@lumx/react 2.1.6-alpha.3 → 2.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/esm/_internal/Lightbox2.js +10 -4
  2. package/esm/_internal/Lightbox2.js.map +1 -1
  3. package/esm/_internal/List2.js.map +1 -1
  4. package/esm/_internal/TextField.js +2 -2
  5. package/esm/_internal/TextField.js.map +1 -1
  6. package/esm/_internal/UserBlock.js +1 -0
  7. package/esm/_internal/UserBlock.js.map +1 -1
  8. package/package.json +10 -15
  9. package/src/components/alert-dialog/AlertDialog.stories.tsx +9 -2
  10. package/src/components/autocomplete/AutocompleteMultiple.stories.tsx +1 -1
  11. package/src/components/avatar/__snapshots__/Avatar.test.tsx.snap +30 -30
  12. package/src/components/comment-block/__snapshots__/CommentBlock.test.tsx.snap +1 -1
  13. package/src/components/dialog/Dialog.stories.tsx +9 -2
  14. package/src/components/image-block/ImageBlock.stories.tsx +2 -2
  15. package/src/components/image-block/__snapshots__/ImageBlock.test.tsx.snap +1 -1
  16. package/src/components/lightbox/Lightbox.stories.tsx +82 -0
  17. package/src/components/lightbox/Lightbox.tsx +12 -4
  18. package/src/components/mosaic/__snapshots__/Mosaic.test.tsx.snap +18 -18
  19. package/src/components/notification/Notifications.stories.tsx +16 -10
  20. package/src/components/skeleton/SkeletonCircle.stories.tsx +1 -1
  21. package/src/components/skeleton/SkeletonRectangle.stories.tsx +1 -1
  22. package/src/components/skeleton/SkeletonTypography.stories.tsx +1 -1
  23. package/src/components/slideshow/__snapshots__/Slideshow.test.tsx.snap +12 -12
  24. package/src/components/text-field/TextField.stories.tsx +30 -0
  25. package/src/components/text-field/TextField.tsx +11 -9
  26. package/src/components/thumbnail/Thumbnail.stories.tsx +2 -2
  27. package/src/components/thumbnail/__snapshots__/Thumbnail.test.tsx.snap +5 -5
  28. package/src/components/user-block/UserBlock.stories.tsx +4 -1
  29. package/src/components/user-block/UserBlock.tsx +1 -0
  30. package/src/components/user-block/__snapshots__/UserBlock.test.tsx.snap +10 -10
  31. package/src/stories/chromaticForceScreenSize.tsx +7 -0
  32. package/src/stories/generated/Autocomplete/Demos.stories.tsx +1 -1
  33. package/src/stories/generated/Avatar/Demos.stories.tsx +1 -1
  34. package/src/stories/generated/Badge/Demos.stories.tsx +1 -1
  35. package/src/stories/generated/Button/Demos.stories.tsx +1 -1
  36. package/src/stories/generated/Checkbox/Demos.stories.tsx +1 -1
  37. package/src/stories/generated/Chip/Demos.stories.tsx +1 -1
  38. package/src/stories/generated/CommentBlock/Demos.stories.tsx +1 -1
  39. package/src/stories/generated/DatePicker/Demos.stories.tsx +1 -1
  40. package/src/stories/generated/Dialog/Demos.stories.tsx +1 -1
  41. package/src/stories/generated/Divider/Demos.stories.tsx +1 -1
  42. package/src/stories/generated/Dropdown/Demos.stories.tsx +1 -1
  43. package/src/stories/generated/ExpansionPanel/Demos.stories.tsx +1 -1
  44. package/src/stories/generated/Icon/Demos.stories.tsx +1 -1
  45. package/src/stories/generated/ImageBlock/Demos.stories.tsx +1 -1
  46. package/src/stories/generated/Lightbox/Demos.stories.tsx +1 -1
  47. package/src/stories/generated/Link/Demos.stories.tsx +1 -1
  48. package/src/stories/generated/LinkPreview/Demos.stories.tsx +1 -1
  49. package/src/stories/generated/List/Demos.stories.tsx +1 -1
  50. package/src/stories/generated/Message/Demos.stories.tsx +1 -1
  51. package/src/stories/generated/Mosaic/Demos.stories.tsx +1 -1
  52. package/src/stories/generated/Notification/Demos.stories.tsx +1 -1
  53. package/src/stories/generated/Popover/Demos.stories.tsx +1 -1
  54. package/src/stories/generated/PostBlock/Demos.stories.tsx +1 -1
  55. package/src/stories/generated/Progress/Demos.stories.tsx +1 -1
  56. package/src/stories/generated/ProgressTracker/Demos.stories.tsx +1 -1
  57. package/src/stories/generated/RadioButton/Demos.stories.tsx +1 -1
  58. package/src/stories/generated/Select/Demos.stories.tsx +1 -1
  59. package/src/stories/generated/SideNavigation/Demos.stories.tsx +1 -1
  60. package/src/stories/generated/Skeleton/Demos.stories.tsx +1 -1
  61. package/src/stories/generated/Slider/Demos.stories.tsx +1 -1
  62. package/src/stories/generated/Slideshow/Demos.stories.tsx +1 -1
  63. package/src/stories/generated/Switch/Demos.stories.tsx +1 -1
  64. package/src/stories/generated/Table/Demos.stories.tsx +1 -1
  65. package/src/stories/generated/Tabs/Demos.stories.tsx +1 -1
  66. package/src/stories/generated/TextField/Demos.stories.tsx +1 -1
  67. package/src/stories/generated/Thumbnail/Demos.stories.tsx +1 -1
  68. package/src/stories/generated/Toolbar/Demos.stories.tsx +1 -1
  69. package/src/stories/generated/Tooltip/Demos.stories.tsx +1 -1
  70. package/src/stories/generated/Uploader/Demos.stories.tsx +1 -1
  71. package/src/stories/generated/UserBlock/Demos.stories.tsx +1 -1
  72. package/src/stories/knobs/enumKnob.ts +1 -1
  73. package/src/stories/knobs/image.ts +12 -12
  74. package/src/untypped-modules.d.ts +2 -0
@@ -4,7 +4,6 @@ import React, { forwardRef, useRef } from 'react';
4
4
  import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './getRootClassName.js';
5
5
  import { d as mdiClose } from './mdi.js';
6
6
  import { D as DOCUMENT } from './constants.js';
7
- import { u as useFocus } from './Popover2.js';
8
7
  import { m as mergeRefs } from './mergeRefs.js';
9
8
  import { I as IconButton } from './IconButton.js';
10
9
  import { u as useFocusTrap } from './useFocusTrap.js';
