@giro-ds/react 12.1.1 → 12.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -76,6 +76,39 @@ const Badge = ({ children, badgeValue = null, className, id, filterVariant = fal
76
76
  }, className), "data-testid": "badge", children: !isEmpty && (jsxRuntime.jsx("span", { "aria-hidden": !!ariaLabel, children: displayValue })) }) }));
77
77
  };
78
78
 
79
+ const REACT_MAJOR = parseInt(React.version.split('.')[0], 10);
80
+ /**
81
+ * Shim de compatibilidade para `React.forwardRef` que funciona tanto no React 18
82
+ * quanto no React 19.
83
+ *
84
+ * - React 18: `ref` não é uma prop comum — usa `React.forwardRef` internamente.
85
+ * - React 19: `ref` é uma prop normal e `forwardRef` foi depreciado. Este shim
86
+ * cria um componente funcional comum que lê `ref` das props diretamente,
87
+ * evitando o aviso de depreciação.
88
+ *
89
+ * O padrão de autoria dos componentes permanece idêntico para ambas as versões.
90
+ *
91
+ * @example
92
+ * const MyInput = forwardRef<HTMLInputElement, MyInputProps>((props, ref) => {
93
+ * return <input ref={ref} {...props} />;
94
+ * });
95
+ */
96
+ function forwardRef(render) {
97
+ if (REACT_MAJOR >= 19) {
98
+ const Comp = (props) => {
99
+ const { ref, ...rest } = props;
100
+ return render(rest, ref ?? null);
101
+ };
102
+ const displayName = render.displayName ?? render.name;
103
+ if (displayName) {
104
+ Comp.displayName = displayName;
105
+ }
106
+ return Comp;
107
+ }
108
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
109
+ return React.forwardRef(render);
110
+ }
111
+
79
112
  var styles$t = {"tooltipContent":"Tooltip-module__tooltipContent___xycUg","triggerWrapper":"Tooltip-module__triggerWrapper___x83XR"};
80
113
 
