@oliasoft-open-source/react-ui-library 4.2.3 → 4.2.4

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 (52) hide show
  1. package/dist/404.html +1 -1
  2. package/dist/assets/{index-cc2feb7a.js → index-26f804a8.js} +2 -7
  3. package/dist/index.html +1 -1
  4. package/dist/index.js +1 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/storybook/assets/{Color-6VNJS4EI-808eec2a.js → Color-6VNJS4EI-163220a2.js} +1 -1
  7. package/dist/storybook/assets/{DocsRenderer-NNNQARDV-5cca9a05.js → DocsRenderer-NNNQARDV-05aa1dec.js} +1 -1
  8. package/dist/storybook/assets/{WithTooltip-4HIR6TLV-35c426d7.js → WithTooltip-4HIR6TLV-324450a3.js} +1 -1
  9. package/dist/storybook/assets/{accordion.stories-28f367e8.js → accordion.stories-0f8af16e.js} +1 -1
  10. package/dist/storybook/assets/{afe.stories-cfc21d8f.js → afe.stories-afb9be07.js} +1 -1
  11. package/dist/storybook/assets/{buttons-and-links-cd06c725.js → buttons-and-links-9bbcee77.js} +1 -1
  12. package/dist/storybook/assets/{casing-loads.stories-53f0c170.js → casing-loads.stories-cfbab702.js} +1 -1
  13. package/dist/storybook/assets/{cell.stories-000c0a3d.js → cell.stories-524a7418.js} +1 -1
  14. package/dist/storybook/assets/{chunk-HLWAVYOI-81c562b1.js → chunk-HLWAVYOI-e8fc2b58.js} +1 -1
  15. package/dist/storybook/assets/{color-d3810b8e.js → color-abfd0eb6.js} +1 -1
  16. package/dist/storybook/assets/{field.stories-34933c78.js → field.stories-f1318053.js} +1 -1
  17. package/dist/storybook/assets/{file-input.stories-94743e9d.js → file-input.stories-1c6ce0ea.js} +1 -1
  18. package/dist/storybook/assets/{footer.stories-a609872b.js → footer.stories-57f07ea2.js} +1 -1
  19. package/dist/storybook/assets/{form.stories-855aa193.js → form.stories-45c0cd59.js} +1 -1
  20. package/dist/storybook/assets/{formation.stories-26609d7c.js → formation.stories-5eeaa826.js} +1 -1
  21. package/dist/storybook/assets/{formatter-SWP5E3XI-6ad445c8.js → formatter-SWP5E3XI-72c21db3.js} +1 -1
  22. package/dist/storybook/assets/{iframe-b1d7d28b.js → iframe-eb834e80.js} +1 -1
  23. package/dist/storybook/assets/{index-08c03c21.js → index-e7458aee.js} +4 -4
  24. package/dist/storybook/assets/input-d68625a5.js +1 -0
  25. package/dist/storybook/assets/{input-group.stories-854d8ff5.js → input-group.stories-a2a3400e.js} +1 -1
  26. package/dist/storybook/assets/{input-validation-88198d89.js → input-validation-3c2e0c83.js} +1 -1
  27. package/dist/storybook/assets/{input.stories-c809bbe4.js → input.stories-164d93ab.js} +1 -1
  28. package/dist/storybook/assets/{inputs-ce764c65.js → inputs-2ac34317.js} +1 -1
  29. package/dist/storybook/assets/{layout-forms-9b627848.js → layout-forms-25900038.js} +1 -1
  30. package/dist/storybook/assets/{layout-general-55ed749e.js → layout-general-4a70e2af.js} +1 -1
  31. package/dist/storybook/assets/{modal.stories-68ebfaa7.js → modal.stories-0e068cc1.js} +1 -1
  32. package/dist/storybook/assets/{number-input-1f8dcc90.js → number-input-7d49b0b3.js} +1 -1
  33. package/dist/storybook/assets/{number-input.stories-b0743e1e.js → number-input.stories-02528124.js} +1 -1
  34. package/dist/storybook/assets/{padding-and-spacing-cb26bd6d.js → padding-and-spacing-fd0bb136.js} +1 -1
  35. package/dist/storybook/assets/{pagination-556e629a.js → pagination-8aade846.js} +1 -1
  36. package/dist/storybook/assets/{pagination.stories-3834d042.js → pagination.stories-423b4938.js} +1 -1
  37. package/dist/storybook/assets/{popover.stories-3582d313.js → popover.stories-f651a81c.js} +1 -1
  38. package/dist/storybook/assets/{preview-5bb72268.js → preview-7e324763.js} +1 -1
  39. package/dist/storybook/assets/preview-fdf00da6.js +1 -0
  40. package/dist/storybook/assets/{reservoirs.stories-9edb6ff1.js → reservoirs.stories-6b14a37f.js} +1 -1
  41. package/dist/storybook/assets/{row.stories-d3e5a7b6.js → row.stories-d5b6b4a6.js} +1 -1
  42. package/dist/storybook/assets/{site.stories-464b55be.js → site.stories-dee8ce1c.js} +1 -1
  43. package/dist/storybook/assets/{syntaxhighlighter-NMPM6SWI-152b0b7a.js → syntaxhighlighter-NMPM6SWI-cda70340.js} +1 -1
  44. package/dist/storybook/assets/{table-b41d5bdc.js → table-da6f6045.js} +1 -1
  45. package/dist/storybook/assets/{table.stories-8ded62ea.js → table.stories-67a3023a.js} +1 -1
  46. package/dist/storybook/assets/{title.stories-1a983eea.js → title.stories-5b4a226c.js} +1 -1
  47. package/dist/storybook/assets/{unit-input.stories-58bddfdf.js → unit-input.stories-65984064.js} +1 -1
  48. package/dist/storybook/iframe.html +1 -1
  49. package/dist/storybook/project.json +1 -1
  50. package/package.json +1 -1
  51. package/dist/storybook/assets/input-f82f3a98.js +0 -1
  52. package/dist/storybook/assets/preview-ba5067fd.js +0 -1
