@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
|
@@ -1,676 +1,50 @@
|
|
|
1
1
|
import { _ as __rest, a as __assign, f as filterDataAttrs } from '../_shared/esm/filter-data-attrs-ea8f4ed4.js';
|
|
2
2
|
import { c as classNames } from '../_shared/esm/index-2e73c2e9.js';
|
|
3
|
-
import
|
|
4
|
-
import React__default, { useContext, createContext, useEffect, forwardRef, useState, createElement, useRef, useCallback, Fragment, useMemo, useId } from 'react';
|
|
3
|
+
import React__default, { useRef, useMemo, useState, createElement, useCallback, forwardRef, Fragment, useEffect, useId, useContext } from 'react';
|
|
5
4
|
import { _ as _extends } from '../_shared/esm/extends-8cc61aad.js';
|
|
6
|
-
import
|
|
7
|
-
import { $ as $c512c27ab02ef895$export$50c7b4e9d9f19c1, a as $
|
|
8
|
-
import {
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
6
|
+
import { $ as $c512c27ab02ef895$export$50c7b4e9d9f19c1, a as $71cd76cc60e0454e$export$6f32135080cb4c3, b as $6ed0406888f73fc4$export$c7b2cbe3552a0d05, e as $8927f6f2acc4f386$export$250ffa63cdc0d034, d as $e42e1063c40fb3ef$export$b9ecd428b558ff10, h as $9f79659886946c16$export$e5c5a5f917a5871c, c as $5e63c961fc1ce211$export$8c6ed5c666ac1360, f as $b1b2314f5f9a1d84$export$25bec8c6f54ee79a } from '../_shared/esm/index-7b531fa7.js';
|
|
7
|
+
import { $ as $e02a7d9cb1dc128c$export$c74125a8e3af6bb2 } from '../_shared/esm/index-044da8d0.js';
|
|
8
|
+
import { $ as $f631663db3294ace$export$b39126d51d94e6f3 } from '../_shared/esm/index-a624de47.js';
|
|
9
|
+
import { $ as $f1701beae083dbae$export$602eac185826482c, h as hideOthers, b as $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c, a as $01b9c$RemoveScroll, c as $d3863c46a17e8a28$export$20e40289641fbbb6, d as $5cb92bef7577960e$export$177fb62ff3ec1f22 } from '../_shared/esm/Combination-e9f7e64e.js';
|
|
10
|
+
import { $ as $1746a345f3d73bb7$export$f680877a34711e37 } from '../_shared/esm/index-efa9be1a.js';
|
|
11
|
+
import { $ as $cf1ac5d9fe0e8206$export$722aac194ae923, a as $cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9, b as $cf1ac5d9fe0e8206$export$b688253958b8dfe7, c as $cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2 } from '../_shared/esm/index-b84a20c6.js';
|
|
12
|
+
import { $ as $ea1ef594cf570d83$export$439d29a4e110a164 } from '../_shared/esm/index-25a5b393.js';
|
|
9
13
|
import { B as BtIconChevronDown2Px } from '../_shared/esm/BtIconChevronDown2Px.esm-217276c2.js';
|
|
10
14
|
import { B as BtIconTickAlt2Px } from '../_shared/esm/BtIconTickAlt2Px.esm-0bc2ded0.js';
|
|
11
15
|
import { I as Icon } from '../_shared/esm/Icon-abd0d990.js';
|
|
12
|
-
import { F as FormControl } from '../_shared/esm/FormControl-
|
|
16
|
+
import { F as FormControl } from '../_shared/esm/FormControl-f0b8fe91.js';
|
|
13
17
|
import { C as Context } from '../_shared/esm/Surface-0ca6817d.js';
|
|
14
18
|
import { A as ArcRootElementContext } from '../_shared/esm/Base-f200653c.js';
|
|
19
|
+
import '../_shared/esm/index-2cfab9f2.js';
|
|
15
20
|
import '../_shared/esm/suffix-modifier-3d548e45.js';
|
|
16
21
|
import '../_shared/esm/BtIconAlert.esm-a4608d47.js';
|
|
17
22
|
import '../_shared/esm/DisclosureMini-ec17b008.js';
|
|
18
23
|
import '../_shared/esm/Text-14f586ac.js';
|
|
24
|
+
import '../_shared/esm/VisuallyHidden-b9eebf71.js';
|
|
19
25
|
|
|
20
26
|
function $ae6933e535247d3d$export$7d15b64cf5a3a4c4(value, [min, max]) {
|
|
21
27
|
return Math.min(max, Math.max(min, value));
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
current: null
|
|
36
|
-
},
|
|
37
|
-
itemMap: new Map()
|
|
38
|
-
});
|
|
39
|
-
const CollectionProvider = (props)=>{
|
|
40
|
-
const { scope: scope , children: children } = props;
|
|
41
|
-
const ref = React__default.useRef(null);
|
|
42
|
-
const itemMap = React__default.useRef(new Map()).current;
|
|
43
|
-
return /*#__PURE__*/ React__default.createElement(CollectionProviderImpl, {
|
|
44
|
-
scope: scope,
|
|
45
|
-
itemMap: itemMap,
|
|
46
|
-
collectionRef: ref
|
|
47
|
-
}, children);
|
|
48
|
-
};
|
|
49
|
-
/* -----------------------------------------------------------------------------------------------
|
|
50
|
-
* CollectionSlot
|
|
51
|
-
* ---------------------------------------------------------------------------------------------*/ const COLLECTION_SLOT_NAME = name + 'CollectionSlot';
|
|
52
|
-
const CollectionSlot = /*#__PURE__*/ React__default.forwardRef((props, forwardedRef)=>{
|
|
53
|
-
const { scope: scope , children: children } = props;
|
|
54
|
-
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
55
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.collectionRef);
|
|
56
|
-
return /*#__PURE__*/ React__default.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
57
|
-
ref: composedRefs
|
|
58
|
-
}, children);
|
|
59
|
-
});
|
|
60
|
-
/* -----------------------------------------------------------------------------------------------
|
|
61
|
-
* CollectionItem
|
|
62
|
-
* ---------------------------------------------------------------------------------------------*/ const ITEM_SLOT_NAME = name + 'CollectionItemSlot';
|
|
63
|
-
const ITEM_DATA_ATTR = 'data-radix-collection-item';
|
|
64
|
-
const CollectionItemSlot = /*#__PURE__*/ React__default.forwardRef((props, forwardedRef)=>{
|
|
65
|
-
const { scope: scope , children: children , ...itemData } = props;
|
|
66
|
-
const ref = React__default.useRef(null);
|
|
67
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
68
|
-
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
69
|
-
React__default.useEffect(()=>{
|
|
70
|
-
context.itemMap.set(ref, {
|
|
71
|
-
ref: ref,
|
|
72
|
-
...itemData
|
|
73
|
-
});
|
|
74
|
-
return ()=>void context.itemMap.delete(ref)
|
|
75
|
-
;
|
|
76
|
-
});
|
|
77
|
-
return /*#__PURE__*/ React__default.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
78
|
-
[ITEM_DATA_ATTR]: '',
|
|
79
|
-
ref: composedRefs
|
|
80
|
-
}, children);
|
|
81
|
-
});
|
|
82
|
-
/* -----------------------------------------------------------------------------------------------
|
|
83
|
-
* useCollection
|
|
84
|
-
* ---------------------------------------------------------------------------------------------*/ function useCollection(scope) {
|
|
85
|
-
const context = useCollectionContext(name + 'CollectionConsumer', scope);
|
|
86
|
-
const getItems = React__default.useCallback(()=>{
|
|
87
|
-
const collectionNode = context.collectionRef.current;
|
|
88
|
-
if (!collectionNode) return [];
|
|
89
|
-
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
90
|
-
const items = Array.from(context.itemMap.values());
|
|
91
|
-
const orderedItems = items.sort((a, b)=>orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
92
|
-
);
|
|
93
|
-
return orderedItems;
|
|
94
|
-
}, [
|
|
95
|
-
context.collectionRef,
|
|
96
|
-
context.itemMap
|
|
97
|
-
]);
|
|
98
|
-
return getItems;
|
|
99
|
-
}
|
|
100
|
-
return [
|
|
101
|
-
{
|
|
102
|
-
Provider: CollectionProvider,
|
|
103
|
-
Slot: CollectionSlot,
|
|
104
|
-
ItemSlot: CollectionItemSlot
|
|
105
|
-
},
|
|
106
|
-
useCollection,
|
|
107
|
-
createCollectionScope
|
|
108
|
-
];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const $f631663db3294ace$var$DirectionContext = /*#__PURE__*/ createContext(undefined);
|
|
112
|
-
/* -----------------------------------------------------------------------------------------------*/ function $f631663db3294ace$export$b39126d51d94e6f3(localDir) {
|
|
113
|
-
const globalDir = useContext($f631663db3294ace$var$DirectionContext);
|
|
114
|
-
return localDir || globalDir || 'ltr';
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Listens for when the escape key is down
|
|
119
|
-
*/ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
120
|
-
const onEscapeKeyDown = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEscapeKeyDownProp);
|
|
121
|
-
useEffect(()=>{
|
|
122
|
-
const handleKeyDown = (event)=>{
|
|
123
|
-
if (event.key === 'Escape') onEscapeKeyDown(event);
|
|
124
|
-
};
|
|
125
|
-
ownerDocument.addEventListener('keydown', handleKeyDown);
|
|
126
|
-
return ()=>ownerDocument.removeEventListener('keydown', handleKeyDown)
|
|
127
|
-
;
|
|
128
|
-
}, [
|
|
129
|
-
onEscapeKeyDown,
|
|
130
|
-
ownerDocument
|
|
131
|
-
]);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update';
|
|
135
|
-
const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';
|
|
136
|
-
const $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';
|
|
137
|
-
let $5cb92bef7577960e$var$originalBodyPointerEvents;
|
|
138
|
-
const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ createContext({
|
|
139
|
-
layers: new Set(),
|
|
140
|
-
layersWithOutsidePointerEventsDisabled: new Set(),
|
|
141
|
-
branches: new Set()
|
|
142
|
-
});
|
|
143
|
-
const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
144
|
-
var _node$ownerDocument;
|
|
145
|
-
const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props;
|
|
146
|
-
const context = useContext($5cb92bef7577960e$var$DismissableLayerContext);
|
|
147
|
-
const [node1, setNode] = useState(null);
|
|
148
|
-
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;
|
|
149
|
-
const [, force] = useState({});
|
|
150
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setNode(node)
|
|
151
|
-
);
|
|
152
|
-
const layers = Array.from(context.layers);
|
|
153
|
-
const [highestLayerWithOutsidePointerEventsDisabled] = [
|
|
154
|
-
...context.layersWithOutsidePointerEventsDisabled
|
|
155
|
-
].slice(-1); // prettier-ignore
|
|
156
|
-
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore
|
|
157
|
-
const index = node1 ? layers.indexOf(node1) : -1;
|
|
158
|
-
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
159
|
-
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
160
|
-
const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event)=>{
|
|
161
|
-
const target = event.target;
|
|
162
|
-
const isPointerDownOnBranch = [
|
|
163
|
-
...context.branches
|
|
164
|
-
].some((branch)=>branch.contains(target)
|
|
165
|
-
);
|
|
166
|
-
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
167
|
-
onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);
|
|
168
|
-
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
|
|
169
|
-
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
170
|
-
}, ownerDocument);
|
|
171
|
-
const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event)=>{
|
|
172
|
-
const target = event.target;
|
|
173
|
-
const isFocusInBranch = [
|
|
174
|
-
...context.branches
|
|
175
|
-
].some((branch)=>branch.contains(target)
|
|
176
|
-
);
|
|
177
|
-
if (isFocusInBranch) return;
|
|
178
|
-
onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);
|
|
179
|
-
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
|
|
180
|
-
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
181
|
-
}, ownerDocument);
|
|
182
|
-
$addc16e1bbe58fd0$export$3a72a57244d6e765((event)=>{
|
|
183
|
-
const isHighestLayer = index === context.layers.size - 1;
|
|
184
|
-
if (!isHighestLayer) return;
|
|
185
|
-
onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);
|
|
186
|
-
if (!event.defaultPrevented && onDismiss) {
|
|
187
|
-
event.preventDefault();
|
|
188
|
-
onDismiss();
|
|
189
|
-
}
|
|
190
|
-
}, ownerDocument);
|
|
191
|
-
useEffect(()=>{
|
|
192
|
-
if (!node1) return;
|
|
193
|
-
if (disableOutsidePointerEvents) {
|
|
194
|
-
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
195
|
-
$5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
196
|
-
ownerDocument.body.style.pointerEvents = 'none';
|
|
197
|
-
}
|
|
198
|
-
context.layersWithOutsidePointerEventsDisabled.add(node1);
|
|
199
|
-
}
|
|
200
|
-
context.layers.add(node1);
|
|
201
|
-
$5cb92bef7577960e$var$dispatchUpdate();
|
|
202
|
-
return ()=>{
|
|
203
|
-
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents;
|
|
204
|
-
};
|
|
205
|
-
}, [
|
|
206
|
-
node1,
|
|
207
|
-
ownerDocument,
|
|
208
|
-
disableOutsidePointerEvents,
|
|
209
|
-
context
|
|
210
|
-
]);
|
|
211
|
-
/**
|
|
212
|
-
* We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect
|
|
213
|
-
* because a change to `disableOutsidePointerEvents` would remove this layer from the stack
|
|
214
|
-
* and add it to the end again so the layering order wouldn't be _creation order_.
|
|
215
|
-
* We only want them to be removed from context stacks when unmounted.
|
|
216
|
-
*/ useEffect(()=>{
|
|
217
|
-
return ()=>{
|
|
218
|
-
if (!node1) return;
|
|
219
|
-
context.layers.delete(node1);
|
|
220
|
-
context.layersWithOutsidePointerEventsDisabled.delete(node1);
|
|
221
|
-
$5cb92bef7577960e$var$dispatchUpdate();
|
|
222
|
-
};
|
|
223
|
-
}, [
|
|
224
|
-
node1,
|
|
225
|
-
context
|
|
226
|
-
]);
|
|
227
|
-
useEffect(()=>{
|
|
228
|
-
const handleUpdate = ()=>force({})
|
|
229
|
-
;
|
|
230
|
-
document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
|
|
231
|
-
return ()=>document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate)
|
|
232
|
-
;
|
|
233
|
-
}, []);
|
|
234
|
-
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, layerProps, {
|
|
235
|
-
ref: composedRefs,
|
|
236
|
-
style: {
|
|
237
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined,
|
|
238
|
-
...props.style
|
|
239
|
-
},
|
|
240
|
-
onFocusCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
241
|
-
onBlurCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
242
|
-
onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
|
|
243
|
-
}));
|
|
244
|
-
});
|
|
245
|
-
/* -----------------------------------------------------------------------------------------------*/ /**
|
|
246
|
-
* Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`
|
|
247
|
-
* to mimic layer dismissing behaviour present in OS.
|
|
248
|
-
* Returns props to pass to the node we want to check for outside events.
|
|
249
|
-
*/ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
250
|
-
const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside);
|
|
251
|
-
const isPointerInsideReactTreeRef = useRef(false);
|
|
252
|
-
const handleClickRef = useRef(()=>{});
|
|
253
|
-
useEffect(()=>{
|
|
254
|
-
const handlePointerDown = (event)=>{
|
|
255
|
-
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
256
|
-
const eventDetail = {
|
|
257
|
-
originalEvent: event
|
|
258
|
-
};
|
|
259
|
-
function handleAndDispatchPointerDownOutsideEvent() {
|
|
260
|
-
$5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {
|
|
261
|
-
discrete: true
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* On touch devices, we need to wait for a click event because browsers implement
|
|
266
|
-
* a ~350ms delay between the time the user stops touching the display and when the
|
|
267
|
-
* browser executres events. We need to ensure we don't reactivate pointer-events within
|
|
268
|
-
* this timeframe otherwise the browser may execute events that should have been prevented.
|
|
269
|
-
*
|
|
270
|
-
* Additionally, this also lets us deal automatically with cancellations when a click event
|
|
271
|
-
* isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.
|
|
272
|
-
*
|
|
273
|
-
* This is why we also continuously remove the previous listener, because we cannot be
|
|
274
|
-
* certain that it was raised, and therefore cleaned-up.
|
|
275
|
-
*/ if (event.pointerType === 'touch') {
|
|
276
|
-
ownerDocument.removeEventListener('click', handleClickRef.current);
|
|
277
|
-
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;
|
|
278
|
-
ownerDocument.addEventListener('click', handleClickRef.current, {
|
|
279
|
-
once: true
|
|
280
|
-
});
|
|
281
|
-
} else handleAndDispatchPointerDownOutsideEvent();
|
|
282
|
-
}
|
|
283
|
-
isPointerInsideReactTreeRef.current = false;
|
|
284
|
-
};
|
|
285
|
-
/**
|
|
286
|
-
* if this hook executes in a component that mounts via a `pointerdown` event, the event
|
|
287
|
-
* would bubble up to the document and trigger a `pointerDownOutside` event. We avoid
|
|
288
|
-
* this by delaying the event listener registration on the document.
|
|
289
|
-
* This is not React specific, but rather how the DOM works, ie:
|
|
290
|
-
* ```
|
|
291
|
-
* button.addEventListener('pointerdown', () => {
|
|
292
|
-
* console.log('I will log');
|
|
293
|
-
* document.addEventListener('pointerdown', () => {
|
|
294
|
-
* console.log('I will also log');
|
|
295
|
-
* })
|
|
296
|
-
* });
|
|
297
|
-
*/ const timerId = window.setTimeout(()=>{
|
|
298
|
-
ownerDocument.addEventListener('pointerdown', handlePointerDown);
|
|
299
|
-
}, 0);
|
|
300
|
-
return ()=>{
|
|
301
|
-
window.clearTimeout(timerId);
|
|
302
|
-
ownerDocument.removeEventListener('pointerdown', handlePointerDown);
|
|
303
|
-
ownerDocument.removeEventListener('click', handleClickRef.current);
|
|
304
|
-
};
|
|
305
|
-
}, [
|
|
306
|
-
ownerDocument,
|
|
307
|
-
handlePointerDownOutside
|
|
308
|
-
]);
|
|
309
|
-
return {
|
|
310
|
-
// ensures we check React component tree (not just DOM tree)
|
|
311
|
-
onPointerDownCapture: ()=>isPointerInsideReactTreeRef.current = true
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Listens for when focus happens outside a react subtree.
|
|
316
|
-
* Returns props to pass to the root (node) of the subtree we want to check.
|
|
317
|
-
*/ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
318
|
-
const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside);
|
|
319
|
-
const isFocusInsideReactTreeRef = useRef(false);
|
|
320
|
-
useEffect(()=>{
|
|
321
|
-
const handleFocus = (event)=>{
|
|
322
|
-
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
323
|
-
const eventDetail = {
|
|
324
|
-
originalEvent: event
|
|
325
|
-
};
|
|
326
|
-
$5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
327
|
-
discrete: false
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
ownerDocument.addEventListener('focusin', handleFocus);
|
|
332
|
-
return ()=>ownerDocument.removeEventListener('focusin', handleFocus)
|
|
333
|
-
;
|
|
334
|
-
}, [
|
|
335
|
-
ownerDocument,
|
|
336
|
-
handleFocusOutside
|
|
337
|
-
]);
|
|
338
|
-
return {
|
|
339
|
-
onFocusCapture: ()=>isFocusInsideReactTreeRef.current = true
|
|
340
|
-
,
|
|
341
|
-
onBlurCapture: ()=>isFocusInsideReactTreeRef.current = false
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
function $5cb92bef7577960e$var$dispatchUpdate() {
|
|
345
|
-
const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE);
|
|
346
|
-
document.dispatchEvent(event);
|
|
347
|
-
}
|
|
348
|
-
function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detail, { discrete: discrete }) {
|
|
349
|
-
const target = detail.originalEvent.target;
|
|
350
|
-
const event = new CustomEvent(name, {
|
|
351
|
-
bubbles: false,
|
|
352
|
-
cancelable: true,
|
|
353
|
-
detail: detail
|
|
354
|
-
});
|
|
355
|
-
if (handler) target.addEventListener(name, handler, {
|
|
356
|
-
once: true
|
|
357
|
-
});
|
|
358
|
-
if (discrete) $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event);
|
|
359
|
-
else target.dispatchEvent(event);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/** Number of components which have requested interest to have focus guards */ let $3db38b7d1fb3fe6a$var$count = 0;
|
|
363
|
-
/**
|
|
364
|
-
* Injects a pair of focus guards at the edges of the whole DOM tree
|
|
365
|
-
* to ensure `focusin` & `focusout` events can be caught consistently.
|
|
366
|
-
*/ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
|
|
367
|
-
useEffect(()=>{
|
|
368
|
-
var _edgeGuards$, _edgeGuards$2;
|
|
369
|
-
const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
|
|
370
|
-
document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
371
|
-
document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
372
|
-
$3db38b7d1fb3fe6a$var$count++;
|
|
373
|
-
return ()=>{
|
|
374
|
-
if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove()
|
|
375
|
-
);
|
|
376
|
-
$3db38b7d1fb3fe6a$var$count--;
|
|
377
|
-
};
|
|
378
|
-
}, []);
|
|
379
|
-
}
|
|
380
|
-
function $3db38b7d1fb3fe6a$var$createFocusGuard() {
|
|
381
|
-
const element = document.createElement('span');
|
|
382
|
-
element.setAttribute('data-radix-focus-guard', '');
|
|
383
|
-
element.tabIndex = 0;
|
|
384
|
-
element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';
|
|
385
|
-
return element;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';
|
|
389
|
-
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';
|
|
390
|
-
const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
|
|
391
|
-
bubbles: false,
|
|
392
|
-
cancelable: true
|
|
393
|
-
};
|
|
394
|
-
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
395
|
-
const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
|
|
396
|
-
const [container1, setContainer] = useState(null);
|
|
397
|
-
const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
|
|
398
|
-
const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
|
|
399
|
-
const lastFocusedElementRef = useRef(null);
|
|
400
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node)
|
|
401
|
-
);
|
|
402
|
-
const focusScope = useRef({
|
|
403
|
-
paused: false,
|
|
404
|
-
pause () {
|
|
405
|
-
this.paused = true;
|
|
406
|
-
},
|
|
407
|
-
resume () {
|
|
408
|
-
this.paused = false;
|
|
409
|
-
}
|
|
410
|
-
}).current; // Takes care of trapping focus if focus is moved outside programmatically for example
|
|
411
|
-
useEffect(()=>{
|
|
412
|
-
if (trapped) {
|
|
413
|
-
function handleFocusIn(event) {
|
|
414
|
-
if (focusScope.paused || !container1) return;
|
|
415
|
-
const target = event.target;
|
|
416
|
-
if (container1.contains(target)) lastFocusedElementRef.current = target;
|
|
417
|
-
else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
418
|
-
select: true
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
function handleFocusOut(event) {
|
|
422
|
-
if (focusScope.paused || !container1) return;
|
|
423
|
-
if (!container1.contains(event.relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
424
|
-
select: true
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
document.addEventListener('focusin', handleFocusIn);
|
|
428
|
-
document.addEventListener('focusout', handleFocusOut);
|
|
429
|
-
return ()=>{
|
|
430
|
-
document.removeEventListener('focusin', handleFocusIn);
|
|
431
|
-
document.removeEventListener('focusout', handleFocusOut);
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
}, [
|
|
435
|
-
trapped,
|
|
436
|
-
container1,
|
|
437
|
-
focusScope.paused
|
|
438
|
-
]);
|
|
439
|
-
useEffect(()=>{
|
|
440
|
-
if (container1) {
|
|
441
|
-
$d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
|
|
442
|
-
const previouslyFocusedElement = document.activeElement;
|
|
443
|
-
const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
|
|
444
|
-
if (!hasFocusedCandidate) {
|
|
445
|
-
const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
446
|
-
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
447
|
-
container1.dispatchEvent(mountEvent);
|
|
448
|
-
if (!mountEvent.defaultPrevented) {
|
|
449
|
-
$d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {
|
|
450
|
-
select: true
|
|
451
|
-
});
|
|
452
|
-
if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
return ()=>{
|
|
456
|
-
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.
|
|
457
|
-
// We need to delay the focus a little to get around it for now.
|
|
458
|
-
// See: https://github.com/facebook/react/issues/17894
|
|
459
|
-
setTimeout(()=>{
|
|
460
|
-
const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
461
|
-
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
462
|
-
container1.dispatchEvent(unmountEvent);
|
|
463
|
-
if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
|
|
464
|
-
select: true
|
|
465
|
-
});
|
|
466
|
-
// we need to remove the listener after we `dispatchEvent`
|
|
467
|
-
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
468
|
-
$d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);
|
|
469
|
-
}, 0);
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
}, [
|
|
473
|
-
container1,
|
|
474
|
-
onMountAutoFocus,
|
|
475
|
-
onUnmountAutoFocus,
|
|
476
|
-
focusScope
|
|
477
|
-
]); // Takes care of looping focus (when tabbing whilst at the edges)
|
|
478
|
-
const handleKeyDown = useCallback((event)=>{
|
|
479
|
-
if (!loop && !trapped) return;
|
|
480
|
-
if (focusScope.paused) return;
|
|
481
|
-
const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
482
|
-
const focusedElement = document.activeElement;
|
|
483
|
-
if (isTabKey && focusedElement) {
|
|
484
|
-
const container = event.currentTarget;
|
|
485
|
-
const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);
|
|
486
|
-
const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges
|
|
487
|
-
if (!hasTabbableElementsInside) {
|
|
488
|
-
if (focusedElement === container) event.preventDefault();
|
|
489
|
-
} else {
|
|
490
|
-
if (!event.shiftKey && focusedElement === last) {
|
|
491
|
-
event.preventDefault();
|
|
492
|
-
if (loop) $d3863c46a17e8a28$var$focus(first, {
|
|
493
|
-
select: true
|
|
494
|
-
});
|
|
495
|
-
} else if (event.shiftKey && focusedElement === first) {
|
|
496
|
-
event.preventDefault();
|
|
497
|
-
if (loop) $d3863c46a17e8a28$var$focus(last, {
|
|
498
|
-
select: true
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
}, [
|
|
504
|
-
loop,
|
|
505
|
-
trapped,
|
|
506
|
-
focusScope.paused
|
|
507
|
-
]);
|
|
508
|
-
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
509
|
-
tabIndex: -1
|
|
510
|
-
}, scopeProps, {
|
|
511
|
-
ref: composedRefs,
|
|
512
|
-
onKeyDown: handleKeyDown
|
|
513
|
-
}));
|
|
514
|
-
});
|
|
515
|
-
/* -------------------------------------------------------------------------------------------------
|
|
516
|
-
* Utils
|
|
517
|
-
* -----------------------------------------------------------------------------------------------*/ /**
|
|
518
|
-
* Attempts focusing the first element in a list of candidates.
|
|
519
|
-
* Stops when focus has actually moved.
|
|
520
|
-
*/ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {
|
|
521
|
-
const previouslyFocusedElement = document.activeElement;
|
|
522
|
-
for (const candidate of candidates){
|
|
523
|
-
$d3863c46a17e8a28$var$focus(candidate, {
|
|
524
|
-
select: select
|
|
525
|
-
});
|
|
526
|
-
if (document.activeElement !== previouslyFocusedElement) return;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* Returns the first and last tabbable elements inside a container.
|
|
531
|
-
*/ function $d3863c46a17e8a28$var$getTabbableEdges(container) {
|
|
532
|
-
const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);
|
|
533
|
-
const first = $d3863c46a17e8a28$var$findVisible(candidates, container);
|
|
534
|
-
const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);
|
|
535
|
-
return [
|
|
536
|
-
first,
|
|
537
|
-
last
|
|
538
|
-
];
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* Returns a list of potential tabbable candidates.
|
|
542
|
-
*
|
|
543
|
-
* NOTE: This is only a close approximation. For example it doesn't take into account cases like when
|
|
544
|
-
* elements are not visible. This cannot be worked out easily by just reading a property, but rather
|
|
545
|
-
* necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
|
|
546
|
-
*
|
|
547
|
-
* See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
|
|
548
|
-
* Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
|
|
549
|
-
*/ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {
|
|
550
|
-
const nodes = [];
|
|
551
|
-
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
552
|
-
acceptNode: (node)=>{
|
|
553
|
-
const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
|
|
554
|
-
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
|
|
555
|
-
// runtime's understanding of tabbability, so this automatically accounts
|
|
556
|
-
// for any kind of element that could be tabbed to.
|
|
557
|
-
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
558
|
-
}
|
|
559
|
-
});
|
|
560
|
-
while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
|
|
561
|
-
// hinders accessibility to have tab order different from visual order.
|
|
562
|
-
return nodes;
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* Returns the first visible element in a list.
|
|
566
|
-
* NOTE: Only checks visibility up to the `container`.
|
|
567
|
-
*/ function $d3863c46a17e8a28$var$findVisible(elements, container) {
|
|
568
|
-
for (const element of elements){
|
|
569
|
-
// we stop checking if it's hidden at the `container` level (excluding)
|
|
570
|
-
if (!$d3863c46a17e8a28$var$isHidden(element, {
|
|
571
|
-
upTo: container
|
|
572
|
-
})) return element;
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
function $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {
|
|
576
|
-
if (getComputedStyle(node).visibility === 'hidden') return true;
|
|
577
|
-
while(node){
|
|
578
|
-
// we stop at `upTo` (excluding it)
|
|
579
|
-
if (upTo !== undefined && node === upTo) return false;
|
|
580
|
-
if (getComputedStyle(node).display === 'none') return true;
|
|
581
|
-
node = node.parentElement;
|
|
582
|
-
}
|
|
583
|
-
return false;
|
|
584
|
-
}
|
|
585
|
-
function $d3863c46a17e8a28$var$isSelectableInput(element) {
|
|
586
|
-
return element instanceof HTMLInputElement && 'select' in element;
|
|
587
|
-
}
|
|
588
|
-
function $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {
|
|
589
|
-
// only focus if that element is focusable
|
|
590
|
-
if (element && element.focus) {
|
|
591
|
-
const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users
|
|
592
|
-
element.focus({
|
|
593
|
-
preventScroll: true
|
|
594
|
-
}); // only select if its not the same element, it supports selection and we need to select
|
|
595
|
-
if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
/* -------------------------------------------------------------------------------------------------
|
|
599
|
-
* FocusScope stack
|
|
600
|
-
* -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();
|
|
601
|
-
function $d3863c46a17e8a28$var$createFocusScopesStack() {
|
|
602
|
-
/** A stack of focus scopes, with the active one at the top */ let stack = [];
|
|
603
|
-
return {
|
|
604
|
-
add (focusScope) {
|
|
605
|
-
// pause the currently active focus scope (at the top of the stack)
|
|
606
|
-
const activeFocusScope = stack[0];
|
|
607
|
-
if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
|
|
608
|
-
// remove in case it already exists (because we'll re-add it at the top of the stack)
|
|
609
|
-
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
610
|
-
stack.unshift(focusScope);
|
|
611
|
-
},
|
|
612
|
-
remove (focusScope) {
|
|
613
|
-
var _stack$;
|
|
614
|
-
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
615
|
-
(_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
|
|
30
|
+
function $010c2913dbd2fe3d$export$5cae361ad82dce8b(value) {
|
|
31
|
+
const ref = useRef({
|
|
32
|
+
value: value,
|
|
33
|
+
previous: value
|
|
34
|
+
}); // We compare values before making an update to ensure that
|
|
35
|
+
// a change has been made. This ensures the previous value is
|
|
36
|
+
// persisted correctly between renders.
|
|
37
|
+
return useMemo(()=>{
|
|
38
|
+
if (ref.current.value !== value) {
|
|
39
|
+
ref.current.previous = ref.current.value;
|
|
40
|
+
ref.current.value = value;
|
|
616
41
|
}
|
|
617
|
-
|
|
618
|
-
}
|
|
619
|
-
function $d3863c46a17e8a28$var$arrayRemove(array, item) {
|
|
620
|
-
const updatedArray = [
|
|
621
|
-
...array
|
|
622
|
-
];
|
|
623
|
-
const index = updatedArray.indexOf(item);
|
|
624
|
-
if (index !== -1) updatedArray.splice(index, 1);
|
|
625
|
-
return updatedArray;
|
|
626
|
-
}
|
|
627
|
-
function $d3863c46a17e8a28$var$removeLinks(items) {
|
|
628
|
-
return items.filter((item)=>item.tagName !== 'A'
|
|
629
|
-
);
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
const $1746a345f3d73bb7$var$useReactId = React['useId'.toString()] || (()=>undefined
|
|
633
|
-
);
|
|
634
|
-
let $1746a345f3d73bb7$var$count = 0;
|
|
635
|
-
function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
636
|
-
const [id, setId] = React.useState($1746a345f3d73bb7$var$useReactId()); // React versions older than 18 will have client-side ids only.
|
|
637
|
-
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
638
|
-
if (!deterministicId) setId((reactId)=>reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
|
|
639
|
-
);
|
|
42
|
+
return ref.current.previous;
|
|
640
43
|
}, [
|
|
641
|
-
|
|
44
|
+
value
|
|
642
45
|
]);
|
|
643
|
-
return deterministicId || (id ? `radix-${id}` : '');
|
|
644
46
|
}
|
|
645
47
|
|
|
646
|
-
const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
647
|
-
var _globalThis$document;
|
|
648
|
-
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;
|
|
649
|
-
return container ? /*#__PURE__*/ $7SXl2$reactdom.createPortal(/*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, portalProps, {
|
|
650
|
-
ref: forwardedRef
|
|
651
|
-
})), container) : null;
|
|
652
|
-
});
|
|
653
|
-
|
|
654
|
-
const $ea1ef594cf570d83$export$439d29a4e110a164 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
655
|
-
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, props, {
|
|
656
|
-
ref: forwardedRef,
|
|
657
|
-
style: {
|
|
658
|
-
// See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
|
|
659
|
-
position: 'absolute',
|
|
660
|
-
border: 0,
|
|
661
|
-
width: 1,
|
|
662
|
-
height: 1,
|
|
663
|
-
padding: 0,
|
|
664
|
-
margin: -1,
|
|
665
|
-
overflow: 'hidden',
|
|
666
|
-
clip: 'rect(0, 0, 0, 0)',
|
|
667
|
-
whiteSpace: 'nowrap',
|
|
668
|
-
wordWrap: 'normal',
|
|
669
|
-
...props.style
|
|
670
|
-
}
|
|
671
|
-
}));
|
|
672
|
-
});
|
|
673
|
-
|
|
674
48
|
const $cc7e05a45900e73f$var$OPEN_KEYS = [
|
|
675
49
|
' ',
|
|
676
50
|
'Enter',
|
|
@@ -686,12 +60,15 @@ const $cc7e05a45900e73f$var$SELECTION_KEYS = [
|
|
|
686
60
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SELECT_NAME = 'Select';
|
|
687
61
|
const [$cc7e05a45900e73f$var$Collection, $cc7e05a45900e73f$var$useCollection, $cc7e05a45900e73f$var$createCollectionScope] = $e02a7d9cb1dc128c$export$c74125a8e3af6bb2($cc7e05a45900e73f$var$SELECT_NAME);
|
|
688
62
|
const [$cc7e05a45900e73f$var$createSelectContext, $cc7e05a45900e73f$export$286727a75dc039bd] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($cc7e05a45900e73f$var$SELECT_NAME, [
|
|
689
|
-
$cc7e05a45900e73f$var$createCollectionScope
|
|
63
|
+
$cc7e05a45900e73f$var$createCollectionScope,
|
|
64
|
+
$cf1ac5d9fe0e8206$export$722aac194ae923
|
|
690
65
|
]);
|
|
66
|
+
const $cc7e05a45900e73f$var$usePopperScope = $cf1ac5d9fe0e8206$export$722aac194ae923();
|
|
691
67
|
const [$cc7e05a45900e73f$var$SelectProvider, $cc7e05a45900e73f$var$useSelectContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$SELECT_NAME);
|
|
692
68
|
const [$cc7e05a45900e73f$var$SelectNativeOptionsProvider, $cc7e05a45900e73f$var$useSelectNativeOptionsContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$SELECT_NAME);
|
|
693
69
|
const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
694
70
|
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;
|
|
71
|
+
const popperScope = $cc7e05a45900e73f$var$usePopperScope(__scopeSelect);
|
|
695
72
|
const [trigger, setTrigger] = useState(null);
|
|
696
73
|
const [valueNode, setValueNode] = useState(null);
|
|
697
74
|
const [valueNodeHasChildren, setValueNodeHasChildren] = useState(false);
|
|
@@ -715,7 +92,7 @@ const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
|
715
92
|
// each time the options change.
|
|
716
93
|
const nativeSelectKey = Array.from(nativeOptionsSet).map((option)=>option.props.value
|
|
717
94
|
).join(';');
|
|
718
|
-
return /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectProvider, {
|
|
95
|
+
return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9, popperScope, /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectProvider, {
|
|
719
96
|
required: required,
|
|
720
97
|
scope: __scopeSelect,
|
|
721
98
|
trigger: trigger,
|
|
@@ -761,13 +138,14 @@ const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
|
761
138
|
disabled: disabled
|
|
762
139
|
}, value === undefined ? /*#__PURE__*/ createElement("option", {
|
|
763
140
|
value: ""
|
|
764
|
-
}) : null, Array.from(nativeOptionsSet)) : null);
|
|
141
|
+
}) : null, Array.from(nativeOptionsSet)) : null));
|
|
765
142
|
};
|
|
766
143
|
/* -------------------------------------------------------------------------------------------------
|
|
767
144
|
* SelectTrigger
|
|
768
145
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$TRIGGER_NAME = 'SelectTrigger';
|
|
769
146
|
const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
770
147
|
const { __scopeSelect: __scopeSelect , disabled: disabled = false , ...triggerProps } = props;
|
|
148
|
+
const popperScope = $cc7e05a45900e73f$var$usePopperScope(__scopeSelect);
|
|
771
149
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$TRIGGER_NAME, __scopeSelect);
|
|
772
150
|
const isDisabled = context.disabled || disabled;
|
|
773
151
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.onTriggerChange);
|
|
@@ -786,7 +164,9 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ forwardRef((props
|
|
|
786
164
|
resetTypeahead();
|
|
787
165
|
}
|
|
788
166
|
};
|
|
789
|
-
return /*#__PURE__*/ createElement($
|
|
167
|
+
return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$export$b688253958b8dfe7, _extends({
|
|
168
|
+
asChild: true
|
|
169
|
+
}, popperScope), /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
|
|
790
170
|
type: "button",
|
|
791
171
|
role: "combobox",
|
|
792
172
|
"aria-controls": context.contentId,
|
|
@@ -797,7 +177,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ forwardRef((props
|
|
|
797
177
|
"data-state": context.open ? 'open' : 'closed',
|
|
798
178
|
disabled: isDisabled,
|
|
799
179
|
"data-disabled": isDisabled ? '' : undefined,
|
|
800
|
-
"data-placeholder": context.value
|
|
180
|
+
"data-placeholder": $cc7e05a45900e73f$var$shouldShowPlaceholder(context.value) ? '' : undefined
|
|
801
181
|
}, triggerProps, {
|
|
802
182
|
ref: composedRefs // Enable compatibility with native label or custom `Label` "click" for Safari:
|
|
803
183
|
,
|
|
@@ -835,14 +215,14 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ forwardRef((props
|
|
|
835
215
|
event.preventDefault();
|
|
836
216
|
}
|
|
837
217
|
})
|
|
838
|
-
}));
|
|
218
|
+
})));
|
|
839
219
|
});
|
|
840
220
|
/* -------------------------------------------------------------------------------------------------
|
|
841
221
|
* SelectValue
|
|
842
222
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$VALUE_NAME = 'SelectValue';
|
|
843
223
|
const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
844
224
|
// We ignore `className` and `style` as this part shouldn't be styled.
|
|
845
|
-
const { __scopeSelect: __scopeSelect , className: className , style: style , children: children , placeholder: placeholder , ...valueProps } = props;
|
|
225
|
+
const { __scopeSelect: __scopeSelect , className: className , style: style , children: children , placeholder: placeholder = '' , ...valueProps } = props;
|
|
846
226
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$VALUE_NAME, __scopeSelect);
|
|
847
227
|
const { onValueNodeHasChildrenChange: onValueNodeHasChildrenChange } = context;
|
|
848
228
|
const hasChildren = children !== undefined;
|
|
@@ -859,7 +239,7 @@ const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ forwardRef((prop
|
|
|
859
239
|
style: {
|
|
860
240
|
pointerEvents: 'none'
|
|
861
241
|
}
|
|
862
|
-
}), context.value
|
|
242
|
+
}), $cc7e05a45900e73f$var$shouldShowPlaceholder(context.value) ? /*#__PURE__*/ createElement(Fragment, null, placeholder) : children);
|
|
863
243
|
});
|
|
864
244
|
const $cc7e05a45900e73f$export$99b400cabb58c515 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
865
245
|
const { __scopeSelect: __scopeSelect , children: children , ...iconProps } = props;
|
|
@@ -883,20 +263,28 @@ const $cc7e05a45900e73f$export$c973a4b3cb86a03d = /*#__PURE__*/ forwardRef((prop
|
|
|
883
263
|
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
884
264
|
setFragment(new DocumentFragment());
|
|
885
265
|
}, []);
|
|
886
|
-
|
|
266
|
+
if (!context.open) {
|
|
267
|
+
const frag = fragment;
|
|
268
|
+
return frag ? /*#__PURE__*/ createPortal(/*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectContentProvider, {
|
|
269
|
+
scope: props.__scopeSelect
|
|
270
|
+
}, /*#__PURE__*/ createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
271
|
+
scope: props.__scopeSelect
|
|
272
|
+
}, /*#__PURE__*/ createElement("div", null, props.children))), frag) : null;
|
|
273
|
+
}
|
|
274
|
+
return /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectContentImpl, _extends({}, props, {
|
|
887
275
|
ref: forwardedRef
|
|
888
|
-
}))
|
|
889
|
-
scope: props.__scopeSelect
|
|
890
|
-
}, /*#__PURE__*/ createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
891
|
-
scope: props.__scopeSelect
|
|
892
|
-
}, /*#__PURE__*/ createElement("div", null, props.children))), fragment) : null);
|
|
276
|
+
}));
|
|
893
277
|
});
|
|
894
|
-
|
|
278
|
+
/* -------------------------------------------------------------------------------------------------
|
|
279
|
+
* SelectContentImpl
|
|
280
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$CONTENT_MARGIN = 10;
|
|
895
281
|
const [$cc7e05a45900e73f$var$SelectContentProvider, $cc7e05a45900e73f$var$useSelectContentContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$CONTENT_NAME);
|
|
896
282
|
const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
897
|
-
const { __scopeSelect: __scopeSelect , onCloseAutoFocus: onCloseAutoFocus ,
|
|
283
|
+
const { __scopeSelect: __scopeSelect , position: position = 'item-aligned' , onCloseAutoFocus: onCloseAutoFocus , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , side: //
|
|
284
|
+
// PopperContent props
|
|
285
|
+
side , sideOffset: sideOffset , align: align , alignOffset: alignOffset , arrowPadding: arrowPadding , collisionBoundary: collisionBoundary , collisionPadding: collisionPadding , sticky: sticky , hideWhenDetached: hideWhenDetached , avoidCollisions: avoidCollisions , //
|
|
286
|
+
...contentProps } = props;
|
|
898
287
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, __scopeSelect);
|
|
899
|
-
const [contentWrapper, setContentWrapper] = useState(null);
|
|
900
288
|
const [content, setContent] = useState(null);
|
|
901
289
|
const [viewport, setViewport] = useState(null);
|
|
902
290
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContent(node)
|
|
@@ -905,8 +293,6 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
905
293
|
const [selectedItemText, setSelectedItemText] = useState(null);
|
|
906
294
|
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
907
295
|
const [isPositioned, setIsPositioned] = useState(false);
|
|
908
|
-
const shouldRepositionRef = useRef(true);
|
|
909
|
-
const shouldExpandOnScrollRef = useRef(false);
|
|
910
296
|
const firstValidItemFoundRef = useRef(false); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
|
|
911
297
|
useEffect(()=>{
|
|
912
298
|
if (content) return hideOthers(content);
|
|
@@ -915,12 +301,6 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
915
301
|
]); // Make sure the whole tree has focus guards as our `Select` may be
|
|
916
302
|
// the last element in the DOM (because of the `Portal`)
|
|
917
303
|
$3db38b7d1fb3fe6a$export$b7ece24a22aeda8c();
|
|
918
|
-
const [contentZIndex, setContentZIndex] = useState();
|
|
919
|
-
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
920
|
-
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
921
|
-
}, [
|
|
922
|
-
content
|
|
923
|
-
]);
|
|
924
304
|
const focusFirst = useCallback((candidates)=>{
|
|
925
305
|
const [firstItem, ...restItems] = getItems().map((item)=>item.ref.current
|
|
926
306
|
);
|
|
@@ -941,101 +321,6 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
941
321
|
getItems,
|
|
942
322
|
viewport
|
|
943
323
|
]);
|
|
944
|
-
const position = useCallback(()=>{
|
|
945
|
-
if (context.trigger && context.valueNode && contentWrapper && content && viewport && selectedItem && selectedItemText) {
|
|
946
|
-
const triggerRect = context.trigger.getBoundingClientRect(); // -----------------------------------------------------------------------------------------
|
|
947
|
-
// Horizontal positioning
|
|
948
|
-
// -----------------------------------------------------------------------------------------
|
|
949
|
-
const contentRect = content.getBoundingClientRect();
|
|
950
|
-
const valueNodeRect = context.valueNode.getBoundingClientRect();
|
|
951
|
-
const itemTextRect = selectedItemText.getBoundingClientRect();
|
|
952
|
-
if (context.dir !== 'rtl') {
|
|
953
|
-
const itemTextOffset = itemTextRect.left - contentRect.left;
|
|
954
|
-
const left = valueNodeRect.left - itemTextOffset;
|
|
955
|
-
const leftDelta = triggerRect.left - left;
|
|
956
|
-
const minContentWidth = triggerRect.width + leftDelta;
|
|
957
|
-
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
958
|
-
const rightEdge = window.innerWidth - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
959
|
-
const clampedLeft = $ae6933e535247d3d$export$7d15b64cf5a3a4c4(left, [
|
|
960
|
-
$cc7e05a45900e73f$var$CONTENT_MARGIN,
|
|
961
|
-
rightEdge - contentWidth
|
|
962
|
-
]);
|
|
963
|
-
contentWrapper.style.minWidth = minContentWidth + 'px';
|
|
964
|
-
contentWrapper.style.left = clampedLeft + 'px';
|
|
965
|
-
} else {
|
|
966
|
-
const itemTextOffset = contentRect.right - itemTextRect.right;
|
|
967
|
-
const right = window.innerWidth - valueNodeRect.right - itemTextOffset;
|
|
968
|
-
const rightDelta = window.innerWidth - triggerRect.right - right;
|
|
969
|
-
const minContentWidth = triggerRect.width + rightDelta;
|
|
970
|
-
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
971
|
-
const leftEdge = window.innerWidth - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
972
|
-
const clampedRight = $ae6933e535247d3d$export$7d15b64cf5a3a4c4(right, [
|
|
973
|
-
$cc7e05a45900e73f$var$CONTENT_MARGIN,
|
|
974
|
-
leftEdge - contentWidth
|
|
975
|
-
]);
|
|
976
|
-
contentWrapper.style.minWidth = minContentWidth + 'px';
|
|
977
|
-
contentWrapper.style.right = clampedRight + 'px';
|
|
978
|
-
} // -----------------------------------------------------------------------------------------
|
|
979
|
-
// Vertical positioning
|
|
980
|
-
// -----------------------------------------------------------------------------------------
|
|
981
|
-
const items = getItems();
|
|
982
|
-
const availableHeight = window.innerHeight - $cc7e05a45900e73f$var$CONTENT_MARGIN * 2;
|
|
983
|
-
const itemsHeight = viewport.scrollHeight;
|
|
984
|
-
const contentStyles = window.getComputedStyle(content);
|
|
985
|
-
const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10);
|
|
986
|
-
const contentPaddingTop = parseInt(contentStyles.paddingTop, 10);
|
|
987
|
-
const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10);
|
|
988
|
-
const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10);
|
|
989
|
-
const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth; // prettier-ignore
|
|
990
|
-
const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight);
|
|
991
|
-
const viewportStyles = window.getComputedStyle(viewport);
|
|
992
|
-
const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10);
|
|
993
|
-
const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10);
|
|
994
|
-
const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
995
|
-
const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;
|
|
996
|
-
const selectedItemHalfHeight = selectedItem.offsetHeight / 2;
|
|
997
|
-
const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight;
|
|
998
|
-
const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;
|
|
999
|
-
const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;
|
|
1000
|
-
const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle;
|
|
1001
|
-
if (willAlignWithoutTopOverflow) {
|
|
1002
|
-
const isLastItem = selectedItem === items[items.length - 1].ref.current;
|
|
1003
|
-
contentWrapper.style.bottom = "0px";
|
|
1004
|
-
const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;
|
|
1005
|
-
const clampedTriggerMiddleToBottomEdge = Math.max(triggerMiddleToBottomEdge, selectedItemHalfHeight + (isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth);
|
|
1006
|
-
const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge;
|
|
1007
|
-
contentWrapper.style.height = height + 'px';
|
|
1008
|
-
} else {
|
|
1009
|
-
const isFirstItem = selectedItem === items[0].ref.current;
|
|
1010
|
-
contentWrapper.style.top = "0px";
|
|
1011
|
-
const clampedTopEdgeToTriggerMiddle = Math.max(topEdgeToTriggerMiddle, contentBorderTopWidth + viewport.offsetTop + (isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight);
|
|
1012
|
-
const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom;
|
|
1013
|
-
contentWrapper.style.height = height + 'px';
|
|
1014
|
-
viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop;
|
|
1015
|
-
}
|
|
1016
|
-
contentWrapper.style.margin = `${$cc7e05a45900e73f$var$CONTENT_MARGIN}px 0`;
|
|
1017
|
-
contentWrapper.style.minHeight = minContentHeight + 'px';
|
|
1018
|
-
contentWrapper.style.maxHeight = availableHeight + 'px'; // -----------------------------------------------------------------------------------------
|
|
1019
|
-
setIsPositioned(true); // we don't want the initial scroll position adjustment to trigger "expand on scroll"
|
|
1020
|
-
// so we explicitly turn it on only after they've registered.
|
|
1021
|
-
requestAnimationFrame(()=>shouldExpandOnScrollRef.current = true
|
|
1022
|
-
);
|
|
1023
|
-
}
|
|
1024
|
-
}, [
|
|
1025
|
-
getItems,
|
|
1026
|
-
context.trigger,
|
|
1027
|
-
context.valueNode,
|
|
1028
|
-
contentWrapper,
|
|
1029
|
-
content,
|
|
1030
|
-
viewport,
|
|
1031
|
-
selectedItem,
|
|
1032
|
-
selectedItemText,
|
|
1033
|
-
context.dir
|
|
1034
|
-
]);
|
|
1035
|
-
$9f79659886946c16$export$e5c5a5f917a5871c(()=>position()
|
|
1036
|
-
, [
|
|
1037
|
-
position
|
|
1038
|
-
]);
|
|
1039
324
|
const focusSelectedItem = useCallback(()=>focusFirst([
|
|
1040
325
|
selectedItem,
|
|
1041
326
|
content
|
|
@@ -1051,19 +336,6 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
1051
336
|
}, [
|
|
1052
337
|
isPositioned,
|
|
1053
338
|
focusSelectedItem
|
|
1054
|
-
]); // When the viewport becomes scrollable at the top, the scroll up button will mount.
|
|
1055
|
-
// Because it is part of the normal flow, it will push down the viewport, thus throwing our
|
|
1056
|
-
// trigger => selectedItem alignment off by the amount the viewport was pushed down.
|
|
1057
|
-
// We wait for this to happen and then re-run the positining logic one more time to account for it.
|
|
1058
|
-
const handleScrollButtonChange = useCallback((node)=>{
|
|
1059
|
-
if (node && shouldRepositionRef.current === true) {
|
|
1060
|
-
position();
|
|
1061
|
-
focusSelectedItem();
|
|
1062
|
-
shouldRepositionRef.current = false;
|
|
1063
|
-
}
|
|
1064
|
-
}, [
|
|
1065
|
-
position,
|
|
1066
|
-
focusSelectedItem
|
|
1067
339
|
]); // prevent selecting items on `pointerup` in some cases after opening from `pointerdown`
|
|
1068
340
|
// and close on `pointerup` outside.
|
|
1069
341
|
const { onOpenChange: onOpenChange , triggerPointerDownPosRef: triggerPointerDownPosRef } = context;
|
|
@@ -1152,9 +424,21 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
1152
424
|
}, [
|
|
1153
425
|
context.value
|
|
1154
426
|
]);
|
|
427
|
+
const SelectPosition = position === 'popper' ? $cc7e05a45900e73f$var$SelectPopperPosition : $cc7e05a45900e73f$var$SelectItemAlignedPosition; // Silently ignore props that are not supported by `SelectItemAlignedPosition`
|
|
428
|
+
const popperContentProps = SelectPosition === $cc7e05a45900e73f$var$SelectPopperPosition ? {
|
|
429
|
+
side: side,
|
|
430
|
+
sideOffset: sideOffset,
|
|
431
|
+
align: align,
|
|
432
|
+
alignOffset: alignOffset,
|
|
433
|
+
arrowPadding: arrowPadding,
|
|
434
|
+
collisionBoundary: collisionBoundary,
|
|
435
|
+
collisionPadding: collisionPadding,
|
|
436
|
+
sticky: sticky,
|
|
437
|
+
hideWhenDetached: hideWhenDetached,
|
|
438
|
+
avoidCollisions: avoidCollisions
|
|
439
|
+
} : {};
|
|
1155
440
|
return /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectContentProvider, {
|
|
1156
441
|
scope: __scopeSelect,
|
|
1157
|
-
contentWrapper: contentWrapper,
|
|
1158
442
|
content: content,
|
|
1159
443
|
viewport: viewport,
|
|
1160
444
|
onViewportChange: setViewport,
|
|
@@ -1162,22 +446,14 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
1162
446
|
selectedItem: selectedItem,
|
|
1163
447
|
onItemLeave: handleItemLeave,
|
|
1164
448
|
itemTextRefCallback: itemTextRefCallback,
|
|
449
|
+
focusSelectedItem: focusSelectedItem,
|
|
1165
450
|
selectedItemText: selectedItemText,
|
|
1166
|
-
|
|
451
|
+
position: position,
|
|
1167
452
|
isPositioned: isPositioned,
|
|
1168
|
-
shouldExpandOnScrollRef: shouldExpandOnScrollRef,
|
|
1169
453
|
searchRef: searchRef
|
|
1170
454
|
}, /*#__PURE__*/ createElement($01b9c$RemoveScroll, {
|
|
1171
455
|
as: $5e63c961fc1ce211$export$8c6ed5c666ac1360,
|
|
1172
456
|
allowPinchZoom: true
|
|
1173
|
-
}, /*#__PURE__*/ createElement("div", {
|
|
1174
|
-
ref: setContentWrapper,
|
|
1175
|
-
style: {
|
|
1176
|
-
display: 'flex',
|
|
1177
|
-
flexDirection: 'column',
|
|
1178
|
-
position: 'fixed',
|
|
1179
|
-
zIndex: contentZIndex
|
|
1180
|
-
}
|
|
1181
457
|
}, /*#__PURE__*/ createElement($d3863c46a17e8a28$export$20e40289641fbbb6, {
|
|
1182
458
|
asChild: true // we make sure we're not trapping once it's been closed
|
|
1183
459
|
,
|
|
@@ -1193,30 +469,33 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
1193
469
|
});
|
|
1194
470
|
event.preventDefault();
|
|
1195
471
|
})
|
|
1196
|
-
}, /*#__PURE__*/ createElement($5cb92bef7577960e$export$177fb62ff3ec1f22,
|
|
472
|
+
}, /*#__PURE__*/ createElement($5cb92bef7577960e$export$177fb62ff3ec1f22, {
|
|
473
|
+
asChild: true,
|
|
474
|
+
disableOutsidePointerEvents: true,
|
|
475
|
+
onEscapeKeyDown: onEscapeKeyDown,
|
|
476
|
+
onPointerDownOutside: onPointerDownOutside // When focus is trapped, a focusout event may still happen.
|
|
477
|
+
,
|
|
478
|
+
onFocusOutside: (event)=>event.preventDefault()
|
|
479
|
+
,
|
|
480
|
+
onDismiss: ()=>context.onOpenChange(false)
|
|
481
|
+
}, /*#__PURE__*/ createElement(SelectPosition, _extends({
|
|
1197
482
|
role: "listbox",
|
|
1198
483
|
id: context.contentId,
|
|
1199
484
|
"data-state": context.open ? 'open' : 'closed',
|
|
1200
485
|
dir: context.dir,
|
|
1201
486
|
onContextMenu: (event)=>event.preventDefault()
|
|
1202
|
-
}, contentProps, {
|
|
487
|
+
}, contentProps, popperContentProps, {
|
|
488
|
+
onPlaced: ()=>setIsPositioned(true)
|
|
489
|
+
,
|
|
1203
490
|
ref: composedRefs,
|
|
1204
491
|
style: {
|
|
492
|
+
// flex layout so we can place the scroll buttons properly
|
|
1205
493
|
display: 'flex',
|
|
1206
494
|
flexDirection: 'column',
|
|
1207
|
-
//
|
|
1208
|
-
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
1209
|
-
boxSizing: 'border-box',
|
|
1210
|
-
maxHeight: '100%',
|
|
495
|
+
// reset the outline by default as the content MAY get focused
|
|
1211
496
|
outline: 'none',
|
|
1212
497
|
...contentProps.style
|
|
1213
498
|
},
|
|
1214
|
-
disableOutsidePointerEvents: true // When focus is trapped, a focusout event may still happen.
|
|
1215
|
-
,
|
|
1216
|
-
onFocusOutside: (event)=>event.preventDefault()
|
|
1217
|
-
,
|
|
1218
|
-
onDismiss: ()=>context.onOpenChange(false)
|
|
1219
|
-
,
|
|
1220
499
|
onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(contentProps.onKeyDown, (event)=>{
|
|
1221
500
|
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey; // select should not be navigated using tab key so we prevent it
|
|
1222
501
|
if (event.key === 'Tab') event.preventDefault();
|
|
@@ -1253,12 +532,185 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
1253
532
|
})
|
|
1254
533
|
}))))));
|
|
1255
534
|
});
|
|
535
|
+
const $cc7e05a45900e73f$var$SelectItemAlignedPosition = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
536
|
+
const { __scopeSelect: __scopeSelect , onPlaced: onPlaced , ...popperProps } = props;
|
|
537
|
+
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, __scopeSelect);
|
|
538
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$CONTENT_NAME, __scopeSelect);
|
|
539
|
+
const [contentWrapper, setContentWrapper] = useState(null);
|
|
540
|
+
const [content, setContent] = useState(null);
|
|
541
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContent(node)
|
|
542
|
+
);
|
|
543
|
+
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
544
|
+
const shouldExpandOnScrollRef = useRef(false);
|
|
545
|
+
const shouldRepositionRef = useRef(true);
|
|
546
|
+
const { viewport: viewport , selectedItem: selectedItem , selectedItemText: selectedItemText , focusSelectedItem: focusSelectedItem } = contentContext;
|
|
547
|
+
const position = useCallback(()=>{
|
|
548
|
+
if (context.trigger && context.valueNode && contentWrapper && content && viewport && selectedItem && selectedItemText) {
|
|
549
|
+
const triggerRect = context.trigger.getBoundingClientRect(); // -----------------------------------------------------------------------------------------
|
|
550
|
+
// Horizontal positioning
|
|
551
|
+
// -----------------------------------------------------------------------------------------
|
|
552
|
+
const contentRect = content.getBoundingClientRect();
|
|
553
|
+
const valueNodeRect = context.valueNode.getBoundingClientRect();
|
|
554
|
+
const itemTextRect = selectedItemText.getBoundingClientRect();
|
|
555
|
+
if (context.dir !== 'rtl') {
|
|
556
|
+
const itemTextOffset = itemTextRect.left - contentRect.left;
|
|
557
|
+
const left = valueNodeRect.left - itemTextOffset;
|
|
558
|
+
const leftDelta = triggerRect.left - left;
|
|
559
|
+
const minContentWidth = triggerRect.width + leftDelta;
|
|
560
|
+
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
561
|
+
const rightEdge = window.innerWidth - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
562
|
+
const clampedLeft = $ae6933e535247d3d$export$7d15b64cf5a3a4c4(left, [
|
|
563
|
+
$cc7e05a45900e73f$var$CONTENT_MARGIN,
|
|
564
|
+
rightEdge - contentWidth
|
|
565
|
+
]);
|
|
566
|
+
contentWrapper.style.minWidth = minContentWidth + 'px';
|
|
567
|
+
contentWrapper.style.left = clampedLeft + 'px';
|
|
568
|
+
} else {
|
|
569
|
+
const itemTextOffset = contentRect.right - itemTextRect.right;
|
|
570
|
+
const right = window.innerWidth - valueNodeRect.right - itemTextOffset;
|
|
571
|
+
const rightDelta = window.innerWidth - triggerRect.right - right;
|
|
572
|
+
const minContentWidth = triggerRect.width + rightDelta;
|
|
573
|
+
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
574
|
+
const leftEdge = window.innerWidth - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
575
|
+
const clampedRight = $ae6933e535247d3d$export$7d15b64cf5a3a4c4(right, [
|
|
576
|
+
$cc7e05a45900e73f$var$CONTENT_MARGIN,
|
|
577
|
+
leftEdge - contentWidth
|
|
578
|
+
]);
|
|
579
|
+
contentWrapper.style.minWidth = minContentWidth + 'px';
|
|
580
|
+
contentWrapper.style.right = clampedRight + 'px';
|
|
581
|
+
} // -----------------------------------------------------------------------------------------
|
|
582
|
+
// Vertical positioning
|
|
583
|
+
// -----------------------------------------------------------------------------------------
|
|
584
|
+
const items = getItems();
|
|
585
|
+
const availableHeight = window.innerHeight - $cc7e05a45900e73f$var$CONTENT_MARGIN * 2;
|
|
586
|
+
const itemsHeight = viewport.scrollHeight;
|
|
587
|
+
const contentStyles = window.getComputedStyle(content);
|
|
588
|
+
const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10);
|
|
589
|
+
const contentPaddingTop = parseInt(contentStyles.paddingTop, 10);
|
|
590
|
+
const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10);
|
|
591
|
+
const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10);
|
|
592
|
+
const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth; // prettier-ignore
|
|
593
|
+
const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight);
|
|
594
|
+
const viewportStyles = window.getComputedStyle(viewport);
|
|
595
|
+
const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10);
|
|
596
|
+
const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10);
|
|
597
|
+
const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
598
|
+
const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;
|
|
599
|
+
const selectedItemHalfHeight = selectedItem.offsetHeight / 2;
|
|
600
|
+
const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight;
|
|
601
|
+
const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;
|
|
602
|
+
const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;
|
|
603
|
+
const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle;
|
|
604
|
+
if (willAlignWithoutTopOverflow) {
|
|
605
|
+
const isLastItem = selectedItem === items[items.length - 1].ref.current;
|
|
606
|
+
contentWrapper.style.bottom = "0px";
|
|
607
|
+
const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;
|
|
608
|
+
const clampedTriggerMiddleToBottomEdge = Math.max(triggerMiddleToBottomEdge, selectedItemHalfHeight + (isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth);
|
|
609
|
+
const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge;
|
|
610
|
+
contentWrapper.style.height = height + 'px';
|
|
611
|
+
} else {
|
|
612
|
+
const isFirstItem = selectedItem === items[0].ref.current;
|
|
613
|
+
contentWrapper.style.top = "0px";
|
|
614
|
+
const clampedTopEdgeToTriggerMiddle = Math.max(topEdgeToTriggerMiddle, contentBorderTopWidth + viewport.offsetTop + (isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight);
|
|
615
|
+
const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom;
|
|
616
|
+
contentWrapper.style.height = height + 'px';
|
|
617
|
+
viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop;
|
|
618
|
+
}
|
|
619
|
+
contentWrapper.style.margin = `${$cc7e05a45900e73f$var$CONTENT_MARGIN}px 0`;
|
|
620
|
+
contentWrapper.style.minHeight = minContentHeight + 'px';
|
|
621
|
+
contentWrapper.style.maxHeight = availableHeight + 'px'; // -----------------------------------------------------------------------------------------
|
|
622
|
+
onPlaced === null || onPlaced === void 0 || onPlaced(); // we don't want the initial scroll position adjustment to trigger "expand on scroll"
|
|
623
|
+
// so we explicitly turn it on only after they've registered.
|
|
624
|
+
requestAnimationFrame(()=>shouldExpandOnScrollRef.current = true
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
}, [
|
|
628
|
+
getItems,
|
|
629
|
+
context.trigger,
|
|
630
|
+
context.valueNode,
|
|
631
|
+
contentWrapper,
|
|
632
|
+
content,
|
|
633
|
+
viewport,
|
|
634
|
+
selectedItem,
|
|
635
|
+
selectedItemText,
|
|
636
|
+
context.dir,
|
|
637
|
+
onPlaced
|
|
638
|
+
]);
|
|
639
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>position()
|
|
640
|
+
, [
|
|
641
|
+
position
|
|
642
|
+
]); // copy z-index from content to wrapper
|
|
643
|
+
const [contentZIndex, setContentZIndex] = useState();
|
|
644
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
645
|
+
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
646
|
+
}, [
|
|
647
|
+
content
|
|
648
|
+
]); // When the viewport becomes scrollable at the top, the scroll up button will mount.
|
|
649
|
+
// Because it is part of the normal flow, it will push down the viewport, thus throwing our
|
|
650
|
+
// trigger => selectedItem alignment off by the amount the viewport was pushed down.
|
|
651
|
+
// We wait for this to happen and then re-run the positining logic one more time to account for it.
|
|
652
|
+
const handleScrollButtonChange = useCallback((node)=>{
|
|
653
|
+
if (node && shouldRepositionRef.current === true) {
|
|
654
|
+
position();
|
|
655
|
+
focusSelectedItem === null || focusSelectedItem === void 0 || focusSelectedItem();
|
|
656
|
+
shouldRepositionRef.current = false;
|
|
657
|
+
}
|
|
658
|
+
}, [
|
|
659
|
+
position,
|
|
660
|
+
focusSelectedItem
|
|
661
|
+
]);
|
|
662
|
+
return /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectViewportProvider, {
|
|
663
|
+
scope: __scopeSelect,
|
|
664
|
+
contentWrapper: contentWrapper,
|
|
665
|
+
shouldExpandOnScrollRef: shouldExpandOnScrollRef,
|
|
666
|
+
onScrollButtonChange: handleScrollButtonChange
|
|
667
|
+
}, /*#__PURE__*/ createElement("div", {
|
|
668
|
+
ref: setContentWrapper,
|
|
669
|
+
style: {
|
|
670
|
+
display: 'flex',
|
|
671
|
+
flexDirection: 'column',
|
|
672
|
+
position: 'fixed',
|
|
673
|
+
zIndex: contentZIndex
|
|
674
|
+
}
|
|
675
|
+
}, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, popperProps, {
|
|
676
|
+
ref: composedRefs,
|
|
677
|
+
style: {
|
|
678
|
+
// When we get the height of the content, it includes borders. If we were to set
|
|
679
|
+
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
680
|
+
boxSizing: 'border-box',
|
|
681
|
+
// We need to ensure the content doesn't get taller than the wrapper
|
|
682
|
+
maxHeight: '100%',
|
|
683
|
+
...popperProps.style
|
|
684
|
+
}
|
|
685
|
+
}))));
|
|
686
|
+
});
|
|
687
|
+
const $cc7e05a45900e73f$var$SelectPopperPosition = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
688
|
+
const { __scopeSelect: __scopeSelect , align: align = 'start' , collisionPadding: collisionPadding = $cc7e05a45900e73f$var$CONTENT_MARGIN , ...popperProps } = props;
|
|
689
|
+
const popperScope = $cc7e05a45900e73f$var$usePopperScope(__scopeSelect);
|
|
690
|
+
return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2, _extends({}, popperScope, popperProps, {
|
|
691
|
+
ref: forwardedRef,
|
|
692
|
+
align: align,
|
|
693
|
+
collisionPadding: collisionPadding,
|
|
694
|
+
style: {
|
|
695
|
+
// Ensure border-box for floating-ui calculations
|
|
696
|
+
boxSizing: 'border-box',
|
|
697
|
+
...popperProps.style,
|
|
698
|
+
'--radix-select-content-transform-origin': 'var(--radix-popper-transform-origin)',
|
|
699
|
+
'--radix-select-content-available-width': 'var(--radix-popper-available-width)',
|
|
700
|
+
'--radix-select-content-available-height': 'var(--radix-popper-available-height)',
|
|
701
|
+
'--radix-select-trigger-width': 'var(--radix-popper-anchor-width)',
|
|
702
|
+
'--radix-select-trigger-height': 'var(--radix-popper-anchor-height)'
|
|
703
|
+
}
|
|
704
|
+
}));
|
|
705
|
+
});
|
|
1256
706
|
/* -------------------------------------------------------------------------------------------------
|
|
1257
707
|
* SelectViewport
|
|
1258
|
-
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$
|
|
708
|
+
* -----------------------------------------------------------------------------------------------*/ const [$cc7e05a45900e73f$var$SelectViewportProvider, $cc7e05a45900e73f$var$useSelectViewportContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, {});
|
|
709
|
+
const $cc7e05a45900e73f$var$VIEWPORT_NAME = 'SelectViewport';
|
|
1259
710
|
const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1260
711
|
const { __scopeSelect: __scopeSelect , ...viewportProps } = props;
|
|
1261
712
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
713
|
+
const viewportContext = $cc7e05a45900e73f$var$useSelectViewportContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
1262
714
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentContext.onViewportChange);
|
|
1263
715
|
const prevScrollTopRef = useRef(0);
|
|
1264
716
|
return /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement("style", {
|
|
@@ -1283,7 +735,7 @@ const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ forwardRef((prop
|
|
|
1283
735
|
},
|
|
1284
736
|
onScroll: $e42e1063c40fb3ef$export$b9ecd428b558ff10(viewportProps.onScroll, (event)=>{
|
|
1285
737
|
const viewport = event.currentTarget;
|
|
1286
|
-
const { contentWrapper: contentWrapper , shouldExpandOnScrollRef: shouldExpandOnScrollRef } =
|
|
738
|
+
const { contentWrapper: contentWrapper , shouldExpandOnScrollRef: shouldExpandOnScrollRef } = viewportContext;
|
|
1287
739
|
if (shouldExpandOnScrollRef !== null && shouldExpandOnScrollRef !== void 0 && shouldExpandOnScrollRef.current && contentWrapper) {
|
|
1288
740
|
const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop);
|
|
1289
741
|
if (scrolledBy > 0) {
|
|
@@ -1333,6 +785,7 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ forwardRef((prop
|
|
|
1333
785
|
context.onOpenChange(false);
|
|
1334
786
|
}
|
|
1335
787
|
};
|
|
788
|
+
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.');
|
|
1336
789
|
return /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectItemContextProvider, {
|
|
1337
790
|
scope: __scopeSelect,
|
|
1338
791
|
value: value,
|
|
@@ -1452,8 +905,9 @@ const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ forwardRef((prop
|
|
|
1452
905
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME = 'SelectScrollUpButton';
|
|
1453
906
|
const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1454
907
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
908
|
+
const viewportContext = $cc7e05a45900e73f$var$useSelectViewportContext($cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
1455
909
|
const [canScrollUp1, setCanScrollUp] = useState(false);
|
|
1456
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef,
|
|
910
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, viewportContext.onScrollButtonChange);
|
|
1457
911
|
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
1458
912
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
1459
913
|
const viewport = contentContext.viewport;
|
|
@@ -1483,8 +937,9 @@ const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ forwardRef((prop
|
|
|
1483
937
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME = 'SelectScrollDownButton';
|
|
1484
938
|
const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1485
939
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
940
|
+
const viewportContext = $cc7e05a45900e73f$var$useSelectViewportContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
1486
941
|
const [canScrollDown1, setCanScrollDown] = useState(false);
|
|
1487
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef,
|
|
942
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, viewportContext.onScrollButtonChange);
|
|
1488
943
|
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
1489
944
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
1490
945
|
const viewport = contentContext.viewport;
|
|
@@ -1549,6 +1004,9 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ forwardRef((p
|
|
|
1549
1004
|
flexShrink: 0,
|
|
1550
1005
|
...scrollIndicatorProps.style
|
|
1551
1006
|
},
|
|
1007
|
+
onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerDown, ()=>{
|
|
1008
|
+
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
1009
|
+
}),
|
|
1552
1010
|
onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerMove, ()=>{
|
|
1553
1011
|
var _contentContext$onIte3;
|
|
1554
1012
|
(_contentContext$onIte3 = contentContext.onItemLeave) === null || _contentContext$onIte3 === void 0 || _contentContext$onIte3.call(contentContext);
|
|
@@ -1559,7 +1017,10 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ forwardRef((p
|
|
|
1559
1017
|
})
|
|
1560
1018
|
}));
|
|
1561
1019
|
});
|
|
1562
|
-
/* -----------------------------------------------------------------------------------------------*/
|
|
1020
|
+
/* -----------------------------------------------------------------------------------------------*/ function $cc7e05a45900e73f$var$shouldShowPlaceholder(value) {
|
|
1021
|
+
return value === '' || value === undefined;
|
|
1022
|
+
}
|
|
1023
|
+
const $cc7e05a45900e73f$var$BubbleSelect = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1563
1024
|
const { value: value , ...selectProps } = props;
|
|
1564
1025
|
const ref = useRef(null);
|
|
1565
1026
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
@@ -1698,7 +1159,7 @@ const BtIconChevronUp2Px = (props) =>
|
|
|
1698
1159
|
/** Use `Select` to choose from a dropdown list of options. */
|
|
1699
1160
|
var Select = function (_a) {
|
|
1700
1161
|
var _b;
|
|
1701
|
-
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 = __rest(_a, ["isRequired", "isDisabled", "placeholder", "label", "ariaLabel", "options", "onOpenChange", "isDefaultOpen", "defaultValue", "errorMessage", "labelSize", "helper", "name", "isFluid", "onBlur", "onChange", "disclosureTitle", "disclosureText", "onClickDisclosure", "selectSize"]);
|
|
1162
|
+
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 = __rest(_a, ["isRequired", "isDisabled", "placeholder", "label", "ariaLabel", "options", "onOpenChange", "isDefaultOpen", "defaultValue", "errorMessage", "labelSize", "helper", "hideLabel", "name", "width", "isFluid", "onBlur", "onChange", "disclosureTitle", "disclosureText", "onClickDisclosure", "selectSize"]);
|
|
1702
1163
|
var id = useId();
|
|
1703
1164
|
var arcRootElement = useContext(ArcRootElementContext);
|
|
1704
1165
|
var surface = useContext(Context).surface;
|
|
@@ -1721,35 +1182,36 @@ var Select = function (_a) {
|
|
|
1721
1182
|
return 20;
|
|
1722
1183
|
}
|
|
1723
1184
|
};
|
|
1724
|
-
return (React__default.createElement(FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, label: label, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional", isDisabled: isDisabled, disclosureText: disclosureText, disclosureTitle: disclosureTitle, onClickDisclosure: onClickDisclosure },
|
|
1185
|
+
return (React__default.createElement(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 },
|
|
1725
1186
|
React__default.createElement($cc7e05a45900e73f$export$be92b6f5f03c0fe9, { name: name, required: isRequired, disabled: isDisabled, defaultOpen: isDefaultOpen, value: selectedValue, onOpenChange: onOpenChange, onValueChange: function (value) { return onValueChange(value); } },
|
|
1726
|
-
React__default.createElement(
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
React__default.createElement(
|
|
1736
|
-
|
|
1737
|
-
React__default.createElement($cc7e05a45900e73f$export$
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
React__default.createElement(
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
React__default.createElement(
|
|
1746
|
-
React__default.createElement(
|
|
1747
|
-
React__default.createElement(
|
|
1748
|
-
|
|
1749
|
-
React__default.createElement(
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
React__default.createElement(
|
|
1187
|
+
React__default.createElement("div", { className: "arc-Select-wrapper" },
|
|
1188
|
+
React__default.createElement($cc7e05a45900e73f$export$41fb9f06171c75f4, __assign({ id: id, name: name, onBlur: onBlur, "aria-label": ariaLabel, style: { width: width }, className: classNames("arc-Select-trigger", (_b = {
|
|
1189
|
+
"arc-Select-trigger--constrained": !isFluid,
|
|
1190
|
+
"arc-Select-trigger--onDarkSurface": surface === "dark",
|
|
1191
|
+
"arc-Select-trigger--invalid": errorMessage
|
|
1192
|
+
},
|
|
1193
|
+
_b["arc-Select-trigger--size".concat(selectSize && selectSize.toUpperCase())] = selectSize && selectSize !== "m",
|
|
1194
|
+
_b)) }, filterDataAttrs(props)),
|
|
1195
|
+
React__default.createElement($cc7e05a45900e73f$export$4c8d1a57a761ef94, { className: "arc-Select-triggerText", placeholder: placeholder, "aria-label": getSelectedValueName(selectedValue) }),
|
|
1196
|
+
React__default.createElement($cc7e05a45900e73f$export$f04a61298a47a40f, { className: "arc-Select-triggerIcon" },
|
|
1197
|
+
React__default.createElement(Icon, { icon: BtIconChevronDown2Px, size: getIconSize(selectSize) }))),
|
|
1198
|
+
React__default.createElement($cc7e05a45900e73f$export$602eac185826482c, { container: arcRootElement || undefined },
|
|
1199
|
+
React__default.createElement($cc7e05a45900e73f$export$7c6e2c02157bb7d2, { sideOffset: 5, position: "popper", className: classNames("arc-Select-content", {
|
|
1200
|
+
"arc-Select-content--onDarkSurface": surface === "dark"
|
|
1201
|
+
}) },
|
|
1202
|
+
React__default.createElement($cc7e05a45900e73f$export$2f60d3ec9ad468f2, { className: "arc-Select-scrollButton" },
|
|
1203
|
+
React__default.createElement(Icon, { icon: BtIconChevronUp2Px, size: 16 })),
|
|
1204
|
+
React__default.createElement($cc7e05a45900e73f$export$d5c6c08dc2d3ca7, null, options.map(function (_a, i) {
|
|
1205
|
+
var name = _a.name, value = _a.value;
|
|
1206
|
+
return (React__default.createElement($cc7e05a45900e73f$export$6d08773d2e66f8f2, { className: "arc-Select-item", key: "select-item-".concat(i), value: value },
|
|
1207
|
+
React__default.createElement("div", { className: "arc-Select-itemTextWrapper" },
|
|
1208
|
+
React__default.createElement($cc7e05a45900e73f$export$d6e5bf9c43ea9319, { asChild: true },
|
|
1209
|
+
React__default.createElement("span", { className: "arc-Select-itemText" }, name))),
|
|
1210
|
+
React__default.createElement($cc7e05a45900e73f$export$c3468e2714d175fa, null,
|
|
1211
|
+
React__default.createElement(Icon, { icon: BtIconTickAlt2Px, size: 20 }))));
|
|
1212
|
+
})),
|
|
1213
|
+
React__default.createElement($cc7e05a45900e73f$export$bf1aedc3039c8d63, { className: "arc-Select-scrollButton" },
|
|
1214
|
+
React__default.createElement(Icon, { icon: BtIconChevronDown2Px, size: 16 }))))))));
|
|
1753
1215
|
};
|
|
1754
1216
|
|
|
1755
1217
|
export { Select };
|