@luxfi/ui 8.2.7 → 8.2.9
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/3d-model-viewer.cjs +25 -421
- package/dist/3d-model-viewer.js +20 -416
- package/dist/accordion.cjs +3 -10
- package/dist/accordion.js +2 -10
- package/dist/advanced-navigation-bar.cjs +5 -401
- package/dist/advanced-navigation-bar.js +5 -401
- package/dist/ai-agents.cjs +45 -890
- package/dist/ai-agents.js +8 -834
- package/dist/ai-assistant.cjs +13 -740
- package/dist/ai-assistant.js +10 -738
- package/dist/ai-chat.cjs +24 -770
- package/dist/ai-chat.js +18 -765
- package/dist/ai-code.cjs +67 -923
- package/dist/ai-code.js +49 -905
- package/dist/ai-playground.cjs +25 -801
- package/dist/ai-playground.js +18 -795
- package/dist/ai-tools.cjs +22 -767
- package/dist/ai-tools.js +15 -761
- package/dist/ai-vision.cjs +41 -993
- package/dist/ai-vision.js +30 -983
- package/dist/ai-voice-settings.cjs +35 -1006
- package/dist/ai-voice-settings.js +32 -1004
- package/dist/ai-voice.cjs +51 -1024
- package/dist/ai-voice.js +9 -963
- package/dist/alert.cjs +11 -129
- package/dist/alert.js +8 -127
- package/dist/announcement.cjs +6 -402
- package/dist/announcement.js +6 -402
- package/dist/app-switcher-navigation-bar.cjs +5 -401
- package/dist/app-switcher-navigation-bar.js +5 -401
- package/dist/apple-cards-carousel.cjs +84 -480
- package/dist/apple-cards-carousel.js +19 -415
- package/dist/auth.cjs +10 -387
- package/dist/auth.js +7 -385
- package/dist/avatar.cjs +2 -9
- package/dist/avatar.js +2 -10
- package/dist/badge.cjs +8 -228
- package/dist/badge.js +5 -210
- package/dist/button.cjs +14 -67
- package/dist/button.js +12 -65
- package/dist/chrome.cjs +29 -493
- package/dist/chrome.js +9 -474
- package/dist/code-block.cjs +16 -664
- package/dist/code-block.js +13 -662
- package/dist/code-compare.cjs +28 -1302
- package/dist/code-compare.js +18 -1293
- package/dist/code-diff.cjs +21 -669
- package/dist/code-diff.js +17 -666
- package/dist/code-editor.cjs +13 -409
- package/dist/code-editor.js +12 -408
- package/dist/code-explorer.cjs +14 -456
- package/dist/code-explorer.js +13 -456
- package/dist/code-preview.cjs +31 -983
- package/dist/code-preview.js +23 -976
- package/dist/code-snippet.cjs +19 -667
- package/dist/code-snippet.js +14 -663
- package/dist/code-terminal.cjs +24 -485
- package/dist/code-terminal.js +19 -481
- package/dist/collapsible.cjs +13 -347
- package/dist/collapsible.js +11 -330
- package/dist/color-picker.cjs +8 -450
- package/dist/color-picker.js +7 -450
- package/dist/combobox.cjs +6 -402
- package/dist/combobox.js +6 -402
- package/dist/communication-navigation-bar.cjs +7 -403
- package/dist/communication-navigation-bar.js +5 -401
- package/dist/dashboard-navigation-bar.cjs +6 -402
- package/dist/dashboard-navigation-bar.js +5 -401
- package/dist/dialog-stack.cjs +5 -401
- package/dist/dialog-stack.js +5 -401
- package/dist/dialog.cjs +13 -70
- package/dist/dialog.js +13 -70
- package/dist/drawer.cjs +23 -99
- package/dist/drawer.js +19 -96
- package/dist/e-commerce-navigation-bar.cjs +7 -403
- package/dist/e-commerce-navigation-bar.js +5 -401
- package/dist/editor.cjs +9 -405
- package/dist/editor.js +6 -402
- package/dist/iam.cjs +2 -123
- package/dist/iam.js +1 -122
- package/dist/icon-button.cjs +2 -56
- package/dist/icon-button.js +1 -55
- package/dist/identity.cjs +28 -242
- package/dist/identity.js +20 -235
- package/dist/image-crop.cjs +10 -406
- package/dist/image-crop.js +7 -403
- package/dist/image.cjs +14 -83
- package/dist/image.js +13 -67
- package/dist/index.cjs +1868 -38770
- package/dist/index.js +174 -38320
- package/dist/input-group.cjs +3 -10
- package/dist/input-group.js +2 -10
- package/dist/item.cjs +2 -27
- package/dist/item.js +1 -22
- package/dist/kanban.cjs +25 -751
- package/dist/kanban.js +15 -742
- package/dist/limelight-nav.cjs +10 -452
- package/dist/limelight-nav.js +9 -452
- package/dist/link.cjs +11 -80
- package/dist/link.js +6 -60
- package/dist/lux.config.cjs +14 -32
- package/dist/lux.config.js +3 -26
- package/dist/menu.cjs +5 -13
- package/dist/menu.js +1 -9
- package/dist/message-dock.cjs +5 -401
- package/dist/message-dock.js +5 -401
- package/dist/mini-calendar.cjs +7 -403
- package/dist/mini-calendar.js +6 -402
- package/dist/music-player.cjs +30 -528
- package/dist/music-player.js +22 -520
- package/dist/next.cjs +8 -89
- package/dist/next.js +3 -86
- package/dist/popover.cjs +17 -74
- package/dist/popover.js +16 -73
- package/dist/progress-circle.cjs +3 -10
- package/dist/progress-circle.js +2 -10
- package/dist/provider.cjs +7 -176
- package/dist/provider.js +4 -174
- package/dist/select.cjs +36 -89
- package/dist/select.js +35 -88
- package/dist/sidebar.cjs +22 -493
- package/dist/sidebar.js +17 -489
- package/dist/site/commerce/ui/context.cjs +9 -214
- package/dist/site/commerce/ui/context.js +6 -215
- package/dist/site/components/analytics.cjs +2 -42
- package/dist/site/components/analytics.js +1 -37
- package/dist/site/components/auth/callback.cjs +2 -8
- package/dist/site/components/auth/callback.js +1 -7
- package/dist/site/components/auth/login-panel.cjs +15 -74
- package/dist/site/components/auth/login-panel.js +12 -73
- package/dist/site/components/auth/login.cjs +2 -6
- package/dist/site/components/auth/login.js +1 -5
- package/dist/site/components/auth/widget.cjs +2 -6
- package/dist/site/components/auth/widget.js +1 -5
- package/dist/site/components/commerce/bag-button.cjs +2 -3
- package/dist/site/components/commerce/bag-button.js +2 -3
- package/dist/site/components/commerce/buy-button.cjs +2 -11
- package/dist/site/components/commerce/buy-button.js +1 -10
- package/dist/site/components/commerce/checkout-button.cjs +2 -3
- package/dist/site/components/commerce/checkout-button.js +2 -3
- package/dist/site/components/commerce/checkout-panel/desktop-cp.cjs +15 -173
- package/dist/site/components/commerce/checkout-panel/desktop-cp.js +14 -174
- package/dist/site/components/commerce/checkout-panel/index.cjs +9 -400
- package/dist/site/components/commerce/checkout-panel/index.js +10 -403
- package/dist/site/components/commerce/checkout-panel/mobile-cp.cjs +15 -236
- package/dist/site/components/commerce/checkout-panel/mobile-cp.js +13 -237
- package/dist/site/components/commerce/desktop-bag-popup.cjs +7 -8
- package/dist/site/components/commerce/desktop-bag-popup.js +3 -8
- package/dist/site/components/commerce/drawer/index.cjs +15 -289
- package/dist/site/components/commerce/drawer/index.js +10 -290
- package/dist/site/components/commerce/drawer/micro.cjs +8 -115
- package/dist/site/components/commerce/drawer/micro.js +4 -115
- package/dist/site/components/commerce/drawer/shell.cjs +2 -10
- package/dist/site/components/commerce/drawer/shell.js +2 -10
- package/dist/site/components/contact-dialog/index.cjs +6 -69
- package/dist/site/components/contact-dialog/index.js +7 -71
- package/dist/site/components/drawer-margin.cjs +2 -10
- package/dist/site/components/drawer-margin.js +2 -10
- package/dist/site/components/footer.cjs +11 -81
- package/dist/site/components/footer.js +8 -80
- package/dist/site/components/header/desktop.cjs +18 -374
- package/dist/site/components/header/desktop.js +12 -355
- package/dist/site/components/header/index.cjs +9 -674
- package/dist/site/components/header/index.js +8 -657
- package/dist/site/components/header/mobile-bag-drawer.cjs +6 -71
- package/dist/site/components/header/mobile-bag-drawer.js +5 -74
- package/dist/site/components/header/mobile-nav-menu-ai.cjs +2 -31
- package/dist/site/components/header/mobile-nav-menu-ai.js +1 -26
- package/dist/site/components/header/mobile-nav-menu-item.cjs +6 -60
- package/dist/site/components/header/mobile-nav-menu-item.js +6 -61
- package/dist/site/components/header/mobile-nav-menu.cjs +7 -110
- package/dist/site/components/header/mobile-nav-menu.js +7 -112
- package/dist/site/components/header/mobile.cjs +25 -330
- package/dist/site/components/header/mobile.js +20 -330
- package/dist/site/components/icons/index.cjs +34 -35
- package/dist/site/components/icons/index.js +5 -33
- package/dist/site/components/index.cjs +118 -1961
- package/dist/site/components/index.js +23 -1951
- package/dist/site/components/mini-chart/index.cjs +7 -90
- package/dist/site/components/mini-chart/index.js +1 -92
- package/dist/site/components/mini-chart/wrapper.cjs +7 -76
- package/dist/site/components/mini-chart/wrapper.js +4 -77
- package/dist/site/components/not-found/index.cjs +9 -819
- package/dist/site/components/not-found/index.js +8 -802
- package/dist/site/components/security/index.cjs +9 -819
- package/dist/site/components/security/index.js +8 -802
- package/dist/site/next/analytics/index.cjs +16 -49
- package/dist/site/next/analytics/index.js +3 -49
- package/dist/site/next/analytics/pixel-analytics.cjs +23 -8
- package/dist/site/next/analytics/pixel-analytics.js +4 -8
- package/dist/site/next/index.cjs +13 -140
- package/dist/site/next/index.js +2 -140
- package/dist/site/root-layout/index.cjs +12 -1435
- package/dist/site/root-layout/index.css +0 -133
- package/dist/site/root-layout/index.js +12 -1416
- package/dist/site/site-def/footer/community.cjs +11 -27
- package/dist/site/site-def/footer/community.js +2 -18
- package/dist/site/site-def/footer/company.d.ts +3 -3
- package/dist/site/site-def/footer/index.cjs +38 -218
- package/dist/site/site-def/footer/index.js +14 -215
- package/dist/site/site-def/index.cjs +28 -620
- package/dist/site/site-def/index.js +3 -624
- package/dist/table.cjs +20 -338
- package/dist/table.js +19 -338
- package/dist/tabs.cjs +3 -10
- package/dist/tabs.js +1 -9
- package/dist/tag.cjs +9 -270
- package/dist/tag.js +6 -268
- package/dist/tags.cjs +6 -314
- package/dist/tags.js +5 -314
- package/dist/textarea.cjs +4 -50
- package/dist/textarea.js +3 -49
- package/dist/tooltip.cjs +15 -34
- package/dist/tooltip.js +13 -33
- package/dist/vite.cjs +3 -82
- package/dist/vite.js +1 -80
- package/package.json +1 -1
- package/dist/index.css +0 -132
- package/dist/site/components/auth/login-panel.css +0 -4
- package/dist/site/components/commerce/bag-button.css +0 -4
- package/dist/site/components/commerce/checkout-button.css +0 -4
- package/dist/site/components/commerce/checkout-panel/desktop-cp.css +0 -132
- package/dist/site/components/commerce/checkout-panel/index.css +0 -132
- package/dist/site/components/commerce/checkout-panel/mobile-cp.css +0 -132
- package/dist/site/components/commerce/desktop-bag-popup.css +0 -4
- package/dist/site/components/commerce/drawer/index.css +0 -132
- package/dist/site/components/commerce/drawer/micro.css +0 -4
- package/dist/site/components/header/desktop.css +0 -4
- package/dist/site/components/header/index.css +0 -132
- package/dist/site/components/header/mobile-bag-drawer.css +0 -4
- package/dist/site/components/header/mobile-nav-menu-ai.css +0 -132
- package/dist/site/components/header/mobile-nav-menu-item.css +0 -132
- package/dist/site/components/header/mobile-nav-menu.css +0 -132
- package/dist/site/components/header/mobile.css +0 -132
- package/dist/site/components/icons/index.css +0 -4
- package/dist/site/components/index.css +0 -132
- package/dist/site/components/not-found/index.css +0 -132
- package/dist/site/components/security/index.css +0 -132
- package/dist/site/site-def/footer/community.css +0 -4
- package/dist/site/site-def/footer/index.css +0 -4
- package/dist/site/site-def/index.css +0 -4
package/dist/select.js
CHANGED
|
@@ -1,72 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { Select as Select$1 } from '@hanzo/gui';
|
|
3
|
-
import { Box,
|
|
3
|
+
import { Box, cn, sx, css } from '@hanzo/ui';
|
|
4
4
|
import { useDebounce } from '@uidotdev/usehooks';
|
|
5
|
-
import * as
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { Skeleton } from './skeleton.js';
|
|
6
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
8
|
|
|
8
|
-
var SKELETON_CLASSES = "lux-skeleton rounded-sm";
|
|
9
|
-
var Skeleton = React2.forwardRef(
|
|
10
|
-
function Skeleton2(props, ref) {
|
|
11
|
-
const { loading = true, asChild, className, children, style, ...rest } = props;
|
|
12
|
-
if (!loading) {
|
|
13
|
-
if (asChild && React2.isValidElement(children)) return children;
|
|
14
|
-
return /* @__PURE__ */ jsx(Box, { ref, className, style, ...rest, children });
|
|
15
|
-
}
|
|
16
|
-
return /* @__PURE__ */ jsx(
|
|
17
|
-
"div",
|
|
18
|
-
{
|
|
19
|
-
ref,
|
|
20
|
-
"data-loading": true,
|
|
21
|
-
...sx(
|
|
22
|
-
SKELETON_CLASSES,
|
|
23
|
-
asChild || children ? "[&_*]:invisible" : "min-h-5",
|
|
24
|
-
className
|
|
25
|
-
),
|
|
26
|
-
style,
|
|
27
|
-
...rest,
|
|
28
|
-
children
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
React2.forwardRef(
|
|
34
|
-
function SkeletonCircle2(props, ref) {
|
|
35
|
-
const { size = 40, loading = true, className, ...rest } = props;
|
|
36
|
-
const dimension = typeof size === "number" ? `${size}px` : size;
|
|
37
|
-
return /* @__PURE__ */ jsx(
|
|
38
|
-
Skeleton,
|
|
39
|
-
{
|
|
40
|
-
ref,
|
|
41
|
-
loading,
|
|
42
|
-
...sx("rounded-full shrink-0", className),
|
|
43
|
-
style: { width: dimension, height: dimension, ...rest.style },
|
|
44
|
-
...rest
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
);
|
|
49
|
-
React2.forwardRef(
|
|
50
|
-
function SkeletonText2(props, ref) {
|
|
51
|
-
const { noOfLines = 3, loading = true, className, ...rest } = props;
|
|
52
|
-
return /* @__PURE__ */ jsx(Box, { ref, className: cn("flex w-full flex-col gap-2", className), ...rest, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsx(
|
|
53
|
-
Skeleton,
|
|
54
|
-
{
|
|
55
|
-
loading,
|
|
56
|
-
...sx(cn("h-4", index === noOfLines - 1 && "max-w-[80%]"))
|
|
57
|
-
},
|
|
58
|
-
index
|
|
59
|
-
)) });
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
9
|
function createListCollection(config) {
|
|
63
10
|
return { items: config.items };
|
|
64
11
|
}
|
|
65
12
|
var ArrowIcon = (props) => /* @__PURE__ */ jsx("svg", { ...props, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M7.5 15L12.5 10L7.5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
66
13
|
var CheckIcon = (props) => /* @__PURE__ */ jsx("svg", { ...props, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M16.667 5L7.5 14.167 3.333 10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
67
14
|
function FilterInput({ placeholder, initialValue = "", onChange }) {
|
|
68
|
-
const [value, setValue] =
|
|
69
|
-
const handleChange =
|
|
15
|
+
const [value, setValue] = React.useState(initialValue);
|
|
16
|
+
const handleChange = React.useCallback((e) => {
|
|
70
17
|
setValue(e.target.value);
|
|
71
18
|
onChange?.(e.target.value);
|
|
72
19
|
}, [onChange]);
|
|
@@ -86,15 +33,15 @@ function FilterInput({ placeholder, initialValue = "", onChange }) {
|
|
|
86
33
|
}
|
|
87
34
|
);
|
|
88
35
|
}
|
|
89
|
-
var SelectInternalContext =
|
|
36
|
+
var SelectInternalContext = React.createContext(null);
|
|
90
37
|
function useSelectInternalContext() {
|
|
91
|
-
const ctx =
|
|
38
|
+
const ctx = React.useContext(SelectInternalContext);
|
|
92
39
|
if (!ctx) {
|
|
93
40
|
throw new Error("Select compound components must be rendered inside <SelectRoot>");
|
|
94
41
|
}
|
|
95
42
|
return ctx;
|
|
96
43
|
}
|
|
97
|
-
var SelectRoot =
|
|
44
|
+
var SelectRoot = React.forwardRef(
|
|
98
45
|
function SelectRoot2(props, ref) {
|
|
99
46
|
const {
|
|
100
47
|
children,
|
|
@@ -125,21 +72,21 @@ var SelectRoot = React2.forwardRef(
|
|
|
125
72
|
hideFrom: _hideFrom
|
|
126
73
|
} = props;
|
|
127
74
|
const collection = collectionProp ?? createListCollection({ items: [] });
|
|
128
|
-
const [internalValue, setInternalValue] =
|
|
75
|
+
const [internalValue, setInternalValue] = React.useState(defaultValueArr ?? []);
|
|
129
76
|
const currentValue = valueProp ?? internalValue;
|
|
130
|
-
const selectedItems =
|
|
77
|
+
const selectedItems = React.useMemo(() => {
|
|
131
78
|
return currentValue.map((v) => collection.items.find((item) => item.value === v)).filter(Boolean);
|
|
132
79
|
}, [currentValue, collection.items]);
|
|
133
|
-
const [open, setOpen] =
|
|
80
|
+
const [open, setOpen] = React.useState(defaultOpen ?? false);
|
|
134
81
|
const isOpen = openProp ?? open;
|
|
135
|
-
const handleOpenChange =
|
|
82
|
+
const handleOpenChange = React.useCallback((nextOpen) => {
|
|
136
83
|
setOpen(nextOpen);
|
|
137
84
|
onOpenChange?.(nextOpen);
|
|
138
85
|
if (!nextOpen) {
|
|
139
86
|
onInteractOutside?.();
|
|
140
87
|
}
|
|
141
88
|
}, [onOpenChange, onInteractOutside]);
|
|
142
|
-
const handleRadixValueChange =
|
|
89
|
+
const handleRadixValueChange = React.useCallback((radixValue) => {
|
|
143
90
|
const nextArr = [radixValue];
|
|
144
91
|
if (!valueProp) {
|
|
145
92
|
setInternalValue(nextArr);
|
|
@@ -147,7 +94,7 @@ var SelectRoot = React2.forwardRef(
|
|
|
147
94
|
const items = collection.items.filter((item) => nextArr.includes(item.value));
|
|
148
95
|
onValueChangeProp?.({ value: nextArr, items });
|
|
149
96
|
}, [valueProp, collection.items, onValueChangeProp]);
|
|
150
|
-
const ctxValue =
|
|
97
|
+
const ctxValue = React.useMemo(() => ({
|
|
151
98
|
value: currentValue,
|
|
152
99
|
selectedItems,
|
|
153
100
|
collection,
|
|
@@ -167,7 +114,7 @@ var SelectRoot = React2.forwardRef(
|
|
|
167
114
|
if (typeof v === "string") return v;
|
|
168
115
|
return v.base ?? v.lg ?? Object.values(v)[0];
|
|
169
116
|
};
|
|
170
|
-
const inlineStyle =
|
|
117
|
+
const inlineStyle = React.useMemo(() => {
|
|
171
118
|
const s = { ...style };
|
|
172
119
|
const rw = resolveVal(w);
|
|
173
120
|
if (rw) s.width = rw;
|
|
@@ -204,7 +151,7 @@ var SelectRoot = React2.forwardRef(
|
|
|
204
151
|
) });
|
|
205
152
|
}
|
|
206
153
|
);
|
|
207
|
-
var SelectControl =
|
|
154
|
+
var SelectControl = React.forwardRef(
|
|
208
155
|
function SelectControl2(props, ref) {
|
|
209
156
|
const { children, noIndicator, triggerProps, loading, defaultValue } = props;
|
|
210
157
|
const ctx = useSelectInternalContext();
|
|
@@ -242,11 +189,11 @@ var SelectControl = React2.forwardRef(
|
|
|
242
189
|
return trigger;
|
|
243
190
|
}
|
|
244
191
|
);
|
|
245
|
-
var SelectClearTrigger =
|
|
192
|
+
var SelectClearTrigger = React.forwardRef(
|
|
246
193
|
function SelectClearTrigger2(props, ref) {
|
|
247
194
|
const { className, ...rest } = props;
|
|
248
195
|
const ctx = useSelectInternalContext();
|
|
249
|
-
const handleClick =
|
|
196
|
+
const handleClick = React.useCallback(() => {
|
|
250
197
|
ctx.onValueChange({ value: [], items: [] });
|
|
251
198
|
}, [ctx]);
|
|
252
199
|
return /* @__PURE__ */ jsx(
|
|
@@ -264,7 +211,7 @@ var SelectClearTrigger = React2.forwardRef(
|
|
|
264
211
|
);
|
|
265
212
|
}
|
|
266
213
|
);
|
|
267
|
-
var SelectContent =
|
|
214
|
+
var SelectContent = React.forwardRef(
|
|
268
215
|
function SelectContent2(props, _ref) {
|
|
269
216
|
const { portalled: _portalled, portalRef: _portalRef, children, className, ...rest } = props;
|
|
270
217
|
let n = 0;
|
|
@@ -287,13 +234,13 @@ var SelectContent = React2.forwardRef(
|
|
|
287
234
|
);
|
|
288
235
|
}
|
|
289
236
|
);
|
|
290
|
-
var stampIndices = (children, next) =>
|
|
291
|
-
if (!
|
|
292
|
-
if (child.type === SelectItem) return
|
|
237
|
+
var stampIndices = (children, next) => React.Children.map(children, (child) => {
|
|
238
|
+
if (!React.isValidElement(child)) return child;
|
|
239
|
+
if (child.type === SelectItem) return React.cloneElement(child, { index: next() });
|
|
293
240
|
const kids = child.props.children;
|
|
294
|
-
return kids === void 0 ? child :
|
|
241
|
+
return kids === void 0 ? child : React.cloneElement(child, void 0, stampIndices(kids, next));
|
|
295
242
|
});
|
|
296
|
-
var SelectItem =
|
|
243
|
+
var SelectItem = React.forwardRef(
|
|
297
244
|
function SelectItem2(props, ref) {
|
|
298
245
|
const { item, children, className, index, ...rest } = props;
|
|
299
246
|
return /* @__PURE__ */ jsxs(
|
|
@@ -321,7 +268,7 @@ var SelectItem = React2.forwardRef(
|
|
|
321
268
|
);
|
|
322
269
|
}
|
|
323
270
|
);
|
|
324
|
-
var SelectValueText =
|
|
271
|
+
var SelectValueText = React.forwardRef(
|
|
325
272
|
function SelectValueText2(props, ref) {
|
|
326
273
|
const { children, size, required, invalid, errorText, mode, className, style, placeholder: placeholderProp, ...rest } = props;
|
|
327
274
|
const ctx = useSelectInternalContext();
|
|
@@ -378,7 +325,7 @@ var SelectValueText = React2.forwardRef(
|
|
|
378
325
|
);
|
|
379
326
|
}
|
|
380
327
|
);
|
|
381
|
-
var SelectItemGroup =
|
|
328
|
+
var SelectItemGroup = React.forwardRef(
|
|
382
329
|
function SelectItemGroup2(props, ref) {
|
|
383
330
|
const { children, label, className, ...rest } = props;
|
|
384
331
|
return /* @__PURE__ */ jsxs(Select$1.Group, { ref, ...sx("py-1", className), ...rest, children: [
|
|
@@ -389,7 +336,7 @@ var SelectItemGroup = React2.forwardRef(
|
|
|
389
336
|
);
|
|
390
337
|
var SelectLabel = Select$1.Label;
|
|
391
338
|
var SelectItemText = Select$1.ItemText;
|
|
392
|
-
var Select =
|
|
339
|
+
var Select = React.forwardRef((props, ref) => {
|
|
393
340
|
const { collection, placeholder, portalled = true, loading, errorText, contentProps, contentHeader, itemFilter, mode, ...rest } = props;
|
|
394
341
|
return /* @__PURE__ */ jsxs(
|
|
395
342
|
SelectRoot,
|
|
@@ -411,7 +358,7 @@ var Select = React2.forwardRef((props, ref) => {
|
|
|
411
358
|
) }),
|
|
412
359
|
/* @__PURE__ */ jsxs(SelectContent, { portalled, ...contentProps, children: [
|
|
413
360
|
contentHeader,
|
|
414
|
-
collection.items.filter(itemFilter ?? (() => true)).map((item) => /* @__PURE__ */ jsxs(
|
|
361
|
+
collection.items.filter(itemFilter ?? (() => true)).map((item) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
415
362
|
/* @__PURE__ */ jsx(SelectItem, { item, children: item.renderLabel ? item.renderLabel("item") : item.label }),
|
|
416
363
|
item.afterElement
|
|
417
364
|
] }, item.value))
|
|
@@ -420,19 +367,19 @@ var Select = React2.forwardRef((props, ref) => {
|
|
|
420
367
|
}
|
|
421
368
|
);
|
|
422
369
|
});
|
|
423
|
-
var SelectAsync =
|
|
370
|
+
var SelectAsync = React.forwardRef((props, ref) => {
|
|
424
371
|
const { placeholder, portalled = true, loading, loadOptions, extraControls, onValueChange, errorText, mode, contentHeader, ...rest } = props;
|
|
425
|
-
const [collection, setCollection] =
|
|
426
|
-
const [inputValue, setInputValue] =
|
|
427
|
-
const [value, setValue] =
|
|
372
|
+
const [collection, setCollection] = React.useState(createListCollection({ items: [] }));
|
|
373
|
+
const [inputValue, setInputValue] = React.useState("");
|
|
374
|
+
const [value, setValue] = React.useState([]);
|
|
428
375
|
const debouncedInputValue = useDebounce(inputValue, 300);
|
|
429
|
-
|
|
376
|
+
React.useEffect(() => {
|
|
430
377
|
loadOptions(debouncedInputValue, value).then(setCollection);
|
|
431
378
|
}, [debouncedInputValue, loadOptions, value]);
|
|
432
|
-
const handleFilterChange =
|
|
379
|
+
const handleFilterChange = React.useCallback((val) => {
|
|
433
380
|
setInputValue(val);
|
|
434
381
|
}, []);
|
|
435
|
-
const handleValueChange =
|
|
382
|
+
const handleValueChange = React.useCallback(({ value: v, items }) => {
|
|
436
383
|
setValue(v);
|
|
437
384
|
onValueChange?.({ value: v, items });
|
|
438
385
|
}, [onValueChange]);
|