@oliasoft-open-source/react-ui-library 4.11.2-beta-1 → 4.11.2-beta-3

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.
Files changed (46) hide show
  1. package/dist/global.css +14 -15
  2. package/dist/index.js +20 -23
  3. package/dist/index.js.map +1 -1
  4. package/dist/storybook/assets/{Color-KGDBMAHA-B-shawjD.js → Color-KGDBMAHA-BU5Cvr93.js} +1 -1
  5. package/dist/storybook/assets/{DocsRenderer-PKQXORMH-CcJF_zh-.js → DocsRenderer-PKQXORMH-giM41WN8.js} +1 -1
  6. package/dist/storybook/assets/{accordion.stories-BPKMbG3k.js → accordion.stories-BlHfHegj.js} +1 -1
  7. package/dist/storybook/assets/{buttons-and-links-BG2zqnHT.js → buttons-and-links-BA3MNFjq.js} +1 -1
  8. package/dist/storybook/assets/{casing-loads.stories-BbYDH_71.js → casing-loads.stories-Cl2tJipP.js} +1 -1
  9. package/dist/storybook/assets/{cell.stories-DC1Vo0__.js → cell.stories-rzJE_qJC.js} +1 -1
  10. package/dist/storybook/assets/{chunk-HLWAVYOI-CM47_bXG.js → chunk-HLWAVYOI-Dvbg03uT.js} +1 -1
  11. package/dist/storybook/assets/{color-Cr-qn3FE.js → color-DIyQ13kP.js} +1 -1
  12. package/dist/storybook/assets/{footer.stories-DstLAiJp.js → footer.stories-C6M5S0UZ.js} +1 -1
  13. package/dist/storybook/assets/{form.stories-C8YjdHnX.js → form.stories-BNORsn6Z.js} +1 -1
  14. package/dist/storybook/assets/{formation.stories-Bt29JldX.js → formation.stories-1WX1Nu1P.js} +1 -1
  15. package/dist/storybook/assets/{iframe-CzFXqOr-.js → iframe-B0e2q2Zd.js} +2 -2
  16. package/dist/storybook/assets/{index-B5IpJ81Q.js → index-BXJ79Lvz.js} +1 -1
  17. package/dist/storybook/assets/{index-CR-eYtkm.js → index-BlyDuQBv.js} +4 -4
  18. package/dist/storybook/assets/{initialize-context-rEvM6bdZ.js → initialize-context-Y03pJPr5.js} +1 -1
  19. package/dist/storybook/assets/{input-validation-xYDgrqcS.js → input-validation-CLZKtfoW.js} +1 -1
  20. package/dist/storybook/assets/{inputs-BKaZW2Pv.js → inputs-DlW6Jeem.js} +1 -1
  21. package/dist/storybook/assets/{layout-forms-D2dIpGLv.js → layout-forms-C6ZH-nYk.js} +1 -1
  22. package/dist/storybook/assets/{layout-general-szYPo7Nk.js → layout-general-CWqOMwXA.js} +1 -1
  23. package/dist/storybook/assets/{number-input-CNnU6gOF.js → number-input-B3_gmeWr.js} +1 -1
  24. package/dist/storybook/assets/{number-input.stories-Bo26PJmJ.js → number-input.stories-epjUq9ve.js} +1 -1
  25. package/dist/storybook/assets/number-input.test-case.stories-DeEtalIU.js +95 -0
  26. package/dist/storybook/assets/{padding-and-spacing-rWdBf9ln.js → padding-and-spacing-CfnXk0Zn.js} +1 -1
  27. package/dist/storybook/assets/{preview-BpH8OxJT.js → preview-b9pkIJl_.js} +2 -2
  28. package/dist/storybook/assets/{preview-CVuoXXv0.js → preview-jWpKVqju.js} +1 -1
  29. package/dist/storybook/assets/{row.stories-DFKACj3C.js → row.stories-DRvH8Grn.js} +1 -1
  30. package/dist/storybook/assets/{slider-Dvdl3yGr.js → slider-CcpE4BLD.js} +4 -4
  31. package/dist/storybook/assets/{slider-Cf9tPrCy.css → slider-DnRddBCy.css} +1 -1
  32. package/dist/storybook/assets/slider.stories-BqlRLY_C.js +171 -0
  33. package/dist/storybook/assets/{table-CkNaVBsz.js → table-DoyDBG6l.js} +1 -1
  34. package/dist/storybook/assets/{table.stories-rxOOpdhc.js → table.stories-BgWKzIob.js} +1 -1
  35. package/dist/storybook/assets/{title.stories-CcqyFQEQ.js → title.stories-Rv6ZO_Wl.js} +1 -1
  36. package/dist/storybook/assets/{unit-input-Byipu-z0.js → unit-input-BXg4VphV.js} +1 -1
  37. package/dist/storybook/assets/{unit-input.stories-CChVbxmI.js → unit-input.stories-Btz2M_TP.js} +1 -1
  38. package/dist/storybook/assets/{unit-input.test-case.stories-BwKiucyc.js → unit-input.test-case.stories-CZD1jf36.js} +1 -1
  39. package/dist/storybook/assets/{unit-table.stories-DvpNdCS9.js → unit-table.stories-CISvZMxX.js} +1 -1
  40. package/dist/storybook/assets/{unit-table.test-case.stories-OSAkErH8.js → unit-table.test-case.stories-tEype9om.js} +1 -1
  41. package/dist/storybook/iframe.html +1 -1
  42. package/dist/storybook/index.json +1 -1
  43. package/dist/storybook/project.json +1 -1
  44. package/package.json +1 -1
  45. package/dist/storybook/assets/number-input.test-case.stories-BBKpBWfA.js +0 -92
  46. package/dist/storybook/assets/slider.stories-ai1lgqaI.js +0 -134
