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,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { cn } from "../../../lib/utils.js";
|
|
4
|
-
import { Button } from "../Button/Button.js";
|
|
5
3
|
import { PopoverContent, PopoverRoot, PopoverTrigger } from "../../data-display/Popover/Popover.js";
|
|
4
|
+
import { Button } from "../Button/Button.js";
|
|
5
|
+
import { Calendar } from "../Calendar/Calendar.js";
|
|
6
6
|
import { CalendarDayContext } from "../shared/calendarDayContext.js";
|
|
7
7
|
import { ClearButton, ClearFade } from "../shared/ClearButton.js";
|
|
8
8
|
import { isFieldInvalid } from "../shared/fieldInvalid.js";
|
|
9
|
-
import { Calendar } from "../Calendar/Calendar.js";
|
|
10
9
|
import { formatOutputDate, formatOutputRange, parseInputDate, parseInputRange } from "../../../lib/dateUtils.js";
|
|
11
10
|
import { useLocale } from "../../../lib/useLocale.js";
|
|
12
11
|
import { useIsMobile } from "../../../lib/useMobile.js";
|
|
12
|
+
import { cn } from "../../../lib/utils.js";
|
|
13
13
|
import * as React$1 from "react";
|
|
14
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
import { format } from "date-fns";
|
|
16
16
|
import { CalendarBlankIcon } from "@phosphor-icons/react/dist/ssr/CalendarBlank";
|
|
17
|
-
|
|
17
|
+
// src/components/inputs/DatePicker/DatePicker.tsx
|
|
18
18
|
function toOutput(variant, selection, valueFormat) {
|
|
19
19
|
if (!selection) return valueFormat === "date" ? null : variant === "single" ? "" : {
|
|
20
20
|
from: "",
|
|
@@ -124,18 +124,18 @@ function DatePicker({ variant = "single", placeholder = variant === "single" ? "
|
|
|
124
124
|
className: cn(`
|
|
125
125
|
group relative flex w-fit items-center justify-start text-left font-normal
|
|
126
126
|
hover:transition-opacity
|
|
127
|
-
data-empty:text-
|
|
127
|
+
data-empty:text-tertiary
|
|
128
128
|
`, buttonClassName),
|
|
129
129
|
disabled: rest.disabled === true,
|
|
130
130
|
"aria-invalid": isFieldInvalid(false, ariaInvalid) || void 0,
|
|
131
131
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
132
132
|
className: "flex items-center justify-center gap-2",
|
|
133
|
-
children: [/* @__PURE__ */ jsx(CalendarBlankIcon, { className: "
|
|
133
|
+
children: [/* @__PURE__ */ jsx(CalendarBlankIcon, { className: "icon-control shrink-0 motion-fade-in" }), /* @__PURE__ */ jsx("span", {
|
|
134
134
|
className: "w-full text-center",
|
|
135
135
|
children: formatForDisplay()
|
|
136
136
|
})]
|
|
137
137
|
}), showClear && /* @__PURE__ */ jsx(ClearFade, {
|
|
138
|
-
className: "
|
|
138
|
+
className: "group-hover:fade-from-surface-overlay group-active:fade-from-surface-tertiary",
|
|
139
139
|
children: /* @__PURE__ */ jsx(ClearButton, {
|
|
140
140
|
focusable: false,
|
|
141
141
|
className: "pointer-events-none clear-visible:pointer-events-auto",
|
|
@@ -161,7 +161,6 @@ function DatePicker({ variant = "single", placeholder = variant === "single" ? "
|
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
DatePicker.displayName = "DatePicker";
|
|
164
|
-
//#endregion
|
|
165
164
|
export { DatePicker };
|
|
166
165
|
|
|
167
166
|
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.js","names":["React","formatFn"],"sources":["../../../../src/components/inputs/DatePicker/DatePicker.tsx"],"sourcesContent":["'use client'\n\nimport { CalendarBlankIcon } from '@phosphor-icons/react/dist/ssr/CalendarBlank'\nimport { format as formatFn, Locale } from 'date-fns'\nimport * as React from 'react'\nimport { PropsBase, PropsRangeRequired, PropsSingleRequired } from 'react-day-picker'\n\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../data-display/Popover'\nimport { Button, type ControlSize } from '../Button'\nimport { Calendar, type CalendarProps } from '../Calendar'\nimport { CalendarDayContext, ClearButton, ClearFade, isFieldInvalid } from '../shared'\n\nimport {\n formatOutputDate,\n formatOutputRange,\n InputDate,\n InputRange,\n parseInputDate,\n parseInputRange,\n ValueFormat,\n} from '@/lib/dateUtils'\nimport { useLocale, type SupportedLocaleString } from '@/lib/useLocale'\nimport { useIsMobile } from '@/lib/useMobile'\nimport { cn } from '@/lib/utils'\n\nexport type { SupportedLocaleString }\n\nexport type IsoDateRange = {\n from?: string\n to?: string\n}\n\nexport type DateRange = {\n from?: Date\n to?: Date\n}\n\nexport type DatePickerOutput<Variant extends 'single' | 'range', Format extends ValueFormat> = Variant extends 'single'\n ? Format extends 'date'\n ? Date | null\n : string | null\n : Format extends 'date'\n ? DateRange | null\n : IsoDateRange | null\n\nexport type DatePickerInput<V extends 'single' | 'range'> = V extends 'single'\n ? Date | string | null\n : { from?: Date | string; to?: Date | string } | null\n\nexport type DatePickerProps<V extends 'single' | 'range' = 'single', F extends ValueFormat = 'iso'> = {\n /**\n * Placeholder text displayed when no date is selected\n * @default 'Pick a date' for single mode, 'Pick a date range' for range mode\n */\n placeholder?: string\n\n /**\n * Format string to use when displaying the selected date in the button\n * @default 'MMM d, yyyy'\n */\n displayFormat?: string\n\n /**\n * ClassName for the button\n */\n buttonClassName?: string\n\n /**\n * Control height. sm 32px, md 40px, lg 48px. Heights are the `--control-height-*` tokens, so an app can change them (for example on touch).\n * @default lg\n */\n size?: ControlSize\n\n /**\n * Marks the trigger invalid (red border). `FormControl` sets it from the form state.\n */\n 'aria-invalid'?: React.AriaAttributes['aria-invalid']\n\n /**\n * Ids of the elements that describe the trigger. `FormControl` sets it to the form description and message.\n */\n 'aria-describedby'?: string\n\n /**\n * Whether to allow the user to show the year switcher menu\n * @default true for single mode, false for range mode\n */\n showYearSwitcher?: boolean\n\n /**\n * Initial value for the date picker\n * Accepts both Date objects and ISO strings regardless of valueFormat setting\n */\n initialValue?: DatePickerInput<V>\n\n /**\n * Current value for the date picker\n * Accepts both Date objects and ISO strings regardless of valueFormat setting\n */\n value?: DatePickerInput<V>\n\n /**\n * Determines if the picker should close after a selection\n * @default true for single mode, false for range mode\n */\n closeOnSelect?: boolean\n\n /**\n * Determines the format of the value provided to the onChange callback\n * - 'iso' (default): onChange receives ISO string(s) ('yyyy-MM-dd') or empty string for cleared values\n * - 'date': onChange receives JavaScript Date object(s) or null for cleared values\n *\n * Note: The component accepts both Date objects and ISO strings for value/initialValue\n * regardless of this setting. Empty values are sent as null (date format) or '' (iso format)\n * instead of undefined to work properly with React Hook Form.\n * @default 'iso'\n */\n valueFormat?: F\n\n /**\n * Callback when date or date range changes\n */\n onChange?: (value: DatePickerOutput<V, F>) => void\n\n /**\n * DatePicker mode - single date or date range\n * @default 'single'\n */\n variant?: V\n\n /**\n * The locale to use for formatting dates and determining the start of the week.\n * Can be a string identifier for supported locales ('enUS', 'es', 'pt', 'enGB', 'de', 'it', 'fr')\n * or a Locale object from date-fns/locale for other languages.\n * @default 'enUS'\n */\n locale?: SupportedLocaleString | Locale\n\n /**\n * Shows an X on hover that clears the selection. A function is also called whenever the selection becomes empty\n * (the X, or clicking the selected date again in the calendar).\n */\n onClear?: boolean | (() => void)\n\n /**\n * Weather the picker is inside a modal (needed for pointer events to work at mobile)\n */\n modal?: boolean\n\n /**\n * Container element to position the popover relative to.\n * @default document.body\n */\n container?: HTMLElement\n} & Pick<CalendarProps, 'disabledDayTooltip'> &\n Omit<PropsBase, 'mode' | 'selected' | 'onSelect' | 'locale'>\n\ntype Variant = 'single' | 'range'\n\nfunction toOutput<V extends Variant, F extends ValueFormat>(\n variant: V,\n selection: Date | DateRange | undefined,\n valueFormat: F,\n): DatePickerOutput<V, F> {\n if (!selection) {\n const empty = variant === 'single' ? '' : { from: '', to: '' }\n return (valueFormat === 'date' ? null : empty) as DatePickerOutput<V, F>\n }\n if (valueFormat === 'date') return selection as DatePickerOutput<V, F>\n const formatted =\n variant === 'single' ? formatOutputDate(selection as Date, 'iso') : formatOutputRange(selection as DateRange, 'iso')\n return formatted as DatePickerOutput<V, F>\n}\n\nfunction formatRange(range: DateRange | undefined, display: (date: Date) => string, placeholder: string) {\n if (!range?.from && !range?.to) return placeholder\n const from = range.from ? display(range.from) : '...'\n const to = range.to ? display(range.to) : '...'\n return `${from} - ${to}`\n}\n\nfunction useFocusCalendarOnMobile(isOpen: boolean, isMobile: boolean, ref: React.RefObject<HTMLDivElement | null>) {\n React.useEffect(() => {\n if (!isOpen || !isMobile || !ref.current) return\n const timeoutId = setTimeout(() => {\n const calendarElement = ref.current?.querySelector<HTMLElement>('[id=\"calendar\"]')\n calendarElement?.focus()\n }, 100)\n\n return () => clearTimeout(timeoutId)\n }, [isOpen, isMobile, ref])\n}\n\nfunction DatePicker<V extends Variant = 'single', F extends ValueFormat = 'iso'>({\n variant = 'single' as V,\n placeholder = variant === 'single' ? 'Pick a date' : 'Pick a date range',\n valueFormat = 'iso' as F,\n initialValue: initialValueProp,\n value: valueProp,\n onChange,\n buttonClassName,\n size = 'lg',\n 'aria-invalid': ariaInvalid,\n 'aria-describedby': ariaDescribedBy,\n id,\n displayFormat = 'MMM d, yyyy',\n closeOnSelect = variant === 'single',\n showYearSwitcher = variant === 'single',\n locale: localeProp = 'enUS',\n defaultMonth,\n onClear,\n modal = false,\n container,\n ...rest\n}: Readonly<DatePickerProps<V, F>>) {\n const [isOpen, setIsOpen] = React.useState(false)\n const isMobile = useIsMobile()\n const calendarRef = React.useRef<HTMLDivElement>(null)\n const isSingle = variant === 'single'\n\n const resolvedLocale = useLocale(localeProp)\n\n const [singleDate, setSingleDate] = React.useState<Date | undefined>(() =>\n isSingle ? parseInputDate(initialValueProp as InputDate) : undefined,\n )\n const [dateRange, setDateRange] = React.useState<DateRange | undefined>(() =>\n isSingle ? undefined : parseInputRange(initialValueProp as InputRange),\n )\n\n React.useEffect(() => {\n if (isSingle) {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- internal state must stay in sync with the externally-controlled `value` prop\n setSingleDate(parseInputDate(valueProp as InputDate))\n } else {\n setDateRange(parseInputRange(valueProp as InputRange))\n }\n }, [valueProp, isSingle])\n\n useFocusCalendarOnMobile(isOpen, isMobile, calendarRef)\n\n const handleSelect = React.useCallback(\n (selection: Date | DateRange | undefined) => {\n if (isSingle) {\n setSingleDate(selection as Date | undefined)\n } else {\n setDateRange(selection as DateRange | undefined)\n }\n\n onChange?.(toOutput(variant, selection, valueFormat))\n\n if (!selection && typeof onClear === 'function') onClear()\n if (isSingle && closeOnSelect) setIsOpen(false)\n },\n [isSingle, variant, valueFormat, onChange, onClear, closeOnSelect],\n )\n\n const handleClear = (event: React.MouseEvent) => {\n event.preventDefault()\n event.stopPropagation()\n handleSelect(undefined)\n }\n\n const formatForDisplay = () => {\n const display = (date: Date) => formatFn(date, displayFormat, { locale: resolvedLocale })\n if (isSingle) return singleDate ? display(singleDate) : placeholder\n return formatRange(dateRange, display, placeholder)\n }\n\n const baseCalendarProps = {\n defaultMonth: (isSingle ? singleDate : dateRange?.from) ?? defaultMonth,\n locale: resolvedLocale,\n initialFocus: true,\n ...rest,\n } as PropsBase\n\n const calendarProps = isSingle\n ? ({\n ...baseCalendarProps,\n mode: 'single' as const,\n selected: singleDate,\n onSelect: (date: Date | undefined) => handleSelect(date),\n } as PropsSingleRequired)\n : ({\n ...baseCalendarProps,\n mode: 'range' as const,\n selected: dateRange,\n onSelect: (range: DateRange | undefined) => handleSelect(range),\n numberOfMonths: rest.numberOfMonths ?? 2,\n } as PropsRangeRequired)\n\n const dayContextValue = React.useMemo(() => ({ container }), [container])\n\n const hasValue = isSingle ? singleDate : dateRange\n const showClear = Boolean(onClear && hasValue && rest.disabled !== true)\n\n return (\n <PopoverRoot open={isOpen} onOpenChange={setIsOpen} modal={modal}>\n <PopoverTrigger\n asChild\n onPointerDown={(event) => {\n event.stopPropagation()\n if (isOpen) event.preventDefault()\n setIsOpen(!isOpen)\n }}\n onClick={(event) => {\n if (event.detail === 0) return\n event.preventDefault()\n event.stopPropagation()\n }}\n >\n <Button\n id={id}\n aria-describedby={ariaDescribedBy}\n variant=\"input\"\n size={size}\n data-clearable={showClear || undefined}\n data-empty={hasValue ? undefined : ''}\n className={cn(\n `\n group relative flex w-fit items-center justify-start text-left font-normal\n hover:transition-opacity\n data-empty:text-neutral-500\n `,\n buttonClassName,\n )}\n disabled={rest.disabled === true}\n aria-invalid={isFieldInvalid(false, ariaInvalid) || undefined}\n >\n <div className=\"flex items-center justify-center gap-2\">\n <CalendarBlankIcon className=\"h-4 w-4 shrink-0 transition-opacity duration-150\" />\n <span className=\"w-full text-center\">{formatForDisplay()}</span>\n </div>\n {showClear && (\n <ClearFade\n className=\"\n group-hover:from-neutral-50 group-hover:via-neutral-50/80\n group-active:from-neutral-100 group-active:via-neutral-100/80\n \"\n >\n <ClearButton\n focusable={false}\n className=\"pointer-events-none clear-visible:pointer-events-auto\"\n onPointerDown={(event) => event.stopPropagation()}\n onClick={handleClear}\n />\n </ClearFade>\n )}\n </Button>\n </PopoverTrigger>\n <PopoverContent container={container} className=\"w-auto p-0\" align=\"center\" ref={calendarRef}>\n <CalendarDayContext.Provider value={dayContextValue}>\n <Calendar {...calendarProps} className=\"border-0\" showYearSwitcher={isSingle ? showYearSwitcher : false} />\n </CalendarDayContext.Provider>\n </PopoverContent>\n </PopoverRoot>\n )\n}\n\nDatePicker.displayName = 'DatePicker'\n\nexport { DatePicker }\n"],"mappings":";;;;;;;;;;;;;;;;;AA+JA,SAAA,SAAA,SAAA,WAAA,aAAA;CAKE,IAAA,CAAA,WAAA,OAAA,gBAAA,SAAA,OAAA,YAAA,WAAA,KAAA;EAC8C,MAAA;EAAU,IAAA;CAAO;CAG/D,IAAA,gBAAA,QAAA,OAAA;CAGA,OAAA,YAAA,WAAA,iBAAA,WAAA,KAAA,IAAA,kBAAA,WAAA,KAAA;AACF;AAEA,SAAA,YAAA,OAAA,SAAA,aAAA;CACE,IAAA,CAAA,OAAA,QAAA,CAAA,OAAA,IAAA,OAAA;CAGA,OAAA,GAAA,MAAA,OAAA,QAAA,MAAA,IAAA,IAAA,MAAA,KAAA,MAAA,KAAA,QAAA,MAAA,EAAA,IAAA;AACF;AAEA,SAAA,yBAAA,QAAA,UAAA,KAAA;CACE,QAAA,gBAAA;EACE,IAAA,CAAA,UAAA,CAAA,YAAA,CAAA,IAAA,SAAA;EACA,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mDAAA,CAAA,GAAA,oBAAA,QAAA;MAEQ,WAAA;MAAgC,UAAA,iBAAA;KAAyB,CAAA,CAAA;IAEhE,CAAA,GAAA,aAAA,oBAAA,WAAA;KAEG,WAAA;KAKA,UAAA,oBAAA,aAAA;MACE,WAAA;MACA,WAAA;MACA,gBAAA,UAAA,MAAA,gBAAA;MACA,SAAA;KACD,CAAA;IACQ,CAAA,CAAA;;EAGD,CAAA,GAAA,oBAAA,gBAAA;GACW;GAAW,WAAA;GAAuB,OAAA;GAAe,KAAA;GAC1E,UAAA,oBAAA,mBAAA,UAAA;IAA6B,OAAA;IAC3B,UAAA,oBAAA,UAAA;KAAU,GAAA;KAAmB,WAAA;KAAqB,kBAAA,WAAA,mBAAA;IAAwD,CAAA;GAC/E,CAAA;EACf,CAAA,CAAA;;AAGtB;AAEA,WAAA,cAAA"}
|
|
1
|
+
{"version":3,"file":"DatePicker.js","names":["React","formatFn"],"sources":["../../../../src/components/inputs/DatePicker/DatePicker.tsx"],"sourcesContent":["'use client'\n\nimport { CalendarBlankIcon } from '@phosphor-icons/react/dist/ssr/CalendarBlank'\nimport { format as formatFn, Locale } from 'date-fns'\nimport * as React from 'react'\nimport { PropsBase, PropsRangeRequired, PropsSingleRequired } from 'react-day-picker'\n\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../data-display/Popover'\nimport { Button, type ControlSize } from '../Button'\nimport { Calendar, type CalendarProps } from '../Calendar'\nimport { CalendarDayContext, ClearButton, ClearFade, isFieldInvalid } from '../shared'\n\nimport {\n formatOutputDate,\n formatOutputRange,\n InputDate,\n InputRange,\n parseInputDate,\n parseInputRange,\n ValueFormat,\n} from '@/lib/dateUtils'\nimport { useLocale, type SupportedLocaleString } from '@/lib/useLocale'\nimport { useIsMobile } from '@/lib/useMobile'\nimport { cn } from '@/lib/utils'\n\nexport type { SupportedLocaleString }\n\nexport type IsoDateRange = {\n from?: string\n to?: string\n}\n\nexport type DateRange = {\n from?: Date\n to?: Date\n}\n\nexport type DatePickerOutput<Variant extends 'single' | 'range', Format extends ValueFormat> = Variant extends 'single'\n ? Format extends 'date'\n ? Date | null\n : string | null\n : Format extends 'date'\n ? DateRange | null\n : IsoDateRange | null\n\nexport type DatePickerInput<V extends 'single' | 'range'> = V extends 'single'\n ? Date | string | null\n : { from?: Date | string; to?: Date | string } | null\n\nexport type DatePickerProps<V extends 'single' | 'range' = 'single', F extends ValueFormat = 'iso'> = {\n /**\n * Placeholder text displayed when no date is selected\n * @default 'Pick a date' for single mode, 'Pick a date range' for range mode\n */\n placeholder?: string\n\n /**\n * Format string to use when displaying the selected date in the button\n * @default 'MMM d, yyyy'\n */\n displayFormat?: string\n\n /**\n * ClassName for the button\n */\n buttonClassName?: string\n\n /**\n * Control height. sm 32px, md 40px, lg 48px. Heights are the `--control-height-*` tokens, so an app can change them (for example on touch).\n * @default lg\n */\n size?: ControlSize\n\n /**\n * Marks the trigger invalid (red border). `FormControl` sets it from the form state.\n */\n 'aria-invalid'?: React.AriaAttributes['aria-invalid']\n\n /**\n * Ids of the elements that describe the trigger. `FormControl` sets it to the form description and message.\n */\n 'aria-describedby'?: string\n\n /**\n * Whether to allow the user to show the year switcher menu\n * @default true for single mode, false for range mode\n */\n showYearSwitcher?: boolean\n\n /**\n * Initial value for the date picker\n * Accepts both Date objects and ISO strings regardless of valueFormat setting\n */\n initialValue?: DatePickerInput<V>\n\n /**\n * Current value for the date picker\n * Accepts both Date objects and ISO strings regardless of valueFormat setting\n */\n value?: DatePickerInput<V>\n\n /**\n * Determines if the picker should close after a selection\n * @default true for single mode, false for range mode\n */\n closeOnSelect?: boolean\n\n /**\n * Determines the format of the value provided to the onChange callback\n * - 'iso' (default): onChange receives ISO string(s) ('yyyy-MM-dd') or empty string for cleared values\n * - 'date': onChange receives JavaScript Date object(s) or null for cleared values\n *\n * Note: The component accepts both Date objects and ISO strings for value/initialValue\n * regardless of this setting. Empty values are sent as null (date format) or '' (iso format)\n * instead of undefined to work properly with React Hook Form.\n * @default 'iso'\n */\n valueFormat?: F\n\n /**\n * Callback when date or date range changes\n */\n onChange?: (value: DatePickerOutput<V, F>) => void\n\n /**\n * DatePicker mode - single date or date range\n * @default 'single'\n */\n variant?: V\n\n /**\n * The locale to use for formatting dates and determining the start of the week.\n * Can be a string identifier for supported locales ('enUS', 'es', 'pt', 'enGB', 'de', 'it', 'fr')\n * or a Locale object from date-fns/locale for other languages.\n * @default 'enUS'\n */\n locale?: SupportedLocaleString | Locale\n\n /**\n * Shows an X on hover that clears the selection. A function is also called whenever the selection becomes empty\n * (the X, or clicking the selected date again in the calendar).\n */\n onClear?: boolean | (() => void)\n\n /**\n * Weather the picker is inside a modal (needed for pointer events to work at mobile)\n */\n modal?: boolean\n\n /**\n * Container element to position the popover relative to.\n * @default document.body\n */\n container?: HTMLElement\n} & Pick<CalendarProps, 'disabledDayTooltip'> &\n Omit<PropsBase, 'mode' | 'selected' | 'onSelect' | 'locale'>\n\ntype Variant = 'single' | 'range'\n\nfunction toOutput<V extends Variant, F extends ValueFormat>(\n variant: V,\n selection: Date | DateRange | undefined,\n valueFormat: F,\n): DatePickerOutput<V, F> {\n if (!selection) {\n const empty = variant === 'single' ? '' : { from: '', to: '' }\n return (valueFormat === 'date' ? null : empty) as DatePickerOutput<V, F>\n }\n if (valueFormat === 'date') return selection as DatePickerOutput<V, F>\n const formatted =\n variant === 'single' ? formatOutputDate(selection as Date, 'iso') : formatOutputRange(selection as DateRange, 'iso')\n return formatted as DatePickerOutput<V, F>\n}\n\nfunction formatRange(range: DateRange | undefined, display: (date: Date) => string, placeholder: string) {\n if (!range?.from && !range?.to) return placeholder\n const from = range.from ? display(range.from) : '...'\n const to = range.to ? display(range.to) : '...'\n return `${from} - ${to}`\n}\n\nfunction useFocusCalendarOnMobile(isOpen: boolean, isMobile: boolean, ref: React.RefObject<HTMLDivElement | null>) {\n React.useEffect(() => {\n if (!isOpen || !isMobile || !ref.current) return\n const timeoutId = setTimeout(() => {\n const calendarElement = ref.current?.querySelector<HTMLElement>('[id=\"calendar\"]')\n calendarElement?.focus()\n }, 100)\n\n return () => clearTimeout(timeoutId)\n }, [isOpen, isMobile, ref])\n}\n\nfunction DatePicker<V extends Variant = 'single', F extends ValueFormat = 'iso'>({\n variant = 'single' as V,\n placeholder = variant === 'single' ? 'Pick a date' : 'Pick a date range',\n valueFormat = 'iso' as F,\n initialValue: initialValueProp,\n value: valueProp,\n onChange,\n buttonClassName,\n size = 'lg',\n 'aria-invalid': ariaInvalid,\n 'aria-describedby': ariaDescribedBy,\n id,\n displayFormat = 'MMM d, yyyy',\n closeOnSelect = variant === 'single',\n showYearSwitcher = variant === 'single',\n locale: localeProp = 'enUS',\n defaultMonth,\n onClear,\n modal = false,\n container,\n ...rest\n}: Readonly<DatePickerProps<V, F>>) {\n const [isOpen, setIsOpen] = React.useState(false)\n const isMobile = useIsMobile()\n const calendarRef = React.useRef<HTMLDivElement>(null)\n const isSingle = variant === 'single'\n\n const resolvedLocale = useLocale(localeProp)\n\n const [singleDate, setSingleDate] = React.useState<Date | undefined>(() =>\n isSingle ? parseInputDate(initialValueProp as InputDate) : undefined,\n )\n const [dateRange, setDateRange] = React.useState<DateRange | undefined>(() =>\n isSingle ? undefined : parseInputRange(initialValueProp as InputRange),\n )\n\n React.useEffect(() => {\n if (isSingle) {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- internal state must stay in sync with the externally-controlled `value` prop\n setSingleDate(parseInputDate(valueProp as InputDate))\n } else {\n setDateRange(parseInputRange(valueProp as InputRange))\n }\n }, [valueProp, isSingle])\n\n useFocusCalendarOnMobile(isOpen, isMobile, calendarRef)\n\n const handleSelect = React.useCallback(\n (selection: Date | DateRange | undefined) => {\n if (isSingle) {\n setSingleDate(selection as Date | undefined)\n } else {\n setDateRange(selection as DateRange | undefined)\n }\n\n onChange?.(toOutput(variant, selection, valueFormat))\n\n if (!selection && typeof onClear === 'function') onClear()\n if (isSingle && closeOnSelect) setIsOpen(false)\n },\n [isSingle, variant, valueFormat, onChange, onClear, closeOnSelect],\n )\n\n const handleClear = (event: React.MouseEvent) => {\n event.preventDefault()\n event.stopPropagation()\n handleSelect(undefined)\n }\n\n const formatForDisplay = () => {\n const display = (date: Date) => formatFn(date, displayFormat, { locale: resolvedLocale })\n if (isSingle) return singleDate ? display(singleDate) : placeholder\n return formatRange(dateRange, display, placeholder)\n }\n\n const baseCalendarProps = {\n defaultMonth: (isSingle ? singleDate : dateRange?.from) ?? defaultMonth,\n locale: resolvedLocale,\n initialFocus: true,\n ...rest,\n } as PropsBase\n\n const calendarProps = isSingle\n ? ({\n ...baseCalendarProps,\n mode: 'single' as const,\n selected: singleDate,\n onSelect: (date: Date | undefined) => handleSelect(date),\n } as PropsSingleRequired)\n : ({\n ...baseCalendarProps,\n mode: 'range' as const,\n selected: dateRange,\n onSelect: (range: DateRange | undefined) => handleSelect(range),\n numberOfMonths: rest.numberOfMonths ?? 2,\n } as PropsRangeRequired)\n\n const dayContextValue = React.useMemo(() => ({ container }), [container])\n\n const hasValue = isSingle ? singleDate : dateRange\n const showClear = Boolean(onClear && hasValue && rest.disabled !== true)\n\n return (\n <PopoverRoot open={isOpen} onOpenChange={setIsOpen} modal={modal}>\n <PopoverTrigger\n asChild\n onPointerDown={(event) => {\n event.stopPropagation()\n if (isOpen) event.preventDefault()\n setIsOpen(!isOpen)\n }}\n onClick={(event) => {\n if (event.detail === 0) return\n event.preventDefault()\n event.stopPropagation()\n }}\n >\n <Button\n id={id}\n aria-describedby={ariaDescribedBy}\n variant=\"input\"\n size={size}\n data-clearable={showClear || undefined}\n data-empty={hasValue ? undefined : ''}\n className={cn(\n `\n group relative flex w-fit items-center justify-start text-left font-normal\n hover:transition-opacity\n data-empty:text-tertiary\n `,\n buttonClassName,\n )}\n disabled={rest.disabled === true}\n aria-invalid={isFieldInvalid(false, ariaInvalid) || undefined}\n >\n <div className=\"flex items-center justify-center gap-2\">\n <CalendarBlankIcon className=\"icon-control shrink-0 motion-fade-in\" />\n <span className=\"w-full text-center\">{formatForDisplay()}</span>\n </div>\n {showClear && (\n <ClearFade className=\"group-hover:fade-from-surface-overlay group-active:fade-from-surface-tertiary\">\n <ClearButton\n focusable={false}\n className=\"pointer-events-none clear-visible:pointer-events-auto\"\n onPointerDown={(event) => event.stopPropagation()}\n onClick={handleClear}\n />\n </ClearFade>\n )}\n </Button>\n </PopoverTrigger>\n <PopoverContent container={container} className=\"w-auto p-0\" align=\"center\" ref={calendarRef}>\n <CalendarDayContext.Provider value={dayContextValue}>\n <Calendar {...calendarProps} className=\"border-0\" showYearSwitcher={isSingle ? showYearSwitcher : false} />\n </CalendarDayContext.Provider>\n </PopoverContent>\n </PopoverRoot>\n )\n}\n\nDatePicker.displayName = 'DatePicker'\n\nexport { DatePicker }\n"],"mappings":";;;;;;;;;;;;;;;;;AA+JA,SAAA,SAAA,SAAA,WAAA,aAAA;CAKE,IAAA,CAAA,WAAA,OAAA,gBAAA,SAAA,OAAA,YAAA,WAAA,KAAA;EAC8C,MAAA;EAAU,IAAA;CAAO;CAG/D,IAAA,gBAAA,QAAA,OAAA;CAGA,OAAA,YAAA,WAAA,iBAAA,WAAA,KAAA,IAAA,kBAAA,WAAA,KAAA;AACF;AAEA,SAAA,YAAA,OAAA,SAAA,aAAA;CACE,IAAA,CAAA,OAAA,QAAA,CAAA,OAAA,IAAA,OAAA;CAGA,OAAA,GAAA,MAAA,OAAA,QAAA,MAAA,IAAA,IAAA,MAAA,KAAA,MAAA,KAAA,QAAA,MAAA,EAAA,IAAA;AACF;AAEA,SAAA,yBAAA,QAAA,UAAA,KAAA;CACE,QAAA,gBAAA;EACE,IAAA,CAAA,UAAA,CAAA,YAAA,CAAA,IAAA,SAAA;EACA,MAAA,YAAA,iBAAA;GAEE,CAAA,IAAA,SAAA,cAAA,mBAAA,EAAA,EAAA,MAAA;EACF,GAAA,GAAA;EAEA,aAAA,aAAA,SAAA;CACF,GAAA;EAAI;EAAQ;EAAU;CAAG,CAAA;AAC3B;AAEA,SAAA,WAAA,EAAA,UAAA,UAAA,cAAA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BAAA;MACA,SAAA;KACD,CAAA;IACQ,CAAA,CAAA;;EAGD,CAAA,GAAA,oBAAA,gBAAA;GACW;GAAW,WAAA;GAAuB,OAAA;GAAe,KAAA;GAC1E,UAAA,oBAAA,mBAAA,UAAA;IAA6B,OAAA;IAC3B,UAAA,oBAAA,UAAA;KAAU,GAAA;KAAmB,WAAA;KAAqB,kBAAA,WAAA,mBAAA;IAAwD,CAAA;GAC/E,CAAA;EACf,CAAA,CAAA;;AAGtB;AAEA,WAAA,cAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
|
-
|
|
2
|
+
// src/components/inputs/DatePicker/hooks/useLocale.ts
|
|
3
3
|
var localeLoaderMap = {
|
|
4
4
|
enUS: () => import("date-fns/locale/en-US").then((module) => ({ default: module.enUS })),
|
|
5
5
|
es: () => import("date-fns/locale/es").then((module) => ({ default: module.es })),
|
|
@@ -26,7 +26,6 @@ function useLocale(localeProp = "enUS") {
|
|
|
26
26
|
}, [localeProp]);
|
|
27
27
|
return resolvedLocale;
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
export { useLocale };
|
|
31
30
|
|
|
32
31
|
//# sourceMappingURL=useLocale.js.map
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { DatePicker };
|
|
1
|
+
export { DatePicker } from "./DatePicker.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { cn } from "../../../lib/utils.js";
|
|
2
|
-
import { Typography } from "../../data-display/Typography/Typography.js";
|
|
3
1
|
import { Label } from "../../data-display/Label/Label.js";
|
|
4
2
|
import { Separator } from "../../data-display/Separator/Separator.js";
|
|
3
|
+
import { Typography } from "../../data-display/Typography/Typography.js";
|
|
4
|
+
import { cn } from "../../../lib/utils.js";
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
import * as React$1 from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
|
|
8
|
+
// src/components/inputs/Field/Field.tsx
|
|
9
9
|
var FieldSet = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("fieldset", {
|
|
10
10
|
ref,
|
|
11
11
|
"data-slot": "field-set",
|
|
@@ -17,7 +17,7 @@ var FieldLegend = React$1.forwardRef(({ className, variant = "legend", ...props
|
|
|
17
17
|
ref,
|
|
18
18
|
"data-slot": "field-legend",
|
|
19
19
|
"data-variant": variant,
|
|
20
|
-
className: cn("mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-
|
|
20
|
+
className: cn("mb-3 font-medium data-[variant=label]:text-title-sm data-[variant=legend]:text-title-md", className),
|
|
21
21
|
...props
|
|
22
22
|
}));
|
|
23
23
|
FieldLegend.displayName = "FieldLegend";
|
|
@@ -72,10 +72,10 @@ var FieldLabel = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
72
72
|
className: cn(`
|
|
73
73
|
group/field-label peer/field-label flex w-fit gap-2 leading-snug
|
|
74
74
|
*:data-[slot=field]:p-4
|
|
75
|
-
group-data-[disabled=true]/field:
|
|
76
|
-
has-data-[state=checked]:border-
|
|
75
|
+
group-data-[disabled=true]/field:text-tertiary
|
|
76
|
+
has-data-[state=checked]:border-focused has-data-[state=checked]:bg-surface-overlay
|
|
77
77
|
has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-lg
|
|
78
|
-
has-[>[data-slot=field]]:border has-[>[data-slot=field]]:border-
|
|
78
|
+
has-[>[data-slot=field]]:border has-[>[data-slot=field]]:border-subtle
|
|
79
79
|
`, className),
|
|
80
80
|
...props
|
|
81
81
|
}));
|
|
@@ -83,7 +83,10 @@ FieldLabel.displayName = "FieldLabel";
|
|
|
83
83
|
var FieldTitle = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
84
84
|
ref,
|
|
85
85
|
"data-slot": "field-label",
|
|
86
|
-
className: cn(
|
|
86
|
+
className: cn(`
|
|
87
|
+
flex w-fit items-center gap-2 text-title-sm leading-snug font-medium
|
|
88
|
+
group-data-[disabled=true]/field:text-tertiary
|
|
89
|
+
`, className),
|
|
87
90
|
...props
|
|
88
91
|
}));
|
|
89
92
|
FieldTitle.displayName = "FieldTitle";
|
|
@@ -98,7 +101,7 @@ var FieldDescription = React$1.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
98
101
|
nth-last-2:-mt-1
|
|
99
102
|
group-has-data-[orientation=horizontal]/field:text-balance
|
|
100
103
|
[&>a]:underline [&>a]:underline-offset-4
|
|
101
|
-
[&>a:hover]:text-
|
|
104
|
+
[&>a:hover]:text-brand
|
|
102
105
|
[[data-variant=legend]+&]:-mt-1.5
|
|
103
106
|
`, className),
|
|
104
107
|
...props
|
|
@@ -108,11 +111,11 @@ var FieldSeparator = React$1.forwardRef(({ children, className, ...props }, ref)
|
|
|
108
111
|
ref,
|
|
109
112
|
"data-slot": "field-separator",
|
|
110
113
|
"data-content": Boolean(children),
|
|
111
|
-
className: cn("relative -my-2 h-5 text-
|
|
114
|
+
className: cn("relative -my-2 h-5 text-body-md", className),
|
|
112
115
|
...props,
|
|
113
116
|
children: [/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }), children && /* @__PURE__ */ jsx("span", {
|
|
114
117
|
"data-slot": "field-separator-content",
|
|
115
|
-
className: "relative mx-auto block w-fit bg-
|
|
118
|
+
className: "relative mx-auto block w-fit bg-surface-primary px-2 text-secondary",
|
|
116
119
|
children
|
|
117
120
|
})]
|
|
118
121
|
}));
|
|
@@ -135,13 +138,12 @@ var FieldError = React$1.forwardRef(({ className, children, errors, ...props },
|
|
|
135
138
|
variant: "body-md",
|
|
136
139
|
color: "error",
|
|
137
140
|
"data-slot": "field-error",
|
|
138
|
-
className: cn("animate-in
|
|
141
|
+
className: cn("animate-in motion-feedback fade-in-0 slide-in-from-top-1 motion-reduce:slide-in-from-top-0", className),
|
|
139
142
|
...props,
|
|
140
143
|
children: content
|
|
141
144
|
});
|
|
142
145
|
});
|
|
143
146
|
FieldError.displayName = "FieldError";
|
|
144
|
-
//#endregion
|
|
145
147
|
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
146
148
|
|
|
147
149
|
//# sourceMappingURL=Field.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","names":["React"],"sources":["../../../../src/components/inputs/Field/Field.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { Label } from '../../data-display/Label'\nimport { Separator } from '../../data-display/Separator'\nimport { Typography, type TypographyProps } from '../../data-display/Typography'\n\nimport { cn } from '@/lib/utils'\n\nconst FieldSet = React.forwardRef<HTMLFieldSetElement, Readonly<React.ComponentPropsWithoutRef<'fieldset'>>>(\n ({ className, ...props }, ref) => (\n <fieldset ref={ref} data-slot=\"field-set\" className={cn('flex flex-col gap-6', className)} {...props} />\n ),\n)\nFieldSet.displayName = 'FieldSet'\n\ntype FieldLegendProps = React.ComponentPropsWithoutRef<'legend'> & {\n /** `legend` titles a group of fields; `label` styles it like a single field's label. */\n variant?: 'legend' | 'label'\n}\n\nconst FieldLegend = React.forwardRef<HTMLLegendElement, Readonly<FieldLegendProps>>(\n ({ className, variant = 'legend', ...props }, ref) => (\n <legend\n ref={ref}\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn('mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base', className)}\n {...props}\n />\n ),\n)\nFieldLegend.displayName = 'FieldLegend'\n\nconst FieldGroup = React.forwardRef<HTMLDivElement, Readonly<React.ComponentPropsWithoutRef<'div'>>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group flex w-full flex-col gap-7 *:data-[slot=field-group]:gap-4',\n className,\n )}\n {...props}\n />\n ),\n)\nFieldGroup.displayName = 'FieldGroup'\n\nconst fieldVariants = cva('group/field flex w-full gap-3', {\n variants: {\n orientation: {\n vertical: 'flex-col *:w-full [&>.sr-only]:w-auto',\n horizontal: `\n flex-row items-center\n *:data-[slot=field-label]:flex-auto\n has-[>[data-slot=field-content]]:items-start\n has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\n `,\n responsive: `\n flex-col\n *:w-full\n @md/field-group:flex-row @md/field-group:items-center\n @md/field-group:*:w-auto\n @md/field-group:*:data-[slot=field-label]:flex-auto\n @md/field-group:has-[>[data-slot=field-content]]:items-start\n @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\n [&>.sr-only]:w-auto\n `,\n },\n },\n defaultVariants: { orientation: 'vertical' },\n})\n\ntype FieldProps = React.ComponentPropsWithoutRef<'div'> & VariantProps<typeof fieldVariants>\n\nconst Field = React.forwardRef<HTMLDivElement, Readonly<FieldProps>>(({ className, orientation, ...props }, ref) => (\n <div\n ref={ref}\n role=\"group\"\n data-slot=\"field\"\n data-orientation={orientation ?? 'vertical'}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n))\nField.displayName = 'Field'\n\nconst FieldContent = React.forwardRef<HTMLDivElement, Readonly<React.ComponentPropsWithoutRef<'div'>>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"field-content\"\n className={cn('group/field-content flex flex-1 flex-col gap-1.5 leading-snug', className)}\n {...props}\n />\n ),\n)\nFieldContent.displayName = 'FieldContent'\n\nconst FieldLabel = React.forwardRef<\n React.ComponentRef<typeof Label>,\n Readonly<React.ComponentPropsWithoutRef<typeof Label>>\n>(({ className, ...props }, ref) => (\n <Label\n ref={ref}\n data-slot=\"field-label\"\n className={cn(\n `\n group/field-label peer/field-label flex w-fit gap-2 leading-snug\n *:data-[slot=field]:p-4\n group-data-[disabled=true]/field:opacity-50\n has-data-[state=checked]:border-neutral-950 has-data-[state=checked]:bg-neutral-50\n has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-lg\n has-[>[data-slot=field]]:border has-[>[data-slot=field]]:border-neutral-200\n `,\n className,\n )}\n {...props}\n />\n))\nFieldLabel.displayName = 'FieldLabel'\n\nconst FieldTitle = React.forwardRef<HTMLDivElement, Readonly<React.ComponentPropsWithoutRef<'div'>>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"field-label\"\n className={cn(\n 'flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50',\n className,\n )}\n {...props}\n />\n ),\n)\nFieldTitle.displayName = 'FieldTitle'\n\nconst FieldDescription = React.forwardRef<HTMLParagraphElement, Readonly<TypographyProps>>(\n ({ className, ...props }, ref) => (\n <Typography\n ref={ref}\n component=\"p\"\n variant=\"body-md\"\n color=\"secondary\"\n data-slot=\"field-description\"\n className={cn(\n `\n last:mt-0\n nth-last-2:-mt-1\n group-has-data-[orientation=horizontal]/field:text-balance\n [&>a]:underline [&>a]:underline-offset-4\n [&>a:hover]:text-primary-600\n [[data-variant=legend]+&]:-mt-1.5\n `,\n className,\n )}\n {...props}\n />\n ),\n)\nFieldDescription.displayName = 'FieldDescription'\n\nconst FieldSeparator = React.forwardRef<HTMLDivElement, Readonly<React.ComponentPropsWithoutRef<'div'>>>(\n ({ children, className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"field-separator\"\n data-content={Boolean(children)}\n className={cn('relative -my-2 h-5 text-sm', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n data-slot=\"field-separator-content\"\n className=\"relative mx-auto block w-fit bg-white px-2 text-neutral-700\"\n >\n {children}\n </span>\n )}\n </div>\n ),\n)\nFieldSeparator.displayName = 'FieldSeparator'\n\ntype FieldErrorProps = TypographyProps & {\n /** Messages to show, such as react-hook-form's `fieldState.error`. Duplicates are shown once; several become a list. Children take precedence. */\n errors?: Array<{ message?: string } | undefined>\n}\n\nfunction errorContent(children: React.ReactNode, errors: FieldErrorProps['errors']) {\n if (children) return children\n const messages = [...new Set(errors?.map((error) => error?.message).filter(Boolean))]\n if (messages.length === 0) return null\n if (messages.length === 1) return messages[0]\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {messages.map((message) => (\n <li key={message}>{message}</li>\n ))}\n </ul>\n )\n}\n\nconst FieldError = React.forwardRef<HTMLParagraphElement, Readonly<FieldErrorProps>>(\n ({ className, children, errors, ...props }, ref) => {\n const content = errorContent(children, errors)\n if (!content) return null\n\n return (\n <Typography\n ref={ref}\n variant=\"body-md\"\n color=\"error\"\n data-slot=\"field-error\"\n className={cn(\n 'animate-in duration-150 ease-out-strong fade-in-0 slide-in-from-top-1 motion-reduce:slide-in-from-top-0',\n className,\n )}\n {...props}\n >\n {content}\n </Typography>\n )\n },\n)\nFieldError.displayName = 'FieldError'\n\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n}\nexport type { FieldErrorProps, FieldLegendProps, FieldProps }\n"],"mappings":";;;;;;;;AASA,IAAM,WAAWA,QAAM,YACpB,EAAE,WAAW,GAAG,SAAS,QACxB,oBAAC,YAAD;CAAe;CAAK,aAAU;CAAY,WAAW,GAAG,uBAAuB,SAAS;CAAG,GAAI;AAAQ,CAAA,CAE3G;AACA,SAAS,cAAc;AAOvB,IAAM,cAAcA,QAAM,YACvB,EAAE,WAAW,UAAU,UAAU,GAAG,SAAS,QAC5C,oBAAC,UAAD;CACO;CACL,aAAU;CACV,gBAAc;CACd,WAAW,GAAG,iFAAiF,SAAS;CACxG,GAAI;AACL,CAAA,CAEL;AACA,YAAY,cAAc;AAE1B,IAAM,aAAaA,QAAM,YACtB,EAAE,WAAW,GAAG,SAAS,QACxB,oBAAC,OAAD;CACO;CACL,aAAU;CACV,WAAW,GACT,uGACA,SACF;CACA,GAAI;AACL,CAAA,CAEL;A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QAAQ,QAAQ;CAC9B,WAAW,GAAG,8BAA8B,SAAS;CACrD,GAAI;CALN,UAAA,CAOE,oBAAC,WAAD,EAAW,WAAU,2BAA4B,CAAA,GAChD,YACC,oBAAC,QAAD;EACE,aAAU;EACV,WAAU;EAET;CACG,CAAA,CAEL;AAET,CAAA,CAAA;AACA,eAAe,cAAc;AAO7B,SAAS,aAAa,UAA2B,QAAmC;CAClF,IAAI,UAAU,OAAO;CACrB,MAAM,WAAW,CAAC,GAAG,IAAI,IAAI,QAAQ,KAAK,UAAU,OAAO,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC;CACpF,IAAI,SAAS,WAAW,GAAG,OAAO;CAClC,IAAI,SAAS,WAAW,GAAG,OAAO,SAAS;CAC3C,OACE,oBAAC,MAAD;EAAI,WAAU;EACX,UAAA,SAAS,KAAK,YACb,oBAAC,MAAD,EAAA,UAAmB,QAAY,GAAtB,OAAsB,CAChC;CACC,CAAA;AAER;AAEA,IAAM,aAAaA,QAAM,YACtB,EAAE,WAAW,UAAU,QAAQ,GAAG,SAAS,QAAQ;CAClD,MAAM,UAAU,aAAa,UAAU,MAAM;CAC7C,IAAI,CAAC,SAAS,OAAO;CAErB,OACE,oBAAC,YAAD;EACO;EACL,SAAQ;EACR,OAAM;EACN,aAAU;EACV,WAAW,GACT,2GACA,SACF;EACA,GAAI;EAEH,UAAA;CACS,CAAA;AAEhB,CACF;AACA,WAAW,cAAc"}
|
|
1
|
+
{"version":3,"file":"Field.js","names":["React"],"sources":["../../../../src/components/inputs/Field/Field.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { Label } from '../../data-display/Label'\nimport { Separator } from '../../data-display/Separator'\nimport { Typography, type TypographyProps } from '../../data-display/Typography'\n\nimport { cn } from '@/lib/utils'\n\nconst FieldSet = React.forwardRef<HTMLFieldSetElement, Readonly<React.ComponentPropsWithoutRef<'fieldset'>>>(\n ({ className, ...props }, ref) => (\n <fieldset ref={ref} data-slot=\"field-set\" className={cn('flex flex-col gap-6', className)} {...props} />\n ),\n)\nFieldSet.displayName = 'FieldSet'\n\ntype FieldLegendProps = React.ComponentPropsWithoutRef<'legend'> & {\n /** `legend` titles a group of fields; `label` styles it like a single field's label. */\n variant?: 'legend' | 'label'\n}\n\nconst FieldLegend = React.forwardRef<HTMLLegendElement, Readonly<FieldLegendProps>>(\n ({ className, variant = 'legend', ...props }, ref) => (\n <legend\n ref={ref}\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n 'mb-3 font-medium data-[variant=label]:text-title-sm data-[variant=legend]:text-title-md',\n className,\n )}\n {...props}\n />\n ),\n)\nFieldLegend.displayName = 'FieldLegend'\n\nconst FieldGroup = React.forwardRef<HTMLDivElement, Readonly<React.ComponentPropsWithoutRef<'div'>>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group flex w-full flex-col gap-7 *:data-[slot=field-group]:gap-4',\n className,\n )}\n {...props}\n />\n ),\n)\nFieldGroup.displayName = 'FieldGroup'\n\nconst fieldVariants = cva('group/field flex w-full gap-3', {\n variants: {\n orientation: {\n vertical: 'flex-col *:w-full [&>.sr-only]:w-auto',\n horizontal: `\n flex-row items-center\n *:data-[slot=field-label]:flex-auto\n has-[>[data-slot=field-content]]:items-start\n has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\n `,\n responsive: `\n flex-col\n *:w-full\n @md/field-group:flex-row @md/field-group:items-center\n @md/field-group:*:w-auto\n @md/field-group:*:data-[slot=field-label]:flex-auto\n @md/field-group:has-[>[data-slot=field-content]]:items-start\n @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\n [&>.sr-only]:w-auto\n `,\n },\n },\n defaultVariants: { orientation: 'vertical' },\n})\n\ntype FieldProps = React.ComponentPropsWithoutRef<'div'> & VariantProps<typeof fieldVariants>\n\nconst Field = React.forwardRef<HTMLDivElement, Readonly<FieldProps>>(({ className, orientation, ...props }, ref) => (\n <div\n ref={ref}\n role=\"group\"\n data-slot=\"field\"\n data-orientation={orientation ?? 'vertical'}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n))\nField.displayName = 'Field'\n\nconst FieldContent = React.forwardRef<HTMLDivElement, Readonly<React.ComponentPropsWithoutRef<'div'>>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"field-content\"\n className={cn('group/field-content flex flex-1 flex-col gap-1.5 leading-snug', className)}\n {...props}\n />\n ),\n)\nFieldContent.displayName = 'FieldContent'\n\nconst FieldLabel = React.forwardRef<\n React.ComponentRef<typeof Label>,\n Readonly<React.ComponentPropsWithoutRef<typeof Label>>\n>(({ className, ...props }, ref) => (\n <Label\n ref={ref}\n data-slot=\"field-label\"\n className={cn(\n `\n group/field-label peer/field-label flex w-fit gap-2 leading-snug\n *:data-[slot=field]:p-4\n group-data-[disabled=true]/field:text-tertiary\n has-data-[state=checked]:border-focused has-data-[state=checked]:bg-surface-overlay\n has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-lg\n has-[>[data-slot=field]]:border has-[>[data-slot=field]]:border-subtle\n `,\n className,\n )}\n {...props}\n />\n))\nFieldLabel.displayName = 'FieldLabel'\n\nconst FieldTitle = React.forwardRef<HTMLDivElement, Readonly<React.ComponentPropsWithoutRef<'div'>>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"field-label\"\n className={cn(\n `\n flex w-fit items-center gap-2 text-title-sm leading-snug font-medium\n group-data-[disabled=true]/field:text-tertiary\n `,\n className,\n )}\n {...props}\n />\n ),\n)\nFieldTitle.displayName = 'FieldTitle'\n\nconst FieldDescription = React.forwardRef<HTMLParagraphElement, Readonly<TypographyProps>>(\n ({ className, ...props }, ref) => (\n <Typography\n ref={ref}\n component=\"p\"\n variant=\"body-md\"\n color=\"secondary\"\n data-slot=\"field-description\"\n className={cn(\n `\n last:mt-0\n nth-last-2:-mt-1\n group-has-data-[orientation=horizontal]/field:text-balance\n [&>a]:underline [&>a]:underline-offset-4\n [&>a:hover]:text-brand\n [[data-variant=legend]+&]:-mt-1.5\n `,\n className,\n )}\n {...props}\n />\n ),\n)\nFieldDescription.displayName = 'FieldDescription'\n\nconst FieldSeparator = React.forwardRef<HTMLDivElement, Readonly<React.ComponentPropsWithoutRef<'div'>>>(\n ({ children, className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"field-separator\"\n data-content={Boolean(children)}\n className={cn('relative -my-2 h-5 text-body-md', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n data-slot=\"field-separator-content\"\n className=\"relative mx-auto block w-fit bg-surface-primary px-2 text-secondary\"\n >\n {children}\n </span>\n )}\n </div>\n ),\n)\nFieldSeparator.displayName = 'FieldSeparator'\n\ntype FieldErrorProps = TypographyProps & {\n /** Messages to show, such as react-hook-form's `fieldState.error`. Duplicates are shown once; several become a list. Children take precedence. */\n errors?: Array<{ message?: string } | undefined>\n}\n\nfunction errorContent(children: React.ReactNode, errors: FieldErrorProps['errors']) {\n if (children) return children\n const messages = [...new Set(errors?.map((error) => error?.message).filter(Boolean))]\n if (messages.length === 0) return null\n if (messages.length === 1) return messages[0]\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {messages.map((message) => (\n <li key={message}>{message}</li>\n ))}\n </ul>\n )\n}\n\nconst FieldError = React.forwardRef<HTMLParagraphElement, Readonly<FieldErrorProps>>(\n ({ className, children, errors, ...props }, ref) => {\n const content = errorContent(children, errors)\n if (!content) return null\n\n return (\n <Typography\n ref={ref}\n variant=\"body-md\"\n color=\"error\"\n data-slot=\"field-error\"\n className={cn(\n 'animate-in motion-feedback fade-in-0 slide-in-from-top-1 motion-reduce:slide-in-from-top-0',\n className,\n )}\n {...props}\n >\n {content}\n </Typography>\n )\n },\n)\nFieldError.displayName = 'FieldError'\n\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n}\nexport type { FieldErrorProps, FieldLegendProps, FieldProps }\n"],"mappings":";;;;;;;;AASA,IAAM,WAAWA,QAAM,YACpB,EAAE,WAAW,GAAG,SAAS,QACxB,oBAAC,YAAD;CAAe;CAAK,aAAU;CAAY,WAAW,GAAG,uBAAuB,SAAS;CAAG,GAAI;AAAQ,CAAA,CAE3G;AACA,SAAS,cAAc;AAOvB,IAAM,cAAcA,QAAM,YACvB,EAAE,WAAW,UAAU,UAAU,GAAG,SAAS,QAC5C,oBAAC,UAAD;CACO;CACL,aAAU;CACV,gBAAc;CACd,WAAW,GACT,2FACA,SACF;CACA,GAAI;AACL,CAAA,CAEL;AACA,YAAY,cAAc;AAE1B,IAAM,aAAaA,QAAM,YACtB,EAAE,WAAW,GAAG,SAAS,QACxB,oBAAC,OAAD;CACO;CACL,aAAU;CACV,WAAW,GACT,uGACA,SACF;CACA,GAAI;AACL,CAAA,CAEL;AACA,WAAW,cAAc;AAEzB,IAAM,gBAAgB,IAAI,iCAAiC;CACzD,UAAU,EACR,aAAa;EACX,UAAU;EACV,YAAY;;;;;;EAMZ,YAAY;;;;;;;;;;CAUd,EACF;CACA,iBAAiB,EAAE,aAAa,WAAW;AAC7C,CAAC;AAID,IAAM,QAAQA,QAAM,YAAkD,EAAE,WAAW,aAAa,GAAG,SAAS,QAC1G,oBAAC,OAAD;CACO;CACL,MAAK;CACL,aAAU;CACV,oBAAkB,eAAe;CACjC,WAAW,GAAG,cAAc,EAAE,YAAY,CAAC,GAAG,SAAS;CACvD,GAAI;AACL,CAAA,CACF;AACD,MAAM,cAAc;AAEpB,IAAM,eAAeA,QAAM,YACxB,EAAE,WAAW,GAAG,SAAS,QACxB,oBAAC,OAAD;CACO;CACL,aAAU;CACV,WAAW,GAAG,iEAAiE,SAAS;CACxF,GAAI;AACL,CAAA,CAEL;AACA,aAAa,cAAc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sB,CAChC;CACC,CAAA;AAER;AAEA,IAAM,aAAaA,QAAM,YACtB,EAAE,WAAW,UAAU,QAAQ,GAAG,SAAS,QAAQ;CAClD,MAAM,UAAU,aAAa,UAAU,MAAM;CAC7C,IAAI,CAAC,SAAS,OAAO;CAErB,OACE,oBAAC,YAAD;EACO;EACL,SAAQ;EACR,OAAM;EACN,aAAU;EACV,WAAW,GACT,8FACA,SACF;EACA,GAAI;EAEH,UAAA;CACS,CAAA;AAEhB,CACF;AACA,WAAW,cAAc"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
1
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "./Field.js";
|
|
@@ -19,7 +19,7 @@ declare const useFormField: () => {
|
|
|
19
19
|
declare const FormItem: React.ForwardRefExoticComponent<Readonly<React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
|
|
20
20
|
declare const FormLabel: React.ForwardRefExoticComponent<Readonly<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref">> & React.RefAttributes<HTMLLabelElement>>;
|
|
21
21
|
declare const FormControl: React.ForwardRefExoticComponent<Readonly<Omit<React.HTMLAttributes<HTMLElement> & {
|
|
22
|
-
children?: React.ReactNode;
|
|
22
|
+
children?: React.ReactNode | undefined;
|
|
23
23
|
} & React.RefAttributes<HTMLElement>, "ref">> & React.RefAttributes<HTMLElement>>;
|
|
24
24
|
declare const FormDescription: React.ForwardRefExoticComponent<Readonly<React.HTMLAttributes<HTMLParagraphElement>> & React.RefAttributes<HTMLParagraphElement>>;
|
|
25
25
|
declare const FormMessage: React.ForwardRefExoticComponent<Readonly<TypographyProps> & React.RefAttributes<HTMLParagraphElement>>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { cn } from "../../../lib/utils.js";
|
|
4
|
-
import { Typography } from "../../data-display/Typography/Typography.js";
|
|
5
3
|
import { Label } from "../../data-display/Label/Label.js";
|
|
4
|
+
import { Typography } from "../../data-display/Typography/Typography.js";
|
|
6
5
|
import { FieldError } from "../Field/Field.js";
|
|
6
|
+
import { cn } from "../../../lib/utils.js";
|
|
7
7
|
import * as React$1 from "react";
|
|
8
8
|
import { Slot } from "@radix-ui/react-slot";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
10
10
|
import { Controller, FormProvider, useFormContext } from "react-hook-form";
|
|
11
|
-
|
|
11
|
+
// src/components/inputs/Form/Form.tsx
|
|
12
12
|
var Form = FormProvider;
|
|
13
13
|
var FormFieldContext = React$1.createContext({});
|
|
14
14
|
var FormField = ({ ...props }) => {
|
|
@@ -73,7 +73,7 @@ var FormDescription = React$1.forwardRef(({ className, ...props }, ref) => {
|
|
|
73
73
|
return /* @__PURE__ */ jsx("p", {
|
|
74
74
|
ref,
|
|
75
75
|
id: formDescriptionId,
|
|
76
|
-
className: cn("text-
|
|
76
|
+
className: cn("text-body-md text-secondary", className),
|
|
77
77
|
...props
|
|
78
78
|
});
|
|
79
79
|
});
|
|
@@ -95,13 +95,12 @@ var FormMessage = React$1.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
95
95
|
id: formMessageId,
|
|
96
96
|
component: "p",
|
|
97
97
|
variant: "body-md",
|
|
98
|
-
className: cn("flex items-center gap-2 text-
|
|
98
|
+
className: cn("flex items-center gap-2 text-tertiary", className),
|
|
99
99
|
...props,
|
|
100
100
|
children: body
|
|
101
101
|
});
|
|
102
102
|
});
|
|
103
103
|
FormMessage.displayName = "FormMessage";
|
|
104
|
-
//#endregion
|
|
105
104
|
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
|
106
105
|
|
|
107
106
|
//# sourceMappingURL=Form.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","names":["React"],"sources":["../../../../src/components/inputs/Form/Form.tsx"],"sourcesContent":["'use client'\nimport * as LabelPrimitive from '@radix-ui/react-label'\nimport { Slot } from '@radix-ui/react-slot'\nimport * as React from 'react'\nimport { Controller, ControllerProps, FieldPath, FieldValues, FormProvider, useFormContext } from 'react-hook-form'\n\nimport { Label } from '../../data-display/Label'\nimport { Typography, type TypographyProps } from '../../data-display/Typography'\nimport { FieldError } from '../Field'\n\nimport { cn } from '@/lib/utils'\n\nconst Form = FormProvider\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue)\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: Readonly<ControllerProps<TFieldValues, TName>>) => {\n const contextValue = React.useMemo(() => ({ name: props.name }), [props.name])\n\n return (\n <FormFieldContext.Provider value={contextValue}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n )\n}\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext)\n const itemContext = React.useContext(FormItemContext)\n const { getFieldState, formState } = useFormContext()\n\n const fieldState = getFieldState(fieldContext.name, formState)\n\n const { id } = itemContext\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n }\n}\n\ntype FormItemContextValue = {\n id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue)\n\nconst FormItem = React.forwardRef<HTMLDivElement, Readonly<React.HTMLAttributes<HTMLDivElement>>>(\n ({ className, ...props }, ref) => {\n const id = React.useId()\n const contextValue = React.useMemo(() => ({ id }), [id])\n\n return (\n <FormItemContext.Provider value={contextValue}>\n <div ref={ref} className={cn('space-y-2', className)} {...props} />\n </FormItemContext.Provider>\n )\n },\n)\nFormItem.displayName = 'FormItem'\n\nconst FormLabel = React.forwardRef<\n React.ComponentRef<typeof LabelPrimitive.Root>,\n Readonly<React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>>\n>(({ className, ...props }, ref) => {\n const { formItemId } = useFormField()\n\n return <Label ref={ref} className={className} htmlFor={formItemId} {...props} />\n})\nFormLabel.displayName = 'FormLabel'\n\nconst FormControl = React.forwardRef<\n React.ComponentRef<typeof Slot>,\n Readonly<React.ComponentPropsWithoutRef<typeof Slot>>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField()\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={`${formDescriptionId} ${error ? formMessageId : ''}`}\n aria-invalid={!!error}\n {...props}\n />\n )\n})\nFormControl.displayName = 'FormControl'\n\nconst FormDescription = React.forwardRef<HTMLParagraphElement, Readonly<React.HTMLAttributes<HTMLParagraphElement>>>(\n ({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField()\n\n return <p ref={ref} id={formDescriptionId} className={cn('text-
|
|
1
|
+
{"version":3,"file":"Form.js","names":["React"],"sources":["../../../../src/components/inputs/Form/Form.tsx"],"sourcesContent":["'use client'\nimport * as LabelPrimitive from '@radix-ui/react-label'\nimport { Slot } from '@radix-ui/react-slot'\nimport * as React from 'react'\nimport { Controller, ControllerProps, FieldPath, FieldValues, FormProvider, useFormContext } from 'react-hook-form'\n\nimport { Label } from '../../data-display/Label'\nimport { Typography, type TypographyProps } from '../../data-display/Typography'\nimport { FieldError } from '../Field'\n\nimport { cn } from '@/lib/utils'\n\nconst Form = FormProvider\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue)\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: Readonly<ControllerProps<TFieldValues, TName>>) => {\n const contextValue = React.useMemo(() => ({ name: props.name }), [props.name])\n\n return (\n <FormFieldContext.Provider value={contextValue}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n )\n}\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext)\n const itemContext = React.useContext(FormItemContext)\n const { getFieldState, formState } = useFormContext()\n\n const fieldState = getFieldState(fieldContext.name, formState)\n\n const { id } = itemContext\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n }\n}\n\ntype FormItemContextValue = {\n id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue)\n\nconst FormItem = React.forwardRef<HTMLDivElement, Readonly<React.HTMLAttributes<HTMLDivElement>>>(\n ({ className, ...props }, ref) => {\n const id = React.useId()\n const contextValue = React.useMemo(() => ({ id }), [id])\n\n return (\n <FormItemContext.Provider value={contextValue}>\n <div ref={ref} className={cn('space-y-2', className)} {...props} />\n </FormItemContext.Provider>\n )\n },\n)\nFormItem.displayName = 'FormItem'\n\nconst FormLabel = React.forwardRef<\n React.ComponentRef<typeof LabelPrimitive.Root>,\n Readonly<React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>>\n>(({ className, ...props }, ref) => {\n const { formItemId } = useFormField()\n\n return <Label ref={ref} className={className} htmlFor={formItemId} {...props} />\n})\nFormLabel.displayName = 'FormLabel'\n\nconst FormControl = React.forwardRef<\n React.ComponentRef<typeof Slot>,\n Readonly<React.ComponentPropsWithoutRef<typeof Slot>>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField()\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={`${formDescriptionId} ${error ? formMessageId : ''}`}\n aria-invalid={!!error}\n {...props}\n />\n )\n})\nFormControl.displayName = 'FormControl'\n\nconst FormDescription = React.forwardRef<HTMLParagraphElement, Readonly<React.HTMLAttributes<HTMLParagraphElement>>>(\n ({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField()\n\n return <p ref={ref} id={formDescriptionId} className={cn('text-body-md text-secondary', className)} {...props} />\n },\n)\nFormDescription.displayName = 'FormDescription'\n\nconst FormMessage = React.forwardRef<HTMLParagraphElement, Readonly<TypographyProps>>(\n ({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField()\n const body = error ? String(error.message) : children\n\n if (!body) {\n return null\n }\n\n if (error) {\n return (\n <FieldError\n ref={ref}\n id={formMessageId}\n component=\"p\"\n className={cn('flex items-center gap-2', className)}\n {...props}\n >\n {body}\n </FieldError>\n )\n }\n\n return (\n <Typography\n ref={ref}\n id={formMessageId}\n component=\"p\"\n variant=\"body-md\"\n className={cn('flex items-center gap-2 text-tertiary', className)}\n {...props}\n >\n {body}\n </Typography>\n )\n },\n)\n\nFormMessage.displayName = 'FormMessage'\n\nexport { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField }\n"],"mappings":";;;;;;;;;;;AAYA,IAAA,OAAA;AASA,IAAA,mBAAA,QAAA,cAAA,CAAA,CAAA;AAEA,IAAA,aAAA,EAAA,GAAA,YAAA;CAME,MAAA,eAAA,QAAA,eAAA,EAAA,MAAA,MAAA,KAAA,IAAA,CAAA,MAAA,IAAA,CAAA;CAEA,OAAA,oBAAA,iBAAA,UAAA;EAC6B,OAAA;EACzB,UAAA,oBAAA,YAAA,EAAA,GAAA,MAAA,CAAA;CACyB,CAAA;AAE/B;AAEA,IAAA,qBAAA;CACE,MAAA,eAAA,QAAA,WAAA,gBAAA;CACA,MAAA,cAAA,QAAA,WAAA,eAAA;CACA,MAAA,EAAA,eAAA,cAAA,eAAA;CAEA,MAAA,aAAA,cAAA,aAAA,MAAA,SAAA;CAEA,MA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AAA,WAAA,UAAA,GAAA,SAAA,QAAA;CAEI,MAAA,EAAA,OAAA,kBAAA,aAAA;CACA,MAAA,OAAA,QAAA,OAAA,MAAA,OAAA,IAAA;CAEA,IAAA,CAAA,MAAA,OAAA;CAIA,IAAA,OAAA,OAAA,oBAAA,YAAA;EAGW;EACL,IAAA;EACA,WAAA;EACA,WAAA,GAAA,2BAAA,SAAA;EACA,GAAA;EAEC,UAAA;CACS,CAAA;CAIhB,OAAA,oBAAA,YAAA;EAES;EACL,IAAA;EACA,WAAA;EACA,SAAA;EACA,WAAA,GAAA,yCAAA,SAAA;EACA,GAAA;EAEC,UAAA;CACS,CAAA;AAEhB,CAAA;AAGF,YAAA,cAAA"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
// src/components/inputs/Form/Page.tsx
|
|
3
3
|
var Page = ({ children }) => {
|
|
4
4
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
5
5
|
};
|
|
6
|
-
//#endregion
|
|
7
6
|
export { Page };
|
|
8
7
|
|
|
9
8
|
//# sourceMappingURL=Page.js.map
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
|
1
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField } from "./Form.js";
|
|
@@ -32,6 +32,12 @@ export type InlineMultiSelectProps = {
|
|
|
32
32
|
commandInputPlaceholder?: string;
|
|
33
33
|
/** Maximum number of items that can be selected */
|
|
34
34
|
max?: number;
|
|
35
|
+
/**
|
|
36
|
+
* What happens when the selected chips don't fit: `false` shows as many as fit and a `+N` count for the rest,
|
|
37
|
+
* `true` wraps them onto more lines and the field grows.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
wrap?: boolean;
|
|
35
41
|
/**
|
|
36
42
|
* Control height. sm 32px, md 40px, lg 48px. Heights are the `--control-height-*` tokens, so an app can change them (for example on touch).
|
|
37
43
|
* @default lg
|
|
@@ -54,5 +60,5 @@ export type InlineMultiSelectProps = {
|
|
|
54
60
|
* A controlled multi-select component that displays selected items inline with search functionality.
|
|
55
61
|
* Supports keyboard navigation, maximum selection limit, and custom styling.
|
|
56
62
|
*/
|
|
57
|
-
export declare const InlineMultiSelect: ({ options, value, onChange, defaultValue, placeholder, notFoundText, commandInputPlaceholder, max, className, size, fieldState, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, id, loading, modal, loadingPlaceholder, closeOnSelect, }: Readonly<InlineMultiSelectProps>) => React.JSX.Element;
|
|
63
|
+
export declare const InlineMultiSelect: ({ options, value, onChange, defaultValue, placeholder, notFoundText, commandInputPlaceholder, max, wrap, className, size, fieldState, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, id, loading, modal, loadingPlaceholder, closeOnSelect, }: Readonly<InlineMultiSelectProps>) => React.JSX.Element;
|
|
58
64
|
export {};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { cn } from "../../../lib/utils.js";
|
|
4
|
-
import { Button } from "../Button/Button.js";
|
|
5
3
|
import { PopoverContent, PopoverRoot, PopoverTrigger } from "../../data-display/Popover/Popover.js";
|
|
6
|
-
import {
|
|
4
|
+
import { OptionCheck } from "../../shared/OptionCheck.js";
|
|
5
|
+
import { Button } from "../Button/Button.js";
|
|
7
6
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../Command/Command.js";
|
|
7
|
+
import { isFieldInvalid } from "../shared/fieldInvalid.js";
|
|
8
|
+
import { cn } from "../../../lib/utils.js";
|
|
8
9
|
import * as React$1 from "react";
|
|
9
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
import { XIcon } from "@phosphor-icons/react/dist/ssr/X";
|
|
11
|
-
import { CheckIcon } from "@phosphor-icons/react/dist/ssr/Check";
|
|
12
12
|
import { CaretUpDownIcon } from "@phosphor-icons/react/dist/ssr/CaretUpDown";
|
|
13
|
-
|
|
13
|
+
// src/components/inputs/InlineMultiSelect/InlineMultiSelect.tsx
|
|
14
14
|
/**
|
|
15
15
|
* InlineMultiSelect Component
|
|
16
16
|
*
|
|
17
17
|
* A controlled multi-select component that displays selected items inline with search functionality.
|
|
18
18
|
* Supports keyboard navigation, maximum selection limit, and custom styling.
|
|
19
19
|
*/
|
|
20
|
-
var InlineMultiSelect = ({ options, value, onChange, defaultValue = [], placeholder, notFoundText, commandInputPlaceholder, max, className, size = "lg", fieldState, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, id, loading = false, modal = false, loadingPlaceholder = "Cargando...", closeOnSelect = false }) => {
|
|
20
|
+
var InlineMultiSelect = ({ options, value, onChange, defaultValue = [], placeholder, notFoundText, commandInputPlaceholder, max, wrap = false, className, size = "lg", fieldState, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, id, loading = false, modal = false, loadingPlaceholder = "Cargando...", closeOnSelect = false }) => {
|
|
21
21
|
const inputRef = React$1.useRef(null);
|
|
22
22
|
const [open, setOpen] = React$1.useState(false);
|
|
23
23
|
const [inputValue, setInputValue] = React$1.useState("");
|
|
@@ -25,9 +25,55 @@ var InlineMultiSelect = ({ options, value, onChange, defaultValue = [], placehol
|
|
|
25
25
|
const [internalSelected, setInternalSelected] = React$1.useState(() => defaultValue);
|
|
26
26
|
const selectedValues = isControlled ? value : internalSelected;
|
|
27
27
|
const selected = React$1.useMemo(() => options.filter((option) => selectedValues.includes(option.value)), [options, selectedValues]);
|
|
28
|
-
const
|
|
28
|
+
const rowRef = React$1.useRef(null);
|
|
29
|
+
const selectedKey = selected.map((option) => option.value).join("\0");
|
|
30
|
+
const [fit, setFit] = React$1.useState({
|
|
31
|
+
key: "",
|
|
32
|
+
count: 0
|
|
33
|
+
});
|
|
34
|
+
const measuring = !wrap && selected.length > 0 && fit.key !== selectedKey;
|
|
35
|
+
const visibleCount = wrap || measuring ? selected.length : Math.min(fit.count, selected.length);
|
|
29
36
|
const visibleItems = React$1.useMemo(() => selected.slice(0, visibleCount), [selected, visibleCount]);
|
|
30
37
|
const hiddenCount = selected.length - visibleCount;
|
|
38
|
+
React$1.useLayoutEffect(() => {
|
|
39
|
+
const row = rowRef.current;
|
|
40
|
+
if (!measuring || !row) return;
|
|
41
|
+
const chips = Array.from(row.querySelectorAll("[data-chip]"));
|
|
42
|
+
const moreWidth = row.querySelector("[data-more]")?.offsetWidth ?? 0;
|
|
43
|
+
const style = getComputedStyle(row);
|
|
44
|
+
const available = row.clientWidth - Number.parseFloat(style.paddingLeft) - Number.parseFloat(style.paddingRight);
|
|
45
|
+
const gap = Number.parseFloat(style.columnGap) || 0;
|
|
46
|
+
let count = chips.length;
|
|
47
|
+
if (available > 0) {
|
|
48
|
+
count = 0;
|
|
49
|
+
let used = 0;
|
|
50
|
+
for (const [index, chip] of chips.entries()) {
|
|
51
|
+
const next = used + (index > 0 ? gap : 0) + chip.offsetWidth;
|
|
52
|
+
if ((index < chips.length - 1 ? next + gap + moreWidth : next) > available) break;
|
|
53
|
+
count = index + 1;
|
|
54
|
+
used = next;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
setFit({
|
|
58
|
+
key: selectedKey,
|
|
59
|
+
count: Math.max(count, 1)
|
|
60
|
+
});
|
|
61
|
+
}, [measuring, selectedKey]);
|
|
62
|
+
React$1.useEffect(() => {
|
|
63
|
+
const row = rowRef.current;
|
|
64
|
+
if (!row || typeof ResizeObserver === "undefined") return;
|
|
65
|
+
let width = row.clientWidth;
|
|
66
|
+
const observer = new ResizeObserver(() => {
|
|
67
|
+
if (row.clientWidth === width) return;
|
|
68
|
+
width = row.clientWidth;
|
|
69
|
+
setFit((previous) => ({
|
|
70
|
+
...previous,
|
|
71
|
+
key: ""
|
|
72
|
+
}));
|
|
73
|
+
});
|
|
74
|
+
observer.observe(row);
|
|
75
|
+
return () => observer.disconnect();
|
|
76
|
+
}, []);
|
|
31
77
|
const handleSelectionChange = (newSelected) => {
|
|
32
78
|
if (!isControlled) setInternalSelected(newSelected);
|
|
33
79
|
onChange?.(newSelected);
|
|
@@ -69,31 +115,41 @@ var InlineMultiSelect = ({ options, value, onChange, defaultValue = [], placehol
|
|
|
69
115
|
},
|
|
70
116
|
"aria-invalid": isFieldInvalid(fieldState?.invalid, ariaInvalid) || void 0,
|
|
71
117
|
"aria-describedby": ariaDescribedBy,
|
|
72
|
-
className: cn("w-full justify-between", className),
|
|
118
|
+
className: cn("w-full justify-between", wrap && "h-auto min-h-(--control-height) py-1", className),
|
|
73
119
|
children: [/* @__PURE__ */ jsx("div", {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
120
|
+
ref: rowRef,
|
|
121
|
+
"data-measuring": measuring ? "" : void 0,
|
|
122
|
+
className: "relative flex min-w-0 flex-1 items-center gap-1 overflow-hidden pr-2 data-wrap:flex-wrap",
|
|
123
|
+
"data-wrap": wrap ? "" : void 0,
|
|
124
|
+
children: selected.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
125
|
+
visibleItems.map((item) => /* @__PURE__ */ jsxs("div", {
|
|
126
|
+
"data-chip": "",
|
|
127
|
+
className: "\n flex min-w-0 items-center gap-1 rounded-sm bg-surface-tertiary px-1 py-0.5\n in-data-measuring:shrink-0\n ",
|
|
79
128
|
children: [/* @__PURE__ */ jsx("span", {
|
|
80
|
-
className: "text-
|
|
129
|
+
className: "truncate text-body-md",
|
|
81
130
|
children: item.label
|
|
82
131
|
}), /* @__PURE__ */ jsx("span", {
|
|
83
132
|
"aria-hidden": true,
|
|
84
133
|
onClick: (event) => handleUnselect(item, event),
|
|
85
|
-
className: "\n
|
|
86
|
-
children: /* @__PURE__ */ jsx(XIcon, { className: "
|
|
134
|
+
className: "\n flex icon-sm shrink-0 cursor-pointer items-center justify-center rounded-full\n hover:bg-surface-neutral-subtle-disabled\n ",
|
|
135
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "icon-sm text-icon-primary" })
|
|
87
136
|
})]
|
|
88
|
-
}, item.value)),
|
|
89
|
-
|
|
137
|
+
}, item.value)),
|
|
138
|
+
measuring && /* @__PURE__ */ jsxs("span", {
|
|
139
|
+
"data-more": "",
|
|
140
|
+
"aria-hidden": true,
|
|
141
|
+
className: "invisible absolute shrink-0 text-body-md",
|
|
142
|
+
children: ["+", selected.length]
|
|
143
|
+
}),
|
|
144
|
+
!measuring && hiddenCount > 0 && /* @__PURE__ */ jsxs("span", {
|
|
145
|
+
className: "shrink-0 text-body-md text-secondary",
|
|
90
146
|
children: ["+", hiddenCount]
|
|
91
|
-
})] }) : /* @__PURE__ */ jsx("span", {
|
|
92
|
-
className: "text-neutral-500",
|
|
93
|
-
children: placeholder
|
|
94
147
|
})
|
|
148
|
+
] }) : /* @__PURE__ */ jsx("span", {
|
|
149
|
+
className: "truncate text-tertiary",
|
|
150
|
+
children: placeholder
|
|
95
151
|
})
|
|
96
|
-
}), /* @__PURE__ */ jsx(CaretUpDownIcon, { className: "
|
|
152
|
+
}), /* @__PURE__ */ jsx(CaretUpDownIcon, { className: "icon-sm text-tertiary" })]
|
|
97
153
|
})
|
|
98
154
|
}), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
99
155
|
"data-size": size,
|
|
@@ -104,7 +160,7 @@ var InlineMultiSelect = ({ options, value, onChange, defaultValue = [], placehol
|
|
|
104
160
|
value: inputValue,
|
|
105
161
|
onValueChange: setInputValue
|
|
106
162
|
}), /* @__PURE__ */ jsx(CommandList, { children: loading ? /* @__PURE__ */ jsx("div", {
|
|
107
|
-
className: "flex items-center justify-center py-6 text-
|
|
163
|
+
className: "flex items-center justify-center py-6 text-body-md text-secondary",
|
|
108
164
|
children: loadingPlaceholder
|
|
109
165
|
}) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: notFoundText ?? "Options not found" }), /* @__PURE__ */ jsx(CommandGroup, { children: options.map((item) => {
|
|
110
166
|
const isSelected = selectedValues.includes(item.value);
|
|
@@ -122,18 +178,13 @@ var InlineMultiSelect = ({ options, value, onChange, defaultValue = [], placehol
|
|
|
122
178
|
}
|
|
123
179
|
if (closeOnSelect) setOpen(false);
|
|
124
180
|
},
|
|
125
|
-
children: [/* @__PURE__ */ jsx(
|
|
126
|
-
"aria-hidden": true,
|
|
127
|
-
className: "mr-1 flex size-6 shrink-0 items-center justify-end",
|
|
128
|
-
children: isSelected && /* @__PURE__ */ jsx(CheckIcon, { weight: "bold" })
|
|
129
|
-
}), item.label]
|
|
181
|
+
children: [item.label, /* @__PURE__ */ jsx(OptionCheck, { selected: isSelected })]
|
|
130
182
|
}, item.value);
|
|
131
183
|
}) })] }) })]
|
|
132
184
|
})]
|
|
133
185
|
})
|
|
134
186
|
});
|
|
135
187
|
};
|
|
136
|
-
//#endregion
|
|
137
188
|
export { InlineMultiSelect };
|
|
138
189
|
|
|
139
190
|
//# sourceMappingURL=InlineMultiSelect.js.map
|