@lumx/react 3.20.1-alpha.12 → 3.20.1-alpha.14
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.
- package/_internal/index.js +236 -0
- package/_internal/index.js.map +1 -0
- package/index.d.ts +1 -1
- package/index.js +14440 -65
- package/index.js.map +1 -1
- package/package.json +11 -3
- package/src/components/alert-dialog/AlertDialog.stories.tsx +127 -0
- package/src/components/alert-dialog/AlertDialog.test.tsx +34 -0
- package/src/components/alert-dialog/AlertDialog.tsx +189 -0
- package/src/components/alert-dialog/index.ts +1 -0
- package/src/components/autocomplete/Autocomplete.stories.tsx +75 -0
- package/src/components/autocomplete/Autocomplete.test.tsx +99 -0
- package/src/components/autocomplete/Autocomplete.tsx +294 -0
- package/src/components/autocomplete/AutocompleteMultiple.stories.tsx +167 -0
- package/src/components/autocomplete/AutocompleteMultiple.test.tsx +61 -0
- package/src/components/autocomplete/AutocompleteMultiple.tsx +156 -0
- package/src/components/autocomplete/__mockData__/index.ts +39 -0
- package/src/components/autocomplete/index.ts +2 -0
- package/src/components/avatar/Avatar.stories.tsx +119 -0
- package/src/components/avatar/Avatar.test.tsx +32 -0
- package/src/components/avatar/Avatar.tsx +114 -0
- package/src/components/avatar/index.ts +1 -0
- package/src/components/badge/Badge.stories.tsx +69 -0
- package/src/components/badge/Badge.test.tsx +45 -0
- package/src/components/badge/Badge.tsx +58 -0
- package/src/components/badge/BadgeWrapper.stories.tsx +75 -0
- package/src/components/badge/BadgeWrapper.test.tsx +47 -0
- package/src/components/badge/BadgeWrapper.tsx +37 -0
- package/src/components/badge/index.ts +2 -0
- package/src/components/button/Button.stories.tsx +355 -0
- package/src/components/button/Button.test.tsx +125 -0
- package/src/components/button/Button.tsx +101 -0
- package/src/components/button/ButtonGroup.stories.tsx +52 -0
- package/src/components/button/ButtonGroup.test.tsx +41 -0
- package/src/components/button/ButtonGroup.tsx +50 -0
- package/src/components/button/ButtonRoot.tsx +163 -0
- package/src/components/button/IconButton.stories.tsx +52 -0
- package/src/components/button/IconButton.test.tsx +66 -0
- package/src/components/button/IconButton.tsx +91 -0
- package/src/components/button/index.ts +4 -0
- package/src/components/checkbox/Checkbox.stories.tsx +64 -0
- package/src/components/checkbox/Checkbox.test.tsx +154 -0
- package/src/components/checkbox/Checkbox.tsx +164 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/chip/Chip.stories.tsx +164 -0
- package/src/components/chip/Chip.test.tsx +243 -0
- package/src/components/chip/Chip.tsx +168 -0
- package/src/components/chip/ChipGroup.stories.tsx +47 -0
- package/src/components/chip/ChipGroup.test.tsx +37 -0
- package/src/components/chip/ChipGroup.tsx +60 -0
- package/src/components/chip/index.ts +2 -0
- package/src/components/comment-block/CommentBlock.stories.tsx +91 -0
- package/src/components/comment-block/CommentBlock.test.tsx +28 -0
- package/src/components/comment-block/CommentBlock.tsx +172 -0
- package/src/components/comment-block/index.ts +1 -0
- package/src/components/date-picker/DatePicker.stories.tsx +118 -0
- package/src/components/date-picker/DatePicker.test.tsx +34 -0
- package/src/components/date-picker/DatePicker.tsx +52 -0
- package/src/components/date-picker/DatePickerControlled.test.tsx +91 -0
- package/src/components/date-picker/DatePickerControlled.tsx +259 -0
- package/src/components/date-picker/DatePickerField.stories.tsx +100 -0
- package/src/components/date-picker/DatePickerField.test.tsx +70 -0
- package/src/components/date-picker/DatePickerField.tsx +135 -0
- package/src/components/date-picker/constants.ts +11 -0
- package/src/components/date-picker/index.ts +4 -0
- package/src/components/date-picker/types.ts +28 -0
- package/src/components/dialog/Dialog.stories.tsx +318 -0
- package/src/components/dialog/Dialog.test.tsx +97 -0
- package/src/components/dialog/Dialog.tsx +288 -0
- package/src/components/dialog/index.ts +1 -0
- package/src/components/divider/Divider.test.tsx +51 -0
- package/src/components/divider/Divider.tsx +50 -0
- package/src/components/divider/index.ts +1 -0
- package/src/components/drag-handle/DragHandle.test.tsx +36 -0
- package/src/components/drag-handle/DragHandle.tsx +51 -0
- package/src/components/drag-handle/index.ts +1 -0
- package/src/components/dropdown/Dropdown.stories.tsx +31 -0
- package/src/components/dropdown/Dropdown.test.tsx +66 -0
- package/src/components/dropdown/Dropdown.tsx +186 -0
- package/src/components/dropdown/index.ts +1 -0
- package/src/components/expansion-panel/ExpansionPanel.stories.tsx +91 -0
- package/src/components/expansion-panel/ExpansionPanel.test.tsx +185 -0
- package/src/components/expansion-panel/ExpansionPanel.tsx +195 -0
- package/src/components/expansion-panel/index.ts +1 -0
- package/src/components/flag/Flag.stories.tsx +48 -0
- package/src/components/flag/Flag.test.tsx +62 -0
- package/src/components/flag/Flag.tsx +52 -0
- package/src/components/flag/index.ts +1 -0
- package/src/components/flex-box/FlexBox.stories.tsx +156 -0
- package/src/components/flex-box/FlexBox.test.tsx +24 -0
- package/src/components/flex-box/FlexBox.tsx +100 -0
- package/src/components/flex-box/index.ts +1 -0
- package/src/components/generic-block/GenericBlock.stories.jsx +128 -0
- package/src/components/generic-block/GenericBlock.test.tsx +156 -0
- package/src/components/generic-block/GenericBlock.tsx +225 -0
- package/src/components/generic-block/constants.ts +9 -0
- package/src/components/generic-block/index.ts +2 -0
- package/src/components/grid/Grid.tsx +83 -0
- package/src/components/grid/GridItem.tsx +55 -0
- package/src/components/grid/index.ts +2 -0
- package/src/components/grid-column/GridColumn.stories.tsx +45 -0
- package/src/components/grid-column/GridColumn.test.jsx +56 -0
- package/src/components/grid-column/GridColumn.tsx +83 -0
- package/src/components/grid-column/index.ts +1 -0
- package/src/components/heading/Heading.stories.tsx +69 -0
- package/src/components/heading/Heading.test.tsx +82 -0
- package/src/components/heading/Heading.tsx +65 -0
- package/src/components/heading/HeadingLevelProvider.tsx +30 -0
- package/src/components/heading/constants.ts +16 -0
- package/src/components/heading/context.tsx +13 -0
- package/src/components/heading/index.ts +3 -0
- package/src/components/heading/useHeadingLevel.tsx +8 -0
- package/src/components/icon/Icon.stories.tsx +73 -0
- package/src/components/icon/Icon.test.tsx +125 -0
- package/src/components/icon/Icon.tsx +133 -0
- package/src/components/icon/index.ts +1 -0
- package/src/components/image-block/ImageBlock.stories.tsx +117 -0
- package/src/components/image-block/ImageBlock.test.tsx +58 -0
- package/src/components/image-block/ImageBlock.tsx +142 -0
- package/src/components/image-block/ImageCaption.tsx +115 -0
- package/src/components/image-block/index.ts +1 -0
- package/src/components/image-lightbox/ImageLightbox.stories.tsx +160 -0
- package/src/components/image-lightbox/ImageLightbox.test.tsx +254 -0
- package/src/components/image-lightbox/ImageLightbox.tsx +90 -0
- package/src/components/image-lightbox/constants.ts +11 -0
- package/src/components/image-lightbox/index.ts +2 -0
- package/src/components/image-lightbox/internal/ImageSlide.tsx +107 -0
- package/src/components/image-lightbox/internal/ImageSlideshow.tsx +164 -0
- package/src/components/image-lightbox/internal/useAnimateScroll.ts +55 -0
- package/src/components/image-lightbox/internal/usePointerZoom.ts +148 -0
- package/src/components/image-lightbox/types.ts +48 -0
- package/src/components/image-lightbox/useImageLightbox.tsx +141 -0
- package/src/components/inline-list/InlineList.stories.tsx +77 -0
- package/src/components/inline-list/InlineList.test.tsx +52 -0
- package/src/components/inline-list/InlineList.tsx +96 -0
- package/src/components/inline-list/index.ts +1 -0
- package/src/components/input-helper/InputHelper.stories.tsx +35 -0
- package/src/components/input-helper/InputHelper.test.tsx +55 -0
- package/src/components/input-helper/InputHelper.tsx +65 -0
- package/src/components/input-helper/constants.ts +11 -0
- package/src/components/input-helper/index.ts +1 -0
- package/src/components/input-label/InputLabel.stories.tsx +45 -0
- package/src/components/input-label/InputLabel.test.tsx +59 -0
- package/src/components/input-label/InputLabel.tsx +69 -0
- package/src/components/input-label/index.ts +1 -0
- package/src/components/lightbox/Lightbox.stories.tsx +101 -0
- package/src/components/lightbox/Lightbox.test.tsx +53 -0
- package/src/components/lightbox/Lightbox.tsx +180 -0
- package/src/components/lightbox/index.ts +1 -0
- package/src/components/link/Link.stories.tsx +195 -0
- package/src/components/link/Link.test.tsx +127 -0
- package/src/components/link/Link.tsx +106 -0
- package/src/components/link/index.ts +1 -0
- package/src/components/link-preview/LinkPreview.stories.tsx +61 -0
- package/src/components/link-preview/LinkPreview.test.tsx +105 -0
- package/src/components/link-preview/LinkPreview.tsx +158 -0
- package/src/components/link-preview/index.ts +1 -0
- package/src/components/list/List.stories.tsx +116 -0
- package/src/components/list/List.test.tsx +18 -0
- package/src/components/list/List.tsx +104 -0
- package/src/components/list/ListDivider.stories.tsx +12 -0
- package/src/components/list/ListDivider.test.tsx +22 -0
- package/src/components/list/ListDivider.tsx +35 -0
- package/src/components/list/ListItem.stories.tsx +66 -0
- package/src/components/list/ListItem.test.tsx +93 -0
- package/src/components/list/ListItem.tsx +157 -0
- package/src/components/list/ListSubheader.stories.tsx +11 -0
- package/src/components/list/ListSubheader.test.tsx +21 -0
- package/src/components/list/ListSubheader.tsx +44 -0
- package/src/components/list/index.ts +4 -0
- package/src/components/list/useInteractiveList.tsx +202 -0
- package/src/components/message/Message.stories.tsx +72 -0
- package/src/components/message/Message.test.tsx +76 -0
- package/src/components/message/Message.tsx +100 -0
- package/src/components/message/index.ts +1 -0
- package/src/components/mosaic/Mosaic.stories.tsx +89 -0
- package/src/components/mosaic/Mosaic.test.tsx +77 -0
- package/src/components/mosaic/Mosaic.tsx +98 -0
- package/src/components/mosaic/index.ts +1 -0
- package/src/components/navigation/Navigation.stories.tsx +234 -0
- package/src/components/navigation/Navigation.test.tsx +65 -0
- package/src/components/navigation/Navigation.tsx +79 -0
- package/src/components/navigation/NavigationItem.test.tsx +35 -0
- package/src/components/navigation/NavigationItem.tsx +82 -0
- package/src/components/navigation/NavigationSection.test.tsx +137 -0
- package/src/components/navigation/NavigationSection.tsx +108 -0
- package/src/components/navigation/context.tsx +7 -0
- package/src/components/navigation/index.ts +1 -0
- package/src/components/notification/Notification.test.tsx +94 -0
- package/src/components/notification/Notification.tsx +138 -0
- package/src/components/notification/Notifications.stories.tsx +92 -0
- package/src/components/notification/constants.ts +28 -0
- package/src/components/notification/index.ts +1 -0
- package/src/components/popover/Popover.stories.tsx +264 -0
- package/src/components/popover/Popover.test.tsx +62 -0
- package/src/components/popover/Popover.tsx +201 -0
- package/src/components/popover/constants.ts +62 -0
- package/src/components/popover/index.ts +3 -0
- package/src/components/popover/usePopoverStyle.tsx +184 -0
- package/src/components/popover/useRestoreFocusOnClose.tsx +47 -0
- package/src/components/popover-dialog/PopoverDialog.stories.tsx +64 -0
- package/src/components/popover-dialog/PopoverDialog.test.tsx +139 -0
- package/src/components/popover-dialog/PopoverDialog.tsx +74 -0
- package/src/components/popover-dialog/index.tsx +1 -0
- package/src/components/post-block/PostBlock.test.tsx +27 -0
- package/src/components/post-block/PostBlock.tsx +122 -0
- package/src/components/post-block/index.ts +1 -0
- package/src/components/progress/Progress.tsx +68 -0
- package/src/components/progress/ProgressCircular.stories.tsx +43 -0
- package/src/components/progress/ProgressCircular.test.tsx +46 -0
- package/src/components/progress/ProgressCircular.tsx +82 -0
- package/src/components/progress/ProgressLinear.stories.tsx +12 -0
- package/src/components/progress/ProgressLinear.test.tsx +30 -0
- package/src/components/progress/ProgressLinear.tsx +50 -0
- package/src/components/progress/index.ts +3 -0
- package/src/components/progress-tracker/ProgressTracker.stories.tsx +145 -0
- package/src/components/progress-tracker/ProgressTracker.test.tsx +42 -0
- package/src/components/progress-tracker/ProgressTracker.tsx +87 -0
- package/src/components/progress-tracker/ProgressTrackerProvider.test.tsx +65 -0
- package/src/components/progress-tracker/ProgressTrackerProvider.tsx +67 -0
- package/src/components/progress-tracker/ProgressTrackerStep.test.tsx +36 -0
- package/src/components/progress-tracker/ProgressTrackerStep.tsx +159 -0
- package/src/components/progress-tracker/ProgressTrackerStepPanel.test.tsx +34 -0
- package/src/components/progress-tracker/ProgressTrackerStepPanel.tsx +67 -0
- package/src/components/progress-tracker/index.ts +4 -0
- package/src/components/radio-button/RadioButton.stories.tsx +71 -0
- package/src/components/radio-button/RadioButton.test.tsx +143 -0
- package/src/components/radio-button/RadioButton.tsx +143 -0
- package/src/components/radio-button/RadioGroup.stories.tsx +39 -0
- package/src/components/radio-button/RadioGroup.test.tsx +29 -0
- package/src/components/radio-button/RadioGroup.tsx +44 -0
- package/src/components/radio-button/index.ts +2 -0
- package/src/components/select/Select.stories.tsx +385 -0
- package/src/components/select/Select.test.tsx +199 -0
- package/src/components/select/Select.tsx +199 -0
- package/src/components/select/SelectMultiple.stories.tsx +315 -0
- package/src/components/select/SelectMultiple.test.tsx +213 -0
- package/src/components/select/SelectMultiple.tsx +206 -0
- package/src/components/select/WithSelectContext.tsx +147 -0
- package/src/components/select/constants.ts +55 -0
- package/src/components/select/index.ts +2 -0
- package/src/components/side-navigation/SideNavigation.stories.tsx +191 -0
- package/src/components/side-navigation/SideNavigation.test.tsx +37 -0
- package/src/components/side-navigation/SideNavigation.tsx +52 -0
- package/src/components/side-navigation/SideNavigationItem.stories.tsx +133 -0
- package/src/components/side-navigation/SideNavigationItem.test.tsx +136 -0
- package/src/components/side-navigation/SideNavigationItem.tsx +165 -0
- package/src/components/side-navigation/index.ts +2 -0
- package/src/components/skeleton/SkeletonCircle.stories.tsx +41 -0
- package/src/components/skeleton/SkeletonCircle.test.tsx +27 -0
- package/src/components/skeleton/SkeletonCircle.tsx +52 -0
- package/src/components/skeleton/SkeletonRectangle.stories.tsx +82 -0
- package/src/components/skeleton/SkeletonRectangle.test.tsx +27 -0
- package/src/components/skeleton/SkeletonRectangle.tsx +88 -0
- package/src/components/skeleton/SkeletonTypography.stories.tsx +19 -0
- package/src/components/skeleton/SkeletonTypography.test.tsx +27 -0
- package/src/components/skeleton/SkeletonTypography.tsx +59 -0
- package/src/components/skeleton/index.ts +3 -0
- package/src/components/slider/Slider.stories.tsx +45 -0
- package/src/components/slider/Slider.test.tsx +29 -0
- package/src/components/slider/Slider.tsx +299 -0
- package/src/components/slider/index.ts +2 -0
- package/src/components/slideshow/Slides.tsx +130 -0
- package/src/components/slideshow/Slideshow.stories.tsx +179 -0
- package/src/components/slideshow/Slideshow.test.tsx +35 -0
- package/src/components/slideshow/Slideshow.tsx +173 -0
- package/src/components/slideshow/SlideshowControls.stories.tsx +100 -0
- package/src/components/slideshow/SlideshowControls.tsx +243 -0
- package/src/components/slideshow/SlideshowItem.tsx +44 -0
- package/src/components/slideshow/SlideshowItemGroup.tsx +60 -0
- package/src/components/slideshow/constants.ts +24 -0
- package/src/components/slideshow/index.ts +4 -0
- package/src/components/slideshow/useKeyNavigate.ts +28 -0
- package/src/components/slideshow/usePaginationVisibleRange.ts +37 -0
- package/src/components/slideshow/useSlideFocusManagement.tsx +92 -0
- package/src/components/slideshow/useSwipeNavigate.ts +18 -0
- package/src/components/switch/Switch.stories.tsx +49 -0
- package/src/components/switch/Switch.test.tsx +144 -0
- package/src/components/switch/Switch.tsx +145 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/table/Table.test.tsx +29 -0
- package/src/components/table/Table.tsx +59 -0
- package/src/components/table/TableBody.test.tsx +30 -0
- package/src/components/table/TableBody.tsx +42 -0
- package/src/components/table/TableCell.test.tsx +72 -0
- package/src/components/table/TableCell.tsx +130 -0
- package/src/components/table/TableHeader.test.tsx +30 -0
- package/src/components/table/TableHeader.tsx +48 -0
- package/src/components/table/TableRow.test.tsx +40 -0
- package/src/components/table/TableRow.tsx +71 -0
- package/src/components/table/index.ts +5 -0
- package/src/components/tabs/Tab.test.tsx +50 -0
- package/src/components/tabs/Tab.tsx +133 -0
- package/src/components/tabs/TabList.test.tsx +49 -0
- package/src/components/tabs/TabList.tsx +94 -0
- package/src/components/tabs/TabPanel.test.tsx +37 -0
- package/src/components/tabs/TabPanel.tsx +67 -0
- package/src/components/tabs/TabProvider.test.tsx +161 -0
- package/src/components/tabs/TabProvider.tsx +67 -0
- package/src/components/tabs/Tabs.stories.tsx +170 -0
- package/src/components/tabs/index.ts +4 -0
- package/src/components/tabs/state.ts +114 -0
- package/src/components/tabs/test-utils.ts +39 -0
- package/src/components/text/Text.stories.tsx +177 -0
- package/src/components/text/Text.test.tsx +92 -0
- package/src/components/text/Text.tsx +139 -0
- package/src/components/text/index.ts +1 -0
- package/src/components/text-field/TextField.stories.tsx +180 -0
- package/src/components/text-field/TextField.test.tsx +298 -0
- package/src/components/text-field/TextField.tsx +493 -0
- package/src/components/text-field/index.ts +1 -0
- package/src/components/thumbnail/Thumbnail.stories.tsx +448 -0
- package/src/components/thumbnail/Thumbnail.test.tsx +88 -0
- package/src/components/thumbnail/Thumbnail.tsx +248 -0
- package/src/components/thumbnail/index.ts +3 -0
- package/src/components/thumbnail/types.ts +48 -0
- package/src/components/thumbnail/useFocusPointStyle.test.ts +92 -0
- package/src/components/thumbnail/useFocusPointStyle.tsx +107 -0
- package/src/components/thumbnail/useImageLoad.ts +40 -0
- package/src/components/toolbar/Toolbar.tsx +68 -0
- package/src/components/toolbar/index.ts +1 -0
- package/src/components/tooltip/Tooltip.stories.tsx +118 -0
- package/src/components/tooltip/Tooltip.test.tsx +417 -0
- package/src/components/tooltip/Tooltip.tsx +165 -0
- package/src/components/tooltip/constants.ts +8 -0
- package/src/components/tooltip/context.tsx +17 -0
- package/src/components/tooltip/index.ts +1 -0
- package/src/components/tooltip/useInjectTooltipRef.tsx +55 -0
- package/src/components/tooltip/useTooltipOpen.tsx +143 -0
- package/src/components/uploader/Uploader.stories.tsx +109 -0
- package/src/components/uploader/Uploader.test.tsx +146 -0
- package/src/components/uploader/Uploader.tsx +177 -0
- package/src/components/uploader/index.ts +1 -0
- package/src/components/user-block/UserBlock.stories.tsx +133 -0
- package/src/components/user-block/UserBlock.test.tsx +106 -0
- package/src/components/user-block/UserBlock.tsx +193 -0
- package/src/components/user-block/index.ts +1 -0
- package/src/constants.ts +27 -0
- package/src/hooks/useBooleanState.tsx +13 -0
- package/src/hooks/useCallbackOnEscape.ts +34 -0
- package/src/hooks/useChipGroupNavigation.tsx +75 -0
- package/src/hooks/useClickAway.tsx +48 -0
- package/src/hooks/useDisableBodyScroll.ts +28 -0
- package/src/hooks/useEventCallback.tsx +17 -0
- package/src/hooks/useFocus.tsx +21 -0
- package/src/hooks/useFocusTrap.ts +93 -0
- package/src/hooks/useFocusWithin.ts +33 -0
- package/src/hooks/useId.test.tsx +22 -0
- package/src/hooks/useId.ts +15 -0
- package/src/hooks/useImageSize.ts +17 -0
- package/src/hooks/useInfiniteScroll.tsx +60 -0
- package/src/hooks/useIntersectionObserver.tsx +43 -0
- package/src/hooks/useInterval.tsx +31 -0
- package/src/hooks/useKeyboardListNavigation.tsx +204 -0
- package/src/hooks/useListenFocus.tsx +26 -0
- package/src/hooks/useOverflowTooltipLabel.tsx +32 -0
- package/src/hooks/usePopper.ts +12 -0
- package/src/hooks/usePreviousValue.ts +12 -0
- package/src/hooks/useRovingTabIndex.tsx +90 -0
- package/src/hooks/useSizeOnWindowResize.ts +30 -0
- package/src/hooks/useSlideshowControls.ts +246 -0
- package/src/hooks/useStopPropagation.ts +21 -0
- package/src/hooks/useTransitionVisibility.ts +48 -0
- package/src/index.ts +63 -0
- package/src/stories/controls/color.ts +7 -0
- package/src/stories/controls/element.ts +6 -0
- package/src/stories/controls/focusPoint.ts +1 -0
- package/src/stories/controls/icons.ts +126 -0
- package/src/stories/controls/image.ts +84 -0
- package/src/stories/controls/selectArgType.ts +8 -0
- package/src/stories/controls/theme.ts +3 -0
- package/src/stories/controls/typography.ts +5 -0
- package/src/stories/controls/withUndefined.ts +1 -0
- package/src/stories/decorators/withChromaticForceScreenSize.tsx +7 -0
- package/src/stories/decorators/withCombinations.tsx +132 -0
- package/src/stories/decorators/withNestedProps.tsx +22 -0
- package/src/stories/decorators/withResizableBox.tsx +21 -0
- package/src/stories/decorators/withThemedBackground.tsx +16 -0
- package/src/stories/decorators/withValueOnChange.tsx +18 -0
- package/src/stories/decorators/withWrapper.tsx +19 -0
- package/src/stories/generated/Autocomplete/Demos.stories.tsx +7 -0
- package/src/stories/generated/Avatar/Demos.stories.tsx +7 -0
- package/src/stories/generated/Badge/Demos.stories.tsx +9 -0
- package/src/stories/generated/Button/Demos.stories.tsx +11 -0
- package/src/stories/generated/Checkbox/Demos.stories.tsx +6 -0
- package/src/stories/generated/Chip/Demos.stories.tsx +11 -0
- package/src/stories/generated/CommentBlock/Demos.stories.tsx +8 -0
- package/src/stories/generated/DatePicker/Demos.stories.tsx +8 -0
- package/src/stories/generated/Dialog/Demos.stories.tsx +10 -0
- package/src/stories/generated/Divider/Demos.stories.tsx +6 -0
- package/src/stories/generated/Dropdown/Demos.stories.tsx +8 -0
- package/src/stories/generated/ExpansionPanel/Demos.stories.tsx +9 -0
- package/src/stories/generated/Flag/Demos.stories.tsx +6 -0
- package/src/stories/generated/GenericBlock/Demos.stories.tsx +8 -0
- package/src/stories/generated/Heading/Demos.stories.tsx +6 -0
- package/src/stories/generated/Icon/Demos.stories.tsx +8 -0
- package/src/stories/generated/ImageBlock/Demos.stories.tsx +9 -0
- package/src/stories/generated/ImageLightbox/Demos.stories.tsx +6 -0
- package/src/stories/generated/Lightbox/Demos.stories.tsx +6 -0
- package/src/stories/generated/LinkPreview/Demos.stories.tsx +7 -0
- package/src/stories/generated/List/Demos.stories.tsx +11 -0
- package/src/stories/generated/Message/Demos.stories.tsx +11 -0
- package/src/stories/generated/Mosaic/Demos.stories.tsx +10 -0
- package/src/stories/generated/Notification/Demos.stories.tsx +6 -0
- package/src/stories/generated/Popover/Demos.stories.tsx +11 -0
- package/src/stories/generated/PopoverDialog/Demos.stories.tsx +6 -0
- package/src/stories/generated/PostBlock/Demos.stories.tsx +6 -0
- package/src/stories/generated/Progress/Demos.stories.tsx +7 -0
- package/src/stories/generated/ProgressTracker/Demos.stories.tsx +9 -0
- package/src/stories/generated/RadioButton/Demos.stories.tsx +6 -0
- package/src/stories/generated/Select/Demos.stories.tsx +14 -0
- package/src/stories/generated/SideNavigation/Demos.stories.tsx +10 -0
- package/src/stories/generated/Skeleton/Demos.stories.tsx +9 -0
- package/src/stories/generated/Slider/Demos.stories.tsx +9 -0
- package/src/stories/generated/Slideshow/Demos.stories.tsx +8 -0
- package/src/stories/generated/Switch/Demos.stories.tsx +6 -0
- package/src/stories/generated/Table/Demos.stories.tsx +7 -0
- package/src/stories/generated/Tabs/Demos.stories.tsx +8 -0
- package/src/stories/generated/TextField/Demos.stories.tsx +20 -0
- package/src/stories/generated/Thumbnail/Demos.stories.tsx +12 -0
- package/src/stories/generated/Toolbar/Demos.stories.tsx +10 -0
- package/src/stories/generated/Tooltip/Demos.stories.tsx +8 -0
- package/src/stories/generated/Uploader/Demos.stories.tsx +8 -0
- package/src/stories/generated/UserBlock/Demos.stories.tsx +11 -0
- package/src/stories/utils/CustomLink.tsx +12 -0
- package/src/stories/utils/concatPath.tsx +17 -0
- package/src/stories/utils/disableArgTypes.ts +3 -0
- package/src/stories/utils/initDemoShadowDOMPortal.ts +10 -0
- package/src/stories/utils/lorem.ts +59 -0
- package/src/stories/utils/theming.tsx +166 -0
- package/src/stories/utils/toFlattenProps.ts +28 -0
- package/src/stories/utils/withCategory.ts +12 -0
- package/src/testing/utils/ThemeSentinel.tsx +10 -0
- package/src/testing/utils/commonTestsSuiteRTL.tsx +193 -0
- package/src/testing/utils/index.ts +1 -0
- package/src/testing/utils/queries.ts +19 -0
- package/src/untypped-modules.d.ts +9 -0
- package/src/utils/ClickAwayProvider/ClickAwayProvider.stories.jsx +70 -0
- package/src/utils/ClickAwayProvider/ClickAwayProvider.tsx +69 -0
- package/src/utils/ClickAwayProvider/index.ts +1 -0
- package/src/utils/MaterialThemeSwitcher/MaterialThemeSwitcher.tsx +54 -0
- package/src/utils/MaterialThemeSwitcher/index.ts +1 -0
- package/src/utils/Portal/Portal.test.tsx +31 -0
- package/src/utils/Portal/Portal.tsx +33 -0
- package/src/utils/Portal/PortalProvider.stories.jsx +22 -0
- package/src/utils/Portal/PortalProvider.test.tsx +72 -0
- package/src/utils/Portal/PortalProvider.tsx +24 -0
- package/src/utils/Portal/index.tsx +2 -0
- package/src/utils/browser/DOM/findImage.tsx +3 -0
- package/src/utils/browser/DOM/startViewTransition.ts +68 -0
- package/src/utils/browser/focus/constants.ts +7 -0
- package/src/utils/browser/focus/getFirstAndLastFocusable.test.ts +134 -0
- package/src/utils/browser/focus/getFirstAndLastFocusable.ts +21 -0
- package/src/utils/browser/focus/getFocusableElements.test.ts +151 -0
- package/src/utils/browser/focus/getFocusableElements.ts +7 -0
- package/src/utils/browser/isFocusVisible.ts +9 -0
- package/src/utils/browser/isHoverNotSupported.test.js +24 -0
- package/src/utils/browser/isHoverNotSupported.ts +2 -0
- package/src/utils/browser/isReducedMotion.ts +6 -0
- package/src/utils/date/addMonthResetDay.test.ts +13 -0
- package/src/utils/date/addMonthResetDay.ts +9 -0
- package/src/utils/date/formatDayNumber.test.ts +12 -0
- package/src/utils/date/formatDayNumber.ts +5 -0
- package/src/utils/date/getFirstDayOfWeek.test.ts +20 -0
- package/src/utils/date/getFirstDayOfWeek.ts +59 -0
- package/src/utils/date/getMonthCalendar.test.ts +127 -0
- package/src/utils/date/getMonthCalendar.ts +69 -0
- package/src/utils/date/getWeekDays.test.ts +48 -0
- package/src/utils/date/getWeekDays.ts +34 -0
- package/src/utils/date/getYearDisplayName.test.ts +20 -0
- package/src/utils/date/getYearDisplayName.ts +12 -0
- package/src/utils/date/isDateValid.test.ts +15 -0
- package/src/utils/date/isDateValid.ts +4 -0
- package/src/utils/date/isSameDay.test.ts +37 -0
- package/src/utils/date/isSameDay.ts +11 -0
- package/src/utils/disabled/DisabledStateContext.tsx +29 -0
- package/src/utils/disabled/DisabledStateProvider.stories.tsx +92 -0
- package/src/utils/disabled/index.ts +2 -0
- package/src/utils/disabled/useDisableStateProps.test.tsx +74 -0
- package/src/utils/disabled/useDisableStateProps.tsx +37 -0
- package/src/utils/function/makeListenerTowerContext.ts +32 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/locale/getCurrentLocale.ts +4 -0
- package/src/utils/locale/parseLocale.test.ts +17 -0
- package/src/utils/locale/parseLocale.ts +23 -0
- package/src/utils/locale/types.ts +8 -0
- package/src/utils/number/clamp.ts +17 -0
- package/src/utils/object/isEqual.test.ts +25 -0
- package/src/utils/object/isEqual.ts +11 -0
- package/src/utils/partitionMulti.test.ts +27 -0
- package/{_internal/4daccdd5.js → src/utils/partitionMulti.ts} +9 -5
- package/src/utils/react/OnBeforeUnmount.tsx +20 -0
- package/src/utils/react/RawClickable.test.tsx +153 -0
- package/src/utils/react/RawClickable.tsx +65 -0
- package/src/utils/react/flattenChildren.ts +32 -0
- package/src/utils/react/forwardRef.ts +11 -0
- package/src/utils/react/forwardRefPolymorphic.ts +9 -0
- package/src/utils/react/mergeRefs.ts +33 -0
- package/src/utils/react/renderLink.tsx +17 -0
- package/src/utils/react/skipRender.tsx +18 -0
- package/src/utils/react/unref.ts +7 -0
- package/src/utils/react/wrapChildrenIconWithSpaces.test.tsx +37 -0
- package/src/utils/react/wrapChildrenIconWithSpaces.tsx +22 -0
- package/src/utils/theme/ThemeContext.ts +16 -0
- package/src/utils/theme/invertTheme.ts +4 -0
- package/src/utils/type/Comp.ts +14 -0
- package/src/utils/type/ComponentRef.ts +16 -0
- package/src/utils/type/HasAriaDisabled.ts +6 -0
- package/src/utils/type/HasPolymorphicAs.ts +6 -0
- package/src/utils/type/HasRequiredLinkHref.ts +1 -0
- package/src/utils/type/MaybeElementOrRef.ts +6 -0
- package/src/utils/type/index.ts +9 -0
- package/src/utils/type/isComponent.ts +33 -0
- package/src/utils/type/isComponentType.ts +9 -0
- package/utils/index.d.ts +1 -1
- package/utils/index.js +1 -3
- package/utils/index.js.map +1 -1
- package/_internal/0420e67b.js +0 -119
- package/_internal/0420e67b.js.map +0 -1
- package/_internal/0a490b07.js +0 -75
- package/_internal/0a490b07.js.map +0 -1
- package/_internal/0b9c76cb.js +0 -6
- package/_internal/0b9c76cb.js.map +0 -1
- package/_internal/0be1006e.js +0 -97
- package/_internal/0be1006e.js.map +0 -1
- package/_internal/0d1a078c.js +0 -144
- package/_internal/0d1a078c.js.map +0 -1
- package/_internal/15eab19b.js +0 -75
- package/_internal/15eab19b.js.map +0 -1
- package/_internal/179a84d1.js +0 -259
- package/_internal/179a84d1.js.map +0 -1
- package/_internal/193521fa.js +0 -52
- package/_internal/193521fa.js.map +0 -1
- package/_internal/1a90ea3d.js +0 -51
- package/_internal/1a90ea3d.js.map +0 -1
- package/_internal/1deba7d7.js +0 -224
- package/_internal/1deba7d7.js.map +0 -1
- package/_internal/1ea72630.js +0 -146
- package/_internal/1ea72630.js.map +0 -1
- package/_internal/21b83d16.js +0 -137
- package/_internal/21b83d16.js.map +0 -1
- package/_internal/230173a8.js +0 -13
- package/_internal/230173a8.js.map +0 -1
- package/_internal/297bed8f.js +0 -457
- package/_internal/297bed8f.js.map +0 -1
- package/_internal/2a3d237c.js +0 -12
- package/_internal/2a3d237c.js.map +0 -1
- package/_internal/2c2b6a89.js +0 -52
- package/_internal/2c2b6a89.js.map +0 -1
- package/_internal/2f1716fa.js +0 -237
- package/_internal/2f1716fa.js.map +0 -1
- package/_internal/2f6c7f84.js +0 -103
- package/_internal/2f6c7f84.js.map +0 -1
- package/_internal/3181f000.js +0 -14
- package/_internal/3181f000.js.map +0 -1
- package/_internal/329b5f12.js +0 -55
- package/_internal/329b5f12.js.map +0 -1
- package/_internal/332e9844.js +0 -2
- package/_internal/332e9844.js.map +0 -1
- package/_internal/34c59f5b.js +0 -681
- package/_internal/34c59f5b.js.map +0 -1
- package/_internal/36bd7352.js +0 -219
- package/_internal/36bd7352.js.map +0 -1
- package/_internal/370bdaed.js +0 -61
- package/_internal/370bdaed.js.map +0 -1
- package/_internal/37b007a4.js +0 -20
- package/_internal/37b007a4.js.map +0 -1
- package/_internal/3a1facc0.js +0 -18
- package/_internal/3a1facc0.js.map +0 -1
- package/_internal/3a4e4636.js +0 -162
- package/_internal/3a4e4636.js.map +0 -1
- package/_internal/3e653144.js +0 -49
- package/_internal/3e653144.js.map +0 -1
- package/_internal/3f86608e.js +0 -45
- package/_internal/3f86608e.js.map +0 -1
- package/_internal/478b5c92.js +0 -24
- package/_internal/478b5c92.js.map +0 -1
- package/_internal/4962be5b.js +0 -121
- package/_internal/4962be5b.js.map +0 -1
- package/_internal/49bbeed3.js +0 -6
- package/_internal/49bbeed3.js.map +0 -1
- package/_internal/4cd870a5.js +0 -2155
- package/_internal/4cd870a5.js.map +0 -1
- package/_internal/4daccdd5.js.map +0 -1
- package/_internal/501f2f9f.js +0 -58
- package/_internal/501f2f9f.js.map +0 -1
- package/_internal/5e7b90e2.js +0 -2
- package/_internal/5e7b90e2.js.map +0 -1
- package/_internal/5ec059fe.js +0 -145
- package/_internal/5ec059fe.js.map +0 -1
- package/_internal/5f8f9454.js +0 -70
- package/_internal/5f8f9454.js.map +0 -1
- package/_internal/5fe09341.js +0 -112
- package/_internal/5fe09341.js.map +0 -1
- package/_internal/628468c4.js +0 -313
- package/_internal/628468c4.js.map +0 -1
- package/_internal/6589b796.js +0 -280
- package/_internal/6589b796.js.map +0 -1
- package/_internal/65f91970.js +0 -297
- package/_internal/65f91970.js.map +0 -1
- package/_internal/66f691d3.js +0 -74
- package/_internal/66f691d3.js.map +0 -1
- package/_internal/68c10f98.js +0 -166
- package/_internal/68c10f98.js.map +0 -1
- package/_internal/690ca33e.js +0 -109
- package/_internal/690ca33e.js.map +0 -1
- package/_internal/6ca04271.js +0 -108
- package/_internal/6ca04271.js.map +0 -1
- package/_internal/6da19518.js +0 -165
- package/_internal/6da19518.js.map +0 -1
- package/_internal/7093ba23.js +0 -95
- package/_internal/7093ba23.js.map +0 -1
- package/_internal/74a4a214.js +0 -82
- package/_internal/74a4a214.js.map +0 -1
- package/_internal/76be70dd.js +0 -42
- package/_internal/76be70dd.js.map +0 -1
- package/_internal/78df9309.js +0 -20
- package/_internal/78df9309.js.map +0 -1
- package/_internal/7b221b05.js +0 -9
- package/_internal/7b221b05.js.map +0 -1
- package/_internal/7daf0f24.js +0 -77
- package/_internal/7daf0f24.js.map +0 -1
- package/_internal/7f54e947.js +0 -758
- package/_internal/7f54e947.js.map +0 -1
- package/_internal/825ac334.js +0 -130
- package/_internal/825ac334.js.map +0 -1
- package/_internal/827b804a.js +0 -6
- package/_internal/827b804a.js.map +0 -1
- package/_internal/84dfe68f.js +0 -436
- package/_internal/84dfe68f.js.map +0 -1
- package/_internal/85e3a5ca.js +0 -145
- package/_internal/85e3a5ca.js.map +0 -1
- package/_internal/86aa4aa4.js +0 -154
- package/_internal/86aa4aa4.js.map +0 -1
- package/_internal/88ec77c2.js +0 -130
- package/_internal/88ec77c2.js.map +0 -1
- package/_internal/8ab42752.js +0 -103
- package/_internal/8ab42752.js.map +0 -1
- package/_internal/95cfd814.js +0 -70
- package/_internal/95cfd814.js.map +0 -1
- package/_internal/9a4dfad0.js +0 -326
- package/_internal/9a4dfad0.js.map +0 -1
- package/_internal/9c9df5f2.js +0 -80
- package/_internal/9c9df5f2.js.map +0 -1
- package/_internal/9d1336a1.js +0 -19
- package/_internal/9d1336a1.js.map +0 -1
- package/_internal/9fdc715b.js +0 -152
- package/_internal/9fdc715b.js.map +0 -1
- package/_internal/a003602b.js +0 -116
- package/_internal/a003602b.js.map +0 -1
- package/_internal/a34639bd.js +0 -97
- package/_internal/a34639bd.js.map +0 -1
- package/_internal/a84f4981.js +0 -122
- package/_internal/a84f4981.js.map +0 -1
- package/_internal/b0a7a999.js +0 -59
- package/_internal/b0a7a999.js.map +0 -1
- package/_internal/b0b2e33d.js +0 -359
- package/_internal/b0b2e33d.js.map +0 -1
- package/_internal/b1af5979.js +0 -653
- package/_internal/b1af5979.js.map +0 -1
- package/_internal/b477da26.js +0 -164
- package/_internal/b477da26.js.map +0 -1
- package/_internal/b8667090.js +0 -36
- package/_internal/b8667090.js.map +0 -1
- package/_internal/bae266a9.js +0 -61
- package/_internal/bae266a9.js.map +0 -1
- package/_internal/be6da9b0.js +0 -296
- package/_internal/be6da9b0.js.map +0 -1
- package/_internal/c0414b89.js +0 -101
- package/_internal/c0414b89.js.map +0 -1
- package/_internal/c2388b10.js +0 -58
- package/_internal/c2388b10.js.map +0 -1
- package/_internal/c459a04d.js +0 -148
- package/_internal/c459a04d.js.map +0 -1
- package/_internal/c6ca7494.js +0 -2
- package/_internal/c6ca7494.js.map +0 -1
- package/_internal/cdddaed8.js +0 -116
- package/_internal/cdddaed8.js.map +0 -1
- package/_internal/d0dd1815.js +0 -10
- package/_internal/d0dd1815.js.map +0 -1
- package/_internal/d45e3f16.js +0 -15
- package/_internal/d45e3f16.js.map +0 -1
- package/_internal/d5f316cb.js +0 -62
- package/_internal/d5f316cb.js.map +0 -1
- package/_internal/db4fdc7b.js +0 -310
- package/_internal/db4fdc7b.js.map +0 -1
- package/_internal/dbe0cf24.js +0 -75
- package/_internal/dbe0cf24.js.map +0 -1
- package/_internal/de24f857.js +0 -4
- package/_internal/de24f857.js.map +0 -1
- package/_internal/e2afb13f.js +0 -75
- package/_internal/e2afb13f.js.map +0 -1
- package/_internal/e52f0d3f.js +0 -94
- package/_internal/e52f0d3f.js.map +0 -1
- package/_internal/e6dd117e.js +0 -50
- package/_internal/e6dd117e.js.map +0 -1
- package/_internal/e806b848.js +0 -9
- package/_internal/e806b848.js.map +0 -1
- package/_internal/ea04260d.js +0 -29
- package/_internal/ea04260d.js.map +0 -1
- package/_internal/eaa8b1d8.js +0 -150
- package/_internal/eaa8b1d8.js.map +0 -1
- package/_internal/eaf6c45a.js +0 -4
- package/_internal/eaf6c45a.js.map +0 -1
- package/_internal/edab29ce.js +0 -308
- package/_internal/edab29ce.js.map +0 -1
- package/_internal/ef5d1aac.js +0 -4
- package/_internal/ef5d1aac.js.map +0 -1
- package/_internal/f0900583.js +0 -142
- package/_internal/f0900583.js.map +0 -1
- package/_internal/f0d7d6ea.js +0 -30
- package/_internal/f0d7d6ea.js.map +0 -1
- package/_internal/f23cdf84.js +0 -181
- package/_internal/f23cdf84.js.map +0 -1
- package/_internal/f52e979e.js +0 -3
- package/_internal/f52e979e.js.map +0 -1
- package/_internal/f5508d3d.js +0 -792
- package/_internal/f5508d3d.js.map +0 -1
- package/_internal/f93fe83e.js +0 -46
- package/_internal/f93fe83e.js.map +0 -1
- /package/_internal/{d95844c1.d.ts → Falsy.d.ts} +0 -0
package/_internal/0d1a078c.js
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { m as getRootClassName, O as Orientation, c as Size, n as forwardRef, b as Theme, l as classNames, j as ColorPalette } from './6589b796.js';
|
|
3
|
-
import isEmpty from 'lodash/isEmpty';
|
|
4
|
-
import set from 'lodash/set';
|
|
5
|
-
import { h as handleBasicClasses } from './e2afb13f.js';
|
|
6
|
-
import { u as useTheme } from './3181f000.js';
|
|
7
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
-
import { Avatar } from './74a4a214.js';
|
|
9
|
-
import { Link } from './66f691d3.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Component display name.
|
|
13
|
-
*/
|
|
14
|
-
const COMPONENT_NAME = 'UserBlock';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Component default class name and class prefix.
|
|
18
|
-
*/
|
|
19
|
-
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Component default props.
|
|
23
|
-
*/
|
|
24
|
-
const DEFAULT_PROPS = {
|
|
25
|
-
orientation: Orientation.horizontal,
|
|
26
|
-
size: Size.m
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* UserBlock component.
|
|
31
|
-
*
|
|
32
|
-
* @param props Component props.
|
|
33
|
-
* @param ref Component ref.
|
|
34
|
-
* @return React element.
|
|
35
|
-
*/
|
|
36
|
-
const UserBlock = forwardRef((props, ref) => {
|
|
37
|
-
const defaultTheme = useTheme() || Theme.light;
|
|
38
|
-
const {
|
|
39
|
-
avatarProps,
|
|
40
|
-
className,
|
|
41
|
-
fields,
|
|
42
|
-
linkProps,
|
|
43
|
-
linkAs,
|
|
44
|
-
multipleActions,
|
|
45
|
-
name,
|
|
46
|
-
nameProps,
|
|
47
|
-
onClick,
|
|
48
|
-
onMouseEnter,
|
|
49
|
-
onMouseLeave,
|
|
50
|
-
orientation = DEFAULT_PROPS.orientation,
|
|
51
|
-
simpleAction,
|
|
52
|
-
size = DEFAULT_PROPS.size,
|
|
53
|
-
theme = defaultTheme,
|
|
54
|
-
children,
|
|
55
|
-
additionalFields,
|
|
56
|
-
after,
|
|
57
|
-
...forwardedProps
|
|
58
|
-
} = props;
|
|
59
|
-
let componentSize = size;
|
|
60
|
-
|
|
61
|
-
// Special case - When using vertical orientation force the size to be Sizes.l.
|
|
62
|
-
if (orientation === Orientation.vertical) {
|
|
63
|
-
componentSize = Size.l;
|
|
64
|
-
}
|
|
65
|
-
const shouldDisplayActions = orientation === Orientation.vertical;
|
|
66
|
-
const isLink = Boolean(linkProps?.href || linkAs);
|
|
67
|
-
const isClickable = !!onClick || isLink;
|
|
68
|
-
const nameBlock = React__default.useMemo(() => {
|
|
69
|
-
if (isEmpty(name)) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
let NameComponent = 'span';
|
|
73
|
-
const nProps = {
|
|
74
|
-
...nameProps,
|
|
75
|
-
className: classNames(`${CLASSNAME}__name`, linkProps?.className, nameProps?.className)
|
|
76
|
-
};
|
|
77
|
-
if (isClickable) {
|
|
78
|
-
NameComponent = Link;
|
|
79
|
-
Object.assign(nProps, {
|
|
80
|
-
...linkProps,
|
|
81
|
-
onClick,
|
|
82
|
-
linkAs,
|
|
83
|
-
color: ColorPalette.dark
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
// Disable avatar focus since the name block is the same link / same button.
|
|
87
|
-
if (avatarProps) {
|
|
88
|
-
set(avatarProps, ['thumbnailProps', 'tabIndex'], -1);
|
|
89
|
-
}
|
|
90
|
-
return /*#__PURE__*/jsx(NameComponent, {
|
|
91
|
-
...nProps,
|
|
92
|
-
children: name
|
|
93
|
-
});
|
|
94
|
-
}, [avatarProps, isClickable, linkAs, linkProps, name, nameProps, onClick]);
|
|
95
|
-
const shouldDisplayFields = componentSize !== Size.s && componentSize !== Size.xs;
|
|
96
|
-
const fieldsBlock = fields && shouldDisplayFields && /*#__PURE__*/jsx("div", {
|
|
97
|
-
className: `${CLASSNAME}__fields`,
|
|
98
|
-
children: fields.map((field, idx) => /*#__PURE__*/jsx("span", {
|
|
99
|
-
className: `${CLASSNAME}__field`,
|
|
100
|
-
children: field
|
|
101
|
-
}, idx))
|
|
102
|
-
});
|
|
103
|
-
return /*#__PURE__*/jsxs("div", {
|
|
104
|
-
ref: ref,
|
|
105
|
-
...forwardedProps,
|
|
106
|
-
className: classNames(className, handleBasicClasses({
|
|
107
|
-
prefix: CLASSNAME,
|
|
108
|
-
orientation,
|
|
109
|
-
size: componentSize,
|
|
110
|
-
theme,
|
|
111
|
-
isClickable
|
|
112
|
-
})),
|
|
113
|
-
onMouseLeave: onMouseLeave,
|
|
114
|
-
onMouseEnter: onMouseEnter,
|
|
115
|
-
children: [avatarProps && /*#__PURE__*/jsx(Avatar, {
|
|
116
|
-
linkAs: linkAs,
|
|
117
|
-
linkProps: linkProps,
|
|
118
|
-
alt: "",
|
|
119
|
-
...avatarProps,
|
|
120
|
-
className: classNames(`${CLASSNAME}__avatar`, avatarProps.className),
|
|
121
|
-
size: componentSize,
|
|
122
|
-
onClick: onClick,
|
|
123
|
-
theme: theme
|
|
124
|
-
}), (fields || name || children || additionalFields) && /*#__PURE__*/jsxs("div", {
|
|
125
|
-
className: `${CLASSNAME}__wrapper`,
|
|
126
|
-
children: [children || nameBlock, fieldsBlock, shouldDisplayFields ? additionalFields : null]
|
|
127
|
-
}), shouldDisplayActions && simpleAction && /*#__PURE__*/jsx("div", {
|
|
128
|
-
className: `${CLASSNAME}__action`,
|
|
129
|
-
children: simpleAction
|
|
130
|
-
}), shouldDisplayActions && multipleActions && /*#__PURE__*/jsx("div", {
|
|
131
|
-
className: `${CLASSNAME}__actions`,
|
|
132
|
-
children: multipleActions
|
|
133
|
-
}), after ? /*#__PURE__*/jsx("div", {
|
|
134
|
-
className: `${CLASSNAME}__after`,
|
|
135
|
-
children: after
|
|
136
|
-
}) : null]
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
UserBlock.displayName = COMPONENT_NAME;
|
|
140
|
-
UserBlock.className = CLASSNAME;
|
|
141
|
-
UserBlock.defaultProps = DEFAULT_PROPS;
|
|
142
|
-
|
|
143
|
-
export { UserBlock };
|
|
144
|
-
//# sourceMappingURL=0d1a078c.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"0d1a078c.js","sources":["../../src/components/user-block/UserBlock.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\n\nimport classNames from 'classnames';\nimport isEmpty from 'lodash/isEmpty';\nimport set from 'lodash/set';\n\nimport { Avatar, ColorPalette, Link, Orientation, Size, Theme } from '@lumx/react';\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { AvatarProps } from '../avatar/Avatar';\n\n/**\n * User block sizes.\n */\nexport type UserBlockSize = Extract<Size, 'xs' | 's' | 'm' | 'l'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface UserBlockProps extends GenericProps, HasTheme {\n /** Props to pass to the avatar. */\n avatarProps?: Omit<AvatarProps, 'alt'>;\n /** Additional fields used to describe the user. */\n fields?: string[];\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 /** Multiple action toolbar content. */\n multipleActions?: ReactNode;\n /** User name. */\n name?: React.ReactNode;\n /** Props to pass to the name block. */\n nameProps?: GenericProps;\n /** Orientation. */\n orientation?: Orientation;\n /** Simple action toolbar content. */\n simpleAction?: ReactNode;\n /** Size variant. */\n size?: UserBlockSize;\n /** On click callback. */\n onClick?(): void;\n /** On mouse enter callback. */\n onMouseEnter?(): void;\n /** On mouse leave callback. */\n onMouseLeave?(): void;\n /** Display additional fields below the original name and fields */\n additionalFields?: React.ReactNode;\n /** Display an additional element after the entire component. (to the right if orientation is horizontal, at the bottom if orientation is vertical) */\n after?: React.ReactNode;\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};\n\n/**\n * UserBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const UserBlock = forwardRef<UserBlockProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme() || Theme.light;\n const {\n avatarProps,\n className,\n fields,\n linkProps,\n linkAs,\n multipleActions,\n name,\n nameProps,\n onClick,\n onMouseEnter,\n onMouseLeave,\n orientation = DEFAULT_PROPS.orientation,\n simpleAction,\n size = DEFAULT_PROPS.size,\n theme = defaultTheme,\n children,\n additionalFields,\n after,\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 let NameComponent: any = 'span';\n const nProps: any = {\n ...nameProps,\n className: classNames(`${CLASSNAME}__name`, linkProps?.className, nameProps?.className),\n };\n if (isClickable) {\n NameComponent = Link;\n Object.assign(nProps, {\n ...linkProps,\n onClick,\n linkAs,\n color: ColorPalette.dark,\n });\n }\n // Disable avatar focus since the name block is the same link / same button.\n if (avatarProps) {\n set(avatarProps, ['thumbnailProps', 'tabIndex'], -1);\n }\n return <NameComponent {...nProps}>{name}</NameComponent>;\n }, [avatarProps, isClickable, linkAs, linkProps, name, nameProps, onClick]);\n\n const shouldDisplayFields = componentSize !== Size.s && componentSize !== Size.xs;\n\n const fieldsBlock: ReactNode = fields && shouldDisplayFields && (\n <div className={`${CLASSNAME}__fields`}>\n {fields.map((field: string, idx: number) => (\n <span key={idx} className={`${CLASSNAME}__field`}>\n {field}\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 alt=\"\"\n {...(avatarProps as any)}\n className={classNames(`${CLASSNAME}__avatar`, avatarProps.className)}\n size={componentSize}\n onClick={onClick}\n theme={theme}\n />\n )}\n {(fields || name || children || additionalFields) && (\n <div className={`${CLASSNAME}__wrapper`}>\n {children || nameBlock}\n {fieldsBlock}\n {shouldDisplayFields ? additionalFields : null}\n </div>\n )}\n {shouldDisplayActions && simpleAction && <div className={`${CLASSNAME}__action`}>{simpleAction}</div>}\n {shouldDisplayActions && multipleActions && (\n <div className={`${CLASSNAME}__actions`}>{multipleActions}</div>\n )}\n {after ? <div className={`${CLASSNAME}__after`}>{after}</div> : null}\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","UserBlock","forwardRef","props","ref","defaultTheme","useTheme","Theme","light","avatarProps","className","fields","linkProps","linkAs","multipleActions","name","nameProps","onClick","onMouseEnter","onMouseLeave","simpleAction","theme","children","additionalFields","after","forwardedProps","componentSize","vertical","l","shouldDisplayActions","isLink","Boolean","href","isClickable","nameBlock","React","useMemo","isEmpty","NameComponent","nProps","classNames","Link","Object","assign","color","ColorPalette","dark","set","_jsx","shouldDisplayFields","s","xs","fieldsBlock","map","field","idx","_jsxs","handleBasicClasses","prefix","Avatar","alt","displayName","defaultProps"],"mappings":";;;;;;;;;;AAuDA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,WAAW,CAAA;;AAElC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAsC,GAAG;EAC3CC,WAAW,EAAEC,WAAW,CAACC,UAAU;EACnCC,IAAI,EAAEC,IAAI,CAACC,CAAAA;AACf,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,SAAS,GAAGC,UAAU,CAAiC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAChF,MAAMC,YAAY,GAAGC,QAAQ,EAAE,IAAIC,KAAK,CAACC,KAAK,CAAA;EAC9C,MAAM;IACFC,WAAW;IACXC,SAAS;IACTC,MAAM;IACNC,SAAS;IACTC,MAAM;IACNC,eAAe;IACfC,IAAI;IACJC,SAAS;IACTC,OAAO;IACPC,YAAY;IACZC,YAAY;IACZxB,WAAW,GAAGD,aAAa,CAACC,WAAW;IACvCyB,YAAY;IACZtB,IAAI,GAAGJ,aAAa,CAACI,IAAI;AACzBuB,IAAAA,KAAK,GAAGhB,YAAY;IACpBiB,QAAQ;IACRC,gBAAgB;IAChBC,KAAK;IACL,GAAGC,cAAAA;AACP,GAAC,GAAGtB,KAAK,CAAA;EACT,IAAIuB,aAAa,GAAG5B,IAAI,CAAA;;AAExB;AACA,EAAA,IAAIH,WAAW,KAAKC,WAAW,CAAC+B,QAAQ,EAAE;IACtCD,aAAa,GAAG3B,IAAI,CAAC6B,CAAC,CAAA;AAC1B,GAAA;AAEA,EAAA,MAAMC,oBAA6B,GAAGlC,WAAW,KAAKC,WAAW,CAAC+B,QAAQ,CAAA;EAE1E,MAAMG,MAAM,GAAG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AACjBI,MAAAA,KAAK,EAAEA,KAAAA;KACV,CACJ,EACA,CAACV,MAAM,IAAII,IAAI,IAAIO,QAAQ,IAAIC,gBAAgB,kBAC5CiC,IAAA,CAAA,KAAA,EAAA;MAAK9C,SAAS,EAAE,CAAGlB,EAAAA,SAAS,CAAY,SAAA,CAAA;MAAA8B,QAAA,EAAA,CACnCA,QAAQ,IAAIY,SAAS,EACrBkB,WAAW,EACXH,mBAAmB,GAAG1B,gBAAgB,GAAG,IAAI,CAAA;AAAA,KAC7C,CACR,EACAM,oBAAoB,IAAIT,YAAY,iBAAI4B,GAAA,CAAA,KAAA,EAAA;MAAKtC,SAAS,EAAE,CAAGlB,EAAAA,SAAS,CAAW,QAAA,CAAA;AAAA8B,MAAAA,QAAA,EAAEF,YAAAA;AAAY,KAAM,CAAC,EACpGS,oBAAoB,IAAIf,eAAe,iBACpCkC,GAAA,CAAA,KAAA,EAAA;MAAKtC,SAAS,EAAE,CAAGlB,EAAAA,SAAS,CAAY,SAAA,CAAA;AAAA8B,MAAAA,QAAA,EAAER,eAAAA;AAAe,KAAM,CAClE,EACAU,KAAK,gBAAGwB,GAAA,CAAA,KAAA,EAAA;MAAKtC,SAAS,EAAE,CAAGlB,EAAAA,SAAS,CAAU,OAAA,CAAA;AAAA8B,MAAAA,QAAA,EAAEE,KAAAA;KAAW,CAAC,GAAG,IAAI,CAAA;AAAA,GACnE,CAAC,CAAA;AAEd,CAAC,EAAC;AACFvB,SAAS,CAAC4D,WAAW,GAAGtE,cAAc,CAAA;AACtCU,SAAS,CAACS,SAAS,GAAGlB,SAAS,CAAA;AAC/BS,SAAS,CAAC6D,YAAY,GAAGpE,aAAa;;;;"}
|
package/_internal/15eab19b.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Children, isValidElement } from 'react';
|
|
2
|
-
import { m as getRootClassName, n as forwardRef, l as classNames } from './6589b796.js';
|
|
3
|
-
import { g as getTypographyClassName } from './d0dd1815.js';
|
|
4
|
-
import { f as fontColorClass } from './d45e3f16.js';
|
|
5
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Component display name.
|
|
9
|
-
*/
|
|
10
|
-
const COMPONENT_NAME = 'InlineList';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Component default class name and class prefix.
|
|
14
|
-
*/
|
|
15
|
-
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Component default props.
|
|
19
|
-
*/
|
|
20
|
-
const DEFAULT_PROPS = {};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* InlineList component.
|
|
24
|
-
*
|
|
25
|
-
* @param props Component props.
|
|
26
|
-
* @param ref Component ref.
|
|
27
|
-
* @return React element.
|
|
28
|
-
*/
|
|
29
|
-
const InlineList = forwardRef((props, ref) => {
|
|
30
|
-
const {
|
|
31
|
-
className,
|
|
32
|
-
color,
|
|
33
|
-
colorVariant,
|
|
34
|
-
typography,
|
|
35
|
-
children,
|
|
36
|
-
wrap,
|
|
37
|
-
...forwardedProps
|
|
38
|
-
} = props;
|
|
39
|
-
const typographyClassName = typography && getTypographyClassName(typography);
|
|
40
|
-
return (
|
|
41
|
-
/*#__PURE__*/
|
|
42
|
-
// eslint-disable-next-line jsx-a11y/no-redundant-roles
|
|
43
|
-
jsx("ul", {
|
|
44
|
-
...forwardedProps,
|
|
45
|
-
ref: ref,
|
|
46
|
-
className: classNames(className, CLASSNAME, wrap && `${CLASSNAME}--wrap`, fontColorClass(color, colorVariant), typographyClassName)
|
|
47
|
-
// Lists with removed bullet style can lose their a11y list role on some browsers
|
|
48
|
-
,
|
|
49
|
-
role: "list",
|
|
50
|
-
children: Children.toArray(children).map((child, index) => {
|
|
51
|
-
const key = /*#__PURE__*/isValidElement(child) && child.key || index;
|
|
52
|
-
return (
|
|
53
|
-
/*#__PURE__*/
|
|
54
|
-
// We need to item is set as display: contents which removes the semantic.
|
|
55
|
-
// eslint-disable-next-line jsx-a11y/no-redundant-roles
|
|
56
|
-
jsxs("li", {
|
|
57
|
-
role: "listitem",
|
|
58
|
-
className: `${CLASSNAME}__item`,
|
|
59
|
-
children: [index !== 0 && /*#__PURE__*/jsx("span", {
|
|
60
|
-
className: `${CLASSNAME}__item-separator`,
|
|
61
|
-
"aria-hidden": "true",
|
|
62
|
-
children: '\u00A0•\u00A0'
|
|
63
|
-
}), child]
|
|
64
|
-
}, key)
|
|
65
|
-
);
|
|
66
|
-
})
|
|
67
|
-
})
|
|
68
|
-
);
|
|
69
|
-
});
|
|
70
|
-
InlineList.displayName = COMPONENT_NAME;
|
|
71
|
-
InlineList.className = CLASSNAME;
|
|
72
|
-
InlineList.defaultProps = DEFAULT_PROPS;
|
|
73
|
-
|
|
74
|
-
export { InlineList };
|
|
75
|
-
//# sourceMappingURL=15eab19b.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"15eab19b.js","sources":["../../src/components/inline-list/InlineList.tsx"],"sourcesContent":["import { Children, isValidElement } from 'react';\n\nimport classNames from 'classnames';\n\nimport { ColorVariant, ColorWithVariants, Typography } from '@lumx/react';\nimport { GenericProps } from '@lumx/react/utils/type';\nimport { fontColorClass, getRootClassName, getTypographyClassName } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\n/**\n * Defines the props of the component.\n */\nexport interface InlineListProps extends GenericProps {\n /**\n * Text color.\n */\n color?: ColorWithVariants;\n /**\n * Lightened or darkened variant of the selected color.\n */\n colorVariant?: ColorVariant;\n /**\n * Typography variant.\n */\n typography?: Typography;\n /**\n * Activate line wrap on overflow.\n */\n wrap?: boolean;\n /**\n * Children\n */\n children?: React.ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'InlineList';\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 = {} as const;\n\n/**\n * InlineList component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const InlineList = forwardRef<InlineListProps>((props, ref) => {\n const { className, color, colorVariant, typography, children, wrap, ...forwardedProps } = props;\n const typographyClassName = typography && getTypographyClassName(typography);\n return (\n // eslint-disable-next-line jsx-a11y/no-redundant-roles\n <ul\n {...forwardedProps}\n ref={ref as any}\n className={classNames(\n className,\n CLASSNAME,\n wrap && `${CLASSNAME}--wrap`,\n fontColorClass(color, colorVariant),\n typographyClassName,\n )}\n // Lists with removed bullet style can lose their a11y list role on some browsers\n role=\"list\"\n >\n {Children.toArray(children).map((child, index) => {\n const key = (isValidElement(child) && child.key) || index;\n return (\n // We need to item is set as display: contents which removes the semantic.\n // eslint-disable-next-line jsx-a11y/no-redundant-roles\n <li key={key} role=\"listitem\" className={`${CLASSNAME}__item`}>\n {index !== 0 && (\n <span className={`${CLASSNAME}__item-separator`} aria-hidden=\"true\">\n {'\\u00A0•\\u00A0'}\n </span>\n )}\n {child}\n </li>\n );\n })}\n </ul>\n );\n});\nInlineList.displayName = COMPONENT_NAME;\nInlineList.className = CLASSNAME;\nInlineList.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","InlineList","forwardRef","props","ref","className","color","colorVariant","typography","children","wrap","forwardedProps","typographyClassName","getTypographyClassName","_jsx","classNames","fontColorClass","role","Children","toArray","map","child","index","key","isValidElement","_jsxs","displayName","defaultProps"],"mappings":";;;;;;AAmCA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,YAAY,CAAA;;AAEnC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAa,GAAG,EAAW,CAAA;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,UAAU,GAAGC,UAAU,CAAkB,CAACC,KAAK,EA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;KACD,CAAA;AAAC,IAAA;AAEb,CAAC,EAAC;AACFtB,UAAU,CAACyB,WAAW,GAAG7B,cAAc,CAAA;AACvCI,UAAU,CAACI,SAAS,GAAGP,SAAS,CAAA;AAChCG,UAAU,CAAC0B,YAAY,GAAG3B,aAAa;;;;"}
|
package/_internal/179a84d1.js
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import { useRef } from 'react';
|
|
2
|
-
import { m as getRootClassName, n as forwardRef, l as classNames, c as Size } from './6589b796.js';
|
|
3
|
-
import { u as useFocus } from './84dfe68f.js';
|
|
4
|
-
import { m as mergeRefs } from './f0d7d6ea.js';
|
|
5
|
-
import { u as useTheme } from './3181f000.js';
|
|
6
|
-
import { u as useDisableStateProps } from './b8667090.js';
|
|
7
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
-
import { TextField } from './b0b2e33d.js';
|
|
9
|
-
import { Dropdown } from './1ea72630.js';
|
|
10
|
-
import { C as Chip } from './85e3a5ca.js';
|
|
11
|
-
import { m as mdiClose } from './eaf6c45a.js';
|
|
12
|
-
import { I as Icon } from './8ab42752.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Component display name.
|
|
16
|
-
*/
|
|
17
|
-
const COMPONENT_NAME$1 = 'Autocomplete';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Component default class name and class prefix.
|
|
21
|
-
*/
|
|
22
|
-
const CLASSNAME$1 = getRootClassName(COMPONENT_NAME$1);
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Component default props.
|
|
26
|
-
*/
|
|
27
|
-
const DEFAULT_PROPS$1 = {
|
|
28
|
-
anchorToInput: false,
|
|
29
|
-
closeOnClick: false,
|
|
30
|
-
closeOnClickAway: true,
|
|
31
|
-
closeOnEscape: true,
|
|
32
|
-
shouldFocusOnClose: false
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Autocomplete component.
|
|
37
|
-
*
|
|
38
|
-
* @param props Component props.
|
|
39
|
-
* @param ref Component ref.
|
|
40
|
-
* @return React element.
|
|
41
|
-
*/
|
|
42
|
-
const Autocomplete = forwardRef((props, ref) => {
|
|
43
|
-
const defaultTheme = useTheme();
|
|
44
|
-
const {
|
|
45
|
-
disabledStateProps,
|
|
46
|
-
otherProps
|
|
47
|
-
} = useDisableStateProps(props);
|
|
48
|
-
const {
|
|
49
|
-
anchorToInput = DEFAULT_PROPS$1.anchorToInput,
|
|
50
|
-
children,
|
|
51
|
-
chips,
|
|
52
|
-
className,
|
|
53
|
-
closeOnClick = DEFAULT_PROPS$1.closeOnClick,
|
|
54
|
-
closeOnClickAway = DEFAULT_PROPS$1.closeOnClickAway,
|
|
55
|
-
closeOnEscape = DEFAULT_PROPS$1.closeOnEscape,
|
|
56
|
-
error,
|
|
57
|
-
fitToAnchorWidth,
|
|
58
|
-
hasError,
|
|
59
|
-
helper,
|
|
60
|
-
icon,
|
|
61
|
-
inputRef,
|
|
62
|
-
clearButtonProps,
|
|
63
|
-
isRequired,
|
|
64
|
-
isOpen,
|
|
65
|
-
isValid,
|
|
66
|
-
label,
|
|
67
|
-
name,
|
|
68
|
-
offset,
|
|
69
|
-
onBlur,
|
|
70
|
-
onChange,
|
|
71
|
-
onClose,
|
|
72
|
-
onFocus,
|
|
73
|
-
onInfiniteScroll,
|
|
74
|
-
placeholder,
|
|
75
|
-
placement,
|
|
76
|
-
shouldFocusOnClose = DEFAULT_PROPS$1.shouldFocusOnClose,
|
|
77
|
-
theme = defaultTheme,
|
|
78
|
-
value,
|
|
79
|
-
textFieldProps = {},
|
|
80
|
-
focusAnchorOnClose,
|
|
81
|
-
...forwardedProps
|
|
82
|
-
} = otherProps;
|
|
83
|
-
const inputAnchorRef = useRef(null);
|
|
84
|
-
const textFieldRef = useRef(null);
|
|
85
|
-
useFocus(inputAnchorRef.current, !isOpen && shouldFocusOnClose);
|
|
86
|
-
return /*#__PURE__*/jsxs("div", {
|
|
87
|
-
ref: ref,
|
|
88
|
-
...forwardedProps,
|
|
89
|
-
className: classNames(className, CLASSNAME$1),
|
|
90
|
-
children: [/*#__PURE__*/jsx(TextField, {
|
|
91
|
-
...textFieldProps,
|
|
92
|
-
chips: chips,
|
|
93
|
-
error: error,
|
|
94
|
-
hasError: hasError,
|
|
95
|
-
helper: helper,
|
|
96
|
-
icon: icon,
|
|
97
|
-
inputRef: mergeRefs(inputAnchorRef, inputRef),
|
|
98
|
-
clearButtonProps: clearButtonProps,
|
|
99
|
-
...disabledStateProps,
|
|
100
|
-
isRequired: isRequired,
|
|
101
|
-
isValid: isValid,
|
|
102
|
-
label: label,
|
|
103
|
-
name: name,
|
|
104
|
-
onBlur: onBlur,
|
|
105
|
-
onChange: onChange,
|
|
106
|
-
onFocus: onFocus,
|
|
107
|
-
placeholder: placeholder,
|
|
108
|
-
textFieldRef: textFieldRef,
|
|
109
|
-
theme: theme,
|
|
110
|
-
value: value
|
|
111
|
-
}), /*#__PURE__*/jsx(Dropdown, {
|
|
112
|
-
anchorRef: anchorToInput ? inputAnchorRef : textFieldRef,
|
|
113
|
-
closeOnClick: closeOnClick,
|
|
114
|
-
closeOnClickAway: closeOnClickAway,
|
|
115
|
-
closeOnEscape: closeOnEscape,
|
|
116
|
-
focusAnchorOnClose: focusAnchorOnClose,
|
|
117
|
-
fitToAnchorWidth: fitToAnchorWidth,
|
|
118
|
-
isOpen: isOpen,
|
|
119
|
-
offset: offset,
|
|
120
|
-
onClose: onClose,
|
|
121
|
-
onInfiniteScroll: onInfiniteScroll,
|
|
122
|
-
placement: placement,
|
|
123
|
-
shouldFocusOnOpen: false,
|
|
124
|
-
theme: theme,
|
|
125
|
-
children: children
|
|
126
|
-
})]
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
Autocomplete.displayName = COMPONENT_NAME$1;
|
|
130
|
-
Autocomplete.className = CLASSNAME$1;
|
|
131
|
-
Autocomplete.defaultProps = DEFAULT_PROPS$1;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Component display name.
|
|
135
|
-
*/
|
|
136
|
-
const COMPONENT_NAME = 'AutocompleteMultiple';
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Component default class name and class prefix.
|
|
140
|
-
*/
|
|
141
|
-
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Component default props.
|
|
145
|
-
*/
|
|
146
|
-
const DEFAULT_PROPS = {
|
|
147
|
-
closeOnClickAway: true,
|
|
148
|
-
closeOnEscape: true,
|
|
149
|
-
selectedChipRender(choice, index, onClear, isDisabled) {
|
|
150
|
-
const onClick = event => onClear && onClear(event, choice);
|
|
151
|
-
return /*#__PURE__*/jsx(Chip, {
|
|
152
|
-
after: onClear && /*#__PURE__*/jsx(Icon, {
|
|
153
|
-
icon: mdiClose,
|
|
154
|
-
size: Size.xxs
|
|
155
|
-
}),
|
|
156
|
-
isDisabled: isDisabled,
|
|
157
|
-
size: Size.s,
|
|
158
|
-
onAfterClick: onClick,
|
|
159
|
-
onClick: onClick,
|
|
160
|
-
children: choice
|
|
161
|
-
}, index);
|
|
162
|
-
},
|
|
163
|
-
values: []
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* AutocompleteMultiple component.
|
|
168
|
-
*
|
|
169
|
-
* @param props Component props.
|
|
170
|
-
* @param ref Component ref.
|
|
171
|
-
* @return React element.
|
|
172
|
-
*/
|
|
173
|
-
const AutocompleteMultiple = forwardRef((props, ref) => {
|
|
174
|
-
const defaultTheme = useTheme();
|
|
175
|
-
const {
|
|
176
|
-
disabledStateProps,
|
|
177
|
-
otherProps
|
|
178
|
-
} = useDisableStateProps(props);
|
|
179
|
-
const {
|
|
180
|
-
anchorToInput,
|
|
181
|
-
children,
|
|
182
|
-
// `chipsAlignment` needs to be here to remove it from `forwardedProps`.
|
|
183
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
184
|
-
chipsAlignment,
|
|
185
|
-
className,
|
|
186
|
-
closeOnClickAway = DEFAULT_PROPS.closeOnClickAway,
|
|
187
|
-
closeOnEscape = DEFAULT_PROPS.closeOnEscape,
|
|
188
|
-
fitToAnchorWidth,
|
|
189
|
-
hasError,
|
|
190
|
-
helper,
|
|
191
|
-
icon,
|
|
192
|
-
inputRef,
|
|
193
|
-
clearButtonProps,
|
|
194
|
-
isRequired,
|
|
195
|
-
isOpen,
|
|
196
|
-
isValid,
|
|
197
|
-
label,
|
|
198
|
-
name,
|
|
199
|
-
offset,
|
|
200
|
-
onBlur,
|
|
201
|
-
onChange,
|
|
202
|
-
onClear,
|
|
203
|
-
onClose,
|
|
204
|
-
onFocus,
|
|
205
|
-
onInfiniteScroll,
|
|
206
|
-
onKeyDown,
|
|
207
|
-
placeholder,
|
|
208
|
-
placement,
|
|
209
|
-
selectedChipRender = DEFAULT_PROPS.selectedChipRender,
|
|
210
|
-
shouldFocusOnClose,
|
|
211
|
-
theme = defaultTheme,
|
|
212
|
-
type,
|
|
213
|
-
value,
|
|
214
|
-
values = DEFAULT_PROPS.values,
|
|
215
|
-
...forwardedProps
|
|
216
|
-
} = otherProps;
|
|
217
|
-
return /*#__PURE__*/jsx(Autocomplete, {
|
|
218
|
-
ref: ref,
|
|
219
|
-
...forwardedProps,
|
|
220
|
-
anchorToInput: anchorToInput,
|
|
221
|
-
className: classNames(className, CLASSNAME),
|
|
222
|
-
name: name,
|
|
223
|
-
value: value,
|
|
224
|
-
onChange: onChange,
|
|
225
|
-
onKeyDown: onKeyDown,
|
|
226
|
-
onBlur: onBlur,
|
|
227
|
-
shouldFocusOnClose: shouldFocusOnClose,
|
|
228
|
-
onFocus: onFocus,
|
|
229
|
-
hasError: hasError,
|
|
230
|
-
helper: helper,
|
|
231
|
-
icon: icon,
|
|
232
|
-
inputRef: inputRef,
|
|
233
|
-
chips: values && values.map((chip, index) => selectedChipRender?.(chip, index, onClear)),
|
|
234
|
-
...disabledStateProps,
|
|
235
|
-
isRequired: isRequired,
|
|
236
|
-
clearButtonProps: clearButtonProps,
|
|
237
|
-
isValid: isValid,
|
|
238
|
-
label: label,
|
|
239
|
-
placeholder: placeholder,
|
|
240
|
-
theme: theme,
|
|
241
|
-
type: type,
|
|
242
|
-
isOpen: isOpen,
|
|
243
|
-
closeOnClick: false,
|
|
244
|
-
closeOnClickAway: closeOnClickAway,
|
|
245
|
-
closeOnEscape: closeOnEscape,
|
|
246
|
-
onClose: onClose,
|
|
247
|
-
offset: offset,
|
|
248
|
-
placement: placement,
|
|
249
|
-
fitToAnchorWidth: fitToAnchorWidth,
|
|
250
|
-
onInfiniteScroll: onInfiniteScroll,
|
|
251
|
-
children: children
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
AutocompleteMultiple.displayName = COMPONENT_NAME;
|
|
255
|
-
AutocompleteMultiple.className = CLASSNAME;
|
|
256
|
-
AutocompleteMultiple.defaultProps = DEFAULT_PROPS;
|
|
257
|
-
|
|
258
|
-
export { Autocomplete, AutocompleteMultiple };
|
|
259
|
-
//# sourceMappingURL=179a84d1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"179a84d1.js","sources":["../../src/components/autocomplete/Autocomplete.tsx","../../src/components/autocomplete/AutocompleteMultiple.tsx"],"sourcesContent":["import { ReactNode, SyntheticEvent, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Dropdown, DropdownProps, IconButtonProps, Offset, Placement, TextField, TextFieldProps } from '@lumx/react';\n\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName } from '@lumx/core/js/utils/className';\nimport { useFocus } from '@lumx/react/hooks/useFocus';\nimport { mergeRefs } from '@lumx/react/utils/react/mergeRefs';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nimport { useDisableStateProps } from '@lumx/react/utils/disabled/useDisableStateProps';\n\n/**\n * Defines the props of the component.\n */\nexport interface AutocompleteProps extends GenericProps, HasTheme {\n /**\n * Whether the suggestions list should display anchored to the input or to the wrapper.\n * @see {@link DropdownProps#anchorToInput}\n */\n anchorToInput?: boolean;\n /**\n * Props to pass to the clear button (minus those already set by the TextField props).\n * If not specified, the button won't be displayed.\n * @see {@link TextFieldProps#clearButtonProps}\n */\n clearButtonProps?: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;\n /**\n * Reference to the <input> or <textarea> element.\n * @see {@link TextFieldProps#inputRef}\n */\n inputRef?: TextFieldProps['inputRef'];\n /**\n * The offset that will be applied to the Dropdown position.\n * @see {@link DropdownProps#offset}\n */\n offset?: Offset;\n /**\n * The preferred Dropdown location against the anchor element.\n * @see {@link DropdownProps#placement}\n */\n placement?: Placement;\n /**\n * Manage dropdown width:\n * - `maxWidth`: dropdown not bigger than anchor\n * - `minWidth` or `true`: dropdown not smaller than anchor\n * - `width`: dropdown equal to the anchor.\n * @see {@link DropdownProps#fitToAnchorWidth}\n */\n fitToAnchorWidth?: DropdownProps['fitToAnchorWidth'];\n /**\n * The error related to the component.\n * @see {@link TextFieldProps#error}\n */\n error?: string | ReactNode;\n /**\n * Whether the text field is displayed with error style or not.\n * @see {@link TextFieldProps#hasError}\n */\n hasError?: boolean;\n /**\n * Whether the text box should be focused upon closing the suggestions or not.\n */\n shouldFocusOnClose?: boolean;\n /**\n * The helper message of the text field.\n * @see {@link TextFieldProps#helper}\n */\n helper?: string;\n /**\n * The icon of the text field (SVG path).\n * @see {@link TextFieldProps#icon}\n */\n icon?: string;\n /**\n * Whether the component is disabled or not.\n * @see {@link TextFieldProps#isDisabled}\n */\n isDisabled?: boolean;\n /**\n * Whether the component is required or not.\n * @see {@link TextFieldProps#isRequired}\n */\n isRequired?: boolean;\n /**\n * Whether the text field is displayed with valid style or not.\n * @see {@link TextFieldProps#isValid}\n */\n isValid?: boolean;\n /**\n * The label of the text field displayed in a label tag.\n * @see {@link TextFieldProps#label}\n */\n label?: string;\n /**\n * The placeholder message of the text field.\n * @see {@link TextFieldProps#placeholder}\n */\n placeholder?: string;\n /** List of suggestions to display during autocomplete. */\n children: React.ReactNode;\n /**\n * The list of chips to be displayed before the text field input.\n */\n chips?: React.ReactNode;\n /**\n * The value of the text field.\n * @see {@link TextFieldProps#value}\n */\n value: string;\n /**\n * Whether the suggestions from the autocomplete should be displayed or not.\n * @see {@link DropdownProps#isOpen}\n */\n isOpen: boolean;\n /**\n * The native input name property.\n * @see {@link TextFieldProps#name}\n */\n name?: string;\n /**\n * Whether a click in the Autocomplete dropdown would close it or not.\n * @see {@link DropdownProps#closeOnClick}\n */\n closeOnClick?: boolean;\n /**\n * Whether a click anywhere out of the Autocomplete would close it or not.\n * @see {@link DropdownProps#closeOnClickAway}\n */\n closeOnClickAway?: boolean;\n /**\n * Whether an escape key press would close the Autocomplete or not.\n * @see {@link DropdownProps#closeOnEscape}\n */\n closeOnEscape?: boolean;\n /**\n * Whether the focus should go back on the anchor when dropdown closes and focus is within.\n * @see {@link DropdownProps#focusAnchorOnClose}\n */\n focusAnchorOnClose?: DropdownProps['focusAnchorOnClose'];\n /**\n * The function called on blur.\n * @see {@link TextFieldProps#onBlur}\n */\n onBlur?(event: React.FocusEvent): void;\n /**\n * On change callback.\n * @see {@link TextFieldProps#onChange}\n */\n onChange(value: string, name?: string, event?: SyntheticEvent): void;\n /**\n * The function called on close.\n * @see {@link DropdownProps#onClose}\n */\n onClose?(): void;\n /**\n * The function called on focus.\n * @see {@link TextFieldProps#onFocus}\n */\n onFocus?(event: React.FocusEvent): void;\n /**\n * The function called when the bottom of the dropdown is reached.\n * @see {@link DropdownProps#onInfiniteScroll}\n */\n onInfiniteScroll?(): void;\n /**\n * Props forwarded to the underlying TextField component.\n * Only the props not managed by the Autocomplete can be set.\n * @see {@link TextFieldProps}\n */\n textFieldProps?: Partial<TextFieldProps>;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Autocomplete';\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<AutocompleteProps> = {\n anchorToInput: false,\n closeOnClick: false,\n closeOnClickAway: true,\n closeOnEscape: true,\n shouldFocusOnClose: false,\n};\n\n/**\n * Autocomplete component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Autocomplete = forwardRef<AutocompleteProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme();\n const { disabledStateProps, otherProps } = useDisableStateProps(props);\n const {\n anchorToInput = DEFAULT_PROPS.anchorToInput,\n children,\n chips,\n className,\n closeOnClick = DEFAULT_PROPS.closeOnClick,\n closeOnClickAway = DEFAULT_PROPS.closeOnClickAway,\n closeOnEscape = DEFAULT_PROPS.closeOnEscape,\n error,\n fitToAnchorWidth,\n hasError,\n helper,\n icon,\n inputRef,\n clearButtonProps,\n isRequired,\n isOpen,\n isValid,\n label,\n name,\n offset,\n onBlur,\n onChange,\n onClose,\n onFocus,\n onInfiniteScroll,\n placeholder,\n placement,\n shouldFocusOnClose = DEFAULT_PROPS.shouldFocusOnClose,\n theme = defaultTheme,\n value,\n textFieldProps = {},\n focusAnchorOnClose,\n ...forwardedProps\n } = otherProps;\n const inputAnchorRef = useRef<HTMLElement>(null);\n const textFieldRef = useRef(null);\n useFocus(inputAnchorRef.current, !isOpen && shouldFocusOnClose);\n\n return (\n <div ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>\n <TextField\n {...textFieldProps}\n chips={chips}\n error={error}\n hasError={hasError}\n helper={helper}\n icon={icon}\n inputRef={mergeRefs(inputAnchorRef as React.RefObject<HTMLInputElement>, inputRef)}\n clearButtonProps={clearButtonProps}\n {...disabledStateProps}\n isRequired={isRequired}\n isValid={isValid}\n label={label}\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n placeholder={placeholder}\n textFieldRef={textFieldRef}\n theme={theme}\n value={value}\n />\n <Dropdown\n anchorRef={anchorToInput ? inputAnchorRef : textFieldRef}\n closeOnClick={closeOnClick}\n closeOnClickAway={closeOnClickAway}\n closeOnEscape={closeOnEscape}\n focusAnchorOnClose={focusAnchorOnClose}\n fitToAnchorWidth={fitToAnchorWidth}\n isOpen={isOpen}\n offset={offset}\n onClose={onClose}\n onInfiniteScroll={onInfiniteScroll}\n placement={placement}\n shouldFocusOnOpen={false}\n theme={theme}\n >\n {children}\n </Dropdown>\n </div>\n );\n});\nAutocomplete.displayName = COMPONENT_NAME;\nAutocomplete.className = CLASSNAME;\nAutocomplete.defaultProps = DEFAULT_PROPS;\n","import { ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { mdiClose } from '@lumx/icons';\n\nimport { Autocomplete, AutocompleteProps, Chip, HorizontalAlignment, Icon, Size } from '@lumx/react';\nimport { getRootClassName } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\n\nimport { useDisableStateProps } from '@lumx/react/utils/disabled/useDisableStateProps';\n\n/**\n * Defines the props of the component.\n */\nexport interface AutocompleteMultipleProps extends AutocompleteProps {\n /** Selected values. */\n values: any[];\n /** Alignment of the chips in the autocomplete. */\n chipsAlignment?: HorizontalAlignment;\n /** Selected value render function. Default: Renders the value inside of a Chip. */\n selectedChipRender(\n choice: any,\n index: number,\n onClear?: (event: React.MouseEvent, choice: any) => void,\n isDisabled?: boolean,\n ): ReactNode | string;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'AutocompleteMultiple';\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<AutocompleteMultipleProps> = {\n closeOnClickAway: true,\n closeOnEscape: true,\n selectedChipRender(choice, index, onClear, isDisabled) {\n const onClick = (event: React.MouseEvent) => onClear && onClear(event, choice);\n return (\n <Chip\n key={index}\n after={onClear && <Icon icon={mdiClose} size={Size.xxs} />}\n isDisabled={isDisabled}\n size={Size.s}\n onAfterClick={onClick}\n onClick={onClick}\n >\n {choice}\n </Chip>\n );\n },\n values: [],\n};\n\n/**\n * AutocompleteMultiple component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const AutocompleteMultiple = forwardRef<AutocompleteMultipleProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme();\n const { disabledStateProps, otherProps } = useDisableStateProps(props);\n const {\n anchorToInput,\n children,\n // `chipsAlignment` needs to be here to remove it from `forwardedProps`.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n chipsAlignment,\n className,\n closeOnClickAway = DEFAULT_PROPS.closeOnClickAway,\n closeOnEscape = DEFAULT_PROPS.closeOnEscape,\n fitToAnchorWidth,\n hasError,\n helper,\n icon,\n inputRef,\n clearButtonProps,\n isRequired,\n isOpen,\n isValid,\n label,\n name,\n offset,\n onBlur,\n onChange,\n onClear,\n onClose,\n onFocus,\n onInfiniteScroll,\n onKeyDown,\n placeholder,\n placement,\n selectedChipRender = DEFAULT_PROPS.selectedChipRender,\n shouldFocusOnClose,\n theme = defaultTheme,\n type,\n value,\n values = DEFAULT_PROPS.values,\n ...forwardedProps\n } = otherProps;\n\n return (\n <Autocomplete\n ref={ref}\n {...forwardedProps}\n anchorToInput={anchorToInput}\n className={classNames(className, CLASSNAME)}\n name={name}\n value={value}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n shouldFocusOnClose={shouldFocusOnClose}\n onFocus={onFocus}\n hasError={hasError}\n helper={helper}\n icon={icon}\n inputRef={inputRef}\n chips={values && values.map((chip: any, index: number) => selectedChipRender?.(chip, index, onClear))}\n {...disabledStateProps}\n isRequired={isRequired}\n clearButtonProps={clearButtonProps}\n isValid={isValid}\n label={label}\n placeholder={placeholder}\n theme={theme}\n type={type}\n isOpen={isOpen}\n closeOnClick={false}\n closeOnClickAway={closeOnClickAway}\n closeOnEscape={closeOnEscape}\n onClose={onClose}\n offset={offset}\n placement={placement}\n fitToAnchorWidth={fitToAnchorWidth}\n onInfiniteScroll={onInfiniteScroll}\n >\n {children}\n </Autocomplete>\n );\n});\nAutocompleteMultiple.displayName = COMPONENT_NAME;\nAutocompleteMultiple.className = CLASSNAME;\nAutocompleteMultiple.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","anchorToInput","closeOnClick","closeOnClickAway","closeOnEscape","shouldFocusOnClose","Autocomplete","forwardRef","props","ref","defaultTheme","useTheme","disabledStateProps","otherProps","useDisableStateProps","children","chips","className","error","fitToAnchorWidth","hasError","helper","icon","inputRef","clearButtonProps","isRequired","isOpen","isValid","label","name","offset","onBlur","onChange","onClose","onFocus","onInfiniteScroll","placeholder","placement","theme","value","textFieldProps","focusAnchorOnClose","forwardedProps","inputAnchorRef","useRef","textFieldRef","useFocus","current","_jsxs","classNames","_jsx","TextField","mergeRefs","Dropdown","anchorRef","shouldFocusOnOpen","displayName","defaultProps","selectedChipRender","choice","index","onClear","isDisabled","onClick","event","Chip","after","Icon","mdiClose","size","Size","xxs","s","onAfterClick","values","AutocompleteMultiple","chipsAlignment","onKeyDown","type","map","chip"],"mappings":";;;;;;;;;;;;;AAiLA;AACA;AACA;AACA,MAAMA,gBAAc,GAAG,cAAc,CAAA;;AAErC;AACA;AACA;AACA,MAAMC,WAAS,GAAGC,gBAAgB,CAACF,gBAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,eAAyC,GAAG;AAC9CC,EAAAA,aAAa,EAAE,KAAK;AACpBC,EAAAA,YAAY,EAAE,KAAK;AACnBC,EAAAA,gBAAgB,EAAE,IAAI;AACtBC,EAAAA,aAAa,EAAE,IAAI;AACnBC,EAAAA,kBAAkB,EAAE,KAAA;AACxB,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,GAAGC,UAAU,CAAoC,CAAC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52 +0,0 @@
|
|
|
1
|
-
import { m as getRootClassName, n as forwardRef, l as classNames } from './6589b796.js';
|
|
2
|
-
import { u as useHeadingLevel, D as DEFAULT_TYPOGRAPHY_BY_LEVEL } from './370bdaed.js';
|
|
3
|
-
export { H as HeadingLevelProvider } from './370bdaed.js';
|
|
4
|
-
import { jsx } from 'react/jsx-runtime';
|
|
5
|
-
import { T as Text } from './0420e67b.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Component display name.
|
|
9
|
-
*/
|
|
10
|
-
const COMPONENT_NAME = 'Heading';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Component default class name and class prefix.
|
|
14
|
-
*/
|
|
15
|
-
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Component default props.
|
|
19
|
-
*/
|
|
20
|
-
const DEFAULT_PROPS = {};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Renders a heading component.
|
|
24
|
-
* Extends the `Text` Component with the heading level automatically computed based on
|
|
25
|
-
* the current level provided by the context.
|
|
26
|
-
*/
|
|
27
|
-
const Heading = forwardRef((props, ref) => {
|
|
28
|
-
const {
|
|
29
|
-
children,
|
|
30
|
-
as,
|
|
31
|
-
className,
|
|
32
|
-
...forwardedProps
|
|
33
|
-
} = props;
|
|
34
|
-
const {
|
|
35
|
-
headingElement
|
|
36
|
-
} = useHeadingLevel();
|
|
37
|
-
const computedHeadingElement = as || headingElement;
|
|
38
|
-
return /*#__PURE__*/jsx(Text, {
|
|
39
|
-
ref: ref,
|
|
40
|
-
className: classNames(className, CLASSNAME),
|
|
41
|
-
as: computedHeadingElement,
|
|
42
|
-
typography: DEFAULT_TYPOGRAPHY_BY_LEVEL[computedHeadingElement],
|
|
43
|
-
...forwardedProps,
|
|
44
|
-
children: children
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
Heading.displayName = COMPONENT_NAME;
|
|
48
|
-
Heading.className = CLASSNAME;
|
|
49
|
-
Heading.defaultProps = DEFAULT_PROPS;
|
|
50
|
-
|
|
51
|
-
export { Heading, useHeadingLevel };
|
|
52
|
-
//# sourceMappingURL=193521fa.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"193521fa.js","sources":["../../src/components/heading/Heading.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport { HeadingElement } from '@lumx/react/utils/type';\nimport { getRootClassName } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nimport { Text, TextProps } from '../text';\nimport { DEFAULT_TYPOGRAPHY_BY_LEVEL } from './constants';\nimport { useHeadingLevel } from './useHeadingLevel';\n\n/**\n * Defines the props of the component.\n */\nexport interface HeadingProps extends Partial<TextProps> {\n /**\n * Display a specific heading level instead of the one provided by parent context provider.\n */\n as?: HeadingElement;\n /**\n * Children\n */\n children?: React.ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Heading';\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 = {} as const;\n\n/**\n * Renders a heading component.\n * Extends the `Text` Component with the heading level automatically computed based on\n * the current level provided by the context.\n */\nexport const Heading = forwardRef<HeadingProps>((props, ref) => {\n const { children, as, className, ...forwardedProps } = props;\n const { headingElement } = useHeadingLevel();\n\n const computedHeadingElement = as || headingElement;\n return (\n <Text\n ref={ref}\n className={classNames(className, CLASSNAME)}\n as={computedHeadingElement}\n typography={DEFAULT_TYPOGRAPHY_BY_LEVEL[computedHeadingElement]}\n {...forwardedProps}\n >\n {children}\n </Text>\n );\n});\n\nHeading.displayName = COMPONENT_NAME;\nHeading.className = CLASSNAME;\nHeading.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","Heading","forwardRef","props","ref","children","as","className","forwardedProps","headingElement","useHeadingLevel","computedHeadingElement","_jsx","Text","classNames","typography","DEFAULT_TYPOGRAPHY_BY_LEVEL","displayName","defaultProps"],"mappings":";;;;;;AAwBA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,SAAS,CAAA;;AAEhC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAa,GAAG,EAAW,CAAA;;AAEjC;AACA;AACA;AACA;AACA;AACO,MAAMC,OAAO,GAAGC,UAAU,CAAe,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC5D,MAAM;IAAEC,QAAQ;IAAEC,EAAE;IAAEC,SAAS;IAAE,GAAGC,cAAAA;AAAe,GAAC,GAAGL,KAAK,CAAA;EAC5D,MAAM;AAAEM,IAAAA,cAAAA;GAAgB,GAAGC,eAAe,EAAE,CAAA;AAE5C,EAAA,MAAMC,sBAAsB,GAAGL,EAAE,IAAIG,cAAc,CAAA;EACnD,oBACIG,GAAA,CAACC,IAAI,EAAA;AACDT,IAAAA,GAAG,EAAEA,GAAI;AACTG,IAAAA,SAAS,EAAEO,UAAU,CAACP,SAAS,EAAET,SAAS,CAAE;AAC5CQ,IAAAA,EAAE,EAAEK,sBAAuB;AAC3BI,IAAAA,UAAU,EAAEC,2BAA2B,CAACL,sBAAsB,CAAE;AAAA,IAAA,GAC5DH,cAAc;AAAAH,IAAAA,QAAA,EAEjBA,QAAAA;AAAQ,GACP,CAAC,CAAA;AAEf,CAAC,EAAC;AAEFJ,OAAO,CAACgB,WAAW,GAAGpB,cAAc,CAAA;AACpCI,OAAO,CAACM,SAAS,GAAGT,SAAS,CAAA;AAC7BG,OAAO,CAACiB,YAAY,GAAGlB,aAAa;;;;"}
|