@hitachivantara/uikit-react-core 5.26.5 → 5.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/cjs/components/ActionsGeneric/ActionsGeneric.cjs +2 -4
  2. package/dist/cjs/components/ActionsGeneric/ActionsGeneric.cjs.map +1 -1
  3. package/dist/cjs/components/AppSwitcher/Action/Action.cjs +1 -2
  4. package/dist/cjs/components/AppSwitcher/Action/Action.cjs.map +1 -1
  5. package/dist/cjs/components/Avatar/Avatar.cjs +4 -5
  6. package/dist/cjs/components/Avatar/Avatar.cjs.map +1 -1
  7. package/dist/cjs/components/BulkActions/BulkActions.cjs +2 -3
  8. package/dist/cjs/components/BulkActions/BulkActions.cjs.map +1 -1
  9. package/dist/cjs/components/Dialog/Dialog.cjs +2 -4
  10. package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -1
  11. package/dist/cjs/components/Drawer/Drawer.cjs +2 -1
  12. package/dist/cjs/components/Drawer/Drawer.cjs.map +1 -1
  13. package/dist/cjs/components/Loading/Loading.cjs +1 -4
  14. package/dist/cjs/components/Loading/Loading.cjs.map +1 -1
  15. package/dist/cjs/components/ScrollTo/Horizontal/ScrollToHorizontal.cjs +2 -2
  16. package/dist/cjs/components/ScrollTo/Horizontal/ScrollToHorizontal.cjs.map +1 -1
  17. package/dist/cjs/components/ScrollTo/Vertical/ScrollToVertical.cjs +2 -2
  18. package/dist/cjs/components/ScrollTo/Vertical/ScrollToVertical.cjs.map +1 -1
  19. package/dist/cjs/components/Stack/Stack.cjs.map +1 -1
  20. package/dist/cjs/components/Table/TableCell/TableCell.cjs +2 -2
  21. package/dist/cjs/components/Table/TableCell/TableCell.cjs.map +1 -1
  22. package/dist/cjs/components/Table/TableHeader/TableHeader.cjs +6 -4
  23. package/dist/cjs/components/Table/TableHeader/TableHeader.cjs.map +1 -1
  24. package/dist/cjs/components/Table/TableRow/TableRow.cjs +3 -4
  25. package/dist/cjs/components/Table/TableRow/TableRow.cjs.map +1 -1
  26. package/dist/cjs/components/Table/renderers/ProgressColumnCell/ProgressColumnCell.cjs +4 -2
  27. package/dist/cjs/components/Table/renderers/ProgressColumnCell/ProgressColumnCell.cjs.map +1 -1
  28. package/dist/cjs/components/Table/renderers/SwitchColumnCell/SwitchColumnCell.cjs +5 -2
  29. package/dist/cjs/components/Table/renderers/SwitchColumnCell/SwitchColumnCell.cjs.map +1 -1
  30. package/dist/cjs/components/Table/renderers/renderers.cjs +6 -3
  31. package/dist/cjs/components/Table/renderers/renderers.cjs.map +1 -1
  32. package/dist/cjs/components/Tag/Tag.cjs +2 -5
  33. package/dist/cjs/components/Tag/Tag.cjs.map +1 -1
  34. package/dist/cjs/hooks/useTheme.cjs +12 -1
  35. package/dist/cjs/hooks/useTheme.cjs.map +1 -1
  36. package/dist/esm/components/ActionsGeneric/ActionsGeneric.js +2 -4
  37. package/dist/esm/components/ActionsGeneric/ActionsGeneric.js.map +1 -1
  38. package/dist/esm/components/AppSwitcher/Action/Action.js +1 -2
  39. package/dist/esm/components/AppSwitcher/Action/Action.js.map +1 -1
  40. package/dist/esm/components/Avatar/Avatar.js +1 -2
  41. package/dist/esm/components/Avatar/Avatar.js.map +1 -1
  42. package/dist/esm/components/BulkActions/BulkActions.js +2 -3
  43. package/dist/esm/components/BulkActions/BulkActions.js.map +1 -1
  44. package/dist/esm/components/Dialog/Dialog.js +2 -4
  45. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  46. package/dist/esm/components/Drawer/Drawer.js +2 -1
  47. package/dist/esm/components/Drawer/Drawer.js.map +1 -1
  48. package/dist/esm/components/Loading/Loading.js +2 -5
  49. package/dist/esm/components/Loading/Loading.js.map +1 -1
  50. package/dist/esm/components/ScrollTo/Horizontal/ScrollToHorizontal.js +2 -2
  51. package/dist/esm/components/ScrollTo/Horizontal/ScrollToHorizontal.js.map +1 -1
  52. package/dist/esm/components/ScrollTo/Vertical/ScrollToVertical.js +2 -2
  53. package/dist/esm/components/ScrollTo/Vertical/ScrollToVertical.js.map +1 -1
  54. package/dist/esm/components/Stack/Stack.js.map +1 -1
  55. package/dist/esm/components/Table/TableCell/TableCell.js +2 -2
  56. package/dist/esm/components/Table/TableCell/TableCell.js.map +1 -1
  57. package/dist/esm/components/Table/TableHeader/TableHeader.js +6 -4
  58. package/dist/esm/components/Table/TableHeader/TableHeader.js.map +1 -1
  59. package/dist/esm/components/Table/TableRow/TableRow.js +3 -4
  60. package/dist/esm/components/Table/TableRow/TableRow.js.map +1 -1
  61. package/dist/esm/components/Table/renderers/ProgressColumnCell/ProgressColumnCell.js +4 -2
  62. package/dist/esm/components/Table/renderers/ProgressColumnCell/ProgressColumnCell.js.map +1 -1
  63. package/dist/esm/components/Table/renderers/SwitchColumnCell/SwitchColumnCell.js +5 -2
  64. package/dist/esm/components/Table/renderers/SwitchColumnCell/SwitchColumnCell.js.map +1 -1
  65. package/dist/esm/components/Table/renderers/renderers.js +6 -3
  66. package/dist/esm/components/Table/renderers/renderers.js.map +1 -1
  67. package/dist/esm/components/Tag/Tag.js +2 -5
  68. package/dist/esm/components/Tag/Tag.js.map +1 -1
  69. package/dist/esm/hooks/useTheme.js +13 -2
  70. package/dist/esm/hooks/useTheme.js.map +1 -1
  71. package/dist/types/index.d.ts +51 -21
  72. package/package.json +5 -5
@@ -36,7 +36,7 @@ const HvScrollToVertical = (props) => {
36
36
  } = useClasses(classesProp);
37
37
  const {
38
38
  activeTheme,
39
- selectedMode
39
+ colors
40
40
  } = useTheme();
41
41
  const elementId = useUniqueId(id, "hvVerticalScrollto");
42
42
  const [selectedIndex, setScrollTo] = useScrollTo(defaultSelectedIndex, scrollElementId, href, offset, options, onChange);
@@ -73,7 +73,7 @@ const HvScrollToVertical = (props) => {
73
73
  }, option.key || option.label);
74
74
  });
75
75
  const positionOffset = calculateOffset(options.length);
