@veeqo/ui 11.0.0 → 11.2.0

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 (69) hide show
  1. package/dist/components/DataGrid/DataGrid.cjs +17 -3
  2. package/dist/components/DataGrid/DataGrid.cjs.map +1 -1
  3. package/dist/components/DataGrid/DataGrid.d.ts +1 -1
  4. package/dist/components/DataGrid/DataGrid.js +17 -3
  5. package/dist/components/DataGrid/DataGrid.js.map +1 -1
  6. package/dist/components/DataGrid/components/Body/Body.cjs +1 -1
  7. package/dist/components/DataGrid/components/Body/Body.cjs.map +1 -1
  8. package/dist/components/DataGrid/components/Body/Body.js +1 -1
  9. package/dist/components/DataGrid/components/Body/Body.js.map +1 -1
  10. package/dist/components/DataGrid/components/Body/EmptyBody/EmptyBody.cjs +34 -0
  11. package/dist/components/DataGrid/components/Body/EmptyBody/EmptyBody.cjs.map +1 -0
  12. package/dist/components/DataGrid/components/Body/EmptyBody/EmptyBody.d.ts +24 -0
  13. package/dist/components/DataGrid/components/Body/EmptyBody/EmptyBody.js +28 -0
  14. package/dist/components/DataGrid/components/Body/EmptyBody/EmptyBody.js.map +1 -0
  15. package/dist/components/DataGrid/components/Body/EmptyBody/EmptyBody.module.scss.cjs +9 -0
  16. package/dist/components/DataGrid/components/Body/EmptyBody/EmptyBody.module.scss.cjs.map +1 -0
  17. package/dist/components/DataGrid/components/Body/EmptyBody/EmptyBody.module.scss.js +7 -0
  18. package/dist/components/DataGrid/components/Body/EmptyBody/EmptyBody.module.scss.js.map +1 -0
  19. package/dist/components/DataGrid/components/Body/EmptyBody/index.d.ts +1 -0
  20. package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBody.cjs +21 -0
  21. package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBody.cjs.map +1 -0
  22. package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBody.d.ts +21 -0
  23. package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBody.js +15 -0
  24. package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBody.js.map +1 -0
  25. package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBodyCell.cjs +46 -0
  26. package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBodyCell.cjs.map +1 -0
  27. package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBodyCell.d.ts +13 -0
  28. package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBodyCell.js +40 -0
  29. package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBodyCell.js.map +1 -0
  30. package/dist/components/DataGrid/components/Body/LoadingBody/index.d.ts +1 -0
  31. package/dist/components/DataGrid/components/Body/Row/Row.cjs.map +1 -1
  32. package/dist/components/DataGrid/components/Body/Row/Row.d.ts +6 -3
  33. package/dist/components/DataGrid/components/Body/Row/Row.js.map +1 -1
  34. package/dist/components/DataGrid/components/Body/index.d.ts +2 -0
  35. package/dist/components/DataGrid/components/Footer/Footer.cjs +1 -1
  36. package/dist/components/DataGrid/components/Footer/Footer.cjs.map +1 -1
  37. package/dist/components/DataGrid/components/Footer/Footer.js +1 -1
  38. package/dist/components/DataGrid/components/Footer/Footer.js.map +1 -1
  39. package/dist/components/DataGrid/types/DataGridProps.d.ts +21 -0
  40. package/dist/components/DataGrid/types/EmptyState.d.ts +6 -0
  41. package/dist/components/DataGrid/types/index.d.ts +1 -0
  42. package/dist/components/Skeleton/Skeleton.cjs +7 -12
  43. package/dist/components/Skeleton/Skeleton.cjs.map +1 -1
  44. package/dist/components/Skeleton/Skeleton.d.ts +4 -4
  45. package/dist/components/Skeleton/Skeleton.js +6 -11
  46. package/dist/components/Skeleton/Skeleton.js.map +1 -1
  47. package/dist/components/Skeleton/Skeleton.module.scss.cjs +9 -0
  48. package/dist/components/Skeleton/Skeleton.module.scss.cjs.map +1 -0
  49. package/dist/components/Skeleton/Skeleton.module.scss.js +7 -0
  50. package/dist/components/Skeleton/Skeleton.module.scss.js.map +1 -0
  51. package/dist/components/ViewTab/ViewTab.cjs +3 -4
  52. package/dist/components/ViewTab/ViewTab.cjs.map +1 -1
  53. package/dist/components/ViewTab/ViewTab.d.ts +3 -1
  54. package/dist/components/ViewTab/ViewTab.js +3 -4
  55. package/dist/components/ViewTab/ViewTab.js.map +1 -1
  56. package/dist/components/ViewTab/styled.cjs +27 -2
  57. package/dist/components/ViewTab/styled.cjs.map +1 -1
  58. package/dist/components/ViewTab/styled.d.ts +1 -1
  59. package/dist/components/ViewTab/styled.js +27 -2
  60. package/dist/components/ViewTab/styled.js.map +1 -1
  61. package/dist/components/ViewTab/types.cjs.map +1 -1
  62. package/dist/components/ViewTab/types.d.ts +7 -2
  63. package/dist/components/ViewTab/types.js.map +1 -1
  64. package/dist/utils/assignCssVars.cjs +26 -0
  65. package/dist/utils/assignCssVars.cjs.map +1 -0
  66. package/dist/utils/assignCssVars.d.ts +13 -0
  67. package/dist/utils/assignCssVars.js +24 -0
  68. package/dist/utils/assignCssVars.js.map +1 -0
  69. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoadingBodyCell.js","sources":["../../../../../../src/components/DataGrid/components/Body/LoadingBody/LoadingBodyCell.tsx"],"sourcesContent":["import React from 'react';\nimport { Column } from '@tanstack/react-table';\n\nimport { Skeleton } from '../../../../Skeleton';\nimport { buildClassnames } from '../../../../../utils';\nimport { usePinnedColumnStyles } from '../../../hooks';\nimport { CellContent } from '../../CellContent';\nimport { theme } from '../../../../../theme';\n\nimport styles from '../BodyCell/BodyCell.module.scss';\n\ntype LoadingBodyCellProps = {\n /**\n * The TanStack Table column instance.\n */\n column: Column<any, any>;\n};\n\n/**\n * A cell component for the DataGrid that displays a skeleton loader.\n */\nexport const LoadingBodyCell = ({ column }: LoadingBodyCellProps) => {\n const { justifyContent, textAlign } = column.columnDef.meta!;\n const { pinnedCellClassName, pinnedCellStyles } = usePinnedColumnStyles({\n column,\n });\n\n const loadingCellClassname = buildClassnames([\n styles.bodyCell,\n pinnedCellClassName,\n 'data-grid-cell',\n 'data-grid-cell-loading',\n ]);\n\n return (\n <td\n className={loadingCellClassname}\n style={pinnedCellStyles}\n aria-colindex={column.getIndex() + 1}\n >\n <CellContent\n contentStyle={\n {\n justifyContent,\n textAlign,\n } as React.CSSProperties\n }\n >\n <Skeleton width=\"75%\" height={theme.sizes[3]} />\n </CellContent>\n </td>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;AAkBA;;AAEG;MACU,eAAe,GAAG,CAAC,EAAE,MAAM,EAAwB,KAAI;IAClE,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC,IAAK;AAC5D,IAAA,MAAM,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,GAAG,qBAAqB,CAAC;QACtE,MAAM;AACP,KAAA,CAAC;IAEF,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAC3C,QAAA,MAAM,CAAC,QAAQ;QACf,mBAAmB;QACnB,gBAAgB;QAChB,wBAAwB;AACzB,KAAA,CAAC;AAEF,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EACE,SAAS,EAAE,oBAAoB,EAC/B,KAAK,EAAE,gBAAgB,mBACR,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAA;QAEpCA,cAAC,CAAA,aAAA,CAAA,WAAW,EACV,EAAA,YAAY,EACV;gBACE,cAAc;gBACd,SAAS;AACa,aAAA,EAAA;AAG1B,YAAAA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAC,EAAA,KAAK,EAAC,KAAK,EAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAI,CACpC,CACX;AAET;;;;"}
@@ -0,0 +1 @@
1
+ export { LoadingBody } from './LoadingBody';
@@ -1 +1 @@
1
- {"version":3,"file":"Row.cjs","sources":["../../../../../../src/components/DataGrid/components/Body/Row/Row.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Row as RowItem } from '@tanstack/react-table';\n\nimport { buildClassnames } from '../../../../../utils';\n\ntype RowProps = {\n /**\n * The row within the TanStack Table instance.\n */\n row: RowItem<any>;\n\n /**\n * Whether rows should be striped or not.\n */\n striped: boolean;\n\n /**\n * Whether row expanding is enabled.\n */\n enableExpanding: boolean;\n\n /**\n * Child elements (table cells).\n */\n children: React.ReactNode;\n};\n\nexport const Row = ({ row, striped, enableExpanding, children }: RowProps) => (\n <tr\n className={buildClassnames(['data-grid-row', striped ? 'striped' : undefined])}\n key={row.id}\n // 0-based index + header row.\n aria-rowindex={row.index + 2}\n aria-level={enableExpanding ? row.depth + 1 : undefined}\n >\n {children}\n </tr>\n);\n"],"names":["React","buildClassnames"],"mappings":";;;;;;;;;;AA4BO,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAY,MACvEA,sBAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EACE,SAAS,EAAEC,+BAAe,CAAC,CAAC,eAAe,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC,EAC9E,GAAG,EAAE,GAAG,CAAC,EAAE,EAAA,eAAA,EAEI,GAAG,CAAC,KAAK,GAAG,CAAC,EAChB,YAAA,EAAA,eAAe,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,SAAS,EAAA,EAEtD,QAAQ,CACN;;;;"}
1
+ {"version":3,"file":"Row.cjs","sources":["../../../../../../src/components/DataGrid/components/Body/Row/Row.tsx"],"sourcesContent":["import React from 'react';\n\nimport { buildClassnames } from '../../../../../utils';\n\ntype RowProps = {\n /**\n * Row information, including id, index, and depth (typically the TanStack table row).\n */\n row: {\n id: string;\n index: number;\n depth: number;\n };\n\n /**\n * Whether rows should be striped or not.\n */\n striped: boolean;\n\n /**\n * Whether row expanding is enabled.\n */\n enableExpanding: boolean;\n\n /**\n * Child elements (table cells).\n */\n children: React.ReactNode;\n};\n\nexport const Row = ({ row, striped, enableExpanding, children }: RowProps) => (\n <tr\n className={buildClassnames(['data-grid-row', striped ? 'striped' : undefined])}\n key={row.id}\n // 0-based index + header row.\n aria-rowindex={row.index + 2}\n aria-level={enableExpanding ? row.depth + 1 : undefined}\n >\n {children}\n </tr>\n);\n"],"names":["React","buildClassnames"],"mappings":";;;;;;;;;;AA8BO,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAY,MACvEA,sBAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EACE,SAAS,EAAEC,+BAAe,CAAC,CAAC,eAAe,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC,EAC9E,GAAG,EAAE,GAAG,CAAC,EAAE,EAAA,eAAA,EAEI,GAAG,CAAC,KAAK,GAAG,CAAC,EAChB,YAAA,EAAA,eAAe,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,SAAS,EAAA,EAEtD,QAAQ,CACN;;;;"}
@@ -1,10 +1,13 @@
1
1
  import React from 'react';
2
- import { Row as RowItem } from '@tanstack/react-table';
3
2
  type RowProps = {
4
3
  /**
5
- * The row within the TanStack Table instance.
4
+ * Row information, including id, index, and depth (typically the TanStack table row).
6
5
  */
7
- row: RowItem<any>;
6
+ row: {
7
+ id: string;
8
+ index: number;
9
+ depth: number;
10
+ };
8
11
  /**
9
12
  * Whether rows should be striped or not.
10
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Row.js","sources":["../../../../../../src/components/DataGrid/components/Body/Row/Row.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Row as RowItem } from '@tanstack/react-table';\n\nimport { buildClassnames } from '../../../../../utils';\n\ntype RowProps = {\n /**\n * The row within the TanStack Table instance.\n */\n row: RowItem<any>;\n\n /**\n * Whether rows should be striped or not.\n */\n striped: boolean;\n\n /**\n * Whether row expanding is enabled.\n */\n enableExpanding: boolean;\n\n /**\n * Child elements (table cells).\n */\n children: React.ReactNode;\n};\n\nexport const Row = ({ row, striped, enableExpanding, children }: RowProps) => (\n <tr\n className={buildClassnames(['data-grid-row', striped ? 'striped' : undefined])}\n key={row.id}\n // 0-based index + header row.\n aria-rowindex={row.index + 2}\n aria-level={enableExpanding ? row.depth + 1 : undefined}\n >\n {children}\n </tr>\n);\n"],"names":["React"],"mappings":";;;;AA4BO,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAY,MACvEA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EACE,SAAS,EAAE,eAAe,CAAC,CAAC,eAAe,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC,EAC9E,GAAG,EAAE,GAAG,CAAC,EAAE,EAAA,eAAA,EAEI,GAAG,CAAC,KAAK,GAAG,CAAC,EAChB,YAAA,EAAA,eAAe,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,SAAS,EAAA,EAEtD,QAAQ,CACN;;;;"}
1
+ {"version":3,"file":"Row.js","sources":["../../../../../../src/components/DataGrid/components/Body/Row/Row.tsx"],"sourcesContent":["import React from 'react';\n\nimport { buildClassnames } from '../../../../../utils';\n\ntype RowProps = {\n /**\n * Row information, including id, index, and depth (typically the TanStack table row).\n */\n row: {\n id: string;\n index: number;\n depth: number;\n };\n\n /**\n * Whether rows should be striped or not.\n */\n striped: boolean;\n\n /**\n * Whether row expanding is enabled.\n */\n enableExpanding: boolean;\n\n /**\n * Child elements (table cells).\n */\n children: React.ReactNode;\n};\n\nexport const Row = ({ row, striped, enableExpanding, children }: RowProps) => (\n <tr\n className={buildClassnames(['data-grid-row', striped ? 'striped' : undefined])}\n key={row.id}\n // 0-based index + header row.\n aria-rowindex={row.index + 2}\n aria-level={enableExpanding ? row.depth + 1 : undefined}\n >\n {children}\n </tr>\n);\n"],"names":["React"],"mappings":";;;;AA8BO,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAY,MACvEA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EACE,SAAS,EAAE,eAAe,CAAC,CAAC,eAAe,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC,EAC9E,GAAG,EAAE,GAAG,CAAC,EAAE,EAAA,eAAA,EAEI,GAAG,CAAC,KAAK,GAAG,CAAC,EAChB,YAAA,EAAA,eAAe,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,SAAS,EAAA,EAEtD,QAAQ,CACN;;;;"}
@@ -1 +1,3 @@
1
1
  export { Body, MemoizedBody } from './Body';
2
+ export { LoadingBody } from './LoadingBody';
3
+ export { EmptyBody } from './EmptyBody';
@@ -11,7 +11,7 @@ const Footer = ({ table, ariaRoles }) => {
11
11
  // We're not making use of column grouping, so we only need the first footer group.
12
12
  const [footer] = table.getFooterGroups();
13
13
  return (React__default.default.createElement("tfoot", { className: "data-grid-footer" },
14
- React__default.default.createElement("tr", { className: "data-grid-footer-row" }, footer.headers.map((header) => (React__default.default.createElement(FooterCell.FooterCell, { key: header.id, ariaRoles: ariaRoles, header: header }))))));
14
+ React__default.default.createElement("tr", { className: "data-grid-footer-row", "aria-rowindex": table.getRowCount() + 1 }, footer.headers.map((header) => (React__default.default.createElement(FooterCell.FooterCell, { key: header.id, ariaRoles: ariaRoles, header: header }))))));
15
15
  };
