@validationcloud/fractal-ui 1.53.0 → 1.55.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/components/collapsible/collapsible.d.ts +14 -0
- package/dist/components/select/select.d.ts +23 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +72 -65
- package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +527 -0
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +402 -0
- package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.6_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +208 -0
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +130 -0
- package/dist/node_modules/.pnpm/@radix-ui_number@1.1.1/node_modules/@radix-ui/number/dist/index.js +6 -0
- package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.2/node_modules/@radix-ui/primitive/dist/index.js +9 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-arrow@1.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@1_d580df0584800d3ed24dd50bc4bb768c/node_modules/@radix-ui/react-arrow/dist/index.js +24 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-collection@1.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_re_965c21727754e936eeb7d35183788fa0/node_modules/@radix-ui/react-collection/dist/index.js +49 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.js +53 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-direction@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-direction/dist/index.js +10 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.6_@types_react-dom@19.2.3_@types_react@19.2.6__@t_c6844451b48448597731ceee2c7ec947/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +128 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.js +18 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-focus-scope@1.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_r_1236dc37c73a65e17034434472fa319b/node_modules/@radix-ui/react-focus-scope/dist/index.js +137 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-id@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-id/dist/index.js +13 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-popper@1.2.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_875fb0de6110028421a3e7790df757e0/node_modules/@radix-ui/react-popper/dist/index.js +219 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_5324bcb5f7050b43e9225714ff37edcd/node_modules/@radix-ui/react-portal/dist/index.js +16 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.0.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_87a4386c2964ee4c9c162dadc854f596/node_modules/@radix-ui/react-primitive/dist/index.js +35 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-select@2.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_6ddc7a756051e26689ab8a69ff12c731/node_modules/@radix-ui/react-select/dist/index.js +821 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.2.0_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-slot/dist/index.js +48 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +10 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +32 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +14 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +6 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-previous@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-previous/dist/index.js +8 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-size@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-size/dist/index.js +27 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-visually-hidden@1.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@typ_06b3b0029799d875b5a80b38402a9c14/node_modules/@radix-ui/react-visually-hidden/dist/index.js +30 -0
- package/dist/node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.js +52 -0
- package/dist/node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.js +7 -0
- package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/component.js +71 -0
- package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +7 -0
- package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +25 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/Combination.js +11 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +112 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/UI.js +31 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +16 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +68 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es2015/component.js +11 -0
- package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es2015/hook.js +15 -0
- package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es2015/singleton.js +30 -0
- package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.js +27 -0
- package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es2015/assignRef.js +6 -0
- package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +26 -0
- package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es2015/useRef.js +25 -0
- package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es2015/exports.js +18 -0
- package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es2015/medium.js +67 -0
- package/dist/server.js +1 -1
- package/dist/src/components/collapsible/collapsible.js +29 -0
- package/dist/src/components/select/select.js +105 -0
- package/dist/styles/animation.css +40 -0
- package/package.json +2 -1
- /package/dist/{assets → src/assets}/animated-loader.svg.js +0 -0
- /package/dist/{assets → src/assets}/default-avatar.svg.js +0 -0
- /package/dist/{assets → src/assets}/not-found.svg.js +0 -0
- /package/dist/{assets → src/assets}/vc-logo.svg.js +0 -0
- /package/dist/{components → src/components}/animated-loader/animated-loader.js +0 -0
- /package/dist/{components → src/components}/badge/badge.js +0 -0
- /package/dist/{components → src/components}/box/box.js +0 -0
- /package/dist/{components → src/components}/button/button.js +0 -0
- /package/dist/{components → src/components}/client-modal/client-modal.js +0 -0
- /package/dist/{components → src/components}/copy-button/copy-button.js +0 -0
- /package/dist/{components → src/components}/decorated-icon/decorated-icon.js +0 -0
- /package/dist/{components → src/components}/dropdown-menu/dropdown-menu.js +0 -0
- /package/dist/{components → src/components}/echarts-renderer/calculate-title-layout.js +0 -0
- /package/dist/{components → src/components}/echarts-renderer/detect-horizontal-bars.js +0 -0
- /package/dist/{components → src/components}/echarts-renderer/echarts-chart-option.js +0 -0
- /package/dist/{components → src/components}/echarts-renderer/echarts-renderer.js +0 -0
- /package/dist/{components → src/components}/echarts-renderer/echarts-theme-option.js +0 -0
- /package/dist/{components → src/components}/echarts-renderer/mavrik-chart.js +0 -0
- /package/dist/{components → src/components}/echarts-renderer/mavrik-theme-horizontal.json.js +0 -0
- /package/dist/{components → src/components}/echarts-renderer/mavrik-theme.js +0 -0
- /package/dist/{components → src/components}/echarts-renderer/mavrik-theme.json.js +0 -0
- /package/dist/{components → src/components}/echarts-renderer/sanitize-chart-options.js +0 -0
- /package/dist/{components → src/components}/echarts-renderer/use-chart-instance.js +0 -0
- /package/dist/{components → src/components}/echarts-renderer/watermark-graphic.js +0 -0
- /package/dist/{components → src/components}/error-boundary/error-boundary.js +0 -0
- /package/dist/{components → src/components}/icon/icon.js +0 -0
- /package/dist/{components → src/components}/icon-button/icon-button.js +0 -0
- /package/dist/{components → src/components}/input-button/input-button.js +0 -0
- /package/dist/{components → src/components}/mount-svg-sprite/mount-svg-sprite.js +0 -0
- /package/dist/{components → src/components}/not-found-component/not-found-component.js +0 -0
- /package/dist/{components → src/components}/page-padding/page-padding.js +0 -0
- /package/dist/{components → src/components}/protocol-logo/protocol-logo.js +0 -0
- /package/dist/{components → src/components}/scroll-area/index.js +0 -0
- /package/dist/{components → src/components}/scroll-area/scroll-area-viewport.js +0 -0
- /package/dist/{components → src/components}/scroll-area/scroll-area.js +0 -0
- /package/dist/{components → src/components}/skeleton/skeleton.js +0 -0
- /package/dist/{components → src/components}/switch/switch.js +0 -0
- /package/dist/{components → src/components}/text-input/text-input.js +0 -0
- /package/dist/{components → src/components}/tooltip/tooltip.js +0 -0
- /package/dist/{components → src/components}/tooltip-provider/tooltip-provider.js +0 -0
- /package/dist/{components → src/components}/touch-target/touch-target.js +0 -0
- /package/dist/{components → src/components}/user-dropdown/user-dropdown.js +0 -0
- /package/dist/{components → src/components}/user-dropdown-mobile/user-dropdown-mobile.js +0 -0
- /package/dist/{hooks → src/hooks}/use-scroll-to-bottom.js +0 -0
- /package/dist/{internal → src/internal}/modal-header.js +0 -0
- /package/dist/{internal → src/internal}/modal.js +0 -0
- /package/dist/{internal → src/internal}/react-portal.js +0 -0
- /package/dist/{internal → src/internal}/round-button.js +0 -0
- /package/dist/{lib → src/lib}/render-chart-to-image.js +0 -0
- /package/dist/{lib → src/lib}/tailwind-merge.js +0 -0
- /package/dist/{utils → src/utils}/disable-password-managers.js +0 -0
|
@@ -0,0 +1,821 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import * as be from "react-dom";
|
|
4
|
+
import { clamp as Re } from "../../../../../@radix-ui_number@1.1.1/node_modules/@radix-ui/number/dist/index.js";
|
|
5
|
+
import { composeEventHandlers as R } from "../../../../../@radix-ui_primitive@1.1.2/node_modules/@radix-ui/primitive/dist/index.js";
|
|
6
|
+
import { createCollection as Ge } from "../../../../../@radix-ui_react-collection@1.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_re_965c21727754e936eeb7d35183788fa0/node_modules/@radix-ui/react-collection/dist/index.js";
|
|
7
|
+
import { useComposedRefs as k } from "@radix-ui/react-compose-refs";
|
|
8
|
+
import { createContextScope as ze } from "../../../../../@radix-ui_react-context@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.js";
|
|
9
|
+
import { useDirection as je } from "../../../../../@radix-ui_react-direction@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-direction/dist/index.js";
|
|
10
|
+
import { DismissableLayer as Ye } from "../../../../../@radix-ui_react-dismissable-layer@1.1.6_@types_react-dom@19.2.3_@types_react@19.2.6__@t_c6844451b48448597731ceee2c7ec947/node_modules/@radix-ui/react-dismissable-layer/dist/index.js";
|
|
11
|
+
import { useFocusGuards as qe } from "../../../../../@radix-ui_react-focus-guards@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.js";
|
|
12
|
+
import { FocusScope as Xe } from "../../../../../@radix-ui_react-focus-scope@1.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_r_1236dc37c73a65e17034434472fa319b/node_modules/@radix-ui/react-focus-scope/dist/index.js";
|
|
13
|
+
import { useId as Ie } from "../../../../../@radix-ui_react-id@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-id/dist/index.js";
|
|
14
|
+
import { createPopperScope as Ne, Root as Ze, Anchor as $e, Content as Je, Arrow as Qe } from "../../../../../@radix-ui_react-popper@1.2.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_875fb0de6110028421a3e7790df757e0/node_modules/@radix-ui/react-popper/dist/index.js";
|
|
15
|
+
import { Portal as et } from "../../../../../@radix-ui_react-portal@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_5324bcb5f7050b43e9225714ff37edcd/node_modules/@radix-ui/react-portal/dist/index.js";
|
|
16
|
+
import { Primitive as M } from "../../../../../@radix-ui_react-primitive@2.0.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_87a4386c2964ee4c9c162dadc854f596/node_modules/@radix-ui/react-primitive/dist/index.js";
|
|
17
|
+
import { createSlot as tt } from "../../../../../@radix-ui_react-slot@1.2.0_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-slot/dist/index.js";
|
|
18
|
+
import { useCallbackRef as ot } from "../../../../../@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.js";
|
|
19
|
+
import { useControllableState as Ee } from "../../../../../@radix-ui_react-use-controllable-state@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.js";
|
|
20
|
+
import { useLayoutEffect as j } from "../../../../../@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.js";
|
|
21
|
+
import { usePrevious as nt } from "../../../../../@radix-ui_react-use-previous@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-previous/dist/index.js";
|
|
22
|
+
import { VisuallyHidden as rt } from "../../../../../@radix-ui_react-visually-hidden@1.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@typ_06b3b0029799d875b5a80b38402a9c14/node_modules/@radix-ui/react-visually-hidden/dist/index.js";
|
|
23
|
+
import { hideOthers as st } from "../../../../../aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.js";
|
|
24
|
+
import lt from "../../../../../react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/Combination.js";
|
|
25
|
+
import { jsx as u, jsxs as ce, Fragment as Te } from "react/jsx-runtime";
|
|
26
|
+
var ct = [" ", "Enter", "ArrowUp", "ArrowDown"], it = [" ", "Enter"], re = "Select", [ae, de, at] = Ge(re), [ee] = ze(re, [
|
|
27
|
+
at,
|
|
28
|
+
Ne
|
|
29
|
+
]), ue = Ne(), [dt, Y] = ee(re), [ut, pt] = ee(re), ft = (o) => {
|
|
30
|
+
const {
|
|
31
|
+
__scopeSelect: i,
|
|
32
|
+
children: e,
|
|
33
|
+
open: c,
|
|
34
|
+
defaultOpen: r,
|
|
35
|
+
onOpenChange: d,
|
|
36
|
+
value: n,
|
|
37
|
+
defaultValue: s,
|
|
38
|
+
onValueChange: l,
|
|
39
|
+
dir: f,
|
|
40
|
+
name: g,
|
|
41
|
+
autoComplete: C,
|
|
42
|
+
disabled: E,
|
|
43
|
+
required: T,
|
|
44
|
+
form: y
|
|
45
|
+
} = o, a = ue(i), [h, S] = t.useState(null), [m, v] = t.useState(null), [K, O] = t.useState(!1), te = je(f), [b = !1, D] = Ee({
|
|
46
|
+
prop: c,
|
|
47
|
+
defaultProp: r,
|
|
48
|
+
onChange: d
|
|
49
|
+
}), [U, X] = Ee({
|
|
50
|
+
prop: n,
|
|
51
|
+
defaultProp: s,
|
|
52
|
+
onChange: l
|
|
53
|
+
}), H = t.useRef(null), V = h ? y || !!h.closest("form") : !0, [G, B] = t.useState(/* @__PURE__ */ new Set()), W = Array.from(G).map((N) => N.props.value).join(";");
|
|
54
|
+
return /* @__PURE__ */ u(Ze, { ...a, children: /* @__PURE__ */ ce(
|
|
55
|
+
dt,
|
|
56
|
+
{
|
|
57
|
+
required: T,
|
|
58
|
+
scope: i,
|
|
59
|
+
trigger: h,
|
|
60
|
+
onTriggerChange: S,
|
|
61
|
+
valueNode: m,
|
|
62
|
+
onValueNodeChange: v,
|
|
63
|
+
valueNodeHasChildren: K,
|
|
64
|
+
onValueNodeHasChildrenChange: O,
|
|
65
|
+
contentId: Ie(),
|
|
66
|
+
value: U,
|
|
67
|
+
onValueChange: X,
|
|
68
|
+
open: b,
|
|
69
|
+
onOpenChange: D,
|
|
70
|
+
dir: te,
|
|
71
|
+
triggerPointerDownPosRef: H,
|
|
72
|
+
disabled: E,
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ u(ae.Provider, { scope: i, children: /* @__PURE__ */ u(
|
|
75
|
+
ut,
|
|
76
|
+
{
|
|
77
|
+
scope: o.__scopeSelect,
|
|
78
|
+
onNativeOptionAdd: t.useCallback((N) => {
|
|
79
|
+
B((L) => new Set(L).add(N));
|
|
80
|
+
}, []),
|
|
81
|
+
onNativeOptionRemove: t.useCallback((N) => {
|
|
82
|
+
B((L) => {
|
|
83
|
+
const F = new Set(L);
|
|
84
|
+
return F.delete(N), F;
|
|
85
|
+
});
|
|
86
|
+
}, []),
|
|
87
|
+
children: e
|
|
88
|
+
}
|
|
89
|
+
) }),
|
|
90
|
+
V ? /* @__PURE__ */ ce(
|
|
91
|
+
Fe,
|
|
92
|
+
{
|
|
93
|
+
"aria-hidden": !0,
|
|
94
|
+
required: T,
|
|
95
|
+
tabIndex: -1,
|
|
96
|
+
name: g,
|
|
97
|
+
autoComplete: C,
|
|
98
|
+
value: U,
|
|
99
|
+
onChange: (N) => X(N.target.value),
|
|
100
|
+
disabled: E,
|
|
101
|
+
form: y,
|
|
102
|
+
children: [
|
|
103
|
+
U === void 0 ? /* @__PURE__ */ u("option", { value: "" }) : null,
|
|
104
|
+
Array.from(G)
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
W
|
|
108
|
+
) : null
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
) });
|
|
112
|
+
};
|
|
113
|
+
ft.displayName = re;
|
|
114
|
+
var _e = "SelectTrigger", mt = t.forwardRef(
|
|
115
|
+
(o, i) => {
|
|
116
|
+
const { __scopeSelect: e, disabled: c = !1, ...r } = o, d = ue(e), n = Y(_e, e), s = n.disabled || c, l = k(i, n.onTriggerChange), f = de(e), g = t.useRef("touch"), [C, E, T] = Ke((a) => {
|
|
117
|
+
const h = f().filter((v) => !v.disabled), S = h.find((v) => v.value === n.value), m = Ue(h, a, S);
|
|
118
|
+
m !== void 0 && n.onValueChange(m.value);
|
|
119
|
+
}), y = (a) => {
|
|
120
|
+
s || (n.onOpenChange(!0), T()), a && (n.triggerPointerDownPosRef.current = {
|
|
121
|
+
x: Math.round(a.pageX),
|
|
122
|
+
y: Math.round(a.pageY)
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
return /* @__PURE__ */ u($e, { asChild: !0, ...d, children: /* @__PURE__ */ u(
|
|
126
|
+
M.button,
|
|
127
|
+
{
|
|
128
|
+
type: "button",
|
|
129
|
+
role: "combobox",
|
|
130
|
+
"aria-controls": n.contentId,
|
|
131
|
+
"aria-expanded": n.open,
|
|
132
|
+
"aria-required": n.required,
|
|
133
|
+
"aria-autocomplete": "none",
|
|
134
|
+
dir: n.dir,
|
|
135
|
+
"data-state": n.open ? "open" : "closed",
|
|
136
|
+
disabled: s,
|
|
137
|
+
"data-disabled": s ? "" : void 0,
|
|
138
|
+
"data-placeholder": We(n.value) ? "" : void 0,
|
|
139
|
+
...r,
|
|
140
|
+
ref: l,
|
|
141
|
+
onClick: R(r.onClick, (a) => {
|
|
142
|
+
a.currentTarget.focus(), g.current !== "mouse" && y(a);
|
|
143
|
+
}),
|
|
144
|
+
onPointerDown: R(r.onPointerDown, (a) => {
|
|
145
|
+
g.current = a.pointerType;
|
|
146
|
+
const h = a.target;
|
|
147
|
+
h.hasPointerCapture(a.pointerId) && h.releasePointerCapture(a.pointerId), a.button === 0 && a.ctrlKey === !1 && a.pointerType === "mouse" && (y(a), a.preventDefault());
|
|
148
|
+
}),
|
|
149
|
+
onKeyDown: R(r.onKeyDown, (a) => {
|
|
150
|
+
const h = C.current !== "";
|
|
151
|
+
!(a.ctrlKey || a.altKey || a.metaKey) && a.key.length === 1 && E(a.key), !(h && a.key === " ") && ct.includes(a.key) && (y(), a.preventDefault());
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
) });
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
mt.displayName = _e;
|
|
158
|
+
var Me = "SelectValue", ht = t.forwardRef(
|
|
159
|
+
(o, i) => {
|
|
160
|
+
const { __scopeSelect: e, className: c, style: r, children: d, placeholder: n = "", ...s } = o, l = Y(Me, e), { onValueNodeHasChildrenChange: f } = l, g = d !== void 0, C = k(i, l.onValueNodeChange);
|
|
161
|
+
return j(() => {
|
|
162
|
+
f(g);
|
|
163
|
+
}, [f, g]), /* @__PURE__ */ u(
|
|
164
|
+
M.span,
|
|
165
|
+
{
|
|
166
|
+
...s,
|
|
167
|
+
ref: C,
|
|
168
|
+
style: { pointerEvents: "none" },
|
|
169
|
+
children: We(l.value) ? /* @__PURE__ */ u(Te, { children: n }) : d
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
ht.displayName = Me;
|
|
175
|
+
var vt = "SelectIcon", gt = t.forwardRef(
|
|
176
|
+
(o, i) => {
|
|
177
|
+
const { __scopeSelect: e, children: c, ...r } = o;
|
|
178
|
+
return /* @__PURE__ */ u(M.span, { "aria-hidden": !0, ...r, ref: i, children: c || "▼" });
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
gt.displayName = vt;
|
|
182
|
+
var St = "SelectPortal", wt = (o) => /* @__PURE__ */ u(et, { asChild: !0, ...o });
|
|
183
|
+
wt.displayName = St;
|
|
184
|
+
var J = "SelectContent", Ct = t.forwardRef(
|
|
185
|
+
(o, i) => {
|
|
186
|
+
const e = Y(J, o.__scopeSelect), [c, r] = t.useState();
|
|
187
|
+
if (j(() => {
|
|
188
|
+
r(new DocumentFragment());
|
|
189
|
+
}, []), !e.open) {
|
|
190
|
+
const d = c;
|
|
191
|
+
return d ? be.createPortal(
|
|
192
|
+
/* @__PURE__ */ u(Oe, { scope: o.__scopeSelect, children: /* @__PURE__ */ u(ae.Slot, { scope: o.__scopeSelect, children: /* @__PURE__ */ u("div", { children: o.children }) }) }),
|
|
193
|
+
d
|
|
194
|
+
) : null;
|
|
195
|
+
}
|
|
196
|
+
return /* @__PURE__ */ u(Ae, { ...o, ref: i });
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
Ct.displayName = J;
|
|
200
|
+
var A = 10, [Oe, q] = ee(J), xt = "SelectContentImpl", yt = tt("SelectContent.RemoveScroll"), Ae = t.forwardRef(
|
|
201
|
+
(o, i) => {
|
|
202
|
+
const {
|
|
203
|
+
__scopeSelect: e,
|
|
204
|
+
position: c = "item-aligned",
|
|
205
|
+
onCloseAutoFocus: r,
|
|
206
|
+
onEscapeKeyDown: d,
|
|
207
|
+
onPointerDownOutside: n,
|
|
208
|
+
//
|
|
209
|
+
// PopperContent props
|
|
210
|
+
side: s,
|
|
211
|
+
sideOffset: l,
|
|
212
|
+
align: f,
|
|
213
|
+
alignOffset: g,
|
|
214
|
+
arrowPadding: C,
|
|
215
|
+
collisionBoundary: E,
|
|
216
|
+
collisionPadding: T,
|
|
217
|
+
sticky: y,
|
|
218
|
+
hideWhenDetached: a,
|
|
219
|
+
avoidCollisions: h,
|
|
220
|
+
//
|
|
221
|
+
...S
|
|
222
|
+
} = o, m = Y(J, e), [v, K] = t.useState(null), [O, te] = t.useState(null), b = k(i, (p) => K(p)), [D, U] = t.useState(null), [X, H] = t.useState(
|
|
223
|
+
null
|
|
224
|
+
), V = de(e), [G, B] = t.useState(!1), W = t.useRef(!1);
|
|
225
|
+
t.useEffect(() => {
|
|
226
|
+
if (v) return st(v);
|
|
227
|
+
}, [v]), qe();
|
|
228
|
+
const N = t.useCallback(
|
|
229
|
+
(p) => {
|
|
230
|
+
const [I, ..._] = V().map((P) => P.ref.current), [w] = _.slice(-1), x = document.activeElement;
|
|
231
|
+
for (const P of p)
|
|
232
|
+
if (P === x || (P?.scrollIntoView({ block: "nearest" }), P === I && O && (O.scrollTop = 0), P === w && O && (O.scrollTop = O.scrollHeight), P?.focus(), document.activeElement !== x)) return;
|
|
233
|
+
},
|
|
234
|
+
[V, O]
|
|
235
|
+
), L = t.useCallback(
|
|
236
|
+
() => N([D, v]),
|
|
237
|
+
[N, D, v]
|
|
238
|
+
);
|
|
239
|
+
t.useEffect(() => {
|
|
240
|
+
G && L();
|
|
241
|
+
}, [G, L]);
|
|
242
|
+
const { onOpenChange: F, triggerPointerDownPosRef: z } = m;
|
|
243
|
+
t.useEffect(() => {
|
|
244
|
+
if (v) {
|
|
245
|
+
let p = { x: 0, y: 0 };
|
|
246
|
+
const I = (w) => {
|
|
247
|
+
p = {
|
|
248
|
+
x: Math.abs(Math.round(w.pageX) - (z.current?.x ?? 0)),
|
|
249
|
+
y: Math.abs(Math.round(w.pageY) - (z.current?.y ?? 0))
|
|
250
|
+
};
|
|
251
|
+
}, _ = (w) => {
|
|
252
|
+
p.x <= 10 && p.y <= 10 ? w.preventDefault() : v.contains(w.target) || F(!1), document.removeEventListener("pointermove", I), z.current = null;
|
|
253
|
+
};
|
|
254
|
+
return z.current !== null && (document.addEventListener("pointermove", I), document.addEventListener("pointerup", _, { capture: !0, once: !0 })), () => {
|
|
255
|
+
document.removeEventListener("pointermove", I), document.removeEventListener("pointerup", _, { capture: !0 });
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}, [v, F, z]), t.useEffect(() => {
|
|
259
|
+
const p = () => F(!1);
|
|
260
|
+
return window.addEventListener("blur", p), window.addEventListener("resize", p), () => {
|
|
261
|
+
window.removeEventListener("blur", p), window.removeEventListener("resize", p);
|
|
262
|
+
};
|
|
263
|
+
}, [F]);
|
|
264
|
+
const [pe, se] = Ke((p) => {
|
|
265
|
+
const I = V().filter((x) => !x.disabled), _ = I.find((x) => x.ref.current === document.activeElement), w = Ue(I, p, _);
|
|
266
|
+
w && setTimeout(() => w.ref.current.focus());
|
|
267
|
+
}), fe = t.useCallback(
|
|
268
|
+
(p, I, _) => {
|
|
269
|
+
const w = !W.current && !_;
|
|
270
|
+
(m.value !== void 0 && m.value === I || w) && (U(p), w && (W.current = !0));
|
|
271
|
+
},
|
|
272
|
+
[m.value]
|
|
273
|
+
), me = t.useCallback(() => v?.focus(), [v]), Q = t.useCallback(
|
|
274
|
+
(p, I, _) => {
|
|
275
|
+
const w = !W.current && !_;
|
|
276
|
+
(m.value !== void 0 && m.value === I || w) && H(p);
|
|
277
|
+
},
|
|
278
|
+
[m.value]
|
|
279
|
+
), le = c === "popper" ? Se : De, oe = le === Se ? {
|
|
280
|
+
side: s,
|
|
281
|
+
sideOffset: l,
|
|
282
|
+
align: f,
|
|
283
|
+
alignOffset: g,
|
|
284
|
+
arrowPadding: C,
|
|
285
|
+
collisionBoundary: E,
|
|
286
|
+
collisionPadding: T,
|
|
287
|
+
sticky: y,
|
|
288
|
+
hideWhenDetached: a,
|
|
289
|
+
avoidCollisions: h
|
|
290
|
+
} : {};
|
|
291
|
+
return /* @__PURE__ */ u(
|
|
292
|
+
Oe,
|
|
293
|
+
{
|
|
294
|
+
scope: e,
|
|
295
|
+
content: v,
|
|
296
|
+
viewport: O,
|
|
297
|
+
onViewportChange: te,
|
|
298
|
+
itemRefCallback: fe,
|
|
299
|
+
selectedItem: D,
|
|
300
|
+
onItemLeave: me,
|
|
301
|
+
itemTextRefCallback: Q,
|
|
302
|
+
focusSelectedItem: L,
|
|
303
|
+
selectedItemText: X,
|
|
304
|
+
position: c,
|
|
305
|
+
isPositioned: G,
|
|
306
|
+
searchRef: pe,
|
|
307
|
+
children: /* @__PURE__ */ u(lt, { as: yt, allowPinchZoom: !0, children: /* @__PURE__ */ u(
|
|
308
|
+
Xe,
|
|
309
|
+
{
|
|
310
|
+
asChild: !0,
|
|
311
|
+
trapped: m.open,
|
|
312
|
+
onMountAutoFocus: (p) => {
|
|
313
|
+
p.preventDefault();
|
|
314
|
+
},
|
|
315
|
+
onUnmountAutoFocus: R(r, (p) => {
|
|
316
|
+
m.trigger?.focus({ preventScroll: !0 }), p.preventDefault();
|
|
317
|
+
}),
|
|
318
|
+
children: /* @__PURE__ */ u(
|
|
319
|
+
Ye,
|
|
320
|
+
{
|
|
321
|
+
asChild: !0,
|
|
322
|
+
disableOutsidePointerEvents: !0,
|
|
323
|
+
onEscapeKeyDown: d,
|
|
324
|
+
onPointerDownOutside: n,
|
|
325
|
+
onFocusOutside: (p) => p.preventDefault(),
|
|
326
|
+
onDismiss: () => m.onOpenChange(!1),
|
|
327
|
+
children: /* @__PURE__ */ u(
|
|
328
|
+
le,
|
|
329
|
+
{
|
|
330
|
+
role: "listbox",
|
|
331
|
+
id: m.contentId,
|
|
332
|
+
"data-state": m.open ? "open" : "closed",
|
|
333
|
+
dir: m.dir,
|
|
334
|
+
onContextMenu: (p) => p.preventDefault(),
|
|
335
|
+
...S,
|
|
336
|
+
...oe,
|
|
337
|
+
onPlaced: () => B(!0),
|
|
338
|
+
ref: b,
|
|
339
|
+
style: {
|
|
340
|
+
// flex layout so we can place the scroll buttons properly
|
|
341
|
+
display: "flex",
|
|
342
|
+
flexDirection: "column",
|
|
343
|
+
// reset the outline by default as the content MAY get focused
|
|
344
|
+
outline: "none",
|
|
345
|
+
...S.style
|
|
346
|
+
},
|
|
347
|
+
onKeyDown: R(S.onKeyDown, (p) => {
|
|
348
|
+
const I = p.ctrlKey || p.altKey || p.metaKey;
|
|
349
|
+
if (p.key === "Tab" && p.preventDefault(), !I && p.key.length === 1 && se(p.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(p.key)) {
|
|
350
|
+
let w = V().filter((x) => !x.disabled).map((x) => x.ref.current);
|
|
351
|
+
if (["ArrowUp", "End"].includes(p.key) && (w = w.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(p.key)) {
|
|
352
|
+
const x = p.target, P = w.indexOf(x);
|
|
353
|
+
w = w.slice(P + 1);
|
|
354
|
+
}
|
|
355
|
+
setTimeout(() => N(w)), p.preventDefault();
|
|
356
|
+
}
|
|
357
|
+
})
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
}
|
|
361
|
+
)
|
|
362
|
+
}
|
|
363
|
+
) })
|
|
364
|
+
}
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
Ae.displayName = xt;
|
|
369
|
+
var It = "SelectItemAlignedPosition", De = t.forwardRef((o, i) => {
|
|
370
|
+
const { __scopeSelect: e, onPlaced: c, ...r } = o, d = Y(J, e), n = q(J, e), [s, l] = t.useState(null), [f, g] = t.useState(null), C = k(i, (b) => g(b)), E = de(e), T = t.useRef(!1), y = t.useRef(!0), { viewport: a, selectedItem: h, selectedItemText: S, focusSelectedItem: m } = n, v = t.useCallback(() => {
|
|
371
|
+
if (d.trigger && d.valueNode && s && f && a && h && S) {
|
|
372
|
+
const b = d.trigger.getBoundingClientRect(), D = f.getBoundingClientRect(), U = d.valueNode.getBoundingClientRect(), X = S.getBoundingClientRect();
|
|
373
|
+
if (d.dir !== "rtl") {
|
|
374
|
+
const x = X.left - D.left, P = U.left - x, Z = b.left - P, $ = b.width + Z, he = Math.max($, D.width), ve = window.innerWidth - A, ge = Re(P, [
|
|
375
|
+
A,
|
|
376
|
+
// Prevents the content from going off the starting edge of the
|
|
377
|
+
// viewport. It may still go off the ending edge, but this can be
|
|
378
|
+
// controlled by the user since they may want to manage overflow in a
|
|
379
|
+
// specific way.
|
|
380
|
+
// https://github.com/radix-ui/primitives/issues/2049
|
|
381
|
+
Math.max(A, ve - he)
|
|
382
|
+
]);
|
|
383
|
+
s.style.minWidth = $ + "px", s.style.left = ge + "px";
|
|
384
|
+
} else {
|
|
385
|
+
const x = D.right - X.right, P = window.innerWidth - U.right - x, Z = window.innerWidth - b.right - P, $ = b.width + Z, he = Math.max($, D.width), ve = window.innerWidth - A, ge = Re(P, [
|
|
386
|
+
A,
|
|
387
|
+
Math.max(A, ve - he)
|
|
388
|
+
]);
|
|
389
|
+
s.style.minWidth = $ + "px", s.style.right = ge + "px";
|
|
390
|
+
}
|
|
391
|
+
const H = E(), V = window.innerHeight - A * 2, G = a.scrollHeight, B = window.getComputedStyle(f), W = parseInt(B.borderTopWidth, 10), N = parseInt(B.paddingTop, 10), L = parseInt(B.borderBottomWidth, 10), F = parseInt(B.paddingBottom, 10), z = W + N + G + F + L, pe = Math.min(h.offsetHeight * 5, z), se = window.getComputedStyle(a), fe = parseInt(se.paddingTop, 10), me = parseInt(se.paddingBottom, 10), Q = b.top + b.height / 2 - A, le = V - Q, oe = h.offsetHeight / 2, p = h.offsetTop + oe, I = W + N + p, _ = z - I;
|
|
392
|
+
if (I <= Q) {
|
|
393
|
+
const x = H.length > 0 && h === H[H.length - 1].ref.current;
|
|
394
|
+
s.style.bottom = "0px";
|
|
395
|
+
const P = f.clientHeight - a.offsetTop - a.offsetHeight, Z = Math.max(
|
|
396
|
+
le,
|
|
397
|
+
oe + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
398
|
+
(x ? me : 0) + P + L
|
|
399
|
+
), $ = I + Z;
|
|
400
|
+
s.style.height = $ + "px";
|
|
401
|
+
} else {
|
|
402
|
+
const x = H.length > 0 && h === H[0].ref.current;
|
|
403
|
+
s.style.top = "0px";
|
|
404
|
+
const Z = Math.max(
|
|
405
|
+
Q,
|
|
406
|
+
W + a.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
407
|
+
(x ? fe : 0) + oe
|
|
408
|
+
) + _;
|
|
409
|
+
s.style.height = Z + "px", a.scrollTop = I - Q + a.offsetTop;
|
|
410
|
+
}
|
|
411
|
+
s.style.margin = `${A}px 0`, s.style.minHeight = pe + "px", s.style.maxHeight = V + "px", c?.(), requestAnimationFrame(() => T.current = !0);
|
|
412
|
+
}
|
|
413
|
+
}, [
|
|
414
|
+
E,
|
|
415
|
+
d.trigger,
|
|
416
|
+
d.valueNode,
|
|
417
|
+
s,
|
|
418
|
+
f,
|
|
419
|
+
a,
|
|
420
|
+
h,
|
|
421
|
+
S,
|
|
422
|
+
d.dir,
|
|
423
|
+
c
|
|
424
|
+
]);
|
|
425
|
+
j(() => v(), [v]);
|
|
426
|
+
const [K, O] = t.useState();
|
|
427
|
+
j(() => {
|
|
428
|
+
f && O(window.getComputedStyle(f).zIndex);
|
|
429
|
+
}, [f]);
|
|
430
|
+
const te = t.useCallback(
|
|
431
|
+
(b) => {
|
|
432
|
+
b && y.current === !0 && (v(), m?.(), y.current = !1);
|
|
433
|
+
},
|
|
434
|
+
[v, m]
|
|
435
|
+
);
|
|
436
|
+
return /* @__PURE__ */ u(
|
|
437
|
+
Pt,
|
|
438
|
+
{
|
|
439
|
+
scope: e,
|
|
440
|
+
contentWrapper: s,
|
|
441
|
+
shouldExpandOnScrollRef: T,
|
|
442
|
+
onScrollButtonChange: te,
|
|
443
|
+
children: /* @__PURE__ */ u(
|
|
444
|
+
"div",
|
|
445
|
+
{
|
|
446
|
+
ref: l,
|
|
447
|
+
style: {
|
|
448
|
+
display: "flex",
|
|
449
|
+
flexDirection: "column",
|
|
450
|
+
position: "fixed",
|
|
451
|
+
zIndex: K
|
|
452
|
+
},
|
|
453
|
+
children: /* @__PURE__ */ u(
|
|
454
|
+
M.div,
|
|
455
|
+
{
|
|
456
|
+
...r,
|
|
457
|
+
ref: C,
|
|
458
|
+
style: {
|
|
459
|
+
// When we get the height of the content, it includes borders. If we were to set
|
|
460
|
+
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
461
|
+
boxSizing: "border-box",
|
|
462
|
+
// We need to ensure the content doesn't get taller than the wrapper
|
|
463
|
+
maxHeight: "100%",
|
|
464
|
+
...r.style
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
)
|
|
468
|
+
}
|
|
469
|
+
)
|
|
470
|
+
}
|
|
471
|
+
);
|
|
472
|
+
});
|
|
473
|
+
De.displayName = It;
|
|
474
|
+
var Tt = "SelectPopperPosition", Se = t.forwardRef((o, i) => {
|
|
475
|
+
const {
|
|
476
|
+
__scopeSelect: e,
|
|
477
|
+
align: c = "start",
|
|
478
|
+
collisionPadding: r = A,
|
|
479
|
+
...d
|
|
480
|
+
} = o, n = ue(e);
|
|
481
|
+
return /* @__PURE__ */ u(
|
|
482
|
+
Je,
|
|
483
|
+
{
|
|
484
|
+
...n,
|
|
485
|
+
...d,
|
|
486
|
+
ref: i,
|
|
487
|
+
align: c,
|
|
488
|
+
collisionPadding: r,
|
|
489
|
+
style: {
|
|
490
|
+
// Ensure border-box for floating-ui calculations
|
|
491
|
+
boxSizing: "border-box",
|
|
492
|
+
...d.style,
|
|
493
|
+
"--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
494
|
+
"--radix-select-content-available-width": "var(--radix-popper-available-width)",
|
|
495
|
+
"--radix-select-content-available-height": "var(--radix-popper-available-height)",
|
|
496
|
+
"--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
|
|
497
|
+
"--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
);
|
|
501
|
+
});
|
|
502
|
+
Se.displayName = Tt;
|
|
503
|
+
var [Pt, Pe] = ee(J, {}), we = "SelectViewport", Rt = t.forwardRef(
|
|
504
|
+
(o, i) => {
|
|
505
|
+
const { __scopeSelect: e, nonce: c, ...r } = o, d = q(we, e), n = Pe(we, e), s = k(i, d.onViewportChange), l = t.useRef(0);
|
|
506
|
+
return /* @__PURE__ */ ce(Te, { children: [
|
|
507
|
+
/* @__PURE__ */ u(
|
|
508
|
+
"style",
|
|
509
|
+
{
|
|
510
|
+
dangerouslySetInnerHTML: {
|
|
511
|
+
__html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
|
|
512
|
+
},
|
|
513
|
+
nonce: c
|
|
514
|
+
}
|
|
515
|
+
),
|
|
516
|
+
/* @__PURE__ */ u(ae.Slot, { scope: e, children: /* @__PURE__ */ u(
|
|
517
|
+
M.div,
|
|
518
|
+
{
|
|
519
|
+
"data-radix-select-viewport": "",
|
|
520
|
+
role: "presentation",
|
|
521
|
+
...r,
|
|
522
|
+
ref: s,
|
|
523
|
+
style: {
|
|
524
|
+
// we use position: 'relative' here on the `viewport` so that when we call
|
|
525
|
+
// `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
|
|
526
|
+
// (independent of the scrollUpButton).
|
|
527
|
+
position: "relative",
|
|
528
|
+
flex: 1,
|
|
529
|
+
// Viewport should only be scrollable in the vertical direction.
|
|
530
|
+
// This won't work in vertical writing modes, so we'll need to
|
|
531
|
+
// revisit this if/when that is supported
|
|
532
|
+
// https://developer.chrome.com/blog/vertical-form-controls
|
|
533
|
+
overflow: "hidden auto",
|
|
534
|
+
...r.style
|
|
535
|
+
},
|
|
536
|
+
onScroll: R(r.onScroll, (f) => {
|
|
537
|
+
const g = f.currentTarget, { contentWrapper: C, shouldExpandOnScrollRef: E } = n;
|
|
538
|
+
if (E?.current && C) {
|
|
539
|
+
const T = Math.abs(l.current - g.scrollTop);
|
|
540
|
+
if (T > 0) {
|
|
541
|
+
const y = window.innerHeight - A * 2, a = parseFloat(C.style.minHeight), h = parseFloat(C.style.height), S = Math.max(a, h);
|
|
542
|
+
if (S < y) {
|
|
543
|
+
const m = S + T, v = Math.min(y, m), K = m - v;
|
|
544
|
+
C.style.height = v + "px", C.style.bottom === "0px" && (g.scrollTop = K > 0 ? K : 0, C.style.justifyContent = "flex-end");
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
l.current = g.scrollTop;
|
|
549
|
+
})
|
|
550
|
+
}
|
|
551
|
+
) })
|
|
552
|
+
] });
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
Rt.displayName = we;
|
|
556
|
+
var Le = "SelectGroup", [Et, bt] = ee(Le), Nt = t.forwardRef(
|
|
557
|
+
(o, i) => {
|
|
558
|
+
const { __scopeSelect: e, ...c } = o, r = Ie();
|
|
559
|
+
return /* @__PURE__ */ u(Et, { scope: e, id: r, children: /* @__PURE__ */ u(M.div, { role: "group", "aria-labelledby": r, ...c, ref: i }) });
|
|
560
|
+
}
|
|
561
|
+
);
|
|
562
|
+
Nt.displayName = Le;
|
|
563
|
+
var ke = "SelectLabel", _t = t.forwardRef(
|
|
564
|
+
(o, i) => {
|
|
565
|
+
const { __scopeSelect: e, ...c } = o, r = bt(ke, e);
|
|
566
|
+
return /* @__PURE__ */ u(M.div, { id: r.id, ...c, ref: i });
|
|
567
|
+
}
|
|
568
|
+
);
|
|
569
|
+
_t.displayName = ke;
|
|
570
|
+
var ie = "SelectItem", [Mt, He] = ee(ie), Ot = t.forwardRef(
|
|
571
|
+
(o, i) => {
|
|
572
|
+
const {
|
|
573
|
+
__scopeSelect: e,
|
|
574
|
+
value: c,
|
|
575
|
+
disabled: r = !1,
|
|
576
|
+
textValue: d,
|
|
577
|
+
...n
|
|
578
|
+
} = o, s = Y(ie, e), l = q(ie, e), f = s.value === c, [g, C] = t.useState(d ?? ""), [E, T] = t.useState(!1), y = k(
|
|
579
|
+
i,
|
|
580
|
+
(m) => l.itemRefCallback?.(m, c, r)
|
|
581
|
+
), a = Ie(), h = t.useRef("touch"), S = () => {
|
|
582
|
+
r || (s.onValueChange(c), s.onOpenChange(!1));
|
|
583
|
+
};
|
|
584
|
+
if (c === "")
|
|
585
|
+
throw new Error(
|
|
586
|
+
"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."
|
|
587
|
+
);
|
|
588
|
+
return /* @__PURE__ */ u(
|
|
589
|
+
Mt,
|
|
590
|
+
{
|
|
591
|
+
scope: e,
|
|
592
|
+
value: c,
|
|
593
|
+
disabled: r,
|
|
594
|
+
textId: a,
|
|
595
|
+
isSelected: f,
|
|
596
|
+
onItemTextChange: t.useCallback((m) => {
|
|
597
|
+
C((v) => v || (m?.textContent ?? "").trim());
|
|
598
|
+
}, []),
|
|
599
|
+
children: /* @__PURE__ */ u(
|
|
600
|
+
ae.ItemSlot,
|
|
601
|
+
{
|
|
602
|
+
scope: e,
|
|
603
|
+
value: c,
|
|
604
|
+
disabled: r,
|
|
605
|
+
textValue: g,
|
|
606
|
+
children: /* @__PURE__ */ u(
|
|
607
|
+
M.div,
|
|
608
|
+
{
|
|
609
|
+
role: "option",
|
|
610
|
+
"aria-labelledby": a,
|
|
611
|
+
"data-highlighted": E ? "" : void 0,
|
|
612
|
+
"aria-selected": f && E,
|
|
613
|
+
"data-state": f ? "checked" : "unchecked",
|
|
614
|
+
"aria-disabled": r || void 0,
|
|
615
|
+
"data-disabled": r ? "" : void 0,
|
|
616
|
+
tabIndex: r ? void 0 : -1,
|
|
617
|
+
...n,
|
|
618
|
+
ref: y,
|
|
619
|
+
onFocus: R(n.onFocus, () => T(!0)),
|
|
620
|
+
onBlur: R(n.onBlur, () => T(!1)),
|
|
621
|
+
onClick: R(n.onClick, () => {
|
|
622
|
+
h.current !== "mouse" && S();
|
|
623
|
+
}),
|
|
624
|
+
onPointerUp: R(n.onPointerUp, () => {
|
|
625
|
+
h.current === "mouse" && S();
|
|
626
|
+
}),
|
|
627
|
+
onPointerDown: R(n.onPointerDown, (m) => {
|
|
628
|
+
h.current = m.pointerType;
|
|
629
|
+
}),
|
|
630
|
+
onPointerMove: R(n.onPointerMove, (m) => {
|
|
631
|
+
h.current = m.pointerType, r ? l.onItemLeave?.() : h.current === "mouse" && m.currentTarget.focus({ preventScroll: !0 });
|
|
632
|
+
}),
|
|
633
|
+
onPointerLeave: R(n.onPointerLeave, (m) => {
|
|
634
|
+
m.currentTarget === document.activeElement && l.onItemLeave?.();
|
|
635
|
+
}),
|
|
636
|
+
onKeyDown: R(n.onKeyDown, (m) => {
|
|
637
|
+
l.searchRef?.current !== "" && m.key === " " || (it.includes(m.key) && S(), m.key === " " && m.preventDefault());
|
|
638
|
+
})
|
|
639
|
+
}
|
|
640
|
+
)
|
|
641
|
+
}
|
|
642
|
+
)
|
|
643
|
+
}
|
|
644
|
+
);
|
|
645
|
+
}
|
|
646
|
+
);
|
|
647
|
+
Ot.displayName = ie;
|
|
648
|
+
var ne = "SelectItemText", At = t.forwardRef(
|
|
649
|
+
(o, i) => {
|
|
650
|
+
const { __scopeSelect: e, className: c, style: r, ...d } = o, n = Y(ne, e), s = q(ne, e), l = He(ne, e), f = pt(ne, e), [g, C] = t.useState(null), E = k(
|
|
651
|
+
i,
|
|
652
|
+
(S) => C(S),
|
|
653
|
+
l.onItemTextChange,
|
|
654
|
+
(S) => s.itemTextRefCallback?.(S, l.value, l.disabled)
|
|
655
|
+
), T = g?.textContent, y = t.useMemo(
|
|
656
|
+
() => /* @__PURE__ */ u("option", { value: l.value, disabled: l.disabled, children: T }, l.value),
|
|
657
|
+
[l.disabled, l.value, T]
|
|
658
|
+
), { onNativeOptionAdd: a, onNativeOptionRemove: h } = f;
|
|
659
|
+
return j(() => (a(y), () => h(y)), [a, h, y]), /* @__PURE__ */ ce(Te, { children: [
|
|
660
|
+
/* @__PURE__ */ u(M.span, { id: l.textId, ...d, ref: E }),
|
|
661
|
+
l.isSelected && n.valueNode && !n.valueNodeHasChildren ? be.createPortal(d.children, n.valueNode) : null
|
|
662
|
+
] });
|
|
663
|
+
}
|
|
664
|
+
);
|
|
665
|
+
At.displayName = ne;
|
|
666
|
+
var Ve = "SelectItemIndicator", Dt = t.forwardRef(
|
|
667
|
+
(o, i) => {
|
|
668
|
+
const { __scopeSelect: e, ...c } = o;
|
|
669
|
+
return He(Ve, e).isSelected ? /* @__PURE__ */ u(M.span, { "aria-hidden": !0, ...c, ref: i }) : null;
|
|
670
|
+
}
|
|
671
|
+
);
|
|
672
|
+
Dt.displayName = Ve;
|
|
673
|
+
var Ce = "SelectScrollUpButton", Lt = t.forwardRef((o, i) => {
|
|
674
|
+
const e = q(Ce, o.__scopeSelect), c = Pe(Ce, o.__scopeSelect), [r, d] = t.useState(!1), n = k(i, c.onScrollButtonChange);
|
|
675
|
+
return j(() => {
|
|
676
|
+
if (e.viewport && e.isPositioned) {
|
|
677
|
+
let s = function() {
|
|
678
|
+
const f = l.scrollTop > 0;
|
|
679
|
+
d(f);
|
|
680
|
+
};
|
|
681
|
+
const l = e.viewport;
|
|
682
|
+
return s(), l.addEventListener("scroll", s), () => l.removeEventListener("scroll", s);
|
|
683
|
+
}
|
|
684
|
+
}, [e.viewport, e.isPositioned]), r ? /* @__PURE__ */ u(
|
|
685
|
+
Be,
|
|
686
|
+
{
|
|
687
|
+
...o,
|
|
688
|
+
ref: n,
|
|
689
|
+
onAutoScroll: () => {
|
|
690
|
+
const { viewport: s, selectedItem: l } = e;
|
|
691
|
+
s && l && (s.scrollTop = s.scrollTop - l.offsetHeight);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
) : null;
|
|
695
|
+
});
|
|
696
|
+
Lt.displayName = Ce;
|
|
697
|
+
var xe = "SelectScrollDownButton", kt = t.forwardRef((o, i) => {
|
|
698
|
+
const e = q(xe, o.__scopeSelect), c = Pe(xe, o.__scopeSelect), [r, d] = t.useState(!1), n = k(i, c.onScrollButtonChange);
|
|
699
|
+
return j(() => {
|
|
700
|
+
if (e.viewport && e.isPositioned) {
|
|
701
|
+
let s = function() {
|
|
702
|
+
const f = l.scrollHeight - l.clientHeight, g = Math.ceil(l.scrollTop) < f;
|
|
703
|
+
d(g);
|
|
704
|
+
};
|
|
705
|
+
const l = e.viewport;
|
|
706
|
+
return s(), l.addEventListener("scroll", s), () => l.removeEventListener("scroll", s);
|
|
707
|
+
}
|
|
708
|
+
}, [e.viewport, e.isPositioned]), r ? /* @__PURE__ */ u(
|
|
709
|
+
Be,
|
|
710
|
+
{
|
|
711
|
+
...o,
|
|
712
|
+
ref: n,
|
|
713
|
+
onAutoScroll: () => {
|
|
714
|
+
const { viewport: s, selectedItem: l } = e;
|
|
715
|
+
s && l && (s.scrollTop = s.scrollTop + l.offsetHeight);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
) : null;
|
|
719
|
+
});
|
|
720
|
+
kt.displayName = xe;
|
|
721
|
+
var Be = t.forwardRef((o, i) => {
|
|
722
|
+
const { __scopeSelect: e, onAutoScroll: c, ...r } = o, d = q("SelectScrollButton", e), n = t.useRef(null), s = de(e), l = t.useCallback(() => {
|
|
723
|
+
n.current !== null && (window.clearInterval(n.current), n.current = null);
|
|
724
|
+
}, []);
|
|
725
|
+
return t.useEffect(() => () => l(), [l]), j(() => {
|
|
726
|
+
s().find((g) => g.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
|
|
727
|
+
}, [s]), /* @__PURE__ */ u(
|
|
728
|
+
M.div,
|
|
729
|
+
{
|
|
730
|
+
"aria-hidden": !0,
|
|
731
|
+
...r,
|
|
732
|
+
ref: i,
|
|
733
|
+
style: { flexShrink: 0, ...r.style },
|
|
734
|
+
onPointerDown: R(r.onPointerDown, () => {
|
|
735
|
+
n.current === null && (n.current = window.setInterval(c, 50));
|
|
736
|
+
}),
|
|
737
|
+
onPointerMove: R(r.onPointerMove, () => {
|
|
738
|
+
d.onItemLeave?.(), n.current === null && (n.current = window.setInterval(c, 50));
|
|
739
|
+
}),
|
|
740
|
+
onPointerLeave: R(r.onPointerLeave, () => {
|
|
741
|
+
l();
|
|
742
|
+
})
|
|
743
|
+
}
|
|
744
|
+
);
|
|
745
|
+
}), Ht = "SelectSeparator", Vt = t.forwardRef(
|
|
746
|
+
(o, i) => {
|
|
747
|
+
const { __scopeSelect: e, ...c } = o;
|
|
748
|
+
return /* @__PURE__ */ u(M.div, { "aria-hidden": !0, ...c, ref: i });
|
|
749
|
+
}
|
|
750
|
+
);
|
|
751
|
+
Vt.displayName = Ht;
|
|
752
|
+
var ye = "SelectArrow", Bt = t.forwardRef(
|
|
753
|
+
(o, i) => {
|
|
754
|
+
const { __scopeSelect: e, ...c } = o, r = ue(e), d = Y(ye, e), n = q(ye, e);
|
|
755
|
+
return d.open && n.position === "popper" ? /* @__PURE__ */ u(Qe, { ...r, ...c, ref: i }) : null;
|
|
756
|
+
}
|
|
757
|
+
);
|
|
758
|
+
Bt.displayName = ye;
|
|
759
|
+
function We(o) {
|
|
760
|
+
return o === "" || o === void 0;
|
|
761
|
+
}
|
|
762
|
+
var Fe = t.forwardRef(
|
|
763
|
+
(o, i) => {
|
|
764
|
+
const { value: e, ...c } = o, r = t.useRef(null), d = k(i, r), n = nt(e);
|
|
765
|
+
return t.useEffect(() => {
|
|
766
|
+
const s = r.current, l = window.HTMLSelectElement.prototype, g = Object.getOwnPropertyDescriptor(
|
|
767
|
+
l,
|
|
768
|
+
"value"
|
|
769
|
+
).set;
|
|
770
|
+
if (n !== e && g) {
|
|
771
|
+
const C = new Event("change", { bubbles: !0 });
|
|
772
|
+
g.call(s, e), s.dispatchEvent(C);
|
|
773
|
+
}
|
|
774
|
+
}, [n, e]), /* @__PURE__ */ u(rt, { asChild: !0, children: /* @__PURE__ */ u("select", { ...c, ref: d, defaultValue: e }) });
|
|
775
|
+
}
|
|
776
|
+
);
|
|
777
|
+
Fe.displayName = "BubbleSelect";
|
|
778
|
+
function Ke(o) {
|
|
779
|
+
const i = ot(o), e = t.useRef(""), c = t.useRef(0), r = t.useCallback(
|
|
780
|
+
(n) => {
|
|
781
|
+
const s = e.current + n;
|
|
782
|
+
i(s), (function l(f) {
|
|
783
|
+
e.current = f, window.clearTimeout(c.current), f !== "" && (c.current = window.setTimeout(() => l(""), 1e3));
|
|
784
|
+
})(s);
|
|
785
|
+
},
|
|
786
|
+
[i]
|
|
787
|
+
), d = t.useCallback(() => {
|
|
788
|
+
e.current = "", window.clearTimeout(c.current);
|
|
789
|
+
}, []);
|
|
790
|
+
return t.useEffect(() => () => window.clearTimeout(c.current), []), [e, r, d];
|
|
791
|
+
}
|
|
792
|
+
function Ue(o, i, e) {
|
|
793
|
+
const r = i.length > 1 && Array.from(i).every((f) => f === i[0]) ? i[0] : i, d = e ? o.indexOf(e) : -1;
|
|
794
|
+
let n = Wt(o, Math.max(d, 0));
|
|
795
|
+
r.length === 1 && (n = n.filter((f) => f !== e));
|
|
796
|
+
const l = n.find(
|
|
797
|
+
(f) => f.textValue.toLowerCase().startsWith(r.toLowerCase())
|
|
798
|
+
);
|
|
799
|
+
return l !== e ? l : void 0;
|
|
800
|
+
}
|
|
801
|
+
function Wt(o, i) {
|
|
802
|
+
return o.map((e, c) => o[(i + c) % o.length]);
|
|
803
|
+
}
|
|
804
|
+
export {
|
|
805
|
+
ft as Select,
|
|
806
|
+
Bt as SelectArrow,
|
|
807
|
+
Ct as SelectContent,
|
|
808
|
+
Nt as SelectGroup,
|
|
809
|
+
gt as SelectIcon,
|
|
810
|
+
Ot as SelectItem,
|
|
811
|
+
Dt as SelectItemIndicator,
|
|
812
|
+
At as SelectItemText,
|
|
813
|
+
_t as SelectLabel,
|
|
814
|
+
wt as SelectPortal,
|
|
815
|
+
kt as SelectScrollDownButton,
|
|
816
|
+
Lt as SelectScrollUpButton,
|
|
817
|
+
Vt as SelectSeparator,
|
|
818
|
+
mt as SelectTrigger,
|
|
819
|
+
ht as SelectValue,
|
|
820
|
+
Rt as SelectViewport
|
|
821
|
+
};
|