@giro-ds/react 12.5.0 → 12.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -335,6 +335,8 @@ interface CalloutProps extends Omit<BaseProps, 'disabled'>, Omit<React$1.HTMLAtt
335
335
 
336
336
  declare const Callout: React__default.FC<CalloutProps>;
337
337
 
338
+ /** Valores permitidos para o raio das bordas do Card, baseados nos tokens de border-radius do design system */
339
+ type CardBorderRadius = 4 | 8 | 12 | 16 | 24 | 'none' | 'pill' | 'circular';
338
340
  /**
339
341
  * Props do componente Card
340
342
  * @example
@@ -352,9 +354,11 @@ interface CardProps {
352
354
  className?: string;
353
355
  /** Define se o card é interativo, aplicando estilos de hover e cursor pointer */
354
356
  hoverable?: boolean;
357
+ /** Raio das bordas do card, baseado nos tokens de border-radius do design system. O padrão é 8 (8px) */
358
+ borderRadius?: CardBorderRadius;
355
359
  }
356
360
 
357
- declare function Card({ children, className, hoverable }: CardProps): React$1.JSX.Element;
361
+ declare function Card({ children, className, hoverable, borderRadius }: CardProps): React$1.JSX.Element;
358
362
 
359
363
  /**
360
364
  * Props do componente Checkbox
@@ -849,15 +853,27 @@ interface MenuProps extends ScalableProps {
849
853
  align?: 'start' | 'end' | 'center';
850
854
  /** Altura máxima do menu */
851
855
  maxHeight?: number | string;
852
- /** Habilita scroll infinito */
856
+ /**
857
+ * @deprecated Futuramente o carregamento remoto será removido do Menu.
858
+ * Para seleção de dados remotos, utilize o componente recomendado
859
+ * no guia de migração.
860
+ */
853
861
  enableInfiniteScroll?: boolean;
854
- /** Callback executado ao chegar ao final do scroll: () => void */
862
+ /**
863
+ * @deprecated Futuramente será removido do Menu.
864
+ */
855
865
  onScrollEnd?: () => void;
856
- /** Estado de carregamento de mais itens */
866
+ /**
867
+ * @deprecated Futuramente será removido do Menu.
868
+ */
857
869
  isLoadingMore?: boolean;
858
- /** Habilita busca via API */
870
+ /**
871
+ * @deprecated Futuramente a busca remota será removida do Menu.
872
+ */
859
873
  enableApiSearch?: boolean;
860
- /** Callback executado na busca via API: (searchTerm) => void */
874
+ /**
875
+ * @deprecated Futuramente a busca remota será removida do Menu.
876
+ */
861
877
  onApiSearch?: (searchTerm: string) => void;
862
878
  /** Callback executado quando o menu abre/fecha: (open) => void */
863
879
  onOpenChange?: (open: boolean) => void;
