@hitachivantara/uikit-react-core 5.36.4 → 5.36.6

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 (90) 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/OverflowTooltip/OverflowTooltip.cjs +9 -2
  18. package/dist/cjs/components/OverflowTooltip/OverflowTooltip.cjs.map +1 -1
  19. package/dist/cjs/components/OverflowTooltip/OverflowTooltip.styles.cjs +2 -2
  20. package/dist/cjs/components/OverflowTooltip/OverflowTooltip.styles.cjs.map +1 -1
  21. package/dist/cjs/components/Table/TableCell/TableCell.cjs +5 -8
  22. package/dist/cjs/components/Table/TableCell/TableCell.cjs.map +1 -1
  23. package/dist/cjs/components/Table/TableRow/TableRow.cjs +3 -20
  24. package/dist/cjs/components/Table/TableRow/TableRow.cjs.map +1 -1
  25. package/dist/cjs/components/Tooltip/Tooltip.cjs +2 -1
  26. package/dist/cjs/components/Tooltip/Tooltip.cjs.map +1 -1
  27. package/dist/cjs/components/TreeView/internals/DescendantProvider.cjs +0 -3
  28. package/dist/cjs/components/TreeView/internals/DescendantProvider.cjs.map +1 -1
  29. package/dist/cjs/components/TreeView/internals/TreeViewProvider.cjs +0 -3
  30. package/dist/cjs/components/TreeView/internals/TreeViewProvider.cjs.map +1 -1
  31. package/dist/cjs/components/Typography/utils.cjs +3 -13
  32. package/dist/cjs/components/Typography/utils.cjs.map +1 -1
  33. package/dist/cjs/components/VerticalNavigation/TreeView/descendants.cjs +0 -3
  34. package/dist/cjs/components/VerticalNavigation/TreeView/descendants.cjs.map +1 -1
  35. package/dist/cjs/hooks/useControlled.cjs +0 -3
  36. package/dist/cjs/hooks/useControlled.cjs.map +1 -1
  37. package/dist/cjs/providers/Provider.cjs +3 -2
  38. package/dist/cjs/providers/Provider.cjs.map +1 -1
  39. package/dist/cjs/utils/document.cjs +11 -0
  40. package/dist/cjs/utils/document.cjs.map +1 -0
  41. package/dist/cjs/utils/theme.cjs +5 -7
  42. package/dist/cjs/utils/theme.cjs.map +1 -1
  43. package/dist/esm/components/AppSwitcher/Action/Action.js +4 -2
  44. package/dist/esm/components/AppSwitcher/Action/Action.js.map +1 -1
  45. package/dist/esm/components/AppSwitcher/Action/Action.styles.js +6 -8
  46. package/dist/esm/components/AppSwitcher/Action/Action.styles.js.map +1 -1
  47. package/dist/esm/components/AppSwitcher/AppSwitcher.js +4 -2
  48. package/dist/esm/components/AppSwitcher/AppSwitcher.js.map +1 -1
  49. package/dist/esm/components/AppSwitcher/AppSwitcher.styles.js +4 -3
  50. package/dist/esm/components/AppSwitcher/AppSwitcher.styles.js.map +1 -1
  51. package/dist/esm/components/BreadCrumb/Page/Page.js +1 -1
  52. package/dist/esm/components/Button/Button.js +0 -3
  53. package/dist/esm/components/Button/Button.js.map +1 -1
  54. package/dist/esm/components/Calendar/utils.js.map +1 -1
  55. package/dist/esm/components/Dialog/Dialog.js +2 -5
  56. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  57. package/dist/esm/components/Dropdown/Dropdown.js +0 -3
  58. package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
  59. package/dist/esm/components/OverflowTooltip/OverflowTooltip.js +9 -2
  60. package/dist/esm/components/OverflowTooltip/OverflowTooltip.js.map +1 -1
  61. package/dist/esm/components/OverflowTooltip/OverflowTooltip.styles.js +2 -2
  62. package/dist/esm/components/OverflowTooltip/OverflowTooltip.styles.js.map +1 -1
  63. package/dist/esm/components/Table/TableCell/TableCell.js +6 -9
  64. package/dist/esm/components/Table/TableCell/TableCell.js.map +1 -1
  65. package/dist/esm/components/Table/TableRow/TableRow.js +4 -21
  66. package/dist/esm/components/Table/TableRow/TableRow.js.map +1 -1
  67. package/dist/esm/components/Tooltip/Tooltip.js +2 -1
  68. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  69. package/dist/esm/components/TreeView/internals/DescendantProvider.js +0 -3
  70. package/dist/esm/components/TreeView/internals/DescendantProvider.js.map +1 -1
  71. package/dist/esm/components/TreeView/internals/TreeViewProvider.js +0 -3
  72. package/dist/esm/components/TreeView/internals/TreeViewProvider.js.map +1 -1
  73. package/dist/esm/components/Typography/utils.js +3 -13
  74. package/dist/esm/components/Typography/utils.js.map +1 -1
  75. package/dist/esm/components/VerticalNavigation/TreeView/descendants.js +0 -3
  76. package/dist/esm/components/VerticalNavigation/TreeView/descendants.js.map +1 -1
  77. package/dist/esm/hooks/useControlled.js +0 -3
  78. package/dist/esm/hooks/useControlled.js.map +1 -1
  79. package/dist/esm/providers/Provider.js +4 -3
  80. package/dist/esm/providers/Provider.js.map +1 -1
  81. package/dist/esm/utils/document.js +11 -0
  82. package/dist/esm/utils/document.js.map +1 -0
  83. package/dist/esm/utils/theme.js +5 -7
  84. package/dist/esm/utils/theme.js.map +1 -1
  85. package/dist/types/index.d.ts +7 -3
  86. package/package.json +5 -5
  87. package/dist/cjs/components/AppSwitcher/TitleWithTooltip.cjs +0 -22
  88. package/dist/cjs/components/AppSwitcher/TitleWithTooltip.cjs.map +0 -1
  89. package/dist/esm/components/AppSwitcher/TitleWithTooltip.js +0 -22
  90. package/dist/esm/components/AppSwitcher/TitleWithTooltip.js.map +0 -1
@@ -24,6 +24,7 @@ const HvOverflowTooltip = (props) => {
24
24
  cx
25
25
  } = OverflowTooltip_styles.useClasses(classesProp);
26
26
  const {
27
+ height = 0,
27
28
  width = 0,
28
29
  ref
29
30
  } = reactResizeDetector.useResizeDetector({
@@ -33,9 +34,15 @@ const HvOverflowTooltip = (props) => {
33
34
  },
34
35
  handleHeight: false
35
36
  });
36
- const scrollWidth = ref.current?.scrollWidth || 0;
37
- const isOverflowing = scrollWidth - width >= 1;
38
37
  const isParag = React.useMemo(() => paragraphOverflow && isParagraph(data?.toString()), [data, paragraphOverflow]);
