@deepnoid/ui 0.1.200 → 0.1.202
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/.turbo/turbo-build.log +185 -185
- package/dist/{chunk-YBXBTE5T.mjs → chunk-COGGK5Q6.mjs} +1 -1
- package/dist/{chunk-VXO7B27Q.mjs → chunk-F6BQCZ54.mjs} +12 -6
- package/dist/{chunk-75ZDPLJ4.mjs → chunk-K2RW5KLO.mjs} +20 -0
- package/dist/components/list/index.mjs +3 -3
- package/dist/components/picker/index.js +17 -0
- package/dist/components/picker/index.mjs +5 -5
- package/dist/components/picker/timePicker.js +508 -60
- package/dist/components/picker/timePicker.mjs +10 -2
- package/dist/components/select/index.js +476 -28
- package/dist/components/select/index.mjs +9 -1
- package/dist/components/select/select.d.mts +1 -0
- package/dist/components/select/select.d.ts +1 -0
- package/dist/components/select/select.js +476 -28
- package/dist/components/select/select.mjs +9 -1
- package/dist/components/table/index.mjs +1 -1
- package/dist/components/table/table-body.mjs +1 -1
- package/dist/components/table/table-head.mjs +1 -1
- package/dist/components/table/table.mjs +1 -1
- package/dist/components/tree/index.js +11 -5
- package/dist/components/tree/index.mjs +1 -1
- package/dist/components/tree/tree.js +11 -5
- package/dist/components/tree/tree.mjs +1 -1
- package/dist/index.js +28 -5
- package/dist/index.mjs +48 -48
- package/package.json +1 -1
|
@@ -10,20 +10,24 @@ import {
|
|
|
10
10
|
} from "./chunk-27Y6K5NK.mjs";
|
|
11
11
|
|
|
12
12
|
// src/components/tree/tree.tsx
|
|
13
|
-
import { forwardRef, useMemo, useState, useCallback, useEffect, memo } from "react";
|
|
13
|
+
import { forwardRef, useMemo, useState, useCallback, useEffect, memo, useRef } from "react";
|
|
14
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
var TreeNodeItemBase = forwardRef(
|
|
16
16
|
({ node, depth, fileIcon, selectedName, classNames, onExpand }, ref) => {
|
|
17
17
|
const slots = useMemo(() => treeStyle(), []);
|
|
18
18
|
const hasSelectedInChildren = useCallback(
|
|
19
19
|
(children2) => {
|
|
20
|
-
if (!children2) return false;
|
|
20
|
+
if (!children2 || !selectedName) return false;
|
|
21
21
|
return children2.some((child) => child.selectedName === selectedName || hasSelectedInChildren(child.children));
|
|
22
22
|
},
|
|
23
23
|
[selectedName]
|
|
24
24
|
);
|
|
25
25
|
const [children, setChildren] = useState(node.children);
|
|
26
|
-
const [isOpen, setIsOpen] = useState(() =>
|
|
26
|
+
const [isOpen, setIsOpen] = useState(() => {
|
|
27
|
+
if (!selectedName) return false;
|
|
28
|
+
return hasSelectedInChildren(node.children);
|
|
29
|
+
});
|
|
30
|
+
const hasOpenedInitially = useRef(false);
|
|
27
31
|
const hasMore = useMemo(() => {
|
|
28
32
|
if (node.isLeaf) return false;
|
|
29
33
|
if (Array.isArray(children)) return children.length > 0;
|
|
@@ -51,11 +55,13 @@ var TreeNodeItemBase = forwardRef(
|
|
|
51
55
|
(_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
|
|
52
56
|
};
|
|
53
57
|
useEffect(() => {
|
|
54
|
-
|
|
55
|
-
if (
|
|
58
|
+
if (!selectedName) return;
|
|
59
|
+
if (!hasOpenedInitially.current) {
|
|
60
|
+
const shouldOpen = hasSelectedInChildren(children);
|
|
56
61
|
setIsOpen(shouldOpen);
|
|
62
|
+
hasOpenedInitially.current = true;
|
|
57
63
|
}
|
|
58
|
-
}, [selectedName, children, hasSelectedInChildren
|
|
64
|
+
}, [selectedName, children, hasSelectedInChildren]);
|
|
59
65
|
return /* @__PURE__ */ jsxs(
|
|
60
66
|
"div",
|
|
61
67
|
{
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
icon_button_default
|
|
4
|
+
} from "./chunk-TB2DOWSM.mjs";
|
|
2
5
|
import {
|
|
3
6
|
Icon_default
|
|
4
7
|
} from "./chunk-YEYUS6DW.mjs";
|
|
@@ -33,6 +36,7 @@ var Select = forwardRef((originalProps, ref) => {
|
|
|
33
36
|
dropdownIconName = "brace-up",
|
|
34
37
|
optionIconName,
|
|
35
38
|
optionIconPlacement,
|
|
39
|
+
clearable,
|
|
36
40
|
...inputProps
|
|
37
41
|
} = props;
|
|
38
42
|
const slots = useMemo(() => select({ ...variantProps }), [variantProps]);
|
|
@@ -86,6 +90,11 @@ var Select = forwardRef((originalProps, ref) => {
|
|
|
86
90
|
setSelectedOptions(nextOptions);
|
|
87
91
|
onChange == null ? void 0 : onChange(nextOptions);
|
|
88
92
|
};
|
|
93
|
+
const handleClear = (e) => {
|
|
94
|
+
e.stopPropagation();
|
|
95
|
+
setSelectedOptions([]);
|
|
96
|
+
onChange == null ? void 0 : onChange([]);
|
|
97
|
+
};
|
|
89
98
|
useEffect(() => {
|
|
90
99
|
const handleClickOutside = (e) => {
|
|
91
100
|
var _a2;
|
|
@@ -212,6 +221,17 @@ var Select = forwardRef((originalProps, ref) => {
|
|
|
212
221
|
}
|
|
213
222
|
),
|
|
214
223
|
/* @__PURE__ */ jsx("input", { type: "hidden", name: inputProps.name, value: selectedValue }),
|
|
224
|
+
clearable && selectedOptions.length > 0 && /* @__PURE__ */ jsx(
|
|
225
|
+
icon_button_default,
|
|
226
|
+
{
|
|
227
|
+
name: "close",
|
|
228
|
+
variant: "ghost",
|
|
229
|
+
size: "sm",
|
|
230
|
+
color: "neutral",
|
|
231
|
+
onClick: handleClear,
|
|
232
|
+
classNames: { base: "pr-[2px]" }
|
|
233
|
+
}
|
|
234
|
+
),
|
|
215
235
|
/* @__PURE__ */ jsx(
|
|
216
236
|
Icon_default,
|
|
217
237
|
{
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../chunk-7MVEAQ7Z.mjs";
|
|
3
|
-
import {
|
|
4
|
-
list_default
|
|
5
|
-
} from "../../chunk-NGRGAY42.mjs";
|
|
6
3
|
import {
|
|
7
4
|
listItem_default
|
|
8
5
|
} from "../../chunk-K3M3QEEV.mjs";
|
|
6
|
+
import {
|
|
7
|
+
list_default
|
|
8
|
+
} from "../../chunk-NGRGAY42.mjs";
|
|
9
9
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
10
10
|
import "../../chunk-YEYUS6DW.mjs";
|
|
11
11
|
import "../../chunk-E3G5QXSH.mjs";
|
|
@@ -7156,6 +7156,7 @@ var Select = (0, import_react8.forwardRef)((originalProps, ref) => {
|
|
|
7156
7156
|
dropdownIconName = "brace-up",
|
|
7157
7157
|
optionIconName,
|
|
7158
7158
|
optionIconPlacement,
|
|
7159
|
+
clearable,
|
|
7159
7160
|
...inputProps
|
|
7160
7161
|
} = props;
|
|
7161
7162
|
const slots = (0, import_react8.useMemo)(() => select({ ...variantProps }), [variantProps]);
|
|
@@ -7209,6 +7210,11 @@ var Select = (0, import_react8.forwardRef)((originalProps, ref) => {
|
|
|
7209
7210
|
setSelectedOptions(nextOptions);
|
|
7210
7211
|
onChange == null ? void 0 : onChange(nextOptions);
|
|
7211
7212
|
};
|
|
7213
|
+
const handleClear = (e) => {
|
|
7214
|
+
e.stopPropagation();
|
|
7215
|
+
setSelectedOptions([]);
|
|
7216
|
+
onChange == null ? void 0 : onChange([]);
|
|
7217
|
+
};
|
|
7212
7218
|
(0, import_react8.useEffect)(() => {
|
|
7213
7219
|
const handleClickOutside = (e) => {
|
|
7214
7220
|
var _a2;
|
|
@@ -7335,6 +7341,17 @@ var Select = (0, import_react8.forwardRef)((originalProps, ref) => {
|
|
|
7335
7341
|
}
|
|
7336
7342
|
),
|
|
7337
7343
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "hidden", name: inputProps.name, value: selectedValue }),
|
|
7344
|
+
clearable && selectedOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
7345
|
+
icon_button_default,
|
|
7346
|
+
{
|
|
7347
|
+
name: "close",
|
|
7348
|
+
variant: "ghost",
|
|
7349
|
+
size: "sm",
|
|
7350
|
+
color: "neutral",
|
|
7351
|
+
onClick: handleClear,
|
|
7352
|
+
classNames: { base: "pr-[2px]" }
|
|
7353
|
+
}
|
|
7354
|
+
),
|
|
7338
7355
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
7339
7356
|
Icon_default,
|
|
7340
7357
|
{
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../chunk-4VWG4726.mjs";
|
|
3
|
+
import {
|
|
4
|
+
timePicker_default
|
|
5
|
+
} from "../../chunk-COGGK5Q6.mjs";
|
|
6
|
+
import "../../chunk-QCEKPS7U.mjs";
|
|
7
|
+
import "../../chunk-K2RW5KLO.mjs";
|
|
3
8
|
import {
|
|
4
9
|
datePicker_default
|
|
5
10
|
} from "../../chunk-2EUKWA4W.mjs";
|
|
@@ -7,11 +12,6 @@ import "../../chunk-FWFEKWWD.mjs";
|
|
|
7
12
|
import {
|
|
8
13
|
day_default
|
|
9
14
|
} from "../../chunk-XZYQFBCT.mjs";
|
|
10
|
-
import {
|
|
11
|
-
timePicker_default
|
|
12
|
-
} from "../../chunk-YBXBTE5T.mjs";
|
|
13
|
-
import "../../chunk-QCEKPS7U.mjs";
|
|
14
|
-
import "../../chunk-75ZDPLJ4.mjs";
|
|
15
15
|
import "../../chunk-2GCSFWHD.mjs";
|
|
16
16
|
import "../../chunk-3RTVVQA3.mjs";
|
|
17
17
|
import "../../chunk-MY5U63QO.mjs";
|