@vector-business-services/cristal-ds-web 0.19.0 → 0.20.0

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/dist/index.js CHANGED
@@ -1,17 +1,18 @@
1
1
  import { forwardRef, useRef, useImperativeHandle, useState, Children, isValidElement, useId, useLayoutEffect, useMemo, useCallback, useEffect, useContext, cloneElement } from 'react';
2
2
  import { Accordion as Accordion$1, AccordionTab as AccordionTab$1 } from 'primereact/accordion';
3
- import { CaretDown, WarningCircle, Info, Question, Check, CircleNotch, ArrowLeft, X, MagnifyingGlass, ArrowsInSimple, ArrowsOutSimple, CaretUp, Funnel, List, DribbbleLogo, SealWarning, XCircle, CheckCircle, Warning, Note, ArrowsInLineHorizontal, SortAscending, SortDescending, DotsThreeVertical, CaretLeft, CaretRight, Trash, CaretDoubleRight, CaretDoubleLeft, GearSix } from '@phosphor-icons/react';
3
+ import { CaretDown, WarningCircle, Info, Question, Check, CircleNotch, ArrowLeft, X, MagnifyingGlass, ArrowsInSimple, ArrowsOutSimple, CaretUp, Funnel, CalendarDot, List, DribbbleLogo, SealWarning, XCircle, CheckCircle, Warning, Note, ArrowsInLineHorizontal, SortAscending, SortDescending, DotsThreeVertical, CaretLeft, CaretRight, Trash, CaretDoubleRight, CaretDoubleLeft, GearSix } from '@phosphor-icons/react';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { AutoComplete as AutoComplete$1 } from 'primereact/autocomplete';
6
6
  import { Badge as Badge$1 } from 'primereact/badge';
7
7
  import { Button as Button$1 } from 'primereact/button';
8
+ import { Calendar as Calendar$1 } from 'primereact/calendar';
9
+ import { addLocale, PrimeReactContext, PrimeReactProvider, localeOption } from 'primereact/api';
8
10
  import { Card as Card$1 } from 'primereact/card';
9
11
  import { Chart as Chart$1 } from 'primereact/chart';
10
12
  import { Tooltip as Tooltip$1 } from 'primereact/tooltip';
11
13
  import { Checkbox as Checkbox$1 } from 'primereact/checkbox';
12
14
  import { Chip as Chip$1 } from 'primereact/chip';
13
15
  import { ContextMenu as ContextMenu$1 } from 'primereact/contextmenu';
14
- import { PrimeReactContext, PrimeReactProvider } from 'primereact/api';
15
16
  import { Menu as Menu$1 } from 'primereact/menu';
16
17
  import { Divider as Divider$1 } from 'primereact/divider';
17
18
  import { Sidebar } from 'primereact/sidebar';
