@godxjp/ui 13.5.1 → 13.7.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/app/index.js +4 -4
- package/dist/{checkbox-iicX1PfF.d.ts → checkbox-ChJ2PyIz.d.ts} +1 -1
- package/dist/{chunk-HOQSAUHZ.js → chunk-2FJ5TMQU.js} +1 -1
- package/dist/{chunk-LIOHE3RU.js → chunk-3JQDPNTA.js} +1 -1
- package/dist/{chunk-IYSGELQC.js → chunk-3ZNSR2NL.js} +3 -3
- package/dist/{chunk-CA247VOA.js → chunk-5L77S5CL.js} +31 -1
- package/dist/chunk-6AIYMYSG.js +98 -0
- package/dist/{chunk-QHS4U3SS.js → chunk-6EKAEN6T.js} +3 -3
- package/dist/{chunk-RR2SSSQS.js → chunk-B23A5CPA.js} +2 -2
- package/dist/{chunk-DKW3XS2A.js → chunk-B7R7DHZF.js} +1 -1
- package/dist/{chunk-ITOHGSPS.js → chunk-C7W5BO7R.js} +3 -0
- package/dist/{chunk-QEHMSZBQ.js → chunk-CSTUENE6.js} +27 -7
- package/dist/{chunk-PXOPMYPJ.js → chunk-G7A6SUIN.js} +28 -7
- package/dist/{chunk-CLEBTIY3.js → chunk-GOJQHYED.js} +141 -101
- package/dist/{chunk-4GHHVXUR.js → chunk-I472SSN2.js} +2 -2
- package/dist/{chunk-BIC6D4EL.js → chunk-JXGDDD46.js} +2 -2
- package/dist/{chunk-LCKET5WL.js → chunk-KW54IV4X.js} +3 -3
- package/dist/{chunk-3JIPRB2T.js → chunk-LFO5BJ4H.js} +2 -2
- package/dist/{chunk-46UVXYPU.js → chunk-LTKHPOE3.js} +1 -1
- package/dist/{chunk-2XH6QAOC.js → chunk-MUUO7SPN.js} +1 -1
- package/dist/{chunk-WW47N4ID.js → chunk-O3F3KF2B.js} +3 -3
- package/dist/{chunk-IHNZCBES.js → chunk-QMGNMDQG.js} +28 -8
- package/dist/{chunk-QVLCFPKF.js → chunk-QPRBPE4S.js} +3 -3
- package/dist/{chunk-6EBULOWM.js → chunk-QTEPKNQE.js} +1 -1
- package/dist/{chunk-E2CTBKYL.js → chunk-RBXVCWXL.js} +2 -2
- package/dist/{chunk-XBFXYKJS.js → chunk-SXECWZZV.js} +4 -4
- package/dist/{chunk-YY5PUFBL.js → chunk-TNFAUPEV.js} +4 -4
- package/dist/{chunk-JCDLEXBB.js → chunk-W3AS2GEC.js} +2 -2
- package/dist/chunk-ZOMIELKI.js +86 -0
- package/dist/{chunk-BTTKHJMC.js → chunk-ZYJRZLMZ.js} +1 -1
- package/dist/components/admin/index.d.ts +2 -2
- package/dist/components/admin/index.js +27 -27
- package/dist/components/data-display/badge.js +3 -3
- package/dist/components/data-display/card.d.ts +2 -2
- package/dist/components/data-display/carousel.js +3 -3
- package/dist/components/data-display/index.js +8 -8
- package/dist/components/data-entry/calendar.d.ts +1 -1
- package/dist/components/data-entry/calendar.js +4 -2
- package/dist/components/data-entry/cascader.d.ts +1 -1
- package/dist/components/data-entry/cascader.js +4 -4
- package/dist/components/data-entry/checkbox.d.ts +2 -2
- package/dist/components/data-entry/color-picker.d.ts +1 -1
- package/dist/components/data-entry/color-picker.js +4 -4
- package/dist/components/data-entry/date-picker.d.ts +2 -2
- package/dist/components/data-entry/date-picker.js +6 -6
- package/dist/components/data-entry/date-range-picker.d.ts +2 -2
- package/dist/components/data-entry/date-range-picker.js +6 -6
- package/dist/components/data-entry/index.d.ts +4 -4
- package/dist/components/data-entry/index.js +22 -22
- package/dist/components/data-entry/input.d.ts +12 -2
- package/dist/components/data-entry/input.js +3 -1
- package/dist/components/data-entry/radio.d.ts +1 -1
- package/dist/components/data-entry/select.d.ts +1 -1
- package/dist/components/data-entry/select.js +5 -5
- package/dist/components/data-entry/slider.d.ts +1 -1
- package/dist/components/data-entry/switch.d.ts +1 -1
- package/dist/components/data-entry/textarea.d.ts +12 -2
- package/dist/components/data-entry/textarea.js +3 -1
- package/dist/components/data-entry/time-input.js +2 -2
- package/dist/components/data-entry/time-picker.d.ts +2 -2
- package/dist/components/data-entry/time-picker.js +5 -5
- package/dist/components/data-entry/transfer.d.ts +2 -2
- package/dist/components/data-entry/transfer.js +6 -6
- package/dist/components/data-entry/tree-select.d.ts +1 -1
- package/dist/components/data-entry/tree-select.js +4 -4
- package/dist/components/data-entry/upload.d.ts +2 -2
- package/dist/components/data-entry/upload.js +7 -7
- package/dist/components/data-grid/index.js +6 -6
- package/dist/components/feedback/alert.js +5 -5
- package/dist/components/feedback/dialog.js +5 -5
- package/dist/components/feedback/index.js +9 -9
- package/dist/components/general/button.d.ts +4 -1
- package/dist/components/general/button.js +3 -1
- package/dist/components/general/index.d.ts +1 -1
- package/dist/components/general/index.js +3 -1
- package/dist/components/layout/index.js +4 -4
- package/dist/components/navigation/index.js +8 -8
- package/dist/components/navigation/pagination.js +6 -6
- package/dist/components/navigation/steps.js +3 -3
- package/dist/components/query/index.d.ts +2 -2
- package/dist/components/query/index.js +5 -5
- package/dist/components/ui/index.d.ts +3 -3
- package/dist/components/ui/index.js +29 -29
- package/dist/{data-entry.prop-D92hPBuo.d.ts → data-entry.prop-CyiZuEI8.d.ts} +39 -2
- package/dist/{general.prop-CBQ_KVtR.d.ts → general.prop-CzlQin6v.d.ts} +18 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +40 -40
- package/dist/lib/datetime/index.js +1 -1
- package/dist/props/components/index.d.ts +3 -3
- package/dist/props/index.d.ts +3 -3
- package/dist/props/index.js +1 -1
- package/dist/{query.prop-CsRuaXNb.d.ts → query.prop-CT2gFtr4.d.ts} +1 -1
- package/dist/{search-input-D29GSk0W.d.ts → search-input--ui38eQV.d.ts} +1 -1
- package/dist/styles/control.css +24 -1
- package/package.json +3 -2
- package/dist/chunk-BNXPDUO4.js +0 -28
- package/dist/chunk-HCCID4YY.js +0 -11
package/dist/app/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useAppContext } from '../chunk-
|
|
2
|
-
export { APP_LOCALES, APP_REQUEST_HEADER_LOCALE, APP_REQUEST_HEADER_TIMEZONE, APP_TIMEZONE_PRESET, APP_TIME_FORMAT_OPTIONS, AppProvider, DEFAULT_STORAGE_KEY, TIMEZONE_ALIASES, formatTimezoneDisplayLabel, getAllIanaTimezones, getAppRequestHeaders, getBrowserTimezone, getTimeFormatLabel, getTimezoneCityName, getTimezoneLabel, getTimezoneOffsetLabel, isValidIanaTimezone, readStoredPreferences, resetAppRequestHeaders, resetIanaTimezoneCacheForTests, resolveDefaultTimeFormat, resolveDefaultTimezone, resolveTimezoneForIntl, resolveTimezonePickerOptions, syncAppRequestHeaders, useAppContext, useAppDateFormat, useAppLocale, useAppTimeFormat, useAppTimezone, useOptionalAppContext, usePickerLocales, useTranslation, writeStoredPreferences } from '../chunk-
|
|
3
|
-
import { formatDate } from '../chunk-
|
|
4
|
-
export { APP_DATE_FORMATS, APP_DATE_FORMAT_OPTIONS, APP_LOCALE_CONFIG, APP_REQUEST_HEADER_DATE_FORMAT, APP_REQUEST_HEADER_TIME_FORMAT, APP_TIME_FORMATS, detectFormatDateKind, formatAppDate, formatAppDateLong, formatAppDateTime, formatAppRelative, formatAppTime, formatCalendarDate, formatDate, formatTimeOfDay, getDateFnsLocale, getDateFormatLabel, getDatePattern, getDateTimePattern, getDatetimeContext, getDayPickerLocale, getTimePattern, isAppDateFormat, isAppLocale, isAppTimeFormat, isFormatDateValue, isValidHhmm, normalizeHhmm, parseDateInput, resolveDefaultDateFormat, syncDatetimeContext } from '../chunk-
|
|
1
|
+
import { useAppContext } from '../chunk-QTEPKNQE.js';
|
|
2
|
+
export { APP_LOCALES, APP_REQUEST_HEADER_LOCALE, APP_REQUEST_HEADER_TIMEZONE, APP_TIMEZONE_PRESET, APP_TIME_FORMAT_OPTIONS, AppProvider, DEFAULT_STORAGE_KEY, TIMEZONE_ALIASES, formatTimezoneDisplayLabel, getAllIanaTimezones, getAppRequestHeaders, getBrowserTimezone, getTimeFormatLabel, getTimezoneCityName, getTimezoneLabel, getTimezoneOffsetLabel, isValidIanaTimezone, readStoredPreferences, resetAppRequestHeaders, resetIanaTimezoneCacheForTests, resolveDefaultTimeFormat, resolveDefaultTimezone, resolveTimezoneForIntl, resolveTimezonePickerOptions, syncAppRequestHeaders, useAppContext, useAppDateFormat, useAppLocale, useAppTimeFormat, useAppTimezone, useOptionalAppContext, usePickerLocales, useTranslation, writeStoredPreferences } from '../chunk-QTEPKNQE.js';
|
|
3
|
+
import { formatDate } from '../chunk-C7W5BO7R.js';
|
|
4
|
+
export { APP_DATE_FORMATS, APP_DATE_FORMAT_OPTIONS, APP_LOCALE_CONFIG, APP_REQUEST_HEADER_DATE_FORMAT, APP_REQUEST_HEADER_TIME_FORMAT, APP_TIME_FORMATS, detectFormatDateKind, formatAppDate, formatAppDateLong, formatAppDateTime, formatAppRelative, formatAppTime, formatCalendarDate, formatDate, formatTimeOfDay, getDateFnsLocale, getDateFormatLabel, getDatePattern, getDateTimePattern, getDatetimeContext, getDayPickerLocale, getTimePattern, isAppDateFormat, isAppLocale, isAppTimeFormat, isFormatDateValue, isValidHhmm, normalizeHhmm, parseDateInput, resolveDefaultDateFormat, syncDatetimeContext } from '../chunk-C7W5BO7R.js';
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
function useFormatting() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { b as CheckboxGroupProp } from './data-entry.prop-
|
|
4
|
+
import { b as CheckboxGroupProp } from './data-entry.prop-CyiZuEI8.js';
|
|
5
5
|
|
|
6
6
|
declare function CheckboxGroup({ value: controlledValue, defaultValue, onValueChange, options, orientation, disabled, name, className, children, }: CheckboxGroupProp): react_jsx_runtime.JSX.Element;
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Input } from './chunk-
|
|
2
|
-
import { Button } from './chunk-
|
|
3
|
-
import { useTranslation } from './chunk-
|
|
1
|
+
import { Input } from './chunk-6AIYMYSG.js';
|
|
2
|
+
import { Button } from './chunk-5L77S5CL.js';
|
|
3
|
+
import { useTranslation } from './chunk-QTEPKNQE.js';
|
|
4
4
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ChevronUp, ChevronDown, EyeOff, Eye, Minus, Star, X } from 'lucide-react';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useTranslation } from './chunk-QTEPKNQE.js';
|
|
1
2
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -5,6 +6,15 @@ import { cva } from 'class-variance-authority';
|
|
|
5
6
|
import { Loader2 } from 'lucide-react';
|
|
6
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
8
|
|
|
9
|
+
var buttonCountClass = {
|
|
10
|
+
default: "bg-primary-foreground/15",
|
|
11
|
+
destructive: "bg-destructive-foreground/15",
|
|
12
|
+
secondary: "bg-secondary-foreground/15",
|
|
13
|
+
outline: "bg-foreground/8 text-muted-foreground",
|
|
14
|
+
dashed: "bg-foreground/8 text-muted-foreground",
|
|
15
|
+
ghost: "bg-foreground/8 text-muted-foreground",
|
|
16
|
+
link: "bg-foreground/8 text-muted-foreground"
|
|
17
|
+
};
|
|
8
18
|
var buttonVariants = cva("ui-button", {
|
|
9
19
|
variants: {
|
|
10
20
|
variant: {
|
|
@@ -46,16 +56,33 @@ var Button = React.forwardRef(
|
|
|
46
56
|
asChild = false,
|
|
47
57
|
loading = false,
|
|
48
58
|
loadingText,
|
|
59
|
+
count,
|
|
60
|
+
overflowCount = 99,
|
|
61
|
+
showZero = true,
|
|
49
62
|
disabled,
|
|
50
63
|
children,
|
|
51
64
|
...props
|
|
52
65
|
}, ref) => {
|
|
66
|
+
const { locale } = useTranslation();
|
|
53
67
|
const Comp = asChild ? Slot : "button";
|
|
54
68
|
const isLoading = !asChild && loading;
|
|
55
69
|
const content = isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
56
70
|
/* @__PURE__ */ jsx(Loader2, { className: "animate-spin", "aria-hidden": "true" }),
|
|
57
71
|
loadingText ?? children
|
|
58
72
|
] }) : children;
|
|
73
|
+
const showCount = !asChild && count != null && (count !== 0 || showZero);
|
|
74
|
+
const countLabel = showCount && count != null && count > overflowCount ? `${new Intl.NumberFormat(locale).format(overflowCount)}+` : count != null ? new Intl.NumberFormat(locale).format(count) : "";
|
|
75
|
+
const countNode = showCount ? /* @__PURE__ */ jsx(
|
|
76
|
+
"span",
|
|
77
|
+
{
|
|
78
|
+
"data-slot": "button-count",
|
|
79
|
+
className: cn(
|
|
80
|
+
"inline-flex min-w-4 items-center justify-center rounded-[var(--radius-pill)] px-1 text-xs leading-none tabular-nums",
|
|
81
|
+
buttonCountClass[variant ?? "default"]
|
|
82
|
+
),
|
|
83
|
+
children: countLabel
|
|
84
|
+
}
|
|
85
|
+
) : null;
|
|
59
86
|
return /* @__PURE__ */ jsx(
|
|
60
87
|
Comp,
|
|
61
88
|
{
|
|
@@ -77,7 +104,10 @@ var Button = React.forwardRef(
|
|
|
77
104
|
),
|
|
78
105
|
ref,
|
|
79
106
|
...props,
|
|
80
|
-
children:
|
|
107
|
+
children: asChild ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
108
|
+
content,
|
|
109
|
+
countNode
|
|
110
|
+
] })
|
|
81
111
|
}
|
|
82
112
|
);
|
|
83
113
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useTranslation } from './chunk-QTEPKNQE.js';
|
|
2
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { X } from 'lucide-react';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var inputBaseClass = [
|
|
8
|
+
"ui-control border-input bg-background w-full min-w-0 rounded-md border px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none",
|
|
9
|
+
"selection:bg-primary selection:text-primary-foreground",
|
|
10
|
+
"file:text-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium",
|
|
11
|
+
"placeholder:text-muted-foreground",
|
|
12
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
13
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
14
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20"
|
|
15
|
+
];
|
|
16
|
+
var Input = React.forwardRef(
|
|
17
|
+
({ className, type, allowClear = false, onClear, value, defaultValue, onChange, ...props }, ref) => {
|
|
18
|
+
const { t } = useTranslation();
|
|
19
|
+
const innerRef = React.useRef(null);
|
|
20
|
+
const setRefs = React.useCallback(
|
|
21
|
+
(node) => {
|
|
22
|
+
innerRef.current = node;
|
|
23
|
+
if (typeof ref === "function") ref(node);
|
|
24
|
+
else if (ref) ref.current = node;
|
|
25
|
+
},
|
|
26
|
+
[ref]
|
|
27
|
+
);
|
|
28
|
+
const [hasText, setHasText] = React.useState(
|
|
29
|
+
() => String(value ?? defaultValue ?? "").length > 0
|
|
30
|
+
);
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
if (value !== void 0) setHasText(String(value).length > 0);
|
|
33
|
+
}, [value]);
|
|
34
|
+
const handleChange = (event) => {
|
|
35
|
+
if (value === void 0) setHasText(event.target.value.length > 0);
|
|
36
|
+
onChange?.(event);
|
|
37
|
+
};
|
|
38
|
+
const clear = () => {
|
|
39
|
+
const el = innerRef.current;
|
|
40
|
+
if (el) {
|
|
41
|
+
const setter = Object.getOwnPropertyDescriptor(
|
|
42
|
+
window.HTMLInputElement.prototype,
|
|
43
|
+
"value"
|
|
44
|
+
)?.set;
|
|
45
|
+
setter?.call(el, "");
|
|
46
|
+
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
47
|
+
el.focus();
|
|
48
|
+
}
|
|
49
|
+
setHasText(false);
|
|
50
|
+
onClear?.();
|
|
51
|
+
};
|
|
52
|
+
if (!allowClear) {
|
|
53
|
+
return /* @__PURE__ */ jsx(
|
|
54
|
+
"input",
|
|
55
|
+
{
|
|
56
|
+
type,
|
|
57
|
+
"data-slot": "input",
|
|
58
|
+
ref: setRefs,
|
|
59
|
+
value,
|
|
60
|
+
defaultValue,
|
|
61
|
+
onChange,
|
|
62
|
+
className: cn(inputBaseClass, className),
|
|
63
|
+
...props
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
const showClear = hasText && !props.disabled && !props.readOnly;
|
|
68
|
+
return /* @__PURE__ */ jsxs("span", { "data-slot": "input-affix-wrapper", className: "relative inline-flex w-full items-center", children: [
|
|
69
|
+
/* @__PURE__ */ jsx(
|
|
70
|
+
"input",
|
|
71
|
+
{
|
|
72
|
+
type,
|
|
73
|
+
"data-slot": "input",
|
|
74
|
+
ref: setRefs,
|
|
75
|
+
value,
|
|
76
|
+
defaultValue,
|
|
77
|
+
onChange: handleChange,
|
|
78
|
+
className: cn(inputBaseClass, showClear && "pe-9", className),
|
|
79
|
+
...props
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
showClear ? /* @__PURE__ */ jsx(
|
|
83
|
+
"button",
|
|
84
|
+
{
|
|
85
|
+
type: "button",
|
|
86
|
+
tabIndex: -1,
|
|
87
|
+
"aria-label": t("common.clear") ?? "Clear",
|
|
88
|
+
onClick: clear,
|
|
89
|
+
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",
|
|
90
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" })
|
|
91
|
+
}
|
|
92
|
+
) : null
|
|
93
|
+
] });
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
Input.displayName = "Input";
|
|
97
|
+
|
|
98
|
+
export { Input };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { humanError } from './chunk-
|
|
1
|
+
import { humanError } from './chunk-2FJ5TMQU.js';
|
|
2
2
|
import { Flex } from './chunk-INIIF7F7.js';
|
|
3
|
-
import { Button } from './chunk-
|
|
4
|
-
import { useTranslation } from './chunk-
|
|
3
|
+
import { Button } from './chunk-5L77S5CL.js';
|
|
4
|
+
import { useTranslation } from './chunk-QTEPKNQE.js';
|
|
5
5
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { Info, CheckCircle2, TriangleAlert, AlertCircle, X, RefreshCw } from 'lucide-react';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { normalizeTreeOptions, formatPathLabels, getNodeByPath, filterTreeOptions, pathsEqual, pathKey } from './chunk-SMLKNECP.js';
|
|
2
2
|
import { Command, CommandInput } from './chunk-3R3QVJCB.js';
|
|
3
|
-
import { Button } from './chunk-CA247VOA.js';
|
|
4
3
|
import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
|
|
5
4
|
import { ScrollArea, ScrollBar } from './chunk-3KPEZ5CF.js';
|
|
5
|
+
import { Button } from './chunk-5L77S5CL.js';
|
|
6
6
|
import { controlOpenRingClass } from './chunk-B4K4BXEF.js';
|
|
7
|
-
import { useTranslation } from './chunk-
|
|
7
|
+
import { useTranslation } from './chunk-QTEPKNQE.js';
|
|
8
8
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import { Check, X, ChevronsUpDown, ChevronRight, Minus } from 'lucide-react';
|
|
@@ -62,6 +62,7 @@ var en_default = {
|
|
|
62
62
|
search: "Search",
|
|
63
63
|
clearSearch: "Clear search",
|
|
64
64
|
clearFilters: "Clear filters",
|
|
65
|
+
clear: "Clear",
|
|
65
66
|
first: "First",
|
|
66
67
|
previous: "Previous",
|
|
67
68
|
next: "Next",
|
|
@@ -333,6 +334,7 @@ var ja_default = {
|
|
|
333
334
|
search: "\u691C\u7D22",
|
|
334
335
|
clearSearch: "\u691C\u7D22\u3092\u30AF\u30EA\u30A2",
|
|
335
336
|
clearFilters: "\u30D5\u30A3\u30EB\u30BF\u30FC\u3092\u30AF\u30EA\u30A2",
|
|
337
|
+
clear: "\u30AF\u30EA\u30A2",
|
|
336
338
|
first: "\u6700\u521D",
|
|
337
339
|
previous: "\u524D\u3078",
|
|
338
340
|
next: "\u6B21\u3078",
|
|
@@ -604,6 +606,7 @@ var vi_default = {
|
|
|
604
606
|
search: "T\xECm ki\u1EBFm",
|
|
605
607
|
clearSearch: "X\xF3a t\xECm ki\u1EBFm",
|
|
606
608
|
clearFilters: "X\xF3a b\u1ED9 l\u1ECDc",
|
|
609
|
+
clear: "X\xF3a",
|
|
607
610
|
first: "\u0110\u1EA7u",
|
|
608
611
|
previous: "Tr\u01B0\u1EDBc",
|
|
609
612
|
next: "Ti\u1EBFp",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Input } from './chunk-
|
|
2
|
-
import { Button } from './chunk-CA247VOA.js';
|
|
1
|
+
import { Input } from './chunk-6AIYMYSG.js';
|
|
3
2
|
import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { Button } from './chunk-5L77S5CL.js';
|
|
4
|
+
import { useTranslation, usePickerLocales } from './chunk-QTEPKNQE.js';
|
|
5
|
+
import { normalizeHhmm, isValidHhmm } from './chunk-C7W5BO7R.js';
|
|
6
6
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
7
7
|
import * as React from 'react';
|
|
8
|
-
import { Clock } from 'lucide-react';
|
|
8
|
+
import { X, Clock } from 'lucide-react';
|
|
9
9
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
11
|
function pad2(n) {
|
|
@@ -208,7 +208,8 @@ function TimePicker({
|
|
|
208
208
|
className,
|
|
209
209
|
id,
|
|
210
210
|
name,
|
|
211
|
-
minuteStep = 5
|
|
211
|
+
minuteStep = 5,
|
|
212
|
+
allowClear = true
|
|
212
213
|
}) {
|
|
213
214
|
const { t } = useTranslation();
|
|
214
215
|
const { timeFormat } = usePickerLocales();
|
|
@@ -226,6 +227,11 @@ function TimePicker({
|
|
|
226
227
|
if (!isControlled) setInternal(next);
|
|
227
228
|
onValueChange?.(next);
|
|
228
229
|
};
|
|
230
|
+
const showClear = allowClear && Boolean(value) && !disabled;
|
|
231
|
+
const clear = () => {
|
|
232
|
+
setValue("");
|
|
233
|
+
setText("");
|
|
234
|
+
};
|
|
229
235
|
return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
230
236
|
/* @__PURE__ */ jsx(
|
|
231
237
|
Input,
|
|
@@ -240,7 +246,7 @@ function TimePicker({
|
|
|
240
246
|
role: "combobox",
|
|
241
247
|
"aria-expanded": open,
|
|
242
248
|
"aria-haspopup": "dialog",
|
|
243
|
-
className: "pe-
|
|
249
|
+
className: cn("tabular-nums", showClear ? "pe-16" : "pe-10"),
|
|
244
250
|
onClick: () => {
|
|
245
251
|
if (!disabled) setOpen(true);
|
|
246
252
|
},
|
|
@@ -263,6 +269,20 @@ function TimePicker({
|
|
|
263
269
|
}
|
|
264
270
|
}
|
|
265
271
|
),
|
|
272
|
+
showClear ? /* @__PURE__ */ jsx(
|
|
273
|
+
Button,
|
|
274
|
+
{
|
|
275
|
+
type: "button",
|
|
276
|
+
variant: "ghost",
|
|
277
|
+
size: "icon",
|
|
278
|
+
disabled,
|
|
279
|
+
tabIndex: -1,
|
|
280
|
+
"aria-label": t("common.clear") ?? "Clear",
|
|
281
|
+
className: "text-muted-foreground absolute inset-y-0 end-8 h-full px-2 hover:bg-transparent",
|
|
282
|
+
onClick: clear,
|
|
283
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4 shrink-0", "aria-hidden": "true" })
|
|
284
|
+
}
|
|
285
|
+
) : null,
|
|
266
286
|
/* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
267
287
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
268
288
|
Button,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Input } from './chunk-BNXPDUO4.js';
|
|
3
|
-
import { Button } from './chunk-CA247VOA.js';
|
|
1
|
+
import { Input } from './chunk-6AIYMYSG.js';
|
|
4
2
|
import { Popover, PopoverAnchor, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { Calendar } from './chunk-MUUO7SPN.js';
|
|
4
|
+
import { Button } from './chunk-5L77S5CL.js';
|
|
5
|
+
import { useTranslation, usePickerLocales } from './chunk-QTEPKNQE.js';
|
|
6
|
+
import { toIsoDate, parseDateInput } from './chunk-C7W5BO7R.js';
|
|
7
7
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
8
8
|
import * as React from 'react';
|
|
9
|
-
import { CalendarIcon } from 'lucide-react';
|
|
9
|
+
import { X, CalendarIcon } from 'lucide-react';
|
|
10
10
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
11
11
|
|
|
12
12
|
var ISO_HINT = "yyyy-mm-dd";
|
|
@@ -21,7 +21,8 @@ function DateRangePicker({
|
|
|
21
21
|
name,
|
|
22
22
|
locale: localeProp,
|
|
23
23
|
fromDate,
|
|
24
|
-
toDate
|
|
24
|
+
toDate,
|
|
25
|
+
allowClear = true
|
|
25
26
|
}) {
|
|
26
27
|
const { t } = useTranslation();
|
|
27
28
|
const { dayPickerLocale } = usePickerLocales(localeProp);
|
|
@@ -40,6 +41,12 @@ function DateRangePicker({
|
|
|
40
41
|
if (!isControlled) setInternalValue(next);
|
|
41
42
|
onValueChange?.(next);
|
|
42
43
|
};
|
|
44
|
+
const showClear = allowClear && Boolean(value?.from || value?.to) && !disabled;
|
|
45
|
+
const clear = () => {
|
|
46
|
+
emit(void 0);
|
|
47
|
+
setFromText("");
|
|
48
|
+
setToText("");
|
|
49
|
+
};
|
|
43
50
|
const commitEdge = (edge, raw) => {
|
|
44
51
|
const trimmed = raw.trim();
|
|
45
52
|
if (trimmed !== "" && !/^\d{4}-\d{2}-\d{2}$/.test(trimmed)) return;
|
|
@@ -114,6 +121,20 @@ function DateRangePicker({
|
|
|
114
121
|
}
|
|
115
122
|
}
|
|
116
123
|
),
|
|
124
|
+
showClear ? /* @__PURE__ */ jsx(
|
|
125
|
+
Button,
|
|
126
|
+
{
|
|
127
|
+
type: "button",
|
|
128
|
+
variant: "ghost",
|
|
129
|
+
size: "icon",
|
|
130
|
+
disabled,
|
|
131
|
+
tabIndex: -1,
|
|
132
|
+
"aria-label": t("common.clear") ?? "Clear",
|
|
133
|
+
className: "text-muted-foreground shrink-0 hover:bg-transparent",
|
|
134
|
+
onClick: clear,
|
|
135
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4 shrink-0", "aria-hidden": "true" })
|
|
136
|
+
}
|
|
137
|
+
) : null,
|
|
117
138
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
118
139
|
Button,
|
|
119
140
|
{
|