@vector-business-services/cristal-ds-web 0.4.0 → 0.6.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.cjs CHANGED
@@ -7,15 +7,25 @@ var jsxRuntime = require('react/jsx-runtime');
7
7
  var badge = require('primereact/badge');
8
8
  var button = require('primereact/button');
9
9
  var card = require('primereact/card');
10
+ var checkbox = require('primereact/checkbox');
10
11
  var chip = require('primereact/chip');
11
12
  var divider = require('primereact/divider');
13
+ var sidebar = require('primereact/sidebar');
12
14
  var inputtext = require('primereact/inputtext');
13
15
  var api = require('primereact/api');
14
16
  var menu = require('primereact/menu');
15
17
  var menubar = require('primereact/menubar');
16
18
  var avatar = require('primereact/avatar');
17
19
  var tooltip = require('primereact/tooltip');
20
+ var dialog = require('primereact/dialog');
18
21
  var multiselect = require('primereact/multiselect');
22
+ var panel = require('primereact/panel');
23
+ var radiobutton = require('primereact/radiobutton');
24
+ var scrollpanel = require('primereact/scrollpanel');
25
+ var selectbutton = require('primereact/selectbutton');
26
+ var dropdown = require('primereact/dropdown');
27
+ var inputswitch = require('primereact/inputswitch');
28
+ var tabview = require('primereact/tabview');
19
29
  var tag = require('primereact/tag');
20
30
 
21
31
  // src/components/AutoComplete/AutoComplete.tsx
@@ -142,6 +152,76 @@ var Card = react.forwardRef(function Card2({ padding = "xsmall", outline = false
142
152
  }
143
153
  );
144
154
  });
