@hitachivantara/uikit-react-core 5.26.6 → 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 (58) 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/BulkActions/BulkActions.cjs +2 -3
  4. package/dist/cjs/components/BulkActions/BulkActions.cjs.map +1 -1
  5. package/dist/cjs/components/Dialog/Dialog.cjs +2 -4
  6. package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -1
  7. package/dist/cjs/components/Drawer/Drawer.cjs +2 -1
  8. package/dist/cjs/components/Drawer/Drawer.cjs.map +1 -1
  9. package/dist/cjs/components/ScrollTo/Horizontal/ScrollToHorizontal.cjs +2 -2
  10. package/dist/cjs/components/ScrollTo/Horizontal/ScrollToHorizontal.cjs.map +1 -1
  11. package/dist/cjs/components/ScrollTo/Vertical/ScrollToVertical.cjs +2 -2
  12. package/dist/cjs/components/ScrollTo/Vertical/ScrollToVertical.cjs.map +1 -1
  13. package/dist/cjs/components/Table/TableCell/TableCell.cjs +2 -2
  14. package/dist/cjs/components/Table/TableCell/TableCell.cjs.map +1 -1
  15. package/dist/cjs/components/Table/TableHeader/TableHeader.cjs +6 -4
  16. package/dist/cjs/components/Table/TableHeader/TableHeader.cjs.map +1 -1
  17. package/dist/cjs/components/Table/TableRow/TableRow.cjs +3 -4
  18. package/dist/cjs/components/Table/TableRow/TableRow.cjs.map +1 -1
  19. package/dist/cjs/components/Table/renderers/ProgressColumnCell/ProgressColumnCell.cjs +4 -2
  20. package/dist/cjs/components/Table/renderers/ProgressColumnCell/ProgressColumnCell.cjs.map +1 -1
  21. package/dist/cjs/components/Table/renderers/SwitchColumnCell/SwitchColumnCell.cjs +5 -2
  22. package/dist/cjs/components/Table/renderers/SwitchColumnCell/SwitchColumnCell.cjs.map +1 -1
  23. package/dist/cjs/components/Table/renderers/renderers.cjs +6 -3
  24. package/dist/cjs/components/Table/renderers/renderers.cjs.map +1 -1
  25. package/dist/cjs/components/Tag/Tag.cjs +2 -4
  26. package/dist/cjs/components/Tag/Tag.cjs.map +1 -1
  27. package/dist/cjs/hooks/useTheme.cjs +12 -1
  28. package/dist/cjs/hooks/useTheme.cjs.map +1 -1
  29. package/dist/esm/components/ActionsGeneric/ActionsGeneric.js +2 -4
  30. package/dist/esm/components/ActionsGeneric/ActionsGeneric.js.map +1 -1
  31. package/dist/esm/components/BulkActions/BulkActions.js +2 -3
  32. package/dist/esm/components/BulkActions/BulkActions.js.map +1 -1
  33. package/dist/esm/components/Dialog/Dialog.js +2 -4
  34. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  35. package/dist/esm/components/Drawer/Drawer.js +2 -1
  36. package/dist/esm/components/Drawer/Drawer.js.map +1 -1
  37. package/dist/esm/components/ScrollTo/Horizontal/ScrollToHorizontal.js +2 -2
  38. package/dist/esm/components/ScrollTo/Horizontal/ScrollToHorizontal.js.map +1 -1
  39. package/dist/esm/components/ScrollTo/Vertical/ScrollToVertical.js +2 -2
  40. package/dist/esm/components/ScrollTo/Vertical/ScrollToVertical.js.map +1 -1
  41. package/dist/esm/components/Table/TableCell/TableCell.js +2 -2
  42. package/dist/esm/components/Table/TableCell/TableCell.js.map +1 -1
  43. package/dist/esm/components/Table/TableHeader/TableHeader.js +6 -4
  44. package/dist/esm/components/Table/TableHeader/TableHeader.js.map +1 -1
  45. package/dist/esm/components/Table/TableRow/TableRow.js +3 -4
  46. package/dist/esm/components/Table/TableRow/TableRow.js.map +1 -1
  47. package/dist/esm/components/Table/renderers/ProgressColumnCell/ProgressColumnCell.js +4 -2
  48. package/dist/esm/components/Table/renderers/ProgressColumnCell/ProgressColumnCell.js.map +1 -1
  49. package/dist/esm/components/Table/renderers/SwitchColumnCell/SwitchColumnCell.js +5 -2
  50. package/dist/esm/components/Table/renderers/SwitchColumnCell/SwitchColumnCell.js.map +1 -1
  51. package/dist/esm/components/Table/renderers/renderers.js +6 -3
  52. package/dist/esm/components/Table/renderers/renderers.js.map +1 -1
  53. package/dist/esm/components/Tag/Tag.js +2 -4
  54. package/dist/esm/components/Tag/Tag.js.map +1 -1
  55. package/dist/esm/hooks/useTheme.js +13 -2
  56. package/dist/esm/hooks/useTheme.js.map +1 -1
  57. package/dist/types/index.d.ts +9 -3
  58. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sources":["../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport MuiDialog, { DialogProps as MuiDialogProps } from \"@mui/material/Dialog\";\nimport MuiBackdrop from \"@mui/material/Backdrop\";\n\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvButton } from \"@core/components/Button\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { setId } from \"@core/utils/setId\";\nimport { withTooltip } from \"@core/hocs/withTooltip\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\n\nimport { staticClasses, useClasses } from \"./Dialog.styles\";\n\nexport { staticClasses as dialogClasses };\n\nexport type HvDialogClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDialogProps\n extends Omit<MuiDialogProps, \"fullScreen\" | \"classes\" | \"open\">,\n HvBaseProps {\n /** Id to be applied to the root node. */\n id?: string;\n /** Current state of the Dialog. */\n open?: boolean;\n /** Function executed on close. */\n onClose?: (\n event: React.SyntheticEvent,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => void;\n /** @inheritdoc */\n maxWidth?: MuiDialogProps[\"maxWidth\"];\n /** @inheritdoc */\n fullWidth?: MuiDialogProps[\"fullWidth\"];\n /**\n * Element id that should be focus when the Dialog opens.\n * Auto-focusing elements can cause usability issues, so this should be avoided.\n * @deprecated Use `autoFocus` on the element instead, if auto-focusing is required.\n */\n firstFocusable?: string;\n /** Title for the button close. */\n buttonTitle?: string;\n /** Set the dialog to fullscreen mode. */\n fullscreen?: boolean;\n /** Prevent closing the dialog when clicking on the backdrop. */\n disableBackdropClick?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDialogClasses;\n /** Variant of the dialog. Adds a status bar to the top of the dialog. If not provided, no status bar is added. */\n variant?: \"success\" | \"error\" | \"warning\";\n}\n\nexport const HvDialog = (props: HvDialogProps) => {\n const {\n variant,\n classes: classesProp,\n className,\n id,\n children,\n open = false,\n onClose,\n firstFocusable,\n buttonTitle = \"Close\",\n fullscreen = false,\n disableBackdropClick = false,\n ...others\n } = useDefaultProps(\"HvDialog\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n delete (others as any).fullScreen;\n\n const { rootId, activeTheme, selectedMode } = useTheme();\n\n // Because the `disableBackdropClick` property was deprecated in MUI5\n // and we want to maintain that functionality to the user we're wrapping\n // the onClose call here to make that check.\n const wrappedClose = useCallback(\n (\n event: any,\n bypassValidation: boolean = false,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => {\n if (bypassValidation || !disableBackdropClick) {\n onClose?.(event, reason);\n }\n },\n [onClose, disableBackdropClick]\n );\n\n const measuredRef = useCallback(() => {\n if (!firstFocusable) return;\n\n const element = document.getElementById(firstFocusable);\n element?.focus();\n }, [firstFocusable]);\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n const slots = useMemo<MuiDialogProps[\"slots\"]>(\n () => ({\n backdrop: (backdropProps) => (\n <MuiBackdrop open={open} onClick={wrappedClose} {...backdropProps} />\n ),\n }),\n [open, wrappedClose]\n );\n\n return (\n <MuiDialog\n container={\n typeof window !== \"undefined\"\n ? // TODO: review\n // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc\n document.getElementById(rootId || \"\") || document.body\n : undefined\n }\n className={cx(classes.root, className)}\n classes={{ container: css({ position: \"relative\" }) }}\n id={id}\n ref={measuredRef}\n open={open}\n fullScreen={fullscreen}\n onClose={(event, reason) => wrappedClose(event, undefined, reason)}\n slots={slots}\n slotProps={{\n backdrop: {\n classes: {\n root: cx(\n css({\n background: hexToRgbA(\n activeTheme?.colors?.modes[selectedMode].atmo4 ||\n theme.colors.atmo4,\n 0.8\n ),\n }),\n classes.background\n ),\n },\n },\n }}\n PaperProps={{\n classes: {\n root: cx(\n css({ position: \"absolute\" }),\n classes.paper,\n variant && cx(classes.statusBar, classes[variant]),\n {\n [classes.fullscreen]: fullscreen,\n }\n ),\n },\n }}\n aria-modal\n {...others}\n >\n <HvButton\n id={setId(id, \"close\")}\n className={classes.closeButton}\n variant=\"secondaryGhost\"\n onClick={(event) => wrappedClose(event, true, undefined)}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </HvButton>\n {children && typeof children === \"object\"\n ? React.Children.map(\n children,\n (c: React.ReactNode) =>\n c && React.cloneElement(c as React.ReactElement, { fullscreen })\n )\n : children}\n </MuiDialog>\n );\n};\n"],"names":["HvDialog","props","variant","classes","classesProp","className","id","children","open","onClose","firstFocusable","buttonTitle","fullscreen","disableBackdropClick","others","useDefaultProps","css","cx","useClasses","fullScreen","rootId","activeTheme","selectedMode","useTheme","wrappedClose","useCallback","event","bypassValidation","reason","measuredRef","element","document","getElementById","focus","closeButtonDisplay","_jsx","Close","role","CloseButtonTooltipWrapper","withTooltip","slots","useMemo","backdrop","backdropProps","MuiBackdrop","onClick","MuiDialog","container","window","body","undefined","root","position","ref","slotProps","background","hexToRgbA","colors","modes","atmo4","theme","PaperProps","paper","statusBar","HvButton","setId","closeButton","React","Children","map","c","cloneElement"],"mappings":";;;;;;;;;;;;;;AAyDaA,MAAAA,WAAWA,CAACC,UAAyB;;AAC1C,QAA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4D,eAAMC,SAASC,IACb9D,UACA,CAAC+D,MACCA,KAAKH,eAAMI,aAAaD,GAAyB;AAAA,MAAE1D;AAAAA,IAAAA,CAAY,CACnE,IACAL,QAAQ;AAAA,EAAA,CACH;AAEf;"}
