@hitachivantara/uikit-react-core 5.36.5 → 5.36.7

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 (94) hide show
  1. package/dist/cjs/components/AppSwitcher/Action/Action.cjs +4 -2
  2. package/dist/cjs/components/AppSwitcher/Action/Action.cjs.map +1 -1
  3. package/dist/cjs/components/AppSwitcher/Action/Action.styles.cjs +6 -8
  4. package/dist/cjs/components/AppSwitcher/Action/Action.styles.cjs.map +1 -1
  5. package/dist/cjs/components/AppSwitcher/AppSwitcher.cjs +4 -2
  6. package/dist/cjs/components/AppSwitcher/AppSwitcher.cjs.map +1 -1
  7. package/dist/cjs/components/AppSwitcher/AppSwitcher.styles.cjs +4 -3
  8. package/dist/cjs/components/AppSwitcher/AppSwitcher.styles.cjs.map +1 -1
  9. package/dist/cjs/components/BreadCrumb/Page/Page.cjs +1 -1
  10. package/dist/cjs/components/Button/Button.cjs +0 -3
  11. package/dist/cjs/components/Button/Button.cjs.map +1 -1
  12. package/dist/cjs/components/Calendar/utils.cjs.map +1 -1
  13. package/dist/cjs/components/Dialog/Dialog.cjs +2 -5
  14. package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -1
  15. package/dist/cjs/components/Dropdown/Dropdown.cjs +0 -3
  16. package/dist/cjs/components/Dropdown/Dropdown.cjs.map +1 -1
  17. package/dist/cjs/components/FileUploader/File/File.cjs +3 -3
  18. package/dist/cjs/components/FileUploader/File/File.cjs.map +1 -1
  19. package/dist/cjs/components/Header/Navigation/MenuItem/MenuItem.styles.cjs.map +1 -1
  20. package/dist/cjs/components/OverflowTooltip/OverflowTooltip.cjs +9 -2
  21. package/dist/cjs/components/OverflowTooltip/OverflowTooltip.cjs.map +1 -1
  22. package/dist/cjs/components/OverflowTooltip/OverflowTooltip.styles.cjs +2 -2
  23. package/dist/cjs/components/OverflowTooltip/OverflowTooltip.styles.cjs.map +1 -1
  24. package/dist/cjs/components/Snackbar/SnackbarProvider/SnackbarProvider.cjs +9 -14
  25. package/dist/cjs/components/Snackbar/SnackbarProvider/SnackbarProvider.cjs.map +1 -1
  26. package/dist/cjs/components/Tooltip/Tooltip.cjs +2 -1
  27. package/dist/cjs/components/Tooltip/Tooltip.cjs.map +1 -1
  28. package/dist/cjs/components/TreeView/internals/DescendantProvider.cjs +0 -3
  29. package/dist/cjs/components/TreeView/internals/DescendantProvider.cjs.map +1 -1
  30. package/dist/cjs/components/TreeView/internals/TreeViewProvider.cjs +0 -3
  31. package/dist/cjs/components/TreeView/internals/TreeViewProvider.cjs.map +1 -1
  32. package/dist/cjs/components/Typography/utils.cjs +3 -13
  33. package/dist/cjs/components/Typography/utils.cjs.map +1 -1
  34. package/dist/cjs/components/VerticalNavigation/TreeView/descendants.cjs +0 -3
  35. package/dist/cjs/components/VerticalNavigation/TreeView/descendants.cjs.map +1 -1
  36. package/dist/cjs/hooks/useControlled.cjs +0 -3
  37. package/dist/cjs/hooks/useControlled.cjs.map +1 -1
  38. package/dist/cjs/providers/Provider.cjs +3 -2
  39. package/dist/cjs/providers/Provider.cjs.map +1 -1
  40. package/dist/cjs/utils/classes.cjs.map +1 -1
  41. package/dist/cjs/utils/document.cjs +11 -0
  42. package/dist/cjs/utils/document.cjs.map +1 -0
  43. package/dist/cjs/utils/theme.cjs +5 -7
  44. package/dist/cjs/utils/theme.cjs.map +1 -1
  45. package/dist/esm/components/AppSwitcher/Action/Action.js +4 -2
  46. package/dist/esm/components/AppSwitcher/Action/Action.js.map +1 -1
  47. package/dist/esm/components/AppSwitcher/Action/Action.styles.js +6 -8
  48. package/dist/esm/components/AppSwitcher/Action/Action.styles.js.map +1 -1
  49. package/dist/esm/components/AppSwitcher/AppSwitcher.js +4 -2
  50. package/dist/esm/components/AppSwitcher/AppSwitcher.js.map +1 -1
  51. package/dist/esm/components/AppSwitcher/AppSwitcher.styles.js +4 -3
  52. package/dist/esm/components/AppSwitcher/AppSwitcher.styles.js.map +1 -1
  53. package/dist/esm/components/BreadCrumb/Page/Page.js +1 -1
  54. package/dist/esm/components/Button/Button.js +0 -3
  55. package/dist/esm/components/Button/Button.js.map +1 -1
  56. package/dist/esm/components/Calendar/utils.js.map +1 -1
  57. package/dist/esm/components/Dialog/Dialog.js +2 -5
  58. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  59. package/dist/esm/components/Dropdown/Dropdown.js +0 -3
  60. package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
  61. package/dist/esm/components/FileUploader/File/File.js +2 -2
  62. package/dist/esm/components/FileUploader/File/File.js.map +1 -1
  63. package/dist/esm/components/Header/Navigation/MenuItem/MenuItem.styles.js.map +1 -1
  64. package/dist/esm/components/OverflowTooltip/OverflowTooltip.js +9 -2
  65. package/dist/esm/components/OverflowTooltip/OverflowTooltip.js.map +1 -1
  66. package/dist/esm/components/OverflowTooltip/OverflowTooltip.styles.js +2 -2
  67. package/dist/esm/components/OverflowTooltip/OverflowTooltip.styles.js.map +1 -1
  68. package/dist/esm/components/Snackbar/SnackbarProvider/SnackbarProvider.js +9 -14
  69. package/dist/esm/components/Snackbar/SnackbarProvider/SnackbarProvider.js.map +1 -1
  70. package/dist/esm/components/Tooltip/Tooltip.js +2 -1
  71. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  72. package/dist/esm/components/TreeView/internals/DescendantProvider.js +0 -3
  73. package/dist/esm/components/TreeView/internals/DescendantProvider.js.map +1 -1
  74. package/dist/esm/components/TreeView/internals/TreeViewProvider.js +0 -3
  75. package/dist/esm/components/TreeView/internals/TreeViewProvider.js.map +1 -1
  76. package/dist/esm/components/Typography/utils.js +3 -13
  77. package/dist/esm/components/Typography/utils.js.map +1 -1
  78. package/dist/esm/components/VerticalNavigation/TreeView/descendants.js +0 -3
  79. package/dist/esm/components/VerticalNavigation/TreeView/descendants.js.map +1 -1
  80. package/dist/esm/hooks/useControlled.js +0 -3
  81. package/dist/esm/hooks/useControlled.js.map +1 -1
  82. package/dist/esm/providers/Provider.js +4 -3
  83. package/dist/esm/providers/Provider.js.map +1 -1
  84. package/dist/esm/utils/classes.js.map +1 -1
  85. package/dist/esm/utils/document.js +11 -0
  86. package/dist/esm/utils/document.js.map +1 -0
  87. package/dist/esm/utils/theme.js +5 -7
  88. package/dist/esm/utils/theme.js.map +1 -1
  89. package/dist/types/index.d.ts +13 -9
  90. package/package.json +4 -4
  91. package/dist/cjs/components/AppSwitcher/TitleWithTooltip.cjs +0 -22
  92. package/dist/cjs/components/AppSwitcher/TitleWithTooltip.cjs.map +0 -1
  93. package/dist/esm/components/AppSwitcher/TitleWithTooltip.js +0 -22
  94. package/dist/esm/components/AppSwitcher/TitleWithTooltip.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { forwardRef, ReactElement } from \"react\";\nimport { Fade, Tooltip, TooltipProps as MuiTooltipProps } from \"@mui/material\";\n\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Tooltip.styles\";\n\nexport { staticClasses as tooltipClasses };\n\nexport type HvTooltipClasses = ExtractNames<typeof useClasses>;\nexport type HvTooltipPlacementType = MuiTooltipProps[\"placement\"];\n\nexport interface HvTooltipProps extends Omit<MuiTooltipProps, \"classes\"> {\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes?: HvTooltipClasses;\n /**\n * If true, the tooltip is shown.\n */\n open?: boolean;\n /**\n * Tooltip placement.\n */\n placement?: HvTooltipPlacementType;\n /**\n * The number of milliseconds to wait before showing the tooltip.\n * This property won't impact the enter touch delay (enterTouchDelay).\n */\n enterDelay?: number;\n /** @inheritdoc */\n title: MuiTooltipProps[\"title\"];\n /** @inheritdoc */\n TransitionComponent?: MuiTooltipProps[\"TransitionComponent\"];\n /** @inheritdoc */\n TransitionProps?: MuiTooltipProps[\"TransitionProps\"];\n /**\n * Defines if should use a single or multiline tooltip.\n */\n useSingle?: boolean;\n /**\n * Node to apply the tooltip.\n */\n children: ReactElement;\n /**\n * Id attribute value of an HTML Element to have the tooltip appended to it.\n */\n containerId?: string;\n}\n\n/**\n * Tooltips display informative text when users hover over, focus on, or tap an element.\n * Accessibility-wise, the tooltip automatically labels the `children` content.\n */\nexport const HvTooltip = forwardRef((props: HvTooltipProps, ref) => {\n const {\n className,\n classes: classesProp,\n open,\n enterDelay = 300,\n placement = \"top\",\n useSingle = true,\n children,\n title,\n TransitionComponent = Fade,\n TransitionProps = { timeout: 400, placement },\n containerId,\n ...others\n } = useDefaultProps(\"HvTooltip\", props);\n\n const { rootId } = useTheme();\n const { classes } = useClasses(classesProp);\n\n return (\n <Tooltip\n ref={ref}\n open={open ?? undefined}\n enterDelay={enterDelay}\n placement={placement}\n TransitionComponent={TransitionComponent}\n TransitionProps={TransitionProps}\n className={className}\n classes={{\n tooltip: useSingle ? classes.tooltip : classes.tooltipMulti,\n popper: classes.popper,\n }}\n title={title}\n PopperProps={{\n container:\n typeof window !== \"undefined\"\n ? document.getElementById(containerId || rootId || \"\") ||\n document.body\n : undefined,\n }}\n {...others}\n >\n {children}\n </Tooltip>\n );\n});\n"],"names":["HvTooltip","forwardRef","props","ref","className","classes","classesProp","open","enterDelay","placement","useSingle","children","title","TransitionComponent","Fade","TransitionProps","timeout","containerId","others","useDefaultProps","rootId","useTheme","useClasses","undefined","tooltip","tooltipMulti","popper","container","window","document","getElementById","body"],"mappings":";;;;;;;AA4DO,MAAMA,YAAYC,WAAW,CAACC,OAAuBC,QAAQ;AAC5D,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC,aAAa;AAAA,IACbC,YAAY;AAAA,IACZC,YAAY;AAAA,IACZC;AAAAA,IACAC;AAAAA,IACAC,sBAAsBC;AAAAA,IACtBC,kBAAkB;AAAA,MAAEC,SAAS;AAAA,MAAKP;AAAAA,IAAU;AAAA,IAC5CQ;AAAAA,IACA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,aAAajB,KAAK;AAEhC,QAAA;AAAA,IAAEkB;AAAAA,MAAWC,SAAS;AACtB,QAAA;AAAA,IAAEhB;AAAAA,EAAAA,IAAYiB,WAAWhB,WAAW;AAGxC,SAAA,oBAAC,SACC,EAAA,KACA,MAAMC,QAAQgB,QACd,YACA,WACA,qBACA,iBACA,WACA,SAAS;AAAA,IACPC,SAASd,YAAYL,QAAQmB,UAAUnB,QAAQoB;AAAAA,IAC/CC,QAAQrB,QAAQqB;AAAAA,EAAAA,GAElB,OACA,aAAa;AAAA,IACXC,WACE,OAAOC,WAAW,cACdC,SAASC,eAAeb,eAAeG,UAAU,EAAE,KACnDS,SAASE,OACTR;AAAAA,EAAAA,GAEJL,GAAAA,QAEHP,SACH,CAAA;AAEJ,CAAC;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { forwardRef, ReactElement } from \"react\";\nimport { Fade, Tooltip, TooltipProps as MuiTooltipProps } from \"@mui/material\";\n\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { getElementById } from \"@core/utils/document\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Tooltip.styles\";\n\nexport { staticClasses as tooltipClasses };\n\nexport type HvTooltipClasses = ExtractNames<typeof useClasses>;\nexport type HvTooltipPlacementType = MuiTooltipProps[\"placement\"];\n\nexport interface HvTooltipProps extends Omit<MuiTooltipProps, \"classes\"> {\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes?: HvTooltipClasses;\n /**\n * If true, the tooltip is shown.\n */\n open?: boolean;\n /**\n * Tooltip placement.\n */\n placement?: HvTooltipPlacementType;\n /**\n * The number of milliseconds to wait before showing the tooltip.\n * This property won't impact the enter touch delay (enterTouchDelay).\n */\n enterDelay?: number;\n /** @inheritdoc */\n title: MuiTooltipProps[\"title\"];\n /** @inheritdoc */\n TransitionComponent?: MuiTooltipProps[\"TransitionComponent\"];\n /** @inheritdoc */\n TransitionProps?: MuiTooltipProps[\"TransitionProps\"];\n /**\n * Defines if should use a single or multiline tooltip.\n */\n useSingle?: boolean;\n /**\n * Node to apply the tooltip.\n */\n children: ReactElement;\n /**\n * Id attribute value of an HTML Element to have the tooltip appended to it.\n */\n containerId?: string;\n}\n\n/**\n * Tooltips display informative text when users hover over, focus on, or tap an element.\n * Accessibility-wise, the tooltip automatically labels the `children` content.\n */\nexport const HvTooltip = forwardRef((props: HvTooltipProps, ref) => {\n const {\n className,\n classes: classesProp,\n open,\n enterDelay = 300,\n placement = \"top\",\n useSingle = true,\n children,\n title,\n TransitionComponent = Fade,\n TransitionProps = { timeout: 400, placement },\n containerId,\n ...others\n } = useDefaultProps(\"HvTooltip\", props);\n\n const { rootId } = useTheme();\n const { classes } = useClasses(classesProp);\n\n return (\n <Tooltip\n ref={ref}\n open={open ?? undefined}\n enterDelay={enterDelay}\n placement={placement}\n TransitionComponent={TransitionComponent}\n TransitionProps={TransitionProps}\n className={className}\n classes={{\n tooltip: useSingle ? classes.tooltip : classes.tooltipMulti,\n popper: classes.popper,\n }}\n title={title}\n PopperProps={{\n container: getElementById(containerId || rootId),\n }}\n {...others}\n >\n {children}\n </Tooltip>\n );\n});\n"],"names":["HvTooltip","forwardRef","props","ref","className","classes","classesProp","open","enterDelay","placement","useSingle","children","title","TransitionComponent","Fade","TransitionProps","timeout","containerId","others","useDefaultProps","rootId","useTheme","useClasses","undefined","tooltip","tooltipMulti","popper","container","getElementById"],"mappings":";;;;;;;;AA6DO,MAAMA,YAAYC,WAAW,CAACC,OAAuBC,QAAQ;AAC5D,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC,aAAa;AAAA,IACbC,YAAY;AAAA,IACZC,YAAY;AAAA,IACZC;AAAAA,IACAC;AAAAA,IACAC,sBAAsBC;AAAAA,IACtBC,kBAAkB;AAAA,MAAEC,SAAS;AAAA,MAAKP;AAAAA,IAAU;AAAA,IAC5CQ;AAAAA,IACA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,aAAajB,KAAK;AAEhC,QAAA;AAAA,IAAEkB;AAAAA,MAAWC,SAAS;AACtB,QAAA;AAAA,IAAEhB;AAAAA,EAAAA,IAAYiB,WAAWhB,WAAW;AAGxC,SAAA,oBAAC,SACC,EAAA,KACA,MAAMC,QAAQgB,QACd,YACA,WACA,qBACA,iBACA,WACA,SAAS;AAAA,IACPC,SAASd,YAAYL,QAAQmB,UAAUnB,QAAQoB;AAAAA,IAC/CC,QAAQrB,QAAQqB;AAAAA,EAAAA,GAElB,OACA,aAAa;AAAA,IACXC,WAAWC,eAAeX,eAAeG,MAAM;AAAA,EAAA,GAE7CF,GAAAA,QAEHP,SACH,CAAA;AAEJ,CAAC;"}