@@ -1349,7 +1365,10 @@ interface SelectPropsBase extends ScalableProps {
1349
1365
  hasMore?: boolean;
1350
1366
  /** Estado de carregamento de mais itens */
1351
1367
  isLoadingMore?: boolean;
1352
- /** Habilita busca via API */
1368
+ /**
1369
+ * @deprecated Futuramente a busca remota será identificada pela presença de
1370
+ * `onApiSearch`. Futuramente será removida.
1371
+ */
1353
1372
  enableApiSearch?: boolean;
1354
1373
  /** Callback executado na busca via API: (term) => void */
1355
1374
  onApiSearch?: (term: string) => void;
@@ -2092,6 +2111,8 @@ interface ToggleGroupItem {
2092
2111
  icon?: ReactNode;
2093
2112
  /** Exibe somente o ícone, sem label */
2094
2113
  iconOnly?: boolean;
2114
+ /** Exibe somente o ícone quando não selecionado; ícone + label quando selecionado */
2115
+ expandOnSelect?: boolean;
2095
2116
  /** Desabilita o item, impedindo sua seleção */
2096
2117
  disabled?: boolean;
2097
2118
  }
@@ -2131,6 +2152,16 @@ type ToggleGroupMultipleSelectionProps = {
2131
2152
  type ToggleGroupProps = {
2132
2153
  /** Items do grupo de toggles */
2133
2154
  items?: ToggleGroupItem[];
2155
+ /**
2156
+ * Exibe somente o ícone dos itens não selecionados; ícone + label no item selecionado.
2157
+ * Aplica-se a todos os itens do grupo. Pode ser sobrescrito individualmente via `item.expandOnSelect`.
2158
+ */
2159
+ expandOnSelect?: boolean;
2160
+ /**
2161
+ * Impede desmarcar o item ativo ao clicar novamente nele, garantindo que sempre haja uma seleção.
2162
+ * Aplica-se somente quando `selectionType="single"` (ignorado em `"multiple"`).
2163
+ */
2164
+ requireSelection?: boolean;
2134
2165
  } & (ToggleGroupSingleSelectionProps | ToggleGroupMultipleSelectionProps);
2135
2166
  /**
2136
2167
  * Props do componente ToggleButton
package/dist/index.esm.js CHANGED
@@ -2119,6 +2119,12 @@ class DateLib {
2119
2119
  * @param overrides Custom overrides for the date library functions.
2120
2120
  */
2121
2121
  constructor(options, overrides) {
2122
+ /**
2123
+ * Reference to the built-in Date constructor.
2124
+ *
2125
+ * @deprecated Use `newDate()` or `today()`.
2126
+ */
2127
+ this.Date = Date;
2122
2128
  /**
2123
2129
  * Creates a new `Date` object representing today's date.
2124
2130
  *
@@ -2132,8 +2138,7 @@ class DateLib {
2132
2138
  if (this.options.timeZone) {
2133
2139
  return TZDate.tz(this.options.timeZone);
2134
2140
  }
2135
- const DateCtor = this.options.Date ?? Date;
2136
- return new DateCtor();
2141
+ return new this.Date();
2137
2142
  };
2138
2143
  /**
2139
2144
  * Creates a new `Date` object with the specified year, month, and day.
@@ -2852,8 +2857,8 @@ const Callout = ({ variant = 'neutral', title, text, icon, onDismiss, dismiss, b
2852
2857
 
2853
2858
  var styles$p = {"card":"Card-module__card___LzN-3","card--hoverable":"Card-module__card--hoverable___orpJZ"};
2854
2859
 
2855
- function Card({ children, className, hoverable }) {
2856
- return (jsx("main", { className: clsx(styles$p['card'], hoverable && styles$p['card--hoverable'], className), children: children }));
2860
+ function Card({ children, className, hoverable, borderRadius }) {
2861
+ return (jsx("div", { className: clsx(styles$p['card'], hoverable && styles$p['card--hoverable'], className), style: borderRadius !== undefined ? { borderRadius: `var(--border-radius-${borderRadius})` } : undefined, children: children }));
2857
2862
  }
2858
2863
 
2859
2864
  const CheckSmall = ({ className = '', width = 12, height = 10, fill = 'white', ...restProps }) => {
@@ -3088,6 +3093,29 @@ const SHIFT_TOGGLES = {
3088
3093
 
3089
3094
  var styles$k = {"container":"VirtualKeyboard-module__container___A-e0I","layout--numeric":"VirtualKeyboard-module__layout--numeric___zfd7G","mode--fixed":"VirtualKeyboard-module__mode--fixed___1eFY1","layout--default":"VirtualKeyboard-module__layout--default___qyY1b","textFieldContainer":"VirtualKeyboard-module__textFieldContainer___XxGen","keyboardWrapper":"VirtualKeyboard-module__keyboardWrapper___jryTf","keyboardNumpadActive":"VirtualKeyboard-module__keyboardNumpadActive___jPpJD","overlay":"VirtualKeyboard-module__overlay___a5y7i","overlayOpen":"VirtualKeyboard-module__overlayOpen___hREu-","textFieldWrapper":"VirtualKeyboard-module__textFieldWrapper___bmi-z","keyPreview":"VirtualKeyboard-module__keyPreview___oWaO1","accentMenu":"VirtualKeyboard-module__accentMenu___A6tTy","accentMenuRow":"VirtualKeyboard-module__accentMenuRow___3kbvT","accentOption":"VirtualKeyboard-module__accentOption___ao-Ta"};
3090
3095
 
3096
+ /**
3097
+ * Atributo usado para marcar raízes de elementos portalizados (ex.: renderizados via
3098
+ * `createPortal` em `document.body`) que devem ser ignorados pela lógica de
3099
+ * "clique/foco fora" de camadas dispensáveis do Radix UI (Dialog, Popover, DropdownMenu etc.).
3100
+ *
3101
+ * Componentes que renderizam conteúdo fora da árvore DOM do elemento pai (como o
3102
+ * `VirtualKeyboard` em modo `native`) devem adicionar este atributo à raiz portalizada
3103
+ * para evitar que o Radix trate cliques nesse conteúdo como "fora" do componente,
3104
+ * o que causaria fechamentos indesejados quando usados dentro de um `Modal` (ou outro
3105
+ * componente baseado em Radix Dialog/Popover).
3106
+ */
3107
+ const DISMISS_OUTSIDE_IGNORE_ATTRIBUTE = 'data-dismiss-outside-ignore';
3108
+ /**
3109
+ * Verifica se o alvo de um evento de "interação fora" (Radix `onInteractOutside`,
3110
+ * `onPointerDownOutside`, `onFocusOutside`) está dentro de um elemento marcado com
3111
+ * {@link DISMISS_OUTSIDE_IGNORE_ATTRIBUTE}.
3112
+ */
3113
+ const isDismissOutsideIgnored = (target) => {
3114
+ if (!(target instanceof Element))
3115
+ return false;
3116
+ return target.closest(`[${DISMISS_OUTSIDE_IGNORE_ATTRIBUTE}]`) !== null;
3117
+ };
3118
+
3091
3119
  const LONG_PRESS_DELAY_MS = 400;
3092
3120
  const ACCENT_OPTIONS = {
3093
3121
  a: ['a', 'á', 'à', 'â', 'ã', 'ä', 'å', 'æ', '@', 'ª'],
@@ -3452,6 +3480,25 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value, onChange
3452
3480
  layoutName,
3453
3481
  capsLockOn,
3454
3482
  ]);
3483
+ // Cobre toda a área do overlay do teclado (inclusive espaços/paddings fora do
3484
+ // `keyboardWrapperRef`, como o preview de tecla e o menu de acento portalizados),
3485
+ // garantindo que `isKeyboardInteractingRef` não seja perdido em cliques que não
3486
+ // caem exatamente sobre um `.hg-button`. Isso evita que o teclado feche sozinho
3487
+ // (via blur do targetRef) ao interagir com áreas adjacentes do próprio teclado.
3488
+ const handleOverlayPointerDown = useCallback((event) => {
3489
+ if (keyboardWrapperRef.current?.contains(event.target))
3490
+ return;
3491
+ isKeyboardInteractingRef.current = true;
3492
+ if (hideTimeoutRef.current !== null) {
3493
+ clearTimeout(hideTimeoutRef.current);
3494
+ }
3495
+ }, []);
3496
+ const handleOverlayPointerUp = useCallback((event) => {
3497
+ if (keyboardWrapperRef.current?.contains(event.target))
3498
+ return;
3499
+ isKeyboardInteractingRef.current = false;
3500
+ scheduleHideIfBlurred();
3501
+ }, [scheduleHideIfBlurred]);
3455
3502
  const handleAccentSelect = useCallback((accentedChar) => {
3456
3503
  const currentValue = valueRef.current;
3457
3504
  const baseLayout = type === 'numeric' ? 'abc' : 'default';
@@ -3624,7 +3671,7 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value, onChange
3624
3671
  if (instance) {
3625
3672
  instance.setInput(valueRef.current);
3626
3673
  }
3627
- }, layoutName: layoutName, layout: activeLayout, theme: 'hg-theme-default', display: keyboardDisplay, onChange: handleChange, onKeyPress: handleKeyPress, preventMouseDownDefault: true }), (() => {
3674
+ }, layoutName: layoutName, layout: activeLayout, theme: 'hg-theme-default', display: keyboardDisplay, onChange: handleChange, onKeyPress: handleKeyPress, preventMouseDownDefault: true, disableButtonHold: true }), (() => {
3628
3675
  const shiftCount = { current: 0 };
3629
3676
  return iconSlots.map((slot) => {
3630
3677
  const key = slot.getAttribute('data-icon-key');
@@ -3638,14 +3685,14 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value, onChange
3638
3685
  }
3639
3686
  return createPortal(createElement(Icon), slot, `icon-${key}`);
3640
3687
  });
3641
- })(), keyPreview && typeof document !== 'undefined' && createPortal(jsx("div", { ref: keyPreviewRef, className: styles$k.keyPreview, style: {
3688
+ })(), keyPreview && typeof document !== 'undefined' && createPortal(jsx("div", { ref: keyPreviewRef, className: clsx(styles$k.keyPreview, className), style: {
3642
3689
  top: keyPreview.top,
3643
3690
  left: keyPreview.left + keyPreviewOffsetX,
3644
3691
  width: portalSizes.preview,
3645
3692
  height: portalSizes.preview,
3646
3693
  ...(portalSizes.fontSize ? { fontSize: portalSizes.fontSize } : {}),
3647
3694
  }, "aria-hidden": true, children: keyPreview.char }), document.body), accentMenu && (typeof document !== 'undefined' &&
3648
- createPortal(jsx("div", { ref: accentMenuRef, className: styles$k.accentMenu, style: {
3695
+ createPortal(jsx("div", { ref: accentMenuRef, className: clsx(styles$k.accentMenu, className), style: {
3649
3696
  top: accentMenu.top,
3650
3697
  left: accentMenu.left + accentMenuOffsetX,
3651
3698
  }, role: "listbox", "aria-label": `Opcoes de acento para ${accentMenu.sourceKey}`, children: Array.from({ length: Math.ceil(accentMenu.options.length / 5) }, (_, rowIndex) => accentMenu.options.slice(rowIndex * 5, rowIndex * 5 + 5)).map((rowOptions, rowIndex) => (jsx("div", { className: styles$k.accentMenuRow, children: rowOptions.map((option) => (jsx("button", { type: "button", className: styles$k.accentOption, style: {
@@ -3657,9 +3704,9 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value, onChange
3657
3704
  event.stopPropagation();
3658
3705
  }, onClick: () => handleAccentSelect(option), children: option }, `${accentMenu.sourceKey}-${option}`))) }, rowIndex))) }), document.body))] })) : null;
3659
3706
  if (variant === 'native' && typeof document !== 'undefined') {
3660
- return createPortal(jsx("div", { id: id, className: clsx(styles$k.overlay, { [styles$k.overlayOpen]: isOpen }, styles$k[isNumpadLayout ? 'layout--numeric' : 'layout--default'], className), style: nativeHeight ? { '--vkeyboard-native-height': nativeHeight } : undefined, children: keyboardEl }), document.body);
3707
+ return createPortal(jsx("div", { id: id, className: clsx(styles$k.overlay, { [styles$k.overlayOpen]: isOpen }, styles$k[isNumpadLayout ? 'layout--numeric' : 'layout--default'], className), style: nativeHeight ? { '--vkeyboard-native-height': nativeHeight } : undefined, [DISMISS_OUTSIDE_IGNORE_ATTRIBUTE]: true, onPointerDownCapture: handleOverlayPointerDown, onPointerUpCapture: handleOverlayPointerUp, onPointerCancelCapture: handleOverlayPointerUp, children: keyboardEl }), document.body);
3661
3708
  }
3662
- return (jsxs("div", { id: id, className: clsx(styles$k.container, styles$k[`mode--${variant}`], styles$k[isNumpadLayout ? 'layout--numeric' : 'layout--default'], className), children: [variant === 'fixed' && (jsx("div", { className: styles$k.textFieldContainer, children: jsx(TextField$1, { placeholder: placeholder, value: effectiveValue, onChange: onChange, helperText: helperText, error: error, errorMessage: errorMessage, readOnly: true, disableAutoComplete: true, maxLength: maxLength, attachedToVirtualKeyboard: true, className: styles$k.textFieldWrapper, scale: textFieldScale }) })), keyboardEl] }));
3709
+ return (jsxs("div", { id: id, className: clsx(styles$k.container, styles$k[`mode--${variant}`], styles$k[isNumpadLayout ? 'layout--numeric' : 'layout--default'], className), children: [variant === 'fixed' && (jsx("div", { className: styles$k.textFieldContainer, children: jsx(TextField$1, { placeholder: placeholder, value: effectiveValue, onChange: onChange, helperText: helperText, error: error, errorMessage: errorMessage, disableAutoComplete: true, maxLength: maxLength, attachedToVirtualKeyboard: true, className: styles$k.textFieldWrapper, scale: textFieldScale }) })), keyboardEl] }));
3663
3710
  };
3664
3711
 
3665
3712
  var styles$j = {"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","inputWithIcon":"TextField-module__inputWithIcon___shqkL","helperText":"TextField-module__helperText___d5QGC","error":"TextField-module__error___IGQzp","disabled":"TextField-module__disabled___roIKP","attachedToVirtualKeyboard":"TextField-module__attachedToVirtualKeyboard___fuO2O","errorWithMessage":"TextField-module__errorWithMessage___m-5AA","clearButtonIcon":"TextField-module__clearButtonIcon___Z2iyc"};
@@ -3862,7 +3909,7 @@ function validatePartialDate(value, locale = 'pt-br') {
3862
3909
  return 'incomplete';
3863
3910
  }
3864
3911
 
3865
- const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign = 'start', helperText, required = false, label = 'Data', value, defaultValue, onChange, disabled = false, error: externalError, minDate, maxDate, 'data-testid': testId, scale = 1, id, className, style, ...rest }) => {
3912
+ const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign = 'start', helperText, required = false, label, value, defaultValue, onChange, disabled = false, error: externalError, minDate, maxDate, 'data-testid': testId, scale = 1, id, className, style, ...rest }) => {
3866
3913
  const fieldId = useId();
3867
3914
  const calendarId = `${fieldId}-calendar`;
3868
3915
  const containerStyle = { '--giro-scale': scale };
@@ -4438,7 +4485,7 @@ const Simple = ({ items, type = 'multiple', selectedIds, onApplyFilter, placehol
4438
4485
  toggleItem(itemId, item);
4439
4486
  }
4440
4487
  }, children: [type === 'multiple' && (jsx(Checkbox, { checked: isSelected, disabled: item.disabled, label: "" })), item.icon && (jsx("span", { className: styles$d.itemIcon, children: item.icon })), jsx("span", { className: styles$d.itemText, children: item.text })] }, itemId));
