@vector-business-services/cristal-ds-web 0.3.0 → 0.5.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
@@ -6,15 +6,26 @@ var react$1 = require('@phosphor-icons/react');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var badge = require('primereact/badge');
8
8
  var button = require('primereact/button');
9
+ var card = require('primereact/card');
10
+ var checkbox = require('primereact/checkbox');
9
11
  var chip = require('primereact/chip');
10
12
  var divider = require('primereact/divider');
13
+ var sidebar = require('primereact/sidebar');
11
14
  var inputtext = require('primereact/inputtext');
12
15
  var api = require('primereact/api');
13
16
  var menu = require('primereact/menu');
14
17
  var menubar = require('primereact/menubar');
15
18
  var avatar = require('primereact/avatar');
16
19
  var tooltip = require('primereact/tooltip');
20
+ var dialog = require('primereact/dialog');
17
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');
18
29
  var tag = require('primereact/tag');
19
30
 
20
31
  // src/components/AutoComplete/AutoComplete.tsx
@@ -124,6 +135,93 @@ var Button = react.forwardRef(function Button2({
124
135
  }
125
136
  );
126
137
  });
138
+ var Card = react.forwardRef(function Card2({ padding = "xsmall", outline = false, className, style, children, ...props }, ref) {
139
+ const classes = ["cr-card", `cr-card--${padding}`, outline && "cr-card--outline", className].filter(Boolean).join(" ");
140
+ return /* @__PURE__ */ jsxRuntime.jsx(
141
+ card.Card,
142
+ {
143
+ unstyled: true,
144
+ ref,
145
+ pt: {
146
+ root: { className: classes, style },
147
+ body: { className: "cr-card__body" },
148
+ content: { className: "cr-card__content" }
149
+ },
150
+ ...props,
151
+ children
152
+ }
153
+ );
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
+ });
127
225
  var Chip = react.forwardRef(function Chip2({
128
226
  label,
129
227
  variant = "default",
@@ -215,6 +313,135 @@ var IconButton = react.forwardRef(function IconButton2({ variant = "primary", si
215
313
  }
216
314
  );
217
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
+ onBack,
325
+ backLabel = "Voltar",
326
+ closeLabel = "Fechar",
327
+ footer,
328
+ children,
329
+ id,
330
+ className
331
+ }) {
332
+ const autoId = react.useId();
333
+ const titleId = `${autoId}-title`;
334
+ const subtitleId = `${autoId}-subtitle`;
335
+ const panelRef = react.useRef(null);
336
+ const retorno = react.useRef(null);
337
+ react.useEffect(() => {
338
+ if (visible) {
339
+ retorno.current = document.activeElement;
340
+ return;
341
+ }
342
+ retorno.current?.focus();
343
+ retorno.current = null;
344
+ }, [visible]);
345
+ const [rolagem, setRolagem] = react.useState(null);
346
+ const [rolavel, setRolavel] = react.useState(false);
347
+ react.useEffect(() => {
348
+ if (!rolagem) return;
349
+ const medir = () => setRolavel(rolagem.scrollHeight > rolagem.clientHeight);
350
+ medir();
351
+ const observer = new ResizeObserver(medir);
352
+ observer.observe(rolagem);
353
+ [...rolagem.children].forEach((child) => observer.observe(child));
354
+ return () => observer.disconnect();
355
+ }, [rolagem, children]);
356
+ const prenderFoco = (event) => {
357
+ if (event.key !== "Tab" || !panelRef.current) return;
358
+ const focaveis = [...panelRef.current.querySelectorAll(FOCAVEIS)];
359
+ const primeiro = focaveis[0];
360
+ const ultimo = focaveis[focaveis.length - 1];
361
+ if (!primeiro || !ultimo) return;
362
+ if (event.shiftKey && document.activeElement === primeiro) {
363
+ event.preventDefault();
364
+ ultimo.focus();
365
+ } else if (!event.shiftKey && document.activeElement === ultimo) {
366
+ event.preventDefault();
367
+ primeiro.focus();
368
+ }
369
+ };
370
+ const classes = ["cr-drawer", `cr-drawer--${side}`, `cr-drawer--${behavior}`, className].filter(Boolean).join(" ");
371
+ return /* @__PURE__ */ jsxRuntime.jsx(
372
+ sidebar.Sidebar,
373
+ {
374
+ unstyled: true,
375
+ id,
376
+ visible,
377
+ onHide,
378
+ position: side,
379
+ blockScroll: true,
380
+ pt: {
381
+ mask: { className: `cr-drawer__mask cr-drawer__mask--${side}` },
382
+ root: {
383
+ className: classes,
384
+ role: "dialog",
385
+ "aria-modal": true,
386
+ "aria-labelledby": titleId,
387
+ "aria-describedby": subtitle ? subtitleId : void 0,
388
+ onKeyDown: prenderFoco
389
+ }
390
+ },
391
+ content: ({ closeIconRef, hide }) => /* @__PURE__ */ jsxRuntime.jsxs(
392
+ "div",
393
+ {
394
+ ref: (element) => {
395
+ panelRef.current = element;
396
+ if (behavior === "full") setRolagem(element);
397
+ },
398
+ className: "cr-drawer__panel",
399
+ tabIndex: behavior === "full" && rolavel ? 0 : void 0,
400
+ children: [
401
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-drawer__header", children: [
402
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-drawer__title-row", children: [
403
+ onBack && /* @__PURE__ */ jsxRuntime.jsx(
404
+ IconButton,
405
+ {
406
+ variant: "tertiary",
407
+ size: "xsmall",
408
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.ArrowLeft, {}),
409
+ "aria-label": backLabel,
410
+ onClick: onBack
411
+ }
412
+ ),
413
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { id: titleId, className: "cr-drawer__title", children: title })
414
+ ] }),
415
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { id: subtitleId, className: "cr-drawer__subtitle", children: subtitle })
416
+ ] }),
417
+ /* @__PURE__ */ jsxRuntime.jsx(
418
+ "div",
419
+ {
420
+ ref: behavior === "fixed" ? setRolagem : void 0,
421
+ className: "cr-drawer__body",
422
+ tabIndex: behavior === "fixed" && rolavel ? 0 : void 0,
423
+ children
424
+ }
425
+ ),
426
+ footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cr-drawer__footer", children: footer }),
427
+ /* @__PURE__ */ jsxRuntime.jsx(
428
+ IconButton,
429
+ {
430
+ ref: closeIconRef,
431
+ className: "cr-drawer__close",
432
+ variant: "tertiary",
433
+ size: "xsmall",
434
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.X, {}),
435
+ "aria-label": closeLabel,
436
+ onClick: (event) => hide(event)
437
+ }
438
+ )
439
+ ]
440
+ }
441
+ )
442
+ }
443
+ );
444
+ }
218
445
  var Input = react.forwardRef(function Input2({
219
446
  variant = "outline",
220
447
  size = "large",
@@ -603,6 +830,96 @@ var Menubar = react.forwardRef(function Menubar2({
603
830
  }
604
831
  ) });
605
832
  });