@@ -1 +1 @@
1
- {"generatedAt":1725445073008,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"testPackages":{"@types/jest":"29.5.12","@vitest/coverage-c8":"0.31.4","eslint-plugin-vitest":null,"eslint-plugin-vitest-globals":"1.5.0","vitest":"1.6.0"},"packageManager":{"type":"yarn","version":"1.22.19"},"typescriptOptions":{"reactDocgen":"react-docgen"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","storybookVersion":"8.2.8","storybookVersionSpecifier":"^8.2.4","language":"typescript","storybookPackages":{"@storybook/addon-essentials":{"version":"8.2.8"},"@storybook/addon-links":{"version":"8.2.8"},"@storybook/preview-api":{"version":"8.2.8"},"@storybook/react":{"version":"8.2.8"},"@storybook/react-vite":{"version":"8.2.8"},"@storybook/test":{"version":"8.2.8"},"@storybook/test-runner":{"version":"0.19.1"},"eslint-plugin-storybook":{"version":"0.6.15"},"storybook":{"version":"8.2.8"}},"addons":{"@storybook/addon-actions":{"version":"8.2.8"},"@storybook/addon-docs":{"version":"8.2.8"},"@storybook/addon-interactions":{"version":"8.2.8"},"storybook-dark-mode":{"version":"4.0.2"}}}
1
+ {"generatedAt":1725450186420,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"testPackages":{"@types/jest":"29.5.12","@vitest/coverage-c8":"0.31.4","eslint-plugin-vitest":null,"eslint-plugin-vitest-globals":"1.5.0","vitest":"1.6.0"},"packageManager":{"type":"yarn","version":"1.22.19"},"typescriptOptions":{"reactDocgen":"react-docgen"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","storybookVersion":"8.2.8","storybookVersionSpecifier":"^8.2.4","language":"typescript","storybookPackages":{"@storybook/addon-essentials":{"version":"8.2.8"},"@storybook/addon-links":{"version":"8.2.8"},"@storybook/preview-api":{"version":"8.2.8"},"@storybook/react":{"version":"8.2.8"},"@storybook/react-vite":{"version":"8.2.8"},"@storybook/test":{"version":"8.2.8"},"@storybook/test-runner":{"version":"0.19.1"},"eslint-plugin-storybook":{"version":"0.6.15"},"storybook":{"version":"8.2.8"}},"addons":{"@storybook/addon-actions":{"version":"8.2.8"},"@storybook/addon-docs":{"version":"8.2.8"},"@storybook/addon-interactions":{"version":"8.2.8"},"storybook-dark-mode":{"version":"4.0.2"}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "4.11.2-beta-1",
3
+ "version": "4.11.2-beta-3",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {
@@ -1,92 +0,0 @@
1
- import{j as a}from"./jsx-runtime-eps93zm2.js";import{r as l}from"./index-DhsZuJvc.js";import{w as c,u as n,e as o,f as B,a as C}from"./index-DMAnyMX5.js";import{S as x}from"./spacer-BWoNR27H.js";import{G as K}from"./grid-DRkC-bt8.js";import{C as m}from"./card-EcjmryU9.js";import{B as Q}from"./button-Cbv7WK6k.js";import{H as p}from"./heading-CRNoBc7q.js";import{I as ee}from"./input-group-addon-D68iUKV2.js";import{S as te}from"./select-Cwks-WA0.js";import{I as ae}from"./input-group-BaRSJAEN.js";import{F as V}from"./field-HrLaMLbx.js";import{T as R}from"./toggle-BbFVf61v.js";import{T as ne}from"./text-B3-TSWok.js";import{M as se}from"./message-BRyKdRaX.js";import{I as X}from"./icon-BSFY3vDO.js";import{N as u}from"./number-input-CNnU6gOF.js";import"./index-CF7H4eMJ.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./spinner-AWUe4xwQ.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./help-icon-Buhx5nl6.js";import"./lodash-c4VUpsOs.js";import"./types-Dx2TtIG9.js";import"./enum-Bnn40S8Q.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-Bax0KeqM.js";import"./badge-CLQ59MDF.js";import"./select.input-CJed_LLR.js";import"./helpers-JJxzGegQ.js";import"./label-CqmyC9he.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./index-C0x1JmaP.js";import"./index-DRSy5Ssd.js";import"./input-Db9WkmPP.js";const Ke={title:"Forms/NumberInput/Test Cases",component:u,parameters:{canvas:{page:null}},args:{label:"Label"},tags:["!autodocs"]},v=()=>a.jsxs(ae,{small:!0,children:[a.jsx(u,{value:123}),a.jsx(ee,{children:"to"}),a.jsx(u,{value:123}),a.jsx(te,{options:[{value:"units",label:"units"}],width:"auto",value:"units"})]}),g=()=>{const[r,s]=l.useState("123|m");return a.jsx(u,{name:"example",onChange:t=>s(t.target.value),placeholder:"Type a value...",value:r,testId:"testId"})};g.play=async({canvasElement:r,step:s})=>{const t=c(r),i=c(r.ownerDocument.body);await s("Shows validation error for non-numeric input",async()=>{const e=t.getByTestId("testId");await n.clear(e),await n.type(e,"123x45s6"),await o(t.getByDisplayValue("123x45s6")).toBeInTheDocument(),await B.mouseOver(e),await o(e.getAttribute("data-error")).toEqual("Must be a numerical value"),await C(()=>{o(i.getByText("Must be a numerical value")).toBeInTheDocument()})})};const y=()=>{const[r,s]=l.useState("123");return a.jsx(u,{value:r,onChange:t=>{s(t.target.value)},testId:"testId",enableDisplayRounding:!0})};y.play=async({canvasElement:r,step:s})=>{const t=c(r);await s("Value should be rounded on blur",async()=>{const i=t.getByTestId("testId");await n.clear(i),await n.type(i,"123.123456789"),await n.click(r),await o(t.getByDisplayValue("123.12")).toBeInTheDocument()}),await s("Full value shown on focus",async()=>{const i=t.getByTestId("testId");await n.click(i),await o(t.getByDisplayValue("123.123456789")).toBeInTheDocument()})};const w=()=>{const[r,s]=l.useState(!0),t=()=>{s(!1),setTimeout(()=>s(!0),0)},[i,e]=l.useState("123");return a.jsxs(K,{columns:"1fr 1fr",gap:!0,children:[a.jsxs(m,{heading:a.jsx(p,{children:"Storage State (Redux)"}),children:[i,a.jsx(x,{}),a.jsx(Q,{label:"Change value",onClick:()=>e(String(Math.floor(Math.random()*100)))})]}),a.jsx(m,{heading:a.jsx(p,{icon:a.jsx(X,{icon:"refresh"}),onIconClick:t,children:"NumberInput"}),children:r&&a.jsx(u,{value:i,onChange:h=>{e(h.target.value)},error:Number(i)>=0?"":"Value must be positive"})})]})},I=()=>{const[r,s]=l.useState(!0),t=()=>{s(!1),setTimeout(()=>s(!0),0)},[i,e]=l.useState(!1),[h,Y]=l.useState(!0),[f,D]=l.useState("0.6889763779527558"),[S,Z]=l.useState(""),$=Number(f)*.3048;return a.jsxs(K,{columns:"1fr 1fr",gap:!0,children:[a.jsxs(m,{heading:a.jsx(p,{children:"Settings"}),children:[a.jsx(V,{label:"Enable display rounding:",labelLeft:!0,labelWidth:200,children:a.jsx(R,{checked:i,onChange:d=>e(d.target.checked)})}),a.jsx(V,{label:"Enable cosmetic rounding:",labelLeft:!0,labelWidth:200,children:a.jsx(R,{checked:h,onChange:d=>Y(d.target.checked)})})]}),a.jsxs(m,{heading:a.jsx(p,{icon:a.jsx(X,{icon:"refresh",testId:"triggerRerenderTestId"}),onIconClick:t,children:"NumberInput (displayed in Meters)"}),children:[a.jsx(ne,{faint:!0,children:"Cosmetic Rounding Test Cases: type 0.21 then return (compare with enableCosmeticRounding on and off)"}),a.jsx(x,{}),r&&a.jsx(u,{name:"Example",value:$,onChange:d=>{const T=String(Number(d.target.value)/.3048);D(T)},enableDisplayRounding:i,enableCosmeticRounding:h,error:Number(f)>=0?"":"Value must be positive",validationCallback:(d,T)=>{Z(T??"")},testId:"testId"})]}),a.jsxs(m,{heading:a.jsx(p,{children:"Storage State / Redux (stored in Feet)"}),children:[f,a.jsx(x,{}),a.jsx(Q,{label:"Change value",onClick:()=>D(String(Math.floor(Math.random()*100)))})]}),a.jsx(m,{heading:a.jsx(p,{children:"Test Validation Callback"}),children:S&&a.jsx(se,{message:{content:S,icon:!0,type:"Error",visible:!0}})})]})};I.play=async({canvasElement:r,step:s})=>{const t=c(r),i=c(r.ownerDocument.body);await s("Can enter decimal values",async()=>{const e=t.getByTestId("testId");await n.clear(e),await n.type(e,"123.123456789"),await n.click(r),await o(t.getByDisplayValue("123.123456789")).toBeInTheDocument()}),await s("Can enter scientific notation when storage unit is different",async()=>{const e=t.getByTestId("testId");await n.clear(e),await n.type(e,"-1.12e-3"),await o(t.getByDisplayValue("-1.12e-3")).toBeInTheDocument(),await t.getByTestId("triggerRerenderTestId").click(),await C(()=>{o(t.getByDisplayValue(-.00112)).toBeInTheDocument()})}),await s("Can enter comma decimals (converts to dot)",async()=>{const e=t.getByTestId("testId");await n.clear(e),await n.type(e,"123,456"),await o(t.getByDisplayValue("123.456")).toBeInTheDocument()}),await s("Can enter small numbers",async()=>{const e=t.getByTestId("testId");await n.clear(e),await n.type(e,"0.0000000023"),await o(t.getByDisplayValue("0.0000000023")).toBeInTheDocument()}),await s("Can enter large numbers",async()=>{const e=t.getByTestId("testId");await n.clear(e),await n.type(e,"999999999999"),await o(t.getByDisplayValue("999999999999")).toBeInTheDocument()}),await s("Shows validation error for non-numeric input",async()=>{const e=t.getByTestId("testId");await n.clear(e),await n.type(e,"123x45s6"),await n.click(r),await o(t.getByDisplayValue("123x45s6")).toBeInTheDocument(),await o(e.getAttribute("data-error")).toEqual("Must be a numerical value"),await B.mouseOver(e),await C(()=>{o(i.getAllByText("Must be a numerical value").length).toEqual(2)})})};const b=()=>{const[r,s]=l.useState("123");return a.jsx(u,{value:r,onChange:t=>{s(t.target.value)},testId:"testId"})};b.play=async({canvasElement:r,step:s})=>{const t=c(r),i=c(r.ownerDocument.body);await s("Can enter decimal values",async()=>{const e=t.getByTestId("testId");await n.clear(e),await n.type(e,"123.123456789"),await o(t.getByDisplayValue("123.123456789")).toBeInTheDocument()}),await s("Can enter scientific notation",async()=>{const e=t.getByTestId("testId");await n.clear(e),await n.type(e,"-1.12e3"),await o(t.getByDisplayValue("-1.12e3")).toBeInTheDocument()}),await s("Can enter comma decimals (converts to dot)",async()=>{const e=t.getByTestId("testId");await n.clear(e),await n.type(e,"123,456"),await o(t.getByDisplayValue("123.456")).toBeInTheDocument()}),await s("Can enter small numbers",async()=>{const e=t.getByTestId("testId");await n.clear(e),await n.type(e,"0.0000000023"),await o(t.getByDisplayValue("0.0000000023")).toBeInTheDocument()}),await s("Can enter large numbers",async()=>{const e=t.getByTestId("testId");await n.clear(e),await n.type(e,"999999999999"),await o(t.getByDisplayValue("999999999999")).toBeInTheDocument()}),await s("Shows validation error for non-numeric input",async()=>{const e=t.getByTestId("testId");await n.clear(e),await n.type(e,"123x45s6"),await o(t.getByDisplayValue("123x45s6")).toBeInTheDocument(),await o(e.getAttribute("data-error")).toEqual("Must be a numerical value"),await B.mouseOver(e),await C(()=>{o(i.getByText("Must be a numerical value")).toBeInTheDocument()})})};v.__docgenInfo={description:"",methods:[],displayName:"TestInputGroup"};g.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"Placeholder"};y.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"TestDisplayRounding"};w.__docgenInfo={description:"",methods:[],displayName:"ManagedTestCase"};I.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"DemoCosmeticRounding"};b.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"TestUserInput"};var j,k,E;v.parameters={...v.parameters,docs:{...(j=v.parameters)==null?void 0:j.docs,source:{originalSource:`() => <InputGroup small>
2
- <NumberInput value={123} />
3
- <InputGroupAddon>to</InputGroupAddon>
4
- <NumberInput value={123} />
5
- <Select options={[{
6
- value: 'units',
7
- label: 'units'
8
- }]} width="auto" value="units" />
9
- </InputGroup>`,...(E=(k=v.parameters)==null?void 0:k.docs)==null?void 0:E.source}}};var N,M,F;g.parameters={...g.parameters,docs:{...(N=g.parameters)==null?void 0:N.docs,source:{originalSource:`() => {
10
- const [value, setValue] = useState('123|m');
11
- return <NumberInput name="example" onChange={evt => setValue(evt.target.value)} placeholder="Type a value..." value={value} testId="testId" />;
12
- }`,...(F=(M=g.parameters)==null?void 0:M.docs)==null?void 0:F.source}}};var _,G,H;y.parameters={...y.parameters,docs:{...(_=y.parameters)==null?void 0:_.docs,source:{originalSource:`() => {
13
- const [value, setValue] = useState('123');
14
- return <NumberInput value={value} onChange={evt => {
15
- setValue(evt.target.value);
16
- }} testId="testId" enableDisplayRounding />;
17
- }`,...(H=(G=y.parameters)==null?void 0:G.docs)==null?void 0:H.source}}};var A,L,q;w.parameters={...w.parameters,docs:{...(A=w.parameters)==null?void 0:A.docs,source:{originalSource:`() => {
18
- const [visible, setVisible] = useState(true);
19
- const triggerRerender = () => {
20
- setVisible(false);
21
- setTimeout(() => setVisible(true), 0);
22
- };
23
- const [value, setValue] = useState('123');
24
- return <Grid columns="1fr 1fr" gap>
25
- <Card heading={<Heading>Storage State (Redux)</Heading>}>
26
- {value}
27
- <Spacer />
28
- <Button label="Change value" onClick={() => setValue(String(Math.floor(Math.random() * 100)))} />
29
- </Card>
30
- <Card heading={<Heading icon={<Icon icon="refresh" />} onIconClick={triggerRerender}>
31
- NumberInput
32
- </Heading>}>
33
- {visible && <NumberInput value={value} onChange={evt => {
34
- setValue(evt.target.value);
35
- }} error={Number(value) >= 0 ? '' : 'Value must be positive'} />}
36
- </Card>
37
- </Grid>;
38
- }`,...(q=(L=w.parameters)==null?void 0:L.docs)==null?void 0:q.source}}};var O,W,P;I.parameters={...I.parameters,docs:{...(O=I.parameters)==null?void 0:O.docs,source:{originalSource:`() => {
39
- const [visible, setVisible] = useState(true);
40
- const triggerRerender = () => {
41
- setVisible(false);
42
- setTimeout(() => setVisible(true), 0);
43
- };
44
- const [enableDisplayRounding, setEnableDisplayRounding] = useState(false);
45
- const [enableCosmeticRounding, setEnableCosmeticRounding] = useState(true);
46
- const [valueInFeet, setValueInFeet] = useState('0.6889763779527558');
47
- const [callBackError, setCallBackError] = useState('');
48
- const valueInMeters = Number(valueInFeet) * 0.3048;
49
- return <Grid columns="1fr 1fr" gap>
50
- <Card heading={<Heading>Settings</Heading>}>
51
- <Field label="Enable display rounding:" labelLeft labelWidth={200}>
52
- <Toggle checked={enableDisplayRounding} onChange={evt => setEnableDisplayRounding(evt.target.checked)} />
53
- </Field>
54
- <Field label="Enable cosmetic rounding:" labelLeft labelWidth={200}>
55
- <Toggle checked={enableCosmeticRounding} onChange={evt => setEnableCosmeticRounding(evt.target.checked)} />
56
- </Field>
57
- </Card>
58
- <Card heading={<Heading icon={<Icon icon="refresh" testId="triggerRerenderTestId" />} onIconClick={triggerRerender}>
59
- NumberInput (displayed in Meters)
60
- </Heading>}>
61
- <Text faint>
62
- Cosmetic Rounding Test Cases: type 0.21 then return (compare with
63
- enableCosmeticRounding on and off)
64
- </Text>
65
- <Spacer />
66
- {visible && <NumberInput name="Example" value={valueInMeters} onChange={evt => {
67
- const nextValueInFeet = String(Number(evt.target.value) / 0.3048);
68
- setValueInFeet(nextValueInFeet); // convert back to ft
69
- }} enableDisplayRounding={enableDisplayRounding} enableCosmeticRounding={enableCosmeticRounding} error={Number(valueInFeet) >= 0 ? '' : 'Value must be positive'} validationCallback={(name, error) => {
70
- setCallBackError(error ?? '');
71
- }} testId="testId" />}
72
- </Card>
73
- <Card heading={<Heading>Storage State / Redux (stored in Feet)</Heading>}>
74
- {valueInFeet}
75
- <Spacer />
76
- <Button label="Change value" onClick={() => setValueInFeet(String(Math.floor(Math.random() * 100)))} />
77
- </Card>
78
- <Card heading={<Heading>Test Validation Callback</Heading>}>
79
- {callBackError && <Message message={{
80
- content: callBackError,
81
- icon: true,
82
- type: 'Error',
83
- visible: true
84
- }} />}
85
- </Card>
86
- </Grid>;
87
- }`,...(P=(W=I.parameters)==null?void 0:W.docs)==null?void 0:P.source}}};var U,z,J;b.parameters={...b.parameters,docs:{...(U=b.parameters)==null?void 0:U.docs,source:{originalSource:`() => {
88
- const [value, setValue] = useState('123');
89
- return <NumberInput value={value} onChange={evt => {
90
- setValue(evt.target.value);
91
- }} testId="testId" />;
92
- }`,...(J=(z=b.parameters)==null?void 0:z.docs)==null?void 0:J.source}}};const Qe=["TestInputGroup","Placeholder","TestDisplayRounding","ManagedTestCase","DemoCosmeticRounding","TestUserInput"];export{I as DemoCosmeticRounding,w as ManagedTestCase,g as Placeholder,y as TestDisplayRounding,v as TestInputGroup,b as TestUserInput,Qe as __namedExportsOrder,Ke as default};
@@ -1,134 +0,0 @@
1
- import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as de}from"./index-DhsZuJvc.js";import{S as V}from"./slider-Dvdl3yGr.js";import{T as pe}from"./text-B3-TSWok.js";import"./lodash-c4VUpsOs.js";import"./objectSpread2-DW4nTBoq.js";import"./index-Bk2sglWO.js";import"./inheritsLoose-DP0QEDDI.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./memoize-one.esm-CcMeOnPo.js";import"./index-BI4_Bp97.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./button-Cbv7WK6k.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./index-CEuq6vkz.js";const{useArgs:ce}=__STORYBOOK_MODULE_PREVIEW_API__,ve=[{label:"S1...",tooltip:"S1 Production",value:20},{label:"S2...",tooltip:"S2 Cementing",value:40},{label:"S3...",tooltip:e.jsxs("span",{children:[e.jsx("strong",{children:"S3"})," Drilling"]}),value:60},{label:"S4...",tooltip:"S4 Shut in",value:80},{label:"S5...",tooltip:"S5 Circulate",value:100}],Fe={title:"Forms/Slider",component:V,args:{value:50,min:0,max:100}},a=r=>{const[S,b]=de.useState(r.value);return e.jsx("div",{style:{paddingTop:40},children:e.jsx(V,{...r,value:S,onChange:x=>b(x.target.value)})})},h=a.bind({}),t=a.bind({});t.args={range:!0,value:[10,40]};const n=a.bind({});n.args={label:"Number of aardvarks"};const l=a.bind({});l.args={range:!0,value:[10,40],showArrows:!0};const o=r=>{const[{value:S},b]=ce(),x=ue=>{b({value:ue.target.value})};return e.jsx(e.Fragment,{children:e.jsx(V,{...r,label:e.jsxs("span",{children:["Fixed width label: ",e.jsx("strong",{children:S*Math.random()})]}),labelWidth:"400px",value:S,onChange:x})})},i=a.bind({});i.args={showTooltip:!0};const u=a.bind({});u.args={showTooltip:!0,tooltipFormatter:r=>e.jsx(pe,{warning:!0,children:`${r} extra info lorem ipsum`})};const d=a.bind({});d.args={showArrows:!0};const p=a.bind({});p.args={marks:[{value:20},{value:40},{value:60},{value:80},{value:100}]};const c=a.bind({});c.args={marks:[{tooltip:"S1 Production",value:20},{tooltip:"S2 Cementing",value:40},{tooltip:e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"S3"})," Drilling"]}),value:60},{tooltip:"S4 Shut in",value:80},{tooltip:"S5 Circulate",value:100}]};const v=a.bind({});v.args={marks:[{label:"20m",value:20},{label:"40m",value:40},{label:"60m",value:60},{label:"80m",value:80},{label:"100m",value:100}]};const s=a.bind({});s.args={small:!0};s.parameters={docs:{description:{story:"Reduces the vertical height of the `Slider` container to align with other `small` elements."}}};const g=a.bind({});g.args={disabled:!0};const m=a.bind({});m.args={marks:ve,vertical:{enabled:!0,width:"100px",height:"400px"}};o.__docgenInfo={description:"",methods:[],displayName:"JSXLabel"};var j,T,C;h.parameters={...h.parameters,docs:{...(j=h.parameters)==null?void 0:j.docs,source:{originalSource:`args => {
2
- const [value, setValue] = useState(args.value);
3
- return <div style={{
4
- paddingTop: 40
5
- }}>
6
- <Slider
7
- // eslint-disable-next-line react/jsx-props-no-spreading
8
- {...args} value={value} onChange={evt => setValue(evt.target.value)} />
9
- </div>;
10
- }`,...(C=(T=h.parameters)==null?void 0:T.docs)==null?void 0:C.source}}};var y,w,A;t.parameters={...t.parameters,docs:{...(y=t.parameters)==null?void 0:y.docs,source:{originalSource:`args => {
11
- const [value, setValue] = useState(args.value);
12
- return <div style={{
13
- paddingTop: 40
14
- }}>
15
- <Slider
16
- // eslint-disable-next-line react/jsx-props-no-spreading
17
- {...args} value={value} onChange={evt => setValue(evt.target.value)} />
18
- </div>;
19
- }`,...(A=(w=t.parameters)==null?void 0:w.docs)==null?void 0:A.source}}};var _,f,k;n.parameters={...n.parameters,docs:{...(_=n.parameters)==null?void 0:_.docs,source:{originalSource:`args => {
20
- const [value, setValue] = useState(args.value);
21
- return <div style={{
22
- paddingTop: 40
23
- }}>
24
- <Slider
25
- // eslint-disable-next-line react/jsx-props-no-spreading
26
- {...args} value={value} onChange={evt => setValue(evt.target.value)} />
27
- </div>;
28
- }`,...(k=(f=n.parameters)==null?void 0:f.docs)==null?void 0:k.source}}};var M,W,E;l.parameters={...l.parameters,docs:{...(M=l.parameters)==null?void 0:M.docs,source:{originalSource:`args => {
29
- const [value, setValue] = useState(args.value);
30
- return <div style={{
31
- paddingTop: 40
32
- }}>
33
- <Slider
34
- // eslint-disable-next-line react/jsx-props-no-spreading
35
- {...args} value={value} onChange={evt => setValue(evt.target.value)} />
36
- </div>;
37
- }`,...(E=(W=l.parameters)==null?void 0:W.docs)==null?void 0:E.source}}};var F,L,R;o.parameters={...o.parameters,docs:{...(F=o.parameters)==null?void 0:F.docs,source:{originalSource:`args => {
38
- const [{
39
- value
40
- }, updateArgs] = useArgs();
41
- const handleChange = (evt: any) => {
42
- updateArgs({
43
- value: evt.target.value
44
- });
45
- };
46
- return <>
47
- <Slider
48
- // eslint-disable-next-line react/jsx-props-no-spreading
49
- {...args} label={<span>
50
- Fixed width label: <strong>{value * Math.random()}</strong>
51
- </span>} labelWidth="400px" value={value} onChange={handleChange} />
52
- </>;
53
- }`,...(R=(L=o.parameters)==null?void 0:L.docs)==null?void 0:R.source}}};var D,O,P;i.parameters={...i.parameters,docs:{...(D=i.parameters)==null?void 0:D.docs,source:{originalSource:`args => {
54
- const [value, setValue] = useState(args.value);
55
- return <div style={{
56
- paddingTop: 40
57
- }}>
58
- <Slider
59
- // eslint-disable-next-line react/jsx-props-no-spreading
60
- {...args} value={value} onChange={evt => setValue(evt.target.value)} />
61
- </div>;
62
- }`,...(P=(O=i.parameters)==null?void 0:O.docs)==null?void 0:P.source}}};var I,J,X;u.parameters={...u.parameters,docs:{...(I=u.parameters)==null?void 0:I.docs,source:{originalSource:`args => {
63
- const [value, setValue] = useState(args.value);
64
- return <div style={{
65
- paddingTop: 40
66
- }}>
67
- <Slider
68
- // eslint-disable-next-line react/jsx-props-no-spreading
69
- {...args} value={value} onChange={evt => setValue(evt.target.value)} />
70
- </div>;
71
- }`,...(X=(J=u.parameters)==null?void 0:J.docs)==null?void 0:X.source}}};var N,B,K;d.parameters={...d.parameters,docs:{...(N=d.parameters)==null?void 0:N.docs,source:{originalSource:`args => {
72
- const [value, setValue] = useState(args.value);
73
- return <div style={{
74
- paddingTop: 40
75
- }}>
76
- <Slider
77
- // eslint-disable-next-line react/jsx-props-no-spreading
78
- {...args} value={value} onChange={evt => setValue(evt.target.value)} />
79
- </div>;
80
- }`,...(K=(B=d.parameters)==null?void 0:B.docs)==null?void 0:K.source}}};var U,Y,$;p.parameters={...p.parameters,docs:{...(U=p.parameters)==null?void 0:U.docs,source:{originalSource:`args => {
81
- const [value, setValue] = useState(args.value);
82
- return <div style={{
83
- paddingTop: 40
84
- }}>
85
- <Slider
86
- // eslint-disable-next-line react/jsx-props-no-spreading
87
- {...args} value={value} onChange={evt => setValue(evt.target.value)} />
88
- </div>;
89
- }`,...($=(Y=p.parameters)==null?void 0:Y.docs)==null?void 0:$.source}}};var q,z,G;c.parameters={...c.parameters,docs:{...(q=c.parameters)==null?void 0:q.docs,source:{originalSource:`args => {
90
- const [value, setValue] = useState(args.value);
91
- return <div style={{
92
- paddingTop: 40
93
- }}>
94
- <Slider
95
- // eslint-disable-next-line react/jsx-props-no-spreading
96
- {...args} value={value} onChange={evt => setValue(evt.target.value)} />
97
- </div>;
98
- }`,...(G=(z=c.parameters)==null?void 0:z.docs)==null?void 0:G.source}}};var H,Q,Z;v.parameters={...v.parameters,docs:{...(H=v.parameters)==null?void 0:H.docs,source:{originalSource:`args => {
99
- const [value, setValue] = useState(args.value);
100
- return <div style={{
101
- paddingTop: 40
102
- }}>
103
- <Slider
104
- // eslint-disable-next-line react/jsx-props-no-spreading
105
- {...args} value={value} onChange={evt => setValue(evt.target.value)} />
106
- </div>;
107
- }`,...(Z=(Q=v.parameters)==null?void 0:Q.docs)==null?void 0:Z.source}}};var ee,ae,re;s.parameters={...s.parameters,docs:{...(ee=s.parameters)==null?void 0:ee.docs,source:{originalSource:`args => {
108
- const [value, setValue] = useState(args.value);
109
- return <div style={{
110
- paddingTop: 40
111
- }}>
112
- <Slider
113
- // eslint-disable-next-line react/jsx-props-no-spreading
114
- {...args} value={value} onChange={evt => setValue(evt.target.value)} />
115
- </div>;
116
- }`,...(re=(ae=s.parameters)==null?void 0:ae.docs)==null?void 0:re.source}}};var se,te,ne;g.parameters={...g.parameters,docs:{...(se=g.parameters)==null?void 0:se.docs,source:{originalSource:`args => {
117
- const [value, setValue] = useState(args.value);
118
- return <div style={{
119
- paddingTop: 40
120
- }}>
121
- <Slider
122
- // eslint-disable-next-line react/jsx-props-no-spreading
123
- {...args} value={value} onChange={evt => setValue(evt.target.value)} />
124
- </div>;
125
- }`,...(ne=(te=g.parameters)==null?void 0:te.docs)==null?void 0:ne.source}}};var le,oe,ie;m.parameters={...m.parameters,docs:{...(le=m.parameters)==null?void 0:le.docs,source:{originalSource:`args => {
126
- const [value, setValue] = useState(args.value);
127
- return <div style={{
128
- paddingTop: 40
129
- }}>
130
- <Slider
131
- // eslint-disable-next-line react/jsx-props-no-spreading
132
- {...args} value={value} onChange={evt => setValue(evt.target.value)} />
133
- </div>;
134
- }`,...(ie=(oe=m.parameters)==null?void 0:oe.docs)==null?void 0:ie.source}}};const Le=["Default","Range","Label","RangeWithArrows","JSXLabel","Tooltip","FormattedTooltip","Arrows","Marks","MarksWithExtraTooltip","MarksWithCustomLabel","Small","Disabled","Vertical"];export{d as Arrows,h as Default,g as Disabled,u as FormattedTooltip,o as JSXLabel,n as Label,p as Marks,v as MarksWithCustomLabel,c as MarksWithExtraTooltip,t as Range,l as RangeWithArrows,s as Small,i as Tooltip,m as Vertical,Le as __namedExportsOrder,Fe as default};