4441
- })) : (jsx("li", { className: styles$d.noResults, role: "status", "aria-live": "polite", children: "Nenhum item encontrado" })) }), jsxs("div", { className: styles$d.footer, children: [jsx(Button, { fullWidth: true, variant: "outlined", onClick: handleClearFilter, children: "Limpar" }), jsx(Button, { fullWidth: true, onClick: handleApplyFilter, children: "Aplicar" })] })] }));
4488
+ })) : (jsx("li", { className: styles$d.noResults, role: "status", "aria-live": "polite", children: "Nenhum resultado encontrado" })) }), jsxs("div", { className: styles$d.footer, children: [jsx(Button, { fullWidth: true, variant: "outlined", onClick: handleClearFilter, children: "Limpar" }), jsx(Button, { fullWidth: true, onClick: handleApplyFilter, children: "Aplicar" })] })] }));
4442
4489
  return (jsx("div", { className: filterClass, id: id, ...rest, children: jsx(Popover, { open: isOpen, onOpenChange: handleOpenChange, side: side, align: align, onOpenAutoFocus: (e) => e.preventDefault(), trigger: triggerButton, content: popoverContent }) }));
4443
4490
  };
4444
4491
 
@@ -4611,7 +4658,7 @@ const ListItem = ({ id, className, variant = 'text', text, subText, disabled = f
4611
4658
  : children }))] }));