833
+ function Modal({
834
+ visible,
835
+ onHide,
836
+ title,
837
+ size = "large",
838
+ onHelp,
839
+ helpLabel = "Ajuda",
840
+ closeLabel = "Fechar",
841
+ footer,
842
+ footerStart,
843
+ children,
844
+ id,
845
+ className
846
+ }) {
847
+ const autoId = react.useId();
848
+ const titleId = `${autoId}-title`;
849
+ const [body, setBody] = react.useState(null);
850
+ const [rolavel, setRolavel] = react.useState(false);
851
+ react.useEffect(() => {
852
+ if (!body) return;
853
+ const medir = () => setRolavel(body.scrollHeight > body.clientHeight);
854
+ medir();
855
+ const observer = new ResizeObserver(medir);
856
+ observer.observe(body);
857
+ [...body.children].forEach((child) => observer.observe(child));
858
+ return () => observer.disconnect();
859
+ }, [body, children]);
860
+ const classes = ["cr-modal", `cr-modal--${size}`, rolavel && "cr-modal--scrollable", className].filter(Boolean).join(" ");
861
+ return /* @__PURE__ */ jsxRuntime.jsx(
862
+ dialog.Dialog,
863
+ {
864
+ unstyled: true,
865
+ id,
866
+ visible,
867
+ onHide,
868
+ draggable: false,
869
+ resizable: false,
870
+ blockScroll: true,
871
+ pt: {
872
+ mask: { className: "cr-modal__mask" },
873
+ root: {
874
+ className: classes,
875
+ "aria-labelledby": titleId,
876
+ "aria-describedby": void 0
877
+ }
878
+ },
879
+ content: ({ hide, closeRef }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
880
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-modal__header", children: [
881
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { id: titleId, className: "cr-modal__title", children: title }),
882
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-modal__tools", children: [
883
+ onHelp && size !== "large" && /* @__PURE__ */ jsxRuntime.jsx(
884
+ IconButton,
885
+ {
886
+ variant: "tertiary",
887
+ size: "xsmall",
888
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.Question, {}),
889
+ "aria-label": helpLabel,
890
+ onClick: onHelp
891
+ }
892
+ ),
893
+ /* @__PURE__ */ jsxRuntime.jsx(
894
+ IconButton,
895
+ {
896
+ ref: closeRef,
897
+ variant: "tertiary",
898
+ size: "xsmall",
899
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.X, {}),
900
+ "aria-label": closeLabel,
901
+ onClick: (event) => hide(event)
902
+ }
903
+ )
904
+ ] })
905
+ ] }),
906
+ /* @__PURE__ */ jsxRuntime.jsx(
907
+ "div",
908
+ {
909
+ ref: setBody,
910
+ className: "cr-modal__body",
911
+ tabIndex: rolavel ? 0 : void 0,
912
+ children
913
+ }
914
+ ),
915
+ (footer || footerStart) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-modal__footer", children: [
916
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cr-modal__footer-start", children: footerStart }),
917
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cr-modal__footer-end", children: footer })
918
+ ] })
919
+ ] })
920
+ }
921
+ );
922
+ }
606
923
  var MultiSelect = react.forwardRef(function MultiSelect2({
607
924
  variant = "outline",
608
925
  size = "large",
@@ -782,6 +1099,402 @@ var MultiSelect = react.forwardRef(function MultiSelect2({
782
1099
  ] })
783
1100
  ] });
