@procore/core-react 12.17.5 → 12.17.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babel.config.js +4 -1
- package/dist/AnchorNavigation/AnchorNavigation.js.map +1 -1
- package/dist/AnchorNavigation/AnchorNavigation.styles.js +3 -3
- package/dist/AnchorNavigation/AnchorNavigationProvider.js +5 -5
- package/dist/AnchorNavigation/AnchorNavigationProvider.js.map +1 -1
- package/dist/Avatar/Avatar.js +10 -11
- package/dist/Avatar/Avatar.js.map +1 -1
- package/dist/Avatar/Avatar.styles.js +5 -5
- package/dist/AvatarStack/AvatarStack.js +14 -14
- package/dist/AvatarStack/AvatarStack.js.map +1 -1
- package/dist/AvatarStack/AvatarStack.styles.js +7 -7
- package/dist/Badge/Badge.js +1 -1
- package/dist/Badge/Badge.styles.js +2 -2
- package/dist/Banner/Banner.js +44 -14
- package/dist/Banner/Banner.js.map +1 -1
- package/dist/Banner/Banner.styles.d.ts +1 -1
- package/dist/Banner/Banner.styles.js +15 -15
- package/dist/Banner/Banner.styles.js.map +1 -1
- package/dist/Box/Box.js +3 -3
- package/dist/Box/Box.styles.js +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +9 -9
- package/dist/Breadcrumbs/Breadcrumbs.styles.js +4 -4
- package/dist/Button/Button.js +7 -7
- package/dist/Button/Button.js.map +1 -1
- package/dist/Button/Button.styles.d.ts +1 -0
- package/dist/Button/Button.styles.js +7 -7
- package/dist/Button/Button.styles.js.map +1 -1
- package/dist/Button/Button.types.d.ts +4 -0
- package/dist/Button/Button.types.js.map +1 -1
- package/dist/Calendar/Calendar.js +4 -4
- package/dist/Calendar/Calendar.js.map +1 -1
- package/dist/Calendar/Calendar.styles.js +8 -8
- package/dist/Card/Card.js +3 -3
- package/dist/Card/Card.styles.js +1 -1
- package/dist/Checkbox/Checkbox.js +9 -9
- package/dist/Checkbox/Checkbox.styles.js +6 -6
- package/dist/Checkbox/CheckboxTooltip.js +2 -2
- package/dist/CheckboxGroup/CheckboxGroup.js +8 -8
- package/dist/ClickOutside/ClickOutside.js +3 -3
- package/dist/ContactItem/ContactItem.js +3 -3
- package/dist/ContactItem/ContactItem.styles.js +5 -5
- package/dist/Content/Content.styles.js +2 -2
- package/dist/DateInput/DateInput.js +11 -11
- package/dist/DateInput/DateInput.js.map +1 -1
- package/dist/DateInput/DateInput.styles.js +10 -10
- package/dist/DateSelect/DateSelect.js +8 -8
- package/dist/DateSelect/DateSelect.js.map +1 -1
- package/dist/DetailPage/DetailPage.js +3 -3
- package/dist/DetailPage/DetailPage.styles.js +7 -7
- package/dist/DetailPage/examples/TableExample.js +5 -5
- package/dist/DetailPageTemplate/DetailPageTemplate.js +3 -3
- package/dist/Dropdown/Dropdown.js +8 -8
- package/dist/Dropdown/Dropdown.styles.js +3 -3
- package/dist/DropdownFlyout/DropdownFlyout.helpers.js +14 -14
- package/dist/DropdownFlyout/DropdownFlyout.js +8 -8
- package/dist/DropdownFlyout/DropdownFlyout.js.map +1 -1
- package/dist/DropdownFlyout/DropdownFlyout.styles.js +4 -4
- package/dist/Dropzone/Dropzone.hooks.js +17 -18
- package/dist/Dropzone/Dropzone.hooks.js.map +1 -1
- package/dist/Dropzone/Dropzone.js +19 -21
- package/dist/Dropzone/Dropzone.js.map +1 -1
- package/dist/Dropzone/Dropzone.styles.js +9 -9
- package/dist/EmptyState/EmptyState.js +3 -3
- package/dist/EmptyState/EmptyState.styles.js +6 -6
- package/dist/Field/Field.js +3 -3
- package/dist/Field/Field.styles.js +3 -3
- package/dist/FileList/FileList.js +3 -3
- package/dist/FileList/FileList.styles.js +4 -4
- package/dist/FileSelect/FileExplorer/FileExplorer.js +3 -3
- package/dist/FileSelect/FileExplorer/FileExplorer.js.map +1 -1
- package/dist/FileSelect/FileExplorer/FileExplorer.styles.js +9 -9
- package/dist/FileSelect/FileExplorer/FileExplorerModal.js +3 -3
- package/dist/FileSelect/FileExplorer/FileExplorerSidebar.js +5 -5
- package/dist/FileSelect/FileExplorer/FileExplorerSidebar.js.map +1 -1
- package/dist/FileSelect/FileExplorer/FileExplorerSidebar.styles.js +3 -3
- package/dist/FileSelect/FileExplorer/useSidebarNavigation.js +8 -8
- package/dist/FileSelect/FileSelect.js +21 -21
- package/dist/FileSelect/FileSelect.js.map +1 -1
- package/dist/FileSelect/FileSelect.styles.js +2 -2
- package/dist/FileSelect/FileSelectDropzone/FileSelectDropzone.js +5 -5
- package/dist/FileSelect/FileSelectDropzone/FileSelectDropzone.js.map +1 -1
- package/dist/FileSelect/FileSelectDropzone/FileSelectDropzone.styles.js +3 -3
- package/dist/FileSelect/FileTokenList/FileTokenList.js +8 -8
- package/dist/FileSelect/FileTokenList/FileTokenList.js.map +1 -1
- package/dist/FileSelect/FileTokenList/FileTokenList.styles.js +2 -2
- package/dist/FileSelect/GridSource/GridSource.js +20 -20
- package/dist/FileSelect/GridSource/GridSource.js.map +1 -1
- package/dist/FileSelect/GridSource/GridSource.styles.js +6 -6
- package/dist/FileSelect/LocalSource/LocalSource.js +19 -19
- package/dist/FileSelect/LocalSource/LocalSource.js.map +1 -1
- package/dist/FileSelect/LocalSource/LocalSource.styles.js +4 -4
- package/dist/FileSelect/ProgressAnnouncer/ProgressAnnouncer.js +11 -11
- package/dist/FileSelect/SourceItem/SourceItem.js +3 -3
- package/dist/FileSelect/SourceItem/SourceItem.styles.js +3 -3
- package/dist/FileSelect/ThumbnailList/ThumbnailList.js +8 -8
- package/dist/FileSelect/ThumbnailList/ThumbnailList.js.map +1 -1
- package/dist/FileSelect/ThumbnailList/ThumbnailList.styles.js +6 -6
- package/dist/FileSelect/TreeSource/TreeSource.js +21 -21
- package/dist/FileSelect/TreeSource/TreeSource.js.map +1 -1
- package/dist/FileSelect/TreeSource/TreeSource.styles.js +1 -1
- package/dist/FileSelect/storyHelpers.js +4 -4
- package/dist/FileSelect/storyHelpers.js.map +1 -1
- package/dist/FileToken/FileToken.js +8 -8
- package/dist/FileToken/FileToken.styles.js +4 -4
- package/dist/FilterToken/FilterToken.js +25 -35
- package/dist/FilterToken/FilterToken.js.map +1 -1
- package/dist/FilterToken/FilterToken.styles.d.ts +5 -0
- package/dist/FilterToken/FilterToken.styles.js +18 -2
- package/dist/FilterToken/FilterToken.styles.js.map +1 -1
- package/dist/Flex/Flex.js +3 -3
- package/dist/FlexList/FlexList.js +3 -3
- package/dist/FlexList/FlexList.styles.js +1 -1
- package/dist/Form/Form.js +22 -18
- package/dist/Form/Form.js.map +1 -1
- package/dist/Form/Form.styles.js +14 -14
- package/dist/Form/FormFieldTooltip.js +1 -1
- package/dist/Form/StyledFormikForm.styles.js +2 -2
- package/dist/Form/stories/util.js +9 -9
- package/dist/Form/stories/util.js.map +1 -1
- package/dist/GhostPlaceholder/GhostPlaceholder.js +3 -3
- package/dist/GhostPlaceholder/GhostPlaceholder.styles.js +2 -2
- package/dist/Grid/Grid.js +3 -3
- package/dist/Grid/Grid.styles.js +3 -3
- package/dist/Grid/Grid.utils.js +5 -5
- package/dist/GroupSelect/GroupSelect.js +17 -17
- package/dist/GroupSelect/GroupSelect.styles.js +1 -1
- package/dist/Input/Input.js +3 -3
- package/dist/Input/Input.styles.js +1 -1
- package/dist/Link/Link.js +3 -3
- package/dist/Link/Link.styles.js +1 -1
- package/dist/ListPage/ListPage.js +3 -3
- package/dist/ListPage/ListPage.styles.js +8 -8
- package/dist/Loader/Loader.js +3 -3
- package/dist/Loader/Loader.styles.js +2 -2
- package/dist/Menu/Menu.js +15 -15
- package/dist/Menu/Menu.js.map +1 -1
- package/dist/MenuImperative/MenuImperative.js +15 -15
- package/dist/MenuImperative/MenuImperative.js.map +1 -1
- package/dist/MenuImperative/MenuImperative.styles.js +10 -10
- package/dist/MenuImperative/sensors.js +8 -8
- package/dist/MenuImperative/sensors.js.map +1 -1
- package/dist/Modal/ChildRegistry.context.js +11 -11
- package/dist/Modal/Modal.js +8 -8
- package/dist/Modal/Modal.js.map +1 -1
- package/dist/Modal/Modal.styles.js +13 -13
- package/dist/Modal/Modal.types.d.ts +3 -1
- package/dist/Modal/Modal.types.js.map +1 -1
- package/dist/Modal/storyHelpers.js +7 -7
- package/dist/MultiSelect/MultiSelect.js +17 -17
- package/dist/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/MultiSelect/MultiSelect.styles.js +6 -6
- package/dist/NextMenu/NextMenu.js +14 -14
- package/dist/NextMenu/NextMenu.js.map +1 -1
- package/dist/NextMenu/NextMenu.styles.js +3 -3
- package/dist/NextMenu/NextMenuItem.js +3 -3
- package/dist/NextMenu/sampleData.js +7 -6
- package/dist/NextMenu/sampleData.js.map +1 -1
- package/dist/NextTile/NextTile.js +9 -9
- package/dist/Notation/Notation.js +4 -4
- package/dist/NumberInput/NumberInput.hooks.js +5 -5
- package/dist/NumberInput/NumberInput.js +14 -14
- package/dist/NumberInput/NumberInput.js.map +1 -1
- package/dist/NumberInput/NumberInput.styles.js +7 -7
- package/dist/NumberInput/NumberInput.utils.js +11 -11
- package/dist/Overlay/Overlay.js.map +1 -1
- package/dist/Overlay/OverlayArrow.js +4 -4
- package/dist/Overlay/OverlayArrow.styles.js +1 -1
- package/dist/OverlayTrigger/OverlayTrigger.js +15 -15
- package/dist/OverlayTrigger/OverlayTrigger.js.map +1 -1
- package/dist/OverlayTrigger/a11yPresets.js +6 -6
- package/dist/OverlayTrigger/a11yPresets.js.map +1 -1
- package/dist/PageFooterTemplate/PageFooterTemplate.js +3 -3
- package/dist/PageFooterTemplate/PageFooterTemplate.styles.js +1 -1
- package/dist/PageHeaderTemplate/PageHeaderTemplate.js +3 -3
- package/dist/PageHeaderTemplate/PageHeaderTemplate.styles.js +3 -3
- package/dist/PageHeaderTemplate/PageHeaderTemplate.utils.js +5 -5
- package/dist/PageLayout/PageLayout.js +15 -15
- package/dist/PageLayout/PageLayout.js.map +1 -1
- package/dist/PageLayout/PageLayout.styles.js +16 -16
- package/dist/PagePaneTemplate/PagePaneTemplate.styles.js +2 -2
- package/dist/PageTemplate/PageTemplate.js +3 -3
- package/dist/PageTemplate/PageTemplate.styles.js +3 -3
- package/dist/PageTemplate/PageTemplateCard.js +3 -3
- package/dist/Pagination/Pagination.js +3 -3
- package/dist/Pagination/Pagination.js.map +1 -1
- package/dist/Pagination/Pagination.styles.js +5 -5
- package/dist/Pagination/PaginationSelect.js +3 -3
- package/dist/Panel/Panel.js +8 -8
- package/dist/Panel/Panel.js.map +1 -1
- package/dist/Panel/Panel.styles.js +11 -11
- package/dist/Pill/Pill.js +3 -3
- package/dist/Pill/Pill.styles.js +2 -2
- package/dist/PillSelect/PillSelect.js +8 -8
- package/dist/PillSelect/PillSelect.styles.js +4 -4
- package/dist/Popover/Popover.js +9 -9
- package/dist/Popover/Popover.styles.js +2 -2
- package/dist/Portal/Portal.js +3 -3
- package/dist/Portal/Portal.styles.js +1 -1
- package/dist/ProgressBar/ProgressBar.d.ts +2 -0
- package/dist/ProgressBar/ProgressBar.js +10 -8
- package/dist/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/ProgressBar/ProgressBar.styles.js +2 -2
- package/dist/ProgressBar/ProgressBar.types.js.map +1 -1
- package/dist/RadioButton/RadioButton.js +3 -3
- package/dist/RadioButton/RadioButton.styles.js +3 -3
- package/dist/Required/Required.js +3 -3
- package/dist/Required/Required.styles.js +3 -3
- package/dist/Search/Search.hooks.js +5 -5
- package/dist/Search/Search.js +3 -3
- package/dist/Search/Search.js.map +1 -1
- package/dist/Search/Search.styles.js +5 -5
- package/dist/Section/Section.js +15 -16
- package/dist/Section/Section.js.map +1 -1
- package/dist/Section/Section.styles.js +7 -7
- package/dist/Section/Section.styles.js.map +1 -1
- package/dist/SegmentedController/SegmentedController.js +14 -14
- package/dist/SegmentedController/SegmentedController.js.map +1 -1
- package/dist/SegmentedController/SegmentedController.styles.js +4 -4
- package/dist/Select/Select.js +8 -8
- package/dist/Select/Select.js.map +1 -1
- package/dist/Select/Select.styles.js +7 -7
- package/dist/Semantic/Semantic.js +3 -3
- package/dist/Semantic/Semantic.styles.js +9 -9
- package/dist/SettingsPage/SettingsPage.js +3 -3
- package/dist/SettingsPageTemplate/SettingsPageTemplate.js +3 -3
- package/dist/Slider/Slider.js +8 -8
- package/dist/Slider/Slider.js.map +1 -1
- package/dist/Slider/Slider.styles.js +5 -5
- package/dist/Spinner/Spinner.js +3 -3
- package/dist/Spinner/Spinner.styles.js +7 -7
- package/dist/SplitViewCard/SplitViewCard.context.js +5 -5
- package/dist/SplitViewCard/SplitViewCard.context.js.map +1 -1
- package/dist/SplitViewCard/SplitViewCard.js +8 -8
- package/dist/SplitViewCard/SplitViewCard.styles.js +8 -8
- package/dist/SuperSelect/SuperSelect.components.js +8 -8
- package/dist/SuperSelect/SuperSelect.components.js.map +1 -1
- package/dist/SuperSelect/SuperSelect.js +7 -7
- package/dist/SuperSelect/SuperSelect.js.map +1 -1
- package/dist/SuperSelect/SuperSelect.presets.styles.js +1 -1
- package/dist/SuperSelect/SuperSelect.styles.js +37 -37
- package/dist/SuperSelect/SuperSelect.utils.js +15 -16
- package/dist/SuperSelect/SuperSelect.utils.js.map +1 -1
- package/dist/SuperSelect/presets/contactsPreset.js +3 -3
- package/dist/SuperSelect/presets/contactsPreset.js.map +1 -1
- package/dist/SuperSelect/presets/filterPreset.js +1 -1
- package/dist/SuperSelect/presets/filterPreset.js.map +1 -1
- package/dist/SuperSelect/presets/pillPreset.js.map +1 -1
- package/dist/SuperSelect/useSuperSelect.js +14 -14
- package/dist/SuperSelect/useSuperSelect.js.map +1 -1
- package/dist/Switch/Switch.js +3 -3
- package/dist/Switch/Switch.styles.js +4 -4
- package/dist/Table/Table.js +9 -9
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/Table.styles.js +28 -28
- package/dist/TableShelf/TableShelf.js +3 -3
- package/dist/TableShelf/TableShelf.styles.js +5 -5
- package/dist/Tabs/Tabs.js +17 -17
- package/dist/Tabs/Tabs.js.map +1 -1
- package/dist/Tabs/Tabs.styles.js +15 -15
- package/dist/Tearsheet/Tearsheet.js +11 -11
- package/dist/Tearsheet/Tearsheet.js.map +1 -1
- package/dist/Tearsheet/Tearsheet.styles.js +5 -5
- package/dist/TextArea/TextArea.js +3 -3
- package/dist/TextArea/TextArea.styles.js +1 -1
- package/dist/TextEditor/TextEditor.js +17 -17
- package/dist/TextEditorOutput/TextEditorOutput.js +9 -9
- package/dist/TextEditorOutput/TextEditorOutput.styles.js +1 -1
- package/dist/Thumbnail/Thumbnail.hooks.d.ts +8 -0
- package/dist/Thumbnail/Thumbnail.hooks.js +8 -8
- package/dist/Thumbnail/Thumbnail.js +9 -9
- package/dist/Thumbnail/Thumbnail.js.map +1 -1
- package/dist/Thumbnail/Thumbnail.styles.js +17 -17
- package/dist/Thumbnail/Thumbnail.utils.js +11 -12
- package/dist/Thumbnail/Thumbnail.utils.js.map +1 -1
- package/dist/Thumbnail/ThumbnailCaption.js +3 -3
- package/dist/Thumbnail/ThumbnailDocumentIcon.js +7 -8
- package/dist/Thumbnail/ThumbnailDocumentIcon.js.map +1 -1
- package/dist/Thumbnail/ThumbnailPreview.js +5 -5
- package/dist/ThumbnailGrid/ThumbnailGrid.hooks.js +5 -5
- package/dist/ThumbnailGrid/ThumbnailGrid.js +17 -17
- package/dist/ThumbnailGrid/ThumbnailGrid.js.map +1 -1
- package/dist/ThumbnailGrid/ThumbnailGrid.styles.js +7 -7
- package/dist/TieredDropdown/TieredDropdown.js +14 -14
- package/dist/TieredDropdown/TieredDropdown.js.map +1 -1
- package/dist/TieredDropdown/useSearch.js +5 -5
- package/dist/TieredSelect/LeafSelectionTieredSelect.js +8 -8
- package/dist/TieredSelect/LeafSelectionTieredSelect.js.map +1 -1
- package/dist/TieredSelect/TierSelectionTieredSelect.js +17 -17
- package/dist/TieredSelect/TierSelectionTieredSelect.js.map +1 -1
- package/dist/TieredSelect/TieredSelect.js +8 -8
- package/dist/TieredSelect/TieredSelect.styles.js +9 -9
- package/dist/TieredSelect/TieredSelectMenu.js +17 -17
- package/dist/TieredSelect/TieredSelectMenu.js.map +1 -1
- package/dist/Tile/Tile.js +3 -3
- package/dist/Tile/Tile.js.map +1 -1
- package/dist/Tile/Tile.styles.js +8 -8
- package/dist/Title/Title.js +3 -3
- package/dist/Title/Title.styles.js +7 -7
- package/dist/Toast/Toast.js +4 -4
- package/dist/Toast/Toast.styles.js +3 -3
- package/dist/ToggleButton/ToggleButton.js +3 -3
- package/dist/ToggleButton/ToggleButton.styles.js +1 -1
- package/dist/Token/Token.js +4 -4
- package/dist/Token/Token.styles.js +3 -3
- package/dist/ToolHeader/ActionIcon.js +3 -3
- package/dist/ToolHeader/ActionIcon.types.example.js.map +1 -1
- package/dist/ToolHeader/ToolHeader.js +9 -9
- package/dist/ToolHeader/ToolHeader.styles.js +6 -6
- package/dist/ToolLandingPage/ToolLandingPage.js +3 -3
- package/dist/ToolLandingPage/ToolLandingPage.styles.js +3 -3
- package/dist/ToolLandingPageTemplate/ToolLandingPageTemplate.js +3 -3
- package/dist/Tooltip/Tooltip.js +8 -8
- package/dist/Tooltip/Tooltip.styles.js +2 -2
- package/dist/Tree/Tree.hooks.js +14 -14
- package/dist/Tree/Tree.hooks.js.map +1 -1
- package/dist/Tree/Tree.js +14 -14
- package/dist/Tree/Tree.js.map +1 -1
- package/dist/Tree/Tree.styles.js +9 -9
- package/dist/Tree/Tree.styles.js.map +1 -1
- package/dist/Typeahead/Typeahead.js +9 -9
- package/dist/Typeahead/Typeahead.styles.js +3 -3
- package/dist/Typography/Typography.js +3 -3
- package/dist/Typography/Typography.styles.js +1 -1
- package/dist/Typography/Typography.table.story.js +2 -2
- package/dist/_hooks/Anchor.js +19 -16
- package/dist/_hooks/Anchor.js.map +1 -1
- package/dist/_hooks/Buffer.js +8 -7
- package/dist/_hooks/Buffer.js.map +1 -1
- package/dist/_hooks/ClickOutside.js +2 -1
- package/dist/_hooks/ClickOutside.js.map +1 -1
- package/dist/_hooks/DateTime/DateTime.js +17 -17
- package/dist/_hooks/DelayedCallback.js +1 -1
- package/dist/_hooks/DelayedToggle.js +7 -2
- package/dist/_hooks/DelayedToggle.js.map +1 -1
- package/dist/_hooks/Deprecation.js +1 -0
- package/dist/_hooks/Deprecation.js.map +1 -1
- package/dist/_hooks/EventListener.js +5 -5
- package/dist/_hooks/FocusScopeOverride.js +6 -6
- package/dist/_hooks/FocusScopeOverride.js.map +1 -1
- package/dist/_hooks/Hotkey.js +2 -2
- package/dist/_hooks/Hotkey.js.map +1 -1
- package/dist/_hooks/I18n.js +13 -13
- package/dist/_hooks/InjectedScript.js +8 -7
- package/dist/_hooks/InjectedScript.js.map +1 -1
- package/dist/_hooks/IntersectionObserver/useIntersectionObserver.js +5 -5
- package/dist/_hooks/ListNavigation.js +9 -7
- package/dist/_hooks/ListNavigation.js.map +1 -1
- package/dist/_hooks/OverflowObserver/OverflowObserver.js +6 -6
- package/dist/_hooks/ResizeObserver.js +5 -5
- package/dist/_hooks/TextEntry.js +5 -2
- package/dist/_hooks/TextEntry.js.map +1 -1
- package/dist/_hooks/Timer.js +1 -0
- package/dist/_hooks/Timer.js.map +1 -1
- package/dist/_hooks/Trigger.js +19 -13
- package/dist/_hooks/Trigger.js.map +1 -1
- package/dist/_hooks/Visibility.js +9 -7
- package/dist/_hooks/Visibility.js.map +1 -1
- package/dist/_hooks/ZIndex.js +7 -7
- package/dist/_hooks/getI18nProviderLocale.js +2 -1
- package/dist/_hooks/getI18nProviderLocale.js.map +1 -1
- package/dist/_hooks/useCurrentMedia.js +5 -5
- package/dist/_hooks/useFileUploader.js +15 -15
- package/dist/_hooks/useFileUploader.js.map +1 -1
- package/dist/_hooks/useFocusWithin.js +5 -5
- package/dist/_hooks/useMediaLessThan.js +5 -5
- package/dist/_hooks/useSet.js +5 -5
- package/dist/_styles/colors.js +6 -6
- package/dist/_styles/spacing.d.ts +27 -0
- package/dist/_styles/spacing.js +27 -0
- package/dist/_styles/spacing.js.map +1 -1
- package/dist/_typedoc/Avatar/Avatar.types.json +20 -20
- package/dist/_typedoc/AvatarStack/AvatarStack.types.json +24 -24
- package/dist/_typedoc/Badge/Badge.types.json +6 -6
- package/dist/_typedoc/Banner/Banner.types.json +13 -13
- package/dist/_typedoc/Box/Box.types.json +68 -68
- package/dist/_typedoc/Breadcrumbs/Breadcrumbs.types.json +10 -10
- package/dist/_typedoc/Button/Button.types.json +24 -16
- package/dist/_typedoc/Calendar/Calendar.types.json +80 -80
- package/dist/_typedoc/Card/Card.types.json +6 -6
- package/dist/_typedoc/Checkbox/Checkbox.types.json +9 -9
- package/dist/_typedoc/ContactItem/ContactItem.types.json +9 -9
- package/dist/_typedoc/DateInput/DateInput.types.json +35 -35
- package/dist/_typedoc/DateSelect/DateSelect.types.json +13 -13
- package/dist/_typedoc/DetailPage/DetailPage.types.json +5 -5
- package/dist/_typedoc/Dropdown/Dropdown.types.json +43 -39
- package/dist/_typedoc/DropdownFlyout/DropdownFlyout.types.json +29 -29
- package/dist/_typedoc/Dropzone/Dropzone.types.json +41 -41
- package/dist/_typedoc/EmptyState/EmptyState.types.json +14 -14
- package/dist/_typedoc/FileList/FileList.types.json +9 -9
- package/dist/_typedoc/FileSelect/FileSelect.types.json +26 -26
- package/dist/_typedoc/FileSelect/GridSource/GridSource.types.json +20 -20
- package/dist/_typedoc/FileSelect/LocalSource/LocalSource.types.json +14 -14
- package/dist/_typedoc/FileSelect/TreeSource/TreeSource.types.json +9 -9
- package/dist/_typedoc/Flex/Flex.types.json +27 -27
- package/dist/_typedoc/FlexList/FlexList.types.json +30 -30
- package/dist/_typedoc/Form/Form.types.json +745 -745
- package/dist/_typedoc/GhostPlaceholder/GhostPlaceholder.types.json +12 -12
- package/dist/_typedoc/Grid/Grid.types.json +8 -8
- package/dist/_typedoc/GroupSelect/GroupSelect.types.json +52 -52
- package/dist/_typedoc/Input/Input.types.json +2 -2
- package/dist/_typedoc/Link/Link.types.json +4 -4
- package/dist/_typedoc/ListPage/ListPage.types.json +13 -13
- package/dist/_typedoc/Menu/Menu.types.json +62 -62
- package/dist/_typedoc/MenuImperative/MenuImperative.types.json +74 -74
- package/dist/_typedoc/Modal/Modal.types.json +50 -50
- package/dist/_typedoc/MultiSelect/MultiSelect.types.json +31 -31
- package/dist/_typedoc/Notation/Notation.types.json +4 -4
- package/dist/_typedoc/NumberInput/NumberInput.types.json +37 -37
- package/dist/_typedoc/OverlayTrigger/OverlayTrigger.types.json +31 -31
- package/dist/_typedoc/PageLayout/PageLayout.types.json +29 -29
- package/dist/_typedoc/Pagination/Pagination.types.json +7 -7
- package/dist/_typedoc/Panel/Panel.types.json +34 -30
- package/dist/_typedoc/Pill/Pill.types.json +2 -2
- package/dist/_typedoc/PillSelect/PillSelect.types.json +49 -49
- package/dist/_typedoc/Popover/Popover.types.json +15 -15
- package/dist/_typedoc/ProgressBar/ProgressBar.types.json +6 -6
- package/dist/_typedoc/RadioButton/RadioButton.types.json +6 -6
- package/dist/_typedoc/Required/Required.types.json +5 -5
- package/dist/_typedoc/Search/Search.types.json +19 -19
- package/dist/_typedoc/Section/Section.types.json +15 -15
- package/dist/_typedoc/SegmentedController/SegmentedController.types.json +21 -21
- package/dist/_typedoc/Select/Select.types.json +60 -60
- package/dist/_typedoc/SettingsPage/SettingsPage.types.json +10 -10
- package/dist/_typedoc/Slider/Slider.types.json +6 -6
- package/dist/_typedoc/Spinner/Spinner.types.json +9 -9
- package/dist/_typedoc/SplitViewCard/SplitViewCard.types.json +12 -12
- package/dist/_typedoc/Switch/Switch.types.json +3 -3
- package/dist/_typedoc/Table/Table.types.json +101 -101
- package/dist/_typedoc/Tabs/Tabs.types.json +20 -20
- package/dist/_typedoc/Tearsheet/Tearsheet.types.json +17 -17
- package/dist/_typedoc/TextArea/TextArea.types.json +3 -3
- package/dist/_typedoc/TextEditor/TextEditor.types.json +11 -11
- package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +6 -6
- package/dist/_typedoc/Thumbnail/Thumbnail.types.json +19 -19
- package/dist/_typedoc/TieredDropdown/TieredDropdown.types.json +48 -44
- package/dist/_typedoc/TieredSelect/TieredSelect.types.json +28 -28
- package/dist/_typedoc/Tile/Tile.types.json +30 -30
- package/dist/_typedoc/Title/Title.types.json +1 -1
- package/dist/_typedoc/Toast/Toast.types.json +4 -4
- package/dist/_typedoc/ToggleButton/ToggleButton.types.json +4 -4
- package/dist/_typedoc/Token/Token.types.json +4 -4
- package/dist/_typedoc/ToolHeader/ToolHeader.types.json +10 -10
- package/dist/_typedoc/ToolLandingPage/ToolLandingPage.types.json +7 -7
- package/dist/_typedoc/Tooltip/Tooltip.types.json +13 -13
- package/dist/_typedoc/Tree/Tree.types.json +86 -86
- package/dist/_typedoc/Typeahead/Typeahead.types.json +2 -2
- package/dist/_typedoc/Typography/Typography.types.json +9 -9
- package/dist/_typedoc/_utils/types.json +3 -3
- package/dist/_typedoc/deprecations.json +1 -1
- package/dist/_utils/TinyMCE.js +4 -4
- package/dist/_utils/TinyMCE.js.map +1 -1
- package/dist/_utils/closeWithConfirm.js +5 -5
- package/dist/_utils/closeWithConfirm.js.map +1 -1
- package/dist/_utils/dateTime.js +6 -6
- package/dist/_utils/dateTime.js.map +1 -1
- package/dist/_utils/getAnchorPosition.js +11 -11
- package/dist/_utils/getAnchorPosition.js.map +1 -1
- package/dist/_utils/partition.js +5 -5
- package/dist/_utils/runInQueue.js +4 -4
- package/dist/_utils/runInQueue.js.map +1 -1
- package/dist/_utils/slotify.js +7 -7
- package/dist/_utils/triggerListeners.js +6 -6
- package/package.json +5 -4
- package/tsconfig.prod.json +2 -1
- package/tsconfig.test.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var _excluded = ["restoreFocus"],
|
|
2
2
|
_excluded2 = ["children", "className", "arrow", "loading", "open", "focus", "variant"],
|
|
3
3
|
_excluded3 = ["afterHide", "afterShow", "beforeHide", "beforeShow", "children", "error", "footer", "i18nScope", "icon", "label", "onKeyDown", "onSearch", "onSelect", "placement", "restoreFocusOnHide", "variant", "hasTabbableElements"];
|
|
4
|
-
function _slicedToArray(
|
|
4
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
5
5
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
function _unsupportedIterableToArray(
|
|
7
|
-
function _arrayLikeToArray(
|
|
8
|
-
function _iterableToArrayLimit(
|
|
9
|
-
function _arrayWithHoles(
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
11
|
-
function _objectWithoutProperties(
|
|
12
|
-
function _objectWithoutPropertiesLoose(
|
|
6
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
7
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
8
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
9
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
12
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
13
13
|
import { CaretDown, CaretUp, EllipsisVertical } from '@procore/core-icons/dist';
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
import React from 'react';
|
|
@@ -5,15 +5,15 @@ import { Card } from '../Card/Card';
|
|
|
5
5
|
import { Spinner } from '../Spinner/Spinner';
|
|
6
6
|
export var StyledDropdownMenu = /*#__PURE__*/styled(Card).withConfig({
|
|
7
7
|
displayName: "StyledDropdownMenu",
|
|
8
|
-
componentId: "core-
|
|
8
|
+
componentId: "core-12_17_7__sc-ufsy2q-0"
|
|
9
9
|
})(["display:flex;max-height:40vh;max-width:248px;min-width:inherit;"]);
|
|
10
10
|
export var StyledDropdownSpinner = /*#__PURE__*/styled(Spinner).withConfig({
|
|
11
11
|
displayName: "StyledDropdownSpinner",
|
|
12
|
-
componentId: "core-
|
|
12
|
+
componentId: "core-12_17_7__sc-ufsy2q-1"
|
|
13
13
|
})(["margin:0 6px;"]);
|
|
14
14
|
export var StyledDropdownButton = /*#__PURE__*/styled(Button).withConfig({
|
|
15
15
|
displayName: "StyledDropdownButton",
|
|
16
|
-
componentId: "core-
|
|
16
|
+
componentId: "core-12_17_7__sc-ufsy2q-2"
|
|
17
17
|
})(["pointer-events:", ";", ""], function (_ref) {
|
|
18
18
|
var disabled = _ref.disabled,
|
|
19
19
|
$loading = _ref.$loading;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function _slicedToArray(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
3
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
function _iterableToArrayLimit(
|
|
5
|
-
function _arrayWithHoles(
|
|
6
|
-
function _toConsumableArray(
|
|
4
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
5
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
6
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
7
7
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
-
function _unsupportedIterableToArray(
|
|
9
|
-
function _iterableToArray(
|
|
10
|
-
function _arrayWithoutHoles(
|
|
11
|
-
function _arrayLikeToArray(
|
|
12
|
-
function ownKeys(
|
|
13
|
-
function _objectSpread(
|
|
14
|
-
function _defineProperty(
|
|
15
|
-
function _toPropertyKey(
|
|
16
|
-
function _toPrimitive(
|
|
8
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
10
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
11
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import { ulid } from 'ulid';
|
|
19
19
|
import { StyledDropdownFlyoutExpandIcon, StyledDropdownFlyoutLabel } from './DropdownFlyout.styles';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var _excluded = ["option", "highlighted", "optionRenderer"],
|
|
2
2
|
_excluded2 = ["children", "icon"],
|
|
3
3
|
_excluded3 = ["disabled", "icon", "label", "loading", "options", "onClick", "optionRenderer", "children", "placement", "onKeyDown", "onFocus", "onBlur", "onMouseDown", "onMouseEnter", "onMouseLeave", "size", "variant"];
|
|
4
|
-
function _slicedToArray(
|
|
4
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
5
5
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
function _unsupportedIterableToArray(
|
|
7
|
-
function _arrayLikeToArray(
|
|
8
|
-
function _iterableToArrayLimit(
|
|
9
|
-
function _arrayWithHoles(
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
11
|
-
function _objectWithoutProperties(
|
|
12
|
-
function _objectWithoutPropertiesLoose(
|
|
6
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
7
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
8
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
9
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
12
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
13
13
|
import { EllipsisVertical } from '@procore/core-icons/dist';
|
|
14
14
|
import React, { useCallback } from 'react';
|
|
15
15
|
import { Card } from '../Card/Card';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownFlyout.js","names":["EllipsisVertical","React","useCallback","Card","DropdownButton","Portal","useClickOutside","useI18nContext","mergeRefs","defaultOptionRenderer","DropdownFlyoutContext","noop","transformOption","useDropdownFlyout","useDropdownFlyoutContext","StyledDropdownFlyout","StyledDropdownFlyoutItem","rootId","useDropdownFlyoutOverlay","FlyoutCaption","forwardRef","_ref","ref","option","highlighted","optionRenderer","props","_objectWithoutProperties","_excluded","createElement","_extends","displayName","FlyoutItem","_ref2","overlayElRef","useRef","_useDropdownFlyoutCon","isHighlighted","isExpanded","_onClick","onClick","expand","collapse","onMouseEnter","onMouseLeave","e","relatedTarget","Node","current","contains","_React$useState","useState","_React$useState2","_slicedToArray","referenceEl","setReferenceEl","Fragment","role","origin","Array","isArray","children","FlyoutList","options","overlayRef","placement","_ref3","_ref3$offset","offset","_useDropdownFlyoutOve","mainAxis","overlayStyle","referenceRef","useEffect","shadowStrength","style","map","key","id","DefaultButton","_ref4","icon","_excluded2","loading","undefined","arrow","Boolean","Children","count","DropdownFlyout","_ref5","disabled","label","_options","_ref5$onClick","_ref5$optionRenderer","_ref5$placement","_onKeyDown","onKeyDown","onFocus_","onFocus","onBlur_","onBlur","onMouseDown_","onMouseDown","onMouseEnter_","onMouseLeave_","size","_ref5$variant","variant","_excluded3","innerRef","containerRef","targetRef","flyoutOptions","useMemo","_useDropdownFlyout","closeSelectedDropdown","openDropdown","isOpen","setMouseOver","setFocused","onClickOutside","refs","element","I18n","ariaLabel","t","concat","trigger","isValidElement","_containerRef$current","target","dataset","flyout","preventDefault","_targetRef$current","focus","_React$useState3","_React$useState4","memoRef","cloneElement","_trigger$props$onClic","_trigger$props","call","tabIndex","Provider","value"],"sources":["../../src/DropdownFlyout/DropdownFlyout.tsx"],"sourcesContent":["import { EllipsisVertical } from '@procore/core-icons/dist'\nimport type { MouseEvent } from 'react'\nimport React, { useCallback } from 'react'\nimport type { ButtonProps } from '../Button/Button.types'\nimport { Card } from '../Card/Card'\nimport { DropdownButton } from '../Dropdown/Dropdown'\nimport { Portal } from '../Portal'\nimport { useClickOutside } from '../_hooks/ClickOutside'\nimport { useI18nContext } from '../_hooks/I18n'\nimport { mergeRefs } from '../_utils/mergeRefs'\nimport type { ReactElementWithRef } from '../_utils/types'\nimport {\n defaultOptionRenderer,\n DropdownFlyoutContext,\n noop,\n transformOption,\n useDropdownFlyout,\n useDropdownFlyoutContext,\n} from './DropdownFlyout.helpers'\nimport {\n StyledDropdownFlyout,\n StyledDropdownFlyoutItem,\n} from './DropdownFlyout.styles'\nimport type {\n DropdownFlyoutProps,\n FlyoutCaptionProps,\n FlyoutItemProps,\n FlyoutListProps,\n} from './DropdownFlyout.types'\nimport { rootId } from './DropdownFlyout.types'\nimport { useDropdownFlyoutOverlay } from './useDropdownFlyoutOverlay'\n\nexport const FlyoutCaption = React.forwardRef<\n HTMLDivElement,\n FlyoutCaptionProps\n>(function FlyoutCaption(\n { option, highlighted, optionRenderer, ...props },\n ref\n) {\n return (\n <StyledDropdownFlyoutItem\n {...props}\n ref={ref}\n data-highlighted={highlighted}\n data-flyout\n >\n {optionRenderer(option)}\n </StyledDropdownFlyoutItem>\n )\n})\n\nFlyoutCaption.displayName = 'FlyoutCaption'\n\nexport function FlyoutItem({ option }: FlyoutItemProps) {\n const overlayElRef = React.useRef<HTMLDivElement>(null)\n const {\n isHighlighted,\n isExpanded,\n onClick: _onClick,\n expand,\n collapse,\n optionRenderer,\n } = useDropdownFlyoutContext()\n\n const onMouseEnter = React.useCallback(() => expand(option), [option, expand])\n const onMouseLeave = React.useCallback(\n (e: React.MouseEvent<HTMLDivElement>) => {\n if (\n e.relatedTarget instanceof Node &&\n overlayElRef.current &&\n !overlayElRef.current.contains(e.relatedTarget as Node)\n ) {\n collapse(option)\n }\n },\n [collapse, option]\n )\n\n const onClick = React.useCallback(() => _onClick(option), [_onClick, option])\n\n const [referenceEl, setReferenceEl] = React.useState<HTMLElement | null>(null)\n\n return (\n <>\n <FlyoutCaption\n ref={setReferenceEl}\n role=\"listitem\"\n option={option.origin}\n onClick={onClick}\n optionRenderer={optionRenderer}\n highlighted={isHighlighted(option)}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n />\n {Array.isArray(option.children) && isExpanded(option) ? (\n <Portal>\n <FlyoutList\n referenceEl={referenceEl}\n options={option.children}\n overlayRef={overlayElRef}\n placement=\"right-top\"\n />\n </Portal>\n ) : null}\n </>\n )\n}\n\nexport function FlyoutList({\n options,\n placement,\n referenceEl,\n overlayRef: overlayElRef,\n offset = 0,\n}: FlyoutListProps) {\n const { overlayStyle, referenceRef, overlayRef } = useDropdownFlyoutOverlay({\n placement,\n offset: { mainAxis: offset },\n })\n\n React.useEffect(() => {\n referenceRef(referenceEl)\n }, [referenceEl, referenceRef])\n\n return (\n <Card\n ref={mergeRefs(overlayRef, overlayElRef)}\n shadowStrength={2}\n style={overlayStyle}\n >\n <StyledDropdownFlyout role=\"list\">\n {options.map((option) => (\n <FlyoutItem key={option.id} option={option} />\n ))}\n </StyledDropdownFlyout>\n </Card>\n )\n}\n\nconst DefaultButton = React.forwardRef<HTMLButtonElement, ButtonProps>(\n function DefaultButton({ children, icon, ...props }, ref) {\n return (\n <DropdownButton\n {...props}\n icon={\n props.loading ? undefined : !icon && !children ? (\n <EllipsisVertical />\n ) : (\n icon\n )\n }\n arrow={Boolean(React.Children.count(children))}\n ref={ref}\n >\n {children}\n </DropdownButton>\n )\n }\n)\n\n/**\n\n The dropdown flyout allows for additional menu items to be nested within\n parent items, which allows more menu options for users.\n @a11y WARN: DropdownFlyotus hold no value and take an action. Focus is expected\n to be moved from a Dropdown to something else, to continue the user flow.\n If the action is inert and does not move focus, this is left to be added\n by the consumer.\n @since 10.19.0\n\n @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-dropdownflyout--demo)\n\n @see [Design Guidelines](https://design.procore.com/dropdown-flyout)\n\n */\nexport const DropdownFlyout = React.forwardRef<\n HTMLDivElement,\n DropdownFlyoutProps\n>(function DropdownFlyout(\n {\n disabled,\n icon,\n label,\n loading,\n options: _options,\n onClick: _onClick = noop,\n optionRenderer = defaultOptionRenderer,\n children,\n placement = 'right-bottom',\n onKeyDown: _onKeyDown,\n onFocus: onFocus_,\n onBlur: onBlur_,\n onMouseDown: onMouseDown_,\n onMouseEnter: onMouseEnter_,\n onMouseLeave: onMouseLeave_,\n size,\n variant = 'secondary',\n ...props\n },\n ref\n) {\n const innerRef = React.useRef<HTMLDivElement>(null)\n const containerRef = (ref as React.RefObject<HTMLInputElement>) || innerRef\n const overlayElRef = React.useRef<HTMLDivElement>(null)\n const targetRef = React.useRef<HTMLElement>(null)\n\n const flyoutOptions = React.useMemo(\n () => transformOption(_options, rootId),\n [_options]\n )\n\n const {\n options,\n collapse,\n expand,\n closeSelectedDropdown,\n openDropdown,\n isOpen,\n onClick,\n onKeyDown,\n setMouseOver,\n setFocused,\n isExpanded,\n isHighlighted,\n } = useDropdownFlyout({\n flyoutOptions,\n onClick: _onClick,\n onKeyDown: _onKeyDown,\n })\n\n useClickOutside({\n onClickOutside: isOpen ? closeSelectedDropdown : noop,\n refs: [containerRef],\n })\n\n const element =\n typeof children === 'function' ? children({ isOpen }) : children\n\n const I18n = useI18nContext()\n\n const ariaLabel =\n props['aria-label'] ||\n label ||\n I18n.t(`core.dropdown.${loading ? 'loading' : 'moreOptions'}`)\n\n const trigger: ReactElementWithRef = React.isValidElement(element) ? (\n element\n ) : (\n <DefaultButton\n aria-label={ariaLabel}\n children={label}\n disabled={disabled}\n loading={loading}\n icon={icon}\n size={size}\n variant={variant}\n />\n )\n\n function onBlur(e: React.FocusEvent<HTMLDivElement>) {\n setFocused(false)\n closeSelectedDropdown(e)\n onBlur_?.(e)\n }\n\n function onFocus(e: React.FocusEvent<HTMLDivElement>) {\n setFocused(true)\n onFocus_?.(e)\n }\n\n function onMouseDown(e: React.MouseEvent<HTMLDivElement>) {\n // Discard firing of blur event\n // when click was inside the dropdown\n if ((e.target as HTMLElement).dataset.flyout) {\n e.preventDefault()\n return\n }\n if (e.target instanceof Node && containerRef.current?.contains(e.target)) {\n e.preventDefault()\n targetRef.current?.focus()\n }\n onMouseDown_?.(e)\n }\n\n function onMouseLeave(e: React.MouseEvent<HTMLDivElement>) {\n setMouseOver(false)\n onMouseLeave_?.(e)\n }\n\n function onMouseEnter(e: React.MouseEvent<HTMLDivElement>) {\n setMouseOver(true)\n onMouseEnter_?.(e)\n }\n\n const [referenceEl, setReferenceEl] = React.useState<HTMLElement | null>(null)\n\n // mergeRefs function is from shared utils.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const memoRef = useCallback(\n trigger.ref\n ? mergeRefs(trigger.ref, targetRef, setReferenceEl)\n : mergeRefs(targetRef, setReferenceEl),\n [targetRef, setReferenceEl, trigger.ref]\n )\n return (\n <div\n {...props}\n aria-label={undefined}\n ref={containerRef}\n onKeyDown={onKeyDown}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onFocus={onFocus}\n onMouseDown={onMouseDown}\n onBlur={onBlur}\n >\n {React.cloneElement(trigger, {\n ref: memoRef,\n onClick: (e: MouseEvent<HTMLElement, 'click'>) => {\n trigger.props.onClick?.(e)\n openDropdown()\n },\n tabIndex: 0,\n })}\n <DropdownFlyoutContext.Provider\n value={{\n expand,\n collapse,\n onClick,\n isExpanded,\n isHighlighted,\n optionRenderer,\n }}\n >\n {isOpen && (\n <Portal>\n <FlyoutList\n options={options}\n overlayRef={overlayElRef}\n placement={placement}\n referenceEl={referenceEl}\n offset={4}\n />\n </Portal>\n )}\n </DropdownFlyoutContext.Provider>\n </div>\n )\n})\n"],"mappings":";;;;;;;;;;;;AAAA,SAASA,gBAAgB,QAAQ,0BAA0B;AAE3D,OAAOC,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAE1C,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,SAAS,QAAQ,qBAAqB;AAE/C,SACEC,qBAAqB,EACrBC,qBAAqB,EACrBC,IAAI,EACJC,eAAe,EACfC,iBAAiB,EACjBC,wBAAwB,QACnB,0BAA0B;AACjC,SACE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MACVD,aAAa,EAAbA,aAAa;MACbZ,cAAc,EAAdA;IACF;EAAE,GAED8F,MAAM,iBACLtH,KAAA,CAAA4B,aAAA,CAACxB,MAAM,qBACLJ,KAAA,CAAA4B,aAAA,CAACiC,UAAU;IACTC,OAAO,EAAEA,OAAQ;IACjBC,UAAU,EAAE9B,YAAa;IACzB+B,SAAS,EAAEA,SAAU;IACrBX,WAAW,EAAEA,WAAY;IACzBc,MAAM,EAAE;EAAE,CACX,CACK,CAEoB,CAC7B,CAAC;AAEV,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"DropdownFlyout.js","names":["EllipsisVertical","React","useCallback","Card","DropdownButton","Portal","useClickOutside","useI18nContext","mergeRefs","defaultOptionRenderer","DropdownFlyoutContext","noop","transformOption","useDropdownFlyout","useDropdownFlyoutContext","StyledDropdownFlyout","StyledDropdownFlyoutItem","rootId","useDropdownFlyoutOverlay","FlyoutCaption","forwardRef","_ref","ref","option","highlighted","optionRenderer","props","_objectWithoutProperties","_excluded","createElement","_extends","displayName","FlyoutItem","_ref2","overlayElRef","useRef","_useDropdownFlyoutCon","isHighlighted","isExpanded","_onClick","onClick","expand","collapse","onMouseEnter","onMouseLeave","e","relatedTarget","Node","current","contains","_React$useState","useState","_React$useState2","_slicedToArray","referenceEl","setReferenceEl","Fragment","role","origin","Array","isArray","children","FlyoutList","options","overlayRef","placement","_ref3","_ref3$offset","offset","_useDropdownFlyoutOve","mainAxis","overlayStyle","referenceRef","useEffect","shadowStrength","style","map","key","id","DefaultButton","_ref4","icon","_excluded2","loading","undefined","arrow","Boolean","Children","count","DropdownFlyout","_ref5","disabled","label","_options","_ref5$onClick","_ref5$optionRenderer","_ref5$placement","_onKeyDown","onKeyDown","onFocus_","onFocus","onBlur_","onBlur","onMouseDown_","onMouseDown","onMouseEnter_","onMouseLeave_","size","_ref5$variant","variant","_excluded3","innerRef","containerRef","targetRef","flyoutOptions","useMemo","_useDropdownFlyout","closeSelectedDropdown","openDropdown","isOpen","setMouseOver","setFocused","onClickOutside","refs","element","I18n","ariaLabel","t","concat","trigger","isValidElement","_containerRef$current","target","dataset","flyout","preventDefault","_targetRef$current","focus","_React$useState3","_React$useState4","memoRef","cloneElement","_trigger$props$onClic","_trigger$props","call","tabIndex","Provider","value"],"sources":["../../src/DropdownFlyout/DropdownFlyout.tsx"],"sourcesContent":["import { EllipsisVertical } from '@procore/core-icons/dist'\nimport type { MouseEvent } from 'react'\nimport React, { useCallback } from 'react'\nimport type { ButtonProps } from '../Button/Button.types'\nimport { Card } from '../Card/Card'\nimport { DropdownButton } from '../Dropdown/Dropdown'\nimport { Portal } from '../Portal'\nimport { useClickOutside } from '../_hooks/ClickOutside'\nimport { useI18nContext } from '../_hooks/I18n'\nimport { mergeRefs } from '../_utils/mergeRefs'\nimport type { ReactElementWithRef } from '../_utils/types'\nimport {\n defaultOptionRenderer,\n DropdownFlyoutContext,\n noop,\n transformOption,\n useDropdownFlyout,\n useDropdownFlyoutContext,\n} from './DropdownFlyout.helpers'\nimport {\n StyledDropdownFlyout,\n StyledDropdownFlyoutItem,\n} from './DropdownFlyout.styles'\nimport type {\n DropdownFlyoutProps,\n FlyoutCaptionProps,\n FlyoutItemProps,\n FlyoutListProps,\n} from './DropdownFlyout.types'\nimport { rootId } from './DropdownFlyout.types'\nimport { useDropdownFlyoutOverlay } from './useDropdownFlyoutOverlay'\n\nexport const FlyoutCaption = React.forwardRef<\n HTMLDivElement,\n FlyoutCaptionProps\n>(function FlyoutCaption(\n { option, highlighted, optionRenderer, ...props },\n ref\n) {\n return (\n <StyledDropdownFlyoutItem\n {...props}\n ref={ref}\n data-highlighted={highlighted}\n data-flyout\n >\n {optionRenderer(option)}\n </StyledDropdownFlyoutItem>\n )\n})\n\nFlyoutCaption.displayName = 'FlyoutCaption'\n\nexport function FlyoutItem({ option }: FlyoutItemProps) {\n const overlayElRef = React.useRef<HTMLDivElement>(null)\n const {\n isHighlighted,\n isExpanded,\n onClick: _onClick,\n expand,\n collapse,\n optionRenderer,\n } = useDropdownFlyoutContext()\n\n const onMouseEnter = React.useCallback(() => expand(option), [option, expand])\n const onMouseLeave = React.useCallback(\n (e: React.MouseEvent<HTMLDivElement>) => {\n if (\n e.relatedTarget instanceof Node &&\n overlayElRef.current &&\n !overlayElRef.current.contains(e.relatedTarget as Node)\n ) {\n collapse(option)\n }\n },\n [collapse, option]\n )\n\n const onClick = React.useCallback(() => _onClick(option), [_onClick, option])\n\n const [referenceEl, setReferenceEl] = React.useState<HTMLElement | null>(null)\n\n return (\n <>\n <FlyoutCaption\n ref={setReferenceEl}\n role=\"listitem\"\n option={option.origin}\n onClick={onClick}\n optionRenderer={optionRenderer}\n highlighted={isHighlighted(option)}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n />\n {Array.isArray(option.children) && isExpanded(option) ? (\n <Portal>\n <FlyoutList\n referenceEl={referenceEl}\n options={option.children}\n overlayRef={overlayElRef}\n placement=\"right-top\"\n />\n </Portal>\n ) : null}\n </>\n )\n}\n\nexport function FlyoutList({\n options,\n placement,\n referenceEl,\n overlayRef: overlayElRef,\n offset = 0,\n}: FlyoutListProps) {\n const { overlayStyle, referenceRef, overlayRef } = useDropdownFlyoutOverlay({\n placement,\n offset: { mainAxis: offset },\n })\n\n React.useEffect(() => {\n referenceRef(referenceEl)\n }, [referenceEl, referenceRef])\n\n return (\n <Card\n ref={mergeRefs(overlayRef, overlayElRef)}\n shadowStrength={2}\n style={overlayStyle}\n >\n <StyledDropdownFlyout role=\"list\">\n {options.map((option) => (\n <FlyoutItem key={option.id} option={option} />\n ))}\n </StyledDropdownFlyout>\n </Card>\n )\n}\n\nconst DefaultButton = React.forwardRef<HTMLButtonElement, ButtonProps>(\n function DefaultButton({ children, icon, ...props }, ref) {\n return (\n <DropdownButton\n {...props}\n icon={\n props.loading ? undefined : !icon && !children ? (\n <EllipsisVertical />\n ) : (\n icon\n )\n }\n arrow={Boolean(React.Children.count(children))}\n ref={ref}\n >\n {children}\n </DropdownButton>\n )\n }\n)\n\n/**\n\n The dropdown flyout allows for additional menu items to be nested within\n parent items, which allows more menu options for users.\n @a11y WARN: DropdownFlyotus hold no value and take an action. Focus is expected\n to be moved from a Dropdown to something else, to continue the user flow.\n If the action is inert and does not move focus, this is left to be added\n by the consumer.\n @since 10.19.0\n\n @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-dropdownflyout--demo)\n\n @see [Design Guidelines](https://design.procore.com/dropdown-flyout)\n\n */\nexport const DropdownFlyout = React.forwardRef<\n HTMLDivElement,\n DropdownFlyoutProps\n>(function DropdownFlyout(\n {\n disabled,\n icon,\n label,\n loading,\n options: _options,\n onClick: _onClick = noop,\n optionRenderer = defaultOptionRenderer,\n children,\n placement = 'right-bottom',\n onKeyDown: _onKeyDown,\n onFocus: onFocus_,\n onBlur: onBlur_,\n onMouseDown: onMouseDown_,\n onMouseEnter: onMouseEnter_,\n onMouseLeave: onMouseLeave_,\n size,\n variant = 'secondary',\n ...props\n },\n ref\n) {\n const innerRef = React.useRef<HTMLDivElement>(null)\n const containerRef = (ref as React.RefObject<HTMLInputElement>) || innerRef\n const overlayElRef = React.useRef<HTMLDivElement>(null)\n const targetRef = React.useRef<HTMLElement>(null)\n\n const flyoutOptions = React.useMemo(\n () => transformOption(_options, rootId),\n [_options]\n )\n\n const {\n options,\n collapse,\n expand,\n closeSelectedDropdown,\n openDropdown,\n isOpen,\n onClick,\n onKeyDown,\n setMouseOver,\n setFocused,\n isExpanded,\n isHighlighted,\n } = useDropdownFlyout({\n flyoutOptions,\n onClick: _onClick,\n onKeyDown: _onKeyDown,\n })\n\n useClickOutside({\n onClickOutside: isOpen ? closeSelectedDropdown : noop,\n refs: [containerRef],\n })\n\n const element =\n typeof children === 'function' ? children({ isOpen }) : children\n\n const I18n = useI18nContext()\n\n const ariaLabel =\n props['aria-label'] ||\n label ||\n I18n.t(`core.dropdown.${loading ? 'loading' : 'moreOptions'}`)\n\n const trigger: ReactElementWithRef = React.isValidElement(element) ? (\n element\n ) : (\n <DefaultButton\n aria-label={ariaLabel}\n children={label}\n disabled={disabled}\n loading={loading}\n icon={icon}\n size={size}\n variant={variant}\n />\n )\n\n function onBlur(e: React.FocusEvent<HTMLDivElement>) {\n setFocused(false)\n closeSelectedDropdown(e)\n onBlur_?.(e)\n }\n\n function onFocus(e: React.FocusEvent<HTMLDivElement>) {\n setFocused(true)\n onFocus_?.(e)\n }\n\n function onMouseDown(e: React.MouseEvent<HTMLDivElement>) {\n // Discard firing of blur event\n // when click was inside the dropdown\n if ((e.target as HTMLElement).dataset.flyout) {\n e.preventDefault()\n return\n }\n if (e.target instanceof Node && containerRef.current?.contains(e.target)) {\n e.preventDefault()\n targetRef.current?.focus()\n }\n onMouseDown_?.(e)\n }\n\n function onMouseLeave(e: React.MouseEvent<HTMLDivElement>) {\n setMouseOver(false)\n onMouseLeave_?.(e)\n }\n\n function onMouseEnter(e: React.MouseEvent<HTMLDivElement>) {\n setMouseOver(true)\n onMouseEnter_?.(e)\n }\n\n const [referenceEl, setReferenceEl] = React.useState<HTMLElement | null>(null)\n\n // mergeRefs function is from shared utils.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const memoRef = useCallback(\n trigger.ref\n ? mergeRefs(trigger.ref, targetRef, setReferenceEl)\n : mergeRefs(targetRef, setReferenceEl),\n [targetRef, setReferenceEl, trigger.ref]\n )\n return (\n <div\n {...props}\n aria-label={undefined}\n ref={containerRef}\n onKeyDown={onKeyDown}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onFocus={onFocus}\n onMouseDown={onMouseDown}\n onBlur={onBlur}\n >\n {React.cloneElement(trigger, {\n ref: memoRef,\n onClick: (e: MouseEvent<HTMLElement, 'click'>) => {\n trigger.props.onClick?.(e)\n openDropdown()\n },\n tabIndex: 0,\n })}\n <DropdownFlyoutContext.Provider\n value={{\n expand,\n collapse,\n onClick,\n isExpanded,\n isHighlighted,\n optionRenderer,\n }}\n >\n {isOpen && (\n <Portal>\n <FlyoutList\n options={options}\n overlayRef={overlayElRef}\n placement={placement}\n referenceEl={referenceEl}\n offset={4}\n />\n </Portal>\n )}\n </DropdownFlyoutContext.Provider>\n </div>\n )\n})\n"],"mappings":";;;;;;;;;;;;AAAA,SAASA,gBAAgB,QAAQ,0BAA0B;AAE3D,OAAOC,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAE1C,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,SAAS,QAAQ,qBAAqB;AAE/C,SACEC,qBAAqB,EACrBC,qBAAqB,EACrBC,IAAI,EACJC,eAAe,EACfC,iBAAiB,EACjBC,wBAAwB,QACnB,0BAA0B;AACjC,SACEC,oBAAoB,EACpBC,wBAAwB,QACnB,yBAAyB;AAOhC,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,wBAAwB,QAAQ,4BAA4B;AAErE,OAAO,IAAMC,aAAa,gBAAGlB,KAAK,CAACmB,UAAU,CAG3C,SAASD,aAAaA,CAAAE,IAAA,EAEtBC,GAAG,EACH;EAAA,IAFEC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAEC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IAAEC,cAAc,GAAAJ,IAAA,CAAdI,cAAc;IAAKC,KAAK,GAAAC,wBAAA,CAAAN,IAAA,EAAAO,SAAA;EAG/C,oBACE3B,KAAA,CAAA4B,aAAA,CAACb,wBAAwB,EAAAc,QAAA,KACnBJ,KAAK;IACTJ,GAAG,EAAEA,GAAI;IACT,oBAAkBE,WAAY;IAC9B;EAAW,IAEVC,cAAc,CAACF,MAAM,CACE,CAAC;AAE/B,CAAC,CAAC;AAEFJ,aAAa,CAACY,WAAW,GAAG,eAAe;AAE3C,OAAO,SAASC,UAAUA,CAAAC,KAAA,EAA8B;EAAA,IAA3BV,MAAM,GAAAU,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AE;IAC3B3G,GAAG,EAAEsH,OAAO;IACZpG,OAAO,EAAE,SAATA,OAAOA,CAAGK,CAAmC,EAAK;MAAA,IAAAiG,qBAAA,EAAAC,cAAA;MAChD,CAAAD,qBAAA,IAAAC,cAAA,GAAAd,OAAO,CAACvG,KAAK,EAACc,OAAO,cAAAsG,qBAAA,uBAArBA,qBAAA,CAAAE,IAAA,CAAAD,cAAA,EAAwBlG,CAAC,CAAC;MAC1ByE,YAAY,CAAC,CAAC;IAChB,CAAC;IACD2B,QAAQ,EAAE;EACZ,CAAC,CAAC,eACFhJ,KAAA,CAAA4B,aAAA,CAACnB,qBAAqB,CAACwI,QAAQ;IAC7BC,KAAK,EAAE;MACL1G,MAAM,EAANA,MAAM;MACNC,QAAQ,EAARA,QAAQ;MACRF,OAAO,EAAPA,OAAO;MACPF,UAAU,EAAVA,UAAU;MACVD,aAAa,EAAbA,aAAa;MACbZ,cAAc,EAAdA;IACF;EAAE,GAED8F,MAAM,iBACLtH,KAAA,CAAA4B,aAAA,CAACxB,MAAM,qBACLJ,KAAA,CAAA4B,aAAA,CAACiC,UAAU;IACTC,OAAO,EAAEA,OAAQ;IACjBC,UAAU,EAAE9B,YAAa;IACzB+B,SAAS,EAAEA,SAAU;IACrBX,WAAW,EAAEA,WAAY;IACzBc,MAAM,EAAE;EAAE,CACX,CACK,CAEoB,CAC7B,CAAC;AAEV,CAAC,CAAC"}
|
|
@@ -6,18 +6,18 @@ import { getEllipsis } from '../_styles/mixins';
|
|
|
6
6
|
import { spacing } from '../_styles/spacing';
|
|
7
7
|
export var StyledDropdownFlyout = /*#__PURE__*/styled.div.withConfig({
|
|
8
8
|
displayName: "StyledDropdownFlyout",
|
|
9
|
-
componentId: "core-
|
|
9
|
+
componentId: "core-12_17_7__sc-1i79jsg-0"
|
|
10
10
|
})(["display:flex;flex-wrap:wrap;flex-direction:column;width:100%;max-height:855px;padding:", "px 0;"], spacing.sm);
|
|
11
11
|
export var StyledDropdownFlyoutItem = /*#__PURE__*/styled.div.withConfig({
|
|
12
12
|
displayName: "StyledDropdownFlyoutItem",
|
|
13
|
-
componentId: "core-
|
|
13
|
+
componentId: "core-12_17_7__sc-1i79jsg-1"
|
|
14
14
|
})(["display:flex;justify-content:space-between;cursor:pointer;width:100%;padding:", "px ", "px;color:", ";", " &[data-highlighted='true'],&:hover{background-color:", ";}"], spacing.xs, spacing.lg, colors.gray20, getTypographyIntent('body'), colors.gray96);
|
|
15
15
|
export var StyledDropdownFlyoutLabel = /*#__PURE__*/styled.span.withConfig({
|
|
16
16
|
displayName: "StyledDropdownFlyoutLabel",
|
|
17
|
-
componentId: "core-
|
|
17
|
+
componentId: "core-12_17_7__sc-1i79jsg-2"
|
|
18
18
|
})(["", ""], getEllipsis());
|
|
19
19
|
export var StyledDropdownFlyoutExpandIcon = /*#__PURE__*/styled.span.withConfig({
|
|
20
20
|
displayName: "StyledDropdownFlyoutExpandIcon",
|
|
21
|
-
componentId: "core-
|
|
21
|
+
componentId: "core-12_17_7__sc-1i79jsg-3"
|
|
22
22
|
})(["position:relative;display:inline-flex;align-self:center;flex-shrink:0;margin-left:", "px;white-space:nowrap;", ""], spacing.lg, arrowRight(4, 'black'));
|
|
23
23
|
//# sourceMappingURL=DropdownFlyout.styles.js.map
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
var _excluded = ["value", "disabled", "multiple", "noClick", "noKeyboard", "onDragEnter", "onDragOver", "onDragLeave", "onDropRejected", "maxFileSize", "minFileSize", "maxFileNumber", "onDrop", "onDropAccepted"];
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
5
4
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
function _iterableToArray(
|
|
7
|
-
function _arrayWithoutHoles(
|
|
8
|
-
function ownKeys(
|
|
9
|
-
function _objectSpread(
|
|
10
|
-
function _slicedToArray(
|
|
5
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
6
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
11
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
-
function _unsupportedIterableToArray(
|
|
13
|
-
function _arrayLikeToArray(
|
|
14
|
-
function _iterableToArrayLimit(
|
|
15
|
-
function _arrayWithHoles(
|
|
16
|
-
function _objectWithoutProperties(
|
|
17
|
-
function _objectWithoutPropertiesLoose(
|
|
18
|
-
function _defineProperty(
|
|
19
|
-
function _toPropertyKey(
|
|
20
|
-
function _toPrimitive(
|
|
11
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
16
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
17
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
20
|
import React from 'react';
|
|
22
21
|
import { useDropzone as useDropzoneBase } from 'react-dropzone';
|
|
23
22
|
import { useI18nContext } from '../_hooks/I18n';
|
|
@@ -27,7 +26,7 @@ import { StyledErrorBannerDetails } from './Dropzone.styles';
|
|
|
27
26
|
import { dropErrors, fileRejectionReason } from './Dropzone.types';
|
|
28
27
|
import { getFileDetail, isZeroSize } from './Dropzone.utils';
|
|
29
28
|
var oneDropAtATimeRejectionReason = 'one-drop-at-a-time';
|
|
30
|
-
var dropErrorsByReason = (
|
|
29
|
+
var dropErrorsByReason = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, fileRejectionReason.maxFiles, dropErrors.fileAmount), fileRejectionReason.maxFileSize, dropErrors.maxFileSize), fileRejectionReason.minFileSize, dropErrors.minFileSize), fileRejectionReason.fileType, dropErrors.fileType);
|
|
31
30
|
var getSizeInMB = function getSizeInMB(maxSize) {
|
|
32
31
|
return maxSize / 10e5;
|
|
33
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropzone.hooks.js","names":["React","useDropzone","useDropzoneBase","useI18nContext","partition","MultipleErrors","StyledErrorBannerDetails","dropErrors","fileRejectionReason","getFileDetail","isZeroSize","oneDropAtATimeRejectionReason","dropErrorsByReason","_dropErrorsByReason","_defineProperty","maxFiles","fileAmount","maxFileSize","minFileSize","fileType","getSizeInMB","maxSize","_ref","arguments","length","undefined","_ref$value","value","_ref$disabled","disabled","_ref$multiple","multiple","_ref$noClick","noClick","_ref$noKeyboard","noKeyboard","onDragEnter","onDragOver","onDragLeave","onDropRejected","minSize","_ref$maxFileNumber","maxFileNumber","Infinity","_onDrop","onDrop","onDropAccepted","props","_objectWithoutProperties","_excluded","I18n","_React$useState","useState","_React$useState2","_slicedToArray","acceptedFiles","setAcceptedFiles","_React$useState3","_React$useState4","fileRejections","setFileRejections","maxFilesRemaining","defaultDropError","type","reset","title","message","dropErrorReducer","state","action","rejectedFiles","createElement","map","_ref2","file","key","name","t","oneFileAtATime","body","sizeInMegabytes","multipleErrors","_objectSpread","withOneDropAtATimeError","errors","code","_React$useReducer","useReducer","_React$useReducer2","dropError","dispatchDropError","useCallback","event","droppedFiles","concat","_toConsumableArray","rej","allFilesWithRejections","_ref3","i","_partition","_ref4","_partition2","actualAcceptedFiles_","actualRejectedFiles","actualAcceptedFiles","_ref5","errorCodes","flatMap","rejection","error","hasMultipleErrors","Set","size","_useDropzoneBase","getRootProps","getInputProps","isDragActive","isFileDialogActive","isDragReject","isFocused","isDragAccept","draggedFiles","open","rootRef","inputRef","dragError","useMemo","getFileTypeError","count","getFileAmountError","fileLimit","amountError"],"sources":["../../src/Dropzone/Dropzone.hooks.tsx"],"sourcesContent":["import React from 'react'\nimport type { DropEvent, DropzoneOptions } from 'react-dropzone'\nimport { useDropzone as useDropzoneBase } from 'react-dropzone'\nimport { useI18nContext } from '../_hooks/I18n'\nimport { partition } from '../_utils/partition'\nimport { MultipleErrors } from './Dropzone'\nimport { StyledErrorBannerDetails } from './Dropzone.styles'\nimport type {\n DropError,\n DropErrorType,\n DropzoneHookProps,\n DropzoneHookState,\n FileRejection,\n FileRejectionReason,\n} from './Dropzone.types'\nimport { dropErrors, fileRejectionReason } from './Dropzone.types'\nimport { getFileDetail, isZeroSize } from './Dropzone.utils'\n\nconst oneDropAtATimeRejectionReason = 'one-drop-at-a-time'\n\nconst dropErrorsByReason: Record<FileRejectionReason, DropErrorType> = {\n [fileRejectionReason.maxFiles]: dropErrors.fileAmount,\n [fileRejectionReason.maxFileSize]: dropErrors.maxFileSize,\n [fileRejectionReason.minFileSize]: dropErrors.minFileSize,\n [fileRejectionReason.fileType]: dropErrors.fileType,\n}\n\nconst getSizeInMB = (maxSize: number): number => maxSize / 10e5\n\n/**\n * WARNING:\n * Use ACCEPT prop carefully, because mime type determination is not reliable across platforms.\n * Details: https://github.com/react-dropzone/react-dropzone/tree/master/examples/accept#browser-limitations\n */\nexport const useDropzone = ({\n value = [],\n disabled = false,\n multiple = false,\n noClick = true,\n noKeyboard = true,\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDropRejected,\n maxFileSize: maxSize,\n minFileSize: minSize,\n maxFileNumber = Infinity,\n onDrop: _onDrop,\n onDropAccepted,\n ...props\n}: DropzoneHookProps = {}): DropzoneHookState => {\n const I18n = useI18nContext()\n const [acceptedFiles, setAcceptedFiles] = React.useState<File[]>([])\n const [fileRejections, setFileRejections] = React.useState<FileRejection[]>(\n []\n )\n\n const maxFilesRemaining = maxFileNumber - value.length\n\n const defaultDropError = {\n type: dropErrors.reset,\n title: '',\n message: '',\n }\n\n const dropErrorReducer = (\n state: DropError,\n action: DropErrorType\n ): DropError => {\n const rejectedFiles = (\n <StyledErrorBannerDetails>\n {fileRejections.map(({ file }) => {\n return <li key={file.name}>{getFileDetail(file)}</li>\n })}\n </StyledErrorBannerDetails>\n )\n const title = I18n.t('core.dropzone.errorTitle')\n\n switch (action) {\n case dropErrors.oneFileAtATime:\n return {\n type: dropErrors.oneFileAtATime,\n title: '',\n message: I18n.t('core.dropzone.oneFileAtATimeError'),\n }\n case dropErrors.fileAmount:\n return {\n type: dropErrors.fileAmount,\n title,\n message: I18n.t('core.dropzone.standaloneMaxFileNumberError', {\n maxFiles: maxFileNumber,\n }),\n body: rejectedFiles,\n }\n case dropErrors.fileType:\n return {\n type: dropErrors.fileType,\n title,\n message: I18n.t('core.dropzone.standaloneUnsupportedFileTypeError'),\n body: rejectedFiles,\n }\n case dropErrors.maxFileSize:\n return {\n type: dropErrors.maxFileSize,\n title,\n message: I18n.t('core.dropzone.standaloneMaxFileSizeError', {\n sizeInMegabytes: getSizeInMB(maxSize as number),\n }),\n body: rejectedFiles,\n }\n case dropErrors.minFileSize:\n const message = isZeroSize(minSize)\n ? I18n.t('core.dropzone.standaloneZeroFileSizeError')\n : I18n.t('core.dropzone.standaloneMinFileSizeError', {\n sizeInMegabytes: getSizeInMB(minSize as number),\n })\n\n return {\n type: dropErrors.minFileSize,\n title,\n message,\n body: rejectedFiles,\n }\n case dropErrors.multipleErrors:\n return {\n type: dropErrors.multipleErrors,\n title,\n message: I18n.t('core.dropzone.multipleErrorsMessage'),\n body: (\n <MultipleErrors\n fileRejections={fileRejections}\n maxFiles={maxFileNumber}\n maxSize={maxSize}\n minSize={minSize}\n />\n ),\n }\n case dropErrors.reset:\n return { ...defaultDropError }\n default:\n return state\n }\n }\n\n const withOneDropAtATimeError = (file: File) => ({\n file,\n errors: [\n {\n message: I18n.t('core.dropzone.oneDropAtATimeError'),\n code: oneDropAtATimeRejectionReason as FileRejectionReason,\n },\n ],\n })\n\n const [dropError, dispatchDropError] = React.useReducer<\n React.Reducer<DropError, DropErrorType>\n >(dropErrorReducer, { ...defaultDropError })\n\n const onDrop: DropzoneOptions['onDrop'] = React.useCallback(\n (\n acceptedFiles: File[],\n rejectedFiles: FileRejection[],\n event: DropEvent\n ) => {\n dispatchDropError(dropErrors.reset)\n\n const droppedFiles = [\n ...acceptedFiles,\n ...rejectedFiles.map((rej) => rej.file),\n ]\n if (!multiple && droppedFiles.length > 1) {\n dispatchDropError(dropErrors.oneFileAtATime)\n onDropRejected?.(droppedFiles.map(withOneDropAtATimeError), event)\n return\n }\n\n const allFilesWithRejections = [\n ...acceptedFiles.map((file) => ({ file, errors: [] })),\n ...rejectedFiles,\n ].map(({ file, errors }, i) => ({\n file,\n errors:\n i < maxFilesRemaining\n ? errors\n : [...errors, { message: '', code: fileRejectionReason.maxFiles }],\n }))\n\n const [actualAcceptedFiles_, actualRejectedFiles] =\n partition<FileRejection>(\n ({ errors }) => errors.length === 0,\n allFilesWithRejections\n )\n\n const actualAcceptedFiles = actualAcceptedFiles_.map(({ file }) => file)\n\n _onDrop?.(actualAcceptedFiles, actualRejectedFiles, event)\n\n setAcceptedFiles(actualAcceptedFiles)\n setFileRejections(actualRejectedFiles)\n\n if (actualAcceptedFiles.length) {\n onDropAccepted?.(actualAcceptedFiles, event)\n }\n\n if (actualRejectedFiles.length) {\n onDropRejected?.(actualRejectedFiles, event)\n }\n\n const errorCodes = actualRejectedFiles\n .flatMap((rejection) => rejection.errors)\n .map((error) => error.code)\n const hasMultipleErrors = new Set([...errorCodes]).size > 1\n\n if (hasMultipleErrors) {\n dispatchDropError(dropErrors.multipleErrors)\n } else {\n dispatchDropError(dropErrorsByReason[errorCodes[0]])\n }\n },\n [_onDrop, maxFilesRemaining, onDropRejected, onDropAccepted, multiple]\n )\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isFileDialogActive,\n isDragReject,\n isFocused,\n isDragAccept,\n draggedFiles,\n open,\n rootRef,\n inputRef,\n } = useDropzoneBase({\n ...props,\n disabled,\n minSize,\n maxSize,\n multiple,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n noClick,\n noKeyboard,\n })\n\n const dragError = React.useMemo(() => {\n const getFileTypeError = () => {\n return isDragReject\n ? I18n.t('core.dropzone.incorrectFileTypeMessage', {\n count: draggedFiles.length,\n })\n : ''\n }\n\n const getFileAmountError = () => {\n const fileLimit = multiple ? maxFilesRemaining : 1\n\n const amountError = multiple\n ? I18n.t('core.dropzone.invalidAmountAttachments', {\n count: maxFileNumber,\n })\n : I18n.t('core.dropzone.incorrectFileNumber')\n\n return draggedFiles.length > fileLimit ? amountError : ''\n }\n\n return getFileAmountError() || getFileTypeError()\n }, [\n I18n,\n draggedFiles.length,\n maxFilesRemaining,\n isDragReject,\n maxFileNumber,\n multiple,\n ])\n\n return {\n getRootProps,\n getInputProps,\n\n isDragActive,\n isFileDialogActive,\n isDragReject,\n isFocused,\n isDragAccept,\n draggedFiles,\n acceptedFiles,\n fileRejections,\n\n open,\n rootRef,\n inputRef,\n\n multiple,\n dragError,\n dropError,\n dispatchDropError,\n disabled,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,WAAW,IAAIC,eAAe,QAAQ,gBAAgB;AAC/D,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,cAAc,QAAQ,YAAY;AAC3C,SAASC,wBAAwB,QAAQ,mBAAmB;AAS5D,SAASC,UAAU,EAAEC,mBAAmB,QAAQ,kBAAkB;AAClE,SAASC,aAAa,EAAEC,UAAU,QAAQ,kBAAkB;AAE5D,IAAMC,6BAA6B,GAAG,oBAAoB;AAE1D,IAAMC,kBAA8D,IAAAC,mBAAA,OAAAC,eAAA,CAAAD,mBAAA,EACjEL,mBAAmB,CAACO,QAAQ,EAAGR,UAAU,CAACS,UAAU,GAAAF,eAAA,CAAAD,mBAAA,EACpDL,mBAAmB,CAACS,WAAW,EAAGV,UAAU,CAACU,WAAW,GAAAH,eAAA,CAAAD,mBAAA,EACxDL,mBAAmB,CAACU,WAAW,EAAGX,UAAU,CAACW,WAAW,GAAAJ,eAAA,CAAAD,mBAAA,EACxDL,mBAAmB,CAACW,QAAQ,EAAGZ,UAAU,CAACY,QAAQ,GAAAN,mBAAA,CACpD;AAED,IAAMO,WAAW,GAAG,SAAdA,WAAWA,CAAIC,OAAe;EAAA,OAAaA,OAAO,GAAG,IAAI;AAAA;;AAE/D;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMpB,WAAW,GAAG,SAAdA,WAAWA,CAAA,EAgByB;EAAA,IAAAqB,IAAA,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAA1B,CAAC,CAAC;EA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Y;IACZnE,aAAa,EAAbA,aAAa;IACbI,cAAc,EAAdA,cAAc;IAEdgE,IAAI,EAAJA,IAAI;IACJC,OAAO,EAAPA,OAAO;IACPC,QAAQ,EAARA,QAAQ;IAER9F,QAAQ,EAARA,QAAQ;IACR+F,SAAS,EAATA,SAAS;IACTrC,SAAS,EAATA,SAAS;IACTC,iBAAiB,EAAjBA,iBAAiB;IACjB7D,QAAQ,EAARA;EACF,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"Dropzone.hooks.js","names":["React","useDropzone","useDropzoneBase","useI18nContext","partition","MultipleErrors","StyledErrorBannerDetails","dropErrors","fileRejectionReason","getFileDetail","isZeroSize","oneDropAtATimeRejectionReason","dropErrorsByReason","_defineProperty","maxFiles","fileAmount","maxFileSize","minFileSize","fileType","getSizeInMB","maxSize","_ref","arguments","length","undefined","_ref$value","value","_ref$disabled","disabled","_ref$multiple","multiple","_ref$noClick","noClick","_ref$noKeyboard","noKeyboard","onDragEnter","onDragOver","onDragLeave","onDropRejected","minSize","_ref$maxFileNumber","maxFileNumber","Infinity","_onDrop","onDrop","onDropAccepted","props","_objectWithoutProperties","_excluded","I18n","_React$useState","useState","_React$useState2","_slicedToArray","acceptedFiles","setAcceptedFiles","_React$useState3","_React$useState4","fileRejections","setFileRejections","maxFilesRemaining","defaultDropError","type","reset","title","message","dropErrorReducer","state","action","rejectedFiles","createElement","map","_ref2","file","key","name","t","oneFileAtATime","body","sizeInMegabytes","multipleErrors","_objectSpread","withOneDropAtATimeError","errors","code","_React$useReducer","useReducer","_React$useReducer2","dropError","dispatchDropError","useCallback","event","droppedFiles","concat","_toConsumableArray","rej","allFilesWithRejections","_ref3","i","_partition","_ref4","_partition2","actualAcceptedFiles_","actualRejectedFiles","actualAcceptedFiles","_ref5","errorCodes","flatMap","rejection","error","hasMultipleErrors","Set","size","_useDropzoneBase","getRootProps","getInputProps","isDragActive","isFileDialogActive","isDragReject","isFocused","isDragAccept","draggedFiles","open","rootRef","inputRef","dragError","useMemo","getFileTypeError","count","getFileAmountError","fileLimit","amountError"],"sources":["../../src/Dropzone/Dropzone.hooks.tsx"],"sourcesContent":["import React from 'react'\nimport type { DropEvent, DropzoneOptions } from 'react-dropzone'\nimport { useDropzone as useDropzoneBase } from 'react-dropzone'\nimport { useI18nContext } from '../_hooks/I18n'\nimport { partition } from '../_utils/partition'\nimport { MultipleErrors } from './Dropzone'\nimport { StyledErrorBannerDetails } from './Dropzone.styles'\nimport type {\n DropError,\n DropErrorType,\n DropzoneHookProps,\n DropzoneHookState,\n FileRejection,\n FileRejectionReason,\n} from './Dropzone.types'\nimport { dropErrors, fileRejectionReason } from './Dropzone.types'\nimport { getFileDetail, isZeroSize } from './Dropzone.utils'\n\nconst oneDropAtATimeRejectionReason = 'one-drop-at-a-time'\n\nconst dropErrorsByReason: Record<FileRejectionReason, DropErrorType> = {\n [fileRejectionReason.maxFiles]: dropErrors.fileAmount,\n [fileRejectionReason.maxFileSize]: dropErrors.maxFileSize,\n [fileRejectionReason.minFileSize]: dropErrors.minFileSize,\n [fileRejectionReason.fileType]: dropErrors.fileType,\n}\n\nconst getSizeInMB = (maxSize: number): number => maxSize / 10e5\n\n/**\n * WARNING:\n * Use ACCEPT prop carefully, because mime type determination is not reliable across platforms.\n * Details: https://github.com/react-dropzone/react-dropzone/tree/master/examples/accept#browser-limitations\n */\nexport const useDropzone = ({\n value = [],\n disabled = false,\n multiple = false,\n noClick = true,\n noKeyboard = true,\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDropRejected,\n maxFileSize: maxSize,\n minFileSize: minSize,\n maxFileNumber = Infinity,\n onDrop: _onDrop,\n onDropAccepted,\n ...props\n}: DropzoneHookProps = {}): DropzoneHookState => {\n const I18n = useI18nContext()\n const [acceptedFiles, setAcceptedFiles] = React.useState<File[]>([])\n const [fileRejections, setFileRejections] = React.useState<FileRejection[]>(\n []\n )\n\n const maxFilesRemaining = maxFileNumber - value.length\n\n const defaultDropError = {\n type: dropErrors.reset,\n title: '',\n message: '',\n }\n\n const dropErrorReducer = (\n state: DropError,\n action: DropErrorType\n ): DropError => {\n const rejectedFiles = (\n <StyledErrorBannerDetails>\n {fileRejections.map(({ file }) => {\n return <li key={file.name}>{getFileDetail(file)}</li>\n })}\n </StyledErrorBannerDetails>\n )\n const title = I18n.t('core.dropzone.errorTitle')\n\n switch (action) {\n case dropErrors.oneFileAtATime:\n return {\n type: dropErrors.oneFileAtATime,\n title: '',\n message: I18n.t('core.dropzone.oneFileAtATimeError'),\n }\n case dropErrors.fileAmount:\n return {\n type: dropErrors.fileAmount,\n title,\n message: I18n.t('core.dropzone.standaloneMaxFileNumberError', {\n maxFiles: maxFileNumber,\n }),\n body: rejectedFiles,\n }\n case dropErrors.fileType:\n return {\n type: dropErrors.fileType,\n title,\n message: I18n.t('core.dropzone.standaloneUnsupportedFileTypeError'),\n body: rejectedFiles,\n }\n case dropErrors.maxFileSize:\n return {\n type: dropErrors.maxFileSize,\n title,\n message: I18n.t('core.dropzone.standaloneMaxFileSizeError', {\n sizeInMegabytes: getSizeInMB(maxSize as number),\n }),\n body: rejectedFiles,\n }\n case dropErrors.minFileSize:\n const message = isZeroSize(minSize)\n ? I18n.t('core.dropzone.standaloneZeroFileSizeError')\n : I18n.t('core.dropzone.standaloneMinFileSizeError', {\n sizeInMegabytes: getSizeInMB(minSize as number),\n })\n\n return {\n type: dropErrors.minFileSize,\n title,\n message,\n body: rejectedFiles,\n }\n case dropErrors.multipleErrors:\n return {\n type: dropErrors.multipleErrors,\n title,\n message: I18n.t('core.dropzone.multipleErrorsMessage'),\n body: (\n <MultipleErrors\n fileRejections={fileRejections}\n maxFiles={maxFileNumber}\n maxSize={maxSize}\n minSize={minSize}\n />\n ),\n }\n case dropErrors.reset:\n return { ...defaultDropError }\n default:\n return state\n }\n }\n\n const withOneDropAtATimeError = (file: File) => ({\n file,\n errors: [\n {\n message: I18n.t('core.dropzone.oneDropAtATimeError'),\n code: oneDropAtATimeRejectionReason as FileRejectionReason,\n },\n ],\n })\n\n const [dropError, dispatchDropError] = React.useReducer<\n React.Reducer<DropError, DropErrorType>\n >(dropErrorReducer, { ...defaultDropError })\n\n const onDrop: DropzoneOptions['onDrop'] = React.useCallback(\n (\n acceptedFiles: File[],\n rejectedFiles: FileRejection[],\n event: DropEvent\n ) => {\n dispatchDropError(dropErrors.reset)\n\n const droppedFiles = [\n ...acceptedFiles,\n ...rejectedFiles.map((rej) => rej.file),\n ]\n if (!multiple && droppedFiles.length > 1) {\n dispatchDropError(dropErrors.oneFileAtATime)\n onDropRejected?.(droppedFiles.map(withOneDropAtATimeError), event)\n return\n }\n\n const allFilesWithRejections = [\n ...acceptedFiles.map((file) => ({ file, errors: [] })),\n ...rejectedFiles,\n ].map(({ file, errors }, i) => ({\n file,\n errors:\n i < maxFilesRemaining\n ? errors\n : [...errors, { message: '', code: fileRejectionReason.maxFiles }],\n }))\n\n const [actualAcceptedFiles_, actualRejectedFiles] =\n partition<FileRejection>(\n ({ errors }) => errors.length === 0,\n allFilesWithRejections\n )\n\n const actualAcceptedFiles = actualAcceptedFiles_.map(({ file }) => file)\n\n _onDrop?.(actualAcceptedFiles, actualRejectedFiles, event)\n\n setAcceptedFiles(actualAcceptedFiles)\n setFileRejections(actualRejectedFiles)\n\n if (actualAcceptedFiles.length) {\n onDropAccepted?.(actualAcceptedFiles, event)\n }\n\n if (actualRejectedFiles.length) {\n onDropRejected?.(actualRejectedFiles, event)\n }\n\n const errorCodes = actualRejectedFiles\n .flatMap((rejection) => rejection.errors)\n .map((error) => error.code)\n const hasMultipleErrors = new Set([...errorCodes]).size > 1\n\n if (hasMultipleErrors) {\n dispatchDropError(dropErrors.multipleErrors)\n } else {\n dispatchDropError(dropErrorsByReason[errorCodes[0]])\n }\n },\n [_onDrop, maxFilesRemaining, onDropRejected, onDropAccepted, multiple]\n )\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isFileDialogActive,\n isDragReject,\n isFocused,\n isDragAccept,\n draggedFiles,\n open,\n rootRef,\n inputRef,\n } = useDropzoneBase({\n ...props,\n disabled,\n minSize,\n maxSize,\n multiple,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n noClick,\n noKeyboard,\n })\n\n const dragError = React.useMemo(() => {\n const getFileTypeError = () => {\n return isDragReject\n ? I18n.t('core.dropzone.incorrectFileTypeMessage', {\n count: draggedFiles.length,\n })\n : ''\n }\n\n const getFileAmountError = () => {\n const fileLimit = multiple ? maxFilesRemaining : 1\n\n const amountError = multiple\n ? I18n.t('core.dropzone.invalidAmountAttachments', {\n count: maxFileNumber,\n })\n : I18n.t('core.dropzone.incorrectFileNumber')\n\n return draggedFiles.length > fileLimit ? amountError : ''\n }\n\n return getFileAmountError() || getFileTypeError()\n }, [\n I18n,\n draggedFiles.length,\n maxFilesRemaining,\n isDragReject,\n maxFileNumber,\n multiple,\n ])\n\n return {\n getRootProps,\n getInputProps,\n\n isDragActive,\n isFileDialogActive,\n isDragReject,\n isFocused,\n isDragAccept,\n draggedFiles,\n acceptedFiles,\n fileRejections,\n\n open,\n rootRef,\n inputRef,\n\n multiple,\n dragError,\n dropError,\n dispatchDropError,\n disabled,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,WAAW,IAAIC,eAAe,QAAQ,gBAAgB;AAC/D,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,cAAc,QAAQ,YAAY;AAC3C,SAASC,wBAAwB,QAAQ,mBAAmB;AAS5D,SAASC,UAAU,EAAEC,mBAAmB,QAAQ,kBAAkB;AAClE,SAASC,aAAa,EAAEC,UAAU,QAAQ,kBAAkB;AAE5D,IAAMC,6BAA6B,GAAG,oBAAoB;AAE1D,IAAMC,kBAA8D,GAAAC,eAAA,CAAAA,eAAA,CAAAA,eAAA,CAAAA,eAAA,KACjEL,mBAAmB,CAACM,QAAQ,EAAGP,UAAU,CAACQ,UAAU,GACp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G,SAAS,GAAGC,WAAW,GAAG,EAAE;IAC3D,CAAC;IAED,OAAOF,kBAAkB,CAAC,CAAC,IAAIF,gBAAgB,CAAC,CAAC;EACnD,CAAC,EAAE,CACD9E,IAAI,EACJwE,YAAY,CAAClG,MAAM,EACnBqC,iBAAiB,EACjB0D,YAAY,EACZ7E,aAAa,EACbX,QAAQ,CACT,CAAC;EAEF,OAAO;IACLoF,YAAY,EAAZA,YAAY;IACZC,aAAa,EAAbA,aAAa;IAEbC,YAAY,EAAZA,YAAY;IACZC,kBAAkB,EAAlBA,kBAAkB;IAClBC,YAAY,EAAZA,YAAY;IACZC,SAAS,EAATA,SAAS;IACTC,YAAY,EAAZA,YAAY;IACZC,YAAY,EAAZA,YAAY;IACZnE,aAAa,EAAbA,aAAa;IACbI,cAAc,EAAdA,cAAc;IAEdgE,IAAI,EAAJA,IAAI;IACJC,OAAO,EAAPA,OAAO;IACPC,QAAQ,EAARA,QAAQ;IAER9F,QAAQ,EAARA,QAAQ;IACR+F,SAAS,EAATA,SAAS;IACTrC,SAAS,EAATA,SAAS;IACTC,iBAAiB,EAAjBA,iBAAiB;IACjB7D,QAAQ,EAARA;EACF,CAAC;AACH,CAAC"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
var _dropErrorsByReason;
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
2
|
var _excluded = ["error", "onDismiss", "qa", "fileRejections"];
|
|
4
|
-
function _defineProperty(
|
|
5
|
-
function _toPropertyKey(
|
|
6
|
-
function _toPrimitive(
|
|
7
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
8
|
-
function _slicedToArray(
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
7
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
9
8
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
-
function _unsupportedIterableToArray(
|
|
11
|
-
function _arrayLikeToArray(
|
|
12
|
-
function _iterableToArrayLimit(
|
|
13
|
-
function _arrayWithHoles(
|
|
14
|
-
function _objectWithoutProperties(
|
|
15
|
-
function _objectWithoutPropertiesLoose(
|
|
9
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
14
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
15
|
import { Ban, Image } from '@procore/core-icons/dist';
|
|
17
16
|
import { equals, omit } from 'ramda';
|
|
18
17
|
import React from 'react';
|
|
@@ -62,7 +61,6 @@ var DropzoneErrorBannerBase = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
62
61
|
}, error.body) : null);
|
|
63
62
|
});
|
|
64
63
|
export function MultipleErrors(props) {
|
|
65
|
-
var _props$fileRejections, _messages;
|
|
66
64
|
var I18n = useI18nContext();
|
|
67
65
|
var filesByErrorType = props.fileRejections.reduce(function (acc, rejection) {
|
|
68
66
|
rejection.errors.forEach(function (error) {
|
|
@@ -70,14 +68,14 @@ export function MultipleErrors(props) {
|
|
|
70
68
|
acc[dropErrorType].push(rejection.file);
|
|
71
69
|
});
|
|
72
70
|
return acc;
|
|
73
|
-
}, (
|
|
74
|
-
var messages = (
|
|
71
|
+
}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, dropErrors.fileAmount, []), dropErrors.minFileSize, []), dropErrors.maxFileSize, []), dropErrors.fileType, []), dropErrors.oneFileAtATime, []), dropErrors.reset, []), dropErrors.multipleErrors, []));
|
|
72
|
+
var messages = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, dropErrors.fileAmount, I18n.t('core.dropzone.maxFileNumberErrorGroup', {
|
|
75
73
|
count: props.maxFiles
|
|
76
|
-
})),
|
|
74
|
+
})), dropErrors.minFileSize, isZeroSize(props.minSize) ? I18n.t('core.dropzone.zeroFileSizeErrorGroup') : I18n.t('core.dropzone.minFileSizeErrorGroup', {
|
|
77
75
|
sizeInMegabytes: getSizeInMB(props.minSize)
|
|
78
|
-
})),
|
|
76
|
+
})), dropErrors.maxFileSize, I18n.t('core.dropzone.maxFileSizeErrorGroup', {
|
|
79
77
|
sizeInMegabytes: getSizeInMB(props.maxSize)
|
|
80
|
-
})),
|
|
78
|
+
})), dropErrors.fileType, I18n.t('core.dropzone.wrongFileTypeErrorGroup')), dropErrors.reset, ''), dropErrors.multipleErrors, ''), dropErrors.oneFileAtATime, '');
|
|
81
79
|
return /*#__PURE__*/React.createElement("div", null, [dropErrors.fileAmount, dropErrors.fileType, dropErrors.maxFileSize, dropErrors.minFileSize].map(function (errorType) {
|
|
82
80
|
var files = filesByErrorType[errorType];
|
|
83
81
|
return files.length ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -95,7 +93,7 @@ export function MultipleErrors(props) {
|
|
|
95
93
|
// make error banner accessible as a styled-components selector
|
|
96
94
|
export var DropzoneErrorBanner = /*#__PURE__*/styled(DropzoneErrorBannerBase).withConfig({
|
|
97
95
|
displayName: "DropzoneErrorBanner",
|
|
98
|
-
componentId: "core-
|
|
96
|
+
componentId: "core-12_17_7__sc-l4fojb-0"
|
|
99
97
|
})([""]);
|
|
100
98
|
function DropzoneContainer(_ref2) {
|
|
101
99
|
var active = _ref2.active,
|
|
@@ -132,7 +130,7 @@ export function DropzoneDefaultMessage(_ref4) {
|
|
|
132
130
|
error: !!errorMessage
|
|
133
131
|
}, errorMessage || I18n.t('core.dropzone.dragAndDrop')));
|
|
134
132
|
}
|
|
135
|
-
var dropErrorsByReason = (
|
|
133
|
+
var dropErrorsByReason = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, fileRejectionReason.maxFiles, dropErrors.fileAmount), fileRejectionReason.maxFileSize, dropErrors.maxFileSize), fileRejectionReason.minFileSize, dropErrors.minFileSize), fileRejectionReason.fileType, dropErrors.fileType);
|
|
136
134
|
var getSizeInMB = function getSizeInMB(maxSize) {
|
|
137
135
|
return maxSize / 10e5;
|
|
138
136
|
};
|