@hitachivantara/uikit-react-core 5.47.1 → 5.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/cjs/BaseDropdown/BaseDropdown.cjs.map +1 -1
  2. package/dist/cjs/Button/Button.cjs +53 -55
  3. package/dist/cjs/Button/Button.cjs.map +1 -1
  4. package/dist/cjs/DropDownMenu/DropDownMenu.cjs +2 -10
  5. package/dist/cjs/DropDownMenu/DropDownMenu.cjs.map +1 -1
  6. package/dist/cjs/Dropdown/Dropdown.cjs.map +1 -1
  7. package/dist/cjs/Dropdown/Dropdown.styles.cjs +1 -4
  8. package/dist/cjs/Dropdown/Dropdown.styles.cjs.map +1 -1
  9. package/dist/cjs/ListContainer/ListContainer.cjs +20 -10
  10. package/dist/cjs/ListContainer/ListContainer.cjs.map +1 -1
  11. package/dist/cjs/ListContainer/ListContext/ListContext.cjs.map +1 -1
  12. package/dist/cjs/ListContainer/ListItem/ListItem.cjs +5 -2
  13. package/dist/cjs/ListContainer/ListItem/ListItem.cjs.map +1 -1
  14. package/dist/cjs/TimeAgo/TimeAgo.cjs +25 -30
  15. package/dist/cjs/TimeAgo/TimeAgo.cjs.map +1 -1
  16. package/dist/cjs/TreeView/TreeView.cjs +2 -2
  17. package/dist/cjs/TreeView/TreeView.cjs.map +1 -1
  18. package/dist/cjs/Typography/Typography.cjs +35 -37
  19. package/dist/cjs/Typography/Typography.cjs.map +1 -1
  20. package/dist/cjs/index.cjs +2 -0
  21. package/dist/cjs/index.cjs.map +1 -1
  22. package/dist/cjs/types/generic.cjs +8 -0
  23. package/dist/cjs/types/generic.cjs.map +1 -0
  24. package/dist/esm/BaseDropdown/BaseDropdown.js.map +1 -1
  25. package/dist/esm/Button/Button.js +53 -55
  26. package/dist/esm/Button/Button.js.map +1 -1
  27. package/dist/esm/DropDownMenu/DropDownMenu.js +2 -10
  28. package/dist/esm/DropDownMenu/DropDownMenu.js.map +1 -1
  29. package/dist/esm/Dropdown/Dropdown.js.map +1 -1
  30. package/dist/esm/Dropdown/Dropdown.styles.js +1 -4
  31. package/dist/esm/Dropdown/Dropdown.styles.js.map +1 -1
  32. package/dist/esm/ListContainer/ListContainer.js +21 -11
  33. package/dist/esm/ListContainer/ListContainer.js.map +1 -1
  34. package/dist/esm/ListContainer/ListContext/ListContext.js.map +1 -1
  35. package/dist/esm/ListContainer/ListItem/ListItem.js +5 -2
  36. package/dist/esm/ListContainer/ListItem/ListItem.js.map +1 -1
  37. package/dist/esm/TimeAgo/TimeAgo.js +25 -28
  38. package/dist/esm/TimeAgo/TimeAgo.js.map +1 -1
  39. package/dist/esm/TreeView/TreeView.js +2 -2
  40. package/dist/esm/TreeView/TreeView.js.map +1 -1
  41. package/dist/esm/Typography/Typography.js +35 -37
  42. package/dist/esm/Typography/Typography.js.map +1 -1
  43. package/dist/esm/index.js +2 -0
  44. package/dist/esm/index.js.map +1 -1
  45. package/dist/esm/types/generic.js +8 -0
  46. package/dist/esm/types/generic.js.map +1 -0
  47. package/dist/types/index.d.ts +170 -70
  48. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"ListContainer.cjs","sources":["../../../src/ListContainer/ListContainer.tsx"],"sourcesContent":["import React, { useRef, useContext, useMemo, forwardRef } from \"react\";\n\nimport { HvBaseProps } from \"../types/generic\";\nimport { useForkRef } from \"../hooks/useForkRef\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { ExtractNames } from \"../utils/classes\";\n\nimport { staticClasses, useClasses } from \"./ListContainer.styles\";\nimport HvListContext from \"./ListContext\";\n\nexport { staticClasses as listContainerClasses };\n\nexport type HvListContainerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvListContainerProps extends HvBaseProps<HTMLUListElement> {\n /**\n * If the list items should be focusable and react to mouse over events.\n * Defaults to true if the list is selectable, false otherwise.\n */\n interactive?: boolean;\n /** If `true` compact the vertical spacing between list items. */\n condensed?: boolean;\n /** If `true`, the list items' left and right padding is removed. */\n disableGutters?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvListContainerClasses;\n}\n\n/**\n * A <b>list</b> is any enumeration of a set of items.\n * The simple list is for continuous <b>vertical indexes of text or icons+text</b>. The content of these lists must be simple: ideally simples fields.\n * This pattern is ideal for <b>selections</b>. It should be used inside a HvPanel.\n */\nexport const HvListContainer = forwardRef<\n HTMLUListElement,\n HvListContainerProps\n>((props, ref) => {\n const {\n id,\n classes: classesProp,\n className,\n interactive = false,\n condensed,\n disableGutters,\n children,\n ...others\n } = useDefaultProps(\"HvListContainer\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const containerRef = useRef(null);\n\n const { topContainerRef, nesting = -1 } = useContext(HvListContext);\n\n const listContext = useMemo(\n () => ({\n topContainerRef: topContainerRef || containerRef,\n condensed,\n disableGutters,\n interactive,\n nesting: nesting + 1,\n }),\n [condensed, disableGutters, interactive, nesting, topContainerRef]\n );\n\n const renderChildren = () => {\n if (!interactive) {\n return children;\n }\n\n const anySelected = React.Children.toArray(children)\n .map((child: any) => child.props.selected && !child.props.disabled)\n .reduce((result, selected) => result || selected, false);\n\n return React.Children.map(children, (child: any, i) => {\n const tabIndex =\n child.props.tabIndex ||\n (!anySelected && i === 0) ||\n (child.props.selected && !child.props.disabled)\n ? 0\n : -1;\n\n return React.cloneElement(child, {\n tabIndex,\n interactive,\n });\n });\n };\n\n const handleRef = useForkRef(ref, containerRef);\n\n return (\n <HvListContext.Provider value={listContext}>\n <ul\n ref={handleRef}\n id={id}\n className={cx(classes.root, className)}\n {...others}\n >\n {renderChildren()}\n </ul>\n </HvListContext.Provider>\n );\n});\n"],"names":["forwardRef","useDefaultProps","useClasses","useRef","useContext","HvListContext","useMemo","React","useForkRef","jsx"],"mappings":";;;;;;;;;;AAiCO,MAAM,kBAAkBA,MAAA,WAG7B,CAAC,OAAO,QAAQ;AACV,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA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MAEH,UAAe,eAAA;AAAA,IAAA;AAAA,EAEpB,EAAA,CAAA;AAEJ,CAAC;;;"}