@@ -147,7 +148,7 @@ var AutoComplete = forwardRef(function AutoComplete2({
147
148
  const id = inputId ?? autoId;
148
149
  const hintId = `${id}-hint`;
149
150
  const supportText = error ?? hint;
150
- const classes = [
151
+ const classes2 = [
151
152
  "cr-field",
152
153
  "cr-autocomplete",
153
154
  dropdown && "cr-autocomplete--dropdown",
@@ -157,7 +158,7 @@ var AutoComplete = forwardRef(function AutoComplete2({
157
158
  disabled && "cr-field--disabled",
158
159
  className
159
160
  ].filter(Boolean).join(" ");
160
- return /* @__PURE__ */ jsxs("div", { className: classes, style, children: [
161
+ return /* @__PURE__ */ jsxs("div", { className: classes2, style, children: [
161
162
  label && /* @__PURE__ */ jsxs("label", { className: "cr-field__label", htmlFor: id, children: [
162
163
  label,
163
164
  required && /* @__PURE__ */ jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
@@ -214,13 +215,13 @@ var AutoComplete = forwardRef(function AutoComplete2({
214
215
  var Badge = forwardRef(function Badge2({ variant = "default", size = "large", className, children, ...props }, ref) {
215
216
  const primeRef = useRef(null);
216
217
  useImperativeHandle(ref, () => primeRef.current?.getElement());
217
- const classes = ["cr-badge", `cr-badge--${variant}`, `cr-badge--${size}`, className].filter(Boolean).join(" ");
218
+ const classes2 = ["cr-badge", `cr-badge--${variant}`, `cr-badge--${size}`, className].filter(Boolean).join(" ");
218
219
  return /* @__PURE__ */ jsx(
219
220
  Badge$1,
220
221
  {
221
222
  unstyled: true,
222
223
  ref: primeRef,
223
- className: classes,
224
+ className: classes2,
224
225
  value: size === "small" ? null : children,
225
226
  ...props
226
227
  }
@@ -236,14 +237,14 @@ var Button = forwardRef(function Button2({
236
237
  children,
237
238
  ...props
238
239
  }, ref) {
239
- const classes = ["cr-button", `cr-button--${variant}`, `cr-button--${size}`, className].filter(Boolean).join(" ");
240
+ const classes2 = ["cr-button", `cr-button--${variant}`, `cr-button--${size}`, className].filter(Boolean).join(" ");
240
241
  return /* @__PURE__ */ jsxs(
241
242
  Button$1,
242
243
  {
243
244
  unstyled: true,
244
245
  ref,
245
246
  type,
246
- className: classes,
247
+ className: classes2,
247
248
  ...props,
248
249
  children: [
249
250
  leadingIcon && /* @__PURE__ */ jsx("span", { className: "cr-button__icon", "aria-hidden": "true", children: leadingIcon }),
@@ -253,15 +254,202 @@ var Button = forwardRef(function Button2({
253
254
  }
254
255
  );
255
256
  });
257
+ var LOCALE = "cr-pt-BR";
258
+ addLocale(LOCALE, {
259
+ firstDayOfWeek: 0,
260
+ dayNames: [
261
+ "domingo",
262
+ "segunda-feira",
263
+ "ter\xE7a-feira",
264
+ "quarta-feira",
265
+ "quinta-feira",
266
+ "sexta-feira",
267
+ "s\xE1bado"
268
+ ],
269
+ dayNamesShort: ["dom", "seg", "ter", "qua", "qui", "sex", "s\xE1b"],
270
+ dayNamesMin: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"],
271
+ monthNames: [
272
+ "Janeiro",
273
+ "Fevereiro",
274
+ "Mar\xE7o",
275
+ "Abril",
276
+ "Maio",
277
+ "Junho",
278
+ "Julho",
279
+ "Agosto",
280
+ "Setembro",
281
+ "Outubro",
282
+ "Novembro",
283
+ "Dezembro"
284
+ ],
285
+ monthNamesShort: [
286
+ "Jan",
287
+ "Fev",
288
+ "Mar",
289
+ "Abr",
290
+ "Mai",
291
+ "Jun",
292
+ "Jul",
293
+ "Ago",
294
+ "Set",
295
+ "Out",
296
+ "Nov",
297
+ "Dez"
298
+ ],
299
+ dateFormat: "dd/mm/yy",
300
+ weekHeader: "Sem",
301
+ today: "Hoje",
302
+ clear: "Limpar",
303
+ chooseDate: "Escolher data",
304
+ chooseMonth: "Escolher m\xEAs",
305
+ chooseYear: "Escolher ano",
306
+ prevMonth: "M\xEAs anterior",
307
+ nextMonth: "Pr\xF3ximo m\xEAs",
308
+ prevYear: "Ano anterior",
309
+ nextYear: "Pr\xF3ximo ano",
310
+ prevDecade: "D\xE9cada anterior",
311
+ nextDecade: "Pr\xF3xima d\xE9cada"
312
+ });
313
+ function seguirFocoDoDia(event) {
314
+ const dia = event.target;
315
+ if (!(dia instanceof HTMLElement) || !dia.classList.contains("cr-calendar__date")) return;
316
+ const painel = dia.closest(".cr-calendar");
317
+ const td = dia.closest("td");
318
+ const mes = dia.closest(".cr-calendar__month");
319
+ if (!painel || !td || !mes || event.relatedTarget) return;
320
+ const indice = [...painel.querySelectorAll(".cr-calendar__month")].indexOf(mes);
321
+ const { pDay, pMonth, pYear } = td.dataset;
322
+ requestAnimationFrame(() => {
323
+ if (dia.isConnected || document.activeElement !== document.body) return;
324
+ const novo = painel.querySelectorAll(".cr-calendar__month")[indice]?.querySelector(
325
+ `td[data-p-day="${pDay}"][data-p-month="${pMonth}"][data-p-year="${pYear}"] .cr-calendar__date`
326
+ );
327
+ if (novo) {
328
+ novo.tabIndex = 0;
329
+ novo.focus();
330
+ }
331
+ });
332
+ }
333
+ if (typeof document !== "undefined") document.addEventListener("focusout", seguirFocoDoDia, true);
334
+ var setas = {
335
+ prevIcon: /* @__PURE__ */ jsx("span", { className: "cr-icon-button__icon", children: /* @__PURE__ */ jsx(CaretLeft, {}) }),
336
+ nextIcon: /* @__PURE__ */ jsx("span", { className: "cr-icon-button__icon", children: /* @__PURE__ */ jsx(CaretRight, {}) })
337
+ };
338
+ var mesmoDia = (data, dia) => data instanceof Date && data.getDate() === dia.day && data.getMonth() === dia.month && data.getFullYear() === dia.year;
339
+ var chave = (dia) => dia.year * 1e4 + dia.month * 100 + dia.day;
340
+ var chaveDe = (data) => chave({ day: data.getDate(), month: data.getMonth(), year: data.getFullYear() });
341
+ function escolhido(props, dia) {
342
+ const { value } = props;
343
+ if (value instanceof Date) return mesmoDia(value, dia);
344
+ if (!Array.isArray(value)) return false;
345
+ if (props.selectionMode === "range") {
346
+ const [inicio, fim] = value;
347
+ if (!inicio) return false;
348
+ return chave(dia) >= chaveDe(inicio) && chave(dia) <= chaveDe(fim ?? inicio);
349
+ }
350
+ return value.some((data) => mesmoDia(data, dia));
351
+ }
352
+ function noPeriodo(props, dia) {
353
+ if (props.selectionMode !== "range" || !Array.isArray(props.value)) return void 0;
354
+ const [inicio, fim] = props.value;
355
+ if (mesmoDia(inicio, dia) || mesmoDia(fim, dia)) return "cr-calendar__day--edge";
356
+ if (inicio && fim) {
357
+ const data = new Date(dia.year, dia.month, dia.day);
358
+ if (data > inicio && data < fim) return "cr-calendar__day--middle";
359
+ }
360
+ return void 0;
361
+ }
362
+ var classes = (...lista) => lista.filter(Boolean).join(" ");
363
+ function ptDoPainel(offDays = []) {
364
+ return {
365
+ groupContainer: { className: "cr-calendar__months" },
366
+ group: { className: "cr-calendar__month" },
367
+ header: { className: "cr-calendar__header" },
368
+ previousButton: {
369
+ className: "cr-icon-button cr-icon-button--tertiary cr-icon-button--xsmall"
370
+ },
371
+ nextButton: { className: "cr-icon-button cr-icon-button--tertiary cr-icon-button--xsmall" },
372
+ title: { className: "cr-calendar__title" },
373
+ // O nome dos botões do título é o texto que aparece neles (o mês e o ano), não "Escolher mês".
374
+ monthTitle: { className: "cr-calendar__title-button", "aria-label": void 0 },
375
+ yearTitle: { className: "cr-calendar__title-button", "aria-label": void 0 },
376
+ decadeTitle: { className: "cr-calendar__title-text" },
377
+ table: { className: "cr-calendar__table" },
378
+ tableHeaderCell: { className: "cr-calendar__weekday" },
379
+ day: ({ props, context }) => {
380
+ const dia = context.date;
381
+ const meses = localeOption("monthNames", props.locale ?? LOCALE);
382
+ return {
383
+ // O Prime põe o escolhido e o desabilitado no <span> do dia, que não tem papel: eles vão
384
+ // para a célula da grade (gridcell). O nome da célula inclui o número que aparece nela.
385
+ "aria-selected": escolhido(props, dia),
386
+ "aria-disabled": dia.selectable ? void 0 : true,
387
+ "aria-label": `${dia.day} de ${meses[dia.month]?.toLowerCase()} de ${dia.year}`,
388
+ className: classes(
389
+ "cr-calendar__day",
390
+ context.today && "cr-calendar__day--today",
391
+ context.otherMonth && "cr-calendar__day--other-month",
392
+ offDays.some((data) => mesmoDia(data, dia)) && "cr-calendar__day--off",
393
+ noPeriodo(props, dia)
394
+ )
395
+ };
396
+ },
397
+ dayLabel: ({ context }) => ({
398
+ "aria-selected": void 0,
399
+ "aria-disabled": void 0,
400
+ className: classes(
401
+ "cr-calendar__date",
402
+ context.selected && "cr-calendar__date--selected",
403
+ context.disabled && "cr-calendar__date--disabled"
404
+ )
405
+ }),
406
+ monthPicker: { className: "cr-calendar__picker cr-calendar__picker--months" },
407
+ month: ({ context }) => ({
408
+ className: classes(
409
+ "cr-calendar__option",
410
+ context.selected && "cr-calendar__option--selected",
411
+ context.disabled && "cr-calendar__option--disabled"
412
+ )
413
+ }),
414
+ yearPicker: { className: "cr-calendar__picker cr-calendar__picker--years" },
415
+ year: ({ context }) => ({
416
+ className: classes(
417
+ "cr-calendar__option",
418
+ context.selected && "cr-calendar__option--selected",
419
+ context.disabled && "cr-calendar__option--disabled"
420
+ )
421
+ })
422
+ };
423
+ }
424
+ function CalendarBase({ offDays, locale = LOCALE, className, ...props }, ref) {
425
+ return /* @__PURE__ */ jsx(
426
+ Calendar$1,
427
+ {
428
+ ...setas,
429
+ locale,
430
+ ...props,
431
+ ref,
432
+ inline: true,
433
+ unstyled: true,
434
+ className,
435
+ pt: {
436
+ root: { className: "cr-calendar-inline" },
437
+ panel: { className: "cr-calendar" },
438
+ ...ptDoPainel(offDays)
439
+ }
440
+ }
441
+ );
442
+ }
443
+ var Calendar = forwardRef(CalendarBase);
256
444
  var Card = forwardRef(function Card2({ padding = "xsmall", outline = false, className, style, children, ...props }, ref) {
257
- const classes = ["cr-card", `cr-card--${padding}`, outline && "cr-card--outline", className].filter(Boolean).join(" ");
445
+ const classes2 = ["cr-card", `cr-card--${padding}`, outline && "cr-card--outline", className].filter(Boolean).join(" ");
258
446
  return /* @__PURE__ */ jsx(
259
447
  Card$1,
260
448
  {
261
449
  unstyled: true,
262
450
  ref,
263
451
  pt: {
264
- root: { className: classes, style },
452
+ root: { className: classes2, style },
265
453
  body: { className: "cr-card__body" },
266
454
  content: { className: "cr-card__content" }
267
455
  },
@@ -321,11 +509,11 @@ function Tooltip({
321
509
  )
322
510
  );
323
511
  }, [target, tooltipId, describe]);
324
- const classes = ["cr-tooltip", `cr-tooltip--${type}`, className].filter(Boolean).join(" ");
512
+ const classes2 = ["cr-tooltip", `cr-tooltip--${type}`, className].filter(Boolean).join(" ");
325
513
  const pt = {
326
514
  root: (options) => {
327
515
  const side = options?.state?.position ?? position;
328
- return { className: `${classes} cr-tooltip--${side}`, "aria-hidden": false };
516
+ return { className: `${classes2} cr-tooltip--${side}`, "aria-hidden": false };
329
517
  },
330
518
  arrow: { className: "cr-tooltip__arrow" },
331
519
  text: { className: "cr-tooltip__text" }
@@ -584,8 +772,8 @@ var Chart = forwardRef(function Chart2({
584
772
  };
585
773
  }, [tema, yAxis, y2Axis, temDireita, series, type, stacked]);
586
774
  const card = Boolean(title || actions);
587
- const classes = ["cr-chart", card && "cr-chart--card", className].filter(Boolean).join(" ");
588
- return /* @__PURE__ */ jsxs("div", { ...props, ref: raiz, id, className: classes, children: [
775
+ const classes2 = ["cr-chart", card && "cr-chart--card", className].filter(Boolean).join(" ");
776
+ return /* @__PURE__ */ jsxs("div", { ...props, ref: raiz, id, className: classes2, children: [
589
777
  card && /* @__PURE__ */ jsxs("div", { className: "cr-chart__header", children: [
590
778
  /* @__PURE__ */ jsxs("div", { className: "cr-chart__title-row", children: [
591
779
  title && /* @__PURE__ */ jsx("span", { className: "cr-chart__title", children: title }),
@@ -678,7 +866,7 @@ var Checkbox = forwardRef(function Checkbox2({
678
866
  useEffect(() => {
679
867
  if (inputRef.current) inputRef.current.indeterminate = indeterminate && !checked;
680
868
  }, [indeterminate, checked]);
681
- const classes = [
869
+ const classes2 = [
682
870
  "cr-checkbox",
683
871
  `cr-checkbox--${position}`,
684
872
  `cr-checkbox--label-${labelSize}`,
@@ -686,7 +874,7 @@ var Checkbox = forwardRef(function Checkbox2({
686
874
  disabled && "cr-checkbox--disabled",
687
875
  className
688
876
  ].filter(Boolean).join(" ");
689
- return /* @__PURE__ */ jsxs("div", { className: classes, style, children: [
877
+ return /* @__PURE__ */ jsxs("div", { className: classes2, style, children: [
690
878
  /* @__PURE__ */ jsx(
691
879
  Checkbox$1,
692
880
  {
@@ -733,7 +921,7 @@ var Chip = forwardRef(function Chip2({
733
921
  className,
734
922
  ...props
735
923
  }, ref) {
736
- const classes = [
924
+ const classes2 = [
737
925
  "cr-chip",
738
926
  `cr-chip--${variant}`,
739
927
  `cr-chip--${size}`,
@@ -747,7 +935,7 @@ var Chip = forwardRef(function Chip2({
747
935
  {
748
936
  unstyled: true,
749
937
  pt: { root: { ref, "aria-label": void 0 } },
750
- className: classes,
938
+ className: classes2,
751
939
  label,
752
940
  "aria-disabled": disabled || void 0,
753
941
  icon: leadingIcon ? () => /* @__PURE__ */ jsx("span", { className: "cr-chip__icon cr-chip__icon--leading", "aria-hidden": "true", children: leadingIcon }) : void 0,
@@ -823,7 +1011,7 @@ var Menu = forwardRef(function Menu2({
823
1011
  template: () => /* @__PURE__ */ jsx("div", { className: "cr-menu__loading", children: /* @__PURE__ */ jsx(CircleNotch, { className: "cr-menu__spinner", "aria-hidden": "true" }) })
824
1012
  }
825
1013
  ] : itensDoPrime(model);
826
- const classes = ["cr-lista cr-menu", `cr-menu--${density}`, popup && "cr-menu--popup", className].filter(Boolean).join(" ");
1014
+ const classes2 = ["cr-lista cr-menu", `cr-menu--${density}`, popup && "cr-menu--popup", className].filter(Boolean).join(" ");
827
1015
  const pt = {
828
1016
  // O nome acessível vai na lista (role=menu); o Prime lê `ariaLabel`, mas não o declara no tipo.
829
1017
  menu: {
@@ -857,7 +1045,7 @@ var Menu = forwardRef(function Menu2({
857
1045
  unstyled: true,
858
1046
  ref: primeRef,
859
1047
  id,
860
- className: classes,
1048
+ className: classes2,
861
1049
  model: items,
862
1050
  popup,
863
1051
  popupAlignment,
@@ -886,9 +1074,9 @@ var ContextMenu = forwardRef(function ContextMenu2({
886
1074
  hide: (event) => primeRef.current?.hide(event),
887
1075
  getElement: () => primeRef.current?.getElement() ?? null
888
1076
  }));
889
- const classes = ["cr-lista cr-menu cr-context-menu", `cr-menu--${density}`, className].filter(Boolean).join(" ");
1077
+ const classes2 = ["cr-lista cr-menu cr-context-menu", `cr-menu--${density}`, className].filter(Boolean).join(" ");
890
1078
  const pt = {
891
- root: { ...props, className: classes },
1079
+ root: { ...props, className: classes2 },
892
1080
  // O nome vai na lista (o Prime dá a ela role=menubar, vertical).
893
1081
  menu: {
894
1082
  className: "cr-menu__list",
@@ -921,10 +1109,120 @@ var ContextMenu = forwardRef(function ContextMenu2({
921
1109
  }
922
1110
  );
923
1111
  });
1112
+ function DatePickerBase({
1113
+ variant = "outline",
1114
+ size = "large",
1115
+ label,
1116
+ hint,
1117
+ error,
1118
+ offDays,
1119
+ locale = LOCALE,
1120
+ placeholder = "dd/mm/aaaa",
1121
+ inputId,
1122
+ required,
1123
+ disabled,
1124
+ className,
1125
+ style,
1126
+ onShow,
1127
+ onHide,
1128
+ ...props
1129
+ }, ref) {
1130
+ const autoId = useId();
1131
+ const id = inputId ?? autoId;
1132
+ const hintId = `${id}-hint`;
1133
+ const supportText = error ?? hint;
1134
+ const pelaSeta = useRef(false);
1135
+ const peloTeclado = useRef(false);
1136
+ const calendario = useRef(null);
1137
+ useImperativeHandle(ref, () => calendario.current, []);
1138
+ const classes2 = [
1139
+ "cr-field",
1140
+ "cr-datepicker",
1141
+ `cr-field--${variant}`,
1142
+ `cr-field--${size}`,
1143
+ error && "cr-field--error",
1144
+ disabled && "cr-field--disabled",
1145
+ className
1146
+ ].filter(Boolean).join(" ");
1147
+ return /* @__PURE__ */ jsxs("div", { className: classes2, style, children: [
1148
+ label && /* @__PURE__ */ jsxs("label", { className: "cr-field__label", htmlFor: id, children: [
1149
+ label,
1150
+ required && /* @__PURE__ */ jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
1151
+ ] }),
1152
+ /* @__PURE__ */ jsx(
1153
+ Calendar$1,
1154
+ {
1155
+ ...setas,
1156
+ locale,
1157
+ placeholder,
1158
+ ...props,
1159
+ ref: calendario,
1160
+ unstyled: true,
1161
+ inputId: id,
1162
+ required,
1163
+ disabled,
1164
+ showIcon: true,
1165
+ icon: /* @__PURE__ */ jsx(CalendarDot, { "aria-hidden": "true" }),
1166
+ onShow: () => {
1167
+ if (!pelaSeta.current) document.getElementById(id)?.focus();
1168
+ pelaSeta.current = false;
1169
+ onShow?.();
1170
+ },
1171
+ onHide: () => {
1172
+ const atual = calendario.current;
1173
+ const ativo = document.activeElement;
1174
+ const semFoco = ativo === document.body || atual?.getOverlay()?.contains(ativo);
1175
+ if (peloTeclado.current && semFoco && atual) {
1176
+ atual.focus();
1177
+ atual.hide();
1178
+ }
1179
+ peloTeclado.current = false;
1180
+ pelaSeta.current = false;
1181
+ onHide?.();
1182
+ },
1183
+ pt: {
1184
+ root: { className: "cr-datepicker__root" },
1185
+ input: {
1186
+ root: {
1187
+ className: "cr-field__control cr-datepicker__input",
1188
+ "aria-describedby": supportText ? hintId : void 0,
1189
+ "aria-invalid": error ? true : void 0,
1190
+ onKeyDown: (event) => {
1191
+ if (event.code === "ArrowDown" && !calendario.current?.getOverlay()) {
1192
+ pelaSeta.current = true;
1193
+ }
1194
+ }
1195
+ }
1196
+ },
1197
+ dropdownButton: { root: { className: "cr-datepicker__button" } },
1198
+ panel: {
1199
+ className: "cr-calendar cr-datepicker__panel",
1200
+ onKeyDown: (event) => {
1201
+ if (["Enter", "NumpadEnter", "Space"].includes(event.code))
1202
+ peloTeclado.current = true;
1203
+ }
1204
+ },
1205
+ // Animação de entrada e saída (a do Prime) e o lado do painel, medido logo depois de o
1206
+ // Prime posicionar.
1207
+ transition: transicaoDoPopup(() => {
1208
+ const campo = document.getElementById(id);
1209
+ seguirLado(painelDoCampo(campo, ".cr-datepicker__panel"), campo);
1210
+ }),
1211
+ ...ptDoPainel(offDays)
1212
+ }
1213
+ }
1214
+ ),
1215
+ supportText && /* @__PURE__ */ jsxs("p", { id: hintId, className: `cr-field__hint${error ? " cr-field__hint--error" : ""}`, children: [
1216
+ /* @__PURE__ */ jsx("span", { className: "cr-field__hint-icon", "aria-hidden": "true", children: error ? /* @__PURE__ */ jsx(WarningCircle, {}) : /* @__PURE__ */ jsx(Info, {}) }),
1217
+ supportText
1218
+ ] })
1219
+ ] });
1220
+ }
1221
+ var DatePicker = forwardRef(DatePickerBase);
924
1222
  var Divider = forwardRef(function Divider2({ orientation = "horizontal", variant = "solid", className, style, ...props }, ref) {
925
1223
  const primeRef = useRef(null);
926
1224
  useImperativeHandle(ref, () => primeRef.current?.getElement());
927
- const classes = ["cr-divider", `cr-divider--${orientation}`, `cr-divider--${variant}`, className].filter(Boolean).join(" ");
1225
+ const classes2 = ["cr-divider", `cr-divider--${orientation}`, `cr-divider--${variant}`, className].filter(Boolean).join(" ");
928
1226
  return /* @__PURE__ */ jsx(
929
1227
  Divider$1,
930
1228
  {
@@ -932,7 +1230,7 @@ var Divider = forwardRef(function Divider2({ orientation = "horizontal", variant
932
1230
  ref: primeRef,
933
1231
  layout: orientation,
934
1232
  pt: {
935
- root: { className: classes, style },
1233
+ root: { className: classes2, style },
936
1234
  content: { className: "cr-divider__content" }
937
1235
  },
938
1236
  ...props
@@ -959,7 +1257,7 @@ var IconButton = forwardRef(function IconButton2({
959
1257
  [ref]
960
1258
  );
961
1259
  const texto = tooltip ?? props["aria-label"];
962
- const classes = [
1260
+ const classes2 = [
963
1261
  "cr-icon-button",
964
1262
  `cr-icon-button--${variant}`,
965
1263
  `cr-icon-button--${size}`,
@@ -972,7 +1270,7 @@ var IconButton = forwardRef(function IconButton2({
972
1270
  unstyled: true,
973
1271
  ref: ligar,
974
1272
  type,
975
- className: classes,
1273
+ className: classes2,
976
1274
  ...props,
977
1275
  children: /* @__PURE__ */ jsx("span", { className: "cr-icon-button__icon", "aria-hidden": "true", children: icon })
978
1276
  }
@@ -1049,7 +1347,7 @@ var Drawer = forwardRef(function Drawer2({
1049
1347
  primeiro.focus();
1050
1348
  }
1051
1349
  };
1052
- const classes = [
1350
+ const classes2 = [
1053
1351
  "cr-drawer",
1054
1352
  `cr-drawer--${side}`,
1055
1353
  `cr-drawer--${behavior}`,
@@ -1074,7 +1372,7 @@ var Drawer = forwardRef(function Drawer2({
1074
1372
  className: `cr-drawer__mask cr-drawer__mask--${side}${modal ? "" : " cr-drawer__mask--sem-overlay"}`
1075
1373
  },
1076
1374
  root: {
1077
- className: classes,
1375
+ className: classes2,
1078
1376
  role: "dialog",
1079
1377
  "aria-modal": modal || void 0,
1080
1378
  "aria-labelledby": titleId,
@@ -1163,7 +1461,7 @@ var Input = forwardRef(function Input2({
1163
1461
  const inputId = id ?? autoId;
1164
1462
  const hintId = `${inputId}-hint`;
1165
1463
  const supportText = error ?? hint;
1166
- const classes = [
1464
+ const classes2 = [
1167
1465
  "cr-field",
1168
1466
  `cr-field--${variant}`,
1169
1467
  `cr-field--${size}`,
@@ -1171,7 +1469,7 @@ var Input = forwardRef(function Input2({
1171
1469
  disabled && "cr-field--disabled",
1172
1470
  className
1173
1471
  ].filter(Boolean).join(" ");
1174
- return /* @__PURE__ */ jsxs("div", { className: classes, children: [
1472
+ return /* @__PURE__ */ jsxs("div", { className: classes2, children: [
1175
1473
  label && /* @__PURE__ */ jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
1176
1474
  label,
1177
1475
  required && /* @__PURE__ */ jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
@@ -1221,7 +1519,7 @@ function ToolButton({ tool }) {
1221
1519
  const hasMenu = Boolean(tool.menu?.length);
1222
1520
  const hasBadge = tool.badge !== void 0 && tool.badge !== null;
1223
1521
  const name = hasBadge ? `${tool.label}, ${tool.badgeLabel ?? String(tool.badge)}` : tool.label;
1224
- const classes = [
1522
+ const classes2 = [
1225
1523
  "cr-menubar__tool",
1226
1524
  tool.showOnTablet && "cr-menubar__tool--tablet",
1227
1525
  open && "cr-menubar__tool--active"
@@ -1233,7 +1531,7 @@ function ToolButton({ tool }) {
1233
1531
  unstyled: true,
1234
1532
  ref: buttonRef,
1235
1533
  type: "button",
1236
- className: classes,
1534
+ className: classes2,
1237
1535
  "aria-label": name,
1238
1536
  "aria-haspopup": hasMenu ? "menu" : void 0,
1239
1537
  "aria-expanded": hasMenu ? open : void 0,
@@ -1337,7 +1635,7 @@ var Menubar = forwardRef(function Menubar2({
1337
1635
  event.preventDefault();
1338
1636
  onSearch?.(search);
1339
1637
  };
1340
- const classes = ["cr-menubar", !showSearch && "cr-menubar--no-search", className].filter(Boolean).join(" ");
1638
+ const classes2 = ["cr-menubar", !showSearch && "cr-menubar--no-search", className].filter(Boolean).join(" ");
1341
1639
  const pt = {
1342
1640
  // A área start some do layout (display: contents): o início e a busca viram colunas do grid.
1343
1641
  start: { className: "cr-menubar__start" },
@@ -1392,7 +1690,7 @@ var Menubar = forwardRef(function Menubar2({
1392
1690
  tools.length > 0 && /* @__PURE__ */ jsx("div", { className: "cr-menubar__tools", children: tools.map((tool) => /* @__PURE__ */ jsx(ToolButton, { tool }, tool.label)) }),
1393
1691
  user && /* @__PURE__ */ jsx(Profile, { user, menu: userMenu })
1394
1692
  ] }) : null;
1395
- return /* @__PURE__ */ jsx("div", { ref, id, className: classes, children: /* @__PURE__ */ jsx(
1693
+ return /* @__PURE__ */ jsx("div", { ref, id, className: classes2, children: /* @__PURE__ */ jsx(
1396
1694
  Menubar$1,
1397
1695
  {
1398
1696
  ...props,
@@ -1408,13 +1706,13 @@ var Menubar = forwardRef(function Menubar2({
1408
1706
  var Tag = forwardRef(function Tag2({ variant = "default", size = "small", icon, className, children, ...props }, ref) {
1409
1707
  const primeRef = useRef(null);
1410
1708
  useImperativeHandle(ref, () => primeRef.current?.getElement());
1411
- const classes = ["cr-tag", `cr-tag--${variant}`, `cr-tag--${size}`, className].filter(Boolean).join(" ");
1709
+ const classes2 = ["cr-tag", `cr-tag--${variant}`, `cr-tag--${size}`, className].filter(Boolean).join(" ");
1412
1710
  return /* @__PURE__ */ jsx(
1413
1711
  Tag$1,
1414
1712
  {
1415
1713
  unstyled: true,
1416
1714
  ref: primeRef,
1417
- className: classes,
1715
+ className: classes2,
1418
1716
  icon: icon ? () => /* @__PURE__ */ jsx("span", { className: "cr-tag__icon", "aria-hidden": "true", children: icon }) : void 0,
1419
1717
  value: children,
1420
1718
  ...props
@@ -1504,7 +1802,7 @@ var MenuPrincipal = forwardRef(
1504
1802
  );
1505
1803
  anterior = entry;
1506
1804
  });
1507
- const classes = ["cr-menu-principal", popup && "cr-menu-principal--popup", className].filter(Boolean).join(" ");
1805
+ const classes2 = ["cr-menu-principal", popup && "cr-menu-principal--popup", className].filter(Boolean).join(" ");
1508
1806
  const pt = {
1509
1807
  // O nome acessível vai na lista (role=menu), como no Menu.
1510
1808
  menu: {
@@ -1531,7 +1829,7 @@ var MenuPrincipal = forwardRef(
1531
1829
  unstyled: true,
1532
1830
  ref: primeRef,
1533
1831
  id,
1534
- className: classes,
1832
+ className: classes2,
1535
1833
  style: popup && baseDoAlvo !== void 0 ? { "--cr-menu-principal-topo": `${baseDoAlvo}px` } : void 0,
1536
1834
  model: items,
1537
1835
  popup,
@@ -1614,7 +1912,7 @@ var Modal = forwardRef(function Modal2({
1614
1912
  [...body.children].forEach((child) => observer.observe(child));
1615
1913
  return () => observer.disconnect();
1616
1914
  }, [body, children]);
1617
- const classes = ["cr-modal", `cr-modal--${size}`, rolavel && "cr-modal--scrollable", className].filter(Boolean).join(" ");
1915
+ const classes2 = ["cr-modal", `cr-modal--${size}`, rolavel && "cr-modal--scrollable", className].filter(Boolean).join(" ");
1618
1916
  return /* @__PURE__ */ jsx(
1619
1917
  Dialog,
1620
1918
  {
@@ -1631,7 +1929,7 @@ var Modal = forwardRef(function Modal2({
1631
1929
  pt: {
1632
1930
  mask: { className: "cr-modal__mask" },
1633
1931
  root: {
1634
- className: classes,
1932
+ className: classes2,
1635
1933
  "aria-labelledby": titleId,
1636
1934
  "aria-describedby": void 0
1637
1935
  },
@@ -1722,7 +2020,7 @@ var MultiSelect = forwardRef(function MultiSelect2({
1722
2020
  const supportText = error ?? hint;
1723
2021
  const selected = value ?? [];
1724
2022
  const overflow = selected.length > maxChips;
1725
- const classes = [
2023
+ const classes2 = [
1726
2024
  "cr-field",
1727
2025
  `cr-field--${variant}`,
1728
2026
  `cr-field--${size}`,
@@ -1833,7 +2131,7 @@ var MultiSelect = forwardRef(function MultiSelect2({
1833
2131
  // Animação de entrada e saída da lista, a do Prime (comum.css).
1834
2132
  transition: transicaoDoPopup()
1835
2133
  };
1836
- return /* @__PURE__ */ jsxs("div", { className: classes, children: [
2134
+ return /* @__PURE__ */ jsxs("div", { className: classes2, children: [
1837
2135
  label && /* @__PURE__ */ jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
1838
2136
  label,
1839
2137
  required && /* @__PURE__ */ jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
@@ -1910,8 +2208,8 @@ var PageHeader = forwardRef(function PageHeader2({
1910
2208
  );
1911
2209
  }
1912
2210
  );
1913
- const classes = ["cr-page-header", `cr-page-header--${variant}`, className].filter(Boolean).join(" ");
1914
- return /* @__PURE__ */ jsxs("div", { ref, className: classes, ...props, children: [
2211
+ const classes2 = ["cr-page-header", `cr-page-header--${variant}`, className].filter(Boolean).join(" ");
2212
+ return /* @__PURE__ */ jsxs("div", { ref, className: classes2, ...props, children: [
1915
2213
  /* @__PURE__ */ jsxs(
1916
2214
  "div",
1917
2215
  {
@@ -2011,7 +2309,7 @@ var Select = forwardRef(function Select2({
2011
2309
  },
2012
2310
  [ref]
2013
2311
  );
2014
- const classes = [
2312
+ const classes2 = [
2015
2313
  "cr-field",
2016
2314
  `cr-field--${variant}`,
2017
2315
  `cr-field--${size}`,
@@ -2053,7 +2351,7 @@ var Select = forwardRef(function Select2({
2053
2351
  }),
2054
2352
  emptyMessage: { className: "cr-lista__item cr-select__item cr-select__empty" }
2055
2353
  };
2056
- return /* @__PURE__ */ jsxs("div", { className: classes, children: [
2354
+ return /* @__PURE__ */ jsxs("div", { className: classes2, children: [
2057
2355
  label && /* @__PURE__ */ jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
2058
2356
  label,
2059
2357
  required && /* @__PURE__ */ jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
@@ -2223,13 +2521,13 @@ var Radio = forwardRef(function Radio2({
2223
2521
  }, ref) {
2224
2522
  const autoId = useId();
2225
2523
  const inputId = id ?? autoId;
2226
- const classes = [
2524
+ const classes2 = [
2227
2525
  "cr-radio",
2228
2526
  `cr-radio--label-${labelSize}`,
2229
2527
  disabled && "cr-radio--disabled",
2230
2528
  className
2231
2529
  ].filter(Boolean).join(" ");
2232
- return /* @__PURE__ */ jsxs("div", { className: classes, style, children: [
2530
+ return /* @__PURE__ */ jsxs("div", { className: classes2, style, children: [
2233
2531
  /* @__PURE__ */ jsx(
2234
2532
  RadioButton,
2235
2533
  {
@@ -2322,7 +2620,7 @@ var SegmentControl = forwardRef(
2322
2620
  }, ref) {
2323
2621
  const primeRef = useRef(null);
2324
2622
  useImperativeHandle(ref, () => primeRef.current?.getElement());
2325
- const classes = ["cr-segment", `cr-segment--${variant}`, className].filter(Boolean).join(" ");
2623
+ const classes2 = ["cr-segment", `cr-segment--${variant}`, className].filter(Boolean).join(" ");
2326
2624
  return /* @__PURE__ */ jsx(
2327
2625
  SelectButton,
2328
2626
  {
@@ -2347,7 +2645,7 @@ var SegmentControl = forwardRef(
2347
2645
  /* @__PURE__ */ jsx("span", { className: "cr-segment__label", children: option.label })
2348
2646
  ] }),
2349
2647
  pt: {
2350
- root: { className: classes },
2648
+ root: { className: classes2 },
2351
2649
  button: {
2352
2650
  className: "cr-segment__item",
2353
2651
  // O Prime só ativa com a barra de espaço; um role=button responde também ao Enter.
@@ -2371,7 +2669,7 @@ var Skeleton = forwardRef(function Skeleton2({
2371
2669
  }, ref) {
2372
2670
  const primeRef = useRef(null);
2373
2671
  useImperativeHandle(ref, () => primeRef.current?.getElement());
2374
- const classes = [
2672
+ const classes2 = [
2375
2673
  "cr-skeleton",
2376
2674
  `cr-skeleton--${shape}`,
2377
2675
  animated && "cr-skeleton--animated",
@@ -2387,7 +2685,7 @@ var Skeleton = forwardRef(function Skeleton2({
2387
2685
  height,
2388
2686
  size,
2389
2687
  animation: animated ? "wave" : "none",
2390
- pt: { root: { ...props, className: classes } }
2688
+ pt: { root: { ...props, className: classes2 } }
2391
2689
  }
2392
2690
  );
2393
2691
  });
@@ -2407,14 +2705,14 @@ var Switch = forwardRef(function Switch2({
2407
2705
  }, ref) {
2408
2706
  const autoId = useId();
2409
2707
  const inputId = id ?? autoId;
2410
- const classes = [
2708
+ const classes2 = [
2411
2709
  "cr-switch",
2412
2710
  `cr-switch--${size}`,
2413
2711
  `cr-switch--label-${labelPosition}`,
2414
2712
  disabled && "cr-switch--disabled",
2415
2713
  className
2416
2714
  ].filter(Boolean).join(" ");
2417
- return /* @__PURE__ */ jsxs("div", { className: classes, style, children: [
2715
+ return /* @__PURE__ */ jsxs("div", { className: classes2, style, children: [
2418
2716
  /* @__PURE__ */ jsx(
2419
2717
  InputSwitch,
2420
2718
  {
@@ -2590,7 +2888,7 @@ function coluna(element, index, opcoes) {
2590
2888
  const { help, header, align, selectionMode, ...props } = element.props;
2591
2889
  const { carregando, ajustada, abrirMenu } = opcoes;
2592
2890
  const frozen = opcoes.fixada ?? props.frozen;
2593
- const chave = chaveDaColuna(element.props, index);
2891
+ const chave2 = chaveDaColuna(element.props, index);
2594
2892
  const celula = [
2595
2893
  "cr-table__cell",
2596
2894
  `cr-table__cell--${align ?? "left"}`,
@@ -2620,7 +2918,7 @@ function coluna(element, index, opcoes) {
2620
2918
  // Botão direito (ou a tecla de menu) no cabeçalho: o menu de contexto da coluna.
2621
2919
  ...abrirMenu && !selectionMode && !carregando && {
2622
2920
  onContextMenu: (event) => abrirMenu(event, {
2623
- chave,
2921
+ chave: chave2,
2624
2922
  titulo: typeof header === "string" ? header : props.field ?? "",
2625
2923
  sortField: props.sortField ?? props.field,
2626
2924
  sortable: Boolean(props.sortable),
@@ -2637,7 +2935,7 @@ function coluna(element, index, opcoes) {
2637
2935
  rowCheckbox: caixa("Selecionar linha")
2638
2936
  }
2639
2937
  },
2640
- element.key ?? chave
2938
+ element.key ?? chave2
2641
2939
  );
2642
2940
  }
2643
2941
  function TableBase({
@@ -2795,11 +3093,11 @@ function TableBase({
2795
3093
  }
2796
3094
  },
2797
3095
  children: elementos.map((element, index) => {
2798
- const chave = chaveDaColuna(element.props, index);
3096
+ const chave2 = chaveDaColuna(element.props, index);
2799
3097
  return coluna(element, index, {
2800
3098
  carregando,
2801
- fixada: fixadas[chave],
2802
- ajustada: Boolean(ajustadas[chave]),
3099
+ fixada: fixadas[chave2],
3100
+ ajustada: Boolean(ajustadas[chave2]),
2803
3101
  abrirMenu: columnMenu ? abrirMenu : void 0
2804
3102
  });
2805
3103
  })
@@ -2893,7 +3191,7 @@ function BarraDeFiltros({
2893
3191
  clearLabel
2894
3192
  }) {
2895
3193
  const chipsRef = useRef(null);
2896
- const [setas, setSetas] = useState({ esquerda: false, direita: false });
3194
+ const [setas2, setSetas] = useState({ esquerda: false, direita: false });
2897
3195
  const medir = useCallback(() => {
2898
3196
  const chips = chipsRef.current;
2899
3197
  if (!chips) return;
@@ -2916,7 +3214,7 @@ function BarraDeFiltros({
2916
3214
  behavior: "smooth"
2917
3215
  });
2918
3216
  return /* @__PURE__ */ jsxs("div", { className: "cr-table-toolbar__filters", children: [
2919
- setas.esquerda && /* @__PURE__ */ jsx(
3217
+ setas2.esquerda && /* @__PURE__ */ jsx(
2920
3218
  IconButton,
2921
3219
  {
2922
3220
  variant: "tertiary",
@@ -2947,7 +3245,7 @@ function BarraDeFiltros({
2947
3245
  },
2948
3246
  `${filter.label}:${filter.value}`
2949
3247
  )) }),
2950
- setas.direita && /* @__PURE__ */ jsx(
3248
+ setas2.direita && /* @__PURE__ */ jsx(
2951
3249
  IconButton,
2952
3250
  {
2953
3251
  variant: "tertiary",
@@ -3159,6 +3457,6 @@ var Toast = forwardRef(function Toast2({ position = "top-right", closeLabel = "F
3159
3457
  );
3160
3458
  });
3161
3459
 
3162
- export { Accordion, AccordionTab, AutoComplete, Badge, Button, Card, Chart, Checkbox, Chip, Column, ContextMenu, Divider, Drawer, IconButton, Input, Menu, MenuPrincipal, Menubar, Message, Modal, MultiSelect, PageHeader, Paginator, Panel, Radio, ScrollPanel, SegmentControl, Select, Skeleton, Switch, TabPanel, Table, TableRowActions, TableToolbar, Tabs, Tag, Toast, Tooltip };
3460
+ export { Accordion, AccordionTab, AutoComplete, Badge, Button, Calendar, Card, Chart, Checkbox, Chip, Column, ContextMenu, DatePicker, Divider, Drawer, IconButton, Input, Menu, MenuPrincipal, Menubar, Message, Modal, MultiSelect, PageHeader, Paginator, Panel, Radio, ScrollPanel, SegmentControl, Select, Skeleton, Switch, TabPanel, Table, TableRowActions, TableToolbar, Tabs, Tag, Toast, Tooltip };
3163
3461
  //# sourceMappingURL=index.js.map
3164
3462
  //# sourceMappingURL=index.js.map