Files
overextended.github.io/assets/js/8cbd576d.d20e5986.js
T

1 line
8.4 KiB
JavaScript

"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7690],{9613:function(e,t,n){n.d(t,{Zo:function(){return s},kt:function(){return f}});var r=n(9496);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),c=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(u.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,u=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),d=c(n),f=a,m=d["".concat(u,".").concat(f)]||d[f]||p[f]||l;return n?r.createElement(m,o(o({ref:t},s),{},{components:n})):r.createElement(m,o({ref:t},s))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=d;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var c=2;c<l;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},7640:function(e,t,n){n.d(t,{Z:function(){return o}});var r=n(9496),a=n(1626),l="tabItem_zeWL";function o(e){var t=e.children,n=e.hidden,o=e.className;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(l,o),hidden:n},t)}},866:function(e,t,n){n.d(t,{Z:function(){return f}});var r=n(5443),a=n(9496),l=n(1626),o=n(4252),i=n(1135),u=n(9162),c=n(3946),s="tabList_gs2P",p="tabItem_Ugfh";function d(e){var t,n,o=e.lazy,d=e.block,f=e.defaultValue,m=e.values,b=e.groupId,v=e.className,h=a.Children.map(e.children,(function(e){if((0,a.isValidElement)(e)&&"value"in e.props)return e;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})),g=null!=m?m:h.map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes}})),y=(0,i.l)(g,(function(e,t){return e.value===t.value}));if(y.length>0)throw new Error('Docusaurus error: Duplicate values "'+y.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.');var x=null===f?f:null!=(t=null!=f?f:null==(n=h.find((function(e){return e.props.default})))?void 0:n.props.value)?t:h[0].props.value;if(null!==x&&!g.some((function(e){return e.value===x})))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+x+'" but none of its children has the corresponding value. Available values are: '+g.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");var k=(0,u.U)(),w=k.tabGroupChoices,T=k.setTabGroupChoices,I=(0,a.useState)(x),N=I[0],O=I[1],E=[],C=(0,c.o5)().blockElementScrollPositionUntilNextRender;if(null!=b){var P=w[b];null!=P&&P!==N&&g.some((function(e){return e.value===P}))&&O(P)}var j=function(e){var t=e.currentTarget,n=E.indexOf(t),r=g[n].value;r!==N&&(C(t),O(r),null!=b&&T(b,String(r)))},U=function(e){var t,n=null;switch(e.key){case"ArrowRight":var r,a=E.indexOf(e.currentTarget)+1;n=null!=(r=E[a])?r:E[0];break;case"ArrowLeft":var l,o=E.indexOf(e.currentTarget)-1;n=null!=(l=E[o])?l:E[E.length-1]}null==(t=n)||t.focus()};return a.createElement("div",{className:(0,l.Z)("tabs-container",s)},a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":d},v)},g.map((function(e){var t=e.value,n=e.label,o=e.attributes;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:N===t?0:-1,"aria-selected":N===t,key:t,ref:function(e){return E.push(e)},onKeyDown:U,onFocus:j,onClick:j},o,{className:(0,l.Z)("tabs__item",p,null==o?void 0:o.className,{"tabs__item--active":N===t})}),null!=n?n:t)}))),o?(0,a.cloneElement)(h.filter((function(e){return e.props.value===N}))[0],{className:"margin-top--md"}):a.createElement("div",{className:"margin-top--md"},h.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==N})}))))}function f(e){var t=(0,o.Z)();return a.createElement(d,(0,r.Z)({key:String(t)},e))}},5332:function(e,t,n){n.r(t),n.d(t,{assets:function(){return d},contentTitle:function(){return s},default:function(){return b},frontMatter:function(){return c},metadata:function(){return p},toc:function(){return f}});var r=n(5443),a=n(3010),l=(n(9496),n(9613)),o=n(866),i=n(7640),u=["components"],c={title:"TextUI"},s=void 0,p={unversionedId:"ox_lib/Interface/Client/textui",id:"ox_lib/Interface/Client/textui",title:"TextUI",description:"lib.showTextUI",source:"@site/docs/ox_lib/Interface/Client/textui.md",sourceDirName:"ox_lib/Interface/Client",slug:"/ox_lib/Interface/Client/textui",permalink:"/docs/ox_lib/Interface/Client/textui",draft:!1,editUrl:"https://github.com/overextended/overextended.github.io/tree/main/docs/ox_lib/Interface/Client/textui.md",tags:[],version:"current",frontMatter:{title:"TextUI"},sidebar:"docs",previous:{title:"Progress",permalink:"/docs/ox_lib/Interface/Client/progress"},next:{title:"Shared",permalink:"/docs/ox_lib/Locale/Shared"}},d={},f=[{value:"lib.showTextUI",id:"libshowtextui",level:3},{value:"lib.hideTextUI",id:"libhidetextui",level:3}],m={toc:f};function b(e){var t=e.components,n=(0,a.Z)(e,u);return(0,l.kt)("wrapper",(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h3",{id:"libshowtextui"},"lib.showTextUI"),(0,l.kt)("p",null,"Show the TextUI window."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"DO NOT")," run this every tick, it's intented to be used as a toggle."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-lua"},'-- text: string\n-- options: table (optional)\n -- position: "right-center" or "left-center" or "top-center" (default - "right-center")\n -- icon: string or table\n -- iconColor: string\n -- style: React.CSSProperties\nlib.showTextUI(text, options)\n')),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example:")),(0,l.kt)(o.Z,{mdxType:"Tabs"},(0,l.kt)(i.Z,{label:"Basic",value:"basic",mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-lua"},"lib.showTextUI('[E] - Fuel vehicle')\n")),(0,l.kt)("p",null,(0,l.kt)("img",{parentName:"p",src:"https://i.imgur.com/3ptQyAq.png",alt:null}))),(0,l.kt)(i.Z,{label:"Custom style",value:"custom",mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-lua"},"lib.showTextUI('[E] - Pick apple', {\n position = \"top-center\",\n icon = 'hand',\n style = {\n borderRadius = 0,\n backgroundColor = '#48BB78',\n color = 'white'\n }\n})\n")),(0,l.kt)("p",null,(0,l.kt)("img",{parentName:"p",src:"https://i.imgur.com/gNDwPBN.png",alt:null})))),(0,l.kt)("p",null,"The icon library used is Font Awesome 6.0, if for the icon you define only a string\nthe default icon type will be ",(0,l.kt)("inlineCode",{parentName:"p"},"solid"),".",(0,l.kt)("br",{parentName:"p"}),"\n","If you want to use a different icon type, i.e\napple as a brand, you need to define icon as a table with the first value being\nthe icon type as a string, and the second being the icon name."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"icon = {'fab', 'apple'}")),(0,l.kt)("h3",{id:"libhidetextui"},"lib.hideTextUI"),(0,l.kt)("p",null,"Hides the currently visible TextUI window"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-lua"},"lib.hideTextUI()\n")))}b.isMDXComponent=!0}}]);