@jfrader/ui 0.3.0 → 0.4.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/combobox-DiMC2g_u.js +327 -0
- package/dist/combobox.js +1 -1
- package/dist/{date-picker-ClUYBIBh.js → date-picker-C29Uo4Tx.js} +42 -42
- package/dist/date-picker.js +1 -1
- package/dist/index.js +8 -8
- package/dist/{menu-DU60SMdt.js → menu-CGPTNRnF.js} +49 -49
- package/dist/menu.js +1 -1
- package/dist/{popover-BtN_0ejj.js → popover-CdRXjQqI.js} +30 -30
- package/dist/popover.js +1 -1
- package/dist/{select-BCS0-LVW.js → select-BgG7WgSh.js} +57 -57
- package/dist/select.js +1 -1
- package/dist/theme-root-BbTBuLMQ.js +46 -0
- package/dist/theme-root.js +1 -1
- package/dist/theme-scope-t7nAKc2c.js +27 -0
- package/dist/toast-CjmELMZZ.js +283 -0
- package/dist/toast.js +1 -1
- package/dist/{tooltip-CB-HC1js.js → tooltip-CaL3rKbV.js} +35 -35
- package/dist/tooltip.js +1 -1
- package/dist/types/components/theme-root/theme-root.d.ts +9 -3
- package/dist/types/overlay/overlay-portal.d.ts +7 -0
- package/dist/types/styling/theme-scope.d.ts +19 -0
- package/dist/use-overlay-floating-Bit-f0FU.js +31 -0
- package/package.json +2 -2
- package/dist/combobox-DrmjBbo7.js +0 -327
- package/dist/theme-root-BiXXvQvr.js +0 -42
- package/dist/toast-iqelR-r0.js +0 -282
- package/dist/use-overlay-floating-efeqppiw.js +0 -19
|
@@ -5,21 +5,21 @@ import { n as r } from "./media-D_eA_I-e.js";
|
|
|
5
5
|
import { t as i } from "./use-controlled-state-CVXDa-qM.js";
|
|
6
6
|
import { f as a, i as o, n as s, o as c } from "./collection-registry-BTYi6zGh.js";
|
|
7
7
|
import { t as l } from "./trigger-style-B1KVC8O1.js";
|
|
8
|
-
import {
|
|
9
|
-
import { createContext as
|
|
10
|
-
import { vars as
|
|
11
|
-
import { jsx as
|
|
12
|
-
import { FloatingFocusManager as
|
|
8
|
+
import { n as u, t as d } from "./use-overlay-floating-Bit-f0FU.js";
|
|
9
|
+
import { createContext as f, useContext as p, useEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
|
|
10
|
+
import { vars as v } from "@jfrader/tokens/vars";
|
|
11
|
+
import { jsx as y } from "@emotion/react/jsx-runtime";
|
|
12
|
+
import { FloatingFocusManager as b, FloatingList as x, useClick as S, useDismiss as C, useInteractions as w, useListNavigation as T, useMergeRefs as E, useRole as D, useTypeahead as O } from "@floating-ui/react";
|
|
13
13
|
//#region src/components/menu/menu.tsx
|
|
14
|
-
var k = 500, A =
|
|
14
|
+
var k = 500, A = f(null), j = f(!1);
|
|
15
15
|
function M(e) {
|
|
16
|
-
let t =
|
|
16
|
+
let t = p(A);
|
|
17
17
|
if (!t) throw Error(`Menu.${e} must be rendered inside <Menu>.`);
|
|
18
18
|
return t;
|
|
19
19
|
}
|
|
20
20
|
function N() {
|
|
21
21
|
let e = M("Item");
|
|
22
|
-
if (!
|
|
22
|
+
if (!p(j)) throw Error("Menu.Item must be rendered inside <Menu.Content>.");
|
|
23
23
|
return e;
|
|
24
24
|
}
|
|
25
25
|
var P = e({
|
|
@@ -30,46 +30,46 @@ var P = e({
|
|
|
30
30
|
inlineSize: "100%",
|
|
31
31
|
minBlockSize: "32px",
|
|
32
32
|
border: 0,
|
|
33
|
-
borderRadius:
|
|
33
|
+
borderRadius: v.radius.sm,
|
|
34
34
|
backgroundColor: "transparent",
|
|
35
|
-
paddingBlock:
|
|
36
|
-
paddingInline:
|
|
35
|
+
paddingBlock: v.space[1],
|
|
36
|
+
paddingInline: v.space[2],
|
|
37
37
|
font: "inherit",
|
|
38
|
-
fontSize:
|
|
39
|
-
color:
|
|
38
|
+
fontSize: v.textSize.sm,
|
|
39
|
+
color: v.color.text,
|
|
40
40
|
textAlign: "start",
|
|
41
41
|
cursor: "pointer",
|
|
42
42
|
transitionProperty: "background-color",
|
|
43
|
-
transitionDuration:
|
|
44
|
-
transitionTimingFunction:
|
|
43
|
+
transitionDuration: v.motion.duration.fast,
|
|
44
|
+
transitionTimingFunction: v.motion.easeStandard,
|
|
45
45
|
"&:focus-visible": { ...n },
|
|
46
46
|
[r]: { transitionDuration: "0s" }
|
|
47
47
|
}), F = e({
|
|
48
48
|
blockSize: "1px",
|
|
49
|
-
marginBlock:
|
|
50
|
-
backgroundColor:
|
|
49
|
+
marginBlock: v.space[1],
|
|
50
|
+
backgroundColor: v.color.border
|
|
51
51
|
});
|
|
52
52
|
function I({ open: e, defaultOpen: t = !1, onOpenChange: n, placement: r = "bottom-start", children: a }) {
|
|
53
|
-
let [o = !1, s] = i(e, t, n), [c, l] =
|
|
53
|
+
let [o = !1, s] = i(e, t, n), [c, l] = _(null), u = g([]), f = g([]), p = g(/* @__PURE__ */ new Set()), v = g(!1), { refs: b, floatingStyles: x, context: E } = d({
|
|
54
54
|
open: o,
|
|
55
55
|
placement: r,
|
|
56
56
|
onOpenChange: (e, t, n) => {
|
|
57
|
-
e || (
|
|
57
|
+
e || (v.current = n === "escape-key"), s(e);
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
|
|
61
|
-
!o &&
|
|
60
|
+
m(() => {
|
|
61
|
+
!o && v.current && (v.current = !1, b.domReference.current?.focus());
|
|
62
62
|
}, [o, b]);
|
|
63
63
|
let j = S(E), M = D(E, { role: "menu" }), N = C(E, {
|
|
64
64
|
escapeKey: !0,
|
|
65
65
|
outsidePress: !0
|
|
66
66
|
}), P = T(E, {
|
|
67
|
-
listRef:
|
|
67
|
+
listRef: u,
|
|
68
68
|
activeIndex: c,
|
|
69
69
|
onNavigate: l,
|
|
70
70
|
loop: !0,
|
|
71
71
|
orientation: "vertical",
|
|
72
|
-
disabledIndices: (e) =>
|
|
72
|
+
disabledIndices: (e) => p.current.has(e),
|
|
73
73
|
focusItemOnOpen: !0
|
|
74
74
|
}), F = O(E, {
|
|
75
75
|
listRef: f,
|
|
@@ -82,18 +82,18 @@ function I({ open: e, defaultOpen: t = !1, onOpenChange: n, placement: r = "bott
|
|
|
82
82
|
N,
|
|
83
83
|
P,
|
|
84
84
|
F
|
|
85
|
-
]), z =
|
|
85
|
+
]), z = h(() => ({
|
|
86
86
|
open: o,
|
|
87
87
|
requestClose: (e = !1) => {
|
|
88
|
-
e && (
|
|
88
|
+
e && (v.current = !0), s(!1);
|
|
89
89
|
},
|
|
90
90
|
activeIndex: c,
|
|
91
91
|
refs: b,
|
|
92
92
|
floatingContext: E,
|
|
93
93
|
floatingStyles: x,
|
|
94
|
-
elementsRef:
|
|
94
|
+
elementsRef: u,
|
|
95
95
|
labelsRef: f,
|
|
96
|
-
disabledIndices:
|
|
96
|
+
disabledIndices: p.current,
|
|
97
97
|
getReferenceProps: I,
|
|
98
98
|
getFloatingProps: L,
|
|
99
99
|
getItemProps: R
|
|
@@ -108,7 +108,7 @@ function I({ open: e, defaultOpen: t = !1, onOpenChange: n, placement: r = "bott
|
|
|
108
108
|
L,
|
|
109
109
|
R
|
|
110
110
|
]);
|
|
111
|
-
return /* @__PURE__ */
|
|
111
|
+
return /* @__PURE__ */ y(A.Provider, {
|
|
112
112
|
value: z,
|
|
113
113
|
children: a
|
|
114
114
|
});
|
|
@@ -116,11 +116,11 @@ function I({ open: e, defaultOpen: t = !1, onOpenChange: n, placement: r = "bott
|
|
|
116
116
|
I.displayName = "Menu";
|
|
117
117
|
function L({ ref: e, className: n, sx: r, ...i }) {
|
|
118
118
|
let { refs: a, getReferenceProps: o } = M("Trigger"), s = E([a.setReference, e]);
|
|
119
|
-
return /* @__PURE__ */
|
|
119
|
+
return /* @__PURE__ */ y(t, {
|
|
120
120
|
className: n,
|
|
121
121
|
styles: l,
|
|
122
122
|
sx: r,
|
|
123
|
-
children: (e) => /* @__PURE__ */
|
|
123
|
+
children: (e) => /* @__PURE__ */ y("button", {
|
|
124
124
|
type: "button",
|
|
125
125
|
...o(i),
|
|
126
126
|
ref: s,
|
|
@@ -131,30 +131,30 @@ function L({ ref: e, className: n, sx: r, ...i }) {
|
|
|
131
131
|
}
|
|
132
132
|
L.displayName = "Menu.Trigger";
|
|
133
133
|
function R({ ref: e, style: n, children: r, className: i, sx: o, ...s }) {
|
|
134
|
-
let { open: c, refs: l, floatingContext:
|
|
135
|
-
return c ? /* @__PURE__ */
|
|
136
|
-
context:
|
|
134
|
+
let { open: c, refs: l, floatingContext: d, floatingStyles: f, elementsRef: p, labelsRef: m, getFloatingProps: h } = M("Content"), g = E([l.setFloating, e]);
|
|
135
|
+
return c ? /* @__PURE__ */ y(u, { children: /* @__PURE__ */ y(b, {
|
|
136
|
+
context: d,
|
|
137
137
|
modal: !1,
|
|
138
138
|
initialFocus: -1,
|
|
139
139
|
returnFocus: !1,
|
|
140
140
|
restoreFocus: !0,
|
|
141
|
-
children: /* @__PURE__ */
|
|
141
|
+
children: /* @__PURE__ */ y(t, {
|
|
142
142
|
className: i,
|
|
143
143
|
styles: a,
|
|
144
144
|
sx: o,
|
|
145
|
-
children: (e) => /* @__PURE__ */
|
|
146
|
-
...
|
|
147
|
-
ref:
|
|
145
|
+
children: (e) => /* @__PURE__ */ y("div", {
|
|
146
|
+
...h(s),
|
|
147
|
+
ref: g,
|
|
148
148
|
"data-ui": "menu",
|
|
149
149
|
style: {
|
|
150
150
|
...n,
|
|
151
|
-
...
|
|
151
|
+
...f
|
|
152
152
|
},
|
|
153
153
|
className: e,
|
|
154
|
-
children: /* @__PURE__ */
|
|
155
|
-
elementsRef:
|
|
156
|
-
labelsRef:
|
|
157
|
-
children: /* @__PURE__ */
|
|
154
|
+
children: /* @__PURE__ */ y(x, {
|
|
155
|
+
elementsRef: p,
|
|
156
|
+
labelsRef: m,
|
|
157
|
+
children: /* @__PURE__ */ y(j.Provider, {
|
|
158
158
|
value: !0,
|
|
159
159
|
children: r
|
|
160
160
|
})
|
|
@@ -165,16 +165,16 @@ function R({ ref: e, style: n, children: r, className: i, sx: o, ...s }) {
|
|
|
165
165
|
}
|
|
166
166
|
R.displayName = "Menu.Content";
|
|
167
167
|
function z({ ref: e, onSelect: n, disabled: r = !1, onClick: i, className: a, sx: l, ...u }) {
|
|
168
|
-
let { activeIndex: d, requestClose: f, disabledIndices: p, getItemProps: m } = N(), { ref: h, index: g } = o({ label: r ? null : void 0 }), _ = E([h, e]),
|
|
168
|
+
let { activeIndex: d, requestClose: f, disabledIndices: p, getItemProps: m } = N(), { ref: h, index: g } = o({ label: r ? null : void 0 }), _ = E([h, e]), v = g !== -1 && d === g;
|
|
169
169
|
s(g, r, p);
|
|
170
170
|
let b = (e) => {
|
|
171
171
|
r || (i?.(e), n?.(), e.defaultPrevented || f(!0));
|
|
172
172
|
};
|
|
173
|
-
return /* @__PURE__ */
|
|
173
|
+
return /* @__PURE__ */ y(t, {
|
|
174
174
|
className: a,
|
|
175
175
|
styles: [P, c],
|
|
176
176
|
sx: l,
|
|
177
|
-
children: (e) => /* @__PURE__ */
|
|
177
|
+
children: (e) => /* @__PURE__ */ y("button", {
|
|
178
178
|
type: "button",
|
|
179
179
|
...m({
|
|
180
180
|
...u,
|
|
@@ -182,9 +182,9 @@ function z({ ref: e, onSelect: n, disabled: r = !1, onClick: i, className: a, sx
|
|
|
182
182
|
}),
|
|
183
183
|
ref: _,
|
|
184
184
|
role: "menuitem",
|
|
185
|
-
tabIndex:
|
|
185
|
+
tabIndex: v ? 0 : -1,
|
|
186
186
|
"aria-disabled": r || void 0,
|
|
187
|
-
"data-active":
|
|
187
|
+
"data-active": v || void 0,
|
|
188
188
|
"data-ui": "menu-item",
|
|
189
189
|
className: e
|
|
190
190
|
})
|
|
@@ -192,11 +192,11 @@ function z({ ref: e, onSelect: n, disabled: r = !1, onClick: i, className: a, sx
|
|
|
192
192
|
}
|
|
193
193
|
z.displayName = "Menu.Item";
|
|
194
194
|
function B({ ref: e, className: n, sx: r, ...i }) {
|
|
195
|
-
return /* @__PURE__ */
|
|
195
|
+
return /* @__PURE__ */ y(t, {
|
|
196
196
|
className: n,
|
|
197
197
|
styles: F,
|
|
198
198
|
sx: r,
|
|
199
|
-
children: (t) => /* @__PURE__ */
|
|
199
|
+
children: (t) => /* @__PURE__ */ y("div", {
|
|
200
200
|
...i,
|
|
201
201
|
ref: e,
|
|
202
202
|
role: "separator",
|
package/dist/menu.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Menu } from "./menu-
|
|
2
|
+
export { t as Menu } from "./menu-CGPTNRnF.js";
|
|
@@ -3,37 +3,37 @@ import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
|
3
3
|
import { t as n } from "./use-controlled-state-CVXDa-qM.js";
|
|
4
4
|
import { t as r } from "./trigger-style-B1KVC8O1.js";
|
|
5
5
|
import { n as i } from "./surface-DZ4d-2aL.js";
|
|
6
|
-
import {
|
|
7
|
-
import { createContext as
|
|
8
|
-
import { vars as
|
|
9
|
-
import { jsx as
|
|
10
|
-
import { FloatingFocusManager as
|
|
6
|
+
import { n as a, t as o } from "./use-overlay-floating-Bit-f0FU.js";
|
|
7
|
+
import { createContext as s, useContext as c, useEffect as l, useMemo as u, useRef as d } from "react";
|
|
8
|
+
import { vars as f } from "@jfrader/tokens/vars";
|
|
9
|
+
import { jsx as p } from "@emotion/react/jsx-runtime";
|
|
10
|
+
import { FloatingFocusManager as m, useClick as h, useDismiss as g, useInteractions as _, useMergeRefs as v, useRole as y } from "@floating-ui/react";
|
|
11
11
|
//#region src/components/popover/popover.tsx
|
|
12
|
-
var b =
|
|
12
|
+
var b = s(null);
|
|
13
13
|
function x(e) {
|
|
14
|
-
let t =
|
|
14
|
+
let t = c(b);
|
|
15
15
|
if (!t) throw Error(`Popover.${e} must be rendered inside <Popover>.`);
|
|
16
16
|
return t;
|
|
17
17
|
}
|
|
18
18
|
var S = e({
|
|
19
19
|
...i,
|
|
20
|
-
borderRadius:
|
|
21
|
-
boxShadow:
|
|
22
|
-
padding:
|
|
20
|
+
borderRadius: f.radius.lg,
|
|
21
|
+
boxShadow: f.shadow.overlay,
|
|
22
|
+
padding: f.space[4],
|
|
23
23
|
minInlineSize: "200px",
|
|
24
24
|
maxInlineSize: "min(360px, calc(100vw - 32px))",
|
|
25
|
-
fontSize:
|
|
25
|
+
fontSize: f.textSize.sm
|
|
26
26
|
});
|
|
27
|
-
function C({ open: e, defaultOpen: t = !1, onOpenChange: r, placement: i = "bottom", children:
|
|
28
|
-
let [s = !1,
|
|
27
|
+
function C({ open: e, defaultOpen: t = !1, onOpenChange: r, placement: i = "bottom", children: a }) {
|
|
28
|
+
let [s = !1, c] = n(e, t, r), f = d(!1), { refs: m, floatingStyles: v, context: x } = o({
|
|
29
29
|
open: s,
|
|
30
30
|
placement: i,
|
|
31
31
|
onOpenChange: (e, t, n) => {
|
|
32
|
-
e || (
|
|
32
|
+
e || (f.current = n === "escape-key"), c(e);
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
-
|
|
36
|
-
!s &&
|
|
35
|
+
l(() => {
|
|
36
|
+
!s && f.current && (f.current = !1, m.domReference.current?.focus());
|
|
37
37
|
}, [s, m]);
|
|
38
38
|
let S = h(x), C = g(x, {
|
|
39
39
|
escapeKey: !0,
|
|
@@ -42,7 +42,7 @@ function C({ open: e, defaultOpen: t = !1, onOpenChange: r, placement: i = "bott
|
|
|
42
42
|
S,
|
|
43
43
|
C,
|
|
44
44
|
w
|
|
45
|
-
]), D =
|
|
45
|
+
]), D = u(() => ({
|
|
46
46
|
open: s,
|
|
47
47
|
refs: m,
|
|
48
48
|
floatingContext: x,
|
|
@@ -57,19 +57,19 @@ function C({ open: e, defaultOpen: t = !1, onOpenChange: r, placement: i = "bott
|
|
|
57
57
|
T,
|
|
58
58
|
E
|
|
59
59
|
]);
|
|
60
|
-
return /* @__PURE__ */
|
|
60
|
+
return /* @__PURE__ */ p(b.Provider, {
|
|
61
61
|
value: D,
|
|
62
|
-
children:
|
|
62
|
+
children: a
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
C.displayName = "Popover";
|
|
66
66
|
function w({ ref: e, className: n, sx: i, ...a }) {
|
|
67
67
|
let { refs: o, getReferenceProps: s } = x("Trigger"), c = v([o.setReference, e]);
|
|
68
|
-
return /* @__PURE__ */
|
|
68
|
+
return /* @__PURE__ */ p(t, {
|
|
69
69
|
className: n,
|
|
70
70
|
styles: r,
|
|
71
71
|
sx: i,
|
|
72
|
-
children: (e) => /* @__PURE__ */
|
|
72
|
+
children: (e) => /* @__PURE__ */ p("button", {
|
|
73
73
|
type: "button",
|
|
74
74
|
...s(a),
|
|
75
75
|
ref: c,
|
|
@@ -79,25 +79,25 @@ function w({ ref: e, className: n, sx: i, ...a }) {
|
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
w.displayName = "Popover.Trigger";
|
|
82
|
-
function T({ ref: e, style: n, className: r, sx: i, ...
|
|
83
|
-
let { open:
|
|
84
|
-
return
|
|
85
|
-
context:
|
|
82
|
+
function T({ ref: e, style: n, className: r, sx: i, ...o }) {
|
|
83
|
+
let { open: s, refs: c, floatingContext: l, floatingStyles: u, getFloatingProps: d } = x("Content"), f = v([c.setFloating, e]);
|
|
84
|
+
return s ? /* @__PURE__ */ p(a, { children: /* @__PURE__ */ p(m, {
|
|
85
|
+
context: l,
|
|
86
86
|
modal: !1,
|
|
87
87
|
initialFocus: -1,
|
|
88
88
|
returnFocus: !1,
|
|
89
89
|
closeOnFocusOut: !1,
|
|
90
|
-
children: /* @__PURE__ */
|
|
90
|
+
children: /* @__PURE__ */ p(t, {
|
|
91
91
|
className: r,
|
|
92
92
|
styles: S,
|
|
93
93
|
sx: i,
|
|
94
|
-
children: (e) => /* @__PURE__ */
|
|
95
|
-
...
|
|
96
|
-
ref:
|
|
94
|
+
children: (e) => /* @__PURE__ */ p("div", {
|
|
95
|
+
...d(o),
|
|
96
|
+
ref: f,
|
|
97
97
|
"data-ui": "popover",
|
|
98
98
|
style: {
|
|
99
99
|
...n,
|
|
100
|
-
...
|
|
100
|
+
...u
|
|
101
101
|
},
|
|
102
102
|
className: e
|
|
103
103
|
})
|
package/dist/popover.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Popover } from "./popover-
|
|
2
|
+
export { t as Popover } from "./popover-CdRXjQqI.js";
|
|
@@ -3,40 +3,40 @@ import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
|
3
3
|
import { t as n } from "./use-controlled-state-CVXDa-qM.js";
|
|
4
4
|
import { a as r, c as i, d as a, f as o, l as s, o as c, r as l, s as u, t as d, u as f } from "./collection-registry-BTYi6zGh.js";
|
|
5
5
|
import { t as p } from "./trigger-style-B1KVC8O1.js";
|
|
6
|
-
import {
|
|
7
|
-
import { createContext as
|
|
8
|
-
import { vars as
|
|
9
|
-
import { jsx as
|
|
10
|
-
import { FloatingList as
|
|
6
|
+
import { n as m, t as h } from "./use-overlay-floating-Bit-f0FU.js";
|
|
7
|
+
import { createContext as g, useContext as _, useId as v, useLayoutEffect as y, useMemo as b, useRef as x, useState as S } from "react";
|
|
8
|
+
import { vars as C } from "@jfrader/tokens/vars";
|
|
9
|
+
import { jsx as w, jsxs as T } from "@emotion/react/jsx-runtime";
|
|
10
|
+
import { FloatingList as E, useClick as D, useDismiss as O, useInteractions as k, useListNavigation as A, useMergeRefs as j, useRole as M } from "@floating-ui/react";
|
|
11
11
|
//#region src/components/select/select.tsx
|
|
12
12
|
var N = 500, P = new Intl.Collator(void 0, {
|
|
13
13
|
usage: "search",
|
|
14
14
|
sensitivity: "base"
|
|
15
|
-
}), F = "✓", I =
|
|
15
|
+
}), F = "✓", I = g(null), L = g(!1);
|
|
16
16
|
function R(e) {
|
|
17
|
-
let t =
|
|
17
|
+
let t = _(I);
|
|
18
18
|
if (!t) throw Error(`Select.${e} must be rendered inside <Select>.`);
|
|
19
19
|
return t;
|
|
20
20
|
}
|
|
21
21
|
function z() {
|
|
22
22
|
let e = R("Item");
|
|
23
|
-
if (!
|
|
23
|
+
if (!_(L)) throw Error("Select.Item must be rendered inside <Select.Content>.");
|
|
24
24
|
return e;
|
|
25
25
|
}
|
|
26
26
|
var B = e({
|
|
27
27
|
justifyContent: "flex-start",
|
|
28
28
|
minInlineSize: "180px",
|
|
29
|
-
"&[aria-expanded=\"true\"]": { backgroundColor:
|
|
29
|
+
"&[aria-expanded=\"true\"]": { backgroundColor: C.color.surfaceHover }
|
|
30
30
|
}), V = e({
|
|
31
31
|
overflow: "hidden",
|
|
32
32
|
textOverflow: "ellipsis",
|
|
33
33
|
whiteSpace: "nowrap",
|
|
34
|
-
"&[data-placeholder]": { color:
|
|
34
|
+
"&[data-placeholder]": { color: C.color.textMuted }
|
|
35
35
|
});
|
|
36
36
|
function H({ value: e, defaultValue: t, onValueChange: i, open: a, defaultOpen: o = !1, onOpenChange: s, placement: c = "bottom-start", disabled: l = !1, name: u, children: d }) {
|
|
37
|
-
let f =
|
|
38
|
-
!g && E && (j(!1),
|
|
39
|
-
let { valuesByIndex: H, disabledIndices: U } =
|
|
37
|
+
let f = v(), [p, m] = n(e, t, i), [g = !1, _] = n(a, o, s), [y, C] = S(null), [E, j] = S(!1), [N, F] = r(), [L, R] = S(null), z = x([]), B = x([]), V = x(null);
|
|
38
|
+
!g && E && (j(!1), C(null));
|
|
39
|
+
let { valuesByIndex: H, disabledIndices: U } = b(() => {
|
|
40
40
|
let e = [], t = /* @__PURE__ */ new Set();
|
|
41
41
|
return N.forEach((n, r) => {
|
|
42
42
|
n.index !== -1 && (e[n.index] = r, n.disabled && t.add(n.index));
|
|
@@ -44,17 +44,17 @@ function H({ value: e, defaultValue: t, onValueChange: i, open: a, defaultOpen:
|
|
|
44
44
|
valuesByIndex: e,
|
|
45
45
|
disabledIndices: t
|
|
46
46
|
};
|
|
47
|
-
}, [N]), W = p === void 0 ? void 0 : N.get(p), G = W && W.index !== -1 ? W.index : null, { refs: K, floatingStyles: q, context: J } =
|
|
47
|
+
}, [N]), W = p === void 0 ? void 0 : N.get(p), G = W && W.index !== -1 ? W.index : null, { refs: K, floatingStyles: q, context: J } = h({
|
|
48
48
|
open: g,
|
|
49
49
|
placement: c,
|
|
50
|
-
onOpenChange: (e) =>
|
|
50
|
+
onOpenChange: (e) => _(e)
|
|
51
51
|
}), Y = D(J), X = M(J, { role: "listbox" }), ee = O(J, {
|
|
52
52
|
escapeKey: !0,
|
|
53
53
|
outsidePress: !0
|
|
54
54
|
}), te = A(J, {
|
|
55
55
|
listRef: z,
|
|
56
|
-
activeIndex:
|
|
57
|
-
onNavigate:
|
|
56
|
+
activeIndex: y,
|
|
57
|
+
onNavigate: C,
|
|
58
58
|
virtual: !0,
|
|
59
59
|
virtualItemRef: V,
|
|
60
60
|
loop: !0,
|
|
@@ -66,16 +66,16 @@ function H({ value: e, defaultValue: t, onValueChange: i, open: a, defaultOpen:
|
|
|
66
66
|
X,
|
|
67
67
|
ee,
|
|
68
68
|
te
|
|
69
|
-
]), ne =
|
|
69
|
+
]), ne = b(() => {
|
|
70
70
|
let e = (e) => {
|
|
71
|
-
|
|
71
|
+
m(e), _(!1);
|
|
72
72
|
};
|
|
73
73
|
return {
|
|
74
74
|
baseId: f,
|
|
75
75
|
open: g,
|
|
76
76
|
disabled: l,
|
|
77
77
|
selectedValue: p,
|
|
78
|
-
activeIndex:
|
|
78
|
+
activeIndex: y,
|
|
79
79
|
options: N,
|
|
80
80
|
triggerLabelling: L,
|
|
81
81
|
refs: K,
|
|
@@ -87,11 +87,11 @@ function H({ value: e, defaultValue: t, onValueChange: i, open: a, defaultOpen:
|
|
|
87
87
|
getItemProps: $,
|
|
88
88
|
selectValue: e,
|
|
89
89
|
matchTypeahead: (e) => {
|
|
90
|
-
let t = B.current, n =
|
|
90
|
+
let t = B.current, n = y ?? -1;
|
|
91
91
|
for (let r = 1; r <= t.length; r += 1) {
|
|
92
92
|
let i = (n + r) % t.length, a = t[i];
|
|
93
93
|
if (!(a == null || U.has(i)) && P.compare(a.slice(0, e.length), e) === 0) {
|
|
94
|
-
|
|
94
|
+
C(i), g || (j(!0), _(!0));
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -100,7 +100,7 @@ function H({ value: e, defaultValue: t, onValueChange: i, open: a, defaultOpen:
|
|
|
100
100
|
let n = H[t];
|
|
101
101
|
n === void 0 || U.has(t) || e(n);
|
|
102
102
|
},
|
|
103
|
-
requestOpenChange:
|
|
103
|
+
requestOpenChange: _,
|
|
104
104
|
registration: F,
|
|
105
105
|
setTriggerLabelling: R
|
|
106
106
|
};
|
|
@@ -109,7 +109,7 @@ function H({ value: e, defaultValue: t, onValueChange: i, open: a, defaultOpen:
|
|
|
109
109
|
g,
|
|
110
110
|
l,
|
|
111
111
|
p,
|
|
112
|
-
|
|
112
|
+
y,
|
|
113
113
|
N,
|
|
114
114
|
L,
|
|
115
115
|
K,
|
|
@@ -119,13 +119,13 @@ function H({ value: e, defaultValue: t, onValueChange: i, open: a, defaultOpen:
|
|
|
119
119
|
$,
|
|
120
120
|
H,
|
|
121
121
|
U,
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
m,
|
|
123
|
+
_,
|
|
124
124
|
F
|
|
125
125
|
]);
|
|
126
|
-
return /* @__PURE__ */
|
|
126
|
+
return /* @__PURE__ */ T(I.Provider, {
|
|
127
127
|
value: ne,
|
|
128
|
-
children: [d, u !== void 0 && /* @__PURE__ */
|
|
128
|
+
children: [d, u !== void 0 && /* @__PURE__ */ w("input", {
|
|
129
129
|
type: "hidden",
|
|
130
130
|
name: u,
|
|
131
131
|
value: p ?? "",
|
|
@@ -135,19 +135,19 @@ function H({ value: e, defaultValue: t, onValueChange: i, open: a, defaultOpen:
|
|
|
135
135
|
}
|
|
136
136
|
H.displayName = "Select";
|
|
137
137
|
function U({ ref: e, id: n, disabled: r, onKeyDown: i, className: a, sx: o, ...s }) {
|
|
138
|
-
let { baseId: c, open: l, disabled: u, activeIndex: d, refs: f, getReferenceProps: m, selectIndex: h, matchTypeahead: g, requestOpenChange: _, setTriggerLabelling:
|
|
138
|
+
let { baseId: c, open: l, disabled: u, activeIndex: d, refs: f, getReferenceProps: m, selectIndex: h, matchTypeahead: g, requestOpenChange: _, setTriggerLabelling: v } = R("Trigger"), b = j([f.setReference, e]), S = x({
|
|
139
139
|
search: "",
|
|
140
140
|
lastKeyAt: 0
|
|
141
|
-
}),
|
|
142
|
-
|
|
143
|
-
id:
|
|
141
|
+
}), C = n ?? `${c}-trigger`, T = s["aria-labelledby"], E = s["aria-label"];
|
|
142
|
+
y(() => (v({
|
|
143
|
+
id: C,
|
|
144
144
|
labelledBy: T,
|
|
145
145
|
label: E
|
|
146
|
-
}), () =>
|
|
147
|
-
|
|
146
|
+
}), () => v(null)), [
|
|
147
|
+
C,
|
|
148
148
|
T,
|
|
149
149
|
E,
|
|
150
|
-
|
|
150
|
+
v
|
|
151
151
|
]);
|
|
152
152
|
let D = (e) => {
|
|
153
153
|
if (i?.(e), !(e.defaultPrevented || u || r)) {
|
|
@@ -160,19 +160,19 @@ function U({ ref: e, id: n, disabled: r, onKeyDown: i, className: a, sx: o, ...s
|
|
|
160
160
|
} else l && (e.key === "Tab" ? _(!1) : (e.key === "Enter" || e.key === " ") && d !== null && (e.preventDefault(), h(d)));
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
|
-
return /* @__PURE__ */
|
|
163
|
+
return /* @__PURE__ */ w(t, {
|
|
164
164
|
className: a,
|
|
165
165
|
styles: [p, B],
|
|
166
166
|
sx: o,
|
|
167
|
-
children: (e) => /* @__PURE__ */
|
|
167
|
+
children: (e) => /* @__PURE__ */ w("button", {
|
|
168
168
|
type: "button",
|
|
169
169
|
...m({
|
|
170
170
|
...s,
|
|
171
|
-
id:
|
|
171
|
+
id: C,
|
|
172
172
|
disabled: u || r,
|
|
173
173
|
onKeyDown: D
|
|
174
174
|
}),
|
|
175
|
-
ref:
|
|
175
|
+
ref: b,
|
|
176
176
|
"data-state": l ? "open" : "closed",
|
|
177
177
|
"data-ui": "select-trigger",
|
|
178
178
|
className: e
|
|
@@ -182,11 +182,11 @@ function U({ ref: e, id: n, disabled: r, onKeyDown: i, className: a, sx: o, ...s
|
|
|
182
182
|
U.displayName = "Select.Trigger";
|
|
183
183
|
function W({ ref: e, placeholder: n, className: r, sx: i, ...a }) {
|
|
184
184
|
let { selectedValue: o, options: s } = R("Value"), c = o === void 0 ? void 0 : s.get(o)?.label, l = c === void 0;
|
|
185
|
-
return /* @__PURE__ */
|
|
185
|
+
return /* @__PURE__ */ w(t, {
|
|
186
186
|
className: r,
|
|
187
187
|
styles: V,
|
|
188
188
|
sx: i,
|
|
189
|
-
children: (t) => /* @__PURE__ */
|
|
189
|
+
children: (t) => /* @__PURE__ */ w("span", {
|
|
190
190
|
...a,
|
|
191
191
|
ref: e,
|
|
192
192
|
"data-placeholder": l || void 0,
|
|
@@ -198,20 +198,20 @@ function W({ ref: e, placeholder: n, className: r, sx: i, ...a }) {
|
|
|
198
198
|
}
|
|
199
199
|
W.displayName = "Select.Value";
|
|
200
200
|
function G({ ref: e, style: n, onMouseDown: r, children: i, className: s, sx: c, ...l }) {
|
|
201
|
-
let { open: u, triggerLabelling: d, refs: f, floatingStyles: p, elementsRef:
|
|
201
|
+
let { open: u, triggerLabelling: d, refs: f, floatingStyles: p, elementsRef: h, getFloatingProps: g } = R("Content"), _ = j([u ? f.setFloating : null, e]), v = l["aria-labelledby"] !== void 0 || l["aria-label"] !== void 0 ? {} : d?.labelledBy === void 0 ? d?.label === void 0 ? { "aria-labelledby": d?.id } : { "aria-label": d.label } : { "aria-labelledby": d.labelledBy }, y = (e) => {
|
|
202
202
|
r?.(e), e.preventDefault();
|
|
203
203
|
};
|
|
204
|
-
return /* @__PURE__ */
|
|
204
|
+
return /* @__PURE__ */ w(m, { children: /* @__PURE__ */ w(t, {
|
|
205
205
|
className: s,
|
|
206
206
|
styles: [o, a],
|
|
207
207
|
sx: c,
|
|
208
|
-
children: (e) => /* @__PURE__ */
|
|
209
|
-
...
|
|
210
|
-
...
|
|
208
|
+
children: (e) => /* @__PURE__ */ w("div", {
|
|
209
|
+
...g({
|
|
210
|
+
...v,
|
|
211
211
|
...l,
|
|
212
|
-
onMouseDown:
|
|
212
|
+
onMouseDown: y
|
|
213
213
|
}),
|
|
214
|
-
ref:
|
|
214
|
+
ref: _,
|
|
215
215
|
hidden: !u,
|
|
216
216
|
"data-state": u ? "open" : "closed",
|
|
217
217
|
"data-ui": "select-listbox",
|
|
@@ -220,9 +220,9 @@ function G({ ref: e, style: n, onMouseDown: r, children: i, className: s, sx: c,
|
|
|
220
220
|
...p
|
|
221
221
|
},
|
|
222
222
|
className: e,
|
|
223
|
-
children: /* @__PURE__ */
|
|
224
|
-
elementsRef:
|
|
225
|
-
children: /* @__PURE__ */
|
|
223
|
+
children: /* @__PURE__ */ w(E, {
|
|
224
|
+
elementsRef: h,
|
|
225
|
+
children: /* @__PURE__ */ w(L.Provider, {
|
|
226
226
|
value: !0,
|
|
227
227
|
children: i
|
|
228
228
|
})
|
|
@@ -232,7 +232,7 @@ function G({ ref: e, style: n, onMouseDown: r, children: i, className: s, sx: c,
|
|
|
232
232
|
}
|
|
233
233
|
G.displayName = "Select.Content";
|
|
234
234
|
function K({ ref: e, value: n, disabled: r = !1, onClick: a, children: o, className: p, sx: m, ...h }) {
|
|
235
|
-
let { baseId: g, selectedValue: _, activeIndex: v, labelsRef: y, getItemProps:
|
|
235
|
+
let { baseId: g, selectedValue: _, activeIndex: v, labelsRef: y, getItemProps: b, selectValue: S, registration: C } = z(), E = x(null), { ref: D, index: O } = l(n, C, E, (e, t) => ({
|
|
236
236
|
index: e,
|
|
237
237
|
label: t,
|
|
238
238
|
disabled: r
|
|
@@ -242,7 +242,7 @@ function K({ ref: e, value: n, disabled: r = !1, onClick: a, children: o, classN
|
|
|
242
242
|
}), k = j([D, e]), A = O !== -1 && v === O, M = _ === n, N = (e) => {
|
|
243
243
|
a?.(e), !(r || e.defaultPrevented) && S(n);
|
|
244
244
|
};
|
|
245
|
-
return /* @__PURE__ */
|
|
245
|
+
return /* @__PURE__ */ w(t, {
|
|
246
246
|
className: p,
|
|
247
247
|
styles: [
|
|
248
248
|
u,
|
|
@@ -250,8 +250,8 @@ function K({ ref: e, value: n, disabled: r = !1, onClick: a, children: o, classN
|
|
|
250
250
|
s
|
|
251
251
|
],
|
|
252
252
|
sx: m,
|
|
253
|
-
children: (e) => /* @__PURE__ */
|
|
254
|
-
...
|
|
253
|
+
children: (e) => /* @__PURE__ */ T("div", {
|
|
254
|
+
...b({
|
|
255
255
|
id: d(g, n),
|
|
256
256
|
...h,
|
|
257
257
|
onClick: N
|
|
@@ -263,11 +263,11 @@ function K({ ref: e, value: n, disabled: r = !1, onClick: a, children: o, classN
|
|
|
263
263
|
"data-active": A || void 0,
|
|
264
264
|
"data-ui": "select-item",
|
|
265
265
|
className: e,
|
|
266
|
-
children: [/* @__PURE__ */
|
|
266
|
+
children: [/* @__PURE__ */ w("span", {
|
|
267
267
|
ref: E,
|
|
268
268
|
css: f,
|
|
269
269
|
children: o
|
|
270
|
-
}), M && /* @__PURE__ */
|
|
270
|
+
}), M && /* @__PURE__ */ w("span", {
|
|
271
271
|
"aria-hidden": "true",
|
|
272
272
|
css: i,
|
|
273
273
|
children: F
|
package/dist/select.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Select } from "./select-
|
|
2
|
+
export { t as Select } from "./select-BgG7WgSh.js";
|