4612
4659
  };
4613
4660
 
4614
- var styles$a = {"content":"Menu-module__content___pnDF6","subContent":"Menu-module__subContent___O9T-y","itemsWrapper":"Menu-module__itemsWrapper___Fcg71","item":"Menu-module__item___S3HKY","subTrigger":"Menu-module__subTrigger___CdnJE","itemSubText":"Menu-module__itemSubText___U1HFP","itemIcon":"Menu-module__itemIcon___iyxmZ","wrapperText":"Menu-module__wrapperText___PomUe","itemText":"Menu-module__itemText___2fd2B","chevronIcon":"Menu-module__chevronIcon___Gda-U","searchWrapper":"Menu-module__searchWrapper___e0knQ","emptyState":"Menu-module__emptyState___3wh-S","loadingMore":"Menu-module__loadingMore___fUCvH"};
4661
+ var styles$a = {"content":"Menu-module__content___pnDF6","subContent":"Menu-module__subContent___O9T-y","itemsWrapper":"Menu-module__itemsWrapper___Fcg71","item":"Menu-module__item___S3HKY","subTrigger":"Menu-module__subTrigger___CdnJE","itemSubText":"Menu-module__itemSubText___U1HFP","itemIcon":"Menu-module__itemIcon___iyxmZ","wrapperText":"Menu-module__wrapperText___PomUe","itemText":"Menu-module__itemText___2fd2B","chevronIcon":"Menu-module__chevronIcon___Gda-U","searchWrapper":"Menu-module__searchWrapper___e0knQ","noResults":"Menu-module__noResults___f-Bi0","loadingMore":"Menu-module__loadingMore___fUCvH"};
4615
4662
 