1
+ {"version":3,"file":"Dialog.js","sources":["../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport MuiDialog, { DialogProps as MuiDialogProps } from \"@mui/material/Dialog\";\nimport MuiBackdrop from \"@mui/material/Backdrop\";\n\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvButton } from \"@core/components/Button\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { setId } from \"@core/utils/setId\";\nimport { withTooltip } from \"@core/hocs/withTooltip\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\n\nimport { staticClasses, useClasses } from \"./Dialog.styles\";\n\nexport { staticClasses as dialogClasses };\n\nexport type HvDialogClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDialogProps\n extends Omit<MuiDialogProps, \"fullScreen\" | \"classes\" | \"open\">,\n HvBaseProps {\n /** Id to be applied to the root node. */\n id?: string;\n /** Current state of the Dialog. */\n open?: boolean;\n /** Function executed on close. */\n onClose?: (\n event: React.SyntheticEvent,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => void;\n /** @inheritdoc */\n maxWidth?: MuiDialogProps[\"maxWidth\"];\n /** @inheritdoc */\n fullWidth?: MuiDialogProps[\"fullWidth\"];\n /**\n * Element id that should be focus when the Dialog opens.\n * Auto-focusing elements can cause usability issues, so this should be avoided.\n * @deprecated Use `autoFocus` on the element instead, if auto-focusing is required.\n */\n firstFocusable?: string;\n /** Title for the button close. */\n buttonTitle?: string;\n /** Set the dialog to fullscreen mode. */\n fullscreen?: boolean;\n /** Prevent closing the dialog when clicking on the backdrop. */\n disableBackdropClick?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDialogClasses;\n /** Variant of the dialog. Adds a status bar to the top of the dialog. If not provided, no status bar is added. */\n variant?: \"success\" | \"error\" | \"warning\";\n}\n\nexport const HvDialog = (props: HvDialogProps) => {\n const {\n variant,\n classes: classesProp,\n className,\n id,\n children,\n open = false,\n onClose,\n firstFocusable,\n buttonTitle = \"Close\",\n fullscreen = false,\n disableBackdropClick = false,\n ...others\n } = useDefaultProps(\"HvDialog\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n delete (others as any).fullScreen;\n\n const { rootId, colors } = useTheme();\n\n // Because the `disableBackdropClick` property was deprecated in MUI5\n // and we want to maintain that functionality to the user we're wrapping\n // the onClose call here to make that check.\n const wrappedClose = useCallback(\n (\n event: any,\n bypassValidation: boolean = false,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => {\n if (bypassValidation || !disableBackdropClick) {\n onClose?.(event, reason);\n }\n },\n [onClose, disableBackdropClick]\n );\n\n const measuredRef = useCallback(() => {\n if (!firstFocusable) return;\n\n const element = document.getElementById(firstFocusable);\n element?.focus();\n }, [firstFocusable]);\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n const slots = useMemo<MuiDialogProps[\"slots\"]>(\n () => ({\n backdrop: (backdropProps) => (\n <MuiBackdrop open={open} onClick={wrappedClose} {...backdropProps} />\n ),\n }),\n [open, wrappedClose]\n );\n\n return (\n <MuiDialog\n container={\n typeof window !== \"undefined\"\n ? // TODO: review\n // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc\n document.getElementById(rootId || \"\") || document.body\n : undefined\n }\n className={cx(classes.root, className)}\n classes={{ container: css({ position: \"relative\" }) }}\n id={id}\n ref={measuredRef}\n open={open}\n fullScreen={fullscreen}\n onClose={(event, reason) => wrappedClose(event, undefined, reason)}\n slots={slots}\n slotProps={{\n backdrop: {\n classes: {\n root: cx(\n css({\n background: hexToRgbA(colors?.atmo4 || theme.colors.atmo4, 0.8),\n }),\n classes.background\n ),\n },\n },\n }}\n PaperProps={{\n classes: {\n root: cx(\n css({ position: \"absolute\" }),\n classes.paper,\n variant && cx(classes.statusBar, classes[variant]),\n {\n [classes.fullscreen]: fullscreen,\n }\n ),\n },\n }}\n aria-modal\n {...others}\n >\n <HvButton\n id={setId(id, \"close\")}\n className={classes.closeButton}\n variant=\"secondaryGhost\"\n onClick={(event) => wrappedClose(event, true, undefined)}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </HvButton>\n {children && typeof children === \"object\"\n ? React.Children.map(\n children,\n (c: React.ReactNode) =>\n c && React.cloneElement(c as React.ReactElement, { fullscreen })\n )\n : children}\n </MuiDialog>\n );\n};\n"],"names":["HvDialog","props","variant","classes","classesProp","className","id","children","open","onClose","firstFocusable","buttonTitle","fullscreen","disableBackdropClick","others","useDefaultProps","css","cx","useClasses","fullScreen","rootId","colors","useTheme","wrappedClose","useCallback","event","bypassValidation","reason","measuredRef","element","document","getElementById","focus","closeButtonDisplay","_jsx","Close","role","CloseButtonTooltipWrapper","withTooltip","slots","useMemo","backdrop","backdropProps","MuiBackdrop","onClick","MuiDialog","container","window","body","undefined","root","position","ref","slotProps","background","hexToRgbA","atmo4","theme","PaperProps","paper","statusBar","HvButton","setId","closeButton","React","Children","map","c","cloneElement"],"mappings":";;;;;;;;;;;;;;AAyDaA,MAAAA,WAAWA,CAACC,UAAyB;AAC1C,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,OAAO;AAAA,IACPC;AAAAA,IACAC;AAAAA,IACAC,cAAc;AAAA,IACdC,aAAa;AAAA,IACbC,uBAAuB;AAAA,IACvB,G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
37
38
  activeTheme,
38
39
  rootId
39
40
  } = useTheme();