1
+ {"version":3,"file":"ListContainer.cjs","sources":["../../../src/ListContainer/ListContainer.tsx"],"sourcesContent":["import React, {\n useRef,\n useContext,\n useMemo,\n forwardRef,\n isValidElement,\n} from \"react\";\n\nimport { HvBaseProps } from \"../types/generic\";\nimport { useForkRef } from \"../hooks/useForkRef\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { ExtractNames } from \"../utils/classes\";\n\nimport { staticClasses, useClasses } from \"./ListContainer.styles\";\nimport HvListContext from \"./ListContext\";\n\nexport { staticClasses as listContainerClasses };\n\nexport type HvListContainerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvListContainerProps extends HvBaseProps<HTMLUListElement> {\n /**\n * If the list items should be focusable and react to mouse over events.\n * Defaults to true if the list is selectable, false otherwise.\n */\n interactive?: boolean;\n /** If `true` compact the vertical spacing between list items. */\n condensed?: boolean;\n /** If `true`, the list items are _visually_ selectable. To enable selection, use `HvSelectionList` */\n selectable?: boolean;\n /** If `true`, the list items' left and right padding is removed. */\n disableGutters?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvListContainerClasses;\n}\n\n/**\n * A <b>list</b> is any enumeration of a set of items.\n * The simple list is for continuous <b>vertical indexes of text or icons+text</b>. The content of these lists must be simple: ideally simples fields.\n * This pattern is ideal for <b>selections</b>. It should be used inside a HvPanel.\n */\nexport const HvListContainer = forwardRef<\n HTMLUListElement,\n HvListContainerProps\n>((props, ref) => {\n const {\n id,\n classes: classesProp,\n className,\n interactive = false,\n selectable,\n condensed,\n disableGutters,\n children: childrenProp,\n ...others\n } = useDefaultProps(\"HvListContainer\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const containerRef = useRef(null);\n\n const { topContainerRef, nesting = -1 } = useContext(HvListContext);\n\n const listContext = useMemo(\n () => ({\n topContainerRef: topContainerRef || containerRef,\n condensed,\n selectable,\n disableGutters,\n interactive,\n nesting: nesting + 1,\n }),\n [\n condensed,\n selectable,\n disableGutters,\n interactive,\n nesting,\n topContainerRef,\n ]\n );\n\n const children = useMemo(() => {\n if (!interactive) return childrenProp;\n\n const anySelected = React.Children.toArray(childrenProp).some(\n (child) =>\n isValidElement(child) && child.props.selected && !child.props.disabled\n );\n\n return React.Children.map(childrenProp, (child: any, i) => {\n const tabIndex =\n child.props.tabIndex ||\n (!anySelected && i === 0) ||\n (child.props.selected && !child.props.disabled)\n ? 0\n : -1;\n\n return React.cloneElement(child, {\n tabIndex,\n interactive,\n });\n });\n }, [childrenProp, interactive]);\n\n const handleRef = useForkRef(ref, containerRef);\n\n return (\n <HvListContext.Provider value={listContext}>\n <ul\n ref={handleRef}\n id={id}\n className={cx(classes.root, className)}\n {...others}\n >\n {children}\n </ul>\n </HvListContext.Provider>\n );\n});\n"],"names":["forwardRef","useDefaultProps","useClasses","useRef","useContext","HvListContext","useMemo","React","isValidElement","useForkRef","jsx"],"mappings":";;;;;;;;;;AAyCO,MAAM,kBAAkBA,MAAA,WAG7B,CAAC,OAAO,QAAQ;AACV,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,GAAG;AAAA,EAAA,IACDC,gBAAgB,gBAAA,mBAAmB,KAAK;AAE5C,QAAM,EAAE,SAAS,GAAG,IAAIC,gCAAW,WAAW;AAExC,QAAA,eAAeC,aAAO,IAAI;AAEhC,QAAM,EAAE,iBAAiB,UAAU,GAAG,IAAIC,MAAAA,WAAWC,YAAAA,OAAa;AAElE,QAAM,cAAcC,MAAA;AAAA,IAClB,OAAO;AAAA,MACL,iBAAiB,mBAAmB;AAAA,MACpC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,UAAU;AAAA,IAAA;AAAA,IAErB;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EAAA;AAGI,QAAA,WAAWA,MAAAA,QAAQ,MAAM;AAC7B,QAAI,CAAC;AAAoB,aAAA;AAEzB,UAAM,cAAcC,eAAAA,QAAM,SAAS,QAAQ,YAAY,EAAE;AAAA,MACvD,CAAC,UACCC,qBAAe,KAAK,KAAK,MAAM,MAAM,YAAY,CAAC,MAAM,MAAM;AAAA,IAAA;AAGlE,WAAOD,eAAAA,QAAM,SAAS,IAAI,cAAc,CAAC,OAAY,MAAM;AACzD,YAAM,WACJ,MAAM,MAAM,YACX,CAAC,eAAe,MAAM,KACtB,MAAM,MAAM,YAAY,CAAC,MAAM,MAAM,WAClC,IACA;AAEC,aAAAA,eAAA,QAAM,aAAa,OAAO;AAAA,QAC/B;AAAA,QACA;AAAA,MAAA,CACD;AAAA,IAAA,CACF;AAAA,EAAA,GACA,CAAC,cAAc,WAAW,CAAC;AAExB,QAAA,YAAYE,WAAAA,WAAW,KAAK,YAAY;AAE9C,SACGC,2BAAAA,IAAAL,YAAAA,QAAc,UAAd,EAAuB,OAAO,aAC7B,UAAAK,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA,WAAW,GAAG,QAAQ,MAAM,SAAS;AAAA,MACpC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAEL,EAAA,CAAA;AAEJ,CAAC;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ListContext.cjs","sources":["../../../../src/ListContainer/ListContext/ListContext.ts"],"sourcesContent":["import React from \"react\";\n\nconst ListContext = React.createContext<{\n interactive?: boolean;\n nesting?: number;\n condensed?: boolean;\n disableGutters?: boolean;\n topContainerRef?: React.MutableRefObject<HTMLUListElement | null>;\n}>({});\n\nListContext.displayName = \"ListContext\";\n\nexport default ListContext;\n"],"names":["React"],"mappings":";;;;;AAEA,MAAM,cAAcA,eAAA,QAAM,cAMvB,CAAA,CAAE;AAEL,YAAY,cAAc;AAE1B,MAAA,gBAAe;;"}
1
+ {"version":3,"file":"ListContext.cjs","sources":["../../../../src/ListContainer/ListContext/ListContext.ts"],"sourcesContent":["import React from \"react\";\n\nconst ListContext = React.createContext<{\n interactive?: boolean;\n nesting?: number;\n condensed?: boolean;\n selectable?: boolean;\n disableGutters?: boolean;\n topContainerRef?: React.MutableRefObject<HTMLUListElement | null>;\n}>({});\n\nListContext.displayName = \"ListContext\";\n\nexport default ListContext;\n"],"names":["React"],"mappings":";;;;;AAEA,MAAM,cAAcA,eAAA,QAAM,cAOvB,CAAA,CAAE;AAEL,YAAY,cAAc;AAE1B,MAAA,gBAAe;;"}
@@ -33,6 +33,7 @@ const HvListItem = React.forwardRef((props, ref) => {
33
33
  value,
34
34
  selected,
35
35
  disabled,
36
+ selectable: selectableProp,
36
37
  interactive: interactiveProp,
37
38
  condensed: condensedProp,
38
39
  disableGutters: disableGuttersProp,
@@ -48,11 +49,13 @@ const HvListItem = React.forwardRef((props, ref) => {
48
49
  topContainerRef,
49
50
  condensed: condensedContext,
50
51
  disableGutters: disableGuttersContext,
51
- interactive: interactiveContext
52
+ interactive: interactiveContext,
53
+ selectable: selectableContext
52
54
  } = React.useContext(ListContext.default);
53
55
  const condensed = condensedProp ?? condensedContext;
54
56
  const disableGutters = disableGuttersProp ?? disableGuttersContext;
55
57
  const interactive = interactiveProp ?? interactiveContext;
58
+ const selectable = selectableProp ?? selectableContext;
56
59
  const handleClick = React.useCallback(
57
60
  (evt) => {
58
61
  if (disabled)
@@ -112,7 +115,7 @@ const HvListItem = React.forwardRef((props, ref) => {
112
115
  {
113
116
  [classes.gutters]: !disableGutters,
114
117
  [classes.condensed]: condensed,
115
- [classes.interactive]: interactive,
118
+ [classes.interactive]: interactive || selectable,
116
119
  [classes.selected]: selected || props["aria-selected"],
117
120
  [classes.disabled]: disabled || props["aria-disabled"],
118
121
  [classes.withStartAdornment]: startAdornment != null,
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.cjs","sources":["../../../../src/ListContainer/ListItem/ListItem.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useContext, useMemo } from \"react\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport { useDefaultProps } from \"../../hooks/useDefaultProps\";\nimport { ExtractNames } from \"../../utils/classes\";\nimport { HvFocus } from \"../../Focus\";\n\nimport HvListContext from \"../ListContext\";\nimport { staticClasses, useClasses } from \"./ListItem.styles\";\n\nexport { staticClasses as listItemClasses };\n\nexport type HvListItemClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvListItemProps extends HvBaseProps<HTMLLIElement> {\n /** Indicates if the list item is selected. */\n selected?: boolean;\n /** If true, the list item will be disabled. */\n disabled?: boolean;\n /**\n * If the list item is focusable and reacts to mouse over events.\n * Defaults to true if the container list is interactive, false otherwise.\n */\n interactive?: boolean;\n /**\n * If `true` compacts the vertical spacing intended to separate the list items.\n * Defaults to the value set in container list.\n */\n condensed?: boolean;\n /**\n * If `true`, the left and right padding is removed.\n * Defaults to the value set in container list.\n */\n disableGutters?: boolean;\n /**\n * Element placed before the children.\n * Also removes the left padding (gutter).\n *\n * Some modifications are applied, assuming that it is either an icon (changing the color when the item is disabled)\n * or a selector (preventing the double focus ring, propagating the checked and disabled states and wiring the onChange event).\n * If unwanted, the element should be placed directly as a child.\n */\n startAdornment?: React.ReactNode;\n /**\n * Element placed after the children and aligned next to the margin.\n * Also removes the right padding (gutter).\n *\n * Some modifications are applied, assuming that it is an icon (changing the color when the item is disabled).\n * If unwanted, the element should be placed directly as a child.\n */\n endAdornment?: React.ReactNode;\n /** The value to be set on the 'li' element */\n value?: any;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvListItemClasses;\n}\n\nconst applyClassNameAndStateToElement = (\n element: any,\n selected: boolean | undefined,\n disabled: boolean | undefined,\n onClick: React.MouseEventHandler<HTMLLIElement>,\n className?: string\n) => {\n if (element == null) return null;\n\n return React.cloneElement(element, {\n className,\n checked: !!selected,\n disabled,\n onChange: onClick,\n });\n};\n\nconst applyClassNameToElement = (element, className?: string) => {\n if (element == null) return null;\n\n return React.cloneElement(element, {\n className,\n });\n};\n\n/**\n * ListItem description/documentation paragraph\n */\nexport const HvListItem = forwardRef<any, HvListItemProps>((props, ref) => {\n const {\n classes: classesProp,\n className,\n role,\n value,\n selected,\n disabled,\n interactive: interactiveProp,\n condensed: condensedProp,\n disableGutters: disableGuttersProp,\n startAdornment,\n endAdornment,\n onClick,\n children,\n tabIndex,\n ...others\n } = useDefaultProps(\"HvListItem\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const {\n topContainerRef,\n condensed: condensedContext,\n disableGutters: disableGuttersContext,\n interactive: interactiveContext,\n } = useContext(HvListContext);\n\n const condensed = condensedProp ?? condensedContext;\n const disableGutters = disableGuttersProp ?? disableGuttersContext;\n const interactive = interactiveProp ?? interactiveContext;\n\n const handleClick = useCallback<React.MouseEventHandler<HTMLLIElement>>(\n (evt) => {\n if (disabled) return;\n onClick?.(evt);\n },\n [disabled, onClick]\n );\n\n const clonedStartAdornment = useMemo(\n () =>\n applyClassNameAndStateToElement(\n startAdornment,\n selected,\n disabled,\n handleClick,\n cx(\n classes.startAdornment,\n { [classes.disabled]: disabled },\n React.isValidElement(startAdornment)\n ? startAdornment.props.className\n : undefined\n )\n ),\n [\n cx,\n classes?.startAdornment,\n classes?.disabled,\n disabled,\n handleClick,\n selected,\n startAdornment,\n ]\n );\n const clonedEndAdornment = useMemo(\n () =>\n applyClassNameToElement(\n endAdornment,\n cx(\n classes.endAdornment,\n { [classes.disabled]: disabled },\n React.isValidElement(endAdornment)\n ? endAdornment.props.className\n : undefined\n )\n ),\n [cx, classes?.endAdornment, classes?.disabled, disabled, endAdornment]\n );\n\n const roleOptionAriaProps =\n role === \"option\" || role === \"menuitem\"\n ? {\n \"aria-disabled\": disabled || undefined,\n \"aria-selected\": selected,\n }\n : {};\n\n const listItem = (\n // For later: this should only have an onClick event if interactive and has the appropriate role.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events\n <li\n ref={ref}\n role={role}\n value={value}\n className={cx(\n classes.root,\n {\n [classes.gutters]: !disableGutters,\n [classes.condensed]: condensed,\n [classes.interactive]: interactive,\n [classes.selected]: selected || props[\"aria-selected\"],\n [classes.disabled]: disabled || props[\"aria-disabled\"],\n [classes.withStartAdornment]: startAdornment != null,\n [classes.withEndAdornment]: endAdornment != null,\n },\n className\n )}\n tabIndex={interactive ? undefined : tabIndex}\n onClick={handleClick}\n {...roleOptionAriaProps}\n {...others}\n >\n {clonedStartAdornment}\n {children}\n {clonedEndAdornment}\n </li>\n );\n\n return interactive ? (\n <HvFocus\n rootRef={topContainerRef}\n selected={selected}\n disabledClass={disabled || undefined}\n strategy={role === \"option\" ? \"listbox\" : \"menu\"}\n classes={{ focus: classes.focus }}\n configuration={{\n tabIndex,\n }}\n >\n {listItem}\n </HvFocus>\n ) : (\n listItem\n );\n});\n"],"names":["React","forwardRef","useDefaultProps","useClasses","useContext","HvListContext","useCallback","useMemo","jsxs","jsx","HvFocus"],"mappings":";;;;;;;;;;AAyDA,MAAM,kCAAkC,CACtC,SACA,UACA,UACA,SACA,cACG;AACH,MAAI,WAAW;AAAa,WAAA;AAErB,SAAAA,eAAA,QAAM,aAAa,SAAS;AAAA,IACjC;AAAA,IACA,SAAS,CAAC,CAAC;AAAA,IACX;AAAA,IACA,UAAU;AAAA,EAAA,CACX;AACH;AAEA,MAAM,0BAA0B,CAAC,SAAS,cAAuB;AAC/D,MAAI,WAAW;AAAa,WAAA;AAErB,SAAAA,eAAA,QAAM,aAAa,SAAS;AAAA,IACjC;AAAA,EAAA,CACD;AACH;AAKO,MAAM,aAAaC,MAAA,WAAiC,CAAC,OAAO,QAAQ;AACnE,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,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iB;AAAA,MAEnB;AAEA,QAAA;AAAA;AAAA;AAAA,IAGJQ,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAW;AAAA,UACT,QAAQ;AAAA,UACR;AAAA,YACE,CAAC,QAAQ,OAAO,GAAG,CAAC;AAAA,YACpB,CAAC,QAAQ,SAAS,GAAG;AAAA,YACrB,CAAC,QAAQ,WAAW,GAAG;AAAA,YACvB,CAAC,QAAQ,QAAQ,GAAG,YAAY,MAAM,eAAe;AAAA,YACrD,CAAC,QAAQ,QAAQ,GAAG,YAAY,MAAM,eAAe;AAAA,YACrD,CAAC,QAAQ,kBAAkB,GAAG,kBAAkB;AAAA,YAChD,CAAC,QAAQ,gBAAgB,GAAG,gBAAgB;AAAA,UAC9C;AAAA,UACA;AAAA,QACF;AAAA,QACA,UAAU,cAAc,SAAY;AAAA,QACpC,SAAS;AAAA,QACR,GAAG;AAAA,QACH,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA;AAGF,SAAO,cACLC,2BAAA;AAAA,IAACC,MAAA;AAAA,IAAA;AAAA,MACC,SAAS;AAAA,MACT;AAAA,MACA,eAAe,YAAY;AAAA,MAC3B,UAAU,SAAS,WAAW,YAAY;AAAA,MAC1C,SAAS,EAAE,OAAO,QAAQ,MAAM;AAAA,MAChC,eAAe;AAAA,QACb;AAAA,MACF;AAAA,MAEC,UAAA;AAAA,IAAA;AAAA,EAGH,IAAA;AAEJ,CAAC;;;"}
1
+ {"version":3,"file":"ListItem.cjs","sources":["../../../../src/ListContainer/ListItem/ListItem.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useContext, useMemo } from \"react\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport { useDefaultProps } from \"../../hooks/useDefaultProps\";\nimport { ExtractNames } from \"../../utils/classes\";\nimport { HvFocus } from \"../../Focus\";\n\nimport HvListContext from \"../ListContext\";\nimport { staticClasses, useClasses } from \"./ListItem.styles\";\n\nexport { staticClasses as listItemClasses };\n\nexport type HvListItemClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvListItemProps extends HvBaseProps<HTMLLIElement> {\n /** Indicates if the list item is selected. */\n selected?: boolean;\n /** Indicated if the list item is _visually_ selectable */\n selectable?: boolean;\n /** If true, the list item will be disabled. */\n disabled?: boolean;\n /**\n * If the list item is focusable and reacts to mouse over events.\n * Defaults to true if the container list is interactive, false otherwise.\n */\n interactive?: boolean;\n /**\n * If `true` compacts the vertical spacing intended to separate the list items.\n * Defaults to the value set in container list.\n */\n condensed?: boolean;\n /**\n * If `true`, the left and right padding is removed.\n * Defaults to the value set in container list.\n */\n disableGutters?: boolean;\n /**\n * Element placed before the children.\n * Also removes the left padding (gutter).\n *\n * Some modifications are applied, assuming that it is either an icon (changing the color when the item is disabled)\n * or a selector (preventing the double focus ring, propagating the checked and disabled states and wiring the onChange event).\n * If unwanted, the element should be placed directly as a child.\n */\n startAdornment?: React.ReactNode;\n /**\n * Element placed after the children and aligned next to the margin.\n * Also removes the right padding (gutter).\n *\n * Some modifications are applied, assuming that it is an icon (changing the color when the item is disabled).\n * If unwanted, the element should be placed directly as a child.\n */\n endAdornment?: React.ReactNode;\n /** The value to be set on the 'li' element */\n value?: any;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvListItemClasses;\n}\n\nconst applyClassNameAndStateToElement = (\n element: any,\n selected: boolean | undefined,\n disabled: boolean | undefined,\n onClick: React.MouseEventHandler<HTMLLIElement>,\n className?: string\n) => {\n if (element == null) return null;\n\n return React.cloneElement(element, {\n className,\n checked: !!selected,\n disabled,\n onChange: onClick,\n });\n};\n\nconst applyClassNameToElement = (element, className?: string) => {\n if (element == null) return null;\n\n return React.cloneElement(element, {\n className,\n });\n};\n\n/**\n * ListItem description/documentation paragraph\n */\nexport const HvListItem = forwardRef<any, HvListItemProps>((props, ref) => {\n const {\n classes: classesProp,\n className,\n role,\n value,\n selected,\n disabled,\n selectable: selectableProp,\n interactive: interactiveProp,\n condensed: condensedProp,\n disableGutters: disableGuttersProp,\n startAdornment,\n endAdornment,\n onClick,\n children,\n tabIndex,\n ...others\n } = useDefaultProps(\"HvListItem\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const {\n topContainerRef,\n condensed: condensedContext,\n disableGutters: disableGuttersContext,\n interactive: interactiveContext,\n selectable: selectableContext,\n } = useContext(HvListContext);\n\n const condensed = condensedProp ?? condensedContext;\n const disableGutters = disableGuttersProp ?? disableGuttersContext;\n const interactive = interactiveProp ?? interactiveContext;\n const selectable = selectableProp ?? selectableContext;\n\n const handleClick = useCallback<React.MouseEventHandler<HTMLLIElement>>(\n (evt) => {\n if (disabled) return;\n onClick?.(evt);\n },\n [disabled, onClick]\n );\n\n const clonedStartAdornment = useMemo(\n () =>\n applyClassNameAndStateToElement(\n startAdornment,\n selected,\n disabled,\n handleClick,\n cx(\n classes.startAdornment,\n { [classes.disabled]: disabled },\n React.isValidElement(startAdornment)\n ? startAdornment.props.className\n : undefined\n )\n ),\n [\n cx,\n classes?.startAdornment,\n classes?.disabled,\n disabled,\n handleClick,\n selected,\n startAdornment,\n ]\n );\n const clonedEndAdornment = useMemo(\n () =>\n applyClassNameToElement(\n endAdornment,\n cx(\n classes.endAdornment,\n { [classes.disabled]: disabled },\n React.isValidElement(endAdornment)\n ? endAdornment.props.className\n : undefined\n )\n ),\n [cx, classes?.endAdornment, classes?.disabled, disabled, endAdornment]\n );\n\n const roleOptionAriaProps =\n role === \"option\" || role === \"menuitem\"\n ? {\n \"aria-disabled\": disabled || undefined,\n \"aria-selected\": selected,\n }\n : {};\n\n const listItem = (\n // For later: this should only have an onClick event if interactive and has the appropriate role.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events\n <li\n ref={ref}\n role={role}\n value={value}\n className={cx(\n classes.root,\n {\n [classes.gutters]: !disableGutters,\n [classes.condensed]: condensed,\n [classes.interactive]: interactive || selectable,\n [classes.selected]: selected || props[\"aria-selected\"],\n [classes.disabled]: disabled || props[\"aria-disabled\"],\n [classes.withStartAdornment]: startAdornment != null,\n [classes.withEndAdornment]: endAdornment != null,\n },\n className\n )}\n tabIndex={interactive ? undefined : tabIndex}\n onClick={handleClick}\n {...roleOptionAriaProps}\n {...others}\n >\n {clonedStartAdornment}\n {children}\n {clonedEndAdornment}\n </li>\n );\n\n return interactive ? (\n <HvFocus\n rootRef={topContainerRef}\n selected={selected}\n disabledClass={disabled || undefined}\n strategy={role === \"option\" ? \"listbox\" : \"menu\"}\n classes={{ focus: classes.focus }}\n configuration={{\n tabIndex,\n }}\n >\n {listItem}\n </HvFocus>\n ) : (\n listItem\n );\n});\n"],"names":["React","forwardRef","useDefaultProps","useClasses","useContext","HvListContext","useCallback","useMemo","jsxs","jsx","HvFocus"],"mappings":";;;;;;;;;;AA2DA,MAAM,kCAAkC,CACtC,SACA,UACA,UACA,SACA,cACG;AACH,MAAI,WAAW;AAAa,WAAA;AAErB,SAAAA,eAAA,QAAM,aAAa,SAAS;AAAA,IACjC;AAAA,IACA,SAAS,CAAC,CAAC;AAAA,IACX;AAAA,IACA,UAAU;AAAA,EAAA,CACX;AACH;AAEA,MAAM,0BAA0B,CAAC,SAAS,cAAuB;AAC/D,MAAI,WAAW;AAAa,WAAA;AAErB,SAAAA,eAAA,QAAM,aAAa,SAAS;AAAA,IACjC;AAAA,EAAA,CACD;AACH;AAKO,MAAM,aAAaC,MAAA,WAAiC,CAAC,OAAO,QAAQ;AACnE,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACDC,gBAAgB,gBAAA,cAA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A;AAAA,IAGJQ,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAW;AAAA,UACT,QAAQ;AAAA,UACR;AAAA,YACE,CAAC,QAAQ,OAAO,GAAG,CAAC;AAAA,YACpB,CAAC,QAAQ,SAAS,GAAG;AAAA,YACrB,CAAC,QAAQ,WAAW,GAAG,eAAe;AAAA,YACtC,CAAC,QAAQ,QAAQ,GAAG,YAAY,MAAM,eAAe;AAAA,YACrD,CAAC,QAAQ,QAAQ,GAAG,YAAY,MAAM,eAAe;AAAA,YACrD,CAAC,QAAQ,kBAAkB,GAAG,kBAAkB;AAAA,YAChD,CAAC,QAAQ,gBAAgB,GAAG,gBAAgB;AAAA,UAC9C;AAAA,UACA;AAAA,QACF;AAAA,QACA,UAAU,cAAc,SAAY;AAAA,QACpC,SAAS;AAAA,QACR,GAAG;AAAA,QACH,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA;AAGF,SAAO,cACLC,2BAAA;AAAA,IAACC,MAAA;AAAA,IAAA;AAAA,MACC,SAAS;AAAA,MACT;AAAA,MACA,eAAe,YAAY;AAAA,MAC3B,UAAU,SAAS,WAAW,YAAY;AAAA,MAC1C,SAAS,EAAE,OAAO,QAAQ,MAAM;AAAA,MAChC,eAAe;AAAA,QACb;AAAA,MACF;AAAA,MAEC,UAAA;AAAA,IAAA;AAAA,EAGH,IAAA;AAEJ,CAAC;;;"}
@@ -1,40 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const React = require("react");
5
- const isEmpty = require("lodash/isEmpty");
6
4
  const useDefaultProps = require("../hooks/useDefaultProps.cjs");
5
+ const generic = require("../types/generic.cjs");
7
6
  const TimeAgo_styles = require("./TimeAgo.styles.cjs");
8
7
  const useTimeAgo = require("./useTimeAgo.cjs");
9
8
  const Typography = require("../Typography/Typography.cjs");
10
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
11
- const isEmpty__default = /* @__PURE__ */ _interopDefault(isEmpty);
12
- const HvTimeAgo = React.forwardRef(
13
- (props, ref) => {
14
- const {
15
- classes: classesProp,
16
- className,
17
- timestamp,
18
- locale: localeProp = "en",
19
- component: Component = Typography.HvTypography,
20
- emptyElement = "—",
21
- disableRefresh = false,
22
- showSeconds = false,
23
- justText = false,
24
- ...others
25
- } = useDefaultProps.useDefaultProps("HvTimeAgo", props);
26
- const { classes, cx } = TimeAgo_styles.useClasses(classesProp);
27
- const locale = isEmpty__default.default(localeProp) ? "en" : localeProp;
28
- const timeAgo = useTimeAgo.default(timestamp, {
29
- locale,
30
- disableRefresh,
31
- showSeconds
32
- });
33
- if (justText && timestamp)
34
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: timeAgo });
35
- return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, className: cx(classes.root, className), ...others, children: !timestamp ? emptyElement : timeAgo });
36
- }
37
- );
9
+ const HvTimeAgo = generic.fixedForwardRef(function HvTimeAgo2(props, ref) {
10
+ const {
11
+ classes: classesProp,
12
+ className,
13
+ timestamp,
14
+ locale: localeProp = "en",
15
+ component: Component = Typography.HvTypography,
16
+ emptyElement = "—",
17
+ disableRefresh = false,
18
+ showSeconds = false,
19
+ justText = false,
20
+ ...others
21
+ } = useDefaultProps.useDefaultProps("HvTimeAgo", props);
22
+ const { classes, cx } = TimeAgo_styles.useClasses(classesProp);
23
+ const locale = localeProp || "en";
24
+ const timeAgo = useTimeAgo.default(timestamp, {
25
+ locale,
26
+ disableRefresh,
27
+ showSeconds
28
+ });
29
+ if (justText && timestamp)
30
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: timeAgo });
31
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, className: cx(classes.root, className), ...others, children: !timestamp ? emptyElement : timeAgo });
32
+ });
38
33
  exports.timeAgoClasses = TimeAgo_styles.staticClasses;
