@selectwin/kit 0.1.266 → 0.1.268

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -57,7 +57,7 @@ embaixo). O item aceso usa `--select-appdock-active` e `--select-appdock-active-
57
57
  Peer deps: **react**, **react-dom** (obrigatórios); **gsap** (opcional — só componentes animados),
58
58
  **react-router-dom** (opcional). Tematização = sobrescrever os tokens CSS `--select-*` / `--sw-*`.
59
59
 
60
- As peças do chat (0.1.254, o inbox do WhatsApp da SWMX): o `SelectConversationBubble` ganha a citação (`quote`, o
60
+ As peças do chat (0.1.254, o inbox do WhatsApp de um painel): o `SelectConversationBubble` ganha a citação (`quote`, o
61
61
  `SelectConversationQuote`, que também é a faixa "Respondendo a…" do compositor), a hora e o estado DENTRO do balão
62
62
  (`stamp`, com o `SelectMessageTicks`: relógio, ✓, ✓✓, ✓✓ na cor da marca, alerta), as reações presas na borda (`reactions`,
63
63
  o `SelectConversationReactions`), a barra de ações (`actions`), o tom do que não saiu (`tone`) e a borda fina dos cartões
@@ -67,7 +67,7 @@ onda, a posição pelo teclado, 1× · 1,5× · 2×), o `SelectAudioRecorder` (o
67
67
  grava; o `onSend` entrega o arquivo e o tipo), o `SelectChatSendButton` (enviar ou gravar), os cartões
68
68
  (`SelectLocationCard`, `SelectContactCard`, `SelectTemplateMessage` com as variáveis em destaque, `SelectInteractiveMessage`
69
69
  com os botões, a lista e o link, `SelectDocumentCard`, `SelectMediaAlbum`), o `SelectLightbox` e o `SelectAttachMenu`
70
- (popover no computador, folha de baixo no celular). O balão de quem envia sai do acento do app — na SWMX, o petróleo claro,
70
+ (popover no computador, folha de baixo no celular). O balão de quem envia sai do acento do app — num painel com o acento petróleo, o petróleo claro,
71
71
  não o verde do WhatsApp; os tons do chat se trocam pelos `--select-chat-*` (a lista está no `select.css`, no bloco da
72
72
  0.1.254).
73
73
 
@@ -86,7 +86,7 @@ tela, a barra e o trilho ficam parados e a página rola no invólucro do `Select
86
86
  trilho, com a barra na borda do painel. O `scrollRef` do painel entrega o invólucro (para voltar ao topo na troca de
87
87
  página), e o `fill` serve à página de altura cheia: a coluna da página tem a altura do invólucro e é uma coluna flex.
88
88
 
