@pibit.ai/cure-design-system 0.6.3 → 0.6.5

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 (52) hide show
  1. package/dist/applications/date-picker/calendar.d.ts +1 -1
  2. package/dist/applications/date-picker/calendar.d.ts.map +1 -1
  3. package/dist/applications/date-picker/calendar.js +162 -157
  4. package/dist/applications/date-picker/cell.d.ts.map +1 -1
  5. package/dist/applications/date-picker/cell.js +58 -51
  6. package/dist/applications/date-picker/date-input.d.ts +2 -2
  7. package/dist/applications/date-picker/date-input.d.ts.map +1 -1
  8. package/dist/applications/date-picker/date-input.js +21 -17
  9. package/dist/applications/date-picker/date-picker.d.ts +4 -1
  10. package/dist/applications/date-picker/date-picker.d.ts.map +1 -1
  11. package/dist/applications/date-picker/date-picker.js +136 -116
  12. package/dist/applications/date-picker/date-range-picker.d.ts +4 -0
  13. package/dist/applications/date-picker/date-range-picker.d.ts.map +1 -1
  14. package/dist/applications/date-picker/date-range-picker.js +245 -197
  15. package/dist/applications/date-picker/date-time-calendar.d.ts +1 -1
  16. package/dist/applications/date-picker/date-time-calendar.d.ts.map +1 -1
  17. package/dist/applications/date-picker/date-time-calendar.js +70 -60
  18. package/dist/applications/date-picker/range-calendar.d.ts +1 -1
  19. package/dist/applications/date-picker/range-calendar.d.ts.map +1 -1
  20. package/dist/applications/date-picker/range-calendar.js +99 -90
  21. package/dist/applications/date-picker/range-preset.d.ts +4 -1
  22. package/dist/applications/date-picker/range-preset.d.ts.map +1 -1
  23. package/dist/applications/date-picker/range-preset.js +23 -17
  24. package/dist/applications/date-picker/sizes.d.ts +12 -0
  25. package/dist/applications/date-picker/sizes.d.ts.map +1 -0
  26. package/dist/applications/date-picker/sizes.js +22 -0
  27. package/dist/applications/date-picker/styles.js +1 -1
  28. package/dist/applications/date-picker/time-field.js +21 -21
  29. package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
  30. package/dist/patterns/table/TableWrapper.js +454 -449
  31. package/dist/patterns/table/integrateTableUndoRedo.d.ts +6 -2
  32. package/dist/patterns/table/integrateTableUndoRedo.d.ts.map +1 -1
  33. package/dist/patterns/table/integrateTableUndoRedo.js +19 -15
  34. package/dist/patterns/table/storyHelpers/useMockTableState.d.ts +1 -0
  35. package/dist/patterns/table/storyHelpers/useMockTableState.d.ts.map +1 -1
  36. package/dist/patterns/table/tableUndoRedo.d.ts +4 -0
  37. package/dist/patterns/table/tableUndoRedo.d.ts.map +1 -1
  38. package/dist/patterns/table/tableUndoRedo.js +47 -37
  39. package/dist/patterns/table/tableUndoRedo.test.d.ts +2 -0
  40. package/dist/patterns/table/tableUndoRedo.test.d.ts.map +1 -0
  41. package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts +9 -0
  42. package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts.map +1 -1
  43. package/dist/patterns/table/toolbar/ColumnHeaderMenu.js +123 -110
  44. package/dist/patterns/table/types.d.ts +5 -0
  45. package/dist/patterns/table/types.d.ts.map +1 -1
  46. package/dist/patterns/table/useTableUndoRedo.d.ts +1 -1
  47. package/dist/patterns/table/useTableUndoRedo.d.ts.map +1 -1
  48. package/dist/patterns/table/useTableUndoRedo.js +179 -165
  49. package/dist/primitives/select/multi-select.d.ts.map +1 -1
  50. package/dist/primitives/select/multi-select.js +419 -422
  51. package/dist/styles/components.css +1 -1
  52. package/package.json +1 -1
