@koide-labs/ui 0.0.14 → 0.1.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/-utils.d.ts +2 -2
- package/dist/-utils.js +1 -1
- package/dist/{Button-DrPFFzo7.js → Button-BmcVHRRW.js} +2 -2
- package/dist/{CompositeRoot-CVk5a-pR.js → CompositeRoot-CCgh2M64.js} +6 -6
- package/dist/{FloatingPortal-tWyuKRSN.js → FloatingPortal-BQsQhvIr.js} +27 -27
- package/dist/{FloatingPortalLite-DVyq6YhV.js → FloatingPortalLite-_ECdFE7b.js} +1 -1
- package/dist/{InternalBackdrop-jYAiOJ8v.js → InternalBackdrop-BSMKU-hc.js} +13 -13
- package/dist/{LabelableContext-BMvjVwor.js → LabelableContext-Be1u-eFg.js} +2 -2
- package/dist/accordion.css +1 -0
- package/dist/alert-dialog.css +1 -0
- package/dist/anchor.css +1 -0
- package/dist/avatar.css +1 -0
- package/dist/badge.css +1 -0
- package/dist/button.css +1 -0
- package/dist/checkbox.css +1 -0
- package/dist/code.css +1 -0
- package/dist/collapse.css +1 -0
- package/dist/command.css +1 -0
- package/dist/components/accordion/accordion.d.ts +19 -0
- package/dist/components/accordion/accordion.js +701 -0
- package/dist/components/accordion/index.d.ts +1 -12
- package/dist/components/accordion/index.js +2 -697
- package/dist/components/alert-dialog/alert-dialog.d.ts +36 -0
- package/dist/components/alert-dialog/alert-dialog.js +138 -0
- package/dist/components/alert-dialog/index.d.ts +1 -26
- package/dist/components/alert-dialog/index.js +2 -134
- package/dist/components/anchor/anchor.d.ts +12 -0
- package/dist/components/anchor/anchor.js +21 -0
- package/dist/components/anchor/index.d.ts +1 -8
- package/dist/components/anchor/index.js +2 -19
- package/dist/components/avatar/avatar.d.ts +25 -0
- package/dist/components/avatar/avatar.js +161 -0
- package/dist/components/avatar/index.d.ts +1 -21
- package/dist/components/avatar/index.js +2 -159
- package/dist/components/badge/badge.d.ts +20 -0
- package/dist/components/badge/badge.js +42 -0
- package/dist/components/badge/index.d.ts +1 -16
- package/dist/components/badge/index.js +2 -40
- package/dist/components/button/button.d.ts +27 -0
- package/dist/components/button/button.js +47 -0
- package/dist/components/button/index.d.ts +1 -24
- package/dist/components/button/index.js +2 -45
- package/dist/components/checkbox/checkbox.d.ts +13 -0
- package/dist/components/checkbox/checkbox.js +269 -0
- package/dist/components/checkbox/index.d.ts +1 -9
- package/dist/components/checkbox/index.js +2 -267
- package/dist/components/code/code.d.ts +13 -0
- package/dist/components/code/code.js +1206 -0
- package/dist/components/code/index.d.ts +1 -9
- package/dist/components/code/index.js +2 -1204
- package/dist/components/collapse/collapse.d.ts +14 -0
- package/dist/components/collapse/collapse.js +35 -0
- package/dist/components/collapse/index.d.ts +1 -11
- package/dist/components/collapse/index.js +2 -33
- package/dist/components/command/command.d.ts +36 -0
- package/dist/components/command/command.js +1695 -0
- package/dist/components/command/index.d.ts +1 -15
- package/dist/components/command/index.js +2 -1693
- package/dist/components/context-menu/context-menu.d.ts +82 -0
- package/dist/components/context-menu/context-menu.js +1445 -0
- package/dist/components/context-menu/index.d.ts +1 -42
- package/dist/components/context-menu/index.js +2 -1442
- package/dist/components/dialog/dialog.d.ts +22 -0
- package/dist/components/dialog/dialog.js +140 -0
- package/dist/components/dialog/dialog.types.d.ts +38 -0
- package/dist/components/dialog/index.d.ts +1 -48
- package/dist/components/dialog/index.js +2 -136
- package/dist/components/heading/heading.d.ts +25 -0
- package/dist/components/heading/heading.js +36 -0
- package/dist/components/heading/index.d.ts +1 -44
- package/dist/components/heading/index.js +2 -49
- package/dist/components/icon/icon.d.ts +28 -0
- package/dist/components/icon/icon.js +43 -0
- package/dist/components/icon/{icon-names.d.ts → icon.types.d.ts} +4 -0
- package/dist/components/icon/icon.types.js +1 -0
- package/dist/components/icon/index.d.ts +2 -24
- package/dist/components/icon/index.js +2 -41
- package/dist/components/icon-button/icon-button.d.ts +16 -0
- package/dist/components/icon-button/icon-button.js +46 -0
- package/dist/components/icon-button/index.d.ts +1 -12
- package/dist/components/icon-button/index.js +2 -44
- package/dist/components/inline-code/index.d.ts +1 -6
- package/dist/components/inline-code/index.js +2 -20
- package/dist/components/inline-code/inline-code.d.ts +10 -0
- package/dist/components/inline-code/inline-code.js +25 -0
- package/dist/components/input/index.d.ts +1 -3
- package/dist/components/input/index.js +2 -117
- package/dist/components/input/input.d.ts +9 -0
- package/dist/components/input/input.js +126 -0
- package/dist/components/meter/index.d.ts +1 -18
- package/dist/components/meter/index.js +2 -163
- package/dist/components/meter/meter.d.ts +22 -0
- package/dist/components/meter/meter.js +165 -0
- package/dist/components/multiline-input/index.d.ts +1 -6
- package/dist/components/multiline-input/index.js +2 -98
- package/dist/components/multiline-input/multiline-input.d.ts +10 -0
- package/dist/components/multiline-input/multiline-input.js +100 -0
- package/dist/components/number-input/index.d.ts +1 -10
- package/dist/components/number-input/index.js +2 -1167
- package/dist/components/number-input/number-input.d.ts +14 -0
- package/dist/components/number-input/number-input.js +1169 -0
- package/dist/components/password-input/index.d.ts +1 -2
- package/dist/components/password-input/index.js +2 -27
- package/dist/components/password-input/password-input.d.ts +7 -0
- package/dist/components/password-input/password-input.js +29 -0
- package/dist/components/pill/index.d.ts +1 -13
- package/dist/components/pill/index.js +2 -36
- package/dist/components/pill/pill.d.ts +17 -0
- package/dist/components/pill/pill.js +38 -0
- package/dist/components/popover/index.d.ts +1 -21
- package/dist/components/popover/index.js +2 -634
- package/dist/components/popover/popover.d.ts +22 -0
- package/dist/components/popover/popover.js +634 -0
- package/dist/components/preview-card/index.d.ts +1 -17
- package/dist/components/preview-card/index.js +2 -400
- package/dist/components/preview-card/preview-card.d.ts +21 -0
- package/dist/components/preview-card/preview-card.js +402 -0
- package/dist/components/radio-group/index.d.ts +1 -0
- package/dist/components/radio-group/index.js +5 -0
- package/dist/components/radio-group/radio-group.d.ts +25 -0
- package/dist/components/{radio/index.js → radio-group/radio-group.js} +91 -90
- package/dist/components/search-bar/index.d.ts +1 -12
- package/dist/components/search-bar/index.js +2 -46
- package/dist/components/search-bar/search-bar.d.ts +16 -0
- package/dist/components/search-bar/search-bar.js +43 -0
- package/dist/components/select/index.d.ts +1 -16
- package/dist/components/select/index.js +2 -1261
- package/dist/components/select/select.d.ts +22 -0
- package/dist/components/select/select.js +1263 -0
- package/dist/components/separator/index.d.ts +1 -7
- package/dist/components/separator/index.js +2 -4
- package/dist/components/separator/separator.d.ts +10 -0
- package/dist/components/separator/separator.js +6 -0
- package/dist/components/slider/index.d.ts +1 -5
- package/dist/components/slider/index.js +2 -900
- package/dist/components/slider/slider.d.ts +10 -0
- package/dist/components/slider/slider.js +899 -0
- package/dist/components/spinner/index.d.ts +1 -2
- package/dist/components/spinner/index.js +2 -11
- package/dist/components/spinner/spinner.d.ts +7 -0
- package/dist/components/spinner/spinner.js +13 -0
- package/dist/components/stacked-avatars/index.d.ts +1 -14
- package/dist/components/stacked-avatars/index.js +2 -90
- package/dist/components/stacked-avatars/stacked-avatars.d.ts +18 -0
- package/dist/components/stacked-avatars/stacked-avatars.js +92 -0
- package/dist/components/status-banner/index.d.ts +1 -17
- package/dist/components/status-banner/index.js +2 -69
- package/dist/components/status-banner/status-banner.d.ts +22 -0
- package/dist/components/status-banner/status-banner.js +71 -0
- package/dist/components/surface/index.d.ts +2 -27
- package/dist/components/surface/index.js +2 -39
- package/dist/components/surface/surface.d.ts +26 -0
- package/dist/components/surface/surface.js +36 -0
- package/dist/components/surface/surface.types.d.ts +1 -0
- package/dist/components/surface/surface.types.js +1 -0
- package/dist/components/switch/index.d.ts +1 -5
- package/dist/components/switch/index.js +2 -194
- package/dist/components/switch/switch.d.ts +10 -0
- package/dist/components/switch/switch.js +193 -0
- package/dist/components/tabs/index.d.ts +1 -18
- package/dist/components/tabs/index.js +2 -507
- package/dist/components/tabs/tabs.d.ts +28 -0
- package/dist/components/tabs/tabs.js +511 -0
- package/dist/components/text/index.d.ts +1 -26
- package/dist/components/text/index.js +2 -46
- package/dist/components/text/text.d.ts +29 -0
- package/dist/components/text/text.js +48 -0
- package/dist/components/theme-provider/index.d.ts +1 -1
- package/dist/components/theme-provider/theme-provider.d.ts +8 -4
- package/dist/components/theme-provider/theme-provider.js +3 -3
- package/dist/components/timestamp/index.d.ts +1 -23
- package/dist/components/timestamp/index.js +2 -1390
- package/dist/components/timestamp/timestamp.d.ts +26 -0
- package/dist/components/timestamp/timestamp.js +1391 -0
- package/dist/components/toaster/index.d.ts +2 -0
- package/dist/components/toaster/index.js +7 -0
- package/dist/components/toaster/toaster.d.ts +7 -0
- package/dist/components/toaster/toaster.js +923 -0
- package/dist/components/{toast → toaster}/use-toast-manager.d.ts +3 -3
- package/dist/components/tooltip/index.d.ts +1 -14
- package/dist/components/tooltip/index.js +2 -710
- package/dist/components/tooltip/tooltip.d.ts +24 -0
- package/dist/components/tooltip/tooltip.js +9 -0
- package/dist/components/view/index.d.ts +2 -30
- package/dist/components/view/index.js +2 -79
- package/dist/components/view/view.d.ts +31 -0
- package/dist/components/view/view.js +83 -0
- package/dist/components/view/view.types.d.ts +5 -0
- package/dist/components/view/view.types.js +1 -0
- package/dist/components/visually-hidden/index.d.ts +5 -1
- package/dist/{composite-Bx7Szd_T.js → composite-BZzP-LlG.js} +3 -3
- package/dist/{composite-C9L5QmZL.js → composite-BwEK5cWH.js} +1 -1
- package/dist/context-menu.css +1 -0
- package/dist/{createBaseUIEventDetails-D8M2Yl-a.js → createBaseUIEventDetails-CCSfZ2vM.js} +7 -7
- package/dist/{detectBrowser-I-s3yzIE.js → detectBrowser-Bl8Ki_1I.js} +2 -2
- package/dist/dialog.css +1 -1
- package/dist/{dialog.module-BeF-6XAo.js → dialog.module-DsbQRp-d.js} +55 -55
- package/dist/{element-CZEOj04G.js → element-u5WgOZX1.js} +7 -7
- package/dist/{event-CKoGyQEJ.js → event-B89-Ng5h.js} +4 -4
- package/dist/{floating-ui.utils-C7pRWMZ_.js → floating-ui.utils-DUVaIF3G.js} +7 -7
- package/dist/{floating-ui.utils.dom-C7FS5id0.js → floating-ui.utils.dom-cbi420Pg.js} +4 -4
- package/dist/{getDisabledMountTransitionStyles-YfHPge6T.js → getDisabledMountTransitionStyles-E2x-_lte.js} +7 -7
- package/dist/heading.css +1 -0
- package/dist/icon-button.css +1 -0
- package/dist/icon.css +1 -0
- package/dist/index.d.ts +10 -10
- package/dist/index.js +86 -104
- package/dist/{inertValue-BCYGsdmf.js → inertValue-BTpPjX30.js} +1 -1
- package/dist/inline-code.css +1 -0
- package/dist/input.css +1 -1
- package/dist/input.module-CtE19OH8.js +8 -0
- package/dist/integrations/react-markdown/index.js +12 -12
- package/dist/meter.css +1 -0
- package/dist/number-input.css +1 -0
- package/dist/password-input.css +1 -0
- package/dist/pill.css +1 -0
- package/dist/popover.css +1 -0
- package/dist/preview-card.css +1 -0
- package/dist/radio-group.css +1 -0
- package/dist/safePolygon-DnkzOIur.js +558 -0
- package/dist/search-bar.css +1 -0
- package/dist/select.css +1 -0
- package/dist/{index-DVjyPAD4.js → separator-fh_wDZNf.js} +7 -11
- package/dist/separator.css +1 -0
- package/dist/slider.css +1 -0
- package/dist/spinner.css +1 -0
- package/dist/stacked-avatars.css +1 -0
- package/dist/status-banner.css +1 -0
- package/dist/styles/core.css +1 -1
- package/dist/surface.css +1 -0
- package/dist/switch.css +1 -0
- package/dist/tabs.css +1 -0
- package/dist/text.css +1 -0
- package/dist/timestamp.css +1 -0
- package/dist/toaster.css +1 -0
- package/dist/tooltip-oCp-elli.js +765 -0
- package/dist/tooltip.css +1 -0
- package/dist/transitions.css +1 -1
- package/dist/{transitions.module-CWX8e5cx.js → transitions.module-D9mMAtfI.js} +11 -11
- package/dist/{useAnimationFrame-451ugS_6.js → useAnimationFrame-DvK1s63A.js} +1 -1
- package/dist/{useButton-DfIwsdb8.js → useButton-d3_JgBNr.js} +3 -3
- package/dist/{useCompositeListItem-OkcAim_1.js → useCompositeListItem-CZp9WTnF.js} +2 -2
- package/dist/{useLabelableId-Ci_jDvmv.js → useLabelableId-CX4tcfzK.js} +3 -3
- package/dist/{useOpenChangeComplete-Dse9kY9E.js → useOpenChangeComplete-BHd-N7Ig.js} +5 -5
- package/dist/{useRender-CLx7dR_1.js → useRender-C3vlzS3t.js} +1 -1
- package/dist/{useRenderElement-DwToLA61.js → useRenderElement-DngNDu_P.js} +2 -2
- package/dist/{useRole-oDBdbuwQ.js → useRole-BD3OL1rr.js} +3 -3
- package/dist/{useStableCallback-CkTrVkNX.js → useStableCallback-DKZHlUAT.js} +1 -1
- package/dist/{useSyncedFloatingRootContext-Dorsv-jf.js → useSyncedFloatingRootContext-BB1vwkV-.js} +20 -20
- package/dist/{useTimeout-CflX-kz3.js → useTimeout-BNni6aw5.js} +1 -1
- package/dist/{useTransitionStatus-CUfcuGAV.js → useTransitionStatus-CmMyUh74.js} +1 -1
- package/dist/{useTypeahead-D85V2IUx.js → useTypeahead-BiL5IAVb.js} +11 -11
- package/dist/{useValueAsRef-HURLzret.js → useValueAsRef-B4EriRsI.js} +1 -1
- package/dist/{useValueChanged-DL757-yD.js → useValueChanged-MJRmEWz1.js} +1 -1
- package/dist/view.css +1 -1
- package/dist/view.module-Dj7wj0kk.js +6 -0
- package/dist/view2.css +1 -0
- package/package.json +16 -19
- package/dist/components/radio/index.d.ts +0 -13
- package/dist/components/toast/index.d.ts +0 -2
- package/dist/components/toast/index.js +0 -8
- package/dist/components/toast/toast.d.ts +0 -2
- package/dist/components/toast/toast.js +0 -921
- package/dist/components/tooltip/tooltip-arrow.d.ts +0 -3
- package/dist/components/tooltip/tooltip-arrow.js +0 -6
- package/dist/index10.css +0 -1
- package/dist/index11.css +0 -1
- package/dist/index12.css +0 -1
- package/dist/index13.css +0 -1
- package/dist/index14.css +0 -1
- package/dist/index15.css +0 -1
- package/dist/index16.css +0 -1
- package/dist/index17.css +0 -1
- package/dist/index18.css +0 -1
- package/dist/index19.css +0 -1
- package/dist/index20.css +0 -1
- package/dist/index21.css +0 -1
- package/dist/index22.css +0 -1
- package/dist/index23.css +0 -1
- package/dist/index24.css +0 -1
- package/dist/index25.css +0 -1
- package/dist/index26.css +0 -1
- package/dist/index27.css +0 -1
- package/dist/index28.css +0 -1
- package/dist/index29.css +0 -1
- package/dist/index3.css +0 -1
- package/dist/index30.css +0 -1
- package/dist/index31.css +0 -1
- package/dist/index32.css +0 -1
- package/dist/index33.css +0 -1
- package/dist/index34.css +0 -1
- package/dist/index35.css +0 -1
- package/dist/index36.css +0 -1
- package/dist/index37.css +0 -1
- package/dist/index4.css +0 -1
- package/dist/index5.css +0 -1
- package/dist/index6.css +0 -1
- package/dist/index7.css +0 -1
- package/dist/index8.css +0 -1
- package/dist/index9.css +0 -1
- package/dist/input.module-DDQY_Ij6.js +0 -7
- package/dist/safePolygon-DWy1dGKJ.js +0 -308
- package/dist/toast.css +0 -1
- package/dist/tooltip-arrow-cs6vjjqZ.js +0 -24
- package/dist/tooltip-arrow.css +0 -1
- package/dist/useHoverReferenceInteraction-SfOBPoXM.js +0 -264
- package/dist/usePopupAutoResize-CNR6Ekmx.js +0 -85
- package/dist/view.module-DfDLgJE0.js +0 -6
- /package/dist/components/{icon/icon-names.js → dialog/dialog.types.js} +0 -0
- /package/dist/components/{toast → toaster}/use-toast-manager.js +0 -0
|
@@ -1,1264 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { c as jt } from "../../clsx-OuTLNxxd.js";
|
|
4
|
-
import * as n from "react";
|
|
5
|
-
import { textify as $t } from "../../-utils.js";
|
|
6
|
-
import { Icon as xt } from "../icon/index.js";
|
|
7
|
-
import { View as Yt } from "../view/index.js";
|
|
8
|
-
import { c as E, l as p, d as Xt, e as Kt, S as Gt, i as Jt, f as Zt, p as Rt, t as Qt } from "../../transitions.module-CWX8e5cx.js";
|
|
9
|
-
import { v as en } from "../../visuallyHidden-CpJ-mhai.js";
|
|
10
|
-
import { b as gt, a as tn, m as St, c as It, u as Re } from "../../useRenderElement-DwToLA61.js";
|
|
11
|
-
import { u as ht } from "../../useControlled-Du4sJyMj.js";
|
|
12
|
-
import { u as fe } from "../../useIsoLayoutEffect-CIDbvm3Q.js";
|
|
13
|
-
import { u as ye } from "../../useStableCallback-CkTrVkNX.js";
|
|
14
|
-
import { u as ct } from "../../useValueAsRef-HURLzret.js";
|
|
15
|
-
import { f as Ke } from "../../formatErrorMessage-BqPuTBN-.js";
|
|
16
|
-
import { c as nn, a as vt, u as Et, b as on, f as rn } from "../../LabelableContext-BMvjVwor.js";
|
|
17
|
-
import { u as sn } from "../../useLabelableId-Ci_jDvmv.js";
|
|
18
|
-
import { u as wt } from "../../useTransitionStatus-CUfcuGAV.js";
|
|
19
|
-
import { c as xe, n as Mt, f as ln, v as cn, w as an, x as tt } from "../../createBaseUIEventDetails-D8M2Yl-a.js";
|
|
20
|
-
import { a as at, t as At } from "../../useOpenChangeComplete-Dse9kY9E.js";
|
|
21
|
-
import { u as un } from "../../useValueChanged-DL757-yD.js";
|
|
22
|
-
import { u as dn, b as fn, a as pn, I as mn, F as gn } from "../../InternalBackdrop-jYAiOJ8v.js";
|
|
23
|
-
import { u as hn, a as bn, g as yn } from "../../getDisabledMountTransitionStyles-YfHPge6T.js";
|
|
24
|
-
import { u as xn, a as Rn } from "../../useTypeahead-D85V2IUx.js";
|
|
25
|
-
import { o as rt } from "../../owner-rKN292Q9.js";
|
|
26
|
-
import { u as _e } from "../../useTimeout-CflX-kz3.js";
|
|
27
|
-
import { u as Tt } from "../../useButton-DfIwsdb8.js";
|
|
28
|
-
import { g as Sn, f as bt } from "../../element-CZEOj04G.js";
|
|
29
|
-
import { h as In, m as vn } from "../../FloatingPortal-tWyuKRSN.js";
|
|
30
|
-
import { i as En } from "../../inertValue-BCYGsdmf.js";
|
|
31
|
-
import { C as wn, u as Mn, I as An } from "../../useCompositeListItem-OkcAim_1.js";
|
|
32
|
-
import * as Tn from "react-dom";
|
|
33
|
-
import { d as Vn } from "../../detectBrowser-I-s3yzIE.js";
|
|
34
|
-
import { u as Cn } from "../../useAnimationFrame-451ugS_6.js";
|
|
35
|
-
import { u as Nn } from "../../ToolbarRootContext-CvvL0Tk1.js";
|
|
36
|
-
import { C as _n } from "../../composite-C9L5QmZL.js";
|
|
37
|
-
import { d as yt } from "../../floating-ui.utils.dom-C7FS5id0.js";
|
|
38
|
-
import '../../index34.css';function Pn(e) {
|
|
39
|
-
const t = n.useRef(!0);
|
|
40
|
-
t.current && (t.current = !1, e());
|
|
41
|
-
}
|
|
42
|
-
const On = (e, t) => Object.is(e, t);
|
|
43
|
-
function Oe(e, t, o) {
|
|
44
|
-
return e == null || t == null ? Object.is(e, t) : o(e, t);
|
|
45
|
-
}
|
|
46
|
-
function nt(e, t, o) {
|
|
47
|
-
return !e || e.length === 0 ? !1 : e.some((s) => s === void 0 ? !1 : Oe(s, t, o));
|
|
48
|
-
}
|
|
49
|
-
function st(e, t, o) {
|
|
50
|
-
return !e || e.length === 0 ? -1 : e.findIndex((s) => s === void 0 ? !1 : Oe(s, t, o));
|
|
51
|
-
}
|
|
52
|
-
function Dn(e, t, o) {
|
|
53
|
-
return e.filter((s) => !Oe(s, t, o));
|
|
54
|
-
}
|
|
55
|
-
function it(e) {
|
|
56
|
-
if (e == null)
|
|
57
|
-
return "";
|
|
58
|
-
if (typeof e == "string")
|
|
59
|
-
return e;
|
|
60
|
-
try {
|
|
61
|
-
return JSON.stringify(e);
|
|
62
|
-
} catch {
|
|
63
|
-
return String(e);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function Hn(e) {
|
|
67
|
-
return e != null && e.length > 0 && typeof e[0] == "object" && e[0] != null && "items" in e[0];
|
|
68
|
-
}
|
|
69
|
-
function ke(e, t) {
|
|
70
|
-
if (t && e != null)
|
|
71
|
-
return t(e) ?? "";
|
|
72
|
-
if (e && typeof e == "object") {
|
|
73
|
-
if ("label" in e && e.label != null)
|
|
74
|
-
return String(e.label);
|
|
75
|
-
if ("value" in e)
|
|
76
|
-
return String(e.value);
|
|
77
|
-
}
|
|
78
|
-
return it(e);
|
|
79
|
-
}
|
|
80
|
-
function Ne(e, t) {
|
|
81
|
-
return t && e != null ? t(e) ?? "" : e && typeof e == "object" && "value" in e && "label" in e ? it(e.value) : it(e);
|
|
82
|
-
}
|
|
83
|
-
function Fn(e, t, o) {
|
|
84
|
-
if (o && e != null)
|
|
85
|
-
return o(e);
|
|
86
|
-
if (e && typeof e == "object" && "label" in e && e.label != null)
|
|
87
|
-
return e.label;
|
|
88
|
-
if (t && !Array.isArray(t))
|
|
89
|
-
return t[e] ?? ke(e, o);
|
|
90
|
-
if (Array.isArray(t)) {
|
|
91
|
-
const s = Hn(t) ? t.flatMap((r) => r.items) : t;
|
|
92
|
-
if (e == null) {
|
|
93
|
-
const r = s.find((i) => i.value == null);
|
|
94
|
-
return r && r.label != null ? r.label : ke(e, o);
|
|
95
|
-
}
|
|
96
|
-
if (typeof e != "object") {
|
|
97
|
-
const r = s.find((i) => i && i.value === e);
|
|
98
|
-
return r && r.label != null ? r.label : ke(e, o);
|
|
99
|
-
}
|
|
100
|
-
if ("value" in e) {
|
|
101
|
-
const r = s.find((i) => i && i.value === e.value);
|
|
102
|
-
if (r && r.label != null)
|
|
103
|
-
return r.label;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return ke(e, o);
|
|
107
|
-
}
|
|
108
|
-
function Bn(e, t) {
|
|
109
|
-
return !Array.isArray(e) || e.length === 0 ? "" : e.map((o) => ke(o, t)).join(", ");
|
|
110
|
-
}
|
|
111
|
-
function Un(e) {
|
|
112
|
-
const t = e.getBoundingClientRect();
|
|
113
|
-
if (process.env.NODE_ENV === "test")
|
|
114
|
-
return t;
|
|
115
|
-
const o = window.getComputedStyle(e, "::before"), s = window.getComputedStyle(e, "::after");
|
|
116
|
-
if (!(o.content !== "none" || s.content !== "none"))
|
|
117
|
-
return t;
|
|
118
|
-
const i = parseFloat(o.width) || 0, m = parseFloat(o.height) || 0, d = parseFloat(s.width) || 0, F = parseFloat(s.height) || 0, w = Math.max(t.width, i, d), v = Math.max(t.height, m, F), R = w - t.width, b = v - t.height;
|
|
119
|
-
return {
|
|
120
|
-
left: t.left - R / 2,
|
|
121
|
-
right: t.right + R / 2,
|
|
122
|
-
top: t.top - b / 2,
|
|
123
|
-
bottom: t.bottom + b / 2
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
const $e = "base-ui-disable-scrollbar", lt = {
|
|
127
|
-
className: $e,
|
|
128
|
-
element: /* @__PURE__ */ C("style", {
|
|
129
|
-
href: $e,
|
|
130
|
-
precedence: "base-ui:low",
|
|
131
|
-
children: `.${$e}{scrollbar-width:none}.${$e}::-webkit-scrollbar{display:none}`
|
|
132
|
-
})
|
|
133
|
-
}, ut = /* @__PURE__ */ n.createContext(null);
|
|
134
|
-
process.env.NODE_ENV !== "production" && (ut.displayName = "SelectRootContext");
|
|
135
|
-
const dt = /* @__PURE__ */ n.createContext(null);
|
|
136
|
-
process.env.NODE_ENV !== "production" && (dt.displayName = "SelectFloatingContext");
|
|
137
|
-
function Se() {
|
|
138
|
-
const e = n.useContext(ut);
|
|
139
|
-
if (e === null)
|
|
140
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>." : Ke(60));
|
|
141
|
-
return e;
|
|
142
|
-
}
|
|
143
|
-
function Vt() {
|
|
144
|
-
const e = n.useContext(dt);
|
|
145
|
-
if (e === null)
|
|
146
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>." : Ke(61));
|
|
147
|
-
return e;
|
|
148
|
-
}
|
|
149
|
-
const a = {
|
|
150
|
-
id: E((e) => e.id),
|
|
151
|
-
modal: E((e) => e.modal),
|
|
152
|
-
multiple: E((e) => e.multiple),
|
|
153
|
-
items: E((e) => e.items),
|
|
154
|
-
itemToStringLabel: E((e) => e.itemToStringLabel),
|
|
155
|
-
itemToStringValue: E((e) => e.itemToStringValue),
|
|
156
|
-
isItemEqualToValue: E((e) => e.isItemEqualToValue),
|
|
157
|
-
value: E((e) => e.value),
|
|
158
|
-
open: E((e) => e.open),
|
|
159
|
-
mounted: E((e) => e.mounted),
|
|
160
|
-
forceMount: E((e) => e.forceMount),
|
|
161
|
-
transitionStatus: E((e) => e.transitionStatus),
|
|
162
|
-
openMethod: E((e) => e.openMethod),
|
|
163
|
-
activeIndex: E((e) => e.activeIndex),
|
|
164
|
-
selectedIndex: E((e) => e.selectedIndex),
|
|
165
|
-
isActive: E((e, t) => e.activeIndex === t),
|
|
166
|
-
isSelected: E((e, t, o) => {
|
|
167
|
-
const s = e.isItemEqualToValue, r = e.value;
|
|
168
|
-
return e.multiple ? Array.isArray(r) && r.some((i) => Oe(i, o, s)) : e.selectedIndex === t && e.selectedIndex !== null ? !0 : Oe(r, o, s);
|
|
169
|
-
}),
|
|
170
|
-
isSelectedByFocus: E((e, t) => e.selectedIndex === t),
|
|
171
|
-
popupProps: E((e) => e.popupProps),
|
|
172
|
-
triggerProps: E((e) => e.triggerProps),
|
|
173
|
-
triggerElement: E((e) => e.triggerElement),
|
|
174
|
-
positionerElement: E((e) => e.positionerElement),
|
|
175
|
-
listElement: E((e) => e.listElement),
|
|
176
|
-
scrollUpArrowVisible: E((e) => e.scrollUpArrowVisible),
|
|
177
|
-
scrollDownArrowVisible: E((e) => e.scrollDownArrowVisible),
|
|
178
|
-
hasScrollArrows: E((e) => e.hasScrollArrows),
|
|
179
|
-
serializedValue: E((e) => {
|
|
180
|
-
const {
|
|
181
|
-
multiple: t,
|
|
182
|
-
value: o,
|
|
183
|
-
itemToStringValue: s
|
|
184
|
-
} = e;
|
|
185
|
-
return t && Array.isArray(o) && o.length === 0 ? "" : Ne(o, s);
|
|
186
|
-
})
|
|
187
|
-
};
|
|
188
|
-
function Ln(e) {
|
|
189
|
-
const {
|
|
190
|
-
id: t,
|
|
191
|
-
value: o,
|
|
192
|
-
defaultValue: s = null,
|
|
193
|
-
onValueChange: r,
|
|
194
|
-
open: i,
|
|
195
|
-
defaultOpen: m = !1,
|
|
196
|
-
onOpenChange: d,
|
|
197
|
-
name: F,
|
|
198
|
-
disabled: w = !1,
|
|
199
|
-
readOnly: v = !1,
|
|
200
|
-
required: R = !1,
|
|
201
|
-
modal: b = !0,
|
|
202
|
-
actionsRef: q,
|
|
203
|
-
inputRef: M,
|
|
204
|
-
onOpenChangeComplete: U,
|
|
205
|
-
items: L,
|
|
206
|
-
multiple: I = !1,
|
|
207
|
-
itemToStringLabel: V,
|
|
208
|
-
itemToStringValue: f,
|
|
209
|
-
isItemEqualToValue: X = On,
|
|
210
|
-
highlightItemOnHover: se = !0,
|
|
211
|
-
children: ie
|
|
212
|
-
} = e, {
|
|
213
|
-
clearErrors: P
|
|
214
|
-
} = nn(), {
|
|
215
|
-
setDirty: N,
|
|
216
|
-
shouldValidateOnChange: ce,
|
|
217
|
-
validityData: j,
|
|
218
|
-
setFilled: S,
|
|
219
|
-
name: G,
|
|
220
|
-
disabled: $,
|
|
221
|
-
validation: y
|
|
222
|
-
} = vt(), {
|
|
223
|
-
controlId: l
|
|
224
|
-
} = Et(), A = sn({
|
|
225
|
-
id: t
|
|
226
|
-
}), B = $ || w, O = G ?? F, [u, K] = ht({
|
|
227
|
-
controlled: o,
|
|
228
|
-
default: I ? s ?? gt : s,
|
|
229
|
-
name: "Select",
|
|
230
|
-
state: "value"
|
|
231
|
-
}), [T, Q] = ht({
|
|
232
|
-
controlled: i,
|
|
233
|
-
default: m,
|
|
234
|
-
name: "Select",
|
|
235
|
-
state: "open"
|
|
236
|
-
}), ee = n.useRef([]), te = n.useRef([]), z = n.useRef(null), c = n.useRef(null), g = n.useRef(0), D = n.useRef(null), H = n.useRef([]), Z = n.useRef(!1), le = n.useRef(!1), ne = n.useRef(null), oe = n.useRef({
|
|
237
|
-
allowSelectedMouseUp: !1,
|
|
238
|
-
allowUnselectedMouseUp: !1
|
|
239
|
-
}), Ie = n.useRef(!1), {
|
|
240
|
-
mounted: re,
|
|
241
|
-
setMounted: _,
|
|
242
|
-
transitionStatus: ae
|
|
243
|
-
} = wt(T), {
|
|
244
|
-
openMethod: pe,
|
|
245
|
-
triggerProps: k,
|
|
246
|
-
reset: W
|
|
247
|
-
} = dn(T), h = tn(() => new Gt({
|
|
248
|
-
id: A,
|
|
249
|
-
modal: b,
|
|
250
|
-
multiple: I,
|
|
251
|
-
itemToStringLabel: V,
|
|
252
|
-
itemToStringValue: f,
|
|
253
|
-
isItemEqualToValue: X,
|
|
254
|
-
value: u,
|
|
255
|
-
open: T,
|
|
256
|
-
mounted: re,
|
|
257
|
-
transitionStatus: ae,
|
|
258
|
-
items: L,
|
|
259
|
-
forceMount: !1,
|
|
260
|
-
openMethod: null,
|
|
261
|
-
activeIndex: null,
|
|
262
|
-
selectedIndex: null,
|
|
263
|
-
popupProps: {},
|
|
264
|
-
triggerProps: {},
|
|
265
|
-
triggerElement: null,
|
|
266
|
-
positionerElement: null,
|
|
267
|
-
listElement: null,
|
|
268
|
-
scrollUpArrowVisible: !1,
|
|
269
|
-
scrollDownArrowVisible: !1,
|
|
270
|
-
hasScrollArrows: !1
|
|
271
|
-
})).current, ue = p(h, a.activeIndex), me = p(h, a.selectedIndex), ge = p(h, a.triggerElement), J = p(h, a.positionerElement), De = n.useMemo(() => I && Array.isArray(u) && u.length === 0 ? "" : Ne(u, f), [I, u, f]), Ge = n.useMemo(() => I && Array.isArray(u) ? u.map((x) => Ne(x, f)) : Ne(u, f), [I, u, f]), We = ct(h.state.triggerElement);
|
|
272
|
-
on({
|
|
273
|
-
id: A,
|
|
274
|
-
commit: y.commit,
|
|
275
|
-
value: u,
|
|
276
|
-
controlRef: We,
|
|
277
|
-
name: O,
|
|
278
|
-
getValue: () => Ge
|
|
279
|
-
});
|
|
280
|
-
const He = n.useRef(u);
|
|
281
|
-
fe(() => {
|
|
282
|
-
u !== He.current && h.set("forceMount", !0);
|
|
283
|
-
}, [h, u]), fe(() => {
|
|
284
|
-
S(u !== null);
|
|
285
|
-
}, [u, S]), fe(function() {
|
|
286
|
-
if (T)
|
|
287
|
-
return;
|
|
288
|
-
const Y = H.current;
|
|
289
|
-
if (I) {
|
|
290
|
-
const we = Array.isArray(u) ? u : [];
|
|
291
|
-
if (we.length === 0) {
|
|
292
|
-
h.set("selectedIndex", null);
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
const be = we[we.length - 1], je = st(Y, be, X);
|
|
296
|
-
h.set("selectedIndex", je === -1 ? null : je);
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
const Ee = st(Y, u, X);
|
|
300
|
-
h.set("selectedIndex", Ee === -1 ? null : Ee);
|
|
301
|
-
}, [I, T, u, H, X, h]), un(u, () => {
|
|
302
|
-
P(O), N(u !== j.initialValue), ce() ? y.commit(u) : y.commit(u, !0);
|
|
303
|
-
});
|
|
304
|
-
const Te = ye((x, Y) => {
|
|
305
|
-
if (d?.(x, Y), !Y.isCanceled && (Q(x), !x && h.state.activeIndex !== null)) {
|
|
306
|
-
const Ee = ee.current[h.state.activeIndex];
|
|
307
|
-
queueMicrotask(() => {
|
|
308
|
-
Ee?.setAttribute("tabindex", "-1");
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
}), Ve = ye(() => {
|
|
312
|
-
_(!1), h.set("activeIndex", null), W(), U?.(!1);
|
|
313
|
-
});
|
|
314
|
-
at({
|
|
315
|
-
enabled: !q,
|
|
316
|
-
open: T,
|
|
317
|
-
ref: z,
|
|
318
|
-
onComplete() {
|
|
319
|
-
T || Ve();
|
|
320
|
-
}
|
|
321
|
-
}), n.useImperativeHandle(q, () => ({
|
|
322
|
-
unmount: Ve
|
|
323
|
-
}), [Ve]);
|
|
324
|
-
const ve = ye((x, Y) => {
|
|
325
|
-
r?.(x, Y), !Y.isCanceled && K(x);
|
|
326
|
-
}), de = ye(() => {
|
|
327
|
-
const x = h.state.listElement || z.current;
|
|
328
|
-
if (!x)
|
|
329
|
-
return;
|
|
330
|
-
const Y = x.scrollTop, Ee = x.scrollTop + x.clientHeight, we = Y > 1, be = Ee < x.scrollHeight - 1;
|
|
331
|
-
h.state.scrollUpArrowVisible !== we && h.set("scrollUpArrowVisible", we), h.state.scrollDownArrowVisible !== be && h.set("scrollDownArrowVisible", be);
|
|
332
|
-
}), he = hn({
|
|
333
|
-
open: T,
|
|
334
|
-
onOpenChange: Te,
|
|
335
|
-
elements: {
|
|
336
|
-
reference: ge,
|
|
337
|
-
floating: J
|
|
338
|
-
}
|
|
339
|
-
}), Fe = fn(he, {
|
|
340
|
-
enabled: !v && !B,
|
|
341
|
-
event: "mousedown"
|
|
342
|
-
}), ze = Xt(he, {
|
|
343
|
-
bubbles: !1
|
|
344
|
-
}), Je = xn(he, {
|
|
345
|
-
enabled: !v && !B,
|
|
346
|
-
listRef: ee,
|
|
347
|
-
activeIndex: ue,
|
|
348
|
-
selectedIndex: me,
|
|
349
|
-
disabledIndices: gt,
|
|
350
|
-
onNavigate(x) {
|
|
351
|
-
x === null && !T || h.set("activeIndex", x);
|
|
352
|
-
},
|
|
353
|
-
// Implement our own listeners since `onPointerLeave` on each option fires while scrolling with
|
|
354
|
-
// the `alignItemWithTrigger=true`, causing a performance issue on Chrome.
|
|
355
|
-
focusItemOnHover: !1
|
|
356
|
-
}), Ze = Rn(he, {
|
|
357
|
-
enabled: !v && !B && (T || !I),
|
|
358
|
-
listRef: te,
|
|
359
|
-
activeIndex: ue,
|
|
360
|
-
selectedIndex: me,
|
|
361
|
-
onMatch(x) {
|
|
362
|
-
T ? h.set("activeIndex", x) : ve(H.current[x], xe("none"));
|
|
363
|
-
},
|
|
364
|
-
onTypingChange(x) {
|
|
365
|
-
Z.current = x;
|
|
366
|
-
}
|
|
367
|
-
}), {
|
|
368
|
-
getReferenceProps: Be,
|
|
369
|
-
getFloatingProps: Ce,
|
|
370
|
-
getItemProps: qe
|
|
371
|
-
} = Kt([Fe, ze, Je, Ze]), Ue = n.useMemo(() => St(Be(), k), [Be, k]);
|
|
372
|
-
Pn(() => {
|
|
373
|
-
h.update({
|
|
374
|
-
popupProps: Ce(),
|
|
375
|
-
triggerProps: Ue
|
|
376
|
-
});
|
|
377
|
-
}), fe(() => {
|
|
378
|
-
h.update({
|
|
379
|
-
id: A,
|
|
380
|
-
modal: b,
|
|
381
|
-
multiple: I,
|
|
382
|
-
value: u,
|
|
383
|
-
open: T,
|
|
384
|
-
mounted: re,
|
|
385
|
-
transitionStatus: ae,
|
|
386
|
-
popupProps: Ce(),
|
|
387
|
-
triggerProps: Ue,
|
|
388
|
-
items: L,
|
|
389
|
-
itemToStringLabel: V,
|
|
390
|
-
itemToStringValue: f,
|
|
391
|
-
isItemEqualToValue: X,
|
|
392
|
-
openMethod: pe
|
|
393
|
-
});
|
|
394
|
-
}, [h, A, b, I, u, T, re, ae, Ce, Ue, L, V, f, X, pe]);
|
|
395
|
-
const Me = n.useMemo(() => ({
|
|
396
|
-
store: h,
|
|
397
|
-
name: O,
|
|
398
|
-
required: R,
|
|
399
|
-
disabled: B,
|
|
400
|
-
readOnly: v,
|
|
401
|
-
multiple: I,
|
|
402
|
-
itemToStringLabel: V,
|
|
403
|
-
itemToStringValue: f,
|
|
404
|
-
highlightItemOnHover: se,
|
|
405
|
-
setValue: ve,
|
|
406
|
-
setOpen: Te,
|
|
407
|
-
listRef: ee,
|
|
408
|
-
popupRef: z,
|
|
409
|
-
scrollHandlerRef: c,
|
|
410
|
-
handleScrollArrowVisibility: de,
|
|
411
|
-
scrollArrowsMountedCountRef: g,
|
|
412
|
-
getItemProps: qe,
|
|
413
|
-
events: he.context.events,
|
|
414
|
-
valueRef: D,
|
|
415
|
-
valuesRef: H,
|
|
416
|
-
labelsRef: te,
|
|
417
|
-
typingRef: Z,
|
|
418
|
-
selectionRef: oe,
|
|
419
|
-
selectedItemTextRef: ne,
|
|
420
|
-
validation: y,
|
|
421
|
-
onOpenChangeComplete: U,
|
|
422
|
-
keyboardActiveRef: le,
|
|
423
|
-
alignItemWithTriggerActiveRef: Ie,
|
|
424
|
-
initialValueRef: He
|
|
425
|
-
}), [h, O, R, B, v, I, V, f, se, ve, Te, qe, he.context.events, y, U, de]), Le = It(M, y.inputRef), Qe = I && Array.isArray(u) && u.length > 0, et = n.useMemo(() => !I || !Array.isArray(u) || !O ? null : u.map((x) => {
|
|
426
|
-
const Y = Ne(x, f);
|
|
427
|
-
return /* @__PURE__ */ C("input", {
|
|
428
|
-
type: "hidden",
|
|
429
|
-
name: O,
|
|
430
|
-
value: Y
|
|
431
|
-
}, Y);
|
|
432
|
-
}), [I, u, O, f]);
|
|
433
|
-
return /* @__PURE__ */ C(ut.Provider, {
|
|
434
|
-
value: Me,
|
|
435
|
-
children: /* @__PURE__ */ Ae(dt.Provider, {
|
|
436
|
-
value: he,
|
|
437
|
-
children: [ie, /* @__PURE__ */ C("input", {
|
|
438
|
-
...y.getInputValidationProps({
|
|
439
|
-
onFocus() {
|
|
440
|
-
h.state.triggerElement?.focus();
|
|
441
|
-
},
|
|
442
|
-
// Handle browser autofill.
|
|
443
|
-
onChange(x) {
|
|
444
|
-
if (x.nativeEvent.defaultPrevented)
|
|
445
|
-
return;
|
|
446
|
-
const Y = x.target.value, Ee = xe(Mt, x.nativeEvent);
|
|
447
|
-
function we() {
|
|
448
|
-
if (I)
|
|
449
|
-
return;
|
|
450
|
-
const be = H.current.find((je) => Ne(je, f).toLowerCase() === Y.toLowerCase());
|
|
451
|
-
be != null && (N(be !== j.initialValue), ve(be, Ee), ce() && y.commit(be));
|
|
452
|
-
}
|
|
453
|
-
h.set("forceMount", !0), queueMicrotask(we);
|
|
454
|
-
}
|
|
455
|
-
}),
|
|
456
|
-
id: t || l || void 0,
|
|
457
|
-
name: I ? void 0 : O,
|
|
458
|
-
value: De,
|
|
459
|
-
disabled: B,
|
|
460
|
-
required: R && !Qe,
|
|
461
|
-
readOnly: v,
|
|
462
|
-
ref: Le,
|
|
463
|
-
style: en,
|
|
464
|
-
tabIndex: -1,
|
|
465
|
-
"aria-hidden": !0
|
|
466
|
-
}), et]
|
|
467
|
-
})
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
const Ye = 2, kn = {
|
|
471
|
-
...Jt,
|
|
472
|
-
...rn,
|
|
473
|
-
value: () => null
|
|
474
|
-
}, Ct = /* @__PURE__ */ n.forwardRef(function(t, o) {
|
|
475
|
-
const {
|
|
476
|
-
render: s,
|
|
477
|
-
className: r,
|
|
478
|
-
disabled: i = !1,
|
|
479
|
-
nativeButton: m = !0,
|
|
480
|
-
...d
|
|
481
|
-
} = t, {
|
|
482
|
-
setTouched: F,
|
|
483
|
-
setFocused: w,
|
|
484
|
-
validationMode: v,
|
|
485
|
-
state: R,
|
|
486
|
-
disabled: b
|
|
487
|
-
} = vt(), {
|
|
488
|
-
labelId: q
|
|
489
|
-
} = Et(), {
|
|
490
|
-
store: M,
|
|
491
|
-
setOpen: U,
|
|
492
|
-
selectionRef: L,
|
|
493
|
-
validation: I,
|
|
494
|
-
readOnly: V,
|
|
495
|
-
alignItemWithTriggerActiveRef: f,
|
|
496
|
-
disabled: X,
|
|
497
|
-
keyboardActiveRef: se
|
|
498
|
-
} = Se(), ie = b || X || i, P = p(M, a.open), N = p(M, a.value), ce = p(M, a.triggerProps), j = p(M, a.positionerElement), S = p(M, a.listElement), G = p(M, a.serializedValue), $ = ct(j), y = n.useRef(null), l = _e(), A = _e(), {
|
|
499
|
-
getButtonProps: B,
|
|
500
|
-
buttonRef: O
|
|
501
|
-
} = Tt({
|
|
502
|
-
disabled: ie,
|
|
503
|
-
native: m
|
|
504
|
-
}), u = ye((c) => {
|
|
505
|
-
M.set("triggerElement", c);
|
|
506
|
-
}), K = It(o, y, O, u), T = _e(), Q = _e();
|
|
507
|
-
n.useEffect(() => {
|
|
508
|
-
if (P)
|
|
509
|
-
return Q.start(200, () => {
|
|
510
|
-
L.current.allowUnselectedMouseUp = !0, T.start(200, () => {
|
|
511
|
-
L.current.allowSelectedMouseUp = !0;
|
|
512
|
-
});
|
|
513
|
-
}), () => {
|
|
514
|
-
T.clear(), Q.clear();
|
|
515
|
-
};
|
|
516
|
-
L.current = {
|
|
517
|
-
allowSelectedMouseUp: !1,
|
|
518
|
-
allowUnselectedMouseUp: !1
|
|
519
|
-
}, A.clear();
|
|
520
|
-
}, [P, L, A, T, Q]);
|
|
521
|
-
const ee = n.useMemo(() => S?.id ?? Sn(j)?.id, [S, j]), te = St(ce, {
|
|
522
|
-
role: "combobox",
|
|
523
|
-
"aria-expanded": P ? "true" : "false",
|
|
524
|
-
"aria-haspopup": "listbox",
|
|
525
|
-
"aria-controls": P ? ee : void 0,
|
|
526
|
-
"aria-labelledby": q,
|
|
527
|
-
"aria-readonly": V || void 0,
|
|
528
|
-
tabIndex: ie ? -1 : 0,
|
|
529
|
-
ref: K,
|
|
530
|
-
onFocus(c) {
|
|
531
|
-
w(!0), P && f.current && U(!1, xe(ln, c.nativeEvent)), l.start(0, () => {
|
|
532
|
-
M.set("forceMount", !0);
|
|
533
|
-
});
|
|
534
|
-
},
|
|
535
|
-
onBlur() {
|
|
536
|
-
F(!0), w(!1), v === "onBlur" && I.commit(N);
|
|
537
|
-
},
|
|
538
|
-
onPointerMove() {
|
|
539
|
-
se.current = !1;
|
|
540
|
-
},
|
|
541
|
-
onKeyDown() {
|
|
542
|
-
se.current = !0;
|
|
543
|
-
},
|
|
544
|
-
onMouseDown(c) {
|
|
545
|
-
if (P)
|
|
546
|
-
return;
|
|
547
|
-
const g = rt(c.currentTarget);
|
|
548
|
-
function D(H) {
|
|
549
|
-
if (!y.current)
|
|
550
|
-
return;
|
|
551
|
-
const Z = H.target;
|
|
552
|
-
if (bt(y.current, Z) || bt($.current, Z) || Z === y.current)
|
|
553
|
-
return;
|
|
554
|
-
const le = Un(y.current);
|
|
555
|
-
H.clientX >= le.left - Ye && H.clientX <= le.right + Ye && H.clientY >= le.top - Ye && H.clientY <= le.bottom + Ye || U(!1, xe(cn, H));
|
|
556
|
-
}
|
|
557
|
-
A.start(0, () => {
|
|
558
|
-
g.addEventListener("mouseup", D, {
|
|
559
|
-
once: !0
|
|
560
|
-
});
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
}, I.getValidationProps, d, B);
|
|
564
|
-
te.role = "combobox";
|
|
565
|
-
const z = n.useMemo(() => ({
|
|
566
|
-
...R,
|
|
567
|
-
open: P,
|
|
568
|
-
disabled: ie,
|
|
569
|
-
value: N,
|
|
570
|
-
readOnly: V,
|
|
571
|
-
placeholder: !G
|
|
572
|
-
}), [R, P, ie, N, V, G]);
|
|
573
|
-
return Re("button", t, {
|
|
574
|
-
ref: [o, y],
|
|
575
|
-
state: z,
|
|
576
|
-
stateAttributesMapping: kn,
|
|
577
|
-
props: te
|
|
578
|
-
});
|
|
579
|
-
});
|
|
580
|
-
process.env.NODE_ENV !== "production" && (Ct.displayName = "SelectTrigger");
|
|
581
|
-
const Wn = {
|
|
582
|
-
value: () => null
|
|
583
|
-
}, Nt = /* @__PURE__ */ n.forwardRef(function(t, o) {
|
|
584
|
-
const {
|
|
585
|
-
className: s,
|
|
586
|
-
render: r,
|
|
587
|
-
children: i,
|
|
588
|
-
...m
|
|
589
|
-
} = t, {
|
|
590
|
-
store: d,
|
|
591
|
-
valueRef: F
|
|
592
|
-
} = Se(), w = p(d, a.value), v = p(d, a.items), R = p(d, a.itemToStringLabel), b = p(d, a.serializedValue), q = n.useMemo(() => ({
|
|
593
|
-
value: w,
|
|
594
|
-
placeholder: !b
|
|
595
|
-
}), [w, b]), M = typeof i == "function" ? i(w) : i ?? (Array.isArray(w) ? Bn(w, R) : Fn(w, v, R));
|
|
596
|
-
return Re("span", t, {
|
|
597
|
-
state: q,
|
|
598
|
-
ref: [o, F],
|
|
599
|
-
props: [{
|
|
600
|
-
children: M
|
|
601
|
-
}, m],
|
|
602
|
-
stateAttributesMapping: Wn
|
|
603
|
-
});
|
|
604
|
-
});
|
|
605
|
-
process.env.NODE_ENV !== "production" && (Nt.displayName = "SelectValue");
|
|
606
|
-
const _t = /* @__PURE__ */ n.forwardRef(function(t, o) {
|
|
607
|
-
const {
|
|
608
|
-
className: s,
|
|
609
|
-
render: r,
|
|
610
|
-
...i
|
|
611
|
-
} = t, {
|
|
612
|
-
store: m
|
|
613
|
-
} = Se(), d = p(m, a.open), F = n.useMemo(() => ({
|
|
614
|
-
open: d
|
|
615
|
-
}), [d]);
|
|
616
|
-
return Re("span", t, {
|
|
617
|
-
state: F,
|
|
618
|
-
ref: o,
|
|
619
|
-
props: [{
|
|
620
|
-
"aria-hidden": !0,
|
|
621
|
-
children: "▼"
|
|
622
|
-
}, i],
|
|
623
|
-
stateAttributesMapping: Zt
|
|
624
|
-
});
|
|
625
|
-
});
|
|
626
|
-
process.env.NODE_ENV !== "production" && (_t.displayName = "SelectIcon");
|
|
627
|
-
const Pt = /* @__PURE__ */ n.createContext(void 0);
|
|
628
|
-
process.env.NODE_ENV !== "production" && (Pt.displayName = "SelectPortalContext");
|
|
629
|
-
const Ot = /* @__PURE__ */ n.forwardRef(function(t, o) {
|
|
630
|
-
const {
|
|
631
|
-
store: s
|
|
632
|
-
} = Se(), r = p(s, a.mounted), i = p(s, a.forceMount);
|
|
633
|
-
return r || i ? /* @__PURE__ */ C(Pt.Provider, {
|
|
634
|
-
value: !0,
|
|
635
|
-
children: /* @__PURE__ */ C(In, {
|
|
636
|
-
ref: o,
|
|
637
|
-
...t
|
|
638
|
-
})
|
|
639
|
-
}) : null;
|
|
640
|
-
});
|
|
641
|
-
process.env.NODE_ENV !== "production" && (Ot.displayName = "SelectPortal");
|
|
642
|
-
const ft = /* @__PURE__ */ n.createContext(void 0);
|
|
643
|
-
process.env.NODE_ENV !== "production" && (ft.displayName = "SelectPositionerContext");
|
|
644
|
-
function Dt() {
|
|
645
|
-
const e = n.useContext(ft);
|
|
646
|
-
if (!e)
|
|
647
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>." : Ke(59));
|
|
648
|
-
return e;
|
|
649
|
-
}
|
|
650
|
-
function Xe(e, t) {
|
|
651
|
-
e && Object.assign(e.style, t);
|
|
652
|
-
}
|
|
653
|
-
const Ht = {
|
|
654
|
-
position: "relative",
|
|
655
|
-
maxHeight: "100%",
|
|
656
|
-
overflowX: "hidden",
|
|
657
|
-
overflowY: "auto"
|
|
658
|
-
}, zn = {
|
|
659
|
-
position: "fixed"
|
|
660
|
-
}, Ft = /* @__PURE__ */ n.forwardRef(function(t, o) {
|
|
661
|
-
const {
|
|
662
|
-
anchor: s,
|
|
663
|
-
positionMethod: r = "absolute",
|
|
664
|
-
className: i,
|
|
665
|
-
render: m,
|
|
666
|
-
side: d = "bottom",
|
|
667
|
-
align: F = "center",
|
|
668
|
-
sideOffset: w = 0,
|
|
669
|
-
alignOffset: v = 0,
|
|
670
|
-
collisionBoundary: R = "clipping-ancestors",
|
|
671
|
-
collisionPadding: b,
|
|
672
|
-
arrowPadding: q = 5,
|
|
673
|
-
sticky: M = !1,
|
|
674
|
-
disableAnchorTracking: U,
|
|
675
|
-
alignItemWithTrigger: L = !0,
|
|
676
|
-
collisionAvoidance: I = vn,
|
|
677
|
-
...V
|
|
678
|
-
} = t, {
|
|
679
|
-
store: f,
|
|
680
|
-
listRef: X,
|
|
681
|
-
labelsRef: se,
|
|
682
|
-
alignItemWithTriggerActiveRef: ie,
|
|
683
|
-
selectedItemTextRef: P,
|
|
684
|
-
valuesRef: N,
|
|
685
|
-
initialValueRef: ce,
|
|
686
|
-
popupRef: j,
|
|
687
|
-
setValue: S
|
|
688
|
-
} = Se(), G = Vt(), $ = p(f, a.open), y = p(f, a.mounted), l = p(f, a.modal), A = p(f, a.value), B = p(f, a.openMethod), O = p(f, a.positionerElement), u = p(f, a.triggerElement), K = p(f, a.isItemEqualToValue), T = n.useRef(null), Q = n.useRef(null), [ee, te] = n.useState(L), z = y && ee && B !== "touch";
|
|
689
|
-
!y && ee !== L && te(L), fe(() => {
|
|
690
|
-
y || (a.scrollUpArrowVisible(f.state) && f.set("scrollUpArrowVisible", !1), a.scrollDownArrowVisible(f.state) && f.set("scrollDownArrowVisible", !1));
|
|
691
|
-
}, [f, y]), n.useImperativeHandle(ie, () => z), pn((z || l) && $ && B !== "touch", u);
|
|
692
|
-
const c = bn({
|
|
693
|
-
anchor: s,
|
|
694
|
-
floatingRootContext: G,
|
|
695
|
-
positionMethod: r,
|
|
696
|
-
mounted: y,
|
|
697
|
-
side: d,
|
|
698
|
-
sideOffset: w,
|
|
699
|
-
align: F,
|
|
700
|
-
alignOffset: v,
|
|
701
|
-
arrowPadding: q,
|
|
702
|
-
collisionBoundary: R,
|
|
703
|
-
collisionPadding: b,
|
|
704
|
-
sticky: M,
|
|
705
|
-
disableAnchorTracking: U ?? z,
|
|
706
|
-
collisionAvoidance: I,
|
|
707
|
-
keepMounted: !0
|
|
708
|
-
}), g = z ? "none" : c.side, D = z ? zn : c.positionerStyles, H = n.useMemo(() => {
|
|
709
|
-
const _ = {};
|
|
710
|
-
return $ || (_.pointerEvents = "none"), {
|
|
711
|
-
role: "presentation",
|
|
712
|
-
hidden: !y,
|
|
713
|
-
style: {
|
|
714
|
-
...D,
|
|
715
|
-
..._
|
|
716
|
-
}
|
|
717
|
-
};
|
|
718
|
-
}, [$, y, D]), Z = n.useMemo(() => ({
|
|
719
|
-
open: $,
|
|
720
|
-
side: g,
|
|
721
|
-
align: c.align,
|
|
722
|
-
anchorHidden: c.anchorHidden
|
|
723
|
-
}), [$, g, c.align, c.anchorHidden]), le = ye((_) => {
|
|
724
|
-
f.set("positionerElement", _);
|
|
725
|
-
}), ne = Re("div", t, {
|
|
726
|
-
ref: [o, le],
|
|
727
|
-
state: Z,
|
|
728
|
-
stateAttributesMapping: Rt,
|
|
729
|
-
props: [H, V]
|
|
730
|
-
}), oe = n.useRef(0), Ie = ye((_) => {
|
|
731
|
-
if (_.size === 0 && oe.current === 0 || N.current.length === 0)
|
|
732
|
-
return;
|
|
733
|
-
const ae = oe.current;
|
|
734
|
-
if (oe.current = _.size, _.size === ae)
|
|
735
|
-
return;
|
|
736
|
-
const pe = xe(Mt);
|
|
737
|
-
if (ae !== 0 && !f.state.multiple && A !== null && st(N.current, A, K) === -1) {
|
|
738
|
-
const W = ce.current, ue = W != null && nt(N.current, W, K) ? W : null;
|
|
739
|
-
S(ue, pe), ue === null && (f.set("selectedIndex", null), P.current = null);
|
|
740
|
-
}
|
|
741
|
-
if (ae !== 0 && f.state.multiple && Array.isArray(A)) {
|
|
742
|
-
const k = A.filter((W) => nt(N.current, W, K));
|
|
743
|
-
(k.length !== A.length || k.some((W) => !nt(A, W, K))) && (S(k, pe), k.length === 0 && (f.set("selectedIndex", null), P.current = null));
|
|
744
|
-
}
|
|
745
|
-
if ($ && z) {
|
|
746
|
-
f.update({
|
|
747
|
-
scrollUpArrowVisible: !1,
|
|
748
|
-
scrollDownArrowVisible: !1
|
|
749
|
-
});
|
|
750
|
-
const k = {
|
|
751
|
-
height: ""
|
|
752
|
-
};
|
|
753
|
-
Xe(O, k), Xe(j.current, k);
|
|
754
|
-
}
|
|
755
|
-
}), re = n.useMemo(() => ({
|
|
756
|
-
...c,
|
|
757
|
-
side: g,
|
|
758
|
-
alignItemWithTriggerActive: z,
|
|
759
|
-
setControlledAlignItemWithTrigger: te,
|
|
760
|
-
scrollUpArrowRef: T,
|
|
761
|
-
scrollDownArrowRef: Q
|
|
762
|
-
}), [c, g, z, te]);
|
|
763
|
-
return /* @__PURE__ */ C(wn, {
|
|
764
|
-
elementsRef: X,
|
|
765
|
-
labelsRef: se,
|
|
766
|
-
onMapChange: Ie,
|
|
767
|
-
children: /* @__PURE__ */ Ae(ft.Provider, {
|
|
768
|
-
value: re,
|
|
769
|
-
children: [y && l && /* @__PURE__ */ C(mn, {
|
|
770
|
-
inert: En(!$),
|
|
771
|
-
cutout: u
|
|
772
|
-
}), ne]
|
|
773
|
-
})
|
|
774
|
-
});
|
|
775
|
-
});
|
|
776
|
-
process.env.NODE_ENV !== "production" && (Ft.displayName = "SelectPositioner");
|
|
777
|
-
function Bt(e) {
|
|
778
|
-
const t = e.currentTarget.getBoundingClientRect();
|
|
779
|
-
return t.top + 1 <= e.clientY && e.clientY <= t.bottom - 1 && t.left + 1 <= e.clientX && e.clientX <= t.right - 1;
|
|
780
|
-
}
|
|
781
|
-
const qn = {
|
|
782
|
-
...Rt,
|
|
783
|
-
...At
|
|
784
|
-
}, Ut = /* @__PURE__ */ n.forwardRef(function(t, o) {
|
|
785
|
-
const {
|
|
786
|
-
render: s,
|
|
787
|
-
className: r,
|
|
788
|
-
...i
|
|
789
|
-
} = t, {
|
|
790
|
-
store: m,
|
|
791
|
-
popupRef: d,
|
|
792
|
-
onOpenChangeComplete: F,
|
|
793
|
-
setOpen: w,
|
|
794
|
-
valueRef: v,
|
|
795
|
-
selectedItemTextRef: R,
|
|
796
|
-
keyboardActiveRef: b,
|
|
797
|
-
multiple: q,
|
|
798
|
-
handleScrollArrowVisibility: M,
|
|
799
|
-
scrollHandlerRef: U
|
|
800
|
-
} = Se(), {
|
|
801
|
-
side: L,
|
|
802
|
-
align: I,
|
|
803
|
-
alignItemWithTriggerActive: V,
|
|
804
|
-
setControlledAlignItemWithTrigger: f,
|
|
805
|
-
scrollDownArrowRef: X,
|
|
806
|
-
scrollUpArrowRef: se
|
|
807
|
-
} = Dt(), ie = Nn() != null, P = Vt(), N = _e(), ce = p(m, a.id), j = p(m, a.open), S = p(m, a.mounted), G = p(m, a.popupProps), $ = p(m, a.transitionStatus), y = p(m, a.triggerElement), l = p(m, a.positionerElement), A = p(m, a.listElement), B = n.useRef(0), O = n.useRef(!1), u = n.useRef(0), K = n.useRef(!1), T = n.useRef({}), Q = Cn(), ee = ye((g) => {
|
|
808
|
-
if (!l || !d.current || !K.current)
|
|
809
|
-
return;
|
|
810
|
-
if (O.current || !V) {
|
|
811
|
-
M();
|
|
812
|
-
return;
|
|
813
|
-
}
|
|
814
|
-
const D = l.style.top === "0px", H = l.style.bottom === "0px", Z = l.getBoundingClientRect().height, le = rt(l), ne = getComputedStyle(l), oe = parseFloat(ne.marginTop), Ie = parseFloat(ne.marginBottom), re = le.documentElement.clientHeight - oe - Ie, _ = g.scrollTop, ae = g.scrollHeight, pe = g.clientHeight, k = ae - pe;
|
|
815
|
-
let W = null, h = null, ue = !1;
|
|
816
|
-
if (D) {
|
|
817
|
-
const me = k - _, ge = Z + me, J = Math.min(ge, re);
|
|
818
|
-
W = J, J !== re ? h = k : ue = !0;
|
|
819
|
-
} else if (H) {
|
|
820
|
-
const me = _ - 0, ge = Z + me, J = Math.min(ge, re), De = ge - re;
|
|
821
|
-
W = J, J !== re ? h = 0 : (ue = !0, _ < k && (h = _ - (me - De)));
|
|
822
|
-
}
|
|
823
|
-
W != null && (l.style.height = `${W}px`), h != null && (g.scrollTop = h), ue && (O.current = !0), M();
|
|
824
|
-
});
|
|
825
|
-
n.useImperativeHandle(U, () => ee, [ee]), at({
|
|
826
|
-
open: j,
|
|
827
|
-
ref: d,
|
|
828
|
-
onComplete() {
|
|
829
|
-
j && F?.(!0);
|
|
830
|
-
}
|
|
831
|
-
});
|
|
832
|
-
const te = n.useMemo(() => ({
|
|
833
|
-
open: j,
|
|
834
|
-
transitionStatus: $,
|
|
835
|
-
side: L,
|
|
836
|
-
align: I
|
|
837
|
-
}), [j, $, L, I]);
|
|
838
|
-
fe(() => {
|
|
839
|
-
!l || !d.current || Object.keys(T.current).length || (T.current = {
|
|
840
|
-
top: l.style.top || "0",
|
|
841
|
-
left: l.style.left || "0",
|
|
842
|
-
right: l.style.right,
|
|
843
|
-
height: l.style.height,
|
|
844
|
-
bottom: l.style.bottom,
|
|
845
|
-
minHeight: l.style.minHeight,
|
|
846
|
-
maxHeight: l.style.maxHeight,
|
|
847
|
-
marginTop: l.style.marginTop,
|
|
848
|
-
marginBottom: l.style.marginBottom
|
|
849
|
-
});
|
|
850
|
-
}, [d, l]), fe(() => {
|
|
851
|
-
S || V || (K.current = !1, O.current = !1, B.current = 0, u.current = 0, Xe(l, T.current));
|
|
852
|
-
}, [S, V, l, d]), fe(() => {
|
|
853
|
-
const g = d.current;
|
|
854
|
-
if (!(!S || !y || !l || !g)) {
|
|
855
|
-
if (!V) {
|
|
856
|
-
K.current = !0, Q.request(M);
|
|
857
|
-
return;
|
|
858
|
-
}
|
|
859
|
-
queueMicrotask(() => {
|
|
860
|
-
const D = getComputedStyle(l), H = getComputedStyle(g), Z = rt(y), le = yt(l), ne = y.getBoundingClientRect(), oe = l.getBoundingClientRect(), Ie = ne.left, re = ne.height, _ = A || g, ae = _.scrollHeight, pe = parseFloat(H.borderBottomWidth), k = parseFloat(D.marginTop) || 10, W = parseFloat(D.marginBottom) || 10, h = parseFloat(D.minHeight) || 100, ue = 5, me = 5, ge = 20, J = Z.documentElement.clientHeight - k - W, De = Z.documentElement.clientWidth, Ge = J - ne.bottom + re, We = R.current, He = v.current;
|
|
861
|
-
let Te = 0, Ve = 0;
|
|
862
|
-
if (We && He) {
|
|
863
|
-
const Me = He.getBoundingClientRect(), Le = We.getBoundingClientRect(), Qe = Me.left - Ie, et = Le.left - oe.left, x = Me.top - ne.top + Me.height / 2, Y = Le.top - oe.top + Le.height / 2;
|
|
864
|
-
Te = Qe - et, Ve = Y - x;
|
|
865
|
-
}
|
|
866
|
-
const ve = Ge + Ve + W + pe;
|
|
867
|
-
let de = Math.min(J, ve);
|
|
868
|
-
const he = J - k - W, Fe = ve - de, ze = Math.max(ue, Ie + Te), Je = De - me, Ze = Math.max(0, ze + oe.width - Je);
|
|
869
|
-
l.style.left = `${ze - Ze}px`, l.style.height = `${de}px`, l.style.maxHeight = "auto", l.style.marginTop = `${k}px`, l.style.marginBottom = `${W}px`, g.style.height = "100%";
|
|
870
|
-
const Be = _.scrollHeight - _.clientHeight, Ce = Fe >= Be;
|
|
871
|
-
Ce && (de = Math.min(J, oe.height) - (Fe - Be));
|
|
872
|
-
const qe = ne.top < ge || ne.bottom > J - ge || de < Math.min(ae, h), Ue = (le.visualViewport?.scale ?? 1) !== 1 && Vn;
|
|
873
|
-
if (qe || Ue) {
|
|
874
|
-
K.current = !0, Xe(l, T.current), Tn.flushSync(() => f(!1));
|
|
875
|
-
return;
|
|
876
|
-
}
|
|
877
|
-
if (Ce) {
|
|
878
|
-
const Me = Math.max(0, J - ve);
|
|
879
|
-
l.style.top = oe.height >= he ? "0" : `${Me}px`, l.style.height = `${de}px`, _.scrollTop = _.scrollHeight - _.clientHeight, B.current = Math.max(h, de);
|
|
880
|
-
} else
|
|
881
|
-
l.style.bottom = "0", B.current = Math.max(h, de), _.scrollTop = Fe;
|
|
882
|
-
B.current === J && (O.current = !0), M(), setTimeout(() => {
|
|
883
|
-
K.current = !0;
|
|
884
|
-
});
|
|
885
|
-
});
|
|
886
|
-
}
|
|
887
|
-
}, [m, S, l, y, v, R, d, M, V, f, Q, X, se, A]), n.useEffect(() => {
|
|
888
|
-
if (!V || !l || !S)
|
|
889
|
-
return;
|
|
890
|
-
const g = yt(l);
|
|
891
|
-
function D(H) {
|
|
892
|
-
w(!1, xe(an, H));
|
|
893
|
-
}
|
|
894
|
-
return g.addEventListener("resize", D), () => {
|
|
895
|
-
g.removeEventListener("resize", D);
|
|
896
|
-
};
|
|
897
|
-
}, [w, V, l, S]);
|
|
898
|
-
const z = {
|
|
899
|
-
...A ? {
|
|
900
|
-
role: "presentation",
|
|
901
|
-
"aria-orientation": void 0
|
|
902
|
-
} : {
|
|
903
|
-
role: "listbox",
|
|
904
|
-
"aria-multiselectable": q || void 0,
|
|
905
|
-
id: `${ce}-list`
|
|
906
|
-
},
|
|
907
|
-
onKeyDown(g) {
|
|
908
|
-
b.current = !0, ie && _n.has(g.key) && g.stopPropagation();
|
|
909
|
-
},
|
|
910
|
-
onMouseMove() {
|
|
911
|
-
b.current = !1;
|
|
912
|
-
},
|
|
913
|
-
onPointerLeave(g) {
|
|
914
|
-
if (Bt(g) || g.pointerType === "touch")
|
|
915
|
-
return;
|
|
916
|
-
const D = g.currentTarget;
|
|
917
|
-
N.start(0, () => {
|
|
918
|
-
m.set("activeIndex", null), D.focus({
|
|
919
|
-
preventScroll: !0
|
|
920
|
-
});
|
|
921
|
-
});
|
|
922
|
-
},
|
|
923
|
-
onScroll(g) {
|
|
924
|
-
A || U.current?.(g.currentTarget);
|
|
925
|
-
},
|
|
926
|
-
...V && {
|
|
927
|
-
style: A ? {
|
|
928
|
-
height: "100%"
|
|
929
|
-
} : Ht
|
|
930
|
-
}
|
|
931
|
-
}, c = Re("div", t, {
|
|
932
|
-
ref: [o, d],
|
|
933
|
-
state: te,
|
|
934
|
-
stateAttributesMapping: qn,
|
|
935
|
-
props: [G, z, yn($), {
|
|
936
|
-
className: !A && V ? lt.className : void 0
|
|
937
|
-
}, i]
|
|
938
|
-
});
|
|
939
|
-
return /* @__PURE__ */ Ae(n.Fragment, {
|
|
940
|
-
children: [lt.element, /* @__PURE__ */ C(gn, {
|
|
941
|
-
context: P,
|
|
942
|
-
modal: !1,
|
|
943
|
-
disabled: !S,
|
|
944
|
-
restoreFocus: !0,
|
|
945
|
-
children: c
|
|
946
|
-
})]
|
|
947
|
-
});
|
|
948
|
-
});
|
|
949
|
-
process.env.NODE_ENV !== "production" && (Ut.displayName = "SelectPopup");
|
|
950
|
-
const Lt = /* @__PURE__ */ n.forwardRef(function(t, o) {
|
|
951
|
-
const {
|
|
952
|
-
className: s,
|
|
953
|
-
render: r,
|
|
954
|
-
...i
|
|
955
|
-
} = t, {
|
|
956
|
-
store: m,
|
|
957
|
-
scrollHandlerRef: d
|
|
958
|
-
} = Se(), {
|
|
959
|
-
alignItemWithTriggerActive: F
|
|
960
|
-
} = Dt(), w = p(m, a.hasScrollArrows), v = p(m, a.openMethod), R = p(m, a.multiple), q = {
|
|
961
|
-
id: `${p(m, a.id)}-list`,
|
|
962
|
-
role: "listbox",
|
|
963
|
-
"aria-multiselectable": R || void 0,
|
|
964
|
-
onScroll(U) {
|
|
965
|
-
d.current?.(U.currentTarget);
|
|
966
|
-
},
|
|
967
|
-
...F && {
|
|
968
|
-
style: Ht
|
|
969
|
-
},
|
|
970
|
-
className: w && v !== "touch" ? lt.className : void 0
|
|
971
|
-
}, M = ye((U) => {
|
|
972
|
-
m.set("listElement", U);
|
|
973
|
-
});
|
|
974
|
-
return Re("div", t, {
|
|
975
|
-
ref: [o, M],
|
|
976
|
-
props: [q, i]
|
|
977
|
-
});
|
|
978
|
-
});
|
|
979
|
-
process.env.NODE_ENV !== "production" && (Lt.displayName = "SelectList");
|
|
980
|
-
const pt = /* @__PURE__ */ n.createContext(void 0);
|
|
981
|
-
process.env.NODE_ENV !== "production" && (pt.displayName = "SelectItemContext");
|
|
982
|
-
function mt() {
|
|
983
|
-
const e = n.useContext(pt);
|
|
984
|
-
if (!e)
|
|
985
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>." : Ke(57));
|
|
986
|
-
return e;
|
|
987
|
-
}
|
|
988
|
-
const kt = /* @__PURE__ */ n.memo(/* @__PURE__ */ n.forwardRef(function(t, o) {
|
|
989
|
-
const {
|
|
990
|
-
render: s,
|
|
991
|
-
className: r,
|
|
992
|
-
value: i = null,
|
|
993
|
-
label: m,
|
|
994
|
-
disabled: d = !1,
|
|
995
|
-
nativeButton: F = !1,
|
|
996
|
-
...w
|
|
997
|
-
} = t, v = n.useRef(null), R = Mn({
|
|
998
|
-
label: m,
|
|
999
|
-
textRef: v,
|
|
1000
|
-
indexGuessBehavior: An.GuessFromOrder
|
|
1001
|
-
}), {
|
|
1002
|
-
store: b,
|
|
1003
|
-
getItemProps: q,
|
|
1004
|
-
setOpen: M,
|
|
1005
|
-
setValue: U,
|
|
1006
|
-
selectionRef: L,
|
|
1007
|
-
typingRef: I,
|
|
1008
|
-
valuesRef: V,
|
|
1009
|
-
keyboardActiveRef: f,
|
|
1010
|
-
multiple: X,
|
|
1011
|
-
highlightItemOnHover: se
|
|
1012
|
-
} = Se(), ie = _e(), P = p(b, a.isActive, R.index), N = p(b, a.isSelected, R.index, i), ce = p(b, a.isSelectedByFocus, R.index), j = p(b, a.isItemEqualToValue), S = R.index, G = S !== -1, $ = n.useRef(null), y = ct(S);
|
|
1013
|
-
fe(() => {
|
|
1014
|
-
if (!G)
|
|
1015
|
-
return;
|
|
1016
|
-
const c = V.current;
|
|
1017
|
-
return c[S] = i, () => {
|
|
1018
|
-
delete c[S];
|
|
1019
|
-
};
|
|
1020
|
-
}, [G, S, i, V]), fe(() => {
|
|
1021
|
-
if (!G)
|
|
1022
|
-
return;
|
|
1023
|
-
const c = b.state.value;
|
|
1024
|
-
let g = c;
|
|
1025
|
-
X && Array.isArray(c) && c.length > 0 && (g = c[c.length - 1]), g !== void 0 && Oe(g, i, j) && b.set("selectedIndex", S);
|
|
1026
|
-
}, [G, S, X, j, b, i]);
|
|
1027
|
-
const l = n.useMemo(() => ({
|
|
1028
|
-
disabled: d,
|
|
1029
|
-
selected: N,
|
|
1030
|
-
highlighted: P
|
|
1031
|
-
}), [d, N, P]), A = q({
|
|
1032
|
-
active: P,
|
|
1033
|
-
selected: N
|
|
1034
|
-
});
|
|
1035
|
-
A.onFocus = void 0, A.id = void 0;
|
|
1036
|
-
const B = n.useRef(null), O = n.useRef("mouse"), u = n.useRef(!1), {
|
|
1037
|
-
getButtonProps: K,
|
|
1038
|
-
buttonRef: T
|
|
1039
|
-
} = Tt({
|
|
1040
|
-
disabled: d,
|
|
1041
|
-
focusableWhenDisabled: !0,
|
|
1042
|
-
native: F
|
|
1043
|
-
});
|
|
1044
|
-
function Q(c) {
|
|
1045
|
-
const g = b.state.value;
|
|
1046
|
-
if (X) {
|
|
1047
|
-
const D = Array.isArray(g) ? g : [], H = N ? Dn(D, i, j) : [...D, i];
|
|
1048
|
-
U(H, xe(tt, c));
|
|
1049
|
-
} else
|
|
1050
|
-
U(i, xe(tt, c)), M(!1, xe(tt, c));
|
|
1051
|
-
}
|
|
1052
|
-
const ee = {
|
|
1053
|
-
role: "option",
|
|
1054
|
-
"aria-selected": N,
|
|
1055
|
-
"aria-disabled": d || void 0,
|
|
1056
|
-
tabIndex: P ? 0 : -1,
|
|
1057
|
-
onFocus() {
|
|
1058
|
-
b.set("activeIndex", S);
|
|
1059
|
-
},
|
|
1060
|
-
onMouseEnter() {
|
|
1061
|
-
!f.current && b.state.selectedIndex === null && b.set("activeIndex", S);
|
|
1062
|
-
},
|
|
1063
|
-
onMouseMove() {
|
|
1064
|
-
se && b.set("activeIndex", S);
|
|
1065
|
-
},
|
|
1066
|
-
onMouseLeave(c) {
|
|
1067
|
-
!se || f.current || Bt(c) || ie.start(0, () => {
|
|
1068
|
-
b.state.activeIndex === S && b.set("activeIndex", null);
|
|
1069
|
-
});
|
|
1070
|
-
},
|
|
1071
|
-
onTouchStart() {
|
|
1072
|
-
L.current = {
|
|
1073
|
-
allowSelectedMouseUp: !1,
|
|
1074
|
-
allowUnselectedMouseUp: !1
|
|
1075
|
-
};
|
|
1076
|
-
},
|
|
1077
|
-
onKeyDown(c) {
|
|
1078
|
-
B.current = c.key, b.set("activeIndex", S);
|
|
1079
|
-
},
|
|
1080
|
-
onClick(c) {
|
|
1081
|
-
u.current = !1, !(c.type === "keydown" && B.current === null) && (d || B.current === " " && I.current || O.current !== "touch" && !P || (B.current = null, Q(c.nativeEvent)));
|
|
1082
|
-
},
|
|
1083
|
-
onPointerEnter(c) {
|
|
1084
|
-
O.current = c.pointerType;
|
|
1085
|
-
},
|
|
1086
|
-
onPointerDown(c) {
|
|
1087
|
-
O.current = c.pointerType, u.current = !0;
|
|
1088
|
-
},
|
|
1089
|
-
onMouseUp(c) {
|
|
1090
|
-
if (d)
|
|
1091
|
-
return;
|
|
1092
|
-
if (u.current) {
|
|
1093
|
-
u.current = !1;
|
|
1094
|
-
return;
|
|
1095
|
-
}
|
|
1096
|
-
const g = !L.current.allowSelectedMouseUp && N, D = !L.current.allowUnselectedMouseUp && !N;
|
|
1097
|
-
g || D || O.current !== "touch" && !P || Q(c.nativeEvent);
|
|
1098
|
-
}
|
|
1099
|
-
}, te = Re("div", t, {
|
|
1100
|
-
ref: [T, o, R.ref, $],
|
|
1101
|
-
state: l,
|
|
1102
|
-
props: [A, ee, w, K]
|
|
1103
|
-
}), z = n.useMemo(() => ({
|
|
1104
|
-
selected: N,
|
|
1105
|
-
indexRef: y,
|
|
1106
|
-
textRef: v,
|
|
1107
|
-
selectedByFocus: ce,
|
|
1108
|
-
hasRegistered: G
|
|
1109
|
-
}), [N, y, v, ce, G]);
|
|
1110
|
-
return /* @__PURE__ */ C(pt.Provider, {
|
|
1111
|
-
value: z,
|
|
1112
|
-
children: te
|
|
1113
|
-
});
|
|
1114
|
-
}));
|
|
1115
|
-
process.env.NODE_ENV !== "production" && (kt.displayName = "SelectItem");
|
|
1116
|
-
const Wt = /* @__PURE__ */ n.forwardRef(function(t, o) {
|
|
1117
|
-
const s = t.keepMounted ?? !1, {
|
|
1118
|
-
selected: r
|
|
1119
|
-
} = mt();
|
|
1120
|
-
return s || r ? /* @__PURE__ */ C(zt, {
|
|
1121
|
-
...t,
|
|
1122
|
-
ref: o
|
|
1123
|
-
}) : null;
|
|
1124
|
-
});
|
|
1125
|
-
process.env.NODE_ENV !== "production" && (Wt.displayName = "SelectItemIndicator");
|
|
1126
|
-
const zt = /* @__PURE__ */ n.memo(/* @__PURE__ */ n.forwardRef((e, t) => {
|
|
1127
|
-
const {
|
|
1128
|
-
render: o,
|
|
1129
|
-
className: s,
|
|
1130
|
-
keepMounted: r,
|
|
1131
|
-
...i
|
|
1132
|
-
} = e, {
|
|
1133
|
-
selected: m
|
|
1134
|
-
} = mt(), d = n.useRef(null), {
|
|
1135
|
-
transitionStatus: F,
|
|
1136
|
-
setMounted: w
|
|
1137
|
-
} = wt(m), v = n.useMemo(() => ({
|
|
1138
|
-
selected: m,
|
|
1139
|
-
transitionStatus: F
|
|
1140
|
-
}), [m, F]), R = Re("span", e, {
|
|
1141
|
-
ref: [t, d],
|
|
1142
|
-
state: v,
|
|
1143
|
-
props: [{
|
|
1144
|
-
"aria-hidden": !0,
|
|
1145
|
-
children: "✔️"
|
|
1146
|
-
}, i],
|
|
1147
|
-
stateAttributesMapping: At
|
|
1148
|
-
});
|
|
1149
|
-
return at({
|
|
1150
|
-
open: m,
|
|
1151
|
-
ref: d,
|
|
1152
|
-
onComplete() {
|
|
1153
|
-
m || w(!1);
|
|
1154
|
-
}
|
|
1155
|
-
}), R;
|
|
1156
|
-
}));
|
|
1157
|
-
process.env.NODE_ENV !== "production" && (zt.displayName = "Inner");
|
|
1158
|
-
const qt = /* @__PURE__ */ n.memo(/* @__PURE__ */ n.forwardRef(function(t, o) {
|
|
1159
|
-
const {
|
|
1160
|
-
indexRef: s,
|
|
1161
|
-
textRef: r,
|
|
1162
|
-
selectedByFocus: i,
|
|
1163
|
-
hasRegistered: m
|
|
1164
|
-
} = mt(), {
|
|
1165
|
-
selectedItemTextRef: d
|
|
1166
|
-
} = Se(), {
|
|
1167
|
-
className: F,
|
|
1168
|
-
render: w,
|
|
1169
|
-
...v
|
|
1170
|
-
} = t, R = n.useCallback((q) => {
|
|
1171
|
-
if (!q || !m)
|
|
1172
|
-
return;
|
|
1173
|
-
const M = d.current === null || !d.current.isConnected;
|
|
1174
|
-
(i || M && s.current === 0) && (d.current = q);
|
|
1175
|
-
}, [d, s, i, m]);
|
|
1176
|
-
return Re("div", t, {
|
|
1177
|
-
ref: [R, o, r],
|
|
1178
|
-
props: v
|
|
1179
|
-
});
|
|
1180
|
-
}));
|
|
1181
|
-
process.env.NODE_ENV !== "production" && (qt.displayName = "SelectItemText");
|
|
1182
|
-
const jn = "_select__trigger_1c25p_1", $n = "_select__list_1c25p_20", Yn = "_select__item_1c25p_32", Pe = {
|
|
1183
|
-
select__trigger: jn,
|
|
1184
|
-
"select__trigger-icon": "_select__trigger-icon_1c25p_16",
|
|
1185
|
-
select__list: $n,
|
|
1186
|
-
select__item: Yn,
|
|
1187
|
-
"select__item-indicator": "_select__item-indicator_1c25p_57",
|
|
1188
|
-
"select__item-text": "_select__item-text_1c25p_61"
|
|
1189
|
-
};
|
|
1190
|
-
function No({
|
|
1191
|
-
placeholder: e,
|
|
1192
|
-
className: t,
|
|
1193
|
-
style: o,
|
|
1194
|
-
...s
|
|
1195
|
-
}) {
|
|
1196
|
-
return /* @__PURE__ */ Ae(Ln, { ...s, children: [
|
|
1197
|
-
/* @__PURE__ */ Ae(
|
|
1198
|
-
Yt,
|
|
1199
|
-
{
|
|
1200
|
-
interactive: "fill-outline",
|
|
1201
|
-
render: /* @__PURE__ */ C(Ct, {}),
|
|
1202
|
-
style: o,
|
|
1203
|
-
className: jt(Pe.select__trigger, t),
|
|
1204
|
-
children: [
|
|
1205
|
-
/* @__PURE__ */ C(Nt, { children: Xn(e, s.items) }),
|
|
1206
|
-
/* @__PURE__ */ C(_t, { children: /* @__PURE__ */ C(
|
|
1207
|
-
xt,
|
|
1208
|
-
{
|
|
1209
|
-
name: "arrow-down-s-line",
|
|
1210
|
-
className: Pe["select__trigger-icon"]
|
|
1211
|
-
}
|
|
1212
|
-
) })
|
|
1213
|
-
]
|
|
1214
|
-
}
|
|
1215
|
-
),
|
|
1216
|
-
/* @__PURE__ */ C(Ot, { children: /* @__PURE__ */ C(Ft, { sideOffset: 4, alignItemWithTrigger: !1, children: /* @__PURE__ */ C(
|
|
1217
|
-
Ut,
|
|
1218
|
-
{
|
|
1219
|
-
className: Qt.transition_scale,
|
|
1220
|
-
children: /* @__PURE__ */ Ae(Lt, { className: Pe.select__list, children: [
|
|
1221
|
-
e && !s.multiple ? /* @__PURE__ */ C(ot, { value: null, label: e }) : null,
|
|
1222
|
-
Array.isArray(s.items) ? s.items.map(({ value: r, label: i }) => /* @__PURE__ */ C(ot, { value: r, label: i }, r)) : typeof s.items == "object" ? Object.entries(s.items).map(([r, i]) => /* @__PURE__ */ C(ot, { value: r, label: i }, r)) : null
|
|
1223
|
-
] })
|
|
1224
|
-
}
|
|
1225
|
-
) }) })
|
|
1226
|
-
] });
|
|
1227
|
-
}
|
|
1228
|
-
function ot(e) {
|
|
1229
|
-
return /* @__PURE__ */ Ae(
|
|
1230
|
-
kt,
|
|
1231
|
-
{
|
|
1232
|
-
className: Pe.select__item,
|
|
1233
|
-
value: e.value,
|
|
1234
|
-
children: [
|
|
1235
|
-
/* @__PURE__ */ C(
|
|
1236
|
-
Wt,
|
|
1237
|
-
{
|
|
1238
|
-
className: Pe["select__item-indicator"],
|
|
1239
|
-
children: /* @__PURE__ */ C(xt, { name: "check-line" })
|
|
1240
|
-
}
|
|
1241
|
-
),
|
|
1242
|
-
/* @__PURE__ */ C(qt, { className: Pe["select__item-text"], children: $t(e.label) })
|
|
1243
|
-
]
|
|
1244
|
-
}
|
|
1245
|
-
);
|
|
1246
|
-
}
|
|
1247
|
-
function Xn(e, t) {
|
|
1248
|
-
function o(r) {
|
|
1249
|
-
if (Array.isArray(t))
|
|
1250
|
-
return t.find((i) => i.value === r)?.label;
|
|
1251
|
-
if (typeof t == "object" && r in t)
|
|
1252
|
-
return t[r];
|
|
1253
|
-
}
|
|
1254
|
-
function s(r) {
|
|
1255
|
-
return !r || !t || r.length === 0 ? e : typeof r == "string" ? o(r) : [
|
|
1256
|
-
o(r[0]) || r[0],
|
|
1257
|
-
r.length > 1 ? ` (+${r.length - 1} more)` : ""
|
|
1258
|
-
];
|
|
1259
|
-
}
|
|
1260
|
-
return s;
|
|
1261
|
-
}
|
|
2
|
+
import { Select as c } from "./select.js";
|
|
1262
3
|
export {
|
|
1263
|
-
|
|
4
|
+
c as Select
|
|
1264
5
|
};
|