38
+ const isOverflowing = React.useMemo(() => {
39
+ if (isParag) {
40
+ const scrollHeight = ref.current?.scrollHeight || 0;
41
+ return scrollHeight - height >= 1;
42
+ }
43
+ const scrollWidth = ref.current?.scrollWidth || 0;
44
+ return scrollWidth - width >= 1;
45
+ }, [height, isParag, ref, width]);
39
46
  const content = React.useMemo(() => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cx({
40
47
  [classes.tooltipAnchor]: !isParag,
41
48
  [classes.tooltipAnchorParagraph]: isParag
@@ -1 +1 @@
1
- {"version":3,"file":"OverflowTooltip.cjs","sources":["../../../../src/components/OverflowTooltip/OverflowTooltip.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useResizeDetector } from \"react-resize-detector\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { HvTooltip, HvTooltipProps } from \"@core/components/Tooltip\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./OverflowTooltip.styles\";\n\nexport { staticClasses as overflowTooltipClasses };\nexport type HvOverflowTooltipClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvOverflowTooltipProps extends HvBaseProps {\n /** The node that will be rendered inside the tooltip. */\n data: React.ReactNode;\n /** If true, the tooltip is shown. */\n open?: boolean;\n /** If `true` the overflow tooltip will always use the paragraph overflow style. */\n paragraphOverflow?: boolean;\n /** Tooltip placement. */\n placement?:\n | \"bottom-end\"\n | \"bottom-start\"\n | \"bottom\"\n | \"left-end\"\n | \"left-start\"\n | \"left\"\n | \"right-end\"\n | \"right-start\"\n | \"right\"\n | \"top-end\"\n | \"top-start\"\n | \"top\";\n /** Extra properties to add to the tooltip. */\n tooltipsProps?: Partial<HvTooltipProps>;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvOverflowTooltipClasses;\n}\n\nconst isParagraph = (children = \"\") => /\\s/.test(children);\n\n/**\n * This component generates a tooltip whenever the text is overflowed.\n */\nexport const HvOverflowTooltip = (props: HvOverflowTooltipProps) => {\n const {\n id,\n classes: classesProp,\n className,\n data,\n open,\n paragraphOverflow,\n placement = \"top-start\",\n tooltipsProps,\n } = useDefaultProps(\"HvOverflowTooltip\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const { width = 0, ref } = useResizeDetector({\n refreshMode: \"debounce\",\n refreshOptions: {\n trailing: true,\n },\n handleHeight: false,\n });\n const scrollWidth = ref.current?.scrollWidth || 0;\n // The difference should be higher than a pixel to be considered as overflowing\n const isOverflowing = scrollWidth - width >= 1;\n\n const isParag = useMemo(\n () => paragraphOverflow && isParagraph(data?.toString()),\n [data, paragraphOverflow]\n );\n\n const content = useMemo(\n () => (\n <div\n ref={ref}\n className={cx(\n {\n [classes.tooltipAnchor]: !isParag,\n [classes.tooltipAnchorParagraph]: isParag,\n },\n className\n )}\n >\n {data}\n </div>\n ),\n [\n className,\n classes.tooltipAnchor,\n classes.tooltipAnchorParagraph,\n cx,\n data,\n isParag,\n ref,\n ]\n );\n\n return (\n <HvTooltip\n id={id}\n disableHoverListener={!isOverflowing}\n open={open}\n placement={placement}\n title={\n <HvTypography className={classes.tooltipData} variant=\"body\">\n {data}\n </HvTypography>\n }\n // unset since `content` *is* the label\n aria-label={null as any}\n aria-labelledby={null as any}\n {...tooltipsProps}\n >\n {content}\n </HvTooltip>\n );\n};\n"],"names":["isParagraph","children","test","HvOverflowTooltip","props","id","classes","classesProp","className","data","open","paragraphOverflow","placement","tooltipsProps","useDefaultProps","cx","useClasses","width","ref","useResizeDetector","refreshMode","refreshOptions","trailing","handleHeight","scrollWidth","current","isOverflowing","isParag","useMemo","toString","content","tooltipAnchor","tooltipAnchorParagraph","jsx","HvTooltip","HvTypography","tooltipData"],"mappings":";;;;;;;;;AAyCA,MAAMA,cAAcA,CAACC,WAAW,OAAO,KAAKC,KAAKD,QAAQ;AAK5CE,MAAAA,oBAAoBA,CAACC,UAAkC;AAC5D,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,YAAY;AAAA,IACZC;AAAAA,EAAAA,IACEC,gBAAgB,gBAAA,qBAAqBV,KAAK;AACxC,QAAA;AAAA,IAAEE;AAAAA,IAASS;AAAAA,EAAAA,IAAOC,uBAAAA,WAAWT,WAAW;AAExC,QAAA;AAAA,IAAEU,QAAQ;AAAA,IAAGC;AAAAA,MAAQC,sCAAkB;AAAA,IAC3CC,aAAa;AAAA,IACbC,gBAAgB;AAAA,MACdC,UAAU;AAAA,IACZ;AAAA,IACAC,cAAc;AAAA,EAAA,CACf;AACKC,QAAAA,cAAcN,IAAIO,SAASD,eAAe;AAE1CE,QAAAA,gBAAgBF,cAAcP,SAAS;AAE7C,QAAMU,UAAUC,MAAAA,QACd,MAAMjB,qBAAqBX,YAAYS,MAAMoB,SAAS,CAAC,GACvD,CAACpB,MAAME,iBAAiB,CAC1B;AAEA,QAAMmB,UAAUF,MACd,QAAA,qCACG,OACC,EAAA,KACA,WAAWb,GACT;AAAA,IACE,CAACT,QAAQyB,aAAa,GAAG,CAACJ;AAAAA,IAC1B,CAACrB,QAAQ0B,sBAAsB,GAAGL;AAAAA,EAAAA,GAEpCnB,SACF,GAECC,UAAAA,KAAAA,CACH,GAEF,CACED,WACAF,QAAQyB,eACRzB,QAAQ0B,wBACRjB,IACAN,MACAkB,SACAT,GAAG,CAEP;AAGE,SAAAe,2BAAA;AAAA,IAACC,QAAA;AAAA,IAAA;AAAA,MACC;AAAA,MACA,sBAAsB,CAACR;AAAAA,MACvB;AAAA,MACA;AAAA,MACA,sCACGS,yBAAa,EAAA,WAAW7B,QAAQ8B,aAAa,SAAQ,QACnD3B,UACH,KAAA,CAAA;AAAA,MAGF,cAAY;AAAA,MACZ,mBAAiB;AAAA,MACjB,GAAII;AAAAA,MAEHiB,UAAAA;AAAAA,IAAAA;AAAAA,EAAAA;AAGP;;;"}
1
+ {"version":3,"file":"OverflowTooltip.cjs","sources":["../../../../src/components/OverflowTooltip/OverflowTooltip.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useResizeDetector } from \"react-resize-detector\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { HvTooltip, HvTooltipProps } from \"@core/components/Tooltip\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./OverflowTooltip.styles\";\n\nexport { staticClasses as overflowTooltipClasses };\nexport type HvOverflowTooltipClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvOverflowTooltipProps extends HvBaseProps {\n /** The node that will be rendered inside the tooltip. */\n data: React.ReactNode;\n /** If true, the tooltip is shown. */\n open?: boolean;\n /** If `true`, the overflow tooltip will always use the paragraph overflow style. */\n paragraphOverflow?: boolean;\n /** Tooltip placement. */\n placement?:\n | \"bottom-end\"\n | \"bottom-start\"\n | \"bottom\"\n | \"left-end\"\n | \"left-start\"\n | \"left\"\n | \"right-end\"\n | \"right-start\"\n | \"right\"\n | \"top-end\"\n | \"top-start\"\n | \"top\";\n /** Extra properties to add to the tooltip. */\n tooltipsProps?: Partial<HvTooltipProps>;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvOverflowTooltipClasses;\n}\n\nconst isParagraph = (children = \"\") => /\\s/.test(children);\n\n/**\n * This component generates a tooltip whenever the text is overflowed.\n */\nexport const HvOverflowTooltip = (props: HvOverflowTooltipProps) => {\n const {\n id,\n classes: classesProp,\n className,\n data,\n open,\n paragraphOverflow,\n placement = \"top-start\",\n tooltipsProps,\n } = useDefaultProps(\"HvOverflowTooltip\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const {\n height = 0,\n width = 0,\n ref,\n } = useResizeDetector({\n refreshMode: \"debounce\",\n refreshOptions: {\n trailing: true,\n },\n handleHeight: false,\n });\n\n const isParag = useMemo(\n () => paragraphOverflow && isParagraph(data?.toString()),\n [data, paragraphOverflow]\n );\n\n // The difference should be higher than a pixel to be considered as overflowing\n const isOverflowing = useMemo(() => {\n if (isParag) {\n const scrollHeight = ref.current?.scrollHeight || 0;\n\n return scrollHeight - height >= 1;\n }\n\n const scrollWidth = ref.current?.scrollWidth || 0;\n\n return scrollWidth - width >= 1;\n }, [height, isParag, ref, width]);\n\n const content = useMemo(\n () => (\n <div\n ref={ref}\n className={cx(\n {\n [classes.tooltipAnchor]: !isParag,\n [classes.tooltipAnchorParagraph]: isParag,\n },\n className\n )}\n >\n {data}\n </div>\n ),\n [\n className,\n classes.tooltipAnchor,\n classes.tooltipAnchorParagraph,\n cx,\n data,\n isParag,\n ref,\n ]\n );\n\n return (\n <HvTooltip\n id={id}\n disableHoverListener={!isOverflowing}\n open={open}\n placement={placement}\n title={\n <HvTypography className={classes.tooltipData} variant=\"body\">\n {data}\n </HvTypography>\n }\n // unset since `content` *is* the label\n aria-label={null as any}\n aria-labelledby={null as any}\n {...tooltipsProps}\n >\n {content}\n </HvTooltip>\n );\n};\n"],"names":["isParagraph","children","test","HvOverflowTooltip","props","id","classes","classesProp","className","data","open","paragraphOverflow","placement","tooltipsProps","useDefaultProps","cx","useClasses","height","width","ref","useResizeDetector","refreshMode","refreshOptions","trailing","handleHeight","isParag","useMemo","toString","isOverflowing","scrollHeight","current","scrollWidth","content","tooltipAnchor","tooltipAnchorParagraph","jsx","HvTooltip","HvTypography","tooltipData"],"mappings":";;;;;;;;;AAyCA,MAAMA,cAAcA,CAACC,WAAW,OAAO,KAAKC,KAAKD,QAAQ;AAK5CE,MAAAA,oBAAoBA,CAACC,UAAkC;AAC5D,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,YAAY;AAAA,IACZC;AAAAA,EAAAA,IACEC,gBAAgB,gBAAA,qBAAqBV,KAAK;AAExC,QAAA;AAAA,IAAEE;AAAAA,IAASS;AAAAA,EAAAA,IAAOC,uBAAAA,WAAWT,WAAW;AAExC,QAAA;AAAA,IACJU,SAAS;AAAA,IACTC,QAAQ;AAAA,IACRC;AAAAA,MACEC,sCAAkB;AAAA,IACpBC,aAAa;AAAA,IACbC,gBAAgB;AAAA,MACdC,UAAU;AAAA,IACZ;AAAA,IACAC,cAAc;AAAA,EAAA,CACf;AAED,QAAMC,UAAUC,MAAAA,QACd,MAAMf,qBAAqBX,YAAYS,MAAMkB,SAAS,CAAC,GACvD,CAAClB,MAAME,iBAAiB,CAC1B;AAGMiB,QAAAA,gBAAgBF,MAAAA,QAAQ,MAAM;AAClC,QAAID,SAAS;AACLI,YAAAA,eAAeV,IAAIW,SAASD,gBAAgB;AAElD,aAAOA,eAAeZ,UAAU;AAAA,IAClC;AAEMc,UAAAA,cAAcZ,IAAIW,SAASC,eAAe;AAEhD,WAAOA,cAAcb,SAAS;AAAA,KAC7B,CAACD,QAAQQ,SAASN,KAAKD,KAAK,CAAC;AAEhC,QAAMc,UAAUN,MACd,QAAA,qCACG,OACC,EAAA,KACA,WAAWX,GACT;AAAA,IACE,CAACT,QAAQ2B,aAAa,GAAG,CAACR;AAAAA,IAC1B,CAACnB,QAAQ4B,sBAAsB,GAAGT;AAAAA,EAAAA,GAEpCjB,SACF,GAECC,UAAAA,KAAAA,CACH,GAEF,CACED,WACAF,QAAQ2B,eACR3B,QAAQ4B,wBACRnB,IACAN,MACAgB,SACAN,GAAG,CAEP;AAGE,SAAAgB,2BAAA;AAAA,IAACC,QAAA;AAAA,IAAA;AAAA,MACC;AAAA,MACA,sBAAsB,CAACR;AAAAA,MACvB;AAAA,MACA;AAAA,MACA,sCACGS,yBAAa,EAAA,WAAW/B,QAAQgC,aAAa,SAAQ,QACnD7B,UACH,KAAA,CAAA;AAAA,MAGF,cAAY;AAAA,MACZ,mBAAiB;AAAA,MACjB,GAAII;AAAAA,MAEHmB,UAAAA;AAAAA,IAAAA;AAAAA,EAAAA;AAGP;;;"}
@@ -14,8 +14,8 @@ const {
14
14
  tooltipAnchorParagraph: {
15
15
  overflow: "hidden",
16
16
  display: "-webkit-box",
17
- "-webkit-line-clamp": 2,
18
- "-webkit-box-orient": "vertical"
17
+ WebkitLineClamp: 3,
18
+ WebkitBoxOrient: "vertical"
19
19
  }
20
20
  });
21
21
  exports.staticClasses = staticClasses;
@@ -1 +1 @@
1
- {"version":3,"file":"OverflowTooltip.styles.cjs","sources":["../../../../src/components/OverflowTooltip/OverflowTooltip.styles.tsx"],"sourcesContent":["import { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\n \"HvOverflowTooltip\",\n {\n tooltipData: {},\n tooltipAnchor: {\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n },\n tooltipAnchorParagraph: {\n overflow: \"hidden\",\n display: \"-webkit-box\",\n \"-webkit-line-clamp\": 2,\n \"-webkit-box-orient\": \"vertical\",\n },\n }\n);\n"],"names":["staticClasses","useClasses","createClasses","tooltipData","tooltipAnchor","whiteSpace","overflow","textOverflow","tooltipAnchorParagraph","display"],"mappings":";;;AAEa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,QAAAA,cAC3C,qBACA;AAAA,EACEC,aAAa,CAAC;AAAA,EACdC,eAAe;AAAA,IACbC,YAAY;AAAA,IACZC,UAAU;AAAA,IACVC,cAAc;AAAA,EAChB;AAAA,EACAC,wBAAwB;AAAA,IACtBF,UAAU;AAAA,IACVG,SAAS;AAAA,IACT,sBAAsB;AAAA,IACtB,sBAAsB;AAAA,EACxB;AACF,CACF;;;"}
1
+ {"version":3,"file":"OverflowTooltip.styles.cjs","sources":["../../../../src/components/OverflowTooltip/OverflowTooltip.styles.tsx"],"sourcesContent":["import { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\n \"HvOverflowTooltip\",\n {\n tooltipData: {},\n tooltipAnchor: {\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n },\n tooltipAnchorParagraph: {\n overflow: \"hidden\",\n display: \"-webkit-box\",\n WebkitLineClamp: 3,\n WebkitBoxOrient: \"vertical\",\n },\n }\n);\n"],"names":["staticClasses","useClasses","createClasses","tooltipData","tooltipAnchor","whiteSpace","overflow","textOverflow","tooltipAnchorParagraph","display","WebkitLineClamp","WebkitBoxOrient"],"mappings":";;;AAEa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,QAAAA,cAC3C,qBACA;AAAA,EACEC,aAAa,CAAC;AAAA,EACdC,eAAe;AAAA,IACbC,YAAY;AAAA,IACZC,UAAU;AAAA,IACVC,cAAc;AAAA,EAChB;AAAA,EACAC,wBAAwB;AAAA,IACtBF,UAAU;AAAA,IACVG,SAAS;AAAA,IACTC,iBAAiB;AAAA,IACjBC,iBAAiB;AAAA,EACnB;AACF,CACF;;;"}
@@ -49,16 +49,13 @@ const HvTableCell = React.forwardRef((props, externalRef) => {
49
49
  } = useTheme.useTheme();
50
50
  const tableContext = React.useContext(TableContext.default);
51
51
  const tableSectionContext = React.useContext(TableSectionContext.default);
52
- const [sortedColorValue, setSortedColorValue] = React.useState();
53
- const [sortedColorAlpha, setSortedColorAlpha] = React.useState();
54
52
  const type = typeProp || tableSectionContext?.type || "body";
55
53
  const Component = component || tableContext?.components?.Td || defaultComponent;
56
- const [sortedColor, setSortedColor] = React.useState(getSortedColor(sortedColorValue, sortedColorAlpha));
57
- React.useEffect(() => {
58
- setSortedColorValue(theme.getVarValue(uikitStyles.theme.table.rowSortedColor, rootId));
59
- setSortedColorAlpha(theme.getVarValue(uikitStyles.theme.table.rowSortedColorAlpha, rootId));
60
- setSortedColor(getSortedColor(sortedColorValue, sortedColorAlpha));
61
- }, [colors, sortedColorValue, sortedColorAlpha, rootId]);
54
+ const sortedColor = React.useMemo(() => {
55
+ const color = theme.getVarValue(uikitStyles.theme.table.rowSortedColor, rootId) || colors?.primary_20;
56
+ const alpha = theme.getVarValue(uikitStyles.theme.table.rowSortedColorAlpha, rootId) || "0.1";
57
+ return getSortedColor(color, alpha);
58
+ }, [colors, rootId]);
62
59
  return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref: externalRef, role: Component === defaultComponent ? null : "cell", style, className: cx(classes.root, classes[type], type === "body" && css({
63
60
  [`&.${TableCell_styles.staticClasses.sorted}`]: {
64
61
  backgroundColor: sortedColor
@@ -1 +1 @@
1
- {"version":3,"file":"TableCell.cjs","sources":["../../../../../src/components/Table/TableCell/TableCell.tsx"],"sourcesContent":["import {\n CSSProperties,\n forwardRef,\n TdHTMLAttributes,\n useContext,\n useEffect,\n useState,\n} from \"react\";\nimport capitalize from \"lodash/capitalize\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { checkValidHexColorValue } from \"@core/utils/checkValidHexColorValue\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { getVarValue } from \"@core/utils/theme\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\nimport { useTheme } from \"@core/hooks/useTheme\";\n\nimport { useDefaultProps } from \"@core/hooks\";\n\nimport {\n HvTableCellAlign,\n HvTableCellType,\n HvTableCellVariant,\n} from \"../Table\";\nimport TableContext from \"../TableContext\";\nimport TableSectionContext from \"../TableSectionContext\";\nimport { staticClasses, useClasses } from \"./TableCell.styles\";\n\nexport { staticClasses as tableCellClasses };\n\nexport type HvTableCellClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableCellProps\n extends Omit<TdHTMLAttributes<HTMLTableCellElement>, \"align\"> {\n /** The component used for the root node. Either a string to use a HTML element or a component. Defaults to td. */\n component?: React.ElementType;\n /** Content to be rendered */\n children?: React.ReactNode;\n /** Inline styles to be applied to the root element. */\n style?: CSSProperties;\n /** Set the text-align on the table cell content. */\n align?: HvTableCellAlign;\n /** Sets the cell's variant. */\n variant?: HvTableCellVariant | \"listcheckbox\" | \"listactions\";\n /** Specify the cell's type. The prop defaults to the value inherited from the parent TableHead, TableBody, or TableFooter components. */\n type?: HvTableCellType;\n /** Whether or not the cell is part of a sorted column. */\n sorted?: boolean;\n /** The cell is part of a sticky column. */\n stickyColumn?: boolean;\n /** The cell is part of the last sticky to the left column. */\n stickyColumnMostLeft?: boolean;\n /** The cell is part of the first sticky to the right column. */\n stickyColumnLeastRight?: boolean;\n /** The cell is part of the first column in the group. */\n groupColumnMostLeft?: boolean;\n /** The cell is part of the last column in the group. */\n groupColumnMostRight?: boolean;\n /** Whether or not the cell is resizable */\n resizable?: boolean;\n /** Whether or not the cell is being resized */\n resizing?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableCellClasses;\n}\n\nconst defaultComponent = \"td\";\n\nconst getSortedColor = (color?: string, alpha?: string) => {\n return checkValidHexColorValue(color) && alpha\n ? hexToRgbA(color, parseFloat(alpha))\n : color;\n};\n\n/**\n * `HvTableCell` acts as a `td` element and inherits styles from its context\n */\nexport const HvTableCell = forwardRef<HTMLElement, HvTableCellProps>(\n (props, externalRef) => {\n const {\n children,\n component,\n className,\n style,\n classes: classesProp,\n align = \"inherit\",\n variant = \"default\",\n type: typeProp,\n stickyColumn = false,\n stickyColumnMostLeft = false,\n stickyColumnLeastRight = false,\n groupColumnMostLeft = false,\n groupColumnMostRight = false,\n sorted = false,\n resizable = false,\n resizing = false,\n ...others\n } = useDefaultProps(\"HvTableCell\", props);\n const { classes, cx, css } = useClasses(classesProp);\n const { colors, rootId } = useTheme();\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const [sortedColorValue, setSortedColorValue] = useState<string>();\n const [sortedColorAlpha, setSortedColorAlpha] = useState<string>();\n\n const type = typeProp || tableSectionContext?.type || \"body\";\n\n const Component =\n component || tableContext?.components?.Td || defaultComponent;\n\n const [sortedColor, setSortedColor] = useState(\n getSortedColor(sortedColorValue, sortedColorAlpha)\n );\n\n useEffect(() => {\n setSortedColorValue(getVarValue(theme.table.rowSortedColor, rootId));\n setSortedColorAlpha(getVarValue(theme.table.rowSortedColorAlpha, rootId));\n\n setSortedColor(getSortedColor(sortedColorValue, sortedColorAlpha));\n }, [colors, sortedColorValue, sortedColorAlpha, rootId]);\n\n return (\n <Component\n ref={externalRef}\n role={Component === defaultComponent ? null : \"cell\"}\n style={style}\n className={cx(\n classes.root,\n classes[type],\n type === \"body\" &&\n css({\n [`&.${staticClasses.sorted}`]: {\n backgroundColor: sortedColor,\n },\n }),\n stickyColumn &&\n css({\n [`&.${staticClasses.sorted}`]: {\n backgroundImage: `linear-gradient(to right, ${sortedColor}, ${sortedColor})`,\n },\n }),\n {\n [classes[`align${capitalize(align)}`]]: align !== \"inherit\",\n [classes.variantList]: tableContext.variant === \"listrow\",\n [classes.variantListHead]:\n tableContext.variant === \"listrow\" && type !== \"body\",\n [classes[`variant${capitalize(variant)}`]]: variant !== \"default\",\n [classes.sorted]: sorted,\n [classes.stickyColumn]: stickyColumn,\n [classes.stickyColumnMostLeft]: stickyColumnMostLeft,\n [classes.stickyColumnLeastRight]: stickyColumnLeastRight,\n [classes.groupColumnMostLeft]: groupColumnMostLeft,\n [classes.groupColumnMostRight]: groupColumnMostRight,\n [classes.resizable]: resizable,\n [classes.resizing]: resizing,\n },\n className\n )}\n {...others}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["defaultComponent","getSortedColor","color","alpha","checkValidHexColorValue","hexToRgbA","parseFloat","HvTableCell","forwardRef","props","externalRef","children","component","className","style","classes","classesProp","align","variant","type","typeProp","stickyColumn","stickyColumnMostLeft","stickyColumnLeastRight","groupColumnMostLeft","groupColumnMostRight","sorted","resizable","resizing","others","useDefaultProps","cx","css","useClasses","colors","rootId","useTheme","tableContext","useContext","TableContext","tableSectionContext","TableSectionContext","sortedColorValue","setSortedColorValue","useState","sortedColorAlpha","setSortedColorAlpha","Component","components","Td","sortedColor","setSortedColor","useEffect","getVarValue","theme","table","rowSortedColor","rowSortedColorAlpha","root","staticClasses","backgroundColor","backgroundImage","capitalize","variantList","variantListHead"],"mappings":";;;;;;;;;;;;;;;;AAmEA,MAAMA,mBAAmB;AAEzB,MAAMC,iBAAiBA,CAACC,OAAgBC,UAAmB;AAClDC,SAAAA,wBAAAA,wBAAwBF,KAAK,KAAKC,QACrCE,UAAAA,UAAUH,OAAOI,WAAWH,KAAK,CAAC,IAClCD;AACN;AAKO,MAAMK,cAAcC,MAAAA,WACzB,CAACC,OAAOC,gBAAgB;AAChB,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,SAASC;AAAAA,IACTC,QAAQ;AAAA,IACRC,UAAU;AAAA,IACVC,MAAMC;AAAAA,IACNC,eAAe;AAAA,IACfC,uBAAuB;AAAA,IACvBC,yBAAyB;AAAA,IACzBC,sBAAsB;AAAA,IACtBC,uBAAuB;AAAA,IACvBC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZC,WAAW;AAAA,IACX,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,gBAAA,eAAerB,KAAK;AAClC,QAAA;AAAA,IAAEM;AAAAA,IAASgB;AAAAA,IAAIC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C,QAAS,QAAO+C,oBAAAA,QAAW7C,KAAK,CAAE,EAAC,CAAC,GAAGA,UAAU;AAAA,IAClD,CAACF,QAAQgD,WAAW,GAAG1B,aAAanB,YAAY;AAAA,IAChD,CAACH,QAAQiD,eAAe,GACtB3B,aAAanB,YAAY,aAAaC,SAAS;AAAA,IACjD,CAACJ,QAAS,UAAS+C,oBAAAA,QAAW5C,OAAO,CAAE,EAAC,CAAC,GAAGA,YAAY;AAAA,IACxD,CAACH,QAAQW,MAAM,GAAGA;AAAAA,IAClB,CAACX,QAAQM,YAAY,GAAGA;AAAAA,IACxB,CAACN,QAAQO,oBAAoB,GAAGA;AAAAA,IAChC,CAACP,QAAQQ,sBAAsB,GAAGA;AAAAA,IAClC,CAACR,QAAQS,mBAAmB,GAAGA;AAAAA,IAC/B,CAACT,QAAQU,oBAAoB,GAAGA;AAAAA,IAChC,CAACV,QAAQY,SAAS,GAAGA;AAAAA,IACrB,CAACZ,QAAQa,QAAQ,GAAGA;AAAAA,EAEtBf,GAAAA,SACF,GACA,GAAIgB,QAEHlB,SACH,CAAA;AAEJ,CACF;;;"}
1
+ {"version":3,"file":"TableCell.cjs","sources":["../../../../../src/components/Table/TableCell/TableCell.tsx"],"sourcesContent":["import {\n CSSProperties,\n forwardRef,\n TdHTMLAttributes,\n useContext,\n useMemo,\n} from \"react\";\nimport capitalize from \"lodash/capitalize\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { checkValidHexColorValue } from \"@core/utils/checkValidHexColorValue\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { getVarValue } from \"@core/utils/theme\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useDefaultProps } from \"@core/hooks\";\n\nimport {\n HvTableCellAlign,\n HvTableCellType,\n HvTableCellVariant,\n} from \"../Table\";\nimport TableContext from \"../TableContext\";\nimport TableSectionContext from \"../TableSectionContext\";\nimport { staticClasses, useClasses } from \"./TableCell.styles\";\n\nexport { staticClasses as tableCellClasses };\n\nexport type HvTableCellClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableCellProps\n extends Omit<TdHTMLAttributes<HTMLTableCellElement>, \"align\"> {\n /** The component used for the root node. Either a string to use a HTML element or a component. Defaults to td. */\n component?: React.ElementType;\n /** Content to be rendered */\n children?: React.ReactNode;\n /** Inline styles to be applied to the root element. */\n style?: CSSProperties;\n /** Set the text-align on the table cell content. */\n align?: HvTableCellAlign;\n /** Sets the cell's variant. */\n variant?: HvTableCellVariant | \"listcheckbox\" | \"listactions\";\n /** Specify the cell's type. The prop defaults to the value inherited from the parent TableHead, TableBody, or TableFooter components. */\n type?: HvTableCellType;\n /** Whether or not the cell is part of a sorted column. */\n sorted?: boolean;\n /** The cell is part of a sticky column. */\n stickyColumn?: boolean;\n /** The cell is part of the last sticky to the left column. */\n stickyColumnMostLeft?: boolean;\n /** The cell is part of the first sticky to the right column. */\n stickyColumnLeastRight?: boolean;\n /** The cell is part of the first column in the group. */\n groupColumnMostLeft?: boolean;\n /** The cell is part of the last column in the group. */\n groupColumnMostRight?: boolean;\n /** Whether or not the cell is resizable */\n resizable?: boolean;\n /** Whether or not the cell is being resized */\n resizing?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableCellClasses;\n}\n\nconst defaultComponent = \"td\";\n\nconst getSortedColor = (color?: string, alpha?: string) => {\n return checkValidHexColorValue(color) && alpha\n ? hexToRgbA(color, parseFloat(alpha))\n : color;\n};\n\n/**\n * `HvTableCell` acts as a `td` element and inherits styles from its context\n */\nexport const HvTableCell = forwardRef<HTMLElement, HvTableCellProps>(\n (props, externalRef) => {\n const {\n children,\n component,\n className,\n style,\n classes: classesProp,\n align = \"inherit\",\n variant = \"default\",\n type: typeProp,\n stickyColumn = false,\n stickyColumnMostLeft = false,\n stickyColumnLeastRight = false,\n groupColumnMostLeft = false,\n groupColumnMostRight = false,\n sorted = false,\n resizable = false,\n resizing = false,\n ...others\n } = useDefaultProps(\"HvTableCell\", props);\n const { classes, cx, css } = useClasses(classesProp);\n const { colors, rootId } = useTheme();\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const type = typeProp || tableSectionContext?.type || \"body\";\n\n const Component =\n component || tableContext?.components?.Td || defaultComponent;\n\n const sortedColor = useMemo(() => {\n // \"colors\" makes the \"sortedColor\" change with the color mode and theme\n const color =\n getVarValue(theme.table.rowSortedColor, rootId) || colors?.primary_20;\n const alpha =\n getVarValue(theme.table.rowSortedColorAlpha, rootId) || \"0.1\";\n\n return getSortedColor(color, alpha);\n }, [colors, rootId]);\n\n return (\n <Component\n ref={externalRef}\n role={Component === defaultComponent ? null : \"cell\"}\n style={style}\n className={cx(\n classes.root,\n classes[type],\n type === \"body\" &&\n css({\n [`&.${staticClasses.sorted}`]: {\n backgroundColor: sortedColor,\n },\n }),\n stickyColumn &&\n css({\n [`&.${staticClasses.sorted}`]: {\n backgroundImage: `linear-gradient(to right, ${sortedColor}, ${sortedColor})`,\n },\n }),\n {\n [classes[`align${capitalize(align)}`]]: align !== \"inherit\",\n [classes.variantList]: tableContext.variant === \"listrow\",\n [classes.variantListHead]:\n tableContext.variant === \"listrow\" && type !== \"body\",\n [classes[`variant${capitalize(variant)}`]]: variant !== \"default\",\n [classes.sorted]: sorted,\n [classes.stickyColumn]: stickyColumn,\n [classes.stickyColumnMostLeft]: stickyColumnMostLeft,\n [classes.stickyColumnLeastRight]: stickyColumnLeastRight,\n [classes.groupColumnMostLeft]: groupColumnMostLeft,\n [classes.groupColumnMostRight]: groupColumnMostRight,\n [classes.resizable]: resizable,\n [classes.resizing]: resizing,\n },\n className\n )}\n {...others}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["defaultComponent","getSortedColor","color","alpha","checkValidHexColorValue","hexToRgbA","parseFloat","HvTableCell","forwardRef","props","externalRef","children","component","className","style","classes","classesProp","align","variant","type","typeProp","stickyColumn","stickyColumnMostLeft","stickyColumnLeastRight","groupColumnMostLeft","groupColumnMostRight","sorted","resizable","resizing","others","useDefaultProps","cx","css","useClasses","colors","rootId","useTheme","tableContext","useContext","TableContext","tableSectionContext","TableSectionContext","Component","components","Td","sortedColor","useMemo","getVarValue","theme","table","rowSortedColor","primary_20","rowSortedColorAlpha","root","staticClasses","backgroundColor","backgroundImage","capitalize","variantList","variantListHead"],"mappings":";;;;;;;;;;;;;;;;AAgEA,MAAMA,mBAAmB;AAEzB,MAAMC,iBAAiBA,CAACC,OAAgBC,UAAmB;AAClDC,SAAAA,wBAAAA,wBAAwBF,KAAK,KAAKC,QACrCE,UAAAA,UAAUH,OAAOI,WAAWH,KAAK,CAAC,IAClCD;AACN;AAKO,MAAMK,cAAcC,MAAAA,WACzB,CAACC,OAAOC,gBAAgB;AAChB,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,SAASC;AAAAA,IACTC,QAAQ;AAAA,IACRC,UAAU;AAAA,IACVC,MAAMC;AAAAA,IACNC,eAAe;AAAA,IACfC,uBAAuB;AAAA,IACvBC,yBAAyB;AAAA,IACzBC,sBAAsB;AAAA,IACtBC,uBAAuB;AAAA,IACvBC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZC,WAAW;AAAA,IACX,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,gBAAA,eAAerB,KAAK;AAClC,QAAA;AAAA,IAAEM;AAAAA,IAASgB;AAAAA,IAAIC;AAAAA,EAAAA,IAAQC,iBAAAA,WAAWjB,WAAW;AAC7C,QAAA;AAAA,IAAEkB;AAAAA,IAAQC;AAAAA,MAAWC,SAAS,SAAA;AAC9BC,QAAAA,eAAeC,iBAAWC,aAAAA,OAAY;AACtCC,QAAAA,sBAAsBF,iBAAWG,oBAAAA,OAAmB;AAEpDtB,QAAAA,OAAOC,YAAYoB,qBAAqBrB,QAAQ;AAEtD,QAAMuB,YACJ9B,aAAayB,cAAcM,YAAYC,MAAM5C;AAEzC6C,QAAAA,cAAcC,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AAGA;AAAAA,IAChC,CAACV,QAAQY,SAAS,GAAGA;AAAAA,IACrB,CAACZ,QAAQa,QAAQ,GAAGA;AAAAA,EAEtBf,GAAAA,SACF,GACA,GAAIgB,QAEHlB,SACH,CAAA;AAEJ,CACF;;;"}
@@ -2,19 +2,13 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("@emotion/react/jsx-runtime");
4
4
  const React = require("react");
5
- const uikitStyles = require("@hitachivantara/uikit-styles");
6
- const checkValidHexColorValue = require("../../../utils/checkValidHexColorValue.cjs");
7
5
  const hexToRgbA = require("../../../utils/hexToRgbA.cjs");
8
- const theme = require("../../../utils/theme.cjs");
9
6
  const useTheme = require("../../../hooks/useTheme.cjs");
10
7
  const TableContext = require("../TableContext.cjs");
11
8
  const TableSectionContext = require("../TableSectionContext.cjs");
12
9
  const TableRow_styles = require("./TableRow.styles.cjs");
13
10
  const useDefaultProps = require("../../../hooks/useDefaultProps.cjs");
14
11
  const defaultComponent = "tr";
15
- const getStripedColor = (color, opacity = 0.6) => {
16
- return checkValidHexColorValue.checkValidHexColorValue(color) ? hexToRgbA.hexToRgbA(color, opacity) : color;
17
- };
18
12
  const HvTableRow = React.forwardRef((props, externalRef) => {
19
13
  const {
20
14
  classes: classesProp,
@@ -32,30 +26,19 @@ const HvTableRow = React.forwardRef((props, externalRef) => {
32
26
  css
33
27
  } = TableRow_styles.useClasses(classesProp);
34
28
  const {
35
- colors,
36
- rootId
29
+ colors
37
30
  } = useTheme.useTheme();
38
31
  const tableContext = React.useContext(TableContext.default);
39
32
  const tableSectionContext = React.useContext(TableSectionContext.default);
40
- const [even, setEven] = React.useState();
41
- const [odd, setOdd] = React.useState();
42
33
  const type = tableSectionContext?.type || "body";
43
34
  const isList = tableContext.variant === "listrow";
44
35
  const Component = component || tableContext?.components?.Tr || defaultComponent;
45
- const [stripedColorEven, setStripedColorEven] = React.useState(getStripedColor(even));
46
- const [stripedColorOdd, setStripedColorOdd] = React.useState(getStripedColor(odd));
47
- React.useEffect(() => {
48
- setEven(theme.getVarValue(uikitStyles.theme.table.rowStripedBackgroundColorEven, rootId));
49
- setOdd(theme.getVarValue(uikitStyles.theme.table.rowStripedBackgroundColorOdd, rootId));
50
- setStripedColorEven(getStripedColor(even));
51
- setStripedColorOdd(getStripedColor(odd));
52
- }, [colors, even, odd, rootId]);
53
36
  return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref: externalRef, className: cx(tableSectionContext.filterClassName, classes.root, classes[type], striped && css({
54
37
  "&:nth-of-type(even)": {
55
- backgroundColor: stripedColorEven
38
+ backgroundColor: hexToRgbA.hexToRgbA(colors?.atmo1, 0.6)
56
39
  },
57
40
  "&:nth-of-type(odd)": {
58
- backgroundColor: stripedColorOdd
41
+ backgroundColor: "transparent"
59
42
  }
60
43
  }), {
61
44
  [classes.hover]: hover,
@@ -1 +1 @@
1
- {"version":3,"file":"TableRow.cjs","sources":["../../../../../src/components/Table/TableRow/TableRow.tsx"],"sourcesContent":["import { forwardRef, useContext, useEffect, useState } from \"react\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { checkValidHexColorValue } from \"@core/utils/checkValidHexColorValue\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\nimport { getVarValue } from \"@core/utils/theme\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useTheme } from \"@core/hooks/useTheme\";\n\nimport { useDefaultProps } from \"@core/hooks\";\n\nimport TableContext from \"../TableContext\";\nimport TableSectionContext from \"../TableSectionContext\";\nimport { staticClasses, useClasses } from \"./TableRow.styles\";\n\nexport { staticClasses as tableRowClasses };\n\nexport type HvTableRowClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableRowProps\n extends HvBaseProps<HTMLTableRowElement, \"children\"> {\n /** Content to be rendered */\n children: React.ReactNode;\n /** The component used for the root node. Either a string to use a HTML element or a component. Defaults to tbody. */\n component?: React.ElementType;\n /** Whether the table row will shade on hover. */\n hover?: boolean;\n /** Whether the table row will have the selected shading. */\n selected?: boolean;\n /** Whether the table row is expanded. */\n expanded?: boolean;\n /** Whether the table row background is striped. */\n striped?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableRowClasses;\n}\n\nconst defaultComponent = \"tr\";\n\nconst getStripedColor = (color?: string, opacity: number = 0.6) => {\n return checkValidHexColorValue(color) ? hexToRgbA(color, opacity) : color;\n};\n\n/**\n * `HvTableRow` acts as a `tr` element and inherits styles from its context\n */\nexport const HvTableRow = forwardRef<HTMLElement, HvTableRowProps>(\n (props, externalRef) => {\n const {\n classes: classesProp,\n className,\n component,\n hover = false,\n selected = false,\n expanded = false,\n striped = false,\n ...others\n } = useDefaultProps(\"HvTableRow\", props);\n const { classes, cx, css } = useClasses(classesProp);\n const { colors, rootId } = useTheme();\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const [even, setEven] = useState<string | undefined>();\n const [odd, setOdd] = useState<string | undefined>();\n\n const type = tableSectionContext?.type || \"body\";\n\n const isList = tableContext.variant === \"listrow\";\n\n const Component =\n component || tableContext?.components?.Tr || defaultComponent;\n\n const [stripedColorEven, setStripedColorEven] = useState(\n getStripedColor(even)\n );\n const [stripedColorOdd, setStripedColorOdd] = useState(\n getStripedColor(odd)\n );\n\n useEffect(() => {\n setEven(getVarValue(theme.table.rowStripedBackgroundColorEven, rootId));\n setOdd(getVarValue(theme.table.rowStripedBackgroundColorOdd, rootId));\n\n setStripedColorEven(getStripedColor(even));\n setStripedColorOdd(getStripedColor(odd));\n }, [colors, even, odd, rootId]);\n\n return (\n <Component\n ref={externalRef}\n className={cx(\n tableSectionContext.filterClassName,\n classes.root,\n classes[type],\n striped &&\n css({\n \"&:nth-of-type(even)\": {\n backgroundColor: stripedColorEven,\n },\n \"&:nth-of-type(odd)\": {\n backgroundColor: stripedColorOdd,\n },\n }),\n {\n [classes.hover]: hover,\n [classes.selected]: selected,\n [classes.expanded]: expanded,\n [classes.striped]: striped,\n [classes.variantList]: isList && type === \"body\",\n [classes.variantListHead]: isList && type === \"head\",\n },\n className\n )}\n role={Component === defaultComponent ? null : \"row\"}\n {...others}\n />\n );\n }\n);\n"],"names":["defaultComponent","getStripedColor","color","opacity","checkValidHexColorValue","hexToRgbA","HvTableRow","forwardRef","props","externalRef","classes","classesProp","className","component","hover","selected","expanded","striped","others","useDefaultProps","cx","css","useClasses","colors","rootId","useTheme","tableContext","useContext","TableContext","tableSectionContext","TableSectionContext","even","setEven","useState","odd","setOdd","type","isList","variant","Component","components","Tr","stripedColorEven","setStripedColorEven","stripedColorOdd","setStripedColorOdd","useEffect","getVarValue","theme","table","rowStripedBackgroundColorEven","rowStripedBackgroundColorOdd","jsx","filterClassName","root","backgroundColor","variantList","variantListHead"],"mappings":";;;;;;;;;;;;;AAuCA,MAAMA,mBAAmB;AAEzB,MAAMC,kBAAkBA,CAACC,OAAgBC,UAAkB,QAAQ;AACjE,SAAOC,wBAAAA,wBAAwBF,KAAK,IAAIG,UAAAA,UAAUH,OAAOC,OAAO,IAAID;AACtE;AAKO,MAAMI,aAAaC,MAAAA,WACxB,CAACC,OAAOC,gBAAgB;AAChB,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,UAAU;AAAA,IACV,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,gBAAA,cAAcX,KAAK;AACjC,QAAA;AAAA,IAAEE;AAAAA,IAASU;AAAAA,IAAIC;AAAAA,EAAAA,IAAQC,gBAAAA,WAAWX,WAAW;AAC7C,QAAA;AAAA,IAAEY;AAAAA,IAAQC;AAAAA,MAAWC,SAAS,SAAA;AAC9BC,QAAAA,eAAeC,iBAAWC,aAAAA,OAAY;AACtCC,QAAAA,sBAAsBF,iBAAWG,oBAAAA,OAAmB;AAE1D,QAAM,CAACC,MAAMC,OAAO,IA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AEhDxB,SACF,GACA,MAAM2B,cAAcvC,mBAAmB,OAAO,OAC1CkB,GAAAA,OACJ,CAAA;AAEN,CACF;;;"}
1
+ {"version":3,"file":"TableRow.cjs","sources":["../../../../../src/components/Table/TableRow/TableRow.tsx"],"sourcesContent":["import { forwardRef, useContext } from \"react\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { hexToRgbA } from \"@core/utils/hexToRgbA\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useDefaultProps } from \"@core/hooks\";\n\nimport TableContext from \"../TableContext\";\nimport TableSectionContext from \"../TableSectionContext\";\nimport { staticClasses, useClasses } from \"./TableRow.styles\";\n\nexport { staticClasses as tableRowClasses };\n\nexport type HvTableRowClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableRowProps\n extends HvBaseProps<HTMLTableRowElement, \"children\"> {\n /** Content to be rendered */\n children: React.ReactNode;\n /** The component used for the root node. Either a string to use a HTML element or a component. Defaults to tbody. */\n component?: React.ElementType;\n /** Whether the table row will shade on hover. */\n hover?: boolean;\n /** Whether the table row will have the selected shading. */\n selected?: boolean;\n /** Whether the table row is expanded. */\n expanded?: boolean;\n /** Whether the table row background is striped. */\n striped?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableRowClasses;\n}\n\nconst defaultComponent = \"tr\";\n\n/**\n * `HvTableRow` acts as a `tr` element and inherits styles from its context\n */\nexport const HvTableRow = forwardRef<HTMLElement, HvTableRowProps>(\n (props, externalRef) => {\n const {\n classes: classesProp,\n className,\n component,\n hover = false,\n selected = false,\n expanded = false,\n striped = false,\n ...others\n } = useDefaultProps(\"HvTableRow\", props);\n const { classes, cx, css } = useClasses(classesProp);\n const { colors } = useTheme();\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const type = tableSectionContext?.type || \"body\";\n\n const isList = tableContext.variant === \"listrow\";\n\n const Component =\n component || tableContext?.components?.Tr || defaultComponent;\n\n return (\n <Component\n ref={externalRef}\n className={cx(\n tableSectionContext.filterClassName,\n classes.root,\n classes[type],\n striped &&\n css({\n \"&:nth-of-type(even)\": {\n backgroundColor: hexToRgbA(colors?.atmo1, 0.6),\n },\n \"&:nth-of-type(odd)\": {\n backgroundColor: \"transparent\",\n },\n }),\n {\n [classes.hover]: hover,\n [classes.selected]: selected,\n [classes.expanded]: expanded,\n [classes.striped]: striped,\n [classes.variantList]: isList && type === \"body\",\n [classes.variantListHead]: isList && type === \"head\",\n },\n className\n )}\n role={Component === defaultComponent ? null : \"row\"}\n {...others}\n />\n );\n }\n);\n"],"names":["defaultComponent","HvTableRow","forwardRef","props","externalRef","classes","classesProp","className","component","hover","selected","expanded","striped","others","useDefaultProps","cx","css","useClasses","colors","useTheme","tableContext","useContext","TableContext","tableSectionContext","TableSectionContext","type","isList","variant","Component","components","Tr","jsx","filterClassName","root","backgroundColor","hexToRgbA","atmo1","variantList","variantListHead"],"mappings":";;;;;;;;;;AAkCA,MAAMA,mBAAmB;AAKlB,MAAMC,aAAaC,MAAAA,WACxB,CAACC,OAAOC,gBAAgB;AAChB,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,UAAU;AAAA,IACV,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,gBAAA,cAAcX,KAAK;AACjC,QAAA;AAAA,IAAEE;AAAAA,IAASU;AAAAA,IAAIC;AAAAA,EAAAA,IAAQC,gBAAAA,WAAWX,WAAW;AAC7C,QAAA;AAAA,IAAEY;AAAAA,MAAWC,SAAS,SAAA;AACtBC,QAAAA,eAAeC,iBAAWC,aAAAA,OAAY;AACtCC,QAAAA,sBAAsBF,iBAAWG,oBAAAA,OAAmB;AAEpDC,QAAAA,OAAOF,qBAAqBE,QAAQ;AAEpCC,QAAAA,SAASN,aAAaO,YAAY;AAExC,QAAMC,YACJpB,aAAaY,cAAcS,YAAYC,MAAM9B;AAE/C,SACG+B,2BAAAA,IAAA,WAAA,EACC,KAAK3B,aACL,WAAWW,GACTQ,oBAAoBS,iBACpB3B,QAAQ4B,MACR5B,QAAQoB,IAAI,GACZb,WACEI,IAAI;AAAA,IACF,uBAAuB;AAAA,MACrBkB,iBAAiBC,UAAAA,UAAUjB,QAAQkB,OAAO,GAAG;AAAA,IAC/C;AAAA,IACA,sBAAsB;AAAA,MACpBF,iBAAiB;AAAA,IACnB;AAAA,EAAA,CACD,GACH;AAAA,IACE,CAAC7B,QAAQI,KAAK,GAAGA;AAAAA,IACjB,CAACJ,QAAQK,QAAQ,GAAGA;AAAAA,IACpB,CAACL,QAAQM,QAAQ,GAAGA;AAAAA,IACpB,CAACN,QAAQO,OAAO,GAAGA;AAAAA,IACnB,CAACP,QAAQgC,WAAW,GAAGX,UAAUD,SAAS;AAAA,IAC1C,CAACpB,QAAQiC,eAAe,GAAGZ,UAAUD,SAAS;AAAA,EAAA,GAEhDlB,SACF,GACA,MAAMqB,cAAc5B,mBAAmB,OAAO,OAC1Ca,GAAAA,OACJ,CAAA;AAEN,CACF;;;"}
@@ -5,6 +5,7 @@ const React = require("react");
5
5
  const material = require("@mui/material");
6
6
  const useTheme = require("../../hooks/useTheme.cjs");
7
7
  const useDefaultProps = require("../../hooks/useDefaultProps.cjs");
8
+ const document = require("../../utils/document.cjs");
8
9
  const Tooltip_styles = require("./Tooltip.styles.cjs");
9
10
  const HvTooltip = React.forwardRef((props, ref) => {
10
11
  const {
@@ -34,7 +35,7 @@ const HvTooltip = React.forwardRef((props, ref) => {
34
35
  tooltip: useSingle ? classes.tooltip : classes.tooltipMulti,
35
36
  popper: classes.popper
36
37
  }, title, PopperProps: {
37
- container: typeof window !== "undefined" ? document.getElementById(containerId || rootId || "") || document.body : void 0
38
+ container: document.getElementById(containerId || rootId)
38
39
  }, ...others, children });
39
40
  });
40
41
  exports.tooltipClasses = Tooltip_styles.staticClasses;
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.cjs","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","jsx","Tooltip","undefined","tooltip","tooltipMulti","popper","container","window","document","getElementById","body"],"mappings":";;;;;;;;AA4DO,MAAMA,YAAYC,MAAAA,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,SAAAA;AAAAA,IACtBC,kBAAkB;AAAA,MAAEC,SAAS;AAAA,MAAKP;AAAAA,IAAU;AAAA,IAC5CQ;AAAAA,IACA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,gBAAA,aAAajB,KAAK;AAEhC,QAAA;AAAA,IAAEkB;AAAAA,MAAWC,SAAS,SAAA;AACtB,QAAA;AAAA,IAAEhB;AAAAA,EAAAA,IAAYiB,eAAAA,WAAWhB,WAAW;AAGxC,SAAAiB,2BAAA,IAACC,SACC,SAAA,EAAA,KACA,MAAMjB,QAAQkB,QACd,YACA,WACA,qBACA,iBACA,WACA,SAAS;AAAA,IACPC,SAAShB,YAAYL,QAAQqB,UAAUrB,QAAQsB;AAAAA,IAC/CC,QAAQvB,QAAQuB;AAAAA,EAAAA,GAElB,OACA,aAAa;AAAA,IACXC,WACE,OAAOC,WAAW,cACdC,SAASC,eAAef,eAAeG,UAAU,EAAE,KACnDW,SAASE,OACTR;AAAAA,EAAAA,GAEJP,GAAAA,QAEHP,SACH,CAAA;AAEJ,CAAC;;;"}
1
+ {"version":3,"file":"Tooltip.cjs","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","jsx","Tooltip","undefined","tooltip","tooltipMulti","popper","container","getElementById"],"mappings":";;;;;;;;;AA6DO,MAAMA,YAAYC,MAAAA,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,SAAAA;AAAAA,IACtBC,kBAAkB;AAAA,MAAEC,SAAS;AAAA,MAAKP;AAAAA,IAAU;AAAA,IAC5CQ;AAAAA,IACA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,gBAAA,aAAajB,KAAK;AAEhC,QAAA;AAAA,IAAEkB;AAAAA,MAAWC,SAAS,SAAA;AACtB,QAAA;AAAA,IAAEhB;AAAAA,EAAAA,IAAYiB,eAAAA,WAAWhB,WAAW;AAGxC,SAAAiB,2BAAA,IAACC,SACC,SAAA,EAAA,KACA,MAAMjB,QAAQkB,QACd,YACA,WACA,qBACA,iBACA,WACA,SAAS;AAAA,IACPC,SAAShB,YAAYL,QAAQqB,UAAUrB,QAAQsB;AAAAA,IAC/CC,QAAQvB,QAAQuB;AAAAA,EAAAA,GAElB,OACA,aAAa;AAAA,IACXC,WAAWC,SAAAA,eAAeb,eAAeG,MAAM;AAAA,EAAA,GAE7CF,GAAAA,QAEHP,SACH,CAAA;AAEJ,CAAC;;;"}
@@ -50,9 +50,6 @@ function binaryFindElement(array, element) {
50
50
  return start;
51
51
  }
52
52
  const DescendantContext = React__namespace.createContext({});
53
- if (process.env.NODE_ENV !== "production") {
54
- DescendantContext.displayName = "DescendantContext";
55
- }
56
53
  function usePrevious(value) {
57
54
  const ref = React__namespace.useRef(null);
58
55
  React__namespace.useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"DescendantProvider.cjs","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","jsx"],"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,SAAS;AAAA,IAAA,OACV;AACLF,cAAQE,SAAS;AAAA,IACnB;AAAA,EACF;AAEOF,SAAAA;AACT;AAcA,MAAMQ,oBAAoBC,iBAAMC,cAAsC,CAAA,CAAE;AAExE,IAAIC,QAAQC,IAAIC,aAAa,cAAc;AACzCL,oBAAkBM,cAAc;AAClC;AAEA,SAASC,YAAeC,OAAU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AAE;AAEEC,QAAAA,qBAAqBjB,iBAAMqC,YAC/B,CAAC;AAAA,IAAE/C;AAAAA,IAAS,GAAGgD;AAAAA,EAAAA,MAAgC;AAC7CF,QAAKG,CAAa,aAAA;AACZA,UAAAA,SAASnD,WAAW,GAAG;AAEzB,eAAO,CACL;AAAA,UACE,GAAGkD;AAAAA,UACHhD;AAAAA,UACAgC,OAAO;AAAA,QAAA,CACR;AAAA,MAEL;AAEMA,YAAAA,QAAQjC,kBAAkBkD,UAAUjD,OAAO;AAC7CkD,UAAAA;AAEJ,UAAID,SAASjB,KAAK,KAAKiB,SAASjB,KAAK,EAAEhC,YAAYA,SAAS;AAE/CiD,mBAAAA;AAAAA,MAAAA,OACN;AAcL,cAAME,UAAU;AAAA,UACd,GAAGH;AAAAA,UACHhD;AAAAA,UACAgC;AAAAA,QAAAA;AAIFkB,mBAAWD,SAASG;AACXC,iBAAAA,OAAOrB,OAAO,GAAGmB,OAAO;AAAA,MACnC;AACSG,eAAAA,QAAQ,CAACrB,MAAMK,aAAa;AACnCL,aAAKD,QAAQM;AAAAA,MAAAA,CACd;AACMY,aAAAA;AAAAA,IAAAA,CACR;AAAA,EACH,GACA,CACF,CAAA;AAEA,QAAMtB,uBAAuBlB,iBAAMqC,YAAY,CAAC/C,YAA2B;AACzE8C,QAAKG,cAAaA,SAASM,OAAQtB,UAASjC,YAAYiC,KAAKjC,OAAO,CAAC;AAAA,EACvE,GAAG,CAAE,CAAA;AAECiB,QAAAA,QAAQP,iBAAM8C,QAClB,OAAO;AAAA,IACL3B,aAAagB;AAAAA,IACblB;AAAAA,IACAC;AAAAA,IACAE,UAAUc;AAAAA,EAAAA,IAEZ,CAACC,OAAOlB,oBAAoBC,sBAAsBgB,EAAE,CACtD;AAEA,SACGa,2BAAAA,IAAA,kBAAkB,UAAlB,EAA2B,OACzBd,SACH,CAAA;AAEJ;;;"}
1
+ {"version":3,"file":"DescendantProvider.cjs","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","jsx"],"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,MAAM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AA2B;AACzE0C,QAAKG,cAAaA,SAASM,OAAQtB,UAAS7B,YAAY6B,KAAK7B,OAAO,CAAC;AAAA,EACvE,GAAG,CAAE,CAAA;AAECa,QAAAA,QAAQH,iBAAM0C,QAClB,OAAO;AAAA,IACL3B,aAAagB;AAAAA,IACblB;AAAAA,IACAC;AAAAA,IACAE,UAAUc;AAAAA,EAAAA,IAEZ,CAACC,OAAOlB,oBAAoBC,sBAAsBgB,EAAE,CACtD;AAEA,SACGa,2BAAAA,IAAA,kBAAkB,UAAlB,EAA2B,OACzBd,SACH,CAAA;AAEJ;;;"}
@@ -16,9 +16,6 @@ const DEFAULT_TREE_VIEW_CONTEXT_VALUE = {
16
16
  }
17
17
  };
18
18
  const TreeViewContext = React.createContext(DEFAULT_TREE_VIEW_CONTEXT_VALUE);
19
- if (process.env.NODE_ENV !== "production") {
20
- TreeViewContext.displayName = "TreeViewContext";
21
- }
22
19
  const TreeViewProvider = (props) => {
23
20
  const {
24
21
  value,
@@ -1 +1 @@
1
- {"version":3,"file":"TreeViewProvider.cjs","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","jsx","DescendantProvider","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,oBAC7BZ,+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,SAAAG,+BAAC,gBAAgB,UAAhB,EAAyB,OACxB,UAACA,2BAAA,IAAAC,uCAAA,EAAoBF,SAAS,CAAA,EAChC,CAAA;AAEJ;AAEaG,MAAAA,qBAAqB,MAE3BC,MAAAA,WAAWb,eAAe;;;;;"}
1
+ {"version":3,"file":"TreeViewProvider.cjs","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","jsx","DescendantProvider","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,oBAC7BZ,+BACF;AAcaa,MAAAA,mBAAmB,CAG9BC,UACG;AACG,QAAA;AAAA,IAAEC;AAAAA,IAAOC;AAAAA,EAAaF,IAAAA;AAG1B,SAAAG,+BAAC,gBAAgB,UAAhB,EAAyB,OACxB,UAACA,2BAAA,IAAAC,uCAAA,EAAoBF,SAAS,CAAA,EAChC,CAAA;AAEJ;AAEaG,MAAAA,qBAAqB,MAE3BC,MAAAA,WAAWT,eAAe;;;;;"}
@@ -2,21 +2,11 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const typographyVariants = ["display", "title1", "title2", "title3", "title4", "body", "label", "caption1", "caption2"];
4
4
  const mappableVariants = /* @__PURE__ */ new Map([["3xlTitle", "display"], ["xlTitle", "title1"], ["mTitle", "title2"], ["xsTitle", "title3"], ["highlightText", "label"], ["normalText", "body"], ["vizText", "caption1"]]);
5
- const isLegacyVariant = (variant) => {
6
- return ["5xlTitle", "4xlTitle", "3xlTitle", "xxlTitle", "xlTitle", "lTitle", "mTitle", "sTitle", "xsTitle", "xxsTitle", "sectionTitle", "highlightText", "normalText", "placeholderText", "link", "disabledText", "selectedNavText", "vizText", "vizTextDisabled", "xsInlineLink"].includes(variant);
7
- };
8
5
  const mapVariant = (variant, theme) => {
6
+ if (theme === "ds3")
7
+ return variant;
9
8
  const mappedVariant = mappableVariants.get(variant);
10
- if (theme !== "ds3") {
11
- if (mappedVariant) {
12
- console.warn(`The typography variant ${variant} is deprecated. You should use ${mappedVariant} instead.`);
13
- return mappedVariant;
14
- }
15
- if (isLegacyVariant(variant)) {
16
- console.warn(`The typography variant ${variant} is deprecated.`);
17
- }
18
- }
19
- return variant;
9
+ return mappedVariant || variant;
20
10
  };
21
11
  exports.mapVariant = mapVariant;
22
12
  exports.typographyVariants = typographyVariants;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","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.cjs","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;;;"}
@@ -23,9 +23,6 @@ const DescendantContext = React.createContext({
23
23
  level: 0,
24
24
  descendants: []
25
25
  });
26
- if (process.env.NODE_ENV !== "production") {
27
- DescendantContext.displayName = "DescendantContext";
28
- }
29
26
  function usePrevious(value) {
30
27
  const ref = React.useRef(null);
31
28
  React.useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"descendants.cjs","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","jsx"],"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,Y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AAAAA,IACAC;AAAAA,IACAC,UAAUe;AAAAA,IACVlC;AAAAA,EAAAA,IAEF,CAACmC,OAAOlB,oBAAoBC,sBAAsBgB,IAAIlC,KAAK,CAC7D;AAEA,SACG+C,2BAAAA,IAAA,kBAAkB,UAAlB,EAA2B,OACzBd,SACH,CAAA;AAEJ;;;"}
1
+ {"version":3,"file":"descendants.cjs","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","jsx"],"mappings":";;;;;AA0BA,SAASA,kBAAkBC,OAAOC,SAAS;AACzC,MAAIC,QAAQ;AACRC,MAAAA,MAAMH,MAAMI,SAAS;AAEzB,SAAOF,SAASC,KAAK;AACnB,UAA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AAe/B,YAAY+B,KAAK/B,OAAO,CAC1D;AAAA,EACF,GAAG,CAAE,CAAA;AAECe,QAAAA,QAAQuC,MAAAA,QACZ,OAAO;AAAA,IACLzC,aAAa8B;AAAAA,IACblB;AAAAA,IACAC;AAAAA,IACAC,UAAUe;AAAAA,IACV9B;AAAAA,EAAAA,IAEF,CAAC+B,OAAOlB,oBAAoBC,sBAAsBgB,IAAI9B,KAAK,CAC7D;AAEA,SACG2C,2BAAAA,IAAA,kBAAkB,UAAlB,EAA2B,OACzBd,SACH,CAAA;AAEJ;;;"}
@@ -7,9 +7,6 @@ const useControlled = (controlledProp, initialState) => {
7
7
  } = React.useRef(controlledProp !== void 0);
8
8
  const [valueState, setValue] = React.useState(initialState);
9
9
  const value = isControlled ? controlledProp : valueState;
10
- if (process.env.NODE_ENV !== "production" && isControlled !== (controlledProp !== void 0)) {
11
- 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"));
12
- }
13
10
  const setValueIfUncontrolled = React.useCallback((newValue) => {
14
11
  if (!isControlled) {
15
12
  setValue(newValue);
@@ -1 +1 @@
1
- {"version":3,"file":"useControlled.cjs","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,aAAOJ,mBAAmBK,MAAS;AACrE,QAAM,CAACC,YAAYC,QAAQ,IAAIC,eAASP,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,kBAC5BC,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.cjs","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,aAAOJ,mBAAmBK,MAAS;AACrE,QAAM,CAACC,YAAYC,QAAQ,IAAIC,eAASP,YAAY;AAC9CQ,QAAAA,QAAQN,eAAeH,iBAAiBM;AAgBxCI,QAAAA,yBAAyBC,kBAC5BC,CAAa,aAAA;AACZ,QAAI,CAACT,cAAc;AACjBI,eAASK,QAAQ;AAAA,IACnB;AAAA,EAAA,GAEF,CAACT,YAAY,CACf;AAEO,SAAA,CAACM,OAAOC,sBAAsB;AACvC;;"}