minerva-design 1.0.0 → 1.0.2

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 (138) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/custom-elements.json +663 -0
  3. package/dist/angular/fesm2022/minerva-angular.mjs +1163 -34
  4. package/dist/angular/fesm2022/minerva-angular.mjs.map +1 -1
  5. package/dist/angular/types/minerva-angular.d.ts +237 -1
  6. package/dist/core/calendar-date.d.cts +5 -0
  7. package/dist/core/calendar-date.d.ts +5 -0
  8. package/dist/core/contracts.cjs +1 -1
  9. package/dist/core/contracts.cjs.map +1 -1
  10. package/dist/core/contracts.js +1 -1
  11. package/dist/core/contracts.js.map +1 -1
  12. package/dist/core/index.cjs +6 -6
  13. package/dist/core/index.cjs.map +1 -1
  14. package/dist/core/index.js +671 -630
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/core/styling-hooks/components/date-picker.d.cts +45 -0
  17. package/dist/core/styling-hooks/components/date-picker.d.ts +45 -0
  18. package/dist/core/styling-hooks/manifest.d.cts +44 -0
  19. package/dist/core/styling-hooks/manifest.d.ts +44 -0
  20. package/dist/core/styling-hooks.cjs +1 -1
  21. package/dist/core/styling-hooks.cjs.map +1 -1
  22. package/dist/core/styling-hooks.js +62 -0
  23. package/dist/core/styling-hooks.js.map +1 -1
  24. package/dist/native/components/Calendar/Calendar.cjs +1 -1
  25. package/dist/native/components/Calendar/Calendar.cjs.map +1 -1
  26. package/dist/native/components/Calendar/Calendar.d.cts +2 -0
  27. package/dist/native/components/Calendar/Calendar.d.ts +2 -0
  28. package/dist/native/components/Calendar/Calendar.js +115 -112
  29. package/dist/native/components/Calendar/Calendar.js.map +1 -1
  30. package/dist/native/components/Checkbox/Checkbox.cjs +1 -1
  31. package/dist/native/components/Checkbox/Checkbox.cjs.map +1 -1
  32. package/dist/native/components/Checkbox/Checkbox.js +8 -8
  33. package/dist/native/components/Checkbox/CheckboxGroup.cjs +1 -1
  34. package/dist/native/components/Checkbox/CheckboxGroup.cjs.map +1 -1
  35. package/dist/native/components/Checkbox/CheckboxGroup.js +6 -6
  36. package/dist/native/components/DatePicker/DatePicker.cjs +2 -0
  37. package/dist/native/components/DatePicker/DatePicker.cjs.map +1 -0
  38. package/dist/native/components/DatePicker/DatePicker.d.cts +40 -0
  39. package/dist/native/components/DatePicker/DatePicker.d.ts +40 -0
  40. package/dist/native/components/DatePicker/DatePicker.js +110 -0
  41. package/dist/native/components/DatePicker/DatePicker.js.map +1 -0
  42. package/dist/native/components/DatePicker/index.cjs +1 -0
  43. package/dist/native/components/DatePicker/index.d.cts +2 -0
  44. package/dist/native/components/DatePicker/index.d.ts +2 -0
  45. package/dist/native/components/DatePicker/index.js +2 -0
  46. package/dist/native/components/Radio/RadioGroup.cjs +1 -1
  47. package/dist/native/components/Radio/RadioGroup.cjs.map +1 -1
  48. package/dist/native/components/Radio/RadioGroup.js +9 -9
  49. package/dist/native/components/Switch/Switch.cjs +1 -1
  50. package/dist/native/components/Switch/Switch.cjs.map +1 -1
  51. package/dist/native/components/Switch/Switch.js +23 -23
  52. package/dist/native/components/Switch/Switch.js.map +1 -1
  53. package/dist/native/index.cjs +1 -1
  54. package/dist/native/index.d.cts +1 -0
  55. package/dist/native/index.d.ts +1 -0
  56. package/dist/native/index.js +70 -68
  57. package/dist/native/source/components/Calendar/Calendar.tsx +14 -6
  58. package/dist/native/source/components/DatePicker/DatePicker.tsx +201 -0
  59. package/dist/native/source/components/DatePicker/index.ts +2 -0
  60. package/dist/native/source/index.ts +1 -0
  61. package/dist/native/source/manifest.ts +6 -0
  62. package/dist/react/components/DatePicker/DatePicker.cjs +2 -0
  63. package/dist/react/components/DatePicker/DatePicker.cjs.map +1 -0
  64. package/dist/react/components/DatePicker/DatePicker.d.cts +13 -0
  65. package/dist/react/components/DatePicker/DatePicker.d.ts +13 -0
  66. package/dist/react/components/DatePicker/DatePicker.js +315 -0
  67. package/dist/react/components/DatePicker/DatePicker.js.map +1 -0
  68. package/dist/react/components/DatePicker/datePicker.module.scss.cjs +2 -0
  69. package/dist/react/components/DatePicker/datePicker.module.scss.cjs.map +1 -0
  70. package/dist/react/components/DatePicker/datePicker.module.scss.js +23 -0
  71. package/dist/react/components/DatePicker/datePicker.module.scss.js.map +1 -0
  72. package/dist/react/components/DatePicker/index.cjs +1 -0
  73. package/dist/react/components/DatePicker/index.d.cts +5 -0
  74. package/dist/react/components/DatePicker/index.d.ts +5 -0
  75. package/dist/react/components/DatePicker/index.js +3 -0
  76. package/dist/react/components/DatePicker/types.d.cts +97 -0
  77. package/dist/react/components/DatePicker/types.d.ts +97 -0
  78. package/dist/react/components/Tooltip/Tooltip.cjs +1 -1
  79. package/dist/react/components/Tooltip/Tooltip.cjs.map +1 -1
  80. package/dist/react/components/Tooltip/Tooltip.js +5 -5
  81. package/dist/react/components/Tooltip/Tooltip.js.map +1 -1
  82. package/dist/react/components/index.cjs +1 -1
  83. package/dist/react/components/index.d.cts +1 -0
  84. package/dist/react/components/index.d.ts +1 -0
  85. package/dist/react/components/index.js +3 -1
  86. package/dist/react/index.cjs +1 -1
  87. package/dist/react/index.js +7 -6
  88. package/dist/react/style.css +1 -0
  89. package/dist/react/styles/date-picker.css +7 -0
  90. package/dist/taro/date-picker.d.ts +20 -0
  91. package/dist/taro/index.d.ts +1 -0
  92. package/dist/taro/index.js +1155 -990
  93. package/dist/uni/DatePicker.vue +225 -0
  94. package/dist/uni/DatePicker.vue.d.ts +36 -0
  95. package/dist/uni/MonthCalendar.vue +2 -0
  96. package/dist/uni/MonthCalendar.vue.d.ts +2 -0
  97. package/dist/uni/index.d.ts +1 -0
  98. package/dist/uni/index.js +1 -0
  99. package/dist/uni/manifest.d.ts +7 -0
  100. package/dist/uni/manifest.js +8 -0
  101. package/dist/vue/components/DatePicker/DatePicker.vue.d.ts +36 -0
  102. package/dist/vue/components/DatePicker/DatePicker.vue.js +7 -0
  103. package/dist/vue/components/DatePicker/DatePicker.vue.js.map +1 -0
  104. package/dist/vue/components/DatePicker/DatePicker.vue_vue_type_script_setup_true_lang.js +380 -0
  105. package/dist/vue/components/DatePicker/DatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
  106. package/dist/vue/components/DatePicker/index.d.ts +2 -0
  107. package/dist/vue/components/DatePicker/index.js +2 -0
  108. package/dist/vue/components/DatePicker/types.d.ts +26 -0
  109. package/dist/vue/components/MonthCalendar/MonthCalendar.vue.d.ts +1 -1
  110. package/dist/vue/global.d.ts +108 -0
  111. package/dist/vue/groups/forms-pickers.d.ts +1 -0
  112. package/dist/vue/groups/forms-pickers.js +5 -2
  113. package/dist/vue/groups/forms-pickers.js.map +1 -1
  114. package/dist/vue/index.js +95 -94
  115. package/dist/weapp/controls.js +259 -76
  116. package/dist/weapp/date-picker/index.js +1 -0
  117. package/dist/weapp/date-picker/index.json +1 -0
  118. package/dist/weapp/date-picker/index.wxml +1 -0
  119. package/dist/weapp/date-picker/index.wxss +1 -0
  120. package/dist/weapp/types.d.ts +19 -0
  121. package/dist/web-components/cdn/minerva.js +461 -335
  122. package/dist/web-components/cdn/minerva.js.map +1 -1
  123. package/dist/web-components/components/date-picker/date-picker.d.ts +110 -0
  124. package/dist/web-components/components/date-picker/date-picker.js +378 -0
  125. package/dist/web-components/components/date-picker/date-picker.js.map +1 -0
  126. package/dist/web-components/elements/date-picker.d.ts +1 -0
  127. package/dist/web-components/elements/date-picker.js +8 -0
  128. package/dist/web-components/elements/date-picker.js.map +1 -0
  129. package/dist/web-components/html-custom-data.json +85 -0
  130. package/dist/web-components/index.d.ts +1 -0
  131. package/dist/web-components/index.js +8 -6
  132. package/dist/web-components/styles/DatePicker/datePicker.css.js +6 -0
  133. package/dist/web-components/styles/DatePicker/datePicker.css.js.map +1 -0
  134. package/dist/web-components/types/react.d.ts +12 -0
  135. package/dist/web-components/types/solid.d.ts +9 -0
  136. package/dist/web-components/types/svelte.d.ts +9 -0
  137. package/dist/web-components/types/vue.d.ts +10 -0
  138. package/package.json +9 -1
@@ -10,10 +10,10 @@ import { useOverlay as u } from "../../internal/useOverlay.js";
10
10
  import { useControllable as d } from "../../internal/useControllable.js";
11
11
  import { useMemo as f, useState as p } from "react";
12
12
  import { Pressable as m, Text as h, View as g } from "react-native";
13
- import { addDays as _, createSelectionMachine as v, dayKey as y, localDate as b, monthStart as x, sameMonth as S } from "../../../core/index.js";
14
- import { jsx as C, jsxs as w } from "react/jsx-runtime";
13
+ import { addDays as _, createSelectionMachine as v, dayKey as y, localDate as b, monthStart as x, sameMonth as ee } from "../../../core/index.js";
14
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
15
15
  //#region src/components/Calendar/Calendar.tsx
