@zonos/amino 5.4.8 → 5.4.9
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
2
|
import type { BaseProps } from "../../types/BaseProps";
|
|
3
3
|
import type { ReactComponent } from "../../types/ReactComponent";
|
|
4
4
|
type SimpleTableHeaderBaseProps = {
|
|
@@ -7,6 +7,11 @@ type SimpleTableHeaderBaseProps = {
|
|
|
7
7
|
* @default 'start'
|
|
8
8
|
*/
|
|
9
9
|
align?: 'start' | 'center' | 'end';
|
|
10
|
+
/**
|
|
11
|
+
* Disable truncating cell content
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
disableTruncate?: boolean;
|
|
10
15
|
/**
|
|
11
16
|
* @default false
|
|
12
17
|
* Disable link routing on cells
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../_tslib-bd4862e8.js"),l=require("react/jsx-runtime"),o=require("react"),i=require("clsx"),t=require("../checkbox/Checkbox.js"),n=require("../skeleton/Skeleton.js"),a=require("../text/Text.js"),d=require("../../style-inject.es-d4ddeae4.js");function r(e){return e&&e.__esModule?e:{default:e}}require("framer-motion"),require("../help-text/HelpText.js"),require("../../styles/constants/theme.js"),require("../../icons/CheckmarkIcon.js"),require("../../icons/icon-base/_IconBase.js"),require("../../global.module-569e4fd5.js"),require("../../utils/getTestId.js");var m=r(
|
|
1
|
+
"use strict";var e=require("../../_tslib-bd4862e8.js"),l=require("react/jsx-runtime"),o=require("react"),i=require("clsx"),t=require("../checkbox/Checkbox.js"),n=require("../skeleton/Skeleton.js"),a=require("../text/Text.js"),d=require("../../style-inject.es-d4ddeae4.js");function r(e){return e&&e.__esModule?e:{default:e}}require("framer-motion"),require("../help-text/HelpText.js"),require("../../styles/constants/theme.js"),require("../../icons/CheckmarkIcon.js"),require("../../icons/icon-base/_IconBase.js"),require("../../global.module-569e4fd5.js"),require("../../utils/getTestId.js");var m=r(o),s=r(i),c="Amino_SimpleTable-module__tableContainer--UsGFZ",b="Amino_SimpleTable-module__tableStyled--Q3YSy",u="Amino_SimpleTable-module__noPadding--b5Y-c",_="Amino_SimpleTable-module__withHover--eL3XX",h="Amino_SimpleTable-module__clickable--XnaaE",p="Amino_SimpleTable-module__noTruncate--jzBpJ",y="Amino_SimpleTable-module__loading--bvjof",S="Amino_SimpleTable-module__cellLink--jySVK",x="Amino_SimpleTable-module__styledCheckbox---753a",v="Amino_SimpleTable-module__skeletonCellWrapper--I8vJ7";d.styleInject(".Amino_SimpleTable-module__tableContainer--UsGFZ{width:100%}.Amino_SimpleTable-module__tableStyled--Q3YSy{border-collapse:initial;border-spacing:0;width:100%}.Amino_SimpleTable-module__tableStyled--Q3YSy>thead{text-transform:none}.Amino_SimpleTable-module__tableStyled--Q3YSy>thead>tr{border-bottom:var(--amino-border-subtle);height:48px}.Amino_SimpleTable-module__tableStyled--Q3YSy>thead>tr>th{background-color:var(--amino-gray-0);border-bottom:var(--amino-border-subtle);padding:12px;position:-webkit-sticky;position:sticky;top:0;white-space:nowrap}.Amino_SimpleTable-module__tableStyled--Q3YSy>thead>tr>th.Amino_SimpleTable-module__noPadding--b5Y-c{padding:0}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr{height:48px}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr.Amino_SimpleTable-module__withHover--eL3XX:hover{background-color:var(--amino-hover-color)}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr.Amino_SimpleTable-module__clickable--XnaaE{cursor:pointer}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr:not(:hover) .row-hover-show{visibility:collapse}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td{border-bottom:var(--amino-border-subtle);max-width:0;overflow:hidden;padding:12px;text-overflow:ellipsis;white-space:nowrap}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td.Amino_SimpleTable-module__noTruncate--jzBpJ{max-width:100%;overflow:visible;overflow:initial;white-space:inherit}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td.Amino_SimpleTable-module__noPadding--b5Y-c{padding:0}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td.Amino_SimpleTable-module__loading--bvjof{text-align:center}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td:not(:hover) .cell-hover-show{visibility:collapse}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td.Amino_SimpleTable-module__cellLink--jySVK{padding:0}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td.Amino_SimpleTable-module__cellLink--jySVK>a{display:block;height:100%;padding:12px;width:100%}.Amino_SimpleTable-module__tableStyled--Q3YSy>tbody>tr>td.Amino_SimpleTable-module__cellLink--jySVK>a.Amino_SimpleTable-module__noPadding--b5Y-c{padding:0}.Amino_SimpleTable-module__styledCheckbox---753a{display:inline-flex;padding:12px}.Amino_SimpleTable-module__skeletonCellWrapper--I8vJ7{display:flex}");var g=function(e){switch(e){case"center":return"center";case"end":return"flex-end";default:return"flex-start"}};exports.SimpleTable=function(i){var d=i.className,r=i.CustomLinkComponent,k=i.getRowLink,j=i.headers,T=i.items,A=i.keyExtractor,f=i.loading,C=void 0!==f&&f,w=i.loadingItems,Y=void 0===w?10:w,Q=i.loadingSkeletonHeight,q=void 0===Q?13:Q,N=i.maxHeight,H=void 0===N?"100%":N,R=i.noHoverBackground,L=void 0!==R&&R,P=i.onRowClick,I=i.onRowHover,F=i.renderFooter,V=i.selectable,X=void 0===V?{enabled:!1}:V,E=i.style,B=function(e,o){var i=o[e.key],t=function(i){var t=m.default.Children.toArray(i).some((function(e){return!!m.default.isValidElement(e)&&/row-hover-show|cell-hover-show/.test(e.props.className)}));if(k&&!X.anySelected&&!e.disabledLink){var n=r||"a";return l.jsx("td",{className:S,children:l.jsx(n,{className:s.default(e.noPadding&&u,(e.disableTruncate||t)&&p),href:k(o),style:{textAlign:e.align||"start"},children:i})})}return l.jsx("td",{className:s.default(e.noPadding&&u,(e.disableTruncate||t)&&p),style:{textAlign:e.align||"start"},children:i})};return e.renderCustom?l.jsx(l.Fragment,{children:t(e.renderCustom(i,o))}):l.jsx(l.Fragment,{children:t(String(i))})};return l.jsx("div",{className:s.default(c,d),style:e.__assign({maxHeight:H},E),children:l.jsxs("table",{className:b,children:[l.jsxs("colgroup",{children:[!!X.onHeaderCheckboxChange&&l.jsx("col",{width:0}),j.map((function(e){return l.jsx("col",{width:void 0!==e.width?"".concat(e.width,"%"):void 0},e.key)}))]}),l.jsx("thead",{children:l.jsxs("tr",{children:[!!X.onHeaderCheckboxChange&&l.jsx("th",{className:u,children:X.renderCustomHeaderCheckbox||l.jsx(t.Checkbox,{checked:!C&&X.headerCheckboxValue||!1,className:x,disabled:C,onChange:X.onHeaderCheckboxChange})}),j.map((function(e){return l.jsx("th",{className:s.default(e.noPadding&&u),style:{textAlign:e.align||"start"},children:"string"==typeof e.name?l.jsx(a.Text,{color:"gray800",type:"small-header",children:e.name}):e.name},e.key)}))]})}),l.jsx("tbody",{children:C?e.__spreadArray([],e.__read(Array(Y).keys()),!1).map((function(e){return l.jsxs("tr",{children:[X.enabled&&l.jsx("td",{children:l.jsx(n.Skeleton,{height:q},e)}),j.map((function(o){return l.jsx("td",{className:s.default(y,o.noPadding&&u),children:l.jsx("div",{className:v,style:{justifyContent:g(o.align)},children:l.jsx(n.Skeleton,{height:q,style:{width:"50%"}},e)})},o.key)}))]},e)})):T.map((function(e,i){var n,a,d,r=!!P||!!X.anySelected&&!!X.onRowCheckboxChange;return l.jsxs("tr",{className:s.default(r&&h,!L&&_),onClick:function(l){var o,t,n;X.anySelected?(null===(o=X.isRowCheckboxDisabled)||void 0===o?void 0:o.call(X,e,i))||(l.preventDefault(),null===(t=X.onRowCheckboxChange)||void 0===t||t.call(X,!(null===(n=X.isRowChecked)||void 0===n?void 0:n.call(X,e,i)),e,i)):null==P||P(e)},onMouseEnter:function(){return null==I?void 0:I(e)},children:[X.enabled&&l.jsx("td",{children:(null===(n=X.renderCustomRowCheckbox)||void 0===n?void 0:n.call(X,e,i))||l.jsx(t.Checkbox,{checked:(null===(a=X.isRowChecked)||void 0===a?void 0:a.call(X,e,i))||!1,disabled:(null===(d=X.isRowCheckboxDisabled)||void 0===d?void 0:d.call(X,e,i))||!1,onChange:function(l){var o;return null===(o=X.onRowCheckboxChange)||void 0===o?void 0:o.call(X,l,e,i)}})}),j.map((function(i){return l.jsx(o.Fragment,{children:B(i,e)},i.key)}))]},A(e))}))}),F]})})};
|