@godxjp/ui 16.0.0 → 16.1.1
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/data-display/card.js +1 -1
- package/dist/components/data-entry/cascader.js +14 -17
- package/dist/components/data-entry/date-picker.js +14 -31
- package/dist/components/data-entry/date-range-picker.js +1 -2
- package/dist/components/data-entry/input.d.ts +12 -0
- package/dist/components/data-entry/input.js +26 -15
- package/dist/components/data-entry/month-picker.js +1 -2
- package/dist/components/data-entry/month-range-picker.js +1 -2
- package/dist/components/data-entry/search-select.js +16 -18
- package/dist/components/data-entry/time-picker.js +48 -65
- package/dist/components/data-entry/tree-select.js +12 -15
- package/dist/styles/card-layout.css +4 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { cn } from "../../lib/utils";
|
|
5
|
-
const cardVariants = cva("group/card
|
|
5
|
+
const cardVariants = cva("group/card", {
|
|
6
6
|
variants: {
|
|
7
7
|
size: {
|
|
8
8
|
md: "",
|
|
@@ -242,8 +242,8 @@ function Cascader({
|
|
|
242
242
|
className: cn(
|
|
243
243
|
"w-full justify-start font-normal",
|
|
244
244
|
controlOpenRingClass,
|
|
245
|
-
// Reserve trailing room for the clear
|
|
246
|
-
|
|
245
|
+
// Reserve trailing room for the single clear-or-chevron overlay rendered below.
|
|
246
|
+
"pe-9",
|
|
247
247
|
!displayLabel && "text-muted-foreground"
|
|
248
248
|
),
|
|
249
249
|
children: /* @__PURE__ */ jsx("span", { className: "truncate", children: displayLabel ?? resolvedPlaceholder })
|
|
@@ -255,14 +255,14 @@ function Cascader({
|
|
|
255
255
|
className: "w-auto min-w-[var(--radix-popover-trigger-width)] p-0",
|
|
256
256
|
align: "start",
|
|
257
257
|
children: [
|
|
258
|
-
showSearch && /* @__PURE__ */ jsx(
|
|
258
|
+
showSearch && /* @__PURE__ */ jsx(Command, { shouldFilter: false, children: /* @__PURE__ */ jsx(
|
|
259
259
|
CommandInput,
|
|
260
260
|
{
|
|
261
261
|
placeholder: t("dataEntry.cascader.searchPlaceholder"),
|
|
262
262
|
value: search,
|
|
263
263
|
onValueChange: setSearch
|
|
264
264
|
}
|
|
265
|
-
) })
|
|
265
|
+
) }),
|
|
266
266
|
isSearching ? /* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[min(300px,50vh)]", children: /* @__PURE__ */ jsx(
|
|
267
267
|
"div",
|
|
268
268
|
{
|
|
@@ -307,19 +307,16 @@ function Cascader({
|
|
|
307
307
|
}
|
|
308
308
|
)
|
|
309
309
|
] }),
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
),
|
|
321
|
-
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-4 shrink-0 opacity-50", "aria-hidden": "true" })
|
|
322
|
-
] })
|
|
310
|
+
/* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-y-0 end-3 flex items-center", children: showClear ? /* @__PURE__ */ jsx(
|
|
311
|
+
"button",
|
|
312
|
+
{
|
|
313
|
+
type: "button",
|
|
314
|
+
"aria-label": t("dataEntry.cascader.clear"),
|
|
315
|
+
className: "pointer-events-auto flex size-4 items-center justify-center rounded-sm opacity-50 hover:opacity-100 focus-visible:opacity-100",
|
|
316
|
+
onClick: clearValue,
|
|
317
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" })
|
|
318
|
+
}
|
|
319
|
+
) : /* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-4 shrink-0 opacity-50", "aria-hidden": "true" }) })
|
|
323
320
|
] });
|
|
324
321
|
}
|
|
325
322
|
export {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { CalendarIcon
|
|
3
|
+
import { CalendarIcon } from "lucide-react";
|
|
4
4
|
import { usePickerLocales, useTranslation } from "../../i18n/use-translation";
|
|
5
5
|
import { parseDateInput, toIsoDate } from "../../lib/datetime/parse";
|
|
6
6
|
import { useControlledLatch } from "../../lib/hooks";
|
|
7
7
|
import { cn } from "../../lib/utils";
|
|
8
|
-
import { Button } from "../general/button";
|
|
9
8
|
import { Input } from "./input";
|
|
10
9
|
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../data-display/popover";
|
|
11
10
|
import { Calendar } from "./calendar";
|
|
@@ -39,7 +38,6 @@ function DatePicker({
|
|
|
39
38
|
setText(toIsoDate(value));
|
|
40
39
|
}, [value]);
|
|
41
40
|
const resolvedPlaceholder = placeholder ?? t("dataEntry.datePicker.placeholder") ?? ISO_HINT;
|
|
42
|
-
const showClear = allowClear && Boolean(value) && !disabled;
|
|
43
41
|
const clear = () => {
|
|
44
42
|
emit(void 0);
|
|
45
43
|
setText("");
|
|
@@ -70,7 +68,19 @@ function DatePicker({
|
|
|
70
68
|
role: "combobox",
|
|
71
69
|
"aria-expanded": open,
|
|
72
70
|
"aria-haspopup": "dialog",
|
|
73
|
-
|
|
71
|
+
allowClear,
|
|
72
|
+
onClear: clear,
|
|
73
|
+
trailingIcon: /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
74
|
+
"button",
|
|
75
|
+
{
|
|
76
|
+
type: "button",
|
|
77
|
+
disabled,
|
|
78
|
+
tabIndex: -1,
|
|
79
|
+
"aria-label": t("dataEntry.datePicker.openCalendar") ?? "Open calendar",
|
|
80
|
+
className: "text-muted-foreground hover:text-foreground inline-flex size-5 items-center justify-center rounded-sm opacity-70 transition-opacity hover:opacity-100",
|
|
81
|
+
children: /* @__PURE__ */ jsx(CalendarIcon, { className: "size-4", "aria-hidden": "true" })
|
|
82
|
+
}
|
|
83
|
+
) }),
|
|
74
84
|
onClick: () => {
|
|
75
85
|
if (!disabled) setOpen(true);
|
|
76
86
|
},
|
|
@@ -92,33 +102,6 @@ function DatePicker({
|
|
|
92
102
|
}
|
|
93
103
|
}
|
|
94
104
|
),
|
|
95
|
-
showClear ? /* @__PURE__ */ jsx(
|
|
96
|
-
Button,
|
|
97
|
-
{
|
|
98
|
-
type: "button",
|
|
99
|
-
variant: "ghost",
|
|
100
|
-
size: "icon",
|
|
101
|
-
disabled,
|
|
102
|
-
tabIndex: -1,
|
|
103
|
-
"aria-label": t("common.clear") ?? "Clear",
|
|
104
|
-
className: "text-muted-foreground absolute inset-y-0 end-8 h-full px-2 hover:bg-transparent",
|
|
105
|
-
onClick: clear,
|
|
106
|
-
children: /* @__PURE__ */ jsx(X, { className: "size-4 shrink-0", "aria-hidden": "true" })
|
|
107
|
-
}
|
|
108
|
-
) : null,
|
|
109
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
110
|
-
Button,
|
|
111
|
-
{
|
|
112
|
-
type: "button",
|
|
113
|
-
variant: "ghost",
|
|
114
|
-
size: "icon",
|
|
115
|
-
disabled,
|
|
116
|
-
tabIndex: -1,
|
|
117
|
-
"aria-label": t("dataEntry.datePicker.openCalendar") ?? "Open calendar",
|
|
118
|
-
className: "text-muted-foreground absolute inset-y-0 end-0 h-full px-2 hover:bg-transparent",
|
|
119
|
-
children: /* @__PURE__ */ jsx(CalendarIcon, { className: "size-4 shrink-0", "aria-hidden": "true" })
|
|
120
|
-
}
|
|
121
|
-
) }),
|
|
122
105
|
/* @__PURE__ */ jsx(
|
|
123
106
|
PopoverContent,
|
|
124
107
|
{
|
|
@@ -142,8 +142,7 @@ function DateRangePicker({
|
|
|
142
142
|
},
|
|
143
143
|
children: /* @__PURE__ */ jsx(X, { className: "size-4 shrink-0", "aria-hidden": "true" })
|
|
144
144
|
}
|
|
145
|
-
) :
|
|
146
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
145
|
+
) : /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
147
146
|
"button",
|
|
148
147
|
{
|
|
149
148
|
type: "button",
|
|
@@ -4,10 +4,22 @@ export type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
|
4
4
|
allowClear?: boolean;
|
|
5
5
|
/** Called after the field is cleared via the inline ✕. */
|
|
6
6
|
onClear?: () => void;
|
|
7
|
+
/**
|
|
8
|
+
* A trailing affordance pinned inside the field — e.g. a calendar / clock popover
|
|
9
|
+
* trigger button. ONE trailing icon shows at a time: when `allowClear` and the field
|
|
10
|
+
* holds a value the clear ✕ REPLACES this icon; otherwise this icon shows. Never both.
|
|
11
|
+
*/
|
|
12
|
+
trailingIcon?: React.ReactNode;
|
|
7
13
|
};
|
|
8
14
|
export declare const Input: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & {
|
|
9
15
|
/** Show an inline ✕ that clears the field while it holds text (default false). */
|
|
10
16
|
allowClear?: boolean;
|
|
11
17
|
/** Called after the field is cleared via the inline ✕. */
|
|
12
18
|
onClear?: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* A trailing affordance pinned inside the field — e.g. a calendar / clock popover
|
|
21
|
+
* trigger button. ONE trailing icon shows at a time: when `allowClear` and the field
|
|
22
|
+
* holds a value the clear ✕ REPLACES this icon; otherwise this icon shows. Never both.
|
|
23
|
+
*/
|
|
24
|
+
trailingIcon?: React.ReactNode;
|
|
13
25
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -13,7 +13,17 @@ const inputBaseClass = [
|
|
|
13
13
|
"aria-invalid:border-destructive aria-invalid:ring-destructive/20"
|
|
14
14
|
];
|
|
15
15
|
const Input = React.forwardRef(
|
|
16
|
-
({
|
|
16
|
+
({
|
|
17
|
+
className,
|
|
18
|
+
type,
|
|
19
|
+
allowClear = false,
|
|
20
|
+
onClear,
|
|
21
|
+
trailingIcon,
|
|
22
|
+
value,
|
|
23
|
+
defaultValue,
|
|
24
|
+
onChange,
|
|
25
|
+
...props
|
|
26
|
+
}, ref) => {
|
|
17
27
|
const { t } = useTranslation();
|
|
18
28
|
const innerRef = React.useRef(null);
|
|
19
29
|
const setRefs = React.useCallback(
|
|
@@ -48,7 +58,7 @@ const Input = React.forwardRef(
|
|
|
48
58
|
setHasText(false);
|
|
49
59
|
onClear?.();
|
|
50
60
|
};
|
|
51
|
-
if (!allowClear) {
|
|
61
|
+
if (!allowClear && trailingIcon == null) {
|
|
52
62
|
return /* @__PURE__ */ jsx(
|
|
53
63
|
"input",
|
|
54
64
|
{
|
|
@@ -63,7 +73,18 @@ const Input = React.forwardRef(
|
|
|
63
73
|
}
|
|
64
74
|
);
|
|
65
75
|
}
|
|
66
|
-
const showClear = hasText && !props.disabled && !props.readOnly;
|
|
76
|
+
const showClear = allowClear && hasText && !props.disabled && !props.readOnly;
|
|
77
|
+
const trailing = showClear ? /* @__PURE__ */ jsx(
|
|
78
|
+
"button",
|
|
79
|
+
{
|
|
80
|
+
type: "button",
|
|
81
|
+
tabIndex: -1,
|
|
82
|
+
"aria-label": t("common.clear") ?? "Clear",
|
|
83
|
+
onClick: clear,
|
|
84
|
+
className: "text-muted-foreground hover:text-foreground inline-flex size-5 items-center justify-center rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:opacity-100",
|
|
85
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" })
|
|
86
|
+
}
|
|
87
|
+
) : trailingIcon;
|
|
67
88
|
return /* @__PURE__ */ jsxs("span", { "data-slot": "input-affix-wrapper", className: "relative inline-flex w-full items-center", children: [
|
|
68
89
|
/* @__PURE__ */ jsx(
|
|
69
90
|
"input",
|
|
@@ -74,21 +95,11 @@ const Input = React.forwardRef(
|
|
|
74
95
|
value,
|
|
75
96
|
defaultValue,
|
|
76
97
|
onChange: handleChange,
|
|
77
|
-
className: cn(inputBaseClass, showClear && "pe-9", className),
|
|
98
|
+
className: cn(inputBaseClass, (showClear || trailingIcon != null) && "pe-9", className),
|
|
78
99
|
...props
|
|
79
100
|
}
|
|
80
101
|
),
|
|
81
|
-
|
|
82
|
-
"button",
|
|
83
|
-
{
|
|
84
|
-
type: "button",
|
|
85
|
-
tabIndex: -1,
|
|
86
|
-
"aria-label": t("common.clear") ?? "Clear",
|
|
87
|
-
onClick: clear,
|
|
88
|
-
className: "text-muted-foreground hover:text-foreground absolute end-2 inline-flex size-5 items-center justify-center rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:opacity-100",
|
|
89
|
-
children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" })
|
|
90
|
-
}
|
|
91
|
-
) : null
|
|
102
|
+
trailing != null ? /* @__PURE__ */ jsx("span", { className: "absolute inset-y-0 end-2 inline-flex items-center", children: trailing }) : null
|
|
92
103
|
] });
|
|
93
104
|
}
|
|
94
105
|
);
|
|
@@ -109,8 +109,7 @@ function MonthPicker({
|
|
|
109
109
|
},
|
|
110
110
|
children: /* @__PURE__ */ jsx(X, { className: "size-4 shrink-0", "aria-hidden": "true" })
|
|
111
111
|
}
|
|
112
|
-
) :
|
|
113
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
112
|
+
) : /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
114
113
|
"button",
|
|
115
114
|
{
|
|
116
115
|
type: "button",
|
|
@@ -164,8 +164,7 @@ function MonthRangePicker({
|
|
|
164
164
|
},
|
|
165
165
|
children: /* @__PURE__ */ jsx(X, { className: "size-4 shrink-0", "aria-hidden": "true" })
|
|
166
166
|
}
|
|
167
|
-
) :
|
|
168
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
167
|
+
) : /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
169
168
|
"button",
|
|
170
169
|
{
|
|
171
170
|
type: "button",
|
|
@@ -172,8 +172,8 @@ function SearchSelect({
|
|
|
172
172
|
className: cn(
|
|
173
173
|
"w-full justify-start font-normal",
|
|
174
174
|
controlOpenRingClass,
|
|
175
|
-
// Reserve trailing room for the clear
|
|
176
|
-
|
|
175
|
+
// Reserve trailing room for the single clear-or-chevron overlay rendered below.
|
|
176
|
+
"pe-9"
|
|
177
177
|
),
|
|
178
178
|
children: /* @__PURE__ */ jsx(
|
|
179
179
|
"span",
|
|
@@ -199,7 +199,7 @@ function SearchSelect({
|
|
|
199
199
|
collisionPadding: 12,
|
|
200
200
|
className: "flex max-h-[var(--radix-popover-content-available-height)] w-max max-w-[min(32rem,calc(100vw-1.5rem))] min-w-[var(--radix-popover-trigger-width)] flex-col p-0",
|
|
201
201
|
children: /* @__PURE__ */ jsxs(Command, { shouldFilter: false, className: "flex min-h-0 flex-col", children: [
|
|
202
|
-
/* @__PURE__ */ jsx("div", { className: "border-border shrink-0 border-b
|
|
202
|
+
/* @__PURE__ */ jsx("div", { className: "border-border shrink-0 border-b", children: /* @__PURE__ */ jsx(
|
|
203
203
|
Input,
|
|
204
204
|
{
|
|
205
205
|
autoFocus: true,
|
|
@@ -209,7 +209,8 @@ function SearchSelect({
|
|
|
209
209
|
value: query,
|
|
210
210
|
onChange: (event) => setQuery(event.target.value),
|
|
211
211
|
onKeyDown,
|
|
212
|
-
placeholder: searchPlaceholder ?? t("dataEntry.searchSelect.search")
|
|
212
|
+
placeholder: searchPlaceholder ?? t("dataEntry.searchSelect.search"),
|
|
213
|
+
className: "rounded-none border-0 shadow-none focus-visible:ring-0"
|
|
213
214
|
}
|
|
214
215
|
) }),
|
|
215
216
|
/* @__PURE__ */ jsxs(
|
|
@@ -265,20 +266,17 @@ function SearchSelect({
|
|
|
265
266
|
]
|
|
266
267
|
}
|
|
267
268
|
),
|
|
268
|
-
/* @__PURE__ */
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
) : null,
|
|
280
|
-
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-4 shrink-0 opacity-50", "aria-hidden": "true" })
|
|
281
|
-
] })
|
|
269
|
+
/* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-y-0 end-3 flex items-center", children: showClear ? /* @__PURE__ */ jsx(
|
|
270
|
+
"button",
|
|
271
|
+
{
|
|
272
|
+
type: "button",
|
|
273
|
+
"aria-label": clearLabel ?? t("dataEntry.searchSelect.clear"),
|
|
274
|
+
"data-testid": optionTestId("clear"),
|
|
275
|
+
className: "pointer-events-auto flex size-4 items-center justify-center rounded-sm opacity-50 hover:opacity-100 focus-visible:opacity-100",
|
|
276
|
+
onClick: clear,
|
|
277
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" })
|
|
278
|
+
}
|
|
279
|
+
) : /* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-4 shrink-0 opacity-50", "aria-hidden": "true" }) })
|
|
282
280
|
] });
|
|
283
281
|
}
|
|
284
282
|
export {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { Clock
|
|
3
|
+
import { Clock } from "lucide-react";
|
|
4
4
|
import { usePickerLocales, useTranslation } from "../../i18n/use-translation";
|
|
5
5
|
import { isValidHhmm, normalizeHhmm } from "../../lib/datetime";
|
|
6
6
|
import { cn } from "../../lib/utils";
|
|
7
|
-
import { Button } from "../general/button";
|
|
8
7
|
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../data-display/popover";
|
|
9
8
|
import { Input } from "./input";
|
|
10
9
|
function pad2(n) {
|
|
@@ -228,76 +227,60 @@ function TimePicker({
|
|
|
228
227
|
if (!isControlled) setInternal(next);
|
|
229
228
|
onValueChange?.(next);
|
|
230
229
|
};
|
|
231
|
-
const showClear = allowClear && Boolean(value) && !disabled;
|
|
232
230
|
const clear = () => {
|
|
233
231
|
setValue("");
|
|
234
232
|
setText("");
|
|
235
233
|
};
|
|
236
234
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
237
|
-
/* @__PURE__ */ jsx(PopoverAnchor, { asChild: true, children: /* @__PURE__ */
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
},
|
|
263
|
-
onChange: (event) => {
|
|
264
|
-
setText(event.target.value);
|
|
265
|
-
const normalized = normalizeHhmm(event.target.value);
|
|
266
|
-
if (normalized) setValue(normalized);
|
|
267
|
-
},
|
|
268
|
-
onBlur: (event) => {
|
|
269
|
-
const normalized = normalizeHhmm(event.target.value);
|
|
270
|
-
setText(normalized ?? (isValidHhmm(value) ? value : ""));
|
|
235
|
+
/* @__PURE__ */ jsx(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: cn("relative", className), children: /* @__PURE__ */ jsx(
|
|
236
|
+
Input,
|
|
237
|
+
{
|
|
238
|
+
id,
|
|
239
|
+
name,
|
|
240
|
+
value: text,
|
|
241
|
+
disabled,
|
|
242
|
+
placeholder: resolvedPlaceholder,
|
|
243
|
+
inputMode: "numeric",
|
|
244
|
+
autoComplete: "off",
|
|
245
|
+
role: "combobox",
|
|
246
|
+
"aria-expanded": open,
|
|
247
|
+
"aria-haspopup": "dialog",
|
|
248
|
+
className: "tabular-nums",
|
|
249
|
+
allowClear,
|
|
250
|
+
onClear: clear,
|
|
251
|
+
trailingIcon: /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
252
|
+
"button",
|
|
253
|
+
{
|
|
254
|
+
type: "button",
|
|
255
|
+
disabled,
|
|
256
|
+
tabIndex: -1,
|
|
257
|
+
"aria-label": t("dataEntry.timePicker.openPicker") ?? "Open time picker",
|
|
258
|
+
className: "text-muted-foreground hover:text-foreground inline-flex size-5 items-center justify-center rounded-sm opacity-70 transition-opacity hover:opacity-100",
|
|
259
|
+
children: /* @__PURE__ */ jsx(Clock, { className: "size-4", "aria-hidden": "true" })
|
|
271
260
|
}
|
|
261
|
+
) }),
|
|
262
|
+
onClick: () => {
|
|
263
|
+
if (!disabled) setOpen(true);
|
|
264
|
+
},
|
|
265
|
+
onKeyDown: (event) => {
|
|
266
|
+
if (event.key === "ArrowDown") {
|
|
267
|
+
event.preventDefault();
|
|
268
|
+
setOpen(true);
|
|
269
|
+
} else if (event.key === "Escape" && open) {
|
|
270
|
+
setOpen(false);
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
onChange: (event) => {
|
|
274
|
+
setText(event.target.value);
|
|
275
|
+
const normalized = normalizeHhmm(event.target.value);
|
|
276
|
+
if (normalized) setValue(normalized);
|
|
277
|
+
},
|
|
278
|
+
onBlur: (event) => {
|
|
279
|
+
const normalized = normalizeHhmm(event.target.value);
|
|
280
|
+
setText(normalized ?? (isValidHhmm(value) ? value : ""));
|
|
272
281
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
Button,
|
|
276
|
-
{
|
|
277
|
-
type: "button",
|
|
278
|
-
variant: "ghost",
|
|
279
|
-
size: "icon",
|
|
280
|
-
disabled,
|
|
281
|
-
tabIndex: -1,
|
|
282
|
-
"aria-label": t("common.clear") ?? "Clear",
|
|
283
|
-
className: "text-muted-foreground absolute inset-y-0 end-0 h-full px-2 hover:bg-transparent",
|
|
284
|
-
onClick: clear,
|
|
285
|
-
children: /* @__PURE__ */ jsx(X, { className: "size-4 shrink-0", "aria-hidden": "true" })
|
|
286
|
-
}
|
|
287
|
-
) : /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
288
|
-
Button,
|
|
289
|
-
{
|
|
290
|
-
type: "button",
|
|
291
|
-
variant: "ghost",
|
|
292
|
-
size: "icon",
|
|
293
|
-
disabled,
|
|
294
|
-
tabIndex: -1,
|
|
295
|
-
"aria-label": t("dataEntry.timePicker.openPicker") ?? "Open time picker",
|
|
296
|
-
className: "text-muted-foreground absolute inset-y-0 end-0 h-full px-2 hover:bg-transparent",
|
|
297
|
-
children: /* @__PURE__ */ jsx(Clock, { className: "size-4 shrink-0", "aria-hidden": "true" })
|
|
298
|
-
}
|
|
299
|
-
) })
|
|
300
|
-
] }) }),
|
|
282
|
+
}
|
|
283
|
+
) }) }),
|
|
301
284
|
/* @__PURE__ */ jsx(
|
|
302
285
|
PopoverContent,
|
|
303
286
|
{
|
|
@@ -185,31 +185,28 @@ function TreeSelectRoot({
|
|
|
185
185
|
),
|
|
186
186
|
children: [
|
|
187
187
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: displayKeys.length ? displayLabel : resolvedPlaceholder }),
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
),
|
|
199
|
-
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-4 opacity-50", "aria-hidden": "true" })
|
|
200
|
-
] })
|
|
188
|
+
/* @__PURE__ */ jsx("span", { className: "ms-2 flex shrink-0 items-center", children: allowClear && displayKeys.length > 0 && !disabled ? /* @__PURE__ */ jsx(
|
|
189
|
+
"button",
|
|
190
|
+
{
|
|
191
|
+
type: "button",
|
|
192
|
+
"aria-label": t("dataEntry.treeSelect.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
|
+
) : /* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-4 opacity-50", "aria-hidden": "true" }) })
|
|
201
198
|
]
|
|
202
199
|
}
|
|
203
200
|
) }),
|
|
204
201
|
/* @__PURE__ */ jsxs(PopoverContent, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: [
|
|
205
|
-
showSearch && /* @__PURE__ */ jsx(
|
|
202
|
+
showSearch && /* @__PURE__ */ jsx(Command, { shouldFilter: false, children: /* @__PURE__ */ jsx(
|
|
206
203
|
CommandInput,
|
|
207
204
|
{
|
|
208
205
|
placeholder: t("dataEntry.treeSelect.searchPlaceholder"),
|
|
209
206
|
value: search,
|
|
210
207
|
onValueChange: setSearch
|
|
211
208
|
}
|
|
212
|
-
) })
|
|
209
|
+
) }),
|
|
213
210
|
/* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[min(300px,50vh)]", children: /* @__PURE__ */ jsx(
|
|
214
211
|
"div",
|
|
215
212
|
{
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
@layer components {
|
|
24
24
|
[data-slot="card"] {
|
|
25
25
|
min-width: 0;
|
|
26
|
+
/* Base hairline border — width lives here (not a Tailwind `border` utility) so the
|
|
27
|
+
* `[data-accent]` rail-width override below can win within the same cascade layer. */
|
|
28
|
+
border-width: 1px;
|
|
29
|
+
border-style: solid;
|
|
26
30
|
border-color: hsl(var(--card-border));
|
|
27
31
|
border-radius: var(--card-radius);
|
|
28
32
|
background: hsl(var(--card-background));
|