16
16
 
17
17
  exports.Footer = Footer;
@@ -1 +1 @@
1
- {"version":3,"file":"Footer.cjs","sources":["../../../../../src/components/DataGrid/components/Footer/Footer.tsx"],"sourcesContent":["import React from 'react';\nimport { Table } from '@tanstack/react-table';\n\nimport { AriaRoles } from '../../types';\nimport { FooterCell } from './FooterCell';\n\ntype FooterProps = {\n /**\n * The TanStack table instance.\n */\n table: Table<any>;\n\n /**\n * ARIA roles used in the grid.\n */\n ariaRoles: AriaRoles;\n};\n\nexport const Footer = ({ table, ariaRoles }: FooterProps) => {\n // We're not making use of column grouping, so we only need the first footer group.\n const [footer] = table.getFooterGroups();\n\n return (\n <tfoot className=\"data-grid-footer\">\n <tr className=\"data-grid-footer-row\">\n {footer.headers.map((header) => (\n <FooterCell key={header.id} ariaRoles={ariaRoles} header={header} />\n ))}\n </tr>\n </tfoot>\n );\n};\n"],"names":["React","FooterCell"],"mappings":";;;;;;;;;AAkBa,MAAA,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAe,KAAI;;IAE1D,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,eAAe,EAAE;AAExC,IAAA,QACEA,sBAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,SAAS,EAAC,kBAAkB,EAAA;AACjC,QAAAA,sBAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,sBAAsB,EACjC,EAAA,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MACzBA,qCAACC,qBAAU,EAAA,EAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAI,CAAA,CACrE,CAAC,CACC,CACC;AAEZ;;;;"}
1
+ {"version":3,"file":"Footer.cjs","sources":["../../../../../src/components/DataGrid/components/Footer/Footer.tsx"],"sourcesContent":["import React from 'react';\nimport { Table } from '@tanstack/react-table';\n\nimport { AriaRoles } from '../../types';\nimport { FooterCell } from './FooterCell';\n\ntype FooterProps = {\n /**\n * The TanStack table instance.\n */\n table: Table<any>;\n\n /**\n * ARIA roles used in the grid.\n */\n ariaRoles: AriaRoles;\n};\n\nexport const Footer = ({ table, ariaRoles }: FooterProps) => {\n // We're not making use of column grouping, so we only need the first footer group.\n const [footer] = table.getFooterGroups();\n\n return (\n <tfoot className=\"data-grid-footer\">\n <tr className=\"data-grid-footer-row\" aria-rowindex={table.getRowCount() + 1}>\n {footer.headers.map((header) => (\n <FooterCell key={header.id} ariaRoles={ariaRoles} header={header} />\n ))}\n </tr>\n </tfoot>\n );\n};\n"],"names":["React","FooterCell"],"mappings":";;;;;;;;;AAkBa,MAAA,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAe,KAAI;;IAE1D,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,eAAe,EAAE;AAExC,IAAA,QACEA,sBAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,SAAS,EAAC,kBAAkB,EAAA;QACjCA,sBAAI,CAAA,aAAA,CAAA,IAAA,EAAA,EAAA,SAAS,EAAC,sBAAsB,EAAA,eAAA,EAAgB,KAAK,CAAC,WAAW,EAAE,GAAG,CAAC,IACxE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MACzBA,sBAAC,CAAA,aAAA,CAAAC,qBAAU,IAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAA,CAAI,CACrE,CAAC,CACC,CACC;AAEZ;;;;"}
@@ -5,7 +5,7 @@ const Footer = ({ table, ariaRoles }) => {
5
5
  // We're not making use of column grouping, so we only need the first footer group.
6
6
  const [footer] = table.getFooterGroups();
7
7
  return (React__default.createElement("tfoot", { className: "data-grid-footer" },
8
- React__default.createElement("tr", { className: "data-grid-footer-row" }, footer.headers.map((header) => (React__default.createElement(FooterCell, { key: header.id, ariaRoles: ariaRoles, header: header }))))));
8
+ React__default.createElement("tr", { className: "data-grid-footer-row", "aria-rowindex": table.getRowCount() + 1 }, footer.headers.map((header) => (React__default.createElement(FooterCell, { key: header.id, ariaRoles: ariaRoles, header: header }))))));
9
9
  };
10
10
 
11
11
  export { Footer };
