@godxjp/ui 11.0.1 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-PGG4IM2Y.js → chunk-2HOTP7RL.js} +3 -1
- package/dist/{chunk-2HXZT2WJ.js → chunk-7BF7U3GG.js} +39 -18
- package/dist/{chunk-VSM44AYE.js → chunk-F6JGFU6O.js} +34 -13
- package/dist/{chunk-4S2AAMSS.js → chunk-FAB3LMTK.js} +2 -2
- package/dist/{chunk-DNGJHWJZ.js → chunk-FTOG7D4T.js} +4 -2
- package/dist/chunk-LN7GE73P.js +318 -0
- package/dist/{chunk-PDXFQS7M.js → chunk-Q4WWD4VV.js} +2 -4
- package/dist/{chunk-GDDCSKCB.js → chunk-QWALQSBS.js} +53 -19
- package/dist/components/admin/index.d.ts +1 -1
- package/dist/components/admin/index.js +18 -18
- package/dist/components/data-display/card.d.ts +2 -2
- package/dist/components/data-display/index.d.ts +1 -1
- package/dist/components/data-display/index.js +5 -5
- package/dist/components/data-entry/calendar.js +1 -1
- package/dist/components/data-entry/cascader.js +1 -4
- package/dist/components/data-entry/date-picker.js +2 -2
- package/dist/components/data-entry/date-range-picker.js +2 -2
- package/dist/components/data-entry/index.d.ts +1 -1
- package/dist/components/data-entry/index.js +13 -13
- package/dist/components/data-entry/time-picker.js +1 -1
- package/dist/components/data-entry/transfer.js +2 -2
- package/dist/components/data-entry/tree-select.js +1 -1
- package/dist/components/data-entry/upload.js +4 -4
- package/dist/components/feedback/dialog.js +2 -2
- package/dist/components/feedback/index.d.ts +3 -3
- package/dist/components/feedback/index.js +3 -3
- package/dist/components/layout/index.js +2 -2
- package/dist/components/navigation/index.js +1 -1
- package/dist/components/navigation/pagination.js +1 -1
- package/dist/components/ui/index.js +19 -19
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -26
- package/dist/props/index.js +1 -1
- package/dist/{search-input-DpqDMXcn.d.ts → search-input-C_x-JFD3.d.ts} +3 -1
- package/dist/styles/control.css +14 -8
- package/dist/styles/data-display-layout.css +52 -2
- package/dist/styles/layout.css +27 -5
- package/dist/styles/navigation-layout.css +3 -3
- package/dist/styles/shell-layout.css +4 -4
- package/package.json +4 -3
- package/dist/chunk-5NCFLCM7.js +0 -255
- package/dist/{chunk-QHODCQDW.js → chunk-BG5RNXTH.js} +1 -1
- package/dist/{chunk-TGNBXS7H.js → chunk-PUGEOUWZ.js} +1 -1
- package/dist/{chunk-SJ77SVEK.js → chunk-USNR424B.js} +1 -1
|
@@ -120,13 +120,22 @@
|
|
|
120
120
|
.ui-timeline {
|
|
121
121
|
display: flex;
|
|
122
122
|
flex-direction: column;
|
|
123
|
-
gap: var(--space-stack-md);
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
.ui-timeline-item {
|
|
127
126
|
display: grid;
|
|
128
127
|
grid-template-columns: 1.5rem minmax(0, 1fr);
|
|
129
|
-
gap: var(--space-stack-md);
|
|
128
|
+
column-gap: var(--space-stack-md);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* Spacing lives INSIDE the item (not a flex gap between items) so the rail line
|
|
132
|
+
spans the full item height and the connector stays continuous dot-to-dot. */
|
|
133
|
+
.ui-timeline-body {
|
|
134
|
+
padding-bottom: var(--space-stack-md);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.ui-timeline-item:last-child .ui-timeline-body {
|
|
138
|
+
padding-bottom: 0;
|
|
130
139
|
}
|
|
131
140
|
|
|
132
141
|
.ui-timeline-rail {
|
|
@@ -207,6 +216,17 @@
|
|
|
207
216
|
.ui-accordion-trigger:hover {
|
|
208
217
|
text-decoration: underline;
|
|
209
218
|
}
|
|
219
|
+
.ui-accordion-trigger:focus-visible {
|
|
220
|
+
outline: 2px solid hsl(var(--ring));
|
|
221
|
+
outline-offset: 2px;
|
|
222
|
+
border-radius: var(--radius-sm);
|
|
223
|
+
}
|
|
224
|
+
.ui-accordion-trigger:disabled,
|
|
225
|
+
.ui-accordion-trigger[data-disabled] {
|
|
226
|
+
cursor: not-allowed;
|
|
227
|
+
opacity: 0.5;
|
|
228
|
+
pointer-events: none;
|
|
229
|
+
}
|
|
210
230
|
.ui-accordion-chevron {
|
|
211
231
|
width: 1rem;
|
|
212
232
|
height: 1rem;
|
|
@@ -292,3 +312,33 @@
|
|
|
292
312
|
width: 1rem;
|
|
293
313
|
height: 1rem;
|
|
294
314
|
}
|
|
315
|
+
|
|
316
|
+
/* Vertical orientation (opts.axis === "y") — flips the track and the arrow positions. */
|
|
317
|
+
.ui-carousel[data-orientation="vertical"] .ui-carousel-content {
|
|
318
|
+
flex-direction: column;
|
|
319
|
+
margin-inline: 0;
|
|
320
|
+
margin-block: calc(var(--space-4) * -1);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.ui-carousel[data-orientation="vertical"] .ui-carousel-item {
|
|
324
|
+
min-width: 0;
|
|
325
|
+
min-height: 100%;
|
|
326
|
+
padding-inline: 0;
|
|
327
|
+
padding-block: var(--space-4);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.ui-carousel[data-orientation="vertical"] .ui-carousel-previous,
|
|
331
|
+
.ui-carousel[data-orientation="vertical"] .ui-carousel-next {
|
|
332
|
+
top: auto;
|
|
333
|
+
left: 50%;
|
|
334
|
+
right: auto;
|
|
335
|
+
transform: translateX(-50%);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.ui-carousel[data-orientation="vertical"] .ui-carousel-previous {
|
|
339
|
+
top: var(--space-2);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.ui-carousel[data-orientation="vertical"] .ui-carousel-next {
|
|
343
|
+
bottom: var(--space-2);
|
|
344
|
+
}
|
package/dist/styles/layout.css
CHANGED
|
@@ -201,21 +201,39 @@
|
|
|
201
201
|
background: hsl(var(--border));
|
|
202
202
|
position: relative;
|
|
203
203
|
flex-shrink: 0;
|
|
204
|
+
display: flex;
|
|
205
|
+
align-items: center;
|
|
206
|
+
justify-content: center;
|
|
207
|
+
color: hsl(var(--muted-foreground));
|
|
204
208
|
}
|
|
205
209
|
|
|
210
|
+
/* Vertical orientation: the separator is a horizontal strip, so swap the
|
|
211
|
+
geometry — give it height instead of width. v4 sets aria-orientation. */
|
|
212
|
+
.ui-resizable-handle[aria-orientation="vertical"] {
|
|
213
|
+
width: auto;
|
|
214
|
+
height: var(--control-border-width);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* v4 react-resizable-panels marks the active (dragging) and disabled state
|
|
218
|
+
via the data-separator attribute value, not data-state. */
|
|
206
219
|
.ui-resizable-handle:hover,
|
|
207
|
-
.ui-resizable-handle[data-
|
|
220
|
+
.ui-resizable-handle[data-separator="active"] {
|
|
208
221
|
background: hsl(var(--accent));
|
|
209
222
|
}
|
|
210
223
|
|
|
211
224
|
.ui-resizable-handle:hover::after,
|
|
212
|
-
.ui-resizable-handle[data-
|
|
225
|
+
.ui-resizable-handle[data-separator="active"]::after {
|
|
213
226
|
content: "";
|
|
214
227
|
position: absolute;
|
|
215
228
|
inset: 0;
|
|
216
229
|
background: hsl(var(--accent-foreground) / 0.2);
|
|
217
230
|
}
|
|
218
231
|
|
|
232
|
+
.ui-resizable-handle[data-separator="disabled"] {
|
|
233
|
+
cursor: not-allowed;
|
|
234
|
+
opacity: 0.5;
|
|
235
|
+
}
|
|
236
|
+
|
|
219
237
|
@media (min-width: 1080px) {
|
|
220
238
|
.ui-split-pane[data-aside-width="sm"] {
|
|
221
239
|
grid-template-columns: minmax(0, 1fr) 20rem;
|
|
@@ -465,7 +483,9 @@
|
|
|
465
483
|
|
|
466
484
|
.ui-pagination-size-trigger {
|
|
467
485
|
width: var(--pagination-size-width);
|
|
468
|
-
|
|
486
|
+
/* Default control height — primitive never picks a sub-default tier; the app
|
|
487
|
+
* overrides via className if it wants smaller. Shared with the page buttons. */
|
|
488
|
+
height: var(--control-height);
|
|
469
489
|
}
|
|
470
490
|
|
|
471
491
|
.ui-pagination-list {
|
|
@@ -482,6 +502,8 @@
|
|
|
482
502
|
|
|
483
503
|
.ui-pagination-ellipsis {
|
|
484
504
|
display: flex;
|
|
505
|
+
width: var(--control-height);
|
|
506
|
+
height: var(--control-height);
|
|
485
507
|
align-items: center;
|
|
486
508
|
justify-content: center;
|
|
487
509
|
color: hsl(var(--muted-foreground));
|
|
@@ -489,8 +511,8 @@
|
|
|
489
511
|
|
|
490
512
|
.ui-pagination-link {
|
|
491
513
|
display: inline-flex;
|
|
492
|
-
width:
|
|
493
|
-
height:
|
|
514
|
+
width: var(--control-height);
|
|
515
|
+
height: var(--control-height);
|
|
494
516
|
align-items: center;
|
|
495
517
|
justify-content: center;
|
|
496
518
|
border-radius: var(--radius-sm);
|
|
@@ -160,14 +160,14 @@
|
|
|
160
160
|
|
|
161
161
|
.ui-menubar {
|
|
162
162
|
display: flex;
|
|
163
|
-
min-height:
|
|
163
|
+
min-height: var(--control-height);
|
|
164
164
|
align-items: center;
|
|
165
165
|
gap: var(--space-1);
|
|
166
166
|
border-radius: var(--radius-md);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
.ui-menubar-trigger {
|
|
170
|
-
height:
|
|
170
|
+
height: var(--control-height);
|
|
171
171
|
padding: 0 var(--space-3);
|
|
172
172
|
border-radius: var(--radius-md);
|
|
173
173
|
}
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
border-radius: var(--radius-md);
|
|
208
208
|
padding-inline: var(--space-2);
|
|
209
209
|
padding-block: var(--space-2);
|
|
210
|
-
height:
|
|
210
|
+
height: var(--control-height);
|
|
211
211
|
font-size: var(--font-size-sm);
|
|
212
212
|
display: inline-flex;
|
|
213
213
|
align-items: center;
|
|
@@ -482,7 +482,7 @@
|
|
|
482
482
|
display: inline-flex;
|
|
483
483
|
max-width: 15rem;
|
|
484
484
|
min-width: 0;
|
|
485
|
-
height:
|
|
485
|
+
height: var(--control-height-sm);
|
|
486
486
|
align-items: center;
|
|
487
487
|
gap: var(--space-1);
|
|
488
488
|
padding-inline: var(--space-2);
|
|
@@ -540,7 +540,7 @@
|
|
|
540
540
|
.tb-search {
|
|
541
541
|
display: flex;
|
|
542
542
|
width: min(20rem, 30vw);
|
|
543
|
-
height:
|
|
543
|
+
height: var(--control-height-sm);
|
|
544
544
|
align-items: center;
|
|
545
545
|
gap: var(--space-2);
|
|
546
546
|
padding-inline: var(--space-2);
|
|
@@ -576,8 +576,8 @@
|
|
|
576
576
|
|
|
577
577
|
.tb-icon-btn {
|
|
578
578
|
display: grid;
|
|
579
|
-
width:
|
|
580
|
-
height:
|
|
579
|
+
width: var(--control-height-sm);
|
|
580
|
+
height: var(--control-height-sm);
|
|
581
581
|
flex: 0 0 auto;
|
|
582
582
|
place-items: center;
|
|
583
583
|
border: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@godxjp/ui",
|
|
3
|
-
"version": "11.0
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"packageManager": "pnpm@10.29.1",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -266,12 +266,13 @@
|
|
|
266
266
|
"test:watch": "vitest",
|
|
267
267
|
"test:coverage": "vitest run --coverage",
|
|
268
268
|
"check:example-imports": "node scripts/check-example-imports.mjs",
|
|
269
|
-
"verify": "pnpm typecheck && pnpm lint && pnpm format && pnpm build && pnpm preview:build && pnpm check:example-imports && pnpm check:core-isolation && pnpm check:prop-vocabulary && pnpm check:token-tiers && pnpm check:mcp-sync && pnpm check:mcp-orphans && pnpm test",
|
|
270
|
-
"verify:release": "pnpm typecheck && pnpm lint && pnpm build && pnpm preview:build && pnpm check:example-imports && pnpm check:core-isolation && pnpm check:prop-vocabulary && pnpm check:token-tiers && pnpm check:mcp-sync && pnpm check:mcp-orphans && pnpm test",
|
|
269
|
+
"verify": "pnpm typecheck && pnpm lint && pnpm format && pnpm build && pnpm preview:build && pnpm check:example-imports && pnpm check:core-isolation && pnpm check:prop-vocabulary && pnpm check:token-tiers && pnpm check:control-sizing && pnpm check:mcp-sync && pnpm check:mcp-orphans && pnpm test",
|
|
270
|
+
"verify:release": "pnpm typecheck && pnpm lint && pnpm build && pnpm preview:build && pnpm check:example-imports && pnpm check:core-isolation && pnpm check:prop-vocabulary && pnpm check:token-tiers && pnpm check:control-sizing && pnpm check:mcp-sync && pnpm check:mcp-orphans && pnpm test",
|
|
271
271
|
"check:mcp-sync": "node scripts/check-mcp-sync.mjs",
|
|
272
272
|
"check:mcp-orphans": "node scripts/check-mcp-orphans.mjs",
|
|
273
273
|
"check:prop-vocabulary": "node scripts/check-prop-vocabulary.mjs",
|
|
274
274
|
"check:token-tiers": "node scripts/check-token-tiers.mjs",
|
|
275
|
+
"check:control-sizing": "node scripts/check-control-sizing.mjs",
|
|
275
276
|
"check:core-isolation": "node scripts/check-core-isolation.mjs",
|
|
276
277
|
"release": "node scripts/release.mjs",
|
|
277
278
|
"preview": "node preview/scripts/kill-port.mjs && vite --config preview/vite.config.ts --port 6008 --strictPort",
|
package/dist/chunk-5NCFLCM7.js
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import { normalizeTreeOptions, formatPathLabels, getNodeByPath, filterTreeOptions, pathsEqual, pathKey } from './chunk-SMLKNECP.js';
|
|
2
|
-
import { Command, CommandInput } from './chunk-HTEL5DQI.js';
|
|
3
|
-
import { Checkbox } from './chunk-BE6GJGKJ.js';
|
|
4
|
-
import { Button } from './chunk-M4PZNAMV.js';
|
|
5
|
-
import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
|
|
6
|
-
import { ScrollArea, ScrollBar } from './chunk-3KPEZ5CF.js';
|
|
7
|
-
import { useTranslation } from './chunk-HTG5VHU7.js';
|
|
8
|
-
import { cn } from './chunk-U7N2A7A3.js';
|
|
9
|
-
import * as React from 'react';
|
|
10
|
-
import { X, ChevronsUpDown, Check, ChevronRight } from 'lucide-react';
|
|
11
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
12
|
-
|
|
13
|
-
function pathInValues(path, values) {
|
|
14
|
-
return values.some((v) => pathsEqual(v, path));
|
|
15
|
-
}
|
|
16
|
-
function togglePath(values, path) {
|
|
17
|
-
if (pathInValues(path, values)) return values.filter((v) => !pathsEqual(v, path));
|
|
18
|
-
return [...values, path];
|
|
19
|
-
}
|
|
20
|
-
function Cascader({
|
|
21
|
-
options: optionsProp,
|
|
22
|
-
value,
|
|
23
|
-
defaultValue,
|
|
24
|
-
onValueChange,
|
|
25
|
-
multiple,
|
|
26
|
-
changeOnSelect,
|
|
27
|
-
showSearch,
|
|
28
|
-
placeholder,
|
|
29
|
-
disabled,
|
|
30
|
-
className,
|
|
31
|
-
id,
|
|
32
|
-
expandTrigger = "click",
|
|
33
|
-
fieldNames,
|
|
34
|
-
allowClear = true
|
|
35
|
-
}) {
|
|
36
|
-
const { t } = useTranslation();
|
|
37
|
-
const options = React.useMemo(
|
|
38
|
-
() => normalizeTreeOptions(optionsProp, fieldNames),
|
|
39
|
-
[optionsProp, fieldNames]
|
|
40
|
-
);
|
|
41
|
-
const [open, setOpen] = React.useState(false);
|
|
42
|
-
const [activePath, setActivePath] = React.useState([]);
|
|
43
|
-
const [search, setSearch] = React.useState("");
|
|
44
|
-
const isControlledSingle = !multiple && value !== void 0;
|
|
45
|
-
const isControlledMulti = multiple && value !== void 0;
|
|
46
|
-
const [internalSingle, setInternalSingle] = React.useState(
|
|
47
|
-
multiple ? [] : defaultValue ?? []
|
|
48
|
-
);
|
|
49
|
-
const [internalMulti, setInternalMulti] = React.useState(
|
|
50
|
-
defaultValue ?? []
|
|
51
|
-
);
|
|
52
|
-
const singleValue = isControlledSingle ? value : internalSingle;
|
|
53
|
-
const multiValue = isControlledMulti ? value : internalMulti;
|
|
54
|
-
const resolvedPlaceholder = placeholder ?? t("dataEntry.cascader.placeholder");
|
|
55
|
-
const displayLabel = React.useMemo(() => {
|
|
56
|
-
if (multiple) {
|
|
57
|
-
if (!multiValue.length) return null;
|
|
58
|
-
return multiValue.map((path) => formatPathLabels(getNodeByPath(options, path))).join(", ");
|
|
59
|
-
}
|
|
60
|
-
if (!singleValue.length) return null;
|
|
61
|
-
return formatPathLabels(getNodeByPath(options, singleValue));
|
|
62
|
-
}, [multiple, multiValue, singleValue, options]);
|
|
63
|
-
const commitSingle = (path) => {
|
|
64
|
-
if (!isControlledSingle) setInternalSingle(path);
|
|
65
|
-
onValueChange?.(path, getNodeByPath(options, path));
|
|
66
|
-
setOpen(false);
|
|
67
|
-
setActivePath([]);
|
|
68
|
-
setSearch("");
|
|
69
|
-
};
|
|
70
|
-
const commitMulti = (paths) => {
|
|
71
|
-
if (!isControlledMulti) setInternalMulti(paths);
|
|
72
|
-
onValueChange?.(
|
|
73
|
-
paths,
|
|
74
|
-
paths.map((p) => getNodeByPath(options, p))
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
const columns = React.useMemo(() => {
|
|
78
|
-
const cols = [options];
|
|
79
|
-
for (const segment of activePath) {
|
|
80
|
-
const col = cols.at(-1);
|
|
81
|
-
const node = col?.find((n) => n.value === segment);
|
|
82
|
-
if (node?.children?.length) cols.push(node.children);
|
|
83
|
-
else break;
|
|
84
|
-
}
|
|
85
|
-
return cols;
|
|
86
|
-
}, [options, activePath]);
|
|
87
|
-
const handleSelectNode = (node, path) => {
|
|
88
|
-
const hasChildren = (node.children?.length ?? 0) > 0 && node.isLeaf !== true;
|
|
89
|
-
if (hasChildren && !changeOnSelect) {
|
|
90
|
-
setActivePath(path);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (multiple) {
|
|
94
|
-
commitMulti(togglePath(multiValue, path));
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
commitSingle(path);
|
|
98
|
-
};
|
|
99
|
-
const isSearching = showSearch && search.trim().length > 0;
|
|
100
|
-
const searchResults = React.useMemo(
|
|
101
|
-
() => isSearching ? filterTreeOptions(options, search) : [],
|
|
102
|
-
[options, search, isSearching]
|
|
103
|
-
);
|
|
104
|
-
const handleOpenChange = (next) => {
|
|
105
|
-
setOpen(next);
|
|
106
|
-
if (!next) {
|
|
107
|
-
setSearch("");
|
|
108
|
-
setActivePath([]);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
const clearValue = (e) => {
|
|
112
|
-
e.stopPropagation();
|
|
113
|
-
if (multiple) commitMulti([]);
|
|
114
|
-
else commitSingle([]);
|
|
115
|
-
};
|
|
116
|
-
const renderCascadeColumns = () => /* @__PURE__ */ jsxs(ScrollArea, { className: "w-full", children: [
|
|
117
|
-
/* @__PURE__ */ jsx("div", { className: "flex max-h-[min(280px,50vh)]", children: columns.map((col, colIndex) => /* @__PURE__ */ jsx(
|
|
118
|
-
"ul",
|
|
119
|
-
{
|
|
120
|
-
role: "listbox",
|
|
121
|
-
"aria-orientation": "vertical",
|
|
122
|
-
"aria-multiselectable": multiple ? true : void 0,
|
|
123
|
-
className: "min-w-[9rem] border-e last:border-e-0",
|
|
124
|
-
onMouseLeave: expandTrigger === "hover" ? () => setActivePath(activePath.slice(0, colIndex)) : void 0,
|
|
125
|
-
children: col.map((node) => {
|
|
126
|
-
const path = [...activePath.slice(0, colIndex), node.value];
|
|
127
|
-
const hasChildren = (node.children?.length ?? 0) > 0 && node.isLeaf !== true;
|
|
128
|
-
const active = activePath[colIndex] === node.value;
|
|
129
|
-
const selected = multiple ? pathInValues(path, multiValue) : pathsEqual(path, singleValue);
|
|
130
|
-
return /* @__PURE__ */ jsx("li", { role: "none", children: /* @__PURE__ */ jsxs(
|
|
131
|
-
"button",
|
|
132
|
-
{
|
|
133
|
-
type: "button",
|
|
134
|
-
role: "option",
|
|
135
|
-
"aria-selected": selected,
|
|
136
|
-
"aria-haspopup": hasChildren ? "menu" : void 0,
|
|
137
|
-
"aria-expanded": hasChildren ? active : void 0,
|
|
138
|
-
disabled: node.disabled,
|
|
139
|
-
className: cn(
|
|
140
|
-
"flex w-full items-center gap-1 px-3 py-2 text-sm outline-none",
|
|
141
|
-
"hover:bg-accent hover:text-accent-foreground",
|
|
142
|
-
active && "bg-accent/70 font-medium",
|
|
143
|
-
node.disabled && "pointer-events-none opacity-50"
|
|
144
|
-
),
|
|
145
|
-
onMouseEnter: expandTrigger === "hover" && hasChildren ? () => setActivePath(path) : void 0,
|
|
146
|
-
onClick: () => !node.disabled && handleSelectNode(node, path),
|
|
147
|
-
children: [
|
|
148
|
-
multiple && /* @__PURE__ */ jsx(
|
|
149
|
-
Checkbox,
|
|
150
|
-
{
|
|
151
|
-
checked: selected,
|
|
152
|
-
disabled: node.disabled,
|
|
153
|
-
className: "me-1",
|
|
154
|
-
"aria-hidden": true,
|
|
155
|
-
tabIndex: -1
|
|
156
|
-
}
|
|
157
|
-
),
|
|
158
|
-
!multiple && selected && /* @__PURE__ */ jsx(Check, { className: "me-1 size-4 shrink-0", "aria-hidden": "true" }),
|
|
159
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-start", children: node.label }),
|
|
160
|
-
hasChildren && /* @__PURE__ */ jsx(ChevronRight, { className: "size-4 shrink-0 opacity-50", "aria-hidden": "true" })
|
|
161
|
-
]
|
|
162
|
-
}
|
|
163
|
-
) }, node.value);
|
|
164
|
-
})
|
|
165
|
-
},
|
|
166
|
-
colIndex
|
|
167
|
-
)) }),
|
|
168
|
-
/* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" })
|
|
169
|
-
] });
|
|
170
|
-
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
|
|
171
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
172
|
-
Button,
|
|
173
|
-
{
|
|
174
|
-
id,
|
|
175
|
-
type: "button",
|
|
176
|
-
variant: "outline",
|
|
177
|
-
role: "combobox",
|
|
178
|
-
"aria-expanded": open,
|
|
179
|
-
disabled,
|
|
180
|
-
className: cn(
|
|
181
|
-
"w-full justify-between font-normal",
|
|
182
|
-
!displayLabel && "text-muted-foreground",
|
|
183
|
-
className
|
|
184
|
-
),
|
|
185
|
-
children: [
|
|
186
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: displayLabel ?? resolvedPlaceholder }),
|
|
187
|
-
/* @__PURE__ */ jsxs("span", { className: "ms-2 flex shrink-0 items-center gap-1", children: [
|
|
188
|
-
allowClear && displayLabel && !disabled && /* @__PURE__ */ jsx(
|
|
189
|
-
"button",
|
|
190
|
-
{
|
|
191
|
-
type: "button",
|
|
192
|
-
"aria-label": t("dataEntry.cascader.clear"),
|
|
193
|
-
className: "flex size-4 items-center justify-center rounded-sm opacity-50 hover:opacity-100 focus-visible:opacity-100",
|
|
194
|
-
onClick: clearValue,
|
|
195
|
-
children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" })
|
|
196
|
-
}
|
|
197
|
-
),
|
|
198
|
-
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-4 opacity-50", "aria-hidden": "true" })
|
|
199
|
-
] })
|
|
200
|
-
]
|
|
201
|
-
}
|
|
202
|
-
) }),
|
|
203
|
-
/* @__PURE__ */ jsxs(
|
|
204
|
-
PopoverContent,
|
|
205
|
-
{
|
|
206
|
-
className: "w-auto min-w-[var(--radix-popover-trigger-width)] p-0",
|
|
207
|
-
align: "start",
|
|
208
|
-
children: [
|
|
209
|
-
showSearch && /* @__PURE__ */ jsx("div", { className: "border-b p-2", children: /* @__PURE__ */ jsx(Command, { shouldFilter: false, children: /* @__PURE__ */ jsx(
|
|
210
|
-
CommandInput,
|
|
211
|
-
{
|
|
212
|
-
placeholder: t("dataEntry.cascader.searchPlaceholder"),
|
|
213
|
-
value: search,
|
|
214
|
-
onValueChange: setSearch
|
|
215
|
-
}
|
|
216
|
-
) }) }),
|
|
217
|
-
isSearching ? /* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[min(300px,50vh)]", children: /* @__PURE__ */ jsx("div", { className: "p-1", role: "listbox", "aria-multiselectable": multiple ? true : void 0, children: searchResults.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground py-6 text-center text-sm", children: t("dataEntry.cascader.empty") }) : searchResults.map(({ path, labels }) => {
|
|
218
|
-
const label = labels.join(" / ");
|
|
219
|
-
const selected = multiple ? pathInValues(path, multiValue) : pathsEqual(path, singleValue);
|
|
220
|
-
return /* @__PURE__ */ jsxs(
|
|
221
|
-
"button",
|
|
222
|
-
{
|
|
223
|
-
type: "button",
|
|
224
|
-
role: "option",
|
|
225
|
-
"aria-selected": selected,
|
|
226
|
-
className: cn(
|
|
227
|
-
"flex w-full items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
228
|
-
"hover:bg-accent hover:text-accent-foreground",
|
|
229
|
-
selected && "bg-accent/60"
|
|
230
|
-
),
|
|
231
|
-
onClick: () => handleSelectNode({ value: path.at(-1)}, path),
|
|
232
|
-
children: [
|
|
233
|
-
multiple ? /* @__PURE__ */ jsx(Checkbox, { checked: selected, className: "me-2", "aria-hidden": true, tabIndex: -1 }) : /* @__PURE__ */ jsx(
|
|
234
|
-
Check,
|
|
235
|
-
{
|
|
236
|
-
className: cn(
|
|
237
|
-
"me-2 size-4 shrink-0",
|
|
238
|
-
selected ? "opacity-100" : "opacity-0"
|
|
239
|
-
),
|
|
240
|
-
"aria-hidden": "true"
|
|
241
|
-
}
|
|
242
|
-
),
|
|
243
|
-
/* @__PURE__ */ jsx("span", { className: "truncate text-start", children: label })
|
|
244
|
-
]
|
|
245
|
-
},
|
|
246
|
-
pathKey(path)
|
|
247
|
-
);
|
|
248
|
-
}) }) }) : renderCascadeColumns()
|
|
249
|
-
]
|
|
250
|
-
}
|
|
251
|
-
)
|
|
252
|
-
] });
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
export { Cascader };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Input } from './chunk-VOHTRR5X.js';
|
|
2
2
|
import { buttonVariants, Button } from './chunk-M4PZNAMV.js';
|
|
3
|
-
import { useTranslation } from './chunk-HTG5VHU7.js';
|
|
4
3
|
import { Label } from './chunk-7PWBC4BY.js';
|
|
4
|
+
import { useTranslation } from './chunk-HTG5VHU7.js';
|
|
5
5
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DropdownMenu, DropdownMenuTrigger } from './chunk-LMKUKCTN.js';
|
|
2
1
|
import { Tooltip, TooltipTrigger, TooltipContent } from './chunk-32WO3YLB.js';
|
|
2
|
+
import { DropdownMenu, DropdownMenuTrigger } from './chunk-LMKUKCTN.js';
|
|
3
3
|
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from './chunk-DV52WNXO.js';
|
|
4
4
|
import { densityClass, pageContainerVariantClass } from './chunk-INIIF7F7.js';
|
|
5
5
|
import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Checkbox } from './chunk-BE6GJGKJ.js';
|
|
2
1
|
import { Flex, densityClass } from './chunk-INIIF7F7.js';
|
|
2
|
+
import { Checkbox } from './chunk-BE6GJGKJ.js';
|
|
3
3
|
import { Button } from './chunk-M4PZNAMV.js';
|
|
4
4
|
import { Table, TableHeader, TableRow, TableHead, TableBody, TableCell } from './chunk-4MMIMZMK.js';
|
|
5
5
|
import { tableCellPaddingClass, tableRowHeightClass, controlIconSmClass } from './chunk-IBK5D2Q6.js';
|