16
- var T = [
16
+ var te = [
17
17
  "sun",
18
18
  "mon",
19
19
  "tue",
@@ -21,136 +21,136 @@ var T = [
21
21
  "thu",
22
22
  "fri",
23
23
  "sat"
24
- ], E = {
24
+ ], w = {
25
25
  small: "control-height-sm",
26
26
  medium: "control-height-md",
27
27
  large: "control-height-lg"
28
- }, D = (e) => {
28
+ }, T = (e) => {
29
29
  let [t, n, r] = e.split("-").map(Number);
30
30
  return b(t, n - 1, r);
31
- }, O = (e) => {
31
+ }, E = (e) => {
32
32
  if (e !== void 0) return e === null ? [] : (Array.isArray(e) ? e : [e]).map(y);
33
33
  };
34
- function k(e) {
34
+ function D(e) {
35
35
  let t = e?.join("\0");
36
36
  return f(() => t === void 0 ? void 0 : t === "" ? [] : t.split("\0"), [t]);
37
37
  }
38
- function A(e) {
39
- return e.poppable ? /* @__PURE__ */ C(j, { ...e }) : /* @__PURE__ */ C(M, { ...e });
38
+ function O(e) {
39
+ return e.poppable ? /* @__PURE__ */ S(k, { ...e }) : /* @__PURE__ */ S(A, { ...e });
40
40
  }
41
- function j({ open: l, defaultOpen: f = !1, onOpenChange: p, title: _, confirmText: v, onConfirm: y, onChange: b, value: x, defaultValue: S = null, type: T = "single", ...E }) {
42
- let { tokens: D, fonts: O } = t(), { t: k } = e(), A = u({
41
+ function k({ open: l, defaultOpen: f = !1, onOpenChange: p, title: _, confirmText: v, onConfirm: y, onChange: b, value: x, defaultValue: ee = null, type: te = "single", ...w }) {
42
+ let { tokens: T, fonts: E } = t(), { t: D } = e(), O = u({
43
43
  open: l,
44
44
  defaultOpen: f,
45
45
  onOpenChange: p
46
- }), [j, ee] = d(x, S, b);
47
- if (A.state.phase === "closed") return null;
48
- let te = Array.isArray(j) ? j.length > 0 : j !== null, N = _ ?? k("calendar.title"), P = typeof N == "string" || typeof N == "number" ? String(N) : void 0;
49
- return /* @__PURE__ */ w(c, {
46
+ }), [k, ne] = d(x, ee, b);
47
+ if (O.state.phase === "closed") return null;
48
+ let re = Array.isArray(k) ? k.length > 0 : k !== null, j = _ ?? D("calendar.title"), M = typeof j == "string" || typeof j == "number" ? String(j) : void 0;
49
+ return /* @__PURE__ */ C(c, {
50
50
  component: "calendar",
51
- phase: A.state.phase,
52
- onAnimationEnd: A.onAnimationEnd,
53
- onRequestClose: A.close,
51
+ phase: O.state.phase,
52
+ onAnimationEnd: O.onAnimationEnd,
53
+ onRequestClose: O.close,
54
54
  placement: "bottom",
55
55
  panelProps: {
56
56
  role: "dialog",
57
- accessibilityLabel: P
57
+ accessibilityLabel: M
58
58
  },
59
59
  children: [
60
- /* @__PURE__ */ w(g, {
60
+ /* @__PURE__ */ C(g, {
61
61
  style: {
62
62
  flexDirection: "row",
63
63
  alignItems: "center",
64
64
  justifyContent: "center",
65
- paddingVertical: D.space[4],
66
- paddingHorizontal: D.space[12]
65
+ paddingVertical: T.space[4],
66
+ paddingHorizontal: T.space[12]
67
67
  },
68
68
  ...n("calendar", "header"),
69
- children: [P === void 0 ? N : /* @__PURE__ */ C(h, {
69
+ children: [M === void 0 ? j : /* @__PURE__ */ S(h, {
70
70
  accessibilityRole: "header",
71
- style: [i(D, "lg", O.sans), { fontWeight: a(D, "semibold") }],
71
+ style: [i(T, "lg", E.sans), { fontWeight: a(T, "semibold") }],
72
72
  ...n("calendar", "title"),
73
- children: P
74
- }), /* @__PURE__ */ C(m, {
73
+ children: M
74
+ }), /* @__PURE__ */ S(m, {
75
75
  accessibilityRole: "button",
76
- accessibilityLabel: k("modal.close"),
77
- hitSlop: r(D, 28, 28),
78
- onPress: () => A.close("close-button"),
76
+ accessibilityLabel: D("modal.close"),
77
+ hitSlop: r(T, 28, 28),
78
+ onPress: () => O.close("close-button"),
79
79
  style: ({ pressed: e }) => ({
80
80
  position: "absolute",
81
- right: D.space[4],
81
+ right: T.space[4],
82
82
  width: 28,
83
83
  height: 28,
84
84
  borderRadius: 14,
85
85
  alignItems: "center",
86
86
  justifyContent: "center",
87
- backgroundColor: e ? D.colors["surface-muted-color"] : "transparent"
87
+ backgroundColor: e ? T.colors["surface-muted-color"] : "transparent"
88
88
  }),
89
89
  ...n("calendar", "close"),
90
- children: /* @__PURE__ */ C(s, {
90
+ children: /* @__PURE__ */ S(s, {
91
91
  name: "close",
92
92
  size: 14,
93
- color: D.colors["text-muted-color"]
93
+ color: T.colors["text-muted-color"]
94
94
  })
95
95
  })]
96
96
  }),
97
- /* @__PURE__ */ C(M, {
98
- ...E,
99
- type: T,
100
- value: j,
101
- onChange: ee,
102
- style: [{ paddingHorizontal: D.space[2] }, E.style]
97
+ /* @__PURE__ */ S(A, {
98
+ ...w,
99
+ type: te,
100
+ value: k,
101
+ onChange: ne,
102
+ style: [{ paddingHorizontal: T.space[2] }, w.style]
103
103
  }),
104
- /* @__PURE__ */ C(g, {
104
+ /* @__PURE__ */ S(g, {
105
105
  style: {
106
- padding: D.space[4],
107
- paddingTop: D.space[2]
106
+ padding: T.space[4],
107
+ paddingTop: T.space[2]
108
108
  },
109
109
  ...n("calendar", "footer"),
110
- children: /* @__PURE__ */ C(o, {
110
+ children: /* @__PURE__ */ S(o, {
111
111
  fullWidth: !0,
112
- disabled: !te,
112
+ disabled: !re,
113
113
  onPress: () => {
114
- y?.(j), A.close("confirm");
114
+ y?.(k), O.close("confirm");
115
115
  },
116
- children: v ?? k("calendar.confirm")
116
+ children: v ?? D("calendar.confirm")
117
117
  })
118
118
  })
119
119
  ]
120
120
  });
121
121
  }
122
- function M({ type: o = "single", value: c, defaultValue: u = null, onChange: A, onSelect: j, month: M, defaultMonth: ee, onMonthChange: te, minDate: N, maxDate: P, disabledDate: ne, firstDayOfWeek: re = 0, size: F = "medium", disabled: I = !1, previousMonthLabel: ie, nextMonthLabel: ae, style: oe, accessibilityLabel: se, poppable: ce, open: le, defaultOpen: ue, onOpenChange: de, title: fe, confirmText: pe, onConfirm: me, ...he }) {
123
- let { tokens: L, fonts: ge } = t(), { t: R, language: z } = e(), [B] = p(() => {
122
+ function A({ type: o = "single", value: c, defaultValue: u = null, onChange: O, onSelect: k, month: A, defaultMonth: ne, onMonthChange: re, minDate: j, maxDate: M, disabledDate: ie, firstDayOfWeek: N = 0, locale: P, size: F = "medium", disabled: I = !1, previousMonthLabel: ae, nextMonthLabel: oe, style: se, accessibilityLabel: ce, poppable: le, open: ue, defaultOpen: de, onOpenChange: fe, title: pe, confirmText: me, onConfirm: he, ...ge }) {
123
+ let { tokens: L, fonts: _e } = t(), { t: R, language: z } = e(), [B] = p(() => {
124
124
  let e = /* @__PURE__ */ new Date();
125
125
  return b(e.getFullYear(), e.getMonth(), e.getDate());
126
- }), _e = y(B), V = N ? y(N) : void 0, ve = P ? y(P) : void 0, ye = (e) => {
126
+ }), ve = y(B), V = j ? y(j) : void 0, H = M ? y(M) : void 0, U = (e) => {
127
127
  let t = y(e);
128
- return V !== void 0 && t < V || ve !== void 0 && t > ve || !!ne?.(e);
129
- }, be = (e) => {
130
- let t = e.map(D);
128
+ return V !== void 0 && t < V || H !== void 0 && t > H || !!ie?.(e);
129
+ }, ye = (e) => {
130
+ let t = e.map(T);
131
131
  return o === "single" ? t[0] ?? null : o === "range" ? t.length === 2 ? [t[0], t[1]] : null : t;
132
- }, xe = k(O(c)), [Se, H] = l(v, {
132
+ }, be = D(E(c)), [xe, W] = l(v, {
133
133
  mode: o === "single" ? "single" : "multiple",
134
- value: xe,
135
- defaultValue: O(u) ?? [],
136
- isDisabled: (e) => ye(D(e)),
134
+ value: be,
135
+ defaultValue: E(u) ?? [],
136
+ isDisabled: (e) => U(T(e)),
137
137
  max: o === "range" ? 2 : void 0,
138
- onValueChange: (e) => A?.(be(e))
139
- }), [U, Ce] = p(null), W = Se.value, G = o === "range" ? U === null ? W.length === 2 ? [W[0], W[1]] : null : [U, U] : null, we = W[0] ? D(W[0]) : void 0, [Te, Ee] = d(M, ee ?? we ?? (N && N > B ? N : B), te), K = x(Te), De = !I && (!N || K > x(N)), Oe = !I && (!P || x(K, 1) <= P), ke = (e) => {
138
+ onValueChange: (e) => O?.(ye(e))
139
+ }), [G, Se] = p(null), K = xe.value, q = o === "range" ? G === null ? K.length === 2 ? [K[0], K[1]] : null : [G, G] : null, Ce = K[0] ? T(K[0]) : void 0, [we, Te] = d(A, ne ?? Ce ?? (j && j > B ? j : B), re), J = x(we), Ee = !I && (!j || J > x(j)), De = !I && (!M || x(J, 1) <= M), Oe = (e) => {
140
140
  let t = y(e);
141
- j?.(e), o === "single" ? H({
141
+ k?.(e), o === "single" ? W({
142
142
  type: "SELECT",
143
143
  value: t
144
- }) : o === "multiple" ? H({
144
+ }) : o === "multiple" ? W({
145
145
  type: "TOGGLE",
146
146
  value: t
147
- }) : U === null || t < U ? Ce(t) : (Ce(null), H({
147
+ }) : G === null || t < G ? Se(t) : (Se(null), W({
148
148
  type: "SET",
149
- value: [U, t]
150
- })), S(e, K) || Ee(x(e));
151
- }, Ae = f(() => {
149
+ value: [G, t]
150
+ })), ee(e, J) || Te(x(e));
151
+ }, ke = f(() => {
152
152
  try {
153
- let e = new Intl.DateTimeFormat(z, {
153
+ let e = new Intl.DateTimeFormat(P ?? z, {
154
154
  weekday: "long",
155
155
  year: "numeric",
156
156
  month: "long",
@@ -160,19 +160,19 @@ function M({ type: o = "single", value: c, defaultValue: u = null, onChange: A,
160
160
  } catch {
161
161
  return (e) => e.toDateString();
162
162
  }
163
- }, [z]), je = (K.getDay() - re + 7) % 7, Me = b(K.getFullYear(), K.getMonth() + 1, 0).getDate(), q = [...Array.from({ length: je }, () => null), ...Array.from({ length: Me }, (e, t) => _(K, t))];
164
- for (; q.length % 7;) q.push(null);
165
- let J = [];
166
- for (let e = 0; e < q.length; e += 7) J.push(q.slice(e, e + 7));
167
- let Y = L.sizes[E[F]], X = Math.min(Y - L.space[1], 44), Z = L.colors["primary-color"], Q = ge.sans, $ = (e) => {
168
- let t = e < 0 ? De : Oe, i = e < 0 ? ie ?? R("monthCalendar.previousMonth") : ae ?? R("monthCalendar.nextMonth");
169
- return /* @__PURE__ */ C(m, {
163
+ }, [z, P]), Ae = (J.getDay() - N + 7) % 7, je = b(J.getFullYear(), J.getMonth() + 1, 0).getDate(), Y = [...Array.from({ length: Ae }, () => null), ...Array.from({ length: je }, (e, t) => _(J, t))];
164
+ for (; Y.length % 7;) Y.push(null);
165
+ let Me = [];
166
+ for (let e = 0; e < Y.length; e += 7) Me.push(Y.slice(e, e + 7));
167
+ let X = L.sizes[w[F]], Z = Math.min(X - L.space[1], 44), Q = L.colors["primary-color"], $ = _e.sans, Ne = (e) => {
168
+ let t = e < 0 ? Ee : De, i = e < 0 ? ae ?? R("monthCalendar.previousMonth") : oe ?? R("monthCalendar.nextMonth");
169
+ return /* @__PURE__ */ S(m, {
170
170
  accessibilityRole: "button",
171
171
  accessibilityLabel: i,
172
172
  accessibilityState: { disabled: !t },
173
173
  disabled: !t,
174
174
  hitSlop: r(L, 32, 32),
175
- onPress: () => Ee(x(K, e)),
175
+ onPress: () => Te(x(J, e)),
176
176
  style: ({ pressed: e }) => ({
177
177
  width: 32,
178
178
  height: 32,
@@ -183,19 +183,19 @@ function M({ type: o = "single", value: c, defaultValue: u = null, onChange: A,
183
183
  backgroundColor: e ? L.colors["surface-muted-color"] : "transparent"
184
184
  }),
185
185
  ...n("calendar", e < 0 ? "prev" : "next"),
186
- children: /* @__PURE__ */ C(s, {
186
+ children: /* @__PURE__ */ S(s, {
187
187
  name: e < 0 ? "chevron-left" : "chevron-right",
188
188
  size: 16,
189
189
  color: L.colors["text-secondary-color"]
190
190
  })
191
191
  });
192
- }, Ne = (e) => {
193
- let t = y(e), r = I || ye(e), o = t === _e, s = G?.[0] === t, c = G?.[1] === t && U === null, l = !!G && t > G[0] && t < G[1], u = G ? s || c : W.includes(t), d = u || l, f = G?.[0] === G?.[1], p = [
192
+ }, Pe = (e) => {
193
+ let t = y(e), r = I || U(e), o = t === ve, s = q?.[0] === t, c = q?.[1] === t && G === null, l = !!q && t > q[0] && t < q[1], u = q ? s || c : K.includes(t), d = u || l, f = q?.[0] === q?.[1], p = [
194
194
  o ? R("monthCalendar.today") : void 0,
195
195
  s ? R("calendar.rangeStart") : void 0,
196
196
  c ? R("calendar.rangeEnd") : void 0
197
- ].filter(Boolean), _ = [Ae(e), ...p].join(", "), v = r ? L.colors["text-disabled-color"] : u ? L.colors["text-inverse-color"] : l ? L.colors["primary-color-text"] : o ? Z : L.colors["text-color"], b = L.colors["primary-color-subtle"];
198
- return /* @__PURE__ */ w(m, {
197
+ ].filter(Boolean), _ = [ke(e), ...p].join(", "), v = r ? L.colors["text-disabled-color"] : u ? L.colors["text-inverse-color"] : l ? L.colors["primary-color-text"] : o ? Q : L.colors["text-color"], b = L.colors["primary-color-subtle"];
198
+ return /* @__PURE__ */ C(m, {
199
199
  accessibilityRole: "button",
200
200
  accessibilityLabel: _,
201
201
  accessibilityState: {
@@ -204,10 +204,10 @@ function M({ type: o = "single", value: c, defaultValue: u = null, onChange: A,
204
204
  },
205
205
  "aria-selected": d,
206
206
  disabled: r,
207
- onPress: () => ke(e),
207
+ onPress: () => Oe(e),
208
208
  style: {
209
209
  flex: 1,
210
- height: Y,
210
+ height: X,
211
211
  alignItems: "center",
212
212
  justifyContent: "center",
213
213
  backgroundColor: l ? b : "transparent"
@@ -216,60 +216,60 @@ function M({ type: o = "single", value: c, defaultValue: u = null, onChange: A,
216
216
  selected: d,
217
217
  today: o,
218
218
  disabled: r,
219
- "range-start": s && !!G,
219
+ "range-start": s && !!q,
220
220
  "range-end": c,
221
221
  "range-middle": l
222
222
  }),
223
- children: [G && !f && (s || c) && /* @__PURE__ */ C(g, { style: {
223
+ children: [q && !f && (s || c) && /* @__PURE__ */ S(g, { style: {
224
224
  position: "absolute",
225
225
  top: 0,
226
226
  bottom: 0,
227
227
  left: s ? "50%" : 0,
228
228
  right: c ? "50%" : 0,
229
229
  backgroundColor: b
230
- } }), /* @__PURE__ */ w(g, {
230
+ } }), /* @__PURE__ */ C(g, {
231
231
  style: {
232
- width: X,
233
- height: X,
234
- borderRadius: X / 2,
232
+ width: Z,
233
+ height: Z,
234
+ borderRadius: Z / 2,
235
235
  alignItems: "center",
236
236
  justifyContent: "center",
237
- backgroundColor: u && !r ? Z : "transparent",
237
+ backgroundColor: u && !r ? Q : "transparent",
238
238
  borderWidth: o && !u ? 1 : 0,
239
- borderColor: Z
239
+ borderColor: Q
240
240
  },
241
- children: [/* @__PURE__ */ C(h, {
241
+ children: [/* @__PURE__ */ S(h, {
242
242
  allowFontScaling: !1,
243
- style: [i(L, F === "small" ? "sm" : "md", Q), {
243
+ style: [i(L, F === "small" ? "sm" : "md", $), {
244
244
  color: v,
245
245
  fontWeight: a(L, u || o ? "semibold" : "regular")
246
246
  }],
247
247
  children: e.getDate()
248
- }), (s || c) && !f && F !== "small" && /* @__PURE__ */ C(h, {
248
+ }), (s || c) && !f && F !== "small" && /* @__PURE__ */ S(h, {
249
249
  allowFontScaling: !1,
250
250
  style: {
251
251
  position: "absolute",
252
252
  bottom: -L.space["0-5"],
253
253
  fontSize: L.fontSize.xs - 3,
254
254
  color: L.colors["text-inverse-color"],
255
- ...Q ? { fontFamily: Q } : null
255
+ ...$ ? { fontFamily: $ } : null
256
256
  },
257
257
  children: R(s ? "calendar.rangeStart" : "calendar.rangeEnd")
258
258
  })]
259
259
  })]
260
260
  }, t);
261
261
  };
262
- return /* @__PURE__ */ w(g, {
262
+ return /* @__PURE__ */ C(g, {
263
263
  role: "group",
264
- accessibilityLabel: se ?? R("monthCalendar.label"),
264
+ accessibilityLabel: ce ?? R("monthCalendar.label"),
265
265
  ...n("calendar", "root", {
266
266
  type: o,
267
267
  disabled: I
268
268
  }),
269
- ...he,
270
- style: [{ backgroundColor: L.colors["surface-color"] }, oe],
269
+ ...ge,
270
+ style: [{ backgroundColor: L.colors["surface-color"] }, se],
271
271
  children: [
272
- /* @__PURE__ */ w(g, {
272
+ /* @__PURE__ */ C(g, {
273
273
  style: {
274
274
  flexDirection: "row",
275
275
  alignItems: "center",
@@ -278,21 +278,24 @@ function M({ type: o = "single", value: c, defaultValue: u = null, onChange: A,
278
278
  paddingVertical: L.space[2]
279
279
  },
280
280
  children: [
281
- $(-1),
282
- /* @__PURE__ */ C(h, {
281
+ Ne(-1),
282
+ /* @__PURE__ */ S(h, {
283
283
  accessibilityRole: "header",
284
284
  accessibilityLiveRegion: "polite",
285
- style: [i(L, "lg", Q), { fontWeight: a(L, "semibold") }],
285
+ style: [i(L, "lg", $), { fontWeight: a(L, "semibold") }],
286
286
  ...n("calendar", "month-title"),
287
- children: R("calendar.monthTitle", {
288
- year: K.getFullYear(),
289
- month: K.getMonth() + 1
287
+ children: P ? new Intl.DateTimeFormat(P, {
288
+ year: "numeric",
289
+ month: "long"
290
+ }).format(J) : R("calendar.monthTitle", {
291
+ year: J.getFullYear(),
292
+ month: J.getMonth() + 1
290
293
  })
291
294
  }),
292
- $(1)
295
+ Ne(1)
293
296
  ]
294
297
  }),
295
- /* @__PURE__ */ C(g, {
298
+ /* @__PURE__ */ S(g, {
296
299
  importantForAccessibility: "no-hide-descendants",
297
300
  accessibilityElementsHidden: !0,
298
301
  style: {
@@ -301,9 +304,9 @@ function M({ type: o = "single", value: c, defaultValue: u = null, onChange: A,
301
304
  },
302
305
  ...n("calendar", "weekdays"),
303
306
  children: Array.from({ length: 7 }, (e, t) => {
304
- let n = T[(re + t) % 7];
305
- return /* @__PURE__ */ C(h, {
306
- style: [i(L, "xs", Q), {
307
+ let n = te[(N + t) % 7];
308
+ return /* @__PURE__ */ S(h, {
309
+ style: [i(L, "xs", $), {
307
310
  flex: 1,
308
311
  textAlign: "center",
309
312
  color: L.colors["text-muted-color"]
@@ -312,21 +315,21 @@ function M({ type: o = "single", value: c, defaultValue: u = null, onChange: A,
312
315
  }, n);
313
316
  })
314
317
  }),
315
- J.map((e, t) => /* @__PURE__ */ C(g, {
318
+ Me.map((e, t) => /* @__PURE__ */ S(g, {
316
319
  style: {
317
320
  flexDirection: "row",
318
321
  marginBottom: L.space["0-5"]
319
322
  },
320
323
  ...n("calendar", "week"),
321
- children: e.map((e, t) => e ? Ne(e) : /* @__PURE__ */ C(g, { style: {
324
+ children: e.map((e, t) => e ? Pe(e) : /* @__PURE__ */ S(g, { style: {
322
325
  flex: 1,
323
- height: Y
326
+ height: X
324
327
  } }, `empty-${t}`))
325
328
  }, t))
326
329
  ]
327
330
  });
328
331
  }
329
332
  //#endregion
330
- export { A as Calendar };
333
+ export { O as Calendar };
331
334
 
332
335
  //# sourceMappingURL=Calendar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.js","names":["WEEKDAYS","CELL_HEIGHT","parseKey","y","m","d","key","localDate","keysOf","value","dayKey","useStableKeys","joined","keys","useMemo","Calendar","props","PoppableCalendar","CalendarView","rest","t","useTheme","translate","useI18n","overlay","useOverlay","current","setCurrent","useControllable","defaultValue","onChange","ready","titleNode","title","titleText","Overlay","View","part","Text","textStyle","fonts","weight","Pressable","hitSlopFor","pressed","Icon","Button","onConfirm","confirmText","_poppable","_open","_defaultOpen","_onOpenChange","_title","_confirmText","_onConfirm","today","useState","now","todayKey","minKey","minDate","maxKey","maxDate","isDisabled","date","disabledDate","toValue","dates","type","controlledKeys","state","send","useMachine","createSelectionMachine","pendingStart","setPendingStart","selected","rangeKeys","firstSelected","shownMonth","setShownMonth","month","defaultMonth","onMonthChange","first","monthStart","canPrev","disabled","canNext","press","onSelect","sameMonth","fullDate","format","language","lead","firstDayOfWeek","daysInMonth","cells","addDays","i","weeks","cellHeight","size","dot","primary","sans","navButton","enabled","direction","label","previousMonthLabel","nextMonthLabel","renderDay","off","isToday","start","end","middle","filled","isSelected","singleDayRange","suffixes","textColor","band","accessibilityLabel","style","name","week","col","row"],"sources":["../../../../../native/src/components/Calendar/Calendar.tsx"],"sourcesContent":["import { useMemo, useState, type ReactNode } from \"react\";\nimport {\n Pressable,\n Text,\n View,\n type StyleProp,\n type ViewProps,\n type ViewStyle,\n} from \"react-native\";\nimport {\n addDays,\n createSelectionMachine,\n dayKey,\n localDate,\n monthStart,\n sameMonth,\n} from \"@minerva/core\";\nimport { useI18n, useTheme } from \"../../theme/MinervaProvider\";\nimport { Icon } from \"../../internal/Icon\";\nimport { Overlay, type OverlayCloseReason } from \"../../internal/Overlay\";\nimport { part } from \"../../internal/parts\";\nimport { hitSlopFor, textStyle, weight } from \"../../internal/styles\";\nimport { useControllable } from \"../../internal/useControllable\";\nimport { useMachine } from \"../../internal/useMachine\";\nimport { useOverlay } from \"../../internal/useOverlay\";\nimport { Button } from \"../Button\";\n\n/** Selection type of `Calendar` */\nexport type CalendarType = \"single\" | \"multiple\" | \"range\";\n\n/**\n * Value of `Calendar`: a day (`single`, `null`: none), days (`multiple`) or\n * a `[start, end]` range (`range`); every date is local midnight\n */\nexport type CalendarValue = Date | Date[] | [Date, Date] | null;\n\n/** Why a poppable calendar closed */\nexport type CalendarCloseReason = OverlayCloseReason;\n\nexport interface CalendarProps extends Omit<ViewProps, \"style\" | \"children\"> {\n /**\n * Selection type: one day, several days, or a range\n * @default \"single\"\n */\n type?: CalendarType;\n /**\n * Selected day(s) (controlled; pair with `onChange`): a `Date` (`single`),\n * `Date[]` (`multiple`) or `[start, end]` (`range`)\n */\n value?: CalendarValue;\n /** Initially selected day(s) (uncontrolled) @default null */\n defaultValue?: CalendarValue;\n /**\n * Called with the new selection (a range once both ends are picked)\n */\n onChange?: (value: CalendarValue) => void;\n /** Called with every pressed day */\n onSelect?: (date: Date) => void;\n /** Displayed month (controlled; any day of the month; pair with `onMonthChange`) */\n month?: Date;\n /**\n * Initially displayed month (uncontrolled)\n * @default the month of the first selected day, else of today\n */\n defaultMonth?: Date;\n /** Called with the first day of the month navigated to */\n onMonthChange?: (month: Date) => void;\n /** Earliest selectable day (earlier days are disabled) */\n minDate?: Date;\n /** Latest selectable day (later days are disabled) */\n maxDate?: Date;\n /** Extra disabled days */\n disabledDate?: (date: Date) => boolean;\n /**\n * First column of the week (0: Sunday ... 6: Saturday)\n * @default 0\n */\n firstDayOfWeek?: number;\n /**\n * Cell density: compact (\"small\"), default (\"medium\") or comfortable\n * (\"large\")\n * @default \"medium\"\n */\n size?: \"small\" | \"medium\" | \"large\";\n /**\n * Blocks navigation and selection\n * @default false\n */\n disabled?: boolean;\n /** Label of the previous-month button @default the \"monthCalendar.previousMonth\" message */\n previousMonthLabel?: string;\n /** Label of the next-month button @default the \"monthCalendar.nextMonth\" message */\n nextMonthLabel?: string;\n /**\n * Renders the calendar in a bottom sheet with a title and a confirm\n * button (`open` / `defaultOpen` / `onOpenChange`)\n * @default false\n */\n poppable?: boolean;\n /** Controlled open state of the poppable sheet */\n open?: boolean;\n /**\n * Initial open state of the poppable sheet while uncontrolled\n * @default false\n */\n defaultOpen?: boolean;\n /** Called with the requested open state of the sheet and the close reason */\n onOpenChange?: (open: boolean, reason?: CalendarCloseReason) => void;\n /** Title of the poppable sheet @default the \"calendar.title\" message */\n title?: ReactNode;\n /** Text of the confirm button @default the \"calendar.confirm\" message */\n confirmText?: ReactNode;\n /** Called by the confirm button of the poppable sheet with the selection */\n onConfirm?: (value: CalendarValue) => void;\n /** Style of the calendar */\n style?: StyleProp<ViewStyle>;\n}\n\nconst WEEKDAYS = [\"sun\", \"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\"] as const;\nconst CELL_HEIGHT = {\n small: \"control-height-sm\",\n medium: \"control-height-md\",\n large: \"control-height-lg\",\n} as const;\n\nconst parseKey = (key: string) => {\n const [y, m, d] = key.split(\"-\").map(Number);\n return localDate(y, m - 1, d);\n};\n\n/** The selected day keys of a value */\nconst keysOf = (value: CalendarValue | undefined): string[] | undefined => {\n if (value === undefined) return undefined;\n if (value === null) return [];\n return (Array.isArray(value) ? value : [value]).map(dayKey);\n};\n\n/** The same array while its items are unchanged (controlled values) */\nfunction useStableKeys(keys: readonly string[] | undefined) {\n const joined = keys?.join(\"\\u0000\");\n return useMemo(\n () =>\n joined === undefined\n ? undefined\n : joined === \"\"\n ? []\n : joined.split(\"\\u0000\"),\n [joined],\n );\n}\n\n/**\n * A month calendar for picking a day, several days or a range: weekday\n * header, month navigation, min / max dates, today ring, selected fills\n * and range tint. Inline, or in a bottom sheet with a confirm button\n * (`poppable`). Single and multiple selections run on the selection\n * machine of @minerva/core.\n */\nexport function Calendar(props: CalendarProps) {\n if (!props.poppable) return <CalendarView {...props} />;\n return <PoppableCalendar {...props} />;\n}\n\nfunction PoppableCalendar({\n open,\n defaultOpen = false,\n onOpenChange,\n title,\n confirmText,\n onConfirm,\n onChange,\n value,\n defaultValue = null,\n type = \"single\",\n ...rest\n}: CalendarProps) {\n const { tokens: t, fonts } = useTheme();\n const { t: translate } = useI18n();\n const overlay = useOverlay({ open, defaultOpen, onOpenChange });\n // the sheet keeps the selection to confirm\n const [current, setCurrent] = useControllable<CalendarValue>(\n value,\n defaultValue,\n onChange,\n );\n if (overlay.state.phase === \"closed\") return null;\n const ready = Array.isArray(current) ? current.length > 0 : current !== null;\n const titleNode = title ?? translate(\"calendar.title\");\n const titleText =\n typeof titleNode === \"string\" || typeof titleNode === \"number\"\n ? String(titleNode)\n : undefined;\n const closeSize = 28;\n\n return (\n <Overlay\n component=\"calendar\"\n phase={overlay.state.phase}\n onAnimationEnd={overlay.onAnimationEnd}\n onRequestClose={overlay.close}\n placement=\"bottom\"\n panelProps={{ role: \"dialog\", accessibilityLabel: titleText }}\n >\n <View\n style={{\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n paddingVertical: t.space[\"4\"],\n paddingHorizontal: t.space[\"12\"],\n }}\n {...part(\"calendar\", \"header\")}\n >\n {titleText !== undefined ? (\n <Text\n accessibilityRole=\"header\"\n style={[\n textStyle(t, \"lg\", fonts.sans),\n { fontWeight: weight(t, \"semibold\") },\n ]}\n {...part(\"calendar\", \"title\")}\n >\n {titleText}\n </Text>\n ) : (\n titleNode\n )}\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={translate(\"modal.close\")}\n hitSlop={hitSlopFor(t, closeSize, closeSize)}\n onPress={() => overlay.close(\"close-button\")}\n style={({ pressed }) => ({\n position: \"absolute\",\n right: t.space[\"4\"],\n width: closeSize,\n height: closeSize,\n borderRadius: closeSize / 2,\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: pressed\n ? t.colors[\"surface-muted-color\"]\n : \"transparent\",\n })}\n {...part(\"calendar\", \"close\")}\n >\n <Icon name=\"close\" size={14} color={t.colors[\"text-muted-color\"]} />\n </Pressable>\n </View>\n <CalendarView\n {...rest}\n type={type}\n value={current}\n onChange={setCurrent}\n style={[{ paddingHorizontal: t.space[\"2\"] }, rest.style]}\n />\n <View\n style={{ padding: t.space[\"4\"], paddingTop: t.space[\"2\"] }}\n {...part(\"calendar\", \"footer\")}\n >\n <Button\n fullWidth\n disabled={!ready}\n onPress={() => {\n onConfirm?.(current);\n overlay.close(\"confirm\");\n }}\n >\n {confirmText ?? translate(\"calendar.confirm\")}\n </Button>\n </View>\n </Overlay>\n );\n}\n\nfunction CalendarView({\n type = \"single\",\n value,\n defaultValue = null,\n onChange,\n onSelect,\n month,\n defaultMonth,\n onMonthChange,\n minDate,\n maxDate,\n disabledDate,\n firstDayOfWeek = 0,\n size = \"medium\",\n disabled = false,\n previousMonthLabel,\n nextMonthLabel,\n style,\n accessibilityLabel,\n // poppable-only props, unused inline\n poppable: _poppable,\n open: _open,\n defaultOpen: _defaultOpen,\n onOpenChange: _onOpenChange,\n title: _title,\n confirmText: _confirmText,\n onConfirm: _onConfirm,\n ...rest\n}: CalendarProps) {\n const { tokens: t, fonts } = useTheme();\n const { t: translate, language } = useI18n();\n const [today] = useState(() => {\n const now = new Date();\n return localDate(now.getFullYear(), now.getMonth(), now.getDate());\n });\n const todayKey = dayKey(today);\n const minKey = minDate ? dayKey(minDate) : undefined;\n const maxKey = maxDate ? dayKey(maxDate) : undefined;\n const isDisabled = (date: Date) => {\n const key = dayKey(date);\n return (\n (minKey !== undefined && key < minKey) ||\n (maxKey !== undefined && key > maxKey) ||\n !!disabledDate?.(date)\n );\n };\n\n const toValue = (keys: readonly string[]): CalendarValue => {\n const dates = keys.map(parseKey);\n if (type === \"single\") return dates[0] ?? null;\n if (type === \"range\") {\n return dates.length === 2 ? [dates[0], dates[1]] : null;\n }\n return dates;\n };\n const controlledKeys = useStableKeys(keysOf(value));\n const [state, send] = useMachine(createSelectionMachine<string>, {\n mode: type === \"single\" ? (\"single\" as const) : (\"multiple\" as const),\n value: controlledKeys,\n defaultValue: keysOf(defaultValue) ?? [],\n isDisabled: (key: string) => isDisabled(parseKey(key)),\n max: type === \"range\" ? 2 : undefined,\n onValueChange: (keys: string[]) => onChange?.(toValue(keys)),\n });\n // range: the first end picked, waiting for the second\n const [pendingStart, setPendingStart] = useState<string | null>(null);\n\n const selected = state.value;\n const rangeKeys: [string, string] | null =\n type === \"range\"\n ? pendingStart !== null\n ? [pendingStart, pendingStart]\n : selected.length === 2\n ? [selected[0], selected[1]]\n : null\n : null;\n\n const firstSelected = selected[0] ? parseKey(selected[0]) : undefined;\n const [shownMonth, setShownMonth] = useControllable<Date>(\n month,\n defaultMonth ??\n firstSelected ??\n (minDate && minDate > today ? minDate : today),\n onMonthChange,\n );\n const first = monthStart(shownMonth);\n const canPrev = !disabled && (!minDate || first > monthStart(minDate));\n const canNext = !disabled && (!maxDate || monthStart(first, 1) <= maxDate);\n\n const press = (date: Date) => {\n const key = dayKey(date);\n onSelect?.(date);\n if (type === \"single\") {\n send({ type: \"SELECT\", value: key });\n } else if (type === \"multiple\") {\n send({ type: \"TOGGLE\", value: key });\n } else if (pendingStart === null || key < pendingStart) {\n setPendingStart(key);\n } else {\n setPendingStart(null);\n send({ type: \"SET\", value: [pendingStart, key] });\n }\n if (!sameMonth(date, first)) setShownMonth(monthStart(date));\n };\n\n const fullDate = useMemo(() => {\n try {\n const format = new Intl.DateTimeFormat(language, {\n weekday: \"long\",\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n });\n return (date: Date) => format.format(date);\n } catch {\n return (date: Date) => date.toDateString();\n }\n }, [language]);\n\n const lead = (first.getDay() - firstDayOfWeek + 7) % 7;\n const daysInMonth = localDate(\n first.getFullYear(),\n first.getMonth() + 1,\n 0,\n ).getDate();\n const cells: (Date | null)[] = [\n ...Array.from({ length: lead }, () => null),\n ...Array.from({ length: daysInMonth }, (_, i) => addDays(first, i)),\n ];\n while (cells.length % 7) cells.push(null);\n const weeks: (Date | null)[][] = [];\n for (let i = 0; i < cells.length; i += 7) weeks.push(cells.slice(i, i + 7));\n\n const cellHeight = t.sizes[CELL_HEIGHT[size]];\n const dot = Math.min(cellHeight - t.space[\"1\"], 44);\n const primary = t.colors[\"primary-color\"];\n const sans = fonts.sans;\n const navSize = 32;\n\n const navButton = (direction: -1 | 1) => {\n const enabled = direction < 0 ? canPrev : canNext;\n const label =\n direction < 0\n ? (previousMonthLabel ?? translate(\"monthCalendar.previousMonth\"))\n : (nextMonthLabel ?? translate(\"monthCalendar.nextMonth\"));\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n accessibilityState={{ disabled: !enabled }}\n disabled={!enabled}\n hitSlop={hitSlopFor(t, navSize, navSize)}\n onPress={() => setShownMonth(monthStart(first, direction))}\n style={({ pressed }) => ({\n width: navSize,\n height: navSize,\n borderRadius: navSize / 2,\n alignItems: \"center\",\n justifyContent: \"center\",\n opacity: enabled ? 1 : 0.35,\n backgroundColor: pressed\n ? t.colors[\"surface-muted-color\"]\n : \"transparent\",\n })}\n {...part(\"calendar\", direction < 0 ? \"prev\" : \"next\")}\n >\n <Icon\n name={direction < 0 ? \"chevron-left\" : \"chevron-right\"}\n size={16}\n color={t.colors[\"text-secondary-color\"]}\n />\n </Pressable>\n );\n };\n\n const renderDay = (date: Date) => {\n const key = dayKey(date);\n const off = disabled || isDisabled(date);\n const isToday = key === todayKey;\n const start = rangeKeys?.[0] === key;\n const end = rangeKeys?.[1] === key && pendingStart === null;\n const middle = !!rangeKeys && key > rangeKeys[0] && key < rangeKeys[1];\n const filled = rangeKeys ? start || end : selected.includes(key);\n const isSelected = filled || middle;\n const singleDayRange = rangeKeys?.[0] === rangeKeys?.[1];\n const suffixes = [\n isToday ? translate(\"monthCalendar.today\") : undefined,\n start ? translate(\"calendar.rangeStart\") : undefined,\n end ? translate(\"calendar.rangeEnd\") : undefined,\n ].filter(Boolean);\n const label = [fullDate(date), ...suffixes].join(\", \");\n const textColor = off\n ? t.colors[\"text-disabled-color\"]\n : filled\n ? t.colors[\"text-inverse-color\"]\n : middle\n ? t.colors[\"primary-color-text\"]\n : isToday\n ? primary\n : t.colors[\"text-color\"];\n const band = t.colors[\"primary-color-subtle\"];\n\n return (\n <Pressable\n key={key}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n accessibilityState={{ selected: isSelected, disabled: off }}\n aria-selected={isSelected}\n disabled={off}\n onPress={() => press(date)}\n style={{\n flex: 1,\n height: cellHeight,\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: middle ? band : \"transparent\",\n }}\n {...part(\"calendar\", \"day\", {\n selected: isSelected,\n today: isToday,\n disabled: off,\n \"range-start\": start && !!rangeKeys,\n \"range-end\": end,\n \"range-middle\": middle,\n })}\n >\n {rangeKeys && !singleDayRange && (start || end) && (\n <View\n style={{\n position: \"absolute\",\n top: 0,\n bottom: 0,\n left: start ? \"50%\" : 0,\n right: end ? \"50%\" : 0,\n backgroundColor: band,\n }}\n />\n )}\n <View\n style={{\n width: dot,\n height: dot,\n borderRadius: dot / 2,\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: filled && !off ? primary : \"transparent\",\n borderWidth: isToday && !filled ? 1 : 0,\n borderColor: primary,\n }}\n >\n <Text\n allowFontScaling={false}\n style={[\n textStyle(t, size === \"small\" ? \"sm\" : \"md\", sans),\n {\n color: textColor,\n fontWeight: weight(\n t,\n filled || isToday ? \"semibold\" : \"regular\",\n ),\n },\n ]}\n >\n {date.getDate()}\n </Text>\n {(start || end) && !singleDayRange && size !== \"small\" && (\n <Text\n allowFontScaling={false}\n style={{\n position: \"absolute\",\n bottom: -t.space[\"0-5\"],\n fontSize: t.fontSize.xs - 3,\n color: t.colors[\"text-inverse-color\"],\n ...(sans ? { fontFamily: sans } : null),\n }}\n >\n {translate(start ? \"calendar.rangeStart\" : \"calendar.rangeEnd\")}\n </Text>\n )}\n </View>\n </Pressable>\n );\n };\n\n return (\n <View\n role=\"group\"\n accessibilityLabel={\n accessibilityLabel ?? translate(\"monthCalendar.label\")\n }\n {...part(\"calendar\", \"root\", { type, disabled })}\n {...rest}\n style={[{ backgroundColor: t.colors[\"surface-color\"] }, style]}\n >\n <View\n style={{\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n paddingHorizontal: t.space[\"2\"],\n paddingVertical: t.space[\"2\"],\n }}\n >\n {navButton(-1)}\n <Text\n accessibilityRole=\"header\"\n accessibilityLiveRegion=\"polite\"\n style={[\n textStyle(t, \"lg\", sans),\n { fontWeight: weight(t, \"semibold\") },\n ]}\n {...part(\"calendar\", \"month-title\")}\n >\n {translate(\"calendar.monthTitle\", {\n year: first.getFullYear(),\n month: first.getMonth() + 1,\n })}\n </Text>\n {navButton(1)}\n </View>\n <View\n importantForAccessibility=\"no-hide-descendants\"\n accessibilityElementsHidden\n style={{ flexDirection: \"row\", paddingVertical: t.space[\"1\"] }}\n {...part(\"calendar\", \"weekdays\")}\n >\n {Array.from({ length: 7 }, (_, i) => {\n const name = WEEKDAYS[(firstDayOfWeek + i) % 7];\n return (\n <Text\n key={name}\n style={[\n textStyle(t, \"xs\", sans),\n {\n flex: 1,\n textAlign: \"center\",\n color: t.colors[\"text-muted-color\"],\n },\n ]}\n >\n {translate(`monthCalendar.weekdays.${name}`)}\n </Text>\n );\n })}\n </View>\n {weeks.map((week, row) => (\n <View\n key={row}\n style={{ flexDirection: \"row\", marginBottom: t.space[\"0-5\"] }}\n {...part(\"calendar\", \"week\")}\n >\n {week.map((date, col) =>\n date ? (\n renderDay(date)\n ) : (\n <View\n key={`empty-${col}`}\n style={{ flex: 1, height: cellHeight }}\n />\n ),\n )}\n </View>\n ))}\n </View>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAsHA,IAAMA,IAAW;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;CAAO;AAAK,GAC3DC,IAAc;CAClB,OAAO;CACP,QAAQ;CACR,OAAO;AACT,GAEMC,KAAY,MAAgB;CAChC,IAAM,CAACC,GAAGC,GAAGC,KAAKC,EAAI,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CAC3C,OAAOC,EAAUJ,GAAGC,IAAI,GAAGC,CAAC;AAC9B,GAGMG,KAAU,MAA2D;CACzE,IAAIC,MAAU,KAAA,GAEd,OADIA,MAAU,OAAa,CAAC,KACpB,MAAM,QAAQA,CAAK,IAAIA,IAAQ,CAACA,CAAK,EAAA,CAAG,IAAIC,CAAM;AAC5D;AAGA,SAASC,EAAc,GAAqC;CAC1D,IAAMC,IAASC,GAAM,KAAK,IAAQ;CAClC,OAAOC,QAEHF,MAAW,KAAA,IACP,KAAA,IACAA,MAAW,KACT,CAAC,IACDA,EAAO,MAAM,IAAQ,GAC7B,CAACA,CAAM,CACT;AACF;AASA,SAAgBG,EAAS,GAAsB;CAE7C,OADKC,EAAM,WACJ,kBAACC,GAAD,EAAkB,GAAID,EAAQ,CAAA,IADT,kBAACE,GAAD,EAAc,GAAIF,EAAQ,CAAA;AAExD;AAEA,SAASC,EAAiB,EACxB,SACA,iBAAc,IACd,iBACA,UACA,gBACA,cACA,aACA,UACA,kB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EAAM,SAAS,IAAI;MAC5B,CAAC;KACG,CAAA;KACLuB,EAAU,CAAC;IACR;;GACN,kBAACxE,GAAD;IACE,2BAA0B;IAC1B,6BAAA;IACA,OAAO;KAAE,eAAe;KAAO,iBAAiBhB,EAAE,MAAM;IAAK;IAC7D,GAAIiB,EAAK,YAAY,UAAU;IAE9B,UAAA,MAAM,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM;KACnC,IAAM2F,IAAOhI,GAAUiG,KAAiBI,KAAK;KAC7C,OACE,kBAAC/D,GAAD;MAEE,OAAO,CACLC,EAAUnB,GAAG,MAAMuF,CAAI,GACvB;OACE,MAAM;OACN,WAAW;OACX,OAAOvF,EAAE,OAAO;MAClB,CACF;MAEC,UAAAE,EAAU,0BAA0B0G,GAAM;KACvC,GAXCA,CAWD;IAEV,CAAC;GACG,CAAA;GACL1B,EAAM,KAAK,GAAM,MAChB,kBAAClE,GAAD;IAEE,OAAO;KAAE,eAAe;KAAO,cAAchB,EAAE,MAAM;IAAO;IAC5D,GAAIiB,EAAK,YAAY,MAAM;IAE1B,UAAA4F,EAAK,KAAK,GAAM,MACfhE,IACEiD,GAAUjD,CAAI,IAEd,kBAAC7B,GAAD,EAEE,OAAO;KAAE,MAAM;KAAG,QAAQmE;IAAW,EACtC,GAFM,SAAS2B,GAEf,CAEL;GACI,GAdCC,CAcD,CACP;EACG;;AAEV"}
1
+ {"version":3,"file":"Calendar.js","names":["WEEKDAYS","CELL_HEIGHT","parseKey","y","m","d","key","localDate","keysOf","value","dayKey","useStableKeys","joined","keys","useMemo","Calendar","props","PoppableCalendar","CalendarView","rest","t","useTheme","translate","useI18n","overlay","useOverlay","current","setCurrent","useControllable","defaultValue","onChange","ready","titleNode","title","titleText","Overlay","View","part","Text","textStyle","fonts","weight","Pressable","hitSlopFor","pressed","Icon","Button","onConfirm","confirmText","_poppable","_open","_defaultOpen","_onOpenChange","_title","_confirmText","_onConfirm","today","useState","now","todayKey","minKey","minDate","maxKey","maxDate","isDisabled","date","disabledDate","toValue","dates","type","controlledKeys","state","send","useMachine","createSelectionMachine","pendingStart","setPendingStart","selected","rangeKeys","firstSelected","shownMonth","setShownMonth","month","defaultMonth","onMonthChange","first","monthStart","canPrev","disabled","canNext","press","onSelect","sameMonth","fullDate","format","locale","language","lead","firstDayOfWeek","daysInMonth","cells","addDays","i","weeks","cellHeight","size","dot","primary","sans","navButton","enabled","direction","label","previousMonthLabel","nextMonthLabel","renderDay","off","isToday","start","end","middle","filled","isSelected","singleDayRange","suffixes","textColor","band","accessibilityLabel","style","name","week","col","row"],"sources":["../../../../../native/src/components/Calendar/Calendar.tsx"],"sourcesContent":["import { useMemo, useState, type ReactNode } from \"react\";\nimport {\n Pressable,\n Text,\n View,\n type StyleProp,\n type ViewProps,\n type ViewStyle,\n} from \"react-native\";\nimport {\n addDays,\n createSelectionMachine,\n dayKey,\n localDate,\n monthStart,\n sameMonth,\n} from \"@minerva/core\";\nimport { useI18n, useTheme } from \"../../theme/MinervaProvider\";\nimport { Icon } from \"../../internal/Icon\";\nimport { Overlay, type OverlayCloseReason } from \"../../internal/Overlay\";\nimport { part } from \"../../internal/parts\";\nimport { hitSlopFor, textStyle, weight } from \"../../internal/styles\";\nimport { useControllable } from \"../../internal/useControllable\";\nimport { useMachine } from \"../../internal/useMachine\";\nimport { useOverlay } from \"../../internal/useOverlay\";\nimport { Button } from \"../Button\";\n\n/** Selection type of `Calendar` */\nexport type CalendarType = \"single\" | \"multiple\" | \"range\";\n\n/**\n * Value of `Calendar`: a day (`single`, `null`: none), days (`multiple`) or\n * a `[start, end]` range (`range`); every date is local midnight\n */\nexport type CalendarValue = Date | Date[] | [Date, Date] | null;\n\n/** Why a poppable calendar closed */\nexport type CalendarCloseReason = OverlayCloseReason;\n\nexport interface CalendarProps extends Omit<ViewProps, \"style\" | \"children\"> {\n /**\n * Selection type: one day, several days, or a range\n * @default \"single\"\n */\n type?: CalendarType;\n /**\n * Selected day(s) (controlled; pair with `onChange`): a `Date` (`single`),\n * `Date[]` (`multiple`) or `[start, end]` (`range`)\n */\n value?: CalendarValue;\n /** Initially selected day(s) (uncontrolled) @default null */\n defaultValue?: CalendarValue;\n /**\n * Called with the new selection (a range once both ends are picked)\n */\n onChange?: (value: CalendarValue) => void;\n /** Called with every pressed day */\n onSelect?: (date: Date) => void;\n /** Displayed month (controlled; any day of the month; pair with `onMonthChange`) */\n month?: Date;\n /**\n * Initially displayed month (uncontrolled)\n * @default the month of the first selected day, else of today\n */\n defaultMonth?: Date;\n /** Called with the first day of the month navigated to */\n onMonthChange?: (month: Date) => void;\n /** Earliest selectable day (earlier days are disabled) */\n minDate?: Date;\n /** Latest selectable day (later days are disabled) */\n maxDate?: Date;\n /** Locale of calendar month and accessible date names. */\n locale?: string;\n /** Extra disabled days */\n disabledDate?: (date: Date) => boolean;\n /**\n * First column of the week (0: Sunday ... 6: Saturday)\n * @default 0\n */\n firstDayOfWeek?: number;\n /**\n * Cell density: compact (\"small\"), default (\"medium\") or comfortable\n * (\"large\")\n * @default \"medium\"\n */\n size?: \"small\" | \"medium\" | \"large\";\n /**\n * Blocks navigation and selection\n * @default false\n */\n disabled?: boolean;\n /** Label of the previous-month button @default the \"monthCalendar.previousMonth\" message */\n previousMonthLabel?: string;\n /** Label of the next-month button @default the \"monthCalendar.nextMonth\" message */\n nextMonthLabel?: string;\n /**\n * Renders the calendar in a bottom sheet with a title and a confirm\n * button (`open` / `defaultOpen` / `onOpenChange`)\n * @default false\n */\n poppable?: boolean;\n /** Controlled open state of the poppable sheet */\n open?: boolean;\n /**\n * Initial open state of the poppable sheet while uncontrolled\n * @default false\n */\n defaultOpen?: boolean;\n /** Called with the requested open state of the sheet and the close reason */\n onOpenChange?: (open: boolean, reason?: CalendarCloseReason) => void;\n /** Title of the poppable sheet @default the \"calendar.title\" message */\n title?: ReactNode;\n /** Text of the confirm button @default the \"calendar.confirm\" message */\n confirmText?: ReactNode;\n /** Called by the confirm button of the poppable sheet with the selection */\n onConfirm?: (value: CalendarValue) => void;\n /** Style of the calendar */\n style?: StyleProp<ViewStyle>;\n}\n\nconst WEEKDAYS = [\"sun\", \"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\"] as const;\nconst CELL_HEIGHT = {\n small: \"control-height-sm\",\n medium: \"control-height-md\",\n large: \"control-height-lg\",\n} as const;\n\nconst parseKey = (key: string) => {\n const [y, m, d] = key.split(\"-\").map(Number);\n return localDate(y, m - 1, d);\n};\n\n/** The selected day keys of a value */\nconst keysOf = (value: CalendarValue | undefined): string[] | undefined => {\n if (value === undefined) return undefined;\n if (value === null) return [];\n return (Array.isArray(value) ? value : [value]).map(dayKey);\n};\n\n/** The same array while its items are unchanged (controlled values) */\nfunction useStableKeys(keys: readonly string[] | undefined) {\n const joined = keys?.join(\"\\u0000\");\n return useMemo(\n () =>\n joined === undefined\n ? undefined\n : joined === \"\"\n ? []\n : joined.split(\"\\u0000\"),\n [joined],\n );\n}\n\n/**\n * A month calendar for picking a day, several days or a range: weekday\n * header, month navigation, min / max dates, today ring, selected fills\n * and range tint. Inline, or in a bottom sheet with a confirm button\n * (`poppable`). Single and multiple selections run on the selection\n * machine of @minerva/core.\n */\nexport function Calendar(props: CalendarProps) {\n if (!props.poppable) return <CalendarView {...props} />;\n return <PoppableCalendar {...props} />;\n}\n\nfunction PoppableCalendar({\n open,\n defaultOpen = false,\n onOpenChange,\n title,\n confirmText,\n onConfirm,\n onChange,\n value,\n defaultValue = null,\n type = \"single\",\n ...rest\n}: CalendarProps) {\n const { tokens: t, fonts } = useTheme();\n const { t: translate } = useI18n();\n const overlay = useOverlay({ open, defaultOpen, onOpenChange });\n // the sheet keeps the selection to confirm\n const [current, setCurrent] = useControllable<CalendarValue>(\n value,\n defaultValue,\n onChange,\n );\n if (overlay.state.phase === \"closed\") return null;\n const ready = Array.isArray(current) ? current.length > 0 : current !== null;\n const titleNode = title ?? translate(\"calendar.title\");\n const titleText =\n typeof titleNode === \"string\" || typeof titleNode === \"number\"\n ? String(titleNode)\n : undefined;\n const closeSize = 28;\n\n return (\n <Overlay\n component=\"calendar\"\n phase={overlay.state.phase}\n onAnimationEnd={overlay.onAnimationEnd}\n onRequestClose={overlay.close}\n placement=\"bottom\"\n panelProps={{ role: \"dialog\", accessibilityLabel: titleText }}\n >\n <View\n style={{\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n paddingVertical: t.space[\"4\"],\n paddingHorizontal: t.space[\"12\"],\n }}\n {...part(\"calendar\", \"header\")}\n >\n {titleText !== undefined ? (\n <Text\n accessibilityRole=\"header\"\n style={[\n textStyle(t, \"lg\", fonts.sans),\n { fontWeight: weight(t, \"semibold\") },\n ]}\n {...part(\"calendar\", \"title\")}\n >\n {titleText}\n </Text>\n ) : (\n titleNode\n )}\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={translate(\"modal.close\")}\n hitSlop={hitSlopFor(t, closeSize, closeSize)}\n onPress={() => overlay.close(\"close-button\")}\n style={({ pressed }) => ({\n position: \"absolute\",\n right: t.space[\"4\"],\n width: closeSize,\n height: closeSize,\n borderRadius: closeSize / 2,\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: pressed\n ? t.colors[\"surface-muted-color\"]\n : \"transparent\",\n })}\n {...part(\"calendar\", \"close\")}\n >\n <Icon name=\"close\" size={14} color={t.colors[\"text-muted-color\"]} />\n </Pressable>\n </View>\n <CalendarView\n {...rest}\n type={type}\n value={current}\n onChange={setCurrent}\n style={[{ paddingHorizontal: t.space[\"2\"] }, rest.style]}\n />\n <View\n style={{ padding: t.space[\"4\"], paddingTop: t.space[\"2\"] }}\n {...part(\"calendar\", \"footer\")}\n >\n <Button\n fullWidth\n disabled={!ready}\n onPress={() => {\n onConfirm?.(current);\n overlay.close(\"confirm\");\n }}\n >\n {confirmText ?? translate(\"calendar.confirm\")}\n </Button>\n </View>\n </Overlay>\n );\n}\n\nfunction CalendarView({\n type = \"single\",\n value,\n defaultValue = null,\n onChange,\n onSelect,\n month,\n defaultMonth,\n onMonthChange,\n minDate,\n maxDate,\n disabledDate,\n firstDayOfWeek = 0,\n locale,\n size = \"medium\",\n disabled = false,\n previousMonthLabel,\n nextMonthLabel,\n style,\n accessibilityLabel,\n // poppable-only props, unused inline\n poppable: _poppable,\n open: _open,\n defaultOpen: _defaultOpen,\n onOpenChange: _onOpenChange,\n title: _title,\n confirmText: _confirmText,\n onConfirm: _onConfirm,\n ...rest\n}: CalendarProps) {\n const { tokens: t, fonts } = useTheme();\n const { t: translate, language } = useI18n();\n const [today] = useState(() => {\n const now = new Date();\n return localDate(now.getFullYear(), now.getMonth(), now.getDate());\n });\n const todayKey = dayKey(today);\n const minKey = minDate ? dayKey(minDate) : undefined;\n const maxKey = maxDate ? dayKey(maxDate) : undefined;\n const isDisabled = (date: Date) => {\n const key = dayKey(date);\n return (\n (minKey !== undefined && key < minKey) ||\n (maxKey !== undefined && key > maxKey) ||\n !!disabledDate?.(date)\n );\n };\n\n const toValue = (keys: readonly string[]): CalendarValue => {\n const dates = keys.map(parseKey);\n if (type === \"single\") return dates[0] ?? null;\n if (type === \"range\") {\n return dates.length === 2 ? [dates[0], dates[1]] : null;\n }\n return dates;\n };\n const controlledKeys = useStableKeys(keysOf(value));\n const [state, send] = useMachine(createSelectionMachine<string>, {\n mode: type === \"single\" ? (\"single\" as const) : (\"multiple\" as const),\n value: controlledKeys,\n defaultValue: keysOf(defaultValue) ?? [],\n isDisabled: (key: string) => isDisabled(parseKey(key)),\n max: type === \"range\" ? 2 : undefined,\n onValueChange: (keys: string[]) => onChange?.(toValue(keys)),\n });\n // range: the first end picked, waiting for the second\n const [pendingStart, setPendingStart] = useState<string | null>(null);\n\n const selected = state.value;\n const rangeKeys: [string, string] | null =\n type === \"range\"\n ? pendingStart !== null\n ? [pendingStart, pendingStart]\n : selected.length === 2\n ? [selected[0], selected[1]]\n : null\n : null;\n\n const firstSelected = selected[0] ? parseKey(selected[0]) : undefined;\n const [shownMonth, setShownMonth] = useControllable<Date>(\n month,\n defaultMonth ??\n firstSelected ??\n (minDate && minDate > today ? minDate : today),\n onMonthChange,\n );\n const first = monthStart(shownMonth);\n const canPrev = !disabled && (!minDate || first > monthStart(minDate));\n const canNext = !disabled && (!maxDate || monthStart(first, 1) <= maxDate);\n\n const press = (date: Date) => {\n const key = dayKey(date);\n onSelect?.(date);\n if (type === \"single\") {\n send({ type: \"SELECT\", value: key });\n } else if (type === \"multiple\") {\n send({ type: \"TOGGLE\", value: key });\n } else if (pendingStart === null || key < pendingStart) {\n setPendingStart(key);\n } else {\n setPendingStart(null);\n send({ type: \"SET\", value: [pendingStart, key] });\n }\n if (!sameMonth(date, first)) setShownMonth(monthStart(date));\n };\n\n const fullDate = useMemo(() => {\n try {\n const format = new Intl.DateTimeFormat(locale ?? language, {\n weekday: \"long\",\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n });\n return (date: Date) => format.format(date);\n } catch {\n return (date: Date) => date.toDateString();\n }\n }, [language, locale]);\n\n const lead = (first.getDay() - firstDayOfWeek + 7) % 7;\n const daysInMonth = localDate(\n first.getFullYear(),\n first.getMonth() + 1,\n 0,\n ).getDate();\n const cells: (Date | null)[] = [\n ...Array.from({ length: lead }, () => null),\n ...Array.from({ length: daysInMonth }, (_, i) => addDays(first, i)),\n ];\n while (cells.length % 7) cells.push(null);\n const weeks: (Date | null)[][] = [];\n for (let i = 0; i < cells.length; i += 7) weeks.push(cells.slice(i, i + 7));\n\n const cellHeight = t.sizes[CELL_HEIGHT[size]];\n const dot = Math.min(cellHeight - t.space[\"1\"], 44);\n const primary = t.colors[\"primary-color\"];\n const sans = fonts.sans;\n const navSize = 32;\n\n const navButton = (direction: -1 | 1) => {\n const enabled = direction < 0 ? canPrev : canNext;\n const label =\n direction < 0\n ? (previousMonthLabel ?? translate(\"monthCalendar.previousMonth\"))\n : (nextMonthLabel ?? translate(\"monthCalendar.nextMonth\"));\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n accessibilityState={{ disabled: !enabled }}\n disabled={!enabled}\n hitSlop={hitSlopFor(t, navSize, navSize)}\n onPress={() => setShownMonth(monthStart(first, direction))}\n style={({ pressed }) => ({\n width: navSize,\n height: navSize,\n borderRadius: navSize / 2,\n alignItems: \"center\",\n justifyContent: \"center\",\n opacity: enabled ? 1 : 0.35,\n backgroundColor: pressed\n ? t.colors[\"surface-muted-color\"]\n : \"transparent\",\n })}\n {...part(\"calendar\", direction < 0 ? \"prev\" : \"next\")}\n >\n <Icon\n name={direction < 0 ? \"chevron-left\" : \"chevron-right\"}\n size={16}\n color={t.colors[\"text-secondary-color\"]}\n />\n </Pressable>\n );\n };\n\n const renderDay = (date: Date) => {\n const key = dayKey(date);\n const off = disabled || isDisabled(date);\n const isToday = key === todayKey;\n const start = rangeKeys?.[0] === key;\n const end = rangeKeys?.[1] === key && pendingStart === null;\n const middle = !!rangeKeys && key > rangeKeys[0] && key < rangeKeys[1];\n const filled = rangeKeys ? start || end : selected.includes(key);\n const isSelected = filled || middle;\n const singleDayRange = rangeKeys?.[0] === rangeKeys?.[1];\n const suffixes = [\n isToday ? translate(\"monthCalendar.today\") : undefined,\n start ? translate(\"calendar.rangeStart\") : undefined,\n end ? translate(\"calendar.rangeEnd\") : undefined,\n ].filter(Boolean);\n const label = [fullDate(date), ...suffixes].join(\", \");\n const textColor = off\n ? t.colors[\"text-disabled-color\"]\n : filled\n ? t.colors[\"text-inverse-color\"]\n : middle\n ? t.colors[\"primary-color-text\"]\n : isToday\n ? primary\n : t.colors[\"text-color\"];\n const band = t.colors[\"primary-color-subtle\"];\n\n return (\n <Pressable\n key={key}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n accessibilityState={{ selected: isSelected, disabled: off }}\n aria-selected={isSelected}\n disabled={off}\n onPress={() => press(date)}\n style={{\n flex: 1,\n height: cellHeight,\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: middle ? band : \"transparent\",\n }}\n {...part(\"calendar\", \"day\", {\n selected: isSelected,\n today: isToday,\n disabled: off,\n \"range-start\": start && !!rangeKeys,\n \"range-end\": end,\n \"range-middle\": middle,\n })}\n >\n {rangeKeys && !singleDayRange && (start || end) && (\n <View\n style={{\n position: \"absolute\",\n top: 0,\n bottom: 0,\n left: start ? \"50%\" : 0,\n right: end ? \"50%\" : 0,\n backgroundColor: band,\n }}\n />\n )}\n <View\n style={{\n width: dot,\n height: dot,\n borderRadius: dot / 2,\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: filled && !off ? primary : \"transparent\",\n borderWidth: isToday && !filled ? 1 : 0,\n borderColor: primary,\n }}\n >\n <Text\n allowFontScaling={false}\n style={[\n textStyle(t, size === \"small\" ? \"sm\" : \"md\", sans),\n {\n color: textColor,\n fontWeight: weight(\n t,\n filled || isToday ? \"semibold\" : \"regular\",\n ),\n },\n ]}\n >\n {date.getDate()}\n </Text>\n {(start || end) && !singleDayRange && size !== \"small\" && (\n <Text\n allowFontScaling={false}\n style={{\n position: \"absolute\",\n bottom: -t.space[\"0-5\"],\n fontSize: t.fontSize.xs - 3,\n color: t.colors[\"text-inverse-color\"],\n ...(sans ? { fontFamily: sans } : null),\n }}\n >\n {translate(start ? \"calendar.rangeStart\" : \"calendar.rangeEnd\")}\n </Text>\n )}\n </View>\n </Pressable>\n );\n };\n\n return (\n <View\n role=\"group\"\n accessibilityLabel={\n accessibilityLabel ?? translate(\"monthCalendar.label\")\n }\n {...part(\"calendar\", \"root\", { type, disabled })}\n {...rest}\n style={[{ backgroundColor: t.colors[\"surface-color\"] }, style]}\n >\n <View\n style={{\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n paddingHorizontal: t.space[\"2\"],\n paddingVertical: t.space[\"2\"],\n }}\n >\n {navButton(-1)}\n <Text\n accessibilityRole=\"header\"\n accessibilityLiveRegion=\"polite\"\n style={[\n textStyle(t, \"lg\", sans),\n { fontWeight: weight(t, \"semibold\") },\n ]}\n {...part(\"calendar\", \"month-title\")}\n >\n {locale\n ? new Intl.DateTimeFormat(locale, {\n year: \"numeric\",\n month: \"long\",\n }).format(first)\n : translate(\"calendar.monthTitle\", {\n year: first.getFullYear(),\n month: first.getMonth() + 1,\n })}\n </Text>\n {navButton(1)}\n </View>\n <View\n importantForAccessibility=\"no-hide-descendants\"\n accessibilityElementsHidden\n style={{ flexDirection: \"row\", paddingVertical: t.space[\"1\"] }}\n {...part(\"calendar\", \"weekdays\")}\n >\n {Array.from({ length: 7 }, (_, i) => {\n const name = WEEKDAYS[(firstDayOfWeek + i) % 7];\n return (\n <Text\n key={name}\n style={[\n textStyle(t, \"xs\", sans),\n {\n flex: 1,\n textAlign: \"center\",\n color: t.colors[\"text-muted-color\"],\n },\n ]}\n >\n {translate(`monthCalendar.weekdays.${name}`)}\n </Text>\n );\n })}\n </View>\n {weeks.map((week, row) => (\n <View\n key={row}\n style={{ flexDirection: \"row\", marginBottom: t.space[\"0-5\"] }}\n {...part(\"calendar\", \"week\")}\n >\n {week.map((date, col) =>\n date ? (\n renderDay(date)\n ) : (\n <View\n key={`empty-${col}`}\n style={{ flex: 1, height: cellHeight }}\n />\n ),\n )}\n </View>\n ))}\n </View>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwHA,IAAMA,KAAW;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;CAAO;AAAK,GAC3DC,IAAc;CAClB,OAAO;CACP,QAAQ;CACR,OAAO;AACT,GAEMC,KAAY,MAAgB;CAChC,IAAM,CAACC,GAAGC,GAAGC,KAAKC,EAAI,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CAC3C,OAAOC,EAAUJ,GAAGC,IAAI,GAAGC,CAAC;AAC9B,GAGMG,KAAU,MAA2D;CACzE,IAAIC,MAAU,KAAA,GAEd,OADIA,MAAU,OAAa,CAAC,KACpB,MAAM,QAAQA,CAAK,IAAIA,IAAQ,CAACA,CAAK,EAAA,CAAG,IAAIC,CAAM;AAC5D;AAGA,SAASC,EAAc,GAAqC;CAC1D,IAAMC,IAASC,GAAM,KAAK,IAAQ;CAClC,OAA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AQoE;IAAW,EACtC,GAFM,SAAS2B,GAEf,CAEL;GACI,GAdCC,CAcD,CACP;EACG;;AAEV"}
@@ -1,2 +1,2 @@
1
- const e=require("../../theme/MinervaProvider.cjs"),t=require("../../internal/parts.cjs"),n=require("../../internal/styles.cjs"),r=require("../../internal/Icon.cjs"),i=require("../../internal/useMachine.cjs"),a=require("../../internal/FormControlContext.cjs"),o=require("../../internal/toggleControl.cjs"),s=require("../../internal/formControl.cjs");let c=require("react"),l=require("react-native"),u=require("../../../core/index.cjs"),d=require("react/jsx-runtime");var f=(0,c.createContext)(null);function p(s){let{checked:p,defaultChecked:m=!1,onChange:h,indeterminate:g=!1,disabled:_=!1,label:v,children:y,color:b,size:x,shape:S,value:C,error:w=!1,labelPlacement:T=`end`,icon:E,style:D,labelStyle:O,accessibilityState:k,hitSlop:A,...j}=a.useFormControlProps(s),{tokens:M,fonts:N}=e.useTheme(),P=(0,c.useContext)(f),F=P!==null&&C!==void 0,I=F?P.value.includes(C):void 0,L=P?.size??x??`medium`,R=P?.color??b??`primary`,z=P?.shape??S??`square`,B=w||!!P?.error,V=_||!!P?.disabled||F&&!I&&P.full,[H,U]=i.useMachine(u.createCheckboxMachine,{checked:F?I:p,defaultChecked:m,indeterminate:g,disabled:V,onCheckedChange:e=>{F&&P.toggle(C),h?.(e,C)}}),W=n.colorRole(M,R),G=o.TOGGLE_BOX[L],K=H.checked||H.indeterminate,q=z===`circle`?G/2:z===`rounded`?M.radius.sm:Math.max(2,Math.round(M.radius.sm/2)),J=v??y,Y=n.textStyle(M,n.controlFontSize(M,L)).lineHeight??G;return(0,d.jsx)(l.Pressable,{accessibilityRole:`checkbox`,accessibilityState:{...k,checked:H.indeterminate?`mixed`:H.checked,disabled:V},"aria-checked":H.indeterminate?`mixed`:H.checked,"aria-disabled":V,disabled:V,onPress:()=>U({type:`TOGGLE`}),hitSlop:A??n.hitSlopFor(M,Math.max(G,Y)),...t.part(`checkbox`,`root`,{checked:H.checked,indeterminate:H.indeterminate,disabled:V,size:L,color:R,shape:z,invalid:B}),...j,style:[o.placementStyle(T),{gap:M.space[2],opacity:V?.5:1},D],children:({pressed:e})=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l.View,{style:{width:G,height:G,borderRadius:q,borderWidth:K?0:1.5,borderColor:B?M.colors[`danger-color`]:e?W.solid:M.colors[`border-strong-color`],backgroundColor:K?e?W.pressed:W.solid:e?W.subtle:M.colors[`surface-color`],alignItems:`center`,justifyContent:`center`},...t.part(`checkbox`,`control`,{checked:H.checked,indeterminate:H.indeterminate}),children:H.indeterminate?(0,d.jsx)(r.Icon,{name:`minus`,size:G*.9,color:W.onSolid}):H.checked?E??(0,d.jsx)(r.Icon,{name:`check`,size:G*.8,color:W.onSolid}):null}),(0,d.jsx)(o.ToggleLabel,{t:M,component:`checkbox`,size:L,disabled:V,fontFamily:N.sans,style:O,children:J})]})})}s.bindFormControl(p,{valuePropName:`checked`,emptyValue:!1,commitOnChange:!0,invalidPropName:`error`,requiredKey:`validation.checkMissing`}),exports.Checkbox=p,exports.CheckboxGroupContext=f;
1
+ const e=require("../../theme/MinervaProvider.cjs"),t=require("../../internal/parts.cjs"),n=require("../../internal/styles.cjs"),r=require("../../internal/Icon.cjs"),i=require("../../internal/useMachine.cjs"),a=require("../../internal/FormControlContext.cjs"),o=require("../../internal/formControl.cjs"),s=require("../../internal/toggleControl.cjs");let c=require("react"),l=require("react-native"),u=require("../../../core/index.cjs"),d=require("react/jsx-runtime");var f=(0,c.createContext)(null);function p(o){let{checked:p,defaultChecked:m=!1,onChange:h,indeterminate:g=!1,disabled:_=!1,label:v,children:y,color:b,size:x,shape:S,value:C,error:w=!1,labelPlacement:T=`end`,icon:E,style:D,labelStyle:O,accessibilityState:k,hitSlop:A,...j}=a.useFormControlProps(o),{tokens:M,fonts:N}=e.useTheme(),P=(0,c.useContext)(f),F=P!==null&&C!==void 0,I=F?P.value.includes(C):void 0,L=P?.size??x??`medium`,R=P?.color??b??`primary`,z=P?.shape??S??`square`,B=w||!!P?.error,V=_||!!P?.disabled||F&&!I&&P.full,[H,U]=i.useMachine(u.createCheckboxMachine,{checked:F?I:p,defaultChecked:m,indeterminate:g,disabled:V,onCheckedChange:e=>{F&&P.toggle(C),h?.(e,C)}}),W=n.colorRole(M,R),G=s.TOGGLE_BOX[L],K=H.checked||H.indeterminate,q=z===`circle`?G/2:z===`rounded`?M.radius.sm:Math.max(2,Math.round(M.radius.sm/2)),J=v??y,Y=n.textStyle(M,n.controlFontSize(M,L)).lineHeight??G;return(0,d.jsx)(l.Pressable,{accessibilityRole:`checkbox`,accessibilityState:{...k,checked:H.indeterminate?`mixed`:H.checked,disabled:V},"aria-checked":H.indeterminate?`mixed`:H.checked,"aria-disabled":V,disabled:V,onPress:()=>U({type:`TOGGLE`}),hitSlop:A??n.hitSlopFor(M,Math.max(G,Y)),...t.part(`checkbox`,`root`,{checked:H.checked,indeterminate:H.indeterminate,disabled:V,size:L,color:R,shape:z,invalid:B}),...j,style:[s.placementStyle(T),{gap:M.space[2],opacity:V?.5:1},D],children:({pressed:e})=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l.View,{style:{width:G,height:G,borderRadius:q,borderWidth:K?0:1.5,borderColor:B?M.colors[`danger-color`]:e?W.solid:M.colors[`border-strong-color`],backgroundColor:K?e?W.pressed:W.solid:e?W.subtle:M.colors[`surface-color`],alignItems:`center`,justifyContent:`center`},...t.part(`checkbox`,`control`,{checked:H.checked,indeterminate:H.indeterminate}),children:H.indeterminate?(0,d.jsx)(r.Icon,{name:`minus`,size:G*.9,color:W.onSolid}):H.checked?E??(0,d.jsx)(r.Icon,{name:`check`,size:G*.8,color:W.onSolid}):null}),(0,d.jsx)(s.ToggleLabel,{t:M,component:`checkbox`,size:L,disabled:V,fontFamily:N.sans,style:O,children:J})]})})}o.bindFormControl(p,{valuePropName:`checked`,emptyValue:!1,commitOnChange:!0,invalidPropName:`error`,requiredKey:`validation.checkMissing`}),exports.Checkbox=p,exports.CheckboxGroupContext=f;
2
2
  //# sourceMappingURL=Checkbox.cjs.map