@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.cjs CHANGED
@@ -1678,60 +1678,65 @@ var BaseField = (0, import_react33.forwardRef)(function BaseField2({ label: labe
1678
1678
  });
1679
1679
 
1680
1680
  // src/components/text-field/index.tsx
1681
- var import_jsx_runtime19 = (
1682
- // En multiline el control es un <textarea>: no reenviamos `controlRef` porque el
1683
- // tipo público de la ref es HTMLInputElement (la ref aplica solo a la rama <input>).
1684
- require("react/jsx-runtime")
1685
- );
1686
- var TextField = (0, import_react34.forwardRef)(function TextField2({
1687
- label: label8,
1688
- help,
1689
- error,
1690
- startIcon,
1691
- multiline,
1692
- rows,
1693
- type = "text",
1694
- onChange,
1695
- className,
1696
- id,
1697
- testId,
1698
- ...rest
1699
- }, ref) {
1700
- const rawTestId = rest["data-testid"];
1701
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1702
- BaseField,
1703
- {
1681
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1682
+ var TextField = (0, import_react34.forwardRef)(
1683
+ function TextField2({
1684
+ label: label8,
1685
+ help,
1686
+ error,
1687
+ startIcon,
1688
+ multiline,
1689
+ rows,
1690
+ type = "text",
1691
+ onChange,
1692
+ className,
1693
+ id,
1694
+ testId,
1695
+ ...rest
1696
+ }, ref) {
1697
+ const inputRef = (0, import_react34.useRef)(null);
1698
+ const textareaRef = (0, import_react34.useRef)(null);
1699
+ (0, import_react34.useImperativeHandle)(
1704
1700
  ref,
1705
- label: label8,
1706
- help,
1707
- error,
1708
- startIcon,
1709
- id,
1710
- className,
1711
- testId,
1712
- children: ({ ref: controlRef, ...control }) => multiline ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1713
- "textarea",
1714
- {
1715
- ...rest,
1716
- ...control,
1717
- "data-testid": rawTestId ?? control["data-testid"],
1718
- rows: rows ?? 4,
1719
- onChange: (e) => onChange?.(e.target.value)
1720
- }
1721
- ) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1722
- "input",
1723
- {
1724
- ...rest,
1725
- ...control,
1726
- "data-testid": rawTestId ?? control["data-testid"],
1727
- ref: controlRef,
1728
- type,
1729
- onChange: (e) => onChange?.(e.target.value)
1730
- }
1731
- )
1732
- }
1733
- );
1734
- });
1701
+ () => multiline ? textareaRef.current : inputRef.current,
1702
+ [multiline]
1703
+ );
1704
+ const rawTestId = rest["data-testid"];
1705
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1706
+ BaseField,
1707
+ {
1708
+ label: label8,
1709
+ help,
1710
+ error,
1711
+ startIcon,
1712
+ id,
1713
+ className,
1714
+ testId,
1715
+ children: (control) => multiline ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1716
+ "textarea",
1717
+ {
1718
+ ...rest,
1719
+ ...control,
1720
+ "data-testid": rawTestId ?? control["data-testid"],
1721
+ ref: textareaRef,
1722
+ rows: rows ?? 4,
1723
+ onChange: (e) => onChange?.(e.target.value)
1724
+ }
1725
+ ) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1726
+ "input",
1727
+ {
1728
+ ...rest,
1729
+ ...control,
1730
+ "data-testid": rawTestId ?? control["data-testid"],
1731
+ ref: inputRef,
1732
+ type,
1733
+ onChange: (e) => onChange?.(e.target.value)
1734
+ }
1735
+ )
1736
+ }
1737
+ );
1738
+ }
1739
+ );
1735
1740
 
1736
1741
  // src/components/password-field/index.tsx
1737
1742
  var import_react36 = require("react");
@@ -3319,7 +3324,19 @@ function useStyles29() {
3319
3324
  // src/components/snackbar/index.tsx
3320
3325
  var import_jsx_runtime44 = require("react/jsx-runtime");
3321
3326
  var DEFAULT_DURATION = 5e3;
3322
- var Snackbar = (0, import_react65.forwardRef)(function Snackbar2({ open, message: message2, action, onClose, duration = DEFAULT_DURATION, testId }, ref) {
3327
+ var Snackbar = (0, import_react65.forwardRef)(function Snackbar2({
3328
+ open,
3329
+ message: message2,
3330
+ action,
3331
+ onClose,
3332
+ duration = DEFAULT_DURATION,
3333
+ testId,
3334
+ onMouseEnter,
3335
+ onMouseLeave,
3336
+ onFocus,
3337
+ onBlur,
3338
+ ...rest
3339
+ }, ref) {
3323
3340
  const { root: root25, message: messageClass, closeBtn: closeBtn2 } = useStyles29();
3324
3341
  const { testId: dataTestId, slot } = useTestId("feedback", testId);
3325
3342
  const onCloseRef = (0, import_react65.useRef)(onClose);
@@ -3346,21 +3363,25 @@ var Snackbar = (0, import_react65.forwardRef)(function Snackbar2({ open, message
3346
3363
  scheduleTimer();
3347
3364
  return clearTimer;
3348
3365
  }, [scheduleTimer, clearTimer]);
3349
- const handleMouseEnter = () => {
3366
+ const handleMouseEnter = (event) => {
3350
3367
  interactingRef.current.hover = true;
3351
3368
  clearTimer();
3369
+ onMouseEnter?.(event);
3352
3370
  };
3353
- const handleMouseLeave = () => {
3371
+ const handleMouseLeave = (event) => {
3354
3372
  interactingRef.current.hover = false;
3355
3373
  scheduleTimer();
3374
+ onMouseLeave?.(event);
3356
3375
  };
3357
- const handleFocus = () => {
3376
+ const handleFocus = (event) => {
3358
3377
  interactingRef.current.focus = true;
3359
3378
  clearTimer();
3379
+ onFocus?.(event);
3360
3380
  };
3361
- const handleBlur = () => {
3381
+ const handleBlur = (event) => {
3362
3382
  interactingRef.current.focus = false;
3363
3383
  scheduleTimer();
3384
+ onBlur?.(event);
3364
3385
  };
3365
3386
  if (!open || typeof document === "undefined") return null;
3366
3387
  return (0, import_react_dom2.createPortal)(
@@ -3369,12 +3390,13 @@ var Snackbar = (0, import_react65.forwardRef)(function Snackbar2({ open, message
3369
3390
  {
3370
3391
  ref,
3371
3392
  role: "status",
3372
- className: root25,
3373
3393
  "data-testid": dataTestId,
3374
3394
  onMouseEnter: handleMouseEnter,
3375
3395
  onMouseLeave: handleMouseLeave,
3376
3396
  onFocus: handleFocus,
3377
3397
  onBlur: handleBlur,
3398
+ ...rest,
3399
+ className: root25,
3378
3400
  children: [
3379
3401
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: messageClass, "data-testid": slot("message"), children: message2 }),
3380
3402
  action,