81
114
  const Tooltip = ({ children, text, side = 'bottom', align = 'start', maxWidth, sideOffset = 10, className, ...rest }) => {
@@ -84,7 +117,7 @@ const Tooltip = ({ children, text, side = 'bottom', align = 'start', maxWidth, s
84
117
 
85
118
  var styles$s = {"button":"Button-module__button___18Bed","button-lg":"Button-module__button-lg___-A8B9","button-sm":"Button-module__button-sm___L7aT7","button-filled":"Button-module__button-filled___IQx1z","button-outlined":"Button-module__button-outlined___hLkLN","button-text":"Button-module__button-text___8GFeA","buttonWithIcon":"Button-module__buttonWithIcon___8ehK1","buttonIconPosition-left":"Button-module__buttonIconPosition-left___uOY6b","buttonIconPosition-right":"Button-module__buttonIconPosition-right___eswRS","buttonIconPosition-both":"Button-module__buttonIconPosition-both___1Lith","buttonNoContent":"Button-module__buttonNoContent___Tc9jk","buttonIconOnly":"Button-module__buttonIconOnly___aifk4","buttonIconLeft":"Button-module__buttonIconLeft___RICR3","buttonIconRight":"Button-module__buttonIconRight___71lu2","buttonFullWidth":"Button-module__buttonFullWidth___tXuVE","disabled":"Button-module__disabled___UzdWL","buttonLoading":"Button-module__buttonLoading___RGdNw","buttonContentHidden":"Button-module__buttonContentHidden___CoCiN","buttonLoadingSpinner":"Button-module__buttonLoadingSpinner___oZxEU","spin":"Button-module__spin___kQKH9"};
86
119
 
87
- const Button = React.forwardRef(({ as, children, variant = 'filled', iconPosition = 'left', href, to, external = false, target, rel, disabled = false, onClick, size = 'lg', scale = 1, className, type = 'button', id, icon, fullWidth = false, ariaLabel, iconOnly = false, loading = false, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', ...rest }, ref) => {
120
+ const Button = forwardRef(({ as, children, variant = 'filled', iconPosition = 'left', href, to, external = false, target, rel, disabled = false, onClick, size = 'lg', scale = 1, className, type = 'button', id, icon, fullWidth = false, ariaLabel, iconOnly = false, loading = false, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', ...rest }, ref) => {
88
121
  const generatedId = React.useId();
89
122
  const componentId = id || generatedId;
90
123
  const getComponent = () => {
@@ -196,7 +229,7 @@ const Button = React.forwardRef(({ as, children, variant = 'filled', iconPositio
196
229
  }
197
230
  return {};
198
231
  };
199
- if (iconOnly && tooltipText && !loading) {
232
+ if (tooltipText && !loading) {
200
233
  return (jsxRuntime.jsx(Tooltip, { text: tooltipText, side: tooltipSide, align: tooltipAlign, children: jsxRuntime.jsx(Component, { ...baseProps, ...getNavigationProps(), children: renderContent() }) }));
201
234
  }
202
235
  return (jsxRuntime.jsx(Component, { ...baseProps, ...getNavigationProps(), children: renderContent() }));
@@ -2928,6 +2961,8 @@ const ICON_KEY_MAP = {
2928
2961
  capslock: reactIcons.KeyboardShiftUppercase20Regular,
2929
2962
  downkeyboard: reactIcons.ChevronDown20Regular,
2930
2963
  emoji: reactIcons.Emoji20Regular,
2964
+ enterNumpad: reactIcons.ArrowImport20Regular,
2965
+ spaceNumpad: reactIcons.Spacebar20Regular,
2931
2966
  };
2932
2967
  const SHARED_DISPLAY = {
2933
2968
  '{capslock}': iconSlot('capslock'),
@@ -2953,9 +2988,11 @@ const LAYOUT_DISPLAY = {
2953
2988
  const EMOTICON_KEY = '{emoticon}';
2954
2989
  const DOWN_KEYBOARD_KEY = '{downkeyboard}';
2955
2990
  const ENTER_KEY = '{enter}';
2956
- const removeKeyFromLayout = (layout, key) => Object.fromEntries(Object.entries(layout).map(([layoutName, rows]) => [
2991
+ const removeKeyFromLayout = (layout, key, skipLayouts = []) => Object.fromEntries(Object.entries(layout).map(([layoutName, rows]) => [
2957
2992
  layoutName,
2958
- rows.map((row) => row.split(key).join(' ').replace(/\s+/g, ' ').trim()),
2993
+ skipLayouts.includes(layoutName)
2994
+ ? rows
2995
+ : rows.map((row) => row.split(key).join(' ').replace(/\s+/g, ' ').trim()),
2959
2996
  ]));
2960
2997
  const replaceKeyWithBlank = (layout, key) => Object.fromEntries(Object.entries(layout).map(([layoutName, rows]) => [
2961
2998
  layoutName,
@@ -2968,7 +3005,8 @@ const QWERTY_LOWERCASE = [
2968
3005
  '{shift} z x c v b n m {bksp}',
2969
3006
  '{numbers} {alt} {space} . {enter}',
2970
3007
  ];
2971
- const NUMPAD = ['1 2 3', '4 5 6', '7 8 9', '{bksp} 0 {abc}'];
3008
+ const NUMPAD = ['1 2 3', '4 5 6', '7 8 9', '{abc} 0 {bksp}'];
3009
+ const NUMPAD_WITH_ENTER = ['1 2 3 -', '4 5 6 {space}', '7 8 9 {bksp}', '{abc} 0 . {enter}'];
2972
3010
  const SHARED_LAYOUTS = {
2973
3011
  shift: [
2974
3012
  '1 2 3 4 5 6 7 8 9 0',
@@ -3018,11 +3056,17 @@ const NATIVE_LAYOUTS = {
3018
3056
  const NATIVE_LAYOUT_KEYS = new Set([
3019
3057
  'default', 'numeric',
3020
3058
  ]);
3021
- const getNativeLayout = (type, Emoji = true, showDownKeyboardButton = true, isFixed = false, showEnterKey = true, showTypeSwitchKey = true) => {
3059
+ const getNativeLayout = (type, Emoji = true, showDownKeyboardButton = true, isFixed = false, showEnterKey = true, showTypeSwitchKey = true, numpadWithEnter = false) => {
3022
3060
  const layout = NATIVE_LAYOUTS[type] ?? NATIVE_LAYOUTS.default ?? null;
3023
3061
  if (!layout)
3024
3062
  return null;
3025
- let computedLayout = layout;
3063
+ let computedLayout = numpadWithEnter
3064
+ ? {
3065
+ ...layout,
3066
+ ...(type === 'numeric' ? { default: NUMPAD_WITH_ENTER } : {}),
3067
+ numbers: NUMPAD_WITH_ENTER,
3068
+ }
3069
+ : layout;
3026
3070
  if (!Emoji) {
3027
3071
  computedLayout = removeKeyFromLayout(computedLayout, EMOTICON_KEY);
3028
3072
  }
@@ -3030,26 +3074,31 @@ const getNativeLayout = (type, Emoji = true, showDownKeyboardButton = true, isFi
3030
3074
  computedLayout = removeKeyFromLayout(computedLayout, DOWN_KEYBOARD_KEY);
3031
3075
  }
3032
3076
  if (!showEnterKey) {
3033
- computedLayout = removeKeyFromLayout(computedLayout, ENTER_KEY);
3077
+ // Numpad layouts always preserve {enter}; only remove from QWERTY layouts
3078
+ const numpadLayouts = type === 'numeric' ? ['default', 'numbers'] : ['numbers'];
3079
+ computedLayout = removeKeyFromLayout(computedLayout, ENTER_KEY, numpadLayouts);
3034
3080
  }
3035
3081
  if (!showTypeSwitchKey) {
3036
3082
  computedLayout = removeKeyFromLayout(computedLayout, '{numbers}');
3037
3083
  computedLayout = replaceKeyWithBlank(computedLayout, '{abc}');
3038
3084
  }
3039
3085
  if (isFixed) {
3040
- computedLayout = Object.fromEntries(Object.entries(computedLayout).map(([layoutName, rows]) => [
3041
- layoutName,
3042
- rows.map((row) => {
3043
- const trimmed = row.trim();
3044
- if (/^[a-zA-ZçÇ]/.test(trimmed) && trimmed.endsWith('{bksp}')) {
3045
- return '{//} ' + trimmed.replace(/\s*\{bksp\}$/, '') + ' {//}';
3046
- }
3047
- if (/\{(shift|capslock|shiftactivated)\}$/.test(trimmed)) {
3048
- return trimmed.replace(/\{(shift|capslock|shiftactivated)\}$/, '{bksp}');
3049
- }
3050
- return row;
3051
- }),
3052
- ]));
3086
+ computedLayout = Object.fromEntries(Object.entries(computedLayout).map(([layoutName, rows]) => {
3087
+ const hasBksp = rows.some((r) => r.includes('{bksp}'));
3088
+ return [
3089
+ layoutName,
3090
+ rows.map((row) => {
3091
+ const trimmed = row.trim();
3092
+ if (/^[a-zA-ZçÇ]/.test(trimmed) && trimmed.endsWith('{bksp}')) {
3093
+ return '{//} ' + trimmed.replace(/\s*\{bksp\}$/, '') + ' {//}';
3094
+ }
3095
+ if (!hasBksp && /\{(shift|capslock|shiftactivated)\}$/.test(trimmed)) {
3096
+ return trimmed.replace(/\{(shift|capslock|shiftactivated)\}$/, '{bksp}');
3097
+ }
3098
+ return row;
3099
+ }),
3100
+ ];
3101
+ }));
3053
3102
  }
3054
3103
  return computedLayout;
3055
3104
  };
@@ -3101,13 +3150,16 @@ const ACCENT_OPTIONS = {
3101
3150
  * <VirtualKeyboard targetRef={inputRef} value={value} onChange={setValue} />
3102
3151
  * ```
3103
3152
  */
3104
- const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onChange, onKeyPress, onTypeChange, maxLength, Emoji = false, className, id, placeholder = 'Digite aqui...', helperText, error, errorMessage, targetRef, textFieldScale = 1, showEnterKey = true, showTypeSwitchKey = true, }) => {
3153
+ const VirtualKeyboard = ({ variant = 'native', type = 'default', value, onChange, onKeyPress, onEnterPress, onTypeChange, maxLength, Emoji = false, className, id, placeholder = 'Digite aqui...', helperText, error, errorMessage, targetRef, textFieldScale = 1, showEnterKey = true, showTypeSwitchKey = true, numpadWithEnter = false, }) => {
3154
+ const [internalValue, setInternalValue] = React.useState(value ?? '');
3105
3155
  const [layoutName, setLayoutName] = React.useState('default');
3106
3156
  const [capsLockOn, setCapsLockOn] = React.useState(false);
3107
3157
  const [accentMenu, setAccentMenu] = React.useState(null);
3108
3158
  const [accentMenuOffsetX, setAccentMenuOffsetX] = React.useState(0);
3109
- const [activeLayout, setActiveLayout] = React.useState(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed', showEnterKey, showTypeSwitchKey));
3159
+ const [activeLayout, setActiveLayout] = React.useState(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed', showEnterKey, showTypeSwitchKey, numpadWithEnter));
3110
3160
  const visualType = NATIVE_LAYOUT_KEYS.has(type) ? type : 'default';
3161
+ const effectiveValue = onChange !== undefined ? (value ?? '') : internalValue;
3162
+ const isNumpadLayout = (type === 'numeric' && layoutName === 'default') || layoutName === 'numbers';
3111
3163
  const [isOpen, setIsOpen] = React.useState(variant !== 'native');
3112
3164
  const hideTimeoutRef = React.useRef(null);
3113
3165
  const scrollTimeoutRef = React.useRef(null);
@@ -3120,15 +3172,15 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
3120
3172
  const keyboardInstanceRef = React.useRef(null);
3121
3173
  const accentMenuRef = React.useRef(null);
3122
3174
  const accentButtonRef = React.useRef(null);
3123
- const valueRef = React.useRef(value);
3175
+ const valueRef = React.useRef(value ?? '');
3124
3176
  const [iconSlots, setIconSlots] = React.useState([]);
3125
3177
  const [keyPreview, setKeyPreview] = React.useState(null);
3126
3178
  const [keyPreviewOffsetX, setKeyPreviewOffsetX] = React.useState(0);
3127
3179
  const keyPreviewRef = React.useRef(null);
3128
3180
  const [containerWidth, setContainerWidth] = React.useState(Infinity);
3129
3181
  React.useEffect(() => {
3130
- valueRef.current = value;
3131
- }, [value]);
3182
+ valueRef.current = effectiveValue;
3183
+ }, [effectiveValue]);
3132
3184
  const clearLongPressTimeout = React.useCallback(() => {
3133
3185
  if (longPressTimeoutRef.current !== null) {
3134
3186
  clearTimeout(longPressTimeoutRef.current);
@@ -3143,8 +3195,8 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
3143
3195
  keyboardInstanceRef.current?.setInput(nextValue);
3144
3196
  }, []);
3145
3197
  React.useEffect(() => {
3146
- syncKeyboardInput(value);
3147
- }, [value, syncKeyboardInput]);
3198
+ syncKeyboardInput(effectiveValue);
3199
+ }, [effectiveValue, syncKeyboardInput]);
3148
3200
  React.useEffect(() => {
3149
3201
  onTypeChange?.(type);
3150
3202
  }, [type, onTypeChange]);
@@ -3222,8 +3274,8 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
3222
3274
  React.useEffect(() => {
3223
3275
  setLayoutName('default');
3224
3276
  setCapsLockOn(false);
3225
- setActiveLayout(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed', showEnterKey, showTypeSwitchKey));
3226
- }, [type, Emoji, variant, showEnterKey, showTypeSwitchKey]);
3277
+ setActiveLayout(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed', showEnterKey, showTypeSwitchKey, numpadWithEnter));
3278
+ }, [type, Emoji, variant, showEnterKey, showTypeSwitchKey, numpadWithEnter]);
3227
3279
  React.useEffect(() => {
3228
3280
  if (!Emoji && layoutName === 'emoticon') {
3229
3281
  setLayoutName(type === 'numeric' ? 'abc' : 'default');
@@ -3303,7 +3355,10 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
3303
3355
  if (newSlots.length === 0)
3304
3356
  return;
3305
3357
  newSlots.forEach((s) => s.setAttribute('data-icon-root', 'true'));
3306
- setIconSlots((prev) => [...prev, ...newSlots]);
3358
+ setIconSlots((prev) => [
3359
+ ...prev.filter((slot) => container.contains(slot)),
3360
+ ...newSlots,
3361
+ ]);
3307
3362
  };
3308
3363
  registerNewSlots();
3309
3364
  const observer = new MutationObserver(() => {
@@ -3314,7 +3369,7 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
3314
3369
  return () => {
3315
3370
  observer.disconnect();
3316
3371
  };
3317
- }, []);
3372
+ }, [variant]);
3318
3373
  React.useEffect(() => {
3319
3374
  closeAccentMenu();
3320
3375
  setAccentMenuOffsetX(0);
@@ -3396,6 +3451,8 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
3396
3451
  const currentValue = valueRef.current;
3397
3452
  if (maxLength === undefined || currentValue.length < maxLength) {
3398
3453
  const nextValue = `${currentValue}${heldKey}`;
3454
+ if (onChange === undefined)
3455
+ setInternalValue(nextValue);
3399
3456
  onChange?.(nextValue);
3400
3457
  onKeyPress?.(heldKey);
3401
3458
  syncKeyboardInput(nextValue);
@@ -3429,6 +3486,8 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
3429
3486
  return;
3430
3487
  }
3431
3488
  const nextValue = `${currentValue}${accentedChar}`;
3489
+ if (onChange === undefined)
3490
+ setInternalValue(nextValue);
3432
3491
  onChange?.(nextValue);
3433
3492
  onKeyPress?.(accentedChar);
3434
3493
  closeAccentMenu();
@@ -3519,12 +3578,16 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
3519
3578
  if (isHeldAccentKey) {
3520
3579
  return;
3521
3580
  }
3581
+ if (button === '{enter}') {
3582
+ onEnterPress?.();
3583
+ }
3522
3584
  onKeyPress?.(button);
3523
3585
  }, [
3524
3586
  type,
3525
3587
  layoutName,
3526
3588
  capsLockOn,
3527
3589
  onKeyPress,
3590
+ onEnterPress,
3528
3591
  onTypeChange,
3529
3592
  Emoji,
3530
3593
  variant,
@@ -3538,12 +3601,12 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
3538
3601
  if (heldKey &&
3539
3602
  input.length >= currentValue.length + 1 &&
3540
3603
  input.startsWith(currentValue) &&
3541
- input.slice(currentValue.length).split('').every((char) => char === heldKey)) {
3604
+ [...input.slice(currentValue.length)].every((char) => char === heldKey)) {
3542
3605
  syncKeyboardInput(currentValue);
3543
3606
  return;
3544
3607
  }
3545
3608
  if (suppressedKey &&
3546
- input.length === currentValue.length + 1 &&
3609
+ input.length === currentValue.length + suppressedKey.length &&
3547
3610
  input.endsWith(suppressedKey)) {
3548
3611
  suppressNextInputRef.current = null;
3549
3612
  syncKeyboardInput(currentValue);
@@ -3551,8 +3614,10 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
3551
3614
  }
3552
3615
  if (maxLength !== undefined && input.length > maxLength)
3553
3616
  return;
3617
+ if (onChange === undefined)
3618
+ setInternalValue(input);
3554
3619
  onChange?.(input);
3555
- }, [maxLength, onChange, syncKeyboardInput]);
3620
+ }, [maxLength, onChange, setInternalValue, syncKeyboardInput]);
3556
3621
  const portalSizes = React.useMemo(() => {
3557
3622
  if (containerWidth <= 360)
3558
3623
  return { preview: 42, option: 44, fontSize: 'var(--font-size-16)' };
@@ -3568,15 +3633,17 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
3568
3633
  const baseDisplay = LAYOUT_DISPLAY[visualType];
3569
3634
  if (!baseDisplay)
3570
3635
  return baseDisplay;
3571
- if (variant !== 'fixed') {
3572
- return baseDisplay;
3636
+ const display = { ...baseDisplay };
3637
+ if (numpadWithEnter && isNumpadLayout) {
3638
+ display['{enter}'] = '<span data-icon-key="enterNumpad"></span>';
3639
+ display['{space}'] = '<span data-icon-key="spaceNumpad"></span>';
3573
3640
  }
3574
- return {
3575
- ...baseDisplay,
3576
- '{bksp}': (baseDisplay['{bksp}'] ?? '').replace(/\s*Apagar$/, ''),
3577
- };
3578
- }, [visualType, variant]);
3579
- const keyboardEl = activeLayout ? (jsxRuntime.jsxs("div", { ref: keyboardWrapperRef, className: clsx(styles$k.keyboardWrapper, ((type === 'numeric' && layoutName === 'default') || layoutName === 'numbers' || type === 'default') && styles$k.keyboardNumpadActive), onPointerDownCapture: handleLongPressStart, onPointerUpCapture: handleLongPressEnd, onPointerLeave: handleLongPressEnd, onPointerCancelCapture: handleLongPressEnd, children: [jsxRuntime.jsx(Keyboard, { keyboardRef: (instance) => {
3641
+ if (variant === 'fixed') {
3642
+ display['{bksp}'] = (display['{bksp}'] ?? '').replace(/\s*Apagar$/, '');
3643
+ }
3644
+ return display;
3645
+ }, [visualType, variant, numpadWithEnter, isNumpadLayout]);
3646
+ const keyboardEl = activeLayout ? (jsxRuntime.jsxs("div", { ref: keyboardWrapperRef, className: clsx(styles$k.keyboardWrapper, isNumpadLayout && styles$k.keyboardNumpadActive), onPointerDownCapture: handleLongPressStart, onPointerUpCapture: handleLongPressEnd, onPointerLeave: handleLongPressEnd, onPointerCancelCapture: handleLongPressEnd, children: [jsxRuntime.jsx(Keyboard, { keyboardRef: (instance) => {
3580
3647
  keyboardInstanceRef.current = instance;
3581
3648
  if (instance) {
3582
3649
  instance.setInput(valueRef.current);
@@ -3614,9 +3681,9 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
3614
3681
  event.stopPropagation();
3615
3682
  }, onClick: () => handleAccentSelect(option), children: option }, `${accentMenu.sourceKey}-${option}`))) }, rowIndex))) }), document.body))] })) : null;
3616
3683
  if (variant === 'native' && typeof document !== 'undefined') {
3617
- return reactDom.createPortal(jsxRuntime.jsx("div", { id: id, className: clsx(styles$k.overlay, { [styles$k.overlayOpen]: isOpen }, styles$k[`layout--${visualType}`], className), children: keyboardEl }), document.body);
3684
+ return reactDom.createPortal(jsxRuntime.jsx("div", { id: id, className: clsx(styles$k.overlay, { [styles$k.overlayOpen]: isOpen }, styles$k[isNumpadLayout ? 'layout--numeric' : 'layout--default'], className), children: keyboardEl }), document.body);
3618
3685
  }
3619
- return (jsxRuntime.jsxs("div", { id: id, className: clsx(styles$k.container, styles$k[`mode--${variant}`], styles$k[`layout--${visualType}`], className), children: [variant === 'fixed' && (jsxRuntime.jsx("div", { className: styles$k.textFieldContainer, children: jsxRuntime.jsx(TextField, { placeholder: placeholder, value: value, onChange: onChange, helperText: helperText, error: error, errorMessage: errorMessage, readOnly: true, disableAutoComplete: true, maxLength: maxLength, attachedToVirtualKeyboard: true, className: styles$k.textFieldWrapper, scale: textFieldScale }) })), keyboardEl] }));
3686
+ return (jsxRuntime.jsxs("div", { id: id, className: clsx(styles$k.container, styles$k[`mode--${variant}`], styles$k[isNumpadLayout ? 'layout--numeric' : 'layout--default'], className), children: [variant === 'fixed' && (jsxRuntime.jsx("div", { className: styles$k.textFieldContainer, children: jsxRuntime.jsx(TextField, { 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] }));
3620
3687
  };
3621
3688
 
3622
3689
  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"};
@@ -3645,7 +3712,7 @@ const LabelComponent = ({ children, htmlFor, required = false, tooltip = false,
3645
3712
  return container;
3646
3713
  };
3647
3714
 
3648
- const TextField$1 = React.forwardRef(({ className, style, value, label, placeholder, type = 'text', onChange, disabled = false, maxLength, required = false, helperText, tooltipText, tooltipSide = 'bottom', tooltipAlign = 'start', errorMessage, error, id, icon, scale = 1, onBlur, onFocus, name, persistIcon = false, virtualKeyboard, attachedToVirtualKeyboard, disableAutoComplete = false, ...rest }, ref) => {
3715
+ const TextField$1 = forwardRef(({ className, style, value, label, placeholder, type = 'text', onChange, disabled = false, maxLength, required = false, helperText, tooltipText, tooltipSide = 'bottom', tooltipAlign = 'start', errorMessage, error, id, icon, scale = 1, onBlur, onFocus, name, virtualKeyboard, attachedToVirtualKeyboard, disableAutoComplete = false, ...rest }, ref) => {
3649
3716
  const normalizeValue = (val) => {
3650
3717
  return val === undefined || val === null ? '' : String(val);
3651
3718
  };
@@ -3696,7 +3763,7 @@ const TextField$1 = React.forwardRef(({ className, style, value, label, placehol
3696
3763
  setIsFocused(true);
3697
3764
  onFocus?.(e);
3698
3765
  }, [onFocus]);
3699
- const showCustomIcon = (inputValue.trim().length === 0 || persistIcon) && icon;
3766
+ const showCustomIcon = (inputValue.trim().length === 0 || !isFocused) && icon;
3700
3767
  const showClearIcon = isFocused && inputValue.trim().length > 0;
3701
3768
  const hasError = Boolean(inputError) || Boolean(error);
3702
3769
  const displayHelperText = (error ? errorMessage : undefined) || inputError || helperText || '\u00A0';
@@ -3951,7 +4018,7 @@ const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign =
3951
4018
  };
3952
4019
  return (jsxRuntime.jsx("div", { ref: wrapperRef, id: id, className: clsx(styles$h.datePicker, className), style: { ...containerStyle, ...style }, ...rest, children: jsxRuntime.jsx(Popover, { open: showCalendar, onOpenChange: setShowCalendar, asAnchor: true, trigger: jsxRuntime.jsx(TextField, { className: styles$h.textfieldContainer, type: "tel", icon: jsxRuntime.jsx(reactIcons.Calendar16Regular, { onClick: !disabled ? handleIconClick : undefined, className: clsx(styles$h.datePickerIcon, disabled && styles$h.datePickerIconDisabled) }), onChange: (e) => {
3953
4020
  handleTextFieldChange(String(e));
3954
- }, onKeyDown: handleKeyDown, onFocus: handleFocus, persistIcon: true, autoComplete: "off", value: displayValue, helperText: !externalError ? (helperText || undefined) : undefined, errorMessage: externalError ? combinedHelperText : undefined, error: hasValidationError ? true : undefined, maxLength: 10, required: required, label: label, disabled: disabled, scale: scale, id: fieldId, "data-testid": testId, placeholder: locale === 'en-us' ? 'MM/DD/YYYY' : 'DD/MM/YYYY', "aria-label": "Open calendar", "aria-expanded": showCalendar, "aria-controls": calendarId, "aria-invalid": hasValidationError, "aria-describedby": externalError ? undefined : (helperText ? `${fieldId}-help` : undefined) }), content: jsxRuntime.jsx(Calendar, { selected: currentSelectedDate, currentDate: currentDate, onDateChange: setCurrentDate, onDaySelect: handleDaySelect, locale: locale, format: locale === 'en-us' ? 'mm/dd/yyyy' : 'dd/mm/yyyy', minDate: minDate, maxDate: maxDate, scale: scale, id: calendarId, onClear: () => {
4021
+ }, onKeyDown: handleKeyDown, onFocus: handleFocus, autoComplete: "off", value: displayValue, helperText: !externalError ? (helperText || undefined) : undefined, errorMessage: externalError ? combinedHelperText : undefined, error: hasValidationError ? true : undefined, maxLength: 10, required: required, label: label, disabled: disabled, scale: scale, id: fieldId, "data-testid": testId, placeholder: locale === 'en-us' ? 'MM/DD/YYYY' : 'DD/MM/YYYY', "aria-label": "Open calendar", "aria-expanded": showCalendar, "aria-controls": calendarId, "aria-invalid": hasValidationError, "aria-describedby": externalError ? undefined : (helperText ? `${fieldId}-help` : undefined) }), content: jsxRuntime.jsx(Calendar, { selected: currentSelectedDate, currentDate: currentDate, onDateChange: setCurrentDate, onDaySelect: handleDaySelect, locale: locale, format: locale === 'en-us' ? 'mm/dd/yyyy' : 'dd/mm/yyyy', minDate: minDate, maxDate: maxDate, scale: scale, id: calendarId, onClear: () => {
3955
4022
  handleDateChange(null);
3956
4023
  setCurrentDate(new Date());
3957
4024
  } }), side: calendarSide, align: calendarAlign, sideOffset: 8 }) }));
@@ -3960,7 +4027,7 @@ var DatePicker_default = React.memo(DatePicker);
3960
4027
 
3961
4028
  var styles$g = {"DialogOverlay":"Dialog-module__DialogOverlay___LEX2O","DialogContent":"Dialog-module__DialogContent___ziVXb","DialogTitle":"Dialog-module__DialogTitle___ay1tD","DialogDescription":"Dialog-module__DialogDescription___odslw","DivButtons":"Dialog-module__DivButtons___BiwX-"};
3962
4029
 
3963
- const Dialog = ({ show = false, title, bodyContent, textPrimaryAction, textSecondaryAction, onPrimaryAction, onSecondaryAction, className, ...rest }) => (jsxRuntime.jsx(radixUi.AlertDialog.Root, { open: show, ...rest, children: jsxRuntime.jsxs(radixUi.AlertDialog.Portal, { children: [jsxRuntime.jsx(radixUi.AlertDialog.Overlay, { className: styles$g.DialogOverlay }), jsxRuntime.jsxs(radixUi.AlertDialog.Content, { className: clsx(styles$g.DialogContent, className), children: [jsxRuntime.jsx(radixUi.AlertDialog.Title, { className: styles$g.DialogTitle, children: title }), jsxRuntime.jsx(radixUi.AlertDialog.Description, { className: styles$g.DialogDescription, children: bodyContent }), jsxRuntime.jsxs("div", { className: styles$g.DivButtons, children: [!!(textSecondaryAction && textSecondaryAction.trim()) && (jsxRuntime.jsx(radixUi.AlertDialog.Cancel, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "outlined", ...(onSecondaryAction && { onClick: onSecondaryAction }), children: textSecondaryAction }) })), jsxRuntime.jsx(radixUi.AlertDialog.Action, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "filled", ...(onPrimaryAction && { onClick: onPrimaryAction }), children: textPrimaryAction }) })] })] })] }) }));
4030
+ const Dialog = ({ show = false, title, bodyContent, textPrimaryAction, textSecondaryAction, onPrimaryAction, onSecondaryAction, className, ...rest }) => (jsxRuntime.jsx(radixUi.AlertDialog.Root, { open: show, ...rest, children: jsxRuntime.jsxs(radixUi.AlertDialog.Portal, { children: [jsxRuntime.jsx(radixUi.AlertDialog.Overlay, { className: styles$g.DialogOverlay }), jsxRuntime.jsxs(radixUi.AlertDialog.Content, { className: clsx(styles$g.DialogContent, className), children: [jsxRuntime.jsx(radixUi.AlertDialog.Title, { className: styles$g.DialogTitle, children: title }), jsxRuntime.jsx(radixUi.AlertDialog.Description, { asChild: true, className: styles$g.DialogDescription, children: jsxRuntime.jsx("div", { children: bodyContent }) }), jsxRuntime.jsxs("div", { className: styles$g.DivButtons, children: [!!(textSecondaryAction && textSecondaryAction.trim()) && (jsxRuntime.jsx(radixUi.AlertDialog.Cancel, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "outlined", ...(onSecondaryAction && { onClick: onSecondaryAction }), children: textSecondaryAction }) })), jsxRuntime.jsx(radixUi.AlertDialog.Action, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "filled", ...(onPrimaryAction && { onClick: onPrimaryAction }), children: textPrimaryAction }) })] })] })] }) }));
3964
4031
 
3965
4032
  var styles$f = {"drawerShadow":"Drawer-module__drawerShadow___0Z6iL","drawerShadow--visible":"Drawer-module__drawerShadow--visible___FspoH","drawerSidebar":"Drawer-module__drawerSidebar___cdyyb","drawerSidebar--open":"Drawer-module__drawerSidebar--open___ee2-Y","drawerSidebar--disabled":"Drawer-module__drawerSidebar--disabled___MYrBI","drawerTitleClose":"Drawer-module__drawerTitleClose___QzqN-","drawerTitle":"Drawer-module__drawerTitle___naMX0","drawerChildren":"Drawer-module__drawerChildren___xGdg9","drawerHeaderContent":"Drawer-module__drawerHeaderContent___NLSwj"};
3966
4033
 
@@ -4053,7 +4120,7 @@ const matchesAccept = (file, accept) => {
4053
4120
  return fileType === type;
4054
4121
  });
4055
4122
  };
4056
- const FileUpload = React.forwardRef(({ value, onChange, helperText, error = false, errorMessage, maxFileSize, maxFilesQuantity, disabled = false, className, id, accept, multiple = true, description = 'Clique ou arraste os arquivos aqui', descriptionErrorMessage = 'Falha ao subir um ou mais arquivos.', ...rest }, ref) => {
4123
+ const FileUpload = forwardRef(({ value, onChange, helperText, error = false, errorMessage, maxFileSize, maxFilesQuantity, disabled = false, className, id, accept, multiple = true, description = 'Clique ou arraste os arquivos aqui', descriptionErrorMessage = 'Falha ao subir um ou mais arquivos.', ...rest }, ref) => {
4057
4124
  const generatedId = React.useId();
4058
4125
  const componentId = id || generatedId;
4059
4126
  const helperId = `${componentId}-helper`;
@@ -4215,7 +4282,7 @@ const Combined = ({ buttonText = 'Filtrar', icon, variant = 'outlined', disabled
4215
4282
 
4216
4283
  var styles$c = {"search":"Search-module__search___u3QsV","searchLeftIcon":"Search-module__searchLeftIcon___OKOBq","disabled":"Search-module__disabled___adbxO","inputWithClearIcon":"Search-module__inputWithClearIcon___cqvkq","searchClearIcon":"Search-module__searchClearIcon___qX9-h"};
4217
4284
 
4218
- const Search = React.forwardRef(({ placeholder = 'Dica do que deve ser buscado', disabled = false, value, onChange, onKeyDown, onFocus, onBlur, onClear, onClick, onMouseDown, searchMode = 'instant', onSearch, id, scale = 1, className, style, virtualKeyboard, 'data-testid': testId, ...rest }, ref) => {
4285
+ const Search = forwardRef(({ placeholder = 'Dica do que deve ser buscado', disabled = false, value, onChange, onKeyDown, onFocus, onBlur, onClear, onClick, onMouseDown, searchMode = 'instant', onSearch, id, scale = 1, className, style, virtualKeyboard, 'data-testid': testId, ...rest }, ref) => {
4219
4286
  const [internalValue, setInternalValue] = React.useState('');
4220
4287
  const { internalRef: inputRef, setRefs: setInputRefs } = useInputKeyboardValue(ref);
4221
4288
  const isControlled = value !== undefined && onChange !== undefined;
@@ -4825,9 +4892,9 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
4825
4892
  }, ...rest, children: [search && (jsxRuntime.jsx("div", { className: styles$a.searchWrapper, children: jsxRuntime.jsx(Search, { placeholder: "Buscar", onChange: handleSearchChange, value: searchInput, onKeyDown: handleSearchKeyDown }) })), jsxRuntime.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}`))) : (jsxRuntime.jsx("div", { className: styles$a.emptyState, children: "Nenhum item encontrado" })), enableInfiniteScroll && isLoadingMore && (jsxRuntime.jsx("div", { className: styles$a.loadingMore, children: "Carregando mais itens..." })), enableInfiniteScroll && (jsxRuntime.jsx("div", { ref: sentinelRef, "data-scroll-sentinel": true, style: { height: '1px', visibility: 'hidden' } }))] })] }) })] }));
4826
4893
  };
4827
4894
 
4828
- 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","modalTitle":"Modal-module__modalTitle___9VDmr","modalBody":"Modal-module__modalBody___ohjQm","modalFooter":"Modal-module__modalFooter___TEqdK"};
4895
+ 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"};
4829
4896
 
4830
- const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeOnOverlayClick = true, className, id, footer, customWidth, customHeight, fullscreen = false, ...rest }) => {
4897
+ const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeOnOverlayClick = true, className, id, footer, customWidth, customHeight, closingButton = true, fullscreen = false, ...rest }) => {
4831
4898
  const contentRef = React__namespace.useRef(null);
4832
4899
  const handleOpenChange = (open) => {
4833
4900
  if (!open) {
@@ -4841,7 +4908,7 @@ const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeO
4841
4908
  return (jsxRuntime.jsx(radixUi.Dialog.Root, { open: isOpen, onOpenChange: handleOpenChange, ...rest, children: jsxRuntime.jsxs(radixUi.Dialog.Portal, { children: [jsxRuntime.jsx(radixUi.Dialog.Overlay, { className: styles$9.modalOverlay }), jsxRuntime.jsxs(radixUi.Dialog.Content, { ref: contentRef, className: clsx(styles$9.modalContent, fullscreen && styles$9['modalContent--fullscreen'], className), id: id, style: {
4842
4909
  '--modal-custom-width': customWidth,
4843
4910
  '--modal-custom-height': customHeight,
4844
- }, onInteractOutside: !closeOnOverlayClick ? (e) => e.preventDefault() : undefined, onOpenAutoFocus: handleOpenAutoFocus, "aria-labelledby": id ? `${id}-title` : 'modal-title', tabIndex: -1, children: [jsxRuntime.jsxs("header", { className: styles$9.modalHeader, children: [title && (jsxRuntime.jsx(radixUi.Dialog.Title, { className: styles$9.modalTitle, id: id ? `${id}-title` : 'modal-title', children: title })), headerContent && (jsxRuntime.jsx("div", { children: headerContent })), jsxRuntime.jsx(radixUi.Dialog.Close, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "outlined", iconOnly: true, icon: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}), size: "lg", tooltipText: 'Fechar' }) })] }), jsxRuntime.jsx("section", { className: styles$9.modalBody, children: children }), footer && (jsxRuntime.jsx("footer", { className: styles$9.modalFooter, children: footer }))] })] }) }));
4911
+ }, onInteractOutside: !closeOnOverlayClick ? (e) => e.preventDefault() : undefined, onOpenAutoFocus: handleOpenAutoFocus, "aria-labelledby": id ? `${id}-title` : 'modal-title', tabIndex: -1, children: [(title || headerContent || closingButton) && (jsxRuntime.jsxs("header", { className: styles$9.modalHeader, children: [title && (jsxRuntime.jsx(radixUi.Dialog.Title, { className: styles$9.modalTitle, id: id ? `${id}-title` : 'modal-title', children: title })), headerContent && (jsxRuntime.jsx("div", { children: headerContent })), closingButton && (jsxRuntime.jsx("div", { className: styles$9.modalCloseButton, children: jsxRuntime.jsx(radixUi.Dialog.Close, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "outlined", iconOnly: true, icon: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}), size: "lg", tooltipText: 'Fechar' }) }) }))] })), jsxRuntime.jsx("section", { className: styles$9.modalBody, children: children }), footer && (jsxRuntime.jsx("footer", { className: styles$9.modalFooter, children: footer }))] })] }) }));
4845
4912
  };
