@mrshmllw/smores-react 16.2.13 → 16.2.15

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.
Files changed (136) hide show
  1. package/dist/Accordion/Accordion.js +6 -6
  2. package/dist/Accordion/Accordion.js.map +1 -1
  3. package/dist/ActionDropdown/ActionDropdown.js +1 -1
  4. package/dist/ActionDropdown/ActionDropdown.js.map +1 -1
  5. package/dist/Alert/Alert.js +1 -1
  6. package/dist/Alert/Alert.js.map +1 -1
  7. package/dist/Badge/Badge.js +7 -7
  8. package/dist/Badge/Badge.js.map +1 -1
  9. package/dist/Badge/BadgeFallbackImage.js +4 -2
  10. package/dist/Badge/BadgeFallbackImage.js.map +1 -1
  11. package/dist/BadgeList/BadgeList.js +1 -1
  12. package/dist/BadgeList/BadgeList.js.map +1 -1
  13. package/dist/Banner/BannerItem.js +2 -2
  14. package/dist/Banner/BannerItem.js.map +1 -1
  15. package/dist/Box/Box.d.ts +1 -1
  16. package/dist/Box/Box.js +1 -1
  17. package/dist/Box/Box.js.map +1 -1
  18. package/dist/Button/Button.js +19 -18
  19. package/dist/Button/Button.js.map +1 -1
  20. package/dist/Card/Card.js +2 -2
  21. package/dist/Card/Card.js.map +1 -1
  22. package/dist/CheckBox/CheckBox.js +2 -2
  23. package/dist/CheckBox/CheckBox.js.map +1 -1
  24. package/dist/Chip/Chip.js +16 -18
  25. package/dist/Chip/Chip.js.map +1 -1
  26. package/dist/CurrencyInput/CurrencyInput.js +3 -2
  27. package/dist/CurrencyInput/CurrencyInput.js.map +1 -1
  28. package/dist/Datepicker/Datepicker.js +3 -3
  29. package/dist/Datepicker/Datepicker.js.map +1 -1
  30. package/dist/Divider/Divider.js +1 -1
  31. package/dist/Divider/Divider.js.map +1 -1
  32. package/dist/Dropdown/Dropdown.js +2 -2
  33. package/dist/Dropdown/Dropdown.js.map +1 -1
  34. package/dist/Icon/Icon.js +1 -1
  35. package/dist/Icon/Icon.js.map +1 -1
  36. package/dist/Icon/iconFiles/CaretUp.d.ts +2 -3
  37. package/dist/Icon/iconsList.d.ts +444 -227
  38. package/dist/IconStrict/IconStrict.js +1 -1
  39. package/dist/IconStrict/IconStrict.js.map +1 -1
  40. package/dist/IconWrapper/IconWrapper.js +1 -1
  41. package/dist/IconWrapper/IconWrapper.js.map +1 -1
  42. package/dist/LabelledText/LabelledText.js +1 -1
  43. package/dist/LabelledText/LabelledText.js.map +1 -1
  44. package/dist/Link/Link.js +9 -11
  45. package/dist/Link/Link.js.map +1 -1
  46. package/dist/Loader/Loader.js +1 -1
  47. package/dist/Loader/Loader.js.map +1 -1
  48. package/dist/Logo/Logo.js +2 -2
  49. package/dist/Logo/Logo.js.map +1 -1
  50. package/dist/Modal/Modal.js +13 -12
  51. package/dist/Modal/Modal.js.map +1 -1
  52. package/dist/NumberInput/NumberInput.js +6 -5
  53. package/dist/NumberInput/NumberInput.js.map +1 -1
  54. package/dist/Pagination/Pagination.js +9 -4
  55. package/dist/Pagination/Pagination.js.map +1 -1
  56. package/dist/ProgressIndicator/ProgressIndicator.js +1 -1
  57. package/dist/ProgressIndicator/ProgressIndicator.js.map +1 -1
  58. package/dist/ProgressIndicator/components/StepItem.js +2 -2
  59. package/dist/ProgressIndicator/components/StepItem.js.map +1 -1
  60. package/dist/PromoCard/PromoCard.js +1 -1
  61. package/dist/PromoCard/PromoCard.js.map +1 -1
  62. package/dist/RadioGroup/RadioElement.js +2 -2
  63. package/dist/RadioGroup/RadioElement.js.map +1 -1
  64. package/dist/RadioGroup/RadioGroup.js +1 -1
  65. package/dist/RadioGroup/RadioGroup.js.map +1 -1
  66. package/dist/RadioGroup/RadioItem.js +22 -22
  67. package/dist/RadioGroup/RadioItem.js.map +1 -1
  68. package/dist/RadioGroup/types.js.map +1 -1
  69. package/dist/RichText/RichText.js +1 -1
  70. package/dist/RichText/RichText.js.map +1 -1
  71. package/dist/RichTextEditor/RichTextEditor.js +2 -2
  72. package/dist/RichTextEditor/RichTextEditor.js.map +1 -1
  73. package/dist/RichTextEditor/plugins/ToolbarPlugin.js +5 -4
  74. package/dist/RichTextEditor/plugins/ToolbarPlugin.js.map +1 -1
  75. package/dist/Row/Row.js +3 -3
  76. package/dist/Row/Row.js.map +1 -1
  77. package/dist/SearchInput/SearchInput.js +5 -2
  78. package/dist/SearchInput/SearchInput.js.map +1 -1
  79. package/dist/SearchInput/components/SearchOptions.js +4 -2
  80. package/dist/SearchInput/components/SearchOptions.js.map +1 -1
  81. package/dist/SegmentedControl/SegmentedControl.js +3 -3
  82. package/dist/SegmentedControl/SegmentedControl.js.map +1 -1
  83. package/dist/SegmentedControl/ToggleButton.js +1 -1
  84. package/dist/SegmentedControl/ToggleButton.js.map +1 -1
  85. package/dist/SliderInput/SliderInput.js +1 -1
  86. package/dist/SliderInput/SliderInput.js.map +1 -1
  87. package/dist/Snackbar/SnackbarContainer.js +1 -0
  88. package/dist/Snackbar/SnackbarContainer.js.map +1 -1
  89. package/dist/Snackbar/SnackbarItem.js +2 -2
  90. package/dist/Snackbar/SnackbarItem.js.map +1 -1
  91. package/dist/SupportMessage/SupportMessage.js +1 -1
  92. package/dist/SupportMessage/SupportMessage.js.map +1 -1
  93. package/dist/Table/Table.js +2 -2
  94. package/dist/Table/Table.js.map +1 -1
  95. package/dist/Table/components/RowActions.js +2 -2
  96. package/dist/Table/components/RowActions.js.map +1 -1
  97. package/dist/Table/components/TableHeader.js +2 -2
  98. package/dist/Table/components/TableHeader.js.map +1 -1
  99. package/dist/Table/components/TableRow.js +4 -4
  100. package/dist/Table/components/TableRow.js.map +1 -1
  101. package/dist/Table/components/commonComponents.d.ts +3 -3
  102. package/dist/Table/components/commonComponents.js +9 -9
  103. package/dist/Table/components/commonComponents.js.map +1 -1
  104. package/dist/Table/types.js.map +1 -1
  105. package/dist/Tag/Tag.js +2 -2
  106. package/dist/Tag/Tag.js.map +1 -1
  107. package/dist/Text/Text.js +1 -1
  108. package/dist/Text/Text.js.map +1 -1
  109. package/dist/TextDateOfBirthInput/TextDateOfBirthInput.d.ts +1 -1
  110. package/dist/TextDateOfBirthInput/TextDateOfBirthInput.js +3 -3
  111. package/dist/TextDateOfBirthInput/TextDateOfBirthInput.js.map +1 -1
  112. package/dist/TextInput/TextInput.js +4 -4
  113. package/dist/TextInput/TextInput.js.map +1 -1
  114. package/dist/Textarea/Textarea.js +1 -1
  115. package/dist/Textarea/Textarea.js.map +1 -1
  116. package/dist/ThemeProvider/utils/colourMap.d.ts +1 -1
  117. package/dist/Toggle/Toggle.js +2 -2
  118. package/dist/Toggle/Toggle.js.map +1 -1
  119. package/dist/Tooltip/Tooltip.d.ts +2 -2
  120. package/dist/Tooltip/Tooltip.js +7 -2
  121. package/dist/Tooltip/Tooltip.js.map +1 -1
  122. package/dist/beta/index.d.ts +1 -0
  123. package/dist/beta/index.js +1 -1
  124. package/dist/beta/index.js.map +1 -1
  125. package/dist/fields/components/CommonInput.d.ts +8 -8
  126. package/dist/fields/components/InternalField.js +2 -2
  127. package/dist/fields/components/InternalField.js.map +1 -1
  128. package/dist/sharedStyles/shared.styles.d.ts +2 -2
  129. package/dist/testUtils/index.d.ts +1 -1
  130. package/dist/utils/dateOfBirth/dateOfBirthValidator.utils.d.ts +4 -4
  131. package/dist/utils/focusOutline.js.map +1 -1
  132. package/dist/utils/space.d.ts +1 -1
  133. package/dist/utils/space.js.map +1 -1
  134. package/dist/utils/useWindowSize.js +1 -0
  135. package/dist/utils/useWindowSize.js.map +1 -1
  136. package/package.json +20 -24