@@ -46,7 +47,7 @@ const HvDrawer = (props) => {
46
47
  useEffect(() => {
47
48
  setBackgroundColorValue(getVarValue(theme.drawer.backDropBackgroundColor, rootId) || (activeTheme == null ? void 0 : activeTheme.drawer.backDropBackgroundColor) || "");
48
49
  setBackgroundColor(getBackgroundColor(backgroundColorValue));
49
- }, [activeTheme == null ? void 0 : activeTheme.colors.modes.selectedMode, backgroundColorValue, setBackgroundColor, rootId, activeTheme == null ? void 0 : activeTheme.drawer.backDropBackgroundColor]);
50
+ }, [colors, backgroundColorValue, setBackgroundColor, rootId, activeTheme == null ? void 0 : activeTheme.drawer.backDropBackgroundColor]);
50
51
  return /* @__PURE__ */ jsxs(Drawer, {
51
52
  className: cx(classes.root, className),
52
53
  id,
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport {\n Drawer as MuiDrawer,\n DrawerProps as MuiDrawerProps,\n} from \"@mui/material\";\n\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { withTooltip } from \"@core/hocs/withTooltip\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\nimport { setId } from \"@core/utils/setId\";\nimport { checkValidHexColorValue } from \"@core/utils/checkValidHexColorValue\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { getVarValue } from \"@core/utils/theme\";\nimport { HvButton } from \"@core/components/Button\";\nimport { useTheme } from \"@core/hooks/useTheme\";\n\nimport { staticClasses, useClasses } from \"./Drawer.styles\";\n\nexport { staticClasses as drawerClasses };\n\nexport type HvDrawerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDrawerProps\n extends MuiDrawerProps,\n Omit<MuiDrawerProps, \"classes\">,\n HvBaseProps<HTMLDivElement> {\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes?: HvDrawerClasses;\n /**\n * Components of the Drawer.\n */\n children?: React.ReactNode;\n /**\n * Current state of the Drawer.\n */\n open?: boolean;\n /**\n * Function executed on close.\n * Extended from Modal from material-ui\n *\n */\n onClose?: (\n event: React.SyntheticEvent,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => void;\n /**\n * The side the drawer opens from.\n */\n anchor?: \"left\" | \"top\" | \"right\" | \"bottom\";\n /**\n * Title for the button close.\n */\n buttonTitle?: string;\n}\n\nconst getBackgroundColor = (color: string) => {\n return checkValidHexColorValue(color) ? hexToRgbA(color, 0.8) : color;\n};\n\n/**\n * The Drawer component provides a foundation to create a sliding pane.\n * It only provides the pane with a close button, the rest of the\n * content can be customized.\n */\nexport const HvDrawer = (props: HvDrawerProps) => {\n const {\n className,\n classes: classesProp,\n id,\n children,\n open,\n onClose,\n anchor = \"right\",\n buttonTitle = \"Close\",\n ...others\n } = useDefaultProps(\"HvDrawer\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme, rootId } = useTheme();\n\n const [backgroundColorValue, setBackgroundColorValue] = useState<string>(\n getVarValue(theme.drawer.backDropBackgroundColor, rootId) || \"\"\n );\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n const [backgroundColor, setBackgroundColor] = useState(\n getBackgroundColor(backgroundColorValue)\n );\n\n useEffect(() => {\n setBackgroundColorValue(\n getVarValue(theme.drawer.backDropBackgroundColor, rootId) ||\n activeTheme?.drawer.backDropBackgroundColor ||\n \"\"\n );\n\n setBackgroundColor(getBackgroundColor(backgroundColorValue));\n }, [\n activeTheme?.colors.modes.selectedMode,\n backgroundColorValue,\n setBackgroundColor,\n rootId,\n activeTheme?.drawer.backDropBackgroundColor,\n ]);\n\n return (\n <MuiDrawer\n className={cx(classes.root, className)}\n id={id}\n anchor={anchor}\n open={open}\n PaperProps={{\n classes: {\n root: classes.paper,\n },\n }}\n BackdropProps={{\n classes: {\n root: cx(css({ backgroundColor }), classes.background),\n },\n }}\n onClose={onClose}\n {...others}\n >\n <HvButton\n id={setId(id, \"close\")}\n className={classes.closeButton}\n variant=\"secondaryGhost\"\n onClick={onClose}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </HvButton>\n {children}\n </MuiDrawer>\n );\n};\n"],"names":["getBackgroundColor","color","checkValidHexColorValue","hexToRgbA","HvDrawer","props","className","classes","classesProp","id","children","open","onClose","anchor","buttonTitle","others","useDefaultProps","css","cx","useClasses","activeTheme","rootId","useTheme","backgroundColorValue","setBackgroundColorValue","useState","getVarValue","theme","drawer","backDropBackgroundColor","closeButtonDisplay","_jsx","Close","role","CloseButtonTooltipWrapper","withTooltip","backgroundColor","setBackgroundColor","useEffect","colors","modes","selectedMode","MuiDrawer","root","PaperProps","paper","BackdropProps","background","HvButton","setId","closeButton","variant","onClick"],"mappings":";;;;;;;;;;;;;;;AAsEA,MAAMA,qBAAqBA,CAACC,UAAkB;AAC5C,SAAOC,wBAAwBD,KAAK,IAAIE,UAAUF,OAAO,GAAG,IAAIA;AAClE;AAOaG,MAAAA,WAAWA,CAACC,UAAyB;AAC1C,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,SAAS;AAAA,IACTC,cAAc;AAAA,IACd,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,YAAYX,KAAK;AAE/B,QAAA;AAAA,IAAEE;AAAAA,IAASU;AAAAA,IAAKC;AAAAA,EAAAA,IAAOC,WAAWX,WAAW;AAC7C,QAAA;AAAA,IAAEY;AAAAA,IAAaC;AAAAA,MAAWC,SAA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AA,GACTxB,QAAQ;AAAA,EAAA,CACA;AAEf;"}
1
+ {"version":3,"file":"Drawer.js","sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport {\n Drawer as MuiDrawer,\n DrawerProps as MuiDrawerProps,\n} from \"@mui/material\";\n\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { withTooltip } from \"@core/hocs/withTooltip\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\nimport { setId } from \"@core/utils/setId\";\nimport { checkValidHexColorValue } from \"@core/utils/checkValidHexColorValue\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { getVarValue } from \"@core/utils/theme\";\nimport { HvButton } from \"@core/components/Button\";\nimport { useTheme } from \"@core/hooks/useTheme\";\n\nimport { staticClasses, useClasses } from \"./Drawer.styles\";\n\nexport { staticClasses as drawerClasses };\n\nexport type HvDrawerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDrawerProps\n extends MuiDrawerProps,\n Omit<MuiDrawerProps, \"classes\">,\n HvBaseProps<HTMLDivElement> {\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes?: HvDrawerClasses;\n /**\n * Components of the Drawer.\n */\n children?: React.ReactNode;\n /**\n * Current state of the Drawer.\n */\n open?: boolean;\n /**\n * Function executed on close.\n * Extended from Modal from material-ui\n *\n */\n onClose?: (\n event: React.SyntheticEvent,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => void;\n /**\n * The side the drawer opens from.\n */\n anchor?: \"left\" | \"top\" | \"right\" | \"bottom\";\n /**\n * Title for the button close.\n */\n buttonTitle?: string;\n}\n\nconst getBackgroundColor = (color: string) => {\n return checkValidHexColorValue(color) ? hexToRgbA(color, 0.8) : color;\n};\n\n/**\n * The Drawer component provides a foundation to create a sliding pane.\n * It only provides the pane with a close button, the rest of the\n * content can be customized.\n */\nexport const HvDrawer = (props: HvDrawerProps) => {\n const {\n className,\n classes: classesProp,\n id,\n children,\n open,\n onClose,\n anchor = \"right\",\n buttonTitle = \"Close\",\n ...others\n } = useDefaultProps(\"HvDrawer\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n const { colors, activeTheme, rootId } = useTheme();\n\n const [backgroundColorValue, setBackgroundColorValue] = useState<string>(\n getVarValue(theme.drawer.backDropBackgroundColor, rootId) || \"\"\n );\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n const [backgroundColor, setBackgroundColor] = useState(\n getBackgroundColor(backgroundColorValue)\n );\n\n useEffect(() => {\n setBackgroundColorValue(\n getVarValue(theme.drawer.backDropBackgroundColor, rootId) ||\n activeTheme?.drawer.backDropBackgroundColor ||\n \"\"\n );\n\n setBackgroundColor(getBackgroundColor(backgroundColorValue));\n }, [\n colors,\n backgroundColorValue,\n setBackgroundColor,\n rootId,\n activeTheme?.drawer.backDropBackgroundColor,\n ]);\n\n return (\n <MuiDrawer\n className={cx(classes.root, className)}\n id={id}\n anchor={anchor}\n open={open}\n PaperProps={{\n classes: {\n root: classes.paper,\n },\n }}\n BackdropProps={{\n classes: {\n root: cx(css({ backgroundColor }), classes.background),\n },\n }}\n onClose={onClose}\n {...others}\n >\n <HvButton\n id={setId(id, \"close\")}\n className={classes.closeButton}\n variant=\"secondaryGhost\"\n onClick={onClose}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </HvButton>\n {children}\n </MuiDrawer>\n );\n};\n"],"names":["getBackgroundColor","color","checkValidHexColorValue","hexToRgbA","HvDrawer","props","className","classes","classesProp","id","children","open","onClose","anchor","buttonTitle","others","useDefaultProps","css","cx","useClasses","colors","activeTheme","rootId","useTheme","backgroundColorValue","setBackgroundColorValue","useState","getVarValue","theme","drawer","backDropBackgroundColor","closeButtonDisplay","_jsx","Close","role","CloseButtonTooltipWrapper","withTooltip","backgroundColor","setBackgroundColor","useEffect","MuiDrawer","root","PaperProps","paper","BackdropProps","background","HvButton","setId","closeButton","variant","onClick"],"mappings":";;;;;;;;;;;;;;;AAsEA,MAAMA,qBAAqBA,CAACC,UAAkB;AAC5C,SAAOC,wBAAwBD,KAAK,IAAIE,UAAUF,OAAO,GAAG,IAAIA;AAClE;AAOaG,MAAAA,WAAWA,CAACC,UAAyB;AAC1C,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,SAAS;AAAA,IACTC,cAAc;AAAA,IACd,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,YAAYX,KAAK;AAE/B,QAAA;AAAA,IAAEE;AAAAA,IAASU;AAAAA,IAAKC;AAAAA,EAAAA,IAAOC,WAAWX,WAAW;AAC7C,QAAA;AAAA,IAAEY;AAAAA,IAAQC;AAAAA,IAAaC;AAAAA,MAAWC,SAAS;AAE3C,QAAA,CAACC,sBAAsBC,uBAAuB,IAAIC,SACtDC,YAAYC,MAAMC,OAAOC,yBAAyBR,MAAM,KAAK,EAC/D;AAEMS,QAAAA,qBAAqBA,MAAMC,oBAACC,OAAK;AAAA,IAACC,MAAK;AAAA,EAAA,CAAgB;AAE7D,QAAMC,4BAA4BrB,cAC9BsB,YAAYL,oBAAoBjB,aAAa,KAAK,IAClDiB;AAEJ,QAAM,CAACM,iBAAiBC,kBAAkB,IAAIZ,SAC5C1B,mBAAmBwB,oBAAoB,CACzC;AAEAe,YAAU,MAAM;AAEZZ,4BAAAA,YAAYC,MAAMC,OAAOC,yBAAyBR,MAAM,MACtDD,2CAAaQ,OAAOC,4BACpB,EACJ;AAEmB9B,uBAAAA,mBAAmBwB,oBAAoB,CAAC;AAAA,EAAA,GAC1D,CACDJ,QACAI,sBACAc,oBACAhB,QACAD,2CAAaQ,OAAOC,uBAAuB,CAC5C;AAED,8BACGU,QAAS;AAAA,IACRlC,WAAWY,GAAGX,QAAQkC,MAAMnC,SAAS;AAAA,IACrCG;AAAAA,IACAI;AAAAA,IACAF;AAAAA,IACA+B,YAAY;AAAA,MACVnC,SAAS;AAAA,QACPkC,MAAMlC,QAAQoC;AAAAA,MAChB;AAAA,IACF;AAAA,IACAC,eAAe;AAAA,MACbrC,SAAS;AAAA,QACPkC,MAAMvB,GAAGD,IAAI;AAAA,UAAEoB;AAAAA,QAAAA,CAAiB,GAAG9B,QAAQsC,UAAU;AAAA,MACvD;AAAA,IACF;AAAA,IACAjC;AAAAA,IAAiB,GACbG;AAAAA,IAAML,UAAA,CAEVsB,oBAACc,UAAQ;AAAA,MACPrC,IAAIsC,MAAMtC,IAAI,OAAO;AAAA,MACrBH,WAAWC,QAAQyC;AAAAA,MACnBC,SAAQ;AAAA,MACRC,SAAStC;AAAAA,MACT,cAAYE;AAAAA,MAAYJ,UAExBsB,oBAACG,2BAA2B,EAAA;AAAA,IACpB,CAAA,GACTzB,QAAQ;AAAA,EAAA,CACA;AAEf;"}
@@ -42,7 +42,7 @@ const HvScrollToHorizontal = (props) => {
42
42
  const upMd = useMediaQuery(muiTheme.breakpoints.up("md"));
43
43
  const {
44
44
  activeTheme,
45
- selectedMode
45
+ colors
46
46
  } = useTheme$1();
47
47
  const elementId = useUniqueId(id, "hvHorizontalScrollto");
48
48
  const [selectedIndex, setScrollTo] = useScrollTo(defaultSelectedIndex, scrollElementId, href, offset, options, onChange);
@@ -102,7 +102,7 @@ const HvScrollToHorizontal = (props) => {
102
102
  marginBottom: 0,
103
103
  marginRight: position === "fixed" && (upMd || downSm) ? theme.spacing(upMd ? 4 : 2) : 0,
104
104
  marginLeft: position === "fixed" && (upMd || downSm) ? theme.spacing(upMd ? 4 : 2) : 0,
105
- backgroundColor: hexToRgbA(activeTheme == null ? void 0 : activeTheme.colors.modes[selectedMode].atmo2, activeTheme == null ? void 0 : activeTheme.scrollTo.backgroundColorOpacity)
105
+ backgroundColor: hexToRgbA(colors == null ? void 0 : colors.atmo2, activeTheme == null ? void 0 : activeTheme.scrollTo.backgroundColorOpacity)
106
106
  }), classes.root, {
107
107
  [classes.positionSticky]: position === "sticky",
108
108
  [classes.positionFixed]: position === "fixed"
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollToHorizontal.js","sources":["../../../../../src/components/ScrollTo/Horizontal/ScrollToHorizontal.tsx"],"sourcesContent":["import { useCallback, useMemo } from \"react\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport { useTheme as useMuiTheme } from \"@mui/material/styles\";\nimport { useMediaQuery } from \"@mui/material\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { CurrentStep } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useTheme } from \"@core/hooks/useTheme\";\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 { HvScrollToTooltipPositions } from \"../types\";\nimport { withTooltip } from \"../withTooltip\";\nimport { HvHorizontalScrollListItem } from \"./HorizontalScrollListItem\";\nimport { useScrollTo } from \"../useScrollTo\";\nimport { staticClasses, useClasses } from \"./ScrollToHorizontal.styles\";\n\nexport { staticClasses as scrollToHorizontalClasses };\n\nexport type HvScrollToHorizontalClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvScrollToHorizontalOption {\n key?: string;\n label: string;\n value: string;\n offset?: number;\n}\n\nexport type HvScrollToHorizontalPositions = \"sticky\" | \"fixed\" | \"relative\";\n\nexport interface HvScrollToHorizontalProps\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: HvScrollToHorizontalOption[];\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 Horizontal scroll to. */\n position?: HvScrollToHorizontalPositions;\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?: HvScrollToHorizontalClasses;\n}\n\n/**\n * The horizontal scroll to element can be used to quickly navigate in a page.\n */\nexport const HvScrollToHorizontal = (props: HvScrollToHorizontalProps) => {\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 = \"top\",\n ...others\n } = useDefaultProps(\"HvScrollToHorizontal\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n const muiTheme = useMuiTheme();\n\n const downSm = useMediaQuery(muiTheme.breakpoints.down(\"sm\"));\n const upMd = useMediaQuery(muiTheme.breakpoints.up(\"md\"));\n\n const { activeTheme, selectedMode } = useTheme();\n\n const elementId = useUniqueId(id, \"hvHorizontalScrollto\");\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);\n });\n }, [options, tooltipPosition]);\n\n const NotSelected = useCallback(() => {\n return (\n <div className={classes.notSelectedRoot}>\n <div className={classes.notSelected} />\n </div>\n );\n }, [classes.notSelectedRoot, classes.notSelected]);\n\n const Selected = useCallback(() => {\n return (\n <CurrentStep\n height={activeTheme?.scrollTo.dotSelectedSize}\n width={activeTheme?.scrollTo.dotSelectedSize}\n className={classes.selected}\n />\n );\n }, [classes.selected, activeTheme?.scrollTo.dotSelectedSize]);\n\n const tabs = options.map((option, index) => {\n const selected = selectedIndex === index;\n const tooltipWrapper = tooltipWrappers[index];\n\n return (\n <HvHorizontalScrollListItem\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 >\n <p>{option.label}</p>\n {selected ? <Selected /> : <NotSelected />}\n </HvHorizontalScrollListItem>\n );\n });\n\n return (\n <ol\n className={cx(\n css({\n width:\n position === \"fixed\" && (upMd || downSm)\n ? `calc(100% - 2*${theme.spacing(upMd ? 4 : 2)})`\n : \"100%\",\n marginTop: 0,\n marginBottom: 0,\n marginRight:\n position === \"fixed\" && (upMd || downSm)\n ? theme.spacing(upMd ? 4 : 2)\n : 0,\n marginLeft:\n position === \"fixed\" && (upMd || downSm)\n ? theme.spacing(upMd ? 4 : 2)\n : 0,\n backgroundColor: hexToRgbA(\n activeTheme?.colors.modes[selectedMode].atmo2,\n activeTheme?.scrollTo.backgroundColorOpacity\n ),\n }),\n classes.root,\n {\n [classes.positionSticky]: position === \"sticky\",\n [classes.positionFixed]: position === \"fixed\",\n },\n className\n )}\n id={elementId}\n {...others}\n >\n {tabs}\n </ol>\n );\n};\n"],"names":["HvScrollToHorizontal","props","id","defaultSelectedIndex","scrollElementId","href","onChange","onClick","onEnter","className","classes","classesProp","options","offset","position","tooltipPosition","others","useDefaultProps","css","cx","useClasses","muiTheme","useMuiTheme","downSm","useMediaQuery","breakpoints","down","upMd","up","activeTheme","selectedMode","useTheme","elementId","useUniqueId","selectedIndex","setScrollTo","useScrollTo","handleSelection","event","value","index","preventDefault","wrappedOnChange","tooltipWrappers","useMemo","map","option","withTooltip","label","NotSelected","useCallback","notSelectedRoot","children","notSelected","Selected","CurrentStep","height","scrollTo","dotSelectedSize","width","selected","tabs","tooltipWrapper","HvHorizontalScrollListItem","setId","onKeyDown","isKey","_jsx","key","theme","spacing","marginTop","marginBottom","marginRight","marginLeft","backgroundColor","hexToRgbA","colors","modes","atmo2","backgroundColorOpacity","root","positionSticky","positionFixed"],"mappings":";;;;;;;;;;;;;;;;;AAiFaA,MAAAA,uBAAuBA,CAACC,UAAqC;AAClE,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,IAClB,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,wBAAwBhB,KAAK;AAE3C,QAAA;AAAA,IAAES;AAAAA,IAASQ;AAAAA,IAAKC;AAAAA,EAAAA,IAAOC,WAA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GACDtE,QAAQuE,MACR;AAAA,MACE,CAACvE,QAAQwE,cAAc,GAAGpE,aAAa;AAAA,MACvC,CAACJ,QAAQyE,aAAa,GAAGrE,aAAa;AAAA,OAExCL,SACF;AAAA,IACAP,IAAI8B;AAAAA,IAAU,GACVhB;AAAAA,IAAMoC,UAETS;AAAAA,EAAAA,CACC;AAER;"}
1
+ {"version":3,"file":"ScrollToHorizontal.js","sources":["../../../../../src/components/ScrollTo/Horizontal/ScrollToHorizontal.tsx"],"sourcesContent":["import { useCallback, useMemo } from \"react\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport { useTheme as useMuiTheme } from \"@mui/material/styles\";\nimport { useMediaQuery } from \"@mui/material\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { CurrentStep } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useTheme } from \"@core/hooks/useTheme\";\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 { HvScrollToTooltipPositions } from \"../types\";\nimport { withTooltip } from \"../withTooltip\";\nimport { HvHorizontalScrollListItem } from \"./HorizontalScrollListItem\";\nimport { useScrollTo } from \"../useScrollTo\";\nimport { staticClasses, useClasses } from \"./ScrollToHorizontal.styles\";\n\nexport { staticClasses as scrollToHorizontalClasses };\n\nexport type HvScrollToHorizontalClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvScrollToHorizontalOption {\n key?: string;\n label: string;\n value: string;\n offset?: number;\n}\n\nexport type HvScrollToHorizontalPositions = \"sticky\" | \"fixed\" | \"relative\";\n\nexport interface HvScrollToHorizontalProps\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: HvScrollToHorizontalOption[];\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 Horizontal scroll to. */\n position?: HvScrollToHorizontalPositions;\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?: HvScrollToHorizontalClasses;\n}\n\n/**\n * The horizontal scroll to element can be used to quickly navigate in a page.\n */\nexport const HvScrollToHorizontal = (props: HvScrollToHorizontalProps) => {\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 = \"top\",\n ...others\n } = useDefaultProps(\"HvScrollToHorizontal\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n const muiTheme = useMuiTheme();\n\n const downSm = useMediaQuery(muiTheme.breakpoints.down(\"sm\"));\n const upMd = useMediaQuery(muiTheme.breakpoints.up(\"md\"));\n\n const { activeTheme, colors } = useTheme();\n\n const elementId = useUniqueId(id, \"hvHorizontalScrollto\");\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);\n });\n }, [options, tooltipPosition]);\n\n const NotSelected = useCallback(() => {\n return (\n <div className={classes.notSelectedRoot}>\n <div className={classes.notSelected} />\n </div>\n );\n }, [classes.notSelectedRoot, classes.notSelected]);\n\n const Selected = useCallback(() => {\n return (\n <CurrentStep\n height={activeTheme?.scrollTo.dotSelectedSize}\n width={activeTheme?.scrollTo.dotSelectedSize}\n className={classes.selected}\n />\n );\n }, [classes.selected, activeTheme?.scrollTo.dotSelectedSize]);\n\n const tabs = options.map((option, index) => {\n const selected = selectedIndex === index;\n const tooltipWrapper = tooltipWrappers[index];\n\n return (\n <HvHorizontalScrollListItem\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 >\n <p>{option.label}</p>\n {selected ? <Selected /> : <NotSelected />}\n </HvHorizontalScrollListItem>\n );\n });\n\n return (\n <ol\n className={cx(\n css({\n width:\n position === \"fixed\" && (upMd || downSm)\n ? `calc(100% - 2*${theme.spacing(upMd ? 4 : 2)})`\n : \"100%\",\n marginTop: 0,\n marginBottom: 0,\n marginRight:\n position === \"fixed\" && (upMd || downSm)\n ? theme.spacing(upMd ? 4 : 2)\n : 0,\n marginLeft:\n position === \"fixed\" && (upMd || downSm)\n ? theme.spacing(upMd ? 4 : 2)\n : 0,\n backgroundColor: hexToRgbA(\n colors?.atmo2,\n activeTheme?.scrollTo.backgroundColorOpacity\n ),\n }),\n classes.root,\n {\n [classes.positionSticky]: position === \"sticky\",\n [classes.positionFixed]: position === \"fixed\",\n },\n className\n )}\n id={elementId}\n {...others}\n >\n {tabs}\n </ol>\n );\n};\n"],"names":["HvScrollToHorizontal","props","id","defaultSelectedIndex","scrollElementId","href","onChange","onClick","onEnter","className","classes","classesProp","options","offset","position","tooltipPosition","others","useDefaultProps","css","cx","useClasses","muiTheme","useMuiTheme","downSm","useMediaQuery","breakpoints","down","upMd","up","activeTheme","colors","useTheme","elementId","useUniqueId","selectedIndex","setScrollTo","useScrollTo","handleSelection","event","value","index","preventDefault","wrappedOnChange","tooltipWrappers","useMemo","map","option","withTooltip","label","NotSelected","useCallback","notSelectedRoot","children","notSelected","Selected","CurrentStep","height","scrollTo","dotSelectedSize","width","selected","tabs","tooltipWrapper","HvHorizontalScrollListItem","setId","onKeyDown","isKey","_jsx","key","theme","spacing","marginTop","marginBottom","marginRight","marginLeft","backgroundColor","hexToRgbA","atmo2","backgroundColorOpacity","root","positionSticky","positionFixed"],"mappings":";;;;;;;;;;;;;;;;;AAiFaA,MAAAA,uBAAuBA,CAACC,UAAqC;AAClE,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,IAClB,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,wBAAwBhB,KAAK;AAE3C,QAAA;AAAA,IAAES;AAAAA,IAASQ;AAAAA,IAAKC;AAAAA,EAAAA,IAAOC,WAAWT,WAAW;AACnD,QAAMU,WAAWC;AAEjB,QAAMC,SAASC,cAAcH,SAASI,YAAYC,KAAK,IA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GAAGnE,aAAa;AAAA,OAExCL,SACF;AAAA,IACAP,IAAI8B;AAAAA,IAAU,GACVhB;AAAAA,IAAMoC,UAETS;AAAAA,EAAAA,CACC;AAER;"}
@@ -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;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,MAAiBC,SAAS;AAEzCC,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;AA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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;AAA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AE3B;AAAA,EAAA,CAEJ;AAEKS,QAAAA,iBAAiBC,gBAAgBvC,QAAQwC,MAAM;AACrD,QAAMC,kBAAkBC,UACtB/B,iCAAQgC,OACRjC,2CAAakC,SAASC,sBACxB;AAEA,6BACE,MAAA;AAAA,IACEhD,WAAWW,GACTD,IAAI;AAAA,MAAEkC;AAAAA,IAAAA,CAAiB,GACvB3C,QAAQgD,MACR;AAAA,MACE,CAAChD,QAAQiD,aAAa,GAAG7C,aAAa;AAAA,MACtC,CAACJ,QAAQkD,gBAAgB,GAAG9C,aAAa;AAAA,OAE3CL,SACF;AAAA,IACAO,OAAO;AAAA,MAAE6C,KAAM,cAAaX;AAAAA,MAAqB,GAAGlC;AAAAA,IAAM;AAAA,IAC1Dd,IAAIuB;AAAAA,IAAU,GACVR;AAAAA,IAAM6C,UAETpB;AAAAA,EAAAA,CACC;AAER;"}
@@ -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;AA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B;AAAA,IAAA,CACD,GACH5B,gBACEU,IAAI;AAAA,MACF,CAAE,KAAIgC,cAAcrC,QAAQ,GAAG;AAAA,QAC7BuC,iBAAkB,6BAA4BhB,gBAAgBA;AAAAA,MAChE;AAAA,IAAA,CACD,GACH;AAAA,MACE,CAAClC,QAAS,QAAOmD,WAAWjD,KAAK,GAAG,CAAC,GAAGA,UAAU;AAAA,MAClD,CAACF,QAAQoD,WAAW,GAAG/B,aAAalB,YAAY;AAAA,MAChD,CAACH,QAAQqD,eAAe,GACtBhC,aAAalB,YAAY,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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,aAAaC,SAAS;AAAA,MACjD,CAACJ,QAAS,UAASgD,WAAW7C,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;"}
@@ -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,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,EACX,GAAGC;AACL,GACAC,gBACG;;AACG,QAAA;AAAA,IAAErB;AAAAA,IAASsB;AAAAA,IAAIC;AAAAA,EAAAA,IAAQC,WAAWvB,WAAW;AAE7C,QAAA;AAAA,IAAEwB;AAAAA,IAAaC;AAAAA,MAAiBC,SAAS;AACzCC,QAAAA,eAAeC,WAAWC,YAAY;AACtCC,QAAAA,sBAAsBF,WAAWG,mBAAmB;AAEpD1B,QAAAA,OAAOC,aAAYwB,2DAAqBzB,SAAQ;AACtD,QAAM2B,aAAa3B,SAAS;AAEtBJ,QAAAA,QAAQC,aAAa8B,aAAa,QAAQ;AAE1CC,QAAAA,OAAOC,QACX,MAAMC,YAAYtB,UAAUD,aAAa,GACzC,CAACC,QAAQD,aAAa,CACxB;AAEA,QAAMwB,YACJxC,eAAa+B,kDAAcU,eAA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,YAAWsD,WAAWlD,KAAK,GAAG,CAAC,GAAGA,UAAU;AAAA,MAAA,CACvD;AAAA,MAAER,WAEFqC,cAAclB,gCACZ0C,UAAQ;AAAA,QACP3D,WAAWE,QAAQ0D;AAAAA,QACnBC,MAAI;AAAA,QACJC,oBAAoB;AAAA,QAAMhE,8BAEzBsC,MAAI;AAAA,UAACpC,WAAWE,QAAQ6D;AAAAA,QAAAA,CAAW;AAAA,MAAA,CAC5B,GAEZC,oBAACC,cAAY;AAAA,QACXlE,WAAU;AAAA,QACVC,WAAWwB,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,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BAAA,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,IACX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AAMS;AAAAA,QAC/B;AAAA,MACF;AAAA,MACA,sBAAsB;AAAA,QACpBD,iBAAiBb;AAAAA,QACjB,WAAW;AAAA,UACTa,iBAAiBT,MAAMC,MAAMS;AAAAA,QAC/B;AAAA,MACF;AAAA,IAAA,CACD,GACH;AAAA,MACE,CAAChD,QAAQI,KAAK,GAAGA;AAAAA,MACjB,CAACJ,QAAQK,QAAQ,GAAGA;AAAAA,MACpB,CAACL,QAAQM,QAAQ,GAAGA;AAAAA,MACpB,CAACN,QAAQO,OAAO,GAAGA;AAAAA,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,M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,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;"}