4846
4913
 
4847
4914
  var styles$8 = {"quantity":"Quantity-module__quantity___-vndR","quantityInput":"Quantity-module__quantityInput___xZG-v","disabled":"Quantity-module__disabled___X6p5l"};
@@ -5117,7 +5184,7 @@ const ExpandableSelectItem = ({ item, variant, onSelect, selectedValues, level =
5117
5184
  }, role: "button", tabIndex: item.disabled ? -1 : 0, "data-disabled": item.disabled || undefined, "data-selected": isSelected && !hasChildren ? 'true' : undefined, "data-testid": `select-item-${item.value}`, children: [variant === 'icon' && item.icon && (jsxRuntime.jsx("span", { className: styles$6.icon, children: item.icon })), jsxRuntime.jsxs("div", { className: styles$6.textContent, children: [jsxRuntime.jsx("div", { className: styles$6.title, children: item.text }), item.subTitle && jsxRuntime.jsx("div", { className: styles$6.subTitle, children: item.subTitle })] }), hasChildren && (jsxRuntime.jsx("span", { className: styles$6.chevron, children: isExpanded ? jsxRuntime.jsx(reactIcons.ChevronDown16Regular, {}) : jsxRuntime.jsx(reactIcons.ChevronRight16Regular, {}) }))] }) }), hasChildren && isExpanded && (jsxRuntime.jsx("div", { className: styles$6.childrenWrapper, children: item.children.map((child) => (jsxRuntime.jsx(ExpandableSelectItem, { item: child, variant: variant, onSelect: onSelect, selectedValues: selectedValues, level: level + 1 }, child.id || child.value))) }))] }));
