@giro-ds/react 1.0.5 → 2.0.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/components/Checkbox/Checkbox.d.ts +4 -4
- package/dist/components/Checkbox/Checkbox.types.d.ts +4 -19
- package/dist/components/Checkbox/__tests__/Checkbox.test.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +3 -3
- package/dist/components/Radio/Radio.types.d.ts +11 -14
- package/dist/components/Radio/__tests__/Radio.test.d.ts +1 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/SelectRadix/SelectRadix.types.d.ts +5 -3
- package/dist/components/Switch/Switch.d.ts +4 -0
- package/dist/components/Switch/Switch.types.d.ts +8 -0
- package/dist/components/Switch/__tests__/Switch.test.d.ts +1 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/TextField/TextField.types.d.ts +2 -3
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.types.d.ts +5 -1
- package/dist/components/Tooltip/__tests__/Tooltip.test.d.ts +1 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/index.d.ts +3 -5
- package/dist/index.cjs +135 -253
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +27 -60
- package/dist/index.esm.js +150 -249
- package/dist/index.esm.js.map +1 -1
- package/dist/shared/Label/index.d.ts +4 -3
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/components/CheckboxRadix/CheckboxRadix.d.ts +0 -4
- package/dist/components/CheckboxRadix/CheckboxRadix.types.d.ts +0 -10
- package/dist/components/CheckboxRadix/index.d.ts +0 -2
- package/dist/components/RadioRadix/RadioRadix.d.ts +0 -4
- package/dist/components/RadioRadix/RadioRadix.types.d.ts +0 -15
- package/dist/components/RadioRadix/index.d.ts +0 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
3
|
-
import React__default, { useId, useMemo, useRef, useState, useEffect, useCallback, forwardRef, memo, useReducer, createElement, isValidElement, createContext, useContext } from 'react';
|
|
2
|
+
import React, { useId, useMemo, useRef, useState, useEffect, useCallback, forwardRef, memo, useReducer, createElement, isValidElement, createContext, useContext } from 'react';
|
|
4
3
|
import clsx, { clsx as clsx$1 } from 'clsx';
|
|
5
4
|
import { ChevronUp16Regular, ChevronDown16Regular, ChevronLeft16Regular, ChevronRight16Regular, Info12Regular, Dismiss16Regular, Calendar16Regular, Search16Regular, ChevronDownRegular, ChevronRight16Filled, Subtract16Regular, Add16Regular, Info20Filled, Warning20Filled, CheckmarkCircle20Filled } from '@fluentui/react-icons';
|
|
6
5
|
import { initReactI18next, useTranslation } from 'react-i18next';
|
|
7
6
|
import i18n from 'i18next';
|
|
8
|
-
import { Checkbox as Checkbox$1,
|
|
7
|
+
import { Checkbox as Checkbox$1, Tooltip as Tooltip$1, Label, RadioGroup, DropdownMenu, Select as Select$1, Switch as Switch$1 } from 'radix-ui';
|
|
9
8
|
|
|
10
|
-
var styles$
|
|
9
|
+
var styles$s = {"zds-avatar__circle":"Avatar-module__zds-avatar__circle___DXcGa","zds-avatar__large":"Avatar-module__zds-avatar__large___G6qoo","zds-avatar__circle__icon":"Avatar-module__zds-avatar__circle__icon___u14vV","zds-avatar__small":"Avatar-module__zds-avatar__small___d-Pj5"};
|
|
11
10
|
|
|
12
11
|
let Avatar = ({ id = '', icon, size = 'small', className = '' }) => {
|
|
13
12
|
const componentId = id || useId();
|
|
14
|
-
const AvatarClass = clsx(styles$
|
|
15
|
-
[styles$
|
|
16
|
-
[styles$
|
|
13
|
+
const AvatarClass = clsx(styles$s['zds-avatar__circle'], {
|
|
14
|
+
[styles$s['zds-avatar__large']]: size === 'large',
|
|
15
|
+
[styles$s['zds-avatar__small']]: size === 'small',
|
|
17
16
|
}, className);
|
|
18
|
-
return (jsx("div", { className: AvatarClass, id: componentId, role: "img", "aria-label": `Avatar ${size}`, children: jsx("div", { className: styles$
|
|
17
|
+
return (jsx("div", { className: AvatarClass, id: componentId, role: "img", "aria-label": `Avatar ${size}`, children: jsx("div", { className: styles$s['zds-avatar__circle__icon'], children: icon }) }));
|
|
19
18
|
};
|
|
20
19
|
|
|
21
|
-
var styles$
|
|
20
|
+
var styles$r = {"zds-badge__container":"Badge-module__zds-badge__container___NMAZD","zds-badge":"Badge-module__zds-badge___TeF7g","zds-badge__status":"Badge-module__zds-badge__status___3rFKE","zds-badge__small":"Badge-module__zds-badge__small___lVA0I","zds-badge__large":"Badge-module__zds-badge__large___yxb6z","zds-badge__status__empty":"Badge-module__zds-badge__status__empty___zWu8n"};
|
|
22
21
|
|
|
23
22
|
const Badge = ({ children, badgeValue = null, type = 'notification', className = '', id, 'aria-label': ariaLabel, }) => {
|
|
24
23
|
const isEmpty = badgeValue === null || badgeValue === undefined || badgeValue === '';
|
|
@@ -41,19 +40,19 @@ const Badge = ({ children, badgeValue = null, type = 'notification', className =
|
|
|
41
40
|
};
|
|
42
41
|
const displayValue = getDisplayValue(badgeValue);
|
|
43
42
|
if (type === 'notification') {
|
|
44
|
-
return (jsxs("div", { className: clsx(styles$
|
|
45
|
-
[styles$
|
|
46
|
-
[styles$
|
|
47
|
-
}, className), "data-testid": "badge-notification", children: !isEmpty && (jsx("span", { className: styles$
|
|
43
|
+
return (jsxs("div", { className: clsx(styles$r['zds-badge__container']), children: [jsx("div", { id: componentId, className: clsx(styles$r['zds-badge'], {
|
|
44
|
+
[styles$r['zds-badge__small']]: Number(badgeValue) <= 10,
|
|
45
|
+
[styles$r['zds-badge__large']]: Number(badgeValue) > 10,
|
|
46
|
+
}, className), "data-testid": "badge-notification", children: !isEmpty && (jsx("span", { className: styles$r['zds-badge__value'], "aria-hidden": ariaLabel ? 'true' : 'false', children: displayValue })) }), children && (jsx("div", { className: styles$r['zds-badge__content'], "data-testid": "badge-content", children: children }))] }));
|
|
48
47
|
}
|
|
49
|
-
return (jsx("div", { className: clsx(styles$
|
|
50
|
-
[styles$
|
|
51
|
-
}, className), "data-testid": "badge-status", children: !isEmpty && (jsx("span", { className: styles$
|
|
48
|
+
return (jsx("div", { className: clsx(styles$r['zds-badge__container']), children: jsx("div", { className: clsx(styles$r['zds-badge__status'], {
|
|
49
|
+
[styles$r['zds-badge__status__empty']]: isEmpty,
|
|
50
|
+
}, className), "data-testid": "badge-status", children: !isEmpty && (jsx("span", { className: styles$r['zds-badge__status-value'], "aria-hidden": ariaLabel ? 'true' : 'false', children: displayValue })) }) }));
|
|
52
51
|
};
|
|
53
52
|
|
|
54
|
-
var styles$
|
|
53
|
+
var styles$q = {"zds-button":"Button-module__zds-button___yeGfH","zds-button__lg":"Button-module__zds-button__lg___3VQCU","zds-button__sm":"Button-module__zds-button__sm___YoOxy","zds-button__filled":"Button-module__zds-button__filled___8J2j-","zds-button__outlined":"Button-module__zds-button__outlined___fvHfI","zds-button__text":"Button-module__zds-button__text___WR6Oo","zds-button__with-icon":"Button-module__zds-button__with-icon___a2CVV","zds-button__icon-position-left":"Button-module__zds-button__icon-position-left___0Oid0","zds-button__icon-position-right":"Button-module__zds-button__icon-position-right___-rTaE","zds-button__no-content":"Button-module__zds-button__no-content___SpTQ-","zds-button__icon-only":"Button-module__zds-button__icon-only___jv5KY","zds-button__icon-left":"Button-module__zds-button__icon-left___fzDuF","zds-button__icon-right":"Button-module__zds-button__icon-right___IUOQu","zds-button__full-width":"Button-module__zds-button__full-width___GklRb","disabled":"Button-module__disabled___UzdWL"};
|
|
55
54
|
|
|
56
|
-
const Button =
|
|
55
|
+
const Button = React.forwardRef(({ as, children, variant = 'filled', iconPosition = 'left', href, to, external = false, target, rel, routerProps = {}, disabled = false, onClick, size = 'lg', className = '', type = 'button', id = '', icon = null, fullWidth = false, ariaLabel = '', iconOnly = false, ...restProps }, ref) => {
|
|
57
56
|
const componentId = id || useId();
|
|
58
57
|
const getComponent = () => {
|
|
59
58
|
if (as)
|
|
@@ -66,15 +65,15 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
66
65
|
};
|
|
67
66
|
const Component = getComponent();
|
|
68
67
|
const hasContent = useMemo(() => {
|
|
69
|
-
return children &&
|
|
68
|
+
return children && React.Children.count(children) > 0;
|
|
70
69
|
}, [children]);
|
|
71
|
-
const buttonClasses = clsx(styles$
|
|
72
|
-
[styles$
|
|
73
|
-
[styles$
|
|
74
|
-
[styles$
|
|
75
|
-
[styles$
|
|
76
|
-
[styles$
|
|
77
|
-
[styles$
|
|
70
|
+
const buttonClasses = clsx(styles$q['zds-button'], styles$q[`zds-button__${variant}`], styles$q[`zds-button__${size}`], {
|
|
71
|
+
[styles$q['zds-button__with-icon']]: icon && !iconOnly,
|
|
72
|
+
[styles$q[`zds-button__icon-position-${iconPosition}`]]: icon && !iconOnly && iconPosition !== 'none',
|
|
73
|
+
[styles$q['zds-button__no-content']]: icon && !hasContent && !iconOnly,
|
|
74
|
+
[styles$q['zds-button__full-width']]: fullWidth,
|
|
75
|
+
[styles$q['zds-button__icon-only']]: iconOnly,
|
|
76
|
+
[styles$q['zds-button__disabled']]: disabled,
|
|
78
77
|
}, className);
|
|
79
78
|
const getAriaLabel = () => {
|
|
80
79
|
if (ariaLabel)
|
|
@@ -98,9 +97,9 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
98
97
|
};
|
|
99
98
|
const renderContent = () => {
|
|
100
99
|
if (iconOnly && icon) {
|
|
101
|
-
return (jsx("span", { className: styles$
|
|
100
|
+
return (jsx("span", { className: styles$q['zds-button__icon-only'], "aria-hidden": "true", children: icon }));
|
|
102
101
|
}
|
|
103
|
-
return (jsxs(Fragment, { children: [icon && iconPosition === 'left' && (jsx("span", { className: styles$
|
|
102
|
+
return (jsxs(Fragment, { children: [icon && iconPosition === 'left' && (jsx("span", { className: styles$q['zds-button__icon-left'], "aria-hidden": "true", children: icon })), children, icon && iconPosition === 'right' && (jsx("span", { className: styles$q['zds-button__icon-right'], "aria-hidden": "true", children: icon }))] }));
|
|
104
103
|
};
|
|
105
104
|
const baseProps = {
|
|
106
105
|
ref,
|
|
@@ -143,7 +142,7 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
143
142
|
});
|
|
144
143
|
Button.displayName = 'Button';
|
|
145
144
|
|
|
146
|
-
var styles$
|
|
145
|
+
var styles$p = {"zds-calendar":"Calendar-module__zds-calendar___PxF9r","zds-calendar__header":"Calendar-module__zds-calendar__header___KsUk4","zds-calendar__month-name":"Calendar-module__zds-calendar__month-name___lyWIV","zds-calendar__year":"Calendar-module__zds-calendar__year___kWZ5P","zds-calendar__year-view":"Calendar-module__zds-calendar__year-view___srlWI","zds-calendar__year--current":"Calendar-module__zds-calendar__year--current___iVQH-","zds-calendar__navigation":"Calendar-module__zds-calendar__navigation___HVXdu","zds-calendar__weekdays":"Calendar-module__zds-calendar__weekdays___x8IAE","zds-calendar__grid":"Calendar-module__zds-calendar__grid___7VcR9","zds-calendar__weekday":"Calendar-module__zds-calendar__weekday___-dJW-","zds-calendar__days":"Calendar-module__zds-calendar__days___voUPb","zds-calendar__day":"Calendar-module__zds-calendar__day___ajiy4","zds-calendar__day--today":"Calendar-module__zds-calendar__day--today___qr5Cn","zds-calendar__day--selected":"Calendar-module__zds-calendar__day--selected___18JlM","zds-calendar__day--empty":"Calendar-module__zds-calendar__day--empty___uj4TJ","zds-calendar__clear":"Calendar-module__zds-calendar__clear___gEqoV"};
|
|
147
146
|
|
|
148
147
|
// i18n.ts
|
|
149
148
|
// Resources configuration
|
|
@@ -503,8 +502,8 @@ const Calendar = ({ currentDate, className, selectedDate = null, onDateChange, o
|
|
|
503
502
|
* Renderiza os anos usando o array de objetos memoizado.
|
|
504
503
|
*/
|
|
505
504
|
const renderYears = useCallback(() => {
|
|
506
|
-
return yearsArray.map((item) => (jsx("div", { className: clsx(styles$
|
|
507
|
-
[styles$
|
|
505
|
+
return yearsArray.map((item) => (jsx("div", { className: clsx(styles$p['zds-calendar__year'], {
|
|
506
|
+
[styles$p['zds-calendar__year--current']]: item.isCurrent,
|
|
508
507
|
}), onClick: () => handleYearSelect(item.year), tabIndex: 0, role: "button", "aria-pressed": item.isCurrent, "aria-label": item.isCurrent
|
|
509
508
|
? locale === 'en-us'
|
|
510
509
|
? `Current year, ${item.year}`
|
|
@@ -524,14 +523,14 @@ const Calendar = ({ currentDate, className, selectedDate = null, onDateChange, o
|
|
|
524
523
|
const renderDays = useCallback(() => {
|
|
525
524
|
return daysArray.map((item) => {
|
|
526
525
|
if (item.type === 'empty') {
|
|
527
|
-
return (jsx("div", { className: clsx(styles$
|
|
526
|
+
return (jsx("div", { className: clsx(styles$p['zds-calendar__day'], styles$p['zds-calendar__day--empty']), "aria-hidden": "true" }, item.key));
|
|
528
527
|
}
|
|
529
528
|
const dayItem = item;
|
|
530
529
|
const isDisabled = !isDateInRange(dayItem.date);
|
|
531
|
-
return (jsx("div", { className: clsx(styles$
|
|
532
|
-
[styles$
|
|
533
|
-
[styles$
|
|
534
|
-
[styles$
|
|
530
|
+
return (jsx("div", { className: clsx(styles$p['zds-calendar__day'], {
|
|
531
|
+
[styles$p['zds-calendar__day--today']]: dayItem.isToday,
|
|
532
|
+
[styles$p['zds-calendar__day--selected']]: dayItem.isSelected,
|
|
533
|
+
[styles$p['zds-calendar__day--disabled']]: isDisabled,
|
|
535
534
|
}), onClick: isDisabled ? undefined : () => handleSelectDay(dayItem.day), onKeyDown: isDisabled ? undefined : (e) => handleDayKeyDown(e, dayItem.day), tabIndex: isDisabled ? -1 : 0, role: "gridcell", "aria-selected": dayItem.isSelected, "aria-current": dayItem.isToday ? 'date' : undefined, "aria-disabled": isDisabled, "aria-label": `${dayItem.day} ${getMonthName()} ${year}${dayItem.isToday ? ` (${t('today')})` : ''}${dayItem.isSelected ? ` (${t('selected')})` : ''}${isDisabled ? ` (${t('disabled')})` : ''}`, children: dayItem.day }, dayItem.key));
|
|
536
535
|
});
|
|
537
536
|
}, [
|
|
@@ -547,7 +546,7 @@ const Calendar = ({ currentDate, className, selectedDate = null, onDateChange, o
|
|
|
547
546
|
const weekdaysComponent = useMemo(() => {
|
|
548
547
|
if (changeView)
|
|
549
548
|
return null;
|
|
550
|
-
return weekDaysLabels.map((day, idx) => (jsx("div", { className: styles$
|
|
549
|
+
return weekDaysLabels.map((day, idx) => (jsx("div", { className: styles$p['zds-calendar__weekday'], children: day }, `${day}-${idx}`)));
|
|
551
550
|
}, [changeView, weekDaysLabels]);
|
|
552
551
|
// ✅ Limpa o anúncio após um tempo para evitar repetições
|
|
553
552
|
useEffect(() => {
|
|
@@ -562,13 +561,13 @@ const Calendar = ({ currentDate, className, selectedDate = null, onDateChange, o
|
|
|
562
561
|
setYearRangeStart(year - 13);
|
|
563
562
|
}
|
|
564
563
|
}, [changeView, year]);
|
|
565
|
-
return (jsxs("div", { className: clsx(styles$
|
|
564
|
+
return (jsxs("div", { className: clsx(styles$p['zds-calendar'], { [styles$p['zds-calendar--year-view']]: changeView }, className), id: componentId, tabIndex: 0, ref: calendarRef, onKeyDown: handleCalendarKeyDown, "aria-label": t('calendar'), children: [jsx("div", { "aria-live": "polite", "aria-atomic": "true", className: styles$p['zds-calendar__aria-live'], style: {
|
|
566
565
|
position: 'absolute',
|
|
567
566
|
width: 1,
|
|
568
567
|
height: 1,
|
|
569
568
|
overflow: 'hidden',
|
|
570
569
|
clip: 'rect(1px, 1px, 1px, 1px)',
|
|
571
|
-
}, children: announcement }), jsxs("div", { className: styles$
|
|
570
|
+
}, children: announcement }), jsxs("div", { className: styles$p['zds-calendar__header'], children: [jsxs("span", { className: styles$p['zds-calendar__month-name'], onClick: handleToggleView, onKeyDown: (e) => {
|
|
572
571
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
573
572
|
e.preventDefault();
|
|
574
573
|
handleToggleView();
|
|
@@ -579,7 +578,7 @@ const Calendar = ({ currentDate, className, selectedDate = null, onDateChange, o
|
|
|
579
578
|
: 'Fechar seleção de ano'
|
|
580
579
|
: locale === 'en-us'
|
|
581
580
|
? 'Open year selection'
|
|
582
|
-
: 'Abrir seleção de ano', children: [`${getMonthName()} ${year}`, changeView ? (jsx(ChevronUp16Regular, { "aria-hidden": "true" })) : (jsx(ChevronDown16Regular, { "aria-hidden": "true" }))] }), jsxs("div", { className: styles$
|
|
581
|
+
: 'Abrir seleção de ano', children: [`${getMonthName()} ${year}`, changeView ? (jsx(ChevronUp16Regular, { "aria-hidden": "true" })) : (jsx(ChevronDown16Regular, { "aria-hidden": "true" }))] }), jsxs("div", { className: styles$p['zds-calendar__navigation'], children: [jsx("button", { onClick: handlePrevMonth, "aria-label": changeView
|
|
583
582
|
? locale === 'en-us'
|
|
584
583
|
? 'Show previous years'
|
|
585
584
|
: 'Mostrar anos anteriores'
|
|
@@ -591,27 +590,27 @@ const Calendar = ({ currentDate, className, selectedDate = null, onDateChange, o
|
|
|
591
590
|
: 'Mostrar próximos anos'
|
|
592
591
|
: locale === 'en-us'
|
|
593
592
|
? `Next month, ${new Date(year, month + 1, 1).toLocaleDateString('en-US', { month: 'long', year: 'numeric' })}`
|
|
594
|
-
: `Próximo mês, ${new Date(year, month + 1, 1).toLocaleDateString('pt-BR', { month: 'long', year: 'numeric' })}`, type: "button", className: "zds-calendar__nav-button", children: jsx(ChevronRight16Regular, { "aria-hidden": "true" }) })] })] }), jsx("div", { className: styles$
|
|
593
|
+
: `Próximo mês, ${new Date(year, month + 1, 1).toLocaleDateString('pt-BR', { month: 'long', year: 'numeric' })}`, type: "button", className: "zds-calendar__nav-button", children: jsx(ChevronRight16Regular, { "aria-hidden": "true" }) })] })] }), jsx("div", { className: styles$p['zds-calendar__weekdays'], children: weekdaysComponent }), jsx("div", { className: styles$p['zds-calendar__grid'], children: changeView ? (jsx("div", { className: styles$p['zds-calendar__year-view'], role: "grid", "aria-label": t('yearSelection'), children: renderYears() })) : (jsx("div", { className: styles$p['zds-calendar__days'], role: "grid", "aria-label": `${getMonthName()} ${year}`, children: renderDays() })) }), jsx("div", { className: styles$p['zds-calendar__clear'], children: jsx(Button, { size: "sm", variant: "outlined", onClick: handleClearDate, disabled: !selectedDate, children: "Limpar" }) })] }));
|
|
595
594
|
};
|
|
596
595
|
// ✅ Default props integrados na função usando valores padrão dos parâmetros
|
|
597
596
|
Calendar.displayName = 'Calendar';
|
|
598
|
-
const MemoizedCalendar =
|
|
597
|
+
const MemoizedCalendar = React.memo(Calendar);
|
|
599
598
|
MemoizedCalendar.displayName = 'Calendar';
|
|
600
599
|
|
|
601
|
-
var styles$
|
|
600
|
+
var styles$o = {"zds-callout__container":"Callout-module__zds-callout__container___EoOQd","zds-callout__container__with-title":"Callout-module__zds-callout__container__with-title___NUq2k","zds-callout__neutral":"Callout-module__zds-callout__neutral___ib9gW","zds-callout__brand":"Callout-module__zds-callout__brand___UYVny","zds-callout__color":"Callout-module__zds-callout__color___6ojEV","zds-callout__alert":"Callout-module__zds-callout__alert___gSOsh","zds-callout__success":"Callout-module__zds-callout__success___6W096","zds-callout__title":"Callout-module__zds-callout__title___jmmqj","zds-callout__text":"Callout-module__zds-callout__text___MTO5R","zds-callout__icon":"Callout-module__zds-callout__icon___-CaUD","zds-callout__content":"Callout-module__zds-callout__content___hh0Mj","zds-callout__subcontent":"Callout-module__zds-callout__subcontent___olIpt"};
|
|
602
601
|
|
|
603
602
|
const Callout = ({ type = 'neutral', title = null, text = '', icon = null, className = '', id = '' }) => {
|
|
604
603
|
const generatedId = useId();
|
|
605
604
|
const titleId = id || `callout-title-${generatedId}`;
|
|
606
605
|
const componentId = id || generatedId;
|
|
607
|
-
const calloutClass = clsx(styles$
|
|
608
|
-
[styles$
|
|
609
|
-
[styles$
|
|
606
|
+
const calloutClass = clsx(styles$o['zds-callout__container'], styles$o[`zds-callout__${type}`], {
|
|
607
|
+
[styles$o['zds-callout__container__with-title']]: title,
|
|
608
|
+
[styles$o['zds-callout__no-icon']]: !icon,
|
|
610
609
|
}, className);
|
|
611
|
-
return (jsx("div", { id: componentId, className: calloutClass, "aria-live": "polite", role: "alert", "aria-labelledby": title ? titleId : undefined, children: jsxs("div", { className: styles$
|
|
610
|
+
return (jsx("div", { id: componentId, className: calloutClass, "aria-live": "polite", role: "alert", "aria-labelledby": title ? titleId : undefined, children: jsxs("div", { className: styles$o['zds-callout__content'], children: [icon && jsx("span", { className: styles$o['zds-callout__icon'], children: icon }), jsxs("div", { className: styles$o['zds-callout__subcontent'], children: [title && (jsx("span", { id: titleId, className: styles$o['zds-callout__title'], children: title })), text && jsx("span", { className: styles$o['zds-callout__text'], children: text })] })] }) }));
|
|
612
611
|
};
|
|
613
612
|
|
|
614
|
-
var styles$
|
|
613
|
+
var styles$n = {"container":"Checkbox-module__container___pUY-s","root":"Checkbox-module__root___BS5dT","disabled":"Checkbox-module__disabled___WagIC","label":"Checkbox-module__label___JBaRm","indicator":"Checkbox-module__indicator___HXLHH","wrapperCheckbox":"Checkbox-module__wrapperCheckbox___m2qIW"};
|
|
615
614
|
|
|
616
615
|
const CheckSmall = ({ className = '', width = 12, height = 10, fill = 'white', ...restProps }) => {
|
|
617
616
|
return (jsx("svg", { width: width, height: height, viewBox: "0 0 12 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", ...restProps, children: jsx("path", { d: "M4 9.4L0 5.4L1.4 4L4 6.6L10.6 0L12 1.4L4 9.4Z", fill: fill }) }));
|
|
@@ -621,57 +620,11 @@ const CheckHalf = ({ className = '', width = 16, height = 16, fill = 'white', ..
|
|
|
621
620
|
return (jsx("svg", { width: width, height: height, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", ...restProps, children: jsx("g", { id: "Icons/check_indeterminate_small", children: jsx("path", { id: "icon", d: "M3 9V7H13V9H3Z", fill: fill }) }) }));
|
|
622
621
|
};
|
|
623
622
|
|
|
624
|
-
|
|
625
|
-
* A customizable Checkbox component that supports controlled and uncontrolled states.
|
|
626
|
-
*/
|
|
627
|
-
const Checkbox = ({ id, name, onChange, label = 'Checkbox', className = '', value = '', disabled = false, indeterminate = false, checked = false, ariaDescribedby = '', }) => {
|
|
628
|
-
const elementRef = useRef(null);
|
|
629
|
-
const generatedId = useId();
|
|
630
|
-
const inputId = id || generatedId;
|
|
631
|
-
const handleChange = (e) => {
|
|
632
|
-
if (disabled)
|
|
633
|
-
return;
|
|
634
|
-
onChange?.(e);
|
|
635
|
-
};
|
|
636
|
-
const checkboxClass = clsx(styles$o['zds-checkbox'], {
|
|
637
|
-
[styles$o['zds-checkbox__disabled']]: disabled,
|
|
638
|
-
[styles$o['zds-checkbox__checked']]: checked && !indeterminate,
|
|
639
|
-
[styles$o['zds-checkbox__indeterminate']]: indeterminate,
|
|
640
|
-
}, className);
|
|
641
|
-
useEffect(() => {
|
|
642
|
-
if (elementRef.current) {
|
|
643
|
-
elementRef.current.indeterminate = indeterminate;
|
|
644
|
-
}
|
|
645
|
-
}, [indeterminate]);
|
|
646
|
-
return (jsx("div", { className: checkboxClass, children: jsxs("label", { htmlFor: inputId, className: styles$o['zds-checkbox__box-check'], children: [jsxs("div", { className: clsx(styles$o['zds-checkbox__checkmark'], {
|
|
647
|
-
[styles$o['zds-checkbox__checkmark__checked']]: checked && !indeterminate,
|
|
648
|
-
[styles$o['zds-checkbox__checkmark__indeterminate']]: indeterminate,
|
|
649
|
-
}), children: [jsx("input", { id: inputId, ref: elementRef, name: name, type: "checkbox", value: value, checked: checked, onChange: handleChange, disabled: disabled, "aria-checked": indeterminate ? 'mixed' : checked, "aria-describedby": ariaDescribedby || undefined, "aria-label": typeof label === 'string' ? label : 'Checkbox', tabIndex: disabled ? -1 : 0 }), checked && !indeterminate && (jsx("span", { className: styles$o['zds-checkbox__icon'], "aria-hidden": "true", children: jsx(CheckSmall, {}) })), indeterminate && (jsx("span", { className: styles$o['zds-checkbox__icon'], "aria-hidden": "true", children: jsx(CheckHalf, {}) }))] }), label && (jsx("div", { className: styles$o['zds-checkbox__text'], children: jsx("span", { className: styles$o['zds-checkbox__label'], children: label }) }))] }) }));
|
|
650
|
-
};
|
|
651
|
-
const MemoizedCheckbox = React__default.memo(Checkbox);
|
|
652
|
-
MemoizedCheckbox.displayName = 'Checkbox';
|
|
653
|
-
|
|
654
|
-
var styles$n = {"container":"CheckboxRadix-module__container___34peZ","root":"CheckboxRadix-module__root___P9Ddi","disabled":"CheckboxRadix-module__disabled___WmZnj","label":"CheckboxRadix-module__label___-d8vL","indicator":"CheckboxRadix-module__indicator___jwn2k","wrapperCheckbox":"CheckboxRadix-module__wrapperCheckbox___--xXQ"};
|
|
655
|
-
|
|
656
|
-
const CheckboxRadix = ({ id, label, onCheckedChange, checked, disabled, className, indeterminate = false, ...rest }) => {
|
|
623
|
+
const Checkbox = ({ id, label = '', onCheckedChange, checked, disabled, className, indeterminate = false, ...rest }) => {
|
|
657
624
|
const componentId = id || useId();
|
|
658
|
-
const checkboxRef = React.useRef(null);
|
|
659
|
-
const handleWrapperClick = (e) => {
|
|
660
|
-
if (e.target !== checkboxRef.current && !disabled) {
|
|
661
|
-
e.stopPropagation();
|
|
662
|
-
e.preventDefault();
|
|
663
|
-
checkboxRef.current?.click();
|
|
664
|
-
}
|
|
665
|
-
};
|
|
666
|
-
const handleWrapperKeyDown = (e) => {
|
|
667
|
-
if ((e.key === ' ' || e.key === 'Enter') && !disabled) {
|
|
668
|
-
e.preventDefault();
|
|
669
|
-
checkboxRef.current?.click();
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
625
|
return (jsxs("div", { className: clsx(styles$n.container, className), children: [jsx("div", { className: clsx(styles$n.wrapperCheckbox, {
|
|
673
626
|
[styles$n.disabled]: disabled,
|
|
674
|
-
}),
|
|
627
|
+
}), role: "presentation", tabIndex: disabled ? -1 : 0, children: jsx(Checkbox$1.Root, { className: styles$n.root, checked: checked, id: componentId, onCheckedChange: onCheckedChange, disabled: disabled, "data-disabled": disabled, "data-indeterminate": indeterminate, "aria-checked": indeterminate ? 'mixed' : checked ? 'true' : 'false', ...rest, children: jsx(Checkbox$1.Indicator, { className: styles$n.indicator, children: indeterminate ? jsx(CheckHalf, {}) : jsx(CheckSmall, {}) }) }) }), jsx("label", { className: clsx(styles$n.label, { [styles$n.disabled]: disabled }), htmlFor: componentId, children: label })] }));
|
|
675
628
|
};
|
|
676
629
|
|
|
677
630
|
var styles$m = {"zds-chips":"Chips-module__zds-chips___LEq0v","zds-chips__title":"Chips-module__zds-chips__title___JexH8","zds-chips__icon__left":"Chips-module__zds-chips__icon__left___frGxl","zds-chips__icon__right":"Chips-module__zds-chips__icon__right___3EmZr","has-left-icon":"Chips-module__has-left-icon___BNIkr","has-right-icon":"Chips-module__has-right-icon___jhoos","zds-chips--neutral":"Chips-module__zds-chips--neutral___FyRQq","zds-chips--brand":"Chips-module__zds-chips--brand___GbmJv","zds-chips--color":"Chips-module__zds-chips--color___JpMwI","zds-chips--alert":"Chips-module__zds-chips--alert___MHi5a","zds-chips--success":"Chips-module__zds-chips--success___jg4-F","zds-chips--disabled":"Chips-module__zds-chips--disabled___HkRDl"};
|
|
@@ -691,7 +644,7 @@ const Chips = ({ title, leftIcon = null, rightIcon = null, type = 'neutral', dis
|
|
|
691
644
|
}, className);
|
|
692
645
|
return (jsxs("div", { className: chipsClass, "aria-label": `Chip: ${title}`, "aria-disabled": disabled, children: [leftIcon && (jsx("span", { className: styles$m['zds-chips__icon__left'], "aria-hidden": "true", children: leftIcon })), jsx("span", { className: styles$m['zds-chips__title'], children: title }), rightIcon && (jsx("span", { className: styles$m['zds-chips__icon__right'], children: rightIcon }))] }));
|
|
693
646
|
};
|
|
694
|
-
const MemoizedChips =
|
|
647
|
+
const MemoizedChips = React.memo(Chips);
|
|
695
648
|
MemoizedChips.displayName = 'Chips';
|
|
696
649
|
|
|
697
650
|
var styles$l = {"container":"Container-module__container___exPuE"};
|
|
@@ -702,47 +655,13 @@ function Container({ children }) {
|
|
|
702
655
|
|
|
703
656
|
var styles$k = {"wrapperLabel":"index-module__wrapperLabel___XJzZO","requiredLabel":"index-module__requiredLabel___7oZkh","infoIcon":"index-module__infoIcon___lClx4","errorLabel":"index-module__errorLabel___qa6h6","disabledLabel":"index-module__disabledLabel___U9vL8"};
|
|
704
657
|
|
|
705
|
-
var styles$j = {"
|
|
706
|
-
|
|
707
|
-
const Tooltip = ({
|
|
708
|
-
|
|
709
|
-
const timeoutRef = useRef(null);
|
|
710
|
-
const tooltipRef = useRef(null);
|
|
711
|
-
const tooltipId = id || useId();
|
|
712
|
-
const handleMouseEnter = () => {
|
|
713
|
-
if (timeoutRef.current)
|
|
714
|
-
clearTimeout(timeoutRef.current);
|
|
715
|
-
setVisible(true);
|
|
716
|
-
};
|
|
717
|
-
const handleMouseLeave = () => {
|
|
718
|
-
timeoutRef.current = setTimeout(() => {
|
|
719
|
-
setVisible(false);
|
|
720
|
-
}, 800);
|
|
721
|
-
};
|
|
722
|
-
const handleKeyDown = (e) => {
|
|
723
|
-
switch (e.key) {
|
|
724
|
-
case 'Escape':
|
|
725
|
-
setVisible(false);
|
|
726
|
-
break;
|
|
727
|
-
case 'Enter':
|
|
728
|
-
case ' ':
|
|
729
|
-
e.preventDefault();
|
|
730
|
-
setVisible(!visible);
|
|
731
|
-
break;
|
|
732
|
-
}
|
|
733
|
-
};
|
|
734
|
-
useEffect(() => {
|
|
735
|
-
return () => {
|
|
736
|
-
if (timeoutRef.current) {
|
|
737
|
-
clearTimeout(timeoutRef.current);
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
}, []);
|
|
741
|
-
const tooltipClass = clsx(styles$j['zds-tooltip__content'], styles$j[`zds-tooltip__${position}`]);
|
|
742
|
-
return (jsxs("div", { className: clsx(styles$j['zds-tooltip__wrapper']), onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onFocus: handleMouseEnter, onBlur: handleMouseLeave, onKeyDown: handleKeyDown, tabIndex: 0, "aria-describedby": visible ? tooltipId : undefined, children: [children, visible && (jsx("div", { ref: tooltipRef, className: tooltipClass, role: 'tooltip', id: tooltipId, "aria-describedby": tooltipId, "aria-hidden": !visible, children: text }))] }));
|
|
658
|
+
var styles$j = {"tooltipContent":"Tooltip-module__tooltipContent___xycUg","triggerWrapper":"Tooltip-module__triggerWrapper___x83XR"};
|
|
659
|
+
|
|
660
|
+
const Tooltip = ({ children, text, side = 'bottom', align = 'start', maxWidth, sideOffset = 10 }) => {
|
|
661
|
+
return (jsx(Tooltip$1.Provider, { children: jsxs(Tooltip$1.Root, { children: [jsx(Tooltip$1.Trigger, { asChild: true, children: jsx("span", { className: styles$j.triggerWrapper, children: children }) }), jsx(Tooltip$1.Portal, { children: jsx(Tooltip$1.Content, { className: styles$j.tooltipContent, side: side, align: align, sideOffset: sideOffset, style: { maxWidth: maxWidth ? `${maxWidth}px` : 'auto' }, children: text }) })] }) }));
|
|
743
662
|
};
|
|
744
663
|
|
|
745
|
-
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false,
|
|
664
|
+
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false, tooltipText, side = 'bottom', align = 'start', className, error = false, disabled = false }) => (jsx(Fragment, { children: tooltip ? (jsx(Tooltip, { side: side, align: align, text: tooltipText || '', children: jsxs(Label.Root, { className: clsx(styles$k.wrapperLabel, error && styles$k.errorLabel, className), htmlFor: htmlFor, children: [children, required && jsx("span", { className: styles$k.requiredLabel, children: "*" }), jsx(Info12Regular, { className: styles$k.infoIcon })] }) })) : (jsxs(Label.Root, { className: clsx(styles$k.wrapperLabel, error && styles$k.errorLabel, disabled && styles$k.disabledLabel, className), htmlFor: htmlFor, children: [children, required && jsx("span", { className: styles$k.requiredLabel, children: "*" })] })) }));
|
|
746
665
|
|
|
747
666
|
var styles$i = {"container":"TextField-module__container___WJHFR","inputWrapper":"TextField-module__inputWrapper___INjfd","inputContainer":"TextField-module__inputContainer___3EsFJ","icon":"TextField-module__icon___p1vwi","clearButton":"TextField-module__clearButton___kgOot","helperText":"TextField-module__helperText___d5QGC","error":"TextField-module__error___IGQzp","disabled":"TextField-module__disabled___roIKP"};
|
|
748
667
|
|
|
@@ -756,7 +675,7 @@ const validateInput = ({ value, maxLength, errorMessage, required }) => {
|
|
|
756
675
|
return '';
|
|
757
676
|
};
|
|
758
677
|
|
|
759
|
-
const TextField = forwardRef(({ className, value = '', label, placeholder, type = 'text', onChange, disabled = false, maxLength = 30, required = false, helperText, tooltip = false, tooltipText = '',
|
|
678
|
+
const TextField = forwardRef(({ className, value = '', label, placeholder, type = 'text', onChange, disabled = false, maxLength = 30, required = false, helperText, tooltip = false, tooltipText = '', side = 'bottom', align = 'start', errorMessage = '', id, icon, onBlur, onFocus, name, ...inputProps }, ref) => {
|
|
760
679
|
const [inputValue, setInputValue] = useState(value);
|
|
761
680
|
const [inputError, setInputError] = useState('');
|
|
762
681
|
const [isFocused, setIsFocused] = useState(false);
|
|
@@ -804,13 +723,13 @@ const TextField = forwardRef(({ className, value = '', label, placeholder, type
|
|
|
804
723
|
[styles$i.disabled]: disabled,
|
|
805
724
|
[className]: className,
|
|
806
725
|
});
|
|
807
|
-
return (jsxs("div", { className: containerClass, children: [label && (jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip,
|
|
726
|
+
return (jsxs("div", { className: containerClass, children: [label && (jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxs("div", { className: styles$i.inputWrapper, children: [jsxs("div", { className: styles$i.inputContainer, children: [jsx("input", { ...inputProps, ref: ref, id: componentId, name: name, type: type, value: inputValue, placeholder: placeholder, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, maxLength: maxLength, disabled: disabled, "aria-invalid": hasError, "aria-required": required, "aria-describedby": helperId }), showCustomIcon && jsx("span", { className: styles$i.icon, children: icon }), showClearIcon && (jsx("button", { type: "button", className: styles$i.clearButton, onMouseDown: (e) => {
|
|
808
727
|
e.preventDefault();
|
|
809
728
|
handleClear();
|
|
810
729
|
}, "aria-label": "Limpar campo", tabIndex: -1, children: jsx(Dismiss16Regular, {}) }))] }), jsx("span", { id: helperId, className: styles$i.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText })] })] }));
|
|
811
730
|
});
|
|
812
731
|
TextField.displayName = 'TextField';
|
|
813
|
-
var TextField$1 =
|
|
732
|
+
var TextField$1 = React.memo(TextField);
|
|
814
733
|
|
|
815
734
|
/**
|
|
816
735
|
* Formata uma data para string conforme o locale.
|
|
@@ -1089,9 +1008,9 @@ const DatePicker = ({ locale = 'pt-br', calendarPosition = 'left', helperText =
|
|
|
1089
1008
|
}, [locale, currentSelectedDate, isEditing]);
|
|
1090
1009
|
return (jsx("div", { ref: wrapperRef, children: jsxs("div", { className: clsx(styles$h['zds-date-picker']), children: [jsx("div", { onClick: handleFieldClick, onFocus: handleFieldFocus, onKeyDown: handleKeyDown, style: { cursor: 'pointer' }, children: jsx(TextField$1, { type: "tel", icon: jsx(Calendar16Regular, { onClick: handleIconClick, style: { cursor: 'pointer' } }), onChange: (e) => {
|
|
1091
1010
|
handleTextFieldChange(String(e));
|
|
1092
|
-
}, "aria-label": "Open calendar", "aria-expanded": showCalendar, "aria-controls": "calendar-popup", placeholder: locale === 'en-us' ? 'MM/DD/YYYY' : 'DD/MM/YYYY', value: displayValue, errorMessage: undefined, "aria-invalid": !!currentError, "aria-describedby": combinedHelperText ? helperTextId : undefined, maxLength: 10,
|
|
1011
|
+
}, "aria-label": "Open calendar", "aria-expanded": showCalendar, "aria-controls": "calendar-popup", placeholder: locale === 'en-us' ? 'MM/DD/YYYY' : 'DD/MM/YYYY', value: displayValue, errorMessage: undefined, "aria-invalid": !!currentError, "aria-describedby": combinedHelperText ? helperTextId : undefined, maxLength: 10, helperText: combinedHelperText, required: required, label: label }) }), jsx("div", { className: clsx(styles$h['zds-date-picker__calendar-popup'], calendarPosition === 'left' && styles$h['zds-calendar--left'], calendarPosition === 'right' && styles$h['zds-calendar--right']), children: showCalendar && (jsx(MemoizedCalendar, { selectedDate: currentSelectedDate, currentDate: currentDate, onDateChange: setCurrentDate, onDaySelect: handleDaySelect, locale: locale, format: locale === 'en-us' ? 'mm/dd/yyyy' : 'dd/mm/yyyy' })) })] }) }));
|
|
1093
1012
|
};
|
|
1094
|
-
var DatePicker_default =
|
|
1013
|
+
var DatePicker_default = React.memo(DatePicker);
|
|
1095
1014
|
|
|
1096
1015
|
var styles$g = {"zds-dialog__overlay":"Dialog-module__zds-dialog__overlay___I0T-Q","zds-dialog__wrapper":"Dialog-module__zds-dialog__wrapper___Va69y","zds-dialog":"Dialog-module__zds-dialog___Bi-9b","zds-dialog__title":"Dialog-module__zds-dialog__title___w9yHe","zds-dialog__text":"Dialog-module__zds-dialog__text___-GmvH","zds-dialog__actions":"Dialog-module__zds-dialog__actions___hHHmN"};
|
|
1097
1016
|
|
|
@@ -1179,7 +1098,7 @@ const Dialog = ({ show, title, text, textConfirm = 'OK', textCancel = 'Cancelar'
|
|
|
1179
1098
|
return (jsxs(Fragment, { children: [jsx("div", { className: styles$g['zds-dialog__overlay'] }), jsx("div", { className: styles$g['zds-dialog__wrapper'], children: jsxs("div", { className: clsx(styles$g['zds-dialog'], className), role: "dialog", "aria-modal": "true", id: id, "aria-labelledby": `zds-dialog-title-${id}`, "aria-describedby": `zds-dialog-desc-${id}`, tabIndex: -1, ref: containerRef, children: [jsx("div", { id: `zds-dialog-title-${id}`, className: styles$g['zds-dialog__title'], children: title }), jsx("div", { id: `zds-dialog-desc-${id}`, className: styles$g['zds-dialog__text'], children: text }), jsxs("div", { className: styles$g['zds-dialog__actions'], children: [!!(textCancel && textCancel.trim()) && (jsx(Button, { variant: "outlined", onClick: handleCancel, children: textCancel })), jsx(Button, { variant: "filled", onClick: handleConfirm, children: textConfirm })] })] }) })] }));
|
|
1180
1099
|
};
|
|
1181
1100
|
// Memoização para otimização de performance
|
|
1182
|
-
const MemoizedDialog =
|
|
1101
|
+
const MemoizedDialog = React.memo(Dialog);
|
|
1183
1102
|
MemoizedDialog.displayName = 'Dialog';
|
|
1184
1103
|
|
|
1185
1104
|
var styles$f = {"zds-custom__drawer-shadow":"Drawer-module__zds-custom__drawer-shadow___xoF-q","zds-custom__drawer-shadow--visible":"Drawer-module__zds-custom__drawer-shadow--visible___9JUdU","zds-custom__drawer-sidebar":"Drawer-module__zds-custom__drawer-sidebar___MC8Zt","zds-custom__drawer-sidebar--open":"Drawer-module__zds-custom__drawer-sidebar--open___DiMJb","zds-custom__drawer-sidebar--disabled":"Drawer-module__zds-custom__drawer-sidebar--disabled___6OGsA","zds-drawer__title-close":"Drawer-module__zds-drawer__title-close___g9K3D","zds-drawer__title":"Drawer-module__zds-drawer__title___lqHFw","zds-drawer__children":"Drawer-module__zds-drawer__children___ZnzF6"};
|
|
@@ -1277,7 +1196,7 @@ onClose, title = 'Título', isOpen = false, onOpen, className = '', id, disabled
|
|
|
1277
1196
|
|
|
1278
1197
|
var styles$e = {"zds-search":"Search-module__zds-search___DRIVl","zds-search__leftIcon":"Search-module__zds-search__leftIcon___gBvTI","zds-search__clearIcon":"Search-module__zds-search__clearIcon___wsOBs"};
|
|
1279
1198
|
|
|
1280
|
-
const Search =
|
|
1199
|
+
const Search = React.forwardRef(({ placeholder = 'Dica do que deve ser buscado', disabled = false, value, onChange, onKeyDown, onFocus, onBlur, onClear, onClick, onMouseDown, id = '', className = '', }, ref) => {
|
|
1281
1200
|
const [internalValue, setInternalValue] = useState('');
|
|
1282
1201
|
const isControlled = value !== undefined && onChange !== undefined;
|
|
1283
1202
|
const currentValue = isControlled ? value : internalValue;
|
|
@@ -1602,7 +1521,7 @@ const Dropdown = ({ className, items = [], id, type = 'text', applySearch = fals
|
|
|
1602
1521
|
setSelectedItems({});
|
|
1603
1522
|
onSelectionChange?.([]);
|
|
1604
1523
|
}, [filter, onSelectionChange]);
|
|
1605
|
-
const isFirstRender =
|
|
1524
|
+
const isFirstRender = React.useRef(true);
|
|
1606
1525
|
useEffect(() => {
|
|
1607
1526
|
if (isFirstRender.current) {
|
|
1608
1527
|
isFirstRender.current = false;
|
|
@@ -1628,9 +1547,9 @@ const Dropdown = ({ className, items = [], id, type = 'text', applySearch = fals
|
|
|
1628
1547
|
const currentSelection = filter ? tempSelectedItems : selectedItems;
|
|
1629
1548
|
return (jsxs("div", { className: clsx(styles$d['zds-dropdown__item-content'], {
|
|
1630
1549
|
[styles$d['zds-dropdown__item-content--disabled']]: item.disabled,
|
|
1631
|
-
}), children: [type === 'checkbox' && (jsx(
|
|
1632
|
-
|
|
1633
|
-
|
|
1550
|
+
}), children: [type === 'checkbox' && (jsx(Checkbox, { checked: !!currentSelection[itemId], onCheckedChange: (checked) => {
|
|
1551
|
+
if (checked === 'indeterminate')
|
|
1552
|
+
return;
|
|
1634
1553
|
toggleSelection(itemId, item);
|
|
1635
1554
|
}, disabled: item.disabled, label: "" })), type === 'icon' && item.icon && (jsx("div", { className: styles$d['zds-dropdown__item-icon-container'], children: jsx("span", { className: styles$d['zds-dropdown__item-icon'], onClick: (event) => {
|
|
1636
1555
|
event.preventDefault();
|
|
@@ -1745,7 +1664,7 @@ const Dropdown = ({ className, items = [], id, type = 'text', applySearch = fals
|
|
|
1745
1664
|
}, children: renderItemContent(item, index) }, itemId));
|
|
1746
1665
|
})) : (jsx("li", { className: styles$d['zds-dropdown__no-results'], role: "status", "aria-live": "polite", children: "Nenhum item corresponde \u00E0 sua busca" })), filter && (jsxs("div", { className: styles$d['zds-dropdown__container-filter'], children: [jsx(Button, { size: "sm", variant: "outlined", onClick: handleClearFilter, children: "Limpar" }), jsx(Button, { size: "sm", onClick: handleApplyFilter, children: "Aplicar" })] })), infiniteScrollHook && infiniteScrollHook.hasNextPage && (jsx("li", { role: "none", className: styles$d['zds-dropdown__infinite-scroll-trigger'], children: jsx("div", { ref: infiniteScrollHook.observerRef, className: styles$d['zds-dropdown__loading-indicator'], children: infiniteScroll?.status === 'loading' ? (jsx("span", { children: "Carregando..." })) : (jsx("span", { children: "Trigger" })) }) }))] }) }));
|
|
1747
1666
|
};
|
|
1748
|
-
const MemoizedDropdown =
|
|
1667
|
+
const MemoizedDropdown = React.memo(Dropdown);
|
|
1749
1668
|
MemoizedDropdown.displayName = 'Dropdown';
|
|
1750
1669
|
|
|
1751
1670
|
var styles$c = {"zds-filter__container":"Filter-module__zds-filter__container___0E-nC","zds-filter__button":"Filter-module__zds-filter__button___gT9yM","zds-filter__icon":"Filter-module__zds-filter__icon___ypiCu","zds-filter__text":"Filter-module__zds-filter__text___1iywL","zds-filter__arrow":"Filter-module__zds-filter__arrow___xflU2","zds-filter__arrow--up":"Filter-module__zds-filter__arrow--up___R0HR-","zds-filter__arrow--down":"Filter-module__zds-filter__arrow--down___4YMmg","zds-filter__button--open":"Filter-module__zds-filter__button--open___OA6EF","zds-filter__dropdown":"Filter-module__zds-filter__dropdown___-67MJ","zds-filter__dropdown--left":"Filter-module__zds-filter__dropdown--left___GgonW","zds-filter__dropdown--right":"Filter-module__zds-filter__dropdown--right___7GS9L","zds-filter-button__content":"Filter-module__zds-filter-button__content___eNIIz","zds-filter-button__arrow":"Filter-module__zds-filter-button__arrow___ZhymS","zds-filter-button__icon":"Filter-module__zds-filter-button__icon___-42Ey"};
|
|
@@ -1840,32 +1759,16 @@ const Filter = ({ items = [], type = 'checkbox', selectedIds = [], onApplyFilter
|
|
|
1840
1759
|
return (jsxs("div", { ref: filterRef, className: filterClass, children: [jsx(Button, { variant: variant, onClick: handleToggle, disabled: disabled, icon: type === 'calendar' ? jsx(Calendar16Regular, {}) : jsx(ChevronDownRegular, {}), iconPosition: "right", size: "lg", children: jsxs("div", { className: styles$c['zds-filter-button__content'], children: [icon && jsx("span", { className: styles$c['zds-filter-button__icon'], children: icon }), jsx("span", { className: styles$c['zds-filter-button__text'], children: buttonDisplayText }), jsx("span", { className: `${styles$c['zds-filter-button__arrow']} ${isOpen ? styles$c['zds-filter-button__arrow--open'] : ''}`, children: getBadgeValue() && (jsx(Badge, { badgeValue: `+${getBadgeValue()}`, type: "status" })) })] }) }), isOpen && (jsx("div", { className: dropdownClass, children: type === 'calendar' ? (jsx(MemoizedCalendar, { currentDate: currentCalendarDate, selectedDate: selectedDate, onDaySelect: handleDateSelection, onDateChange: handleCalendarNavigation, minDate: minDate, maxDate: maxDate, locale: locale, onClear: handleClear, id: `filter-calendar-${filterRef.current?.id || ''}`, "aria-label": "Selecionar data para filtro" })) : (jsx(MemoizedDropdown, { items: items, type: type, defaultSelectedIds: selectedIds, placeholder: placeholder, applySearch: enableSearch, filter: true, onSelectionChange: handleApplyFilter })) }))] }));
|
|
1841
1760
|
};
|
|
1842
1761
|
|
|
1843
|
-
var styles$b = {"
|
|
1762
|
+
var styles$b = {"root":"Radio-module__root___7ElY2","wrapper":"Radio-module__wrapper___NYQ1y","disabled":"Radio-module__disabled___RZ0be","labelText":"Radio-module__labelText___Wkb41","item":"Radio-module__item___3Kvj7","itemWrapper":"Radio-module__itemWrapper___5KbM1","labelWrapper":"Radio-module__labelWrapper___LOHmJ","indicator":"Radio-module__indicator___TJ5hz"};
|
|
1844
1763
|
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
const uniqueId = useId();
|
|
1853
|
-
const inputId = id || uniqueId;
|
|
1854
|
-
const handleChange = (e) => {
|
|
1855
|
-
if (disabled)
|
|
1856
|
-
return;
|
|
1857
|
-
onChange?.(e.target.value);
|
|
1858
|
-
};
|
|
1859
|
-
const radioClass = clsx(styles$b['zds-radiobutton'], {
|
|
1860
|
-
[styles$b['zds-radiobutton--disabled']]: disabled,
|
|
1861
|
-
}, className);
|
|
1862
|
-
const labelClass = clsx(styles$b['zds-radiobutton__box-check'], {
|
|
1863
|
-
[styles$b['zds-radiobutton__disabled']]: disabled,
|
|
1864
|
-
});
|
|
1865
|
-
return (jsx("div", { className: radioClass, children: jsxs("label", { className: labelClass, htmlFor: inputId, children: [jsx("div", { className: styles$b['zds-radiobutton__mini-box'], children: jsx("input", { id: inputId, type: "radio", name: name, value: value, checked: checked, disabled: disabled, onChange: handleChange }) }), label && (jsx("span", { id: `${inputId}-description`, className: styles$b['zds-radiobutton__box-check__text'], children: label }))] }) }));
|
|
1764
|
+
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', ...rest }) => {
|
|
1765
|
+
const componentId = id || useId();
|
|
1766
|
+
return (jsx(RadioGroup.Root, { id: componentId, className: styles$b.root, defaultValue: defaultValue, onValueChange: onValueChange, name: name, "aria-label": ariaLabel, "data-orientation": orientation, orientation: orientation, ...rest, children: items.map(({ id, value, disabled, label }) => {
|
|
1767
|
+
const itemKey = id ?? value;
|
|
1768
|
+
const uniqueId = `${componentId}-item-${value}`;
|
|
1769
|
+
return (jsx("div", { className: clsx(styles$b.wrapper, { [styles$b.disabled]: disabled }), children: jsxs("label", { className: styles$b.labelWrapper, htmlFor: uniqueId, children: [jsx("div", { className: styles$b.itemWrapper, children: jsx(RadioGroup.Item, { disabled: disabled, className: styles$b.item, value: value, id: uniqueId, "data-disabled": disabled, children: jsx(RadioGroup.Indicator, { className: styles$b.indicator }) }) }), jsx("span", { className: styles$b.labelText, children: label })] }) }, itemKey));
|
|
1770
|
+
}) }));
|
|
1866
1771
|
};
|
|
1867
|
-
const MemoizedRadio = React__default.memo(Radio);
|
|
1868
|
-
MemoizedRadio.displayName = 'Radio';
|
|
1869
1772
|
|
|
1870
1773
|
var styles$a = {"zds-list-item__container":"ListItem-module__zds-list-item__container___mEIUK","zds-list-item--checkbox":"ListItem-module__zds-list-item--checkbox___wfi9-","zds-list-item--icon":"ListItem-module__zds-list-item--icon___h3Ijt","zds-list-item--radio":"ListItem-module__zds-list-item--radio___2l7mK","zds-list-item--text":"ListItem-module__zds-list-item--text___F0PDx","zds-list-item--hovered":"ListItem-module__zds-list-item--hovered___XrDWn","zds-list-item--disabled":"ListItem-module__zds-list-item--disabled___p1xZF","zds-list-item__wrapper-text":"ListItem-module__zds-list-item__wrapper-text___5-TX2","zds-list-item__wrapper-icon":"ListItem-module__zds-list-item__wrapper-icon___S6Fr1","zds-list-item__title":"ListItem-module__zds-list-item__title___AV7nz","zds-list-item__subtext":"ListItem-module__zds-list-item__subtext___nfXky","zds-list-item__text":"ListItem-module__zds-list-item__text___3y0sB"};
|
|
1871
1774
|
|
|
@@ -1952,9 +1855,13 @@ const ListItem = ({ id, className, variant = 'text', text = '', name = '', subTe
|
|
|
1952
1855
|
const currentVariant = validVariants.includes(variant) ? variant : 'text';
|
|
1953
1856
|
switch (currentVariant) {
|
|
1954
1857
|
case 'checkbox':
|
|
1955
|
-
return (jsxs(Fragment, { children: [jsx(
|
|
1858
|
+
return (jsxs(Fragment, { children: [jsx(Checkbox, { checked: internalChecked, disabled: disabled, onCheckedChange: () => handleCheckboxClick({}) }), jsxs("div", { className: styles$a['zds-list-item__wrapper-text'], children: [jsx("span", { id: `${itemId}-text`, className: styles$a['zds-list-item__text'], onClick: handleCheckboxClick, children: text }), showSubText && subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$a['zds-list-item__subtext'], onClick: handleCheckboxClick, children: subText }))] })] }));
|
|
1956
1859
|
case 'radio':
|
|
1957
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: styles$a['zds-list-item__wrapper-radio'], children: jsx("span", { className: styles$a['zds-list-item__radio'], "aria-hidden": "true", children: jsx(
|
|
1860
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: styles$a['zds-list-item__wrapper-radio'], children: jsx("span", { className: styles$a['zds-list-item__radio'], "aria-hidden": "true", children: jsx(Radio, { name: name, onValueChange: () => handleRadioClick({}), items: [{
|
|
1861
|
+
value: value,
|
|
1862
|
+
label: '',
|
|
1863
|
+
disabled: disabled
|
|
1864
|
+
}], "aria-labelledby": `${itemId}-text` }) }) }), jsxs("div", { className: styles$a['zds-list-item__wrapper-text'], children: [jsx("span", { id: `${itemId}-text`, className: styles$a['zds-list-item__title'], onClick: handleRadioClick, children: text }), showSubText && subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$a['zds-list-item__subtext'], children: subText }))] })] }));
|
|
1958
1865
|
case 'icon':
|
|
1959
1866
|
return (jsxs(Fragment, { children: [jsx("div", { className: styles$a['zds-list-item__wrapper-icon'], children: icon }), jsxs("div", { className: styles$a['zds-list-item__wrapper-text'], children: [jsx("span", { id: `${itemId}-text`, className: styles$a['zds-list-item__title'], onClick: handleTextOrIconClick, children: text }), showSubText && subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$a['zds-list-item__subtext'], children: subText }))] })] }));
|
|
1960
1867
|
case 'text':
|
|
@@ -2101,7 +2008,7 @@ const Menu = ({ children, menuItems = [], onMenuItemClick, onToggle, type = 'tex
|
|
|
2101
2008
|
}, [isMenuOpen, handleClickOutside, handleKeyDown]);
|
|
2102
2009
|
const renderAnchor = () => {
|
|
2103
2010
|
const dropdownId = `${id || 'menu'}-dropdown`;
|
|
2104
|
-
return
|
|
2011
|
+
return React.cloneElement(children, {
|
|
2105
2012
|
ref: anchorRef,
|
|
2106
2013
|
onClick: (e) => {
|
|
2107
2014
|
if (dropdownRef.current && dropdownRef.current.contains(e.target)) {
|
|
@@ -2593,23 +2500,12 @@ const Quantity = ({ defaultValue = 0, value: controlledValue, onChange, disabled
|
|
|
2593
2500
|
const inputId = id || uniqueId;
|
|
2594
2501
|
return (jsxs("div", { className: clsx(styles$7['zds-quantity'], { disabled }, className), children: [jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, icon: jsx(Subtract16Regular, {}), onClick: decrement, disabled: disabled || isMinValue, "aria-label": 'Diminuir quantidade' }), jsx("input", { ref: inputRef, className: clsx(styles$7['zds-quantity__input'], { disabled }), type: 'text', value: inputValue, onChange: handleInputChange, onBlur: handleBlur, onKeyDown: handleInputKeyDown, id: inputId, min: '0', step: stepValue, "aria-label": 'Quantidade', role: 'spinbutton', "aria-valuenow": computedValue, "aria-valuemin": 0, "aria-valuemax": decimal ? undefined : 9999, disabled: disabled, inputMode: decimal ? 'decimal' : 'numeric' }), jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, onClick: increment, disabled: disabled, "aria-label": 'Aumentar quantidade', icon: jsx(Add16Regular, {}) })] }));
|
|
2595
2502
|
};
|
|
2596
|
-
const memorizedQuantity =
|
|
2503
|
+
const memorizedQuantity = React.memo(Quantity);
|
|
2597
2504
|
memorizedQuantity.displayName = 'Quantity';
|
|
2598
2505
|
|
|
2599
|
-
var styles$6 = {"
|
|
2506
|
+
var styles$6 = {"zds-select":"Select-module__zds-select___TePBJ","zds-select__dropdown":"Select-module__zds-select__dropdown___pEXsY","zds-dropdown__container":"Select-module__zds-dropdown__container___TJvrT","zds-select__dropdown--top":"Select-module__zds-select__dropdown--top___O3u5M","zds-select__dropdown--bottom":"Select-module__zds-select__dropdown--bottom___qfKLH"};
|
|
2600
2507
|
|
|
2601
|
-
|
|
2602
|
-
const componentId = id || useId();
|
|
2603
|
-
return (jsx(RadioGroup.Root, { id: componentId, className: styles$6.root, defaultValue: defaultValue, onValueChange: onValueChange, name: name, "aria-label": ariaLabel, "data-orientation": orientation, orientation: orientation, ...rest, children: items.map(({ id, value, disabled, label }, index) => {
|
|
2604
|
-
const itemKey = id ?? value ?? `radio-${index}`;
|
|
2605
|
-
const uniqueId = `${componentId}-item-${value}`;
|
|
2606
|
-
return (jsx("div", { className: clsx(styles$6.wrapper, { [styles$6.disabled]: disabled }), children: jsxs("label", { className: styles$6.labelWrapper, htmlFor: uniqueId, children: [jsx("div", { className: styles$6.itemWrapper, children: jsx(RadioGroup.Item, { disabled: disabled, className: styles$6.item, value: value, id: uniqueId, "data-disabled": disabled, children: jsx(RadioGroup.Indicator, { className: styles$6.indicator }) }) }), jsx("span", { className: styles$6.labelText, children: label })] }) }, itemKey));
|
|
2607
|
-
}) }));
|
|
2608
|
-
};
|
|
2609
|
-
|
|
2610
|
-
var styles$5 = {"zds-select":"Select-module__zds-select___TePBJ","zds-select__dropdown":"Select-module__zds-select__dropdown___pEXsY","zds-dropdown__container":"Select-module__zds-dropdown__container___TJvrT","zds-select__dropdown--top":"Select-module__zds-select__dropdown--top___O3u5M","zds-select__dropdown--bottom":"Select-module__zds-select__dropdown--bottom___qfKLH"};
|
|
2611
|
-
|
|
2612
|
-
var styles$4 = {"zds-select-field":"SelectField-module__zds-select-field___djzS5","zds-select-field__required":"SelectField-module__zds-select-field__required___T-LvC","zds-select-field__container-box":"SelectField-module__zds-select-field__container-box___nkzZy","zds-select-field__box__input":"SelectField-module__zds-select-field__box__input___xBdKZ","zds-select-field__display":"SelectField-module__zds-select-field__display___snLz3","zds-select-field--open":"SelectField-module__zds-select-field--open___IUfIn","zds-select-field__icon":"SelectField-module__zds-select-field__icon___kt-SW","zds-select-field__helper-text":"SelectField-module__zds-select-field__helper-text___9jTiW","zds-select-field__container-tooltip":"SelectField-module__zds-select-field__container-tooltip___xZr46","zds-select-field__tooltip":"SelectField-module__zds-select-field__tooltip___XYAEC","zds-select-field--error":"SelectField-module__zds-select-field--error___sb6H6","zds-select-field--disabled":"SelectField-module__zds-select-field--disabled___48f33"};
|
|
2508
|
+
var styles$5 = {"zds-select-field":"SelectField-module__zds-select-field___djzS5","zds-select-field__required":"SelectField-module__zds-select-field__required___T-LvC","zds-select-field__container-box":"SelectField-module__zds-select-field__container-box___nkzZy","zds-select-field__box__input":"SelectField-module__zds-select-field__box__input___xBdKZ","zds-select-field__display":"SelectField-module__zds-select-field__display___snLz3","zds-select-field--open":"SelectField-module__zds-select-field--open___IUfIn","zds-select-field__icon":"SelectField-module__zds-select-field__icon___kt-SW","zds-select-field__helper-text":"SelectField-module__zds-select-field__helper-text___9jTiW","zds-select-field__container-tooltip":"SelectField-module__zds-select-field__container-tooltip___xZr46","zds-select-field__tooltip":"SelectField-module__zds-select-field__tooltip___XYAEC","zds-select-field--error":"SelectField-module__zds-select-field--error___sb6H6","zds-select-field--disabled":"SelectField-module__zds-select-field--disabled___48f33"};
|
|
2613
2509
|
|
|
2614
2510
|
const SelectField = forwardRef(({ id, name, value, placeholder, label, helperText, errorMessage, required = false, disabled = false, icon, isOpen = false, className, tooltip, tooltipText, isTouched = false, hasError = false, positionTooltip }, ref) => {
|
|
2615
2511
|
// ✅ NOVA LÓGICA: Validação de required
|
|
@@ -2623,23 +2519,23 @@ const SelectField = forwardRef(({ id, name, value, placeholder, label, helperTex
|
|
|
2623
2519
|
// ✅ NOVA LÓGICA: Estado de erro combinado
|
|
2624
2520
|
const showError = hasError || shouldShowRequiredError || Boolean(errorMessage);
|
|
2625
2521
|
// Classes CSS
|
|
2626
|
-
const containerClasses = clsx(styles$
|
|
2627
|
-
[styles$
|
|
2628
|
-
[styles$
|
|
2629
|
-
[styles$
|
|
2630
|
-
[styles$
|
|
2631
|
-
[styles$
|
|
2522
|
+
const containerClasses = clsx(styles$5['zds-select-field'], {
|
|
2523
|
+
[styles$5['zds-select-field--open']]: isOpen,
|
|
2524
|
+
[styles$5['zds-select-field--disabled']]: disabled,
|
|
2525
|
+
[styles$5['zds-select-field--error']]: showError,
|
|
2526
|
+
[styles$5['zds-select-field--required']]: isRequired,
|
|
2527
|
+
[styles$5['zds-select-field--touched']]: isTouched,
|
|
2632
2528
|
}, className);
|
|
2633
|
-
const displayClasses = clsx(styles$
|
|
2634
|
-
[styles$
|
|
2529
|
+
const displayClasses = clsx(styles$5['zds-select-field__display'], {
|
|
2530
|
+
[styles$5['zds-select-field__display--placeholder']]: !hasValue,
|
|
2635
2531
|
'has-value': hasValue,
|
|
2636
2532
|
});
|
|
2637
2533
|
const displayText = hasValue ? value : placeholder;
|
|
2638
|
-
return (jsxs("div", { className: containerClasses, ref: ref, children: [label && (jsx("label", { htmlFor: id, children: tooltip ? (jsx(Tooltip, { text: tooltipText, position: positionTooltip, children: jsxs("div", { className: styles$
|
|
2534
|
+
return (jsxs("div", { className: containerClasses, ref: ref, children: [label && (jsx("label", { htmlFor: id, children: tooltip ? (jsx(Tooltip, { text: tooltipText, position: positionTooltip, children: jsxs("div", { className: styles$5['zds-select-field__container-tooltip'], children: [label, required && jsx("span", { className: styles$5['zds-select-field__required'], children: "*" }), jsx(Info12Regular, { className: styles$5['zds-select-field__tooltip'] })] }) })) : (jsxs("div", { className: styles$5['zds-select-field__container-tooltip'], children: [label, required && jsx("span", { className: styles$5['zds-select-field__required'], children: "*" })] })) })), jsxs("div", { className: styles$5['zds-select-field__container-box'], children: [jsxs("div", { className: styles$5['zds-select-field__box__input'], children: [jsx("div", { id: id, className: displayClasses, "data-placeholder": !hasValue ? placeholder : undefined, children: displayText }), jsx("input", { type: "hidden", name: name, value: value || '', disabled: disabled, required: required, className: styles$5['zds-select-field__input'] }), icon && (jsx("div", { className: styles$5['zds-select-field__icon'], children: icon }))] }), !isOpen && (helperText || showError) && (jsx("div", { className: styles$5['zds-select-field__helper-text'], children: showError ? dynamicErrorMessage : helperText }))] })] }));
|
|
2639
2535
|
});
|
|
2640
2536
|
SelectField.displayName = 'SelectField';
|
|
2641
2537
|
|
|
2642
|
-
const Select =
|
|
2538
|
+
const Select = React.memo(({ id, options = [], value, initialValue, onChange, placeholder = 'Selecione', type = 'text', label, helperText, errorMessage, required = false, disabled = false, className, ariaLabel, showSubText, maxWidth, minWidth, width, position, tooltip = false, tooltipText = 'tooltip', positionTooltip = 'top-right', infiniteScroll, maxHeight }) => {
|
|
2643
2539
|
// Hooks e refs
|
|
2644
2540
|
const componentId = useId();
|
|
2645
2541
|
const finalId = id || componentId;
|
|
@@ -2949,16 +2845,16 @@ const Select = React__default.memo(({ id, options = [], value, initialValue, onC
|
|
|
2949
2845
|
return styles;
|
|
2950
2846
|
}, [maxWidth, minWidth, width]);
|
|
2951
2847
|
// ✅ MELHORADO: Classes CSS com estados visuais
|
|
2952
|
-
const selectClasses = clsx(styles$
|
|
2953
|
-
[styles$
|
|
2954
|
-
[styles$
|
|
2955
|
-
[styles$
|
|
2956
|
-
[styles$
|
|
2957
|
-
[styles$
|
|
2848
|
+
const selectClasses = clsx(styles$6['zds-select'], {
|
|
2849
|
+
[styles$6['zds-select--disabled']]: disabled,
|
|
2850
|
+
[styles$6['zds-select--error']]: Boolean(errorMessage) || shouldShowRequiredError,
|
|
2851
|
+
[styles$6['zds-select--focused']]: isOpen,
|
|
2852
|
+
[styles$6['zds-select--required']]: required,
|
|
2853
|
+
[styles$6['zds-select--touched']]: isTouched,
|
|
2958
2854
|
}, className);
|
|
2959
2855
|
return (jsxs("div", { className: selectClasses, ref: selectRef, id: finalId, "data-testid": "select-container", style: containerStyles, children: [jsx("div", { role: "combobox", "aria-expanded": isOpen, "aria-haspopup": "listbox", "aria-owns": isOpen ? `${finalId}-dropdown` : undefined, "aria-controls": `${finalId}-dropdown`, "aria-describedby": helperText ? `${finalId}-helper` : undefined, "aria-invalid": Boolean(errorMessage), "aria-required": required, "aria-label": ariaLabel || label || placeholder || 'Selecione uma opção', "aria-activedescendant": isOpen && focusedOptionIndex >= 0
|
|
2960
2856
|
? dropdownItems[focusedOptionIndex]?.id
|
|
2961
|
-
: selectedIds.length > 0 ? selectedIds[0] : undefined, tabIndex: disabled ? -1 : 0, onBlur: handleBlur, onKeyDown: handleKeyDown, onClick: handleTriggerClick, className: styles$
|
|
2857
|
+
: selectedIds.length > 0 ? selectedIds[0] : undefined, tabIndex: disabled ? -1 : 0, onBlur: handleBlur, onKeyDown: handleKeyDown, onClick: handleTriggerClick, className: styles$6['zds-select__trigger'], children: jsx(SelectField, { name: `select-${finalId}`, placeholder: displayText || placeholder, value: displayText, disabled: disabled, helperText: !isOpen ? helperText : undefined, errorMessage: !isOpen ? errorMessage : undefined, icon: isOpen ? jsx(ChevronUp16Regular, {}) : jsx(ChevronDown16Regular, {}), required: required, label: label, isTouched: isTouched, hasError: shouldShowRequiredError, isOpen: isOpen, tooltip: tooltip, tooltipText: tooltipText, positionTooltip: positionTooltip }) }), isOpen && !disabled && (jsx("div", { className: clsx(styles$6['zds-select__dropdown'], position && styles$6[`zds-select__dropdown--${position}`]), children: jsx(MemoizedDropdown, { items: dropdownItems, type: type, onSelectionChange: handleOptionSelect, initialItemsSelected: initialItemsSelected, defaultSelectedIds: selectedIds, id: `${finalId}-dropdown`, showSubText: showSubText, maxWidth: maxWidth, minWidth: minWidth, width: width, maxHeight: maxHeight, infiniteScroll: infiniteScroll }, `dropdown-${selectedIds.join('-')}`) }))] }));
|
|
2962
2858
|
});
|
|
2963
2859
|
Select.displayName = 'Select';
|
|
2964
2860
|
|
|
@@ -3203,29 +3099,30 @@ enableApiSearch = false, onApiSearch, isSearching = false, }) {
|
|
|
3203
3099
|
};
|
|
3204
3100
|
}
|
|
3205
3101
|
|
|
3206
|
-
var styles$
|
|
3102
|
+
var styles$4 = {"fieldContainer":"index-module__fieldContainer___rfpwH","trigger":"index-module__trigger___RCzFG","disabled":"index-module__disabled___ust2Z","open":"index-module__open___JZ3rh","error":"index-module__error___bEUc-","hasValue":"index-module__hasValue___pp7kv","triggerText":"index-module__triggerText___Q67w2","containerLabel":"index-module__containerLabel___nM2na","content":"index-module__content___hK3aL","viewport":"index-module__viewport___lJTlo","group":"index-module__group___2RRJc","container":"index-module__container___IPFKk","searchWrapper":"index-module__searchWrapper___Mxi7i","item":"index-module__item___ePUP1","subTitle":"index-module__subTitle___6Iz6p","title":"index-module__title___XHkS6","checkboxItem":"index-module__checkboxItem___3Q7pV","checkboxContent":"index-module__checkboxContent___a9PQw","itemWrapper":"index-module__itemWrapper___LmG00","icon":"index-module__icon___5zWjG","itemIndicator":"index-module__itemIndicator___jC6dI","textContent":"index-module__textContent___sIMxV","helper":"index-module__helper___LK89V","errorMessage":"index-module__errorMessage___MDeJD","noResults":"index-module__noResults___mudWL","loadingMore":"index-module__loadingMore___WvQCu"};
|
|
3207
3103
|
|
|
3208
|
-
const CheckboxSelectItem = ({ text, subTitle, disabled, checked,
|
|
3209
|
-
const handleCheckboxChange = (
|
|
3210
|
-
|
|
3211
|
-
onChange(e.target.checked);
|
|
3104
|
+
const CheckboxSelectItem = ({ text, subTitle, disabled, checked, onCheckedChange, value, ...restProps }) => {
|
|
3105
|
+
const handleCheckboxChange = (checkedValue) => {
|
|
3106
|
+
onCheckedChange(Boolean(checkedValue));
|
|
3212
3107
|
};
|
|
3213
|
-
return (jsx("div", { className: clsx(styles$
|
|
3214
|
-
[styles$
|
|
3215
|
-
}), role: "option", "aria-selected": checked, "data-selected": checked, "data-testid": `checkbox-item-${value}`, ...restProps, children: jsx("div", { className: styles$
|
|
3108
|
+
return (jsx("div", { className: clsx(styles$4.item, styles$4.checkboxItem, {
|
|
3109
|
+
[styles$4.disabled]: disabled,
|
|
3110
|
+
}), role: "option", "aria-selected": checked, "data-selected": checked, "data-testid": `checkbox-item-${value}`, ...restProps, children: jsx("div", { className: styles$4.checkboxContent, children: jsx(Checkbox, { checked: checked, onCheckedChange: handleCheckboxChange, disabled: disabled, label: jsxs("div", { className: styles$4.textContent, children: [jsx("span", { className: styles$4.title, children: text }), subTitle && jsx("div", { className: styles$4.subTitle, children: subTitle })] }) }) }) }));
|
|
3216
3111
|
};
|
|
3217
3112
|
CheckboxSelectItem.displayName = 'CheckboxSelectItem';
|
|
3218
3113
|
|
|
3219
|
-
const SelectItem =
|
|
3220
|
-
return (jsxs("div", { className: clsx(styles$
|
|
3221
|
-
[styles$
|
|
3222
|
-
}), "data-disabled": disabled || undefined, "data-testid": `select-item-${value}`, ref: ref, children: [variant === 'icon' && icon && (jsx("span", { className: styles$
|
|
3223
|
-
[styles$
|
|
3224
|
-
}), value: value, disabled: disabled, ...restProps, children: [jsx(Select$1.ItemText, { className: styles$
|
|
3114
|
+
const SelectItem = React.forwardRef(({ text, subTitle, icon, disabled, value, variant, ...restProps }, ref) => {
|
|
3115
|
+
return (jsxs("div", { className: clsx(styles$4.itemWrapper, {
|
|
3116
|
+
[styles$4.disabled]: disabled,
|
|
3117
|
+
}), "data-disabled": disabled || undefined, "data-testid": `select-item-${value}`, ref: ref, children: [variant === 'icon' && icon && (jsx("span", { className: styles$4.icon, children: icon })), jsxs(Select$1.Item, { className: clsx(styles$4.item, {
|
|
3118
|
+
[styles$4.disabled]: disabled,
|
|
3119
|
+
}), value: value, disabled: disabled, ...restProps, children: [jsx(Select$1.ItemText, { className: styles$4.title, children: text }), subTitle && jsx("div", { className: styles$4.subTitle, children: subTitle }), jsx(Select$1.ItemIndicator, { className: styles$4.itemIndicator })] })] }));
|
|
3225
3120
|
});
|
|
3226
3121
|
SelectItem.displayName = 'SelectItem';
|
|
3227
3122
|
|
|
3228
|
-
const SelectRadix = ({ items, onValueChange, onOpenChange, variant, required = false, value,
|
|
3123
|
+
const SelectRadix = ({ items, onValueChange, onOpenChange, variant, required = false, value, label, helperText, placeholder = 'Selecione', maxWidth, search = false, errorMessage, disabled = false, className, 'aria-label': ariaLabel, 'data-testid': testId,
|
|
3124
|
+
// Props para label com tooltip
|
|
3125
|
+
tooltip = false, tooltipText, side = 'bottom', align = 'start',
|
|
3229
3126
|
// Props para scroll infinito
|
|
3230
3127
|
enableInfiniteScroll = false, onScrollEnd, isLoadingMore = false,
|
|
3231
3128
|
// Props para busca em API
|
|
@@ -3303,18 +3200,18 @@ enableApiSearch = false, onApiSearch, isSearching = false, ...restProps }) => {
|
|
|
3303
3200
|
onApiSearch('');
|
|
3304
3201
|
}
|
|
3305
3202
|
};
|
|
3306
|
-
return (jsx(Select$1.Root, { value: variant === 'checkbox' ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...restProps, children: jsxs("div", { className: clsx(styles$
|
|
3307
|
-
[styles$
|
|
3308
|
-
[styles$
|
|
3309
|
-
[styles$
|
|
3310
|
-
[styles$
|
|
3311
|
-
}), id: selectId, "aria-label": ariaLabel, "data-testid": `${testId}-trigger`, children: [variant === 'checkbox' ? (jsx("span", { className: styles$
|
|
3312
|
-
[styles$
|
|
3313
|
-
}), children: helperText })), state.hasError && state.touched && (jsx("span", { className: styles$
|
|
3203
|
+
return (jsx(Select$1.Root, { value: variant === 'checkbox' ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...restProps, children: jsxs("div", { className: clsx(styles$4.container, className), style: containerStyle, "data-testid": testId, children: [jsx("div", { className: styles$4.fieldContainer, children: jsxs("div", { className: styles$4.containerLabel, children: [jsx(LabelComponent, { htmlFor: selectId, required: required, tooltipText: tooltipText, tooltip: tooltip, side: side, align: align, error: state.hasError && state.touched, disabled: disabled, children: label }), jsxs(Select$1.Trigger, { className: clsx(styles$4.trigger, {
|
|
3204
|
+
[styles$4.error]: state.hasError && state.touched,
|
|
3205
|
+
[styles$4.disabled]: disabled,
|
|
3206
|
+
[styles$4.hasValue]: state.selectedValues.length > 0,
|
|
3207
|
+
[styles$4.open]: state.isOpen,
|
|
3208
|
+
}), id: selectId, "aria-label": ariaLabel, "data-testid": `${testId}-trigger`, children: [variant === 'checkbox' ? (jsx("span", { className: styles$4.triggerText, children: displayText })) : (jsx(Select$1.Value, { placeholder: placeholder, className: styles$4.placeholder, children: displayText })), state.isOpen ? jsx(ChevronUp16Regular, {}) : jsx(ChevronDown16Regular, {})] }), !state.isOpen && helperText && !state.hasError && (jsx("span", { className: clsx(styles$4.helper, {
|
|
3209
|
+
[styles$4.disabled]: disabled
|
|
3210
|
+
}), children: helperText })), state.hasError && state.touched && (jsx("span", { className: styles$4.errorMessage, children: errorMessage || 'Campo obrigatório' }))] }) }), jsx(Select$1.Portal, { children: jsxs(Select$1.Content, { className: styles$4.content, position: "popper", side: "bottom", sideOffset: 8, align: "start", avoidCollisions: true, children: [search && (jsx("div", { className: styles$4.searchWrapper, children: jsx(Search, { ref: refs.searchInputRef, className: styles$4.search, placeholder: "Buscar", value: state.searchInput, onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onClear: handleClear, "data-testid": `${testId}-search` }) })), jsx(Select$1.Viewport, { ref: viewportRef, className: styles$4.viewport, children: jsx(Select$1.Group, { className: styles$4.group, children: filteredItems.length === 0 ? (jsx("div", { className: styles$4.noResults, children: "Nenhum resultado encontrado" })) : (jsxs(Fragment, { children: [filteredItems.map((item) => (variant === 'checkbox' ? (jsx(CheckboxSelectItem, { ...item, checked: state.selectedValues.includes(item.value), onCheckedChange: (checked) => actions.handleMultipleSelect(item.value, checked) }, item.id || item.value)) : (jsx(SelectItem, { ...item, variant: variant }, item.id || item.value)))), enableInfiniteScroll && isLoadingMore && (jsx("div", { className: styles$4.loadingMore, children: "Carregando mais itens..." }))] })) }) })] }) })] }) }));
|
|
3314
3211
|
};
|
|
3315
3212
|
SelectRadix.displayName = 'SelectRadix';
|
|
3316
3213
|
|
|
3317
|
-
var styles$
|
|
3214
|
+
var styles$3 = {"zds-table__container":"Table-module__zds-table__container___9xeVY","zds-table__scroll-wrapper":"Table-module__zds-table__scroll-wrapper___xQZPq","zds-table":"Table-module__zds-table___bPvaS","zds-table__head":"Table-module__zds-table__head___FvQuS","zds-table__th":"Table-module__zds-table__th___R03sj","zds-table__th-content":"Table-module__zds-table__th-content___duR3c","zds-table__td":"Table-module__zds-table__td___aY-Nt","zds-table-header__filters-placeholder":"Table-module__zds-table-header__filters-placeholder___GhVwi","zds-table__body":"Table-module__zds-table__body___kuKXb","zds-table__empty":"Table-module__zds-table__empty___ZM4iu","zds-table__empty__content":"Table-module__zds-table__empty__content___8xl-u","zds-table__empty__title":"Table-module__zds-table__empty__title___7Y9Pj","zds-table__empty__caption":"Table-module__zds-table__empty__caption___toS00","zds-table__row":"Table-module__zds-table__row___8cEjq","zds-table__empty-cell":"Table-module__zds-table__empty-cell___Ldb6Z","zds-table-header__search":"Table-module__zds-table-header__search___yzLxw","zds-table__pagination":"Table-module__zds-table__pagination___FR5GH","zds-table-header":"Table-module__zds-table-header___uPRjd","zds-table-header__search-container":"Table-module__zds-table-header__search-container___-Fzz1","zds-table-header__filters":"Table-module__zds-table-header__filters___ViH07","zds-table-header__filter-label":"Table-module__zds-table-header__filter-label___c3BWI","zds-table-header__custom-filters":"Table-module__zds-table-header__custom-filters___oTuoM","zds-table-header__filters-content":"Table-module__zds-table-header__filters-content___nKlgL","zds-table-header__filters-wrapper":"Table-module__zds-table-header__filters-wrapper___BrZ9A","zds-table-header__filter-items":"Table-module__zds-table-header__filter-items___Tn8Yv","zds-table__pagination-select":"Table-module__zds-table__pagination-select___TZK-y","zds-table__pagination-info":"Table-module__zds-table__pagination-info___3k-B2","zds-table__pagination-controls":"Table-module__zds-table__pagination-controls___S-zs7","zds-table__pagination-button":"Table-module__zds-table__pagination-button___Wvq9W"};
|
|
3318
3215
|
|
|
3319
3216
|
/**
|
|
3320
3217
|
* @module constants
|
|
@@ -6752,10 +6649,10 @@ const Table = ({ columns = [], dataSource = [], className, loading = false, rowS
|
|
|
6752
6649
|
return columns;
|
|
6753
6650
|
const checkboxColumn = {
|
|
6754
6651
|
key: '__checkbox__',
|
|
6755
|
-
label: (jsx(
|
|
6652
|
+
label: (jsx(Checkbox, { checked: isAllSelected, indeterminate: isIndeterminate, onCheckedChange: toggleAll, label: '' })),
|
|
6756
6653
|
render: (_, index) => {
|
|
6757
6654
|
const props = rowSelection.getCheckboxProps?.(dataSource[index], index) || {};
|
|
6758
|
-
return (jsx(
|
|
6655
|
+
return (jsx(Checkbox, { checked: selectedSet.has(index), onCheckedChange: () => toggleRow(index), disabled: props.disabled, label: '' }));
|
|
6759
6656
|
},
|
|
6760
6657
|
align: 'center',
|
|
6761
6658
|
};
|
|
@@ -6763,13 +6660,13 @@ const Table = ({ columns = [], dataSource = [], className, loading = false, rowS
|
|
|
6763
6660
|
}, [columns, rowSelection, isAllSelected, isIndeterminate, toggleAll, selectedSet, toggleRow, dataSource]);
|
|
6764
6661
|
const tableId = useMemo(() => `table-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
6765
6662
|
if (loading) {
|
|
6766
|
-
return (jsx("div", { className: clsx(styles$
|
|
6663
|
+
return (jsx("div", { className: clsx(styles$3['zds-table__container'], className), children: jsx("div", { className: styles$3['zds-table__loader'], children: jsx(LoaderList, {}) }) }));
|
|
6767
6664
|
}
|
|
6768
|
-
const emptyText = locale.emptyText || (jsxs("div", { className: styles$
|
|
6769
|
-
return (jsx("div", { className: clsx(styles$
|
|
6665
|
+
const emptyText = locale.emptyText || (jsxs("div", { className: styles$3['zds-table__empty'], children: [jsx("div", { className: styles$3['zds-table__empty__content'], children: jsx(EmptyRows150Color, {}) }), jsxs("div", { className: styles$3['zds-table__empty__text'], children: [jsx("h3", { className: styles$3['zds-table__empty__title'], children: "Nenhum dado encontrado" }), jsx("p", { className: styles$3['zds-table__empty__caption'], children: "Nenhum registro encontrado" })] })] }));
|
|
6666
|
+
return (jsx("div", { className: clsx(styles$3['zds-table__container'], className), children: jsx("div", { className: styles$3['zds-table__scroll-wrapper'], children: jsxs("table", { className: styles$3['zds-table'], role: "table", "aria-label": "Tabela de dados", "aria-describedby": loading ? `${tableId}-loading` : undefined, "aria-rowcount": dataSource.length + 1, children: [jsx("thead", { className: styles$3['zds-table__head'], children: jsx("tr", { children: finalColumns.map((column) => (jsx("th", { className: clsx(styles$3['zds-table__th'], column.align && `text-${column.align}`), style: column.style, children: jsx("div", { className: styles$3['zds-table__th-content'], children: column.label }) }, column.key))) }) }), jsx("tbody", { className: styles$3['zds-table__body'], children: dataSource.length > 0 ? (dataSource.map((row, index) => {
|
|
6770
6667
|
const rowProps = onRow?.(row, index) || {};
|
|
6771
|
-
return (jsx("tr", { className: clsx(styles$
|
|
6772
|
-
})) : (jsx("tr", { children: jsx("td", { colSpan: finalColumns.length, className: styles$
|
|
6668
|
+
return (jsx("tr", { className: clsx(styles$3['zds-table__row'], rowProps.className), onClick: rowProps.onClick, onDoubleClick: rowProps.onDoubleClick, children: finalColumns.map((column) => (jsx("td", { className: clsx(styles$3['zds-table__td'], column.align && `text-${column.align}`), children: renderCell(column, row, index) }, column.key))) }, index));
|
|
6669
|
+
})) : (jsx("tr", { children: jsx("td", { colSpan: finalColumns.length, className: styles$3['zds-table__empty-cell'], children: emptyText }) })) })] }) }) }));
|
|
6773
6670
|
};
|
|
6774
6671
|
|
|
6775
6672
|
const isCalendarFilter = (filter) => {
|
|
@@ -6780,7 +6677,7 @@ const isCheckboxFilter = (filter) => {
|
|
|
6780
6677
|
};
|
|
6781
6678
|
const TableHeader = ({ searchValue = '', onSearchChange, onSearch, searchPlaceholder = 'Pesquisar...', showSearch = true, showFilters = false, filters, filterItems = [], className = '', }) => {
|
|
6782
6679
|
const [internalSearchValue, setInternalSearchValue] = useState(searchValue);
|
|
6783
|
-
|
|
6680
|
+
React.useEffect(() => {
|
|
6784
6681
|
setInternalSearchValue(searchValue);
|
|
6785
6682
|
}, [searchValue]);
|
|
6786
6683
|
const handleInputChange = (e) => {
|
|
@@ -6802,7 +6699,7 @@ const TableHeader = ({ searchValue = '', onSearchChange, onSearch, searchPlaceho
|
|
|
6802
6699
|
}
|
|
6803
6700
|
};
|
|
6804
6701
|
const hasFilters = filters || (filterItems && filterItems.length > 0);
|
|
6805
|
-
return (jsxs("div", { className: `${styles$
|
|
6702
|
+
return (jsxs("div", { className: `${styles$3['zds-table-header']} ${className}`.trim(), children: [showSearch && (onSearchChange || onSearch) && (jsx("div", { className: styles$3['zds-table-header__search-container'], children: jsx(Search, { value: internalSearchValue, onChange: handleInputChange, onKeyDown: handleKeyDown, placeholder: searchPlaceholder, className: styles$3['zds-table-header__search'] }) })), showFilters && (jsx("div", { className: styles$3['zds-table-header__filters'], children: hasFilters ? (jsxs("div", { className: styles$3['zds-table-header__filters-content'], children: [filters && (jsx("div", { className: styles$3['zds-table-header__custom-filters'], children: filters })), jsxs("div", { className: styles$3['zds-table-header__filters-wrapper'], children: [jsx("span", { className: styles$3['zds-table-header__filter-label'], children: "Filtros" }), jsx("div", { className: styles$3['zds-table-header__filter-items'], children: filterItems && filterItems.map((filterItem, index) => {
|
|
6806
6703
|
const commonProps = {
|
|
6807
6704
|
key: filterItem.id || index,
|
|
6808
6705
|
buttonText: filterItem.buttonText,
|
|
@@ -6821,7 +6718,7 @@ const TableHeader = ({ searchValue = '', onSearchChange, onSearch, searchPlaceho
|
|
|
6821
6718
|
}
|
|
6822
6719
|
console.warn('TableHeader: Tipo de filtro não reconhecido:', filterItem);
|
|
6823
6720
|
return null;
|
|
6824
|
-
}) })] })] })) : (jsx("div", { className: styles$
|
|
6721
|
+
}) })] })] })) : (jsx("div", { className: styles$3['zds-table-header__filters-placeholder'], children: jsx("span", { children: "Nenhum filtro dispon\u00EDvel" }) })) }))] }));
|
|
6825
6722
|
};
|
|
6826
6723
|
|
|
6827
6724
|
const TablePagination = ({ currentPage, totalItems, itemsPerPage, onPageChange, onItemsPerPageChange, pageSizeOptions = [10, 25, 50, 100], disabled = false, className = '', }) => {
|
|
@@ -6847,12 +6744,12 @@ const TablePagination = ({ currentPage, totalItems, itemsPerPage, onPageChange,
|
|
|
6847
6744
|
const newItemsPerPage = Number(event.target.value);
|
|
6848
6745
|
onItemsPerPageChange(newItemsPerPage);
|
|
6849
6746
|
};
|
|
6850
|
-
return (jsxs("div", { className: `${styles$
|
|
6747
|
+
return (jsxs("div", { className: `${styles$3['zds-table__pagination']} ${className}`.trim(), children: [jsxs("div", { className: styles$3['zds-table__pagination-select'], children: [jsx("label", { htmlFor: "items-per-page", className: styles$3['zds-table__pagination-label'], children: "Itens por p\u00E1gina" }), jsx("select", { id: "items-per-page", value: itemsPerPage, onChange: handleItemsPerPageChange, disabled: disabled, className: styles$3['zds-table__pagination-select-input'], children: pageSizeOptions.map((option) => (jsx("option", { value: option, children: option }, option))) })] }), jsx("div", { className: styles$3['zds-table__pagination-info'], children: jsx("span", { children: totalItems > 0
|
|
6851
6748
|
? `${startItem}–${endItem} de ${totalItems}`
|
|
6852
|
-
: '0 itens' }) }), jsxs("div", { className: styles$
|
|
6749
|
+
: '0 itens' }) }), jsxs("div", { className: styles$3['zds-table__pagination-controls'], children: [jsx("button", { className: styles$3['zds-table__pagination-button'], onClick: handlePrevious, disabled: !canGoPrev, "aria-label": "P\u00E1gina anterior", children: jsx(ChevronLeft16Regular, {}) }), jsx("button", { className: styles$3['zds-table__pagination-button'], onClick: handleNext, disabled: !canGoNext, "aria-label": "Pr\u00F3xima p\u00E1gina", children: jsx(ChevronRight16Regular, {}) })] })] }));
|
|
6853
6750
|
};
|
|
6854
6751
|
|
|
6855
|
-
var styles$
|
|
6752
|
+
var styles$2 = {"zds-toast__container":"Toast-module__zds-toast__container___IE2Z4","zds-toast__item":"Toast-module__zds-toast__item___ysYjL","zds-toast__message":"Toast-module__zds-toast__message___BMJL7","zds-toast__icon":"Toast-module__zds-toast__icon___JCwTV","zds-toast__close":"Toast-module__zds-toast__close___nfxSB","zds-toast__active":"Toast-module__zds-toast__active___IraTZ","zds-toast__success":"Toast-module__zds-toast__success___8z2qq","zds-toast__alert":"Toast-module__zds-toast__alert___TM-W8","zds-toast__info":"Toast-module__zds-toast__info___T3dcI"};
|
|
6856
6753
|
|
|
6857
6754
|
const sanitizeMessage = (message) => {
|
|
6858
6755
|
if (typeof message !== 'string')
|
|
@@ -6874,15 +6771,15 @@ const ToastContext = createContext(undefined);
|
|
|
6874
6771
|
const toastVariants = {
|
|
6875
6772
|
success: {
|
|
6876
6773
|
icon: jsx(CheckmarkCircle20Filled, {}),
|
|
6877
|
-
className: styles$
|
|
6774
|
+
className: styles$2['zds-toast__success'],
|
|
6878
6775
|
},
|
|
6879
6776
|
alert: {
|
|
6880
6777
|
icon: jsx(Warning20Filled, {}),
|
|
6881
|
-
className: styles$
|
|
6778
|
+
className: styles$2['zds-toast__alert'],
|
|
6882
6779
|
},
|
|
6883
6780
|
info: {
|
|
6884
6781
|
icon: jsx(Info20Filled, {}),
|
|
6885
|
-
className: styles$
|
|
6782
|
+
className: styles$2['zds-toast__info'],
|
|
6886
6783
|
},
|
|
6887
6784
|
};
|
|
6888
6785
|
const ToastItem = ({ toast, onClose, isVisible }) => {
|
|
@@ -6892,12 +6789,12 @@ const ToastItem = ({ toast, onClose, isVisible }) => {
|
|
|
6892
6789
|
onClose(toast.id);
|
|
6893
6790
|
}
|
|
6894
6791
|
};
|
|
6895
|
-
return (jsxs("div", { className: clsx(styles$
|
|
6792
|
+
return (jsxs("div", { className: clsx(styles$2['zds-toast__item'], variant.className, isVisible && styles$2['zds-toast__active']), role: toast.type === 'alert' ? 'alert' : 'status', "aria-live": toast.type === 'alert' ? 'assertive' : 'polite', "aria-atomic": "true", tabIndex: toast.persistent ? 0 : -1, onKeyDown: handleKeyDown, children: [jsx("span", { className: styles$2['zds-toast__icon'], "aria-hidden": "true", children: variant.icon }), jsx("span", { className: styles$2['zds-toast__message'], dangerouslySetInnerHTML: { __html: sanitizeMessage(toast.message) } }), jsx("button", { type: "button", className: styles$2['zds-toast__close'], "aria-label": `Fechar notificação: ${toast.message.slice(0, 50)}${toast.message.length > 50 ? '...' : ''}`, onClick: () => onClose(toast.id), children: jsx(Dismiss16Regular, { "aria-hidden": "true" }) })] }));
|
|
6896
6793
|
};
|
|
6897
6794
|
const ToastContainer = ({ toasts, onClose, visibleToasts }) => {
|
|
6898
6795
|
if (toasts.length === 0)
|
|
6899
6796
|
return null;
|
|
6900
|
-
return (jsx("div", { className: styles$
|
|
6797
|
+
return (jsx("div", { className: styles$2['zds-toast__container'], role: "log", "aria-label": "Notifica\u00E7\u00F5es do sistema", children: toasts.map(toast => (jsx(ToastItem, { toast: toast, onClose: onClose, isVisible: visibleToasts.has(toast.id) }, toast.id))) }));
|
|
6901
6798
|
};
|
|
6902
6799
|
const ToastProvider = ({ children, maxToasts = MAX_TOASTS }) => {
|
|
6903
6800
|
const [toasts, setToasts] = useState([]);
|
|
@@ -6985,6 +6882,10 @@ const useToast = () => {
|
|
|
6985
6882
|
return context;
|
|
6986
6883
|
};
|
|
6987
6884
|
|
|
6885
|
+
var styles$1 = {"container":"Switch-module__container___BR1OB","switchRoot":"Switch-module__switchRoot___jz2HD","switchThumb":"Switch-module__switchThumb___X3RL7"};
|
|
6886
|
+
|
|
6887
|
+
const Switch = ({ disabled = false, defaultChecked = false, checked, onCheckedChange, name, value }) => (jsx("div", { className: clsx(styles$1.container), children: jsx(Switch$1.Root, { className: styles$1.switchRoot, disabled: disabled, defaultChecked: defaultChecked, onCheckedChange: onCheckedChange, name: name, value: value, children: jsx(Switch$1.Thumb, { className: styles$1.switchThumb }) }) }));
|
|
6888
|
+
|
|
6988
6889
|
var styles = {"zds-verification-code__container":"VerificationCode-module__zds-verification-code__container___tUNuJ","zds-verification-code__input":"VerificationCode-module__zds-verification-code__input___wDIQ6","zds-verification-code__filled":"VerificationCode-module__zds-verification-code__filled___-2VVb","zds-verification-code__has-error":"VerificationCode-module__zds-verification-code__has-error___eqKAp","zds-verification-code__error":"VerificationCode-module__zds-verification-code__error___T53i5"};
|
|
6989
6890
|
|
|
6990
6891
|
/**
|
|
@@ -7300,5 +7201,5 @@ function useApiSimulation(config = {}) {
|
|
|
7300
7201
|
};
|
|
7301
7202
|
}
|
|
7302
7203
|
|
|
7303
|
-
export { Avatar, Badge, Button, MemoizedCalendar as Calendar, Callout,
|
|
7204
|
+
export { Avatar, Badge, Button, MemoizedCalendar as Calendar, Callout, Checkbox, MemoizedChips as Chips, Container, DatePicker_default as DatePicker, MemoizedDialog as Dialog, Drawer, MemoizedDropdown as Dropdown, Filter, ListItem, Menu, MenuRadix, memorizedQuantity as Quantity, Radio, Search, Select, SelectField, SelectRadix, Switch, Table, TableHeader, TablePagination, TextField$1 as TextField, ToastProvider as Toast, ToastProvider, Tooltip, VerificationCode, normalizeText, useApiSimulation, useInfiniteScroll, useToast };
|
|
7304
7205
|
//# sourceMappingURL=index.esm.js.map
|