@@ -1,128 +1,138 @@
1
- import { jsx as r, jsxs as d } from "react/jsx-runtime";
2
- import { useState as y, useMemo as k, useRef as j, useEffect as I, useContext as L } from "react";
3
- import { Time as w, toCalendarDateTime as M } from "@internationalized/date";
4
- import { CalendarCheck01 as P } from "@untitledui/icons";
5
- import { CalendarContext as q, Calendar as E, TimeField as G, CalendarStateContext as H, DateField as X } from "react-aria-components";
6
- import { cx as m } from "../../utils/cn.js";
7
- import { CalendarMonthYearHeader as Y, CalendarDayGrid as z } from "./calendar.js";
1
+ import { jsx as r, jsxs as m } from "react/jsx-runtime";
2
+ import { useState as y, useMemo as I, useRef as j, useEffect as L, useContext as M } from "react";
3
+ import { Time as w, toCalendarDateTime as P } from "@internationalized/date";
4
+ import { CalendarCheck01 as q } from "@untitledui/icons";
5
+ import { CalendarContext as E, Calendar as G, TimeField as H, CalendarStateContext as X, DateField as Y } from "react-aria-components";
6
+ import { cx as a } from "../../utils/cn.js";
7
+ import { CalendarMonthYearHeader as A, CalendarDayGrid as B } from "./calendar.js";
8
8
  import { DateInput as N } from "./date-input.js";
9
9
  import { toSingleDate as R } from "./calendar-value.js";