@@ -65,10 +64,17 @@ var Lightbox = forwardRef(function (props, ref) {
65
64
  var isVisible = useDelayedVisibility(!!isOpen, LIGHTBOX_TRANSITION_DURATION); // Handle focus trap.
66
65
  // eslint-disable-next-line react-hooks/rules-of-hooks
67
66
 
68
- useFocusTrap(wrapperRef.current, (_childrenRef$current = childrenRef.current) === null || _childrenRef$current === void 0 ? void 0 : _childrenRef$current.firstChild); // Focus the parent element on close.
69
- // eslint-disable-next-line react-hooks/rules-of-hooks
67
+ useFocusTrap(wrapperRef.current, (_childrenRef$current = childrenRef.current) === null || _childrenRef$current === void 0 ? void 0 : _childrenRef$current.firstChild);
68
+ var previousOpen = React.useRef(isOpen);
69
+ React.useEffect(function () {
70
+ if (isOpen !== previousOpen.current) {
71
+ previousOpen.current = isOpen; // Focus the parent element on close.
70
72
 
71
- useFocus(parentElement === null || parentElement === void 0 ? void 0 : parentElement.current, !isOpen); // Close lightbox on escape key pressed.
73
+ if (!isOpen && parentElement && parentElement.current) {
74
+ parentElement.current.focus();
75
+ }
76
+ }
77
+ }, [isOpen, parentElement]); // Close lightbox on escape key pressed.
72
78
  // eslint-disable-next-line react-hooks/rules-of-hooks
73
79
 
74
80
  useCallbackOnEscape(onClose); // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -1 +1 @@
1
- {"version":3,"file":"Lightbox2.js","sources":["../../../src/components/lightbox/Lightbox.tsx"],"sourcesContent":["import React, { forwardRef, RefObject, useRef } from 'react';\n\nimport classNames from 'classnames';\nimport { createPortal } from 'react-dom';\n\nimport { mdiClose } from '@lumx/icons';\nimport { ColorPalette, Emphasis, IconButton, IconButtonProps, Theme } from '@lumx/react';\nimport { DOCUMENT } from '@lumx/react/constants';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';\nimport { useDelayedVisibility } from '@lumx/react/hooks/useDelayedVisibility';\nimport { useFocus } from '@lumx/react/hooks/useFocus';\nimport { useDisableBodyScroll } from '@lumx/react/hooks/useDisableBodyScroll';\nimport { ClickAwayProvider } from '@lumx/react/utils/ClickAwayProvider';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\nimport { useCallbackOnEscape } from '@lumx/react/hooks/useCallbackOnEscape';\n\nconst LIGHTBOX_TRANSITION_DURATION = 400;\n\n/**\n * Defines the props of the component.\n */\nexport interface LightboxProps extends GenericProps {\n /** Props to pass to the close button (minus those already set by the Lightbox props). */\n closeButtonProps?: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Reference to the element that triggered modal opening to set focus on. */\n parentElement: RefObject<any>;\n /** Whether to keep the dialog open on clickaway or escape press. */\n preventAutoClose?: boolean;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Z-axis position. */\n zIndex?: number;\n /** On close callback. */\n onClose?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Lightbox';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Lightbox component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Lightbox: Comp<LightboxProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n ariaLabel,\n children,\n className,\n closeButtonProps,\n isOpen,\n onClose,\n parentElement,\n preventAutoClose,\n theme,\n zIndex,\n ...forwardedProps\n } = props;\n if (!DOCUMENT) {\n // Can't render in SSR.\n return null;\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const childrenRef = useRef<any>(null);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useDisableBodyScroll(isOpen && wrapperRef.current);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const isVisible = useDelayedVisibility(!!isOpen, LIGHTBOX_TRANSITION_DURATION);\n\n // Handle focus trap.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useFocusTrap(wrapperRef.current, childrenRef.current?.firstChild);\n\n // Focus the parent element on close.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useFocus(parentElement?.current, !isOpen);\n\n // Close lightbox on escape key pressed.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useCallbackOnEscape(onClose);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const clickAwayRefs = useRef([wrapperRef]);\n\n if (!isOpen && !isVisible) return null;\n\n return createPortal(\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */\n <div\n ref={mergeRefs(ref, wrapperRef)}\n {...forwardedProps}\n aria-label={ariaLabel}\n aria-modal=\"true\"\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n isHidden: !isOpen,\n isShown: isOpen || isVisible,\n theme,\n }),\n )}\n style={{ zIndex }}\n >\n {closeButtonProps && (\n <IconButton\n {...closeButtonProps}\n className={`${CLASSNAME}__close`}\n color={ColorPalette.light}\n emphasis={Emphasis.low}\n icon={mdiClose}\n theme={theme}\n type=\"button\"\n onClick={onClose}\n />\n )}\n <ClickAwayProvider callback={!preventAutoClose && onClose} refs={clickAwayRefs}>\n <div ref={childrenRef} className={`${CLASSNAME}__wrapper`} role=\"presentation\">\n {children}\n </div>\n </ClickAwayProvider>\n </div>,\n document.body,\n );\n});\nLightbox.displayName = COMPONENT_NAME;\nLightbox.className = CLASSNAME;\n"],"names":["LIGHTBOX_TRANSITION_DURATION","COMPONENT_NAME","CLASSNAME","getRootClassName","Lightbox","forwardRef","props","ref","ariaLabel","children","className","closeButtonProps","isOpen","onClose","parentElement","preventAutoClose","theme","zIndex","forwardedProps","DOCUMENT","childrenRef","useRef","wrapperRef","useDisableBodyScroll","current","isVisible","useDelayedVisibility","useFocusTrap","firstChild","useFocus","useCallbackOnEscape","clickAwayRefs","createPortal","mergeRefs","classNames","handleBasicClasses","prefix","isHidden","isShown","ColorPalette","light","Emphasis","low","mdiClose","document","body","displayName"],"mappings":";;;;;;;;;;;;;;;AAkBA,IAAMA,4BAA4B,GAAG,GAArC;AAEA;;;;AAqBA;;;AAGA,IAAMC,cAAc,GAAG,UAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;;;;;IAOaG,QAA6C,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA;;AAAA,MAEhFC,SAFgF,GA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,SAAT,GAAqBR,SAArB;;;;"}
1
+ {"version":3,"file":"Lightbox2.js","sources":["../../../src/components/lightbox/Lightbox.tsx"],"sourcesContent":["import React, { forwardRef, RefObject, useRef } from 'react';\n\nimport classNames from 'classnames';\nimport { createPortal } from 'react-dom';\n\nimport { mdiClose } from '@lumx/icons';\nimport { ColorPalette, Emphasis, IconButton, IconButtonProps, Theme } from '@lumx/react';\nimport { DOCUMENT } from '@lumx/react/constants';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';\nimport { useDelayedVisibility } from '@lumx/react/hooks/useDelayedVisibility';\nimport { useDisableBodyScroll } from '@lumx/react/hooks/useDisableBodyScroll';\nimport { ClickAwayProvider } from '@lumx/react/utils/ClickAwayProvider';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\nimport { useCallbackOnEscape } from '@lumx/react/hooks/useCallbackOnEscape';\n\nconst LIGHTBOX_TRANSITION_DURATION = 400;\n\n/**\n * Defines the props of the component.\n */\nexport interface LightboxProps extends GenericProps {\n /** Props to pass to the close button (minus those already set by the Lightbox props). */\n closeButtonProps?: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Reference to the element that triggered modal opening to set focus on. */\n parentElement: RefObject<any>;\n /** Whether to keep the dialog open on clickaway or escape press. */\n preventAutoClose?: boolean;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Z-axis position. */\n zIndex?: number;\n /** On close callback. */\n onClose?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Lightbox';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Lightbox component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Lightbox: Comp<LightboxProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n ariaLabel,\n children,\n className,\n closeButtonProps,\n isOpen,\n onClose,\n parentElement,\n preventAutoClose,\n theme,\n zIndex,\n ...forwardedProps\n } = props;\n if (!DOCUMENT) {\n // Can't render in SSR.\n return null;\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const childrenRef = useRef<any>(null);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useDisableBodyScroll(isOpen && wrapperRef.current);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const isVisible = useDelayedVisibility(!!isOpen, LIGHTBOX_TRANSITION_DURATION);\n\n // Handle focus trap.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useFocusTrap(wrapperRef.current, childrenRef.current?.firstChild);\n\n const previousOpen = React.useRef(isOpen);\n\n React.useEffect(() => {\n if (isOpen !== previousOpen.current) {\n previousOpen.current = isOpen;\n\n // Focus the parent element on close.\n if (!isOpen && parentElement && parentElement.current) {\n parentElement.current.focus();\n }\n }\n }, [isOpen, parentElement]);\n\n // Close lightbox on escape key pressed.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useCallbackOnEscape(onClose);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const clickAwayRefs = useRef([wrapperRef]);\n\n if (!isOpen && !isVisible) return null;\n\n return createPortal(\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */\n <div\n ref={mergeRefs(ref, wrapperRef)}\n {...forwardedProps}\n aria-label={ariaLabel}\n aria-modal=\"true\"\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n isHidden: !isOpen,\n isShown: isOpen || isVisible,\n theme,\n }),\n )}\n style={{ zIndex }}\n >\n {closeButtonProps && (\n <IconButton\n {...closeButtonProps}\n className={`${CLASSNAME}__close`}\n color={ColorPalette.light}\n emphasis={Emphasis.low}\n icon={mdiClose}\n theme={theme}\n type=\"button\"\n onClick={onClose}\n />\n )}\n <ClickAwayProvider callback={!preventAutoClose && onClose} refs={clickAwayRefs}>\n <div ref={childrenRef} className={`${CLASSNAME}__wrapper`} role=\"presentation\">\n {children}\n </div>\n </ClickAwayProvider>\n </div>,\n document.body,\n );\n});\nLightbox.displayName = COMPONENT_NAME;\nLightbox.className = CLASSNAME;\n"],"names":["LIGHTBOX_TRANSITION_DURATION","COMPONENT_NAME","CLASSNAME","getRootClassName","Lightbox","forwardRef","props","ref","ariaLabel","children","className","closeButtonProps","isOpen","onClose","parentElement","preventAutoClose","theme","zIndex","forwardedProps","DOCUMENT","childrenRef","useRef","wrapperRef","useDisableBodyScroll","current","isVisible","useDelayedVisibility","useFocusTrap","firstChild","previousOpen","React","useEffect","focus","useCallbackOnEscape","clickAwayRefs","createPortal","mergeRefs","classNames","handleBasicClasses","prefix","isHidden","isShown","ColorPalette","light","Emphasis","low","mdiClose","document","body","displayName"],"mappings":";;;;;;;;;;;;;;AAiBA,IAAMA,4BAA4B,GAAG,GAArC;AAEA;;;;AAqBA;;;AAGA,IAAMC,cAAc,GAAG,UAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;;;;;IAOaG,QAA6C,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA;;AAAA,MAEhFC,SAFgF,GAahFF,KAbgF,CAEhFE,SAFgF;AAAA,MAGhFC,QAHgF,GAahFH,KAbgF,CAGhFG,QAHgF;AAAA,MAIhFC,SAJgF,GAahFJ,KAbgF,CAIhFI,SAJgF;AAAA,MAKhFC,gBALgF,GAahFL,KAbgF,CAKhFK,gBALgF;AAAA,MAMhFC,MANgF,GAahFN,KAbgF,CAMhFM,MANgF;AAAA,MAOhFC,OAPgF,GAahFP,KAbgF,CAOhFO,OAPgF;AAAA,MAQhFC,aARgF,GAahFR,KAbgF,CAQhFQ,aARgF;A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":3,"file":"List2.js","sources":["../../../src/hooks/useKeyboardListNavigation.tsx","../../../src/components/list/ListItem.tsx","../../../node_modules/react-is/cjs/react-is.production.min.js","../../../node_modules/react-is/cjs/react-is.development.js","../../../node_modules/react-is/index.js","../../../src/utils/flattenChildren.ts","../../../src/components/list/useInteractiveList.tsx","../../../src/components/list/List.tsx"],"sourcesContent":["import { RefObject, SetStateAction, useEffect, useState } from 'react';\n\nimport get from 'lodash/get';\n\ntype Listener = (evt: KeyboardEvent) => void;\n\ninterface UseKeyboardListNavigationType {\n /** the current active index */\n activeItemIndex: number;\n /** callback to be used when a key is pressed. usually used with the native prop `onKeyDown` */\n onKeyboardNavigation: Listener;\n /** Resets the active index to the initial state */\n resetActiveIndex(): void;\n /** Sets the active index to a given value */\n setActiveItemIndex(value: SetStateAction<number>): void;\n}\n\nexport type useKeyboardListNavigationType = <I>(\n items: I[],\n ref: RefObject<HTMLElement>,\n onListItemSelected: (itemSelected: I) => void,\n onListItemNavigated?: (itemSelected: I) => void,\n onEnterPressed?: (itemSelected: string) => void,\n onBackspacePressed?: Listener,\n keepFocusAfterSelection?: boolean,\n initialIndex?: number,\n preventTabOnEnteredValue?: boolean,\n) => UseKeyboardListNavigationType;\n\nconst INITIAL_INDEX = -1;\n\n/**\n * This custom hook provides the necessary set of functions and values to properly navigate\n * a list using the keyboard.\n *\n * @param items the list of items that will be navigated using the keyboard.\n * @param ref A reference to the element that is controlling the navigation.\n * @param onListItemSelected callback to be executed when the ENTER key is pressed on an item.\n * @param onListItemNavigated callback to be executed when the Arrow keys are pressed.\n * @param onEnterPressed callback to be executed when the ENTER key is pressed.\n * @param onBackspacePressed callback to be executed when the BACKSPACE key is pressed.\n * @param keepFocusAfterSelection determines whether after selecting an item, the focus should be maintained on the current target or not.\n * @param initialIndex where should the navigation start from. it defaults to `-1`, so the first item navigated is the item on position `0`.\n * @param preventTabOnEnteredValue determines whether upon TAB, if there is a value entered, the event is prevented or not.\n * @return useKeyboardListNavigation helpers.\n */\nexport const useKeyboardListNavigation: useKeyboardListNavigationType = (\n items,\n ref,\n onListItemSelected,\n onListItemNavigated,\n onEnterPressed,\n onBackspacePressed,\n keepFocusAfterSelection = false,\n initialIndex = INITIAL_INDEX,\n preventTabOnEnteredValue = true,\n) => {\n const [activeItemIndex, setActiveItemIndex] = useState(initialIndex);\n\n /**\n * This function calculates the next index in the list to be highlighted\n * @param key - key code pressed\n * @return next active index\n */\n const calculateActiveIndex = (key: string): number => {\n switch (key) {\n case 'ArrowDown':\n return activeItemIndex + 1 < items.length ? activeItemIndex + 1 : 0;\n case 'ArrowUp':\n return activeItemIndex - 1 >= 0 ? activeItemIndex - 1 : items.length - 1;\n default:\n return initialIndex;\n }\n };\n\n /**\n * Resets the active index to the initial state\n */\n const resetActiveIndex = () => {\n setActiveItemIndex(initialIndex);\n };\n\n /**\n * Prevents the default event and stops the propagation of said event\n * @param evt - key pressed event\n */\n const preventDefaultAndStopPropagation: Listener = (evt) => {\n evt.preventDefault();\n evt.stopPropagation();\n };\n\n /**\n * Handles navigation with the arrows using the keyboard\n * @param evt - key pressed event\n */\n const onArrowPressed: Listener = (evt) => {\n const { key } = evt;\n const nextActiveIndex = calculateActiveIndex(key);\n setActiveItemIndex(nextActiveIndex);\n preventDefaultAndStopPropagation(evt);\n if (onListItemNavigated) {\n const selectedItem = items[nextActiveIndex];\n onListItemNavigated(selectedItem);\n }\n };\n\n /**\n * Handles the event when the backspace key is pressed\n * @param evt - key pressed event\n */\n const onBackspaceKeyPressed: Listener = (evt) => {\n if (onBackspacePressed) {\n onBackspacePressed(evt);\n }\n };\n\n /**\n * Handles when the ENTER key is pressed\n * @param evt - key pressed event\n */\n const onEnterKeyPressed: Listener = (evt) => {\n if (!onListItemSelected) {\n return;\n }\n\n preventDefaultAndStopPropagation(evt);\n\n if (!keepFocusAfterSelection) {\n (evt.currentTarget as HTMLElement).blur();\n }\n\n const selectedItem = items[activeItemIndex];\n\n if (selectedItem) {\n onListItemSelected(selectedItem);\n resetActiveIndex();\n } else if (activeItemIndex === initialIndex && onEnterPressed) {\n const value = get(evt, 'target.value');\n onEnterPressed(value);\n resetActiveIndex();\n }\n };\n\n /**\n * Handles when the TAB key is pressed\n * @param evt - key pressed event\n */\n const onTabKeyPressed: Listener = (evt) => {\n const value = get(evt, 'target.value');\n\n if (preventTabOnEnteredValue && value && value.length > 0) {\n preventDefaultAndStopPropagation(evt);\n }\n };\n\n /**\n * In order to make it easier in the future to add new events depending on the key\n * a map was created to add these handlers. In the future, if there is another event\n * that we need to manage depending on a specific key, we just need to add the key code\n * here, and as a value, the handler for said key.\n */\n const eventsForKeyPressed: Record<string, Listener> = {\n ArrowDown: onArrowPressed,\n Tab: onTabKeyPressed,\n ArrowUp: onArrowPressed,\n Enter: onEnterKeyPressed,\n Backspace: onBackspaceKeyPressed,\n };\n\n /**\n * Calculates the next active item index depending on the key pressed.\n * If the key pressed was ENTER, the function executes the callback `onListItemSelected`\n * and resets the active index, since an item was selected.\n * @param evt - key pressed or key down event\n */\n const onKeyboardNavigation: Listener = (evt) => {\n const { key } = evt;\n const handler = eventsForKeyPressed[key];\n\n if (handler) {\n handler(evt);\n }\n };\n\n useEffect(() => {\n const { current: currentElement } = ref;\n if (!currentElement) {\n return undefined;\n }\n currentElement.addEventListener('focus', resetActiveIndex);\n currentElement.addEventListener('keydown', onKeyboardNavigation);\n return () => {\n currentElement.removeEventListener('focus', resetActiveIndex);\n currentElement.removeEventListener('keydown', onKeyboardNavigation);\n };\n });\n\n return {\n activeItemIndex,\n onKeyboardNavigation,\n resetActiveIndex,\n setActiveItemIndex,\n };\n};\n","import React, { forwardRef, ReactNode, Ref, SyntheticEvent, useMemo } from 'react';\n\nimport classNames from 'classnames';\nimport isEmpty from 'lodash/isEmpty';\n\nimport { ListProps, Size } from '@lumx/react';\nimport {\n Comp,\n GenericProps,\n getRootClassName,\n handleBasicClasses,\n onEnterPressed,\n onButtonPressed,\n} from '@lumx/react/utils';\nimport { renderLink } from '@lumx/react/utils/renderLink';\n\nexport type ListItemSize = Extract<Size, 'tiny' | 'regular' | 'big' | 'huge'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface ListItemProps extends GenericProps {\n /** A component to be rendered after the content. */\n after?: ReactNode;\n /** A component to be rendered before the content. */\n before?: ReactNode;\n /** Content. */\n children: string | ReactNode;\n /** Whether the list item should be highlighted or not. */\n isHighlighted?: boolean;\n /** Whether the component is selected or not. */\n isSelected?: boolean;\n /** Whether link/button is disabled or not. */\n isDisabled?: boolean;\n /** Reference to the <li> element. */\n listItemRef?: Ref<HTMLLIElement>;\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n /** Props that will be passed on to the Link */\n linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;\n /** Reference to the link element. */\n linkRef?: Ref<HTMLAnchorElement>;\n /** Size variant. */\n size?: ListItemSize;\n\n /** On selected callback. */\n onItemSelected?(evt: SyntheticEvent): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ListItem';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ListProps> = {\n size: Size.regular,\n};\n\n/**\n * Check if the list item is clickable.\n * @return `true` if the list item is clickable; `false` otherwise.\n */\nexport function isClickable({ linkProps, onItemSelected }: Partial<ListItemProps>): boolean {\n return !isEmpty(linkProps?.href) || !!onItemSelected;\n}\n\n/**\n * ListItem component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ListItem: Comp<ListItemProps, HTMLLIElement> = forwardRef((props, ref) => {\n const {\n after,\n before,\n children,\n className,\n isHighlighted,\n isSelected,\n isDisabled,\n linkAs,\n linkProps = {},\n linkRef,\n onItemSelected,\n size,\n ...forwardedProps\n } = props;\n\n const role = linkAs || linkProps.href ? 'link' : 'button';\n const onKeyDown = useMemo(() => {\n if (onItemSelected && role === 'link') return onEnterPressed(onItemSelected as any);\n if (onItemSelected && role === 'button') return onButtonPressed(onItemSelected as any);\n return undefined;\n }, [role, onItemSelected]);\n\n const content = (\n <>\n {before && <div className={`${CLASSNAME}__before`}>{before}</div>}\n <div className={`${CLASSNAME}__content`}>{children}</div>\n {after && <div className={`${CLASSNAME}__after`}>{after}</div>}\n </>\n );\n\n return (\n <li\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n size,\n }),\n )}\n >\n {isClickable({ linkProps, onItemSelected }) ? (\n /* Clickable list item */\n renderLink(\n {\n linkAs,\n tabIndex: !isDisabled && role === 'button' ? 0 : undefined,\n role,\n 'aria-disabled': isDisabled,\n ...linkProps,\n href: isDisabled ? undefined : linkProps.href,\n className: classNames(\n handleBasicClasses({\n prefix: `${CLASSNAME}__link`,\n isHighlighted,\n isSelected,\n isDisabled,\n }),\n ),\n onClick: isDisabled ? undefined : onItemSelected,\n onKeyDown,\n ref: linkRef,\n },\n content,\n )\n ) : (\n /* Non clickable list item */\n <div className={`${CLASSNAME}__wrapper`}>{content}</div>\n )}\n </li>\n );\n});\nListItem.displayName = COMPONENT_NAME;\nListItem.className = CLASSNAME;\nListItem.defaultProps = DEFAULT_PROPS;\n","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","import get from 'lodash/get';\nimport { Children, Key, ReactChild, ReactNode, cloneElement, isValidElement } from 'react';\nimport { isFragment } from 'react-is';\n\n/**\n * Flatten list of react nodes removing fragments and adding keys.\n * based on: https://github.com/grrowl/react-keyed-flatten-children/blob/5d421644a449765ddd62b659946196b4b5d7b135/index.ts\n *\n * @param children React nodes to flatten.\n * @return Flattened react nodes.\n */\nexport function flattenChildren(children: ReactNode) {\n function recur(nodes: ReactNode, keys: Key[] = []) {\n return Children.toArray(nodes).reduce((acc: ReactChild[], node, index) => {\n const nodeKeys = keys.concat(get(node, 'key') ?? index);\n if (isFragment(node)) {\n acc.push(...recur(node.props.children, nodeKeys));\n } else if (isValidElement(node)) {\n acc.push(cloneElement(node, { key: nodeKeys.join('.') }));\n } else if (typeof node === 'string' || typeof node === 'number') {\n acc.push(node);\n }\n return acc;\n }, []);\n }\n return recur(children);\n}\n","import { ListItemProps } from '@lumx/react';\nimport { isClickable } from '@lumx/react/components/list/ListItem';\n\nimport { isComponent } from '@lumx/react/utils';\nimport { flattenChildren } from '@lumx/react/utils/flattenChildren';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\nimport get from 'lodash/get';\nimport {\n cloneElement,\n Key,\n ReactElement,\n ReactNode,\n RefObject,\n SyntheticEvent,\n useEffect,\n useMemo,\n useState,\n} from 'react';\n\ntype Listener = (evt: KeyboardEvent) => void;\n\ninterface Options {\n /** List of items to navigate on. */\n items: ReactNode[] | ReactNode;\n /** Reference to the list-like element controlling the navigation. */\n ref: RefObject<HTMLElement>;\n\n /**\n * On list item navigated callback (triggered on ARROW key navigation).\n *\n * @param index Index of the navigated item among the sibling items.\n * @param key React key of the navigated item.\n */\n onListItemNavigated?(index: number, key: Key | null): void;\n\n /**\n * On list item selected callback (via ENTER key or click).\n *\n * @param index Index of the selected item among the sibling items.\n * @param key React key of the selected item.\n * @param evt Source event (either mouse or keyboard event).\n */\n onListItemSelected?(index: number, key: Key | null, evt: SyntheticEvent): void;\n}\n\ninterface Output {\n /** List of items transformed to accommodate keyboard navigation. */\n items: ReactNode[];\n /** Whether the list contains clickable items or not. */\n hasClickableItem: boolean;\n}\n\nexport type useInteractiveList = (options: Options) => Output;\n\nconst INITIAL_INDEX = -1;\n\nfunction onKeyboardFocus(props: any, handler: (evt: FocusEvent) => void) {\n let isMouseDown = false;\n return {\n onFocus(evt: FocusEvent) {\n props.onFocus?.(evt);\n if (!isMouseDown) {\n handler(evt);\n }\n },\n onMouseDown(evt: MouseEvent) {\n props.onMouseDown?.(evt);\n isMouseDown = true;\n },\n onMouseUp(evt: MouseEvent) {\n props.onMouseUp?.(evt);\n isMouseDown = false;\n },\n };\n}\n\nconst isNavigableItem = (node: ReactNode): node is ReactElement => {\n return isComponent('ListItem')(node) && isClickable(node.props) && !node.props.isDisabled;\n};\n\n/**\n * This custom hook detects clickable list item in a list and make them navigable with the keyboard.\n *\n * @param options See {@link Options}\n * @return See {@link Output}\n */\nexport const useInteractiveList: useInteractiveList = (options) => {\n const { ref, onListItemSelected, onListItemNavigated } = options;\n const items = useMemo(() => flattenChildren(options.items), [options.items]);\n const [activeItemIndex, setActiveItemIndex] = useState(INITIAL_INDEX);\n\n // Attach listeners to the list.\n useEffect(() => {\n const { current: listElement } = ref;\n if (!listElement) {\n return undefined;\n }\n\n /**\n * This function calculates the next index in the list to be active\n * @param index current index\n * @param code key code pressed\n * @return next index\n */\n const getNextIndex = (index: number, key: string): number => {\n switch (key) {\n case 'ArrowDown':\n return index + 1 < items.length ? index + 1 : 0;\n case 'ArrowUp':\n return index - 1 >= 0 ? index - 1 : items.length - 1;\n default:\n return INITIAL_INDEX;\n }\n };\n\n /**\n * Resets the active index to the initial state\n */\n const resetActiveIndex = () => {\n setActiveItemIndex(INITIAL_INDEX);\n };\n\n /**\n * Handles navigation with the arrows using the keyboard\n * @param evt Key event\n */\n const onArrowPressed: Listener = (evt) => {\n const { key } = evt;\n if (key !== 'ArrowUp' && key !== 'ArrowDown') {\n return;\n }\n\n let nextIndex = activeItemIndex;\n let iterations = 0;\n\n // Move to next navigable item.\n do {\n nextIndex = getNextIndex(nextIndex, key);\n iterations += 1;\n } while (\n nextIndex !== INITIAL_INDEX &&\n nextIndex !== activeItemIndex &&\n !isNavigableItem(items[nextIndex] as any) &&\n iterations < items.length\n );\n\n setActiveItemIndex(nextIndex);\n evt.preventDefault();\n evt.stopPropagation();\n onListItemNavigated?.(nextIndex, get(items, [nextIndex, 'key']));\n };\n\n /**\n * Reset active list item index when focusing outside the list.\n * @param evt Focus out event\n */\n const onFocusOut = (evt: FocusEvent) => {\n if (!evt.relatedTarget || !listElement.contains(evt.relatedTarget as any)) {\n resetActiveIndex();\n }\n };\n\n listElement.addEventListener('focusout', onFocusOut);\n listElement.addEventListener('keydown', onArrowPressed);\n return () => {\n listElement.removeEventListener('focusout', onFocusOut);\n listElement.removeEventListener('keydown', onArrowPressed);\n };\n }, [ref, activeItemIndex, items, onListItemNavigated]);\n\n return useMemo(() => {\n let hasClickableItem = false;\n const transformedItems = items.map((item, index) => {\n // Ignore if list not clickable or item is not a simple list item.\n if (!isNavigableItem(item)) {\n return item;\n }\n\n hasClickableItem = true;\n const isHighlighted = index === activeItemIndex;\n\n // Clone list item: inject ref, add tab index and active state.\n return cloneElement<ListItemProps>(item, {\n ...item.props,\n isHighlighted: item.props.isHighlighted ?? isHighlighted,\n linkRef: mergeRefs(item.props.linkRef, (element: any) => {\n if (isHighlighted) {\n element?.focus();\n }\n }),\n onItemSelected(evt) {\n item.props.onItemSelected?.();\n onListItemSelected?.(index, item.key, evt);\n },\n ...onKeyboardFocus(item.props, () => {\n setActiveItemIndex(index);\n }),\n });\n });\n return { items: transformedItems, hasClickableItem };\n }, [items, activeItemIndex, onListItemSelected]);\n};\n","import { Size } from '@lumx/react';\n\nimport { useKeyboardListNavigation } from '@lumx/react/hooks/useKeyboardListNavigation';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\n\nimport classNames from 'classnames';\nimport React, { forwardRef, Key, ReactNode, SyntheticEvent, useRef } from 'react';\nimport { useInteractiveList } from './useInteractiveList';\n\n/**\n * Defines the props of the component.\n */\nexport interface ListProps extends GenericProps {\n /** List content (should be ListItem, ListSubheader or ListDivider). */\n children: ReactNode;\n /**\n * Whether the list items are clickable.\n * @deprecated not needed anymore.\n */\n isClickable?: boolean;\n /** Item padding size. */\n itemPadding?: Extract<Size, 'big' | 'huge'>;\n /**\n * On list item selected callback.\n *\n * @param key React key of the selected item.\n * @param index Index of the selected item among the sibling items.\n * @param evt Source event (either mouse or keyboard event).\n */\n onListItemSelected?(key: Key, index: number, evt: SyntheticEvent): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'List';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n/**\n * List component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nconst InternalList: Comp<ListProps, HTMLUListElement> = forwardRef((props, ref) => {\n const { children, className, isClickable, itemPadding, onListItemSelected, ...forwardedProps } = props;\n const listElementRef = useRef<HTMLUListElement>(null);\n\n const { items, hasClickableItem } = useInteractiveList({\n items: children,\n ref: listElementRef,\n onListItemSelected,\n });\n const clickable = hasClickableItem || isClickable;\n\n return (\n <ul\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n itemPadding: itemPadding ?? (clickable ? Size.big : undefined),\n }),\n )}\n tabIndex={clickable ? 0 : -1}\n ref={mergeRefs(ref, listElementRef)}\n >\n {items}\n </ul>\n );\n});\nInternalList.displayName = COMPONENT_NAME;\nInternalList.className = CLASSNAME;\n\nexport const List = Object.assign(InternalList, { useKeyboardListNavigation });\n"],"names":["INITIAL_INDEX","useKeyboardListNavigation","items","ref","onListItemSelected","onListItemNavigated","onEnterPressed","onBackspacePressed","keepFocusAfterSelection","initialIndex","preventTabOnEnteredValue","useState","activeItemIndex","setActiveItemIndex","calculateActiveIndex","key","length","resetActiveIndex","preventDefaultAndStopPropagation","evt","preventDefault","stopPropagation","onArrowPressed","nextActiveIndex","selectedItem","onBackspaceKeyPressed","onEnterKeyPressed","currentTarget","blur","value","get","onTabKeyPressed","eventsForKeyPressed","ArrowDown","Tab","ArrowUp","Enter","Backspace","onKeyboardNavigation","handler","useEffect","currentElement","current","undefined","addEventListener","removeEventListener","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","regular","isClickable","linkProps","onItemSelected","isEmpty","href","ListItem","forwardRef","props","after","before","children","className","isHighlighted","isSelected","isDisabled","linkAs","linkRef","forwardedProps","role","onKeyDown","useMemo","onButtonPressed","content","classNames","handleBasicClasses","prefix","renderLink","tabIndex","onClick","displayName","defaultProps","require$$0","require$$1","flattenChildren","recur","nodes","keys","Children","toArray","reduce","acc","node","index","nodeKeys","concat","isFragment","push","isValidElement","cloneElement","join","onKeyboardFocus","isMouseDown","onFocus","onMouseDown","onMouseUp","isNavigableItem","isComponent","useInteractiveList","options","listElement","getNextIndex","nextIndex","iterations","onFocusOut","relatedTarget","contains","hasClickableItem","transformedItems","map","item","mergeRefs","element","focus","InternalList","itemPadding","listElementRef","useRef","clickable","big","List","Object","assign"],"mappings":";;;;;;;;;;;;;AA6BA,IAAMA,aAAa,GAAG,CAAC,CAAvB;AAEA;;;;;;;;;;;;;;;;AAeO,IAAMC,yBAAwD,GAAG,SAA3DA,yBAA2D,CACpEC,KADoE,EAEpEC,GAFoE,EAGpEC,kBAHoE,EAIpEC,mBAJoE,EAKpEC,cALoE,EAMpEC,kBANoE,EAUnE;AAAA,MAHDC,uBAGC,uEAHyB,KAGzB;AAAA,MAFDC,YAEC,uEAFcT,aAEd;AAAA,MADDU,wBACC,uEAD0B,IAC1B;;AAAA,kBAC6CC,QAAQ,CAACF,YAAD,CADrD;AAAA;AAAA,MACMG,eADN;AAAA,MACuBC,kBADvB;AAGD;;;;;;;AAKA,MAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,GAAD,EAAyB;AAClD,YAAQA,GAAR;AACI,WAAK,WAAL;AACI,eAAOH,eAAe,GAAG,CAAlB,GAAsBV,KAAK,CAACc,MAA5B,GAAqCJ,eAAe,GAAG,CAAvD,GAA2D,CAAlE;;AACJ,WAAK,SAAL;AACI,eAAOA,eAAe,GAAG,CAAlB,IAAuB,CAAvB,GAA2BA,eAAe,GAAG,CAA7C,GAAiDV,KAAK,CAACc,MAAN,GAAe,CAAvE;;AACJ;AACI,eAAOP,YAAP;AANR;AAQH,GATD;AAWA;;;;;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AAY,CAAC5C,WAAb,GAA2BpC,gBAA3B;AACAgF,YAAY,CAAC9D,SAAb,GAAyBjB,WAAzB;IAEaqF,IAAI,GAAGC,MAAM,CAACC,MAAP,CAAcR,YAAd,EAA4B;AAAE7H,EAAAA,yBAAyB,EAAzBA;AAAF,CAA5B;;;;"}
1
+ {"version":3,"file":"List2.js","sources":["../../../src/hooks/useKeyboardListNavigation.tsx","../../../src/components/list/ListItem.tsx","../../../../../node_modules/react-is/cjs/react-is.production.min.js","../../../../../node_modules/react-is/cjs/react-is.development.js","../../../../../node_modules/react-is/index.js","../../../src/utils/flattenChildren.ts","../../../src/components/list/useInteractiveList.tsx","../../../src/components/list/List.tsx"],"sourcesContent":["import { RefObject, SetStateAction, useEffect, useState } from 'react';\n\nimport get from 'lodash/get';\n\ntype Listener = (evt: KeyboardEvent) => void;\n\ninterface UseKeyboardListNavigationType {\n /** the current active index */\n activeItemIndex: number;\n /** callback to be used when a key is pressed. usually used with the native prop `onKeyDown` */\n onKeyboardNavigation: Listener;\n /** Resets the active index to the initial state */\n resetActiveIndex(): void;\n /** Sets the active index to a given value */\n setActiveItemIndex(value: SetStateAction<number>): void;\n}\n\nexport type useKeyboardListNavigationType = <I>(\n items: I[],\n ref: RefObject<HTMLElement>,\n onListItemSelected: (itemSelected: I) => void,\n onListItemNavigated?: (itemSelected: I) => void,\n onEnterPressed?: (itemSelected: string) => void,\n onBackspacePressed?: Listener,\n keepFocusAfterSelection?: boolean,\n initialIndex?: number,\n preventTabOnEnteredValue?: boolean,\n) => UseKeyboardListNavigationType;\n\nconst INITIAL_INDEX = -1;\n\n/**\n * This custom hook provides the necessary set of functions and values to properly navigate\n * a list using the keyboard.\n *\n * @param items the list of items that will be navigated using the keyboard.\n * @param ref A reference to the element that is controlling the navigation.\n * @param onListItemSelected callback to be executed when the ENTER key is pressed on an item.\n * @param onListItemNavigated callback to be executed when the Arrow keys are pressed.\n * @param onEnterPressed callback to be executed when the ENTER key is pressed.\n * @param onBackspacePressed callback to be executed when the BACKSPACE key is pressed.\n * @param keepFocusAfterSelection determines whether after selecting an item, the focus should be maintained on the current target or not.\n * @param initialIndex where should the navigation start from. it defaults to `-1`, so the first item navigated is the item on position `0`.\n * @param preventTabOnEnteredValue determines whether upon TAB, if there is a value entered, the event is prevented or not.\n * @return useKeyboardListNavigation helpers.\n */\nexport const useKeyboardListNavigation: useKeyboardListNavigationType = (\n items,\n ref,\n onListItemSelected,\n onListItemNavigated,\n onEnterPressed,\n onBackspacePressed,\n keepFocusAfterSelection = false,\n initialIndex = INITIAL_INDEX,\n preventTabOnEnteredValue = true,\n) => {\n const [activeItemIndex, setActiveItemIndex] = useState(initialIndex);\n\n /**\n * This function calculates the next index in the list to be highlighted\n * @param key - key code pressed\n * @return next active index\n */\n const calculateActiveIndex = (key: string): number => {\n switch (key) {\n case 'ArrowDown':\n return activeItemIndex + 1 < items.length ? activeItemIndex + 1 : 0;\n case 'ArrowUp':\n return activeItemIndex - 1 >= 0 ? activeItemIndex - 1 : items.length - 1;\n default:\n return initialIndex;\n }\n };\n\n /**\n * Resets the active index to the initial state\n */\n const resetActiveIndex = () => {\n setActiveItemIndex(initialIndex);\n };\n\n /**\n * Prevents the default event and stops the propagation of said event\n * @param evt - key pressed event\n */\n const preventDefaultAndStopPropagation: Listener = (evt) => {\n evt.preventDefault();\n evt.stopPropagation();\n };\n\n /**\n * Handles navigation with the arrows using the keyboard\n * @param evt - key pressed event\n */\n const onArrowPressed: Listener = (evt) => {\n const { key } = evt;\n const nextActiveIndex = calculateActiveIndex(key);\n setActiveItemIndex(nextActiveIndex);\n preventDefaultAndStopPropagation(evt);\n if (onListItemNavigated) {\n const selectedItem = items[nextActiveIndex];\n onListItemNavigated(selectedItem);\n }\n };\n\n /**\n * Handles the event when the backspace key is pressed\n * @param evt - key pressed event\n */\n const onBackspaceKeyPressed: Listener = (evt) => {\n if (onBackspacePressed) {\n onBackspacePressed(evt);\n }\n };\n\n /**\n * Handles when the ENTER key is pressed\n * @param evt - key pressed event\n */\n const onEnterKeyPressed: Listener = (evt) => {\n if (!onListItemSelected) {\n return;\n }\n\n preventDefaultAndStopPropagation(evt);\n\n if (!keepFocusAfterSelection) {\n (evt.currentTarget as HTMLElement).blur();\n }\n\n const selectedItem = items[activeItemIndex];\n\n if (selectedItem) {\n onListItemSelected(selectedItem);\n resetActiveIndex();\n } else if (activeItemIndex === initialIndex && onEnterPressed) {\n const value = get(evt, 'target.value');\n onEnterPressed(value);\n resetActiveIndex();\n }\n };\n\n /**\n * Handles when the TAB key is pressed\n * @param evt - key pressed event\n */\n const onTabKeyPressed: Listener = (evt) => {\n const value = get(evt, 'target.value');\n\n if (preventTabOnEnteredValue && value && value.length > 0) {\n preventDefaultAndStopPropagation(evt);\n }\n };\n\n /**\n * In order to make it easier in the future to add new events depending on the key\n * a map was created to add these handlers. In the future, if there is another event\n * that we need to manage depending on a specific key, we just need to add the key code\n * here, and as a value, the handler for said key.\n */\n const eventsForKeyPressed: Record<string, Listener> = {\n ArrowDown: onArrowPressed,\n Tab: onTabKeyPressed,\n ArrowUp: onArrowPressed,\n Enter: onEnterKeyPressed,\n Backspace: onBackspaceKeyPressed,\n };\n\n /**\n * Calculates the next active item index depending on the key pressed.\n * If the key pressed was ENTER, the function executes the callback `onListItemSelected`\n * and resets the active index, since an item was selected.\n * @param evt - key pressed or key down event\n */\n const onKeyboardNavigation: Listener = (evt) => {\n const { key } = evt;\n const handler = eventsForKeyPressed[key];\n\n if (handler) {\n handler(evt);\n }\n };\n\n useEffect(() => {\n const { current: currentElement } = ref;\n if (!currentElement) {\n return undefined;\n }\n currentElement.addEventListener('focus', resetActiveIndex);\n currentElement.addEventListener('keydown', onKeyboardNavigation);\n return () => {\n currentElement.removeEventListener('focus', resetActiveIndex);\n currentElement.removeEventListener('keydown', onKeyboardNavigation);\n };\n });\n\n return {\n activeItemIndex,\n onKeyboardNavigation,\n resetActiveIndex,\n setActiveItemIndex,\n };\n};\n","import React, { forwardRef, ReactNode, Ref, SyntheticEvent, useMemo } from 'react';\n\nimport classNames from 'classnames';\nimport isEmpty from 'lodash/isEmpty';\n\nimport { ListProps, Size } from '@lumx/react';\nimport {\n Comp,\n GenericProps,\n getRootClassName,\n handleBasicClasses,\n onEnterPressed,\n onButtonPressed,\n} from '@lumx/react/utils';\nimport { renderLink } from '@lumx/react/utils/renderLink';\n\nexport type ListItemSize = Extract<Size, 'tiny' | 'regular' | 'big' | 'huge'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface ListItemProps extends GenericProps {\n /** A component to be rendered after the content. */\n after?: ReactNode;\n /** A component to be rendered before the content. */\n before?: ReactNode;\n /** Content. */\n children: string | ReactNode;\n /** Whether the list item should be highlighted or not. */\n isHighlighted?: boolean;\n /** Whether the component is selected or not. */\n isSelected?: boolean;\n /** Whether link/button is disabled or not. */\n isDisabled?: boolean;\n /** Reference to the <li> element. */\n listItemRef?: Ref<HTMLLIElement>;\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n /** Props that will be passed on to the Link */\n linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;\n /** Reference to the link element. */\n linkRef?: Ref<HTMLAnchorElement>;\n /** Size variant. */\n size?: ListItemSize;\n\n /** On selected callback. */\n onItemSelected?(evt: SyntheticEvent): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ListItem';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ListProps> = {\n size: Size.regular,\n};\n\n/**\n * Check if the list item is clickable.\n * @return `true` if the list item is clickable; `false` otherwise.\n */\nexport function isClickable({ linkProps, onItemSelected }: Partial<ListItemProps>): boolean {\n return !isEmpty(linkProps?.href) || !!onItemSelected;\n}\n\n/**\n * ListItem component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ListItem: Comp<ListItemProps, HTMLLIElement> = forwardRef((props, ref) => {\n const {\n after,\n before,\n children,\n className,\n isHighlighted,\n isSelected,\n isDisabled,\n linkAs,\n linkProps = {},\n linkRef,\n onItemSelected,\n size,\n ...forwardedProps\n } = props;\n\n const role = linkAs || linkProps.href ? 'link' : 'button';\n const onKeyDown = useMemo(() => {\n if (onItemSelected && role === 'link') return onEnterPressed(onItemSelected as any);\n if (onItemSelected && role === 'button') return onButtonPressed(onItemSelected as any);\n return undefined;\n }, [role, onItemSelected]);\n\n const content = (\n <>\n {before && <div className={`${CLASSNAME}__before`}>{before}</div>}\n <div className={`${CLASSNAME}__content`}>{children}</div>\n {after && <div className={`${CLASSNAME}__after`}>{after}</div>}\n </>\n );\n\n return (\n <li\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n size,\n }),\n )}\n >\n {isClickable({ linkProps, onItemSelected }) ? (\n /* Clickable list item */\n renderLink(\n {\n linkAs,\n tabIndex: !isDisabled && role === 'button' ? 0 : undefined,\n role,\n 'aria-disabled': isDisabled,\n ...linkProps,\n href: isDisabled ? undefined : linkProps.href,\n className: classNames(\n handleBasicClasses({\n prefix: `${CLASSNAME}__link`,\n isHighlighted,\n isSelected,\n isDisabled,\n }),\n ),\n onClick: isDisabled ? undefined : onItemSelected,\n onKeyDown,\n ref: linkRef,\n },\n content,\n )\n ) : (\n /* Non clickable list item */\n <div className={`${CLASSNAME}__wrapper`}>{content}</div>\n )}\n </li>\n );\n});\nListItem.displayName = COMPONENT_NAME;\nListItem.className = CLASSNAME;\nListItem.defaultProps = DEFAULT_PROPS;\n","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","import get from 'lodash/get';\nimport { Children, Key, ReactChild, ReactNode, cloneElement, isValidElement } from 'react';\nimport { isFragment } from 'react-is';\n\n/**\n * Flatten list of react nodes removing fragments and adding keys.\n * based on: https://github.com/grrowl/react-keyed-flatten-children/blob/5d421644a449765ddd62b659946196b4b5d7b135/index.ts\n *\n * @param children React nodes to flatten.\n * @return Flattened react nodes.\n */\nexport function flattenChildren(children: ReactNode) {\n function recur(nodes: ReactNode, keys: Key[] = []) {\n return Children.toArray(nodes).reduce((acc: ReactChild[], node, index) => {\n const nodeKeys = keys.concat(get(node, 'key') ?? index);\n if (isFragment(node)) {\n acc.push(...recur(node.props.children, nodeKeys));\n } else if (isValidElement(node)) {\n acc.push(cloneElement(node, { key: nodeKeys.join('.') }));\n } else if (typeof node === 'string' || typeof node === 'number') {\n acc.push(node);\n }\n return acc;\n }, []);\n }\n return recur(children);\n}\n","import { ListItemProps } from '@lumx/react';\nimport { isClickable } from '@lumx/react/components/list/ListItem';\n\nimport { isComponent } from '@lumx/react/utils';\nimport { flattenChildren } from '@lumx/react/utils/flattenChildren';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\nimport get from 'lodash/get';\nimport {\n cloneElement,\n Key,\n ReactElement,\n ReactNode,\n RefObject,\n SyntheticEvent,\n useEffect,\n useMemo,\n useState,\n} from 'react';\n\ntype Listener = (evt: KeyboardEvent) => void;\n\ninterface Options {\n /** List of items to navigate on. */\n items: ReactNode[] | ReactNode;\n /** Reference to the list-like element controlling the navigation. */\n ref: RefObject<HTMLElement>;\n\n /**\n * On list item navigated callback (triggered on ARROW key navigation).\n *\n * @param index Index of the navigated item among the sibling items.\n * @param key React key of the navigated item.\n */\n onListItemNavigated?(index: number, key: Key | null): void;\n\n /**\n * On list item selected callback (via ENTER key or click).\n *\n * @param index Index of the selected item among the sibling items.\n * @param key React key of the selected item.\n * @param evt Source event (either mouse or keyboard event).\n */\n onListItemSelected?(index: number, key: Key | null, evt: SyntheticEvent): void;\n}\n\ninterface Output {\n /** List of items transformed to accommodate keyboard navigation. */\n items: ReactNode[];\n /** Whether the list contains clickable items or not. */\n hasClickableItem: boolean;\n}\n\nexport type useInteractiveList = (options: Options) => Output;\n\nconst INITIAL_INDEX = -1;\n\nfunction onKeyboardFocus(props: any, handler: (evt: FocusEvent) => void) {\n let isMouseDown = false;\n return {\n onFocus(evt: FocusEvent) {\n props.onFocus?.(evt);\n if (!isMouseDown) {\n handler(evt);\n }\n },\n onMouseDown(evt: MouseEvent) {\n props.onMouseDown?.(evt);\n isMouseDown = true;\n },\n onMouseUp(evt: MouseEvent) {\n props.onMouseUp?.(evt);\n isMouseDown = false;\n },\n };\n}\n\nconst isNavigableItem = (node: ReactNode): node is ReactElement => {\n return isComponent('ListItem')(node) && isClickable(node.props) && !node.props.isDisabled;\n};\n\n/**\n * This custom hook detects clickable list item in a list and make them navigable with the keyboard.\n *\n * @param options See {@link Options}\n * @return See {@link Output}\n */\nexport const useInteractiveList: useInteractiveList = (options) => {\n const { ref, onListItemSelected, onListItemNavigated } = options;\n const items = useMemo(() => flattenChildren(options.items), [options.items]);\n const [activeItemIndex, setActiveItemIndex] = useState(INITIAL_INDEX);\n\n // Attach listeners to the list.\n useEffect(() => {\n const { current: listElement } = ref;\n if (!listElement) {\n return undefined;\n }\n\n /**\n * This function calculates the next index in the list to be active\n * @param index current index\n * @param code key code pressed\n * @return next index\n */\n const getNextIndex = (index: number, key: string): number => {\n switch (key) {\n case 'ArrowDown':\n return index + 1 < items.length ? index + 1 : 0;\n case 'ArrowUp':\n return index - 1 >= 0 ? index - 1 : items.length - 1;\n default:\n return INITIAL_INDEX;\n }\n };\n\n /**\n * Resets the active index to the initial state\n */\n const resetActiveIndex = () => {\n setActiveItemIndex(INITIAL_INDEX);\n };\n\n /**\n * Handles navigation with the arrows using the keyboard\n * @param evt Key event\n */\n const onArrowPressed: Listener = (evt) => {\n const { key } = evt;\n if (key !== 'ArrowUp' && key !== 'ArrowDown') {\n return;\n }\n\n let nextIndex = activeItemIndex;\n let iterations = 0;\n\n // Move to next navigable item.\n do {\n nextIndex = getNextIndex(nextIndex, key);\n iterations += 1;\n } while (\n nextIndex !== INITIAL_INDEX &&\n nextIndex !== activeItemIndex &&\n !isNavigableItem(items[nextIndex] as any) &&\n iterations < items.length\n );\n\n setActiveItemIndex(nextIndex);\n evt.preventDefault();\n evt.stopPropagation();\n onListItemNavigated?.(nextIndex, get(items, [nextIndex, 'key']));\n };\n\n /**\n * Reset active list item index when focusing outside the list.\n * @param evt Focus out event\n */\n const onFocusOut = (evt: FocusEvent) => {\n if (!evt.relatedTarget || !listElement.contains(evt.relatedTarget as any)) {\n resetActiveIndex();\n }\n };\n\n listElement.addEventListener('focusout', onFocusOut);\n listElement.addEventListener('keydown', onArrowPressed);\n return () => {\n listElement.removeEventListener('focusout', onFocusOut);\n listElement.removeEventListener('keydown', onArrowPressed);\n };\n }, [ref, activeItemIndex, items, onListItemNavigated]);\n\n return useMemo(() => {\n let hasClickableItem = false;\n const transformedItems = items.map((item, index) => {\n // Ignore if list not clickable or item is not a simple list item.\n if (!isNavigableItem(item)) {\n return item;\n }\n\n hasClickableItem = true;\n const isHighlighted = index === activeItemIndex;\n\n // Clone list item: inject ref, add tab index and active state.\n return cloneElement<ListItemProps>(item, {\n ...item.props,\n isHighlighted: item.props.isHighlighted ?? isHighlighted,\n linkRef: mergeRefs(item.props.linkRef, (element: any) => {\n if (isHighlighted) {\n element?.focus();\n }\n }),\n onItemSelected(evt) {\n item.props.onItemSelected?.();\n onListItemSelected?.(index, item.key, evt);\n },\n ...onKeyboardFocus(item.props, () => {\n setActiveItemIndex(index);\n }),\n });\n });\n return { items: transformedItems, hasClickableItem };\n }, [items, activeItemIndex, onListItemSelected]);\n};\n","import { Size } from '@lumx/react';\n\nimport { useKeyboardListNavigation } from '@lumx/react/hooks/useKeyboardListNavigation';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\n\nimport classNames from 'classnames';\nimport React, { forwardRef, Key, ReactNode, SyntheticEvent, useRef } from 'react';\nimport { useInteractiveList } from './useInteractiveList';\n\n/**\n * Defines the props of the component.\n */\nexport interface ListProps extends GenericProps {\n /** List content (should be ListItem, ListSubheader or ListDivider). */\n children: ReactNode;\n /**\n * Whether the list items are clickable.\n * @deprecated not needed anymore.\n */\n isClickable?: boolean;\n /** Item padding size. */\n itemPadding?: Extract<Size, 'big' | 'huge'>;\n /**\n * On list item selected callback.\n *\n * @param key React key of the selected item.\n * @param index Index of the selected item among the sibling items.\n * @param evt Source event (either mouse or keyboard event).\n */\n onListItemSelected?(key: Key, index: number, evt: SyntheticEvent): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'List';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n/**\n * List component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nconst InternalList: Comp<ListProps, HTMLUListElement> = forwardRef((props, ref) => {\n const { children, className, isClickable, itemPadding, onListItemSelected, ...forwardedProps } = props;\n const listElementRef = useRef<HTMLUListElement>(null);\n\n const { items, hasClickableItem } = useInteractiveList({\n items: children,\n ref: listElementRef,\n onListItemSelected,\n });\n const clickable = hasClickableItem || isClickable;\n\n return (\n <ul\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n itemPadding: itemPadding ?? (clickable ? Size.big : undefined),\n }),\n )}\n tabIndex={clickable ? 0 : -1}\n ref={mergeRefs(ref, listElementRef)}\n >\n {items}\n </ul>\n );\n});\nInternalList.displayName = COMPONENT_NAME;\nInternalList.className = CLASSNAME;\n\nexport const List = Object.assign(InternalList, { useKeyboardListNavigation });\n"],"names":["INITIAL_INDEX","useKeyboardListNavigation","items","ref","onListItemSelected","onListItemNavigated","onEnterPressed","onBackspacePressed","keepFocusAfterSelection","initialIndex","preventTabOnEnteredValue","useState","activeItemIndex","setActiveItemIndex","calculateActiveIndex","key","length","resetActiveIndex","preventDefaultAndStopPropagation","evt","preventDefault","stopPropagation","onArrowPressed","nextActiveIndex","selectedItem","onBackspaceKeyPressed","onEnterKeyPressed","currentTarget","blur","value","get","onTabKeyPressed","eventsForKeyPressed","ArrowDown","Tab","ArrowUp","Enter","Backspace","onKeyboardNavigation","handler","useEffect","currentElement","current","undefined","addEventListener","removeEventListener","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","regular","isClickable","linkProps","onItemSelected","isEmpty","href","ListItem","forwardRef","props","after","before","children","className","isHighlighted","isSelected","isDisabled","linkAs","linkRef","forwardedProps","role","onKeyDown","useMemo","onButtonPressed","content","classNames","handleBasicClasses","prefix","renderLink","tabIndex","onClick","displayName","defaultProps","require$$0","require$$1","flattenChildren","recur","nodes","keys","Children","toArray","reduce","acc","node","index","nodeKeys","concat","isFragment","push","isValidElement","cloneElement","join","onKeyboardFocus","isMouseDown","onFocus","onMouseDown","onMouseUp","isNavigableItem","isComponent","useInteractiveList","options","listElement","getNextIndex","nextIndex","iterations","onFocusOut","relatedTarget","contains","hasClickableItem","transformedItems","map","item","mergeRefs","element","focus","InternalList","itemPadding","listElementRef","useRef","clickable","big","List","Object","assign"],"mappings":";;;;;;;;;;;;;AA6BA,IAAMA,aAAa,GAAG,CAAC,CAAvB;AAEA;;;;;;;;;;;;;;;;AAeO,IAAMC,yBAAwD,GAAG,SAA3DA,yBAA2D,CACpEC,KADoE,EAEpEC,GAFoE,EAGpEC,kBAHoE,EAIpEC,mBAJoE,EAKpEC,cALoE,EAMpEC,kBANoE,EAUnE;AAAA,MAHDC,uBAGC,uEAHyB,KAGzB;AAAA,MAFDC,YAEC,uEAFcT,aAEd;AAAA,MADDU,wBACC,uEAD0B,IAC1B;;AAAA,kBAC6CC,QAAQ,CAACF,YAAD,CADrD;AAAA;AAAA,MACMG,eADN;AAAA,MACuBC,kBADvB;AAGD;;;;;;;AAKA,MAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,GAAD,EAAyB;AAClD,YAAQA,GAAR;AACI,WAAK,WAAL;AACI,eAAOH,eAAe,GAAG,CAAlB,GAAsBV,KAAK,CAACc,MAA5B,GAAqCJ,eAAe,G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AAFrC,KAAD,CAFD,CAFzB;AASI,IAAA,QAAQ,EAAEuF,SAAS,GAAG,CAAH,GAAO,CAAC,CAT/B;AAUI,IAAA,GAAG,EAAEP,SAAS,CAACxH,GAAD,EAAM6H,cAAN;AAVlB,MAYK9H,KAZL,CADJ;AAgBH,CA3BiE,CAAlE;AA4BA4H,YAAY,CAAC5C,WAAb,GAA2BpC,gBAA3B;AACAgF,YAAY,CAAC9D,SAAb,GAAyBjB,WAAzB;IAEaqF,IAAI,GAAGC,MAAM,CAACC,MAAP,CAAcR,YAAd,EAA4B;AAAE7H,EAAAA,yBAAyB,EAAzBA;AAAF,CAA5B;;;;"}
@@ -233,9 +233,9 @@ var TextField = forwardRef(function (props, ref) {
233
233
  prefix: CLASSNAME,
234
234
  theme: theme
235
235
  }))
236
- }, label && React.createElement("div", {
236
+ }, (label || maxLength) && React.createElement("div", {
237
237
  className: "".concat(CLASSNAME, "__header")
238
- }, React.createElement(InputLabel, {
238
+ }, label && React.createElement(InputLabel, {
239
239
  htmlFor: textFieldId,
240
240
  className: "".concat(CLASSNAME, "__label"),
241
241
  isRequired: isRequired,
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.js","sources":["../../../src/components/text-field/TextField.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode, RefObject, SyntheticEvent, useEffect, useMemo, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\nimport get from 'lodash/get';\nimport { uid } from 'uid';\n\nimport { mdiAlertCircle, mdiCheckCircle, mdiCloseCircle } from '@lumx/icons';\nimport { Emphasis, Icon, IconButton, IconButtonProps, InputHelper, InputLabel, Kind, Size, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\n\n/**\n * Defines the props of the component.\n */\nexport interface TextFieldProps extends GenericProps {\n /** Chip Group to be rendered before the main text input. */\n chips?: HTMLElement | ReactNode;\n /** Props to pass to the clear button (minus those already set by the TextField props). If not specified, the button won't be displayed. */\n clearButtonProps?: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;\n /** Error message. */\n error?: string | ReactNode;\n /** Whether we force the focus style or not. */\n forceFocusStyle?: boolean;\n /** Whether the text field is displayed with error style or not. */\n hasError?: boolean;\n /** Additional element to put at the end of the text field. */\n afterElement?: ReactNode;\n /** Helper text. */\n helper?: string | ReactNode;\n /** Icon (SVG path). */\n icon?: string;\n /** Native input id property (generated if not provided to link the label element). */\n id?: string;\n /** Reference to the <input> or <textarea> element. */\n inputRef?: RefObject<HTMLInputElement> | RefObject<HTMLTextAreaElement>;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Whether the component is required or not. */\n isRequired?: boolean;\n /** Whether the text field is displayed with valid style or not. */\n isValid?: boolean;\n /** Label text. */\n label?: string;\n /** Max string length the input accepts (constrains the input and displays a character counter). */\n maxLength?: number;\n /** Minimum number of rows displayed in multiline mode (requires `multiline` to be enabled). */\n minimumRows?: number;\n /** Whether the text field is a textarea or an input. */\n multiline?: boolean;\n /** Native input name property. */\n name?: string;\n /** Placeholder text. */\n placeholder?: string;\n /** Reference to the wrapper. */\n textFieldRef?: RefObject<HTMLDivElement>;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Value. */\n value?: string;\n /** On blur callback. */\n onBlur?(event: React.FocusEvent): void;\n /** On change callback. */\n onChange(value: string, name?: string, event?: SyntheticEvent): void;\n /** On focus callback. */\n onFocus?(event: React.FocusEvent): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'TextField';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Default minimum number of rows in the multiline mode.\n */\nconst DEFAULT_MIN_ROWS = 2;\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<TextFieldProps> = {\n theme: Theme.light,\n type: 'text',\n};\n\n/**\n * Hook that allows to calculate the number of rows needed for a text area.\n * @param minimumRows Minimum number of rows that we want to display.\n * @return rows to be used and a callback to recalculate\n */\nconst useComputeNumberOfRows = (\n minimumRows: number,\n): {\n /** number of rows to be used on the text area */\n rows: number;\n /**\n * Callback in order to recalculate the number of rows due to a change on the text area\n */\n recomputeNumberOfRows(target: Element): void;\n} => {\n const [rows, setRows] = useState(minimumRows);\n\n const recompute = (target: Element) => {\n /**\n * HEAD's UP! This part is a little bit tricky. The idea here is to only\n * display the necessary rows on the textarea. In order to dynamically adjust\n * the height on that field, we need to:\n * 1. Set the current amount of rows to the minimum. That will make the scroll appear.\n * 2. With that, we will have the `scrollHeight`, meaning the height of the container adjusted to the current content\n * 3. With the scroll height, we can figure out how many rows we need to use by dividing the scroll height\n * by the line height.\n * 4. With that number, we can readjust the number of rows on the text area. We need to do that here, if we leave that to\n * the state change through React, there are some scenarios (resize, hitting ENTER or BACKSPACE which add or remove lines)\n * when we will not see the update and the rows will be resized to the minimum.\n * 5. In case there is any other update on the component that changes the UI, we need to keep the number of rows\n * on the state in order to allow React to re-render. Therefore, we save them using `useState`\n */\n // eslint-disable-next-line no-param-reassign\n (target as HTMLTextAreaElement).rows = minimumRows;\n let currentRows = target.scrollHeight / (target.clientHeight / minimumRows);\n currentRows = currentRows >= minimumRows ? currentRows : minimumRows;\n // eslint-disable-next-line no-param-reassign\n (target as HTMLTextAreaElement).rows = currentRows;\n\n setRows(currentRows);\n };\n\n return {\n recomputeNumberOfRows: recompute,\n rows,\n };\n};\n\ninterface InputNativeProps {\n id?: string;\n inputRef?: RefObject<HTMLInputElement> | RefObject<HTMLTextAreaElement>;\n isDisabled?: boolean;\n isRequired?: boolean;\n multiline?: boolean;\n maxLength?: number;\n placeholder?: string;\n rows: number;\n type: string;\n name?: string;\n value?: string;\n setFocus(focus: boolean): void;\n recomputeNumberOfRows(target: Element): void;\n onChange(value: string, name?: string, event?: SyntheticEvent): void;\n onFocus?(value: React.FocusEvent): void;\n onBlur?(value: React.FocusEvent): void;\n}\n\nconst renderInputNative: React.FC<InputNativeProps> = (props) => {\n const {\n id,\n isDisabled,\n isRequired,\n placeholder,\n multiline,\n value,\n setFocus,\n onChange,\n onFocus,\n onBlur,\n inputRef,\n rows,\n recomputeNumberOfRows,\n type,\n name,\n ...forwardedProps\n } = props;\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const ref = useRef<HTMLElement>(null);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n // Recompute the number of rows for the first rendering\n if (multiline && ref && ref.current) {\n recomputeNumberOfRows(ref.current);\n }\n }, [ref, multiline, recomputeNumberOfRows, value]);\n\n const onTextFieldFocus = (event: React.FocusEvent) => {\n onFocus?.(event);\n setFocus(true);\n };\n\n const onTextFieldBlur = (event: React.FocusEvent) => {\n onBlur?.(event);\n setFocus(false);\n };\n\n const handleChange = (event: React.ChangeEvent) => {\n onChange(get(event, 'target.value'), name, event);\n };\n\n const Component = multiline ? 'textarea' : 'input';\n const inputProps: any = {\n ...forwardedProps,\n id,\n className: multiline\n ? `${CLASSNAME}__input-native ${CLASSNAME}__input-native--textarea`\n : `${CLASSNAME}__input-native ${CLASSNAME}__input-native--text`,\n placeholder,\n value,\n name,\n disabled: isDisabled,\n required: isRequired,\n onFocus: onTextFieldFocus,\n onBlur: onTextFieldBlur,\n onChange: handleChange,\n ref: mergeRefs(inputRef as any, ref) as any,\n };\n if (multiline) {\n inputProps.rows = rows;\n } else {\n inputProps.type = type;\n }\n return <Component {...inputProps} />;\n};\n\n/**\n * TextField component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const TextField: Comp<TextFieldProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n chips,\n className,\n clearButtonProps,\n disabled,\n error,\n forceFocusStyle,\n hasError,\n helper,\n icon,\n id,\n inputRef,\n isDisabled = disabled,\n isRequired,\n isValid,\n label,\n maxLength,\n minimumRows,\n multiline,\n name,\n onBlur,\n onChange,\n onFocus,\n placeholder,\n textFieldRef,\n theme,\n type,\n value,\n afterElement,\n ...forwardedProps\n } = props;\n const textFieldId = useMemo(() => id || `text-field-${uid()}`, [id]);\n const [isFocus, setFocus] = useState(false);\n const { rows, recomputeNumberOfRows } = useComputeNumberOfRows(multiline ? minimumRows || DEFAULT_MIN_ROWS : 0);\n const valueLength = (value || '').length;\n const isNotEmpty = valueLength > 0;\n\n /**\n * Function triggered when the Clear Button is clicked.\n * The idea is to execute the `onChange` callback with an empty string\n * and remove focus from the clear button.\n * @param evt On clear event.\n */\n const onClear = (evt: React.ChangeEvent) => {\n evt.nativeEvent.preventDefault();\n evt.nativeEvent.stopPropagation();\n (evt.currentTarget as HTMLElement).blur();\n\n onChange('');\n };\n\n return (\n <div\n ref={ref}\n className={classNames(\n className,\n handleBasicClasses({\n hasChips: Boolean(chips),\n hasError: !isValid && hasError,\n hasIcon: Boolean(icon),\n hasInput: !multiline,\n hasInputClear: clearButtonProps && isNotEmpty,\n hasLabel: Boolean(label),\n hasPlaceholder: Boolean(placeholder),\n hasTextarea: multiline,\n hasValue: Boolean(value),\n isDisabled,\n isFocus: isFocus || forceFocusStyle,\n isValid,\n prefix: CLASSNAME,\n theme,\n }),\n )}\n >\n {label && (\n <div className={`${CLASSNAME}__header`}>\n <InputLabel\n htmlFor={textFieldId}\n className={`${CLASSNAME}__label`}\n isRequired={isRequired}\n theme={theme}\n >\n {label}\n </InputLabel>\n\n {maxLength && (\n <div className={`${CLASSNAME}__char-counter`}>\n <span>{maxLength - valueLength}</span>\n {maxLength - valueLength === 0 && <Icon icon={mdiAlertCircle} size={Size.xxs} />}\n </div>\n )}\n </div>\n )}\n\n <div className={`${CLASSNAME}__wrapper`} ref={textFieldRef}>\n {icon && (\n <Icon\n className={`${CLASSNAME}__input-icon`}\n color={theme === Theme.dark ? 'light' : undefined}\n icon={icon}\n size={Size.xs}\n />\n )}\n\n {chips && (\n <div className={`${CLASSNAME}__chips`}>\n {chips}\n\n {renderInputNative({\n id: textFieldId,\n inputRef,\n isDisabled,\n isRequired,\n maxLength,\n multiline,\n onBlur,\n onChange,\n onFocus,\n placeholder,\n recomputeNumberOfRows,\n rows,\n setFocus,\n type,\n value,\n name,\n ...forwardedProps,\n })}\n </div>\n )}\n\n {!chips && (\n <div className={`${CLASSNAME}__input-wrapper`}>\n {renderInputNative({\n id: textFieldId,\n inputRef,\n isDisabled,\n isRequired,\n maxLength,\n multiline,\n onBlur,\n onChange,\n onFocus,\n placeholder,\n recomputeNumberOfRows,\n rows,\n setFocus,\n type,\n value,\n name,\n ...forwardedProps,\n })}\n </div>\n )}\n\n {(isValid || hasError) && (\n <Icon\n className={`${CLASSNAME}__input-validity`}\n color={theme === Theme.dark ? 'light' : undefined}\n icon={isValid ? mdiCheckCircle : mdiAlertCircle}\n size={Size.xxs}\n />\n )}\n\n {clearButtonProps && isNotEmpty && (\n <IconButton\n {...clearButtonProps}\n className={`${CLASSNAME}__input-clear`}\n icon={mdiCloseCircle}\n emphasis={Emphasis.low}\n size={Size.s}\n theme={theme}\n onClick={onClear}\n type=\"button\"\n />\n )}\n\n {afterElement && <div className={`${CLASSNAME}__after-element`}>{afterElement}</div>}\n </div>\n\n {hasError && error && (\n <InputHelper className={`${CLASSNAME}__helper`} kind={Kind.error} theme={theme}>\n {error}\n </InputHelper>\n )}\n\n {helper && (\n <InputHelper className={`${CLASSNAME}__helper`} theme={theme}>\n {helper}\n </InputHelper>\n )}\n </div>\n );\n});\nTextField.displayName = COMPONENT_NAME;\nTextField.className = CLASSNAME;\nTextField.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_MIN_ROWS","DEFAULT_PROPS","theme","Theme","light","type","useComputeNumberOfRows","minimumRows","useState","rows","setRows","recompute","target","currentRows","scrollHeight","clientHeight","recomputeNumberOfRows","renderInputNative","props","id","isDisabled","isRequired","placeholder","multiline","value","setFocus","onChange","onFocus","onBlur","inputRef","name","forwardedProps","ref","useRef","useEffect","current","onTextFieldFocus","event","onTextFieldBlur","handleChange","get","Component","inputProps","className","disabled","required","mergeRefs","TextField","forwardRef","chips","clearButtonProps","error","forceFocusStyle","hasError","helper","icon","isValid","label","maxLength","textFieldRef","afterElement","textFieldId","useMemo","uid","isFocus","valueLength","length","isNotEmpty","onClear","evt","nativeEvent","preventDefault","stopPropagation","currentTarget","blur","classNames","handleBasicClasses","hasChips","Boolean","hasIcon","hasInput","hasInputClear","hasLabel","hasPlaceholder","hasTextarea","hasValue","prefix","mdiAlertCircle","Size","xxs","dark","undefined","xs","mdiCheckCircle","mdiCloseCircle","Emphasis","low","s","Kind","displayName","defaultProps"],"mappings":";;;;;;;;;;;;;AAWA;;;;AAyDA;;;AAGA,IAAMA,cAAc,GAAG,WAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,gBAAgB,GAAG,CAAzB;AAEA;;;;AAGA,IAAMC,aAAsC,GAAG;AAC3CC,EAAAA,KAAK,EAAEC,KAAK,CAACC,KAD8B;AAE3CC,EAAAA,IAAI,EAAE;AAFqC,CAA/C;AAKA;;;;;;AAKA,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAyB,CAC3BC,WAD2B,EAS1B;AAAA,kBACuBC,QAAQ,CAACD,WAAD,CAD/B;AAAA;AAAA,MACME,IADN;AAAA,MACYC,OADZ;;AAGD,MAAMC,SAAS,GAAG,SAAZA,SAAY,CAACC,MAAD,EAAqB;AACnC;;;;;;;;;;;;;;AAcA;AACCA,IAAAA,MAAD,CAAgCH,IAAhC,GAAuCF,WAAvC;AACA,QAAIM,WAAW,GAAGD,MAAM,CAACE,YAAP,IAAuBF,MAAM,CAACG,YAAP,GAAsBR,WAA7C,CAAlB;AACAM,IAAAA,WAAW,GAAGA,WAAW,IAAIN,WAAf,GAA6BM,WAA7B,GAA2CN,WAAzD,CAlBmC;;AAoBlCK,IAAAA,MAAD,CAAgCH,IAAhC,GAAuCI,WAAvC;AAEAH,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I,EAAEgG,cAHV;AAII,IAAA,QAAQ,EAAEC,QAAQ,CAACC,GAJvB;AAKI,IAAA,IAAI,EAAER,IAAI,CAACS,CALf;AAMI,IAAA,KAAK,EAAE/F,KANX;AAOI,IAAA,OAAO,EAAEkE,OAPb;AAQI,IAAA,IAAI,EAAC;AART,KAtER,EAkFKR,YAAY,IAAI;AAAK,IAAA,SAAS,YAAK9D,SAAL;AAAd,KAAgD8D,YAAhD,CAlFrB,CA1CJ,EA+HKP,QAAQ,IAAIF,KAAZ,IACG,oBAAC,WAAD;AAAa,IAAA,SAAS,YAAKrD,SAAL,aAAtB;AAAgD,IAAA,IAAI,EAAEoG,IAAI,CAAC/C,KAA3D;AAAkE,IAAA,KAAK,EAAEjD;AAAzE,KACKiD,KADL,CAhIR,EAqIKG,MAAM,IACH,oBAAC,WAAD;AAAa,IAAA,SAAS,YAAKxD,SAAL,aAAtB;AAAgD,IAAA,KAAK,EAAEI;AAAvD,KACKoD,MADL,CAtIR,CADJ;AA6IH,CAjMwE;AAkMzEP,SAAS,CAACoD,WAAV,GAAwBtG,cAAxB;AACAkD,SAAS,CAACJ,SAAV,GAAsB7C,SAAtB;AACAiD,SAAS,CAACqD,YAAV,GAAyBnG,aAAzB;;;;"}
1
+ {"version":3,"file":"TextField.js","sources":["../../../src/components/text-field/TextField.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode, RefObject, SyntheticEvent, useEffect, useMemo, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\nimport get from 'lodash/get';\nimport { uid } from 'uid';\n\nimport { mdiAlertCircle, mdiCheckCircle, mdiCloseCircle } from '@lumx/icons';\nimport { Emphasis, Icon, IconButton, IconButtonProps, InputHelper, InputLabel, Kind, Size, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\n\n/**\n * Defines the props of the component.\n */\nexport interface TextFieldProps extends GenericProps {\n /** Chip Group to be rendered before the main text input. */\n chips?: HTMLElement | ReactNode;\n /** Props to pass to the clear button (minus those already set by the TextField props). If not specified, the button won't be displayed. */\n clearButtonProps?: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;\n /** Error message. */\n error?: string | ReactNode;\n /** Whether we force the focus style or not. */\n forceFocusStyle?: boolean;\n /** Whether the text field is displayed with error style or not. */\n hasError?: boolean;\n /** Additional element to put at the end of the text field. */\n afterElement?: ReactNode;\n /** Helper text. */\n helper?: string | ReactNode;\n /** Icon (SVG path). */\n icon?: string;\n /** Native input id property (generated if not provided to link the label element). */\n id?: string;\n /** Reference to the <input> or <textarea> element. */\n inputRef?: RefObject<HTMLInputElement> | RefObject<HTMLTextAreaElement>;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Whether the component is required or not. */\n isRequired?: boolean;\n /** Whether the text field is displayed with valid style or not. */\n isValid?: boolean;\n /** Label text. */\n label?: string;\n /** Max string length the input accepts (constrains the input and displays a character counter). */\n maxLength?: number;\n /** Minimum number of rows displayed in multiline mode (requires `multiline` to be enabled). */\n minimumRows?: number;\n /** Whether the text field is a textarea or an input. */\n multiline?: boolean;\n /** Native input name property. */\n name?: string;\n /** Placeholder text. */\n placeholder?: string;\n /** Reference to the wrapper. */\n textFieldRef?: RefObject<HTMLDivElement>;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Value. */\n value?: string;\n /** On blur callback. */\n onBlur?(event: React.FocusEvent): void;\n /** On change callback. */\n onChange(value: string, name?: string, event?: SyntheticEvent): void;\n /** On focus callback. */\n onFocus?(event: React.FocusEvent): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'TextField';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Default minimum number of rows in the multiline mode.\n */\nconst DEFAULT_MIN_ROWS = 2;\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<TextFieldProps> = {\n theme: Theme.light,\n type: 'text',\n};\n\n/**\n * Hook that allows to calculate the number of rows needed for a text area.\n * @param minimumRows Minimum number of rows that we want to display.\n * @return rows to be used and a callback to recalculate\n */\nconst useComputeNumberOfRows = (\n minimumRows: number,\n): {\n /** number of rows to be used on the text area */\n rows: number;\n /**\n * Callback in order to recalculate the number of rows due to a change on the text area\n */\n recomputeNumberOfRows(target: Element): void;\n} => {\n const [rows, setRows] = useState(minimumRows);\n\n const recompute = (target: Element) => {\n /**\n * HEAD's UP! This part is a little bit tricky. The idea here is to only\n * display the necessary rows on the textarea. In order to dynamically adjust\n * the height on that field, we need to:\n * 1. Set the current amount of rows to the minimum. That will make the scroll appear.\n * 2. With that, we will have the `scrollHeight`, meaning the height of the container adjusted to the current content\n * 3. With the scroll height, we can figure out how many rows we need to use by dividing the scroll height\n * by the line height.\n * 4. With that number, we can readjust the number of rows on the text area. We need to do that here, if we leave that to\n * the state change through React, there are some scenarios (resize, hitting ENTER or BACKSPACE which add or remove lines)\n * when we will not see the update and the rows will be resized to the minimum.\n * 5. In case there is any other update on the component that changes the UI, we need to keep the number of rows\n * on the state in order to allow React to re-render. Therefore, we save them using `useState`\n */\n // eslint-disable-next-line no-param-reassign\n (target as HTMLTextAreaElement).rows = minimumRows;\n let currentRows = target.scrollHeight / (target.clientHeight / minimumRows);\n currentRows = currentRows >= minimumRows ? currentRows : minimumRows;\n // eslint-disable-next-line no-param-reassign\n (target as HTMLTextAreaElement).rows = currentRows;\n\n setRows(currentRows);\n };\n\n return {\n recomputeNumberOfRows: recompute,\n rows,\n };\n};\n\ninterface InputNativeProps {\n id?: string;\n inputRef?: RefObject<HTMLInputElement> | RefObject<HTMLTextAreaElement>;\n isDisabled?: boolean;\n isRequired?: boolean;\n multiline?: boolean;\n maxLength?: number;\n placeholder?: string;\n rows: number;\n type: string;\n name?: string;\n value?: string;\n setFocus(focus: boolean): void;\n recomputeNumberOfRows(target: Element): void;\n onChange(value: string, name?: string, event?: SyntheticEvent): void;\n onFocus?(value: React.FocusEvent): void;\n onBlur?(value: React.FocusEvent): void;\n}\n\nconst renderInputNative: React.FC<InputNativeProps> = (props) => {\n const {\n id,\n isDisabled,\n isRequired,\n placeholder,\n multiline,\n value,\n setFocus,\n onChange,\n onFocus,\n onBlur,\n inputRef,\n rows,\n recomputeNumberOfRows,\n type,\n name,\n ...forwardedProps\n } = props;\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const ref = useRef<HTMLElement>(null);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n // Recompute the number of rows for the first rendering\n if (multiline && ref && ref.current) {\n recomputeNumberOfRows(ref.current);\n }\n }, [ref, multiline, recomputeNumberOfRows, value]);\n\n const onTextFieldFocus = (event: React.FocusEvent) => {\n onFocus?.(event);\n setFocus(true);\n };\n\n const onTextFieldBlur = (event: React.FocusEvent) => {\n onBlur?.(event);\n setFocus(false);\n };\n\n const handleChange = (event: React.ChangeEvent) => {\n onChange(get(event, 'target.value'), name, event);\n };\n\n const Component = multiline ? 'textarea' : 'input';\n const inputProps: any = {\n ...forwardedProps,\n id,\n className: multiline\n ? `${CLASSNAME}__input-native ${CLASSNAME}__input-native--textarea`\n : `${CLASSNAME}__input-native ${CLASSNAME}__input-native--text`,\n placeholder,\n value,\n name,\n disabled: isDisabled,\n required: isRequired,\n onFocus: onTextFieldFocus,\n onBlur: onTextFieldBlur,\n onChange: handleChange,\n ref: mergeRefs(inputRef as any, ref) as any,\n };\n if (multiline) {\n inputProps.rows = rows;\n } else {\n inputProps.type = type;\n }\n return <Component {...inputProps} />;\n};\n\n/**\n * TextField component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const TextField: Comp<TextFieldProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n chips,\n className,\n clearButtonProps,\n disabled,\n error,\n forceFocusStyle,\n hasError,\n helper,\n icon,\n id,\n inputRef,\n isDisabled = disabled,\n isRequired,\n isValid,\n label,\n maxLength,\n minimumRows,\n multiline,\n name,\n onBlur,\n onChange,\n onFocus,\n placeholder,\n textFieldRef,\n theme,\n type,\n value,\n afterElement,\n ...forwardedProps\n } = props;\n const textFieldId = useMemo(() => id || `text-field-${uid()}`, [id]);\n const [isFocus, setFocus] = useState(false);\n const { rows, recomputeNumberOfRows } = useComputeNumberOfRows(multiline ? minimumRows || DEFAULT_MIN_ROWS : 0);\n const valueLength = (value || '').length;\n const isNotEmpty = valueLength > 0;\n\n /**\n * Function triggered when the Clear Button is clicked.\n * The idea is to execute the `onChange` callback with an empty string\n * and remove focus from the clear button.\n * @param evt On clear event.\n */\n const onClear = (evt: React.ChangeEvent) => {\n evt.nativeEvent.preventDefault();\n evt.nativeEvent.stopPropagation();\n (evt.currentTarget as HTMLElement).blur();\n\n onChange('');\n };\n\n return (\n <div\n ref={ref}\n className={classNames(\n className,\n handleBasicClasses({\n hasChips: Boolean(chips),\n hasError: !isValid && hasError,\n hasIcon: Boolean(icon),\n hasInput: !multiline,\n hasInputClear: clearButtonProps && isNotEmpty,\n hasLabel: Boolean(label),\n hasPlaceholder: Boolean(placeholder),\n hasTextarea: multiline,\n hasValue: Boolean(value),\n isDisabled,\n isFocus: isFocus || forceFocusStyle,\n isValid,\n prefix: CLASSNAME,\n theme,\n }),\n )}\n >\n {(label || maxLength) && (\n <div className={`${CLASSNAME}__header`}>\n {label && (\n <InputLabel\n htmlFor={textFieldId}\n className={`${CLASSNAME}__label`}\n isRequired={isRequired}\n theme={theme}\n >\n {label}\n </InputLabel>\n )}\n\n {maxLength && (\n <div className={`${CLASSNAME}__char-counter`}>\n <span>{maxLength - valueLength}</span>\n {maxLength - valueLength === 0 && <Icon icon={mdiAlertCircle} size={Size.xxs} />}\n </div>\n )}\n </div>\n )}\n\n <div className={`${CLASSNAME}__wrapper`} ref={textFieldRef}>\n {icon && (\n <Icon\n className={`${CLASSNAME}__input-icon`}\n color={theme === Theme.dark ? 'light' : undefined}\n icon={icon}\n size={Size.xs}\n />\n )}\n\n {chips && (\n <div className={`${CLASSNAME}__chips`}>\n {chips}\n\n {renderInputNative({\n id: textFieldId,\n inputRef,\n isDisabled,\n isRequired,\n maxLength,\n multiline,\n onBlur,\n onChange,\n onFocus,\n placeholder,\n recomputeNumberOfRows,\n rows,\n setFocus,\n type,\n value,\n name,\n ...forwardedProps,\n })}\n </div>\n )}\n\n {!chips && (\n <div className={`${CLASSNAME}__input-wrapper`}>\n {renderInputNative({\n id: textFieldId,\n inputRef,\n isDisabled,\n isRequired,\n maxLength,\n multiline,\n onBlur,\n onChange,\n onFocus,\n placeholder,\n recomputeNumberOfRows,\n rows,\n setFocus,\n type,\n value,\n name,\n ...forwardedProps,\n })}\n </div>\n )}\n\n {(isValid || hasError) && (\n <Icon\n className={`${CLASSNAME}__input-validity`}\n color={theme === Theme.dark ? 'light' : undefined}\n icon={isValid ? mdiCheckCircle : mdiAlertCircle}\n size={Size.xxs}\n />\n )}\n\n {clearButtonProps && isNotEmpty && (\n <IconButton\n {...clearButtonProps}\n className={`${CLASSNAME}__input-clear`}\n icon={mdiCloseCircle}\n emphasis={Emphasis.low}\n size={Size.s}\n theme={theme}\n onClick={onClear}\n type=\"button\"\n />\n )}\n\n {afterElement && <div className={`${CLASSNAME}__after-element`}>{afterElement}</div>}\n </div>\n\n {hasError && error && (\n <InputHelper className={`${CLASSNAME}__helper`} kind={Kind.error} theme={theme}>\n {error}\n </InputHelper>\n )}\n\n {helper && (\n <InputHelper className={`${CLASSNAME}__helper`} theme={theme}>\n {helper}\n </InputHelper>\n )}\n </div>\n );\n});\nTextField.displayName = COMPONENT_NAME;\nTextField.className = CLASSNAME;\nTextField.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_MIN_ROWS","DEFAULT_PROPS","theme","Theme","light","type","useComputeNumberOfRows","minimumRows","useState","rows","setRows","recompute","target","currentRows","scrollHeight","clientHeight","recomputeNumberOfRows","renderInputNative","props","id","isDisabled","isRequired","placeholder","multiline","value","setFocus","onChange","onFocus","onBlur","inputRef","name","forwardedProps","ref","useRef","useEffect","current","onTextFieldFocus","event","onTextFieldBlur","handleChange","get","Component","inputProps","className","disabled","required","mergeRefs","TextField","forwardRef","chips","clearButtonProps","error","forceFocusStyle","hasError","helper","icon","isValid","label","maxLength","textFieldRef","afterElement","textFieldId","useMemo","uid","isFocus","valueLength","length","isNotEmpty","onClear","evt","nativeEvent","preventDefault","stopPropagation","currentTarget","blur","classNames","handleBasicClasses","hasChips","Boolean","hasIcon","hasInput","hasInputClear","hasLabel","hasPlaceholder","hasTextarea","hasValue","prefix","mdiAlertCircle","Size","xxs","dark","undefined","xs","mdiCheckCircle","mdiCloseCircle","Emphasis","low","s","Kind","displayName","defaultProps"],"mappings":";;;;;;;;;;;;;AAWA;;;;AAyDA;;;AAGA,IAAMA,cAAc,GAAG,WAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,gBAAgB,GAAG,CAAzB;AAEA;;;;AAGA,IAAMC,aAAsC,GAAG;AAC3CC,EAAAA,KAAK,EAAEC,KAAK,CAACC,KAD8B;AAE3CC,EAAAA,IAAI,EAAE;AAFqC,CAA/C;AAKA;;;;;;AAKA,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAyB,CAC3BC,WAD2B,EAS1B;AAAA,kBACuBC,QAAQ,CAACD,WAAD,CAD/B;AAAA;AAAA,MACME,IADN;AAAA,MACYC,OADZ;;AAGD,MAAMC,SAAS,GAAG,SAAZA,SAAY,CAACC,MAAD,EAAqB;AACnC;;;;;;;;;;;;;;AAcA;AACCA,IAAAA,MAAD,CAAgCH,IAAhC,GAAuCF,WAAvC;AACA,QAAIM,WAAW,GAAGD,MAAM,CAACE,YAAP,IAAuBF,MAAM,CAACG,YAAP,GAAsBR,WAA7C,CAAlB;AACAM,IAAAA,WAAW,GAAGA,WAAW,IAAIN,WAAf,GAA6BM,WAA7B,GAA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vC,gBAAgB,IAAIiB,UAApB,IACG,oBAAC,UAAD,eACQjB,gBADR;AAEI,IAAA,SAAS,YAAKpD,SAAL,kBAFb;AAGI,IAAA,IAAI,EAAEgG,cAHV;AAII,IAAA,QAAQ,EAAEC,QAAQ,CAACC,GAJvB;AAKI,IAAA,IAAI,EAAER,IAAI,CAACS,CALf;AAMI,IAAA,KAAK,EAAE/F,KANX;AAOI,IAAA,OAAO,EAAEkE,OAPb;AAQI,IAAA,IAAI,EAAC;AART,KAtER,EAkFKR,YAAY,IAAI;AAAK,IAAA,SAAS,YAAK9D,SAAL;AAAd,KAAgD8D,YAAhD,CAlFrB,CA5CJ,EAiIKP,QAAQ,IAAIF,KAAZ,IACG,oBAAC,WAAD;AAAa,IAAA,SAAS,YAAKrD,SAAL,aAAtB;AAAgD,IAAA,IAAI,EAAEoG,IAAI,CAAC/C,KAA3D;AAAkE,IAAA,KAAK,EAAEjD;AAAzE,KACKiD,KADL,CAlIR,EAuIKG,MAAM,IACH,oBAAC,WAAD;AAAa,IAAA,SAAS,YAAKxD,SAAL,aAAtB;AAAgD,IAAA,KAAK,EAAEI;AAAvD,KACKoD,MADL,CAxIR,CADJ;AA+IH,CAnMwE;AAoMzEP,SAAS,CAACoD,WAAV,GAAwBtG,cAAxB;AACAkD,SAAS,CAACJ,SAAV,GAAsB7C,SAAtB;AACAiD,SAAS,CAACqD,YAAV,GAAyBnG,aAAzB;;;;"}
@@ -108,6 +108,7 @@ var UserBlock = forwardRef(function (props, ref) {
108
108
  onMouseLeave: onMouseLeave,
109
109
  onMouseEnter: onMouseEnter
110
110
  }), avatarProps && React.createElement(Avatar, _extends({
111
+ linkAs: linkAs,
111
112
  linkProps: linkProps
112
113
  }, avatarProps, {
113
114
  className: classnames("".concat(CLASSNAME, "__avatar"), avatarProps.className),
@@ -1 +1 @@
1
- {"version":3,"file":"UserBlock.js","sources":["../../../src/components/user-block/UserBlock.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Avatar, Orientation, Size, Theme } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport { isEmpty } from 'lodash';\nimport { renderLink } from '@lumx/react/utils/renderLink';\nimport { AvatarProps } from '../avatar/Avatar';\n\n/**\n * User block sizes.\n */\nexport type UserBlockSize = Extract<Size, 's' | 'm' | 'l'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface UserBlockProps extends GenericProps {\n /** Props to pass to the avatar. */\n avatarProps?: AvatarProps;\n /** Props to pass to the link wrapping the avatar thumbnail. */\n linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n /** Simple action toolbar content. */\n simpleAction?: ReactNode;\n /** Multiple action toolbar content. */\n multipleActions?: ReactNode;\n /** Additional fields used to describe the user. */\n fields?: string[];\n /** User name. */\n name?: string;\n /** Orientation. */\n orientation?: Orientation;\n /** Size variant. */\n size?: UserBlockSize;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** On click callback. */\n onClick?(): void;\n /** On mouse enter callback. */\n onMouseEnter?(): void;\n /** On mouse leave callback. */\n onMouseLeave?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'UserBlock';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<UserBlockProps> = {\n orientation: Orientation.horizontal,\n size: Size.m,\n theme: Theme.light,\n};\n\n/**\n * UserBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const UserBlock: Comp<UserBlockProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n avatarProps,\n className,\n fields,\n multipleActions,\n name,\n onClick,\n onMouseEnter,\n onMouseLeave,\n orientation,\n simpleAction,\n size,\n theme,\n linkProps,\n linkAs,\n ...forwardedProps\n } = props;\n let componentSize = size;\n\n // Special case - When using vertical orientation force the size to be Sizes.l.\n if (orientation === Orientation.vertical) {\n componentSize = Size.l;\n }\n\n const shouldDisplayActions: boolean = orientation === Orientation.vertical;\n\n const isLink = Boolean(linkProps?.href || linkAs);\n const isClickable = !!onClick || isLink;\n\n const nameBlock: ReactNode = React.useMemo(() => {\n if (isEmpty(name)) {\n return null;\n }\n const nameClassName = classNames(\n handleBasicClasses({ prefix: `${CLASSNAME}__name`, isClickable }),\n isLink && linkProps?.className,\n );\n if (isLink) {\n return renderLink({ ...linkProps, linkAs, className: nameClassName }, name);\n }\n if (onClick) {\n return (\n <button onClick={onClick} type=\"button\" className={nameClassName}>\n {name}\n </button>\n );\n }\n return <span className={nameClassName}>{name}</span>;\n }, [isClickable, isLink, linkAs, linkProps, name, onClick]);\n\n const fieldsBlock: ReactNode = fields && componentSize !== Size.s && (\n <div className={`${CLASSNAME}__fields`}>\n {fields.map((aField: string, idx: number) => (\n <span key={idx} className={`${CLASSNAME}__field`}>\n {aField}\n </span>\n ))}\n </div>\n );\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({ prefix: CLASSNAME, orientation, size: componentSize, theme, isClickable }),\n )}\n onMouseLeave={onMouseLeave}\n onMouseEnter={onMouseEnter}\n >\n {avatarProps && (\n <Avatar\n linkProps={linkProps}\n {...avatarProps}\n className={classNames(`${CLASSNAME}__avatar`, avatarProps.className)}\n size={componentSize}\n onClick={onClick}\n theme={theme}\n />\n )}\n {(fields || name) && (\n <div className={`${CLASSNAME}__wrapper`}>\n {nameBlock}\n {fieldsBlock}\n </div>\n )}\n {shouldDisplayActions && simpleAction && <div className={`${CLASSNAME}__action`}>{simpleAction}</div>}\n {shouldDisplayActions && multipleActions && (\n <div className={`${CLASSNAME}__actions`}>{multipleActions}</div>\n )}\n </div>\n );\n});\nUserBlock.displayName = COMPONENT_NAME;\nUserBlock.className = CLASSNAME;\nUserBlock.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","orientation","Orientation","horizontal","size","Size","m","theme","Theme","light","UserBlock","forwardRef","props","ref","avatarProps","className","fields","multipleActions","name","onClick","onMouseEnter","onMouseLeave","simpleAction","linkProps","linkAs","forwardedProps","componentSize","vertical","l","shouldDisplayActions","isLink","Boolean","href","isClickable","nameBlock","React","useMemo","isEmpty","nameClassName","classNames","handleBasicClasses","prefix","renderLink","fieldsBlock","s","map","aField","idx","displayName","defaultProps"],"mappings":";;;;;;;;AAgDA;;;AAGA,IAAMA,cAAc,GAAG,WAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAsC,GAAG;AAC3CC,EAAAA,WAAW,EAAEC,WAAW,CAACC,UADkB;AAE3CC,EAAAA,IAAI,EAAEC,IAAI,CAACC,CAFgC;AAG3CC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAH8B,CAA/C;AAMA;;;;;;;;IAOaC,SAA+C,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAElFC,WAFkF,GAiBlFF,KAjBkF,CAElFE,WAFkF;AAAA,MAGlFC,SAHkF,GAiBlFH,KAjBkF,CAGlFG,SAHkF;AAAA,MAIlFC,MAJkF,GAiBlFJ,KAjBkF,CAIlFI,MAJkF;AAAA,MAKlFC,eALkF,GAiBlFL,KAjBkF,CAKlFK,eALkF;AAAA,MAMlFC,IANkF,GAiBlFN,KAjBkF,CAMlFM,IANkF;AAAA,MAOlFC,OAPkF,GAiBlFP,KAjBkF,CAOlFO,OAPkF;AAAA,MAQlFC,YARkF,GAiBlFR,KAjBkF,CAQlFQ,YARkF;AAAA,MASlFC,YATkF,GAiBlFT,KAjBkF,CASlFS,YATkF;AAAA,MAUlFpB,WAVkF,GAiBlFW,KAjBkF,CAUlFX,WA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EAAEW,aAJV;AAKI,IAAA,OAAO,EAAEP,OALb;AAMI,IAAA,KAAK,EAAEZ;AANX,KAXR,EAoBK,CAACS,MAAM,IAAIE,IAAX,KACG;AAAK,IAAA,SAAS,YAAKpB,SAAL;AAAd,KACKoC,SADL,EAEKS,WAFL,CArBR,EA0BKd,oBAAoB,IAAIP,YAAxB,IAAwC;AAAK,IAAA,SAAS,YAAKxB,SAAL;AAAd,KAAyCwB,YAAzC,CA1B7C,EA2BKO,oBAAoB,IAAIZ,eAAxB,IACG;AAAK,IAAA,SAAS,YAAKnB,SAAL;AAAd,KAA0CmB,eAA1C,CA5BR,CADJ;AAiCH,CA9FwE;AA+FzEP,SAAS,CAACsC,WAAV,GAAwBnD,cAAxB;AACAa,SAAS,CAACK,SAAV,GAAsBjB,SAAtB;AACAY,SAAS,CAACuC,YAAV,GAAyBjD,aAAzB;;;;"}
1
+ {"version":3,"file":"UserBlock.js","sources":["../../../src/components/user-block/UserBlock.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Avatar, Orientation, Size, Theme } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport { isEmpty } from 'lodash';\nimport { renderLink } from '@lumx/react/utils/renderLink';\nimport { AvatarProps } from '../avatar/Avatar';\n\n/**\n * User block sizes.\n */\nexport type UserBlockSize = Extract<Size, 's' | 'm' | 'l'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface UserBlockProps extends GenericProps {\n /** Props to pass to the avatar. */\n avatarProps?: AvatarProps;\n /** Props to pass to the link wrapping the avatar thumbnail. */\n linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n /** Simple action toolbar content. */\n simpleAction?: ReactNode;\n /** Multiple action toolbar content. */\n multipleActions?: ReactNode;\n /** Additional fields used to describe the user. */\n fields?: string[];\n /** User name. */\n name?: string;\n /** Orientation. */\n orientation?: Orientation;\n /** Size variant. */\n size?: UserBlockSize;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** On click callback. */\n onClick?(): void;\n /** On mouse enter callback. */\n onMouseEnter?(): void;\n /** On mouse leave callback. */\n onMouseLeave?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'UserBlock';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<UserBlockProps> = {\n orientation: Orientation.horizontal,\n size: Size.m,\n theme: Theme.light,\n};\n\n/**\n * UserBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const UserBlock: Comp<UserBlockProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n avatarProps,\n className,\n fields,\n multipleActions,\n name,\n onClick,\n onMouseEnter,\n onMouseLeave,\n orientation,\n simpleAction,\n size,\n theme,\n linkProps,\n linkAs,\n ...forwardedProps\n } = props;\n let componentSize = size;\n\n // Special case - When using vertical orientation force the size to be Sizes.l.\n if (orientation === Orientation.vertical) {\n componentSize = Size.l;\n }\n\n const shouldDisplayActions: boolean = orientation === Orientation.vertical;\n\n const isLink = Boolean(linkProps?.href || linkAs);\n const isClickable = !!onClick || isLink;\n\n const nameBlock: ReactNode = React.useMemo(() => {\n if (isEmpty(name)) {\n return null;\n }\n const nameClassName = classNames(\n handleBasicClasses({ prefix: `${CLASSNAME}__name`, isClickable }),\n isLink && linkProps?.className,\n );\n if (isLink) {\n return renderLink({ ...linkProps, linkAs, className: nameClassName }, name);\n }\n if (onClick) {\n return (\n <button onClick={onClick} type=\"button\" className={nameClassName}>\n {name}\n </button>\n );\n }\n return <span className={nameClassName}>{name}</span>;\n }, [isClickable, isLink, linkAs, linkProps, name, onClick]);\n\n const fieldsBlock: ReactNode = fields && componentSize !== Size.s && (\n <div className={`${CLASSNAME}__fields`}>\n {fields.map((aField: string, idx: number) => (\n <span key={idx} className={`${CLASSNAME}__field`}>\n {aField}\n </span>\n ))}\n </div>\n );\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({ prefix: CLASSNAME, orientation, size: componentSize, theme, isClickable }),\n )}\n onMouseLeave={onMouseLeave}\n onMouseEnter={onMouseEnter}\n >\n {avatarProps && (\n <Avatar\n linkAs={linkAs}\n linkProps={linkProps}\n {...avatarProps}\n className={classNames(`${CLASSNAME}__avatar`, avatarProps.className)}\n size={componentSize}\n onClick={onClick}\n theme={theme}\n />\n )}\n {(fields || name) && (\n <div className={`${CLASSNAME}__wrapper`}>\n {nameBlock}\n {fieldsBlock}\n </div>\n )}\n {shouldDisplayActions && simpleAction && <div className={`${CLASSNAME}__action`}>{simpleAction}</div>}\n {shouldDisplayActions && multipleActions && (\n <div className={`${CLASSNAME}__actions`}>{multipleActions}</div>\n )}\n </div>\n );\n});\nUserBlock.displayName = COMPONENT_NAME;\nUserBlock.className = CLASSNAME;\nUserBlock.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","orientation","Orientation","horizontal","size","Size","m","theme","Theme","light","UserBlock","forwardRef","props","ref","avatarProps","className","fields","multipleActions","name","onClick","onMouseEnter","onMouseLeave","simpleAction","linkProps","linkAs","forwardedProps","componentSize","vertical","l","shouldDisplayActions","isLink","Boolean","href","isClickable","nameBlock","React","useMemo","isEmpty","nameClassName","classNames","handleBasicClasses","prefix","renderLink","fieldsBlock","s","map","aField","idx","displayName","defaultProps"],"mappings":";;;;;;;;AAgDA;;;AAGA,IAAMA,cAAc,GAAG,WAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAsC,GAAG;AAC3CC,EAAAA,WAAW,EAAEC,WAAW,CAACC,UADkB;AAE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