@oliasoft-open-source/react-ui-library 4.0.0-beta-60 → 4.0.0-beta-61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{index-8aeda5d9.css → index-815d3e96.css} +130 -116
- package/dist/assets/{index-77d87326.js → index-bb4c3557.js} +78 -70
- package/dist/global.css +130 -116
- package/dist/index.html +1 -1
- package/dist/index.js +109 -92
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/{Color-6VNJS4EI-b650924c.js → Color-6VNJS4EI-b198135c.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-NNNQARDV-84fd372f.js → DocsRenderer-NNNQARDV-19e71c0e.js} +1 -1
- package/dist/storybook/assets/{WithTooltip-4HIR6TLV-dfbcd30e.js → WithTooltip-4HIR6TLV-2f83280b.js} +1 -1
- package/dist/storybook/assets/{accordion.stories-11c22ab5.js → accordion.stories-e1a1a1da.js} +1 -1
- package/dist/storybook/assets/{afe.stories-2bda4793.js → afe.stories-37c20b62.js} +1 -1
- package/dist/storybook/assets/{buttons-and-links-28cadbd3.js → buttons-and-links-82ee1d3d.js} +1 -1
- package/dist/storybook/assets/{casing-loads.stories-59db26a9.js → casing-loads.stories-07b8c5bf.js} +1 -1
- package/dist/storybook/assets/{cell.stories-7ebcbb82.js → cell.stories-0c3541a7.js} +1 -1
- package/dist/storybook/assets/check-box-73be452f.js +1 -0
- package/dist/storybook/assets/check-box-960c9b05.css +1 -0
- package/dist/storybook/assets/check-box.stories-73c79421.js +97 -0
- package/dist/storybook/assets/{chunk-HLWAVYOI-5ddd8c65.js → chunk-HLWAVYOI-3f2e7bdd.js} +1 -1
- package/dist/storybook/assets/{color-c9a5468c.js → color-338772bf.js} +1 -1
- package/dist/storybook/assets/{drawer.stories-fdef3d43.js → drawer.stories-4eeb77c2.js} +1 -1
- package/dist/storybook/assets/{footer.stories-c9d4f59e.js → footer.stories-8a474f57.js} +1 -1
- package/dist/storybook/assets/{form.stories-7b32c75b.js → form.stories-c6efa8b0.js} +1 -1
- package/dist/storybook/assets/{formation.stories-4536d334.js → formation.stories-b909ce02.js} +1 -1
- package/dist/storybook/assets/{formatter-SWP5E3XI-f1dc6120.js → formatter-SWP5E3XI-25bcba07.js} +1 -1
- package/dist/storybook/assets/grid-3b729f81.js +15 -0
- package/dist/storybook/assets/{grid.stories-9c914a43.js → grid.stories-bf68df4a.js} +1 -1
- package/dist/storybook/assets/{icon.stories-10514dcd.js → icon.stories-9a1cd92c.js} +1 -1
- package/dist/storybook/assets/{iframe-c85447e5.js → iframe-bc0fdebc.js} +1 -1
- package/dist/storybook/assets/{index-d70ff53b.js → index-c54905c0.js} +4 -4
- package/dist/storybook/assets/{input-validation-46150ca3.js → input-validation-7db01452.js} +1 -1
- package/dist/storybook/assets/{inputs-f50f972e.js → inputs-b9d1bfa6.js} +1 -1
- package/dist/storybook/assets/{layout-forms-2ff4582d.js → layout-forms-d1ce1a06.js} +1 -1
- package/dist/storybook/assets/{layout-general-22bbe03d.js → layout-general-97dba2ce.js} +1 -1
- package/dist/storybook/assets/{list-858d3a1f.js → list-5907161b.js} +1 -1
- package/dist/storybook/assets/list-heading-d81b63f6.css +1 -0
- package/dist/storybook/assets/list-heading-f1ceab8b.js +1 -0
- package/dist/storybook/assets/{list.stories-534b1266.js → list.stories-339e0e65.js} +1 -1
- package/dist/storybook/assets/{message.stories-50cd9843.js → message.stories-48adad88.js} +1 -1
- package/dist/storybook/assets/{number-input-863c4463.js → number-input-42f50494.js} +5 -5
- package/dist/storybook/assets/{number-input.stories-04f6469b.js → number-input.stories-b4db5a5c.js} +1 -1
- package/dist/storybook/assets/{option-dropdown.stories-b3566308.js → option-dropdown.stories-4d10db5b.js} +1 -1
- package/dist/storybook/assets/{padding-and-spacing-8f84561b.js → padding-and-spacing-a3a5213e.js} +1 -1
- package/dist/storybook/assets/{preview-8895bf64.js → preview-074d29f8.js} +1 -1
- package/dist/storybook/assets/preview-de19c997.js +1 -0
- package/dist/storybook/assets/{projects.stories-fb4cb900.js → projects.stories-a5ac5dbd.js} +1 -1
- package/dist/storybook/assets/radio-button-266c81ed.js +1 -0
- package/dist/storybook/assets/radio-button-52e2b7a7.css +1 -0
- package/dist/storybook/assets/radio-button.stories-d74ed901.js +61 -0
- package/dist/storybook/assets/{reservoirs.stories-134f21cc.js → reservoirs.stories-098985fb.js} +1 -1
- package/dist/storybook/assets/{row.stories-b0214b95.js → row.stories-566dbfdc.js} +1 -1
- package/dist/storybook/assets/{site.stories-3f58bf8f.js → site.stories-aa5eda50.js} +1 -1
- package/dist/storybook/assets/{syntaxhighlighter-NMPM6SWI-d8b407a1.js → syntaxhighlighter-NMPM6SWI-9c89c825.js} +1 -1
- package/dist/storybook/assets/{table-95ed9716.js → table-16e7479d.js} +1 -1
- package/dist/storybook/assets/{table.stories-3387ebf8.js → table.stories-af5f3080.js} +1 -1
- package/dist/storybook/assets/{title.stories-286cd48b.js → title.stories-c91929de.js} +1 -1
- package/dist/storybook/assets/{toggle-d9a0cd27.css → toggle-239108ba.css} +1 -1
- package/dist/storybook/assets/toggle-de8e437a.js +1 -0
- package/dist/storybook/assets/toggle.stories-05bf43ff.js +108 -0
- package/dist/storybook/assets/{tree.stories-304d9ff1.js → tree.stories-0521665b.js} +4 -4
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/stories.json +1 -1
- package/package.json +1 -1
- package/dist/storybook/assets/check-box-421e08ab.js +0 -1
- package/dist/storybook/assets/check-box-805d6047.css +0 -1
- package/dist/storybook/assets/check-box.stories-3e23f07e.js +0 -85
- package/dist/storybook/assets/grid-78d1b29a.js +0 -15
- package/dist/storybook/assets/list-heading-8544b8e3.css +0 -1
- package/dist/storybook/assets/list-heading-d8175bfc.js +0 -1
- package/dist/storybook/assets/preview-f0e36fec.js +0 -1
- package/dist/storybook/assets/radio-button-82505e3b.js +0 -1
- package/dist/storybook/assets/radio-button-bd9936b8.css +0 -1
- package/dist/storybook/assets/radio-button.stories-0cbfcabb.js +0 -51
- package/dist/storybook/assets/toggle-df90df5f.js +0 -1
- package/dist/storybook/assets/toggle.stories-107799ac.js +0 -96
package/dist/storybook/assets/{number-input.stories-04f6469b.js → number-input.stories-b4db5a5c.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as r}from"./jsx-runtime-f961835c.js";import{N as c}from"./number-input-
|
|
1
|
+
import{j as r}from"./jsx-runtime-f961835c.js";import{N as c}from"./number-input-42f50494.js";import{I as J}from"./input-group-20c3add3.js";import{I as P}from"./input-group-addon-f8f6683a.js";import{S as Q}from"./select-6b6d28f7.js";import"./index-f80c8c95.js";import"./index-54f0d271.js";import"./lodash-75c70a11.js";import"./input-d68625a5.js";import"./index-a80ed1cf.js";import"./disabled-context-d654f6ff.js";import"./types-332ceaf3.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./common-types-2c81813f.js";import"./index-c89a1915.js";import"./inheritsLoose-d4851ab8.js";import"./assertThisInitialized-081f9914.js";import"./memoize-one.esm-52518564.js";import"./types-cc224262.js";import"./text-ad1f5f1d.js";import"./actions-46447905.js";import"./button-e6a6c574.js";import"./spinner-cb92a546.js";import"./icon-c5e1f218.js";import"./tslib.es6-dfef685f.js";import"./badge-3abf067b.js";import"./select.input-88b6ebab.js";const{useArgs:V}=__STORYBOOK_MODULE_ADDONS__,Le={title:"Forms/NumberInput",component:c,parameters:{canvas:{page:null}},args:{label:"Label"}},e=Y=>{const[X,k]=V(),q=z=>{k({value:z.target.value})};return r.jsx(c,{onChange:q,value:123,...Y})},l=e.bind({}),a=e.bind({});a.args={small:!0};const n=e.bind({});n.args={width:"150px"};const t=e.bind({});t.args={left:!0};const s=e.bind({});s.args={disabled:!0};const u=e.bind({});u.args={allowEmpty:!0,value:""};const o=e.bind({});o.args={warning:"This input number is almost 100!",value:"99"};const p=e.bind({});p.args={error:"This is a error message"};const g=e.bind({});g.args={value:"123test"};const m=()=>r.jsxs(J,{small:!0,children:[r.jsx(c,{value:123}),r.jsx(P,{children:"to"}),r.jsx(c,{value:123}),r.jsx(Q,{options:[{value:"units",label:"units"}],width:"auto",value:"units"})]});var d,i,v;l.parameters={...l.parameters,docs:{...(d=l.parameters)==null?void 0:d.docs,source:{originalSource:`args => {
|
|
2
2
|
const [_, updateArgs] = useArgs();
|
|
3
3
|
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
|
|
4
4
|
updateArgs({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as n}from"./jsx-runtime-f961835c.js";import{T as I}from"./common-types-2c81813f.js";import{M as N}from"./actions-46447905.js";import{c as A}from"./index-a80ed1cf.js";import{C as E}from"./check-box-
|
|
1
|
+
import{j as n}from"./jsx-runtime-f961835c.js";import{T as I}from"./common-types-2c81813f.js";import{M as N}from"./actions-46447905.js";import{c as A}from"./index-a80ed1cf.js";import{C as E}from"./check-box-73be452f.js";import{D as f}from"./divider-182aa58c.js";import"./index-f80c8c95.js";import"./lodash-75c70a11.js";import"./disabled-context-d654f6ff.js";import"./button-e6a6c574.js";import"./spinner-cb92a546.js";import"./index-c89a1915.js";import"./icon-c5e1f218.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-3abf067b.js";import"./help-icon-5be78589.js";import"./text-ad1f5f1d.js";const V="_menu_12x4u_1",T="_header_12x4u_11",q="_item_12x4u_27",w="_heading_12x4u_32",u={menu:V,header:T,item:q,heading:w},g=({option:e,onChange:r})=>{const{key:o,label:i,selected:a}=e;return n.jsx("div",{className:u.item,children:n.jsx(E,{label:i,noMargin:!0,checked:a,onChange:r})},o)};try{g.displayName="Option",g.__docgenInfo={description:"",displayName:"Option",props:{option:{defaultValue:null,description:"",name:"option",required:!0,type:{name:"{ key?: string | undefined; label?: string | null | undefined; selected?: boolean | undefined; }"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!0,type:{name:"(evt: ChangeEvent<HTMLInputElement>) => void"}}}}}catch{}const _=({label:e})=>n.jsx("div",{className:u.heading,children:e});try{_.displayName="Heading",_.__docgenInfo={description:"",displayName:"Heading",props:{label:{defaultValue:null,description:"",name:"label",required:!0,type:{name:"string"}}}}}catch{}var h=(e=>(e.HEADING="Heading",e.DIVIDER="Divider",e.DEFAULT="Default",e))(h||{});const y=({options:e,onChangeOptions:r,showHeader:o,maxHeight:i})=>n.jsxs("div",{className:A("menu",u.menu),style:{maxHeight:i},children:[o&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:u.header,children:[n.jsx("a",{onClick:a=>{const s=e.map(t=>({...t,selected:!0}));r(a,s)},children:"All"}),n.jsx("a",{onClick:a=>{const s=e.map(t=>({...t,selected:!1}));r(a,s)},children:"Clear"}),n.jsx("a",{onClick:a=>{const s=e.map(t=>({...t,selected:!t.selected}));r(a,s)},children:"Invert"})]}),n.jsx(f,{margin:0})]}),e.map((a,s)=>{switch(a.type){case h.HEADING:return n.jsx(_,{label:a.label},s);case h.DIVIDER:return n.jsx(f,{margin:0},s);default:return n.jsx(g,{option:a,onChange:t=>{const{value:m}=a,H=e.map(d=>d.value!==m?d:{...d,selected:!d.selected});r(t,H)}},s)}})]});try{y.displayName="Layer",y.__docgenInfo={description:"",displayName:"Layer",props:{options:{defaultValue:null,description:"",name:"options",required:!0,type:{name:"IOptionType[]"}},onChangeOptions:{defaultValue:null,description:"",name:"onChangeOptions",required:!0,type:{name:"(evt: MouseEvent<HTMLAnchorElement, MouseEvent>, options: IOptionType[]) => void"}},showHeader:{defaultValue:null,description:"",name:"showHeader",required:!1,type:{name:"boolean"}},maxHeight:{defaultValue:null,description:"",name:"maxHeight",required:!1,type:{name:"TStringOrNumber"}}}}}catch{}const c=({name:e,label:r,options:o,onChange:i,showHeader:a=!0,maxHeight:s="40vh"})=>n.jsx(N,{menu:{label:r,trigger:I.DROP_DOWN_BUTTON,possiblePlacements:["top-start","bottom-start"],sections:n.jsx(y,{options:o,onChangeOptions:(t,m)=>{t.stopPropagation(),t.target.name=e,t.target.value=m,i(t)},showHeader:a,maxHeight:s})}});try{c.displayName="OptionDropdown",c.__docgenInfo={description:"",displayName:"OptionDropdown",props:{name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},label:{defaultValue:null,description:"",name:"label",required:!0,type:{name:"string"}},options:{defaultValue:null,description:"",name:"options",required:!0,type:{name:"IOptionType[]"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!0,type:{name:"(evt: ChangeEvent<HTMLInputElement & { name?: string | undefined; value: IOptionType[]; }>) => void"}},showHeader:{defaultValue:{value:"true"},description:"",name:"showHeader",required:!1,type:{name:"boolean"}},maxHeight:{defaultValue:{value:"40vh"},description:"",name:"maxHeight",required:!1,type:{name:"string"}}}}}catch{}const{useArgs:M}=__STORYBOOK_MODULE_ADDONS__,k=[{label:"Animals",type:"Heading"},{type:"Divider"},{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Monkeys",value:"bananas"}],se={title:"Forms/OptionDropdown",component:c,args:{label:"Label",options:k}},j=e=>{const[r,o]=M(),i=a=>{o({options:a.target.value})};return n.jsx(c,{...e,onChange:i})},p=j.bind({}),l=j.bind({});l.args={options:[...Array(50)].map((e,r)=>({label:`Item #${r}`,value:r}))};var v,x,b;p.parameters={...p.parameters,docs:{...(v=p.parameters)==null?void 0:v.docs,source:{originalSource:`args => {
|
|
2
2
|
const [_, updateArgs] = useArgs();
|
|
3
3
|
const handleChange = (evt: any) => {
|
|
4
4
|
updateArgs({
|
package/dist/storybook/assets/{padding-and-spacing-8f84561b.js → padding-and-spacing-a3a5213e.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-f961835c.js";import{M as r}from"./index-
|
|
1
|
+
import{j as e}from"./jsx-runtime-f961835c.js";import{M as r}from"./index-c54905c0.js";import{u as t}from"./index-5cdc9468.js";import"./index-f80c8c95.js";import"./iframe-bc0fdebc.js";import"../sb-preview/runtime.js";import"./index-3d476d02.js";import"./inheritsLoose-d4851ab8.js";import"./assertThisInitialized-081f9914.js";import"./index-97a99495.js";function i(n){const s=Object.assign({h1:"h1",h2:"h2",p:"p",ul:"ul",li:"li",strong:"strong",code:"code"},t(),n.components);return e.jsxs(e.Fragment,{children:[e.jsx(r,{title:"Padding, Margin & Size"}),`
|
|
2
2
|
`,e.jsx(s.h1,{id:"padding-margin--size",children:"Padding, Margin & Size"}),`
|
|
3
3
|
`,e.jsx(s.h2,{id:"padding--margin",children:"Padding & Margin"}),`
|
|
4
4
|
`,e.jsx(s.p,{children:"There are standard CSS spacing variables for padding and margin."}),`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as S}from"./jsx-runtime-f961835c.js";import{R as M}from"./index-f80c8c95.js";import{T as pe}from"./toaster-7efa1564.js";import{e as G}from"./index-54f0d271.js";import"./chunk-HLWAVYOI-
|
|
1
|
+
import{j as S}from"./jsx-runtime-f961835c.js";import{R as M}from"./index-f80c8c95.js";import{T as pe}from"./toaster-7efa1564.js";import{e as G}from"./index-54f0d271.js";import"./chunk-HLWAVYOI-3f2e7bdd.js";import{e as de,t as U}from"./index-c54905c0.js";import"./index-3d476d02.js";import"./types-fe05eeca.js";import"./index-c89a1915.js";import"./index-a80ed1cf.js";import"./button-e6a6c574.js";import"./common-types-2c81813f.js";import"./disabled-context-d654f6ff.js";import"./spinner-cb92a546.js";import"./icon-c5e1f218.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./tooltip-23e84186.js";import"./iframe-bc0fdebc.js";import"../sb-preview/runtime.js";import"./react-16-147b12fd.js";import"./assertThisInitialized-081f9914.js";import"./index-97a99495.js";var W="DARK_MODE";const{global:ce}=__STORYBOOK_MODULE_GLOBAL__;__STORYBOOK_MODULE_CLIENT_LOGGER__;function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},b.apply(this,arguments)}function me(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},h(e,t)}function ge(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,h(e,t)}function z(e){return z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},z(e)}function be(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function he(){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 C(e,t,r){return he()?C=Reflect.construct.bind():C=function(a,n,o){var i=[null];i.push.apply(i,n);var l=Function.bind.apply(a,i),s=new l;return o&&h(s,o.prototype),s},C.apply(null,arguments)}function H(e){var t=typeof Map=="function"?new Map:void 0;return H=function(r){if(r===null||!be(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(r))return t.get(r);t.set(r,a)}function a(){return C(r,arguments,z(this).constructor)}return a.prototype=Object.create(r.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),h(a,r)},H(e)}var ye={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-bc0fdebc.js";import"../sb-preview/runtime.js";var a={docs:{renderer:async()=>{let{DocsRenderer:r}=await e(()=>import("./DocsRenderer-NNNQARDV-19e71c0e.js"),["./DocsRenderer-NNNQARDV-19e71c0e.js","./chunk-HLWAVYOI-3f2e7bdd.js","./iframe-bc0fdebc.js","./index-f80c8c95.js","./react-16-147b12fd.js","./index-3d476d02.js","./index-c54905c0.js","./inheritsLoose-d4851ab8.js","./assertThisInitialized-081f9914.js","./index-97a99495.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"./index-f80c8c95.js";import{T as n}from"./top-bar-cbdcbd32.js";import{L as r}from"./list-
|
|
1
|
+
import{j as e}from"./jsx-runtime-f961835c.js";import"./index-f80c8c95.js";import{T as n}from"./top-bar-cbdcbd32.js";import{L as r}from"./list-5907161b.js";import{P as p}from"./page-6d07f774.js";import{R as c,C as o}from"./row-2f12e486.js";import{T as d}from"./tabs-e616ae83.js";import{S as u}from"./spacer-54db0620.js";import"./index-a80ed1cf.js";import"./icon-c5e1f218.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./common-types-2c81813f.js";import"./button-e6a6c574.js";import"./spinner-cb92a546.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./actions-46447905.js";import"./lodash-75c70a11.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-3abf067b.js";import"./index.es-ed1d81bc.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./memoize-one.esm-52518564.js";import"./card-3847c251.js";import"./list-heading-f1ceab8b.js";import"./heading-61bdbf94.js";import"./help-icon-5be78589.js";import"./loader-87ec8334.js";import"./styled-components.browser.esm-416d73e5.js";import"./select.input-88b6ebab.js";const t=[{label:"Browse",value:"Browse"},{label:"Recent",value:"Recent"},{label:"My Projects",value:"My Projects"}],s=[{id:1,name:"Lorem",active:!0},{id:2,name:"Ipsum"},{id:3,name:"Dolor"},{id:4,name:"Long name goes here lorem ipsum"},{id:5,name:"Lorem"},{id:6,name:"Ipsum"},{id:7,name:"Dolor"},{id:8,name:"Long name goes here lorem ipsum"},{id:9,name:"Lorem"},{id:10,name:"Ipsum"},{id:11,name:"Dolor"},{id:12,name:"Long name goes here lorem ipsum"},{id:13,name:"Lorem"},{id:14,name:"Ipsum"},{id:15,name:"Dolor"},{id:16,name:"Long name goes here lorem ipsum"}],V={title:"Layout/Layout Examples",parameters:{layout:"fullscreen",docs:{story:{inline:!1,iframeHeight:400}}}},l=()=>e.jsxs(e.Fragment,{children:[e.jsx(n,{}),e.jsxs(p,{padding:!1,left:0,scroll:!1,children:[e.jsx(u,{}),e.jsx(d,{margin:!1,padding:!0,options:t,value:t[0]}),e.jsxs(c,{spacing:0,flex:!0,height:"100%",children:[e.jsx(o,{borderRight:!0,scroll:!0,showScrollbar:!1,children:e.jsx(r,{list:{name:"Country",items:s}})}),e.jsx(o,{borderRight:!0,scroll:!0,showScrollbar:!1,children:e.jsx(r,{list:{name:"Field",items:s}})}),e.jsx(o,{borderRight:!0,scroll:!0,showScrollbar:!1,children:e.jsx(r,{list:{name:"Site",items:s}})}),e.jsx(o,{borderRight:!0,scroll:!0,showScrollbar:!1,children:e.jsx(r,{list:{name:"Well",items:s}})}),e.jsx(o,{borderRight:!0,scroll:!0,showScrollbar:!1,children:e.jsx(r,{list:{name:"Wellbore",items:s}})}),e.jsx(o,{scroll:!0,showScrollbar:!1,children:e.jsx(r,{list:{name:"Design",items:s}})})]})]})]});var i,m,a;l.parameters={...l.parameters,docs:{...(i=l.parameters)==null?void 0:i.docs,source:{originalSource:`() => {
|
|
2
2
|
return <>
|
|
3
3
|
<TopBar />
|
|
4
4
|
<Page padding={false} left={0} scroll={false}>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as l}from"./jsx-runtime-f961835c.js";import{r as E}from"./index-f80c8c95.js";import{c as v}from"./index-a80ed1cf.js";import{D as N}from"./disabled-context-d654f6ff.js";import{s as R}from"./select.input-88b6ebab.js";import{b as j}from"./common-types-2c81813f.js";import{H as O}from"./help-icon-5be78589.js";const H="_wrapper_1fbik_1",B="_inline_1fbik_1",D="_radio_1fbik_5",S="_labelMargin_1fbik_8",w="_small_1fbik_27",L="_noMargin_1fbik_32",F="_disabled_1fbik_90",z="_isInTable_1fbik_106",A="_helpIconEnabled_1fbik_111",a={wrapper:H,inline:B,radio:D,labelMargin:S,small:w,noMargin:L,disabled:F,isInTable:z,helpIconEnabled:A},y=({name:n,label:m,value:d,selected:c,disabled:t=!1,small:f=!1,onChange:b,noMargin:_=!1,testId:g,helpText:i,onClickHelp:s})=>{const u=i||s;return l.jsxs("div",{className:v(a.radio,t?a.disabled:null,f?a.small:null,_?a.noMargin:null),onClick:b,"data-testid":g,children:[l.jsx("input",{type:j.RADIO,value:d,checked:c,onChange:()=>{},disabled:t}),l.jsx("label",{"data-name":n,"data-value":d,children:m}),u&&l.jsx("div",{className:a.helpIconEnabled,onClick:s,children:l.jsx(O,{text:i})})]})};try{y.displayName="RadioInput",y.__docgenInfo={description:"",displayName:"RadioInput",props:{name:{defaultValue:null,description:"",name:"name",required:!0,type:{name:"TStringOrNumber"}},label:{defaultValue:null,description:"",name:"label",required:!0,type:{name:"TStringOrNumber"}},value:{defaultValue:null,description:"",name:"value",required:!0,type:{name:"TStringOrNumber"}},selected:{defaultValue:null,description:"",name:"selected",required:!0,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},small:{defaultValue:{value:"false"},description:"",name:"small",required:!1,type:{name:"boolean"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((evt: MouseEvent<HTMLDivElement, MouseEvent>) => void)"}},noMargin:{defaultValue:{value:"false"},description:"",name:"noMargin",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}},helpText:{defaultValue:null,description:"",name:"helpText",required:!1,type:{name:"string"}},onClickHelp:{defaultValue:null,description:"",name:"onClickHelp",required:!1,type:{name:"((event?: any) => void)"}}}}}catch{}const I=({name:n,label:m,options:d,value:c,onChange:t,disabled:f=!1,small:b=!1,noMargin:_=!1,onClick:g=()=>{},inline:i=!1,mainLabel:s="",radioButtonsData:u,classForContainer:V="grouped fields"})=>{const q=E.useContext(N),o=u!==void 0,{simpleInputs:h,options:x,selectedOptions:p}=o?{simpleInputs:!1,options:u,selectedOptions:void 0}:R(d,c),k=o||p===void 0||p===null?void 0:h?p:p.value,C=o?s:m;return l.jsxs("div",{className:v(a.wrapper,i?a.inline:null,V==="inline fields"?a.inline:null),children:[s&&l.jsx("label",{className:v(i&&a.labelMargin),children:C}),x.map((e,M)=>{const T=e.checked||e.value===k||!1;return l.jsx(y,{name:e.name||e.value,label:e.label,value:e.value,selected:T,disabled:f||e.disabled||q,small:b,noMargin:_,onChange:e.disabled?void 0:r=>{o?g(r.target):(r.target.name=n,r.target.value=e.value.toString(),r.target.label=e.label.toString(),t&&t(r))},testId:e.testId,helpText:e.helpText,onClickHelp:e.onClickHelp},M)})]})};try{I.displayName="RadioButton",I.__docgenInfo={description:"",displayName:"RadioButton",props:{name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},label:{defaultValue:null,description:"",name:"label",required:!1,type:{name:"string | null"}},options:{defaultValue:null,description:"",name:"options",required:!0,type:{name:"IRadioButtonOption[]"}},value:{defaultValue:null,description:"",name:"value",required:!0,type:{name:"TStringOrNumber | IRadioButtonOption"}},inline:{defaultValue:{value:"false"},description:"",name:"inline",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},small:{defaultValue:{value:"false"},description:"",name:"small",required:!1,type:{name:"boolean"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((evt: ChangeEvent<HTMLInputElement>) => void)"}},noMargin:{defaultValue:{value:"false"},description:"",name:"noMargin",required:!1,type:{name:"boolean"}},mainLabel:{defaultValue:{value:""},description:"",name:"mainLabel",required:!1,type:{name:"string"}},onClick:{defaultValue:{value:"() => {}"},description:"",name:"onClick",required:!1,type:{name:"((target: HTMLInputElement) => void)"}},radioButtonsData:{defaultValue:null,description:"",name:"radioButtonsData",required:!1,type:{name:"IRadioButtonOption[]"}},classForContainer:{defaultValue:{value:"grouped fields"},description:"",name:"classForContainer",required:!1,type:{name:"enum",value:[{value:'"grouped fields"'},{value:'"inline fields"'}]}}}}}catch{}export{I as R};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._wrapper_1fbik_1._inline_1fbik_1{display:flex;align-items:center}._wrapper_1fbik_1._inline_1fbik_1 ._radio_1fbik_5:not(:last-child){margin-right:var(--padding)}._wrapper_1fbik_1 ._labelMargin_1fbik_8{margin-right:var(--padding)}._radio_1fbik_5{--size-radio: var(--size-xs);margin:calc((var(--size) - var(--size-radio)) / 2) 0;position:relative;display:flex;align-items:center;gap:var(--padding-xxs);backface-visibility:hidden;vertical-align:baseline;font-style:normal;min-height:var(--size-radio);font-size:var(--font-size);line-height:var(--size-radio);min-width:var(--size-radio);outline:0px}._radio_1fbik_5._small_1fbik_27{--size-radio: calc(var(--size-xs) - 4px);margin:calc((var(--size-sm) - var(--size-radio)) / 2) 0;font-size:var(--font-size-sm)}._radio_1fbik_5._noMargin_1fbik_32{margin-top:0;margin-bottom:0}._radio_1fbik_5 input{cursor:pointer;position:absolute;top:0;left:0;opacity:0!important;outline:0;width:var(--size-radio);height:var(--size-radio);z-index:-1}._radio_1fbik_5 label{cursor:pointer;position:relative;display:block;padding-left:calc(var(--size-radio) + var(--padding-xs));outline:0;color:var(--color-text);transition:color .1s ease}._radio_1fbik_5 label:before,._radio_1fbik_5 label:after{content:"";position:absolute;top:0;left:0;width:var(--size-radio);height:var(--size-radio);line-height:var(--size-radio);border-radius:50%;transition:border .1s ease,opacity .1s ease,transform .1s ease,box-shadow .1s ease}._radio_1fbik_5 label:before{background:var(--color-background-button-default);border:1px solid var(--color-border-checkbox);transform:none}._radio_1fbik_5 label:hover:before{border-color:var(--color-border-hover)}._radio_1fbik_5 label:after{border:none;transform:scale(.46666667);background-color:#fff;box-shadow:var(--shadow-button);opacity:0}._radio_1fbik_5 input:checked~label:before{background-color:var(--color-background-primary);border-color:transparent}._radio_1fbik_5 input:checked~label:after{opacity:1}._radio_1fbik_5._disabled_1fbik_90{cursor:default;pointer-events:none}._radio_1fbik_5._disabled_1fbik_90 label{color:var(--color-text-faint)}._radio_1fbik_5._disabled_1fbik_90 label:before{background-color:var(--color-background-disabled)!important}._radio_1fbik_5._disabled_1fbik_90 input:checked~label:before{border-color:var(--color-border-checkbox)}._radio_1fbik_5._disabled_1fbik_90 input:checked~label:after{background-color:var(--color-border-checkbox)}._isInTable_1fbik_106{margin:0;position:relative;top:1px}._helpIconEnabled_1fbik_111{pointer-events:auto}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import{j}from"./jsx-runtime-f961835c.js";import{r as _}from"./index-f80c8c95.js";import{R as I}from"./radio-button-266c81ed.js";import"./index-a80ed1cf.js";import"./disabled-context-d654f6ff.js";import"./select.input-88b6ebab.js";import"./types-cc224262.js";import"./common-types-2c81813f.js";import"./help-icon-5be78589.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./icon-c5e1f218.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";const n=[{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Monkeys",value:"bananas",disabled:!0}],Y={title:"Forms/RadioButton",component:I,args:{options:n,inline:!1,noMargin:!1,disabled:!1,small:!1}},a=e=>{const[t,M]=_.useState(n[0]),y=k=>{const L=k.target.value,i=n.find(D=>D.value===L);i&&M(i)};return j.jsx(I,{...e,value:t,onChange:y})},c=a.bind({}),s=a.bind({});s.args={small:!0};const o=a.bind({});o.args={options:n.map((e,t)=>({...e,helpText:`Help text #${t}`}))};const l=a.bind({});l.args={options:n.map((e,t)=>({...e,onClickHelp:()=>console.log(`Help #${t} clicked`)}))};const r=a.bind({});r.args={inline:!0};const p=a.bind({});p.args={options:n.map((e,t)=>({...e,helpText:`Help text #${t}`,disabled:!0}))};var u,d,g;c.parameters={...c.parameters,docs:{...(u=c.parameters)==null?void 0:u.docs,source:{originalSource:`args => {
|
|
2
|
+
const [value, setValue] = useState<OptionType>(options[0]);
|
|
3
|
+
const handleChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
|
4
|
+
const selectedValue = evt.target.value;
|
|
5
|
+
const selectedOption = options.find(opt => opt.value === selectedValue);
|
|
6
|
+
if (selectedOption) {
|
|
7
|
+
setValue(selectedOption);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
return <RadioButton {...args} value={value} onChange={handleChange} />;
|
|
11
|
+
}`,...(g=(d=c.parameters)==null?void 0:d.docs)==null?void 0:g.source}}};var m,v,h;s.parameters={...s.parameters,docs:{...(m=s.parameters)==null?void 0:m.docs,source:{originalSource:`args => {
|
|
12
|
+
const [value, setValue] = useState<OptionType>(options[0]);
|
|
13
|
+
const handleChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
|
14
|
+
const selectedValue = evt.target.value;
|
|
15
|
+
const selectedOption = options.find(opt => opt.value === selectedValue);
|
|
16
|
+
if (selectedOption) {
|
|
17
|
+
setValue(selectedOption);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return <RadioButton {...args} value={value} onChange={handleChange} />;
|
|
21
|
+
}`,...(h=(v=s.parameters)==null?void 0:v.docs)==null?void 0:h.source}}};var C,O,V;o.parameters={...o.parameters,docs:{...(C=o.parameters)==null?void 0:C.docs,source:{originalSource:`args => {
|
|
22
|
+
const [value, setValue] = useState<OptionType>(options[0]);
|
|
23
|
+
const handleChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
|
24
|
+
const selectedValue = evt.target.value;
|
|
25
|
+
const selectedOption = options.find(opt => opt.value === selectedValue);
|
|
26
|
+
if (selectedOption) {
|
|
27
|
+
setValue(selectedOption);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return <RadioButton {...args} value={value} onChange={handleChange} />;
|
|
31
|
+
}`,...(V=(O=o.parameters)==null?void 0:O.docs)==null?void 0:V.source}}};var f,T,H;l.parameters={...l.parameters,docs:{...(f=l.parameters)==null?void 0:f.docs,source:{originalSource:`args => {
|
|
32
|
+
const [value, setValue] = useState<OptionType>(options[0]);
|
|
33
|
+
const handleChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
|
34
|
+
const selectedValue = evt.target.value;
|
|
35
|
+
const selectedOption = options.find(opt => opt.value === selectedValue);
|
|
36
|
+
if (selectedOption) {
|
|
37
|
+
setValue(selectedOption);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return <RadioButton {...args} value={value} onChange={handleChange} />;
|
|
41
|
+
}`,...(H=(T=l.parameters)==null?void 0:T.docs)==null?void 0:H.source}}};var R,b,E;r.parameters={...r.parameters,docs:{...(R=r.parameters)==null?void 0:R.docs,source:{originalSource:`args => {
|
|
42
|
+
const [value, setValue] = useState<OptionType>(options[0]);
|
|
43
|
+
const handleChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
|
44
|
+
const selectedValue = evt.target.value;
|
|
45
|
+
const selectedOption = options.find(opt => opt.value === selectedValue);
|
|
46
|
+
if (selectedOption) {
|
|
47
|
+
setValue(selectedOption);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
return <RadioButton {...args} value={value} onChange={handleChange} />;
|
|
51
|
+
}`,...(E=(b=r.parameters)==null?void 0:b.docs)==null?void 0:E.source}}};var S,x,B;p.parameters={...p.parameters,docs:{...(S=p.parameters)==null?void 0:S.docs,source:{originalSource:`args => {
|
|
52
|
+
const [value, setValue] = useState<OptionType>(options[0]);
|
|
53
|
+
const handleChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
|
54
|
+
const selectedValue = evt.target.value;
|
|
55
|
+
const selectedOption = options.find(opt => opt.value === selectedValue);
|
|
56
|
+
if (selectedOption) {
|
|
57
|
+
setValue(selectedOption);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return <RadioButton {...args} value={value} onChange={handleChange} />;
|
|
61
|
+
}`,...(B=(x=p.parameters)==null?void 0:x.docs)==null?void 0:B.source}}};const Z=["Default","Small","HelpText","OnClickHelp","Inline","DisabledWithHelpText"];export{c as Default,p as DisabledWithHelpText,o as HelpText,r as Inline,l as OnClickHelp,s as Small,Z as __namedExportsOrder,Y as default};
|
package/dist/storybook/assets/{reservoirs.stories-134f21cc.js → reservoirs.stories-098985fb.js}
RENAMED
|
@@ -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-cbdcbd32.js";import{S as L}from"./side-bar-bc0bfe9c.js";import{H as t}from"./heading-61bdbf94.js";import{B as m}from"./button-e6a6c574.js";import{D as v}from"./drawer-2407de69.js";import{L as C}from"./list-
|
|
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-cbdcbd32.js";import{S as L}from"./side-bar-bc0bfe9c.js";import{H as t}from"./heading-61bdbf94.js";import{B as m}from"./button-e6a6c574.js";import{D as v}from"./drawer-2407de69.js";import{L as C}from"./list-5907161b.js";import{F as l}from"./field-2424dd3c.js";import{I as i}from"./input-d68625a5.js";import{C as p}from"./check-box-73be452f.js";import{R as h}from"./radio-button-266c81ed.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-2f12e486.js";import{S as R}from"./select-6b6d28f7.js";import{S as f}from"./spacer-54db0620.js";import"./index-a80ed1cf.js";import"./icon-c5e1f218.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./actions-46447905.js";import"./lodash-75c70a11.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-3abf067b.js";import"./index-c7f280f6.js";import"./help-icon-5be78589.js";import"./spinner-cb92a546.js";import"./index.es-ed1d81bc.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./memoize-one.esm-52518564.js";import"./list-heading-f1ceab8b.js";import"./loader-87ec8334.js";import"./label-0958ef3a.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-
|
|
1
|
+
import{j as o}from"./jsx-runtime-f961835c.js";import{r as R}from"./index-f80c8c95.js";import{T as c}from"./table-16e7479d.js";import{T as V}from"./text-ad1f5f1d.js";import{t as g,i as W,q as B}from"./table.stories-data-07840afd.js";import"./index-a80ed1cf.js";import"./index.es-ed1d81bc.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-c5e1f218.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./lodash-75c70a11.js";import"./actions-46447905.js";import"./common-types-2c81813f.js";import"./button-e6a6c574.js";import"./spinner-cb92a546.js";import"./tooltip-23e84186.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-3abf067b.js";import"./heading-61bdbf94.js";import"./help-icon-5be78589.js";import"./pagination-8a1d097c.js";import"./select-6b6d28f7.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-42f50494.js";import"./index-54f0d271.js";import"./check-box-73be452f.js";import"./slider-cf2db7b4.js";import"./index-c7f280f6.js";import"./popover-e20a61fe.js";import"./flex-47732c42.js";const ke={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-cbdcbd32.js";import{S as w}from"./side-bar-bc0bfe9c.js";import{H as t}from"./heading-61bdbf94.js";import{B as L}from"./button-e6a6c574.js";import{D as v}from"./drawer-2407de69.js";import{L as d}from"./list-
|
|
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-cbdcbd32.js";import{S as w}from"./side-bar-bc0bfe9c.js";import{H as t}from"./heading-61bdbf94.js";import{B as L}from"./button-e6a6c574.js";import{D as v}from"./drawer-2407de69.js";import{L as d}from"./list-5907161b.js";import{F as l}from"./field-2424dd3c.js";import{I as a}from"./input-d68625a5.js";import{C as m}from"./check-box-73be452f.js";import{P as f}from"./page-6d07f774.js";import{R as o,C as i}from"./row-2f12e486.js";import{A as u}from"./accordion-18132dea.js";import{S as s}from"./spacer-54db0620.js";import{T as F}from"./tabs-e616ae83.js";import"./index-a80ed1cf.js";import"./icon-c5e1f218.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./actions-46447905.js";import"./lodash-75c70a11.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-3abf067b.js";import"./index-c7f280f6.js";import"./help-icon-5be78589.js";import"./spinner-cb92a546.js";import"./index.es-ed1d81bc.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./memoize-one.esm-52518564.js";import"./card-3847c251.js";import"./list-heading-f1ceab8b.js";import"./loader-87ec8334.js";import"./label-0958ef3a.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-
|
|
1
|
+
import{S as c,c as l,s as n}from"./index-c54905c0.js";import"./iframe-bc0fdebc.js";import"../sb-preview/runtime.js";import"./index-f80c8c95.js";import"./index-3d476d02.js";import"./inheritsLoose-d4851ab8.js";import"./assertThisInitialized-081f9914.js";import"./index-97a99495.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 V}from"./index-f80c8c95.js";import{c as j}from"./index-a80ed1cf.js";import{I as He,D as Pe,C as Le,P as De}from"./index.es-ed1d81bc.js";import{l as Fe}from"./lodash-75c70a11.js";import{A as ye}from"./actions-46447905.js";import{H as $e}from"./heading-61bdbf94.js";import{P as Oe}from"./pagination-8a1d097c.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-863c4463.js";import{S as Ge}from"./select-6b6d28f7.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-421e08ab.js";import{S as Je}from"./slider-cf2db7b4.js";import{I as B}from"./icon-c5e1f218.js";import{P as Ke}from"./popover-e20a61fe.js";import{H as Ee}from"./help-icon-5be78589.js";import{T as ee}from"./text-ad1f5f1d.js";const ze="_inputInTable_16p4q_1",Ye="_inputHover_16p4q_13",Qe="_inputFocus_16p4q_18",Ze="_inputError_16p4q_25",en="_inputWarning_16p4q_26",nn="_inputDisabled_16p4q_61",tn="_hideScrollbars_16p4q_67",rn="_wrapper_16p4q_85",an="_bordered_16p4q_93",ln="_scroll_16p4q_98",on="_table_16p4q_108",sn="_striped_16p4q_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)},qe=e=>e.reduce((t,a)=>a.actions&&a.actions.length>0?1:t,0),_n=(e,t)=>qe(t)>0||qe(e)>0,J=({table:e,children:t})=>{const{rows:a,infiniteScroll:l}=e,r=Math.ceil(window.innerHeight/30),[o,s]=l?V.useState(r):[a.length,null],[u,d]=l?V.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",Cn="_dragIconCell_11d5t_28",xn="_dragIcon_11d5t_28",R={clickableRow:gn,hoverableRow:yn,rowActive:fn,expandableRow:hn,flush:bn,dragIconCell:Cn,dragIcon:xn},K=({colSpan:e,children:t,flush:a})=>n.jsx("tr",{children:n.jsx("td",{colSpan:e,className:j(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 Ve=(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."),[])},Nn="_inputInTable_17dgc_1",jn="_inputHover_17dgc_13",wn="_inputFocus_17dgc_18",An="_inputError_17dgc_25",vn="_inputWarning_17dgc_26",Rn="_inputDisabled_17dgc_61",Sn="_hideScrollbars_17dgc_67",qn="_cell_17dgc_77",Vn="_disabledLink_17dgc_87",Tn="_inputWrapper_17dgc_91",En="_breakWord_17dgc_106",kn="_inputCell_17dgc_109",Wn="_sliderCell_17dgc_112",Hn="_staticCell_17dgc_116",Pn="_staticCellContent_17dgc_119",Ln="_error_17dgc_131",Dn="_warning_17dgc_132",Fn="_unit_17dgc_141",$n="_sortingCell_17dgc_144",On="_sortingCellIcon_17dgc_155",Bn="_icon_17dgc_166",Mn="_checkBoxCell_17dgc_170",Gn="_iconCellWrapper_17dgc_174",Un="_actionsCell_17dgc_178",Xn="_rightAligned_17dgc_186",Jn="_centerAligned_17dgc_192",Kn="_leftAligned_17dgc_198",zn="_popover_17dgc_201",Yn="_disabledPointerEvents_17dgc_204",i={inputInTable:Nn,inputHover:jn,inputFocus:wn,inputError:An,inputWarning:vn,inputDisabled:Rn,hideScrollbars:Sn,cell:qn,disabledLink:Vn,inputWrapper:Tn,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=V.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:j(i.staticCellContent,l?i.error:r?i.warning:""),children:n.jsx("a",{className:j((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:j(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=V.useRef(null),g={bodyAlignment:l,headerAlignment:a,isHeader:t},P=Ve(g,i),C=Ve(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=j(i.cell,L,e.hasSort?i.sortingCell:null,P,e.breakWord?i.breakWord:""),T=c??r??((o==null?void 0:o.isDragging)&&y.current&&y.current.offsetWidth)??void 0,x={width:T,minWidth:T,...u},A=t?"th":"td";return n.jsx(A,{ref:y,className:w,style:x,colSpan:d,rowSpan:p,children:n.jsx(ge,{cell:e,columnAlignment:C??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 C=V.useRef(null),L=In(o,a,t),{onRowClick:w,onRowFocus:T,onRowMouseEnter:x,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)}),q=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:C,onClick:w,onMouseEnter:x,onMouseLeave:A,onFocus:T,className:j(w?R.clickableRow:null,x?R.hoverableRow:null),children:[d?n.jsx("th",{}):null,E,q]},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:x,onMouseLeave:A,onFocus:T,className:j(w&&!w.noStyle?R.clickableRow:null,x&&!x.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,q]},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 Te=e=>{var Ie,Ne,je,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:C=null,onAddRow:L=null,bordered:w=!0,maxHeight:T,fixedWidth:x}=a,A=V.useRef(null),[I,Q]=V.useState({width:0,height:0});V.useEffect(()=>{A.current&&Q({width:A.current.offsetWidth,height:A.current.offsetHeight})},[]);const E=Fe.get(e,"table.headers",[]),q=mn(s,E),k=_n(s,E),W=q+(k?1:0),h=r?((Ne=(Ie=r==null?void 0:r.pagination)==null?void 0:Ie.rowsPerPage)==null?void 0:Ne.value)===0||Number((je=r==null?void 0:r.pagination)==null?void 0:je.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=C==null?void 0:C.cells)==null?void 0:Re.length)&&L&&h,ke={cells:v?C.cells.map((m,N)=>(m==null?void 0:m.type)==="Input"?{...m,onChange:_=>{var M;const f=(M=_==null?void 0:_.target)==null?void 0:M.value,D={...C,cells:C.cells.map((G,We)=>({...G,value:We===N?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},Ce=j(H.wrapper,w?H.bordered:""),xe={maxHeight:T,width:x,display:x==="auto"?"inline-flex":"flex"};return P?n.jsxs("div",{ref:A,className:Ce,style:xe,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(Pe,{onDragEnd:m=>{var f,D;const N=(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 N=="number"&&typeof _=="number"&&t({from:N,to:_})},children:n.jsx(Le,{droppableId:"droppable",children:m=>n.jsx(J,{table:be,children:({visibleRows:N})=>n.jsxs("table",{className:j(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:q,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p,draggableTable:P},`0_${f}`))}),n.jsxs("tbody",{children:[Z.slice(0,N).map((_,f)=>n.jsx(De,{draggableId:f+"",index:f,isDragDisabled:_.noDrag,children:(D,M)=>n.jsx(F,{rowIndex:f,row:_,columnCount:q,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:Ce,style:xe,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:j(H.table,y?H.striped:""),"data-testid":g,children:[n.jsx("thead",{children:E.map((N,_)=>n.jsx(F,{rowIndex:_,isHeader:!0,row:N,columnCount:q,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p},`0_${_}`))}),n.jsx("tbody",{children:Z.slice(0,m).map((N,_)=>n.jsx(F,{rowIndex:_,row:N,columnCount:q,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{Te.displayName="Table",Te.__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{Te as T};
|
|
1
|
+
import{j as n}from"./jsx-runtime-f961835c.js";import{r as V}from"./index-f80c8c95.js";import{c as j}from"./index-a80ed1cf.js";import{I as He,D as Pe,C as Le,P as De}from"./index.es-ed1d81bc.js";import{l as Fe}from"./lodash-75c70a11.js";import{A as ye}from"./actions-46447905.js";import{H as $e}from"./heading-61bdbf94.js";import{P as Oe}from"./pagination-8a1d097c.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-42f50494.js";import{S as Ge}from"./select-6b6d28f7.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-73be452f.js";import{S as Je}from"./slider-cf2db7b4.js";import{I as B}from"./icon-c5e1f218.js";import{P as Ke}from"./popover-e20a61fe.js";import{H as Ee}from"./help-icon-5be78589.js";import{T as ee}from"./text-ad1f5f1d.js";const ze="_inputInTable_16p4q_1",Ye="_inputHover_16p4q_13",Qe="_inputFocus_16p4q_18",Ze="_inputError_16p4q_25",en="_inputWarning_16p4q_26",nn="_inputDisabled_16p4q_61",tn="_hideScrollbars_16p4q_67",rn="_wrapper_16p4q_85",an="_bordered_16p4q_93",ln="_scroll_16p4q_98",on="_table_16p4q_108",sn="_striped_16p4q_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)},qe=e=>e.reduce((t,a)=>a.actions&&a.actions.length>0?1:t,0),_n=(e,t)=>qe(t)>0||qe(e)>0,J=({table:e,children:t})=>{const{rows:a,infiniteScroll:l}=e,r=Math.ceil(window.innerHeight/30),[o,s]=l?V.useState(r):[a.length,null],[u,d]=l?V.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",Cn="_dragIconCell_11d5t_28",xn="_dragIcon_11d5t_28",R={clickableRow:gn,hoverableRow:yn,rowActive:fn,expandableRow:hn,flush:bn,dragIconCell:Cn,dragIcon:xn},K=({colSpan:e,children:t,flush:a})=>n.jsx("tr",{children:n.jsx("td",{colSpan:e,className:j(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 Ve=(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."),[])},Nn="_inputInTable_17dgc_1",jn="_inputHover_17dgc_13",wn="_inputFocus_17dgc_18",An="_inputError_17dgc_25",vn="_inputWarning_17dgc_26",Rn="_inputDisabled_17dgc_61",Sn="_hideScrollbars_17dgc_67",qn="_cell_17dgc_77",Vn="_disabledLink_17dgc_87",Tn="_inputWrapper_17dgc_91",En="_breakWord_17dgc_106",kn="_inputCell_17dgc_109",Wn="_sliderCell_17dgc_112",Hn="_staticCell_17dgc_116",Pn="_staticCellContent_17dgc_119",Ln="_error_17dgc_131",Dn="_warning_17dgc_132",Fn="_unit_17dgc_141",$n="_sortingCell_17dgc_144",On="_sortingCellIcon_17dgc_155",Bn="_icon_17dgc_166",Mn="_checkBoxCell_17dgc_170",Gn="_iconCellWrapper_17dgc_174",Un="_actionsCell_17dgc_178",Xn="_rightAligned_17dgc_186",Jn="_centerAligned_17dgc_192",Kn="_leftAligned_17dgc_198",zn="_popover_17dgc_201",Yn="_disabledPointerEvents_17dgc_204",i={inputInTable:Nn,inputHover:jn,inputFocus:wn,inputError:An,inputWarning:vn,inputDisabled:Rn,hideScrollbars:Sn,cell:qn,disabledLink:Vn,inputWrapper:Tn,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=V.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:j(i.staticCellContent,l?i.error:r?i.warning:""),children:n.jsx("a",{className:j((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:j(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=V.useRef(null),g={bodyAlignment:l,headerAlignment:a,isHeader:t},P=Ve(g,i),C=Ve(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=j(i.cell,L,e.hasSort?i.sortingCell:null,P,e.breakWord?i.breakWord:""),T=c??r??((o==null?void 0:o.isDragging)&&y.current&&y.current.offsetWidth)??void 0,x={width:T,minWidth:T,...u},A=t?"th":"td";return n.jsx(A,{ref:y,className:w,style:x,colSpan:d,rowSpan:p,children:n.jsx(ge,{cell:e,columnAlignment:C??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 C=V.useRef(null),L=In(o,a,t),{onRowClick:w,onRowFocus:T,onRowMouseEnter:x,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)}),q=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:C,onClick:w,onMouseEnter:x,onMouseLeave:A,onFocus:T,className:j(w?R.clickableRow:null,x?R.hoverableRow:null),children:[d?n.jsx("th",{}):null,E,q]},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:x,onMouseLeave:A,onFocus:T,className:j(w&&!w.noStyle?R.clickableRow:null,x&&!x.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,q]},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 Te=e=>{var Ie,Ne,je,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:C=null,onAddRow:L=null,bordered:w=!0,maxHeight:T,fixedWidth:x}=a,A=V.useRef(null),[I,Q]=V.useState({width:0,height:0});V.useEffect(()=>{A.current&&Q({width:A.current.offsetWidth,height:A.current.offsetHeight})},[]);const E=Fe.get(e,"table.headers",[]),q=mn(s,E),k=_n(s,E),W=q+(k?1:0),h=r?((Ne=(Ie=r==null?void 0:r.pagination)==null?void 0:Ie.rowsPerPage)==null?void 0:Ne.value)===0||Number((je=r==null?void 0:r.pagination)==null?void 0:je.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=C==null?void 0:C.cells)==null?void 0:Re.length)&&L&&h,ke={cells:v?C.cells.map((m,N)=>(m==null?void 0:m.type)==="Input"?{...m,onChange:_=>{var M;const f=(M=_==null?void 0:_.target)==null?void 0:M.value,D={...C,cells:C.cells.map((G,We)=>({...G,value:We===N?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},Ce=j(H.wrapper,w?H.bordered:""),xe={maxHeight:T,width:x,display:x==="auto"?"inline-flex":"flex"};return P?n.jsxs("div",{ref:A,className:Ce,style:xe,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(Pe,{onDragEnd:m=>{var f,D;const N=(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 N=="number"&&typeof _=="number"&&t({from:N,to:_})},children:n.jsx(Le,{droppableId:"droppable",children:m=>n.jsx(J,{table:be,children:({visibleRows:N})=>n.jsxs("table",{className:j(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:q,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p,draggableTable:P},`0_${f}`))}),n.jsxs("tbody",{children:[Z.slice(0,N).map((_,f)=>n.jsx(De,{draggableId:f+"",index:f,isDragDisabled:_.noDrag,children:(D,M)=>n.jsx(F,{rowIndex:f,row:_,columnCount:q,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:Ce,style:xe,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:j(H.table,y?H.striped:""),"data-testid":g,children:[n.jsx("thead",{children:E.map((N,_)=>n.jsx(F,{rowIndex:_,isHeader:!0,row:N,columnCount:q,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p},`0_${_}`))}),n.jsx("tbody",{children:Z.slice(0,m).map((N,_)=>n.jsx(F,{rowIndex:_,row:N,columnCount:q,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{Te.displayName="Table",Te.__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{Te as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}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 ae}from"./lodash-75c70a11.js";import{T}from"./table-
|
|
1
|
+
import{j as c}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 ae}from"./lodash-75c70a11.js";import{T}from"./table-16e7479d.js";import{C as Ge}from"./card-3847c251.js";import{I as ee}from"./input-d68625a5.js";import{F as ne}from"./field-2424dd3c.js";import{H as Je}from"./heading-61bdbf94.js";import{t as Y,a as Xe,b as Ye,c as Ze,d as en,e as nn,f as tn,g as an}from"./table.stories-data-07840afd.js";import"./index-a80ed1cf.js";import"./index.es-ed1d81bc.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-c5e1f218.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./actions-46447905.js";import"./common-types-2c81813f.js";import"./button-e6a6c574.js";import"./spinner-cb92a546.js";import"./tooltip-23e84186.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-3abf067b.js";import"./pagination-8a1d097c.js";import"./select-6b6d28f7.js";import"./assertThisInitialized-081f9914.js";import"./text-ad1f5f1d.js";import"./select.input-88b6ebab.js";import"./input-group-20c3add3.js";import"./input-group-addon-f8f6683a.js";import"./number-input-42f50494.js";import"./index-54f0d271.js";import"./check-box-73be452f.js";import"./help-icon-5be78589.js";import"./slider-cf2db7b4.js";import"./index-c7f280f6.js";import"./popover-e20a61fe.js";import"./label-0958ef3a.js";import"./flex-47732c42.js";const Jn={title:"Basic/Table",component:T,args:{table:{...Y}}},I=h=>c.jsx(T,{...h}),B=I.bind({}),N=I.bind({});N.args={table:{...Y,fixedWidth:"400px"}};const M=I.bind({});M.args={table:{...Y,fixedWidth:"auto"}};const O=I.bind({});O.args={table:Xe};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 Q=I.bind({});Q.args={table:Ye};const W=I.bind({});W.args={table:Ze};W.parameters={docs:{description:{story:"This is only required when you need to override `columnAlignment` in header cells (i.e. they have different alignment)"}}};const _=I.bind({});_.args={table:en};const U=I.bind({});U.args={table:nn};U.decorators=[h=>c.jsx("div",{style:{position:"absolute",inset:0,padding:"var(--padding)"},children:c.jsx(h,{})})];const E=I.bind({});E.args={table:tn};E.parameters={docs:{description:{story:"If a `maxHeight` is set, the table should only fill that height if it needs to."}}};const L=I.bind({});L.args={table:an};const q=()=>c.jsx(Ge,{heading:c.jsx(Je,{children:"Card heading"}),padding:!1,children:c.jsx(T,{table:{...Y,bordered:!1}})});q.parameters={docs:{source:{type:"dynamic"}}};const z=()=>{const h=["Section","Width","Height"];let m=["","m","m"],o=[...Array(175).keys()].map((a,n)=>[n,n*2,n*2]);const k=(a,n,s)=>a==="m"&&n==="ft"?s*3.28084:a==="ft"&&n==="m"?s/3.28084:s,l=(a,n,s,u)=>{o[n][s]=a.target.value,u()},C=a=>{o=o.concat([["","",""]]),a()},A=(a,n)=>{o=o.filter((s,u)=>u!==a),n()},d=(a,n,s)=>{const u=m[n],y=a.target.value;m=m.map((R,b)=>b===n?y:R),o=o.map(R=>R.map((b,g)=>g===n?k(u,y,b):b)),s()},p=()=>{const a=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[n,s]=S.useState(10),[u,y]=S.useState(1),[R,b]=S.useState(!1),g=()=>{b(!R)},F=()=>{const e=Math.ceil(o.length/n);y(e)},D=(u-1)*n,t=n===0?o.length-1:D+n,i={headers:[{cells:h.map(e=>({value:e})),actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{C(g),F()}}]},{cells:[{},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:m[1],type:"Select",native:!0,onChange:e=>d(e,1,g)},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:m[2],type:"Select",native:!0,onChange:e=>d(e,2,g)}]}],rows:o.slice(D,t).map((e,r)=>{const x=D+r;return{cells:[...Array(3).keys()].map((f,w)=>({value:e[w],type:"Input",onChange:P=>l(P,x,w,g)})),actions:[{label:"Delete",icon:"minus",onClick:()=>A(x,g)}]}}),footer:{pagination:{rowCount:o.length,selectedPage:u,rowsPerPage:{onChange:e=>{const{value:r}=e.target;s(Number(r))},options:a,value:n},onSelectPage:e=>y(e),small:!0}}};return c.jsx(T,{table:i})};return c.jsx(p,{})},G=()=>{const h=["Section","Width","Height"];let m=[...Array(175).keys()].map((k,l)=>({Section:l,Width:l*2,Height:l*2}));const o=()=>{const k=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[l,C]=S.useState(10),[A,d]=S.useState(1),[p,a]=S.useState({}),[n,s]=S.useState({});S.useEffect(()=>{d(1)},[p,n]);const u=(A-1)*l,y=l===0?m.length-1:u+l,R=(e,r,x)=>e.filter(f=>Object.keys(r).every(w=>r[w]===""?!0:f[w].toString().includes(r[w]))).sort((f,w)=>Object.entries(x).map(([P,j])=>{switch(j){case"up":return f[P]-w[P];case"down":return w[P]-f[P];default:return 0}}).reduce((P,j)=>P||j,0)),b=(e,r,x,f,w)=>{const P=e.map(v=>{const V=Object.keys(f).includes(v)?f[v]:"",H=`${v[0].toUpperCase()}${v.slice(1)}`;return{key:v,value:H,hasSort:!0,sort:V,onSort:()=>{const $=V===""?"up":V==="up"?"down":"";w({...f,[v]:$})}}}),j=e.map(v=>{const V=Object.keys(r).includes(v)?r[v]:"";return{key:v,value:V,type:"Input",placeholder:"Filter",onChange:H=>x({...r,[v]:H.target.value})}});return{dataSortCells:P,dataFilterCells:j}},{dataSortCells:g,dataFilterCells:F}=b(h,p,a,n,s),D=R(m,p,n),t=[...D.slice(u,y).map(e=>({cells:Object.entries(e).map(([x,f])=>({key:x,value:f,type:"Input",disabled:!0}))}))],i={headers:[{cells:g},{cells:F}],rows:t,footer:{pagination:{rowCount:D.length,selectedPage:A,rowsPerPage:{onChange:e=>{const{value:r}=e.target;C(Number(r))},options:k,value:l},onSelectPage:e=>d(e),small:!0}}};return c.jsx(T,{table:i})};return c.jsx(o,{})},J=()=>{const h={tea:3.6,coffee:3.2,orange:4.1},m=[{label:"Tea",value:"tea"},{label:"Coffee",value:"coffee"},{label:"Orange juice",value:"orange"}],o={cells:[{type:"Select",options:m,value:{value:"tea"}},{type:"Input"},{type:"Static"}]},k=[...Array(15).keys()].map((t,i)=>({cells:[{type:"Select",options:m,value:{value:"tea"}},{type:"Input",value:i+1},{type:"Static"}]})),[l,C]=S.useState(k),A=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[d,p]=S.useState(10),[a,n]=S.useState(1),s=(a-1)*d,u=d===0?l.length-1:s+d,y=({newRow:t}={})=>{const i=K(l,e=>{e.push(t??o)});C(i)},R=({rowIndex:t})=>{const i=K(l,e=>{delete e[t]}).filter(e=>e);C(i)},b=({rowIndex:t,value:i})=>{const e=K(l,r=>{r[t].cells[0].value.value=i});C(e)},g=({rowIndex:t,value:i})=>{const e=K(l,r=>{r[t].cells[1].value=i});C(e)},F=({value:t})=>{const i=Number(t);return!ae.isNaN(i)&&ae.isInteger(i)&&i>0},D=l.slice(s,u).map((t,i)=>{const e=s+i;return l.length-1,{...t,cells:t==null?void 0:t.cells.map((r,x)=>{var v,V,H,$,te;const f=(H=(V=(v=t==null?void 0:t.cells)==null?void 0:v[0])==null?void 0:V.value)==null?void 0:H.value,w=Number((te=($=t==null?void 0:t.cells)==null?void 0:$[1])==null?void 0:te.value),P=h==null?void 0:h[f],j=P&&F({value:w})?(P*w).toFixed(2):null;if(x===0)return{...r,onChange:Z=>b({rowIndex:e,value:Z.target.value})};if(x===1)return{...r,onChange:Z=>g({rowIndex:e,value:Z.target.value}),error:F({value:r.value})?null:"Must be valid whole number"};if(x===2)return{...r,value:j}}),actions:[{label:"Delete",icon:"minus",onClick:()=>R({rowIndex:e})}]}});return c.jsx(T,{table:{defaultEmptyRow:o,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:l.length,selectedPage:a,rowsPerPage:{onChange:t=>{const{value:i}=t.target;p(Number(i))},options:A,value:d},onSelectPage:t=>n(t),small:!0}}}})},X=()=>{const h=["Section","Width","Height"];let m=Array.from(Array(10),(d,p)=>[p,p*2,p*2]);const[o,k]=S.useState({pastedValues:"",rowIndex:0,cellIndex:0}),l=(d,p,a,n)=>{m[p][a]=Number(d.target.value),n()},C=(d,p,a,n)=>{var u;let s=((u=d==null?void 0:d.clipboardData)==null?void 0:u.getData("text"))??"";return k({rowIndex:p,cellIndex:a,pastedValues:s}),n(),{pastedData:o}},A=()=>{const[d,p]=S.useState(!1),a=()=>{p(!d)},n={headers:[{cells:h.map(s=>({value:s}))}],rows:m.map((s,u)=>{const y=u;return{cells:[...Array(3).keys()].map((R,b)=>({value:s[b],type:"Input",onChange:g=>l(g,y,b,a),onPaste:g=>C(g,y,b,a)}))}})};return c.jsxs(c.Fragment,{children:[c.jsx(T,{table:n}),c.jsx(ne,{label:"Pasted Data",children:c.jsx(ee,{value:o.pastedValues})}),c.jsx(ne,{label:"At Row",children:c.jsx(ee,{value:o.rowIndex})}),c.jsx(ne,{label:"At Cell Index",children:c.jsx(ee,{value:o.cellIndex})})]})};return c.jsx(A,{})};var re,se,oe;B.parameters={...B.parameters,docs:{...(re=B.parameters)==null?void 0:re.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-
|
|
1
|
+
import{j as B}from"./jsx-runtime-f961835c.js";import{T as X}from"./table-16e7479d.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-07840afd.js";import"./index-f80c8c95.js";import"./index-a80ed1cf.js";import"./index.es-ed1d81bc.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-c5e1f218.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./lodash-75c70a11.js";import"./actions-46447905.js";import"./common-types-2c81813f.js";import"./button-e6a6c574.js";import"./spinner-cb92a546.js";import"./tooltip-23e84186.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-3abf067b.js";import"./heading-61bdbf94.js";import"./help-icon-5be78589.js";import"./pagination-8a1d097c.js";import"./select-6b6d28f7.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-42f50494.js";import"./index-54f0d271.js";import"./check-box-73be452f.js";import"./slider-cf2db7b4.js";import"./index-c7f280f6.js";import"./popover-e20a61fe.js";import"./flex-47732c42.js";const Xr={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 +1 @@
|
|
|
1
|
-
:root{--color-background-toggle: rgba(0, 0, 0, .2);--color-background-toggle-hover: rgba(0, 0, 0, .25)}[data-theme=dark]{--color-background-toggle: rgba(255, 255, 255, .2);--color-background-toggle-hover: rgba(255, 255, 255, .3)}.
|
|
1
|
+
:root{--color-background-toggle: rgba(0, 0, 0, .2);--color-background-toggle-hover: rgba(0, 0, 0, .25)}[data-theme=dark]{--color-background-toggle: rgba(255, 255, 255, .2);--color-background-toggle-hover: rgba(255, 255, 255, .3)}._toggle_3ujcm_9{--size-toggle: var(--size-xs);position:relative;display:inline-flex;align-items:center;gap:var(--padding-xxs);backface-visibility:hidden;outline:0;vertical-align:baseline;font-style:normal;min-height:var(--size-toggle);font-size:inherit;line-height:var(--size-toggle);min-width:var(--size-toggle);margin:calc((var(--size) - var(--size-toggle)) / 2) 0}._toggle_3ujcm_9._small_3ujcm_25{--size-toggle: calc(var(--size-xs) - 4px);margin:calc((var(--size-sm) - var(--size-toggle)) / 2) 0;font-size:var(--font-size-sm)}._toggle_3ujcm_9 input{width:calc(var(--size-toggle) * 2);height:var(--size-toggle);cursor:pointer;position:absolute;top:0;left:0;opacity:0!important;outline:0;z-index:3;box-sizing:border-box;padding:0;overflow:visible;font-family:sans-serif;margin:0}._toggle_3ujcm_9 label{min-height:var(--size-toggle);padding-left:calc((var(--size-toggle) * 2) + var(--padding-xs));transition:color .1s ease;cursor:auto;position:relative;display:block;outline:0}._toggle_3ujcm_9 label:empty{padding-left:calc(var(--size-toggle) * 2)}._toggle_3ujcm_9 label:before,._toggle_3ujcm_9 label:after{display:block;position:absolute;content:""}._toggle_3ujcm_9 label:before{height:var(--size-toggle);border-radius:calc(var(--size-toggle) / 2);z-index:1;transform:none;background:var(--color-background-toggle);box-shadow:none;width:calc(var(--size-toggle) * 2);left:0;top:0;transition:background .3s ease,border .1s ease,opacity .1s ease,transform .1s ease,box-shadow .1s ease}._toggle_3ujcm_9 label:after{height:calc(var(--size-toggle) - 4px);width:calc(var(--size-toggle) - 4px);border-radius:50%;left:2px;top:50%;transform:translateY(-50%);box-shadow:var(--shadow-button);background:white;opacity:1;z-index:2;transition:background .3s ease,left .3s ease}._toggle_3ujcm_9 input:hover~label:before{background:var(--color-background-toggle-hover)}._toggle_3ujcm_9 input:checked~label:before{background-color:var(--color-background-button-primary)}._toggle_3ujcm_9 input:checked~label:after{left:calc(var(--size-toggle) + 2px)}._toggle_3ujcm_9 input:checked:hover~label:before{background-color:var(--color-background-button-primary-hover)}._toggle_3ujcm_9._disabled_3ujcm_101{cursor:default;pointer-events:none;color:var(--color-text-faint)}._toggle_3ujcm_9._disabled_3ujcm_101 label:before{background-color:var(--color-background-disabled)}._toggle_3ujcm_9._disabled_3ujcm_101 label:after{opacity:.4}._noMargin_3ujcm_112{margin:0}._helpIconEnabled_3ujcm_115{pointer-events:auto}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as l}from"./jsx-runtime-f961835c.js";import{r as b}from"./index-f80c8c95.js";import{c as y}from"./index-a80ed1cf.js";import{b as x}from"./common-types-2c81813f.js";import{D as C}from"./disabled-context-d654f6ff.js";import{H as j}from"./help-icon-5be78589.js";const E="_toggle_3ujcm_9",h="_small_3ujcm_25",q="_disabled_3ujcm_101",I="_noMargin_3ujcm_112",V="_helpIconEnabled_3ujcm_115",a={toggle:E,small:h,disabled:q,noMargin:I,helpIconEnabled:V},i=({name:t,label:d,checked:e=!1,disabled:u,small:m=!1,onChange:p,noMargin:c=!1,testId:g,helpText:o,onClickHelp:r})=>{const f=b.useContext(C),_=o||r,s=u||f;return l.jsxs("div",{className:y(a.toggle,s?a.disabled:null,m?a.small:null,c?a.noMargin:null),onClick:n=>{s||(n.target.name=t,n.target.checked=!e,n.target.value=!e,p(n))},"data-testid":g,children:[l.jsx("input",{type:x.CHECKBOX,name:t,value:e==null?void 0:e.toString(),disabled:s,checked:e,onChange:()=>{}}),l.jsx("label",{children:d}),_&&l.jsx("div",{className:a.helpIconEnabled,onClick:r,children:l.jsx(j,{text:o})})]})};try{i.displayName="Toggle",i.__docgenInfo={description:"",displayName:"Toggle",props:{name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},label:{defaultValue:null,description:"",name:"label",required:!1,type:{name:"string | ReactElement<any, string | JSXElementConstructor<any>> | null"}},checked:{defaultValue:{value:"false"},description:"",name:"checked",required:!1,type:{name:"boolean"}},disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"boolean"}},small:{defaultValue:{value:"false"},description:"",name:"small",required:!1,type:{name:"boolean"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!0,type:{name:"(evt: ChangeEvent<HTMLInputElement>) => void"}},noMargin:{defaultValue:{value:"false"},description:"",name:"noMargin",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}},helpText:{defaultValue:null,description:"",name:"helpText",required:!1,type:{name:"string"}},onClickHelp:{defaultValue:null,description:"",name:"onClickHelp",required:!1,type:{name:"((evt: any) => void)"}}}}}catch{}export{i as T};
|