89
- A nota interna e a lista do "/" e da "@" (0.1.257, o CRM sobre o Chat da SWMX; as pranchas O-Inbox e C-Mobile do
89
+ A nota interna e a lista do "/" e da "@" (0.1.257, o CRM sobre o Chat; as pranchas O-Inbox e C-Mobile do
90
90
  canvas do CRM): o `SelectConversationNote` é a nota entre as mensagens, do lado de quem responde, no fundo de aviso com a
91
91
  borda tracejada, o cadeado e "Nota interna · só a equipe vê" em cima e, no pé, quem escreveu, a hora e quem foi avisado;
92
92
  o `SelectMentionText` (com o `SelectMention` e o `selectMentionParts`) destaca cada "@nome" no começo de uma palavra, sem
@@ -277,7 +277,7 @@ novos estão no `SelectLocale`, em pt-BR e en.
277
277
 
278
278
  Os três detalhes da barra de ações do balão (0.1.264; o dono, depois da 0.1.262). A barra do balão que abre a conversa
279
279
  (sem nada em cima dele, nem o dia) sai embaixo dele na conversa estreita e no celular: em cima ela passava do topo da
280
- área que rola. Com o dia em cima, como no Chat da SWMX, ela fica em cima, como nas pranchas. Pelo foco, a barra só fica
280
+ área que rola. Com o dia em cima, como no Chat de um painel, ela fica em cima, como nas pranchas. Pelo foco, a barra só fica
281
281
  com o foco visível (`:has(:focus-visible)`; o `:focus-within` só no navegador sem o `:has()`), e o `SelectPopover` aberto
282
282
  pelo ponteiro e fechado só com o Esc devolve o foco ao gatilho sem o anel (`focusVisible: false`): quem usa o mouse vê a
283
283
  barra sumir quando o ponteiro sai do balão; quem usa o teclado (ou anda pelo painel com as setas e o Tab) segue com o anel
@@ -286,13 +286,40 @@ e a barra. E o gatilho de painel no `SelectIconButton` (com `aria-expanded`) gua
286
286
 
287
287
  O selo do canal sozinho (0.1.265): `SelectChannelBadge` (`channel`, `label?`, `className?`) é o mesmo círculo de 16 px do
288
288
  rosto da lista do Chat (o ícone na cor do canal, na superfície, com o filete), fora do canto do rosto e na linha do texto
289
- (`select-maillist__channel--inline`: `position: static`, sem encolher). É o da lista das campanhas da SWMX, antes do
289
+ (`select-maillist__channel--inline`: `position: static`, sem encolher). É o da lista das campanhas, antes do
290
290
  nome. Sem `label`, o leitor de tela ouve o nome do canal no idioma do kit; o `className` é só o lugar na linha de quem usa
291
291
  (o `mt-*` que alinha o selo à primeira linha). O selo no rosto do `SelectMailListItem` segue igual.
292
292
 
293
293
  Os ícones de desfazer e refazer (0.1.266): `UndoIcon` e `RedoIcon`, para o histórico dos editores (o
294
294
  desfazer e o refazer da faixa do editor de e-mail), no padrão dos outros ícones (`currentColor`, `aria-hidden`).
295
295
 
296
+ As peças da agenda, dos relatórios e do compositor do CRM (0.1.267), nenhuma muda quem não as liga. O "Quando" de um
297
+ campo só, `SelectWhenField` (`value: { start, minutes }`, `onChange`, `durations?`, `minDate?`, `maxDate?`, `label`,
298
+ `error`, `hint`, `disabled`): o dia, a hora de começar e a de terminar lidos como uma frase ("19/11, 15:00 às 15:45"; o
299
+ ano só quando não é o deste ano), no popover do campo de data com o "Começa" e o "Termina" (a hora do fim com a duração,
300
+ "15:45 (45 min)"); o `start` é o relógio da parede (`'YYYY-MM-DDTHH:mm'`), e a duração que não está nas `durations` entra
301
+ na lista (`SELECT_WHEN_DURATIONS`: 15, 30, 45, 60, 90 e 120). A agenda sem a caixa da grade, `SelectCalendar bare`, para
302
+ o corpo de uma `SelectSection`. A faixa dos números numa linha, `SelectKpiBand columns` de 5 a 8: todos lado a lado da
303
+ janela de 1.200 px para cima, a quebra de sempre no meio e dois por linha no celular, com o que sobra esticando. No
304
+ compositor: `SelectMailComposer fill` é a folha de tela cheia (a altura que sobra no pai, os campos que rolam por dentro,
305
+ o rodapé preso embaixo com o "Enviar" na ponta direita), com o `above` do `SelectMailComposerFooter` para a linha logo
306
+ acima do rodapé; e `narrow` (`'auto'` ou `true`) no `variant="chat"` é o modo estreito: abaixo de 27rem da largura do
307
+ próprio compositor, o campo sobe para a linha de cima e as ferramentas ficam embaixo, e a dica do campo não quebra.
308
+
309
+ Os ajustes da varredura visual e a mesma barra de rolagem em tudo (0.1.268). O campo de um mês, `SelectMonthField`
310
+ (`value` e `onChange` em `'AAAA-MM'`, `min?`, `max?`, `label`, `placeholder`, `required`, `disabled`, `error`, `hint`,
311
+ `clearable?`, `name?`): o mês na língua do `SelectLocaleProvider` ("dezembro de 2026" / "December 2026"), na grade dos
312
+ doze meses do `SelectDateField` (o rótulo do ano abre a grade dos anos; os meses fora do `min`/`max` apagados; o "Este
313
+ mês" e o "Limpar"), no lugar do `<input type="month">`, que segue a língua do navegador e não a do app. O
314
+ `SelectDateField` também passa a seguir o provider (os dias, os meses, as setas, o pé e a ordem da data); sem provider, o
315
+ português de sempre. O título do cartão, da tabela e da lista lê a base e o piso de dois tokens, `--select-heading-basis`
316
+ (padrão `12rem`) e `--select-heading-min` (padrão `0`): sem eles nada muda; com `0px` e `min-content`, a ação fica na
317
+ linha do título sempre que a palavra mais longa do título cabe ao lado dela. A tabela sem moldura, `SelectTable bare`,
318
+ para o meio de outro conteúdo do corpo de um cartão ou de um modal: o cabeçalho das colunas e os filetes, sem a caixa
319
+ branca com a borda. Toda peça do kit que rola desenha a barra do scroll padrão (a fina, no polegar do token, também no
320
+ WebKit), pela regra `:where([class*='select-'])`, sem peso: a peça que esconde a barra continua escondendo. E o
321
+ `SelectScrollArea gutter="auto"` não guarda a calha (a lista curta de um menu).
322
+
296
323
  ## Build
297
324
 
298
325
  ```bash
@@ -84,6 +84,12 @@ export interface SelectCalendarProps {
84
84
  * negrito).
85
85
  */
86
86
  dayHeader?: 'stacked' | 'inline';
87
+ /**
88
+ * 0.1.267: sem a caixa da grade (o fundo, o filete e o canto), para a agenda que mora no corpo de uma `SelectSection`:
89
+ * a grade fica direto na caixa branca do cartão, sem uma caixa dentro da outra. As linhas de dentro da grade ficam.
90
+ * Fora de um cartão, deixe sem: a grade precisa da caixa dela.
91
+ */
92
+ bare?: boolean;
87
93
  }
88
94
  /** Hoje no fuso da grade ('YYYY-MM-DD'). */
89
95
  export declare function calendarToday(timeZone?: string): string;
@@ -115,4 +121,4 @@ export declare function SelectCalendarLegend({ items, className }: {
115
121
  items?: SelectCalendarLegendItem[];
116
122
  className?: string;
117
123
  }): import("react").JSX.Element;
118
- export declare function SelectCalendar({ view, date, events, onViewChange, onDateChange, onEventClick, onDayClick, timeZone, weekStartsOn, actions, loading, scrollToHour, className, views, days: weekDays, tasks, onTaskClick, legend, selectedId, layout, bar, dayHeader, }: SelectCalendarProps): import("react").JSX.Element;
124
+ export declare function SelectCalendar({ view, date, events, onViewChange, onDateChange, onEventClick, onDayClick, timeZone, weekStartsOn, actions, loading, scrollToHour, className, views, days: weekDays, tasks, onTaskClick, legend, selectedId, layout, bar, dayHeader, bare, }: SelectCalendarProps): import("react").JSX.Element;
@@ -201,24 +201,24 @@ function K({ items: e = y, className: t }) {
201
201
  }, e))
202
202
  });
203
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), [
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", bare: B = !1 }) {
205
+ let V = a().calendar, H = k === 5 ? 5 : 7, U = l(() => j(t, i, b, H), [
206
206
  t,
207
207
  i,
208
208
  b,
209
- V
210
- ]), U = l(() => F(c, v, B.allDay), [
209
+ H
210
+ ]), G = l(() => F(c, v, V.allDay), [
211
211
  c,
212
212
  v,
213
- B.allDay
214
- ]), G = l(() => {
213
+ V.allDay
214
+ ]), q = l(() => {
215
215
  let e = /* @__PURE__ */ new Map();
216
216
  for (let t of M ?? []) {
217
217
  let n = e.get(t.date);
218
218
  n ? n.push(t) : e.set(t.date, [t]);
219
219
  }
220
220
  return e;
221
- }, [M]), q = A(v), [, ee] = S(i), Q = P === !0 ? y : Array.isArray(P) ? P : null, $ = (e) => {
221
+ }, [M]), Z = A(v), [, te] = S(i), Q = P === !0 ? y : Array.isArray(P) ? P : null, $ = (e) => {
222
222
  if (d) {
223
223
  if (t === "week") d(C(i, 7 * e));
224
224
  else if (t === "day") d(C(i, e));
@@ -227,11 +227,11 @@ function q({ view: t, date: i, events: c, onViewChange: u, onDateChange: d, onEv
227
227
  d(x(t, n + e, 1));
228
228
  }
229
229
  }
230
- }, te = t === "week" ? B.prevWeek : t === "day" ? B.prevDay : B.prevMonth, ne = t === "week" ? B.nextWeek : t === "day" ? B.nextDay : B.nextMonth;
230
+ }, ne = t === "week" ? V.prevWeek : t === "day" ? V.prevDay : V.prevMonth, re = t === "week" ? V.nextWeek : t === "day" ? V.nextDay : V.nextMonth;
231
231
  return /* @__PURE__ */ m("div", {
232
- className: `select-calendar${T ? " is-loading" : ""}${L === "list" ? " select-calendar--list" : ""}${D ? " " + D : ""}`,
232
+ className: `select-calendar${T ? " is-loading" : ""}${L === "list" ? " select-calendar--list" : ""}${B ? " select-calendar--bare" : ""}${D ? " " + D : ""}`,
233
233
  "aria-busy": T || void 0,
234
- style: { "--select-cal-days": String(t === "day" ? 1 : V) },
234
+ style: { "--select-cal-days": String(t === "day" ? 1 : H) },
235
235
  children: [
236
236
  R ? /* @__PURE__ */ m("div", {
237
237
  className: "select-calendar__bar",
@@ -240,14 +240,14 @@ function q({ view: t, date: i, events: c, onViewChange: u, onDateChange: d, onEv
240
240
  children: [d ? /* @__PURE__ */ m(f, { children: [
241
241
  /* @__PURE__ */ p(s, {
242
242
  icon: /* @__PURE__ */ p(n, {}),
243
- label: te,
243
+ label: ne,
244
244
  variant: "outline",
245
245
  size: "sm",
246
246
  onClick: () => $(-1)
247
247
  }),
248
248
  /* @__PURE__ */ p(s, {
249
249
  icon: /* @__PURE__ */ p(r, {}),
250
- label: ne,
250
+ label: re,
251
251
  variant: "outline",
252
252
  size: "sm",
253
253
  onClick: () => $(1)
@@ -256,13 +256,13 @@ function q({ view: t, date: i, events: c, onViewChange: u, onDateChange: d, onEv
256
256
  variant: "secondary",
257
257
  size: "sm",
258
258
  inline: !0,
259
- onClick: () => d(q),
260
- children: B.today
259
+ onClick: () => d(Z),
260
+ children: V.today
261
261
  })
262
262
  ] }) : null, /* @__PURE__ */ p("h3", {
263
263
  className: "select-calendar__title",
264
264
  "aria-live": "polite",
265
- children: W(t, i, H, B, t === "week" && V === 5)
265
+ children: W(t, i, U, V, t === "week" && H === 5)
266
266
  })]
267
267
  }), /* @__PURE__ */ m("div", {
268
268
  className: "select-calendar__tools",
@@ -271,9 +271,9 @@ function q({ view: t, date: i, events: c, onViewChange: u, onDateChange: d, onEv
271
271
  onChange: (e) => u(e),
272
272
  options: O.map((e) => ({
273
273
  value: e,
274
- label: B.views[e]
274
+ label: V.views[e]
275
275
  })),
276
- ariaLabel: B.viewLabel
276
+ ariaLabel: V.viewLabel
277
277
  }) : null]
278
278
  })]
279
279
  }) : null,
@@ -283,39 +283,39 @@ function q({ view: t, date: i, events: c, onViewChange: u, onDateChange: d, onEv
283
283
  }) : null,
284
284
  t === "day" && d ? /* @__PURE__ */ p(J, {
285
285
  date: i,
286
- today: q,
286
+ today: Z,
287
287
  weekStartsOn: b,
288
- count: V,
288
+ count: H,
289
289
  onDateChange: d,
290
- t: B
290
+ t: V
291
291
  }) : null,
292
292
  t === "month" ? /* @__PURE__ */ p(X, {
293
- days: H,
294
- month: ee,
295
- today: q,
296
- pieces: U,
293
+ days: U,
294
+ month: te,
295
+ today: Z,
296
+ pieces: G,
297
297
  onEventClick: g,
298
298
  onDayClick: _,
299
- t: B
299
+ t: V
300
300
  }) : L === "list" ? /* @__PURE__ */ p(Y, {
301
- days: H,
302
- today: q,
303
- pieces: U,
301
+ days: U,
302
+ today: Z,
303
+ pieces: G,
304
304
  onEventClick: g,
305
305
  selectedId: I,
306
- t: B
307
- }) : /* @__PURE__ */ p(Z, {
308
- days: H,
309
- today: q,
310
- pieces: U,
306
+ t: V
307
+ }) : /* @__PURE__ */ p(ee, {
308
+ days: U,
309
+ today: Z,
310
+ pieces: G,
311
311
  timeZone: v,
312
312
  onEventClick: g,
313
313
  scrollToHour: E,
314
- tasksByDay: M ? G : null,
314
+ tasksByDay: M ? q : null,
315
315
  onTaskClick: N,
316
316
  selectedId: I,
317
317
  inlineHead: z === "inline",
318
- t: B
318
+ t: V
319
319
  })
320
320
  ]
321
321
  });
@@ -470,7 +470,7 @@ function X({ days: e, month: t, today: n, pieces: r, onEventClick: i, onDayClick
470
470
  })]
471
471
  });
472
472
  }
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: _ }) {
473
+ function ee({ days: e, today: n, pieces: r, timeZone: i, onEventClick: a, scrollToHour: o, tasksByDay: s, onTaskClick: l, selectedId: h, inlineHead: g = !1, t: _ }) {
474
474
  let y = u(null), [x, C] = d(() => O(/* @__PURE__ */ new Date(), i).minutes);
475
475
  c(() => {
476
476
  let e = y.current;
@@ -1,235 +1,202 @@
1
1
  /* empty css */
2
2
  import { SelectButton as e } from "./SelectButton.js";
3
3
  import { CalendarIcon as t, ChevronDownIcon as n, ChevronLeftIcon as r, ChevronRightIcon as i } from "./icons.js";
4
- import { SelectLabelRow as a } from "./SelectField.js";
5
- import { SelectPopover as o } from "./SelectPopover.js";
6
- import { forwardRef as s, useId as ee, useState as c } from "react";
7
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
4
+ import { useSelectMessages as a } from "./SelectLocale.js";
5
+ import { SelectLabelRow as o } from "./SelectField.js";
6
+ import { SelectPopover as ee } from "./SelectPopover.js";
7
+ import { forwardRef as s, useId as c, useState as l } from "react";
8
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
8
9
  //#region src/SelectDateField.tsx
9
- var d = [
10
- "Dom",
11
- "Seg",
12
- "Ter",
13
- "Qua",
14
- "Qui",
15
- "Sex",
16
- "Sáb"
17
- ], f = [
18
- "Janeiro",
19
- "Fevereiro",
20
- "Março",
21
- "Abril",
22
- "Maio",
23
- "Junho",
24
- "Julho",
25
- "Agosto",
26
- "Setembro",
27
- "Outubro",
28
- "Novembro",
29
- "Dezembro"
30
- ], p = [
31
- "Jan",
32
- "Fev",
33
- "Mar",
34
- "Abr",
35
- "Mai",
36
- "Jun",
37
- "Jul",
38
- "Ago",
39
- "Set",
40
- "Out",
41
- "Nov",
42
- "Dez"
43
- ], m = 12, h = (e) => String(e).padStart(2, "0"), g = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()), _ = (e) => new Date(e.getFullYear(), e.getMonth(), 1), v = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t), y = (e, t) => new Date(e.getFullYear(), e.getMonth() + t, 1), b = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
44
- function x(e) {
10
+ var f = 12, p = (e) => String(e).padStart(2, "0"), m = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()), h = (e) => new Date(e.getFullYear(), e.getMonth(), 1), g = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t), te = (e, t) => new Date(e.getFullYear(), e.getMonth() + t, 1), _ = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
11
+ function ne(e) {
45
12
  let t = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}))?/.exec(e || "");
46
13
  return t ? new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3]), Number(t[4] ?? 0), Number(t[5] ?? 0)) : null;
47
14
  }
48
- function S(e, t) {
49
- let n = `${e.getFullYear()}-${h(e.getMonth() + 1)}-${h(e.getDate())}`;
50
- return t ? `${n}T${h(e.getHours())}:${h(e.getMinutes())}` : n;
15
+ function v(e, t) {
16
+ let n = `${e.getFullYear()}-${p(e.getMonth() + 1)}-${p(e.getDate())}`;
17
+ return t ? `${n}T${p(e.getHours())}:${p(e.getMinutes())}` : n;
51
18
  }
52
- function C(e, t) {
53
- let n = `${h(e.getDate())}/${h(e.getMonth() + 1)}/${e.getFullYear()}`;
54
- return t ? `${n} ${h(e.getHours())}:${h(e.getMinutes())}` : n;
19
+ function y(e, t, n) {
20
+ let r = n.date(e.getFullYear(), e.getMonth() + 1, e.getDate());
21
+ return t ? `${r} ${p(e.getHours())}:${p(e.getMinutes())}` : r;
55
22
  }
56
- var w = s(function({ label: s, value: w, onChange: T, showTime: E = !1, placeholder: te, required: ne, disabled: D, error: O, hint: k, minDate: A, maxDate: j, clearable: re = !0, openTo: ie = "day", id: ae, className: M, ...N }, P) {
57
- let F = ee(), I = ae ?? F, [L, R] = c(!1), z = x(w), B = A ? g(A) : null, V = j ? g(j) : null, H = (e) => !!B && g(e) < B || !!V && g(e) > V, U = () => {
58
- if (z) return z;
23
+ var b = s(function({ label: s, value: b, onChange: x, showTime: S = !1, placeholder: C, required: w, disabled: T, error: E, hint: D, minDate: O, maxDate: k, clearable: re = !0, openTo: ie = "day", id: ae, className: A, ...j }, M) {
24
+ let N = c(), P = ae ?? N, F = a().dateField, [I, L] = l(!1), R = ne(b), z = O ? m(O) : null, B = k ? m(k) : null, V = (e) => !!z && m(e) < z || !!B && m(e) > B, H = () => {
25
+ if (R) return R;
59
26
  let e = /* @__PURE__ */ new Date();
60
- return V && e > V ? V : B && e < B ? B : e;
61
- }, [W, G] = c(() => _(U())), [K, q] = c("day"), oe = (e) => !!B && e < B.getFullYear() || !!V && e > V.getFullYear(), se = (e, t) => !!B && new Date(e, t + 1, 0) < B || !!V && new Date(e, t, 1) > V, J = W.getFullYear() - W.getFullYear() % m, ce = v(_(W), -_(W).getDay()), Y = Array.from({ length: 42 }, (e, t) => v(ce, t)), X = g(/* @__PURE__ */ new Date()), le = () => {
62
- D || (G(_(U())), q(!z && ie === "year" ? "year" : "day"), R((e) => !e));
63
- }, Z = (e) => G((t) => K === "day" ? y(t, e) : new Date(t.getFullYear() + e * (K === "year" ? m : 1), t.getMonth(), 1)), Q = K === "day" ? ["Mês anterior", "Próximo mês"] : K === "month" ? ["Ano anterior", "Próximo ano"] : ["Anos anteriores", "Próximos anos"], $ = (e) => {
64
- if (H(e)) return;
27
+ return B && e > B ? B : z && e < z ? z : e;
28
+ }, [U, W] = l(() => h(H())), [G, K] = l("day"), q = (e) => !!z && e < z.getFullYear() || !!B && e > B.getFullYear(), oe = (e, t) => !!z && new Date(e, t + 1, 0) < z || !!B && new Date(e, t, 1) > B, J = U.getFullYear() - U.getFullYear() % f, se = g(h(U), -h(U).getDay()), ce = Array.from({ length: 42 }, (e, t) => g(se, t)), Y = m(/* @__PURE__ */ new Date()), X = () => {
29
+ T || (W(h(H())), K(!R && ie === "year" ? "year" : "day"), L((e) => !e));
30
+ }, Z = (e) => W((t) => G === "day" ? te(t, e) : new Date(t.getFullYear() + e * (G === "year" ? f : 1), t.getMonth(), 1)), Q = G === "day" ? [F.prevMonth, F.nextMonth] : G === "month" ? [F.prevYear, F.nextYear] : [F.prevYears, F.nextYears], $ = (e) => {
31
+ if (V(e)) return;
65
32
  let t = new Date(e);
66
- E && t.setHours((z == null ? void 0 : z.getHours()) ?? 0, (z == null ? void 0 : z.getMinutes()) ?? 0, 0, 0), T(S(t, E)), E || R(!1);
67
- }, ue = (e) => {
68
- let [t = "", n = ""] = e.split(":"), r = Number(t), i = Number(n), a = new Date(z ?? X);
69
- a.setHours(Number.isFinite(r) ? r : 0, Number.isFinite(i) ? i : 0, 0, 0), T(S(a, !0));
70
- }, de = () => {
71
- T(""), R(!1);
72
- }, fe = /* @__PURE__ */ u("div", {
73
- className: `select-input-wrap${O ? " select-input-wrap--error" : ""}`,
74
- children: [/* @__PURE__ */ l("button", {
75
- id: I,
33
+ S && t.setHours((R == null ? void 0 : R.getHours()) ?? 0, (R == null ? void 0 : R.getMinutes()) ?? 0, 0, 0), x(v(t, S)), S || L(!1);
34
+ }, le = (e) => {
35
+ let [t = "", n = ""] = e.split(":"), r = Number(t), i = Number(n), a = new Date(R ?? Y);
36
+ a.setHours(Number.isFinite(r) ? r : 0, Number.isFinite(i) ? i : 0, 0, 0), x(v(a, !0));
37
+ }, ue = () => {
38
+ x(""), L(!1);
39
+ }, de = /* @__PURE__ */ d("div", {
40
+ className: `select-input-wrap${E ? " select-input-wrap--error" : ""}`,
41
+ children: [/* @__PURE__ */ u("button", {
42
+ id: P,
76
43
  type: "button",
77
- className: `select-input select-datefield__activator${O ? " select-input--error" : ""}`,
78
- onClick: le,
79
- disabled: D,
44
+ className: `select-input select-datefield__activator${E ? " select-input--error" : ""}`,
45
+ onClick: X,
46
+ disabled: T,
80
47
  "aria-haspopup": "dialog",
81
- "aria-expanded": L,
82
- "aria-invalid": O ? !0 : void 0,
83
- children: z ? C(z, E) : /* @__PURE__ */ l("span", {
48
+ "aria-expanded": I,
49
+ "aria-invalid": E ? !0 : void 0,
50
+ children: R ? y(R, S, F) : /* @__PURE__ */ u("span", {
84
51
  className: "select-datefield__ph",
85
- children: te ?? (E ? "Selecione data e hora" : "Selecione uma data")
52
+ children: C ?? (S ? F.dateTimePlaceholder : F.datePlaceholder)
86
53
  })
87
- }), /* @__PURE__ */ l("span", {
54
+ }), /* @__PURE__ */ u("span", {
88
55
  className: "select-datefield__icon",
89
56
  "aria-hidden": "true",
90
- children: /* @__PURE__ */ l(t, {})
57
+ children: /* @__PURE__ */ u(t, {})
91
58
  })]
92
59
  });
93
- return /* @__PURE__ */ u("div", {
94
- ref: P,
95
- ...N,
96
- className: `select-field${M ? " " + M : ""}`,
60
+ return /* @__PURE__ */ d("div", {
61
+ ref: M,
62
+ ...j,
63
+ className: `select-field${A ? " " + A : ""}`,
97
64
  children: [
98
- s && /* @__PURE__ */ l(a, {
99
- htmlFor: I,
100
- label: ne ? `${s} *` : s
65
+ s && /* @__PURE__ */ u(o, {
66
+ htmlFor: P,
67
+ label: w ? `${s} *` : s
101
68
  }),
102
- /* @__PURE__ */ l("div", {
69
+ /* @__PURE__ */ u("div", {
103
70
  className: "select-datefield",
104
- children: /* @__PURE__ */ l(o, {
105
- active: L,
106
- onClose: () => R(!1),
71
+ children: /* @__PURE__ */ u(ee, {
72
+ active: I,
73
+ onClose: () => L(!1),
107
74
  placement: "bottom-start",
108
75
  role: "dialog",
109
- activator: fe,
110
- children: /* @__PURE__ */ u("div", {
76
+ activator: de,
77
+ children: /* @__PURE__ */ d("div", {
111
78
  className: "select-datefield__pop",
112
79
  children: [
113
- /* @__PURE__ */ u("div", {
80
+ /* @__PURE__ */ d("div", {
114
81
  className: "select-datepicker__calhead",
115
82
  children: [
116
- /* @__PURE__ */ l("button", {
83
+ /* @__PURE__ */ u("button", {
117
84
  type: "button",
118
85
  className: "select-datepicker__nav",
119
86
  "aria-label": Q[0],
120
87
  onClick: () => Z(-1),
121
- children: /* @__PURE__ */ l(r, {})
88
+ children: /* @__PURE__ */ u(r, {})
122
89
  }),
123
- K === "year" ? /* @__PURE__ */ u("span", {
90
+ G === "year" ? /* @__PURE__ */ d("span", {
124
91
  className: "select-datepicker__monthlabel",
125
92
  children: [
126
93
  J,
127
94
  " – ",
128
- J + m - 1
95
+ J + f - 1
129
96
  ]
130
- }) : /* @__PURE__ */ u("button", {
97
+ }) : /* @__PURE__ */ d("button", {
131
98
  type: "button",
132
99
  className: "select-datepicker__monthlabel select-datefield__modebtn",
133
- "aria-label": K === "day" ? "Escolher o ano e o mês" : "Escolher o ano",
134
- onClick: () => q("year"),
135
- children: [K === "day" ? `${f[W.getMonth()]} ${W.getFullYear()}` : W.getFullYear(), /* @__PURE__ */ l(n, {})]
100
+ "aria-label": G === "day" ? F.pickYearMonth : F.pickYear,
101
+ onClick: () => K("year"),
102
+ children: [G === "day" ? F.monthTitle(U.getMonth() + 1, U.getFullYear()) : U.getFullYear(), /* @__PURE__ */ u(n, {})]
136
103
  }),
137
- /* @__PURE__ */ l("button", {
104
+ /* @__PURE__ */ u("button", {
138
105
  type: "button",
139
106
  className: "select-datepicker__nav",
140
107
  "aria-label": Q[1],
141
108
  onClick: () => Z(1),
142
- children: /* @__PURE__ */ l(i, {})
109
+ children: /* @__PURE__ */ u(i, {})
143
110
  })
144
111
  ]
145
112
  }),
146
- K === "year" && /* @__PURE__ */ l("div", {
113
+ G === "year" && /* @__PURE__ */ u("div", {
147
114
  className: "select-datefield__cells",
148
115
  role: "grid",
149
- "aria-label": "Anos",
150
- children: Array.from({ length: m }, (e, t) => J + t).map((e) => {
151
- let t = (z == null ? void 0 : z.getFullYear()) === e;
152
- return /* @__PURE__ */ l("button", {
116
+ "aria-label": F.years,
117
+ children: Array.from({ length: f }, (e, t) => J + t).map((e) => {
118
+ let t = (R == null ? void 0 : R.getFullYear()) === e;
119
+ return /* @__PURE__ */ u("button", {
153
120
  type: "button",
154
- className: `select-datefield__cell${t ? " is-selected" : ""}${e === X.getFullYear() && !t ? " is-today" : ""}`,
155
- disabled: oe(e),
121
+ className: `select-datefield__cell${t ? " is-selected" : ""}${e === Y.getFullYear() && !t ? " is-today" : ""}`,
122
+ disabled: q(e),
156
123
  onClick: () => {
157
- G(new Date(e, W.getMonth(), 1)), q("month");
124
+ W(new Date(e, U.getMonth(), 1)), K("month");
158
125
  },
159
126
  children: e
160
127
  }, e);
161
128
  })
162
129
  }),
163
- K === "month" && /* @__PURE__ */ l("div", {
130
+ G === "month" && /* @__PURE__ */ u("div", {
164
131
  className: "select-datefield__cells",
165
132
  role: "grid",
166
- "aria-label": `Meses de ${W.getFullYear()}`,
167
- children: p.map((e, t) => {
168
- let n = W.getFullYear(), r = !!z && z.getFullYear() === n && z.getMonth() === t;
169
- return /* @__PURE__ */ l("button", {
133
+ "aria-label": F.monthsOf(U.getFullYear()),
134
+ children: F.monthsShort.map((e, t) => {
135
+ let n = U.getFullYear(), r = !!R && R.getFullYear() === n && R.getMonth() === t;
136
+ return /* @__PURE__ */ u("button", {
170
137
  type: "button",
171
- "aria-label": `${f[t]} de ${n}`,
138
+ "aria-label": F.monthCell(t + 1, n),
172
139
  className: `select-datefield__cell${r ? " is-selected" : ""}`,
173
- disabled: se(n, t),
140
+ disabled: oe(n, t),
174
141
  onClick: () => {
175
- G(new Date(n, t, 1)), q("day");
142
+ W(new Date(n, t, 1)), K("day");
176
143
  },
177
144
  children: e
178
145
  }, e);
179
146
  })
180
147
  }),
181
- K === "day" && /* @__PURE__ */ u("div", {
148
+ G === "day" && /* @__PURE__ */ d("div", {
182
149
  className: "select-datepicker__grid",
183
150
  role: "grid",
184
- children: [d.map((e) => /* @__PURE__ */ l("div", {
151
+ children: [F.weekdays.map((e) => /* @__PURE__ */ u("div", {
185
152
  className: "select-datepicker__weekday",
186
153
  children: e
187
- }, e)), Y.map((e) => {
188
- let t = e.getMonth() !== W.getMonth(), n = !!z && b(e, z), r = "select-datepicker__daybtn" + (n ? " is-selected" : "") + (b(e, X) && !n ? " is-today" : "") + (t ? " is-outside" : "");
189
- return /* @__PURE__ */ l("div", {
154
+ }, e)), ce.map((e) => {
155
+ let t = e.getMonth() !== U.getMonth(), n = !!R && _(e, R), r = "select-datepicker__daybtn" + (n ? " is-selected" : "") + (_(e, Y) && !n ? " is-today" : "") + (t ? " is-outside" : "");
156
+ return /* @__PURE__ */ u("div", {
190
157
  className: "select-datepicker__day",
191
- children: /* @__PURE__ */ l("button", {
158
+ children: /* @__PURE__ */ u("button", {
192
159
  type: "button",
193
160
  className: r,
194
- disabled: H(e),
161
+ disabled: V(e),
195
162
  onClick: () => $(e),
196
163
  children: e.getDate()
197
164
  })
198
165
  }, e.getTime());
199
166
  })]
200
167
  }),
201
- E && /* @__PURE__ */ u("div", {
168
+ S && /* @__PURE__ */ d("div", {
202
169
  className: "select-datefield__time",
203
- children: [/* @__PURE__ */ l("span", {
170
+ children: [/* @__PURE__ */ u("span", {
204
171
  className: "select-datefield__time-label",
205
- children: "Horário"
206
- }), /* @__PURE__ */ l("input", {
172
+ children: F.time
173
+ }), /* @__PURE__ */ u("input", {
207
174
  type: "time",
208
175
  className: "select-input select-datefield__time-input",
209
- "aria-label": "Horário",
210
- value: z ? `${h(z.getHours())}:${h(z.getMinutes())}` : "",
211
- onChange: (e) => ue(e.target.value)
176
+ "aria-label": F.time,
177
+ value: R ? `${p(R.getHours())}:${p(R.getMinutes())}` : "",
178
+ onChange: (e) => le(e.target.value)
212
179
  })]
213
180
  }),
214
- /* @__PURE__ */ u("div", {
181
+ /* @__PURE__ */ d("div", {
215
182
  className: "select-datefield__footer",
216
- children: [re && z ? /* @__PURE__ */ l(e, {
183
+ children: [re && R ? /* @__PURE__ */ u(e, {
217
184
  variant: "secondary",
218
185
  inline: !0,
219
- onClick: de,
220
- children: "Limpar"
221
- }) : /* @__PURE__ */ l("span", {}), /* @__PURE__ */ u("div", {
186
+ onClick: ue,
187
+ children: F.clear
188
+ }) : /* @__PURE__ */ u("span", {}), /* @__PURE__ */ d("div", {
222
189
  className: "select-datefield__footer-right",
223
- children: [!H(X) && /* @__PURE__ */ l(e, {
190
+ children: [!V(Y) && /* @__PURE__ */ u(e, {
224
191
  variant: "secondary",
225
192
  inline: !0,
226
- onClick: () => $(X),
227
- children: "Hoje"
228
- }), E && /* @__PURE__ */ l(e, {
193
+ onClick: () => $(Y),
194
+ children: F.today
195
+ }), S && /* @__PURE__ */ u(e, {
229
196
  variant: "primary",
230
197
  inline: !0,
231
- onClick: () => R(!1),
232
- children: "Concluir"
198
+ onClick: () => L(!1),
199
+ children: F.done
233
200
  })]
234
201
  })]
235
202
  })
@@ -237,19 +204,19 @@ var w = s(function({ label: s, value: w, onChange: T, showTime: E = !1, placehol
237
204
  })
238
205
  })
239
206
  }),
240
- O ? /* @__PURE__ */ l("p", {
241
- id: `${I}-err`,
207
+ E ? /* @__PURE__ */ u("p", {
208
+ id: `${P}-err`,
242
209
  className: "select-field__error",
243
- children: O
244
- }) : k ? /* @__PURE__ */ l("p", {
245
- id: `${I}-hint`,
210
+ children: E
211
+ }) : D ? /* @__PURE__ */ u("p", {
212
+ id: `${P}-hint`,
246
213
  className: "select-field__hint",
247
- children: k
214
+ children: D
248
215
  }) : null
249
216
  ]
250
217
  });
251
218
  });
252
219
  //#endregion
253
- export { w as SelectDateField };
220
+ export { b as SelectDateField };
254
221
 
255
222
  //# sourceMappingURL=SelectDateField.js.map