155
+ var Checkbox = react.forwardRef(function Checkbox2({
156
+ label,
157
+ showLabel = true,
158
+ position = "left",
159
+ labelSize = "default",
160
+ checked = false,
161
+ indeterminate = false,
162
+ onChange,
163
+ disabled,
164
+ required,
165
+ name,
166
+ value,
167
+ id,
168
+ className,
169
+ style
170
+ }, ref) {
171
+ const autoId = react.useId();
172
+ const inputId = id ?? autoId;
173
+ const inputRef = react.useRef(null);
174
+ const setInputRef = react.useCallback(
175
+ (input) => {
176
+ inputRef.current = input;
177
+ if (typeof ref === "function") ref(input);
178
+ else if (ref) ref.current = input;
179
+ },
180
+ [ref]
181
+ );
182
+ react.useEffect(() => {
183
+ if (inputRef.current) inputRef.current.indeterminate = indeterminate && !checked;
184
+ }, [indeterminate, checked]);
185
+ const classes = [
186
+ "cr-checkbox",
187
+ `cr-checkbox--${position}`,
188
+ `cr-checkbox--label-${labelSize}`,
189
+ indeterminate && !checked && "cr-checkbox--indeterminate",
190
+ disabled && "cr-checkbox--disabled",
191
+ className
192
+ ].filter(Boolean).join(" ");
193
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, style, children: [
194
+ /* @__PURE__ */ jsxRuntime.jsx(
195
+ checkbox.Checkbox,
196
+ {
197
+ unstyled: true,
198
+ inputRef: setInputRef,
199
+ inputId,
200
+ checked,
201
+ onChange,
202
+ disabled,
203
+ required,
204
+ name,
205
+ value,
206
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.Check, { size: 16 }),
207
+ pt: {
208
+ root: { className: "cr-checkbox__control" },
209
+ input: { className: "cr-checkbox__input" },
210
+ box: { className: "cr-checkbox__box" },
211
+ icon: { className: "cr-checkbox__icon", "aria-hidden": true }
212
+ }
213
+ }
214
+ ),
215
+ /* @__PURE__ */ jsxRuntime.jsx(
216
+ "label",
217
+ {
218
+ className: `cr-checkbox__label${showLabel ? "" : " cr-checkbox__label--hidden"}`,
219
+ htmlFor: inputId,
220
+ children: label
221
+ }
222
+ )
223
+ ] });
224
+ });
145
225
  var Chip = react.forwardRef(function Chip2({
146
226
  label,
147
227
  variant = "default",
@@ -233,6 +313,149 @@ var IconButton = react.forwardRef(function IconButton2({ variant = "primary", si
233
313
  }
234
314
  );
235
315
  });
316
+ var FOCAVEIS = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
317
+ function Drawer({
318
+ visible,
319
+ onHide,
320
+ title,
321
+ subtitle,
322
+ side = "right",
323
+ behavior = "full",
324
+ modal = true,
325
+ onBack,
326
+ backLabel = "Voltar",
327
+ closeLabel = "Fechar",
328
+ footer,
329
+ children,
330
+ id,
331
+ className
332
+ }) {
333
+ const autoId = react.useId();
334
+ const titleId = `${autoId}-title`;
335
+ const subtitleId = `${autoId}-subtitle`;
336
+ const panelRef = react.useRef(null);
337
+ const retorno = react.useRef(null);
338
+ react.useEffect(() => {
339
+ if (visible) {
340
+ retorno.current = document.activeElement;
341
+ return;
342
+ }
343
+ retorno.current?.focus();
344
+ retorno.current = null;
345
+ }, [visible]);
346
+ const [rolagem, setRolagem] = react.useState(null);
347
+ const [rolavel, setRolavel] = react.useState(false);
348
+ react.useEffect(() => {
349
+ if (!rolagem) return;
350
+ const medir = () => setRolavel(rolagem.scrollHeight > rolagem.clientHeight);
351
+ medir();
352
+ const observer = new ResizeObserver(medir);
353
+ observer.observe(rolagem);
354
+ [...rolagem.children].forEach((child) => observer.observe(child));
355
+ return () => observer.disconnect();
356
+ }, [rolagem, children]);
357
+ const prenderFoco = (event) => {
358
+ if (!modal || event.key !== "Tab" || !panelRef.current) return;
359
+ const focaveis = [...panelRef.current.querySelectorAll(FOCAVEIS)];
360
+ const primeiro = focaveis[0];
361
+ const ultimo = focaveis[focaveis.length - 1];
362
+ if (!primeiro || !ultimo) return;
363
+ if (event.shiftKey && document.activeElement === primeiro) {
364
+ event.preventDefault();
365
+ ultimo.focus();
366
+ } else if (!event.shiftKey && document.activeElement === ultimo) {
367
+ event.preventDefault();
368
+ primeiro.focus();
369
+ }
370
+ };
371
+ const classes = ["cr-drawer", `cr-drawer--${side}`, `cr-drawer--${behavior}`, className].filter(Boolean).join(" ");
372
+ return /* @__PURE__ */ jsxRuntime.jsx(
373
+ sidebar.Sidebar,
374
+ {
375
+ unstyled: true,
376
+ id,
377
+ visible,
378
+ onHide,
379
+ position: side,
380
+ modal,
381
+ blockScroll: modal,
382
+ dismissable: modal,
383
+ pt: {
384
+ mask: {
385
+ className: `cr-drawer__mask cr-drawer__mask--${side}${modal ? "" : " cr-drawer__mask--sem-overlay"}`
386
+ },
387
+ root: {
388
+ className: classes,
389
+ role: "dialog",
390
+ "aria-modal": modal || void 0,
391
+ "aria-labelledby": titleId,
392
+ "aria-describedby": subtitle ? subtitleId : void 0,
393
+ onKeyDown: prenderFoco
394
+ },
395
+ // No unstyled o Prime não põe classes na transição: o Cristal dá as dele (Drawer.css).
396
+ // O tipo do Prime exige o addEndListener do react-transition-group, que aqui não se usa.
397
+ transition: {
398
+ classNames: {
399
+ enter: "cr-drawer--enter",
400
+ enterActive: "cr-drawer--enter-active",
401
+ exitActive: "cr-drawer--exit-active"
402
+ }
403
+ }
404
+ },
405
+ content: ({ closeIconRef, hide }) => /* @__PURE__ */ jsxRuntime.jsxs(
406
+ "div",
407
+ {
408
+ ref: (element) => {
409
+ panelRef.current = element;
410
+ if (behavior === "full") setRolagem(element);
411
+ },
412
+ className: "cr-drawer__panel",
413
+ tabIndex: behavior === "full" && rolavel ? 0 : void 0,
414
+ children: [
415
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-drawer__header", children: [
416
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-drawer__title-row", children: [
417
+ onBack && /* @__PURE__ */ jsxRuntime.jsx(
418
+ IconButton,
419
+ {
420
+ variant: "tertiary",
421
+ size: "xsmall",
422
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.ArrowLeft, {}),
423
+ "aria-label": backLabel,
424
+ onClick: onBack
425
+ }
426
+ ),
427
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { id: titleId, className: "cr-drawer__title", children: title })
428
+ ] }),
429
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { id: subtitleId, className: "cr-drawer__subtitle", children: subtitle })
430
+ ] }),
431
+ /* @__PURE__ */ jsxRuntime.jsx(
432
+ "div",
433
+ {
434
+ ref: behavior === "fixed" ? setRolagem : void 0,
435
+ className: "cr-drawer__body",
436
+ tabIndex: behavior === "fixed" && rolavel ? 0 : void 0,
437
+ children
438
+ }
439
+ ),
440
+ footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cr-drawer__footer", children: footer }),
441
+ /* @__PURE__ */ jsxRuntime.jsx(
442
+ IconButton,
443
+ {
444
+ ref: closeIconRef,
445
+ className: "cr-drawer__close",
446
+ variant: "tertiary",
447
+ size: "xsmall",
448
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.X, {}),
449
+ "aria-label": closeLabel,
450
+ onClick: (event) => hide(event)
451
+ }
452
+ )
453
+ ]
454
+ }
455
+ )
456
+ }
457
+ );
458
+ }
236
459
  var Input = react.forwardRef(function Input2({
237
460
  variant = "outline",
238
461
  size = "large",
@@ -621,6 +844,96 @@ var Menubar = react.forwardRef(function Menubar2({
621
844
  }
622
845
  ) });
623
846
  });