@@ -1 +1 @@
1
- {"version":3,"file":"SupportMessage.js","sourceRoot":"","sources":["../../src/SupportMessage/SupportMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAE5B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,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,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;QAMtC,OAAO,IAAI,qBAAqB,MAAM,CAAC,GAAG,EAAE,gBAAgB,CAAC,GAAG;;GAErE,CACF,CAAA;AAED,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAA;;iBAEL,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;WACjC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI;;mBAE5B,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;CACnD,CAAA;AAED,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;;CAGjC,CAAA;AAED,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;CAG/B,CAAA","sourcesContent":["import { darken } from 'polished'\nimport { FC, MouseEventHandler, ReactElement } from 'react'\nimport styled, { css, useTheme } from 'styled-components'\n\nimport { Box } from '../Box'\n\nimport { Text } from '../Text'\nimport { theme as oldTheme } from '../theme'\nimport { isReactElement } from '../utils/isReactElement'\nimport { MarginProps } from '../utils/space'\nimport { NewColor, resolveToThemeColor } from '../ThemeProvider/utils/colourMap'\nimport { IconDefinition } from '@fortawesome/fontawesome-svg-core'\nimport {\n faCircleCheck,\n faCircleExclamation,\n faCircleInfo,\n faTriangleExclamation,\n} from '@awesome.me/kit-46ca99185c/icons/classic/regular'\nimport { IconContainer } from '../sharedStyles/shared.styles'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faChevronRight } from '@awesome.me/kit-46ca99185c/icons/classic/solid'\n\ntype StylesItem = {\n iconColor: NewColor\n backgroundColor: NewColor\n icon: IconDefinition\n}\n\nconst styles: Record<SupportMessageType, StylesItem> = {\n info: {\n iconColor: 'color.icon.base',\n backgroundColor: 'color.illustration.neutral.300',\n icon: faCircleInfo,\n },\n fallbackStyle: {\n iconColor: 'color.icon.base',\n backgroundColor: 'color.surface.base.100',\n icon: faCircleInfo,\n },\n alert: {\n iconColor: 'extended1.100',\n backgroundColor: 'color.feedback.notice.100',\n icon: faTriangleExclamation,\n },\n warning: {\n iconColor: 'color.feedback.negative.200',\n backgroundColor: 'color.feedback.negative.100',\n icon: faCircleExclamation,\n },\n success: {\n iconColor: 'color.feedback.positive.200',\n backgroundColor: 'color.feedback.positive.100',\n icon: faCircleCheck,\n },\n}\n\ntype SupportMessageType =\n | 'info'\n | 'fallbackStyle'\n | 'alert'\n | 'warning'\n | 'success'\n\nexport type SupportMessageProps = {\n className?: string\n description: string | ReactElement<any>\n onClick?: MouseEventHandler\n /**\n * Right side content, usually an icon or a button\n */\n rightSideComponent?: ReactElement<any>\n type: SupportMessageType\n title?: string\n} & MarginProps\n\nexport const SupportMessage: FC<SupportMessageProps> = ({\n className,\n description,\n onClick,\n rightSideComponent,\n type,\n title,\n ...marginProps\n}) => {\n const theme = useTheme()\n const resolveBackgroundColor = resolveToThemeColor(\n styles[type].backgroundColor,\n theme,\n )\n\n const resolvedIconColor = resolveToThemeColor(styles[type].iconColor, theme)\n\n return (\n <Wrapper\n className={className}\n $backgroundColor={resolveBackgroundColor}\n onClick={onClick}\n {...marginProps}\n >\n <IconContainer $size={20} style={{ alignSelf: 'flex-start' }}>\n <FontAwesomeIcon icon={styles[type].icon} color={resolvedIconColor} />\n </IconContainer>\n <Box flex direction=\"column\" mx=\"space.100\">\n {title && <Title>{title}</Title>}\n {isReactElement(description) ? (\n <DescriptionBox>{description}</DescriptionBox>\n ) : (\n <Description tag=\"p\">{description}</Description>\n )}\n </Box>\n {rightSideComponent}\n {onClick && rightSideComponent === undefined && (\n <Box ml={{ custom: 'auto' }}>\n <IconContainer $size={16}>\n <FontAwesomeIcon\n icon={faChevronRight}\n color={theme.color.illustration.neutral[400]}\n />\n </IconContainer>\n </Box>\n )}\n </Wrapper>\n )\n}\n\ninterface IWrapper {\n $backgroundColor: string\n onClick?: MouseEventHandler\n}\n\nconst Wrapper = styled(Box)<IWrapper>(\n ({ $backgroundColor, onClick }) => css`\n align-items: center;\n background-color: ${$backgroundColor};\n border-radius: 16px;\n ${onClick && `cursor: pointer`};\n padding: ${({ theme }) => theme.space[150]};\n display: flex;\n width: 100%;\n\n &:hover,\n &:active {\n ${onClick && `background-color: ${darken(0.1, $backgroundColor)};`};\n }\n `,\n)\n\nconst Title = styled.p`\n font-size: 16px;\n font-weight: ${oldTheme.font.weight.medium};\n color: ${({ theme }) => theme.color.text.base};\n line-height: 20.8px;\n margin-bottom: ${({ theme }) => theme.space['050']};\n`\n\nconst DescriptionBox = styled(Box)`\n font-size: 14px;\n line-height: 20px;\n`\n\nconst Description = styled(Text)`\n font-size: 14px;\n line-height: 20px;\n`\n"]}
1
+ {"version":3,"file":"SupportMessage.js","sourceRoot":"","sources":["../../src/SupportMessage/SupportMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAE5B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAY,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAEhF,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,GACtB,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,cAAc,EA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C,IAAI;;mBAE5B,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;CACnD,CAAA;AAED,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;;CAGjC,CAAA;AAED,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;CAG/B,CAAA","sourcesContent":["import { darken } from 'polished'\nimport { FC, MouseEventHandler, ReactElement } from 'react'\nimport styled, { css, useTheme } from 'styled-components'\n\nimport { Box } from '../Box'\n\nimport { Text } from '../Text'\nimport { theme as oldTheme } from '../theme'\nimport { isReactElement } from '../utils/isReactElement'\nimport { MarginProps } from '../utils/space'\nimport { NewColor, resolveToThemeColor } from '../ThemeProvider/utils/colourMap'\nimport { IconDefinition } from '@fortawesome/fontawesome-svg-core'\nimport {\n faCircleCheck,\n faCircleExclamation,\n faCircleInfo,\n faTriangleExclamation,\n} from '@awesome.me/kit-46ca99185c/icons/classic/regular'\nimport { IconContainer } from '../sharedStyles/shared.styles'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faChevronRight } from '@awesome.me/kit-46ca99185c/icons/classic/solid'\n\ntype StylesItem = {\n iconColor: NewColor\n backgroundColor: NewColor\n icon: IconDefinition\n}\n\nconst styles: Record<SupportMessageType, StylesItem> = {\n info: {\n iconColor: 'color.icon.base',\n backgroundColor: 'color.illustration.neutral.300',\n icon: faCircleInfo,\n },\n fallbackStyle: {\n iconColor: 'color.icon.base',\n backgroundColor: 'color.surface.base.100',\n icon: faCircleInfo,\n },\n alert: {\n iconColor: 'extended1.100',\n backgroundColor: 'color.feedback.notice.100',\n icon: faTriangleExclamation,\n },\n warning: {\n iconColor: 'color.feedback.negative.200',\n backgroundColor: 'color.feedback.negative.100',\n icon: faCircleExclamation,\n },\n success: {\n iconColor: 'color.feedback.positive.200',\n backgroundColor: 'color.feedback.positive.100',\n icon: faCircleCheck,\n },\n}\n\ntype SupportMessageType =\n 'info' | 'fallbackStyle' | 'alert' | 'warning' | 'success'\n\nexport type SupportMessageProps = {\n className?: string\n description: string | ReactElement<any>\n onClick?: MouseEventHandler\n /**\n * Right side content, usually an icon or a button\n */\n rightSideComponent?: ReactElement<any>\n type: SupportMessageType\n title?: string\n} & MarginProps\n\nexport const SupportMessage: FC<SupportMessageProps> = ({\n className,\n description,\n onClick,\n rightSideComponent,\n type,\n title,\n ...marginProps\n}) => {\n const theme = useTheme()\n const resolveBackgroundColor = resolveToThemeColor(\n styles[type].backgroundColor,\n theme,\n )\n\n const resolvedIconColor = resolveToThemeColor(styles[type].iconColor, theme)\n\n return (\n <Wrapper\n className={className}\n $backgroundColor={resolveBackgroundColor}\n onClick={onClick}\n {...marginProps}\n >\n <IconContainer $size={20} style={{ alignSelf: 'flex-start' }}>\n <FontAwesomeIcon icon={styles[type].icon} color={resolvedIconColor} />\n </IconContainer>\n <Box flex direction=\"column\" mx=\"space.100\">\n {title && <Title>{title}</Title>}\n {isReactElement(description) ? (\n <DescriptionBox>{description}</DescriptionBox>\n ) : (\n <Description tag=\"p\">{description}</Description>\n )}\n </Box>\n {rightSideComponent}\n {onClick && rightSideComponent === undefined && (\n <Box ml={{ custom: 'auto' }}>\n <IconContainer $size={16}>\n <FontAwesomeIcon\n icon={faChevronRight}\n color={theme.color.illustration.neutral[400]}\n />\n </IconContainer>\n </Box>\n )}\n </Wrapper>\n )\n}\n\ninterface IWrapper {\n $backgroundColor: string\n onClick?: MouseEventHandler\n}\n\nconst Wrapper = styled(Box)<IWrapper>(\n ({ $backgroundColor, onClick }) => css`\n align-items: center;\n background-color: ${$backgroundColor};\n border-radius: 16px;\n ${onClick && `cursor: pointer`};\n padding: ${({ theme }) => theme.space[150]};\n display: flex;\n width: 100%;\n\n &:hover,\n &:active {\n ${onClick && `background-color: ${darken(0.1, $backgroundColor)};`};\n }\n `,\n)\n\nconst Title = styled.p`\n font-size: 16px;\n font-weight: ${oldTheme.font.weight.medium};\n color: ${({ theme }) => theme.color.text.base};\n line-height: 20.8px;\n margin-bottom: ${({ theme }) => theme.space['050']};\n`\n\nconst DescriptionBox = styled(Box)`\n font-size: 14px;\n line-height: 20px;\n`\n\nconst Description = styled(Text)`\n font-size: 14px;\n line-height: 20px;\n`\n"]}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Text } from '../Text';
3
3
  import { TableHeader } from './components/TableHeader';
4
4
  import { TableRow } from './components/TableRow';
@@ -27,6 +27,6 @@ export const Table = ({ columns, data, fixedHeader = true, hasKeyline = false, e
27
27
  const resolvedHeaderColor = resolveToThemeColor(headerColor, theme);
28
28
  const showActionsCell = expandable ?? rowActions;
29
29
  const totalColumns = showActionsCell ? columns.length + 1 : columns.length;
30
- return (_jsxs(StyledTable, { "$roundedTable": roundedTable, children: [_jsx(TableColumnGroup, { widths: columnWidths, columnCount: totalColumns, setSubTableColumnWidths: setSubTableColumnWidths, shouldAlignSubTableColumns: alignSubTableColumns }), !hideTableHeader && (_jsx("thead", { children: _jsx(TableHeader, { columns: columns, fixedHeader: fixedHeader, headerHeight: headerHeight, headerColor: resolvedHeaderColor, rowActions: rowActions, columnPadding: columnPadding, expandable: expandable, hasKeyline: hasKeyline }) })), _jsxs("tbody", { children: [data.length === 0 && (_jsx("tr", { children: _jsx(StyledCell, { colSpan: totalColumns, "$rowPadding": rowPadding, "$columnPadding": columnPadding, children: noDataContent ?? _jsx(Text, { align: "center", children: "No available data" }) }) })), data.length !== 0 && (_jsxs(_Fragment, { children: [data.map((row, rowIndex) => (_jsx(TableRow, { rowData: row, rowIndex: rowIndex, columns: columns, rowActions: rowActions, stripedColor: stripedColor, subTable: subTable, renderSubTable: renderSubTable, subRows: subRows, rowColor: rowColor, rowBorderColor: rowBorderColor, rowPadding: rowPadding, columnPadding: columnPadding, expandable: expandable, clickableRow: clickableRow, hideBorder: Boolean(roundedTable) && rowIndex === data.length - 1 }, getRowKey ? getRowKey(row, rowIndex) : rowIndex))), footer && (_jsx(TableFooter, { columnCount: columns.length, footer: footer }))] }))] })] }));
30
+ return (_jsxs(StyledTable, { $roundedTable: roundedTable, children: [_jsx(TableColumnGroup, { widths: columnWidths, columnCount: totalColumns, setSubTableColumnWidths: setSubTableColumnWidths, shouldAlignSubTableColumns: alignSubTableColumns }), !hideTableHeader && (_jsx("thead", { children: _jsx(TableHeader, { columns: columns, fixedHeader: fixedHeader, headerHeight: headerHeight, headerColor: resolvedHeaderColor, rowActions: rowActions, columnPadding: columnPadding, expandable: expandable, hasKeyline: hasKeyline }) })), _jsxs("tbody", { children: [data.length === 0 && (_jsx("tr", { children: _jsx(StyledCell, { colSpan: totalColumns, $rowPadding: rowPadding, $columnPadding: columnPadding, children: noDataContent ?? _jsx(Text, { align: "center", children: "No available data" }) }) })), data.length !== 0 && (_jsxs(_Fragment, { children: [data.map((row, rowIndex) => (_jsx(TableRow, { rowData: row, rowIndex: rowIndex, columns: columns, rowActions: rowActions, stripedColor: stripedColor, subTable: subTable, renderSubTable: renderSubTable, subRows: subRows, rowColor: rowColor, rowBorderColor: rowBorderColor, rowPadding: rowPadding, columnPadding: columnPadding, expandable: expandable, clickableRow: clickableRow, hideBorder: Boolean(roundedTable) && rowIndex === data.length - 1 }, getRowKey ? getRowKey(row, rowIndex) : rowIndex))), footer && (_jsx(TableFooter, { columnCount: columns.length, footer: footer }))] }))] })] }));
31
31
  };
32
32
  //# sourceMappingURL=Table.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/Table/Table.tsx"],"names":[],"mappings":";AAAA,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,E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,MAAM,IAAI,CACT,KAAC,WAAW,IAAC,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAI,CAC7D,IACA,CACJ,IACK,IACI,CACf,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { Text } from '../Text'\nimport { TableHeader } from './components/TableHeader'\nimport { TableRow } from './components/TableRow'\nimport { StyledCell, StyledTable } from './components/commonComponents'\nimport { TableProps } from './types'\nimport { TableFooter } from './components/TableFooter'\nimport { useTheme } from 'styled-components'\nimport { resolveToThemeColor } from '../ThemeProvider/utils/colourMap'\nimport { TableColumnGroup } from './components/TableColumnGroup'\nimport { useAlignedSubTableColumns } from './hooks/useAlignedSubTableColumns'\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, K extends object>({\n columns,\n data,\n fixedHeader = true,\n hasKeyline = false,\n expandable,\n subTable,\n subRows,\n headerHeight,\n headerColor = 'color.surface.base.200',\n rowColor = 'color.surface.base.300',\n footer,\n stripedColor,\n rowBorderColor = 'color.illustration.neutral.300',\n rowActions,\n clickableRow,\n rowPadding,\n columnPadding,\n noDataContent,\n roundedTable,\n alignSubTableColumns = false,\n columnWidths,\n hideTableHeader = false,\n getRowKey,\n}: TableProps<T, K>) => {\n const theme = useTheme()\n const { renderSubTable, setSubTableColumnWidths } = useAlignedSubTableColumns(\n subTable,\n alignSubTableColumns,\n )\n\n const resolvedHeaderColor = resolveToThemeColor(headerColor, theme)\n\n const showActionsCell = expandable ?? rowActions\n const totalColumns = showActionsCell ? columns.length + 1 : columns.length\n\n return (\n <StyledTable $roundedTable={roundedTable}>\n <TableColumnGroup\n widths={columnWidths}\n columnCount={totalColumns}\n setSubTableColumnWidths={setSubTableColumnWidths}\n shouldAlignSubTableColumns={alignSubTableColumns}\n />\n {!hideTableHeader && (\n <thead>\n <TableHeader\n columns={columns}\n fixedHeader={fixedHeader}\n headerHeight={headerHeight}\n headerColor={resolvedHeaderColor}\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={totalColumns}\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 <>\n {data.map((row, rowIndex) => (\n <TableRow\n key={getRowKey ? getRowKey(row, rowIndex) : rowIndex}\n rowData={row}\n rowIndex={rowIndex}\n columns={columns}\n rowActions={rowActions}\n stripedColor={stripedColor}\n subTable={subTable}\n renderSubTable={renderSubTable}\n subRows={subRows}\n rowColor={rowColor}\n rowBorderColor={rowBorderColor}\n rowPadding={rowPadding}\n columnPadding={columnPadding}\n expandable={expandable}\n clickableRow={clickableRow}\n hideBorder={\n Boolean(roundedTable) && rowIndex === data.length - 1\n }\n />\n ))}\n\n {footer && (\n <TableFooter columnCount={columns.length} footer={footer} />\n )}\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,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;AAEvE,OAAO,EAAE,W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WAAW,IAAC,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAI,CAC7D,IACA,CACJ,IACK,IACI,CACf,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { Text } from '../Text'\nimport { TableHeader } from './components/TableHeader'\nimport { TableRow } from './components/TableRow'\nimport { StyledCell, StyledTable } from './components/commonComponents'\nimport { TableProps } from './types'\nimport { TableFooter } from './components/TableFooter'\nimport { useTheme } from 'styled-components'\nimport { resolveToThemeColor } from '../ThemeProvider/utils/colourMap'\nimport { TableColumnGroup } from './components/TableColumnGroup'\nimport { useAlignedSubTableColumns } from './hooks/useAlignedSubTableColumns'\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, K extends object>({\n columns,\n data,\n fixedHeader = true,\n hasKeyline = false,\n expandable,\n subTable,\n subRows,\n headerHeight,\n headerColor = 'color.surface.base.200',\n rowColor = 'color.surface.base.300',\n footer,\n stripedColor,\n rowBorderColor = 'color.illustration.neutral.300',\n rowActions,\n clickableRow,\n rowPadding,\n columnPadding,\n noDataContent,\n roundedTable,\n alignSubTableColumns = false,\n columnWidths,\n hideTableHeader = false,\n getRowKey,\n}: TableProps<T, K>) => {\n const theme = useTheme()\n const { renderSubTable, setSubTableColumnWidths } = useAlignedSubTableColumns(\n subTable,\n alignSubTableColumns,\n )\n\n const resolvedHeaderColor = resolveToThemeColor(headerColor, theme)\n\n const showActionsCell = expandable ?? rowActions\n const totalColumns = showActionsCell ? columns.length + 1 : columns.length\n\n return (\n <StyledTable $roundedTable={roundedTable}>\n <TableColumnGroup\n widths={columnWidths}\n columnCount={totalColumns}\n setSubTableColumnWidths={setSubTableColumnWidths}\n shouldAlignSubTableColumns={alignSubTableColumns}\n />\n {!hideTableHeader && (\n <thead>\n <TableHeader\n columns={columns}\n fixedHeader={fixedHeader}\n headerHeight={headerHeight}\n headerColor={resolvedHeaderColor}\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={totalColumns}\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 <>\n {data.map((row, rowIndex) => (\n <TableRow\n key={getRowKey ? getRowKey(row, rowIndex) : rowIndex}\n rowData={row}\n rowIndex={rowIndex}\n columns={columns}\n rowActions={rowActions}\n stripedColor={stripedColor}\n subTable={subTable}\n renderSubTable={renderSubTable}\n subRows={subRows}\n rowColor={rowColor}\n rowBorderColor={rowBorderColor}\n rowPadding={rowPadding}\n columnPadding={columnPadding}\n expandable={expandable}\n clickableRow={clickableRow}\n hideBorder={\n Boolean(roundedTable) && rowIndex === data.length - 1\n }\n />\n ))}\n\n {footer && (\n <TableFooter columnCount={columns.length} footer={footer} />\n )}\n </>\n )}\n </tbody>\n </StyledTable>\n )\n}\n"]}
@@ -18,7 +18,7 @@ export const RowActions = ({ rowData, rowActions, isExpanded, toggleExpansion, e
18
18
  const resolvedRowActionBgColor = rowActions?.bgColor
19
19
  ? resolveToThemeColor(rowActions.bgColor, theme)
20
20
  : undefined;
21
- return (_jsx(StyledCell, { "$stickyCell": Boolean(rowActions) || Boolean(expandable), "$rowActionsBgColor": resolvedRowActionBgColor, "$width": width, children: _jsxs(Box, { flex: true, alignItems: "center", justifyContent: "flex-end", children: [rowActions?.actions?.map((action, actionIndex) => {
21
+ return (_jsx(StyledCell, { $stickyCell: Boolean(rowActions) || Boolean(expandable), $rowActionsBgColor: resolvedRowActionBgColor, $width: width, children: _jsxs(Box, { flex: true, alignItems: "center", justifyContent: "flex-end", children: [rowActions?.actions?.map((action, actionIndex) => {
22
22
  if (!action.showCondition || action.showCondition(rowData)) {
23
23
  return (_jsxs(Wrapper, { flex: true, children: ['element' in action &&
24
24
  isReactElement(action.element) &&
@@ -36,7 +36,7 @@ export const RowActions = ({ rowData, rowActions, isExpanded, toggleExpansion, e
36
36
  }), canExpandRow && (_jsx(CaretIcon, { render: "caret", handleClick: (e) => {
37
37
  e.stopPropagation();
38
38
  toggleExpansion();
39
- }, size: 24, "$isOpen": isExpanded, iconColor: isExpanded ? 'color.surface.base.000' : 'color.icon.base', backgroundColor: isExpanded
39
+ }, size: 24, $isOpen: isExpanded, iconColor: isExpanded ? 'color.surface.base.000' : 'color.icon.base', backgroundColor: isExpanded
40
40
  ? 'color.surface.base.900'
41
41
  : 'color.illustration.neutral.300' }))] }) }));
42
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RowActions.js","sourceRoot":"","sources":["../../../src/Table/components/RowActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAa,MAAM,OAAO,CAAA;AAC/C,OAAO,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACpD,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;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,q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R,CAAC,CAAC,wBAAwB;wBAC1B,CAAC,CAAC,gCAAgC,GAEtC,CACH,IACG,GACK,CACd,CAAA;AACH,CAAC,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;kBAET,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;oBAG7B,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;;;;;MAK/C,iBAAiB;;CAEtB,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,CAClC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;iBACF,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc;;GAEzD,CACF,CAAA","sourcesContent":["import { cloneElement, FormEvent } from 'react'\nimport styled, { useTheme } 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'\nimport { resolveToThemeColor } from '../../ThemeProvider/utils/colourMap'\n\nexport const RowActions = <T extends object>({\n rowData,\n rowActions,\n isExpanded,\n toggleExpansion,\n expandable,\n width,\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 const theme = useTheme()\n\n const resolvedRowActionBgColor = rowActions?.bgColor\n ? resolveToThemeColor(rowActions.bgColor, theme)\n : undefined\n\n return (\n <StyledCell\n $stickyCell={Boolean(rowActions) || Boolean(expandable)}\n $rowActionsBgColor={resolvedRowActionBgColor}\n $width={width}\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 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={24}\n $isOpen={isExpanded}\n iconColor={\n isExpanded ? 'color.surface.base.000' : 'color.icon.base'\n }\n backgroundColor={\n isExpanded\n ? 'color.surface.base.900'\n : 'color.illustration.neutral.300'\n }\n />\n )}\n </Box>\n </StyledCell>\n )\n}\n\nconst Wrapper = styled(Box)`\n white-space: nowrap;\n margin-right: ${({ theme }) => theme.space[100]};\n\n &:last-child {\n margin-right: ${({ theme }) => theme.space['000']};\n }\n\n .reactElementRowAction {\n cursor: pointer;\n ${focusOutlineStyle}\n }\n`\n\nconst CaretIcon = styled(IconStrict)<{ $isOpen?: boolean }>(\n ({ $isOpen }) => `\n transform: ${$isOpen ? 'rotate(180deg)' : 'rotate(0deg)'};\n transition: transform 0.3s ease;\n `,\n)\n"]}
1
+ {"version":3,"file":"RowActions.js","sourceRoot":"","sources":["../../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,CACX,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,OACL,MAAM,CAAC,UAAU,EACrB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,GACxD,CACH,CAAC,KAtCa,WAAW,CAuCpB,CACX,CAAA;oBACH,CAAC;oBACD,OAAO,IAAI,CAAA;gBACb,CAAC,CAAC,EACD,YAAY,IAAI,CACf,KAAC,SAAS,IACR,MAAM,EAAC,OAAO,EACd,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;wBACjB,CAAC,CAAC,eAAe,EAAE,CAAA;wBACnB,eAAe,EAAE,CAAA;oBACnB,CAAC,EACD,IAAI,EAAE,EAAE,EACR,OAAO,EAAE,UAAU,EACnB,SAAS,EACP,UAAU,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,iBAAiB,EAE3D,eAAe,EACb,UAAU;wBACR,CAAC,CAAC,wBAAwB;wBAC1B,CAAC,CAAC,gCAAgC,GAEtC,CACH,IACG,GACK,CACd,CAAA;AACH,CAAC,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;kBAET,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;oBAG7B,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;;;;;MAK/C,iBAAiB;;CAEtB,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,CAClC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;iBACF,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc;;GAEzD,CACF,CAAA","sourcesContent":["import { cloneElement, FormEvent } from 'react'\nimport styled, { useTheme } 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'\nimport { resolveToThemeColor } from '../../ThemeProvider/utils/colourMap'\n\nexport const RowActions = <T extends object>({\n rowData,\n rowActions,\n isExpanded,\n toggleExpansion,\n expandable,\n width,\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 const theme = useTheme()\n\n const resolvedRowActionBgColor = rowActions?.bgColor\n ? resolveToThemeColor(rowActions.bgColor, theme)\n : undefined\n\n return (\n <StyledCell\n $stickyCell={Boolean(rowActions) || Boolean(expandable)}\n $rowActionsBgColor={resolvedRowActionBgColor}\n $width={width}\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 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={24}\n $isOpen={isExpanded}\n iconColor={\n isExpanded ? 'color.surface.base.000' : 'color.icon.base'\n }\n backgroundColor={\n isExpanded\n ? 'color.surface.base.900'\n : 'color.illustration.neutral.300'\n }\n />\n )}\n </Box>\n </StyledCell>\n )\n}\n\nconst Wrapper = styled(Box)`\n white-space: nowrap;\n margin-right: ${({ theme }) => theme.space[100]};\n\n &:last-child {\n margin-right: ${({ theme }) => theme.space['000']};\n }\n\n .reactElementRowAction {\n cursor: pointer;\n ${focusOutlineStyle}\n }\n`\n\nconst CaretIcon = styled(IconStrict)<{ $isOpen?: boolean }>(\n ({ $isOpen }) => `\n transform: ${$isOpen ? 'rotate(180deg)' : 'rotate(0deg)'};\n transition: transform 0.3s ease;\n `,\n)\n"]}
@@ -4,7 +4,7 @@ export const TableHeader = ({ columns, fixedHeader, headerColor, rowActions, hea
4
4
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
5
5
  const showActionsCell = expandable || rowActions;
6
6
  return (_jsxs(StyledRow, { children: [columns.map((column, columnIndex) => {
7
- return (_jsx(StyledHeaderCell, { "$fixedHeader": fixedHeader, "$headerHeight": headerHeight, "$minWidth": column.minWidth, "$maxWidth": column.maxWidth, "$headerColor": headerColor, "$columnPadding": columnPadding, "$hasKeyline": hasKeyline, children: column.name }, columnIndex));
8
- }), showActionsCell && (_jsx(StyledHeaderCell, { "$fixedHeader": fixedHeader, "$stickyCell": true, "$minWidth": rowActions?.minWidth, "$headerColor": headerColor, "$columnPadding": columnPadding, "$hasKeyline": hasKeyline, children: "Actions" }))] }));
7
+ return (_jsx(StyledHeaderCell, { $fixedHeader: fixedHeader, $headerHeight: headerHeight, $minWidth: column.minWidth, $maxWidth: column.maxWidth, $headerColor: headerColor, $columnPadding: columnPadding, $hasKeyline: hasKeyline, children: column.name }, columnIndex));
8
+ }), showActionsCell && (_jsx(StyledHeaderCell, { $fixedHeader: fixedHeader, $stickyCell: true, $minWidth: rowActions?.minWidth, $headerColor: headerColor, $columnPadding: columnPadding, $hasKeyline: hasKeyline, children: "Actions" }))] }));
9
9
  };
10
10
  //# sourceMappingURL=TableHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableHeader.js","sourceRoot":"","sources":["../../../src/Table/components/TableHeader.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEhE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAmB,EAC5C,OAAO,EACP,WAAW,EACX,WAAW,EACX,UAAU,EACV,YAAY,EACZ,aAAa,EACb,UAAU,EACV,UAAU,GACU,EAAE,EAAE;IACxB,wEAAwE;IACxE,MAAM,eAAe,GAAG,UAAU,IAAI,UAAU,CAAA;IAEhD,OAAO,CACL,MAAC,SAAS,eACP,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;gBACnC,OAAO,CACL,KAAC,gBAAgB,oBAED,WAAW,mBACV,YAAY,eAChB,MAAM,CAAC,QAAQ,eACf,MAAM,CAAC,QAAQ,kBACZ,WAAW,oBACT,aAAa,iBAChB,UAAU,YAEtB,MAAM,CAAC,IAAI,IATP,WAAW,CAUC,CACpB,CAAA;YACH,CAAC,CAAC,EACD,eAAe,IAAI,CAClB,KAAC,gBAAgB,oBACD,WAAW,iBACZ,IAAI,eACN,UAAU,EAAE,QAAQ,kBACjB,WAAW,oBACT,aAAa,iBAChB,UAAU,wBAGN,CACpB,IACS,CACb,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { TableHeaderProps } from '../types'\nimport { StyledHeaderCell, StyledRow } from './commonComponents'\n\nexport const TableHeader = <T extends object>({\n columns,\n fixedHeader,\n headerColor,\n rowActions,\n headerHeight,\n columnPadding,\n expandable,\n hasKeyline,\n}: TableHeaderProps<T>) => {\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const showActionsCell = expandable || rowActions\n\n return (\n <StyledRow>\n {columns.map((column, columnIndex) => {\n return (\n <StyledHeaderCell\n key={columnIndex}\n $fixedHeader={fixedHeader}\n $headerHeight={headerHeight}\n $minWidth={column.minWidth}\n $maxWidth={column.maxWidth}\n $headerColor={headerColor}\n $columnPadding={columnPadding}\n $hasKeyline={hasKeyline}\n >\n {column.name}\n </StyledHeaderCell>\n )\n })}\n {showActionsCell && (\n <StyledHeaderCell\n $fixedHeader={fixedHeader}\n $stickyCell={true}\n $minWidth={rowActions?.minWidth}\n $headerColor={headerColor}\n $columnPadding={columnPadding}\n $hasKeyline={hasKeyline}\n >\n Actions\n </StyledHeaderCell>\n )}\n </StyledRow>\n )\n}\n"]}
1
+ {"version":3,"file":"TableHeader.js","sourceRoot":"","sources":["../../../src/Table/components/TableHeader.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEhE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAmB,EAC5C,OAAO,EACP,WAAW,EACX,WAAW,EACX,UAAU,EACV,YAAY,EACZ,aAAa,EACb,UAAU,EACV,UAAU,GACU,EAAE,EAAE;IACxB,wEAAwE;IACxE,MAAM,eAAe,GAAG,UAAU,IAAI,UAAU,CAAA;IAEhD,OAAO,CACL,MAAC,SAAS,eACP,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;gBACnC,OAAO,CACL,KAAC,gBAAgB,IAEf,YAAY,EAAE,WAAW,EACzB,aAAa,EAAE,YAAY,EAC3B,SAAS,EAAE,MAAM,CAAC,QAAQ,EAC1B,SAAS,EAAE,MAAM,CAAC,QAAQ,EAC1B,YAAY,EAAE,WAAW,EACzB,cAAc,EAAE,aAAa,EAC7B,WAAW,EAAE,UAAU,YAEtB,MAAM,CAAC,IAAI,IATP,WAAW,CAUC,CACpB,CAAA;YACH,CAAC,CAAC,EACD,eAAe,IAAI,CAClB,KAAC,gBAAgB,IACf,YAAY,EAAE,WAAW,EACzB,WAAW,EAAE,IAAI,EACjB,SAAS,EAAE,UAAU,EAAE,QAAQ,EAC/B,YAAY,EAAE,WAAW,EACzB,cAAc,EAAE,aAAa,EAC7B,WAAW,EAAE,UAAU,wBAGN,CACpB,IACS,CACb,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { TableHeaderProps } from '../types'\nimport { StyledHeaderCell, StyledRow } from './commonComponents'\n\nexport const TableHeader = <T extends object>({\n columns,\n fixedHeader,\n headerColor,\n rowActions,\n headerHeight,\n columnPadding,\n expandable,\n hasKeyline,\n}: TableHeaderProps<T>) => {\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const showActionsCell = expandable || rowActions\n\n return (\n <StyledRow>\n {columns.map((column, columnIndex) => {\n return (\n <StyledHeaderCell\n key={columnIndex}\n $fixedHeader={fixedHeader}\n $headerHeight={headerHeight}\n $minWidth={column.minWidth}\n $maxWidth={column.maxWidth}\n $headerColor={headerColor}\n $columnPadding={columnPadding}\n $hasKeyline={hasKeyline}\n >\n {column.name}\n </StyledHeaderCell>\n )\n })}\n {showActionsCell && (\n <StyledHeaderCell\n $fixedHeader={fixedHeader}\n $stickyCell={true}\n $minWidth={rowActions?.minWidth}\n $headerColor={headerColor}\n $columnPadding={columnPadding}\n $hasKeyline={hasKeyline}\n >\n Actions\n </StyledHeaderCell>\n )}\n </StyledRow>\n )\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cloneElement, useState } from 'react';
3
3
  import { isReactElement } from '../../utils/isReactElement';
4
4
  import { isMappedReactElement } from '../helpers';
@@ -36,16 +36,16 @@ export const TableRow = ({ rowData, rowIndex, columns, subRows, subTable, stripe
36
36
  const showActionsCell = expandable ?? rowActions;
37
37
  const expandSubProp = showActionsCell ? columns.length + 1 : columns.length;
38
38
  const isExpandedRow = expandedRows.includes(rowIndex);
39
- return (_jsxs(_Fragment, { children: [_jsxs(StyledRow, { "$stripedColor": resolvedStripedColor, "$rowColor": resolvedRowColor, "$rowBorderColor": resolvedRowBorderColor, "$clickableRow": !!clickableRow, "$noRowBorderColor": isExpandedRow || hideBorder, onClick: () => clickableRow?.(rowData), tabIndex: clickableRow && 0, children: [columns.map((column, columnIndex) => {
39
+ return (_jsxs(_Fragment, { children: [_jsxs(StyledRow, { $stripedColor: resolvedStripedColor, $rowColor: resolvedRowColor, $rowBorderColor: resolvedRowBorderColor, $clickableRow: !!clickableRow, $noRowBorderColor: isExpandedRow || hideBorder, onClick: () => clickableRow?.(rowData), tabIndex: clickableRow && 0, children: [columns.map((column, columnIndex) => {
40
40
  let cellContent;
41
41
  if (column.cell) {
42
42
  cellContent = column.cell(rowData, rowIndex, column, rowIndex);
43
43
  }
44
- return (_jsx(StyledCell, { "$rowPadding": rowPadding, "$columnPadding": columnPadding, "$minWidth": column.minWidth, "$maxWidth": column.maxWidth, "$noWrapContent": column.noWrapContent, "$truncateContent": column.truncateContent, "$hideOverflow": column.hideOverflow, children: cellContent }, columnIndex));
44
+ return (_jsx(StyledCell, { $rowPadding: rowPadding, $columnPadding: columnPadding, $minWidth: column.minWidth, $maxWidth: column.maxWidth, $noWrapContent: column.noWrapContent, $truncateContent: column.truncateContent, $hideOverflow: column.hideOverflow, children: cellContent }, columnIndex));
45
45
  }), (showActionsCell ?? showActions) && (_jsx(RowActions, { canExpandRow: canExpandRow, rowActions: rowActions, rowData: rowData, isExpanded: isExpandedRow, toggleExpansion: () => toggleRowExpansion(rowIndex) }))] }), isExpandedRow && (_jsxs(_Fragment, { children: [subRowsData &&
46
46
  isReactElement(subRowsData) &&
47
47
  cloneElement(subRowsData, { rowPadding, columnPadding }), subRowsData &&
48
48
  isMappedReactElement(subRowsData) &&
49
- subRowsData.map((row) => cloneElement(row, { rowPadding, showActions: showActionsCell })), subTableData && (_jsx(StyledSubTableCell, { "$rowBorderColor": resolvedRowBorderColor, colSpan: expandSubProp, "$bgColor": resolvedSubBgColor, "$padding": subPadding, children: cloneElement(subTableData, { rowPadding, columnPadding }) }))] }))] }));
49
+ subRowsData.map((row) => cloneElement(row, { rowPadding, showActions: showActionsCell })), subTableData && (_jsx(StyledSubTableCell, { $rowBorderColor: resolvedRowBorderColor, colSpan: expandSubProp, $bgColor: resolvedSubBgColor, $padding: subPadding, children: cloneElement(subTableData, { rowPadding, columnPadding }) }))] }))] }));
50
50
  };
51
51
  //# sourceMappingURL=TableRow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableRow.js","sourceRoot":"","sources":["../../../src/Table/components/TableRow.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAA;AACzD,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;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AAEzE,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,cAAc,EACd,UAAU,GACO,EAAE,EAAE;IACrB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAA;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AAI,CAChB,8BACG,WAAW;wBACV,cAAc,CAAC,WAAW,CAAC;wBAC3B,YAAY,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,EAEzD,WAAW;wBACV,oBAAoB,CAAC,WAAW,CAAC;wBACjC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACtB,YAAY,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC,CAChE,EAEF,YAAY,IAAI,CACf,KAAC,kBAAkB,uBACA,sBAAsB,EACvC,OAAO,EAAE,aAAa,cACZ,kBAAkB,cAClB,UAAU,YAEnB,YAAY,CAAC,YAAY,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,GACvC,CACtB,IACA,CACJ,IACA,CACJ,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { 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'\nimport { useTheme } from 'styled-components'\nimport { resolveToThemeColor } from '../../ThemeProvider/utils/colourMap'\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 renderSubTable,\n hideBorder,\n}: TableRowProps<T>) => {\n const theme = useTheme()\n const [expandedRows, setExpandedRows] = useState<number[]>([])\n\n const resolvedRowColor = rowColor\n ? resolveToThemeColor(rowColor, theme)\n : undefined\n const resolvedStripedColor = stripedColor\n ? resolveToThemeColor(stripedColor, theme)\n : undefined\n const resolvedRowBorderColor = rowBorderColor\n ? resolveToThemeColor(rowBorderColor, theme)\n : undefined\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 = renderSubTable?.(rowData)\n\n const subPadding = subTable?.padding ?? subRows?.padding\n const subBgColor = subTable?.bgColor ?? subRows?.bgColor\n const resolvedSubBgColor = subBgColor\n ? resolveToThemeColor(subBgColor, theme)\n : undefined\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={resolvedStripedColor}\n $rowColor={resolvedRowColor}\n $rowBorderColor={resolvedRowBorderColor}\n $clickableRow={!!clickableRow}\n $noRowBorderColor={isExpandedRow || hideBorder}\n onClick={() => 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={resolvedRowBorderColor}\n colSpan={expandSubProp}\n $bgColor={resolvedSubBgColor}\n $padding={subPadding}\n >\n {cloneElement(subTableData, { rowPadding, columnPadding })}\n </StyledSubTableCell>\n )}\n </>\n )}\n </>\n )\n}\n"]}
1
+ {"version":3,"file":"TableRow.js","sourceRoot":"","sources":["../../../src/Table/components/TableRow.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAA;AACzD,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;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AAEzE,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,cAAc,EACd,UAAU,GACO,EAAE,EAAE;IACrB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAA;IAE9D,MAAM,gBAAgB,GAAG,QAAQ;QAC/B,CAAC,CAAC,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC;QACtC,CAAC,C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,QAAQ,CAAC,GACnD,CACH,IACS,EASX,aAAa,IAAI,CAChB,8BACG,WAAW;wBACV,cAAc,CAAC,WAAW,CAAC;wBAC3B,YAAY,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,EAEzD,WAAW;wBACV,oBAAoB,CAAC,WAAW,CAAC;wBACjC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACtB,YAAY,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC,CAChE,EAEF,YAAY,IAAI,CACf,KAAC,kBAAkB,IACjB,eAAe,EAAE,sBAAsB,EACvC,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,kBAAkB,EAC5B,QAAQ,EAAE,UAAU,YAEnB,YAAY,CAAC,YAAY,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,GACvC,CACtB,IACA,CACJ,IACA,CACJ,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { 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'\nimport { useTheme } from 'styled-components'\nimport { resolveToThemeColor } from '../../ThemeProvider/utils/colourMap'\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 renderSubTable,\n hideBorder,\n}: TableRowProps<T>) => {\n const theme = useTheme()\n const [expandedRows, setExpandedRows] = useState<number[]>([])\n\n const resolvedRowColor = rowColor\n ? resolveToThemeColor(rowColor, theme)\n : undefined\n const resolvedStripedColor = stripedColor\n ? resolveToThemeColor(stripedColor, theme)\n : undefined\n const resolvedRowBorderColor = rowBorderColor\n ? resolveToThemeColor(rowBorderColor, theme)\n : undefined\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 = renderSubTable?.(rowData)\n\n const subPadding = subTable?.padding ?? subRows?.padding\n const subBgColor = subTable?.bgColor ?? subRows?.bgColor\n const resolvedSubBgColor = subBgColor\n ? resolveToThemeColor(subBgColor, theme)\n : undefined\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={resolvedStripedColor}\n $rowColor={resolvedRowColor}\n $rowBorderColor={resolvedRowBorderColor}\n $clickableRow={!!clickableRow}\n $noRowBorderColor={isExpandedRow || hideBorder}\n onClick={() => 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={resolvedRowBorderColor}\n colSpan={expandSubProp}\n $bgColor={resolvedSubBgColor}\n $padding={subPadding}\n >\n {cloneElement(subTableData, { rowPadding, columnPadding })}\n </StyledSubTableCell>\n )}\n </>\n )}\n </>\n )\n}\n"]}
@@ -4,9 +4,9 @@ type StyledTableProps = {
4
4
  $roundedTable: TableProps<unknown>['roundedTable'];
5
5
  };
6
6
  export declare const StyledTable: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "$roundedTable"> & StyledTableProps, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "$roundedTable"> & StyledTableProps, never>>> & string;
7
- export declare const StyledHeaderCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "$width" | "$maxWidth" | "$minWidth" | "$headerHeight" | "$fixedHeader" | "$hasKeyline" | "$stripedColor" | "$headerColor" | "$rowColor" | "$rowBorderColor" | "$clickableRow" | "$rowPadding" | "$columnPadding" | "$stickyCell" | "$rowActionsBgColor" | "$noWrapContent" | "$truncateContent" | "$hideOverflow" | "$noRowBorderColor"> & TransientProps<TableStylesProps>, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "$width" | "$maxWidth" | "$minWidth" | "$headerHeight" | "$fixedHeader" | "$hasKeyline" | "$stripedColor" | "$headerColor" | "$rowColor" | "$rowBorderColor" | "$clickableRow" | "$rowPadding" | "$columnPadding" | "$stickyCell" | "$rowActionsBgColor" | "$noWrapContent" | "$truncateContent" | "$hideOverflow" | "$noRowBorderColor"> & TransientProps<TableStylesProps>, never>>> & string;
8
- export declare const StyledCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "$width" | "$maxWidth" | "$minWidth" | "$headerHeight" | "$fixedHeader" | "$hasKeyline" | "$stripedColor" | "$headerColor" | "$rowColor" | "$rowBorderColor" | "$clickableRow" | "$rowPadding" | "$columnPadding" | "$stickyCell" | "$rowActionsBgColor" | "$noWrapContent" | "$truncateContent" | "$hideOverflow" | "$noRowBorderColor"> & TransientProps<TableStylesProps>, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "$width" | "$maxWidth" | "$minWidth" | "$headerHeight" | "$fixedHeader" | "$hasKeyline" | "$stripedColor" | "$headerColor" | "$rowColor" | "$rowBorderColor" | "$clickableRow" | "$rowPadding" | "$columnPadding" | "$stickyCell" | "$rowActionsBgColor" | "$noWrapContent" | "$truncateContent" | "$hideOverflow" | "$noRowBorderColor"> & TransientProps<TableStylesProps>, never>>> & string;
9
- export declare const StyledRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "$width" | "$maxWidth" | "$minWidth" | "$headerHeight" | "$fixedHeader" | "$hasKeyline" | "$stripedColor" | "$headerColor" | "$rowColor" | "$rowBorderColor" | "$clickableRow" | "$rowPadding" | "$columnPadding" | "$stickyCell" | "$rowActionsBgColor" | "$noWrapContent" | "$truncateContent" | "$hideOverflow" | "$noRowBorderColor"> & TransientProps<TableStylesProps>, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "$width" | "$maxWidth" | "$minWidth" | "$headerHeight" | "$fixedHeader" | "$hasKeyline" | "$stripedColor" | "$headerColor" | "$rowColor" | "$rowBorderColor" | "$clickableRow" | "$rowPadding" | "$columnPadding" | "$stickyCell" | "$rowActionsBgColor" | "$noWrapContent" | "$truncateContent" | "$hideOverflow" | "$noRowBorderColor"> & TransientProps<TableStylesProps>, never>>> & string;
7
+ export declare const StyledHeaderCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "$clickableRow" | "$columnPadding" | "$fixedHeader" | "$hasKeyline" | "$headerColor" | "$headerHeight" | "$hideOverflow" | "$maxWidth" | "$minWidth" | "$noRowBorderColor" | "$noWrapContent" | "$rowActionsBgColor" | "$rowBorderColor" | "$rowColor" | "$rowPadding" | "$stickyCell" | "$stripedColor" | "$truncateContent" | "$width"> & TransientProps<TableStylesProps>, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "$clickableRow" | "$columnPadding" | "$fixedHeader" | "$hasKeyline" | "$headerColor" | "$headerHeight" | "$hideOverflow" | "$maxWidth" | "$minWidth" | "$noRowBorderColor" | "$noWrapContent" | "$rowActionsBgColor" | "$rowBorderColor" | "$rowColor" | "$rowPadding" | "$stickyCell" | "$stripedColor" | "$truncateContent" | "$width"> & TransientProps<TableStylesProps>, never>>> & string;
8
+ export declare const StyledCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "$clickableRow" | "$columnPadding" | "$fixedHeader" | "$hasKeyline" | "$headerColor" | "$headerHeight" | "$hideOverflow" | "$maxWidth" | "$minWidth" | "$noRowBorderColor" | "$noWrapContent" | "$rowActionsBgColor" | "$rowBorderColor" | "$rowColor" | "$rowPadding" | "$stickyCell" | "$stripedColor" | "$truncateContent" | "$width"> & TransientProps<TableStylesProps>, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "$clickableRow" | "$columnPadding" | "$fixedHeader" | "$hasKeyline" | "$headerColor" | "$headerHeight" | "$hideOverflow" | "$maxWidth" | "$minWidth" | "$noRowBorderColor" | "$noWrapContent" | "$rowActionsBgColor" | "$rowBorderColor" | "$rowColor" | "$rowPadding" | "$stickyCell" | "$stripedColor" | "$truncateContent" | "$width"> & TransientProps<TableStylesProps>, never>>> & string;
9
+ export declare const StyledRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "$clickableRow" | "$columnPadding" | "$fixedHeader" | "$hasKeyline" | "$headerColor" | "$headerHeight" | "$hideOverflow" | "$maxWidth" | "$minWidth" | "$noRowBorderColor" | "$noWrapContent" | "$rowActionsBgColor" | "$rowBorderColor" | "$rowColor" | "$rowPadding" | "$stickyCell" | "$stripedColor" | "$truncateContent" | "$width"> & TransientProps<TableStylesProps>, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "$clickableRow" | "$columnPadding" | "$fixedHeader" | "$hasKeyline" | "$headerColor" | "$headerHeight" | "$hideOverflow" | "$maxWidth" | "$minWidth" | "$noRowBorderColor" | "$noWrapContent" | "$rowActionsBgColor" | "$rowBorderColor" | "$rowColor" | "$rowPadding" | "$stickyCell" | "$stripedColor" | "$truncateContent" | "$width"> & TransientProps<TableStylesProps>, never>>> & string;
10
10
  type StyledSubTableCellProps = {
11
11
  $bgColor?: string;
12
12
  $padding?: string | undefined;
@@ -120,15 +120,15 @@ export const StyledRow = styled.tr `
120
120
 
121
121
  ${({ $clickableRow, $rowColor, theme }) => $clickableRow &&
122
122
  css `
123
- cursor: pointer;
124
- &:hover {
125
- background: ${darken(0.1, $rowColor ?? theme.color.surface.base[300])};
126
- }
127
- &:focus-visible {
128
- ${focusOutlineStyle}
129
- background: ${darken(0.1, $rowColor ?? theme.color.surface.base[300])};
130
- }
131
- `}
123
+ cursor: pointer;
124
+ &:hover {
125
+ background: ${darken(0.1, $rowColor ?? theme.color.surface.base[300])};
126
+ }
127
+ &:focus-visible {
128
+ ${focusOutlineStyle}
129
+ background: ${darken(0.1, $rowColor ?? theme.color.surface.base[300])};
130
+ }
131
+ `}
132
132
  `;
133
133
  export const StyledSubTableCell = styled.td `
134
134
  padding: ${({ $padding }) => $padding ?? '12px 0'};
@@ -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,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,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CA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AA","sourcesContent":["import { darken } from 'polished'\nimport styled, { css } from 'styled-components'\nimport { TransientProps } from '../../utils/utilTypes'\nimport { fontStyleMapping } from '../../Text/fontMapping'\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 }) => theme.color.surface.base[100]};\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 }) => theme.color.surface.base[100]};\n border-bottom: ${({ $hasKeyline, theme }) =>\n $hasKeyline ? `1px solid ${theme.color.surface.base[900]}` : '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: ${({ theme }) => theme.space[100]};\n padding-right: ${({ theme }) => theme.space[100]};\n padding-top: ${({ theme }) => theme.space[100]};\n padding-bottom: ${({ theme }) => theme.space[100]};\n\n ${({ $headerColor }) =>\n $headerColor &&\n css`\n background: ${$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: ${({ $columnPadding }) => $columnPadding ?? '8px'};\n padding-right: ${({ $columnPadding }) => $columnPadding ?? '8px'};\n padding-top: ${({ $rowPadding }) => $rowPadding ?? '8px'};\n padding-bottom: ${({ $rowPadding }) => $rowPadding ?? '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 ${({ $maxWidth }) =>\n $maxWidth &&\n css`\n max-width: ${$maxWidth};\n `}\n\n ${({ $rowActionsBgColor }) =>\n $rowActionsBgColor &&\n css`\n background: ${$rowActionsBgColor};\n `}\n`\n\nexport const StyledRow = styled.tr<TransientProps<TableStylesProps>>`\n background: ${({ theme }) => theme.color.surface.base[300]};\n\n ${({ $rowBorderColor, $noRowBorderColor }) =>\n $rowBorderColor &&\n !$noRowBorderColor &&\n css`\n border-bottom: 1px solid ${$rowBorderColor};\n `}\n\n ${({ $rowColor }) =>\n $rowColor &&\n css`\n background: ${$rowColor};\n `}\n\n ${({ $stripedColor }) =>\n $stripedColor &&\n css`\n &:nth-child(even) {\n background: ${$stripedColor};\n }\n `}\n\n ${({ $clickableRow, $rowColor, theme }) =>\n $clickableRow &&\n css`\n cursor: pointer;\n &:hover {\n background: ${darken(0.1, $rowColor ?? theme.color.surface.base[300])};\n }\n &:focus-visible {\n ${focusOutlineStyle}\n background: ${darken(0.1, $rowColor ?? theme.color.surface.base[300])};\n }\n `}\n`\n\ntype StyledSubTableCellProps = {\n $bgColor?: string\n $padding?: string | undefined\n $rowBorderColor?: string\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 ${$rowBorderColor};\n `}\n\n ${({ $bgColor }) => $bgColor && `background-color: ${$bgColor};`}\n`\n\nexport const StyledSubInnerCell = styled.div<StyledSubInnerCellProps>`\n padding: ${({ $padding }) => $padding ?? '12px 0'};\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,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,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;;;IAGxD,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CACtB,aAAa;IACb,GAAG,CAAA;uBACgB,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM;;KAElE;CACJ,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,EAAE,CAAkC;gBAC3D,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;mBACzC,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE,CAC1C,WAAW,CAA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,EAAE,EAAE,EAAE,CACxC,aAAa;IACb,GAAG,CAAA;;;wBAGe,MAAM,CAAC,GAAG,EAAE,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;;YAGnE,iBAAiB;wBACL,MAAM,CAAC,GAAG,EAAE,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;OAExE;CACN,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,eAAe;KAC3C;;IAED,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,IAAI,qBAAqB,QAAQ,GAAG;CACjE,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 { 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 }) => theme.color.surface.base[100]};\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 }) => theme.color.surface.base[100]};\n border-bottom: ${({ $hasKeyline, theme }) =>\n $hasKeyline ? `1px solid ${theme.color.surface.base[900]}` : '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: ${({ theme }) => theme.space[100]};\n padding-right: ${({ theme }) => theme.space[100]};\n padding-top: ${({ theme }) => theme.space[100]};\n padding-bottom: ${({ theme }) => theme.space[100]};\n\n ${({ $headerColor }) =>\n $headerColor &&\n css`\n background: ${$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: ${({ $columnPadding }) => $columnPadding ?? '8px'};\n padding-right: ${({ $columnPadding }) => $columnPadding ?? '8px'};\n padding-top: ${({ $rowPadding }) => $rowPadding ?? '8px'};\n padding-bottom: ${({ $rowPadding }) => $rowPadding ?? '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 ${({ $maxWidth }) =>\n $maxWidth &&\n css`\n max-width: ${$maxWidth};\n `}\n\n ${({ $rowActionsBgColor }) =>\n $rowActionsBgColor &&\n css`\n background: ${$rowActionsBgColor};\n `}\n`\n\nexport const StyledRow = styled.tr<TransientProps<TableStylesProps>>`\n background: ${({ theme }) => theme.color.surface.base[300]};\n\n ${({ $rowBorderColor, $noRowBorderColor }) =>\n $rowBorderColor &&\n !$noRowBorderColor &&\n css`\n border-bottom: 1px solid ${$rowBorderColor};\n `}\n\n ${({ $rowColor }) =>\n $rowColor &&\n css`\n background: ${$rowColor};\n `}\n\n ${({ $stripedColor }) =>\n $stripedColor &&\n css`\n &:nth-child(even) {\n background: ${$stripedColor};\n }\n `}\n\n ${({ $clickableRow, $rowColor, theme }) =>\n $clickableRow &&\n css`\n cursor: pointer;\n &:hover {\n background: ${darken(0.1, $rowColor ?? theme.color.surface.base[300])};\n }\n &:focus-visible {\n ${focusOutlineStyle}\n background: ${darken(0.1, $rowColor ?? theme.color.surface.base[300])};\n }\n `}\n`\n\ntype StyledSubTableCellProps = {\n $bgColor?: string\n $padding?: string | undefined\n $rowBorderColor?: string\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 ${$rowBorderColor};\n `}\n\n ${({ $bgColor }) => $bgColor && `background-color: ${$bgColor};`}\n`\n\nexport const StyledSubInnerCell = styled.div<StyledSubInnerCellProps>`\n padding: ${({ $padding }) => $padding ?? '12px 0'};\n`\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/Table/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactElement, ReactNode } from 'react'\nimport { ButtonProps } from '../Button/Button'\nimport { IconStrictProps } from '../IconStrict'\nimport type { BoxSpacing, SingleSpacing } from './helper.types'\nimport { ColorTypes } from '../ThemeProvider/utils/colourMap'\n\nexport type TableStylesProps = {\n hasKeyline?: boolean\n fixedHeader?: boolean\n headerHeight?: string\n stripedColor?: string\n stickyCell?: boolean\n headerColor?: string\n rowColor?: string\n rowBorderColor?: string\n rowActionsBgColor?: string\n width?: string\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?: ColorTypes\n}\n\ntype RowCellRenderer<T> = (\n row: T,\n rowIndex: number,\n column: TableColumn<T>,\n id: string | number,\n) => ReactNode\n\nexport interface TableColumn<T> {\n name?: string | number | 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?: ColorTypes\n padding?: BoxSpacing\n margin?: BoxSpacing\n}\n\n/** @template T - The type of data the table displays. */\ninterface CommonTableProps<T, ColorT = ColorTypes> {\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?: ColorT\n /** A function to determine if a row is expandable. */\n expandable?: (rowData: T) => boolean\n /** The color for the table header. */\n headerColor?: ColorT\n /** The default color for each table row. */\n rowColor?: ColorT\n /** The default color for each table row border. */\n rowBorderColor?: ColorT\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\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?: SingleSpacing\n /** The X padding for each row. */\n columnPadding?: SingleSpacing\n /** Hides the table header. Table defaults to always showing the header. */\n hideTableHeader?: boolean\n}\n\n/**\n * Type for each table row's data object.\n **/\nexport type TableRowData = {\n /**\n * Optionally include a unique `rowKey` for stable React keys.\n * If omitted, row index is used, which may cause issues if rows move.\n */\n rowKey?: React.Key\n}\n\nexport interface TableProps<T, K = undefined> extends CommonTableProps<T> {\n /** Array of data to be displayed in the table. */\n data: T[]\n\n /** Callback to derive a stable React key for each row. Falls back to row index if not provided. */\n getRowKey?: (row: T, index: number) => React.Key\n\n /** If true, the sub table columns will be aligned with the main table columns, by using the widths of the main table columns. */\n alignSubTableColumns?: boolean\n\n /** The widths of the table columns to be set to, usually passed down to a subtable to align to the main table columns.\n * The array length should match the number of columns in the table.\n * @example ['100px', '200px', '150px']\n */\n columnWidths?: string[]\n\n footer?: TableFooter<K>\n\n /** The text to show when there is no available data to map through. */\n noDataContent?: ReactNode\n}\n\n/**\n * The type of the footer prop in the Table component.\n * It can either be an array of columns and data, or a React element.\n *\n * For columns, the columns and data will be passed to each column.cell component to generate the footer.\n * For a React element, it will render that as the table footer.\n */\nexport type TableFooter<K> =\n | TableFooterColumnsProps<K>\n | TableFooterElementProps<K>\n\nexport interface TableRowProps<T> extends CommonTableProps<T> {\n rowData: T\n rowIndex: number\n showActions?: boolean\n hideBorder?: boolean\n\n renderSubTable?: (rowData: T) => ReactElement<any>\n}\n\nexport interface RowActionsProps<T> extends Pick<\n CommonTableProps<T, string>,\n 'expandable' | 'rowActions'\n> {\n rowData: T\n width?: string\n canExpandRow: boolean\n toggleExpansion: () => void\n isExpanded?: boolean\n}\n\ntype TableFooterElementProps<K> = {\n element: ReactElement<K>\n}\n\ntype TableFooterColumnsProps<K> = {\n /**\n * Row color of the footer.\n *\n * @default 'custard'\n */\n rowColor?: ColorTypes\n rowPadding?: SingleSpacing\n columnPadding?: SingleSpacing\n columns: TableColumn<K>[]\n data: K\n}\n\nexport type TableHeaderProps<T> = CommonTableProps<T, string>\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/Table/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactElement, ReactNode } from 'react'\nimport { ButtonProps } from '../Button/Button'\nimport { IconStrictProps } from '../IconStrict'\nimport type { BoxSpacing, SingleSpacing } from './helper.types'\nimport { ColorTypes } from '../ThemeProvider/utils/colourMap'\n\nexport type TableStylesProps = {\n hasKeyline?: boolean\n fixedHeader?: boolean\n headerHeight?: string\n stripedColor?: string\n stickyCell?: boolean\n headerColor?: string\n rowColor?: string\n rowBorderColor?: string\n rowActionsBgColor?: string\n width?: string\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> | 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?: ColorTypes\n}\n\ntype RowCellRenderer<T> = (\n row: T,\n rowIndex: number,\n column: TableColumn<T>,\n id: string | number,\n) => ReactNode\n\nexport interface TableColumn<T> {\n name?: string | number | 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?: ColorTypes\n padding?: BoxSpacing\n margin?: BoxSpacing\n}\n\n/** @template T - The type of data the table displays. */\ninterface CommonTableProps<T, ColorT = ColorTypes> {\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?: ColorT\n /** A function to determine if a row is expandable. */\n expandable?: (rowData: T) => boolean\n /** The color for the table header. */\n headerColor?: ColorT\n /** The default color for each table row. */\n rowColor?: ColorT\n /** The default color for each table row border. */\n rowBorderColor?: ColorT\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\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?: SingleSpacing\n /** The X padding for each row. */\n columnPadding?: SingleSpacing\n /** Hides the table header. Table defaults to always showing the header. */\n hideTableHeader?: boolean\n}\n\n/**\n * Type for each table row's data object.\n **/\nexport type TableRowData = {\n /**\n * Optionally include a unique `rowKey` for stable React keys.\n * If omitted, row index is used, which may cause issues if rows move.\n */\n rowKey?: React.Key\n}\n\nexport interface TableProps<T, K = undefined> extends CommonTableProps<T> {\n /** Array of data to be displayed in the table. */\n data: T[]\n\n /** Callback to derive a stable React key for each row. Falls back to row index if not provided. */\n getRowKey?: (row: T, index: number) => React.Key\n\n /** If true, the sub table columns will be aligned with the main table columns, by using the widths of the main table columns. */\n alignSubTableColumns?: boolean\n\n /** The widths of the table columns to be set to, usually passed down to a subtable to align to the main table columns.\n * The array length should match the number of columns in the table.\n * @example ['100px', '200px', '150px']\n */\n columnWidths?: string[]\n\n footer?: TableFooter<K>\n\n /** The text to show when there is no available data to map through. */\n noDataContent?: ReactNode\n}\n\n/**\n * The type of the footer prop in the Table component.\n * It can either be an array of columns and data, or a React element.\n *\n * For columns, the columns and data will be passed to each column.cell component to generate the footer.\n * For a React element, it will render that as the table footer.\n */\nexport type TableFooter<K> =\n TableFooterColumnsProps<K> | TableFooterElementProps<K>\n\nexport interface TableRowProps<T> extends CommonTableProps<T> {\n rowData: T\n rowIndex: number\n showActions?: boolean\n hideBorder?: boolean\n\n renderSubTable?: (rowData: T) => ReactElement<any>\n}\n\nexport interface RowActionsProps<T> extends Pick<\n CommonTableProps<T, string>,\n 'expandable' | 'rowActions'\n> {\n rowData: T\n width?: string\n canExpandRow: boolean\n toggleExpansion: () => void\n isExpanded?: boolean\n}\n\ntype TableFooterElementProps<K> = {\n element: ReactElement<K>\n}\n\ntype TableFooterColumnsProps<K> = {\n /**\n * Row color of the footer.\n *\n * @default 'custard'\n */\n rowColor?: ColorTypes\n rowPadding?: SingleSpacing\n columnPadding?: SingleSpacing\n columns: TableColumn<K>[]\n data: K\n}\n\nexport type TableHeaderProps<T> = CommonTableProps<T, string>\n"]}
package/dist/Tag/Tag.js CHANGED
@@ -9,8 +9,8 @@ export const Tag = ({ label, color, borderColor, bgColor, className, icon, iconC
9
9
  const theme = useTheme();
10
10
  const resolvedBGColor = resolveToThemeColor(bgColor, theme);
11
11
  const resolvedBorderColor = borderColor && resolveToThemeColor(borderColor, theme);
12
- const iconToRender = iconComponent ? (_jsx(IconContainer, { "$size": 16, style: { paddingRight: '4px' }, children: iconComponent })) : icon ? (_jsx(TagIcon, { render: icon, color: iconColor, size: 16, "data-testid": `tag-icon-${icon}` })) : null;
13
- return (_jsxs(Wrapper, { "$bgColor": resolvedBGColor, className: className, "$borderColor": resolvedBorderColor, ...marginProps, alignContent: "center", justifyContent: "center", onClick: onClick, children: [iconToRender, _jsx(TagText, { tag: "span", typo: "label", color: getColorPath(color), children: label })] }));
12
+ const iconToRender = iconComponent ? (_jsx(IconContainer, { $size: 16, style: { paddingRight: '4px' }, children: iconComponent })) : icon ? (_jsx(TagIcon, { render: icon, color: iconColor, size: 16, "data-testid": `tag-icon-${icon}` })) : null;
13
+ return (_jsxs(Wrapper, { $bgColor: resolvedBGColor, className: className, $borderColor: resolvedBorderColor, ...marginProps, alignContent: "center", justifyContent: "center", onClick: onClick, children: [iconToRender, _jsx(TagText, { tag: "span", typo: "label", color: getColorPath(color), children: label })] }));
14
14
  };
15
15
  const Wrapper = styled(Box) `
16
16
  background-color: ${({ $bgColor }) => $bgColor};
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../src/Tag/Tag.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAIpD,OAAO,EAAE,GAAG,EAAE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CAAC,YACxD,KAAK,GACE,IACF,CACX,CAAA;AACH,CAAC,CAAA;AAOD,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAc;sBACnB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ;YACpC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,YAAY,IAAI,aAAa,YAAY,EAAE;;;;;;;;;CAS5E,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;;;;;CAO3B,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;mBACT,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;CACnD,CAAA","sourcesContent":["import { FC, ReactNode } from 'react'\nimport styled, { useTheme } from 'styled-components'\nimport { MarginProps } from '../utils/space'\n\nimport { TransientProps } from '../utils/utilTypes'\nimport { Box } from '../Box'\nimport { Text } from '../Text'\nimport { Icon, Icons } from '../Icon'\nimport {\n ColorTypes,\n getColorPath,\n resolveToThemeColor,\n} from '../ThemeProvider/utils/colourMap'\nimport { IconContainer } from '../sharedStyles/shared.styles'\n\nexport type TagProps = {\n label: string\n color: ColorTypes\n bgColor: ColorTypes\n borderColor?: ColorTypes\n className?: string\n icon?: Icons\n iconComponent?: ReactNode\n iconColor?: ColorTypes\n onClick?: () => void\n} & MarginProps\n\nexport const Tag: FC<TagProps> = ({\n label,\n color,\n borderColor,\n bgColor,\n className,\n icon,\n iconComponent,\n iconColor,\n onClick,\n ...marginProps\n}) => {\n const theme = useTheme()\n\n const resolvedBGColor = resolveToThemeColor(bgColor, theme)\n const resolvedBorderColor =\n borderColor && resolveToThemeColor(borderColor, theme)\n\n const iconToRender = iconComponent ? (\n <IconContainer $size={16} style={{ paddingRight: '4px' }}>\n {iconComponent}\n </IconContainer>\n ) : icon ? (\n <TagIcon\n render={icon}\n color={iconColor}\n size={16}\n data-testid={`tag-icon-${icon}`}\n />\n ) : null\n\n return (\n <Wrapper\n $bgColor={resolvedBGColor}\n className={className}\n $borderColor={resolvedBorderColor}\n {...marginProps}\n alignContent=\"center\"\n justifyContent=\"center\"\n onClick={onClick}\n >\n {iconToRender}\n <TagText tag=\"span\" typo=\"label\" color={getColorPath(color)}>\n {label}\n </TagText>\n </Wrapper>\n )\n}\n\ntype WrapperProps = TransientProps<{\n bgColor: string\n borderColor?: string\n}>\n\nconst Wrapper = styled(Box)<WrapperProps>`\n background-color: ${({ $bgColor }) => $bgColor};\n border: ${({ $borderColor }) => $borderColor && `1px solid ${$borderColor}`};\n\n border-radius: 6px;\n padding: 4px 8px;\n\n height: 22px;\n\n box-sizing: border-box;\n display: inline-flex;\n`\n\nconst TagText = styled(Text)`\n display: flex;\n align-items: center;\n font-size: 10px;\n font-weight: 500;\n line-height: 12px;\n text-transform: uppercase;\n`\n\nconst TagIcon = styled(Icon)`\n padding-right: ${({ theme }) => theme.space['050']};\n`\n"]}
1
+ {"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../src/Tag/Tag.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAIpD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAS,MAAM,SAAS,CAAA;AACrC,OAAO,EAEL,YAAY,EACZ,mBAAmB,GACpB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAc7D,MAAM,CAAC,MAAM,GAAG,GAAiB,CAAC,EAChC,KAAK,EACL,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,IAAI,EACJ,aAAa,EACb,SAAS,EACT,OAAO,EACP,GAAG,WAAW,EACf,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,QAAQ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EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;CACnD,CAAA","sourcesContent":["import { FC, ReactNode } from 'react'\nimport styled, { useTheme } from 'styled-components'\nimport { MarginProps } from '../utils/space'\n\nimport { TransientProps } from '../utils/utilTypes'\nimport { Box } from '../Box'\nimport { Text } from '../Text'\nimport { Icon, Icons } from '../Icon'\nimport {\n ColorTypes,\n getColorPath,\n resolveToThemeColor,\n} from '../ThemeProvider/utils/colourMap'\nimport { IconContainer } from '../sharedStyles/shared.styles'\n\nexport type TagProps = {\n label: string\n color: ColorTypes\n bgColor: ColorTypes\n borderColor?: ColorTypes\n className?: string\n icon?: Icons\n iconComponent?: ReactNode\n iconColor?: ColorTypes\n onClick?: () => void\n} & MarginProps\n\nexport const Tag: FC<TagProps> = ({\n label,\n color,\n borderColor,\n bgColor,\n className,\n icon,\n iconComponent,\n iconColor,\n onClick,\n ...marginProps\n}) => {\n const theme = useTheme()\n\n const resolvedBGColor = resolveToThemeColor(bgColor, theme)\n const resolvedBorderColor =\n borderColor && resolveToThemeColor(borderColor, theme)\n\n const iconToRender = iconComponent ? (\n <IconContainer $size={16} style={{ paddingRight: '4px' }}>\n {iconComponent}\n </IconContainer>\n ) : icon ? (\n <TagIcon\n render={icon}\n color={iconColor}\n size={16}\n data-testid={`tag-icon-${icon}`}\n />\n ) : null\n\n return (\n <Wrapper\n $bgColor={resolvedBGColor}\n className={className}\n $borderColor={resolvedBorderColor}\n {...marginProps}\n alignContent=\"center\"\n justifyContent=\"center\"\n onClick={onClick}\n >\n {iconToRender}\n <TagText tag=\"span\" typo=\"label\" color={getColorPath(color)}>\n {label}\n </TagText>\n </Wrapper>\n )\n}\n\ntype WrapperProps = TransientProps<{\n bgColor: string\n borderColor?: string\n}>\n\nconst Wrapper = styled(Box)<WrapperProps>`\n background-color: ${({ $bgColor }) => $bgColor};\n border: ${({ $borderColor }) => $borderColor && `1px solid ${$borderColor}`};\n\n border-radius: 6px;\n padding: 4px 8px;\n\n height: 22px;\n\n box-sizing: border-box;\n display: inline-flex;\n`\n\nconst TagText = styled(Text)`\n display: flex;\n align-items: center;\n font-size: 10px;\n font-weight: 500;\n line-height: 12px;\n text-transform: uppercase;\n`\n\nconst TagIcon = styled(Icon)`\n padding-right: ${({ theme }) => theme.space['050']};\n`\n"]}
package/dist/Text/Text.js CHANGED
@@ -8,7 +8,7 @@ import { resolveToThemeColor, } from '../ThemeProvider/utils/colourMap';
8
8
  export const Text = forwardRef(({ children, typo = 'body-regular', className = '', tag = 'p', align = 'left', color = 'color.text.base', cursor = 'inherit', title = '', ...props }, ref) => {
9
9
  const theme = useTheme();
10
10
  const resolvedColor = resolveToThemeColor(color, theme);
11
- return (_jsx(Container, { forwardedAs: tag, className: className, "$typo": typo, "$align": align, "$color": resolvedColor, cursor: cursor, title: title, ...props, ref: ref, children: children }));
11
+ return (_jsx(Container, { forwardedAs: tag, className: className, $typo: typo, $align: align, $color: resolvedColor, cursor: cursor, title: title, ...props, ref: ref, children: children }));
12
12
  });
13
13
  Text.displayName = 'Text';
14
14
  const isTypo = (value) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/Text/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAkC,MAAM,OAAO,CAAA;AACtE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAEL,mBAAmB,GACpB,MAAM,kCAAkC,CAAA;AAuCzC,MAAM,CAAC,MAAM,IAAI,GAAkB,UAAU,CAC3C,CACE,EACE,QAAQ,EACR,IAAI,GAAG,cAAc,EACrB,SAAS,GAAG,EAAE,EACd,GAAG,GAAG,GAAG,EACT,KAAK,GAAG,MAAM,EACd,KAAK,GAAG,iBAAiB,EACzB,MAAM,GAAG,SAAS,EAClB,KAAK,GAAG,EAAE,EACV,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MAAM,aAAa,GAAG,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAEvD,OAAO,CACL,KAAC,SAAS,IACR,WAAW,EAAE,GAAG,EAChB,SAAS,EAAE,SAAS,WACb,IAAI,YACH,KAAK,YACL,aAAa,EACrB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,KACR,KAAK,EACT,GAAG,EAAE,GAAG,YAEP,QAAQ,GACC,CACb,CAAA;AACH,CAAC,CACF,CAAA;AAED,IAAI,CAAC,WAAW,GAAG,MAAM,CAAA;AAEzB,MAAM,MAAM,GAAG,CAAC,KAAa,EAAiB,EAAE;IAC9C,OAAO,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AACtD,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAC3B,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;MAGvC,MAAM,CAAC,KAAK,CAAC,IAAI,gBAAgB,CAAC,KAAK,CAAC;;kBAE5B,MAAM;cACV,OAAO;aACR,MAAM;MACb,iBAAiB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;GACvC,CACF,CAAA","sourcesContent":["import { FC, forwardRef, LabelHTMLAttributes, ReactNode } from 'react'\nimport styled, { css, useTheme } from 'styled-components'\n\nimport { Box } from '../Box'\nimport { linkStyleOverride } from '../Link/Link'\nimport { MarginProps } from '../utils/space'\nimport { fontStyleMapping } from './fontMapping'\nimport {\n ColorTypes,\n resolveToThemeColor,\n} from '../ThemeProvider/utils/colourMap'\ninterface IText {\n /** typography class name to apply predefined styles */\n $typo: string\n /** text-align */\n $align: string\n /** color from the theme */\n $color: ColorTypes\n $cursor: string\n}\n\nexport type Typo =\n | 'hero-alternate'\n | 'hero'\n | 'heading-alternate'\n | 'heading-large'\n | 'heading-medium'\n | 'heading-small'\n | 'headline-regular'\n | 'headline-small'\n | 'body-standfirst'\n | 'body-regular'\n | 'body-small'\n | 'caption'\n | 'label'\n\ntype Props = {\n children: ReactNode\n tag?: any\n className?: string\n typo?: Typo\n align?: string\n color?: ColorTypes\n cursor?: string\n title?: string\n} & MarginProps\n\nexport type TextProps = Props & Omit<LabelHTMLAttributes<HTMLElement>, 'color'>\n\nexport const Text: FC<TextProps> = forwardRef<HTMLElement, TextProps>(\n (\n {\n children,\n typo = 'body-regular',\n className = '',\n tag = 'p',\n align = 'left',\n color = 'color.text.base',\n cursor = 'inherit',\n title = '',\n ...props\n },\n ref,\n ) => {\n const theme = useTheme()\n const resolvedColor = resolveToThemeColor(color, theme)\n\n return (\n <Container\n forwardedAs={tag}\n className={className}\n $typo={typo}\n $align={align}\n $color={resolvedColor}\n cursor={cursor}\n title={title}\n {...props}\n ref={ref}\n >\n {children}\n </Container>\n )\n },\n)\n\nText.displayName = 'Text'\n\nconst isTypo = (value: string): value is Typo => {\n return Object.keys(fontStyleMapping).includes(value)\n}\n\nconst Container = styled(Box)<IText>(\n ({ $align, $color, $cursor, $typo }) => css`\n /** TYPOGRAPHY STYLES */\n\n ${isTypo($typo) && fontStyleMapping[$typo]}\n\n text-align: ${$align};\n cursor: ${$cursor};\n color: ${$color};\n ${linkStyleOverride({ color: $color })}\n `,\n)\n"]}
1
+ {"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/Text/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAkC,MAAM,OAAO,CAAA;AACtE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,mBAAmB,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,MAAM,CAAC,KAAK,CAAC,IAAI,gBAAgB,CAAC,KAAK,CAAC;;kBAE5B,MAAM;cACV,OAAO;aACR,MAAM;MACb,iBAAiB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;GACvC,CACF,CAAA","sourcesContent":["import { FC, forwardRef, LabelHTMLAttributes, ReactNode } from 'react'\nimport styled, { css, useTheme } from 'styled-components'\n\nimport { Box } from '../Box'\nimport { linkStyleOverride } from '../Link/Link'\nimport { MarginProps } from '../utils/space'\nimport { fontStyleMapping } from './fontMapping'\nimport {\n ColorTypes,\n resolveToThemeColor,\n} from '../ThemeProvider/utils/colourMap'\ninterface IText {\n /** typography class name to apply predefined styles */\n $typo: string\n /** text-align */\n $align: string\n /** color from the theme */\n $color: ColorTypes\n $cursor: string\n}\n\nexport type Typo =\n | 'hero-alternate'\n | 'hero'\n | 'heading-alternate'\n | 'heading-large'\n | 'heading-medium'\n | 'heading-small'\n | 'headline-regular'\n | 'headline-small'\n | 'body-standfirst'\n | 'body-regular'\n | 'body-small'\n | 'caption'\n | 'label'\n\ntype Props = {\n children: ReactNode\n tag?: any\n className?: string\n typo?: Typo\n align?: string\n color?: ColorTypes\n cursor?: string\n title?: string\n} & MarginProps\n\nexport type TextProps = Props & Omit<LabelHTMLAttributes<HTMLElement>, 'color'>\n\nexport const Text: FC<TextProps> = forwardRef<HTMLElement, TextProps>(\n (\n {\n children,\n typo = 'body-regular',\n className = '',\n tag = 'p',\n align = 'left',\n color = 'color.text.base',\n cursor = 'inherit',\n title = '',\n ...props\n },\n ref,\n ) => {\n const theme = useTheme()\n const resolvedColor = resolveToThemeColor(color, theme)\n\n return (\n <Container\n forwardedAs={tag}\n className={className}\n $typo={typo}\n $align={align}\n $color={resolvedColor}\n cursor={cursor}\n title={title}\n {...props}\n ref={ref}\n >\n {children}\n </Container>\n )\n },\n)\n\nText.displayName = 'Text'\n\nconst isTypo = (value: string): value is Typo => {\n return Object.keys(fontStyleMapping).includes(value)\n}\n\nconst Container = styled(Box)<IText>(\n ({ $align, $color, $cursor, $typo }) => css`\n /** TYPOGRAPHY STYLES */\n\n ${isTypo($typo) && fontStyleMapping[$typo]}\n\n text-align: ${$align};\n cursor: ${$cursor};\n color: ${$color};\n ${linkStyleOverride({ color: $color })}\n `,\n)\n"]}
@@ -32,4 +32,4 @@ export declare const TextDateOfBirthInput: import("react").ForwardRefExoticCompo
32
32
  message?: string;
33
33
  };
34
34
  dataTestId?: string;
35
- } & Pick<FieldsetProps, "label" | "assistiveText"> & import("react").RefAttributes<HTMLInputElement>>;
35
+ } & Pick<FieldsetProps, "assistiveText" | "label"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -52,11 +52,11 @@ export const TextDateOfBirthInput = forwardRef(function TextDateOfBirthInput({ o
52
52
  year: numericValue,
53
53
  });
54
54
  };
55
- return (_jsx(Fieldset, { label: label, assistiveText: assistiveText, completed: showCompleted && Boolean(value.day && value.month && value.year), error: Boolean(hookformError), errorMsg: hookformError?.message, "data-testid": dataTestId, children: _jsxs(Box, { flex: true, gap: "space.200", children: [_jsx(SetWidthTextInput, { ref: ref, label: "day", autoCompleteAttr: "bday-day", inputModeAttr: "numeric", "$width": 60, value: value.day || '', placeholder: "", onChange: handleDayChange, error: Boolean(hookformError?.type?.includes('day') ||
55
+ return (_jsx(Fieldset, { label: label, assistiveText: assistiveText, completed: showCompleted && Boolean(value.day && value.month && value.year), error: Boolean(hookformError), errorMsg: hookformError?.message, "data-testid": dataTestId, children: _jsxs(Box, { flex: true, gap: "space.200", children: [_jsx(SetWidthTextInput, { ref: ref, label: "day", autoCompleteAttr: "bday-day", inputModeAttr: "numeric", $width: 60, value: value.day || '', placeholder: "", onChange: handleDayChange, error: Boolean(hookformError?.type?.includes('day') ||
56
56
  (hookformError?.type &&
57
- inputValidationErrorValues.includes(hookformError.type))) }), _jsx(SetWidthTextInput, { ref: monthRef, label: "month", autoCompleteAttr: "bday-month", inputModeAttr: "numeric", "$width": 60, value: value.month || '', placeholder: "", onChange: handleMonthChange, error: Boolean(hookformError?.type?.includes('month') ||
57
+ inputValidationErrorValues.includes(hookformError.type))) }), _jsx(SetWidthTextInput, { ref: monthRef, label: "month", autoCompleteAttr: "bday-month", inputModeAttr: "numeric", $width: 60, value: value.month || '', placeholder: "", onChange: handleMonthChange, error: Boolean(hookformError?.type?.includes('month') ||
58
58
  (hookformError?.type &&
59
- inputValidationErrorValues.includes(hookformError.type))) }), _jsx(SetWidthTextInput, { ref: yearRef, label: "year", autoCompleteAttr: "bday-year", inputModeAttr: "numeric", "$width": 80, value: value.year || '', placeholder: "", onChange: handleYearChange, error: Boolean(hookformError?.type?.includes('year') ||
59
+ inputValidationErrorValues.includes(hookformError.type))) }), _jsx(SetWidthTextInput, { ref: yearRef, label: "year", autoCompleteAttr: "bday-year", inputModeAttr: "numeric", $width: 80, value: value.year || '', placeholder: "", onChange: handleYearChange, error: Boolean(hookformError?.type?.includes('year') ||
60
60
  (hookformError?.type &&
61
61
  inputValidationErrorValues.includes(hookformError.type))) })] }) }));
62
62
  });
@@ -1 +1 @@
1
- {"version":3,"file":"TextDateOfBirthInput.js","sourceRoot":"","sources":["../../src/TextDateOfBirthInput/TextDateOfBirthInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAiB,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAmBlE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAG5C,SAAS,oBAAoB,CAC7B,EACE,QAAQ,EACR,KAAK,EACL,KAAK,EACL,aAAa,EACb,aAAa,EACb,aAAa,GAAG,K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C,IAA4B,CAC3C,CAAC,CACL,GACD,EACF,KAAC,iBAAiB,IAChB,GAAG,EAAE,OAAO,EACZ,KAAK,EAAC,MAAM,EACZ,gBAAgB,EAAC,WAAW,EAC5B,aAAa,EAAC,SAAS,YACf,EAAE,EACV,KAAK,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,EACvB,WAAW,EAAC,EAAE,EACd,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,OAAO,CACZ,aAAa,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC;wBACrC,CAAC,aAAa,EAAE,IAAI;4BAClB,0BAA0B,CAAC,QAAQ,CACjC,aAAa,CAAC,IAA4B,CAC3C,CAAC,CACL,GACD,IACE,GACG,CACZ,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,CAAoB;WACpD,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,IAAI;CACvC,CAAA","sourcesContent":["import { forwardRef, useRef } from 'react'\nimport styled from 'styled-components'\n\nimport { Box } from '../Box'\nimport { Fieldset, FieldsetProps } from '../fields/Fieldset'\nimport { TextInput } from '../TextInput'\nimport { InputValidationError } from '../utils/dateOfBirth/schema'\n\nexport type DateObject = {\n day?: string | null\n month?: string | null\n year?: string | null\n}\n\nexport type TextDateOfBirthInputProps = {\n value: DateObject\n onChange: (value: DateObject) => void\n showCompleted?: boolean\n hookformError?: {\n type: string\n message?: string\n }\n dataTestId?: string\n} & Pick<FieldsetProps, 'label' | 'assistiveText'>\n\n/**\n * Renders a set of input fields to collect a date of birth as separate day, month,\n * and year fields.\n *\n * ### Date of birth input validations\n * - All fields are present and correctly formatted.\n * - The age is at least 17 years old.\n * - The year is not before 1900.\n */\nexport const TextDateOfBirthInput = forwardRef<\n HTMLInputElement,\n TextDateOfBirthInputProps\n>(function TextDateOfBirthInput(\n {\n onChange,\n value,\n label,\n assistiveText,\n hookformError,\n showCompleted = false,\n dataTestId,\n },\n ref,\n) {\n const inputValidationErrorValues = Object.values(InputValidationError)\n const monthRef = useRef<HTMLInputElement>(null)\n const yearRef = useRef<HTMLInputElement>(null)\n\n const filterNonNumeric = (value: string) => value.replace(/[^0-9]/g, '')\n\n const handleDayChange = (day: string) => {\n const numericValue = filterNonNumeric(day)\n\n if (numericValue.length > 2) return\n\n onChange({\n ...value,\n day: numericValue,\n })\n if (numericValue.length === 2) {\n monthRef.current?.focus()\n }\n }\n\n const handleMonthChange = (month: string) => {\n const numericValue = filterNonNumeric(month)\n\n if (numericValue.length > 2) return\n\n onChange({\n ...value,\n month: numericValue,\n })\n if (numericValue.length === 2) {\n yearRef.current?.focus()\n }\n }\n\n const handleYearChange = (year: string) => {\n const numericValue = filterNonNumeric(year)\n\n if (numericValue.length > 4) return\n\n onChange({\n ...value,\n year: numericValue,\n })\n }\n\n return (\n <Fieldset\n label={label}\n assistiveText={assistiveText}\n completed={\n showCompleted && Boolean(value.day && value.month && value.year)\n }\n error={Boolean(hookformError)}\n errorMsg={hookformError?.message}\n data-testid={dataTestId}\n >\n <Box flex gap=\"space.200\">\n <SetWidthTextInput\n ref={ref}\n label=\"day\"\n autoCompleteAttr=\"bday-day\"\n inputModeAttr=\"numeric\"\n $width={60}\n value={value.day || ''}\n placeholder=\"\"\n onChange={handleDayChange}\n error={Boolean(\n hookformError?.type?.includes('day') ||\n (hookformError?.type &&\n inputValidationErrorValues.includes(\n hookformError.type as InputValidationError,\n )),\n )}\n />\n <SetWidthTextInput\n ref={monthRef}\n label=\"month\"\n autoCompleteAttr=\"bday-month\"\n inputModeAttr=\"numeric\"\n $width={60}\n value={value.month || ''}\n placeholder=\"\"\n onChange={handleMonthChange}\n error={Boolean(\n hookformError?.type?.includes('month') ||\n (hookformError?.type &&\n inputValidationErrorValues.includes(\n hookformError.type as InputValidationError,\n )),\n )}\n />\n <SetWidthTextInput\n ref={yearRef}\n label=\"year\"\n autoCompleteAttr=\"bday-year\"\n inputModeAttr=\"numeric\"\n $width={80}\n value={value.year || ''}\n placeholder=\"\"\n onChange={handleYearChange}\n error={Boolean(\n hookformError?.type?.includes('year') ||\n (hookformError?.type &&\n inputValidationErrorValues.includes(\n hookformError.type as InputValidationError,\n )),\n )}\n />\n </Box>\n </Fieldset>\n )\n})\n\nconst SetWidthTextInput = styled(TextInput)<{ $width: number }>`\n width: ${({ $width }) => `${$width}px`};\n`\n"]}
1
+ {"version":3,"file":"TextDateOfBirthInput.js","sourceRoot":"","sources":["../../src/TextDateOfBirthInput/TextDateOfBirthInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAiB,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAmBlE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAG5C,SAAS,oBAAoB,CAC7B,EACE,QAAQ,EACR,KAAK,EACL,KAAK,EACL,aAAa,EACb,aAAa,EACb,aAAa,GAAG,KAAK,EACrB,UAAU,GACX,EACD,GAAG;IAEH,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAA;IACtE,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAA;IAC/C,MAAM,OAAO,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAA;IAE9C,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;IAExE,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE;QACtC,MAAM,YA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C,aAAa,EAAE,IAAI;4BAClB,0BAA0B,CAAC,QAAQ,CACjC,aAAa,CAAC,IAA4B,CAC3C,CAAC,CACL,GACD,IACE,GACG,CACZ,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,CAAoB;WACpD,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,IAAI;CACvC,CAAA","sourcesContent":["import { forwardRef, useRef } from 'react'\nimport styled from 'styled-components'\n\nimport { Box } from '../Box'\nimport { Fieldset, FieldsetProps } from '../fields/Fieldset'\nimport { TextInput } from '../TextInput'\nimport { InputValidationError } from '../utils/dateOfBirth/schema'\n\nexport type DateObject = {\n day?: string | null\n month?: string | null\n year?: string | null\n}\n\nexport type TextDateOfBirthInputProps = {\n value: DateObject\n onChange: (value: DateObject) => void\n showCompleted?: boolean\n hookformError?: {\n type: string\n message?: string\n }\n dataTestId?: string\n} & Pick<FieldsetProps, 'label' | 'assistiveText'>\n\n/**\n * Renders a set of input fields to collect a date of birth as separate day, month,\n * and year fields.\n *\n * ### Date of birth input validations\n * - All fields are present and correctly formatted.\n * - The age is at least 17 years old.\n * - The year is not before 1900.\n */\nexport const TextDateOfBirthInput = forwardRef<\n HTMLInputElement,\n TextDateOfBirthInputProps\n>(function TextDateOfBirthInput(\n {\n onChange,\n value,\n label,\n assistiveText,\n hookformError,\n showCompleted = false,\n dataTestId,\n },\n ref,\n) {\n const inputValidationErrorValues = Object.values(InputValidationError)\n const monthRef = useRef<HTMLInputElement>(null)\n const yearRef = useRef<HTMLInputElement>(null)\n\n const filterNonNumeric = (value: string) => value.replace(/[^0-9]/g, '')\n\n const handleDayChange = (day: string) => {\n const numericValue = filterNonNumeric(day)\n\n if (numericValue.length > 2) return\n\n onChange({\n ...value,\n day: numericValue,\n })\n if (numericValue.length === 2) {\n monthRef.current?.focus()\n }\n }\n\n const handleMonthChange = (month: string) => {\n const numericValue = filterNonNumeric(month)\n\n if (numericValue.length > 2) return\n\n onChange({\n ...value,\n month: numericValue,\n })\n if (numericValue.length === 2) {\n yearRef.current?.focus()\n }\n }\n\n const handleYearChange = (year: string) => {\n const numericValue = filterNonNumeric(year)\n\n if (numericValue.length > 4) return\n\n onChange({\n ...value,\n year: numericValue,\n })\n }\n\n return (\n <Fieldset\n label={label}\n assistiveText={assistiveText}\n completed={\n showCompleted && Boolean(value.day && value.month && value.year)\n }\n error={Boolean(hookformError)}\n errorMsg={hookformError?.message}\n data-testid={dataTestId}\n >\n <Box flex gap=\"space.200\">\n <SetWidthTextInput\n ref={ref}\n label=\"day\"\n autoCompleteAttr=\"bday-day\"\n inputModeAttr=\"numeric\"\n $width={60}\n value={value.day || ''}\n placeholder=\"\"\n onChange={handleDayChange}\n error={Boolean(\n hookformError?.type?.includes('day') ||\n (hookformError?.type &&\n inputValidationErrorValues.includes(\n hookformError.type as InputValidationError,\n )),\n )}\n />\n <SetWidthTextInput\n ref={monthRef}\n label=\"month\"\n autoCompleteAttr=\"bday-month\"\n inputModeAttr=\"numeric\"\n $width={60}\n value={value.month || ''}\n placeholder=\"\"\n onChange={handleMonthChange}\n error={Boolean(\n hookformError?.type?.includes('month') ||\n (hookformError?.type &&\n inputValidationErrorValues.includes(\n hookformError.type as InputValidationError,\n )),\n )}\n />\n <SetWidthTextInput\n ref={yearRef}\n label=\"year\"\n autoCompleteAttr=\"bday-year\"\n inputModeAttr=\"numeric\"\n $width={80}\n value={value.year || ''}\n placeholder=\"\"\n onChange={handleYearChange}\n error={Boolean(\n hookformError?.type?.includes('year') ||\n (hookformError?.type &&\n inputValidationErrorValues.includes(\n hookformError.type as InputValidationError,\n )),\n )}\n />\n </Box>\n </Fieldset>\n )\n})\n\nconst SetWidthTextInput = styled(TextInput)<{ $width: number }>`\n width: ${({ $width }) => `${$width}px`};\n`\n"]}
@@ -21,11 +21,11 @@ export const TextInput = forwardRef(function TextInput({ id: idProp, type = 'tex
21
21
  onAutoFill();
22
22
  }
23
23
  };
24
- const frontIconToRender = frontIconComponent ? (_jsx(InputLeadingIconContainer, { "$size": 20, "$iconColor": theme.color.text.subtle, children: frontIconComponent })) : frontIcon ? (_jsx(StyledFrontIcon, { "$disabled": disabled, render: frontIcon, color: "color.icon.base" })) : null;
25
- const trailingIconToRender = trailingIconComponent ? (_jsx(InputLeadingIconContainer, { "$size": 20, "$iconColor": theme.color.text.subtle, children: trailingIconComponent })) : trailingIcon ? (_jsx(StyledTrailingIcon, { "$disabled": disabled, render: trailingIcon, color: "color.icon.base" })) : null;
26
- return (_jsx(Field, { ...fieldProps, htmlFor: id, error: error, children: _jsxs(Box, { flex: true, alignItems: "center", justifyContent: "flex-start", children: [frontIconToRender && frontIconToRender, _jsx(Input, { disabled: disabled, type: type, id: id, name: name, ref: ref, onAnimationEnd: handleAnimationEnd, placeholder: placeholder, value: value, "$error": error, "$frontIcon": Boolean(frontIconToRender), "$fallbackStyle": fallbackStyle, autoComplete: autoCompleteAttr, onChange: (e) => {
24
+ const frontIconToRender = frontIconComponent ? (_jsx(InputLeadingIconContainer, { $size: 20, $iconColor: theme.color.text.subtle, children: frontIconComponent })) : frontIcon ? (_jsx(StyledFrontIcon, { $disabled: disabled, render: frontIcon, color: "color.icon.base" })) : null;
25
+ const trailingIconToRender = trailingIconComponent ? (_jsx(InputLeadingIconContainer, { $size: 20, $iconColor: theme.color.text.subtle, children: trailingIconComponent })) : trailingIcon ? (_jsx(StyledTrailingIcon, { $disabled: disabled, render: trailingIcon, color: "color.icon.base" })) : null;
26
+ return (_jsx(Field, { ...fieldProps, htmlFor: id, error: error, children: _jsxs(Box, { flex: true, alignItems: "center", justifyContent: "flex-start", children: [frontIconToRender, _jsx(Input, { disabled: disabled, type: type, id: id, name: name, ref: ref, onAnimationEnd: handleAnimationEnd, placeholder: placeholder, value: value, $error: error, $frontIcon: Boolean(frontIconToRender), $fallbackStyle: fallbackStyle, autoComplete: autoCompleteAttr, onChange: (e) => {
27
27
  onChange?.(e.currentTarget.value);
28
28
  onInputChange?.(e);
29
- }, onBlur: onBlur, inputMode: inputModeAttr }), trailingIconToRender && trailingIconToRender] }) }));
29
+ }, onBlur: onBlur, inputMode: inputModeAttr }), trailingIconToRender] }) }));
30
30
  });
31
31
  //# sourceMappingURL=TextInput.js.map