10
- import { TimeList as A } from "./time-list.js";
10
+ import { TimeList as J } from "./time-list.js";
11
+ import { dateInputSizeFor as b } from "./sizes.js";
11
12
  const h = (e) => new w(e.hour, e.minute, e.second), T = (e, n) => {
12
- const s = {
13
+ const t = {
13
14
  hour: n.hour,
14
15
  minute: n.minute,
15
16
  second: n.second,
16
17
  millisecond: 0
17
18
  };
18
- return "hour" in e ? e.set(s) : M(e, h(n));
19
- }, B = (e, n) => e === n || !!e && !!n && e.year === n.year && e.month === n.month && e.day === n.day && e.era === n.era, J = ({ size: e }) => {
20
- const n = L(H);
21
- return /* @__PURE__ */ d(
22
- X,
19
+ return "hour" in e ? e.set(t) : P(e, h(n));
20
+ }, K = (e, n) => e === n || !!e && !!n && e.year === n.year && e.month === n.month && e.day === n.day && e.era === n.era, Q = ({ size: e }) => {
21
+ const n = M(X);
22
+ return /* @__PURE__ */ m(
23
+ Y,
23
24
  {
24
25
  "aria-label": "Date",
25
26
  granularity: "day",
26
27
  isDisabled: n == null ? void 0 : n.isDisabled,
27
28
  isReadOnly: n == null ? void 0 : n.isReadOnly,
28
29
  value: R(n == null ? void 0 : n.value),
29
- onChange: (s) => n == null ? void 0 : n.setValue(s),
30
+ onChange: (t) => n == null ? void 0 : n.setValue(t),
30
31
  className: "relative min-w-0 flex-1",
31
32
  children: [
32
- /* @__PURE__ */ r(N, { className: "w-full pr-9", size: e === "xs" ? "sm" : "md" }),
33
33
  /* @__PURE__ */ r(
34
- P,
34
+ N,
35
+ {
36
+ className: a("w-full", e === "xs" ? "pr-8" : "pr-9"),
37
+ size: b(e)
38
+ }
39
+ ),
40
+ /* @__PURE__ */ r(
41
+ q,
35
42
  {
36
43
  "aria-hidden": "true",
37
- className: "pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2 text-fg-quaternary"
44
+ className: a(
45
+ "pointer-events-none absolute top-1/2 -translate-y-1/2 text-fg-quaternary",
46
+ e === "xs" ? "right-2.5 size-3.5" : "right-3 size-4"
47
+ )
38
48
  }
39
49
  )
40
50
  ]
41
51
  }
42
52
  );
43
- }, ie = ({
53
+ }, ae = ({
44
54
  value: e,
45
55
  onChange: n,
46
- highlightedDates: s,
47
- timeStep: b = 30,
56
+ highlightedDates: t,
57
+ timeStep: F = 30,
48
58
  hourCycle: p,
49
59
  timeGranularity: O = "minute",
50
- defaultTime: V,
51
- size: o = "sm",
60
+ defaultTime: S,
61
+ size: s = "xs",
52
62
  className: c,
53
- ...t
63
+ ...o
54
64
  }) => {
55
- const a = o === "xs", u = !!t.isDisabled || !!t.isReadOnly, [F, f] = y(
65
+ const l = s === "xs", u = !!o.isDisabled || !!o.isReadOnly, [V, f] = y(
56
66
  e ?? void 0
57
- ), [g, C] = y(null), l = k(
67
+ ), [g, x] = y(null), d = I(
58
68
  () => e && "hour" in e ? h(e) : g,
59
69
  [g, e]
60
- ), D = j(e);
61
- I(() => {
62
- !B(D.current, e) && e && f(e), D.current = e;
70
+ ), C = j(e);
71
+ L(() => {
72
+ !K(C.current, e) && e && f(e), C.current = e;
63
73
  }, [e]);
64
- const S = (i) => {
74
+ const k = (i) => {
65
75
  if (!u) {
66
76
  if (!i) {
67
- C(l), n(null);
77
+ x(d), n(null);
68
78
  return;
69
79
  }
70
- f(i), n(T(i, l ?? V ?? new w()));
80
+ f(i), n(T(i, d ?? S ?? new w()));
71
81
  }
72
- }, x = (i) => {
82
+ }, D = (i) => {
73
83
  if (!(u || !i)) {
74
84
  if (!e) {
75
- C(h(i));
85
+ x(h(i));
76
86
  return;
77
87
  }
78
88
  n(T(e, i));
79
89
  }
80
90
  };
81
91
  return /* @__PURE__ */ r(
82
- q.Provider,
92
+ E.Provider,
83
93
  {
84
94
  value: {
85
95
  value: e,
86
- onChange: (i) => S(R(i)),
87
- focusedValue: F,
96
+ onChange: (i) => k(R(i)),
97
+ focusedValue: V,
88
98
  onFocusChange: f
89
99
  },
90
- children: /* @__PURE__ */ d(
91
- E,
100
+ children: /* @__PURE__ */ m(
101
+ G,
92
102
  {
93
- ...t,
94
- className: (i) => m(
103
+ ...o,
104
+ className: (i) => a(
95
105
  "flex w-max flex-col",
96
- a ? "gap-2" : "gap-3",
106
+ l ? "gap-2" : "gap-3",
97
107
  typeof c == "function" ? c(i) : c
98
108
  ),
99
109
  children: [
100
- /* @__PURE__ */ r(Y, { size: o }),
101
- /* @__PURE__ */ d("div", { className: m("flex", a ? "gap-2" : "gap-3"), children: [
102
- /* @__PURE__ */ r(J, { size: o }),
110
+ /* @__PURE__ */ r(A, { size: s }),
111
+ /* @__PURE__ */ m("div", { className: a("flex", l ? "gap-2" : "gap-3"), children: [
112
+ /* @__PURE__ */ r(Q, { size: s }),
103
113
  /* @__PURE__ */ r(
104
- G,
114
+ H,
105
115
  {
106
116
  "aria-label": "Time",
107
- value: l,
108
- onChange: x,
117
+ value: d,
118
+ onChange: D,
109
119
  hourCycle: p,
110
120
  granularity: O,
111
- isDisabled: t.isDisabled,
112
- isReadOnly: t.isReadOnly,
113
- className: a ? "w-24" : "w-30",
114
- children: /* @__PURE__ */ r(N, { className: "w-full", size: a ? "sm" : "md" })
121
+ isDisabled: o.isDisabled,
122
+ isReadOnly: o.isReadOnly,
123
+ className: l ? "w-24" : "w-30",
124
+ children: /* @__PURE__ */ r(N, { className: "w-full", size: b(s) })
115
125
  }
116
126
  )
117
127
  ] }),
118
- /* @__PURE__ */ d("div", { className: m("flex", a ? "gap-2" : "gap-3"), children: [
119
- /* @__PURE__ */ r(z, { highlightedDates: s, size: o }),
120
- /* @__PURE__ */ r("div", { className: m("relative shrink-0", a ? "w-24" : "w-30"), children: /* @__PURE__ */ r(
121
- A,
128
+ /* @__PURE__ */ m("div", { className: a("flex", l ? "gap-2" : "gap-3"), children: [
129
+ /* @__PURE__ */ r(B, { highlightedDates: t, size: s }),
130
+ /* @__PURE__ */ r("div", { className: a("relative shrink-0", l ? "w-24" : "w-30"), children: /* @__PURE__ */ r(
131
+ J,
122
132
  {
123
- value: l,
124
- onChange: x,
125
- step: b,
133
+ value: d,
134
+ onChange: D,
135
+ step: F,
126
136
  hourCycle: p,
127
137
  isDisabled: u,
128
138
  className: "absolute inset-0 pr-1"
@@ -136,6 +146,6 @@ const h = (e) => new w(e.hour, e.minute, e.second), T = (e, n) => {
136
146
  );
137
147
  };
138
148
  export {
139
- ie as DateTimeCalendar,
149
+ ae as DateTimeCalendar,
140
150
  T as withTime
141
151
  };
@@ -14,7 +14,7 @@ export interface RangeCalendarProps extends AriaRangeCalendarProps<DateValue> {
14
14
  };
15
15
  }>;
16
16
  containerClassName?: string;
17
- /** Visual size: "xs" (compact) or "sm" (default). */
17
+ /** Visual size: "xs" (compact, default) or "sm". */
18
18
  size?: CalendarSize;
19
19
  /** Drops the horizontal padding on the calendars' outer edges, for containers that supply their own padding. */
20
20
  flushEdges?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"range-calendar.d.ts","sourceRoot":"","sources":["../../../src/applications/date-picker/range-calendar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK/D,OAAO,KAAK,EACV,kBAAkB,IAAI,sBAAsB,EAC5C,SAAS,EACV,MAAM,uBAAuB,CAAC;AAY/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAM/C,eAAO,MAAM,4BAA4B,GAAI,eAE1C,iBAAiB,4CAcnB,CAAC;AAgDF,MAAM,WAAW,kBAAmB,SAAQ,sBAAsB,CAAC,SAAS,CAAC;IAC3E,8BAA8B;IAC9B,gBAAgB,CAAC,EAAE,SAAS,EAAE,CAAC;IAC/B,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CACd,MAAM,EACN;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE;YAAE,KAAK,EAAE,SAAS,CAAC;YAAC,GAAG,EAAE,SAAS,CAAA;SAAE,CAAA;KAAE,CAC/D,CAAC;IACF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qDAAqD;IACrD,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,gHAAgH;IAChH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,GAAI,6DAM3B,kBAAkB,4CAiKpB,CAAC"}
1
+ {"version":3,"file":"range-calendar.d.ts","sourceRoot":"","sources":["../../../src/applications/date-picker/range-calendar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK/D,OAAO,KAAK,EACV,kBAAkB,IAAI,sBAAsB,EAC5C,SAAS,EACV,MAAM,uBAAuB,CAAC;AAY/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAO/C,eAAO,MAAM,4BAA4B,GAAI,eAE1C,iBAAiB,4CAcnB,CAAC;AAgDF,MAAM,WAAW,kBAAmB,SAAQ,sBAAsB,CAAC,SAAS,CAAC;IAC3E,8BAA8B;IAC9B,gBAAgB,CAAC,EAAE,SAAS,EAAE,CAAC;IAC/B,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CACd,MAAM,EACN;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE;YAAE,KAAK,EAAE,SAAS,CAAC;YAAC,GAAG,EAAE,SAAS,CAAA;SAAE,CAAA;KAAE,CAC/D,CAAC;IACF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oDAAoD;IACpD,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,gHAAgH;IAChH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,GAAI,6DAM3B,kBAAkB,4CAuKpB,CAAC"}
@@ -1,89 +1,90 @@
1
- import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
- import { Fragment as w, useState as p, useContext as v } from "react";
3
- import { ChevronLeft as _, ChevronRight as f } from "@untitledui/icons";
4
- import { useDateFormatter as D } from "react-aria";
5
- import { useSlottedContext as k, RangeCalendarContext as z, RangeCalendar as S, CalendarGrid as h, CalendarGridHeader as u, CalendarHeaderCell as b, CalendarGridBody as g, RangeCalendarStateContext as R } from "react-aria-components";
6
- import { useBreakpoint as B } from "../../hooks/use-breakpoint.js";
7
- import { CalendarCell as C } from "./cell.js";
8
- import { DateInput as y } from "./date-input.js";
9
- import { cx as i } from "../../utils/cn.js";
10
- import { Button as m } from "../../primitives/button/button.js";
11
- const F = ({
1
+ import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
+ import { Fragment as D, useState as f, useContext as j } from "react";
3
+ import { ChevronLeft as S, ChevronRight as p } from "@untitledui/icons";
4
+ import { useDateFormatter as k } from "react-aria";
5
+ import { useSlottedContext as B, RangeCalendarContext as w, RangeCalendar as F, CalendarGrid as h, CalendarGridHeader as u, CalendarHeaderCell as b, CalendarGridBody as g, RangeCalendarStateContext as _ } from "react-aria-components";
6
+ import { useBreakpoint as G } from "../../hooks/use-breakpoint.js";
7
+ import { dateInputSizeFor as y, rangeGridMinHeights as H, dayBoxSizes as C } from "./sizes.js";
8
+ import { CalendarCell as N } from "./cell.js";
9
+ import { DateInput as v } from "./date-input.js";
10
+ import { cx as o } from "../../utils/cn.js";
11
+ import { Button as c } from "../../primitives/button/button.js";
12
+ const L = ({
12
13
  children: l
13
14
  }) => {
14
- const [t, n] = p(null), [r, c] = p();
15
+ const [r, t] = f(null), [s, m] = f();
15
16
  return /* @__PURE__ */ e(
16
- z.Provider,
17
+ w.Provider,
17
18
  {
18
- value: { value: t, onChange: n, focusedValue: r, onFocusChange: c },
19
+ value: { value: r, onChange: t, focusedValue: s, onFocusChange: m },
19
20
  children: l
20
21
  }
21
22
  );
22
- }, N = ({ part: l }) => {
23
- const t = v(R);
24
- if (!t)
23
+ }, R = ({ part: l }) => {
24
+ const r = j(_);
25
+ if (!r)
25
26
  throw new Error(
26
27
  "<RangeCalendarTitle /> must be used within a <RangeCalendar /> component."
27
28
  );
28
- const n = D({
29
+ const t = k({
29
30
  month: "long",
30
31
  year: "numeric",
31
- calendar: t.visibleRange.start.calendar.identifier,
32
- timeZone: t.timeZone
32
+ calendar: r.visibleRange.start.calendar.identifier,
33
+ timeZone: r.timeZone
33
34
  });
34
- return l === "start" ? n.format(t.visibleRange.start.toDate(t.timeZone)) : n.format(t.visibleRange.end.toDate(t.timeZone));
35
- }, L = ({
35
+ return l === "start" ? t.format(r.visibleRange.start.toDate(r.timeZone)) : t.format(r.visibleRange.end.toDate(r.timeZone));
36
+ }, Z = ({
36
37
  value: l,
37
- children: t,
38
- ...n
38
+ children: r,
39
+ ...t
39
40
  }) => {
40
- const r = v(R);
41
+ const s = j(_);
41
42
  return /* @__PURE__ */ e(
42
- m,
43
+ c,
43
44
  {
44
- ...n,
45
+ ...t,
45
46
  slot: null,
46
- size: "sm",
47
+ size: "xs",
47
48
  color: "link-color",
48
49
  onClick: () => {
49
- r == null || r.setValue(l), r == null || r.setFocusedDate(l.start);
50
+ s == null || s.setValue(l), s == null || s.setFocusedDate(l.start);
50
51
  },
51
- children: t
52
+ children: r
52
53
  }
53
54
  );
54
- }, X = ({
55
+ }, J = ({
55
56
  presets: l,
56
- containerClassName: t,
57
- size: n = "sm",
58
- flushEdges: r = !1,
59
- ...c
57
+ containerClassName: r,
58
+ size: t = "xs",
59
+ flushEdges: s = !1,
60
+ ...m
60
61
  }) => {
61
- const d = B("md"), j = k(z), a = n === "xs", x = a ? "min-h-[220px]" : "min-h-[310px]";
62
- return /* @__PURE__ */ e(j ? w : F, { children: /* @__PURE__ */ o(
63
- S,
62
+ const d = G("md"), z = B(w), a = t === "xs", x = H[t];
63
+ return /* @__PURE__ */ e(z ? D : L, { children: /* @__PURE__ */ i(
64
+ F,
64
65
  {
65
- className: i("flex items-start", t),
66
+ className: o("flex items-start", r),
66
67
  visibleDuration: {
67
68
  months: d ? 2 : 1
68
69
  },
69
- ...c,
70
+ ...m,
70
71
  children: [
71
- /* @__PURE__ */ o(
72
+ /* @__PURE__ */ i(
72
73
  "div",
73
74
  {
74
- className: i(
75
- "flex flex-col py-1",
76
- a ? "gap-2 px-4" : "gap-3 px-6",
77
- r && (d ? "pl-0" : "px-0")
75
+ className: o(
76
+ "flex flex-1 flex-col py-1",
77
+ a ? "gap-2 px-3" : "gap-3 px-4",
78
+ s && (d ? "pl-0" : "px-0")
78
79
  ),
79
80
  children: [
80
- /* @__PURE__ */ o("header", { className: "relative flex items-center justify-between md:justify-start", children: [
81
+ /* @__PURE__ */ i("header", { className: "relative flex items-center justify-between md:justify-start", children: [
81
82
  /* @__PURE__ */ e(
82
- m,
83
+ c,
83
84
  {
84
85
  slot: "previous",
85
- iconLeading: _,
86
- size: "sm",
86
+ iconLeading: S,
87
+ size: a ? "xs" : "sm",
87
88
  color: "tertiary",
88
89
  className: a ? "size-6" : "size-8"
89
90
  }
@@ -91,109 +92,117 @@ const F = ({
91
92
  /* @__PURE__ */ e(
92
93
  "h2",
93
94
  {
94
- className: i(
95
+ className: o(
95
96
  "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 font-semibold text-fg-secondary",
96
97
  a ? "text-xs" : "text-sm"
97
98
  ),
98
- children: /* @__PURE__ */ e(N, { part: "start" })
99
+ children: /* @__PURE__ */ e(R, { part: "start" })
99
100
  }
100
101
  ),
101
102
  /* @__PURE__ */ e(
102
- m,
103
+ c,
103
104
  {
104
105
  slot: "next",
105
- iconLeading: f,
106
- size: "sm",
106
+ iconLeading: p,
107
+ size: a ? "xs" : "sm",
107
108
  color: "tertiary",
108
- className: i(a ? "size-6" : "size-8", "md:hidden")
109
+ className: o(a ? "size-6" : "size-8", "md:hidden")
109
110
  }
110
111
  )
111
112
  ] }),
112
- !d && /* @__PURE__ */ o("div", { className: "flex items-center gap-2 md:hidden", children: [
113
+ !d && /* @__PURE__ */ i("div", { className: "flex items-center gap-2 md:hidden", children: [
113
114
  /* @__PURE__ */ e(
114
- y,
115
+ v,
115
116
  {
116
117
  slot: "start",
117
- size: a ? "sm" : "md",
118
+ size: y(t),
118
119
  className: "flex-1"
119
120
  }
120
121
  ),
121
- /* @__PURE__ */ e("div", { className: "text-md text-quaternary", children: "–" }),
122
122
  /* @__PURE__ */ e(
123
- y,
123
+ "div",
124
+ {
125
+ className: o("text-quaternary", a ? "text-xs" : "text-md"),
126
+ children: "–"
127
+ }
128
+ ),
129
+ /* @__PURE__ */ e(
130
+ v,
124
131
  {
125
132
  slot: "end",
126
- size: a ? "sm" : "md",
133
+ size: y(t),
127
134
  className: "flex-1"
128
135
  }
129
136
  )
130
137
  ] }),
131
- !d && l && /* @__PURE__ */ e("div", { className: "mt-1 flex justify-between gap-3 px-2 md:hidden", children: Object.values(l).map((s) => /* @__PURE__ */ e(L, { value: s.value, children: s.label }, s.label)) }),
132
- /* @__PURE__ */ e("div", { className: x, children: /* @__PURE__ */ o(h, { weekdayStyle: "short", className: "w-max", children: [
133
- /* @__PURE__ */ e(u, { children: (s) => /* @__PURE__ */ e(b, { className: "border-b-4 border-transparent p-0", children: /* @__PURE__ */ e(
138
+ !d && l && /* @__PURE__ */ e("div", { className: "mt-1 flex justify-between gap-3 px-2 md:hidden", children: Object.values(l).map((n) => /* @__PURE__ */ e(Z, { value: n.value, children: n.label }, n.label)) }),
139
+ /* @__PURE__ */ e("div", { className: x, children: /* @__PURE__ */ i(h, { weekdayStyle: "short", className: "w-full", children: [
140
+ /* @__PURE__ */ e(u, { children: (n) => /* @__PURE__ */ e(b, { className: "border-b-2 border-transparent p-0", children: /* @__PURE__ */ e(
134
141
  "div",
135
142
  {
136
- className: i(
137
- "flex items-center justify-center font-medium text-secondary",
138
- a ? "size-7 text-xs" : "size-10 text-sm"
143
+ className: o(
144
+ "mx-auto flex items-center justify-center font-medium text-secondary",
145
+ C[t],
146
+ a ? "text-xs" : "text-sm"
139
147
  ),
140
- children: s.slice(0, 2)
148
+ children: n.slice(0, 2)
141
149
  }
142
150
  ) }) }),
143
- /* @__PURE__ */ e(g, { className: "[&_td]:p-0 [&_tr]:border-b-4 [&_tr]:border-transparent [&_tr:last-of-type]:border-none", children: (s) => /* @__PURE__ */ e(C, { date: s, size: n }) })
151
+ /* @__PURE__ */ e(g, { className: "[&_td]:p-0 [&_tr]:border-b-2 [&_tr]:border-transparent [&_tr:last-of-type]:border-none", children: (n) => /* @__PURE__ */ e(N, { date: n, size: t }) })
144
152
  ] }) })
145
153
  ]
146
154
  }
147
155
  ),
148
- d && /* @__PURE__ */ o(
156
+ d && /* @__PURE__ */ i(
149
157
  "div",
150
158
  {
151
- className: i(
152
- "flex flex-col border-l border-secondary py-1",
153
- a ? "gap-2 px-4" : "gap-3 px-6",
154
- r && "pr-0"
159
+ className: o(
160
+ "flex flex-1 flex-col border-l border-secondary py-1",
161
+ a ? "gap-2 px-3" : "gap-3 px-4",
162
+ s && "pr-0"
155
163
  ),
156
164
  children: [
157
- /* @__PURE__ */ o("header", { className: "relative flex items-center justify-end", children: [
165
+ /* @__PURE__ */ i("header", { className: "relative flex items-center justify-end", children: [
158
166
  /* @__PURE__ */ e(
159
167
  "h2",
160
168
  {
161
- className: i(
169
+ className: o(
162
170
  "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 font-semibold text-fg-secondary",
163
171
  a ? "text-xs" : "text-sm"
164
172
  ),
165
- children: /* @__PURE__ */ e(N, { part: "end" })
173
+ children: /* @__PURE__ */ e(R, { part: "end" })
166
174
  }
167
175
  ),
168
176
  /* @__PURE__ */ e(
169
- m,
177
+ c,
170
178
  {
171
179
  slot: "next",
172
- iconLeading: f,
173
- size: "sm",
180
+ iconLeading: p,
181
+ size: a ? "xs" : "sm",
174
182
  color: "tertiary",
175
183
  className: a ? "size-6" : "size-8"
176
184
  }
177
185
  )
178
186
  ] }),
179
- /* @__PURE__ */ e("div", { className: x, children: /* @__PURE__ */ o(
187
+ /* @__PURE__ */ e("div", { className: x, children: /* @__PURE__ */ i(
180
188
  h,
181
189
  {
182
190
  weekdayStyle: "short",
183
191
  offset: { months: 1 },
184
- className: "w-max",
192
+ className: "w-full",
185
193
  children: [
186
- /* @__PURE__ */ e(u, { children: (s) => /* @__PURE__ */ e(b, { className: "border-b-4 border-transparent p-0", children: /* @__PURE__ */ e(
194
+ /* @__PURE__ */ e(u, { children: (n) => /* @__PURE__ */ e(b, { className: "border-b-2 border-transparent p-0", children: /* @__PURE__ */ e(
187
195
  "div",
188
196
  {
189
- className: i(
190
- "flex items-center justify-center font-medium text-secondary",
191
- a ? "size-7 text-xs" : "size-10 text-sm"
197
+ className: o(
198
+ "mx-auto flex items-center justify-center font-medium text-secondary",
199
+ C[t],
200
+ a ? "text-xs" : "text-sm"
192
201
  ),
193
- children: s.slice(0, 2)
202
+ children: n.slice(0, 2)
194
203
  }
195
204
  ) }) }),
196
- /* @__PURE__ */ e(g, { className: "[&_td]:p-0 [&_tr]:border-b-4 [&_tr]:border-transparent [&_tr:last-of-type]:border-none", children: (s) => /* @__PURE__ */ e(C, { date: s, size: n }) })
205
+ /* @__PURE__ */ e(g, { className: "[&_td]:p-0 [&_tr]:border-b-2 [&_tr]:border-transparent [&_tr:last-of-type]:border-none", children: (n) => /* @__PURE__ */ e(N, { date: n, size: t }) })
197
206
  ]
198
207
  }
199
208
  ) })
@@ -205,6 +214,6 @@ const F = ({
205
214
  ) });
206
215
  };
207
216
  export {
208
- X as RangeCalendar,
209
- F as RangeCalendarContextProvider
217
+ J as RangeCalendar,
218
+ L as RangeCalendarContextProvider
210
219
  };
@@ -1,10 +1,13 @@
1
1
  import { HTMLAttributes } from 'react';
2
2
  import { DateValue } from 'react-aria-components';
3
+ import { PopoverSize } from './sizes';
3
4
  export interface RangePresetButtonProps extends HTMLAttributes<HTMLButtonElement> {
4
5
  value: {
5
6
  start: DateValue;
6
7
  end: DateValue;
7
8
  };
9
+ /** Matches the picker's popover size. Defaults to "xs". */
10
+ size?: PopoverSize;
8
11
  }
9
- export declare const RangePresetButton: ({ value, className, children, ...props }: RangePresetButtonProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const RangePresetButton: ({ value, size, className, children, ...props }: RangePresetButtonProps) => import("react/jsx-runtime").JSX.Element;
10
13
  //# sourceMappingURL=range-preset.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"range-preset.d.ts","sourceRoot":"","sources":["../../../src/applications/date-picker/range-preset.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,sBAAuB,SAAQ,cAAc,CAAC,iBAAiB,CAAC;IAC/E,KAAK,EAAE;QAAE,KAAK,EAAE,SAAS,CAAC;QAAC,GAAG,EAAE,SAAS,CAAA;KAAE,CAAC;CAC7C;AAED,eAAO,MAAM,iBAAiB,GAAI,0CAK/B,sBAAsB,4CAqBxB,CAAC"}
1
+ {"version":3,"file":"range-preset.d.ts","sourceRoot":"","sources":["../../../src/applications/date-picker/range-preset.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAQ3C,MAAM,WAAW,sBAAuB,SAAQ,cAAc,CAAC,iBAAiB,CAAC;IAC/E,KAAK,EAAE;QAAE,KAAK,EAAE,SAAS,CAAC;QAAC,GAAG,EAAE,SAAS,CAAA;KAAE,CAAC;IAC5C,2DAA2D;IAC3D,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,GAAI,gDAM/B,sBAAsB,4CAsBxB,CAAC"}
@@ -1,27 +1,33 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { useSlottedContext as m, RangeCalendarContext as l } from "react-aria-components";
3
- import { cx as v } from "../../utils/cn.js";
4
- const h = ({
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { useSlottedContext as x, RangeCalendarContext as p } from "react-aria-components";
3
+ import { cx as l } from "../../utils/cn.js";
4
+ const v = {
5
+ xs: "px-2.5 py-1 text-xs",
6
+ sm: "px-3 py-1.5 text-sm",
7
+ md: "px-3 py-2 text-sm"
8
+ }, b = ({
5
9
  value: t,
6
- className: a,
7
- children: i,
8
- ...u
10
+ size: a = "xs",
11
+ className: i,
12
+ children: m,
13
+ ...c
9
14
  }) => {
10
- var o, r, n, s;
11
- const e = m(l), c = ((r = (o = e == null ? void 0 : e.value) == null ? void 0 : o.start) == null ? void 0 : r.compare(t.start)) === 0 && ((s = (n = e == null ? void 0 : e.value) == null ? void 0 : n.end) == null ? void 0 : s.compare(t.end)) === 0;
12
- return /* @__PURE__ */ d(
15
+ var o, r, s, n;
16
+ const e = x(p), d = ((r = (o = e == null ? void 0 : e.value) == null ? void 0 : o.start) == null ? void 0 : r.compare(t.start)) === 0 && ((n = (s = e == null ? void 0 : e.value) == null ? void 0 : s.end) == null ? void 0 : n.compare(t.end)) === 0;
17
+ return /* @__PURE__ */ u(
13
18
  "button",
14
19
  {
15
- ...u,
16
- className: v(
17
- "cursor-pointer rounded-md px-3 py-2 text-left text-sm font-medium outline-focus-ring transition duration-100 ease-linear focus-visible:outline-2 focus-visible:outline-offset-2",
18
- c ? "bg-active text-secondary_hover hover:bg-secondary_hover" : "text-secondary hover:bg-primary_hover hover:text-secondary_hover",
19
- a
20
+ ...c,
21
+ className: l(
22
+ "cursor-pointer rounded-md text-left font-medium outline-focus-ring transition duration-100 ease-linear focus-visible:outline-2 focus-visible:outline-offset-2",
23
+ v[a],
24
+ d ? "bg-active text-secondary_hover hover:bg-secondary_hover" : "text-secondary hover:bg-primary_hover hover:text-secondary_hover",
25
+ i
20
26
  ),
21
- children: i
27
+ children: m
22
28
  }
23
29
  );
24
30
  };
25
31
  export {
26
- h as RangePresetButton
32
+ b as RangePresetButton
27
33
  };
@@ -0,0 +1,12 @@
1
+ import { CalendarSize } from './calendar';
2
+ /** Size of the boxes in the popovers: "xs" (28px days, 12px text), "sm" (36px days) or "md" (40px days). */
3
+ export type PopoverSize = "xs" | "sm" | "md";
4
+ /** The weekday header box and the round day marker. */
5
+ export declare const dayBoxSizes: Record<CalendarSize, string>;
6
+ /** A day cell: as tall as its marker and at least as wide, growing to fill its column. */
7
+ export declare const dayCellSizes: Record<CalendarSize, string>;
8
+ /** Six weeks of cells plus the weekday row, so paging a range calendar never changes its height. */
9
+ export declare const rangeGridMinHeights: Record<CalendarSize, string>;
10
+ /** The DateInput size that sits beside a calendar of the given size. */
11
+ export declare const dateInputSizeFor: (size: CalendarSize) => "xs" | "sm" | "md";
12
+ //# sourceMappingURL=sizes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sizes.d.ts","sourceRoot":"","sources":["../../../src/applications/date-picker/sizes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,4GAA4G;AAC5G,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7C,uDAAuD;AACvD,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAKpD,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAKrD,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAK5D,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,GAAI,MAAM,YAAY,uBACtB,CAAC"}