847
+ function Modal({
848
+ visible,
849
+ onHide,
850
+ title,
851
+ size = "large",
852
+ onHelp,
853
+ helpLabel = "Ajuda",
854
+ closeLabel = "Fechar",
855
+ footer,
856
+ footerStart,
857
+ children,
858
+ id,
859
+ className
860
+ }) {
861
+ const autoId = react.useId();
862
+ const titleId = `${autoId}-title`;
863
+ const [body, setBody] = react.useState(null);
864
+ const [rolavel, setRolavel] = react.useState(false);
865
+ react.useEffect(() => {
866
+ if (!body) return;
867
+ const medir = () => setRolavel(body.scrollHeight > body.clientHeight);
868
+ medir();
869
+ const observer = new ResizeObserver(medir);
870
+ observer.observe(body);
871
+ [...body.children].forEach((child) => observer.observe(child));
872
+ return () => observer.disconnect();
873
+ }, [body, children]);
874
+ const classes = ["cr-modal", `cr-modal--${size}`, rolavel && "cr-modal--scrollable", className].filter(Boolean).join(" ");
875
+ return /* @__PURE__ */ jsxRuntime.jsx(
876
+ dialog.Dialog,
877
+ {
878
+ unstyled: true,
879
+ id,
880
+ visible,
881
+ onHide,
882
+ draggable: false,
883
+ resizable: false,
884
+ blockScroll: true,
885
+ pt: {
886
+ mask: { className: "cr-modal__mask" },
887
+ root: {
888
+ className: classes,
889
+ "aria-labelledby": titleId,
890
+ "aria-describedby": void 0
891
+ }
892
+ },
893
+ content: ({ hide, closeRef }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
894
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-modal__header", children: [
895
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { id: titleId, className: "cr-modal__title", children: title }),
896
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-modal__tools", children: [
897
+ onHelp && size !== "large" && /* @__PURE__ */ jsxRuntime.jsx(
898
+ IconButton,
899
+ {
900
+ variant: "tertiary",
901
+ size: "xsmall",
902
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.Question, {}),
903
+ "aria-label": helpLabel,
904
+ onClick: onHelp
905
+ }
906
+ ),
907
+ /* @__PURE__ */ jsxRuntime.jsx(
908
+ IconButton,
909
+ {
910
+ ref: closeRef,
911
+ variant: "tertiary",
912
+ size: "xsmall",
913
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.X, {}),
914
+ "aria-label": closeLabel,
915
+ onClick: (event) => hide(event)
916
+ }
917
+ )
918
+ ] })
919
+ ] }),
920
+ /* @__PURE__ */ jsxRuntime.jsx(
921
+ "div",
922
+ {
923
+ ref: setBody,
924
+ className: "cr-modal__body",
925
+ tabIndex: rolavel ? 0 : void 0,
926
+ children
927
+ }
928
+ ),
929
+ (footer || footerStart) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-modal__footer", children: [
930
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cr-modal__footer-start", children: footerStart }),
931
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cr-modal__footer-end", children: footer })
932
+ ] })
933
+ ] })
934
+ }
935
+ );
936
+ }
624
937
  var MultiSelect = react.forwardRef(function MultiSelect2({
625
938
  variant = "outline",
626
939
  size = "large",
@@ -800,6 +1113,402 @@ var MultiSelect = react.forwardRef(function MultiSelect2({
800
1113
  ] })
801
1114
  ] });