4616
4663
  const MenuItem = memo(({ item, isSelected, onSelect }) => {
4617
4664
  const handleSelect = () => {
@@ -4865,7 +4912,7 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
4865
4912
  if (search) {
4866
4913
  e.stopPropagation();
4867
4914
  }
4868
- }, ...rest, children: [search && (jsx("div", { className: styles$a.searchWrapper, children: jsx(Search, { placeholder: "Buscar", onChange: handleSearchChange, value: searchInput, onKeyDown: handleSearchKeyDown }) })), jsxs("div", { className: styles$a.itemsWrapper, ref: itemsWrapperRef, style: { maxHeight: maxHeightStyle }, children: [filteredItems.length > 0 ? (filteredItems.map((item, index) => renderMenuItem(item, item.value || item.text || `item-${index}`))) : (jsx("div", { className: styles$a.emptyState, children: "Nenhum item encontrado" })), enableInfiniteScroll && isLoadingMore && (jsx("div", { className: styles$a.loadingMore, children: "Carregando mais itens..." })), enableInfiniteScroll && (jsx("div", { ref: sentinelRef, "data-scroll-sentinel": true, style: { height: '1px', visibility: 'hidden' } }))] })] }) })] }));
4915
+ }, ...rest, children: [search && (jsx("div", { className: styles$a.searchWrapper, children: jsx(Search, { placeholder: "Buscar", onChange: handleSearchChange, value: searchInput, onKeyDown: handleSearchKeyDown }) })), jsxs("div", { className: styles$a.itemsWrapper, ref: itemsWrapperRef, style: { maxHeight: maxHeightStyle }, children: [filteredItems.length > 0 ? (filteredItems.map((item, index) => renderMenuItem(item, item.value || item.text || `item-${index}`))) : (jsx("div", { className: styles$a.noResults, children: "Nenhum resultado encontrado" })), enableInfiniteScroll && isLoadingMore && (jsx("div", { className: styles$a.loadingMore, children: "Carregando mais itens..." })), enableInfiniteScroll && (jsx("div", { ref: sentinelRef, "data-scroll-sentinel": true, style: { height: '1px', visibility: 'hidden' } }))] })] }) })] }));
4869
4916
  };
4870
4917
 
4871
4918
  var styles$9 = {"modalOverlay":"Modal-module__modalOverlay___rI8Wz","modalContent":"Modal-module__modalContent___6Cgb1","modalContent--fullscreen":"Modal-module__modalContent--fullscreen___QeBlG","modalHeader":"Modal-module__modalHeader___IuHIg","modalCloseButton":"Modal-module__modalCloseButton___VoWHD","modalTitle":"Modal-module__modalTitle___9VDmr","modalBody":"Modal-module__modalBody___ohjQm","modalFooter":"Modal-module__modalFooter___TEqdK"};
@@ -4881,10 +4928,21 @@ const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeO
4881
4928
  e.preventDefault();
4882
4929
  contentRef.current?.focus();
4883
4930
  };
