@mrshmllw/smores-react 11.0.1-crumbs-feature-adjust-package-2.1 → 11.1.0-crumbs-feature-support-rounded-sub-tables.1

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.
@@ -13,4 +13,4 @@ import { TableProps } from './types';
13
13
  * ## Improvements:
14
14
  * - It would be nice if we expandable logic inside this component, e.g the presence of certain props would automatically add this
15
15
  */
16
- export declare const Table: <T extends object>({ columns, data, fixedHeader, hasKeyline, expandable, subTable, subRows, headerHeight, headerColor, rowColor, stripedColor, rowBorderColor, rowActions, clickableRow, rowPadding, columnPadding, noDataContent, hideTableHeader, }: TableProps<T>) => React.JSX.Element;
16
+ export declare const Table: <T extends object>({ columns, data, fixedHeader, hasKeyline, expandable, subTable, subRows, headerHeight, headerColor, rowColor, stripedColor, rowBorderColor, rowActions, clickableRow, rowPadding, columnPadding, noDataContent, roundedTable, hideTableHeader, }: TableProps<T>) => React.JSX.Element;
@@ -16,16 +16,16 @@ import { StyledCell, StyledTable } from './components/commonComponents';
16
16
  * ## Improvements:
17
17
  * - It would be nice if we expandable logic inside this component, e.g the presence of certain props would automatically add this
18
18
  */
19
- export const Table = ({ columns, data, fixedHeader = true, hasKeyline = false, expandable, subTable, subRows, headerHeight, headerColor = 'mascarpone', rowColor = 'custard', stripedColor, rowBorderColor = 'oatmeal', rowActions, clickableRow, rowPadding, columnPadding, noDataContent, hideTableHeader = false, }) => {
20
- const showActionsCell = expandable || rowActions;
19
+ export const Table = ({ columns, data, fixedHeader = true, hasKeyline = false, expandable, subTable, subRows, headerHeight, headerColor = 'mascarpone', rowColor = 'custard', stripedColor, rowBorderColor = 'oatmeal', rowActions, clickableRow, rowPadding, columnPadding, noDataContent, roundedTable, hideTableHeader = false, }) => {
20
+ const showActionsCell = expandable ?? rowActions;
21
21
  const expandSubProp = showActionsCell ? columns.length + 1 : columns.length;
22
- return (React.createElement(StyledTable, null,
22
+ return (React.createElement(StyledTable, { "$roundedTable": roundedTable },
23
23
  !hideTableHeader && (React.createElement("thead", null,
24
24
  React.createElement(TableHeader, { columns: columns, fixedHeader: fixedHeader, headerHeight: headerHeight, subTable: subTable, headerColor: headerColor, rowActions: rowActions, columnPadding: columnPadding, expandable: expandable, hasKeyline: hasKeyline }))),
25
25
  React.createElement("tbody", null,
26
26
  data.length === 0 && (React.createElement("tr", null,
27
- React.createElement(StyledCell, { colSpan: expandSubProp, "$rowPadding": rowPadding, "$columnPadding": columnPadding }, noDataContent ? (noDataContent) : (React.createElement(Text, { align: "center" }, "No available data"))))),
27
+ React.createElement(StyledCell, { colSpan: expandSubProp, "$rowPadding": rowPadding, "$columnPadding": columnPadding }, noDataContent ?? React.createElement(Text, { align: "center" }, "No available data")))),
28
28
  data.length !== 0 &&
29
- data.map((row, rowIndex) => (React.createElement(TableRow, { key: rowIndex, rowData: row, rowIndex: rowIndex, columns: columns, rowActions: rowActions, stripedColor: stripedColor, subTable: subTable, subRows: subRows, rowColor: rowColor, rowBorderColor: rowBorderColor, rowPadding: rowPadding, columnPadding: columnPadding, expandable: expandable, clickableRow: clickableRow }))))));
29
+ data.map((row, rowIndex) => (React.createElement(TableRow, { key: rowIndex, rowData: row, rowIndex: rowIndex, columns: columns, rowActions: rowActions, stripedColor: stripedColor, subTable: subTable, subRows: subRows, rowColor: rowColor, rowBorderColor: rowBorderColor, rowPadding: rowPadding, columnPadding: columnPadding, expandable: expandable, clickableRow: clickableRow, hideBorder: Boolean(roundedTable) && rowIndex === data.length - 1 }))))));
30
30
  };
31
31
  //# sourceMappingURL=Table.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,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,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,CAC1B,oBAAC,QAAQ,IACP,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,GAC1B,CACH,CAAC,CACE,CACI,CACf,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Text } from '../Text'\nimport { TableHeader } from './components/TableHeader'\nimport { TableRow } from './components/TableRow'\nimport { StyledCell, StyledTable } from './components/commonComponents'\nimport { TableProps } from './types'\n\n/**\n * A table component that displays data with various features such as expandable rows, striped rows, and fixed headers.\n *\n * ## Caveats:\n * - `subRows` should always have the same columns as the Parent table\n * - `stripedColor` wont be applied to `subRows` or `subTables`\n * - `rowActions` will always need an `onClick`, this will be automatically passed onto the `ReactNode` you place & will be selectable\n * - Rows will scale depending on the cell content size\n * - Using `clickableRow` with clickable cells, ensure you use `e.stopPropagation` in your cells `onClick`\n *\n * ## Improvements:\n * - It would be nice if we expandable logic inside this component, e.g the presence of certain props would automatically add this\n */\nexport const Table = <T extends object>({\n columns,\n data,\n fixedHeader = true,\n hasKeyline = false,\n expandable,\n subTable,\n subRows,\n headerHeight,\n headerColor = 'mascarpone',\n rowColor = 'custard',\n stripedColor,\n rowBorderColor = 'oatmeal',\n rowActions,\n clickableRow,\n rowPadding,\n columnPadding,\n noDataContent,\n hideTableHeader = false,\n}: TableProps<T>) => {\n const showActionsCell = expandable || rowActions\n const expandSubProp = showActionsCell ? columns.length + 1 : columns.length\n return (\n <StyledTable>\n {!hideTableHeader && (\n <thead>\n <TableHeader\n columns={columns}\n fixedHeader={fixedHeader}\n headerHeight={headerHeight}\n subTable={subTable}\n headerColor={headerColor}\n rowActions={rowActions}\n columnPadding={columnPadding}\n expandable={expandable}\n hasKeyline={hasKeyline}\n />\n </thead>\n )}\n <tbody>\n {data.length === 0 && (\n <tr>\n <StyledCell\n colSpan={expandSubProp}\n $rowPadding={rowPadding}\n $columnPadding={columnPadding}\n >\n {noDataContent ? (\n noDataContent\n ) : (\n <Text align=\"center\">No available data</Text>\n )}\n </StyledCell>\n </tr>\n )}\n {data.length !== 0 &&\n data.map((row, rowIndex) => (\n <TableRow\n key={rowIndex}\n rowData={row}\n rowIndex={rowIndex}\n columns={columns}\n rowActions={rowActions}\n stripedColor={stripedColor}\n subTable={subTable}\n subRows={subRows}\n rowColor={rowColor}\n rowBorderColor={rowBorderColor}\n rowPadding={rowPadding}\n columnPadding={columnPadding}\n expandable={expandable}\n clickableRow={clickableRow}\n />\n ))}\n </tbody>\n </StyledTable>\n )\n}\n"]}