802
1115
  });
1116
+ var Panel = react.forwardRef(function Panel2({ className, style, children, ...props }, ref) {
1117
+ const primeRef = react.useRef(null);
1118
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
1119
+ return /* @__PURE__ */ jsxRuntime.jsx(
1120
+ panel.Panel,
1121
+ {
1122
+ unstyled: true,
1123
+ ref: primeRef,
1124
+ pt: {
1125
+ root: { className: ["cr-panel", className].filter(Boolean).join(" "), style },
1126
+ toggleableContent: {
1127
+ className: "cr-panel__body",
1128
+ role: void 0,
1129
+ "aria-labelledby": void 0
1130
+ },
1131
+ content: { className: "cr-panel__content" }
1132
+ },
1133
+ ...props,
1134
+ children
1135
+ }
1136
+ );
1137
+ });
1138
+ var Radio = react.forwardRef(function Radio2({
1139
+ label,
1140
+ showLabel = true,
1141
+ labelSize = "default",
1142
+ checked = false,
1143
+ value,
1144
+ name,
1145
+ onChange,
1146
+ disabled,
1147
+ required,
1148
+ id,
1149
+ className,
1150
+ style
1151
+ }, ref) {
1152
+ const autoId = react.useId();
1153
+ const inputId = id ?? autoId;
1154
+ const classes = [
1155
+ "cr-radio",
1156
+ `cr-radio--label-${labelSize}`,
1157
+ disabled && "cr-radio--disabled",
1158
+ className
1159
+ ].filter(Boolean).join(" ");
1160
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, style, children: [
1161
+ /* @__PURE__ */ jsxRuntime.jsx(
1162
+ radiobutton.RadioButton,
1163
+ {
1164
+ unstyled: true,
1165
+ inputRef: ref,
1166
+ inputId,
1167
+ checked,
1168
+ value,
1169
+ name,
1170
+ onChange,
1171
+ disabled,
1172
+ required,
1173
+ pt: {
1174
+ root: { className: "cr-radio__control" },
1175
+ input: { className: "cr-radio__input" },
1176
+ box: { className: "cr-radio__box" },
1177
+ icon: { className: "cr-radio__icon" }
1178
+ }
1179
+ }
1180
+ ),
1181
+ /* @__PURE__ */ jsxRuntime.jsx(
1182
+ "label",
1183
+ {
1184
+ className: `cr-radio__label${showLabel ? "" : " cr-radio__label--hidden"}`,
1185
+ htmlFor: inputId,
1186
+ children: label
1187
+ }
1188
+ )
1189
+ ] });
1190
+ });
1191
+ var porcentagem = (posicao, total, visivel) => total > visivel ? Math.round(posicao / (total - visivel) * 100) : 0;
1192
+ var ScrollPanel = react.forwardRef(function ScrollPanel2({ children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, style, id, className }, ref) {
1193
+ const primeRef = react.useRef(null);
1194
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
1195
+ const contentId = `${react.useId()}-content`;
1196
+ const [posicao, setPosicao] = react.useState({ x: 0, y: 0 });
1197
+ const aoRolar = (event) => {
1198
+ const el = event.currentTarget;
1199
+ setPosicao({
1200
+ x: porcentagem(el.scrollLeft, el.scrollWidth, el.clientWidth),
1201
+ y: porcentagem(el.scrollTop, el.scrollHeight, el.clientHeight)
1202
+ });
1203
+ };
1204
+ const barra = (orientacao, valor) => ({
1205
+ className: `cr-scrollpanel__bar cr-scrollpanel__bar--${orientacao}`,
1206
+ tabIndex: -1,
1207
+ "aria-controls": contentId,
1208
+ "aria-valuenow": valor,
1209
+ "aria-valuemin": 0,
1210
+ "aria-valuemax": 100
1211
+ });
1212
+ const pt = {
1213
+ root: { className: ["cr-scrollpanel", className].filter(Boolean).join(" "), style },
1214
+ wrapper: { className: "cr-scrollpanel__wrapper" },
1215
+ content: {
1216
+ id: contentId,
1217
+ className: "cr-scrollpanel__content",
1218
+ tabIndex: 0,
1219
+ role: "region",
1220
+ "aria-label": ariaLabel,
1221
+ "aria-labelledby": ariaLabelledBy,
1222
+ onScroll: aoRolar
1223
+ },
1224
+ barx: barra("horizontal", posicao.x),
1225
+ bary: barra("vertical", posicao.y)
1226
+ };
1227
+ return /* @__PURE__ */ jsxRuntime.jsx(scrollpanel.ScrollPanel, { unstyled: true, ref: primeRef, id, pt, children });
1228
+ });
1229
+ var SegmentControl = react.forwardRef(
1230
+ function SegmentControl2({
1231
+ options,
1232
+ value,
1233
+ onChange,
1234
+ variant = "primary",
1235
+ "aria-label": ariaLabel,
1236
+ "aria-labelledby": ariaLabelledBy,
1237
+ disabled,
1238
+ id,
1239
+ className
1240
+ }, ref) {
1241
+ const primeRef = react.useRef(null);
1242
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
1243
+ const classes = ["cr-segment", `cr-segment--${variant}`, className].filter(Boolean).join(" ");
1244
+ return /* @__PURE__ */ jsxRuntime.jsx(
1245
+ selectbutton.SelectButton,
1246
+ {
1247
+ unstyled: true,
1248
+ ref: primeRef,
1249
+ id,
1250
+ options,
1251
+ optionLabel: "label",
1252
+ optionValue: "value",
1253
+ optionDisabled: "disabled",
1254
+ value,
1255
+ onChange: (event) => {
1256
+ if (event.value != null) onChange?.(event.value);
1257
+ },
1258
+ allowEmpty: false,
1259
+ disabled,
1260
+ "aria-label": ariaLabel,
1261
+ "aria-labelledby": ariaLabelledBy,
1262
+ itemTemplate: (option) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1263
+ option.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-segment__icon", "aria-hidden": "true", children: option.icon }),
1264
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-segment__label", children: option.label })
1265
+ ] }),
1266
+ pt: {
1267
+ root: { className: classes },
1268
+ button: {
1269
+ className: "cr-segment__item",
1270
+ // O Prime só ativa com a barra de espaço; um role=button responde também ao Enter.
1271
+ onKeyDown: (event) => {
1272
+ if (event.key === "Enter") event.currentTarget.click();
1273
+ }
1274
+ }
1275
+ }
1276
+ }
1277
+ );
1278
+ }
1279
+ );
1280
+ var Select = react.forwardRef(function Select2({
1281
+ variant = "outline",
1282
+ size = "large",
1283
+ label,
1284
+ "aria-label": ariaLabel,
1285
+ options,
1286
+ optionLabel = "label",
1287
+ optionValue,
1288
+ value,
1289
+ onChange,
1290
+ placeholder = "Selecione uma op\xE7\xE3o",
1291
+ hint,
1292
+ error,
1293
+ required,
1294
+ disabled,
1295
+ id,
1296
+ name,
1297
+ className
1298
+ }, ref) {
1299
+ const autoId = react.useId();
1300
+ const inputId = id ?? autoId;
1301
+ const hintId = `${inputId}-hint`;
1302
+ const listId = `${inputId}-list`;
1303
+ const supportText = error ?? hint;
1304
+ const [open, setOpen] = react.useState(false);
1305
+ const setInputRef = react.useCallback(
1306
+ (input) => {
1307
+ input?.setAttribute("role", "combobox");
1308
+ if (typeof ref === "function") ref(input);
1309
+ else if (ref) ref.current = input;
1310
+ },
1311
+ [ref]
1312
+ );
1313
+ const classes = [
1314
+ "cr-field",
1315
+ `cr-field--${variant}`,
1316
+ `cr-field--${size}`,
1317
+ "cr-select",
1318
+ error && "cr-field--error",
1319
+ disabled && "cr-field--disabled",
1320
+ className
1321
+ ].filter(Boolean).join(" ");
1322
+ const pt = {
1323
+ root: {
1324
+ className: `cr-field__control cr-select__control${open ? " cr-select__control--open" : ""}`,
1325
+ // O Prime aponta para um item mesmo sem destaque (dropdownItem_-1); o foco vai no item.
1326
+ "aria-activedescendant": void 0
1327
+ },
1328
+ // O <select> escondido do Prime só existe para formulários: fora da árvore de acessibilidade.
1329
+ select: { "aria-hidden": true },
1330
+ hiddenSelectedMessage: { className: "cr-select__hidden" },
1331
+ // O Prime usa a mesma chave no texto do campo e no combobox escondido.
1332
+ input: { className: "cr-select__value" },
1333
+ trigger: { className: "cr-field__icon cr-select__trigger", "aria-hidden": true },
1334
+ panel: { className: "cr-select__panel" },
1335
+ wrapper: { className: "cr-select__wrapper" },
1336
+ list: { className: "cr-select__list", id: listId },
1337
+ item: { className: "cr-select__item" },
1338
+ emptyMessage: { className: "cr-select__item cr-select__empty" }
1339
+ };
1340
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, children: [
1341
+ label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
1342
+ label,
1343
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
1344
+ ] }),
1345
+ /* @__PURE__ */ jsxRuntime.jsx(
1346
+ dropdown.Dropdown,
1347
+ {
1348
+ unstyled: true,
1349
+ inputId,
1350
+ focusInputRef: setInputRef,
1351
+ value,
1352
+ options,
1353
+ optionLabel,
1354
+ optionValue,
1355
+ onChange: (event) => onChange?.(event.value),
1356
+ onShow: () => setOpen(true),
1357
+ onHide: () => setOpen(false),
1358
+ disabled,
1359
+ required,
1360
+ name,
1361
+ invalid: Boolean(error),
1362
+ placeholder,
1363
+ valueTemplate: (option) => option == null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-select__placeholder", children: placeholder }) : String(option[optionLabel] ?? option),
1364
+ scrollHeight: "185px",
1365
+ dropdownIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDown, {}),
1366
+ collapseIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretUp, {}),
1367
+ "aria-label": label ? void 0 : ariaLabel,
1368
+ "aria-expanded": open,
1369
+ "aria-controls": open ? listId : void 0,
1370
+ "aria-describedby": supportText ? hintId : void 0,
1371
+ "aria-invalid": error ? true : void 0,
1372
+ "aria-required": required || void 0,
1373
+ pt
1374
+ }
1375
+ ),
1376
+ supportText && /* @__PURE__ */ jsxRuntime.jsxs("p", { id: hintId, className: `cr-field__hint${error ? " cr-field__hint--error" : ""}`, children: [
1377
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__hint-icon", "aria-hidden": "true", children: error ? /* @__PURE__ */ jsxRuntime.jsx(react$1.WarningCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(react$1.Info, {}) }),
1378
+ supportText
1379
+ ] })
1380
+ ] });
1381
+ });
1382
+ var Switch = react.forwardRef(function Switch2({
1383
+ label,
1384
+ showLabel = true,
1385
+ labelPosition = "right",
1386
+ size = "medium",
1387
+ checked = false,
1388
+ onChange,
1389
+ disabled,
1390
+ name,
1391
+ id,
1392
+ className,
1393
+ style
1394
+ }, ref) {
1395
+ const autoId = react.useId();
1396
+ const inputId = id ?? autoId;
1397
+ const classes = [
1398
+ "cr-switch",
1399
+ `cr-switch--${size}`,
1400
+ `cr-switch--label-${labelPosition}`,
1401
+ disabled && "cr-switch--disabled",
1402
+ className
1403
+ ].filter(Boolean).join(" ");
1404
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, style, children: [
1405
+ /* @__PURE__ */ jsxRuntime.jsx(
1406
+ inputswitch.InputSwitch,
1407
+ {
1408
+ unstyled: true,
1409
+ inputRef: ref,
1410
+ inputId,
1411
+ checked,
1412
+ onChange,
1413
+ disabled,
1414
+ name,
1415
+ pt: {
1416
+ root: { className: "cr-switch__control", role: void 0, "aria-checked": void 0 },
1417
+ input: { className: "cr-switch__input" },
1418
+ slider: { className: "cr-switch__track" }
1419
+ }
1420
+ }
1421
+ ),
1422
+ /* @__PURE__ */ jsxRuntime.jsx(
1423
+ "label",
1424
+ {
1425
+ className: `cr-switch__label${showLabel ? "" : " cr-switch__label--hidden"}`,
1426
+ htmlFor: inputId,
1427
+ children: label
1428
+ }
1429
+ )
1430
+ ] });
1431
+ });
1432
+ function TabPanel(_props) {
1433
+ return null;
1434
+ }
1435
+ var Tabs = react.forwardRef(function Tabs2({ activeIndex, onTabChange, children, id, className }, ref) {
1436
+ const primeRef = react.useRef(null);
1437
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
1438
+ const [interno, setInterno] = react.useState(0);
1439
+ const ativa = activeIndex ?? interno;
1440
+ const panels = react.Children.toArray(children).filter(
1441
+ (child) => react.isValidElement(child)
1442
+ );
1443
+ const header = (panel) => function TabHeader(options) {
1444
+ const element = options.element;
1445
+ const close = panel.onClose;
1446
+ return react.cloneElement(
1447
+ element,
1448
+ {
1449
+ "aria-keyshortcuts": close ? "Delete" : void 0,
1450
+ onKeyDown: (event) => {
1451
+ if (close && event.key === "Delete") close();
1452
+ else element.props.onKeyDown?.(event);
1453
+ }
1454
+ },
1455
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1456
+ panel.leftIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-tabs__icon", "aria-hidden": "true", children: panel.leftIcon }),
1457
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-tabs__label", children: panel.header }),
1458
+ panel.badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(Badge, { className: "cr-tabs__badge", children: panel.badge }),
1459
+ close && // O X é só para o mouse: pelo teclado a aba fecha com Delete (aria-keyshortcuts).
1460
+ /* @__PURE__ */ jsxRuntime.jsx(
1461
+ "span",
1462
+ {
1463
+ className: "cr-tabs__close",
1464
+ "aria-hidden": "true",
1465
+ onClick: (event) => {
1466
+ event.stopPropagation();
1467
+ close();
1468
+ },
1469
+ children: /* @__PURE__ */ jsxRuntime.jsx(react$1.X, {})
1470
+ }
1471
+ )
1472
+ ] })
1473
+ );
1474
+ };
1475
+ return /* @__PURE__ */ jsxRuntime.jsx(
1476
+ tabview.TabView,
1477
+ {
1478
+ unstyled: true,
1479
+ ref: primeRef,
1480
+ id,
1481
+ activeIndex: ativa,
1482
+ onTabChange: (event) => {
1483
+ setInterno(event.index);
1484
+ onTabChange?.(event.index);
1485
+ },
1486
+ pt: {
1487
+ root: { className: ["cr-tabs", className].filter(Boolean).join(" ") },
1488
+ navContainer: { className: "cr-tabs__nav-container" },
1489
+ navContent: { className: "cr-tabs__nav-content" },
1490
+ nav: { className: "cr-tabs__nav" },
1491
+ inkbar: { className: "cr-tabs__inkbar" },
1492
+ panelContainer: { className: "cr-tabs__panels" }
1493
+ },
1494
+ children: panels.map((panel, index) => /* @__PURE__ */ jsxRuntime.jsx(
1495
+ tabview.TabPanel,
1496
+ {
1497
+ header: panel.props.header,
1498
+ disabled: panel.props.disabled,
1499
+ headerTemplate: header(panel.props),
1500
+ pt: {
1501
+ header: { className: "cr-tabs__item" },
1502
+ headerAction: { className: "cr-tabs__tab" },
1503
+ content: { className: "cr-tabs__panel" }
1504
+ },
1505
+ children: panel.props.children
1506
+ },
1507
+ panel.key ?? index
1508
+ ))
1509
+ }
1510
+ );
1511
+ });
803
1512
  var Tag = react.forwardRef(function Tag2({ variant = "default", size = "small", icon, className, children, ...props }, ref) {
804
1513
  const primeRef = react.useRef(null);
805
1514
  react.useImperativeHandle(ref, () => primeRef.current?.getElement());
@@ -821,13 +1530,24 @@ exports.AutoComplete = AutoComplete;
821
1530
  exports.Badge = Badge;
822
1531
  exports.Button = Button;
823
1532
  exports.Card = Card;
1533
+ exports.Checkbox = Checkbox;
824
1534
  exports.Chip = Chip;
825
1535
  exports.Divider = Divider;
1536
+ exports.Drawer = Drawer;
826
1537
  exports.IconButton = IconButton;
827
1538
  exports.Input = Input;
828
1539
  exports.Menu = Menu;
829
1540
  exports.Menubar = Menubar;
1541
+ exports.Modal = Modal;
830
1542
  exports.MultiSelect = MultiSelect;
1543
+ exports.Panel = Panel;
1544
+ exports.Radio = Radio;
1545
+ exports.ScrollPanel = ScrollPanel;
1546
+ exports.SegmentControl = SegmentControl;
1547
+ exports.Select = Select;
1548
+ exports.Switch = Switch;
1549
+ exports.TabPanel = TabPanel;
1550
+ exports.Tabs = Tabs;
831
1551
  exports.Tag = Tag;
832
1552
  exports.Tooltip = Tooltip;
833
1553
  //# sourceMappingURL=index.cjs.map