5118
5185
  };
5119
5186
 
5120
- const SelectItem = React.forwardRef(({ text, subTitle, icon, disabled, value, variant, disableFocusOnHover, ...restProps }, ref) => {
5187
+ const SelectItem = forwardRef(({ text, subTitle, icon, disabled, value, variant, disableFocusOnHover, ...restProps }, ref) => {
5121
5188
  return (jsxRuntime.jsxs("div", { className: clsx(styles$6.itemWrapper, {
5122
5189
  [styles$6.disabled]: disabled,
5123
5190
  }), "data-disabled": disabled || undefined, "data-testid": `select-item-${value}`, ref: ref, children: [variant === 'icon' && icon && (jsxRuntime.jsx("span", { className: styles$6.icon, children: icon })), jsxRuntime.jsxs(radixUi.Select.Item, { className: clsx(styles$6.item, {
@@ -5359,11 +5426,12 @@ function useSelectLogic({ value, required = false, search = false, onValueChange
5359
5426
  };
5360
5427
  }
5361
5428
 
5362
- 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, isLoadingMore = false, enableApiSearch = false, onApiSearch, isSearching = false, scale = 1, ...rest }) => {
5429
+ 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 }) => {
5363
5430
  const componentId = React.useId();
5364
5431
  const selectId = `select-${componentId}`;
5365
5432
  const viewportRef = React.useRef(null);
5366
5433
  const hasReachedEndRef = React.useRef(false);
5434
+ const wasLoadingMoreRef = React.useRef(false);
5367
5435
  const { state, actions, refs, utils, } = useSelectLogic({
5368
5436
  value,
5369
5437
  required,
@@ -5382,7 +5450,7 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
5382
5450
  const handleScroll = () => {
5383
5451
  const { scrollTop, scrollHeight, clientHeight } = viewport;
5384
5452
  const isAtBottom = scrollTop + clientHeight >= scrollHeight - 1;
5385
- if (isAtBottom && !hasReachedEndRef.current && onScrollEnd && !isLoadingMore) {
5453
+ if (isAtBottom && !hasReachedEndRef.current && onScrollEnd && !isLoadingMore && hasMore) {
5386
5454
  hasReachedEndRef.current = true;
5387
5455
  onScrollEnd();
5388
5456
  }
@@ -5394,17 +5462,38 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
5394
5462
  return () => {
5395
5463
  viewport.removeEventListener('scroll', handleScroll);
5396
5464
  };
5397
- }, [state.isOpen, enableInfiniteScroll, onScrollEnd, isLoadingMore]);
5465
+ }, [state.isOpen, enableInfiniteScroll, onScrollEnd, isLoadingMore, hasMore]);
5398
5466
  React.useEffect(() => {
5399
5467
  if (state.isOpen && enableInfiniteScroll) {
5400
5468
  hasReachedEndRef.current = false;
5401
5469
  }
5402
5470
  }, [state.isOpen, enableInfiniteScroll]);
5471
+ React.useEffect(() => {
5472
+ if (wasLoadingMoreRef.current && !isLoadingMore && enableInfiniteScroll) {
5473
+ hasReachedEndRef.current = false;
5474
+ }
5475
+ wasLoadingMoreRef.current = isLoadingMore;
5476
+ }, [isLoadingMore, enableInfiniteScroll]);
5403
5477
  const displayText = React.useMemo(() => utils.getDisplayText(state.selectedValues, placeholder, variant, items), [state.selectedValues, placeholder, variant, items, utils]);
5404
5478
  const filteredItems = React.useMemo(() => {
5405
5479
  const termToFilter = enableApiSearch ? state.searchTerm : state.searchInput;
5406
5480
  return utils.getFilteredItems(items, termToFilter);
5407
5481
  }, [items, state.searchTerm, state.searchInput, enableApiSearch, utils]);
5482
+ React.useEffect(() => {
5483
+ if (!state.isOpen || !enableInfiniteScroll || !onScrollEnd || isLoadingMore)
5484
+ return;
5485
+ const timer = setTimeout(() => {
5486
+ const viewport = viewportRef.current;
5487
+ if (!viewport)
5488
+ return;
5489
+ const { scrollHeight, clientHeight } = viewport;
5490
+ if (scrollHeight <= clientHeight && !hasReachedEndRef.current && hasMore) {
5491
+ hasReachedEndRef.current = true;
5492
+ onScrollEnd();
5493
+ }
5494
+ }, 150);
5495
+ return () => clearTimeout(timer);
5496
+ }, [state.isOpen, enableInfiniteScroll, onScrollEnd, isLoadingMore, hasMore, filteredItems.length]);
5408
5497
  const containerStyle = React.useMemo(() => ({
5409
5498
  maxWidth: maxWidth ? `${maxWidth}px` : undefined,
5410
5499
  '--giro-scale': scale,
@@ -5472,18 +5561,18 @@ const EmptyState = ({ emptyIcon, emptyTitle, emptyText }) => (jsxRuntime.jsxs("d
5472
5561
 
5473
5562
  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"};
5474
5563
 
5475
- const Toggle = ({ pressed, defaultPressed, onPressedChange, disabled = false, className, children, id, size = 'lg', scale = 1, style, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', icon, iconOnly = false, mode: _mode, selectionType: _type, value: _value, defaultValue: _defaultValue, onValueChange: _onValueChange, orientation: _orientation, items: _items, ...rest }) => {
5564
+ 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 }) => {
5476
5565
  const toggle = (jsxRuntime.jsx(radixUi.Toggle.Root, { pressed: pressed, defaultPressed: defaultPressed, onPressedChange: onPressedChange, disabled: disabled, className: clsx(styles$4.toggle, styles$4[`toggle-${size}`], {
5477
5566
  [styles$4.toggleIconOnly]: iconOnly,
5478
5567
  [styles$4.toggleWithIcon]: !!icon && !iconOnly,
5479
- }, className), id: id, style: { '--giro-scale': scale, ...style }, ...rest, children: iconOnly ? (jsxRuntime.jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: icon })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon && jsxRuntime.jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: icon }), children] })) }));
5568
+ }, className), id: id, style: { '--giro-scale': scale, ...style }, ...rest, children: iconOnly ? (jsxRuntime.jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: icon })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon && jsxRuntime.jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: icon }), label] })) }));
5480
5569
  if (tooltipText) {
5481
5570
  return (jsxRuntime.jsx(Tooltip, { text: tooltipText, side: tooltipSide, align: tooltipAlign, children: toggle }));
5482
5571
  }