@@ -1 +1 @@
1
- import{j as r}from"./jsx-runtime-f961835c.js";import{P as C}from"./popover-06e375a5.js";import{I as S}from"./input-f82f3a98.js";import{B as i}from"./button-74c97e4a.js";import{F as P}from"./flex-1d14d86c.js";import{S as B}from"./select-205cd538.js";import"./index-f80c8c95.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./index-a80ed1cf.js";import"./common-types-2c81813f.js";import"./disabled-context-d654f6ff.js";import"./types-332ceaf3.js";import"./lodash-75c70a11.js";import"./spinner-a81ebe38.js";import"./icon-e9cbb4d7.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./assertThisInitialized-081f9914.js";import"./memoize-one.esm-52518564.js";import"./types-cc224262.js";import"./text-ad1f5f1d.js";import"./actions-2d4e1c8e.js";import"./badge-20e7ee0b.js";import"./select.input-88b6ebab.js";const l=[{label:"Option 1",value:"1"},{label:"Option 2",value:"2"}],w=({close:e})=>r.jsxs(P,{gap:"var(--padding-xs)",children:[r.jsx(S,{value:"Value",width:"150px",small:!0}),r.jsx(B,{options:l,value:l[0],width:"auto",small:!0}),r.jsx(i,{colored:!0,label:"Save",onClick:()=>{},small:!0}),r.jsx(i,{label:"Cancel",onClick:e,small:!0})]}),Z={title:"Basic/Popover",component:C,args:{overflowContainer:!0,content:r.jsx(w,{}),children:r.jsx(i,{label:"Toggle me"})},decorators:[e=>r.jsx("div",{style:{display:"flex"},children:e()})],parameters:{docs:{source:{excludeDecorators:!0}}}},p=e=>r.jsx(C,{...e}),a=p.bind({}),o=p.bind({});o.args={children:r.jsx(S,{value:"Value",width:"100%"})};const s=p.bind({});s.args={closeOnOutsideClick:!1,showCloseButton:!0};const t=p.bind({});t.args={disabled:!0};var m,c,n;a.parameters={...a.parameters,docs:{...(m=a.parameters)==null?void 0:m.docs,source:{originalSource:"args => <Popover {...args} />",...(n=(c=a.parameters)==null?void 0:c.docs)==null?void 0:n.source}}};var u,d,g;o.parameters={...o.parameters,docs:{...(u=o.parameters)==null?void 0:u.docs,source:{originalSource:"args => <Popover {...args} />",...(g=(d=o.parameters)==null?void 0:d.docs)==null?void 0:g.source}}};var x,v,b;s.parameters={...s.parameters,docs:{...(x=s.parameters)==null?void 0:x.docs,source:{originalSource:"args => <Popover {...args} />",...(b=(v=s.parameters)==null?void 0:v.docs)==null?void 0:b.source}}};var f,j,h;t.parameters={...t.parameters,docs:{...(f=t.parameters)==null?void 0:f.docs,source:{originalSource:"args => <Popover {...args} />",...(h=(j=t.parameters)==null?void 0:j.docs)==null?void 0:h.source}}};const $=["Default","InputTrigger","CloseButton","Disabled"];export{s as CloseButton,a as Default,t as Disabled,o as InputTrigger,$ as __namedExportsOrder,Z as default};
1
+ import{j as r}from"./jsx-runtime-f961835c.js";import{P as C}from"./popover-06e375a5.js";import{I as S}from"./input-d68625a5.js";import{B as i}from"./button-74c97e4a.js";import{F as P}from"./flex-1d14d86c.js";import{S as B}from"./select-205cd538.js";import"./index-f80c8c95.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./index-a80ed1cf.js";import"./common-types-2c81813f.js";import"./disabled-context-d654f6ff.js";import"./types-332ceaf3.js";import"./lodash-75c70a11.js";import"./spinner-a81ebe38.js";import"./icon-e9cbb4d7.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./assertThisInitialized-081f9914.js";import"./memoize-one.esm-52518564.js";import"./types-cc224262.js";import"./text-ad1f5f1d.js";import"./actions-2d4e1c8e.js";import"./badge-20e7ee0b.js";import"./select.input-88b6ebab.js";const l=[{label:"Option 1",value:"1"},{label:"Option 2",value:"2"}],w=({close:e})=>r.jsxs(P,{gap:"var(--padding-xs)",children:[r.jsx(S,{value:"Value",width:"150px",small:!0}),r.jsx(B,{options:l,value:l[0],width:"auto",small:!0}),r.jsx(i,{colored:!0,label:"Save",onClick:()=>{},small:!0}),r.jsx(i,{label:"Cancel",onClick:e,small:!0})]}),Z={title:"Basic/Popover",component:C,args:{overflowContainer:!0,content:r.jsx(w,{}),children:r.jsx(i,{label:"Toggle me"})},decorators:[e=>r.jsx("div",{style:{display:"flex"},children:e()})],parameters:{docs:{source:{excludeDecorators:!0}}}},p=e=>r.jsx(C,{...e}),a=p.bind({}),o=p.bind({});o.args={children:r.jsx(S,{value:"Value",width:"100%"})};const s=p.bind({});s.args={closeOnOutsideClick:!1,showCloseButton:!0};const t=p.bind({});t.args={disabled:!0};var m,c,n;a.parameters={...a.parameters,docs:{...(m=a.parameters)==null?void 0:m.docs,source:{originalSource:"args => <Popover {...args} />",...(n=(c=a.parameters)==null?void 0:c.docs)==null?void 0:n.source}}};var u,d,g;o.parameters={...o.parameters,docs:{...(u=o.parameters)==null?void 0:u.docs,source:{originalSource:"args => <Popover {...args} />",...(g=(d=o.parameters)==null?void 0:d.docs)==null?void 0:g.source}}};var x,v,b;s.parameters={...s.parameters,docs:{...(x=s.parameters)==null?void 0:x.docs,source:{originalSource:"args => <Popover {...args} />",...(b=(v=s.parameters)==null?void 0:v.docs)==null?void 0:b.source}}};var f,j,h;t.parameters={...t.parameters,docs:{...(f=t.parameters)==null?void 0:f.docs,source:{originalSource:"args => <Popover {...args} />",...(h=(j=t.parameters)==null?void 0:j.docs)==null?void 0:h.source}}};const $=["Default","InputTrigger","CloseButton","Disabled"];export{s as CloseButton,a as Default,t as Disabled,o as InputTrigger,$ as __namedExportsOrder,Z as default};
@@ -1,4 +1,4 @@
1
- import{j as at}from"./jsx-runtime-f961835c.js";import{g as De,c as ct,a as ji,r as he,R as fe}from"./index-f80c8c95.js";import{T as Li}from"./toaster-541ce85b.js";import{r as da,s as ga,t as Ur,i as Di,v as ma,e as qr,w as ki,x as Mi,c as Hr,y as Bi,z as Gi,A as Ui,B as qi,C as ya,D as Hi,E as zi,F as Wi,G as Yi,H as Xi,I as Ki,J as Vi,K as Qi,p as va}from"./index-cf68f115.js";import{f as Ji,k as ba,h as Zi,i as eo,j as to,l as ro,o as no,m as ke,p as ao,q as io,r as oo,t as fn}from"./index-08c03c21.js";import{a as so}from"./isPlainObject-1cdd40eb.js";import{e as cn}from"./index-54f0d271.js";import"./chunk-HLWAVYOI-81c562b1.js";import"./index-3d476d02.js";import"./message-7e627e60.js";import"./index-a80ed1cf.js";import"./common-types-2c81813f.js";import"./icon-e9cbb4d7.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./iframe-b1d7d28b.js";import"../sb-preview/runtime.js";import"./assertThisInitialized-081f9914.js";import"./react-16-147b12fd.js";var pn="DARK_MODE";const{global:lo}=__STORYBOOK_MODULE_GLOBAL__;__STORYBOOK_MODULE_CLIENT_LOGGER__;function Te(){return Te=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Te.apply(this,arguments)}function uo(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Qe(t,e){return Qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Qe(t,e)}function fo(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Qe(t,e)}function mr(t){return mr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},mr(t)}function co(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function po(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function pt(t,e,r){return po()?pt=Reflect.construct.bind():pt=function(n,s,o){var l=[null];l.push.apply(l,s);var a=Function.bind.apply(n,l),i=new a;return o&&Qe(i,o.prototype),i},pt.apply(null,arguments)}function yr(t){var e=typeof Map=="function"?new Map:void 0;return yr=function(r){if(r===null||!co(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,n)}function n(){return pt(r,arguments,mr(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Qe(n,r)},yr(t)}var ho={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
1
+ import{j as at}from"./jsx-runtime-f961835c.js";import{g as De,c as ct,a as ji,r as he,R as fe}from"./index-f80c8c95.js";import{T as Li}from"./toaster-541ce85b.js";import{r as da,s as ga,t as Ur,i as Di,v as ma,e as qr,w as ki,x as Mi,c as Hr,y as Bi,z as Gi,A as Ui,B as qi,C as ya,D as Hi,E as zi,F as Wi,G as Yi,H as Xi,I as Ki,J as Vi,K as Qi,p as va}from"./index-cf68f115.js";import{f as Ji,k as ba,h as Zi,i as eo,j as to,l as ro,o as no,m as ke,p as ao,q as io,r as oo,t as fn}from"./index-e7458aee.js";import{a as so}from"./isPlainObject-1cdd40eb.js";import{e as cn}from"./index-54f0d271.js";import"./chunk-HLWAVYOI-e8fc2b58.js";import"./index-3d476d02.js";import"./message-7e627e60.js";import"./index-a80ed1cf.js";import"./common-types-2c81813f.js";import"./icon-e9cbb4d7.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./iframe-eb834e80.js";import"../sb-preview/runtime.js";import"./assertThisInitialized-081f9914.js";import"./react-16-147b12fd.js";var pn="DARK_MODE";const{global:lo}=__STORYBOOK_MODULE_GLOBAL__;__STORYBOOK_MODULE_CLIENT_LOGGER__;function Te(){return Te=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Te.apply(this,arguments)}function uo(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Qe(t,e){return Qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Qe(t,e)}function fo(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Qe(t,e)}function mr(t){return mr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},mr(t)}function co(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function po(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function pt(t,e,r){return po()?pt=Reflect.construct.bind():pt=function(n,s,o){var l=[null];l.push.apply(l,s);var a=Function.bind.apply(n,l),i=new a;return o&&Qe(i,o.prototype),i},pt.apply(null,arguments)}function yr(t){var e=typeof Map=="function"?new Map:void 0;return yr=function(r){if(r===null||!co(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,n)}function n(){return pt(r,arguments,mr(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Qe(n,r)},yr(t)}var ho={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
2
2
 
3
3
  `,2:`Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).
4
4
 
@@ -0,0 +1 @@
1
+ import{_ as e}from"./iframe-eb834e80.js";import"../sb-preview/runtime.js";var a={docs:{renderer:async()=>{let{DocsRenderer:r}=await e(()=>import("./DocsRenderer-NNNQARDV-05aa1dec.js"),["./DocsRenderer-NNNQARDV-05aa1dec.js","./chunk-HLWAVYOI-e8fc2b58.js","./iframe-eb834e80.js","./index-f80c8c95.js","./react-16-147b12fd.js","./index-3d476d02.js","./index-e7458aee.js","./inheritsLoose-d4851ab8.js","./assertThisInitialized-081f9914.js","./index-cf68f115.js"],import.meta.url);return new r}}};export{a as parameters};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./jsx-runtime-f961835c.js";import{r as b}from"./index-f80c8c95.js";import{I as j}from"./common-types-2c81813f.js";import{T as w}from"./top-bar-a84b9365.js";import{S as L}from"./side-bar-88e8cf41.js";import{H as t}from"./heading-d29eb744.js";import{B as m}from"./button-74c97e4a.js";import{D as v}from"./drawer-7f450988.js";import{L as C}from"./list-0dc3df85.js";import{F as l}from"./field-a094cd72.js";import{I as i}from"./input-f82f3a98.js";import{C as p}from"./check-box-e21258d5.js";import{R as h}from"./radio-button-135a9615.js";import{C as d}from"./card-3847c251.js";import{F}from"./form-row-19dd7f6e.js";import{P as g}from"./page-6d07f774.js";import{R as a,C as r}from"./row-2299f0e7.js";import{S as R}from"./select-205cd538.js";import{S as f}from"./spacer-54db0620.js";import"./index-a80ed1cf.js";import"./icon-e9cbb4d7.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./actions-2d4e1c8e.js";import"./lodash-75c70a11.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./index-c7f280f6.js";import"./help-icon-d4189b1b.js";import"./spinner-a81ebe38.js";import"./index.es-85cc7dfc.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./memoize-one.esm-52518564.js";import"./list-heading-88cc8a9b.js";import"./loader-87ec8334.js";import"./label-13d490a3.js";import"./select.input-88b6ebab.js";import"./styled-components.browser.esm-416d73e5.js";import"./assertThisInitialized-081f9914.js";import"./text-ad1f5f1d.js";const k=({width:s,height:n})=>e.jsx("div",{style:{background:"#ddd",width:s,height:n}}),Le={title:"Layout/Layout Examples",parameters:{layout:"fullscreen",docs:{story:{inline:!1,iframeHeight:400}}}},o=()=>{const[s,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(!s),round:!0,icon:j.CHEVRON_LEFT}),open:s,width:300,closedWidth:"var(--size-sidebar)",children:e.jsx(C,{drawer:!0,narrow:!s,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%"})})})]})})]})]})]})]})})]})};var u,x,c;o.parameters={...o.parameters,docs:{...(u=o.parameters)==null?void 0:u.docs,source:{originalSource:`() => {
1
+ import{j as e}from"./jsx-runtime-f961835c.js";import{r as b}from"./index-f80c8c95.js";import{I as j}from"./common-types-2c81813f.js";import{T as w}from"./top-bar-a84b9365.js";import{S as L}from"./side-bar-88e8cf41.js";import{H as t}from"./heading-d29eb744.js";import{B as m}from"./button-74c97e4a.js";import{D as v}from"./drawer-7f450988.js";import{L as C}from"./list-0dc3df85.js";import{F as l}from"./field-a094cd72.js";import{I as i}from"./input-d68625a5.js";import{C as p}from"./check-box-e21258d5.js";import{R as h}from"./radio-button-135a9615.js";import{C as d}from"./card-3847c251.js";import{F}from"./form-row-19dd7f6e.js";import{P as g}from"./page-6d07f774.js";import{R as a,C as r}from"./row-2299f0e7.js";import{S as R}from"./select-205cd538.js";import{S as f}from"./spacer-54db0620.js";import"./index-a80ed1cf.js";import"./icon-e9cbb4d7.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./actions-2d4e1c8e.js";import"./lodash-75c70a11.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./index-c7f280f6.js";import"./help-icon-d4189b1b.js";import"./spinner-a81ebe38.js";import"./index.es-85cc7dfc.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./memoize-one.esm-52518564.js";import"./list-heading-88cc8a9b.js";import"./loader-87ec8334.js";import"./label-13d490a3.js";import"./select.input-88b6ebab.js";import"./styled-components.browser.esm-416d73e5.js";import"./assertThisInitialized-081f9914.js";import"./text-ad1f5f1d.js";const k=({width:s,height:n})=>e.jsx("div",{style:{background:"#ddd",width:s,height:n}}),Le={title:"Layout/Layout Examples",parameters:{layout:"fullscreen",docs:{story:{inline:!1,iframeHeight:400}}}},o=()=>{const[s,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(!s),round:!0,icon:j.CHEVRON_LEFT}),open:s,width:300,closedWidth:"var(--size-sidebar)",children:e.jsx(C,{drawer:!0,narrow:!s,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%"})})})]})})]})]})]})]})})]})};var u,x,c;o.parameters={...o.parameters,docs:{...(u=o.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
- import{j as o}from"./jsx-runtime-f961835c.js";import{r as R}from"./index-f80c8c95.js";import{T as c}from"./table-b41d5bdc.js";import{T as V}from"./text-ad1f5f1d.js";import{t as g,i as W,q as B}from"./table.stories-data-8a836b92.js";import"./index-a80ed1cf.js";import"./index.es-85cc7dfc.js";import"./inheritsLoose-d4851ab8.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./index-3d476d02.js";import"./memoize-one.esm-52518564.js";import"./icon-e9cbb4d7.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./lodash-75c70a11.js";import"./actions-2d4e1c8e.js";import"./common-types-2c81813f.js";import"./button-74c97e4a.js";import"./spinner-a81ebe38.js";import"./tooltip-23e84186.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./heading-d29eb744.js";import"./help-icon-d4189b1b.js";import"./pagination-556e629a.js";import"./select-205cd538.js";import"./assertThisInitialized-081f9914.js";import"./select.input-88b6ebab.js";import"./input-f82f3a98.js";import"./input-group-20c3add3.js";import"./input-group-addon-f8f6683a.js";import"./number-input-1f8dcc90.js";import"./index-57d7693e.js";import"./index-54f0d271.js";import"./check-box-e21258d5.js";import"./slider-160e2152.js";import"./index-c7f280f6.js";import"./popover-06e375a5.js";import"./flex-1d14d86c.js";const Ae={title:"Basic/Table/Row",component:c,args:{table:{...g}}},b=n=>o.jsx(c,{...n}),i=b.bind({});i.args={table:W};const p=b.bind({});p.args={table:B};const t=b.bind({});t.args={table:{...g,striped:!1}};t.parameters={docs:{description:{story:"`striped: false` removes tinted background on alternative rows."}}};const m=()=>{const[n,e]=R.useState(null),a=r=>e(n===r?null:r);return o.jsx(c,{table:{...g,striped:!1,rows:g.rows.map((r,d)=>({...r,onRowClick:()=>a(d),expandedContent:{content:n===d?o.jsx("div",{children:"Example expanded content"}):null}}))}})},w=()=>{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,u,l)=>{const x=[...s];return s[l].noDrag?s:(x.splice(l,0,x.splice(u,1)[0]),x)},[a,r]=R.useState(n.rows),d=s=>{const{to:u,from:l}=s;e(a,l,u),r(e(a,l,u))};return o.jsx(c,{table:{...n,rows:a},onListReorder:d})},v=()=>{const[n,e]=R.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(V,{children:n}),o.jsx(c,{table:{fixedWidth:"100%",headers:[{cells:[{value:"Description"},{value:"Value"}],onRowMouseEnter:()=>e("Hovering header row"),onRowMouseLeave:()=>e("Not hovering any row...")}],rows:a}})]})};var y,D,E;i.parameters={...i.parameters,docs:{...(y=i.parameters)==null?void 0:y.docs,source:{originalSource:`args => {
1
+ import{j as o}from"./jsx-runtime-f961835c.js";import{r as R}from"./index-f80c8c95.js";import{T as c}from"./table-da6f6045.js";import{T as V}from"./text-ad1f5f1d.js";import{t as g,i as W,q as B}from"./table.stories-data-8a836b92.js";import"./index-a80ed1cf.js";import"./index.es-85cc7dfc.js";import"./inheritsLoose-d4851ab8.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./index-3d476d02.js";import"./memoize-one.esm-52518564.js";import"./icon-e9cbb4d7.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./lodash-75c70a11.js";import"./actions-2d4e1c8e.js";import"./common-types-2c81813f.js";import"./button-74c97e4a.js";import"./spinner-a81ebe38.js";import"./tooltip-23e84186.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./heading-d29eb744.js";import"./help-icon-d4189b1b.js";import"./pagination-8aade846.js";import"./select-205cd538.js";import"./assertThisInitialized-081f9914.js";import"./select.input-88b6ebab.js";import"./input-d68625a5.js";import"./input-group-20c3add3.js";import"./input-group-addon-f8f6683a.js";import"./number-input-7d49b0b3.js";import"./index-57d7693e.js";import"./index-54f0d271.js";import"./check-box-e21258d5.js";import"./slider-160e2152.js";import"./index-c7f280f6.js";import"./popover-06e375a5.js";import"./flex-1d14d86c.js";const Ae={title:"Basic/Table/Row",component:c,args:{table:{...g}}},b=n=>o.jsx(c,{...n}),i=b.bind({});i.args={table:W};const p=b.bind({});p.args={table:B};const t=b.bind({});t.args={table:{...g,striped:!1}};t.parameters={docs:{description:{story:"`striped: false` removes tinted background on alternative rows."}}};const m=()=>{const[n,e]=R.useState(null),a=r=>e(n===r?null:r);return o.jsx(c,{table:{...g,striped:!1,rows:g.rows.map((r,d)=>({...r,onRowClick:()=>a(d),expandedContent:{content:n===d?o.jsx("div",{children:"Example expanded content"}):null}}))}})},w=()=>{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,u,l)=>{const x=[...s];return s[l].noDrag?s:(x.splice(l,0,x.splice(u,1)[0]),x)},[a,r]=R.useState(n.rows),d=s=>{const{to:u,from:l}=s;e(a,l,u),r(e(a,l,u))};return o.jsx(c,{table:{...n,rows:a},onListReorder:d})},v=()=>{const[n,e]=R.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(V,{children:n}),o.jsx(c,{table:{fixedWidth:"100%",headers:[{cells:[{value:"Description"},{value:"Value"}],onRowMouseEnter:()=>e("Hovering header row"),onRowMouseLeave:()=>e("Not hovering any row...")}],rows:a}})]})};var y,D,E;i.parameters={...i.parameters,docs:{...(y=i.parameters)==null?void 0:y.docs,source:{originalSource:`args => {
2
2
  return <Table
3
3
  // eslint-disable-next-line react/jsx-props-no-spreading
4
4
  {...args} />;
@@ -1,4 +1,4 @@
1
- import{j as e}from"./jsx-runtime-f961835c.js";import{r as x}from"./index-f80c8c95.js";import{I as j}from"./common-types-2c81813f.js";import{T as g}from"./top-bar-a84b9365.js";import{S as w}from"./side-bar-88e8cf41.js";import{H as t}from"./heading-d29eb744.js";import{B as L}from"./button-74c97e4a.js";import{D as v}from"./drawer-7f450988.js";import{L as d}from"./list-0dc3df85.js";import{F as l}from"./field-a094cd72.js";import{I as a}from"./input-f82f3a98.js";import{C as m}from"./check-box-e21258d5.js";import{P as f}from"./page-6d07f774.js";import{R as o,C as i}from"./row-2299f0e7.js";import{A as u}from"./accordion-168fa7c5.js";import{S as s}from"./spacer-54db0620.js";import{T as F}from"./tabs-cf5ccede.js";import"./index-a80ed1cf.js";import"./icon-e9cbb4d7.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./actions-2d4e1c8e.js";import"./lodash-75c70a11.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./index-c7f280f6.js";import"./help-icon-d4189b1b.js";import"./spinner-a81ebe38.js";import"./index.es-85cc7dfc.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./memoize-one.esm-52518564.js";import"./card-3847c251.js";import"./list-heading-88cc8a9b.js";import"./loader-87ec8334.js";import"./label-13d490a3.js";import"./styled-components.browser.esm-416d73e5.js";import"./select.input-88b6ebab.js";const C=[{label:"Import",value:"import",right:!0},{label:"Settings",value:"settings",right:!0}],S=()=>e.jsx("div",{style:{background:"#AAD3DF",borderLeft:"1px solid #8AB3BF",display:"flex",alignItems:"center",justifyContent:"center",color:"white",height:"100%"},children:"MAP"}),be={title:"Layout/Layout Examples",parameters:{layout:"fullscreen",docs:{story:{inline:!1,iframeHeight:400}}}},n=()=>{const[r,b]=x.useState(!0);return e.jsxs(e.Fragment,{children:[e.jsx(g,{}),e.jsx(w,{options:{title:"",sections:[]},width:"250px"}),e.jsx(f,{padding:!1,scroll:!1,children:e.jsxs(o,{spacing:0,flex:!0,children:[e.jsxs(v,{button:e.jsx(L,{onClick:()=>b(!r),round:!0,icon:j.CHEVRON_LEFT}),open:r,width:300,closedWidth:"var(--size-sidebar)",children:[e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Sites",items:[{id:1,name:"Main Site",type:"Heading"},{id:2,name:"Site name here",active:!0,label:{value:1,color:"#69779b"}},{id:3,name:"Locations",type:"Heading"},{id:4,name:"Ipsum",label:{value:2,color:"#69779b"}},{id:5,name:"Dolor",label:{value:3,color:"#69779b"}}]}}),e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Wells",items:[{id:1,name:"Main Wellbore",type:"Heading"},{id:2,name:"Lorem",label:{value:1,color:"#77699b"}}]}}),e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Targets",items:[{id:1,name:"Lorem",label:{value:1,color:"#9b6977"}}]}})]}),e.jsxs(i,{borderLeft:!0,flexbox:!0,children:[e.jsx(s,{}),e.jsx(F,{padding:!0,margin:!1,options:C}),e.jsxs(o,{spacing:0,flex:!0,children:[e.jsxs(i,{scroll:!0,padding:!0,width:550,children:[e.jsx(t,{top:!0,children:"Site name here"}),e.jsx(l,{label:"Name",children:e.jsx(a,{value:"Site name here",width:"200px"})}),e.jsxs(u,{heading:e.jsx(t,{children:"Coordinate Reference System"}),managed:!0,children:[e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{children:e.jsx(m,{label:"Dolor"})})]}),e.jsx(s,{}),e.jsx(t,{marginBottom:"var(--padding)",children:"Location"}),e.jsxs(o,{children:[e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})})]}),e.jsx(s,{}),e.jsx(t,{marginBottom:"var(--padding)",children:"Model"}),e.jsxs(o,{children:[e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})})]}),e.jsxs(u,{heading:e.jsx(t,{children:"Settings"}),managed:!0,children:[e.jsx(l,{children:e.jsx(m,{label:"Dolor"})}),e.jsxs(o,{children:[e.jsxs(i,{children:[e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})]}),e.jsxs(i,{children:[e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})]})]})]})]}),e.jsx(i,{children:e.jsx(S,{})})]})]})]})})]})};var p,c,h;n.parameters={...n.parameters,docs:{...(p=n.parameters)==null?void 0:p.docs,source:{originalSource:`() => {
1
+ import{j as e}from"./jsx-runtime-f961835c.js";import{r as x}from"./index-f80c8c95.js";import{I as j}from"./common-types-2c81813f.js";import{T as g}from"./top-bar-a84b9365.js";import{S as w}from"./side-bar-88e8cf41.js";import{H as t}from"./heading-d29eb744.js";import{B as L}from"./button-74c97e4a.js";import{D as v}from"./drawer-7f450988.js";import{L as d}from"./list-0dc3df85.js";import{F as l}from"./field-a094cd72.js";import{I as a}from"./input-d68625a5.js";import{C as m}from"./check-box-e21258d5.js";import{P as f}from"./page-6d07f774.js";import{R as o,C as i}from"./row-2299f0e7.js";import{A as u}from"./accordion-168fa7c5.js";import{S as s}from"./spacer-54db0620.js";import{T as F}from"./tabs-cf5ccede.js";import"./index-a80ed1cf.js";import"./icon-e9cbb4d7.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./actions-2d4e1c8e.js";import"./lodash-75c70a11.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./index-c7f280f6.js";import"./help-icon-d4189b1b.js";import"./spinner-a81ebe38.js";import"./index.es-85cc7dfc.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./memoize-one.esm-52518564.js";import"./card-3847c251.js";import"./list-heading-88cc8a9b.js";import"./loader-87ec8334.js";import"./label-13d490a3.js";import"./styled-components.browser.esm-416d73e5.js";import"./select.input-88b6ebab.js";const C=[{label:"Import",value:"import",right:!0},{label:"Settings",value:"settings",right:!0}],S=()=>e.jsx("div",{style:{background:"#AAD3DF",borderLeft:"1px solid #8AB3BF",display:"flex",alignItems:"center",justifyContent:"center",color:"white",height:"100%"},children:"MAP"}),be={title:"Layout/Layout Examples",parameters:{layout:"fullscreen",docs:{story:{inline:!1,iframeHeight:400}}}},n=()=>{const[r,b]=x.useState(!0);return e.jsxs(e.Fragment,{children:[e.jsx(g,{}),e.jsx(w,{options:{title:"",sections:[]},width:"250px"}),e.jsx(f,{padding:!1,scroll:!1,children:e.jsxs(o,{spacing:0,flex:!0,children:[e.jsxs(v,{button:e.jsx(L,{onClick:()=>b(!r),round:!0,icon:j.CHEVRON_LEFT}),open:r,width:300,closedWidth:"var(--size-sidebar)",children:[e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Sites",items:[{id:1,name:"Main Site",type:"Heading"},{id:2,name:"Site name here",active:!0,label:{value:1,color:"#69779b"}},{id:3,name:"Locations",type:"Heading"},{id:4,name:"Ipsum",label:{value:2,color:"#69779b"}},{id:5,name:"Dolor",label:{value:3,color:"#69779b"}}]}}),e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Wells",items:[{id:1,name:"Main Wellbore",type:"Heading"},{id:2,name:"Lorem",label:{value:1,color:"#77699b"}}]}}),e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Targets",items:[{id:1,name:"Lorem",label:{value:1,color:"#9b6977"}}]}})]}),e.jsxs(i,{borderLeft:!0,flexbox:!0,children:[e.jsx(s,{}),e.jsx(F,{padding:!0,margin:!1,options:C}),e.jsxs(o,{spacing:0,flex:!0,children:[e.jsxs(i,{scroll:!0,padding:!0,width:550,children:[e.jsx(t,{top:!0,children:"Site name here"}),e.jsx(l,{label:"Name",children:e.jsx(a,{value:"Site name here",width:"200px"})}),e.jsxs(u,{heading:e.jsx(t,{children:"Coordinate Reference System"}),managed:!0,children:[e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{children:e.jsx(m,{label:"Dolor"})})]}),e.jsx(s,{}),e.jsx(t,{marginBottom:"var(--padding)",children:"Location"}),e.jsxs(o,{children:[e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})})]}),e.jsx(s,{}),e.jsx(t,{marginBottom:"var(--padding)",children:"Model"}),e.jsxs(o,{children:[e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})})]}),e.jsxs(u,{heading:e.jsx(t,{children:"Settings"}),managed:!0,children:[e.jsx(l,{children:e.jsx(m,{label:"Dolor"})}),e.jsxs(o,{children:[e.jsxs(i,{children:[e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})]}),e.jsxs(i,{children:[e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})]})]})]})]}),e.jsx(i,{children:e.jsx(S,{})})]})]})]})})]})};var p,c,h;n.parameters={...n.parameters,docs:{...(p=n.parameters)==null?void 0:p.docs,source:{originalSource:`() => {
2
2
  const [open, setOpen] = useState(true);
3
3
  return <>
4
4
  <TopBar />
@@ -1 +1 @@
1
- import{S as c,c as l,s as n}from"./index-08c03c21.js";import"./iframe-b1d7d28b.js";import"../sb-preview/runtime.js";import"./index-f80c8c95.js";import"./index-3d476d02.js";import"./inheritsLoose-d4851ab8.js";import"./assertThisInitialized-081f9914.js";import"./index-cf68f115.js";export{c as SyntaxHighlighter,l as createCopyToClipboardFunction,n as default};
1
+ import{S as c,c as l,s as n}from"./index-e7458aee.js";import"./iframe-eb834e80.js";import"../sb-preview/runtime.js";import"./index-f80c8c95.js";import"./index-3d476d02.js";import"./inheritsLoose-d4851ab8.js";import"./assertThisInitialized-081f9914.js";import"./index-cf68f115.js";export{c as SyntaxHighlighter,l as createCopyToClipboardFunction,n as default};
@@ -1 +1 @@
1
- import{j as n}from"./jsx-runtime-f961835c.js";import{r as T}from"./index-f80c8c95.js";import{c as N}from"./index-a80ed1cf.js";import{I as He,D as Pe,C as Le,P as De}from"./index.es-85cc7dfc.js";import{l as Fe}from"./lodash-75c70a11.js";import{A as ye}from"./actions-2d4e1c8e.js";import{H as $e}from"./heading-d29eb744.js";import{P as Oe}from"./pagination-556e629a.js";import{A as b,I as $}from"./common-types-2c81813f.js";import{I as Be}from"./input-f82f3a98.js";import{N as Me}from"./number-input-1f8dcc90.js";import{S as Ge}from"./select-205cd538.js";import{D as Ue}from"./disabled-context-d654f6ff.js";import{i as O}from"./types-332ceaf3.js";import{T as fe}from"./tooltip-23e84186.js";import{C as Xe}from"./check-box-e21258d5.js";import{S as Je}from"./slider-160e2152.js";import{I as B}from"./icon-e9cbb4d7.js";import{P as Ke}from"./popover-06e375a5.js";import{H as Ee}from"./help-icon-d4189b1b.js";import{T as ee}from"./text-ad1f5f1d.js";const ze="_inputInTable_y9car_1",Ye="_inputHover_y9car_13",Qe="_inputFocus_y9car_18",Ze="_inputError_y9car_25",en="_inputWarning_y9car_26",nn="_inputDisabled_y9car_61",tn="_hideScrollbars_y9car_67",rn="_wrapper_y9car_85",an="_bordered_y9car_93",ln="_scroll_y9car_98",on="_table_y9car_108",sn="_striped_y9car_188",H={inputInTable:ze,inputHover:Ye,inputFocus:Qe,inputError:Ze,inputWarning:en,inputDisabled:nn,hideScrollbars:tn,wrapper:rn,bordered:an,scroll:ln,table:on,striped:sn},dn="_title_11pbp_1",cn={title:dn},U=({name:e=null,actions:t=null,actionsRight:a=!1,testId:l})=>{const r=e!==null,o=t!==null;if(!r&&!o)return null;const s=()=>{if(!o)return null;const u=n.jsx(ye,{actions:t});return a?u:n.jsx("div",{children:u})};return n.jsxs("div",{className:cn.title,children:[r?n.jsx($e,{children:n.jsx("span",{"data-testid":l,children:e})}):null,s()]})};try{U.displayName="Title",U.__docgenInfo={description:"",displayName:"Title",props:{name:{defaultValue:{value:"null"},description:"",name:"name",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},actions:{defaultValue:{value:"null"},description:"",name:"actions",required:!1,type:{name:"any"}},actionsRight:{defaultValue:{value:"false"},description:"",name:"actionsRight",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const un="_footer_4sumy_1",pn="_section_4sumy_7",ne={footer:un,section:pn},X=({colSpan:e,pagination:t,actions:a,content:l})=>{const r=a&&a.length,o=l!=null,s=()=>{var d,p;if(t){const{rowCount:c,rowsPerPage:y}=t,g=Number((p=(d=y==null?void 0:y.options)==null?void 0:d[0])==null?void 0:p.value);return c>g}return!1};return r||o||s()?n.jsxs("div",{className:ne.footer,children:[o?n.jsx("div",{className:ne.section,children:n.jsx("div",{children:l})}):null,r||s()?n.jsxs("div",{className:ne.section,children:[s()?n.jsx(Oe,{pagination:t}):n.jsx("div",{}),r&&n.jsx("div",{children:n.jsx(ye,{actions:a})})]}):null]}):null};try{X.displayName="Footer",X.__docgenInfo={description:"",displayName:"Footer",props:{colSpan:{defaultValue:null,description:"",name:"colSpan",required:!1,type:{name:"number"}},pagination:{defaultValue:null,description:"",name:"pagination",required:!0,type:{name:"IPagination"}},actions:{defaultValue:null,description:"",name:"actions",required:!1,type:{name:"IAction[]"}},content:{defaultValue:null,description:"",name:"content",required:!1,type:{name:"ReactNode"}}}}}catch{}const Se=e=>{const t=Math.max(...e.reduce((a,l)=>{const r=l.cells.map(o=>o.colSpan?o.colSpan:1).reduce((o,s)=>o+s,0);return a.concat(r)},[]));return isNaN(t)?0:t},mn=(e,t)=>{const a=[Se(t),Se(e)];return Math.max(...a)},Ve=e=>e.reduce((t,a)=>a.actions&&a.actions.length>0?1:t,0),_n=(e,t)=>Ve(t)>0||Ve(e)>0,J=({table:e,children:t})=>{const{rows:a,infiniteScroll:l}=e,r=Math.ceil(window.innerHeight/30),[o,s]=l?T.useState(r):[a.length,null],[u,d]=l?T.useState(o<a.length):[!1,null],p=()=>{if(o>=a.length&&d){d(!1);return}s&&s(o+r)};return n.jsx("div",{id:"scrollWrapper",className:H.scroll,children:l?n.jsx(He,{dataLength:Math.min(a.length,o+r),next:p,hasMore:u,scrollableTarget:"scrollWrapper",style:{overflow:"initial"},loader:null,children:t({visibleRows:o})}):t({visibleRows:o})})};try{J.displayName="TableScrollWrapper",J.__docgenInfo={description:"",displayName:"TableScrollWrapper",props:{table:{defaultValue:null,description:"",name:"table",required:!0,type:{name:"ITableProps"}}}}}catch{}const gn="_clickableRow_11d5t_1",yn="_hoverableRow_11d5t_4",fn="_rowActive_11d5t_4",hn="_expandableRow_11d5t_8",bn="_flush_11d5t_8",xn="_dragIconCell_11d5t_28",Cn="_dragIcon_11d5t_28",R={clickableRow:gn,hoverableRow:yn,rowActive:fn,expandableRow:hn,flush:bn,dragIconCell:xn,dragIcon:Cn},K=({colSpan:e,children:t,flush:a})=>n.jsx("tr",{children:n.jsx("td",{colSpan:e,className:N(R.expandableRow,a?R.flush:""),children:t})});try{K.displayName="ExpandedContentRow",K.__docgenInfo={description:"",displayName:"ExpandedContentRow",props:{colSpan:{defaultValue:null,description:"",name:"colSpan",required:!0,type:{name:"number"}},flush:{defaultValue:null,description:"",name:"flush",required:!1,type:{name:"boolean"}}}}}catch{}const Te=(e,t={leftAligned:"",rightAligned:"",centerAligned:""},a=!1)=>{if(!e)return null;const{bodyAlignment:l,headerAlignment:r,isHeader:o}=e;switch(o&&r?r:l){case b.LEFT:return a?b.LEFT:t.leftAligned;case b.RIGHT:return a?b.RIGHT:t.rightAligned;case b.CENTER:return a?b.CENTER:t.centerAligned;default:return a?b.LEFT:t.leftAligned}},In=(e,t=!1,a=0)=>{if(!e||e.length===0)return[];const l=e.every(o=>Array.isArray(o)),r=e.every(o=>typeof o=="string");return l&&t?e[a]||[]:r?e:(console.warn("getHeaderAlignment: alignments array contains a mix of strings and arrays, returning an empty array."),[])},jn="_inputInTable_u3xdj_1",Nn="_inputHover_u3xdj_13",wn="_inputFocus_u3xdj_18",An="_inputError_u3xdj_25",vn="_inputWarning_u3xdj_26",Rn="_inputDisabled_u3xdj_61",Sn="_hideScrollbars_u3xdj_67",Vn="_cell_u3xdj_77",Tn="_disabledLink_u3xdj_87",qn="_inputWrapper_u3xdj_91",En="_breakWord_u3xdj_106",kn="_inputCell_u3xdj_109",Wn="_sliderCell_u3xdj_112",Hn="_staticCell_u3xdj_116",Pn="_staticCellContent_u3xdj_119",Ln="_error_u3xdj_131",Dn="_warning_u3xdj_132",Fn="_unit_u3xdj_141",$n="_sortingCell_u3xdj_144",On="_sortingCellIcon_u3xdj_155",Bn="_icon_u3xdj_166",Mn="_checkBoxCell_u3xdj_170",Gn="_iconCellWrapper_u3xdj_174",Un="_actionsCell_u3xdj_178",Xn="_rightAligned_u3xdj_186",Jn="_centerAligned_u3xdj_192",Kn="_leftAligned_u3xdj_198",zn="_popover_u3xdj_201",Yn="_disabledPointerEvents_u3xdj_204",i={inputInTable:jn,inputHover:Nn,inputFocus:wn,inputError:An,inputWarning:vn,inputDisabled:Rn,hideScrollbars:Sn,cell:Vn,disabledLink:Tn,inputWrapper:qn,breakWord:En,inputCell:kn,sliderCell:Wn,staticCell:Hn,staticCellContent:Pn,error:Ln,warning:Dn,unit:Fn,sortingCell:$n,sortingCellIcon:On,icon:Bn,checkBoxCell:Mn,iconCellWrapper:Gn,actionsCell:Un,rightAligned:Xn,centerAligned:Jn,leftAligned:Kn,popover:zn,disabledPointerEvents:Yn},te=({cell:e,columnAlignment:t,testId:a})=>n.jsx(Be,{name:e.name,value:e.value,onChange:l=>{var r;return(r=e.onChange)==null?void 0:r.call(e,l)},onPaste:l=>{var r;return(r=e.onPaste)==null?void 0:r.call(e,l)},placeholder:e.placeholder,error:e.error,warning:e.warning,disabled:e.disabled,isInTable:!0,maxTooltipWidth:e.maxTooltipWidth,right:t===b.RIGHT,testId:a,tabIndex:e.disabled?-1:0,tooltip:e.tooltip});try{te.displayName="InputCell",te.__docgenInfo={description:"",displayName:"InputCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IInputCell"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!1,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const re=({cell:e,testId:t})=>n.jsx(Me,{name:e.name,value:e.value,onChange:a=>{var l;return(l=e.onChange)==null?void 0:l.call(e,a)},placeholder:e.placeholder,error:e.error,warning:e.warning,disabled:e.disabled,isInTable:!0,left:e.left,tabIndex:e.disabled?-1:0,testId:t,tooltip:e.tooltip,validationCallback:e.validationCallback,allowEmpty:e.allowEmpty});try{re.displayName="NumberInputCell",re.__docgenInfo={description:"",displayName:"NumberInputCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"INumberInputCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const ae=({cell:e,columnAlignment:t,testId:a})=>n.jsx(Ge,{name:e.name,borderRadius:0,options:e.options,onChange:l=>{var r;return(r=e.onChange)==null?void 0:r.call(e,l)},onCreate:e.onCreate?l=>e.onCreate&&e.onCreate(l):void 0,error:e.error,warning:e.warning,disabled:e.disabled,placeholder:e.placeholder,isInTable:!0,value:e.value,native:e.native,clearable:e.clearable,searchable:e.searchable,deprecatedEventHandler:e.deprecatedEventHandler,maxTooltipWidth:e.maxTooltipWidth,width:"100%",autoLayerWidth:e.autoLayerWidth,right:t===b.RIGHT,testId:a,tabIndex:e.disabled?-1:0});try{ae.displayName="SelectCell",ae.__docgenInfo={description:"",displayName:"SelectCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ISelectCell"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!1,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const le=({cell:e,columnAlignment:t,testId:a})=>n.jsx("div",{className:i.inputWrapper,children:e.type==="Input"?n.jsx(te,{cell:e,columnAlignment:t,testId:a}):e.type==="NumberInput"?n.jsx(re,{cell:e,testId:a}):e.type==="Select"?n.jsx(ae,{cell:e,columnAlignment:t,testId:a}):null});try{le.displayName="InputCellWrapper",le.__docgenInfo={description:"",displayName:"InputCellWrapper",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"any"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!0,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const oe=({cell:e,testId:t})=>{const a=T.useContext(Ue),{error:l,warning:r,tooltip:o,maxTooltipWidth:s}=e,u=d=>O(d);return n.jsx("div",{className:i.inputWrapper,children:n.jsx(fe,{error:!!l,warning:!!r,text:o||l||r,enabled:u(o)||u(l)||u(r)||!1,maxWidth:s,placement:"bottom-center",children:n.jsx("div",{className:N(i.staticCellContent,l?i.error:r?i.warning:""),children:n.jsx("a",{className:N((e.disabled||a)&&i.disabledLink),onClick:e.disabled||a?void 0:d=>{var p;d.stopPropagation(),(p=e.onClick)==null||p.call(e,d)},"data-testid":t,children:e.value})})})})};try{oe.displayName="LinkCell",oe.__docgenInfo={description:"",displayName:"LinkCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ILinkCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const ie=({cell:e,testId:t})=>n.jsx(Xe,{label:e.label,checked:e.checked,isInTable:!0,disabled:e.disabled,onChange:a=>e.onChange(a),testId:t,tabIndex:e.disabled?-1:0});try{ie.displayName="CheckBoxCell",ie.__docgenInfo={description:"",displayName:"CheckBoxCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ICheckBoxCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const se=({cell:e})=>n.jsx("div",{className:i.inputWrapper,children:n.jsx(Je,{label:e.label,value:e.value,min:e.min,max:e.max,step:e.step,marks:e.marks,onChange:t=>e.onChange(t),showArrows:e.showArrows,showTooltip:e.showTooltip,tooltipFormatter:e.tooltipFormatter,disabled:e.disabled})});try{se.displayName="SliderCell",se.__docgenInfo={description:"",displayName:"SliderCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ISliderCell"}}}}}catch{}const de=({cell:e})=>{const{tooltip:t,icon:a}=e;return n.jsx("div",{className:i.iconCellWrapper,children:n.jsx(fe,{text:t,enabled:!!t&&O(t),display:"flex",placement:"top-center",children:n.jsx(B,{icon:a})})})};try{de.displayName="IconCell",de.__docgenInfo={description:"",displayName:"IconCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IIconCell"}}}}}catch{}const ce=({cell:e})=>n.jsx(ye,{actions:e.actions});try{ce.displayName="ActionsCell",ce.__docgenInfo={description:"",displayName:"ActionsCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IActionCell"}}}}}catch{}const ue=({cell:e})=>{const{helpIcon:t}=e;return t?n.jsx("div",{className:i.icon,children:n.jsx(Ee,{onClick:t.onClick,text:t.tooltip})}):null};try{ue.displayName="CellHelpIcon",ue.__docgenInfo={description:"",displayName:"CellHelpIcon",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IHelpIconCell"}}}}}catch{}const pe=({cell:e})=>{const{libraryIcon:t}=e;return t?n.jsx("div",{className:i.icon,children:n.jsx(Ee,{onClick:t.onClick,text:t.tooltip,icon:$.LIBRARY})}):null};try{pe.displayName="CellLibraryIcon",pe.__docgenInfo={description:"",displayName:"CellLibraryIcon",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ILibraryIconCell"}}}}}catch{}const me=({cell:e})=>{const{hasSort:t,sort:a,sortPriority:l}=e;return t?n.jsxs("span",{className:i.sortingCellIcon,children:[a==="down"?n.jsx(ee,{link:!0,children:n.jsx(B,{icon:$.SORT_ASCENDING})}):a==="up"?n.jsx(ee,{link:!0,children:n.jsx(B,{icon:$.SORT_DESCENDING})}):n.jsx(ee,{faint:!0,children:n.jsx(B,{icon:$.SORT_DESCENDING})}),l&&a?n.jsx("sup",{children:l}):null]}):null};try{me.displayName="Sort",me.__docgenInfo={description:"",displayName:"Sort",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ISortCell"}}}}}catch{}const z=({cell:e,isHeader:t,testId:a})=>{const{error:l,warning:r,tooltip:o,maxTooltipWidth:s,hasSort:u,onSort:d,type:p}=e,c=n.jsxs("div",{className:N(i.staticCellContent,p==="Unit"?i.unit:"",l?i.error:r?i.warning:""),onClick:u?y=>d&&d(y):()=>{},"data-testid":a,children:[e.value,t?n.jsxs(n.Fragment,{children:[n.jsx(ue,{cell:e}),n.jsx(pe,{cell:e}),n.jsx(me,{cell:e})]}):null]});return n.jsx("div",{className:i.inputWrapper,children:n.jsx(fe,{error:!!l,warning:!!r,text:o||l||r,enabled:o&&O(o)||l&&O(l)||r&&O(r)||!1,maxWidth:s,display:"block",placement:"bottom-center",children:c})})};try{z.displayName="StaticCell",z.__docgenInfo={description:"",displayName:"StaticCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IStaticCell"}},isHeader:{defaultValue:null,description:"",name:"isHeader",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const _e=({cell:e,testId:t})=>{const{content:a,fullWidth:l,closeOnOutsideClick:r,disabled:o}=e;return n.jsx(Ke,{content:a,fullWidth:l,closeOnOutsideClick:r,disabled:o,children:n.jsx("div",{className:i.popover,children:n.jsx(z,{cell:e,testId:t})})})};try{_e.displayName="PopoverCell",_e.__docgenInfo={description:"",displayName:"PopoverCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IPopoverCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const ge=({cell:e,isHeader:t,columnAlignment:a,testId:l})=>{if(!e)return null;switch(e.type){case"Input":case"NumberInput":case"Select":return n.jsx(le,{cell:e,columnAlignment:a,testId:l});case"Link":return n.jsx(oe,{cell:e,testId:l});case"CheckBox":return n.jsx(ie,{cell:e,testId:l});case"Slider":return n.jsx(se,{cell:e});case"Icon":return n.jsx(de,{cell:e});case"Actions":return n.jsx(ce,{cell:e});case"Popover":return n.jsx(_e,{cell:e});default:return n.jsx(z,{cell:e,isHeader:t,testId:l})}};try{ge.displayName="CellWrapper",ge.__docgenInfo={description:"",displayName:"CellWrapper",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"any"}},isHeader:{defaultValue:null,description:"",name:"isHeader",required:!0,type:{name:"boolean"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!0,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}var S=(e=>(e.INPUT="Input",e.NUMBER_INPUT="NumberInput",e.SELECT="Select",e.POPOVER="Popover",e.SLIDER="Slider",e.CHECKBOX="CheckBox",e.ACTIONS="Actions",e))(S||{});const Y=({cell:e,isHeader:t,columnHeaderAlignment:a,columnAlignment:l=b.LEFT,width:r,snapshot:o,testId:s})=>{if(!e)return null;const{style:u,colSpan:d,rowSpan:p,width:c}=e,y=T.useRef(null),g={bodyAlignment:l,headerAlignment:a,isHeader:t},P=Te(g,i),x=Te(g,i,!0),L=e.type===S.INPUT||e.type===S.NUMBER_INPUT||e.type===S.SELECT||e.type===S.POPOVER?i.inputCell:e.type===S.SLIDER?i.sliderCell:e.type===S.CHECKBOX?i.checkBoxCell:e.type===S.ACTIONS?i.actionsCell:i.staticCell,w=N(i.cell,L,e.hasSort?i.sortingCell:null,P,e.breakWord?i.breakWord:""),q=c??r??((o==null?void 0:o.isDragging)&&y.current&&y.current.offsetWidth)??void 0,C={width:q,minWidth:q,...u},A=t?"th":"td";return n.jsx(A,{ref:y,className:w,style:C,colSpan:d,rowSpan:p,children:n.jsx(ge,{cell:e,columnAlignment:x??b.RIGHT,isHeader:t,testId:s})})};try{Y.displayName="Cell",Y.__docgenInfo={description:"",displayName:"Cell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!1,type:{name:"TCellShape"}},isHeader:{defaultValue:null,description:"",name:"isHeader",required:!0,type:{name:"boolean"}},columnHeaderAlignment:{defaultValue:null,description:"",name:"columnHeaderAlignment",required:!1,type:{name:"string"}},columnAlignment:{defaultValue:{value:"Align.LEFT"},description:"",name:"columnAlignment",required:!1,type:{name:"Align.LEFT | Align.RIGHT | null"}},width:{defaultValue:null,description:"",name:"width",required:!1,type:{name:"TStringOrNumber"}},snapshot:{defaultValue:null,description:"",name:"snapshot",required:!1,type:{name:"any"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const F=({row:e,rowIndex:t,isHeader:a=!1,columnCount:l,colSpan:r,columnHeaderAlignments:o=[],columnAlignment:s=[],hasRowActions:u,draggableTable:d=!1,snapshot:p=null,provided:c=null,width:y,columnWidths:g,testId:P})=>{const x=T.useRef(null),L=In(o,a,t),{onRowClick:w,onRowFocus:q,onRowMouseEnter:C,onRowMouseLeave:A,expandedContent:I,active:Q}=e,E=e.cells.map((h,v)=>{const he=`${a?0:1}_${t}_${v}`;return n.jsx(Y,{cell:h,isHeader:a,columnAlignment:s[v],columnHeaderAlignment:L[v],width:g?g[v]:void 0,snapshot:p,testId:h.testId},he)}),V=u&&n.jsx(Y,{cell:{type:S.ACTIONS,actions:e.actions},isHeader:a},l),k=(h,v)=>({minWidth:h&&`${y}px`,width:h&&"100%",display:h&&"table",background:h&&"var(--color-background-listitem-active)",border:h&&"var(--color-border)",borderTop:h&&0,opacity:h&&.1,...v}),W=()=>e.noDrag?n.jsx("td",{"aria-labelledby":"unique-label-id"}):n.jsx("td",{className:R.dragIconCell,children:n.jsx("div",{...c.dragHandleProps,className:R.dragIcon,children:n.jsx(B,{icon:$.DRAG})})});return a?n.jsxs(n.Fragment,{children:[n.jsxs("tr",{ref:x,onClick:w,onMouseEnter:C,onMouseLeave:A,onFocus:q,className:N(w?R.clickableRow:null,C?R.hoverableRow:null),children:[d?n.jsx("th",{}):null,E,V]},t),I&&I.content?n.jsx(K,{colSpan:r,flush:I.flush===!0,children:I.content},`${t}_expanded_content`):null]}):n.jsxs(n.Fragment,{children:[n.jsxs("tr",{onClick:w,onMouseEnter:C,onMouseLeave:A,onFocus:q,className:N(w&&!w.noStyle?R.clickableRow:null,C&&!C.noStyle?R.hoverableRow:null,Q?R.rowActive:null),ref:(c==null?void 0:c.innerRef)||null,...(c==null?void 0:c.draggableProps)||null,style:p&&c?k(p.isDragging,c.draggableProps.style):null,children:[d?W():null,E,V]},t),I&&I.content?n.jsx(K,{colSpan:r,flush:I.flush===!0,children:I.content},`${t}_expanded_content`):null]})};try{F.displayName="Row",F.__docgenInfo={description:"",displayName:"Row",props:{row:{defaultValue:null,description:"",name:"row",required:!0,type:{name:"TRowType"}},rowIndex:{defaultValue:null,description:"",name:"rowIndex",required:!0,type:{name:"number"}},isHeader:{defaultValue:{value:"false"},description:"",name:"isHeader",required:!1,type:{name:"boolean"}},columnCount:{defaultValue:null,description:"",name:"columnCount",required:!0,type:{name:"number"}},colSpan:{defaultValue:null,description:"",name:"colSpan",required:!0,type:{name:"number"}},columnHeaderAlignments:{defaultValue:{value:"[]"},description:"",name:"columnHeaderAlignments",required:!1,type:{name:"string[] | string[][]"}},columnAlignment:{defaultValue:{value:"[]"},description:"",name:"columnAlignment",required:!1,type:{name:"string[]"}},hasRowActions:{defaultValue:null,description:"",name:"hasRowActions",required:!0,type:{name:"boolean"}},draggableTable:{defaultValue:{value:"false"},description:"",name:"draggableTable",required:!1,type:{name:"boolean"}},snapshot:{defaultValue:{value:"null"},description:"",name:"snapshot",required:!1,type:{name:"any"}},provided:{defaultValue:{value:"null"},description:"",name:"provided",required:!1,type:{name:"any"}},width:{defaultValue:null,description:"",name:"width",required:!1,type:{name:"TStringOrNumber"}},columnWidths:{defaultValue:null,description:"",name:"columnWidths",required:!1,type:{name:"string[]"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const qe=e=>{var Ie,je,Ne,we,Ae,ve,Re;const{onListReorder:t=()=>{},table:a}=e,{columnWidths:l,footer:r,name:o,rows:s=[],actions:u,actionsRight:d,columnHeaderAlignments:p,columnAlignment:c,striped:y=!0,testId:g,draggable:P,defaultEmptyRow:x=null,onAddRow:L=null,bordered:w=!0,maxHeight:q,fixedWidth:C}=a,A=T.useRef(null),[I,Q]=T.useState({width:0,height:0});T.useEffect(()=>{A.current&&Q({width:A.current.offsetWidth,height:A.current.offsetHeight})},[]);const E=Fe.get(e,"table.headers",[]),V=mn(s,E),k=_n(s,E),W=V+(k?1:0),h=r?((je=(Ie=r==null?void 0:r.pagination)==null?void 0:Ie.rowsPerPage)==null?void 0:je.value)===0||Number((Ne=r==null?void 0:r.pagination)==null?void 0:Ne.selectedPage)>=Number((we=r==null?void 0:r.pagination)==null?void 0:we.rowCount)/Number((ve=(Ae=r==null?void 0:r.pagination)==null?void 0:Ae.rowsPerPage)==null?void 0:ve.value):!0,v=((Re=x==null?void 0:x.cells)==null?void 0:Re.length)&&L&&h,ke={cells:v?x.cells.map((m,j)=>(m==null?void 0:m.type)==="Input"?{...m,onChange:_=>{var M;const f=(M=_==null?void 0:_.target)==null?void 0:M.value,D={...x,cells:x.cells.map((G,We)=>({...G,value:We===j?f:G==null?void 0:G.value}))};L({newRow:D})}}:{...m,disabled:!0}):null,testId:g?`${g}-last-empty-row`:void 0},Z=v?s.concat(ke):s,be={...a,rows:Z},xe=N(H.wrapper,w?H.bordered:""),Ce={maxHeight:q,width:C,display:C==="auto"?"inline-flex":"flex"};return P?n.jsxs("div",{ref:A,className:xe,style:Ce,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(Pe,{onDragEnd:m=>{var f,D;const j=(f=m==null?void 0:m.source)==null?void 0:f.index,_=(D=m==null?void 0:m.destination)==null?void 0:D.index;typeof j=="number"&&typeof _=="number"&&t({from:j,to:_})},children:n.jsx(Le,{droppableId:"droppable",children:m=>n.jsx(J,{table:be,children:({visibleRows:j})=>n.jsxs("table",{className:N(H.table,y?H.striped:""),"data-testid":g,ref:m.innerRef,children:[n.jsx("thead",{children:E.map((_,f)=>n.jsx(F,{rowIndex:f,isHeader:!0,row:_,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p,draggableTable:P},`0_${f}`))}),n.jsxs("tbody",{children:[Z.slice(0,j).map((_,f)=>n.jsx(De,{draggableId:f+"",index:f,isDragDisabled:_.noDrag,children:(D,M)=>n.jsx(F,{rowIndex:f,row:_,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,provided:D,snapshot:M,draggableTable:P,width:I.width},`1_${f}`)},`index_${f}`)),m.placeholder]})]})})})}),r&&n.jsx(X,{pagination:r.pagination,actions:r.actions,content:r.content})]}):n.jsxs("div",{className:xe,style:Ce,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(J,{table:be,children:({visibleRows:m})=>n.jsxs("table",{className:N(H.table,y?H.striped:""),"data-testid":g,children:[n.jsx("thead",{children:E.map((j,_)=>n.jsx(F,{rowIndex:_,isHeader:!0,row:j,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p},`0_${_}`))}),n.jsx("tbody",{children:Z.slice(0,m).map((j,_)=>n.jsx(F,{rowIndex:_,row:j,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c},`1_${_}`))})]})}),r&&n.jsx(X,{colSpan:W,pagination:r.pagination,actions:r.actions,content:r.content})]})};try{qe.displayName="Table",qe.__docgenInfo={description:"",displayName:"Table",props:{onListReorder:{defaultValue:null,description:"",name:"onListReorder",required:!1,type:{name:"((obj: { from: number; to: number; }) => void)"}},table:{defaultValue:null,description:"",name:"table",required:!0,type:{name:"{ name?: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined; ... 18 more ...; actions?: any; }"}}}}}catch{}export{qe as T};
1
+ import{j as n}from"./jsx-runtime-f961835c.js";import{r as T}from"./index-f80c8c95.js";import{c as N}from"./index-a80ed1cf.js";import{I as He,D as Pe,C as Le,P as De}from"./index.es-85cc7dfc.js";import{l as Fe}from"./lodash-75c70a11.js";import{A as ye}from"./actions-2d4e1c8e.js";import{H as $e}from"./heading-d29eb744.js";import{P as Oe}from"./pagination-8aade846.js";import{A as b,I as $}from"./common-types-2c81813f.js";import{I as Be}from"./input-d68625a5.js";import{N as Me}from"./number-input-7d49b0b3.js";import{S as Ge}from"./select-205cd538.js";import{D as Ue}from"./disabled-context-d654f6ff.js";import{i as O}from"./types-332ceaf3.js";import{T as fe}from"./tooltip-23e84186.js";import{C as Xe}from"./check-box-e21258d5.js";import{S as Je}from"./slider-160e2152.js";import{I as B}from"./icon-e9cbb4d7.js";import{P as Ke}from"./popover-06e375a5.js";import{H as Ee}from"./help-icon-d4189b1b.js";import{T as ee}from"./text-ad1f5f1d.js";const ze="_inputInTable_y9car_1",Ye="_inputHover_y9car_13",Qe="_inputFocus_y9car_18",Ze="_inputError_y9car_25",en="_inputWarning_y9car_26",nn="_inputDisabled_y9car_61",tn="_hideScrollbars_y9car_67",rn="_wrapper_y9car_85",an="_bordered_y9car_93",ln="_scroll_y9car_98",on="_table_y9car_108",sn="_striped_y9car_188",H={inputInTable:ze,inputHover:Ye,inputFocus:Qe,inputError:Ze,inputWarning:en,inputDisabled:nn,hideScrollbars:tn,wrapper:rn,bordered:an,scroll:ln,table:on,striped:sn},dn="_title_11pbp_1",cn={title:dn},U=({name:e=null,actions:t=null,actionsRight:a=!1,testId:l})=>{const r=e!==null,o=t!==null;if(!r&&!o)return null;const s=()=>{if(!o)return null;const u=n.jsx(ye,{actions:t});return a?u:n.jsx("div",{children:u})};return n.jsxs("div",{className:cn.title,children:[r?n.jsx($e,{children:n.jsx("span",{"data-testid":l,children:e})}):null,s()]})};try{U.displayName="Title",U.__docgenInfo={description:"",displayName:"Title",props:{name:{defaultValue:{value:"null"},description:"",name:"name",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},actions:{defaultValue:{value:"null"},description:"",name:"actions",required:!1,type:{name:"any"}},actionsRight:{defaultValue:{value:"false"},description:"",name:"actionsRight",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const un="_footer_4sumy_1",pn="_section_4sumy_7",ne={footer:un,section:pn},X=({colSpan:e,pagination:t,actions:a,content:l})=>{const r=a&&a.length,o=l!=null,s=()=>{var d,p;if(t){const{rowCount:c,rowsPerPage:y}=t,g=Number((p=(d=y==null?void 0:y.options)==null?void 0:d[0])==null?void 0:p.value);return c>g}return!1};return r||o||s()?n.jsxs("div",{className:ne.footer,children:[o?n.jsx("div",{className:ne.section,children:n.jsx("div",{children:l})}):null,r||s()?n.jsxs("div",{className:ne.section,children:[s()?n.jsx(Oe,{pagination:t}):n.jsx("div",{}),r&&n.jsx("div",{children:n.jsx(ye,{actions:a})})]}):null]}):null};try{X.displayName="Footer",X.__docgenInfo={description:"",displayName:"Footer",props:{colSpan:{defaultValue:null,description:"",name:"colSpan",required:!1,type:{name:"number"}},pagination:{defaultValue:null,description:"",name:"pagination",required:!0,type:{name:"IPagination"}},actions:{defaultValue:null,description:"",name:"actions",required:!1,type:{name:"IAction[]"}},content:{defaultValue:null,description:"",name:"content",required:!1,type:{name:"ReactNode"}}}}}catch{}const Se=e=>{const t=Math.max(...e.reduce((a,l)=>{const r=l.cells.map(o=>o.colSpan?o.colSpan:1).reduce((o,s)=>o+s,0);return a.concat(r)},[]));return isNaN(t)?0:t},mn=(e,t)=>{const a=[Se(t),Se(e)];return Math.max(...a)},Ve=e=>e.reduce((t,a)=>a.actions&&a.actions.length>0?1:t,0),_n=(e,t)=>Ve(t)>0||Ve(e)>0,J=({table:e,children:t})=>{const{rows:a,infiniteScroll:l}=e,r=Math.ceil(window.innerHeight/30),[o,s]=l?T.useState(r):[a.length,null],[u,d]=l?T.useState(o<a.length):[!1,null],p=()=>{if(o>=a.length&&d){d(!1);return}s&&s(o+r)};return n.jsx("div",{id:"scrollWrapper",className:H.scroll,children:l?n.jsx(He,{dataLength:Math.min(a.length,o+r),next:p,hasMore:u,scrollableTarget:"scrollWrapper",style:{overflow:"initial"},loader:null,children:t({visibleRows:o})}):t({visibleRows:o})})};try{J.displayName="TableScrollWrapper",J.__docgenInfo={description:"",displayName:"TableScrollWrapper",props:{table:{defaultValue:null,description:"",name:"table",required:!0,type:{name:"ITableProps"}}}}}catch{}const gn="_clickableRow_11d5t_1",yn="_hoverableRow_11d5t_4",fn="_rowActive_11d5t_4",hn="_expandableRow_11d5t_8",bn="_flush_11d5t_8",xn="_dragIconCell_11d5t_28",Cn="_dragIcon_11d5t_28",R={clickableRow:gn,hoverableRow:yn,rowActive:fn,expandableRow:hn,flush:bn,dragIconCell:xn,dragIcon:Cn},K=({colSpan:e,children:t,flush:a})=>n.jsx("tr",{children:n.jsx("td",{colSpan:e,className:N(R.expandableRow,a?R.flush:""),children:t})});try{K.displayName="ExpandedContentRow",K.__docgenInfo={description:"",displayName:"ExpandedContentRow",props:{colSpan:{defaultValue:null,description:"",name:"colSpan",required:!0,type:{name:"number"}},flush:{defaultValue:null,description:"",name:"flush",required:!1,type:{name:"boolean"}}}}}catch{}const Te=(e,t={leftAligned:"",rightAligned:"",centerAligned:""},a=!1)=>{if(!e)return null;const{bodyAlignment:l,headerAlignment:r,isHeader:o}=e;switch(o&&r?r:l){case b.LEFT:return a?b.LEFT:t.leftAligned;case b.RIGHT:return a?b.RIGHT:t.rightAligned;case b.CENTER:return a?b.CENTER:t.centerAligned;default:return a?b.LEFT:t.leftAligned}},In=(e,t=!1,a=0)=>{if(!e||e.length===0)return[];const l=e.every(o=>Array.isArray(o)),r=e.every(o=>typeof o=="string");return l&&t?e[a]||[]:r?e:(console.warn("getHeaderAlignment: alignments array contains a mix of strings and arrays, returning an empty array."),[])},jn="_inputInTable_u3xdj_1",Nn="_inputHover_u3xdj_13",wn="_inputFocus_u3xdj_18",An="_inputError_u3xdj_25",vn="_inputWarning_u3xdj_26",Rn="_inputDisabled_u3xdj_61",Sn="_hideScrollbars_u3xdj_67",Vn="_cell_u3xdj_77",Tn="_disabledLink_u3xdj_87",qn="_inputWrapper_u3xdj_91",En="_breakWord_u3xdj_106",kn="_inputCell_u3xdj_109",Wn="_sliderCell_u3xdj_112",Hn="_staticCell_u3xdj_116",Pn="_staticCellContent_u3xdj_119",Ln="_error_u3xdj_131",Dn="_warning_u3xdj_132",Fn="_unit_u3xdj_141",$n="_sortingCell_u3xdj_144",On="_sortingCellIcon_u3xdj_155",Bn="_icon_u3xdj_166",Mn="_checkBoxCell_u3xdj_170",Gn="_iconCellWrapper_u3xdj_174",Un="_actionsCell_u3xdj_178",Xn="_rightAligned_u3xdj_186",Jn="_centerAligned_u3xdj_192",Kn="_leftAligned_u3xdj_198",zn="_popover_u3xdj_201",Yn="_disabledPointerEvents_u3xdj_204",i={inputInTable:jn,inputHover:Nn,inputFocus:wn,inputError:An,inputWarning:vn,inputDisabled:Rn,hideScrollbars:Sn,cell:Vn,disabledLink:Tn,inputWrapper:qn,breakWord:En,inputCell:kn,sliderCell:Wn,staticCell:Hn,staticCellContent:Pn,error:Ln,warning:Dn,unit:Fn,sortingCell:$n,sortingCellIcon:On,icon:Bn,checkBoxCell:Mn,iconCellWrapper:Gn,actionsCell:Un,rightAligned:Xn,centerAligned:Jn,leftAligned:Kn,popover:zn,disabledPointerEvents:Yn},te=({cell:e,columnAlignment:t,testId:a})=>n.jsx(Be,{name:e.name,value:e.value,onChange:l=>{var r;return(r=e.onChange)==null?void 0:r.call(e,l)},onPaste:l=>{var r;return(r=e.onPaste)==null?void 0:r.call(e,l)},placeholder:e.placeholder,error:e.error,warning:e.warning,disabled:e.disabled,isInTable:!0,maxTooltipWidth:e.maxTooltipWidth,right:t===b.RIGHT,testId:a,tabIndex:e.disabled?-1:0,tooltip:e.tooltip});try{te.displayName="InputCell",te.__docgenInfo={description:"",displayName:"InputCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IInputCell"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!1,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const re=({cell:e,testId:t})=>n.jsx(Me,{name:e.name,value:e.value,onChange:a=>{var l;return(l=e.onChange)==null?void 0:l.call(e,a)},placeholder:e.placeholder,error:e.error,warning:e.warning,disabled:e.disabled,isInTable:!0,left:e.left,tabIndex:e.disabled?-1:0,testId:t,tooltip:e.tooltip,validationCallback:e.validationCallback,allowEmpty:e.allowEmpty});try{re.displayName="NumberInputCell",re.__docgenInfo={description:"",displayName:"NumberInputCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"INumberInputCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const ae=({cell:e,columnAlignment:t,testId:a})=>n.jsx(Ge,{name:e.name,borderRadius:0,options:e.options,onChange:l=>{var r;return(r=e.onChange)==null?void 0:r.call(e,l)},onCreate:e.onCreate?l=>e.onCreate&&e.onCreate(l):void 0,error:e.error,warning:e.warning,disabled:e.disabled,placeholder:e.placeholder,isInTable:!0,value:e.value,native:e.native,clearable:e.clearable,searchable:e.searchable,deprecatedEventHandler:e.deprecatedEventHandler,maxTooltipWidth:e.maxTooltipWidth,width:"100%",autoLayerWidth:e.autoLayerWidth,right:t===b.RIGHT,testId:a,tabIndex:e.disabled?-1:0});try{ae.displayName="SelectCell",ae.__docgenInfo={description:"",displayName:"SelectCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ISelectCell"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!1,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const le=({cell:e,columnAlignment:t,testId:a})=>n.jsx("div",{className:i.inputWrapper,children:e.type==="Input"?n.jsx(te,{cell:e,columnAlignment:t,testId:a}):e.type==="NumberInput"?n.jsx(re,{cell:e,testId:a}):e.type==="Select"?n.jsx(ae,{cell:e,columnAlignment:t,testId:a}):null});try{le.displayName="InputCellWrapper",le.__docgenInfo={description:"",displayName:"InputCellWrapper",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"any"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!0,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const oe=({cell:e,testId:t})=>{const a=T.useContext(Ue),{error:l,warning:r,tooltip:o,maxTooltipWidth:s}=e,u=d=>O(d);return n.jsx("div",{className:i.inputWrapper,children:n.jsx(fe,{error:!!l,warning:!!r,text:o||l||r,enabled:u(o)||u(l)||u(r)||!1,maxWidth:s,placement:"bottom-center",children:n.jsx("div",{className:N(i.staticCellContent,l?i.error:r?i.warning:""),children:n.jsx("a",{className:N((e.disabled||a)&&i.disabledLink),onClick:e.disabled||a?void 0:d=>{var p;d.stopPropagation(),(p=e.onClick)==null||p.call(e,d)},"data-testid":t,children:e.value})})})})};try{oe.displayName="LinkCell",oe.__docgenInfo={description:"",displayName:"LinkCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ILinkCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const ie=({cell:e,testId:t})=>n.jsx(Xe,{label:e.label,checked:e.checked,isInTable:!0,disabled:e.disabled,onChange:a=>e.onChange(a),testId:t,tabIndex:e.disabled?-1:0});try{ie.displayName="CheckBoxCell",ie.__docgenInfo={description:"",displayName:"CheckBoxCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ICheckBoxCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const se=({cell:e})=>n.jsx("div",{className:i.inputWrapper,children:n.jsx(Je,{label:e.label,value:e.value,min:e.min,max:e.max,step:e.step,marks:e.marks,onChange:t=>e.onChange(t),showArrows:e.showArrows,showTooltip:e.showTooltip,tooltipFormatter:e.tooltipFormatter,disabled:e.disabled})});try{se.displayName="SliderCell",se.__docgenInfo={description:"",displayName:"SliderCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ISliderCell"}}}}}catch{}const de=({cell:e})=>{const{tooltip:t,icon:a}=e;return n.jsx("div",{className:i.iconCellWrapper,children:n.jsx(fe,{text:t,enabled:!!t&&O(t),display:"flex",placement:"top-center",children:n.jsx(B,{icon:a})})})};try{de.displayName="IconCell",de.__docgenInfo={description:"",displayName:"IconCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IIconCell"}}}}}catch{}const ce=({cell:e})=>n.jsx(ye,{actions:e.actions});try{ce.displayName="ActionsCell",ce.__docgenInfo={description:"",displayName:"ActionsCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IActionCell"}}}}}catch{}const ue=({cell:e})=>{const{helpIcon:t}=e;return t?n.jsx("div",{className:i.icon,children:n.jsx(Ee,{onClick:t.onClick,text:t.tooltip})}):null};try{ue.displayName="CellHelpIcon",ue.__docgenInfo={description:"",displayName:"CellHelpIcon",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IHelpIconCell"}}}}}catch{}const pe=({cell:e})=>{const{libraryIcon:t}=e;return t?n.jsx("div",{className:i.icon,children:n.jsx(Ee,{onClick:t.onClick,text:t.tooltip,icon:$.LIBRARY})}):null};try{pe.displayName="CellLibraryIcon",pe.__docgenInfo={description:"",displayName:"CellLibraryIcon",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ILibraryIconCell"}}}}}catch{}const me=({cell:e})=>{const{hasSort:t,sort:a,sortPriority:l}=e;return t?n.jsxs("span",{className:i.sortingCellIcon,children:[a==="down"?n.jsx(ee,{link:!0,children:n.jsx(B,{icon:$.SORT_ASCENDING})}):a==="up"?n.jsx(ee,{link:!0,children:n.jsx(B,{icon:$.SORT_DESCENDING})}):n.jsx(ee,{faint:!0,children:n.jsx(B,{icon:$.SORT_DESCENDING})}),l&&a?n.jsx("sup",{children:l}):null]}):null};try{me.displayName="Sort",me.__docgenInfo={description:"",displayName:"Sort",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ISortCell"}}}}}catch{}const z=({cell:e,isHeader:t,testId:a})=>{const{error:l,warning:r,tooltip:o,maxTooltipWidth:s,hasSort:u,onSort:d,type:p}=e,c=n.jsxs("div",{className:N(i.staticCellContent,p==="Unit"?i.unit:"",l?i.error:r?i.warning:""),onClick:u?y=>d&&d(y):()=>{},"data-testid":a,children:[e.value,t?n.jsxs(n.Fragment,{children:[n.jsx(ue,{cell:e}),n.jsx(pe,{cell:e}),n.jsx(me,{cell:e})]}):null]});return n.jsx("div",{className:i.inputWrapper,children:n.jsx(fe,{error:!!l,warning:!!r,text:o||l||r,enabled:o&&O(o)||l&&O(l)||r&&O(r)||!1,maxWidth:s,display:"block",placement:"bottom-center",children:c})})};try{z.displayName="StaticCell",z.__docgenInfo={description:"",displayName:"StaticCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IStaticCell"}},isHeader:{defaultValue:null,description:"",name:"isHeader",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const _e=({cell:e,testId:t})=>{const{content:a,fullWidth:l,closeOnOutsideClick:r,disabled:o}=e;return n.jsx(Ke,{content:a,fullWidth:l,closeOnOutsideClick:r,disabled:o,children:n.jsx("div",{className:i.popover,children:n.jsx(z,{cell:e,testId:t})})})};try{_e.displayName="PopoverCell",_e.__docgenInfo={description:"",displayName:"PopoverCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IPopoverCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const ge=({cell:e,isHeader:t,columnAlignment:a,testId:l})=>{if(!e)return null;switch(e.type){case"Input":case"NumberInput":case"Select":return n.jsx(le,{cell:e,columnAlignment:a,testId:l});case"Link":return n.jsx(oe,{cell:e,testId:l});case"CheckBox":return n.jsx(ie,{cell:e,testId:l});case"Slider":return n.jsx(se,{cell:e});case"Icon":return n.jsx(de,{cell:e});case"Actions":return n.jsx(ce,{cell:e});case"Popover":return n.jsx(_e,{cell:e});default:return n.jsx(z,{cell:e,isHeader:t,testId:l})}};try{ge.displayName="CellWrapper",ge.__docgenInfo={description:"",displayName:"CellWrapper",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"any"}},isHeader:{defaultValue:null,description:"",name:"isHeader",required:!0,type:{name:"boolean"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!0,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}var S=(e=>(e.INPUT="Input",e.NUMBER_INPUT="NumberInput",e.SELECT="Select",e.POPOVER="Popover",e.SLIDER="Slider",e.CHECKBOX="CheckBox",e.ACTIONS="Actions",e))(S||{});const Y=({cell:e,isHeader:t,columnHeaderAlignment:a,columnAlignment:l=b.LEFT,width:r,snapshot:o,testId:s})=>{if(!e)return null;const{style:u,colSpan:d,rowSpan:p,width:c}=e,y=T.useRef(null),g={bodyAlignment:l,headerAlignment:a,isHeader:t},P=Te(g,i),x=Te(g,i,!0),L=e.type===S.INPUT||e.type===S.NUMBER_INPUT||e.type===S.SELECT||e.type===S.POPOVER?i.inputCell:e.type===S.SLIDER?i.sliderCell:e.type===S.CHECKBOX?i.checkBoxCell:e.type===S.ACTIONS?i.actionsCell:i.staticCell,w=N(i.cell,L,e.hasSort?i.sortingCell:null,P,e.breakWord?i.breakWord:""),q=c??r??((o==null?void 0:o.isDragging)&&y.current&&y.current.offsetWidth)??void 0,C={width:q,minWidth:q,...u},A=t?"th":"td";return n.jsx(A,{ref:y,className:w,style:C,colSpan:d,rowSpan:p,children:n.jsx(ge,{cell:e,columnAlignment:x??b.RIGHT,isHeader:t,testId:s})})};try{Y.displayName="Cell",Y.__docgenInfo={description:"",displayName:"Cell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!1,type:{name:"TCellShape"}},isHeader:{defaultValue:null,description:"",name:"isHeader",required:!0,type:{name:"boolean"}},columnHeaderAlignment:{defaultValue:null,description:"",name:"columnHeaderAlignment",required:!1,type:{name:"string"}},columnAlignment:{defaultValue:{value:"Align.LEFT"},description:"",name:"columnAlignment",required:!1,type:{name:"Align.LEFT | Align.RIGHT | null"}},width:{defaultValue:null,description:"",name:"width",required:!1,type:{name:"TStringOrNumber"}},snapshot:{defaultValue:null,description:"",name:"snapshot",required:!1,type:{name:"any"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const F=({row:e,rowIndex:t,isHeader:a=!1,columnCount:l,colSpan:r,columnHeaderAlignments:o=[],columnAlignment:s=[],hasRowActions:u,draggableTable:d=!1,snapshot:p=null,provided:c=null,width:y,columnWidths:g,testId:P})=>{const x=T.useRef(null),L=In(o,a,t),{onRowClick:w,onRowFocus:q,onRowMouseEnter:C,onRowMouseLeave:A,expandedContent:I,active:Q}=e,E=e.cells.map((h,v)=>{const he=`${a?0:1}_${t}_${v}`;return n.jsx(Y,{cell:h,isHeader:a,columnAlignment:s[v],columnHeaderAlignment:L[v],width:g?g[v]:void 0,snapshot:p,testId:h.testId},he)}),V=u&&n.jsx(Y,{cell:{type:S.ACTIONS,actions:e.actions},isHeader:a},l),k=(h,v)=>({minWidth:h&&`${y}px`,width:h&&"100%",display:h&&"table",background:h&&"var(--color-background-listitem-active)",border:h&&"var(--color-border)",borderTop:h&&0,opacity:h&&.1,...v}),W=()=>e.noDrag?n.jsx("td",{"aria-labelledby":"unique-label-id"}):n.jsx("td",{className:R.dragIconCell,children:n.jsx("div",{...c.dragHandleProps,className:R.dragIcon,children:n.jsx(B,{icon:$.DRAG})})});return a?n.jsxs(n.Fragment,{children:[n.jsxs("tr",{ref:x,onClick:w,onMouseEnter:C,onMouseLeave:A,onFocus:q,className:N(w?R.clickableRow:null,C?R.hoverableRow:null),children:[d?n.jsx("th",{}):null,E,V]},t),I&&I.content?n.jsx(K,{colSpan:r,flush:I.flush===!0,children:I.content},`${t}_expanded_content`):null]}):n.jsxs(n.Fragment,{children:[n.jsxs("tr",{onClick:w,onMouseEnter:C,onMouseLeave:A,onFocus:q,className:N(w&&!w.noStyle?R.clickableRow:null,C&&!C.noStyle?R.hoverableRow:null,Q?R.rowActive:null),ref:(c==null?void 0:c.innerRef)||null,...(c==null?void 0:c.draggableProps)||null,style:p&&c?k(p.isDragging,c.draggableProps.style):null,children:[d?W():null,E,V]},t),I&&I.content?n.jsx(K,{colSpan:r,flush:I.flush===!0,children:I.content},`${t}_expanded_content`):null]})};try{F.displayName="Row",F.__docgenInfo={description:"",displayName:"Row",props:{row:{defaultValue:null,description:"",name:"row",required:!0,type:{name:"TRowType"}},rowIndex:{defaultValue:null,description:"",name:"rowIndex",required:!0,type:{name:"number"}},isHeader:{defaultValue:{value:"false"},description:"",name:"isHeader",required:!1,type:{name:"boolean"}},columnCount:{defaultValue:null,description:"",name:"columnCount",required:!0,type:{name:"number"}},colSpan:{defaultValue:null,description:"",name:"colSpan",required:!0,type:{name:"number"}},columnHeaderAlignments:{defaultValue:{value:"[]"},description:"",name:"columnHeaderAlignments",required:!1,type:{name:"string[] | string[][]"}},columnAlignment:{defaultValue:{value:"[]"},description:"",name:"columnAlignment",required:!1,type:{name:"string[]"}},hasRowActions:{defaultValue:null,description:"",name:"hasRowActions",required:!0,type:{name:"boolean"}},draggableTable:{defaultValue:{value:"false"},description:"",name:"draggableTable",required:!1,type:{name:"boolean"}},snapshot:{defaultValue:{value:"null"},description:"",name:"snapshot",required:!1,type:{name:"any"}},provided:{defaultValue:{value:"null"},description:"",name:"provided",required:!1,type:{name:"any"}},width:{defaultValue:null,description:"",name:"width",required:!1,type:{name:"TStringOrNumber"}},columnWidths:{defaultValue:null,description:"",name:"columnWidths",required:!1,type:{name:"string[]"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const qe=e=>{var Ie,je,Ne,we,Ae,ve,Re;const{onListReorder:t=()=>{},table:a}=e,{columnWidths:l,footer:r,name:o,rows:s=[],actions:u,actionsRight:d,columnHeaderAlignments:p,columnAlignment:c,striped:y=!0,testId:g,draggable:P,defaultEmptyRow:x=null,onAddRow:L=null,bordered:w=!0,maxHeight:q,fixedWidth:C}=a,A=T.useRef(null),[I,Q]=T.useState({width:0,height:0});T.useEffect(()=>{A.current&&Q({width:A.current.offsetWidth,height:A.current.offsetHeight})},[]);const E=Fe.get(e,"table.headers",[]),V=mn(s,E),k=_n(s,E),W=V+(k?1:0),h=r?((je=(Ie=r==null?void 0:r.pagination)==null?void 0:Ie.rowsPerPage)==null?void 0:je.value)===0||Number((Ne=r==null?void 0:r.pagination)==null?void 0:Ne.selectedPage)>=Number((we=r==null?void 0:r.pagination)==null?void 0:we.rowCount)/Number((ve=(Ae=r==null?void 0:r.pagination)==null?void 0:Ae.rowsPerPage)==null?void 0:ve.value):!0,v=((Re=x==null?void 0:x.cells)==null?void 0:Re.length)&&L&&h,ke={cells:v?x.cells.map((m,j)=>(m==null?void 0:m.type)==="Input"?{...m,onChange:_=>{var M;const f=(M=_==null?void 0:_.target)==null?void 0:M.value,D={...x,cells:x.cells.map((G,We)=>({...G,value:We===j?f:G==null?void 0:G.value}))};L({newRow:D})}}:{...m,disabled:!0}):null,testId:g?`${g}-last-empty-row`:void 0},Z=v?s.concat(ke):s,be={...a,rows:Z},xe=N(H.wrapper,w?H.bordered:""),Ce={maxHeight:q,width:C,display:C==="auto"?"inline-flex":"flex"};return P?n.jsxs("div",{ref:A,className:xe,style:Ce,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(Pe,{onDragEnd:m=>{var f,D;const j=(f=m==null?void 0:m.source)==null?void 0:f.index,_=(D=m==null?void 0:m.destination)==null?void 0:D.index;typeof j=="number"&&typeof _=="number"&&t({from:j,to:_})},children:n.jsx(Le,{droppableId:"droppable",children:m=>n.jsx(J,{table:be,children:({visibleRows:j})=>n.jsxs("table",{className:N(H.table,y?H.striped:""),"data-testid":g,ref:m.innerRef,children:[n.jsx("thead",{children:E.map((_,f)=>n.jsx(F,{rowIndex:f,isHeader:!0,row:_,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p,draggableTable:P},`0_${f}`))}),n.jsxs("tbody",{children:[Z.slice(0,j).map((_,f)=>n.jsx(De,{draggableId:f+"",index:f,isDragDisabled:_.noDrag,children:(D,M)=>n.jsx(F,{rowIndex:f,row:_,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,provided:D,snapshot:M,draggableTable:P,width:I.width},`1_${f}`)},`index_${f}`)),m.placeholder]})]})})})}),r&&n.jsx(X,{pagination:r.pagination,actions:r.actions,content:r.content})]}):n.jsxs("div",{className:xe,style:Ce,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(J,{table:be,children:({visibleRows:m})=>n.jsxs("table",{className:N(H.table,y?H.striped:""),"data-testid":g,children:[n.jsx("thead",{children:E.map((j,_)=>n.jsx(F,{rowIndex:_,isHeader:!0,row:j,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p},`0_${_}`))}),n.jsx("tbody",{children:Z.slice(0,m).map((j,_)=>n.jsx(F,{rowIndex:_,row:j,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c},`1_${_}`))})]})}),r&&n.jsx(X,{colSpan:W,pagination:r.pagination,actions:r.actions,content:r.content})]})};try{qe.displayName="Table",qe.__docgenInfo={description:"",displayName:"Table",props:{onListReorder:{defaultValue:null,description:"",name:"onListReorder",required:!1,type:{name:"((obj: { from: number; to: number; }) => void)"}},table:{defaultValue:null,description:"",name:"table",required:!0,type:{name:"{ name?: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined; ... 18 more ...; actions?: any; }"}}}}}catch{}export{qe as T};
@@ -1,4 +1,4 @@
1
- import{j as n}from"./jsx-runtime-f961835c.js";import{r as S}from"./index-f80c8c95.js";import{f as K}from"./immer.esm-5c06d4d0.js";import{l as oe}from"./lodash-75c70a11.js";import{G as se}from"./grid-3b729f81.js";import{T as V}from"./text-ad1f5f1d.js";import{T as A}from"./table-b41d5bdc.js";import{C as sn}from"./card-3847c251.js";import{I as ae}from"./input-f82f3a98.js";import{F as re}from"./field-a094cd72.js";import{H as ln}from"./heading-d29eb744.js";import{t as ne,a as on,b as cn,c as dn,d as un,e as pn,f as gn,g as mn}from"./table.stories-data-8a836b92.js";import"./styled-components.browser.esm-416d73e5.js";import"./tslib.es6-dfef685f.js";import"./index-a80ed1cf.js";import"./index.es-85cc7dfc.js";import"./inheritsLoose-d4851ab8.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./index-3d476d02.js";import"./memoize-one.esm-52518564.js";import"./icon-e9cbb4d7.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./actions-2d4e1c8e.js";import"./common-types-2c81813f.js";import"./button-74c97e4a.js";import"./spinner-a81ebe38.js";import"./tooltip-23e84186.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./pagination-556e629a.js";import"./select-205cd538.js";import"./assertThisInitialized-081f9914.js";import"./select.input-88b6ebab.js";import"./input-group-20c3add3.js";import"./input-group-addon-f8f6683a.js";import"./number-input-1f8dcc90.js";import"./index-57d7693e.js";import"./index-54f0d271.js";import"./check-box-e21258d5.js";import"./help-icon-d4189b1b.js";import"./slider-160e2152.js";import"./index-c7f280f6.js";import"./popover-06e375a5.js";import"./label-13d490a3.js";import"./flex-1d14d86c.js";const ct={title:"Basic/Table",component:A,args:{table:{...ne}}},I=g=>n.jsx(A,{...g}),B=I.bind({}),_=I.bind({});_.args={table:{...ne,fixedWidth:"400px"}};const M=I.bind({});M.args={table:{...ne,fixedWidth:"auto"}};const O=I.bind({});O.args={table:on};O.parameters={docs:{description:{story:"Use sparingly when certain columns cannot be below a certain width. Unless the Table is auto width, set one column to `auto` to use remaining space."}}};const L=I.bind({});L.args={table:cn};const U=I.bind({});U.args={table:dn};U.parameters={docs:{description:{story:"This is only required when you need to override `columnAlignment` in header cells (i.e. they have different alignment)"}}};const Q=I.bind({});Q.args={table:un};const E=I.bind({});E.args={table:pn};E.decorators=[g=>n.jsx("div",{style:{position:"absolute",inset:0,padding:"var(--padding)"},children:n.jsx(g,{})})];const N=I.bind({});N.args={table:gn};N.parameters={docs:{description:{story:"If a `maxHeight` is set, the table should only fill that height if it needs to."}}};const G=I.bind({});G.args={table:mn};const q=()=>n.jsx(sn,{heading:n.jsx(ln,{children:"Card heading"}),padding:!1,children:n.jsx(A,{table:{...ne,bordered:!1}})});q.parameters={docs:{source:{type:"dynamic"}}};const z=()=>{const g=["Section","Width","Height"];let u=["","m","m"],r=[...Array(175).keys()].map((s,t)=>[t,t*2,t*2]);const T=(s,t,i)=>s==="m"&&t==="ft"?i*3.28084:s==="ft"&&t==="m"?i/3.28084:i,o=(s,t,i,p)=>{r[t][i]=s.target.value,p()},C=s=>{r=r.concat([["","",""]]),s()},k=(s,t)=>{r=r.filter((i,p)=>p!==s),t()},d=(s,t,i)=>{const p=u[t],y=s.target.value;u=u.map((R,h)=>h===t?y:R),r=r.map(R=>R.map((h,b)=>b===t?T(p,y,h):h)),i()},m=()=>{const s=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[t,i]=S.useState(10),[p,y]=S.useState(1),[R,h]=S.useState(!1),b=()=>{h(!R)},W=()=>{const e=Math.ceil(r.length/t);y(e)},D=(p-1)*t,a=t===0?r.length-1:D+t,c={headers:[{cells:g.map(e=>({value:e})),actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{C(b),W()}}]},{cells:[{},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:u[1],type:"Select",native:!0,onChange:e=>d(e,1,b)},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:u[2],type:"Select",native:!0,onChange:e=>d(e,2,b)}]}],rows:r.slice(D,a).map((e,l)=>{const P=D+l;return{cells:[...Array(3).keys()].map((f,w)=>({value:e[w],type:"Input",onChange:x=>o(x,P,w,b)})),actions:[{label:"Delete",icon:"minus",onClick:()=>k(P,b)}]}}),footer:{pagination:{rowCount:r.length,selectedPage:p,rowsPerPage:{onChange:e=>{const{value:l}=e.target;i(Number(l))},options:s,value:t},onSelectPage:e=>y(e),small:!0}}};return n.jsx(A,{table:c})};return n.jsx(m,{})},J=()=>{const g=["Section","Width","Height"];let u=[...Array(175).keys()].map((T,o)=>({Section:o,Width:o*2,Height:o*2}));const r=()=>{const T=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[o,C]=S.useState(10),[k,d]=S.useState(1),[m,s]=S.useState({}),[t,i]=S.useState({});S.useEffect(()=>{d(1)},[m,t]);const p=(k-1)*o,y=o===0?u.length-1:p+o,R=(e,l,P)=>e.filter(f=>Object.keys(l).every(w=>l[w]===""?!0:f[w].toString().includes(l[w]))).sort((f,w)=>Object.entries(P).map(([x,F])=>{switch(F){case"up":return f[x]-w[x];case"down":return w[x]-f[x];default:return 0}}).reduce((x,F)=>x||F,0)),h=(e,l,P,f,w)=>{const x=e.map(v=>{const j=Object.keys(f).includes(v)?f[v]:"",H=`${v[0].toUpperCase()}${v.slice(1)}`;return{key:v,value:H,hasSort:!0,sort:j,onSort:()=>{const $=j===""?"up":j==="up"?"down":"";w({...f,[v]:$})}}}),F=e.map(v=>{const j=Object.keys(l).includes(v)?l[v]:"";return{key:v,value:j,type:"Input",placeholder:"Filter",onChange:H=>P({...l,[v]:H.target.value})}});return{dataSortCells:x,dataFilterCells:F}},{dataSortCells:b,dataFilterCells:W}=h(g,m,s,t,i),D=R(u,m,t),a=[...D.slice(p,y).map(e=>({cells:Object.entries(e).map(([P,f])=>({key:P,value:f,type:"Input",disabled:!0}))}))],c={headers:[{cells:b},{cells:W}],rows:a,footer:{pagination:{rowCount:D.length,selectedPage:k,rowsPerPage:{onChange:e=>{const{value:l}=e.target;C(Number(l))},options:T,value:o},onSelectPage:e=>d(e),small:!0}}};return n.jsx(A,{table:c})};return n.jsx(r,{})},X=()=>{const g={tea:3.6,coffee:3.2,orange:4.1},u=[{label:"Tea",value:"tea"},{label:"Coffee",value:"coffee"},{label:"Orange juice",value:"orange"}],r={cells:[{type:"Select",options:u,value:{value:"tea"}},{type:"Input"},{type:"Static"}]},T=[...Array(15).keys()].map((a,c)=>({cells:[{type:"Select",options:u,value:{value:"tea"}},{type:"Input",value:c+1},{type:"Static"}]})),[o,C]=S.useState(T),k=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[d,m]=S.useState(10),[s,t]=S.useState(1),i=(s-1)*d,p=d===0?o.length-1:i+d,y=({newRow:a}={})=>{const c=K(o,e=>{e.push(a??r)});C(c)},R=({rowIndex:a})=>{const c=K(o,e=>{delete e[a]}).filter(e=>e);C(c)},h=({rowIndex:a,value:c})=>{const e=K(o,l=>{l[a].cells[0].value.value=c});C(e)},b=({rowIndex:a,value:c})=>{const e=K(o,l=>{l[a].cells[1].value=c});C(e)},W=({value:a})=>{const c=Number(a);return!oe.isNaN(c)&&oe.isInteger(c)&&c>0},D=o.slice(i,p).map((a,c)=>{const e=i+c;return o.length-1,{...a,cells:a==null?void 0:a.cells.map((l,P)=>{var v,j,H,$,le;const f=(H=(j=(v=a==null?void 0:a.cells)==null?void 0:v[0])==null?void 0:j.value)==null?void 0:H.value,w=Number((le=($=a==null?void 0:a.cells)==null?void 0:$[1])==null?void 0:le.value),x=g==null?void 0:g[f],F=x&&W({value:w})?(x*w).toFixed(2):null;if(P===0)return{...l,onChange:te=>h({rowIndex:e,value:te.target.value})};if(P===1)return{...l,onChange:te=>b({rowIndex:e,value:te.target.value}),error:W({value:l.value})?null:"Must be valid whole number"};if(P===2)return{...l,value:F}}),actions:[{label:"Delete",icon:"minus",onClick:()=>R({rowIndex:e})}]}});return n.jsx(A,{table:{defaultEmptyRow:r,onAddRow:y,columnAlignment:["left","right","right"],headers:[{cells:[{value:"Drink"},{value:"Quantity"},{value:"Total Price (£)"}],actions:[{primary:!0,icon:"plus",label:"Add",onClick:()=>y()}]}],rows:D,footer:{pagination:{rowCount:o.length,selectedPage:s,rowsPerPage:{onChange:a=>{const{value:c}=a.target;m(Number(c))},options:k,value:d},onSelectPage:a=>t(a),small:!0}}}})},Y=()=>{const g=["Section","Width","Height"];let u=Array.from(Array(10),(d,m)=>[m,m*2,m*2]);const[r,T]=S.useState({pastedValues:"",rowIndex:0,cellIndex:0}),o=(d,m,s,t)=>{u[m][s]=Number(d.target.value),t()},C=(d,m,s,t)=>{var p;let i=((p=d==null?void 0:d.clipboardData)==null?void 0:p.getData("text"))??"";return T({rowIndex:m,cellIndex:s,pastedValues:i}),t(),{pastedData:r}},k=()=>{const[d,m]=S.useState(!1),s=()=>{m(!d)},t={headers:[{cells:g.map(i=>({value:i}))}],rows:u.map((i,p)=>{const y=p;return{cells:[...Array(3).keys()].map((R,h)=>({value:i[h],type:"Input",onChange:b=>o(b,y,h,s),onPaste:b=>C(b,y,h,s)}))}})};return n.jsxs(n.Fragment,{children:[n.jsx(A,{table:t}),n.jsx(re,{label:"Pasted Data",children:n.jsx(ae,{value:r.pastedValues})}),n.jsx(re,{label:"At Row",children:n.jsx(ae,{value:r.rowIndex})}),n.jsx(re,{label:"At Cell Index",children:n.jsx(ae,{value:r.cellIndex})})]})};return n.jsx(k,{})},Z=()=>{const g={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],columnAlignment:[...Array(10)].map((u,r)=>"right"),headers:[{cells:[...Array(10)].map((u,r)=>({value:"Heading"}))},{cells:[...Array(10)].map((u,r)=>({options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],type:"Select",searchable:!1,value:{label:"m",value:"m"},autoLayerWidth:!0}))}],rows:[...Array(10)].map((u,r)=>({cells:[...Array(10)].map((T,o)=>({value:123.45})),actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here lorem ipsum"}),n.jsx(V,{children:"Label: 123.45m"}),n.jsx(V,{children:"Another label: 123.45m"}),n.jsx(V,{children:"Label: 123.45m"})]})}]}))};return n.jsx(A,{table:g})},ee=()=>{const g={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],headers:[{cells:[{value:"Label"},{value:"Value",colSpan:2}]}],rows:[{cells:[{value:"Country",style:{fontWeight:"bold"},width:"120px"},{value:"Norway",colSpan:2}],actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here"}),n.jsx(V,{children:"Details go here"})]})}]},{cells:[{value:"Depth",style:{fontWeight:"bold"}},{value:123,width:"80px"},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:{label:"m",value:"m"},type:"Select",width:"80px"}],actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here"}),n.jsx(V,{children:"Details go here"})]})}]}]};return n.jsx(A,{table:g})};var ie,ce,de;B.parameters={...B.parameters,docs:{...(ie=B.parameters)==null?void 0:ie.docs,source:{originalSource:`args => {
1
+ import{j as n}from"./jsx-runtime-f961835c.js";import{r as S}from"./index-f80c8c95.js";import{f as K}from"./immer.esm-5c06d4d0.js";import{l as oe}from"./lodash-75c70a11.js";import{G as se}from"./grid-3b729f81.js";import{T as V}from"./text-ad1f5f1d.js";import{T as A}from"./table-da6f6045.js";import{C as sn}from"./card-3847c251.js";import{I as ae}from"./input-d68625a5.js";import{F as re}from"./field-a094cd72.js";import{H as ln}from"./heading-d29eb744.js";import{t as ne,a as on,b as cn,c as dn,d as un,e as pn,f as gn,g as mn}from"./table.stories-data-8a836b92.js";import"./styled-components.browser.esm-416d73e5.js";import"./tslib.es6-dfef685f.js";import"./index-a80ed1cf.js";import"./index.es-85cc7dfc.js";import"./inheritsLoose-d4851ab8.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./index-3d476d02.js";import"./memoize-one.esm-52518564.js";import"./icon-e9cbb4d7.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./actions-2d4e1c8e.js";import"./common-types-2c81813f.js";import"./button-74c97e4a.js";import"./spinner-a81ebe38.js";import"./tooltip-23e84186.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./pagination-8aade846.js";import"./select-205cd538.js";import"./assertThisInitialized-081f9914.js";import"./select.input-88b6ebab.js";import"./input-group-20c3add3.js";import"./input-group-addon-f8f6683a.js";import"./number-input-7d49b0b3.js";import"./index-57d7693e.js";import"./index-54f0d271.js";import"./check-box-e21258d5.js";import"./help-icon-d4189b1b.js";import"./slider-160e2152.js";import"./index-c7f280f6.js";import"./popover-06e375a5.js";import"./label-13d490a3.js";import"./flex-1d14d86c.js";const ct={title:"Basic/Table",component:A,args:{table:{...ne}}},I=g=>n.jsx(A,{...g}),B=I.bind({}),_=I.bind({});_.args={table:{...ne,fixedWidth:"400px"}};const M=I.bind({});M.args={table:{...ne,fixedWidth:"auto"}};const O=I.bind({});O.args={table:on};O.parameters={docs:{description:{story:"Use sparingly when certain columns cannot be below a certain width. Unless the Table is auto width, set one column to `auto` to use remaining space."}}};const L=I.bind({});L.args={table:cn};const U=I.bind({});U.args={table:dn};U.parameters={docs:{description:{story:"This is only required when you need to override `columnAlignment` in header cells (i.e. they have different alignment)"}}};const Q=I.bind({});Q.args={table:un};const E=I.bind({});E.args={table:pn};E.decorators=[g=>n.jsx("div",{style:{position:"absolute",inset:0,padding:"var(--padding)"},children:n.jsx(g,{})})];const N=I.bind({});N.args={table:gn};N.parameters={docs:{description:{story:"If a `maxHeight` is set, the table should only fill that height if it needs to."}}};const G=I.bind({});G.args={table:mn};const q=()=>n.jsx(sn,{heading:n.jsx(ln,{children:"Card heading"}),padding:!1,children:n.jsx(A,{table:{...ne,bordered:!1}})});q.parameters={docs:{source:{type:"dynamic"}}};const z=()=>{const g=["Section","Width","Height"];let u=["","m","m"],r=[...Array(175).keys()].map((s,t)=>[t,t*2,t*2]);const T=(s,t,i)=>s==="m"&&t==="ft"?i*3.28084:s==="ft"&&t==="m"?i/3.28084:i,o=(s,t,i,p)=>{r[t][i]=s.target.value,p()},C=s=>{r=r.concat([["","",""]]),s()},k=(s,t)=>{r=r.filter((i,p)=>p!==s),t()},d=(s,t,i)=>{const p=u[t],y=s.target.value;u=u.map((R,h)=>h===t?y:R),r=r.map(R=>R.map((h,b)=>b===t?T(p,y,h):h)),i()},m=()=>{const s=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[t,i]=S.useState(10),[p,y]=S.useState(1),[R,h]=S.useState(!1),b=()=>{h(!R)},W=()=>{const e=Math.ceil(r.length/t);y(e)},D=(p-1)*t,a=t===0?r.length-1:D+t,c={headers:[{cells:g.map(e=>({value:e})),actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{C(b),W()}}]},{cells:[{},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:u[1],type:"Select",native:!0,onChange:e=>d(e,1,b)},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:u[2],type:"Select",native:!0,onChange:e=>d(e,2,b)}]}],rows:r.slice(D,a).map((e,l)=>{const P=D+l;return{cells:[...Array(3).keys()].map((f,w)=>({value:e[w],type:"Input",onChange:x=>o(x,P,w,b)})),actions:[{label:"Delete",icon:"minus",onClick:()=>k(P,b)}]}}),footer:{pagination:{rowCount:r.length,selectedPage:p,rowsPerPage:{onChange:e=>{const{value:l}=e.target;i(Number(l))},options:s,value:t},onSelectPage:e=>y(e),small:!0}}};return n.jsx(A,{table:c})};return n.jsx(m,{})},J=()=>{const g=["Section","Width","Height"];let u=[...Array(175).keys()].map((T,o)=>({Section:o,Width:o*2,Height:o*2}));const r=()=>{const T=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[o,C]=S.useState(10),[k,d]=S.useState(1),[m,s]=S.useState({}),[t,i]=S.useState({});S.useEffect(()=>{d(1)},[m,t]);const p=(k-1)*o,y=o===0?u.length-1:p+o,R=(e,l,P)=>e.filter(f=>Object.keys(l).every(w=>l[w]===""?!0:f[w].toString().includes(l[w]))).sort((f,w)=>Object.entries(P).map(([x,F])=>{switch(F){case"up":return f[x]-w[x];case"down":return w[x]-f[x];default:return 0}}).reduce((x,F)=>x||F,0)),h=(e,l,P,f,w)=>{const x=e.map(v=>{const j=Object.keys(f).includes(v)?f[v]:"",H=`${v[0].toUpperCase()}${v.slice(1)}`;return{key:v,value:H,hasSort:!0,sort:j,onSort:()=>{const $=j===""?"up":j==="up"?"down":"";w({...f,[v]:$})}}}),F=e.map(v=>{const j=Object.keys(l).includes(v)?l[v]:"";return{key:v,value:j,type:"Input",placeholder:"Filter",onChange:H=>P({...l,[v]:H.target.value})}});return{dataSortCells:x,dataFilterCells:F}},{dataSortCells:b,dataFilterCells:W}=h(g,m,s,t,i),D=R(u,m,t),a=[...D.slice(p,y).map(e=>({cells:Object.entries(e).map(([P,f])=>({key:P,value:f,type:"Input",disabled:!0}))}))],c={headers:[{cells:b},{cells:W}],rows:a,footer:{pagination:{rowCount:D.length,selectedPage:k,rowsPerPage:{onChange:e=>{const{value:l}=e.target;C(Number(l))},options:T,value:o},onSelectPage:e=>d(e),small:!0}}};return n.jsx(A,{table:c})};return n.jsx(r,{})},X=()=>{const g={tea:3.6,coffee:3.2,orange:4.1},u=[{label:"Tea",value:"tea"},{label:"Coffee",value:"coffee"},{label:"Orange juice",value:"orange"}],r={cells:[{type:"Select",options:u,value:{value:"tea"}},{type:"Input"},{type:"Static"}]},T=[...Array(15).keys()].map((a,c)=>({cells:[{type:"Select",options:u,value:{value:"tea"}},{type:"Input",value:c+1},{type:"Static"}]})),[o,C]=S.useState(T),k=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[d,m]=S.useState(10),[s,t]=S.useState(1),i=(s-1)*d,p=d===0?o.length-1:i+d,y=({newRow:a}={})=>{const c=K(o,e=>{e.push(a??r)});C(c)},R=({rowIndex:a})=>{const c=K(o,e=>{delete e[a]}).filter(e=>e);C(c)},h=({rowIndex:a,value:c})=>{const e=K(o,l=>{l[a].cells[0].value.value=c});C(e)},b=({rowIndex:a,value:c})=>{const e=K(o,l=>{l[a].cells[1].value=c});C(e)},W=({value:a})=>{const c=Number(a);return!oe.isNaN(c)&&oe.isInteger(c)&&c>0},D=o.slice(i,p).map((a,c)=>{const e=i+c;return o.length-1,{...a,cells:a==null?void 0:a.cells.map((l,P)=>{var v,j,H,$,le;const f=(H=(j=(v=a==null?void 0:a.cells)==null?void 0:v[0])==null?void 0:j.value)==null?void 0:H.value,w=Number((le=($=a==null?void 0:a.cells)==null?void 0:$[1])==null?void 0:le.value),x=g==null?void 0:g[f],F=x&&W({value:w})?(x*w).toFixed(2):null;if(P===0)return{...l,onChange:te=>h({rowIndex:e,value:te.target.value})};if(P===1)return{...l,onChange:te=>b({rowIndex:e,value:te.target.value}),error:W({value:l.value})?null:"Must be valid whole number"};if(P===2)return{...l,value:F}}),actions:[{label:"Delete",icon:"minus",onClick:()=>R({rowIndex:e})}]}});return n.jsx(A,{table:{defaultEmptyRow:r,onAddRow:y,columnAlignment:["left","right","right"],headers:[{cells:[{value:"Drink"},{value:"Quantity"},{value:"Total Price (£)"}],actions:[{primary:!0,icon:"plus",label:"Add",onClick:()=>y()}]}],rows:D,footer:{pagination:{rowCount:o.length,selectedPage:s,rowsPerPage:{onChange:a=>{const{value:c}=a.target;m(Number(c))},options:k,value:d},onSelectPage:a=>t(a),small:!0}}}})},Y=()=>{const g=["Section","Width","Height"];let u=Array.from(Array(10),(d,m)=>[m,m*2,m*2]);const[r,T]=S.useState({pastedValues:"",rowIndex:0,cellIndex:0}),o=(d,m,s,t)=>{u[m][s]=Number(d.target.value),t()},C=(d,m,s,t)=>{var p;let i=((p=d==null?void 0:d.clipboardData)==null?void 0:p.getData("text"))??"";return T({rowIndex:m,cellIndex:s,pastedValues:i}),t(),{pastedData:r}},k=()=>{const[d,m]=S.useState(!1),s=()=>{m(!d)},t={headers:[{cells:g.map(i=>({value:i}))}],rows:u.map((i,p)=>{const y=p;return{cells:[...Array(3).keys()].map((R,h)=>({value:i[h],type:"Input",onChange:b=>o(b,y,h,s),onPaste:b=>C(b,y,h,s)}))}})};return n.jsxs(n.Fragment,{children:[n.jsx(A,{table:t}),n.jsx(re,{label:"Pasted Data",children:n.jsx(ae,{value:r.pastedValues})}),n.jsx(re,{label:"At Row",children:n.jsx(ae,{value:r.rowIndex})}),n.jsx(re,{label:"At Cell Index",children:n.jsx(ae,{value:r.cellIndex})})]})};return n.jsx(k,{})},Z=()=>{const g={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],columnAlignment:[...Array(10)].map((u,r)=>"right"),headers:[{cells:[...Array(10)].map((u,r)=>({value:"Heading"}))},{cells:[...Array(10)].map((u,r)=>({options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],type:"Select",searchable:!1,value:{label:"m",value:"m"},autoLayerWidth:!0}))}],rows:[...Array(10)].map((u,r)=>({cells:[...Array(10)].map((T,o)=>({value:123.45})),actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here lorem ipsum"}),n.jsx(V,{children:"Label: 123.45m"}),n.jsx(V,{children:"Another label: 123.45m"}),n.jsx(V,{children:"Label: 123.45m"})]})}]}))};return n.jsx(A,{table:g})},ee=()=>{const g={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],headers:[{cells:[{value:"Label"},{value:"Value",colSpan:2}]}],rows:[{cells:[{value:"Country",style:{fontWeight:"bold"},width:"120px"},{value:"Norway",colSpan:2}],actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here"}),n.jsx(V,{children:"Details go here"})]})}]},{cells:[{value:"Depth",style:{fontWeight:"bold"}},{value:123,width:"80px"},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:{label:"m",value:"m"},type:"Select",width:"80px"}],actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here"}),n.jsx(V,{children:"Details go here"})]})}]}]};return n.jsx(A,{table:g})};var ie,ce,de;B.parameters={...B.parameters,docs:{...(ie=B.parameters)==null?void 0:ie.docs,source:{originalSource:`args => {
2
2
  return <Table
3
3
  // eslint-disable-next-line react/jsx-props-no-spreading
4
4
  {...args} />;
@@ -1,4 +1,4 @@
1
- import{j as B}from"./jsx-runtime-f961835c.js";import{T as X}from"./table-b41d5bdc.js";import{t as O,h as W,i as q,j as z,k as D,l as G,m as K,n as M,o as P,p as Q}from"./table.stories-data-8a836b92.js";import"./index-f80c8c95.js";import"./index-a80ed1cf.js";import"./index.es-85cc7dfc.js";import"./inheritsLoose-d4851ab8.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./index-3d476d02.js";import"./memoize-one.esm-52518564.js";import"./icon-e9cbb4d7.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./lodash-75c70a11.js";import"./actions-2d4e1c8e.js";import"./common-types-2c81813f.js";import"./button-74c97e4a.js";import"./spinner-a81ebe38.js";import"./tooltip-23e84186.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./heading-d29eb744.js";import"./help-icon-d4189b1b.js";import"./pagination-556e629a.js";import"./select-205cd538.js";import"./assertThisInitialized-081f9914.js";import"./text-ad1f5f1d.js";import"./select.input-88b6ebab.js";import"./input-f82f3a98.js";import"./input-group-20c3add3.js";import"./input-group-addon-f8f6683a.js";import"./number-input-1f8dcc90.js";import"./index-57d7693e.js";import"./index-54f0d271.js";import"./check-box-e21258d5.js";import"./slider-160e2152.js";import"./index-c7f280f6.js";import"./popover-06e375a5.js";import"./flex-1d14d86c.js";const kr={title:"Basic/Table/Title & Header",component:X,args:{table:{...O}}},r=k=>B.jsx(X,{...k}),e=r.bind({});e.args={table:W};const s=r.bind({});s.args={table:q};const a=r.bind({});a.args={table:z};const t=r.bind({});t.args={table:D};const o=r.bind({});o.args={table:G};const n=r.bind({});n.args={table:K};const i=r.bind({});i.args={table:M};const p=r.bind({});p.args={table:P};const l=r.bind({});l.args={table:Q};var m,c,d;e.parameters={...e.parameters,docs:{...(m=e.parameters)==null?void 0:m.docs,source:{originalSource:`args => {
1
+ import{j as B}from"./jsx-runtime-f961835c.js";import{T as X}from"./table-da6f6045.js";import{t as O,h as W,i as q,j as z,k as D,l as G,m as K,n as M,o as P,p as Q}from"./table.stories-data-8a836b92.js";import"./index-f80c8c95.js";import"./index-a80ed1cf.js";import"./index.es-85cc7dfc.js";import"./inheritsLoose-d4851ab8.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./index-3d476d02.js";import"./memoize-one.esm-52518564.js";import"./icon-e9cbb4d7.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./lodash-75c70a11.js";import"./actions-2d4e1c8e.js";import"./common-types-2c81813f.js";import"./button-74c97e4a.js";import"./spinner-a81ebe38.js";import"./tooltip-23e84186.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./heading-d29eb744.js";import"./help-icon-d4189b1b.js";import"./pagination-8aade846.js";import"./select-205cd538.js";import"./assertThisInitialized-081f9914.js";import"./text-ad1f5f1d.js";import"./select.input-88b6ebab.js";import"./input-d68625a5.js";import"./input-group-20c3add3.js";import"./input-group-addon-f8f6683a.js";import"./number-input-7d49b0b3.js";import"./index-57d7693e.js";import"./index-54f0d271.js";import"./check-box-e21258d5.js";import"./slider-160e2152.js";import"./index-c7f280f6.js";import"./popover-06e375a5.js";import"./flex-1d14d86c.js";const kr={title:"Basic/Table/Title & Header",component:X,args:{table:{...O}}},r=k=>B.jsx(X,{...k}),e=r.bind({});e.args={table:W};const s=r.bind({});s.args={table:q};const a=r.bind({});a.args={table:z};const t=r.bind({});t.args={table:D};const o=r.bind({});o.args={table:G};const n=r.bind({});n.args={table:K};const i=r.bind({});i.args={table:M};const p=r.bind({});p.args={table:P};const l=r.bind({});l.args={table:Q};var m,c,d;e.parameters={...e.parameters,docs:{...(m=e.parameters)==null?void 0:m.docs,source:{originalSource:`args => {
2
2
  return <Table
3
3
  // eslint-disable-next-line react/jsx-props-no-spreading
4
4
  {...args} />;
@@ -1,4 +1,4 @@
1
- import{j as e}from"./jsx-runtime-f961835c.js";import{r as o}from"./index-f80c8c95.js";import{d as r,r as rn}from"./index-57d7693e.js";import{c as sn}from"./index-a80ed1cf.js";import{M as we}from"./actions-2d4e1c8e.js";import{I as un}from"./input-group-addon-f8f6683a.js";import{B as m}from"./button-74c97e4a.js";import{T as on}from"./tooltip-23e84186.js";import{I as dn}from"./input-group-20c3add3.js";import{S}from"./spacer-54db0620.js";import{T as cn}from"./text-ad1f5f1d.js";import{I as mn}from"./input-f82f3a98.js";import{M as Ee}from"./types-cc224262.js";import{l as E}from"./lodash-75c70a11.js";import{D as pn}from"./divider-182aa58c.js";import{R as qt,C as pe}from"./row-2299f0e7.js";import{F as I}from"./field-a094cd72.js";import{a as ge}from"./message-7e627e60.js";import"./index-54f0d271.js";import"./common-types-2c81813f.js";import"./disabled-context-d654f6ff.js";import"./icon-e9cbb4d7.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./spinner-a81ebe38.js";import"./index-3d476d02.js";import"./styled-components.browser.esm-416d73e5.js";import"./label-13d490a3.js";import"./help-icon-d4189b1b.js";const gn=()=>{const t=o.useRef(null);return o.useLayoutEffect(()=>{t.current&&(t.current(),t.current=null)}),n=>{t.current=n}},hn=t=>{const a=o.useRef();return o.useEffect(()=>{a.current=t},[t]),a.current},vn=(t,a)=>{const n=a==null?void 0:a[t];return n||(console.log(`Warning: 'unitTemplate' does not define a preferred unit for '${t}'. Defaulting to standard unit.`),r.unitFromQuantity(t)??"")};var b=(t=>(t.CUSTOM="custom",t.PREDEFINED="predefined",t))(b||{});const Wt=t=>t==="undefined"||t===void 0||t===""||t==="null"||t===null||t==="NaN"||isNaN(t),Rt=(t="",a,n="",i=!1)=>{if(i)return t;if(a&&!Wt(t))try{const u=r.isValueWithUnit(t)?t:r.withUnit(t,n),d=r.convertSamePrecision(u,a);return r.getValue(d)}catch{}return t},fn=t=>t?!!r.getUnit(t):!1,F=(t="",a,n,i)=>{if(i)return t;const u=fn(t)||r.isValueWithUnit(t),d=r.getValue(t);return Wt(d)?d:u?Rt(d,a,n,i):t},Ne=t=>E.isObject(t)&&!E.isArray(t)&&!E.isFunction(t)?E.get(t,"fieldName",""):typeof t=="string"?t:"",Cn=t=>E.isObjectLike(t)&&E.has(t,"message"),bn=t=>typeof t=="string"?t:Cn(t)?t.message:null;var Un=rn();const yn=t=>t.search(RegExp(/(^0{2}\.)|(^0+[1-9])/g))===0,Ae=(t,a)=>{var j;const{allowEmpty:n=!1,autoValue:i,placeholder:u,disabledValidation:d=!1}=a||{},s=String(t);if(d||i||u)return null;const g=Un.isValueWithUnit(s)?r.getValue(s):s;if(n&&g==="")return null;if(yn(g))return"Invalid number format due to leading zeroes";const h=r.validateNumber(g);if(!h.valid){const re=((j=h==null?void 0:h.errors)==null?void 0:j[0])??null;return bn(re)}return null},Pe=(t="")=>{var a;return(a=r.KNOWN_UNITS)==null?void 0:a.includes(t)},xn=(t,a)=>{const n=r.getUnit(t||"");return Pe(a)&&Pe(n)},Vn="_predefinedMenuActive_1yvt4_1",In={predefinedMenuActive:Vn},p=({name:t,placeholder:a="",disabled:n=!1,disabledUnit:i=!1,error:u=null,left:d=!1,small:s=!1,width:g="100%",value:h,unitkey:j="",initUnit:re,noConversion:Tt=!1,onChange:se=()=>{},onClick:kn=()=>{},onFocus:Lt=()=>{},onSwitchUnit:he=()=>{},unitTemplate:ve,doNotConvertValue:A=!1,testId:w,warning:Kt=null,predefinedOptions:x,initialPredefinedOption:$t=!1,shouldLinkAutomaticly:fe=!0,selectedPredefinedOptionKey:Ce,validationCallback:be=()=>({name:"",error:null}),disabledValidation:Ue=!1,allowEmpty:ye=!1,autoValue:V})=>{typeof h=="number"&&(h=`${h}`);const Ht=gn(),[ie="",P=""]=h!==void 0?r.split(h):[],xe=V?r.getUnit(V):"",Ve=o.useMemo(()=>vn(j,ve),[j,ve]),zt=xn(h,Ve),U=re||Ve||P,Jt=hn(U),Ie=F(h,U,P,A),je=F(V,U,xe,A),Yt=Ie!==""?{value:Ie,unit:U}:je!==""?{value:je,unit:U}:{value:ie,unit:P},[v,Y]=o.useState(Yt),[Zt,ue]=o.useState(null),[k,oe]=o.useState($t?b.PREDEFINED:b.CUSTOM),de=ie===""&&V,D=x&&x.find(l=>{if(Ce)return Ce===l.valueKey;const c=r.isValueWithUnit(l.value)?r.getUnit(l.value):"";return r.withUnit(Rt(h,c),c)===l.value}),Gt=()=>{if(j)try{const l=de?V:h??"";let c=r.altUnitsList(l,j);return r.getValue(l)===""?c.map(f=>["",f[1]]):c}catch{return null}},Qt=l=>{const c=Ne(t),f=l.target,{value:y,selectionStart:X}=f,Se=r.cleanNumStr(y.replaceAll(" ","").replaceAll("|","")),ce=r.withUnit(Se,(v==null?void 0:v.unit)||""),nn=r.getValue(ce),me=Ae(nn,{allowEmpty:ye,autoValue:V,placeholder:a,disabledValidation:Ue});if(me===null){se({target:{value:ce,name:c}});const[an,ln]=r.split(ce);Y({value:an,unit:ln}),ue(null),be(c,null)}else Y({value:Se,unit:v.unit}),ue(me),be(c,me);Ht(()=>{f.selectionStart=X,f.selectionEnd=X})},Xt=(l,c)=>{c===v.unit||isNaN(Number(l))||(Y({value:l,unit:c}),he&&he(c))};o.useEffect(()=>{if(U){let f,y="";Jt!==U?(f=F(h,U,P,A),y=U):r.withUnit(v.value,v.unit)!==h&&(f=F(h,v.unit,P,A),y=v.unit),f!==void 0&&Y({value:f,unit:y}),x&&oe(D&&fe?b.PREDEFINED:b.CUSTOM)}const l=r.checkAndCleanDecimalComma(ie),c=Ae(l,{allowEmpty:ye,autoValue:V,placeholder:a,disabledValidation:Ue});ue(c)},[U,h,u,fe]);const Z=Gt(),G=r.label(v.unit)||v.unit||"",en=Tt||!Z||Z&&Z.length===1,ke=Ne(t);let Q;const tn=l=>{const[c,f=""]=r.isValueWithUnit(l.value)?r.split(l.value):[l.value];return{type:Ee.OPTION,inline:!0,onClick:()=>{r.validateNumber(c).valid&&!n&&(oe(b.PREDEFINED),se({target:{value:l.value,name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||"",predefinedSelected:!0,predefinedOption:l}}))},label:e.jsxs(e.Fragment,{children:[e.jsx(cn,{children:l.label}),e.jsx(S,{width:"20px",height:"0"})]}),description:r.isValueWithUnit(l.value)?`${c} ${f}`:l.value,selected:D===l&&k===b.PREDEFINED}};if(Q=[{type:Ee.OPTION,inline:!0,onClick:()=>{k!==b.CUSTOM&&!n&&se({target:{value:r.withUnit(v.value,v.unit),name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||""}})},label:"Custom",selected:k===b.CUSTOM}],x!=null&&x.length){const l=x.map(tn);Q=[...Q,...l]}return e.jsx("div",{className:k===b.PREDEFINED?sn(In.predefinedMenuActive):"",children:e.jsxs(dn,{small:s,width:g,children:[x&&e.jsx(on,{text:k===b.PREDEFINED?D==null?void 0:D.label:"",children:e.jsx(we,{maxHeight:380,groupOrder:"first",testId:w&&`${w}-predefined-menu`,disabled:n,menu:{colored:!0,trigger:"Component",component:e.jsx(m,{groupOrder:"first",active:k===b.PREDEFINED,icon:k===b.PREDEFINED?"link":"unlink"}),small:s,sections:Q}})}),e.jsx(mn,{type:"text",name:ke,testId:w,disabled:n,placeholder:de?F(V,v.unit,xe,A):a,value:v.value,onChange:Qt,onFocus:Lt,error:u||Zt,warning:Kt,right:!d},ke),G&&(en||!zt?e.jsx(un,{groupOrder:"last",children:G}):e.jsx(we,{maxHeight:380,groupOrder:"last",disabled:i,testId:w&&`${w}-menu`,menu:{label:G,trigger:"DropDownButton",small:s,sections:Z.map(([l,c,f])=>{const y=f||c||"";return{type:"Option",label:isNaN(Number(l))?"":l,inline:!0,onClick:X=>{X.stopPropagation(),Xt(de?"":l,c)},description:y,selected:y===G,testId:`${w}-unit-${y}`}})}}))]})})};try{p.displayName="UnitInput",p.__docgenInfo={description:"",displayName:"UnitInput",props:{name:{defaultValue:null,description:"",name:"name",required:!0,type:{name:"string | { fieldName?: string | undefined; }"}},placeholder:{defaultValue:{value:""},description:"",name:"placeholder",required:!1,type:{name:"string"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},disabledUnit:{defaultValue:{value:"false"},description:"",name:"disabledUnit",required:!1,type:{name:"boolean"}},error:{defaultValue:{value:"null"},description:"",name:"error",required:!1,type:{name:"string | boolean | null"}},left:{defaultValue:{value:"false"},description:"",name:"left",required:!1,type:{name:"boolean"}},small:{defaultValue:{value:"false"},description:"",name:"small",required:!1,type:{name:"boolean"}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string | number"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"string"}},unitkey:{defaultValue:{value:""},description:"",name:"unitkey",required:!1,type:{name:"string"}},initUnit:{defaultValue:null,description:"",name:"initUnit",required:!1,type:{name:"string"}},noConversion:{defaultValue:{value:"false"},description:"",name:"noConversion",required:!1,type:{name:"boolean"}},doNotConvertValue:{defaultValue:{value:"false"},description:"",name:"doNotConvertValue",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}},warning:{defaultValue:{value:"null"},description:"",name:"warning",required:!1,type:{name:"string | null"}},predefinedOptions:{defaultValue:null,description:"",name:"predefinedOptions",required:!1,type:{name:"IPredefinedOption[]"}},initialPredefinedOption:{defaultValue:{value:"false"},description:"",name:"initialPredefinedOption",required:!1,type:{name:"boolean"}},shouldLinkAutomaticly:{defaultValue:{value:"true"},description:"",name:"shouldLinkAutomaticly",required:!1,type:{name:"boolean"}},selectedPredefinedOptionKey:{defaultValue:null,description:"",name:"selectedPredefinedOptionKey",required:!1,type:{name:"string"}},validationCallback:{defaultValue:{value:"() => ({ name: '', error: null })"},description:"",name:"validationCallback",required:!1,type:{name:"((name: string, message: string | null) => { name: string; error: string | null; })"}},disabledValidation:{defaultValue:{value:"false"},description:"",name:"disabledValidation",required:!1,type:{name:"boolean"}},allowEmpty:{defaultValue:{value:"false"},description:"",name:"allowEmpty",required:!1,type:{name:"boolean"}},autoValue:{defaultValue:null,description:"",name:"autoValue",required:!1,type:{name:"string"}},onChange:{defaultValue:{value:"() => {}"},description:"",name:"onChange",required:!1,type:{name:"(event: ChangeEvent<HTMLInputElement> | ICustomChangeEvent) => void"}},onSwitchUnit:{defaultValue:{value:"() => {}"},description:"",name:"onSwitchUnit",required:!1,type:{name:"((unit: string) => void)"}},onClick:{defaultValue:{value:"() => {}"},description:"",name:"onClick",required:!1,type:{name:"MouseEventHandler<HTMLInputElement>"}},onFocus:{defaultValue:{value:"() => {}"},description:"",name:"onFocus",required:!1,type:{name:"FocusEventHandler<HTMLInputElement>"}},unitTemplate:{defaultValue:null,description:"",name:"unitTemplate",required:!1,type:{name:"Record<string, any>"}}}}}catch{}const{useArgs:jn}=__STORYBOOK_MODULE_ADDONS__,ra={title:"Basic/UnitInput",component:p,args:{name:"example",unitkey:"length",value:"123|m"}},C=t=>{const[a,n]=jn(),i=u=>{n({value:u.target.value})};return e.jsx(p,{...t,onChange:i})},ee=C.bind({}),M=C.bind({});M.args={initUnit:"ft",unitTemplate:{length:"ft"}};const _=C.bind({});_.args={value:'123|"',unitkey:'"'};const O=C.bind({});O.args={width:"180px"};const B=C.bind({});B.args={noConversion:!0};const q=C.bind({});q.args={small:!0};const W=C.bind({});W.args={error:"Error message goes here"};const R=C.bind({});R.args={value:"asas123asd|%"};const N=C.bind({});N.args={disabled:!0,disabledUnit:!0};N.parameters={docs:{description:{story:"Each part of UnitInput can be disabled separately. `disabled` disables only the main text input, `disabledUnit` disables only the unit menu. **Needs review (comes from Reservoir input requirements)**"}}};const T=C.bind({});T.args={disabled:!0,disabledUnit:!0,noConversion:!0};const L=C.bind({});L.args={disabledUnit:!0,unitkey:void 0};const K=C.bind({});K.args={disabledUnit:!0,unitkey:"length"};const $=C.bind({});$.args={disabledUnit:!1,disabled:!0};const H=t=>{const[a,n]=o.useState("123|m"),[i,u]=o.useState("223|m"),[d,s]=o.useState("ft");return e.jsxs(e.Fragment,{children:[e.jsx(m,{label:"Change initUnit",onClick:()=>s(d==="m"?"ft":"m")}),e.jsx(S,{}),e.jsx(m,{label:"Change value",onClick:()=>n(a==="123|m"?"456|m":"123|m")}),e.jsx(S,{}),e.jsx(p,{name:"example",onChange:g=>{n(g.target.value)},unitkey:"length",value:a,initUnit:d,onSwitchUnit:s}),e.jsx(S,{}),e.jsx(p,{name:"example2",onChange:g=>{u(g.target.value)},unitkey:"length",value:i,initUnit:d,onSwitchUnit:s}),e.jsx(pn,{}),e.jsx("h4",{children:"Without initUnit property (taken from the redux store)"}),e.jsx(p,{name:"example",onChange:g=>{n(g.target.value)},unitkey:"length",value:a,onSwitchUnit:s}),e.jsx(p,{name:"example2",onChange:g=>{u(g.target.value)},unitkey:"length",value:i,onSwitchUnit:s})]})};H.parameters={docs:{description:{story:"[OW-4380](https://oliasoft.atlassian.net/browse/OW-4380?atlOrigin=eyJpIjoiMmM1N2RkNWU3Mjk5NDYxY2E0YzhkMzk5ZTVmZTJhMjciLCJwIjoiaiJ9)"}}};const z=C.bind({});z.args={predefinedOptions:[{label:"bottom of casing",value:"12|km"},{label:"mud weight at shoe depth",value:"8|mm"}]};const J=()=>{const t="500px",[a,n]=o.useState(void 0);return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different edge cases such as +/- infinity, undefined, NaN, null:"}),e.jsxs(qt,{children:[e.jsxs(pe,{width:"25%",children:[e.jsx(m,{label:"Change value infinity",onClick:()=>n(1/0)}),e.jsx("br",{}),e.jsx(m,{label:"Change value -infinity",onClick:()=>n(-1/0)}),e.jsx("br",{}),e.jsx(m,{label:"Change value null",onClick:()=>n(null)}),e.jsx("br",{}),e.jsx(m,{label:"Change value - undefined",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(m,{label:"Change value - NaN",onClick:()=>n(NaN)}),e.jsx("br",{}),e.jsx(m,{label:"Change value - nothing (empty)",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(m,{label:"Change value - empty string",onClick:()=>n("")})]}),e.jsxs(pe,{width:"25%",children:[e.jsx(m,{label:"Change value infinity|m",onClick:()=>n("Infinity|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value -infinity|m",onClick:()=>n("-Infinity|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value null|m",onClick:()=>n(null+"|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value - undefined|m",onClick:()=>n(void 0+"|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value - NaN|m",onClick:()=>n("NaN|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value - nothing (empty)|m",onClick:()=>n("|m")})]})]}),e.jsx("br",{}),e.jsx(I,{label:"Normal PUI",children:e.jsx(p,{name:"example1",onChange:i=>n(i.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit"})}),e.jsx(I,{label:"Disabled validation",children:e.jsx(p,{name:"example2",onChange:i=>n(i.target.value),value:a,unitkey:"length",disabledValidation:!0,width:t})}),e.jsx(I,{label:"Disabled validation and manual error",children:e.jsx(p,{name:"example3",onChange:i=>n(i.target.value),value:a,unitkey:"length",error:"test",disabledValidation:!0,width:t})}),e.jsx(ge,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})},te=()=>{const t="500px",[a,n]=o.useState("1|m"),[i,u]=o.useState("|m"),d="123|km";return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different cases for automatic (placeholder) values:"}),e.jsx(qt,{children:e.jsxs(pe,{width:"25%",children:[e.jsx(m,{label:"Change value to ''",onClick:()=>n("")}),e.jsx("br",{}),e.jsx(m,{label:"Change value to 1",onClick:()=>n("1")}),e.jsx("br",{}),e.jsx(m,{label:"Change value to 1|m",onClick:()=>n("1|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value to |m - empty value",onClick:()=>n("|m")})]})}),e.jsx("br",{}),e.jsx(I,{label:"Normal PUI (placeholder + auto)",children:e.jsx(p,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit",autoValue:d})}),e.jsx(I,{label:"Normal PUI (only auto)",children:e.jsx(p,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,autoValue:d})}),e.jsx(I,{label:"Empty PUI with autoValue",children:e.jsx(p,{name:"example1",onChange:s=>u(s.target.value),value:i,unitkey:"length",width:t,autoValue:d})}),e.jsx(I,{label:"Normal PUI (only placeholder)",children:e.jsx(p,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test"})}),e.jsx(I,{label:"Normal PUI (placeholder + allowEmpty)",children:e.jsx(p,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test",allowEmpty:!0})}),e.jsx(ge,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})};J.parameters={docs:{description:{story:"[OW-8884](https://oliasoft.atlassian.net/browse/OW-8884)"}}};const ne=()=>{const[t,a]=o.useState("123|%"),[n,i]=o.useState(null),u="This should be visible when an error appears",d=(s,g)=>(i(g),{name:s,error:g});return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"3rd party validation message when inputting invalid value:"}),e.jsx(p,{name:"example",onChange:s=>a(s.target.value),error:!n||u,validationCallback:d,value:t}),e.jsx("br",{}),e.jsx(S,{}),e.jsx("h4",{children:"Original validation message: "}),e.jsx(ge,{message:{heading:n,visible:!0}})]})},ae=()=>{const[t,a]=o.useState("123|m"),[n,i]=o.useState(""),[u,d]=o.useState("km"),s=()=>{d("ft"),i("placeholder"),a("|m")};return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Empty value case:"}),e.jsx(p,{name:"example",onChange:g=>a(g.target.value),value:t,allowEmpty:!0,placeholder:n,initUnit:u,unitkey:"length"}),e.jsx("br",{}),e.jsx(S,{}),e.jsx(m,{label:"Change value |m and unit ft",onClick:()=>s()})]})},le=()=>{const[t,a]=o.useState("123|m"),[n,i]=o.useState("m");return e.jsxs(e.Fragment,{children:[e.jsx(p,{name:"example",onChange:u=>a(u.target.value),value:t,initUnit:n,unitkey:"length",onSwitchUnit:i}),e.jsx(S,{}),e.jsx(p,{name:"example",onChange:u=>a(u.target.value),value:t,initUnit:n,unitkey:"length",onSwitchUnit:i})]})};var De,Fe,Me;ee.parameters={...ee.parameters,docs:{...(De=ee.parameters)==null?void 0:De.docs,source:{originalSource:`args => {
1
+ import{j as e}from"./jsx-runtime-f961835c.js";import{r as o}from"./index-f80c8c95.js";import{d as r,r as rn}from"./index-57d7693e.js";import{c as sn}from"./index-a80ed1cf.js";import{M as we}from"./actions-2d4e1c8e.js";import{I as un}from"./input-group-addon-f8f6683a.js";import{B as m}from"./button-74c97e4a.js";import{T as on}from"./tooltip-23e84186.js";import{I as dn}from"./input-group-20c3add3.js";import{S}from"./spacer-54db0620.js";import{T as cn}from"./text-ad1f5f1d.js";import{I as mn}from"./input-d68625a5.js";import{M as Ee}from"./types-cc224262.js";import{l as E}from"./lodash-75c70a11.js";import{D as pn}from"./divider-182aa58c.js";import{R as qt,C as pe}from"./row-2299f0e7.js";import{F as I}from"./field-a094cd72.js";import{a as ge}from"./message-7e627e60.js";import"./index-54f0d271.js";import"./common-types-2c81813f.js";import"./disabled-context-d654f6ff.js";import"./icon-e9cbb4d7.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./spinner-a81ebe38.js";import"./index-3d476d02.js";import"./styled-components.browser.esm-416d73e5.js";import"./label-13d490a3.js";import"./help-icon-d4189b1b.js";const gn=()=>{const t=o.useRef(null);return o.useLayoutEffect(()=>{t.current&&(t.current(),t.current=null)}),n=>{t.current=n}},hn=t=>{const a=o.useRef();return o.useEffect(()=>{a.current=t},[t]),a.current},vn=(t,a)=>{const n=a==null?void 0:a[t];return n||(console.log(`Warning: 'unitTemplate' does not define a preferred unit for '${t}'. Defaulting to standard unit.`),r.unitFromQuantity(t)??"")};var b=(t=>(t.CUSTOM="custom",t.PREDEFINED="predefined",t))(b||{});const Wt=t=>t==="undefined"||t===void 0||t===""||t==="null"||t===null||t==="NaN"||isNaN(t),Rt=(t="",a,n="",i=!1)=>{if(i)return t;if(a&&!Wt(t))try{const u=r.isValueWithUnit(t)?t:r.withUnit(t,n),d=r.convertSamePrecision(u,a);return r.getValue(d)}catch{}return t},fn=t=>t?!!r.getUnit(t):!1,F=(t="",a,n,i)=>{if(i)return t;const u=fn(t)||r.isValueWithUnit(t),d=r.getValue(t);return Wt(d)?d:u?Rt(d,a,n,i):t},Ne=t=>E.isObject(t)&&!E.isArray(t)&&!E.isFunction(t)?E.get(t,"fieldName",""):typeof t=="string"?t:"",Cn=t=>E.isObjectLike(t)&&E.has(t,"message"),bn=t=>typeof t=="string"?t:Cn(t)?t.message:null;var Un=rn();const yn=t=>t.search(RegExp(/(^0{2}\.)|(^0+[1-9])/g))===0,Ae=(t,a)=>{var j;const{allowEmpty:n=!1,autoValue:i,placeholder:u,disabledValidation:d=!1}=a||{},s=String(t);if(d||i||u)return null;const g=Un.isValueWithUnit(s)?r.getValue(s):s;if(n&&g==="")return null;if(yn(g))return"Invalid number format due to leading zeroes";const h=r.validateNumber(g);if(!h.valid){const re=((j=h==null?void 0:h.errors)==null?void 0:j[0])??null;return bn(re)}return null},Pe=(t="")=>{var a;return(a=r.KNOWN_UNITS)==null?void 0:a.includes(t)},xn=(t,a)=>{const n=r.getUnit(t||"");return Pe(a)&&Pe(n)},Vn="_predefinedMenuActive_1yvt4_1",In={predefinedMenuActive:Vn},p=({name:t,placeholder:a="",disabled:n=!1,disabledUnit:i=!1,error:u=null,left:d=!1,small:s=!1,width:g="100%",value:h,unitkey:j="",initUnit:re,noConversion:Tt=!1,onChange:se=()=>{},onClick:kn=()=>{},onFocus:Lt=()=>{},onSwitchUnit:he=()=>{},unitTemplate:ve,doNotConvertValue:A=!1,testId:w,warning:Kt=null,predefinedOptions:x,initialPredefinedOption:$t=!1,shouldLinkAutomaticly:fe=!0,selectedPredefinedOptionKey:Ce,validationCallback:be=()=>({name:"",error:null}),disabledValidation:Ue=!1,allowEmpty:ye=!1,autoValue:V})=>{typeof h=="number"&&(h=`${h}`);const Ht=gn(),[ie="",P=""]=h!==void 0?r.split(h):[],xe=V?r.getUnit(V):"",Ve=o.useMemo(()=>vn(j,ve),[j,ve]),zt=xn(h,Ve),U=re||Ve||P,Jt=hn(U),Ie=F(h,U,P,A),je=F(V,U,xe,A),Yt=Ie!==""?{value:Ie,unit:U}:je!==""?{value:je,unit:U}:{value:ie,unit:P},[v,Y]=o.useState(Yt),[Zt,ue]=o.useState(null),[k,oe]=o.useState($t?b.PREDEFINED:b.CUSTOM),de=ie===""&&V,D=x&&x.find(l=>{if(Ce)return Ce===l.valueKey;const c=r.isValueWithUnit(l.value)?r.getUnit(l.value):"";return r.withUnit(Rt(h,c),c)===l.value}),Gt=()=>{if(j)try{const l=de?V:h??"";let c=r.altUnitsList(l,j);return r.getValue(l)===""?c.map(f=>["",f[1]]):c}catch{return null}},Qt=l=>{const c=Ne(t),f=l.target,{value:y,selectionStart:X}=f,Se=r.cleanNumStr(y.replaceAll(" ","").replaceAll("|","")),ce=r.withUnit(Se,(v==null?void 0:v.unit)||""),nn=r.getValue(ce),me=Ae(nn,{allowEmpty:ye,autoValue:V,placeholder:a,disabledValidation:Ue});if(me===null){se({target:{value:ce,name:c}});const[an,ln]=r.split(ce);Y({value:an,unit:ln}),ue(null),be(c,null)}else Y({value:Se,unit:v.unit}),ue(me),be(c,me);Ht(()=>{f.selectionStart=X,f.selectionEnd=X})},Xt=(l,c)=>{c===v.unit||isNaN(Number(l))||(Y({value:l,unit:c}),he&&he(c))};o.useEffect(()=>{if(U){let f,y="";Jt!==U?(f=F(h,U,P,A),y=U):r.withUnit(v.value,v.unit)!==h&&(f=F(h,v.unit,P,A),y=v.unit),f!==void 0&&Y({value:f,unit:y}),x&&oe(D&&fe?b.PREDEFINED:b.CUSTOM)}const l=r.checkAndCleanDecimalComma(ie),c=Ae(l,{allowEmpty:ye,autoValue:V,placeholder:a,disabledValidation:Ue});ue(c)},[U,h,u,fe]);const Z=Gt(),G=r.label(v.unit)||v.unit||"",en=Tt||!Z||Z&&Z.length===1,ke=Ne(t);let Q;const tn=l=>{const[c,f=""]=r.isValueWithUnit(l.value)?r.split(l.value):[l.value];return{type:Ee.OPTION,inline:!0,onClick:()=>{r.validateNumber(c).valid&&!n&&(oe(b.PREDEFINED),se({target:{value:l.value,name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||"",predefinedSelected:!0,predefinedOption:l}}))},label:e.jsxs(e.Fragment,{children:[e.jsx(cn,{children:l.label}),e.jsx(S,{width:"20px",height:"0"})]}),description:r.isValueWithUnit(l.value)?`${c} ${f}`:l.value,selected:D===l&&k===b.PREDEFINED}};if(Q=[{type:Ee.OPTION,inline:!0,onClick:()=>{k!==b.CUSTOM&&!n&&se({target:{value:r.withUnit(v.value,v.unit),name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||""}})},label:"Custom",selected:k===b.CUSTOM}],x!=null&&x.length){const l=x.map(tn);Q=[...Q,...l]}return e.jsx("div",{className:k===b.PREDEFINED?sn(In.predefinedMenuActive):"",children:e.jsxs(dn,{small:s,width:g,children:[x&&e.jsx(on,{text:k===b.PREDEFINED?D==null?void 0:D.label:"",children:e.jsx(we,{maxHeight:380,groupOrder:"first",testId:w&&`${w}-predefined-menu`,disabled:n,menu:{colored:!0,trigger:"Component",component:e.jsx(m,{groupOrder:"first",active:k===b.PREDEFINED,icon:k===b.PREDEFINED?"link":"unlink"}),small:s,sections:Q}})}),e.jsx(mn,{type:"text",name:ke,testId:w,disabled:n,placeholder:de?F(V,v.unit,xe,A):a,value:v.value,onChange:Qt,onFocus:Lt,error:u||Zt,warning:Kt,right:!d},ke),G&&(en||!zt?e.jsx(un,{groupOrder:"last",children:G}):e.jsx(we,{maxHeight:380,groupOrder:"last",disabled:i,testId:w&&`${w}-menu`,menu:{label:G,trigger:"DropDownButton",small:s,sections:Z.map(([l,c,f])=>{const y=f||c||"";return{type:"Option",label:isNaN(Number(l))?"":l,inline:!0,onClick:X=>{X.stopPropagation(),Xt(de?"":l,c)},description:y,selected:y===G,testId:`${w}-unit-${y}`}})}}))]})})};try{p.displayName="UnitInput",p.__docgenInfo={description:"",displayName:"UnitInput",props:{name:{defaultValue:null,description:"",name:"name",required:!0,type:{name:"string | { fieldName?: string | undefined; }"}},placeholder:{defaultValue:{value:""},description:"",name:"placeholder",required:!1,type:{name:"string"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},disabledUnit:{defaultValue:{value:"false"},description:"",name:"disabledUnit",required:!1,type:{name:"boolean"}},error:{defaultValue:{value:"null"},description:"",name:"error",required:!1,type:{name:"string | boolean | null"}},left:{defaultValue:{value:"false"},description:"",name:"left",required:!1,type:{name:"boolean"}},small:{defaultValue:{value:"false"},description:"",name:"small",required:!1,type:{name:"boolean"}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string | number"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"string"}},unitkey:{defaultValue:{value:""},description:"",name:"unitkey",required:!1,type:{name:"string"}},initUnit:{defaultValue:null,description:"",name:"initUnit",required:!1,type:{name:"string"}},noConversion:{defaultValue:{value:"false"},description:"",name:"noConversion",required:!1,type:{name:"boolean"}},doNotConvertValue:{defaultValue:{value:"false"},description:"",name:"doNotConvertValue",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}},warning:{defaultValue:{value:"null"},description:"",name:"warning",required:!1,type:{name:"string | null"}},predefinedOptions:{defaultValue:null,description:"",name:"predefinedOptions",required:!1,type:{name:"IPredefinedOption[]"}},initialPredefinedOption:{defaultValue:{value:"false"},description:"",name:"initialPredefinedOption",required:!1,type:{name:"boolean"}},shouldLinkAutomaticly:{defaultValue:{value:"true"},description:"",name:"shouldLinkAutomaticly",required:!1,type:{name:"boolean"}},selectedPredefinedOptionKey:{defaultValue:null,description:"",name:"selectedPredefinedOptionKey",required:!1,type:{name:"string"}},validationCallback:{defaultValue:{value:"() => ({ name: '', error: null })"},description:"",name:"validationCallback",required:!1,type:{name:"((name: string, message: string | null) => { name: string; error: string | null; })"}},disabledValidation:{defaultValue:{value:"false"},description:"",name:"disabledValidation",required:!1,type:{name:"boolean"}},allowEmpty:{defaultValue:{value:"false"},description:"",name:"allowEmpty",required:!1,type:{name:"boolean"}},autoValue:{defaultValue:null,description:"",name:"autoValue",required:!1,type:{name:"string"}},onChange:{defaultValue:{value:"() => {}"},description:"",name:"onChange",required:!1,type:{name:"(event: ChangeEvent<HTMLInputElement> | ICustomChangeEvent) => void"}},onSwitchUnit:{defaultValue:{value:"() => {}"},description:"",name:"onSwitchUnit",required:!1,type:{name:"((unit: string) => void)"}},onClick:{defaultValue:{value:"() => {}"},description:"",name:"onClick",required:!1,type:{name:"MouseEventHandler<HTMLInputElement>"}},onFocus:{defaultValue:{value:"() => {}"},description:"",name:"onFocus",required:!1,type:{name:"FocusEventHandler<HTMLInputElement>"}},unitTemplate:{defaultValue:null,description:"",name:"unitTemplate",required:!1,type:{name:"Record<string, any>"}}}}}catch{}const{useArgs:jn}=__STORYBOOK_MODULE_ADDONS__,ra={title:"Basic/UnitInput",component:p,args:{name:"example",unitkey:"length",value:"123|m"}},C=t=>{const[a,n]=jn(),i=u=>{n({value:u.target.value})};return e.jsx(p,{...t,onChange:i})},ee=C.bind({}),M=C.bind({});M.args={initUnit:"ft",unitTemplate:{length:"ft"}};const _=C.bind({});_.args={value:'123|"',unitkey:'"'};const O=C.bind({});O.args={width:"180px"};const B=C.bind({});B.args={noConversion:!0};const q=C.bind({});q.args={small:!0};const W=C.bind({});W.args={error:"Error message goes here"};const R=C.bind({});R.args={value:"asas123asd|%"};const N=C.bind({});N.args={disabled:!0,disabledUnit:!0};N.parameters={docs:{description:{story:"Each part of UnitInput can be disabled separately. `disabled` disables only the main text input, `disabledUnit` disables only the unit menu. **Needs review (comes from Reservoir input requirements)**"}}};const T=C.bind({});T.args={disabled:!0,disabledUnit:!0,noConversion:!0};const L=C.bind({});L.args={disabledUnit:!0,unitkey:void 0};const K=C.bind({});K.args={disabledUnit:!0,unitkey:"length"};const $=C.bind({});$.args={disabledUnit:!1,disabled:!0};const H=t=>{const[a,n]=o.useState("123|m"),[i,u]=o.useState("223|m"),[d,s]=o.useState("ft");return e.jsxs(e.Fragment,{children:[e.jsx(m,{label:"Change initUnit",onClick:()=>s(d==="m"?"ft":"m")}),e.jsx(S,{}),e.jsx(m,{label:"Change value",onClick:()=>n(a==="123|m"?"456|m":"123|m")}),e.jsx(S,{}),e.jsx(p,{name:"example",onChange:g=>{n(g.target.value)},unitkey:"length",value:a,initUnit:d,onSwitchUnit:s}),e.jsx(S,{}),e.jsx(p,{name:"example2",onChange:g=>{u(g.target.value)},unitkey:"length",value:i,initUnit:d,onSwitchUnit:s}),e.jsx(pn,{}),e.jsx("h4",{children:"Without initUnit property (taken from the redux store)"}),e.jsx(p,{name:"example",onChange:g=>{n(g.target.value)},unitkey:"length",value:a,onSwitchUnit:s}),e.jsx(p,{name:"example2",onChange:g=>{u(g.target.value)},unitkey:"length",value:i,onSwitchUnit:s})]})};H.parameters={docs:{description:{story:"[OW-4380](https://oliasoft.atlassian.net/browse/OW-4380?atlOrigin=eyJpIjoiMmM1N2RkNWU3Mjk5NDYxY2E0YzhkMzk5ZTVmZTJhMjciLCJwIjoiaiJ9)"}}};const z=C.bind({});z.args={predefinedOptions:[{label:"bottom of casing",value:"12|km"},{label:"mud weight at shoe depth",value:"8|mm"}]};const J=()=>{const t="500px",[a,n]=o.useState(void 0);return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different edge cases such as +/- infinity, undefined, NaN, null:"}),e.jsxs(qt,{children:[e.jsxs(pe,{width:"25%",children:[e.jsx(m,{label:"Change value infinity",onClick:()=>n(1/0)}),e.jsx("br",{}),e.jsx(m,{label:"Change value -infinity",onClick:()=>n(-1/0)}),e.jsx("br",{}),e.jsx(m,{label:"Change value null",onClick:()=>n(null)}),e.jsx("br",{}),e.jsx(m,{label:"Change value - undefined",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(m,{label:"Change value - NaN",onClick:()=>n(NaN)}),e.jsx("br",{}),e.jsx(m,{label:"Change value - nothing (empty)",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(m,{label:"Change value - empty string",onClick:()=>n("")})]}),e.jsxs(pe,{width:"25%",children:[e.jsx(m,{label:"Change value infinity|m",onClick:()=>n("Infinity|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value -infinity|m",onClick:()=>n("-Infinity|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value null|m",onClick:()=>n(null+"|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value - undefined|m",onClick:()=>n(void 0+"|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value - NaN|m",onClick:()=>n("NaN|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value - nothing (empty)|m",onClick:()=>n("|m")})]})]}),e.jsx("br",{}),e.jsx(I,{label:"Normal PUI",children:e.jsx(p,{name:"example1",onChange:i=>n(i.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit"})}),e.jsx(I,{label:"Disabled validation",children:e.jsx(p,{name:"example2",onChange:i=>n(i.target.value),value:a,unitkey:"length",disabledValidation:!0,width:t})}),e.jsx(I,{label:"Disabled validation and manual error",children:e.jsx(p,{name:"example3",onChange:i=>n(i.target.value),value:a,unitkey:"length",error:"test",disabledValidation:!0,width:t})}),e.jsx(ge,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})},te=()=>{const t="500px",[a,n]=o.useState("1|m"),[i,u]=o.useState("|m"),d="123|km";return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different cases for automatic (placeholder) values:"}),e.jsx(qt,{children:e.jsxs(pe,{width:"25%",children:[e.jsx(m,{label:"Change value to ''",onClick:()=>n("")}),e.jsx("br",{}),e.jsx(m,{label:"Change value to 1",onClick:()=>n("1")}),e.jsx("br",{}),e.jsx(m,{label:"Change value to 1|m",onClick:()=>n("1|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value to |m - empty value",onClick:()=>n("|m")})]})}),e.jsx("br",{}),e.jsx(I,{label:"Normal PUI (placeholder + auto)",children:e.jsx(p,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit",autoValue:d})}),e.jsx(I,{label:"Normal PUI (only auto)",children:e.jsx(p,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,autoValue:d})}),e.jsx(I,{label:"Empty PUI with autoValue",children:e.jsx(p,{name:"example1",onChange:s=>u(s.target.value),value:i,unitkey:"length",width:t,autoValue:d})}),e.jsx(I,{label:"Normal PUI (only placeholder)",children:e.jsx(p,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test"})}),e.jsx(I,{label:"Normal PUI (placeholder + allowEmpty)",children:e.jsx(p,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test",allowEmpty:!0})}),e.jsx(ge,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})};J.parameters={docs:{description:{story:"[OW-8884](https://oliasoft.atlassian.net/browse/OW-8884)"}}};const ne=()=>{const[t,a]=o.useState("123|%"),[n,i]=o.useState(null),u="This should be visible when an error appears",d=(s,g)=>(i(g),{name:s,error:g});return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"3rd party validation message when inputting invalid value:"}),e.jsx(p,{name:"example",onChange:s=>a(s.target.value),error:!n||u,validationCallback:d,value:t}),e.jsx("br",{}),e.jsx(S,{}),e.jsx("h4",{children:"Original validation message: "}),e.jsx(ge,{message:{heading:n,visible:!0}})]})},ae=()=>{const[t,a]=o.useState("123|m"),[n,i]=o.useState(""),[u,d]=o.useState("km"),s=()=>{d("ft"),i("placeholder"),a("|m")};return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Empty value case:"}),e.jsx(p,{name:"example",onChange:g=>a(g.target.value),value:t,allowEmpty:!0,placeholder:n,initUnit:u,unitkey:"length"}),e.jsx("br",{}),e.jsx(S,{}),e.jsx(m,{label:"Change value |m and unit ft",onClick:()=>s()})]})},le=()=>{const[t,a]=o.useState("123|m"),[n,i]=o.useState("m");return e.jsxs(e.Fragment,{children:[e.jsx(p,{name:"example",onChange:u=>a(u.target.value),value:t,initUnit:n,unitkey:"length",onSwitchUnit:i}),e.jsx(S,{}),e.jsx(p,{name:"example",onChange:u=>a(u.target.value),value:t,initUnit:n,unitkey:"length",onSwitchUnit:i})]})};var De,Fe,Me;ee.parameters={...ee.parameters,docs:{...(De=ee.parameters)==null?void 0:De.docs,source:{originalSource:`args => {
2
2
  const [_, updateArgs] = useArgs();
3
3
  const handleChange = (evt: any) => {
4
4
  updateArgs({
@@ -357,7 +357,7 @@
357
357
  }
358
358
  </script>
359
359
 
360
- <script type="module" crossorigin src="./assets/iframe-b1d7d28b.js"></script>
360
+ <script type="module" crossorigin src="./assets/iframe-eb834e80.js"></script>
361
361
  </head>
362
362
 
363
363
  <body>
@@ -1 +1 @@
1
- {"generatedAt":1709805119385,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"packageManager":{"type":"yarn","version":"1.22.19"},"features":{"storyStoreV7":true},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","storybookVersion":"7.5.3","storybookVersionSpecifier":"^7.5.3","language":"typescript","storybookPackages":{"@storybook/addon-essentials":{"version":"7.5.3"},"@storybook/addon-links":{"version":"7.5.3"},"@storybook/addons":{"version":"7.5.3"},"@storybook/react":{"version":"7.5.3"},"@storybook/react-vite":{"version":"7.5.3"},"eslint-plugin-storybook":{"version":"0.6.15"},"storybook":{"version":"7.5.3"}},"addons":{"@storybook/addon-actions":{"version":"7.5.3"},"@storybook/addon-docs":{"version":"7.5.3"},"storybook-dark-mode":{"version":"3.0.3"}}}
1
+ {"generatedAt":1709905052857,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"packageManager":{"type":"yarn","version":"1.22.19"},"features":{"storyStoreV7":true},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","storybookVersion":"7.5.3","storybookVersionSpecifier":"^7.5.3","language":"typescript","storybookPackages":{"@storybook/addon-essentials":{"version":"7.5.3"},"@storybook/addon-links":{"version":"7.5.3"},"@storybook/addons":{"version":"7.5.3"},"@storybook/react":{"version":"7.5.3"},"@storybook/react-vite":{"version":"7.5.3"},"eslint-plugin-storybook":{"version":"0.6.15"},"storybook":{"version":"7.5.3"}},"addons":{"@storybook/addon-actions":{"version":"7.5.3"},"@storybook/addon-docs":{"version":"7.5.3"},"storybook-dark-mode":{"version":"3.0.3"}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "4.2.3",
3
+ "version": "4.2.4",
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 +0,0 @@
1
- import{j as r}from"./jsx-runtime-f961835c.js";import{r as l}from"./index-f80c8c95.js";import{c as L}from"./index-a80ed1cf.js";import{D as M}from"./disabled-context-d654f6ff.js";import{i}from"./types-332ceaf3.js";import{T as P}from"./tooltip-23e84186.js";const W="_inputInTable_jnwnh_1",D="_inputHover_jnwnh_13",J="_inputFocus_jnwnh_18",K="_inputError_jnwnh_25",X="_inputWarning_jnwnh_26",$="_inputDisabled_jnwnh_61",z="_hideScrollbars_jnwnh_67",B="_input_jnwnh_1",k="_isInTable_jnwnh_100",A="_small_jnwnh_124",G="_error_jnwnh_130",Q="_warning_jnwnh_147",U="_right_jnwnh_170",Y="_groupOrderFirst_jnwnh_173",Z="_groupOrderMiddle_jnwnh_174",ee="_groupOrderLast_jnwnh_175",n={inputInTable:W,inputHover:D,inputFocus:J,inputError:K,inputWarning:X,inputDisabled:$,hideScrollbars:z,input:B,isInTable:k,small:A,error:G,warning:Q,right:U,groupOrderFirst:Y,groupOrderMiddle:Z,groupOrderLast:ee},c=e=>`calc((${e} * 0.675em) + (2 * var(--padding-input-x)))`,m=l.forwardRef(({error:e=null,tooltip:a=null,isInTable:u,width:f=void 0,small:_=!1,onChange:g=()=>{},placeholder:h="",value:b="",onKeyPress:y=()=>{},onFocus:v=()=>{},onBlur:w=()=>{},onPaste:I=()=>{},name:V=void 0,type:q="text",tabIndex:j=0,disabled:x=!1,right:E=!1,warning:t=null,groupOrder:s=null,maxTooltipWidth:T=void 0,testId:O=void 0,size:o=null},C)=>{const[N,H]=l.useState(b),S=l.useContext(M),F=(()=>{if(s)switch(s){case"first":return n.groupOrderFirst;case"last":return n.groupOrderLast;default:return n.groupOrderMiddle}return""})(),d=f||(o?"auto":"100%"),R=p=>{H(p.target.value),g(p)};return r.jsx("div",{style:{width:d},className:F,children:r.jsx(P,{error:!!e,warning:!!t,text:a||e||t,enabled:a&&i(a)||e&&i(e)||t&&i(t)||!1,maxWidth:T,display:"block",placement:"bottom-center",children:r.jsx("input",{ref:C,type:q||"text",size:o||20,placeholder:h??"",value:N??"",onChange:R,onKeyPress:y,onFocus:v,onBlur:w,onPaste:I,name:V,tabIndex:j,autoComplete:"off",disabled:x||S,className:L(n.input,e?n.error:t?n.warning:"",E?n.right:"",_?n.small:"",u?n.isInTable:""),style:{width:d},"data-testid":O})})})});try{c.displayName="widthOfCharacters",c.__docgenInfo={description:"",displayName:"widthOfCharacters",props:{}}}catch{}try{m.displayName="Input",m.__docgenInfo={description:"",displayName:"Input",props:{error:{defaultValue:{value:"null"},description:"",name:"error",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},warning:{defaultValue:{value:"null"},description:"",name:"warning",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},tooltip:{defaultValue:{value:"null"},description:"",name:"tooltip",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},name:{defaultValue:{value:"undefined"},description:"",name:"name",required:!1,type:{name:"string"}},type:{defaultValue:{value:"text"},description:"",name:"type",required:!1,type:{name:"string"}},onChange:{defaultValue:{value:"() => {}"},description:"",name:"onChange",required:!1,type:{name:"ChangeEventHandler<HTMLInputElement>"}},onKeyPress:{defaultValue:{value:"() => {}"},description:"",name:"onKeyPress",required:!1,type:{name:"KeyboardEventHandler<HTMLInputElement>"}},onFocus:{defaultValue:{value:"() => {}"},description:"",name:"onFocus",required:!1,type:{name:"FocusEventHandler<HTMLInputElement>"}},onBlur:{defaultValue:{value:"() => {}"},description:"",name:"onBlur",required:!1,type:{name:"FocusEventHandler<HTMLInputElement>"}},onPaste:{defaultValue:{value:"() => {}"},description:"",name:"onPaste",required:!1,type:{name:"ClipboardEventHandler<HTMLInputElement>"}},small:{defaultValue:{value:"false"},description:"",name:"small",required:!1,type:{name:"boolean"}},placeholder:{defaultValue:{value:""},description:"",name:"placeholder",required:!1,type:{name:"string | null"}},tabIndex:{defaultValue:{value:"0"},description:"",name:"tabIndex",required:!1,type:{name:"number"}},value:{defaultValue:{value:""},description:"",name:"value",required:!1,type:{name:"TStringNumberNull"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},right:{defaultValue:{value:"false"},description:"",name:"right",required:!1,type:{name:"boolean"}},groupOrder:{defaultValue:{value:"null"},description:"",name:"groupOrder",required:!1,type:{name:"string"}},maxTooltipWidth:{defaultValue:{value:"undefined"},description:"",name:"maxTooltipWidth",required:!1,type:{name:"TStringOrNumber"}},width:{defaultValue:null,description:"",name:"width",required:!1,type:{name:"TStringOrNumber"}},testId:{defaultValue:{value:"undefined"},description:"",name:"testId",required:!1,type:{name:"string"}},size:{defaultValue:{value:"null"},description:"",name:"size",required:!1,type:{name:"number"}},isInTable:{defaultValue:null,description:"",name:"isInTable",required:!1,type:{name:"boolean"}}}}}catch{}export{m as I};
@@ -1 +0,0 @@
1
- import{_ as e}from"./iframe-b1d7d28b.js";import"../sb-preview/runtime.js";var a={docs:{renderer:async()=>{let{DocsRenderer:r}=await e(()=>import("./DocsRenderer-NNNQARDV-5cca9a05.js"),["./DocsRenderer-NNNQARDV-5cca9a05.js","./chunk-HLWAVYOI-81c562b1.js","./iframe-b1d7d28b.js","./index-f80c8c95.js","./react-16-147b12fd.js","./index-3d476d02.js","./index-08c03c21.js","./inheritsLoose-d4851ab8.js","./assertThisInitialized-081f9914.js","./index-cf68f115.js"],import.meta.url);return new r}}};export{a as parameters};