@@ -1 +1 @@
1
- {"version":3,"file":"Footer.js","sources":["../../../../../src/components/DataGrid/components/Footer/Footer.tsx"],"sourcesContent":["import React from 'react';\nimport { Table } from '@tanstack/react-table';\n\nimport { AriaRoles } from '../../types';\nimport { FooterCell } from './FooterCell';\n\ntype FooterProps = {\n /**\n * The TanStack table instance.\n */\n table: Table<any>;\n\n /**\n * ARIA roles used in the grid.\n */\n ariaRoles: AriaRoles;\n};\n\nexport const Footer = ({ table, ariaRoles }: FooterProps) => {\n // We're not making use of column grouping, so we only need the first footer group.\n const [footer] = table.getFooterGroups();\n\n return (\n <tfoot className=\"data-grid-footer\">\n <tr className=\"data-grid-footer-row\">\n {footer.headers.map((header) => (\n <FooterCell key={header.id} ariaRoles={ariaRoles} header={header} />\n ))}\n </tr>\n </tfoot>\n );\n};\n"],"names":["React"],"mappings":";;;AAkBa,MAAA,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAe,KAAI;;IAE1D,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,eAAe,EAAE;AAExC,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,SAAS,EAAC,kBAAkB,EAAA;AACjC,QAAAA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,sBAAsB,EACjC,EAAA,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MACzBA,6BAAC,UAAU,EAAA,EAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAI,CAAA,CACrE,CAAC,CACC,CACC;AAEZ;;;;"}
1
+ {"version":3,"file":"Footer.js","sources":["../../../../../src/components/DataGrid/components/Footer/Footer.tsx"],"sourcesContent":["import React from 'react';\nimport { Table } from '@tanstack/react-table';\n\nimport { AriaRoles } from '../../types';\nimport { FooterCell } from './FooterCell';\n\ntype FooterProps = {\n /**\n * The TanStack table instance.\n */\n table: Table<any>;\n\n /**\n * ARIA roles used in the grid.\n */\n ariaRoles: AriaRoles;\n};\n\nexport const Footer = ({ table, ariaRoles }: FooterProps) => {\n // We're not making use of column grouping, so we only need the first footer group.\n const [footer] = table.getFooterGroups();\n\n return (\n <tfoot className=\"data-grid-footer\">\n <tr className=\"data-grid-footer-row\" aria-rowindex={table.getRowCount() + 1}>\n {footer.headers.map((header) => (\n <FooterCell key={header.id} ariaRoles={ariaRoles} header={header} />\n ))}\n </tr>\n </tfoot>\n );\n};\n"],"names":["React"],"mappings":";;;AAkBa,MAAA,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAe,KAAI;;IAE1D,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,eAAe,EAAE;AAExC,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,SAAS,EAAC,kBAAkB,EAAA;QACjCA,cAAI,CAAA,aAAA,CAAA,IAAA,EAAA,EAAA,SAAS,EAAC,sBAAsB,EAAA,eAAA,EAAgB,KAAK,CAAC,WAAW,EAAE,GAAG,CAAC,IACxE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MACzBA,cAAC,CAAA,aAAA,CAAA,UAAU,IAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAA,CAAI,CACrE,CAAC,CACC,CACC;AAEZ;;;;"}
@@ -6,6 +6,7 @@ import { SortState } from './SortState';
6
6
  import { PinnedColumnState } from './PinnedColumnState';
7
7
  import { RowGroupingConfiguration } from './RowGroupingConfiguration';
8
8
  import { ColumnWidths } from './ColumnWidths';
9
+ import { EmptyState } from './EmptyState';
9
10
  export type CustomState = {
10
11
  iconSlot: ReactElement;
11
12
  heading: string;
@@ -120,4 +121,24 @@ export type DataGridProps = Pick<AriaAttributes, 'aria-label'> & {
120
121
  * Callback which is raised when the column widths change.
121
122
  */
122
123
  onColumnsResized?: (columnWidths: ColumnWidths) => void;
124
+ /** Empty/Loading State */
125
+ /**
126
+ * Show the loading state.
127
+ */
128
+ isLoading?: boolean;
129
+ /**
130
+ * Number of rows to be rendered in the loading state.
131
+ * @default 5
132
+ */
133
+ loadingRowCount?: number;
134
+ /**
135
+ * Settings for the empty state, rendered when there are no rows.
136
+ *
137
+ * If none is provided, a default empty state will be displayed.
138
+ */
139
+ emptyState?: EmptyState;
140
+ /**
141
+ * Optional slot for custom content in the empty body, overrides empty state.
142
+ */
143
+ emptySlot?: React.ReactElement;
123
144
  };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export type EmptyState = {
3
+ iconSlot?: React.ReactElement;
4
+ heading?: string;
5
+ subHeading?: string;
6
+ };
@@ -5,3 +5,4 @@ export { ColumnDefinition } from './ColumnDefinition';
5
5
  export { SortState } from './SortState';
6
6
  export { PinnedColumnState } from './PinnedColumnState';
7
7
  export { RowGroupingConfiguration, ExpandedRows } from './RowGroupingConfiguration';
8
+ export { EmptyState } from './EmptyState';
@@ -1,21 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var styled = require('styled-components');
4
- var BaseContainer = require('../BaseContainer/BaseContainer.cjs');
3
+ var React = require('react');
4
+ var assignCssVars = require('../../utils/assignCssVars.cjs');
5
+ var Skeleton_module = require('./Skeleton.module.scss.cjs');
5
6
 
6
7
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
7
8
 
8
- var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
9
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
9
10
 
10
- const Skeleton = styled__default.default(BaseContainer.BaseContainer).attrs(() => ({
11
- 'aria-hidden': true,
12
- })).withConfig({ displayName: "vui--Skeleton", componentId: "vui--7bl1ak" }) `display:block;background:#f6f7f8;background:linear-gradient(to right, #eeeeee 8%, #dddddd 18%, #eeeeee 33%);background-size:2500px 104px;cursor:progress;border-radius:4px;${({ width = '', height = '' }) => `
13
- width: ${width || '100%'};
14
- min-width: ${width};
15
- height: ${height || '20px'};
16
- min-height: ${height};
17
- `};@media (prefers-reduced-motion: no-preference){animation-duration:2s;animation-fill-mode:forwards;animation-iteration-count:infinite;animation-name:placeHolderShimmer;animation-timing-function:linear;}@keyframes placeHolderShimmer{0%{background-position:-1080px 0;}100%{background-position:1080px 0;}}`;
18
- Skeleton.displayName = 'Skeleton';
11
+ const Skeleton = ({ width, height }) => {
12
+ return (React__default.default.createElement("div", { "aria-hidden": "true", style: assignCssVars.assignCssVars({ width, height }), className: Skeleton_module.skeleton }));
13
+ };
19
14
 
20
15
  exports.Skeleton = Skeleton;
21
16
  //# sourceMappingURL=Skeleton.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Skeleton.cjs","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { BaseContainer } from '../BaseContainer';\n\nexport type SkeletonProps = {\n width?: string;\n height?: string;\n};\n\nexport const Skeleton = styled(BaseContainer).attrs(() => ({\n 'aria-hidden': true,\n}))<SkeletonProps>`\n // General\n display: block;\n background: #f6f7f8;\n background: linear-gradient(to right, #eeeeee 8%, #dddddd 18%, #eeeeee 33%);\n background-size: 2500px 104px;\n\n cursor: progress;\n\n // Sizing\n\n border-radius: 4px;\n ${({ width = '', height = '' }) => `\n width: ${width || '100%'};\n min-width: ${width};\n height: ${height || '20px'};\n min-height: ${height};\n `};\n\n // Animation\n\n @media (prefers-reduced-motion: no-preference) {\n animation-duration: 2s;\n animation-fill-mode: forwards;\n animation-iteration-count: infinite;\n animation-name: placeHolderShimmer;\n animation-timing-function: linear;\n }\n\n @keyframes placeHolderShimmer {\n 0% {\n background-position: -1080px 0;\n }\n 100% {\n background-position: 1080px 0;\n }\n }\n`;\n\nSkeleton.displayName = 'Skeleton';\n"],"names":["styled","BaseContainer"],"mappings":";;;;;;;;;AAQO,MAAM,QAAQ,GAAGA,uBAAM,CAACC,2BAAa,CAAC,CAAC,KAAK,CAAC,OAAO;AACzD,IAAA,aAAa,EAAE,IAAI;AACpB,CAAA,CAAC,CAAC,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,eAAA,EAAA,WAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA,2KAAA,EAYC,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK;AACxB,WAAA,EAAA,KAAK,IAAI,MAAM,CAAA;iBACX,KAAK,CAAA;AACR,YAAA,EAAA,MAAM,IAAI,MAAM,CAAA;kBACZ,MAAM,CAAA;AACrB,EAAA,CAAA,CAAA,8SAAA;AAsBH,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}
1
+ {"version":3,"file":"Skeleton.cjs","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import React from 'react';\n\nimport { assignCssVars } from '../../utils/assignCssVars';\n\nimport styles from './Skeleton.module.scss';\n\ntype SkeletonProps = {\n width?: string;\n height?: string;\n};\n\nexport const Skeleton = ({ width, height }: SkeletonProps) => {\n return (\n <div aria-hidden=\"true\" style={assignCssVars({ width, height })} className={styles.skeleton} />\n );\n};\n"],"names":["React","assignCssVars","styles"],"mappings":";;;;;;;;;;AAWa,MAAA,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAiB,KAAI;IAC3D,QACEA,6DAAiB,MAAM,EAAC,KAAK,EAAEC,2BAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAEC,eAAM,CAAC,QAAQ,EAAI,CAAA;AAEnG;;;;"}
@@ -1,7 +1,7 @@
1
- export type SkeletonProps = {
1
+ import React from 'react';
2
+ type SkeletonProps = {
2
3
  width?: string;
3
4
  height?: string;
4
5
  };
5
- export declare const Skeleton: import("styled-components").StyledComponent<"div", any, {
6
- 'aria-hidden': true;
7
- } & SkeletonProps, "aria-hidden">;
6
+ export declare const Skeleton: ({ width, height }: SkeletonProps) => React.JSX.Element;
7
+ export {};
@@ -1,15 +1,10 @@
1
- import styled from 'styled-components';
2
- import { BaseContainer } from '../BaseContainer/BaseContainer.js';
1
+ import React__default from 'react';
2
+ import { assignCssVars } from '../../utils/assignCssVars.js';
3
+ import styles from './Skeleton.module.scss.js';
3
4
 
4
- const Skeleton = styled(BaseContainer).attrs(() => ({
5
- 'aria-hidden': true,
6
- })).withConfig({ displayName: "vui--Skeleton", componentId: "vui--7bl1ak" }) `display:block;background:#f6f7f8;background:linear-gradient(to right, #eeeeee 8%, #dddddd 18%, #eeeeee 33%);background-size:2500px 104px;cursor:progress;border-radius:4px;${({ width = '', height = '' }) => `
7
- width: ${width || '100%'};
8
- min-width: ${width};
9
- height: ${height || '20px'};
10
- min-height: ${height};
11
- `};@media (prefers-reduced-motion: no-preference){animation-duration:2s;animation-fill-mode:forwards;animation-iteration-count:infinite;animation-name:placeHolderShimmer;animation-timing-function:linear;}@keyframes placeHolderShimmer{0%{background-position:-1080px 0;}100%{background-position:1080px 0;}}`;
12
- Skeleton.displayName = 'Skeleton';
5
+ const Skeleton = ({ width, height }) => {
6
+ return (React__default.createElement("div", { "aria-hidden": "true", style: assignCssVars({ width, height }), className: styles.skeleton }));
7
+ };
13
8
 
14
9
  export { Skeleton };
15
10
  //# sourceMappingURL=Skeleton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Skeleton.js","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { BaseContainer } from '../BaseContainer';\n\nexport type SkeletonProps = {\n width?: string;\n height?: string;\n};\n\nexport const Skeleton = styled(BaseContainer).attrs(() => ({\n 'aria-hidden': true,\n}))<SkeletonProps>`\n // General\n display: block;\n background: #f6f7f8;\n background: linear-gradient(to right, #eeeeee 8%, #dddddd 18%, #eeeeee 33%);\n background-size: 2500px 104px;\n\n cursor: progress;\n\n // Sizing\n\n border-radius: 4px;\n ${({ width = '', height = '' }) => `\n width: ${width || '100%'};\n min-width: ${width};\n height: ${height || '20px'};\n min-height: ${height};\n `};\n\n // Animation\n\n @media (prefers-reduced-motion: no-preference) {\n animation-duration: 2s;\n animation-fill-mode: forwards;\n animation-iteration-count: infinite;\n animation-name: placeHolderShimmer;\n animation-timing-function: linear;\n }\n\n @keyframes placeHolderShimmer {\n 0% {\n background-position: -1080px 0;\n }\n 100% {\n background-position: 1080px 0;\n }\n }\n`;\n\nSkeleton.displayName = 'Skeleton';\n"],"names":[],"mappings":";;;AAQO,MAAM,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,OAAO;AACzD,IAAA,aAAa,EAAE,IAAI;AACpB,CAAA,CAAC,CAAC,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,eAAA,EAAA,WAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA,2KAAA,EAYC,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK;AACxB,WAAA,EAAA,KAAK,IAAI,MAAM,CAAA;iBACX,KAAK,CAAA;AACR,YAAA,EAAA,MAAM,IAAI,MAAM,CAAA;kBACZ,MAAM,CAAA;AACrB,EAAA,CAAA,CAAA,8SAAA;AAsBH,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}
1
+ {"version":3,"file":"Skeleton.js","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import React from 'react';\n\nimport { assignCssVars } from '../../utils/assignCssVars';\n\nimport styles from './Skeleton.module.scss';\n\ntype SkeletonProps = {\n width?: string;\n height?: string;\n};\n\nexport const Skeleton = ({ width, height }: SkeletonProps) => {\n return (\n <div aria-hidden=\"true\" style={assignCssVars({ width, height })} className={styles.skeleton} />\n );\n};\n"],"names":["React"],"mappings":";;;;AAWa,MAAA,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAiB,KAAI;IAC3D,QACEA,qDAAiB,MAAM,EAAC,KAAK,EAAE,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAI,CAAA;AAEnG;;;;"}
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
4
+
5
+ ___$insertStyle("._skeleton_1w7c5_1 {\n box-sizing: border-box;\n position: relative;\n margin: var(--sizes-none);\n padding: var(--sizes-none);\n display: block;\n background: #f6f7f8;\n background: linear-gradient(to right, #eeeeee 8%, #dddddd 18%, #eeeeee 33%);\n background-size: 2500px 104px;\n cursor: progress;\n border-radius: var(--sizes-1);\n width: var(--width, \"100%\");\n min-width: var(--width, \"100%\");\n height: var(--height, \"20px\");\n min-height: var(--height, \"20px\");\n}\n@keyframes _placeHolderShimmer_1w7c5_1 {\n 0% {\n background-position: -1080px 0;\n }\n 100% {\n background-position: 1080px 0;\n }\n}\n@media (prefers-reduced-motion: no-preference) {\n ._skeleton_1w7c5_1 {\n animation-duration: 2s;\n animation-fill-mode: forwards;\n animation-iteration-count: infinite;\n animation-name: _placeHolderShimmer_1w7c5_1;\n animation-timing-function: linear;\n }\n}");
6
+ var styles = {"skeleton":"_skeleton_1w7c5_1","placeHolderShimmer":"_placeHolderShimmer_1w7c5_1"};
7
+
8
+ module.exports = styles;
9
+ //# sourceMappingURL=Skeleton.module.scss.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Skeleton.module.scss.cjs","sources":["../../../src/components/Skeleton/Skeleton.module.scss"],"sourcesContent":[".skeleton {\n box-sizing: border-box;\n position: relative;\n margin: var(--sizes-none);\n padding: var(--sizes-none);\n\n // General\n display: block;\n background: #f6f7f8;\n background: linear-gradient(to right, #eeeeee 8%, #dddddd 18%, #eeeeee 33%);\n background-size: 2500px 104px;\n\n cursor: progress;\n\n // Sizing\n border-radius: var(--sizes-1);\n\n width: var(--width, '100%');\n min-width: var(--width, '100%');\n\n height: var(--height, '20px');\n min-height: var(--height, '20px');\n\n // Animation\n @keyframes placeHolderShimmer {\n 0% {\n background-position: -1080px 0;\n }\n 100% {\n background-position: 1080px 0;\n }\n }\n\n @media (prefers-reduced-motion: no-preference) {\n animation-duration: 2s;\n animation-fill-mode: forwards;\n animation-iteration-count: infinite;\n animation-name: placeHolderShimmer;\n animation-timing-function: linear;\n }\n}\n\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,y5BAAA;AACA,aAAA,CAAA,UAAA,CAAA,mBAAA,CAAA,oBAAA,CAAA,6BAAA;;;;"}
@@ -0,0 +1,7 @@
1
+ import insertStyle from '../../_virtual/____insertStyle.js';
2
+
3
+ insertStyle("._skeleton_1w7c5_1 {\n box-sizing: border-box;\n position: relative;\n margin: var(--sizes-none);\n padding: var(--sizes-none);\n display: block;\n background: #f6f7f8;\n background: linear-gradient(to right, #eeeeee 8%, #dddddd 18%, #eeeeee 33%);\n background-size: 2500px 104px;\n cursor: progress;\n border-radius: var(--sizes-1);\n width: var(--width, \"100%\");\n min-width: var(--width, \"100%\");\n height: var(--height, \"20px\");\n min-height: var(--height, \"20px\");\n}\n@keyframes _placeHolderShimmer_1w7c5_1 {\n 0% {\n background-position: -1080px 0;\n }\n 100% {\n background-position: 1080px 0;\n }\n}\n@media (prefers-reduced-motion: no-preference) {\n ._skeleton_1w7c5_1 {\n animation-duration: 2s;\n animation-fill-mode: forwards;\n animation-iteration-count: infinite;\n animation-name: _placeHolderShimmer_1w7c5_1;\n animation-timing-function: linear;\n }\n}");
4
+ var styles = {"skeleton":"_skeleton_1w7c5_1","placeHolderShimmer":"_placeHolderShimmer_1w7c5_1"};
5
+
6
+ export { styles as default };
7
+ //# sourceMappingURL=Skeleton.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Skeleton.module.scss.js","sources":["../../../src/components/Skeleton/Skeleton.module.scss"],"sourcesContent":[".skeleton {\n box-sizing: border-box;\n position: relative;\n margin: var(--sizes-none);\n padding: var(--sizes-none);\n\n // General\n display: block;\n background: #f6f7f8;\n background: linear-gradient(to right, #eeeeee 8%, #dddddd 18%, #eeeeee 33%);\n background-size: 2500px 104px;\n\n cursor: progress;\n\n // Sizing\n border-radius: var(--sizes-1);\n\n width: var(--width, '100%');\n min-width: var(--width, '100%');\n\n height: var(--height, '20px');\n min-height: var(--height, '20px');\n\n // Animation\n @keyframes placeHolderShimmer {\n 0% {\n background-position: -1080px 0;\n }\n 100% {\n background-position: 1080px 0;\n }\n }\n\n @media (prefers-reduced-motion: no-preference) {\n animation-duration: 2s;\n animation-fill-mode: forwards;\n animation-iteration-count: infinite;\n animation-name: placeHolderShimmer;\n animation-timing-function: linear;\n }\n}\n\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,y5BAAA;AACA,aAAA,CAAA,UAAA,CAAA,mBAAA,CAAA,oBAAA,CAAA,6BAAA;;;;"}
@@ -22,7 +22,7 @@ const generateClassNames = (prefix) => ({
22
22
  active: prefix ? `${prefix}-active` : undefined,
23
23
  counter: prefix ? `${prefix}-counter` : undefined,
24
24
  });
