@lumx/react 3.0.2 → 3.0.3
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/{esm/_internal/_rollupPluginBabelHelpers.js → _internal/ClickAwayProvider.js} +107 -2
- package/_internal/ClickAwayProvider.js.map +1 -0
- package/_internal/types.d.ts +271 -0
- package/index.d.ts +2686 -0
- package/index.js +12533 -0
- package/index.js.map +1 -0
- package/package.json +7 -6
- package/src/components/alert-dialog/AlertDialog.tsx +2 -1
- package/src/components/autocomplete/Autocomplete.tsx +2 -2
- package/src/components/autocomplete/AutocompleteMultiple.tsx +2 -1
- package/src/components/avatar/Avatar.tsx +2 -1
- package/src/components/badge/Badge.test.tsx +1 -1
- package/src/components/badge/Badge.tsx +2 -1
- package/src/components/button/Button.test.tsx +1 -1
- package/src/components/button/Button.tsx +2 -1
- package/src/components/button/ButtonGroup.tsx +2 -1
- package/src/components/button/ButtonRoot.test.tsx +1 -1
- package/src/components/button/ButtonRoot.tsx +2 -1
- package/src/components/button/IconButton.tsx +2 -1
- package/src/components/checkbox/Checkbox.test.tsx +1 -1
- package/src/components/checkbox/Checkbox.tsx +2 -1
- package/src/components/chip/Chip.test.tsx +1 -1
- package/src/components/chip/Chip.tsx +3 -1
- package/src/components/chip/ChipGroup.tsx +2 -1
- package/src/components/comment-block/CommentBlock.tsx +2 -1
- package/src/components/date-picker/DatePicker.tsx +1 -1
- package/src/components/date-picker/DatePickerControlled.tsx +1 -1
- package/src/components/date-picker/DatePickerField.tsx +1 -1
- package/src/components/date-picker/constants.ts +1 -1
- package/src/components/date-picker/types.ts +1 -1
- package/src/components/dialog/Dialog.tsx +4 -8
- package/src/components/divider/Divider.test.tsx +1 -1
- package/src/components/divider/Divider.tsx +3 -2
- package/src/components/drag-handle/DragHandle.tsx +2 -1
- package/src/components/dropdown/Dropdown.tsx +2 -1
- package/src/components/expansion-panel/ExpansionPanel.test.tsx +1 -1
- package/src/components/expansion-panel/ExpansionPanel.tsx +3 -10
- package/src/components/flag/Flag.test.tsx +1 -1
- package/src/components/flag/Flag.tsx +2 -1
- package/src/components/flex-box/FlexBox.stories.tsx +8 -0
- package/src/components/flex-box/FlexBox.tsx +7 -3
- package/src/components/flex-box/__snapshots__/FlexBox.test.tsx.snap +16 -0
- package/src/components/generic-block/GenericBlock.stories.jsx +23 -1
- package/src/components/generic-block/GenericBlock.tsx +18 -4
- package/src/components/generic-block/constants.ts +9 -0
- package/src/components/generic-block/index.ts +1 -0
- package/src/components/grid/Grid.tsx +2 -1
- package/src/components/grid/GridItem.tsx +2 -1
- package/src/components/heading/Heading.tsx +2 -1
- package/src/components/heading/HeadingLevelProvider.tsx +1 -1
- package/src/components/heading/context.tsx +1 -1
- package/src/components/icon/Icon.test.tsx +1 -1
- package/src/components/icon/Icon.tsx +2 -1
- package/src/components/image-block/ImageBlock.tsx +2 -1
- package/src/components/index.ts +1 -1
- package/src/components/inline-list/InlineList.stories.tsx +40 -0
- package/src/components/inline-list/InlineList.test.tsx +41 -0
- package/src/components/inline-list/InlineList.tsx +80 -0
- package/src/components/inline-list/index.ts +1 -0
- package/src/components/input-helper/InputHelper.tsx +2 -1
- package/src/components/input-label/InputLabel.tsx +2 -1
- package/src/components/lightbox/Lightbox.tsx +2 -1
- package/src/components/link/Link.tsx +2 -1
- package/src/components/link-preview/LinkPreview.test.tsx +1 -1
- package/src/components/link-preview/LinkPreview.tsx +2 -1
- package/src/components/list/List.tsx +2 -1
- package/src/components/list/ListDivider.tsx +2 -1
- package/src/components/list/ListItem.tsx +3 -8
- package/src/components/list/ListSubheader.tsx +2 -1
- package/src/components/list/useInteractiveList.tsx +1 -1
- package/src/components/message/Message.test.tsx +1 -1
- package/src/components/message/Message.tsx +2 -1
- package/src/components/mosaic/Mosaic.tsx +2 -1
- package/src/components/notification/Notification.tsx +2 -1
- package/src/components/popover/Popover.tsx +2 -1
- package/src/components/post-block/PostBlock.tsx +2 -1
- package/src/components/progress/Progress.tsx +2 -1
- package/src/components/progress-tracker/ProgressTracker.tsx +2 -1
- package/src/components/progress-tracker/ProgressTrackerStep.test.tsx +1 -1
- package/src/components/progress-tracker/ProgressTrackerStep.tsx +2 -1
- package/src/components/progress-tracker/ProgressTrackerStepPanel.tsx +2 -1
- package/src/components/radio-button/RadioButton.test.tsx +1 -1
- package/src/components/radio-button/RadioButton.tsx +2 -1
- package/src/components/radio-button/RadioGroup.tsx +2 -1
- package/src/components/select/Select.test.tsx +1 -1
- package/src/components/select/Select.tsx +2 -1
- package/src/components/select/SelectMultiple.test.tsx +1 -1
- package/src/components/select/SelectMultiple.tsx +2 -1
- package/src/components/select/WithSelectContext.tsx +1 -1
- package/src/components/select/constants.ts +1 -1
- package/src/components/side-navigation/SideNavigation.tsx +2 -1
- package/src/components/side-navigation/SideNavigationItem.test.tsx +1 -1
- package/src/components/side-navigation/SideNavigationItem.tsx +3 -9
- package/src/components/skeleton/SkeletonCircle.tsx +2 -1
- package/src/components/skeleton/SkeletonRectangle.tsx +2 -1
- package/src/components/skeleton/SkeletonTypography.tsx +2 -1
- package/src/components/slider/Slider.tsx +2 -1
- package/src/components/slideshow/Slides.tsx +2 -1
- package/src/components/slideshow/Slideshow.tsx +1 -1
- package/src/components/slideshow/SlideshowControls.tsx +2 -1
- package/src/components/slideshow/SlideshowItem.tsx +2 -1
- package/src/components/slideshow/SlideshowItemGroup.tsx +2 -1
- package/src/components/switch/Switch.test.tsx +1 -1
- package/src/components/switch/Switch.tsx +2 -1
- package/src/components/table/Table.tsx +2 -1
- package/src/components/table/TableBody.tsx +2 -1
- package/src/components/table/TableCell.tsx +3 -1
- package/src/components/table/TableHeader.tsx +2 -1
- package/src/components/table/TableRow.tsx +2 -1
- package/src/components/tabs/Tab.test.tsx +1 -1
- package/src/components/tabs/Tab.tsx +2 -1
- package/src/components/tabs/TabList.test.tsx +1 -1
- package/src/components/tabs/TabList.tsx +2 -1
- package/src/components/tabs/TabPanel.tsx +2 -1
- package/src/components/text/{Text.stories.tsx → Text.stories.jsx} +23 -28
- package/src/components/text/Text.test.tsx +15 -1
- package/src/components/text/Text.tsx +38 -12
- package/src/components/text-field/TextField.test.tsx +1 -1
- package/src/components/text-field/TextField.tsx +2 -1
- package/src/components/thumbnail/Thumbnail.tsx +2 -1
- package/src/components/thumbnail/types.ts +1 -1
- package/src/components/toolbar/Toolbar.tsx +2 -1
- package/src/components/tooltip/Tooltip.tsx +2 -1
- package/src/components/tooltip/useTooltipOpen.tsx +1 -1
- package/src/components/uploader/Uploader.test.tsx +1 -1
- package/src/components/uploader/Uploader.tsx +2 -1
- package/src/components/user-block/UserBlock.tsx +2 -1
- package/src/hooks/useCallbackOnEscape.ts +2 -1
- package/src/hooks/useClickAway.tsx +1 -1
- package/src/hooks/useDisableBodyScroll.ts +1 -1
- package/src/hooks/useFocusTrap.ts +1 -1
- package/src/hooks/useInterval.tsx +1 -1
- package/src/hooks/useOnResize.ts +1 -1
- package/src/index.ts +5 -0
- package/src/stories/generated/GenericBlock/Demos.stories.tsx +3 -1
- package/src/stories/generated/Heading/Demos.stories.tsx +6 -0
- package/src/stories/withResizableBox.tsx +18 -0
- package/src/testing/utils/commonTestsSuite.ts +1 -1
- package/src/utils/{getRootClassName.ts → className.ts} +19 -0
- package/src/utils/event.ts +1 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/type.ts +3 -0
- package/src/utils/utils.test.ts +1 -1
- package/types.d.ts +68 -11
- package/utils/index.d.ts +29 -0
- package/utils/index.js +2 -0
- package/utils/index.js.map +1 -0
- package/esm/_internal/AlertDialog.js +0 -141
- package/esm/_internal/AlertDialog.js.map +0 -1
- package/esm/_internal/AutocompleteMultiple.js +0 -257
- package/esm/_internal/AutocompleteMultiple.js.map +0 -1
- package/esm/_internal/Avatar2.js +0 -82
- package/esm/_internal/Avatar2.js.map +0 -1
- package/esm/_internal/Badge2.js +0 -54
- package/esm/_internal/Badge2.js.map +0 -1
- package/esm/_internal/Button2.js +0 -84
- package/esm/_internal/Button2.js.map +0 -1
- package/esm/_internal/ButtonGroup.js +0 -51
- package/esm/_internal/ButtonGroup.js.map +0 -1
- package/esm/_internal/ButtonRoot.js +0 -135
- package/esm/_internal/ButtonRoot.js.map +0 -1
- package/esm/_internal/Checkbox2.js +0 -116
- package/esm/_internal/Checkbox2.js.map +0 -1
- package/esm/_internal/Chip2.js +0 -118
- package/esm/_internal/Chip2.js.map +0 -1
- package/esm/_internal/ChipGroup.js +0 -122
- package/esm/_internal/ChipGroup.js.map +0 -1
- package/esm/_internal/ClickAwayProvider.js +0 -217
- package/esm/_internal/ClickAwayProvider.js.map +0 -1
- package/esm/_internal/CommentBlock.js +0 -124
- package/esm/_internal/CommentBlock.js.map +0 -1
- package/esm/_internal/DatePickerField.js +0 -347
- package/esm/_internal/DatePickerField.js.map +0 -1
- package/esm/_internal/Dialog2.js +0 -274
- package/esm/_internal/Dialog2.js.map +0 -1
- package/esm/_internal/Divider2.js +0 -53
- package/esm/_internal/Divider2.js.map +0 -1
- package/esm/_internal/DragHandle.js +0 -50
- package/esm/_internal/DragHandle.js.map +0 -1
- package/esm/_internal/Dropdown2.js +0 -157
- package/esm/_internal/Dropdown2.js.map +0 -1
- package/esm/_internal/ExpansionPanel.js +0 -156
- package/esm/_internal/ExpansionPanel.js.map +0 -1
- package/esm/_internal/Flag2.js +0 -48
- package/esm/_internal/Flag2.js.map +0 -1
- package/esm/_internal/FlexBox.js +0 -55
- package/esm/_internal/FlexBox.js.map +0 -1
- package/esm/_internal/GenericBlock.js +0 -125
- package/esm/_internal/GenericBlock.js.map +0 -1
- package/esm/_internal/GridItem.js +0 -96
- package/esm/_internal/GridItem.js.map +0 -1
- package/esm/_internal/HeadingLevelProvider.js +0 -112
- package/esm/_internal/HeadingLevelProvider.js.map +0 -1
- package/esm/_internal/Icon2.js +0 -120
- package/esm/_internal/Icon2.js.map +0 -1
- package/esm/_internal/IconButton.js +0 -74
- package/esm/_internal/IconButton.js.map +0 -1
- package/esm/_internal/ImageBlock.js +0 -101
- package/esm/_internal/ImageBlock.js.map +0 -1
- package/esm/_internal/InputHelper.js +0 -72
- package/esm/_internal/InputHelper.js.map +0 -1
- package/esm/_internal/InputLabel.js +0 -58
- package/esm/_internal/InputLabel.js.map +0 -1
- package/esm/_internal/Lightbox2.js +0 -123
- package/esm/_internal/Lightbox2.js.map +0 -1
- package/esm/_internal/Link2.js +0 -122
- package/esm/_internal/Link2.js.map +0 -1
- package/esm/_internal/LinkPreview.js +0 -105
- package/esm/_internal/LinkPreview.js.map +0 -1
- package/esm/_internal/List2.js +0 -799
- package/esm/_internal/List2.js.map +0 -1
- package/esm/_internal/ListSubheader.js +0 -79
- package/esm/_internal/ListSubheader.js.map +0 -1
- package/esm/_internal/Message2.js +0 -78
- package/esm/_internal/Message2.js.map +0 -1
- package/esm/_internal/Mosaic2.js +0 -89
- package/esm/_internal/Mosaic2.js.map +0 -1
- package/esm/_internal/Notification2.js +0 -133
- package/esm/_internal/Notification2.js.map +0 -1
- package/esm/_internal/Popover2.js +0 -2473
- package/esm/_internal/Popover2.js.map +0 -1
- package/esm/_internal/PostBlock.js +0 -96
- package/esm/_internal/PostBlock.js.map +0 -1
- package/esm/_internal/Progress2.js +0 -81
- package/esm/_internal/Progress2.js.map +0 -1
- package/esm/_internal/ProgressTrackerStepPanel.js +0 -313
- package/esm/_internal/ProgressTrackerStepPanel.js.map +0 -1
- package/esm/_internal/RadioGroup.js +0 -147
- package/esm/_internal/RadioGroup.js.map +0 -1
- package/esm/_internal/SelectMultiple.js +0 -424
- package/esm/_internal/SelectMultiple.js.map +0 -1
- package/esm/_internal/SideNavigationItem.js +0 -151
- package/esm/_internal/SideNavigationItem.js.map +0 -1
- package/esm/_internal/SkeletonTypography.js +0 -168
- package/esm/_internal/SkeletonTypography.js.map +0 -1
- package/esm/_internal/Slider2.js +0 -327
- package/esm/_internal/Slider2.js.map +0 -1
- package/esm/_internal/Slides.js +0 -864
- package/esm/_internal/Slides.js.map +0 -1
- package/esm/_internal/Switch2.js +0 -116
- package/esm/_internal/Switch2.js.map +0 -1
- package/esm/_internal/TabPanel.js +0 -280
- package/esm/_internal/TabPanel.js.map +0 -1
- package/esm/_internal/TableRow.js +0 -291
- package/esm/_internal/TableRow.js.map +0 -1
- package/esm/_internal/Text2.js +0 -63
- package/esm/_internal/Text2.js.map +0 -1
- package/esm/_internal/TextField.js +0 -322
- package/esm/_internal/TextField.js.map +0 -1
- package/esm/_internal/Thumbnail2.js +0 -301
- package/esm/_internal/Thumbnail2.js.map +0 -1
- package/esm/_internal/Toolbar2.js +0 -60
- package/esm/_internal/Toolbar2.js.map +0 -1
- package/esm/_internal/Tooltip2.js +0 -282
- package/esm/_internal/Tooltip2.js.map +0 -1
- package/esm/_internal/Uploader2.js +0 -84
- package/esm/_internal/Uploader2.js.map +0 -1
- package/esm/_internal/UserBlock.js +0 -132
- package/esm/_internal/UserBlock.js.map +0 -1
- package/esm/_internal/_rollupPluginBabelHelpers.js.map +0 -1
- package/esm/_internal/alert-dialog.js +0 -34
- package/esm/_internal/alert-dialog.js.map +0 -1
- package/esm/_internal/autocomplete.js +0 -32
- package/esm/_internal/autocomplete.js.map +0 -1
- package/esm/_internal/avatar.js +0 -13
- package/esm/_internal/avatar.js.map +0 -1
- package/esm/_internal/badge.js +0 -10
- package/esm/_internal/badge.js.map +0 -1
- package/esm/_internal/button.js +0 -25
- package/esm/_internal/button.js.map +0 -1
- package/esm/_internal/checkbox.js +0 -14
- package/esm/_internal/checkbox.js.map +0 -1
- package/esm/_internal/chip.js +0 -12
- package/esm/_internal/chip.js.map +0 -1
- package/esm/_internal/comment-block.js +0 -24
- package/esm/_internal/comment-block.js.map +0 -1
- package/esm/_internal/components.js +0 -156
- package/esm/_internal/components.js.map +0 -1
- package/esm/_internal/constants.js +0 -13
- package/esm/_internal/constants.js.map +0 -1
- package/esm/_internal/date-picker.js +0 -32
- package/esm/_internal/date-picker.js.map +0 -1
- package/esm/_internal/dialog.js +0 -27
- package/esm/_internal/dialog.js.map +0 -1
- package/esm/_internal/divider.js +0 -10
- package/esm/_internal/divider.js.map +0 -1
- package/esm/_internal/drag-handle.js +0 -11
- package/esm/_internal/drag-handle.js.map +0 -1
- package/esm/_internal/dropdown.js +0 -21
- package/esm/_internal/dropdown.js.map +0 -1
- package/esm/_internal/expansion-panel.js +0 -32
- package/esm/_internal/expansion-panel.js.map +0 -1
- package/esm/_internal/flag.js +0 -11
- package/esm/_internal/flag.js.map +0 -1
- package/esm/_internal/flex-box.js +0 -11
- package/esm/_internal/flex-box.js.map +0 -1
- package/esm/_internal/generic-block.js +0 -20
- package/esm/_internal/generic-block.js.map +0 -1
- package/esm/_internal/getRootClassName.js +0 -346
- package/esm/_internal/getRootClassName.js.map +0 -1
- package/esm/_internal/grid.js +0 -10
- package/esm/_internal/grid.js.map +0 -1
- package/esm/_internal/heading.js +0 -11
- package/esm/_internal/heading.js.map +0 -1
- package/esm/_internal/icon.js +0 -10
- package/esm/_internal/icon.js.map +0 -1
- package/esm/_internal/image-block.js +0 -14
- package/esm/_internal/image-block.js.map +0 -1
- package/esm/_internal/input-helper.js +0 -10
- package/esm/_internal/input-helper.js.map +0 -1
- package/esm/_internal/input-label.js +0 -10
- package/esm/_internal/input-label.js.map +0 -1
- package/esm/_internal/lightbox.js +0 -27
- package/esm/_internal/lightbox.js.map +0 -1
- package/esm/_internal/link-preview.js +0 -15
- package/esm/_internal/link-preview.js.map +0 -1
- package/esm/_internal/link.js +0 -12
- package/esm/_internal/link.js.map +0 -1
- package/esm/_internal/list.js +0 -15
- package/esm/_internal/list.js.map +0 -1
- package/esm/_internal/mergeRefs.js +0 -25
- package/esm/_internal/mergeRefs.js.map +0 -1
- package/esm/_internal/message.js +0 -11
- package/esm/_internal/message.js.map +0 -1
- package/esm/_internal/mosaic.js +0 -14
- package/esm/_internal/mosaic.js.map +0 -1
- package/esm/_internal/notification.js +0 -18
- package/esm/_internal/notification.js.map +0 -1
- package/esm/_internal/partitionMulti.js +0 -27
- package/esm/_internal/partitionMulti.js.map +0 -1
- package/esm/_internal/popover.js +0 -15
- package/esm/_internal/popover.js.map +0 -1
- package/esm/_internal/post-block.js +0 -15
- package/esm/_internal/post-block.js.map +0 -1
- package/esm/_internal/progress-tracker.js +0 -17
- package/esm/_internal/progress-tracker.js.map +0 -1
- package/esm/_internal/progress.js +0 -10
- package/esm/_internal/progress.js.map +0 -1
- package/esm/_internal/radio-button.js +0 -13
- package/esm/_internal/radio-button.js.map +0 -1
- package/esm/_internal/renderLink.js +0 -25
- package/esm/_internal/renderLink.js.map +0 -1
- package/esm/_internal/select.js +0 -31
- package/esm/_internal/select.js.map +0 -1
- package/esm/_internal/side-navigation.js +0 -25
- package/esm/_internal/side-navigation.js.map +0 -1
- package/esm/_internal/skeleton.js +0 -10
- package/esm/_internal/skeleton.js.map +0 -1
- package/esm/_internal/slider.js +0 -13
- package/esm/_internal/slider.js.map +0 -1
- package/esm/_internal/slideshow.js +0 -29
- package/esm/_internal/slideshow.js.map +0 -1
- package/esm/_internal/state.js +0 -145
- package/esm/_internal/state.js.map +0 -1
- package/esm/_internal/switch.js +0 -13
- package/esm/_internal/switch.js.map +0 -1
- package/esm/_internal/table.js +0 -12
- package/esm/_internal/table.js.map +0 -1
- package/esm/_internal/tabs.js +0 -15
- package/esm/_internal/tabs.js.map +0 -1
- package/esm/_internal/text-field.js +0 -26
- package/esm/_internal/text-field.js.map +0 -1
- package/esm/_internal/text.js +0 -10
- package/esm/_internal/text.js.map +0 -1
- package/esm/_internal/thumbnail.js +0 -13
- package/esm/_internal/thumbnail.js.map +0 -1
- package/esm/_internal/toolbar.js +0 -9
- package/esm/_internal/toolbar.js.map +0 -1
- package/esm/_internal/tooltip.js +0 -18
- package/esm/_internal/tooltip.js.map +0 -1
- package/esm/_internal/type.js +0 -40
- package/esm/_internal/type.js.map +0 -1
- package/esm/_internal/types.js +0 -23
- package/esm/_internal/types.js.map +0 -1
- package/esm/_internal/uploader.js +0 -11
- package/esm/_internal/uploader.js.map +0 -1
- package/esm/_internal/useDelayedVisibility.js +0 -47
- package/esm/_internal/useDelayedVisibility.js.map +0 -1
- package/esm/_internal/useDisableBodyScroll.js +0 -220
- package/esm/_internal/useDisableBodyScroll.js.map +0 -1
- package/esm/_internal/useFocusTrap.js +0 -86
- package/esm/_internal/useFocusTrap.js.map +0 -1
- package/esm/_internal/useRovingTabIndex.js +0 -87
- package/esm/_internal/useRovingTabIndex.js.map +0 -1
- package/esm/_internal/user-block.js +0 -17
- package/esm/_internal/user-block.js.map +0 -1
- package/esm/index.js +0 -95
- package/esm/index.js.map +0 -1
- package/esm/index2.js +0 -16
- package/esm/index2.js.map +0 -1
- package/src/utils/index.tsx +0 -7
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import React, { useEffect, createContext, useContext, useMemo, useRef } from 'react';
|
|
2
|
+
import isEmpty from 'lodash/isEmpty';
|
|
3
|
+
|
|
1
4
|
function _typeof(obj) {
|
|
2
5
|
"@babel/helpers - typeof";
|
|
3
6
|
|
|
@@ -183,5 +186,107 @@ function _nonIterableRest() {
|
|
|
183
186
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
184
187
|
}
|
|
185
188
|
|
|
186
|
-
|
|
187
|
-
|
|
189
|
+
var EVENT_TYPES = ['mousedown', 'touchstart'];
|
|
190
|
+
|
|
191
|
+
function isClickAway(target, refs) {
|
|
192
|
+
// The target element is not contained in any of the listed element references.
|
|
193
|
+
return !refs.some(function (e) {
|
|
194
|
+
var _e$current;
|
|
195
|
+
|
|
196
|
+
return e === null || e === void 0 ? void 0 : (_e$current = e.current) === null || _e$current === void 0 ? void 0 : _e$current.contains(target);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Listen to clicks away from the given elements and callback the passed in function.
|
|
202
|
+
*
|
|
203
|
+
* Warning: If you need to detect click away on nested React portals, please use the `ClickAwayProvider` component.
|
|
204
|
+
*/
|
|
205
|
+
function useClickAway(_ref) {
|
|
206
|
+
var callback = _ref.callback,
|
|
207
|
+
childrenRefs = _ref.childrenRefs;
|
|
208
|
+
useEffect(function () {
|
|
209
|
+
var currentRefs = childrenRefs.current;
|
|
210
|
+
|
|
211
|
+
if (!callback || !currentRefs || isEmpty(currentRefs)) {
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
var listener = function listener(evt) {
|
|
216
|
+
if (isClickAway(evt.target, currentRefs)) {
|
|
217
|
+
callback(evt);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
EVENT_TYPES.forEach(function (evtType) {
|
|
222
|
+
return document.addEventListener(evtType, listener);
|
|
223
|
+
});
|
|
224
|
+
return function () {
|
|
225
|
+
EVENT_TYPES.forEach(function (evtType) {
|
|
226
|
+
return document.removeEventListener(evtType, listener);
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
}, [callback, childrenRefs]);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
var ClickAwayAncestorContext = createContext(null);
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Component combining the `useClickAway` hook with a React context to hook into the React component tree and make sure
|
|
236
|
+
* we take into account both the DOM tree and the React tree to detect click away.
|
|
237
|
+
*
|
|
238
|
+
* @return the react component.
|
|
239
|
+
*/
|
|
240
|
+
var ClickAwayProvider = function ClickAwayProvider(_ref) {
|
|
241
|
+
var children = _ref.children,
|
|
242
|
+
callback = _ref.callback,
|
|
243
|
+
childrenRefs = _ref.childrenRefs,
|
|
244
|
+
parentRef = _ref.parentRef;
|
|
245
|
+
var parentContext = useContext(ClickAwayAncestorContext);
|
|
246
|
+
var currentContext = useMemo(function () {
|
|
247
|
+
var context = {
|
|
248
|
+
childrenRefs: [],
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Add element refs to the current context and propagate to the parent context.
|
|
252
|
+
*/
|
|
253
|
+
addRefs: function addRefs() {
|
|
254
|
+
var _context$childrenRefs;
|
|
255
|
+
|
|
256
|
+
// Add element refs that should be considered as inside the click away context.
|
|
257
|
+
(_context$childrenRefs = context.childrenRefs).push.apply(_context$childrenRefs, arguments);
|
|
258
|
+
|
|
259
|
+
if (parentContext) {
|
|
260
|
+
// Also add then to the parent context
|
|
261
|
+
parentContext.addRefs.apply(parentContext, arguments);
|
|
262
|
+
|
|
263
|
+
if (parentRef) {
|
|
264
|
+
// The parent element is also considered as inside the parent click away context but not inside the current context
|
|
265
|
+
parentContext.addRefs(parentRef);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
return context;
|
|
271
|
+
}, [parentContext, parentRef]);
|
|
272
|
+
useEffect(function () {
|
|
273
|
+
var currentRefs = childrenRefs.current;
|
|
274
|
+
|
|
275
|
+
if (!currentRefs) {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
currentContext.addRefs.apply(currentContext, _toConsumableArray(currentRefs));
|
|
280
|
+
}, [currentContext, childrenRefs]);
|
|
281
|
+
useClickAway({
|
|
282
|
+
callback: callback,
|
|
283
|
+
childrenRefs: useRef(currentContext.childrenRefs)
|
|
284
|
+
});
|
|
285
|
+
return React.createElement(ClickAwayAncestorContext.Provider, {
|
|
286
|
+
value: currentContext
|
|
287
|
+
}, children);
|
|
288
|
+
};
|
|
289
|
+
ClickAwayProvider.displayName = 'ClickAwayProvider';
|
|
290
|
+
|
|
291
|
+
export { ClickAwayProvider as C, _objectSpread2 as _, _objectWithoutProperties as a, _slicedToArray as b, _defineProperty as c, _extends as d, _toConsumableArray as e, _toArray as f, _typeof as g };
|
|
292
|
+
//# sourceMappingURL=ClickAwayProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClickAwayProvider.js","sources":["../../src/hooks/useClickAway.tsx","../../src/utils/ClickAwayProvider/ClickAwayProvider.tsx"],"sourcesContent":["import { RefObject, useEffect } from 'react';\n\nimport { Falsy } from '@lumx/react/utils/type';\n\nimport isEmpty from 'lodash/isEmpty';\n\nconst EVENT_TYPES = ['mousedown', 'touchstart'];\n\nfunction isClickAway(target: HTMLElement, refs: Array<RefObject<HTMLElement>>): boolean {\n // The target element is not contained in any of the listed element references.\n return !refs.some((e) => e?.current?.contains(target));\n}\n\nexport interface ClickAwayParameters {\n /**\n * A callback function to call when the user clicks away from the elements.\n */\n callback: EventListener | Falsy;\n /**\n * Elements considered within the click away context (clicking outside them will trigger the click away callback).\n */\n childrenRefs: RefObject<Array<RefObject<HTMLElement>>>;\n}\n\n/**\n * Listen to clicks away from the given elements and callback the passed in function.\n *\n * Warning: If you need to detect click away on nested React portals, please use the `ClickAwayProvider` component.\n */\nexport function useClickAway({ callback, childrenRefs }: ClickAwayParameters): void {\n useEffect(() => {\n const { current: currentRefs } = childrenRefs;\n if (!callback || !currentRefs || isEmpty(currentRefs)) {\n return undefined;\n }\n const listener: EventListener = (evt) => {\n if (isClickAway(evt.target as HTMLElement, currentRefs)) {\n callback(evt);\n }\n };\n\n EVENT_TYPES.forEach((evtType) => document.addEventListener(evtType, listener));\n return () => {\n EVENT_TYPES.forEach((evtType) => document.removeEventListener(evtType, listener));\n };\n }, [callback, childrenRefs]);\n}\n","import React, { createContext, RefObject, useContext, useEffect, useMemo, useRef } from 'react';\nimport { ClickAwayParameters, useClickAway } from '@lumx/react/hooks/useClickAway';\n\ninterface ContextValue {\n childrenRefs: Array<RefObject<HTMLElement>>;\n addRefs(...newChildrenRefs: Array<RefObject<HTMLElement>>): void;\n}\n\nconst ClickAwayAncestorContext = createContext<ContextValue | null>(null);\n\ninterface ClickAwayProviderProps extends ClickAwayParameters {\n /**\n * (Optional) Element that should be considered as part of the parent\n */\n parentRef?: RefObject<HTMLElement>;\n}\n\n/**\n * Component combining the `useClickAway` hook with a React context to hook into the React component tree and make sure\n * we take into account both the DOM tree and the React tree to detect click away.\n *\n * @return the react component.\n */\nexport const ClickAwayProvider: React.FC<ClickAwayProviderProps> = ({\n children,\n callback,\n childrenRefs,\n parentRef,\n}) => {\n const parentContext = useContext(ClickAwayAncestorContext);\n const currentContext = useMemo(() => {\n const context: ContextValue = {\n childrenRefs: [],\n /**\n * Add element refs to the current context and propagate to the parent context.\n */\n addRefs(...newChildrenRefs) {\n // Add element refs that should be considered as inside the click away context.\n context.childrenRefs.push(...newChildrenRefs);\n\n if (parentContext) {\n // Also add then to the parent context\n parentContext.addRefs(...newChildrenRefs);\n if (parentRef) {\n // The parent element is also considered as inside the parent click away context but not inside the current context\n parentContext.addRefs(parentRef);\n }\n }\n },\n };\n return context;\n }, [parentContext, parentRef]);\n\n useEffect(() => {\n const { current: currentRefs } = childrenRefs;\n if (!currentRefs) {\n return;\n }\n currentContext.addRefs(...currentRefs);\n }, [currentContext, childrenRefs]);\n\n useClickAway({ callback, childrenRefs: useRef(currentContext.childrenRefs) });\n return <ClickAwayAncestorContext.Provider value={currentContext}>{children}</ClickAwayAncestorContext.Provider>;\n};\nClickAwayProvider.displayName = 'ClickAwayProvider';\n"],"names":["EVENT_TYPES","isClickAway","target","refs","some","e","current","contains","useClickAway","callback","childrenRefs","useEffect","currentRefs","isEmpty","undefined","listener","evt","forEach","evtType","document","addEventListener","removeEventListener","ClickAwayAncestorContext","createContext","ClickAwayProvider","children","parentRef","parentContext","useContext","currentContext","useMemo","context","addRefs","push","useRef","displayName"],"mappings":"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"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import React, { Ref, ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Get types of the values of a record. */
|
|
4
|
+
declare type ValueOf<T extends Record<any, any>> = T[keyof T];
|
|
5
|
+
/** LumX Component Type. */
|
|
6
|
+
declare type Comp<P, T = HTMLElement> = {
|
|
7
|
+
(props: P & {
|
|
8
|
+
ref?: Ref<T>;
|
|
9
|
+
}): ReactElement | null;
|
|
10
|
+
/** React component type. */
|
|
11
|
+
readonly $$typeof: symbol;
|
|
12
|
+
/** Component default props. */
|
|
13
|
+
defaultProps?: Partial<P>;
|
|
14
|
+
/** Component name. */
|
|
15
|
+
displayName?: string;
|
|
16
|
+
/** Component base class name. */
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
/** Union type of all heading elements */
|
|
20
|
+
declare type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
21
|
+
/** Union type of all text elements */
|
|
22
|
+
declare type TextElement = 'span' | 'p' | HeadingElement;
|
|
23
|
+
interface HasTheme {
|
|
24
|
+
/**
|
|
25
|
+
* Theme adapting the component to light or dark background.
|
|
26
|
+
*/
|
|
27
|
+
theme?: Theme;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Define a generic props types.
|
|
31
|
+
*/
|
|
32
|
+
interface GenericProps {
|
|
33
|
+
/**
|
|
34
|
+
* Class name forwarded to the root element of the component.
|
|
35
|
+
*/
|
|
36
|
+
className?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Any prop (particularly any supported prop for a HTML element).
|
|
39
|
+
*/
|
|
40
|
+
[propName: string]: any;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Callback function type alias (use for readability)
|
|
44
|
+
*/
|
|
45
|
+
declare type Callback = () => void;
|
|
46
|
+
/**
|
|
47
|
+
* JS falsy values.
|
|
48
|
+
* (excluding `NaN` as it can't be distinguished from `number`)
|
|
49
|
+
*/
|
|
50
|
+
declare type Falsy = false | undefined | null | 0 | '';
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Alignments.
|
|
54
|
+
*/
|
|
55
|
+
declare const Alignment: {
|
|
56
|
+
readonly bottom: "bottom";
|
|
57
|
+
readonly center: "center";
|
|
58
|
+
readonly end: "end";
|
|
59
|
+
readonly left: "left";
|
|
60
|
+
readonly right: "right";
|
|
61
|
+
readonly spaceAround: "space-around";
|
|
62
|
+
readonly spaceBetween: "space-between";
|
|
63
|
+
readonly spaceEvenly: "space-evenly";
|
|
64
|
+
readonly start: "start";
|
|
65
|
+
readonly top: "top";
|
|
66
|
+
};
|
|
67
|
+
declare type Alignment = ValueOf<typeof Alignment>;
|
|
68
|
+
declare type VerticalAlignment = Extract<Alignment, 'top' | 'center' | 'bottom'>;
|
|
69
|
+
declare type HorizontalAlignment = Extract<Alignment, 'right' | 'center' | 'left'>;
|
|
70
|
+
/**
|
|
71
|
+
* See SCSS variable $lumx-color-palette
|
|
72
|
+
*/
|
|
73
|
+
declare const ColorPalette: {
|
|
74
|
+
readonly primary: "primary";
|
|
75
|
+
readonly secondary: "secondary";
|
|
76
|
+
readonly blue: "blue";
|
|
77
|
+
readonly dark: "dark";
|
|
78
|
+
readonly green: "green";
|
|
79
|
+
readonly yellow: "yellow";
|
|
80
|
+
readonly red: "red";
|
|
81
|
+
readonly light: "light";
|
|
82
|
+
readonly grey: "grey";
|
|
83
|
+
};
|
|
84
|
+
declare type ColorPalette = ValueOf<typeof ColorPalette>;
|
|
85
|
+
declare type Color = ColorPalette | string;
|
|
86
|
+
/**
|
|
87
|
+
* See SCSS variable $lumx-color-variants
|
|
88
|
+
*/
|
|
89
|
+
declare const ColorVariant: {
|
|
90
|
+
readonly D1: "D1";
|
|
91
|
+
readonly D2: "D2";
|
|
92
|
+
readonly L1: "L1";
|
|
93
|
+
readonly L2: "L2";
|
|
94
|
+
readonly L3: "L3";
|
|
95
|
+
readonly L4: "L4";
|
|
96
|
+
readonly L5: "L5";
|
|
97
|
+
readonly L6: "L6";
|
|
98
|
+
readonly N: "N";
|
|
99
|
+
};
|
|
100
|
+
declare type ColorVariant = ValueOf<typeof ColorVariant>;
|
|
101
|
+
declare const Theme: {
|
|
102
|
+
readonly light: "light";
|
|
103
|
+
readonly dark: "dark";
|
|
104
|
+
};
|
|
105
|
+
declare type Theme = ValueOf<typeof Theme>;
|
|
106
|
+
declare const Size: {
|
|
107
|
+
readonly xxs: "xxs";
|
|
108
|
+
readonly xs: "xs";
|
|
109
|
+
readonly s: "s";
|
|
110
|
+
readonly m: "m";
|
|
111
|
+
readonly l: "l";
|
|
112
|
+
readonly xl: "xl";
|
|
113
|
+
readonly xxl: "xxl";
|
|
114
|
+
readonly tiny: "tiny";
|
|
115
|
+
readonly regular: "regular";
|
|
116
|
+
readonly medium: "medium";
|
|
117
|
+
readonly big: "big";
|
|
118
|
+
readonly huge: "huge";
|
|
119
|
+
};
|
|
120
|
+
declare type Size = ValueOf<typeof Size>;
|
|
121
|
+
declare type GlobalSize = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;
|
|
122
|
+
declare const Orientation: {
|
|
123
|
+
readonly horizontal: "horizontal";
|
|
124
|
+
readonly vertical: "vertical";
|
|
125
|
+
};
|
|
126
|
+
declare type Orientation = ValueOf<typeof Orientation>;
|
|
127
|
+
declare const Emphasis: {
|
|
128
|
+
readonly low: "low";
|
|
129
|
+
readonly medium: "medium";
|
|
130
|
+
readonly high: "high";
|
|
131
|
+
};
|
|
132
|
+
declare type Emphasis = ValueOf<typeof Emphasis>;
|
|
133
|
+
/**
|
|
134
|
+
* List of typographies that can't be customized.
|
|
135
|
+
*/
|
|
136
|
+
declare const TypographyInterface: {
|
|
137
|
+
readonly overline: "overline";
|
|
138
|
+
readonly caption: "caption";
|
|
139
|
+
readonly body1: "body1";
|
|
140
|
+
readonly body2: "body2";
|
|
141
|
+
readonly subtitle1: "subtitle1";
|
|
142
|
+
readonly subtitle2: "subtitle2";
|
|
143
|
+
readonly title: "title";
|
|
144
|
+
readonly headline: "headline";
|
|
145
|
+
readonly display1: "display1";
|
|
146
|
+
};
|
|
147
|
+
declare type TypographyInterface = ValueOf<typeof TypographyInterface>;
|
|
148
|
+
/**
|
|
149
|
+
* List of title typographies that can be customized (via CSS variables).
|
|
150
|
+
*/
|
|
151
|
+
declare const TypographyTitleCustom: {
|
|
152
|
+
readonly title1: "custom-title1";
|
|
153
|
+
readonly title2: "custom-title2";
|
|
154
|
+
readonly title3: "custom-title3";
|
|
155
|
+
readonly title4: "custom-title4";
|
|
156
|
+
readonly title5: "custom-title5";
|
|
157
|
+
readonly title6: "custom-title6";
|
|
158
|
+
};
|
|
159
|
+
declare type TypographyTitleCustom = ValueOf<typeof TypographyTitleCustom>;
|
|
160
|
+
/**
|
|
161
|
+
* List of typographies that can be customized (via CSS variables).
|
|
162
|
+
*/
|
|
163
|
+
declare const TypographyCustom: {
|
|
164
|
+
readonly intro: "custom-intro";
|
|
165
|
+
readonly 'body-large': "custom-body-large";
|
|
166
|
+
readonly body: "custom-body";
|
|
167
|
+
readonly quote: "custom-quote";
|
|
168
|
+
readonly 'publish-info': "custom-publish-info";
|
|
169
|
+
readonly button: "custom-button";
|
|
170
|
+
readonly title1: "custom-title1";
|
|
171
|
+
readonly title2: "custom-title2";
|
|
172
|
+
readonly title3: "custom-title3";
|
|
173
|
+
readonly title4: "custom-title4";
|
|
174
|
+
readonly title5: "custom-title5";
|
|
175
|
+
readonly title6: "custom-title6";
|
|
176
|
+
};
|
|
177
|
+
declare type TypographyCustom = ValueOf<typeof TypographyCustom>;
|
|
178
|
+
/**
|
|
179
|
+
* List of all typographies.
|
|
180
|
+
*/
|
|
181
|
+
declare const Typography: {
|
|
182
|
+
readonly custom: {
|
|
183
|
+
readonly intro: "custom-intro";
|
|
184
|
+
readonly 'body-large': "custom-body-large";
|
|
185
|
+
readonly body: "custom-body";
|
|
186
|
+
readonly quote: "custom-quote";
|
|
187
|
+
readonly 'publish-info': "custom-publish-info";
|
|
188
|
+
readonly button: "custom-button";
|
|
189
|
+
readonly title1: "custom-title1";
|
|
190
|
+
readonly title2: "custom-title2";
|
|
191
|
+
readonly title3: "custom-title3";
|
|
192
|
+
readonly title4: "custom-title4";
|
|
193
|
+
readonly title5: "custom-title5";
|
|
194
|
+
readonly title6: "custom-title6";
|
|
195
|
+
};
|
|
196
|
+
readonly overline: "overline";
|
|
197
|
+
readonly caption: "caption";
|
|
198
|
+
readonly body1: "body1";
|
|
199
|
+
readonly body2: "body2";
|
|
200
|
+
readonly subtitle1: "subtitle1";
|
|
201
|
+
readonly subtitle2: "subtitle2";
|
|
202
|
+
readonly title: "title";
|
|
203
|
+
readonly headline: "headline";
|
|
204
|
+
readonly display1: "display1";
|
|
205
|
+
};
|
|
206
|
+
declare type Typography = TypographyInterface | TypographyCustom;
|
|
207
|
+
/**
|
|
208
|
+
* All available aspect ratios.
|
|
209
|
+
*/
|
|
210
|
+
declare const AspectRatio: {
|
|
211
|
+
/** Intrinsic content ratio. */
|
|
212
|
+
readonly original: "original";
|
|
213
|
+
/** Ratio 16:9 */
|
|
214
|
+
readonly wide: "wide";
|
|
215
|
+
/** Ratio 3:2 */
|
|
216
|
+
readonly horizontal: "horizontal";
|
|
217
|
+
/** Ratio 3:2 */
|
|
218
|
+
readonly vertical: "vertical";
|
|
219
|
+
/** Ratio 1:1 */
|
|
220
|
+
readonly square: "square";
|
|
221
|
+
/** Ratio constrained by the parent. */
|
|
222
|
+
readonly free: "free";
|
|
223
|
+
};
|
|
224
|
+
declare type AspectRatio = ValueOf<typeof AspectRatio>;
|
|
225
|
+
/**
|
|
226
|
+
* Semantic info about the purpose of the component
|
|
227
|
+
*/
|
|
228
|
+
declare const Kind: {
|
|
229
|
+
readonly info: "info";
|
|
230
|
+
readonly success: "success";
|
|
231
|
+
readonly warning: "warning";
|
|
232
|
+
readonly error: "error";
|
|
233
|
+
};
|
|
234
|
+
declare type Kind = ValueOf<typeof Kind>;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Focal point using vertical alignment, horizontal alignment or coordinates (from -1 to 1).
|
|
238
|
+
*/
|
|
239
|
+
declare type FocusPoint = {
|
|
240
|
+
x?: number;
|
|
241
|
+
y?: number;
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* Loading attribute is not yet supported in typescript, so we need
|
|
245
|
+
* to add it in order to avoid a ts error.
|
|
246
|
+
* https://github.com/typescript-cheatsheets/react-typescript-cheatsheet/blob/master/ADVANCED.md#adding-non-standard-attributes
|
|
247
|
+
*/
|
|
248
|
+
declare module 'react' {
|
|
249
|
+
interface ImgHTMLAttributes<T> extends React.HTMLAttributes<T> {
|
|
250
|
+
loading?: 'eager' | 'lazy';
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* All available aspect ratios.
|
|
255
|
+
* @deprecated
|
|
256
|
+
*/
|
|
257
|
+
declare const ThumbnailAspectRatio: Record<string, AspectRatio>;
|
|
258
|
+
/**
|
|
259
|
+
* Thumbnail sizes.
|
|
260
|
+
*/
|
|
261
|
+
declare type ThumbnailSize = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;
|
|
262
|
+
/**
|
|
263
|
+
* Thumbnail variants.
|
|
264
|
+
*/
|
|
265
|
+
declare const ThumbnailVariant: {
|
|
266
|
+
readonly squared: "squared";
|
|
267
|
+
readonly rounded: "rounded";
|
|
268
|
+
};
|
|
269
|
+
declare type ThumbnailVariant = ValueOf<typeof ThumbnailVariant>;
|
|
270
|
+
|
|
271
|
+
export { Alignment as A, Comp as C, Emphasis as E, Falsy as F, GenericProps as G, HasTheme as H, Kind as K, Orientation as O, Size as S, Typography as T, ValueOf as V, HorizontalAlignment as a, Color as b, Callback as c, ColorPalette as d, VerticalAlignment as e, ColorVariant as f, TextElement as g, HeadingElement as h, AspectRatio as i, FocusPoint as j, ThumbnailSize as k, ThumbnailVariant as l, GlobalSize as m, TypographyInterface as n, Theme as o, TypographyTitleCustom as p, TypographyCustom as q, ThumbnailAspectRatio as r };
|