@vector-business-services/cristal-ds-web 0.0.0-stage → 0.1.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/icons.cjs ADDED
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var react = require('@phosphor-icons/react');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+
6
+ // src/icons/index.ts
7
+ var ICON_DEFAULTS = {
8
+ weight: "bold",
9
+ size: "1em",
10
+ color: "currentColor",
11
+ mirrored: false,
12
+ shapeRendering: "geometricPrecision"
13
+ };
14
+ function IconProvider({ children, value }) {
15
+ return /* @__PURE__ */ jsxRuntime.jsx(react.IconContext.Provider, { value: { ...ICON_DEFAULTS, ...value }, children });
16
+ }
17
+
18
+ exports.ICON_DEFAULTS = ICON_DEFAULTS;
19
+ exports.IconProvider = IconProvider;
20
+ Object.keys(react).forEach(function (k) {
21
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
22
+ enumerable: true,
23
+ get: function () { return react[k]; }
24
+ });
25
+ });
26
+ //# sourceMappingURL=icons.cjs.map
27
+ //# sourceMappingURL=icons.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/icons/IconProvider.tsx"],"names":["jsx","IconContext"],"mappings":";;;;;;AAMO,IAAM,aAAA,GAA2B;AAAA,EACtC,MAAA,EAAQ,MAAA;AAAA,EACR,IAAA,EAAM,KAAA;AAAA,EACN,KAAA,EAAO,cAAA;AAAA,EACP,QAAA,EAAU,KAAA;AAAA,EACV,cAAA,EAAgB;AAClB;AAQO,SAAS,YAAA,CAAa,EAAE,QAAA,EAAU,KAAA,EAAM,EAAsB;AACnE,EAAA,uBACEA,cAAA,CAACC,iBAAA,CAAY,QAAA,EAAZ,EAAqB,KAAA,EAAO,EAAE,GAAG,aAAA,EAAe,GAAG,KAAA,EAAM,EAAI,QAAA,EAAS,CAAA;AAE3E","file":"icons.cjs","sourcesContent":["import type { ReactNode } from 'react';\nimport { IconContext, type IconProps } from '@phosphor-icons/react';\n\n// Padrões do Cristal para os ícones Phosphor: bold, herdando cor e tamanho do texto,\n// com antialias explícito (shape-rendering) no SVG.\n// Qualquer ícone pode sobrescrever via props (ex.: weight=\"regular\" para casos específicos).\nexport const ICON_DEFAULTS: IconProps = {\n weight: 'bold',\n size: '1em',\n color: 'currentColor',\n mirrored: false,\n shapeRendering: 'geometricPrecision',\n};\n\nexport interface IconProviderProps {\n children: ReactNode;\n /** Sobrescreve os padrões para tudo que estiver dentro (ex.: { weight: 'regular' }). */\n value?: IconProps;\n}\n\nexport function IconProvider({ children, value }: IconProviderProps) {\n return (\n <IconContext.Provider value={{ ...ICON_DEFAULTS, ...value }}>{children}</IconContext.Provider>\n );\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { IconProps } from '@phosphor-icons/react';
2
+ export * from '@phosphor-icons/react';
3
+ import * as react$1 from 'react';
4
+ import { ReactNode } from 'react';
5
+
6
+ declare const ICON_DEFAULTS: IconProps;
7
+ interface IconProviderProps {
8
+ children: ReactNode;
9
+ /** Sobrescreve os padrões para tudo que estiver dentro (ex.: { weight: 'regular' }). */
10
+ value?: IconProps;
11
+ }
12
+ declare function IconProvider({ children, value }: IconProviderProps): react$1.JSX.Element;
13
+
14
+ export { ICON_DEFAULTS, IconProvider };
15
+ export type { IconProviderProps };
@@ -0,0 +1,15 @@
1
+ import { IconProps } from '@phosphor-icons/react';
2
+ export * from '@phosphor-icons/react';
3
+ import * as react$1 from 'react';
4
+ import { ReactNode } from 'react';
5
+
6
+ declare const ICON_DEFAULTS: IconProps;
7
+ interface IconProviderProps {
8
+ children: ReactNode;
9
+ /** Sobrescreve os padrões para tudo que estiver dentro (ex.: { weight: 'regular' }). */
10
+ value?: IconProps;
11
+ }
12
+ declare function IconProvider({ children, value }: IconProviderProps): react$1.JSX.Element;
13
+
14
+ export { ICON_DEFAULTS, IconProvider };
15
+ export type { IconProviderProps };
package/dist/icons.js ADDED
@@ -0,0 +1,19 @@
1
+ import { IconContext } from '@phosphor-icons/react';
2
+ export * from '@phosphor-icons/react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ // src/icons/index.ts
6
+ var ICON_DEFAULTS = {
7
+ weight: "bold",
8
+ size: "1em",
9
+ color: "currentColor",
10
+ mirrored: false,
11
+ shapeRendering: "geometricPrecision"
12
+ };
13
+ function IconProvider({ children, value }) {
14
+ return /* @__PURE__ */ jsx(IconContext.Provider, { value: { ...ICON_DEFAULTS, ...value }, children });
15
+ }
16
+
17
+ export { ICON_DEFAULTS, IconProvider };
18
+ //# sourceMappingURL=icons.js.map
19
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/icons/IconProvider.tsx"],"names":[],"mappings":";;;;;AAMO,IAAM,aAAA,GAA2B;AAAA,EACtC,MAAA,EAAQ,MAAA;AAAA,EACR,IAAA,EAAM,KAAA;AAAA,EACN,KAAA,EAAO,cAAA;AAAA,EACP,QAAA,EAAU,KAAA;AAAA,EACV,cAAA,EAAgB;AAClB;AAQO,SAAS,YAAA,CAAa,EAAE,QAAA,EAAU,KAAA,EAAM,EAAsB;AACnE,EAAA,uBACE,GAAA,CAAC,WAAA,CAAY,QAAA,EAAZ,EAAqB,KAAA,EAAO,EAAE,GAAG,aAAA,EAAe,GAAG,KAAA,EAAM,EAAI,QAAA,EAAS,CAAA;AAE3E","file":"icons.js","sourcesContent":["import type { ReactNode } from 'react';\nimport { IconContext, type IconProps } from '@phosphor-icons/react';\n\n// Padrões do Cristal para os ícones Phosphor: bold, herdando cor e tamanho do texto,\n// com antialias explícito (shape-rendering) no SVG.\n// Qualquer ícone pode sobrescrever via props (ex.: weight=\"regular\" para casos específicos).\nexport const ICON_DEFAULTS: IconProps = {\n weight: 'bold',\n size: '1em',\n color: 'currentColor',\n mirrored: false,\n shapeRendering: 'geometricPrecision',\n};\n\nexport interface IconProviderProps {\n children: ReactNode;\n /** Sobrescreve os padrões para tudo que estiver dentro (ex.: { weight: 'regular' }). */\n value?: IconProps;\n}\n\nexport function IconProvider({ children, value }: IconProviderProps) {\n return (\n <IconContext.Provider value={{ ...ICON_DEFAULTS, ...value }}>{children}</IconContext.Provider>\n );\n}\n"]}
package/dist/index.cjs ADDED
@@ -0,0 +1,475 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var autocomplete = require('primereact/autocomplete');
5
+ var react$1 = require('@phosphor-icons/react');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var badge = require('primereact/badge');
8
+ var button = require('primereact/button');
9
+ var chip = require('primereact/chip');
10
+ var divider = require('primereact/divider');
11
+ var inputtext = require('primereact/inputtext');
12
+ var multiselect = require('primereact/multiselect');
13
+ var tag = require('primereact/tag');
14
+
15
+ // src/components/AutoComplete/AutoComplete.tsx
16
+ var AutoComplete = react.forwardRef(function AutoComplete2({
17
+ variant = "outline",
18
+ size = "large",
19
+ label,
20
+ hint,
21
+ error,
22
+ inputId,
23
+ required,
24
+ disabled,
25
+ className,
26
+ style,
27
+ ...props
28
+ }, ref) {
29
+ const autoId = react.useId();
30
+ const id = inputId ?? autoId;
31
+ const hintId = `${id}-hint`;
32
+ const supportText = error ?? hint;
33
+ const classes = [
34
+ "cr-field",
35
+ "cr-autocomplete",
36
+ `cr-field--${variant}`,
37
+ `cr-field--${size}`,
38
+ error && "cr-field--error",
39
+ disabled && "cr-field--disabled",
40
+ className
41
+ ].filter(Boolean).join(" ");
42
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, style, children: [
43
+ label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cr-field__label", htmlFor: id, children: [
44
+ label,
45
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
46
+ ] }),
47
+ /* @__PURE__ */ jsxRuntime.jsx(
48
+ autocomplete.AutoComplete,
49
+ {
50
+ unstyled: true,
51
+ inputRef: ref,
52
+ inputId: id,
53
+ required,
54
+ disabled,
55
+ scrollHeight: "185px",
56
+ pt: {
57
+ root: { className: "cr-autocomplete__root" },
58
+ input: {
59
+ root: {
60
+ className: "cr-field__control cr-autocomplete__input",
61
+ "aria-describedby": supportText ? hintId : void 0,
62
+ "aria-invalid": error ? true : void 0
63
+ }
64
+ },
65
+ // O Prime mostra um spinner próprio enquanto busca; o Figma não define esse estado.
66
+ loadingIcon: { className: "cr-autocomplete__loader" },
67
+ panel: { className: "cr-autocomplete__panel" },
68
+ list: { className: "cr-autocomplete__list" },
69
+ item: { className: "cr-autocomplete__item" }
70
+ },
71
+ ...props
72
+ }
73
+ ),
74
+ supportText && /* @__PURE__ */ jsxRuntime.jsxs("p", { id: hintId, className: `cr-field__hint${error ? " cr-field__hint--error" : ""}`, children: [
75
+ /* @__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, {}) }),
76
+ supportText
77
+ ] })
78
+ ] });
79
+ });
80
+ var Badge = react.forwardRef(function Badge2({ variant = "default", size = "large", className, children, ...props }, ref) {
81
+ const primeRef = react.useRef(null);
82
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
83
+ const classes = ["cr-badge", `cr-badge--${variant}`, `cr-badge--${size}`, className].filter(Boolean).join(" ");
84
+ return /* @__PURE__ */ jsxRuntime.jsx(
85
+ badge.Badge,
86
+ {
87
+ unstyled: true,
88
+ ref: primeRef,
89
+ className: classes,
90
+ value: size === "small" ? null : children,
91
+ ...props
92
+ }
93
+ );
94
+ });
95
+ var Button = react.forwardRef(function Button2({
96
+ variant = "primary",
97
+ size = "large",
98
+ leadingIcon,
99
+ trailingIcon,
100
+ type = "button",
101
+ className,
102
+ children,
103
+ ...props
104
+ }, ref) {
105
+ const classes = ["cr-button", `cr-button--${variant}`, `cr-button--${size}`, className].filter(Boolean).join(" ");
106
+ return /* @__PURE__ */ jsxRuntime.jsxs(
107
+ button.Button,
108
+ {
109
+ unstyled: true,
110
+ ref,
111
+ type,
112
+ className: classes,
113
+ ...props,
114
+ children: [
115
+ leadingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-button__icon", "aria-hidden": "true", children: leadingIcon }),
116
+ children,
117
+ trailingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-button__icon", "aria-hidden": "true", children: trailingIcon })
118
+ ]
119
+ }
120
+ );
121
+ });
122
+ var Chip = react.forwardRef(function Chip2({
123
+ label,
124
+ variant = "default",
125
+ size = "small",
126
+ leadingIcon,
127
+ trailingIcon,
128
+ disabled = false,
129
+ onRemove,
130
+ removeLabel = "Remover",
131
+ className,
132
+ ...props
133
+ }, ref) {
134
+ const classes = [
135
+ "cr-chip",
136
+ `cr-chip--${variant}`,
137
+ `cr-chip--${size}`,
138
+ disabled && "cr-chip--disabled",
139
+ className
140
+ ].filter(Boolean).join(" ");
141
+ const removable = Boolean(onRemove) && !disabled;
142
+ const trailing = trailingIcon ?? (onRemove ? /* @__PURE__ */ jsxRuntime.jsx(react$1.X, {}) : null);
143
+ return /* @__PURE__ */ jsxRuntime.jsx(
144
+ chip.Chip,
145
+ {
146
+ unstyled: true,
147
+ pt: { root: { ref, "aria-label": void 0 } },
148
+ className: classes,
149
+ label,
150
+ "aria-disabled": disabled || void 0,
151
+ icon: leadingIcon ? () => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-chip__icon cr-chip__icon--leading", "aria-hidden": "true", children: leadingIcon }) : void 0,
152
+ removable: Boolean(trailing),
153
+ removeIcon: (options) => {
154
+ if (!removable) {
155
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-chip__icon cr-chip__icon--trailing", "aria-hidden": "true", children: trailing });
156
+ }
157
+ const { role, tabIndex, onClick, onKeyDown } = options.iconProps;
158
+ return /* @__PURE__ */ jsxRuntime.jsx(
159
+ "span",
160
+ {
161
+ role,
162
+ tabIndex,
163
+ onClick,
164
+ onKeyDown,
165
+ className: "cr-chip__icon cr-chip__icon--trailing cr-chip__remove",
166
+ "aria-label": removeLabel,
167
+ children: trailing
168
+ }
169
+ );
170
+ },
171
+ onRemove: onRemove ? (event) => onRemove(event) !== false : void 0,
172
+ ...props
173
+ }
174
+ );
175
+ });
176
+ var Divider = react.forwardRef(function Divider2({ orientation = "horizontal", variant = "solid", className, style, ...props }, ref) {
177
+ const primeRef = react.useRef(null);
178
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
179
+ const classes = ["cr-divider", `cr-divider--${orientation}`, `cr-divider--${variant}`, className].filter(Boolean).join(" ");
180
+ return /* @__PURE__ */ jsxRuntime.jsx(
181
+ divider.Divider,
182
+ {
183
+ unstyled: true,
184
+ ref: primeRef,
185
+ layout: orientation,
186
+ pt: {
187
+ root: { className: classes, style },
188
+ content: { className: "cr-divider__content" }
189
+ },
190
+ ...props
191
+ }
192
+ );
193
+ });
194
+ var IconButton = react.forwardRef(function IconButton2({ variant = "primary", size = "large", icon, type = "button", className, ...props }, ref) {
195
+ const classes = [
196
+ "cr-icon-button",
197
+ `cr-icon-button--${variant}`,
198
+ `cr-icon-button--${size}`,
199
+ className
200
+ ].filter(Boolean).join(" ");
201
+ return /* @__PURE__ */ jsxRuntime.jsx(
202
+ button.Button,
203
+ {
204
+ unstyled: true,
205
+ ref,
206
+ type,
207
+ className: classes,
208
+ ...props,
209
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-icon-button__icon", "aria-hidden": "true", children: icon })
210
+ }
211
+ );
212
+ });
213
+ var Input = react.forwardRef(function Input2({
214
+ variant = "outline",
215
+ size = "large",
216
+ label,
217
+ leadingIcon,
218
+ trailingIcon,
219
+ hint,
220
+ error,
221
+ id,
222
+ required,
223
+ disabled,
224
+ className,
225
+ ...props
226
+ }, ref) {
227
+ const autoId = react.useId();
228
+ const inputId = id ?? autoId;
229
+ const hintId = `${inputId}-hint`;
230
+ const supportText = error ?? hint;
231
+ const classes = [
232
+ "cr-field",
233
+ `cr-field--${variant}`,
234
+ `cr-field--${size}`,
235
+ error && "cr-field--error",
236
+ disabled && "cr-field--disabled",
237
+ className
238
+ ].filter(Boolean).join(" ");
239
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, children: [
240
+ label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
241
+ label,
242
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
243
+ ] }),
244
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-field__control", children: [
245
+ leadingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__icon", "aria-hidden": "true", children: leadingIcon }),
246
+ /* @__PURE__ */ jsxRuntime.jsx(
247
+ inputtext.InputText,
248
+ {
249
+ unstyled: true,
250
+ ref,
251
+ id: inputId,
252
+ className: "cr-field__input",
253
+ required,
254
+ disabled,
255
+ invalid: Boolean(error),
256
+ "aria-invalid": error ? true : void 0,
257
+ "aria-describedby": supportText ? hintId : void 0,
258
+ ...props
259
+ }
260
+ ),
261
+ trailingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__icon", children: trailingIcon })
262
+ ] }),
263
+ supportText && /* @__PURE__ */ jsxRuntime.jsxs("p", { id: hintId, className: `cr-field__hint${error ? " cr-field__hint--error" : ""}`, children: [
264
+ /* @__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, {}) }),
265
+ supportText
266
+ ] })
267
+ ] });
268
+ });
269
+ var MultiSelect = react.forwardRef(function MultiSelect2({
270
+ variant = "outline",
271
+ size = "large",
272
+ density = "normal",
273
+ label,
274
+ options,
275
+ optionLabel = "label",
276
+ optionValue,
277
+ value,
278
+ onChange,
279
+ placeholder = "Selecionar op\xE7\xE3o",
280
+ filter = false,
281
+ filterPlaceholder = "Pesquisar",
282
+ maxChips = 3,
283
+ selectedItemsLabel = "{0} itens selecionados",
284
+ removeLabel = "Remover",
285
+ selectAllLabel = "Selecionar todos",
286
+ emptyFilterMessage = "Nenhum resultado encontrado",
287
+ hint,
288
+ error,
289
+ required,
290
+ disabled,
291
+ id,
292
+ className,
293
+ ...props
294
+ }, ref) {
295
+ const autoId = react.useId();
296
+ const inputId = id ?? autoId;
297
+ const hintId = `${inputId}-hint`;
298
+ const supportText = error ?? hint;
299
+ const selected = value ?? [];
300
+ const overflow = selected.length > maxChips;
301
+ const classes = [
302
+ "cr-field",
303
+ `cr-field--${variant}`,
304
+ `cr-field--${size}`,
305
+ "cr-multiselect",
306
+ error && "cr-field--error",
307
+ disabled && "cr-field--disabled",
308
+ className
309
+ ].filter(Boolean).join(" ");
310
+ const valueOf = (option) => optionValue ? option[optionValue] : option;
311
+ const labelOf = (item) => {
312
+ const option = options.find((o) => valueOf(o) === item) ?? item;
313
+ const text = option?.[optionLabel];
314
+ return String(text ?? item);
315
+ };
316
+ const remove = (event, next) => {
317
+ event.originalEvent.stopPropagation();
318
+ onChange?.(next);
319
+ return false;
320
+ };
321
+ const renderSelected = (item) => {
322
+ if (item === void 0) {
323
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-multiselect__placeholder", children: placeholder });
324
+ }
325
+ if (overflow) {
326
+ if (selected.indexOf(item) !== 0) return null;
327
+ return /* @__PURE__ */ jsxRuntime.jsx(
328
+ Chip,
329
+ {
330
+ className: "cr-multiselect__chip",
331
+ label: selectedItemsLabel.replace("{0}", String(selected.length)),
332
+ disabled,
333
+ onRemove: disabled ? void 0 : (event) => remove(event, []),
334
+ removeLabel
335
+ }
336
+ );
337
+ }
338
+ return /* @__PURE__ */ jsxRuntime.jsx(
339
+ Chip,
340
+ {
341
+ className: "cr-multiselect__chip",
342
+ label: labelOf(item),
343
+ disabled,
344
+ onRemove: disabled ? void 0 : (event) => remove(
345
+ event,
346
+ selected.filter((v) => v !== item)
347
+ ),
348
+ removeLabel: `${removeLabel} ${labelOf(item)}`
349
+ }
350
+ );
351
+ };
352
+ const checkbox = {
353
+ root: { className: "cr-multiselect__checkbox" },
354
+ box: { className: "cr-multiselect__checkbox-box" },
355
+ input: { className: "cr-multiselect__checkbox-input" }
356
+ };
357
+ const pt = {
358
+ // Com a lista aberta o foco vai para a busca (no body), fora da caixa: o estado Focused do
359
+ // Figma vem do estado do Prime.
360
+ root: (options2) => {
361
+ const open = options2?.state?.overlayVisible;
362
+ return {
363
+ className: `cr-field__control cr-multiselect__control${open ? " cr-multiselect__control--open" : ""}`
364
+ };
365
+ },
366
+ hiddenInputWrapper: { className: "cr-multiselect__hidden" },
367
+ input: {
368
+ "aria-describedby": supportText ? hintId : void 0,
369
+ "aria-invalid": error ? true : void 0,
370
+ "aria-required": required || void 0
371
+ },
372
+ labelContainer: { className: "cr-multiselect__value" },
373
+ label: { className: "cr-multiselect__chips" },
374
+ trigger: { className: "cr-field__icon cr-multiselect__trigger" },
375
+ panel: { className: `cr-multiselect__panel cr-multiselect__panel--${density}` },
376
+ header: { className: "cr-multiselect__header" },
377
+ headerCheckboxContainer: { className: "cr-multiselect__select-all" },
378
+ // O Prime repete role=checkbox na <div> em volta do <input>: o leitor de tela veria dois.
379
+ headerCheckbox: {
380
+ ...checkbox,
381
+ root: { ...checkbox.root, role: void 0, "aria-checked": void 0 },
382
+ input: { ...checkbox.input, "aria-label": selectAllLabel }
383
+ },
384
+ filterContainer: { className: "cr-multiselect__search" },
385
+ // O filtro é um InputText do Prime, que lê o pass-through da raiz (a tipagem do Prime diverge).
386
+ filterInput: {
387
+ root: { className: "cr-multiselect__search-input", "aria-label": filterPlaceholder }
388
+ },
389
+ closeButton: { className: "cr-multiselect__close" },
390
+ wrapper: { className: "cr-multiselect__wrapper" },
391
+ list: { className: "cr-multiselect__list" },
392
+ item: (options2) => {
393
+ const context = options2?.context;
394
+ const focused = context !== void 0 && context.focusedIndex === context.index;
395
+ return {
396
+ className: `cr-multiselect__item${focused ? " cr-multiselect__item--focused" : ""}`
397
+ };
398
+ },
399
+ checkboxContainer: { className: "cr-multiselect__item-checkbox" },
400
+ // O item (role=option) já diz se está selecionado; o checkbox é só visual para o leitor de tela.
401
+ // O item (role=option) já diz se está selecionado. O checkbox do Prime fica só visual: inert
402
+ // tira o <input> do foco e do leitor de tela (tabindex=-1 e aria-hidden não bastam dentro de
403
+ // um option), e o clique cai no item.
404
+ checkbox: {
405
+ ...checkbox,
406
+ root: { ...checkbox.root, role: void 0, "aria-checked": void 0, inert: true }
407
+ },
408
+ emptyMessage: { className: "cr-multiselect__empty" }
409
+ };
410
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, children: [
411
+ label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
412
+ label,
413
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-field__required", "aria-hidden": "true", children: "*" })
414
+ ] }),
415
+ /* @__PURE__ */ jsxRuntime.jsx(
416
+ multiselect.MultiSelect,
417
+ {
418
+ unstyled: true,
419
+ inputId,
420
+ inputRef: ref,
421
+ value: selected,
422
+ options,
423
+ optionLabel,
424
+ optionValue,
425
+ onChange: (event) => onChange?.(event.value),
426
+ disabled,
427
+ invalid: Boolean(error),
428
+ placeholder,
429
+ selectedItemTemplate: renderSelected,
430
+ filter,
431
+ filterPlaceholder,
432
+ scrollHeight: density === "compact" ? "224px" : "280px",
433
+ emptyFilterMessage,
434
+ filterIcon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-multiselect__search-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(react$1.MagnifyingGlass, {}) }),
435
+ dropdownIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDown, { "aria-hidden": "true" }),
436
+ checkboxIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.Check, { "aria-hidden": "true" }),
437
+ itemCheckboxIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.Check, { "aria-hidden": "true" }),
438
+ pt,
439
+ ...props
440
+ }
441
+ ),
442
+ supportText && /* @__PURE__ */ jsxRuntime.jsxs("p", { id: hintId, className: `cr-field__hint${error ? " cr-field__hint--error" : ""}`, children: [
443
+ /* @__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, {}) }),
444
+ supportText
445
+ ] })
446
+ ] });
447
+ });
448
+ var Tag = react.forwardRef(function Tag2({ variant = "default", size = "small", icon, className, children, ...props }, ref) {
449
+ const primeRef = react.useRef(null);
450
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
451
+ const classes = ["cr-tag", `cr-tag--${variant}`, `cr-tag--${size}`, className].filter(Boolean).join(" ");
452
+ return /* @__PURE__ */ jsxRuntime.jsx(
453
+ tag.Tag,
454
+ {
455
+ unstyled: true,
456
+ ref: primeRef,
457
+ className: classes,
458
+ icon: icon ? () => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-tag__icon", "aria-hidden": "true", children: icon }) : void 0,
459
+ value: children,
460
+ ...props
461
+ }
462
+ );
463
+ });
464
+
465
+ exports.AutoComplete = AutoComplete;
466
+ exports.Badge = Badge;
467
+ exports.Button = Button;
468
+ exports.Chip = Chip;
469
+ exports.Divider = Divider;
470
+ exports.IconButton = IconButton;
471
+ exports.Input = Input;
472
+ exports.MultiSelect = MultiSelect;
473
+ exports.Tag = Tag;
474
+ //# sourceMappingURL=index.cjs.map
475
+ //# sourceMappingURL=index.cjs.map