@pibit.ai/cure-design-system 0.5.7 → 0.5.8

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.
Files changed (72) hide show
  1. package/dist/applications/date-picker/calendar.d.ts +42 -0
  2. package/dist/applications/date-picker/calendar.d.ts.map +1 -0
  3. package/dist/applications/date-picker/calendar.js +310 -0
  4. package/dist/applications/date-picker/cell.d.ts +15 -0
  5. package/dist/applications/date-picker/cell.d.ts.map +1 -0
  6. package/dist/applications/date-picker/cell.js +90 -0
  7. package/dist/applications/date-picker/date-input.d.ts +7 -0
  8. package/dist/applications/date-picker/date-input.d.ts.map +1 -0
  9. package/dist/applications/date-picker/date-input.js +39 -0
  10. package/dist/applications/date-picker/date-picker.d.ts +47 -0
  11. package/dist/applications/date-picker/date-picker.d.ts.map +1 -0
  12. package/dist/applications/date-picker/date-picker.js +237 -0
  13. package/dist/applications/date-picker/date-range-picker.d.ts +44 -0
  14. package/dist/applications/date-picker/date-range-picker.d.ts.map +1 -0
  15. package/dist/applications/date-picker/date-range-picker.js +335 -0
  16. package/dist/applications/date-picker/date-range-presets.d.ts +50 -0
  17. package/dist/applications/date-picker/date-range-presets.d.ts.map +1 -0
  18. package/dist/applications/date-picker/date-range-presets.js +86 -0
  19. package/dist/applications/date-picker/date-time-calendar.d.ts +34 -0
  20. package/dist/applications/date-picker/date-time-calendar.d.ts.map +1 -0
  21. package/dist/applications/date-picker/date-time-calendar.js +140 -0
  22. package/dist/applications/date-picker/index.d.ts +12 -0
  23. package/dist/applications/date-picker/index.d.ts.map +1 -0
  24. package/dist/applications/date-picker/index.js +36 -0
  25. package/dist/applications/date-picker/range-calendar.d.ts +23 -0
  26. package/dist/applications/date-picker/range-calendar.d.ts.map +1 -0
  27. package/dist/applications/date-picker/range-calendar.js +210 -0
  28. package/dist/applications/date-picker/range-preset.d.ts +10 -0
  29. package/dist/applications/date-picker/range-preset.d.ts.map +1 -0
  30. package/dist/applications/date-picker/range-preset.js +27 -0
  31. package/dist/applications/date-picker/styles.d.ts +8 -0
  32. package/dist/applications/date-picker/styles.d.ts.map +1 -0
  33. package/dist/applications/date-picker/styles.js +14 -0
  34. package/dist/applications/date-picker/time-field.d.ts +7 -0
  35. package/dist/applications/date-picker/time-field.d.ts.map +1 -0
  36. package/dist/applications/date-picker/time-field.js +116 -0
  37. package/dist/applications/date-picker/time-list.d.ts +23 -0
  38. package/dist/applications/date-picker/time-list.d.ts.map +1 -0
  39. package/dist/applications/date-picker/time-list.js +89 -0
  40. package/dist/hooks/use-breakpoint.d.ts +10 -0
  41. package/dist/hooks/use-breakpoint.d.ts.map +1 -0
  42. package/dist/hooks/use-breakpoint.js +21 -0
  43. package/dist/index.d.ts +1 -0
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +341 -316
  46. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +6 -6
  47. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +6 -6
  48. package/dist/primitives/select/multi-select.js +81 -82
  49. package/dist/styles/components.css +1 -1
  50. package/package.json +8 -1
  51. package/dist/node_modules/@react-aria/focus/dist/FocusScope.js +0 -442
  52. package/dist/node_modules/@react-aria/i18n/dist/context.js +0 -10
  53. package/dist/node_modules/@react-aria/i18n/dist/useCollator.js +0 -11
  54. package/dist/node_modules/@react-aria/i18n/dist/useDefaultLocale.js +0 -36
  55. package/dist/node_modules/@react-aria/i18n/dist/useFilter.js +0 -35
  56. package/dist/node_modules/@react-aria/i18n/dist/utils.js +0 -44
  57. package/dist/node_modules/@react-aria/interactions/dist/focusSafely.js +0 -18
  58. package/dist/node_modules/@react-aria/interactions/dist/useFocusVisible.js +0 -62
  59. package/dist/node_modules/@react-aria/interactions/dist/utils.js +0 -5
  60. package/dist/node_modules/@react-aria/ssr/dist/SSRProvider.js +0 -49
  61. package/dist/node_modules/@react-aria/utils/dist/DOMFunctions.js +0 -27
  62. package/dist/node_modules/@react-aria/utils/dist/ShadowTreeWalker.js +0 -130
  63. package/dist/node_modules/@react-aria/utils/dist/domHelpers.js +0 -15
  64. package/dist/node_modules/@react-aria/utils/dist/focusWithoutScrolling.js +0 -45
  65. package/dist/node_modules/@react-aria/utils/dist/isElementVisible.js +0 -25
  66. package/dist/node_modules/@react-aria/utils/dist/isFocusable.js +0 -37
  67. package/dist/node_modules/@react-aria/utils/dist/isVirtualEvent.js +0 -7
  68. package/dist/node_modules/@react-aria/utils/dist/openLink.js +0 -28
  69. package/dist/node_modules/@react-aria/utils/dist/platform.js +0 -47
  70. package/dist/node_modules/@react-aria/utils/dist/runAfterTransition.js +0 -35
  71. package/dist/node_modules/@react-aria/utils/dist/useLayoutEffect.js +0 -6
  72. package/dist/node_modules/@react-stately/flags/dist/import.js +0 -7