784
1101
  });
1102
+ var Panel = react.forwardRef(function Panel2({ className, style, children, ...props }, ref) {
1103
+ const primeRef = react.useRef(null);
1104
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
1105
+ return /* @__PURE__ */ jsxRuntime.jsx(
1106
+ panel.Panel,
1107
+ {
1108
+ unstyled: true,
1109
+ ref: primeRef,
1110
+ pt: {
1111
+ root: { className: ["cr-panel", className].filter(Boolean).join(" "), style },
1112
+ toggleableContent: {
1113
+ className: "cr-panel__body",
1114
+ role: void 0,
1115
+ "aria-labelledby": void 0
1116
+ },
1117
+ content: { className: "cr-panel__content" }
1118
+ },
1119
+ ...props,
1120
+ children
1121
+ }
1122
+ );
1123
+ });
1124
+ var Radio = react.forwardRef(function Radio2({
1125
+ label,
1126
+ showLabel = true,
1127
+ labelSize = "default",
1128
+ checked = false,
1129
+ value,
1130
+ name,
1131
+ onChange,
1132
+ disabled,
1133
+ required,
1134
+ id,
1135
+ className,
1136
+ style
1137
+ }, ref) {
1138
+ const autoId = react.useId();
1139
+ const inputId = id ?? autoId;
1140
+ const classes = [
1141
+ "cr-radio",
1142
+ `cr-radio--label-${labelSize}`,
1143
+ disabled && "cr-radio--disabled",
1144
+ className
1145
+ ].filter(Boolean).join(" ");
1146
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, style, children: [
1147
+ /* @__PURE__ */ jsxRuntime.jsx(
1148
+ radiobutton.RadioButton,
1149
+ {
1150
+ unstyled: true,
1151
+ inputRef: ref,
1152
+ inputId,
1153
+ checked,
1154
+ value,
1155
+ name,
1156
+ onChange,
1157
+ disabled,
1158
+ required,
1159
+ pt: {
1160
+ root: { className: "cr-radio__control" },
1161
+ input: { className: "cr-radio__input" },
1162
+ box: { className: "cr-radio__box" },
1163
+ icon: { className: "cr-radio__icon" }
1164
+ }
1165
+ }
1166
+ ),
1167
+ /* @__PURE__ */ jsxRuntime.jsx(
1168
+ "label",
1169
+ {
1170
+ className: `cr-radio__label${showLabel ? "" : " cr-radio__label--hidden"}`,
1171
+ htmlFor: inputId,
1172
+ children: label
1173
+ }
1174
+ )
1175
+ ] });
1176
+ });
1177
+ var porcentagem = (posicao, total, visivel) => total > visivel ? Math.round(posicao / (total - visivel) * 100) : 0;
1178
+ var ScrollPanel = react.forwardRef(function ScrollPanel2({ children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, style, id, className }, ref) {
1179
+ const primeRef = react.useRef(null);
1180
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
1181
+ const contentId = `${react.useId()}-content`;
1182
+ const [posicao, setPosicao] = react.useState({ x: 0, y: 0 });
1183
+ const aoRolar = (event) => {
1184
+ const el = event.currentTarget;
1185
+ setPosicao({
1186
+ x: porcentagem(el.scrollLeft, el.scrollWidth, el.clientWidth),
1187
+ y: porcentagem(el.scrollTop, el.scrollHeight, el.clientHeight)
1188
+ });
1189
+ };
1190
+ const barra = (orientacao, valor) => ({
1191
+ className: `cr-scrollpanel__bar cr-scrollpanel__bar--${orientacao}`,
1192
+ tabIndex: -1,
1193
+ "aria-controls": contentId,
1194
+ "aria-valuenow": valor,
1195
+ "aria-valuemin": 0,
1196
+ "aria-valuemax": 100
1197
+ });
1198
+ const pt = {
1199
+ root: { className: ["cr-scrollpanel", className].filter(Boolean).join(" "), style },
1200
+ wrapper: { className: "cr-scrollpanel__wrapper" },
1201
+ content: {
1202
+ id: contentId,
1203
+ className: "cr-scrollpanel__content",
1204
+ tabIndex: 0,
1205
+ role: "region",
1206
+ "aria-label": ariaLabel,
1207
+ "aria-labelledby": ariaLabelledBy,
1208
+ onScroll: aoRolar
1209
+ },
1210
+ barx: barra("horizontal", posicao.x),
1211
+ bary: barra("vertical", posicao.y)
1212
+ };
1213
+ return /* @__PURE__ */ jsxRuntime.jsx(scrollpanel.ScrollPanel, { unstyled: true, ref: primeRef, id, pt, children });
1214
+ });
1215
+ var SegmentControl = react.forwardRef(
1216
+ function SegmentControl2({
1217
+ options,
1218
+ value,
1219
+ onChange,
1220
+ variant = "primary",
1221
+ "aria-label": ariaLabel,
1222
+ "aria-labelledby": ariaLabelledBy,
1223
+ disabled,
1224
+ id,
1225
+ className
1226
+ }, ref) {
1227
+ const primeRef = react.useRef(null);
1228
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
1229
+ const classes = ["cr-segment", `cr-segment--${variant}`, className].filter(Boolean).join(" ");
1230
+ return /* @__PURE__ */ jsxRuntime.jsx(
1231
+ selectbutton.SelectButton,
1232
+ {
1233
+ unstyled: true,
1234
+ ref: primeRef,
1235
+ id,
1236
+ options,
1237
+ optionLabel: "label",
1238
+ optionValue: "value",
1239
+ optionDisabled: "disabled",
1240
+ value,
1241
+ onChange: (event) => {
1242
+ if (event.value != null) onChange?.(event.value);
1243
+ },
1244
+ allowEmpty: false,
1245
+ disabled,
1246
+ "aria-label": ariaLabel,
1247
+ "aria-labelledby": ariaLabelledBy,
1248
+ itemTemplate: (option) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1249
+ option.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-segment__icon", "aria-hidden": "true", children: option.icon }),
1250
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-segment__label", children: option.label })
1251
+ ] }),
1252
+ pt: {
1253
+ root: { className: classes },
1254
+ button: {
1255
+ className: "cr-segment__item",
1256
+ // O Prime só ativa com a barra de espaço; um role=button responde também ao Enter.
1257
+ onKeyDown: (event) => {
1258
+ if (event.key === "Enter") event.currentTarget.click();
1259
+ }
1260
+ }
1261
+ }
1262
+ }
1263
+ );
1264
+ }
1265
+ );
1266
+ var Select = react.forwardRef(function Select2({
1267
+ variant = "outline",
1268
+ size = "large",
1269
+ label,
1270
+ "aria-label": ariaLabel,
1271
+ options,
1272
+ optionLabel = "label",
1273
+ optionValue,
1274
+ value,
1275
+ onChange,
1276
+ placeholder = "Selecione uma op\xE7\xE3o",
1277
+ hint,
1278
+ error,
1279
+ required,
1280
+ disabled,
1281
+ id,
1282
+ name,
1283
+ className
1284
+ }, ref) {
1285
+ const autoId = react.useId();
1286
+ const inputId = id ?? autoId;
1287
+ const hintId = `${inputId}-hint`;
1288
+ const listId = `${inputId}-list`;
1289
+ const supportText = error ?? hint;
1290
+ const [open, setOpen] = react.useState(false);
1291
+ const setInputRef = react.useCallback(
1292
+ (input) => {
1293
+ input?.setAttribute("role", "combobox");
1294
+ if (typeof ref === "function") ref(input);
1295
+ else if (ref) ref.current = input;
1296
+ },
1297
+ [ref]
1298
+ );
1299
+ const classes = [
1300
+ "cr-field",
1301
+ `cr-field--${variant}`,
1302
+ `cr-field--${size}`,
1303
+ "cr-select",
1304
+ error && "cr-field--error",
1305
+ disabled && "cr-field--disabled",
1306
+ className
1307
+ ].filter(Boolean).join(" ");
1308
+ const pt = {
1309
+ root: {
1310
+ className: `cr-field__control cr-select__control${open ? " cr-select__control--open" : ""}`,
1311
+ // O Prime aponta para um item mesmo sem destaque (dropdownItem_-1); o foco vai no item.
1312
+ "aria-activedescendant": void 0
1313
+ },
1314
+ // O <select> escondido do Prime só existe para formulários: fora da árvore de acessibilidade.
1315
+ select: { "aria-hidden": true },
1316
+ hiddenSelectedMessage: { className: "cr-select__hidden" },
1317
+ // O Prime usa a mesma chave no texto do campo e no combobox escondido.
1318
+ input: { className: "cr-select__value" },
1319
+ trigger: { className: "cr-field__icon cr-select__trigger", "aria-hidden": true },
1320
+ panel: { className: "cr-select__panel" },
1321
+ wrapper: { className: "cr-select__wrapper" },
1322
+ list: { className: "cr-select__list", id: listId },
1323
+ item: { className: "cr-select__item" },
1324
+ emptyMessage: { className: "cr-select__item cr-select__empty" }
1325
+ };
1326
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, children: [
1327
+ label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
1328
+ label,
1329
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
1330
+ ] }),
1331
+ /* @__PURE__ */ jsxRuntime.jsx(
1332
+ dropdown.Dropdown,
1333
+ {
1334
+ unstyled: true,
1335
+ inputId,
1336
+ focusInputRef: setInputRef,
1337
+ value,
1338
+ options,
1339
+ optionLabel,
1340
+ optionValue,
1341
+ onChange: (event) => onChange?.(event.value),
1342
+ onShow: () => setOpen(true),
1343
+ onHide: () => setOpen(false),
1344
+ disabled,
1345
+ required,
1346
+ name,
1347
+ invalid: Boolean(error),
1348
+ placeholder,
1349
+ valueTemplate: (option) => option == null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-select__placeholder", children: placeholder }) : String(option[optionLabel] ?? option),
1350
+ scrollHeight: "185px",
1351
+ dropdownIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDown, {}),
1352
+ collapseIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretUp, {}),
1353
+ "aria-label": label ? void 0 : ariaLabel,
1354
+ "aria-expanded": open,
1355
+ "aria-controls": open ? listId : void 0,
1356
+ "aria-describedby": supportText ? hintId : void 0,
1357
+ "aria-invalid": error ? true : void 0,
1358
+ "aria-required": required || void 0,
1359
+ pt
1360
+ }
1361
+ ),
1362
+ supportText && /* @__PURE__ */ jsxRuntime.jsxs("p", { id: hintId, className: `cr-field__hint${error ? " cr-field__hint--error" : ""}`, children: [
1363
+ /* @__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, {}) }),
1364
+ supportText
1365
+ ] })
1366
+ ] });
1367
+ });
1368
+ var Switch = react.forwardRef(function Switch2({
1369
+ label,
1370
+ showLabel = true,
1371
+ labelPosition = "right",
1372
+ size = "medium",
1373
+ checked = false,
1374
+ onChange,
1375
+ disabled,
1376
+ name,
1377
+ id,
1378
+ className,
1379
+ style
1380
+ }, ref) {
1381
+ const autoId = react.useId();
1382
+ const inputId = id ?? autoId;
1383
+ const classes = [
1384
+ "cr-switch",
1385
+ `cr-switch--${size}`,
1386
+ `cr-switch--label-${labelPosition}`,
1387
+ disabled && "cr-switch--disabled",
1388
+ className
1389
+ ].filter(Boolean).join(" ");
1390
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, style, children: [
1391
+ /* @__PURE__ */ jsxRuntime.jsx(
1392
+ inputswitch.InputSwitch,
1393
+ {
1394
+ unstyled: true,
1395
+ inputRef: ref,
1396
+ inputId,
1397
+ checked,
1398
+ onChange,
1399
+ disabled,
1400
+ name,
1401
+ pt: {
1402
+ root: { className: "cr-switch__control", role: void 0, "aria-checked": void 0 },
1403
+ input: { className: "cr-switch__input" },
1404
+ slider: { className: "cr-switch__track" }
1405
+ }
1406
+ }
1407
+ ),
1408
+ /* @__PURE__ */ jsxRuntime.jsx(
1409
+ "label",
1410
+ {
1411
+ className: `cr-switch__label${showLabel ? "" : " cr-switch__label--hidden"}`,
1412
+ htmlFor: inputId,
1413
+ children: label
1414
+ }
1415
+ )
1416
+ ] });
1417
+ });
1418
+ function TabPanel(_props) {
1419
+ return null;
1420
+ }
1421
+ var Tabs = react.forwardRef(function Tabs2({ activeIndex, onTabChange, children, id, className }, ref) {
1422
+ const primeRef = react.useRef(null);
1423
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
1424
+ const [interno, setInterno] = react.useState(0);
1425
+ const ativa = activeIndex ?? interno;
1426
+ const panels = react.Children.toArray(children).filter(
1427
+ (child) => react.isValidElement(child)
1428
+ );
1429
+ const header = (panel) => function TabHeader(options) {
1430
+ const element = options.element;
1431
+ const close = panel.onClose;
1432
+ return react.cloneElement(
1433
+ element,
1434
+ {
1435
+ "aria-keyshortcuts": close ? "Delete" : void 0,
1436
+ onKeyDown: (event) => {
1437
+ if (close && event.key === "Delete") close();
1438
+ else element.props.onKeyDown?.(event);
1439
+ }
1440
+ },
1441
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1442
+ panel.leftIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-tabs__icon", "aria-hidden": "true", children: panel.leftIcon }),
1443
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-tabs__label", children: panel.header }),
1444
+ panel.badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(Badge, { className: "cr-tabs__badge", children: panel.badge }),
1445
+ close && // O X é só para o mouse: pelo teclado a aba fecha com Delete (aria-keyshortcuts).
1446
+ /* @__PURE__ */ jsxRuntime.jsx(
1447
+ "span",
1448
+ {
1449
+ className: "cr-tabs__close",
1450
+ "aria-hidden": "true",
1451
+ onClick: (event) => {
1452
+ event.stopPropagation();
1453
+ close();
1454
+ },
1455
+ children: /* @__PURE__ */ jsxRuntime.jsx(react$1.X, {})
1456
+ }
1457
+ )
1458
+ ] })
1459
+ );
1460
+ };
1461
+ return /* @__PURE__ */ jsxRuntime.jsx(
1462
+ tabview.TabView,
1463
+ {
1464
+ unstyled: true,
1465
+ ref: primeRef,
1466
+ id,
1467
+ activeIndex: ativa,
1468
+ onTabChange: (event) => {
1469
+ setInterno(event.index);
1470
+ onTabChange?.(event.index);
1471
+ },
1472
+ pt: {
1473
+ root: { className: ["cr-tabs", className].filter(Boolean).join(" ") },
1474
+ navContainer: { className: "cr-tabs__nav-container" },
1475
+ navContent: { className: "cr-tabs__nav-content" },
1476
+ nav: { className: "cr-tabs__nav" },
1477
+ inkbar: { className: "cr-tabs__inkbar" },
1478
+ panelContainer: { className: "cr-tabs__panels" }
1479
+ },
1480
+ children: panels.map((panel, index) => /* @__PURE__ */ jsxRuntime.jsx(
1481
+ tabview.TabPanel,
1482
+ {
1483
+ header: panel.props.header,
1484
+ disabled: panel.props.disabled,
1485
+ headerTemplate: header(panel.props),
1486
+ pt: {
1487
+ header: { className: "cr-tabs__item" },
1488
+ headerAction: { className: "cr-tabs__tab" },
1489
+ content: { className: "cr-tabs__panel" }
1490
+ },
1491
+ children: panel.props.children
1492
+ },
1493
+ panel.key ?? index
1494
+ ))
1495
+ }
1496
+ );
1497
+ });
785
1498
  var Tag = react.forwardRef(function Tag2({ variant = "default", size = "small", icon, className, children, ...props }, ref) {
786
1499
  const primeRef = react.useRef(null);
787
1500
  react.useImperativeHandle(ref, () => primeRef.current?.getElement());
@@ -802,13 +1515,25 @@ var Tag = react.forwardRef(function Tag2({ variant = "default", size = "small",
802
1515
  exports.AutoComplete = AutoComplete;
803
1516
  exports.Badge = Badge;
804
1517
  exports.Button = Button;
1518
+ exports.Card = Card;
1519
+ exports.Checkbox = Checkbox;
805
1520
  exports.Chip = Chip;
806
1521
  exports.Divider = Divider;
1522
+ exports.Drawer = Drawer;
807
1523
  exports.IconButton = IconButton;
808
1524
  exports.Input = Input;
809
1525
  exports.Menu = Menu;
810
1526
  exports.Menubar = Menubar;
1527
+ exports.Modal = Modal;
811
1528
  exports.MultiSelect = MultiSelect;
1529
+ exports.Panel = Panel;
1530
+ exports.Radio = Radio;
1531
+ exports.ScrollPanel = ScrollPanel;
1532
+ exports.SegmentControl = SegmentControl;
1533
+ exports.Select = Select;
1534
+ exports.Switch = Switch;
1535
+ exports.TabPanel = TabPanel;
1536
+ exports.Tabs = Tabs;
812
1537
  exports.Tag = Tag;
813
1538
  exports.Tooltip = Tooltip;
814
1539
  //# sourceMappingURL=index.cjs.map