76
- const backgroundColor = hexToRgbA(activeTheme == null ? void 0 : activeTheme.colors.modes[selectedMode].atmo2, activeTheme == null ? void 0 : activeTheme.scrollTo.backgroundColorOpacity);
76
+ const backgroundColor = hexToRgbA(colors == null ? void 0 : colors.atmo2, activeTheme == null ? void 0 : activeTheme.scrollTo.backgroundColorOpacity);
77
77
  return /* @__PURE__ */ jsx("ol", {
78
78
  className: cx(css({
79
79
  backgroundColor
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollToVertical.js","sources":["../../../../../src/components/ScrollTo/Vertical/ScrollToVertical.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { isKey } from \"@core/utils/keyboardUtils\";\nimport { setId } from \"@core/utils/setId\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\n\nimport {\n staticClasses,\n useClasses,\n calculateOffset,\n} from \"./ScrollToVertical.styles\";\nimport { HvVerticalScrollListItem } from \"./VerticalScrollListItem\";\nimport { useScrollTo } from \"../useScrollTo\";\nimport { withTooltip } from \"../withTooltip\";\nimport {\n HvScrollToTooltipPositions,\n HvScrollToVerticalOption,\n HvScrollToVerticalPositions,\n} from \"../types\";\n\nexport { staticClasses as scrollToVerticalClasses };\n\nexport type HvScrollToVerticalClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvScrollToVerticalProps\n extends HvBaseProps<HTMLOListElement, \"onChange\" | \"onClick\"> {\n /** An Array of Objects with Label and Value. Label is the displayed Element and Value is the local navigation location applied */\n options: HvScrollToVerticalOption[];\n /** True if the href location link should be applied. It will create an a element around every list item */\n href?: boolean;\n /** Default selected index passed from the parent. */\n defaultSelectedIndex?: number;\n /**\n * The Id of the scrollable container containing displayed elements.\n *\n * Defaults to `window` if unspecified.\n */\n scrollElementId?: string;\n /**\n * Defines the offset from the top of each element for getting an optimal viewing region in the container.\n * This allows to exclude regions of the container that are obscured by other content (such as fixed-positioned toolbars or titles)\n * or to put more breathing room between the targeted element and the edges of the container.\n *\n * Each element can also have a specific offset via the options property.\n */\n offset?: number;\n /** Position of the Vertical scroll to. */\n position?: HvScrollToVerticalPositions;\n /** Position of tooltip identifying the current item. */\n tooltipPosition?: HvScrollToTooltipPositions;\n /** A function called each time the selected index changes. */\n onChange?: (\n event:\n | Event\n | React.MouseEvent<HTMLDivElement>\n | React.KeyboardEvent<HTMLDivElement>,\n index: number\n ) => void;\n /** A function called each time an user clicks on a tab element. */\n onClick?: (event: React.MouseEvent<HTMLDivElement>, index: number) => void;\n /** A function called each time an user press enter on a tab element. */\n onEnter?: (event: React.KeyboardEvent<HTMLDivElement>, index: number) => void;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvScrollToVerticalClasses;\n}\n\n/**\n * The vertical scroll to element can be used to quickly navigate in a page.\n */\nexport const HvScrollToVertical = (props: HvScrollToVerticalProps) => {\n const {\n id,\n defaultSelectedIndex = 0,\n scrollElementId,\n href = true,\n onChange,\n onClick,\n onEnter,\n className,\n classes: classesProp,\n options,\n offset = 0,\n position = \"relative\",\n tooltipPosition = \"left\",\n style,\n ...others\n } = useDefaultProps(\"HvScrollToVertical\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme, selectedMode } = useTheme();\n\n const elementId = useUniqueId(id, \"hvVerticalScrollto\");\n\n const [selectedIndex, setScrollTo] = useScrollTo(\n defaultSelectedIndex,\n scrollElementId,\n href,\n offset,\n options,\n onChange\n );\n\n const handleSelection = (\n event:\n | React.MouseEvent<HTMLDivElement>\n | React.KeyboardEvent<HTMLDivElement>,\n value: string,\n index: number\n ) => {\n event.preventDefault();\n\n const wrappedOnChange = () => {\n onChange?.(event, index);\n };\n\n setScrollTo(event, value, index, wrappedOnChange);\n };\n\n const tooltipWrappers = useMemo(() => {\n return options.map((option) => {\n return withTooltip(option.label, \"div\", tooltipPosition, false);\n });\n }, [options, tooltipPosition]);\n\n const tabs = options.map((option, index) => {\n const selected = selectedIndex === index;\n const tooltipWrapper = tooltipWrappers[index];\n\n return (\n <HvVerticalScrollListItem\n id={setId(elementId, `item-${index}`)}\n onClick={(event) => {\n handleSelection(event, option.value, index);\n onClick?.(event, index);\n }}\n onKeyDown={(event) => {\n if (isKey(event, \"Enter\") === true) {\n handleSelection(event, option.value, index);\n onEnter?.(event, index);\n }\n }}\n tooltipWrapper={tooltipWrapper}\n selected={selected}\n key={option.key || option.label}\n aria-label={option.label}\n />\n );\n });\n\n const positionOffset = calculateOffset(options.length);\n const backgroundColor = hexToRgbA(\n activeTheme?.colors.modes[selectedMode].atmo2,\n activeTheme?.scrollTo.backgroundColorOpacity\n );\n\n return (\n <ol\n className={cx(\n css({ backgroundColor }),\n classes.root,\n {\n [classes.positionFixed]: position === \"fixed\",\n [classes.positionAbsolute]: position === \"absolute\",\n },\n className\n )}\n style={{ top: `calc(50% - ${positionOffset}px)`, ...style }}\n id={elementId}\n {...others}\n >\n {tabs}\n </ol>\n );\n};\n"],"names":["HvScrollToVertical","props","id","defaultSelectedIndex","scrollElementId","href","onChange","onClick","onEnter","className","classes","classesProp","options","offset","position","tooltipPosition","style","others","useDefaultProps","css","cx","useClasses","activeTheme","selectedMode","useTheme","elementId","useUniqueId","selectedIndex","setScrollTo","useScrollTo","handleSelection","event","value","index","preventDefault","wrappedOnChange","tooltipWrappers","useMemo","map","option","withTooltip","label","tabs","selected","tooltipWrapper","HvVerticalScrollListItem","setId","onKeyDown","isKey","key","positionOffset","calculateOffset","length","backgroundColor","hexToRgbA","colors","modes","atmo2","scrollTo","backgroundColorOpacity","root","positionFixed","positionAbsolute","top","children"],"mappings":";;;;;;;;;;;;;AA0EaA,MAAAA,qBAAqBA,CAACC,UAAmC;AAC9D,QAAA;AAAA,IACJC;AAAAA,IACAC,uBAAuB;AAAA,IACvBC;AAAAA,IACAC,OAAO;AAAA,IACPC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,SAASC;AAAAA,IACTC;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A,OAAOQ,OAAOP,OAAOC,KAAK;AAC1CzB,6CAAUuB,OAAOE;AAAAA,QACnB;AAAA,MACF;AAAA,MACAW;AAAAA,MACAD;AAAAA,MAEA,cAAYJ,OAAOE;AAAAA,IADdF,GAAAA,OAAOU,OAAOV,OAAOE,KAE3B;AAAA,EAAA,CAEJ;AAEKS,QAAAA,iBAAiBC,gBAAgBvC,QAAQwC,MAAM;AAC/CC,QAAAA,kBAAkBC,UACtBhC,2CAAaiC,OAAOC,MAAMjC,cAAckC,OACxCnC,2CAAaoC,SAASC,sBACxB;AAEA,6BACE,MAAA;AAAA,IACElD,WAAWW,GACTD,IAAI;AAAA,MAAEkC;AAAAA,IAAAA,CAAiB,GACvB3C,QAAQkD,MACR;AAAA,MACE,CAAClD,QAAQmD,aAAa,GAAG/C,aAAa;AAAA,MACtC,CAACJ,QAAQoD,gBAAgB,GAAGhD,aAAa;AAAA,OAE3CL,SACF;AAAA,IACAO,OAAO;AAAA,MAAE+C,KAAM,cAAab;AAAAA,MAAqB,GAAGlC;AAAAA,IAAM;AAAA,IAC1Dd,IAAIuB;AAAAA,IAAU,GACVR;AAAAA,IAAM+C,UAETtB;AAAAA,EAAAA,CACC;AAER;"}
1
+ {"version":3,"file":"ScrollToVertical.js","sources":["../../../../../src/components/ScrollTo/Vertical/ScrollToVertical.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { isKey } from \"@core/utils/keyboardUtils\";\nimport { setId } from \"@core/utils/setId\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\n\nimport {\n staticClasses,\n useClasses,\n calculateOffset,\n} from \"./ScrollToVertical.styles\";\nimport { HvVerticalScrollListItem } from \"./VerticalScrollListItem\";\nimport { useScrollTo } from \"../useScrollTo\";\nimport { withTooltip } from \"../withTooltip\";\nimport {\n HvScrollToTooltipPositions,\n HvScrollToVerticalOption,\n HvScrollToVerticalPositions,\n} from \"../types\";\n\nexport { staticClasses as scrollToVerticalClasses };\n\nexport type HvScrollToVerticalClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvScrollToVerticalProps\n extends HvBaseProps<HTMLOListElement, \"onChange\" | \"onClick\"> {\n /** An Array of Objects with Label and Value. Label is the displayed Element and Value is the local navigation location applied */\n options: HvScrollToVerticalOption[];\n /** True if the href location link should be applied. It will create an a element around every list item */\n href?: boolean;\n /** Default selected index passed from the parent. */\n defaultSelectedIndex?: number;\n /**\n * The Id of the scrollable container containing displayed elements.\n *\n * Defaults to `window` if unspecified.\n */\n scrollElementId?: string;\n /**\n * Defines the offset from the top of each element for getting an optimal viewing region in the container.\n * This allows to exclude regions of the container that are obscured by other content (such as fixed-positioned toolbars or titles)\n * or to put more breathing room between the targeted element and the edges of the container.\n *\n * Each element can also have a specific offset via the options property.\n */\n offset?: number;\n /** Position of the Vertical scroll to. */\n position?: HvScrollToVerticalPositions;\n /** Position of tooltip identifying the current item. */\n tooltipPosition?: HvScrollToTooltipPositions;\n /** A function called each time the selected index changes. */\n onChange?: (\n event:\n | Event\n | React.MouseEvent<HTMLDivElement>\n | React.KeyboardEvent<HTMLDivElement>,\n index: number\n ) => void;\n /** A function called each time an user clicks on a tab element. */\n onClick?: (event: React.MouseEvent<HTMLDivElement>, index: number) => void;\n /** A function called each time an user press enter on a tab element. */\n onEnter?: (event: React.KeyboardEvent<HTMLDivElement>, index: number) => void;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvScrollToVerticalClasses;\n}\n\n/**\n * The vertical scroll to element can be used to quickly navigate in a page.\n */\nexport const HvScrollToVertical = (props: HvScrollToVerticalProps) => {\n const {\n id,\n defaultSelectedIndex = 0,\n scrollElementId,\n href = true,\n onChange,\n onClick,\n onEnter,\n className,\n classes: classesProp,\n options,\n offset = 0,\n position = \"relative\",\n tooltipPosition = \"left\",\n style,\n ...others\n } = useDefaultProps(\"HvScrollToVertical\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme, colors } = useTheme();\n\n const elementId = useUniqueId(id, \"hvVerticalScrollto\");\n\n const [selectedIndex, setScrollTo] = useScrollTo(\n defaultSelectedIndex,\n scrollElementId,\n href,\n offset,\n options,\n onChange\n );\n\n const handleSelection = (\n event:\n | React.MouseEvent<HTMLDivElement>\n | React.KeyboardEvent<HTMLDivElement>,\n value: string,\n index: number\n ) => {\n event.preventDefault();\n\n const wrappedOnChange = () => {\n onChange?.(event, index);\n };\n\n setScrollTo(event, value, index, wrappedOnChange);\n };\n\n const tooltipWrappers = useMemo(() => {\n return options.map((option) => {\n return withTooltip(option.label, \"div\", tooltipPosition, false);\n });\n }, [options, tooltipPosition]);\n\n const tabs = options.map((option, index) => {\n const selected = selectedIndex === index;\n const tooltipWrapper = tooltipWrappers[index];\n\n return (\n <HvVerticalScrollListItem\n id={setId(elementId, `item-${index}`)}\n onClick={(event) => {\n handleSelection(event, option.value, index);\n onClick?.(event, index);\n }}\n onKeyDown={(event) => {\n if (isKey(event, \"Enter\") === true) {\n handleSelection(event, option.value, index);\n onEnter?.(event, index);\n }\n }}\n tooltipWrapper={tooltipWrapper}\n selected={selected}\n key={option.key || option.label}\n aria-label={option.label}\n />\n );\n });\n\n const positionOffset = calculateOffset(options.length);\n const backgroundColor = hexToRgbA(\n colors?.atmo2,\n activeTheme?.scrollTo.backgroundColorOpacity\n );\n\n return (\n <ol\n className={cx(\n css({ backgroundColor }),\n classes.root,\n {\n [classes.positionFixed]: position === \"fixed\",\n [classes.positionAbsolute]: position === \"absolute\",\n },\n className\n )}\n style={{ top: `calc(50% - ${positionOffset}px)`, ...style }}\n id={elementId}\n {...others}\n >\n {tabs}\n </ol>\n );\n};\n"],"names":["HvScrollToVertical","props","id","defaultSelectedIndex","scrollElementId","href","onChange","onClick","onEnter","className","classes","classesProp","options","offset","position","tooltipPosition","style","others","useDefaultProps","css","cx","useClasses","activeTheme","colors","useTheme","elementId","useUniqueId","selectedIndex","setScrollTo","useScrollTo","handleSelection","event","value","index","preventDefault","wrappedOnChange","tooltipWrappers","useMemo","map","option","withTooltip","label","tabs","selected","tooltipWrapper","HvVerticalScrollListItem","setId","onKeyDown","isKey","key","positionOffset","calculateOffset","length","backgroundColor","hexToRgbA","atmo2","scrollTo","backgroundColorOpacity","root","positionFixed","positionAbsolute","top","children"],"mappings":";;;;;;;;;;;;;AA0EaA,MAAAA,qBAAqBA,CAACC,UAAmC;AAC9D,QAAA;AAAA,IACJC;AAAAA,IACAC,uBAAuB;AAAA,IACvBC;AAAAA,IACAC,OAAO;AAAA,IACPC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC,SAAS;AAAA,IACTC,WAAW;AAAA,IACXC,kBAAkB;AAAA,IAClBC;AAAAA,IACA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,sBAAsBjB,KAAK;AAEzC,QAAA;AAAA,IAAES;AAAAA,IAASS;AAAAA,IAAKC;AAAAA,EAAAA,IAAOC,WAAWV,WAAW;AAC7C,QAAA;AAAA,IAAEW;AAAAA,IAAaC;AAAAA,MAAWC,SAAS;AAEnCC,QAAAA,YAAYC,YAAYxB,IAAI,oBAAoB;AAEhD,QAAA,CAACyB,eAAeC,WAAW,IAAIC,YACnC1B,sBACAC,iBACAC,MACAQ,QACAD,SACAN,QACF;AAEA,QAAMwB,kBAAkBA,CACtBC,OAGAC,OACAC,UACG;AACHF,UAAMG,eAAe;AAErB,UAAMC,kBAAkBA,MAAM;AAC5B7B,2CAAWyB,OAAOE;AAAAA,IAAK;AAGbF,gBAAAA,OAAOC,OAAOC,OAAOE,eAAe;AAAA,EAAA;AAG5CC,QAAAA,kBAAkBC,QAAQ,MAAM;AAC7BzB,WAAAA,QAAQ0B,IAAKC,CAAW,WAAA;AAC7B,aAAOC,Y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ACC;AAER;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Stack.js","sources":["../../../../src/components/Stack/Stack.tsx"],"sourcesContent":["import React, { useMemo, useRef, useCallback } from \"react\";\n\nimport { useTheme } from \"@mui/material/styles\";\nimport MuiDivider, {\n DividerProps as MuiDividerProps,\n} from \"@mui/material/Divider\";\n\nimport isString from \"lodash/isString\";\nimport isBoolean from \"lodash/isBoolean\";\n\nimport { useWidth } from \"@core/hooks/useWidth\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { HvFocus } from \"@core/components/Focus\";\nimport { HvBreakpoints } from \"@core/types/tokens\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { useClasses, staticClasses } from \"./Stack.styles\";\n\nexport { staticClasses as stackClasses };\n\nexport type HvStackClasses = ExtractNames<typeof useClasses>;\n\nexport type HvStackDirection = \"column\" | \"row\" | Partial<HvStackBreakpoints>;\nexport interface HvStackBreakpoints extends Record<HvBreakpoints, string> {}\n\nexport interface HvStackProps extends HvBaseProps {\n /** The direction of the stack. Can be either a string or an object that states the direction for each breakpoint. */\n direction?: HvStackDirection;\n /** The spacing between elements of the stack. */\n spacing?: HvBreakpoints;\n /** The divider component to be used between the stack elements.\n * - If `true` the Material-UI Divider component will be used.\n * - If a React node is passed then the custom divider will be used.\n */\n divider?: boolean | React.ReactNode;\n /** The properties to pass on to the Material-UI component. */\n dividerProps?: MuiDividerProps;\n /** Sets whether or not there should be arrow navigation between the stack elements. */\n withNavigation?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvStackClasses;\n}\n\n/**\n * @returns {string} - Returns a direction for the stack: column or row. If the\n * `direction` property is a string and a valid direction then we\n * use it. If it's an object with multiple directions by breakpoint\n * we use the appropriate one or search for the nearest breakpoint\n * smaller than the current one to use.\n */\nconst getDirection = (direction, width, breakpoints) => {\n if (isString(direction)) return direction;\n\n for (let i = breakpoints.indexOf(width); i >= 0; i -= 1) {\n if (direction[breakpoints[i]] !== undefined) {\n return direction[breakpoints[i]];\n }\n }\n return \"column\";\n};\n\n/**\n * A Stack component allows the organization of its children in a vertical or horizontal layout.\n *\n * It also allows the specification of the spacing between the stack elements and the addition of a divider between the elements.\n */\nexport const HvStack = (props: HvStackProps) => {\n const {\n classes: classesProp,\n className,\n children,\n direction = \"column\",\n spacing = \"sm\",\n divider = false,\n withNavigation = false,\n dividerProps = {},\n ...others\n } = useDefaultProps(\"HvStack\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const width = useWidth();\n const containerRef = useRef(null);\n const { breakpoints } = useTheme();\n\n const processedDirection = useMemo(\n () => getDirection(direction, width, breakpoints.keys),\n [direction, width, breakpoints]\n );\n\n /**\n * @returns {node} - The divider component to use. If the property `divider` is\n * set to `true` then the Material-UI divider is used, otherwise\n * we use the custom divider the user passed.\n */\n const getDividerComponent = useCallback(() => {\n if (isBoolean(divider) && divider) {\n return (\n <MuiDivider\n orientation={\n processedDirection === \"column\" ? \"horizontal\" : \"vertical\"\n }\n flexItem={processedDirection === \"row\"}\n role=\"separator\"\n {...dividerProps}\n />\n );\n }\n return divider;\n }, [divider, dividerProps, processedDirection]);\n\n return (\n <div\n ref={containerRef}\n className={cx(\n classes.root,\n classes[processedDirection],\n classes[spacing],\n className\n )}\n {...others}\n >\n {React.Children.map(children, (child, i) => {\n return (\n <>\n {divider && i !== 0 && getDividerComponent()}\n {withNavigation ? (\n <HvFocus\n rootRef={containerRef}\n focusDisabled={false}\n strategy=\"grid\"\n navigationJump={\n processedDirection === \"column\"\n ? 1\n : React.Children.count(children) || 0\n }\n filterClass=\"child\"\n >\n <div className=\"child\">{child}</div>\n </HvFocus>\n ) : (\n child\n )}\n </>\n );\n })}\n </div>\n );\n};\n"],"names":["getDirection","direction","width","breakpoints","isString","i","indexOf","undefined","HvStack","props","classes","classesProp","className","children","spacing","divider","withNavigation","dividerProps","others","useDefaultProps","cx","useClasses","useWidth","containerRef","useRef","useTheme","processedDirection","useMemo","keys","getDividerComponent","useCallback","isBoolean","MuiDivider","orientation","flexItem","role","ref","root","React","Children","map","child","_Fragment","_jsx","HvFocus","rootRef","focusDisabled","strategy","navigationJump","count","filterClass"],"mappings":";;;;;;;;;;;AAmDA,MAAMA,eAAeA,CAACC,WAAWC,OAAOC,gBAAgB;AACtD,MAAIC,SAASH,SAAS;AAAUA,WAAAA;AAEvBI,WAAAA,IAAIF,YAAYG,QAAQJ,KAAK,GAAGG,KAAK,GAAGA,KAAK,GAAG;AACvD,QAAIJ,UAAUE,YAAYE,CAAC,CAAC,MAAME,QAAW;AACpCN,aAAAA,UAAUE,YAAYE,CAAC,CAAC;AAAA,IACjC;AAAA,EACF;AACO,SAAA;AACT;AAOaG,MAAAA,UAAUA,CAACC,UAAwB;AACxC,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAZ,YAAY;AAAA,IACZa,UAAU;AAAA,IACVC,UAAU;AAAA,IACVC,iBAAiB;AAAA,IACjBC,eAAe,CAAC;AAAA,IAChB,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,WAAWV,KAAK;AAC9B,QAAA;AAAA,IAAEC;AAAAA,IAASU;AAAAA,EAAAA,IAAOC,WAAWV,WAAW;AAE9C,QAAMT,QAAQoB;AACRC,QAAAA,eAAeC,OAAO,IAAI;AAC1B,QAAA;AAAA,IAAErB;AAAAA,MAAgBsB,SAAS;AAEjC,QAAMC,qBAAqBC,QACzB,MAAM3B,aAAaC,WAAWC,OAAOC,YAAYyB,IAAI,GACrD,CAAC3B,WAAWC,OAAOC,WAAW,CAChC;AAOM0B,QAAAA,sBAAsBC,YAAY,MAAM;AACxCC,QAAAA,UAAUhB,OAAO,KAAKA,SAAS;AACjC,iCACGiB,YAAU;AAAA,QACTC,aACEP,uBAAuB,WAAW,eAAe;AAAA,QAEnDQ,UAAUR,uBAAuB;AAAA,QACjCS,MAAK;AAAA,QAAW,GACZlB;AAAAA,MAAAA,CACL;AAAA,IAEL;AACOF,WAAAA;AAAAA,EACN,GAAA,CAACA,SAASE,cAAcS,kBAAkB,CAAC;AAE9C,6BACE,OAAA;AAAA,IACEU,KAAKb;AAAAA,IACLX,WAAWQ,GACTV,QAAQ2B,MACR3B,QAAQgB,kBAAkB,GAC1BhB,QAAQI,OAAO,GACfF,SACF;AAAA,IAAE,GACEM;AAAAA,IAAML,UAETyB,eAAMC,SAASC,IAAI3B,UAAU,CAAC4B,OAAOpC,MAAM;AAC1C,kCACEqC,UAAA;AAAA,QAAA7B,UACGE,CAAAA,WAAWV,MAAM,KAAKwB,uBACtBb,iBACC2B,oBAACC,SAAO;AAAA,UACNC,SAAStB;AAAAA,UACTuB,eAAe;AAAA,UACfC,UAAS;AAAA,UACTC,gBACEtB,uBAAuB,WACnB,IACAY,eAAMC,SAASU,MAAMpC,QAAQ,KAAK;AAAA,UAExCqC,aAAY;AAAA,UAAOrC,8BAEnB,OAAA;AAAA,YAAKD,WAAU;AAAA,YAAOC,UAAE4B;AAAAA,UAAAA,CAAW;AAAA,QAC5B,CAAA,IAETA,KACD;AAAA,MAAA,CACD;AAAA,IAAA,CAEL;AAAA,EAAA,CACE;AAET;"}
1
+ {"version":3,"file":"Stack.js","sources":["../../../../src/components/Stack/Stack.tsx"],"sourcesContent":["import React, { useMemo, useRef, useCallback } from \"react\";\n\nimport { useTheme } from \"@mui/material/styles\";\nimport MuiDivider, {\n DividerProps as MuiDividerProps,\n} from \"@mui/material/Divider\";\n\nimport isString from \"lodash/isString\";\nimport isBoolean from \"lodash/isBoolean\";\n\nimport { HvBreakpoints } from \"@hitachivantara/uikit-styles\";\nimport { useWidth } from \"@core/hooks/useWidth\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { HvFocus } from \"@core/components/Focus\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { useClasses, staticClasses } from \"./Stack.styles\";\n\nexport { staticClasses as stackClasses };\n\nexport type HvStackClasses = ExtractNames<typeof useClasses>;\n\nexport type HvStackDirection = \"column\" | \"row\" | Partial<HvStackBreakpoints>;\nexport interface HvStackBreakpoints extends Record<HvBreakpoints, string> {}\n\nexport interface HvStackProps extends HvBaseProps {\n /** The direction of the stack. Can be either a string or an object that states the direction for each breakpoint. */\n direction?: HvStackDirection;\n /** The spacing between elements of the stack. */\n spacing?: HvBreakpoints;\n /** The divider component to be used between the stack elements.\n * - If `true` the Material-UI Divider component will be used.\n * - If a React node is passed then the custom divider will be used.\n */\n divider?: boolean | React.ReactNode;\n /** The properties to pass on to the Material-UI component. */\n dividerProps?: MuiDividerProps;\n /** Sets whether or not there should be arrow navigation between the stack elements. */\n withNavigation?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvStackClasses;\n}\n\n/**\n * @returns {string} - Returns a direction for the stack: column or row. If the\n * `direction` property is a string and a valid direction then we\n * use it. If it's an object with multiple directions by breakpoint\n * we use the appropriate one or search for the nearest breakpoint\n * smaller than the current one to use.\n */\nconst getDirection = (direction, width, breakpoints) => {\n if (isString(direction)) return direction;\n\n for (let i = breakpoints.indexOf(width); i >= 0; i -= 1) {\n if (direction[breakpoints[i]] !== undefined) {\n return direction[breakpoints[i]];\n }\n }\n return \"column\";\n};\n\n/**\n * A Stack component allows the organization of its children in a vertical or horizontal layout.\n *\n * It also allows the specification of the spacing between the stack elements and the addition of a divider between the elements.\n */\nexport const HvStack = (props: HvStackProps) => {\n const {\n classes: classesProp,\n className,\n children,\n direction = \"column\",\n spacing = \"sm\",\n divider = false,\n withNavigation = false,\n dividerProps = {},\n ...others\n } = useDefaultProps(\"HvStack\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const width = useWidth();\n const containerRef = useRef(null);\n const { breakpoints } = useTheme();\n\n const processedDirection = useMemo(\n () => getDirection(direction, width, breakpoints.keys),\n [direction, width, breakpoints]\n );\n\n /**\n * @returns {node} - The divider component to use. If the property `divider` is\n * set to `true` then the Material-UI divider is used, otherwise\n * we use the custom divider the user passed.\n */\n const getDividerComponent = useCallback(() => {\n if (isBoolean(divider) && divider) {\n return (\n <MuiDivider\n orientation={\n processedDirection === \"column\" ? \"horizontal\" : \"vertical\"\n }\n flexItem={processedDirection === \"row\"}\n role=\"separator\"\n {...dividerProps}\n />\n );\n }\n return divider;\n }, [divider, dividerProps, processedDirection]);\n\n return (\n <div\n ref={containerRef}\n className={cx(\n classes.root,\n classes[processedDirection],\n classes[spacing],\n className\n )}\n {...others}\n >\n {React.Children.map(children, (child, i) => {\n return (\n <>\n {divider && i !== 0 && getDividerComponent()}\n {withNavigation ? (\n <HvFocus\n rootRef={containerRef}\n focusDisabled={false}\n strategy=\"grid\"\n navigationJump={\n processedDirection === \"column\"\n ? 1\n : React.Children.count(children) || 0\n }\n filterClass=\"child\"\n >\n <div className=\"child\">{child}</div>\n </HvFocus>\n ) : (\n child\n )}\n </>\n );\n })}\n </div>\n );\n};\n"],"names":["getDirection","direction","width","breakpoints","isString","i","indexOf","undefined","HvStack","props","classes","classesProp","className","children","spacing","divider","withNavigation","dividerProps","others","useDefaultProps","cx","useClasses","useWidth","containerRef","useRef","useTheme","processedDirection","useMemo","keys","getDividerComponent","useCallback","isBoolean","MuiDivider","orientation","flexItem","role","ref","root","React","Children","map","child","_Fragment","_jsx","HvFocus","rootRef","focusDisabled","strategy","navigationJump","count","filterClass"],"mappings":";;;;;;;;;;;AAmDA,MAAMA,eAAeA,CAACC,WAAWC,OAAOC,gBAAgB;AACtD,MAAIC,SAASH,SAAS;AAAUA,WAAAA;AAEvBI,WAAAA,IAAIF,YAAYG,QAAQJ,KAAK,GAAGG,KAAK,GAAGA,KAAK,GAAG;AACvD,QAAIJ,UAAUE,YAAYE,CAAC,CAAC,MAAME,QAAW;AACpCN,aAAAA,UAAUE,YAAYE,CAAC,CAAC;AAAA,IACjC;AAAA,EACF;AACO,SAAA;AACT;AAOaG,MAAAA,UAAUA,CAACC,UAAwB;AACxC,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC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K;AAAA,UAExCqC,aAAY;AAAA,UAAOrC,8BAEnB,OAAA;AAAA,YAAKD,WAAU;AAAA,YAAOC,UAAE4B;AAAAA,UAAAA,CAAW;AAAA,QAC5B,CAAA,IAETA,KACD;AAAA,MAAA,CACD;AAAA,IAAA,CAEL;AAAA,EAAA,CACE;AAET;"}
@@ -40,7 +40,7 @@ const HvTableCell = forwardRef((props, externalRef) => {
40
40
  css
41
41
  } = useClasses(classesProp);
42
42
  const {
43
- activeTheme,
43
+ colors,
44
44
  rootId
45
45
  } = useTheme();
46
46
  const tableContext = useContext(TableContext);
@@ -54,7 +54,7 @@ const HvTableCell = forwardRef((props, externalRef) => {
54
54
  setSortedColorValue(getVarValue(theme.table.rowSortedColor, rootId));
55
55
  setSortedColorAlpha(getVarValue(theme.table.rowSortedColorAlpha, rootId));
56
56
  setSortedColor(getSortedColor(sortedColorValue, sortedColorAlpha));
57
- }, [activeTheme == null ? void 0 : activeTheme.colors.modes.selectedMode, sortedColorValue, sortedColorAlpha, rootId]);
57
+ }, [colors, sortedColorValue, sortedColorAlpha, rootId]);
58
58
  return /* @__PURE__ */ jsx(Component, {
59
59
  ref: externalRef,
60
60
  role: Component === defaultComponent ? null : "cell",
@@ -1 +1 @@
1
- {"version":3,"file":"TableCell.js","sources":["../../../../../src/components/Table/TableCell/TableCell.tsx"],"sourcesContent":["import capitalize from \"lodash/capitalize\";\n\nimport {\n CSSProperties,\n forwardRef,\n TdHTMLAttributes,\n useContext,\n useEffect,\n useState,\n} from \"react\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { checkValidHexColorValue } from \"@core/utils/checkValidHexColorValue\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { getVarValue } from \"@core/utils/theme\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\nimport { useTheme } from \"@core/hooks/useTheme\";\n\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<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?: 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\nconst getSortedColor = (color?: string, alpha?: string) => {\n return checkValidHexColorValue(color) && alpha\n ? hexToRgbA(color, parseFloat(alpha))\n : color;\n};\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 } = props;\n const { classes, cx, css } = useClasses(classesProp);\n const { activeTheme, rootId } = useTheme();\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const [sortedColorValue, setSortedColorValue] = useState<\n string | undefined\n >();\n const [sortedColorAlpha, setSortedColorAlpha] = useState<\n string | undefined\n >();\n\n const type = typeProp || tableSectionContext?.type || \"body\";\n\n const Component =\n component || tableContext?.components?.Td || defaultComponent;\n\n const [sortedColor, setSortedColor] = useState(\n getSortedColor(sortedColorValue, sortedColorAlpha)\n );\n\n useEffect(() => {\n setSortedColorValue(getVarValue(theme.table.rowSortedColor, rootId));\n setSortedColorAlpha(getVarValue(theme.table.rowSortedColorAlpha, rootId));\n\n setSortedColor(getSortedColor(sortedColorValue, sortedColorAlpha));\n }, [\n activeTheme?.colors.modes.selectedMode,\n sortedColorValue,\n sortedColorAlpha,\n rootId,\n ]);\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 type === \"body\" &&\n css({\n [`&.${staticClasses.sorted}`]: {\n backgroundColor: sortedColor,\n },\n }),\n stickyColumn &&\n css({\n [`&.${staticClasses.sorted}`]: {\n backgroundImage: `linear-gradient(to right, ${sortedColor}, ${sortedColor})`,\n },\n }),\n {\n [classes[`align${capitalize(align)}`]]: align !== \"inherit\",\n [classes.variantList]: tableContext.variant === \"listrow\",\n [classes.variantListHead]:\n tableContext.variant === \"listrow\" && type !== \"body\",\n [classes[`variant${capitalize(variant)}`]]: variant !== \"default\",\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":["defaultComponent","getSortedColor","color","alpha","checkValidHexColorValue","hexToRgbA","parseFloat","HvTableCell","forwardRef","props","externalRef","children","component","className","style","classes","classesProp","align","variant","type","typeProp","stickyColumn","stickyColumnMostLeft","stickyColumnLeastRight","groupColumnMostLeft","groupColumnMostRight","sorted","resizable","resizing","others","cx","css","useClasses","activeTheme","rootId","useTheme","tableContext","useContext","TableContext","tableSectionContext","TableSectionContext","sortedColorValue","setSortedColorValue","useState","sortedColorAlpha","setSortedColorAlpha","Component","components","Td","sortedColor","setSortedColor","useEffect","getVarValue","theme","table","rowSortedColor","rowSortedColorAlpha","colors","modes","selectedMode","ref","role","root","staticClasses","backgroundColor","backgroundImage","capitalize","variantList","variantListHead"],"mappings":";;;;;;;;;;;AAkEA,MAAMA,mBAAmB;AAEzB,MAAMC,iBAAiBA,CAACC,OAAgBC,UAAmB;AAClDC,SAAAA,wBAAwBF,KAAK,KAAKC,QACrCE,UAAUH,OAAOI,WAAWH,KAAK,CAAC,IAClCD;AACN;AAKO,MAAMK,cAAcC,WACzB,CAACC,OAAOC,gBAAgB;;AAChB,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,SAASC;AAAAA,IACTC,QAAQ;AAAA,IACRC,UAAU;AAAA,IACVC,MAAMC;AAAAA,IACNC,eAAe;AAAA,IACfC,uBAAuB;AAAA,IACvBC,yBAAyB;AAAA,IACzBC,sBAAsB;AAAA,IACtBC,uBAAuB;AAAA,IACvBC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZC,WAAW;AAAA,IACX,GAAGC;AAAAA,EACDpB,IAAAA;AACE,QAAA;AAAA,IAAEM;AAAAA,IAASe;AAAAA,IAAIC;AAAAA,EAAAA,IAAQC,WAAWhB,WAAW;AAC7C,QAAA;AAAA,IAAEiB;AAAAA,IAAaC;AAAAA,MAAWC,SAAS;AACnCC,QAAAA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AAY,aAAaC,SAAS;AAAA,MACjD,CAACJ,QAAS,UAASmD,WAAWhD,OAAO,GAAG,CAAC,GAAGA,YAAY;AAAA,MACxD,CAACH,QAAQW,MAAM,GAAGA;AAAAA,MAClB,CAACX,QAAQM,YAAY,GAAGA;AAAAA,MACxB,CAACN,QAAQO,oBAAoB,GAAGA;AAAAA,MAChC,CAACP,QAAQQ,sBAAsB,GAAGA;AAAAA,MAClC,CAACR,QAAQS,mBAAmB,GAAGA;AAAAA,MAC/B,CAACT,QAAQU,oBAAoB,GAAGA;AAAAA,MAChC,CAACV,QAAQY,SAAS,GAAGA;AAAAA,MACrB,CAACZ,QAAQa,QAAQ,GAAGA;AAAAA,OAEtBf,SACF;AAAA,IAAE,GACEgB;AAAAA,IAAMlB;AAAAA,EAAAA,CAGD;AAEf,CACF;"}
1
+ {"version":3,"file":"TableCell.js","sources":["../../../../../src/components/Table/TableCell/TableCell.tsx"],"sourcesContent":["import capitalize from \"lodash/capitalize\";\n\nimport {\n CSSProperties,\n forwardRef,\n TdHTMLAttributes,\n useContext,\n useEffect,\n useState,\n} from \"react\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { checkValidHexColorValue } from \"@core/utils/checkValidHexColorValue\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { getVarValue } from \"@core/utils/theme\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\nimport { useTheme } from \"@core/hooks/useTheme\";\n\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<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?: 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\nconst getSortedColor = (color?: string, alpha?: string) => {\n return checkValidHexColorValue(color) && alpha\n ? hexToRgbA(color, parseFloat(alpha))\n : color;\n};\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 } = props;\n const { classes, cx, css } = useClasses(classesProp);\n const { colors, rootId } = useTheme();\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const [sortedColorValue, setSortedColorValue] = useState<string>();\n const [sortedColorAlpha, setSortedColorAlpha] = useState<string>();\n\n const type = typeProp || tableSectionContext?.type || \"body\";\n\n const Component =\n component || tableContext?.components?.Td || defaultComponent;\n\n const [sortedColor, setSortedColor] = useState(\n getSortedColor(sortedColorValue, sortedColorAlpha)\n );\n\n useEffect(() => {\n setSortedColorValue(getVarValue(theme.table.rowSortedColor, rootId));\n setSortedColorAlpha(getVarValue(theme.table.rowSortedColorAlpha, rootId));\n\n setSortedColor(getSortedColor(sortedColorValue, sortedColorAlpha));\n }, [colors, sortedColorValue, sortedColorAlpha, rootId]);\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 type === \"body\" &&\n css({\n [`&.${staticClasses.sorted}`]: {\n backgroundColor: sortedColor,\n },\n }),\n stickyColumn &&\n css({\n [`&.${staticClasses.sorted}`]: {\n backgroundImage: `linear-gradient(to right, ${sortedColor}, ${sortedColor})`,\n },\n }),\n {\n [classes[`align${capitalize(align)}`]]: align !== \"inherit\",\n [classes.variantList]: tableContext.variant === \"listrow\",\n [classes.variantListHead]:\n tableContext.variant === \"listrow\" && type !== \"body\",\n [classes[`variant${capitalize(variant)}`]]: variant !== \"default\",\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":["defaultComponent","getSortedColor","color","alpha","checkValidHexColorValue","hexToRgbA","parseFloat","HvTableCell","forwardRef","props","externalRef","children","component","className","style","classes","classesProp","align","variant","type","typeProp","stickyColumn","stickyColumnMostLeft","stickyColumnLeastRight","groupColumnMostLeft","groupColumnMostRight","sorted","resizable","resizing","others","cx","css","useClasses","colors","rootId","useTheme","tableContext","useContext","TableContext","tableSectionContext","TableSectionContext","sortedColorValue","setSortedColorValue","useState","sortedColorAlpha","setSortedColorAlpha","Component","components","Td","sortedColor","setSortedColor","useEffect","getVarValue","theme","table","rowSortedColor","rowSortedColorAlpha","ref","role","root","staticClasses","backgroundColor","backgroundImage","capitalize","variantList","variantListHead"],"mappings":";;;;;;;;;;;AAkEA,MAAMA,mBAAmB;AAEzB,MAAMC,iBAAiBA,CAACC,OAAgBC,UAAmB;AAClDC,SAAAA,wBAAwBF,KAAK,KAAKC,QACrCE,UAAUH,OAAOI,WAAWH,KAAK,CAAC,IAClCD;AACN;AAKO,MAAMK,cAAcC,WACzB,CAACC,OAAOC,gBAAgB;;AAChB,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,SAASC;AAAAA,IACTC,QAAQ;AAAA,IACRC,UAAU;AAAA,IACVC,MAAMC;AAAAA,IACNC,eAAe;AAAA,IACfC,uBAAuB;AAAA,IACvBC,yBAAyB;AAAA,IACzBC,sBAAsB;AAAA,IACtBC,uBAAuB;AAAA,IACvBC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZC,WAAW;AAAA,IACX,GAAGC;AAAAA,EACDpB,IAAAA;AACE,QAAA;AAAA,IAAEM;AAAAA,IAASe;AAAAA,IAAIC;AAAAA,EAAAA,IAAQC,WAAWhB,WAAW;AAC7C,QAAA;AAAA,IAAEiB;AAAAA,IAAQC;AAAAA,MAAWC,SAAS;AAC9BC,QAAAA,eAAeC,WAAWC,YAAY;AACtCC,QAAAA,sBAAsBF,WAAWG,mBAAmB;AAE1D,QAAM,CAACC,kBAAkBC,mBAAmB,IAAIC,SAAiB;AACjE,QAAM,CAACC,kBAAkBC,mBAAmB,IAAIF,SAAiB;AAE3DxB,QAAAA,OAAOC,aAAYmB,2DAAqBpB,SAAQ;AAEtD,QAAM2B,YACJlC,eAAawB,kDAAcW,eAAdX,mBAA0BY,OAAMhD;AAEzC,QAAA,CAACiD,aAAaC,cAAc,IAAIP,SACpC1C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,MAChC,CAACV,QAAQY,SAAS,GAAGA;AAAAA,MACrB,CAACZ,QAAQa,QAAQ,GAAGA;AAAAA,OAEtBf,SACF;AAAA,IAAE,GACEgB;AAAAA,IAAMlB;AAAAA,EAAAA,CAGD;AAEf,CACF;"}
@@ -33,17 +33,17 @@ const HvTableHeader = forwardRef(({
33
33
  resizerProps = {},
34
34
  resizable = false,
35
35
  resizing = false,
36
+ sortButtonProps,
36
37
  ...others
37
38
  }, externalRef) => {
38
- var _a, _b;
39
+ var _a;
39
40
  const {
40
41
  classes,
41
42
  cx,
42
43
  css
43
44
  } = useClasses(classesProp);
44
45
  const {
45
- activeTheme,
46
- selectedMode
46
+ colors
47
47
  } = useTheme();
48
48
  const tableContext = useContext(TableContext);
49
49
  const tableSectionContext = useContext(TableSectionContext);
@@ -61,7 +61,7 @@ const HvTableHeader = forwardRef(({
61
61
  style,
62
62
  className: cx(classes.root, classes[type], type === "body" && css({
63
63
  [`&.${staticClasses.sorted}`]: {
64
- backgroundColor: alpha(hexToRgb(((_b = activeTheme == null ? void 0 : activeTheme.colors) == null ? void 0 : _b.modes[selectedMode].atmo1) || theme.colors.atmo1), 0.4)
64
+ backgroundColor: alpha(hexToRgb((colors == null ? void 0 : colors.atmo1) || theme.colors.atmo1), 0.4)
65
65
  }
66
66
  }), {
67
67
  [classes.groupColumnMostLeft]: groupColumnMostLeft,
@@ -87,6 +87,8 @@ const HvTableHeader = forwardRef(({
87
87
  className: classes.sortButton,
88
88
  icon: true,
89
89
  overrideIconColors: false,
90
+ "aria-label": "Sort",
91
+ ...sortButtonProps,
90
92
  children: /* @__PURE__ */ jsx(Sort, {
91
93
  className: classes.sortIcon
92
94
  })
@@ -1 +1 @@
1
- {"version":3,"file":"TableHeader.js","sources":["../../../../../src/components/Table/TableHeader/TableHeader.tsx"],"sourcesContent":["import {\n forwardRef,\n HTMLAttributes,\n ThHTMLAttributes,\n useContext,\n useMemo,\n} from \"react\";\n\nimport capitalize from \"lodash/capitalize\";\n\nimport { hexToRgb, alpha } from \"@mui/material\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvTypography, HvTypographyProps } from \"@core/components/Typography\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { HvButton } from \"@core/components/Button\";\n\nimport TableContext from \"../TableContext\";\nimport TableSectionContext from \"../TableSectionContext\";\nimport { getSortIcon, isParagraph } from \"./utils\";\nimport { useClasses, staticClasses } from \"./TableHeader.styles\";\nimport {\n HvTableCellAlign,\n HvTableCellType,\n HvTableCellVariant,\n} from \"../Table\";\n\nexport { staticClasses as tableHeaderClasses };\n\nexport type HvTableHeaderClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableHeaderProps\n extends Omit<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?: HTMLAttributes<HTMLDivElement>;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableHeaderClasses;\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 (\n {\n children,\n component,\n className,\n style,\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 ...others\n },\n externalRef\n ) => {\n const { classes, cx, css } = useClasses(classesProp);\n\n const { activeTheme, selectedMode } = useTheme();\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 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 type === \"body\" &&\n css({\n [`&.${staticClasses.sorted}`]: {\n backgroundColor: alpha(\n hexToRgb(\n activeTheme?.colors?.modes[selectedMode].atmo1 ||\n theme.colors.atmo1\n ),\n 0.4\n ),\n },\n }),\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 [classes[`align${capitalize(align)}`]]: align !== \"inherit\",\n [classes[`variant${capitalize(variant)}`]]: variant !== \"default\",\n },\n className\n )}\n aria-sort={sortable ? sortDirection : undefined}\n {...others}\n >\n <div\n className={cx(classes.headerContent, {\n [classes[`alignFlex${capitalize(align)}`]]: align !== \"inherit\",\n })}\n >\n {isHeadCell && sortable && (\n <HvButton\n className={classes.sortButton}\n icon\n overrideIconColors={false}\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 {resizable && <div {...resizerProps} className={classes.resizer} />}\n </div>\n </Component>\n );\n }\n);\n"],"names":["defaultComponent","HvTableHeader","forwardRef","children","component","className","style","classes","classesProp","scope","scopeProp","align","variant","type","typeProp","stickyColumn","stickyColumnMostLeft","stickyColumnLeastRight","groupColumnMostLeft","groupColumnMostRight","sortDirection","sorted","sortable","headerTextProps","resizerProps","resizable","resizing","others","externalRef","cx","css","useClasses","activeTheme","selectedMode","useTheme","tableContext","useContext","TableContext","tableSectionContext","TableSectionContext","isHeadCell","Sort","useMemo","getSortIcon","Component","components","Th","role","paragraph","isParagraph","ref","root","staticClasses","backgroundColor","alpha","hexToRgb","colors","modes","atmo1","theme","variantList","capitalize","undefined","headerContent","HvButton","sortButton","icon","overrideIconColors","sortIcon","_jsx","HvTypography","headerText","headerParagraph","sortableHeaderText","resizer"],"mappings":";;;;;;;;;;;;AA2EA,MAAMA,mBAAmB;AAKZC,MAAAA,gBAAgBC,WAC3B,CACE;AAAA,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B,GAAG;AAAA,UACZ,CAACtB,QAAQgE,UAAU,GAAG,CAACvB;AAAAA,UACvB,CAACzC,QAAQiE,eAAe,GAAGxB;AAAAA,UAC3B,CAACzC,QAAQkE,kBAAkB,GAAGnD;AAAAA,QAAAA,CAC/B;AAAA,QACDV,SAAQ;AAAA,QAAO,GACXW;AAAAA,QAAepB;AAAAA,MAAAA,CAGP,GACbsB,aAAa4C,oBAAA,OAAA;AAAA,QAAA,GAAS7C;AAAAA,QAAcnB,WAAWE,QAAQmE;AAAAA,MAAAA,CAAU,CAAC;AAAA,IAAA,CAChE;AAAA,EAAA,CACI;AAEf,CACF;"}
1
+ {"version":3,"file":"TableHeader.js","sources":["../../../../../src/components/Table/TableHeader/TableHeader.tsx"],"sourcesContent":["import {\n forwardRef,\n HTMLAttributes,\n ThHTMLAttributes,\n useContext,\n useMemo,\n} from \"react\";\n\nimport capitalize from \"lodash/capitalize\";\n\nimport { hexToRgb, alpha } from \"@mui/material\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvTypography, HvTypographyProps } from \"@core/components/Typography\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { HvButton, HvButtonProps } from \"@core/components/Button\";\n\nimport TableContext from \"../TableContext\";\nimport TableSectionContext from \"../TableSectionContext\";\nimport { getSortIcon, isParagraph } from \"./utils\";\nimport { useClasses, staticClasses } from \"./TableHeader.styles\";\nimport {\n HvTableCellAlign,\n HvTableCellType,\n HvTableCellVariant,\n} from \"../Table\";\n\nexport { staticClasses as tableHeaderClasses };\n\nexport type HvTableHeaderClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableHeaderProps\n extends Omit<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?: 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 (\n {\n children,\n component,\n className,\n style,\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 },\n externalRef\n ) => {\n const { classes, cx, css } = useClasses(classesProp);\n\n const { colors } = useTheme();\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 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 type === \"body\" &&\n css({\n [`&.${staticClasses.sorted}`]: {\n backgroundColor: alpha(\n hexToRgb(colors?.atmo1 || theme.colors.atmo1),\n 0.4\n ),\n },\n }),\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 [classes[`align${capitalize(align)}`]]: align !== \"inherit\",\n [classes[`variant${capitalize(variant)}`]]: variant !== \"default\",\n },\n className\n )}\n aria-sort={sortable ? sortDirection : undefined}\n {...others}\n >\n <div\n className={cx(classes.headerContent, {\n [classes[`alignFlex${capitalize(align)}`]]: align !== \"inherit\",\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 {resizable && <div {...resizerProps} className={classes.resizer} />}\n </div>\n </Component>\n );\n }\n);\n"],"names":["defaultComponent","HvTableHeader","forwardRef","children","component","className","style","classes","classesProp","scope","scopeProp","align","variant","type","typeProp","stickyColumn","stickyColumnMostLeft","stickyColumnLeastRight","groupColumnMostLeft","groupColumnMostRight","sortDirection","sorted","sortable","headerTextProps","resizerProps","resizable","resizing","sortButtonProps","others","externalRef","cx","css","useClasses","colors","useTheme","tableContext","useContext","TableContext","tableSectionContext","TableSectionContext","isHeadCell","Sort","useMemo","getSortIcon","Component","components","Th","role","paragraph","isParagraph","ref","root","staticClasses","backgroundColor","alpha","hexToRgb","atmo1","theme","variantList","capitalize","undefined","headerContent","HvButton","sortButton","icon","overrideIconColors","sortIcon","_jsx","HvTypography","headerText","headerParagraph","sortableHeaderText","resizer"],"mappings":";;;;;;;;;;;;AA6EA,MAAMA,mBAAmB;AAKZC,MAAAA,gBAAgBC,WAC3B,CACE;AAAA,EACEC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,SAASC;AAAAA,EACTC,OAAOC;AAAAA,EACPC,QAAQ;AAAA,EACRC,UAAU;AAAA,EACVC,MAAMC;AAAAA,EACNC,eAAe;AAAA,EACfC,uBAAuB;AAAA,EACvBC,yBAAyB;AAAA,EACzBC,sBAAsB;AAAA,EACtBC,uBAAuB;AAAA,EACvBC,gBAAgB;AAAA,EAChBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,eAAe,CAAC;AAAA,EAChBC,YAAY;AAAA,EACZC,WAAW;AAAA,EACXC;AAAAA,EACA,GAAGC;AACL,GACAC,gBACG;;AACG,QAAA;AAAA,IAAEtB;AAAAA,IAASuB;AAAAA,IAAIC;AAAAA,EAAAA,IAAQC,WAAWxB,WAAW;AAE7C,QAAA;AAAA,IAAEyB;AAAAA,MAAWC,SAAS;AACtBC,QAAAA,eAAeC,WAAWC,YAAY;AACtCC,Q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A,UAAU;AAAA,MAClD,CAACJ,QAAS,UAASoD,WAAW/C,OAAO,GAAG,CAAC,GAAGA,YAAY;AAAA,OAE1DP,SACF;AAAA,IACA,aAAWiB,WAAWF,gBAAgBwC;AAAAA,IAAU,GAC5ChC;AAAAA,IAAMzB,+BAEV,OAAA;AAAA,MACEE,WAAWyB,GAAGvB,QAAQsD,eAAe;AAAA,QACnC,CAACtD,QAAS,YAAWoD,WAAWhD,KAAK,GAAG,CAAC,GAAGA,UAAU;AAAA,MAAA,CACvD;AAAA,MAAER,WAEFqC,cAAclB,gCACZwC,UAAQ;AAAA,QACPzD,WAAWE,QAAQwD;AAAAA,QACnBC,MAAI;AAAA,QACJC,oBAAoB;AAAA,QACpB,cAAW;AAAA,QAAM,GACbtC;AAAAA,QAAexB,8BAElBsC,MAAI;AAAA,UAACpC,WAAWE,QAAQ2D;AAAAA,QAAAA,CAAW;AAAA,MAAA,CAC5B,GAEZC,oBAACC,cAAY;AAAA,QACXhE,WAAU;AAAA,QACVC,WAAWyB,GAAG;AAAA,UACZ,CAACvB,QAAQ8D,UAAU,GAAG,CAACrB;AAAAA,UACvB,CAACzC,QAAQ+D,eAAe,GAAGtB;AAAAA,UAC3B,CAACzC,QAAQgE,kBAAkB,GAAGjD;AAAAA,QAAAA,CAC/B;AAAA,QACDV,SAAQ;AAAA,QAAO,GACXW;AAAAA,QAAepB;AAAAA,MAAAA,CAGP,GACbsB,aAAa0C,oBAAA,OAAA;AAAA,QAAA,GAAS3C;AAAAA,QAAcnB,WAAWE,QAAQiE;AAAAA,MAAAA,CAAU,CAAC;AAAA,IAAA,CAChE;AAAA,EAAA,CACI;AAEf,CACF;"}
@@ -14,7 +14,7 @@ const getStripedColor = (color, opacity = 0.6) => {
14
14
  return checkValidHexColorValue(color) ? hexToRgbA(color, opacity) : color;
15
15
  };
16
16
  const HvTableRow = forwardRef((props, externalRef) => {
17
- var _a, _b;
17
+ var _a;
18
18
  const {
19
19
  classes: classesProp,
20
20
  className,
@@ -31,8 +31,7 @@ const HvTableRow = forwardRef((props, externalRef) => {
31
31
  css
32
32
  } = useClasses(classesProp);
33
33
  const {
34
- activeTheme,
35
- selectedMode,
34
+ colors,
36
35
  rootId
37
36
  } = useTheme();
38
37
  const tableContext = useContext(TableContext);
@@ -49,7 +48,7 @@ const HvTableRow = forwardRef((props, externalRef) => {
49
48
  setOdd(getVarValue(theme.table.rowStripedBackgroundColorOdd, rootId));
50
49
  setStripedColorEven(getStripedColor(even));
51
50
  setStripedColorOdd(getStripedColor(odd));
52
- }, [(_b = activeTheme == null ? void 0 : activeTheme.colors) == null ? void 0 : _b.modes[selectedMode], even, odd, rootId]);
51
+ }, [colors, even, odd, rootId]);
53
52
  return /* @__PURE__ */ jsx(Component, {
54
53
  ref: externalRef,
55
54
  className: cx(tableSectionContext.filterClassName, classes.root, classes[type], striped && css({
@@ -1 +1 @@
1
- {"version":3,"file":"TableRow.js","sources":["../../../../../src/components/Table/TableRow/TableRow.tsx"],"sourcesContent":["import { forwardRef, useContext, useEffect, useState } from \"react\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { checkValidHexColorValue } from \"@core/utils/checkValidHexColorValue\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\nimport { getVarValue } from \"@core/utils/theme\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useTheme } from \"@core/hooks/useTheme\";\n\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\nconst getStripedColor = (color?: string, opacity: number = 0.6) => {\n return checkValidHexColorValue(color) ? hexToRgbA(color, opacity) : color;\n};\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 } = props;\n const { classes, cx, css } = useClasses(classesProp);\n const { activeTheme, selectedMode, rootId } = useTheme();\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const [even, setEven] = useState<string | undefined>();\n const [odd, setOdd] = useState<string | undefined>();\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 const [stripedColorEven, setStripedColorEven] = useState(\n getStripedColor(even)\n );\n const [stripedColorOdd, setStripedColorOdd] = useState(\n getStripedColor(odd)\n );\n\n useEffect(() => {\n setEven(getVarValue(theme.table.rowStripedBackgroundColorEven, rootId));\n setOdd(getVarValue(theme.table.rowStripedBackgroundColorOdd, rootId));\n\n setStripedColorEven(getStripedColor(even));\n setStripedColorOdd(getStripedColor(odd));\n }, [activeTheme?.colors?.modes[selectedMode], even, odd, rootId]);\n\n return (\n <Component\n ref={externalRef}\n className={cx(\n tableSectionContext.filterClassName,\n classes.root,\n classes[type],\n striped &&\n css({\n \"&:nth-of-type(even)\": {\n backgroundColor: stripedColorEven,\n \"&:hover\": {\n backgroundColor: theme.table.rowHoverColor,\n },\n },\n \"&:nth-of-type(odd)\": {\n backgroundColor: stripedColorOdd,\n \"&:hover\": {\n backgroundColor: theme.table.rowHoverColor,\n },\n },\n }),\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":["defaultComponent","getStripedColor","color","opacity","checkValidHexColorValue","hexToRgbA","HvTableRow","forwardRef","props","externalRef","classes","classesProp","className","component","hover","selected","expanded","striped","others","cx","css","useClasses","activeTheme","selectedMode","rootId","useTheme","tableContext","useContext","TableContext","tableSectionContext","TableSectionContext","even","setEven","useState","odd","setOdd","type","isList","variant","Component","components","Tr","stripedColorEven","setStripedColorEven","stripedColorOdd","setStripedColorOdd","useEffect","getVarValue","theme","table","rowStripedBackgroundColorEven","rowStripedBackgroundColorOdd","colors","modes","ref","filterClassName","root","backgroundColor","rowHoverColor","variantList","variantListHead","role"],"mappings":";;;;;;;;;;;AAqCA,MAAMA,mBAAmB;AAEzB,MAAMC,kBAAkBA,CAACC,OAAgBC,UAAkB,QAAQ;AACjE,SAAOC,wBAAwBF,KAAK,IAAIG,UAAUH,OAAOC,OAAO,IAAID;AACtE;AAKO,MAAMI,aAAaC,WACxB,CAACC,OAAOC,gBAAgB;;AAChB,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,UAAU;AAAA,IACV,GAAGC;AAAAA,EACDV,IAAAA;AACE,QAAA;AAAA,IAAEE;AAAAA,IAASS;AAAAA,IAAIC;AAAAA,EAAAA,IAAQC,WAAWV,WAAW;AAC7C,QAAA;AAAA,IAAEW;AAAAA,IAAaC;AAAAA,IAAcC;AAAAA,MAAWC,SAAS;AACjDC,QAAAA,eAAeC,WAAWC,YAAY;AACtCC,QAAAA,sBAAsBF,WAAWG,mBAAmB;AAE1D,QAAM,CAACC,MAAMC,OAAO,IAAIC,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A,MACnB,CAACP,QAAQiD,WAAW,GAAGtB,UAAUD,SAAS;AAAA,MAC1C,CAAC1B,QAAQkD,eAAe,GAAGvB,UAAUD,SAAS;AAAA,OAEhDxB,SACF;AAAA,IACAiD,MAAMtB,cAAcvC,mBAAmB,OAAO;AAAA,IAAM,GAChDkB;AAAAA,EAAAA,CACL;AAEL,CACF;"}
1
+ {"version":3,"file":"TableRow.js","sources":["../../../../../src/components/Table/TableRow/TableRow.tsx"],"sourcesContent":["import { forwardRef, useContext, useEffect, useState } from \"react\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { checkValidHexColorValue } from \"@core/utils/checkValidHexColorValue\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\nimport { getVarValue } from \"@core/utils/theme\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useTheme } from \"@core/hooks/useTheme\";\n\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\nconst getStripedColor = (color?: string, opacity: number = 0.6) => {\n return checkValidHexColorValue(color) ? hexToRgbA(color, opacity) : color;\n};\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 } = props;\n const { classes, cx, css } = useClasses(classesProp);\n const { colors, rootId } = useTheme();\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const [even, setEven] = useState<string | undefined>();\n const [odd, setOdd] = useState<string | undefined>();\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 const [stripedColorEven, setStripedColorEven] = useState(\n getStripedColor(even)\n );\n const [stripedColorOdd, setStripedColorOdd] = useState(\n getStripedColor(odd)\n );\n\n useEffect(() => {\n setEven(getVarValue(theme.table.rowStripedBackgroundColorEven, rootId));\n setOdd(getVarValue(theme.table.rowStripedBackgroundColorOdd, rootId));\n\n setStripedColorEven(getStripedColor(even));\n setStripedColorOdd(getStripedColor(odd));\n }, [colors, even, odd, rootId]);\n\n return (\n <Component\n ref={externalRef}\n className={cx(\n tableSectionContext.filterClassName,\n classes.root,\n classes[type],\n striped &&\n css({\n \"&:nth-of-type(even)\": {\n backgroundColor: stripedColorEven,\n \"&:hover\": {\n backgroundColor: theme.table.rowHoverColor,\n },\n },\n \"&:nth-of-type(odd)\": {\n backgroundColor: stripedColorOdd,\n \"&:hover\": {\n backgroundColor: theme.table.rowHoverColor,\n },\n },\n }),\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":["defaultComponent","getStripedColor","color","opacity","checkValidHexColorValue","hexToRgbA","HvTableRow","forwardRef","props","externalRef","classes","classesProp","className","component","hover","selected","expanded","striped","others","cx","css","useClasses","colors","rootId","useTheme","tableContext","useContext","TableContext","tableSectionContext","TableSectionContext","even","setEven","useState","odd","setOdd","type","isList","variant","Component","components","Tr","stripedColorEven","setStripedColorEven","stripedColorOdd","setStripedColorOdd","useEffect","getVarValue","theme","table","rowStripedBackgroundColorEven","rowStripedBackgroundColorOdd","ref","filterClassName","root","backgroundColor","rowHoverColor","variantList","variantListHead","role"],"mappings":";;;;;;;;;;;AAqCA,MAAMA,mBAAmB;AAEzB,MAAMC,kBAAkBA,CAACC,OAAgBC,UAAkB,QAAQ;AACjE,SAAOC,wBAAwBF,KAAK,IAAIG,UAAUH,OAAOC,OAAO,IAAID;AACtE;AAKO,MAAMI,aAAaC,WACxB,CAACC,OAAOC,gBAAgB;;AAChB,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,UAAU;AAAA,IACV,GAAGC;AAAAA,EACDV,IAAAA;AACE,QAAA;AAAA,IAAEE;AAAAA,IAASS;AAAAA,IAAIC;AAAAA,EAAAA,IAAQC,WAAWV,WAAW;AAC7C,QAAA;AAAA,IAAEW;AAAAA,IAAQC;AAAAA,MAAWC,SAAS;AAC9BC,QAAAA,eAAeC,WAAWC,YAAY;AACtCC,QAAAA,sBAAsBF,WAAWG,mBAAmB;AAE1D,QAAM,CAACC,MAAMC,OAAO,IAAIC,SAA6B;AACrD,QAAM,CAACC,KAAKC,MAAM,IAAIF,SAA6B;AAE7CG,QAAAA,QAAOP,2DAAqBO,SAAQ;AAEpCC,QAAAA,SAASX,aAAaY,YAAY;AAExC,QAAMC,YACJzB,eAAaY,kDAAcc,eAAdd,mBAA0Be,OAAMxC;AAE/C,QAAM,CAACyC,kBAAkBC,mBAAmB,IAAIV,SAC9C/B,gBAAgB6B,IAAI,CACtB;AACA,QAAM,CAACa,iBAAiBC,kBAAkB,IAAIZ,SAC5C/B,gBAAgBgC,GAAG,CACrB;AAEAY,YAAU,MAAM;AACdd,YAAQe,YAAYC,MAAMC,MAAMC,+BAA+B1B,MAAM,CAAC;AACtEW,WAAOY,YAAYC,MAAMC,MAAME,8BAA8B3B,MAAM,CAAC;AAEhDtB,wBAAAA,gBAAgB6B,IAAI,CAAC;AACtB7B,uBAAAA,gBAAgBgC,GAAG,CAAC;AAAA,KACtC,CAACX,QAAQQ,MAAMG,KAAKV,MAAM,CAAC;AAE9B,6BACGe,WAAS;AAAA,IACRa,KAAK1C;AAAAA,IACLG,WAAWO,GACTS,oBAAoBwB,iBACpB1C,QAAQ2C,MACR3C,QAAQyB,IAAI,GACZlB,WACEG,IAAI;AAAA,MACF,uBAAuB;AAAA,QACrBkC,iBAAiBb;AAAAA,QACjB,WAAW;AAAA,UACTa,iBAAiBP,MAAMC,MAAMO;AAAAA,QAC/B;AAAA,MACF;AAAA,MACA,sBAAsB;AAAA,QACpBD,iBAAiBX;AAAAA,QACjB,WAAW;AAAA,UACTW,iBAAiBP,MAAMC,MAAMO;AAAAA,QAC/B;AAAA,MACF;AAAA,IAAA,CACD,GACH;AAAA,MACE,CAAC7C,QAAQI,KAAK,GAAGA;AAAAA,MACjB,CAACJ,QAAQK,QAAQ,GAAGA;AAAAA,MACpB,CAACL,QAAQM,QAAQ,GAAGA;AAAAA,MACpB,CAACN,QAAQO,OAAO,GAAGA;AAAAA,MACnB,CAACP,QAAQ8C,WAAW,GAAGpB,UAAUD,SAAS;AAAA,MAC1C,CAACzB,QAAQ+C,eAAe,GAAGrB,UAAUD,SAAS;AAAA,OAEhDvB,SACF;AAAA,IACA8C,MAAMpB,cAActC,mBAAmB,OAAO;AAAA,IAAM,GAChDkB;AAAAA,EAAAA,CACL;AAEL,CACF;"}
@@ -7,7 +7,8 @@ const normalizeProgressBar = (value, max) => {
7
7
  const HvProgressColumnCell = ({
8
8
  partial,
9
9
  total,
10
- color = "primary"
10
+ color = "primary",
11
+ "aria-labelledby": ariaLabelledBy
11
12
  }) => {
12
13
  const {
13
14
  classes
@@ -27,7 +28,8 @@ const HvProgressColumnCell = ({
27
28
  },
28
29
  color,
29
30
  variant: "determinate",
30
- value: percentage
31
+ value: percentage,
32
+ "aria-labelledby": ariaLabelledBy
31
33
  })
32
34
  })
33
35
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressColumnCell.js","sources":["../../../../../../src/components/Table/renderers/ProgressColumnCell/ProgressColumnCell.tsx"],"sourcesContent":["import MuiLinearProgress from \"@mui/material/LinearProgress\";\n\nimport { useClasses } from \"./ProgressColumnCell.styles\";\n\nexport interface HvProgressColumnCellProp {\n /** Current value of the bar. */\n partial: number;\n /** Maximum value of the bar. */\n total: number;\n /** The color of the bar. */\n color?: \"primary\" | \"secondary\";\n}\n\nexport const normalizeProgressBar = (value: number, max: number) => {\n return max > 0 ? Math.floor((value * 100) / max) : 0;\n};\n\nexport const HvProgressColumnCell = ({\n partial,\n total,\n color = \"primary\",\n}: HvProgressColumnCellProp): JSX.Element => {\n const { classes } = useClasses();\n\n const percentage = normalizeProgressBar(partial, total);\n\n return (\n <div className={classes.root}>\n <div className={classes.linearProgressContainer}>\n <MuiLinearProgress\n className={classes.linearProgress}\n classes={{\n root: classes.linearProgressRoot,\n colorPrimary: classes.linearProgressColorPrimary,\n barColorPrimary: classes.linearProgressBarColorPrimary,\n barColorSecondary: classes.linearProgressBarColorSecondary,\n }}\n color={color}\n variant=\"determinate\"\n value={percentage}\n />\n </div>\n </div>\n );\n};\n"],"names":["normalizeProgressBar","value","max","Math","floor","HvProgressColumnCell","partial","total","color","classes","useClasses","percentage","className","root","children","linearProgressContainer","MuiLinearProgress","linearProgress","linearProgressRoot","colorPrimary","linearProgressColorPrimary","barColorPrimary","linearProgressBarColorPrimary","barColorSecondary","linearProgressBarColorSecondary","variant"],"mappings":";;;AAaaA,MAAAA,uBAAuBA,CAACC,OAAeC,QAAgB;AAClE,SAAOA,MAAM,IAAIC,KAAKC,MAAOH,QAAQ,MAAOC,GAAG,IAAI;AACrD;AAEO,MAAMG,uBAAuBA,CAAC;AAAA,EACnCC;AAAAA,EACAC;AAAAA,EACAC,QAAQ;AACgB,MAAmB;AACrC,QAAA;AAAA,IAAEC;AAAAA,MAAYC,WAAW;AAEzBC,QAAAA,aAAaX,qBAAqBM,SAASC,KAAK;AAEtD,6BACE,OAAA;AAAA,IAAKK,WAAWH,QAAQI;AAAAA,IAAKC,8BAC3B,OAAA;AAAA,MAAKF,WAAWH,QAAQM;AAAAA,MAAwBD,8BAC7CE,mBAAiB;AAAA,QAChBJ,WAAWH,QAAQQ;AAAAA,QACnBR,SAAS;AAAA,UACPI,MAAMJ,QAAQS;AAAAA,UACdC,cAAcV,QAAQW;AAAAA,UACtBC,iBAAiBZ,QAAQa;AAAAA,UACzBC,mBAAmBd,QAAQe;AAAAA,QAC7B;AAAA,QACAhB;AAAAA,QACAiB,SAAQ;AAAA,QACRxB,OAAOU;AAAAA,MAAAA,CACR;AAAA,IAAA,CACE;AAAA,EAAA,CACF;AAET;"}
1
+ {"version":3,"file":"ProgressColumnCell.js","sources":["../../../../../../src/components/Table/renderers/ProgressColumnCell/ProgressColumnCell.tsx"],"sourcesContent":["import MuiLinearProgress from \"@mui/material/LinearProgress\";\n\nimport { useClasses } from \"./ProgressColumnCell.styles\";\n\nexport interface HvProgressColumnCellProp {\n /** Current value of the bar. */\n partial: number;\n /** Maximum value of the bar. */\n total: number;\n /** The color of the bar. */\n color?: \"primary\" | \"secondary\";\n \"aria-labelledby\"?: string;\n}\n\nexport const normalizeProgressBar = (value: number, max: number) => {\n return max > 0 ? Math.floor((value * 100) / max) : 0;\n};\n\nexport const HvProgressColumnCell = ({\n partial,\n total,\n color = \"primary\",\n \"aria-labelledby\": ariaLabelledBy,\n}: HvProgressColumnCellProp): JSX.Element => {\n const { classes } = useClasses();\n\n const percentage = normalizeProgressBar(partial, total);\n\n return (\n <div className={classes.root}>\n <div className={classes.linearProgressContainer}>\n <MuiLinearProgress\n className={classes.linearProgress}\n classes={{\n root: classes.linearProgressRoot,\n colorPrimary: classes.linearProgressColorPrimary,\n barColorPrimary: classes.linearProgressBarColorPrimary,\n barColorSecondary: classes.linearProgressBarColorSecondary,\n }}\n color={color}\n variant=\"determinate\"\n value={percentage}\n aria-labelledby={ariaLabelledBy}\n />\n </div>\n </div>\n );\n};\n"],"names":["normalizeProgressBar","value","max","Math","floor","HvProgressColumnCell","partial","total","color","ariaLabelledBy","classes","useClasses","percentage","className","root","children","linearProgressContainer","MuiLinearProgress","linearProgress","linearProgressRoot","colorPrimary","linearProgressColorPrimary","barColorPrimary","linearProgressBarColorPrimary","barColorSecondary","linearProgressBarColorSecondary","variant"],"mappings":";;;AAcaA,MAAAA,uBAAuBA,CAACC,OAAeC,QAAgB;AAClE,SAAOA,MAAM,IAAIC,KAAKC,MAAOH,QAAQ,MAAOC,GAAG,IAAI;AACrD;AAEO,MAAMG,uBAAuBA,CAAC;AAAA,EACnCC;AAAAA,EACAC;AAAAA,EACAC,QAAQ;AAAA,EACR,mBAAmBC;AACK,MAAmB;AACrC,QAAA;AAAA,IAAEC;AAAAA,MAAYC,WAAW;AAEzBC,QAAAA,aAAaZ,qBAAqBM,SAASC,KAAK;AAEtD,6BACE,OAAA;AAAA,IAAKM,WAAWH,QAAQI;AAAAA,IAAKC,8BAC3B,OAAA;AAAA,MAAKF,WAAWH,QAAQM;AAAAA,MAAwBD,8BAC7CE,mBAAiB;AAAA,QAChBJ,WAAWH,QAAQQ;AAAAA,QACnBR,SAAS;AAAA,UACPI,MAAMJ,QAAQS;AAAAA,UACdC,cAAcV,QAAQW;AAAAA,UACtBC,iBAAiBZ,QAAQa;AAAAA,UACzBC,mBAAmBd,QAAQe;AAAAA,QAC7B;AAAA,QACAjB;AAAAA,QACAkB,SAAQ;AAAA,QACRzB,OAAOW;AAAAA,QACP,mBAAiBH;AAAAA,MAAAA,CAClB;AAAA,IAAA,CACE;AAAA,EAAA,CACF;AAET;"}
@@ -20,10 +20,13 @@ const HvSwitchColumnCell = ({
20
20
  className: classes.switchNo,
21
21
  children: falseLabel
22
22
  }), /* @__PURE__ */ jsx(HvBaseSwitch, {
23
- "aria-label": switchLabel,
24
23
  checked,
25
24
  value,
26
- ...switchProps
25
+ ...switchProps,
26
+ inputProps: {
27
+ "aria-label": switchLabel,
28
+ ...switchProps == null ? void 0 : switchProps.inputProps
29
+ }
27
30
  }), trueLabel != null && /* @__PURE__ */ jsx(HvTypography, {
28
31
  "aria-hidden": "true",
29
32
  variant: "body",
@@ -1 +1 @@
1
- {"version":3,"file":"SwitchColumnCell.js","sources":["../../../../../../src/components/Table/renderers/SwitchColumnCell/SwitchColumnCell.tsx"],"sourcesContent":["import { HvBaseSwitch, HvBaseSwitchProps } from \"@core/components/BaseSwitch\";\nimport { HvTypography } from \"@core/components/Typography\";\n\nimport { useClasses } from \"./SwitchColumnCell.styles\";\n\nexport interface HvSwitchColumnCellProp {\n /** Whether the switch is checked or not. */\n checked: boolean;\n /** The switch label. */\n value: number | string | undefined;\n /** The value of the switch. */\n switchLabel: string;\n /** The right switch label. */\n falseLabel?: string;\n /** The left switch label. */\n trueLabel?: string;\n /** Extra props to be passed to the switch. */\n switchProps?: HvBaseSwitchProps;\n}\n\nexport const HvSwitchColumnCell = ({\n checked,\n value,\n switchLabel,\n falseLabel,\n trueLabel,\n switchProps,\n}: HvSwitchColumnCellProp): JSX.Element => {\n const { classes } = useClasses();\n\n return (\n <>\n {falseLabel != null && (\n <HvTypography\n aria-hidden=\"true\"\n variant=\"body\"\n className={classes.switchNo}\n >\n {falseLabel}\n </HvTypography>\n )}\n <HvBaseSwitch\n aria-label={switchLabel}\n checked={checked}\n value={value}\n {...switchProps}\n />\n {trueLabel != null && (\n <HvTypography\n aria-hidden=\"true\"\n variant=\"body\"\n className={classes.switchYes}\n >\n {trueLabel}\n </HvTypography>\n )}\n </>\n );\n};\n"],"names":["HvSwitchColumnCell","checked","value","switchLabel","falseLabel","trueLabel","switchProps","classes","useClasses","_Fragment","children","HvTypography","variant","className","switchNo","_jsx","HvBaseSwitch","switchYes"],"mappings":";;;;AAoBO,MAAMA,qBAAqBA,CAAC;AAAA,EACjCC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AACsB,MAAmB;AACnC,QAAA;AAAA,IAAEC;AAAAA,MAAYC,WAAW;AAE/B,8BACEC,UAAA;AAAA,IAAAC,WACGN,cAAc,4BACZO,cAAY;AAAA,MACX,eAAY;AAAA,MACZC,SAAQ;AAAA,MACRC,WAAWN,QAAQO;AAAAA,MAASJ,UAE3BN;AAAAA,IAAAA,CACW,GAEhBW,oBAACC,cAAY;AAAA,MACX,cAAYb;AAAAA,MACZF;AAAAA,MACAC;AAAAA,MAAa,GACTI;AAAAA,IACL,CAAA,GACAD,aAAa,4BACXM,cAAY;AAAA,MACX,eAAY;AAAA,MACZC,SAAQ;AAAA,MACRC,WAAWN,QAAQU;AAAAA,MAAUP,UAE5BL;AAAAA,IAAAA,CACW,CACf;AAAA,EAAA,CACD;AAEN;"}
1
+ {"version":3,"file":"SwitchColumnCell.js","sources":["../../../../../../src/components/Table/renderers/SwitchColumnCell/SwitchColumnCell.tsx"],"sourcesContent":["import { HvBaseSwitch, HvBaseSwitchProps } from \"@core/components/BaseSwitch\";\nimport { HvTypography } from \"@core/components/Typography\";\n\nimport { useClasses } from \"./SwitchColumnCell.styles\";\n\nexport interface HvSwitchColumnCellProp {\n /** Whether the switch is checked or not. */\n checked: boolean;\n /** The switch label. */\n value: number | string | undefined;\n /** The value of the switch. */\n switchLabel: string;\n /** The right switch label. */\n falseLabel?: string;\n /** The left switch label. */\n trueLabel?: string;\n /** Extra props to be passed to the switch. */\n switchProps?: HvBaseSwitchProps;\n}\n\nexport const HvSwitchColumnCell = ({\n checked,\n value,\n switchLabel,\n falseLabel,\n trueLabel,\n switchProps,\n}: HvSwitchColumnCellProp): JSX.Element => {\n const { classes } = useClasses();\n\n return (\n <>\n {falseLabel != null && (\n <HvTypography\n aria-hidden=\"true\"\n variant=\"body\"\n className={classes.switchNo}\n >\n {falseLabel}\n </HvTypography>\n )}\n <HvBaseSwitch\n checked={checked}\n value={value}\n {...switchProps}\n inputProps={{ \"aria-label\": switchLabel, ...switchProps?.inputProps }}\n />\n {trueLabel != null && (\n <HvTypography\n aria-hidden=\"true\"\n variant=\"body\"\n className={classes.switchYes}\n >\n {trueLabel}\n </HvTypography>\n )}\n </>\n );\n};\n"],"names":["HvSwitchColumnCell","checked","value","switchLabel","falseLabel","trueLabel","switchProps","classes","useClasses","_Fragment","children","HvTypography","variant","className","switchNo","_jsx","HvBaseSwitch","inputProps","switchYes"],"mappings":";;;;AAoBO,MAAMA,qBAAqBA,CAAC;AAAA,EACjCC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AACsB,MAAmB;AACnC,QAAA;AAAA,IAAEC;AAAAA,MAAYC,WAAW;AAE/B,8BACEC,UAAA;AAAA,IAAAC,WACGN,cAAc,4BACZO,cAAY;AAAA,MACX,eAAY;AAAA,MACZC,SAAQ;AAAA,MACRC,WAAWN,QAAQO;AAAAA,MAASJ,UAE3BN;AAAAA,IAAAA,CACW,GAEhBW,oBAACC,cAAY;AAAA,MACXf;AAAAA,MACAC;AAAAA,MAAa,GACTI;AAAAA,MACJW,YAAY;AAAA,QAAE,cAAcd;AAAAA,QAAa,GAAGG,2CAAaW;AAAAA,MAAW;AAAA,IACrE,CAAA,GACAZ,aAAa,4BACXM,cAAY;AAAA,MACX,eAAY;AAAA,MACZC,SAAQ;AAAA,MACRC,WAAWN,QAAQW;AAAAA,MAAUR,UAE5BL;AAAAA,IAAAA,CACW,CACf;AAAA,EAAA,CACD;AAEN;"}
@@ -165,7 +165,8 @@ function hvDropdownColumn(col, id, placeholder, disabledPlaceholder, onChange) {
165
165
  onChange: (val) => onChange == null ? void 0 : onChange(row.id, val),
166
166
  disabled: dsbld,
167
167
  dropdownProps: {
168
- "aria-labelledby": setId(id, column.id)
168
+ "aria-labelledby": setId(id, column.id) || column.id || id
169
+ // TODO - to be reviewed because it doesn't make much sense
169
170
  }
170
171
  });
171
172
  },
@@ -180,7 +181,8 @@ function hvProgressColumn(col, getPartial, getTotal, color) {
180
181
  return {
181
182
  Cell: (cellProps) => {
182
183
  const {
183
- row
184
+ row,
185
+ column
184
186
  } = cellProps;
185
187
  const partial = (getPartial == null ? void 0 : getPartial(row)) || 0;
186
188
  const total = getTotal == null ? void 0 : getTotal(row);
@@ -188,7 +190,8 @@ function hvProgressColumn(col, getPartial, getTotal, color) {
188
190
  return /* @__PURE__ */ jsx(HvProgressColumnCell, {
189
191
  partial,
190
192
  total,
191
- color
193
+ color,
194
+ "aria-labelledby": column.id
192
195
  });
193
196
  }
194
197
  return /* @__PURE__ */ jsx(Fragment, {
@@ -1 +1 @@
1
- {"version":3,"file":"renderers.js","sources":["../../../../../src/components/Table/renderers/renderers.tsx"],"sourcesContent":["import { ClassNames } from \"@emotion/react\";\n\nimport { DropDownXS, DropUpXS } from \"@hitachivantara/uikit-react-icons\";\n\nimport { setId } from \"@core/utils/setId\";\nimport { HvTag, HvTagProps } from \"@core/components/Tag\";\nimport { HvButton } from \"@core/components/Button\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport {\n HvOverflowTooltip,\n HvOverflowTooltipProps,\n} from \"@core/components/OverflowTooltip\";\nimport { HvBaseSwitchProps } from \"@core/components/BaseSwitch\";\nimport { HvListValue } from \"@core/components/List\";\n\nimport {\n HvTableHeaderRenderer,\n HvCellProps,\n HvTableColumnConfig,\n HvRowInstance,\n} from \"../hooks/useTable\";\nimport { HvDateColumnCell } from \"./DateColumnCell\";\nimport { HvSwitchColumnCell } from \"./SwitchColumnCell\";\nimport { HvProgressColumnCell } from \"./ProgressColumnCell\";\nimport { HvDropdownColumnCell } from \"./DropdownColumnCell\";\nimport { hvStringFallback, hvNumberFallback } from \"../utils\";\n\nexport function hvTextColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(\n col: HvTableColumnConfig<D, H>,\n overflowTooltipProps: Omit<HvOverflowTooltipProps, \"data\"> = {}\n): HvTableColumnConfig<D, H> {\n return {\n Cell: ({ value }: HvCellProps<D, H>) => (\n <HvOverflowTooltip\n data={hvStringFallback(value)}\n {...overflowTooltipProps}\n />\n ),\n sortType: \"alphanumeric\",\n ...col,\n };\n}\n\nexport function hvNumberColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(col: HvTableColumnConfig<D, H>): HvTableColumnConfig<D, H> {\n return {\n Cell: ({ value }: HvCellProps<D, H>) => <>{hvNumberFallback(value)}</>,\n align: \"right\",\n sortType: \"number\",\n ...col,\n };\n}\n\nexport function hvDateColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(\n col: HvTableColumnConfig<D, H>,\n dateFormat?: string\n): HvTableColumnConfig<D, H> {\n return {\n Cell: ({ value }: HvCellProps<D, H>) => (\n <HvDateColumnCell date={value} dateFormat={dateFormat} />\n ),\n sortType: \"alphanumeric\",\n sortDescFirst: true,\n ...col,\n };\n}\n\nexport function hvExpandColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(\n col: HvTableColumnConfig<D, H>,\n expandRowButtonAriaLabel: string,\n collapseRowButtonAriaLabel: string,\n getCanRowExpand?: (row: HvRowInstance<D, H>) => boolean,\n ExpandedIcon: React.ReactNode = <DropUpXS />,\n CollapsedIcon: React.ReactNode = <DropDownXS />\n): HvTableColumnConfig<D, H> {\n return {\n Cell: (cellProps: HvCellProps<D, H>) => {\n const { value, row } = cellProps;\n const expandedProps = row.getToggleRowExpandedProps?.();\n\n const hasContent = getCanRowExpand?.(row) ?? true;\n\n return (\n <ClassNames>\n {({ css }) => (\n <>\n {hasContent && (\n <HvButton\n icon\n aria-label={\n row.isExpanded\n ? collapseRowButtonAriaLabel\n : expandRowButtonAriaLabel\n }\n aria-expanded={row.isExpanded}\n onClick={expandedProps?.onClick}\n classes={{\n root: css({\n position: \"absolute\",\n left: 0,\n top: \"50%\",\n transform: \"translateY(-50%)\",\n }),\n }}\n >\n {row.isExpanded ? ExpandedIcon : CollapsedIcon}\n </HvButton>\n )}\n\n <HvOverflowTooltip data={hvStringFallback(value)} />\n </>\n )}\n </ClassNames>\n );\n },\n sortType: \"alphanumeric\",\n cellStyle: {\n position: \"relative\",\n },\n ...col,\n };\n}\n\nexport function hvTagColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer,\n A extends object = Record<string, unknown>\n>(\n col: HvTableColumnConfig<D, H>,\n valueDataKey: keyof A,\n colorDataKey: keyof A,\n textColorDataKey: keyof A,\n fromRowData: boolean = false,\n tagProps?: HvTagProps\n): HvTableColumnConfig<D, H> {\n return {\n Cell: (cellProps: HvCellProps<D, H>) => {\n const { value, row } = cellProps;\n if (!value) {\n return <>—</>;\n }\n\n const {\n [valueDataKey]: name,\n [colorDataKey]: color,\n [textColorDataKey]: textColor,\n } = fromRowData ? row.original : value;\n\n return (\n <HvTag\n label={<HvTypography variant=\"body\">{name}</HvTypography>}\n type=\"semantic\"\n color={color}\n style={textColor != null ? { color: textColor } : {}}\n tabIndex={-1}\n {...tagProps}\n />\n );\n },\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n\nexport function hvSwitchColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(\n col: HvTableColumnConfig<D, H>,\n switchLabel: string,\n falseLabel?: string,\n trueLabel?: string,\n switchProps?: HvBaseSwitchProps\n): HvTableColumnConfig<D, H> {\n return {\n Cell: (cellProps: HvCellProps<D, H>) => {\n const { value, row } = cellProps;\n return (\n <HvSwitchColumnCell\n checked={value}\n value={row.id}\n switchLabel={switchLabel}\n falseLabel={falseLabel}\n trueLabel={trueLabel}\n switchProps={switchProps}\n />\n );\n },\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n\nexport function hvDropdownColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(\n col: HvTableColumnConfig<D, H>,\n id: string,\n placeholder: string,\n disabledPlaceholder: string,\n onChange?: (identifier: string, value: HvListValue) => void\n): HvTableColumnConfig<D, H> {\n return {\n Cell: (cellProps: HvCellProps<D, H>) => {\n const { value, row, column } = cellProps;\n const dsbld = value.length < 1;\n return (\n <HvDropdownColumnCell\n values={value}\n placeholder={dsbld ? disabledPlaceholder : placeholder}\n onChange={(val) => onChange?.(row.id, val)}\n disabled={dsbld}\n dropdownProps={{\n \"aria-labelledby\": setId(id, column.id),\n }}\n />\n );\n },\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n\nexport function hvProgressColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(\n col: HvTableColumnConfig<D, H>,\n getPartial?: (row: HvRowInstance<D, H>) => number,\n getTotal?: (row: HvRowInstance<D, H>) => number,\n color?: \"primary\" | \"secondary\"\n): HvTableColumnConfig<D, H> {\n return {\n Cell: (cellProps: HvCellProps<D, H>) => {\n const { row } = cellProps;\n const partial = getPartial?.(row) || 0;\n const total = getTotal?.(row);\n\n if (total) {\n return (\n <HvProgressColumnCell partial={partial} total={total} color={color} />\n );\n }\n\n return <>—</>;\n },\n\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n"],"names":["hvTextColumn","col","overflowTooltipProps","Cell","value","HvOverflowTooltip","data","hvStringFallback","sortType","hvNumberColumn","_Fragment","children","hvNumberFallback","align","hvDateColumn","dateFormat","HvDateColumnCell","date","sortDescFirst","hvExpandColumn","expandRowButtonAriaLabel","collapseRowButtonAriaLabel","getCanRowExpand","ExpandedIcon","DropUpXS","CollapsedIcon","_jsx","DropDownXS","cellProps","row","expandedProps","getToggleRowExpandedProps","hasContent","ClassNames","css","HvButton","icon","isExpanded","onClick","classes","root","position","left","top","transform","cellStyle","hvTagColumn","valueDataKey","colorDataKey","textColorDataKey","fromRowData","tagProps","name","color","textColor","original","HvTag","label","HvTypography","variant","type","style","tabIndex","paddingTop","paddingBottom","hvSwitchColumn","switchLabel","falseLabel","trueLabel","switchProps","HvSwitchColumnCell","checked","id","hvDropdownColumn","placeholder","disabledPlaceholder","onChange","column","dsbld","length","HvDropdownColumnCell","values","val","disabled","dropdownProps","setId","hvProgressColumn","getPartial","getTotal","partial","total","HvProgressColumnCell"],"mappings":";;;;;;;;;;;;;AA2BO,SAASA,aAIdC,KACAC,uBAA6D,IAClC;AACpB,SAAA;AAAA,IACLC,MAAMA,CAAC;AAAA,MAAEC;AAAAA,IAAAA,0BACNC,mBAAiB;AAAA,MAChBC,MAAMC,iBAAiBH,KAAK;AAAA,MAAE,GAC1BF;AAAAA,IAAAA,CACL;AAAA,IAEHM,UAAU;AAAA,IACV,GAAGP;AAAAA,EAAAA;AAEP;AAEO,SAASQ,eAGdR,KAA2D;AACpD,SAAA;AAAA,IACLE,MAAMA,CAAC;AAAA,MAAEC;AAAAA,IAAAA,0BAA+BM,UAAA;AAAA,MAAAC,UAAGC,iBAAiBR,KAAK;AAAA,IAAA,CAAI;AAAA,IACrES,OAAO;AAAA,IACPL,UAAU;AAAA,IACV,GAAGP;AAAAA,EAAAA;AAEP;AAEgBa,SAAAA,aAIdb,KACAc,YAC2B;AACpB,SAAA;AAAA,IACLZ,MAAMA,CAAC;AAAA,MAAEC;AAAAA,IAAAA,0BACNY,kBAAgB;AAAA,MAACC,MAAMb;AAAAA,MAAOW;AAAAA,IAAAA,CAAyB;AAAA,IAE1DP,UAAU;AAAA,IACVU,eAAe;AAAA,IACf,GAAGjB;AAAAA,EAAAA;AAEP;AAEO,SAASkB,eAIdlB,KACAmB,0BACAC,4BACAC,iBACAC,eAAiCC,oBAAAA,UAAU,CAAA,CAAA,GAC3CC,gBAAiCC,oBAACC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AAAA,QACRsE,aAAaI,QAAQH,sBAAsBD;AAAAA,QAC3CE,UAAWM,CAAAA,QAAQN,qCAAW/C,IAAI2C,IAAIU;AAAAA,QACtCC,UAAUL;AAAAA,QACVM,eAAe;AAAA,UACb,mBAAmBC,MAAMb,IAAIK,OAAOL,EAAE;AAAA,QACxC;AAAA,MAAA,CACD;AAAA,IAEL;AAAA,IACA3B,WAAW;AAAA,MACTkB,YAAY;AAAA,MACZC,eAAe;AAAA,IACjB;AAAA,IACA,GAAG/D;AAAAA,EAAAA;AAEP;AAEO,SAASqF,iBAIdrF,KACAsF,YACAC,UACAnC,OAC2B;AACpB,SAAA;AAAA,IACLlD,MAAMA,CAACyB,cAAiC;AAChC,YAAA;AAAA,QAAEC;AAAAA,MAAQD,IAAAA;AACV6D,YAAAA,WAAUF,yCAAa1D,SAAQ;AAC/B6D,YAAAA,QAAQF,qCAAW3D;AAEzB,UAAI6D,OAAO;AACT,mCACGC,sBAAoB;AAAA,UAACF;AAAAA,UAAkBC;AAAAA,UAAcrC;AAAAA,QAAAA,CAAe;AAAA,MAEzE;AAEA,iCAAO3C,UAAA;AAAA,QAAAC,UAAE;AAAA,MAAA,CAAG;AAAA,IACd;AAAA,IAEAkC,WAAW;AAAA,MACTkB,YAAY;AAAA,MACZC,eAAe;AAAA,IACjB;AAAA,IACA,GAAG/D;AAAAA,EAAAA;AAEP;"}
1
+ {"version":3,"file":"renderers.js","sources":["../../../../../src/components/Table/renderers/renderers.tsx"],"sourcesContent":["import { ClassNames } from \"@emotion/react\";\n\nimport { DropDownXS, DropUpXS } from \"@hitachivantara/uikit-react-icons\";\n\nimport { setId } from \"@core/utils/setId\";\nimport { HvTag, HvTagProps } from \"@core/components/Tag\";\nimport { HvButton } from \"@core/components/Button\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport {\n HvOverflowTooltip,\n HvOverflowTooltipProps,\n} from \"@core/components/OverflowTooltip\";\nimport { HvBaseSwitchProps } from \"@core/components/BaseSwitch\";\nimport { HvListValue } from \"@core/components/List\";\n\nimport {\n HvTableHeaderRenderer,\n HvCellProps,\n HvTableColumnConfig,\n HvRowInstance,\n} from \"../hooks/useTable\";\nimport { HvDateColumnCell } from \"./DateColumnCell\";\nimport { HvSwitchColumnCell } from \"./SwitchColumnCell\";\nimport { HvProgressColumnCell } from \"./ProgressColumnCell\";\nimport { HvDropdownColumnCell } from \"./DropdownColumnCell\";\nimport { hvStringFallback, hvNumberFallback } from \"../utils\";\n\nexport function hvTextColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(\n col: HvTableColumnConfig<D, H>,\n overflowTooltipProps: Omit<HvOverflowTooltipProps, \"data\"> = {}\n): HvTableColumnConfig<D, H> {\n return {\n Cell: ({ value }: HvCellProps<D, H>) => (\n <HvOverflowTooltip\n data={hvStringFallback(value)}\n {...overflowTooltipProps}\n />\n ),\n sortType: \"alphanumeric\",\n ...col,\n };\n}\n\nexport function hvNumberColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(col: HvTableColumnConfig<D, H>): HvTableColumnConfig<D, H> {\n return {\n Cell: ({ value }: HvCellProps<D, H>) => <>{hvNumberFallback(value)}</>,\n align: \"right\",\n sortType: \"number\",\n ...col,\n };\n}\n\nexport function hvDateColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(\n col: HvTableColumnConfig<D, H>,\n dateFormat?: string\n): HvTableColumnConfig<D, H> {\n return {\n Cell: ({ value }: HvCellProps<D, H>) => (\n <HvDateColumnCell date={value} dateFormat={dateFormat} />\n ),\n sortType: \"alphanumeric\",\n sortDescFirst: true,\n ...col,\n };\n}\n\nexport function hvExpandColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(\n col: HvTableColumnConfig<D, H>,\n expandRowButtonAriaLabel: string,\n collapseRowButtonAriaLabel: string,\n getCanRowExpand?: (row: HvRowInstance<D, H>) => boolean,\n ExpandedIcon: React.ReactNode = <DropUpXS />,\n CollapsedIcon: React.ReactNode = <DropDownXS />\n): HvTableColumnConfig<D, H> {\n return {\n Cell: (cellProps: HvCellProps<D, H>) => {\n const { value, row } = cellProps;\n const expandedProps = row.getToggleRowExpandedProps?.();\n\n const hasContent = getCanRowExpand?.(row) ?? true;\n\n return (\n <ClassNames>\n {({ css }) => (\n <>\n {hasContent && (\n <HvButton\n icon\n aria-label={\n row.isExpanded\n ? collapseRowButtonAriaLabel\n : expandRowButtonAriaLabel\n }\n aria-expanded={row.isExpanded}\n onClick={expandedProps?.onClick}\n classes={{\n root: css({\n position: \"absolute\",\n left: 0,\n top: \"50%\",\n transform: \"translateY(-50%)\",\n }),\n }}\n >\n {row.isExpanded ? ExpandedIcon : CollapsedIcon}\n </HvButton>\n )}\n\n <HvOverflowTooltip data={hvStringFallback(value)} />\n </>\n )}\n </ClassNames>\n );\n },\n sortType: \"alphanumeric\",\n cellStyle: {\n position: \"relative\",\n },\n ...col,\n };\n}\n\nexport function hvTagColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer,\n A extends object = Record<string, unknown>\n>(\n col: HvTableColumnConfig<D, H>,\n valueDataKey: keyof A,\n colorDataKey: keyof A,\n textColorDataKey: keyof A,\n fromRowData: boolean = false,\n tagProps?: HvTagProps\n): HvTableColumnConfig<D, H> {\n return {\n Cell: (cellProps: HvCellProps<D, H>) => {\n const { value, row } = cellProps;\n if (!value) {\n return <>—</>;\n }\n\n const {\n [valueDataKey]: name,\n [colorDataKey]: color,\n [textColorDataKey]: textColor,\n } = fromRowData ? row.original : value;\n\n return (\n <HvTag\n label={<HvTypography variant=\"body\">{name}</HvTypography>}\n type=\"semantic\"\n color={color}\n style={textColor != null ? { color: textColor } : {}}\n tabIndex={-1}\n {...tagProps}\n />\n );\n },\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n\n// TODO - Review accessibility on the next renderers because they all differ\n\nexport function hvSwitchColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(\n col: HvTableColumnConfig<D, H>,\n switchLabel: string,\n falseLabel?: string,\n trueLabel?: string,\n switchProps?: HvBaseSwitchProps\n): HvTableColumnConfig<D, H> {\n return {\n Cell: (cellProps: HvCellProps<D, H>) => {\n const { value, row } = cellProps;\n return (\n <HvSwitchColumnCell\n checked={value}\n value={row.id}\n switchLabel={switchLabel}\n falseLabel={falseLabel}\n trueLabel={trueLabel}\n switchProps={switchProps}\n />\n );\n },\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n\nexport function hvDropdownColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(\n col: HvTableColumnConfig<D, H>,\n id: string | undefined,\n placeholder: string,\n disabledPlaceholder: string,\n onChange?: (identifier: string, value: HvListValue) => void\n): HvTableColumnConfig<D, H> {\n return {\n Cell: (cellProps: HvCellProps<D, H>) => {\n const { value, row, column } = cellProps;\n const dsbld = value.length < 1;\n return (\n <HvDropdownColumnCell\n values={value}\n placeholder={dsbld ? disabledPlaceholder : placeholder}\n onChange={(val) => onChange?.(row.id, val)}\n disabled={dsbld}\n dropdownProps={{\n \"aria-labelledby\": setId(id, column.id) || column.id || id, // TODO - to be reviewed because it doesn't make much sense\n }}\n />\n );\n },\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n\nexport function hvProgressColumn<\n D extends object = Record<string, unknown>,\n H extends HvTableHeaderRenderer | undefined = HvTableHeaderRenderer\n>(\n col: HvTableColumnConfig<D, H>,\n getPartial?: (row: HvRowInstance<D, H>) => number,\n getTotal?: (row: HvRowInstance<D, H>) => number,\n color?: \"primary\" | \"secondary\"\n): HvTableColumnConfig<D, H> {\n return {\n Cell: (cellProps: HvCellProps<D, H>) => {\n const { row, column } = cellProps;\n const partial = getPartial?.(row) || 0;\n const total = getTotal?.(row);\n\n if (total) {\n return (\n <HvProgressColumnCell\n partial={partial}\n total={total}\n color={color}\n aria-labelledby={column.id}\n />\n );\n }\n\n return <>—</>;\n },\n\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n"],"names":["hvTextColumn","col","overflowTooltipProps","Cell","value","HvOverflowTooltip","data","hvStringFallback","sortType","hvNumberColumn","_Fragment","children","hvNumberFallback","align","hvDateColumn","dateFormat","HvDateColumnCell","date","sortDescFirst","hvExpandColumn","expandRowButtonAriaLabel","collapseRowButtonAriaLabel","getCanRowExpand","ExpandedIcon","DropUpXS","CollapsedIcon","_jsx","DropDownXS","cellProps","row","expandedProps","getToggleRowExpandedProps","hasContent","ClassNames","css","HvButton","icon","isExpanded","onClick","classes","root","position","left","top","transform","cellStyle","hvTagColumn","valueDataKey","colorDataKey","textColorDataKey","fromRowData","tagProps","name","color","textColor","original","HvTag","label","HvTypography","variant","type","style","tabIndex","paddingTop","paddingBottom","hvSwitchColumn","switchLabel","falseLabel","trueLabel","switchProps","HvSwitchColumnCell","checked","id","hvDropdownColumn","placeholder","disabledPlaceholder","onChange","column","dsbld","length","HvDropdownColumnCell","values","val","disabled","dropdownProps","setId","hvProgressColumn","getPartial","getTotal","partial","total","HvProgressColumnCell"],"mappings":";;;;;;;;;;;;;AA2BO,SAASA,aAIdC,KACAC,uBAA6D,IAClC;AACpB,SAAA;AAAA,IACLC,MAAMA,CAAC;AAAA,MAAEC;AAAAA,IAAAA,0BACNC,mBAAiB;AAAA,MAChBC,MAAMC,iBAAiBH,KAAK;AAAA,MAAE,GAC1BF;AAAAA,IAAAA,CACL;AAAA,IAEHM,UAAU;AAAA,IACV,GAAGP;AAAAA,EAAAA;AAEP;AAEO,SAASQ,eAGdR,KAA2D;AACpD,SAAA;AAAA,IACLE,MAAMA,CAAC;AAAA,MAAEC;AAAAA,IAAA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AAAA,CACzB;AAAA,MAEL;AAEA,iCAAO9D,UAAA;AAAA,QAAAC,UAAE;AAAA,MAAA,CAAG;AAAA,IACd;AAAA,IAEAkC,WAAW;AAAA,MACTkB,YAAY;AAAA,MACZC,eAAe;AAAA,IACjB;AAAA,IACA,GAAG/D;AAAAA,EAAAA;AAEP;"}
@@ -22,7 +22,6 @@ const getColor = (customColor, type, colors) => {
22
22
  return backgroundColor;
23
23
  };
24
24
  const HvTag = (props) => {
25
- var _a;
26
25
  const {
27
26
  classes: classesProp,
28
27
  className,
@@ -40,8 +39,7 @@ const HvTag = (props) => {
40
39
  ...others
41
40
  } = useDefaultProps("HvTag", props);
42
41
  const {
43
- activeTheme,
44
- selectedMode
42
+ colors
45
43
  } = useTheme();
46
44
  const {
47
45
  classes,
@@ -82,11 +80,10 @@ const HvTag = (props) => {
82
80
  const inlineStyle = {
83
81
  ...style
84
82
  };
85
- let categoricalBackgroundColor;
83
+ const categoricalBackgroundColor = type === "categorical" ? getColor(color, type, colors) : void 0;
86
84
  if (type === "semantic") {
87
85
  inlineStyle.backgroundColor = getColor(color, type, {});
88
86
  } else if (type === "categorical") {
89
- categoricalBackgroundColor = getColor(color, type, (_a = activeTheme == null ? void 0 : activeTheme.colors) == null ? void 0 : _a.modes[selectedMode]);
90
87
  inlineStyle.backgroundColor = `${categoricalBackgroundColor}30`;
91
88
  }
92
89
  const [hover, setHover] = useState(false);