@oliasoft-open-source/react-ui-library 4.7.3-beta-1 → 4.7.3-beta-2
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-7PLAdoQ9.js → index-D5kcnHmD.js} +0 -1
- package/dist/index.html +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/{Color-KGDBMAHA-flSaV_MJ.js → Color-KGDBMAHA-BDaGFyls.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-PKQXORMH-B2MpYyNq.js → DocsRenderer-PKQXORMH-DeAerz72.js} +1 -1
- package/dist/storybook/assets/{accordion.stories-sb-Y7MMb.js → accordion.stories-Beb4y7rL.js} +1 -1
- package/dist/storybook/assets/{afe.stories--E_j7kET.js → afe.stories-WJoC6FVV.js} +1 -1
- package/dist/storybook/assets/{buttons-and-links-BYEAhhA9.js → buttons-and-links-GWWpybLw.js} +1 -1
- package/dist/storybook/assets/{casing-loads.stories-EZlP6XsN.js → casing-loads.stories-DeIAdq5K.js} +1 -1
- package/dist/storybook/assets/{cell.stories-D9KrTmCA.js → cell.stories-DZKcKOIi.js} +1 -1
- package/dist/storybook/assets/check-box.stories-Dqopb7XV.js +126 -0
- package/dist/storybook/assets/{chunk-HLWAVYOI-BYDWICmD.js → chunk-HLWAVYOI-rY5YQOb2.js} +1 -1
- package/dist/storybook/assets/{color-Da1CW6lH.js → color-lBkUm7cb.js} +1 -1
- package/dist/storybook/assets/dialog-dXhT3sJF.js +1 -0
- package/dist/storybook/assets/{file-input.stories-aiTQE5UN.js → file-input.stories-CJLU_nqW.js} +1 -1
- package/dist/storybook/assets/{footer.stories-B5zvZawz.js → footer.stories-BlfgJYnF.js} +1 -1
- package/dist/storybook/assets/{form.stories-D58sdhOk.js → form.stories-RD2lXS5Q.js} +1 -1
- package/dist/storybook/assets/{formation.stories-OtA8Hcp6.js → formation.stories-BC2p8tEp.js} +1 -1
- package/dist/storybook/assets/iframe-D9Shj_Nm.js +2 -0
- package/dist/storybook/assets/{index-DJ8hSxGk.js → index-4gO9mIeA.js} +4 -4
- package/dist/storybook/assets/index-Be0hXiyp.js +179 -0
- package/dist/storybook/assets/index-CF7H4eMJ.js +28 -0
- package/dist/storybook/assets/{index-B9beUMCC.js → index-NK2Pj-Tv.js} +1 -1
- package/dist/storybook/assets/{input-group.stories-hHCmTbtu.js → input-group.stories-Dtak6Me2.js} +1 -1
- package/dist/storybook/assets/{input-validation-D54Tgh0X.js → input-validation-wltu7rhx.js} +2 -2
- package/dist/storybook/assets/{inputs-D7FnSkCy.js → inputs-Bsfja93s.js} +4 -4
- package/dist/storybook/assets/{layout-forms-DMszHpOu.js → layout-forms-Bf7y_Hym.js} +1 -1
- package/dist/storybook/assets/{layout-general-CWsbvxgT.js → layout-general-DJOJ7Xv5.js} +1 -1
- package/dist/storybook/assets/menu.stories-BD7P2iMQ.js +84 -0
- package/dist/storybook/assets/message-BYzRg8Ae.js +1 -0
- package/dist/storybook/assets/{message.stories-CXOrrAOR.js → message.stories-B02RIMXw.js} +1 -1
- package/dist/storybook/assets/modal.stories-l76yG1FY.js +228 -0
- package/dist/storybook/assets/number-input.stories-CmgIvuEY.js +105 -0
- package/dist/storybook/assets/{padding-and-spacing-vB3pUNzW.js → padding-and-spacing-BnOF4Ueu.js} +1 -1
- package/dist/storybook/assets/{pagination-0wY_w1xz.js → pagination-DRdJ9LGH.js} +1 -1
- package/dist/storybook/assets/{pagination.stories-BagAIIz3.js → pagination.stories-C_4kzgcf.js} +1 -1
- package/dist/storybook/assets/{pop-confirm.stories-D4L3erpj.js → pop-confirm.stories-Dlm0BaMY.js} +1 -1
- package/dist/storybook/assets/{popover.stories-ChwzGOlc.js → popover.stories-D6_Ulo0d.js} +1 -1
- package/dist/storybook/assets/preview-DLBQXbKW.js +1 -0
- package/dist/storybook/assets/{preview-DMFuiETZ.js → preview-DtaSOELl.js} +1 -1
- package/dist/storybook/assets/{preview-1T5p1vXe.js → preview-Dyti8xUp.js} +2 -2
- package/dist/storybook/assets/radio-button.stories-Ds-DfLlj.js +71 -0
- package/dist/storybook/assets/{reservoirs.stories-DywuU8EY.js → reservoirs.stories-BUs7WSxB.js} +1 -1
- package/dist/storybook/assets/{rich-text-input.stories-Cw_6EJx8.js → rich-text-input.stories-BP79IJ53.js} +1 -1
- package/dist/storybook/assets/{row.stories-D7V0fxhq.js → row.stories-CIJowbkv.js} +1 -1
- package/dist/storybook/assets/select-BeEJzL_0.js +40 -0
- package/dist/storybook/assets/select.stories-DgC9Agq6.js +579 -0
- package/dist/storybook/assets/{smart-upload-modal.stories-Cot88l9r.js → smart-upload-modal.stories-PeStvjoa.js} +1 -1
- package/dist/storybook/assets/{table-DmwpXp_Q.js → table-B7Ro6zGB.js} +1 -1
- package/dist/storybook/assets/{table.stories-DKcZk5JR.js → table.stories-1mHu1R2T.js} +1 -1
- package/dist/storybook/assets/{title.stories-CKbl0CB2.js → title.stories-CcK2ZS1r.js} +1 -1
- package/dist/storybook/assets/toaster-BNO0suPv.js +1 -0
- package/dist/storybook/assets/toaster.stories-DYw4Syxn.js +89 -0
- package/dist/storybook/assets/toggle.stories-DKENe2T9.js +141 -0
- package/dist/storybook/assets/{unit-input.stories-DeyzCbvE.js → unit-input.stories-BdhJ50Pr.js} +24 -24
- package/dist/storybook/assets/{unit-table.stories-BoNWlaAe.js → unit-table.stories-_Z6tTx-x.js} +1 -1
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.html +6 -2
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/sb-addons/interactions-2/manager-bundle.js +233 -0
- package/dist/storybook/sb-addons/storybook-dark-mode-esm-preset-3/manager-bundle.js.LEGAL.txt +0 -0
- package/package.json +1 -1
- package/dist/storybook/assets/check-box.stories-Do-GOmLf.js +0 -102
- package/dist/storybook/assets/dialog-B-R6eAnf.js +0 -1
- package/dist/storybook/assets/iframe-BCuVAzCF.js +0 -2
- package/dist/storybook/assets/menu.stories-Bc2kf356.js +0 -82
- package/dist/storybook/assets/message-ZenLdkrf.js +0 -1
- package/dist/storybook/assets/modal.stories-ChRLG9ud.js +0 -200
- package/dist/storybook/assets/number-input.stories-COWyMRAs.js +0 -97
- package/dist/storybook/assets/radio-button.stories-BFp_qyyE.js +0 -61
- package/dist/storybook/assets/select-yqiMF9-4.js +0 -40
- package/dist/storybook/assets/select.stories-VMcOn7Ri.js +0 -914
- package/dist/storybook/assets/toaster-B8A3xIYu.js +0 -1
- package/dist/storybook/assets/toaster.stories-DuE6vvV6.js +0 -86
- package/dist/storybook/assets/toggle.stories-Cre2gnIB.js +0 -117
- /package/dist/storybook/sb-addons/{storybook-dark-mode-esm-preset-2 → interactions-2}/manager-bundle.js.LEGAL.txt +0 -0
- /package/dist/storybook/sb-addons/{storybook-dark-mode-esm-preset-2 → storybook-dark-mode-esm-preset-3}/manager-bundle.js +0 -0
|
@@ -0,0 +1,579 @@
|
|
|
1
|
+
import{j as d}from"./jsx-runtime-eps93zm2.js";import{r as b}from"./index-DhsZuJvc.js";import{w as i,u as c,e as u}from"./index-Be0hXiyp.js";import{S as z}from"./select-BeEJzL_0.js";import{S as qa}from"./spacer-BWoNR27H.js";import{I as Z}from"./common-types-Sih75Sav.js";import{I as $}from"./icon-BSFY3vDO.js";import"./index-CF7H4eMJ.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"./badge-CLQ59MDF.js";import"./select.input-DIKP56UZ.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";const _a=[{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Koalas",value:"leaves"},{label:"Monkeys",value:"bananas",disabled:!0},{label:"Wombats",value:"bark"}],Fa=[{label:"Kangaroos",value:"grass",details:"(grass)"},{label:"Monkeys",value:"bananas",details:"(bananas)"},{label:"Possums",value:"slugs",details:"(slugs)"}],Ga=[{type:"Heading",label:"Large"},{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Monkeys",value:"bananas"},{type:"Heading",label:"Small"},{label:"Possums",value:"slugs"}],Ya=[{label:1,value:1},{label:2,value:2},{label:3,value:3},{label:4,value:4}],Za=[{label:"Yes",value:!0},{label:"No",value:!1}],$a=[{label:"Aardvarks",value:"termites"},{label:"Monkeys",value:"bananas"},{label:"Vampires",value:"blood",icon:d.jsx($,{icon:Z.WARNING,color:"var(--color-text-warning)"})},{label:"Zombies",value:"brains",icon:d.jsx($,{icon:Z.ERROR,color:"var(--color-text-error)"})}],y=[{label:"Delete",icon:"delete",onClick:()=>{}},{label:"Rename",icon:"rename",onClick:()=>{}}],za=[{label:"Kangaroos",value:"grass",actions:y},{label:"Monkeys",value:"bananas",actions:y},{label:"Possums",value:"slugs",actions:y,details:"(some details)"}],Ja=[{label:"Kangaroos",value:"grass",actions:y,icon:d.jsx($,{icon:Z.WARNING,color:"var(--color-text-warning)"}),details:"(grass)"},{label:"Monkeys",value:"bananas",actions:y,icon:d.jsx($,{icon:Z.WARNING,color:"var(--color-text-warning)"}),details:"(bananas)"},{label:"Possums",value:"slugs",actions:y,icon:d.jsx($,{icon:Z.WARNING,color:"var(--color-text-warning)"}),details:"(slugs)"}],Qa=[...Array(1e4).keys()].map((t,l)=>({label:Math.random().toString(36).substring(7),value:l})),Ua=["Aardvarks","Kangaroos","Monkeys","Possums"],Tn={title:"Forms/Select",component:z,args:{options:_a,native:!1,multi:!1,disabled:!1,autoLayerWidth:!1,clearable:!1,searchable:!0,right:!1}},e=t=>{const{multi:l,value:a}=t,[s,n]=b.useState(a||(l?[]:void 0)),o=r=>{const{value:g}=r.target;n(l?g:{value:g})};return d.jsx(z,{value:s,onChange:o,...t})},J=e.bind({}),C=e.bind({});C.args={small:!0};const x=e.bind({});x.args={width:"auto"};const I=e.bind({});I.args={width:"200px"};const f=e.bind({});f.args={native:!0};const w=e.bind({});w.args={multi:!0,clearable:!0};const T=e.bind({});T.args={options:[]};const j=e.bind({});j.args={clearable:!0};const B=e.bind({});B.args={value:{label:"Vampires",value:"blood"}};const k=e.bind({});k.args={placeholder:"Select the best animal..."};const W=e.bind({});W.args={options:Ga};const O=e.bind({});O.args={options:Fa};const D=e.bind({});D.args={options:$a};const N=e.bind({});N.args={options:za};const A=e.bind({});A.args={options:Ja};const E=e.bind({});E.args={searchable:!1};const M=e.bind({});M.args={right:!0};const v=e.bind({});v.parameters={docs:{description:{story:"Avoid autoLayerWidth for very long lists in custom selects (slow)"}}};v.args={width:"70px",autoLayerWidth:!0};const L=e.bind({});L.args={tooltip:"Some info"};const K=e.bind({});K.args={error:"Some info"};const R=e.bind({});R.args={warning:"Some info"};const P=e.bind({});P.args={disabled:!0};const H=e.bind({});H.args={options:Ya,placeholder:void 0};const _=e.bind({});_.args={options:Za};const q=e.bind({});q.args={options:Ua};const m=e.bind({});m.parameters={docs:{description:{story:"Avoid `width: auto` and autoLayerWidth for very long lists in custom selects (slow). Consider checkNonExistentValues={false}."}}};m.args={options:Qa};const F=e.bind({});F.args={deprecatedEventHandler:!0};const G=e.bind({});G.args={value:{label:"Vampires",value:"blood"},disabled:!0};const Y=()=>{const[t,l]=b.useState([{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Monkeys",value:"bananas"},{label:"Possums",value:"slugs"}]),[a,s]=b.useState(void 0),[n,o]=b.useState([]);return d.jsxs(d.Fragment,{children:[d.jsx(z,{name:"example",options:t,onChange:r=>s({value:r.target.value}),onCreate:r=>{const g={label:r,value:r};l([...t,g]),s(g)},value:a,clearable:!0}),d.jsx(qa,{}),d.jsx(z,{name:"example",options:t,onChange:r=>o(r.target.value),onCreate:r=>{const g={label:r,value:r};l([...t,g]),console.log(r),o([...n,g])},value:n,multi:!0,clearable:!0})]})},h=e.bind({});h.args={testId:"testId",clearable:!0};h.play=async({canvasElement:t,step:l})=>{const a=t.parentElement?i(t.parentElement):null;a&&(await l("Select item with click",async()=>{const s=a.getByTestId("testId");await c.click(s);const n=a.getByTestId("testId-layer");await u(n).toBeInTheDocument();const o=i(n).getByText("Wombats");await c.click(o);const r=a.getByTestId("testId-value");await u(i(r).getByText("Wombats")).toBeInTheDocument()}),await l("Clear selected value",async()=>{const s=a.getByTestId("testId-clear");await c.click(s);const n=a.queryByTestId("testId-value");await u(n).not.toBeInTheDocument()}))};const S=e.bind({});S.args={testId:"testId",clearable:!0,multi:!0};S.play=async({canvasElement:t,step:l})=>{const a=t.parentElement?i(t.parentElement):null;a&&(await l("Select items with click",async()=>{const s=a.getByTestId("testId");await c.click(s);const n=a.getByTestId("testId-layer");await u(n).toBeInTheDocument();const o=i(n).getByText("Wombats");await c.click(o);const r=i(n).getByText("Kangaroos");await c.click(r),await c.click(t),await u(n).not.toBeInTheDocument();const g=a.getByTestId("testId-value");await u(i(g).getByText("Wombats")).toBeInTheDocument(),await u(i(g).getByText("Kangaroos")).toBeInTheDocument()}),await l("Deselect item with click",async()=>{const s=a.getByTestId("testId");await c.click(s);const n=a.getByTestId("testId-layer");await u(n).toBeInTheDocument();const o=i(n).getByText("Wombats");await c.click(o),await c.click(t),await u(n).not.toBeInTheDocument();const r=a.getByTestId("testId-value");await u(i(r).queryByText("Wombats")).not.toBeInTheDocument()}),await l("Clear selected values",async()=>{const s=a.getByTestId("testId-clear");await c.click(s);const n=a.queryByTestId("testId-value");await u(n).not.toBeInTheDocument()}))};const V=e.bind({});V.args={testId:"testId",disabled:!0};V.play=async({canvasElement:t,step:l})=>{const a=i(t);await l("Clicking disabled trigger should not show layer",async()=>{await a.getByTestId("testId").click();const n=a.queryByTestId("testId-layer");await u(n).toBeNull()})};const p=()=>{const[t,l]=b.useState(_a),[a,s]=b.useState(void 0);return d.jsx(z,{testId:"testId",name:"example",options:t,onChange:n=>s({value:n.target.value}),onCreate:n=>{const o={label:n,value:n};l([...t,o]),s(o)},value:a})};p.args={testId:"testId"};p.play=async({canvasElement:t,step:l})=>{const a=t.parentElement?i(t.parentElement):null;a&&await l("Create new item",async()=>{const s=a.getByTestId("testId-input");if(u(s).toBeInTheDocument(),!s)return;await c.type(s,"New value");const n=a.getByText('Create "New value"');await c.click(n);const o=a.getByTestId("testId-value");await u(i(o).getByText("New value")).toBeInTheDocument()})};Y.__docgenInfo={description:"",methods:[],displayName:"OnCreate"};p.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"TestCreate"};var Q,U,X;J.parameters={...J.parameters,docs:{...(Q=J.parameters)==null?void 0:Q.docs,source:{originalSource:`(args: any) => {
|
|
2
|
+
const {
|
|
3
|
+
multi,
|
|
4
|
+
value
|
|
5
|
+
} = args;
|
|
6
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
7
|
+
const handleChange = (evt: any) => {
|
|
8
|
+
const {
|
|
9
|
+
value
|
|
10
|
+
} = evt.target;
|
|
11
|
+
setSelectedValue(multi ? value : {
|
|
12
|
+
value
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
16
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
17
|
+
{...args} />;
|
|
18
|
+
}`,...(X=(U=J.parameters)==null?void 0:U.docs)==null?void 0:X.source}}};var ee,ae,ne;C.parameters={...C.parameters,docs:{...(ee=C.parameters)==null?void 0:ee.docs,source:{originalSource:`(args: any) => {
|
|
19
|
+
const {
|
|
20
|
+
multi,
|
|
21
|
+
value
|
|
22
|
+
} = args;
|
|
23
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
24
|
+
const handleChange = (evt: any) => {
|
|
25
|
+
const {
|
|
26
|
+
value
|
|
27
|
+
} = evt.target;
|
|
28
|
+
setSelectedValue(multi ? value : {
|
|
29
|
+
value
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
33
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
34
|
+
{...args} />;
|
|
35
|
+
}`,...(ne=(ae=C.parameters)==null?void 0:ae.docs)==null?void 0:ne.source}}};var te,se,le;x.parameters={...x.parameters,docs:{...(te=x.parameters)==null?void 0:te.docs,source:{originalSource:`(args: any) => {
|
|
36
|
+
const {
|
|
37
|
+
multi,
|
|
38
|
+
value
|
|
39
|
+
} = args;
|
|
40
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
41
|
+
const handleChange = (evt: any) => {
|
|
42
|
+
const {
|
|
43
|
+
value
|
|
44
|
+
} = evt.target;
|
|
45
|
+
setSelectedValue(multi ? value : {
|
|
46
|
+
value
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
50
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
51
|
+
{...args} />;
|
|
52
|
+
}`,...(le=(se=x.parameters)==null?void 0:se.docs)==null?void 0:le.source}}};var re,oe,ue;I.parameters={...I.parameters,docs:{...(re=I.parameters)==null?void 0:re.docs,source:{originalSource:`(args: any) => {
|
|
53
|
+
const {
|
|
54
|
+
multi,
|
|
55
|
+
value
|
|
56
|
+
} = args;
|
|
57
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
58
|
+
const handleChange = (evt: any) => {
|
|
59
|
+
const {
|
|
60
|
+
value
|
|
61
|
+
} = evt.target;
|
|
62
|
+
setSelectedValue(multi ? value : {
|
|
63
|
+
value
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
67
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
68
|
+
{...args} />;
|
|
69
|
+
}`,...(ue=(oe=I.parameters)==null?void 0:oe.docs)==null?void 0:ue.source}}};var ce,ie,de;f.parameters={...f.parameters,docs:{...(ce=f.parameters)==null?void 0:ce.docs,source:{originalSource:`(args: any) => {
|
|
70
|
+
const {
|
|
71
|
+
multi,
|
|
72
|
+
value
|
|
73
|
+
} = args;
|
|
74
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
75
|
+
const handleChange = (evt: any) => {
|
|
76
|
+
const {
|
|
77
|
+
value
|
|
78
|
+
} = evt.target;
|
|
79
|
+
setSelectedValue(multi ? value : {
|
|
80
|
+
value
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
84
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
85
|
+
{...args} />;
|
|
86
|
+
}`,...(de=(ie=f.parameters)==null?void 0:ie.docs)==null?void 0:de.source}}};var ge,pe,ve;w.parameters={...w.parameters,docs:{...(ge=w.parameters)==null?void 0:ge.docs,source:{originalSource:`(args: any) => {
|
|
87
|
+
const {
|
|
88
|
+
multi,
|
|
89
|
+
value
|
|
90
|
+
} = args;
|
|
91
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
92
|
+
const handleChange = (evt: any) => {
|
|
93
|
+
const {
|
|
94
|
+
value
|
|
95
|
+
} = evt.target;
|
|
96
|
+
setSelectedValue(multi ? value : {
|
|
97
|
+
value
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
101
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
102
|
+
{...args} />;
|
|
103
|
+
}`,...(ve=(pe=w.parameters)==null?void 0:pe.docs)==null?void 0:ve.source}}};var me,he,Se;T.parameters={...T.parameters,docs:{...(me=T.parameters)==null?void 0:me.docs,source:{originalSource:`(args: any) => {
|
|
104
|
+
const {
|
|
105
|
+
multi,
|
|
106
|
+
value
|
|
107
|
+
} = args;
|
|
108
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
109
|
+
const handleChange = (evt: any) => {
|
|
110
|
+
const {
|
|
111
|
+
value
|
|
112
|
+
} = evt.target;
|
|
113
|
+
setSelectedValue(multi ? value : {
|
|
114
|
+
value
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
118
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
119
|
+
{...args} />;
|
|
120
|
+
}`,...(Se=(he=T.parameters)==null?void 0:he.docs)==null?void 0:Se.source}}};var Ve,be,ye;j.parameters={...j.parameters,docs:{...(Ve=j.parameters)==null?void 0:Ve.docs,source:{originalSource:`(args: any) => {
|
|
121
|
+
const {
|
|
122
|
+
multi,
|
|
123
|
+
value
|
|
124
|
+
} = args;
|
|
125
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
126
|
+
const handleChange = (evt: any) => {
|
|
127
|
+
const {
|
|
128
|
+
value
|
|
129
|
+
} = evt.target;
|
|
130
|
+
setSelectedValue(multi ? value : {
|
|
131
|
+
value
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
135
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
136
|
+
{...args} />;
|
|
137
|
+
}`,...(ye=(be=j.parameters)==null?void 0:be.docs)==null?void 0:ye.source}}};var Ce,xe,Ie;B.parameters={...B.parameters,docs:{...(Ce=B.parameters)==null?void 0:Ce.docs,source:{originalSource:`(args: any) => {
|
|
138
|
+
const {
|
|
139
|
+
multi,
|
|
140
|
+
value
|
|
141
|
+
} = args;
|
|
142
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
143
|
+
const handleChange = (evt: any) => {
|
|
144
|
+
const {
|
|
145
|
+
value
|
|
146
|
+
} = evt.target;
|
|
147
|
+
setSelectedValue(multi ? value : {
|
|
148
|
+
value
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
152
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
153
|
+
{...args} />;
|
|
154
|
+
}`,...(Ie=(xe=B.parameters)==null?void 0:xe.docs)==null?void 0:Ie.source}}};var fe,we,Te;k.parameters={...k.parameters,docs:{...(fe=k.parameters)==null?void 0:fe.docs,source:{originalSource:`(args: any) => {
|
|
155
|
+
const {
|
|
156
|
+
multi,
|
|
157
|
+
value
|
|
158
|
+
} = args;
|
|
159
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
160
|
+
const handleChange = (evt: any) => {
|
|
161
|
+
const {
|
|
162
|
+
value
|
|
163
|
+
} = evt.target;
|
|
164
|
+
setSelectedValue(multi ? value : {
|
|
165
|
+
value
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
169
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
170
|
+
{...args} />;
|
|
171
|
+
}`,...(Te=(we=k.parameters)==null?void 0:we.docs)==null?void 0:Te.source}}};var je,Be,ke;W.parameters={...W.parameters,docs:{...(je=W.parameters)==null?void 0:je.docs,source:{originalSource:`(args: any) => {
|
|
172
|
+
const {
|
|
173
|
+
multi,
|
|
174
|
+
value
|
|
175
|
+
} = args;
|
|
176
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
177
|
+
const handleChange = (evt: any) => {
|
|
178
|
+
const {
|
|
179
|
+
value
|
|
180
|
+
} = evt.target;
|
|
181
|
+
setSelectedValue(multi ? value : {
|
|
182
|
+
value
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
186
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
187
|
+
{...args} />;
|
|
188
|
+
}`,...(ke=(Be=W.parameters)==null?void 0:Be.docs)==null?void 0:ke.source}}};var We,Oe,De;O.parameters={...O.parameters,docs:{...(We=O.parameters)==null?void 0:We.docs,source:{originalSource:`(args: any) => {
|
|
189
|
+
const {
|
|
190
|
+
multi,
|
|
191
|
+
value
|
|
192
|
+
} = args;
|
|
193
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
194
|
+
const handleChange = (evt: any) => {
|
|
195
|
+
const {
|
|
196
|
+
value
|
|
197
|
+
} = evt.target;
|
|
198
|
+
setSelectedValue(multi ? value : {
|
|
199
|
+
value
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
203
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
204
|
+
{...args} />;
|
|
205
|
+
}`,...(De=(Oe=O.parameters)==null?void 0:Oe.docs)==null?void 0:De.source}}};var Ne,Ae,Ee;D.parameters={...D.parameters,docs:{...(Ne=D.parameters)==null?void 0:Ne.docs,source:{originalSource:`(args: any) => {
|
|
206
|
+
const {
|
|
207
|
+
multi,
|
|
208
|
+
value
|
|
209
|
+
} = args;
|
|
210
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
211
|
+
const handleChange = (evt: any) => {
|
|
212
|
+
const {
|
|
213
|
+
value
|
|
214
|
+
} = evt.target;
|
|
215
|
+
setSelectedValue(multi ? value : {
|
|
216
|
+
value
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
220
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
221
|
+
{...args} />;
|
|
222
|
+
}`,...(Ee=(Ae=D.parameters)==null?void 0:Ae.docs)==null?void 0:Ee.source}}};var Me,Le,Ke;N.parameters={...N.parameters,docs:{...(Me=N.parameters)==null?void 0:Me.docs,source:{originalSource:`(args: any) => {
|
|
223
|
+
const {
|
|
224
|
+
multi,
|
|
225
|
+
value
|
|
226
|
+
} = args;
|
|
227
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
228
|
+
const handleChange = (evt: any) => {
|
|
229
|
+
const {
|
|
230
|
+
value
|
|
231
|
+
} = evt.target;
|
|
232
|
+
setSelectedValue(multi ? value : {
|
|
233
|
+
value
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
237
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
238
|
+
{...args} />;
|
|
239
|
+
}`,...(Ke=(Le=N.parameters)==null?void 0:Le.docs)==null?void 0:Ke.source}}};var Re,Pe,He;A.parameters={...A.parameters,docs:{...(Re=A.parameters)==null?void 0:Re.docs,source:{originalSource:`(args: any) => {
|
|
240
|
+
const {
|
|
241
|
+
multi,
|
|
242
|
+
value
|
|
243
|
+
} = args;
|
|
244
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
245
|
+
const handleChange = (evt: any) => {
|
|
246
|
+
const {
|
|
247
|
+
value
|
|
248
|
+
} = evt.target;
|
|
249
|
+
setSelectedValue(multi ? value : {
|
|
250
|
+
value
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
254
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
255
|
+
{...args} />;
|
|
256
|
+
}`,...(He=(Pe=A.parameters)==null?void 0:Pe.docs)==null?void 0:He.source}}};var _e,qe,Fe;E.parameters={...E.parameters,docs:{...(_e=E.parameters)==null?void 0:_e.docs,source:{originalSource:`(args: any) => {
|
|
257
|
+
const {
|
|
258
|
+
multi,
|
|
259
|
+
value
|
|
260
|
+
} = args;
|
|
261
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
262
|
+
const handleChange = (evt: any) => {
|
|
263
|
+
const {
|
|
264
|
+
value
|
|
265
|
+
} = evt.target;
|
|
266
|
+
setSelectedValue(multi ? value : {
|
|
267
|
+
value
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
271
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
272
|
+
{...args} />;
|
|
273
|
+
}`,...(Fe=(qe=E.parameters)==null?void 0:qe.docs)==null?void 0:Fe.source}}};var Ge,Ye,Ze;M.parameters={...M.parameters,docs:{...(Ge=M.parameters)==null?void 0:Ge.docs,source:{originalSource:`(args: any) => {
|
|
274
|
+
const {
|
|
275
|
+
multi,
|
|
276
|
+
value
|
|
277
|
+
} = args;
|
|
278
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
279
|
+
const handleChange = (evt: any) => {
|
|
280
|
+
const {
|
|
281
|
+
value
|
|
282
|
+
} = evt.target;
|
|
283
|
+
setSelectedValue(multi ? value : {
|
|
284
|
+
value
|
|
285
|
+
});
|
|
286
|
+
};
|
|
287
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
288
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
289
|
+
{...args} />;
|
|
290
|
+
}`,...(Ze=(Ye=M.parameters)==null?void 0:Ye.docs)==null?void 0:Ze.source}}};var $e,ze,Je;v.parameters={...v.parameters,docs:{...($e=v.parameters)==null?void 0:$e.docs,source:{originalSource:`(args: any) => {
|
|
291
|
+
const {
|
|
292
|
+
multi,
|
|
293
|
+
value
|
|
294
|
+
} = args;
|
|
295
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
296
|
+
const handleChange = (evt: any) => {
|
|
297
|
+
const {
|
|
298
|
+
value
|
|
299
|
+
} = evt.target;
|
|
300
|
+
setSelectedValue(multi ? value : {
|
|
301
|
+
value
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
305
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
306
|
+
{...args} />;
|
|
307
|
+
}`,...(Je=(ze=v.parameters)==null?void 0:ze.docs)==null?void 0:Je.source}}};var Qe,Ue,Xe;L.parameters={...L.parameters,docs:{...(Qe=L.parameters)==null?void 0:Qe.docs,source:{originalSource:`(args: any) => {
|
|
308
|
+
const {
|
|
309
|
+
multi,
|
|
310
|
+
value
|
|
311
|
+
} = args;
|
|
312
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
313
|
+
const handleChange = (evt: any) => {
|
|
314
|
+
const {
|
|
315
|
+
value
|
|
316
|
+
} = evt.target;
|
|
317
|
+
setSelectedValue(multi ? value : {
|
|
318
|
+
value
|
|
319
|
+
});
|
|
320
|
+
};
|
|
321
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
322
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
323
|
+
{...args} />;
|
|
324
|
+
}`,...(Xe=(Ue=L.parameters)==null?void 0:Ue.docs)==null?void 0:Xe.source}}};var ea,aa,na;K.parameters={...K.parameters,docs:{...(ea=K.parameters)==null?void 0:ea.docs,source:{originalSource:`(args: any) => {
|
|
325
|
+
const {
|
|
326
|
+
multi,
|
|
327
|
+
value
|
|
328
|
+
} = args;
|
|
329
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
330
|
+
const handleChange = (evt: any) => {
|
|
331
|
+
const {
|
|
332
|
+
value
|
|
333
|
+
} = evt.target;
|
|
334
|
+
setSelectedValue(multi ? value : {
|
|
335
|
+
value
|
|
336
|
+
});
|
|
337
|
+
};
|
|
338
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
339
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
340
|
+
{...args} />;
|
|
341
|
+
}`,...(na=(aa=K.parameters)==null?void 0:aa.docs)==null?void 0:na.source}}};var ta,sa,la;R.parameters={...R.parameters,docs:{...(ta=R.parameters)==null?void 0:ta.docs,source:{originalSource:`(args: any) => {
|
|
342
|
+
const {
|
|
343
|
+
multi,
|
|
344
|
+
value
|
|
345
|
+
} = args;
|
|
346
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
347
|
+
const handleChange = (evt: any) => {
|
|
348
|
+
const {
|
|
349
|
+
value
|
|
350
|
+
} = evt.target;
|
|
351
|
+
setSelectedValue(multi ? value : {
|
|
352
|
+
value
|
|
353
|
+
});
|
|
354
|
+
};
|
|
355
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
356
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
357
|
+
{...args} />;
|
|
358
|
+
}`,...(la=(sa=R.parameters)==null?void 0:sa.docs)==null?void 0:la.source}}};var ra,oa,ua;P.parameters={...P.parameters,docs:{...(ra=P.parameters)==null?void 0:ra.docs,source:{originalSource:`(args: any) => {
|
|
359
|
+
const {
|
|
360
|
+
multi,
|
|
361
|
+
value
|
|
362
|
+
} = args;
|
|
363
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
364
|
+
const handleChange = (evt: any) => {
|
|
365
|
+
const {
|
|
366
|
+
value
|
|
367
|
+
} = evt.target;
|
|
368
|
+
setSelectedValue(multi ? value : {
|
|
369
|
+
value
|
|
370
|
+
});
|
|
371
|
+
};
|
|
372
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
373
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
374
|
+
{...args} />;
|
|
375
|
+
}`,...(ua=(oa=P.parameters)==null?void 0:oa.docs)==null?void 0:ua.source}}};var ca,ia,da;H.parameters={...H.parameters,docs:{...(ca=H.parameters)==null?void 0:ca.docs,source:{originalSource:`(args: any) => {
|
|
376
|
+
const {
|
|
377
|
+
multi,
|
|
378
|
+
value
|
|
379
|
+
} = args;
|
|
380
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
381
|
+
const handleChange = (evt: any) => {
|
|
382
|
+
const {
|
|
383
|
+
value
|
|
384
|
+
} = evt.target;
|
|
385
|
+
setSelectedValue(multi ? value : {
|
|
386
|
+
value
|
|
387
|
+
});
|
|
388
|
+
};
|
|
389
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
390
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
391
|
+
{...args} />;
|
|
392
|
+
}`,...(da=(ia=H.parameters)==null?void 0:ia.docs)==null?void 0:da.source}}};var ga,pa,va;_.parameters={..._.parameters,docs:{...(ga=_.parameters)==null?void 0:ga.docs,source:{originalSource:`(args: any) => {
|
|
393
|
+
const {
|
|
394
|
+
multi,
|
|
395
|
+
value
|
|
396
|
+
} = args;
|
|
397
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
398
|
+
const handleChange = (evt: any) => {
|
|
399
|
+
const {
|
|
400
|
+
value
|
|
401
|
+
} = evt.target;
|
|
402
|
+
setSelectedValue(multi ? value : {
|
|
403
|
+
value
|
|
404
|
+
});
|
|
405
|
+
};
|
|
406
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
407
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
408
|
+
{...args} />;
|
|
409
|
+
}`,...(va=(pa=_.parameters)==null?void 0:pa.docs)==null?void 0:va.source}}};var ma,ha,Sa;q.parameters={...q.parameters,docs:{...(ma=q.parameters)==null?void 0:ma.docs,source:{originalSource:`(args: any) => {
|
|
410
|
+
const {
|
|
411
|
+
multi,
|
|
412
|
+
value
|
|
413
|
+
} = args;
|
|
414
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
415
|
+
const handleChange = (evt: any) => {
|
|
416
|
+
const {
|
|
417
|
+
value
|
|
418
|
+
} = evt.target;
|
|
419
|
+
setSelectedValue(multi ? value : {
|
|
420
|
+
value
|
|
421
|
+
});
|
|
422
|
+
};
|
|
423
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
424
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
425
|
+
{...args} />;
|
|
426
|
+
}`,...(Sa=(ha=q.parameters)==null?void 0:ha.docs)==null?void 0:Sa.source}}};var Va,ba,ya;m.parameters={...m.parameters,docs:{...(Va=m.parameters)==null?void 0:Va.docs,source:{originalSource:`(args: any) => {
|
|
427
|
+
const {
|
|
428
|
+
multi,
|
|
429
|
+
value
|
|
430
|
+
} = args;
|
|
431
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
432
|
+
const handleChange = (evt: any) => {
|
|
433
|
+
const {
|
|
434
|
+
value
|
|
435
|
+
} = evt.target;
|
|
436
|
+
setSelectedValue(multi ? value : {
|
|
437
|
+
value
|
|
438
|
+
});
|
|
439
|
+
};
|
|
440
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
441
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
442
|
+
{...args} />;
|
|
443
|
+
}`,...(ya=(ba=m.parameters)==null?void 0:ba.docs)==null?void 0:ya.source}}};var Ca,xa,Ia;F.parameters={...F.parameters,docs:{...(Ca=F.parameters)==null?void 0:Ca.docs,source:{originalSource:`(args: any) => {
|
|
444
|
+
const {
|
|
445
|
+
multi,
|
|
446
|
+
value
|
|
447
|
+
} = args;
|
|
448
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
449
|
+
const handleChange = (evt: any) => {
|
|
450
|
+
const {
|
|
451
|
+
value
|
|
452
|
+
} = evt.target;
|
|
453
|
+
setSelectedValue(multi ? value : {
|
|
454
|
+
value
|
|
455
|
+
});
|
|
456
|
+
};
|
|
457
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
458
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
459
|
+
{...args} />;
|
|
460
|
+
}`,...(Ia=(xa=F.parameters)==null?void 0:xa.docs)==null?void 0:Ia.source}}};var fa,wa,Ta;G.parameters={...G.parameters,docs:{...(fa=G.parameters)==null?void 0:fa.docs,source:{originalSource:`(args: any) => {
|
|
461
|
+
const {
|
|
462
|
+
multi,
|
|
463
|
+
value
|
|
464
|
+
} = args;
|
|
465
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
466
|
+
const handleChange = (evt: any) => {
|
|
467
|
+
const {
|
|
468
|
+
value
|
|
469
|
+
} = evt.target;
|
|
470
|
+
setSelectedValue(multi ? value : {
|
|
471
|
+
value
|
|
472
|
+
});
|
|
473
|
+
};
|
|
474
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
475
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
476
|
+
{...args} />;
|
|
477
|
+
}`,...(Ta=(wa=G.parameters)==null?void 0:wa.docs)==null?void 0:Ta.source}}};var ja,Ba,ka;Y.parameters={...Y.parameters,docs:{...(ja=Y.parameters)==null?void 0:ja.docs,source:{originalSource:`() => {
|
|
478
|
+
const [options, setOptions] = useState([{
|
|
479
|
+
label: 'Aardvarks',
|
|
480
|
+
value: 'termites'
|
|
481
|
+
}, {
|
|
482
|
+
label: 'Kangaroos',
|
|
483
|
+
value: 'grass'
|
|
484
|
+
}, {
|
|
485
|
+
label: 'Monkeys',
|
|
486
|
+
value: 'bananas'
|
|
487
|
+
}, {
|
|
488
|
+
label: 'Possums',
|
|
489
|
+
value: 'slugs'
|
|
490
|
+
}]);
|
|
491
|
+
const [singleValue, setSingleValue] = useState<ISelectSelectedOption | undefined>(undefined);
|
|
492
|
+
const [multiValue, setMultiValue] = useState<ISelectSelectedOption[]>([]);
|
|
493
|
+
return <>
|
|
494
|
+
<Select name="example" options={options} onChange={evt => setSingleValue({
|
|
495
|
+
value: evt.target.value
|
|
496
|
+
})} onCreate={value => {
|
|
497
|
+
const newValue = {
|
|
498
|
+
label: value,
|
|
499
|
+
value
|
|
500
|
+
};
|
|
501
|
+
setOptions([...options, newValue]);
|
|
502
|
+
setSingleValue(newValue);
|
|
503
|
+
}} value={singleValue} clearable />
|
|
504
|
+
<Spacer />
|
|
505
|
+
<Select name="example" options={options} onChange={evt => setMultiValue(evt.target.value)} onCreate={value => {
|
|
506
|
+
const newValue = {
|
|
507
|
+
label: value,
|
|
508
|
+
value
|
|
509
|
+
};
|
|
510
|
+
setOptions([...options, newValue]);
|
|
511
|
+
console.log(value);
|
|
512
|
+
setMultiValue([...multiValue, newValue]);
|
|
513
|
+
}} value={multiValue} multi clearable />
|
|
514
|
+
</>;
|
|
515
|
+
}`,...(ka=(Ba=Y.parameters)==null?void 0:Ba.docs)==null?void 0:ka.source}}};var Wa,Oa,Da;h.parameters={...h.parameters,docs:{...(Wa=h.parameters)==null?void 0:Wa.docs,source:{originalSource:`(args: any) => {
|
|
516
|
+
const {
|
|
517
|
+
multi,
|
|
518
|
+
value
|
|
519
|
+
} = args;
|
|
520
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
521
|
+
const handleChange = (evt: any) => {
|
|
522
|
+
const {
|
|
523
|
+
value
|
|
524
|
+
} = evt.target;
|
|
525
|
+
setSelectedValue(multi ? value : {
|
|
526
|
+
value
|
|
527
|
+
});
|
|
528
|
+
};
|
|
529
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
530
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
531
|
+
{...args} />;
|
|
532
|
+
}`,...(Da=(Oa=h.parameters)==null?void 0:Oa.docs)==null?void 0:Da.source}}};var Na,Aa,Ea;S.parameters={...S.parameters,docs:{...(Na=S.parameters)==null?void 0:Na.docs,source:{originalSource:`(args: any) => {
|
|
533
|
+
const {
|
|
534
|
+
multi,
|
|
535
|
+
value
|
|
536
|
+
} = args;
|
|
537
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
538
|
+
const handleChange = (evt: any) => {
|
|
539
|
+
const {
|
|
540
|
+
value
|
|
541
|
+
} = evt.target;
|
|
542
|
+
setSelectedValue(multi ? value : {
|
|
543
|
+
value
|
|
544
|
+
});
|
|
545
|
+
};
|
|
546
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
547
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
548
|
+
{...args} />;
|
|
549
|
+
}`,...(Ea=(Aa=S.parameters)==null?void 0:Aa.docs)==null?void 0:Ea.source}}};var Ma,La,Ka;V.parameters={...V.parameters,docs:{...(Ma=V.parameters)==null?void 0:Ma.docs,source:{originalSource:`(args: any) => {
|
|
550
|
+
const {
|
|
551
|
+
multi,
|
|
552
|
+
value
|
|
553
|
+
} = args;
|
|
554
|
+
const [selectedValue, setSelectedValue] = useState(value || (multi ? [] : undefined));
|
|
555
|
+
const handleChange = (evt: any) => {
|
|
556
|
+
const {
|
|
557
|
+
value
|
|
558
|
+
} = evt.target;
|
|
559
|
+
setSelectedValue(multi ? value : {
|
|
560
|
+
value
|
|
561
|
+
});
|
|
562
|
+
};
|
|
563
|
+
return <Select value={selectedValue} onChange={handleChange}
|
|
564
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
565
|
+
{...args} />;
|
|
566
|
+
}`,...(Ka=(La=V.parameters)==null?void 0:La.docs)==null?void 0:Ka.source}}};var Ra,Pa,Ha;p.parameters={...p.parameters,docs:{...(Ra=p.parameters)==null?void 0:Ra.docs,source:{originalSource:`() => {
|
|
567
|
+
const [options, setOptions] = useState(storyData.options);
|
|
568
|
+
const [singleValue, setSingleValue] = useState<ISelectSelectedOption | undefined>(undefined);
|
|
569
|
+
return <Select testId="testId" name="example" options={options} onChange={evt => setSingleValue({
|
|
570
|
+
value: evt.target.value
|
|
571
|
+
})} onCreate={value => {
|
|
572
|
+
const newValue = {
|
|
573
|
+
label: value,
|
|
574
|
+
value
|
|
575
|
+
};
|
|
576
|
+
setOptions([...options, newValue]);
|
|
577
|
+
setSingleValue(newValue);
|
|
578
|
+
}} value={singleValue} />;
|
|
579
|
+
}`,...(Ha=(Pa=p.parameters)==null?void 0:Pa.docs)==null?void 0:Ha.source}}};const jn=["Default","Small","AutoWidth","FixedWidth","Native","Multiselect","Empty","Clearable","NonExistentValue","CustomPlaceholder","OptionsWithHeadings","OptionsWithDetails","OptionsWithIcons","OptionsWithActions","OptionsWithEverything","NotSearchable","RightAligned","AutoLayerWidth","Tooltip","Error","Warning","Disabled","NumericOptions","BooleanOptions","SimpleOptions","VeryLongList","DeprecatedEventHandler","TestDisabledNonExistentValue","OnCreate","Test","TestMulti","TestDisabled","TestCreate"];export{v as AutoLayerWidth,x as AutoWidth,_ as BooleanOptions,j as Clearable,k as CustomPlaceholder,J as Default,F as DeprecatedEventHandler,P as Disabled,T as Empty,K as Error,I as FixedWidth,w as Multiselect,f as Native,B as NonExistentValue,E as NotSearchable,H as NumericOptions,Y as OnCreate,N as OptionsWithActions,O as OptionsWithDetails,A as OptionsWithEverything,W as OptionsWithHeadings,D as OptionsWithIcons,M as RightAligned,q as SimpleOptions,C as Small,h as Test,p as TestCreate,V as TestDisabled,G as TestDisabledNonExistentValue,S as TestMulti,L as Tooltip,m as VeryLongList,R as Warning,jn as __namedExportsOrder,Tn as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as i}from"./index-DhsZuJvc.js";import{B as h}from"./button-CdEIDAx8.js";import{u as Q,M as z,D as G}from"./dialog-
|
|
1
|
+
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as i}from"./index-DhsZuJvc.js";import{B as h}from"./button-CdEIDAx8.js";import{u as Q,M as z,D as G}from"./dialog-dXhT3sJF.js";import{F as J}from"./file-input-Amcc9o5I.js";import{S}from"./spacer-BWoNR27H.js";import{T as W}from"./text-B3-TSWok.js";import{P as X}from"./progress-bar-C_kV6r0Q.js";import{d as Y}from"./index-DQs5XS8h.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"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./tooltip-C_E_6ym5.js";import"./index-CUZDtIZe.js";import"./portal-GQ0_cLB6.js";import"./lodash-BHd_uQHh.js";import"./heading-EzI5s4VN.js";import"./help-icon-CfV3_Ais.js";import"./input-group-BaRSJAEN.js";import"./input-D97ganXq.js";import"./types-UmZ4Y_CR.js";import"./index-DRSy5Ssd.js";const U=250,g=4e4,b=20,I=500,M=({visible:s,prompt:p,onCloseModal:f,onUpload:m,onComplete:y,onFailed:n,onError:a,width:F,heading:_,dialogText:E,fileInputText:k,fileInputPlaceholder:N,uploadText:V,cancelText:B,testId:d})=>{const[c,v]=i.useState(null),[C,u]=i.useState(!1),[P,T]=i.useState(0);let o=0;const R=()=>{o=o+U,T(o)},A=t=>{let r=o+t;r>=.99*g&&(r=g),o=r,T(o)};i.useEffect(()=>{v(null)},[s]);const L=t=>{t.target.value&&v(t.target.value)},H=async()=>{T(0);const t=setInterval(R,U);try{if(!c)return;u(!0);const r=await m(p,c);if(!s)return;if(r){clearInterval(t);const K=setInterval(A,I/b,(g-o)/(b-1));setTimeout(()=>{y(r),clearInterval(K),u(!1)},I)}else n==null||n(),u(!1)}catch(r){a==null||a(r),u(!1)}finally{clearInterval(t)}},O=()=>{H()},x=()=>{f()},$=e.jsxs(e.Fragment,{children:[e.jsx(W,{children:E||"Upload file and extract data using a LLM"}),e.jsx(S,{}),e.jsx(J,{placeholder:N||"No file",label:k||"Select",file:c||void 0,onChange:L,testId:`${d}-file-input`,accept:"image/*"}),C&&e.jsxs(e.Fragment,{children:[e.jsx(S,{}),e.jsx(X,{percentage:Y.roundByMagnitudeToFixed(100*P/g,3)})]})]}),D=e.jsxs(e.Fragment,{children:[e.jsx(h,{label:V||"Upload",colored:!0,onClick:O,disabled:!c||C,testId:`${d}-button-upload`}),e.jsx(h,{label:B||"Cancel",onClick:x,testId:`${d}-button-cancel`})]});return Q("Escape",()=>x()),e.jsx(z,{visible:s,centered:!0,children:e.jsx(G,{dialog:{scroll:!0,heading:_||"Smart Upload",content:$,footer:D,onClose:x,width:F||350,testId:d}})})};M.__docgenInfo={description:"",methods:[],displayName:"SmartUploadModal",props:{visible:{required:!0,tsType:{name:"boolean"},description:""},prompt:{required:!0,tsType:{name:"string"},description:""},onCloseModal:{required:!0,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},onUpload:{required:!0,tsType:{name:"signature",type:"function",raw:"(prompt: string, file: File) => any",signature:{arguments:[{type:{name:"string"},name:"prompt"},{type:{name:"File"},name:"file"}],return:{name:"any"}}},description:""},onComplete:{required:!0,tsType:{name:"signature",type:"function",raw:"(data: { [key: string]: string }[]) => void",signature:{arguments:[{type:{name:"Array",elements:[{name:"signature",type:"object",raw:"{ [key: string]: string }",signature:{properties:[{key:{name:"string"},value:{name:"string",required:!0}}]}}],raw:"{ [key: string]: string }[]"},name:"data"}],return:{name:"void"}}},description:""},onFailed:{required:!1,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},onError:{required:!1,tsType:{name:"signature",type:"function",raw:"(error: any) => void",signature:{arguments:[{type:{name:"any"},name:"error"}],return:{name:"void"}}},description:""},width:{required:!1,tsType:{name:"number"},description:""},heading:{required:!1,tsType:{name:"string"},description:""},dialogText:{required:!1,tsType:{name:"string"},description:""},fileInputText:{required:!1,tsType:{name:"string"},description:""},fileInputPlaceholder:{required:!1,tsType:{name:"string"},description:""},uploadText:{required:!1,tsType:{name:"string"},description:""},cancelText:{required:!1,tsType:{name:"string"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const Ie={title:"Ai/SmartUploadModal",component:M,args:{visible:!0,prompt:"This is a prompt",onCloseModal:()=>{},onUpload:()=>{},onComplete:()=>{}},parameters:{docs:{story:{inline:!1,iframeHeight:400}}}},l=()=>{const[s,p]=i.useState(!0),f=()=>{p(!0)},m=()=>{p(!1)},y=()=>(console.log("Uploading"),new Promise(a=>{setTimeout(()=>{a([])},4e3)})),n=()=>{console.log("Completed"),m()};return e.jsxs(e.Fragment,{children:[e.jsx(M,{visible:s,prompt:"This is a prompt",onCloseModal:m,onUpload:y,onComplete:n}),e.jsx(h,{label:"Open Modal",onClick:f})]})};l.__docgenInfo={description:"",methods:[],displayName:"SmartUpload"};var j,q,w;l.parameters={...l.parameters,docs:{...(j=l.parameters)==null?void 0:j.docs,source:{originalSource:`() => {
|
|
2
2
|
const [visible, setVisible] = useState(true);
|
|
3
3
|
const openModal = () => {
|
|
4
4
|
setVisible(true);
|