@arc-ui/components 11.15.0 → 11.17.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/Breadcrumbs/Breadcrumbs.cjs.js +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.esm.js +1 -1
- package/dist/Calendar/Calendar.cjs.js +21 -0
- package/dist/Calendar/Calendar.esm.js +13 -0
- package/dist/Calendar/package.json +7 -0
- package/dist/Checkbox/Checkbox.cjs.js +3 -2
- package/dist/Checkbox/Checkbox.esm.js +3 -2
- package/dist/DatePicker/DatePicker.cjs.js +565 -0
- package/dist/DatePicker/DatePicker.esm.js +552 -0
- package/dist/DatePicker/package.json +7 -0
- package/dist/FormControl/FormControl.cjs.js +2 -1
- package/dist/FormControl/FormControl.esm.js +2 -1
- package/dist/InformationCard/InformationCard.cjs.js +31 -48
- package/dist/InformationCard/InformationCard.esm.js +29 -46
- package/dist/MediaCard/MediaCard.cjs.js +56 -0
- package/dist/MediaCard/MediaCard.esm.js +48 -0
- package/dist/MediaCard/package.json +7 -0
- package/dist/Modal/Modal.cjs.js +16 -313
- package/dist/Modal/Modal.esm.js +6 -303
- package/dist/PaginationSimple/PaginationSimple.cjs.js +19 -16
- package/dist/PaginationSimple/PaginationSimple.esm.js +19 -16
- package/dist/RadioGroup/RadioGroup.cjs.js +3 -2
- package/dist/RadioGroup/RadioGroup.esm.js +3 -2
- package/dist/Select/Select.cjs.js +352 -909
- package/dist/Select/Select.esm.js +303 -841
- package/dist/SiteFooter/SiteFooter.cjs.js +2 -2
- package/dist/SiteFooter/SiteFooter.esm.js +3 -3
- package/dist/SiteHeader/SiteHeader.cjs.js +2 -2
- package/dist/SiteHeader/SiteHeader.esm.js +2 -2
- package/dist/SiteHeaderV2/SiteHeaderV2.cjs.js +23 -0
- package/dist/SiteHeaderV2/SiteHeaderV2.esm.js +15 -0
- package/dist/SiteHeaderV2/package.json +7 -0
- package/dist/Switch/Switch.cjs.js +338 -13
- package/dist/Switch/Switch.esm.js +331 -6
- package/dist/Tabs/Tabs.cjs.js +7 -4
- package/dist/Tabs/Tabs.esm.js +7 -4
- package/dist/TextArea/TextArea.cjs.js +23 -18
- package/dist/TextArea/TextArea.esm.js +23 -18
- package/dist/TextInput/TextInput.cjs.js +3 -2
- package/dist/TextInput/TextInput.esm.js +3 -2
- package/dist/Toast/Toast.cjs.js +6 -4
- package/dist/Toast/Toast.esm.js +6 -4
- package/dist/TypographyCard/TypographyCard.cjs.js +36 -0
- package/dist/TypographyCard/TypographyCard.esm.js +28 -0
- package/dist/TypographyCard/package.json +7 -0
- package/dist/_shared/cjs/{Breadcrumbs-ed70e75a.js → Breadcrumbs-ef659d2b.js} +5 -5
- package/dist/_shared/cjs/BtIconArrowRightFill.esm-435cf4bd.js +26 -0
- package/dist/_shared/cjs/Calendar-18e255f8.js +4106 -0
- package/dist/_shared/cjs/CardFooter-43c32239.js +80 -0
- package/dist/_shared/cjs/CardLabel-768abf20.js +54 -0
- package/dist/_shared/cjs/{Checkbox-b126194e.js → Checkbox-4d4b432f.js} +1 -1
- package/dist/_shared/cjs/{index-43458549.js → Combination-9974f2e2.js} +687 -143
- package/dist/_shared/cjs/{FormControl-7daf8110.js → FormControl-b26ad353.js} +13 -6
- package/dist/_shared/cjs/{RadioGroup-56e3b0e5.js → RadioGroup-23c964ae.js} +1 -1
- package/dist/_shared/cjs/{SiteFooter-97c27b29.js → SiteFooter-65b6360c.js} +2 -2
- package/dist/_shared/cjs/{SiteHeader.rehydrator-af3dddef.js → SiteHeader.rehydrator-df053a52.js} +8 -8
- package/dist/_shared/cjs/SiteHeaderV2-8ce6d4fc.js +610 -0
- package/dist/_shared/cjs/{Tabs-2d2a517d.js → Tabs-34db6bc1.js} +17 -37
- package/dist/_shared/cjs/TextInput-d0370fa8.js +100 -0
- package/dist/_shared/cjs/{Toast-69108261.js → Toast-392b1d60.js} +266 -26
- package/dist/_shared/cjs/{index-adbb63da.js → index-6eb396a3.js} +1 -1
- package/dist/_shared/cjs/index-74004a9c.js +23 -0
- package/dist/_shared/cjs/index-77ab5c6a.js +2180 -0
- package/dist/_shared/cjs/{index-b2fd6338.js → index-9f99d686.js} +1 -1
- package/dist/_shared/cjs/index-a31e64a9.js +27 -0
- package/dist/_shared/cjs/index-d38f1bd0.js +131 -0
- package/dist/_shared/cjs/index-dcfdd5da.js +11 -0
- package/dist/_shared/cjs/{index.module-dd1d7d0b.js → index-dd1d18ea.js} +26 -43
- package/dist/_shared/esm/{Breadcrumbs-87e2bd46.js → Breadcrumbs-36edfb3d.js} +5 -5
- package/dist/_shared/esm/BtIconArrowRightFill.esm-99019d1a.js +20 -0
- package/dist/_shared/esm/Calendar-4033fa48.js +4093 -0
- package/dist/_shared/esm/CardFooter-dd8d4000.js +74 -0
- package/dist/_shared/esm/CardLabel-d6d71407.js +46 -0
- package/dist/_shared/esm/{Checkbox-d6ec5024.js → Checkbox-720b074d.js} +1 -1
- package/dist/_shared/esm/{index-41d7af2b.js → Combination-e9f7e64e.js} +670 -133
- package/dist/_shared/esm/{FormControl-351e5f1b.js → FormControl-f0b8fe91.js} +13 -6
- package/dist/_shared/esm/{RadioGroup-c838764c.js → RadioGroup-37fdb06b.js} +1 -1
- package/dist/_shared/esm/{SiteFooter-94316b8b.js → SiteFooter-38ee1536.js} +1 -1
- package/dist/_shared/esm/{SiteHeader.rehydrator-1b507253.js → SiteHeader.rehydrator-32bdcd88.js} +2 -2
- package/dist/_shared/esm/SiteHeaderV2-f8377627.js +604 -0
- package/dist/_shared/esm/{Tabs-f903187a.js → Tabs-df9965dd.js} +7 -27
- package/dist/_shared/esm/TextInput-abbab56b.js +94 -0
- package/dist/_shared/esm/{Toast-37549e68.js → Toast-5d66e13f.js} +258 -19
- package/dist/_shared/esm/{index-a1d2d9b3.js → index-044da8d0.js} +1 -1
- package/dist/_shared/esm/index-25a5b393.js +25 -0
- package/dist/_shared/esm/index-2cfab9f2.js +21 -0
- package/dist/_shared/esm/{index.module-44714d3f.js → index-7b531fa7.js} +28 -44
- package/dist/_shared/esm/index-a624de47.js +9 -0
- package/dist/_shared/esm/index-b84a20c6.js +2155 -0
- package/dist/_shared/esm/index-ca72c9d5.js +129 -0
- package/dist/_shared/esm/{index-efd9ef1c.js → index-efa9be1a.js} +1 -1
- package/dist/_shared/esm/{index.es-c552c0ea.js → use-media-query-4c807227.js} +9 -9
- package/dist/index.es.js +4072 -1533
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +4074 -1533
- package/dist/index.js.map +1 -1
- package/dist/styles.css +5 -5
- package/dist/types/components/Calendar/Calendar.d.ts +49 -0
- package/dist/types/components/Calendar/Calendar.provider.d.ts +21 -0
- package/dist/types/components/Calendar/components/CalendarDateSelect/CalendarDateSelect.d.ts +15 -0
- package/dist/types/components/Calendar/components/CalendarDateSelect/index.d.ts +1 -0
- package/dist/types/components/Calendar/components/CalendarDayGrid/CalendarDayGrid.d.ts +6 -0
- package/dist/types/components/Calendar/components/CalendarDayGrid/index.d.ts +1 -0
- package/dist/types/components/Calendar/components/CalendarDayNumber/CalendarDayNumber.d.ts +8 -0
- package/dist/types/components/Calendar/components/CalendarDayNumber/index.d.ts +1 -0
- package/dist/types/components/Calendar/components/CalendarDoubleMonthView/CalendarDoubleMonthView.d.ts +9 -0
- package/dist/types/components/Calendar/components/CalendarDoubleMonthView/index.d.ts +1 -0
- package/dist/types/components/Calendar/components/CalendarFooter/CalendarFooter.d.ts +6 -0
- package/dist/types/components/Calendar/components/CalendarFooter/index.d.ts +1 -0
- package/dist/types/components/Calendar/components/CalendarMonthView/CalendarMonthView.d.ts +9 -0
- package/dist/types/components/Calendar/components/CalendarMonthView/index.d.ts +1 -0
- package/dist/types/components/Calendar/components/CalendarMonthYearView/CalendarMonthYearView.d.ts +11 -0
- package/dist/types/components/Calendar/components/CalendarMonthYearView/index.d.ts +1 -0
- package/dist/types/components/Calendar/components/CalendarNavButton/CalendarNavButton.d.ts +10 -0
- package/dist/types/components/Calendar/components/CalendarNavButton/index.d.ts +1 -0
- package/dist/types/components/Calendar/components/CalendarWrapper/CalendarWrapper.d.ts +5 -0
- package/dist/types/components/Calendar/components/CalendarWrapper/index.d.ts +1 -0
- package/dist/types/components/Calendar/components/index.d.ts +6 -0
- package/dist/types/components/Calendar/constants/day-names.d.ts +5 -0
- package/dist/types/components/Calendar/constants/index.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/contains-date.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/contains-date.test.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/date-without-time.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/date-without-time.test.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/get-calendar-type.d.ts +2 -0
- package/dist/types/components/Calendar/helpers/get-calendar-type.test.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/get-dates-in-month.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/get-dates-in-month.test.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/get-double-month-display-range.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/get-double-month-display-range.test.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/get-focus-date.d.ts +5 -0
- package/dist/types/components/Calendar/helpers/get-focus-date.test.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/get-highlighted-range.d.ts +6 -0
- package/dist/types/components/Calendar/helpers/get-highlighted-range.test.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/get-keydown-date.d.ts +6 -0
- package/dist/types/components/Calendar/helpers/get-keydown-date.test.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/index.d.ts +13 -0
- package/dist/types/components/Calendar/helpers/is-day.d.ts +2 -0
- package/dist/types/components/Calendar/helpers/is-day.test.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/is-disabled-date.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/is-disabled-date.test.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/is-month-after-max-date.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/is-month-after-max-date.test.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/is-month-before-min-date.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/is-month-before-min-date.test.d.ts +1 -0
- package/dist/types/components/Calendar/helpers/process-selected-range.d.ts +9 -0
- package/dist/types/components/Calendar/helpers/process-selected-range.test.d.ts +1 -0
- package/dist/types/components/Calendar/index.d.ts +2 -0
- package/dist/types/components/Calendar/state/handlers/calendar-keydown-handler.d.ts +3 -0
- package/dist/types/components/Calendar/state/handlers/day-grid-leave-handler.d.ts +3 -0
- package/dist/types/components/Calendar/state/handlers/day-number-select-handler.d.ts +3 -0
- package/dist/types/components/Calendar/state/handlers/default-handler.d.ts +2 -0
- package/dist/types/components/Calendar/state/handlers/dropdown-change-month-handler.d.ts +3 -0
- package/dist/types/components/Calendar/state/handlers/dropdown-change-year-handler.d.ts +3 -0
- package/dist/types/components/Calendar/state/handlers/highlight-range-handler.d.ts +3 -0
- package/dist/types/components/Calendar/state/handlers/index.d.ts +12 -0
- package/dist/types/components/Calendar/state/handlers/range-select-handler.d.ts +3 -0
- package/dist/types/components/Calendar/state/handlers/show-next-double-month-handler.d.ts +3 -0
- package/dist/types/components/Calendar/state/handlers/show-next-month-handler.d.ts +3 -0
- package/dist/types/components/Calendar/state/handlers/show-previous-double-month-handler.d.ts +3 -0
- package/dist/types/components/Calendar/state/handlers/show-previous-month-handler.d.ts +3 -0
- package/dist/types/components/Calendar/state/index.d.ts +2 -0
- package/dist/types/components/Calendar/state/reducer.d.ts +3 -0
- package/dist/types/components/Calendar/state/reducer.test.d.ts +1 -0
- package/dist/types/components/Calendar/state/types/actions.d.ts +81 -0
- package/dist/types/components/Calendar/state/types/state-handler.d.ts +3 -0
- package/dist/types/components/Calendar/state/types/state.d.ts +5 -0
- package/dist/types/components/Calendar/types/calendar-type.d.ts +1 -0
- package/dist/types/components/Calendar/types/date-select-value.d.ts +2 -0
- package/dist/types/components/Calendar/types/index.d.ts +6 -0
- package/dist/types/components/Calendar/types/key-names.d.ts +13 -0
- package/dist/types/components/Calendar/types/range-selection.d.ts +10 -0
- package/dist/types/components/Calendar/types/selection-type.d.ts +1 -0
- package/dist/types/components/Calendar/types/week-days.d.ts +18 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts +17 -0
- package/dist/types/components/DatePicker/constants/date-format.d.ts +1 -0
- package/dist/types/components/DatePicker/constants/index.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/convert-date-string-to-date.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/convert-date-string-to-date.test.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/convert-range-string-to-dates.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/convert-range-string-to-dates.test.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/format-date.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/format-date.test.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/index.d.ts +8 -0
- package/dist/types/components/DatePicker/helpers/is-date-valid.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/is-date-valid.test.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/is-disabled-date.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/is-disabled-date.test.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/is-range-valid.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/is-range-valid.test.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/parse-date-string.d.ts +5 -0
- package/dist/types/components/DatePicker/helpers/parse-date-string.test.d.ts +1 -0
- package/dist/types/components/DatePicker/helpers/parse-range-string.d.ts +14 -0
- package/dist/types/components/DatePicker/helpers/parse-range-string.test.d.ts +1 -0
- package/dist/types/components/DatePicker/index.d.ts +6 -0
- package/dist/types/components/FormControl/FormControl.d.ts +4 -0
- package/dist/types/components/MediaCard/MediaCard.d.ts +24 -30
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/types/components/Select/Select.d.ts +49 -0
- package/dist/types/components/SiteHeaderV2/SiteHeaderV2.d.ts +77 -0
- package/dist/types/components/SiteHeaderV2/components/BackButton/BackButton.d.ts +5 -0
- package/dist/types/components/SiteHeaderV2/components/BackButton/index.d.ts +1 -0
- package/dist/types/components/SiteHeaderV2/components/Column/Column.d.ts +8 -0
- package/dist/types/components/SiteHeaderV2/components/Column/index.d.ts +1 -0
- package/dist/types/components/SiteHeaderV2/components/HorizontalPanel/HorizontalPanel.d.ts +13 -0
- package/dist/types/components/SiteHeaderV2/components/HorizontalPanel/index.d.ts +1 -0
- package/dist/types/components/SiteHeaderV2/components/Item/Item.d.ts +20 -0
- package/dist/types/components/SiteHeaderV2/components/Item/index.d.ts +1 -0
- package/dist/types/components/SiteHeaderV2/components/ItemGroup/ItemGroup.d.ts +27 -0
- package/dist/types/components/SiteHeaderV2/components/ItemGroup/index.d.ts +1 -0
- package/dist/types/components/SiteHeaderV2/components/MenuButton/MenuButton.d.ts +6 -0
- package/dist/types/components/SiteHeaderV2/components/MenuButton/index.d.ts +1 -0
- package/dist/types/components/SiteHeaderV2/components/NavItem/NavItem.d.ts +40 -0
- package/dist/types/components/SiteHeaderV2/components/NavItem/NavItemWithSubNav.d.ts +55 -0
- package/dist/types/components/SiteHeaderV2/components/NavItem/index.d.ts +2 -0
- package/dist/types/components/SiteHeaderV2/components/NodeItem/NodeItem.d.ts +8 -0
- package/dist/types/components/SiteHeaderV2/components/Panel/Panel.d.ts +26 -0
- package/dist/types/components/SiteHeaderV2/components/Panel/index.d.ts +1 -0
- package/dist/types/components/SiteHeaderV2/components/SubNavItem/SubNavItem.d.ts +45 -0
- package/dist/types/components/SiteHeaderV2/components/SubNavItem/index.d.ts +1 -0
- package/dist/types/components/SiteHeaderV2/components/VerticalDivider/VerticalDivider.d.ts +1 -0
- package/dist/types/components/SiteHeaderV2/components/VerticalDivider/index.d.ts +1 -0
- package/dist/types/components/SiteHeaderV2/index.d.ts +1 -0
- package/dist/types/components/TextArea/TextArea.d.ts +4 -0
- package/dist/types/components/TextInput/TextInput.d.ts +34 -4
- package/dist/types/components/TypographyCard/TypographyCard.d.ts +48 -0
- package/dist/types/components/TypographyCard/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/private-components/CardFooter/CardFooter.d.ts +11 -0
- package/dist/types/private-components/CardFooter/index.d.ts +1 -0
- package/dist/types/private-components/CardHeading/CardHeading.d.ts +19 -0
- package/dist/types/private-components/CardHeading/index.d.ts +1 -0
- package/dist/types/private-components/CardLabel/CardLabel.d.ts +10 -0
- package/dist/types/private-components/CardLabel/index.d.ts +1 -0
- package/dist/types/private-components/ConditionalWrapper/ConditionalWrapper.d.ts +6 -0
- package/dist/types/private-components/ConditionalWrapper/index.d.ts +1 -0
- package/dist/types/private-components/index.d.ts +4 -0
- package/dist/types/styles.d.ts +8 -1
- package/package.json +5 -3
- package/dist/_shared/cjs/TextInput-bf1fe052.js +0 -81
- package/dist/_shared/cjs/index-6b2a9ac3.js +0 -289
- package/dist/_shared/cjs/index-c575a255.js +0 -490
- package/dist/_shared/esm/TextInput-991804b6.js +0 -75
- package/dist/_shared/esm/index-13d575cc.js +0 -479
- package/dist/_shared/esm/index-3797d77e.js +0 -280
- package/dist/types/components/MediaCard/MediaCard.stories-wip.d.ts +0 -15
- package/dist/_shared/cjs/{index.es-26dd8c5d.js → use-media-query-e61881d8.js} +8 -8
|
@@ -3,701 +3,56 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var filterDataAttrs = require('../_shared/cjs/filter-data-attrs-1c9a530c.js');
|
|
6
|
-
var index$
|
|
6
|
+
var index$6 = require('../_shared/cjs/index-9947ac13.js');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var _extends = require('../_shared/cjs/extends-8c5e4b48.js');
|
|
9
9
|
var $7SXl2$reactdom = require('react-dom');
|
|
10
|
-
var
|
|
11
|
-
var index = require('../_shared/cjs/index-
|
|
10
|
+
var index$1 = require('../_shared/cjs/index-dd1d18ea.js');
|
|
11
|
+
var index = require('../_shared/cjs/index-9f99d686.js');
|
|
12
|
+
var index$3 = require('../_shared/cjs/index-dcfdd5da.js');
|
|
13
|
+
var Combination = require('../_shared/cjs/Combination-9974f2e2.js');
|
|
14
|
+
var index$4 = require('../_shared/cjs/index-6eb396a3.js');
|
|
15
|
+
var index$2 = require('../_shared/cjs/index-77ab5c6a.js');
|
|
16
|
+
var index$5 = require('../_shared/cjs/index-a31e64a9.js');
|
|
12
17
|
var BtIconChevronDown2Px_esm = require('../_shared/cjs/BtIconChevronDown2Px.esm-39030ee0.js');
|
|
13
18
|
var BtIconTickAlt2Px_esm = require('../_shared/cjs/BtIconTickAlt2Px.esm-57c89acc.js');
|
|
14
19
|
var Icon = require('../_shared/cjs/Icon-a9801f05.js');
|
|
15
|
-
var FormControl = require('../_shared/cjs/FormControl-
|
|
20
|
+
var FormControl = require('../_shared/cjs/FormControl-b26ad353.js');
|
|
16
21
|
var Surface = require('../_shared/cjs/Surface-038db6e1.js');
|
|
17
22
|
var Base = require('../_shared/cjs/Base-f5a86eed.js');
|
|
23
|
+
require('../_shared/cjs/index-74004a9c.js');
|
|
18
24
|
require('../_shared/cjs/suffix-modifier-64dcd338.js');
|
|
19
25
|
require('../_shared/cjs/BtIconAlert.esm-1a0ff9f0.js');
|
|
20
26
|
require('../_shared/cjs/DisclosureMini-d0eeb6bb.js');
|
|
21
27
|
require('../_shared/cjs/Text-606ca3a2.js');
|
|
28
|
+
require('../_shared/cjs/VisuallyHidden-e2c8b291.js');
|
|
22
29
|
|
|
23
30
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
31
|
|
|
25
|
-
function _interopNamespace(e) {
|
|
26
|
-
if (e && e.__esModule) return e;
|
|
27
|
-
var n = Object.create(null);
|
|
28
|
-
if (e) {
|
|
29
|
-
Object.keys(e).forEach(function (k) {
|
|
30
|
-
if (k !== 'default') {
|
|
31
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
32
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () { return e[k]; }
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
n["default"] = e;
|
|
40
|
-
return Object.freeze(n);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
32
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
44
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
45
|
-
var $7SXl2$reactdom__default = /*#__PURE__*/_interopDefaultLegacy($7SXl2$reactdom);
|
|
46
33
|
|
|
47
34
|
function $ae6933e535247d3d$export$7d15b64cf5a3a4c4(value, [min, max]) {
|
|
48
35
|
return Math.min(max, Math.max(min, value));
|
|
49
36
|
}
|
|
50
37
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
current: null
|
|
63
|
-
},
|
|
64
|
-
itemMap: new Map()
|
|
65
|
-
});
|
|
66
|
-
const CollectionProvider = (props)=>{
|
|
67
|
-
const { scope: scope , children: children } = props;
|
|
68
|
-
const ref = React__default["default"].useRef(null);
|
|
69
|
-
const itemMap = React__default["default"].useRef(new Map()).current;
|
|
70
|
-
return /*#__PURE__*/ React__default["default"].createElement(CollectionProviderImpl, {
|
|
71
|
-
scope: scope,
|
|
72
|
-
itemMap: itemMap,
|
|
73
|
-
collectionRef: ref
|
|
74
|
-
}, children);
|
|
75
|
-
};
|
|
76
|
-
/* -----------------------------------------------------------------------------------------------
|
|
77
|
-
* CollectionSlot
|
|
78
|
-
* ---------------------------------------------------------------------------------------------*/ const COLLECTION_SLOT_NAME = name + 'CollectionSlot';
|
|
79
|
-
const CollectionSlot = /*#__PURE__*/ React__default["default"].forwardRef((props, forwardedRef)=>{
|
|
80
|
-
const { scope: scope , children: children } = props;
|
|
81
|
-
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
82
|
-
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.collectionRef);
|
|
83
|
-
return /*#__PURE__*/ React__default["default"].createElement(index_module.$5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
84
|
-
ref: composedRefs
|
|
85
|
-
}, children);
|
|
86
|
-
});
|
|
87
|
-
/* -----------------------------------------------------------------------------------------------
|
|
88
|
-
* CollectionItem
|
|
89
|
-
* ---------------------------------------------------------------------------------------------*/ const ITEM_SLOT_NAME = name + 'CollectionItemSlot';
|
|
90
|
-
const ITEM_DATA_ATTR = 'data-radix-collection-item';
|
|
91
|
-
const CollectionItemSlot = /*#__PURE__*/ React__default["default"].forwardRef((props, forwardedRef)=>{
|
|
92
|
-
const { scope: scope , children: children , ...itemData } = props;
|
|
93
|
-
const ref = React__default["default"].useRef(null);
|
|
94
|
-
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
95
|
-
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
96
|
-
React__default["default"].useEffect(()=>{
|
|
97
|
-
context.itemMap.set(ref, {
|
|
98
|
-
ref: ref,
|
|
99
|
-
...itemData
|
|
100
|
-
});
|
|
101
|
-
return ()=>void context.itemMap.delete(ref)
|
|
102
|
-
;
|
|
103
|
-
});
|
|
104
|
-
return /*#__PURE__*/ React__default["default"].createElement(index_module.$5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
105
|
-
[ITEM_DATA_ATTR]: '',
|
|
106
|
-
ref: composedRefs
|
|
107
|
-
}, children);
|
|
108
|
-
});
|
|
109
|
-
/* -----------------------------------------------------------------------------------------------
|
|
110
|
-
* useCollection
|
|
111
|
-
* ---------------------------------------------------------------------------------------------*/ function useCollection(scope) {
|
|
112
|
-
const context = useCollectionContext(name + 'CollectionConsumer', scope);
|
|
113
|
-
const getItems = React__default["default"].useCallback(()=>{
|
|
114
|
-
const collectionNode = context.collectionRef.current;
|
|
115
|
-
if (!collectionNode) return [];
|
|
116
|
-
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
117
|
-
const items = Array.from(context.itemMap.values());
|
|
118
|
-
const orderedItems = items.sort((a, b)=>orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
119
|
-
);
|
|
120
|
-
return orderedItems;
|
|
121
|
-
}, [
|
|
122
|
-
context.collectionRef,
|
|
123
|
-
context.itemMap
|
|
124
|
-
]);
|
|
125
|
-
return getItems;
|
|
126
|
-
}
|
|
127
|
-
return [
|
|
128
|
-
{
|
|
129
|
-
Provider: CollectionProvider,
|
|
130
|
-
Slot: CollectionSlot,
|
|
131
|
-
ItemSlot: CollectionItemSlot
|
|
132
|
-
},
|
|
133
|
-
useCollection,
|
|
134
|
-
createCollectionScope
|
|
135
|
-
];
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const $f631663db3294ace$var$DirectionContext = /*#__PURE__*/ React.createContext(undefined);
|
|
139
|
-
/* -----------------------------------------------------------------------------------------------*/ function $f631663db3294ace$export$b39126d51d94e6f3(localDir) {
|
|
140
|
-
const globalDir = React.useContext($f631663db3294ace$var$DirectionContext);
|
|
141
|
-
return localDir || globalDir || 'ltr';
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Listens for when the escape key is down
|
|
146
|
-
*/ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
147
|
-
const onEscapeKeyDown = index_module.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEscapeKeyDownProp);
|
|
148
|
-
React.useEffect(()=>{
|
|
149
|
-
const handleKeyDown = (event)=>{
|
|
150
|
-
if (event.key === 'Escape') onEscapeKeyDown(event);
|
|
151
|
-
};
|
|
152
|
-
ownerDocument.addEventListener('keydown', handleKeyDown);
|
|
153
|
-
return ()=>ownerDocument.removeEventListener('keydown', handleKeyDown)
|
|
154
|
-
;
|
|
155
|
-
}, [
|
|
156
|
-
onEscapeKeyDown,
|
|
157
|
-
ownerDocument
|
|
158
|
-
]);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update';
|
|
162
|
-
const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';
|
|
163
|
-
const $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';
|
|
164
|
-
let $5cb92bef7577960e$var$originalBodyPointerEvents;
|
|
165
|
-
const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ React.createContext({
|
|
166
|
-
layers: new Set(),
|
|
167
|
-
layersWithOutsidePointerEventsDisabled: new Set(),
|
|
168
|
-
branches: new Set()
|
|
169
|
-
});
|
|
170
|
-
const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
171
|
-
var _node$ownerDocument;
|
|
172
|
-
const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props;
|
|
173
|
-
const context = React.useContext($5cb92bef7577960e$var$DismissableLayerContext);
|
|
174
|
-
const [node1, setNode] = React.useState(null);
|
|
175
|
-
const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;
|
|
176
|
-
const [, force] = React.useState({});
|
|
177
|
-
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setNode(node)
|
|
178
|
-
);
|
|
179
|
-
const layers = Array.from(context.layers);
|
|
180
|
-
const [highestLayerWithOutsidePointerEventsDisabled] = [
|
|
181
|
-
...context.layersWithOutsidePointerEventsDisabled
|
|
182
|
-
].slice(-1); // prettier-ignore
|
|
183
|
-
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore
|
|
184
|
-
const index = node1 ? layers.indexOf(node1) : -1;
|
|
185
|
-
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
186
|
-
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
187
|
-
const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event)=>{
|
|
188
|
-
const target = event.target;
|
|
189
|
-
const isPointerDownOnBranch = [
|
|
190
|
-
...context.branches
|
|
191
|
-
].some((branch)=>branch.contains(target)
|
|
192
|
-
);
|
|
193
|
-
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
194
|
-
onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);
|
|
195
|
-
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
|
|
196
|
-
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
197
|
-
}, ownerDocument);
|
|
198
|
-
const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event)=>{
|
|
199
|
-
const target = event.target;
|
|
200
|
-
const isFocusInBranch = [
|
|
201
|
-
...context.branches
|
|
202
|
-
].some((branch)=>branch.contains(target)
|
|
203
|
-
);
|
|
204
|
-
if (isFocusInBranch) return;
|
|
205
|
-
onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);
|
|
206
|
-
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
|
|
207
|
-
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
208
|
-
}, ownerDocument);
|
|
209
|
-
$addc16e1bbe58fd0$export$3a72a57244d6e765((event)=>{
|
|
210
|
-
const isHighestLayer = index === context.layers.size - 1;
|
|
211
|
-
if (!isHighestLayer) return;
|
|
212
|
-
onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);
|
|
213
|
-
if (!event.defaultPrevented && onDismiss) {
|
|
214
|
-
event.preventDefault();
|
|
215
|
-
onDismiss();
|
|
216
|
-
}
|
|
217
|
-
}, ownerDocument);
|
|
218
|
-
React.useEffect(()=>{
|
|
219
|
-
if (!node1) return;
|
|
220
|
-
if (disableOutsidePointerEvents) {
|
|
221
|
-
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
222
|
-
$5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
223
|
-
ownerDocument.body.style.pointerEvents = 'none';
|
|
224
|
-
}
|
|
225
|
-
context.layersWithOutsidePointerEventsDisabled.add(node1);
|
|
226
|
-
}
|
|
227
|
-
context.layers.add(node1);
|
|
228
|
-
$5cb92bef7577960e$var$dispatchUpdate();
|
|
229
|
-
return ()=>{
|
|
230
|
-
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents;
|
|
231
|
-
};
|
|
232
|
-
}, [
|
|
233
|
-
node1,
|
|
234
|
-
ownerDocument,
|
|
235
|
-
disableOutsidePointerEvents,
|
|
236
|
-
context
|
|
237
|
-
]);
|
|
238
|
-
/**
|
|
239
|
-
* We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect
|
|
240
|
-
* because a change to `disableOutsidePointerEvents` would remove this layer from the stack
|
|
241
|
-
* and add it to the end again so the layering order wouldn't be _creation order_.
|
|
242
|
-
* We only want them to be removed from context stacks when unmounted.
|
|
243
|
-
*/ React.useEffect(()=>{
|
|
244
|
-
return ()=>{
|
|
245
|
-
if (!node1) return;
|
|
246
|
-
context.layers.delete(node1);
|
|
247
|
-
context.layersWithOutsidePointerEventsDisabled.delete(node1);
|
|
248
|
-
$5cb92bef7577960e$var$dispatchUpdate();
|
|
249
|
-
};
|
|
250
|
-
}, [
|
|
251
|
-
node1,
|
|
252
|
-
context
|
|
253
|
-
]);
|
|
254
|
-
React.useEffect(()=>{
|
|
255
|
-
const handleUpdate = ()=>force({})
|
|
256
|
-
;
|
|
257
|
-
document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
|
|
258
|
-
return ()=>document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate)
|
|
259
|
-
;
|
|
260
|
-
}, []);
|
|
261
|
-
return /*#__PURE__*/ React.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends._extends({}, layerProps, {
|
|
262
|
-
ref: composedRefs,
|
|
263
|
-
style: {
|
|
264
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined,
|
|
265
|
-
...props.style
|
|
266
|
-
},
|
|
267
|
-
onFocusCapture: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
268
|
-
onBlurCapture: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
269
|
-
onPointerDownCapture: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
|
|
270
|
-
}));
|
|
271
|
-
});
|
|
272
|
-
/* -----------------------------------------------------------------------------------------------*/ /**
|
|
273
|
-
* Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`
|
|
274
|
-
* to mimic layer dismissing behaviour present in OS.
|
|
275
|
-
* Returns props to pass to the node we want to check for outside events.
|
|
276
|
-
*/ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
277
|
-
const handlePointerDownOutside = index_module.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside);
|
|
278
|
-
const isPointerInsideReactTreeRef = React.useRef(false);
|
|
279
|
-
const handleClickRef = React.useRef(()=>{});
|
|
280
|
-
React.useEffect(()=>{
|
|
281
|
-
const handlePointerDown = (event)=>{
|
|
282
|
-
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
283
|
-
const eventDetail = {
|
|
284
|
-
originalEvent: event
|
|
285
|
-
};
|
|
286
|
-
function handleAndDispatchPointerDownOutsideEvent() {
|
|
287
|
-
$5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {
|
|
288
|
-
discrete: true
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* On touch devices, we need to wait for a click event because browsers implement
|
|
293
|
-
* a ~350ms delay between the time the user stops touching the display and when the
|
|
294
|
-
* browser executres events. We need to ensure we don't reactivate pointer-events within
|
|
295
|
-
* this timeframe otherwise the browser may execute events that should have been prevented.
|
|
296
|
-
*
|
|
297
|
-
* Additionally, this also lets us deal automatically with cancellations when a click event
|
|
298
|
-
* isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.
|
|
299
|
-
*
|
|
300
|
-
* This is why we also continuously remove the previous listener, because we cannot be
|
|
301
|
-
* certain that it was raised, and therefore cleaned-up.
|
|
302
|
-
*/ if (event.pointerType === 'touch') {
|
|
303
|
-
ownerDocument.removeEventListener('click', handleClickRef.current);
|
|
304
|
-
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;
|
|
305
|
-
ownerDocument.addEventListener('click', handleClickRef.current, {
|
|
306
|
-
once: true
|
|
307
|
-
});
|
|
308
|
-
} else handleAndDispatchPointerDownOutsideEvent();
|
|
309
|
-
}
|
|
310
|
-
isPointerInsideReactTreeRef.current = false;
|
|
311
|
-
};
|
|
312
|
-
/**
|
|
313
|
-
* if this hook executes in a component that mounts via a `pointerdown` event, the event
|
|
314
|
-
* would bubble up to the document and trigger a `pointerDownOutside` event. We avoid
|
|
315
|
-
* this by delaying the event listener registration on the document.
|
|
316
|
-
* This is not React specific, but rather how the DOM works, ie:
|
|
317
|
-
* ```
|
|
318
|
-
* button.addEventListener('pointerdown', () => {
|
|
319
|
-
* console.log('I will log');
|
|
320
|
-
* document.addEventListener('pointerdown', () => {
|
|
321
|
-
* console.log('I will also log');
|
|
322
|
-
* })
|
|
323
|
-
* });
|
|
324
|
-
*/ const timerId = window.setTimeout(()=>{
|
|
325
|
-
ownerDocument.addEventListener('pointerdown', handlePointerDown);
|
|
326
|
-
}, 0);
|
|
327
|
-
return ()=>{
|
|
328
|
-
window.clearTimeout(timerId);
|
|
329
|
-
ownerDocument.removeEventListener('pointerdown', handlePointerDown);
|
|
330
|
-
ownerDocument.removeEventListener('click', handleClickRef.current);
|
|
331
|
-
};
|
|
332
|
-
}, [
|
|
333
|
-
ownerDocument,
|
|
334
|
-
handlePointerDownOutside
|
|
335
|
-
]);
|
|
336
|
-
return {
|
|
337
|
-
// ensures we check React component tree (not just DOM tree)
|
|
338
|
-
onPointerDownCapture: ()=>isPointerInsideReactTreeRef.current = true
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Listens for when focus happens outside a react subtree.
|
|
343
|
-
* Returns props to pass to the root (node) of the subtree we want to check.
|
|
344
|
-
*/ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
345
|
-
const handleFocusOutside = index_module.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside);
|
|
346
|
-
const isFocusInsideReactTreeRef = React.useRef(false);
|
|
347
|
-
React.useEffect(()=>{
|
|
348
|
-
const handleFocus = (event)=>{
|
|
349
|
-
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
350
|
-
const eventDetail = {
|
|
351
|
-
originalEvent: event
|
|
352
|
-
};
|
|
353
|
-
$5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
354
|
-
discrete: false
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
ownerDocument.addEventListener('focusin', handleFocus);
|
|
359
|
-
return ()=>ownerDocument.removeEventListener('focusin', handleFocus)
|
|
360
|
-
;
|
|
361
|
-
}, [
|
|
362
|
-
ownerDocument,
|
|
363
|
-
handleFocusOutside
|
|
364
|
-
]);
|
|
365
|
-
return {
|
|
366
|
-
onFocusCapture: ()=>isFocusInsideReactTreeRef.current = true
|
|
367
|
-
,
|
|
368
|
-
onBlurCapture: ()=>isFocusInsideReactTreeRef.current = false
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
function $5cb92bef7577960e$var$dispatchUpdate() {
|
|
372
|
-
const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE);
|
|
373
|
-
document.dispatchEvent(event);
|
|
374
|
-
}
|
|
375
|
-
function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detail, { discrete: discrete }) {
|
|
376
|
-
const target = detail.originalEvent.target;
|
|
377
|
-
const event = new CustomEvent(name, {
|
|
378
|
-
bubbles: false,
|
|
379
|
-
cancelable: true,
|
|
380
|
-
detail: detail
|
|
381
|
-
});
|
|
382
|
-
if (handler) target.addEventListener(name, handler, {
|
|
383
|
-
once: true
|
|
384
|
-
});
|
|
385
|
-
if (discrete) index_module.$8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event);
|
|
386
|
-
else target.dispatchEvent(event);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
/** Number of components which have requested interest to have focus guards */ let $3db38b7d1fb3fe6a$var$count = 0;
|
|
390
|
-
/**
|
|
391
|
-
* Injects a pair of focus guards at the edges of the whole DOM tree
|
|
392
|
-
* to ensure `focusin` & `focusout` events can be caught consistently.
|
|
393
|
-
*/ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
|
|
394
|
-
React.useEffect(()=>{
|
|
395
|
-
var _edgeGuards$, _edgeGuards$2;
|
|
396
|
-
const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
|
|
397
|
-
document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
398
|
-
document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
399
|
-
$3db38b7d1fb3fe6a$var$count++;
|
|
400
|
-
return ()=>{
|
|
401
|
-
if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove()
|
|
402
|
-
);
|
|
403
|
-
$3db38b7d1fb3fe6a$var$count--;
|
|
404
|
-
};
|
|
405
|
-
}, []);
|
|
406
|
-
}
|
|
407
|
-
function $3db38b7d1fb3fe6a$var$createFocusGuard() {
|
|
408
|
-
const element = document.createElement('span');
|
|
409
|
-
element.setAttribute('data-radix-focus-guard', '');
|
|
410
|
-
element.tabIndex = 0;
|
|
411
|
-
element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';
|
|
412
|
-
return element;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';
|
|
416
|
-
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';
|
|
417
|
-
const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
|
|
418
|
-
bubbles: false,
|
|
419
|
-
cancelable: true
|
|
420
|
-
};
|
|
421
|
-
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
422
|
-
const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
|
|
423
|
-
const [container1, setContainer] = React.useState(null);
|
|
424
|
-
const onMountAutoFocus = index_module.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
|
|
425
|
-
const onUnmountAutoFocus = index_module.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
|
|
426
|
-
const lastFocusedElementRef = React.useRef(null);
|
|
427
|
-
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node)
|
|
428
|
-
);
|
|
429
|
-
const focusScope = React.useRef({
|
|
430
|
-
paused: false,
|
|
431
|
-
pause () {
|
|
432
|
-
this.paused = true;
|
|
433
|
-
},
|
|
434
|
-
resume () {
|
|
435
|
-
this.paused = false;
|
|
436
|
-
}
|
|
437
|
-
}).current; // Takes care of trapping focus if focus is moved outside programmatically for example
|
|
438
|
-
React.useEffect(()=>{
|
|
439
|
-
if (trapped) {
|
|
440
|
-
function handleFocusIn(event) {
|
|
441
|
-
if (focusScope.paused || !container1) return;
|
|
442
|
-
const target = event.target;
|
|
443
|
-
if (container1.contains(target)) lastFocusedElementRef.current = target;
|
|
444
|
-
else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
445
|
-
select: true
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
function handleFocusOut(event) {
|
|
449
|
-
if (focusScope.paused || !container1) return;
|
|
450
|
-
if (!container1.contains(event.relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
451
|
-
select: true
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
|
-
document.addEventListener('focusin', handleFocusIn);
|
|
455
|
-
document.addEventListener('focusout', handleFocusOut);
|
|
456
|
-
return ()=>{
|
|
457
|
-
document.removeEventListener('focusin', handleFocusIn);
|
|
458
|
-
document.removeEventListener('focusout', handleFocusOut);
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
}, [
|
|
462
|
-
trapped,
|
|
463
|
-
container1,
|
|
464
|
-
focusScope.paused
|
|
465
|
-
]);
|
|
466
|
-
React.useEffect(()=>{
|
|
467
|
-
if (container1) {
|
|
468
|
-
$d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
|
|
469
|
-
const previouslyFocusedElement = document.activeElement;
|
|
470
|
-
const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
|
|
471
|
-
if (!hasFocusedCandidate) {
|
|
472
|
-
const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
473
|
-
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
474
|
-
container1.dispatchEvent(mountEvent);
|
|
475
|
-
if (!mountEvent.defaultPrevented) {
|
|
476
|
-
$d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {
|
|
477
|
-
select: true
|
|
478
|
-
});
|
|
479
|
-
if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
return ()=>{
|
|
483
|
-
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.
|
|
484
|
-
// We need to delay the focus a little to get around it for now.
|
|
485
|
-
// See: https://github.com/facebook/react/issues/17894
|
|
486
|
-
setTimeout(()=>{
|
|
487
|
-
const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
488
|
-
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
489
|
-
container1.dispatchEvent(unmountEvent);
|
|
490
|
-
if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
|
|
491
|
-
select: true
|
|
492
|
-
});
|
|
493
|
-
// we need to remove the listener after we `dispatchEvent`
|
|
494
|
-
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
495
|
-
$d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);
|
|
496
|
-
}, 0);
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
}, [
|
|
500
|
-
container1,
|
|
501
|
-
onMountAutoFocus,
|
|
502
|
-
onUnmountAutoFocus,
|
|
503
|
-
focusScope
|
|
504
|
-
]); // Takes care of looping focus (when tabbing whilst at the edges)
|
|
505
|
-
const handleKeyDown = React.useCallback((event)=>{
|
|
506
|
-
if (!loop && !trapped) return;
|
|
507
|
-
if (focusScope.paused) return;
|
|
508
|
-
const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
509
|
-
const focusedElement = document.activeElement;
|
|
510
|
-
if (isTabKey && focusedElement) {
|
|
511
|
-
const container = event.currentTarget;
|
|
512
|
-
const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);
|
|
513
|
-
const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges
|
|
514
|
-
if (!hasTabbableElementsInside) {
|
|
515
|
-
if (focusedElement === container) event.preventDefault();
|
|
516
|
-
} else {
|
|
517
|
-
if (!event.shiftKey && focusedElement === last) {
|
|
518
|
-
event.preventDefault();
|
|
519
|
-
if (loop) $d3863c46a17e8a28$var$focus(first, {
|
|
520
|
-
select: true
|
|
521
|
-
});
|
|
522
|
-
} else if (event.shiftKey && focusedElement === first) {
|
|
523
|
-
event.preventDefault();
|
|
524
|
-
if (loop) $d3863c46a17e8a28$var$focus(last, {
|
|
525
|
-
select: true
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
}, [
|
|
531
|
-
loop,
|
|
532
|
-
trapped,
|
|
533
|
-
focusScope.paused
|
|
534
|
-
]);
|
|
535
|
-
return /*#__PURE__*/ React.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends._extends({
|
|
536
|
-
tabIndex: -1
|
|
537
|
-
}, scopeProps, {
|
|
538
|
-
ref: composedRefs,
|
|
539
|
-
onKeyDown: handleKeyDown
|
|
540
|
-
}));
|
|
541
|
-
});
|
|
542
|
-
/* -------------------------------------------------------------------------------------------------
|
|
543
|
-
* Utils
|
|
544
|
-
* -----------------------------------------------------------------------------------------------*/ /**
|
|
545
|
-
* Attempts focusing the first element in a list of candidates.
|
|
546
|
-
* Stops when focus has actually moved.
|
|
547
|
-
*/ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {
|
|
548
|
-
const previouslyFocusedElement = document.activeElement;
|
|
549
|
-
for (const candidate of candidates){
|
|
550
|
-
$d3863c46a17e8a28$var$focus(candidate, {
|
|
551
|
-
select: select
|
|
552
|
-
});
|
|
553
|
-
if (document.activeElement !== previouslyFocusedElement) return;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* Returns the first and last tabbable elements inside a container.
|
|
558
|
-
*/ function $d3863c46a17e8a28$var$getTabbableEdges(container) {
|
|
559
|
-
const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);
|
|
560
|
-
const first = $d3863c46a17e8a28$var$findVisible(candidates, container);
|
|
561
|
-
const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);
|
|
562
|
-
return [
|
|
563
|
-
first,
|
|
564
|
-
last
|
|
565
|
-
];
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
* Returns a list of potential tabbable candidates.
|
|
569
|
-
*
|
|
570
|
-
* NOTE: This is only a close approximation. For example it doesn't take into account cases like when
|
|
571
|
-
* elements are not visible. This cannot be worked out easily by just reading a property, but rather
|
|
572
|
-
* necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
|
|
573
|
-
*
|
|
574
|
-
* See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
|
|
575
|
-
* Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
|
|
576
|
-
*/ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {
|
|
577
|
-
const nodes = [];
|
|
578
|
-
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
579
|
-
acceptNode: (node)=>{
|
|
580
|
-
const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
|
|
581
|
-
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
|
|
582
|
-
// runtime's understanding of tabbability, so this automatically accounts
|
|
583
|
-
// for any kind of element that could be tabbed to.
|
|
584
|
-
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
|
|
588
|
-
// hinders accessibility to have tab order different from visual order.
|
|
589
|
-
return nodes;
|
|
590
|
-
}
|
|
591
|
-
/**
|
|
592
|
-
* Returns the first visible element in a list.
|
|
593
|
-
* NOTE: Only checks visibility up to the `container`.
|
|
594
|
-
*/ function $d3863c46a17e8a28$var$findVisible(elements, container) {
|
|
595
|
-
for (const element of elements){
|
|
596
|
-
// we stop checking if it's hidden at the `container` level (excluding)
|
|
597
|
-
if (!$d3863c46a17e8a28$var$isHidden(element, {
|
|
598
|
-
upTo: container
|
|
599
|
-
})) return element;
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
function $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {
|
|
603
|
-
if (getComputedStyle(node).visibility === 'hidden') return true;
|
|
604
|
-
while(node){
|
|
605
|
-
// we stop at `upTo` (excluding it)
|
|
606
|
-
if (upTo !== undefined && node === upTo) return false;
|
|
607
|
-
if (getComputedStyle(node).display === 'none') return true;
|
|
608
|
-
node = node.parentElement;
|
|
609
|
-
}
|
|
610
|
-
return false;
|
|
611
|
-
}
|
|
612
|
-
function $d3863c46a17e8a28$var$isSelectableInput(element) {
|
|
613
|
-
return element instanceof HTMLInputElement && 'select' in element;
|
|
614
|
-
}
|
|
615
|
-
function $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {
|
|
616
|
-
// only focus if that element is focusable
|
|
617
|
-
if (element && element.focus) {
|
|
618
|
-
const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users
|
|
619
|
-
element.focus({
|
|
620
|
-
preventScroll: true
|
|
621
|
-
}); // only select if its not the same element, it supports selection and we need to select
|
|
622
|
-
if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
/* -------------------------------------------------------------------------------------------------
|
|
626
|
-
* FocusScope stack
|
|
627
|
-
* -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();
|
|
628
|
-
function $d3863c46a17e8a28$var$createFocusScopesStack() {
|
|
629
|
-
/** A stack of focus scopes, with the active one at the top */ let stack = [];
|
|
630
|
-
return {
|
|
631
|
-
add (focusScope) {
|
|
632
|
-
// pause the currently active focus scope (at the top of the stack)
|
|
633
|
-
const activeFocusScope = stack[0];
|
|
634
|
-
if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
|
|
635
|
-
// remove in case it already exists (because we'll re-add it at the top of the stack)
|
|
636
|
-
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
637
|
-
stack.unshift(focusScope);
|
|
638
|
-
},
|
|
639
|
-
remove (focusScope) {
|
|
640
|
-
var _stack$;
|
|
641
|
-
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
642
|
-
(_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
|
|
38
|
+
function $010c2913dbd2fe3d$export$5cae361ad82dce8b(value) {
|
|
39
|
+
const ref = React.useRef({
|
|
40
|
+
value: value,
|
|
41
|
+
previous: value
|
|
42
|
+
}); // We compare values before making an update to ensure that
|
|
43
|
+
// a change has been made. This ensures the previous value is
|
|
44
|
+
// persisted correctly between renders.
|
|
45
|
+
return React.useMemo(()=>{
|
|
46
|
+
if (ref.current.value !== value) {
|
|
47
|
+
ref.current.previous = ref.current.value;
|
|
48
|
+
ref.current.value = value;
|
|
643
49
|
}
|
|
644
|
-
|
|
645
|
-
}
|
|
646
|
-
function $d3863c46a17e8a28$var$arrayRemove(array, item) {
|
|
647
|
-
const updatedArray = [
|
|
648
|
-
...array
|
|
649
|
-
];
|
|
650
|
-
const index = updatedArray.indexOf(item);
|
|
651
|
-
if (index !== -1) updatedArray.splice(index, 1);
|
|
652
|
-
return updatedArray;
|
|
653
|
-
}
|
|
654
|
-
function $d3863c46a17e8a28$var$removeLinks(items) {
|
|
655
|
-
return items.filter((item)=>item.tagName !== 'A'
|
|
656
|
-
);
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
const $1746a345f3d73bb7$var$useReactId = React__namespace['useId'.toString()] || (()=>undefined
|
|
660
|
-
);
|
|
661
|
-
let $1746a345f3d73bb7$var$count = 0;
|
|
662
|
-
function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
663
|
-
const [id, setId] = React__namespace.useState($1746a345f3d73bb7$var$useReactId()); // React versions older than 18 will have client-side ids only.
|
|
664
|
-
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
665
|
-
if (!deterministicId) setId((reactId)=>reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
|
|
666
|
-
);
|
|
50
|
+
return ref.current.previous;
|
|
667
51
|
}, [
|
|
668
|
-
|
|
52
|
+
value
|
|
669
53
|
]);
|
|
670
|
-
return deterministicId || (id ? `radix-${id}` : '');
|
|
671
54
|
}
|
|
672
55
|
|
|
673
|
-
const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
674
|
-
var _globalThis$document;
|
|
675
|
-
const { container: container = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body , ...portalProps } = props;
|
|
676
|
-
return container ? /*#__PURE__*/ $7SXl2$reactdom__default["default"].createPortal(/*#__PURE__*/ React.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends._extends({}, portalProps, {
|
|
677
|
-
ref: forwardedRef
|
|
678
|
-
})), container) : null;
|
|
679
|
-
});
|
|
680
|
-
|
|
681
|
-
const $ea1ef594cf570d83$export$439d29a4e110a164 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
682
|
-
return /*#__PURE__*/ React.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends._extends({}, props, {
|
|
683
|
-
ref: forwardedRef,
|
|
684
|
-
style: {
|
|
685
|
-
// See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
|
|
686
|
-
position: 'absolute',
|
|
687
|
-
border: 0,
|
|
688
|
-
width: 1,
|
|
689
|
-
height: 1,
|
|
690
|
-
padding: 0,
|
|
691
|
-
margin: -1,
|
|
692
|
-
overflow: 'hidden',
|
|
693
|
-
clip: 'rect(0, 0, 0, 0)',
|
|
694
|
-
whiteSpace: 'nowrap',
|
|
695
|
-
wordWrap: 'normal',
|
|
696
|
-
...props.style
|
|
697
|
-
}
|
|
698
|
-
}));
|
|
699
|
-
});
|
|
700
|
-
|
|
701
56
|
const $cc7e05a45900e73f$var$OPEN_KEYS = [
|
|
702
57
|
' ',
|
|
703
58
|
'Enter',
|
|
@@ -711,24 +66,27 @@ const $cc7e05a45900e73f$var$SELECTION_KEYS = [
|
|
|
711
66
|
/* -------------------------------------------------------------------------------------------------
|
|
712
67
|
* Select
|
|
713
68
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SELECT_NAME = 'Select';
|
|
714
|
-
const [$cc7e05a45900e73f$var$Collection, $cc7e05a45900e73f$var$useCollection, $cc7e05a45900e73f$var$createCollectionScope] =
|
|
715
|
-
const [$cc7e05a45900e73f$var$createSelectContext, $cc7e05a45900e73f$export$286727a75dc039bd] =
|
|
716
|
-
$cc7e05a45900e73f$var$createCollectionScope
|
|
69
|
+
const [$cc7e05a45900e73f$var$Collection, $cc7e05a45900e73f$var$useCollection, $cc7e05a45900e73f$var$createCollectionScope] = index.$e02a7d9cb1dc128c$export$c74125a8e3af6bb2($cc7e05a45900e73f$var$SELECT_NAME);
|
|
70
|
+
const [$cc7e05a45900e73f$var$createSelectContext, $cc7e05a45900e73f$export$286727a75dc039bd] = index$1.$c512c27ab02ef895$export$50c7b4e9d9f19c1($cc7e05a45900e73f$var$SELECT_NAME, [
|
|
71
|
+
$cc7e05a45900e73f$var$createCollectionScope,
|
|
72
|
+
index$2.$cf1ac5d9fe0e8206$export$722aac194ae923
|
|
717
73
|
]);
|
|
74
|
+
const $cc7e05a45900e73f$var$usePopperScope = index$2.$cf1ac5d9fe0e8206$export$722aac194ae923();
|
|
718
75
|
const [$cc7e05a45900e73f$var$SelectProvider, $cc7e05a45900e73f$var$useSelectContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$SELECT_NAME);
|
|
719
76
|
const [$cc7e05a45900e73f$var$SelectNativeOptionsProvider, $cc7e05a45900e73f$var$useSelectNativeOptionsContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$SELECT_NAME);
|
|
720
77
|
const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
721
78
|
const { __scopeSelect: __scopeSelect , children: children , open: openProp , defaultOpen: defaultOpen , onOpenChange: onOpenChange , value: valueProp , defaultValue: defaultValue , onValueChange: onValueChange , dir: dir , name: name , autoComplete: autoComplete , disabled: disabled , required: required } = props;
|
|
79
|
+
const popperScope = $cc7e05a45900e73f$var$usePopperScope(__scopeSelect);
|
|
722
80
|
const [trigger, setTrigger] = React.useState(null);
|
|
723
81
|
const [valueNode, setValueNode] = React.useState(null);
|
|
724
82
|
const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false);
|
|
725
|
-
const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
726
|
-
const [open = false, setOpen] =
|
|
83
|
+
const direction = index$3.$f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
84
|
+
const [open = false, setOpen] = index$1.$71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
727
85
|
prop: openProp,
|
|
728
86
|
defaultProp: defaultOpen,
|
|
729
87
|
onChange: onOpenChange
|
|
730
88
|
});
|
|
731
|
-
const [value, setValue] =
|
|
89
|
+
const [value, setValue] = index$1.$71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
732
90
|
prop: valueProp,
|
|
733
91
|
defaultProp: defaultValue,
|
|
734
92
|
onChange: onValueChange
|
|
@@ -742,7 +100,7 @@ const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
|
742
100
|
// each time the options change.
|
|
743
101
|
const nativeSelectKey = Array.from(nativeOptionsSet).map((option)=>option.props.value
|
|
744
102
|
).join(';');
|
|
745
|
-
return /*#__PURE__*/ React.createElement($cc7e05a45900e73f$var$SelectProvider, {
|
|
103
|
+
return /*#__PURE__*/ React.createElement(index$2.$cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9, popperScope, /*#__PURE__*/ React.createElement($cc7e05a45900e73f$var$SelectProvider, {
|
|
746
104
|
required: required,
|
|
747
105
|
scope: __scopeSelect,
|
|
748
106
|
trigger: trigger,
|
|
@@ -751,7 +109,7 @@ const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
|
751
109
|
onValueNodeChange: setValueNode,
|
|
752
110
|
valueNodeHasChildren: valueNodeHasChildren,
|
|
753
111
|
onValueNodeHasChildrenChange: setValueNodeHasChildren,
|
|
754
|
-
contentId: $1746a345f3d73bb7$export$f680877a34711e37(),
|
|
112
|
+
contentId: index$4.$1746a345f3d73bb7$export$f680877a34711e37(),
|
|
755
113
|
value: value,
|
|
756
114
|
onValueChange: setValue,
|
|
757
115
|
open: open,
|
|
@@ -788,16 +146,17 @@ const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
|
788
146
|
disabled: disabled
|
|
789
147
|
}, value === undefined ? /*#__PURE__*/ React.createElement("option", {
|
|
790
148
|
value: ""
|
|
791
|
-
}) : null, Array.from(nativeOptionsSet)) : null);
|
|
149
|
+
}) : null, Array.from(nativeOptionsSet)) : null));
|
|
792
150
|
};
|
|
793
151
|
/* -------------------------------------------------------------------------------------------------
|
|
794
152
|
* SelectTrigger
|
|
795
153
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$TRIGGER_NAME = 'SelectTrigger';
|
|
796
154
|
const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
797
155
|
const { __scopeSelect: __scopeSelect , disabled: disabled = false , ...triggerProps } = props;
|
|
156
|
+
const popperScope = $cc7e05a45900e73f$var$usePopperScope(__scopeSelect);
|
|
798
157
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$TRIGGER_NAME, __scopeSelect);
|
|
799
158
|
const isDisabled = context.disabled || disabled;
|
|
800
|
-
const composedRefs =
|
|
159
|
+
const composedRefs = index$1.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.onTriggerChange);
|
|
801
160
|
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
802
161
|
const [searchRef, handleTypeaheadSearch, resetTypeahead] = $cc7e05a45900e73f$var$useTypeaheadSearch((search)=>{
|
|
803
162
|
const enabledItems = getItems().filter((item)=>!item.disabled
|
|
@@ -813,7 +172,9 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React.forwardRef(
|
|
|
813
172
|
resetTypeahead();
|
|
814
173
|
}
|
|
815
174
|
};
|
|
816
|
-
return /*#__PURE__*/ React.createElement(
|
|
175
|
+
return /*#__PURE__*/ React.createElement(index$2.$cf1ac5d9fe0e8206$export$b688253958b8dfe7, _extends._extends({
|
|
176
|
+
asChild: true
|
|
177
|
+
}, popperScope), /*#__PURE__*/ React.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends._extends({
|
|
817
178
|
type: "button",
|
|
818
179
|
role: "combobox",
|
|
819
180
|
"aria-controls": context.contentId,
|
|
@@ -824,11 +185,11 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React.forwardRef(
|
|
|
824
185
|
"data-state": context.open ? 'open' : 'closed',
|
|
825
186
|
disabled: isDisabled,
|
|
826
187
|
"data-disabled": isDisabled ? '' : undefined,
|
|
827
|
-
"data-placeholder": context.value
|
|
188
|
+
"data-placeholder": $cc7e05a45900e73f$var$shouldShowPlaceholder(context.value) ? '' : undefined
|
|
828
189
|
}, triggerProps, {
|
|
829
190
|
ref: composedRefs // Enable compatibility with native label or custom `Label` "click" for Safari:
|
|
830
191
|
,
|
|
831
|
-
onClick:
|
|
192
|
+
onClick: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onClick, (event)=>{
|
|
832
193
|
// Whilst browsers generally have no issue focusing the trigger when clicking
|
|
833
194
|
// on a label, Safari seems to struggle with the fact that there's no `onClick`.
|
|
834
195
|
// We force `focus` in this case. Note: this doesn't create any other side-effect
|
|
@@ -836,7 +197,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React.forwardRef(
|
|
|
836
197
|
// this only runs for a label "click"
|
|
837
198
|
event.currentTarget.focus();
|
|
838
199
|
}),
|
|
839
|
-
onPointerDown:
|
|
200
|
+
onPointerDown: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onPointerDown, (event)=>{
|
|
840
201
|
// prevent implicit pointer capture
|
|
841
202
|
// https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture
|
|
842
203
|
const target = event.target;
|
|
@@ -852,7 +213,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React.forwardRef(
|
|
|
852
213
|
event.preventDefault();
|
|
853
214
|
}
|
|
854
215
|
}),
|
|
855
|
-
onKeyDown:
|
|
216
|
+
onKeyDown: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onKeyDown, (event)=>{
|
|
856
217
|
const isTypingAhead = searchRef.current !== '';
|
|
857
218
|
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
858
219
|
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
@@ -862,42 +223,42 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React.forwardRef(
|
|
|
862
223
|
event.preventDefault();
|
|
863
224
|
}
|
|
864
225
|
})
|
|
865
|
-
}));
|
|
226
|
+
})));
|
|
866
227
|
});
|
|
867
228
|
/* -------------------------------------------------------------------------------------------------
|
|
868
229
|
* SelectValue
|
|
869
230
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$VALUE_NAME = 'SelectValue';
|
|
870
231
|
const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
871
232
|
// We ignore `className` and `style` as this part shouldn't be styled.
|
|
872
|
-
const { __scopeSelect: __scopeSelect , className: className , style: style , children: children , placeholder: placeholder , ...valueProps } = props;
|
|
233
|
+
const { __scopeSelect: __scopeSelect , className: className , style: style , children: children , placeholder: placeholder = '' , ...valueProps } = props;
|
|
873
234
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$VALUE_NAME, __scopeSelect);
|
|
874
235
|
const { onValueNodeHasChildrenChange: onValueNodeHasChildrenChange } = context;
|
|
875
236
|
const hasChildren = children !== undefined;
|
|
876
|
-
const composedRefs =
|
|
877
|
-
|
|
237
|
+
const composedRefs = index$1.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.onValueNodeChange);
|
|
238
|
+
index$1.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
878
239
|
onValueNodeHasChildrenChange(hasChildren);
|
|
879
240
|
}, [
|
|
880
241
|
onValueNodeHasChildrenChange,
|
|
881
242
|
hasChildren
|
|
882
243
|
]);
|
|
883
|
-
return /*#__PURE__*/ React.createElement(
|
|
244
|
+
return /*#__PURE__*/ React.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends._extends({}, valueProps, {
|
|
884
245
|
ref: composedRefs // we don't want events from the portalled `SelectValue` children to bubble
|
|
885
246
|
,
|
|
886
247
|
style: {
|
|
887
248
|
pointerEvents: 'none'
|
|
888
249
|
}
|
|
889
|
-
}), context.value
|
|
250
|
+
}), $cc7e05a45900e73f$var$shouldShowPlaceholder(context.value) ? /*#__PURE__*/ React.createElement(React.Fragment, null, placeholder) : children);
|
|
890
251
|
});
|
|
891
252
|
const $cc7e05a45900e73f$export$99b400cabb58c515 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
892
253
|
const { __scopeSelect: __scopeSelect , children: children , ...iconProps } = props;
|
|
893
|
-
return /*#__PURE__*/ React.createElement(
|
|
254
|
+
return /*#__PURE__*/ React.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends._extends({
|
|
894
255
|
"aria-hidden": true
|
|
895
256
|
}, iconProps, {
|
|
896
257
|
ref: forwardedRef
|
|
897
258
|
}), children || '▼');
|
|
898
259
|
});
|
|
899
260
|
const $cc7e05a45900e73f$export$b2af6c9944296213 = (props)=>{
|
|
900
|
-
return /*#__PURE__*/ React.createElement(
|
|
261
|
+
return /*#__PURE__*/ React.createElement(Combination.$f1701beae083dbae$export$602eac185826482c, _extends._extends({
|
|
901
262
|
asChild: true
|
|
902
263
|
}, props));
|
|
903
264
|
};
|
|
@@ -907,47 +268,47 @@ const $cc7e05a45900e73f$export$b2af6c9944296213 = (props)=>{
|
|
|
907
268
|
const $cc7e05a45900e73f$export$c973a4b3cb86a03d = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
908
269
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, props.__scopeSelect);
|
|
909
270
|
const [fragment, setFragment] = React.useState(); // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server
|
|
910
|
-
|
|
271
|
+
index$1.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
911
272
|
setFragment(new DocumentFragment());
|
|
912
273
|
}, []);
|
|
913
|
-
|
|
274
|
+
if (!context.open) {
|
|
275
|
+
const frag = fragment;
|
|
276
|
+
return frag ? /*#__PURE__*/ $7SXl2$reactdom.createPortal(/*#__PURE__*/ React.createElement($cc7e05a45900e73f$var$SelectContentProvider, {
|
|
277
|
+
scope: props.__scopeSelect
|
|
278
|
+
}, /*#__PURE__*/ React.createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
279
|
+
scope: props.__scopeSelect
|
|
280
|
+
}, /*#__PURE__*/ React.createElement("div", null, props.children))), frag) : null;
|
|
281
|
+
}
|
|
282
|
+
return /*#__PURE__*/ React.createElement($cc7e05a45900e73f$var$SelectContentImpl, _extends._extends({}, props, {
|
|
914
283
|
ref: forwardedRef
|
|
915
|
-
}))
|
|
916
|
-
scope: props.__scopeSelect
|
|
917
|
-
}, /*#__PURE__*/ React.createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
918
|
-
scope: props.__scopeSelect
|
|
919
|
-
}, /*#__PURE__*/ React.createElement("div", null, props.children))), fragment) : null);
|
|
284
|
+
}));
|
|
920
285
|
});
|
|
921
|
-
|
|
286
|
+
/* -------------------------------------------------------------------------------------------------
|
|
287
|
+
* SelectContentImpl
|
|
288
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$CONTENT_MARGIN = 10;
|
|
922
289
|
const [$cc7e05a45900e73f$var$SelectContentProvider, $cc7e05a45900e73f$var$useSelectContentContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$CONTENT_NAME);
|
|
923
290
|
const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
924
|
-
const { __scopeSelect: __scopeSelect , onCloseAutoFocus: onCloseAutoFocus ,
|
|
291
|
+
const { __scopeSelect: __scopeSelect , position: position = 'item-aligned' , onCloseAutoFocus: onCloseAutoFocus , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , side: //
|
|
292
|
+
// PopperContent props
|
|
293
|
+
side , sideOffset: sideOffset , align: align , alignOffset: alignOffset , arrowPadding: arrowPadding , collisionBoundary: collisionBoundary , collisionPadding: collisionPadding , sticky: sticky , hideWhenDetached: hideWhenDetached , avoidCollisions: avoidCollisions , //
|
|
294
|
+
...contentProps } = props;
|
|
925
295
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, __scopeSelect);
|
|
926
|
-
const [contentWrapper, setContentWrapper] = React.useState(null);
|
|
927
296
|
const [content, setContent] = React.useState(null);
|
|
928
297
|
const [viewport, setViewport] = React.useState(null);
|
|
929
|
-
const composedRefs =
|
|
298
|
+
const composedRefs = index$1.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContent(node)
|
|
930
299
|
);
|
|
931
300
|
const [selectedItem, setSelectedItem] = React.useState(null);
|
|
932
301
|
const [selectedItemText, setSelectedItemText] = React.useState(null);
|
|
933
302
|
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
934
303
|
const [isPositioned, setIsPositioned] = React.useState(false);
|
|
935
|
-
const shouldRepositionRef = React.useRef(true);
|
|
936
|
-
const shouldExpandOnScrollRef = React.useRef(false);
|
|
937
304
|
const firstValidItemFoundRef = React.useRef(false); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
|
|
938
305
|
React.useEffect(()=>{
|
|
939
|
-
if (content) return
|
|
306
|
+
if (content) return Combination.hideOthers(content);
|
|
940
307
|
}, [
|
|
941
308
|
content
|
|
942
309
|
]); // Make sure the whole tree has focus guards as our `Select` may be
|
|
943
310
|
// the last element in the DOM (because of the `Portal`)
|
|
944
|
-
|
|
945
|
-
const [contentZIndex, setContentZIndex] = React.useState();
|
|
946
|
-
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
947
|
-
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
948
|
-
}, [
|
|
949
|
-
content
|
|
950
|
-
]);
|
|
311
|
+
Combination.$3db38b7d1fb3fe6a$export$b7ece24a22aeda8c();
|
|
951
312
|
const focusFirst = React.useCallback((candidates)=>{
|
|
952
313
|
const [firstItem, ...restItems] = getItems().map((item)=>item.ref.current
|
|
953
314
|
);
|
|
@@ -968,101 +329,6 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React.forwardRef((
|
|
|
968
329
|
getItems,
|
|
969
330
|
viewport
|
|
970
331
|
]);
|
|
971
|
-
const position = React.useCallback(()=>{
|
|
972
|
-
if (context.trigger && context.valueNode && contentWrapper && content && viewport && selectedItem && selectedItemText) {
|
|
973
|
-
const triggerRect = context.trigger.getBoundingClientRect(); // -----------------------------------------------------------------------------------------
|
|
974
|
-
// Horizontal positioning
|
|
975
|
-
// -----------------------------------------------------------------------------------------
|
|
976
|
-
const contentRect = content.getBoundingClientRect();
|
|
977
|
-
const valueNodeRect = context.valueNode.getBoundingClientRect();
|
|
978
|
-
const itemTextRect = selectedItemText.getBoundingClientRect();
|
|
979
|
-
if (context.dir !== 'rtl') {
|
|
980
|
-
const itemTextOffset = itemTextRect.left - contentRect.left;
|
|
981
|
-
const left = valueNodeRect.left - itemTextOffset;
|
|
982
|
-
const leftDelta = triggerRect.left - left;
|
|
983
|
-
const minContentWidth = triggerRect.width + leftDelta;
|
|
984
|
-
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
985
|
-
const rightEdge = window.innerWidth - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
986
|
-
const clampedLeft = $ae6933e535247d3d$export$7d15b64cf5a3a4c4(left, [
|
|
987
|
-
$cc7e05a45900e73f$var$CONTENT_MARGIN,
|
|
988
|
-
rightEdge - contentWidth
|
|
989
|
-
]);
|
|
990
|
-
contentWrapper.style.minWidth = minContentWidth + 'px';
|
|
991
|
-
contentWrapper.style.left = clampedLeft + 'px';
|
|
992
|
-
} else {
|
|
993
|
-
const itemTextOffset = contentRect.right - itemTextRect.right;
|
|
994
|
-
const right = window.innerWidth - valueNodeRect.right - itemTextOffset;
|
|
995
|
-
const rightDelta = window.innerWidth - triggerRect.right - right;
|
|
996
|
-
const minContentWidth = triggerRect.width + rightDelta;
|
|
997
|
-
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
998
|
-
const leftEdge = window.innerWidth - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
999
|
-
const clampedRight = $ae6933e535247d3d$export$7d15b64cf5a3a4c4(right, [
|
|
1000
|
-
$cc7e05a45900e73f$var$CONTENT_MARGIN,
|
|
1001
|
-
leftEdge - contentWidth
|
|
1002
|
-
]);
|
|
1003
|
-
contentWrapper.style.minWidth = minContentWidth + 'px';
|
|
1004
|
-
contentWrapper.style.right = clampedRight + 'px';
|
|
1005
|
-
} // -----------------------------------------------------------------------------------------
|
|
1006
|
-
// Vertical positioning
|
|
1007
|
-
// -----------------------------------------------------------------------------------------
|
|
1008
|
-
const items = getItems();
|
|
1009
|
-
const availableHeight = window.innerHeight - $cc7e05a45900e73f$var$CONTENT_MARGIN * 2;
|
|
1010
|
-
const itemsHeight = viewport.scrollHeight;
|
|
1011
|
-
const contentStyles = window.getComputedStyle(content);
|
|
1012
|
-
const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10);
|
|
1013
|
-
const contentPaddingTop = parseInt(contentStyles.paddingTop, 10);
|
|
1014
|
-
const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10);
|
|
1015
|
-
const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10);
|
|
1016
|
-
const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth; // prettier-ignore
|
|
1017
|
-
const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight);
|
|
1018
|
-
const viewportStyles = window.getComputedStyle(viewport);
|
|
1019
|
-
const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10);
|
|
1020
|
-
const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10);
|
|
1021
|
-
const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
1022
|
-
const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;
|
|
1023
|
-
const selectedItemHalfHeight = selectedItem.offsetHeight / 2;
|
|
1024
|
-
const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight;
|
|
1025
|
-
const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;
|
|
1026
|
-
const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;
|
|
1027
|
-
const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle;
|
|
1028
|
-
if (willAlignWithoutTopOverflow) {
|
|
1029
|
-
const isLastItem = selectedItem === items[items.length - 1].ref.current;
|
|
1030
|
-
contentWrapper.style.bottom = "0px";
|
|
1031
|
-
const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;
|
|
1032
|
-
const clampedTriggerMiddleToBottomEdge = Math.max(triggerMiddleToBottomEdge, selectedItemHalfHeight + (isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth);
|
|
1033
|
-
const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge;
|
|
1034
|
-
contentWrapper.style.height = height + 'px';
|
|
1035
|
-
} else {
|
|
1036
|
-
const isFirstItem = selectedItem === items[0].ref.current;
|
|
1037
|
-
contentWrapper.style.top = "0px";
|
|
1038
|
-
const clampedTopEdgeToTriggerMiddle = Math.max(topEdgeToTriggerMiddle, contentBorderTopWidth + viewport.offsetTop + (isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight);
|
|
1039
|
-
const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom;
|
|
1040
|
-
contentWrapper.style.height = height + 'px';
|
|
1041
|
-
viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop;
|
|
1042
|
-
}
|
|
1043
|
-
contentWrapper.style.margin = `${$cc7e05a45900e73f$var$CONTENT_MARGIN}px 0`;
|
|
1044
|
-
contentWrapper.style.minHeight = minContentHeight + 'px';
|
|
1045
|
-
contentWrapper.style.maxHeight = availableHeight + 'px'; // -----------------------------------------------------------------------------------------
|
|
1046
|
-
setIsPositioned(true); // we don't want the initial scroll position adjustment to trigger "expand on scroll"
|
|
1047
|
-
// so we explicitly turn it on only after they've registered.
|
|
1048
|
-
requestAnimationFrame(()=>shouldExpandOnScrollRef.current = true
|
|
1049
|
-
);
|
|
1050
|
-
}
|
|
1051
|
-
}, [
|
|
1052
|
-
getItems,
|
|
1053
|
-
context.trigger,
|
|
1054
|
-
context.valueNode,
|
|
1055
|
-
contentWrapper,
|
|
1056
|
-
content,
|
|
1057
|
-
viewport,
|
|
1058
|
-
selectedItem,
|
|
1059
|
-
selectedItemText,
|
|
1060
|
-
context.dir
|
|
1061
|
-
]);
|
|
1062
|
-
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>position()
|
|
1063
|
-
, [
|
|
1064
|
-
position
|
|
1065
|
-
]);
|
|
1066
332
|
const focusSelectedItem = React.useCallback(()=>focusFirst([
|
|
1067
333
|
selectedItem,
|
|
1068
334
|
content
|
|
@@ -1078,19 +344,6 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React.forwardRef((
|
|
|
1078
344
|
}, [
|
|
1079
345
|
isPositioned,
|
|
1080
346
|
focusSelectedItem
|
|
1081
|
-
]); // When the viewport becomes scrollable at the top, the scroll up button will mount.
|
|
1082
|
-
// Because it is part of the normal flow, it will push down the viewport, thus throwing our
|
|
1083
|
-
// trigger => selectedItem alignment off by the amount the viewport was pushed down.
|
|
1084
|
-
// We wait for this to happen and then re-run the positining logic one more time to account for it.
|
|
1085
|
-
const handleScrollButtonChange = React.useCallback((node)=>{
|
|
1086
|
-
if (node && shouldRepositionRef.current === true) {
|
|
1087
|
-
position();
|
|
1088
|
-
focusSelectedItem();
|
|
1089
|
-
shouldRepositionRef.current = false;
|
|
1090
|
-
}
|
|
1091
|
-
}, [
|
|
1092
|
-
position,
|
|
1093
|
-
focusSelectedItem
|
|
1094
347
|
]); // prevent selecting items on `pointerup` in some cases after opening from `pointerdown`
|
|
1095
348
|
// and close on `pointerup` outside.
|
|
1096
349
|
const { onOpenChange: onOpenChange , triggerPointerDownPosRef: triggerPointerDownPosRef } = context;
|
|
@@ -1179,9 +432,21 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React.forwardRef((
|
|
|
1179
432
|
}, [
|
|
1180
433
|
context.value
|
|
1181
434
|
]);
|
|
435
|
+
const SelectPosition = position === 'popper' ? $cc7e05a45900e73f$var$SelectPopperPosition : $cc7e05a45900e73f$var$SelectItemAlignedPosition; // Silently ignore props that are not supported by `SelectItemAlignedPosition`
|
|
436
|
+
const popperContentProps = SelectPosition === $cc7e05a45900e73f$var$SelectPopperPosition ? {
|
|
437
|
+
side: side,
|
|
438
|
+
sideOffset: sideOffset,
|
|
439
|
+
align: align,
|
|
440
|
+
alignOffset: alignOffset,
|
|
441
|
+
arrowPadding: arrowPadding,
|
|
442
|
+
collisionBoundary: collisionBoundary,
|
|
443
|
+
collisionPadding: collisionPadding,
|
|
444
|
+
sticky: sticky,
|
|
445
|
+
hideWhenDetached: hideWhenDetached,
|
|
446
|
+
avoidCollisions: avoidCollisions
|
|
447
|
+
} : {};
|
|
1182
448
|
return /*#__PURE__*/ React.createElement($cc7e05a45900e73f$var$SelectContentProvider, {
|
|
1183
449
|
scope: __scopeSelect,
|
|
1184
|
-
contentWrapper: contentWrapper,
|
|
1185
450
|
content: content,
|
|
1186
451
|
viewport: viewport,
|
|
1187
452
|
onViewportChange: setViewport,
|
|
@@ -1189,23 +454,15 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React.forwardRef((
|
|
|
1189
454
|
selectedItem: selectedItem,
|
|
1190
455
|
onItemLeave: handleItemLeave,
|
|
1191
456
|
itemTextRefCallback: itemTextRefCallback,
|
|
457
|
+
focusSelectedItem: focusSelectedItem,
|
|
1192
458
|
selectedItemText: selectedItemText,
|
|
1193
|
-
|
|
459
|
+
position: position,
|
|
1194
460
|
isPositioned: isPositioned,
|
|
1195
|
-
shouldExpandOnScrollRef: shouldExpandOnScrollRef,
|
|
1196
461
|
searchRef: searchRef
|
|
1197
|
-
}, /*#__PURE__*/ React.createElement(
|
|
1198
|
-
as:
|
|
462
|
+
}, /*#__PURE__*/ React.createElement(Combination.$01b9c$RemoveScroll, {
|
|
463
|
+
as: index$1.$5e63c961fc1ce211$export$8c6ed5c666ac1360,
|
|
1199
464
|
allowPinchZoom: true
|
|
1200
|
-
}, /*#__PURE__*/ React.createElement(
|
|
1201
|
-
ref: setContentWrapper,
|
|
1202
|
-
style: {
|
|
1203
|
-
display: 'flex',
|
|
1204
|
-
flexDirection: 'column',
|
|
1205
|
-
position: 'fixed',
|
|
1206
|
-
zIndex: contentZIndex
|
|
1207
|
-
}
|
|
1208
|
-
}, /*#__PURE__*/ React.createElement($d3863c46a17e8a28$export$20e40289641fbbb6, {
|
|
465
|
+
}, /*#__PURE__*/ React.createElement(Combination.$d3863c46a17e8a28$export$20e40289641fbbb6, {
|
|
1209
466
|
asChild: true // we make sure we're not trapping once it's been closed
|
|
1210
467
|
,
|
|
1211
468
|
trapped: context.open,
|
|
@@ -1213,38 +470,41 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React.forwardRef((
|
|
|
1213
470
|
// we prevent open autofocus because we manually focus the selected item
|
|
1214
471
|
event.preventDefault();
|
|
1215
472
|
},
|
|
1216
|
-
onUnmountAutoFocus:
|
|
473
|
+
onUnmountAutoFocus: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(onCloseAutoFocus, (event)=>{
|
|
1217
474
|
var _context$trigger;
|
|
1218
475
|
(_context$trigger = context.trigger) === null || _context$trigger === void 0 || _context$trigger.focus({
|
|
1219
476
|
preventScroll: true
|
|
1220
477
|
});
|
|
1221
478
|
event.preventDefault();
|
|
1222
479
|
})
|
|
1223
|
-
}, /*#__PURE__*/ React.createElement(
|
|
480
|
+
}, /*#__PURE__*/ React.createElement(Combination.$5cb92bef7577960e$export$177fb62ff3ec1f22, {
|
|
481
|
+
asChild: true,
|
|
482
|
+
disableOutsidePointerEvents: true,
|
|
483
|
+
onEscapeKeyDown: onEscapeKeyDown,
|
|
484
|
+
onPointerDownOutside: onPointerDownOutside // When focus is trapped, a focusout event may still happen.
|
|
485
|
+
,
|
|
486
|
+
onFocusOutside: (event)=>event.preventDefault()
|
|
487
|
+
,
|
|
488
|
+
onDismiss: ()=>context.onOpenChange(false)
|
|
489
|
+
}, /*#__PURE__*/ React.createElement(SelectPosition, _extends._extends({
|
|
1224
490
|
role: "listbox",
|
|
1225
491
|
id: context.contentId,
|
|
1226
492
|
"data-state": context.open ? 'open' : 'closed',
|
|
1227
493
|
dir: context.dir,
|
|
1228
494
|
onContextMenu: (event)=>event.preventDefault()
|
|
1229
|
-
}, contentProps, {
|
|
495
|
+
}, contentProps, popperContentProps, {
|
|
496
|
+
onPlaced: ()=>setIsPositioned(true)
|
|
497
|
+
,
|
|
1230
498
|
ref: composedRefs,
|
|
1231
499
|
style: {
|
|
500
|
+
// flex layout so we can place the scroll buttons properly
|
|
1232
501
|
display: 'flex',
|
|
1233
502
|
flexDirection: 'column',
|
|
1234
|
-
//
|
|
1235
|
-
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
1236
|
-
boxSizing: 'border-box',
|
|
1237
|
-
maxHeight: '100%',
|
|
503
|
+
// reset the outline by default as the content MAY get focused
|
|
1238
504
|
outline: 'none',
|
|
1239
505
|
...contentProps.style
|
|
1240
506
|
},
|
|
1241
|
-
|
|
1242
|
-
,
|
|
1243
|
-
onFocusOutside: (event)=>event.preventDefault()
|
|
1244
|
-
,
|
|
1245
|
-
onDismiss: ()=>context.onOpenChange(false)
|
|
1246
|
-
,
|
|
1247
|
-
onKeyDown: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(contentProps.onKeyDown, (event)=>{
|
|
507
|
+
onKeyDown: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(contentProps.onKeyDown, (event)=>{
|
|
1248
508
|
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey; // select should not be navigated using tab key so we prevent it
|
|
1249
509
|
if (event.key === 'Tab') event.preventDefault();
|
|
1250
510
|
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
@@ -1280,13 +540,186 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React.forwardRef((
|
|
|
1280
540
|
})
|
|
1281
541
|
}))))));
|
|
1282
542
|
});
|
|
543
|
+
const $cc7e05a45900e73f$var$SelectItemAlignedPosition = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
544
|
+
const { __scopeSelect: __scopeSelect , onPlaced: onPlaced , ...popperProps } = props;
|
|
545
|
+
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, __scopeSelect);
|
|
546
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$CONTENT_NAME, __scopeSelect);
|
|
547
|
+
const [contentWrapper, setContentWrapper] = React.useState(null);
|
|
548
|
+
const [content, setContent] = React.useState(null);
|
|
549
|
+
const composedRefs = index$1.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContent(node)
|
|
550
|
+
);
|
|
551
|
+
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
552
|
+
const shouldExpandOnScrollRef = React.useRef(false);
|
|
553
|
+
const shouldRepositionRef = React.useRef(true);
|
|
554
|
+
const { viewport: viewport , selectedItem: selectedItem , selectedItemText: selectedItemText , focusSelectedItem: focusSelectedItem } = contentContext;
|
|
555
|
+
const position = React.useCallback(()=>{
|
|
556
|
+
if (context.trigger && context.valueNode && contentWrapper && content && viewport && selectedItem && selectedItemText) {
|
|
557
|
+
const triggerRect = context.trigger.getBoundingClientRect(); // -----------------------------------------------------------------------------------------
|
|
558
|
+
// Horizontal positioning
|
|
559
|
+
// -----------------------------------------------------------------------------------------
|
|
560
|
+
const contentRect = content.getBoundingClientRect();
|
|
561
|
+
const valueNodeRect = context.valueNode.getBoundingClientRect();
|
|
562
|
+
const itemTextRect = selectedItemText.getBoundingClientRect();
|
|
563
|
+
if (context.dir !== 'rtl') {
|
|
564
|
+
const itemTextOffset = itemTextRect.left - contentRect.left;
|
|
565
|
+
const left = valueNodeRect.left - itemTextOffset;
|
|
566
|
+
const leftDelta = triggerRect.left - left;
|
|
567
|
+
const minContentWidth = triggerRect.width + leftDelta;
|
|
568
|
+
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
569
|
+
const rightEdge = window.innerWidth - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
570
|
+
const clampedLeft = $ae6933e535247d3d$export$7d15b64cf5a3a4c4(left, [
|
|
571
|
+
$cc7e05a45900e73f$var$CONTENT_MARGIN,
|
|
572
|
+
rightEdge - contentWidth
|
|
573
|
+
]);
|
|
574
|
+
contentWrapper.style.minWidth = minContentWidth + 'px';
|
|
575
|
+
contentWrapper.style.left = clampedLeft + 'px';
|
|
576
|
+
} else {
|
|
577
|
+
const itemTextOffset = contentRect.right - itemTextRect.right;
|
|
578
|
+
const right = window.innerWidth - valueNodeRect.right - itemTextOffset;
|
|
579
|
+
const rightDelta = window.innerWidth - triggerRect.right - right;
|
|
580
|
+
const minContentWidth = triggerRect.width + rightDelta;
|
|
581
|
+
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
582
|
+
const leftEdge = window.innerWidth - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
583
|
+
const clampedRight = $ae6933e535247d3d$export$7d15b64cf5a3a4c4(right, [
|
|
584
|
+
$cc7e05a45900e73f$var$CONTENT_MARGIN,
|
|
585
|
+
leftEdge - contentWidth
|
|
586
|
+
]);
|
|
587
|
+
contentWrapper.style.minWidth = minContentWidth + 'px';
|
|
588
|
+
contentWrapper.style.right = clampedRight + 'px';
|
|
589
|
+
} // -----------------------------------------------------------------------------------------
|
|
590
|
+
// Vertical positioning
|
|
591
|
+
// -----------------------------------------------------------------------------------------
|
|
592
|
+
const items = getItems();
|
|
593
|
+
const availableHeight = window.innerHeight - $cc7e05a45900e73f$var$CONTENT_MARGIN * 2;
|
|
594
|
+
const itemsHeight = viewport.scrollHeight;
|
|
595
|
+
const contentStyles = window.getComputedStyle(content);
|
|
596
|
+
const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10);
|
|
597
|
+
const contentPaddingTop = parseInt(contentStyles.paddingTop, 10);
|
|
598
|
+
const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10);
|
|
599
|
+
const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10);
|
|
600
|
+
const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth; // prettier-ignore
|
|
601
|
+
const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight);
|
|
602
|
+
const viewportStyles = window.getComputedStyle(viewport);
|
|
603
|
+
const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10);
|
|
604
|
+
const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10);
|
|
605
|
+
const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
606
|
+
const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;
|
|
607
|
+
const selectedItemHalfHeight = selectedItem.offsetHeight / 2;
|
|
608
|
+
const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight;
|
|
609
|
+
const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;
|
|
610
|
+
const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;
|
|
611
|
+
const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle;
|
|
612
|
+
if (willAlignWithoutTopOverflow) {
|
|
613
|
+
const isLastItem = selectedItem === items[items.length - 1].ref.current;
|
|
614
|
+
contentWrapper.style.bottom = "0px";
|
|
615
|
+
const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;
|
|
616
|
+
const clampedTriggerMiddleToBottomEdge = Math.max(triggerMiddleToBottomEdge, selectedItemHalfHeight + (isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth);
|
|
617
|
+
const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge;
|
|
618
|
+
contentWrapper.style.height = height + 'px';
|
|
619
|
+
} else {
|
|
620
|
+
const isFirstItem = selectedItem === items[0].ref.current;
|
|
621
|
+
contentWrapper.style.top = "0px";
|
|
622
|
+
const clampedTopEdgeToTriggerMiddle = Math.max(topEdgeToTriggerMiddle, contentBorderTopWidth + viewport.offsetTop + (isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight);
|
|
623
|
+
const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom;
|
|
624
|
+
contentWrapper.style.height = height + 'px';
|
|
625
|
+
viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop;
|
|
626
|
+
}
|
|
627
|
+
contentWrapper.style.margin = `${$cc7e05a45900e73f$var$CONTENT_MARGIN}px 0`;
|
|
628
|
+
contentWrapper.style.minHeight = minContentHeight + 'px';
|
|
629
|
+
contentWrapper.style.maxHeight = availableHeight + 'px'; // -----------------------------------------------------------------------------------------
|
|
630
|
+
onPlaced === null || onPlaced === void 0 || onPlaced(); // we don't want the initial scroll position adjustment to trigger "expand on scroll"
|
|
631
|
+
// so we explicitly turn it on only after they've registered.
|
|
632
|
+
requestAnimationFrame(()=>shouldExpandOnScrollRef.current = true
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
}, [
|
|
636
|
+
getItems,
|
|
637
|
+
context.trigger,
|
|
638
|
+
context.valueNode,
|
|
639
|
+
contentWrapper,
|
|
640
|
+
content,
|
|
641
|
+
viewport,
|
|
642
|
+
selectedItem,
|
|
643
|
+
selectedItemText,
|
|
644
|
+
context.dir,
|
|
645
|
+
onPlaced
|
|
646
|
+
]);
|
|
647
|
+
index$1.$9f79659886946c16$export$e5c5a5f917a5871c(()=>position()
|
|
648
|
+
, [
|
|
649
|
+
position
|
|
650
|
+
]); // copy z-index from content to wrapper
|
|
651
|
+
const [contentZIndex, setContentZIndex] = React.useState();
|
|
652
|
+
index$1.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
653
|
+
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
654
|
+
}, [
|
|
655
|
+
content
|
|
656
|
+
]); // When the viewport becomes scrollable at the top, the scroll up button will mount.
|
|
657
|
+
// Because it is part of the normal flow, it will push down the viewport, thus throwing our
|
|
658
|
+
// trigger => selectedItem alignment off by the amount the viewport was pushed down.
|
|
659
|
+
// We wait for this to happen and then re-run the positining logic one more time to account for it.
|
|
660
|
+
const handleScrollButtonChange = React.useCallback((node)=>{
|
|
661
|
+
if (node && shouldRepositionRef.current === true) {
|
|
662
|
+
position();
|
|
663
|
+
focusSelectedItem === null || focusSelectedItem === void 0 || focusSelectedItem();
|
|
664
|
+
shouldRepositionRef.current = false;
|
|
665
|
+
}
|
|
666
|
+
}, [
|
|
667
|
+
position,
|
|
668
|
+
focusSelectedItem
|
|
669
|
+
]);
|
|
670
|
+
return /*#__PURE__*/ React.createElement($cc7e05a45900e73f$var$SelectViewportProvider, {
|
|
671
|
+
scope: __scopeSelect,
|
|
672
|
+
contentWrapper: contentWrapper,
|
|
673
|
+
shouldExpandOnScrollRef: shouldExpandOnScrollRef,
|
|
674
|
+
onScrollButtonChange: handleScrollButtonChange
|
|
675
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
676
|
+
ref: setContentWrapper,
|
|
677
|
+
style: {
|
|
678
|
+
display: 'flex',
|
|
679
|
+
flexDirection: 'column',
|
|
680
|
+
position: 'fixed',
|
|
681
|
+
zIndex: contentZIndex
|
|
682
|
+
}
|
|
683
|
+
}, /*#__PURE__*/ React.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends._extends({}, popperProps, {
|
|
684
|
+
ref: composedRefs,
|
|
685
|
+
style: {
|
|
686
|
+
// When we get the height of the content, it includes borders. If we were to set
|
|
687
|
+
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
688
|
+
boxSizing: 'border-box',
|
|
689
|
+
// We need to ensure the content doesn't get taller than the wrapper
|
|
690
|
+
maxHeight: '100%',
|
|
691
|
+
...popperProps.style
|
|
692
|
+
}
|
|
693
|
+
}))));
|
|
694
|
+
});
|
|
695
|
+
const $cc7e05a45900e73f$var$SelectPopperPosition = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
696
|
+
const { __scopeSelect: __scopeSelect , align: align = 'start' , collisionPadding: collisionPadding = $cc7e05a45900e73f$var$CONTENT_MARGIN , ...popperProps } = props;
|
|
697
|
+
const popperScope = $cc7e05a45900e73f$var$usePopperScope(__scopeSelect);
|
|
698
|
+
return /*#__PURE__*/ React.createElement(index$2.$cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2, _extends._extends({}, popperScope, popperProps, {
|
|
699
|
+
ref: forwardedRef,
|
|
700
|
+
align: align,
|
|
701
|
+
collisionPadding: collisionPadding,
|
|
702
|
+
style: {
|
|
703
|
+
// Ensure border-box for floating-ui calculations
|
|
704
|
+
boxSizing: 'border-box',
|
|
705
|
+
...popperProps.style,
|
|
706
|
+
'--radix-select-content-transform-origin': 'var(--radix-popper-transform-origin)',
|
|
707
|
+
'--radix-select-content-available-width': 'var(--radix-popper-available-width)',
|
|
708
|
+
'--radix-select-content-available-height': 'var(--radix-popper-available-height)',
|
|
709
|
+
'--radix-select-trigger-width': 'var(--radix-popper-anchor-width)',
|
|
710
|
+
'--radix-select-trigger-height': 'var(--radix-popper-anchor-height)'
|
|
711
|
+
}
|
|
712
|
+
}));
|
|
713
|
+
});
|
|
1283
714
|
/* -------------------------------------------------------------------------------------------------
|
|
1284
715
|
* SelectViewport
|
|
1285
|
-
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$
|
|
716
|
+
* -----------------------------------------------------------------------------------------------*/ const [$cc7e05a45900e73f$var$SelectViewportProvider, $cc7e05a45900e73f$var$useSelectViewportContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, {});
|
|
717
|
+
const $cc7e05a45900e73f$var$VIEWPORT_NAME = 'SelectViewport';
|
|
1286
718
|
const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
1287
719
|
const { __scopeSelect: __scopeSelect , ...viewportProps } = props;
|
|
1288
720
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
1289
|
-
const
|
|
721
|
+
const viewportContext = $cc7e05a45900e73f$var$useSelectViewportContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
722
|
+
const composedRefs = index$1.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentContext.onViewportChange);
|
|
1290
723
|
const prevScrollTopRef = React.useRef(0);
|
|
1291
724
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("style", {
|
|
1292
725
|
dangerouslySetInnerHTML: {
|
|
@@ -1294,7 +727,7 @@ const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ React.forwardRef
|
|
|
1294
727
|
}
|
|
1295
728
|
}), /*#__PURE__*/ React.createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
1296
729
|
scope: __scopeSelect
|
|
1297
|
-
}, /*#__PURE__*/ React.createElement(
|
|
730
|
+
}, /*#__PURE__*/ React.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends._extends({
|
|
1298
731
|
"data-radix-select-viewport": "",
|
|
1299
732
|
role: "presentation"
|
|
1300
733
|
}, viewportProps, {
|
|
@@ -1308,9 +741,9 @@ const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ React.forwardRef
|
|
|
1308
741
|
overflow: 'auto',
|
|
1309
742
|
...viewportProps.style
|
|
1310
743
|
},
|
|
1311
|
-
onScroll:
|
|
744
|
+
onScroll: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(viewportProps.onScroll, (event)=>{
|
|
1312
745
|
const viewport = event.currentTarget;
|
|
1313
|
-
const { contentWrapper: contentWrapper , shouldExpandOnScrollRef: shouldExpandOnScrollRef } =
|
|
746
|
+
const { contentWrapper: contentWrapper , shouldExpandOnScrollRef: shouldExpandOnScrollRef } = viewportContext;
|
|
1314
747
|
if (shouldExpandOnScrollRef !== null && shouldExpandOnScrollRef !== void 0 && shouldExpandOnScrollRef.current && contentWrapper) {
|
|
1315
748
|
const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop);
|
|
1316
749
|
if (scrolledBy > 0) {
|
|
@@ -1349,17 +782,18 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React.forwardRef
|
|
|
1349
782
|
const isSelected = context.value === value;
|
|
1350
783
|
const [textValue, setTextValue] = React.useState(textValueProp !== null && textValueProp !== void 0 ? textValueProp : '');
|
|
1351
784
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
1352
|
-
const composedRefs =
|
|
785
|
+
const composedRefs = index$1.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>{
|
|
1353
786
|
var _contentContext$itemR;
|
|
1354
787
|
return (_contentContext$itemR = contentContext.itemRefCallback) === null || _contentContext$itemR === void 0 ? void 0 : _contentContext$itemR.call(contentContext, node, value, disabled);
|
|
1355
788
|
});
|
|
1356
|
-
const textId = $1746a345f3d73bb7$export$f680877a34711e37();
|
|
789
|
+
const textId = index$4.$1746a345f3d73bb7$export$f680877a34711e37();
|
|
1357
790
|
const handleSelect = ()=>{
|
|
1358
791
|
if (!disabled) {
|
|
1359
792
|
context.onValueChange(value);
|
|
1360
793
|
context.onOpenChange(false);
|
|
1361
794
|
}
|
|
1362
795
|
};
|
|
796
|
+
if (value === '') throw new Error('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.');
|
|
1363
797
|
return /*#__PURE__*/ React.createElement($cc7e05a45900e73f$var$SelectItemContextProvider, {
|
|
1364
798
|
scope: __scopeSelect,
|
|
1365
799
|
value: value,
|
|
@@ -1377,7 +811,7 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React.forwardRef
|
|
|
1377
811
|
value: value,
|
|
1378
812
|
disabled: disabled,
|
|
1379
813
|
textValue: textValue
|
|
1380
|
-
}, /*#__PURE__*/ React.createElement(
|
|
814
|
+
}, /*#__PURE__*/ React.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends._extends({
|
|
1381
815
|
role: "option",
|
|
1382
816
|
"aria-labelledby": textId,
|
|
1383
817
|
"data-highlighted": isFocused ? '' : undefined // `isFocused` caveat fixes stuttering in VoiceOver
|
|
@@ -1389,12 +823,12 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React.forwardRef
|
|
|
1389
823
|
tabIndex: disabled ? undefined : -1
|
|
1390
824
|
}, itemProps, {
|
|
1391
825
|
ref: composedRefs,
|
|
1392
|
-
onFocus:
|
|
826
|
+
onFocus: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onFocus, ()=>setIsFocused(true)
|
|
1393
827
|
),
|
|
1394
|
-
onBlur:
|
|
828
|
+
onBlur: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onBlur, ()=>setIsFocused(false)
|
|
1395
829
|
),
|
|
1396
|
-
onPointerUp:
|
|
1397
|
-
onPointerMove:
|
|
830
|
+
onPointerUp: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerUp, handleSelect),
|
|
831
|
+
onPointerMove: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerMove, (event)=>{
|
|
1398
832
|
if (disabled) {
|
|
1399
833
|
var _contentContext$onIte;
|
|
1400
834
|
(_contentContext$onIte = contentContext.onItemLeave) === null || _contentContext$onIte === void 0 || _contentContext$onIte.call(contentContext);
|
|
@@ -1404,13 +838,13 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React.forwardRef
|
|
|
1404
838
|
preventScroll: true
|
|
1405
839
|
});
|
|
1406
840
|
}),
|
|
1407
|
-
onPointerLeave:
|
|
841
|
+
onPointerLeave: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerLeave, (event)=>{
|
|
1408
842
|
if (event.currentTarget === document.activeElement) {
|
|
1409
843
|
var _contentContext$onIte2;
|
|
1410
844
|
(_contentContext$onIte2 = contentContext.onItemLeave) === null || _contentContext$onIte2 === void 0 || _contentContext$onIte2.call(contentContext);
|
|
1411
845
|
}
|
|
1412
846
|
}),
|
|
1413
|
-
onKeyDown:
|
|
847
|
+
onKeyDown: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onKeyDown, (event)=>{
|
|
1414
848
|
var _contentContext$searc;
|
|
1415
849
|
const isTypingAhead = ((_contentContext$searc = contentContext.searchRef) === null || _contentContext$searc === void 0 ? void 0 : _contentContext$searc.current) !== '';
|
|
1416
850
|
if (isTypingAhead && event.key === ' ') return;
|
|
@@ -1430,7 +864,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React.forwardRef
|
|
|
1430
864
|
const itemContext = $cc7e05a45900e73f$var$useSelectItemContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
1431
865
|
const nativeOptionsContext = $cc7e05a45900e73f$var$useSelectNativeOptionsContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
1432
866
|
const [itemTextNode, setItemTextNode] = React.useState(null);
|
|
1433
|
-
const composedRefs =
|
|
867
|
+
const composedRefs = index$1.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setItemTextNode(node)
|
|
1434
868
|
, itemContext.onItemTextChange, (node)=>{
|
|
1435
869
|
var _contentContext$itemT;
|
|
1436
870
|
return (_contentContext$itemT = contentContext.itemTextRefCallback) === null || _contentContext$itemT === void 0 ? void 0 : _contentContext$itemT.call(contentContext, node, itemContext.value, itemContext.disabled);
|
|
@@ -1447,7 +881,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React.forwardRef
|
|
|
1447
881
|
textContent
|
|
1448
882
|
]);
|
|
1449
883
|
const { onNativeOptionAdd: onNativeOptionAdd , onNativeOptionRemove: onNativeOptionRemove } = nativeOptionsContext;
|
|
1450
|
-
|
|
884
|
+
index$1.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
1451
885
|
onNativeOptionAdd(nativeOption);
|
|
1452
886
|
return ()=>onNativeOptionRemove(nativeOption)
|
|
1453
887
|
;
|
|
@@ -1456,7 +890,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React.forwardRef
|
|
|
1456
890
|
onNativeOptionRemove,
|
|
1457
891
|
nativeOption
|
|
1458
892
|
]);
|
|
1459
|
-
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(
|
|
893
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends._extends({
|
|
1460
894
|
id: itemContext.textId
|
|
1461
895
|
}, itemTextProps, {
|
|
1462
896
|
ref: composedRefs
|
|
@@ -1468,7 +902,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React.forwardRef
|
|
|
1468
902
|
const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
1469
903
|
const { __scopeSelect: __scopeSelect , ...itemIndicatorProps } = props;
|
|
1470
904
|
const itemContext = $cc7e05a45900e73f$var$useSelectItemContext($cc7e05a45900e73f$var$ITEM_INDICATOR_NAME, __scopeSelect);
|
|
1471
|
-
return itemContext.isSelected ? /*#__PURE__*/ React.createElement(
|
|
905
|
+
return itemContext.isSelected ? /*#__PURE__*/ React.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends._extends({
|
|
1472
906
|
"aria-hidden": true
|
|
1473
907
|
}, itemIndicatorProps, {
|
|
1474
908
|
ref: forwardedRef
|
|
@@ -1479,9 +913,10 @@ const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ React.forwardRef
|
|
|
1479
913
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME = 'SelectScrollUpButton';
|
|
1480
914
|
const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
1481
915
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
916
|
+
const viewportContext = $cc7e05a45900e73f$var$useSelectViewportContext($cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
1482
917
|
const [canScrollUp1, setCanScrollUp] = React.useState(false);
|
|
1483
|
-
const composedRefs =
|
|
1484
|
-
|
|
918
|
+
const composedRefs = index$1.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, viewportContext.onScrollButtonChange);
|
|
919
|
+
index$1.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
1485
920
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
1486
921
|
const viewport = contentContext.viewport;
|
|
1487
922
|
function handleScroll() {
|
|
@@ -1510,9 +945,10 @@ const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ React.forwardRef
|
|
|
1510
945
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME = 'SelectScrollDownButton';
|
|
1511
946
|
const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
1512
947
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
948
|
+
const viewportContext = $cc7e05a45900e73f$var$useSelectViewportContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
1513
949
|
const [canScrollDown1, setCanScrollDown] = React.useState(false);
|
|
1514
|
-
const composedRefs =
|
|
1515
|
-
|
|
950
|
+
const composedRefs = index$1.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, viewportContext.onScrollButtonChange);
|
|
951
|
+
index$1.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
1516
952
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
1517
953
|
const viewport = contentContext.viewport;
|
|
1518
954
|
function handleScroll() {
|
|
@@ -1558,7 +994,7 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React.forward
|
|
|
1558
994
|
// Because it is part of the normal flow, it will push down (top button) or shrink (bottom button)
|
|
1559
995
|
// the viewport, potentially causing the active item to now be partially out of view.
|
|
1560
996
|
// We re-run the `scrollIntoView` logic to make sure it stays within the viewport.
|
|
1561
|
-
|
|
997
|
+
index$1.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
1562
998
|
var _activeItem$ref$curre;
|
|
1563
999
|
const activeItem = getItems().find((item)=>item.ref.current === document.activeElement
|
|
1564
1000
|
);
|
|
@@ -1568,7 +1004,7 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React.forward
|
|
|
1568
1004
|
}, [
|
|
1569
1005
|
getItems
|
|
1570
1006
|
]);
|
|
1571
|
-
return /*#__PURE__*/ React.createElement(
|
|
1007
|
+
return /*#__PURE__*/ React.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends._extends({
|
|
1572
1008
|
"aria-hidden": true
|
|
1573
1009
|
}, scrollIndicatorProps, {
|
|
1574
1010
|
ref: forwardedRef,
|
|
@@ -1576,21 +1012,27 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React.forward
|
|
|
1576
1012
|
flexShrink: 0,
|
|
1577
1013
|
...scrollIndicatorProps.style
|
|
1578
1014
|
},
|
|
1579
|
-
|
|
1015
|
+
onPointerDown: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerDown, ()=>{
|
|
1016
|
+
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
1017
|
+
}),
|
|
1018
|
+
onPointerMove: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerMove, ()=>{
|
|
1580
1019
|
var _contentContext$onIte3;
|
|
1581
1020
|
(_contentContext$onIte3 = contentContext.onItemLeave) === null || _contentContext$onIte3 === void 0 || _contentContext$onIte3.call(contentContext);
|
|
1582
1021
|
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
1583
1022
|
}),
|
|
1584
|
-
onPointerLeave:
|
|
1023
|
+
onPointerLeave: index$1.$e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerLeave, ()=>{
|
|
1585
1024
|
clearAutoScrollTimer();
|
|
1586
1025
|
})
|
|
1587
1026
|
}));
|
|
1588
1027
|
});
|
|
1589
|
-
/* -----------------------------------------------------------------------------------------------*/
|
|
1028
|
+
/* -----------------------------------------------------------------------------------------------*/ function $cc7e05a45900e73f$var$shouldShowPlaceholder(value) {
|
|
1029
|
+
return value === '' || value === undefined;
|
|
1030
|
+
}
|
|
1031
|
+
const $cc7e05a45900e73f$var$BubbleSelect = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
1590
1032
|
const { value: value , ...selectProps } = props;
|
|
1591
1033
|
const ref = React.useRef(null);
|
|
1592
|
-
const composedRefs =
|
|
1593
|
-
const prevValue =
|
|
1034
|
+
const composedRefs = index$1.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
1035
|
+
const prevValue = $010c2913dbd2fe3d$export$5cae361ad82dce8b(value); // Bubble value change to parents (e.g form change event)
|
|
1594
1036
|
React.useEffect(()=>{
|
|
1595
1037
|
const select = ref.current;
|
|
1596
1038
|
const selectProto = window.HTMLSelectElement.prototype;
|
|
@@ -1618,7 +1060,7 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React.forward
|
|
|
1618
1060
|
*
|
|
1619
1061
|
* We use `VisuallyHidden` rather than `display: "none"` because Safari autofill
|
|
1620
1062
|
* won't work otherwise.
|
|
1621
|
-
*/ return /*#__PURE__*/ React.createElement($ea1ef594cf570d83$export$439d29a4e110a164, {
|
|
1063
|
+
*/ return /*#__PURE__*/ React.createElement(index$5.$ea1ef594cf570d83$export$439d29a4e110a164, {
|
|
1622
1064
|
asChild: true
|
|
1623
1065
|
}, /*#__PURE__*/ React.createElement("select", _extends._extends({}, selectProps, {
|
|
1624
1066
|
ref: composedRefs,
|
|
@@ -1627,7 +1069,7 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React.forward
|
|
|
1627
1069
|
});
|
|
1628
1070
|
$cc7e05a45900e73f$var$BubbleSelect.displayName = 'BubbleSelect';
|
|
1629
1071
|
function $cc7e05a45900e73f$var$useTypeaheadSearch(onSearchChange) {
|
|
1630
|
-
const handleSearchChange =
|
|
1072
|
+
const handleSearchChange = index$1.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onSearchChange);
|
|
1631
1073
|
const searchRef = React.useRef('');
|
|
1632
1074
|
const timerRef = React.useRef(0);
|
|
1633
1075
|
const handleTypeaheadSearch = React.useCallback((key)=>{
|
|
@@ -1725,7 +1167,7 @@ const BtIconChevronUp2Px = (props) =>
|
|
|
1725
1167
|
/** Use `Select` to choose from a dropdown list of options. */
|
|
1726
1168
|
var Select = function (_a) {
|
|
1727
1169
|
var _b;
|
|
1728
|
-
var isRequired = _a.isRequired, isDisabled = _a.isDisabled, placeholder = _a.placeholder, label = _a.label, _c = _a.ariaLabel, ariaLabel = _c === void 0 ? label : _c, options = _a.options, onOpenChange = _a.onOpenChange, isDefaultOpen = _a.isDefaultOpen, defaultValue = _a.defaultValue, errorMessage = _a.errorMessage, labelSize = _a.labelSize, helper = _a.helper, name = _a.name, isFluid = _a.isFluid, onBlur = _a.onBlur, onChange = _a.onChange, disclosureTitle = _a.disclosureTitle, disclosureText = _a.disclosureText, onClickDisclosure = _a.onClickDisclosure, _d = _a.selectSize, selectSize = _d === void 0 ? "m" : _d, props = filterDataAttrs.__rest(_a, ["isRequired", "isDisabled", "placeholder", "label", "ariaLabel", "options", "onOpenChange", "isDefaultOpen", "defaultValue", "errorMessage", "labelSize", "helper", "name", "isFluid", "onBlur", "onChange", "disclosureTitle", "disclosureText", "onClickDisclosure", "selectSize"]);
|
|
1170
|
+
var isRequired = _a.isRequired, isDisabled = _a.isDisabled, placeholder = _a.placeholder, label = _a.label, _c = _a.ariaLabel, ariaLabel = _c === void 0 ? label : _c, options = _a.options, onOpenChange = _a.onOpenChange, isDefaultOpen = _a.isDefaultOpen, defaultValue = _a.defaultValue, errorMessage = _a.errorMessage, labelSize = _a.labelSize, helper = _a.helper, hideLabel = _a.hideLabel, name = _a.name, width = _a.width, isFluid = _a.isFluid, onBlur = _a.onBlur, onChange = _a.onChange, disclosureTitle = _a.disclosureTitle, disclosureText = _a.disclosureText, onClickDisclosure = _a.onClickDisclosure, _d = _a.selectSize, selectSize = _d === void 0 ? "m" : _d, props = filterDataAttrs.__rest(_a, ["isRequired", "isDisabled", "placeholder", "label", "ariaLabel", "options", "onOpenChange", "isDefaultOpen", "defaultValue", "errorMessage", "labelSize", "helper", "hideLabel", "name", "width", "isFluid", "onBlur", "onChange", "disclosureTitle", "disclosureText", "onClickDisclosure", "selectSize"]);
|
|
1729
1171
|
var id = React.useId();
|
|
1730
1172
|
var arcRootElement = React.useContext(Base.ArcRootElementContext);
|
|
1731
1173
|
var surface = React.useContext(Surface.Context).surface;
|
|
@@ -1748,35 +1190,36 @@ var Select = function (_a) {
|
|
|
1748
1190
|
return 20;
|
|
1749
1191
|
}
|
|
1750
1192
|
};
|
|
1751
|
-
return (React__default["default"].createElement(FormControl.FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, label: label, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional", isDisabled: isDisabled, disclosureText: disclosureText, disclosureTitle: disclosureTitle, onClickDisclosure: onClickDisclosure },
|
|
1193
|
+
return (React__default["default"].createElement(FormControl.FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, label: label, hideLabel: hideLabel, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional", isDisabled: isDisabled, disclosureText: disclosureText, disclosureTitle: disclosureTitle, onClickDisclosure: onClickDisclosure },
|
|
1752
1194
|
React__default["default"].createElement($cc7e05a45900e73f$export$be92b6f5f03c0fe9, { name: name, required: isRequired, disabled: isDisabled, defaultOpen: isDefaultOpen, value: selectedValue, onOpenChange: onOpenChange, onValueChange: function (value) { return onValueChange(value); } },
|
|
1753
|
-
React__default["default"].createElement(
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
React__default["default"].createElement(
|
|
1763
|
-
|
|
1764
|
-
React__default["default"].createElement($cc7e05a45900e73f$export$
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
React__default["default"].createElement(
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
React__default["default"].createElement(
|
|
1773
|
-
React__default["default"].createElement(
|
|
1774
|
-
React__default["default"].createElement(
|
|
1775
|
-
|
|
1776
|
-
React__default["default"].createElement(
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
React__default["default"].createElement(
|
|
1195
|
+
React__default["default"].createElement("div", { className: "arc-Select-wrapper" },
|
|
1196
|
+
React__default["default"].createElement($cc7e05a45900e73f$export$41fb9f06171c75f4, filterDataAttrs.__assign({ id: id, name: name, onBlur: onBlur, "aria-label": ariaLabel, style: { width: width }, className: index$6.classNames("arc-Select-trigger", (_b = {
|
|
1197
|
+
"arc-Select-trigger--constrained": !isFluid,
|
|
1198
|
+
"arc-Select-trigger--onDarkSurface": surface === "dark",
|
|
1199
|
+
"arc-Select-trigger--invalid": errorMessage
|
|
1200
|
+
},
|
|
1201
|
+
_b["arc-Select-trigger--size".concat(selectSize && selectSize.toUpperCase())] = selectSize && selectSize !== "m",
|
|
1202
|
+
_b)) }, filterDataAttrs.filterDataAttrs(props)),
|
|
1203
|
+
React__default["default"].createElement($cc7e05a45900e73f$export$4c8d1a57a761ef94, { className: "arc-Select-triggerText", placeholder: placeholder, "aria-label": getSelectedValueName(selectedValue) }),
|
|
1204
|
+
React__default["default"].createElement($cc7e05a45900e73f$export$f04a61298a47a40f, { className: "arc-Select-triggerIcon" },
|
|
1205
|
+
React__default["default"].createElement(Icon.Icon, { icon: BtIconChevronDown2Px_esm.BtIconChevronDown2Px, size: getIconSize(selectSize) }))),
|
|
1206
|
+
React__default["default"].createElement($cc7e05a45900e73f$export$602eac185826482c, { container: arcRootElement || undefined },
|
|
1207
|
+
React__default["default"].createElement($cc7e05a45900e73f$export$7c6e2c02157bb7d2, { sideOffset: 5, position: "popper", className: index$6.classNames("arc-Select-content", {
|
|
1208
|
+
"arc-Select-content--onDarkSurface": surface === "dark"
|
|
1209
|
+
}) },
|
|
1210
|
+
React__default["default"].createElement($cc7e05a45900e73f$export$2f60d3ec9ad468f2, { className: "arc-Select-scrollButton" },
|
|
1211
|
+
React__default["default"].createElement(Icon.Icon, { icon: BtIconChevronUp2Px, size: 16 })),
|
|
1212
|
+
React__default["default"].createElement($cc7e05a45900e73f$export$d5c6c08dc2d3ca7, null, options.map(function (_a, i) {
|
|
1213
|
+
var name = _a.name, value = _a.value;
|
|
1214
|
+
return (React__default["default"].createElement($cc7e05a45900e73f$export$6d08773d2e66f8f2, { className: "arc-Select-item", key: "select-item-".concat(i), value: value },
|
|
1215
|
+
React__default["default"].createElement("div", { className: "arc-Select-itemTextWrapper" },
|
|
1216
|
+
React__default["default"].createElement($cc7e05a45900e73f$export$d6e5bf9c43ea9319, { asChild: true },
|
|
1217
|
+
React__default["default"].createElement("span", { className: "arc-Select-itemText" }, name))),
|
|
1218
|
+
React__default["default"].createElement($cc7e05a45900e73f$export$c3468e2714d175fa, null,
|
|
1219
|
+
React__default["default"].createElement(Icon.Icon, { icon: BtIconTickAlt2Px_esm.BtIconTickAlt2Px, size: 20 }))));
|
|
1220
|
+
})),
|
|
1221
|
+
React__default["default"].createElement($cc7e05a45900e73f$export$bf1aedc3039c8d63, { className: "arc-Select-scrollButton" },
|
|
1222
|
+
React__default["default"].createElement(Icon.Icon, { icon: BtIconChevronDown2Px_esm.BtIconChevronDown2Px, size: 16 }))))))));
|
|
1780
1223
|
};
|
|
1781
1224
|
|
|
1782
1225
|
exports.Select = Select;
|