periplo-ui 4.23.2 → 4.24.0
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/dist/base.css +254 -0
- package/dist/components/data-display/Avatar/Avatar.js +8 -9
- package/dist/components/data-display/Avatar/Avatar.js.map +1 -1
- package/dist/components/data-display/Avatar/index.js +1 -2
- package/dist/components/data-display/Badge/Badge.d.ts +1 -1
- package/dist/components/data-display/Badge/Badge.js +10 -11
- package/dist/components/data-display/Badge/Badge.js.map +1 -1
- package/dist/components/data-display/Badge/index.js +1 -2
- package/dist/components/data-display/Carousel/Carousel.js +3 -4
- package/dist/components/data-display/Carousel/Carousel.js.map +1 -1
- package/dist/components/data-display/Carousel/index.js +1 -2
- package/dist/components/data-display/Chip/Chip.d.ts +1 -1
- package/dist/components/data-display/Chip/Chip.js +29 -33
- package/dist/components/data-display/Chip/Chip.js.map +1 -1
- package/dist/components/data-display/Chip/index.js +1 -2
- package/dist/components/data-display/DataTable/DataTable.js +11 -10
- package/dist/components/data-display/DataTable/DataTable.js.map +1 -1
- package/dist/components/data-display/DataTable/components/DataTableBody.js +15 -14
- package/dist/components/data-display/DataTable/components/DataTableBody.js.map +1 -1
- package/dist/components/data-display/DataTable/components/DataTableCell.js +2 -3
- package/dist/components/data-display/DataTable/components/DataTableCheckbox.js +2 -3
- package/dist/components/data-display/DataTable/components/DataTableCheckbox.js.map +1 -1
- package/dist/components/data-display/DataTable/components/DataTableColumnHeader.js +4 -5
- package/dist/components/data-display/DataTable/components/DataTableColumnHeader.js.map +1 -1
- package/dist/components/data-display/DataTable/components/DataTableGroupRow.js +8 -8
- package/dist/components/data-display/DataTable/components/DataTableGroupRow.js.map +1 -1
- package/dist/components/data-display/DataTable/components/DataTablePagination.js +9 -10
- package/dist/components/data-display/DataTable/components/DataTablePagination.js.map +1 -1
- package/dist/components/data-display/DataTable/components/DataTableSelectCells.js +1 -2
- package/dist/components/data-display/DataTable/components/DataTableToolbar.js +8 -9
- package/dist/components/data-display/DataTable/components/DataTableToolbar.js.map +1 -1
- package/dist/components/data-display/DataTable/components/DataTableToolbarButton.js +2 -3
- package/dist/components/data-display/DataTable/components/dataTableCellStyles.js +3 -4
- package/dist/components/data-display/DataTable/components/dataTableCellStyles.js.map +1 -1
- package/dist/components/data-display/DataTable/data.js +1 -2
- package/dist/components/data-display/DataTable/hooks/useGroupExpansion.js +1 -2
- package/dist/components/data-display/DataTable/hooks/useSelectColumn.js +1 -2
- package/dist/components/data-display/DataTable/hooks/useSelection.js +1 -2
- package/dist/components/data-display/DataTable/hooks/useSorting.js +1 -2
- package/dist/components/data-display/DataTable/index.js +1 -1
- package/dist/components/data-display/DataTable/utils.js +1 -2
- package/dist/components/data-display/Flag/Flag.js +3 -4
- package/dist/components/data-display/Flag/Flag.js.map +1 -1
- package/dist/components/data-display/Flag/index.js +1 -2
- package/dist/components/data-display/Label/Label.js +2 -3
- package/dist/components/data-display/Label/Label.js.map +1 -1
- package/dist/components/data-display/Label/index.js +1 -2
- package/dist/components/data-display/Marquee/Marquee.js +2 -3
- package/dist/components/data-display/Marquee/Marquee.js.map +1 -1
- package/dist/components/data-display/Marquee/index.js +1 -2
- package/dist/components/data-display/NotificationBadge/NotificationBadge.js +13 -15
- package/dist/components/data-display/NotificationBadge/NotificationBadge.js.map +1 -1
- package/dist/components/data-display/NotificationBadge/index.js +1 -2
- package/dist/components/data-display/Popover/Popover.js +4 -5
- package/dist/components/data-display/Popover/Popover.js.map +1 -1
- package/dist/components/data-display/Popover/index.js +1 -2
- package/dist/components/data-display/Separator/Separator.js +2 -3
- package/dist/components/data-display/Separator/Separator.js.map +1 -1
- package/dist/components/data-display/Separator/index.js +1 -2
- package/dist/components/data-display/Table/Table.js +5 -6
- package/dist/components/data-display/Table/Table.js.map +1 -1
- package/dist/components/data-display/Table/index.js +1 -2
- package/dist/components/data-display/Tooltip/Tooltip.js +22 -6
- package/dist/components/data-display/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/data-display/Tooltip/index.js +1 -2
- package/dist/components/data-display/TruncatedTypographyWithTooltip/TruncatedTypographyWithTooltip.js +2 -3
- package/dist/components/data-display/TruncatedTypographyWithTooltip/index.js +1 -2
- package/dist/components/data-display/Typography/Typography.d.ts +4 -4
- package/dist/components/data-display/Typography/Typography.js +27 -31
- package/dist/components/data-display/Typography/Typography.js.map +1 -1
- package/dist/components/data-display/Typography/index.js +1 -2
- package/dist/components/feedback/Dialog/Dialog.js +8 -9
- package/dist/components/feedback/Dialog/Dialog.js.map +1 -1
- package/dist/components/feedback/Dialog/index.js +1 -2
- package/dist/components/feedback/Progress/Progress.d.ts +2 -2
- package/dist/components/feedback/Progress/Progress.js +7 -8
- package/dist/components/feedback/Progress/Progress.js.map +1 -1
- package/dist/components/feedback/Progress/hooks/useFakeProgress.js +1 -2
- package/dist/components/feedback/Progress/index.js +1 -2
- package/dist/components/feedback/Skeleton/Skeleton.js +2 -3
- package/dist/components/feedback/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/feedback/Skeleton/index.js +1 -2
- package/dist/components/feedback/Toaster/Toaster.js +11 -12
- package/dist/components/feedback/Toaster/Toaster.js.map +1 -1
- package/dist/components/feedback/Toaster/index.js +1 -2
- package/dist/components/inputs/Button/Button.d.ts +1 -1
- package/dist/components/inputs/Button/Button.js +62 -58
- package/dist/components/inputs/Button/Button.js.map +1 -1
- package/dist/components/inputs/Button/index.js +1 -2
- package/dist/components/inputs/Calendar/Calendar.js +38 -36
- package/dist/components/inputs/Calendar/Calendar.js.map +1 -1
- package/dist/components/inputs/Calendar/index.js +1 -2
- package/dist/components/inputs/Checkbox/Checkbox.js +14 -13
- package/dist/components/inputs/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/inputs/Checkbox/index.js +1 -2
- package/dist/components/inputs/Combobox/Combobox.d.ts +1 -1
- package/dist/components/inputs/Combobox/Combobox.js +6 -6
- package/dist/components/inputs/Combobox/Combobox.js.map +1 -1
- package/dist/components/inputs/Combobox/ComboboxOptionWithTooltip.js +1 -2
- package/dist/components/inputs/Combobox/ComboboxTrigger.js +7 -5
- package/dist/components/inputs/Combobox/ComboboxTrigger.js.map +1 -1
- package/dist/components/inputs/Combobox/StaticComboboxList.js +10 -22
- package/dist/components/inputs/Combobox/StaticComboboxList.js.map +1 -1
- package/dist/components/inputs/Combobox/VirtualizedComboboxList.js +6 -7
- package/dist/components/inputs/Combobox/VirtualizedComboboxList.js.map +1 -1
- package/dist/components/inputs/Combobox/hooks/index.js +1 -1
- package/dist/components/inputs/Combobox/hooks/useComboboxOpenState.js +1 -2
- package/dist/components/inputs/Combobox/hooks/useComboboxSelection.js +1 -2
- package/dist/components/inputs/Combobox/hooks/useDebouncedState.js +5 -6
- package/dist/components/inputs/Combobox/hooks/useDebouncedState.js.map +1 -1
- package/dist/components/inputs/Combobox/hooks/useDisplayValue.js +1 -2
- package/dist/components/inputs/Combobox/index.js +1 -1
- package/dist/components/inputs/Combobox/types.d.ts +1 -1
- package/dist/components/inputs/Combobox/useCombobox.js +1 -2
- package/dist/components/inputs/Command/Command.js +25 -21
- package/dist/components/inputs/Command/Command.js.map +1 -1
- package/dist/components/inputs/Command/index.js +1 -2
- package/dist/components/inputs/CountrySelect/CountrySelect.js +7 -9
- package/dist/components/inputs/CountrySelect/CountrySelect.js.map +1 -1
- package/dist/components/inputs/CountrySelect/index.js +1 -2
- package/dist/components/inputs/DatePicker/DatePicker.js +7 -8
- package/dist/components/inputs/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/inputs/DatePicker/hooks/useLocale.js +1 -2
- package/dist/components/inputs/DatePicker/index.js +1 -2
- package/dist/components/inputs/Field/Field.js +15 -13
- package/dist/components/inputs/Field/Field.js.map +1 -1
- package/dist/components/inputs/Field/index.js +1 -2
- package/dist/components/inputs/Form/Form.d.ts +1 -1
- package/dist/components/inputs/Form/Form.js +5 -6
- package/dist/components/inputs/Form/Form.js.map +1 -1
- package/dist/components/inputs/Form/Page.js +1 -2
- package/dist/components/inputs/Form/index.js +1 -2
- package/dist/components/inputs/InlineMultiSelect/InlineMultiSelect.d.ts +7 -1
- package/dist/components/inputs/InlineMultiSelect/InlineMultiSelect.js +80 -29
- package/dist/components/inputs/InlineMultiSelect/InlineMultiSelect.js.map +1 -1
- package/dist/components/inputs/InlineMultiSelect/index.js +1 -2
- package/dist/components/inputs/Input/Input.js +22 -15
- package/dist/components/inputs/Input/Input.js.map +1 -1
- package/dist/components/inputs/Input/index.js +1 -2
- package/dist/components/inputs/InputDate/InputDate.js +16 -17
- package/dist/components/inputs/InputDate/InputDate.js.map +1 -1
- package/dist/components/inputs/InputDate/index.js +1 -2
- package/dist/components/inputs/InputOTP/InputOTP.js +5 -6
- package/dist/components/inputs/InputOTP/InputOTP.js.map +1 -1
- package/dist/components/inputs/InputOTP/index.js +1 -2
- package/dist/components/inputs/LazyDatePicker/LazyDatePicker.js +14 -14
- package/dist/components/inputs/LazyDatePicker/LazyDatePicker.js.map +1 -1
- package/dist/components/inputs/LazyDatePicker/index.js +1 -2
- package/dist/components/inputs/MultiSelect/MultiSelect.js +9 -14
- package/dist/components/inputs/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/inputs/MultiSelect/Page.js +1 -2
- package/dist/components/inputs/MultiSelect/index.js +1 -2
- package/dist/components/inputs/PhoneInput/PhoneInput.js +18 -21
- package/dist/components/inputs/PhoneInput/PhoneInput.js.map +1 -1
- package/dist/components/inputs/PhoneInput/hooks/index.js +1 -2
- package/dist/components/inputs/PhoneInput/hooks/usePhoneField.js +7 -8
- package/dist/components/inputs/PhoneInput/hooks/usePhoneField.js.map +1 -1
- package/dist/components/inputs/PhoneInput/index.js +1 -1
- package/dist/components/inputs/PhoneInput/phone.js +1 -2
- package/dist/components/inputs/RadioGroup/Page.js +1 -2
- package/dist/components/inputs/RadioGroup/RadioGroup.js +14 -14
- package/dist/components/inputs/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/inputs/RadioGroup/index.js +1 -2
- package/dist/components/inputs/Select/Select.js +22 -21
- package/dist/components/inputs/Select/Select.js.map +1 -1
- package/dist/components/inputs/Select/index.js +1 -2
- package/dist/components/inputs/StarRating/StarRating.js +10 -11
- package/dist/components/inputs/StarRating/StarRating.js.map +1 -1
- package/dist/components/inputs/StarRating/index.js +1 -2
- package/dist/components/inputs/Textarea/Textarea.js +11 -11
- package/dist/components/inputs/Textarea/Textarea.js.map +1 -1
- package/dist/components/inputs/Textarea/index.js +1 -2
- package/dist/components/inputs/Toggle/Toggle.js +19 -15
- package/dist/components/inputs/Toggle/Toggle.js.map +1 -1
- package/dist/components/inputs/Toggle/index.js +1 -2
- package/dist/components/inputs/ToggleGroup/ToggleGroup.js +2 -3
- package/dist/components/inputs/ToggleGroup/index.js +1 -2
- package/dist/components/inputs/shared/ClearButton.js +9 -10
- package/dist/components/inputs/shared/ClearButton.js.map +1 -1
- package/dist/components/inputs/shared/InputGroup.js +15 -12
- package/dist/components/inputs/shared/InputGroup.js.map +1 -1
- package/dist/components/inputs/shared/calendarDayContext.js +1 -2
- package/dist/components/inputs/shared/fieldInvalid.js +1 -2
- package/dist/components/navigation/Breadcrumb/Breadcrumb.js +8 -9
- package/dist/components/navigation/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/navigation/Breadcrumb/index.js +1 -2
- package/dist/components/navigation/DropdownMenu/DropdownMenu.js +31 -35
- package/dist/components/navigation/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/navigation/DropdownMenu/index.js +1 -2
- package/dist/components/navigation/Pagination/Pagination.js +6 -7
- package/dist/components/navigation/Pagination/Pagination.js.map +1 -1
- package/dist/components/navigation/Pagination/index.js +1 -2
- package/dist/components/navigation/Sheet/Sheet.js +9 -12
- package/dist/components/navigation/Sheet/Sheet.js.map +1 -1
- package/dist/components/navigation/Sheet/index.js +1 -2
- package/dist/components/navigation/Sidebar/Sidebar.d.ts +2 -2
- package/dist/components/navigation/Sidebar/Sidebar.js +30 -31
- package/dist/components/navigation/Sidebar/Sidebar.js.map +1 -1
- package/dist/components/navigation/Sidebar/SidebarMenu.d.ts +5 -5
- package/dist/components/navigation/Sidebar/SidebarMenu.js +46 -53
- package/dist/components/navigation/Sidebar/SidebarMenu.js.map +1 -1
- package/dist/components/navigation/Sidebar/SidebarPage.js +9 -10
- package/dist/components/navigation/Sidebar/SidebarPage.js.map +1 -1
- package/dist/components/navigation/Sidebar/SidebarUser.js +23 -25
- package/dist/components/navigation/Sidebar/SidebarUser.js.map +1 -1
- package/dist/components/navigation/Sidebar/context.js +1 -2
- package/dist/components/navigation/Sidebar/index.js +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +21 -7
- package/dist/components/navigation/Tabs/Tabs.js.map +1 -1
- package/dist/components/navigation/Tabs/index.js +1 -2
- package/dist/components/shared/CloseButton.js +1 -2
- package/dist/components/shared/OptionCheck.d.ts +14 -0
- package/dist/components/shared/OptionCheck.js +22 -0
- package/dist/components/shared/OptionCheck.js.map +1 -0
- package/dist/components/shared/Spinner.d.ts +7 -0
- package/dist/components/shared/Spinner.js +19 -0
- package/dist/components/shared/Spinner.js.map +1 -0
- package/dist/components/shared/index.d.ts +2 -0
- package/dist/components/shared/index.js +3 -1
- package/dist/components/surface/Accordion/Accordion.js +5 -6
- package/dist/components/surface/Accordion/Accordion.js.map +1 -1
- package/dist/components/surface/Accordion/index.js +1 -2
- package/dist/components/surface/Card/Card.js +2 -3
- package/dist/components/surface/Card/Card.js.map +1 -1
- package/dist/components/surface/Card/index.js +1 -2
- package/dist/components/surface/Collapsible/Collapsible.js +1 -2
- package/dist/components/surface/Collapsible/index.js +1 -2
- package/dist/foundations/shared.d.ts +22 -0
- package/dist/foundations/shared.js +63 -0
- package/dist/foundations/shared.js.map +1 -0
- package/dist/lib/countries.js +1 -2
- package/dist/lib/dateUtils.js +1 -2
- package/dist/lib/flagSvg.js +1 -2
- package/dist/lib/inputModality.js +1 -2
- package/dist/lib/marquee.js +1 -2
- package/dist/lib/useListScroll.js +1 -2
- package/dist/lib/useLocale.js +1 -2
- package/dist/lib/useMobile.js +1 -2
- package/dist/lib/useSlidingIndicator.js +1 -2
- package/dist/lib/useTouchDevice.js +1 -2
- package/dist/lib/utils.js +66 -3
- package/dist/lib/utils.js.map +1 -1
- package/dist/node_modules/country-flag-icons/3x2/AC.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AD.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AF.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AI.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AL.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AQ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AS.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AT.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AU.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AW.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AX.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/AZ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BB.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BD.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BF.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BH.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BI.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BJ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BL.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BN.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BQ-BO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BQ-SA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BQ-SE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BQ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BS.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BT.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BV.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BW.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BY.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/BZ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CC.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CD.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CF.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CH.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CI.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CK.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CL.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CN.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CU.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CV.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CW.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CX.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CY.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/CZ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/DE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/DJ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/DK.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/DM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/DO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/DZ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/EC.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/EE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/EG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/EH.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/ER.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/ES-CT.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/ES.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/ET.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/EU.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/FI.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/FJ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/FK.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/FM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/FO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/FR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GB-ENG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GB-NIR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GB-SCT.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GB-WLS.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GB.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GD.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GF.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GH.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GI.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GL.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GN.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GP.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GQ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GS.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GT.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GU.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GW.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/GY.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/HK.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/HM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/HN.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/HR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/HT.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/HU.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/IC.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/ID.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/IE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/IL.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/IM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/IN.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/IO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/IQ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/IR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/IS.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/IT.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/JE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/JM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/JO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/JP.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/KE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/KG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/KH.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/KI.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/KM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/KN.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/KP.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/KR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/KW.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/KY.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/KZ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/LA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/LB.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/LC.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/LI.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/LK.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/LR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/LS.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/LT.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/LU.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/LV.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/LY.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MC.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MD.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/ME.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MF.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MH.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MK.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/ML.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MN.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MP.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MQ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MS.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MT.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MU.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MV.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MW.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MX.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MY.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/MZ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/NA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/NC.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/NE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/NF.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/NG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/NI.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/NL.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/NO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/NP.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/NR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/NU.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/NZ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/OM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PF.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PH.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PK.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PL.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PN.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PS.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PT.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PW.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/PY.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/QA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/RE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/RO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/RS.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/RU.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/RW.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SB.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SC.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SD.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SH.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SI.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SJ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SK.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SL.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SN.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SS.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/ST.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SV.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SX.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SY.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/SZ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TC.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TD.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TF.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TH.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TJ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TK.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TL.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TN.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TR.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TT.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TV.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TW.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/TZ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/UA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/UG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/UM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/US.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/UY.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/UZ.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/VA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/VC.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/VE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/VG.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/VI.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/VN.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/VU.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/WF.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/WS.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/XA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/XC.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/XK.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/XO.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/YE.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/YT.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/ZA.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/ZM.js +1 -2
- package/dist/node_modules/country-flag-icons/3x2/ZW.js +1 -2
- package/dist/theme.css +3 -336
- package/dist/tokens.css +491 -0
- package/dist/utilities.css +642 -0
- package/package.json +86 -85
- package/dist/theme/control.css +0 -94
- package/dist/theme/fade-text.css +0 -7
- package/dist/theme/hit-area.css +0 -42
- package/dist/theme/motion.css +0 -3
- package/dist/theme/press.css +0 -22
- package/dist/theme/scrollbar.css +0 -3
- package/dist/theme/sliding-indicator.css +0 -7
- package/dist/theme/sticky-column.css +0 -11
- package/dist/theme/surface.css +0 -18
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { OptionCheck } from "../../shared/OptionCheck.js";
|
|
1
2
|
import { Checkbox } from "../Checkbox/Checkbox.js";
|
|
2
3
|
import { CommandEmpty, CommandGroup, CommandItem, CommandList, CommandSeparator } from "../Command/Command.js";
|
|
3
4
|
import { ComboboxOptionWithTooltip } from "./ComboboxOptionWithTooltip.js";
|
|
4
5
|
import { useMemo } from "react";
|
|
5
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
//#region src/components/inputs/Combobox/StaticComboboxList.tsx
|
|
7
|
+
// src/components/inputs/Combobox/StaticComboboxList.tsx
|
|
8
8
|
var StaticComboboxList = ({ filteredOptions, loading, loadingPlaceholder, emptyMessage, multiple, value, getOptionValue, getOptionLabel, handleSelect, renderOption, maxHeight, selectedMultiplePlaceholder, multipleOptionsPlaceholder, options, specialOptions, specialOptionsTitle, listRef }) => {
|
|
9
9
|
const isArrayValue = Array.isArray(value);
|
|
10
10
|
const selectedValues = useMemo(() => multiple && isArrayValue ? value : [], [
|
|
@@ -47,35 +47,24 @@ var StaticComboboxList = ({ filteredOptions, loading, loadingPlaceholder, emptyM
|
|
|
47
47
|
const renderListOption = (option) => {
|
|
48
48
|
const optionValue = getOptionValue(option);
|
|
49
49
|
const selected = isOptionSelected(optionValue);
|
|
50
|
-
const renderSelectionIndicator = () => {
|
|
51
|
-
if (multiple) return /* @__PURE__ */ jsx(Checkbox, {
|
|
52
|
-
checked: selected,
|
|
53
|
-
tabIndex: -1,
|
|
54
|
-
"aria-hidden": true,
|
|
55
|
-
className: "pointer-events-none mr-2 shrink-0"
|
|
56
|
-
});
|
|
57
|
-
return /* @__PURE__ */ jsx("span", {
|
|
58
|
-
"aria-hidden": true,
|
|
59
|
-
className: "mr-1 flex h-6! w-6! shrink-0 items-center justify-end",
|
|
60
|
-
children: selected && /* @__PURE__ */ jsx(CheckIcon, {
|
|
61
|
-
weight: "bold",
|
|
62
|
-
className: "h-4! w-4!"
|
|
63
|
-
})
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
50
|
return /* @__PURE__ */ jsx(CommandItem, {
|
|
67
51
|
value: optionValue,
|
|
68
52
|
onSelect: handleSelect,
|
|
69
|
-
children: renderOption ? renderOption(option, selected) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53
|
+
children: renderOption ? renderOption(option, selected) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ComboboxOptionWithTooltip, { label: getOptionLabel(option) }), multiple ? /* @__PURE__ */ jsx(Checkbox, {
|
|
54
|
+
checked: selected,
|
|
55
|
+
tabIndex: -1,
|
|
56
|
+
"aria-hidden": true,
|
|
57
|
+
className: "pointer-events-none ml-auto shrink-0"
|
|
58
|
+
}) : /* @__PURE__ */ jsx(OptionCheck, { selected })] })
|
|
70
59
|
}, optionValue);
|
|
71
60
|
};
|
|
72
61
|
return /* @__PURE__ */ jsx(CommandList, {
|
|
73
62
|
ref: listRef,
|
|
74
63
|
style: { maxHeight },
|
|
75
|
-
className: "scrollbar-subtle overflow-auto overscroll-contain",
|
|
64
|
+
className: "\n scroll-fade scroll-py-(--control-option-height,max(var(--control-height-md),var(--control-touch-height)))\n scrollbar-subtle overflow-auto overscroll-contain\n ",
|
|
76
65
|
onWheel: (event) => event.stopPropagation(),
|
|
77
66
|
children: loading ? /* @__PURE__ */ jsx("div", {
|
|
78
|
-
className: "flex items-center justify-center py-6 text-
|
|
67
|
+
className: "flex items-center justify-center py-6 text-body-md text-tertiary",
|
|
79
68
|
children: loadingPlaceholder
|
|
80
69
|
}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
81
70
|
filteredOptions.length === 0 && regularOptions.length === 0 && (!specialOptions || specialOptions.length === 0) && /* @__PURE__ */ jsx(CommandEmpty, { children: emptyMessage }),
|
|
@@ -94,7 +83,6 @@ var StaticComboboxList = ({ filteredOptions, loading, loadingPlaceholder, emptyM
|
|
|
94
83
|
] })
|
|
95
84
|
});
|
|
96
85
|
};
|
|
97
|
-
//#endregion
|
|
98
86
|
export { StaticComboboxList };
|
|
99
87
|
|
|
100
88
|
//# sourceMappingURL=StaticComboboxList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticComboboxList.js","names":["_Fragment"],"sources":["../../../../src/components/inputs/Combobox/StaticComboboxList.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"StaticComboboxList.js","names":["_Fragment"],"sources":["../../../../src/components/inputs/Combobox/StaticComboboxList.tsx"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { OptionCheck } from '../../shared'\nimport { Checkbox } from '../Checkbox'\nimport { CommandEmpty, CommandGroup, CommandItem, CommandList, CommandSeparator } from '../Command'\n\nimport { ComboboxOptionWithTooltip } from './ComboboxOptionWithTooltip'\nimport type { StaticComboboxListProps } from './types'\n\nexport const StaticComboboxList = <T extends object>({\n filteredOptions,\n loading,\n loadingPlaceholder,\n emptyMessage,\n multiple,\n value,\n getOptionValue,\n getOptionLabel,\n handleSelect,\n renderOption,\n maxHeight,\n selectedMultiplePlaceholder,\n multipleOptionsPlaceholder,\n options,\n specialOptions,\n specialOptionsTitle,\n listRef,\n}: Readonly<StaticComboboxListProps<T>>) => {\n const isArrayValue = Array.isArray(value)\n const selectedValues = useMemo(() => (multiple && isArrayValue ? value : []), [multiple, isArrayValue, value])\n\n const isOptionSelected = (optionValue: string) =>\n multiple ? selectedValues.includes(optionValue) : value === optionValue\n\n const regularOptions = useMemo(() => {\n return filteredOptions.filter(\n (option) => !specialOptions?.some((special) => getOptionValue(special) === getOptionValue(option)),\n )\n }, [filteredOptions, specialOptions, getOptionValue])\n\n const regularSelectedOptions = useMemo(() => {\n if (!multiple || !isArrayValue) return []\n\n return options.filter(\n (option) =>\n selectedValues.includes(getOptionValue(option)) &&\n !specialOptions?.some((special) => getOptionValue(special) === getOptionValue(option)),\n )\n }, [options, selectedValues, specialOptions, getOptionValue, multiple, isArrayValue])\n\n const optionsToShow = useMemo(() => {\n if (specialOptions) return regularOptions\n\n if (!multiple || !isArrayValue) return regularOptions\n\n return regularOptions.filter((option) => !selectedValues.includes(getOptionValue(option)))\n }, [regularOptions, specialOptions, selectedValues, getOptionValue, multiple, isArrayValue])\n\n const groupHeading = !specialOptions && multiple ? multipleOptionsPlaceholder : undefined\n\n const renderListOption = (option: T) => {\n const optionValue = getOptionValue(option)\n const selected = isOptionSelected(optionValue)\n\n return (\n <CommandItem key={optionValue} value={optionValue} onSelect={handleSelect}>\n {renderOption ? (\n renderOption(option, selected)\n ) : (\n <>\n <ComboboxOptionWithTooltip label={getOptionLabel(option)} />\n {multiple ? (\n <Checkbox checked={selected} tabIndex={-1} aria-hidden className=\"pointer-events-none ml-auto shrink-0\" />\n ) : (\n <OptionCheck selected={selected} />\n )}\n </>\n )}\n </CommandItem>\n )\n }\n\n return (\n <CommandList\n ref={listRef}\n style={{ maxHeight }}\n className=\"\n scroll-fade scroll-py-(--control-option-height,max(var(--control-height-md),var(--control-touch-height)))\n scrollbar-subtle overflow-auto overscroll-contain\n \"\n onWheel={(event) => event.stopPropagation()}\n >\n {loading ? (\n <div className=\"flex items-center justify-center py-6 text-body-md text-tertiary\">{loadingPlaceholder}</div>\n ) : (\n <>\n {filteredOptions.length === 0 &&\n regularOptions.length === 0 &&\n (!specialOptions || specialOptions.length === 0) && <CommandEmpty>{emptyMessage}</CommandEmpty>}\n\n {specialOptions?.length ? (\n <>\n <CommandGroup heading={specialOptionsTitle}>{specialOptions.map(renderListOption)}</CommandGroup>\n\n {optionsToShow.length > 0 && <CommandSeparator className=\"mx-1\" />}\n </>\n ) : null}\n\n {!specialOptions && multiple && isArrayValue && regularSelectedOptions.length > 0 && (\n <CommandGroup heading={selectedMultiplePlaceholder}>\n {regularSelectedOptions.map(renderListOption)}\n </CommandGroup>\n )}\n\n {optionsToShow.length > 0 && (\n <CommandGroup heading={groupHeading}>{optionsToShow.map(renderListOption)}</CommandGroup>\n )}\n </>\n )}\n </CommandList>\n )\n}\n"],"mappings":";;;;;;;AASA,IAAa,sBAAwC,EACnD,iBACA,SACA,oBACA,cACA,UACA,OACA,gBACA,gBACA,cACA,cACA,WACA,6BACA,4BACA,SACA,gBACA,qBACA,cAC0C;CAC1C,MAAM,eAAe,MAAM,QAAQ,KAAK;CACxC,MAAM,iBAAiB,cAAe,YAAY,eAAe,QAAQ,CAAC,GAAI;EAAC;EAAU;EAAc;CAAK,CAAC;CAE7G,MAAM,oBAAoB,gBACxB,WAAW,eAAe,SAAS,WAAW,IAAI,UAAU;CAE9D,MAAM,iBAAiB,cAAc;EACnC,OAAO,gBAAgB,QACpB,WAAW,CAAC,gBAAgB,MAAM,YAAY,eAAe,OAAO,MAAM,eAAe,MAAM,CAAC,CACnG;CACF,GAAG;EAAC;EAAiB;EAAgB;CAAc,CAAC;CAEpD,MAAM,yBAAyB,cAAc;EAC3C,IAAI,CAAC,YAAY,CAAC,cAAc,OAAO,CAAC;EAExC,OAAO,QAAQ,QACZ,WACC,eAAe,SAAS,eAAe,MAAM,CAAC,KAC9C,CAAC,gBAAgB,MAAM,YAAY,eAAe,OAAO,MAAM,eAAe,MAAM,CAAC,CACzF;CACF,GAAG;EAAC;EAAS;EAAgB;EAAgB;EAAgB;EAAU;CAAY,CAAC;CAEpF,MAAM,gBAAgB,cAAc;EAClC,IAAI,gBAAgB,OAAO;EAE3B,IAAI,CAAC,YAAY,CAAC,cAAc,OAAO;EAEvC,OAAO,eAAe,QAAQ,WAAW,CAAC,eAAe,SAAS,eAAe,MAAM,CAAC,CAAC;CAC3F,GAAG;EAAC;EAAgB;EAAgB;EAAgB;EAAgB;EAAU;CAAY,CAAC;CAE3F,MAAM,eAAe,CAAC,kBAAkB,WAAW,6BAA6B,KAAA;CAEhF,MAAM,oBAAoB,WAAc;EACtC,MAAM,cAAc,eAAe,MAAM;EACzC,MAAM,WAAW,iBAAiB,WAAW;EAE7C,OACE,oBAAC,aAAD;GAA+B,OAAO;GAAa,UAAU;GAC1D,UAAA,eACC,aAAa,QAAQ,QAAQ,IAE7B,qBAAAA,UAAA,EAAA,UAAA,CACE,oBAAC,2BAAD,EAA2B,OAAO,eAAe,MAAM,EAAI,CAAA,GAC1D,WACC,oBAAC,UAAD;IAAU,SAAS;IAAU,UAAU;IAAI,eAAA;IAAY,WAAU;GAAwC,CAAA,IAEzG,oBAAC,aAAD,EAAuB,SAAW,CAAA,CAEpC,EAAA,CAAA;EAEO,GAbK,WAaL;CAEjB;CAEA,OACE,oBAAC,aAAD;EACE,KAAK;EACL,OAAO,EAAE,UAAU;EACnB,WAAU;EAIV,UAAU,UAAU,MAAM,gBAAgB;EAEzC,UAAA,UACC,oBAAC,OAAD;GAAK,WAAU;GAAoE,UAAA;EAAwB,CAAA,IAE3G,qBAAAA,UAAA,EAAA,UAAA;GACG,gBAAgB,WAAW,KAC1B,eAAe,WAAW,MACzB,CAAC,kBAAkB,eAAe,WAAW,MAAM,oBAAC,cAAD,EAAA,UAAe,aAA2B,CAAA;GAE/F,gBAAgB,SACf,qBAAAA,UAAA,EAAA,UAAA,CACE,oBAAC,cAAD;IAAc,SAAS;IAAsB,UAAA,eAAe,IAAI,gBAAgB;GAAgB,CAAA,GAE/F,cAAc,SAAS,KAAK,oBAAC,kBAAD,EAAkB,WAAU,OAAQ,CAAA,CACjE,EAAA,CAAA,IACA;GAEH,CAAC,kBAAkB,YAAY,gBAAgB,uBAAuB,SAAS,KAC9E,oBAAC,cAAD;IAAc,SAAS;IACpB,UAAA,uBAAuB,IAAI,gBAAgB;GAChC,CAAA;GAGf,cAAc,SAAS,KACtB,oBAAC,cAAD;IAAc,SAAS;IAAe,UAAA,cAAc,IAAI,gBAAgB;GAAgB,CAAA;EAE1F,EAAA,CAAA;CAEO,CAAA;AAEjB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { OptionCheck } from "../../shared/OptionCheck.js";
|
|
1
2
|
import { CommandEmpty, CommandGroup, CommandItem, CommandList, CommandSeparator } from "../Command/Command.js";
|
|
2
3
|
import { ComboboxOptionWithTooltip } from "./ComboboxOptionWithTooltip.js";
|
|
3
4
|
import { useEffect, useRef, useState } from "react";
|
|
4
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { CheckIcon } from "@phosphor-icons/react/dist/ssr/Check";
|
|
6
6
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
7
|
-
|
|
7
|
+
// src/components/inputs/Combobox/VirtualizedComboboxList.tsx
|
|
8
8
|
var DEFAULT_ESTIMATED_ROW_HEIGHT = 40;
|
|
9
9
|
var VirtualizedComboboxList = ({ localOptions, loading, loadingPlaceholder, emptyMessage, value, getOptionValue, getOptionLabel, handleSelect, renderOption, maxHeight, hasNextPage = false, loadingMore = false, onLoadMore = () => {}, estimateSize = DEFAULT_ESTIMATED_ROW_HEIGHT, listRef, specialOptions, specialOptionsTitle }) => {
|
|
10
10
|
const ownRef = useRef(null);
|
|
@@ -59,7 +59,7 @@ var VirtualizedComboboxList = ({ localOptions, loading, loadingPlaceholder, empt
|
|
|
59
59
|
onLoadMore
|
|
60
60
|
]);
|
|
61
61
|
if (loading && localOptions.length === 0) return /* @__PURE__ */ jsx("div", {
|
|
62
|
-
className: "flex items-center justify-center py-6 text-
|
|
62
|
+
className: "flex items-center justify-center py-6 text-body-md text-tertiary",
|
|
63
63
|
children: loadingPlaceholder
|
|
64
64
|
});
|
|
65
65
|
if (localOptions.length === 0 && !specialOptions?.length && !loading && !loadingMore) return /* @__PURE__ */ jsx(CommandEmpty, { children: emptyMessage });
|
|
@@ -70,12 +70,12 @@ var VirtualizedComboboxList = ({ localOptions, loading, loadingPlaceholder, empt
|
|
|
70
70
|
value: optionValue,
|
|
71
71
|
"data-checked": isSelected || void 0,
|
|
72
72
|
onSelect: handleSelect,
|
|
73
|
-
children: renderOption ? renderOption(option, isSelected) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(
|
|
73
|
+
children: renderOption ? renderOption(option, isSelected) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ComboboxOptionWithTooltip, { label: getOptionLabel(option) }), /* @__PURE__ */ jsx(OptionCheck, {})] })
|
|
74
74
|
}, optionValue);
|
|
75
75
|
};
|
|
76
76
|
return /* @__PURE__ */ jsxs(CommandList, {
|
|
77
77
|
ref: parentRef,
|
|
78
|
-
className: "scrollbar-subtle overflow-auto overscroll-contain",
|
|
78
|
+
className: "\n scroll-fade scroll-py-(--control-option-height,max(var(--control-height-md),var(--control-touch-height)))\n scrollbar-subtle overflow-auto overscroll-contain\n ",
|
|
79
79
|
style: { maxHeight },
|
|
80
80
|
onWheel: (event) => event.stopPropagation(),
|
|
81
81
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -103,12 +103,11 @@ var VirtualizedComboboxList = ({ localOptions, loading, loadingPlaceholder, empt
|
|
|
103
103
|
children: renderOptionRow(localOptions[virtualRow.index])
|
|
104
104
|
}, getOptionValue(localOptions[virtualRow.index])))]
|
|
105
105
|
}), loadingMore && /* @__PURE__ */ jsx("div", {
|
|
106
|
-
className: "flex items-center justify-center py-2 text-
|
|
106
|
+
className: "flex items-center justify-center py-2 text-body-md text-tertiary",
|
|
107
107
|
children: loadingPlaceholder
|
|
108
108
|
})]
|
|
109
109
|
});
|
|
110
110
|
};
|
|
111
|
-
//#endregion
|
|
112
111
|
export { VirtualizedComboboxList };
|
|
113
112
|
|
|
114
113
|
//# sourceMappingURL=VirtualizedComboboxList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedComboboxList.js","names":["_Fragment"],"sources":["../../../../src/components/inputs/Combobox/VirtualizedComboboxList.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"VirtualizedComboboxList.js","names":["_Fragment"],"sources":["../../../../src/components/inputs/Combobox/VirtualizedComboboxList.tsx"],"sourcesContent":["import { useVirtualizer } from '@tanstack/react-virtual'\nimport { useRef, useEffect, useState } from 'react'\n\nimport { OptionCheck } from '../../shared'\nimport { CommandEmpty, CommandGroup, CommandItem, CommandList, CommandSeparator } from '../Command'\n\nimport { ComboboxOptionWithTooltip } from './ComboboxOptionWithTooltip'\nimport type { VirtualizedComboboxListProps } from './types'\n\nconst DEFAULT_ESTIMATED_ROW_HEIGHT = 40\n\nexport const VirtualizedComboboxList = <T extends object>({\n localOptions,\n loading,\n loadingPlaceholder,\n emptyMessage,\n value,\n getOptionValue,\n getOptionLabel,\n handleSelect,\n renderOption,\n maxHeight,\n hasNextPage = false,\n loadingMore = false,\n onLoadMore = () => {},\n estimateSize = DEFAULT_ESTIMATED_ROW_HEIGHT,\n listRef,\n specialOptions,\n specialOptionsTitle,\n}: Readonly<VirtualizedComboboxListProps<T>>) => {\n const ownRef = useRef<HTMLDivElement>(null)\n const parentRef = listRef ?? ownRef\n const hasTriggeredRef = useRef(false)\n\n const totalCount = localOptions.length\n const PREFETCH_THRESHOLD = 25\n\n // scrollMargin accounts for the special group's height so scrollToIndex still centers correctly.\n const specialGroupRef = useRef<HTMLDivElement>(null)\n const [specialGroupHeight, setSpecialGroupHeight] = useState(0)\n useEffect(() => {\n setSpecialGroupHeight(specialGroupRef.current?.offsetHeight ?? 0)\n }, [specialOptions])\n\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack returns functions the React Compiler can't memoize, so it skips this component either way\n const rowVirtualizer = useVirtualizer({\n count: totalCount,\n getScrollElement: () => parentRef.current,\n estimateSize: () => estimateSize,\n overscan: 10,\n useAnimationFrameWithResizeObserver: true,\n scrollMargin: specialGroupHeight,\n })\n\n useEffect(() => {\n hasTriggeredRef.current = false\n }, [totalCount, loadingMore])\n\n const hasCenteredRef = useRef(false)\n useEffect(() => {\n if (hasCenteredRef.current || !value) return\n const index = localOptions.findIndex((option) => getOptionValue(option) === value)\n if (index === -1) return\n hasCenteredRef.current = true\n if (!parentRef.current?.scrollTop) rowVirtualizer.scrollToIndex(index, { align: 'center' })\n }, [value, localOptions, getOptionValue, rowVirtualizer, parentRef])\n\n const virtualItems = rowVirtualizer.getVirtualItems()\n\n useEffect(() => {\n if (virtualItems.length === 0 || !hasNextPage || loadingMore || loading || hasTriggeredRef.current) {\n return\n }\n\n const lastVisibleItem = virtualItems.at(-1)\n const itemsFromEnd = totalCount - (lastVisibleItem?.index ?? 0)\n\n if (itemsFromEnd <= PREFETCH_THRESHOLD) {\n hasTriggeredRef.current = true\n onLoadMore()\n }\n }, [virtualItems, totalCount, hasNextPage, loadingMore, loading, onLoadMore])\n\n if (loading && localOptions.length === 0) {\n return <div className=\"flex items-center justify-center py-6 text-body-md text-tertiary\">{loadingPlaceholder}</div>\n }\n\n if (localOptions.length === 0 && !specialOptions?.length && !loading && !loadingMore) {\n return <CommandEmpty>{emptyMessage}</CommandEmpty>\n }\n\n const renderOptionRow = (option: T) => {\n const optionValue = getOptionValue(option)\n const isSelected = value === optionValue\n return (\n <CommandItem key={optionValue} value={optionValue} data-checked={isSelected || undefined} onSelect={handleSelect}>\n {renderOption ? (\n renderOption(option, isSelected)\n ) : (\n <>\n <ComboboxOptionWithTooltip label={getOptionLabel(option)} />\n <OptionCheck />\n </>\n )}\n </CommandItem>\n )\n }\n\n return (\n <CommandList\n ref={parentRef}\n className=\"\n scroll-fade scroll-py-(--control-option-height,max(var(--control-height-md),var(--control-touch-height)))\n scrollbar-subtle overflow-auto overscroll-contain\n \"\n style={{ maxHeight }}\n onWheel={(event) => event.stopPropagation()}\n >\n <div style={{ height: `${specialGroupHeight + rowVirtualizer.getTotalSize()}px`, position: 'relative' }}>\n {specialOptions?.length ? (\n <div ref={specialGroupRef} data-testid=\"combobox-special-group\">\n <CommandGroup heading={specialOptionsTitle}>{specialOptions.map(renderOptionRow)}</CommandGroup>\n {localOptions.length > 0 && <CommandSeparator className=\"mx-1\" />}\n </div>\n ) : null}\n\n {rowVirtualizer.getVirtualItems().map((virtualRow) => (\n <div\n key={getOptionValue(localOptions[virtualRow.index])}\n data-index={virtualRow.index}\n ref={(el) => rowVirtualizer.measureElement(el)}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n transform: `translateY(${virtualRow.start}px)`,\n }}\n >\n {renderOptionRow(localOptions[virtualRow.index])}\n </div>\n ))}\n </div>\n {loadingMore && (\n <div className=\"flex items-center justify-center py-2 text-body-md text-tertiary\">{loadingPlaceholder}</div>\n )}\n </CommandList>\n )\n}\n"],"mappings":";;;;;;;AASA,IAAM,+BAA+B;AAErC,IAAa,2BAA6C,EACxD,cACA,SACA,oBACA,cACA,OACA,gBACA,gBACA,cACA,cACA,WACA,cAAc,OACd,cAAc,OACd,mBAAmB,CAAC,GACpB,eAAe,8BACf,SACA,gBACA,0BAC+C;CAC/C,MAAM,SAAS,OAAuB,IAAI;CAC1C,MAAM,YAAY,WAAW;CAC7B,MAAM,kBAAkB,OAAO,KAAK;CAEpC,MAAM,aAAa,aAAa;CAChC,MAAM,qBAAqB;CAG3B,MAAM,kBAAkB,OAAuB,IAAI;CACnD,MAAM,CAAC,oBAAoB,yBAAyB,SAAS,CAAC;CAC9D,gBAAgB;EACd,sBAAsB,gBAAgB,SAAS,gBAAgB,CAAC;CAClE,GAAG,CAAC,cAAc,CAAC;CAGnB,MAAM,iBAAiB,eAAe;EACpC,OAAO;EACP,wBAAwB,UAAU;EAClC,oBAAoB;EACpB,UAAU;EACV,qCAAqC;EACrC,cAAc;CAChB,CAAC;CAED,gBAAgB;EACd,gBAAgB,UAAU;CAC5B,GAAG,CAAC,YAAY,WAAW,CAAC;CAE5B,MAAM,iBAAiB,OAAO,KAAK;CACnC,gBAAgB;EACd,IAAI,eAAe,WAAW,CAAC,OAAO;EACtC,MAAM,QAAQ,aAAa,WAAW,WAAW,eAAe,MAAM,MAAM,KAAK;EACjF,IAAI,UAAU,IAAI;EAClB,eAAe,UAAU;EACzB,IAAI,CAAC,UAAU,SAAS,WAAW,eAAe,cAAc,OAAO,EAAE,OAAO,SAAS,CAAC;CAC5F,GAAG;EAAC;EAAO;EAAc;EAAgB;EAAgB;CAAS,CAAC;CAEnE,MAAM,eAAe,eAAe,gBAAgB;CAEpD,gBAAgB;EACd,IAAI,aAAa,WAAW,KAAK,CAAC,eAAe,eAAe,WAAW,gBAAgB,SACzF;EAGF,MAAM,kBAAkB,aAAa,GAAG,EAAE;EAG1C,IAFqB,cAAc,iBAAiB,SAAS,MAEzC,oBAAoB;GACtC,gBAAgB,UAAU;GAC1B,WAAW;EACb;CACF,GAAG;EAAC;EAAc;EAAY;EAAa;EAAa;EAAS;CAAU,CAAC;CAE5E,IAAI,WAAW,aAAa,WAAW,GACrC,OAAO,oBAAC,OAAD;EAAK,WAAU;EAAoE,UAAA;CAAwB,CAAA;CAGpH,IAAI,aAAa,WAAW,KAAK,CAAC,gBAAgB,UAAU,CAAC,WAAW,CAAC,aACvE,OAAO,oBAAC,cAAD,EAAA,UAAe,aAA2B,CAAA;CAGnD,MAAM,mBAAmB,WAAc;EACrC,MAAM,cAAc,eAAe,MAAM;EACzC,MAAM,aAAa,UAAU;EAC7B,OACE,oBAAC,aAAD;GAA+B,OAAO;GAAa,gBAAc,cAAc,KAAA;GAAW,UAAU;GACjG,UAAA,eACC,aAAa,QAAQ,UAAU,IAE/B,qBAAAA,UAAA,EAAA,UAAA,CACE,oBAAC,2BAAD,EAA2B,OAAO,eAAe,MAAM,EAAI,CAAA,GAC3D,oBAAC,aAAD,CAAc,CAAA,CACd,EAAA,CAAA;EAEO,GATK,WASL;CAEjB;CAEA,OACE,qBAAC,aAAD;EACE,KAAK;EACL,WAAU;EAIV,OAAO,EAAE,UAAU;EACnB,UAAU,UAAU,MAAM,gBAAgB;EAP5C,UAAA,CASE,qBAAC,OAAD;GAAK,OAAO;IAAE,QAAQ,GAAG,qBAAqB,eAAe,aAAa,EAAE;IAAK,UAAU;GAAW;GAAtG,UAAA,CACG,gBAAgB,SACf,qBAAC,OAAD;IAAK,KAAK;IAAiB,eAAY;IAAvC,UAAA,CACE,oBAAC,cAAD;KAAc,SAAS;KAAsB,UAAA,eAAe,IAAI,eAAe;IAAgB,CAAA,GAC9F,aAAa,SAAS,KAAK,oBAAC,kBAAD,EAAkB,WAAU,OAAQ,CAAA,CAC7D;GACH,CAAA,IAAA,MAEH,eAAe,gBAAgB,CAAC,CAAC,KAAK,eACrC,oBAAC,OAAD;IAEE,cAAY,WAAW;IACvB,MAAM,OAAO,eAAe,eAAe,EAAE;IAC7C,OAAO;KACL,UAAU;KACV,KAAK;KACL,MAAM;KACN,OAAO;KACP,WAAW,cAAc,WAAW,MAAM;IAC5C;IAEC,UAAA,gBAAgB,aAAa,WAAW,MAAM;GAC5C,GAZE,eAAe,aAAa,WAAW,MAAM,CAY/C,CACN,CACE;EACJ,CAAA,GAAA,eACC,oBAAC,OAAD;GAAK,WAAU;GAAoE,UAAA;EAAwB,CAAA,CAElG;;AAEjB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useDebouncedState } from "./useDebouncedState.js";
|
|
2
1
|
import { useComboboxOpenState } from "./useComboboxOpenState.js";
|
|
3
2
|
import { useComboboxSelection } from "./useComboboxSelection.js";
|
|
3
|
+
import { useDebouncedState } from "./useDebouncedState.js";
|
|
4
4
|
import { useDisplayValue } from "./useDisplayValue.js";
|
|
5
5
|
export { useComboboxOpenState, useComboboxSelection, useDebouncedState, useDisplayValue };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useDebouncedState } from "./useDebouncedState.js";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
|
-
|
|
3
|
+
// src/components/inputs/Combobox/hooks/useComboboxOpenState.ts
|
|
4
4
|
function useComboboxOpenState() {
|
|
5
5
|
const [isOpen, setIsOpen] = useState(false);
|
|
6
6
|
const { value: searchTerm, debouncedValue: debouncedSearchTerm, setValue: setSearchTerm } = useDebouncedState("");
|
|
@@ -15,7 +15,6 @@ function useComboboxOpenState() {
|
|
|
15
15
|
setSearchTerm
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { useComboboxOpenState };
|
|
20
19
|
|
|
21
20
|
//# sourceMappingURL=useComboboxOpenState.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
|
|
2
|
+
// src/components/inputs/Combobox/hooks/useComboboxSelection.ts
|
|
3
3
|
function useComboboxSelection(props, setOpen) {
|
|
4
4
|
const { multiple, clearable = true, onClear, specialOptions } = props;
|
|
5
5
|
const closeOnSelect = props.closeOnSelect ?? !props.multiple;
|
|
@@ -45,7 +45,6 @@ function useComboboxSelection(props, setOpen) {
|
|
|
45
45
|
}, [props.value, multiple])
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
//#endregion
|
|
49
48
|
export { useComboboxSelection };
|
|
50
49
|
|
|
51
50
|
//# sourceMappingURL=useComboboxSelection.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
-
|
|
2
|
+
// src/components/inputs/Combobox/hooks/useDebouncedState.ts
|
|
3
3
|
function useDebouncedState(initial, delay = 300) {
|
|
4
|
-
const [value,
|
|
4
|
+
const [value, setValue] = useState(initial);
|
|
5
5
|
const [debouncedValue, setDebouncedValue] = useState(initial);
|
|
6
6
|
const timerRef = useRef(null);
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const updateValue = useCallback((next) => {
|
|
8
|
+
setValue(next);
|
|
9
9
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
10
10
|
timerRef.current = setTimeout(() => setDebouncedValue(next), delay);
|
|
11
11
|
}, [delay]);
|
|
@@ -15,10 +15,9 @@ function useDebouncedState(initial, delay = 300) {
|
|
|
15
15
|
return {
|
|
16
16
|
value,
|
|
17
17
|
debouncedValue,
|
|
18
|
-
setValue
|
|
18
|
+
setValue: updateValue
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { useDebouncedState };
|
|
23
22
|
|
|
24
23
|
//# sourceMappingURL=useDebouncedState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDebouncedState.js","names":[],"sources":["../../../../../src/components/inputs/Combobox/hooks/useDebouncedState.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\n\nexport function useDebouncedState<T>(initial: T, delay: number = 300) {\n const [value,
|
|
1
|
+
{"version":3,"file":"useDebouncedState.js","names":[],"sources":["../../../../../src/components/inputs/Combobox/hooks/useDebouncedState.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\n\nexport function useDebouncedState<T>(initial: T, delay: number = 300) {\n const [value, setValue] = useState<T>(initial)\n const [debouncedValue, setDebouncedValue] = useState<T>(initial)\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n const updateValue = useCallback(\n (next: T) => {\n setValue(next)\n if (timerRef.current) clearTimeout(timerRef.current)\n timerRef.current = setTimeout(() => setDebouncedValue(next), delay)\n },\n [delay],\n )\n\n useEffect(\n () => () => {\n if (timerRef.current) clearTimeout(timerRef.current)\n },\n [],\n )\n\n return { value, debouncedValue, setValue: updateValue }\n}\n"],"mappings":";;AAEA,SAAgB,kBAAqB,SAAY,QAAgB,KAAK;CACpE,MAAM,CAAC,OAAO,YAAY,SAAY,OAAO;CAC7C,MAAM,CAAC,gBAAgB,qBAAqB,SAAY,OAAO;CAC/D,MAAM,WAAW,OAA6C,IAAI;CAElE,MAAM,cAAc,aACjB,SAAY;EACX,SAAS,IAAI;EACb,IAAI,SAAS,SAAS,aAAa,SAAS,OAAO;EACnD,SAAS,UAAU,iBAAiB,kBAAkB,IAAI,GAAG,KAAK;CACpE,GACA,CAAC,KAAK,CACR;CAEA,sBACc;EACV,IAAI,SAAS,SAAS,aAAa,SAAS,OAAO;CACrD,GACA,CAAC,CACH;CAEA,OAAO;EAAE;EAAO;EAAgB,UAAU;CAAY;AACxD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
|
|
2
|
+
// src/components/inputs/Combobox/hooks/useDisplayValue.ts
|
|
3
3
|
function getMultipleDisplayValue(props, lookup, getOptionLabel, placeholder, handleRemove) {
|
|
4
4
|
const { renderLabel } = props;
|
|
5
5
|
const value = Array.isArray(props.value) ? props.value : [];
|
|
@@ -31,7 +31,6 @@ function useDisplayValue({ props, handleRemove }) {
|
|
|
31
31
|
specialOptions
|
|
32
32
|
]);
|
|
33
33
|
}
|
|
34
|
-
//#endregion
|
|
35
34
|
export { useDisplayValue };
|
|
36
35
|
|
|
37
36
|
//# sourceMappingURL=useDisplayValue.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Combobox } from "./Combobox.js";
|
|
1
2
|
import { ComboboxOptionWithTooltip } from "./ComboboxOptionWithTooltip.js";
|
|
2
3
|
import { StaticComboboxList } from "./StaticComboboxList.js";
|
|
3
4
|
import { useCombobox } from "./useCombobox.js";
|
|
4
5
|
import { VirtualizedComboboxList } from "./VirtualizedComboboxList.js";
|
|
5
|
-
import { Combobox } from "./Combobox.js";
|
|
6
6
|
export { Combobox, ComboboxOptionWithTooltip, StaticComboboxList, VirtualizedComboboxList, useCombobox };
|
|
@@ -6,7 +6,7 @@ export type ComboboxListBaseProps<T> = {
|
|
|
6
6
|
getOptionLabel: (option: T) => string;
|
|
7
7
|
handleSelect: (value: string) => void;
|
|
8
8
|
renderOption?: (option: T, isSelected: boolean) => React.ReactNode;
|
|
9
|
-
maxHeight
|
|
9
|
+
maxHeight?: string | number;
|
|
10
10
|
listRef?: React.RefObject<HTMLDivElement | null>;
|
|
11
11
|
};
|
|
12
12
|
export type VirtualizedComboboxListProps<T> = ComboboxListBaseProps<T> & {
|
|
@@ -3,7 +3,7 @@ import { useComboboxOpenState } from "./hooks/useComboboxOpenState.js";
|
|
|
3
3
|
import { useComboboxSelection } from "./hooks/useComboboxSelection.js";
|
|
4
4
|
import { useDisplayValue } from "./hooks/useDisplayValue.js";
|
|
5
5
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
6
|
-
|
|
6
|
+
// src/components/inputs/Combobox/useCombobox.ts
|
|
7
7
|
var EMPTY_ARRAY = [];
|
|
8
8
|
var useCombobox = (props) => {
|
|
9
9
|
const { getOptionLabel, filterOptions, specialOptions } = props;
|
|
@@ -62,7 +62,6 @@ var useCombobox = (props) => {
|
|
|
62
62
|
loadNextPage
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
|
-
//#endregion
|
|
66
65
|
export { useCombobox };
|
|
67
66
|
|
|
68
67
|
//# sourceMappingURL=useCombobox.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { cn } from "../../../lib/utils.js";
|
|
4
3
|
import { Dialog, DialogContent } from "../../feedback/Dialog/Dialog.js";
|
|
4
|
+
import { cn } from "../../../lib/utils.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { MagnifyingGlassIcon } from "@phosphor-icons/react/dist/ssr/MagnifyingGlass";
|
|
8
8
|
import { Command as Command$1 } from "cmdk";
|
|
9
|
-
|
|
9
|
+
// src/components/inputs/Command/Command.tsx
|
|
10
10
|
var Command = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Command$1, {
|
|
11
11
|
ref,
|
|
12
|
-
className: cn("flex
|
|
12
|
+
className: cn("flex size-full flex-col overflow-hidden bg-surface-primary text-primary", className),
|
|
13
13
|
...props
|
|
14
14
|
}));
|
|
15
15
|
Command.displayName = Command$1.displayName;
|
|
@@ -19,24 +19,25 @@ var CommandDialog = ({ children, ...props }) => {
|
|
|
19
19
|
children: /* @__PURE__ */ jsx(DialogContent, {
|
|
20
20
|
className: "overflow-hidden surface p-0 surface-list",
|
|
21
21
|
children: /* @__PURE__ */ jsx(Command, {
|
|
22
|
-
className: "\n **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium
|
|
22
|
+
className: "\n **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-tertiary\n **:[[cmdk-group]]:px-2\n **:[[cmdk-input]]:h-12\n **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3\n [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0\n [&_[cmdk-input-wrapper]_svg]:icon-md\n [&_[cmdk-item]_svg]:icon-md\n ",
|
|
23
23
|
children
|
|
24
24
|
})
|
|
25
25
|
})
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
var CommandInput = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs("div", {
|
|
29
|
-
|
|
29
|
+
"data-cmdk-search": true,
|
|
30
|
+
className: "\n mx-[calc(var(--surface-inset)*2)] mt-[calc(var(--surface-inset)*2)] mb-(--surface-inset) flex\n h-(--control-option-height,max(var(--control-height-md),var(--control-touch-height))) items-center rounded-lg\n border border-input px-3 motion-hover\n focus-within:border-focused focus-within:outline-1 focus-within:-outline-offset-2 focus-within:outline-focused\n focus-within:hover:border-focused\n hover:border-control\n ",
|
|
30
31
|
children: [
|
|
31
|
-
/* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "mr-2
|
|
32
|
+
/* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "mr-2 icon-md shrink-0 text-tertiary" }),
|
|
32
33
|
/* @__PURE__ */ jsx(Command$1.Input, {
|
|
33
34
|
ref,
|
|
34
35
|
className: cn(`
|
|
35
|
-
flex
|
|
36
|
+
flex size-full rounded-lg bg-transparent py-3 text-(length:--control-option-text,0.875rem)
|
|
36
37
|
leading-(--control-option-leading,1.25rem)
|
|
37
|
-
placeholder:text-
|
|
38
|
-
disabled:cursor-not-allowed disabled:
|
|
39
|
-
pointer-coarse:text-
|
|
38
|
+
placeholder:text-tertiary
|
|
39
|
+
disabled:cursor-not-allowed disabled:text-tertiary
|
|
40
|
+
pointer-coarse:text-body-lg
|
|
40
41
|
`, className),
|
|
41
42
|
...props
|
|
42
43
|
}),
|
|
@@ -49,29 +50,33 @@ var CommandInput = React$1.forwardRef(({ className, children, ...props }, ref) =
|
|
|
49
50
|
CommandInput.displayName = Command$1.Input.displayName;
|
|
50
51
|
var CommandList = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Command$1.List, {
|
|
51
52
|
ref,
|
|
52
|
-
className: cn(
|
|
53
|
+
className: cn(`
|
|
54
|
+
relative mb-(--surface-inset)
|
|
55
|
+
max-h-[calc(var(--control-option-height,max(var(--control-height-md),var(--control-touch-height)))*6)]
|
|
56
|
+
scrollbar-subtle overflow-x-hidden overflow-y-auto px-(--surface-inset)
|
|
57
|
+
`, className),
|
|
53
58
|
...props
|
|
54
59
|
}));
|
|
55
60
|
CommandList.displayName = Command$1.List.displayName;
|
|
56
61
|
var CommandEmpty = React$1.forwardRef((props, ref) => /* @__PURE__ */ jsx(Command$1.Empty, {
|
|
57
62
|
ref,
|
|
58
|
-
className: "py-6 text-center text-
|
|
63
|
+
className: "py-6 text-center text-body-md",
|
|
59
64
|
...props
|
|
60
65
|
}));
|
|
61
66
|
CommandEmpty.displayName = Command$1.Empty.displayName;
|
|
62
67
|
var CommandGroup = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Command$1.Group, {
|
|
63
68
|
ref,
|
|
64
69
|
className: cn(`
|
|
65
|
-
overflow-hidden text-left text-
|
|
66
|
-
**:[[cmdk-group-heading]]:px-3 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-
|
|
67
|
-
**:[[cmdk-group-heading]]:font-normal **:[[cmdk-group-heading]]:text-
|
|
70
|
+
overflow-hidden text-left text-primary
|
|
71
|
+
**:[[cmdk-group-heading]]:px-3 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-body-md
|
|
72
|
+
**:[[cmdk-group-heading]]:font-normal **:[[cmdk-group-heading]]:text-tertiary
|
|
68
73
|
`, className),
|
|
69
74
|
...props
|
|
70
75
|
}));
|
|
71
76
|
CommandGroup.displayName = Command$1.Group.displayName;
|
|
72
77
|
var CommandSeparator = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
73
78
|
ref,
|
|
74
|
-
className: cn("my-1 h-px bg-
|
|
79
|
+
className: cn("my-1 h-px bg-surface-tertiary", className),
|
|
75
80
|
...props
|
|
76
81
|
}));
|
|
77
82
|
CommandSeparator.displayName = Command$1.Separator.displayName;
|
|
@@ -81,21 +86,20 @@ var CommandItem = React$1.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
81
86
|
relative flex min-h-(--control-option-height,max(var(--control-height-md),var(--control-touch-height)))
|
|
82
87
|
items-center gap-2 surface-item press-fill-strong px-3 py-1.5 text-(length:--control-option-text,0.875rem)
|
|
83
88
|
leading-(--control-option-leading,1.25rem) outline-hidden select-none
|
|
84
|
-
data-[disabled=true]:pointer-events-none data-[disabled=true]:
|
|
85
|
-
data-[selected=true]:bg-
|
|
86
|
-
[&_svg]:pointer-events-none [&_svg]:
|
|
89
|
+
data-[disabled=true]:pointer-events-none data-[disabled=true]:text-tertiary
|
|
90
|
+
data-[selected=true]:bg-surface-tertiary
|
|
91
|
+
[&_svg]:pointer-events-none [&_svg]:icon-md [&_svg]:shrink-0
|
|
87
92
|
`, className),
|
|
88
93
|
...props
|
|
89
94
|
}));
|
|
90
95
|
CommandItem.displayName = Command$1.Item.displayName;
|
|
91
96
|
var CommandShortcut = ({ className, ...props }) => {
|
|
92
97
|
return /* @__PURE__ */ jsx("span", {
|
|
93
|
-
className: cn("ml-auto text-
|
|
98
|
+
className: cn("ml-auto text-body-sm tracking-widest text-tertiary", className),
|
|
94
99
|
...props
|
|
95
100
|
});
|
|
96
101
|
};
|
|
97
102
|
CommandShortcut.displayName = "CommandShortcut";
|
|
98
|
-
//#endregion
|
|
99
103
|
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|
|
100
104
|
|
|
101
105
|
//# sourceMappingURL=Command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.js","names":["React","CommandPrimitive"],"sources":["../../../../src/components/inputs/Command/Command.tsx"],"sourcesContent":["'use client'\n\nimport { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/ssr/MagnifyingGlass'\nimport { type DialogProps } from '@radix-ui/react-dialog'\nimport { Command as CommandPrimitive } from 'cmdk'\nimport * as React from 'react'\n\nimport { Dialog, DialogContent } from '../../feedback/Dialog'\n\nimport { cn } from '@/lib/utils'\n\nconst Command = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn('flex
|
|
1
|
+
{"version":3,"file":"Command.js","names":["React","CommandPrimitive"],"sources":["../../../../src/components/inputs/Command/Command.tsx"],"sourcesContent":["'use client'\n\nimport { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/ssr/MagnifyingGlass'\nimport { type DialogProps } from '@radix-ui/react-dialog'\nimport { Command as CommandPrimitive } from 'cmdk'\nimport * as React from 'react'\n\nimport { Dialog, DialogContent } from '../../feedback/Dialog'\n\nimport { cn } from '@/lib/utils'\n\nconst Command = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn('flex size-full flex-col overflow-hidden bg-surface-primary text-primary', className)}\n {...props}\n />\n))\nCommand.displayName = CommandPrimitive.displayName\n\nconst CommandDialog = ({ children, ...props }: Readonly<DialogProps>) => {\n return (\n <Dialog {...props}>\n <DialogContent className=\"overflow-hidden surface p-0 surface-list\">\n <Command\n className=\"\n **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-tertiary\n **:[[cmdk-group]]:px-2\n **:[[cmdk-input]]:h-12\n **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3\n [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0\n [&_[cmdk-input-wrapper]_svg]:icon-md\n [&_[cmdk-item]_svg]:icon-md\n \"\n >\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n )\n}\n\nconst CommandInput = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Input>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>>\n>(({ className, children, ...props }, ref) => (\n <div\n data-cmdk-search\n className=\"\n mx-[calc(var(--surface-inset)*2)] mt-[calc(var(--surface-inset)*2)] mb-(--surface-inset) flex\n h-(--control-option-height,max(var(--control-height-md),var(--control-touch-height))) items-center rounded-lg\n border border-input px-3 motion-hover\n focus-within:border-focused focus-within:outline-1 focus-within:-outline-offset-2 focus-within:outline-focused\n focus-within:hover:border-focused\n hover:border-control\n \"\n >\n <MagnifyingGlassIcon className=\"mr-2 icon-md shrink-0 text-tertiary\" />\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n `\n flex size-full rounded-lg bg-transparent py-3 text-(length:--control-option-text,0.875rem)\n leading-(--control-option-leading,1.25rem)\n placeholder:text-tertiary\n disabled:cursor-not-allowed disabled:text-tertiary\n pointer-coarse:text-body-lg\n `,\n className,\n )}\n {...props}\n />\n {children && <div className=\"ml-2\">{children}</div>}\n </div>\n))\n\nCommandInput.displayName = CommandPrimitive.Input.displayName\n\nconst CommandList = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.List>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn(\n `\n relative mb-(--surface-inset)\n max-h-[calc(var(--control-option-height,max(var(--control-height-md),var(--control-touch-height)))*6)]\n scrollbar-subtle overflow-x-hidden overflow-y-auto px-(--surface-inset)\n `,\n className,\n )}\n {...props}\n />\n))\n\nCommandList.displayName = CommandPrimitive.List.displayName\n\nconst CommandEmpty = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Empty>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>>\n>((props, ref) => <CommandPrimitive.Empty ref={ref} className=\"py-6 text-center text-body-md\" {...props} />)\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName\n\nconst CommandGroup = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Group>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n `\n overflow-hidden text-left text-primary\n **:[[cmdk-group-heading]]:px-3 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-body-md\n **:[[cmdk-group-heading]]:font-normal **:[[cmdk-group-heading]]:text-tertiary\n `,\n className,\n )}\n {...props}\n />\n))\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName\n\nconst CommandSeparator = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Separator>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator ref={ref} className={cn('my-1 h-px bg-surface-tertiary', className)} {...props} />\n))\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName\n\nconst CommandItem = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Item>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n `\n relative flex min-h-(--control-option-height,max(var(--control-height-md),var(--control-touch-height)))\n items-center gap-2 surface-item press-fill-strong px-3 py-1.5 text-(length:--control-option-text,0.875rem)\n leading-(--control-option-leading,1.25rem) outline-hidden select-none\n data-[disabled=true]:pointer-events-none data-[disabled=true]:text-tertiary\n data-[selected=true]:bg-surface-tertiary\n [&_svg]:pointer-events-none [&_svg]:icon-md [&_svg]:shrink-0\n `,\n className,\n )}\n {...props}\n />\n))\n\nCommandItem.displayName = CommandPrimitive.Item.displayName\n\nconst CommandShortcut = ({ className, ...props }: Readonly<React.HTMLAttributes<HTMLSpanElement>>) => {\n return <span className={cn('ml-auto text-body-sm tracking-widest text-tertiary', className)} {...props} />\n}\nCommandShortcut.displayName = 'CommandShortcut'\n\nexport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n}\n"],"mappings":";;;;;;;;;AAWA,IAAA,UAAA,QAAA,YAAA,EAAA,WAAA,GAAA,SAAA,QAAA,oBAAA,WAAA;CAKS;CACL,WAAA,GAAA,2EAAA,SAAA;CACA,GAAA;AACD,CAAA,CAAA;AAEH,QAAA,cAAA,UAAA;AAEA,IAAA,iBAAA,EAAA,UAAA,GAAA,YAAA;CACE,OAAA,oBAAA,QAAA;EACU,GAAA;EACN,UAAA,oBAAA,eAAA;GAAe,WAAA;GACb,UAAA,oBAAA,SAAA;IACE,WAAA;IAUC;GACM,CAAA;EACI,CAAA;CACT,CAAA;AAEZ;AAEA,IAAA,eAAA,QAAA,YAAA,EAAA,WAAA,UAAA,GAAA,SAAA,QAAA,qBAAA,OAAA;CAKI,oBAAA;CACA,WAAA;CAFF,UAAA;EAWE,oBAAA,qBAAA,EAAA,WAAA,sCAAA,CAAA;EACA,oBAAA,UAAA,OAAA;GACO;GACL,WAAA,GAAA;;;;;;WAQE,SAAA;GAEF,GAAA;EACD,CAAA;EACA,YAAA,oBAAA,OAAA;GAAiB,WAAA;GAAkB;EAAc,CAAA;CAC/C;AACN,CAAA,CAAA;AAED,aAAA,cAAA,UAAA,MAAA;AAEA,IAAA,cAAA,QAAA,YAAA,EAAA,WAAA,GAAA,SAAA,QAAA,oBAAA,UAAA,MAAA;CAKS;CACL,WAAA,GAAA;;;;SAME,SAAA;CAEF,GAAA;AACD,CAAA,CAAA;AAGH,YAAA,cAAA,UAAA,KAAA;AAEA,IAAA,eAAA,QAAA,YAAA,OAAA,QAAA,oBAAA,UAAA,OAAA;CAG+C;CAAK,WAAA;CAA0C,GAAA;AAAY,CAAA,CAAA;AAE1G,aAAA,cAAA,UAAA,MAAA;AAEA,IAAA,eAAA,QAAA,YAAA,EAAA,WAAA,GAAA,SAAA,QAAA,oBAAA,UAAA,OAAA;CAKS;CACL,WAAA,GAAA;;;;SAME,SAAA;CAEF,GAAA;AACD,CAAA,CAAA;AAGH,aAAA,cAAA,UAAA,MAAA;AAEA,IAAA,mBAAA,QAAA,YAAA,EAAA,WAAA,GAAA,SAAA,QAAA,oBAAA,UAAA,WAAA;CAImC;CAAK,WAAA,GAAA,iCAAA,SAAA;CAA2D,GAAA;AAAY,CAAA,CAAA;AAE/G,iBAAA,cAAA,UAAA,UAAA;AAEA,IAAA,cAAA,QAAA,YAAA,EAAA,WAAA,GAAA,SAAA,QAAA,oBAAA,UAAA,MAAA;CAKS;CACL,WAAA,GAAA;;;;;;;SASE,SAAA;CAEF,GAAA;AACD,CAAA,CAAA;AAGH,YAAA,cAAA,UAAA,KAAA;AAEA,IAAA,mBAAA,EAAA,WAAA,GAAA,YAAA;CACE,OAAA,oBAAA,QAAA;EAAa,WAAA,GAAA,sDAAA,SAAA;EAAgF,GAAA;CAAY,CAAA;AAC3G;AACA,gBAAA,cAAA"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|
|
1
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from "./Command.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { cn, createSearchMatcher } from "../../../lib/utils.js";
|
|
2
|
-
import { Combobox } from "../Combobox/Combobox.js";
|
|
3
1
|
import { Flag } from "../../data-display/Flag/Flag.js";
|
|
2
|
+
import { OptionCheck } from "../../shared/OptionCheck.js";
|
|
3
|
+
import { Combobox } from "../Combobox/Combobox.js";
|
|
4
4
|
import { buildCountries, regionName, resolveIso, splitByPriority } from "../../../lib/countries.js";
|
|
5
|
+
import { cn, createSearchMatcher } from "../../../lib/utils.js";
|
|
5
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { CheckIcon } from "@phosphor-icons/react/dist/ssr/Check";
|
|
7
7
|
import { GlobeIcon } from "@phosphor-icons/react/dist/ssr/Globe";
|
|
8
|
-
|
|
8
|
+
// src/components/inputs/CountrySelect/CountrySelect.tsx
|
|
9
9
|
function CountrySelect(props) {
|
|
10
10
|
const { countries, locale = "en", priorityCountries, onChange, renderFlag, getCountryValue, getCountryIsoCode, getCountryName, getCountrySearchTerms, className, disabled = false, placeholder = "Select country", ...comboboxProps } = props;
|
|
11
11
|
const options = countries ?? buildCountries(locale);
|
|
@@ -43,7 +43,7 @@ function CountrySelect(props) {
|
|
|
43
43
|
placeholder: /* @__PURE__ */ jsxs("span", {
|
|
44
44
|
className: "flex items-center gap-2",
|
|
45
45
|
children: [/* @__PURE__ */ jsx(GlobeIcon, {
|
|
46
|
-
className: "
|
|
46
|
+
className: "icon-control shrink-0",
|
|
47
47
|
"aria-hidden": true
|
|
48
48
|
}), /* @__PURE__ */ jsx("span", {
|
|
49
49
|
className: "truncate",
|
|
@@ -63,15 +63,13 @@ function CountrySelect(props) {
|
|
|
63
63
|
if (country) onChange?.(value, country);
|
|
64
64
|
},
|
|
65
65
|
renderLabel: renderCountry,
|
|
66
|
-
renderOption: (option, isSelected) => /* @__PURE__ */ jsxs(Fragment, { children: [renderCountry(option), isSelected && /* @__PURE__ */ jsx(
|
|
66
|
+
renderOption: (option, isSelected) => /* @__PURE__ */ jsxs(Fragment, { children: [renderCountry(option), isSelected && /* @__PURE__ */ jsx(OptionCheck, {
|
|
67
67
|
"data-testid": "selected-check",
|
|
68
|
-
|
|
69
|
-
className: "ml-auto h-4 w-4 shrink-0 text-neutral-950"
|
|
68
|
+
className: "ml-auto"
|
|
70
69
|
})] })
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
72
|
CountrySelect.displayName = "CountrySelect";
|
|
74
|
-
//#endregion
|
|
75
73
|
export { CountrySelect };
|
|
76
74
|
|
|
77
75
|
//# sourceMappingURL=CountrySelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CountrySelect.js","names":["_Fragment"],"sources":["../../../../src/components/inputs/CountrySelect/CountrySelect.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"CountrySelect.js","names":["_Fragment"],"sources":["../../../../src/components/inputs/CountrySelect/CountrySelect.tsx"],"sourcesContent":["import { GlobeIcon } from '@phosphor-icons/react/dist/ssr/Globe'\nimport type * as React from 'react'\n\nimport { Flag } from '../../data-display/Flag'\nimport { OptionCheck } from '../../shared'\nimport { Combobox, type ComboboxSingleProps } from '../Combobox'\n\nimport type { Country, CountrySelectAccessors } from './types'\n\nimport { buildCountries, regionName, resolveIso, splitByPriority } from '@/lib/countries'\nimport { cn, createSearchMatcher } from '@/lib/utils'\n\ntype CountrySelectComboboxProps = Pick<\n ComboboxSingleProps<object>,\n | 'id'\n | 'className'\n | 'disabled'\n | 'error'\n | 'size'\n | 'value'\n | 'placeholder'\n | 'searchPlaceholder'\n | 'emptyMessage'\n | 'aria-invalid'\n | 'aria-describedby'\n>\n\ntype CountrySelectBaseProps<T> = CountrySelectComboboxProps & {\n /** ISO codes pinned above the list, in order. */\n priorityCountries?: Array<string>\n onChange?: (value: string, country: T) => void\n /** Replaces the default `Flag` in the trigger and the options. */\n renderFlag?: (country: T) => React.ReactNode\n}\n\ntype ResolvedCountrySelectProps<T extends object> = CountrySelectBaseProps<T> &\n Partial<CountrySelectAccessors<T>> & {\n /** Defaults to the generated list. */\n countries?: Array<T>\n /** Ignored when `countries` is passed. */\n locale?: string\n }\n\nexport type CountrySelectDefaultProps = ResolvedCountrySelectProps<Country>\n\nexport type CountrySelectCustomProps<T extends object> = CountrySelectBaseProps<T> &\n CountrySelectAccessors<T> & {\n countries: Array<T>\n }\n\nexport type CountrySelectProps<T extends object = Country> = CountrySelectDefaultProps | CountrySelectCustomProps<T>\n\nexport function CountrySelect(props: Readonly<CountrySelectDefaultProps>): React.ReactElement\nexport function CountrySelect<T extends object>(props: Readonly<CountrySelectCustomProps<T>>): React.ReactElement\nexport function CountrySelect<T extends object>(props: Readonly<ResolvedCountrySelectProps<T>>): React.ReactElement {\n const {\n countries,\n locale = 'en',\n priorityCountries,\n onChange,\n renderFlag,\n getCountryValue,\n getCountryIsoCode,\n getCountryName,\n getCountrySearchTerms,\n className,\n disabled = false,\n placeholder = 'Select country',\n ...comboboxProps\n } = props\n\n const options = countries ?? (buildCountries(locale) as unknown as Array<T>)\n const valueOf = getCountryValue ?? ((option: T) => (option as unknown as Country).isoCode)\n const nameOf = getCountryName ?? ((option: T) => (option as unknown as Country).name)\n const isoOf = (option: T) => resolveIso(valueOf(option), getCountryIsoCode?.(option))\n\n const { priority, rest } = splitByPriority(options, priorityCountries, isoOf)\n\n const filterOptions = (list: Array<T>, search: string) => {\n const matches = createSearchMatcher(search)\n return list.filter((option) => {\n const iso = isoOf(option)\n const terms = [nameOf(option), iso ?? '', ...(getCountrySearchTerms?.(option) ?? [])]\n if (!countries && iso && locale !== 'en') terms.push(regionName(iso))\n return matches(terms)\n })\n }\n\n const renderCountry = (option: T) => {\n const iso = isoOf(option)\n return (\n <span className=\"flex min-w-0 items-center gap-2\">\n {renderFlag ? renderFlag(option) : iso && <Flag iso={iso} />}\n <span className=\"truncate\">{nameOf(option)}</span>\n </span>\n )\n }\n\n return (\n <Combobox<T>\n {...comboboxProps}\n className={cn('w-full', className)}\n disabled={disabled || (options.length <= 1 && !!comboboxProps.value)}\n placeholder={\n <span className=\"flex items-center gap-2\">\n <GlobeIcon className=\"icon-control shrink-0\" aria-hidden />\n <span className=\"truncate\">{placeholder}</span>\n </span>\n }\n virtualized\n options={rest}\n specialOptions={priority}\n getOptionValue={valueOf}\n getOptionLabel={nameOf}\n filterOptions={filterOptions}\n clearable={false}\n onOpenAutoFocus\n onChange={(value) => {\n const country = options.find((option) => valueOf(option) === value)\n if (country) onChange?.(value, country)\n }}\n renderLabel={renderCountry}\n renderOption={(option, isSelected) => (\n <>\n {renderCountry(option)}\n {isSelected && <OptionCheck data-testid=\"selected-check\" className=\"ml-auto\" />}\n </>\n )}\n />\n )\n}\n\nCountrySelect.displayName = 'CountrySelect'\n"],"mappings":";;;;;;;;AAsDA,SAAgB,cAAgC,OAAoE;CAClH,MAAM,EACJ,WACA,SAAS,MACT,mBACA,UACA,YACA,iBACA,mBACA,gBACA,uBACA,WACA,WAAW,OACX,cAAc,kBACd,GAAG,kBACD;CAEJ,MAAM,UAAU,aAAc,eAAe,MAAM;CACnD,MAAM,UAAU,qBAAqB,WAAe,OAA8B;CAClF,MAAM,SAAS,oBAAoB,WAAe,OAA8B;CAChF,MAAM,SAAS,WAAc,WAAW,QAAQ,MAAM,GAAG,oBAAoB,MAAM,CAAC;CAEpF,MAAM,EAAE,UAAU,SAAS,gBAAgB,SAAS,mBAAmB,KAAK;CAE5E,MAAM,iBAAiB,MAAgB,WAAmB;EACxD,MAAM,UAAU,oBAAoB,MAAM;EAC1C,OAAO,KAAK,QAAQ,WAAW;GAC7B,MAAM,MAAM,MAAM,MAAM;GACxB,MAAM,QAAQ;IAAC,OAAO,MAAM;IAAG,OAAO;IAAI,GAAI,wBAAwB,MAAM,KAAK,CAAC;GAAE;GACpF,IAAI,CAAC,aAAa,OAAO,WAAW,MAAM,MAAM,KAAK,WAAW,GAAG,CAAC;GACpE,OAAO,QAAQ,KAAK;EACtB,CAAC;CACH;CAEA,MAAM,iBAAiB,WAAc;EACnC,MAAM,MAAM,MAAM,MAAM;EACxB,OACE,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACG,aAAa,WAAW,MAAM,IAAI,OAAO,oBAAC,MAAD,EAAW,IAAM,CAAA,GAC3D,oBAAC,QAAD;IAAM,WAAU;IAAY,UAAA,OAAO,MAAM;GAAQ,CAAA,CAC7C;;CAEV;CAEA,OACE,oBAAC,UAAD;EACE,GAAI;EACJ,WAAW,GAAG,UAAU,SAAS;EACjC,UAAU,YAAa,QAAQ,UAAU,KAAK,CAAC,CAAC,cAAc;EAC9D,aACE,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACE,oBAAC,WAAD;IAAW,WAAU;IAAwB,eAAA;GAAa,CAAA,GAC1D,oBAAC,QAAD;IAAM,WAAU;IAAY,UAAA;GAAkB,CAAA,CAC1C;;EAER,aAAA;EACA,SAAS;EACT,gBAAgB;EAChB,gBAAgB;EAChB,gBAAgB;EACD;EACf,WAAW;EACX,iBAAA;EACA,WAAW,UAAU;GACnB,MAAM,UAAU,QAAQ,MAAM,WAAW,QAAQ,MAAM,MAAM,KAAK;GAClE,IAAI,SAAS,WAAW,OAAO,OAAO;EACxC;EACA,aAAa;EACb,eAAe,QAAQ,eACrB,qBAAAA,UAAA,EAAA,UAAA,CACG,cAAc,MAAM,GACpB,cAAc,oBAAC,aAAD;GAAa,eAAY;GAAiB,WAAU;EAAW,CAAA,CAC9E,EAAA,CAAA;CAEL,CAAA;AAEL;AAEA,cAAc,cAAc"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { CountrySelect };
|
|
1
|
+
export { CountrySelect } from "./CountrySelect.js";
|