@oliasoft-open-source/react-ui-library 4.7.1 → 4.8.0-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{index-D5kcnHmD.js → index-DYGOUZH8.js} +0 -1
- package/dist/global.css +4 -1
- package/dist/index.d.ts +16 -6
- package/dist/index.html +1 -1
- package/dist/index.js +121 -158
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/{Color-KGDBMAHA-ChInQPtm.js → Color-KGDBMAHA-TfNjzFol.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-PKQXORMH-D9jeh5x5.js → DocsRenderer-PKQXORMH-CvKaIyAS.js} +1 -1
- package/dist/storybook/assets/{accordion.stories-sb-Y7MMb.js → accordion.stories-CbUgpQAC.js} +1 -1
- package/dist/storybook/assets/{afe.stories--E_j7kET.js → afe.stories-3nCmEH0q.js} +1 -1
- package/dist/storybook/assets/{buttons-and-links-CGABKYuN.js → buttons-and-links-DQXhygpA.js} +1 -1
- package/dist/storybook/assets/{casing-loads.stories-EZlP6XsN.js → casing-loads.stories-CSdj5faI.js} +1 -1
- package/dist/storybook/assets/{cell.stories-D9KrTmCA.js → cell.stories-DBLJ17se.js} +1 -1
- package/dist/storybook/assets/{chunk-HLWAVYOI-4dAs2eBm.js → chunk-HLWAVYOI-C9RjJIQI.js} +1 -1
- package/dist/storybook/assets/{color-Bif_5nQw.js → color-DiLYh1iE.js} +1 -1
- package/dist/storybook/assets/{footer.stories-B5zvZawz.js → footer.stories-CpsfxWaj.js} +1 -1
- package/dist/storybook/assets/{form.stories-D58sdhOk.js → form.stories-CqFk9g40.js} +1 -1
- package/dist/storybook/assets/{formation.stories-OtA8Hcp6.js → formation.stories-DN4l7-9g.js} +1 -1
- package/dist/storybook/assets/iframe-CeeVOkcX.js +2 -0
- package/dist/storybook/assets/{index-CdEG3ntG.js → index-B9Xm8jXL.js} +1 -1
- package/dist/storybook/assets/{index-0mVwGqNm.js → index-BesoTaoD.js} +4 -4
- package/dist/storybook/assets/{index-DQs5XS8h.js → index-DGl0obec.js} +1 -1
- package/dist/storybook/assets/{input-group.stories-hHCmTbtu.js → input-group.stories-DctjyXor.js} +1 -1
- package/dist/storybook/assets/{input-validation-DGRN9eyS.js → input-validation-BVAuiwBg.js} +1 -1
- package/dist/storybook/assets/{inputs-C1zY_c9W.js → inputs-zvgQy7Ef.js} +4 -4
- package/dist/storybook/assets/{layout-forms-kbHRclqK.js → layout-forms-CiP17Xxu.js} +1 -1
- package/dist/storybook/assets/{layout-general-D5EVLJYf.js → layout-general-ChpChtZ5.js} +1 -1
- package/dist/storybook/assets/{modal.stories-ChRLG9ud.js → modal.stories-B31R5KLu.js} +1 -1
- package/dist/storybook/assets/number-input-RV1zn3_t.js +4 -0
- package/dist/storybook/assets/number-input.stories-CBser6Ry.js +153 -0
- package/dist/storybook/assets/{padding-and-spacing-BUAWfapl.js → padding-and-spacing-Ds9-kSBv.js} +1 -1
- package/dist/storybook/assets/{pagination-0wY_w1xz.js → pagination-BA9mb3NP.js} +1 -1
- package/dist/storybook/assets/{pagination.stories-BagAIIz3.js → pagination.stories-2HPZnimC.js} +1 -1
- package/dist/storybook/assets/{popover.stories-ChwzGOlc.js → popover.stories-SMz7Cd0A.js} +1 -1
- package/dist/storybook/assets/{preview-C_kotj1_.js → preview-AeyuE7NC.js} +2 -2
- package/dist/storybook/assets/{preview-BZH-CnkP.js → preview-craejBWr.js} +1 -1
- package/dist/storybook/assets/{reservoirs.stories-DywuU8EY.js → reservoirs.stories-D_HCj-TY.js} +1 -1
- package/dist/storybook/assets/{rich-text-input.stories-Cw_6EJx8.js → rich-text-input.stories-rQEM-l57.js} +1 -1
- package/dist/storybook/assets/{row.stories-D7V0fxhq.js → row.stories-BHz3vX8n.js} +1 -1
- package/dist/storybook/assets/{select-yqiMF9-4.js → select-BPp24Pdw.js} +1 -1
- package/dist/storybook/assets/{select.stories-VMcOn7Ri.js → select.stories-hyJTR9B_.js} +1 -1
- package/dist/storybook/assets/{smart-upload-modal.stories-Cot88l9r.js → smart-upload-modal.stories-01X4DGpB.js} +1 -1
- package/dist/storybook/assets/{table-DmwpXp_Q.js → table-CWxrvmPS.js} +1 -1
- package/dist/storybook/assets/{table.stories-DKcZk5JR.js → table.stories-DXq-XP56.js} +1 -1
- package/dist/storybook/assets/{title.stories-CKbl0CB2.js → title.stories-D2obDA1k.js} +1 -1
- package/dist/storybook/assets/unit-input-5P4Cogho.css +1 -0
- package/dist/storybook/assets/unit-input.stories-CEzR1Pvn.js +354 -0
- package/dist/storybook/assets/unit-table.stories-CWGzy_cE.js +150 -0
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/package.json +1 -1
- package/dist/404.html +0 -1
- package/dist/storybook/assets/iframe-CPU35noh.js +0 -2
- package/dist/storybook/assets/number-input-B-Nmya5O.js +0 -4
- package/dist/storybook/assets/number-input.stories-COWyMRAs.js +0 -97
- package/dist/storybook/assets/unit-input-CoFS2qhN.css +0 -1
- package/dist/storybook/assets/unit-input.stories-BkkknmTW.js +0 -290
- package/dist/storybook/assets/unit-table.stories-BoNWlaAe.js +0 -150
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as s}from"./index-BcNHZKhG.js";import{Z as r,$ as n}from"./index-
|
|
1
|
+
import{j as e}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as s}from"./index-BcNHZKhG.js";import{Z as r,$ as n}from"./index-BesoTaoD.js";import{Center as d,SpaceBetween as l,JustifyEnd as a,Column as c}from"./flex.stories-CT6o2gii.js";import{Default as h,CustomColumnWidth as p,DefaultGap as x,CustomGap as m,Responsive as u}from"./grid.stories-BhjMGl59.js";import{Default as j,FixedWidth as f,NoPadding as w,ResponsiveWidth as g}from"./column.stories-rKyxUTAG.js";import"./index-DhsZuJvc.js";import"./iframe-CeeVOkcX.js";import"../sb-preview/runtime.js";import"./index-CUZDtIZe.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";import"./flex-EllkLxgO.js";import"./button-CdEIDAx8.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./index-CEuq6vkz.js";import"./tooltip-C_E_6ym5.js";import"./text-B3-TSWok.js";import"./grid-B6LFPf51.js";import"./styled-components.browser.esm-Bf0q9Yjk.js";import"./card-EcjmryU9.js";import"./row-4iAGREkV.js";import"./heading-EzI5s4VN.js";import"./help-icon-CfV3_Ais.js";function t(i){const o={code:"code",h1:"h1",h2:"h2",h3:"h3",p:"p",...s(),...i.components};return e.jsxs(e.Fragment,{children:[e.jsx(r,{title:"Layout (General)"}),`
|
|
2
2
|
`,e.jsx(o.h1,{id:"layout-general",children:"Layout (General)"}),`
|
|
3
3
|
`,e.jsx(o.h2,{id:"flex",children:"Flex"}),`
|
|
4
4
|
`,e.jsxs(o.p,{children:["The ",e.jsx(o.code,{children:"Flex"})," component is a basic flexbox wrapper with optional props for ",e.jsx(o.code,{children:"alignItems"}),", ",e.jsx(o.code,{children:"justifyContent"})," and ",e.jsx(o.code,{children:"flexDirection"}),". This is a conveninent way to center items vertically and/or horizontally, to align them to opposite edges, or align them to the far side."]}),`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as h}from"./index-DhsZuJvc.js";import{T as X}from"./common-types-Sih75Sav.js";import{M,D as C}from"./dialog-B-R6eAnf.js";import{B as o}from"./button-CdEIDAx8.js";import{P as Z}from"./popover-CvS_kBVF.js";import{I as Q}from"./input-D97ganXq.js";import{I as $}from"./input-group-BaRSJAEN.js";import{F as j}from"./field-nInV3MuR.js";import{M as ee}from"./actions-4w-EOz3m.js";import{S as oe}from"./select-
|
|
1
|
+
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as h}from"./index-DhsZuJvc.js";import{T as X}from"./common-types-Sih75Sav.js";import{M,D as C}from"./dialog-B-R6eAnf.js";import{B as o}from"./button-CdEIDAx8.js";import{P as Z}from"./popover-CvS_kBVF.js";import{I as Q}from"./input-D97ganXq.js";import{I as $}from"./input-group-BaRSJAEN.js";import{F as j}from"./field-nInV3MuR.js";import{M as ee}from"./actions-4w-EOz3m.js";import{S as oe}from"./select-BPp24Pdw.js";import{S as le}from"./spacer-BWoNR27H.js";import{T as ne}from"./tooltip-C_E_6ym5.js";import{M as k}from"./types-BmbYqTX_.js";import"./index-Bk2sglWO.js";import"./portal-GQ0_cLB6.js";import"./index-CUZDtIZe.js";import"./lodash-BHd_uQHh.js";import"./heading-EzI5s4VN.js";import"./help-icon-CfV3_Ais.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./spinner-AWUe4xwQ.js";import"./types-UmZ4Y_CR.js";import"./label-Cz6TT90s.js";import"./badge-CLQ59MDF.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./text-B3-TSWok.js";import"./select.input-DIKP56UZ.js";const{useArgs:se}=__STORYBOOK_MODULE_PREVIEW_API__,Ne={title:"Modals/Modal",component:M,args:{visible:!0,centered:!0,width:"300px",heading:"Are you sure?",content:e.jsx(e.Fragment,{children:"This will complete the transaction"}),footer:e.jsxs(e.Fragment,{children:[e.jsx(o,{label:"Okay",colored:!0,onClick:()=>{}}),e.jsx(o,{label:"Cancel",onClick:()=>{}})]}),onClose:()=>{}},parameters:{docs:{story:{inline:!1,iframeHeight:400}}}},a=()=>{const[{visible:n,centered:r,...s},l]=se(),t=()=>{l({visible:!n})};return e.jsxs(e.Fragment,{children:[e.jsx(M,{visible:n,centered:r,children:e.jsx(C,{dialog:{...s,onClose:t}})}),e.jsx(o,{label:"Open Modal",onClick:t})]})},v=a.bind({}),i=a.bind({});i.args={centered:!0};const d=a.bind({});d.args={content:["This is a","new line!"]};const c=a.bind({});c.args={scroll:!0,content:e.jsx("div",{children:"Example modal content goes here lorem ipsum. ".repeat(100)})};const g=a.bind({});g.args={width:"100%",content:e.jsx("div",{children:"Example modal content goes here lorem ipsum. ".repeat(100)})};const p=a.bind({});p.args={contentPadding:0};const m=a.bind({});m.args={content:e.jsxs(e.Fragment,{children:[e.jsx(ne,{text:"Tooltip text",children:"Hover for tooltip"}),e.jsx(le,{}),e.jsx(j,{label:"Custom Select",helpText:"Select an animal",children:e.jsx(oe,{name:"example",options:["Aardvarks","Kangaroos","Monkeys","Possums","Gorilla","Puma","Patagonian Mara","Tarsier","Koala","Panda","Red Panda","Impala","Tiger","Crocodile","Bat"],onChange:()=>{},value:"Monkeys",error:"Bad value"})}),e.jsx(j,{label:"Nested Menu",children:e.jsx(ee,{maxHeight:"240px",menu:{label:"Menu",trigger:X.DROP_DOWN_BUTTON,sections:[{type:k.MENU,menu:{trigger:"Text",label:"Children",sections:[...Array(100).keys()].map(()=>({type:"Option",label:Math.random().toString(36).substring(7),onClick:()=>{}}))}},...[...Array(100).keys()].map(()=>({type:k.OPTION,label:Math.random().toString(36).substring(7),onClick:()=>{}}))]}})}),e.jsx(Z,{content:e.jsxs($,{small:!0,children:[e.jsx(Q,{value:"Value",width:"150px",error:"Bad value"}),e.jsx(o,{colored:!0,label:"Save",onClick:()=>{}}),e.jsx(o,{label:"Cancel",onClick:()=>{}})]}),children:e.jsx(o,{colored:!0,label:"Toggle me",onClick:()=>{}})})]})};const u=()=>{const[n,r]=h.useState(!1),s=()=>{r(!0)},l=()=>{r(!1)},t=()=>{console.log("Submit action"),l()};return e.jsxs(e.Fragment,{children:[e.jsx(M,{visible:n,onEnter:()=>{console.log("Enter"),t()},onEscape:()=>{console.log("Escape"),l()},children:e.jsx(C,{dialog:{heading:"Test key handling",content:e.jsx(Q,{}),footer:e.jsxs(e.Fragment,{children:[e.jsx(o,{label:"Done",colored:"red",onClick:t}),e.jsx(o,{label:"Cancel",onClick:l})]}),onClose:l}})}),e.jsx(o,{label:"Open Modal",onClick:s})]})},b=()=>{const[n,r]=h.useState(!1),s=()=>r(!n),[l,t]=h.useState(!1),x=()=>t(!l);return e.jsxs(e.Fragment,{children:[e.jsx(M,{visible:n,children:e.jsx(C,{dialog:{heading:"Modal 1",content:"Lorem ipsum dolor sit amet",footer:e.jsxs(e.Fragment,{children:[e.jsx(o,{label:"Open modal 2",colored:!0,onClick:x}),e.jsx(M,{visible:l,children:e.jsx(C,{dialog:{heading:"Modal 2",content:"Lorem ipsum dolor sit amet",footer:e.jsx(o,{label:"Close",onClick:x}),onClose:x}})}),e.jsx(o,{label:"Close",onClick:s})]}),onClose:s}})}),e.jsx(o,{label:"Open modal 1",onClick:s})]})};u.__docgenInfo={description:"",methods:[],displayName:"KeyHandle"};b.__docgenInfo={description:"",methods:[],displayName:"MultipleModals"};var f,S,P;v.parameters={...v.parameters,docs:{...(f=v.parameters)==null?void 0:f.docs,source:{originalSource:`() => {
|
|
2
2
|
const [{
|
|
3
3
|
visible,
|
|
4
4
|
centered,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{j as V}from"./jsx-runtime-eps93zm2.js";import{r as a}from"./index-DhsZuJvc.js";import{d as m}from"./index-DGl0obec.js";import{K as J,E as Q}from"./select-BPp24Pdw.js";import{l as X}from"./lodash-BHd_uQHh.js";import{I as Y}from"./input-D97ganXq.js";const $=14,ee=n=>m.isScientificStringNum(n)?n:m.roundToPrecision(n,$),ne=n=>n?typeof n=="string"?n:X.isArray(n)?n[0]:n.fieldName:"",te=({name:n,placeholder:c="",disabled:q=!1,error:g=!1,left:w=!1,small:h=!1,width:S="100%",value:d="",onChange:R=()=>{},onFocus:C=()=>{},onBlur:F=()=>{},tabIndex:x=0,testId:M,tooltip:H=null,warning:L=!1,validationCallback:y=()=>{},allowEmpty:j=!1,isInTable:_,groupOrder:K,enableCosmeticRounding:v=!0,enableDisplayRounding:p=!1,roundDisplayValue:T,disableInternalErrorValidationMessages:O=!1})=>{const r=a.useRef(null),[s,E]=a.useState(String(d)),[u,b]=a.useState(!1),[A,k]=a.useState(!0),i=ne(n),B=e=>{const t=m.validateNumber(e);return j&&e===""||t.valid?{...t,valid:!0,errors:void 0}:t},{valid:o,errors:f}=B(s),N=f&&f.length&&!O?f[0]:null;a.useEffect(()=>{E(String(d))},[d,v,p]),a.useEffect(()=>{!u&&!o?y(i,N):y(i,null)},[u,o,g]);const I=e=>{if(o&&!A){const t={...e,target:{...e.target,value:String(s),name:i}};R(t)}},D=e=>{const t=e.target,{value:Z}=t,z=m.cleanNumStr(Z.replaceAll(" ","").replaceAll("|",""));E(z),k(!1)};a.useEffect(()=>{if(r&&(r!=null&&r.current)&&p&&u){const e=r.current;e&&setTimeout(()=>{const{length:t}=String(s);e.setSelectionRange(t,t)},0)}},[u]);const P=e=>{b(!0),C(e)},U=e=>{b(!1),I(e),F(e)},l=p&&!u&&o?T?String(T(s)):m.roundToFixed(s,2):s,W=!!(l!=null&&l.endsWith("0")),G=v&&l&&!W&&o?ee(l):l;return V.jsx(J,{handleKeys:[Q.ENTER],onKeyEvent:(e,t)=>I(t),children:V.jsx(Y,{type:"text",name:i,testId:M,disabled:q,placeholder:c,value:G,onChange:D,onFocus:P,onBlur:U,error:!u&&(N||g),warning:L,right:!w,small:h,width:S,isInTable:_,groupOrder:K,tabIndex:x,tooltip:H,ref:r},i)})};te.__docgenInfo={description:"",methods:[],displayName:"NumberInput",props:{name:{required:!1,tsType:{name:"union",raw:"string | { fieldName: string }",elements:[{name:"string"},{name:"signature",type:"object",raw:"{ fieldName: string }",signature:{properties:[{key:"fieldName",value:{name:"string",required:!0}}]}}]},description:""},placeholder:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"''",computed:!1}},disabled:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},error:{required:!1,tsType:{name:"union",raw:"string | boolean",elements:[{name:"string"},{name:"boolean"}]},description:"",defaultValue:{value:"false",computed:!1}},left:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},small:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},width:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:"",defaultValue:{value:"'100%'",computed:!1}},value:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:"",defaultValue:{value:"''",computed:!1}},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: ChangeEvent<HTMLInputElement>) => void",signature:{arguments:[{type:{name:"ChangeEvent",elements:[{name:"HTMLInputElement"}],raw:"ChangeEvent<HTMLInputElement>"},name:"evt"}],return:{name:"void"}}},description:"",defaultValue:{value:"() => {}",computed:!1}},onFocus:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: FocusEvent<HTMLInputElement>) => void",signature:{arguments:[{type:{name:"FocusEvent",elements:[{name:"HTMLInputElement"}],raw:"FocusEvent<HTMLInputElement>"},name:"evt"}],return:{name:"void"}}},description:"",defaultValue:{value:"() => {}",computed:!1}},onBlur:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: FocusEvent<HTMLInputElement>) => void",signature:{arguments:[{type:{name:"FocusEvent",elements:[{name:"HTMLInputElement"}],raw:"FocusEvent<HTMLInputElement>"},name:"evt"}],return:{name:"void"}}},description:"",defaultValue:{value:"() => {}",computed:!1}},tabIndex:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"0",computed:!1}},testId:{required:!1,tsType:{name:"string"},description:""},tooltip:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | React.ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactReactNode",raw:"React.ReactNode"}]},description:"",defaultValue:{value:"null",computed:!1}},warning:{required:!1,tsType:{name:"union",raw:"string | boolean",elements:[{name:"string"},{name:"boolean"}]},description:"",defaultValue:{value:"false",computed:!1}},validationCallback:{required:!1,tsType:{name:"signature",type:"function",raw:`(
|
|
2
|
+
name: string | { fieldName: string },
|
|
3
|
+
error: string | null,
|
|
4
|
+
) => void`,signature:{arguments:[{type:{name:"union",raw:"string | { fieldName: string }",elements:[{name:"string"},{name:"signature",type:"object",raw:"{ fieldName: string }",signature:{properties:[{key:"fieldName",value:{name:"string",required:!0}}]}}]},name:"name"},{type:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},name:"error"}],return:{name:"void"}}},description:"",defaultValue:{value:"() => {}",computed:!1}},allowEmpty:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},isInTable:{required:!1,tsType:{name:"boolean"},description:""},groupOrder:{required:!1,tsType:{name:"any"},description:""},enableCosmeticRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},enableDisplayRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},roundDisplayValue:{required:!1,tsType:{name:"signature",type:"function",raw:"(args: TStringNumberNull) => TStringNumberNull",signature:{arguments:[{type:{name:"union",raw:"string | number | null",elements:[{name:"string"},{name:"number"},{name:"null"}]},name:"args"}],return:{name:"union",raw:"string | number | null",elements:[{name:"string"},{name:"number"},{name:"null"}]}}},description:""},disableInternalErrorValidationMessages:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}}}};export{te as N,ee as r};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as d}from"./index-DhsZuJvc.js";import{d as Ae}from"./index-DGl0obec.js";import{S as T}from"./spacer-BWoNR27H.js";import{G as Ee}from"./grid-B6LFPf51.js";import{F as y}from"./field-nInV3MuR.js";import{T as _}from"./toggle-D0yzyALV.js";import{I as Re}from"./input-group-BaRSJAEN.js";import{I as je}from"./input-group-addon-D68iUKV2.js";import{S as Te}from"./select-BPp24Pdw.js";import{C as s}from"./card-EcjmryU9.js";import{B as xe}from"./button-CdEIDAx8.js";import{H as o}from"./heading-EzI5s4VN.js";import{T as Ne}from"./text-B3-TSWok.js";import{M as Me}from"./message-ZenLdkrf.js";import{N as u}from"./number-input-RV1zn3_t.js";import"./index-DRSy5Ssd.js";import"./styled-components.browser.esm-Bf0q9Yjk.js";import"./index-Bk2sglWO.js";import"./label-Cz6TT90s.js";import"./common-types-Sih75Sav.js";import"./help-icon-CfV3_Ais.js";import"./tooltip-C_E_6ym5.js";import"./index-CUZDtIZe.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./types-UmZ4Y_CR.js";import"./lodash-BHd_uQHh.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./actions-4w-EOz3m.js";import"./badge-CLQ59MDF.js";import"./select.input-DIKP56UZ.js";import"./spinner-AWUe4xwQ.js";import"./input-D97ganXq.js";const{useArgs:ye}=__STORYBOOK_MODULE_PREVIEW_API__,va={title:"Forms/NumberInput",component:u,parameters:{canvas:{page:null}},args:{label:"Label"}},a=n=>{const[l,t]=ye(),R=i=>{t({value:i.target.value})};return e.jsx(u,{onChange:R,value:123,...n})},A=a.bind({}),g=a.bind({});g.args={small:!0};const c=a.bind({});c.args={width:"150px"};const p=a.bind({});p.args={left:!0};const m=a.bind({});m.args={disabled:!0};const h=a.bind({});h.args={allowEmpty:!0,value:""};const v=a.bind({});v.args={warning:"This input number is almost 100!",value:"99"};const C=a.bind({});C.args={error:"This is a error message"};const b=a.bind({});b.args={value:"123test"};const I=a.bind({});I.args={value:"123.123456789",enableDisplayRounding:!0};const E=a.bind({});E.args={value:"123.123456789",enableDisplayRounding:!0,roundDisplayValue:n=>Ae.roundToFixed(n,4)};const x=()=>e.jsxs(Re,{small:!0,children:[e.jsx(u,{value:123}),e.jsx(je,{children:"to"}),e.jsx(u,{value:123}),e.jsx(Te,{options:[{value:"units",label:"units"}],width:"auto",value:"units"})]}),S=()=>{const[n,l]=d.useState("123");return e.jsxs(Ee,{columns:"1fr 1fr",gap:!0,children:[e.jsxs(s,{heading:e.jsx(o,{children:"Storage State (Redux)"}),children:[n,e.jsx(T,{}),e.jsx(xe,{label:"Change value",onClick:()=>l(String(Math.floor(Math.random()*100)))})]}),e.jsx(s,{heading:e.jsx(o,{children:"NumberInput"}),children:e.jsx(u,{value:n,onChange:t=>{l(t.target.value)},error:Number(n)>=0?"":"Value must be positive"})})]})},f=()=>{const[n,l]=d.useState(!1),[t,R]=d.useState(!0),[i,N]=d.useState("0.6889763779527558"),[M,Se]=d.useState(""),fe=Number(i)*.3048;return e.jsxs(Ee,{columns:"1fr 1fr",gap:!0,children:[e.jsxs(s,{heading:e.jsx(o,{children:"Settings"}),children:[e.jsx(y,{label:"Enable display rounding:",labelLeft:!0,labelWidth:200,children:e.jsx(_,{checked:n,onChange:r=>l(r.target.checked)})}),e.jsx(y,{label:"Enable cosmetic rounding:",labelLeft:!0,labelWidth:200,children:e.jsx(_,{checked:t,onChange:r=>R(r.target.checked)})})]}),e.jsxs(s,{heading:e.jsx(o,{children:"NumberInput (displayed in Meters)"}),children:[e.jsx(Ne,{faint:!0,children:"Cosmetic Rounding Test Cases: type 0.21 then return (compare with enableCosmeticRounding on and off)"}),e.jsx(T,{}),e.jsx(u,{name:"Example",value:fe,onChange:r=>{const j=String(Number(r.target.value)/.3048);N(j)},enableDisplayRounding:n,enableCosmeticRounding:t,error:Number(i)>=0?"":"Value must be positive",validationCallback:(r,j)=>{Se(j??"")}})]}),e.jsxs(s,{heading:e.jsx(o,{children:"Storage State / Redux (stored in Feet)"}),children:[i,e.jsx(T,{}),e.jsx(xe,{label:"Change value",onClick:()=>N(String(Math.floor(Math.random()*100)))})]}),e.jsx(s,{heading:e.jsx(o,{children:"Test Validation Callback"}),children:M&&e.jsx(Me,{message:{content:M,icon:!0,type:"Error",visible:!0}})})]})};x.__docgenInfo={description:"",methods:[],displayName:"TestInputGroup"};S.__docgenInfo={description:"",methods:[],displayName:"ManagedTestCase"};f.__docgenInfo={description:"",methods:[],displayName:"DemoCosmeticRounding"};var H,k,D;A.parameters={...A.parameters,docs:{...(H=A.parameters)==null?void 0:H.docs,source:{originalSource:`args => {
|
|
2
|
+
const [_, updateArgs] = useArgs();
|
|
3
|
+
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
|
|
4
|
+
updateArgs({
|
|
5
|
+
value: evt.target.value
|
|
6
|
+
});
|
|
7
|
+
};
|
|
8
|
+
return <NumberInput onChange={handleChange} value={123} {...args} />;
|
|
9
|
+
}`,...(D=(k=A.parameters)==null?void 0:k.docs)==null?void 0:D.source}}};var F,L,V;g.parameters={...g.parameters,docs:{...(F=g.parameters)==null?void 0:F.docs,source:{originalSource:`args => {
|
|
10
|
+
const [_, updateArgs] = useArgs();
|
|
11
|
+
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
|
|
12
|
+
updateArgs({
|
|
13
|
+
value: evt.target.value
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
return <NumberInput onChange={handleChange} value={123} {...args} />;
|
|
17
|
+
}`,...(V=(L=g.parameters)==null?void 0:L.docs)==null?void 0:V.source}}};var G,B,W;c.parameters={...c.parameters,docs:{...(G=c.parameters)==null?void 0:G.docs,source:{originalSource:`args => {
|
|
18
|
+
const [_, updateArgs] = useArgs();
|
|
19
|
+
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
|
|
20
|
+
updateArgs({
|
|
21
|
+
value: evt.target.value
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
return <NumberInput onChange={handleChange} value={123} {...args} />;
|
|
25
|
+
}`,...(W=(B=c.parameters)==null?void 0:B.docs)==null?void 0:W.source}}};var w,O,P;p.parameters={...p.parameters,docs:{...(w=p.parameters)==null?void 0:w.docs,source:{originalSource:`args => {
|
|
26
|
+
const [_, updateArgs] = useArgs();
|
|
27
|
+
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
|
|
28
|
+
updateArgs({
|
|
29
|
+
value: evt.target.value
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
return <NumberInput onChange={handleChange} value={123} {...args} />;
|
|
33
|
+
}`,...(P=(O=p.parameters)==null?void 0:O.docs)==null?void 0:P.source}}};var K,U,Y;m.parameters={...m.parameters,docs:{...(K=m.parameters)==null?void 0:K.docs,source:{originalSource:`args => {
|
|
34
|
+
const [_, updateArgs] = useArgs();
|
|
35
|
+
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
|
|
36
|
+
updateArgs({
|
|
37
|
+
value: evt.target.value
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
return <NumberInput onChange={handleChange} value={123} {...args} />;
|
|
41
|
+
}`,...(Y=(U=m.parameters)==null?void 0:U.docs)==null?void 0:Y.source}}};var q,z,J;h.parameters={...h.parameters,docs:{...(q=h.parameters)==null?void 0:q.docs,source:{originalSource:`args => {
|
|
42
|
+
const [_, updateArgs] = useArgs();
|
|
43
|
+
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
|
|
44
|
+
updateArgs({
|
|
45
|
+
value: evt.target.value
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
return <NumberInput onChange={handleChange} value={123} {...args} />;
|
|
49
|
+
}`,...(J=(z=h.parameters)==null?void 0:z.docs)==null?void 0:J.source}}};var Q,X,Z;v.parameters={...v.parameters,docs:{...(Q=v.parameters)==null?void 0:Q.docs,source:{originalSource:`args => {
|
|
50
|
+
const [_, updateArgs] = useArgs();
|
|
51
|
+
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
|
|
52
|
+
updateArgs({
|
|
53
|
+
value: evt.target.value
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
return <NumberInput onChange={handleChange} value={123} {...args} />;
|
|
57
|
+
}`,...(Z=(X=v.parameters)==null?void 0:X.docs)==null?void 0:Z.source}}};var $,ee,ae;C.parameters={...C.parameters,docs:{...($=C.parameters)==null?void 0:$.docs,source:{originalSource:`args => {
|
|
58
|
+
const [_, updateArgs] = useArgs();
|
|
59
|
+
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
|
|
60
|
+
updateArgs({
|
|
61
|
+
value: evt.target.value
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
return <NumberInput onChange={handleChange} value={123} {...args} />;
|
|
65
|
+
}`,...(ae=(ee=C.parameters)==null?void 0:ee.docs)==null?void 0:ae.source}}};var ne,te,re;b.parameters={...b.parameters,docs:{...(ne=b.parameters)==null?void 0:ne.docs,source:{originalSource:`args => {
|
|
66
|
+
const [_, updateArgs] = useArgs();
|
|
67
|
+
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
|
|
68
|
+
updateArgs({
|
|
69
|
+
value: evt.target.value
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return <NumberInput onChange={handleChange} value={123} {...args} />;
|
|
73
|
+
}`,...(re=(te=b.parameters)==null?void 0:te.docs)==null?void 0:re.source}}};var se,oe,ue;I.parameters={...I.parameters,docs:{...(se=I.parameters)==null?void 0:se.docs,source:{originalSource:`args => {
|
|
74
|
+
const [_, updateArgs] = useArgs();
|
|
75
|
+
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
|
|
76
|
+
updateArgs({
|
|
77
|
+
value: evt.target.value
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
return <NumberInput onChange={handleChange} value={123} {...args} />;
|
|
81
|
+
}`,...(ue=(oe=I.parameters)==null?void 0:oe.docs)==null?void 0:ue.source}}};var le,ie,de;E.parameters={...E.parameters,docs:{...(le=E.parameters)==null?void 0:le.docs,source:{originalSource:`args => {
|
|
82
|
+
const [_, updateArgs] = useArgs();
|
|
83
|
+
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
|
|
84
|
+
updateArgs({
|
|
85
|
+
value: evt.target.value
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
return <NumberInput onChange={handleChange} value={123} {...args} />;
|
|
89
|
+
}`,...(de=(ie=E.parameters)==null?void 0:ie.docs)==null?void 0:de.source}}};var ge,ce,pe;x.parameters={...x.parameters,docs:{...(ge=x.parameters)==null?void 0:ge.docs,source:{originalSource:`() => <InputGroup small>
|
|
90
|
+
<NumberInput value={123} />
|
|
91
|
+
<InputGroupAddon>to</InputGroupAddon>
|
|
92
|
+
<NumberInput value={123} />
|
|
93
|
+
<Select options={[{
|
|
94
|
+
value: 'units',
|
|
95
|
+
label: 'units'
|
|
96
|
+
}]} width="auto" value="units" />
|
|
97
|
+
</InputGroup>`,...(pe=(ce=x.parameters)==null?void 0:ce.docs)==null?void 0:pe.source}}};var me,he,ve;S.parameters={...S.parameters,docs:{...(me=S.parameters)==null?void 0:me.docs,source:{originalSource:`() => {
|
|
98
|
+
const [value, setValue] = useState('123');
|
|
99
|
+
return <Grid columns="1fr 1fr" gap>
|
|
100
|
+
<Card heading={<Heading>Storage State (Redux)</Heading>}>
|
|
101
|
+
{value}
|
|
102
|
+
<Spacer />
|
|
103
|
+
<Button label="Change value" onClick={() => setValue(String(Math.floor(Math.random() * 100)))} />
|
|
104
|
+
</Card>
|
|
105
|
+
<Card heading={<Heading>NumberInput</Heading>}>
|
|
106
|
+
<NumberInput value={value} onChange={evt => {
|
|
107
|
+
setValue(evt.target.value);
|
|
108
|
+
}} error={Number(value) >= 0 ? '' : 'Value must be positive'} />
|
|
109
|
+
</Card>
|
|
110
|
+
</Grid>;
|
|
111
|
+
}`,...(ve=(he=S.parameters)==null?void 0:he.docs)==null?void 0:ve.source}}};var Ce,be,Ie;f.parameters={...f.parameters,docs:{...(Ce=f.parameters)==null?void 0:Ce.docs,source:{originalSource:`() => {
|
|
112
|
+
const [enableDisplayRounding, setEnableDisplayRounding] = useState(false);
|
|
113
|
+
const [enableCosmeticRounding, setEnableCosmeticRounding] = useState(true);
|
|
114
|
+
const [valueInFeet, setValueInFeet] = useState('0.6889763779527558');
|
|
115
|
+
const [callBackError, setCallBackError] = useState('');
|
|
116
|
+
const valueInMeters = Number(valueInFeet) * 0.3048;
|
|
117
|
+
return <Grid columns="1fr 1fr" gap>
|
|
118
|
+
<Card heading={<Heading>Settings</Heading>}>
|
|
119
|
+
<Field label="Enable display rounding:" labelLeft labelWidth={200}>
|
|
120
|
+
<Toggle checked={enableDisplayRounding} onChange={evt => setEnableDisplayRounding(evt.target.checked)} />
|
|
121
|
+
</Field>
|
|
122
|
+
<Field label="Enable cosmetic rounding:" labelLeft labelWidth={200}>
|
|
123
|
+
<Toggle checked={enableCosmeticRounding} onChange={evt => setEnableCosmeticRounding(evt.target.checked)} />
|
|
124
|
+
</Field>
|
|
125
|
+
</Card>
|
|
126
|
+
<Card heading={<Heading>NumberInput (displayed in Meters)</Heading>}>
|
|
127
|
+
<Text faint>
|
|
128
|
+
Cosmetic Rounding Test Cases: type 0.21 then return (compare with
|
|
129
|
+
enableCosmeticRounding on and off)
|
|
130
|
+
</Text>
|
|
131
|
+
<Spacer />
|
|
132
|
+
<NumberInput name="Example" value={valueInMeters} onChange={evt => {
|
|
133
|
+
const nextValueInFeet = String(Number(evt.target.value) / 0.3048);
|
|
134
|
+
setValueInFeet(nextValueInFeet); // convert back to ft
|
|
135
|
+
}} enableDisplayRounding={enableDisplayRounding} enableCosmeticRounding={enableCosmeticRounding} error={Number(valueInFeet) >= 0 ? '' : 'Value must be positive'} validationCallback={(name, error) => {
|
|
136
|
+
setCallBackError(error ?? '');
|
|
137
|
+
}} />
|
|
138
|
+
</Card>
|
|
139
|
+
<Card heading={<Heading>Storage State / Redux (stored in Feet)</Heading>}>
|
|
140
|
+
{valueInFeet}
|
|
141
|
+
<Spacer />
|
|
142
|
+
<Button label="Change value" onClick={() => setValueInFeet(String(Math.floor(Math.random() * 100)))} />
|
|
143
|
+
</Card>
|
|
144
|
+
<Card heading={<Heading>Test Validation Callback</Heading>}>
|
|
145
|
+
{callBackError && <Message message={{
|
|
146
|
+
content: callBackError,
|
|
147
|
+
icon: true,
|
|
148
|
+
type: 'Error',
|
|
149
|
+
visible: true
|
|
150
|
+
}} />}
|
|
151
|
+
</Card>
|
|
152
|
+
</Grid>;
|
|
153
|
+
}`,...(Ie=(be=f.parameters)==null?void 0:be.docs)==null?void 0:Ie.source}}};const Ca=["Default","Small","Width","Left","Disabled","AllowEmpty","Warning","Error","BadInput","WithDisplayRounding","WithCustomDisplayRounding","TestInputGroup","ManagedTestCase","DemoCosmeticRounding"];export{h as AllowEmpty,b as BadInput,A as Default,f as DemoCosmeticRounding,m as Disabled,C as Error,p as Left,S as ManagedTestCase,g as Small,x as TestInputGroup,v as Warning,c as Width,E as WithCustomDisplayRounding,I as WithDisplayRounding,Ca as __namedExportsOrder,va as default};
|
package/dist/storybook/assets/{padding-and-spacing-BUAWfapl.js → padding-and-spacing-Ds9-kSBv.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as r}from"./index-BcNHZKhG.js";import{Z as t}from"./index-
|
|
1
|
+
import{j as e}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as r}from"./index-BcNHZKhG.js";import{Z as t}from"./index-BesoTaoD.js";import"./index-DhsZuJvc.js";import"./iframe-CeeVOkcX.js";import"../sb-preview/runtime.js";import"./index-CUZDtIZe.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";function i(s){const n={code:"code",h1:"h1",h2:"h2",li:"li",p:"p",strong:"strong",ul:"ul",...r(),...s.components};return e.jsxs(e.Fragment,{children:[e.jsx(t,{title:"Padding, Margin & Size"}),`
|
|
2
2
|
`,e.jsx(n.h1,{id:"padding-margin--size",children:"Padding, Margin & Size"}),`
|
|
3
3
|
`,e.jsx(n.h2,{id:"padding--margin",children:"Padding & Margin"}),`
|
|
4
4
|
`,e.jsx(n.p,{children:"There are standard CSS spacing variables for padding and margin."}),`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-eps93zm2.js";import{r as b}from"./index-DhsZuJvc.js";import{I as l}from"./common-types-Sih75Sav.js";import{S as C}from"./select-
|
|
1
|
+
import{j as o}from"./jsx-runtime-eps93zm2.js";import{r as b}from"./index-DhsZuJvc.js";import{I as l}from"./common-types-Sih75Sav.js";import{S as C}from"./select-BPp24Pdw.js";import{I}from"./input-D97ganXq.js";import{B as p}from"./button-CdEIDAx8.js";import{I as N}from"./input-group-BaRSJAEN.js";import{I as j}from"./input-group-addon-D68iUKV2.js";const E=(n,i)=>i||n&&n.reduce((e,t)=>t.selected?Number(t.value):e,10)||10,_=(n,i)=>{if(!i||!n)return 10;const{options:e,value:t}=i,a=Number(t);return a===0?1:Math.ceil(n/E(e,a))},S=(n,i,e="Selected page must be a positive whole number between 1 and")=>{const t=`${e} ${i}`,a={valid:!0,error:null};return n===""?a:!n.match(/^\d+$/g)||parseInt(n)<=0||parseInt(n)>i?{valid:!1,error:t}:a},P="_paginationContainer_1tmz4_1",R={paginationContainer:P},T=({pagination:n})=>{const{rowCount:i,selectedPage:e,small:t,onSelectPage:a,rowsPerPage:r,errorMessageTemplate:g,testIds:m}=n,d=Number(r==null?void 0:r.value)===0,u=_(i,r),[f,h]=b.useState(String(e));b.useEffect(()=>{h(String(e))},[e]);const{error:v}=S(f,u,g),c=s=>{const{valid:x}=S(s,u,g);h(s),x&&s!==""&&a&&a(Number(s))};return o.jsxs("div",{className:R.paginationContainer,children:[r&&o.jsx("div",{style:{flexShrink:0},children:o.jsx(C,{onChange:s=>{r.onChange&&r.onChange(s),c(String(1))},options:r.options,native:!!r.options,small:t,width:"auto",value:r.value})}),o.jsx(p,{small:t,round:!0,basic:!0,icon:l.CHEVRON_DOUBLE_LEFT,onClick:()=>c(String(1)),disabled:d||e===1}),o.jsx(p,{small:t,round:!0,basic:!0,icon:l.CHEVRON_LEFT,onClick:()=>c(String(Number(e)-1)),disabled:d||e===1}),o.jsxs(N,{small:t,width:"auto",children:[o.jsx(I,{right:!0,value:f,placeholder:String(e),onChange:s=>c(s.target.value),width:"50px",disabled:d||u<=1,error:v}),o.jsxs(j,{children:["of ",u]})]}),o.jsx(p,{small:t,round:!0,basic:!0,icon:l.CHEVRON_RIGHT,onClick:()=>c(String(Number(e)+1)),disabled:d||e===u}),o.jsx(p,{small:t,round:!0,basic:!0,icon:l.CHEVRON_DOUBLE_RIGHT,onClick:()=>c(String(u)),disabled:d||e===u,testId:m==null?void 0:m.doubleRightBtn})]})};T.__docgenInfo={description:"",methods:[],displayName:"Pagination",props:{pagination:{required:!0,tsType:{name:"IPagination"},description:""}}};export{T as P};
|
package/dist/storybook/assets/{pagination.stories-BagAIIz3.js → pagination.stories-2HPZnimC.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as p}from"./jsx-runtime-eps93zm2.js";import{r as l}from"./index-DhsZuJvc.js";import{P as g}from"./pagination-
|
|
1
|
+
import{j as p}from"./jsx-runtime-eps93zm2.js";import{r as l}from"./index-DhsZuJvc.js";import{P as g}from"./pagination-BA9mb3NP.js";import"./common-types-Sih75Sav.js";import"./select-BPp24Pdw.js";import"./index-Bk2sglWO.js";import"./disabled-context-rmpd7YJS.js";import"./types-UmZ4Y_CR.js";import"./lodash-BHd_uQHh.js";import"./tooltip-C_E_6ym5.js";import"./index-CUZDtIZe.js";import"./index-CEuq6vkz.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-4w-EOz3m.js";import"./button-CdEIDAx8.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./badge-CLQ59MDF.js";import"./select.input-DIKP56UZ.js";import"./input-D97ganXq.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";const h={rowCount:500,selectedPage:1,onSelectPage:()=>{}},V={title:"Basic/Pagination",component:g,args:{pagination:h}},n=()=>{const[a,t]=l.useState(1);return p.jsx(g,{pagination:{rowCount:500,selectedPage:a,onSelectPage:o=>t(o)}})},r=()=>{const[a,t]=l.useState(1),[o,i]=l.useState(20);return p.jsx(g,{pagination:{rowCount:500,selectedPage:a,rowsPerPage:{onChange:e=>i(Number(e.target.value)),options:[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],value:o},onSelectPage:e=>t(e)}})},s=()=>{const[a,t]=l.useState(1),[o,i]=l.useState(20);return p.jsx(g,{pagination:{small:!0,rowCount:500,selectedPage:a,rowsPerPage:{onChange:e=>i(Number(e.target.value)),options:[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],value:o},onSelectPage:e=>t(e)}})};n.__docgenInfo={description:"",methods:[],displayName:"Default"};r.__docgenInfo={description:"",methods:[],displayName:"RowsPerPage"};s.__docgenInfo={description:"",methods:[],displayName:"Small"};var P,c,u;n.parameters={...n.parameters,docs:{...(P=n.parameters)==null?void 0:P.docs,source:{originalSource:`() => {
|
|
2
2
|
const [selectedPage, setSelectedPage] = useState(1);
|
|
3
3
|
return <Pagination pagination={{
|
|
4
4
|
rowCount: 500,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as r}from"./jsx-runtime-eps93zm2.js";import{r as k}from"./index-DhsZuJvc.js";import{S as w}from"./spacer-BWoNR27H.js";import{P as i}from"./popover-CvS_kBVF.js";import{I as c}from"./input-D97ganXq.js";import{B as l}from"./button-CdEIDAx8.js";import{F as y}from"./flex-EllkLxgO.js";import{S as D}from"./select-
|
|
1
|
+
import{j as r}from"./jsx-runtime-eps93zm2.js";import{r as k}from"./index-DhsZuJvc.js";import{S as w}from"./spacer-BWoNR27H.js";import{P as i}from"./popover-CvS_kBVF.js";import{I as c}from"./input-D97ganXq.js";import{B as l}from"./button-CdEIDAx8.js";import{F as y}from"./flex-EllkLxgO.js";import{S as D}from"./select-BPp24Pdw.js";import"./tooltip-C_E_6ym5.js";import"./index-CUZDtIZe.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./types-UmZ4Y_CR.js";import"./lodash-BHd_uQHh.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-4w-EOz3m.js";import"./badge-CLQ59MDF.js";import"./select.input-DIKP56UZ.js";const u=[{label:"Option 1",value:"1"},{label:"Option 2",value:"2"}],_=({close:e})=>r.jsxs(y,{gap:"var(--padding-xs)",children:[r.jsx(c,{value:"Value",width:"150px",small:!0}),r.jsx(D,{options:u,value:u[0],width:"auto",small:!0}),r.jsx(l,{colored:!0,label:"Save",onClick:()=>{},small:!0}),r.jsx(l,{label:"Cancel",onClick:e,small:!0})]}),lr={title:"Basic/Popover",component:i,args:{overflowContainer:!0,content:r.jsx(_,{}),children:r.jsx(l,{label:"Toggle me"})},decorators:[e=>r.jsx("div",{style:{display:"flex"},children:e()})],parameters:{docs:{source:{excludeDecorators:!0}}}},n=e=>r.jsx(i,{...e}),p=n.bind({}),o=n.bind({});o.args={children:r.jsx(c,{value:"Value",width:"100%"})};const s=n.bind({});s.args={closeOnOutsideClick:!1,showCloseButton:!0};const t=n.bind({});t.args={disabled:!0};const a=e=>{const[m,T]=k.useState(!1);return r.jsxs("div",{children:[r.jsx(l,{onClick:()=>T(!m),label:"Toggle Popover Externally"}),r.jsx(w,{}),r.jsx(i,{...e,isOpen:m,children:r.jsx(c,{})})]})};a.__docgenInfo={description:"",methods:[],displayName:"ExternalControl"};var d,g,x;p.parameters={...p.parameters,docs:{...(d=p.parameters)==null?void 0:d.docs,source:{originalSource:"args => <Popover {...args} />",...(x=(g=p.parameters)==null?void 0:g.docs)==null?void 0:x.source}}};var v,f,j;o.parameters={...o.parameters,docs:{...(v=o.parameters)==null?void 0:v.docs,source:{originalSource:"args => <Popover {...args} />",...(j=(f=o.parameters)==null?void 0:f.docs)==null?void 0:j.source}}};var b,S,C;s.parameters={...s.parameters,docs:{...(b=s.parameters)==null?void 0:b.docs,source:{originalSource:"args => <Popover {...args} />",...(C=(S=s.parameters)==null?void 0:S.docs)==null?void 0:C.source}}};var O,h,P;t.parameters={...t.parameters,docs:{...(O=t.parameters)==null?void 0:O.docs,source:{originalSource:"args => <Popover {...args} />",...(P=(h=t.parameters)==null?void 0:h.docs)==null?void 0:P.source}}};var I,E,B;a.parameters={...a.parameters,docs:{...(I=a.parameters)==null?void 0:I.docs,source:{originalSource:`args => {
|
|
2
2
|
const [isOpen, setIsOpen] = useState(false);
|
|
3
3
|
return <div>
|
|
4
4
|
<Button onClick={() => setIsOpen(!isOpen)} label="Toggle Popover Externally" />
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DocsRenderer-PKQXORMH-
|
|
2
|
-
import{_ as a}from"./iframe-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DocsRenderer-PKQXORMH-CvKaIyAS.js","./chunk-HLWAVYOI-C9RjJIQI.js","./iframe-CeeVOkcX.js","./index-DhsZuJvc.js","./react-16-DXAfArL2.js","./index-CUZDtIZe.js","./index-BesoTaoD.js","./inheritsLoose-DP0QEDDI.js","./assertThisInitialized-B9jnkVVz.js","./index-D6rZ4wEC.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as a}from"./iframe-CeeVOkcX.js";import"../sb-preview/runtime.js";const{global:s}=__STORYBOOK_MODULE_GLOBAL__;var _=Object.entries(s.TAGS_OPTIONS??{}).reduce((e,r)=>{let[t,o]=r;return o.excludeFromDocsStories&&(e[t]=!0),e},{}),d={docs:{renderer:async()=>{let{DocsRenderer:e}=await a(()=>import("./DocsRenderer-PKQXORMH-CvKaIyAS.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url);return new e},stories:{filter:e=>{var r;return(e.tags||[]).filter(t=>_[t]).length===0&&!((r=e.parameters.docs)!=null&&r.disable)}}}};export{d as parameters};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as s}from"./jsx-runtime-eps93zm2.js";import{r as P,R as C}from"./index-DhsZuJvc.js";import{T as I}from"./toaster-7wnI6hqB.js";import"./message-ZenLdkrf.js";import{a4 as d,a5 as M}from"./index-
|
|
1
|
+
import{j as s}from"./jsx-runtime-eps93zm2.js";import{r as P,R as C}from"./index-DhsZuJvc.js";import{T as I}from"./toaster-7wnI6hqB.js";import"./message-ZenLdkrf.js";import{a4 as d,a5 as M}from"./index-BesoTaoD.js";import{e as _}from"./index-DRSy5Ssd.js";import"./chunk-HLWAVYOI-C9RjJIQI.js";import"./index-CUZDtIZe.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./iframe-CeeVOkcX.js";import"../sb-preview/runtime.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";import"./react-16-DXAfArL2.js";var v="DARK_MODE";function f(r){"@babel/helpers - typeof";return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(r)}var b;function k(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),e.push.apply(e,n)}return e}function A(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?k(Object(e),!0).forEach(function(n){R(r,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):k(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}function R(r,t,e){return t=x(t),t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function x(r){var t=K(r,"string");return f(t)==="symbol"?t:String(t)}function K(r,t){if(f(r)!=="object"||r===null)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var n=e.call(r,t||"default");if(f(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function p(r){return B(r)||U(r)||N(r)||L()}function L(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function N(r,t){if(r){if(typeof r=="string")return h(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);if(e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set")return Array.from(r);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return h(r,t)}}function U(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function B(r){if(Array.isArray(r))return h(r)}function h(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}const{global:Y}=__STORYBOOK_MODULE_GLOBAL__;__STORYBOOK_MODULE_CORE_EVENTS__;var T=Y,$=T.document,g=T.window,j="sb-addon-themes-3";(b=g.matchMedia)===null||b===void 0||b.call(g,"(prefers-color-scheme: dark)");var O={classTarget:"body",dark:d.dark,darkClass:["dark"],light:d.light,lightClass:["light"],stylePreview:!1,userHasExplicitlySetTheTheme:!1},E=function(t){g.localStorage.setItem(j,JSON.stringify(t))},H=function(t,e){var n=e.current,a=e.darkClass,l=a===void 0?O.darkClass:a,o=e.lightClass,i=o===void 0?O.lightClass:o;if(n==="dark"){var u,c;(u=t.classList).remove.apply(u,p(y(i))),(c=t.classList).add.apply(c,p(y(l)))}else{var m,S;(m=t.classList).remove.apply(m,p(y(l))),(S=t.classList).add.apply(S,p(y(i)))}},y=function(t){var e=[];return e.concat(t).map(function(n){return n})},V=function(t){var e=$.querySelector(t.classTarget);e&&H(e,t)},D=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=g.localStorage.getItem(j);if(typeof e=="string"){var n=JSON.parse(e);return t&&(t.dark&&!_(n.dark,t.dark)&&(n.dark=t.dark,E(n)),t.light&&!_(n.light,t.light)&&(n.light=t.light,E(n))),n}return A(A({},O),t)};V(D());function W(r,t){return F(r)||J(r,t)||G(r,t)||q()}function q(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function G(r,t){if(r){if(typeof r=="string")return w(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);if(e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set")return Array.from(r);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return w(r,t)}}function w(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function J(r,t){var e=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e!=null){var n,a,l,o,i=[],u=!0,c=!1;try{if(l=(e=e.call(r)).next,t!==0)for(;!(u=(n=l.call(e)).done)&&(i.push(n.value),i.length!==t);u=!0);}catch(m){c=!0,a=m}finally{try{if(!u&&e.return!=null&&(o=e.return(),Object(o)!==o))return}finally{if(c)throw a}}return i}}function F(r){if(Array.isArray(r))return r}const{addons:z,useState:Q,useEffect:X}=__STORYBOOK_MODULE_PREVIEW_API__;function Z(){var r=Q(D().current==="dark"),t=W(r,2),e=t[0],n=t[1];return X(function(){var a=z.getChannel();return a.on(v,n),function(){return a.off(v,n)}},[]),e}const Or=[r=>s.jsxs(s.Fragment,{children:[s.jsx(r,{}),s.jsx(I,{})]}),r=>{const t=Z();return P.useEffect(()=>document.documentElement.dataset.theme=t?"dark":"default",[t]),s.jsx(r,{})}],Sr={docs:{container:r=>{const[t,e]=C.useState(!1);r.context.channel.on(v,a=>e(a));const n={...r};return n.theme=t?d.dark:d.light,s.jsx(M,{...n})}},darkMode:{current:"light",stylePreview:!0}},_r=["autodocs"];export{Or as decorators,Sr as parameters,_r as tags};
|
package/dist/storybook/assets/{reservoirs.stories-DywuU8EY.js → reservoirs.stories-D_HCj-TY.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as b}from"./index-DhsZuJvc.js";import{I as j}from"./common-types-Sih75Sav.js";import{T as w}from"./top-bar-mKg-xcLh.js";import{S as L}from"./side-bar-DAMfASqb.js";import{H as t}from"./heading-EzI5s4VN.js";import{B as m}from"./button-CdEIDAx8.js";import{D as v}from"./drawer-BOl7GxGI.js";import{L as C}from"./list-BtA0jYMp.js";import{F as l}from"./field-nInV3MuR.js";import{I as i}from"./input-D97ganXq.js";import{C as p}from"./check-box-2fHPdAZG.js";import{R as h}from"./radio-button-J4oEQdxt.js";import{C as d}from"./card-EcjmryU9.js";import{F}from"./form-row-CM112EYF.js";import{P as g}from"./page-7SSpdYhb.js";import{R as a,C as r}from"./row-4iAGREkV.js";import{S as R}from"./select-
|
|
1
|
+
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as b}from"./index-DhsZuJvc.js";import{I as j}from"./common-types-Sih75Sav.js";import{T as w}from"./top-bar-mKg-xcLh.js";import{S as L}from"./side-bar-DAMfASqb.js";import{H as t}from"./heading-EzI5s4VN.js";import{B as m}from"./button-CdEIDAx8.js";import{D as v}from"./drawer-BOl7GxGI.js";import{L as C}from"./list-BtA0jYMp.js";import{F as l}from"./field-nInV3MuR.js";import{I as i}from"./input-D97ganXq.js";import{C as p}from"./check-box-2fHPdAZG.js";import{R as h}from"./radio-button-J4oEQdxt.js";import{C as d}from"./card-EcjmryU9.js";import{F}from"./form-row-CM112EYF.js";import{P as g}from"./page-7SSpdYhb.js";import{R as a,C as r}from"./row-4iAGREkV.js";import{S as R}from"./select-BPp24Pdw.js";import{S as f}from"./spacer-BWoNR27H.js";import"./index-Bk2sglWO.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./actions-4w-EOz3m.js";import"./lodash-BHd_uQHh.js";import"./tooltip-C_E_6ym5.js";import"./index-CUZDtIZe.js";import"./types-BmbYqTX_.js";import"./types-UmZ4Y_CR.js";import"./badge-CLQ59MDF.js";import"./index-BI4_Bp97.js";import"./help-icon-CfV3_Ais.js";import"./spinner-AWUe4xwQ.js";import"./index.es-DazXb-ul.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./memoize-one.esm-CcMeOnPo.js";import"./meta-content-BdypOdcN.js";import"./loader-XHoVniao.js";import"./label-Cz6TT90s.js";import"./select.input-DIKP56UZ.js";import"./styled-components.browser.esm-Bf0q9Yjk.js";import"./assertThisInitialized-B9jnkVVz.js";import"./text-B3-TSWok.js";const k=({width:o,height:n})=>e.jsx("div",{style:{background:"#ddd",width:o,height:n}}),ve={title:"Layout/Layout Examples",parameters:{layout:"fullscreen",docs:{story:{inline:!1,iframeHeight:400}}}},s=()=>{const[o,n]=b.useState(!0);return e.jsxs(e.Fragment,{children:[e.jsx(w,{}),e.jsx(L,{options:{title:"",sections:[]}}),e.jsx(g,{padding:!1,scroll:!1,children:e.jsxs(a,{spacing:0,height:"100%",children:[e.jsx(v,{button:e.jsx(m,{onClick:()=>n(!o),round:!0,icon:j.CHEVRON_LEFT}),open:o,width:300,closedWidth:"var(--size-sidebar)",children:e.jsx(C,{drawer:!0,narrow:!o,list:{name:"Reservoirs",items:[{id:1,name:"Lorem",active:!0},{id:2,name:"Ipsum"}]}})}),e.jsxs(r,{scroll:!0,padding:!0,borderLeft:!0,children:[e.jsxs(a,{children:[e.jsxs(r,{children:[e.jsx(t,{top:!0,children:"Reservoir name here"}),e.jsxs(F,{children:[e.jsx(l,{label:"Name",children:e.jsx(i,{value:"Reservoir name here",width:"200px"})}),e.jsx(l,{label:"Lorem",children:e.jsx(h,{name:"example",options:[{label:"Aardvarks",value:"termites"},{label:"Monkeys",value:"bananas"}],value:{label:"Monkeys",value:"bananas"},inline:!0})}),e.jsx(l,{label:"Ipsum",children:e.jsx(R,{name:"example",options:[{label:"Monkeys",value:"bananas"},{label:"Possums",value:"slugs"}],value:{label:"Monkeys",value:"bananas"},native:!0})}),e.jsx(l,{children:e.jsx(p,{label:"Dolor"})})]})]}),e.jsx(r,{flex:!1,children:e.jsx(m,{onClick:()=>{},round:!0,icon:"question"})})]}),e.jsxs(a,{children:[e.jsx(r,{width:"50%",children:e.jsx(d,{heading:e.jsx(t,{onClickHelp:()=>console.log("help!"),children:"Reservoir Zone"}),children:e.jsxs(a,{children:[e.jsxs(r,{width:"50%",children:[e.jsxs(l,{label:"Label",helpText:"Lorem ipsum",children:[e.jsx(h,{options:[{label:"Aardvarks",value:"termites"},{label:"Monkeys",value:"bananas"}],value:{label:"Monkeys",value:"bananas"},inline:!0}),e.jsx(i,{width:"100%"})]}),e.jsxs(l,{label:"Label",helpText:"Lorem ipsum",children:[e.jsx(p,{label:"Lorem ipsum"}),e.jsx(i,{width:"100%",disabled:!0})]}),e.jsx(l,{label:"Label",helpText:"Lorem ipsum",children:e.jsx(i,{width:"100%"})}),e.jsx(l,{label:"Label",helpText:"Lorem ipsum",children:e.jsx(i,{width:"100%"})})]}),e.jsxs(r,{width:"50%",children:[e.jsx(l,{label:"Label",helpText:"Lorem ipsum",children:e.jsx(i,{width:"100%"})}),e.jsx(l,{label:"Label",helpText:"Lorem ipsum",children:e.jsx(i,{width:"100%"})}),e.jsx(l,{label:"Label",helpText:"Lorem ipsum",children:e.jsx(i,{width:"100%"})}),e.jsx(l,{label:"Label",helpText:"Lorem ipsum",children:e.jsx(i,{width:"100%"})})]})]})})}),e.jsxs(r,{width:"50%",children:[e.jsx(d,{heading:e.jsx(t,{children:"Reservoir Size"}),children:e.jsxs(a,{children:[e.jsxs(r,{width:"160px",children:[e.jsx(l,{label:"Length",children:e.jsx(i,{width:"100%"})}),e.jsx(l,{label:"Width",children:e.jsx(i,{width:"100%"})})]}),e.jsx(r,{children:e.jsx(k,{width:"100%",height:"100%"})})]})}),e.jsx(f,{}),e.jsx(d,{heading:e.jsx(t,{children:"Reservoir Properties"}),children:e.jsxs(a,{children:[e.jsx(r,{children:e.jsx(l,{label:"Label",children:e.jsx(i,{width:"100%"})})}),e.jsx(r,{children:e.jsx(l,{label:"Label",children:e.jsx(i,{width:"100%"})})}),e.jsx(r,{children:e.jsx(l,{label:"Label",children:e.jsx(i,{width:"100%"})})})]})})]})]})]})]})})]})};s.__docgenInfo={description:"",methods:[],displayName:"Reservoirs"};var u,x,c;s.parameters={...s.parameters,docs:{...(u=s.parameters)==null?void 0:u.docs,source:{originalSource:`() => {
|
|
2
2
|
const [open, setOpen] = useState(true);
|
|
3
3
|
return <>
|
|
4
4
|
<TopBar />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var kf=Object.defineProperty;var Sf=(t,e,n)=>e in t?kf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var el=(t,e,n)=>Sf(t,typeof e!="symbol"?e+"":e,n);import{j as ae}from"./jsx-runtime-eps93zm2.js";import{g as Ni,R as Me,r as z}from"./index-DhsZuJvc.js";import{D as vf}from"./disabled-context-rmpd7YJS.js";import{C as wf}from"./common-types-Sih75Sav.js";import{B as bu}from"./button-CdEIDAx8.js";import{r as Ef}from"./index-CUZDtIZe.js";import{S as Cf}from"./select-
|
|
1
|
+
var kf=Object.defineProperty;var Sf=(t,e,n)=>e in t?kf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var el=(t,e,n)=>Sf(t,typeof e!="symbol"?e+"":e,n);import{j as ae}from"./jsx-runtime-eps93zm2.js";import{g as Ni,R as Me,r as z}from"./index-DhsZuJvc.js";import{D as vf}from"./disabled-context-rmpd7YJS.js";import{C as wf}from"./common-types-Sih75Sav.js";import{B as bu}from"./button-CdEIDAx8.js";import{r as Ef}from"./index-CUZDtIZe.js";import{S as Cf}from"./select-BPp24Pdw.js";import"./index-Bk2sglWO.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./tooltip-C_E_6ym5.js";import"./types-UmZ4Y_CR.js";import"./lodash-BHd_uQHh.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-4w-EOz3m.js";import"./badge-CLQ59MDF.js";import"./select.input-DIKP56UZ.js";var Eo={exports:{}};(function(t,e){var n=typeof Reflect<"u"?Reflect.construct:void 0,r=Object.defineProperty,s=Error.captureStackTrace;s===void 0&&(s=function(c){var u=new Error;r(c,"stack",{configurable:!0,get:function(){var h=u.stack;return r(this,"stack",{configurable:!0,value:h,writable:!0}),h},set:function(h){r(c,"stack",{configurable:!0,value:h,writable:!0})}})});function i(l){l!==void 0&&r(this,"message",{configurable:!0,value:l,writable:!0});var c=this.constructor.name;c!==void 0&&c!==this.name&&r(this,"name",{configurable:!0,value:c,writable:!0}),s(this,this.constructor)}i.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:i,writable:!0}});var o=function(){function l(u,d){return r(u,"name",{configurable:!0,value:d})}try{var c=function(){};if(l(c,"foo"),c.name==="foo")return l}catch{}}();function a(l,c){if(c==null||c===Error)c=i;else if(typeof c!="function")throw new TypeError("super_ should be a function");var u;if(typeof l=="string")u=l,l=n!==void 0?function(){return n(c,arguments,this.constructor)}:function(){c.apply(this,arguments)},o!==void 0&&(o(l,u),u=void 0);else if(typeof l!="function")throw new TypeError("constructor should be either a string or a function");l.super_=l.super=c;var d={constructor:{configurable:!0,value:l,writable:!0}};return u!==void 0&&(d.name={configurable:!0,value:u,writable:!0}),l.prototype=Object.create(c.prototype,d),l}e=t.exports=a,e.BaseError=i})(Eo,Eo.exports);var ku=Eo.exports,tl="ProseMirror-selectednode",la="",Wt="\0",nl="__state_override__",Tf={LastNodeCompatible:"lastNodeCompatible",FormattingMark:"formattingMark",FormattingNode:"formattingNode",NodeCursor:"nodeCursor",FontStyle:"fontStyle",Link:"link",Color:"color",Alignment:"alignment",Indentation:"indentation",Behavior:"behavior",Code:"code",InlineNode:"inline",ListContainerNode:"listContainer",ListItemNode:"listItemNode",Block:"block",BlockNode:"block",TextBlock:"textBlock",ExcludeInputRules:"excludeFromInputRules",PreventExits:"preventsExits",Media:"media"},j=Tf,Nt=Symbol.for("__remirror__"),xe=(t=>(t.PlainExtension="RemirrorPlainExtension",t.NodeExtension="RemirrorNodeExtension",t.MarkExtension="RemirrorMarkExtension",t.PlainExtensionConstructor="RemirrorPlainExtensionConstructor",t.NodeExtensionConstructor="RemirrorNodeExtensionConstructor",t.MarkExtensionConstructor="RemirrorMarkExtensionConstructor",t.Manager="RemirrorManager",t.Preset="RemirrorPreset",t.PresetConstructor="RemirrorPresetConstructor",t))(xe||{}),X=(t=>(t[t.Critical=1e6]="Critical",t[t.Highest=1e5]="Highest",t[t.High=1e4]="High",t[t.Medium=1e3]="Medium",t[t.Default=100]="Default",t[t.Low=10]="Low",t[t.Lowest=0]="Lowest",t))(X||{}),De=(t=>(t[t.None=0]="None",t[t.Create=1]="Create",t[t.EditorView=2]="EditorView",t[t.Runtime=3]="Runtime",t[t.Destroy=4]="Destroy",t))(De||{}),E=(t=>(t.Undo="_|undo|_",t.Redo="_|redo|_",t.Bold="_|bold|_",t.Italic="_|italic|_",t.Underline="_|underline|_",t.Strike="_|strike|_",t.Code="_|code|_",t.Paragraph="_|paragraph|_",t.H1="_|h1|_",t.H2="_|h2|_",t.H3="_|h3|_",t.H4="_|h4|_",t.H5="_|h5|_",t.H6="_|h6|_",t.TaskList="_|task|_",t.BulletList="_|bullet|_",t.OrderedList="_|number|_",t.Quote="_|quote|_",t.Divider="_|divider|_",t.Codeblock="_|codeblock|_",t.ClearFormatting="_|clear|_",t.Superscript="_|sup|_",t.Subscript="_|sub|_",t.LeftAlignment="_|left-align|_",t.CenterAlignment="_|center-align|_",t.RightAlignment="_|right-align|_",t.JustifyAlignment="_|justify-align|_",t.InsertLink="_|link|_",t.Find="_|find|_",t.FindBackwards="_|find-backwards|_",t.FindReplace="_|find-replace|_",t.AddFootnote="_|footnote|_",t.AddComment="_|comment|_",t.ContextMenu="_|context-menu|_",t.IncreaseFontSize="_|inc-font-size|_",t.DecreaseFontSize="_|dec-font-size|_",t.IncreaseIndent="_|indent|_",t.DecreaseIndent="_|dedent|_",t.Shortcuts="_|shortcuts|_",t.Copy="_|copy|_",t.Cut="_|cut|_",t.Paste="_|paste|_",t.PastePlain="_|paste-plain|_",t.SelectAll="_|select-all|_",t.Format="_|format|_",t))(E||{}),b=(t=>(t.PROD="RMR0000",t.UNKNOWN="RMR0001",t.INVALID_COMMAND_ARGUMENTS="RMR0002",t.CUSTOM="RMR0003",t.CORE_HELPERS="RMR0004",t.MUTATION="RMR0005",t.INTERNAL="RMR0006",t.MISSING_REQUIRED_EXTENSION="RMR0007",t.MANAGER_PHASE_ERROR="RMR0008",t.INVALID_GET_EXTENSION="RMR0010",t.INVALID_MANAGER_ARGUMENTS="RMR0011",t.SCHEMA="RMR0012",t.HELPERS_CALLED_IN_OUTER_SCOPE="RMR0013",t.INVALID_MANAGER_EXTENSION="RMR0014",t.DUPLICATE_COMMAND_NAMES="RMR0016",t.DUPLICATE_HELPER_NAMES="RMR0017",t.NON_CHAINABLE_COMMAND="RMR0018",t.INVALID_EXTENSION="RMR0019",t.INVALID_CONTENT="RMR0021",t.INVALID_NAME="RMR0050",t.EXTENSION="RMR0100",t.EXTENSION_SPEC="RMR0101",t.EXTENSION_EXTRA_ATTRIBUTES="RMR0102",t.INVALID_SET_EXTENSION_OPTIONS="RMR0103",t.REACT_PROVIDER_CONTEXT="RMR0200",t.REACT_GET_ROOT_PROPS="RMR0201",t.REACT_EDITOR_VIEW="RMR0202",t.REACT_CONTROLLED="RMR0203",t.REACT_NODE_VIEW="RMR0204",t.REACT_GET_CONTEXT="RMR0205",t.REACT_COMPONENTS="RMR0206",t.REACT_HOOKS="RMR0207",t.I18N_CONTEXT="RMR0300",t))(b||{}),Of=function(e){return Mf(e)&&!_f(e)};function Mf(t){return!!t&&typeof t=="object"}function _f(t){var e=Object.prototype.toString.call(t);return e==="[object RegExp]"||e==="[object Date]"||Rf(t)}var Nf=typeof Symbol=="function"&&Symbol.for,Af=Nf?Symbol.for("react.element"):60103;function Rf(t){return t.$$typeof===Af}function If(t){return Array.isArray(t)?[]:{}}function ns(t,e){return e.clone!==!1&&e.isMergeableObject(t)?tr(If(t),t,e):t}function Df(t,e,n){return t.concat(e).map(function(r){return ns(r,n)})}function Pf(t,e){if(!e.customMerge)return tr;var n=e.customMerge(t);return typeof n=="function"?n:tr}function Lf(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[]}function rl(t){return Object.keys(t).concat(Lf(t))}function Su(t,e){try{return e in t}catch{return!1}}function Bf(t,e){return Su(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))}function zf(t,e,n){var r={};return n.isMergeableObject(t)&&rl(t).forEach(function(s){r[s]=ns(t[s],n)}),rl(e).forEach(function(s){Bf(t,s)||(Su(t,s)&&n.isMergeableObject(e[s])?r[s]=Pf(s,n)(t[s],e[s],n):r[s]=ns(e[s],n))}),r}function tr(t,e,n){n=n||{},n.arrayMerge=n.arrayMerge||Df,n.isMergeableObject=n.isMergeableObject||Of,n.cloneUnlessOtherwiseSpecified=ns;var r=Array.isArray(e),s=Array.isArray(t),i=r===s;return i?r?n.arrayMerge(t,e,n):zf(t,e,n):ns(e,n)}tr.all=function(e,n){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(r,s){return tr(r,s,n)},{})};var $f=tr,Ff=$f;const Vf=Ni(Ff);/*!
|
|
2
2
|
* isobject <https://github.com/jonschlinkert/isobject>
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-eps93zm2.js";import{r as D}from"./index-DhsZuJvc.js";import{T as g}from"./table-
|
|
1
|
+
import{j as o}from"./jsx-runtime-eps93zm2.js";import{r as D}from"./index-DhsZuJvc.js";import{T as g}from"./table-CWxrvmPS.js";import{T as z}from"./text-B3-TSWok.js";import{t as R,s as G,u as J,v as K,w as Q}from"./table.stories-data-C6x-UHeN.js";import"./index-Bk2sglWO.js";import"./index.es-DazXb-ul.js";import"./inheritsLoose-DP0QEDDI.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./index-CUZDtIZe.js";import"./memoize-one.esm-CcMeOnPo.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./lodash-BHd_uQHh.js";import"./actions-4w-EOz3m.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./button-CdEIDAx8.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./index-CEuq6vkz.js";import"./tooltip-C_E_6ym5.js";import"./types-BmbYqTX_.js";import"./types-UmZ4Y_CR.js";import"./badge-CLQ59MDF.js";import"./heading-EzI5s4VN.js";import"./help-icon-CfV3_Ais.js";import"./pagination-BA9mb3NP.js";import"./select-BPp24Pdw.js";import"./assertThisInitialized-B9jnkVVz.js";import"./select.input-DIKP56UZ.js";import"./input-D97ganXq.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./number-input-RV1zn3_t.js";import"./index-DGl0obec.js";import"./index-DRSy5Ssd.js";import"./check-box-2fHPdAZG.js";import"./slider-BLU39INk.js";import"./index-BI4_Bp97.js";import"./popover-CvS_kBVF.js";import"./flex-EllkLxgO.js";const Ie={title:"Basic/Table/Row",component:g,args:{table:{...R}}},v=n=>o.jsx(g,{...n}),i=v.bind({});i.args={table:G};const p=v.bind({});p.args={table:J};const c=v.bind({});c.args={table:K};const d=v.bind({});d.args={table:Q};const t=v.bind({});t.args={table:{...R,striped:!1}};t.parameters={docs:{description:{story:"`striped: false` removes tinted background on alternative rows."}}};const u=()=>{const[n,e]=D.useState(null),a=r=>e(n===r?null:r);return o.jsx(g,{table:{...R,striped:!1,rows:R.rows.map((r,x)=>({...r,onRowClick:()=>a(x),expandedContent:{content:n===x?o.jsx("div",{children:"Example expanded content"}):null}}))}})},m=()=>{const n={draggable:!0,headers:[{cells:[{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"}]}],rows:[{noDrag:!0,cells:[{value:"Undraggable"},{value:100},{value:361},{value:"Vietnam"}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"}]}]},e=(s,b,l)=>{const y=[...s];return s[l].noDrag?s:(y.splice(l,0,y.splice(b,1)[0]),y)},[a,r]=D.useState(n.rows),x=s=>{const{to:b,from:l}=s;e(a,l,b),r(e(a,l,b))};return o.jsx(g,{table:{...n,rows:a},onListReorder:x})},w=()=>{const[n,e]=D.useState("Hover any row!"),a=[1,2,3,4,5].map(r=>({cells:[{value:`Row ${r}`},{value:`${r**2}`}],onRowMouseEnter:()=>e(`Hovering row ${r}`),onRowMouseLeave:()=>e("Not hovering any row...")}));return o.jsxs(o.Fragment,{children:[o.jsx(z,{children:n}),o.jsx(g,{table:{fixedWidth:"100%",headers:[{cells:[{value:"Description"},{value:"Value"}],onRowMouseEnter:()=>e("Hovering header row"),onRowMouseLeave:()=>e("Not hovering any row...")}],rows:a}})]})};u.__docgenInfo={description:"",methods:[],displayName:"Expandable"};m.__docgenInfo={description:"",methods:[],displayName:"DragAndDrop"};w.__docgenInfo={description:"",methods:[],displayName:"OnRowEnter"};var E,h,T;i.parameters={...i.parameters,docs:{...(E=i.parameters)==null?void 0:E.docs,source:{originalSource:`args => {
|
|
2
2
|
return <Table
|
|
3
3
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4
4
|
{...args} />;
|
|
@@ -37,4 +37,4 @@ import{j as f}from"./jsx-runtime-eps93zm2.js";import{r as N,g as We}from"./index
|
|
|
37
37
|
) => void`,signature:{arguments:[{type:{name:"ReactMouseEvent",raw:"React.MouseEvent<HTMLDivElement, MouseEvent>",elements:[{name:"HTMLDivElement"},{name:"MouseEvent"}]},name:"event"},{type:{name:"ISelectSection"},name:"section"}],return:{name:"void"}}},description:""},focusedOptionIndex:{required:!1,tsType:{name:"number"},description:""},width:{required:!0,tsType:{name:"number"},description:""},small:{required:!1,tsType:{name:"boolean"},description:""},firstSelectedOptionIndex:{required:!1,tsType:{name:"number"},description:""},closeLayer:{required:!0,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const Yn="_inputInTable_1qfoj_1",Bn="_inputHover_1qfoj_13",Zn="_inputFocus_1qfoj_18",Xn="_inputError_1qfoj_25",Jn="_inputWarning_1qfoj_26",Qn="_inputDisabled_1qfoj_61",et="_hideScrollbars_1qfoj_67",nt="_trigger_1qfoj_77",tt="_isInTable_1qfoj_93",rt="_input_1qfoj_1",at="_isOpen_1qfoj_114",it="_error_1qfoj_122",st="_warning_1qfoj_139",ot="_disabled_1qfoj_156",lt="_icons_1qfoj_162",ut="_clearAll_1qfoj_169",ct="_iconOpen_1qfoj_170",dt="_small_1qfoj_181",mt="_triggerInputContainer_1qfoj_189",pt="_right_1qfoj_198",ft="_multiOptions_1qfoj_211",gt="_multiOption_1qfoj_211",vt="_label_1qfoj_239",yt="_closeMultiOption_1qfoj_242",ht="_focus_1qfoj_253",St="_selectedSingleValue_1qfoj_257",bt="_placeHolder_1qfoj_258",_t="_groupOrderFirst_1qfoj_297",Tt="_groupOrderMiddle_1qfoj_298",Et="_groupOrderLast_1qfoj_302",It="_detailedLabel_1qfoj_307",M={inputInTable:Yn,inputHover:Bn,inputFocus:Zn,inputError:Xn,inputWarning:Jn,inputDisabled:Qn,hideScrollbars:et,trigger:nt,isInTable:tt,input:rt,isOpen:at,error:it,warning:st,disabled:ot,icons:lt,clearAll:ut,iconOpen:ct,small:dt,triggerInputContainer:mt,right:pt,multiOptions:ft,multiOption:gt,label:vt,closeMultiOption:yt,focus:ht,selectedSingleValue:St,placeHolder:bt,groupOrderFirst:_t,groupOrderMiddle:Tt,groupOrderLast:Et,detailedLabel:It},Ae=({selectedOptions:e,small:n,width:a})=>{const d=xe(),[c,g]=N.useState([]),[p,s]=N.useState([]);return N.useEffect(()=>{let o=[],v=[],b=0;e.forEach((S,I)=>{b+=Kn(S,n,d),I===e.length-1&&b<a||b<a-24?o.push(S):v.push(S)}),g(o),s(v)},[e,d,a]),f.jsxs("div",{className:M.multiOptions,children:[c.filter(o=>o&&o.label).map((o,v)=>f.jsx("span",{className:M.multiOption,onClick:b=>{b.stopPropagation()},children:o.label},v)),p.length>0&&f.jsx(me,{text:p.map((o,v)=>f.jsx("div",{children:o.label},v)),display:"inline-flex",children:f.jsx("span",{className:M.multiOption,children:c.length?`+${p.length}`:`${p.length} items`})})]})};Ae.__docgenInfo={description:"",methods:[],displayName:"MultiSelectedOptions",props:{selectedOptions:{required:!0,tsType:{name:"Array",elements:[{name:"ISelectSelectedOption"}],raw:"ISelectSelectedOption[]"},description:""},small:{required:!1,tsType:{name:"boolean"},description:""},width:{required:!0,tsType:{name:"number"},description:""}}};const Fe=({selectedOptions:e,searchable:n=!1,searchValue:a,onChange:d=()=>{},inputRef:c,error:g,placeholder:p="Select...",small:s})=>{const o=N.useRef(null),v=Array.isArray(e),b=v?e.length>0:!!e,S=a?a.length+1:1,I=()=>{var t,l;const T=((t=o.current)==null?void 0:t.offsetWidth)||0,_=((l=c.current)==null?void 0:l.offsetWidth)||0;return T-_};return f.jsxs("div",{className:M.triggerInputContainer,ref:o,children:[b?v?f.jsx(Ae,{selectedOptions:e,small:s,width:I()}):f.jsx("span",{className:M.selectedSingleValue,children:a!=null&&a.length?"":e==null?void 0:e.label}):f.jsx("span",{className:M.placeHolder,children:a!=null&&a.length?"":p}),n?f.jsx("input",{tabIndex:-1,ref:c,size:S,className:G(M.input,g?M.error:""),value:a,onChange:T=>d(T.target.value)}):null]})};Fe.__docgenInfo={description:"",methods:[],displayName:"Input",props:{selectedOptions:{required:!1,tsType:{name:"union",raw:"ISelectSelectedOption | ISelectSelectedOption[]",elements:[{name:"ISelectSelectedOption"},{name:"Array",elements:[{name:"ISelectSelectedOption"}],raw:"ISelectSelectedOption[]"}]},description:""},searchable:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},searchValue:{required:!1,tsType:{name:"string"},description:""},inputRef:{required:!0,tsType:{name:"MutableRefObject",elements:[{name:"union",raw:"HTMLInputElement | null",elements:[{name:"HTMLInputElement"},{name:"null"}]}],raw:"MutableRefObject<HTMLInputElement | null>"},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(value: string) => void",signature:{arguments:[{type:{name:"string"},name:"value"}],return:{name:"void"}}},description:"",defaultValue:{value:"() => {}",computed:!1}},error:{required:!1,tsType:{name:"union",raw:"string | ReactNode",elements:[{name:"string"},{name:"ReactNode"}]},description:""},placeholder:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:"",defaultValue:{value:"'Select...'",computed:!1}},small:{required:!1,tsType:{name:"boolean"},description:""}}};const He=({selectedOptions:e,searchValue:n,searchable:a,clearable:d,onClickTrigger:c,element:g,error:p,warning:s,tooltip:o,small:v,isInTable:b,disabled:S,onChangeSearch:I,onClickDeselect:T,onClickClear:_,tabIndex:t,isOpen:l,triggerRef:i,clearAllIsFocused:r,focusedSelectedOptionIndex:u,onFocus:m,onBlur:y,groupOrder:h,maxTooltipWidth:E,placeholder:R,right:x,testId:q})=>{var H;const[w,C]=we(),A=Array.isArray(e)?e.length>0&&((H=e[0])==null?void 0:H.value):e==null?void 0:e.value,j=d&&A,z=(()=>{if(h)switch(h){case ae.FIRST:return M.groupOrderFirst;case ae.LAST:return M.groupOrderLast;default:return M.groupOrderMiddle}return""})(),K=!Array.isArray(e)&&(e!=null&&e.details)?{...e,label:f.jsxs("div",{className:G(M.detailedLabel),children:[f.jsx(le,{children:e.label}),f.jsx(le,{muted:!0,children:e.details})]})}:e,V=f.jsxs(f.Fragment,{children:[g,f.jsxs("div",{ref:i,tabIndex:t,className:G(M.trigger,l?M.isOpen:"",p?M.error:s?M.warning:"",S?M.disabled:"",v?M.small:"",b?M.isInTable:"",x?M.right:"",z),onClick:P=>{P.stopPropagation(),typeof C=="function"&&C(),c(P)},onFocus:m,onBlur:y,"data-testid":q,children:[f.jsx(Fe,{selectedOptions:K,placeholder:R,searchable:a,searchValue:n,inputRef:w,onChange:I,error:p,small:v}),f.jsx("span",{className:M.icons,children:j?f.jsx("span",{className:G(M.clearAll,r?M.focus:""),onClick:P=>{P.stopPropagation(),_&&_(P)},children:f.jsx(ue,{icon:Ee.CLOSE})}):f.jsx("span",{className:G(M.iconOpen),children:f.jsx(ue,{icon:"chevron down"})})})]})]});return f.jsx(f.Fragment,{children:f.jsx(me,{error:!!p,warning:!!s,text:o||p||s,enabled:o&&ne(o)||p&&ne(p)||s&&ne(s)||!1,maxWidth:E,placement:"bottom-center",children:V})})};He.__docgenInfo={description:"",methods:[],displayName:"Trigger",props:{selectedOptions:{required:!1,tsType:{name:"union",raw:"ISelectSelectedOption | ISelectSelectedOption[]",elements:[{name:"ISelectSelectedOption"},{name:"Array",elements:[{name:"ISelectSelectedOption"}],raw:"ISelectSelectedOption[]"}]},description:""},searchValue:{required:!1,tsType:{name:"string"},description:""},searchable:{required:!1,tsType:{name:"boolean"},description:""},clearable:{required:!1,tsType:{name:"boolean"},description:""},onClickTrigger:{required:!0,tsType:{name:"signature",type:"function",raw:"(evt: React.MouseEvent<HTMLDivElement, MouseEvent>) => void",signature:{arguments:[{type:{name:"ReactMouseEvent",raw:"React.MouseEvent<HTMLDivElement, MouseEvent>",elements:[{name:"HTMLDivElement"},{name:"MouseEvent"}]},name:"evt"}],return:{name:"void"}}},description:""},element:{required:!1,tsType:{name:"ReactNode"},description:""},error:{required:!1,tsType:{name:"union",raw:"string | ReactNode",elements:[{name:"string"},{name:"ReactNode"}]},description:""},warning:{required:!1,tsType:{name:"union",raw:"string | ReactNode",elements:[{name:"string"},{name:"ReactNode"}]},description:""},tooltip:{required:!1,tsType:{name:"union",raw:"string | ReactNode",elements:[{name:"string"},{name:"ReactNode"}]},description:""},small:{required:!1,tsType:{name:"boolean"},description:""},isInTable:{required:!1,tsType:{name:"boolean"},description:""},disabled:{required:!1,tsType:{name:"boolean"},description:""},onChangeSearch:{required:!1,tsType:{name:"signature",type:"function",raw:"(value: string) => void",signature:{arguments:[{type:{name:"string"},name:"value"}],return:{name:"void"}}},description:""},onClickDeselect:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: React.MouseEvent<HTMLDivElement, MouseEvent>) => void",signature:{arguments:[{type:{name:"ReactMouseEvent",raw:"React.MouseEvent<HTMLDivElement, MouseEvent>",elements:[{name:"HTMLDivElement"},{name:"MouseEvent"}]},name:"evt"}],return:{name:"void"}}},description:""},onClickClear:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void",signature:{arguments:[{type:{name:"ReactMouseEvent",raw:"React.MouseEvent<HTMLSpanElement, MouseEvent>",elements:[{name:"HTMLSpanElement"},{name:"MouseEvent"}]},name:"evt"}],return:{name:"void"}}},description:""},tabIndex:{required:!1,tsType:{name:"number"},description:""},isOpen:{required:!1,tsType:{name:"boolean"},description:""},triggerRef:{required:!1,tsType:{name:"RefObject",elements:[{name:"HTMLDivElement"}],raw:"RefObject<HTMLDivElement>"},description:""},clearAllIsFocused:{required:!1,tsType:{name:"boolean"},description:""},focusedSelectedOptionIndex:{required:!1,tsType:{name:"number"},description:""},onFocus:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: React.FocusEvent<HTMLDivElement>) => void",signature:{arguments:[{type:{name:"ReactFocusEvent",raw:"React.FocusEvent<HTMLDivElement>",elements:[{name:"HTMLDivElement"}]},name:"evt"}],return:{name:"void"}}},description:""},onBlur:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: React.FocusEvent<HTMLDivElement>) => void",signature:{arguments:[{type:{name:"ReactFocusEvent",raw:"React.FocusEvent<HTMLDivElement>",elements:[{name:"HTMLDivElement"}]},name:"evt"}],return:{name:"void"}}},description:""},groupOrder:{required:!1,tsType:{name:"union",raw:"TGroupOrder | string",elements:[{name:"union",raw:"'first' | 'middle' | 'last'",elements:[{name:"literal",value:"'first'"},{name:"literal",value:"'middle'"},{name:"literal",value:"'last'"}]},{name:"string"}]},description:""},maxTooltipWidth:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},placeholder:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""},right:{required:!1,tsType:{name:"boolean"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};var U=(e=>(e.SET_VISIBLE_OPTIONS="SET_VISIBLE_OPTIONS",e.RESET_LAYER_FOCUS="RESET_LAYER_FOCUS",e.CLEAR_SEARCH="CLEAR_SEARCH",e.ON_CHANGE_SEARCH="ON_CHANGE_SEARCH",e.FOCUS_TRIGGER_INPUTS="FOCUS_TRIGGER_INPUTS",e.BLUR_TRIGGER_INPUTS="BLUR_TRIGGER_INPUTS",e.FOCUS_LAYER_OPTIONS="FOCUS_LAYER_OPTIONS",e.OPEN_LAYER="OPEN_LAYER",e.CLOSE_LAYER="CLOSE_LAYER",e))(U||{});const Pe={options:["none","clearAll"],currentIndex:0,currentOption:!1,clearAll:!1},Ot=e=>e!==null?e+1:0,De=(e,n)=>{const a=["none",...e.map((c,g)=>c.type!==ie.HEADING?g:null).filter(c=>c!==null)],d=Ot(n);return{options:a,currentIndex:d,current:a[d]}},wt=(e,n)=>{const a=e==="up"?-1:1,d=n.currentIndex+a,c=(d<0?n.options.length-1:d)%n.options.length,g=n.options[c];return{...n,currentIndex:c,current:g}},xt=(e,n,a)=>{const d=e==="left"?-1:1,c=n&&n.length?["none",...Array.from({length:n.length},(v,b)=>b),"clearAll"]:["none","clearAll"],g=a.currentIndex+d,p=(g<0?c.length-1:g)%c.length,s=c[p];return{options:c,currentIndex:p,currentOption:s,clearAll:s==="clearAll"}},_e=()=>Pe,Te=e=>({...e,currentIndex:0,current:"none"}),Rt=(e,n)=>{switch(n.type){case U.SET_VISIBLE_OPTIONS:return{...e,visibleOptions:n.options||[]};case U.RESET_LAYER_FOCUS:return{...e,layerFocus:De(n.options||[],n.firstSelectedOptionIndex||0)};case U.CLEAR_SEARCH:return{...e,visibleOptions:n.options||[],searchValue:""};case U.ON_CHANGE_SEARCH:{let d=[...(n.options||[]).filter(c=>(String(c.label)+(c.details?String(c.details):"")).toLowerCase().includes(String(n.value||"").toLowerCase()))];return n.createAble&&n.value&&n.value!==""&&d.push({label:`Create "${n.value}"`,value:n.value,createAble:!0}),{...e,searchValue:n.value,visibleOptions:d,layerFocus:Te(e.layerFocus)}}case U.FOCUS_TRIGGER_INPUTS:return{...e,triggerFocus:xt(n.direction||"right",n.selectedOptions||[],e.triggerFocus),layerFocus:Te(e.layerFocus)};case U.BLUR_TRIGGER_INPUTS:return{...e,triggerFocus:_e()};case U.FOCUS_LAYER_OPTIONS:return n.nextLayerFocus?{...e,layerFocus:n.nextLayerFocus,triggerFocus:_e()}:e;case U.OPEN_LAYER:return{...e,isLayerOpen:!0};case U.CLOSE_LAYER:return{...e,isLayerOpen:!1};default:return e}},qt={auto:!0,possiblePlacements:["bottom-start","top-start"],placement:"bottom-start",preferX:"right",preferY:"bottom"};var D=(e=>(e.CLOSE_LAYER="CLOSE_LAYER",e.OPEN_LAYER="OPEN_LAYER",e.SET_VISIBLE_OPTIONS="SET_VISIBLE_OPTIONS",e.CLEAR_SEARCH="CLEAR_SEARCH",e.RESET_LAYER_FOCUS="RESET_LAYER_FOCUS",e.FOCUS_LAYER_OPTIONS="FOCUS_LAYER_OPTIONS",e.BLUR_TRIGGER_INPUTS="BLUR_TRIGGER_INPUTS",e.FOCUS_TRIGGER_INPUTS="FOCUS_TRIGGER_INPUTS",e.ON_CHANGE_SEARCH="ON_CHANGE_SEARCH",e))(D||{}),$=(e=>(e.RIGHT="right",e.LEFT="left",e.UP="up",e.DOWN="down",e.ENTER="enter",e.ESC="esc",e.TAB="tab",e))($||{});const Lt=({state:e,dispatch:n,options:a,setTriggerFocus:d,disabled:c,disabledContext:g,onCreate:p,onChange:s,selectedOptions:o,width:v,small:b,isFontLoaded:S,placeholder:I,firstSelectedOptionIndex:T,createAble:_,listRef:t,autoLayerWidth:l})=>{const i=()=>{e.isLayerOpen&&n({type:D.CLOSE_LAYER}),d()},r=()=>n({type:D.OPEN_LAYER}),u=N.useRef(!0);N.useEffect(()=>{u.current?u.current=!1:n({type:D.SET_VISIBLE_OPTIONS,options:a})},[a]);const m=(O,L,Q)=>{if(!(c||g)){if(Q&&Q(),L){if(L.createAble&&p)p(L.value);else if(!L.disabled)if(Array.isArray(o))if(o.some(B=>B.label===L.label)){const B=o.filter(pe=>pe.label!==L.label);s&&s(O,B)}else{const B=[...o,L];s&&s(O,B)}else s&&s(O,L)}n({type:D.CLEAR_SEARCH,options:a}),d()}},y=N.useCallback(()=>v?v!=="auto"?v:be(a,b,S,I):"100%",[a,S]),h=N.useCallback(O=>l?Math.max(be(a,b,S,I),O==null?void 0:O.width):O==null?void 0:O.width,[a,S]),{renderLayer:E,layerProps:R,triggerProps:x,triggerBounds:q}=Ue({isOpen:(e==null?void 0:e.isLayerOpen)??!1,overflowContainer:!0,...qt,ResizeObserver,onOutsideClick:i,onParentClose:i}),w=()=>{if(!(c||g)){if(e.isLayerOpen){i();return}n({type:D.RESET_LAYER_FOCUS,options:a,firstSelectedOptionIndex:T}),r()}},C=N.useRef(!0);N.useEffect(()=>{C.current?C.current=!1:e.isLayerOpen||n({type:D.CLEAR_SEARCH,options:a})},[e.isLayerOpen]);const A=(O,L)=>{const Q=o instanceof Array?o.filter(Y=>Y.value!==L.value):null;s&&s(O,Q)},j=O=>{const L=o instanceof Array?[]:{value:null};s&&s(O,L)},z=O=>n({type:D.ON_CHANGE_SEARCH,options:a,value:O,createAble:_}),K=()=>{r(),n({type:D.BLUR_TRIGGER_INPUTS})},V=O=>{t.current&&Number.isInteger(O)&&t.current.scrollToItem(O)},H=O=>{const L=wt(O,e.layerFocus);n({type:D.FOCUS_LAYER_OPTIONS,nextLayerFocus:L}),V(L.current)},P=O=>{n({type:D.FOCUS_TRIGGER_INPUTS,ICustomSelectDirection:O,selectedOptions:o})},Z=O=>j(O),te=o&&o[e.triggerFocus.currentOption],re=O=>{A(O,o[e.triggerFocus.currentOption])},X=O=>{var L;m(O,(L=e==null?void 0:e.visibleOptions)==null?void 0:L[e.layerFocus.current],i)},k=e.triggerFocus.clearAll;return{getTriggerWidth:y,onKeyEvent:(O,L)=>{switch(O){case $.UP:{H(O);break}case $.DOWN:{e.isLayerOpen?H(O):K();break}case $.LEFT:case $.RIGHT:{P(O);break}case $.ENTER:{k?Z(L):te?re(L):X(L);break}case $.ESC:{i();break}}},clearAllIsFocused:k,triggerProps:x,onClickTrigger:w,onChangeSearch:z,onClickDeselectOption:A,onClickClearAll:j,renderLayer:E,layerProps:R,closeLayer:i,onSelectOption:m,getLayerWidth:h,triggerBounds:q}},ke=e=>{const{multi:n=!1,disabled:a=!1,error:d=null,warning:c=null,tooltip:g=null,options:p,selectedOptions:s,onCreate:o=null,placeholder:v="",small:b=!1,tabIndex:S=0,onFocus:I=()=>{},onBlur:T=()=>{},searchable:_=!0,clearable:t=!1,maxTooltipWidth:l,closeOnOptionActionClick:i,isInTable:r=!1,groupOrder:u,firstSelectedOptionIndex:m=0,right:y=!1,testId:h=void 0}=e,E=N.useContext(de),R=o!==null,x=N.useRef(null),[q,w]=we(),C=xe(),[A,j]=N.useReducer(Rt,{options:p,firstSelectedOptionIndex:m},({options:Y})=>({searchValue:"",visibleOptions:Y,layerFocus:De(Y,m??0),triggerFocus:Pe,isLayerOpen:!1})),{getTriggerWidth:z,onKeyEvent:K,clearAllIsFocused:V,triggerProps:H,onClickTrigger:P,onChangeSearch:Z,onClickDeselectOption:te,onClickClearAll:re,renderLayer:X,layerProps:k,closeLayer:J,onSelectOption:O,getLayerWidth:L,triggerBounds:Q}=Lt({...e,state:A,dispatch:j,setTriggerFocus:w,disabledContext:E,isFontLoaded:C,createAble:R,listRef:x});return f.jsx("div",{style:{width:z()},children:f.jsxs(fn,{handleKeys:Object.values($),onKeyEvent:K,children:[f.jsx(He,{selectedOptions:s,searchValue:A.searchValue,isOpen:A.isLayerOpen,focusedSelectedOptionIndex:A.triggerFocus.currentOption,clearAllIsFocused:V,searchable:_,triggerRef:Ge(q,H.ref),error:d,warning:c,tooltip:g,small:b,isInTable:r,disabled:a||E,clearable:t,tabIndex:S,onClickTrigger:P,onChangeSearch:Z,onClickDeselect:te,onClickClear:re,onFocus:I,onBlur:T,groupOrder:u,maxTooltipWidth:l,placeholder:v,right:y,testId:h}),A.isLayerOpen&&X(f.jsx("div",{...k,className:F.layerContainer,children:f.jsx(je,{listRef:x,isMulti:n,sections:A.visibleOptions,selectedOptions:s,onSelectOption:(Y,B)=>{O(Y,B,n?void 0:J)},closeLayer:()=>{i&&J()},width:L(Q),small:b,focusedOptionIndex:A.layerFocus.current,firstSelectedOptionIndex:m??0,testId:h&&`${h}-layer`})}))]})})};ke.__docgenInfo={description:"",methods:[],displayName:"CustomSelect",props:{multi:{required:!1,tsType:{name:"boolean"},description:""},disabled:{required:!1,tsType:{name:"boolean"},description:""},error:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:""},warning:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:""},tooltip:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:""},options:{required:!0,tsType:{name:"Array",elements:[{name:"union",raw:"ISelectSelectedOption | Heading",elements:[{name:"ISelectSelectedOption"},{name:"Heading"}]}],raw:"TCustomSelectSelectOption[]"},description:""},selectedOptions:{required:!0,tsType:{name:"union",raw:"ISelectSelectedOption | ISelectSelectedOption[]",elements:[{name:"ISelectSelectedOption"},{name:"Array",elements:[{name:"ISelectSelectedOption"}],raw:"ISelectSelectedOption[]"}]},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:`(
|
|
38
38
|
evt: ChangeEvent<HTMLInputElement>,
|
|
39
39
|
newSelectedOptions: ISelectSelectedOption,
|
|
40
|
-
) => void`,signature:{arguments:[{type:{name:"ChangeEvent",elements:[{name:"HTMLInputElement"}],raw:"ChangeEvent<HTMLInputElement>"},name:"evt"},{type:{name:"ISelectSelectedOption"},name:"newSelectedOptions"}],return:{name:"void"}}},description:""},onCreate:{required:!1,tsType:{name:"signature",type:"function",raw:"(value: string) => void",signature:{arguments:[{type:{name:"string"},name:"value"}],return:{name:"void"}}},description:""},placeholder:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""},small:{required:!1,tsType:{name:"boolean"},description:""},tabIndex:{required:!1,tsType:{name:"number"},description:""},width:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | null",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"null"}]},description:""},autoLayerWidth:{required:!1,tsType:{name:"boolean"},description:""},onFocus:{required:!1,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},onBlur:{required:!1,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},searchable:{required:!1,tsType:{name:"boolean"},description:""},clearable:{required:!1,tsType:{name:"boolean"},description:""},isInTable:{required:!1,tsType:{name:"boolean"},description:""},groupOrder:{required:!1,tsType:{name:"union",raw:"TGroupOrder | string",elements:[{name:"union",raw:"'first' | 'middle' | 'last'",elements:[{name:"literal",value:"'first'"},{name:"literal",value:"'middle'"},{name:"literal",value:"'last'"}]},{name:"string"}]},description:""},firstSelectedOptionIndex:{required:!0,tsType:{name:"union",raw:"number | null",elements:[{name:"number"},{name:"null"}]},description:""},right:{required:!1,tsType:{name:"boolean"},description:""},maxTooltipWidth:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},closeOnOptionActionClick:{required:!1,tsType:{name:"boolean"},description:""},testId:{required:!1,tsType:{name:"union",raw:"string | undefined",elements:[{name:"string"},{name:"undefined"}]},description:""}}};const Ct=e=>{const{name:n="",options:a=[],value:d,native:c=!1,onChange:g=()=>{},deprecatedEventHandler:p=!1,autoScroll:s=!0,warning:o,error:v,checkNonExistentValues:b=!0,closeOnOptionActionClick:S=!0,testId:I,disabled:T}=e,_=!c&&s===!0,{multi:t,simpleInputs:l,options:i,selectedOptions:r,firstSelectedOptionIndex:u,hasNonExistentValue:m}=Ye(a,d,_,b),y=!t,h=c&&y;c&&!y&&console.warn("Native select does not support provided props (see stories)");const E="Value no longer available for re-selection",R=m&&!T?o?f.jsxs("div",{children:[f.jsx("div",{children:E}),f.jsx("div",{children:o})]}):E:o,x=m&&v&&!T?f.jsxs("div",{children:[f.jsx("div",{children:E}),f.jsx("div",{children:v})]}):v,q=(w,C)=>{if(p){const A=t?C.map(j=>l?j.value:j):l?C.value:C;g(A)}else{const A=!(w instanceof Event),j=t?C:C.value;A?(w.target.name=n,w.target.value=j,t||(w.target.label=C.label),g(w)):g({...w,target:{...w.target,name:n,value:j,...!t&&{label:C.label}}})}};return h?f.jsx(Ie,{...e,options:i,selectedOption:r,onChange:q,hasNonExistentValue:m,warning:R,error:x,testId:I}):f.jsx(ke,{...e,options:i,selectedOptions:r,onChange:q,multi:t,firstSelectedOptionIndex:u,warning:R,error:x,testId:I,closeOnOptionActionClick:S})};Ct.__docgenInfo={description:"",methods:[],displayName:"Select",props:{name:{required:!1,tsType:{name:"string"},description:""},multi:{required:!1,tsType:{name:"boolean"},description:""},options:{required:!1,tsType:{name:"Array",elements:[{name:"ISelectSelectedOption"}],raw:"ISelectSelectedOption[]"},description:""},value:{required:!1,tsType:{name:"any"},description:""},native:{required:!1,tsType:{name:"boolean"},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(value: any) => void",signature:{arguments:[{type:{name:"any"},name:"value"}],return:{name:"void"}}},description:""},deprecatedEventHandler:{required:!1,tsType:{name:"boolean"},description:""},autoScroll:{required:!1,tsType:{name:"boolean"},description:""},warning:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:""},error:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:""},checkNonExistentValues:{required:!1,tsType:{name:"boolean"},description:""},closeOnOptionActionClick:{required:!1,tsType:{name:"boolean"},description:""},small:{required:!1,tsType:{name:"boolean"},description:""},width:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | null",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"null"}]},description:""},borderRadius:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},onCreate:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: any) => any",signature:{arguments:[{type:{name:"any"},name:"evt"}],return:{name:"any"}}},description:""},disabled:{required:!1,tsType:{name:"boolean"},description:""},placeholder:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""},isInTable:{required:!1,tsType:{name:"boolean"},description:""},clearable:{required:!1,tsType:{name:"boolean"},description:""},searchable:{required:!1,tsType:{name:"boolean"},description:""},maxTooltipWidth:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},autoLayerWidth:{required:!1,tsType:{name:"boolean"},description:""},right:{required:!1,tsType:{name:"boolean"},description:""},tabIndex:{required:!1,tsType:{name:"number"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};export{Ct as S};
|
|
40
|
+
) => void`,signature:{arguments:[{type:{name:"ChangeEvent",elements:[{name:"HTMLInputElement"}],raw:"ChangeEvent<HTMLInputElement>"},name:"evt"},{type:{name:"ISelectSelectedOption"},name:"newSelectedOptions"}],return:{name:"void"}}},description:""},onCreate:{required:!1,tsType:{name:"signature",type:"function",raw:"(value: string) => void",signature:{arguments:[{type:{name:"string"},name:"value"}],return:{name:"void"}}},description:""},placeholder:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""},small:{required:!1,tsType:{name:"boolean"},description:""},tabIndex:{required:!1,tsType:{name:"number"},description:""},width:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | null",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"null"}]},description:""},autoLayerWidth:{required:!1,tsType:{name:"boolean"},description:""},onFocus:{required:!1,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},onBlur:{required:!1,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},searchable:{required:!1,tsType:{name:"boolean"},description:""},clearable:{required:!1,tsType:{name:"boolean"},description:""},isInTable:{required:!1,tsType:{name:"boolean"},description:""},groupOrder:{required:!1,tsType:{name:"union",raw:"TGroupOrder | string",elements:[{name:"union",raw:"'first' | 'middle' | 'last'",elements:[{name:"literal",value:"'first'"},{name:"literal",value:"'middle'"},{name:"literal",value:"'last'"}]},{name:"string"}]},description:""},firstSelectedOptionIndex:{required:!0,tsType:{name:"union",raw:"number | null",elements:[{name:"number"},{name:"null"}]},description:""},right:{required:!1,tsType:{name:"boolean"},description:""},maxTooltipWidth:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},closeOnOptionActionClick:{required:!1,tsType:{name:"boolean"},description:""},testId:{required:!1,tsType:{name:"union",raw:"string | undefined",elements:[{name:"string"},{name:"undefined"}]},description:""}}};const Ct=e=>{const{name:n="",options:a=[],value:d,native:c=!1,onChange:g=()=>{},deprecatedEventHandler:p=!1,autoScroll:s=!0,warning:o,error:v,checkNonExistentValues:b=!0,closeOnOptionActionClick:S=!0,testId:I,disabled:T}=e,_=!c&&s===!0,{multi:t,simpleInputs:l,options:i,selectedOptions:r,firstSelectedOptionIndex:u,hasNonExistentValue:m}=Ye(a,d,_,b),y=!t,h=c&&y;c&&!y&&console.warn("Native select does not support provided props (see stories)");const E="Value no longer available for re-selection",R=m&&!T?o?f.jsxs("div",{children:[f.jsx("div",{children:E}),f.jsx("div",{children:o})]}):E:o,x=m&&v&&!T?f.jsxs("div",{children:[f.jsx("div",{children:E}),f.jsx("div",{children:v})]}):v,q=(w,C)=>{if(p){const A=t?C.map(j=>l?j.value:j):l?C.value:C;g(A)}else{const A=!(w instanceof Event),j=t?C:C.value;A?(w.target.name=n,w.target.value=j,t||(w.target.label=C.label),g(w)):g({...w,target:{...w.target,name:n,value:j,...!t&&{label:C.label}}})}};return h?f.jsx(Ie,{...e,options:i,selectedOption:r,onChange:q,hasNonExistentValue:m,warning:R,error:x,testId:I}):f.jsx(ke,{...e,options:i,selectedOptions:r,onChange:q,multi:t,firstSelectedOptionIndex:u,warning:R,error:x,testId:I,closeOnOptionActionClick:S})};Ct.__docgenInfo={description:"",methods:[],displayName:"Select",props:{name:{required:!1,tsType:{name:"string"},description:""},multi:{required:!1,tsType:{name:"boolean"},description:""},options:{required:!1,tsType:{name:"Array",elements:[{name:"ISelectSelectedOption"}],raw:"ISelectSelectedOption[]"},description:""},value:{required:!1,tsType:{name:"any"},description:""},native:{required:!1,tsType:{name:"boolean"},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(value: any) => void",signature:{arguments:[{type:{name:"any"},name:"value"}],return:{name:"void"}}},description:""},deprecatedEventHandler:{required:!1,tsType:{name:"boolean"},description:""},autoScroll:{required:!1,tsType:{name:"boolean"},description:""},warning:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:""},error:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:""},checkNonExistentValues:{required:!1,tsType:{name:"boolean"},description:""},closeOnOptionActionClick:{required:!1,tsType:{name:"boolean"},description:""},small:{required:!1,tsType:{name:"boolean"},description:""},width:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | null",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"null"}]},description:""},borderRadius:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},onCreate:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: any) => any",signature:{arguments:[{type:{name:"any"},name:"evt"}],return:{name:"any"}}},description:""},disabled:{required:!1,tsType:{name:"boolean"},description:""},placeholder:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""},isInTable:{required:!1,tsType:{name:"boolean"},description:""},clearable:{required:!1,tsType:{name:"boolean"},description:""},searchable:{required:!1,tsType:{name:"boolean"},description:""},maxTooltipWidth:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},autoLayerWidth:{required:!1,tsType:{name:"boolean"},description:""},right:{required:!1,tsType:{name:"boolean"},description:""},tabIndex:{required:!1,tsType:{name:"number"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};export{$ as E,fn as K,Ct as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as n}from"./jsx-runtime-eps93zm2.js";import{r as P}from"./index-DhsZuJvc.js";import{S as d}from"./select-
|
|
1
|
+
import{j as n}from"./jsx-runtime-eps93zm2.js";import{r as P}from"./index-DhsZuJvc.js";import{S as d}from"./select-BPp24Pdw.js";import{S as p}from"./spacer-BWoNR27H.js";import{I as D}from"./common-types-Sih75Sav.js";import{I as L}from"./icon-BSFY3vDO.js";import{T as hn}from"./text-B3-TSWok.js";import"./index-Bk2sglWO.js";import"./disabled-context-rmpd7YJS.js";import"./types-UmZ4Y_CR.js";import"./lodash-BHd_uQHh.js";import"./tooltip-C_E_6ym5.js";import"./index-CUZDtIZe.js";import"./index-CEuq6vkz.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./actions-4w-EOz3m.js";import"./button-CdEIDAx8.js";import"./spinner-AWUe4xwQ.js";import"./badge-CLQ59MDF.js";import"./select.input-DIKP56UZ.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";const gn=[{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Koalas",value:"leaves"},{label:"Monkeys",value:"bananas",disabled:!0},{label:"Wombats",value:"bark"}],vn=[{label:"Kangaroos",value:"grass",details:"(grass)"},{label:"Monkeys",value:"bananas",details:"(bananas)"},{label:"Possums",value:"slugs",details:"(slugs)"}],mn=[{type:"Heading",label:"Large"},{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Monkeys",value:"bananas"},{type:"Heading",label:"Small"},{label:"Possums",value:"slugs"}],Sn=[{label:1,value:1},{label:2,value:2},{label:3,value:3},{label:4,value:4}],xn=[{label:"Yes",value:!0},{label:"No",value:!1}],Cn=[{label:"Aardvarks",value:"termites"},{label:"Monkeys",value:"bananas"},{label:"Vampires",value:"blood",icon:n.jsx(L,{icon:D.WARNING,color:"var(--color-text-warning)"})},{label:"Zombies",value:"brains",icon:n.jsx(L,{icon:D.ERROR,color:"var(--color-text-error)"})}],u=[{label:"Delete",icon:"delete",onClick:()=>{}},{label:"Rename",icon:"rename",onClick:()=>{}}],bn=[{label:"Kangaroos",value:"grass",actions:u},{label:"Monkeys",value:"bananas",actions:u},{label:"Possums",value:"slugs",actions:u,details:"(some details)"}],Vn=[{label:"Kangaroos",value:"grass",actions:u,icon:n.jsx(L,{icon:D.WARNING,color:"var(--color-text-warning)"}),details:"(grass)"},{label:"Monkeys",value:"bananas",actions:u,icon:n.jsx(L,{icon:D.WARNING,color:"var(--color-text-warning)"}),details:"(bananas)"},{label:"Possums",value:"slugs",actions:u,icon:n.jsx(L,{icon:D.WARNING,color:"var(--color-text-warning)"}),details:"(slugs)"}],wn=[...Array(1e4).keys()].map((l,s)=>({label:Math.random().toString(36).substring(7),value:s})),jn=["Aardvarks","Kangaroos","Monkeys","Possums"],zn={title:"Forms/Select",component:d,args:{options:gn,native:!1,multi:!1,disabled:!1,autoLayerWidth:!1,clearable:!1,searchable:!0,right:!1}},e=l=>{const{multi:s,value:H}=l,[r,R]=P.useState(H||(s?[]:void 0)),o=a=>{const{value:t}=a.target;R(s?t:{value:t})};return n.jsxs(n.Fragment,{children:[n.jsx(d,{value:r,onChange:o,placeholder:"Full width",...l}),n.jsx(p,{}),n.jsx(d,{value:r,onChange:o,width:"200px",placeholder:"Fixed width",...l}),n.jsx(p,{}),n.jsx(d,{value:r,onChange:o,width:"auto",placeholder:"Auto width",...l}),n.jsx(p,{}),n.jsx(d,{value:r,onChange:o,width:"auto",placeholder:"Small",small:!0,...l}),n.jsx(p,{}),n.jsx(hn,{small:!0,muted:!0,children:"Avoid auto width for very long lists."})]})},K=e.bind({}),h=e.bind({});h.args={native:!0};const g=e.bind({});g.args={multi:!0,clearable:!0};const v=e.bind({});v.args={options:[]};const m=e.bind({});m.args={clearable:!0};const S=e.bind({});S.args={value:{label:"Vampires",value:"blood"}};const x=e.bind({});x.args={placeholder:"Select the best animal..."};const C=e.bind({});C.args={options:mn};const b=e.bind({});b.args={options:vn};const V=e.bind({});V.args={options:Cn};const w=e.bind({});w.args={options:bn};const j=e.bind({});j.args={options:Vn};const y=e.bind({});y.args={searchable:!1};const f=e.bind({});f.args={right:!0};const i=e.bind({});i.parameters={docs:{description:{story:"Avoid autoLayerWidth for very long lists in custom selects (slow)"}}};i.args={width:"70px",autoLayerWidth:!0};const A=e.bind({});A.args={tooltip:"Some info"};const T=e.bind({});T.args={error:"Some info"};const F=e.bind({});F.args={warning:"Some info"};const W=e.bind({});W.args={disabled:!0};const O=e.bind({});O.args={options:Sn,placeholder:void 0};const N=e.bind({});N.args={options:xn};const k=e.bind({});k.args={options:jn};const c=e.bind({});c.parameters={docs:{description:{story:"Avoid `width: auto` and autoLayerWidth for very long lists in custom selects (slow). Consider checkNonExistentValues={false}."}}};c.args={options:wn};const E=e.bind({});E.args={deprecatedEventHandler:!0};const M=e.bind({});M.args={value:{label:"Vampires",value:"blood"},disabled:!0};const I=()=>{const[l,s]=P.useState([{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Monkeys",value:"bananas"},{label:"Possums",value:"slugs"}]),[H,r]=P.useState(void 0),[R,o]=P.useState([]);return n.jsxs(n.Fragment,{children:[n.jsx(d,{name:"example",options:l,onChange:a=>r({value:a.target.value}),onCreate:a=>{const t={label:a,value:a};s([...l,t]),r(t)},value:H,clearable:!0}),n.jsx(p,{}),n.jsx(d,{name:"example",options:l,onChange:a=>o(a.target.value),onCreate:a=>{const t={label:a,value:a};s([...l,t]),console.log(a),o([...R,t])},value:R,multi:!0,clearable:!0})]})};I.__docgenInfo={description:"",methods:[],displayName:"OnCreate"};var _,G,B;K.parameters={...K.parameters,docs:{...(_=K.parameters)==null?void 0:_.docs,source:{originalSource:`(args: any) => {
|
|
2
2
|
const {
|
|
3
3
|
multi,
|
|
4
4
|
value
|