@razorpay/blade 12.14.0 → 12.15.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.
- package/build/lib/native/components/Table/TableBody.native.js.map +1 -1
- package/build/lib/native/components/Table/TableContext.js +1 -1
- package/build/lib/native/components/Table/TableContext.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/Calendar.web.js +17 -4
- package/build/lib/web/development/components/DatePicker/Calendar.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/DatePicker.web.js +2 -1
- package/build/lib/web/development/components/DatePicker/DatePicker.web.js.map +1 -1
- package/build/lib/web/development/components/Table/Table.web.js +38 -11
- package/build/lib/web/development/components/Table/Table.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableBody.web.js +96 -179
- package/build/lib/web/development/components/Table/TableBody.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableContext.js +5 -1
- package/build/lib/web/development/components/Table/TableContext.js.map +1 -1
- package/build/lib/web/development/components/Table/TableHeader.web.js +22 -5
- package/build/lib/web/development/components/Table/TableHeader.web.js.map +1 -1
- package/build/lib/web/development/components/Table/commonStyles/index.js +2 -0
- package/build/lib/web/development/components/Table/commonStyles/index.js.map +1 -0
- package/build/lib/web/development/components/Table/commonStyles/tableBodyStyles.js +187 -0
- package/build/lib/web/development/components/Table/commonStyles/tableBodyStyles.js.map +1 -0
- package/build/lib/web/development/components/Table/componentIds.js +1 -0
- package/build/lib/web/development/components/Table/componentIds.js.map +1 -1
- package/build/lib/web/development/components/Table/utils.js +29 -0
- package/build/lib/web/development/components/Table/utils.js.map +1 -0
- package/build/lib/web/production/components/DatePicker/Calendar.web.js +17 -4
- package/build/lib/web/production/components/DatePicker/Calendar.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/DatePicker.web.js +2 -1
- package/build/lib/web/production/components/DatePicker/DatePicker.web.js.map +1 -1
- package/build/lib/web/production/components/Table/Table.web.js +38 -11
- package/build/lib/web/production/components/Table/Table.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableBody.web.js +96 -179
- package/build/lib/web/production/components/Table/TableBody.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableContext.js +5 -1
- package/build/lib/web/production/components/Table/TableContext.js.map +1 -1
- package/build/lib/web/production/components/Table/TableHeader.web.js +22 -5
- package/build/lib/web/production/components/Table/TableHeader.web.js.map +1 -1
- package/build/lib/web/production/components/Table/commonStyles/index.js +2 -0
- package/build/lib/web/production/components/Table/commonStyles/index.js.map +1 -0
- package/build/lib/web/production/components/Table/commonStyles/tableBodyStyles.js +187 -0
- package/build/lib/web/production/components/Table/commonStyles/tableBodyStyles.js.map +1 -0
- package/build/lib/web/production/components/Table/componentIds.js +1 -0
- package/build/lib/web/production/components/Table/componentIds.js.map +1 -1
- package/build/lib/web/production/components/Table/utils.js +29 -0
- package/build/lib/web/production/components/Table/utils.js.map +1 -0
- package/build/types/components/index.d.ts +13 -3
- package/build/types/components/index.native.d.ts +13 -3
- package/codemods/aicodemod/knowledge/Table.md +126 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableBodyStyles.js","sources":["../../../../../../../src/components/Table/commonStyles/tableBodyStyles.tsx"],"sourcesContent":["import { tableRow } from '../tokens';\nimport { getTableActionsHoverStyles } from '../utils';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { Theme } from '~components/BladeProvider';\nimport type { BoxProps } from '~components/Box';\n\nconst getRowWrapperSelector = ({ isVirtualized }: { isVirtualized?: boolean }): string => {\n return isVirtualized ? 'tbody div' : '&';\n};\n\nconst addTableRowSelectorIFVirtualized = ({\n isVirtualized,\n}: {\n isVirtualized?: boolean;\n}): string => {\n return isVirtualized ? 'tr' : '';\n};\n\nconst getTableBodyStyles = ({\n isVirtualized,\n addCommonStyles,\n theme,\n height,\n width,\n isSelectable,\n showStripedRows,\n}: {\n isVirtualized?: boolean;\n addCommonStyles?: boolean;\n theme: Theme;\n height?: BoxProps['height'];\n width?: BoxProps['width'];\n isSelectable?: boolean;\n showStripedRows?: boolean;\n}): Record<string, unknown> => {\n const shouldAddCommonStyle = isVirtualized ?? addCommonStyles;\n return {\n ...(isVirtualized && {\n '& > div ': {\n overflow: 'auto !important',\n height: `${height} !important`,\n width: `${width} !important`,\n },\n // and remove scroll from the main table element\n '&': {\n overflow: 'hidden !important',\n },\n // for virtualized table, we need to apply some styles to tbody\n 'tbody > div': {\n display: 'block !important',\n },\n 'tbody div tr': {\n display: 'grid',\n gridTemplateColumns: 'var(--data-table-library_grid-template-columns)',\n columnGap: '0',\n },\n 'tbody div tr:last-child .cell-wrapper': {\n borderBottom: 'none',\n },\n 'tbody div td': {\n padding: '0',\n },\n }),\n // these styles are common for both virtualized and non-virtualized tables\n ...(shouldAddCommonStyle && {\n [`${getRowWrapperSelector({\n isVirtualized,\n })} .row-select-single-selected .cell-wrapper-base, .row-select-selected .cell-wrapper-base`]: {\n backgroundColor: getIn(theme.colors, tableRow.nonStripe.backgroundColorSelected),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} .row-select-single-selected:hover:not(.disabled-row) .cell-wrapper-base, .row-select-selected:hover:not(.disabled-row) .cell-wrapper-base`]: {\n backgroundColor: getIn(theme.colors, tableRow.nonStripe.backgroundColorSelectedHover),\n ...getTableActionsHoverStyles({\n hoverColor: tableRow.nonStripe.backgroundColorSelectedHover,\n backgroundGradientColor: tableRow.nonStripeWrapper.backgroundColorSelectedHover,\n theme,\n }),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} .row-select-single-selected:focus:not(.disabled-row) .cell-wrapper-base, .row-select-selected:focus:not(.disabled-row) .cell-wrapper-base`]: {\n backgroundColor: getIn(theme.colors, tableRow.nonStripe.backgroundColorSelectedFocus),\n ...getTableActionsHoverStyles({\n hoverColor: tableRow.nonStripe.backgroundColorSelectedFocus,\n backgroundGradientColor: tableRow.nonStripeWrapper.backgroundColorSelectedFocus,\n theme,\n }),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} .row-select-single-selected:active:not(.disabled-row) .cell-wrapper-base, .row-select-selected:active:not(.disabled-row) .cell-wrapper-base`]: {\n backgroundColor: getIn(theme.colors, tableRow.nonStripe.backgroundColorSelectedActive),\n ...getTableActionsHoverStyles({\n hoverColor: tableRow.nonStripe.backgroundColorSelectedActive,\n backgroundGradientColor: tableRow.nonStripe.backgroundColorHover,\n theme,\n }),\n },\n\n ...(isSelectable && {\n [`${getRowWrapperSelector({\n isVirtualized,\n })} tr:active:not(.disabled-row) .cell-wrapper`]: {\n backgroundColor: getIn(theme.colors, tableRow.nonStripeWrapper.backgroundColorActive),\n },\n }),\n\n ...(showStripedRows && {\n [`${getRowWrapperSelector({\n isVirtualized,\n })} tr:nth-child(even) .cell-wrapper`]: {\n backgroundColor: getIn(theme.colors, tableRow.stripeWrapper.backgroundColor),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} tr:nth-child(even) .cell-wrapper-base`]: {\n backgroundColor: tableRow.stripe.backgroundColor,\n },\n }),\n\n ...(showStripedRows &&\n isSelectable && {\n [`${getRowWrapperSelector({\n isVirtualized,\n })} tr:nth-child(even):hover:not(.disabled-row) .cell-wrapper`]: {\n backgroundColor: getIn(theme.colors, tableRow.stripeWrapper.backgroundColorHover),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} tr:nth-child(even):focus:not(.disabled-row) .cell-wrapper`]: {\n backgroundColor: getIn(theme.colors, tableRow.stripeWrapper.backgroundColorFocus),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} tr:nth-child(even):active:not(.disabled-row) .cell-wrapper`]: {\n backgroundColor: getIn(theme.colors, tableRow.stripeWrapper.backgroundColorActive),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} .row-select-single-selected:nth-child(even) .cell-wrapper, .row-select-selected:nth-child(even) .cell-wrapper`]: {\n backgroundColor: getIn(theme.colors, tableRow.stripeWrapper.backgroundColorSelected),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} .row-select-single-selected:nth-child(even):hover:not(.disabled-row) .cell-wrapper, .row-select-selected:nth-child(even):hover:not(.disabled-row) .cell-wrapper`]: {\n backgroundColor: getIn(\n theme.colors,\n tableRow.stripeWrapper.backgroundColorSelectedHover,\n ),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} .row-select-single-selected:nth-child(even):focus:not(.disabled-row) .cell-wrapper, .row-select-selected:nth-child(even):focus:not(.disabled-row) .cell-wrapper`]: {\n backgroundColor: getIn(\n theme.colors,\n tableRow.stripeWrapper.backgroundColorSelectedFocus,\n ),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} .row-select-single-selected:nth-child(even):active:not(.disabled-row) .cell-wrapper, .row-select-selected:nth-child(even):active:not(.disabled-row) .cell-wrapper`]: {\n backgroundColor: getIn(\n theme.colors,\n tableRow.stripeWrapper.backgroundColorSelectedActive,\n ),\n },\n\n [`${getRowWrapperSelector({\n isVirtualized,\n })} tr:nth-child(even):hover:not(.disabled-row) .cell-wrapper-base`]: {\n backgroundColor: getIn(theme.colors, tableRow.stripe.backgroundColorHover),\n ...getTableActionsHoverStyles({\n hoverColor: tableRow.stripe.backgroundColorHover,\n theme,\n backgroundGradientColor: tableRow.stripeWrapper.backgroundColorHover,\n }),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} tr:nth-child(even):focus:not(.disabled-row) .cell-wrapper-base`]: {\n backgroundColor: getIn(theme.colors, tableRow.stripe.backgroundColorFocus),\n ...getTableActionsHoverStyles({\n hoverColor: tableRow.stripe.backgroundColorFocus,\n theme,\n backgroundGradientColor: tableRow.stripeWrapper.backgroundColorFocus,\n }),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} tr:nth-child(even):active:not(.disabled-row) .cell-wrapper-base`]: {\n backgroundColor: getIn(theme.colors, tableRow.stripe.backgroundColorActive),\n ...getTableActionsHoverStyles({\n hoverColor: tableRow.stripe.backgroundColorActive,\n backgroundGradientColor: tableRow.stripe.backgroundColorHover,\n theme,\n }),\n },\n\n [`${getRowWrapperSelector({\n isVirtualized,\n })} ${addTableRowSelectorIFVirtualized({\n isVirtualized,\n })}.row-select-single-selected:nth-child(even) .cell-wrapper-base, .row-select-selected:nth-child(even) .cell-wrapper-base `]: {\n backgroundColor: getIn(theme.colors, tableRow.stripe.backgroundColorSelected),\n ...getTableActionsHoverStyles({\n hoverColor: tableRow.stripe.backgroundColorSelected,\n theme,\n backgroundGradientColor: tableRow.stripeWrapper.backgroundColorSelected,\n }),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} ${addTableRowSelectorIFVirtualized({\n isVirtualized,\n })} .row-select-single-selected:nth-child(even):hover:not(.disabled-row) .cell-wrapper-base, .row-select-selected:nth-child(even):hover:not(.disabled-row) .cell-wrapper-base `]: {\n backgroundColor: getIn(theme.colors, tableRow.stripe.backgroundColorSelectedHover),\n ...getTableActionsHoverStyles({\n hoverColor: tableRow.stripe.backgroundColorSelectedHover,\n theme,\n backgroundGradientColor: tableRow.stripeWrapper.backgroundColorSelectedHover,\n }),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} ${addTableRowSelectorIFVirtualized({\n isVirtualized,\n })} .row-select-single-selected:nth-child(even):focus:not(.disabled-row) .cell-wrapper-base, .row-select-selected:nth-child(even):focus:not(.disabled-row) .cell-wrapper-base `]: {\n backgroundColor: getIn(theme.colors, tableRow.stripe.backgroundColorSelectedFocus),\n ...getTableActionsHoverStyles({\n hoverColor: tableRow.stripe.backgroundColorSelectedFocus,\n theme,\n backgroundGradientColor: tableRow.stripeWrapper.backgroundColorSelectedFocus,\n }),\n },\n [`${getRowWrapperSelector({\n isVirtualized,\n })} ${addTableRowSelectorIFVirtualized({\n isVirtualized,\n })}.row-select-single-selected:nth-child(even):active:not(.disabled-row) .cell-wrapper-base, .row-select-selected:nth-child(even):active:not(.disabled-row) .cell-wrapper-base `]: {\n backgroundColor: getIn(theme.colors, tableRow.stripe.backgroundColorSelectedActive),\n ...getTableActionsHoverStyles({\n hoverColor: tableRow.stripe.backgroundColorSelectedActive,\n theme,\n backgroundGradientColor: tableRow.stripe.backgroundColorHover,\n }),\n },\n }),\n }),\n };\n};\nexport { getTableBodyStyles };\n"],"names":["getRowWrapperSelector","_ref","isVirtualized","addTableRowSelectorIFVirtualized","_ref2","getTableBodyStyles","_ref3","_ref6","addCommonStyles","theme","height","width","isSelectable","showStripedRows","shouldAddCommonStyle","_objectSpread","overflow","concat","display","gridTemplateColumns","columnGap","borderBottom","padding","_defineProperty","backgroundColor","getIn","colors","tableRow","nonStripe","backgroundColorSelected","backgroundColorSelectedHover","getTableActionsHoverStyles","hoverColor","backgroundGradientColor","nonStripeWrapper","backgroundColorSelectedFocus","backgroundColorSelectedActive","backgroundColorHover","backgroundColorActive","stripeWrapper","stripe","backgroundColorFocus"],"mappings":";;;;;;;AAMA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAAC,IAAA,EAA+D;AAAA,EAAA,IAAzDC,aAAa,GAAAD,IAAA,CAAbC,aAAa,CAAA;AAC5C,EAAA,OAAOA,aAAa,GAAG,WAAW,GAAG,GAAG,CAAA;AAC1C,CAAC,CAAA;AAED,IAAMC,gCAAgC,GAAG,SAAnCA,gCAAgCA,CAAAC,KAAA,EAIxB;AAAA,EAAA,IAHZF,aAAa,GAAAE,KAAA,CAAbF,aAAa,CAAA;AAIb,EAAA,OAAOA,aAAa,GAAG,IAAI,GAAG,EAAE,CAAA;AAClC,CAAC,CAAA;AAED,IAAMG,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,KAAA,EAgBO;AAAA,EAAA,IAAAC,KAAA,CAAA;AAAA,EAAA,IAf7BL,aAAa,GAAAI,KAAA,CAAbJ,aAAa;IACbM,eAAe,GAAAF,KAAA,CAAfE,eAAe;IACfC,KAAK,GAAAH,KAAA,CAALG,KAAK;IACLC,MAAM,GAAAJ,KAAA,CAANI,MAAM;IACNC,KAAK,GAAAL,KAAA,CAALK,KAAK;IACLC,YAAY,GAAAN,KAAA,CAAZM,Y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5BC,IAAAA,UAAU,EAAEL,QAAQ,CAACa,MAAM,CAACJ,6BAA6B;AACzD3B,IAAAA,KAAK,EAALA,KAAK;AACLwB,IAAAA,uBAAuB,EAAEN,QAAQ,CAACa,MAAM,CAACH,oBAAAA;GAC1C,CAAC,GAEL,CACJ,CAAA,CAAA;AAEL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentIds.js","sources":["../../../../../../src/components/Table/componentIds.ts"],"sourcesContent":["const ComponentIds = {\n Table: 'Table',\n TableBody: 'TableBody',\n TableRow: 'TableRow',\n TableCell: 'TableCell',\n TableEditableCell: 'TableEditableCell',\n TableToolbar: 'TableToolbar',\n TableToolbarActions: 'TableToolbarActions',\n TableHeader: 'TableHeader',\n TableHeaderRow: 'TableHeaderRow',\n TableHeaderCell: 'TableHeaderCell',\n TableFooter: 'TableFooter',\n TableFooterRow: 'TableFooterRow',\n TableFooterCell: 'TableFooterCell',\n TablePagination: 'TablePagination',\n};\n\nexport { ComponentIds };\n"],"names":["ComponentIds","Table","TableBody","TableRow","TableCell","TableEditableCell","TableToolbar","TableToolbarActions","TableHeader","TableHeaderRow","TableHeaderCell","TableFooter","TableFooterRow","TableFooterCell","TablePagination"],"mappings":"AAAA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,YAAY,EAAE,cAAc;AAC5BC,EAAAA,mBAAmB,EAAE,qBAAqB;AAC1CC,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,eAAe,EAAE,iBAAiB;AAClCC,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,eAAe,EAAE,iBAAiB;AAClCC,EAAAA,eAAe,EAAE,iBAAA;AACnB;;;;"}
|
|
1
|
+
{"version":3,"file":"componentIds.js","sources":["../../../../../../src/components/Table/componentIds.ts"],"sourcesContent":["const ComponentIds = {\n Table: 'Table',\n TableBody: 'TableBody',\n TableRow: 'TableRow',\n TableCell: 'TableCell',\n TableEditableCell: 'TableEditableCell',\n TableToolbar: 'TableToolbar',\n TableToolbarActions: 'TableToolbarActions',\n TableHeader: 'TableHeader',\n TableHeaderRow: 'TableHeaderRow',\n TableHeaderCell: 'TableHeaderCell',\n TableFooter: 'TableFooter',\n TableFooterRow: 'TableFooterRow',\n TableFooterCell: 'TableFooterCell',\n VirtualizedTable: 'VirtualizedTable',\n TablePagination: 'TablePagination',\n};\n\nexport { ComponentIds };\n"],"names":["ComponentIds","Table","TableBody","TableRow","TableCell","TableEditableCell","TableToolbar","TableToolbarActions","TableHeader","TableHeaderRow","TableHeaderCell","TableFooter","TableFooterRow","TableFooterCell","VirtualizedTable","TablePagination"],"mappings":"AAAA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,YAAY,EAAE,cAAc;AAC5BC,EAAAA,mBAAmB,EAAE,qBAAqB;AAC1CC,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,eAAe,EAAE,iBAAiB;AAClCC,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,eAAe,EAAE,iBAAiB;AAClCC,EAAAA,gBAAgB,EAAE,kBAAkB;AACpCC,EAAAA,eAAe,EAAE,iBAAA;AACnB;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import { tableRow, classes, tableBackgroundColor } from './tokens.js';
|
|
3
|
+
import '../../utils/index.js';
|
|
4
|
+
import getIn from '../../utils/lodashButBetter/get.js';
|
|
5
|
+
import { makeMotionTime } from '../../utils/makeMotionTime/makeMotionTime.web.js';
|
|
6
|
+
|
|
7
|
+
var getTableRowBackgroundTransition = function getTableRowBackgroundTransition(theme) {
|
|
8
|
+
var rowBackgroundTransition = "background-color ".concat(makeMotionTime(getIn(theme.motion, tableRow.backgroundColorMotionDuration)), " ").concat(getIn(theme.motion, tableRow.backgroundColorMotionEasing));
|
|
9
|
+
return rowBackgroundTransition;
|
|
10
|
+
};
|
|
11
|
+
var getTableActionsHoverStyles = function getTableActionsHoverStyles(_ref) {
|
|
12
|
+
var hoverColor = _ref.hoverColor,
|
|
13
|
+
theme = _ref.theme,
|
|
14
|
+
backgroundGradientColor = _ref.backgroundGradientColor;
|
|
15
|
+
var rowBackgroundTransition = getTableRowBackgroundTransition(theme);
|
|
16
|
+
return _defineProperty(_defineProperty(_defineProperty({}, "& .".concat(classes.HOVER_ACTIONS), {
|
|
17
|
+
backgroundColor: getIn(theme.colors, tableBackgroundColor),
|
|
18
|
+
transition: rowBackgroundTransition
|
|
19
|
+
}), "& .".concat(classes.HOVER_ACTIONS_LAYER2), {
|
|
20
|
+
backgroundColor: getIn(theme.colors, backgroundGradientColor !== null && backgroundGradientColor !== void 0 ? backgroundGradientColor : 'transparent'),
|
|
21
|
+
transition: rowBackgroundTransition
|
|
22
|
+
}), "& .".concat(classes.HOVER_ACTIONS_LAYER3), {
|
|
23
|
+
backgroundColor: getIn(theme.colors, hoverColor),
|
|
24
|
+
transition: rowBackgroundTransition
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { getTableActionsHoverStyles, getTableRowBackgroundTransition };
|
|
29
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../src/components/Table/utils.ts"],"sourcesContent":["import { classes, tableRow, tableBackgroundColor } from './tokens';\nimport type { Theme } from '~components/BladeProvider';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\n\nimport { makeMotionTime } from '~utils';\nimport getIn from '~utils/lodashButBetter/get';\n\nconst getTableRowBackgroundTransition = (theme: Theme): string => {\n const rowBackgroundTransition = `background-color ${makeMotionTime(\n getIn(theme.motion, tableRow.backgroundColorMotionDuration),\n )} ${getIn(theme.motion, tableRow.backgroundColorMotionEasing)}`;\n\n return rowBackgroundTransition;\n};\n\nconst getTableActionsHoverStyles = ({\n hoverColor,\n theme,\n backgroundGradientColor,\n}: {\n hoverColor: DotNotationToken<Theme['colors']>;\n backgroundGradientColor?: DotNotationToken<Omit<Theme['colors'], 'name'>>;\n theme: Theme;\n}): React.CSSProperties => {\n const rowBackgroundTransition = getTableRowBackgroundTransition(theme);\n\n return {\n // Solid layer 1 background - should match the table background\n [`& .${classes.HOVER_ACTIONS}`]: {\n backgroundColor: getIn(theme.colors, tableBackgroundColor),\n transition: rowBackgroundTransition,\n },\n // Alpha layer 2 background - Stripped row background, Hover background in selected state, etc\n [`& .${classes.HOVER_ACTIONS_LAYER2}`]: {\n backgroundColor: getIn(theme.colors, backgroundGradientColor ?? 'transparent'),\n transition: rowBackgroundTransition,\n },\n // Alpha layer 3 background - Hover, selection, active background\n [`& .${classes.HOVER_ACTIONS_LAYER3}`]: {\n backgroundColor: getIn(theme.colors, hoverColor),\n transition: rowBackgroundTransition,\n },\n };\n};\n\nexport { getTableActionsHoverStyles, getTableRowBackgroundTransition };\n"],"names":["getTableRowBackgroundTransition","theme","rowBackgroundTransition","concat","makeMotionTime","getIn","motion","tableRow","backgroundColorMotionDuration","backgroundColorMotionEasing","getTableActionsHoverStyles","_ref","hoverColor","backgroundGradientColor","_defineProperty","classes","HOVER_ACTIONS","backgroundColor","colors","tableBackgroundColor","transition","HOVER_ACTIONS_LAYER2","HOVER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BAAoB,CAAK,EAAA;IACtCL,eAAe,EAAEZ,KAAK,CAACJ,KAAK,CAACiB,MAAM,EAAEN,UAAU,CAAC;AAChDQ,IAAAA,UAAU,EAAElB,uBAAAA;GACb,CAAA,CAAA;AAEL;;;;"}
|
|
@@ -23935,7 +23935,7 @@ type TableProps<Item> = {
|
|
|
23935
23935
|
defaultSelectedIds?: Identifier[];
|
|
23936
23936
|
} & DataAnalyticsAttribute & StyledPropsBlade;
|
|
23937
23937
|
type Identifier = string | number;
|
|
23938
|
-
type TableBodyProps = {
|
|
23938
|
+
type TableBodyProps<Item> = {
|
|
23939
23939
|
/**
|
|
23940
23940
|
* The children of the TableBody component should be TableRow components.
|
|
23941
23941
|
* @example
|
|
@@ -23944,8 +23944,17 @@ type TableBodyProps = {
|
|
|
23944
23944
|
* <TableCell>...</TableCell>
|
|
23945
23945
|
* </TableRow>
|
|
23946
23946
|
* </TableBody>
|
|
23947
|
+
* if you are using TableBody inside TableVirtualizedWrapper then you can pass the children as a function
|
|
23948
|
+
* @example
|
|
23949
|
+
* <TableBody>
|
|
23950
|
+
* {(tableItem, index) => (
|
|
23951
|
+
* <TableRow key={index} item={tableItem}>
|
|
23952
|
+
* <TableCell>...</TableCell>
|
|
23953
|
+
* </TableRow>
|
|
23954
|
+
* )}
|
|
23955
|
+
* </TableBody>
|
|
23947
23956
|
**/
|
|
23948
|
-
children: React__default.ReactNode;
|
|
23957
|
+
children: React__default.ReactNode | ((tableItem: Item, index: number) => React__default.ReactElement);
|
|
23949
23958
|
} & DataAnalyticsAttribute;
|
|
23950
23959
|
type TableRowProps<Item> = {
|
|
23951
23960
|
/**
|
|
@@ -24059,6 +24068,7 @@ type TablePaginationCommonProps = {
|
|
|
24059
24068
|
* The default page size.
|
|
24060
24069
|
* Page size controls how rows are shown per page.
|
|
24061
24070
|
* @default 10
|
|
24071
|
+
* consider using virtualization for large page sizes
|
|
24062
24072
|
**/
|
|
24063
24073
|
defaultPageSize?: 10 | 25 | 50;
|
|
24064
24074
|
/**
|
|
@@ -24162,7 +24172,7 @@ declare const TableHeader: ({ children, ...rest }: TableHeaderRowProps) => React
|
|
|
24162
24172
|
declare const TableHeaderCell: ({ children, headerKey, _hasPadding, textAlign, ...rest }: TableHeaderCellProps) => React__default.ReactElement;
|
|
24163
24173
|
declare const TableHeaderRow: ({ children, rowDensity, ...rest }: TableHeaderRowProps) => React__default.ReactElement;
|
|
24164
24174
|
|
|
24165
|
-
declare const TableBody: ({ children, ...rest }: TableBodyProps) => React__default.ReactElement;
|
|
24175
|
+
declare const TableBody: <Item>({ children, ...rest }: TableBodyProps<Item>) => React__default.ReactElement;
|
|
24166
24176
|
declare const TableCell: ({ children, textAlign, _hasPadding, ...rest }: TableCellProps) => React__default.ReactElement;
|
|
24167
24177
|
declare const TableRow: <Item>({ children, item, isDisabled, onHover, onClick, hoverActions, testID, ...rest }: TableRowProps<Item>) => React__default.ReactElement;
|
|
24168
24178
|
|
|
@@ -14683,7 +14683,7 @@ type TableProps<Item> = {
|
|
|
14683
14683
|
defaultSelectedIds?: Identifier[];
|
|
14684
14684
|
} & DataAnalyticsAttribute & StyledPropsBlade;
|
|
14685
14685
|
type Identifier = string | number;
|
|
14686
|
-
type TableBodyProps = {
|
|
14686
|
+
type TableBodyProps<Item> = {
|
|
14687
14687
|
/**
|
|
14688
14688
|
* The children of the TableBody component should be TableRow components.
|
|
14689
14689
|
* @example
|
|
@@ -14692,8 +14692,17 @@ type TableBodyProps = {
|
|
|
14692
14692
|
* <TableCell>...</TableCell>
|
|
14693
14693
|
* </TableRow>
|
|
14694
14694
|
* </TableBody>
|
|
14695
|
+
* if you are using TableBody inside TableVirtualizedWrapper then you can pass the children as a function
|
|
14696
|
+
* @example
|
|
14697
|
+
* <TableBody>
|
|
14698
|
+
* {(tableItem, index) => (
|
|
14699
|
+
* <TableRow key={index} item={tableItem}>
|
|
14700
|
+
* <TableCell>...</TableCell>
|
|
14701
|
+
* </TableRow>
|
|
14702
|
+
* )}
|
|
14703
|
+
* </TableBody>
|
|
14695
14704
|
**/
|
|
14696
|
-
children: React__default.ReactNode;
|
|
14705
|
+
children: React__default.ReactNode | ((tableItem: Item, index: number) => React__default.ReactElement);
|
|
14697
14706
|
} & DataAnalyticsAttribute;
|
|
14698
14707
|
type TableRowProps<Item> = {
|
|
14699
14708
|
/**
|
|
@@ -14807,6 +14816,7 @@ type TablePaginationCommonProps = {
|
|
|
14807
14816
|
* The default page size.
|
|
14808
14817
|
* Page size controls how rows are shown per page.
|
|
14809
14818
|
* @default 10
|
|
14819
|
+
* consider using virtualization for large page sizes
|
|
14810
14820
|
**/
|
|
14811
14821
|
defaultPageSize?: 10 | 25 | 50;
|
|
14812
14822
|
/**
|
|
@@ -14910,7 +14920,7 @@ declare const TableHeader: (props: TableHeaderProps) => React__default.ReactElem
|
|
|
14910
14920
|
declare const TableHeaderRow: (props: TableHeaderRowProps) => React__default.ReactElement;
|
|
14911
14921
|
declare const TableHeaderCell: (props: TableHeaderCellProps) => React__default.ReactElement;
|
|
14912
14922
|
|
|
14913
|
-
declare const TableBody: (props: TableBodyProps) => React__default.ReactElement;
|
|
14923
|
+
declare const TableBody: <Item>(props: TableBodyProps<Item>) => React__default.ReactElement;
|
|
14914
14924
|
declare const TableRow: (props: TableRowProps<unknown>) => React__default.ReactElement;
|
|
14915
14925
|
declare const TableCell: (props: TableCellProps) => React__default.ReactElement;
|
|
14916
14926
|
|
|
@@ -594,3 +594,129 @@ const TableComponent: StoryFn<typeof Table> = ({ ...args }) => {
|
|
|
594
594
|
);
|
|
595
595
|
};
|
|
596
596
|
```
|
|
597
|
+
|
|
598
|
+
# Virtualized Table
|
|
599
|
+
|
|
600
|
+
Virtaulized table is a table component that renders only the visible rows and columns. This is useful when you have a large dataset and you want to render only the visible rows and columns to improve the performance of the table.
|
|
601
|
+
|
|
602
|
+
Out implementation of virtualized table is an wrapper on top of react-table-library 's implementation. It provides a simple API to create a virtualized table.
|
|
603
|
+
|
|
604
|
+
## Props
|
|
605
|
+
|
|
606
|
+
most of props are same as Table component. we have added following table component.
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
but their is a change in children prop of Table component. In virtualized table we need to pass a component named TableVirtulized that takes TableHeader, TableBody components.
|
|
610
|
+
VirtualizedTable is a wrapper on top of react-table-library's [Virtualized](https://github.com/table-library/react-table-library/blob/master/src/virtualized/Virtualized.tsx) component. It provides a simple API to create a virtualized table.
|
|
611
|
+
|
|
612
|
+
```ts
|
|
613
|
+
type VirtualizedWrapperProps<Item> = {
|
|
614
|
+
/**
|
|
615
|
+
* * @example
|
|
616
|
+
* <TableComponent
|
|
617
|
+
* data={data}
|
|
618
|
+
* isVirtualized
|
|
619
|
+
* rowDensity="compact"
|
|
620
|
+
* selectionType="multiple"
|
|
621
|
+
* height="700px"
|
|
622
|
+
* toolbar={
|
|
623
|
+
* <TableToolbar>
|
|
624
|
+
* <TableToolbarActions>
|
|
625
|
+
* <Button variant="secondary" marginRight="spacing.2">
|
|
626
|
+
* Export
|
|
627
|
+
* </Button>
|
|
628
|
+
* <Button>Payout</Button>
|
|
629
|
+
* </TableToolbarActions>
|
|
630
|
+
* </TableToolbar>
|
|
631
|
+
* }
|
|
632
|
+
* >
|
|
633
|
+
* {(tableData) => (
|
|
634
|
+
* <TableVirtualizedWrapper tableData={tableData}>
|
|
635
|
+
* <TableHeader>
|
|
636
|
+
* <TableHeaderRow>
|
|
637
|
+
* <TableHeaderCell>ID</TableHeaderCell>
|
|
638
|
+
* <TableHeaderCell>Amount</TableHeaderCell>
|
|
639
|
+
* <TableHeaderCell>Account</TableHeaderCell>
|
|
640
|
+
* <TableHeaderCell>Date</TableHeaderCell>
|
|
641
|
+
* <TableHeaderCell>Method</TableHeaderCell>
|
|
642
|
+
* <TableHeaderCell>Status</TableHeaderCell>
|
|
643
|
+
* </TableHeaderRow>
|
|
644
|
+
* </TableHeader>
|
|
645
|
+
* <TableBody<Item>>
|
|
646
|
+
* {(tableItem, index) => (
|
|
647
|
+
* <TableRow
|
|
648
|
+
* key={index}
|
|
649
|
+
* item={tableItem}
|
|
650
|
+
* hoverActions={
|
|
651
|
+
* <>
|
|
652
|
+
* <IconButton
|
|
653
|
+
* accessibilityLabel="Copy"
|
|
654
|
+
* isHighlighted
|
|
655
|
+
* icon={CopyIcon}
|
|
656
|
+
* onClick={() => console.log('copy', tableItem)}
|
|
657
|
+
* />
|
|
658
|
+
* <IconButton
|
|
659
|
+
* accessibilityLabel="Delete"
|
|
660
|
+
* isHighlighted
|
|
661
|
+
* icon={TrashIcon}
|
|
662
|
+
* onClick={() => console.log('delete', tableItem)}
|
|
663
|
+
* />
|
|
664
|
+
* </>
|
|
665
|
+
* }
|
|
666
|
+
* >
|
|
667
|
+
* <TableCell>
|
|
668
|
+
* <Code size="medium">{tableItem.paymentId}</Code>
|
|
669
|
+
* </TableCell>
|
|
670
|
+
* <TableCell>
|
|
671
|
+
* <Amount value={tableItem.amount} />
|
|
672
|
+
* </TableCell>
|
|
673
|
+
* <TableCell>{tableItem.account}</TableCell>
|
|
674
|
+
* <TableCell>
|
|
675
|
+
* {tableItem.date?.toLocaleDateString('en-IN', {
|
|
676
|
+
* year: 'numeric',
|
|
677
|
+
* month: '2-digit',
|
|
678
|
+
* day: '2-digit',
|
|
679
|
+
* })}
|
|
680
|
+
* </TableCell>
|
|
681
|
+
* <TableCell>{tableItem.method}</TableCell>
|
|
682
|
+
* <TableCell>
|
|
683
|
+
* <Badge
|
|
684
|
+
* size="medium"
|
|
685
|
+
* color={
|
|
686
|
+
* tableItem.status === 'Completed'
|
|
687
|
+
* ? 'positive'
|
|
688
|
+
* : tableItem.status === 'Pending'
|
|
689
|
+
* ? 'notice'
|
|
690
|
+
* : tableItem.status === 'Failed'
|
|
691
|
+
* ? 'negative'
|
|
692
|
+
* : 'default'
|
|
693
|
+
* }
|
|
694
|
+
* >
|
|
695
|
+
* {tableItem.status}
|
|
696
|
+
* </Badge>
|
|
697
|
+
* </TableCell>
|
|
698
|
+
* </TableRow>
|
|
699
|
+
* )}
|
|
700
|
+
* </TableBody>
|
|
701
|
+
* </TableVirtualizedWrapper>
|
|
702
|
+
* )}
|
|
703
|
+
* </TableComponent>
|
|
704
|
+
*
|
|
705
|
+
**/
|
|
706
|
+
/**
|
|
707
|
+
/**
|
|
708
|
+
* The tableData prop is an array of objects.
|
|
709
|
+
*/
|
|
710
|
+
tableData: TableNode<Item>[];
|
|
711
|
+
/**
|
|
712
|
+
* headerHeight is the height of the header
|
|
713
|
+
**/
|
|
714
|
+
headerHeight?: number;
|
|
715
|
+
/**
|
|
716
|
+
* rowHeight is the height of each row, it can be a fixed number or a function that returns a number
|
|
717
|
+
**/
|
|
718
|
+
rowHeight?: (item: TableLibraryTableNode, index: number) => number;
|
|
719
|
+
children: React.ReactNode;
|
|
720
|
+
children: React.ReactNode;
|
|
721
|
+
};
|
|
722
|
+
```
|