@selectwin/kit 0.1.262 → 0.1.264

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 (65) hide show
  1. package/README.md +74 -0
  2. package/dist/SelectActionMenu.d.ts +7 -1
  3. package/dist/SelectActionMenu.js +14 -13
  4. package/dist/SelectBlockBuilder.d.ts +63 -0
  5. package/dist/SelectBlockBuilder.js +370 -0
  6. package/dist/SelectCalendar.d.ts +68 -4
  7. package/dist/SelectCalendar.js +449 -279
  8. package/dist/SelectChannelPreview.d.ts +34 -5
  9. package/dist/SelectChannelPreview.js +167 -73
  10. package/dist/SelectChartCard.d.ts +13 -0
  11. package/dist/SelectChartCard.js +50 -30
  12. package/dist/SelectCombobox.d.ts +5 -0
  13. package/dist/SelectCombobox.js +77 -61
  14. package/dist/SelectConversationContext.d.ts +30 -0
  15. package/dist/SelectConversationContext.js +141 -0
  16. package/dist/SelectDatePicker.d.ts +4 -0
  17. package/dist/SelectDatePicker.js +78 -62
  18. package/dist/SelectDateRangeField.d.ts +6 -1
  19. package/dist/SelectDateRangeField.js +9 -8
  20. package/dist/SelectField.d.ts +7 -3
  21. package/dist/SelectField.js +71 -70
  22. package/dist/SelectFilterBar.d.ts +9 -0
  23. package/dist/SelectFilterBar.js +301 -179
  24. package/dist/SelectFunnel.d.ts +12 -2
  25. package/dist/SelectFunnel.js +193 -63
  26. package/dist/SelectHorizontalBar.d.ts +11 -1
  27. package/dist/SelectHorizontalBar.js +86 -35
  28. package/dist/SelectHtmlFrame.d.ts +3 -1
  29. package/dist/SelectHtmlFrame.js +4 -4
  30. package/dist/SelectIconButton.d.ts +2 -1
  31. package/dist/SelectIconButton.js +1 -1
  32. package/dist/SelectLocale.d.ts +146 -0
  33. package/dist/SelectLocale.js +363 -31
  34. package/dist/SelectMail.d.ts +80 -4
  35. package/dist/SelectMail.js +433 -300
  36. package/dist/SelectMailEditor.d.ts +35 -1
  37. package/dist/SelectMailEditor.js +347 -163
  38. package/dist/SelectNumberedList.d.ts +20 -2
  39. package/dist/SelectNumberedList.js +75 -17
  40. package/dist/SelectPopover.js +31 -18
  41. package/dist/SelectProgressBar.d.ts +22 -5
  42. package/dist/SelectProgressBar.js +70 -40
  43. package/dist/SelectRecordCard.d.ts +13 -4
  44. package/dist/SelectRecordCard.js +30 -8
  45. package/dist/SelectRuleBuilder.d.ts +52 -0
  46. package/dist/SelectRuleBuilder.js +157 -0
  47. package/dist/SelectSearchPreview.d.ts +35 -0
  48. package/dist/SelectSearchPreview.js +69 -0
  49. package/dist/SelectSegmented.d.ts +2 -0
  50. package/dist/SelectSegmented.js +1 -1
  51. package/dist/SelectSortable.d.ts +5 -1
  52. package/dist/SelectSparkBars.d.ts +5 -1
  53. package/dist/SelectSparkBars.js +65 -57
  54. package/dist/SelectSteps.d.ts +6 -0
  55. package/dist/SelectSteps.js +43 -10
  56. package/dist/SelectTabs.d.ts +16 -4
  57. package/dist/SelectTabs.js +95 -60
  58. package/dist/SelectTextarea.d.ts +1 -1
  59. package/dist/SelectVoiceNote.d.ts +6 -1
  60. package/dist/SelectVoiceNote.js +118 -106
  61. package/dist/chartUtils.d.ts +10 -0
  62. package/dist/index.d.ts +18 -2
  63. package/dist/index.js +153 -149
  64. package/dist/style.css +1 -1
  65. package/package.json +1 -1
@@ -1,66 +1,38 @@
1
1
  import { SelectButton as e } from "./SelectButton.js";
