@oliasoft-open-source/react-ui-library 4.10.1-beta-1 → 4.10.1-beta-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/global.css +60 -53
- package/dist/index.js +136 -185
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/{Color-KGDBMAHA-BKjenJg6.js → Color-KGDBMAHA-CkgwyT0N.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-PKQXORMH-C2T7m4eo.js → DocsRenderer-PKQXORMH-oAAOHN-C.js} +1 -1
- package/dist/storybook/assets/{accordion.stories-DYWwH-nb.js → accordion.stories-Cwzj5gr0.js} +1 -1
- package/dist/storybook/assets/{buttons-and-links-DvzJXTiI.js → buttons-and-links-Buoa2iwA.js} +1 -1
- package/dist/storybook/assets/{casing-loads.stories-CS3UEFRb.js → casing-loads.stories-Bf2hKInT.js} +1 -1
- package/dist/storybook/assets/{cell.stories-DC0iukzz.js → cell.stories-lr1YhwEl.js} +1 -1
- package/dist/storybook/assets/{chunk-HLWAVYOI-BjTw4qro.js → chunk-HLWAVYOI-BHCx7ia6.js} +1 -1
- package/dist/storybook/assets/{color-P_umYTX_.js → color-DAEtgSoL.js} +1 -1
- package/dist/storybook/assets/{footer.stories-BGebD8DA.js → footer.stories-DWGqaJbs.js} +1 -1
- package/dist/storybook/assets/{formation.stories-CSRmoL6O.js → formation.stories-CfXwQfRl.js} +1 -1
- package/dist/storybook/assets/{iframe-D3Y4UHkr.js → iframe-DuJjppX2.js} +2 -2
- package/dist/storybook/assets/{index-D64MwP-f.js → index-BJf4XCAG.js} +1 -1
- package/dist/storybook/assets/{index-fzFtvz6M.js → index-ds5tI1R2.js} +4 -4
- package/dist/storybook/assets/{input-validation-DRAbj6PG.js → input-validation-BmfYx2P4.js} +1 -1
- package/dist/storybook/assets/{inputs-Bsw0dZrv.js → inputs-CgNOu3sy.js} +1 -1
- package/dist/storybook/assets/{layout-forms-Crl8l1Fb.js → layout-forms-Bv2METR5.js} +1 -1
- package/dist/storybook/assets/{layout-general-CNSlTZ6G.js → layout-general-pBLj8gsZ.js} +1 -1
- package/dist/storybook/assets/{padding-and-spacing-CL4N967X.js → padding-and-spacing-Bgosh0O8.js} +1 -1
- package/dist/storybook/assets/{preview-DL9T_bF-.js → preview-BfauereQ.js} +2 -2
- package/dist/storybook/assets/{preview-CqKyK4JL.js → preview-Cn3hDbd5.js} +1 -1
- package/dist/storybook/assets/{rich-text-input.stories-hAHCnDHk.js → rich-text-input.stories-DkaOBgbE.js} +46 -46
- package/dist/storybook/assets/{row.stories-C6aRnuL5.js → row.stories-D48CKwrs.js} +1 -1
- package/dist/storybook/assets/{table-C9uAiJu6.css → table-B8ojy8Nj.css} +1 -1
- package/dist/storybook/assets/table-D2bws-Po.js +86 -0
- package/dist/storybook/assets/{table.stories-BsPbkctl.js → table.stories-DMaFYF-x.js} +1 -1
- package/dist/storybook/assets/{table.stories-data-D52aKMY1.js → table.stories-data-C3vJedB1.js} +1 -1
- package/dist/storybook/assets/{title.stories-wr63QEGT.js → title.stories-Net03xNL.js} +1 -1
- package/dist/storybook/assets/unit-input.stories-Dq7teE0t.js +403 -0
- package/dist/storybook/assets/{unit-table.stories-CbAekNaE.js → unit-table.stories-BBfG_eDi.js} +1 -1
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/sb-manager/globals-runtime.js +1 -1
- package/package.json +1 -1
- package/dist/storybook/assets/table-Dh7Es_V6.js +0 -86
- package/dist/storybook/assets/unit-input.stories-2K9MHmw_.js +0 -394
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-eps93zm2.js";import{r as D}from"./index-DhsZuJvc.js";import{T as g}from"./table-
|
|
1
|
+
import{j as o}from"./jsx-runtime-eps93zm2.js";import{r as D}from"./index-DhsZuJvc.js";import{T as g}from"./table-D2bws-Po.js";import{T as z}from"./text-B3-TSWok.js";import{t as R,s as G,u as J,v as K,w as Q}from"./table.stories-data-C3vJedB1.js";import"./index-Bk2sglWO.js";import"./index.es-DazXb-ul.js";import"./inheritsLoose-DP0QEDDI.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./index-CUZDtIZe.js";import"./memoize-one.esm-CcMeOnPo.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./lodash-c4VUpsOs.js";import"./actions-D-uVCDzk.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./index-CEuq6vkz.js";import"./tooltip-1V7clEnw.js";import"./types-BmbYqTX_.js";import"./types-Dx2TtIG9.js";import"./badge-CLQ59MDF.js";import"./heading-CRNoBc7q.js";import"./help-icon-Buhx5nl6.js";import"./pagination-CLt-kUlx.js";import"./select-DnRuRG_N.js";import"./assertThisInitialized-B9jnkVVz.js";import"./select.input-D0UkAPd9.js";import"./input-DTXbDJaL.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./number-input-B25TXDQC.js";import"./index-C0x1JmaP.js";import"./index-DRSy5Ssd.js";import"./check-box-DPLaOkRR.js";import"./slider-C7vnj_3M.js";import"./index-BI4_Bp97.js";import"./popover-rq33c1W2.js";import"./flex-EllkLxgO.js";const Ie={title:"Basic/Table/Row",component:g,args:{table:{...R}}},v=n=>o.jsx(g,{...n}),i=v.bind({});i.args={table:G};const p=v.bind({});p.args={table:J};const c=v.bind({});c.args={table:K};const d=v.bind({});d.args={table:Q};const t=v.bind({});t.args={table:{...R,striped:!1}};t.parameters={docs:{description:{story:"`striped: false` removes tinted background on alternative rows."}}};const u=()=>{const[n,e]=D.useState(null),a=r=>e(n===r?null:r);return o.jsx(g,{table:{...R,striped:!1,rows:R.rows.map((r,x)=>({...r,onRowClick:()=>a(x),expandedContent:{content:n===x?o.jsx("div",{children:"Example expanded content"}):null}}))}})},m=()=>{const n={draggable:!0,headers:[{cells:[{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"}]}],rows:[{noDrag:!0,cells:[{value:"Undraggable"},{value:100},{value:361},{value:"Vietnam"}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"}]}]},e=(s,b,l)=>{const y=[...s];return s[l].noDrag?s:(y.splice(l,0,y.splice(b,1)[0]),y)},[a,r]=D.useState(n.rows),x=s=>{const{to:b,from:l}=s;e(a,l,b),r(e(a,l,b))};return o.jsx(g,{table:{...n,rows:a},onListReorder:x})},w=()=>{const[n,e]=D.useState("Hover any row!"),a=[1,2,3,4,5].map(r=>({cells:[{value:`Row ${r}`},{value:`${r**2}`}],onRowMouseEnter:()=>e(`Hovering row ${r}`),onRowMouseLeave:()=>e("Not hovering any row...")}));return o.jsxs(o.Fragment,{children:[o.jsx(z,{children:n}),o.jsx(g,{table:{fixedWidth:"100%",headers:[{cells:[{value:"Description"},{value:"Value"}],onRowMouseEnter:()=>e("Hovering header row"),onRowMouseLeave:()=>e("Not hovering any row...")}],rows:a}})]})};u.__docgenInfo={description:"",methods:[],displayName:"Expandable"};m.__docgenInfo={description:"",methods:[],displayName:"DragAndDrop"};w.__docgenInfo={description:"",methods:[],displayName:"OnRowEnter"};var E,h,T;i.parameters={...i.parameters,docs:{...(E=i.parameters)==null?void 0:E.docs,source:{originalSource:`args => {
|
|
2
2
|
return <Table
|
|
3
3
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4
4
|
{...args} />;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._inputInTable_k0mvt_1{background-color:transparent;border-radius:inherit!important;height:var(--size);min-height:100%}._inputInTable_k0mvt_1:not(:hover):not(._error_k0mvt_7):not(._warning_k0mvt_7){border-color:transparent}._inputInTable_k0mvt_1:not(:focus){box-shadow:none}._inputHover_k0mvt_13{position:relative;border-color:var(--color-border-hover);z-index:2}._inputFocus_k0mvt_18{position:relative;outline:none!important;border-color:var(--color-border-focus)!important;box-shadow:var(--shadow-focus);z-index:3}._inputError_k0mvt_25,._inputWarning_k0mvt_26{position:relative}._inputError_k0mvt_25{z-index:2;border-color:var(--color-border-error);color:var(--color-text-error)!important;background-color:var(--color-background-error-muted)}._inputError_k0mvt_25:hover{border-color:var(--color-border-error-hover)!important}._inputError_k0mvt_25:focus{position:relative;outline:none!important;border-color:var(--color-border-focus)!important;box-shadow:var(--shadow-focus);z-index:3}._inputWarning_k0mvt_26{z-index:1;border-color:var(--color-border-warning);color:var(--color-text-warning)!important;background-color:var(--color-background-warning-muted)}._inputWarning_k0mvt_26:hover{border-color:var(--color-border-warning-hover)!important}._inputWarning_k0mvt_26:focus{position:relative;outline:none!important;border-color:var(--color-border-focus)!important;box-shadow:var(--shadow-focus);z-index:3}._inputDisabled_k0mvt_61{pointer-events:none;background-color:var(--color-background-disabled);color:var(--color-text-muted);box-shadow:none}._hideScrollbars_k0mvt_67{scrollbar-width:none;-ms-overflow-style:none}._hideScrollbars_k0mvt_67::-webkit-scrollbar{display:none}:root{--color-background-table-header: var(--color-neutral-150);--color-background-table-row-tinted: var(--color-neutral-50)}html[data-theme=dark]{--color-background-table-header: var(--color-neutral-800);--color-background-table-row-tinted: var(--color-neutral-800)}._wrapper_k0mvt_85{border-radius:inherit;max-height:100%;max-width:100%;display:flex;flex-direction:column;overflow:hidden}._wrapper_k0mvt_85._bordered_k0mvt_93{border-radius:var(--border-radius);border:1px solid var(--color-border);box-shadow:var(--shadow-card)}._scroll_k0mvt_98{overflow-y:auto;border-radius:inherit;flex:1;min-height:0}._scroll_k0mvt_98:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}._table_k0mvt_108{background:var(--color-background-raised);color:var(--color-text);border-collapse:separate;border-spacing:0;border-radius:inherit;width:100%;font-variant-numeric:tabular-nums}._table_k0mvt_108>:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}._table_k0mvt_108>:first-child>:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}._table_k0mvt_108>:first-child>:first-child>:first-child{border-top-left-radius:inherit}._table_k0mvt_108>:first-child>:first-child>:last-child{border-top-right-radius:inherit}._table_k0mvt_108>:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}._table_k0mvt_108>:last-child>:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}._table_k0mvt_108>:last-child>:last-child>:first-child{border-bottom-left-radius:inherit}._table_k0mvt_108>:last-child>:last-child>:last-child{border-bottom-right-radius:inherit}th,td{padding:var(--padding-input)!important;height:var(--size);background:inherit;border-color:var(--color-border);border-style:solid;border-width:0}th:not(:first-child),td:not(:first-child){border-left-width:1px}._table_k0mvt_108>*:not(:last-child)>tr th,._table_k0mvt_108>*:not(:last-child)>tr td,._table_k0mvt_108>*:last-child>tr:not(:last-child) th,._table_k0mvt_108>*:last-child>tr:not(:last-child) td{border-bottom-width:1px}@-moz-document url-prefix(){tr{height:var(--size)}td,th{height:100%}}thead{position:sticky;top:0;overflow:hidden;z-index:5}thead tr{background-color:var(--color-background-table-header)}tbody{overflow:hidden}tbody tr{background-color:var(--color-background-raised)}._striped_k0mvt_188 tbody tr:nth-child(2n){background-color:var(--color-background-table-row-tinted)}._title_zn5s7_1{background-color:var(--color-background-cardheader);border-bottom:1px solid var(--color-border);padding:var(--padding-xxs) var(--padding-sm);display:flex;align-items:center;justify-content:space-between;gap:4px;width:100%;border-top-left-radius:inherit;border-top-right-radius:inherit;flex-shrink:0}._footer_4sumy_1{background-color:var(--color-background-table-header);z-index:4;overflow:hidden;flex-shrink:0}._section_4sumy_7{padding:var(--padding-input);display:flex;align-items:center;justify-content:space-between;border-top:1px solid var(--color-border)}._clickableRow_1ki29_1{cursor:pointer}._hoverableRow_1ki29_4:not(._rowActive_1ki29_4):hover,._clickableRow_1ki29_1:not(._rowActive_1ki29_4):hover{background-color:var(--color-background-listitem-hover)!important}._expandableRow_1ki29_8._flush_1ki29_8{padding:0!important;height:auto!important}._errorRow_1ki29_12{background-color:var(--color-background-error-muted)!important}._warningRow_1ki29_15{background-color:var(--color-background-warning-muted)!important}._rowActive_1ki29_4{position:relative;background-color:var(--color-background-listitem-active)!important}._rowActive_1ki29_4:after{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;border-top-left-radius:inherit;border-bottom-left-radius:inherit;transition:background .3s;background:var(--color-background-primary)}._dragIconCell_1ki29_34{width:var(--size);min-width:var(--size);position:relative}._dragIcon_1ki29_34{display:flex;align-items:center;justify-content:center;position:absolute;top:0;right:0;bottom:0;left:0;color:var(--color-text-faint)}._dragIcon_1ki29_34:hover{color:var(--color-text-primary-hover)}._dragIcon_1ki29_34:active{color:var(--color-text-primary-active)}._inputInTable_1rtjr_1{background-color:transparent;border-radius:inherit!important;height:var(--size);min-height:100%}._inputInTable_1rtjr_1:not(:hover):not(._error_1rtjr_7):not(._warning_1rtjr_7){border-color:transparent}._inputInTable_1rtjr_1:not(:focus){box-shadow:none}._inputHover_1rtjr_13{position:relative;border-color:var(--color-border-hover);z-index:2}._inputFocus_1rtjr_18{position:relative;outline:none!important;border-color:var(--color-border-focus)!important;box-shadow:var(--shadow-focus);z-index:3}._inputError_1rtjr_25,._inputWarning_1rtjr_26{position:relative}._inputError_1rtjr_25{z-index:2;border-color:var(--color-border-error);color:var(--color-text-error)!important;background-color:var(--color-background-error-muted)}._inputError_1rtjr_25:hover{border-color:var(--color-border-error-hover)!important}._inputError_1rtjr_25:focus{position:relative;outline:none!important;border-color:var(--color-border-focus)!important;box-shadow:var(--shadow-focus);z-index:3}._inputWarning_1rtjr_26{z-index:1;border-color:var(--color-border-warning);color:var(--color-text-warning)!important;background-color:var(--color-background-warning-muted)}._inputWarning_1rtjr_26:hover{border-color:var(--color-border-warning-hover)!important}._inputWarning_1rtjr_26:focus{position:relative;outline:none!important;border-color:var(--color-border-focus)!important;box-shadow:var(--shadow-focus);z-index:3}._inputDisabled_1rtjr_61{pointer-events:none;background-color:var(--color-background-disabled);color:var(--color-text-muted);box-shadow:none}._hideScrollbars_1rtjr_67{scrollbar-width:none;-ms-overflow-style:none}._hideScrollbars_1rtjr_67::-webkit-scrollbar{display:none}._cell_1rtjr_77 a{cursor:pointer;color:var(--color-text-primary)}._cell_1rtjr_77 a:hover{color:var(--color-text-primary-hover)}._cell_1rtjr_77 a:active{color:var(--color-text-primary-active)}._cell_1rtjr_77 a._disabledLink_1rtjr_87{color:var(--color-text-faint)!important;cursor:default!important}._inputWrapper_1rtjr_91{height:100%;border-radius:inherit}._inputWrapper_1rtjr_91>span,._inputWrapper_1rtjr_91>span>span,._inputWrapper_1rtjr_91>span>span>div{height:100%;border-radius:inherit}._inputWrapper_1rtjr_91>div,._inputWrapper_1rtjr_91>div>span{height:100%;border-radius:inherit}._breakWord_1rtjr_106{word-break:break-word}._inputCell_1rtjr_109{padding:0!important}._sliderCell_1rtjr_112{padding-top:0!important;padding-bottom:0!important}._staticCell_1rtjr_116{padding:0!important}._staticCell_1rtjr_116 ._staticCellContent_1rtjr_119{line-height:1.25;min-height:100%;padding:var(--padding-input);position:relative;border-radius:inherit;display:flex;align-items:center}tbody ._staticCell_1rtjr_116 ._staticCellContent_1rtjr_119{color:var(--color-text-muted)}._staticCell_1rtjr_116 ._staticCellContent_1rtjr_119._error_1rtjr_7,._staticCell_1rtjr_116 ._staticCellContent_1rtjr_119._warning_1rtjr_7{border:1px solid transparent}._staticCell_1rtjr_116 ._staticCellContent_1rtjr_119._error_1rtjr_7{background-color:var(--color-background-error-muted)}._staticCell_1rtjr_116 ._staticCellContent_1rtjr_119._warning_1rtjr_7{background-color:var(--color-background-warning-muted)}._staticCell_1rtjr_116 ._staticCellContent_1rtjr_119._unit_1rtjr_141{font-weight:400}._sortingCell_1rtjr_144 ._staticCellContent_1rtjr_119{position:relative;padding-right:calc(var(--size) + var(--padding-xxs))!important;cursor:pointer!important}._sortingCell_1rtjr_144 ._staticCellContent_1rtjr_119:hover{background-color:#0000000d!important}[data-theme=dark] ._sortingCell_1rtjr_144 ._staticCellContent_1rtjr_119:hover{background-color:#ffffff1a!important}._sortingCell_1rtjr_144 ._sortingCellIcon_1rtjr_155{font-size:var(--size-xs);position:absolute;right:var(--padding-input-x);top:50%;transform:translateY(-50%);display:flex}._sortingCell_1rtjr_144 ._sortingCellIcon_1rtjr_155>*{display:flex}._icon_1rtjr_166{display:inline-flex;margin-left:var(--padding-xxs)}._checkBoxCell_1rtjr_170{padding-block:0!important;width:var(--size)}._iconCellWrapper_1rtjr_174{display:flex;justify-content:center}._actionsCell_1rtjr_178{width:var(--size-sm);padding:0 calc((var(--size) - var(--size-sm)) / 2)!important;position:sticky;right:0;background:inherit;z-index:4}._rightAligned_1rtjr_186{text-align:right!important}._rightAligned_1rtjr_186 ._staticCellContent_1rtjr_119{justify-content:flex-end}._centerAligned_1rtjr_192{text-align:center!important}._centerAligned_1rtjr_192 ._staticCellContent_1rtjr_119{justify-content:center}._leftAligned_1rtjr_198{text-align:left!important}._popover_1rtjr_201{padding:var(--padding-input)}._disabledPointerEvents_1rtjr_204{pointer-events:none}
|
|
1
|
+
._inputInTable_k0mvt_1{background-color:transparent;border-radius:inherit!important;height:var(--size);min-height:100%}._inputInTable_k0mvt_1:not(:hover):not(._error_k0mvt_7):not(._warning_k0mvt_7){border-color:transparent}._inputInTable_k0mvt_1:not(:focus){box-shadow:none}._inputHover_k0mvt_13{position:relative;border-color:var(--color-border-hover);z-index:2}._inputFocus_k0mvt_18{position:relative;outline:none!important;border-color:var(--color-border-focus)!important;box-shadow:var(--shadow-focus);z-index:3}._inputError_k0mvt_25,._inputWarning_k0mvt_26{position:relative}._inputError_k0mvt_25{z-index:2;border-color:var(--color-border-error);color:var(--color-text-error)!important;background-color:var(--color-background-error-muted)}._inputError_k0mvt_25:hover{border-color:var(--color-border-error-hover)!important}._inputError_k0mvt_25:focus{position:relative;outline:none!important;border-color:var(--color-border-focus)!important;box-shadow:var(--shadow-focus);z-index:3}._inputWarning_k0mvt_26{z-index:1;border-color:var(--color-border-warning);color:var(--color-text-warning)!important;background-color:var(--color-background-warning-muted)}._inputWarning_k0mvt_26:hover{border-color:var(--color-border-warning-hover)!important}._inputWarning_k0mvt_26:focus{position:relative;outline:none!important;border-color:var(--color-border-focus)!important;box-shadow:var(--shadow-focus);z-index:3}._inputDisabled_k0mvt_61{pointer-events:none;background-color:var(--color-background-disabled);color:var(--color-text-muted);box-shadow:none}._hideScrollbars_k0mvt_67{scrollbar-width:none;-ms-overflow-style:none}._hideScrollbars_k0mvt_67::-webkit-scrollbar{display:none}:root{--color-background-table-header: var(--color-neutral-150);--color-background-table-row-tinted: var(--color-neutral-50)}html[data-theme=dark]{--color-background-table-header: var(--color-neutral-800);--color-background-table-row-tinted: var(--color-neutral-800)}._wrapper_k0mvt_85{border-radius:inherit;max-height:100%;max-width:100%;display:flex;flex-direction:column;overflow:hidden}._wrapper_k0mvt_85._bordered_k0mvt_93{border-radius:var(--border-radius);border:1px solid var(--color-border);box-shadow:var(--shadow-card)}._scroll_k0mvt_98{overflow-y:auto;border-radius:inherit;flex:1;min-height:0}._scroll_k0mvt_98:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}._table_k0mvt_108{background:var(--color-background-raised);color:var(--color-text);border-collapse:separate;border-spacing:0;border-radius:inherit;width:100%;font-variant-numeric:tabular-nums}._table_k0mvt_108>:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}._table_k0mvt_108>:first-child>:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}._table_k0mvt_108>:first-child>:first-child>:first-child{border-top-left-radius:inherit}._table_k0mvt_108>:first-child>:first-child>:last-child{border-top-right-radius:inherit}._table_k0mvt_108>:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}._table_k0mvt_108>:last-child>:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}._table_k0mvt_108>:last-child>:last-child>:first-child{border-bottom-left-radius:inherit}._table_k0mvt_108>:last-child>:last-child>:last-child{border-bottom-right-radius:inherit}th,td{padding:var(--padding-input)!important;height:var(--size);background:inherit;border-color:var(--color-border);border-style:solid;border-width:0}th:not(:first-child),td:not(:first-child){border-left-width:1px}._table_k0mvt_108>*:not(:last-child)>tr th,._table_k0mvt_108>*:not(:last-child)>tr td,._table_k0mvt_108>*:last-child>tr:not(:last-child) th,._table_k0mvt_108>*:last-child>tr:not(:last-child) td{border-bottom-width:1px}@-moz-document url-prefix(){tr{height:var(--size)}td,th{height:100%}}thead{position:sticky;top:0;overflow:hidden;z-index:5}thead tr{background-color:var(--color-background-table-header)}tbody{overflow:hidden}tbody tr{background-color:var(--color-background-raised)}._striped_k0mvt_188 tbody tr:nth-child(2n){background-color:var(--color-background-table-row-tinted)}._title_zn5s7_1{background-color:var(--color-background-cardheader);border-bottom:1px solid var(--color-border);padding:var(--padding-xxs) var(--padding-sm);display:flex;align-items:center;justify-content:space-between;gap:4px;width:100%;border-top-left-radius:inherit;border-top-right-radius:inherit;flex-shrink:0}._footer_4sumy_1{background-color:var(--color-background-table-header);z-index:4;overflow:hidden;flex-shrink:0}._section_4sumy_7{padding:var(--padding-input);display:flex;align-items:center;justify-content:space-between;border-top:1px solid var(--color-border)}._clickableRow_1ki29_1{cursor:pointer}._hoverableRow_1ki29_4:not(._rowActive_1ki29_4):hover,._clickableRow_1ki29_1:not(._rowActive_1ki29_4):hover{background-color:var(--color-background-listitem-hover)!important}._expandableRow_1ki29_8._flush_1ki29_8{padding:0!important;height:auto!important}._errorRow_1ki29_12{background-color:var(--color-background-error-muted)!important}._warningRow_1ki29_15{background-color:var(--color-background-warning-muted)!important}._rowActive_1ki29_4{position:relative;background-color:var(--color-background-listitem-active)!important}._rowActive_1ki29_4:after{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;border-top-left-radius:inherit;border-bottom-left-radius:inherit;transition:background .3s;background:var(--color-background-primary)}._dragIconCell_1ki29_34{width:var(--size);min-width:var(--size);position:relative}._dragIcon_1ki29_34{display:flex;align-items:center;justify-content:center;position:absolute;top:0;right:0;bottom:0;left:0;color:var(--color-text-faint)}._dragIcon_1ki29_34:hover{color:var(--color-text-primary-hover)}._dragIcon_1ki29_34:active{color:var(--color-text-primary-active)}._inputInTable_9hq13_1{background-color:transparent;border-radius:inherit!important;height:var(--size);min-height:100%}._inputInTable_9hq13_1:not(:hover):not(._error_9hq13_7):not(._warning_9hq13_7){border-color:transparent}._inputInTable_9hq13_1:not(:focus){box-shadow:none}._inputHover_9hq13_13{position:relative;border-color:var(--color-border-hover);z-index:2}._inputFocus_9hq13_18{position:relative;outline:none!important;border-color:var(--color-border-focus)!important;box-shadow:var(--shadow-focus);z-index:3}._inputError_9hq13_25,._inputWarning_9hq13_26{position:relative}._inputError_9hq13_25{z-index:2;border-color:var(--color-border-error);color:var(--color-text-error)!important;background-color:var(--color-background-error-muted)}._inputError_9hq13_25:hover{border-color:var(--color-border-error-hover)!important}._inputError_9hq13_25:focus{position:relative;outline:none!important;border-color:var(--color-border-focus)!important;box-shadow:var(--shadow-focus);z-index:3}._inputWarning_9hq13_26{z-index:1;border-color:var(--color-border-warning);color:var(--color-text-warning)!important;background-color:var(--color-background-warning-muted)}._inputWarning_9hq13_26:hover{border-color:var(--color-border-warning-hover)!important}._inputWarning_9hq13_26:focus{position:relative;outline:none!important;border-color:var(--color-border-focus)!important;box-shadow:var(--shadow-focus);z-index:3}._inputDisabled_9hq13_61{pointer-events:none;background-color:var(--color-background-disabled);color:var(--color-text-muted);box-shadow:none}._hideScrollbars_9hq13_67{scrollbar-width:none;-ms-overflow-style:none}._hideScrollbars_9hq13_67::-webkit-scrollbar{display:none}._cell_9hq13_77 a{cursor:pointer;color:var(--color-text-primary)}._cell_9hq13_77 a:hover{color:var(--color-text-primary-hover)}._cell_9hq13_77 a:active{color:var(--color-text-primary-active)}._cell_9hq13_77 a._disabledLink_9hq13_87{color:var(--color-text-faint)!important;cursor:default!important}._inputWrapper_9hq13_91{height:100%;border-radius:inherit}._inputWrapper_9hq13_91>span,._inputWrapper_9hq13_91>span>span,._inputWrapper_9hq13_91>span>span>div{height:100%;border-radius:inherit}._inputWrapper_9hq13_91>div,._inputWrapper_9hq13_91>div>span{height:100%;border-radius:inherit}._numberInputWrapper_9hq13_106>span,._numberInputWrapper_9hq13_106>span>div,._numberInputWrapper_9hq13_106>span>div>span{display:block;height:100%;border-radius:inherit}._breakWord_9hq13_113{word-break:break-word}._inputCell_9hq13_116{padding:0!important}._sliderCell_9hq13_119{padding-top:0!important;padding-bottom:0!important}._staticCell_9hq13_123{padding:0!important}._staticCell_9hq13_123 ._staticCellContent_9hq13_126{line-height:1.25;min-height:100%;padding:var(--padding-input);position:relative;border-radius:inherit;display:flex;align-items:center}tbody ._staticCell_9hq13_123 ._staticCellContent_9hq13_126{color:var(--color-text-muted)}._staticCell_9hq13_123 ._staticCellContent_9hq13_126._error_9hq13_7,._staticCell_9hq13_123 ._staticCellContent_9hq13_126._warning_9hq13_7{border:1px solid transparent}._staticCell_9hq13_123 ._staticCellContent_9hq13_126._error_9hq13_7{background-color:var(--color-background-error-muted)}._staticCell_9hq13_123 ._staticCellContent_9hq13_126._warning_9hq13_7{background-color:var(--color-background-warning-muted)}._staticCell_9hq13_123 ._staticCellContent_9hq13_126._unit_9hq13_148{font-weight:400}._sortingCell_9hq13_151 ._staticCellContent_9hq13_126{position:relative;padding-right:calc(var(--size) + var(--padding-xxs))!important;cursor:pointer!important}._sortingCell_9hq13_151 ._staticCellContent_9hq13_126:hover{background-color:#0000000d!important}[data-theme=dark] ._sortingCell_9hq13_151 ._staticCellContent_9hq13_126:hover{background-color:#ffffff1a!important}._sortingCell_9hq13_151 ._sortingCellIcon_9hq13_162{font-size:var(--size-xs);position:absolute;right:var(--padding-input-x);top:50%;transform:translateY(-50%);display:flex}._sortingCell_9hq13_151 ._sortingCellIcon_9hq13_162>*{display:flex}._icon_9hq13_173{display:inline-flex;margin-left:var(--padding-xxs)}._checkBoxCell_9hq13_177{padding-block:0!important;width:var(--size)}._iconCellWrapper_9hq13_181{display:flex;justify-content:center}._actionsCell_9hq13_185{width:var(--size-sm);padding:0 calc((var(--size) - var(--size-sm)) / 2)!important;position:sticky;right:0;background:inherit;z-index:4}._rightAligned_9hq13_193{text-align:right!important}._rightAligned_9hq13_193 ._staticCellContent_9hq13_126{justify-content:flex-end}._centerAligned_9hq13_199{text-align:center!important}._centerAligned_9hq13_199 ._staticCellContent_9hq13_126{justify-content:center}._leftAligned_9hq13_205{text-align:left!important}._popover_9hq13_208{padding:var(--padding-input)}._disabledPointerEvents_9hq13_211{pointer-events:none}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import{j as n}from"./jsx-runtime-eps93zm2.js";import{r as S}from"./index-DhsZuJvc.js";import{c as _}from"./index-Bk2sglWO.js";import{I as Le,D as We,C as Fe,P as Pe}from"./index.es-DazXb-ul.js";import{l as De}from"./lodash-c4VUpsOs.js";import{A as ae}from"./actions-D-uVCDzk.js";import{H as Oe}from"./heading-CRNoBc7q.js";import{P as $e}from"./pagination-CLt-kUlx.js";import{A as f,I as B}from"./common-types-Sih75Sav.js";import{I as Be}from"./input-DTXbDJaL.js";import{N as Me}from"./number-input-B25TXDQC.js";import{S as Ge}from"./select-DnRuRG_N.js";import{D as Ve}from"./disabled-context-rmpd7YJS.js";import{i as M}from"./types-Dx2TtIG9.js";import{T as oe}from"./tooltip-1V7clEnw.js";import{C as Ue}from"./check-box-DPLaOkRR.js";import{S as ze}from"./slider-C7vnj_3M.js";import{I as G}from"./icon-BSFY3vDO.js";import{P as Ke}from"./popover-rq33c1W2.js";import{H as fe}from"./help-icon-Buhx5nl6.js";import{T as Y}from"./text-B3-TSWok.js";const Xe="_inputInTable_k0mvt_1",Ye="_error_k0mvt_7",Je="_warning_k0mvt_7",Qe="_inputHover_k0mvt_13",Ze="_inputFocus_k0mvt_18",en="_inputError_k0mvt_25",nn="_inputWarning_k0mvt_26",tn="_inputDisabled_k0mvt_61",rn="_hideScrollbars_k0mvt_67",an="_wrapper_k0mvt_85",on="_bordered_k0mvt_93",sn="_scroll_k0mvt_98",ln="_table_k0mvt_108",un="_striped_k0mvt_188",L={inputInTable:Xe,error:Ye,warning:Je,inputHover:Qe,inputFocus:Ze,inputError:en,inputWarning:nn,inputDisabled:tn,hideScrollbars:rn,wrapper:an,bordered:on,scroll:sn,table:ln,striped:un},dn="_title_zn5s7_1",cn={title:dn},Q=({name:e=null,actions:t=null,actionsRight:r=!1,testId:o})=>{const a=e!==null,i=t!==null;if(!a&&!i)return null;const l=()=>{if(!i)return null;const c=n.jsx(ae,{actions:t});return r?c:n.jsx("div",{children:c})};return n.jsxs("div",{className:cn.title,children:[a?n.jsx(Oe,{children:n.jsx("span",{"data-testid":o,children:e})}):null,l()]})};Q.__docgenInfo={description:"",methods:[],displayName:"Title",props:{name:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:"",defaultValue:{value:"null",computed:!1}},actions:{required:!1,tsType:{name:"any"},description:"",defaultValue:{value:"null",computed:!1}},actionsRight:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},testId:{required:!1,tsType:{name:"string"},description:""}}};const pn="_footer_4sumy_1",mn="_section_4sumy_7",J={footer:pn,section:mn},Z=({colSpan:e,pagination:t,actions:r,content:o})=>{const a=r&&r.length,i=o!=null,l=()=>{var u,p;if(t){const{rowCount:d,rowsPerPage:I}=t,h=Number((p=(u=I==null?void 0:I.options)==null?void 0:u[0])==null?void 0:p.value);return d>h}return!1};return a||i||l()?n.jsxs("div",{className:J.footer,children:[i?n.jsx("div",{className:J.section,children:n.jsx("div",{children:o})}):null,a||l()?n.jsxs("div",{className:J.section,children:[l()?n.jsx($e,{pagination:t}):n.jsx("div",{}),a&&n.jsx("div",{children:n.jsx(ae,{actions:r})})]}):null]}):null};Z.__docgenInfo={description:"",methods:[],displayName:"Footer",props:{colSpan:{required:!1,tsType:{name:"number"},description:""},pagination:{required:!0,tsType:{name:"IPagination"},description:""},actions:{required:!1,tsType:{name:"Array",elements:[{name:"IAction"}],raw:"IAction[]"},description:""},content:{required:!1,tsType:{name:"ReactNode"},description:""}}};const ye=e=>{const t=Math.max(...e.reduce((r,o)=>{const a=o.cells.map(i=>i.colSpan?i.colSpan:1).reduce((i,l)=>i+l,0);return r.concat(a)},[]));return isNaN(t)?0:t},gn=(e,t)=>{const r=[ye(t),ye(e)];return Math.max(...r)},Ce=e=>e.reduce((t,r)=>r.actions&&r.actions.length>0?1:t,0),hn=(e,t)=>Ce(t)>0||Ce(e)>0,ee=({table:e,children:t})=>{const{rows:r,infiniteScroll:o}=e,a=Math.ceil(window.innerHeight/30),[i,l]=o?S.useState(a):[r.length,null],[c,u]=o?S.useState(i<r.length):[!1,null],p=()=>{if(i>=r.length&&u){u(!1);return}l&&l(i+a)};return n.jsx("div",{id:"scrollWrapper",className:L.scroll,children:o?n.jsx(Le,{dataLength:Math.min(r.length,i+a),next:p,hasMore:c,scrollableTarget:"scrollWrapper",style:{overflow:"initial"},loader:null,children:t({visibleRows:i})}):t({visibleRows:i})})};ee.__docgenInfo={description:"",methods:[],displayName:"TableScrollWrapper",props:{table:{required:!0,tsType:{name:"ITableProps"},description:""},children:{required:!0,tsType:{name:"signature",type:"function",raw:"(props: { visibleRows: number }) => ReactNode",signature:{arguments:[{type:{name:"signature",type:"object",raw:"{ visibleRows: number }",signature:{properties:[{key:"visibleRows",value:{name:"number",required:!0}}]}},name:"props"}],return:{name:"ReactNode"}}},description:""}}};const In="_clickableRow_1ki29_1",yn="_hoverableRow_1ki29_4",Cn="_rowActive_1ki29_4",bn="_expandableRow_1ki29_8",fn="_flush_1ki29_8",_n="_errorRow_1ki29_12",wn="_warningRow_1ki29_15",vn="_dragIconCell_1ki29_34",xn="_dragIcon_1ki29_34",b={clickableRow:In,hoverableRow:yn,rowActive:Cn,expandableRow:bn,flush:fn,errorRow:_n,warningRow:wn,dragIconCell:vn,dragIcon:xn},ne=({colSpan:e,children:t,flush:r})=>n.jsx("tr",{children:n.jsx("td",{colSpan:e,className:_(b.expandableRow,r?b.flush:""),children:t})});ne.__docgenInfo={description:"",methods:[],displayName:"ExpandedContentRow",props:{colSpan:{required:!0,tsType:{name:"number"},description:""},children:{required:!0,tsType:{name:"ReactNode"},description:""},flush:{required:!1,tsType:{name:"boolean"},description:""}}};const be=(e,t={leftAligned:"",rightAligned:"",centerAligned:""},r=!1)=>{if(!e)return null;const{bodyAlignment:o,headerAlignment:a,isHeader:i}=e;switch(i&&a?a:o){case f.LEFT:return r?f.LEFT:t.leftAligned;case f.RIGHT:return r?f.RIGHT:t.rightAligned;case f.CENTER:return r?f.CENTER:t.centerAligned;default:return r?f.LEFT:t.leftAligned}},Tn=(e,t=!1,r=0)=>{if(!e||e.length===0)return[];const o=e.every(i=>Array.isArray(i)),a=e.every(i=>typeof i=="string");return o&&t?e[r]||[]:a?e:(console.warn("getHeaderAlignment: alignments array contains a mix of strings and arrays, returning an empty array."),[])},qn="_inputInTable_9hq13_1",kn="_error_9hq13_7",An="_warning_9hq13_7",Rn="_inputHover_9hq13_13",jn="_inputFocus_9hq13_18",Nn="_inputError_9hq13_25",Sn="_inputWarning_9hq13_26",En="_inputDisabled_9hq13_61",Hn="_hideScrollbars_9hq13_67",Ln="_cell_9hq13_77",Wn="_disabledLink_9hq13_87",Fn="_inputWrapper_9hq13_91",Pn="_numberInputWrapper_9hq13_106",Dn="_breakWord_9hq13_113",On="_inputCell_9hq13_116",$n="_sliderCell_9hq13_119",Bn="_staticCell_9hq13_123",Mn="_staticCellContent_9hq13_126",Gn="_unit_9hq13_148",Vn="_sortingCell_9hq13_151",Un="_sortingCellIcon_9hq13_162",zn="_icon_9hq13_173",Kn="_checkBoxCell_9hq13_177",Xn="_iconCellWrapper_9hq13_181",Yn="_actionsCell_9hq13_185",Jn="_rightAligned_9hq13_193",Qn="_centerAligned_9hq13_199",Zn="_leftAligned_9hq13_205",et="_popover_9hq13_208",nt="_disabledPointerEvents_9hq13_211",s={inputInTable:qn,error:kn,warning:An,inputHover:Rn,inputFocus:jn,inputError:Nn,inputWarning:Sn,inputDisabled:En,hideScrollbars:Hn,cell:Ln,disabledLink:Wn,inputWrapper:Fn,numberInputWrapper:Pn,breakWord:Dn,inputCell:On,sliderCell:$n,staticCell:Bn,staticCellContent:Mn,unit:Gn,sortingCell:Vn,sortingCellIcon:Un,icon:zn,checkBoxCell:Kn,iconCellWrapper:Xn,actionsCell:Yn,rightAligned:Jn,centerAligned:Qn,leftAligned:Zn,popover:et,disabledPointerEvents:nt},te=({cell:e,columnAlignment:t,testId:r,type:o})=>n.jsx(Be,{name:e.name,value:e.value,onChange:a=>{var i;return(i=e.onChange)==null?void 0:i.call(e,a)},onFocus:e.onFocus,onBlur:e.onBlur,onPaste:a=>{var i;return(i=e.onPaste)==null?void 0:i.call(e,a)},placeholder:e.placeholder,error:e.error,warning:e.warning,disabled:e.disabled,isInTable:!0,maxTooltipWidth:e.maxTooltipWidth,right:t===f.RIGHT,testId:r,tabIndex:e.disabled?-1:0,tooltip:e.tooltip,type:o});te.__docgenInfo={description:"",methods:[],displayName:"InputCell",props:{cell:{required:!0,tsType:{name:"IInputCell"},description:""},columnAlignment:{required:!1,tsType:{name:"union",raw:"Align.LEFT | Align.RIGHT | string",elements:[{name:"Align.LEFT"},{name:"Align.RIGHT"},{name:"string"}]},description:""},testId:{required:!1,tsType:{name:"string"},description:""},type:{required:!1,tsType:{name:"union",raw:"'text' | 'date'",elements:[{name:"literal",value:"'text'"},{name:"literal",value:"'date'"}]},description:""}}};const _e=({cell:e,testId:t})=>n.jsx(Me,{name:e.name,value:e.value,onChange:r=>{var o;return(o=e.onChange)==null?void 0:o.call(e,r)},onFocus:e.onFocus,onBlur:e.onBlur,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,enableCosmeticRounding:e.enableCosmeticRounding,enableDisplayRounding:e.enableDisplayRounding,roundDisplayValue:e.roundDisplayValue});_e.__docgenInfo={description:"",methods:[],displayName:"NumberInputCell",props:{cell:{required:!0,tsType:{name:"INumberInputCell"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const we=({cell:e,columnAlignment:t,testId:r})=>n.jsx(Ge,{name:e.name,borderRadius:0,options:e.options,onChange:o=>{var a;return(a=e.onChange)==null?void 0:a.call(e,o)},onCreate:e.onCreate?o=>e.onCreate&&e.onCreate(o):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,multi:e.multi,right:t===f.RIGHT,testId:r,tabIndex:e.disabled?-1:0});we.__docgenInfo={description:"",methods:[],displayName:"SelectCell",props:{cell:{required:!0,tsType:{name:"ISelectCell"},description:""},columnAlignment:{required:!1,tsType:{name:"union",raw:"Align.LEFT | Align.RIGHT | string",elements:[{name:"Align.LEFT"},{name:"Align.RIGHT"},{name:"string"}]},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const ve=({cell:e,columnAlignment:t,testId:r})=>n.jsx("div",{className:_(s.inputWrapper,e.type==="NumberInput"?s.numberInputWrapper:""),children:e.type==="Input"?n.jsx(te,{cell:e,columnAlignment:t,testId:r}):e.type==="NumberInput"?n.jsx(_e,{cell:e,testId:r}):e.type==="DateInput"?n.jsx(te,{cell:e,testId:r,type:"date"}):e.type==="Select"?n.jsx(we,{cell:e,columnAlignment:t,testId:r}):null});ve.__docgenInfo={description:"",methods:[],displayName:"InputCellWrapper",props:{cell:{required:!0,tsType:{name:"any"},description:""},columnAlignment:{required:!0,tsType:{name:"union",raw:"Align.LEFT | Align.RIGHT | string",elements:[{name:"Align.LEFT"},{name:"Align.RIGHT"},{name:"string"}]},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const xe=({cell:e,testId:t})=>{const r=S.useContext(Ve),{error:o,warning:a,tooltip:i,maxTooltipWidth:l}=e,c=u=>M(u);return n.jsx("div",{className:s.inputWrapper,children:n.jsx(oe,{error:!!o,warning:!!a,text:i||o||a,enabled:c(i)||c(o)||c(a)||!1,maxWidth:l,placement:"bottom-center",children:n.jsx("div",{className:_(s.staticCellContent,o?s.error:a?s.warning:""),children:n.jsx("a",{className:_((e.disabled||r)&&s.disabledLink),onClick:e.disabled||r?void 0:u=>{var p;u.stopPropagation(),(p=e.onClick)==null||p.call(e,u)},"data-testid":t,children:e.value})})})})};xe.__docgenInfo={description:"",methods:[],displayName:"LinkCell",props:{cell:{required:!0,tsType:{name:"ILinkCell"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const Te=({cell:e,testId:t})=>n.jsx(Ue,{label:e.label,checked:e.checked,isInTable:!0,disabled:e.disabled,onChange:r=>e.onChange(r),testId:t,tabIndex:e.disabled?-1:0});Te.__docgenInfo={description:"",methods:[],displayName:"CheckBoxCell",props:{cell:{required:!0,tsType:{name:"ICheckBoxCell"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const qe=({cell:e})=>n.jsx("div",{className:s.inputWrapper,children:n.jsx(ze,{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})});qe.__docgenInfo={description:"",methods:[],displayName:"SliderCell",props:{cell:{required:!0,tsType:{name:"ISliderCell"},description:""}}};const ke=({cell:e})=>{const{tooltip:t,icon:r}=e;return n.jsx("div",{className:s.iconCellWrapper,children:n.jsx(oe,{text:t,enabled:!!t&&M(t),display:"flex",placement:"top-center",children:n.jsx(G,{icon:r})})})};ke.__docgenInfo={description:"",methods:[],displayName:"IconCell",props:{cell:{required:!0,tsType:{name:"IIconCell"},description:""}}};const Ae=({cell:e})=>n.jsx(ae,{actions:e.actions});Ae.__docgenInfo={description:"",methods:[],displayName:"ActionsCell",props:{cell:{required:!0,tsType:{name:"IActionCell"},description:""}}};const Re=({cell:e})=>{const{helpIcon:t}=e;return t?n.jsx("div",{className:s.icon,children:n.jsx(fe,{onClick:t.onClick,text:t.tooltip})}):null};Re.__docgenInfo={description:"",methods:[],displayName:"CellHelpIcon",props:{cell:{required:!0,tsType:{name:"IHelpIconCell"},description:""}}};const je=({cell:e})=>{const{libraryIcon:t}=e;return t?n.jsx("div",{className:s.icon,children:n.jsx(fe,{onClick:t.onClick,text:t.tooltip,icon:B.LIBRARY})}):null};je.__docgenInfo={description:"",methods:[],displayName:"CellLibraryIcon",props:{cell:{required:!0,tsType:{name:"ILibraryIconCell"},description:""}}};const Ne=({cell:e})=>{const{hasSort:t,sort:r,sortPriority:o}=e;return t?n.jsxs("span",{className:s.sortingCellIcon,children:[r==="down"?n.jsx(Y,{link:!0,children:n.jsx(G,{icon:B.SORT_ASCENDING})}):r==="up"?n.jsx(Y,{link:!0,children:n.jsx(G,{icon:B.SORT_DESCENDING})}):n.jsx(Y,{faint:!0,children:n.jsx(G,{icon:B.SORT_DESCENDING})}),o&&r?n.jsx("sup",{children:o}):null]}):null};Ne.__docgenInfo={description:"",methods:[],displayName:"Sort",props:{cell:{required:!0,tsType:{name:"ISortCell"},description:""}}};const ie=({cell:e,isHeader:t,testId:r})=>{const{error:o,warning:a,tooltip:i,maxTooltipWidth:l,hasSort:c,onSort:u,type:p}=e,d=n.jsxs("div",{className:_(s.staticCellContent,p==="Unit"?s.unit:"",o?s.error:a?s.warning:""),onClick:c?I=>u&&u(I):()=>{},"data-testid":r,children:[e.value,t?n.jsxs(n.Fragment,{children:[n.jsx(Re,{cell:e}),n.jsx(je,{cell:e}),n.jsx(Ne,{cell:e})]}):null]});return n.jsx("div",{className:s.inputWrapper,children:n.jsx(oe,{error:!!o,warning:!!a,text:i||o||a,enabled:i&&M(i)||o&&M(o)||a&&M(a)||!1,maxWidth:l,display:"block",placement:"bottom-center",children:d})})};ie.__docgenInfo={description:"",methods:[],displayName:"StaticCell",props:{cell:{required:!0,tsType:{name:"IStaticCell"},description:""},isHeader:{required:!1,tsType:{name:"boolean"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const Se=({cell:e,testId:t})=>{const{content:r,fullWidth:o,closeOnOutsideClick:a,disabled:i}=e;return n.jsx(Ke,{content:r,fullWidth:o,closeOnOutsideClick:a,disabled:i,children:n.jsx("div",{className:s.popover,children:n.jsx(ie,{cell:e,testId:t})})})};Se.__docgenInfo={description:"",methods:[],displayName:"PopoverCell",props:{cell:{required:!0,tsType:{name:"IPopoverCell"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const Ee=({cell:e,isHeader:t,columnAlignment:r,testId:o})=>{if(!e)return null;switch(e.type){case"Input":case"NumberInput":case"DateInput":case"Select":return n.jsx(ve,{cell:e,columnAlignment:r,testId:o});case"Link":return n.jsx(xe,{cell:e,testId:o});case"CheckBox":return n.jsx(Te,{cell:e,testId:o});case"Slider":return n.jsx(qe,{cell:e});case"Icon":return n.jsx(ke,{cell:e});case"Actions":return n.jsx(Ae,{cell:e});case"Popover":return n.jsx(Se,{cell:e});default:return n.jsx(ie,{cell:e,isHeader:t,testId:o})}};Ee.__docgenInfo={description:"",methods:[],displayName:"CellWrapper",props:{cell:{required:!0,tsType:{name:"any"},description:""},isHeader:{required:!0,tsType:{name:"boolean"},description:""},columnAlignment:{required:!0,tsType:{name:"union",raw:"Align.LEFT | Align.RIGHT | string",elements:[{name:"Align.LEFT"},{name:"Align.RIGHT"},{name:"string"}]},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};var A=(e=>(e.INPUT="Input",e.NUMBER_INPUT="NumberInput",e.SELECT="Select",e.POPOVER="Popover",e.SLIDER="Slider",e.CHECKBOX="CheckBox",e.ACTIONS="Actions",e.AUTO_UNIT="AutoUnit",e))(A||{});const re=({cell:e,isHeader:t,columnHeaderAlignment:r,columnAlignment:o=f.LEFT,width:a,snapshot:i,testId:l})=>{if(!e)return null;const{style:c,colSpan:u,rowSpan:p,width:d}=e,I=S.useRef(null),h={bodyAlignment:o,headerAlignment:r,isHeader:t},W=be(h,s),w=be(h,s,!0),F=e.type===A.INPUT||e.type===A.NUMBER_INPUT||e.type===A.SELECT||e.type===A.POPOVER?s.inputCell:e.type===A.SLIDER?s.sliderCell:e.type===A.CHECKBOX?s.checkBoxCell:e.type===A.ACTIONS?s.actionsCell:s.staticCell,q=_(s.cell,F,e.hasSort?s.sortingCell:null,W,e.breakWord?s.breakWord:""),E=d??a??((i==null?void 0:i.isDragging)&&I.current&&I.current.offsetWidth)??void 0,v={width:E,minWidth:E,...c},k=t?"th":"td";return n.jsx(k,{ref:I,className:q,style:v,colSpan:u,rowSpan:p,children:n.jsx(Ee,{cell:e,columnAlignment:w??f.RIGHT,isHeader:t,testId:l})})};re.__docgenInfo={description:"",methods:[],displayName:"Cell",props:{cell:{required:!1,tsType:{name:"union",raw:`| IPopoverCell
|
|
2
|
+
| IStaticCell
|
|
3
|
+
| ISelectCell
|
|
4
|
+
| IHelpIconCell
|
|
5
|
+
| ILibraryIconCell
|
|
6
|
+
| ICheckBoxCell
|
|
7
|
+
| IIconCell
|
|
8
|
+
| IInputCell
|
|
9
|
+
| ILinkCell
|
|
10
|
+
| INumberInputCell
|
|
11
|
+
| IActionCell
|
|
12
|
+
| ISortCell
|
|
13
|
+
| ISliderCell
|
|
14
|
+
| ISimpleCell`,elements:[{name:"IPopoverCell"},{name:"IStaticCell"},{name:"ISelectCell"},{name:"IHelpIconCell"},{name:"ILibraryIconCell"},{name:"ICheckBoxCell"},{name:"IIconCell"},{name:"IInputCell"},{name:"ILinkCell"},{name:"INumberInputCell"},{name:"IActionCell"},{name:"ISortCell"},{name:"ISliderCell"},{name:"ISimpleCell"}]},description:""},isHeader:{required:!0,tsType:{name:"boolean"},description:""},columnHeaderAlignment:{required:!1,tsType:{name:"string"},description:""},columnAlignment:{required:!1,tsType:{name:"union",raw:"Align.LEFT | Align.RIGHT | null",elements:[{name:"Align.LEFT"},{name:"Align.RIGHT"},{name:"null"}]},description:"",defaultValue:{value:"Align.LEFT",computed:!0}},width:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},snapshot:{required:!1,tsType:{name:"any"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const $=({row:e,rowIndex:t,isHeader:r=!1,columnCount:o,colSpan:a,columnHeaderAlignments:i=[],columnAlignment:l=[],hasRowActions:c,draggableTable:u=!1,snapshot:p=null,provided:d=null,width:I,columnWidths:h,testId:W})=>{const w=S.useRef(null),F=Tn(i,r,t),{onRowClick:q,onRowFocus:E,onRowMouseEnter:v,onRowMouseLeave:k,expandedContent:x,error:K,warning:P,active:H}=e,R=e.cells.map((C,N)=>{const O=`${r?0:1}_${t}_${N}`;return n.jsx(re,{cell:C,isHeader:r,columnAlignment:l[N],columnHeaderAlignment:F[N],width:h?h[N]:void 0,snapshot:p,testId:C.testId},O)}),j=c&&n.jsx(re,{cell:{type:A.ACTIONS,actions:e.actions},isHeader:r},o),X=(C,N)=>({minWidth:C&&`${I}px`,width:C&&"100%",display:C&&"table",background:C&&"var(--color-background-listitem-active)",border:C&&"var(--color-border)",borderTop:C&&0,opacity:C&&.1,...N}),V=()=>e.noDrag?n.jsx("td",{"aria-labelledby":"unique-label-id"}):n.jsx("td",{className:b.dragIconCell,children:n.jsx("div",{...d.dragHandleProps,className:b.dragIcon,children:n.jsx(G,{icon:B.DRAG})})});return r?n.jsxs(n.Fragment,{children:[n.jsxs("tr",{ref:w,onClick:q,onMouseEnter:v,onMouseLeave:k,onFocus:E,className:_(q?b.clickableRow:null,v?b.hoverableRow:null),children:[u?n.jsx("th",{}):null,R,j]},t),x&&x.content?n.jsx(ne,{colSpan:a,flush:x.flush===!0,children:x.content},`${t}_expanded_content`):null]}):n.jsxs(n.Fragment,{children:[n.jsxs("tr",{onClick:q,onMouseEnter:v,onMouseLeave:k,onFocus:E,className:_(q&&!q.noStyle?b.clickableRow:null,v&&!v.noStyle?b.hoverableRow:null,H?b.rowActive:null,K?b.errorRow:null,P?b.warningRow:null),ref:(d==null?void 0:d.innerRef)||null,...(d==null?void 0:d.draggableProps)||null,style:p&&d?X(p.isDragging,d.draggableProps.style):null,children:[u?V():null,R,j]},t),x&&x.content?n.jsx(ne,{colSpan:a,flush:x.flush===!0,children:x.content},`${t}_expanded_content`):null]})};$.__docgenInfo={description:"",methods:[],displayName:"Row",props:{row:{required:!0,tsType:{name:"signature",type:"object",raw:`{
|
|
15
|
+
active?: boolean;
|
|
16
|
+
error?: boolean;
|
|
17
|
+
warning?: boolean;
|
|
18
|
+
cells: TCellShape[];
|
|
19
|
+
noDrag?: boolean;
|
|
20
|
+
onRowClick?: IOnRowClickFunction;
|
|
21
|
+
onRowFocus?: IOnRowClickFunction;
|
|
22
|
+
onRowMouseEnter?: IOnRowClickFunction;
|
|
23
|
+
onRowMouseLeave?: IOnRowClickFunction;
|
|
24
|
+
expandedContent?: {
|
|
25
|
+
content: ReactNode;
|
|
26
|
+
flush?: boolean;
|
|
27
|
+
};
|
|
28
|
+
actions?: any[];
|
|
29
|
+
}`,signature:{properties:[{key:"active",value:{name:"boolean",required:!1}},{key:"error",value:{name:"boolean",required:!1}},{key:"warning",value:{name:"boolean",required:!1}},{key:"cells",value:{name:"Array",elements:[{name:"union",raw:`| IPopoverCell
|
|
30
|
+
| IStaticCell
|
|
31
|
+
| ISelectCell
|
|
32
|
+
| IHelpIconCell
|
|
33
|
+
| ILibraryIconCell
|
|
34
|
+
| ICheckBoxCell
|
|
35
|
+
| IIconCell
|
|
36
|
+
| IInputCell
|
|
37
|
+
| ILinkCell
|
|
38
|
+
| INumberInputCell
|
|
39
|
+
| IActionCell
|
|
40
|
+
| ISortCell
|
|
41
|
+
| ISliderCell
|
|
42
|
+
| ISimpleCell`,elements:[{name:"IPopoverCell"},{name:"IStaticCell"},{name:"ISelectCell"},{name:"IHelpIconCell"},{name:"ILibraryIconCell"},{name:"ICheckBoxCell"},{name:"IIconCell"},{name:"IInputCell"},{name:"ILinkCell"},{name:"INumberInputCell"},{name:"IActionCell"},{name:"ISortCell"},{name:"ISliderCell"},{name:"ISimpleCell"}]}],raw:"TCellShape[]",required:!0}},{key:"noDrag",value:{name:"boolean",required:!1}},{key:"onRowClick",value:{name:"IOnRowClickFunction",required:!1}},{key:"onRowFocus",value:{name:"IOnRowClickFunction",required:!1}},{key:"onRowMouseEnter",value:{name:"IOnRowClickFunction",required:!1}},{key:"onRowMouseLeave",value:{name:"IOnRowClickFunction",required:!1}},{key:"expandedContent",value:{name:"signature",type:"object",raw:`{
|
|
43
|
+
content: ReactNode;
|
|
44
|
+
flush?: boolean;
|
|
45
|
+
}`,signature:{properties:[{key:"content",value:{name:"ReactNode",required:!0}},{key:"flush",value:{name:"boolean",required:!1}}]},required:!1}},{key:"actions",value:{name:"Array",elements:[{name:"any"}],raw:"any[]",required:!1}}]}},description:""},rowIndex:{required:!0,tsType:{name:"number"},description:""},isHeader:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},columnCount:{required:!0,tsType:{name:"number"},description:""},colSpan:{required:!0,tsType:{name:"number"},description:""},columnHeaderAlignments:{required:!1,tsType:{name:"union",raw:"string[] | string[][]",elements:[{name:"Array",elements:[{name:"string"}],raw:"string[]"},{name:"Array",elements:[{name:"Array",elements:[{name:"string"}],raw:"string[]"}],raw:"string[][]"}]},description:"",defaultValue:{value:"[]",computed:!1}},columnAlignment:{required:!1,tsType:{name:"Array",elements:[{name:"string"}],raw:"string[]"},description:"",defaultValue:{value:"[]",computed:!1}},hasRowActions:{required:!0,tsType:{name:"boolean"},description:""},draggableTable:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},snapshot:{required:!1,tsType:{name:"any"},description:"",defaultValue:{value:"null",computed:!1}},provided:{required:!1,tsType:{name:"any"},description:"",defaultValue:{value:"null",computed:!1}},width:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},columnWidths:{required:!1,tsType:{name:"Array",elements:[{name:"string"}],raw:"string[]"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const tt=e=>{var de,ce,pe,me,ge,he,Ie;const{onListReorder:t=()=>{},table:r}=e,{columnWidths:o,footer:a,name:i,rows:l=[],actions:c,actionsRight:u,columnHeaderAlignments:p,columnAlignment:d,striped:I=!0,testId:h,draggable:W,defaultEmptyRow:w=null,onAddRow:F=null,bordered:q=!0,maxHeight:E,fixedWidth:v}=r,k=S.useRef(null),[x,K]=S.useState({width:0,height:0});S.useEffect(()=>{k.current&&K({width:k.current.offsetWidth,height:k.current.offsetHeight})},[]);const P=De.get(e,"table.headers",[]),H=gn(l,P),R=hn(l,P),j=H+(R?1:0),X=a?((ce=(de=a==null?void 0:a.pagination)==null?void 0:de.rowsPerPage)==null?void 0:ce.value)===0||Number((pe=a==null?void 0:a.pagination)==null?void 0:pe.selectedPage)>=Number((me=a==null?void 0:a.pagination)==null?void 0:me.rowCount)/Number((he=(ge=a==null?void 0:a.pagination)==null?void 0:ge.rowsPerPage)==null?void 0:he.value):!0,V=((Ie=w==null?void 0:w.cells)==null?void 0:Ie.length)&&F&&X,N={cells:V?w.cells.map((m,T)=>(m==null?void 0:m.type)==="Input"?{...m,onChange:g=>{var U;const y=(U=g==null?void 0:g.target)==null?void 0:U.value,D={...w,cells:w.cells.map((z,He)=>({...z,value:He===T?y:z==null?void 0:z.value}))};F({newRow:D})}}:{...m,disabled:!0}):null,testId:h?`${h}-last-empty-row`:void 0},O=V?l.concat(N):l,se={...r,rows:O},le=_(L.wrapper,q?L.bordered:""),ue={maxHeight:E,width:v,display:v==="auto"?"inline-flex":"flex"};return W?n.jsxs("div",{ref:k,className:le,style:ue,children:[n.jsx(Q,{actions:c,actionsRight:u,name:i,testId:h&&`${h}-title`}),n.jsx(We,{onDragEnd:m=>{var y,D;const T=(y=m==null?void 0:m.source)==null?void 0:y.index,g=(D=m==null?void 0:m.destination)==null?void 0:D.index;typeof T=="number"&&typeof g=="number"&&t({from:T,to:g})},children:n.jsx(Fe,{droppableId:"droppable",children:m=>n.jsx(ee,{table:se,children:({visibleRows:T})=>n.jsxs("table",{className:_(L.table,I?L.striped:""),"data-testid":h,ref:m.innerRef,children:[n.jsx("thead",{children:P.map((g,y)=>n.jsx($,{rowIndex:y,isHeader:!0,row:g,columnCount:H,columnWidths:o,colSpan:j,hasRowActions:R,columnAlignment:d,columnHeaderAlignments:p,draggableTable:W},`0_${y}`))}),n.jsxs("tbody",{children:[O.slice(0,T).map((g,y)=>n.jsx(Pe,{draggableId:y+"",index:y,isDragDisabled:g.noDrag,children:(D,U)=>n.jsx($,{rowIndex:y,row:g,columnCount:H,columnWidths:o,colSpan:j,hasRowActions:R,columnAlignment:d,provided:D,snapshot:U,draggableTable:W,width:x.width},`1_${y}`)},`index_${y}`)),m.placeholder]})]})})})}),a&&n.jsx(Z,{pagination:a.pagination,actions:a.actions,content:a.content})]}):n.jsxs("div",{className:le,style:ue,children:[n.jsx(Q,{actions:c,actionsRight:u,name:i,testId:h&&`${h}-title`}),n.jsx(ee,{table:se,children:({visibleRows:m})=>n.jsxs("table",{className:_(L.table,I?L.striped:""),"data-testid":h,children:[n.jsx("thead",{children:P.map((T,g)=>n.jsx($,{rowIndex:g,isHeader:!0,row:T,columnCount:H,columnWidths:o,colSpan:j,hasRowActions:R,columnAlignment:d,columnHeaderAlignments:p},`0_${g}`))}),n.jsx("tbody",{children:O.slice(0,m).map((T,g)=>n.jsx($,{rowIndex:g,row:T,columnCount:H,columnWidths:o,colSpan:j,hasRowActions:R,columnAlignment:d},`1_${g}`))})]})}),a&&n.jsx(Z,{colSpan:j,pagination:a.pagination,actions:a.actions,content:a.content})]})};tt.__docgenInfo={description:"",methods:[],displayName:"Table",props:{onListReorder:{required:!1,tsType:{name:"signature",type:"function",raw:"(obj: { from: number; to: number }) => void",signature:{arguments:[{type:{name:"signature",type:"object",raw:"{ from: number; to: number }",signature:{properties:[{key:"from",value:{name:"number",required:!0}},{key:"to",value:{name:"number",required:!0}}]}},name:"obj"}],return:{name:"void"}}},description:""},table:{required:!0,tsType:{name:"signature",type:"object",raw:`{
|
|
46
|
+
name?: TStringOrNumber | ReactNode;
|
|
47
|
+
actionsRight?: boolean;
|
|
48
|
+
fixedWidth?: TStringOrNumber;
|
|
49
|
+
maxHeight?: TStringOrNumber;
|
|
50
|
+
columnWidths?: string[];
|
|
51
|
+
className?: string;
|
|
52
|
+
columnHeaderAlignments?: Array<TAlign | string>;
|
|
53
|
+
columnAlignment?: Array<TAlign | string>;
|
|
54
|
+
infiniteScroll?: boolean;
|
|
55
|
+
headers?: any[];
|
|
56
|
+
rows?: TRowsType;
|
|
57
|
+
footer?: IFooterProps;
|
|
58
|
+
draggable?: boolean;
|
|
59
|
+
bordered?: boolean;
|
|
60
|
+
striped?: boolean;
|
|
61
|
+
testId?: string;
|
|
62
|
+
onAddRow?: any;
|
|
63
|
+
defaultEmptyRow?: any;
|
|
64
|
+
stickyHeaders?: string | boolean;
|
|
65
|
+
actions?: any;
|
|
66
|
+
}`,signature:{properties:[{key:"name",value:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}],required:!1},{name:"ReactNode"}],required:!1}},{key:"actionsRight",value:{name:"boolean",required:!1}},{key:"fixedWidth",value:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}],required:!1}},{key:"maxHeight",value:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}],required:!1}},{key:"columnWidths",value:{name:"Array",elements:[{name:"string"}],raw:"string[]",required:!1}},{key:"className",value:{name:"string",required:!1}},{key:"columnHeaderAlignments",value:{name:"Array",elements:[{name:"union",raw:"TAlign | string",elements:[{name:"union",raw:"'left' | 'right' | 'center'",elements:[{name:"literal",value:"'left'"},{name:"literal",value:"'right'"},{name:"literal",value:"'center'"}]},{name:"string"}]}],raw:"Array<TAlign | string>",required:!1}},{key:"columnAlignment",value:{name:"Array",elements:[{name:"union",raw:"TAlign | string",elements:[{name:"union",raw:"'left' | 'right' | 'center'",elements:[{name:"literal",value:"'left'"},{name:"literal",value:"'right'"},{name:"literal",value:"'center'"}]},{name:"string"}]}],raw:"Array<TAlign | string>",required:!1}},{key:"infiniteScroll",value:{name:"boolean",required:!1}},{key:"headers",value:{name:"Array",elements:[{name:"any"}],raw:"any[]",required:!1}},{key:"rows",value:{name:"Array",elements:[{name:"signature",type:"object",raw:`{
|
|
67
|
+
cells: TCellShape[];
|
|
68
|
+
actions?: any[];
|
|
69
|
+
testId?: string;
|
|
70
|
+
noDrag?: boolean;
|
|
71
|
+
onRowMouseEnter?: TEmpty;
|
|
72
|
+
onRowMouseLeave?: TEmpty;
|
|
73
|
+
}`,signature:{properties:[{key:"cells",value:{name:"Array",elements:[{name:"union",raw:`| IPopoverCell
|
|
74
|
+
| IStaticCell
|
|
75
|
+
| ISelectCell
|
|
76
|
+
| IHelpIconCell
|
|
77
|
+
| ILibraryIconCell
|
|
78
|
+
| ICheckBoxCell
|
|
79
|
+
| IIconCell
|
|
80
|
+
| IInputCell
|
|
81
|
+
| ILinkCell
|
|
82
|
+
| INumberInputCell
|
|
83
|
+
| IActionCell
|
|
84
|
+
| ISortCell
|
|
85
|
+
| ISliderCell
|
|
86
|
+
| ISimpleCell`,elements:[{name:"IPopoverCell"},{name:"IStaticCell"},{name:"ISelectCell"},{name:"IHelpIconCell"},{name:"ILibraryIconCell"},{name:"ICheckBoxCell"},{name:"IIconCell"},{name:"IInputCell"},{name:"ILinkCell"},{name:"INumberInputCell"},{name:"IActionCell"},{name:"ISortCell"},{name:"ISliderCell"},{name:"ISimpleCell"}]}],raw:"TCellShape[]",required:!0}},{key:"actions",value:{name:"Array",elements:[{name:"any"}],raw:"any[]",required:!1}},{key:"testId",value:{name:"string",required:!1}},{key:"noDrag",value:{name:"boolean",required:!1}},{key:"onRowMouseEnter",value:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}},required:!1}},{key:"onRowMouseLeave",value:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}},required:!1}}]}}],raw:"TRowType[]",required:!1}},{key:"footer",value:{name:"IFooterProps",required:!1}},{key:"draggable",value:{name:"boolean",required:!1}},{key:"bordered",value:{name:"boolean",required:!1}},{key:"striped",value:{name:"boolean",required:!1}},{key:"testId",value:{name:"string",required:!1}},{key:"onAddRow",value:{name:"any",required:!1}},{key:"defaultEmptyRow",value:{name:"any",required:!1}},{key:"stickyHeaders",value:{name:"union",raw:"string | boolean",elements:[{name:"string"},{name:"boolean"}],required:!1}},{key:"actions",value:{name:"any",required:!1}}]}},description:""}}};export{A as C,tt as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as n}from"./jsx-runtime-eps93zm2.js";import{r as S}from"./index-DhsZuJvc.js";import{f as ne}from"./immer.esm-BwVl9PS2.js";import{l as Z}from"./lodash-c4VUpsOs.js";import{G as le}from"./grid-DRkC-bt8.js";import{T as W}from"./text-B3-TSWok.js";import{T as D}from"./table-Dh7Es_V6.js";import{C as dn}from"./card-EcjmryU9.js";import{I as se}from"./input-DTXbDJaL.js";import{F as oe}from"./field-HrLaMLbx.js";import{H as un}from"./heading-CRNoBc7q.js";import{t as ae,x as pn,y as mn,z as gn,A as bn,B as hn,C as wn,D as yn}from"./table.stories-data-D52aKMY1.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./index-Bk2sglWO.js";import"./index.es-DazXb-ul.js";import"./inheritsLoose-DP0QEDDI.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./index-CUZDtIZe.js";import"./memoize-one.esm-CcMeOnPo.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./actions-D-uVCDzk.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./index-CEuq6vkz.js";import"./tooltip-1V7clEnw.js";import"./types-BmbYqTX_.js";import"./types-Dx2TtIG9.js";import"./badge-CLQ59MDF.js";import"./pagination-CLt-kUlx.js";import"./select-DnRuRG_N.js";import"./assertThisInitialized-B9jnkVVz.js";import"./select.input-D0UkAPd9.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./number-input-B25TXDQC.js";import"./index-C0x1JmaP.js";import"./index-DRSy5Ssd.js";import"./check-box-DPLaOkRR.js";import"./help-icon-Buhx5nl6.js";import"./slider-C7vnj_3M.js";import"./index-BI4_Bp97.js";import"./popover-rq33c1W2.js";import"./label-CqmyC9he.js";import"./flex-EllkLxgO.js";const gt={title:"Basic/Table",component:D,args:{table:{...ae}}},A=h=>n.jsx(D,{...h}),te=A.bind({}),E=A.bind({});E.args={table:{...ae,fixedWidth:"400px"}};const L=A.bind({});L.args={table:{...ae,fixedWidth:"auto"}};const _=A.bind({});_.args={table:pn};_.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=A.bind({});Q.args={table:mn};const O=A.bind({});O.args={table:gn};O.parameters={docs:{description:{story:"This is only required when you need to override `columnAlignment` in header cells (i.e. they have different alignment)"}}};const G=A.bind({});G.args={table:bn};const N=A.bind({});N.args={table:hn};N.decorators=[h=>n.jsx("div",{style:{position:"absolute",inset:0,padding:"var(--padding)"},children:n.jsx(h,{})})];const U=A.bind({});U.args={table:wn};U.parameters={docs:{description:{story:"If a `maxHeight` is set, the table should only fill that height if it needs to."}}};const $=A.bind({});$.args={table:yn};const M=()=>n.jsx(dn,{heading:n.jsx(un,{children:"Card heading"}),padding:!1,children:n.jsx(D,{table:{...ae,bordered:!1}})});M.parameters={docs:{source:{type:"dynamic"}}};const q=()=>{const h=["Section","Width","Height"];let g=["","m","m"],o=[...Array(175).keys()].map((l,t)=>[t,t*2,t*2]);const x=(l,t,r)=>l==="m"&&t==="ft"?r*3.28084:l==="ft"&&t==="m"?r/3.28084:r,i=(l,t,r,c)=>{o[t][r]=l.target.value,c()},R=l=>{o=o.concat([["","",""]]),l()},k=(l,t)=>{o=o.filter((r,c)=>c!==l),t()},p=(l,t,r)=>{const c=g[t],b=l.target.value;g=g.map((y,s)=>s===t?b:y),o=o.map(y=>y.map((s,u)=>u===t?x(c,b,s):s)),r()},w=()=>{const l=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[t,r]=S.useState(10),[c,b]=S.useState(1),[y,s]=S.useState(!1),u=()=>{s(!y)},j=()=>{const e=Math.ceil(o.length/t);b(e)},T=(c-1)*t,a=t===0?o.length-1:T+t,m={headers:[{cells:h.map(e=>({value:e})),actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{R(u),j()}}]},{cells:[{},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:g[1],type:"Select",native:!0,onChange:e=>p(e,1,u)},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:g[2],type:"Select",native:!0,onChange:e=>p(e,2,u)}]}],rows:o.slice(T,a).map((e,d)=>{const I=T+d;return{cells:[...Array(3).keys()].map((P,v)=>({value:e[v],type:"Input",onChange:C=>i(C,I,v,u)})),actions:[{label:"Delete",icon:"minus",onClick:()=>k(I,u)}]}}),footer:{pagination:{rowCount:o.length,selectedPage:c,rowsPerPage:{onChange:e=>{const{value:d}=e.target;r(Number(d))},options:l,value:t},onSelectPage:e=>b(e),small:!0}}};return n.jsx(D,{table:m})};return n.jsx(w,{})},K=()=>{const h=["Section","Width","Height"];let g=[...Array(20).keys()].map((x,i)=>({Section:Z.random(0,100),Width:Z.random(0,100),Height:Z.random(0,100)}));const o=()=>{const[x,i]=S.useState({Section:"up"}),R=(r,c)=>r.sort((b,y)=>Object.entries(c).map(([s,u])=>{switch(u){case"up":return b[s]-y[s];case"down":return y[s]-b[s];default:return 0}}).reduce((s,u)=>s||u,0)),k=(r,c,b)=>({dataSortCells:r.map(s=>{const u=Object.keys(c).includes(s)?c[s]:"",j=`${s[0].toUpperCase()}${s.slice(1)}`;return{key:s,value:j,hasSort:!0,sort:u,onSort:()=>{const T=u==="up"?"down":"up";b({[s]:T})}}})}),{dataSortCells:p}=k(h,x,i),l=[...R(g,x).map(r=>({cells:Object.entries(r).map(([b,y])=>({key:b,value:y,type:"Input",disabled:!0}))}))],t={headers:[{cells:p}],rows:l};return n.jsx(D,{table:t})};return n.jsx(o,{})},B=()=>{const h=["Section","Width","Height"];let g=[...Array(175).keys()].map((x,i)=>({Section:i,Width:i*2,Height:i*2}));const o=()=>{const x=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[i,R]=S.useState(10),[k,p]=S.useState(1),[w,l]=S.useState({}),[t,r]=S.useState({});S.useEffect(()=>{p(1)},[w,t]);const c=(k-1)*i,b=i===0?g.length-1:c+i,y=(e,d,I)=>e.filter(P=>Object.keys(d).every(v=>d[v]===""?!0:P[v].toString().includes(d[v]))).sort((P,v)=>Object.entries(I).map(([C,H])=>{switch(H){case"up":return P[C]-v[C];case"down":return v[C]-P[C];default:return 0}}).reduce((C,H)=>C||H,0)),s=(e,d,I,P,v)=>{const C=e.map(f=>{const V=Object.keys(P).includes(f)?P[f]:"",F=`${f[0].toUpperCase()}${f.slice(1)}`;return{key:f,value:F,hasSort:!0,sort:V,onSort:()=>{const ee=V===""?"up":V==="up"?"down":"";v({...P,[f]:ee})}}}),H=e.map(f=>{const V=Object.keys(d).includes(f)?d[f]:"";return{key:f,value:V,type:"Input",placeholder:"Filter",onChange:F=>I({...d,[f]:F.target.value})}});return{dataSortCells:C,dataFilterCells:H}},{dataSortCells:u,dataFilterCells:j}=s(h,w,l,t,r),T=y(g,w,t),a=[...T.slice(c,b).map(e=>({cells:Object.entries(e).map(([I,P])=>({key:I,value:P,type:"Input",disabled:!0}))}))],m={headers:[{cells:u},{cells:j}],rows:a,footer:{pagination:{rowCount:T.length,selectedPage:k,rowsPerPage:{onChange:e=>{const{value:d}=e.target;R(Number(d))},options:x,value:i},onSelectPage:e=>p(e),small:!0}}};return n.jsx(D,{table:m})};return n.jsx(o,{})},z=()=>{const h={tea:3.6,coffee:3.2,orange:4.1},g=[{label:"Tea",value:"tea"},{label:"Coffee",value:"coffee"},{label:"Orange juice",value:"orange"}],o={cells:[{type:"Select",options:g,value:{value:"tea"}},{type:"Input"},{type:"Static"}]},x=[...Array(15).keys()].map((a,m)=>({cells:[{type:"Select",options:g,value:{value:"tea"}},{type:"Input",value:m+1},{type:"Static"}]})),[i,R]=S.useState(x),k=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[p,w]=S.useState(10),[l,t]=S.useState(1),r=(l-1)*p,c=p===0?i.length-1:r+p,b=({newRow:a}={})=>{const m=ne(i,e=>{e.push(a??o)});R(m)},y=({rowIndex:a})=>{const m=ne(i,e=>{delete e[a]}).filter(e=>e);R(m)},s=({rowIndex:a,value:m})=>{const e=ne(i,d=>{d[a].cells[0].value.value=m});R(e)},u=({rowIndex:a,value:m})=>{const e=ne(i,d=>{d[a].cells[1].value=m});R(e)},j=({value:a})=>{const m=Number(a);return!Z.isNaN(m)&&Z.isInteger(m)&&m>0},T=i.slice(r,c).map((a,m)=>{const e=r+m;return i.length-1,{...a,cells:a==null?void 0:a.cells.map((d,I)=>{var f,V,F,ee,ie;const P=(F=(V=(f=a==null?void 0:a.cells)==null?void 0:f[0])==null?void 0:V.value)==null?void 0:F.value,v=Number((ie=(ee=a==null?void 0:a.cells)==null?void 0:ee[1])==null?void 0:ie.value),C=h==null?void 0:h[P],H=C&&j({value:v})?(C*v).toFixed(2):null;if(I===0)return{...d,onChange:re=>s({rowIndex:e,value:re.target.value})};if(I===1)return{...d,onChange:re=>u({rowIndex:e,value:re.target.value}),error:j({value:d.value})?null:"Must be valid whole number"};if(I===2)return{...d,value:H}}),actions:[{label:"Delete",icon:"minus",onClick:()=>y({rowIndex:e})}]}});return n.jsx(D,{table:{defaultEmptyRow:o,onAddRow:b,columnAlignment:["left","right","right"],headers:[{cells:[{value:"Drink"},{value:"Quantity"},{value:"Total Price (£)"}],actions:[{primary:!0,icon:"plus",label:"Add",onClick:()=>b()}]}],rows:T,footer:{pagination:{rowCount:i.length,selectedPage:l,rowsPerPage:{onChange:a=>{const{value:m}=a.target;w(Number(m))},options:k,value:p},onSelectPage:a=>t(a),small:!0}}}})},J=()=>{const h=["Section","Width","Height"];let g=Array.from(Array(10),(p,w)=>[w,w*2,w*2]);const[o,x]=S.useState({pastedValues:"",rowIndex:0,cellIndex:0}),i=(p,w,l,t)=>{g[w][l]=Number(p.target.value),t()},R=(p,w,l,t)=>{var c;let r=((c=p==null?void 0:p.clipboardData)==null?void 0:c.getData("text"))??"";return x({rowIndex:w,cellIndex:l,pastedValues:r}),t(),{pastedData:o}},k=()=>{const[p,w]=S.useState(!1),l=()=>{w(!p)},t={headers:[{cells:h.map(r=>({value:r}))}],rows:g.map((r,c)=>{const b=c;return{cells:[...Array(3).keys()].map((y,s)=>({value:r[s],type:"Input",onChange:u=>i(u,b,s,l),onPaste:u=>R(u,b,s,l)}))}})};return n.jsxs(n.Fragment,{children:[n.jsx(D,{table:t}),n.jsx(oe,{label:"Pasted Data",children:n.jsx(se,{value:o.pastedValues})}),n.jsx(oe,{label:"At Row",children:n.jsx(se,{value:o.rowIndex})}),n.jsx(oe,{label:"At Cell Index",children:n.jsx(se,{value:o.cellIndex})})]})};return n.jsx(k,{})},X=()=>{const h={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],columnAlignment:[...Array(10)].map((g,o)=>"right"),headers:[{cells:[...Array(10)].map((g,o)=>({value:"Heading"}))},{cells:[...Array(10)].map((g,o)=>({options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],type:"Select",searchable:!1,value:{label:"m",value:"m"},autoLayerWidth:!0}))}],rows:[...Array(10)].map((g,o)=>({cells:[...Array(10)].map((x,i)=>({value:123.45})),actions:[{icon:"help",tooltip:n.jsxs(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here lorem ipsum"}),n.jsx(W,{children:"Label: 123.45m"}),n.jsx(W,{children:"Another label: 123.45m"}),n.jsx(W,{children:"Label: 123.45m"})]})}]}))};return n.jsx(D,{table:h})},Y=()=>{const h={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],headers:[{cells:[{value:"Label"},{value:"Value",colSpan:2}]}],rows:[{cells:[{value:"Country",style:{fontWeight:"bold"},width:"120px"},{value:"Norway",colSpan:2}],actions:[{icon:"help",tooltip:n.jsxs(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here"}),n.jsx(W,{children:"Details go here"})]})}]},{cells:[{value:"Depth",style:{fontWeight:"bold"}},{value:123,width:"80px"},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:{label:"m",value:"m"},type:"Select",width:"80px"}],actions:[{icon:"help",tooltip:n.jsxs(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here"}),n.jsx(W,{children:"Details go here"})]})}]}]};return n.jsx(D,{table:h})};M.__docgenInfo={description:"",methods:[],displayName:"InCard"};q.__docgenInfo={description:"",methods:[],displayName:"Managed"};K.__docgenInfo={description:"",methods:[],displayName:"ManagedWithSort"};B.__docgenInfo={description:"",methods:[],displayName:"ManagedWithFilterAndMultipleSort"};z.__docgenInfo={description:"",methods:[],displayName:"AutoAddNewRow"};J.__docgenInfo={description:"",methods:[],displayName:"OnPasteCallback"};X.__docgenInfo={description:"",methods:[],displayName:"ExampleTableWithInfoTooltips"};Y.__docgenInfo={description:"",methods:[],displayName:"ExampleTableWithInlineUnits"};var ce,de,ue;te.parameters={...te.parameters,docs:{...(ce=te.parameters)==null?void 0:ce.docs,source:{originalSource:`args => {
|
|
1
|
+
import{j as n}from"./jsx-runtime-eps93zm2.js";import{r as S}from"./index-DhsZuJvc.js";import{f as ne}from"./immer.esm-BwVl9PS2.js";import{l as Z}from"./lodash-c4VUpsOs.js";import{G as le}from"./grid-DRkC-bt8.js";import{T as W}from"./text-B3-TSWok.js";import{T as D}from"./table-D2bws-Po.js";import{C as dn}from"./card-EcjmryU9.js";import{I as se}from"./input-DTXbDJaL.js";import{F as oe}from"./field-HrLaMLbx.js";import{H as un}from"./heading-CRNoBc7q.js";import{t as ae,x as pn,y as mn,z as gn,A as bn,B as hn,C as wn,D as yn}from"./table.stories-data-C3vJedB1.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./index-Bk2sglWO.js";import"./index.es-DazXb-ul.js";import"./inheritsLoose-DP0QEDDI.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./index-CUZDtIZe.js";import"./memoize-one.esm-CcMeOnPo.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./actions-D-uVCDzk.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./index-CEuq6vkz.js";import"./tooltip-1V7clEnw.js";import"./types-BmbYqTX_.js";import"./types-Dx2TtIG9.js";import"./badge-CLQ59MDF.js";import"./pagination-CLt-kUlx.js";import"./select-DnRuRG_N.js";import"./assertThisInitialized-B9jnkVVz.js";import"./select.input-D0UkAPd9.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./number-input-B25TXDQC.js";import"./index-C0x1JmaP.js";import"./index-DRSy5Ssd.js";import"./check-box-DPLaOkRR.js";import"./help-icon-Buhx5nl6.js";import"./slider-C7vnj_3M.js";import"./index-BI4_Bp97.js";import"./popover-rq33c1W2.js";import"./label-CqmyC9he.js";import"./flex-EllkLxgO.js";const gt={title:"Basic/Table",component:D,args:{table:{...ae}}},A=h=>n.jsx(D,{...h}),te=A.bind({}),E=A.bind({});E.args={table:{...ae,fixedWidth:"400px"}};const L=A.bind({});L.args={table:{...ae,fixedWidth:"auto"}};const _=A.bind({});_.args={table:pn};_.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=A.bind({});Q.args={table:mn};const O=A.bind({});O.args={table:gn};O.parameters={docs:{description:{story:"This is only required when you need to override `columnAlignment` in header cells (i.e. they have different alignment)"}}};const G=A.bind({});G.args={table:bn};const N=A.bind({});N.args={table:hn};N.decorators=[h=>n.jsx("div",{style:{position:"absolute",inset:0,padding:"var(--padding)"},children:n.jsx(h,{})})];const U=A.bind({});U.args={table:wn};U.parameters={docs:{description:{story:"If a `maxHeight` is set, the table should only fill that height if it needs to."}}};const $=A.bind({});$.args={table:yn};const M=()=>n.jsx(dn,{heading:n.jsx(un,{children:"Card heading"}),padding:!1,children:n.jsx(D,{table:{...ae,bordered:!1}})});M.parameters={docs:{source:{type:"dynamic"}}};const q=()=>{const h=["Section","Width","Height"];let g=["","m","m"],o=[...Array(175).keys()].map((l,t)=>[t,t*2,t*2]);const x=(l,t,r)=>l==="m"&&t==="ft"?r*3.28084:l==="ft"&&t==="m"?r/3.28084:r,i=(l,t,r,c)=>{o[t][r]=l.target.value,c()},R=l=>{o=o.concat([["","",""]]),l()},k=(l,t)=>{o=o.filter((r,c)=>c!==l),t()},p=(l,t,r)=>{const c=g[t],b=l.target.value;g=g.map((y,s)=>s===t?b:y),o=o.map(y=>y.map((s,u)=>u===t?x(c,b,s):s)),r()},w=()=>{const l=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[t,r]=S.useState(10),[c,b]=S.useState(1),[y,s]=S.useState(!1),u=()=>{s(!y)},j=()=>{const e=Math.ceil(o.length/t);b(e)},T=(c-1)*t,a=t===0?o.length-1:T+t,m={headers:[{cells:h.map(e=>({value:e})),actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{R(u),j()}}]},{cells:[{},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:g[1],type:"Select",native:!0,onChange:e=>p(e,1,u)},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:g[2],type:"Select",native:!0,onChange:e=>p(e,2,u)}]}],rows:o.slice(T,a).map((e,d)=>{const I=T+d;return{cells:[...Array(3).keys()].map((P,v)=>({value:e[v],type:"Input",onChange:C=>i(C,I,v,u)})),actions:[{label:"Delete",icon:"minus",onClick:()=>k(I,u)}]}}),footer:{pagination:{rowCount:o.length,selectedPage:c,rowsPerPage:{onChange:e=>{const{value:d}=e.target;r(Number(d))},options:l,value:t},onSelectPage:e=>b(e),small:!0}}};return n.jsx(D,{table:m})};return n.jsx(w,{})},K=()=>{const h=["Section","Width","Height"];let g=[...Array(20).keys()].map((x,i)=>({Section:Z.random(0,100),Width:Z.random(0,100),Height:Z.random(0,100)}));const o=()=>{const[x,i]=S.useState({Section:"up"}),R=(r,c)=>r.sort((b,y)=>Object.entries(c).map(([s,u])=>{switch(u){case"up":return b[s]-y[s];case"down":return y[s]-b[s];default:return 0}}).reduce((s,u)=>s||u,0)),k=(r,c,b)=>({dataSortCells:r.map(s=>{const u=Object.keys(c).includes(s)?c[s]:"",j=`${s[0].toUpperCase()}${s.slice(1)}`;return{key:s,value:j,hasSort:!0,sort:u,onSort:()=>{const T=u==="up"?"down":"up";b({[s]:T})}}})}),{dataSortCells:p}=k(h,x,i),l=[...R(g,x).map(r=>({cells:Object.entries(r).map(([b,y])=>({key:b,value:y,type:"Input",disabled:!0}))}))],t={headers:[{cells:p}],rows:l};return n.jsx(D,{table:t})};return n.jsx(o,{})},B=()=>{const h=["Section","Width","Height"];let g=[...Array(175).keys()].map((x,i)=>({Section:i,Width:i*2,Height:i*2}));const o=()=>{const x=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[i,R]=S.useState(10),[k,p]=S.useState(1),[w,l]=S.useState({}),[t,r]=S.useState({});S.useEffect(()=>{p(1)},[w,t]);const c=(k-1)*i,b=i===0?g.length-1:c+i,y=(e,d,I)=>e.filter(P=>Object.keys(d).every(v=>d[v]===""?!0:P[v].toString().includes(d[v]))).sort((P,v)=>Object.entries(I).map(([C,H])=>{switch(H){case"up":return P[C]-v[C];case"down":return v[C]-P[C];default:return 0}}).reduce((C,H)=>C||H,0)),s=(e,d,I,P,v)=>{const C=e.map(f=>{const V=Object.keys(P).includes(f)?P[f]:"",F=`${f[0].toUpperCase()}${f.slice(1)}`;return{key:f,value:F,hasSort:!0,sort:V,onSort:()=>{const ee=V===""?"up":V==="up"?"down":"";v({...P,[f]:ee})}}}),H=e.map(f=>{const V=Object.keys(d).includes(f)?d[f]:"";return{key:f,value:V,type:"Input",placeholder:"Filter",onChange:F=>I({...d,[f]:F.target.value})}});return{dataSortCells:C,dataFilterCells:H}},{dataSortCells:u,dataFilterCells:j}=s(h,w,l,t,r),T=y(g,w,t),a=[...T.slice(c,b).map(e=>({cells:Object.entries(e).map(([I,P])=>({key:I,value:P,type:"Input",disabled:!0}))}))],m={headers:[{cells:u},{cells:j}],rows:a,footer:{pagination:{rowCount:T.length,selectedPage:k,rowsPerPage:{onChange:e=>{const{value:d}=e.target;R(Number(d))},options:x,value:i},onSelectPage:e=>p(e),small:!0}}};return n.jsx(D,{table:m})};return n.jsx(o,{})},z=()=>{const h={tea:3.6,coffee:3.2,orange:4.1},g=[{label:"Tea",value:"tea"},{label:"Coffee",value:"coffee"},{label:"Orange juice",value:"orange"}],o={cells:[{type:"Select",options:g,value:{value:"tea"}},{type:"Input"},{type:"Static"}]},x=[...Array(15).keys()].map((a,m)=>({cells:[{type:"Select",options:g,value:{value:"tea"}},{type:"Input",value:m+1},{type:"Static"}]})),[i,R]=S.useState(x),k=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[p,w]=S.useState(10),[l,t]=S.useState(1),r=(l-1)*p,c=p===0?i.length-1:r+p,b=({newRow:a}={})=>{const m=ne(i,e=>{e.push(a??o)});R(m)},y=({rowIndex:a})=>{const m=ne(i,e=>{delete e[a]}).filter(e=>e);R(m)},s=({rowIndex:a,value:m})=>{const e=ne(i,d=>{d[a].cells[0].value.value=m});R(e)},u=({rowIndex:a,value:m})=>{const e=ne(i,d=>{d[a].cells[1].value=m});R(e)},j=({value:a})=>{const m=Number(a);return!Z.isNaN(m)&&Z.isInteger(m)&&m>0},T=i.slice(r,c).map((a,m)=>{const e=r+m;return i.length-1,{...a,cells:a==null?void 0:a.cells.map((d,I)=>{var f,V,F,ee,ie;const P=(F=(V=(f=a==null?void 0:a.cells)==null?void 0:f[0])==null?void 0:V.value)==null?void 0:F.value,v=Number((ie=(ee=a==null?void 0:a.cells)==null?void 0:ee[1])==null?void 0:ie.value),C=h==null?void 0:h[P],H=C&&j({value:v})?(C*v).toFixed(2):null;if(I===0)return{...d,onChange:re=>s({rowIndex:e,value:re.target.value})};if(I===1)return{...d,onChange:re=>u({rowIndex:e,value:re.target.value}),error:j({value:d.value})?null:"Must be valid whole number"};if(I===2)return{...d,value:H}}),actions:[{label:"Delete",icon:"minus",onClick:()=>y({rowIndex:e})}]}});return n.jsx(D,{table:{defaultEmptyRow:o,onAddRow:b,columnAlignment:["left","right","right"],headers:[{cells:[{value:"Drink"},{value:"Quantity"},{value:"Total Price (£)"}],actions:[{primary:!0,icon:"plus",label:"Add",onClick:()=>b()}]}],rows:T,footer:{pagination:{rowCount:i.length,selectedPage:l,rowsPerPage:{onChange:a=>{const{value:m}=a.target;w(Number(m))},options:k,value:p},onSelectPage:a=>t(a),small:!0}}}})},J=()=>{const h=["Section","Width","Height"];let g=Array.from(Array(10),(p,w)=>[w,w*2,w*2]);const[o,x]=S.useState({pastedValues:"",rowIndex:0,cellIndex:0}),i=(p,w,l,t)=>{g[w][l]=Number(p.target.value),t()},R=(p,w,l,t)=>{var c;let r=((c=p==null?void 0:p.clipboardData)==null?void 0:c.getData("text"))??"";return x({rowIndex:w,cellIndex:l,pastedValues:r}),t(),{pastedData:o}},k=()=>{const[p,w]=S.useState(!1),l=()=>{w(!p)},t={headers:[{cells:h.map(r=>({value:r}))}],rows:g.map((r,c)=>{const b=c;return{cells:[...Array(3).keys()].map((y,s)=>({value:r[s],type:"Input",onChange:u=>i(u,b,s,l),onPaste:u=>R(u,b,s,l)}))}})};return n.jsxs(n.Fragment,{children:[n.jsx(D,{table:t}),n.jsx(oe,{label:"Pasted Data",children:n.jsx(se,{value:o.pastedValues})}),n.jsx(oe,{label:"At Row",children:n.jsx(se,{value:o.rowIndex})}),n.jsx(oe,{label:"At Cell Index",children:n.jsx(se,{value:o.cellIndex})})]})};return n.jsx(k,{})},X=()=>{const h={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],columnAlignment:[...Array(10)].map((g,o)=>"right"),headers:[{cells:[...Array(10)].map((g,o)=>({value:"Heading"}))},{cells:[...Array(10)].map((g,o)=>({options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],type:"Select",searchable:!1,value:{label:"m",value:"m"},autoLayerWidth:!0}))}],rows:[...Array(10)].map((g,o)=>({cells:[...Array(10)].map((x,i)=>({value:123.45})),actions:[{icon:"help",tooltip:n.jsxs(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here lorem ipsum"}),n.jsx(W,{children:"Label: 123.45m"}),n.jsx(W,{children:"Another label: 123.45m"}),n.jsx(W,{children:"Label: 123.45m"})]})}]}))};return n.jsx(D,{table:h})},Y=()=>{const h={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],headers:[{cells:[{value:"Label"},{value:"Value",colSpan:2}]}],rows:[{cells:[{value:"Country",style:{fontWeight:"bold"},width:"120px"},{value:"Norway",colSpan:2}],actions:[{icon:"help",tooltip:n.jsxs(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here"}),n.jsx(W,{children:"Details go here"})]})}]},{cells:[{value:"Depth",style:{fontWeight:"bold"}},{value:123,width:"80px"},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:{label:"m",value:"m"},type:"Select",width:"80px"}],actions:[{icon:"help",tooltip:n.jsxs(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here"}),n.jsx(W,{children:"Details go here"})]})}]}]};return n.jsx(D,{table:h})};M.__docgenInfo={description:"",methods:[],displayName:"InCard"};q.__docgenInfo={description:"",methods:[],displayName:"Managed"};K.__docgenInfo={description:"",methods:[],displayName:"ManagedWithSort"};B.__docgenInfo={description:"",methods:[],displayName:"ManagedWithFilterAndMultipleSort"};z.__docgenInfo={description:"",methods:[],displayName:"AutoAddNewRow"};J.__docgenInfo={description:"",methods:[],displayName:"OnPasteCallback"};X.__docgenInfo={description:"",methods:[],displayName:"ExampleTableWithInfoTooltips"};Y.__docgenInfo={description:"",methods:[],displayName:"ExampleTableWithInlineUnits"};var ce,de,ue;te.parameters={...te.parameters,docs:{...(ce=te.parameters)==null?void 0:ce.docs,source:{originalSource:`args => {
|
|
2
2
|
return <Table
|
|
3
3
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4
4
|
{...args} />;
|
package/dist/storybook/assets/{table.stories-data-D52aKMY1.js → table.stories-data-C3vJedB1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./jsx-runtime-eps93zm2.js";import{I as o,T as c}from"./common-types-Sih75Sav.js";import{F as v}from"./flex-EllkLxgO.js";import{M as p}from"./actions-D-uVCDzk.js";import{T as d}from"./text-B3-TSWok.js";import{I as n}from"./icon-BSFY3vDO.js";import{M as r}from"./types-BmbYqTX_.js";const e={headers:[{cells:[{value:"Name"},{value:"Weight"},{value:"Energy"},{value:"Origin"}]}],rows:[{cells:[{value:"Brown rice",testId:"table-tbody-cell-brown-rice"},{value:100,testId:"table-tbody-cell-100"},{value:361,testId:"table-tbody-cell-361"},{value:"Vietnam",testId:"table-tbody-cell-vietnam"}]},{cells:[{value:"Buckwheat",testId:"table-tbody-cell-buckwheat"},{value:50,testId:"table-tbody-cell-50"},{value:358,testId:"table-tbody-cell-358"},{value:"Poland",testId:"table-tbody-cell-poland"}]},{cells:[{value:"Couscous",testId:"table-tbody-cell-couscous"},{value:10,testId:"table-tbody-cell-10"},{value:368,testId:"table-tbody-cell-368"},{value:"France",testId:"table-tbody-cell-france"}]}]},S={...e,columnWidths:["200px","20%","100px","auto"]},x={...e,rows:e.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,tooltip:"Tooltip"}))}))},f={...e,rows:e.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,width:"200px"}))}))},W={...e,rows:e.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,style:{width:"200px",background:"var(--color-background-table-header)",fontWeight:"bold"}}))}))},F={...e,rows:[{cells:[{breakWord:!0,value:"LoremipsumdolorsitametconsecteturadipiscingelitseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquaUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariaturufugiatnullapariatur"},{value:100},{value:361},{value:"Vietnam"}]},...e.rows]},D={...e,headers:[...e.headers,{cells:[{},{options:[{label:"kg",value:"kg"},{label:"tonnes",value:"tonnes"}],type:"Select",searchable:!1,value:{label:"kg",value:"kg"},onChange:()=>{}},{type:"Unit",value:"kcal / 100g"},{}]}]},L={...e,rows:e.rows.map((l,a)=>({...l,active:a===0,onRowClick:()=>{}}))},E={...e,rows:e.rows.map((l,a)=>({...l,error:a===1}))},P={...e,rows:e.rows.map((l,a)=>({...l,warning:a===1}))},A={...e,name:"Food"},V={...e,name:t.jsxs(v,{gap:"var(--padding-xs)",alignItems:"center",children:["Food",t.jsx(n,{icon:o.STAR})]})},u=[{childComponent:t.jsx(p,{menu:{label:"Import food",trigger:c.DROP_DOWN_BUTTON,sections:[{type:r.HEADING,label:"Import options"},{type:r.OPTION,label:"Import from csv"},{type:r.OPTION,label:"Import from library"}],small:!0}})}],B={...e,name:"Food",actions:u,testId:"table-child-component"},N={...e,actions:u,actionsRight:!0},i={...e,headers:[...e.headers,{cells:[{},{options:[{label:"kg",value:"kg"},{label:"tonnes",value:"tonnes"}],type:"Select",native:!0,value:{label:"kg",value:"kg"},onChange:()=>{}},{type:"Unit",value:"kcal / 100g"},{}]}],bordered:!0,infiniteScroll:!0,maxHeight:"500px",stickyHeaders:!0,rows:Array.from({length:100},(l,a)=>({cells:[{type:"Input",value:`Strawberry Letter ${a+1}`},{type:"Input",value:100},{type:"Input",value:361},{type:"Input",value:"Vietnam"}]})),footer:{content:t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:"Footer content:"})," goes here"]})}},O={...i,maxHeight:"100%"},j={...i,rows:Array.from({length:1},(l,a)=>({cells:[{type:"Input",value:`Strawberry Letter ${a+1}`},{type:"Input",value:100},{type:"Input",value:361},{type:"Input",value:"Vietnam"}]}))},T={...i,draggable:!0},H={...e,rows:e.rows.map(l=>({...l,onRowFocus:()=>{}}))},b=()=>t.jsxs("ul",{children:[t.jsx("li",{children:"Carrots"}),t.jsx("li",{children:"Chocolate"}),t.jsx("li",{children:"Chorizo"})]}),R={headers:[{cells:[{value:"Name"},{value:"Content"}]}],rows:[{cells:[{value:"Sub-component"},{value:b()}]},{cells:[{value:"JSX"},{value:t.jsxs("div",{children:["Some ",t.jsx(d,{bold:!0,children:"bold content"})]})}]}]},m={...e,headers:[{cells:[{value:""},{value:"Stats",colSpan:2},{value:""}]},...e.headers],rows:[...e.rows,{cells:[{value:"Total",colSpan:4}]}]},q={...e,headers:[{cells:[{value:"Name",colSpan:2},{value:"Origin",rowSpan:2}]},{cells:[{value:"English"},{value:"Chinese"}]}],rows:[{cells:[{type:"Input",value:"Brown rice"},{type:"Input",value:"糙米"},{type:"Select",options:[{label:"China",value:"China"},{label:"France",value:"France"},{label:"Poland",value:"Poland"}],value:{label:"China",value:"China"},rowSpan:2}]},{cells:[{type:"Input",value:"White rice"},{type:"Input",value:"白米"}]}]},M={...e,columnWidths:["auto","120px","120px","auto"],headers:[{cells:[{value:"Header"},{value:"Header",colSpan:2},{value:"Header"}]}]},U={...e,columnAlignment:["left","right","right","left"]},J={...m,columnAlignment:["left","right","right","left","right"],columnHeaderAlignments:[["","center",""],["","right","right",""]]},s={fixedWidth:"auto",headers:[{cells:[{value:"Input",testId:"with-editable-cells-cell-name",width:"140px"},{value:"Select (native)",width:"140px"},{value:"Number Input",width:"140px"},{value:"Select (custom)",width:"140px"},{value:"Slider",width:"140px"},{value:"Static"}]}],rows:[{cells:[{value:"Buckwheat",type:"Input",onChange:()=>{},testId:"table-tbody-cell-buckwheat"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{}},{value:361,type:"NumberInput",onChange:()=>{}},{type:"Select",options:[{label:"France",value:"France"},{label:"Poland",value:"Poland"},{label:"Vietnam",value:"Vietnam"}],value:{label:"Poland",value:"Poland"},onChange:()=>{}},{type:"Slider",value:50,min:0,max:100,onChange:()=>{}},{value:361}]},{cells:[{value:"",type:"Input",onChange:()=>{},testId:"table-tbody-cell-arborio",error:"Error"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{},error:"Error"},{value:361,type:"NumberInput",onChange:()=>{},error:"Error"},{type:"Select",options:[{label:"France",value:"France"},{label:"Italy",value:"Italy"},{label:"Vietnam",value:"Vietnam"}],value:{label:"Italy",value:"Italy"},onChange:()=>{},error:"Error"},{type:"Slider",value:50,min:0,max:100,onChange:()=>{},error:"Error"},{value:361,error:"Error"}]},{cells:[{value:"Couscous",type:"Input",onChange:()=>{},testId:"table-tbody-cell-couscous",warning:"Warning"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{},warning:"Warning"},{value:361,type:"NumberInput",onChange:()=>{},warning:"Warning"},{type:"Select",options:[{label:"France",value:"France"},{label:"Poland",value:"Poland"},{label:"Vietnam",value:"Vietnam"}],value:{label:"France",value:"France"},onChange:()=>{},warning:"Warning"},{type:"Slider",value:50,min:0,max:100,onChange:()=>{},warning:"Warning"},{value:361,warning:"Warning"}]}]},z={...e,headers:e.headers.map(l=>({...l,cells:[{type:"CheckBox",onChange:()=>{}},...l.cells]})),rows:e.rows.map(l=>({...l,cells:[{type:"CheckBox",onChange:()=>{}},...l.cells]}))},_={...s,rows:s.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,disabled:!0}))}))},G={...e,headers:[...e.headers,{cells:[{value:"",type:"Input",placeholder:"Search",onChange:()=>{}},{value:"",type:"Input",placeholder:"Search",onChange:()=>{}},{value:"",type:"Input",placeholder:"Search",onChange:()=>{}},{value:"",type:"Input",placeholder:"Search",onChange:()=>{}}]}]},$={headers:[{cells:[{value:"Name"},{value:"Weight (kg)",hasSort:!0,sort:"up",sortPriority:1,onSort:()=>{}},{value:"Energy (kcal / 100g)",hasSort:!0,sort:"down",sortPriority:2,onSort:()=>{}},{value:"Origin",hasSort:!0,sort:"",sortPriority:1,onSort:()=>{}}]}],rows:[{cells:[{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"}]}]},K={headers:[{cells:[{},{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"}]}],rows:[{cells:[{type:"Icon",icon:t.jsx(n,{icon:o.SUCCESS,color:"var(--color-text-success)"}),tooltip:"Success tooltip here",width:"var(--size)"},{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"}]},{cells:[{type:"Icon",icon:t.jsx(n,{icon:o.WARNING,color:"var(--color-text-warning)"}),tooltip:"Warning tooltip here",width:"var(--size)"},{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}]},{cells:[{type:"Icon",icon:t.jsx(n,{icon:o.ERROR,color:"var(--color-text-error)"}),tooltip:"Error tooltip here",width:"var(--size)"},{value:"Couscous"},{value:10},{value:368},{value:"France"}]}]},X={headers:[{cells:[{value:"Lorem"},{value:"Ipsum"}]}],rows:[{cells:[{type:"Link",value:"Link text",onClick:()=>console.log("Link clicked")},{type:"Link",value:"Disabled link text",disabled:!0,onClick:()=>console.log("Link clicked")}]},{cells:[{type:"Link",value:"Static warning link",warning:"Warning message",onClick:()=>console.log("Link clicked")},{type:"Link",value:"Static error link",error:"Error message",onClick:()=>console.log("Link clicked")}]}]},Q={headers:[{cells:[{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{}}]}],rows:[{cells:[{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{label:"test",icon:"minus",onClick:()=>{},hidden:!0}]}]},Y={headers:[{cells:[{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"}],actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{}}]}],rows:[{cells:[{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"}],actions:[{label:"More",subActions:[{label:"Move Up",icon:"up",onClick:()=>{}},{label:"Move Down",icon:"down",onClick:()=>{}}]},{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}],actions:[{label:"More",subActions:[{label:"Move Up",icon:"up",onClick:()=>{}},{label:"Move Down",icon:"down",onClick:()=>{}}]},{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"}],actions:[{label:"More",subActions:[{label:"Move Up",icon:"up",onClick:()=>{}},{label:"Move Down",icon:"down",onClick:()=>{}}]},{label:"Delete",icon:"minus",onClick:()=>{}}]}]},Z={...e,footer:{content:t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:"Footer content:"})," goes here"]}),pagination:{rowCount:500,selectedPage:10,rowsPerPage:{onChange:()=>{},options:[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],value:20},goTo:{onChange:()=>{}},onSelectPage:()=>{},small:!0},actions:[{label:"Star",icon:"star",onClick:()=>{}}]}},ee={...e,headers:e.headers.map(l=>({...l,cells:l.cells.map(a=>({...a,helpIcon:{onClick:()=>console.log("Help clicked"),tooltip:"Help text goes here"},libraryIcon:{onClick:()=>console.log("Library clicked"),tooltip:"Edit in library"}}))}))},le={columnWidths:[void 0,"100px","100px","100px",void 0],columnAlignment:["left","right","left","left","left","right"],columnHeaderAlignments:[["left","right","left","left","left","right"]],headers:[{cells:[{value:"Lorem ipsum dolor sit amet consectetur adipiscing elit sed doeius mod tempor incididunt laboreet dolore magna aliqua"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"},{value:"Static"},{value:"Static Right"}]}],rows:[{cells:[{breakWord:!0,value:"LoremipsumdolorsitametconsecteturadipiscingelitseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquaUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariaturufugiatnullapariatur"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{},disabled:!0},{type:"Select",options:[{label:"Vietnam",value:"Vietnam"},{label:"Other",value:"Other"}],value:{label:"Vietnam",value:"Vietnam"},onChange:()=>{},error:"Error"},{value:"Brown rice",type:"Input",onChange:()=>{},testId:"table-tbody-cell-brown-rice",warning:"Warning message"},{value:"Static warning",warning:"Warning message"},{value:"100"}]},{cells:[{value:"Buckwheat"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{}},{type:"Select",options:[{label:"Vietnam",value:"Vietnam"},{label:"Other",value:"Other"}],value:{label:"Vietnam",value:"Vietnam"},onChange:()=>{}},{value:"Brown rice",type:"Input",onChange:()=>{},testId:"table-tbody-cell-brown-rice"},{type:"Link",value:"Static error link",error:"Error message"},{value:"100"}]}]},ae={fixedWidth:"auto",headers:[{cells:[{value:"Name"},{value:"Date of birth"}]}],rows:[{cells:[{value:"John Smith",width:"140px"},{value:"1980-05-05",type:"DateInput",width:"110px"}]},{cells:[{value:"Jane Doe",width:"140px"},{value:"1984-12-12",type:"DateInput",width:"110px"}]}]};export{i as A,O as B,j as C,T as D,D as E,A as F,V as G,B as H,G as I,$ as J,N as K,ee as L,s as a,_ as b,ae as c,m as d,M as e,f,W as g,q as h,z as i,K as j,X as k,Q as l,Y as m,R as n,x as o,F as p,le as q,Z as r,L as s,e as t,E as u,P as v,H as w,S as x,U as y,J as z};
|
|
1
|
+
import{j as t}from"./jsx-runtime-eps93zm2.js";import{I as o,T as c}from"./common-types-Sih75Sav.js";import{F as v}from"./flex-EllkLxgO.js";import{M as p}from"./actions-D-uVCDzk.js";import{T as d}from"./text-B3-TSWok.js";import{I as n}from"./icon-BSFY3vDO.js";import{M as r}from"./types-BmbYqTX_.js";const e={headers:[{cells:[{value:"Name"},{value:"Weight"},{value:"Energy"},{value:"Origin"}]}],rows:[{cells:[{value:"Brown rice",testId:"table-tbody-cell-brown-rice"},{value:100,testId:"table-tbody-cell-100"},{value:361,testId:"table-tbody-cell-361"},{value:"Vietnam",testId:"table-tbody-cell-vietnam"}]},{cells:[{value:"Buckwheat",testId:"table-tbody-cell-buckwheat"},{value:50,testId:"table-tbody-cell-50"},{value:358,testId:"table-tbody-cell-358"},{value:"Poland",testId:"table-tbody-cell-poland"}]},{cells:[{value:"Couscous",testId:"table-tbody-cell-couscous"},{value:10,testId:"table-tbody-cell-10"},{value:368,testId:"table-tbody-cell-368"},{value:"France",testId:"table-tbody-cell-france"}]}]},x={...e,columnWidths:["200px","20%","100px","auto"]},S={...e,rows:e.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,tooltip:"Tooltip"}))}))},f={...e,rows:e.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,width:"200px"}))}))},W={...e,rows:e.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,style:{width:"200px",background:"var(--color-background-table-header)",fontWeight:"bold"}}))}))},F={...e,rows:[{cells:[{breakWord:!0,value:"LoremipsumdolorsitametconsecteturadipiscingelitseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquaUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariaturufugiatnullapariatur"},{value:100},{value:361},{value:"Vietnam"}]},...e.rows]},D={...e,headers:[...e.headers,{cells:[{},{options:[{label:"kg",value:"kg"},{label:"tonnes",value:"tonnes"}],type:"Select",searchable:!1,value:{label:"kg",value:"kg"},onChange:()=>{}},{type:"Unit",value:"kcal / 100g"},{}]}]},L={...e,rows:e.rows.map((l,a)=>({...l,active:a===0,onRowClick:()=>{}}))},E={...e,rows:e.rows.map((l,a)=>({...l,error:a===1}))},P={...e,rows:e.rows.map((l,a)=>({...l,warning:a===1}))},A={...e,name:"Food"},N={...e,name:t.jsxs(v,{gap:"var(--padding-xs)",alignItems:"center",children:["Food",t.jsx(n,{icon:o.STAR})]})},u=[{childComponent:t.jsx(p,{menu:{label:"Import food",trigger:c.DROP_DOWN_BUTTON,sections:[{type:r.HEADING,label:"Import options"},{type:r.OPTION,label:"Import from csv"},{type:r.OPTION,label:"Import from library"}],small:!0}})}],V={...e,name:"Food",actions:u,testId:"table-child-component"},B={...e,actions:u,actionsRight:!0},i={...e,headers:[...e.headers,{cells:[{},{options:[{label:"kg",value:"kg"},{label:"tonnes",value:"tonnes"}],type:"Select",native:!0,value:{label:"kg",value:"kg"},onChange:()=>{}},{type:"Unit",value:"kcal / 100g"},{}]}],bordered:!0,infiniteScroll:!0,maxHeight:"500px",stickyHeaders:!0,rows:Array.from({length:100},(l,a)=>({cells:[{type:"Input",value:`Strawberry Letter ${a+1}`},{type:"Input",value:100},{type:"Input",value:361},{type:"Input",value:"Vietnam"}]})),footer:{content:t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:"Footer content:"})," goes here"]})}},O={...i,maxHeight:"100%"},j={...i,rows:Array.from({length:1},(l,a)=>({cells:[{type:"Input",value:`Strawberry Letter ${a+1}`},{type:"Input",value:100},{type:"Input",value:361},{type:"Input",value:"Vietnam"}]}))},T={...i,draggable:!0},R={...e,rows:e.rows.map(l=>({...l,onRowFocus:()=>{}}))},b=()=>t.jsxs("ul",{children:[t.jsx("li",{children:"Carrots"}),t.jsx("li",{children:"Chocolate"}),t.jsx("li",{children:"Chorizo"})]}),H={headers:[{cells:[{value:"Name"},{value:"Content"}]}],rows:[{cells:[{value:"Sub-component"},{value:b()}]},{cells:[{value:"JSX"},{value:t.jsxs("div",{children:["Some ",t.jsx(d,{bold:!0,children:"bold content"})]})}]}]},m={...e,headers:[{cells:[{value:""},{value:"Stats",colSpan:2},{value:""}]},...e.headers],rows:[...e.rows,{cells:[{value:"Total",colSpan:4}]}]},q={...e,headers:[{cells:[{value:"Name",colSpan:2},{value:"Origin",rowSpan:2}]},{cells:[{value:"English"},{value:"Chinese"}]}],rows:[{cells:[{type:"Input",value:"Brown rice"},{type:"Input",value:"糙米"},{type:"Select",options:[{label:"China",value:"China"},{label:"France",value:"France"},{label:"Poland",value:"Poland"}],value:{label:"China",value:"China"},rowSpan:2}]},{cells:[{type:"Input",value:"White rice"},{type:"Input",value:"白米"}]}]},M={...e,columnWidths:["auto","120px","120px","auto"],headers:[{cells:[{value:"Header"},{value:"Header",colSpan:2},{value:"Header"}]}]},U={...e,columnAlignment:["left","right","right","left"]},J={...m,columnAlignment:["left","right","right","left","right"],columnHeaderAlignments:[["","center",""],["","right","right",""]]},s={fixedWidth:"auto",headers:[{cells:[{value:"Input",testId:"with-editable-cells-cell-name",width:"140px"},{value:"Select (native)",width:"140px"},{value:"Number Input",width:"140px"},{value:"Select (custom)",width:"140px"},{value:"Slider",width:"140px"},{value:"Static"}]}],rows:[{cells:[{value:"Buckwheat",type:"Input",onChange:()=>{},testId:"table-tbody-cell-buckwheat"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{}},{value:361,type:"NumberInput",onChange:()=>{}},{type:"Select",options:[{label:"France",value:"France"},{label:"Poland",value:"Poland"},{label:"Vietnam",value:"Vietnam"}],value:{label:"Poland",value:"Poland"},onChange:()=>{}},{type:"Slider",value:50,min:0,max:100,onChange:()=>{}},{value:361}]},{cells:[{value:"",type:"Input",onChange:()=>{},testId:"table-tbody-cell-arborio",error:"Error"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{},error:"Error"},{value:361,type:"NumberInput",onChange:()=>{},error:"Error"},{type:"Select",options:[{label:"France",value:"France"},{label:"Italy",value:"Italy"},{label:"Vietnam",value:"Vietnam"}],value:{label:"Italy",value:"Italy"},onChange:()=>{},error:"Error"},{type:"Slider",value:50,min:0,max:100,onChange:()=>{},error:"Error"},{value:361,error:"Error"}]},{cells:[{value:"Couscous",type:"Input",onChange:()=>{},testId:"table-tbody-cell-couscous",warning:"Warning"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{},warning:"Warning"},{value:361,type:"NumberInput",onChange:()=>{},warning:"Warning"},{type:"Select",options:[{label:"France",value:"France"},{label:"Poland",value:"Poland"},{label:"Vietnam",value:"Vietnam"}],value:{label:"France",value:"France"},onChange:()=>{},warning:"Warning"},{type:"Slider",value:50,min:0,max:100,onChange:()=>{},warning:"Warning"},{value:361,warning:"Warning"}]}]},z={...e,headers:e.headers.map(l=>({...l,cells:[{type:"CheckBox",onChange:()=>{}},...l.cells]})),rows:e.rows.map(l=>({...l,cells:[{type:"CheckBox",onChange:()=>{}},...l.cells]}))},_={...s,rows:s.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,disabled:!0}))}))},G={...e,headers:[...e.headers,{cells:[{value:"",type:"Input",placeholder:"Search",onChange:()=>{}},{value:"",type:"Input",placeholder:"Search",onChange:()=>{}},{value:"",type:"Input",placeholder:"Search",onChange:()=>{}},{value:"",type:"Input",placeholder:"Search",onChange:()=>{}}]}]},$={headers:[{cells:[{value:"Name"},{value:"Weight (kg)",hasSort:!0,sort:"up",sortPriority:1,onSort:()=>{}},{value:"Energy (kcal / 100g)",hasSort:!0,sort:"down",sortPriority:2,onSort:()=>{}},{value:"Origin",hasSort:!0,sort:"",sortPriority:1,onSort:()=>{}}]}],rows:[{cells:[{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"}]}]},K={headers:[{cells:[{},{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"}]}],rows:[{cells:[{type:"Icon",icon:t.jsx(n,{icon:o.SUCCESS,color:"var(--color-text-success)"}),tooltip:"Success tooltip here",width:"var(--size)"},{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"}]},{cells:[{type:"Icon",icon:t.jsx(n,{icon:o.WARNING,color:"var(--color-text-warning)"}),tooltip:"Warning tooltip here",width:"var(--size)"},{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}]},{cells:[{type:"Icon",icon:t.jsx(n,{icon:o.ERROR,color:"var(--color-text-error)"}),tooltip:"Error tooltip here",width:"var(--size)"},{value:"Couscous"},{value:10},{value:368},{value:"France"}]}]},X={headers:[{cells:[{value:"Lorem"},{value:"Ipsum"}]}],rows:[{cells:[{type:"Link",value:"Link text",onClick:()=>console.log("Link clicked")},{type:"Link",value:"Disabled link text",disabled:!0,onClick:()=>console.log("Link clicked")}]},{cells:[{type:"Link",value:"Static warning link",warning:"Warning message",onClick:()=>console.log("Link clicked")},{type:"Link",value:"Static error link",error:"Error message",onClick:()=>console.log("Link clicked")}]}]},Q={headers:[{cells:[{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{}}]}],rows:[{cells:[{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{label:"test",icon:"minus",onClick:()=>{},hidden:!0}]}]},Y={headers:[{cells:[{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"}],actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{}}]}],rows:[{cells:[{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"}],actions:[{label:"More",subActions:[{label:"Move Up",icon:"up",onClick:()=>{}},{label:"Move Down",icon:"down",onClick:()=>{}}]},{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}],actions:[{label:"More",subActions:[{label:"Move Up",icon:"up",onClick:()=>{}},{label:"Move Down",icon:"down",onClick:()=>{}}]},{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"}],actions:[{label:"More",subActions:[{label:"Move Up",icon:"up",onClick:()=>{}},{label:"Move Down",icon:"down",onClick:()=>{}}]},{label:"Delete",icon:"minus",onClick:()=>{}}]}]},Z={...e,footer:{content:t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:"Footer content:"})," goes here"]}),pagination:{rowCount:500,selectedPage:10,rowsPerPage:{onChange:()=>{},options:[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],value:20},goTo:{onChange:()=>{}},onSelectPage:()=>{},small:!0},actions:[{label:"Star",icon:"star",onClick:()=>{}}]}},ee={...e,headers:e.headers.map(l=>({...l,cells:l.cells.map(a=>({...a,helpIcon:{onClick:()=>console.log("Help clicked"),tooltip:"Help text goes here"},libraryIcon:{onClick:()=>console.log("Library clicked"),tooltip:"Edit in library"}}))}))},le={columnWidths:[void 0,"100px","100px","100px",void 0],columnAlignment:["left","right","right","left","left","left","right"],headers:[{cells:[{value:"Lorem ipsum dolor sit amet consectetur adipiscing elit sed doeius mod tempor incididunt laboreet dolore magna aliqua"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"},{value:"Text"},{value:"Static"},{value:"Static Right"}]}],rows:[{cells:[{breakWord:!0,value:"LoremipsumdolorsitametconsecteturadipiscingelitseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquaUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariaturufugiatnullapariatur"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{},disabled:!0},{type:"NumberInput",value:361},{type:"Select",options:[{label:"Vietnam",value:"Vietnam"},{label:"Other",value:"Other"}],value:{label:"Vietnam",value:"Vietnam"},onChange:()=>{},error:"Error"},{value:"Brown rice",type:"Input",onChange:()=>{},testId:"table-tbody-cell-brown-rice",warning:"Warning message"},{value:"Static warning",warning:"Warning message"},{value:"100"}]},{cells:[{value:"Buckwheat"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{}},{type:"NumberInput",value:361},{type:"Select",options:[{label:"Vietnam",value:"Vietnam"},{label:"Other",value:"Other"}],value:{label:"Vietnam",value:"Vietnam"},onChange:()=>{}},{value:"Brown rice",type:"Input",onChange:()=>{},testId:"table-tbody-cell-brown-rice"},{type:"Link",value:"Static error link",error:"Error message"},{value:"100"}]}]},ae={fixedWidth:"auto",headers:[{cells:[{value:"Name"},{value:"Date of birth"}]}],rows:[{cells:[{value:"John Smith",width:"140px"},{value:"1980-05-05",type:"DateInput",width:"110px"}]},{cells:[{value:"Jane Doe",width:"140px"},{value:"1984-12-12",type:"DateInput",width:"110px"}]}]};export{i as A,O as B,j as C,T as D,D as E,A as F,N as G,V as H,G as I,$ as J,B as K,ee as L,s as a,_ as b,ae as c,m as d,M as e,f,W as g,q as h,z as i,K as j,X as k,Q as l,Y as m,H as n,S as o,F as p,le as q,Z as r,L as s,e as t,E as u,P as v,R as w,x,U as y,J as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as G}from"./jsx-runtime-eps93zm2.js";import{T as X}from"./table-
|
|
1
|
+
import{j as G}from"./jsx-runtime-eps93zm2.js";import{T as X}from"./table-D2bws-Po.js";import{t as K,E as O,s as W,F as k,G as q,H as z,I as D,J as M,K as P,L as Q}from"./table.stories-data-C3vJedB1.js";import"./index-DhsZuJvc.js";import"./index-Bk2sglWO.js";import"./index.es-DazXb-ul.js";import"./inheritsLoose-DP0QEDDI.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./index-CUZDtIZe.js";import"./memoize-one.esm-CcMeOnPo.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./lodash-c4VUpsOs.js";import"./actions-D-uVCDzk.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./index-CEuq6vkz.js";import"./tooltip-1V7clEnw.js";import"./types-BmbYqTX_.js";import"./types-Dx2TtIG9.js";import"./badge-CLQ59MDF.js";import"./heading-CRNoBc7q.js";import"./help-icon-Buhx5nl6.js";import"./pagination-CLt-kUlx.js";import"./select-DnRuRG_N.js";import"./assertThisInitialized-B9jnkVVz.js";import"./text-B3-TSWok.js";import"./select.input-D0UkAPd9.js";import"./input-DTXbDJaL.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./number-input-B25TXDQC.js";import"./index-C0x1JmaP.js";import"./index-DRSy5Ssd.js";import"./check-box-DPLaOkRR.js";import"./slider-C7vnj_3M.js";import"./index-BI4_Bp97.js";import"./popover-rq33c1W2.js";import"./flex-EllkLxgO.js";const Gr={title:"Basic/Table/Title & Header",component:X,args:{table:{...K}}},r=B=>G.jsx(X,{...B}),e=r.bind({});e.args={table:O};const s=r.bind({});s.args={table:W};const a=r.bind({});a.args={table:k};const t=r.bind({});t.args={table:q};const o=r.bind({});o.args={table:z};const n=r.bind({});n.args={table:D};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} />;
|