25
- const ViewTab = React__default.default.forwardRef(({ id, iconSlot, name, type, className, colourPalette = colors.colors.secondary.blue, customTextColour, count, active = false, onClick, subAction, ariaContext, ...props }, ref) => {
25
+ const ViewTab = React__default.default.forwardRef(({ id, iconSlot, name, type, className, colourPalette = colors.colors.secondary.blue, customTextColour, count, countSlot, active = false, onClick, subAction, ariaContext, ariaDescribedBy, ...props }, ref) => {
26
26
  const classNames = generateClassNames(className);
27
27
  const [isHovered, handleEnter, handleLeave] = useHover.useHover();
28
28
  const action = active && subAction ? subAction : onClick;
@@ -36,12 +36,11 @@ const ViewTab = React__default.default.forwardRef(({ id, iconSlot, name, type, c
36
36
  return 'Edit';
37
37
  return '';
38
38
  };
39
- return (React__default.default.createElement(styled.ViewButton, { className: buildClassnames.buildClassnames([classNames === null || classNames === undefined ? undefined : classNames.container]), onClick: handleAction, role: "tab", "aria-selected": active, "aria-label": `${getLabelAction()} ${name} view ${count ? `with ${count} ${ariaContext}` : ''}`, customTextColour: customTextColour, ref: ref, ...props },
39
+ return (React__default.default.createElement(styled.ViewButton, { className: buildClassnames.buildClassnames([classNames === null || classNames === undefined ? undefined : classNames.container]), onClick: handleAction, role: "tab", "aria-selected": active, "aria-label": `${getLabelAction()} ${name} view ${count && ariaContext ? `with ${count} ${ariaContext}` : ''}`, customTextColour: customTextColour, ref: ref, "aria-describedby": ariaDescribedBy, ...props },
40
40
  React__default.default.createElement(styled.Contour, { active: active, onMouseEnter: handleEnter, onMouseLeave: handleLeave, colourPalette: colourPalette, customTextColour: customTextColour },
41
41
  iconSlot && React__default.default.createElement(styled.CustomIconWrapper, null, iconSlot),
42
42
  React__default.default.createElement(Text.Text, { variant: "bodyBold" }, name),
43
- count !== undefined && count !== null && (React__default.default.createElement(styled.CounterContainer, { "data-testid": "countContainer", active: active || isHovered, colourPalette: colourPalette, customTextColour: customTextColour },
44
- React__default.default.createElement(styled.CounterText, { variant: "subheadingSmall" }, count))),
43
+ (countSlot || (count !== undefined && count !== null)) && (React__default.default.createElement(styled.CounterContainer, { "data-testid": "countContainer", active: active || isHovered, colourPalette: colourPalette, customTextColour: customTextColour }, countSlot || React__default.default.createElement(styled.CounterText, { variant: "subheadingSmall" }, count))),
45
44
  isDraft && React__default.default.createElement(styled.CrossIconStyling, { ...styled.IconStyling, "aria-label": "delete icon" }),
46
45
  isSaved && active && React__default.default.createElement(styled.ThreeDotsIconStyling, { ...styled.IconStyling, "aria-label": "edit icon" }))));
47
46
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ViewTab.cjs","sources":["../../../src/components/ViewTab/ViewTab.tsx"],"sourcesContent":["import React, { Ref } from 'react';\n\nimport { useHover } from '../../hooks';\nimport { colors } from '../../theme/modules/colors';\n\nimport { ViewTabProps, ViewTabTypes } from './types';\n\nimport {\n Contour,\n CounterContainer,\n CounterText,\n CrossIconStyling,\n CustomIconWrapper,\n IconStyling,\n Text,\n ThreeDotsIconStyling,\n ViewButton,\n} from './styled';\nimport { buildClassnames } from '../../utils/buildClassnames';\n\nexport interface ClassNamesReturnPayload {\n delete?: string;\n edit?: string;\n container?: string;\n active?: string;\n counter?: string;\n}\n\nconst generateClassNames = (prefix?: string): ClassNamesReturnPayload => ({\n delete: prefix ? `${prefix}-delete` : undefined,\n edit: prefix ? `${prefix}-edit` : undefined,\n container: prefix ? `${prefix}-view` : undefined,\n active: prefix ? `${prefix}-active` : undefined,\n counter: prefix ? `${prefix}-counter` : undefined,\n});\n\nexport const ViewTab = React.forwardRef<HTMLButtonElement, ViewTabProps>(\n (\n {\n id,\n iconSlot,\n name,\n type,\n className,\n colourPalette = colors.secondary.blue,\n customTextColour,\n count,\n active = false,\n onClick,\n subAction,\n ariaContext,\n ...props\n }: ViewTabProps,\n ref: Ref<HTMLButtonElement>,\n ) => {\n const classNames = generateClassNames(className);\n const [isHovered, handleEnter, handleLeave] = useHover();\n\n const action = active && subAction ? subAction : onClick;\n const handleAction = () => action(id);\n\n const isDraft = type === ViewTabTypes.draft;\n const isSaved = type === ViewTabTypes.saved;\n\n const getLabelAction = () => {\n if (active && isDraft) return 'Delete';\n if (active && isSaved) return 'Edit';\n return '';\n };\n\n return (\n <ViewButton\n className={buildClassnames([classNames?.container])}\n onClick={handleAction}\n role=\"tab\"\n aria-selected={active}\n aria-label={`${getLabelAction()} ${name} view ${\n count ? `with ${count} ${ariaContext}` : ''\n }`}\n customTextColour={customTextColour}\n ref={ref}\n {...props}\n >\n <Contour\n active={active}\n onMouseEnter={handleEnter}\n onMouseLeave={handleLeave}\n colourPalette={colourPalette}\n customTextColour={customTextColour}\n >\n {iconSlot && <CustomIconWrapper>{iconSlot}</CustomIconWrapper>}\n <Text variant=\"bodyBold\">{name}</Text>\n {count !== undefined && count !== null && (\n <CounterContainer\n data-testid=\"countContainer\"\n active={active || isHovered}\n colourPalette={colourPalette}\n customTextColour={customTextColour}\n >\n <CounterText variant=\"subheadingSmall\">{count}</CounterText>\n </CounterContainer>\n )}\n {isDraft && <CrossIconStyling {...IconStyling} aria-label=\"delete icon\" />}\n {isSaved && active && <ThreeDotsIconStyling {...IconStyling} aria-label=\"edit icon\" />}\n </Contour>\n </ViewButton>\n );\n },\n);\n"],"names":["React","colors","useHover","ViewTabTypes","ViewButton","buildClassnames","Contour","CustomIconWrapper","Text","CounterContainer","CounterText","CrossIconStyling","IconStyling","ThreeDotsIconStyling"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,MAAM,kBAAkB,GAAG,CAAC,MAAe,MAA+B;IACxE,MAAM,EAAE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AA,CAAAW,uBAAgB,OAAKC,kBAAW,EAAA,YAAA,EAAa,aAAa,EAAG,CAAA;AACzE,YAAA,OAAO,IAAI,MAAM,IAAIZ,sBAAA,CAAA,aAAA,CAACa,2BAAoB,EAAA,EAAA,GAAKD,kBAAW,EAAA,YAAA,EAAa,WAAW,EAAA,CAAG,CAC9E,CACC;AAEjB,CAAC;;;;"}
1
+ {"version":3,"file":"ViewTab.cjs","sources":["../../../src/components/ViewTab/ViewTab.tsx"],"sourcesContent":["import React, { Ref } from 'react';\n\nimport { useHover } from '../../hooks';\nimport { colors } from '../../theme/modules/colors';\n\nimport { ViewTabProps, ViewTabTypes } from './types';\n\nimport {\n Contour,\n CounterContainer,\n CounterText,\n CrossIconStyling,\n CustomIconWrapper,\n IconStyling,\n Text,\n ThreeDotsIconStyling,\n ViewButton,\n} from './styled';\nimport { buildClassnames } from '../../utils/buildClassnames';\n\nexport interface ClassNamesReturnPayload {\n delete?: string;\n edit?: string;\n container?: string;\n active?: string;\n counter?: string;\n}\n\nconst generateClassNames = (prefix?: string): ClassNamesReturnPayload => ({\n delete: prefix ? `${prefix}-delete` : undefined,\n edit: prefix ? `${prefix}-edit` : undefined,\n container: prefix ? `${prefix}-view` : undefined,\n active: prefix ? `${prefix}-active` : undefined,\n counter: prefix ? `${prefix}-counter` : undefined,\n});\n\nexport const ViewTab = React.forwardRef<HTMLButtonElement, ViewTabProps>(\n (\n {\n id,\n iconSlot,\n name,\n type,\n className,\n colourPalette = colors.secondary.blue,\n customTextColour,\n count,\n countSlot,\n active = false,\n onClick,\n subAction,\n ariaContext,\n ariaDescribedBy,\n ...props\n }: ViewTabProps,\n ref: Ref<HTMLButtonElement>,\n ) => {\n const classNames = generateClassNames(className);\n const [isHovered, handleEnter, handleLeave] = useHover();\n\n const action = active && subAction ? subAction : onClick;\n const handleAction = () => action(id);\n\n const isDraft = type === ViewTabTypes.draft;\n const isSaved = type === ViewTabTypes.saved;\n\n const getLabelAction = () => {\n if (active && isDraft) return 'Delete';\n if (active && isSaved) return 'Edit';\n return '';\n };\n\n return (\n <ViewButton\n className={buildClassnames([classNames?.container])}\n onClick={handleAction}\n role=\"tab\"\n aria-selected={active}\n aria-label={`${getLabelAction()} ${name} view ${\n count && ariaContext ? `with ${count} ${ariaContext}` : ''\n }`}\n customTextColour={customTextColour}\n ref={ref}\n aria-describedby={ariaDescribedBy}\n {...props}\n >\n <Contour\n active={active}\n onMouseEnter={handleEnter}\n onMouseLeave={handleLeave}\n colourPalette={colourPalette}\n customTextColour={customTextColour}\n >\n {iconSlot && <CustomIconWrapper>{iconSlot}</CustomIconWrapper>}\n <Text variant=\"bodyBold\">{name}</Text>\n {(countSlot || (count !== undefined && count !== null)) && (\n <CounterContainer\n data-testid=\"countContainer\"\n active={active || isHovered}\n colourPalette={colourPalette}\n customTextColour={customTextColour}\n >\n {countSlot || <CounterText variant=\"subheadingSmall\">{count}</CounterText>}\n </CounterContainer>\n )}\n {isDraft && <CrossIconStyling {...IconStyling} aria-label=\"delete icon\" />}\n {isSaved && active && <ThreeDotsIconStyling {...IconStyling} aria-label=\"edit icon\" />}\n </Contour>\n </ViewButton>\n );\n },\n);\n"],"names":["React","colors","useHover","ViewTabTypes","ViewButton","buildClassnames","Contour","CustomIconWrapper","Text","CounterContainer","CounterText","CrossIconStyling","IconStyling","ThreeDotsIconStyling"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,MAAM,kBAAkB,GAAG,CAAC,MAAe,MAA+B;IACxE,MAAM,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAS,OAAA,CAAA,GAAG,SAAS;IAC/C,IAAI,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAO,KAAA,CAAA,GAAG,SAAS;IAC3C,SAAS,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAO,KAAA,CAAA,GAAG,SAAS;IAChD,MAAM,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAS,OAAA,CAAA,GAAG,SAAS;IAC/C,OAAO,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}
@@ -15,7 +15,9 @@ export declare const ViewTab: React.ForwardRefExoticComponent<Omit<React.ButtonH
15
15
  id: string;
16
16
  type?: "fixed" | "saved" | "draft" | undefined;
17
17
  count?: string | number | null | undefined;
18
+ countSlot?: React.ReactNode;
18
19
  onClick: (id: string) => void;
19
20
  subAction?: ((id: string) => void) | undefined;
20
- ariaContext: string;
21
+ ariaContext?: string | undefined;
22
+ ariaDescribedBy?: string | undefined;
21
23
  } & React.RefAttributes<HTMLButtonElement>>;
@@ -16,7 +16,7 @@ const generateClassNames = (prefix) => ({
16
16
  active: prefix ? `${prefix}-active` : undefined,
17
17
  counter: prefix ? `${prefix}-counter` : undefined,
18
18
  });
19
- const ViewTab = React__default.forwardRef(({ id, iconSlot, name, type, className, colourPalette = colors.secondary.blue, customTextColour, count, active = false, onClick, subAction, ariaContext, ...props }, ref) => {
19
+ const ViewTab = React__default.forwardRef(({ id, iconSlot, name, type, className, colourPalette = colors.secondary.blue, customTextColour, count, countSlot, active = false, onClick, subAction, ariaContext, ariaDescribedBy, ...props }, ref) => {
20
20
  const classNames = generateClassNames(className);
21
21
  const [isHovered, handleEnter, handleLeave] = useHover();
22
22
  const action = active && subAction ? subAction : onClick;
@@ -30,12 +30,11 @@ const ViewTab = React__default.forwardRef(({ id, iconSlot, name, type, className
30
30
  return 'Edit';
31
31
  return '';
32
32
  };
33
- return (React__default.createElement(ViewButton, { className: buildClassnames([classNames === null || classNames === undefined ? undefined : classNames.container]), onClick: handleAction, role: "tab", "aria-selected": active, "aria-label": `${getLabelAction()} ${name} view ${count ? `with ${count} ${ariaContext}` : ''}`, customTextColour: customTextColour, ref: ref, ...props },
33
+ return (React__default.createElement(ViewButton, { className: buildClassnames([classNames === null || classNames === undefined ? undefined : classNames.container]), onClick: handleAction, role: "tab", "aria-selected": active, "aria-label": `${getLabelAction()} ${name} view ${count && ariaContext ? `with ${count} ${ariaContext}` : ''}`, customTextColour: customTextColour, ref: ref, "aria-describedby": ariaDescribedBy, ...props },
34
34
  React__default.createElement(Contour, { active: active, onMouseEnter: handleEnter, onMouseLeave: handleLeave, colourPalette: colourPalette, customTextColour: customTextColour },
35
35
  iconSlot && React__default.createElement(CustomIconWrapper, null, iconSlot),
36
36
  React__default.createElement(Text, { variant: "bodyBold" }, name),
37
- count !== undefined && count !== null && (React__default.createElement(CounterContainer, { "data-testid": "countContainer", active: active || isHovered, colourPalette: colourPalette, customTextColour: customTextColour },
38
- React__default.createElement(CounterText, { variant: "subheadingSmall" }, count))),
37
+ (countSlot || (count !== undefined && count !== null)) && (React__default.createElement(CounterContainer, { "data-testid": "countContainer", active: active || isHovered, colourPalette: colourPalette, customTextColour: customTextColour }, countSlot || React__default.createElement(CounterText, { variant: "subheadingSmall" }, count))),
39
38
  isDraft && React__default.createElement(CrossIconStyling, { ...IconStyling, "aria-label": "delete icon" }),
40
39
  isSaved && active && React__default.createElement(ThreeDotsIconStyling, { ...IconStyling, "aria-label": "edit icon" }))));
41
40
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ViewTab.js","sources":["../../../src/components/ViewTab/ViewTab.tsx"],"sourcesContent":["import React, { Ref } from 'react';\n\nimport { useHover } from '../../hooks';\nimport { colors } from '../../theme/modules/colors';\n\nimport { ViewTabProps, ViewTabTypes } from './types';\n\nimport {\n Contour,\n CounterContainer,\n CounterText,\n CrossIconStyling,\n CustomIconWrapper,\n IconStyling,\n Text,\n ThreeDotsIconStyling,\n ViewButton,\n} from './styled';\nimport { buildClassnames } from '../../utils/buildClassnames';\n\nexport interface ClassNamesReturnPayload {\n delete?: string;\n edit?: string;\n container?: string;\n active?: string;\n counter?: string;\n}\n\nconst generateClassNames = (prefix?: string): ClassNamesReturnPayload => ({\n delete: prefix ? `${prefix}-delete` : undefined,\n edit: prefix ? `${prefix}-edit` : undefined,\n container: prefix ? `${prefix}-view` : undefined,\n active: prefix ? `${prefix}-active` : undefined,\n counter: prefix ? `${prefix}-counter` : undefined,\n});\n\nexport const ViewTab = React.forwardRef<HTMLButtonElement, ViewTabProps>(\n (\n {\n id,\n iconSlot,\n name,\n type,\n className,\n colourPalette = colors.secondary.blue,\n customTextColour,\n count,\n active = false,\n onClick,\n subAction,\n ariaContext,\n ...props\n }: ViewTabProps,\n ref: Ref<HTMLButtonElement>,\n ) => {\n const classNames = generateClassNames(className);\n const [isHovered, handleEnter, handleLeave] = useHover();\n\n const action = active && subAction ? subAction : onClick;\n const handleAction = () => action(id);\n\n const isDraft = type === ViewTabTypes.draft;\n const isSaved = type === ViewTabTypes.saved;\n\n const getLabelAction = () => {\n if (active && isDraft) return 'Delete';\n if (active && isSaved) return 'Edit';\n return '';\n };\n\n return (\n <ViewButton\n className={buildClassnames([classNames?.container])}\n onClick={handleAction}\n role=\"tab\"\n aria-selected={active}\n aria-label={`${getLabelAction()} ${name} view ${\n count ? `with ${count} ${ariaContext}` : ''\n }`}\n customTextColour={customTextColour}\n ref={ref}\n {...props}\n >\n <Contour\n active={active}\n onMouseEnter={handleEnter}\n onMouseLeave={handleLeave}\n colourPalette={colourPalette}\n customTextColour={customTextColour}\n >\n {iconSlot && <CustomIconWrapper>{iconSlot}</CustomIconWrapper>}\n <Text variant=\"bodyBold\">{name}</Text>\n {count !== undefined && count !== null && (\n <CounterContainer\n data-testid=\"countContainer\"\n active={active || isHovered}\n colourPalette={colourPalette}\n customTextColour={customTextColour}\n >\n <CounterText variant=\"subheadingSmall\">{count}</CounterText>\n </CounterContainer>\n )}\n {isDraft && <CrossIconStyling {...IconStyling} aria-label=\"delete icon\" />}\n {isSaved && active && <ThreeDotsIconStyling {...IconStyling} aria-label=\"edit icon\" />}\n </Contour>\n </ViewButton>\n );\n },\n);\n"],"names":["React"],"mappings":";;;;;;;;;;;AA4BA,MAAM,kBAAkB,GAAG,CAAC,MAAe,MAA+B;IACxE,MAAM,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAS,OAAA,CAAA,GAAG,SAAS;IAC/C,IAAI,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAO,KAAA,C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,WAAW,EAAA,YAAA,EAAa,WAAW,EAAA,CAAG,CAC9E,CACC;AAEjB,CAAC;;;;"}
1
+ {"version":3,"file":"ViewTab.js","sources":["../../../src/components/ViewTab/ViewTab.tsx"],"sourcesContent":["import React, { Ref } from 'react';\n\nimport { useHover } from '../../hooks';\nimport { colors } from '../../theme/modules/colors';\n\nimport { ViewTabProps, ViewTabTypes } from './types';\n\nimport {\n Contour,\n CounterContainer,\n CounterText,\n CrossIconStyling,\n CustomIconWrapper,\n IconStyling,\n Text,\n ThreeDotsIconStyling,\n ViewButton,\n} from './styled';\nimport { buildClassnames } from '../../utils/buildClassnames';\n\nexport interface ClassNamesReturnPayload {\n delete?: string;\n edit?: string;\n container?: string;\n active?: string;\n counter?: string;\n}\n\nconst generateClassNames = (prefix?: string): ClassNamesReturnPayload => ({\n delete: prefix ? `${prefix}-delete` : undefined,\n edit: prefix ? `${prefix}-edit` : undefined,\n container: prefix ? `${prefix}-view` : undefined,\n active: prefix ? `${prefix}-active` : undefined,\n counter: prefix ? `${prefix}-counter` : undefined,\n});\n\nexport const ViewTab = React.forwardRef<HTMLButtonElement, ViewTabProps>(\n (\n {\n id,\n iconSlot,\n name,\n type,\n className,\n colourPalette = colors.secondary.blue,\n customTextColour,\n count,\n countSlot,\n active = false,\n onClick,\n subAction,\n ariaContext,\n ariaDescribedBy,\n ...props\n }: ViewTabProps,\n ref: Ref<HTMLButtonElement>,\n ) => {\n const classNames = generateClassNames(className);\n const [isHovered, handleEnter, handleLeave] = useHover();\n\n const action = active && subAction ? subAction : onClick;\n const handleAction = () => action(id);\n\n const isDraft = type === ViewTabTypes.draft;\n const isSaved = type === ViewTabTypes.saved;\n\n const getLabelAction = () => {\n if (active && isDraft) return 'Delete';\n if (active && isSaved) return 'Edit';\n return '';\n };\n\n return (\n <ViewButton\n className={buildClassnames([classNames?.container])}\n onClick={handleAction}\n role=\"tab\"\n aria-selected={active}\n aria-label={`${getLabelAction()} ${name} view ${\n count && ariaContext ? `with ${count} ${ariaContext}` : ''\n }`}\n customTextColour={customTextColour}\n ref={ref}\n aria-describedby={ariaDescribedBy}\n {...props}\n >\n <Contour\n active={active}\n onMouseEnter={handleEnter}\n onMouseLeave={handleLeave}\n colourPalette={colourPalette}\n customTextColour={customTextColour}\n >\n {iconSlot && <CustomIconWrapper>{iconSlot}</CustomIconWrapper>}\n <Text variant=\"bodyBold\">{name}</Text>\n {(countSlot || (count !== undefined && count !== null)) && (\n <CounterContainer\n data-testid=\"countContainer\"\n active={active || isHovered}\n colourPalette={colourPalette}\n customTextColour={customTextColour}\n >\n {countSlot || <CounterText variant=\"subheadingSmall\">{count}</CounterText>}\n </CounterContainer>\n )}\n {isDraft && <CrossIconStyling {...IconStyling} aria-label=\"delete icon\" />}\n {isSaved && active && <ThreeDotsIconStyling {...IconStyling} aria-label=\"edit icon\" />}\n </Contour>\n </ViewButton>\n );\n },\n);\n"],"names":["React"],"mappings":";;;;;;;;;;;AA4BA,MAAM,kBAAkB,GAAG,CAAC,MAAe,MAA+B;IACxE,MAAM,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAS,OAAA,CAAA,GAAG,SAAS;IAC/C,IAAI,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAO,KAAA,CAAA,GAAG,SAAS;IAC3C,SAAS,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAO,KAAA,CAAA,GAAG,SAAS;IAChD,MAAM,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAS,OAAA,CAAA,GAAG,SAAS;IAC/C,OAAO,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAU,QAAA,CAAA,GAAG,SAAS;AAClD,CAAA,CAAC;AAEW,MAAA,OAAO,GAAGA,cAAK,CAAC,UAAU,CACrC,CACE,EACE,EAAE,EACF,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,EACrC,gBAAgB,EAChB,KAAK,EACL,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,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,WAAW,EACzB,YAAY,EAAE,WAAW,EACzB,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAAA;AAEjC,YAAA,QAAQ,IAAIA,cAAA,CAAA,aAAA,CAAC,iBAAiB,EAAA,IAAA,EAAE,QAAQ,CAAqB;AAC9D,YAAAA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAC,EAAA,OAAO,EAAC,UAAU,EAAA,EAAE,IAAI,CAAQ;YACrC,CAAC,SAAS,KAAK,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,MACpDA,cAAC,CAAA,aAAA,CAAA,gBAAgB,mBACH,gBAAgB,EAC5B,MAAM,EAAE,MAAM,IAAI,SAAS,EAC3B,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAEjC,EAAA,SAAS,IAAIA,cAAC,CAAA,aAAA,CAAA,WAAW,IAAC,OAAO,EAAC,iBAAiB,EAAE,EAAA,KAAK,CAAe,CACzD,CACpB;AACA,YAAA,OAAO,IAAIA,cAAC,CAAA,aAAA,CAAA,gBAAgB,OAAK,WAAW,EAAA,YAAA,EAAa,aAAa,EAAG,CAAA;AACzE,YAAA,OAAO,IAAI,MAAM,IAAIA,cAAA,CAAA,aAAA,CAAC,oBAAoB,EAAA,EAAA,GAAK,WAAW,EAAA,YAAA,EAAa,WAAW,EAAA,CAAG,CAC9E,CACC;AAEjB,CAAC;;;;"}
@@ -18,11 +18,22 @@ var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
18
18
  const CounterText = styled__default.default(Text.Text).withConfig({ displayName: "vui--CounterText", componentId: "vui--13z4q4k" }) `line-height:1;`;
19
19
  const ThreeDotsIconStyling = styled__default.default(ThreeDotsIcon.ThreeDotsIcon).withConfig({ displayName: "vui--ThreeDotsIconStyling", componentId: "vui--lo8tpb" }) ``;
20
20
  const CrossIconStyling = styled__default.default(CrossIcon.ReactComponent).withConfig({ displayName: "vui--CrossIconStyling", componentId: "vui--u5oj4b" }) ``;
21
- const CounterContainer = styled__default.default(Text.Text).withConfig({ displayName: "vui--CounterContainer", componentId: "vui--1nbpnol" }) `display:inline-flex;flex-direction:row;justify-content:center;align-items:center;border-radius:4px;padding:2px 4px;min-width:20px;height:20px;margin-left:8px;${({ active, colourPalette }) => active &&
21
+ const CounterContainer = styled__default.default.div.withConfig({ displayName: "vui--CounterContainer", componentId: "vui--1nbpnol" }) `display:inline-flex;flex-direction:row;justify-content:center;align-items:center;border-radius:4px;padding:2px 4px;min-width:20px;height:20px;margin-left:8px;${({ active, colourPalette }) => active &&
22
22
  `
23
23
  background-color: ${colourPalette.dark};
24
24
 
25
- & > ${CounterText} {
25
+ & ${CounterText} {
26
+ color: ${colors.colors.neutral.grey.lightest};
27
+ }
28
+
29
+ /* Force all text elements to be white when active, used when using slot */
30
+ & ${Text.Text} {
31
+ color: ${colors.colors.neutral.grey.lightest} !important;
32
+ }
33
+
34
+ /* Force all SVG icons to be white when active, used when using slot */
35
+ & svg {
36
+ fill: ${colors.colors.neutral.grey.lightest};
26
37
  color: ${colors.colors.neutral.grey.lightest};
27
38
  }
28
39
  `}`;
@@ -35,6 +46,13 @@ const Contour = styled__default.default(BaseContainer.BaseContainer).withConfig(
35
46
  & > ${CounterText} {
36
47
  color: ${colors.colors.neutral.ink.base};
37
48
  }
49
+ & ${Text.Text} {
50
+ color: ${colors.colors.neutral.ink.base} !important;
51
+ }
52
+ & svg {
53
+ fill: ${colors.colors.neutral.ink.base};
54
+ color: ${colors.colors.neutral.ink.base};
55
+ }
38
56
  }
39
57
  & > ${Text.Text} {
40
58
  color: ${customTextColour !== null && customTextColour !== undefined ? customTextColour : colors.colors.neutral.ink.dark};
@@ -74,6 +92,13 @@ const ViewButton = styled__default.default(styled$1.FlatButton).withConfig({ dis
74
92
  & > ${CounterText} {
75
93
  color: ${colors.colors.neutral.ink.base};
76
94
  }
95
+ & ${Text.Text} {
96
+ color: ${colors.colors.neutral.ink.base} !important;
97
+ }
98
+ & svg {
99
+ fill: ${colors.colors.neutral.ink.base};
100
+ color: ${colors.colors.neutral.ink.base};
101
+ }
77
102
  }
78
103
  & > ${Text.Text} {
79
104
  color: ${customTextColour !== null && customTextColour !== undefined ? customTextColour : colors.colors.neutral.ink.dark};
@@ -1 +1 @@
1
- {"version":3,"file":"styled.cjs","sources":["../../../src/components/ViewTab/styled.ts"],"sourcesContent":["import styled from 'styled-components';\n\nimport { CSSProperties } from 'react';\nimport { ColourPalette, colors } from '../../theme/modules/colors';\n\nimport { Text } from '../Text';\nimport { BaseContainer } from '../BaseContainer';\n\nimport { ViewTabProps } from './types';\nimport { sizes } from '../../theme/modules/sizes';\nimport { ThreeDotsIcon, CrossIcon } from '../../icons';\nimport { FlatButton } from '../Button/components/styled';\nimport { theme } from '../../theme';\n\ntype RequiredPalette = { colourPalette: ColourPalette };\nexport type ContourProps = Pick<ViewTabProps, 'active' | 'customTextColour'> & RequiredPalette;\nexport type CounterProps = Pick<ViewTabProps, 'active' | 'customTextColour'> & RequiredPalette;\nexport type ViewButtonProps = Pick<ViewTabProps, 'customTextColour'>;\n\nconst CounterText = styled(Text)`\n line-height: 1;\n`;\n\nconst ThreeDotsIconStyling = styled(ThreeDotsIcon)``;\nconst CrossIconStyling = styled(CrossIcon)``;\n\nconst CounterContainer = styled(Text)<CounterProps>`\n display: inline-flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n border-radius: 4px;\n padding: 2px 4px;\n min-width: 20px;\n height: 20px;\n margin-left: 8px;\n\n ${({ active, colourPalette }) =>\n active &&\n `\n background-color: ${colourPalette.dark};\n\n & > ${CounterText} {\n color: ${colors.neutral.grey.lightest};\n }\n `}\n`;\n\nconst Contour = styled(BaseContainer)<ContourProps>`\n position: relative;\n display: flex;\n flex-direction: row;\n align-items: center;\n height: 40px;\n border-radius: 4px;\n padding: ${theme.sizes.sm};\n border: 1px solid transparent;\n cursor: pointer;\n background-color: transparent;\n\n ${({ customTextColour }) => `\n\n &:hover {\n background-color: ${colors.neutral.grey.base};\n & > ${CounterContainer} {\n background-color: ${colors.neutral.grey.base};\n & > ${CounterText} {\n color: ${colors.neutral.ink.base};\n }\n }\n & > ${Text} {\n color: ${customTextColour ?? colors.neutral.ink.dark};\n }\n & > ${ThreeDotsIconStyling} {\n color: ${colors.neutral.ink.dark};\n }\n & > ${CrossIconStyling} {\n color: ${colors.neutral.ink.dark};\n }\n }\n\n & > ${Text} {\n color: ${customTextColour ?? colors.neutral.ink.dark};\n }\n `}\n\n ${({ active, colourPalette, customTextColour }) =>\n active &&\n `\n background-color: ${colourPalette.lightest};\n\n & > ${ThreeDotsIconStyling} {\n color: ${colourPalette.dark};\n }\n & > ${CrossIconStyling} {\n color: ${colourPalette.dark};\n }\n\n & > ${Text} {\n color: ${customTextColour ?? colourPalette.dark};\n }\n `}\n`;\n\nconst ViewButton = styled(FlatButton)<ViewButtonProps>`\n padding: ${theme.sizes.sm};\n box-sizing: border-box;\n border-radius: 4px;\n border: none;\n position: relative;\n margin: 0;\n padding: 0;\n\n ${({ customTextColour }) => `\n &:focus-visible {\n ${Contour} {\n background-color: ${colors.neutral.grey.base};\n & > ${CounterContainer} {\n background-color: ${colors.neutral.grey.base};\n & > ${CounterText} {\n color: ${colors.neutral.ink.base};\n }\n }\n & > ${Text} {\n color: ${customTextColour ?? colors.neutral.ink.dark};\n }\n & > ${ThreeDotsIconStyling} {\n color: ${colors.neutral.ink.dark};\n }\n & > ${CrossIconStyling} {\n color: ${colors.neutral.ink.dark};\n }\n }\n `}\n`;\n\nconst IconStyling = {\n style: {\n marginLeft: sizes.xs,\n padding: sizes.xs,\n height: sizes.base,\n width: sizes.base,\n } as CSSProperties,\n};\n\nexport const CustomIconWrapper = styled.div`\n display: flex;\n align-items: center;\n margin-right: ${sizes.sm};\n\n svg {\n height: ${sizes.base};\n width: ${sizes.base};\n }\n`;\n\nexport {\n ViewButton,\n Contour,\n Text,\n CounterContainer,\n CounterText,\n IconStyling,\n Thre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AAA;;YAEhD,oBAAoB,CAAA;AACf,eAAA,EAAAA,aAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA;;YAE5B,gBAAgB,CAAA;AACX,eAAA,EAAAA,aAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA;;;AAGrC,EAAA,CAAA,CAAA;AAGH,MAAM,WAAW,GAAG;AAClB,IAAA,KAAK,EAAE;QACL,UAAU,EAAEI,WAAK,CAAC,EAAE;QACpB,OAAO,EAAEA,WAAK,CAAC,EAAE;QACjB,MAAM,EAAEA,WAAK,CAAC,IAAI;QAClB,KAAK,EAAEA,WAAK,CAAC,IAAI;AACD,KAAA;;MAGP,iBAAiB,GAAGR,uBAAM,CAAC,GAAG,oIAGzBQ,WAAK,CAAC,EAAE,CAGZ,YAAA,EAAAA,WAAK,CAAC,IAAI,CAAA,OAAA,EACXA,WAAK,CAAC,IAAI;;;;;;;;;;;;"}
1
+ {"version":3,"file":"styled.cjs","sources":["../../../src/components/ViewTab/styled.ts"],"sourcesContent":["import styled from 'styled-components';\n\nimport { CSSProperties } from 'react';\nimport { ColourPalette, colors } from '../../theme/modules/colors';\n\nimport { Text } from '../Text';\nimport { BaseContainer } from '../BaseContainer';\n\nimport { ViewTabProps } from './types';\nimport { sizes } from '../../theme/modules/sizes';\nimport { ThreeDotsIcon, CrossIcon } from '../../icons';\nimport { FlatButton } from '../Button/components/styled';\nimport { theme } from '../../theme';\n\ntype RequiredPalette = { colourPalette: ColourPalette };\nexport type ContourProps = Pick<ViewTabProps, 'active' | 'customTextColour'> & RequiredPalette;\nexport type CounterProps = Pick<ViewTabProps, 'active' | 'customTextColour'> & RequiredPalette;\nexport type ViewButtonProps = Pick<ViewTabProps, 'customTextColour'>;\n\nconst CounterText = styled(Text)`\n line-height: 1;\n`;\n\nconst ThreeDotsIconStyling = styled(ThreeDotsIcon)``;\nconst CrossIconStyling = styled(CrossIcon)``;\n\nconst CounterContainer = styled.div<CounterProps>`\n display: inline-flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n border-radius: 4px;\n padding: 2px 4px;\n min-width: 20px;\n height: 20px;\n margin-left: 8px;\n\n ${({ active, colourPalette }) =>\n active &&\n `\n background-color: ${colourPalette.dark};\n\n & ${CounterText} {\n color: ${colors.neutral.grey.lightest};\n }\n\n /* Force all text elements to be white when active, used when using slot */\n & ${Text} {\n color: ${colors.neutral.grey.lightest} !important;\n }\n\n /* Force all SVG icons to be white when active, used when using slot */\n & svg {\n fill: ${colors.neutral.grey.lightest};\n color: ${colors.neutral.grey.lightest};\n }\n `}\n`;\n\nconst Contour = styled(BaseContainer)<ContourProps>`\n position: relative;\n display: flex;\n flex-direction: row;\n align-items: center;\n height: 40px;\n border-radius: 4px;\n padding: ${theme.sizes.sm};\n border: 1px solid transparent;\n cursor: pointer;\n background-color: transparent;\n\n ${({ customTextColour }) => `\n\n &:hover {\n background-color: ${colors.neutral.grey.base};\n & > ${CounterContainer} {\n background-color: ${colors.neutral.grey.base};\n & > ${CounterText} {\n color: ${colors.neutral.ink.base};\n }\n & ${Text} {\n color: ${colors.neutral.ink.base} !important;\n }\n & svg {\n fill: ${colors.neutral.ink.base};\n color: ${colors.neutral.ink.base};\n }\n }\n & > ${Text} {\n color: ${customTextColour ?? colors.neutral.ink.dark};\n }\n & > ${ThreeDotsIconStyling} {\n color: ${colors.neutral.ink.dark};\n }\n & > ${CrossIconStyling} {\n color: ${colors.neutral.ink.dark};\n }\n }\n\n & > ${Text} {\n color: ${customTextColour ?? colors.neutral.ink.dark};\n }\n `}\n\n ${({ active, colourPalette, customTextColour }) =>\n active &&\n `\n background-color: ${colourPalette.lightest};\n\n & > ${ThreeDotsIconStyling} {\n color: ${colourPalette.dark};\n }\n & > ${CrossIconStyling} {\n color: ${colourPalette.dark};\n }\n\n & > ${Text} {\n color: ${customTextColour ?? colourPalette.dark};\n }\n `}\n`;\n\nconst ViewButton = styled(FlatButton)<ViewButtonProps>`\n padding: ${theme.sizes.sm};\n box-sizing: border-box;\n border-radius: 4px;\n border: none;\n position: relative;\n margin: 0;\n padding: 0;\n\n ${({ customTextColour }) => `\n &:focus-visible {\n ${Contour} {\n background-color: ${colors.neutral.grey.base};\n & > ${CounterContainer} {\n background-color: ${colors.neutral.grey.base};\n & > ${CounterText} {\n color: ${colors.neutral.ink.base};\n }\n & ${Text} {\n color: ${colors.neutral.ink.base} !important;\n }\n & svg {\n fill: ${colors.neutral.ink.base};\n color: ${colors.neutral.ink.base};\n }\n }\n & > ${Text} {\n color: ${customTextColour ?? colors.neutral.ink.dark};\n }\n & > ${ThreeDotsIconStyling} {\n color: ${colors.neutral.ink.dark};\n }\n & > ${CrossIconStyling} {\n color: ${colors.neutral.ink.dark};\n }\n }\n `}\n`;\n\nconst IconStyling = {\n style: {\n marginLeft: sizes.xs,\n padding: sizes.xs,\n height: sizes.base,\n width: sizes.base,\n } as CSSProperties,\n};\n\nexport const CustomIconWrapper = styled.div`\n display: flex;\n align-items: center;\n margin-right: ${sizes.sm};\n\n svg {\n height: ${sizes.base};\n width: ${sizes.base};\n }\n`;\n\nexport {\n ViewButton,\n Contour,\n Text,\n CounterContainer,\n CounterText,\n IconStyling,\n ThreeDotsIconStyling,\n CrossIconStyling,\n};\n"],"names":["styled","Text","ThreeDotsIcon","CrossIcon","colors","BaseContainer","theme","FlatButton","sizes"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,MAAM,WAAW,GAAGA,uBAAM,CAACC,SAAI,CAAC;AAIhC,MAAM,oBAAoB,GAAGD,uBAAM,CAACE,2BAAa,CAAC;AAClD,MAAM,gBAAgB,GAAGF,uBAAM,CAACG,wBAAS,CAAC;AAE1C,MAAM,gBAAgB,GAAGH,uBAAM,CAAC,GAAG,CAW/B,UAAA,CAAA,EAAA,WAAA,EAAA,uBAAA,EAAA,WAAA,EAAA,cAAA,EAAA,CAAA,CAAA,CAAA,8JAAA,EAAA,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,KAC1B,MAAM;AACN,IAAA;AACsB,wB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AAO,CAAC,GAAG,CAAC,IAAI,CAAA;;;YAG9BH,SAAI,CAAA;iBACC,gBAAgB,KAAA,IAAA,IAAhB,gBAAgB,KAAA,SAAA,GAAhB,gBAAgB,GAAIG,aAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA;;YAEhD,oBAAoB,CAAA;AACf,eAAA,EAAAA,aAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA;;YAE5B,gBAAgB,CAAA;AACX,eAAA,EAAAA,aAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA;;;AAGrC,EAAA,CAAA,CAAA;AAGH,MAAM,WAAW,GAAG;AAClB,IAAA,KAAK,EAAE;QACL,UAAU,EAAEI,WAAK,CAAC,EAAE;QACpB,OAAO,EAAEA,WAAK,CAAC,EAAE;QACjB,MAAM,EAAEA,WAAK,CAAC,IAAI;QAClB,KAAK,EAAEA,WAAK,CAAC,IAAI;AACD,KAAA;;MAGP,iBAAiB,GAAGR,uBAAM,CAAC,GAAG,oIAGzBQ,WAAK,CAAC,EAAE,CAGZ,YAAA,EAAAA,WAAK,CAAC,IAAI,CAAA,OAAA,EACXA,WAAK,CAAC,IAAI;;;;;;;;;;;;"}
@@ -11,7 +11,7 @@ export type ViewButtonProps = Pick<ViewTabProps, 'customTextColour'>;
11
11
  declare const CounterText: import("styled-components").StyledComponent<"span", any, {} & import("../Text/types").TextProps, never>;
12
12
  declare const ThreeDotsIconStyling: import("styled-components").StyledComponent<(props: import("../../icons/types").IconComponentProps) => import("react").JSX.Element, any, {}, never>;
13
13
  declare const CrossIconStyling: import("styled-components").StyledComponent<(props: import("react").SVGProps<SVGSVGElement>) => import("react").JSX.Element, any, {}, never>;
14
- declare const CounterContainer: import("styled-components").StyledComponent<"span", any, ({} & import("../Text/types").TextProps) & Pick<ViewTabProps, "active" | "customTextColour"> & RequiredPalette, never>;
14
+ declare const CounterContainer: import("styled-components").StyledComponent<"div", any, Pick<ViewTabProps, "active" | "customTextColour"> & RequiredPalette, never>;
15
15
  declare const Contour: import("styled-components").StyledComponent<"div", any, Pick<ViewTabProps, "active" | "customTextColour"> & RequiredPalette, never>;
16
16
  declare const ViewButton: import("styled-components").StyledComponent<any, any, object & ViewButtonProps, string | number | symbol>;
17
17
  declare const IconStyling: {
@@ -12,11 +12,22 @@ import { theme } from '../../theme/index.js';
12
12
  const CounterText = styled(Text).withConfig({ displayName: "vui--CounterText", componentId: "vui--13z4q4k" }) `line-height:1;`;
13
13
  const ThreeDotsIconStyling = styled(ThreeDotsIcon).withConfig({ displayName: "vui--ThreeDotsIconStyling", componentId: "vui--lo8tpb" }) ``;
14
14
  const CrossIconStyling = styled(CrossIcon).withConfig({ displayName: "vui--CrossIconStyling", componentId: "vui--u5oj4b" }) ``;
15
- const CounterContainer = styled(Text).withConfig({ displayName: "vui--CounterContainer", componentId: "vui--1nbpnol" }) `display:inline-flex;flex-direction:row;justify-content:center;align-items:center;border-radius:4px;padding:2px 4px;min-width:20px;height:20px;margin-left:8px;${({ active, colourPalette }) => active &&
15
+ const CounterContainer = styled.div.withConfig({ displayName: "vui--CounterContainer", componentId: "vui--1nbpnol" }) `display:inline-flex;flex-direction:row;justify-content:center;align-items:center;border-radius:4px;padding:2px 4px;min-width:20px;height:20px;margin-left:8px;${({ active, colourPalette }) => active &&
16
16
  `
17
17
  background-color: ${colourPalette.dark};
18
18
 
19
- & > ${CounterText} {
19
+ & ${CounterText} {
20
+ color: ${colors.neutral.grey.lightest};
21
+ }
22
+
23
+ /* Force all text elements to be white when active, used when using slot */
24
+ & ${Text} {
25
+ color: ${colors.neutral.grey.lightest} !important;
26
+ }
27
+
28
+ /* Force all SVG icons to be white when active, used when using slot */
29
+ & svg {
30
+ fill: ${colors.neutral.grey.lightest};
20
31
  color: ${colors.neutral.grey.lightest};
21
32
  }
22
33
  `}`;
@@ -29,6 +40,13 @@ const Contour = styled(BaseContainer).withConfig({ displayName: "vui--Contour",
29
40
  & > ${CounterText} {
30
41
  color: ${colors.neutral.ink.base};
31
42
  }
43
+ & ${Text} {
44
+ color: ${colors.neutral.ink.base} !important;
45
+ }
46
+ & svg {
47
+ fill: ${colors.neutral.ink.base};
48
+ color: ${colors.neutral.ink.base};
49
+ }
32
50
  }
33
51
  & > ${Text} {
34
52
  color: ${customTextColour !== null && customTextColour !== undefined ? customTextColour : colors.neutral.ink.dark};
@@ -68,6 +86,13 @@ const ViewButton = styled(FlatButton).withConfig({ displayName: "vui--ViewButton
68
86
  & > ${CounterText} {
69
87
  color: ${colors.neutral.ink.base};
70
88
  }
89
+ & ${Text} {
90
+ color: ${colors.neutral.ink.base} !important;
91
+ }
92
+ & svg {
93
+ fill: ${colors.neutral.ink.base};
94
+ color: ${colors.neutral.ink.base};
95
+ }
71
96
  }
72
97
  & > ${Text} {
73
98
  color: ${customTextColour !== null && customTextColour !== undefined ? customTextColour : colors.neutral.ink.dark};