@algolia/satellite 1.0.0-beta.164 → 1.0.0-beta.165
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/cjs/AnnouncementBadge/AnnouncementBadge.d.ts +3 -3
- package/cjs/AnnouncementBadge/AnnouncementBadge.js +4 -6
- package/cjs/AnnouncementBadge/index.js +2 -2
- package/cjs/AutoComplete/AutoComplete.d.ts +3 -49
- package/cjs/AutoComplete/AutoComplete.js +347 -516
- package/cjs/AutoComplete/AutoComplete.tailwind.d.ts +1 -1
- package/cjs/AutoComplete/components/AutoCompleteEmptyState.js +2 -4
- package/cjs/AutoComplete/components/AutocompleteContext.d.ts +5 -0
- package/cjs/AutoComplete/components/AutocompleteContext.js +19 -0
- package/cjs/AutoComplete/components/DefaultOptionItem.d.ts +2 -2
- package/cjs/AutoComplete/components/DefaultOptionItem.js +4 -5
- package/cjs/AutoComplete/index.d.ts +1 -0
- package/cjs/AutoComplete/index.js +14 -2
- package/cjs/AutoComplete/types.d.ts +1 -1
- package/cjs/AutoComplete/utils.d.ts +3 -0
- package/cjs/AutoComplete/utils.js +36 -6
- package/cjs/Avatars/ApplicationAvatar.js +2 -4
- package/cjs/Avatars/UserAvatar.js +4 -6
- package/cjs/Avatars/index.js +2 -2
- package/cjs/Avatars/utils.js +9 -13
- package/cjs/Badge/Badge.d.ts +0 -2
- package/cjs/Badge/Badge.js +4 -6
- package/cjs/Badge/index.js +2 -2
- package/cjs/Banners/Alert/Alert.d.ts +2 -2
- package/cjs/Banners/Alert/Alert.js +2 -4
- package/cjs/Banners/Alert/index.js +2 -2
- package/cjs/Banners/BigBertha/BigBertha.js +2 -4
- package/cjs/Banners/BigBertha/index.js +2 -2
- package/cjs/Banners/Promote/Promote.d.ts +0 -6
- package/cjs/Banners/Promote/Promote.js +2 -10
- package/cjs/Banners/Promote/index.js +2 -2
- package/cjs/Button/Button.js +4 -6
- package/cjs/Button/Button.tailwind.d.ts +1 -1
- package/cjs/Button/Button.tailwind.js +1 -1
- package/cjs/Button/ButtonGroup.d.ts +1 -1
- package/cjs/Button/ButtonGroup.js +2 -4
- package/cjs/Button/IconButton.d.ts +5 -0
- package/cjs/Button/IconButton.js +9 -6
- package/cjs/Button/PolymorphicButton.js +5 -6
- package/cjs/Button/PolymorphicIconButton.d.ts +5 -1
- package/cjs/Button/PolymorphicIconButton.js +12 -12
- package/cjs/Button/index.js +2 -2
- package/cjs/Button/styles.d.ts +1 -1
- package/cjs/Button/styles.js +8 -9
- package/cjs/Button/types.d.ts +3 -2
- package/cjs/Card/Card.d.ts +1 -1
- package/cjs/Card/Card.js +4 -6
- package/cjs/Card/Card.tailwind.d.ts +1 -1
- package/cjs/Card/components/CardHeader.js +4 -6
- package/cjs/Card/components/CardTitle.js +4 -6
- package/cjs/Card/index.js +2 -2
- package/cjs/Checkbox/Checkbox.d.ts +3 -3
- package/cjs/Checkbox/Checkbox.js +6 -8
- package/cjs/Checkbox/Checkbox.tailwind.d.ts +1 -1
- package/cjs/Checkbox/Checkbox.tailwind.js +5 -0
- package/cjs/Checkbox/index.js +2 -2
- package/cjs/ClickAwayContainer/ClickAwayContainer.js +5 -9
- package/cjs/DatePicker/DatePicker/DatePicker.d.ts +1 -1
- package/cjs/DatePicker/DatePicker/DatePicker.js +11 -12
- package/cjs/DatePicker/DatePicker/datePickerReducer.js +8 -11
- package/cjs/DatePicker/DatePicker/index.js +2 -2
- package/cjs/DatePicker/DatePicker.tailwind.d.ts +1 -1
- package/cjs/DatePicker/DateRangePicker/DateRangePicker.js +5 -7
- package/cjs/DatePicker/DateRangePicker/DateRangePickerDisplay.js +1 -2
- package/cjs/DatePicker/DateRangePicker/dateRangePickerReducer.js +8 -11
- package/cjs/DatePicker/DateRangePicker/dateRangePickerTimeRange.js +4 -7
- package/cjs/DatePicker/DateRangePicker/index.js +2 -2
- package/cjs/DatePicker/components/Calendar.js +3 -4
- package/cjs/DatePicker/components/Display.js +1 -2
- package/cjs/DatePicker/components/Footer.js +1 -2
- package/cjs/DatePicker/components/FooterActions.js +1 -2
- package/cjs/DatePicker/components/Modal.js +4 -6
- package/cjs/DatePicker/components/NavBar.js +3 -4
- package/cjs/DatePicker/components/SidePanel.js +1 -2
- package/cjs/DatePicker/index.d.ts +0 -1
- package/cjs/DatePicker/index.js +2 -17
- package/cjs/DatePicker/utils.js +3 -5
- package/cjs/Dropdown/Dropdown.js +5 -8
- package/cjs/Dropdown/DropdownButton.js +4 -6
- package/cjs/Dropdown/DropdownContext.js +3 -6
- package/cjs/Dropdown/components/DropdownButtonItem.d.ts +1 -1
- package/cjs/Dropdown/components/DropdownButtonItem.js +4 -6
- package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItem.js +3 -5
- package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroup.js +2 -3
- package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroupContext.js +3 -5
- package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsMultiGroup.js +2 -3
- package/cjs/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsSingleGroup.js +2 -3
- package/cjs/Dropdown/components/DropdownDivider.js +2 -4
- package/cjs/Dropdown/components/DropdownFooterItem.d.ts +1 -0
- package/cjs/Dropdown/components/DropdownFooterItem.js +4 -6
- package/cjs/Dropdown/components/DropdownLinkItem.js +4 -6
- package/cjs/Dropdown/components/DropdownRadioItem.js +4 -6
- package/cjs/Dropdown/components/DropdownTitle.js +4 -6
- package/cjs/Dropdown/components/DropdownToggleItem.js +4 -6
- package/cjs/Dropdown/index.js +2 -2
- package/cjs/Dropdown/useDropdownItemProps.js +4 -6
- package/cjs/Dropzone/Dropzone.js +6 -8
- package/cjs/Dropzone/index.js +2 -2
- package/cjs/EmptyState/EmptyState.js +26 -28
- package/cjs/EmptyState/EmptyState.tailwind.d.ts +1 -1
- package/cjs/EmptyState/index.js +2 -2
- package/cjs/EmptyState/types.d.ts +8 -23
- package/cjs/Field/Field.d.ts +0 -1
- package/cjs/Field/Field.js +4 -6
- package/cjs/Field/FieldStateContext.js +3 -6
- package/cjs/Field/index.js +2 -2
- package/cjs/Field/useFieldState.js +4 -6
- package/cjs/Flag/Flag.js +5 -7
- package/cjs/Flag/Flag.tailwind.d.ts +1 -1
- package/cjs/Flag/Flags.js +8 -9
- package/cjs/Flag/index.js +2 -2
- package/cjs/FlexGrid/FlexGrid.d.ts +1 -12
- package/cjs/FlexGrid/FlexGrid.js +2 -4
- package/cjs/FlexGrid/FlexGrid.tailwind.d.ts +1 -1
- package/cjs/FlexGrid/FlexGrid.tailwind.js +2 -2
- package/cjs/FlexGrid/index.js +2 -2
- package/cjs/HelpUnderline/HelpUnderline.js +4 -6
- package/cjs/HelpUnderline/HelpUnderline.tailwind.d.ts +1 -1
- package/cjs/HelpUnderline/index.js +2 -2
- package/cjs/Input/Input.d.ts +4 -1
- package/cjs/Input/Input.js +8 -10
- package/cjs/Input/Input.tailwind.d.ts +1 -1
- package/cjs/Input/index.js +2 -2
- package/cjs/Insert/Insert.js +2 -4
- package/cjs/Insert/index.js +2 -2
- package/cjs/InstantSearch/InstantSearch.tailwind.d.ts +1 -1
- package/cjs/KeyboardKey/KeyboardKey.js +2 -3
- package/cjs/KeyboardKey/KeyboardKey.tailwind.d.ts +1 -1
- package/cjs/Link/BaseLink.js +4 -6
- package/cjs/Link/ButtonLink.js +4 -6
- package/cjs/Link/IconButtonLink.js +4 -6
- package/cjs/Link/Link.d.ts +2 -2
- package/cjs/Link/Link.js +4 -6
- package/cjs/Link/index.js +2 -2
- package/cjs/Medallion/Medallion.d.ts +1 -0
- package/cjs/Medallion/Medallion.js +2 -4
- package/cjs/Medallion/Medallion.tailwind.d.ts +1 -1
- package/cjs/Medallion/index.js +2 -2
- package/cjs/Modal/Modal.js +12 -13
- package/cjs/Modal/Modal.tailwind.d.ts +1 -1
- package/cjs/Modal/components/ModalFooter.js +4 -6
- package/cjs/Modal/components/ModalSection.js +2 -4
- package/cjs/Modal/index.js +2 -2
- package/cjs/Pagination/CompactPagination/CompactPagination.js +6 -10
- package/cjs/Pagination/CompactPagination/index.js +2 -2
- package/cjs/Pagination/DotPagination/DotPagination.js +5 -7
- package/cjs/Pagination/DotPagination/index.js +2 -2
- package/cjs/Pagination/Pagination/Pagination.js +6 -8
- package/cjs/Pagination/Pagination/index.js +2 -2
- package/cjs/Pagination/index.js +2 -2
- package/cjs/Popover/Popover.d.ts +5 -0
- package/cjs/Popover/Popover.js +137 -0
- package/cjs/Popover/index.d.ts +3 -0
- package/cjs/Popover/index.js +36 -0
- package/cjs/Popover/types.d.ts +74 -0
- package/cjs/Popover/types.js +5 -0
- package/cjs/ProgressBar/ProgressBar.js +6 -7
- package/cjs/ProgressBar/ProgressBar.tailwind.d.ts +1 -1
- package/cjs/ProgressBar/index.js +2 -2
- package/cjs/ProgressSpinner/ProgressSpinner.js +4 -6
- package/cjs/ProgressSpinner/ProgressSpinner.tailwind.d.ts +1 -1
- package/cjs/ProgressSpinner/ProgressSpinner.tailwind.js +8 -0
- package/cjs/ProgressSpinner/index.js +2 -2
- package/cjs/RadioGroup/RadioButton.d.ts +1 -1
- package/cjs/RadioGroup/RadioButton.js +4 -6
- package/cjs/RadioGroup/RadioButton.tailwind.d.ts +1 -1
- package/cjs/RadioGroup/RadioButton.tailwind.js +3 -0
- package/cjs/RadioGroup/RadioGroup.d.ts +1 -0
- package/cjs/RadioGroup/RadioGroup.js +3 -6
- package/cjs/RadioGroup/RadiogroupContext.d.ts +1 -4
- package/cjs/RadioGroup/RadiogroupContext.js +3 -5
- package/cjs/RadioGroup/index.js +2 -2
- package/cjs/RangeSlider/RangeSlider.d.ts +2 -0
- package/cjs/RangeSlider/RangeSlider.js +4 -6
- package/cjs/RangeSlider/index.js +2 -2
- package/cjs/Satellite/Satellite.js +5 -7
- package/cjs/Satellite/SatelliteContext.js +5 -8
- package/cjs/Satellite/SatelliteRouter.js +2 -4
- package/cjs/Satellite/index.js +2 -2
- package/cjs/Satellite/locale.d.ts +2 -0
- package/cjs/Satellite/locale.js +2 -3
- package/cjs/Satellite/useCreatePortal.js +2 -3
- package/cjs/ScrollIndicator/ScrollIndicator.js +2 -4
- package/cjs/ScrollIndicator/ScrollIndicator.tailwind.d.ts +1 -1
- package/cjs/ScrollIndicator/index.js +2 -2
- package/cjs/Select/Select.js +4 -6
- package/cjs/Select/Select.tailwind.d.ts +1 -1
- package/cjs/Select/index.js +2 -2
- package/cjs/Separator/Separator.d.ts +1 -0
- package/cjs/Separator/Separator.js +21 -11
- package/cjs/Separator/Separator.tailwind.d.ts +1 -1
- package/cjs/Separator/Separator.tailwind.js +31 -2
- package/cjs/Separator/index.js +2 -2
- package/cjs/Sidebar/Sidebar.d.ts +1 -0
- package/cjs/Sidebar/Sidebar.js +4 -5
- package/cjs/Sidebar/SidebarButtonLink.js +4 -5
- package/cjs/Sidebar/SidebarContext.js +3 -5
- package/cjs/Sidebar/SidebarHeader.d.ts +1 -0
- package/cjs/Sidebar/SidebarHeader.js +2 -3
- package/cjs/Sidebar/SidebarHeading.d.ts +1 -0
- package/cjs/Sidebar/SidebarHeading.js +2 -3
- package/cjs/Sidebar/SidebarLink.js +4 -5
- package/cjs/Sidebar/SidebarLinksGroup/ActiveLinkIndicator.d.ts +1 -0
- package/cjs/Sidebar/SidebarLinksGroup/ActiveLinkIndicator.js +3 -4
- package/cjs/Sidebar/SidebarLinksGroup/SidebarGroupLink.js +4 -5
- package/cjs/Sidebar/SidebarLinksGroup/SidebarLinksGroup.d.ts +1 -0
- package/cjs/Sidebar/SidebarLinksGroup/SidebarLinksGroup.js +6 -7
- package/cjs/Sidebar/SidebarNav.d.ts +1 -0
- package/cjs/Sidebar/SidebarNav.js +2 -3
- package/cjs/Switch/Switch.d.ts +1 -0
- package/cjs/Switch/Switch.js +5 -5
- package/cjs/Switch/Switch.tailwind.d.ts +1 -1
- package/cjs/Switch/SwitchOption.js +5 -7
- package/cjs/Switch/index.js +2 -2
- package/cjs/Switch/utils.js +5 -9
- package/cjs/Tables/DataTable/DataTable.d.ts +8 -1
- package/cjs/Tables/DataTable/DataTable.js +6 -8
- package/cjs/Tables/DataTable/DataTable.tailwind.d.ts +1 -1
- package/cjs/Tables/DataTable/components/Body.js +4 -6
- package/cjs/Tables/DataTable/components/Footer.js +6 -8
- package/cjs/Tables/DataTable/components/Header.js +2 -4
- package/cjs/Tables/DataTable/components/HeaderCell.js +6 -8
- package/cjs/Tables/DataTable/components/Loader.d.ts +1 -0
- package/cjs/Tables/DataTable/components/Loader.js +3 -5
- package/cjs/Tables/DataTable/index.js +2 -2
- package/cjs/Tables/DataTable/types.d.ts +14 -0
- package/cjs/Tables/DataTable/utils.js +4 -7
- package/cjs/Tables/Table/Table.js +4 -6
- package/cjs/Tables/Table/Table.tailwind.d.ts +1 -1
- package/cjs/Tables/Table/components/TableFooter.js +2 -4
- package/cjs/Tables/Table/index.js +2 -2
- package/cjs/Tables/index.js +2 -2
- package/cjs/Tabs/ContentTabs.js +2 -4
- package/cjs/Tabs/LinkTabs.js +3 -6
- package/cjs/Tabs/Tabs.tailwind.d.ts +1 -1
- package/cjs/Tabs/Tabs.tailwind.js +20 -1
- package/cjs/Tabs/components/LinkTab.js +12 -14
- package/cjs/Tabs/index.js +2 -2
- package/cjs/Tabs/types.d.ts +0 -1
- package/cjs/Tabs/utils.js +2 -3
- package/cjs/Tag/Tag.d.ts +7 -17
- package/cjs/Tag/Tag.js +16 -12
- package/cjs/Tag/Tag.tailwind.d.ts +1 -1
- package/cjs/Tag/index.js +2 -2
- package/cjs/TextArea/TextArea.js +4 -6
- package/cjs/TextArea/TextArea.tailwind.d.ts +1 -1
- package/cjs/TextArea/index.js +2 -2
- package/cjs/TextWrap/TextWrap.js +4 -6
- package/cjs/TextWrap/index.js +2 -2
- package/cjs/Toggle/Toggle.d.ts +6 -2
- package/cjs/Toggle/Toggle.js +26 -13
- package/cjs/Toggle/Toggle.tailwind.d.ts +1 -1
- package/cjs/Toggle/Toggle.tailwind.js +18 -6
- package/cjs/Toggle/index.js +2 -2
- package/cjs/Tooltip/OverflowTooltipWrapper.js +4 -5
- package/cjs/Tooltip/Tooltip.d.ts +1 -1
- package/cjs/Tooltip/Tooltip.js +4 -6
- package/cjs/Tooltip/Tooltip.tailwind.d.ts +1 -1
- package/cjs/Tooltip/Tooltip.tailwind.js +1 -91
- package/cjs/Tooltip/TooltipWrapper.d.ts +2 -2
- package/cjs/Tooltip/TooltipWrapper.js +7 -8
- package/cjs/Tooltip/index.js +2 -2
- package/cjs/Tooltip/types.d.ts +15 -15
- package/cjs/Tooltip/utils.js +2 -3
- package/cjs/Typography/Typography.tailwind.d.ts +1 -1
- package/cjs/Typography/Typography.tailwind.js +2 -2
- package/cjs/UserContent/UserContent.d.ts +1 -0
- package/cjs/UserContent/UserContent.js +2 -4
- package/cjs/UserContent/UserContent.tailwind.d.ts +1 -1
- package/cjs/UserContent/UserContent.tailwind.js +2 -2
- package/cjs/styles/base.tailwind.d.ts +1 -1
- package/cjs/styles/helpers/makePurgeCssExtractor.js +1 -1
- package/cjs/styles/tailwind.config.js +3 -3
- package/cjs/styles/zIndexes.d.ts +1 -0
- package/cjs/styles/zIndexes.js +4 -3
- package/cjs/types.d.ts +2 -3
- package/cjs/utilities/overlay.tailwind.d.ts +5 -0
- package/cjs/utilities/overlay.tailwind.js +107 -0
- package/cjs/utilities/utilities.tailwind.d.ts +1 -1
- package/cjs/utils/genericChangeHandler.js +1 -2
- package/cjs/utils/hashCode.js +2 -4
- package/cjs/utils/isCssPropertySupported.d.ts +1 -1
- package/cjs/utils/isCssPropertySupported.js +1 -2
- package/cjs/utils/isNil.js +2 -4
- package/cjs/utils/isReactText.js +2 -3
- package/cjs/utils/isRenderedChild.js +1 -2
- package/cjs/utils/matchLocation.js +1 -2
- package/cjs/utils/onlyText.js +1 -2
- package/cjs/utils/parseUrl.js +2 -4
- package/cjs/utils/pluralize.js +1 -2
- package/cjs/utils/prefersReducedMotion.d.ts +6 -0
- package/cjs/utils/prefersReducedMotion.js +12 -0
- package/cjs/utils/range.js +1 -2
- package/cjs/utils/toSentenceCase.js +2 -4
- package/cjs/utils/uniqBy.js +1 -2
- package/cjs/utils/uniqueId.js +1 -2
- package/cjs/utils/useForwardedRef.js +1 -2
- package/cjs/utils/useLinkProps.js +2 -4
- package/cjs/utils/useTriggerInputChange.js +1 -2
- package/esm/AnnouncementBadge/AnnouncementBadge.d.ts +3 -3
- package/esm/AnnouncementBadge/AnnouncementBadge.js +2 -2
- package/esm/AutoComplete/AutoComplete.d.ts +3 -49
- package/esm/AutoComplete/AutoComplete.js +350 -517
- package/esm/AutoComplete/AutoComplete.tailwind.d.ts +1 -1
- package/esm/AutoComplete/components/AutocompleteContext.d.ts +5 -0
- package/esm/AutoComplete/components/AutocompleteContext.js +13 -0
- package/esm/AutoComplete/components/DefaultOptionItem.d.ts +2 -2
- package/esm/AutoComplete/components/DefaultOptionItem.js +2 -2
- package/esm/AutoComplete/index.d.ts +1 -0
- package/esm/AutoComplete/index.js +1 -0
- package/esm/AutoComplete/types.d.ts +1 -1
- package/esm/AutoComplete/utils.d.ts +3 -0
- package/esm/AutoComplete/utils.js +31 -1
- package/esm/Avatars/UserAvatar.js +2 -2
- package/esm/Avatars/utils.js +2 -2
- package/esm/Badge/Badge.d.ts +0 -2
- package/esm/Badge/Badge.js +2 -2
- package/esm/Banners/Alert/Alert.d.ts +2 -2
- package/esm/Banners/Promote/Promote.d.ts +0 -6
- package/esm/Banners/Promote/Promote.js +0 -6
- package/esm/Button/Button.js +2 -2
- package/esm/Button/Button.tailwind.d.ts +1 -1
- package/esm/Button/Button.tailwind.js +1 -1
- package/esm/Button/ButtonGroup.d.ts +1 -1
- package/esm/Button/IconButton.d.ts +5 -0
- package/esm/Button/IconButton.js +7 -2
- package/esm/Button/PolymorphicButton.js +2 -2
- package/esm/Button/PolymorphicIconButton.d.ts +5 -1
- package/esm/Button/PolymorphicIconButton.js +11 -10
- package/esm/Button/styles.d.ts +1 -1
- package/esm/Button/styles.js +3 -0
- package/esm/Button/types.d.ts +3 -2
- package/esm/Card/Card.d.ts +1 -1
- package/esm/Card/Card.js +2 -2
- package/esm/Card/Card.tailwind.d.ts +1 -1
- package/esm/Card/components/CardHeader.js +2 -2
- package/esm/Card/components/CardTitle.js +2 -2
- package/esm/Checkbox/Checkbox.d.ts +3 -3
- package/esm/Checkbox/Checkbox.js +4 -4
- package/esm/Checkbox/Checkbox.tailwind.d.ts +1 -1
- package/esm/Checkbox/Checkbox.tailwind.js +5 -0
- package/esm/ClickAwayContainer/ClickAwayContainer.js +1 -1
- package/esm/DatePicker/DatePicker/DatePicker.d.ts +1 -1
- package/esm/DatePicker/DatePicker/DatePicker.js +9 -9
- package/esm/DatePicker/DatePicker/datePickerReducer.js +5 -5
- package/esm/DatePicker/DatePicker.tailwind.d.ts +1 -1
- package/esm/DatePicker/DateRangePicker/DateRangePicker.js +3 -3
- package/esm/DatePicker/DateRangePicker/dateRangePickerReducer.js +5 -5
- package/esm/DatePicker/components/Calendar.js +2 -2
- package/esm/DatePicker/components/Modal.js +2 -2
- package/esm/DatePicker/components/NavBar.js +2 -2
- package/esm/DatePicker/index.d.ts +0 -1
- package/esm/DatePicker/index.js +0 -1
- package/esm/Dropdown/Dropdown.js +2 -2
- package/esm/Dropdown/DropdownButton.js +2 -2
- package/esm/Dropdown/components/DropdownButtonItem.d.ts +1 -1
- package/esm/Dropdown/components/DropdownButtonItem.js +2 -2
- package/esm/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItem.js +1 -1
- package/esm/Dropdown/components/DropdownFooterItem.d.ts +1 -0
- package/esm/Dropdown/components/DropdownFooterItem.js +2 -2
- package/esm/Dropdown/components/DropdownLinkItem.js +2 -2
- package/esm/Dropdown/components/DropdownRadioItem.js +2 -2
- package/esm/Dropdown/components/DropdownTitle.js +2 -2
- package/esm/Dropdown/components/DropdownToggleItem.js +2 -2
- package/esm/Dropdown/useDropdownItemProps.js +2 -2
- package/esm/Dropzone/Dropzone.js +4 -4
- package/esm/EmptyState/EmptyState.js +24 -24
- package/esm/EmptyState/EmptyState.tailwind.d.ts +1 -1
- package/esm/EmptyState/types.d.ts +8 -23
- package/esm/Field/Field.d.ts +0 -1
- package/esm/Flag/Flag.js +3 -3
- package/esm/Flag/Flag.tailwind.d.ts +1 -1
- package/esm/Flag/Flags.js +6 -5
- package/esm/FlexGrid/FlexGrid.d.ts +1 -12
- package/esm/FlexGrid/FlexGrid.tailwind.d.ts +1 -1
- package/esm/FlexGrid/FlexGrid.tailwind.js +2 -2
- package/esm/HelpUnderline/HelpUnderline.js +2 -2
- package/esm/HelpUnderline/HelpUnderline.tailwind.d.ts +1 -1
- package/esm/Input/Input.d.ts +4 -1
- package/esm/Input/Input.js +6 -6
- package/esm/Input/Input.tailwind.d.ts +1 -1
- package/esm/InstantSearch/InstantSearch.tailwind.d.ts +1 -1
- package/esm/KeyboardKey/KeyboardKey.tailwind.d.ts +1 -1
- package/esm/Link/BaseLink.js +2 -2
- package/esm/Link/ButtonLink.js +2 -2
- package/esm/Link/IconButtonLink.js +2 -2
- package/esm/Link/Link.d.ts +2 -2
- package/esm/Link/Link.js +2 -2
- package/esm/Medallion/Medallion.d.ts +1 -0
- package/esm/Medallion/Medallion.tailwind.d.ts +1 -1
- package/esm/Modal/Modal.js +8 -7
- package/esm/Modal/Modal.tailwind.d.ts +1 -1
- package/esm/Modal/components/ModalFooter.js +2 -2
- package/esm/Pagination/CompactPagination/CompactPagination.js +2 -2
- package/esm/Pagination/DotPagination/DotPagination.js +3 -3
- package/esm/Pagination/Pagination/Pagination.js +2 -2
- package/esm/Popover/Popover.d.ts +5 -0
- package/esm/Popover/Popover.js +129 -0
- package/esm/Popover/index.d.ts +3 -0
- package/esm/Popover/index.js +3 -0
- package/esm/Popover/types.d.ts +74 -0
- package/esm/Popover/types.js +1 -0
- package/esm/ProgressBar/ProgressBar.js +4 -3
- package/esm/ProgressBar/ProgressBar.tailwind.d.ts +1 -1
- package/esm/ProgressSpinner/ProgressSpinner.js +2 -2
- package/esm/ProgressSpinner/ProgressSpinner.tailwind.d.ts +1 -1
- package/esm/ProgressSpinner/ProgressSpinner.tailwind.js +8 -0
- package/esm/RadioGroup/RadioButton.d.ts +1 -1
- package/esm/RadioGroup/RadioButton.js +2 -2
- package/esm/RadioGroup/RadioButton.tailwind.d.ts +1 -1
- package/esm/RadioGroup/RadioButton.tailwind.js +3 -0
- package/esm/RadioGroup/RadioGroup.d.ts +1 -0
- package/esm/RadioGroup/RadiogroupContext.d.ts +1 -4
- package/esm/RangeSlider/RangeSlider.d.ts +2 -0
- package/esm/RangeSlider/RangeSlider.js +2 -2
- package/esm/Satellite/Satellite.js +4 -4
- package/esm/Satellite/SatelliteContext.js +2 -2
- package/esm/Satellite/locale.d.ts +2 -0
- package/esm/ScrollIndicator/ScrollIndicator.tailwind.d.ts +1 -1
- package/esm/Select/Select.js +2 -2
- package/esm/Select/Select.tailwind.d.ts +1 -1
- package/esm/Separator/Separator.d.ts +1 -0
- package/esm/Separator/Separator.js +17 -5
- package/esm/Separator/Separator.tailwind.d.ts +1 -1
- package/esm/Separator/Separator.tailwind.js +31 -2
- package/esm/Sidebar/Sidebar.d.ts +1 -0
- package/esm/Sidebar/Sidebar.js +2 -2
- package/esm/Sidebar/SidebarButtonLink.js +2 -2
- package/esm/Sidebar/SidebarHeader.d.ts +1 -0
- package/esm/Sidebar/SidebarHeading.d.ts +1 -0
- package/esm/Sidebar/SidebarLink.js +2 -2
- package/esm/Sidebar/SidebarLinksGroup/ActiveLinkIndicator.d.ts +1 -0
- package/esm/Sidebar/SidebarLinksGroup/ActiveLinkIndicator.js +1 -1
- package/esm/Sidebar/SidebarLinksGroup/SidebarGroupLink.js +2 -2
- package/esm/Sidebar/SidebarLinksGroup/SidebarLinksGroup.d.ts +1 -0
- package/esm/Sidebar/SidebarLinksGroup/SidebarLinksGroup.js +4 -4
- package/esm/Sidebar/SidebarNav.d.ts +1 -0
- package/esm/Switch/Switch.d.ts +1 -0
- package/esm/Switch/Switch.js +3 -1
- package/esm/Switch/Switch.tailwind.d.ts +1 -1
- package/esm/Switch/SwitchOption.js +3 -3
- package/esm/Tables/DataTable/DataTable.d.ts +8 -1
- package/esm/Tables/DataTable/DataTable.js +4 -4
- package/esm/Tables/DataTable/DataTable.tailwind.d.ts +1 -1
- package/esm/Tables/DataTable/components/Body.js +2 -2
- package/esm/Tables/DataTable/components/Footer.js +2 -2
- package/esm/Tables/DataTable/components/HeaderCell.js +4 -4
- package/esm/Tables/DataTable/components/Loader.d.ts +1 -0
- package/esm/Tables/DataTable/components/Loader.js +1 -1
- package/esm/Tables/DataTable/types.d.ts +14 -0
- package/esm/Tables/Table/Table.js +2 -2
- package/esm/Tables/Table/Table.tailwind.d.ts +1 -1
- package/esm/Tabs/Tabs.tailwind.d.ts +1 -1
- package/esm/Tabs/Tabs.tailwind.js +20 -1
- package/esm/Tabs/components/LinkTab.js +10 -10
- package/esm/Tabs/types.d.ts +0 -1
- package/esm/Tag/Tag.d.ts +7 -17
- package/esm/Tag/Tag.js +14 -8
- package/esm/Tag/Tag.tailwind.d.ts +1 -1
- package/esm/TextArea/TextArea.js +2 -2
- package/esm/TextArea/TextArea.tailwind.d.ts +1 -1
- package/esm/TextWrap/TextWrap.js +2 -2
- package/esm/Toggle/Toggle.d.ts +6 -2
- package/esm/Toggle/Toggle.js +24 -9
- package/esm/Toggle/Toggle.tailwind.d.ts +1 -1
- package/esm/Toggle/Toggle.tailwind.js +18 -6
- package/esm/Tooltip/OverflowTooltipWrapper.js +2 -2
- package/esm/Tooltip/Tooltip.d.ts +1 -1
- package/esm/Tooltip/Tooltip.js +2 -2
- package/esm/Tooltip/Tooltip.tailwind.d.ts +1 -1
- package/esm/Tooltip/Tooltip.tailwind.js +1 -90
- package/esm/Tooltip/TooltipWrapper.d.ts +2 -2
- package/esm/Tooltip/TooltipWrapper.js +3 -3
- package/esm/Tooltip/types.d.ts +15 -15
- package/esm/Typography/Typography.tailwind.d.ts +1 -1
- package/esm/Typography/Typography.tailwind.js +2 -2
- package/esm/UserContent/UserContent.d.ts +1 -0
- package/esm/UserContent/UserContent.tailwind.d.ts +1 -1
- package/esm/UserContent/UserContent.tailwind.js +2 -2
- package/esm/styles/base.tailwind.d.ts +1 -1
- package/esm/styles/helpers/makePurgeCssExtractor.js +1 -1
- package/esm/styles/tailwind.config.js +3 -3
- package/esm/styles/zIndexes.d.ts +1 -0
- package/esm/styles/zIndexes.js +4 -3
- package/esm/types.d.ts +2 -3
- package/esm/utilities/overlay.tailwind.d.ts +5 -0
- package/esm/utilities/overlay.tailwind.js +106 -0
- package/esm/utilities/utilities.tailwind.d.ts +1 -1
- package/esm/utils/isCssPropertySupported.d.ts +1 -1
- package/esm/utils/prefersReducedMotion.d.ts +6 -0
- package/esm/utils/prefersReducedMotion.js +6 -0
- package/package.json +9 -7
- package/satellite.min.css +1 -1
- package/scss/variables.scss +4 -3
@@ -1,110 +1,41 @@
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
5
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
6
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
7
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
8
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
9
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
10
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
11
|
-
|
12
|
-
|
13
|
-
var
|
14
|
-
_excluded2 = ["ref"];
|
15
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
16
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
17
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
18
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
19
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
20
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
21
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
5
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28;
|
6
|
+
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; }
|
7
|
+
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; }
|
22
8
|
import cx from "clsx";
|
23
|
-
import
|
24
|
-
import {
|
25
|
-
import { createPortal } from "react-dom";
|
9
|
+
import { useCombobox, useMultipleSelection } from "downshift";
|
10
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
26
11
|
import { X } from "react-feather";
|
27
|
-
import {
|
28
|
-
import
|
29
|
-
import Card from "../Card";
|
12
|
+
import { usePopper } from "react-popper";
|
13
|
+
import useMeasure from "react-use/lib/useMeasure";
|
14
|
+
import { Card } from "../Card";
|
30
15
|
import { ClickAwayContainer } from "../ClickAwayContainer";
|
31
|
-
import {
|
32
|
-
import {
|
16
|
+
import { useFieldState } from "../Field";
|
17
|
+
import { useCreatePortal, useLocale } from "../Satellite";
|
33
18
|
import ScrollIndicator from "../ScrollIndicator";
|
34
19
|
import stl from "../styles/helpers/satellitePrefixer";
|
35
20
|
import Tag from "../Tag";
|
36
21
|
import uniqBy from "../utils/uniqBy";
|
22
|
+
import { AutocompleteProvider } from "./components/AutocompleteContext";
|
37
23
|
import AutoCompleteEmptyState from "./components/AutoCompleteEmptyState";
|
38
|
-
import DefaultOptionItem from "./components/DefaultOptionItem";
|
39
|
-
import { DEFAULT_AUTOCOMPLETE_LOCALE, defaultCreateFromInputValue,
|
24
|
+
import { DefaultOptionItem } from "./components/DefaultOptionItem";
|
25
|
+
import { DEFAULT_AUTOCOMPLETE_LOCALE, defaultCreateFromInputValue, filter, optionToString } from "./utils";
|
40
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
41
27
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
var labels = (option.metadata || []).concat(option.label);
|
50
|
-
return needles.every(function (needle) {
|
51
|
-
return labels.some(function (label) {
|
52
|
-
return String(label || "").trim().toLowerCase().includes(needle);
|
53
|
-
});
|
54
|
-
});
|
55
|
-
}
|
56
|
-
function filter(options, selectedItems, itemValue) {
|
57
|
-
var needles = makeNeedles(itemValue);
|
58
|
-
var selectedValues = selectedItems.map(function (option) {
|
59
|
-
return option.value;
|
60
|
-
});
|
61
|
-
var results = [];
|
62
|
-
var _iterator = _createForOfIteratorHelper(options),
|
63
|
-
_step;
|
64
|
-
try {
|
65
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
66
|
-
var option = _step.value;
|
67
|
-
if (selectedValues.includes(option.value)) {
|
68
|
-
continue;
|
69
|
-
} else if (option.bypassNeedleMatch || needlesMatch(needles, option)) {
|
70
|
-
results.push(option);
|
71
|
-
}
|
72
|
-
}
|
73
|
-
} catch (err) {
|
74
|
-
_iterator.e(err);
|
75
|
-
} finally {
|
76
|
-
_iterator.f();
|
77
|
-
}
|
78
|
-
return results;
|
79
|
-
}
|
80
|
-
function inputValueFromProps(props) {
|
81
|
-
if (props.inputValue !== undefined) {
|
82
|
-
return props.inputValue;
|
83
|
-
}
|
84
|
-
return !isAutoCompleteMultiProps(props) && props.value ? optionToString(props.value) : "";
|
85
|
-
}
|
86
|
-
var MENU_POPPER_MODFIERS = [{
|
87
|
-
name: "offset",
|
88
|
-
options: {
|
89
|
-
offset: [0, 8]
|
90
|
-
}
|
91
|
-
}];
|
92
|
-
/** @ignore */
|
93
|
-
var DefaultEmptyState = function DefaultEmptyState(_ref) {
|
94
|
-
var emptyStateTitle = _ref.emptyStateTitle;
|
95
|
-
return /*#__PURE__*/_jsx(AutoCompleteEmptyState, {
|
96
|
-
title: emptyStateTitle
|
97
|
-
});
|
98
|
-
};
|
99
|
-
var DefaultOption = function DefaultOption(_ref2) {
|
100
|
-
var optionItemPrefix = _ref2.optionItemPrefix,
|
101
|
-
props = _objectWithoutProperties(_ref2, _excluded);
|
102
|
-
return /*#__PURE__*/_jsx(DefaultOptionItem, _objectSpread(_objectSpread({}, props), {}, {
|
103
|
-
locale: {
|
104
|
-
optionItemPrefix: optionItemPrefix !== null && optionItemPrefix !== void 0 ? optionItemPrefix : DEFAULT_AUTOCOMPLETE_LOCALE.optionItemPrefix
|
28
|
+
var MENU_POPPER_OPTIONS = {
|
29
|
+
strategy: "fixed",
|
30
|
+
placement: "bottom-start",
|
31
|
+
modifiers: [{
|
32
|
+
name: "offset",
|
33
|
+
options: {
|
34
|
+
offset: [0, 8]
|
105
35
|
}
|
106
|
-
}
|
36
|
+
}]
|
107
37
|
};
|
38
|
+
var SHOW_ALL_ITEMS_ID = "__stl_extra_results_option__";
|
108
39
|
|
109
40
|
/**
|
110
41
|
* Autocomplete is a search-as-you-type function that matches what a person types, usually the beginning of a word, or a prefix, with a word list. Not to be confused with auto-suggestion that predicts the end of a query.
|
@@ -122,464 +53,366 @@ var DefaultOption = function DefaultOption(_ref2) {
|
|
122
53
|
* - Provide matching results quickly
|
123
54
|
* - Style different data
|
124
55
|
*/
|
125
|
-
export var AutoComplete =
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
56
|
+
export var AutoComplete = function AutoComplete(_ref) {
|
57
|
+
var localeProp = _ref.locale,
|
58
|
+
id = _ref.id,
|
59
|
+
name = _ref.name,
|
60
|
+
placeholder = _ref.placeholder,
|
61
|
+
autoFocus = _ref.autoFocus,
|
62
|
+
inputValueProp = _ref.inputValue,
|
63
|
+
onTextChange = _ref.onTextChange,
|
64
|
+
_onFocus = _ref.onFocus,
|
65
|
+
_onBlur = _ref.onBlur,
|
66
|
+
disabled = _ref.disabled,
|
67
|
+
clearable = _ref.clearable,
|
68
|
+
renderValueTemplate = _ref.renderValueTemplate,
|
69
|
+
noWrap = _ref.noWrap,
|
70
|
+
separatorKeys = _ref.separatorKeys,
|
71
|
+
multiple = _ref.multiple,
|
72
|
+
value = _ref.value,
|
73
|
+
selectOnBlur = _ref.selectOnBlur,
|
74
|
+
onChange = _ref.onChange,
|
75
|
+
options = _ref.options,
|
76
|
+
optionItemComponent = _ref.optionItemComponent,
|
77
|
+
creatable = _ref.creatable,
|
78
|
+
_ref$createFromInputV = _ref.createFromInputValue,
|
79
|
+
createFromInputValue = _ref$createFromInputV === void 0 ? defaultCreateFromInputValue : _ref$createFromInputV,
|
80
|
+
emptyState = _ref.emptyState,
|
81
|
+
_ref$maxResults = _ref.maxResults,
|
82
|
+
maxItems = _ref$maxResults === void 0 ? 7 : _ref$maxResults,
|
83
|
+
menuFooter = _ref.menuFooter,
|
84
|
+
menuSize = _ref.menuSize,
|
85
|
+
variant = _ref.variant,
|
86
|
+
Icon = _ref.icon,
|
87
|
+
endItem = _ref.endItem,
|
88
|
+
className = _ref.className,
|
89
|
+
menuClassName = _ref.menuClassName,
|
90
|
+
valuesClassName = _ref.valuesClassName;
|
91
|
+
var createPortal = useCreatePortal();
|
92
|
+
var _useFieldState = useFieldState(),
|
93
|
+
status = _useFieldState.status;
|
94
|
+
var localeContext = useLocale("autoComplete");
|
95
|
+
var locale = useMemo(function () {
|
96
|
+
return _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_AUTOCOMPLETE_LOCALE), localeContext), localeProp);
|
97
|
+
}, [localeContext, localeProp]);
|
98
|
+
var inputRef = useRef(null);
|
99
|
+
var _useState = useState(false),
|
100
|
+
_useState2 = _slicedToArray(_useState, 2),
|
101
|
+
inputFocused = _useState2[0],
|
102
|
+
setInputFocused = _useState2[1];
|
103
|
+
var _useState3 = useState(function () {
|
104
|
+
return (inputValueProp !== null && inputValueProp !== void 0 ? inputValueProp : multiple) ? "" : value ? optionToString(value) : "";
|
105
|
+
}),
|
106
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
107
|
+
internalInputValue = _useState4[0],
|
108
|
+
setInternalInputValue = _useState4[1];
|
109
|
+
var inputValue = inputValueProp !== null && inputValueProp !== void 0 ? inputValueProp : internalInputValue;
|
110
|
+
var _useState5 = useState(null),
|
111
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
112
|
+
containerElement = _useState6[0],
|
113
|
+
setContainerElement = _useState6[1];
|
114
|
+
var _useMeasure = useMeasure(),
|
115
|
+
_useMeasure2 = _slicedToArray(_useMeasure, 2),
|
116
|
+
setContainerMeasureRef = _useMeasure2[0],
|
117
|
+
containerWidth = _useMeasure2[1].width;
|
118
|
+
var menuRef = useRef(null);
|
119
|
+
var menuPopper = usePopper(containerElement, menuRef.current, MENU_POPPER_OPTIONS);
|
120
|
+
var _useState7 = useState(false),
|
121
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
122
|
+
showAllItems = _useState8[0],
|
123
|
+
setShowAllItems = _useState8[1];
|
124
|
+
var selectedItems = useMemo(function () {
|
125
|
+
return !value ? [] : Array.isArray(value) ? value : [value];
|
126
|
+
}, [value]);
|
127
|
+
var items = useMemo(function () {
|
128
|
+
var results = filter(options !== null && options !== void 0 ? options : [], multiple ? selectedItems : [], inputValue);
|
129
|
+
var emptyInputValue = !inputValue || inputValue.trim().length === 0;
|
130
|
+
if (creatable && !emptyInputValue) {
|
131
|
+
results.unshift.apply(results, _toConsumableArray(createFromInputValue(options, inputValue)));
|
133
132
|
}
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
_defineProperty(_assertThisInitialized(_this), "inputContainerRef", null);
|
141
|
-
_defineProperty(_assertThisInitialized(_this), "inputRef", null);
|
142
|
-
_defineProperty(_assertThisInitialized(_this), "menuWrapperRef", null);
|
143
|
-
_defineProperty(_assertThisInitialized(_this), "handleClearClick", function () {
|
144
|
-
return _this.setState({
|
145
|
-
inputValue: ""
|
146
|
-
}, function () {
|
147
|
-
return _this.props.onChange(null);
|
133
|
+
if (!showAllItems && results.length > maxItems) {
|
134
|
+
var extraResults = results.length - maxItems;
|
135
|
+
var label = locale.showMoreButton(extraResults);
|
136
|
+
results.splice(maxItems, results.length, {
|
137
|
+
value: SHOW_ALL_ITEMS_ID,
|
138
|
+
label: label
|
148
139
|
});
|
149
|
-
}
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
newInputValue = isAutoCompleteMultiProps(_this.props) ? "" : optionToString(_this.props.value);
|
164
|
-
selectItemAtIndex(highlightedIndex);
|
165
|
-
} else if (isAutoCompleteMultiProps(_this.props)) {
|
166
|
-
newInputValue = inputValue;
|
167
|
-
} else {
|
168
|
-
newInputValue = optionToString(_this.props.value);
|
169
|
-
}
|
170
|
-
if (onBlur) {
|
171
|
-
onBlur(evt);
|
172
|
-
}
|
173
|
-
_this.setState({
|
174
|
-
inputValue: newInputValue || "",
|
175
|
-
inputFocused: false,
|
176
|
-
showAllResults: false
|
177
|
-
});
|
178
|
-
};
|
179
|
-
});
|
180
|
-
_defineProperty(_assertThisInitialized(_this), "handleInputChange", function (evt) {
|
181
|
-
var inputValue = evt.target.value;
|
182
|
-
_this.setState({
|
183
|
-
inputValue: inputValue
|
184
|
-
});
|
185
|
-
if (_this.props.onTextChange) {
|
186
|
-
_this.props.onTextChange(inputValue);
|
187
|
-
}
|
188
|
-
if (!_this.props.multiple && _this.props.value && !inputValue) {
|
189
|
-
_this.props.onChange(null);
|
190
|
-
}
|
191
|
-
});
|
192
|
-
_defineProperty(_assertThisInitialized(_this), "handleInputContainerRefUpdate", function (el) {
|
193
|
-
_this.inputContainerRef = el;
|
194
|
-
if (el) {
|
195
|
-
_this.updateInputWidth();
|
196
|
-
}
|
197
|
-
});
|
198
|
-
_defineProperty(_assertThisInitialized(_this), "updateInputWidth", function () {
|
199
|
-
var _this$inputContainerR, _this$inputContainerR2;
|
200
|
-
var inputWidth = _this.state.inputWidth;
|
201
|
-
var newInputWidth = (_this$inputContainerR = (_this$inputContainerR2 = _this.inputContainerRef) === null || _this$inputContainerR2 === void 0 ? void 0 : _this$inputContainerR2.getBoundingClientRect().width) !== null && _this$inputContainerR !== void 0 ? _this$inputContainerR : inputWidth;
|
202
|
-
if (newInputWidth !== inputWidth) {
|
203
|
-
_this.setState({
|
204
|
-
inputWidth: newInputWidth
|
205
|
-
});
|
206
|
-
}
|
207
|
-
});
|
208
|
-
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (state) {
|
209
|
-
return function (evt) {
|
210
|
-
if (!isAutoCompleteMultiProps(_this.props)) return;
|
211
|
-
var _this$props2 = _this.props,
|
212
|
-
_this$props2$value = _this$props2.value,
|
213
|
-
value = _this$props2$value === void 0 ? [] : _this$props2$value,
|
214
|
-
_this$props2$separato = _this$props2.separatorKeys,
|
215
|
-
separatorKeys = _this$props2$separato === void 0 ? AutoComplete.defaultProps.separatorKeys : _this$props2$separato,
|
216
|
-
creatable = _this$props2.creatable,
|
217
|
-
_this$props2$createFr = _this$props2.createFromInputValue,
|
218
|
-
createFromInputValue = _this$props2$createFr === void 0 ? AutoComplete.defaultProps.createFromInputValue : _this$props2$createFr,
|
219
|
-
options = _this$props2.options,
|
220
|
-
onChange = _this$props2.onChange;
|
221
|
-
var inputValue = state.inputValue || "";
|
222
|
-
var canCreate = creatable && inputValue.trim().length > 0;
|
223
|
-
if (evt.key === "Backspace" && !inputValue.length) {
|
224
|
-
onChange(value.slice(0, -1));
|
225
|
-
} else if (canCreate && separatorKeys.includes(evt.key)) {
|
226
|
-
evt.preventDefault();
|
227
|
-
var _createFromInputValue = createFromInputValue(options, inputValue),
|
228
|
-
_createFromInputValue2 = _slicedToArray(_createFromInputValue, 1),
|
229
|
-
newOption = _createFromInputValue2[0];
|
230
|
-
if (newOption && !newOption.disabled) {
|
231
|
-
state.selectItem(newOption);
|
232
|
-
}
|
233
|
-
}
|
234
|
-
};
|
235
|
-
});
|
236
|
-
_defineProperty(_assertThisInitialized(_this), "handleChange", function (option) {
|
237
|
-
if (option.disabled) return;
|
238
|
-
option = option ? _objectSpread(_objectSpread({}, option), {}, {
|
239
|
-
"new": undefined
|
240
|
-
}) : option;
|
241
|
-
if (isAutoCompleteMultiProps(_this.props)) {
|
242
|
-
var arrayValue = Array.isArray(_this.props.value) ? _this.props.value : [];
|
243
|
-
var newValue = uniqBy([].concat(_toConsumableArray(arrayValue), [option]), function (o) {
|
244
|
-
return o.value;
|
245
|
-
});
|
246
|
-
_this.props.onChange(newValue);
|
247
|
-
_this.setState({
|
248
|
-
inputValue: "",
|
249
|
-
showAllResults: false
|
250
|
-
});
|
140
|
+
}
|
141
|
+
return results;
|
142
|
+
}, [creatable, createFromInputValue, inputValue, locale, maxItems, multiple, options, selectedItems, showAllItems]);
|
143
|
+
var hasValue = !!selectedItems.length;
|
144
|
+
var showClearButton = !disabled && clearable && hasValue;
|
145
|
+
var multipleSelection = useMultipleSelection({
|
146
|
+
selectedItems: selectedItems,
|
147
|
+
onSelectedItemsChange: function onSelectedItemsChange(changes) {
|
148
|
+
if (typeof changes.selectedItems === "undefined") {
|
149
|
+
onChange(null);
|
150
|
+
} else if (multiple) {
|
151
|
+
onChange(uniqBy(changes.selectedItems, function (i) {
|
152
|
+
return i.value;
|
153
|
+
}));
|
251
154
|
} else {
|
252
|
-
|
253
|
-
|
254
|
-
inputValue: option ? option.label : "",
|
255
|
-
showAllResults: false
|
256
|
-
});
|
155
|
+
var _changes$selectedItem;
|
156
|
+
onChange((_changes$selectedItem = changes.selectedItems[0]) !== null && _changes$selectedItem !== void 0 ? _changes$selectedItem : null);
|
257
157
|
}
|
258
|
-
}
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
if (!isAutoCompleteMultiProps(_this.props)) return;
|
268
|
-
var currentOptions = _this.props.value || [];
|
269
|
-
var newOptions = currentOptions.filter(function (option) {
|
270
|
-
return option.value !== removedOption.value;
|
158
|
+
}
|
159
|
+
});
|
160
|
+
var combobox = useCombobox({
|
161
|
+
items: items,
|
162
|
+
itemToString: optionToString,
|
163
|
+
scrollIntoView: function scrollIntoView(node) {
|
164
|
+
var _node$scrollIntoView;
|
165
|
+
return node === null || node === void 0 || (_node$scrollIntoView = node.scrollIntoView) === null || _node$scrollIntoView === void 0 ? void 0 : _node$scrollIntoView.call(node, {
|
166
|
+
block: "nearest"
|
271
167
|
});
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
168
|
+
},
|
169
|
+
defaultHighlightedIndex: 0,
|
170
|
+
getA11yStatusMessage: function getA11yStatusMessage(_ref2) {
|
171
|
+
var isOpen = _ref2.isOpen,
|
172
|
+
resultCount = _ref2.resultCount,
|
173
|
+
previousResultCount = _ref2.previousResultCount;
|
174
|
+
if (!isOpen) {
|
276
175
|
return "";
|
277
176
|
}
|
278
|
-
if (!
|
279
|
-
return
|
177
|
+
if (!resultCount) {
|
178
|
+
return locale.emptyStateTitle;
|
280
179
|
}
|
281
|
-
if (
|
282
|
-
return
|
180
|
+
if (resultCount !== previousResultCount) {
|
181
|
+
return locale.itemsAvailable(resultCount);
|
283
182
|
}
|
284
183
|
return "";
|
285
|
-
}
|
286
|
-
|
287
|
-
var
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
id: id,
|
315
|
-
name: name,
|
316
|
-
disabled: disabled,
|
317
|
-
className: inputClassName,
|
318
|
-
type: "text",
|
319
|
-
placeholder: hasValue ? undefined : placeholder,
|
320
|
-
ref: function ref(input) {
|
321
|
-
return _this.inputRef = input;
|
322
|
-
},
|
323
|
-
onChange: _this.handleInputChange,
|
324
|
-
onFocus: function onFocus(evt) {
|
325
|
-
_onFocus === null || _onFocus === void 0 ? void 0 : _onFocus(evt);
|
326
|
-
if (evt.defaultPrevented) {
|
327
|
-
return;
|
184
|
+
},
|
185
|
+
getA11ySelectionMessage: function getA11ySelectionMessage(_ref3) {
|
186
|
+
var selectedItem = _ref3.selectedItem;
|
187
|
+
return locale.selectionMessage(optionToString(selectedItem), selectedItem);
|
188
|
+
},
|
189
|
+
selectedItem: null,
|
190
|
+
inputValue: inputValue,
|
191
|
+
onStateChange: function onStateChange(changes) {
|
192
|
+
switch (changes.type) {
|
193
|
+
case useCombobox.stateChangeTypes.InputBlur:
|
194
|
+
case useCombobox.stateChangeTypes.InputKeyDownEnter:
|
195
|
+
case useCombobox.stateChangeTypes.ItemClick:
|
196
|
+
{
|
197
|
+
var selectedItem = selectOnBlur && changes.type === useCombobox.stateChangeTypes.InputBlur && combobox.highlightedIndex >= 0 ? items[combobox.highlightedIndex] : changes.selectedItem;
|
198
|
+
if (!selectedItem || selectedItem.disabled) return;
|
199
|
+
if (changes.type !== useCombobox.stateChangeTypes.InputBlur && selectedItem.value === SHOW_ALL_ITEMS_ID) {
|
200
|
+
setShowAllItems(true);
|
201
|
+
combobox.openMenu();
|
202
|
+
combobox.setHighlightedIndex(maxItems);
|
203
|
+
} else if (multiple) {
|
204
|
+
multipleSelection.addSelectedItem(selectedItem);
|
205
|
+
combobox.setInputValue("");
|
206
|
+
setShowAllItems(false);
|
207
|
+
} else {
|
208
|
+
multipleSelection.setSelectedItems([selectedItem]);
|
209
|
+
combobox.setInputValue(optionToString(selectedItem));
|
210
|
+
setShowAllItems(false);
|
211
|
+
}
|
212
|
+
break;
|
328
213
|
}
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
214
|
+
case useCombobox.stateChangeTypes.FunctionSetInputValue:
|
215
|
+
case useCombobox.stateChangeTypes.InputChange:
|
216
|
+
{
|
217
|
+
var _changes$inputValue, _menuPopper$update;
|
218
|
+
var newInputValue = (_changes$inputValue = changes.inputValue) !== null && _changes$inputValue !== void 0 ? _changes$inputValue : "";
|
219
|
+
setInternalInputValue(newInputValue);
|
220
|
+
onTextChange === null || onTextChange === void 0 || onTextChange(newInputValue);
|
221
|
+
if (!multiple && value && !newInputValue) {
|
222
|
+
multipleSelection.setSelectedItems([]);
|
223
|
+
}
|
224
|
+
(_menuPopper$update = menuPopper.update) === null || _menuPopper$update === void 0 || _menuPopper$update.call(menuPopper);
|
225
|
+
break;
|
226
|
+
}
|
227
|
+
case useCombobox.stateChangeTypes.InputKeyDownEscape:
|
228
|
+
{
|
229
|
+
if (!combobox.isOpen) {
|
230
|
+
combobox.setInputValue("");
|
231
|
+
multipleSelection.setSelectedItems([]);
|
232
|
+
}
|
233
|
+
break;
|
234
|
+
}
|
235
|
+
}
|
236
|
+
},
|
237
|
+
isItemDisabled: function isItemDisabled(item) {
|
238
|
+
return Boolean(item.disabled);
|
239
|
+
}
|
240
|
+
});
|
241
|
+
var inputProps = combobox.getInputProps(multipleSelection.getDropdownProps({
|
242
|
+
ref: inputRef,
|
243
|
+
autoFocus: autoFocus,
|
244
|
+
disabled: disabled,
|
245
|
+
// We need to make sure to define event handlers here so that they can be composed properly
|
246
|
+
onFocus: function onFocus(evt) {
|
247
|
+
var _menuPopper$update2;
|
248
|
+
_onFocus === null || _onFocus === void 0 || _onFocus(evt);
|
249
|
+
if (evt.defaultPrevented) return;
|
250
|
+
setInputFocused(true);
|
251
|
+
(_menuPopper$update2 = menuPopper.update) === null || _menuPopper$update2 === void 0 || _menuPopper$update2.call(menuPopper);
|
252
|
+
},
|
253
|
+
onBlur: function onBlur(evt) {
|
254
|
+
_onBlur === null || _onBlur === void 0 || _onBlur(evt);
|
255
|
+
setInputFocused(false);
|
256
|
+
},
|
257
|
+
onKeyDown: function onKeyDown(evt) {
|
258
|
+
if (combobox.isOpen && ["ArrowLeft", "ArrowRight"].includes(evt.key)) {
|
259
|
+
// @ts-expect-error
|
260
|
+
evt.nativeEvent.preventDownshiftDefault = true;
|
261
|
+
}
|
262
|
+
if (multiple && creatable && inputValue.trim().length > 0 && separatorKeys !== null && separatorKeys !== void 0 && separatorKeys.includes(evt.key)) {
|
263
|
+
evt.preventDefault();
|
264
|
+
var _createFromInputValue = createFromInputValue(options, inputValue),
|
265
|
+
_createFromInputValue2 = _slicedToArray(_createFromInputValue, 1),
|
266
|
+
newOption = _createFromInputValue2[0];
|
267
|
+
if (newOption && !newOption.disabled) {
|
268
|
+
multipleSelection.addSelectedItem(newOption);
|
269
|
+
combobox.setInputValue("");
|
270
|
+
}
|
271
|
+
}
|
272
|
+
}
|
273
|
+
}));
|
274
|
+
useEffect(function () {
|
275
|
+
if (!combobox.isOpen) return;
|
276
|
+
if (items.length === 0 && combobox.highlightedIndex >= 0) {
|
277
|
+
combobox.setHighlightedIndex(-1);
|
278
|
+
} else if (items.length > 0 && combobox.highlightedIndex < 0) {
|
279
|
+
combobox.setHighlightedIndex(0);
|
280
|
+
}
|
281
|
+
}, [combobox, items.length]);
|
282
|
+
var shouldRenderCustomTemplate = Boolean(!multiple && !inputFocused && value && renderValueTemplate);
|
283
|
+
var shouldShowDefaultEmptyState = emptyState === undefined && !!inputValue.length;
|
284
|
+
var shouldShowEmptyState = !!emptyState;
|
285
|
+
var hideMenu = !combobox.isOpen || items.length === 0 && !shouldShowEmptyState && !shouldShowDefaultEmptyState;
|
286
|
+
var OptionItem = useMemo(function () {
|
287
|
+
return optionItemComponent !== null && optionItemComponent !== void 0 ? optionItemComponent : function (props) {
|
288
|
+
return /*#__PURE__*/_jsx(DefaultOptionItem, _objectSpread(_objectSpread({}, props), {}, {
|
289
|
+
locale: locale
|
290
|
+
}));
|
291
|
+
};
|
292
|
+
}, [optionItemComponent, locale]);
|
293
|
+
return /*#__PURE__*/_jsx(AutocompleteProvider, {
|
294
|
+
children: /*#__PURE__*/_jsxs("div", {
|
295
|
+
className: cx(stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["flex"]))), className),
|
296
|
+
ref: function ref(el) {
|
297
|
+
setContainerElement(el);
|
298
|
+
// @ts-expect-error
|
299
|
+
setContainerMeasureRef(el);
|
300
|
+
},
|
301
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
302
|
+
className: cx(stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["autocomplete-container"]))), variant === "large" && stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["autocomplete-large py-1"]))), inputFocused && stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["autocomplete-focused"]))), disabled && stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["autocomplete-disabled"]))), status === "invalid" && stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["autocomplete-invalid"]))), noWrap && stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["autocomplete-nowrap"])))),
|
303
|
+
onClick: function onClick() {
|
304
|
+
var _inputRef$current;
|
305
|
+
return (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
338
306
|
},
|
339
|
-
onBlur: _this.handleInputBlur(autocompleteHelpers),
|
340
|
-
onKeyDown: _this.handleKeyDown(autocompleteHelpers),
|
341
|
-
autoComplete: "off",
|
342
|
-
autoFocus: autoFocus
|
343
|
-
});
|
344
|
-
return /*#__PURE__*/_jsxs("div", {
|
345
|
-
className: inputContainerClassName,
|
346
|
-
onClick: _this.handleFakeInputClick,
|
347
|
-
ref: _this.handleInputContainerRefUpdate,
|
348
307
|
children: [Icon && /*#__PURE__*/_jsx(Icon, {
|
349
|
-
className: stl(
|
308
|
+
className: cx(stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["mr-4 shrink-0"]))), stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["", ""])), disabled ? "text-grey-200" : inputFocused ? "text-accent-600" : "text-grey-500")),
|
350
309
|
size: "1rem"
|
351
310
|
}), /*#__PURE__*/_jsxs("div", {
|
352
|
-
className: cx(stl(
|
353
|
-
children: [multiple &&
|
354
|
-
return renderValueTemplate ?
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
311
|
+
className: cx(stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["flex items-center flex-1 max-h-full"]))), !noWrap && stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["flex-wrap overflow-y-scroll no-scrollbar"]))), multiple && stl(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["-ml-1"]))), valuesClassName),
|
312
|
+
children: [multiple && selectedItems.map(function (option, index) {
|
313
|
+
return renderValueTemplate ? /*#__PURE__*/_jsx("span", _objectSpread(_objectSpread({}, multipleSelection.getSelectedItemProps({
|
314
|
+
selectedItem: option,
|
315
|
+
index: index
|
316
|
+
})), {}, {
|
317
|
+
children: renderValueTemplate({
|
318
|
+
option: option,
|
319
|
+
editable: !disabled
|
320
|
+
})
|
321
|
+
}), String(option.value)) : /*#__PURE__*/_jsx(Tag, _objectSpread(_objectSpread({
|
322
|
+
onRemove: disabled ? undefined : function (evt) {
|
323
|
+
evt.stopPropagation();
|
324
|
+
multipleSelection.removeSelectedItem(option);
|
361
325
|
},
|
362
|
-
className: stl(
|
326
|
+
className: stl(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["m-1 max-w-48 ", ""])), disabled && "opacity-50")
|
327
|
+
}, multipleSelection.getSelectedItemProps({
|
328
|
+
selectedItem: option,
|
329
|
+
index: index
|
330
|
+
})), {}, {
|
363
331
|
children: option.label
|
364
|
-
}, String(option.value));
|
332
|
+
}), String(option.value));
|
365
333
|
}), shouldRenderCustomTemplate && renderValueTemplate({
|
366
334
|
option: value,
|
367
|
-
key: String(value),
|
368
335
|
editable: !disabled
|
369
|
-
}), /*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({
|
336
|
+
}), /*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({
|
370
337
|
"data-lpignore": true
|
338
|
+
}, inputProps), {}, {
|
339
|
+
id: id,
|
340
|
+
name: name,
|
341
|
+
type: "text",
|
342
|
+
placeholder: hasValue ? "" : placeholder,
|
343
|
+
autoComplete: "off",
|
344
|
+
className: cx(stl(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["autocomplete-input py-1.5"]))), multiple && stl(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["ml-1"]))), shouldRenderCustomTemplate && hasValue && stl(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["h-0 w-0 opacity-0"]))))
|
371
345
|
}))]
|
372
|
-
}), (showClearButton ||
|
373
|
-
className: cx(showClearButton && endItem && stl(
|
346
|
+
}), Boolean(showClearButton || endItem) && /*#__PURE__*/_jsxs("div", {
|
347
|
+
className: cx(showClearButton && endItem && stl(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["my-2 flex self-end space-x-4"])))),
|
374
348
|
children: [!!endItem && /*#__PURE__*/_jsx("div", {
|
375
|
-
className: stl(
|
349
|
+
className: stl(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["text-grey-700 my-auto"]))),
|
376
350
|
children: endItem
|
377
351
|
}), showClearButton && /*#__PURE__*/_jsx("button", {
|
378
352
|
type: "button",
|
379
|
-
className: stl(
|
380
|
-
onClick:
|
381
|
-
|
353
|
+
className: stl(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["w-6 h-6 flex items-center justify-center text-grey-500"]))),
|
354
|
+
onClick: function onClick(evt) {
|
355
|
+
evt.stopPropagation();
|
356
|
+
combobox.setInputValue("");
|
357
|
+
multipleSelection.setSelectedItems([]);
|
358
|
+
},
|
359
|
+
"aria-label": locale.clearInputButton,
|
382
360
|
children: /*#__PURE__*/_jsx(X, {
|
383
361
|
size: ".75rem"
|
384
362
|
})
|
385
363
|
})]
|
386
364
|
})]
|
387
|
-
})
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
_this$props4$emptySta = _this$props4.emptyState,
|
404
|
-
emptyState = _this$props4$emptySta === void 0 ? defaultEmptyState : _this$props4$emptySta,
|
405
|
-
_this$props4$maxResul = _this$props4.maxResults,
|
406
|
-
maxResults = _this$props4$maxResul === void 0 ? AutoComplete.defaultProps.maxResults : _this$props4$maxResul,
|
407
|
-
_this$props4$multiple = _this$props4.multiple,
|
408
|
-
multiple = _this$props4$multiple === void 0 ? AutoComplete.defaultProps.multiple : _this$props4$multiple,
|
409
|
-
_this$props4$optionIt = _this$props4.optionItemComponent,
|
410
|
-
OptionItem = _this$props4$optionIt === void 0 ? AutoComplete.defaultProps.optionItemComponent : _this$props4$optionIt;
|
411
|
-
var _this$state = _this.state,
|
412
|
-
inputWidth = _this$state.inputWidth,
|
413
|
-
showAllResults = _this$state.showAllResults;
|
414
|
-
var dropdownStyle = inputWidth ? {
|
415
|
-
minWidth: inputWidth,
|
416
|
-
maxWidth: "42vw"
|
417
|
-
} : undefined;
|
418
|
-
var optionItemProps = {
|
419
|
-
multiple: multiple,
|
420
|
-
inputValue: inputValue || ""
|
421
|
-
};
|
422
|
-
var extraResults = results.length - maxResults;
|
423
|
-
var shouldShowDefaultEmptyState = emptyState === defaultEmptyState && results.length === 0 && !!(inputValue !== null && inputValue !== void 0 && inputValue.length);
|
424
|
-
var shouldShowEmptyState = emptyState !== defaultEmptyState && !!emptyState && results.length === 0;
|
425
|
-
var showResults = results.length > 0;
|
426
|
-
if (!isOpen || !showResults && !shouldShowEmptyState && !shouldShowDefaultEmptyState) {
|
427
|
-
return /*#__PURE__*/_jsx("ul", _objectSpread(_objectSpread({}, getMenuProps()), {}, {
|
428
|
-
className: stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["hidden h-0"])))
|
429
|
-
}));
|
430
|
-
}
|
431
|
-
return /*#__PURE__*/_jsx(Popper, {
|
432
|
-
placement: "bottom-start",
|
433
|
-
strategy: "fixed",
|
434
|
-
referenceElement: (_this$inputContainerR3 = _this.inputContainerRef) !== null && _this$inputContainerR3 !== void 0 ? _this$inputContainerR3 : undefined,
|
435
|
-
modifiers: MENU_POPPER_MODFIERS,
|
436
|
-
innerRef: function innerRef(wrapperEl) {
|
437
|
-
return _this.menuWrapperRef = wrapperEl;
|
438
|
-
},
|
439
|
-
children: function children(popper) {
|
440
|
-
var _getMenuProps = getMenuProps({
|
441
|
-
ref: popper.ref
|
442
|
-
}),
|
443
|
-
menuRef = _getMenuProps.ref,
|
444
|
-
menuProps = _objectWithoutProperties(_getMenuProps, _excluded2);
|
445
|
-
return /*#__PURE__*/_jsx(ClickAwayContainer, {
|
446
|
-
element: _this.menuWrapperRef,
|
365
|
+
}), createPortal( /*#__PURE__*/_jsx(ClickAwayContainer, {
|
366
|
+
element: menuRef.current,
|
367
|
+
children: /*#__PURE__*/_jsxs(Card, _objectSpread(_objectSpread({}, menuPopper.attributes), {}, {
|
368
|
+
className: cx(stl(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["z-dropdown"]))), menuClassName),
|
369
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, menuPopper.styles.popper), hideMenu && {
|
370
|
+
display: "none"
|
371
|
+
}), {}, {
|
372
|
+
minWidth: containerWidth,
|
373
|
+
maxWidth: "42vw"
|
374
|
+
}),
|
375
|
+
ref: menuRef,
|
376
|
+
elevation: "300",
|
377
|
+
fullBleed: true,
|
378
|
+
children: [items.length === 0 ? /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, combobox.getMenuProps({
|
379
|
+
className: stl(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["min-h-10"])))
|
380
|
+
})), {}, {
|
447
381
|
children: /*#__PURE__*/_jsx("div", {
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
* anything else:
|
454
|
-
* https://github.com/downshift-js/downshift/blob/3fb0ed21278c5f1d0a077ed9b1d0dfd55a75c71b/src/downshift.js#L951
|
455
|
-
*/
|
456
|
-
ref: menuRef,
|
457
|
-
className: cx(stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["z-dropdown"]))), menuClassName),
|
458
|
-
style: _objectSpread(_objectSpread({}, popper.style), dropdownStyle),
|
459
|
-
"data-popper-placement": popper.placement,
|
460
|
-
children: /*#__PURE__*/_jsxs(Card, {
|
461
|
-
fullBleed: true,
|
462
|
-
elevation: "300",
|
463
|
-
children: [results.length === 0 ? /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, menuProps), {}, {
|
464
|
-
className: stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["min-h-10"]))),
|
465
|
-
children: emptyState
|
466
|
-
})) : /*#__PURE__*/_jsx(ScrollIndicator, {
|
467
|
-
className: menuSize === "large" ? stl(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["max-h-96"]))) : stl(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["max-h-64"]))),
|
468
|
-
children: /*#__PURE__*/_jsxs("ul", _objectSpread(_objectSpread({}, menuProps), {}, {
|
469
|
-
children: [results.slice(0, showAllResults ? Number.MAX_SAFE_INTEGER : maxResults).map(function (result, index) {
|
470
|
-
return /*#__PURE__*/_jsx("li", _objectSpread(_objectSpread({}, getItemProps({
|
471
|
-
item: result,
|
472
|
-
disabled: result.disabled,
|
473
|
-
className: stl(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n autocomplete-result\n flex items-center min-h-10 px-4 cursor-pointer\n ", "\n ", "\n "])), index === highlightedIndex && "bg-grey-100", result.disabled && "cursor-not-allowed")
|
474
|
-
})), {}, {
|
475
|
-
children: /*#__PURE__*/_jsx(OptionItem, _objectSpread(_objectSpread({}, optionItemProps), {}, {
|
476
|
-
highlighted: index === highlightedIndex,
|
477
|
-
option: result,
|
478
|
-
optionItemPrefix: _this.locale.optionItemPrefix
|
479
|
-
}))
|
480
|
-
}), result.value);
|
481
|
-
}), extraResults > 0 && !showAllResults && /*#__PURE__*/_jsx("li", {
|
482
|
-
className: stl(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["p-2 text-right"]))),
|
483
|
-
children: /*#__PURE__*/_jsx(Button, {
|
484
|
-
variant: "subtle",
|
485
|
-
size: "small",
|
486
|
-
onMouseDown: _this.handleShowAllResults,
|
487
|
-
children: _this.locale.showMoreButton(extraResults)
|
488
|
-
})
|
489
|
-
})]
|
490
|
-
}))
|
491
|
-
}), !!menuFooter && /*#__PURE__*/_jsx("footer", {
|
492
|
-
className: stl(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["flex items-center justify-center min-h-12 p-4 bg-grey-100 border-t border-grey-200 text-grey-600"]))),
|
493
|
-
children: menuFooter
|
494
|
-
})]
|
382
|
+
role: "option",
|
383
|
+
"aria-disabled": "true",
|
384
|
+
"aria-selected": "false",
|
385
|
+
children: emptyState !== null && emptyState !== void 0 ? emptyState : /*#__PURE__*/_jsx(AutoCompleteEmptyState, {
|
386
|
+
title: locale.emptyStateTitle
|
495
387
|
})
|
496
388
|
})
|
497
|
-
})
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
// Only interested in updating inputValue from props for now
|
527
|
-
// (which should only happen when this.props.multiple === false)
|
528
|
-
if (this.props.multiple) return;
|
529
|
-
var prevPropsInputValue = inputValueFromProps(prevProps);
|
530
|
-
var propsInputValue = inputValueFromProps(this.props);
|
531
|
-
var shouldUpdateInputValueFromProps = prevPropsInputValue !== propsInputValue && this.state.inputValue !== propsInputValue;
|
532
|
-
if (shouldUpdateInputValueFromProps) {
|
533
|
-
this.setState({
|
534
|
-
inputValue: propsInputValue
|
535
|
-
});
|
536
|
-
}
|
537
|
-
}
|
538
|
-
}, {
|
539
|
-
key: "locale",
|
540
|
-
get: function get() {
|
541
|
-
return _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_AUTOCOMPLETE_LOCALE), this.context["locales"]), this.props.locale);
|
542
|
-
}
|
543
|
-
}, {
|
544
|
-
key: "render",
|
545
|
-
value: function render() {
|
546
|
-
var _this2 = this;
|
547
|
-
var inputValue = (this.props.inputValue !== undefined ? this.props.inputValue : this.state.inputValue) || "";
|
548
|
-
return /*#__PURE__*/_jsx(FieldStateContext.Consumer, {
|
549
|
-
children: function children(fieldState) {
|
550
|
-
return /*#__PURE__*/_jsx(Downshift, {
|
551
|
-
inputValue: inputValue
|
552
|
-
/*
|
553
|
-
* See https://github.com/algolia/AlgoliaWeb/issues/9045
|
554
|
-
* See multi-select example
|
555
|
-
* https://github.com/downshift-js/downshift#examples
|
556
|
-
* https://codesandbox.io/s/github/kentcdodds/downshift-examples/tree/master/?module=/src/ordered-examples/04-multi-select.js&moduleview=1&file=/src/ordered-examples/04-multi-select.js:2482-2509
|
557
|
-
*/,
|
558
|
-
selectedItem: null,
|
559
|
-
getA11yStatusMessage: _this2.getA11yStatusMessage,
|
560
|
-
onChange: _this2.handleChange,
|
561
|
-
itemToString: optionToString,
|
562
|
-
defaultHighlightedIndex: 0,
|
563
|
-
children: function children(autocompleteHelpers) {
|
564
|
-
return _this2.renderSelect(autocompleteHelpers, fieldState);
|
565
|
-
}
|
566
|
-
});
|
567
|
-
}
|
568
|
-
});
|
569
|
-
}
|
570
|
-
}]);
|
571
|
-
return AutoComplete;
|
572
|
-
}(Component);
|
573
|
-
_defineProperty(AutoComplete, "contextType", SatelliteContext);
|
574
|
-
_defineProperty(AutoComplete, "defaultProps", {
|
575
|
-
clearable: false,
|
576
|
-
creatable: false,
|
577
|
-
multiple: false,
|
578
|
-
maxResults: 7,
|
579
|
-
createFromInputValue: defaultCreateFromInputValue,
|
580
|
-
options: [],
|
581
|
-
separatorKeys: [],
|
582
|
-
optionItemComponent: DefaultOption,
|
583
|
-
noWrap: false
|
584
|
-
});
|
389
|
+
})) : /*#__PURE__*/_jsx(ScrollIndicator, {
|
390
|
+
className: menuSize === "large" ? stl(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["max-h-96"]))) : stl(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["max-h-64"]))),
|
391
|
+
children: /*#__PURE__*/_jsx("ul", _objectSpread(_objectSpread({}, combobox.getMenuProps()), {}, {
|
392
|
+
children: items.map(function (item, index) {
|
393
|
+
return /*#__PURE__*/_jsx("li", _objectSpread(_objectSpread({}, combobox.getItemProps({
|
394
|
+
item: item,
|
395
|
+
className: cx(stl(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["autocomplete-result flex items-center min-h-10 px-4 cursor-pointer"]))), index === combobox.highlightedIndex && stl(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["bg-grey-100"]))), item.disabled && stl(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["cursor-not-allowed"]))))
|
396
|
+
})), {}, {
|
397
|
+
children: item.value === SHOW_ALL_ITEMS_ID ? /*#__PURE__*/_jsx("span", {
|
398
|
+
className: stl(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["w-full py-2 truncate text-center text-grey-900"]))),
|
399
|
+
children: item.label
|
400
|
+
}, item.value) : /*#__PURE__*/_jsx(OptionItem, {
|
401
|
+
multiple: Boolean(multiple),
|
402
|
+
inputValue: inputValue,
|
403
|
+
highlighted: index === combobox.highlightedIndex,
|
404
|
+
option: item
|
405
|
+
})
|
406
|
+
}), String(item.value));
|
407
|
+
})
|
408
|
+
}))
|
409
|
+
}), !!menuFooter && /*#__PURE__*/_jsx("footer", {
|
410
|
+
className: stl(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["flex items-center justify-center min-h-12 p-4 bg-grey-100 border-t border-grey-200 text-grey-600"]))),
|
411
|
+
children: menuFooter
|
412
|
+
})]
|
413
|
+
}))
|
414
|
+
}))]
|
415
|
+
})
|
416
|
+
});
|
417
|
+
};
|
585
418
|
export default AutoComplete;
|