@bricks-toolkit/toolkit 0.1.20 → 0.1.21
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-62JXQJBD.cjs +533 -0
- package/dist/chunk-6LBTRQZD.mjs +806 -0
- package/dist/chunk-M6XPQ5BE.cjs +808 -0
- package/dist/chunk-UPSMZISM.mjs +567 -0
- package/dist/chunk-YV3WWKQY.cjs +569 -0
- package/dist/chunk-Z5FRCULF.mjs +531 -0
- package/dist/date-picker/index.cjs +2 -2
- package/dist/date-picker/index.mjs +1 -1
- package/dist/date-time-picker/index.cjs +2 -2
- package/dist/date-time-picker/index.mjs +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.mjs +3 -3
- package/dist/time-picker/index.cjs +2 -2
- package/dist/time-picker/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/Button.types-BsQYqZml.d.ts +0 -27
- package/dist/Button.types-D-srlWFf.d.mts +0 -27
- package/dist/TextInput.types-DRI8HQza.d.mts +0 -32
- package/dist/TextInput.types-DRI8HQza.d.ts +0 -32
- package/dist/Tooltip.types-PbUasE3C.d.mts +0 -36
- package/dist/Tooltip.types-PbUasE3C.d.ts +0 -36
- package/dist/avatar/index.d.mts +0 -29
- package/dist/avatar/index.d.ts +0 -29
- package/dist/badge/index.d.mts +0 -57
- package/dist/badge/index.d.ts +0 -57
- package/dist/breadcrumbs/index.d.mts +0 -32
- package/dist/breadcrumbs/index.d.ts +0 -32
- package/dist/button/index.d.mts +0 -8
- package/dist/button/index.d.ts +0 -8
- package/dist/card/index.d.mts +0 -42
- package/dist/card/index.d.ts +0 -42
- package/dist/checkbox/index.d.mts +0 -36
- package/dist/checkbox/index.d.ts +0 -36
- package/dist/chunk-E6KUCC56.mjs +0 -804
- package/dist/chunk-FK5HAWIU.cjs +0 -531
- package/dist/chunk-HG4BPC2T.cjs +0 -806
- package/dist/chunk-LKNQH36V.mjs +0 -529
- package/dist/chunk-M5V2IWA6.mjs +0 -565
- package/dist/chunk-WVRXSANT.cjs +0 -567
- package/dist/combo-box/index.d.mts +0 -62
- package/dist/combo-box/index.d.ts +0 -62
- package/dist/date-picker/index.d.mts +0 -52
- package/dist/date-picker/index.d.ts +0 -52
- package/dist/date-time-picker/index.d.mts +0 -52
- package/dist/date-time-picker/index.d.ts +0 -52
- package/dist/dialog/index.d.mts +0 -61
- package/dist/dialog/index.d.ts +0 -61
- package/dist/dropdown-menu/index.d.mts +0 -34
- package/dist/dropdown-menu/index.d.ts +0 -34
- package/dist/email/index.d.mts +0 -38
- package/dist/email/index.d.ts +0 -38
- package/dist/file-upload/index.d.mts +0 -27
- package/dist/file-upload/index.d.ts +0 -27
- package/dist/header/index.d.mts +0 -28
- package/dist/header/index.d.ts +0 -28
- package/dist/icon-button/index.d.mts +0 -16
- package/dist/icon-button/index.d.ts +0 -16
- package/dist/image/index.d.mts +0 -48
- package/dist/image/index.d.ts +0 -48
- package/dist/index.d.mts +0 -142
- package/dist/index.d.ts +0 -142
- package/dist/link/index.d.mts +0 -25
- package/dist/link/index.d.ts +0 -25
- package/dist/loader/index.d.mts +0 -21
- package/dist/loader/index.d.ts +0 -21
- package/dist/modal/index.d.mts +0 -116
- package/dist/modal/index.d.ts +0 -116
- package/dist/multi-select/index.d.mts +0 -59
- package/dist/multi-select/index.d.ts +0 -59
- package/dist/otp-input/index.d.mts +0 -57
- package/dist/otp-input/index.d.ts +0 -57
- package/dist/password-input/index.d.mts +0 -32
- package/dist/password-input/index.d.ts +0 -32
- package/dist/phone/index.d.mts +0 -41
- package/dist/phone/index.d.ts +0 -41
- package/dist/radio-button/index.d.mts +0 -56
- package/dist/radio-button/index.d.ts +0 -56
- package/dist/search-input/index.d.mts +0 -22
- package/dist/search-input/index.d.ts +0 -22
- package/dist/select/index.d.mts +0 -36
- package/dist/select/index.d.ts +0 -36
- package/dist/sidebar/index.d.mts +0 -96
- package/dist/sidebar/index.d.ts +0 -96
- package/dist/skeleton/index.d.mts +0 -76
- package/dist/skeleton/index.d.ts +0 -76
- package/dist/styles.d.mts +0 -2
- package/dist/styles.d.ts +0 -2
- package/dist/table/index.d.mts +0 -92
- package/dist/table/index.d.ts +0 -92
- package/dist/tabs/index.d.mts +0 -26
- package/dist/tabs/index.d.ts +0 -26
- package/dist/text-input/index.d.mts +0 -7
- package/dist/text-input/index.d.ts +0 -7
- package/dist/theme-provider/index.d.mts +0 -122
- package/dist/theme-provider/index.d.ts +0 -122
- package/dist/theme.css +0 -62
- package/dist/time-picker/index.d.mts +0 -51
- package/dist/time-picker/index.d.ts +0 -51
- package/dist/toaster/index.d.mts +0 -28
- package/dist/toaster/index.d.ts +0 -28
- package/dist/tooltip/index.d.mts +0 -7
- package/dist/tooltip/index.d.ts +0 -7
package/dist/chunk-WVRXSANT.cjs
DELETED
|
@@ -1,567 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkJ53N2LAE_cjs = require('./chunk-J53N2LAE.cjs');
|
|
4
|
-
var chunkL5VQZZVR_cjs = require('./chunk-L5VQZZVR.cjs');
|
|
5
|
-
var react = require('react');
|
|
6
|
-
var outline = require('@heroicons/react/24/outline');
|
|
7
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
-
|
|
9
|
-
var sizeClasses = {
|
|
10
|
-
xs: "h-6 px-2 text-xs",
|
|
11
|
-
sm: "h-8 px-3 text-sm",
|
|
12
|
-
md: "h-10 px-3 text-sm",
|
|
13
|
-
lg: "h-11 px-4 text-base",
|
|
14
|
-
xl: "h-12 px-4 text-lg"
|
|
15
|
-
};
|
|
16
|
-
var labelSizeClasses = {
|
|
17
|
-
xs: "text-xs",
|
|
18
|
-
sm: "text-xs",
|
|
19
|
-
md: "text-sm",
|
|
20
|
-
lg: "text-sm",
|
|
21
|
-
xl: "text-base"
|
|
22
|
-
};
|
|
23
|
-
var variantClasses = {
|
|
24
|
-
default: "rounded-md border border-border bg-surface shadow-sm focus-within:outline-none focus-within:ring-2 focus-within:ring-primary/40 transition-all duration-200",
|
|
25
|
-
filled: "rounded-md border border-transparent bg-surface-secondary focus-within:bg-surface focus-within:ring-2 focus-within:ring-primary/40 transition-all duration-200",
|
|
26
|
-
flushed: "rounded-none border-0 border-b border-border bg-transparent",
|
|
27
|
-
unstyled: "border-0 bg-transparent p-0"
|
|
28
|
-
};
|
|
29
|
-
var stateVariantClasses = {
|
|
30
|
-
default: {
|
|
31
|
-
default: "border-border focus-within:border-primary",
|
|
32
|
-
filled: "focus-within:border-primary",
|
|
33
|
-
flushed: "border-border focus-within:border-primary",
|
|
34
|
-
unstyled: ""
|
|
35
|
-
},
|
|
36
|
-
error: {
|
|
37
|
-
default: "border-error focus-within:border-error focus-within:ring-error/20",
|
|
38
|
-
filled: "bg-error/5 focus-within:border-error focus-within:ring-error/20",
|
|
39
|
-
flushed: "border-error",
|
|
40
|
-
unstyled: ""
|
|
41
|
-
},
|
|
42
|
-
success: {
|
|
43
|
-
default: "border-success focus-within:border-success focus-within:ring-success/20",
|
|
44
|
-
filled: "bg-success/5 focus-within:border-success focus-within:ring-success/20",
|
|
45
|
-
flushed: "border-success",
|
|
46
|
-
unstyled: ""
|
|
47
|
-
},
|
|
48
|
-
warning: {
|
|
49
|
-
default: "border-warning focus-within:border-warning focus-within:ring-warning/20",
|
|
50
|
-
filled: "bg-warning/5 focus-within:border-warning focus-within:ring-warning/20",
|
|
51
|
-
flushed: "border-warning",
|
|
52
|
-
unstyled: ""
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
var stateMessageClasses = {
|
|
56
|
-
default: "text-text-muted",
|
|
57
|
-
error: "text-error font-medium",
|
|
58
|
-
success: "text-success font-medium",
|
|
59
|
-
warning: "text-warning font-medium"
|
|
60
|
-
};
|
|
61
|
-
function AddonIcon({ children, side, size, onClick, asButton = false, ariaLabel }) {
|
|
62
|
-
const iconSize = {
|
|
63
|
-
xs: "w-3.5 h-3.5",
|
|
64
|
-
sm: "w-4 h-4",
|
|
65
|
-
md: "w-4 h-4",
|
|
66
|
-
lg: "w-5 h-5",
|
|
67
|
-
xl: "w-5 h-5"
|
|
68
|
-
};
|
|
69
|
-
const base = chunkL5VQZZVR_cjs.cn(
|
|
70
|
-
"absolute top-1/2 -translate-y-1/2 text-text-secondary flex items-center justify-center",
|
|
71
|
-
side === "left" ? "left-3" : "right-3",
|
|
72
|
-
iconSize[size]
|
|
73
|
-
);
|
|
74
|
-
if (asButton && onClick) {
|
|
75
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
76
|
-
"button",
|
|
77
|
-
{
|
|
78
|
-
type: "button",
|
|
79
|
-
onClick,
|
|
80
|
-
className: chunkL5VQZZVR_cjs.cn(base, "cursor-pointer hover:text-text transition-colors"),
|
|
81
|
-
tabIndex: -1,
|
|
82
|
-
"aria-label": ariaLabel,
|
|
83
|
-
children
|
|
84
|
-
}
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: chunkL5VQZZVR_cjs.cn(base, "pointer-events-none"), "aria-label": ariaLabel, children });
|
|
88
|
-
}
|
|
89
|
-
function Addon({ children, side }) {
|
|
90
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
-
"span",
|
|
92
|
-
{
|
|
93
|
-
"aria-hidden": "true",
|
|
94
|
-
className: chunkL5VQZZVR_cjs.cn(
|
|
95
|
-
"inline-flex items-center border border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none",
|
|
96
|
-
side === "left" ? "rounded-l-md border-r-0" : "rounded-r-md border-l-0"
|
|
97
|
-
),
|
|
98
|
-
children
|
|
99
|
-
}
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
function DatePicker({
|
|
103
|
-
label,
|
|
104
|
-
required = false,
|
|
105
|
-
helperText,
|
|
106
|
-
errorMessage,
|
|
107
|
-
successMessage,
|
|
108
|
-
warningMessage,
|
|
109
|
-
variant = "default",
|
|
110
|
-
size = "md",
|
|
111
|
-
state = "default",
|
|
112
|
-
fullWidth = true,
|
|
113
|
-
leftElement,
|
|
114
|
-
rightElement,
|
|
115
|
-
prefix,
|
|
116
|
-
suffix,
|
|
117
|
-
wrapperClassName,
|
|
118
|
-
inputGroupClassName,
|
|
119
|
-
inputClassName,
|
|
120
|
-
labelClassName,
|
|
121
|
-
helperClassName,
|
|
122
|
-
id: idProp,
|
|
123
|
-
disabled,
|
|
124
|
-
className,
|
|
125
|
-
clearable,
|
|
126
|
-
isLoading,
|
|
127
|
-
value,
|
|
128
|
-
defaultValue,
|
|
129
|
-
onChange,
|
|
130
|
-
onDateChange,
|
|
131
|
-
placeholder = "Select date",
|
|
132
|
-
minDate,
|
|
133
|
-
maxDate,
|
|
134
|
-
disabledDates,
|
|
135
|
-
locale = "en-US",
|
|
136
|
-
name,
|
|
137
|
-
"aria-label": ariaLabel,
|
|
138
|
-
"aria-describedby": ariaDescribedby
|
|
139
|
-
}) {
|
|
140
|
-
const generatedId = react.useId();
|
|
141
|
-
const inputId = idProp ?? generatedId;
|
|
142
|
-
const helperId = `${inputId}-helper`;
|
|
143
|
-
const stateMessageId = `${inputId}-state`;
|
|
144
|
-
const popoverId = `${inputId}-popover`;
|
|
145
|
-
const isControlled = value !== void 0;
|
|
146
|
-
const [internalValue, setInternalValue] = react.useState(defaultValue ?? "");
|
|
147
|
-
const displayValue = isControlled ? value : internalValue;
|
|
148
|
-
const selectedDate = chunkJ53N2LAE_cjs.parseISODate(displayValue);
|
|
149
|
-
const today = react.useMemo(() => /* @__PURE__ */ new Date(), []);
|
|
150
|
-
const [isOpen, setIsOpen] = react.useState(false);
|
|
151
|
-
const [viewYear, setViewYear] = react.useState(selectedDate?.getFullYear() ?? today.getFullYear());
|
|
152
|
-
const [viewMonth, setViewMonth] = react.useState(selectedDate?.getMonth() ?? today.getMonth());
|
|
153
|
-
const [viewMode, setViewMode] = react.useState("day");
|
|
154
|
-
const wrapperRef = react.useRef(null);
|
|
155
|
-
const popoverRef = react.useRef(null);
|
|
156
|
-
const [prevDisplay, setPrevDisplay] = react.useState(displayValue);
|
|
157
|
-
if (displayValue !== prevDisplay) {
|
|
158
|
-
setPrevDisplay(displayValue);
|
|
159
|
-
if (selectedDate) {
|
|
160
|
-
setViewYear(selectedDate.getFullYear());
|
|
161
|
-
setViewMonth(selectedDate.getMonth());
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
react.useEffect(() => {
|
|
165
|
-
if (!isOpen) return;
|
|
166
|
-
function handleClick(e) {
|
|
167
|
-
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
168
|
-
setIsOpen(false);
|
|
169
|
-
setViewMode("day");
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
document.addEventListener("mousedown", handleClick);
|
|
173
|
-
return () => {
|
|
174
|
-
document.removeEventListener("mousedown", handleClick);
|
|
175
|
-
};
|
|
176
|
-
}, [isOpen]);
|
|
177
|
-
const handleSelect = (date) => {
|
|
178
|
-
if (chunkJ53N2LAE_cjs.isDisabledDate(date, minDate, maxDate, disabledDates)) return;
|
|
179
|
-
const iso = chunkJ53N2LAE_cjs.toISODateString(date);
|
|
180
|
-
if (!isControlled) setInternalValue(iso);
|
|
181
|
-
onChange?.(iso);
|
|
182
|
-
onDateChange?.(date);
|
|
183
|
-
setIsOpen(false);
|
|
184
|
-
setViewMode("day");
|
|
185
|
-
};
|
|
186
|
-
const handleClear = () => {
|
|
187
|
-
if (!isControlled) setInternalValue("");
|
|
188
|
-
onChange?.("");
|
|
189
|
-
onDateChange?.(null);
|
|
190
|
-
};
|
|
191
|
-
const toggleOpen = () => {
|
|
192
|
-
if (disabled || isLoading) return;
|
|
193
|
-
setIsOpen((prev) => !prev);
|
|
194
|
-
setViewMode("day");
|
|
195
|
-
if (!isOpen && selectedDate) {
|
|
196
|
-
setViewYear(selectedDate.getFullYear());
|
|
197
|
-
setViewMonth(selectedDate.getMonth());
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
const prevMonth = () => {
|
|
201
|
-
if (viewMonth === 0) {
|
|
202
|
-
setViewMonth(11);
|
|
203
|
-
setViewYear((y) => y - 1);
|
|
204
|
-
} else setViewMonth((m) => m - 1);
|
|
205
|
-
};
|
|
206
|
-
const nextMonth = () => {
|
|
207
|
-
if (viewMonth === 11) {
|
|
208
|
-
setViewMonth(0);
|
|
209
|
-
setViewYear((y) => y + 1);
|
|
210
|
-
} else setViewMonth((m) => m + 1);
|
|
211
|
-
};
|
|
212
|
-
const showClear = clearable && displayValue.length > 0 && !disabled && !isLoading;
|
|
213
|
-
const hasLeftElement = leftElement !== void 0;
|
|
214
|
-
const hasRightElement = rightElement !== void 0 || Boolean(showClear) || Boolean(isLoading);
|
|
215
|
-
const stateMessage = state === "error" ? errorMessage : state === "success" ? successMessage : state === "warning" ? warningMessage : void 0;
|
|
216
|
-
const describedBy = [helperText ? helperId : null, stateMessage ? stateMessageId : null, ariaDescribedby ?? null].filter(Boolean).join(" ") || void 0;
|
|
217
|
-
const calendarGrid = chunkJ53N2LAE_cjs.buildCalendarGrid(viewYear, viewMonth);
|
|
218
|
-
const yearRange = chunkJ53N2LAE_cjs.getYearRange(viewYear);
|
|
219
|
-
const leftPad = {
|
|
220
|
-
xs: "pl-6",
|
|
221
|
-
sm: "pl-8",
|
|
222
|
-
md: "pl-9",
|
|
223
|
-
lg: "pl-10",
|
|
224
|
-
xl: "pl-11"
|
|
225
|
-
};
|
|
226
|
-
const rightPad = {
|
|
227
|
-
xs: "pr-6",
|
|
228
|
-
sm: "pr-8",
|
|
229
|
-
md: "pr-9",
|
|
230
|
-
lg: "pr-10",
|
|
231
|
-
xl: "pr-11"
|
|
232
|
-
};
|
|
233
|
-
const paddingClasses = chunkL5VQZZVR_cjs.cn(
|
|
234
|
-
hasLeftElement && leftPad[size],
|
|
235
|
-
(hasRightElement || showClear) && rightPad[size]
|
|
236
|
-
);
|
|
237
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
238
|
-
"div",
|
|
239
|
-
{
|
|
240
|
-
ref: wrapperRef,
|
|
241
|
-
className: chunkL5VQZZVR_cjs.cn(
|
|
242
|
-
"flex flex-col gap-1 relative",
|
|
243
|
-
fullWidth ? "w-full" : "w-fit",
|
|
244
|
-
wrapperClassName,
|
|
245
|
-
className
|
|
246
|
-
),
|
|
247
|
-
children: [
|
|
248
|
-
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
249
|
-
"label",
|
|
250
|
-
{
|
|
251
|
-
htmlFor: inputId,
|
|
252
|
-
className: chunkL5VQZZVR_cjs.cn(
|
|
253
|
-
"font-black leading-none text-text uppercase tracking-widest",
|
|
254
|
-
labelSizeClasses[size],
|
|
255
|
-
labelClassName
|
|
256
|
-
),
|
|
257
|
-
children: [
|
|
258
|
-
label,
|
|
259
|
-
required && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "ml-1 text-error", children: "*" })
|
|
260
|
-
]
|
|
261
|
-
}
|
|
262
|
-
),
|
|
263
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
264
|
-
"div",
|
|
265
|
-
{
|
|
266
|
-
className: chunkL5VQZZVR_cjs.cn("flex items-stretch", fullWidth ? "w-full" : "w-fit", inputGroupClassName),
|
|
267
|
-
children: [
|
|
268
|
-
prefix !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(Addon, { side: "left", children: prefix }),
|
|
269
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-1 items-center", children: [
|
|
270
|
-
/* @__PURE__ */ jsxRuntime.jsx(AddonIcon, { side: "left", size, children: leftElement ?? /* @__PURE__ */ jsxRuntime.jsx(outline.CalendarIcon, { className: "w-full h-full" }) }),
|
|
271
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
272
|
-
"button",
|
|
273
|
-
{
|
|
274
|
-
id: inputId,
|
|
275
|
-
type: "button",
|
|
276
|
-
role: "combobox",
|
|
277
|
-
"aria-expanded": isOpen,
|
|
278
|
-
"aria-haspopup": "dialog",
|
|
279
|
-
"aria-controls": popoverId,
|
|
280
|
-
"aria-label": ariaLabel ?? label ?? "Date picker",
|
|
281
|
-
"aria-describedby": describedBy,
|
|
282
|
-
"aria-required": required,
|
|
283
|
-
"aria-invalid": state === "error" ? true : void 0,
|
|
284
|
-
disabled: Boolean(disabled) || Boolean(isLoading),
|
|
285
|
-
onClick: toggleOpen,
|
|
286
|
-
name,
|
|
287
|
-
className: chunkL5VQZZVR_cjs.cn(
|
|
288
|
-
"w-full flex items-center text-left transition-colors duration-150 cursor-pointer",
|
|
289
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
290
|
-
sizeClasses[size],
|
|
291
|
-
variantClasses[variant],
|
|
292
|
-
stateVariantClasses[state][variant],
|
|
293
|
-
"pl-9",
|
|
294
|
-
hasRightElement || showClear ? rightPad[size] : "",
|
|
295
|
-
paddingClasses,
|
|
296
|
-
inputClassName,
|
|
297
|
-
prefix !== void 0 && suffix !== void 0 ? "rounded-none" : prefix !== void 0 ? "rounded-l-none" : suffix !== void 0 ? "rounded-r-none" : ""
|
|
298
|
-
),
|
|
299
|
-
children: displayValue && selectedDate ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text truncate", children: chunkJ53N2LAE_cjs.formatDate(selectedDate, locale) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-muted", children: placeholder })
|
|
300
|
-
}
|
|
301
|
-
),
|
|
302
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(AddonIcon, { side: "right", size, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
303
|
-
"svg",
|
|
304
|
-
{
|
|
305
|
-
className: "animate-spin h-full w-full text-text-muted",
|
|
306
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
307
|
-
fill: "none",
|
|
308
|
-
viewBox: "0 0 24 24",
|
|
309
|
-
children: [
|
|
310
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
311
|
-
"circle",
|
|
312
|
-
{
|
|
313
|
-
className: "opacity-25",
|
|
314
|
-
cx: "12",
|
|
315
|
-
cy: "12",
|
|
316
|
-
r: "10",
|
|
317
|
-
stroke: "currentColor",
|
|
318
|
-
strokeWidth: "4"
|
|
319
|
-
}
|
|
320
|
-
),
|
|
321
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
322
|
-
"path",
|
|
323
|
-
{
|
|
324
|
-
className: "opacity-75",
|
|
325
|
-
fill: "currentColor",
|
|
326
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
327
|
-
}
|
|
328
|
-
)
|
|
329
|
-
]
|
|
330
|
-
}
|
|
331
|
-
) }) : showClear ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
332
|
-
AddonIcon,
|
|
333
|
-
{
|
|
334
|
-
side: "right",
|
|
335
|
-
size,
|
|
336
|
-
asButton: true,
|
|
337
|
-
onClick: handleClear,
|
|
338
|
-
ariaLabel: "Clear date",
|
|
339
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(outline.XMarkIcon, { className: "w-full h-full", strokeWidth: 2.5 })
|
|
340
|
-
}
|
|
341
|
-
) : rightElement ? /* @__PURE__ */ jsxRuntime.jsx(AddonIcon, { side: "right", size, children: rightElement }) : null
|
|
342
|
-
] }),
|
|
343
|
-
suffix !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(Addon, { side: "right", children: suffix })
|
|
344
|
-
]
|
|
345
|
-
}
|
|
346
|
-
),
|
|
347
|
-
helperText !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
348
|
-
"p",
|
|
349
|
-
{
|
|
350
|
-
id: helperId,
|
|
351
|
-
className: chunkL5VQZZVR_cjs.cn("text-xs leading-tight text-text-muted font-medium", helperClassName),
|
|
352
|
-
children: helperText
|
|
353
|
-
}
|
|
354
|
-
),
|
|
355
|
-
stateMessage !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
356
|
-
"p",
|
|
357
|
-
{
|
|
358
|
-
id: stateMessageId,
|
|
359
|
-
role: state === "error" ? "alert" : void 0,
|
|
360
|
-
className: chunkL5VQZZVR_cjs.cn(
|
|
361
|
-
"text-xs leading-tight mt-0.5 font-medium",
|
|
362
|
-
stateMessageClasses[state],
|
|
363
|
-
helperClassName
|
|
364
|
-
),
|
|
365
|
-
children: stateMessage
|
|
366
|
-
}
|
|
367
|
-
),
|
|
368
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
369
|
-
"div",
|
|
370
|
-
{
|
|
371
|
-
id: popoverId,
|
|
372
|
-
ref: popoverRef,
|
|
373
|
-
role: "dialog",
|
|
374
|
-
"aria-label": "Date picker calendar",
|
|
375
|
-
"aria-modal": "true",
|
|
376
|
-
className: chunkL5VQZZVR_cjs.cn(
|
|
377
|
-
"absolute top-full left-0 z-50 mt-1 w-72",
|
|
378
|
-
"bg-surface border border-border rounded-xl shadow-xl",
|
|
379
|
-
"transition-all duration-200 origin-top",
|
|
380
|
-
isOpen ? "opacity-100 scale-100 pointer-events-auto" : "opacity-0 scale-95 pointer-events-none"
|
|
381
|
-
),
|
|
382
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3", children: [
|
|
383
|
-
viewMode === "day" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
384
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-3", children: [
|
|
385
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
386
|
-
"button",
|
|
387
|
-
{
|
|
388
|
-
type: "button",
|
|
389
|
-
onClick: prevMonth,
|
|
390
|
-
className: "p-1.5 rounded-lg hover:bg-hover text-text-secondary hover:text-text transition-colors",
|
|
391
|
-
"aria-label": "Previous month",
|
|
392
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronLeftIcon, { className: "w-4 h-4" })
|
|
393
|
-
}
|
|
394
|
-
),
|
|
395
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
396
|
-
"button",
|
|
397
|
-
{
|
|
398
|
-
type: "button",
|
|
399
|
-
onClick: () => {
|
|
400
|
-
setViewMode("month");
|
|
401
|
-
},
|
|
402
|
-
className: "text-sm font-bold text-text hover:text-primary transition-colors px-2 py-1 rounded-lg hover:bg-hover",
|
|
403
|
-
children: [
|
|
404
|
-
chunkJ53N2LAE_cjs.MONTH_NAMES[viewMonth],
|
|
405
|
-
" ",
|
|
406
|
-
viewYear
|
|
407
|
-
]
|
|
408
|
-
}
|
|
409
|
-
),
|
|
410
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
411
|
-
"button",
|
|
412
|
-
{
|
|
413
|
-
type: "button",
|
|
414
|
-
onClick: nextMonth,
|
|
415
|
-
className: "p-1.5 rounded-lg hover:bg-hover text-text-secondary hover:text-text transition-colors",
|
|
416
|
-
"aria-label": "Next month",
|
|
417
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronRightIcon, { className: "w-4 h-4" })
|
|
418
|
-
}
|
|
419
|
-
)
|
|
420
|
-
] }),
|
|
421
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 mb-1", children: chunkJ53N2LAE_cjs.DAY_NAMES_SHORT.map((d) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-xs font-semibold text-text-muted py-1", children: d }, d)) }),
|
|
422
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 gap-y-0.5", children: calendarGrid.flat().map((date, idx) => {
|
|
423
|
-
if (!date) return /* @__PURE__ */ jsxRuntime.jsx("div", {}, idx);
|
|
424
|
-
const isSelected = selectedDate ? chunkJ53N2LAE_cjs.isSameDay(date, selectedDate) : false;
|
|
425
|
-
const isToday = chunkJ53N2LAE_cjs.isSameDay(date, today);
|
|
426
|
-
const isDisabled = chunkJ53N2LAE_cjs.isDisabledDate(date, minDate, maxDate, disabledDates);
|
|
427
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
428
|
-
"button",
|
|
429
|
-
{
|
|
430
|
-
type: "button",
|
|
431
|
-
onClick: () => {
|
|
432
|
-
handleSelect(date);
|
|
433
|
-
},
|
|
434
|
-
disabled: isDisabled,
|
|
435
|
-
"aria-label": date.toDateString(),
|
|
436
|
-
"aria-pressed": isSelected,
|
|
437
|
-
className: chunkL5VQZZVR_cjs.cn(
|
|
438
|
-
"mx-auto flex h-8 w-8 items-center justify-center rounded-full text-sm transition-colors duration-150 font-medium",
|
|
439
|
-
isSelected ? "bg-primary text-white font-bold shadow-sm" : isToday ? "ring-2 ring-primary text-primary" : "text-text hover:bg-hover",
|
|
440
|
-
isDisabled && "opacity-30 cursor-not-allowed"
|
|
441
|
-
),
|
|
442
|
-
children: date.getDate()
|
|
443
|
-
},
|
|
444
|
-
idx
|
|
445
|
-
);
|
|
446
|
-
}) })
|
|
447
|
-
] }),
|
|
448
|
-
viewMode === "month" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
449
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-3", children: [
|
|
450
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
451
|
-
"button",
|
|
452
|
-
{
|
|
453
|
-
type: "button",
|
|
454
|
-
onClick: () => {
|
|
455
|
-
setViewYear((y) => y - 1);
|
|
456
|
-
},
|
|
457
|
-
className: "p-1.5 rounded-lg hover:bg-hover text-text-secondary hover:text-text transition-colors",
|
|
458
|
-
"aria-label": "Previous year",
|
|
459
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronLeftIcon, { className: "w-4 h-4" })
|
|
460
|
-
}
|
|
461
|
-
),
|
|
462
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
463
|
-
"button",
|
|
464
|
-
{
|
|
465
|
-
type: "button",
|
|
466
|
-
onClick: () => {
|
|
467
|
-
setViewMode("year");
|
|
468
|
-
},
|
|
469
|
-
className: "text-sm font-bold text-text hover:text-primary transition-colors px-2 py-1 rounded-lg hover:bg-hover",
|
|
470
|
-
children: viewYear
|
|
471
|
-
}
|
|
472
|
-
),
|
|
473
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
474
|
-
"button",
|
|
475
|
-
{
|
|
476
|
-
type: "button",
|
|
477
|
-
onClick: () => {
|
|
478
|
-
setViewYear((y) => y + 1);
|
|
479
|
-
},
|
|
480
|
-
className: "p-1.5 rounded-lg hover:bg-hover text-text-secondary hover:text-text transition-colors",
|
|
481
|
-
"aria-label": "Next year",
|
|
482
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronRightIcon, { className: "w-4 h-4" })
|
|
483
|
-
}
|
|
484
|
-
)
|
|
485
|
-
] }),
|
|
486
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-3 gap-1", children: chunkJ53N2LAE_cjs.MONTH_NAMES_SHORT.map((m, i) => {
|
|
487
|
-
const isActive = i === viewMonth && viewYear === (selectedDate?.getFullYear() ?? -1);
|
|
488
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
489
|
-
"button",
|
|
490
|
-
{
|
|
491
|
-
type: "button",
|
|
492
|
-
onClick: () => {
|
|
493
|
-
setViewMonth(i);
|
|
494
|
-
setViewMode("day");
|
|
495
|
-
},
|
|
496
|
-
className: chunkL5VQZZVR_cjs.cn(
|
|
497
|
-
"py-2 rounded-lg text-sm font-medium transition-colors",
|
|
498
|
-
isActive ? "bg-primary text-white" : "text-text hover:bg-hover"
|
|
499
|
-
),
|
|
500
|
-
children: m
|
|
501
|
-
},
|
|
502
|
-
m
|
|
503
|
-
);
|
|
504
|
-
}) })
|
|
505
|
-
] }),
|
|
506
|
-
viewMode === "year" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
507
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-3", children: [
|
|
508
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
509
|
-
"button",
|
|
510
|
-
{
|
|
511
|
-
type: "button",
|
|
512
|
-
onClick: () => {
|
|
513
|
-
setViewYear((y) => y - 12);
|
|
514
|
-
},
|
|
515
|
-
className: "p-1.5 rounded-lg hover:bg-hover text-text-secondary hover:text-text transition-colors",
|
|
516
|
-
"aria-label": "Previous decade",
|
|
517
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronLeftIcon, { className: "w-4 h-4" })
|
|
518
|
-
}
|
|
519
|
-
),
|
|
520
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-bold text-text", children: [
|
|
521
|
-
yearRange[0],
|
|
522
|
-
" \u2013 ",
|
|
523
|
-
yearRange[yearRange.length - 1]
|
|
524
|
-
] }),
|
|
525
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
526
|
-
"button",
|
|
527
|
-
{
|
|
528
|
-
type: "button",
|
|
529
|
-
onClick: () => {
|
|
530
|
-
setViewYear((y) => y + 12);
|
|
531
|
-
},
|
|
532
|
-
className: "p-1.5 rounded-lg hover:bg-hover text-text-secondary hover:text-text transition-colors",
|
|
533
|
-
"aria-label": "Next decade",
|
|
534
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronRightIcon, { className: "w-4 h-4" })
|
|
535
|
-
}
|
|
536
|
-
)
|
|
537
|
-
] }),
|
|
538
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-3 gap-1", children: yearRange.map((yr) => {
|
|
539
|
-
const isActive = yr === (selectedDate?.getFullYear() ?? -1);
|
|
540
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
541
|
-
"button",
|
|
542
|
-
{
|
|
543
|
-
type: "button",
|
|
544
|
-
onClick: () => {
|
|
545
|
-
setViewYear(yr);
|
|
546
|
-
setViewMode("month");
|
|
547
|
-
},
|
|
548
|
-
className: chunkL5VQZZVR_cjs.cn(
|
|
549
|
-
"py-2 rounded-lg text-sm font-medium transition-colors",
|
|
550
|
-
isActive ? "bg-primary text-white" : "text-text hover:bg-hover",
|
|
551
|
-
yr === today.getFullYear() && !isActive ? "ring-1 ring-primary text-primary" : ""
|
|
552
|
-
),
|
|
553
|
-
children: yr
|
|
554
|
-
},
|
|
555
|
-
yr
|
|
556
|
-
);
|
|
557
|
-
}) })
|
|
558
|
-
] })
|
|
559
|
-
] })
|
|
560
|
-
}
|
|
561
|
-
)
|
|
562
|
-
]
|
|
563
|
-
}
|
|
564
|
-
);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
exports.DatePicker = DatePicker;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
type ComboBoxSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
-
type ComboBoxState = 'default' | 'error' | 'success' | 'warning';
|
|
5
|
-
interface ComboBoxOption {
|
|
6
|
-
/** The underlying value submitted/returned. */
|
|
7
|
-
value: string;
|
|
8
|
-
/** The human-readable label shown in the dropdown and input. */
|
|
9
|
-
label: string;
|
|
10
|
-
/** When true the option is shown but cannot be selected. */
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
}
|
|
13
|
-
interface ComboBoxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'value' | 'onChange' | 'multiple'> {
|
|
14
|
-
/** List of selectable options. */
|
|
15
|
-
options: ComboBoxOption[];
|
|
16
|
-
/** Currently selected value(s). Pass string for single, string[] for multi. */
|
|
17
|
-
value?: string | string[];
|
|
18
|
-
/** Fired when selection changes. */
|
|
19
|
-
onChange?: (value: string | string[]) => void;
|
|
20
|
-
/** Allow selecting multiple options. Defaults to false. */
|
|
21
|
-
multiple?: boolean;
|
|
22
|
-
/** Allow the user to type and filter options. Defaults to true. */
|
|
23
|
-
searchable?: boolean;
|
|
24
|
-
/** Show a clear (×) button when a value is selected. Defaults to false. */
|
|
25
|
-
clearable?: boolean;
|
|
26
|
-
/** Field label rendered above the input. */
|
|
27
|
-
label?: string;
|
|
28
|
-
/** Makes the label show a required asterisk. */
|
|
29
|
-
required?: boolean;
|
|
30
|
-
/** Helper text shown below the field. */
|
|
31
|
-
helperText?: string;
|
|
32
|
-
/** Message shown when state = 'error'. */
|
|
33
|
-
errorMessage?: string;
|
|
34
|
-
/** Message shown when state = 'success'. */
|
|
35
|
-
successMessage?: string;
|
|
36
|
-
/** Message shown when state = 'warning'. */
|
|
37
|
-
warningMessage?: string;
|
|
38
|
-
/** Visual / validation state. Defaults to 'default'. */
|
|
39
|
-
state?: ComboBoxState;
|
|
40
|
-
/** Input size. Defaults to 'md'. */
|
|
41
|
-
size?: ComboBoxSize;
|
|
42
|
-
/** Stretch to fill its container. Defaults to true. */
|
|
43
|
-
fullWidth?: boolean;
|
|
44
|
-
/** Placeholder shown in the input when nothing is selected. */
|
|
45
|
-
placeholder?: string;
|
|
46
|
-
/** Rendered when no options match the current search query. */
|
|
47
|
-
noOptionsMessage?: ReactNode;
|
|
48
|
-
/** Additional class for the outer wrapper div. */
|
|
49
|
-
wrapperClassName?: string;
|
|
50
|
-
/** Additional class for the trigger / input element. */
|
|
51
|
-
inputClassName?: string;
|
|
52
|
-
/** Additional class for the dropdown list. */
|
|
53
|
-
listClassName?: string;
|
|
54
|
-
/** Additional class for the label element. */
|
|
55
|
-
labelClassName?: string;
|
|
56
|
-
/** Additional class for helper / state message text. */
|
|
57
|
-
helperClassName?: string;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
declare const ComboBox: React.ForwardRefExoticComponent<ComboBoxProps & React.RefAttributes<HTMLInputElement>>;
|
|
61
|
-
|
|
62
|
-
export { ComboBox, type ComboBoxOption, type ComboBoxProps, type ComboBoxSize, type ComboBoxState };
|