asheeui 0.6.8 → 0.6.10
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/autocomplete/Autocomplete.d.ts +34 -17
- package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/Autocomplete.js +86 -102
- package/dist/components/autocomplete/autocomplete-config.d.ts +4 -22
- package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete-config.js +8 -11
- package/dist/components/button/Button.d.ts +31 -5
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +68 -64
- package/dist/components/card/Card.d.ts +58 -54
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +152 -158
- package/dist/components/card/card-config.d.ts +66 -33
- package/dist/components/card/card-config.d.ts.map +1 -1
- package/dist/components/card/card-config.js +9 -9
- package/dist/components/date-picker/Calendar.d.ts +57 -0
- package/dist/components/date-picker/Calendar.d.ts.map +1 -0
- package/dist/components/date-picker/Calendar.js +224 -0
- package/dist/components/date-picker/DatePicker.d.ts +68 -155
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +194 -466
- package/dist/components/date-picker/TimeSpinner.d.ts +46 -0
- package/dist/components/date-picker/TimeSpinner.d.ts.map +1 -0
- package/dist/components/date-picker/TimeSpinner.js +84 -0
- package/dist/components/date-picker/date-picker-config.d.ts +24 -3
- package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-config.js +9 -12
- package/dist/components/date-picker/date-picker-styles.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-styles.js +4 -11
- package/dist/components/date-picker/date-picker.helpers.d.ts +111 -0
- package/dist/components/date-picker/date-picker.helpers.d.ts.map +1 -0
- package/dist/components/date-picker/date-picker.helpers.js +110 -0
- package/dist/components/date-picker/index.js +3 -0
- package/dist/components/input/Input.d.ts +13 -7
- package/dist/components/input/Input.d.ts.map +1 -1
- package/dist/components/input/Input.js +96 -91
- package/dist/components/keyboard/KeyboardContext.d.ts +130 -0
- package/dist/components/keyboard/KeyboardContext.d.ts.map +1 -0
- package/dist/components/keyboard/KeyboardContext.js +13 -0
- package/dist/components/keyboard/KeyboardProvider.d.ts +78 -0
- package/dist/components/keyboard/KeyboardProvider.d.ts.map +1 -0
- package/dist/components/keyboard/KeyboardProvider.js +183 -0
- package/dist/components/keyboard/OnScreenKeyboard.d.ts +65 -43
- package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
- package/dist/components/keyboard/OnScreenKeyboard.js +119 -113
- package/dist/components/keyboard/index.d.ts +2 -1
- package/dist/components/keyboard/index.d.ts.map +1 -1
- package/dist/components/keyboard/index.js +2 -1
- package/dist/components/keyboard/keyboard-config.d.ts +40 -36
- package/dist/components/keyboard/keyboard-config.d.ts.map +1 -1
- package/dist/components/keyboard/keyboard-config.js +15 -10
- package/dist/components/keyboard/use-keyboard-field.d.ts +6 -4
- package/dist/components/keyboard/use-keyboard-field.d.ts.map +1 -1
- package/dist/components/keyboard/use-keyboard-field.js +12 -12
- package/dist/components/multi-select/MultiSelect.d.ts +75 -40
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +188 -187
- package/dist/components/multi-select/multi-select-config.d.ts +4 -22
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/multi-select/multi-select-config.js +11 -14
- package/dist/components/radio/radio-config.d.ts +3 -2
- package/dist/components/radio/radio-config.d.ts.map +1 -1
- package/dist/components/radio/radio-config.js +9 -8
- package/dist/components/select/Select.d.ts +60 -45
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js +147 -159
- package/dist/components/select/select-config.d.ts +5 -33
- package/dist/components/select/select-config.d.ts.map +1 -1
- package/dist/components/select/select-config.js +6 -13
- package/dist/components/select/select-styles.js +1 -6
- package/dist/components/select-menu/SelectMenu.d.ts +45 -30
- package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +125 -124
- package/dist/components/select-menu/select-menu-config.d.ts +25 -2
- package/dist/components/select-menu/select-menu-config.d.ts.map +1 -1
- package/dist/components/select-menu/select-menu-config.js +4 -3
- package/dist/components/switch/Switch.d.ts +9 -33
- package/dist/components/switch/Switch.d.ts.map +1 -1
- package/dist/components/switch/Switch.js +68 -74
- package/dist/components/switch/switch-config.d.ts +3 -2
- package/dist/components/switch/switch-config.d.ts.map +1 -1
- package/dist/components/switch/switch-config.js +6 -5
- package/dist/components/switch/switch-styles.d.ts +1 -6
- package/dist/components/switch/switch-styles.d.ts.map +1 -1
- package/dist/components/switch/switch-styles.js +6 -12
- package/dist/components/textarea/Textarea.d.ts +19 -1
- package/dist/components/textarea/Textarea.d.ts.map +1 -1
- package/dist/components/textarea/Textarea.js +95 -90
- package/dist/components/toast/ToastContext.d.ts +122 -0
- package/dist/components/toast/ToastContext.d.ts.map +1 -0
- package/dist/components/toast/ToastContext.js +28 -0
- package/dist/components/toast/ToastProvider.d.ts +98 -0
- package/dist/components/toast/ToastProvider.d.ts.map +1 -0
- package/dist/components/toast/ToastProvider.js +192 -0
- package/dist/components/toast/index.d.ts +2 -1
- package/dist/components/toast/index.d.ts.map +1 -1
- package/dist/components/toast/index.js +2 -1
- package/dist/components/toast/toast-config.d.ts +36 -0
- package/dist/components/toast/toast-config.d.ts.map +1 -1
- package/dist/components/toast/toast-styles.d.ts +8 -0
- package/dist/components/toast/toast-styles.d.ts.map +1 -1
- package/dist/components/toast/toast-styles.js +11 -3
- package/dist/icons/ChevronUpIcon.d.ts +3 -0
- package/dist/icons/ChevronUpIcon.d.ts.map +1 -0
- package/dist/icons/ChevronUpIcon.js +21 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/index.js +62 -59
- package/dist/theme/color.js +2 -2
- package/package.json +1 -1
- package/dist/components/keyboard/keyboard-context.d.ts +0 -118
- package/dist/components/keyboard/keyboard-context.d.ts.map +0 -1
- package/dist/components/keyboard/keyboard-context.js +0 -90
- package/dist/components/toast/toast-context.d.ts +0 -163
- package/dist/components/toast/toast-context.d.ts.map +0 -1
- package/dist/components/toast/toast-context.js +0 -177
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { useState as f, useMemo as q } from "react";
|
|
4
|
+
import { ChevronLeftIcon as B } from "../../icons/ChevronLeftIcon.js";
|
|
5
|
+
import { ChevronRightIcon as J } from "../../icons/ChevronRightIcon.js";
|
|
6
|
+
import { buildDayCells as Q, MONTHS as U, DAYS_OF_WEEK as X } from "./date-picker.helpers.js";
|
|
7
|
+
import { CALENDAR_COLOR_CLASSES as L, DATE_PICKER_CELL_SIZE_CLASS as tt } from "./date-picker-styles.js";
|
|
8
|
+
import { TimeSpinner as y } from "./TimeSpinner.js";
|
|
9
|
+
import { cn as u } from "../../utils/cn.js";
|
|
10
|
+
function ut({
|
|
11
|
+
selected: n,
|
|
12
|
+
mode: s,
|
|
13
|
+
isClearable: C,
|
|
14
|
+
resolvedSizeKey: j,
|
|
15
|
+
resolvedColor: h,
|
|
16
|
+
radiusClass: a,
|
|
17
|
+
onSelect: v,
|
|
18
|
+
onClose: w,
|
|
19
|
+
disableFuture: Y = !1
|
|
20
|
+
}) {
|
|
21
|
+
const r = /* @__PURE__ */ new Date(), [l, k] = f(
|
|
22
|
+
(n == null ? void 0 : n.getFullYear()) ?? r.getFullYear()
|
|
23
|
+
), [i, g] = f(
|
|
24
|
+
(n == null ? void 0 : n.getMonth()) ?? r.getMonth()
|
|
25
|
+
), [b, A] = f((n == null ? void 0 : n.getHours()) ?? 0), [p, H] = f((n == null ? void 0 : n.getMinutes()) ?? 0), [x, T] = f((n == null ? void 0 : n.getSeconds()) ?? 0), m = L[h] ?? L.primary;
|
|
26
|
+
function M(t, e, Z) {
|
|
27
|
+
const S = n ?? /* @__PURE__ */ new Date();
|
|
28
|
+
v(
|
|
29
|
+
new Date(S.getFullYear(), S.getMonth(), S.getDate(), t, e, Z, 0)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function I(t) {
|
|
33
|
+
A(t), M(t, p, x);
|
|
34
|
+
}
|
|
35
|
+
function O(t) {
|
|
36
|
+
H(t), M(b, t, x);
|
|
37
|
+
}
|
|
38
|
+
function R(t) {
|
|
39
|
+
T(t), M(b, p, t);
|
|
40
|
+
}
|
|
41
|
+
function K(t) {
|
|
42
|
+
v(new Date(l, i, t, b, p, x, 0)), s === "date" && w();
|
|
43
|
+
}
|
|
44
|
+
function P() {
|
|
45
|
+
i === 0 ? (g(11), k((t) => t - 1)) : g((t) => t - 1);
|
|
46
|
+
}
|
|
47
|
+
function V() {
|
|
48
|
+
i === 11 ? (g(0), k((t) => t + 1)) : g((t) => t + 1);
|
|
49
|
+
}
|
|
50
|
+
function d(t) {
|
|
51
|
+
return !!n && n.getFullYear() === l && n.getMonth() === i && n.getDate() === t;
|
|
52
|
+
}
|
|
53
|
+
function N(t) {
|
|
54
|
+
return r.getFullYear() === l && r.getMonth() === i && r.getDate() === t;
|
|
55
|
+
}
|
|
56
|
+
const $ = new Date(
|
|
57
|
+
r.getFullYear(),
|
|
58
|
+
r.getMonth(),
|
|
59
|
+
r.getDate()
|
|
60
|
+
);
|
|
61
|
+
function D(t) {
|
|
62
|
+
return Y ? new Date(l, i, t) > $ : !1;
|
|
63
|
+
}
|
|
64
|
+
const F = !Y || l < r.getFullYear() || l === r.getFullYear() && i < r.getMonth(), E = s === "date" || s === "datetime", z = s === "time" || s === "datetime", G = s !== "date" || C && !!n, _ = Q(l, i), W = q(() => _.map((t, e) => ({
|
|
65
|
+
key: t !== null ? `day-${t}` : `empty-slot-${e}`,
|
|
66
|
+
day: t
|
|
67
|
+
})), [_]);
|
|
68
|
+
return /* @__PURE__ */ c(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
className: u(
|
|
72
|
+
"bg-background border border-border/70 shadow-xl select-none p-4 w-max",
|
|
73
|
+
a
|
|
74
|
+
),
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ c("div", { className: "flex flex-row", children: [
|
|
77
|
+
E && /* @__PURE__ */ c("div", { className: "flex flex-col w-[264px]", children: [
|
|
78
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between pb-3 mb-2 border-b border-border/60", children: [
|
|
79
|
+
/* @__PURE__ */ o(
|
|
80
|
+
"button",
|
|
81
|
+
{
|
|
82
|
+
type: "button",
|
|
83
|
+
onClick: P,
|
|
84
|
+
"aria-label": "Previous month",
|
|
85
|
+
className: u(
|
|
86
|
+
"p-1.5 text-foreground/70 transition-all active:scale-95",
|
|
87
|
+
"hover:text-foreground hover:bg-secondary",
|
|
88
|
+
a
|
|
89
|
+
),
|
|
90
|
+
children: /* @__PURE__ */ o(B, {})
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
/* @__PURE__ */ c("span", { className: "font-semibold text-sm text-foreground tracking-wide", children: [
|
|
94
|
+
U[i],
|
|
95
|
+
" ",
|
|
96
|
+
l
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ o(
|
|
99
|
+
"button",
|
|
100
|
+
{
|
|
101
|
+
type: "button",
|
|
102
|
+
onClick: V,
|
|
103
|
+
disabled: !F,
|
|
104
|
+
"aria-label": "Next month",
|
|
105
|
+
className: u(
|
|
106
|
+
"p-1.5 text-foreground/70 transition-all",
|
|
107
|
+
F ? "hover:text-foreground hover:bg-secondary active:scale-95" : "opacity-30 cursor-not-allowed",
|
|
108
|
+
a
|
|
109
|
+
),
|
|
110
|
+
children: /* @__PURE__ */ o(J, {})
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] }),
|
|
114
|
+
/* @__PURE__ */ c("div", { className: "grid grid-cols-7 gap-1 text-center", children: [
|
|
115
|
+
X.map((t) => /* @__PURE__ */ o(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
className: "text-[11px] font-bold tracking-wider text-foreground/50 uppercase py-1 mb-1",
|
|
119
|
+
children: t
|
|
120
|
+
},
|
|
121
|
+
t
|
|
122
|
+
)),
|
|
123
|
+
W.map(
|
|
124
|
+
({ key: t, day: e }) => e === null ? /* @__PURE__ */ o("div", {}, t) : /* @__PURE__ */ o(
|
|
125
|
+
"button",
|
|
126
|
+
{
|
|
127
|
+
type: "button",
|
|
128
|
+
onClick: () => K(e),
|
|
129
|
+
disabled: D(e),
|
|
130
|
+
className: u(
|
|
131
|
+
"w-full flex items-center justify-center font-medium transition-all duration-200",
|
|
132
|
+
tt[j],
|
|
133
|
+
a,
|
|
134
|
+
D(e) ? "opacity-30 cursor-not-allowed text-foreground/50" : "active:scale-90",
|
|
135
|
+
!D(e) && !d(e) && !N(e) && m.hover,
|
|
136
|
+
d(e) && u(m.bg, "font-semibold shadow-sm"),
|
|
137
|
+
N(e) && !d(e) && u("border", m.border, m.text),
|
|
138
|
+
!d(e) && !N(e) && "text-foreground"
|
|
139
|
+
),
|
|
140
|
+
children: e
|
|
141
|
+
},
|
|
142
|
+
e
|
|
143
|
+
)
|
|
144
|
+
)
|
|
145
|
+
] })
|
|
146
|
+
] }),
|
|
147
|
+
z && /* @__PURE__ */ c(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
className: u(
|
|
151
|
+
"flex items-center justify-center gap-4",
|
|
152
|
+
E && "pl-5 ml-4 border-l border-border/60"
|
|
153
|
+
),
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ o(
|
|
156
|
+
y,
|
|
157
|
+
{
|
|
158
|
+
value: b,
|
|
159
|
+
max: 23,
|
|
160
|
+
label: "HH",
|
|
161
|
+
onChange: I,
|
|
162
|
+
resolvedColor: h,
|
|
163
|
+
radiusClass: a
|
|
164
|
+
}
|
|
165
|
+
),
|
|
166
|
+
/* @__PURE__ */ o(
|
|
167
|
+
y,
|
|
168
|
+
{
|
|
169
|
+
value: p,
|
|
170
|
+
max: 59,
|
|
171
|
+
label: "MM",
|
|
172
|
+
onChange: O,
|
|
173
|
+
resolvedColor: h,
|
|
174
|
+
radiusClass: a
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
/* @__PURE__ */ o(
|
|
178
|
+
y,
|
|
179
|
+
{
|
|
180
|
+
value: x,
|
|
181
|
+
max: 59,
|
|
182
|
+
label: "SS",
|
|
183
|
+
onChange: R,
|
|
184
|
+
resolvedColor: h,
|
|
185
|
+
radiusClass: a
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
] }),
|
|
192
|
+
G && /* @__PURE__ */ c("div", { className: "flex items-center justify-between border-t border-border/60 pt-3 mt-3", children: [
|
|
193
|
+
C && n ? /* @__PURE__ */ o(
|
|
194
|
+
"button",
|
|
195
|
+
{
|
|
196
|
+
type: "button",
|
|
197
|
+
onClick: () => {
|
|
198
|
+
v(null), w();
|
|
199
|
+
},
|
|
200
|
+
className: "text-xs font-medium text-foreground/50 hover:text-danger transition-colors active:scale-95 px-2 py-1",
|
|
201
|
+
children: "Clear"
|
|
202
|
+
}
|
|
203
|
+
) : /* @__PURE__ */ o("div", {}),
|
|
204
|
+
s !== "date" && /* @__PURE__ */ o(
|
|
205
|
+
"button",
|
|
206
|
+
{
|
|
207
|
+
type: "button",
|
|
208
|
+
onClick: w,
|
|
209
|
+
className: u(
|
|
210
|
+
"ml-auto text-xs font-semibold px-4 py-2 transition-all hover:opacity-90 active:scale-95 shadow-sm",
|
|
211
|
+
a,
|
|
212
|
+
m.bg
|
|
213
|
+
),
|
|
214
|
+
children: "Done"
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
] })
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
export {
|
|
223
|
+
ut as Calendar
|
|
224
|
+
};
|
|
@@ -1,179 +1,90 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { InputProps } from '../input/Input';
|
|
2
|
+
import { DatePickerConfig, PickerConfig } from './date-picker-config';
|
|
3
|
+
/**
|
|
4
|
+
* Picker menu configuration that extends PickerConfig with className.
|
|
5
|
+
* Used for styling the calendar popover.
|
|
6
|
+
*/
|
|
7
|
+
export interface PickerMenu extends PickerConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Extra CSS classes for the calendar popover.
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Base DatePicker props excluding the picker configuration.
|
|
15
|
+
* Combines DatePickerConfig (minus picker) with InputProps (minus value-related props).
|
|
16
|
+
*/
|
|
17
|
+
export type BaseDatePickerProps = Omit<DatePickerConfig, "picker"> & Omit<InputProps, "onChange" | "value" | "defaultValue" | "endContent" | "startContent">;
|
|
18
|
+
/**
|
|
19
|
+
* Configuration options for the DatePicker component.
|
|
20
|
+
* Extends InputProps but omits value-related props that are replaced
|
|
21
|
+
* with date-specific equivalents.
|
|
22
|
+
*/
|
|
23
|
+
export interface DatePickerProps extends BaseDatePickerProps {
|
|
6
24
|
/**
|
|
7
25
|
* The currently selected date.
|
|
8
|
-
*
|
|
26
|
+
* Pass null for no selection.
|
|
9
27
|
*/
|
|
10
28
|
selected?: Date | null;
|
|
11
29
|
/**
|
|
12
30
|
* Callback fired when the selected date changes.
|
|
13
|
-
* Receives the new date or null
|
|
31
|
+
* Receives the new date or null if cleared.
|
|
14
32
|
*/
|
|
15
33
|
onChange?: (date: Date | null) => void;
|
|
16
34
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @default "date"
|
|
21
|
-
*/
|
|
22
|
-
mode?: PickerMode;
|
|
23
|
-
/**
|
|
24
|
-
* Size of the date picker.
|
|
25
|
-
* Controls the height and font size of the trigger.
|
|
26
|
-
*
|
|
27
|
-
* @default "md"
|
|
28
|
-
*/
|
|
29
|
-
size?: FieldSizeKey;
|
|
30
|
-
/**
|
|
31
|
-
* Corner rounding of the date picker.
|
|
32
|
-
*
|
|
33
|
-
* @default "md"
|
|
34
|
-
*/
|
|
35
|
-
radius?: Radius;
|
|
36
|
-
/**
|
|
37
|
-
* Visual style variant of the date picker trigger.
|
|
38
|
-
*
|
|
39
|
-
* @default "bordered"
|
|
40
|
-
*/
|
|
41
|
-
variant?: Variant;
|
|
42
|
-
/**
|
|
43
|
-
* Theme accent color of the date picker.
|
|
44
|
-
*
|
|
45
|
-
* @default "primary"
|
|
46
|
-
*/
|
|
47
|
-
color?: Color;
|
|
48
|
-
/**
|
|
49
|
-
* Validation status of the field.
|
|
50
|
-
* Controls border color and message styling.
|
|
51
|
-
*/
|
|
52
|
-
status?: FieldStatus;
|
|
53
|
-
/**
|
|
54
|
-
* Label text for the date picker.
|
|
55
|
-
*/
|
|
56
|
-
label?: string;
|
|
57
|
-
/**
|
|
58
|
-
* Alignment of the label relative to the input.
|
|
59
|
-
*
|
|
60
|
-
* @default "left"
|
|
61
|
-
*/
|
|
62
|
-
labelAlign?: LabelAlign;
|
|
63
|
-
/**
|
|
64
|
-
* Description text shown below the field.
|
|
65
|
-
*/
|
|
66
|
-
description?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Validation message shown below the field.
|
|
69
|
-
* Color is determined by the status prop.
|
|
70
|
-
*/
|
|
71
|
-
message?: string;
|
|
72
|
-
/**
|
|
73
|
-
* Whether the field is required.
|
|
74
|
-
* Adds a required indicator to the label.
|
|
75
|
-
*
|
|
76
|
-
* @default false
|
|
77
|
-
*/
|
|
78
|
-
required?: boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Whether the field is in a loading state.
|
|
81
|
-
* Shows a loading spinner.
|
|
82
|
-
*
|
|
83
|
-
* @default false
|
|
84
|
-
*/
|
|
85
|
-
isLoading?: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Whether the field is disabled.
|
|
88
|
-
* Prevents interaction and dims the field.
|
|
89
|
-
*
|
|
90
|
-
* @default false
|
|
35
|
+
* Picker configuration overrides including portal, portalTarget, and className.
|
|
36
|
+
* All picker-related props should be passed through this object.
|
|
91
37
|
*/
|
|
92
|
-
|
|
38
|
+
picker?: PickerMenu;
|
|
93
39
|
/**
|
|
94
|
-
* Whether a clear button is shown
|
|
40
|
+
* Whether a clear button is shown in the input.
|
|
41
|
+
* When true, a clear button appears when a date is selected.
|
|
95
42
|
*
|
|
96
43
|
* @default false
|
|
97
44
|
*/
|
|
98
45
|
isClearable?: boolean;
|
|
99
46
|
/**
|
|
100
|
-
* Whether future dates are disabled
|
|
47
|
+
* Whether future dates are disabled in the calendar.
|
|
48
|
+
* When true, dates after today cannot be selected.
|
|
101
49
|
*
|
|
102
50
|
* @default false
|
|
103
51
|
*/
|
|
104
52
|
disableFuture?: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Custom placeholder text.
|
|
107
|
-
* Overrides the default placeholder for the selected mode.
|
|
108
|
-
*/
|
|
109
|
-
placeholder?: string;
|
|
110
|
-
/**
|
|
111
|
-
* Extra CSS classes for the date picker.
|
|
112
|
-
*/
|
|
113
|
-
className?: string;
|
|
114
|
-
/**
|
|
115
|
-
* Optional ID for the field.
|
|
116
|
-
*/
|
|
117
|
-
id?: string;
|
|
118
|
-
/**
|
|
119
|
-
* Inline styles for the date picker.
|
|
120
|
-
*/
|
|
121
|
-
style?: CSSProperties;
|
|
122
|
-
/**
|
|
123
|
-
* Whether to render the calendar popover in a React portal.
|
|
124
|
-
* When true, the popover is rendered at the document body level.
|
|
125
|
-
* Defaults to true.
|
|
126
|
-
*/
|
|
127
|
-
portal?: boolean;
|
|
128
|
-
/**
|
|
129
|
-
* Custom portal target element for the calendar popover.
|
|
130
|
-
* When portal is enabled, the popover is rendered into this element.
|
|
131
|
-
* Defaults to document.body.
|
|
132
|
-
*/
|
|
133
|
-
portalTarget?: HTMLElement | null;
|
|
134
53
|
}
|
|
135
54
|
/**
|
|
136
|
-
* A date
|
|
55
|
+
* A date/time picker component with calendar popover and time selection.
|
|
137
56
|
*
|
|
138
|
-
* DatePicker
|
|
139
|
-
* selecting dates and times. It supports
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* The component automatically handles accessibility attributes including
|
|
144
|
-
* role="combobox", aria-expanded, aria-invalid, and proper focus management
|
|
145
|
-
* through Floating UI.
|
|
57
|
+
* DatePicker renders an input field with a calendar popover that allows
|
|
58
|
+
* selecting dates and/or times. It supports date, time, and datetime modes,
|
|
59
|
+
* clearable selection, and future date restrictions. The component integrates
|
|
60
|
+
* with Floating UI for popover positioning and follows the standard AsheeUI
|
|
61
|
+
* cascade system for visual tokens.
|
|
146
62
|
*
|
|
147
63
|
* By default, the calendar popover uses React's createPortal to render at the
|
|
148
64
|
* document body level. This ensures the popover escapes CSS containment,
|
|
149
65
|
* overflow clipping, and stacking context issues. The portal can be disabled
|
|
150
|
-
* via the `portal` prop or `components.datePicker.portal` in
|
|
151
|
-
* the popover needs to stay within a specific parent container.
|
|
66
|
+
* via the `picker.portal` prop or `components.datePicker.picker.portal` in
|
|
67
|
+
* the config if the popover needs to stay within a specific parent container.
|
|
152
68
|
*
|
|
153
69
|
* @param props - DatePicker configuration options.
|
|
154
|
-
* @param props.selected -
|
|
155
|
-
* @param props.onChange - Callback fired when the
|
|
156
|
-
* @param props.mode - Selection mode. Defaults to "date".
|
|
157
|
-
* @param props.
|
|
70
|
+
* @param props.selected - Currently selected date or null.
|
|
71
|
+
* @param props.onChange - Callback fired when the date changes.
|
|
72
|
+
* @param props.mode - Selection mode: "date", "time", or "datetime". Defaults to "date".
|
|
73
|
+
* @param props.isClearable - Whether a clear button is shown. Defaults to false.
|
|
74
|
+
* @param props.disableFuture - Whether future dates are disabled. Defaults to false.
|
|
75
|
+
* @param props.placeholder - Placeholder text.
|
|
76
|
+
* @param props.size - Size of the input. Defaults to "md".
|
|
158
77
|
* @param props.radius - Corner rounding. Defaults to "md".
|
|
159
|
-
* @param props.variant - Visual style variant. Defaults to "bordered".
|
|
160
78
|
* @param props.color - Theme accent color. Defaults to "primary".
|
|
161
|
-
* @param props.
|
|
162
|
-
* @param props.
|
|
163
|
-
* @param props.
|
|
79
|
+
* @param props.disabled - Whether the input is disabled. Defaults to false.
|
|
80
|
+
* @param props.picker - Picker configuration overrides including className, portal, and portalTarget.
|
|
81
|
+
* @param props.label - Field label text.
|
|
164
82
|
* @param props.description - Description text.
|
|
165
83
|
* @param props.message - Validation message.
|
|
166
|
-
* @param props.required - Whether the field is required.
|
|
167
|
-
* @param props.isLoading - Loading state.
|
|
168
|
-
* @param props.
|
|
169
|
-
* @param props.
|
|
170
|
-
* @param props.disableFuture - Whether future dates are disabled.
|
|
171
|
-
* @param props.placeholder - Custom placeholder text.
|
|
172
|
-
* @param props.className - Extra CSS classes.
|
|
173
|
-
* @param props.id - Optional ID for the field.
|
|
174
|
-
* @param props.style - Inline styles.
|
|
175
|
-
* @param props.portal - Whether to render the popover in a portal. Defaults to true.
|
|
176
|
-
* @param props.portalTarget - Custom portal target element. Defaults to document.body.
|
|
84
|
+
* @param props.required - Whether the field is required. Defaults to false.
|
|
85
|
+
* @param props.isLoading - Loading state. Defaults to false.
|
|
86
|
+
* @param props.status - Validation status.
|
|
87
|
+
* @param props.labelAlign - Alignment of the label. Defaults to "left".
|
|
177
88
|
*
|
|
178
89
|
* @example
|
|
179
90
|
* ```tsx
|
|
@@ -181,13 +92,13 @@ export interface DatePickerProps {
|
|
|
181
92
|
* import { useState } from "react";
|
|
182
93
|
*
|
|
183
94
|
* export function Example() {
|
|
184
|
-
* const [
|
|
95
|
+
* const [selected, setSelected] = useState<Date | null>(null);
|
|
185
96
|
*
|
|
186
97
|
* return (
|
|
187
98
|
* <DatePicker
|
|
188
|
-
* selected={
|
|
189
|
-
* onChange={
|
|
190
|
-
* label="Select
|
|
99
|
+
* selected={selected}
|
|
100
|
+
* onChange={setSelected}
|
|
101
|
+
* label="Select Date"
|
|
191
102
|
* isClearable
|
|
192
103
|
* />
|
|
193
104
|
* );
|
|
@@ -196,19 +107,21 @@ export interface DatePickerProps {
|
|
|
196
107
|
*
|
|
197
108
|
* @example
|
|
198
109
|
* ```tsx
|
|
199
|
-
* //
|
|
110
|
+
* // With datetime mode and custom picker configuration
|
|
200
111
|
* <DatePicker
|
|
201
112
|
* mode="datetime"
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
113
|
+
* label="Select Date and Time"
|
|
114
|
+
* isClearable
|
|
115
|
+
* picker={{
|
|
116
|
+
* className: "custom-calendar",
|
|
117
|
+
* portal: false,
|
|
118
|
+
* }}
|
|
206
119
|
* />
|
|
207
120
|
* ```
|
|
208
121
|
*
|
|
209
122
|
* @see DatePickerConfig - The configuration type for component defaults.
|
|
210
|
-
* @see
|
|
211
|
-
* @see
|
|
123
|
+
* @see Input - The underlying input component.
|
|
124
|
+
* @see Calendar - The calendar popover component.
|
|
212
125
|
*/
|
|
213
|
-
export declare const DatePicker: import('react').ForwardRefExoticComponent<DatePickerProps & import('react').RefAttributes<
|
|
126
|
+
export declare const DatePicker: import('react').ForwardRefExoticComponent<DatePickerProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
214
127
|
//# sourceMappingURL=DatePicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/DatePicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/DatePicker.tsx"],"names":[],"mappings":"AAqCA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AASxD,OAAO,EACL,KAAK,gBAAgB,EAErB,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAChE,IAAI,CACF,UAAU,EACV,UAAU,GAAG,OAAO,GAAG,cAAc,GAAG,YAAY,GAAG,cAAc,CACtE,CAAC;AAEJ;;;;GAIG;AACH,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D;;;OAGG;IACH,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;IAEvC;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IAEpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,eAAO,MAAM,UAAU,8GAiTtB,CAAC"}
|