@octavius2929-personal/design-system 1.4.0 → 1.4.1

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.cts CHANGED
@@ -1816,7 +1816,7 @@ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "on
1816
1816
  testId?: string;
1817
1817
  }
1818
1818
 
1819
- declare const TextField: react.ForwardRefExoticComponent<TextFieldProps & react.RefAttributes<HTMLInputElement>>;
1819
+ declare const TextField: react.ForwardRefExoticComponent<TextFieldProps & react.RefAttributes<HTMLTextAreaElement | HTMLInputElement>>;
1820
1820
 
1821
1821
  interface PasswordFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "onChange"> {
1822
1822
  label?: ReactNode;
@@ -2028,7 +2028,7 @@ interface DialogProps {
2028
2028
 
2029
2029
  declare const Dialog: react.ForwardRefExoticComponent<DialogProps & react.RefAttributes<HTMLDivElement>>;
2030
2030
 
2031
- interface SnackbarProps {
2031
+ interface SnackbarProps extends Omit<HTMLAttributes<HTMLDivElement>, "className" | "style"> {
2032
2032
  open: boolean;
2033
2033
  message: ReactNode;
2034
2034
  action?: ReactNode;
package/dist/index.d.ts CHANGED
@@ -1816,7 +1816,7 @@ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "on
1816
1816
  testId?: string;
1817
1817
  }
1818
1818
 
1819
- declare const TextField: react.ForwardRefExoticComponent<TextFieldProps & react.RefAttributes<HTMLInputElement>>;
1819
+ declare const TextField: react.ForwardRefExoticComponent<TextFieldProps & react.RefAttributes<HTMLTextAreaElement | HTMLInputElement>>;
1820
1820
 
1821
1821
  interface PasswordFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "onChange"> {
1822
1822
  label?: ReactNode;
@@ -2028,7 +2028,7 @@ interface DialogProps {
2028
2028
 
2029
2029
  declare const Dialog: react.ForwardRefExoticComponent<DialogProps & react.RefAttributes<HTMLDivElement>>;
2030
2030
 
2031
- interface SnackbarProps {
2031
+ interface SnackbarProps extends Omit<HTMLAttributes<HTMLDivElement>, "className" | "style"> {
2032
2032
  open: boolean;
2033
2033
  message: ReactNode;
2034
2034
  action?: ReactNode;
package/dist/index.js CHANGED
@@ -1403,7 +1403,11 @@ var Switch = forwardRef13(function Switch2({ checked = false, onChange, label: l
1403
1403
  });
1404
1404
 
1405
1405
  // src/components/text-field/index.tsx
1406
- import { forwardRef as forwardRef15 } from "react";
1406
+ import {
1407
+ forwardRef as forwardRef15,
1408
+ useImperativeHandle,
1409
+ useRef as useRef3
1410
+ } from "react";
1407
1411
 
1408
1412
  // src/components/base-field/index.tsx
1409
1413
  import { forwardRef as forwardRef14, useId as useId2 } from "react";
@@ -1498,59 +1502,64 @@ var BaseField = forwardRef14(function BaseField2({ label: label8, help, error, s
1498
1502
 
1499
1503
  // src/components/text-field/index.tsx
1500
1504
  import { jsx as jsx19 } from "react/jsx-runtime";
1501
- var TextField = forwardRef15(function TextField2({
1502
- label: label8,
1503
- help,
1504
- error,
1505
- startIcon,
1506
- multiline,
1507
- rows,
1508
- type = "text",
1509
- onChange,
1510
- className,
1511
- id,
1512
- testId,
1513
- ...rest
1514
- }, ref) {
1515
- const rawTestId = rest["data-testid"];
1516
- return /* @__PURE__ */ jsx19(
1517
- BaseField,
1518
- {
1505
+ var TextField = forwardRef15(
1506
+ function TextField2({
1507
+ label: label8,
1508
+ help,
1509
+ error,
1510
+ startIcon,
1511
+ multiline,
1512
+ rows,
1513
+ type = "text",
1514
+ onChange,
1515
+ className,
1516
+ id,
1517
+ testId,
1518
+ ...rest
1519
+ }, ref) {
1520
+ const inputRef = useRef3(null);
1521
+ const textareaRef = useRef3(null);
1522
+ useImperativeHandle(
1519
1523
  ref,
1520
- label: label8,
1521
- help,
1522
- error,
1523
- startIcon,
1524
- id,
1525
- className,
1526
- testId,
1527
- children: ({ ref: controlRef, ...control }) => multiline ? (
1528
- // En multiline el control es un <textarea>: no reenviamos `controlRef` porque el
1529
- // tipo público de la ref es HTMLInputElement (la ref aplica solo a la rama <input>).
1530
- /* @__PURE__ */ jsx19(
1524
+ () => multiline ? textareaRef.current : inputRef.current,
1525
+ [multiline]
1526
+ );
1527
+ const rawTestId = rest["data-testid"];
1528
+ return /* @__PURE__ */ jsx19(
1529
+ BaseField,
1530
+ {
1531
+ label: label8,
1532
+ help,
1533
+ error,
1534
+ startIcon,
1535
+ id,
1536
+ className,
1537
+ testId,
1538
+ children: (control) => multiline ? /* @__PURE__ */ jsx19(
1531
1539
  "textarea",
1532
1540
  {
1533
1541
  ...rest,
1534
1542
  ...control,
1535
1543
  "data-testid": rawTestId ?? control["data-testid"],
1544
+ ref: textareaRef,
1536
1545
  rows: rows ?? 4,
1537
1546
  onChange: (e) => onChange?.(e.target.value)
1538
1547
  }
1548
+ ) : /* @__PURE__ */ jsx19(
1549
+ "input",
1550
+ {
1551
+ ...rest,
1552
+ ...control,
1553
+ "data-testid": rawTestId ?? control["data-testid"],
1554
+ ref: inputRef,
1555
+ type,
1556
+ onChange: (e) => onChange?.(e.target.value)
1557
+ }
1539
1558
  )
1540
- ) : /* @__PURE__ */ jsx19(
1541
- "input",
1542
- {
1543
- ...rest,
1544
- ...control,
1545
- "data-testid": rawTestId ?? control["data-testid"],
1546
- ref: controlRef,
1547
- type,
1548
- onChange: (e) => onChange?.(e.target.value)
1549
- }
1550
- )
1551
- }
1552
- );
1553
- });
1559
+ }
1560
+ );
1561
+ }
1562
+ );
1554
1563
 
1555
1564
  // src/components/password-field/index.tsx
1556
1565
  import { forwardRef as forwardRef16, useState as useState3 } from "react";
@@ -2010,7 +2019,7 @@ import {
2010
2019
  forwardRef as forwardRef21,
2011
2020
  useEffect as useEffect4,
2012
2021
  useId as useId3,
2013
- useRef as useRef3,
2022
+ useRef as useRef4,
2014
2023
  useState as useState5
2015
2024
  } from "react";
2016
2025
 
@@ -2046,7 +2055,7 @@ var Tooltip = forwardRef21(function Tooltip2({ label: label8, children, placemen
2046
2055
  const tooltipId = useId3();
2047
2056
  const { wrapper: wrapper4, bubble: bubble2 } = useStyles19({ placement: placement2 });
2048
2057
  const { testId: dataTestId, slot } = useTestId("feedback", testId);
2049
- const hideTimer = useRef3(null);
2058
+ const hideTimer = useRef4(null);
2050
2059
  const clearHide = () => {
2051
2060
  if (hideTimer.current) {
2052
2061
  clearTimeout(hideTimer.current);
@@ -2110,7 +2119,7 @@ var Tooltip = forwardRef21(function Tooltip2({ label: label8, children, placemen
2110
2119
  });
2111
2120
 
2112
2121
  // src/components/select/index.tsx
2113
- import { forwardRef as forwardRef22, useEffect as useEffect5, useId as useId4, useRef as useRef4, useState as useState6 } from "react";
2122
+ import { forwardRef as forwardRef22, useEffect as useEffect5, useId as useId4, useRef as useRef5, useState as useState6 } from "react";
2114
2123
 
2115
2124
  // src/components/icons/chevron-down/index.tsx
2116
2125
  import { jsx as jsx32 } from "react/jsx-runtime";
@@ -2183,7 +2192,7 @@ var Select = forwardRef22(function Select2({
2183
2192
  }, ref) {
2184
2193
  const [open, setOpen] = useState6(false);
2185
2194
  const [activeIndex, setActiveIndex] = useState6(0);
2186
- const rootRef = useRef4(null);
2195
+ const rootRef = useRef5(null);
2187
2196
  const setRootRef = (node) => {
2188
2197
  rootRef.current = node;
2189
2198
  if (typeof ref === "function") ref(node);
@@ -2710,7 +2719,7 @@ var Stepper = forwardRef27(function Stepper2({ steps, active: active2 = 0, class
2710
2719
  });
2711
2720
 
2712
2721
  // src/components/tabs/index.tsx
2713
- import { forwardRef as forwardRef28, useId as useId5, useRef as useRef5 } from "react";
2722
+ import { forwardRef as forwardRef28, useId as useId5, useRef as useRef6 } from "react";
2714
2723
 
2715
2724
  // src/components/tabs/use-styles.ts
2716
2725
  import { useMemo as useMemo30 } from "react";
@@ -2738,7 +2747,7 @@ var Tabs = forwardRef28(function Tabs2({ items, value, onChange, testId, ...rest
2738
2747
  const { root: root25, tabClass, panel: panel3 } = useStyles26();
2739
2748
  const { testId: dataTestId, slot } = useTestId("nav", testId);
2740
2749
  const baseId = useId5();
2741
- const tabRefs = useRef5([]);
2750
+ const tabRefs = useRef6([]);
2742
2751
  const hasPanels = items.some((item3) => item3.content !== void 0);
2743
2752
  const activeIndex = items.findIndex((item3) => item3.value === value);
2744
2753
  const tabId = (v) => `${baseId}-tab-${v}`;
@@ -2823,7 +2832,7 @@ import {
2823
2832
  forwardRef as forwardRef29,
2824
2833
  useEffect as useEffect6,
2825
2834
  useLayoutEffect,
2826
- useRef as useRef6,
2835
+ useRef as useRef7,
2827
2836
  useState as useState8
2828
2837
  } from "react";
2829
2838
 
@@ -2862,13 +2871,13 @@ var Menu = forwardRef29(function Menu2({ trigger: trigger2, items, testId }, ref
2862
2871
  const { testId: rootTestId, slot } = useTestId("menu", testId);
2863
2872
  const [open, setOpen] = useState8(false);
2864
2873
  const [alignEnd, setAlignEnd] = useState8(false);
2865
- const rootRef = useRef6(null);
2874
+ const rootRef = useRef7(null);
2866
2875
  const setRootRef = (node) => {
2867
2876
  rootRef.current = node;
2868
2877
  assignRef(ref, node);
2869
2878
  };
2870
- const listRef = useRef6(null);
2871
- const triggerRef = useRef6(null);
2879
+ const listRef = useRef7(null);
2880
+ const triggerRef = useRef7(null);
2872
2881
  const getMenuItems = () => Array.from(listRef.current?.querySelectorAll('[role="menuitem"]') ?? []);
2873
2882
  const focusItemAt = (index) => {
2874
2883
  const menuItems = getMenuItems();
@@ -3009,7 +3018,7 @@ import {
3009
3018
  forwardRef as forwardRef30,
3010
3019
  useEffect as useEffect7,
3011
3020
  useId as useId6,
3012
- useRef as useRef7
3021
+ useRef as useRef8
3013
3022
  } from "react";
3014
3023
  import { createPortal } from "react-dom";
3015
3024
 
@@ -3046,12 +3055,12 @@ function assignRef2(ref, value) {
3046
3055
  var Dialog = forwardRef30(function Dialog2({ open, onClose, title, actions: actions3, children, testId }, ref) {
3047
3056
  const { overlay: overlay2, surface: surface3, body: body3, actions: actionsClass } = useStyles28();
3048
3057
  const { testId: rootTestId, slot } = useTestId("dialog", testId);
3049
- const surfaceRef = useRef7(null);
3058
+ const surfaceRef = useRef8(null);
3050
3059
  const setSurfaceRef = (node) => {
3051
3060
  surfaceRef.current = node;
3052
3061
  assignRef2(ref, node);
3053
3062
  };
3054
- const previouslyFocused = useRef7(null);
3063
+ const previouslyFocused = useRef8(null);
3055
3064
  const generatedId = useId6();
3056
3065
  const titleId = title != null ? generatedId : void 0;
3057
3066
  useEffect7(() => {
@@ -3130,7 +3139,12 @@ var Dialog = forwardRef30(function Dialog2({ open, onClose, title, actions: acti
3130
3139
  });
3131
3140
 
3132
3141
  // src/components/snackbar/index.tsx
3133
- import { forwardRef as forwardRef31, useCallback as useCallback2, useEffect as useEffect8, useRef as useRef8 } from "react";
3142
+ import {
3143
+ forwardRef as forwardRef31,
3144
+ useCallback as useCallback2,
3145
+ useEffect as useEffect8,
3146
+ useRef as useRef9
3147
+ } from "react";
3134
3148
  import { createPortal as createPortal2 } from "react-dom";
3135
3149
 
3136
3150
  // src/components/snackbar/use-styles.ts
@@ -3157,15 +3171,27 @@ function useStyles29() {
3157
3171
  // src/components/snackbar/index.tsx
3158
3172
  import { jsx as jsx44, jsxs as jsxs28 } from "react/jsx-runtime";
3159
3173
  var DEFAULT_DURATION = 5e3;
3160
- var Snackbar = forwardRef31(function Snackbar2({ open, message: message2, action, onClose, duration = DEFAULT_DURATION, testId }, ref) {
3174
+ var Snackbar = forwardRef31(function Snackbar2({
3175
+ open,
3176
+ message: message2,
3177
+ action,
3178
+ onClose,
3179
+ duration = DEFAULT_DURATION,
3180
+ testId,
3181
+ onMouseEnter,
3182
+ onMouseLeave,
3183
+ onFocus,
3184
+ onBlur,
3185
+ ...rest
3186
+ }, ref) {
3161
3187
  const { root: root25, message: messageClass, closeBtn: closeBtn2 } = useStyles29();
3162
3188
  const { testId: dataTestId, slot } = useTestId("feedback", testId);
3163
- const onCloseRef = useRef8(onClose);
3189
+ const onCloseRef = useRef9(onClose);
3164
3190
  useEffect8(() => {
3165
3191
  onCloseRef.current = onClose;
3166
3192
  }, [onClose]);
3167
- const interactingRef = useRef8({ hover: false, focus: false });
3168
- const timeoutRef = useRef8();
3193
+ const interactingRef = useRef9({ hover: false, focus: false });
3194
+ const timeoutRef = useRef9();
3169
3195
  const clearTimer = useCallback2(() => {
3170
3196
  if (timeoutRef.current !== void 0) {
3171
3197
  clearTimeout(timeoutRef.current);
@@ -3184,21 +3210,25 @@ var Snackbar = forwardRef31(function Snackbar2({ open, message: message2, action
3184
3210
  scheduleTimer();
3185
3211
  return clearTimer;
3186
3212
  }, [scheduleTimer, clearTimer]);
3187
- const handleMouseEnter = () => {
3213
+ const handleMouseEnter = (event) => {
3188
3214
  interactingRef.current.hover = true;
3189
3215
  clearTimer();
3216
+ onMouseEnter?.(event);
3190
3217
  };
3191
- const handleMouseLeave = () => {
3218
+ const handleMouseLeave = (event) => {
3192
3219
  interactingRef.current.hover = false;
3193
3220
  scheduleTimer();
3221
+ onMouseLeave?.(event);
3194
3222
  };
3195
- const handleFocus = () => {
3223
+ const handleFocus = (event) => {
3196
3224
  interactingRef.current.focus = true;
3197
3225
  clearTimer();
3226
+ onFocus?.(event);
3198
3227
  };
3199
- const handleBlur = () => {
3228
+ const handleBlur = (event) => {
3200
3229
  interactingRef.current.focus = false;
3201
3230
  scheduleTimer();
3231
+ onBlur?.(event);
3202
3232
  };
3203
3233
  if (!open || typeof document === "undefined") return null;
3204
3234
  return createPortal2(
@@ -3207,12 +3237,13 @@ var Snackbar = forwardRef31(function Snackbar2({ open, message: message2, action
3207
3237
  {
3208
3238
  ref,
3209
3239
  role: "status",
3210
- className: root25,
3211
3240
  "data-testid": dataTestId,
3212
3241
  onMouseEnter: handleMouseEnter,
3213
3242
  onMouseLeave: handleMouseLeave,
3214
3243
  onFocus: handleFocus,
3215
3244
  onBlur: handleBlur,
3245
+ ...rest,
3246
+ className: root25,
3216
3247
  children: [
3217
3248
  /* @__PURE__ */ jsx44("span", { className: messageClass, "data-testid": slot("message"), children: message2 }),
3218
3249
  action,