@@ -29,9 +29,6 @@ function binaryFindElement(array, element) {
29
29
  return start;
30
30
  }
31
31
  const DescendantContext = React.createContext({});
32
- if (process.env.NODE_ENV !== "production") {
33
- DescendantContext.displayName = "DescendantContext";
34
- }
35
32
  function usePrevious(value) {
36
33
  const ref = React.useRef(null);
37
34
  React.useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"DescendantProvider.js","sources":["../../../../../src/components/TreeView/internals/DescendantProvider.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { unstable_useEnhancedEffect as useEnhancedEffect } from \"@mui/material/utils\";\n\n/** Credit: https://github.com/reach/reach-ui/blob/86a046f54d53b6420e392b3fa56dd991d9d4e458/packages/descendants/README.md\n * Modified slightly to suit our purposes.\n */\n\n// To replace with .findIndex() once we stop IE11 support.\nfunction findIndex<T>(array: T[], comp: (item: T) => boolean) {\n for (let i = 0; i < array.length; i += 1) {\n if (comp(array[i])) {\n return i;\n }\n }\n\n return -1;\n}\n\nfunction binaryFindElement(\n array: TreeItemDescendant[],\n element: HTMLLIElement\n) {\n let start = 0;\n let end = array.length - 1;\n\n while (start <= end) {\n const middle = Math.floor((start + end) / 2);\n\n if (array[middle].element === element) {\n return middle;\n }\n\n if (\n // eslint-disable-next-line no-bitwise\n array[middle].element.compareDocumentPosition(element) &\n Node.DOCUMENT_POSITION_PRECEDING\n ) {\n end = middle - 1;\n } else {\n start = middle + 1;\n }\n }\n\n return start;\n}\n\nexport interface TreeItemDescendant {\n element: HTMLLIElement;\n id: string;\n}\n\ninterface DescendantContextValue {\n registerDescendant?: (params: TreeItemDescendant & { index: number }) => void;\n unregisterDescendant?: (params: HTMLLIElement) => void;\n descendants?: TreeItemDescendant[];\n parentId?: string | null;\n}\n\nconst DescendantContext = React.createContext<DescendantContextValue>({});\n\nif (process.env.NODE_ENV !== \"production\") {\n DescendantContext.displayName = \"DescendantContext\";\n}\n\nfunction usePrevious<T>(value: T) {\n const ref = React.useRef<T | null>(null);\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current;\n}\n\nconst noop = () => {};\n\n/**\n * This hook registers our descendant by passing it into an array. We can then\n * search that array by to find its index when registering it in the component.\n * We use this for focus management, keyboard navigation, and typeahead\n * functionality for some components.\n *\n * The hook accepts the element node\n *\n * Our main goals with this are:\n * 1) maximum composability,\n * 2) minimal API friction\n * 3) SSR compatibility*\n * 4) concurrent safe\n * 5) index always up-to-date with the tree despite changes\n * 6) works with memoization of any component in the tree (hopefully)\n *\n * * As for SSR, the good news is that we don't actually need the index on the\n * server for most use-cases, as we are only using it to determine the order of\n * composed descendants for keyboard navigation.\n */\nexport function useDescendant(descendant: TreeItemDescendant) {\n const [, forceUpdate] = React.useState<{}>();\n const {\n registerDescendant = noop,\n unregisterDescendant = noop,\n descendants = [],\n parentId = null,\n } = React.useContext(DescendantContext);\n\n // This will initially return -1 because we haven't registered the descendant\n // on the first render. After we register, this will then return the correct\n // index on the following render, and we will re-register descendants\n // so that everything is up-to-date before the user interacts with a\n // collection.\n const index = findIndex(\n descendants,\n (item) => item.element === descendant.element\n );\n\n const previousDescendants = usePrevious(descendants);\n\n // We also need to re-register descendants any time ANY of the other\n // descendants have changed. My brain was melting when I wrote this and it\n // feels a little off, but checking in render and using the result in the\n // effect's dependency array works well enough.\n const someDescendantsHaveChanged = descendants.some(\n (newDescendant, position) => {\n return (\n previousDescendants &&\n previousDescendants[position] &&\n previousDescendants[position].element !== newDescendant.element\n );\n }\n );\n\n // Prevent any flashing\n useEnhancedEffect(() => {\n if (descendant.element) {\n registerDescendant({\n ...descendant,\n index,\n });\n return () => {\n unregisterDescendant(descendant.element!);\n };\n }\n forceUpdate({});\n\n return undefined;\n }, [\n registerDescendant,\n unregisterDescendant,\n index,\n someDescendantsHaveChanged,\n descendant,\n ]);\n\n return { parentId, index };\n}\n\ninterface DescendantProviderProps {\n id?: string;\n children: React.ReactNode;\n}\n\nexport const DescendantProvider = (props: DescendantProviderProps) => {\n const { children, id } = props;\n\n const [items, set] = React.useState<\n (TreeItemDescendant & { index: number })[]\n >([]);\n\n const registerDescendant = React.useCallback(\n ({ element, ...other }: TreeItemDescendant) => {\n set((oldItems) => {\n if (oldItems.length === 0) {\n // If there are no items, register at index 0 and bail.\n return [\n {\n ...other,\n element,\n index: 0,\n },\n ];\n }\n\n const index = binaryFindElement(oldItems, element);\n let newItems: typeof oldItems;\n\n if (oldItems[index] && oldItems[index].element === element) {\n // If the element is already registered, just use the same array\n newItems = oldItems;\n } else {\n // When registering a descendant, we need to make sure we insert in\n // into the array in the same order that it appears in the DOM. So as\n // new descendants are added or maybe some are removed, we always know\n // that the array is up-to-date and correct.\n //\n // So here we look at our registered descendants and see if the new\n // element we are adding appears earlier than an existing descendant's\n // DOM node via `node.compareDocumentPosition`. If it does, we insert\n // the new element at this index. Because `registerDescendant` will be\n // called in an effect every time the descendants state value changes,\n // we should be sure that this index is accurate when descendent\n // elements come or go from our component.\n\n const newItem = {\n ...other,\n element,\n index,\n };\n\n // If an index is not found we will push the element to the end.\n newItems = oldItems.slice();\n newItems.splice(index, 0, newItem);\n }\n newItems.forEach((item, position) => {\n item.index = position;\n });\n return newItems;\n });\n },\n []\n );\n\n const unregisterDescendant = React.useCallback((element: HTMLLIElement) => {\n set((oldItems) => oldItems.filter((item) => element !== item.element));\n }, []);\n\n const value = React.useMemo(\n () => ({\n descendants: items,\n registerDescendant,\n unregisterDescendant,\n parentId: id,\n }),\n [items, registerDescendant, unregisterDescendant, id]\n );\n\n return (\n <DescendantContext.Provider value={value}>\n {children}\n </DescendantContext.Provider>\n );\n};\n"],"names":["findIndex","array","comp","i","length","binaryFindElement","element","start","end","middle","Math","floor","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","DescendantContext","React","createContext","process","env","NODE_ENV","displayName","usePrevious","value","ref","useRef","useEffect","current","noop","useDescendant","descendant","forceUpdate","useState","registerDescendant","unregisterDescendant","descendants","parentId","useContext","index","item","previousDescendants","someDescendantsHaveChanged","some","newDescendant","position","useEnhancedEffect","undefined","DescendantProvider","props","children","id","items","set","useCallback","other","oldItems","newItems","newItem","slice","splice","forEach","filter","useMemo"],"mappings":";;;AAQA,SAASA,UAAaC,OAAYC,MAA4B;AAC5D,WAASC,IAAI,GAAGA,IAAIF,MAAMG,QAAQD,KAAK,GAAG;AACxC,QAAID,KAAKD,MAAME,CAAC,CAAC,GAAG;AACXA,aAAAA;AAAAA,IACT;AAAA,EACF;AAEO,SAAA;AACT;AAEA,SAASE,kBACPJ,OACAK,SACA;AACA,MAAIC,QAAQ;AACRC,MAAAA,MAAMP,MAAMG,SAAS;AAEzB,SAAOG,SAASC,KAAK;AACnB,UAAMC,SAASC,KAAKC,OAAOJ,QAAQC,OAAO,CAAC;AAE3C,QAAIP,MAAMQ,MAAM,EAAEH,YAAYA,SAAS;AAC9BG,aAAAA;AAAAA,IACT;AAEA;AAAA;AAAA,MAEER,MAAMQ,MAAM,EAAEH,QAAQM,wBAAwBN,OAAO,IACrDO,KAAKC;AAAAA,MACL;AACAN,YAAMC,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AAAA,IAEZ,CAACC,OAAOlB,oBAAoBC,sBAAsBgB,EAAE,CACtD;AAEA,SACG,oBAAA,kBAAkB,UAAlB,EAA2B,OACzBD,SACH,CAAA;AAEJ;"}
1
+ {"version":3,"file":"DescendantProvider.js","sources":["../../../../../src/components/TreeView/internals/DescendantProvider.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { unstable_useEnhancedEffect as useEnhancedEffect } from \"@mui/material/utils\";\n\n/** Credit: https://github.com/reach/reach-ui/blob/86a046f54d53b6420e392b3fa56dd991d9d4e458/packages/descendants/README.md\n * Modified slightly to suit our purposes.\n */\n\n// To replace with .findIndex() once we stop IE11 support.\nfunction findIndex<T>(array: T[], comp: (item: T) => boolean) {\n for (let i = 0; i < array.length; i += 1) {\n if (comp(array[i])) {\n return i;\n }\n }\n\n return -1;\n}\n\nfunction binaryFindElement(\n array: TreeItemDescendant[],\n element: HTMLLIElement\n) {\n let start = 0;\n let end = array.length - 1;\n\n while (start <= end) {\n const middle = Math.floor((start + end) / 2);\n\n if (array[middle].element === element) {\n return middle;\n }\n\n if (\n // eslint-disable-next-line no-bitwise\n array[middle].element.compareDocumentPosition(element) &\n Node.DOCUMENT_POSITION_PRECEDING\n ) {\n end = middle - 1;\n } else {\n start = middle + 1;\n }\n }\n\n return start;\n}\n\nexport interface TreeItemDescendant {\n element: HTMLLIElement;\n id: string;\n}\n\ninterface DescendantContextValue {\n registerDescendant?: (params: TreeItemDescendant & { index: number }) => void;\n unregisterDescendant?: (params: HTMLLIElement) => void;\n descendants?: TreeItemDescendant[];\n parentId?: string | null;\n}\n\nconst DescendantContext = React.createContext<DescendantContextValue>({});\n\nfunction usePrevious<T>(value: T) {\n const ref = React.useRef<T | null>(null);\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current;\n}\n\nconst noop = () => {};\n\n/**\n * This hook registers our descendant by passing it into an array. We can then\n * search that array by to find its index when registering it in the component.\n * We use this for focus management, keyboard navigation, and typeahead\n * functionality for some components.\n *\n * The hook accepts the element node\n *\n * Our main goals with this are:\n * 1) maximum composability,\n * 2) minimal API friction\n * 3) SSR compatibility*\n * 4) concurrent safe\n * 5) index always up-to-date with the tree despite changes\n * 6) works with memoization of any component in the tree (hopefully)\n *\n * * As for SSR, the good news is that we don't actually need the index on the\n * server for most use-cases, as we are only using it to determine the order of\n * composed descendants for keyboard navigation.\n */\nexport function useDescendant(descendant: TreeItemDescendant) {\n const [, forceUpdate] = React.useState<{}>();\n const {\n registerDescendant = noop,\n unregisterDescendant = noop,\n descendants = [],\n parentId = null,\n } = React.useContext(DescendantContext);\n\n // This will initially return -1 because we haven't registered the descendant\n // on the first render. After we register, this will then return the correct\n // index on the following render, and we will re-register descendants\n // so that everything is up-to-date before the user interacts with a\n // collection.\n const index = findIndex(\n descendants,\n (item) => item.element === descendant.element\n );\n\n const previousDescendants = usePrevious(descendants);\n\n // We also need to re-register descendants any time ANY of the other\n // descendants have changed. My brain was melting when I wrote this and it\n // feels a little off, but checking in render and using the result in the\n // effect's dependency array works well enough.\n const someDescendantsHaveChanged = descendants.some(\n (newDescendant, position) => {\n return (\n previousDescendants &&\n previousDescendants[position] &&\n previousDescendants[position].element !== newDescendant.element\n );\n }\n );\n\n // Prevent any flashing\n useEnhancedEffect(() => {\n if (descendant.element) {\n registerDescendant({\n ...descendant,\n index,\n });\n return () => {\n unregisterDescendant(descendant.element!);\n };\n }\n forceUpdate({});\n\n return undefined;\n }, [\n registerDescendant,\n unregisterDescendant,\n index,\n someDescendantsHaveChanged,\n descendant,\n ]);\n\n return { parentId, index };\n}\n\ninterface DescendantProviderProps {\n id?: string;\n children: React.ReactNode;\n}\n\nexport const DescendantProvider = (props: DescendantProviderProps) => {\n const { children, id } = props;\n\n const [items, set] = React.useState<\n (TreeItemDescendant & { index: number })[]\n >([]);\n\n const registerDescendant = React.useCallback(\n ({ element, ...other }: TreeItemDescendant) => {\n set((oldItems) => {\n if (oldItems.length === 0) {\n // If there are no items, register at index 0 and bail.\n return [\n {\n ...other,\n element,\n index: 0,\n },\n ];\n }\n\n const index = binaryFindElement(oldItems, element);\n let newItems: typeof oldItems;\n\n if (oldItems[index] && oldItems[index].element === element) {\n // If the element is already registered, just use the same array\n newItems = oldItems;\n } else {\n // When registering a descendant, we need to make sure we insert in\n // into the array in the same order that it appears in the DOM. So as\n // new descendants are added or maybe some are removed, we always know\n // that the array is up-to-date and correct.\n //\n // So here we look at our registered descendants and see if the new\n // element we are adding appears earlier than an existing descendant's\n // DOM node via `node.compareDocumentPosition`. If it does, we insert\n // the new element at this index. Because `registerDescendant` will be\n // called in an effect every time the descendants state value changes,\n // we should be sure that this index is accurate when descendent\n // elements come or go from our component.\n\n const newItem = {\n ...other,\n element,\n index,\n };\n\n // If an index is not found we will push the element to the end.\n newItems = oldItems.slice();\n newItems.splice(index, 0, newItem);\n }\n newItems.forEach((item, position) => {\n item.index = position;\n });\n return newItems;\n });\n },\n []\n );\n\n const unregisterDescendant = React.useCallback((element: HTMLLIElement) => {\n set((oldItems) => oldItems.filter((item) => element !== item.element));\n }, []);\n\n const value = React.useMemo(\n () => ({\n descendants: items,\n registerDescendant,\n unregisterDescendant,\n parentId: id,\n }),\n [items, registerDescendant, unregisterDescendant, id]\n );\n\n return (\n <DescendantContext.Provider value={value}>\n {children}\n </DescendantContext.Provider>\n );\n};\n"],"names":["findIndex","array","comp","i","length","binaryFindElement","element","start","end","middle","Math","floor","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","DescendantContext","React","createContext","usePrevious","value","ref","useRef","useEffect","current","noop","useDescendant","descendant","forceUpdate","useState","registerDescendant","unregisterDescendant","descendants","parentId","useContext","index","item","previousDescendants","someDescendantsHaveChanged","some","newDescendant","position","useEnhancedEffect","undefined","DescendantProvider","props","children","id","items","set","useCallback","other","oldItems","newItems","newItem","slice","splice","forEach","filter","useMemo"],"mappings":";;;AAQA,SAASA,UAAaC,OAAYC,MAA4B;AAC5D,WAASC,IAAI,GAAGA,IAAIF,MAAMG,QAAQD,KAAK,GAA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a;AACnCL,aAAKD,QAAQM;AAAAA,MAAAA,CACd;AACMY,aAAAA;AAAAA,IAAAA,CACR;AAAA,EACH,GACA,CACF,CAAA;AAEA,QAAMtB,uBAAuBd,MAAMiC,YAAY,CAAC3C,YAA2B;AACzE0C,QAAKG,cAAaA,SAASM,OAAQtB,UAAS7B,YAAY6B,KAAK7B,OAAO,CAAC;AAAA,EACvE,GAAG,CAAE,CAAA;AAECa,QAAAA,QAAQH,MAAM0C,QAClB,OAAO;AAAA,IACL3B,aAAagB;AAAAA,IACblB;AAAAA,IACAC;AAAAA,IACAE,UAAUc;AAAAA,EAAAA,IAEZ,CAACC,OAAOlB,oBAAoBC,sBAAsBgB,EAAE,CACtD;AAEA,SACG,oBAAA,kBAAkB,UAAlB,EAA2B,OACzBD,SACH,CAAA;AAEJ;"}
@@ -14,9 +14,6 @@ const DEFAULT_TREE_VIEW_CONTEXT_VALUE = {
14
14
  }
