@hitachivantara/uikit-react-core 5.82.3 → 5.82.4

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 (86) hide show
  1. package/dist/cjs/BaseDropdown/BaseDropdown.cjs +1 -1
  2. package/dist/cjs/Card/Card.cjs +1 -1
  3. package/dist/cjs/ColorPicker/Fields/Fields.cjs +4 -4
  4. package/dist/cjs/ColorPicker/Picker/Picker.cjs +11 -3
  5. package/dist/cjs/ColorPicker/Picker/Picker.styles.cjs +6 -1
  6. package/dist/cjs/Controls/context/ControlsContext.cjs +1 -3
  7. package/dist/cjs/DropDownMenu/DropDownMenu.cjs +1 -1
  8. package/dist/cjs/FormElement/Adornment/Adornment.cjs +1 -1
  9. package/dist/cjs/FormElement/Suggestions/Suggestions.cjs +1 -1
  10. package/dist/cjs/Grid/Grid.cjs +1 -1
  11. package/dist/cjs/ListContainer/ListContext/ListContext.cjs +1 -3
  12. package/dist/cjs/Select/Select.cjs +1 -3
  13. package/dist/cjs/Slider/Slider.cjs +2 -2
  14. package/dist/cjs/Snackbar/SnackbarContent/SnackbarContent.cjs +1 -1
  15. package/dist/cjs/SnackbarProvider/SnackbarProvider.cjs +1 -1
  16. package/dist/cjs/Table/TableBody/TableBody.cjs +10 -8
  17. package/dist/cjs/Table/TableCell/TableCell.cjs +2 -2
  18. package/dist/cjs/Table/TableContainer/TableContainer.cjs +9 -2
  19. package/dist/cjs/Table/TableHead/TableHead.cjs +10 -2
  20. package/dist/cjs/Table/TableHeader/TableHeader.cjs +2 -2
  21. package/dist/cjs/Table/TableRow/TableRow.cjs +2 -2
  22. package/dist/cjs/TableSection/TableSection.styles.cjs +6 -2
  23. package/dist/cjs/VerticalNavigation/TreeView/TreeViewItem.cjs +1 -1
  24. package/dist/cjs/hocs/withTooltip.cjs +40 -37
  25. package/dist/cjs/hooks/useIsMounted.cjs +2 -4
  26. package/dist/esm/BaseDropdown/BaseDropdown.js +1 -1
  27. package/dist/esm/BaseDropdown/BaseDropdown.js.map +1 -1
  28. package/dist/esm/Card/Card.js +1 -1
  29. package/dist/esm/Card/Card.js.map +1 -1
  30. package/dist/esm/ColorPicker/Fields/Fields.js +4 -4
  31. package/dist/esm/ColorPicker/Fields/Fields.js.map +1 -1
  32. package/dist/esm/ColorPicker/Picker/Picker.js +11 -3
  33. package/dist/esm/ColorPicker/Picker/Picker.js.map +1 -1
  34. package/dist/esm/ColorPicker/Picker/Picker.styles.js +6 -1
  35. package/dist/esm/ColorPicker/Picker/Picker.styles.js.map +1 -1
  36. package/dist/esm/Controls/context/ControlsContext.js +2 -2
  37. package/dist/esm/Controls/context/ControlsContext.js.map +1 -1
  38. package/dist/esm/Dialog/Dialog.js.map +1 -1
  39. package/dist/esm/DropDownMenu/DropDownMenu.js +1 -1
  40. package/dist/esm/DropDownMenu/DropDownMenu.js.map +1 -1
  41. package/dist/esm/EmptyState/EmptyState.js.map +1 -1
  42. package/dist/esm/FormElement/Adornment/Adornment.js +1 -1
  43. package/dist/esm/FormElement/Adornment/Adornment.js.map +1 -1
  44. package/dist/esm/FormElement/Suggestions/Suggestions.js +1 -1
  45. package/dist/esm/FormElement/Suggestions/Suggestions.js.map +1 -1
  46. package/dist/esm/GlobalActions/GlobalActions.js.map +1 -1
  47. package/dist/esm/Grid/Grid.js +1 -1
  48. package/dist/esm/Grid/Grid.js.map +1 -1
  49. package/dist/esm/InlineEditor/InlineEditor.js.map +1 -1
  50. package/dist/esm/List/List.js.map +1 -1
  51. package/dist/esm/ListContainer/ListContext/ListContext.js +2 -2
  52. package/dist/esm/ListContainer/ListContext/ListContext.js.map +1 -1
  53. package/dist/esm/Pagination/Pagination.js.map +1 -1
  54. package/dist/esm/Select/Select.js +1 -1
  55. package/dist/esm/Select/Select.js.map +1 -1
  56. package/dist/esm/Slider/Slider.js +2 -2
  57. package/dist/esm/Slider/Slider.js.map +1 -1
  58. package/dist/esm/Snackbar/SnackbarContent/SnackbarContent.js +1 -1
  59. package/dist/esm/Snackbar/SnackbarContent/SnackbarContent.js.map +1 -1
  60. package/dist/esm/SnackbarProvider/SnackbarProvider.js +1 -1
  61. package/dist/esm/SnackbarProvider/SnackbarProvider.js.map +1 -1
  62. package/dist/esm/Table/TableBody/TableBody.js +10 -8
  63. package/dist/esm/Table/TableBody/TableBody.js.map +1 -1
  64. package/dist/esm/Table/TableCell/TableCell.js +2 -2
  65. package/dist/esm/Table/TableCell/TableCell.js.map +1 -1
  66. package/dist/esm/Table/TableContainer/TableContainer.js +9 -2
  67. package/dist/esm/Table/TableContainer/TableContainer.js.map +1 -1
  68. package/dist/esm/Table/TableHead/TableHead.js +10 -2
  69. package/dist/esm/Table/TableHead/TableHead.js.map +1 -1
  70. package/dist/esm/Table/TableHeader/TableHeader.js +2 -2
  71. package/dist/esm/Table/TableHeader/TableHeader.js.map +1 -1
  72. package/dist/esm/Table/TableRow/TableRow.js +2 -2
  73. package/dist/esm/Table/TableRow/TableRow.js.map +1 -1
  74. package/dist/esm/TableSection/TableSection.styles.js +6 -2
  75. package/dist/esm/TableSection/TableSection.styles.js.map +1 -1
  76. package/dist/esm/TagsInput/TagsInput.js.map +1 -1
  77. package/dist/esm/TreeView/internals/utils/EventManager.js.map +1 -1
  78. package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.js +1 -1
  79. package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.js.map +1 -1
  80. package/dist/esm/hocs/withTooltip.js +40 -37
  81. package/dist/esm/hocs/withTooltip.js.map +1 -1
  82. package/dist/esm/hooks/useIsMounted.js +3 -3
  83. package/dist/esm/hooks/useIsMounted.js.map +1 -1
  84. package/dist/esm/utils/deepMerge.js.map +1 -1
  85. package/dist/types/index.d.ts +31 -31
  86. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"TableCell.js","sources":["../../../../src/Table/TableCell/TableCell.tsx"],"sourcesContent":["import { forwardRef, useContext } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { capitalize } from \"../../utils/helpers\";\nimport {\n HvTableCellAlign,\n HvTableCellType,\n HvTableCellVariant,\n} from \"../Table\";\nimport TableContext from \"../TableContext\";\nimport { TableSectionContext } from \"../TableSectionContext\";\nimport { staticClasses, useClasses } from \"./TableCell.styles\";\n\nexport { staticClasses as tableCellClasses };\n\nexport type HvTableCellClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableCellProps\n extends Omit<React.TdHTMLAttributes<HTMLTableCellElement>, \"align\"> {\n /** The component used for the root node. Either a string to use a HTML element or a component. Defaults to td. */\n component?: React.ElementType;\n /** Content to be rendered */\n children?: React.ReactNode;\n /** Inline styles to be applied to the root element. */\n style?: React.CSSProperties;\n /** Set the text-align on the table cell content. */\n align?: HvTableCellAlign;\n /** Sets the cell's variant. */\n variant?: HvTableCellVariant | \"listcheckbox\" | \"listactions\";\n /** Specify the cell's type. The prop defaults to the value inherited from the parent TableHead, TableBody, or TableFooter components. */\n type?: HvTableCellType;\n /** Whether or not the cell is part of a sorted column. */\n sorted?: boolean;\n /** The cell is part of a sticky column. */\n stickyColumn?: boolean;\n /** The cell is part of the last sticky to the left column. */\n stickyColumnMostLeft?: boolean;\n /** The cell is part of the first sticky to the right column. */\n stickyColumnLeastRight?: boolean;\n /** The cell is part of the first column in the group. */\n groupColumnMostLeft?: boolean;\n /** The cell is part of the last column in the group. */\n groupColumnMostRight?: boolean;\n /** Whether or not the cell is resizable */\n resizable?: boolean;\n /** Whether or not the cell is being resized */\n resizing?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableCellClasses;\n}\n\nconst defaultComponent = \"td\";\n\n/**\n * `HvTableCell` acts as a `td` element and inherits styles from its context\n */\nexport const HvTableCell = forwardRef<HTMLElement, HvTableCellProps>(\n (props, externalRef) => {\n const {\n children,\n component,\n className,\n style,\n classes: classesProp,\n align = \"inherit\",\n variant = \"default\",\n type: typeProp,\n stickyColumn = false,\n stickyColumnMostLeft = false,\n stickyColumnLeastRight = false,\n groupColumnMostLeft = false,\n groupColumnMostRight = false,\n sorted = false,\n resizable = false,\n resizing = false,\n ...others\n } = useDefaultProps(\"HvTableCell\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const type = typeProp || tableSectionContext?.type || \"body\";\n\n const Component =\n component || tableContext?.components?.Td || defaultComponent;\n\n return (\n <Component\n ref={externalRef}\n role={Component === defaultComponent ? null : \"cell\"}\n style={style}\n className={cx(\n classes.root,\n classes[type],\n align !== \"inherit\" && classes[`align${capitalize(align)}`],\n variant !== \"default\" && classes[`variant${capitalize(variant)}`],\n {\n [classes.variantList]: tableContext.variant === \"listrow\",\n [classes.variantListHead]:\n tableContext.variant === \"listrow\" && type !== \"body\",\n [classes.sorted]: sorted,\n [classes.stickyColumn]: stickyColumn,\n [classes.stickyColumnMostLeft]: stickyColumnMostLeft,\n [classes.stickyColumnLeastRight]: stickyColumnLeastRight,\n [classes.groupColumnMostLeft]: groupColumnMostLeft,\n [classes.groupColumnMostRight]: groupColumnMostRight,\n [classes.resizable]: resizable,\n [classes.resizing]: resizing,\n },\n className,\n )}\n {...others}\n >\n {children}\n </Component>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;;AAsDA,MAAM,mBAAmB;AAKlB,MAAM,cAAc;AAAA,EACzB,CAAC,OAAO,gBAAgB;AAChB,UAAA;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,MAAM;AAAA,MACN,eAAe;AAAA,MACf,uBAAuB;AAAA,MACvB,yBAAyB;AAAA,MACzB,sBAAsB;AAAA,MACtB,uBAAuB;AAAA,MACvB,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,GAAG;AAAA,IAAA,IACD,gBAAgB,eAAe,KAAK;AAExC,UAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAExC,UAAA,eAAe,WAAW,YAAY;AACtC,UAAA,sBAAsB,WAAW,mBAAmB;AAEpD,UAAA,OAAO,YAAY,qBAAqB,QAAQ;AAEtD,UAAM,YACJ,aAAa,cAAc,YAAY,MAAM;AAG7C,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAK;AAAA,QACL,MAAM,cAAc,mBAAmB,OAAO;AAAA,QAC9C;AAAA,QACA,WAAW;AAAA,UACT,QAAQ;AAAA,UACR,QAAQ,IAAI;AAAA,UACZ,UAAU,aAAa,QAAQ,QAAQ,WAAW,KAAK,CAAC,EAAE;AAAA,UAC1D,YAAY,aAAa,QAAQ,UAAU,WAAW,OAAO,CAAC,EAAE;AAAA,UAChE;AAAA,YACE,CAAC,QAAQ,WAAW,GAAG,aAAa,YAAY;AAAA,YAChD,CAAC,QAAQ,eAAe,GACtB,aAAa,YAAY,aAAa,SAAS;AAAA,YACjD,CAAC,QAAQ,MAAM,GAAG;AAAA,YAClB,CAAC,QAAQ,YAAY,GAAG;AAAA,YACxB,CAAC,QAAQ,oBAAoB,GAAG;AAAA,YAChC,CAAC,QAAQ,sBAAsB,GAAG;AAAA,YAClC,CAAC,QAAQ,mBAAmB,GAAG;AAAA,YAC/B,CAAC,QAAQ,oBAAoB,GAAG;AAAA,YAChC,CAAC,QAAQ,SAAS,GAAG;AAAA,YACrB,CAAC,QAAQ,QAAQ,GAAG;AAAA,UACtB;AAAA,UACA;AAAA,QACF;AAAA,QACC,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"TableCell.js","sources":["../../../../src/Table/TableCell/TableCell.tsx"],"sourcesContent":["import { forwardRef, useContext } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { capitalize } from \"../../utils/helpers\";\nimport {\n HvTableCellAlign,\n HvTableCellType,\n HvTableCellVariant,\n} from \"../Table\";\nimport TableContext from \"../TableContext\";\nimport { TableSectionContext } from \"../TableSectionContext\";\nimport { staticClasses, useClasses } from \"./TableCell.styles\";\n\nexport { staticClasses as tableCellClasses };\n\nexport type HvTableCellClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableCellProps\n extends Omit<React.TdHTMLAttributes<HTMLTableCellElement>, \"align\"> {\n /** The component used for the root node. Either a string to use a HTML element or a component. Defaults to td. */\n component?: React.ElementType;\n /** Content to be rendered */\n children?: React.ReactNode;\n /** Inline styles to be applied to the root element. */\n style?: React.CSSProperties;\n /** Set the text-align on the table cell content. */\n align?: HvTableCellAlign;\n /** Sets the cell's variant. */\n variant?: HvTableCellVariant | \"listcheckbox\" | \"listactions\";\n /** Specify the cell's type. The prop defaults to the value inherited from the parent TableHead, TableBody, or TableFooter components. */\n type?: HvTableCellType;\n /** Whether or not the cell is part of a sorted column. */\n sorted?: boolean;\n /** The cell is part of a sticky column. */\n stickyColumn?: boolean;\n /** The cell is part of the last sticky to the left column. */\n stickyColumnMostLeft?: boolean;\n /** The cell is part of the first sticky to the right column. */\n stickyColumnLeastRight?: boolean;\n /** The cell is part of the first column in the group. */\n groupColumnMostLeft?: boolean;\n /** The cell is part of the last column in the group. */\n groupColumnMostRight?: boolean;\n /** Whether or not the cell is resizable */\n resizable?: boolean;\n /** Whether or not the cell is being resized */\n resizing?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableCellClasses;\n}\n\nconst defaultComponent = \"td\";\n\n/**\n * `HvTableCell` acts as a `td` element and inherits styles from its context\n */\nexport const HvTableCell = forwardRef<HTMLElement, HvTableCellProps>(\n function HvTableCell(props, ref) {\n const {\n children,\n component,\n className,\n style,\n classes: classesProp,\n align = \"inherit\",\n variant = \"default\",\n type: typeProp,\n stickyColumn = false,\n stickyColumnMostLeft = false,\n stickyColumnLeastRight = false,\n groupColumnMostLeft = false,\n groupColumnMostRight = false,\n sorted = false,\n resizable = false,\n resizing = false,\n ...others\n } = useDefaultProps(\"HvTableCell\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const type = typeProp || tableSectionContext?.type || \"body\";\n\n const Component =\n component || tableContext?.components?.Td || defaultComponent;\n\n return (\n <Component\n ref={ref}\n role={Component === defaultComponent ? null : \"cell\"}\n style={style}\n className={cx(\n classes.root,\n classes[type],\n align !== \"inherit\" && classes[`align${capitalize(align)}`],\n variant !== \"default\" && classes[`variant${capitalize(variant)}`],\n {\n [classes.variantList]: tableContext.variant === \"listrow\",\n [classes.variantListHead]:\n tableContext.variant === \"listrow\" && type !== \"body\",\n [classes.sorted]: sorted,\n [classes.stickyColumn]: stickyColumn,\n [classes.stickyColumnMostLeft]: stickyColumnMostLeft,\n [classes.stickyColumnLeastRight]: stickyColumnLeastRight,\n [classes.groupColumnMostLeft]: groupColumnMostLeft,\n [classes.groupColumnMostRight]: groupColumnMostRight,\n [classes.resizable]: resizable,\n [classes.resizing]: resizing,\n },\n className,\n )}\n {...others}\n >\n {children}\n </Component>\n );\n },\n);\n"],"names":["HvTableCell"],"mappings":";;;;;;;;AAsDA,MAAM,mBAAmB;AAKlB,MAAM,cAAc;AAAA,EACzB,SAASA,aAAY,OAAO,KAAK;AACzB,UAAA;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,MAAM;AAAA,MACN,eAAe;AAAA,MACf,uBAAuB;AAAA,MACvB,yBAAyB;AAAA,MACzB,sBAAsB;AAAA,MACtB,uBAAuB;AAAA,MACvB,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,GAAG;AAAA,IAAA,IACD,gBAAgB,eAAe,KAAK;AAExC,UAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAExC,UAAA,eAAe,WAAW,YAAY;AACtC,UAAA,sBAAsB,WAAW,mBAAmB;AAEpD,UAAA,OAAO,YAAY,qBAAqB,QAAQ;AAEtD,UAAM,YACJ,aAAa,cAAc,YAAY,MAAM;AAG7C,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,MAAM,cAAc,mBAAmB,OAAO;AAAA,QAC9C;AAAA,QACA,WAAW;AAAA,UACT,QAAQ;AAAA,UACR,QAAQ,IAAI;AAAA,UACZ,UAAU,aAAa,QAAQ,QAAQ,WAAW,KAAK,CAAC,EAAE;AAAA,UAC1D,YAAY,aAAa,QAAQ,UAAU,WAAW,OAAO,CAAC,EAAE;AAAA,UAChE;AAAA,YACE,CAAC,QAAQ,WAAW,GAAG,aAAa,YAAY;AAAA,YAChD,CAAC,QAAQ,eAAe,GACtB,aAAa,YAAY,aAAa,SAAS;AAAA,YACjD,CAAC,QAAQ,MAAM,GAAG;AAAA,YAClB,CAAC,QAAQ,YAAY,GAAG;AAAA,YACxB,CAAC,QAAQ,oBAAoB,GAAG;AAAA,YAChC,CAAC,QAAQ,sBAAsB,GAAG;AAAA,YAClC,CAAC,QAAQ,mBAAmB,GAAG;AAAA,YAC/B,CAAC,QAAQ,oBAAoB,GAAG;AAAA,YAChC,CAAC,QAAQ,SAAS,GAAG;AAAA,YACrB,CAAC,QAAQ,QAAQ,GAAG;AAAA,UACtB;AAAA,UACA;AAAA,QACF;AAAA,QACC,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;"}