5483
5572
  return toggle;
5484
5573
  };
5485
5574
 
5486
- const ToggleGroup = ({ selectionType = 'single', value, defaultValue, onValueChange, orientation = 'horizontal', disabled = false, items = [], children, 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 }) => {
5575
+ 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 }) => {
5487
5576
  const rootProps = selectionType === 'multiple'
5488
5577
  ? {
5489
5578
  type: 'multiple',
@@ -5497,11 +5586,10 @@ const ToggleGroup = ({ selectionType = 'single', value, defaultValue, onValueCha
5497
5586
  defaultValue: defaultValue,
5498
5587
  onValueChange: onValueChange,
5499
5588
  };
5500
- const group = (jsxRuntime.jsx(radixUi.ToggleGroup.Root, { ...rootProps, orientation: orientation, disabled: disabled, className: clsx(styles$4.group, className), id: id, style: { '--giro-scale': scale, ...style }, ...rest, children: children ??
5501
- items.map((item) => (jsxRuntime.jsx(radixUi.ToggleGroup.Item, { value: item.value, disabled: item.disabled, className: clsx(styles$4.item, styles$4[`item-${size}`], {
5502
- [styles$4.toggleIconOnly]: item.iconOnly,
5503
- [styles$4.toggleWithIcon]: !!item.icon && !item.iconOnly,
5504
- }), style: { '--giro-scale': scale }, children: item.iconOnly ? (jsxRuntime.jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: item.icon })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [item.icon && jsxRuntime.jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: item.icon }), item.label] })) }, item.value))) }));
5589
+ const group = (jsxRuntime.jsx(radixUi.ToggleGroup.Root, { ...rootProps, disabled: disabled, className: clsx(styles$4.group, className), id: id, style: { '--giro-scale': scale, ...style }, ...rest, children: items.map((item) => (jsxRuntime.jsx(radixUi.ToggleGroup.Item, { value: item.value, disabled: item.disabled, className: clsx(styles$4.item, styles$4[`item-${size}`], {
5590
+ [styles$4.toggleIconOnly]: item.iconOnly,
5591
+ [styles$4.toggleWithIcon]: !!item.icon && !item.iconOnly,
5592
+ }), style: { '--giro-scale': scale }, children: item.iconOnly ? (jsxRuntime.jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: item.icon })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [item.icon && jsxRuntime.jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: item.icon }), item.label] })) }, item.value))) }));
5505
5593
  if (tooltipText) {
5506
5594
  return (jsxRuntime.jsx(Tooltip, { text: tooltipText, side: tooltipSide, align: tooltipAlign, children: group }));
5507
5595
  }