@@ -0,0 +1,42 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { CalendarProps as AriaCalendarProps, DateValue } from 'react-aria-components';
3
+ export declare const CalendarContextProvider: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
4
+ /** Callback fired only when user selects a date from the calendar grid (not from the date input). Used to e.g. close popover only on grid selection. */
5
+ export declare const CalendarGridSelectContext: import('react').Context<((date: DateValue) => void) | null>;
6
+ /** Controlled calendar context: value and onSelect from props; used for inline calendar (e.g. NestedFieldSelect date dropdown). */
7
+ export interface ControlledCalendarContextProviderProps extends PropsWithChildren {
8
+ value: DateValue | null;
9
+ /** Called when a date is selected (by default from both grid and input). With onlyNotifyOnGridSelect, only from grid. */
10
+ onSelect?: (date: DateValue) => void;
11
+ /** Called on every value change (input or grid). Use with onlyNotifyOnGridSelect to sync typed values without closing. */
12
+ onChange?: (date: DateValue | null) => void;
13
+ /** When true, onSelect is only called when a date is picked from the calendar grid, not when the value changes via the date input. Use in popovers so the popover stays open while typing. Default false for backwards compatibility. */
14
+ onlyNotifyOnGridSelect?: boolean;
15
+ }
16
+ export declare const ControlledCalendarContextProvider: ({ value, onSelect, onChange, onlyNotifyOnGridSelect, children, }: ControlledCalendarContextProviderProps) => import("react/jsx-runtime").JSX.Element;
17
+ export type CalendarSize = "xs" | "sm" | "md" | "lg";
18
+ export interface CalendarDayGridProps {
19
+ /** The dates to mark with a dot. */
20
+ highlightedDates?: DateValue[];
21
+ /** Visual size; must match the enclosing calendar. */
22
+ size?: CalendarSize;
23
+ /** Called when a day is picked from the grid (not from a typed input). */
24
+ onDateSelect?: (date: DateValue) => void;
25
+ }
26
+ /** Weekday header plus the day cells. Must be rendered inside an Aria `Calendar`. */
27
+ export declare const CalendarDayGrid: ({ highlightedDates, size, onDateSelect, }: CalendarDayGridProps) => import("react/jsx-runtime").JSX.Element;
28
+ /**
29
+ * Calendar heading with month and year dropdowns on the left and the previous/next
30
+ * buttons on the right. Must be rendered inside an Aria `Calendar`.
31
+ */
32
+ export declare const CalendarMonthYearHeader: ({ size, }: {
33
+ size?: CalendarSize;
34
+ }) => import("react/jsx-runtime").JSX.Element;
35
+ export interface CalendarProps extends AriaCalendarProps<DateValue> {
36
+ /** The dates to highlight. */
37
+ highlightedDates?: DateValue[];
38
+ /** Visual size: "xs" (compact, for popovers/small screens) or "sm" (default). */
39
+ size?: CalendarSize;
40
+ }
41
+ export declare const Calendar: ({ highlightedDates, size, className, ...props }: CalendarProps) => import("react/jsx-runtime").JSX.Element;
42
+ //# sourceMappingURL=calendar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../src/applications/date-picker/calendar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,iBAAiB,EAAgB,MAAM,OAAO,CAAC;AAW7E,OAAO,KAAK,EACV,aAAa,IAAI,iBAAiB,EAClC,SAAS,EACV,MAAM,uBAAuB,CAAC;AA4E/B,eAAO,MAAM,uBAAuB,GAAI,cAAc,iBAAiB,4CAWtE,CAAC;AAEF,wJAAwJ;AACxJ,eAAO,MAAM,yBAAyB,kCAC5B,SAAS,KAAK,IAAI,SACrB,CAAC;AAER,mIAAmI;AACnI,MAAM,WAAW,sCAAuC,SAAQ,iBAAiB;IAC/E,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,yHAAyH;IACzH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,0HAA0H;IAC1H,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C,yOAAyO;IACzO,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,eAAO,MAAM,iCAAiC,GAAI,kEAM/C,sCAAsC,4CAmCxC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AA4ErD,MAAM,WAAW,oBAAoB;IACnC,oCAAoC;IACpC,gBAAgB,CAAC,EAAE,SAAS,EAAE,CAAC;IAC/B,sDAAsD;IACtD,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CAC1C;AAED,qFAAqF;AACrF,eAAO,MAAM,eAAe,GAAI,2CAI7B,oBAAoB,4CAiCtB,CAAC;AA4DF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAAI,WAErC;IACD,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB,4CA0EA,CAAC;AAEF,MAAM,WAAW,aAAc,SAAQ,iBAAiB,CAAC,SAAS,CAAC;IACjE,8BAA8B;IAC9B,gBAAgB,CAAC,EAAE,SAAS,EAAE,CAAC;IAC/B,iFAAiF;IACjF,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED,eAAO,MAAM,QAAQ,GAAI,iDAKtB,aAAa,4CA+Cf,CAAC"}
@@ -0,0 +1,310 @@
1
+ import { jsx as a, jsxs as u } from "react/jsx-runtime";
2
+ import { createContext as F, useContext as x, Fragment as I, useState as p, useMemo as k, useEffect as R, cloneElement as W } from "react";
3
+ import { ChevronLeft as E, ChevronRight as G, ChevronDown as L } from "@untitledui/icons";
4
+ import { useSlottedContext as N, CalendarContext as b, Calendar as Y, Heading as j, CalendarGrid as O, CalendarGridHeader as K, CalendarHeaderCell as T, CalendarStateContext as g, DateField as X, RangeCalendarStateContext as Z, RangeCalendarContext as $, Select as q, Button as z, SelectValue as V, ListBox as J, ListBoxItem as Q } from "react-aria-components";
5
+ import { useDateFormatter as S, useCalendarGrid as U } from "react-aria";
6
+ import { today as B, getLocalTimeZone as ee, endOfMonth as te } from "@internationalized/date";
7
+ import { cx as h } from "../../utils/cn.js";
8
+ import { CalendarCell as re } from "./cell.js";
9
+ import { DateInput as w } from "./date-input.js";
10
+ import { Button as P } from "../../primitives/button/button.js";
11
+ import { Popover as ae } from "../../primitives/select/popover.js";
12
+ import { pickerOptionStyles as ne } from "./styles.js";
13
+ const oe = 6;
14
+ function se({
15
+ children: t,
16
+ className: r
17
+ }) {
18
+ const e = x(g), s = x(Z), n = e ?? s, o = N(b), l = N($), d = n.visibleRange.start, m = (o == null ? void 0 : o.firstDayOfWeek) ?? (l == null ? void 0 : l.firstDayOfWeek), { weeksInMonth: C } = U(
19
+ {
20
+ startDate: d,
21
+ endDate: te(d),
22
+ weekdayStyle: "short",
23
+ firstDayOfWeek: m
24
+ },
25
+ n
26
+ ), i = Math.max(oe, C);
27
+ return /* @__PURE__ */ a("tbody", { className: r, children: [...new Array(i).keys()].map((c) => /* @__PURE__ */ a("tr", { children: n.getDatesInWeek(c, d).map(
28
+ (f, v) => f ? W(t(f), { key: v }) : /* @__PURE__ */ a("td", {}, v)
29
+ ) }, c)) });
30
+ }
31
+ const le = ({ children: t }) => {
32
+ const [r, e] = p(null), [s, n] = p();
33
+ return /* @__PURE__ */ a(
34
+ b.Provider,
35
+ {
36
+ value: { value: r, onChange: e, focusedValue: s, onFocusChange: n },
37
+ children: t
38
+ }
39
+ );
40
+ }, A = F(null), De = ({
41
+ value: t,
42
+ onSelect: r,
43
+ onChange: e,
44
+ onlyNotifyOnGridSelect: s = !1,
45
+ children: n
46
+ }) => {
47
+ const [o, l] = p(t), [d, m] = p();
48
+ R(() => {
49
+ l(t), t != null && m(t);
50
+ }, [t]);
51
+ const C = (c) => {
52
+ l(c), c && m(c), e == null || e(c), c && !s && (r == null || r(c));
53
+ }, i = s && r ? r : null;
54
+ return /* @__PURE__ */ a(A.Provider, { value: i, children: /* @__PURE__ */ a(
55
+ b.Provider,
56
+ {
57
+ value: {
58
+ value: o,
59
+ onChange: C,
60
+ focusedValue: d,
61
+ onFocusChange: m
62
+ },
63
+ children: n
64
+ }
65
+ ) });
66
+ }, H = F("sm"), ce = () => {
67
+ const t = x(g), r = x(H);
68
+ return t ? /* @__PURE__ */ a(
69
+ X,
70
+ {
71
+ value: t.value ?? void 0,
72
+ onChange: (e) => t.setValue(e),
73
+ children: /* @__PURE__ */ a(w, { className: "flex-1", size: r === "xs" ? "sm" : "md" })
74
+ }
75
+ ) : /* @__PURE__ */ a(w, { className: "flex-1", size: r === "xs" ? "sm" : "md" });
76
+ }, ie = ({
77
+ value: t,
78
+ children: r,
79
+ size: e = "sm",
80
+ ...s
81
+ }) => {
82
+ const n = x(g);
83
+ if (!n)
84
+ throw new Error("Preset must be used within a Calendar component");
85
+ return /* @__PURE__ */ a(
86
+ P,
87
+ {
88
+ ...s,
89
+ slot: null,
90
+ size: e,
91
+ color: "secondary",
92
+ onClick: () => {
93
+ n.setValue(t), n.setFocusedDate(t);
94
+ },
95
+ className: h(
96
+ "w-full h-full bg-secondary font-semibold",
97
+ e === "xs" ? "text-xs" : "text-sm"
98
+ ),
99
+ children: r
100
+ }
101
+ );
102
+ }, y = ({
103
+ slot: t,
104
+ size: r
105
+ }) => /* @__PURE__ */ a(
106
+ P,
107
+ {
108
+ slot: t,
109
+ iconLeading: t === "previous" ? E : G,
110
+ size: "sm",
111
+ color: "tertiary",
112
+ className: r === "xs" ? "size-6" : "size-8"
113
+ }
114
+ ), de = ({
115
+ highlightedDates: t,
116
+ size: r = "sm",
117
+ onDateSelect: e
118
+ }) => {
119
+ const s = r === "xs";
120
+ return /* @__PURE__ */ u(O, { weekdayStyle: "short", className: "w-max", children: [
121
+ /* @__PURE__ */ a(K, { className: "border-b-4 border-transparent", children: (n) => /* @__PURE__ */ a(T, { className: "p-0", children: /* @__PURE__ */ a(
122
+ "div",
123
+ {
124
+ className: h(
125
+ "flex items-center justify-center font-medium text-secondary",
126
+ s ? "size-7 text-xs" : "size-10 text-sm"
127
+ ),
128
+ children: n.slice(0, 2)
129
+ }
130
+ ) }) }),
131
+ /* @__PURE__ */ a(se, { className: "[&_td]:p-0 [&_tr]:border-b-4 [&_tr]:border-transparent [&_tr:last-of-type]:border-none", children: (n) => /* @__PURE__ */ a(
132
+ re,
133
+ {
134
+ date: n,
135
+ size: r,
136
+ isHighlighted: t == null ? void 0 : t.some(
137
+ (o) => n.compare(o) === 0
138
+ ),
139
+ onDateSelect: e
140
+ }
141
+ ) })
142
+ ] });
143
+ }, M = 100, _ = ({
144
+ "aria-label": t,
145
+ items: r,
146
+ selectedKey: e,
147
+ onChange: s,
148
+ size: n
149
+ }) => /* @__PURE__ */ u(
150
+ q,
151
+ {
152
+ "aria-label": t,
153
+ selectedKey: e,
154
+ onSelectionChange: (o) => {
155
+ o != null && s(Number(o));
156
+ },
157
+ children: [
158
+ /* @__PURE__ */ u(
159
+ z,
160
+ {
161
+ className: ({ isFocusVisible: o, isPressed: l }) => h(
162
+ "flex cursor-pointer items-center gap-1 rounded-md px-1.5 py-1 font-semibold text-fg-secondary outline-hidden transition duration-100 ease-linear hover:bg-primary_hover",
163
+ n === "xs" ? "text-xs" : "text-sm",
164
+ l && "bg-primary_hover",
165
+ o && "outline-2 outline-offset-2 outline-focus-ring"
166
+ ),
167
+ children: [
168
+ /* @__PURE__ */ a(V, {}),
169
+ /* @__PURE__ */ a(
170
+ L,
171
+ {
172
+ "aria-hidden": "true",
173
+ className: "size-4 shrink-0 text-fg-quaternary"
174
+ }
175
+ )
176
+ ]
177
+ }
178
+ ),
179
+ /* @__PURE__ */ a(ae, { size: "sm", placement: "bottom start", className: "w-36", children: /* @__PURE__ */ a(J, { items: r, className: "outline-hidden", children: (o) => /* @__PURE__ */ a(
180
+ Q,
181
+ {
182
+ id: o.id,
183
+ textValue: o.label,
184
+ className: ne,
185
+ children: o.label
186
+ }
187
+ ) }) })
188
+ ]
189
+ }
190
+ ), ke = ({
191
+ size: t = "sm"
192
+ }) => {
193
+ const r = x(g);
194
+ if (!r)
195
+ throw new Error(
196
+ "<CalendarMonthYearHeader /> must be used within a <Calendar /> component."
197
+ );
198
+ const { focusedDate: e, timeZone: s, minValue: n, maxValue: o } = r, l = S({
199
+ month: "long",
200
+ calendar: e.calendar.identifier,
201
+ timeZone: s
202
+ }), d = S({
203
+ year: "numeric",
204
+ calendar: e.calendar.identifier,
205
+ timeZone: s
206
+ }), m = k(() => {
207
+ const i = e.calendar.getMonthsInYear(e);
208
+ return Array.from({ length: i }, (c, f) => ({
209
+ id: f + 1,
210
+ label: l.format(
211
+ e.set({ month: f + 1, day: 1 }).toDate(s)
212
+ )
213
+ }));
214
+ }, [e, l, s]), C = k(() => {
215
+ const i = B(s).year, c = Math.min(
216
+ (n == null ? void 0 : n.year) ?? i - M,
217
+ e.year
218
+ ), f = Math.max(
219
+ (o == null ? void 0 : o.year) ?? i + M,
220
+ e.year
221
+ );
222
+ return Array.from({ length: f - c + 1 }, (v, D) => ({
223
+ id: c + D,
224
+ label: d.format(
225
+ e.set({ year: c + D, month: 1, day: 1 }).toDate(s)
226
+ )
227
+ }));
228
+ }, [e, o, n, s, d]);
229
+ return /* @__PURE__ */ u("header", { className: "flex items-center justify-between gap-2", children: [
230
+ /* @__PURE__ */ u("div", { className: "-ml-1.5 flex items-center gap-1", children: [
231
+ /* @__PURE__ */ a(
232
+ _,
233
+ {
234
+ "aria-label": "Month",
235
+ size: t,
236
+ items: m,
237
+ selectedKey: e.month,
238
+ onChange: (i) => r.setFocusedDate(e.set({ month: i }))
239
+ }
240
+ ),
241
+ /* @__PURE__ */ a(
242
+ _,
243
+ {
244
+ "aria-label": "Year",
245
+ size: t,
246
+ items: C,
247
+ selectedKey: e.year,
248
+ onChange: (i) => r.setFocusedDate(e.set({ year: i }))
249
+ }
250
+ )
251
+ ] }),
252
+ /* @__PURE__ */ u("div", { className: "flex items-center gap-1", children: [
253
+ /* @__PURE__ */ a(y, { slot: "previous", size: t }),
254
+ /* @__PURE__ */ a(y, { slot: "next", size: t })
255
+ ] })
256
+ ] });
257
+ }, Se = ({
258
+ highlightedDates: t,
259
+ size: r = "sm",
260
+ className: e,
261
+ ...s
262
+ }) => {
263
+ const n = N(b), o = x(A), l = r === "xs";
264
+ return /* @__PURE__ */ a(n ? I : le, { children: /* @__PURE__ */ a(H.Provider, { value: r, children: /* @__PURE__ */ u(
265
+ Y,
266
+ {
267
+ ...s,
268
+ className: (m) => h(
269
+ "flex flex-col w-max",
270
+ l ? "gap-2" : "gap-3",
271
+ typeof e == "function" ? e(m) : e
272
+ ),
273
+ children: [
274
+ /* @__PURE__ */ u("header", { className: "flex items-center justify-between", children: [
275
+ /* @__PURE__ */ a(y, { slot: "previous", size: r }),
276
+ /* @__PURE__ */ a(
277
+ j,
278
+ {
279
+ className: h(
280
+ "font-semibold text-fg-secondary",
281
+ l ? "text-xs" : "text-sm"
282
+ )
283
+ }
284
+ ),
285
+ /* @__PURE__ */ a(y, { slot: "next", size: r })
286
+ ] }),
287
+ /* @__PURE__ */ u("div", { className: h("flex", l ? "gap-2" : "gap-3"), children: [
288
+ /* @__PURE__ */ a(ce, {}),
289
+ /* @__PURE__ */ a(ie, { size: r, value: B(ee()), children: "Today" })
290
+ ] }),
291
+ /* @__PURE__ */ a(
292
+ de,
293
+ {
294
+ highlightedDates: t,
295
+ size: r,
296
+ onDateSelect: o ?? void 0
297
+ }
298
+ )
299
+ ]
300
+ }
301
+ ) }) });
302
+ };
303
+ export {
304
+ Se as Calendar,
305
+ le as CalendarContextProvider,
306
+ de as CalendarDayGrid,
307
+ A as CalendarGridSelectContext,
308
+ ke as CalendarMonthYearHeader,
309
+ De as ControlledCalendarContextProvider
310
+ };
@@ -0,0 +1,15 @@
1
+ import { DateValue } from '@internationalized/date';
2
+ import { CalendarCellProps as AriaCalendarCellProps } from 'react-aria-components';
3
+ import { CalendarSize } from './calendar';
4
+ export interface CalendarCellProps extends AriaCalendarCellProps {
5
+ /** Whether the calendar is a range calendar. */
6
+ isRangeCalendar?: boolean;
7
+ /** Whether the cell is highlighted. */
8
+ isHighlighted?: boolean;
9
+ /** Visual size: "xs", "sm", "md", "lg" (must match Calendar size). */
10
+ size?: CalendarSize;
11
+ /** Called when the user selects this date from the grid (click or keyboard). Use to e.g. close popover only on grid selection. */
12
+ onDateSelect?: (date: DateValue) => void;
13
+ }
14
+ export declare const CalendarCell: ({ date, isHighlighted, size, onDateSelect, ...props }: CalendarCellProps) => import("react/jsx-runtime").JSX.Element;
15
+ //# sourceMappingURL=cell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cell.d.ts","sourceRoot":"","sources":["../../../src/applications/date-picker/cell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMzD,OAAO,KAAK,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAQxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D,gDAAgD;IAChD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uCAAuC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sEAAsE;IACtE,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,kIAAkI;IAClI,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CAC1C;AAED,eAAO,MAAM,YAAY,GAAI,uDAM1B,iBAAiB,4CA8HnB,CAAC"}
@@ -0,0 +1,90 @@
1
+ import { jsx as y, jsxs as M } from "react/jsx-runtime";
2
+ import { getDayOfWeek as N, isToday as T, getLocalTimeZone as B } from "@internationalized/date";
3
+ import { useLocale as E, useSlottedContext as W, RangeCalendarContext as F, CalendarCell as I } from "react-aria-components";
4
+ import { cx as u } from "../../utils/cn.js";
5
+ const H = ({
6
+ date: e,
7
+ isHighlighted: p,
8
+ size: m = "sm",
9
+ onDateSelect: g,
10
+ ...O
11
+ }) => {
12
+ var b, x;
13
+ const { locale: R } = E(), h = N(e, R), o = W(F), n = !!o, a = (b = o == null ? void 0 : o.value) == null ? void 0 : b.start, s = (x = o == null ? void 0 : o.value) == null ? void 0 : x.end, z = a ? e.compare(a) > 0 : !0, C = s ? e.compare(s) < 0 : !0, L = a && e.compare(a) >= 0, k = s && e.compare(s) <= 0, w = L && k, _ = new Date(e.year, e.month, 0).getDate(), j = e.day === _, A = e.day === 1, v = T(e, B());
14
+ return /* @__PURE__ */ y(
15
+ I,
16
+ {
17
+ ...O,
18
+ date: e,
19
+ className: ({
20
+ isDisabled: t,
21
+ isFocusVisible: i,
22
+ isSelectionStart: f,
23
+ isSelectionEnd: l,
24
+ isSelected: r,
25
+ isOutsideMonth: c
26
+ }) => u(
27
+ "relative focus:outline-none",
28
+ m === "xs" ? "size-7" : "size-10",
29
+ (f || h === 0) && "rounded-l-full",
30
+ (l || h === 6) && "rounded-r-full",
31
+ w && t && "bg-active",
32
+ r && n && "bg-active",
33
+ t ? "pointer-events-none" : "cursor-pointer",
34
+ i ? "z-10" : "z-0",
35
+ n && c && "hidden",
36
+ // Show gradient on last day of month if it's within the selected range.
37
+ j && r && C && n && "after:absolute after:inset-0 after:translate-x-full after:bg-gradient-to-l after:from-transparent after:to-bg-active in-[[role=gridcell]:last-child]:after:hidden",
38
+ // Show gradient on first day of month if it's within the selected range.
39
+ A && r && z && n && "after:absolute after:inset-0 after:-translate-x-full after:bg-gradient-to-r after:from-transparent after:to-bg-active in-[[role=gridcell]:first-child]:after:hidden"
40
+ ),
41
+ children: ({
42
+ isDisabled: t,
43
+ isFocusVisible: i,
44
+ isSelectionStart: f,
45
+ isSelectionEnd: l,
46
+ isSelected: r,
47
+ formattedDate: c
48
+ }) => {
49
+ const d = f || l || r && !t && !n;
50
+ return /* @__PURE__ */ M(
51
+ "div",
52
+ {
53
+ onClick: () => {
54
+ !t && g && g(e);
55
+ },
56
+ className: u(
57
+ "relative flex size-full items-center justify-center rounded-full",
58
+ m === "xs" ? "text-xs" : "text-sm",
59
+ // Disabled state.
60
+ t ? "text-disabled" : "text-secondary hover:text-secondary_hover",
61
+ // Focus ring, visible while the cell has keyboard focus.
62
+ i ? "outline-2 outline-offset-2 outline-focus-ring" : "",
63
+ // Hover state for cells in the middle of the range.
64
+ r && !t && n ? "font-medium" : "",
65
+ d && "bg-brand-solid font-medium text-white hover:bg-brand-solid_hover hover:text-white",
66
+ // Hover state for non-selected cells.
67
+ !r && !t ? "hover:bg-primary_hover hover:font-medium!" : "",
68
+ !r && v ? "bg-active font-medium hover:bg-secondary_hover" : ""
69
+ ),
70
+ children: [
71
+ c,
72
+ (p || v) && /* @__PURE__ */ y(
73
+ "div",
74
+ {
75
+ className: u(
76
+ "absolute bottom-1 left-1/2 size-1.25 -translate-x-1/2 rounded-full",
77
+ t ? "bg-fg-disabled" : d ? "bg-fg-white" : "bg-fg-brand-primary"
78
+ )
79
+ }
80
+ )
81
+ ]
82
+ }
83
+ );
84
+ }
85
+ }
86
+ );
87
+ };
88
+ export {
89
+ H as CalendarCell
90
+ };
@@ -0,0 +1,7 @@
1
+ import { DateInputProps as AriaDateInputProps } from 'react-aria-components';
2
+ export interface DateInputProps extends Omit<AriaDateInputProps, "children"> {
3
+ /** Input size: "sm" (compact) or "md" (default). */
4
+ size?: "sm" | "md";
5
+ }
6
+ export declare const DateInput: ({ size, ...props }: DateInputProps) => import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=date-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-input.d.ts","sourceRoot":"","sources":["../../../src/applications/date-picker/date-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AA0BlF,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC;IAC1E,oDAAoD;IACpD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,GAAI,oBAA2B,cAAc,4CAiClE,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { DateInput as s, DateSegment as i } from "react-aria-components";
3
+ import { cx as n } from "../../utils/cn.js";
4
+ const d = /* @__PURE__ */ new Set(["day", "month", "hour"]);
5
+ function c(r) {
6
+ const { type: e, text: t, isPlaceholder: o } = r;
7
+ return o || !d.has(e) ? t : t.length === 1 && /^\d$/.test(t) ? `0${t}` : t;
8
+ }
9
+ const p = ({ size: r = "md", ...e }) => /* @__PURE__ */ a(
10
+ s,
11
+ {
12
+ ...e,
13
+ className: n(
14
+ "flex rounded-lg bg-primary shadow-xs ring-1 ring-secondary ring-inset focus-within:ring-2 focus-within:ring-brand",
15
+ r === "sm" ? "px-2 py-1.5 text-sm rounded-md" : "px-2.5 py-2 text-md",
16
+ typeof e.className == "string" && e.className
17
+ ),
18
+ children: (t) => /* @__PURE__ */ a(
19
+ i,
20
+ {
21
+ segment: t,
22
+ className: n(
23
+ "rounded px-0.5 text-primary caret-transparent focus:bg-brand-solid focus:font-medium focus:text-white focus:outline-hidden",
24
+ r === "sm" ? "text-xs" : "text-sm",
25
+ // The placeholder segment.
26
+ t.isPlaceholder && "text-placeholder uppercase",
27
+ // The separator "/" segment.
28
+ t.type === "literal" && "text-secondary",
29
+ // "pm" rather than "PM", matching the time list.
30
+ t.type === "dayPeriod" && !t.isPlaceholder && "lowercase"
31
+ ),
32
+ children: c(t)
33
+ }
34
+ )
35
+ }
36
+ );
37
+ export {
38
+ p as DateInput
39
+ };
@@ -0,0 +1,47 @@
1
+ import { ReactNode } from 'react';
2
+ import { DatePickerProps as AriaDatePickerProps, DateValue, TimeValue } from 'react-aria-components';
3
+ /** Trigger sizes: text size, the Button size it sits on, and the calendar icon. */
4
+ declare const sizes: {
5
+ readonly xs: {
6
+ readonly button: "xs";
7
+ readonly text: "text-xs";
8
+ readonly icon: "size-3!";
9
+ };
10
+ readonly sm: {
11
+ readonly button: "xs";
12
+ readonly text: "text-sm";
13
+ readonly icon: "size-3.5!";
14
+ };
15
+ readonly md: {
16
+ readonly button: "sm";
17
+ readonly text: "text-md";
18
+ readonly icon: "size-4!";
19
+ };
20
+ };
21
+ export type DatePickerSize = keyof typeof sizes;
22
+ export interface DatePickerProps extends AriaDatePickerProps<DateValue> {
23
+ /** Trigger size: "xs" (text-xs, xs button), "sm" (text-sm, xs button), "md" (text-md, sm button). Defaults to "xs". */
24
+ size?: DatePickerSize;
25
+ /** The function to call when the apply button is clicked. */
26
+ onApply?: (value?: DateValue) => void;
27
+ /** The function to call when the cancel button is clicked. */
28
+ onCancel?: () => void;
29
+ /** Whether to show the Apply/Cancel footer. Defaults to true. */
30
+ showFooter?: boolean;
31
+ /** Class name applied to the trigger button (e.g. for font size like text-xs). */
32
+ triggerClassName?: string;
33
+ /** When true, shows a clear control when a date is set; calls `onChange(null)`. */
34
+ clearable?: boolean;
35
+ /** Rendered to the left of the clear control (or on the far right when empty). */
36
+ endAdornment?: ReactNode;
37
+ /**
38
+ * Time mode only (`granularity` of "hour", "minute" or "second"): minutes between
39
+ * two options in the time list. Defaults to 30.
40
+ */
41
+ timeStep?: number;
42
+ /** Time mode only: the time a date gets when it is picked before any time is. Defaults to midnight. */
43
+ defaultTime?: TimeValue;
44
+ }
45
+ export declare const DatePicker: ({ value: valueProp, defaultValue, onChange, onApply, onCancel, className, showFooter, triggerClassName, clearable, endAdornment, isDisabled, size, granularity, minValue, maxValue, isDateUnavailable, firstDayOfWeek, hourCycle: hourCycleProp, timeStep, defaultTime, ...props }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
46
+ export {};
47
+ //# sourceMappingURL=date-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/applications/date-picker/date-picker.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,KAAK,EACV,eAAe,IAAI,mBAAmB,EACtC,SAAS,EACT,SAAS,EACV,MAAM,uBAAuB,CAAC;AAe/B,mFAAmF;AACnF,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;CAIA,CAAC;AAEZ,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,KAAK,CAAC;AAEhD,MAAM,WAAW,eAAgB,SAAQ,mBAAmB,CAAC,SAAS,CAAC;IACrE,uHAAuH;IACvH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IACtC,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,iEAAiE;IACjE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mFAAmF;IACnF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kFAAkF;IAClF,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uGAAuG;IACvG,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB;AAiCD,eAAO,MAAM,UAAU,GAAI,oRAsBxB,eAAe,4CAqPjB,CAAC"}