39
34
  exports.HvTimeAgo = HvTimeAgo;
40
35
  //# sourceMappingURL=TimeAgo.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"TimeAgo.cjs","sources":["../../../src/TimeAgo/TimeAgo.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\n\nimport isEmpty from \"lodash/isEmpty\";\n\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { HvTypography } from \"../Typography\";\nimport { PolymorphicComponentRef, PolymorphicRef } from \"../types/generic\";\n\nimport { staticClasses, useClasses } from \"./TimeAgo.styles\";\nimport useTimeAgo from \"./useTimeAgo\";\n\nexport { staticClasses as timeAgoClasses };\n\nexport type HvTimeAgoClasses = ExtractNames<typeof useClasses>;\n\nexport type HvTimeAgoProps<C extends React.ElementType = \"p\"> =\n PolymorphicComponentRef<\n C,\n {\n /**\n * The timestamp to format, in seconds or milliseconds.\n * Defaults to `emptyElement` if value is null or 0\n */\n timestamp?: number;\n /**\n * The locale to be used. Should be on of the dayjs supported locales and explicitly imported\n * @see https://day.js.org/docs/en/i18n/i18n\n */\n locale?: string;\n /**\n * The element to render when the timestamp is null or 0\n * Defaults to `—` (Em Dash)\n */\n emptyElement?: React.ReactNode;\n /** Disables periodic date refreshes */\n disableRefresh?: boolean;\n /** Whether to show seconds in the rendered time */\n showSeconds?: boolean;\n /**\n * Whether the component should render just the string\n * Consider using `useTimeAgo` instead\n */\n justText?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTimeAgoClasses;\n }\n >;\n\n/**\n * The HvTimeAgo component implements the Design System relative time format guidelines.\n */\nexport const HvTimeAgo: <C extends React.ElementType = \"p\">(\n props: HvTimeAgoProps<C>\n) => React.ReactElement | null = forwardRef(\n <C extends React.ElementType = \"p\">(\n props: HvTimeAgoProps<C>,\n ref: PolymorphicRef<C>\n ) => {\n const {\n classes: classesProp,\n className,\n timestamp,\n locale: localeProp = \"en\",\n component: Component = HvTypography,\n emptyElement = \"—\",\n disableRefresh = false,\n showSeconds = false,\n justText = false,\n ...others\n } = useDefaultProps(\"HvTimeAgo\", props);\n\n const { classes, cx } = useClasses(classesProp);\n const locale = isEmpty(localeProp) ? \"en\" : localeProp;\n const timeAgo = useTimeAgo(timestamp, {\n locale,\n disableRefresh,\n showSeconds,\n });\n\n // eslint-disable-next-line react/jsx-no-useless-fragment\n if (justText && timestamp) return <>{timeAgo}</>;\n\n return (\n <Component ref={ref} className={cx(classes.root, className)} {...others}>\n {!timestamp ? emptyElement : timeAgo}\n </Component>\n );\n }\n);\n"],"names":["forwardRef","HvTypography","useDefaultProps","useClasses","isEmpty","useTimeAgo","jsx"],"mappings":";;;;;;;;;;;AAoDO,MAAM,YAEoBA,MAAA;AAAA,EAC/B,CACE,OACA,QACG;AACG,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA,QAAQ,aAAa;AAAA,MACrB,WAAW,YAAYC,WAAA;AAAA,MACvB,eAAe;AAAA,MACf,iBAAiB;AAAA,MACjB,cAAc;AAAA,MACd,WAAW;AAAA,MACX,GAAG;AAAA,IAAA,IACDC,gBAAgB,gBAAA,aAAa,KAAK;AAEtC,UAAM,EAAE,SAAS,GAAG,IAAIC,0BAAW,WAAW;AAC9C,UAAM,SAASC,iBAAA,QAAQ,UAAU,IAAI,OAAO;AACtC,UAAA,UAAUC,mBAAW,WAAW;AAAA,MACpC;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD;AAGD,QAAI,YAAY;AAAW,mEAAU,UAAQ,QAAA,CAAA;AAE7C,WACGC,2BAAAA,IAAA,WAAA,EAAU,KAAU,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QAC9D,UAAC,CAAA,YAAY,eAAe,QAC/B,CAAA;AAAA,EAEJ;AACF;;;"}