@@ -5718,7 +5806,7 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
5718
5806
 
5719
5807
  var styles$3 = {"container":"TextArea-module__container___WEBC-","inputWrapper":"TextArea-module__inputWrapper___-omPx","inputContainer":"TextArea-module__inputContainer___0-jKY","footer":"TextArea-module__footer___7XMlj","helperText":"TextArea-module__helperText___709rD","charCount":"TextArea-module__charCount___zdbxM","error":"TextArea-module__error___DWDms","disabled":"TextArea-module__disabled___lHxCa"};
5720
5808
 
5721
- const TextArea = React.forwardRef(({ className, value, label, placeholder, onChange, disabled = false, maxLength, required = false, helperText, tooltipText, tooltipSide = 'bottom', tooltipAlign = 'start', errorMessage, error, id, onBlur, onFocus, name, resize = 'vertical', charCount = false, height, virtualKeyboard, ...rest }, ref) => {
5809
+ const TextArea = forwardRef(({ className, value, label, placeholder, onChange, disabled = false, maxLength, required = false, helperText, tooltipText, tooltipSide = 'bottom', tooltipAlign = 'start', errorMessage, error, id, onBlur, onFocus, name, resize = 'vertical', charCount = false, height, virtualKeyboard, ...rest }, ref) => {
5722
5810
  const normalizeValue = (val) => {
5723
5811
  return val === undefined || val === null ? '' : String(val);
5724
5812
  };
@@ -5867,13 +5955,19 @@ const useToast = () => {
5867
5955
  const Toast = ({ id, title, duration = 5000, icon, iconClosed = jsxRuntime.jsx(reactIcons.Dismiss16Filled, {}), automaticClose = true, iconType = "Info", className, ...rest }) => {
5868
5956
  const [open, setOpen] = React__namespace.useState(false);
5869
5957
  const { dismissToast } = useToastContext();
5958
+ const dismissTimerRef = React__namespace.useRef(null);
5870
5959
  React__namespace.useEffect(() => {
5871
5960
  setOpen(true);
5961
+ return () => {
5962
+ if (dismissTimerRef.current !== null) {
5963
+ clearTimeout(dismissTimerRef.current);
5964
+ }
5965
+ };
5872
5966
  }, []);
5873
5967
  const handleOpenChange = (isOpen) => {
5874
5968
  setOpen(isOpen);
5875
5969
  if (!isOpen && id) {
5876
- setTimeout(() => dismissToast(id), 200);
5970
+ dismissTimerRef.current = setTimeout(() => dismissToast(id), 200);
5877
5971
  }
5878
5972
  };
5879
5973
  let displayIcon = icon;
@@ -6299,6 +6393,39 @@ exports.Dialog = Dialog;
6299
6393
  exports.Drawer = Drawer;
6300
6394
  exports.FileUpload = FileUpload;
6301
6395
  exports.Filter = Filter;
6396
+ exports.G_Avatar = Avatar;
6397
+ exports.G_Badge = Badge;
6398
+ exports.G_Button = Button;
6399
+ exports.G_Calendar = Calendar;
6400
+ exports.G_Callout = Callout;
6401
+ exports.G_Card = Card;
6402
+ exports.G_Checkbox = Checkbox;
6403
+ exports.G_Chips = MemoizedChips;
6404
+ exports.G_Container = Container;
6405
+ exports.G_DatePicker = DatePicker_default;
6406
+ exports.G_Dialog = Dialog;
6407
+ exports.G_Drawer = Drawer;
6408
+ exports.G_FileUpload = FileUpload;
6409
+ exports.G_Filter = Filter;
6410
+ exports.G_ListItem = ListItem;
6411
+ exports.G_Menu = Menu;
6412
+ exports.G_Modal = Modal;
6413
+ exports.G_Popover = Popover;
6414
+ exports.G_Quantity = memorizedQuantity;
6415
+ exports.G_Radio = Radio;
6416
+ exports.G_Search = Search;
6417
+ exports.G_Select = Select;
6418
+ exports.G_Switch = Switch;
6419
+ exports.G_TableV2 = TableV2;
6420
+ exports.G_TextArea = TextArea_default;
6421
+ exports.G_TextField = TextField;
6422
+ exports.G_Toast = Toast;
6423
+ exports.G_ToastContainer = ToastContainer;
6424
+ exports.G_ToastProvider = ToastProvider;
6425
+ exports.G_ToggleButton = ToggleButton;
6426
+ exports.G_Tooltip = Tooltip;
6427
+ exports.G_VerificationCode = VerificationCode;
6428
+ exports.G_VirtualKeyboard = VirtualKeyboard;
6302
6429
  exports.ListItem = ListItem;
6303
6430
  exports.Menu = Menu;
6304
6431
  exports.Modal = Modal;