2
- import { ChevronLeftIcon as t, ChevronRightIcon as n } from "./icons.js";
3
- import { SelectSegmented as r } from "./SelectSegmented.js";
4
- import { SelectIconButton as i } from "./SelectIconButton.js";
5
- import { useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
6
- import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
2
+ import { CheckIcon as t, ChevronLeftIcon as n, ChevronRightIcon as r } from "./icons.js";
3
+ import { selectKitMessages as i, useSelectMessages as a } from "./SelectLocale.js";
4
+ import { SelectSegmented as o } from "./SelectSegmented.js";
5
+ import { SelectIconButton as s } from "./SelectIconButton.js";
6
+ import { useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
7
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
7
8
  //#region src/SelectCalendar.tsx
8
- var f = "America/Sao_Paulo", p = 864e5, m = 3, h = 3, g = [
9
- "dom",
10
- "seg",
11
- "ter",
12
- "qua",
13
- "qui",
14
- "sex",
15
- "sáb"
16
- ], _ = [
17
- "janeiro",
18
- "fevereiro",
19
- "março",
20
- "abril",
21
- "maio",
22
- "junho",
23
- "julho",
24
- "agosto",
25
- "setembro",
26
- "outubro",
27
- "novembro",
28
- "dezembro"
29
- ], v = [
30
- "jan.",
31
- "fev.",
32
- "mar.",
33
- "abr.",
34
- "mai.",
35
- "jun.",
36
- "jul.",
37
- "ago.",
38
- "set.",
39
- "out.",
40
- "nov.",
41
- "dez."
42
- ], y = (e) => String(e).padStart(2, "0"), b = (e, t, n) => {
9
+ var h = "America/Sao_Paulo", g = 864e5, _ = 3, v = 3, y = [
10
+ "mine",
11
+ "other",
12
+ "series",
13
+ "draft"
14
+ ], b = (e) => String(e).padStart(2, "0"), x = (e, t, n) => {
43
15
  let r = new Date(Date.UTC(e, t - 1, n));
44
- return `${r.getUTCFullYear()}-${y(r.getUTCMonth() + 1)}-${y(r.getUTCDate())}`;
45
- }, x = (e) => {
16
+ return `${r.getUTCFullYear()}-${b(r.getUTCMonth() + 1)}-${b(r.getUTCDate())}`;
17
+ }, S = (e) => {
46
18
  let [t, n, r] = e.split("-").map(Number);
47
19
  return [
48
20
  t ?? 1970,
49
21
  n ?? 1,
50
22
  r ?? 1
51
23
  ];
52
- }, S = (e, t) => {
53
- let [n, r, i] = x(e);
54
- return b(n, r, i + t);
55
- }, C = (e) => {
56
- let [t, n, r] = x(e);
24
+ }, C = (e, t) => {
25
+ let [n, r, i] = S(e);
26
+ return x(n, r, i + t);
27
+ }, w = (e) => {
28
+ let [t, n, r] = S(e);
57
29
  return new Date(Date.UTC(t, n - 1, r)).getUTCDay();
58
- }, w = (e, t) => S(e, -((C(e) - t + 7) % 7)), T = (e, t) => {
59
- let [n, r, i] = x(e), [a, o, s] = x(t);
60
- return Math.round((Date.UTC(a, o - 1, s) - Date.UTC(n, r - 1, i)) / p);
61
- }, E = /* @__PURE__ */ new Map();
62
- function D(e, t) {
63
- let n = E.get(t);
30
+ }, T = (e, t) => C(e, -((w(e) - t + 7) % 7)), E = (e, t) => {
31
+ let [n, r, i] = S(e), [a, o, s] = S(t);
32
+ return Math.round((Date.UTC(a, o - 1, s) - Date.UTC(n, r - 1, i)) / g);
33
+ }, D = /* @__PURE__ */ new Map();
34
+ function O(e, t) {
35
+ let n = D.get(t);
64
36
  n || (n = new Intl.DateTimeFormat("en-CA", {
65
37
  timeZone: t,
66
38
  year: "numeric",
@@ -69,7 +41,7 @@ function D(e, t) {
69
41
  hour: "2-digit",
70
42
  minute: "2-digit",
71
43
  hourCycle: "h23"
72
- }), E.set(t, n));
44
+ }), D.set(t, n));
73
45
  let r = {};
74
46
  for (let t of n.formatToParts(e)) r[t.type] = t.value;
75
47
  return {
@@ -77,70 +49,71 @@ function D(e, t) {
77
49
  minutes: Number(r.hour) * 60 + Number(r.minute)
78
50
  };
79
51
  }
80
- function O(e, t) {
81
- let [n, r, i] = x(e), a = Date.UTC(n, r - 1, i), o = (e) => {
82
- let n = D(new Date(e), t), [r, i, a] = x(n.key);
52
+ function k(e, t) {
53
+ let [n, r, i] = S(e), a = Date.UTC(n, r - 1, i), o = (e) => {
54
+ let n = O(new Date(e), t), [r, i, a] = S(n.key);
83
55
  return Date.UTC(r, i - 1, a) + n.minutes * 6e4 - e;
84
56
  }, s = a - o(a);
85
57
  return new Date(a - o(s));
86
58
  }
87
- function k(e = f) {
88
- return D(/* @__PURE__ */ new Date(), e).key;
59
+ function A(e = h) {
60
+ return O(/* @__PURE__ */ new Date(), e).key;
89
61
  }
90
- function A(e, t, n) {
62
+ function j(e, t, n, r = 7) {
63
+ if (e === "day") return [t];
91
64
  if (e === "week") {
92
- let e = w(t, n);
93
- return Array.from({ length: 7 }, (t, n) => S(e, n));
65
+ let e = T(t, n);
66
+ return Array.from({ length: r }, (t, n) => C(e, n));
94
67
  }
95
- let [r, i] = x(t), a = w(b(r, i, 1), n), o = T(a, w(b(r, i + 1, 0), n)) + 7;
96
- return Array.from({ length: o }, (e, t) => S(a, t));
68
+ let [i, a] = S(t), o = T(x(i, a, 1), n), s = E(o, T(x(i, a + 1, 0), n)) + 7;
69
+ return Array.from({ length: s }, (e, t) => C(o, t));
97
70
  }
98
- function j(e, t, n = {}) {
99
- let r = n.timeZone ?? f, i = A(e, t, n.weekStartsOn ?? 0);
71
+ function M(e, t, n = {}) {
72
+ let r = n.timeZone ?? h, i = j(e, t, n.weekStartsOn ?? 0, n.days ?? 7);
100
73
  return {
101
- from: O(i[0], r).toISOString(),
102
- to: O(S(i[i.length - 1], 1), r).toISOString(),
74
+ from: k(i[0], r).toISOString(),
75
+ to: k(C(i[i.length - 1], 1), r).toISOString(),
103
76
  days: i
104
77
  };
105
78
  }
106
- var M = (e) => typeof e == "string" ? e.slice(0, 10) : e.toISOString().slice(0, 10), N = (e) => `${y(Math.floor(e / 60))}:${y(e % 60)}`;
107
- function P(e, t) {
108
- let n = /* @__PURE__ */ new Map(), r = (e) => {
109
- let t = n.get(e.day);
110
- t ? t.push(e) : n.set(e.day, [e]);
79
+ var N = (e) => typeof e == "string" ? e.slice(0, 10) : e.toISOString().slice(0, 10), P = (e) => `${b(Math.floor(e / 60))}:${b(e % 60)}`;
80
+ function F(e, t, n = "Dia inteiro") {
81
+ let r = /* @__PURE__ */ new Map(), i = (e) => {
82
+ let t = r.get(e.day);
83
+ t ? t.push(e) : r.set(e.day, [e]);
111
84
  };
112
- for (let n of e) {
113
- if (n.allDay) {
114
- let e = M(n.start), t = Math.max(1, Math.min(62, T(e, M(n.end))));
115
- for (let i = 0; i < t; i++) r({
116
- event: n,
117
- day: S(e, i),
85
+ for (let r of e) {
86
+ if (r.allDay) {
87
+ let e = N(r.start), t = Math.max(1, Math.min(62, E(e, N(r.end))));
88
+ for (let a = 0; a < t; a++) i({
89
+ event: r,
90
+ day: C(e, a),
118
91
  allDay: !0,
119
92
  from: 0,
120
93
  to: 1440,
121
- label: "Dia inteiro"
94
+ label: n
122
95
  });
123
96
  continue;
124
97
  }
125
- let e = D(new Date(n.start), t), i = D(new Date(n.end), t);
126
- i.minutes === 0 && i.key !== e.key && (i = {
127
- key: S(i.key, -1),
98
+ let e = O(new Date(r.start), t), a = O(new Date(r.end), t);
99
+ a.minutes === 0 && a.key !== e.key && (a = {
100
+ key: C(a.key, -1),
128
101
  minutes: 1440
129
102
  });
130
- let a = e.key === i.key ? `${N(e.minutes)} – ${N(i.minutes)}` : `${N(e.minutes)}`, o = Math.max(0, Math.min(62, T(e.key, i.key)));
131
- for (let t = 0; t <= o; t++) r({
132
- event: n,
133
- day: S(e.key, t),
103
+ let o = e.key === a.key ? `${P(e.minutes)} – ${P(a.minutes)}` : `${P(e.minutes)}`, s = Math.max(0, Math.min(62, E(e.key, a.key)));
104
+ for (let t = 0; t <= s; t++) i({
105
+ event: r,
106
+ day: C(e.key, t),
134
107
  allDay: !1,
135
108
  from: t === 0 ? e.minutes : 0,
136
- to: t === o ? Math.max(i.minutes, t === 0 ? e.minutes : 0) : 1440,
137
- label: a
109
+ to: t === s ? Math.max(a.minutes, t === 0 ? e.minutes : 0) : 1440,
110
+ label: o
138
111
  });
139
112
  }
140
- for (let e of n.values()) e.sort((e, t) => Number(t.allDay) - Number(e.allDay) || e.from - t.from || t.to - e.to);
141
- return n;
113
+ for (let e of r.values()) e.sort((e, t) => Number(t.allDay) - Number(e.allDay) || e.from - t.from || t.to - e.to);
114
+ return r;
142
115
  }
143
- function F(e) {
116
+ function I(e) {
144
117
  let t = e.filter((e) => !e.allDay), n = [], r = [], i = -1, a = () => {
145
118
  let e = r.reduce((e, t) => Math.max(e, t.col + 1), 1);
146
119
  for (let t of r) n.push({
@@ -161,173 +134,335 @@ function F(e) {
161
134
  }
162
135
  return r.length && a(), n;
163
136
  }
164
- var I = (e) => e.color ? { "--select-cal-color": e.color } : void 0, L = (e) => e.status === "cancelled" ? " is-cancelled" : e.status === "tentative" ? " is-tentative" : "", R = (e) => `${e.event.title}, ${e.label}${e.event.status === "cancelled" ? ", cancelada" : e.event.status === "tentative" ? ", talvez" : ""}`;
165
- function z({ event: e }) {
166
- return e.status === "tentative" ? /* @__PURE__ */ u("span", {
137
+ var L = (e) => e.color ? { "--select-cal-color": e.color } : void 0, R = (e) => e.status === "cancelled" ? " is-cancelled" : e.status === "tentative" ? " is-tentative" : "", z = (e, t) => `${e.kind ? ` select-calendar__block--${e.kind}` : ""}${e.draft ? " is-draft" : ""}${t != null && e.id === t ? " is-selected" : ""}`, B = (e, t) => `${e.event.title}, ${e.label}${e.event.status === "cancelled" ? `, ${t.cancelled}` : e.event.status === "tentative" ? `, ${t.maybe}` : ""}${e.event.draft ? `, ${t.kinds.draft.toLowerCase()}` : ""}`;
138
+ function V({ event: e, t }) {
139
+ return e.status === "tentative" ? /* @__PURE__ */ p("span", {
167
140
  className: "select-calendar__maybe",
168
- children: "talvez"
141
+ children: t.maybe
169
142
  }) : null;
170
143
  }
171
- function B({ piece: e, onClick: t }) {
172
- let n = e.event;
173
- return /* @__PURE__ */ d(t ? "button" : "div", {
144
+ function H({ piece: e, onClick: t, t: n }) {
145
+ let r = e.event;
146
+ return /* @__PURE__ */ m(t ? "button" : "div", {
174
147
  ...t ? {
175
148
  type: "button",
176
- onClick: () => t(n.id)
149
+ onClick: () => t(r.id)
177
150
  } : {},
178
- className: `select-calendar__chip${e.allDay ? " select-calendar__chip--allday" : ""}${L(n)}`,
179
- style: I(n),
180
- "aria-label": R(e),
181
- title: R(e),
151
+ className: `select-calendar__chip${e.allDay ? " select-calendar__chip--allday" : ""}${R(r)}`,
152
+ style: L(r),
153
+ "aria-label": B(e, n),
154
+ title: B(e, n),
182
155
  children: [
183
- e.allDay ? null : /* @__PURE__ */ u("span", {
156
+ e.allDay ? null : /* @__PURE__ */ p("span", {
184
157
  className: "select-calendar__chiptime",
185
- children: N(e.from)
158
+ children: P(e.from)
186
159
  }),
187
- /* @__PURE__ */ u("span", {
160
+ /* @__PURE__ */ p("span", {
188
161
  className: "select-calendar__chiptitle",
189
- children: n.title
162
+ children: r.title
190
163
  }),
191
- /* @__PURE__ */ u(z, { event: n })
164
+ /* @__PURE__ */ p(V, {
165
+ event: r,
166
+ t: n
167
+ })
192
168
  ]
193
169
  });
194
170
  }
195
- function V({ n: e }) {
196
- return /* @__PURE__ */ d(l, { children: [`+${e}`, /* @__PURE__ */ u("span", {
171
+ function U({ n: e, t }) {
172
+ return /* @__PURE__ */ m(f, { children: [`+${e}`, /* @__PURE__ */ p("span", {
197
173
  className: "select-calendar__moreword",
198
- children: ` ${e === 1 ? "outro" : "outros"}`
174
+ children: ` ${t.others(e)}`
199
175
  })] });
200
176
  }
201
- function H(e, t, n) {
177
+ function W(e, t, n, r, i) {
202
178
  if (e === "month") {
203
- let [e, n] = x(t);
204
- return `${_[n - 1]} de ${e}`;
179
+ let [e, n] = S(t);
180
+ return r.monthTitle(n, e);
205
181
  }
206
- let [r, i, a] = x(n[0]), [o, s, c] = x(n[n.length - 1]);
207
- return r === o && i === s ? `${a} – ${c} de ${_[i - 1]} de ${o}` : r === o ? `${a} de ${v[i - 1]} – ${c} de ${v[s - 1]} de ${o}` : `${a} de ${v[i - 1]} de ${r} – ${c} de ${v[s - 1]} de ${o}`;
182
+ if (e === "day") return r.dayTitle(w(t), S(t));
183
+ let a = S(n[0]), o = S(n[n.length - 1]);
184
+ return i ? r.workWeekTitle(a, o) : r.weekTitle(a, o);
185
+ }
186
+ function G(e, t, n = {}) {
187
+ let r = n.messages ?? i["pt-BR"].calendar;
188
+ return W(e, t, j(e, t, n.weekStartsOn ?? 0, n.days ?? 7), r, e === "week" && n.days === 5);
208
189
  }
209
- function U({ view: a, date: s, events: c, onViewChange: p, onDateChange: m, onEventClick: h, onDayClick: g, timeZone: _ = f, weekStartsOn: v = 0, actions: y, loading: C = !1, scrollToHour: w = 8, className: T }) {
210
- let E = o(() => A(a, s, v), [
211
- a,
212
- s,
213
- v
214
- ]), D = o(() => P(c, _), [c, _]), O = k(_), [, j] = x(s), M = (e) => {
215
- if (m) {
216
- if (a === "week") m(S(s, 7 * e));
190
+ function K({ items: e = y, className: t }) {
191
+ let n = a().calendar;
192
+ return /* @__PURE__ */ p("ul", {
193
+ className: `select-calendar__legend${t ? " " + t : ""}`,
194
+ "aria-label": n.legend,
195
+ children: e.map((e) => /* @__PURE__ */ m("li", {
196
+ className: `select-calendar__legenditem select-calendar__legenditem--${e}`,
197
+ children: [/* @__PURE__ */ p("span", {
198
+ className: "select-calendar__swatch",
199
+ "aria-hidden": "true"
200
+ }), n.kinds[e]]
201
+ }, e))
202
+ });
203
+ }
204
+ function q({ view: t, date: i, events: c, onViewChange: u, onDateChange: d, onEventClick: g, onDayClick: _, timeZone: v = h, weekStartsOn: b = 0, actions: w, loading: T = !1, scrollToHour: E = 8, className: D, views: O = ["month", "week"], days: k = 7, tasks: M, onTaskClick: N, legend: P, selectedId: I, layout: L = "grid", bar: R = !0, dayHeader: z = "stacked" }) {
205
+ let B = a().calendar, V = k === 5 ? 5 : 7, H = l(() => j(t, i, b, V), [
206
+ t,
207
+ i,
208
+ b,
209
+ V
210
+ ]), U = l(() => F(c, v, B.allDay), [
211
+ c,
212
+ v,
213
+ B.allDay
214
+ ]), G = l(() => {
215
+ let e = /* @__PURE__ */ new Map();
216
+ for (let t of M ?? []) {
217
+ let n = e.get(t.date);
218
+ n ? n.push(t) : e.set(t.date, [t]);
219
+ }
220
+ return e;
221
+ }, [M]), q = A(v), [, ee] = S(i), Q = P === !0 ? y : Array.isArray(P) ? P : null, $ = (e) => {
222
+ if (d) {
223
+ if (t === "week") d(C(i, 7 * e));
224
+ else if (t === "day") d(C(i, e));
217
225
  else {
218
- let [t, n] = x(s);
219
- m(b(t, n + e, 1));
226
+ let [t, n] = S(i);
227
+ d(x(t, n + e, 1));
220
228
  }
221
229
  }
222
- };
223
- return /* @__PURE__ */ d("div", {
224
- className: `select-calendar${C ? " is-loading" : ""}${T ? " " + T : ""}`,
225
- "aria-busy": C || void 0,
226
- children: [/* @__PURE__ */ d("div", {
227
- className: "select-calendar__bar",
228
- children: [/* @__PURE__ */ d("div", {
229
- className: "select-calendar__nav",
230
- children: [m ? /* @__PURE__ */ d(l, { children: [
231
- /* @__PURE__ */ u(i, {
232
- icon: /* @__PURE__ */ u(t, {}),
233
- label: a === "week" ? "Semana anterior" : "Mês anterior",
234
- variant: "outline",
235
- size: "sm",
236
- onClick: () => M(-1)
237
- }),
238
- /* @__PURE__ */ u(i, {
239
- icon: /* @__PURE__ */ u(n, {}),
240
- label: a === "week" ? "Próxima semana" : "Próximo mês",
241
- variant: "outline",
242
- size: "sm",
243
- onClick: () => M(1)
230
+ }, te = t === "week" ? B.prevWeek : t === "day" ? B.prevDay : B.prevMonth, ne = t === "week" ? B.nextWeek : t === "day" ? B.nextDay : B.nextMonth;
231
+ return /* @__PURE__ */ m("div", {
232
+ className: `select-calendar${T ? " is-loading" : ""}${L === "list" ? " select-calendar--list" : ""}${D ? " " + D : ""}`,
233
+ "aria-busy": T || void 0,
234
+ style: { "--select-cal-days": String(t === "day" ? 1 : V) },
235
+ children: [
236
+ R ? /* @__PURE__ */ m("div", {
237
+ className: "select-calendar__bar",
238
+ children: [/* @__PURE__ */ m("div", {
239
+ className: "select-calendar__nav",
240
+ children: [d ? /* @__PURE__ */ m(f, { children: [
241
+ /* @__PURE__ */ p(s, {
242
+ icon: /* @__PURE__ */ p(n, {}),
243
+ label: te,
244
+ variant: "outline",
245
+ size: "sm",
246
+ onClick: () => $(-1)
247
+ }),
248
+ /* @__PURE__ */ p(s, {
249
+ icon: /* @__PURE__ */ p(r, {}),
250
+ label: ne,
251
+ variant: "outline",
252
+ size: "sm",
253
+ onClick: () => $(1)
254
+ }),
255
+ /* @__PURE__ */ p(e, {
256
+ variant: "secondary",
257
+ size: "sm",
258
+ inline: !0,
259
+ onClick: () => d(q),
260
+ children: B.today
261
+ })
262
+ ] }) : null, /* @__PURE__ */ p("h3", {
263
+ className: "select-calendar__title",
264
+ "aria-live": "polite",
265
+ children: W(t, i, H, B, t === "week" && V === 5)
266
+ })]
267
+ }), /* @__PURE__ */ m("div", {
268
+ className: "select-calendar__tools",
269
+ children: [w, u ? /* @__PURE__ */ p(o, {
270
+ value: t,
271
+ onChange: (e) => u(e),
272
+ options: O.map((e) => ({
273
+ value: e,
274
+ label: B.views[e]
275
+ })),
276
+ ariaLabel: B.viewLabel
277
+ }) : null]
278
+ })]
279
+ }) : null,
280
+ Q ? /* @__PURE__ */ p(K, {
281
+ items: Q,
282
+ className: "select-calendar__legend--top"
283
+ }) : null,
284
+ t === "day" && d ? /* @__PURE__ */ p(J, {
285
+ date: i,
286
+ today: q,
287
+ weekStartsOn: b,
288
+ count: V,
289
+ onDateChange: d,
290
+ t: B
291
+ }) : null,
292
+ t === "month" ? /* @__PURE__ */ p(X, {
293
+ days: H,
294
+ month: ee,
295
+ today: q,
296
+ pieces: U,
297
+ onEventClick: g,
298
+ onDayClick: _,
299
+ t: B
300
+ }) : L === "list" ? /* @__PURE__ */ p(Y, {
301
+ days: H,
302
+ today: q,
303
+ pieces: U,
304
+ onEventClick: g,
305
+ selectedId: I,
306
+ t: B
307
+ }) : /* @__PURE__ */ p(Z, {
308
+ days: H,
309
+ today: q,
310
+ pieces: U,
311
+ timeZone: v,
312
+ onEventClick: g,
313
+ scrollToHour: E,
314
+ tasksByDay: M ? G : null,
315
+ onTaskClick: N,
316
+ selectedId: I,
317
+ inlineHead: z === "inline",
318
+ t: B
319
+ })
320
+ ]
321
+ });
322
+ }
323
+ function J({ date: e, today: t, weekStartsOn: n, count: r, onDateChange: i, t: a }) {
324
+ let o = T(e, n), s = Array.from({ length: r }, (e, t) => C(o, t));
325
+ return /* @__PURE__ */ p("div", {
326
+ className: "select-calendar__daystrip",
327
+ role: "group",
328
+ "aria-label": a.weekDays,
329
+ children: s.map((n) => {
330
+ let [, r, o] = S(n), s = n === e;
331
+ return /* @__PURE__ */ m("button", {
332
+ type: "button",
333
+ className: `select-calendar__stripday${s ? " is-selected" : ""}${n === t ? " is-today" : ""}`,
334
+ "aria-pressed": s,
335
+ "aria-label": `${a.dow[w(n)]}, ${a.dayLabel(r, o)}`,
336
+ onClick: () => i(n),
337
+ children: [/* @__PURE__ */ p("span", {
338
+ className: "select-calendar__stripdow",
339
+ children: a.dow[w(n)]
340
+ }), /* @__PURE__ */ p("span", {
341
+ className: "select-calendar__stripnum",
342
+ children: o
343
+ })]
344
+ }, n);
345
+ })
346
+ });
347
+ }
348
+ function Y({ days: e, today: t, pieces: n, onEventClick: r, selectedId: i, t: a }) {
349
+ return /* @__PURE__ */ p("div", {
350
+ className: "select-calendar__list",
351
+ children: e.map((e) => {
352
+ let o = n.get(e) ?? [], [, s, c] = S(e), l = e === t;
353
+ return /* @__PURE__ */ m("section", {
354
+ className: `select-calendar__listday${l ? " is-today" : ""}`,
355
+ "aria-label": `${a.dow[w(e)]}, ${a.dayLabel(s, c)}`,
356
+ children: [
357
+ /* @__PURE__ */ m("span", {
358
+ className: "select-calendar__listhead",
359
+ "aria-hidden": "true",
360
+ children: [
361
+ /* @__PURE__ */ p("span", {
362
+ className: "select-calendar__listdow",
363
+ children: a.dow[w(e)]
364
+ }),
365
+ /* @__PURE__ */ p("span", {
366
+ className: "select-calendar__listdate",
367
+ children: a.dayShort(s, c)
368
+ }),
369
+ l ? /* @__PURE__ */ p("span", {
370
+ className: "select-calendar__listtoday",
371
+ children: a.todayTag
372
+ }) : null
373
+ ]
244
374
  }),
245
- /* @__PURE__ */ u(e, {
246
- variant: "secondary",
247
- size: "sm",
248
- inline: !0,
249
- onClick: () => m(O),
250
- children: "Hoje"
375
+ o.length === 0 ? /* @__PURE__ */ p("span", {
376
+ className: "select-calendar__listempty",
377
+ children: a.empty
378
+ }) : null,
379
+ o.map((e) => {
380
+ var t;
381
+ let n = e.event, o = r ? "button" : "div", s = ((t = n.tag) == null ? void 0 : t.tone) ?? "neutral";
382
+ return /* @__PURE__ */ m(o, {
383
+ ...r ? {
384
+ type: "button",
385
+ onClick: () => r(n.id)
386
+ } : {},
387
+ className: `select-calendar__card select-calendar__card--${s}${z(n, i)}${R(n)}`,
388
+ "aria-current": i != null && n.id === i || void 0,
389
+ style: L(n),
390
+ children: [
391
+ /* @__PURE__ */ m("span", {
392
+ className: "select-calendar__cardtop",
393
+ children: [/* @__PURE__ */ p("span", {
394
+ className: "select-calendar__cardtime",
395
+ children: e.allDay ? a.allDay : P(e.from)
396
+ }), n.marks == null ? null : /* @__PURE__ */ p("span", {
397
+ className: "select-calendar__cardmarks",
398
+ children: n.marks
399
+ })]
400
+ }),
401
+ /* @__PURE__ */ p("span", {
402
+ className: "select-calendar__cardtitle",
403
+ children: n.title
404
+ }),
405
+ n.tag ? /* @__PURE__ */ p("span", {
406
+ className: `select-calendar__cardtag select-calendar__cardtag--${s}`,
407
+ children: n.tag.label
408
+ }) : null
409
+ ]
410
+ }, n.id);
251
411
  })
252
- ] }) : null, /* @__PURE__ */ u("h3", {
253
- className: "select-calendar__title",
254
- "aria-live": "polite",
255
- children: H(a, s, E)
256
- })]
257
- }), /* @__PURE__ */ d("div", {
258
- className: "select-calendar__tools",
259
- children: [y, p ? /* @__PURE__ */ u(r, {
260
- value: a,
261
- onChange: (e) => p(e),
262
- options: [{
263
- value: "month",
264
- label: "Mês"
265
- }, {
266
- value: "week",
267
- label: "Semana"
268
- }],
269
- ariaLabel: "Vista da agenda"
270
- }) : null]
271
- })]
272
- }), a === "month" ? /* @__PURE__ */ u(W, {
273
- days: E,
274
- month: j,
275
- today: O,
276
- pieces: D,
277
- onEventClick: h,
278
- onDayClick: g
279
- }) : /* @__PURE__ */ u(G, {
280
- days: E,
281
- today: O,
282
- pieces: D,
283
- timeZone: _,
284
- onEventClick: h,
285
- scrollToHour: w
286
- })]
412
+ ]
413
+ }, e);
414
+ })
287
415
  });
288
416
  }
289
- function W({ days: e, month: t, today: n, pieces: r, onEventClick: i, onDayClick: a }) {
290
- return /* @__PURE__ */ d("div", {
417
+ function X({ days: e, month: t, today: n, pieces: r, onEventClick: i, onDayClick: a, t: o }) {
418
+ return /* @__PURE__ */ m("div", {
291
419
  className: "select-calendar__month",
292
- children: [/* @__PURE__ */ u("div", {
420
+ children: [/* @__PURE__ */ p("div", {
293
421
  className: "select-calendar__dows",
294
422
  "aria-hidden": "true",
295
- children: e.slice(0, 7).map((e) => /* @__PURE__ */ u("span", {
423
+ children: e.slice(0, 7).map((e) => /* @__PURE__ */ p("span", {
296
424
  className: "select-calendar__dow",
297
- children: g[C(e)]
425
+ children: o.dow[w(e)]
298
426
  }, e))
299
- }), /* @__PURE__ */ u("div", {
427
+ }), /* @__PURE__ */ p("div", {
300
428
  className: "select-calendar__cells",
301
429
  role: "list",
302
430
  children: e.map((e) => {
303
- let o = r.get(e) ?? [], s = o.length > m ? o.slice(0, 2) : o, c = o.length - s.length, [, l, f] = x(e), p = `${f} de ${_[l - 1]}${o.length ? `, ${o.length} ${o.length === 1 ? "evento" : "eventos"}` : ""}`;
304
- return /* @__PURE__ */ d("div", {
431
+ let s = r.get(e) ?? [], c = s.length > _ ? s.slice(0, 2) : s, l = s.length - c.length, [, u, d] = S(e), f = `${o.dayLabel(u, d)}${s.length ? `, ${o.events(s.length)}` : ""}`;
432
+ return /* @__PURE__ */ m("div", {
305
433
  role: "listitem",
306
- "aria-label": p,
307
- className: `select-calendar__cell${l === t ? "" : " select-calendar__cell--out"}${e === n ? " select-calendar__cell--today" : ""}`,
308
- children: [a ? /* @__PURE__ */ u("button", {
434
+ "aria-label": f,
435
+ className: `select-calendar__cell${u === t ? "" : " select-calendar__cell--out"}${e === n ? " select-calendar__cell--today" : ""}`,
436
+ children: [a ? /* @__PURE__ */ p("button", {
309
437
  type: "button",
310
438
  className: "select-calendar__daynum",
311
439
  onClick: () => a(e),
312
- "aria-label": `Ver a semana de ${f} de ${_[l - 1]}`,
313
- children: f
314
- }) : /* @__PURE__ */ u("span", {
440
+ "aria-label": o.seeWeek(o.dayLabel(u, d)),
441
+ children: d
442
+ }) : /* @__PURE__ */ p("span", {
315
443
  className: "select-calendar__daynum",
316
- children: f
317
- }), /* @__PURE__ */ d("div", {
444
+ children: d
445
+ }), /* @__PURE__ */ m("div", {
318
446
  className: "select-calendar__dayevents",
319
- children: [s.map((t) => /* @__PURE__ */ u(B, {
447
+ children: [c.map((t) => /* @__PURE__ */ p(H, {
320
448
  piece: t,
321
- onClick: i
322
- }, `${t.event.id}:${e}`)), c > 0 ? a ? /* @__PURE__ */ u("button", {
449
+ onClick: i,
450
+ t: o
451
+ }, `${t.event.id}:${e}`)), l > 0 ? a ? /* @__PURE__ */ p("button", {
323
452
  type: "button",
324
453
  className: "select-calendar__more",
325
454
  onClick: () => a(e),
326
- "aria-label": `Mais ${c} em ${f} de ${_[l - 1]}`,
327
- children: /* @__PURE__ */ u(V, { n: c })
328
- }) : /* @__PURE__ */ u("span", {
455
+ "aria-label": o.moreIn(l, o.dayLabel(u, d)),
456
+ children: /* @__PURE__ */ p(U, {
457
+ n: l,
458
+ t: o
459
+ })
460
+ }) : /* @__PURE__ */ p("span", {
329
461
  className: "select-calendar__more",
330
- children: /* @__PURE__ */ u(V, { n: c })
462
+ children: /* @__PURE__ */ p(U, {
463
+ n: l,
464
+ t: o
465
+ })
331
466
  }) : null]
332
467
  })]
333
468
  }, e);
@@ -335,107 +470,142 @@ function W({ days: e, month: t, today: n, pieces: r, onEventClick: i, onDayClick
335
470
  })]
336
471
  });
337
472
  }
338
- function G({ days: e, today: t, pieces: n, timeZone: r, onEventClick: i, scrollToHour: o }) {
339
- let l = s(null), [f, p] = c(() => D(/* @__PURE__ */ new Date(), r).minutes);
340
- a(() => {
341
- let e = l.current;
473
+ function Z({ days: e, today: n, pieces: r, timeZone: i, onEventClick: a, scrollToHour: o, tasksByDay: s, onTaskClick: l, selectedId: h, inlineHead: g = !1, t: _ }) {
474
+ let y = u(null), [x, C] = d(() => O(/* @__PURE__ */ new Date(), i).minutes);
475
+ c(() => {
476
+ let e = y.current;
342
477
  if (!e) return;
343
478
  let t = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
344
- e.scrollTop = Math.max(0, o * h * t - t);
345
- }, [o]), a(() => {
346
- let e = setInterval(() => p(D(/* @__PURE__ */ new Date(), r).minutes), 6e4);
479
+ e.scrollTop = Math.max(0, o * v * t - t);
480
+ }, [o]), c(() => {
481
+ let e = setInterval(() => C(O(/* @__PURE__ */ new Date(), i).minutes), 6e4);
347
482
  return () => clearInterval(e);
348
- }, [r]);
349
- let m = e.some((e) => (n.get(e) ?? []).some((e) => e.allDay));
350
- return /* @__PURE__ */ d("div", {
483
+ }, [i]);
484
+ let T = e.some((e) => (r.get(e) ?? []).some((e) => e.allDay));
485
+ return /* @__PURE__ */ m("div", {
351
486
  className: "select-calendar__week",
352
487
  children: [
353
- /* @__PURE__ */ d("div", {
354
- className: "select-calendar__weekhead",
355
- children: [/* @__PURE__ */ u("span", {
488
+ /* @__PURE__ */ m("div", {
489
+ className: `select-calendar__weekhead${g ? " select-calendar__weekhead--inline" : ""}`,
490
+ children: [/* @__PURE__ */ p("span", {
356
491
  className: "select-calendar__gutter",
357
492
  "aria-hidden": "true"
358
493
  }), e.map((e) => {
359
- let [, , n] = x(e);
360
- return /* @__PURE__ */ d("span", {
361
- className: `select-calendar__weekday${e === t ? " select-calendar__weekday--today" : ""}`,
362
- children: [/* @__PURE__ */ u("span", {
494
+ let [, t, r] = S(e);
495
+ return /* @__PURE__ */ p("span", {
496
+ className: `select-calendar__weekday${e === n ? " select-calendar__weekday--today" : ""}`,
497
+ children: g ? /* @__PURE__ */ m(f, { children: [
498
+ /* @__PURE__ */ p("span", {
499
+ className: "select-calendar__weekdow",
500
+ children: _.dowAbbr[w(e)]
501
+ }),
502
+ " ",
503
+ /* @__PURE__ */ p("span", {
504
+ className: "select-calendar__weekdate",
505
+ children: _.dayShort(t, r)
506
+ })
507
+ ] }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", {
363
508
  className: "select-calendar__weekdow",
364
- children: g[C(e)]
365
- }), /* @__PURE__ */ u("span", {
509
+ children: _.dow[w(e)]
510
+ }), /* @__PURE__ */ p("span", {
366
511
  className: "select-calendar__weeknum",
367
- children: n
368
- })]
512
+ children: r
513
+ })] })
369
514
  }, e);
370
515
  })]
371
516
  }),
372
- m ? /* @__PURE__ */ d("div", {
517
+ s ? /* @__PURE__ */ m("div", {
518
+ className: "select-calendar__tasksrow",
519
+ children: [/* @__PURE__ */ p("span", {
520
+ className: "select-calendar__gutter select-calendar__gutter--label",
521
+ children: _.tasks
522
+ }), e.map((e) => /* @__PURE__ */ p("div", {
523
+ className: "select-calendar__tasks",
524
+ children: (s.get(e) ?? []).map((e) => /* @__PURE__ */ m(l ? "button" : "div", {
525
+ ...l ? {
526
+ type: "button",
527
+ onClick: () => l(e.id)
528
+ } : {},
529
+ className: "select-calendar__task",
530
+ children: [/* @__PURE__ */ p("span", {
531
+ className: "select-calendar__taskicon",
532
+ "aria-hidden": "true",
533
+ children: /* @__PURE__ */ p(t, {})
534
+ }), /* @__PURE__ */ m("span", {
535
+ className: "select-calendar__tasktext",
536
+ children: [/* @__PURE__ */ p("strong", { children: e.title }), e.deal ? ` · ${e.deal}` : ""]
537
+ })]
538
+ }, e.id))
539
+ }, e))]
540
+ }) : null,
541
+ T ? /* @__PURE__ */ m("div", {
373
542
  className: "select-calendar__alldayrow",
374
- children: [/* @__PURE__ */ u("span", {
543
+ children: [/* @__PURE__ */ p("span", {
375
544
  className: "select-calendar__gutter select-calendar__gutter--label",
376
- children: "dia inteiro"
377
- }), e.map((e) => /* @__PURE__ */ u("div", {
545
+ children: _.allDayRow
546
+ }), e.map((e) => /* @__PURE__ */ p("div", {
378
547
  className: "select-calendar__allday",
379
- children: (n.get(e) ?? []).filter((e) => e.allDay).map((e) => /* @__PURE__ */ u(B, {
548
+ children: (r.get(e) ?? []).filter((e) => e.allDay).map((e) => /* @__PURE__ */ p(H, {
380
549
  piece: e,
381
- onClick: i
550
+ onClick: a,
551
+ t: _
382
552
  }, e.event.id))
383
553
  }, e))]
384
554
  }) : null,
385
- /* @__PURE__ */ u("div", {
555
+ /* @__PURE__ */ p("div", {
386
556
  className: "select-calendar__scroll",
387
- ref: l,
388
- children: /* @__PURE__ */ d("div", {
557
+ ref: y,
558
+ children: /* @__PURE__ */ m("div", {
389
559
  className: "select-calendar__timegrid",
390
560
  style: { height: "72rem" },
391
- children: [/* @__PURE__ */ u("div", {
561
+ children: [/* @__PURE__ */ p("div", {
392
562
  className: "select-calendar__gutter",
393
563
  "aria-hidden": "true",
394
- children: Array.from({ length: 24 }, (e, t) => /* @__PURE__ */ u("span", {
564
+ children: Array.from({ length: 24 }, (e, t) => /* @__PURE__ */ p("span", {
395
565
  className: "select-calendar__hour",
396
- style: { top: `${t * h}rem` },
397
- children: t === 0 ? "" : `${y(t)}:00`
566
+ style: { top: `${t * v}rem` },
567
+ children: t === 0 ? "" : `${b(t)}:00`
398
568
  }, t))
399
- }), e.map((e) => /* @__PURE__ */ d("div", {
400
- className: `select-calendar__col${e === t ? " select-calendar__col--today" : ""}`,
401
- children: [F(n.get(e) ?? []).map(({ piece: e, col: t, cols: n }) => {
402
- let r = e.event, a = Math.max(e.to - e.from, 20), o = {
403
- ...I(r),
404
- top: `${e.from / 60 * h}rem`,
405
- height: `${a / 60 * h}rem`,
569
+ }), e.map((e) => /* @__PURE__ */ m("div", {
570
+ className: `select-calendar__col${e === n ? " select-calendar__col--today" : ""}`,
571
+ children: [I(r.get(e) ?? []).map(({ piece: e, col: t, cols: n }) => {
572
+ let r = e.event, i = Math.max(e.to - e.from, 20), o = {
573
+ ...L(r),
574
+ top: `${e.from / 60 * v}rem`,
575
+ height: `${i / 60 * v}rem`,
406
576
  left: `calc(${t / n * 100}% + 2px)`,
407
577
  width: `calc(${100 / n}% - 4px)`
408
578
  };
409
- return /* @__PURE__ */ d(i ? "button" : "div", {
410
- ...i ? {
579
+ return /* @__PURE__ */ m(a ? "button" : "div", {
580
+ ...a ? {
411
581
  type: "button",
412
- onClick: () => i(r.id)
582
+ onClick: () => a(r.id)
413
583
  } : {},
414
- className: `select-calendar__block${a < 45 ? " select-calendar__block--short" : ""}${L(r)}`,
584
+ className: `select-calendar__block${i < 60 ? " select-calendar__block--short" : ""}${R(r)}${z(r, h)}`,
415
585
  style: o,
416
- "aria-label": R(e),
417
- title: R(e),
418
- children: [
419
- /* @__PURE__ */ d("span", {
420
- className: "select-calendar__blocktitle",
421
- children: [/* @__PURE__ */ u("span", {
422
- className: "select-calendar__blockname",
423
- children: r.title
424
- }), /* @__PURE__ */ u(z, { event: r })]
425
- }),
426
- /* @__PURE__ */ u("span", {
427
- className: "select-calendar__blocktime",
428
- children: e.label
429
- }),
430
- r.detail && a >= 60 ? /* @__PURE__ */ u("span", {
586
+ "aria-label": B(e, _),
587
+ "aria-current": h != null && r.id === h || void 0,
588
+ title: B(e, _),
589
+ children: [/* @__PURE__ */ m("span", {
590
+ className: "select-calendar__blocktitle",
591
+ children: [/* @__PURE__ */ p("span", {
592
+ className: "select-calendar__blockname",
593
+ children: r.title
594
+ }), /* @__PURE__ */ p(V, {
595
+ event: r,
596
+ t: _
597
+ })]
598
+ }), /* @__PURE__ */ m("span", {
599
+ className: "select-calendar__blocktime",
600
+ children: [e.label, r.detail ? /* @__PURE__ */ p("span", {
431
601
  className: "select-calendar__blockdetail",
432
- children: r.detail
433
- }) : null
434
- ]
602
+ children: ` · ${r.detail}`
603
+ }) : null]
604
+ })]
435
605
  }, r.id);
436
- }), e === t ? /* @__PURE__ */ u("span", {
606
+ }), e === n ? /* @__PURE__ */ p("span", {
437
607
  className: "select-calendar__now",
438
- style: { top: `${f / 60 * h}rem` },
608
+ style: { top: `${x / 60 * v}rem` },
439
609
  "aria-hidden": "true"
440
610
  }) : null]
441
611
  }, e))]
@@ -445,6 +615,6 @@ function G({ days: e, today: t, pieces: n, timeZone: r, onEventClick: i, scrollT
445
615
  });
446
616
  }
447
617
  //#endregion
448
- export { U as SelectCalendar, j as calendarRange, k as calendarToday };
618
+ export { q as SelectCalendar, K as SelectCalendarLegend, M as calendarRange, G as calendarTitle, A as calendarToday };
449
619
 
450
620
  //# sourceMappingURL=SelectCalendar.js.map