@@ -1,15 +1,22 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
+ import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
3
4
  import { useClasses } from "./TableContainer.styles.js";
4
5
  import { staticClasses } from "./TableContainer.styles.js";
5
6
  const HvTableContainer = forwardRef(
6
- ({ classes: classesProp, className, component, ...others }, externalRef) => {
7
+ function HvTableContainer2(props, ref) {
8
+ const {
9
+ classes: classesProp,
10
+ className,
11
+ component,
12
+ ...others
13
+ } = useDefaultProps("HvTableContainer", props);
7
14
  const { classes, cx } = useClasses(classesProp);
8
15
  const Component = component || "div";
9
16
  return /* @__PURE__ */ jsx(
10
17
  Component,
11
18
  {
12
- ref: externalRef,
19
+ ref,
13
20
  className: cx(classes.root, className),
14
21
  ...others
15
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TableContainer.js","sources":["../../../../src/Table/TableContainer/TableContainer.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { type ExtractNames } from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport { staticClasses, useClasses } from \"./TableContainer.styles\";\n\nexport { staticClasses as tableContainerClasses };\n\nexport type HvTableContainerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableContainerProps\n extends HvBaseProps<HTMLDivElement, \"children\"> {\n /**\n * Content to be rendered\n */\n children: React.ReactNode;\n /**\n * The component used for the root node. Either a string to use a HTML element or a component.\n * Defaults to tbody.\n */\n component?: React.ElementType;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableContainerClasses;\n}\n\n/**\n * HvTableContainer is a container for the HvTable\n */\nexport const HvTableContainer = forwardRef<HTMLElement, HvTableContainerProps>(\n ({ classes: classesProp, className, component, ...others }, externalRef) => {\n const { classes, cx } = useClasses(classesProp);\n\n const Component = component || \"div\";\n\n return (\n <Component\n ref={externalRef}\n className={cx(classes.root, className)}\n {...others}\n />\n );\n },\n);\n"],"names":[],"mappings":";;;;AA4BO,MAAM,mBAAmB;AAAA,EAC9B,CAAC,EAAE,SAAS,aAAa,WAAW,WAAW,GAAG,OAAO,GAAG,gBAAgB;AAC1E,UAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAE9C,UAAM,YAAY,aAAa;AAG7B,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAK;AAAA,QACL,WAAW,GAAG,QAAQ,MAAM,SAAS;AAAA,QACpC,GAAG;AAAA,MAAA;AAAA,IACN;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"TableContainer.js","sources":["../../../../src/Table/TableContainer/TableContainer.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport { staticClasses, useClasses } from \"./TableContainer.styles\";\n\nexport { staticClasses as tableContainerClasses };\n\nexport type HvTableContainerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableContainerProps\n extends HvBaseProps<HTMLDivElement, \"children\"> {\n /**\n * Content to be rendered\n */\n children: React.ReactNode;\n /**\n * The component used for the root node. Either a string to use a HTML element or a component.\n * Defaults to tbody.\n */\n component?: React.ElementType;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableContainerClasses;\n}\n\n/**\n * HvTableContainer is a container for the HvTable\n */\nexport const HvTableContainer = forwardRef<HTMLElement, HvTableContainerProps>(\n function HvTableContainer(props, ref) {\n const {\n classes: classesProp,\n className,\n component,\n ...others\n } = useDefaultProps(\"HvTableContainer\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const Component = component || \"div\";\n\n return (\n <Component\n ref={ref}\n className={cx(classes.root, className)}\n {...others}\n />\n );\n },\n);\n"],"names":["HvTableContainer"],"mappings":";;;;;AA+BO,MAAM,mBAAmB;AAAA,EAC9B,SAASA,kBAAiB,OAAO,KAAK;AAC9B,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA,IACD,gBAAgB,oBAAoB,KAAK;AAC7C,UAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAE9C,UAAM,YAAY,aAAa;AAG7B,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,QAAQ,MAAM,SAAS;AAAA,QACpC,GAAG;AAAA,MAAA;AAAA,IACN;AAAA,EAAA;AAGN;"}
@@ -1,5 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useContext } from "react";
3
+ import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
3
4
  import TableContext from "../TableContext.js";
4
5
  import { TableSectionContext } from "../TableSectionContext.js";
5
6
  import { useClasses } from "./TableHead.styles.js";
@@ -9,7 +10,14 @@ const tableSectionContext = {
9
10
  };
10
11
  const defaultComponent = "thead";
11
12
  const HvTableHead = forwardRef(
12
- ({ classes: classesProp, className, component, stickyHeader, ...others }, externalRef) => {
13
+ function HvTableHead2(props, ref) {
14
+ const {
15
+ classes: classesProp,
16
+ className,
17
+ component,
18
+ stickyHeader,
19
+ ...others
20
+ } = useDefaultProps("HvTableHead", props);
13
21
  const { classes, cx } = useClasses(classesProp);
14
22
  const tableContext = useContext(TableContext);
15
23
  const Component = component || tableContext?.components?.THead || defaultComponent;
@@ -21,7 +29,7 @@ const HvTableHead = forwardRef(
21
29
  { [classes.stickyHeader]: stickyHeader },
22
30
  className
23
31
  ),
24
- ref: externalRef,
32
+ ref,
25
33
  role: Component === defaultComponent ? null : "rowgroup",
26
34
  ...others
27
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TableHead.js","sources":["../../../../src/Table/TableHead/TableHead.tsx"],"sourcesContent":["import { forwardRef, useContext } from \"react\";\nimport { type ExtractNames } from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport TableContext from \"../TableContext\";\nimport {\n TableSectionContext,\n TableSectionContextValue,\n} from \"../TableSectionContext\";\nimport { staticClasses, useClasses } from \"./TableHead.styles\";\n\nexport { staticClasses as tableHeadClasses };\n\nexport type HvTableHeadClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableHeadProps\n extends HvBaseProps<HTMLTableSectionElement, \"children\"> {\n /**\n * Content to be rendered\n */\n children: React.ReactNode;\n /**\n * The component used for the root node. Either a string to use a HTML element or a component.\n * Defaults to thead.\n */\n component?: React.ElementType;\n /**\n * The table has sticky headers.\n */\n stickyHeader?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableHeadClasses;\n}\n\nconst tableSectionContext = {\n type: \"head\",\n} satisfies TableSectionContextValue;\n\nconst defaultComponent = \"thead\";\n\n/**\n * HvTableHead acts as a `thead` element.\n * `HvTableCell` and `HvTableRow` elements in it inherit header-specific styles\n */\nexport const HvTableHead = forwardRef<HTMLElement, HvTableHeadProps>(\n (\n { classes: classesProp, className, component, stickyHeader, ...others },\n externalRef,\n ) => {\n const { classes, cx } = useClasses(classesProp);\n\n const tableContext = useContext(TableContext);\n\n const Component =\n component || tableContext?.components?.THead || defaultComponent;\n\n return (\n <TableSectionContext.Provider value={tableSectionContext}>\n <Component\n className={cx(\n classes.root,\n { [classes.stickyHeader]: stickyHeader },\n className,\n )}\n ref={externalRef}\n role={Component === defaultComponent ? null : \"rowgroup\"}\n {...others}\n />\n </TableSectionContext.Provider>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;AAkCA,MAAM,sBAAsB;AAAA,EAC1B,MAAM;AACR;AAEA,MAAM,mBAAmB;AAMlB,MAAM,cAAc;AAAA,EACzB,CACE,EAAE,SAAS,aAAa,WAAW,WAAW,cAAc,GAAG,OAAO,GACtE,gBACG;AACH,UAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAExC,UAAA,eAAe,WAAW,YAAY;AAE5C,UAAM,YACJ,aAAa,cAAc,YAAY,SAAS;AAElD,WACG,oBAAA,oBAAoB,UAApB,EAA6B,OAAO,qBACnC,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW;AAAA,UACT,QAAQ;AAAA,UACR,EAAE,CAAC,QAAQ,YAAY,GAAG,aAAa;AAAA,UACvC;AAAA,QACF;AAAA,QACA,KAAK;AAAA,QACL,MAAM,cAAc,mBAAmB,OAAO;AAAA,QAC7C,GAAG;AAAA,MAAA;AAAA,IAAA,GAER;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"TableHead.js","sources":["../../../../src/Table/TableHead/TableHead.tsx"],"sourcesContent":["import { forwardRef, useContext } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport TableContext from \"../TableContext\";\nimport {\n TableSectionContext,\n TableSectionContextValue,\n} from \"../TableSectionContext\";\nimport { staticClasses, useClasses } from \"./TableHead.styles\";\n\nexport { staticClasses as tableHeadClasses };\n\nexport type HvTableHeadClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableHeadProps\n extends HvBaseProps<HTMLTableSectionElement, \"children\"> {\n /**\n * Content to be rendered\n */\n children: React.ReactNode;\n /**\n * The component used for the root node. Either a string to use a HTML element or a component.\n * Defaults to thead.\n */\n component?: React.ElementType;\n /**\n * The table has sticky headers.\n */\n stickyHeader?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableHeadClasses;\n}\n\nconst tableSectionContext = {\n type: \"head\",\n} satisfies TableSectionContextValue;\n\nconst defaultComponent = \"thead\";\n\n/**\n * HvTableHead acts as a `thead` element.\n * `HvTableCell` and `HvTableRow` elements in it inherit header-specific styles\n */\nexport const HvTableHead = forwardRef<HTMLElement, HvTableHeadProps>(\n function HvTableHead(props, ref) {\n const {\n classes: classesProp,\n className,\n component,\n stickyHeader,\n ...others\n } = useDefaultProps(\"HvTableHead\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const tableContext = useContext(TableContext);\n\n const Component =\n component || tableContext?.components?.THead || defaultComponent;\n\n return (\n <TableSectionContext.Provider value={tableSectionContext}>\n <Component\n className={cx(\n classes.root,\n { [classes.stickyHeader]: stickyHeader },\n className,\n )}\n ref={ref}\n role={Component === defaultComponent ? null : \"rowgroup\"}\n {...others}\n />\n </TableSectionContext.Provider>\n );\n },\n);\n"],"names":["HvTableHead"],"mappings":";;;;;;;AAqCA,MAAM,sBAAsB;AAAA,EAC1B,MAAM;AACR;AAEA,MAAM,mBAAmB;AAMlB,MAAM,cAAc;AAAA,EACzB,SAASA,aAAY,OAAO,KAAK;AACzB,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA,IACD,gBAAgB,eAAe,KAAK;AACxC,UAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAExC,UAAA,eAAe,WAAW,YAAY;AAE5C,UAAM,YACJ,aAAa,cAAc,YAAY,SAAS;AAElD,WACG,oBAAA,oBAAoB,UAApB,EAA6B,OAAO,qBACnC,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW;AAAA,UACT,QAAQ;AAAA,UACR,EAAE,CAAC,QAAQ,YAAY,GAAG,aAAa;AAAA,UACvC;AAAA,QACF;AAAA,QACA;AAAA,QACA,MAAM,cAAc,mBAAmB,OAAO;AAAA,QAC7C,GAAG;AAAA,MAAA;AAAA,IAAA,GAER;AAAA,EAAA;AAGN;"}
@@ -11,7 +11,7 @@ import { HvButton } from "../../Button/Button.js";
11
11
  import { HvTypography } from "../../Typography/Typography.js";
12
12
  const defaultComponent = "th";
13
13
  const HvTableHeader = forwardRef(
14
- (props, externalRef) => {
14
+ function HvTableHeader2(props, ref) {
15
15
  const {
16
16
  children,
17
17
  component,
@@ -54,7 +54,7 @@ const HvTableHeader = forwardRef(
54
54
  return /* @__PURE__ */ jsxs(
55
55
  Component,
56
56
  {
57
- ref: externalRef,
57
+ ref,
58
58
  role,
59
59
  scope,
60
60
  style,
@@ -1 +1 @@
1
- {"version":3,"file":"TableHeader.js","sources":["../../../../src/Table/TableHeader/TableHeader.tsx"],"sourcesContent":["import { forwardRef, useContext, useMemo } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvButton, HvButtonProps } from \"../../Button\";\nimport { HvTypography, HvTypographyProps } from \"../../Typography\";\nimport { capitalize } from \"../../utils/helpers\";\nimport {\n HvTableCellAlign,\n HvTableCellType,\n HvTableCellVariant,\n} from \"../Table\";\nimport TableContext from \"../TableContext\";\nimport { TableSectionContext } from \"../TableSectionContext\";\nimport { staticClasses, useClasses } from \"./TableHeader.styles\";\nimport { getSortIcon, isParagraph } from \"./utils\";\n\nexport { staticClasses as tableHeaderClasses };\n\nexport type HvTableHeaderClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableHeaderProps\n extends Omit<React.ThHTMLAttributes<HTMLTableCellElement>, \"align\"> {\n /** The component used for the root node. Either a string to use a HTML element or a component. Defaults to th. */\n component?: React.ElementType;\n /** Content to be rendered */\n children?: React.ReactNode;\n /** The scope of cells that the header element relates to. */\n scope?: \"col\" | \"row\" | \"colgroup\" | \"rowgroup\";\n /** Set the text-align on the table cell content. */\n align?: HvTableCellAlign;\n /** Sets the cell's variant. */\n variant?: HvTableCellVariant;\n /** Specify the cell type. The prop defaults to the value inherited from the parent TableHead, TableBody, or TableFooter components. */\n type?: HvTableCellType;\n /** The cell is part of a sticky column. */\n stickyColumn?: boolean;\n /** The cell is part of the last sticky to the left column. */\n stickyColumnMostLeft?: boolean;\n /** The cell is part of the first sticky to the right column. */\n stickyColumnLeastRight?: boolean;\n /** The cell is part of the first column in the group. */\n groupColumnMostLeft?: boolean;\n /** The cell is part of the last column in the group. */\n groupColumnMostRight?: boolean;\n /** Whether or not the cell is sorted */\n sorted?: boolean;\n /** Whether or not the cell is sortable */\n sortable?: boolean;\n /** Set sort direction icon and aria-sort. */\n sortDirection?: \"ascending\" | \"descending\" | false;\n /** Extra props to be passed onto the text in the header. */\n headerTextProps?: HvTypographyProps;\n /** Whether or not the cell is resizable */\n resizable?: boolean;\n /** Whether or not the cell is being resized */\n resizing?: boolean;\n /** The resize props injected in the resize handler */\n resizerProps?: React.HTMLAttributes<HTMLDivElement>;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableHeaderClasses;\n /** Extra props to be passed onto the sort button in the header. */\n sortButtonProps?: HvButtonProps;\n}\n\nconst defaultComponent = \"th\";\n\n/**\n * `HvTableHeader` acts as a `th` element and inherits styles from its context\n */\nexport const HvTableHeader = forwardRef<HTMLElement, HvTableHeaderProps>(\n (props, externalRef) => {\n const {\n children,\n component,\n className,\n style: styleProp,\n classes: classesProp,\n scope: scopeProp,\n align = \"inherit\",\n variant = \"default\",\n type: typeProp,\n stickyColumn = false,\n stickyColumnMostLeft = false,\n stickyColumnLeastRight = false,\n groupColumnMostLeft = false,\n groupColumnMostRight = false,\n sortDirection = \"none\",\n sorted,\n sortable,\n headerTextProps,\n resizerProps = {},\n resizable = false,\n resizing = false,\n sortButtonProps,\n ...others\n } = useDefaultProps(\"HvTableHeader\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const type = typeProp || tableSectionContext?.type || \"body\";\n const isHeadCell = type === \"head\";\n\n const scope = scopeProp ?? (isHeadCell ? \"col\" : \"row\");\n\n const Sort = useMemo(\n () => getSortIcon(sorted && sortDirection),\n [sorted, sortDirection],\n );\n\n const Component =\n component || tableContext?.components?.Th || defaultComponent;\n\n const role =\n Component === defaultComponent\n ? null\n : isHeadCell\n ? \"columnheader\"\n : \"rowheader\";\n const paragraph = isParagraph(children);\n\n // Keep the header sticky\n const style = stickyColumn\n ? { ...styleProp, position: \"sticky\" }\n : styleProp;\n\n return (\n <Component\n ref={externalRef}\n role={role}\n scope={scope}\n style={style}\n className={cx(\n classes.root,\n classes[type],\n align !== \"inherit\" && classes[`align${capitalize(align)}`],\n variant !== \"default\" && classes[`variant${capitalize(variant)}`],\n {\n [classes.groupColumnMostLeft]: groupColumnMostLeft,\n [classes.groupColumnMostRight]: groupColumnMostRight,\n [classes.sortable]: sortable,\n [classes.sorted]: sorted,\n [classes.resizable]: resizable,\n [classes.resizing]: resizing,\n [classes.stickyColumn]: stickyColumn,\n [classes.stickyColumnMostLeft]: stickyColumnMostLeft,\n [classes.stickyColumnLeastRight]: stickyColumnLeastRight,\n [classes.variantList]: tableContext.variant === \"listrow\",\n },\n className,\n )}\n aria-sort={sortable ? sortDirection : undefined}\n {...others}\n >\n <div\n className={cx(\n classes.headerContent,\n align !== \"inherit\" && classes[`alignFlex${capitalize(align)}`],\n )}\n >\n {isHeadCell && sortable && (\n <HvButton\n className={classes.sortButton}\n icon\n overrideIconColors={false}\n aria-label=\"Sort\"\n {...sortButtonProps}\n >\n <Sort className={classes.sortIcon} />\n </HvButton>\n )}\n <HvTypography\n component=\"div\"\n className={cx({\n [classes.headerText]: !paragraph,\n [classes.headerParagraph]: paragraph,\n [classes.sortableHeaderText]: sortable,\n })}\n variant=\"label\"\n {...headerTextProps}\n >\n {children}\n </HvTypography>\n </div>\n {resizable && <div {...resizerProps} className={classes.resizer} />}\n </Component>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;;;;;AAmEA,MAAM,mBAAmB;AAKlB,MAAM,gBAAgB;AAAA,EAC3B,CAAC,OAAO,gBAAgB;AAChB,UAAA;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP,SAAS;AAAA,MACT,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,MAAM;AAAA,MACN,eAAe;AAAA,MACf,uBAAuB;AAAA,MACvB,yBAAyB;AAAA,MACzB,sBAAsB;AAAA,MACtB,uBAAuB;AAAA,MACvB,gBAAgB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAe,CAAC;AAAA,MAChB,YAAY;AAAA,MACZ,WAAW;AAAA,MACX;AAAA,MACA,GAAG;AAAA,IAAA,IACD,gBAAgB,iBAAiB,KAAK;AAC1C,UAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAExC,UAAA,eAAe,WAAW,YAAY;AACtC,UAAA,sBAAsB,WAAW,mBAAmB;AAEpD,UAAA,OAAO,YAAY,qBAAqB,QAAQ;AACtD,UAAM,aAAa,SAAS;AAEtB,UAAA,QAAQ,cAAc,aAAa,QAAQ;AAEjD,UAAM,OAAO;AAAA,MACX,MAAM,YAAY,UAAU,aAAa;AAAA,MACzC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A,oBACnB,MAAI;AAAA,oBACJ,oBAAoB;AAAA,oBACpB,cAAW;AAAA,oBACV,GAAG;AAAA,oBAEJ,UAAC,oBAAA,MAAA,EAAK,WAAW,QAAQ,SAAU,CAAA;AAAA,kBAAA;AAAA,gBACrC;AAAA,gBAEF;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,WAAU;AAAA,oBACV,WAAW,GAAG;AAAA,sBACZ,CAAC,QAAQ,UAAU,GAAG,CAAC;AAAA,sBACvB,CAAC,QAAQ,eAAe,GAAG;AAAA,sBAC3B,CAAC,QAAQ,kBAAkB,GAAG;AAAA,oBAAA,CAC/B;AAAA,oBACD,SAAQ;AAAA,oBACP,GAAG;AAAA,oBAEH;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACH;AAAA,YAAA;AAAA,UACF;AAAA,UACC,aAAc,oBAAA,OAAA,EAAK,GAAG,cAAc,WAAW,QAAQ,QAAS,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACnE;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"TableHeader.js","sources":["../../../../src/Table/TableHeader/TableHeader.tsx"],"sourcesContent":["import { forwardRef, useContext, useMemo } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvButton, HvButtonProps } from \"../../Button\";\nimport { HvTypography, HvTypographyProps } from \"../../Typography\";\nimport { capitalize } from \"../../utils/helpers\";\nimport {\n HvTableCellAlign,\n HvTableCellType,\n HvTableCellVariant,\n} from \"../Table\";\nimport TableContext from \"../TableContext\";\nimport { TableSectionContext } from \"../TableSectionContext\";\nimport { staticClasses, useClasses } from \"./TableHeader.styles\";\nimport { getSortIcon, isParagraph } from \"./utils\";\n\nexport { staticClasses as tableHeaderClasses };\n\nexport type HvTableHeaderClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableHeaderProps\n extends Omit<React.ThHTMLAttributes<HTMLTableCellElement>, \"align\"> {\n /** The component used for the root node. Either a string to use a HTML element or a component. Defaults to th. */\n component?: React.ElementType;\n /** Content to be rendered */\n children?: React.ReactNode;\n /** The scope of cells that the header element relates to. */\n scope?: \"col\" | \"row\" | \"colgroup\" | \"rowgroup\";\n /** Set the text-align on the table cell content. */\n align?: HvTableCellAlign;\n /** Sets the cell's variant. */\n variant?: HvTableCellVariant;\n /** Specify the cell type. The prop defaults to the value inherited from the parent TableHead, TableBody, or TableFooter components. */\n type?: HvTableCellType;\n /** The cell is part of a sticky column. */\n stickyColumn?: boolean;\n /** The cell is part of the last sticky to the left column. */\n stickyColumnMostLeft?: boolean;\n /** The cell is part of the first sticky to the right column. */\n stickyColumnLeastRight?: boolean;\n /** The cell is part of the first column in the group. */\n groupColumnMostLeft?: boolean;\n /** The cell is part of the last column in the group. */\n groupColumnMostRight?: boolean;\n /** Whether or not the cell is sorted */\n sorted?: boolean;\n /** Whether or not the cell is sortable */\n sortable?: boolean;\n /** Set sort direction icon and aria-sort. */\n sortDirection?: \"ascending\" | \"descending\" | false;\n /** Extra props to be passed onto the text in the header. */\n headerTextProps?: HvTypographyProps;\n /** Whether or not the cell is resizable */\n resizable?: boolean;\n /** Whether or not the cell is being resized */\n resizing?: boolean;\n /** The resize props injected in the resize handler */\n resizerProps?: React.HTMLAttributes<HTMLDivElement>;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableHeaderClasses;\n /** Extra props to be passed onto the sort button in the header. */\n sortButtonProps?: HvButtonProps;\n}\n\nconst defaultComponent = \"th\";\n\n/**\n * `HvTableHeader` acts as a `th` element and inherits styles from its context\n */\nexport const HvTableHeader = forwardRef<HTMLElement, HvTableHeaderProps>(\n function HvTableHeader(props, ref) {\n const {\n children,\n component,\n className,\n style: styleProp,\n classes: classesProp,\n scope: scopeProp,\n align = \"inherit\",\n variant = \"default\",\n type: typeProp,\n stickyColumn = false,\n stickyColumnMostLeft = false,\n stickyColumnLeastRight = false,\n groupColumnMostLeft = false,\n groupColumnMostRight = false,\n sortDirection = \"none\",\n sorted,\n sortable,\n headerTextProps,\n resizerProps = {},\n resizable = false,\n resizing = false,\n sortButtonProps,\n ...others\n } = useDefaultProps(\"HvTableHeader\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const type = typeProp || tableSectionContext?.type || \"body\";\n const isHeadCell = type === \"head\";\n\n const scope = scopeProp ?? (isHeadCell ? \"col\" : \"row\");\n\n const Sort = useMemo(\n () => getSortIcon(sorted && sortDirection),\n [sorted, sortDirection],\n );\n\n const Component =\n component || tableContext?.components?.Th || defaultComponent;\n\n const role =\n Component === defaultComponent\n ? null\n : isHeadCell\n ? \"columnheader\"\n : \"rowheader\";\n const paragraph = isParagraph(children);\n\n // Keep the header sticky\n const style = stickyColumn\n ? { ...styleProp, position: \"sticky\" }\n : styleProp;\n\n return (\n <Component\n ref={ref}\n role={role}\n scope={scope}\n style={style}\n className={cx(\n classes.root,\n classes[type],\n align !== \"inherit\" && classes[`align${capitalize(align)}`],\n variant !== \"default\" && classes[`variant${capitalize(variant)}`],\n {\n [classes.groupColumnMostLeft]: groupColumnMostLeft,\n [classes.groupColumnMostRight]: groupColumnMostRight,\n [classes.sortable]: sortable,\n [classes.sorted]: sorted,\n [classes.resizable]: resizable,\n [classes.resizing]: resizing,\n [classes.stickyColumn]: stickyColumn,\n [classes.stickyColumnMostLeft]: stickyColumnMostLeft,\n [classes.stickyColumnLeastRight]: stickyColumnLeastRight,\n [classes.variantList]: tableContext.variant === \"listrow\",\n },\n className,\n )}\n aria-sort={sortable ? sortDirection : undefined}\n {...others}\n >\n <div\n className={cx(\n classes.headerContent,\n align !== \"inherit\" && classes[`alignFlex${capitalize(align)}`],\n )}\n >\n {isHeadCell && sortable && (\n <HvButton\n className={classes.sortButton}\n icon\n overrideIconColors={false}\n aria-label=\"Sort\"\n {...sortButtonProps}\n >\n <Sort className={classes.sortIcon} />\n </HvButton>\n )}\n <HvTypography\n component=\"div\"\n className={cx({\n [classes.headerText]: !paragraph,\n [classes.headerParagraph]: paragraph,\n [classes.sortableHeaderText]: sortable,\n })}\n variant=\"label\"\n {...headerTextProps}\n >\n {children}\n </HvTypography>\n </div>\n {resizable && <div {...resizerProps} className={classes.resizer} />}\n </Component>\n );\n },\n);\n"],"names":["HvTableHeader"],"mappings":";;;;;;;;;;;AAmEA,MAAM,mBAAmB;AAKlB,MAAM,gBAAgB;AAAA,EAC3B,SAASA,eAAc,OAAO,KAAK;AAC3B,UAAA;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP,SAAS;AAAA,MACT,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,MAAM;AAAA,MACN,eAAe;AAAA,MACf,uBAAuB;AAAA,MACvB,yBAAyB;AAAA,MACzB,sBAAsB;AAAA,MACtB,uBAAuB;AAAA,MACvB,gBAAgB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAe,CAAC;AAAA,MAChB,YAAY;AAAA,MACZ,WAAW;AAAA,MACX;AAAA,MACA,GAAG;AAAA,IAAA,IACD,gBAAgB,iBAAiB,KAAK;AAC1C,UAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAExC,UAAA,eAAe,WAAW,YAAY;AACtC,UAAA,sBAAsB,WAAW,mBAAmB;AAEpD,UAAA,OAAO,YAAY,qBAAqB,QAAQ;AACtD,UAAM,aAAa,SAAS;AAEtB,UAAA,QAAQ,cAAc,aAAa,QAAQ;AAEjD,UAAM,OAAO;AAAA,MACX,MAAM,YAAY,UAAU,aAAa;AAAA,MACzC,CAAC,QAAQ,aAAa;AAAA,IACxB;AAEA,UAAM,YACJ,aAAa,cAAc,YAAY,MAAM;AAE/C,UAAM,OACJ,cAAc,mBACV,OACA,aACE,iBACA;AACF,UAAA,YAAY,YAAY,QAAQ;AAGtC,UAAM,QAAQ,eACV,EAAE,GAAG,WAAW,UAAU,aAC1B;AAGF,WAAA;AAAA,MAAC;A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W,GAAG;AAAA,sBACZ,CAAC,QAAQ,UAAU,GAAG,CAAC;AAAA,sBACvB,CAAC,QAAQ,eAAe,GAAG;AAAA,sBAC3B,CAAC,QAAQ,kBAAkB,GAAG;AAAA,oBAAA,CAC/B;AAAA,oBACD,SAAQ;AAAA,oBACP,GAAG;AAAA,oBAEH;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACH;AAAA,YAAA;AAAA,UACF;AAAA,UACC,aAAc,oBAAA,OAAA,EAAK,GAAG,cAAc,WAAW,QAAQ,QAAS,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACnE;AAAA,EAAA;AAGN;"}
@@ -7,7 +7,7 @@ import { useClasses } from "./TableRow.styles.js";
7
7
  import { staticClasses } from "./TableRow.styles.js";
8
8
  const defaultComponent = "tr";
9
9
  const HvTableRow = forwardRef(
10
- (props, externalRef) => {
10
+ function HvTableRow2(props, ref) {
11
11
  const {
12
12
  classes: classesProp,
13
13
  className,
@@ -27,7 +27,7 @@ const HvTableRow = forwardRef(
27
27
  return /* @__PURE__ */ jsx(
28
28
  Component,
29
29
  {
30
- ref: externalRef,
30
+ ref,
31
31
  className: cx(
32
32
  tableSectionContext.filterClassName,
33
33
  classes.root,
@@ -1 +1 @@
1
- {"version":3,"file":"TableRow.js","sources":["../../../../src/Table/TableRow/TableRow.tsx"],"sourcesContent":["import { forwardRef, useContext } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport TableContext from \"../TableContext\";\nimport { TableSectionContext } from \"../TableSectionContext\";\nimport { staticClasses, useClasses } from \"./TableRow.styles\";\n\nexport { staticClasses as tableRowClasses };\n\nexport type HvTableRowClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableRowProps\n extends HvBaseProps<HTMLTableRowElement, \"children\"> {\n /** Content to be rendered */\n children: React.ReactNode;\n /** The component used for the root node. Either a string to use a HTML element or a component. Defaults to tbody. */\n component?: React.ElementType;\n /** Whether the table row will shade on hover. */\n hover?: boolean;\n /** Whether the table row will have the selected shading. */\n selected?: boolean;\n /** Whether the table row is expanded. */\n expanded?: boolean;\n /** Whether the table row background is striped. */\n striped?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableRowClasses;\n}\n\nconst defaultComponent = \"tr\";\n\n/**\n * `HvTableRow` acts as a `tr` element and inherits styles from its context\n */\nexport const HvTableRow = forwardRef<HTMLElement, HvTableRowProps>(\n (props, externalRef) => {\n const {\n classes: classesProp,\n className,\n component,\n hover = false,\n selected = false,\n expanded = false,\n striped = false,\n ...others\n } = useDefaultProps(\"HvTableRow\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const type = tableSectionContext?.type || \"body\";\n\n const isList = tableContext.variant === \"listrow\";\n\n const Component =\n component || tableContext?.components?.Tr || defaultComponent;\n\n return (\n <Component\n ref={externalRef}\n className={cx(\n tableSectionContext.filterClassName,\n classes.root,\n classes[type],\n {\n [classes.hover]: hover,\n [classes.selected]: selected,\n [classes.expanded]: expanded,\n [classes.striped]: striped,\n [classes.variantList]: isList && type === \"body\",\n [classes.variantListHead]: isList && type === \"head\",\n },\n className,\n )}\n role={Component === defaultComponent ? null : \"row\"}\n {...others}\n />\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;AAiCA,MAAM,mBAAmB;AAKlB,MAAM,aAAa;AAAA,EACxB,CAAC,OAAO,gBAAgB;AAChB,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,WAAW;AAAA,MACX,UAAU;AAAA,MACV,GAAG;AAAA,IAAA,IACD,gBAAgB,cAAc,KAAK;AAEvC,UAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAExC,UAAA,eAAe,WAAW,YAAY;AACtC,UAAA,sBAAsB,WAAW,mBAAmB;AAEpD,UAAA,OAAO,qBAAqB,QAAQ;AAEpC,UAAA,SAAS,aAAa,YAAY;AAExC,UAAM,YACJ,aAAa,cAAc,YAAY,MAAM;AAG7C,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAK;AAAA,QACL,WAAW;AAAA,UACT,oBAAoB;AAAA,UACpB,QAAQ;AAAA,UACR,QAAQ,IAAI;AAAA,UACZ;AAAA,YACE,CAAC,QAAQ,KAAK,GAAG;AAAA,YACjB,CAAC,QAAQ,QAAQ,GAAG;AAAA,YACpB,CAAC,QAAQ,QAAQ,GAAG;AAAA,YACpB,CAAC,QAAQ,OAAO,GAAG;AAAA,YACnB,CAAC,QAAQ,WAAW,GAAG,UAAU,SAAS;AAAA,YAC1C,CAAC,QAAQ,eAAe,GAAG,UAAU,SAAS;AAAA,UAChD;AAAA,UACA;AAAA,QACF;AAAA,QACA,MAAM,cAAc,mBAAmB,OAAO;AAAA,QAC7C,GAAG;AAAA,MAAA;AAAA,IACN;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"TableRow.js","sources":["../../../../src/Table/TableRow/TableRow.tsx"],"sourcesContent":["import { forwardRef, useContext } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport TableContext from \"../TableContext\";\nimport { TableSectionContext } from \"../TableSectionContext\";\nimport { staticClasses, useClasses } from \"./TableRow.styles\";\n\nexport { staticClasses as tableRowClasses };\n\nexport type HvTableRowClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableRowProps\n extends HvBaseProps<HTMLTableRowElement, \"children\"> {\n /** Content to be rendered */\n children: React.ReactNode;\n /** The component used for the root node. Either a string to use a HTML element or a component. Defaults to tbody. */\n component?: React.ElementType;\n /** Whether the table row will shade on hover. */\n hover?: boolean;\n /** Whether the table row will have the selected shading. */\n selected?: boolean;\n /** Whether the table row is expanded. */\n expanded?: boolean;\n /** Whether the table row background is striped. */\n striped?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableRowClasses;\n}\n\nconst defaultComponent = \"tr\";\n\n/**\n * `HvTableRow` acts as a `tr` element and inherits styles from its context\n */\nexport const HvTableRow = forwardRef<HTMLElement, HvTableRowProps>(\n function HvTableRow(props, ref) {\n const {\n classes: classesProp,\n className,\n component,\n hover = false,\n selected = false,\n expanded = false,\n striped = false,\n ...others\n } = useDefaultProps(\"HvTableRow\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const type = tableSectionContext?.type || \"body\";\n\n const isList = tableContext.variant === \"listrow\";\n\n const Component =\n component || tableContext?.components?.Tr || defaultComponent;\n\n return (\n <Component\n ref={ref}\n className={cx(\n tableSectionContext.filterClassName,\n classes.root,\n classes[type],\n {\n [classes.hover]: hover,\n [classes.selected]: selected,\n [classes.expanded]: expanded,\n [classes.striped]: striped,\n [classes.variantList]: isList && type === \"body\",\n [classes.variantListHead]: isList && type === \"head\",\n },\n className,\n )}\n role={Component === defaultComponent ? null : \"row\"}\n {...others}\n />\n );\n },\n);\n"],"names":["HvTableRow"],"mappings":";;;;;;;AAiCA,MAAM,mBAAmB;AAKlB,MAAM,aAAa;AAAA,EACxB,SAASA,YAAW,OAAO,KAAK;AACxB,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,WAAW;AAAA,MACX,UAAU;AAAA,MACV,GAAG;AAAA,IAAA,IACD,gBAAgB,cAAc,KAAK;AAEvC,UAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAExC,UAAA,eAAe,WAAW,YAAY;AACtC,UAAA,sBAAsB,WAAW,mBAAmB;AAEpD,UAAA,OAAO,qBAAqB,QAAQ;AAEpC,UAAA,SAAS,aAAa,YAAY;AAExC,UAAM,YACJ,aAAa,cAAc,YAAY,MAAM;AAG7C,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT,oBAAoB;AAAA,UACpB,QAAQ;AAAA,UACR,QAAQ,IAAI;AAAA,UACZ;AAAA,YACE,CAAC,QAAQ,KAAK,GAAG;AAAA,YACjB,CAAC,QAAQ,QAAQ,GAAG;AAAA,YACpB,CAAC,QAAQ,QAAQ,GAAG;AAAA,YACpB,CAAC,QAAQ,OAAO,GAAG;AAAA,YACnB,CAAC,QAAQ,WAAW,GAAG,UAAU,SAAS;AAAA,YAC1C,CAAC,QAAQ,eAAe,GAAG,UAAU,SAAS;AAAA,UAChD;AAAA,UACA;AAAA,QACF;AAAA,QACA,MAAM,cAAc,mBAAmB,OAAO;AAAA,QAC7C,GAAG;AAAA,MAAA;AAAA,IACN;AAAA,EAAA;AAGN;"}
@@ -38,7 +38,9 @@ const { staticClasses, useClasses } = createClasses("HvTableSection", {
38
38
  borderBottomRightRadius: "inherit"
39
39
  },
40
40
  [`& .${staticClasses$1.root}`]: {
41
- paddingBottom: 0
41
+ paddingBottom: 0,
42
+ borderTopLeftRadius: "inherit",
43
+ borderTopRightRadius: "inherit"
42
44
  },
43
45
  [`& .${staticClasses$2.head}`]: {
44
46
  backgroundColor: theme.colors.atmo2,
@@ -75,7 +77,9 @@ const { staticClasses, useClasses } = createClasses("HvTableSection", {
75
77
  margin: 0,
76
78
  backgroundColor: theme.colors.atmo2,
77
79
  padding: theme.space.xs,
78
- borderTop: `1px solid ${theme.colors.atmo3}`
80
+ borderTop: `1px solid ${theme.colors.atmo3}`,
81
+ borderBottomLeftRadius: "inherit",
82
+ borderBottomRightRadius: "inherit"
79
83
  },
80
84
  [`& .${staticClasses$6.pageSizeOptions}`]: {
81
85
  left: theme.space.sm
@@ -1 +1 @@
1
- {"version":3,"file":"TableSection.styles.js","sources":["../../../src/TableSection/TableSection.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { bulkActionsClasses } from \"../BulkActions\";\nimport { paginationClasses } from \"../Pagination\";\nimport { tableCellClasses } from \"../Table/TableCell\";\nimport { tableContainerClasses } from \"../Table/TableContainer\";\nimport { tableHeaderClasses } from \"../Table/TableHeader\";\nimport { tableRowClasses } from \"../Table/TableRow\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTableSection\", {\n root: {},\n header: {\n // Only apply the border to divide the header and content when both are displayed\n \"+ div\": {\n borderTop: `1px solid ${theme.colors.atmo3}`,\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n },\n },\n actions: {},\n content: {\n marginTop: 0,\n padding: 0,\n\n // Apply border radius to the first child if there's not an header\n \"&:first-of-type\": {\n \"& > :first-of-type\": {\n borderTopLeftRadius: \"inherit\",\n borderTopRightRadius: \"inherit\",\n },\n },\n\n \"& > :last-child\": {\n borderBottomLeftRadius: \"inherit\",\n borderBottomRightRadius: \"inherit\",\n },\n\n [`& .${tableContainerClasses.root}`]: {\n paddingBottom: 0,\n },\n\n [`& .${tableHeaderClasses.head}`]: {\n backgroundColor: theme.colors.atmo2,\n borderBottomColor: theme.colors.atmo3,\n [`&.${tableHeaderClasses.variantCheckbox}`]: {\n borderRight: \"none\",\n },\n [`&.${tableHeaderClasses.variantActions}`]: {\n borderLeft: \"none\",\n },\n },\n\n // Remove border for the last table row\n [`& .${tableRowClasses.root}`]: {\n \"&:last-child\": {\n [`& .${tableCellClasses.root}`]: { borderBottom: \"none\" },\n },\n },\n\n [`& .${tableCellClasses.root}`]: {\n borderBottomColor: theme.colors.atmo3,\n },\n\n [`& .${tableCellClasses.variantCheckbox}`]: {\n borderRight: \"none\",\n },\n\n [`& .${tableCellClasses.variantActions}`]: {\n borderLeft: \"none\",\n },\n\n [`& .${bulkActionsClasses.root}`]: {\n marginBottom: 0,\n border: \"none\",\n borderBottom: `1px solid ${theme.colors.atmo3}`,\n padding: theme.spacing(\"xs\", \"sm\"),\n },\n\n [`& .${paginationClasses.root}`]: {\n margin: 0,\n backgroundColor: theme.colors.atmo2,\n padding: theme.space.xs,\n borderTop: `1px solid ${theme.colors.atmo3}`,\n },\n\n [`& .${paginationClasses.pageSizeOptions}`]: {\n left: theme.space.sm,\n },\n [`& .${paginationClasses.pageSizeHeader}`]: {\n border: \"none\",\n \"&:hover\": {\n border: \"none\",\n },\n },\n },\n hidden: {},\n raisedHeader: {\n \"& $content\": {\n paddingTop: 0,\n },\n },\n hasHeader: {},\n /** @deprecated use `hasHeader` instead */\n spaceTop: {},\n});\n"],"names":["tableContainerClasses","tableHeaderClasses","tableRowClasses","tableCellClasses","bulkActionsClasses","paginationClasses"],"mappings":";;;;;;;;;;;;;;AAUO,MAAM,EAAE,eAAe,eAAe,cAAc,kBAAkB;AAAA,EAC3E,MAAM,CAAC;AAAA,EACP,QAAQ;AAAA;AAAA,IAEN,SAAS;AAAA,MACP,WAAW,aAAa,MAAM,OAAO,KAAK;AAAA,MAC1C,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,IAAA;AAAA,EAE1B;AAAA,EACA,SAAS,CAAC;AAAA,EACV,SAAS;AAAA,IACP,WAAW;AAAA,IACX,SAAS;AAAA;AAAA,IAGT,mBAAmB;AAAA,MACjB,sBAAsB;AAAA,QACpB,qBAAqB;AAAA,QACrB,sBAAsB;AAAA,MAAA;AAAA,IAE1B;AAAA,IAEA,mBAAmB;AAAA,MACjB,wBAAwB;AAAA,MACxB,yBAAyB;AAAA,IAC3B;AAAA,IAEA,CAAC,MAAMA,gBAAsB,IAAI,EAAE,GAAG;AAAA,MACpC,eAAe;AAAA,IACjB;AAAA,IAEA,CAAC,MAAMC,gBAAmB,IAAI,EAAE,GAAG;AAAA,MACjC,iBAAiB,MAAM,OAAO;AAAA,MAC9B,mBAAmB,MAAM,OAAO;AAAA,MAChC,CAAC,KAAKA,gBAAmB,eAAe,EAAE,GAAG;AAAA,QAC3C,aAAa;AAAA,MACf;AAAA,MACA,CAAC,KAAKA,gBAAmB,cAAc,EAAE,GAAG;A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UAAU,CAAA;AACZ,CAAC;"}
1
+ {"version":3,"file":"TableSection.styles.js","sources":["../../../src/TableSection/TableSection.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { bulkActionsClasses } from \"../BulkActions\";\nimport { paginationClasses } from \"../Pagination\";\nimport { tableCellClasses } from \"../Table/TableCell\";\nimport { tableContainerClasses } from \"../Table/TableContainer\";\nimport { tableHeaderClasses } from \"../Table/TableHeader\";\nimport { tableRowClasses } from \"../Table/TableRow\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTableSection\", {\n root: {},\n header: {\n // Only apply the border to divide the header and content when both are displayed\n \"+ div\": {\n borderTop: `1px solid ${theme.colors.atmo3}`,\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n },\n },\n actions: {},\n content: {\n marginTop: 0,\n padding: 0,\n\n // Apply border radius to the first child if there's not an header\n \"&:first-of-type\": {\n \"& > :first-of-type\": {\n borderTopLeftRadius: \"inherit\",\n borderTopRightRadius: \"inherit\",\n },\n },\n\n \"& > :last-child\": {\n borderBottomLeftRadius: \"inherit\",\n borderBottomRightRadius: \"inherit\",\n },\n\n [`& .${tableContainerClasses.root}`]: {\n paddingBottom: 0,\n borderTopLeftRadius: \"inherit\",\n borderTopRightRadius: \"inherit\",\n },\n\n [`& .${tableHeaderClasses.head}`]: {\n backgroundColor: theme.colors.atmo2,\n borderBottomColor: theme.colors.atmo3,\n [`&.${tableHeaderClasses.variantCheckbox}`]: {\n borderRight: \"none\",\n },\n [`&.${tableHeaderClasses.variantActions}`]: {\n borderLeft: \"none\",\n },\n },\n\n // Remove border for the last table row\n [`& .${tableRowClasses.root}`]: {\n \"&:last-child\": {\n [`& .${tableCellClasses.root}`]: { borderBottom: \"none\" },\n },\n },\n\n [`& .${tableCellClasses.root}`]: {\n borderBottomColor: theme.colors.atmo3,\n },\n\n [`& .${tableCellClasses.variantCheckbox}`]: {\n borderRight: \"none\",\n },\n\n [`& .${tableCellClasses.variantActions}`]: {\n borderLeft: \"none\",\n },\n\n [`& .${bulkActionsClasses.root}`]: {\n marginBottom: 0,\n border: \"none\",\n borderBottom: `1px solid ${theme.colors.atmo3}`,\n padding: theme.spacing(\"xs\", \"sm\"),\n },\n\n [`& .${paginationClasses.root}`]: {\n margin: 0,\n backgroundColor: theme.colors.atmo2,\n padding: theme.space.xs,\n borderTop: `1px solid ${theme.colors.atmo3}`,\n borderBottomLeftRadius: \"inherit\",\n borderBottomRightRadius: \"inherit\",\n },\n\n [`& .${paginationClasses.pageSizeOptions}`]: {\n left: theme.space.sm,\n },\n [`& .${paginationClasses.pageSizeHeader}`]: {\n border: \"none\",\n \"&:hover\": {\n border: \"none\",\n },\n },\n },\n hidden: {},\n raisedHeader: {\n \"& $content\": {\n paddingTop: 0,\n },\n },\n hasHeader: {},\n /** @deprecated use `hasHeader` instead */\n spaceTop: {},\n});\n"],"names":["tableContainerClasses","tableHeaderClasses","tableRowClasses","tableCellClasses","bulkActionsClasses","paginationClasses"],"mappings":";;;;;;;;;;;;;;AAUO,MAAM,EAAE,eAAe,eAAe,cAAc,kBAAkB;AAAA,EAC3E,MAAM,CAAC;AAAA,EACP,QAAQ;AAAA;AAAA,IAEN,SAAS;AAAA,MACP,WAAW,aAAa,MAAM,OAAO,KAAK;AAAA,MAC1C,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,IAAA;AAAA,EAE1B;AAAA,EACA,SAAS,CAAC;AAAA,EACV,SAAS;AAAA,IACP,WAAW;AAAA,IACX,SAAS;AAAA;AAAA,IAGT,mBAAmB;AAAA,MACjB,sBAAsB;AAAA,QACpB,qBAAqB;AAAA,QACrB,sBAAsB;AAAA,MAAA;AAAA,IAE1B;AAAA,IAEA,mBAAmB;AAAA,MACjB,wBAAwB;AAAA,MACxB,yBAAyB;AAAA,IAC3B;AAAA,IAEA,CAAC,MAAMA,gBAAsB,IAAI,EAAE,GAAG;AAAA,MACpC,eAAe;AA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,EAAE,GAAG;AAAA,MAC3C,MAAM,MAAM,MAAM;AAAA,IACpB;AAAA,IACA,CAAC,MAAMA,gBAAkB,cAAc,EAAE,GAAG;AAAA,MAC1C,QAAQ;AAAA,MACR,WAAW;AAAA,QACT,QAAQ;AAAA,MAAA;AAAA,IACV;AAAA,EAEJ;AAAA,EACA,QAAQ,CAAC;AAAA,EACT,cAAc;AAAA,IACZ,cAAc;AAAA,MACZ,YAAY;AAAA,IAAA;AAAA,EAEhB;AAAA,EACA,WAAW,CAAC;AAAA;AAAA,EAEZ,UAAU,CAAA;AACZ,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TagsInput.js","sources":["../../../src/TagsInput/TagsInput.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useForkRef } from \"@mui/material/utils\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { baseInputClasses } from \"../BaseInput\";\nimport { DEFAULT_ERROR_MESSAGES } from \"../BaseInput/validations\";\nimport {\n HvCharCounter,\n HvCharCounterProps,\n HvFormElement,\n HvFormElementProps,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvWarningText,\n validationStates,\n} from \"../FormElement\";\nimport {\n HvSuggestions,\n HvSuggestionsProps,\n} from \"../FormElement/Suggestions/Suggestions\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useIsMounted } from \"../hooks/useIsMounted\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { HvInput, HvInputProps, HvInputSuggestion } from \"../Input\";\nimport { HvListContainer, HvListItem } from \"../ListContainer\";\nimport { HvTag, HvTagProps } from \"../Tag\";\nimport { isKey } from \"../utils/keyboardUtils\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./TagsInput.styles\";\n\nexport { staticClasses as tagsInputClasses };\n\nexport interface HvTagSuggestion extends HvInputSuggestion {}\n\nexport type HvTagsInputClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTagsInputProps\n extends Omit<\n HvInputProps,\n \"onChange\" | \"onBlur\" | \"onFocus\" | \"onKeyDown\" | \"value\" | \"defaultValue\"\n > {\n /** The value of the form element. */\n value?: string[] | HvTagProps[];\n /** When uncontrolled, defines the initial input value. */\n defaultValue?: string[] | HvTagProps[];\n\n /** The function that will be executed onChange. */\n onChange?: (\n event:\n | React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>\n | React.MouseEvent\n | React.KeyboardEvent<HTMLUListElement>\n | React.FocusEvent<HTMLDivElement>,\n value: HvTagProps[],\n ) => void;\n /** The function that will be executed when the element is focused. */\n onFocus?: (event: React.FocusEvent<HTMLDivElement>, value: string) => void;\n /** The function that will be executed when the element is blurred. */\n onBlur?: (event: React.FocusEvent<HTMLDivElement>, value: string) => void;\n /** The function that will be executed when a tag is deleted. */\n onDelete?: (\n event:\n | React.KeyboardEvent<HTMLUListElement>\n | React.MouseEvent<HTMLElement>,\n value: HvTagProps,\n index: number,\n ) => void;\n /** The function that will be executed when a tag is added. */\n onAdd?: (\n event:\n | React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>\n | React.MouseEvent\n | React.KeyboardEvent<HTMLUListElement>\n | React.FocusEvent<HTMLDivElement>,\n value: HvTagProps,\n index: number,\n ) => void;\n /** If `true` the character counter isn't shown even if maxTagsQuantity is set. */\n hideCounter?: boolean;\n /** Text between the current char counter and max value. */\n middleCountLabel?: string;\n /** The maximum allowed length of the characters, if this value is null no check will be performed. */\n maxTagsQuantity?: number;\n /** If `true` the component is resizable. */\n resizable?: boolean;\n /** Props passed to the HvCharCount component. */\n countCharProps?: Partial<HvCharCounterProps>;\n /** If `true` the component is in multiline mode. */\n multiline?: boolean;\n /** An array of strings that represent the character used to input a tag. This character is the string representation of the event.code from the input event. */\n commitTagOn?: string[];\n /** If `true` the tag will be committed when the blur event occurs. */\n commitOnBlur?: boolean;\n /** The function that will be executed to received an array of objects that has a label and id to create list of suggestions. */\n suggestionListCallback?: (value: string) => HvTagSuggestion[] | null;\n /** The validation function that will be executed when adding tags in the suggestions mode. */\n suggestionValidation?: (value: string) => boolean;\n /** When in suggestions mode, this property indicates that tags that are not present on the suggestions list can also be added. */\n suggestionsLoose?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTagsInputClasses;\n}\n\n/**\n * A tags input is a single or multiline control that allows the input of tags.\n */\nexport const HvTagsInput = forwardRef<HTMLUListElement, HvTagsInputProps>(\n function HvTagsInput(props, ref) {\n const {\n classes: classesProp,\n className,\n id,\n name,\n value: valueProp,\n defaultValue = [],\n readOnly,\n disabled,\n required,\n label: textAreaLabel,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n onChange,\n onAdd,\n onDelete,\n onBlur,\n onFocus,\n placeholder,\n hideCounter,\n middleCountLabel = \"/\",\n maxTagsQuantity,\n resizable = true,\n inputProps,\n countCharProps,\n multiline,\n status,\n statusMessage,\n validationMessages,\n commitTagOn = [\"Enter\"],\n commitOnBlur,\n suggestionListCallback,\n suggestionValidation,\n suggestionsLoose,\n ...others\n } = useDefaultProps(\"HvTagsInput\", props);\n\n const { classes, cx, css } = useClasses(classesProp);\n\n const elementId = useUniqueId(id);\n\n const hasLabel = textAreaLabel != null;\n const hasDescription = description != null;\n\n const [value, setValue] = useControlled(valueProp, defaultValue);\n\n const [validationState, setValidationState] = useControlled<HvFormStatus>(\n status,\n \"standBy\",\n );\n const [validationMessage, setValidationMessage] = useControlled(\n statusMessage,\n \"\",\n );\n\n const [tagInput, setTagInput] = useState(\"\");\n const [tagCursorPos, setTagCursorPos] = useState(value.length);\n const [stateValid, setStateValid] = useState(true);\n\n const inputRef = useRef<any>();\n const containerRef = useRef<any>();\n const skipReset = useRef(false);\n const blurTimeout = useRef<any>();\n const materialInputRef = useRef<any>(null);\n\n const forkedContainerRef = useForkRef(ref, containerRef);\n\n const isTagSelected = tagCursorPos >= 0 && tagCursorPos < value.length;\n const hasCounter = maxTagsQuantity != null && !hideCounter;\n\n // suggestions related state\n const [suggestionValues, setSuggestionValues] = useState<\n HvTagSuggestion[] | null\n >(null);\n\n const isStateInvalid = useMemo(() => {\n return hasCounter && value.length > maxTagsQuantity;\n }, [hasCounter, maxTagsQuantity, value.length]);\n\n const canShowSuggestions = suggestionListCallback != null;\n const hasSuggestions = !!suggestionValues;\n\n const errorMessages = useMemo(\n () => ({ ...DEFAULT_ERROR_MESSAGES, ...validationMessages }),\n [validationMessages],\n );\n\n const performValidation = useCallback(\n (currValue: HvTagProps[]) => {\n if (\n maxTagsQuantity !== null &&\n maxTagsQuantity !== undefined &&\n currValue.length > maxTagsQuantity\n ) {\n setValidationState(validationStates.invalid);\n setValidationMessage(errorMessages.maxCharError);\n setStateValid(false);\n } else {\n setValidationState(validationStates.valid);\n setValidationMessage(\"\");\n setStateValid(true);\n }\n },\n [\n errorMessages.maxCharError,\n maxTagsQuantity,\n setValidationMessage,\n setValidationState,\n ],\n );\n\n /**\n * Deletes a Tag from the array of tags and sets the new position for the tag cursor.\n * Also executes the user provided onDelete and onChange events.\n *\n * @param {number} tagPos - the position at which to remove the tag\n * @param {Event} event - the event associated with the delete\n * @param {boolean} end - whether or not to set the cursor at the end of the array\n */\n const deleteTag = useCallback(\n (\n tagPos: number,\n event:\n | React.KeyboardEvent<HTMLUListElement>\n | React.MouseEvent<HTMLElement>,\n end: boolean,\n ) => {\n const newTagsArr = [\n ...value.slice(0, tagPos),\n ...value.slice(tagPos + 1),\n ] as HvTagProps[];\n setValue(newTagsArr);\n setTagCursorPos(\n end ? newTagsArr.length : tagCursorPos > 0 ? tagCursorPos - 1 : 0,\n );\n inputRef.current?.focus();\n performValidation(newTagsArr);\n onDelete?.(event, value[tagPos] as HvTagProps, tagPos);\n onChange?.(event, newTagsArr);\n skipReset.current = true;\n },\n [onChange, onDelete, performValidation, setValue, tagCursorPos, value],\n );\n\n /**\n * Adds a Tag to the array of tags.\n * Also executes the user provided onAdd and onDelete events.\n *\n * @param {Event} event - whatever event triggered adding a tag\n * @param {string} tag - the string for the tag\n */\n const addTag = useCallback(\n (\n event:\n | React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>\n | React.MouseEvent\n | React.KeyboardEvent<HTMLUListElement>\n | React.FocusEvent<HTMLDivElement>,\n tag: React.ReactNode,\n ) => {\n event.preventDefault();\n if (tag !== \"\") {\n const newTag: HvTagProps = { label: tag, type: \"semantic\" };\n const newTagsArr = [...value, newTag] as HvTagProps[];\n setValue(newTagsArr);\n performValidation(newTagsArr);\n onAdd?.(event, newTag, newTagsArr.length - 1);\n onChange?.(event, newTagsArr);\n }\n },\n [onAdd, onChange, performValidation, setValue, value],\n );\n\n const canShowError =\n (status !== undefined &&\n status === \"invalid\" &&\n statusMessage !== undefined) ||\n !stateValid;\n\n useEffect(() => {\n if (!multiline) {\n const element = containerRef?.current?.children[tagCursorPos];\n // this setTimeout is a workaround for Firefox not properly dealing\n // with setting the scrollLeft value.\n setTimeout(() => {\n const container = containerRef.current;\n if (container == null) return;\n container.scrollLeft = element\n ? element.offsetLeft -\n container.getBoundingClientRect().width / 2 +\n element.getBoundingClientRect().width / 2\n : 0;\n }, 10);\n\n element?.focus();\n }\n }, [multiline, tagCursorPos]);\n\n useEffect(() => {\n if (!skipReset.current) {\n setTagInput(\"\");\n setTagCursorPos(value.length);\n }\n skipReset.current = false;\n }, [value]);\n\n const isMounted = useIsMounted();\n\n /**\n * Looks for the node that represent the input inside the material tree and focus it.\n */\n const focusInput = () => {\n materialInputRef.current.focus();\n };\n\n const getSuggestions = useCallback(\n (li: number) => {\n // TODO Replace with ref\n const listEl = document.getElementById(\n setId(elementId, \"suggestions-list\") || \"\",\n );\n return li != null ? listEl?.getElementsByTagName(\"li\")?.[li] : listEl;\n },\n [elementId],\n );\n\n /**\n * Clears the suggestion array.\n */\n const suggestionClearHandler = useCallback(() => {\n if (isMounted.current) {\n setSuggestionValues(null);\n }\n }, [isMounted]);\n\n /**\n * Fills of the suggestion array.\n */\n const suggestionHandler = useCallback(\n (val: string) => {\n const suggestionsArray = suggestionListCallback?.(val);\n if (suggestionsArray?.[0]?.label) {\n setSuggestionValues(suggestionsArray);\n } else {\n suggestionClearHandler();\n }\n },\n [suggestionClearHandler, suggestionListCallback],\n );\n\n /**\n * Executes the user callback adds the selection to the state and clears the suggestions.\n */\n const suggestionSelectedHandler: HvSuggestionsProps[\"onSuggestionSelected\"] =\n (event, item) => {\n addTag(event, item.value || item.label);\n\n // set the input value (only when value is uncontrolled)\n setTagInput((item.value || item.label) as string); // TODO - in v6 review all types: this is not a string but a React.ReactNode\n\n focusInput();\n suggestionClearHandler();\n };\n\n /**\n * Handler for the `onKeyDown` event on the suggestions component\n */\n const onSuggestionKeyDown = (\n event: React.KeyboardEvent<HTMLDivElement>,\n ) => {\n if (isKey(event, \"Esc\")) {\n suggestionClearHandler();\n focusInput();\n } else if (isKey(event, \"Tab\")) {\n suggestionClearHandler();\n }\n };\n\n /**\n * Handler for the `onChange` event on the tag input\n */\n const onChangeHandler = useCallback(\n (\n event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,\n input: string,\n ) => {\n setTagInput(input);\n\n if (canShowSuggestions) {\n // an edge case might be a controlled input whose onChange callback\n // doesn't change the value (or sets another): the suggestionListCallback\n // callback will still receive the original rejected value.\n // a refactor is needed so the suggestionListCallback might be called only\n // when the input is uncontrolled, providing a way to externally control\n // the suggestion values.\n suggestionHandler(input);\n }\n },\n [canShowSuggestions, suggestionHandler],\n );\n\n /**\n * Handler for the `onKeyDown` event on the form element\n */\n const onInputKeyDownHandler = useCallback(\n (\n event:\n | React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>\n | React.MouseEvent,\n ) => {\n if (!canShowSuggestions && commitTagOn.includes((event as any).code)) {\n addTag(event, tagInput);\n }\n },\n [addTag, canShowSuggestions, commitTagOn, tagInput],\n );\n\n /**\n * Handler for the `onKeyDown` event on the list container.\n */\n const onKeyDownHandler = useCallback(\n (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (tagInput === \"\") {\n switch (event.code) {\n case \"ArrowLeft\":\n setTagCursorPos(tagCursorPos > 0 ? tagCursorPos - 1 : 0);\n break;\n case \"ArrowRight\":\n setTagCursorPos(\n tagCursorPos < value.length ? tagCursorPos + 1 : value.length,\n );\n break;\n case \"Backspace\":\n if (isTagSelected) {\n deleteTag(tagCursorPos, event, false);\n } else {\n setTagCursorPos(value.length - 1);\n }\n break;\n case \"Delete\":\n if (isTagSelected) {\n deleteTag(tagCursorPos, event, false);\n }\n break;\n default:\n break;\n }\n } else {\n switch (event.code) {\n case \"ArrowDown\":\n getSuggestions(0)?.focus();\n break;\n case \"Enter\":\n if (\n canShowSuggestions &&\n suggestionsLoose &&\n (suggestionValidation?.(tagInput) || !suggestionValidation)\n ) {\n addTag(event, tagInput);\n\n // set the input value (only when value is uncontrolled)\n setTagInput(tagInput);\n\n focusInput();\n suggestionClearHandler();\n }\n break;\n default:\n break;\n }\n }\n },\n [\n addTag,\n canShowSuggestions,\n deleteTag,\n getSuggestions,\n isTagSelected,\n suggestionClearHandler,\n suggestionValidation,\n suggestionsLoose,\n tagCursorPos,\n tagInput,\n value.length,\n ],\n );\n\n /**\n * Handler for the `onDelete` event on the tag component\n */\n const onDeleteTagHandler = useCallback(\n (event: React.MouseEvent<HTMLElement>, i: number) => {\n deleteTag(i, event, true);\n setValidationState(validationStates.standBy);\n },\n [deleteTag, setValidationState],\n );\n\n /**\n * Handler for the `onClick` event on the list container\n */\n const onContainerClickHandler = useCallback(() => {\n inputRef.current?.focus();\n clearTimeout(blurTimeout.current);\n setTagCursorPos(value.length);\n }, [value.length]);\n\n const onBlurHandler: HvFormElementProps[\"onBlur\"] = (evt) => {\n blurTimeout.current = setTimeout(() => {\n if (commitOnBlur) {\n addTag(evt, tagInput);\n }\n onBlur?.(evt, tagInput);\n }, 10);\n };\n\n const onFocusHandler: HvFormElementProps[\"onFocus\"] = (evt) => {\n clearTimeout(blurTimeout.current);\n onFocus?.(evt, tagInput);\n };\n\n return (\n <HvFormElement\n id={id}\n name={name}\n disabled={disabled}\n readOnly={readOnly}\n status={validationState}\n required={required}\n onBlur={onBlurHandler}\n onFocus={onFocusHandler}\n className={cx(\n classes.root,\n { [classes.disabled]: disabled, [classes.readOnly]: readOnly },\n className,\n )}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n className={classes.label}\n id={setId(id, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={textAreaLabel}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n className={classes.description}\n id={setId(elementId, \"description\")}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n\n {hasCounter && (\n <HvCharCounter\n id={setId(elementId, \"charCounter\")}\n className={classes.characterCounter}\n separator={middleCountLabel}\n currentCharQuantity={value.length}\n maxCharQuantity={maxTagsQuantity}\n {...countCharProps}\n />\n )}\n\n <HvListContainer\n className={cx(classes.tagsList, {\n [classes.error]: canShowError,\n [classes.resizable]: resizable && multiline,\n [classes.invalid]: isStateInvalid,\n [classes.singleLine]: !multiline,\n })}\n onKeyDown={onKeyDownHandler}\n onClick={onContainerClickHandler}\n ref={forkedContainerRef}\n >\n {value?.map((t, i) => {\n const tag =\n typeof t === \"string\"\n ? {\n label: t,\n type: \"semantic\",\n }\n : t;\n const { label, type, ...otherProps } = tag;\n return (\n <HvListItem\n key={`${tag.label}-${i}`}\n tabIndex={-1}\n className={cx({ [classes.singleLine]: !multiline })}\n classes={{\n gutters: classes.listItemGutters,\n root: classes.listItemRoot,\n }}\n id={setId(elementId, `tag-${i}`)}\n >\n <HvTag\n label={label}\n className={cx({\n [classes.tagSelected]: i === tagCursorPos,\n })}\n classes={{\n chipRoot: classes.chipRoot,\n }}\n type={type as HvTagProps[\"type\"]}\n {...(!(readOnly || disabled || type === \"categorical\") && {\n onDelete: (event) => onDeleteTagHandler(event, i),\n })}\n deleteButtonProps={{\n tabIndex: -1,\n }}\n {...otherProps}\n />\n </HvListItem>\n );\n })}\n {!(disabled || readOnly) && (\n <HvListItem\n className={cx(\n {\n [classes.singleLine]: !multiline,\n [classes.tagInputRootEmpty]: value.length === 0,\n },\n !!isTagSelected &&\n css({\n [`& .${baseInputClasses.inputRoot}`]: {\n backgroundColor: theme.colors.atmo1,\n },\n }),\n )}\n classes={{\n root: classes.tagInputContainerRoot,\n gutters: classes.listItemGutters,\n }}\n id={setId(elementId, `tag-${value.length}`)}\n >\n <HvInput\n value={tagInput}\n disableClear\n onChange={onChangeHandler}\n onKeyDown={onInputKeyDownHandler}\n placeholder={value.length === 0 ? placeholder : \"\"}\n className={cx({\n [classes.singleLine]: !multiline,\n })}\n classes={{\n root: classes.tagInputRoot,\n input: classes.input,\n inputBorderContainer: classes.tagInputBorderContainer,\n inputRootFocused: classes.tagInputRootFocused,\n }}\n disabled={disabled}\n readOnly={readOnly || isTagSelected}\n inputProps={{\n ref: materialInputRef,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\":\n ariaDescribedBy != null\n ? ariaDescribedBy\n : (description && setId(elementId, \"description\")) ||\n undefined,\n\n ...inputProps,\n }}\n ref={inputRef}\n {...others}\n />\n </HvListItem>\n )}\n </HvListContainer>\n {canShowSuggestions && (\n <>\n {hasSuggestions && (\n <div role=\"presentation\" className={classes.inputExtension} />\n )}\n <HvSuggestions\n id={setId(elementId, \"suggestions\")}\n classes={{\n root: classes.suggestionsContainer,\n list: classes.suggestionList,\n }}\n expanded={hasSuggestions}\n anchorEl={containerRef?.current?.parentElement}\n onClose={suggestionClearHandler}\n onKeyDown={onSuggestionKeyDown}\n onSuggestionSelected={suggestionSelectedHandler}\n suggestionValues={suggestionValues}\n />\n </>\n )}\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n disableBorder\n className={classes.error}\n >\n {validationMessage}\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A,wBACA,KAAK;AAAA,wBACJ,GAAG;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACN;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UAEJ;AAAA,UACC,sBAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,YAAA,sCACE,OAAI,EAAA,MAAK,gBAAe,WAAW,QAAQ,gBAAgB;AAAA,YAE9D;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,IAAI,MAAM,WAAW,aAAa;AAAA,gBAClC,SAAS;AAAA,kBACP,MAAM,QAAQ;AAAA,kBACd,MAAM,QAAQ;AAAA,gBAChB;AAAA,gBACA,UAAU;AAAA,gBACV,UAAU,cAAc,SAAS;AAAA,gBACjC,SAAS;AAAA,gBACT,WAAW;AAAA,gBACX,sBAAsB;AAAA,gBACtB;AAAA,cAAA;AAAA,YAAA;AAAA,UACF,GACF;AAAA,UAED,gBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAI,MAAM,WAAW,OAAO;AAAA,cAC5B,eAAa;AAAA,cACb,WAAW,QAAQ;AAAA,cAElB,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"TagsInput.js","sources":["../../../src/TagsInput/TagsInput.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useForkRef } from \"@mui/material/utils\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { baseInputClasses } from \"../BaseInput\";\nimport { DEFAULT_ERROR_MESSAGES } from \"../BaseInput/validations\";\nimport {\n HvCharCounter,\n HvCharCounterProps,\n HvFormElement,\n HvFormElementProps,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvWarningText,\n validationStates,\n} from \"../FormElement\";\nimport {\n HvSuggestions,\n HvSuggestionsProps,\n} from \"../FormElement/Suggestions/Suggestions\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useIsMounted } from \"../hooks/useIsMounted\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { HvInput, HvInputProps, HvInputSuggestion } from \"../Input\";\nimport { HvListContainer, HvListItem } from \"../ListContainer\";\nimport { HvTag, HvTagProps } from \"../Tag\";\nimport { isKey } from \"../utils/keyboardUtils\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./TagsInput.styles\";\n\nexport { staticClasses as tagsInputClasses };\n\nexport interface HvTagSuggestion extends HvInputSuggestion {}\n\nexport type HvTagsInputClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTagsInputProps\n extends Omit<\n HvInputProps,\n \"onChange\" | \"onBlur\" | \"onFocus\" | \"onKeyDown\" | \"value\" | \"defaultValue\"\n > {\n /** The value of the form element. */\n value?: string[] | HvTagProps[];\n /** When uncontrolled, defines the initial input value. */\n defaultValue?: string[] | HvTagProps[];\n\n /** The function that will be executed onChange. */\n onChange?: (\n event:\n | React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>\n | React.MouseEvent\n | React.KeyboardEvent<HTMLUListElement>\n | React.FocusEvent<HTMLDivElement>,\n value: HvTagProps[],\n ) => void;\n /** The function that will be executed when the element is focused. */\n onFocus?: (event: React.FocusEvent<HTMLDivElement>, value: string) => void;\n /** The function that will be executed when the element is blurred. */\n onBlur?: (event: React.FocusEvent<HTMLDivElement>, value: string) => void;\n /** The function that will be executed when a tag is deleted. */\n onDelete?: (\n event:\n | React.KeyboardEvent<HTMLUListElement>\n | React.MouseEvent<HTMLElement>,\n value: HvTagProps,\n index: number,\n ) => void;\n /** The function that will be executed when a tag is added. */\n onAdd?: (\n event:\n | React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>\n | React.MouseEvent\n | React.KeyboardEvent<HTMLUListElement>\n | React.FocusEvent<HTMLDivElement>,\n value: HvTagProps,\n index: number,\n ) => void;\n /** If `true` the character counter isn't shown even if maxTagsQuantity is set. */\n hideCounter?: boolean;\n /** Text between the current char counter and max value. */\n middleCountLabel?: string;\n /** The maximum allowed length of the characters, if this value is null no check will be performed. */\n maxTagsQuantity?: number;\n /** If `true` the component is resizable. */\n resizable?: boolean;\n /** Props passed to the HvCharCount component. */\n countCharProps?: Partial<HvCharCounterProps>;\n /** If `true` the component is in multiline mode. */\n multiline?: boolean;\n /** An array of strings that represent the character used to input a tag. This character is the string representation of the event.code from the input event. */\n commitTagOn?: string[];\n /** If `true` the tag will be committed when the blur event occurs. */\n commitOnBlur?: boolean;\n /** The function that will be executed to received an array of objects that has a label and id to create list of suggestions. */\n suggestionListCallback?: (value: string) => HvTagSuggestion[] | null;\n /** The validation function that will be executed when adding tags in the suggestions mode. */\n suggestionValidation?: (value: string) => boolean;\n /** When in suggestions mode, this property indicates that tags that are not present on the suggestions list can also be added. */\n suggestionsLoose?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTagsInputClasses;\n}\n\n/**\n * A tags input is a single or multiline control that allows the input of tags.\n */\nexport const HvTagsInput = forwardRef<HTMLUListElement, HvTagsInputProps>(\n function HvTagsInput(props, ref) {\n const {\n classes: classesProp,\n className,\n id,\n name,\n value: valueProp,\n defaultValue = [],\n readOnly,\n disabled,\n required,\n label: textAreaLabel,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n onChange,\n onAdd,\n onDelete,\n onBlur,\n onFocus,\n placeholder,\n hideCounter,\n middleCountLabel = \"/\",\n maxTagsQuantity,\n resizable = true,\n inputProps,\n countCharProps,\n multiline,\n status,\n statusMessage,\n validationMessages,\n commitTagOn = [\"Enter\"],\n commitOnBlur,\n suggestionListCallback,\n suggestionValidation,\n suggestionsLoose,\n ...others\n } = useDefaultProps(\"HvTagsInput\", props);\n\n const { classes, cx, css } = useClasses(classesProp);\n\n const elementId = useUniqueId(id);\n\n const hasLabel = textAreaLabel != null;\n const hasDescription = description != null;\n\n const [value, setValue] = useControlled(valueProp, defaultValue);\n\n const [validationState, setValidationState] = useControlled<HvFormStatus>(\n status,\n \"standBy\",\n );\n const [validationMessage, setValidationMessage] = useControlled(\n statusMessage,\n \"\",\n );\n\n const [tagInput, setTagInput] = useState(\"\");\n const [tagCursorPos, setTagCursorPos] = useState(value.length);\n const [stateValid, setStateValid] = useState(true);\n\n const inputRef = useRef<any>();\n const containerRef = useRef<any>();\n const skipReset = useRef(false);\n const blurTimeout = useRef<any>();\n const materialInputRef = useRef<any>(null);\n\n const forkedContainerRef = useForkRef(ref, containerRef);\n\n const isTagSelected = tagCursorPos >= 0 && tagCursorPos < value.length;\n const hasCounter = maxTagsQuantity != null && !hideCounter;\n\n // suggestions related state\n const [suggestionValues, setSuggestionValues] = useState<\n HvTagSuggestion[] | null\n >(null);\n\n const isStateInvalid = useMemo(() => {\n return hasCounter && value.length > maxTagsQuantity;\n }, [hasCounter, maxTagsQuantity, value.length]);\n\n const canShowSuggestions = suggestionListCallback != null;\n const hasSuggestions = !!suggestionValues;\n\n const errorMessages = useMemo(\n () => ({ ...DEFAULT_ERROR_MESSAGES, ...validationMessages }),\n [validationMessages],\n );\n\n const performValidation = useCallback(\n (currValue: HvTagProps[]) => {\n if (\n maxTagsQuantity !== null &&\n maxTagsQuantity !== undefined &&\n currValue.length > maxTagsQuantity\n ) {\n setValidationState(validationStates.invalid);\n setValidationMessage(errorMessages.maxCharError);\n setStateValid(false);\n } else {\n setValidationState(validationStates.valid);\n setValidationMessage(\"\");\n setStateValid(true);\n }\n },\n [\n errorMessages.maxCharError,\n maxTagsQuantity,\n setValidationMessage,\n setValidationState,\n ],\n );\n\n /**\n * Deletes a Tag from the array of tags and sets the new position for the tag cursor.\n * Also executes the user provided onDelete and onChange events.\n *\n * @param {number} tagPos - the position at which to remove the tag\n * @param {Event} event - the event associated with the delete\n * @param {boolean} end - whether or not to set the cursor at the end of the array\n */\n const deleteTag = useCallback(\n (\n tagPos: number,\n event:\n | React.KeyboardEvent<HTMLUListElement>\n | React.MouseEvent<HTMLElement>,\n end: boolean,\n ) => {\n const newTagsArr = [\n ...value.slice(0, tagPos),\n ...value.slice(tagPos + 1),\n ] as HvTagProps[];\n setValue(newTagsArr);\n setTagCursorPos(\n end ? newTagsArr.length : tagCursorPos > 0 ? tagCursorPos - 1 : 0,\n );\n inputRef.current?.focus();\n performValidation(newTagsArr);\n onDelete?.(event, value[tagPos] as HvTagProps, tagPos);\n onChange?.(event, newTagsArr);\n skipReset.current = true;\n },\n [onChange, onDelete, performValidation, setValue, tagCursorPos, value],\n );\n\n /**\n * Adds a Tag to the array of tags.\n * Also executes the user provided onAdd and onDelete events.\n *\n * @param {Event} event - whatever event triggered adding a tag\n * @param {string} tag - the string for the tag\n */\n const addTag = useCallback(\n (\n event:\n | React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>\n | React.MouseEvent\n | React.KeyboardEvent<HTMLUListElement>\n | React.FocusEvent<HTMLDivElement>,\n tag: React.ReactNode,\n ) => {\n event.preventDefault();\n if (tag !== \"\") {\n const newTag: HvTagProps = { label: tag, type: \"semantic\" };\n const newTagsArr = [...value, newTag] as HvTagProps[];\n setValue(newTagsArr);\n performValidation(newTagsArr);\n onAdd?.(event, newTag, newTagsArr.length - 1);\n onChange?.(event, newTagsArr);\n }\n },\n [onAdd, onChange, performValidation, setValue, value],\n );\n\n const canShowError =\n (status !== undefined &&\n status === \"invalid\" &&\n statusMessage !== undefined) ||\n !stateValid;\n\n useEffect(() => {\n if (!multiline) {\n const element = containerRef?.current?.children[tagCursorPos];\n // this setTimeout is a workaround for Firefox not properly dealing\n // with setting the scrollLeft value.\n setTimeout(() => {\n const container = containerRef.current;\n if (container == null) return;\n container.scrollLeft = element\n ? element.offsetLeft -\n container.getBoundingClientRect().width / 2 +\n element.getBoundingClientRect().width / 2\n : 0;\n }, 10);\n\n element?.focus();\n }\n }, [multiline, tagCursorPos]);\n\n useEffect(() => {\n if (!skipReset.current) {\n setTagInput(\"\");\n setTagCursorPos(value.length);\n }\n skipReset.current = false;\n }, [value]);\n\n const isMounted = useIsMounted();\n\n /**\n * Looks for the node that represent the input inside the material tree and focus it.\n */\n const focusInput = () => {\n materialInputRef.current.focus();\n };\n\n const getSuggestions = useCallback(\n (li: number) => {\n // TODO Replace with ref\n const listEl = document.getElementById(\n setId(elementId, \"suggestions-list\") || \"\",\n );\n return li != null ? listEl?.getElementsByTagName(\"li\")?.[li] : listEl;\n },\n [elementId],\n );\n\n /**\n * Clears the suggestion array.\n */\n const suggestionClearHandler = useCallback(() => {\n if (isMounted.current) {\n setSuggestionValues(null);\n }\n }, [isMounted]);\n\n /**\n * Fills of the suggestion array.\n */\n const suggestionHandler = useCallback(\n (val: string) => {\n const suggestionsArray = suggestionListCallback?.(val);\n if (suggestionsArray?.[0]?.label) {\n setSuggestionValues(suggestionsArray);\n } else {\n suggestionClearHandler();\n }\n },\n [suggestionClearHandler, suggestionListCallback],\n );\n\n /**\n * Executes the user callback adds the selection to the state and clears the suggestions.\n */\n const suggestionSelectedHandler: HvSuggestionsProps[\"onSuggestionSelected\"] =\n (event, item) => {\n addTag(event, item.value || item.label);\n\n // set the input value (only when value is uncontrolled)\n setTagInput((item.value || item.label) as string); // TODO - in v6 review all types: this is not a string but a React.ReactNode\n\n focusInput();\n suggestionClearHandler();\n };\n\n /**\n * Handler for the `onKeyDown` event on the suggestions component\n */\n const onSuggestionKeyDown = (\n event: React.KeyboardEvent<HTMLDivElement>,\n ) => {\n if (isKey(event, \"Esc\")) {\n suggestionClearHandler();\n focusInput();\n } else if (isKey(event, \"Tab\")) {\n suggestionClearHandler();\n }\n };\n\n /**\n * Handler for the `onChange` event on the tag input\n */\n const onChangeHandler = useCallback(\n (\n event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,\n input: string,\n ) => {\n setTagInput(input);\n\n if (canShowSuggestions) {\n // an edge case might be a controlled input whose onChange callback\n // doesn't change the value (or sets another): the suggestionListCallback\n // callback will still receive the original rejected value.\n // a refactor is needed so the suggestionListCallback might be called only\n // when the input is uncontrolled, providing a way to externally control\n // the suggestion values.\n suggestionHandler(input);\n }\n },\n [canShowSuggestions, suggestionHandler],\n );\n\n /**\n * Handler for the `onKeyDown` event on the form element\n */\n const onInputKeyDownHandler = useCallback(\n (\n event:\n | React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>\n | React.MouseEvent,\n ) => {\n if (!canShowSuggestions && commitTagOn.includes((event as any).code)) {\n addTag(event, tagInput);\n }\n },\n [addTag, canShowSuggestions, commitTagOn, tagInput],\n );\n\n /**\n * Handler for the `onKeyDown` event on the list container.\n */\n const onKeyDownHandler = useCallback(\n (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (tagInput === \"\") {\n switch (event.code) {\n case \"ArrowLeft\":\n setTagCursorPos(tagCursorPos > 0 ? tagCursorPos - 1 : 0);\n break;\n case \"ArrowRight\":\n setTagCursorPos(\n tagCursorPos < value.length ? tagCursorPos + 1 : value.length,\n );\n break;\n case \"Backspace\":\n if (isTagSelected) {\n deleteTag(tagCursorPos, event, false);\n } else {\n setTagCursorPos(value.length - 1);\n }\n break;\n case \"Delete\":\n if (isTagSelected) {\n deleteTag(tagCursorPos, event, false);\n }\n break;\n default:\n break;\n }\n } else {\n switch (event.code) {\n case \"ArrowDown\":\n getSuggestions(0)?.focus();\n break;\n case \"Enter\":\n if (\n canShowSuggestions &&\n suggestionsLoose &&\n (suggestionValidation?.(tagInput) || !suggestionValidation)\n ) {\n addTag(event, tagInput);\n\n // set the input value (only when value is uncontrolled)\n setTagInput(tagInput);\n\n focusInput();\n suggestionClearHandler();\n }\n break;\n default:\n break;\n }\n }\n },\n [\n addTag,\n canShowSuggestions,\n deleteTag,\n getSuggestions,\n isTagSelected,\n suggestionClearHandler,\n suggestionValidation,\n suggestionsLoose,\n tagCursorPos,\n tagInput,\n value.length,\n ],\n );\n\n /**\n * Handler for the `onDelete` event on the tag component\n */\n const onDeleteTagHandler = useCallback(\n (event: React.MouseEvent<HTMLElement>, i: number) => {\n deleteTag(i, event, true);\n setValidationState(validationStates.standBy);\n },\n [deleteTag, setValidationState],\n );\n\n /**\n * Handler for the `onClick` event on the list container\n */\n const onContainerClickHandler = useCallback(() => {\n inputRef.current?.focus();\n clearTimeout(blurTimeout.current);\n setTagCursorPos(value.length);\n }, [value.length]);\n\n const onBlurHandler: HvFormElementProps[\"onBlur\"] = (evt) => {\n blurTimeout.current = setTimeout(() => {\n if (commitOnBlur) {\n addTag(evt, tagInput);\n }\n onBlur?.(evt, tagInput);\n }, 10);\n };\n\n const onFocusHandler: HvFormElementProps[\"onFocus\"] = (evt) => {\n clearTimeout(blurTimeout.current);\n onFocus?.(evt, tagInput);\n };\n\n return (\n <HvFormElement\n id={id}\n name={name}\n disabled={disabled}\n readOnly={readOnly}\n status={validationState}\n required={required}\n onBlur={onBlurHandler}\n onFocus={onFocusHandler}\n className={cx(\n classes.root,\n { [classes.disabled]: disabled, [classes.readOnly]: readOnly },\n className,\n )}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n className={classes.label}\n id={setId(id, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={textAreaLabel}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n className={classes.description}\n id={setId(elementId, \"description\")}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n\n {hasCounter && (\n <HvCharCounter\n id={setId(elementId, \"charCounter\")}\n className={classes.characterCounter}\n separator={middleCountLabel}\n currentCharQuantity={value.length}\n maxCharQuantity={maxTagsQuantity}\n {...countCharProps}\n />\n )}\n\n <HvListContainer\n className={cx(classes.tagsList, {\n [classes.error]: canShowError,\n [classes.resizable]: resizable && multiline,\n [classes.invalid]: isStateInvalid,\n [classes.singleLine]: !multiline,\n })}\n onKeyDown={onKeyDownHandler}\n onClick={onContainerClickHandler}\n ref={forkedContainerRef}\n >\n {value?.map((t, i) => {\n const tag =\n typeof t === \"string\"\n ? {\n label: t,\n type: \"semantic\",\n }\n : t;\n const { label, type, ...otherProps } = tag;\n return (\n <HvListItem\n key={`${tag.label}-${i}`}\n tabIndex={-1}\n className={cx({ [classes.singleLine]: !multiline })}\n classes={{\n gutters: classes.listItemGutters,\n root: classes.listItemRoot,\n }}\n id={setId(elementId, `tag-${i}`)}\n >\n <HvTag\n label={label}\n className={cx({\n [classes.tagSelected]: i === tagCursorPos,\n })}\n classes={{\n chipRoot: classes.chipRoot,\n }}\n type={type as HvTagProps[\"type\"]}\n {...(!(readOnly || disabled || type === \"categorical\") && {\n onDelete: (event) => onDeleteTagHandler(event, i),\n })}\n deleteButtonProps={{\n tabIndex: -1,\n }}\n {...otherProps}\n />\n </HvListItem>\n );\n })}\n {!(disabled || readOnly) && (\n <HvListItem\n className={cx(\n {\n [classes.singleLine]: !multiline,\n [classes.tagInputRootEmpty]: value.length === 0,\n },\n !!isTagSelected &&\n css({\n [`& .${baseInputClasses.inputRoot}`]: {\n backgroundColor: theme.colors.atmo1,\n },\n }),\n )}\n classes={{\n root: classes.tagInputContainerRoot,\n gutters: classes.listItemGutters,\n }}\n id={setId(elementId, `tag-${value.length}`)}\n >\n <HvInput\n value={tagInput}\n disableClear\n onChange={onChangeHandler}\n onKeyDown={onInputKeyDownHandler}\n placeholder={value.length === 0 ? placeholder : \"\"}\n className={cx({\n [classes.singleLine]: !multiline,\n })}\n classes={{\n root: classes.tagInputRoot,\n input: classes.input,\n inputBorderContainer: classes.tagInputBorderContainer,\n inputRootFocused: classes.tagInputRootFocused,\n }}\n disabled={disabled}\n readOnly={readOnly || isTagSelected}\n inputProps={{\n ref: materialInputRef,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\":\n ariaDescribedBy != null\n ? ariaDescribedBy\n : (description && setId(elementId, \"description\")) ||\n undefined,\n\n ...inputProps,\n }}\n ref={inputRef}\n {...others}\n />\n </HvListItem>\n )}\n </HvListContainer>\n {canShowSuggestions && (\n <>\n {hasSuggestions && (\n <div role=\"presentation\" className={classes.inputExtension} />\n )}\n <HvSuggestions\n id={setId(elementId, \"suggestions\")}\n classes={{\n root: classes.suggestionsContainer,\n list: classes.suggestionList,\n }}\n expanded={hasSuggestions}\n anchorEl={containerRef?.current?.parentElement}\n onClose={suggestionClearHandler}\n onKeyDown={onSuggestionKeyDown}\n onSuggestionSelected={suggestionSelectedHandler}\n suggestionValues={suggestionValues}\n />\n </>\n )}\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n disableBorder\n className={classes.error}\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n },\n);\n"],"names":["HvTagsInput","baseInputClasses"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsHO,MAAM,cAAc;AAAA,EACzB,SAASA,aAAY,OAAO,KAAK;AACzB,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP,eAAe,CAAC;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB;AAAA,MACA,oBAAoB;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,mBAAmB;AAAA,MACnB;AAAA,MACA,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAc,CAAC,OAAO;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA,IACD,gBAAgB,eAAe,KAAK;AAExC,UAAM,EAAE,SAAS,IAAI,IAAI,IAAI,WAAW,WAAW;AAE7C,UAAA,YAAY,YAAY,EAAE;AAEhC,UAAM,WAAW,iBAAiB;AAClC,UAAM,iBAAiB,eAAe;AAEtC,UAAM,CA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;AAAA,wBAAA,CACxB;AAAA,wBACD,SAAS;AAAA,0BACP,MAAM,QAAQ;AAAA,0BACd,OAAO,QAAQ;AAAA,0BACf,sBAAsB,QAAQ;AAAA,0BAC9B,kBAAkB,QAAQ;AAAA,wBAC5B;AAAA,wBACA;AAAA,wBACA,UAAU,YAAY;AAAA,wBACtB,YAAY;AAAA,0BACV,KAAK;AAAA,0BACL,cAAc;AAAA,0BACd,mBAAmB;AAAA,0BACnB,oBACE,mBAAmB,OACf,kBACC,eAAe,MAAM,WAAW,aAAa,KAC9C;AAAA,0BAEN,GAAG;AAAA,wBACL;AAAA,wBACA,KAAK;AAAA,wBACJ,GAAG;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACN;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UAEJ;AAAA,UACC,sBAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,YAAA,sCACE,OAAI,EAAA,MAAK,gBAAe,WAAW,QAAQ,gBAAgB;AAAA,YAE9D;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,IAAI,MAAM,WAAW,aAAa;AAAA,gBAClC,SAAS;AAAA,kBACP,MAAM,QAAQ;AAAA,kBACd,MAAM,QAAQ;AAAA,gBAChB;AAAA,gBACA,UAAU;AAAA,gBACV,UAAU,cAAc,SAAS;AAAA,gBACjC,SAAS;AAAA,gBACT,WAAW;AAAA,gBACX,sBAAsB;AAAA,gBACtB;AAAA,cAAA;AAAA,YAAA;AAAA,UACF,GACF;AAAA,UAED,gBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAI,MAAM,WAAW,OAAO;AAAA,cAC5B,eAAa;AAAA,cACb,WAAW,QAAQ;AAAA,cAElB,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAGN;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EventManager.js","sources":["../../../../../src/TreeView/internals/utils/EventManager.ts"],"sourcesContent":["export type EventListener = (...args: any[]) => void;\n\nexport interface EventListenerOptions {\n isFirst?: boolean;\n}\n\ninterface EventListenerCollection {\n /**\n * List of listeners to run before the others\n * They are run in the opposite order of the registration order\n */\n highPriority: Map<EventListener, true>;\n /**\n * List of events to run after the high priority listeners\n * They are run in the registration order\n */\n regular: Map<EventListener, true>;\n}\n\n// Used https://gist.github.com/mudge/5830382 as a starting point.\n// See https://github.com/browserify/events/blob/master/events.js for\n// the Node.js (https://nodejs.org/api/events.html) polyfill used by webpack.\nexport class EventManager {\n maxListeners = 20;\n\n warnOnce = false;\n\n events: { [eventName: string]: EventListenerCollection } = {};\n\n on(\n eventName: string,\n listener: EventListener,\n options: EventListenerOptions = {},\n ): void {\n let collection = this.events[eventName];\n\n if (!collection) {\n collection = {\n highPriority: new Map(),\n regular: new Map(),\n };\n this.events[eventName] = collection;\n }\n\n if (options.isFirst) {\n collection.highPriority.set(listener, true);\n } else {\n collection.regular.set(listener, true);\n }\n }\n\n removeListener(eventName: string, listener: EventListener): void {\n if (this.events[eventName]) {\n this.events[eventName].regular.delete(listener);\n this.events[eventName].highPriority.delete(listener);\n }\n }\n\n removeAllListeners(): void {\n this.events = {};\n }\n\n emit(eventName: string, ...args: any[]): void {\n const collection = this.events[eventName];\n if (!collection) {\n return;\n }\n\n const highPriorityListeners = Array.from(collection.highPriority.keys());\n const regularListeners = Array.from(collection.regular.keys());\n\n for (let i = highPriorityListeners.length - 1; i >= 0; i -= 1) {\n const listener = highPriorityListeners[i];\n if (collection.highPriority.has(listener)) {\n listener.apply(this, args);\n }\n }\n\n for (let i = 0; i < regularListeners.length; i += 1) {\n const listener = regularListeners[i];\n if (collection.regular.has(listener)) {\n listener.apply(this, args);\n }\n }\n }\n\n once(eventName: string, listener: EventListener): void {\n // eslint-disable-next-line consistent-this\n const that = this;\n this.on(eventName, function oneTimeListener(...args) {\n that.removeListener(eventName, oneTimeListener);\n listener.apply(that, args);\n });\n }\n}\n"],"names":[],"mappings":"AAsBO,MAAM,aAAa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,iBAAA,MAAM,MAAM,IAAI;AAAA,MAAA;AAAA,IAC3B;AAAA,EACF;AAAA,EAGF,KAAK,WAAmB,UAA+B;AAErD,UAAM,OAAO;AACb,SAAK,GAAG,WAAW,SAAS,mBAAmB,MAAM;AAC9C,WAAA,eAAe,WAAW,eAAe;AACrC,eAAA,MAAM,MAAM,IAAI;AAAA,IAAA,CAC1B;AAAA,EAAA;AAEL;"}
1
+ {"version":3,"file":"EventManager.js","sources":["../../../../../src/TreeView/internals/utils/EventManager.ts"],"sourcesContent":["export type EventListener = (...args: any[]) => void;\n\nexport interface EventListenerOptions {\n isFirst?: boolean;\n}\n\ninterface EventListenerCollection {\n /**\n * List of listeners to run before the others\n * They are run in the opposite order of the registration order\n */\n highPriority: Map<EventListener, true>;\n /**\n * List of events to run after the high priority listeners\n * They are run in the registration order\n */\n regular: Map<EventListener, true>;\n}\n\n// Used https://gist.github.com/mudge/5830382 as a starting point.\n// See https://github.com/browserify/events/blob/master/events.js for\n// the Node.js (https://nodejs.org/api/events.html) polyfill used by webpack.\nexport class EventManager {\n maxListeners = 20;\n\n warnOnce = false;\n\n events: { [eventName: string]: EventListenerCollection } = {};\n\n on(\n eventName: string,\n listener: EventListener,\n options: EventListenerOptions = {},\n ): void {\n let collection = this.events[eventName];\n\n if (!collection) {\n collection = {\n highPriority: new Map(),\n regular: new Map(),\n };\n this.events[eventName] = collection;\n }\n\n if (options.isFirst) {\n collection.highPriority.set(listener, true);\n } else {\n collection.regular.set(listener, true);\n }\n }\n\n removeListener(eventName: string, listener: EventListener): void {\n if (this.events[eventName]) {\n this.events[eventName].regular.delete(listener);\n this.events[eventName].highPriority.delete(listener);\n }\n }\n\n removeAllListeners(): void {\n this.events = {};\n }\n\n emit(eventName: string, ...args: any[]): void {\n const collection = this.events[eventName];\n if (!collection) {\n return;\n }\n\n const highPriorityListeners = Array.from(collection.highPriority.keys());\n const regularListeners = Array.from(collection.regular.keys());\n\n for (let i = highPriorityListeners.length - 1; i >= 0; i -= 1) {\n const listener = highPriorityListeners[i];\n if (collection.highPriority.has(listener)) {\n listener.apply(this, args);\n }\n }\n\n for (let i = 0; i < regularListeners.length; i += 1) {\n const listener = regularListeners[i];\n if (collection.regular.has(listener)) {\n listener.apply(this, args);\n }\n }\n }\n\n once(eventName: string, listener: EventListener): void {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this;\n this.on(eventName, function oneTimeListener(...args) {\n that.removeListener(eventName, oneTimeListener);\n listener.apply(that, args);\n });\n }\n}\n"],"names":[],"mappings":"AAsBO,MAAM,aAAa;AAAA,EACxB,eAAe;AAAA,EAEf,WAAW;AAAA,EAEX,SAA2D,CAAC;AAAA,EAE5D,GACE,WACA,UACA,UAAgC,CAAA,GAC1B;AACF,QAAA,aAAa,KAAK,OAAO,SAAS;AAEtC,QAAI,CAAC,YAAY;AACF,mBAAA;AAAA,QACX,kCAAkB,IAAI;AAAA,QACtB,6BAAa,IAAI;AAAA,MACnB;AACK,WAAA,OAAO,SAAS,IAAI;AAAA,IAAA;AAG3B,QAAI,QAAQ,SAAS;AACR,iBAAA,aAAa,IAAI,UAAU,IAAI;AAAA,IAAA,OACrC;AACM,iBAAA,QAAQ,IAAI,UAAU,IAAI;AAAA,IAAA;AAAA,EACvC;AAAA,EAGF,eAAe,WAAmB,UAA+B;AAC3D,QAAA,KAAK,OAAO,SAAS,GAAG;AAC1B,WAAK,OAAO,SAAS,EAAE,QAAQ,OAAO,QAAQ;AAC9C,WAAK,OAAO,SAAS,EAAE,aAAa,OAAO,QAAQ;AAAA,IAAA;AAAA,EACrD;AAAA,EAGF,qBAA2B;AACzB,SAAK,SAAS,CAAC;AAAA,EAAA;AAAA,EAGjB,KAAK,cAAsB,MAAmB;AACtC,UAAA,aAAa,KAAK,OAAO,SAAS;AACxC,QAAI,CAAC,YAAY;AACf;AAAA,IAAA;AAGF,UAAM,wBAAwB,MAAM,KAAK,WAAW,aAAa,MAAM;AACvE,UAAM,mBAAmB,MAAM,KAAK,WAAW,QAAQ,MAAM;AAE7D,aAAS,IAAI,sBAAsB,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG;AACvD,YAAA,WAAW,sBAAsB,CAAC;AACxC,UAAI,WAAW,aAAa,IAAI,QAAQ,GAAG;AAChC,iBAAA,MAAM,MAAM,IAAI;AAAA,MAAA;AAAA,IAC3B;AAGF,aAAS,IAAI,GAAG,IAAI,iBAAiB,QAAQ,KAAK,GAAG;AAC7C,YAAA,WAAW,iBAAiB,CAAC;AACnC,UAAI,WAAW,QAAQ,IAAI,QAAQ,GAAG;AAC3B,iBAAA,MAAM,MAAM,IAAI;AAAA,MAAA;AAAA,IAC3B;AAAA,EACF;AAAA,EAGF,KAAK,WAAmB,UAA+B;AAErD,UAAM,OAAO;AACb,SAAK,GAAG,WAAW,SAAS,mBAAmB,MAAM;AAC9C,WAAA,eAAe,WAAW,eAAe;AACrC,eAAA,MAAM,MAAM,IAAI;AAAA,IAAA,CAC1B;AAAA,EAAA;AAEL;"}
@@ -19,7 +19,7 @@ const preventSelection = (event, disabled) => {
19
19
  }
20
20
  };
21
21
  const HvVerticalNavigationTreeViewItem = forwardRef(
22
- (props, ref) => {
22
+ function HvVerticalNavigationTreeViewItem2(props, ref) {
23
23
  const {
24
24
  id: idProp,
25
25
  className,