@vritti/quantum-ui 0.3.12 → 0.3.13
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/Alert.js +1 -1
- package/dist/Alert.js.map +1 -1
- package/dist/Avatar.js +1 -1
- package/dist/Avatar.js.map +1 -1
- package/dist/Badge2.js +2 -2
- package/dist/BillingCycleSelector.js +37 -0
- package/dist/BillingCycleSelector.js.map +1 -0
- package/dist/Breadcrumb.js +1 -1
- package/dist/Breadcrumb.js.map +1 -1
- package/dist/Button.js +1 -1
- package/dist/Button.js.map +1 -1
- package/dist/Button2.js +2 -2
- package/dist/CardSkeleton.js.map +1 -1
- package/dist/CategoryFilter.js +6 -4
- package/dist/CategoryFilter.js.map +1 -1
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox2.js +4 -4
- package/dist/CheckboxGroup.js.map +1 -1
- package/dist/Collapsible.js.map +1 -1
- package/dist/Combination.js +1129 -0
- package/dist/Combination.js.map +1 -0
- package/dist/CompanySelector.js +20 -0
- package/dist/CompanySelector.js.map +1 -0
- package/dist/ConfirmHost.js.map +1 -1
- package/dist/CountrySelector.js +37 -0
- package/dist/CountrySelector.js.map +1 -0
- package/dist/CurrencyField.js +1 -0
- package/dist/CurrencyField.js.map +1 -1
- package/dist/CustomerSelector.js +2 -2
- package/dist/CustomerSelector.js.map +1 -1
- package/dist/DangerZoneSkeleton.js +21 -3
- package/dist/DangerZoneSkeleton.js.map +1 -1
- package/dist/DatePicker.js +3 -3
- package/dist/DatePicker.js.map +1 -1
- package/dist/DateTimePicker.js +2 -2
- package/dist/DetailSectionSkeleton.js.map +1 -1
- package/dist/Dialog.js.map +1 -1
- package/dist/DropdownMenu.js.map +1 -1
- package/dist/FeaturePermissionSelector.js +37 -0
- package/dist/FeaturePermissionSelector.js.map +1 -0
- package/dist/Form.js.map +1 -1
- package/dist/FormSection.js +4 -4
- package/dist/FormSection.js.map +1 -1
- package/dist/HierarchyGraph.js +5 -10621
- package/dist/HierarchyGraph.js.map +1 -1
- package/dist/ISOCountrySelect.js +283 -0
- package/dist/ISOCountrySelect.js.map +1 -0
- package/dist/IconSelect.js +1 -1
- package/dist/IconSelect.js.map +1 -1
- package/dist/InventoryItemSelector.js +2 -2
- package/dist/InventoryItemSelector.js.map +1 -1
- package/dist/Kbd.js +1 -1
- package/dist/Kbd.js.map +1 -1
- package/dist/Label.js +1 -1
- package/dist/LayoutModeContext.js.map +1 -1
- package/dist/LegalEntitySelector.js +37 -0
- package/dist/LegalEntitySelector.js.map +1 -0
- package/dist/LocationSelector.js +2 -2
- package/dist/LocationSelector.js.map +1 -1
- package/dist/LotSelector.js +2 -2
- package/dist/LotSelector.js.map +1 -1
- package/dist/OTPField.js.map +1 -1
- package/dist/PageContent.js.map +1 -1
- package/dist/PageHeaderSkeleton.js +21 -10
- package/dist/PageHeaderSkeleton.js.map +1 -1
- package/dist/PasswordField.js.map +1 -1
- package/dist/PermissionGate.js +49 -5
- package/dist/PermissionGate.js.map +1 -1
- package/dist/PersonSelector.js +20 -0
- package/dist/PersonSelector.js.map +1 -0
- package/dist/PhoneField.js.map +1 -1
- package/dist/PurchaseOrderSelector.js +2 -2
- package/dist/PurchaseOrderSelector.js.map +1 -1
- package/dist/QuantSelector.js +2 -2
- package/dist/QuantSelector.js.map +1 -1
- package/dist/RadioGroup.js +6 -6
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RoleSelector.js +20 -0
- package/dist/RoleSelector.js.map +1 -0
- package/dist/Select.js +4 -1
- package/dist/Select.js.map +1 -1
- package/dist/SelectFilter.js.map +1 -1
- package/dist/Separator.js.map +1 -1
- package/dist/SerialSelector.js +2 -2
- package/dist/SerialSelector.js.map +1 -1
- package/dist/Sidebar.js +2 -2
- package/dist/Sidebar.js.map +1 -1
- package/dist/SingleSelect.js +2 -2
- package/dist/SingleSelect.js.map +1 -1
- package/dist/SiteGroupSelector.js +37 -0
- package/dist/SiteGroupSelector.js.map +1 -0
- package/dist/SiteSelector.js +37 -0
- package/dist/SiteSelector.js.map +1 -0
- package/dist/Sonner.js +1 -1
- package/dist/Sonner.js.map +1 -1
- package/dist/Sortable.js +4 -4417
- package/dist/Sortable.js.map +1 -1
- package/dist/StepProgressIndicator.js.map +1 -1
- package/dist/SupplierItemSelector.js +2 -2
- package/dist/SupplierItemSelector.js.map +1 -1
- package/dist/SupplierSelector.js +2 -2
- package/dist/SupplierSelector.js.map +1 -1
- package/dist/Switch.js +3 -3
- package/dist/Switch.js.map +1 -1
- package/dist/TabsSkeleton.js +101 -49
- package/dist/TabsSkeleton.js.map +1 -1
- package/dist/TaxClassSelector.js +20 -0
- package/dist/TaxClassSelector.js.map +1 -0
- package/dist/TextField.js.map +1 -1
- package/dist/ThemeContext.js.map +1 -1
- package/dist/ThemeToggle.js.map +1 -1
- package/dist/Toggle.js +1 -1
- package/dist/Toggle.js.map +1 -1
- package/dist/Tooltip.js.map +1 -1
- package/dist/Typography.js.map +1 -1
- package/dist/UomSelector.js +2 -2
- package/dist/UomSelector.js.map +1 -1
- package/dist/UploadFile.js.map +1 -1
- package/dist/assets/quantum-ui.css +25 -13
- package/dist/calendar2.js +1 -1
- package/dist/collapsible2.js +1 -1
- package/dist/components/CompanySelector.js +2 -0
- package/dist/components/CompanySelector.js.map +1 -0
- package/dist/components/FormattedDate.js +2 -2
- package/dist/components/HierarchyGraph.js +2 -1
- package/dist/components/HierarchyGraph.js.map +1 -1
- package/dist/components/PermissionGate.js +1 -1
- package/dist/components/PersonSelector.js +2 -0
- package/dist/components/PersonSelector.js.map +1 -0
- package/dist/components/ScanBarcodeButton.js.map +1 -1
- package/dist/components/TreeView.js +7 -7
- package/dist/components/TreeView.js.map +1 -1
- package/dist/core.esm.js +4025 -0
- package/dist/core.esm.js.map +1 -0
- package/dist/dropdown-menu.js +10 -10
- package/dist/field.js +1 -1
- package/dist/image-component.js.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/index10.js +102 -1499
- package/dist/index10.js.map +1 -1
- package/dist/index11.js +1499 -37
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +29 -477
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +427 -231
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +215 -1074
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +1140 -14
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +13 -19
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +24 -172
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +168 -175
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +173 -201
- package/dist/index19.js.map +1 -1
- package/dist/index20.js +203 -69
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +70 -211
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +207 -117
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +123 -71
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +74 -11
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +13 -1134
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +1120 -219
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +202 -2506
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +2527 -23
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +32 -4
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +11543 -267
- package/dist/index3.js.map +1 -1
- package/dist/index30.js +3 -1124
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +1 -1
- package/dist/index32.js +7 -7
- package/dist/index34.js +1 -1
- package/dist/index37.js +1 -1
- package/dist/index38.js +21 -42
- package/dist/index38.js.map +1 -1
- package/dist/index4.js +272 -132
- package/dist/index4.js.map +1 -1
- package/dist/index5.js +138 -388
- package/dist/index5.js.map +1 -1
- package/dist/index6.js +386 -7
- package/dist/index6.js.map +1 -1
- package/dist/index7.js +13 -92
- package/dist/index7.js.map +1 -1
- package/dist/index8.js +92 -43
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +42 -102
- package/dist/index9.js.map +1 -1
- package/dist/lib/components/Alert/Alert.d.ts.map +1 -1
- package/dist/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/lib/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/lib/components/Button/Button.d.ts.map +1 -1
- package/dist/lib/components/Card/CardSkeleton.d.ts.map +1 -1
- package/dist/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/lib/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
- package/dist/lib/components/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/lib/components/CompanySelector/CompanySelector.d.ts +4 -0
- package/dist/lib/components/CompanySelector/CompanySelector.d.ts.map +1 -0
- package/dist/lib/components/CompanySelector/index.d.ts +2 -0
- package/dist/lib/components/CompanySelector/index.d.ts.map +1 -0
- package/dist/lib/components/ConfirmHost/ConfirmHost.d.ts.map +1 -1
- package/dist/lib/components/CurrencyField/CurrencyField.d.ts.map +1 -1
- package/dist/lib/components/DangerZone/DangerZone.d.ts +3 -1
- package/dist/lib/components/DangerZone/DangerZone.d.ts.map +1 -1
- package/dist/lib/components/DataTable/CompactTableSkeleton.d.ts.map +1 -1
- package/dist/lib/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/lib/components/DataTable/cells/cells.d.ts.map +1 -1
- package/dist/lib/components/DataTable/components/DataTableSelectionBar.d.ts.map +1 -1
- package/dist/lib/components/DataTable/components/RowActions.d.ts.map +1 -1
- package/dist/lib/components/DataTable/hooks/useDataTable.d.ts.map +1 -1
- package/dist/lib/components/DataTable/store/store.d.ts.map +1 -1
- package/dist/lib/components/DataTable/types.d.ts.map +1 -1
- package/dist/lib/components/DatePicker/DatePicker.d.ts +2 -2
- package/dist/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/lib/components/DetailField/DetailField.d.ts.map +1 -1
- package/dist/lib/components/DetailField/DetailHeader.d.ts.map +1 -1
- package/dist/lib/components/DetailField/DetailSectionSkeleton.d.ts.map +1 -1
- package/dist/lib/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/lib/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/lib/components/DropdownMenu/types.d.ts.map +1 -1
- package/dist/lib/components/Editor/editor-ui/color-picker.d.ts.map +1 -1
- package/dist/lib/components/Editor/editor-ui/image-component.d.ts.map +1 -1
- package/dist/lib/components/Editor/nodes/autocomplete-node.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/actions/max-length-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/embeds/auto-embed-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/embeds/youtube-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/emojis-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/floating-link-editor-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/floating-text-format-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/images-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/keywords-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/layout-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/list-max-indent-level-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/mentions-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/picker/component-picker-option.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/tab-focus-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/table-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/toolbar/clear-formatting-toolbar-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/plugins/typing-pref-plugin.d.ts.map +1 -1
- package/dist/lib/components/Editor/shared/invariant.d.ts.map +1 -1
- package/dist/lib/components/Editor/shared/react-patches.d.ts.map +1 -1
- package/dist/lib/components/Editor/shared/react-test-utils.d.ts.map +1 -1
- package/dist/lib/components/Editor/shared/simple-diff-with-cursor.d.ts.map +1 -1
- package/dist/lib/components/Editor/shared/use-layout-effect.d.ts.map +1 -1
- package/dist/lib/components/Editor/transformers/markdown-table-transformer.d.ts.map +1 -1
- package/dist/lib/components/Editor/utils/collapsible.d.ts.map +1 -1
- package/dist/lib/components/Editor/utils/doc-serialization.d.ts.map +1 -1
- package/dist/lib/components/Editor/utils/emoji-list.d.ts.map +1 -1
- package/dist/lib/components/Editor/utils/get-dom-range-rect.d.ts.map +1 -1
- package/dist/lib/components/Editor/utils/get-selected-node.d.ts.map +1 -1
- package/dist/lib/components/Editor/utils/guard.d.ts.map +1 -1
- package/dist/lib/components/Editor/utils/set-floating-elem-position-for-link-editor.d.ts.map +1 -1
- package/dist/lib/components/Editor/utils/set-floating-elem-position.d.ts.map +1 -1
- package/dist/lib/components/Editor/utils/swipe.d.ts.map +1 -1
- package/dist/lib/components/Editor/utils/url.d.ts.map +1 -1
- package/dist/lib/components/Form/Form.d.ts.map +1 -1
- package/dist/lib/components/OTPField/OTPField.d.ts.map +1 -1
- package/dist/lib/components/PageContent/PageContent.d.ts.map +1 -1
- package/dist/lib/components/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/lib/components/PasswordField/PasswordField.d.ts.map +1 -1
- package/dist/lib/components/PermissionGate/PermissionGate.d.ts +15 -4
- package/dist/lib/components/PermissionGate/PermissionGate.d.ts.map +1 -1
- package/dist/lib/components/PermissionGate/index.d.ts +1 -1
- package/dist/lib/components/PermissionGate/index.d.ts.map +1 -1
- package/dist/lib/components/PersonSelector/PersonSelector.d.ts +4 -0
- package/dist/lib/components/PersonSelector/PersonSelector.d.ts.map +1 -0
- package/dist/lib/components/PersonSelector/index.d.ts +2 -0
- package/dist/lib/components/PersonSelector/index.d.ts.map +1 -0
- package/dist/lib/components/PhoneField/PhoneField.d.ts.map +1 -1
- package/dist/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/lib/components/ScanBarcodeButton/ScanBarcodeButton.d.ts.map +1 -1
- package/dist/lib/components/Select/SelectFilter.d.ts.map +1 -1
- package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts.map +1 -1
- package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts.map +1 -1
- package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts.map +1 -1
- package/dist/lib/components/Select/hooks/useSelect.d.ts.map +1 -1
- package/dist/lib/components/Select/hooks/useSingleSelect.d.ts.map +1 -1
- package/dist/lib/components/Select/types.d.ts +1 -1
- package/dist/lib/components/Select/types.d.ts.map +1 -1
- package/dist/lib/components/Separator/Separator.d.ts.map +1 -1
- package/dist/lib/components/Sidebar/Sidebar.d.ts.map +1 -1
- package/dist/lib/components/Sonner/Sonner.d.ts.map +1 -1
- package/dist/lib/components/Sonner/toast.d.ts.map +1 -1
- package/dist/lib/components/StepProgressIndicator/StepProgressIndicator.d.ts.map +1 -1
- package/dist/lib/components/Switch/Switch.d.ts.map +1 -1
- package/dist/lib/components/Tabs/Tabs.d.ts +2 -0
- package/dist/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/lib/components/Tabs/TabsSkeleton.d.ts.map +1 -1
- package/dist/lib/components/TextField/TextField.d.ts.map +1 -1
- package/dist/lib/components/ThemeToggle/ThemeToggle.d.ts.map +1 -1
- package/dist/lib/components/Toggle/Toggle.d.ts.map +1 -1
- package/dist/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/lib/components/TreeView/TreeView.d.ts.map +1 -1
- package/dist/lib/components/Typography/Typography.d.ts.map +1 -1
- package/dist/lib/components/UploadFile/UploadFile.d.ts.map +1 -1
- package/dist/lib/components/index.d.ts +2 -0
- package/dist/lib/components/index.d.ts.map +1 -1
- package/dist/lib/config/index.d.ts.map +1 -1
- package/dist/lib/context/LayoutModeContext.d.ts.map +1 -1
- package/dist/lib/context/ThemeContext.d.ts.map +1 -1
- package/dist/lib/hooks/useBUCurrency.d.ts.map +1 -1
- package/dist/lib/hooks/useBUTimezone.d.ts.map +1 -1
- package/dist/lib/hooks/useBarcodeScanner.d.ts.map +1 -1
- package/dist/lib/hooks/useFormatters.d.ts.map +1 -1
- package/dist/lib/hooks/useSSE.d.ts.map +1 -1
- package/dist/lib/hooks/useTheme.d.ts.map +1 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/selects/billing-cycle/BillingCycleFilter.d.ts +12 -0
- package/dist/lib/selects/billing-cycle/BillingCycleFilter.d.ts.map +1 -0
- package/dist/lib/selects/billing-cycle/BillingCycleSelector.d.ts +4 -0
- package/dist/lib/selects/billing-cycle/BillingCycleSelector.d.ts.map +1 -0
- package/dist/lib/selects/billing-cycle/index.d.ts +3 -0
- package/dist/lib/selects/billing-cycle/index.d.ts.map +1 -0
- package/dist/lib/selects/category/CategoryFilter.d.ts.map +1 -1
- package/dist/lib/selects/category/CategorySelector.d.ts.map +1 -1
- package/dist/lib/selects/cost-category/CostCategorySelector.d.ts.map +1 -1
- package/dist/lib/selects/country/CountryFilter.d.ts +12 -0
- package/dist/lib/selects/country/CountryFilter.d.ts.map +1 -0
- package/dist/lib/selects/country/CountrySelector.d.ts +4 -0
- package/dist/lib/selects/country/CountrySelector.d.ts.map +1 -0
- package/dist/lib/selects/country/index.d.ts +3 -0
- package/dist/lib/selects/country/index.d.ts.map +1 -0
- package/dist/lib/selects/feature-permission/FeaturePermissionFilter.d.ts +12 -0
- package/dist/lib/selects/feature-permission/FeaturePermissionFilter.d.ts.map +1 -0
- package/dist/lib/selects/feature-permission/FeaturePermissionSelector.d.ts +4 -0
- package/dist/lib/selects/feature-permission/FeaturePermissionSelector.d.ts.map +1 -0
- package/dist/lib/selects/feature-permission/index.d.ts +3 -0
- package/dist/lib/selects/feature-permission/index.d.ts.map +1 -0
- package/dist/lib/selects/icon/IconSelect.d.ts.map +1 -1
- package/dist/lib/selects/index.d.ts +9 -0
- package/dist/lib/selects/index.d.ts.map +1 -1
- package/dist/lib/selects/inventory-item/InventoryItemSelector.d.ts +2 -2
- package/dist/lib/selects/inventory-item/InventoryItemSelector.d.ts.map +1 -1
- package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts +15 -0
- package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts.map +1 -0
- package/dist/lib/selects/iso-country/index.d.ts +3 -0
- package/dist/lib/selects/iso-country/index.d.ts.map +1 -0
- package/dist/lib/selects/iso-country/iso-countries.d.ts +7 -0
- package/dist/lib/selects/iso-country/iso-countries.d.ts.map +1 -0
- package/dist/lib/selects/legal-entity/LegalEntityFilter.d.ts +12 -0
- package/dist/lib/selects/legal-entity/LegalEntityFilter.d.ts.map +1 -0
- package/dist/lib/selects/legal-entity/LegalEntitySelector.d.ts +4 -0
- package/dist/lib/selects/legal-entity/LegalEntitySelector.d.ts.map +1 -0
- package/dist/lib/selects/legal-entity/index.d.ts +3 -0
- package/dist/lib/selects/legal-entity/index.d.ts.map +1 -0
- package/dist/lib/selects/location/LocationSelector.d.ts.map +1 -1
- package/dist/lib/selects/purchase-order/PurchaseOrderSelector.d.ts.map +1 -1
- package/dist/lib/selects/purchase-order-item/PurchaseOrderItemSelector.d.ts.map +1 -1
- package/dist/lib/selects/role/RoleSelector.d.ts +4 -0
- package/dist/lib/selects/role/RoleSelector.d.ts.map +1 -0
- package/dist/lib/selects/role/index.d.ts +2 -0
- package/dist/lib/selects/role/index.d.ts.map +1 -0
- package/dist/lib/selects/serial/SerialSelector.d.ts.map +1 -1
- package/dist/lib/selects/site/SiteFilter.d.ts +12 -0
- package/dist/lib/selects/site/SiteFilter.d.ts.map +1 -0
- package/dist/lib/selects/site/SiteSelector.d.ts +4 -0
- package/dist/lib/selects/site/SiteSelector.d.ts.map +1 -0
- package/dist/lib/selects/site/index.d.ts +3 -0
- package/dist/lib/selects/site/index.d.ts.map +1 -0
- package/dist/lib/selects/site-group/SiteGroupFilter.d.ts +12 -0
- package/dist/lib/selects/site-group/SiteGroupFilter.d.ts.map +1 -0
- package/dist/lib/selects/site-group/SiteGroupSelector.d.ts +4 -0
- package/dist/lib/selects/site-group/SiteGroupSelector.d.ts.map +1 -0
- package/dist/lib/selects/site-group/index.d.ts +3 -0
- package/dist/lib/selects/site-group/index.d.ts.map +1 -0
- package/dist/lib/selects/supplier/SupplierSelector.d.ts.map +1 -1
- package/dist/lib/selects/supplier-item/SupplierItemFilter.d.ts.map +1 -1
- package/dist/lib/selects/supplier-item/SupplierItemSelector.d.ts.map +1 -1
- package/dist/lib/selects/tax-class/TaxClassSelector.d.ts +4 -0
- package/dist/lib/selects/tax-class/TaxClassSelector.d.ts.map +1 -0
- package/dist/lib/selects/tax-class/index.d.ts +2 -0
- package/dist/lib/selects/tax-class/index.d.ts.map +1 -0
- package/dist/lib/theme/index.d.ts.map +1 -1
- package/dist/lib/types/catalog-resolver.d.ts +50 -17
- package/dist/lib/types/catalog-resolver.d.ts.map +1 -1
- package/dist/lib/utils/axios.d.ts.map +1 -1
- package/dist/lib/utils/cn.d.ts +3 -0
- package/dist/lib/utils/cn.d.ts.map +1 -0
- package/dist/lib/utils/dagre.d.ts +2 -0
- package/dist/lib/utils/dagre.d.ts.map +1 -0
- package/dist/lib/utils/dnd-kit/core.d.ts +2 -0
- package/dist/lib/utils/dnd-kit/core.d.ts.map +1 -0
- package/dist/lib/utils/dnd-kit/sortable.d.ts +2 -0
- package/dist/lib/utils/dnd-kit/sortable.d.ts.map +1 -0
- package/dist/lib/utils/dnd-kit/utilities.d.ts +2 -0
- package/dist/lib/utils/dnd-kit/utilities.d.ts.map +1 -0
- package/dist/lib/utils/formHelpers.d.ts.map +1 -1
- package/dist/lib/utils/format.d.ts.map +1 -1
- package/dist/lib/utils/permission-deps.d.ts +9 -0
- package/dist/lib/utils/permission-deps.d.ts.map +1 -0
- package/dist/lib/utils/react-flow.d.ts +2 -0
- package/dist/lib/utils/react-flow.d.ts.map +1 -0
- package/dist/lib/utils/zod.d.ts +9 -0
- package/dist/lib/utils/zod.d.ts.map +1 -1
- package/dist/popover.js +1 -1
- package/dist/select2.js +1 -1
- package/dist/selects/billing-cycle.js +2 -0
- package/dist/selects/billing-cycle.js.map +1 -0
- package/dist/selects/cost-category.js +2 -2
- package/dist/selects/cost-category.js.map +1 -1
- package/dist/selects/country.js +2 -0
- package/dist/selects/country.js.map +1 -0
- package/dist/selects/feature-permission.js +2 -0
- package/dist/selects/feature-permission.js.map +1 -0
- package/dist/selects/iso-country.js +2 -0
- package/dist/selects/iso-country.js.map +1 -0
- package/dist/selects/legal-entity.js +2 -0
- package/dist/selects/legal-entity.js.map +1 -0
- package/dist/selects/purchase-order-item.js +1 -1
- package/dist/selects/purchase-order-item.js.map +1 -1
- package/dist/selects/role.js +2 -0
- package/dist/selects/role.js.map +1 -0
- package/dist/selects/site-group.js +2 -0
- package/dist/selects/site-group.js.map +1 -0
- package/dist/selects/site.js +2 -0
- package/dist/selects/site.js.map +1 -0
- package/dist/selects/tax-class.js +2 -0
- package/dist/selects/tax-class.js.map +1 -0
- package/dist/selects/tax-group.js +2 -2
- package/dist/selects/tax-group.js.map +1 -1
- package/dist/separator2.js +1 -1
- package/dist/sortable.esm.js +780 -0
- package/dist/sortable.esm.js.map +1 -0
- package/dist/theme/index.js.map +1 -1
- package/dist/toast.js +2 -26
- package/dist/toast.js.map +1 -1
- package/dist/tooltip2.js +1 -1
- package/dist/types/catalog-resolver.js +5 -2
- package/dist/types/catalog-resolver.js.map +1 -1
- package/dist/useBUTimezone.js.map +1 -1
- package/dist/useDataTable.js +58 -60
- package/dist/useDataTable.js.map +1 -1
- package/dist/useFormatters.js.map +1 -1
- package/dist/useTheme.js.map +1 -1
- package/dist/useTimer.js +2 -2
- package/dist/useTimer.js.map +1 -1
- package/dist/utilities.esm.js +333 -0
- package/dist/utilities.esm.js.map +1 -0
- package/dist/utils/axios.js +1 -1
- package/dist/utils/axios.js.map +1 -1
- package/dist/utils/cn.js +6 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/currency.js +2 -2
- package/dist/utils/dagre.js +4 -0
- package/dist/utils/dagre.js.map +1 -0
- package/dist/utils/dnd-kit/core.js +2 -0
- package/dist/utils/dnd-kit/core.js.map +1 -0
- package/dist/utils/dnd-kit/sortable.js +2 -0
- package/dist/utils/dnd-kit/sortable.js.map +1 -0
- package/dist/utils/dnd-kit/utilities.js +2 -0
- package/dist/utils/dnd-kit/utilities.js.map +1 -0
- package/dist/utils/format.js +2 -2
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/hotkeys.js +1 -1
- package/dist/utils/money.js +1 -1
- package/dist/utils/permission-deps.js +64 -0
- package/dist/utils/permission-deps.js.map +1 -0
- package/dist/utils/react-flow.js +2 -0
- package/dist/utils/react-flow.js.map +1 -0
- package/dist/utils/timezone.js +1 -1
- package/dist/utils/zod.js +11 -1
- package/dist/utils/zod.js.map +1 -1
- package/package.json +73 -1
package/dist/index14.js
CHANGED
|
@@ -1,884 +1,251 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { u as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { u as useCallbackRef } from './index33.js';
|
|
12
|
-
import { u as useLayoutEffect2 } from './index29.js';
|
|
13
|
-
import { u as usePrevious } from './index36.js';
|
|
14
|
-
import { V as VISUALLY_HIDDEN_STYLES } from './index28.js';
|
|
15
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { u as useControllableState, P as Primitive, c as composeEventHandlers, b as createSlot } from './index20.js';
|
|
3
|
+
import { u as useComposedRefs } from './index12.js';
|
|
4
|
+
import { c as createContextScope } from './index21.js';
|
|
5
|
+
import { P as Portal$1, D as DismissableLayer } from './index27.js';
|
|
6
|
+
import { h as hideOthers, R as ReactRemoveScroll, u as useFocusGuards, F as FocusScope } from './Combination.js';
|
|
7
|
+
import { u as useId } from './index25.js';
|
|
8
|
+
import { R as Root2$1, A as Anchor, c as createPopperScope, C as Content, a as Arrow } from './index28.js';
|
|
9
|
+
import { P as Presence } from './index23.js';
|
|
10
|
+
import { jsx } from 'react/jsx-runtime';
|
|
16
11
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return Math.min(max, Math.max(min, value));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var OPEN_KEYS = [" ", "Enter", "ArrowUp", "ArrowDown"];
|
|
23
|
-
var SELECTION_KEYS = [" ", "Enter"];
|
|
24
|
-
var SELECT_NAME = "Select";
|
|
25
|
-
var [Collection, useCollection, createCollectionScope] = createCollection(SELECT_NAME);
|
|
26
|
-
var [createSelectContext] = createContextScope(SELECT_NAME, [
|
|
27
|
-
createCollectionScope,
|
|
12
|
+
var POPOVER_NAME = "Popover";
|
|
13
|
+
var [createPopoverContext] = createContextScope(POPOVER_NAME, [
|
|
28
14
|
createPopperScope
|
|
29
15
|
]);
|
|
30
16
|
var usePopperScope = createPopperScope();
|
|
31
|
-
var [
|
|
32
|
-
var
|
|
33
|
-
var Select = (props) => {
|
|
17
|
+
var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
|
|
18
|
+
var Popover = (props) => {
|
|
34
19
|
const {
|
|
35
|
-
|
|
20
|
+
__scopePopover,
|
|
36
21
|
children,
|
|
37
22
|
open: openProp,
|
|
38
23
|
defaultOpen,
|
|
39
24
|
onOpenChange,
|
|
40
|
-
|
|
41
|
-
defaultValue,
|
|
42
|
-
onValueChange,
|
|
43
|
-
dir,
|
|
44
|
-
name,
|
|
45
|
-
autoComplete,
|
|
46
|
-
disabled,
|
|
47
|
-
required,
|
|
48
|
-
form
|
|
25
|
+
modal = false
|
|
49
26
|
} = props;
|
|
50
|
-
const popperScope = usePopperScope(
|
|
51
|
-
const
|
|
52
|
-
const [
|
|
53
|
-
const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false);
|
|
54
|
-
const direction = useDirection(dir);
|
|
27
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
28
|
+
const triggerRef = React.useRef(null);
|
|
29
|
+
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
55
30
|
const [open, setOpen] = useControllableState({
|
|
56
31
|
prop: openProp,
|
|
57
32
|
defaultProp: defaultOpen ?? false,
|
|
58
33
|
onChange: onOpenChange,
|
|
59
|
-
caller:
|
|
60
|
-
});
|
|
61
|
-
const [value, setValue] = useControllableState({
|
|
62
|
-
prop: valueProp,
|
|
63
|
-
defaultProp: defaultValue,
|
|
64
|
-
onChange: onValueChange,
|
|
65
|
-
caller: SELECT_NAME
|
|
34
|
+
caller: POPOVER_NAME
|
|
66
35
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const [nativeOptionsSet, setNativeOptionsSet] = React.useState(/* @__PURE__ */ new Set());
|
|
70
|
-
const nativeSelectKey = Array.from(nativeOptionsSet).map((option) => option.props.value).join(";");
|
|
71
|
-
return /* @__PURE__ */ jsx(Root2$1, { ...popperScope, children: /* @__PURE__ */ jsxs(
|
|
72
|
-
SelectProvider,
|
|
36
|
+
return /* @__PURE__ */ jsx(Root2$1, { ...popperScope, children: /* @__PURE__ */ jsx(
|
|
37
|
+
PopoverProvider,
|
|
73
38
|
{
|
|
74
|
-
|
|
75
|
-
scope: __scopeSelect,
|
|
76
|
-
trigger,
|
|
77
|
-
onTriggerChange: setTrigger,
|
|
78
|
-
valueNode,
|
|
79
|
-
onValueNodeChange: setValueNode,
|
|
80
|
-
valueNodeHasChildren,
|
|
81
|
-
onValueNodeHasChildrenChange: setValueNodeHasChildren,
|
|
39
|
+
scope: __scopePopover,
|
|
82
40
|
contentId: useId(),
|
|
83
|
-
|
|
84
|
-
onValueChange: setValue,
|
|
41
|
+
triggerRef,
|
|
85
42
|
open,
|
|
86
43
|
onOpenChange: setOpen,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
scope: props.__scopeSelect,
|
|
95
|
-
onNativeOptionAdd: React.useCallback((option) => {
|
|
96
|
-
setNativeOptionsSet((prev) => new Set(prev).add(option));
|
|
97
|
-
}, []),
|
|
98
|
-
onNativeOptionRemove: React.useCallback((option) => {
|
|
99
|
-
setNativeOptionsSet((prev) => {
|
|
100
|
-
const optionsSet = new Set(prev);
|
|
101
|
-
optionsSet.delete(option);
|
|
102
|
-
return optionsSet;
|
|
103
|
-
});
|
|
104
|
-
}, []),
|
|
105
|
-
children
|
|
106
|
-
}
|
|
107
|
-
) }),
|
|
108
|
-
isFormControl ? /* @__PURE__ */ jsxs(
|
|
109
|
-
SelectBubbleInput,
|
|
110
|
-
{
|
|
111
|
-
"aria-hidden": true,
|
|
112
|
-
required,
|
|
113
|
-
tabIndex: -1,
|
|
114
|
-
name,
|
|
115
|
-
autoComplete,
|
|
116
|
-
value,
|
|
117
|
-
onChange: (event) => setValue(event.target.value),
|
|
118
|
-
disabled,
|
|
119
|
-
form,
|
|
120
|
-
children: [
|
|
121
|
-
value === void 0 ? /* @__PURE__ */ jsx("option", { value: "" }) : null,
|
|
122
|
-
Array.from(nativeOptionsSet)
|
|
123
|
-
]
|
|
124
|
-
},
|
|
125
|
-
nativeSelectKey
|
|
126
|
-
) : null
|
|
127
|
-
]
|
|
44
|
+
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
45
|
+
hasCustomAnchor,
|
|
46
|
+
onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
|
|
47
|
+
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),
|
|
48
|
+
modal,
|
|
49
|
+
children
|
|
128
50
|
}
|
|
129
51
|
) });
|
|
130
52
|
};
|
|
131
|
-
|
|
132
|
-
var
|
|
133
|
-
var
|
|
53
|
+
Popover.displayName = POPOVER_NAME;
|
|
54
|
+
var ANCHOR_NAME = "PopoverAnchor";
|
|
55
|
+
var PopoverAnchor = React.forwardRef(
|
|
134
56
|
(props, forwardedRef) => {
|
|
135
|
-
const {
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (pointerEvent) {
|
|
156
|
-
context.triggerPointerDownPosRef.current = {
|
|
157
|
-
x: Math.round(pointerEvent.pageX),
|
|
158
|
-
y: Math.round(pointerEvent.pageY)
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
return /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(
|
|
57
|
+
const { __scopePopover, ...anchorProps } = props;
|
|
58
|
+
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
59
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
60
|
+
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
onCustomAnchorAdd();
|
|
63
|
+
return () => onCustomAnchorRemove();
|
|
64
|
+
}, [onCustomAnchorAdd, onCustomAnchorRemove]);
|
|
65
|
+
return /* @__PURE__ */ jsx(Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
69
|
+
var TRIGGER_NAME = "PopoverTrigger";
|
|
70
|
+
var PopoverTrigger = React.forwardRef(
|
|
71
|
+
(props, forwardedRef) => {
|
|
72
|
+
const { __scopePopover, ...triggerProps } = props;
|
|
73
|
+
const context = usePopoverContext(TRIGGER_NAME, __scopePopover);
|
|
74
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
75
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
76
|
+
const trigger = /* @__PURE__ */ jsx(
|
|
163
77
|
Primitive.button,
|
|
164
78
|
{
|
|
165
79
|
type: "button",
|
|
166
|
-
|
|
167
|
-
"aria-controls": context.contentId,
|
|
80
|
+
"aria-haspopup": "dialog",
|
|
168
81
|
"aria-expanded": context.open,
|
|
169
|
-
"aria-
|
|
170
|
-
"
|
|
171
|
-
dir: context.dir,
|
|
172
|
-
"data-state": context.open ? "open" : "closed",
|
|
173
|
-
disabled: isDisabled,
|
|
174
|
-
"data-disabled": isDisabled ? "" : void 0,
|
|
175
|
-
"data-placeholder": shouldShowPlaceholder(context.value) ? "" : void 0,
|
|
82
|
+
"aria-controls": context.contentId,
|
|
83
|
+
"data-state": getState(context.open),
|
|
176
84
|
...triggerProps,
|
|
177
|
-
ref:
|
|
178
|
-
onClick: composeEventHandlers(
|
|
179
|
-
event.currentTarget.focus();
|
|
180
|
-
if (pointerTypeRef.current !== "mouse") {
|
|
181
|
-
handleOpen(event);
|
|
182
|
-
}
|
|
183
|
-
}),
|
|
184
|
-
onPointerDown: composeEventHandlers(triggerProps.onPointerDown, (event) => {
|
|
185
|
-
pointerTypeRef.current = event.pointerType;
|
|
186
|
-
const target = event.target;
|
|
187
|
-
if (target.hasPointerCapture(event.pointerId)) {
|
|
188
|
-
target.releasePointerCapture(event.pointerId);
|
|
189
|
-
}
|
|
190
|
-
if (event.button === 0 && event.ctrlKey === false && event.pointerType === "mouse") {
|
|
191
|
-
handleOpen(event);
|
|
192
|
-
event.preventDefault();
|
|
193
|
-
}
|
|
194
|
-
}),
|
|
195
|
-
onKeyDown: composeEventHandlers(triggerProps.onKeyDown, (event) => {
|
|
196
|
-
const isTypingAhead = searchRef.current !== "";
|
|
197
|
-
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
198
|
-
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
199
|
-
if (isTypingAhead && event.key === " ") return;
|
|
200
|
-
if (OPEN_KEYS.includes(event.key)) {
|
|
201
|
-
handleOpen();
|
|
202
|
-
event.preventDefault();
|
|
203
|
-
}
|
|
204
|
-
})
|
|
205
|
-
}
|
|
206
|
-
) });
|
|
207
|
-
}
|
|
208
|
-
);
|
|
209
|
-
SelectTrigger.displayName = TRIGGER_NAME;
|
|
210
|
-
var VALUE_NAME = "SelectValue";
|
|
211
|
-
var SelectValue = React.forwardRef(
|
|
212
|
-
(props, forwardedRef) => {
|
|
213
|
-
const { __scopeSelect, className, style, children, placeholder = "", ...valueProps } = props;
|
|
214
|
-
const context = useSelectContext(VALUE_NAME, __scopeSelect);
|
|
215
|
-
const { onValueNodeHasChildrenChange } = context;
|
|
216
|
-
const hasChildren = children !== void 0;
|
|
217
|
-
const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);
|
|
218
|
-
useLayoutEffect2(() => {
|
|
219
|
-
onValueNodeHasChildrenChange(hasChildren);
|
|
220
|
-
}, [onValueNodeHasChildrenChange, hasChildren]);
|
|
221
|
-
return /* @__PURE__ */ jsx(
|
|
222
|
-
Primitive.span,
|
|
223
|
-
{
|
|
224
|
-
...valueProps,
|
|
225
|
-
ref: composedRefs,
|
|
226
|
-
style: { pointerEvents: "none" },
|
|
227
|
-
children: shouldShowPlaceholder(context.value) ? /* @__PURE__ */ jsx(Fragment, { children: placeholder }) : children
|
|
85
|
+
ref: composedTriggerRef,
|
|
86
|
+
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
228
87
|
}
|
|
229
88
|
);
|
|
89
|
+
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: trigger });
|
|
230
90
|
}
|
|
231
91
|
);
|
|
232
|
-
|
|
233
|
-
var
|
|
234
|
-
var
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
);
|
|
240
|
-
|
|
241
|
-
var PORTAL_NAME = "SelectPortal";
|
|
242
|
-
var SelectPortal = (props) => {
|
|
243
|
-
return /* @__PURE__ */ jsx(Portal$1, { asChild: true, ...props });
|
|
92
|
+
PopoverTrigger.displayName = TRIGGER_NAME;
|
|
93
|
+
var PORTAL_NAME = "PopoverPortal";
|
|
94
|
+
var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME, {
|
|
95
|
+
forceMount: void 0
|
|
96
|
+
});
|
|
97
|
+
var PopoverPortal = (props) => {
|
|
98
|
+
const { __scopePopover, forceMount, children, container } = props;
|
|
99
|
+
const context = usePopoverContext(PORTAL_NAME, __scopePopover);
|
|
100
|
+
return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopePopover, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$1, { asChild: true, container, children }) }) });
|
|
244
101
|
};
|
|
245
|
-
|
|
246
|
-
var CONTENT_NAME = "
|
|
247
|
-
var
|
|
102
|
+
PopoverPortal.displayName = PORTAL_NAME;
|
|
103
|
+
var CONTENT_NAME = "PopoverContent";
|
|
104
|
+
var PopoverContent = React.forwardRef(
|
|
248
105
|
(props, forwardedRef) => {
|
|
249
|
-
const
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}, []);
|
|
254
|
-
if (!context.open) {
|
|
255
|
-
const frag = fragment;
|
|
256
|
-
return frag ? ReactDOM.createPortal(
|
|
257
|
-
/* @__PURE__ */ jsx(SelectContentProvider, { scope: props.__scopeSelect, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeSelect, children: /* @__PURE__ */ jsx("div", { children: props.children }) }) }),
|
|
258
|
-
frag
|
|
259
|
-
) : null;
|
|
260
|
-
}
|
|
261
|
-
return /* @__PURE__ */ jsx(SelectContentImpl, { ...props, ref: forwardedRef });
|
|
106
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);
|
|
107
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
108
|
+
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
109
|
+
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(PopoverContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(PopoverContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
262
110
|
}
|
|
263
111
|
);
|
|
264
|
-
|
|
265
|
-
var
|
|
266
|
-
var
|
|
267
|
-
var CONTENT_IMPL_NAME = "SelectContentImpl";
|
|
268
|
-
var Slot = createSlot("SelectContent.RemoveScroll");
|
|
269
|
-
var SelectContentImpl = React.forwardRef(
|
|
112
|
+
PopoverContent.displayName = CONTENT_NAME;
|
|
113
|
+
var Slot = createSlot("PopoverContent.RemoveScroll");
|
|
114
|
+
var PopoverContentModal = React.forwardRef(
|
|
270
115
|
(props, forwardedRef) => {
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
onEscapeKeyDown,
|
|
276
|
-
onPointerDownOutside,
|
|
277
|
-
//
|
|
278
|
-
// PopperContent props
|
|
279
|
-
side,
|
|
280
|
-
sideOffset,
|
|
281
|
-
align,
|
|
282
|
-
alignOffset,
|
|
283
|
-
arrowPadding,
|
|
284
|
-
collisionBoundary,
|
|
285
|
-
collisionPadding,
|
|
286
|
-
sticky,
|
|
287
|
-
hideWhenDetached,
|
|
288
|
-
avoidCollisions,
|
|
289
|
-
//
|
|
290
|
-
...contentProps
|
|
291
|
-
} = props;
|
|
292
|
-
const context = useSelectContext(CONTENT_NAME, __scopeSelect);
|
|
293
|
-
const [content, setContent] = React.useState(null);
|
|
294
|
-
const [viewport, setViewport] = React.useState(null);
|
|
295
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
296
|
-
const [selectedItem, setSelectedItem] = React.useState(null);
|
|
297
|
-
const [selectedItemText, setSelectedItemText] = React.useState(
|
|
298
|
-
null
|
|
299
|
-
);
|
|
300
|
-
const getItems = useCollection(__scopeSelect);
|
|
301
|
-
const [isPositioned, setIsPositioned] = React.useState(false);
|
|
302
|
-
const firstValidItemFoundRef = React.useRef(false);
|
|
116
|
+
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
117
|
+
const contentRef = React.useRef(null);
|
|
118
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
119
|
+
const isRightClickOutsideRef = React.useRef(false);
|
|
303
120
|
React.useEffect(() => {
|
|
121
|
+
const content = contentRef.current;
|
|
304
122
|
if (content) return hideOthers(content);
|
|
305
|
-
}, [
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
(candidates) => {
|
|
309
|
-
const [firstItem, ...restItems] = getItems().map((item) => item.ref.current);
|
|
310
|
-
const [lastItem] = restItems.slice(-1);
|
|
311
|
-
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
312
|
-
for (const candidate of candidates) {
|
|
313
|
-
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
314
|
-
candidate?.scrollIntoView({ block: "nearest" });
|
|
315
|
-
if (candidate === firstItem && viewport) viewport.scrollTop = 0;
|
|
316
|
-
if (candidate === lastItem && viewport) viewport.scrollTop = viewport.scrollHeight;
|
|
317
|
-
candidate?.focus();
|
|
318
|
-
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
319
|
-
}
|
|
320
|
-
},
|
|
321
|
-
[getItems, viewport]
|
|
322
|
-
);
|
|
323
|
-
const focusSelectedItem = React.useCallback(
|
|
324
|
-
() => focusFirst([selectedItem, content]),
|
|
325
|
-
[focusFirst, selectedItem, content]
|
|
326
|
-
);
|
|
327
|
-
React.useEffect(() => {
|
|
328
|
-
if (isPositioned) {
|
|
329
|
-
focusSelectedItem();
|
|
330
|
-
}
|
|
331
|
-
}, [isPositioned, focusSelectedItem]);
|
|
332
|
-
const { onOpenChange, triggerPointerDownPosRef } = context;
|
|
333
|
-
React.useEffect(() => {
|
|
334
|
-
if (content) {
|
|
335
|
-
let pointerMoveDelta = { x: 0, y: 0 };
|
|
336
|
-
const handlePointerMove = (event) => {
|
|
337
|
-
pointerMoveDelta = {
|
|
338
|
-
x: Math.abs(Math.round(event.pageX) - (triggerPointerDownPosRef.current?.x ?? 0)),
|
|
339
|
-
y: Math.abs(Math.round(event.pageY) - (triggerPointerDownPosRef.current?.y ?? 0))
|
|
340
|
-
};
|
|
341
|
-
};
|
|
342
|
-
const handlePointerUp = (event) => {
|
|
343
|
-
if (pointerMoveDelta.x <= 10 && pointerMoveDelta.y <= 10) {
|
|
344
|
-
event.preventDefault();
|
|
345
|
-
} else {
|
|
346
|
-
if (!content.contains(event.target)) {
|
|
347
|
-
onOpenChange(false);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
document.removeEventListener("pointermove", handlePointerMove);
|
|
351
|
-
triggerPointerDownPosRef.current = null;
|
|
352
|
-
};
|
|
353
|
-
if (triggerPointerDownPosRef.current !== null) {
|
|
354
|
-
document.addEventListener("pointermove", handlePointerMove);
|
|
355
|
-
document.addEventListener("pointerup", handlePointerUp, { capture: true, once: true });
|
|
356
|
-
}
|
|
357
|
-
return () => {
|
|
358
|
-
document.removeEventListener("pointermove", handlePointerMove);
|
|
359
|
-
document.removeEventListener("pointerup", handlePointerUp, { capture: true });
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
}, [content, onOpenChange, triggerPointerDownPosRef]);
|
|
363
|
-
React.useEffect(() => {
|
|
364
|
-
const close = () => onOpenChange(false);
|
|
365
|
-
window.addEventListener("blur", close);
|
|
366
|
-
window.addEventListener("resize", close);
|
|
367
|
-
return () => {
|
|
368
|
-
window.removeEventListener("blur", close);
|
|
369
|
-
window.removeEventListener("resize", close);
|
|
370
|
-
};
|
|
371
|
-
}, [onOpenChange]);
|
|
372
|
-
const [searchRef, handleTypeaheadSearch] = useTypeaheadSearch((search) => {
|
|
373
|
-
const enabledItems = getItems().filter((item) => !item.disabled);
|
|
374
|
-
const currentItem = enabledItems.find((item) => item.ref.current === document.activeElement);
|
|
375
|
-
const nextItem = findNextItem(enabledItems, search, currentItem);
|
|
376
|
-
if (nextItem) {
|
|
377
|
-
setTimeout(() => nextItem.ref.current.focus());
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
const itemRefCallback = React.useCallback(
|
|
381
|
-
(node, value, disabled) => {
|
|
382
|
-
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
383
|
-
const isSelectedItem = context.value !== void 0 && context.value === value;
|
|
384
|
-
if (isSelectedItem || isFirstValidItem) {
|
|
385
|
-
setSelectedItem(node);
|
|
386
|
-
if (isFirstValidItem) firstValidItemFoundRef.current = true;
|
|
387
|
-
}
|
|
388
|
-
},
|
|
389
|
-
[context.value]
|
|
390
|
-
);
|
|
391
|
-
const handleItemLeave = React.useCallback(() => content?.focus(), [content]);
|
|
392
|
-
const itemTextRefCallback = React.useCallback(
|
|
393
|
-
(node, value, disabled) => {
|
|
394
|
-
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
395
|
-
const isSelectedItem = context.value !== void 0 && context.value === value;
|
|
396
|
-
if (isSelectedItem || isFirstValidItem) {
|
|
397
|
-
setSelectedItemText(node);
|
|
398
|
-
}
|
|
399
|
-
},
|
|
400
|
-
[context.value]
|
|
401
|
-
);
|
|
402
|
-
const SelectPosition = position === "popper" ? SelectPopperPosition : SelectItemAlignedPosition;
|
|
403
|
-
const popperContentProps = SelectPosition === SelectPopperPosition ? {
|
|
404
|
-
side,
|
|
405
|
-
sideOffset,
|
|
406
|
-
align,
|
|
407
|
-
alignOffset,
|
|
408
|
-
arrowPadding,
|
|
409
|
-
collisionBoundary,
|
|
410
|
-
collisionPadding,
|
|
411
|
-
sticky,
|
|
412
|
-
hideWhenDetached,
|
|
413
|
-
avoidCollisions
|
|
414
|
-
} : {};
|
|
415
|
-
return /* @__PURE__ */ jsx(
|
|
416
|
-
SelectContentProvider,
|
|
123
|
+
}, []);
|
|
124
|
+
return /* @__PURE__ */ jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ jsx(
|
|
125
|
+
PopoverContentImpl,
|
|
417
126
|
{
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
event.preventDefault();
|
|
442
|
-
}),
|
|
443
|
-
children: /* @__PURE__ */ jsx(
|
|
444
|
-
DismissableLayer,
|
|
445
|
-
{
|
|
446
|
-
asChild: true,
|
|
447
|
-
disableOutsidePointerEvents: true,
|
|
448
|
-
onEscapeKeyDown,
|
|
449
|
-
onPointerDownOutside,
|
|
450
|
-
onFocusOutside: (event) => event.preventDefault(),
|
|
451
|
-
onDismiss: () => context.onOpenChange(false),
|
|
452
|
-
children: /* @__PURE__ */ jsx(
|
|
453
|
-
SelectPosition,
|
|
454
|
-
{
|
|
455
|
-
role: "listbox",
|
|
456
|
-
id: context.contentId,
|
|
457
|
-
"data-state": context.open ? "open" : "closed",
|
|
458
|
-
dir: context.dir,
|
|
459
|
-
onContextMenu: (event) => event.preventDefault(),
|
|
460
|
-
...contentProps,
|
|
461
|
-
...popperContentProps,
|
|
462
|
-
onPlaced: () => setIsPositioned(true),
|
|
463
|
-
ref: composedRefs,
|
|
464
|
-
style: {
|
|
465
|
-
// flex layout so we can place the scroll buttons properly
|
|
466
|
-
display: "flex",
|
|
467
|
-
flexDirection: "column",
|
|
468
|
-
// reset the outline by default as the content MAY get focused
|
|
469
|
-
outline: "none",
|
|
470
|
-
...contentProps.style
|
|
471
|
-
},
|
|
472
|
-
onKeyDown: composeEventHandlers(contentProps.onKeyDown, (event) => {
|
|
473
|
-
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
474
|
-
if (event.key === "Tab") event.preventDefault();
|
|
475
|
-
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
476
|
-
if (["ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) {
|
|
477
|
-
const items = getItems().filter((item) => !item.disabled);
|
|
478
|
-
let candidateNodes = items.map((item) => item.ref.current);
|
|
479
|
-
if (["ArrowUp", "End"].includes(event.key)) {
|
|
480
|
-
candidateNodes = candidateNodes.slice().reverse();
|
|
481
|
-
}
|
|
482
|
-
if (["ArrowUp", "ArrowDown"].includes(event.key)) {
|
|
483
|
-
const currentElement = event.target;
|
|
484
|
-
const currentIndex = candidateNodes.indexOf(currentElement);
|
|
485
|
-
candidateNodes = candidateNodes.slice(currentIndex + 1);
|
|
486
|
-
}
|
|
487
|
-
setTimeout(() => focusFirst(candidateNodes));
|
|
488
|
-
event.preventDefault();
|
|
489
|
-
}
|
|
490
|
-
})
|
|
491
|
-
}
|
|
492
|
-
)
|
|
493
|
-
}
|
|
494
|
-
)
|
|
495
|
-
}
|
|
496
|
-
) })
|
|
127
|
+
...props,
|
|
128
|
+
ref: composedRefs,
|
|
129
|
+
trapFocus: context.open,
|
|
130
|
+
disableOutsidePointerEvents: true,
|
|
131
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
|
|
134
|
+
}),
|
|
135
|
+
onPointerDownOutside: composeEventHandlers(
|
|
136
|
+
props.onPointerDownOutside,
|
|
137
|
+
(event) => {
|
|
138
|
+
const originalEvent = event.detail.originalEvent;
|
|
139
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
140
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
141
|
+
isRightClickOutsideRef.current = isRightClick;
|
|
142
|
+
},
|
|
143
|
+
{ checkForDefaultPrevented: false }
|
|
144
|
+
),
|
|
145
|
+
onFocusOutside: composeEventHandlers(
|
|
146
|
+
props.onFocusOutside,
|
|
147
|
+
(event) => event.preventDefault(),
|
|
148
|
+
{ checkForDefaultPrevented: false }
|
|
149
|
+
)
|
|
497
150
|
}
|
|
498
|
-
);
|
|
151
|
+
) });
|
|
499
152
|
}
|
|
500
153
|
);
|
|
501
|
-
|
|
502
|
-
var ITEM_ALIGNED_POSITION_NAME = "SelectItemAlignedPosition";
|
|
503
|
-
var SelectItemAlignedPosition = React.forwardRef((props, forwardedRef) => {
|
|
504
|
-
const { __scopeSelect, onPlaced, ...popperProps } = props;
|
|
505
|
-
const context = useSelectContext(CONTENT_NAME, __scopeSelect);
|
|
506
|
-
const contentContext = useSelectContentContext(CONTENT_NAME, __scopeSelect);
|
|
507
|
-
const [contentWrapper, setContentWrapper] = React.useState(null);
|
|
508
|
-
const [content, setContent] = React.useState(null);
|
|
509
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
510
|
-
const getItems = useCollection(__scopeSelect);
|
|
511
|
-
const shouldExpandOnScrollRef = React.useRef(false);
|
|
512
|
-
const shouldRepositionRef = React.useRef(true);
|
|
513
|
-
const { viewport, selectedItem, selectedItemText, focusSelectedItem } = contentContext;
|
|
514
|
-
const position = React.useCallback(() => {
|
|
515
|
-
if (context.trigger && context.valueNode && contentWrapper && content && viewport && selectedItem && selectedItemText) {
|
|
516
|
-
const triggerRect = context.trigger.getBoundingClientRect();
|
|
517
|
-
const contentRect = content.getBoundingClientRect();
|
|
518
|
-
const valueNodeRect = context.valueNode.getBoundingClientRect();
|
|
519
|
-
const itemTextRect = selectedItemText.getBoundingClientRect();
|
|
520
|
-
if (context.dir !== "rtl") {
|
|
521
|
-
const itemTextOffset = itemTextRect.left - contentRect.left;
|
|
522
|
-
const left = valueNodeRect.left - itemTextOffset;
|
|
523
|
-
const leftDelta = triggerRect.left - left;
|
|
524
|
-
const minContentWidth = triggerRect.width + leftDelta;
|
|
525
|
-
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
526
|
-
const rightEdge = window.innerWidth - CONTENT_MARGIN;
|
|
527
|
-
const clampedLeft = clamp(left, [
|
|
528
|
-
CONTENT_MARGIN,
|
|
529
|
-
// Prevents the content from going off the starting edge of the
|
|
530
|
-
// viewport. It may still go off the ending edge, but this can be
|
|
531
|
-
// controlled by the user since they may want to manage overflow in a
|
|
532
|
-
// specific way.
|
|
533
|
-
// https://github.com/radix-ui/primitives/issues/2049
|
|
534
|
-
Math.max(CONTENT_MARGIN, rightEdge - contentWidth)
|
|
535
|
-
]);
|
|
536
|
-
contentWrapper.style.minWidth = minContentWidth + "px";
|
|
537
|
-
contentWrapper.style.left = clampedLeft + "px";
|
|
538
|
-
} else {
|
|
539
|
-
const itemTextOffset = contentRect.right - itemTextRect.right;
|
|
540
|
-
const right = window.innerWidth - valueNodeRect.right - itemTextOffset;
|
|
541
|
-
const rightDelta = window.innerWidth - triggerRect.right - right;
|
|
542
|
-
const minContentWidth = triggerRect.width + rightDelta;
|
|
543
|
-
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
544
|
-
const leftEdge = window.innerWidth - CONTENT_MARGIN;
|
|
545
|
-
const clampedRight = clamp(right, [
|
|
546
|
-
CONTENT_MARGIN,
|
|
547
|
-
Math.max(CONTENT_MARGIN, leftEdge - contentWidth)
|
|
548
|
-
]);
|
|
549
|
-
contentWrapper.style.minWidth = minContentWidth + "px";
|
|
550
|
-
contentWrapper.style.right = clampedRight + "px";
|
|
551
|
-
}
|
|
552
|
-
const items = getItems();
|
|
553
|
-
const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;
|
|
554
|
-
const itemsHeight = viewport.scrollHeight;
|
|
555
|
-
const contentStyles = window.getComputedStyle(content);
|
|
556
|
-
const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10);
|
|
557
|
-
const contentPaddingTop = parseInt(contentStyles.paddingTop, 10);
|
|
558
|
-
const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10);
|
|
559
|
-
const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10);
|
|
560
|
-
const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth;
|
|
561
|
-
const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight);
|
|
562
|
-
const viewportStyles = window.getComputedStyle(viewport);
|
|
563
|
-
const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10);
|
|
564
|
-
const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10);
|
|
565
|
-
const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - CONTENT_MARGIN;
|
|
566
|
-
const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;
|
|
567
|
-
const selectedItemHalfHeight = selectedItem.offsetHeight / 2;
|
|
568
|
-
const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight;
|
|
569
|
-
const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;
|
|
570
|
-
const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;
|
|
571
|
-
const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle;
|
|
572
|
-
if (willAlignWithoutTopOverflow) {
|
|
573
|
-
const isLastItem = items.length > 0 && selectedItem === items[items.length - 1].ref.current;
|
|
574
|
-
contentWrapper.style.bottom = "0px";
|
|
575
|
-
const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;
|
|
576
|
-
const clampedTriggerMiddleToBottomEdge = Math.max(
|
|
577
|
-
triggerMiddleToBottomEdge,
|
|
578
|
-
selectedItemHalfHeight + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
579
|
-
(isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth
|
|
580
|
-
);
|
|
581
|
-
const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge;
|
|
582
|
-
contentWrapper.style.height = height + "px";
|
|
583
|
-
} else {
|
|
584
|
-
const isFirstItem = items.length > 0 && selectedItem === items[0].ref.current;
|
|
585
|
-
contentWrapper.style.top = "0px";
|
|
586
|
-
const clampedTopEdgeToTriggerMiddle = Math.max(
|
|
587
|
-
topEdgeToTriggerMiddle,
|
|
588
|
-
contentBorderTopWidth + viewport.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
589
|
-
(isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight
|
|
590
|
-
);
|
|
591
|
-
const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom;
|
|
592
|
-
contentWrapper.style.height = height + "px";
|
|
593
|
-
viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop;
|
|
594
|
-
}
|
|
595
|
-
contentWrapper.style.margin = `${CONTENT_MARGIN}px 0`;
|
|
596
|
-
contentWrapper.style.minHeight = minContentHeight + "px";
|
|
597
|
-
contentWrapper.style.maxHeight = availableHeight + "px";
|
|
598
|
-
onPlaced?.();
|
|
599
|
-
requestAnimationFrame(() => shouldExpandOnScrollRef.current = true);
|
|
600
|
-
}
|
|
601
|
-
}, [
|
|
602
|
-
getItems,
|
|
603
|
-
context.trigger,
|
|
604
|
-
context.valueNode,
|
|
605
|
-
contentWrapper,
|
|
606
|
-
content,
|
|
607
|
-
viewport,
|
|
608
|
-
selectedItem,
|
|
609
|
-
selectedItemText,
|
|
610
|
-
context.dir,
|
|
611
|
-
onPlaced
|
|
612
|
-
]);
|
|
613
|
-
useLayoutEffect2(() => position(), [position]);
|
|
614
|
-
const [contentZIndex, setContentZIndex] = React.useState();
|
|
615
|
-
useLayoutEffect2(() => {
|
|
616
|
-
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
617
|
-
}, [content]);
|
|
618
|
-
const handleScrollButtonChange = React.useCallback(
|
|
619
|
-
(node) => {
|
|
620
|
-
if (node && shouldRepositionRef.current === true) {
|
|
621
|
-
position();
|
|
622
|
-
focusSelectedItem?.();
|
|
623
|
-
shouldRepositionRef.current = false;
|
|
624
|
-
}
|
|
625
|
-
},
|
|
626
|
-
[position, focusSelectedItem]
|
|
627
|
-
);
|
|
628
|
-
return /* @__PURE__ */ jsx(
|
|
629
|
-
SelectViewportProvider,
|
|
630
|
-
{
|
|
631
|
-
scope: __scopeSelect,
|
|
632
|
-
contentWrapper,
|
|
633
|
-
shouldExpandOnScrollRef,
|
|
634
|
-
onScrollButtonChange: handleScrollButtonChange,
|
|
635
|
-
children: /* @__PURE__ */ jsx(
|
|
636
|
-
"div",
|
|
637
|
-
{
|
|
638
|
-
ref: setContentWrapper,
|
|
639
|
-
style: {
|
|
640
|
-
display: "flex",
|
|
641
|
-
flexDirection: "column",
|
|
642
|
-
position: "fixed",
|
|
643
|
-
zIndex: contentZIndex
|
|
644
|
-
},
|
|
645
|
-
children: /* @__PURE__ */ jsx(
|
|
646
|
-
Primitive.div,
|
|
647
|
-
{
|
|
648
|
-
...popperProps,
|
|
649
|
-
ref: composedRefs,
|
|
650
|
-
style: {
|
|
651
|
-
// When we get the height of the content, it includes borders. If we were to set
|
|
652
|
-
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
653
|
-
boxSizing: "border-box",
|
|
654
|
-
// We need to ensure the content doesn't get taller than the wrapper
|
|
655
|
-
maxHeight: "100%",
|
|
656
|
-
...popperProps.style
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
)
|
|
660
|
-
}
|
|
661
|
-
)
|
|
662
|
-
}
|
|
663
|
-
);
|
|
664
|
-
});
|
|
665
|
-
SelectItemAlignedPosition.displayName = ITEM_ALIGNED_POSITION_NAME;
|
|
666
|
-
var POPPER_POSITION_NAME = "SelectPopperPosition";
|
|
667
|
-
var SelectPopperPosition = React.forwardRef((props, forwardedRef) => {
|
|
668
|
-
const {
|
|
669
|
-
__scopeSelect,
|
|
670
|
-
align = "start",
|
|
671
|
-
collisionPadding = CONTENT_MARGIN,
|
|
672
|
-
...popperProps
|
|
673
|
-
} = props;
|
|
674
|
-
const popperScope = usePopperScope(__scopeSelect);
|
|
675
|
-
return /* @__PURE__ */ jsx(
|
|
676
|
-
Content,
|
|
677
|
-
{
|
|
678
|
-
...popperScope,
|
|
679
|
-
...popperProps,
|
|
680
|
-
ref: forwardedRef,
|
|
681
|
-
align,
|
|
682
|
-
collisionPadding,
|
|
683
|
-
style: {
|
|
684
|
-
// Ensure border-box for floating-ui calculations
|
|
685
|
-
boxSizing: "border-box",
|
|
686
|
-
...popperProps.style,
|
|
687
|
-
// re-namespace exposed content custom properties
|
|
688
|
-
...{
|
|
689
|
-
"--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
690
|
-
"--radix-select-content-available-width": "var(--radix-popper-available-width)",
|
|
691
|
-
"--radix-select-content-available-height": "var(--radix-popper-available-height)",
|
|
692
|
-
"--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
|
|
693
|
-
"--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
);
|
|
698
|
-
});
|
|
699
|
-
SelectPopperPosition.displayName = POPPER_POSITION_NAME;
|
|
700
|
-
var [SelectViewportProvider, useSelectViewportContext] = createSelectContext(CONTENT_NAME, {});
|
|
701
|
-
var VIEWPORT_NAME = "SelectViewport";
|
|
702
|
-
var SelectViewport = React.forwardRef(
|
|
154
|
+
var PopoverContentNonModal = React.forwardRef(
|
|
703
155
|
(props, forwardedRef) => {
|
|
704
|
-
const
|
|
705
|
-
const
|
|
706
|
-
const
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
// (independent of the scrollUpButton).
|
|
730
|
-
position: "relative",
|
|
731
|
-
flex: 1,
|
|
732
|
-
// Viewport should only be scrollable in the vertical direction.
|
|
733
|
-
// This won't work in vertical writing modes, so we'll need to
|
|
734
|
-
// revisit this if/when that is supported
|
|
735
|
-
// https://developer.chrome.com/blog/vertical-form-controls
|
|
736
|
-
overflow: "hidden auto",
|
|
737
|
-
...viewportProps.style
|
|
738
|
-
},
|
|
739
|
-
onScroll: composeEventHandlers(viewportProps.onScroll, (event) => {
|
|
740
|
-
const viewport = event.currentTarget;
|
|
741
|
-
const { contentWrapper, shouldExpandOnScrollRef } = viewportContext;
|
|
742
|
-
if (shouldExpandOnScrollRef?.current && contentWrapper) {
|
|
743
|
-
const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop);
|
|
744
|
-
if (scrolledBy > 0) {
|
|
745
|
-
const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;
|
|
746
|
-
const cssMinHeight = parseFloat(contentWrapper.style.minHeight);
|
|
747
|
-
const cssHeight = parseFloat(contentWrapper.style.height);
|
|
748
|
-
const prevHeight = Math.max(cssMinHeight, cssHeight);
|
|
749
|
-
if (prevHeight < availableHeight) {
|
|
750
|
-
const nextHeight = prevHeight + scrolledBy;
|
|
751
|
-
const clampedNextHeight = Math.min(availableHeight, nextHeight);
|
|
752
|
-
const heightDiff = nextHeight - clampedNextHeight;
|
|
753
|
-
contentWrapper.style.height = clampedNextHeight + "px";
|
|
754
|
-
if (contentWrapper.style.bottom === "0px") {
|
|
755
|
-
viewport.scrollTop = heightDiff > 0 ? heightDiff : 0;
|
|
756
|
-
contentWrapper.style.justifyContent = "flex-end";
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
}
|
|
156
|
+
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
157
|
+
const hasInteractedOutsideRef = React.useRef(false);
|
|
158
|
+
const hasPointerDownOutsideRef = React.useRef(false);
|
|
159
|
+
return /* @__PURE__ */ jsx(
|
|
160
|
+
PopoverContentImpl,
|
|
161
|
+
{
|
|
162
|
+
...props,
|
|
163
|
+
ref: forwardedRef,
|
|
164
|
+
trapFocus: false,
|
|
165
|
+
disableOutsidePointerEvents: false,
|
|
166
|
+
onCloseAutoFocus: (event) => {
|
|
167
|
+
props.onCloseAutoFocus?.(event);
|
|
168
|
+
if (!event.defaultPrevented) {
|
|
169
|
+
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
}
|
|
172
|
+
hasInteractedOutsideRef.current = false;
|
|
173
|
+
hasPointerDownOutsideRef.current = false;
|
|
174
|
+
},
|
|
175
|
+
onInteractOutside: (event) => {
|
|
176
|
+
props.onInteractOutside?.(event);
|
|
177
|
+
if (!event.defaultPrevented) {
|
|
178
|
+
hasInteractedOutsideRef.current = true;
|
|
179
|
+
if (event.detail.originalEvent.type === "pointerdown") {
|
|
180
|
+
hasPointerDownOutsideRef.current = true;
|
|
760
181
|
}
|
|
761
|
-
|
|
762
|
-
|
|
182
|
+
}
|
|
183
|
+
const target = event.target;
|
|
184
|
+
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
185
|
+
if (targetIsTrigger) event.preventDefault();
|
|
186
|
+
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
187
|
+
event.preventDefault();
|
|
188
|
+
}
|
|
763
189
|
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
}
|
|
767
|
-
);
|
|
768
|
-
SelectViewport.displayName = VIEWPORT_NAME;
|
|
769
|
-
var GROUP_NAME = "SelectGroup";
|
|
770
|
-
var [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext(GROUP_NAME);
|
|
771
|
-
var SelectGroup = React.forwardRef(
|
|
772
|
-
(props, forwardedRef) => {
|
|
773
|
-
const { __scopeSelect, ...groupProps } = props;
|
|
774
|
-
const groupId = useId();
|
|
775
|
-
return /* @__PURE__ */ jsx(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId, children: /* @__PURE__ */ jsx(Primitive.div, { role: "group", "aria-labelledby": groupId, ...groupProps, ref: forwardedRef }) });
|
|
776
|
-
}
|
|
777
|
-
);
|
|
778
|
-
SelectGroup.displayName = GROUP_NAME;
|
|
779
|
-
var LABEL_NAME = "SelectLabel";
|
|
780
|
-
var SelectLabel = React.forwardRef(
|
|
781
|
-
(props, forwardedRef) => {
|
|
782
|
-
const { __scopeSelect, ...labelProps } = props;
|
|
783
|
-
const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
784
|
-
return /* @__PURE__ */ jsx(Primitive.div, { id: groupContext.id, ...labelProps, ref: forwardedRef });
|
|
190
|
+
}
|
|
191
|
+
);
|
|
785
192
|
}
|
|
786
193
|
);
|
|
787
|
-
|
|
788
|
-
var ITEM_NAME = "SelectItem";
|
|
789
|
-
var [SelectItemContextProvider, useSelectItemContext] = createSelectContext(ITEM_NAME);
|
|
790
|
-
var SelectItem = React.forwardRef(
|
|
194
|
+
var PopoverContentImpl = React.forwardRef(
|
|
791
195
|
(props, forwardedRef) => {
|
|
792
196
|
const {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
197
|
+
__scopePopover,
|
|
198
|
+
trapFocus,
|
|
199
|
+
onOpenAutoFocus,
|
|
200
|
+
onCloseAutoFocus,
|
|
201
|
+
disableOutsidePointerEvents,
|
|
202
|
+
onEscapeKeyDown,
|
|
203
|
+
onPointerDownOutside,
|
|
204
|
+
onFocusOutside,
|
|
205
|
+
onInteractOutside,
|
|
206
|
+
...contentProps
|
|
798
207
|
} = props;
|
|
799
|
-
const context =
|
|
800
|
-
const
|
|
801
|
-
|
|
802
|
-
const [textValue, setTextValue] = React.useState(textValueProp ?? "");
|
|
803
|
-
const [isFocused, setIsFocused] = React.useState(false);
|
|
804
|
-
const composedRefs = useComposedRefs(
|
|
805
|
-
forwardedRef,
|
|
806
|
-
(node) => contentContext.itemRefCallback?.(node, value, disabled)
|
|
807
|
-
);
|
|
808
|
-
const textId = useId();
|
|
809
|
-
const pointerTypeRef = React.useRef("touch");
|
|
810
|
-
const handleSelect = () => {
|
|
811
|
-
if (!disabled) {
|
|
812
|
-
context.onValueChange(value);
|
|
813
|
-
context.onOpenChange(false);
|
|
814
|
-
}
|
|
815
|
-
};
|
|
816
|
-
if (value === "") {
|
|
817
|
-
throw new Error(
|
|
818
|
-
"A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
|
|
819
|
-
);
|
|
820
|
-
}
|
|
208
|
+
const context = usePopoverContext(CONTENT_NAME, __scopePopover);
|
|
209
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
210
|
+
useFocusGuards();
|
|
821
211
|
return /* @__PURE__ */ jsx(
|
|
822
|
-
|
|
212
|
+
FocusScope,
|
|
823
213
|
{
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
onItemTextChange: React.useCallback((node) => {
|
|
830
|
-
setTextValue((prevTextValue) => prevTextValue || (node?.textContent ?? "").trim());
|
|
831
|
-
}, []),
|
|
214
|
+
asChild: true,
|
|
215
|
+
loop: true,
|
|
216
|
+
trapped: trapFocus,
|
|
217
|
+
onMountAutoFocus: onOpenAutoFocus,
|
|
218
|
+
onUnmountAutoFocus: onCloseAutoFocus,
|
|
832
219
|
children: /* @__PURE__ */ jsx(
|
|
833
|
-
|
|
220
|
+
DismissableLayer,
|
|
834
221
|
{
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
222
|
+
asChild: true,
|
|
223
|
+
disableOutsidePointerEvents,
|
|
224
|
+
onInteractOutside,
|
|
225
|
+
onEscapeKeyDown,
|
|
226
|
+
onPointerDownOutside,
|
|
227
|
+
onFocusOutside,
|
|
228
|
+
onDismiss: () => context.onOpenChange(false),
|
|
839
229
|
children: /* @__PURE__ */ jsx(
|
|
840
|
-
|
|
230
|
+
Content,
|
|
841
231
|
{
|
|
842
|
-
|
|
843
|
-
"
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
onPointerUp: composeEventHandlers(itemProps.onPointerUp, () => {
|
|
858
|
-
if (pointerTypeRef.current === "mouse") handleSelect();
|
|
859
|
-
}),
|
|
860
|
-
onPointerDown: composeEventHandlers(itemProps.onPointerDown, (event) => {
|
|
861
|
-
pointerTypeRef.current = event.pointerType;
|
|
862
|
-
}),
|
|
863
|
-
onPointerMove: composeEventHandlers(itemProps.onPointerMove, (event) => {
|
|
864
|
-
pointerTypeRef.current = event.pointerType;
|
|
865
|
-
if (disabled) {
|
|
866
|
-
contentContext.onItemLeave?.();
|
|
867
|
-
} else if (pointerTypeRef.current === "mouse") {
|
|
868
|
-
event.currentTarget.focus({ preventScroll: true });
|
|
869
|
-
}
|
|
870
|
-
}),
|
|
871
|
-
onPointerLeave: composeEventHandlers(itemProps.onPointerLeave, (event) => {
|
|
872
|
-
if (event.currentTarget === document.activeElement) {
|
|
873
|
-
contentContext.onItemLeave?.();
|
|
232
|
+
"data-state": getState(context.open),
|
|
233
|
+
role: "dialog",
|
|
234
|
+
id: context.contentId,
|
|
235
|
+
...popperScope,
|
|
236
|
+
...contentProps,
|
|
237
|
+
ref: forwardedRef,
|
|
238
|
+
style: {
|
|
239
|
+
...contentProps.style,
|
|
240
|
+
// re-namespace exposed content custom properties
|
|
241
|
+
...{
|
|
242
|
+
"--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
243
|
+
"--radix-popover-content-available-width": "var(--radix-popper-available-width)",
|
|
244
|
+
"--radix-popover-content-available-height": "var(--radix-popper-available-height)",
|
|
245
|
+
"--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
|
|
246
|
+
"--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
|
|
874
247
|
}
|
|
875
|
-
}
|
|
876
|
-
onKeyDown: composeEventHandlers(itemProps.onKeyDown, (event) => {
|
|
877
|
-
const isTypingAhead = contentContext.searchRef?.current !== "";
|
|
878
|
-
if (isTypingAhead && event.key === " ") return;
|
|
879
|
-
if (SELECTION_KEYS.includes(event.key)) handleSelect();
|
|
880
|
-
if (event.key === " ") event.preventDefault();
|
|
881
|
-
})
|
|
248
|
+
}
|
|
882
249
|
}
|
|
883
250
|
)
|
|
884
251
|
}
|
|
@@ -887,265 +254,39 @@ var SelectItem = React.forwardRef(
|
|
|
887
254
|
);
|
|
888
255
|
}
|
|
889
256
|
);
|
|
890
|
-
|
|
891
|
-
var
|
|
892
|
-
var SelectItemText = React.forwardRef(
|
|
893
|
-
(props, forwardedRef) => {
|
|
894
|
-
const { __scopeSelect, className, style, ...itemTextProps } = props;
|
|
895
|
-
const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
896
|
-
const contentContext = useSelectContentContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
897
|
-
const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
898
|
-
const nativeOptionsContext = useSelectNativeOptionsContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
899
|
-
const [itemTextNode, setItemTextNode] = React.useState(null);
|
|
900
|
-
const composedRefs = useComposedRefs(
|
|
901
|
-
forwardedRef,
|
|
902
|
-
(node) => setItemTextNode(node),
|
|
903
|
-
itemContext.onItemTextChange,
|
|
904
|
-
(node) => contentContext.itemTextRefCallback?.(node, itemContext.value, itemContext.disabled)
|
|
905
|
-
);
|
|
906
|
-
const textContent = itemTextNode?.textContent;
|
|
907
|
-
const nativeOption = React.useMemo(
|
|
908
|
-
() => /* @__PURE__ */ jsx("option", { value: itemContext.value, disabled: itemContext.disabled, children: textContent }, itemContext.value),
|
|
909
|
-
[itemContext.disabled, itemContext.value, textContent]
|
|
910
|
-
);
|
|
911
|
-
const { onNativeOptionAdd, onNativeOptionRemove } = nativeOptionsContext;
|
|
912
|
-
useLayoutEffect2(() => {
|
|
913
|
-
onNativeOptionAdd(nativeOption);
|
|
914
|
-
return () => onNativeOptionRemove(nativeOption);
|
|
915
|
-
}, [onNativeOptionAdd, onNativeOptionRemove, nativeOption]);
|
|
916
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
917
|
-
/* @__PURE__ */ jsx(Primitive.span, { id: itemContext.textId, ...itemTextProps, ref: composedRefs }),
|
|
918
|
-
itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren ? ReactDOM.createPortal(itemTextProps.children, context.valueNode) : null
|
|
919
|
-
] });
|
|
920
|
-
}
|
|
921
|
-
);
|
|
922
|
-
SelectItemText.displayName = ITEM_TEXT_NAME;
|
|
923
|
-
var ITEM_INDICATOR_NAME = "SelectItemIndicator";
|
|
924
|
-
var SelectItemIndicator = React.forwardRef(
|
|
925
|
-
(props, forwardedRef) => {
|
|
926
|
-
const { __scopeSelect, ...itemIndicatorProps } = props;
|
|
927
|
-
const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
928
|
-
return itemContext.isSelected ? /* @__PURE__ */ jsx(Primitive.span, { "aria-hidden": true, ...itemIndicatorProps, ref: forwardedRef }) : null;
|
|
929
|
-
}
|
|
930
|
-
);
|
|
931
|
-
SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
|
|
932
|
-
var SCROLL_UP_BUTTON_NAME = "SelectScrollUpButton";
|
|
933
|
-
var SelectScrollUpButton = React.forwardRef((props, forwardedRef) => {
|
|
934
|
-
const contentContext = useSelectContentContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
935
|
-
const viewportContext = useSelectViewportContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
936
|
-
const [canScrollUp, setCanScrollUp] = React.useState(false);
|
|
937
|
-
const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);
|
|
938
|
-
useLayoutEffect2(() => {
|
|
939
|
-
if (contentContext.viewport && contentContext.isPositioned) {
|
|
940
|
-
let handleScroll2 = function() {
|
|
941
|
-
const canScrollUp2 = viewport.scrollTop > 0;
|
|
942
|
-
setCanScrollUp(canScrollUp2);
|
|
943
|
-
};
|
|
944
|
-
const viewport = contentContext.viewport;
|
|
945
|
-
handleScroll2();
|
|
946
|
-
viewport.addEventListener("scroll", handleScroll2);
|
|
947
|
-
return () => viewport.removeEventListener("scroll", handleScroll2);
|
|
948
|
-
}
|
|
949
|
-
}, [contentContext.viewport, contentContext.isPositioned]);
|
|
950
|
-
return canScrollUp ? /* @__PURE__ */ jsx(
|
|
951
|
-
SelectScrollButtonImpl,
|
|
952
|
-
{
|
|
953
|
-
...props,
|
|
954
|
-
ref: composedRefs,
|
|
955
|
-
onAutoScroll: () => {
|
|
956
|
-
const { viewport, selectedItem } = contentContext;
|
|
957
|
-
if (viewport && selectedItem) {
|
|
958
|
-
viewport.scrollTop = viewport.scrollTop - selectedItem.offsetHeight;
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
) : null;
|
|
963
|
-
});
|
|
964
|
-
SelectScrollUpButton.displayName = SCROLL_UP_BUTTON_NAME;
|
|
965
|
-
var SCROLL_DOWN_BUTTON_NAME = "SelectScrollDownButton";
|
|
966
|
-
var SelectScrollDownButton = React.forwardRef((props, forwardedRef) => {
|
|
967
|
-
const contentContext = useSelectContentContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
968
|
-
const viewportContext = useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
969
|
-
const [canScrollDown, setCanScrollDown] = React.useState(false);
|
|
970
|
-
const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);
|
|
971
|
-
useLayoutEffect2(() => {
|
|
972
|
-
if (contentContext.viewport && contentContext.isPositioned) {
|
|
973
|
-
let handleScroll2 = function() {
|
|
974
|
-
const maxScroll = viewport.scrollHeight - viewport.clientHeight;
|
|
975
|
-
const canScrollDown2 = Math.ceil(viewport.scrollTop) < maxScroll;
|
|
976
|
-
setCanScrollDown(canScrollDown2);
|
|
977
|
-
};
|
|
978
|
-
const viewport = contentContext.viewport;
|
|
979
|
-
handleScroll2();
|
|
980
|
-
viewport.addEventListener("scroll", handleScroll2);
|
|
981
|
-
return () => viewport.removeEventListener("scroll", handleScroll2);
|
|
982
|
-
}
|
|
983
|
-
}, [contentContext.viewport, contentContext.isPositioned]);
|
|
984
|
-
return canScrollDown ? /* @__PURE__ */ jsx(
|
|
985
|
-
SelectScrollButtonImpl,
|
|
986
|
-
{
|
|
987
|
-
...props,
|
|
988
|
-
ref: composedRefs,
|
|
989
|
-
onAutoScroll: () => {
|
|
990
|
-
const { viewport, selectedItem } = contentContext;
|
|
991
|
-
if (viewport && selectedItem) {
|
|
992
|
-
viewport.scrollTop = viewport.scrollTop + selectedItem.offsetHeight;
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
) : null;
|
|
997
|
-
});
|
|
998
|
-
SelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;
|
|
999
|
-
var SelectScrollButtonImpl = React.forwardRef((props, forwardedRef) => {
|
|
1000
|
-
const { __scopeSelect, onAutoScroll, ...scrollIndicatorProps } = props;
|
|
1001
|
-
const contentContext = useSelectContentContext("SelectScrollButton", __scopeSelect);
|
|
1002
|
-
const autoScrollTimerRef = React.useRef(null);
|
|
1003
|
-
const getItems = useCollection(__scopeSelect);
|
|
1004
|
-
const clearAutoScrollTimer = React.useCallback(() => {
|
|
1005
|
-
if (autoScrollTimerRef.current !== null) {
|
|
1006
|
-
window.clearInterval(autoScrollTimerRef.current);
|
|
1007
|
-
autoScrollTimerRef.current = null;
|
|
1008
|
-
}
|
|
1009
|
-
}, []);
|
|
1010
|
-
React.useEffect(() => {
|
|
1011
|
-
return () => clearAutoScrollTimer();
|
|
1012
|
-
}, [clearAutoScrollTimer]);
|
|
1013
|
-
useLayoutEffect2(() => {
|
|
1014
|
-
const activeItem = getItems().find((item) => item.ref.current === document.activeElement);
|
|
1015
|
-
activeItem?.ref.current?.scrollIntoView({ block: "nearest" });
|
|
1016
|
-
}, [getItems]);
|
|
1017
|
-
return /* @__PURE__ */ jsx(
|
|
1018
|
-
Primitive.div,
|
|
1019
|
-
{
|
|
1020
|
-
"aria-hidden": true,
|
|
1021
|
-
...scrollIndicatorProps,
|
|
1022
|
-
ref: forwardedRef,
|
|
1023
|
-
style: { flexShrink: 0, ...scrollIndicatorProps.style },
|
|
1024
|
-
onPointerDown: composeEventHandlers(scrollIndicatorProps.onPointerDown, () => {
|
|
1025
|
-
if (autoScrollTimerRef.current === null) {
|
|
1026
|
-
autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
1027
|
-
}
|
|
1028
|
-
}),
|
|
1029
|
-
onPointerMove: composeEventHandlers(scrollIndicatorProps.onPointerMove, () => {
|
|
1030
|
-
contentContext.onItemLeave?.();
|
|
1031
|
-
if (autoScrollTimerRef.current === null) {
|
|
1032
|
-
autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
1033
|
-
}
|
|
1034
|
-
}),
|
|
1035
|
-
onPointerLeave: composeEventHandlers(scrollIndicatorProps.onPointerLeave, () => {
|
|
1036
|
-
clearAutoScrollTimer();
|
|
1037
|
-
})
|
|
1038
|
-
}
|
|
1039
|
-
);
|
|
1040
|
-
});
|
|
1041
|
-
var SEPARATOR_NAME = "SelectSeparator";
|
|
1042
|
-
var SelectSeparator = React.forwardRef(
|
|
1043
|
-
(props, forwardedRef) => {
|
|
1044
|
-
const { __scopeSelect, ...separatorProps } = props;
|
|
1045
|
-
return /* @__PURE__ */ jsx(Primitive.div, { "aria-hidden": true, ...separatorProps, ref: forwardedRef });
|
|
1046
|
-
}
|
|
1047
|
-
);
|
|
1048
|
-
SelectSeparator.displayName = SEPARATOR_NAME;
|
|
1049
|
-
var ARROW_NAME = "SelectArrow";
|
|
1050
|
-
var SelectArrow = React.forwardRef(
|
|
257
|
+
var CLOSE_NAME = "PopoverClose";
|
|
258
|
+
var PopoverClose = React.forwardRef(
|
|
1051
259
|
(props, forwardedRef) => {
|
|
1052
|
-
const {
|
|
1053
|
-
const
|
|
1054
|
-
const context = useSelectContext(ARROW_NAME, __scopeSelect);
|
|
1055
|
-
const contentContext = useSelectContentContext(ARROW_NAME, __scopeSelect);
|
|
1056
|
-
return context.open && contentContext.position === "popper" ? /* @__PURE__ */ jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef }) : null;
|
|
1057
|
-
}
|
|
1058
|
-
);
|
|
1059
|
-
SelectArrow.displayName = ARROW_NAME;
|
|
1060
|
-
var BUBBLE_INPUT_NAME = "SelectBubbleInput";
|
|
1061
|
-
var SelectBubbleInput = React.forwardRef(
|
|
1062
|
-
({ __scopeSelect, value, ...props }, forwardedRef) => {
|
|
1063
|
-
const ref = React.useRef(null);
|
|
1064
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
1065
|
-
const prevValue = usePrevious(value);
|
|
1066
|
-
React.useEffect(() => {
|
|
1067
|
-
const select = ref.current;
|
|
1068
|
-
if (!select) return;
|
|
1069
|
-
const selectProto = window.HTMLSelectElement.prototype;
|
|
1070
|
-
const descriptor = Object.getOwnPropertyDescriptor(
|
|
1071
|
-
selectProto,
|
|
1072
|
-
"value"
|
|
1073
|
-
);
|
|
1074
|
-
const setValue = descriptor.set;
|
|
1075
|
-
if (prevValue !== value && setValue) {
|
|
1076
|
-
const event = new Event("change", { bubbles: true });
|
|
1077
|
-
setValue.call(select, value);
|
|
1078
|
-
select.dispatchEvent(event);
|
|
1079
|
-
}
|
|
1080
|
-
}, [prevValue, value]);
|
|
260
|
+
const { __scopePopover, ...closeProps } = props;
|
|
261
|
+
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
|
|
1081
262
|
return /* @__PURE__ */ jsx(
|
|
1082
|
-
Primitive.
|
|
263
|
+
Primitive.button,
|
|
1083
264
|
{
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
ref:
|
|
1087
|
-
|
|
265
|
+
type: "button",
|
|
266
|
+
...closeProps,
|
|
267
|
+
ref: forwardedRef,
|
|
268
|
+
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
1088
269
|
}
|
|
1089
270
|
);
|
|
1090
271
|
}
|
|
1091
272
|
);
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
(function updateSearch(value) {
|
|
1105
|
-
searchRef.current = value;
|
|
1106
|
-
window.clearTimeout(timerRef.current);
|
|
1107
|
-
if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3);
|
|
1108
|
-
})(search);
|
|
1109
|
-
},
|
|
1110
|
-
[handleSearchChange]
|
|
1111
|
-
);
|
|
1112
|
-
const resetTypeahead = React.useCallback(() => {
|
|
1113
|
-
searchRef.current = "";
|
|
1114
|
-
window.clearTimeout(timerRef.current);
|
|
1115
|
-
}, []);
|
|
1116
|
-
React.useEffect(() => {
|
|
1117
|
-
return () => window.clearTimeout(timerRef.current);
|
|
1118
|
-
}, []);
|
|
1119
|
-
return [searchRef, handleTypeaheadSearch, resetTypeahead];
|
|
1120
|
-
}
|
|
1121
|
-
function findNextItem(items, search, currentItem) {
|
|
1122
|
-
const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
|
|
1123
|
-
const normalizedSearch = isRepeated ? search[0] : search;
|
|
1124
|
-
const currentItemIndex = currentItem ? items.indexOf(currentItem) : -1;
|
|
1125
|
-
let wrappedItems = wrapArray(items, Math.max(currentItemIndex, 0));
|
|
1126
|
-
const excludeCurrentItem = normalizedSearch.length === 1;
|
|
1127
|
-
if (excludeCurrentItem) wrappedItems = wrappedItems.filter((v) => v !== currentItem);
|
|
1128
|
-
const nextItem = wrappedItems.find(
|
|
1129
|
-
(item) => item.textValue.toLowerCase().startsWith(normalizedSearch.toLowerCase())
|
|
1130
|
-
);
|
|
1131
|
-
return nextItem !== currentItem ? nextItem : void 0;
|
|
1132
|
-
}
|
|
1133
|
-
function wrapArray(array, startIndex) {
|
|
1134
|
-
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
273
|
+
PopoverClose.displayName = CLOSE_NAME;
|
|
274
|
+
var ARROW_NAME = "PopoverArrow";
|
|
275
|
+
var PopoverArrow = React.forwardRef(
|
|
276
|
+
(props, forwardedRef) => {
|
|
277
|
+
const { __scopePopover, ...arrowProps } = props;
|
|
278
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
279
|
+
return /* @__PURE__ */ jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
PopoverArrow.displayName = ARROW_NAME;
|
|
283
|
+
function getState(open) {
|
|
284
|
+
return open ? "open" : "closed";
|
|
1135
285
|
}
|
|
1136
|
-
var Root2 =
|
|
1137
|
-
var Trigger =
|
|
1138
|
-
var
|
|
1139
|
-
var
|
|
1140
|
-
var Portal = SelectPortal;
|
|
1141
|
-
var Content2 = SelectContent;
|
|
1142
|
-
var Viewport = SelectViewport;
|
|
1143
|
-
var Group = SelectGroup;
|
|
1144
|
-
var Item = SelectItem;
|
|
1145
|
-
var ItemText = SelectItemText;
|
|
1146
|
-
var ItemIndicator = SelectItemIndicator;
|
|
1147
|
-
var ScrollUpButton = SelectScrollUpButton;
|
|
1148
|
-
var ScrollDownButton = SelectScrollDownButton;
|
|
286
|
+
var Root2 = Popover;
|
|
287
|
+
var Trigger = PopoverTrigger;
|
|
288
|
+
var Portal = PopoverPortal;
|
|
289
|
+
var Content2 = PopoverContent;
|
|
1149
290
|
|
|
1150
|
-
export { Content2 as C,
|
|
291
|
+
export { Content2 as C, Portal as P, Root2 as R, Trigger as T, PopoverPortal as a };
|
|
1151
292
|
//# sourceMappingURL=index14.js.map
|