1
+ {"version":3,"file":"TimeAgo.cjs","sources":["../../../src/TimeAgo/TimeAgo.tsx"],"sourcesContent":["import { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { HvTypography } from \"../Typography\";\nimport {\n fixedForwardRef,\n PolymorphicComponentRef,\n PolymorphicRef,\n} from \"../types/generic\";\n\nimport { staticClasses, useClasses } from \"./TimeAgo.styles\";\nimport useTimeAgo from \"./useTimeAgo\";\n\nexport { staticClasses as timeAgoClasses };\n\nexport type HvTimeAgoClasses = ExtractNames<typeof useClasses>;\n\nexport type HvTimeAgoProps<C extends React.ElementType = \"p\"> =\n PolymorphicComponentRef<\n C,\n {\n /**\n * The timestamp to format, in seconds or milliseconds.\n * Defaults to `emptyElement` if value is null or 0\n */\n timestamp?: number;\n /**\n * The locale to be used. Should be on of the dayjs supported locales and explicitly imported\n * @see https://day.js.org/docs/en/i18n/i18n\n */\n locale?: string;\n /**\n * The element to render when the timestamp is null or 0\n * Defaults to `—` (Em Dash)\n */\n emptyElement?: React.ReactNode;\n /** Disables periodic date refreshes */\n disableRefresh?: boolean;\n /** Whether to show seconds in the rendered time */\n showSeconds?: boolean;\n /**\n * Whether the component should render just the string\n * Consider using `useTimeAgo` instead\n */\n justText?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTimeAgoClasses;\n }\n >;\n\n/**\n * The HvTimeAgo component implements the Design System relative time format guidelines.\n */\nexport const HvTimeAgo = fixedForwardRef(function HvTimeAgo<\n C extends React.ElementType = \"p\"\n>(props: HvTimeAgoProps<C>, ref: PolymorphicRef<C>) {\n const {\n classes: classesProp,\n className,\n timestamp,\n locale: localeProp = \"en\",\n component: Component = HvTypography,\n emptyElement = \"—\",\n disableRefresh = false,\n showSeconds = false,\n justText = false,\n ...others\n } = useDefaultProps(\"HvTimeAgo\", props);\n\n const { classes, cx } = useClasses(classesProp);\n const locale = localeProp || \"en\";\n const timeAgo = useTimeAgo(timestamp, {\n locale,\n disableRefresh,\n showSeconds,\n });\n\n // eslint-disable-next-line react/jsx-no-useless-fragment\n if (justText && timestamp) return <>{timeAgo}</>;\n\n return (\n <Component ref={ref} className={cx(classes.root, className)} {...others}>\n {!timestamp ? emptyElement : timeAgo}\n </Component>\n );\n});\n"],"names":["fixedForwardRef","HvTimeAgo","HvTypography","useDefaultProps","useClasses","useTimeAgo","jsx"],"mappings":";;;;;;;;AAoDO,MAAM,YAAYA,QAAAA,gBAAgB,SAASC,WAEhD,OAA0B,KAAwB;AAC5C,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,QAAQ,aAAa;AAAA,IACrB,WAAW,YAAYC,WAAA;AAAA,IACvB,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd,WAAW;AAAA,IACX,GAAG;AAAA,EAAA,IACDC,gBAAgB,gBAAA,aAAa,KAAK;AAEtC,QAAM,EAAE,SAAS,GAAG,IAAIC,0BAAW,WAAW;AAC9C,QAAM,SAAS,cAAc;AACvB,QAAA,UAAUC,mBAAW,WAAW;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAGD,MAAI,YAAY;AAAW,iEAAU,UAAQ,QAAA,CAAA;AAE7C,SACGC,2BAAAA,IAAA,WAAA,EAAU,KAAU,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QAC9D,UAAC,CAAA,YAAY,eAAe,QAC/B,CAAA;AAEJ,CAAC;;;"}
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const React = require("react");
5
4
  const utils = require("@mui/base/utils");
6
5
  const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
6
+ const generic = require("../types/generic.cjs");
7
7
  const useDefaultProps = require("../hooks/useDefaultProps.cjs");
8
8
  const useTreeView = require("./internals/hooks/useTreeView.cjs");
9
9
  const TreeViewProvider = require("./internals/TreeViewProvider.cjs");
10
10
  const TreeView_styles = require("./TreeView.styles.cjs");
11
11
  const defaultPlugins = require("./internals/hooks/plugins/defaultPlugins.cjs");