1
+ {"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAGvE;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAmB,EACtC,OAAO,EACP,IAAI,EACJ,WAAW,GAAG,IAAI,EAClB,UAAU,GAAG,KAAK,EAClB,UAAU,EACV,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,WAAW,GAAG,YAAY,EAC1B,QAAQ,GAAG,SAAS,EACpB,YAAY,EACZ,cAAc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AAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI,QAAQ,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,GACjE,CACH,CAAC,CACE,CACI,CACf,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Text } from '../Text'\nimport { TableHeader } from './components/TableHeader'\nimport { TableRow } from './components/TableRow'\nimport { StyledCell, StyledTable } from './components/commonComponents'\nimport { TableProps } from './types'\n\n/**\n * A table component that displays data with various features such as expandable rows, striped rows, and fixed headers.\n *\n * ## Caveats:\n * - `subRows` should always have the same columns as the Parent table\n * - `stripedColor` wont be applied to `subRows` or `subTables`\n * - `rowActions` will always need an `onClick`, this will be automatically passed onto the `ReactNode` you place & will be selectable\n * - Rows will scale depending on the cell content size\n * - Using `clickableRow` with clickable cells, ensure you use `e.stopPropagation` in your cells `onClick`\n *\n * ## Improvements:\n * - It would be nice if we expandable logic inside this component, e.g the presence of certain props would automatically add this\n */\nexport const Table = <T extends object>({\n columns,\n data,\n fixedHeader = true,\n hasKeyline = false,\n expandable,\n subTable,\n subRows,\n headerHeight,\n headerColor = 'mascarpone',\n rowColor = 'custard',\n stripedColor,\n rowBorderColor = 'oatmeal',\n rowActions,\n clickableRow,\n rowPadding,\n columnPadding,\n noDataContent,\n roundedTable,\n hideTableHeader = false,\n}: TableProps<T>) => {\n const showActionsCell = expandable ?? rowActions\n const expandSubProp = showActionsCell ? columns.length + 1 : columns.length\n return (\n <StyledTable $roundedTable={roundedTable}>\n {!hideTableHeader && (\n <thead>\n <TableHeader\n columns={columns}\n fixedHeader={fixedHeader}\n headerHeight={headerHeight}\n subTable={subTable}\n headerColor={headerColor}\n rowActions={rowActions}\n columnPadding={columnPadding}\n expandable={expandable}\n hasKeyline={hasKeyline}\n />\n </thead>\n )}\n <tbody>\n {data.length === 0 && (\n <tr>\n <StyledCell\n colSpan={expandSubProp}\n $rowPadding={rowPadding}\n $columnPadding={columnPadding}\n >\n {noDataContent ?? <Text align=\"center\">No available data</Text>}\n </StyledCell>\n </tr>\n )}\n {data.length !== 0 &&\n data.map((row, rowIndex) => (\n <TableRow\n key={rowIndex}\n rowData={row}\n rowIndex={rowIndex}\n columns={columns}\n rowActions={rowActions}\n stripedColor={stripedColor}\n subTable={subTable}\n subRows={subRows}\n rowColor={rowColor}\n rowBorderColor={rowBorderColor}\n rowPadding={rowPadding}\n columnPadding={columnPadding}\n expandable={expandable}\n clickableRow={clickableRow}\n hideBorder={Boolean(roundedTable) && rowIndex === data.length - 1}\n />\n ))}\n </tbody>\n </StyledTable>\n )\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { RowActionsProps } from '../types';
3
- export declare const RowActions: <T extends object>({ rowData, rowActions, expandable, isExpanded, toggleExpansion, }: RowActionsProps<T>) => React.JSX.Element;
3
+ export declare const RowActions: <T extends object>({ rowData, rowActions, isExpanded, toggleExpansion, expandable, canExpandRow, }: RowActionsProps<T>) => React.JSX.Element;
@@ -7,7 +7,7 @@ import { Tooltip } from '../../Tooltip';
7
7
  import { focusOutlineStyle } from '../../utils/focusOutline';
8
8
  import { isReactElement } from '../../utils/isReactElement';
9
9
  import { StyledCell } from './commonComponents';
10
- export const RowActions = ({ rowData, rowActions, expandable, isExpanded, toggleExpansion, }) => {
10
+ export const RowActions = ({ rowData, rowActions, isExpanded, toggleExpansion, expandable, canExpandRow, }) => {
11
11
  const handleAction = async (e, action) => {
12
12
  e.stopPropagation();
13
13
  await action(rowData);
@@ -34,7 +34,7 @@ export const RowActions = ({ rowData, rowActions, expandable, isExpanded, toggle
34
34
  }
35
35
  return null;
36
36
  }),
37
- expandable?.(rowData) && (React.createElement(CaretIcon, { render: "caret", handleClick: (e) => {
37
+ canExpandRow && (React.createElement(CaretIcon, { render: "caret", handleClick: (e) => {
38
38
  e.stopPropagation();
39
39
  toggleExpansion();
40
40
  }, size: 36, "$isOpen": isExpanded, backgroundColor: "cream" })))));
@@ -1 +1 @@
1
- {"version":3,"file":"RowActions.js","sourceRoot":"","sources":["../../../src/Table/components/RowActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAmB,EAC3C,OAAO,EACP,UAAU,EACV,UAAU,EACV,UAAU,EACV,eAAe,GACI,EAAE,EAAE;IACvB,MAAM,YAAY,GAAG,KAAK,EACxB,CAA4C,EAC5C,MAA4C,EAC5C,EAAE;QACF,CAAC,CAAC,eAAe,EAAE,CAAA;QACnB,MAAM,MAAM,CAAC,OAAO,CAAC,CAAA;IACvB,CAAC,CAAA;IAED,OAAO,CACL,oBAAC,UAAU,mBACI,OAAO,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,wBACnC,UAAU,EAAE,OAAO;QAEvC,oBAAC,GAAG,IAAC,IAAI,QAAC,UAAU,EAAC,QAAQ,EAAC,cAAc,EAAC,UAAU;YACpD,UAAU,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;gBAChD,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;oBAC3D,OAAO,CACL,oBAAC,OAAO,IA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AAC;gBACD,OAAO,IAAI,CAAA;YACb,CAAC,CAAC;YACD,UAAU,EAAE,CAAC,OAAO,CAAC,IAAI,CACxB,oBAAC,SAAS,IACR,MAAM,EAAC,OAAO,EACd,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;oBACjB,CAAC,CAAC,eAAe,EAAE,CAAA;oBACnB,eAAe,EAAE,CAAA;gBACnB,CAAC,EACD,IAAI,EAAE,EAAE,aACC,UAAU,EACnB,eAAe,EAAC,OAAO,GACvB,CACH,CACG,CACK,CACd,CAAA;AACH,CAAC,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;;;;;;;;;MAUrB,iBAAiB;;CAEtB,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,CAClC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;iBACF,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,cAAc;;GAExD,CACF,CAAA","sourcesContent":["import React, { FormEvent } from 'react'\nimport styled from 'styled-components'\nimport { Box } from '../../Box'\nimport { Button } from '../../Button'\nimport { IconStrict } from '../../IconStrict'\nimport { Tooltip } from '../../Tooltip'\nimport { focusOutlineStyle } from '../../utils/focusOutline'\nimport { isReactElement } from '../../utils/isReactElement'\nimport { RowActionsProps } from '../types'\nimport { StyledCell } from './commonComponents'\n\nexport const RowActions = <T extends object>({\n rowData,\n rowActions,\n expandable,\n isExpanded,\n toggleExpansion,\n}: RowActionsProps<T>) => {\n const handleAction = async (\n e: MouseEvent | FormEvent<HTMLButtonElement>,\n action: (rowData: T) => void | Promise<void>,\n ) => {\n e.stopPropagation()\n await action(rowData)\n }\n\n return (\n <StyledCell\n $stickyCell={Boolean(rowActions) || Boolean(expandable)}\n $rowActionsBgColor={rowActions?.bgColor}\n >\n <Box flex alignItems=\"center\" justifyContent=\"flex-end\">\n {rowActions?.actions?.map((action, actionIndex) => {\n if (!action.showCondition || action.showCondition(rowData)) {\n return (\n <Wrapper flex key={actionIndex}>\n {'element' in action &&\n isReactElement(action.element) &&\n React.cloneElement(action.element, {\n onClick: async (e: MouseEvent) => {\n await handleAction(e, action.onClick)\n },\n tabIndex: 0,\n className: 'reactElementRowAction',\n })}\n {!('element' in action) && action.genericButton && (\n <Button\n {...action.genericButton}\n handleClick={(e) => void handleAction(e, action.onClick)}\n >\n {action.genericButton.children}\n </Button>\n )}\n {!('element' in action) &&\n action.iconButton &&\n (action.iconButton?.tooltipText ? (\n <Tooltip\n content={action.iconButton.tooltipText}\n position={'bottom'}\n variant=\"bubblegum\"\n >\n <IconStrict\n {...action.iconButton}\n handleClick={(e) =>\n void handleAction(e, action.onClick)\n }\n />\n </Tooltip>\n ) : (\n <IconStrict\n {...action.iconButton}\n handleClick={(e) => void handleAction(e, action.onClick)}\n />\n ))}\n </Wrapper>\n )\n }\n return null\n })}\n {expandable?.(rowData) && (\n <CaretIcon\n render=\"caret\"\n handleClick={(e) => {\n e.stopPropagation()\n toggleExpansion()\n }}\n size={36}\n $isOpen={isExpanded}\n backgroundColor=\"cream\"\n />\n )}\n </Box>\n </StyledCell>\n )\n}\n\nconst Wrapper = styled(Box)`\n white-space: nowrap;\n margin-right: 8px;\n\n &:last-child {\n margin-right: 0px;\n }\n\n .reactElementRowAction {\n cursor: pointer;\n ${focusOutlineStyle}\n }\n`\n\nconst CaretIcon = styled(IconStrict)<{ $isOpen?: boolean }>(\n ({ $isOpen }) => `\n transform: ${$isOpen ? 'rotate(90deg)' : 'rotate(0deg)'};\n transition: transform 0.3s ease;\n `,\n)\n"]}
1
+ {"version":3,"file":"RowActions.js","sourceRoot":"","sources":["../../../src/Table/components/RowActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;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vB,CACH,CACG,CACK,CACd,CAAA;AACH,CAAC,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;;;;;;;;;MAUrB,iBAAiB;;CAEtB,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,CAClC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;iBACF,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,cAAc;;GAExD,CACF,CAAA","sourcesContent":["import React, { FormEvent } from 'react'\nimport styled from 'styled-components'\nimport { Box } from '../../Box'\nimport { Button } from '../../Button'\nimport { IconStrict } from '../../IconStrict'\nimport { Tooltip } from '../../Tooltip'\nimport { focusOutlineStyle } from '../../utils/focusOutline'\nimport { isReactElement } from '../../utils/isReactElement'\nimport { RowActionsProps } from '../types'\nimport { StyledCell } from './commonComponents'\n\nexport const RowActions = <T extends object>({\n rowData,\n rowActions,\n isExpanded,\n toggleExpansion,\n expandable,\n canExpandRow,\n}: RowActionsProps<T>) => {\n const handleAction = async (\n e: MouseEvent | FormEvent<HTMLButtonElement>,\n action: (rowData: T) => void | Promise<void>,\n ) => {\n e.stopPropagation()\n await action(rowData)\n }\n\n return (\n <StyledCell\n $stickyCell={Boolean(rowActions) || Boolean(expandable)}\n $rowActionsBgColor={rowActions?.bgColor}\n >\n <Box flex alignItems=\"center\" justifyContent=\"flex-end\">\n {rowActions?.actions?.map((action, actionIndex) => {\n if (!action.showCondition || action.showCondition(rowData)) {\n return (\n <Wrapper flex key={actionIndex}>\n {'element' in action &&\n isReactElement(action.element) &&\n React.cloneElement(action.element, {\n onClick: async (e: MouseEvent) => {\n await handleAction(e, action.onClick)\n },\n tabIndex: 0,\n className: 'reactElementRowAction',\n })}\n {!('element' in action) && action.genericButton && (\n <Button\n {...action.genericButton}\n handleClick={(e) => void handleAction(e, action.onClick)}\n >\n {action.genericButton.children}\n </Button>\n )}\n {!('element' in action) &&\n action.iconButton &&\n (action.iconButton?.tooltipText ? (\n <Tooltip\n content={action.iconButton.tooltipText}\n position={'bottom'}\n variant=\"bubblegum\"\n >\n <IconStrict\n {...action.iconButton}\n handleClick={(e) =>\n void handleAction(e, action.onClick)\n }\n />\n </Tooltip>\n ) : (\n <IconStrict\n {...action.iconButton}\n handleClick={(e) => void handleAction(e, action.onClick)}\n />\n ))}\n </Wrapper>\n )\n }\n return null\n })}\n {canExpandRow && (\n <CaretIcon\n render=\"caret\"\n handleClick={(e) => {\n e.stopPropagation()\n toggleExpansion()\n }}\n size={36}\n $isOpen={isExpanded}\n backgroundColor=\"cream\"\n />\n )}\n </Box>\n </StyledCell>\n )\n}\n\nconst Wrapper = styled(Box)`\n white-space: nowrap;\n margin-right: 8px;\n\n &:last-child {\n margin-right: 0px;\n }\n\n .reactElementRowAction {\n cursor: pointer;\n ${focusOutlineStyle}\n }\n`\n\nconst CaretIcon = styled(IconStrict)<{ $isOpen?: boolean }>(\n ({ $isOpen }) => `\n transform: ${$isOpen ? 'rotate(90deg)' : 'rotate(0deg)'};\n transition: transform 0.3s ease;\n `,\n)\n"]}
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { TableRowProps } from '../types';
3
- export declare const TableRow: <T extends object>({ rowData, rowIndex, columns, subRows, subTable, stripedColor, rowActions, rowColor, rowBorderColor, rowPadding, columnPadding, showActions, expandable, clickableRow, }: TableRowProps<T>) => React.JSX.Element;
3
+ export declare const TableRow: <T extends object>({ rowData, rowIndex, columns, subRows, subTable, stripedColor, rowActions, rowColor, rowBorderColor, rowPadding, columnPadding, showActions, expandable, clickableRow, hideBorder, }: TableRowProps<T>) => React.JSX.Element;
@@ -1,23 +1,27 @@
1
- import React, { useState } from 'react';
1
+ import React, { cloneElement, useState } from 'react';
2
2
  import { isReactElement } from '../../utils/isReactElement';
3
3
  import { isMappedReactElement } from '../helpers';
4
4
  import { RowActions } from './RowActions';
5
- import { StyledCell, StyledRow } from './commonComponents';
6
- export const TableRow = ({ rowData, rowIndex, columns, subRows, subTable, stripedColor, rowActions, rowColor, rowBorderColor, rowPadding, columnPadding, showActions, expandable, clickableRow, }) => {
5
+ import { StyledCell, StyledRow, StyledSubTableCell } from './commonComponents';
6
+ export const TableRow = ({ rowData, rowIndex, columns, subRows, subTable, stripedColor, rowActions, rowColor, rowBorderColor, rowPadding, columnPadding, showActions, expandable, clickableRow, hideBorder, }) => {
7
7
  const [expandedRows, setExpandedRows] = useState([]);
8
8
  const toggleRowExpansion = (rowIndex) => {
9
9
  setExpandedRows((prevState) => prevState.includes(rowIndex)
10
10
  ? prevState.filter((index) => index !== rowIndex)
11
11
  : [...prevState, rowIndex]);
12
12
  };
13
+ const canExpandRow = expandable !== undefined
14
+ ? expandable?.(rowData)
15
+ : Boolean(subTable?.table ?? subRows?.rows);
13
16
  const subRowsData = subRows?.rows(rowData);
14
17
  const subTableData = subTable?.table(rowData);
15
- const showSubRowsOnExpand = subRows?.showOnExpand?.(rowData);
16
- const showSubTableOnExpand = subTable?.showOnExpand?.(rowData);
17
- const showActionsCell = expandable || rowActions;
18
+ const subPadding = subTable?.padding ?? subRows?.padding;
19
+ const subBgColor = subTable?.bgColor ?? subRows?.bgColor;
20
+ const showActionsCell = expandable ?? rowActions;
18
21
  const expandSubProp = showActionsCell ? columns.length + 1 : columns.length;
22
+ const isExpandedRow = expandedRows.includes(rowIndex);
19
23
  return (React.createElement(React.Fragment, null,
20
- React.createElement(StyledRow, { "$stripedColor": stripedColor, "$rowColor": rowColor, "$rowBorderColor": rowBorderColor, "$clickableRow": !!clickableRow, onClick: () => clickableRow && clickableRow(rowData), tabIndex: clickableRow && 0 },
24
+ React.createElement(StyledRow, { "$stripedColor": stripedColor, "$rowColor": rowColor, "$rowBorderColor": rowBorderColor, "$clickableRow": !!clickableRow, "$noRowBorderColor": isExpandedRow || hideBorder, onClick: () => clickableRow && clickableRow(rowData), tabIndex: clickableRow && 0 },
21
25
  columns.map((column, columnIndex) => {
22
26
  let cellContent;
23
27
  if (column.cell) {
@@ -25,47 +29,14 @@ export const TableRow = ({ rowData, rowIndex, columns, subRows, subTable, stripe
25
29
  }
26
30
  return (React.createElement(StyledCell, { key: columnIndex, "$rowPadding": rowPadding, "$columnPadding": columnPadding, "$minWidth": column.minWidth, "$maxWidth": column.maxWidth, "$noWrapContent": column.noWrapContent, "$truncateContent": column.truncateContent, "$hideOverflow": column.hideOverflow }, cellContent));
27
31
  }),
28
- (showActionsCell || showActions) && (React.createElement(RowActions, { expandable: expandable, rowActions: rowActions, rowData: rowData, isExpanded: expandedRows.includes(rowIndex), toggleExpansion: () => toggleRowExpansion(rowIndex) }))),
29
- expandedRows.includes(rowIndex) && (React.createElement(React.Fragment, null,
30
- subRows &&
31
- subRowsData &&
32
- showSubRowsOnExpand &&
33
- isReactElement(subRowsData) &&
34
- React.cloneElement(subRowsData, {
35
- rowPadding: rowPadding,
36
- columnPadding: columnPadding,
37
- }),
38
- subRows &&
39
- subRowsData &&
40
- showSubRowsOnExpand &&
41
- isMappedReactElement(subRowsData) &&
42
- subRowsData.map((row) => React.cloneElement(row, {
43
- rowPadding: rowPadding,
44
- showActions: showActionsCell,
45
- })),
46
- subTable && showSubTableOnExpand && subTableData && (React.createElement(StyledCell, { colSpan: expandSubProp }, React.cloneElement(subTableData, {
47
- rowPadding: rowPadding,
48
- columnPadding: columnPadding,
49
- }))))),
50
- subRows &&
32
+ (showActionsCell ?? showActions) && (React.createElement(RowActions, { canExpandRow: canExpandRow, rowActions: rowActions, rowData: rowData, isExpanded: isExpandedRow, toggleExpansion: () => toggleRowExpansion(rowIndex) }))),
33
+ isExpandedRow && (React.createElement(React.Fragment, null,
51
34
  subRowsData &&
52
- !showSubRowsOnExpand &&
53
- isReactElement(subRowsData) &&
54
- React.cloneElement(subRowsData, {
55
- rowPadding: rowPadding,
56
- columnPadding: columnPadding,
57
- }),
58
- subRows &&
35
+ isReactElement(subRowsData) &&
36
+ cloneElement(subRowsData, { rowPadding, columnPadding }),
59
37
  subRowsData &&
60
- !showSubRowsOnExpand &&
61
- isMappedReactElement(subRowsData) &&
62
- subRowsData.map((row) => React.cloneElement(row, {
63
- rowPadding: rowPadding,
64
- columnPadding: columnPadding,
65
- })),
66
- subTable && subTableData && !showSubTableOnExpand && (React.createElement(StyledCell, { colSpan: expandSubProp }, React.cloneElement(subTableData, {
67
- rowPadding: rowPadding,
68
- columnPadding: columnPadding,
69
- })))));
38
+ isMappedReactElement(subRowsData) &&
39
+ subRowsData.map((row) => cloneElement(row, { rowPadding, showActions: showActionsCell })),
40
+ subTableData && (React.createElement(StyledSubTableCell, { "$rowBorderColor": rowBorderColor, colSpan: expandSubProp, "$bgColor": subBgColor, "$padding": subPadding }, cloneElement(subTableData, { rowPadding, columnPadding })))))));
70
41
  };
71
42
  //# sourceMappingURL=TableRow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableRow.js","sourceRoot":"","sources":["../../../src/Table/components/TableRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE1D,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAmB,EACzC,OAAO,EACP,QAAQ,EACR,OAAO,EACP,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,cAAc,EACd,UAAU,EACV,aAAa,EACb,WAAW,EACX,UAAU,EACV,YAAY,GACK,EAAE,EAAE;IACrB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAA;IAE9D,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAE,EAAE;QAC9C,eAAe,CAAC,CAAC,SA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Y,CAAC,WAAW,EAAE;gBAC9B,UAAU,EAAE,UAAU;gBACtB,aAAa,EAAE,aAAa;aAC7B,CAAC;QACH,OAAO;YACN,WAAW;YACX,CAAC,mBAAmB;YACpB,oBAAoB,CAAC,WAAW,CAAC;YACjC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACtB,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE;gBACtB,UAAU,EAAE,UAAU;gBACtB,aAAa,EAAE,aAAa;aAC7B,CAAC,CACH;QACF,QAAQ,IAAI,YAAY,IAAI,CAAC,oBAAoB,IAAI,CACpD,oBAAC,UAAU,IAAC,OAAO,EAAE,aAAa,IAC/B,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE;YAChC,UAAU,EAAE,UAAU;YACtB,aAAa,EAAE,aAAa;SAC7B,CAAC,CACS,CACd,CACA,CACJ,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React, { ReactNode, useState } from 'react'\nimport { isReactElement } from '../../utils/isReactElement'\nimport { isMappedReactElement } from '../helpers'\nimport { TableRowProps } from '../types'\nimport { RowActions } from './RowActions'\nimport { StyledCell, StyledRow } from './commonComponents'\n\nexport const TableRow = <T extends object>({\n rowData,\n rowIndex,\n columns,\n subRows,\n subTable,\n stripedColor,\n rowActions,\n rowColor,\n rowBorderColor,\n rowPadding,\n columnPadding,\n showActions,\n expandable,\n clickableRow,\n}: TableRowProps<T>) => {\n const [expandedRows, setExpandedRows] = useState<number[]>([])\n\n const toggleRowExpansion = (rowIndex: number) => {\n setExpandedRows((prevState) =>\n prevState.includes(rowIndex)\n ? prevState.filter((index) => index !== rowIndex)\n : [...prevState, rowIndex],\n )\n }\n\n const subRowsData = subRows?.rows(rowData)\n const subTableData = subTable?.table(rowData)\n const showSubRowsOnExpand = subRows?.showOnExpand?.(rowData)\n const showSubTableOnExpand = subTable?.showOnExpand?.(rowData)\n\n const showActionsCell = expandable || rowActions\n const expandSubProp = showActionsCell ? columns.length + 1 : columns.length\n\n return (\n <>\n <StyledRow\n $stripedColor={stripedColor}\n $rowColor={rowColor}\n $rowBorderColor={rowBorderColor}\n $clickableRow={!!clickableRow}\n onClick={() => clickableRow && clickableRow(rowData)}\n tabIndex={clickableRow && 0}\n >\n {columns.map((column, columnIndex) => {\n let cellContent: ReactNode\n if (column.cell) {\n cellContent = column.cell(rowData, rowIndex, column, rowIndex)\n }\n\n return (\n <StyledCell\n key={columnIndex}\n $rowPadding={rowPadding}\n $columnPadding={columnPadding}\n $minWidth={column.minWidth}\n $maxWidth={column.maxWidth}\n $noWrapContent={column.noWrapContent}\n $truncateContent={column.truncateContent}\n $hideOverflow={column.hideOverflow}\n >\n {cellContent}\n </StyledCell>\n )\n })}\n\n {(showActionsCell || showActions) && (\n <RowActions\n expandable={expandable}\n rowActions={rowActions}\n rowData={rowData}\n isExpanded={expandedRows.includes(rowIndex)}\n toggleExpansion={() => toggleRowExpansion(rowIndex)}\n />\n )}\n </StyledRow>\n {/**\n * This could be extracted out and cleaned up\n * this section is for expanded rows only\n * Items rendered here wont show unless expanded\n */}\n {expandedRows.includes(rowIndex) && (\n <>\n {subRows &&\n subRowsData &&\n showSubRowsOnExpand &&\n isReactElement(subRowsData) &&\n React.cloneElement(subRowsData, {\n rowPadding: rowPadding,\n columnPadding: columnPadding,\n })}\n\n {subRows &&\n subRowsData &&\n showSubRowsOnExpand &&\n isMappedReactElement(subRowsData) &&\n subRowsData.map((row) =>\n React.cloneElement(row, {\n rowPadding: rowPadding,\n showActions: showActionsCell,\n }),\n )}\n\n {subTable && showSubTableOnExpand && subTableData && (\n <StyledCell colSpan={expandSubProp}>\n {React.cloneElement(subTableData, {\n rowPadding: rowPadding,\n columnPadding: columnPadding,\n })}\n </StyledCell>\n )}\n </>\n )}\n {/**\n * This could be extracted out and cleaned up\n * this section is for rendering things under a row,\n * without the need to expand.\n * Items rendered here wont show when expanded\n */}\n {subRows &&\n subRowsData &&\n !showSubRowsOnExpand &&\n isReactElement(subRowsData) &&\n React.cloneElement(subRowsData, {\n rowPadding: rowPadding,\n columnPadding: columnPadding,\n })}\n {subRows &&\n subRowsData &&\n !showSubRowsOnExpand &&\n isMappedReactElement(subRowsData) &&\n subRowsData.map((row) =>\n React.cloneElement(row, {\n rowPadding: rowPadding,\n columnPadding: columnPadding,\n }),\n )}\n {subTable && subTableData && !showSubTableOnExpand && (\n <StyledCell colSpan={expandSubProp}>\n {React.cloneElement(subTableData, {\n rowPadding: rowPadding,\n columnPadding: columnPadding,\n })}\n </StyledCell>\n )}\n </>\n )\n}\n"]}
1
+ {"version":3,"file":"TableRow.js","sourceRoot":"","sources":["../../../src/Table/components/TableRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,YAAY,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAE9E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAmB,EACzC,OAAO,EACP,QAAQ,EACR,OAAO,EACP,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,cAAc,EACd,UAAU,EACV,aAAa,EACb,WAAW,EACX,UAAU,EACV,YAAY,EACZ,UAAU,GACO,EAAE,EAAE;IACrB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAA;IAE9D,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAE,EAAE;QAC9C,eAAe,CAAC,CAAC,SAAS,EAAE,EAAE,CAC5B,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAC1B,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,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,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;gBAChE,CAAC;gBAED,OAAO,CACL,oBAAC,UAAU,IACT,GAAG,EAAE,WAAW,iBACH,UAAU,oBACP,aAAa,eAClB,MAAM,CAAC,QAAQ,eACf,MAAM,CAAC,QAAQ,oBACV,MAAM,CAAC,aAAa,sBAClB,MAAM,CAAC,eAAe,mBACzB,MAAM,CAAC,YAAY,IAEjC,WAAW,CACD,CACd,CAAA;YACH,CAAC,CAAC;YAED,CAAC,eAAe,IAAI,WAAW,CAAC,IAAI,CACnC,oBAAC,UAAU,IACT,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,aAAa,EACzB,eAAe,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GACnD,CACH,CACS;QASX,aAAa,IAAI,CAChB;YACG,WAAW;gBACV,cAAc,CAAC,WAAW,CAAC;gBAC3B,YAAY,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;YAEzD,WAAW;gBACV,oBAAoB,CAAC,WAAW,CAAC;gBACjC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACtB,YAAY,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC,CAChE;YAEF,YAAY,IAAI,CACf,oBAAC,kBAAkB,uBACA,cAAc,EAC/B,OAAO,EAAE,aAAa,cACZ,UAAU,cACV,UAAU,IAEnB,YAAY,CAAC,YAAY,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,CACvC,CACtB,CACA,CACJ,CACA,CACJ,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React, { cloneElement, ReactNode, useState } from 'react'\nimport { isReactElement } from '../../utils/isReactElement'\nimport { isMappedReactElement } from '../helpers'\nimport { TableRowProps } from '../types'\nimport { RowActions } from './RowActions'\nimport { StyledCell, StyledRow, StyledSubTableCell } from './commonComponents'\n\nexport const TableRow = <T extends object>({\n rowData,\n rowIndex,\n columns,\n subRows,\n subTable,\n stripedColor,\n rowActions,\n rowColor,\n rowBorderColor,\n rowPadding,\n columnPadding,\n showActions,\n expandable,\n clickableRow,\n hideBorder,\n}: TableRowProps<T>) => {\n const [expandedRows, setExpandedRows] = useState<number[]>([])\n\n const toggleRowExpansion = (rowIndex: number) => {\n setExpandedRows((prevState) =>\n prevState.includes(rowIndex)\n ? prevState.filter((index) => index !== rowIndex)\n : [...prevState, rowIndex],\n )\n }\n\n const canExpandRow =\n expandable !== undefined\n ? expandable?.(rowData)\n : Boolean(subTable?.table ?? subRows?.rows)\n\n const subRowsData = subRows?.rows(rowData)\n const subTableData = subTable?.table(rowData)\n\n const subPadding = subTable?.padding ?? subRows?.padding\n const subBgColor = subTable?.bgColor ?? subRows?.bgColor\n\n const showActionsCell = expandable ?? rowActions\n const expandSubProp = showActionsCell ? columns.length + 1 : columns.length\n\n const isExpandedRow = expandedRows.includes(rowIndex)\n\n return (\n <>\n <StyledRow\n $stripedColor={stripedColor}\n $rowColor={rowColor}\n $rowBorderColor={rowBorderColor}\n $clickableRow={!!clickableRow}\n $noRowBorderColor={isExpandedRow || hideBorder}\n onClick={() => clickableRow && clickableRow(rowData)}\n tabIndex={clickableRow && 0}\n >\n {columns.map((column, columnIndex) => {\n let cellContent: ReactNode\n if (column.cell) {\n cellContent = column.cell(rowData, rowIndex, column, rowIndex)\n }\n\n return (\n <StyledCell\n key={columnIndex}\n $rowPadding={rowPadding}\n $columnPadding={columnPadding}\n $minWidth={column.minWidth}\n $maxWidth={column.maxWidth}\n $noWrapContent={column.noWrapContent}\n $truncateContent={column.truncateContent}\n $hideOverflow={column.hideOverflow}\n >\n {cellContent}\n </StyledCell>\n )\n })}\n\n {(showActionsCell ?? showActions) && (\n <RowActions\n canExpandRow={canExpandRow}\n rowActions={rowActions}\n rowData={rowData}\n isExpanded={isExpandedRow}\n toggleExpansion={() => toggleRowExpansion(rowIndex)}\n />\n )}\n </StyledRow>\n {/**\n * Rendering subTable and/or subRows\n *\n * This could be extracted out and cleaned up\n * this section is for expanded rows only\n * Items rendered here wont show unless expanded\n */}\n\n {isExpandedRow && (\n <>\n {subRowsData &&\n isReactElement(subRowsData) &&\n cloneElement(subRowsData, { rowPadding, columnPadding })}\n\n {subRowsData &&\n isMappedReactElement(subRowsData) &&\n subRowsData.map((row) =>\n cloneElement(row, { rowPadding, showActions: showActionsCell }),\n )}\n\n {subTableData && (\n <StyledSubTableCell\n $rowBorderColor={rowBorderColor}\n colSpan={expandSubProp}\n $bgColor={subBgColor}\n $padding={subPadding}\n >\n {cloneElement(subTableData, { rowPadding, columnPadding })}\n </StyledSubTableCell>\n )}\n </>\n )}\n </>\n )\n}\n"]}
@@ -1,6 +1,21 @@
1
1
  import { TransientProps } from 'utils/utilTypes';
2
- import { TableStylesProps } from '../types';
3
- export declare const StyledTable: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, never>> & string;
2
+ import { type Color } from '../../theme';
3
+ import { TableStylesProps, type TableProps } from '../types';
4
+ type StyledTableProps = {
5
+ $roundedTable: TableProps<unknown>['roundedTable'];
6
+ };
7
+ export declare const StyledTable: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, StyledTableProps>> & string;
4
8
  export declare const StyledHeaderCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, TransientProps<TableStylesProps>>> & string;
5
9
  export declare const StyledCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, TransientProps<TableStylesProps>>> & string;
6
10
  export declare const StyledRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, TransientProps<TableStylesProps>>> & string;
11
+ type StyledSubTableCellProps = {
12
+ $bgColor?: Color;
13
+ $padding?: string | undefined;
14
+ $rowBorderColor?: Color;
15
+ };
16
+ type StyledSubInnerCellProps = {
17
+ $padding?: string | undefined;
18
+ };
19
+ export declare const StyledSubTableCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, StyledSubTableCellProps>> & string;
20
+ export declare const StyledSubInnerCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledSubInnerCellProps>> & string;
21
+ export {};
@@ -3,6 +3,7 @@ import styled, { css } from 'styled-components';
3
3
  import { fontStyleMapping } from '../../Text/fontMapping';
4
4
  import { theme } from '../../theme';
5
5
  import { focusOutlineStyle } from '../../utils/focusOutline';
6
+ const isString = (value) => typeof value === 'string';
6
7
  export const StyledTable = styled.table `
7
8
  width: 100%;
8
9
  height: 100%;
@@ -10,6 +11,12 @@ export const StyledTable = styled.table `
10
11
  overflow: auto;
11
12
  background: ${theme.colors.coconut};
12
13
  border-spacing: 30px;
14
+
15
+ ${({ $roundedTable }) => $roundedTable &&
16
+ css `
17
+ border-radius: ${isString($roundedTable) ? $roundedTable : '16px'};
18
+ overflow: hidden;
19
+ `}
13
20
  `;
14
21
  export const StyledHeaderCell = styled.th `
15
22
  background: ${theme.colors.coconut};
@@ -106,7 +113,8 @@ export const StyledCell = styled.td `
106
113
  export const StyledRow = styled.tr `
107
114
  background: ${theme.colors.custard};
108
115
 
109
- ${({ $rowBorderColor }) => $rowBorderColor &&
116
+ ${({ $rowBorderColor, $noRowBorderColor }) => $rowBorderColor &&
117
+ !$noRowBorderColor &&
110
118
  css `
111
119
  border-bottom: 1px solid ${theme.colors[$rowBorderColor]};
112
120
  `}
@@ -135,4 +143,17 @@ export const StyledRow = styled.tr `
135
143
  }
136
144
  `}
137
145
  `;
146
+ export const StyledSubTableCell = styled.td `
147
+ padding: ${({ $padding }) => $padding ?? '12px 0'};
148
+
149
+ ${({ $rowBorderColor }) => $rowBorderColor &&
150
+ css `
151
+ border-bottom: 1px solid ${theme.colors[$rowBorderColor]};
152
+ `}
153
+
154
+ ${({ $bgColor }) => $bgColor && `background-color: ${theme.colors[$bgColor]};`}
155
+ `;
156
+ export const StyledSubInnerCell = styled.div `
157
+ padding: ${({ $padding }) => $padding ?? '12px 0'};
158
+ `;
138
159
  //# sourceMappingURL=commonComponents.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commonComponents.js","sourceRoot":"","sources":["../../../src/Table/components/commonComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAG5D,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAA;;;;;gBAKvB,KAAK,CAAC,MAAM,CAAC,OAAO;;CAEnC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,EAAE,CAAkC;gBAC3D,KAAK,CAAC,MAAM,CAAC,OAAO;mBACjB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CACnC,WAAW,CAAC,CAAC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C,EAAE,cAAc,EAAE,EAAE,EAAE,CACvB,cAAc;IACd,GAAG,CAAA;sBACe,cAAc;uBACb,cAAc;KAChC;;IAED,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAClB,SAAS;IACT,GAAG,CAAA;mBACY,SAAS;KACvB;;IAED,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAC3B,kBAAkB;IAClB,GAAG,CAAA;oBACa,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC;KAC/C;CACJ,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,EAAE,CAAkC;gBACpD,KAAK,CAAC,MAAM,CAAC,OAAO;;IAEhC,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CACxB,eAAe;IACf,GAAG,CAAA;iCAC0B,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC;KACzD;;IAED,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAClB,SAAS;IACT,GAAG,CAAA;oBACa,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;KACtC;;IAED,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CACtB,aAAa;IACb,GAAG,CAAA;;sBAEe,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC;;KAE5C;;MAEC,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,EAAE,CACnC,aAAa;IACb,GAAG,CAAA;;;sBAGe,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC;;;UAG7D,iBAAiB;sBACL,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC;;KAElE;CACJ,CAAA","sourcesContent":["import { darken } from 'polished'\nimport styled, { css } from 'styled-components'\nimport { TransientProps } from 'utils/utilTypes'\nimport { fontStyleMapping } from '../../Text/fontMapping'\nimport { theme } from '../../theme'\nimport { focusOutlineStyle } from '../../utils/focusOutline'\nimport { TableStylesProps } from '../types'\n\nexport const StyledTable = styled.table`\n width: 100%;\n height: 100%;\n border-collapse: collapse;\n overflow: auto;\n background: ${theme.colors.coconut};\n border-spacing: 30px;\n`\n\nexport const StyledHeaderCell = styled.th<TransientProps<TableStylesProps>>`\n background: ${theme.colors.coconut};\n border-bottom: ${({ $hasKeyline }) =>\n $hasKeyline ? `1px solid ${theme.colors.liquorice}` : 'none'};\n position: ${({ $fixedHeader }) => ($fixedHeader ? 'sticky' : 'auto')};\n top: 0;\n z-index: 2;\n text-align: left;\n vertical-align: bottom;\n ${fontStyleMapping.label};\n padding-left: 8px;\n padding-right: 8px;\n padding-top: 8px;\n padding-bottom: 8px;\n\n ${({ $headerColor }) =>\n $headerColor &&\n css`\n background: ${theme.colors[$headerColor]};\n `}\n\n ${({ $headerHeight }) =>\n $headerHeight &&\n css`\n height: ${$headerHeight};\n `}\n\n ${({ $maxWidth }) =>\n $maxWidth &&\n css`\n max-width: ${$maxWidth};\n `}\n\n ${({ $minWidth }) =>\n $minWidth &&\n css`\n min-width: ${$minWidth};\n `}\n \n ${({ $columnPadding }) =>\n $columnPadding &&\n css`\n padding-left: ${$columnPadding};\n padding-right: ${$columnPadding};\n `};\n`\n\nexport const StyledCell = styled.td<TransientProps<TableStylesProps>>`\n vertical-align: middle;\n padding-left: 8px;\n padding-right: 8px;\n padding-top: 8px;\n padding-bottom: 8px;\n\n ${({ $hideOverflow }) =>\n $hideOverflow &&\n css`\n overflow: hidden;\n `};\n\n ${({ $noWrapContent }) =>\n $noWrapContent &&\n css`\n white-space: nowrap;\n `};\n\n ${({ $truncateContent }) =>\n $truncateContent &&\n css`\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n `};\n\n ${({ $stickyCell }) =>\n $stickyCell &&\n css`\n position: sticky;\n right: 0;\n `};\n\n ${({ $rowPadding }) =>\n $rowPadding &&\n css`\n padding-top: ${$rowPadding};\n padding-bottom: ${$rowPadding};\n `};\n\n ${({ $columnPadding }) =>\n $columnPadding &&\n css`\n padding-left: ${$columnPadding};\n padding-right: ${$columnPadding};\n `};\n\n ${({ $maxWidth }) =>\n $maxWidth &&\n css`\n max-width: ${$maxWidth};\n `}\n\n ${({ $rowActionsBgColor }) =>\n $rowActionsBgColor &&\n css`\n background: ${theme.colors[$rowActionsBgColor]};\n `}\n`\n\nexport const StyledRow = styled.tr<TransientProps<TableStylesProps>>`\n background: ${theme.colors.custard};\n\n ${({ $rowBorderColor }) =>\n $rowBorderColor &&\n css`\n border-bottom: 1px solid ${theme.colors[$rowBorderColor]};\n `}\n\n ${({ $rowColor }) =>\n $rowColor &&\n css`\n background: ${theme.colors[$rowColor]};\n `}\n\n ${({ $stripedColor }) =>\n $stripedColor &&\n css`\n &:nth-child(even) {\n background: ${theme.colors[$stripedColor]};\n }\n `}\n\n ${({ $clickableRow, $rowColor }) =>\n $clickableRow &&\n css`\n cursor: pointer;\n &:hover {\n background: ${darken(0.1, theme.colors[$rowColor ?? 'custard'])};\n }\n &:focus-visible {\n ${focusOutlineStyle}\n background: ${darken(0.1, theme.colors[$rowColor ?? 'custard'])};\n }\n `}\n`\n"]}
1
+ {"version":3,"file":"commonComponents.js","sourceRoot":"","sources":["../../../src/Table/components/commonComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,KAAK,EAAc,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAO5D,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAA;AAE/E,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAkB;;;;;gBAKzC,KAAK,CAAC,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EAAE,CACnC,aAAa;IACb,GAAG,CAAA;;;sBAGe,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC;;;UAG7D,iBAAiB;sBACL,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC;;KAElE;CACJ,CAAA;AAYD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,EAAE,CAAyB;aACvD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,IAAI,QAAQ;;IAE/C,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CACxB,eAAe;IACf,GAAG,CAAA;iCAC0B,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC;KACzD;;IAED,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CACjB,QAAQ,IAAI,qBAAqB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG;CAC7D,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAyB;aACxD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,IAAI,QAAQ;CAClD,CAAA","sourcesContent":["import { darken } from 'polished'\nimport styled, { css } from 'styled-components'\nimport { TransientProps } from 'utils/utilTypes'\nimport { fontStyleMapping } from '../../Text/fontMapping'\nimport { theme, type Color } from '../../theme'\nimport { focusOutlineStyle } from '../../utils/focusOutline'\nimport { TableStylesProps, type TableProps } from '../types'\n\ntype StyledTableProps = {\n $roundedTable: TableProps<unknown>['roundedTable']\n}\n\nconst isString = (value: unknown): value is string => typeof value === 'string'\n\nexport const StyledTable = styled.table<StyledTableProps>`\n width: 100%;\n height: 100%;\n border-collapse: collapse;\n overflow: auto;\n background: ${theme.colors.coconut};\n border-spacing: 30px;\n\n ${({ $roundedTable }) =>\n $roundedTable &&\n css`\n border-radius: ${isString($roundedTable) ? $roundedTable : '16px'};\n overflow: hidden;\n `}\n`\n\nexport const StyledHeaderCell = styled.th<TransientProps<TableStylesProps>>`\n background: ${theme.colors.coconut};\n border-bottom: ${({ $hasKeyline }) =>\n $hasKeyline ? `1px solid ${theme.colors.liquorice}` : 'none'};\n position: ${({ $fixedHeader }) => ($fixedHeader ? 'sticky' : 'auto')};\n top: 0;\n z-index: 2;\n text-align: left;\n vertical-align: bottom;\n ${fontStyleMapping.label};\n padding-left: 8px;\n padding-right: 8px;\n padding-top: 8px;\n padding-bottom: 8px;\n\n ${({ $headerColor }) =>\n $headerColor &&\n css`\n background: ${theme.colors[$headerColor]};\n `}\n\n ${({ $headerHeight }) =>\n $headerHeight &&\n css`\n height: ${$headerHeight};\n `}\n\n ${({ $maxWidth }) =>\n $maxWidth &&\n css`\n max-width: ${$maxWidth};\n `}\n\n ${({ $minWidth }) =>\n $minWidth &&\n css`\n min-width: ${$minWidth};\n `}\n \n ${({ $columnPadding }) =>\n $columnPadding &&\n css`\n padding-left: ${$columnPadding};\n padding-right: ${$columnPadding};\n `};\n`\n\nexport const StyledCell = styled.td<TransientProps<TableStylesProps>>`\n vertical-align: middle;\n padding-left: 8px;\n padding-right: 8px;\n padding-top: 8px;\n padding-bottom: 8px;\n\n ${({ $hideOverflow }) =>\n $hideOverflow &&\n css`\n overflow: hidden;\n `};\n\n ${({ $noWrapContent }) =>\n $noWrapContent &&\n css`\n white-space: nowrap;\n `};\n\n ${({ $truncateContent }) =>\n $truncateContent &&\n css`\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n `};\n\n ${({ $stickyCell }) =>\n $stickyCell &&\n css`\n position: sticky;\n right: 0;\n `};\n\n ${({ $rowPadding }) =>\n $rowPadding &&\n css`\n padding-top: ${$rowPadding};\n padding-bottom: ${$rowPadding};\n `};\n\n ${({ $columnPadding }) =>\n $columnPadding &&\n css`\n padding-left: ${$columnPadding};\n padding-right: ${$columnPadding};\n `};\n\n ${({ $maxWidth }) =>\n $maxWidth &&\n css`\n max-width: ${$maxWidth};\n `}\n\n ${({ $rowActionsBgColor }) =>\n $rowActionsBgColor &&\n css`\n background: ${theme.colors[$rowActionsBgColor]};\n `}\n`\n\nexport const StyledRow = styled.tr<TransientProps<TableStylesProps>>`\n background: ${theme.colors.custard};\n\n ${({ $rowBorderColor, $noRowBorderColor }) =>\n $rowBorderColor &&\n !$noRowBorderColor &&\n css`\n border-bottom: 1px solid ${theme.colors[$rowBorderColor]};\n `}\n\n ${({ $rowColor }) =>\n $rowColor &&\n css`\n background: ${theme.colors[$rowColor]};\n `}\n\n ${({ $stripedColor }) =>\n $stripedColor &&\n css`\n &:nth-child(even) {\n background: ${theme.colors[$stripedColor]};\n }\n `}\n\n ${({ $clickableRow, $rowColor }) =>\n $clickableRow &&\n css`\n cursor: pointer;\n &:hover {\n background: ${darken(0.1, theme.colors[$rowColor ?? 'custard'])};\n }\n &:focus-visible {\n ${focusOutlineStyle}\n background: ${darken(0.1, theme.colors[$rowColor ?? 'custard'])};\n }\n `}\n`\n\ntype StyledSubTableCellProps = {\n $bgColor?: Color\n $padding?: string | undefined\n $rowBorderColor?: Color\n}\n\ntype StyledSubInnerCellProps = {\n $padding?: string | undefined\n}\n\nexport const StyledSubTableCell = styled.td<StyledSubTableCellProps>`\n padding: ${({ $padding }) => $padding ?? '12px 0'};\n\n ${({ $rowBorderColor }) =>\n $rowBorderColor &&\n css`\n border-bottom: 1px solid ${theme.colors[$rowBorderColor]};\n `}\n\n ${({ $bgColor }) =>\n $bgColor && `background-color: ${theme.colors[$bgColor]};`}\n`\n\nexport const StyledSubInnerCell = styled.div<StyledSubInnerCellProps>`\n padding: ${({ $padding }) => $padding ?? '12px 0'};\n`\n"]}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A type that represents a pixel value with the "px" suffix.
3
+ *
4
+ * @example '0' | '12px' | '24px'
5
+ */
6
+ type PixelSuffix = `${number}px`;
7
+ type Spacing = '0' | PixelSuffix;
8
+ /**
9
+ * A type that represents a padding value with the "px" suffix.
10
+ *
11
+ * The value can be a single value, or a string with 2, 3, or 4 values.
12
+ * The values are applied in the following order: top, right, bottom, left.
13
+ *
14
+ * @example '0' | '12px' | '24px' | '12px 24px' | '12px 0 36px' | '12px 24px 36px 48px'
15
+ */
16
+ export type BoxSpacing = Spacing | `${Spacing} ${Spacing}` | `${Spacing} ${Spacing} ${Spacing}` | `${Spacing} ${Spacing} ${Spacing} ${Spacing}`;
17
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=helper.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.types.js","sourceRoot":"","sources":["../../src/Table/helper.types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A type that represents a pixel value with the \"px\" suffix.\n *\n * @example '0' | '12px' | '24px'\n */\ntype PixelSuffix = `${number}px`\n\ntype Spacing = '0' | PixelSuffix\n/**\n * A type that represents a padding value with the \"px\" suffix.\n *\n * The value can be a single value, or a string with 2, 3, or 4 values.\n * The values are applied in the following order: top, right, bottom, left.\n *\n * @example '0' | '12px' | '24px' | '12px 24px' | '12px 0 36px' | '12px 24px 36px 48px'\n */\nexport type BoxSpacing =\n | Spacing\n | `${Spacing} ${Spacing}`\n | `${Spacing} ${Spacing} ${Spacing}`\n | `${Spacing} ${Spacing} ${Spacing} ${Spacing}`\n"]}
@@ -2,6 +2,7 @@ import React, { ReactElement, ReactNode } from 'react';
2
2
  import { ButtonProps } from '../Button/Button';
3
3
  import { IconStrictProps } from '../IconStrict';
4
4
  import { Color } from '../theme';
5
+ import type { BoxSpacing } from './helper.types';
5
6
  export type TableStylesProps = {
6
7
  hasKeyline?: boolean;
7
8
  fixedHeader?: boolean;
@@ -20,6 +21,7 @@ export type TableStylesProps = {
20
21
  columnPadding?: string;
21
22
  hideOverflow?: boolean;
22
23
  clickableRow?: boolean;
24
+ noRowBorderColor?: boolean;
23
25
  };
24
26
  export type Primitive = string | number | boolean | bigint;
25
27
  export type BaseRowAction<T> = {
@@ -51,6 +53,11 @@ export interface TableColumn<T> {
51
53
  hideOverflow?: boolean;
52
54
  cell?: RowCellRenderer<T>;
53
55
  }
56
+ type SubElementProps = {
57
+ bgColor?: Color;
58
+ padding?: BoxSpacing;
59
+ margin?: BoxSpacing;
60
+ };
54
61
  /** @template T - The type of data the table displays. */
55
62
  interface CommonTableProps<T> {
56
63
  /** Array of columns to display in the table. */
@@ -71,17 +78,16 @@ interface CommonTableProps<T> {
71
78
  rowColor?: Color;
72
79
  /** The default color for each table row border. */
73
80
  rowBorderColor?: Color;
81
+ /** If true, the table will have rounded corners */
82
+ roundedTable?: true;
74
83
  /** A React element to show when a row is expanded. */
75
- subTable?: {
84
+ subTable?: SubElementProps & {
76
85
  table: (rowData: T) => ReactElement<any>;
77
- showOnExpand?: (rowData: T) => boolean;
78
86
  };
79
87
  /** Settings for sub rows. */
80
- subRows?: {
88
+ subRows?: SubElementProps & {
81
89
  /** Function that returns a React element for the sub row. */
82
90
  rows: (rowData: T) => ReactElement<any> | ReactElement<any>[];
83
- /** If true, the sub rows will only be shown when the row is expanded. */
84
- showOnExpand?: (rowData: T) => boolean;
85
91
  };
86
92
  /** Function to apply to a row, to make the entire row clickable, useful for navigation. */
87
93
  clickableRow?: (rowData: T) => void;
@@ -104,9 +110,11 @@ export interface TableRowProps<T> extends CommonTableProps<T> {
104
110
  rowData: T;
105
111
  rowIndex: number;
106
112
  showActions?: boolean;
113
+ hideBorder?: boolean;
107
114
  }
108
115
  export interface RowActionsProps<T> extends Pick<CommonTableProps<T>, 'expandable' | 'rowActions'> {
109
116
  rowData: T;
117
+ canExpandRow: boolean;
110
118
  toggleExpansion: () => void;
111
119
  isExpanded?: boolean;
112
120
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/Table/types.ts"],"names":[],"mappings":"","sourcesContent":["import React, { ReactElement, ReactNode } from 'react'\nimport { ButtonProps } from '../Button/Button'\nimport { IconStrictProps } from '../IconStrict'\nimport { Color } from '../theme'\n\nexport type TableStylesProps = {\n hasKeyline?: boolean\n fixedHeader?: boolean\n headerHeight?: string\n stripedColor?: Color\n stickyCell?: boolean\n headerColor?: Color\n rowColor?: Color\n rowBorderColor?: Color\n rowActionsBgColor?: Color\n minWidth?: string\n maxWidth?: string\n noWrapContent?: boolean\n truncateContent?: boolean\n rowPadding?: string\n columnPadding?: string\n hideOverflow?: boolean\n clickableRow?: boolean\n}\n\nexport type Primitive = string | number | boolean | bigint\n\nexport type BaseRowAction<T> = {\n onClick: (rowData: T) => void\n showCondition?: (rowData: T) => boolean\n}\n\nexport type RowAction<T> =\n | RowActionButtonDefault<T>\n | RowActionElementOverride<T>\n\nexport type RowActionButtonDefault<T> = {\n iconButton?: Pick<\n IconStrictProps,\n 'size' | 'render' | 'iconColor' | 'backgroundColor' | 'id' | 'title'\n > & { tooltipText?: string }\n genericButton?: Pick<\n ButtonProps,\n | 'children'\n | 'loading'\n | 'disabled'\n | 'primary'\n | 'secondary'\n | 'fallbackStyle'\n | 'textBtn'\n | 'smallButton'\n | 'id'\n >\n} & BaseRowAction<T>\n\nexport type RowActionElementOverride<T> = {\n element: ReactElement<any>\n} & BaseRowAction<T>\n\nexport type RowActions<T> = {\n actions: RowAction<T>[]\n minWidth?: string\n bgColor?: Color\n}\n\ntype RowCellRenderer<T> = (\n row: T,\n rowIndex: number,\n column: TableColumn<T>,\n id: string | number,\n) => React.ReactNode\n\nexport interface TableColumn<T> {\n name?: string | number | React.ReactNode\n minWidth?: string\n maxWidth?: string\n noWrapContent?: boolean\n truncateContent?: boolean\n hideOverflow?: boolean\n cell?: RowCellRenderer<T>\n}\n\n/** @template T - The type of data the table displays. */\ninterface CommonTableProps<T> {\n /** Array of columns to display in the table. */\n columns: TableColumn<T>[]\n /** Sets the height of the header. */\n headerHeight?: string\n /** If true, the table header will be fixed/sticky. */\n fixedHeader?: boolean\n /** If true, the table header will have a key line. */\n hasKeyline?: boolean\n /** If present, the table rows will have alternating colors. */\n stripedColor?: Color\n /** A function to determine if a row is expandable. */\n expandable?: (rowData: T) => boolean\n /** The color for the table header. */\n headerColor?: Color\n /** The default color for each table row. */\n rowColor?: Color\n /** The default color for each table row border. */\n rowBorderColor?: Color\n /** A React element to show when a row is expanded. */\n subTable?: {\n table: (rowData: T) => ReactElement<any>\n showOnExpand?: (rowData: T) => boolean\n }\n /** Settings for sub rows. */\n subRows?: {\n /** Function that returns a React element for the sub row. */\n rows: (rowData: T) => ReactElement<any> | ReactElement<any>[]\n /** If true, the sub rows will only be shown when the row is expanded. */\n showOnExpand?: (rowData: T) => boolean\n }\n /** Function to apply to a row, to make the entire row clickable, useful for navigation. */\n clickableRow?: (rowData: T) => void\n /** Array of actions that can be performed on each row. */\n rowActions?: RowActions<T>\n /** The Y padding for each row. */\n rowPadding?: string\n /** The X padding for each row. */\n columnPadding?: string\n /** Hides the table header. Table defaults to always showing the header. */\n hideTableHeader?: boolean\n}\n\nexport interface TableProps<T> extends CommonTableProps<T> {\n /** Array of data to be displayed in the table. */\n data: T[]\n /** The text to show when there is no available data to map through. */\n noDataContent?: ReactNode\n}\n\nexport interface TableRowProps<T> extends CommonTableProps<T> {\n rowData: T\n rowIndex: number\n showActions?: boolean\n}\n\nexport interface RowActionsProps<T>\n extends Pick<CommonTableProps<T>, 'expandable' | 'rowActions'> {\n rowData: T\n toggleExpansion: () => void\n isExpanded?: boolean\n}\n\nexport type TableHeaderProps<T> = CommonTableProps<T>\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/Table/types.ts"],"names":[],"mappings":"","sourcesContent":["import React, { ReactElement, ReactNode } from 'react'\nimport { ButtonProps } from '../Button/Button'\nimport { IconStrictProps } from '../IconStrict'\nimport { Color } from '../theme'\nimport type { BoxSpacing } from './helper.types'\n\nexport type TableStylesProps = {\n hasKeyline?: boolean\n fixedHeader?: boolean\n headerHeight?: string\n stripedColor?: Color\n stickyCell?: boolean\n headerColor?: Color\n rowColor?: Color\n rowBorderColor?: Color\n rowActionsBgColor?: Color\n minWidth?: string\n maxWidth?: string\n noWrapContent?: boolean\n truncateContent?: boolean\n rowPadding?: string\n columnPadding?: string\n hideOverflow?: boolean\n clickableRow?: boolean\n noRowBorderColor?: boolean\n}\n\nexport type Primitive = string | number | boolean | bigint\n\nexport type BaseRowAction<T> = {\n onClick: (rowData: T) => void\n showCondition?: (rowData: T) => boolean\n}\n\nexport type RowAction<T> =\n | RowActionButtonDefault<T>\n | RowActionElementOverride<T>\n\nexport type RowActionButtonDefault<T> = {\n iconButton?: Pick<\n IconStrictProps,\n 'size' | 'render' | 'iconColor' | 'backgroundColor' | 'id' | 'title'\n > & { tooltipText?: string }\n genericButton?: Pick<\n ButtonProps,\n | 'children'\n | 'loading'\n | 'disabled'\n | 'primary'\n | 'secondary'\n | 'fallbackStyle'\n | 'textBtn'\n | 'smallButton'\n | 'id'\n >\n} & BaseRowAction<T>\n\nexport type RowActionElementOverride<T> = {\n element: ReactElement<any>\n} & BaseRowAction<T>\n\nexport type RowActions<T> = {\n actions: RowAction<T>[]\n minWidth?: string\n bgColor?: Color\n}\n\ntype RowCellRenderer<T> = (\n row: T,\n rowIndex: number,\n column: TableColumn<T>,\n id: string | number,\n) => React.ReactNode\n\nexport interface TableColumn<T> {\n name?: string | number | React.ReactNode\n minWidth?: string\n maxWidth?: string\n noWrapContent?: boolean\n truncateContent?: boolean\n hideOverflow?: boolean\n cell?: RowCellRenderer<T>\n}\n\ntype SubElementProps = {\n bgColor?: Color\n padding?: BoxSpacing\n margin?: BoxSpacing\n}\n\n/** @template T - The type of data the table displays. */\ninterface CommonTableProps<T> {\n /** Array of columns to display in the table. */\n columns: TableColumn<T>[]\n /** Sets the height of the header. */\n headerHeight?: string\n /** If true, the table header will be fixed/sticky. */\n fixedHeader?: boolean\n /** If true, the table header will have a key line. */\n hasKeyline?: boolean\n /** If present, the table rows will have alternating colors. */\n stripedColor?: Color\n /** A function to determine if a row is expandable. */\n expandable?: (rowData: T) => boolean\n /** The color for the table header. */\n headerColor?: Color\n /** The default color for each table row. */\n rowColor?: Color\n /** The default color for each table row border. */\n rowBorderColor?: Color\n /** If true, the table will have rounded corners */\n roundedTable?: true\n /** A React element to show when a row is expanded. */\n subTable?: SubElementProps & {\n table: (rowData: T) => ReactElement<any>\n }\n /** Settings for sub rows. */\n subRows?: SubElementProps & {\n /** Function that returns a React element for the sub row. */\n rows: (rowData: T) => ReactElement<any> | ReactElement<any>[]\n }\n /** Function to apply to a row, to make the entire row clickable, useful for navigation. */\n clickableRow?: (rowData: T) => void\n /** Array of actions that can be performed on each row. */\n rowActions?: RowActions<T>\n /** The Y padding for each row. */\n rowPadding?: string\n /** The X padding for each row. */\n columnPadding?: string\n /** Hides the table header. Table defaults to always showing the header. */\n hideTableHeader?: boolean\n}\n\nexport interface TableProps<T> extends CommonTableProps<T> {\n /** Array of data to be displayed in the table. */\n data: T[]\n /** The text to show when there is no available data to map through. */\n noDataContent?: ReactNode\n}\n\nexport interface TableRowProps<T> extends CommonTableProps<T> {\n rowData: T\n rowIndex: number\n showActions?: boolean\n hideBorder?: boolean\n}\n\nexport interface RowActionsProps<T>\n extends Pick<CommonTableProps<T>, 'expandable' | 'rowActions'> {\n rowData: T\n canExpandRow: boolean\n toggleExpansion: () => void\n isExpanded?: boolean\n}\n\nexport type TableHeaderProps<T> = CommonTableProps<T>\n"]}
@@ -1,8 +1,4 @@
1
- type DateObject = {
2
- day?: string | null;
3
- month?: string | null;
4
- year?: string | null;
5
- };
1
+ import { DateObject } from '../../TextDateOfBirthInput';
6
2
  declare const dateFields: readonly ["day", "month", "year"];
7
3
  export declare const monthsArray: string[];
8
4
  export declare const validators: Record<(typeof dateFields)[number], (dateField: string | undefined | null) => boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"dateOfBirthValidator.utils.js","sourceRoot":"","sources":["../../../src/utils/dateOfBirth/dateOfBirthValidator.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAQ5C,MAAM,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YAAY,GAAG,CAAC,IAAU,EAAE,EAAE;IACzC,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA;IAE/C,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,CAAA;AACvC,CAAC,CAAA","sourcesContent":["import { isAfter, subYears } from 'date-fns'\n\ntype DateObject = {\n day?: string | null\n month?: string | null\n year?: string | null\n}\n\nconst dateFields = ['day', 'month', 'year'] as const\n\nexport const monthsArray = [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n]\n\nexport const validators: Record<\n (typeof dateFields)[number],\n (dateField: string | undefined | null) => boolean\n> = {\n day: (day) => {\n const dayNumber = Number(day)\n return Boolean(day && dayNumber >= 1 && dayNumber <= 31)\n },\n month: (month) => {\n const monthNumber = Number(month)\n return Boolean(month && monthNumber >= 1 && monthNumber <= 12)\n },\n year: (year) => {\n const yearNumber = Number(year)\n return Boolean(year && yearNumber && year.length === 4 && yearNumber > 0)\n },\n}\n\nexport const isAllowedValue = (value: string | null | undefined) => {\n return value === null || (value && /^\\d+$/.test(value)) || value === ''\n}\n\nexport const getInvalidInputFields = (dateObject: DateObject) => {\n const invalidValues = dateFields.filter((field) => {\n const value = dateObject[field]\n return !isAllowedValue(value)\n })\n\n return invalidValues\n}\n\nexport const getMissingFields = (dateObject: DateObject) => {\n const missingFields = dateFields.filter((field) => {\n return !dateObject[field]\n })\n\n return missingFields\n}\n\nexport const getImpossibleFields = (dateObject: DateObject) => {\n const impossibleValues = dateFields.filter((field) => {\n return !validators[field](dateObject[field])\n })\n\n return impossibleValues\n}\n\nexport const humanReadableJoin = (arr: string[]): string => {\n if (arr.length === 0) {\n return ''\n } else if (arr.length === 1) {\n return arr[0]\n } else if (arr.length === 2) {\n return `${arr[0]} and ${arr[1]}`\n } else {\n const last = arr.pop()\n return `${arr.join(', ')} and ${last}`\n }\n}\n\nexport const createMissingFieldErrorMessage = (missingFields: string[]) => {\n const beginning = 'Date of birth must include '\n const orderedMissingFields = ['day', 'month', 'year'].filter((field) =>\n missingFields.includes(field),\n )\n\n return beginning + humanReadableJoin(orderedMissingFields)\n}\n\nexport const createImpossibleFieldErrorMessage = (\n impossibleFields: string[],\n) => {\n const beginning = 'Please enter a valid '\n const orderedImpossibleFields = ['day', 'month', 'year'].filter((field) =>\n impossibleFields.includes(field),\n )\n\n return beginning + humanReadableJoin(orderedImpossibleFields)\n}\n\nexport const createYoungerThan17ErrorMessage = () => {\n const comparisonDate = subYears(new Date(), 17)\n\n return `Please enter a date of birth on or before ${comparisonDate.getDate()} ${monthsArray[comparisonDate.getMonth()]} ${comparisonDate.getFullYear()}`\n}\n\nexport const error = <T>(\n type: T,\n fields?: string[],\n): {\n error: T\n fields?: string[]\n} => {\n return { error: type, fields }\n}\n\nexport const is17YearsOld = (date: Date) => {\n const comparisonDate = subYears(new Date(), 17)\n\n return !isAfter(date, comparisonDate)\n}\n"]}
1
+ {"version":3,"file":"dateOfBirthValidator.utils.js","sourceRoot":"","sources":["../../../src/utils/dateOfBirth/dateOfBirthValidator.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAI5C,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAU,CAAA;AAEpD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,SAAS;IACT,UAAU;IACV,OAAO;IACP,OAAO;IACP,KAAK;IACL,MAAM;IACN,MAAM;IACN,QAAQ;IACR,WAAW;IACX,SAAS;IACT,UAAU;IACV,UAAU;CACX,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAGnB;IACF,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACX,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;QAC7B,OAAO,OAAO,CAAC,GAAG,IAAI,SAAS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,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,gBAA0B,EAC1B,EAAE;IACF,MAAM,SAAS,GAAG,uBAAuB,CAAA;IACzC,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CACxE,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,CACjC,CAAA;IAED,OAAO,SAAS,GAAG,iBAAiB,CAAC,uBAAuB,CAAC,CAAA;AAC/D,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,EAAE;IAClD,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA;IAE/C,OAAO,6CAA6C,cAAc,CAAC,OAAO,EAAE,IAAI,WAAW,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,IAAI,cAAc,CAAC,WAAW,EAAE,EAAE,CAAA;AAC1J,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,IAAO,EACP,MAAiB,EAIjB,EAAE;IACF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;AAChC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAU,EAAE,EAAE;IACzC,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA;IAE/C,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,CAAA;AACvC,CAAC,CAAA","sourcesContent":["import { isAfter, subYears } from 'date-fns'\n\nimport { DateObject } from '../../TextDateOfBirthInput'\n\nconst dateFields = ['day', 'month', 'year'] as const\n\nexport const monthsArray = [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n]\n\nexport const validators: Record<\n (typeof dateFields)[number],\n (dateField: string | undefined | null) => boolean\n> = {\n day: (day) => {\n const dayNumber = Number(day)\n return Boolean(day && dayNumber >= 1 && dayNumber <= 31)\n },\n month: (month) => {\n const monthNumber = Number(month)\n return Boolean(month && monthNumber >= 1 && monthNumber <= 12)\n },\n year: (year) => {\n const yearNumber = Number(year)\n return Boolean(year && yearNumber && year.length === 4 && yearNumber > 0)\n },\n}\n\nexport const isAllowedValue = (value: string | null | undefined) => {\n return value === null || (value && /^\\d+$/.test(value)) || value === ''\n}\n\nexport const getInvalidInputFields = (dateObject: DateObject) => {\n const invalidValues = dateFields.filter((field) => {\n const value = dateObject[field]\n return !isAllowedValue(value)\n })\n\n return invalidValues\n}\n\nexport const getMissingFields = (dateObject: DateObject) => {\n const missingFields = dateFields.filter((field) => {\n return !dateObject[field]\n })\n\n return missingFields\n}\n\nexport const getImpossibleFields = (dateObject: DateObject) => {\n const impossibleValues = dateFields.filter((field) => {\n return !validators[field](dateObject[field])\n })\n\n return impossibleValues\n}\n\nexport const humanReadableJoin = (arr: string[]): string => {\n if (arr.length === 0) {\n return ''\n } else if (arr.length === 1) {\n return arr[0]\n } else if (arr.length === 2) {\n return `${arr[0]} and ${arr[1]}`\n } else {\n const last = arr.pop()\n return `${arr.join(', ')} and ${last}`\n }\n}\n\nexport const createMissingFieldErrorMessage = (missingFields: string[]) => {\n const beginning = 'Date of birth must include '\n const orderedMissingFields = ['day', 'month', 'year'].filter((field) =>\n missingFields.includes(field),\n )\n\n return beginning + humanReadableJoin(orderedMissingFields)\n}\n\nexport const createImpossibleFieldErrorMessage = (\n impossibleFields: string[],\n) => {\n const beginning = 'Please enter a valid '\n const orderedImpossibleFields = ['day', 'month', 'year'].filter((field) =>\n impossibleFields.includes(field),\n )\n\n return beginning + humanReadableJoin(orderedImpossibleFields)\n}\n\nexport const createYoungerThan17ErrorMessage = () => {\n const comparisonDate = subYears(new Date(), 17)\n\n return `Please enter a date of birth on or before ${comparisonDate.getDate()} ${monthsArray[comparisonDate.getMonth()]} ${comparisonDate.getFullYear()}`\n}\n\nexport const error = <T>(\n type: T,\n fields?: string[],\n): {\n error: T\n fields?: string[]\n} => {\n return { error: type, fields }\n}\n\nexport const is17YearsOld = (date: Date) => {\n const comparisonDate = subYears(new Date(), 17)\n\n return !isAfter(date, comparisonDate)\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrshmllw/smores-react",
3
- "version": "11.0.1-crumbs-feature-adjust-package-2.1",
3
+ "version": "11.1.0-crumbs-feature-support-rounded-sub-tables.1",
4
4
  "main": "./dist/index.js",
5
5
  "description": "Collection of React components used by Marshmallow Technology",
6
6
  "type": "module",
@@ -42,22 +42,22 @@
42
42
  "@semantic-release/github": "^11.0.1",
43
43
  "@semantic-release/npm": "^12.0.0",
44
44
  "@snyk/protect": "^1.1295.3",
45
- "@storybook/addon-a11y": "^8.4.7",
45
+ "@storybook/addon-a11y": "^8.5.6",
46
46
  "@storybook/addon-coverage": "^1.0.5",
47
- "@storybook/addon-essentials": "^8.4.7",
48
- "@storybook/addon-interactions": "^8.4.7",
49
- "@storybook/addon-links": "^8.4.7",
50
- "@storybook/preview-api": "^8.4.7",
51
- "@storybook/react": "^8.4.7",
52
- "@storybook/react-vite": "^8.4.7",
47
+ "@storybook/addon-essentials": "^8.5.6",
48
+ "@storybook/addon-interactions": "^8.5.6",
49
+ "@storybook/addon-links": "^8.5.6",
50
+ "@storybook/preview-api": "^8.5.6",
51
+ "@storybook/react": "^8.5.6",
52
+ "@storybook/react-vite": "^8.5.6",
53
53
  "@storybook/test": "^8.2.1",
54
- "@storybook/test-runner": "^0.21.0",
54
+ "@storybook/test-runner": "^0.21.1",
55
55
  "@testing-library/react": "^16.2.0",
56
56
  "@types/body-scroll-lock": "^3.1.0",
57
57
  "@types/dompurify": "^3.2.0",
58
- "@types/node": "^22.13.2",
59
- "@types/react": "^19.0.8",
60
- "@types/react-dom": "^19.0.3",
58
+ "@types/node": "^22.13.4",
59
+ "@types/react": "^19.0.10",
60
+ "@types/react-dom": "^19.0.4",
61
61
  "@typescript-eslint/eslint-plugin": "^8.23.0",
62
62
  "@typescript-eslint/parser": "^8.23.0",
63
63
  "axe-playwright": "^2.1.0",
@@ -71,15 +71,15 @@
71
71
  "jsdom": "^26.0.0",
72
72
  "lint-staged": "^15.4.3",
73
73
  "playwright": "^1.50.1",
74
- "prettier": "^3.5.0",
74
+ "prettier": "^3.5.1",
75
75
  "react": "^19.0.0",
76
76
  "react-dom": "^19.0.0",
77
77
  "rimraf": "^6.0.1",
78
- "semantic-release": "^24.2.2",
78
+ "semantic-release": "^24.2.3",
79
79
  "storybook": "^8.0.4",
80
80
  "styled-components": "^6.1.15",
81
81
  "typescript": "^5.7.3",
82
- "typescript-eslint": "^8.24.0",
82
+ "typescript-eslint": "^8.24.1",
83
83
  "vite": "^6.1.0",
84
84
  "vitest": "^3.0.5"
85
85
  },