15
15
  };
16
16
  const TreeViewContext = createContext(DEFAULT_TREE_VIEW_CONTEXT_VALUE);
17
- if (process.env.NODE_ENV !== "production") {
18
- TreeViewContext.displayName = "TreeViewContext";
19
- }
20
17
  const TreeViewProvider = (props) => {
21
18
  const {
22
19
  value,
@@ -1 +1 @@
1
- {"version":3,"file":"TreeViewProvider.js","sources":["../../../../../src/components/TreeView/internals/TreeViewProvider.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nimport { TreeViewAnyPluginSignature, TreeViewInstance } from \"./types\";\nimport { DescendantProvider } from \"./DescendantProvider\";\n\nexport interface TreeViewContextValue<\n TPlugins extends readonly TreeViewAnyPluginSignature[]\n> {\n treeId: string | undefined;\n instance: TreeViewInstance<TPlugins> | null;\n multiSelect: boolean;\n disabledItemsFocusable: boolean;\n icons: {\n defaultCollapseIcon: React.ReactNode;\n defaultExpandIcon: React.ReactNode;\n defaultParentIcon: React.ReactNode;\n defaultEndIcon: React.ReactNode;\n };\n}\n\nexport const DEFAULT_TREE_VIEW_CONTEXT_VALUE: TreeViewContextValue<any> = {\n instance: null,\n multiSelect: false,\n disabledItemsFocusable: false,\n treeId: undefined,\n icons: {\n defaultCollapseIcon: null,\n defaultExpandIcon: null,\n defaultParentIcon: null,\n defaultEndIcon: null,\n },\n};\n\n/**\n * @ignore - internal component.\n */\nexport const TreeViewContext = createContext<TreeViewContextValue<any>>(\n DEFAULT_TREE_VIEW_CONTEXT_VALUE\n);\n\nif (process.env.NODE_ENV !== \"production\") {\n TreeViewContext.displayName = \"TreeViewContext\";\n}\n\nexport interface TreeViewProviderProps<\n TPlugins extends readonly TreeViewAnyPluginSignature[]\n> {\n value: TreeViewContextValue<TPlugins>;\n children: React.ReactNode;\n}\n\n/**\n * Sets up the contexts for the underlying TreeItem components.\n *\n * @ignore - do not document.\n */\nexport const TreeViewProvider = <\n TPlugins extends readonly TreeViewAnyPluginSignature[]\n>(\n props: TreeViewProviderProps<TPlugins>\n) => {\n const { value, children } = props;\n\n return (\n <TreeViewContext.Provider value={value}>\n <DescendantProvider>{children}</DescendantProvider>\n </TreeViewContext.Provider>\n );\n};\n\nexport const useTreeViewContext = <\n TPlugins extends readonly TreeViewAnyPluginSignature[]\n>() => useContext(TreeViewContext) as TreeViewContextValue<TPlugins>;\n"],"names":["DEFAULT_TREE_VIEW_CONTEXT_VALUE","instance","multiSelect","disabledItemsFocusable","treeId","undefined","icons","defaultCollapseIcon","defaultExpandIcon","defaultParentIcon","defaultEndIcon","TreeViewContext","createContext","process","env","NODE_ENV","displayName","TreeViewProvider","props","value","children","useTreeViewContext","useContext"],"mappings":";;;AAoBO,MAAMA,kCAA6D;AAAA,EACxEC,UAAU;AAAA,EACVC,aAAa;AAAA,EACbC,wBAAwB;AAAA,EACxBC,QAAQC;AAAAA,EACRC,OAAO;AAAA,IACLC,qBAAqB;AAAA,IACrBC,mBAAmB;AAAA,IACnBC,mBAAmB;AAAA,IACnBC,gBAAgB;AAAA,EAClB;AACF;AAKaC,MAAAA,kBAAkBC,cAC7BZ,+BACF;AAEA,IAAIa,QAAQC,IAAIC,aAAa,cAAc;AACzCJ,kBAAgBK,cAAc;AAChC;AAcaC,MAAAA,mBAAmB,CAG9BC,UACG;AACG,QAAA;AAAA,IAAEC;AAAAA,IAAOC;AAAAA,EAAaF,IAAAA;AAG1B,SAAA,oBAAC,gBAAgB,UAAhB,EAAyB,OACxB,UAAC,oBAAA,oBAAA,EAAoBE,SAAS,CAAA,EAChC,CAAA;AAEJ;AAEaC,MAAAA,qBAAqB,MAE3BC,WAAWX,eAAe;"}
1
+ {"version":3,"file":"TreeViewProvider.js","sources":["../../../../../src/components/TreeView/internals/TreeViewProvider.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nimport { TreeViewAnyPluginSignature, TreeViewInstance } from \"./types\";\nimport { DescendantProvider } from \"./DescendantProvider\";\n\nexport interface TreeViewContextValue<\n TPlugins extends readonly TreeViewAnyPluginSignature[]\n> {\n treeId: string | undefined;\n instance: TreeViewInstance<TPlugins> | null;\n multiSelect: boolean;\n disabledItemsFocusable: boolean;\n icons: {\n defaultCollapseIcon: React.ReactNode;\n defaultExpandIcon: React.ReactNode;\n defaultParentIcon: React.ReactNode;\n defaultEndIcon: React.ReactNode;\n };\n}\n\nexport const DEFAULT_TREE_VIEW_CONTEXT_VALUE: TreeViewContextValue<any> = {\n instance: null,\n multiSelect: false,\n disabledItemsFocusable: false,\n treeId: undefined,\n icons: {\n defaultCollapseIcon: null,\n defaultExpandIcon: null,\n defaultParentIcon: null,\n defaultEndIcon: null,\n },\n};\n\n/**\n * @ignore - internal component.\n */\nexport const TreeViewContext = createContext<TreeViewContextValue<any>>(\n DEFAULT_TREE_VIEW_CONTEXT_VALUE\n);\n\nexport interface TreeViewProviderProps<\n TPlugins extends readonly TreeViewAnyPluginSignature[]\n> {\n value: TreeViewContextValue<TPlugins>;\n children: React.ReactNode;\n}\n\n/**\n * Sets up the contexts for the underlying TreeItem components.\n *\n * @ignore - do not document.\n */\nexport const TreeViewProvider = <\n TPlugins extends readonly TreeViewAnyPluginSignature[]\n>(\n props: TreeViewProviderProps<TPlugins>\n) => {\n const { value, children } = props;\n\n return (\n <TreeViewContext.Provider value={value}>\n <DescendantProvider>{children}</DescendantProvider>\n </TreeViewContext.Provider>\n );\n};\n\nexport const useTreeViewContext = <\n TPlugins extends readonly TreeViewAnyPluginSignature[]\n>() => useContext(TreeViewContext) as TreeViewContextValue<TPlugins>;\n"],"names":["DEFAULT_TREE_VIEW_CONTEXT_VALUE","instance","multiSelect","disabledItemsFocusable","treeId","undefined","icons","defaultCollapseIcon","defaultExpandIcon","defaultParentIcon","defaultEndIcon","TreeViewContext","createContext","TreeViewProvider","props","value","children","useTreeViewContext","useContext"],"mappings":";;;AAoBO,MAAMA,kCAA6D;AAAA,EACxEC,UAAU;AAAA,EACVC,aAAa;AAAA,EACbC,wBAAwB;AAAA,EACxBC,QAAQC;AAAAA,EACRC,OAAO;AAAA,IACLC,qBAAqB;AAAA,IACrBC,mBAAmB;AAAA,IACnBC,mBAAmB;AAAA,IACnBC,gBAAgB;AAAA,EAClB;AACF;AAKaC,MAAAA,kBAAkBC,cAC7BZ,+BACF;AAcaa,MAAAA,mBAAmB,CAG9BC,UACG;AACG,QAAA;AAAA,IAAEC;AAAAA,IAAOC;AAAAA,EAAaF,IAAAA;AAG1B,SAAA,oBAAC,gBAAgB,UAAhB,EAAyB,OACxB,UAAC,oBAAA,oBAAA,EAAoBE,SAAS,CAAA,EAChC,CAAA;AAEJ;AAEaC,MAAAA,qBAAqB,MAE3BC,WAAWP,eAAe;"}
@@ -1,20 +1,10 @@
1
1
  const typographyVariants = ["display", "title1", "title2", "title3", "title4", "body", "label", "caption1", "caption2"];
2
2
  const mappableVariants = /* @__PURE__ */ new Map([["3xlTitle", "display"], ["xlTitle", "title1"], ["mTitle", "title2"], ["xsTitle", "title3"], ["highlightText", "label"], ["normalText", "body"], ["vizText", "caption1"]]);
3
- const isLegacyVariant = (variant) => {
4
- return ["5xlTitle", "4xlTitle", "3xlTitle", "xxlTitle", "xlTitle", "lTitle", "mTitle", "sTitle", "xsTitle", "xxsTitle", "sectionTitle", "highlightText", "normalText", "placeholderText", "link", "disabledText", "selectedNavText", "vizText", "vizTextDisabled", "xsInlineLink"].includes(variant);
5
- };
6
3
  const mapVariant = (variant, theme) => {
4
+ if (theme === "ds3")
5
+ return variant;
7
6
  const mappedVariant = mappableVariants.get(variant);
8
- if (theme !== "ds3") {
9
- if (mappedVariant) {
10
- console.warn(`The typography variant ${variant} is deprecated. You should use ${mappedVariant} instead.`);
11
- return mappedVariant;
12
- }
13
- if (isLegacyVariant(variant)) {
14
- console.warn(`The typography variant ${variant} is deprecated.`);
15
- }
16
- }
17
- return variant;
7
+ return mappedVariant || variant;
18
8
  };
19
9
  export {
20
10
  mapVariant,
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../src/components/Typography/utils.ts"],"sourcesContent":["export const typographyVariants = [\n \"display\",\n \"title1\",\n \"title2\",\n \"title3\",\n \"title4\",\n \"body\",\n \"label\",\n \"caption1\",\n \"caption2\",\n] as const;\n\nexport type HvTypographyVariants = (typeof typographyVariants)[number];\n\n/** @deprecated */\nexport type HvTypographyLegacyVariants =\n | \"5xlTitle\"\n | \"4xlTitle\"\n | \"3xlTitle\"\n | \"xxlTitle\"\n | \"xlTitle\"\n | \"lTitle\"\n | \"mTitle\"\n | \"sTitle\"\n | \"xsTitle\"\n | \"xxsTitle\"\n | \"sectionTitle\"\n | \"highlightText\"\n | \"normalText\"\n | \"placeholderText\"\n | \"link\"\n | \"disabledText\"\n | \"selectedNavText\"\n | \"vizText\"\n | \"vizTextDisabled\"\n | \"xsInlineLink\";\n\ntype Variant = HvTypographyVariants | HvTypographyLegacyVariants;\n\nconst mappableVariants = new Map<Variant, HvTypographyVariants>([\n [\"3xlTitle\", \"display\"],\n [\"xlTitle\", \"title1\"],\n [\"mTitle\", \"title2\"],\n [\"xsTitle\", \"title3\"],\n [\"highlightText\", \"label\"],\n [\"normalText\", \"body\"],\n [\"vizText\", \"caption1\"],\n]);\n\nconst isLegacyVariant = (variant: string) => {\n return [\n \"5xlTitle\",\n \"4xlTitle\",\n \"3xlTitle\",\n \"xxlTitle\",\n \"xlTitle\",\n \"lTitle\",\n \"mTitle\",\n \"sTitle\",\n \"xsTitle\",\n \"xxsTitle\",\n \"sectionTitle\",\n \"highlightText\",\n \"normalText\",\n \"placeholderText\",\n \"link\",\n \"disabledText\",\n \"selectedNavText\",\n \"vizText\",\n \"vizTextDisabled\",\n \"xsInlineLink\",\n ].includes(variant);\n};\n\nexport const mapVariant = (variant: Variant, theme?: string) => {\n const mappedVariant = mappableVariants.get(variant);\n\n if (theme !== \"ds3\") {\n if (mappedVariant) {\n // eslint-disable-next-line no-console\n console.warn(\n `The typography variant ${variant} is deprecated. You should use ${mappedVariant} instead.`\n );\n return mappedVariant;\n }\n if (isLegacyVariant(variant)) {\n // eslint-disable-next-line no-console\n console.warn(`The typography variant ${variant} is deprecated.`);\n }\n }\n\n return variant;\n};\n"],"names":["typographyVariants","mappableVariants","Map","isLegacyVariant","variant","includes","mapVariant","theme","mappedVariant","get","console","warn"],"mappings":"AAAaA,MAAAA,qBAAqB,CAChC,WACA,UACA,UACA,UACA,UACA,QACA,SACA,YACA,UAAU;AA8BZ,MAAMC,mBAAmB,oBAAIC,IAAmC,CAC9D,CAAC,YAAY,SAAS,GACtB,CAAC,WAAW,QAAQ,GACpB,CAAC,UAAU,QAAQ,GACnB,CAAC,WAAW,QAAQ,GACpB,CAAC,iBAAiB,OAAO,GACzB,CAAC,cAAc,MAAM,GACrB,CAAC,WAAW,UAAU,CAAC,CACxB;AAED,MAAMC,kBAAkBA,CAACC,YAAoB;AACpC,SAAA,CACL,YACA,YACA,YACA,YACA,WACA,UACA,UACA,UACA,WACA,YACA,gBACA,iBACA,cACA,mBACA,QACA,gBACA,mBACA,WACA,mBACA,cAAc,EACdC,SAASD,OAAO;AACpB;AAEaE,MAAAA,aAAaA,CAACF,SAAkBG,UAAmB;AACxDC,QAAAA,gBAAgBP,iBAAiBQ,IAAIL,OAAO;AAElD,MAAIG,UAAU,OAAO;AACnB,QAAIC,eAAe;AAEjBE,cAAQC,KACL,0BAAyBP,OAAQ,kCAAiCI,aAAc,WACnF;AACOA,aAAAA;AAAAA,IACT;AACIL,QAAAA,gBAAgBC,OAAO,GAAG;AAEpBO,cAAAA,KAAM,0BAAyBP,OAAQ,iBAAgB;AAAA,IACjE;AAAA,EACF;AAEOA,SAAAA;AACT;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../src/components/Typography/utils.ts"],"sourcesContent":["export const typographyVariants = [\n \"display\",\n \"title1\",\n \"title2\",\n \"title3\",\n \"title4\",\n \"body\",\n \"label\",\n \"caption1\",\n \"caption2\",\n] as const;\n\nexport type HvTypographyVariants = (typeof typographyVariants)[number];\n\n/** @deprecated */\nexport type HvTypographyLegacyVariants =\n | \"5xlTitle\"\n | \"4xlTitle\"\n | \"3xlTitle\"\n | \"xxlTitle\"\n | \"xlTitle\"\n | \"lTitle\"\n | \"mTitle\"\n | \"sTitle\"\n | \"xsTitle\"\n | \"xxsTitle\"\n | \"sectionTitle\"\n | \"highlightText\"\n | \"normalText\"\n | \"placeholderText\"\n | \"link\"\n | \"disabledText\"\n | \"selectedNavText\"\n | \"vizText\"\n | \"vizTextDisabled\"\n | \"xsInlineLink\";\n\ntype Variant = HvTypographyVariants | HvTypographyLegacyVariants;\n\nconst mappableVariants = new Map<Variant, HvTypographyVariants>([\n [\"3xlTitle\", \"display\"],\n [\"xlTitle\", \"title1\"],\n [\"mTitle\", \"title2\"],\n [\"xsTitle\", \"title3\"],\n [\"highlightText\", \"label\"],\n [\"normalText\", \"body\"],\n [\"vizText\", \"caption1\"],\n]);\n\nconst isLegacyVariant = (variant: string) => {\n return [\n \"5xlTitle\",\n \"4xlTitle\",\n \"3xlTitle\",\n \"xxlTitle\",\n \"xlTitle\",\n \"lTitle\",\n \"mTitle\",\n \"sTitle\",\n \"xsTitle\",\n \"xxsTitle\",\n \"sectionTitle\",\n \"highlightText\",\n \"normalText\",\n \"placeholderText\",\n \"link\",\n \"disabledText\",\n \"selectedNavText\",\n \"vizText\",\n \"vizTextDisabled\",\n \"xsInlineLink\",\n ].includes(variant);\n};\n\nexport const mapVariant = (variant: Variant, theme?: string) => {\n if (theme === \"ds3\") return variant;\n const mappedVariant = mappableVariants.get(variant);\n\n if (import.meta.env.DEV) {\n /* eslint-disable no-console */\n const msg = `The typography variant ${variant} is deprecated.`;\n if (mappedVariant) {\n console.warn(`${msg} Use ${mappedVariant} instead.`);\n }\n if (isLegacyVariant(variant)) {\n console.warn(msg);\n }\n }\n\n return mappedVariant || variant;\n};\n"],"names":["typographyVariants","mappableVariants","Map","mapVariant","variant","theme","mappedVariant","get"],"mappings":"AAAaA,MAAAA,qBAAqB,CAChC,WACA,UACA,UACA,UACA,UACA,QACA,SACA,YACA,UAAU;AA8BZ,MAAMC,mBAAmB,oBAAIC,IAAmC,CAC9D,CAAC,YAAY,SAAS,GACtB,CAAC,WAAW,QAAQ,GACpB,CAAC,UAAU,QAAQ,GACnB,CAAC,WAAW,QAAQ,GACpB,CAAC,iBAAiB,OAAO,GACzB,CAAC,cAAc,MAAM,GACrB,CAAC,WAAW,UAAU,CAAC,CACxB;AA2BYC,MAAAA,aAAaA,CAACC,SAAkBC,UAAmB;AAC9D,MAAIA,UAAU;AAAcD,WAAAA;AACtBE,QAAAA,gBAAgBL,iBAAiBM,IAAIH,OAAO;AAalD,SAAOE,iBAAiBF;AAC1B;"}
@@ -21,9 +21,6 @@ const DescendantContext = createContext({
21
21
  level: 0,
22
22
  descendants: []
23
23
  });
24
- if (process.env.NODE_ENV !== "production") {
25
- DescendantContext.displayName = "DescendantContext";
26
- }
27
24
  function usePrevious(value) {
28
25
  const ref = useRef(null);
29
26
  useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"descendants.js","sources":["../../../../../src/components/VerticalNavigation/TreeView/descendants.tsx"],"sourcesContent":["/**\n * Copied from https://github.com/mui-org/material-ui/blob/8763de1633d80295e7b83d8c21040dad333e6699/packages/material-ui-lab/src/TreeView/descendants.js\n * Credit: https://github.com/reach/reach-ui/blob/86a046f54d53b6420e392b3fa56dd991d9d4e458/packages/descendants/README.md\n *\n * - Added level (depth) property.\n * - Use local copy of useEnhancedEffect.\n */\n\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport { useEnhancedEffect } from \"@core/hooks\";\n\ntype Item = {\n element?;\n index?;\n [key: string]: unknown;\n};\n\nfunction binaryFindElement(array, element) {\n let start = 0;\n let end = array.length - 1;\n\n while (start <= end) {\n const middle = Math.floor((start + end) / 2);\n\n if (array[middle].element === element) {\n return middle;\n }\n\n if (\n array[middle].element.compareDocumentPosition(element) &&\n Node.DOCUMENT_POSITION_PRECEDING\n ) {\n end = middle - 1;\n } else {\n start = middle + 1;\n }\n }\n\n return start;\n}\n\nconst DescendantContext = createContext<DescendantContextValue>({\n level: 0,\n descendants: [],\n});\n\ninterface DescendantContextValue {\n level?: number;\n registerDescendant?;\n unregisterDescendant?;\n descendants: Item[];\n parentId?;\n}\n\nif (process.env.NODE_ENV !== \"production\") {\n DescendantContext.displayName = \"DescendantContext\";\n}\n\nfunction usePrevious(value) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current;\n}\n\nconst noop = () => {};\n\n/**\n * This hook registers our descendant by passing it into an array. We can then\n * search that array by to find its index when registering it in the component.\n * We use this for focus management, keyboard navigation, and typeahead\n * functionality for some components.\n *\n * The hook accepts the element node\n *\n * Our main goals with this are:\n * 1) maximum composability,\n * 2) minimal API friction\n * 3) SSR compatibility*\n * 4) concurrent safe\n * 5) index always up-to-date with the tree despite changes\n * 6) works with memoization of any component in the tree (hopefully)\n *\n * * As for SSR, the good news is that we don't actually need the index on the\n * server for most use-cases, as we are only using it to determine the order of\n * composed descendants for keyboard navigation.\n */\nexport function useDescendant(descendant) {\n const [, forceUpdate] = useState<{} | null>();\n const {\n registerDescendant = noop,\n unregisterDescendant = noop,\n descendants = [],\n parentId = null,\n level = 0,\n } = useContext(DescendantContext);\n\n // This will initially return -1 because we haven't registered the descendant\n // on the first render. After we register, this will then return the correct\n // index on the following render and we will re-register descendants\n // so that everything is up-to-date before the user interacts with a\n // collection.\n const index = descendants.findIndex(\n (item) => item.element === descendant.element\n );\n\n const previousDescendants: Item[] | null = usePrevious(descendants);\n\n // We also need to re-register descendants any time ANY of the other\n // descendants have changed. My brain was melting when I wrote this and it\n // feels a little off, but checking in render and using the result in the\n // effect's dependency array works well enough.\n const someDescendantsHaveChanged = descendants.some(\n (newDescendant, position) => {\n return (\n previousDescendants && previousDescendants[position]\n // previousDescendants[position].element !== newDescendant.element\n // was not able to type check this, did not any difference\n );\n }\n );\n\n // Prevent any flashing\n useEnhancedEffect(() => {\n if (descendant.element) {\n registerDescendant({\n ...descendant,\n index,\n });\n return () => {\n unregisterDescendant(descendant.element);\n };\n }\n forceUpdate({});\n\n return undefined;\n }, [\n registerDescendant,\n unregisterDescendant,\n index,\n someDescendantsHaveChanged,\n descendant,\n ]);\n\n return { parentId, index, level };\n}\n\nexport const DescendantProvider = (props: DescendantProviderProps) => {\n const { children, id, level } = props;\n\n const [items, set] = useState<Item[]>([]);\n\n const registerDescendant = useCallback(({ element, ...other }) => {\n set((oldItems) => {\n let newItems;\n if (oldItems.length === 0) {\n // If there are no items, register at index 0 and bail.\n return [\n {\n ...other,\n element,\n index: 0,\n },\n ];\n }\n\n const index = binaryFindElement(oldItems, element);\n\n if (oldItems[index] && oldItems[index].element === element) {\n // If the element is already registered, just use the same array\n newItems = oldItems;\n } else {\n // When registering a descendant, we need to make sure we insert in\n // into the array in the same order that it appears in the DOM. So as\n // new descendants are added or maybe some are removed, we always know\n // that the array is up-to-date and correct.\n //\n // So here we look at our registered descendants and see if the new\n // element we are adding appears earlier than an existing descendant's\n // DOM node via `node.compareDocumentPosition`. If it does, we insert\n // the new element at this index. Because `registerDescendant` will be\n // called in an effect every time the descendants state value changes,\n // we should be sure that this index is accurate when descendent\n // elements come or go from our component.\n\n const newItem = {\n ...other,\n element,\n index,\n };\n\n // If an index is not found we will push the element to the end.\n newItems = oldItems.slice();\n newItems.splice(index, 0, newItem);\n }\n newItems.forEach((item, position) => {\n item.index = position;\n });\n return newItems;\n });\n }, []);\n\n const unregisterDescendant = useCallback((element: Item) => {\n set((oldItems) =>\n oldItems.filter((item: Item) => element !== item.element)\n );\n }, []);\n\n const value = useMemo(\n () => ({\n descendants: items,\n registerDescendant,\n unregisterDescendant,\n parentId: id,\n level,\n }),\n [items, registerDescendant, unregisterDescendant, id, level]\n );\n\n return (\n <DescendantContext.Provider value={value}>\n {children}\n </DescendantContext.Provider>\n );\n};\n\nexport type DescendantProviderProps = {\n children?: React.ReactNode;\n id?: string;\n level?: number;\n};\n"],"names":["binaryFindElement","array","element","start","end","length","middle","Math","floor","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","DescendantContext","createContext","level","descendants","process","env","NODE_ENV","displayName","usePrevious","value","ref","useRef","useEffect","current","noop","useDescendant","descendant","forceUpdate","useState","registerDescendant","unregisterDescendant","parentId","useContext","index","findIndex","item","previousDescendants","someDescendantsHaveChanged","some","newDescendant","position","useEnhancedEffect","undefined","DescendantProvider","props","children","id","items","set","useCallback","other","oldItems","newItems","newItem","slice","splice","forEach","filter","useMemo"],"mappings":";;;AA0BA,SAASA,kBAAkBC,OAAOC,SAAS;AACzC,MAAIC,QAAQ;AACRC,MAAAA,MAAMH,MAAMI,SAAS;AAEzB,SAAOF,SAASC,KAAK;AACnB,UAAME,SAASC,KAAKC,OAAOL,QAAQC,OAAO,CAAC;AAE3C,QAAIH,MAAMK,MAAM,EAAEJ,YAAYA,SAAS;AAC9BI,aAAAA;AAAAA,IACT;AAGEL,QAAAA,MAAMK,MAAM,EAAEJ,QAAQO,wBAAwBP,OAAO,KACrDQ,KAAKC,6BACL;AACAP,YAAME,SAAS;AAAA,IAAA,OACV;AACLH,cAAQG,SAAS;A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IlC,KAAK,CAC7D;AAEA,SACG,oBAAA,kBAAkB,UAAlB,EAA2B,OACzBiC,SACH,CAAA;AAEJ;"}
1
+ {"version":3,"file":"descendants.js","sources":["../../../../../src/components/VerticalNavigation/TreeView/descendants.tsx"],"sourcesContent":["/**\n * Copied from https://github.com/mui-org/material-ui/blob/8763de1633d80295e7b83d8c21040dad333e6699/packages/material-ui-lab/src/TreeView/descendants.js\n * Credit: https://github.com/reach/reach-ui/blob/86a046f54d53b6420e392b3fa56dd991d9d4e458/packages/descendants/README.md\n *\n * - Added level (depth) property.\n * - Use local copy of useEnhancedEffect.\n */\n\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport { useEnhancedEffect } from \"@core/hooks\";\n\ntype Item = {\n element?;\n index?;\n [key: string]: unknown;\n};\n\nfunction binaryFindElement(array, element) {\n let start = 0;\n let end = array.length - 1;\n\n while (start <= end) {\n const middle = Math.floor((start + end) / 2);\n\n if (array[middle].element === element) {\n return middle;\n }\n\n if (\n array[middle].element.compareDocumentPosition(element) &&\n Node.DOCUMENT_POSITION_PRECEDING\n ) {\n end = middle - 1;\n } else {\n start = middle + 1;\n }\n }\n\n return start;\n}\n\nconst DescendantContext = createContext<DescendantContextValue>({\n level: 0,\n descendants: [],\n});\n\ninterface DescendantContextValue {\n level?: number;\n registerDescendant?;\n unregisterDescendant?;\n descendants: Item[];\n parentId?;\n}\n\nfunction usePrevious(value) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current;\n}\n\nconst noop = () => {};\n\n/**\n * This hook registers our descendant by passing it into an array. We can then\n * search that array by to find its index when registering it in the component.\n * We use this for focus management, keyboard navigation, and typeahead\n * functionality for some components.\n *\n * The hook accepts the element node\n *\n * Our main goals with this are:\n * 1) maximum composability,\n * 2) minimal API friction\n * 3) SSR compatibility*\n * 4) concurrent safe\n * 5) index always up-to-date with the tree despite changes\n * 6) works with memoization of any component in the tree (hopefully)\n *\n * * As for SSR, the good news is that we don't actually need the index on the\n * server for most use-cases, as we are only using it to determine the order of\n * composed descendants for keyboard navigation.\n */\nexport function useDescendant(descendant) {\n const [, forceUpdate] = useState<{} | null>();\n const {\n registerDescendant = noop,\n unregisterDescendant = noop,\n descendants = [],\n parentId = null,\n level = 0,\n } = useContext(DescendantContext);\n\n // This will initially return -1 because we haven't registered the descendant\n // on the first render. After we register, this will then return the correct\n // index on the following render and we will re-register descendants\n // so that everything is up-to-date before the user interacts with a\n // collection.\n const index = descendants.findIndex(\n (item) => item.element === descendant.element\n );\n\n const previousDescendants: Item[] | null = usePrevious(descendants);\n\n // We also need to re-register descendants any time ANY of the other\n // descendants have changed. My brain was melting when I wrote this and it\n // feels a little off, but checking in render and using the result in the\n // effect's dependency array works well enough.\n const someDescendantsHaveChanged = descendants.some(\n (newDescendant, position) => {\n return (\n previousDescendants && previousDescendants[position]\n // previousDescendants[position].element !== newDescendant.element\n // was not able to type check this, did not any difference\n );\n }\n );\n\n // Prevent any flashing\n useEnhancedEffect(() => {\n if (descendant.element) {\n registerDescendant({\n ...descendant,\n index,\n });\n return () => {\n unregisterDescendant(descendant.element);\n };\n }\n forceUpdate({});\n\n return undefined;\n }, [\n registerDescendant,\n unregisterDescendant,\n index,\n someDescendantsHaveChanged,\n descendant,\n ]);\n\n return { parentId, index, level };\n}\n\nexport const DescendantProvider = (props: DescendantProviderProps) => {\n const { children, id, level } = props;\n\n const [items, set] = useState<Item[]>([]);\n\n const registerDescendant = useCallback(({ element, ...other }) => {\n set((oldItems) => {\n let newItems;\n if (oldItems.length === 0) {\n // If there are no items, register at index 0 and bail.\n return [\n {\n ...other,\n element,\n index: 0,\n },\n ];\n }\n\n const index = binaryFindElement(oldItems, element);\n\n if (oldItems[index] && oldItems[index].element === element) {\n // If the element is already registered, just use the same array\n newItems = oldItems;\n } else {\n // When registering a descendant, we need to make sure we insert in\n // into the array in the same order that it appears in the DOM. So as\n // new descendants are added or maybe some are removed, we always know\n // that the array is up-to-date and correct.\n //\n // So here we look at our registered descendants and see if the new\n // element we are adding appears earlier than an existing descendant's\n // DOM node via `node.compareDocumentPosition`. If it does, we insert\n // the new element at this index. Because `registerDescendant` will be\n // called in an effect every time the descendants state value changes,\n // we should be sure that this index is accurate when descendent\n // elements come or go from our component.\n\n const newItem = {\n ...other,\n element,\n index,\n };\n\n // If an index is not found we will push the element to the end.\n newItems = oldItems.slice();\n newItems.splice(index, 0, newItem);\n }\n newItems.forEach((item, position) => {\n item.index = position;\n });\n return newItems;\n });\n }, []);\n\n const unregisterDescendant = useCallback((element: Item) => {\n set((oldItems) =>\n oldItems.filter((item: Item) => element !== item.element)\n );\n }, []);\n\n const value = useMemo(\n () => ({\n descendants: items,\n registerDescendant,\n unregisterDescendant,\n parentId: id,\n level,\n }),\n [items, registerDescendant, unregisterDescendant, id, level]\n );\n\n return (\n <DescendantContext.Provider value={value}>\n {children}\n </DescendantContext.Provider>\n );\n};\n\nexport type DescendantProviderProps = {\n children?: React.ReactNode;\n id?: string;\n level?: number;\n};\n"],"names":["binaryFindElement","array","element","start","end","length","middle","Math","floor","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","DescendantContext","createContext","level","descendants","usePrevious","value","ref","useRef","useEffect","current","noop","useDescendant","descendant","forceUpdate","useState","registerDescendant","unregisterDescendant","parentId","useContext","index","findIndex","item","previousDescendants","someDescendantsHaveChanged","some","newDescendant","position","useEnhancedEffect","undefined","DescendantProvider","props","children","id","items","set","useCallback","other","oldItems","newItems","newItem","slice","splice","forEach","filter","useMemo"],"mappings":";;;AA0BA,SAASA,kBAAkBC,OAAOC,SAAS;AACzC,MAAIC,QAAQ;AACRC,MAAAA,MAAMH,MAAMI,SAAS;AAEzB,SAAOF,SAASC,KAAK;AACnB,UAAME,SAASC,KAAKC,OAAOL,QAAQC,OAAO,CAAC;AAE3C,QAAIH,MAAMK,MAAM,EAAEJ,YAAYA,SAAS;AAC9BI,aAAAA;AAAAA,IACT;AAGEL,QA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;AAAAA,EAAAA,IAEF,CAAC+B,OAAOlB,oBAAoBC,sBAAsBgB,IAAI9B,KAAK,CAC7D;AAEA,SACG,oBAAA,kBAAkB,UAAlB,EAA2B,OACzB6B,SACH,CAAA;AAEJ;"}
@@ -5,9 +5,6 @@ const useControlled = (controlledProp, initialState) => {
5
5
  } = useRef(controlledProp !== void 0);
6
6
  const [valueState, setValue] = useState(initialState);
7
7
  const value = isControlled ? controlledProp : valueState;
8
- if (process.env.NODE_ENV !== "production" && isControlled !== (controlledProp !== void 0)) {
9
- console.error([`A component is changing the ${isControlled ? "" : "un"}controlled state to be ${isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", "Decide between using a controlled or uncontrolled element for the lifetime of the component.", "The nature of the state is determined during the first render, it's considered controlled if the value is not `undefined`."].join("\n"));
10
- }
11
8
  const setValueIfUncontrolled = useCallback((newValue) => {
12
9
  if (!isControlled) {
13
10
  setValue(newValue);
@@ -1 +1 @@
1
- {"version":3,"file":"useControlled.js","sources":["../../../src/hooks/useControlled.ts"],"sourcesContent":["// based in https://raw.githubusercontent.com/mui-org/material-ui/next/packages/material-ui/src/utils/useControlled.js\n// modifications:\n// 1. renamed default to initialState, to convey the same meaning of the useState hook.\n// 2. removed the console error when initialState changes; that is acceptable and just ignored, like in useState.\n// 3. the console error regarding switching from controlled to uncontrolled (or vice-versa) is sent synchronously\n// so the stacktrace shows the caller\n// 4. given that, the hook signature was simplified, no need for metadata\n\nimport { useRef, useState, useCallback } from \"react\";\n\nexport const useControlled = (controlledProp, initialState) => {\n const { current: isControlled } = useRef(controlledProp !== undefined);\n const [valueState, setValue] = useState(initialState);\n const value = isControlled ? controlledProp : valueState;\n\n if (\n process.env.NODE_ENV !== \"production\" &&\n isControlled !== (controlledProp !== undefined)\n ) {\n // eslint-disable-next-line no-console\n console.error(\n [\n `A component is changing the ${\n isControlled ? \"\" : \"un\"\n }controlled state to be ${isControlled ? \"un\" : \"\"}controlled.`,\n \"Elements should not switch from uncontrolled to controlled (or vice versa).\",\n \"Decide between using a controlled or uncontrolled element for the lifetime of the component.\",\n \"The nature of the state is determined during the first render, it's considered controlled if the value is not `undefined`.\",\n ].join(\"\\n\")\n );\n }\n\n const setValueIfUncontrolled = useCallback(\n (newValue) => {\n if (!isControlled) {\n setValue(newValue);\n }\n },\n [isControlled]\n );\n\n return [value, setValueIfUncontrolled];\n};\n"],"names":["useControlled","controlledProp","initialState","current","isControlled","useRef","undefined","valueState","setValue","useState","value","process","env","NODE_ENV","console","error","join","setValueIfUncontrolled","useCallback","newValue"],"mappings":";AAUaA,MAAAA,gBAAgBA,CAACC,gBAAgBC,iBAAiB;AACvD,QAAA;AAAA,IAAEC,SAASC;AAAAA,EAAa,IAAIC,OAAOJ,mBAAmBK,MAAS;AACrE,QAAM,CAACC,YAAYC,QAAQ,IAAIC,SAASP,YAAY;AAC9CQ,QAAAA,QAAQN,eAAeH,iBAAiBM;AAE9C,MACEI,QAAQC,IAAIC,aAAa,gBACzBT,kBAAkBH,mBAAmBK,SACrC;AAEAQ,YAAQC,MACN,CACG,+BACCX,eAAe,KAAK,IACrB,0BAAyBA,eAAe,OAAO,EAAG,eACnD,+EACA,gGACA,4HAA4H,EAC5HY,KAAK,IAAI,CACb;AAAA,EACF;AAEMC,QAAAA,yBAAyBC,YAC5BC,CAAa,aAAA;AACZ,QAAI,CAACf,cAAc;AACjBI,eAASW,QAAQ;AAAA,IACnB;AAAA,EAAA,GAEF,CAACf,YAAY,CACf;AAEO,SAAA,CAACM,OAAOO,sBAAsB;AACvC;"}
1
+ {"version":3,"file":"useControlled.js","sources":["../../../src/hooks/useControlled.ts"],"sourcesContent":["// based in https://raw.githubusercontent.com/mui-org/material-ui/next/packages/material-ui/src/utils/useControlled.js\n// modifications:\n// 1. renamed default to initialState, to convey the same meaning of the useState hook.\n// 2. removed the console error when initialState changes; that is acceptable and just ignored, like in useState.\n// 3. the console error regarding switching from controlled to uncontrolled (or vice-versa) is sent synchronously\n// so the stacktrace shows the caller\n// 4. given that, the hook signature was simplified, no need for metadata\n\nimport { useRef, useState, useCallback } from \"react\";\n\nexport const useControlled = (controlledProp, initialState) => {\n const { current: isControlled } = useRef(controlledProp !== undefined);\n const [valueState, setValue] = useState(initialState);\n const value = isControlled ? controlledProp : valueState;\n\n if (import.meta.env.DEV && isControlled !== (controlledProp !== undefined)) {\n // eslint-disable-next-line no-console\n console.error(\n [\n `A component is changing the ${\n isControlled ? \"\" : \"un\"\n }controlled state to be ${isControlled ? \"un\" : \"\"}controlled.`,\n \"Elements should not switch from uncontrolled to controlled (or vice versa).\",\n \"Decide between using a controlled or uncontrolled element for the lifetime of the component.\",\n \"The nature of the state is determined during the first render, it's considered controlled if the value is not `undefined`.\",\n ].join(\"\\n\")\n );\n }\n\n const setValueIfUncontrolled = useCallback(\n (newValue) => {\n if (!isControlled) {\n setValue(newValue);\n }\n },\n [isControlled]\n );\n\n return [value, setValueIfUncontrolled];\n};\n"],"names":["useControlled","controlledProp","initialState","current","isControlled","useRef","undefined","valueState","setValue","useState","value","setValueIfUncontrolled","useCallback","newValue"],"mappings":";AAUaA,MAAAA,gBAAgBA,CAACC,gBAAgBC,iBAAiB;AACvD,QAAA;AAAA,IAAEC,SAASC;AAAAA,EAAa,IAAIC,OAAOJ,mBAAmBK,MAAS;AACrE,QAAM,CAACC,YAAYC,QAAQ,IAAIC,SAASP,YAAY;AAC9CQ,QAAAA,QAAQN,eAAeH,iBAAiBM;AAgBxCI,QAAAA,yBAAyBC,YAC5BC,CAAa,aAAA;AACZ,QAAI,CAACT,cAAc;AACjBI,eAASK,QAAQ;AAAA,IACnB;AAAA,EAAA,GAEF,CAACT,YAAY,CACf;AAEO,SAAA,CAACM,OAAOC,sBAAsB;AACvC;"}
@@ -3,6 +3,7 @@ import { useMemo } from "react";
3
3
  import createCache from "@emotion/cache";
4
4
  import { CacheProvider, Global, css, ClassNames } from "@emotion/react";
5
5
  import { CssBaseline, getThemesVars, CssScopedBaseline } from "@hitachivantara/uikit-styles";
6
+ import { getElementById } from "../utils/document.js";
6
7
  import { processThemes } from "../utils/theme.js";
7
8
  import { useUniqueId } from "../hooks/useUniqueId.js";
8
9
  import { HvThemeProvider } from "./ThemeProvider.js";
@@ -25,12 +26,12 @@ const HvProvider = ({
25
26
  prepend: true
26
27
  }), [classNameKey]);
27
28
  return /* @__PURE__ */ jsxs(CacheProvider, { value: emotionCache, children: [
28
- /* @__PURE__ */ jsx(Global, { styles: /* @__PURE__ */ css(cssBaseline === "global" && CssBaseline, " ", getThemesVars(themesList), ";" + (process.env.NODE_ENV === "production" ? "" : ";label:HvProvider;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2h2LXVpa2l0LXJlYWN0L2h2LXVpa2l0LXJlYWN0L3BhY2thZ2VzL2NvcmUvc3JjL3Byb3ZpZGVycy9Qcm92aWRlci50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBbUh3QiIsImZpbGUiOiIvaG9tZS9ydW5uZXIvd29yay9odi11aWtpdC1yZWFjdC9odi11aWtpdC1yZWFjdC9wYWNrYWdlcy9jb3JlL3NyYy9wcm92aWRlcnMvUHJvdmlkZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0LCB7IHVzZU1lbW8gfSBmcm9tIFwicmVhY3RcIjtcblxuaW1wb3J0IGNyZWF0ZUNhY2hlIGZyb20gXCJAZW1vdGlvbi9jYWNoZVwiO1xuaW1wb3J0IHtcbiAgY3NzIGFzIGNzc1JlYWN0LFxuICBHbG9iYWwsXG4gIENhY2hlUHJvdmlkZXIsXG4gIENsYXNzTmFtZXMsXG59IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xuXG5pbXBvcnQge1xuICBDc3NCYXNlbGluZSxcbiAgQ3NzU2NvcGVkQmFzZWxpbmUsXG4gIGdldFRoZW1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dGhlbWVzTGlzdH1cbiAgICAgICAgdGhlbWU9e3RoZW1lIHx8IHRoZW1lc0xpc3RbMF0ubmFtZX1cbiAgICAgICAgZW1vdGlvbkNhY2hlPXtlbW90aW9uQ2FjaGV9XG4gICAgICAgIGNvbG9yTW9kZT17Y29sb3JNb2RlIHx8IE9iamVjdC5rZXlzKHRoZW1lc0xpc3RbMF0uY29sb3JzLm1vZGVzKVswXX1cbiAgICAgICAgdGhlbWVSb290SWQ9e1xuICAgICAgICAgIGNzc1RoZW1lID09PSBcInNjb3BlZFwiID8gcm9vdEVsZW1lbnRJZCB8fCBzY29wZWRSb290SWQgOiB1bmRlZmluZWRcbiAgICAgICAgfVxuICAgICAgPlxuICAgICAgICA8Q2xhc3NOYW1lcz5cbiAgICAgICAgICB7KHsgY3NzIH0pID0+IHtcbiAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgdHlwZW9mIHdpbmRvdyAhPT0gXCJ1bmRlZmluZWRcIiAmJlxuICAgICAgICAgICAgICBjc3NCYXNlbGluZSA9PT0gXCJzY29wZWRcIiAmJlxuICAgICAgICAgICAgICByb290RWxlbWVudElkXG4gICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgY29uc3Qgcm9vdEVsZW1lbnQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChyb290RWxlbWVudElkKTtcblxuICAgICAgICAgICAgICBpZiAocm9vdEVsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICByb290RWxlbWVudC5jbGFzc0xpc3QuYWRkKFxuICAgICAgICAgICAgICAgICAgY3NzKHtcbiAgICAgICAgICAgICAgICAgICAgLi4uQ3NzU2NvcGVkQmFzZWxpbmUsXG4gICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIChjc3NUaGVtZSA9PT0gXCJzY29wZWRcIiB8fCBjc3NCYXNlbGluZSA9PT0gXCJzY29wZWRcIikgJiZcbiAgICAgICAgICAgICAgIXJvb3RFbGVtZW50SWQgPyAoXG4gICAgICAgICAgICAgIDxkaXZcbiAgICAgICAgICAgICAgICBpZD17c2NvcGVkUm9vdElkfVxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZT17XG4gICAgICAgICAgICAgICAgICBjc3NCYXNlbGluZSA9PT0gXCJzY29wZWRcIlxuICAgICAgICAgICAgICAgICAgICA/IGNzcyh7IC4uLkNzc1Njb3BlZEJhc2VsaW5lIH0pXG4gICAgICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICA+XG4gICAgICAgICAgICAgICAge2NoaWxkcmVufVxuICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICkgOiAoXG4gICAgICAgICAgICAgIGNoaWxkcmVuXG4gICAgICAgICAgICApO1xuICAgICAgICAgIH19XG4gICAgICAgIDwvQ2xhc3NOYW1lcz5cbiAgICAgIDwvSHZUaGVtZVByb3ZpZGVyPlxuICAgIDwvQ2FjaGVQcm92aWRlcj5cbiAgKTtcbn07XG4iXX0= */") }),
29
+ /* @__PURE__ */ jsx(Global, { styles: /* @__PURE__ */ css(cssBaseline === "global" && CssBaseline, " ", getThemesVars(themesList), ";" + (process.env.NODE_ENV === "production" ? "" : ";label:HvProvider;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2h2LXVpa2l0LXJlYWN0L2h2LXVpa2l0LXJlYWN0L3BhY2thZ2VzL2NvcmUvc3JjL3Byb3ZpZGVycy9Qcm92aWRlci50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBb0h3QiIsImZpbGUiOiIvaG9tZS9ydW5uZXIvd29yay9odi11aWtpdC1yZWFjdC9odi11aWtpdC1yZWFjdC9wYWNrYWdlcy9j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ICAgICAgICAgICAgICBpZiAocm9vdEVsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICByb290RWxlbWVudC5jbGFzc0xpc3QuYWRkKFxuICAgICAgICAgICAgICAgICAgY3NzKHtcbiAgICAgICAgICAgICAgICAgICAgLi4uQ3NzU2NvcGVkQmFzZWxpbmUsXG4gICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIChjc3NUaGVtZSA9PT0gXCJzY29wZWRcIiB8fCBjc3NCYXNlbGluZSA9PT0gXCJzY29wZWRcIikgJiZcbiAgICAgICAgICAgICAgIXJvb3RFbGVtZW50SWQgPyAoXG4gICAgICAgICAgICAgIDxkaXZcbiAgICAgICAgICAgICAgICBpZD17c2NvcGVkUm9vdElkfVxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZT17XG4gICAgICAgICAgICAgICAgICBjc3NCYXNlbGluZSA9PT0gXCJzY29wZWRcIlxuICAgICAgICAgICAgICAgICAgICA/IGNzcyh7IC4uLkNzc1Njb3BlZEJhc2VsaW5lIH0pXG4gICAgICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICA+XG4gICAgICAgICAgICAgICAge2NoaWxkcmVufVxuICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICkgOiAoXG4gICAgICAgICAgICAgIGNoaWxkcmVuXG4gICAgICAgICAgICApO1xuICAgICAgICAgIH19XG4gICAgICAgIDwvQ2xhc3NOYW1lcz5cbiAgICAgIDwvSHZUaGVtZVByb3ZpZGVyPlxuICAgIDwvQ2FjaGVQcm92aWRlcj5cbiAgKTtcbn07XG4iXX0= */") }),
29
30
  /* @__PURE__ */ jsx(HvThemeProvider, { themes: themesList, theme: theme || themesList[0].name, emotionCache, colorMode: colorMode || Object.keys(themesList[0].colors.modes)[0], themeRootId: cssTheme === "scoped" ? rootElementId || scopedRootId : void 0, children: /* @__PURE__ */ jsx(ClassNames, { children: ({
30
31
  css: css2
31
32
  }) => {
32
- if (typeof window !== "undefined" && cssBaseline === "scoped" && rootElementId) {
33
- const rootElement = document.getElementById(rootElementId);
33
+ if (cssBaseline === "scoped") {
34
+ const rootElement = getElementById(rootElementId);
34
35
  if (rootElement) {
35
36
  rootElement.classList.add(css2({
36
37
  ...CssScopedBaseline
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.js","sources":["../../../src/providers/Provider.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\n\nimport createCache from \"@emotion/cache\";\nimport {\n css as cssReact,\n Global,\n CacheProvider,\n ClassNames,\n} from \"@emotion/react\";\n\nimport {\n CssBaseline,\n CssScopedBaseline,\n getThemesVars,\n HvThemeStructure,\n} from \"@hitachivantara/uikit-styles\";\n\nimport { processThemes } from \"@core/utils/theme\";\nimport { HvTheme } from \"@core/types/theme\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\n\nimport {\n HvThemeProvider,\n defaultCacheKey,\n defaultEmotionCache,\n} from \"./ThemeProvider\";\n\n// Provider props\nexport interface HvProviderProps {\n /**\n * Your component tree.\n */\n children?: React.ReactNode;\n /**\n * Id of your root element.\n */\n rootElementId?: string;\n /**\n * By default the baseline styles are applied globally, `global`, to the application for the UI Kit components to work properly.\n * If you need to scope the baseline styles to avoid styling conflicts, you can set this property to `scoped`.\n * To scope the baseline to your root, you need to add the `rootElementId` property.\n * If the `rootElementId` property is not set, the baseline will be scoped to a new container, `hv-uikit-scoped-root*`, created around your content.\n * If you are providing your own baseline styles, you can set this property to `none` to disable the baseline styles.\n */\n cssBaseline?: \"global\" | \"scoped\" | \"none\";\n /**\n * By default the theme styles are applied globally, `global`, to the application.\n * If you need to scope the theme styles to avoid styling conflicts, you can set this property to `scoped`.\n * To scope the theme to your root, you need to add the `rootElementId` property.\n * If the `rootElementId` property is not set, the theme will be scoped to a new container, `hv-uikit-scoped-root*`, created around your content.\n */\n cssTheme?: \"global\" | \"scoped\";\n /**\n * The string used to prefix the class names and uniquely identify them. The key can only contain lower case alphabetical characters.\n * This is useful to avoid class name collisions.\n *\n * If no value is provided, the default is `hv`.\n */\n classNameKey?: string;\n /**\n * List of themes to be used by UI Kit.\n * You can provide your own themes created with the `createTheme` utility and/or the default themes `ds3` and `ds5` provided by UI Kit.\n *\n * If no value is provided, the `ds5` theme will be used.\n */\n themes?: (HvTheme | HvThemeStructure)[];\n /**\n * The active theme. It must be one of the themes passed to `themes`.\n *\n * If no value is provided, the first theme from the `themes` list is used. If no `themes` list is provided, the `ds5` theme will be used.\n */\n theme?: string;\n /**\n * The active color mode. It must be one of the color modes of the active theme.\n *\n * If no value is provided, the first color mode defined in the active theme is used.\n * For the default themes `ds3` and `ds5`, the `dawn` color mode is the one used.\n */\n colorMode?: string;\n}\n\nconst scopedRootPrefix = \"hv-uikit-scoped-root\" as const;\n\n/**\n * Enables theming capabilities and makes cross-component theme properties available down the tree.\n */\nexport const HvProvider = ({\n children,\n rootElementId,\n cssBaseline = \"global\",\n cssTheme = \"global\",\n themes,\n theme,\n colorMode,\n classNameKey = defaultCacheKey,\n}: HvProviderProps) => {\n const scopedRootId = useUniqueId(undefined, scopedRootPrefix);\n\n // Themes\n const themesList: (HvTheme | HvThemeStructure)[] = processThemes(themes);\n\n // Emotion cache\n // Moves UI Kit styles to the top of the <head> so they're loaded first\n // This enables users to override the UI Kit styles if necessary\n const emotionCache = useMemo(\n () =>\n classNameKey === defaultCacheKey\n ? defaultEmotionCache\n : createCache({ key: classNameKey, prepend: true }),\n [classNameKey]\n );\n\n return (\n <CacheProvider value={emotionCache}>\n <Global\n styles={cssReact`\n ${cssBaseline === \"global\" && CssBaseline}\n ${getThemesVars(themesList)}\n `}\n />\n <HvThemeProvider\n themes={themesList}\n theme={theme || themesList[0].name}\n emotionCache={emotionCache}\n colorMode={colorMode || Object.keys(themesList[0].colors.modes)[0]}\n themeRootId={\n cssTheme === \"scoped\" ? rootElementId || scopedRootId : undefined\n }\n >\n <ClassNames>\n {({ css }) => {\n if (\n typeof window !== \"undefined\" &&\n cssBaseline === \"scoped\" &&\n rootElementId\n ) {\n const rootElement = document.getElementById(rootElementId);\n\n if (rootElement) {\n rootElement.classList.add(\n css({\n ...CssScopedBaseline,\n })\n );\n }\n }\n\n return (cssTheme === \"scoped\" || cssBaseline === \"scoped\") &&\n !rootElementId ? (\n <div\n id={scopedRootId}\n className={\n cssBaseline === \"scoped\"\n ? css({ ...CssScopedBaseline })\n : undefined\n }\n >\n {children}\n </div>\n ) : (\n children\n );\n }}\n </ClassNames>\n </HvThemeProvider>\n </CacheProvider>\n );\n};\n"],"names":["scopedRootPrefix","HvProvider","children","rootElementId","cssBaseline","cssTheme","themes","theme","colorMode","classNameKey","defaultCacheKey","scopedRootId","useUniqueId","undefined","themesList","processThemes","emotionCache","useMemo","defaultEmotionCache","createCache","key","prepend","CssBaseline","getThemesVars","process","env","NODE_ENV","name","Object","keys","colors","modes","css","window","rootElement","document","getElementById","classList","add","CssScopedBaseline"],"mappings":";;;;;;;;;AAiFA,MAAMA,mBAAmB;AAKlB,MAAMC,aAAaA,CAAC;AAAA,EACzBC;AAAAA,EACAC;AAAAA,EACAC,cAAc;AAAA,EACdC,WAAW;AAAA,EACXC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,eAAeC;AACA,MAAM;AACfC,QAAAA,eAAeC,YAAYC,QAAWb,gBAAgB;AAGtDc,QAAAA,aAA6CC,cAAcT,MAAM;AAKvE,QAAMU,eAAeC,QACnB,MACER,iBAAiBC,kBACbQ,sBACAC,YAAY;AAAA,IAAEC,KAAKX;AAAAA,IAAcY,SAAS;AAAA,EAAA,CAAM,GACtD,CAACZ,YAAY,CACf;AAGE,SAAA,qBAAC,eAAc,EAAA,OAAOO,cACpB,UAAA;AAAA,IAAC,oBAAA,QAAA,EACC,QACIZ,oBAAAA,gBAAgB,YAAYkB,aAC5BC,KAAAA,cAAcT,UAAU,GAAC,OAAAU,QAAAC,IAAAC,aAAA,eAAA,KAAA,uBAAAF,QAAAC,IAAAC,aAC3B,eAAA,KAAA,6wPAAA,EAAA,CAAA;AAAA,IAEH,oBAAA,iBAAA,EACC,QAAQZ,YACR,OAAOP,SAASO,WAAW,CAAC,EAAEa,MAC9B,cACA,WAAWnB,aAAaoB,OAAOC,KAAKf,WAAW,CAAC,EAAEgB,OAAOC,KAAK,EAAE,CAAC,GACjE,aACE1B,aAAa,WAAWF,iBAAiBQ,eAAeE,QAG1D,UAAA,oBAAC,cACE,UAAC,CAAA;AAAA,MAAEmB,KAAAA;AAAAA,IAAAA,MAAU;AACZ,UACE,OAAOC,WAAW,eAClB7B,gBAAgB,YAChBD,eACA;AACM+B,cAAAA,cAAcC,SAASC,eAAejC,aAAa;AAEzD,YAAI+B,aAAa;AACHG,sBAAAA,UAAUC,IACpBN,KAAI;AAAA,YACF,GAAGO;AAAAA,UACJ,CAAA,CACH;AAAA,QACF;AAAA,MACF;AAEA,cAAQlC,aAAa,YAAYD,gBAAgB,aAC/C,CAACD,gBACA,oBAAA,OAAA,EACC,IAAIQ,cACJ,WACEP,gBAAgB,WACZ4B,KAAI;AAAA,QAAE,GAAGO;AAAAA,MAAmB,CAAA,IAC5B1B,QAGLX,SACH,CAAA,IAEAA;AAAAA,OAGN,EACF,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"Provider.js","sources":["../../../src/providers/Provider.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\n\nimport createCache from \"@emotion/cache\";\nimport {\n css as cssReact,\n Global,\n CacheProvider,\n ClassNames,\n} from \"@emotion/react\";\n\nimport {\n CssBaseline,\n CssScopedBaseline,\n getThemesVars,\n HvThemeStructure,\n} from \"@hitachivantara/uikit-styles\";\n\nimport { getElementById } from \"@core/utils/document\";\nimport { processThemes } from \"@core/utils/theme\";\nimport { HvTheme } from \"@core/types/theme\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\n\nimport {\n HvThemeProvider,\n defaultCacheKey,\n defaultEmotionCache,\n} from \"./ThemeProvider\";\n\n// Provider props\nexport interface HvProviderProps {\n /**\n * Your component tree.\n */\n children?: React.ReactNode;\n /**\n * Id of your root element.\n */\n rootElementId?: string;\n /**\n * By default the baseline styles are applied globally, `global`, to the application for the UI Kit components to work properly.\n * If you need to scope the baseline styles to avoid styling conflicts, you can set this property to `scoped`.\n * To scope the baseline to your root, you need to add the `rootElementId` property.\n * If the `rootElementId` property is not set, the baseline will be scoped to a new container, `hv-uikit-scoped-root*`, created around your content.\n * If you are providing your own baseline styles, you can set this property to `none` to disable the baseline styles.\n */\n cssBaseline?: \"global\" | \"scoped\" | \"none\";\n /**\n * By default the theme styles are applied globally, `global`, to the application.\n * If you need to scope the theme styles to avoid styling conflicts, you can set this property to `scoped`.\n * To scope the theme to your root, you need to add the `rootElementId` property.\n * If the `rootElementId` property is not set, the theme will be scoped to a new container, `hv-uikit-scoped-root*`, created around your content.\n */\n cssTheme?: \"global\" | \"scoped\";\n /**\n * The string used to prefix the class names and uniquely identify them. The key can only contain lower case alphabetical characters.\n * This is useful to avoid class name collisions.\n *\n * If no value is provided, the default is `hv`.\n */\n classNameKey?: string;\n /**\n * List of themes to be used by UI Kit.\n * You can provide your own themes created with the `createTheme` utility and/or the default themes `ds3` and `ds5` provided by UI Kit.\n *\n * If no value is provided, the `ds5` theme will be used.\n */\n themes?: (HvTheme | HvThemeStructure)[];\n /**\n * The active theme. It must be one of the themes passed to `themes`.\n *\n * If no value is provided, the first theme from the `themes` list is used. If no `themes` list is provided, the `ds5` theme will be used.\n */\n theme?: string;\n /**\n * The active color mode. It must be one of the color modes of the active theme.\n *\n * If no value is provided, the first color mode defined in the active theme is used.\n * For the default themes `ds3` and `ds5`, the `dawn` color mode is the one used.\n */\n colorMode?: string;\n}\n\nconst scopedRootPrefix = \"hv-uikit-scoped-root\" as const;\n\n/**\n * Enables theming capabilities and makes cross-component theme properties available down the tree.\n */\nexport const HvProvider = ({\n children,\n rootElementId,\n cssBaseline = \"global\",\n cssTheme = \"global\",\n themes,\n theme,\n colorMode,\n classNameKey = defaultCacheKey,\n}: HvProviderProps) => {\n const scopedRootId = useUniqueId(undefined, scopedRootPrefix);\n\n // Themes\n const themesList: (HvTheme | HvThemeStructure)[] = processThemes(themes);\n\n // Emotion cache\n // Moves UI Kit styles to the top of the <head> so they're loaded first\n // This enables users to override the UI Kit styles if necessary\n const emotionCache = useMemo(\n () =>\n classNameKey === defaultCacheKey\n ? defaultEmotionCache\n : createCache({ key: classNameKey, prepend: true }),\n [classNameKey]\n );\n\n return (\n <CacheProvider value={emotionCache}>\n <Global\n styles={cssReact`\n ${cssBaseline === \"global\" && CssBaseline}\n ${getThemesVars(themesList)}\n `}\n />\n <HvThemeProvider\n themes={themesList}\n theme={theme || themesList[0].name}\n emotionCache={emotionCache}\n colorMode={colorMode || Object.keys(themesList[0].colors.modes)[0]}\n themeRootId={\n cssTheme === \"scoped\" ? rootElementId || scopedRootId : undefined\n }\n >\n <ClassNames>\n {({ css }) => {\n if (cssBaseline === \"scoped\") {\n const rootElement = getElementById(rootElementId);\n\n if (rootElement) {\n rootElement.classList.add(\n css({\n ...CssScopedBaseline,\n })\n );\n }\n }\n\n return (cssTheme === \"scoped\" || cssBaseline === \"scoped\") &&\n !rootElementId ? (\n <div\n id={scopedRootId}\n className={\n cssBaseline === \"scoped\"\n ? css({ ...CssScopedBaseline })\n : undefined\n }\n >\n {children}\n </div>\n ) : (\n children\n );\n }}\n </ClassNames>\n </HvThemeProvider>\n </CacheProvider>\n );\n};\n"],"names":["scopedRootPrefix","HvProvider","children","rootElementId","cssBaseline","cssTheme","themes","theme","colorMode","classNameKey","defaultCacheKey","scopedRootId","useUniqueId","undefined","themesList","processThemes","emotionCache","useMemo","defaultEmotionCache","createCache","key","prepend","CssBaseline","getThemesVars","process","env","NODE_ENV","name","Object","keys","colors","modes","css","rootElement","getElementById","classList","add","CssScopedBaseline"],"mappings":";;;;;;;;;;AAkFA,MA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WACZ4B,KAAI;AAAA,QAAE,GAAGK;AAAAA,MAAmB,CAAA,IAC5BxB,QAGLX,SACH,CAAA,IAEAA;AAAAA,OAGN,EACF,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"classes.js","sources":["../../../src/utils/classes.ts"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/css\";\n\nimport { useCss } from \"@core/hooks/useCss\";\n\nexport type ExtractNames<\n T extends (...args: any) => { classes: Record<string, any>; cx: any }\n> = Partial<ReturnType<T>[\"classes\"]>;\n\nexport const getClasses = <T extends string, N extends string>(\n keys: T[],\n name: N\n) => {\n const classesObj: Record<string, string> = {};\n keys.forEach((key: string) => {\n classesObj[key] = `${name}-${key}`;\n });\n return classesObj as { [P in T]: `${N}-${P}` };\n};\n\nconst deepRenameKeys = <T extends object>(\n obj: T,\n mapFn: (key: string) => string\n): T => {\n const result: any = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n const newKey = mapFn(key);\n const value = obj[key];\n result[newKey] =\n typeof value === \"object\" ? deepRenameKeys(value as any, mapFn) : value;\n }\n }\n return result;\n};\n\n/** Given a `stylesObj`, replaces its keys' `$myClass` with `.{name}-myClass`. */\nexport const replace$ = <T extends object>(stylesObj: T, name: string): T => {\n return deepRenameKeys(stylesObj, (key) => {\n const matches = key.match(/\\$\\w+/g);\n if (!matches?.length) return key;\n const newKey = matches.reduce(\n (acc, match) => acc.replace(match, `.${name}-${match.slice(1)}`),\n key\n );\n return newKey ?? key;\n });\n};\n\n/** Utility function to create classes for a component. */\nexport function createClasses<Name extends string, ClassName extends string>(\n /** Component name in PascalCase (ie. `HvTableCell`). */\n name: Name,\n stylesObject: Record<ClassName, CSSInterpolation>\n) {\n const styles = replace$(stylesObject, name);\n\n const staticClasses = getClasses(Object.keys(styles) as ClassName[], name);\n\n /**\n * Hook that takes in a component's `classesProp` overrides, and returns the\n * concatenated static/internal/override `classes`, and the cached `cx` and `css` utilities.\n */\n function useClasses(\n classesProp: Partial<Record<ClassName, string>> = {},\n /** Whether to add the static classes. Disable when included by `classesProp` */\n addStatic = true\n ) {\n const { cx, css } = useCss();\n\n const mergeClasses = (key: string) =>\n cx(addStatic && `${name}-${key}`, css(styles[key]), classesProp?.[key]);\n\n const classes = Object.fromEntries(\n Object.keys(styles).map((key) => [key, mergeClasses(key)])\n ) as { [P in ClassName]: string };\n\n return { classes, css, cx };\n }\n\n return { useClasses, staticClasses };\n}\n"],"names":["getClasses","keys","name","classesObj","forEach","key","deepRenameKeys","obj","mapFn","result","Object","prototype","hasOwnProperty","call","newKey","value","replace$","stylesObj","matches","match","length","reduce","acc","replace","slice","createClasses","stylesObject","styles","staticClasses","useClasses","classesProp","addStatic","cx","css","useCss","mergeClasses","classes","fromEntries","map"],"mappings":";AAQaA,MAAAA,aAAa,CACxBC,MACAC,SACG;AACH,QAAMC,aAAqC,CAAA;AACtCC,OAAAA,QAAQ,CAACC,QAAgB;AAC5BF,eAAWE,GAAG,IAAK,GAAEH,IAAK,IAAGG,GAAI;AAAA,EAAA,CAClC;AACMF,SAAAA;AACT;AAEA,MAAMG,iBAAiB,CACrBC,KACAC,UACM;AACN,QAAMC,SAAc,CAAA;AACpB,aAAWJ,OAAOE,KAAK;AACrB,QAAIG,OAAOC,UAAUC,eAAeC,KAAKN,KAAKF,GAAG,GAAG;AAC5CS,YAAAA,SAASN,MAAMH,GAAG;AAClBU,YAAAA,QAAQR,IAAIF,GAAG;AACdS,aAAAA,MAAM,IACX,OAAOC,UAAU,WAAWT,eAAeS,OAAcP,KAAK,IAAIO;AAAAA,IACtE;AAAA,EACF;AACON,SAAAA;AACT;AAGaO,MAAAA,WAAW,CAAmBC,WAAcf,SAAoB;AACpEI,SAAAA,eAAeW,WAAYZ,CAAQ,QAAA;AAClCa,UAAAA,UAAUb,IAAIc,MAAM,QAAQ;AAClC,QAAI,CAACD,SAASE;AAAef,aAAAA;AAC7B,UAAMS,SAASI,QAAQG,OACrB,CAACC,KAAKH,UAAUG,IAAIC,QAAQJ,OAAQ,IAAGjB,IAAK,IAAGiB,MAAMK,MAAM,CAAC,CAAE,EAAC,GAC/DnB,GACF;AACA,WAAOS,UAAUT;AAAAA,EAAAA,CAClB;AACH;AAGgBoB,SAAAA,cAEdvB,MACAwB,cACA;AACMC,QAAAA,SAASX,SAASU,cAAcxB,IAAI;AAE1C,QAAM0B,gBAAgB5B,WAAWU,OAAOT,KAAK0B,MAAM,GAAkBzB,IAAI;AAMzE,WAAS2B,WACPC,cAAkD,IAElDC,YAAY,MACZ;AACM,UAAA;AAAA,MAAEC;AAAAA,MAAIC;AAAAA,QAAQC,OAAO;AAE3B,UAAMC,eAAeA,CAAC9B,QACpB2B,GAAGD,aAAc,GAAE7B,IAAK,IAAGG,GAAI,IAAG4B,IAAIN,OAAOtB,GAAG,CAAC,GAAGyB,cAAczB,GAAG,CAAC;AAExE,UAAM+B,UAAU1B,OAAO2B,YACrB3B,OAAOT,KAAK0B,MAAM,EAAEW,IAAKjC,CAAAA,QAAQ,CAACA,KAAK8B,aAAa9B,GAAG,CAAC,CAAC,CAC3D;AAEO,WAAA;AAAA,MAAE+B;AAAAA,MAASH;AAAAA,MAAKD;AAAAA,IAAAA;AAAAA,EACzB;AAEO,SAAA;AAAA,IAAEH;AAAAA,IAAYD;AAAAA,EAAAA;AACvB;"}
1
+ {"version":3,"file":"classes.js","sources":["../../../src/utils/classes.ts"],"sourcesContent":["import type { CSSInterpolation } from \"@emotion/serialize\";\n\nimport { useCss } from \"@core/hooks/useCss\";\n\nexport type ExtractNames<\n T extends (...args: any) => { classes: Record<string, any>; cx: any }\n> = Partial<ReturnType<T>[\"classes\"]>;\n\nexport const getClasses = <T extends string, N extends string>(\n keys: T[],\n name: N\n) => {\n const classesObj: Record<string, string> = {};\n keys.forEach((key: string) => {\n classesObj[key] = `${name}-${key}`;\n });\n return classesObj as { [P in T]: `${N}-${P}` };\n};\n\nconst deepRenameKeys = <T extends object>(\n obj: T,\n mapFn: (key: string) => string\n): T => {\n const result: any = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n const newKey = mapFn(key);\n const value = obj[key];\n result[newKey] =\n typeof value === \"object\" ? deepRenameKeys(value as any, mapFn) : value;\n }\n }\n return result;\n};\n\n/** Given a `stylesObj`, replaces its keys' `$myClass` with `.{name}-myClass`. */\nexport const replace$ = <T extends object>(stylesObj: T, name: string): T => {\n return deepRenameKeys(stylesObj, (key) => {\n const matches = key.match(/\\$\\w+/g);\n if (!matches?.length) return key;\n const newKey = matches.reduce(\n (acc, match) => acc.replace(match, `.${name}-${match.slice(1)}`),\n key\n );\n return newKey ?? key;\n });\n};\n\n/** Utility function to create classes for a component. */\nexport function createClasses<Name extends string, ClassName extends string>(\n /** Component name in PascalCase (ie. `HvTableCell`). */\n name: Name,\n stylesObject: Record<ClassName, CSSInterpolation>\n) {\n const styles = replace$(stylesObject, name);\n\n const staticClasses = getClasses(Object.keys(styles) as ClassName[], name);\n\n /**\n * Hook that takes in a component's `classesProp` overrides, and returns the\n * concatenated static/internal/override `classes`, and the cached `cx` and `css` utilities.\n */\n function useClasses(\n classesProp: Partial<Record<ClassName, string>> = {},\n /** Whether to add the static classes. Disable when included by `classesProp` */\n addStatic = true\n ) {\n const { cx, css } = useCss();\n\n const mergeClasses = (key: string) =>\n cx(addStatic && `${name}-${key}`, css(styles[key]), classesProp?.[key]);\n\n const classes = Object.fromEntries(\n Object.keys(styles).map((key) => [key, mergeClasses(key)])\n ) as { [P in ClassName]: string };\n\n return { classes, css, cx };\n }\n\n return { useClasses, staticClasses };\n}\n"],"names":["getClasses","keys","name","classesObj","forEach","key","deepRenameKeys","obj","mapFn","result","Object","prototype","hasOwnProperty","call","newKey","value","replace$","stylesObj","matches","match","length","reduce","acc","replace","slice","createClasses","stylesObject","styles","staticClasses","useClasses","classesProp","addStatic","cx","css","useCss","mergeClasses","classes","fromEntries","map"],"mappings":";AAQaA,MAAAA,aAAa,CACxBC,M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AAczB,GAAG,CAAC;AAExE,UAAM+B,UAAU1B,OAAO2B,YACrB3B,OAAOT,KAAK0B,MAAM,EAAEW,IAAKjC,CAAAA,QAAQ,CAACA,KAAK8B,aAAa9B,GAAG,CAAC,CAAC,CAC3D;AAEO,WAAA;AAAA,MAAE+B;AAAAA,MAASH;AAAAA,MAAKD;AAAAA,IAAAA;AAAAA,EACzB;AAEO,SAAA;AAAA,IAAEH;AAAAA,IAAYD;AAAAA,EAAAA;AACvB;"}
@@ -0,0 +1,11 @@
1
+ function getDocument() {
2
+ return typeof window !== "undefined" ? document : void 0;
3
+ }
4
+ function getElementById(elementId) {
5
+ return elementId && getDocument()?.getElementById(elementId) || void 0;
6
+ }
7
+ export {
8
+ getDocument,
9
+ getElementById
10
+ };
11
+ //# sourceMappingURL=document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.js","sources":["../../../src/utils/document.ts"],"sourcesContent":["export function getDocument() {\n return typeof window !== \"undefined\" ? document : undefined;\n}\n\n/** Wrapper around `document.getElementById` */\nexport function getElementById(elementId?: string) {\n return (elementId && getDocument()?.getElementById(elementId)) || undefined;\n}\n\n/** Get a container element by id, falling back to document-body */\nexport function getContainerElement(elementId?: string) {\n return getElementById(elementId) || getDocument()?.body;\n}\n"],"names":["getDocument","window","document","undefined","getElementById","elementId"],"mappings":"AAAO,SAASA,cAAc;AACrB,SAAA,OAAOC,WAAW,cAAcC,WAAWC;AACpD;AAGO,SAASC,eAAeC,WAAoB;AACjD,SAAQA,aAAaL,YAAeI,GAAAA,eAAeC,SAAS,KAAMF;AACpE;"}
@@ -1,4 +1,5 @@
1
1
  import { theme, themes } from "@hitachivantara/uikit-styles";
2
+ import { getElementById } from "./document.js";
2
3
  const setElementStyle = (element, style) => {
3
4
  Object.entries(style).forEach(([property, value]) => {
4
5
  element.style[property] = value;
@@ -88,13 +89,10 @@ const processThemes = (themesList) => {
88
89
  return [themes.ds5];
89
90
  };
90
91
  const getVarValue = (cssVar, rootElementId) => {
91
- if (typeof window !== "undefined") {
92
- const root = document.getElementById(rootElementId || "hv-root");
93
- if (root) {
94
- const computedValue = getComputedStyle(root).getPropertyValue(cssVar.replace("var(", "").replace(")", "")).trim();
95
- return computedValue;
96
- }
97
- }
92
+ const root = getElementById(rootElementId || "hv-root");
93
+ if (!root)
94
+ return void 0;
95
+ return getComputedStyle(root).getPropertyValue(cssVar.replace("var(", "").replace(")", "")).trim();
98
96
  };
99
97
  export {
100
98
  createTheme,
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","sources":["../../../src/utils/theme.ts"],"sourcesContent":["/* eslint import/namespace: [2, { allowComputed: true }] */\nimport { CSSProperties } from \"react\";\n\nimport {\n themes,\n HvThemeColorModeStructure,\n HvThemeStructure,\n theme,\n} from \"@hitachivantara/uikit-styles\";\n\nimport { HvTheme, HvCreateThemeProps } from \"@core/types/theme\";\n\n/**\n * Sets the element style properties.\n */\nconst setElementStyle = (element: HTMLElement, style: CSSProperties) => {\n Object.entries(style).forEach(([property, value]) => {\n element.style[property] = value;\n });\n};\n\n/**\n * Sets the element attributes and style for a theme and color mode.\n */\nexport const setElementAttrs = (\n themeName: string,\n modeName: string,\n colorScheme: string,\n themeRootId?: string\n) => {\n const element = themeRootId\n ? document.getElementById(themeRootId)\n : document.body;\n\n if (element) {\n element.setAttribute(`data-theme`, themeName);\n element.setAttribute(`data-color-mode`, modeName);\n\n // Set default properties for all components to inherit\n setElementStyle(element, {\n colorScheme,\n backgroundColor: theme.colors.backgroundColor,\n accentColor: theme.colors.secondary,\n color: theme.colors.secondary,\n fontSize: theme.typography.body.fontSize,\n fontWeight: theme.typography.body.fontWeight,\n lineHeight: theme.typography.body.lineHeight,\n letterSpacing: theme.typography.body.letterSpacing,\n fontFamily: theme.fontFamily.body,\n });\n }\n};\n\n/**\n * Applies customizations to a theme.\n */\nconst applyThemeCustomizations = (obj: object, customizations: object) => {\n const isObject = (val: any) =>\n val && typeof val === \"object\" && !Array.isArray(val);\n\n // Customized theme\n const customizedTheme = { ...obj };\n\n // Add new values to the theme or replace values\n Object.keys(customizations).forEach((key) => {\n if (customizedTheme[key]) {\n if (isObject(customizedTheme[key]) && isObject(customizations[key])) {\n customizedTheme[key] = applyThemeCustomizations(\n customizedTheme[key],\n customizations[key]\n );\n } else if (typeof customizedTheme[key] === typeof customizations[key]) {\n customizedTheme[key] = customizations[key];\n }\n } else {\n customizedTheme[key] = customizations[key];\n }\n });\n\n return customizedTheme;\n};\n\n/**\n * Creates a customized theme based on the base theme and customizations given.\n * For the color modes, the colors that are not defined will be replaced by the values from the dawn mode of the base theme.\n */\nexport const createTheme = (\n props: HvCreateThemeProps\n): HvTheme | HvThemeStructure => {\n const {\n name,\n base = \"ds5\",\n inheritColorModes = true,\n ...customizations\n } = props;\n\n // Apply customizations to the base theme\n const customizedTheme: HvTheme | HvThemeStructure = customizations\n ? (applyThemeCustomizations(themes[base], customizations) as HvTheme)\n : { ...themes[base] };\n\n // Set theme name\n customizedTheme.name = name.trim();\n // Set theme base\n customizedTheme.base = base;\n\n // Fill new color modes with missing colors\n if (customizations) {\n Object.keys(customizedTheme.colors.modes).forEach((mode) => {\n if (!themes[base].colors.modes[mode]) {\n customizedTheme.colors.modes[mode] = {\n ...themes[base].colors.modes.dawn,\n ...(customizedTheme.colors.modes[mode] as Partial<\n HvThemeColorModeStructure & { [key: string]: string }\n >),\n };\n }\n });\n }\n\n // If the flag `inheritColorModes` is false and customizations were given for the color modes,\n // we're removing any color modes that might have been inherited\n if (!inheritColorModes && customizations.colors?.modes) {\n Object.keys(customizedTheme.colors.modes).forEach((mode) => {\n if (!Object.keys(customizations.colors?.modes || {}).includes(mode)) {\n delete customizedTheme.colors.modes[mode];\n }\n });\n }\n\n // Created theme\n return customizedTheme;\n};\n\n/**\n * Process the themes provided to the HvProvider:\n * - Cleans themes with the same name\n * - Returns the default if the list is empty (ds5)\n */\nexport const processThemes = (\n themesList?: (HvTheme | HvThemeStructure)[]\n): (HvTheme | HvThemeStructure)[] => {\n if (themesList && Array.isArray(themesList) && themesList.length > 0) {\n const list: (HvTheme | HvThemeStructure)[] = [];\n\n themesList.forEach((thm) => {\n const i: number = list.findIndex(\n (t) => t.name.trim() === thm.name.trim()\n );\n\n if (i !== -1) {\n list.splice(i, 1);\n list.push(thm);\n } else {\n list.push(thm);\n }\n });\n\n // Cleaned themes\n return list;\n }\n // DS5\n return [themes.ds5];\n};\n\nexport const getVarValue = (cssVar: string, rootElementId?: string) => {\n if (typeof window !== \"undefined\") {\n const root = document.getElementById(rootElementId || \"hv-root\");\n\n if (root) {\n const computedValue = getComputedStyle(root)\n .getPropertyValue(cssVar.replace(\"var(\", \"\").replace(\")\", \"\"))\n .trim();\n\n return computedValue;\n }\n }\n};\n"],"names":["setElementStyle","element","style","entries","forEach","property","value","setElementAttrs","themeName","modeName","colorScheme","themeRootId","document","getElementById","body","setAttribute","backgroundColor","theme","colors","accentColor","secondary","color","fontSize","typography","fontWeight","lineHeight","letterSpacing","fontFamily","applyThemeCustomizations","obj","customizations","isObject","val","Array","isArray","customizedTheme","Object","keys","key","createTheme","props","name","base","inheritColorModes","themes","trim","modes","mode","dawn","includes","processThemes","themesList","length","list","thm","i","findIndex","t","splice","push","ds5","getVarValue","cssVar","rootElementId","window","root","computedValue","getComputedStyle","getPropertyValue","replace"],"mappings":";AAeA,MAAMA,kBAAkBA,CAACC,SAAsBC,UAAyB;AAC/DC,SAAAA,QAAQD,KAAK,EAAEE,QAAQ,CAAC,CAACC,UAAUC,KAAK,MAAM;AAC3CJ,YAAAA,MAAMG,QAAQ,IAAIC;AAAAA,EAAAA,CAC3B;AACH;AAKO,MAAMC,kBAAkBA,CAC7BC,WACAC,UACAC,aACAC,gBACG;AACH,QAAMV,UAAUU,cACZC,SAASC,eAAeF,WAAW,IACnCC,SAASE;AAEb,MAAIb,SAAS;AACHc,YAAAA,aAAc,cAAaP,SAAS;AACpCO,YAAAA,aAAc,mBAAkBN,QAAQ;AAGhDT,oBAAgBC,SAAS;AAAA,MACvBS;AAAAA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A,MACf;AAAA,IAAA,CACD;AAGMD,WAAAA;AAAAA,EACT;AAEO,SAAA,CAACT,OAAOgB,GAAG;AACpB;AAEaC,MAAAA,cAAcA,CAACC,QAAgBC,kBAA2B;AACjE,MAAA,OAAOC,WAAW,aAAa;AACjC,UAAMC,OAAOrD,SAASC,eAAekD,iBAAiB,SAAS;AAE/D,QAAIE,MAAM;AACR,YAAMC,gBAAgBC,iBAAiBF,IAAI,EACxCG,iBAAiBN,OAAOO,QAAQ,QAAQ,EAAE,EAAEA,QAAQ,KAAK,EAAE,CAAC,EAC5DxB;AAEIqB,aAAAA;AAAAA,IACT;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"theme.js","sources":["../../../src/utils/theme.ts"],"sourcesContent":["import { CSSProperties } from \"react\";\n\nimport {\n themes,\n HvThemeColorModeStructure,\n HvThemeStructure,\n theme,\n} from \"@hitachivantara/uikit-styles\";\n\nimport { HvTheme, HvCreateThemeProps } from \"@core/types/theme\";\n\nimport { getElementById } from \"./document\";\n\n/**\n * Sets the element style properties.\n */\nconst setElementStyle = (element: HTMLElement, style: CSSProperties) => {\n Object.entries(style).forEach(([property, value]) => {\n element.style[property] = value;\n });\n};\n\n/**\n * Sets the element attributes and style for a theme and color mode.\n */\nexport const setElementAttrs = (\n themeName: string,\n modeName: string,\n colorScheme: string,\n themeRootId?: string\n) => {\n const element = themeRootId\n ? document.getElementById(themeRootId)\n : document.body;\n\n if (element) {\n element.setAttribute(`data-theme`, themeName);\n element.setAttribute(`data-color-mode`, modeName);\n\n // Set default properties for all components to inherit\n setElementStyle(element, {\n colorScheme,\n backgroundColor: theme.colors.backgroundColor,\n accentColor: theme.colors.secondary,\n color: theme.colors.secondary,\n fontSize: theme.typography.body.fontSize,\n fontWeight: theme.typography.body.fontWeight,\n lineHeight: theme.typography.body.lineHeight,\n letterSpacing: theme.typography.body.letterSpacing,\n fontFamily: theme.fontFamily.body,\n });\n }\n};\n\n/**\n * Applies customizations to a theme.\n */\nconst applyThemeCustomizations = (obj: object, customizations: object) => {\n const isObject = (val: any) =>\n val && typeof val === \"object\" && !Array.isArray(val);\n\n // Customized theme\n const customizedTheme = { ...obj };\n\n // Add new values to the theme or replace values\n Object.keys(customizations).forEach((key) => {\n if (customizedTheme[key]) {\n if (isObject(customizedTheme[key]) && isObject(customizations[key])) {\n customizedTheme[key] = applyThemeCustomizations(\n customizedTheme[key],\n customizations[key]\n );\n } else if (typeof customizedTheme[key] === typeof customizations[key]) {\n customizedTheme[key] = customizations[key];\n }\n } else {\n customizedTheme[key] = customizations[key];\n }\n });\n\n return customizedTheme;\n};\n\n/**\n * Creates a customized theme based on the base theme and customizations given.\n * For the color modes, the colors that are not defined will be replaced by the values from the dawn mode of the base theme.\n */\nexport const createTheme = (\n props: HvCreateThemeProps\n): HvTheme | HvThemeStructure => {\n const {\n name,\n base = \"ds5\",\n inheritColorModes = true,\n ...customizations\n } = props;\n\n // Apply customizations to the base theme\n const customizedTheme: HvTheme | HvThemeStructure = customizations\n ? (applyThemeCustomizations(themes[base], customizations) as HvTheme)\n : { ...themes[base] };\n\n // Set theme name\n customizedTheme.name = name.trim();\n // Set theme base\n customizedTheme.base = base;\n\n // Fill new color modes with missing colors\n if (customizations) {\n Object.keys(customizedTheme.colors.modes).forEach((mode) => {\n if (!themes[base].colors.modes[mode]) {\n customizedTheme.colors.modes[mode] = {\n ...themes[base].colors.modes.dawn,\n ...(customizedTheme.colors.modes[mode] as Partial<\n HvThemeColorModeStructure & { [key: string]: string }\n >),\n };\n }\n });\n }\n\n // If the flag `inheritColorModes` is false and customizations were given for the color modes,\n // we're removing any color modes that might have been inherited\n if (!inheritColorModes && customizations.colors?.modes) {\n Object.keys(customizedTheme.colors.modes).forEach((mode) => {\n if (!Object.keys(customizations.colors?.modes || {}).includes(mode)) {\n delete customizedTheme.colors.modes[mode];\n }\n });\n }\n\n // Created theme\n return customizedTheme;\n};\n\n/**\n * Process the themes provided to the HvProvider:\n * - Cleans themes with the same name\n * - Returns the default if the list is empty (ds5)\n */\nexport const processThemes = (\n themesList?: (HvTheme | HvThemeStructure)[]\n): (HvTheme | HvThemeStructure)[] => {\n if (themesList && Array.isArray(themesList) && themesList.length > 0) {\n const list: (HvTheme | HvThemeStructure)[] = [];\n\n themesList.forEach((thm) => {\n const i: number = list.findIndex(\n (t) => t.name.trim() === thm.name.trim()\n );\n\n if (i !== -1) {\n list.splice(i, 1);\n list.push(thm);\n } else {\n list.push(thm);\n }\n });\n\n // Cleaned themes\n return list;\n }\n // DS5\n return [themes.ds5];\n};\n\nexport const getVarValue = (cssVar: string, rootElementId?: string) => {\n const root = getElementById(rootElementId || \"hv-root\");\n if (!root) return undefined;\n\n return getComputedStyle(root)\n .getPropertyValue(cssVar.replace(\"var(\", \"\").replace(\")\", \"\"))\n .trim();\n};\n"],"names":["setElementStyle","element","style","entries","forEach","property","value","setElementAttrs","themeName","modeName","colorScheme","themeRootId","document","getElementById","body","setAttribute","backgroundColor","theme","colors","accentColor","secondary","color","fontSize","typography","fontWeight","lineHeight","letterSpacing","fontFamily","applyThemeCustomizations","obj","customizations","isObject","val","Array","isArray","customizedTheme","Object","keys","key","createTheme","props","name","base","inheritColorModes","themes","trim","modes","mode","dawn","includes","processThemes","themesList","length","list","thm","i","findIndex","t","splice","push","ds5","getVarValue","cssVar","rootElementId","root","undefined","getComputedStyle","getPropertyValue","replace"],"mappings":";;AAgBA,MAAMA,kBAAkBA,CAACC,SAAsBC,UAAyB;AAC/DC,SAAAA,QAAQD,KAAK,EAAEE,QAAQ,CAAC,CAACC,UAAUC,KAAK,MAAM;AAC3CJ,YAAAA,MAAMG,QAAQ,IAAIC;AAAAA,EAAAA,CAC3B;AACH;AAKO,MAAMC,kBAAkBA,CAC7BC,WACAC,UACAC,aACAC,gBACG;AACH,QAAMV,UAAUU,cACZC,SAASC,eAAeF,WAAW,IACnCC,SAASE;AAEb,MAAIb,SAAS;AACHc,YAAAA,aAAc,cAAaP,SAAS;AACpCO,YAAAA,aAAc,mBAAkBN,QAAQ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AA,MAAA,OACR;AACLD,aAAKM,KAAKL,GAAG;AAAA,MACf;AAAA,IAAA,CACD;AAGMD,WAAAA;AAAAA,EACT;AAEO,SAAA,CAACT,OAAOgB,GAAG;AACpB;AAEaC,MAAAA,cAAcA,CAACC,QAAgBC,kBAA2B;AAC/DC,QAAAA,OAAOnD,eAAekD,iBAAiB,SAAS;AACtD,MAAI,CAACC;AAAaC,WAAAA;AAElB,SAAOC,iBAAiBF,IAAI,EACzBG,iBAAiBL,OAAOM,QAAQ,QAAQ,EAAE,EAAEA,QAAQ,KAAK,EAAE,CAAC,EAC5DvB,KAAK;AACV;"}
@@ -213,6 +213,7 @@ export declare const appSwitcherActionClasses: {
213
213
  selected: "HvAppSwitcher-Action-selected";
214
214
  iconUrl: "HvAppSwitcher-Action-iconUrl";
215
215
  iconInfo: "HvAppSwitcher-Action-iconInfo";
216
+ titleAnchor: "HvAppSwitcher-Action-titleAnchor";
216
217
  };
217
218
 
218
219
  export declare const appSwitcherClasses: {
@@ -222,6 +223,7 @@ export declare const appSwitcherClasses: {
222
223
  actionsContainer: "HvAppSwitcher-actionsContainer";
223
224
  open: "HvAppSwitcher-open";
224
225
  item: "HvAppSwitcher-item";
226
+ titleAnchor: "HvAppSwitcher-titleAnchor";
225
227
  itemSelected: "HvAppSwitcher-itemSelected";
226
228
  itemDisabled: "HvAppSwitcher-itemDisabled";
227
229
  itemTrigger: "HvAppSwitcher-itemTrigger";
@@ -576,12 +578,12 @@ export declare const controlsClasses: {
576
578
  /** Utility function to create classes for a component. */
577
579
  export declare function createClasses<Name extends string, ClassName extends string>(
578
580
  /** Component name in PascalCase (ie. `HvTableCell`). */
579
- name: Name, stylesObject: Record<ClassName, CSSInterpolation_2>): {
581
+ name: Name, stylesObject: Record<ClassName, CSSInterpolation>): {
580
582
  useClasses: (classesProp?: Partial<Record<ClassName, string>>, addStatic?: boolean) => {
581
583
  classes: { [P in ClassName]: string; };
582
584
  css: {
583
- (template: TemplateStringsArray, ...args: CSSInterpolation_2[]): string;
584
- (...args: CSSInterpolation_2[]): string;
585
+ (template: TemplateStringsArray, ...args: CSSInterpolation[]): string;
586
+ (...args: CSSInterpolation[]): string;
585
587
  };
586
588
  cx: (...args: any) => string;
587
589
  };
@@ -4537,7 +4539,7 @@ export declare interface HvOverflowTooltipProps extends HvBaseProps {
4537
4539
  data: React.ReactNode;
4538
4540
  /** If true, the tooltip is shown. */
4539
4541
  open?: boolean;
4540
- /** If `true` the overflow tooltip will always use the paragraph overflow style. */
4542
+ /** If `true`, the overflow tooltip will always use the paragraph overflow style. */
4541
4543
  paragraphOverflow?: boolean;
4542
4544
  /** Tooltip placement. */
4543
4545
  placement?: "bottom-end" | "bottom-start" | "bottom" | "left-end" | "left-start" | "left" | "right-end" | "right-start" | "right" | "top-end" | "top-start" | "top";
@@ -8460,7 +8462,7 @@ declare const useClasses_114: (classesProp?: Partial<Record<"root" | "topGroup"
8460
8462
  actionButtonContainer: string;
8461
8463
  topRulesContainer: string;
8462
8464
  buttonBackground: string;
8463
- };
8465
+ }; /** Styles applied to the action button container. */
8464
8466
  css: {
8465
8467
  (template: TemplateStringsArray, ...args: CSSInterpolation[]): string;
8466
8468
  (...args: CSSInterpolation[]): string;
@@ -9101,8 +9103,8 @@ declare const useClasses_37: (classesProp?: Partial<Record<"link" | "root" | "me
9101
9103
  button: string;
9102
9104
  };
9103
9105
  css: {
9104
- (template: TemplateStringsArray, ...args: CSSInterpolation_2[]): string;
9105
- (...args: CSSInterpolation_2[]): string;
9106
+ (template: TemplateStringsArray, ...args: CSSInterpolation[]): string;
9107
+ (...args: CSSInterpolation[]): string;
9106
9108
  };
9107
9109
  cx: (...args: any) => string;
9108
9110
  };
@@ -9390,7 +9392,7 @@ declare const useClasses_53: (classesProp?: Partial<Record<"root" | "disabled" |
9390
9392
  cx: (...args: any) => string;
9391
9393
  };
9392
9394
 
9393
- declare const useClasses_54: (classesProp?: Partial<Record<"root" | "title" | "single" | "actionsContainer" | "open" | "item" | "itemSelected" | "itemDisabled" | "itemTrigger" | "itemIcon" | "itemTitle" | "itemInfoIcon" | "footerContainer" | "closed" | "dual" | "fluid", string>>, addStatic?: boolean) => {
9395
+ declare const useClasses_54: (classesProp?: Partial<Record<"root" | "title" | "single" | "actionsContainer" | "open" | "item" | "titleAnchor" | "itemSelected" | "itemDisabled" | "itemTrigger" | "itemIcon" | "itemTitle" | "itemInfoIcon" | "footerContainer" | "closed" | "dual" | "fluid", string>>, addStatic?: boolean) => {
9394
9396
  classes: {
9395
9397
  root: string;
9396
9398
  title: string;
@@ -9398,6 +9400,7 @@ declare const useClasses_54: (classesProp?: Partial<Record<"root" | "title" | "s
9398
9400
  actionsContainer: string;
9399
9401
  open: string;
9400
9402
  item: string;
9403
+ titleAnchor: string;
9401
9404
  itemSelected: string;
9402
9405
  itemDisabled: string;
9403
9406
  itemTrigger: string;
@@ -9416,7 +9419,7 @@ declare const useClasses_54: (classesProp?: Partial<Record<"root" | "title" | "s
9416
9419
  cx: (...args: any) => string;
9417
9420
  };
9418
9421
 
9419
- declare const useClasses_55: (classesProp?: Partial<Record<"typography" | "root" | "disabled" | "icon" | "title" | "selected" | "iconUrl" | "iconInfo", string>>, addStatic?: boolean) => {
9422
+ declare const useClasses_55: (classesProp?: Partial<Record<"typography" | "root" | "disabled" | "icon" | "title" | "selected" | "iconUrl" | "iconInfo" | "titleAnchor", string>>, addStatic?: boolean) => {
9420
9423
  classes: {
9421
9424
  typography: string;
9422
9425
  root: string;
@@ -9426,6 +9429,7 @@ declare const useClasses_55: (classesProp?: Partial<Record<"typography" | "root"
9426
9429
  selected: string;
9427
9430
  iconUrl: string;
9428
9431
  iconInfo: string;
9432
+ titleAnchor: string;
9429
9433
  };
9430
9434
  css: {
9431
9435
  (template: TemplateStringsArray, ...args: CSSInterpolation[]): string;