12
- const HvTreeView = React.forwardRef(function HvTreeView2(props, ref) {
12
+ const HvTreeView = generic.fixedForwardRef(function HvTreeView2(props, ref) {
13
13
  const {
14
14
  id,
15
15
  children,
@@ -1 +1 @@
1
- {"version":3,"file":"TreeView.cjs","sources":["../../../src/TreeView/TreeView.tsx"],"sourcesContent":["import { ReactNode, Ref, forwardRef } from \"react\";\nimport { useSlotProps } from \"@mui/base/utils\";\nimport { DropDownXS, DropRightXS } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvBaseProps } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\n\nimport {\n DEFAULT_TREE_VIEW_PLUGINS,\n DefaultTreeViewPluginParameters,\n} from \"./internals/hooks/plugins\";\nimport { useTreeView } from \"./internals/hooks/useTreeView\";\nimport { TreeViewProvider } from \"./internals/TreeViewProvider\";\nimport { staticClasses, useClasses } from \"./TreeView.styles\";\n\nexport { staticClasses as treeView2Classes }; // TODO: remove old `treeViewClasses`\n\nexport type HvTreeViewClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTreeViewProps<Multiple extends boolean | undefined>\n extends HvBaseProps<HTMLUListElement>,\n DefaultTreeViewPluginParameters<Multiple> {\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvTreeViewClasses;\n /** Tree View children. Usually a `HvTreeItem` instance, or a custom variation of it */\n children?: ReactNode;\n}\n\ntype HvTreeViewComponent = <Multiple extends boolean | undefined = undefined>(\n props: HvTreeViewProps<Multiple>\n) => React.JSX.Element;\n\n/* eslint-disable prefer-arrow-callback */\n/**\n * A Tree View displays hierarchical structures.\n * It also facilitates the exploration of categorical levels and their content.\n *\n * Tree structures are built through composing the `HvTreeItem` component,\n * or a custom variation of it.\n *\n * It is based on MUI's [TreeView](https://mui.com/x/react-tree-view) component.\n *\n * @example\n * ```tsx\n * <HvTreeView>\n * <HvTreeItem nodeId=\"1\" label=\"File1\" />\n * </HvTreeView>\n * ```\n */\nconst HvTreeView = forwardRef(function HvTreeView<\n Multiple extends boolean | undefined\n>(props: HvTreeViewProps<Multiple>, ref: Ref<HTMLUListElement>) {\n const {\n id,\n children,\n classes: classesProp,\n className,\n\n disabledItemsFocusable,\n multiSelect,\n expanded,\n defaultExpanded,\n selected,\n defaultSelected,\n disableSelection,\n defaultCollapseIcon = <DropDownXS role=\"none\" />,\n defaultExpandIcon = <DropRightXS role=\"none\" />,\n defaultEndIcon,\n defaultParentIcon,\n onNodeSelect,\n onNodeToggle,\n onNodeFocus,\n ...others\n } = useDefaultProps(\"HvTreeView\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const { getRootProps, contextValue } = useTreeView({\n disabledItemsFocusable,\n expanded,\n defaultExpanded,\n onNodeToggle,\n onNodeFocus,\n disableSelection,\n defaultSelected,\n selected,\n multiSelect,\n onNodeSelect: onNodeSelect as HvTreeViewProps<any>[\"onNodeSelect\"],\n id,\n defaultCollapseIcon,\n defaultEndIcon,\n defaultExpandIcon,\n defaultParentIcon,\n plugins: DEFAULT_TREE_VIEW_PLUGINS,\n rootRef: ref,\n });\n\n const rootProps = useSlotProps({\n elementType: \"ul\",\n externalSlotProps: {},\n externalForwardedProps: others,\n className: classes.root,\n getSlotProps: getRootProps,\n ownerState: props,\n });\n\n return (\n <TreeViewProvider value={contextValue}>\n <ul className={cx(classes.root, className)} {...rootProps} {...others}>\n {children}\n </ul>\n </TreeViewProvider>\n );\n}) as HvTreeViewComponent;\n\nexport { HvTreeView };\n"],"names":["forwardRef","HvTreeView","jsx","DropDownXS","DropRightXS","useDefaultProps","useClasses","useTreeView","DEFAULT_TREE_VIEW_PLUGINS","useSlotProps","TreeViewProvider"],"mappings":";;;;;;;;;;;AAkDA,MAAM,aAAaA,MAAAA,WAAW,SAASC,YAErC,OAAkC,KAA4B;AACxD,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,sBAAsBC,2BAAAA,IAACC,gBAAAA,YAAW,EAAA,MAAK,OAAO,CAAA;AAAA,IAC9C,oBAAoBD,2BAAAA,IAACE,gBAAAA,aAAY,EAAA,MAAK,OAAO,CAAA;AAAA,IAC7C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACDC,gBAAgB,gBAAA,cAAc,KAAK;AACvC,QAAM,EAAE,SAAS,GAAG,IAAIC,2BAAW,WAAW;AAE9C,QAAM,EAAE,cAAc,aAAa,IAAIC,wBAAY;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAASC,eAAA;AAAA,IACT,SAAS;AAAA,EAAA,CACV;AAED,QAAM,YAAYC,MAAAA,aAAa;AAAA,IAC7B,aAAa;AAAA,IACb,mBAAmB,CAAC;AAAA,IACpB,wBAAwB;AAAA,IACxB,WAAW,QAAQ;AAAA,IACnB,cAAc;AAAA,IACd,YAAY;AAAA,EAAA,CACb;AAED,wCACGC,iBAAiB,kBAAA,EAAA,OAAO,cACvB,UAAAR,2BAAAA,IAAC,QAAG,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,WAAY,GAAG,QAC5D,UACH,EACF,CAAA;AAEJ,CAAC;;;"}
1
+ {"version":3,"file":"TreeView.cjs","sources":["../../../src/TreeView/TreeView.tsx"],"sourcesContent":["import { useSlotProps } from \"@mui/base/utils\";\nimport { DropDownXS, DropRightXS } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvBaseProps, fixedForwardRef } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\n\nimport {\n DEFAULT_TREE_VIEW_PLUGINS,\n DefaultTreeViewPluginParameters,\n} from \"./internals/hooks/plugins\";\nimport { useTreeView } from \"./internals/hooks/useTreeView\";\nimport { TreeViewProvider } from \"./internals/TreeViewProvider\";\nimport { staticClasses, useClasses } from \"./TreeView.styles\";\n\nexport { staticClasses as treeView2Classes }; // TODO: remove old `treeViewClasses`\n\nexport type HvTreeViewClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTreeViewProps<Multiple extends boolean | undefined>\n extends HvBaseProps<HTMLUListElement>,\n DefaultTreeViewPluginParameters<Multiple> {\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvTreeViewClasses;\n /** Tree View children. Usually a `HvTreeItem` instance, or a custom variation of it */\n children?: React.ReactNode;\n}\n\n/**\n * A Tree View displays hierarchical structures.\n * It also facilitates the exploration of categorical levels and their content.\n *\n * Tree structures are built through composing the `HvTreeItem` component,\n * or a custom variation of it.\n *\n * It is based on MUI's [TreeView](https://mui.com/x/react-tree-view) component.\n *\n * @example\n * ```tsx\n * <HvTreeView>\n * <HvTreeItem nodeId=\"1\" label=\"File1\" />\n * </HvTreeView>\n * ```\n */\nexport const HvTreeView = fixedForwardRef(function HvTreeView<\n Multiple extends boolean | undefined\n>(props: HvTreeViewProps<Multiple>, ref: React.Ref<HTMLUListElement>) {\n const {\n id,\n children,\n classes: classesProp,\n className,\n\n disabledItemsFocusable,\n multiSelect,\n expanded,\n defaultExpanded,\n selected,\n defaultSelected,\n disableSelection,\n defaultCollapseIcon = <DropDownXS role=\"none\" />,\n defaultExpandIcon = <DropRightXS role=\"none\" />,\n defaultEndIcon,\n defaultParentIcon,\n onNodeSelect,\n onNodeToggle,\n onNodeFocus,\n ...others\n } = useDefaultProps(\"HvTreeView\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const { getRootProps, contextValue } = useTreeView({\n disabledItemsFocusable,\n expanded,\n defaultExpanded,\n onNodeToggle,\n onNodeFocus,\n disableSelection,\n defaultSelected,\n selected,\n multiSelect,\n onNodeSelect: onNodeSelect as HvTreeViewProps<any>[\"onNodeSelect\"],\n id,\n defaultCollapseIcon,\n defaultEndIcon,\n defaultExpandIcon,\n defaultParentIcon,\n plugins: DEFAULT_TREE_VIEW_PLUGINS,\n rootRef: ref,\n });\n\n const rootProps = useSlotProps({\n elementType: \"ul\",\n externalSlotProps: {},\n externalForwardedProps: others,\n className: classes.root,\n getSlotProps: getRootProps,\n ownerState: props,\n });\n\n return (\n <TreeViewProvider value={contextValue}>\n <ul className={cx(classes.root, className)} {...rootProps} {...others}>\n {children}\n </ul>\n </TreeViewProvider>\n );\n});\n"],"names":["fixedForwardRef","HvTreeView","jsx","DropDownXS","DropRightXS","useDefaultProps","useClasses","useTreeView","DEFAULT_TREE_VIEW_PLUGINS","useSlotProps","TreeViewProvider"],"mappings":";;;;;;;;;;;AA4CO,MAAM,aAAaA,QAAAA,gBAAgB,SAASC,YAEjD,OAAkC,KAAkC;AAC9D,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,sBAAsBC,2BAAAA,IAACC,gBAAAA,YAAW,EAAA,MAAK,OAAO,CAAA;AAAA,IAC9C,oBAAoBD,2BAAAA,IAACE,gBAAAA,aAAY,EAAA,MAAK,OAAO,CAAA;AAAA,IAC7C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACDC,gBAAgB,gBAAA,cAAc,KAAK;AACvC,QAAM,EAAE,SAAS,GAAG,IAAIC,2BAAW,WAAW;AAE9C,QAAM,EAAE,cAAc,aAAa,IAAIC,wBAAY;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAASC,eAAA;AAAA,IACT,SAAS;AAAA,EAAA,CACV;AAED,QAAM,YAAYC,MAAAA,aAAa;AAAA,IAC7B,aAAa;AAAA,IACb,mBAAmB,CAAC;AAAA,IACpB,wBAAwB;AAAA,IACxB,WAAW,QAAQ;AAAA,IACnB,cAAc;AAAA,IACd,YAAY;AAAA,EAAA,CACb;AAED,wCACGC,iBAAiB,kBAAA,EAAA,OAAO,cACvB,UAAAR,2BAAAA,IAAC,QAAG,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,WAAY,GAAG,QAC5D,UACH,EACF,CAAA;AAEJ,CAAC;;;"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const React = require("react");
4
+ const generic = require("../types/generic.cjs");
5
5
  const useTheme = require("../hooks/useTheme.cjs");
6
6
  const useDefaultProps = require("../hooks/useDefaultProps.cjs");
7
7
  const utils = require("./utils.cjs");
@@ -38,43 +38,41 @@ const HvTypographyMap = {
38
38
  vizTextDisabled: "p",
39
39
  xsInlineLink: "p"
40
40
  };
41
- const HvTypography = React.forwardRef(
42
- (props, ref) => {
43
- const {
44
- className,
45
- component: ComponentProp,
46
- classes: classesProp,
47
- variant: variantProp = "body",
48
- link = false,
49
- noWrap = false,
50
- paragraph = false,
51
- disabled = false,
41
+ const HvTypography = generic.fixedForwardRef(function HvTypography2(props, ref) {
42
+ const {
43
+ className,
44
+ component: ComponentProp,
45
+ classes: classesProp,
46
+ variant: variantProp = "body",
47
+ link = false,
48
+ noWrap = false,
49
+ paragraph = false,
50
+ disabled = false,
51
+ ...others
52
+ } = useDefaultProps.useDefaultProps("HvTypography", props);
53
+ const { classes, cx } = Typography_styles.useClasses(classesProp);
54
+ const { activeTheme } = useTheme.useTheme();
55
+ const variant = utils.mapVariant(variantProp, activeTheme?.name);
56
+ const Component = ComponentProp || paragraph && "p" || HvTypographyMap[variant] || "span";
57
+ return /* @__PURE__ */ jsxRuntime.jsx(
58
+ Component,
59
+ {
60
+ ref,
61
+ className: cx(
62
+ classes.root,
63
+ classes[variant],
64
+ {
65
+ [classes.isLink]: link,
66
+ [classes.noWrap]: noWrap,
67
+ [classes.disabled]: disabled
68
+ },
69
+ className
70
+ ),
71
+ disabled,
52
72
  ...others
53
- } = useDefaultProps.useDefaultProps("HvTypography", props);
54
- const { classes, cx } = Typography_styles.useClasses(classesProp);
55
- const { activeTheme } = useTheme.useTheme();
56
- const variant = utils.mapVariant(variantProp, activeTheme?.name);
57
- const Component = ComponentProp || paragraph && "p" || HvTypographyMap[variant] || "span";
58
- return /* @__PURE__ */ jsxRuntime.jsx(
59
- Component,
60
- {
61
- ref,
62
- className: cx(
63
- classes.root,
64
- classes[variant],
65
- {
66
- [classes.isLink]: link,
67
- [classes.noWrap]: noWrap,
68
- [classes.disabled]: disabled
69
- },
70
- className
71
- ),
72
- disabled,
73
- ...others
74
- }
75
- );
76
- }
77
- );
73
+ }
74
+ );
75
+ });
78
76
  exports.typographyClasses = Typography_styles.staticClasses;
79
77
  exports.HvTypography = HvTypography;
80
78
  //# sourceMappingURL=Typography.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Typography.cjs","sources":["../../../src/Typography/Typography.tsx"],"sourcesContent":["import { ElementType, forwardRef } from \"react\";\n\nimport { PolymorphicComponentRef, PolymorphicRef } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { useTheme } from \"../hooks/useTheme\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport {\n HvTypographyLegacyVariants,\n HvTypographyVariants,\n mapVariant,\n} from \"./utils\";\nimport { staticClasses, useClasses } from \"./Typography.styles\";\n\nexport { staticClasses as typographyClasses };\n\nexport type HvTypographyClasses = ExtractNames<typeof useClasses>;\n\nconst HvTypographyMap = {\n display: \"h1\",\n title1: \"h1\",\n title2: \"h2\",\n title3: \"h3\",\n title4: \"h4\",\n body: \"p\",\n label: \"span\",\n caption1: \"p\",\n caption2: \"p\",\n // LEGACY\n \"5xlTitle\": \"h1\",\n \"4xlTitle\": \"h1\",\n \"3xlTitle\": \"h1\",\n xxlTitle: \"h1\",\n xlTitle: \"h1\",\n lTitle: \"h2\",\n mTitle: \"h3\",\n sTitle: \"h4\",\n xsTitle: \"h5\",\n xxsTitle: \"h6\",\n sectionTitle: \"p\",\n highlightText: \"p\",\n normalText: \"p\",\n placeholderText: \"p\",\n link: \"p\",\n disabledText: \"p\",\n selectedNavText: \"p\",\n vizText: \"p\",\n vizTextDisabled: \"p\",\n xsInlineLink: \"p\",\n} satisfies Record<\n HvTypographyVariants | HvTypographyLegacyVariants,\n ElementType\n>;\n\nexport type HvTypographyProps<C extends React.ElementType = \"p\"> =\n PolymorphicComponentRef<\n C,\n {\n /** Use the variant prop to change the visual style of the Typography. */\n variant?: HvTypographyVariants | HvTypographyLegacyVariants;\n /** If `true` the typography will display the look of a link. */\n link?: boolean;\n /** If `true` the typography will display the look of a disabled state. */\n disabled?: boolean;\n /**\n * If `true`, the typography will render a \"p\" element\n * @deprecated use `component=\"p\"` instead\n * */\n paragraph?: boolean;\n /**\n * If `true`, the text will not wrap, but instead will truncate with a text overflow ellipsis.\n *\n * Note that text overflow can only happen with block or inline-block level elements\n * (the element needs to have a width in order to overflow).\n */\n noWrap?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTypographyClasses;\n }\n >;\n\n/**\n * Typography component is used to render text and paragraphs within an interface.\n */\nexport const HvTypography: <C extends React.ElementType = \"p\">(\n props: HvTypographyProps<C>\n) => React.ReactElement | null = forwardRef(\n <C extends React.ElementType = \"p\">(\n props: HvTypographyProps<C>,\n ref: PolymorphicRef<C>\n ) => {\n const {\n className,\n component: ComponentProp,\n classes: classesProp,\n variant: variantProp = \"body\",\n link = false,\n noWrap = false,\n paragraph = false,\n disabled = false,\n ...others\n } = useDefaultProps(\"HvTypography\", props);\n const { classes, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const variant = mapVariant(variantProp, activeTheme?.name);\n\n const Component =\n ComponentProp || (paragraph && \"p\") || HvTypographyMap[variant] || \"span\";\n\n return (\n <Component\n ref={ref}\n className={cx(\n classes.root,\n classes[variant],\n {\n [classes.isLink]: link,\n [classes.noWrap]: noWrap,\n [classes.disabled]: disabled,\n },\n className\n )}\n disabled={disabled}\n {...others}\n />\n );\n }\n);\n"],"names":["forwardRef","useDefaultProps","useClasses","useTheme","mapVariant","jsx"],"mappings":";;;;;;;;AAiBA,MAAM,kBAAkB;AAAA,EACtB,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA;AAAA,EAEV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,UAAU;AAAA,EACV,cAAc;AAAA,EACd,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,iBAAiB;AAAA,EACjB,cAAc;AAChB;AAmCO,MAAM,eAEoBA,MAAA;AAAA,EAC/B,CACE,OACA,QACG;AACG,UAAA;AAAA,MACJ;AAAA,MACA,WAAW;AAAA,MACX,SAAS;AAAA,MACT,SAAS,cAAc;AAAA,MACvB,OAAO;AAAA,MACP,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,GAAG;AAAA,IAAA,IACDC,gBAAgB,gBAAA,gBAAgB,KAAK;AACzC,UAAM,EAAE,SAAS,GAAG,IAAIC,6BAAW,WAAW;AACxC,UAAA,EAAE,gBAAgBC,SAAAA;AAExB,UAAM,UAAUC,MAAA,WAAW,aAAa,aAAa,IAAI;AAEzD,UAAM,YACJ,iBAAkB,aAAa,OAAQ,gBAAgB,OAAO,KAAK;AAGnE,WAAAC,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT,QAAQ;AAAA,UACR,QAAQ,OAAO;AAAA,UACf;AAAA,YACE,CAAC,QAAQ,MAAM,GAAG;AAAA,YAClB,CAAC,QAAQ,MAAM,GAAG;AAAA,YAClB,CAAC,QAAQ,QAAQ,GAAG;AAAA,UACtB;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,QACC,GAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;;;"}
1
+ {"version":3,"file":"Typography.cjs","sources":["../../../src/Typography/Typography.tsx"],"sourcesContent":["import {\n fixedForwardRef,\n PolymorphicComponentRef,\n PolymorphicRef,\n} from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { useTheme } from \"../hooks/useTheme\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport {\n HvTypographyLegacyVariants,\n HvTypographyVariants,\n mapVariant,\n} from \"./utils\";\nimport { staticClasses, useClasses } from \"./Typography.styles\";\n\nexport { staticClasses as typographyClasses };\n\nexport type HvTypographyClasses = ExtractNames<typeof useClasses>;\n\nconst HvTypographyMap = {\n display: \"h1\",\n title1: \"h1\",\n title2: \"h2\",\n title3: \"h3\",\n title4: \"h4\",\n body: \"p\",\n label: \"span\",\n caption1: \"p\",\n caption2: \"p\",\n // LEGACY\n \"5xlTitle\": \"h1\",\n \"4xlTitle\": \"h1\",\n \"3xlTitle\": \"h1\",\n xxlTitle: \"h1\",\n xlTitle: \"h1\",\n lTitle: \"h2\",\n mTitle: \"h3\",\n sTitle: \"h4\",\n xsTitle: \"h5\",\n xxsTitle: \"h6\",\n sectionTitle: \"p\",\n highlightText: \"p\",\n normalText: \"p\",\n placeholderText: \"p\",\n link: \"p\",\n disabledText: \"p\",\n selectedNavText: \"p\",\n vizText: \"p\",\n vizTextDisabled: \"p\",\n xsInlineLink: \"p\",\n} satisfies Record<\n HvTypographyVariants | HvTypographyLegacyVariants,\n React.ElementType\n>;\n\nexport type HvTypographyProps<C extends React.ElementType = \"p\"> =\n PolymorphicComponentRef<\n C,\n {\n /** Use the variant prop to change the visual style of the Typography. */\n variant?: HvTypographyVariants | HvTypographyLegacyVariants;\n /** If `true` the typography will display the look of a link. */\n link?: boolean;\n /** If `true` the typography will display the look of a disabled state. */\n disabled?: boolean;\n /**\n * If `true`, the typography will render a \"p\" element\n * @deprecated use `component=\"p\"` instead\n * */\n paragraph?: boolean;\n /**\n * If `true`, the text will not wrap, but instead will truncate with a text overflow ellipsis.\n *\n * Note that text overflow can only happen with block or inline-block level elements\n * (the element needs to have a width in order to overflow).\n */\n noWrap?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTypographyClasses;\n }\n >;\n\n/**\n * Typography component is used to render text and paragraphs within an interface.\n */\nexport const HvTypography = fixedForwardRef(function HvTypography<\n C extends React.ElementType = \"p\"\n>(props: HvTypographyProps<C>, ref: PolymorphicRef<C>) {\n const {\n className,\n component: ComponentProp,\n classes: classesProp,\n variant: variantProp = \"body\",\n link = false,\n noWrap = false,\n paragraph = false,\n disabled = false,\n ...others\n } = useDefaultProps(\"HvTypography\", props);\n const { classes, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const variant = mapVariant(variantProp, activeTheme?.name);\n\n const Component =\n ComponentProp || (paragraph && \"p\") || HvTypographyMap[variant] || \"span\";\n\n return (\n <Component\n ref={ref}\n className={cx(\n classes.root,\n classes[variant],\n {\n [classes.isLink]: link,\n [classes.noWrap]: noWrap,\n [classes.disabled]: disabled,\n },\n className\n )}\n disabled={disabled}\n {...others}\n />\n );\n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AAA,UACE,CAAC,QAAQ,MAAM,GAAG;AAAA,UAClB,CAAC,QAAQ,MAAM,GAAG;AAAA,UAClB,CAAC,QAAQ,QAAQ,GAAG;AAAA,QACtB;AAAA,QACA;AAAA,MACF;AAAA,MACA;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;;;"}
@@ -16,6 +16,7 @@ const useUniqueId = require("./hooks/useUniqueId.cjs");
16
16
  const useWidth = require("./hooks/useWidth.cjs");
17
17
  const Provider = require("./providers/Provider.cjs");
18
18
  const ThemeProvider = require("./providers/ThemeProvider.cjs");
19
+ const generic = require("./types/generic.cjs");
19
20
  const withTooltip = require("./hocs/withTooltip.cjs");
20
21
  const browser = require("./utils/browser.cjs");
21
22
  const checkValidHexColorValue = require("./utils/checkValidHexColorValue.cjs");
@@ -337,6 +338,7 @@ exports.useUniqueId = useUniqueId.useUniqueId;
337
338
  exports.useWidth = useWidth.useWidth;
338
339
  exports.HvProvider = Provider.HvProvider;
339
340
  exports.HvThemeProvider = ThemeProvider.HvThemeProvider;
341
+ exports.fixedForwardRef = generic.fixedForwardRef;
340
342
  exports.withTooltip = withTooltip.withTooltip;
341
343
  exports.isBrowser = browser.isBrowser;
342
344
  exports.checkValidHexColorValue = checkValidHexColorValue.checkValidHexColorValue;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const React = require("react");
4
+ function fixedForwardRef(render) {
5
+ return React.forwardRef(render);
6
+ }
7
+ exports.fixedForwardRef = fixedForwardRef;
8
+ //# sourceMappingURL=generic.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic.cjs","sources":["../../../src/types/generic.ts"],"sourcesContent":["import { forwardRef } from \"react\";\n\nimport type {\n HvExtraProps,\n HvExtraDeepProps,\n} from \"@hitachivantara/uikit-react-shared\";\n\nexport type { HvExtraProps, HvExtraDeepProps };\n\ntype AsProp<C extends React.ElementType> = {\n /** Custom element type to override the root component */\n component?: C;\n};\n\ntype PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P);\n\n// Workaround to fix the use of Omit with ComponentPropsWithoutRef\n// Without this the event handlers return any instead of the type for the chosen element\ntype FixComponentProps<T> = T extends any ? T : never;\n\ntype PolymorphicComponent<\n C extends React.ElementType,\n Props = {}\n> = React.PropsWithChildren<Props & AsProp<C>> &\n FixComponentProps<\n Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>\n >;\n\nexport type PolymorphicRef<C extends React.ElementType> =\n React.ComponentPropsWithRef<C>[\"ref\"];\n\nexport type PolymorphicComponentRef<\n C extends React.ElementType,\n Props = {}\n> = PolymorphicComponent<C, Props> & { ref?: PolymorphicRef<C> };\n\n/** HV Base Props. Extends `React.HTMLAttributes` of an element `E`, and filters `K` keys. */\nexport type HvBaseProps<\n E extends HTMLElement = HTMLDivElement,\n K extends keyof React.HTMLAttributes<E> = never\n> = Omit<React.HTMLAttributes<E>, K>;\n\n/** This type allows to do a deep partial by applying the Partial type to each key recursively */\nexport type DeepPartial<T> = T extends Object\n ? Partial<{\n [P in keyof T]: DeepPartial<T[P]>;\n }>\n : T;\n\n/** This type combines the HvExtraProps and DeepPartial types */\nexport type HvExtraDeepPartialProps<T> = Partial<{\n [P in keyof T]: DeepPartial<T[P]> & HvExtraProps;\n}> &\n HvExtraProps;\n\nexport type Arrayable<T> = T | T[];\n\n/** React.forwardRef with fixed type declarations */\nexport function fixedForwardRef<T, P = {}>(\n // TODO: change `React.ReactElement | null` to `React.ReactNode` in typescript@5\n render: (props: P, ref: React.Ref<T>) => React.ReactElement | null\n): (props: P & React.RefAttributes<T>) => React.ReactElement | null {\n return forwardRef(render) as any;\n}\n"],"names":["forwardRef"],"mappings":";;;AA0DO,SAAS,gBAEd,QACkE;AAClE,SAAOA,MAAAA,WAAW,MAAM;AAC1B;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"BaseDropdown.js","sources":["../../../src/BaseDropdown/BaseDropdown.tsx"],"sourcesContent":["import React, {\n useMemo,\n useState,\n useCallback,\n KeyboardEventHandler,\n AriaAttributes,\n forwardRef,\n} from \"react\";\n\nimport { createPortal } from \"react-dom\";\n\nimport ClickAwayListener, {\n ClickAwayListenerProps,\n} from \"@mui/material/ClickAwayListener\";\nimport { PopperPlacementType, PopperProps } from \"@mui/material/Popper\";\n\nimport { DropDownXS, DropUpXS } from \"@hitachivantara/uikit-react-icons\";\n\nimport { usePopper } from \"react-popper\";\nimport { detectOverflow, ModifierArguments, Options } from \"@popperjs/core\";\n\nimport { HvTypography } from \"../Typography\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { useTheme } from \"../hooks/useTheme\";\nimport { useForkRef } from \"../hooks/useForkRef\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { isKey, isOneOfKeys } from \"../utils/keyboardUtils\";\nimport { setId } from \"../utils/setId\";\nimport { getFirstAndLastFocus } from \"../utils/focusableElementFinder\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\n\nimport { staticClasses, useClasses } from \"./BaseDropdown.styles\";\nimport BaseDropdownContext from \"./BaseDropdownContext\";\n\nexport { staticClasses as baseDropdownClasses };\n\nexport type HvBaseDropdownClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvBaseDropdownProps extends HvBaseProps {\n /**\n * The role of the element that triggers the popup.\n *\n * Defaults to \"combobox\" if `component` and the default\n * \"textbox\" header is used, undefined otherwise.\n */\n role?: string;\n /**\n * Header placeholder.\n */\n placeholder?: React.ReactNode;\n /**\n * If `true` the dropdown is disabled unable to be interacted, if `false` it is enabled.\n */\n disabled?: boolean;\n /**\n * If `true` the dropdown will be in read only mode, unable to be interacted.\n */\n readOnly?: boolean;\n /**\n * Indicates that user input is required on the form element.\n */\n required?: boolean;\n /**\n * Disable the portal behavior.\n * The children stay within it's parent DOM hierarchy.\n */\n disablePortal?: boolean;\n /**\n * If `true` the dropdown width depends size of content if `false` the width depends on the header size.\n * Defaults to `false`.\n */\n variableWidth?: boolean;\n /**\n * If `true` the dropdown starts opened if `false` it starts closed.\n */\n expanded?: boolean;\n /**\n * When uncontrolled, defines the initial expanded state.\n */\n defaultExpanded?: boolean;\n /**\n * An object containing props to be wired to the popper component.\n */\n popperProps?: Partial<PopperProps>;\n /**\n * Placement of the dropdown.\n */\n placement?: \"left\" | \"right\";\n /**\n * Replacement for the header component.\n */\n component?: React.ReactNode;\n /**\n * Adornment to replace the default arrows.\n */\n adornment?: React.ReactNode;\n /**\n * When dropdown changes the expanded state.\n */\n onToggle?: (event: Event, open: boolean) => void;\n /**\n * When user click outside the open container.\n */\n onClickOutside?: (event: Event) => void;\n /**\n * Callback called when the dropdown is opened and ready,\n * commonly used to set focus to the content.\n */\n onContainerCreation?: (container: HTMLElement | null) => void;\n /**\n * Attributes applied to the dropdown header element.\n */\n dropdownHeaderProps?: React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n >;\n /**\n * Pass a ref to the dropdown header element.\n */\n dropdownHeaderRef?: React.Ref<HTMLDivElement>;\n /**\n * A Jss Object used to override or extend the component styles applied.\n */\n classes?: HvBaseDropdownClasses;\n /** @ignore */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport const HvBaseDropdown = forwardRef<HTMLDivElement, HvBaseDropdownProps>(\n (props, ref) => {\n const {\n id: idProp,\n className,\n classes: classesProp,\n children,\n role,\n placeholder,\n component,\n adornment,\n expanded,\n dropdownHeaderProps,\n defaultExpanded,\n disabled,\n readOnly,\n required,\n disablePortal,\n variableWidth,\n placement: placementProp = \"right\",\n \"aria-expanded\": ariaExpandedProp,\n \"aria-label\": ariaLabelProp,\n \"aria-labelledby\": ariaLabelledByProp,\n popperProps = {},\n dropdownHeaderRef: dropdownHeaderRefProp,\n onToggle,\n onClickOutside,\n onContainerCreation,\n ...others\n } = useDefaultProps(\"HvBaseDropdown\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const { rootId } = useTheme();\n\n const [isOpen, setIsOpen] = useControlled(\n expanded,\n Boolean(defaultExpanded)\n );\n\n const [referenceElement, setReferenceElement] =\n useState<HTMLElement | null>(null);\n const [popperElement, setPopperElement] = useState<HTMLElement | null>(\n null\n );\n const [popperMaxSize, setPopperMaxSize] = useState<{\n width?: number;\n height?: number;\n }>({});\n\n const handleDropdownHeaderRefProp = useForkRef(\n dropdownHeaderRefProp,\n dropdownHeaderProps?.ref\n );\n const handleDropdownHeaderRef = useForkRef(\n setReferenceElement,\n handleDropdownHeaderRefProp\n );\n\n const ariaRole = role || (component == null ? \"combobox\" : undefined);\n\n const ariaExpanded = ariaExpandedProp ?? (ariaRole ? !!isOpen : undefined);\n\n const id = useUniqueId(idProp, \"hvbasedropdown\");\n const containerId = setId(id, \"children-container\");\n\n const headerControlArias = {\n \"aria-required\": required ?? undefined,\n \"aria-readonly\": readOnly ?? undefined,\n \"aria-disabled\": disabled ?? undefined,\n\n \"aria-expanded\": ariaExpanded,\n \"aria-owns\": isOpen ? containerId : undefined,\n \"aria-controls\": isOpen ? containerId : undefined,\n } satisfies AriaAttributes;\n\n const headerAriaLabels = {\n \"aria-label\": ariaLabelProp,\n \"aria-labelledby\": ariaLabelledByProp,\n } satisfies AriaAttributes;\n\n const placement: PopperPlacementType = `bottom-${\n placementProp === \"right\" ? \"start\" : \"end\"\n }`;\n\n const extensionWidth = referenceElement\n ? referenceElement?.offsetWidth\n : \"inherit\";\n\n const { modifiers: popperPropsModifiers = [], ...otherPopperProps } =\n popperProps;\n\n const onFirstUpdate = useCallback(() => {\n onContainerCreation?.(popperElement);\n }, [onContainerCreation, popperElement]);\n\n const widthCalculator = useCallback(\n ({ state }: ModifierArguments<Options>) => {\n state.styles.popper.width = `${state.rects.reference.width}px`;\n },\n []\n );\n\n const widthCalculatorEffect = useCallback(\n ({ state }: ModifierArguments<Options>) => {\n state.elements.popper.style.width = `${\n (state.elements.reference as any).offsetWidth\n }px`;\n },\n []\n );\n\n const applyMaxSizeCalculator = useCallback(\n ({ state }: ModifierArguments<Options>) => {\n // The `maxSize` modifier provides this data\n const { width, height } = state.modifiersData.maxSize;\n if (\n width !== popperMaxSize?.width ||\n height !== popperMaxSize?.height\n ) {\n setPopperMaxSize({ width, height });\n }\n\n state.styles.popper = {\n ...state.styles.popper,\n maxWidth: `${width}px`,\n maxHeight: `${height}px`,\n };\n },\n [popperMaxSize]\n );\n\n const maxSizeCalculator = useCallback(\n ({ state, name, options }: ModifierArguments<Options>) => {\n const overflow = detectOverflow(state, options);\n\n const x = state.modifiersData.preventOverflow?.x || 0;\n const y = state.modifiersData.preventOverflow?.y || 0;\n\n const popperWidth = state.rects.popper.width;\n const popperHeight = state.rects.popper.height;\n\n const basePlacement = state.placement.split(\"-\")[0];\n\n const widthProp = basePlacement === \"left\" ? \"left\" : \"right\";\n const heightProp = basePlacement === \"top\" ? \"top\" : \"bottom\";\n\n state.modifiersData[name] = {\n width: popperWidth - overflow[widthProp] - x,\n height: popperHeight - overflow[heightProp] - y,\n };\n },\n []\n );\n\n const modifiers = useMemo<PopperProps[\"modifiers\"]>(\n () => [\n {\n name: \"variableWidth\",\n enabled: !variableWidth,\n phase: \"beforeWrite\",\n requires: [\"computeStyles\"],\n fn: widthCalculator,\n effect: widthCalculatorEffect,\n },\n {\n name: \"maxSize\",\n enabled: true,\n phase: \"main\",\n requiresIfExists: [\"offset\", \"preventOverflow\", \"flip\"],\n fn: maxSizeCalculator,\n },\n {\n name: \"applyMaxSize\",\n enabled: true,\n phase: \"beforeWrite\",\n requires: [\"maxSize\"],\n fn: applyMaxSizeCalculator,\n },\n ...popperPropsModifiers,\n ],\n [\n maxSizeCalculator,\n applyMaxSizeCalculator,\n popperPropsModifiers,\n variableWidth,\n widthCalculator,\n widthCalculatorEffect,\n ]\n );\n\n const { styles: popperStyles, attributes } = usePopper(\n referenceElement,\n popperElement,\n {\n placement,\n modifiers,\n onFirstUpdate,\n ...otherPopperProps,\n }\n );\n\n const popperPlacement =\n attributes.popper?.[\"data-popper-placement\"] ?? \"bottom\";\n\n const handleToggle = useCallback(\n (event: any) => {\n if (event && !isKey(event, \"Tab\")) {\n event.preventDefault();\n }\n\n const notControlKey =\n !!event?.code &&\n !isOneOfKeys(event, [\"Tab\", \"Enter\", \"Esc\", \"ArrowDown\", \"Space\"]);\n\n const ignoredCombinations =\n (isKey(event, \"Esc\") && !isOpen) ||\n (isKey(event, \"ArrowDown\") && isOpen) ||\n (isKey(event, \"Tab\") && !isOpen);\n\n if (disabled || notControlKey || ignoredCombinations) return;\n\n const newOpen = !isOpen;\n\n /* If about to close focus on the header component. */\n setIsOpen(() => {\n if (!newOpen) {\n // Focus-ring won't be visible even if using the keyboard:\n // https://github.com/WICG/focus-visible/issues/88\n referenceElement?.focus({ preventScroll: true });\n }\n\n return newOpen;\n });\n\n onToggle?.(event, newOpen);\n },\n [isOpen, disabled, setIsOpen, onToggle, referenceElement]\n );\n\n const ExpanderComponent = isOpen ? DropUpXS : DropDownXS;\n\n const defaultHeaderElement = (\n <div\n id={setId(id, \"header\")}\n className={cx(classes.header, {\n [classes.headerDisabled]: disabled,\n [classes.headerReadOnly]: readOnly,\n [classes.headerOpen]: isOpen,\n [classes.headerOpenUp]: isOpen && popperPlacement.includes(\"top\"),\n [classes.headerOpenDown]:\n isOpen && popperPlacement.includes(\"bottom\"),\n })}\n // TODO: review \"textbox\" role\n role={ariaRole === \"combobox\" ? \"textbox\" : undefined}\n {...headerAriaLabels}\n style={disabled || readOnly ? { pointerEvents: \"none\" } : undefined}\n // Removes the element from the navigation sequence for keyboard focus if disabled\n tabIndex={disabled ? -1 : 0}\n ref={handleDropdownHeaderRef}\n {...dropdownHeaderProps}\n >\n <div className={classes.selection}>\n {placeholder && typeof placeholder === \"string\" ? (\n <HvTypography\n className={cx(classes.placeholder, {\n [classes.selectionDisabled]: disabled,\n })}\n variant=\"body\"\n >\n {placeholder}\n </HvTypography>\n ) : (\n placeholder\n )}\n </div>\n <div className={classes.arrowContainer}>\n {adornment || (\n <ExpanderComponent\n iconSize=\"XS\"\n color={disabled ? \"secondary_60\" : undefined}\n className={classes.arrow}\n />\n )}\n </div>\n </div>\n );\n\n const headerElement =\n component && React.isValidElement(component)\n ? React.cloneElement(component as React.ReactElement, {\n ref: handleDropdownHeaderRef,\n ...headerControlArias,\n })\n : defaultHeaderElement;\n\n const containerComponent = (() => {\n /**\n * Handle keyboard inside children container.\n */\n const handleContainerKeyDown: KeyboardEventHandler = (event) => {\n if (isKey(event, \"Esc\")) {\n handleToggle(event);\n }\n if (isKey(event, \"Tab\") && !event.shiftKey) {\n const focusList = getFirstAndLastFocus(popperElement);\n if (document.activeElement === focusList?.last) {\n event.preventDefault();\n focusList?.first?.focus();\n }\n }\n };\n\n const handleOutside: ClickAwayListenerProps[\"onClickAway\"] = (event) => {\n const isButtonClick = referenceElement?.contains(event.target as any);\n if (!isButtonClick) {\n onClickOutside?.(event);\n setIsOpen(false);\n onToggle?.(event, false);\n }\n };\n\n const container = (\n <div\n ref={setPopperElement}\n className={classes.container}\n style={popperStyles.popper}\n {...attributes.popper}\n >\n <ClickAwayListener onClickAway={handleOutside}>\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div onKeyDown={handleContainerKeyDown}>\n {popperPlacement.includes(\"bottom\") && (\n <div\n style={{ width: extensionWidth }}\n className={cx(classes.inputExtensionOpen, {\n [classes.inputExtensionLeftPosition]:\n popperPlacement.includes(\"end\"),\n })}\n />\n )}\n <BaseDropdownContext.Provider value={popperMaxSize}>\n <div\n id={containerId}\n className={cx(classes.panel, {\n [classes.panelOpenedUp]: popperPlacement.includes(\"top\"),\n [classes.panelOpenedDown]:\n popperPlacement.includes(\"bottom\"),\n })}\n >\n {children}\n </div>\n </BaseDropdownContext.Provider>\n {popperPlacement.includes(\"top\") && (\n <div\n style={{ width: extensionWidth }}\n className={cx(\n classes.inputExtensionOpen,\n classes.inputExtensionOpenShadow,\n {\n [classes.inputExtensionFloatRight]:\n popperPlacement.includes(\"end\"),\n [classes.inputExtensionFloatLeft]:\n popperPlacement.includes(\"start\"),\n }\n )}\n />\n )}\n </div>\n </ClickAwayListener>\n </div>\n );\n\n if (disablePortal) return container;\n\n return createPortal(\n container,\n document.getElementById(rootId || \"\") || document.body\n );\n })();\n\n return (\n <div className={classes.root}>\n <div\n ref={ref}\n id={id}\n className={cx(\n classes.anchor,\n { [classes.rootDisabled]: disabled },\n className\n )}\n {...(!readOnly && {\n onKeyDown: handleToggle,\n onClick: handleToggle,\n })}\n {...(ariaRole && {\n role: ariaRole,\n ...headerAriaLabels,\n ...headerControlArias,\n })}\n // Removes the element from the navigation sequence for keyboard focus\n tabIndex={-1}\n {...others}\n >\n {headerElement}\n </div>\n {isOpen && containerComponent}\n </div>\n );\n }\n);\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;AAkIO,MAAM,iBAAiB;AAAA,EAC5B,CAAC,OAAO,QAAQ;AACR,UAAA;AAAA,MACJ,IAAI;AAAA,MACJ;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,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E,CAAC,QAAQ,YAAY,GAAG,SAAS;AAAA,YACnC;AAAA,UACF;AAAA,UACC,GAAI,CAAC,YAAY;AAAA,YAChB,WAAW;AAAA,YACX,SAAS;AAAA,UACX;AAAA,UACC,GAAI,YAAY;AAAA,YACf,MAAM;AAAA,YACN,GAAG;AAAA,YACH,GAAG;AAAA,UACL;AAAA,UAEA,UAAU;AAAA,UACT,GAAG;AAAA,UAEH,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,MACC,UAAU;AAAA,IACb,EAAA,CAAA;AAAA,EAEJ;AACF;"}
1
+ {"version":3,"file":"BaseDropdown.js","sources":["../../../src/BaseDropdown/BaseDropdown.tsx"],"sourcesContent":["import React, {\n useMemo,\n useState,\n useCallback,\n KeyboardEventHandler,\n AriaAttributes,\n forwardRef,\n} from \"react\";\n\nimport { createPortal } from \"react-dom\";\n\nimport ClickAwayListener, {\n ClickAwayListenerProps,\n} from \"@mui/material/ClickAwayListener\";\nimport { DropDownXS, DropUpXS } from \"@hitachivantara/uikit-react-icons\";\n\nimport { PopperProps, usePopper } from \"react-popper\";\nimport {\n detectOverflow,\n ModifierArguments,\n Options,\n Placement,\n} from \"@popperjs/core\";\n\nimport { HvTypography } from \"../Typography\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { useTheme } from \"../hooks/useTheme\";\nimport { useForkRef } from \"../hooks/useForkRef\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { isKey, isOneOfKeys } from \"../utils/keyboardUtils\";\nimport { setId } from \"../utils/setId\";\nimport { getFirstAndLastFocus } from \"../utils/focusableElementFinder\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\n\nimport { staticClasses, useClasses } from \"./BaseDropdown.styles\";\nimport BaseDropdownContext from \"./BaseDropdownContext\";\n\nexport { staticClasses as baseDropdownClasses };\n\nexport type HvBaseDropdownClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvBaseDropdownProps extends HvBaseProps {\n /**\n * The role of the element that triggers the popup.\n *\n * Defaults to \"combobox\" if `component` and the default\n * \"textbox\" header is used, undefined otherwise.\n */\n role?: string;\n /**\n * Header placeholder.\n */\n placeholder?: React.ReactNode;\n /**\n * If `true` the dropdown is disabled unable to be interacted, if `false` it is enabled.\n */\n disabled?: boolean;\n /**\n * If `true` the dropdown will be in read only mode, unable to be interacted.\n */\n readOnly?: boolean;\n /**\n * Indicates that user input is required on the form element.\n */\n required?: boolean;\n /**\n * Disable the portal behavior.\n * The children stay within it's parent DOM hierarchy.\n */\n disablePortal?: boolean;\n /**\n * If `true` the dropdown width depends size of content if `false` the width depends on the header size.\n * Defaults to `false`.\n */\n variableWidth?: boolean;\n /**\n * If `true` the dropdown starts opened if `false` it starts closed.\n */\n expanded?: boolean;\n /**\n * When uncontrolled, defines the initial expanded state.\n */\n defaultExpanded?: boolean;\n /**\n * An object containing props to be wired to the popper component.\n */\n popperProps?: Partial<PopperProps<any>>;\n /**\n * Placement of the dropdown.\n */\n placement?: \"left\" | \"right\";\n /**\n * Replacement for the header component.\n */\n component?: React.ReactNode;\n /**\n * Adornment to replace the default arrows.\n */\n adornment?: React.ReactNode;\n /**\n * When dropdown changes the expanded state.\n */\n onToggle?: (event: Event, open: boolean) => void;\n /**\n * When user click outside the open container.\n */\n onClickOutside?: (event: Event) => void;\n /**\n * Callback called when the dropdown is opened and ready,\n * commonly used to set focus to the content.\n */\n onContainerCreation?: (container: HTMLElement | null) => void;\n /**\n * Attributes applied to the dropdown header element.\n */\n dropdownHeaderProps?: React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n >;\n /**\n * Pass a ref to the dropdown header element.\n */\n dropdownHeaderRef?: React.Ref<HTMLDivElement>;\n /**\n * A Jss Object used to override or extend the component styles applied.\n */\n classes?: HvBaseDropdownClasses;\n /** @ignore */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport const HvBaseDropdown = forwardRef<HTMLDivElement, HvBaseDropdownProps>(\n (props, ref) => {\n const {\n id: idProp,\n className,\n classes: classesProp,\n children,\n role,\n placeholder,\n component,\n adornment,\n expanded,\n dropdownHeaderProps,\n defaultExpanded,\n disabled,\n readOnly,\n required,\n disablePortal,\n variableWidth,\n placement: placementProp = \"right\",\n \"aria-expanded\": ariaExpandedProp,\n \"aria-label\": ariaLabelProp,\n \"aria-labelledby\": ariaLabelledByProp,\n popperProps = {},\n dropdownHeaderRef: dropdownHeaderRefProp,\n onToggle,\n onClickOutside,\n onContainerCreation,\n ...others\n } = useDefaultProps(\"HvBaseDropdown\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const { rootId } = useTheme();\n\n const [isOpen, setIsOpen] = useControlled(\n expanded,\n Boolean(defaultExpanded)\n );\n\n const [referenceElement, setReferenceElement] =\n useState<HTMLElement | null>(null);\n const [popperElement, setPopperElement] = useState<HTMLElement | null>(\n null\n );\n const [popperMaxSize, setPopperMaxSize] = useState<{\n width?: number;\n height?: number;\n }>({});\n\n const handleDropdownHeaderRefProp = useForkRef(\n dropdownHeaderRefProp,\n dropdownHeaderProps?.ref\n );\n const handleDropdownHeaderRef = useForkRef(\n setReferenceElement,\n handleDropdownHeaderRefProp\n );\n\n const ariaRole = role || (component == null ? \"combobox\" : undefined);\n\n const ariaExpanded = ariaExpandedProp ?? (ariaRole ? !!isOpen : undefined);\n\n const id = useUniqueId(idProp, \"hvbasedropdown\");\n const containerId = setId(id, \"children-container\");\n\n const headerControlArias = {\n \"aria-required\": required ?? undefined,\n \"aria-readonly\": readOnly ?? undefined,\n \"aria-disabled\": disabled ?? undefined,\n\n \"aria-expanded\": ariaExpanded,\n \"aria-owns\": isOpen ? containerId : undefined,\n \"aria-controls\": isOpen ? containerId : undefined,\n } satisfies AriaAttributes;\n\n const headerAriaLabels = {\n \"aria-label\": ariaLabelProp,\n \"aria-labelledby\": ariaLabelledByProp,\n } satisfies AriaAttributes;\n\n const placement: Placement = `bottom-${\n placementProp === \"right\" ? \"start\" : \"end\"\n }`;\n\n const extensionWidth = referenceElement\n ? referenceElement?.offsetWidth\n : \"inherit\";\n\n const { modifiers: popperPropsModifiers = [], ...otherPopperProps } =\n popperProps;\n\n const onFirstUpdate = useCallback(() => {\n onContainerCreation?.(popperElement);\n }, [onContainerCreation, popperElement]);\n\n const widthCalculator = useCallback(\n ({ state }: ModifierArguments<Options>) => {\n state.styles.popper.width = `${state.rects.reference.width}px`;\n },\n []\n );\n\n const widthCalculatorEffect = useCallback(\n ({ state }: ModifierArguments<Options>) => {\n state.elements.popper.style.width = `${\n (state.elements.reference as any).offsetWidth\n }px`;\n },\n []\n );\n\n const applyMaxSizeCalculator = useCallback(\n ({ state }: ModifierArguments<Options>) => {\n // The `maxSize` modifier provides this data\n const { width, height } = state.modifiersData.maxSize;\n if (\n width !== popperMaxSize?.width ||\n height !== popperMaxSize?.height\n ) {\n setPopperMaxSize({ width, height });\n }\n\n state.styles.popper = {\n ...state.styles.popper,\n maxWidth: `${width}px`,\n maxHeight: `${height}px`,\n };\n },\n [popperMaxSize]\n );\n\n const maxSizeCalculator = useCallback(\n ({ state, name, options }: ModifierArguments<Options>) => {\n const overflow = detectOverflow(state, options);\n\n const x = state.modifiersData.preventOverflow?.x || 0;\n const y = state.modifiersData.preventOverflow?.y || 0;\n\n const popperWidth = state.rects.popper.width;\n const popperHeight = state.rects.popper.height;\n\n const basePlacement = state.placement.split(\"-\")[0];\n\n const widthProp = basePlacement === \"left\" ? \"left\" : \"right\";\n const heightProp = basePlacement === \"top\" ? \"top\" : \"bottom\";\n\n state.modifiersData[name] = {\n width: popperWidth - overflow[widthProp] - x,\n height: popperHeight - overflow[heightProp] - y,\n };\n },\n []\n );\n\n const modifiers = useMemo<Options[\"modifiers\"]>(\n () => [\n {\n name: \"variableWidth\",\n enabled: !variableWidth,\n phase: \"beforeWrite\",\n requires: [\"computeStyles\"],\n fn: widthCalculator,\n effect: widthCalculatorEffect,\n },\n {\n name: \"maxSize\",\n enabled: true,\n phase: \"main\",\n requiresIfExists: [\"offset\", \"preventOverflow\", \"flip\"],\n fn: maxSizeCalculator,\n },\n {\n name: \"applyMaxSize\",\n enabled: true,\n phase: \"beforeWrite\",\n requires: [\"maxSize\"],\n fn: applyMaxSizeCalculator,\n },\n ...popperPropsModifiers,\n ],\n [\n maxSizeCalculator,\n applyMaxSizeCalculator,\n popperPropsModifiers,\n variableWidth,\n widthCalculator,\n widthCalculatorEffect,\n ]\n );\n\n const { styles: popperStyles, attributes } = usePopper(\n referenceElement,\n popperElement,\n {\n placement,\n modifiers,\n onFirstUpdate,\n ...otherPopperProps,\n }\n );\n\n const popperPlacement =\n (attributes.popper?.[\"data-popper-placement\"] as Placement) ?? \"bottom\";\n\n const handleToggle = useCallback(\n (event: any) => {\n if (event && !isKey(event, \"Tab\")) {\n event.preventDefault();\n }\n\n const notControlKey =\n !!event?.code &&\n !isOneOfKeys(event, [\"Tab\", \"Enter\", \"Esc\", \"ArrowDown\", \"Space\"]);\n\n const ignoredCombinations =\n (isKey(event, \"Esc\") && !isOpen) ||\n (isKey(event, \"ArrowDown\") && isOpen) ||\n (isKey(event, \"Tab\") && !isOpen);\n\n if (disabled || notControlKey || ignoredCombinations) return;\n\n const newOpen = !isOpen;\n\n /* If about to close focus on the header component. */\n setIsOpen(() => {\n if (!newOpen) {\n // Focus-ring won't be visible even if using the keyboard:\n // https://github.com/WICG/focus-visible/issues/88\n referenceElement?.focus({ preventScroll: true });\n }\n\n return newOpen;\n });\n\n onToggle?.(event, newOpen);\n },\n [isOpen, disabled, setIsOpen, onToggle, referenceElement]\n );\n\n const ExpanderComponent = isOpen ? DropUpXS : DropDownXS;\n\n const defaultHeaderElement = (\n <div\n id={setId(id, \"header\")}\n className={cx(classes.header, {\n [classes.headerDisabled]: disabled,\n [classes.headerReadOnly]: readOnly,\n [classes.headerOpen]: isOpen,\n [classes.headerOpenUp]: isOpen && popperPlacement.includes(\"top\"),\n [classes.headerOpenDown]:\n isOpen && popperPlacement.includes(\"bottom\"),\n })}\n // TODO: review \"textbox\" role\n role={ariaRole === \"combobox\" ? \"textbox\" : undefined}\n {...headerAriaLabels}\n style={disabled || readOnly ? { pointerEvents: \"none\" } : undefined}\n // Removes the element from the navigation sequence for keyboard focus if disabled\n tabIndex={disabled ? -1 : 0}\n ref={handleDropdownHeaderRef}\n {...dropdownHeaderProps}\n >\n <div className={classes.selection}>\n {placeholder && typeof placeholder === \"string\" ? (\n <HvTypography\n className={cx(classes.placeholder, {\n [classes.selectionDisabled]: disabled,\n })}\n variant=\"body\"\n >\n {placeholder}\n </HvTypography>\n ) : (\n placeholder\n )}\n </div>\n <div className={classes.arrowContainer}>\n {adornment || (\n <ExpanderComponent\n iconSize=\"XS\"\n color={disabled ? \"secondary_60\" : undefined}\n className={classes.arrow}\n />\n )}\n </div>\n </div>\n );\n\n const headerElement =\n component && React.isValidElement(component)\n ? React.cloneElement(component as React.ReactElement, {\n ref: handleDropdownHeaderRef,\n ...headerControlArias,\n })\n : defaultHeaderElement;\n\n const containerComponent = (() => {\n /**\n * Handle keyboard inside children container.\n */\n const handleContainerKeyDown: KeyboardEventHandler = (event) => {\n if (isKey(event, \"Esc\")) {\n handleToggle(event);\n }\n if (isKey(event, \"Tab\") && !event.shiftKey) {\n const focusList = getFirstAndLastFocus(popperElement);\n if (document.activeElement === focusList?.last) {\n event.preventDefault();\n focusList?.first?.focus();\n }\n }\n };\n\n const handleOutside: ClickAwayListenerProps[\"onClickAway\"] = (event) => {\n const isButtonClick = referenceElement?.contains(event.target as any);\n if (!isButtonClick) {\n onClickOutside?.(event);\n setIsOpen(false);\n onToggle?.(event, false);\n }\n };\n\n const container = (\n <div\n ref={setPopperElement}\n className={classes.container}\n style={popperStyles.popper}\n {...attributes.popper}\n >\n <ClickAwayListener onClickAway={handleOutside}>\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div onKeyDown={handleContainerKeyDown}>\n {popperPlacement.includes(\"bottom\") && (\n <div\n style={{ width: extensionWidth }}\n className={cx(classes.inputExtensionOpen, {\n [classes.inputExtensionLeftPosition]:\n popperPlacement.includes(\"end\"),\n })}\n />\n )}\n <BaseDropdownContext.Provider value={popperMaxSize}>\n <div\n id={containerId}\n className={cx(classes.panel, {\n [classes.panelOpenedUp]: popperPlacement.includes(\"top\"),\n [classes.panelOpenedDown]:\n popperPlacement.includes(\"bottom\"),\n })}\n >\n {children}\n </div>\n </BaseDropdownContext.Provider>\n {popperPlacement.includes(\"top\") && (\n <div\n style={{ width: extensionWidth }}\n className={cx(\n classes.inputExtensionOpen,\n classes.inputExtensionOpenShadow,\n {\n [classes.inputExtensionFloatRight]:\n popperPlacement.includes(\"end\"),\n [classes.inputExtensionFloatLeft]:\n popperPlacement.includes(\"start\"),\n }\n )}\n />\n )}\n </div>\n </ClickAwayListener>\n </div>\n );\n\n if (disablePortal) return container;\n\n return createPortal(\n container,\n document.getElementById(rootId || \"\") || document.body\n );\n })();\n\n return (\n <div className={classes.root}>\n <div\n ref={ref}\n id={id}\n className={cx(\n classes.anchor,\n { [classes.rootDisabled]: disabled },\n className\n )}\n {...(!readOnly && {\n onKeyDown: handleToggle,\n onClick: handleToggle,\n })}\n {...(ariaRole && {\n role: ariaRole,\n ...headerAriaLabels,\n ...headerControlArias,\n })}\n // Removes the element from the navigation sequence for keyboard focus\n tabIndex={-1}\n {...others}\n >\n {headerElement}\n </div>\n {isOpen && containerComponent}\n </div>\n );\n }\n);\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;AAqIO,MAAM,iBAAiB;AAAA,EAC5B,CAAC,OAAO,QAAQ;AACR,UAAA;AAAA,MACJ,IAAI;AAAA,MACJ;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW,gBAAgB;AAAA,MAC3B,iBAAiB;AAAA,MACjB,c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