4931
+ const handleInteractOutside = (e) => {
4932
+ // Ignora interações em elementos portalizados que se declararam isentos
4933
+ // (ex.: VirtualKeyboard em modo native), evitando fechamentos indesejados.
4934
+ if (isDismissOutsideIgnored(e.target)) {
4935
+ e.preventDefault();
4936
+ return;
4937
+ }
4938
+ if (!closeOnOverlayClick) {
4939
+ e.preventDefault();
4940
+ }
4941
+ };
4884
4942
  return (jsx(Dialog$1.Root, { open: isOpen, onOpenChange: handleOpenChange, ...rest, children: jsxs(Dialog$1.Portal, { children: [jsx(Dialog$1.Overlay, { className: styles$9.modalOverlay }), jsxs(Dialog$1.Content, { ref: contentRef, className: clsx(styles$9.modalContent, fullscreen && styles$9['modalContent--fullscreen'], className), id: id, style: {
4885
4943
  '--modal-custom-width': customWidth,
4886
4944
  '--modal-custom-height': customHeight,
4887
- }, onInteractOutside: !closeOnOverlayClick ? (e) => e.preventDefault() : undefined, onOpenAutoFocus: handleOpenAutoFocus, "aria-labelledby": id ? `${id}-title` : 'modal-title', tabIndex: -1, children: [(title || headerContent || closingButton) && (jsxs("header", { className: styles$9.modalHeader, children: [title && (jsx(Dialog$1.Title, { className: styles$9.modalTitle, id: id ? `${id}-title` : 'modal-title', children: title })), headerContent && (jsx("div", { children: headerContent })), closingButton && (jsx("div", { className: styles$9.modalCloseButton, children: jsx(Dialog$1.Close, { asChild: true, children: jsx(Button, { variant: "outlined", iconOnly: true, icon: jsx(Dismiss16Regular, {}), size: "lg", tooltipText: 'Fechar' }) }) }))] })), jsx("section", { className: styles$9.modalBody, children: children }), footer && (jsx("footer", { className: styles$9.modalFooter, children: footer }))] })] }) }));
4945
+ }, onInteractOutside: handleInteractOutside, onOpenAutoFocus: handleOpenAutoFocus, "aria-labelledby": id ? `${id}-title` : 'modal-title', tabIndex: -1, children: [(title || headerContent || closingButton) && (jsxs("header", { className: styles$9.modalHeader, children: [title && (jsx(Dialog$1.Title, { className: styles$9.modalTitle, id: id ? `${id}-title` : 'modal-title', children: title })), headerContent && (jsx("div", { children: headerContent })), closingButton && (jsx("div", { className: styles$9.modalCloseButton, children: jsx(Dialog$1.Close, { asChild: true, children: jsx(Button, { variant: "outlined", iconOnly: true, icon: jsx(Dismiss16Regular, {}), size: "lg", tooltipText: 'Fechar' }) }) }))] })), jsx("section", { className: styles$9.modalBody, children: children }), footer && (jsx("footer", { className: styles$9.modalFooter, children: footer }))] })] }) }));
4888
4946
  };
4889
4947
 
4890
4948
  var styles$8 = {"quantity":"Quantity-module__quantity___-vndR","quantityInput":"Quantity-module__quantityInput___xZG-v","disabled":"Quantity-module__disabled___X6p5l"};
@@ -5402,19 +5460,33 @@ function useSelectLogic({ value, required = false, search = false, onValueChange
5402
5460
  };
5403
5461
  }
5404
5462
 
5405
- const Select = ({ items, onValueChange, onOpenChange, variant, required = false, value, label, helperText, placeholder = 'Selecione', maxWidth, search = false, error, errorMessage, disabled = false, className, style, 'aria-label': ariaLabel, 'data-testid': testId, tooltipText, tooltipSide = 'bottom', tooltipAlign = 'start', enableInfiniteScroll = false, onScrollEnd, hasMore = true, isLoadingMore = false, enableApiSearch = false, onApiSearch, isSearching = false, scale = 1, ...rest }) => {
5463
+ const Select = ({ items, onValueChange, onOpenChange, variant, required = false, value, label, helperText, placeholder = 'Selecione', maxWidth, search = false, error, errorMessage, disabled = false, className, style, 'aria-label': ariaLabel, 'data-testid': testId, tooltipText, tooltipSide = 'bottom', tooltipAlign = 'start', enableInfiniteScroll = false, onScrollEnd, hasMore = true, isLoadingMore = false, enableApiSearch, onApiSearch, isSearching = false, scale = 1, ...rest }) => {
5406
5464
  const componentId = useId();
5407
5465
  const selectId = `select-${componentId}`;
5408
5466
  const viewportRef = useRef(null);
5409
5467
  const hasReachedEndRef = useRef(false);
5410
5468
  const wasLoadingMoreRef = useRef(false);
5469
+ const isApiSearch = enableApiSearch ?? Boolean(onApiSearch);
5470
+ useEffect(() => {
5471
+ if (process.env.NODE_ENV !== 'production' && enableApiSearch !== undefined) {
5472
+ console.warn('[Giro DS] `enableApiSearch` está depreciado. ' +
5473
+ 'A busca remota será ativada pela presença de `onApiSearch`. ' +
5474
+ 'Remoção psera feita futuramente.');
5475
+ }
5476
+ }, [enableApiSearch]);
5477
+ useEffect(() => {
5478
+ if (process.env.NODE_ENV !== 'production' && enableApiSearch === false && onApiSearch) {
5479
+ console.warn('[Giro DS] A combinação `enableApiSearch={false}` com `onApiSearch` ' +
5480
+ 'futuramente o comportamento ira mudar');
5481
+ }
5482
+ }, [enableApiSearch, onApiSearch]);
5411
5483
  const { state, actions, refs, utils, } = useSelectLogic({
5412
5484
  value,
5413
5485
  required,
5414
5486
  search,
5415
5487
  onValueChange,
5416
5488
  onOpenChange,
5417
- enableApiSearch,
5489
+ enableApiSearch: isApiSearch,
5418
5490
  onApiSearch,
5419
5491
  isSearching,
5420
5492
  error,
@@ -5452,9 +5524,9 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
5452
5524
  }, [isLoadingMore, enableInfiniteScroll]);
5453
5525
  const displayText = useMemo(() => utils.getDisplayText(state.selectedValues, placeholder, variant, items), [state.selectedValues, placeholder, variant, items, utils]);
5454
5526
  const filteredItems = useMemo(() => {
5455
- const termToFilter = enableApiSearch ? state.searchTerm : state.searchInput;
5527
+ const termToFilter = isApiSearch ? state.searchTerm : state.searchInput;
5456
5528
  return utils.getFilteredItems(items, termToFilter);
5457
- }, [items, state.searchTerm, state.searchInput, enableApiSearch, utils]);
5529
+ }, [items, state.searchTerm, state.searchInput, isApiSearch, utils]);
5458
5530
  useEffect(() => {
5459
5531
  if (!state.isOpen || !enableInfiniteScroll || !onScrollEnd || isLoadingMore)
5460
5532
  return;
@@ -5477,7 +5549,7 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
5477
5549
  const handleSearchChange = (e) => {
5478
5550
  const value = e.target.value;
5479
5551
  actions.setSearchInput(value);
5480
- if (enableApiSearch) {
5552
+ if (isApiSearch) {
5481
5553
  actions.setSearchTerm(value);
5482
5554
  }
5483
5555
  };
@@ -5502,7 +5574,7 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
5502
5574
  };
5503
5575
  const handleClear = () => {
5504
5576
  actions.resetSearch();
5505
- if (enableApiSearch && onApiSearch) {
5577
+ if (isApiSearch && onApiSearch) {
5506
5578
  onApiSearch('');
5507
5579
  }
5508
5580
  };
@@ -5535,9 +5607,9 @@ var styles$5 = {"wrapper":"Table-module__wrapper___KMc04","tableContainer":"Tabl
5535
5607
 
5536
5608
  const EmptyState = ({ emptyIcon, emptyTitle, emptyText }) => (jsxs("div", { className: styles$5.tableEmpty, children: [jsx("div", { className: styles$5.tableEmptyContent, children: emptyIcon ?? jsx(SearchInfo20Regular, {}) }), jsxs("div", { className: styles$5.tableEmptyText, children: [jsx("h3", { className: styles$5.tableEmptyTitle, children: emptyTitle ?? 'Nenhum dado encontrado' }), jsx("p", { className: styles$5.tableEmptyCaption, children: emptyText ?? 'Nenhum registro encontrado' })] })] }));
5537
5609
 
5538
- var styles$4 = {"toggle":"ToggleButton-module__toggle___c1Ym-","item":"ToggleButton-module__item___2Qll-","toggle-lg":"ToggleButton-module__toggle-lg___8f3lo","item-lg":"ToggleButton-module__item-lg___479w-","toggle-sm":"ToggleButton-module__toggle-sm___SAGGb","item-sm":"ToggleButton-module__item-sm___4ju--","toggleIconLeft":"ToggleButton-module__toggleIconLeft___VwgKk","toggleWithIcon":"ToggleButton-module__toggleWithIcon___WbCr7","toggleIconOnly":"ToggleButton-module__toggleIconOnly___4iMEp","group":"ToggleButton-module__group___BoR-e"};
5610
+ var styles$4 = {"toggle":"ToggleButton-module__toggle___c1Ym-","item":"ToggleButton-module__item___2Qll-","toggle-lg":"ToggleButton-module__toggle-lg___8f3lo","item-lg":"ToggleButton-module__item-lg___479w-","toggle-sm":"ToggleButton-module__toggle-sm___SAGGb","item-sm":"ToggleButton-module__item-sm___4ju--","toggleIconLeft":"ToggleButton-module__toggleIconLeft___VwgKk","toggleWithIcon":"ToggleButton-module__toggleWithIcon___WbCr7","toggleIconOnly":"ToggleButton-module__toggleIconOnly___4iMEp","toggleLabel":"ToggleButton-module__toggleLabel___nCwcu","itemExpandOnSelect":"ToggleButton-module__itemExpandOnSelect___FVQj3","group":"ToggleButton-module__group___BoR-e","groupExpandable":"ToggleButton-module__groupExpandable___BWYWN"};
5539
5611
 
5540
- const Toggle = ({ pressed, defaultPressed, onPressedChange, disabled = false, className, label, id, size = 'lg', scale = 1, style, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', icon, iconOnly = false, mode: _mode, selectionType: _type, value: _value, defaultValue: _defaultValue, onValueChange: _onValueChange, items: _items, ...rest }) => {
5612
+ const Toggle = ({ pressed, defaultPressed, onPressedChange, disabled = false, className, label, id, size = 'lg', scale = 1, style, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', icon, iconOnly = false, mode: _mode, selectionType: _type, value: _value, defaultValue: _defaultValue, onValueChange: _onValueChange, items: _items, expandOnSelect: _expandOnSelect, requireSelection: _requireSelection, ...rest }) => {
5541
5613
  const toggle = (jsx(Toggle$1.Root, { pressed: pressed, defaultPressed: defaultPressed, onPressedChange: onPressedChange, disabled: disabled, className: clsx(styles$4.toggle, styles$4[`toggle-${size}`], {
5542
5614
  [styles$4.toggleIconOnly]: iconOnly,
5543
5615
  [styles$4.toggleWithIcon]: !!icon && !iconOnly,
@@ -5548,7 +5620,20 @@ const Toggle = ({ pressed, defaultPressed, onPressedChange, disabled = false, cl
5548
5620
  return toggle;
5549
5621
  };
5550
5622
 
5551
- const ToggleGroup = ({ selectionType = 'single', value, defaultValue, onValueChange, disabled = false, items = [], className, id, size = 'lg', scale = 1, style, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', mode: _mode, icon: _icon, iconOnly: _iconOnly, pressed: _pressed, defaultPressed: _defaultPressed, onPressedChange: _onPressedChange, ...rest }) => {
5623
+ const ToggleGroup = ({ selectionType = 'single', value, defaultValue, onValueChange, requireSelection = false, disabled = false, items = [], expandOnSelect: groupExpandOnSelect = false, className, id, size = 'lg', scale = 1, style, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', mode: _mode, icon: _icon, iconOnly: _iconOnly, pressed: _pressed, defaultPressed: _defaultPressed, onPressedChange: _onPressedChange, ...rest }) => {
5624
+ const singleValueProp = value;
5625
+ const singleOnValueChange = onValueChange;
5626
+ const isSingleControlled = singleValueProp !== undefined;
5627
+ const [uncontrolledValue, setUncontrolledValue] = React__default.useState(defaultValue ?? '');
5628
+ const handleSingleValueChange = React__default.useCallback((next) => {
5629
+ if (requireSelection && !next) {
5630
+ return;
5631
+ }
5632
+ if (!isSingleControlled) {
5633
+ setUncontrolledValue(next);
5634
+ }
5635
+ singleOnValueChange?.(next);
5636
+ }, [requireSelection, isSingleControlled, singleOnValueChange]);
5552
5637
  const rootProps = selectionType === 'multiple'
5553
5638
  ? {
5554
5639
  type: 'multiple',
@@ -5556,16 +5641,27 @@ const ToggleGroup = ({ selectionType = 'single', value, defaultValue, onValueCha
5556
5641
  defaultValue: defaultValue,
5557
5642
  onValueChange: onValueChange,
5558
5643
  }
5559
- : {
5560
- type: 'single',
5561
- value: value,
5562
- defaultValue: defaultValue,
5563
- onValueChange: onValueChange,
5564
- };
5565
- const group = (jsx(ToggleGroup$1.Root, { ...rootProps, disabled: disabled, className: clsx(styles$4.group, className), id: id, style: { '--giro-scale': scale, ...style }, ...rest, children: items.map((item) => (jsx(ToggleGroup$1.Item, { value: item.value, disabled: item.disabled, className: clsx(styles$4.item, styles$4[`item-${size}`], {
5566
- [styles$4.toggleIconOnly]: item.iconOnly,
5567
- [styles$4.toggleWithIcon]: !!item.icon && !item.iconOnly,
5568
- }), style: { '--giro-scale': scale }, children: item.iconOnly ? (jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: item.icon })) : (jsxs(Fragment, { children: [item.icon && jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: item.icon }), item.label] })) }, item.value))) }));
5644
+ : requireSelection
5645
+ ? {
5646
+ type: 'single',
5647
+ value: isSingleControlled ? singleValueProp : uncontrolledValue,
5648
+ onValueChange: handleSingleValueChange,
5649
+ }
5650
+ : {
5651
+ type: 'single',
5652
+ value: singleValueProp,
5653
+ defaultValue: defaultValue,
5654
+ onValueChange: singleOnValueChange,
5655
+ };
5656
+ const hasExpandableItems = groupExpandOnSelect || items.some((item) => item.expandOnSelect);
5657
+ const group = (jsx(ToggleGroup$1.Root, { ...rootProps, disabled: disabled, className: clsx(styles$4.group, { [styles$4.groupExpandable]: hasExpandableItems }, className), id: id, style: { '--giro-scale': scale, ...style }, ...rest, children: items.map((item) => {
5658
+ const expandOnSelect = item.expandOnSelect ?? groupExpandOnSelect;
5659
+ return (jsx(ToggleGroup$1.Item, { value: item.value, disabled: item.disabled, className: clsx(styles$4.item, styles$4[`item-${size}`], {
5660
+ [styles$4.toggleIconOnly]: item.iconOnly && !expandOnSelect,
5661
+ [styles$4.toggleWithIcon]: !!item.icon && !item.iconOnly && !expandOnSelect,
5662
+ [styles$4.itemExpandOnSelect]: expandOnSelect,
5663
+ }), style: { '--giro-scale': scale }, children: expandOnSelect ? (jsxs(Fragment, { children: [item.icon && jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: item.icon }), jsx("span", { className: styles$4.toggleLabel, children: item.label })] })) : item.iconOnly ? (jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: item.icon })) : (jsxs(Fragment, { children: [item.icon && jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: item.icon }), item.label] })) }, item.value));
5664
+ }) }));
5569
5665
  if (tooltipText) {
5570
5666
  return (jsx(Tooltip, { text: tooltipText, side: tooltipSide, align: tooltipAlign, children: group }));
5571
5667
  }
@@ -5718,7 +5814,7 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
5718
5814
  footer?.onPageChange?.(1);
5719
5815
  }
5720
5816
  header?.onSearchChange?.('');
5721
- }, placeholder: header.searchPlaceholder ?? 'Pesquisar...', className: styles$5.tableHeaderSearch }) })), header.viewToggle && (jsx(ToggleButton, { mode: "combined", selectionType: "single", value: activeView, onValueChange: (val) => {
5817
+ }, placeholder: header.searchPlaceholder ?? 'Pesquisar...', className: styles$5.tableHeaderSearch }) })), header.viewToggle && (jsx(ToggleButton, { mode: "combined", selectionType: "single", value: activeView, requireSelection: true, onValueChange: (val) => {
5722
5818
  if (!val)
5723
5819
  return;
5724
5820
  setActiveView(val);