@rubenpazch/drawer 4.1.0 → 4.2.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/README.md CHANGED
@@ -1,3 +1,38 @@
1
1
  # Drawer
2
2
 
3
3
  Generated component package.
4
+
5
+ <!-- catalogo:inicio (generado por pnpm catalogo, no editar) -->
6
+
7
+ Panel lateral (izquierda/derecha/arriba/abajo) con animación y fondo.
8
+
9
+ - **Usar cuando:** Menús laterales, filtros o formularios de edición que no requieren cambiar de página.
10
+ - **Evitar cuando:** Confirmaciones breves: usa ConfirmationDialog.
11
+
12
+ Se recomienda instalar el paquete completo `@rubenpazch/ui` (incluye este). Por separado:
13
+
14
+ ```bash
15
+ npm install @rubenpazch/drawer
16
+ ```
17
+
18
+ ## Drawer
19
+
20
+ | Prop | Tipo | Req. | Por defecto | Descripción |
21
+ | --------------------- | -------------------------------------------------- | ---- | --------------- | --------------------------------------------------------------------------------------- |
22
+ | `children` | `ReactNode` | sí | | Content to render in the drawer |
23
+ | `isOpen` | `boolean` | sí | | Whether the drawer is open |
24
+ | `onClose` | `() => void` | sí | | Function to close the drawer |
25
+ | `className` | `string` | | `` | Custom className for the drawer content |
26
+ | `closeLabel` | `string` | | `Cerrar` | Texto accesible del botón de cerrar. |
27
+ | `closeOnEscape` | `boolean` | | `true` | Whether pressing Escape closes the drawer |
28
+ | `closeOnOverlayClick` | `boolean` | | `true` | Whether clicking overlay closes the drawer |
29
+ | `contentContained` | `boolean` | | `false` | Whether the content (header, body, footer) should be contained in a max-width container |
30
+ | `footer` | `ReactNode` | | | Footer content (typically action buttons) |
31
+ | `footerAlign` | `"left" \| "right" \| "center" \| "space-between"` | | `right` | Footer alignment |
32
+ | `headerAlign` | `"left" \| "right" \| "center" \| "space-between"` | | `space-between` | Header alignment (how to position title and close button) |
33
+ | `position` | `"left" \| "right" \| "top" \| "bottom"` | | `right` | Position from which the drawer slides in |
34
+ | `showOverlay` | `boolean` | | `true` | Whether to show overlay backdrop |
35
+ | `size` | `"sm" \| "md" \| "lg" \| "xl" \| "full"` | | `md` | Size of the drawer |
36
+ | `title` | `string` | | | Title displayed in the drawer header |
37
+
38
+ <!-- catalogo:fin -->
package/dist/Drawer.d.ts CHANGED
@@ -21,6 +21,8 @@ export interface DrawerProps {
21
21
  closeOnOverlayClick?: boolean;
22
22
  /** Whether pressing Escape closes the drawer */
23
23
  closeOnEscape?: boolean;
24
+ /** Texto accesible del botón de cerrar. */
25
+ closeLabel?: string;
24
26
  /** Custom className for the drawer content */
25
27
  className?: string;
26
28
  /** Footer content (typically action buttons) */
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../src/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAO3D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;AACjE,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAC5D,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,eAAe,CAAC;AAExE,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,mCAAmC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,yBAAyB;IACzB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iDAAiD;IACjD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gDAAgD;IAChD,aAAa,CAAC,EAAE,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AAO,CAAC;IACxB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,gEAAgE;IAChE,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,uBAAuB;IACvB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,8FAA8F;IAC9F,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAkNjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -457,7 +457,7 @@ var styles = {"root":"Drawer-module_root__9H22a","overlay":"Drawer-module_overla
457
457
  styleInject(css_248z);
458
458
 
459
459
  const classNames = (...classes) => classes.filter(Boolean).join(" ");
460
- const Drawer = ({ isOpen, onClose, position = "right", size = "md", title, children, showOverlay = true, closeOnOverlayClick = true, closeOnEscape = true, className = "", footer, headerAlign = "space-between", footerAlign = "right", contentContained = false, }) => {
460
+ const Drawer = ({ isOpen, onClose, position = "right", size = "md", title, children, showOverlay = true, closeOnOverlayClick = true, closeOnEscape = true, closeLabel = "Cerrar", className = "", footer, headerAlign = "space-between", footerAlign = "right", contentContained = false, }) => {
461
461
  const drawerRef = require$$0.useRef(null);
462
462
  const [isAnimating, setIsAnimating] = require$$0.useState(false);
463
463
  const [shouldRender, setShouldRender] = require$$0.useState(isOpen);
@@ -565,7 +565,7 @@ const Drawer = ({ isOpen, onClose, position = "right", size = "md", title, child
565
565
  right: styles.footerEnd,
566
566
  "space-between": styles.footerSpaceBetween,
567
567
  }[footerAlign];
568
- return (jsxRuntimeExports.jsxs("div", { className: styles.root, role: "dialog", "aria-modal": "true", "aria-labelledby": title ? "drawer-title" : undefined, children: [showOverlay && (jsxRuntimeExports.jsx("div", { className: classNames(styles.overlay, isAnimating ? styles.overlayVisible : styles.overlayHidden), "data-testid": "drawer-overlay", onClick: handleOverlayClick, "aria-hidden": "true" })), jsxRuntimeExports.jsxs("div", { ref: drawerRef, tabIndex: -1, className: getPositionClasses(), "data-position": position, "data-size": size, children: [title && (jsxRuntimeExports.jsx("div", { className: classNames(styles.header, headerAlign === "center" && styles.headerCenter), children: jsxRuntimeExports.jsxs("div", { className: styles.headerContent, children: [jsxRuntimeExports.jsx("h2", { id: "drawer-title", className: styles.title, children: title }), jsxRuntimeExports.jsx("button", { onClick: onClose, className: styles.closeButton, "aria-label": "Close drawer", children: jsxRuntimeExports.jsx(icons.CloseIcon, { size: "md" }) })] }) })), jsxRuntimeExports.jsx("div", { className: styles.body, children: contentContained ? (jsxRuntimeExports.jsx("div", { className: styles.contained, children: children })) : (children) }), footer && (jsxRuntimeExports.jsx("div", { className: classNames(styles.footer, footerAlignClass), children: contentContained ? (jsxRuntimeExports.jsx("div", { className: styles.contained, children: footer })) : (footer) }))] })] }));
568
+ return (jsxRuntimeExports.jsxs("div", { className: styles.root, role: "dialog", "aria-modal": "true", "aria-labelledby": title ? "drawer-title" : undefined, children: [showOverlay && (jsxRuntimeExports.jsx("div", { className: classNames(styles.overlay, isAnimating ? styles.overlayVisible : styles.overlayHidden), "data-testid": "drawer-overlay", onClick: handleOverlayClick, "aria-hidden": "true" })), jsxRuntimeExports.jsxs("div", { ref: drawerRef, tabIndex: -1, className: getPositionClasses(), "data-position": position, "data-size": size, children: [title && (jsxRuntimeExports.jsx("div", { className: classNames(styles.header, headerAlign === "center" && styles.headerCenter), children: jsxRuntimeExports.jsxs("div", { className: styles.headerContent, children: [jsxRuntimeExports.jsx("h2", { id: "drawer-title", className: styles.title, children: title }), jsxRuntimeExports.jsx("button", { onClick: onClose, className: styles.closeButton, "aria-label": closeLabel, children: jsxRuntimeExports.jsx(icons.CloseIcon, { size: "md" }) })] }) })), jsxRuntimeExports.jsx("div", { className: styles.body, children: contentContained ? (jsxRuntimeExports.jsx("div", { className: styles.contained, children: children })) : (children) }), footer && (jsxRuntimeExports.jsx("div", { className: classNames(styles.footer, footerAlignClass), children: contentContained ? (jsxRuntimeExports.jsx("div", { className: styles.contained, children: footer })) : (footer) }))] })] }));
569
569
  };
570
570
 
571
571
  module.exports = Drawer;
package/dist/index.d.ts CHANGED
@@ -22,6 +22,8 @@ interface DrawerProps {
22
22
  closeOnOverlayClick?: boolean;
23
23
  /** Whether pressing Escape closes the drawer */
24
24
  closeOnEscape?: boolean;
25
+ /** Texto accesible del botón de cerrar. */
26
+ closeLabel?: string;
25
27
  /** Custom className for the drawer content */
26
28
  className?: string;
27
29
  /** Footer content (typically action buttons) */
package/dist/index.esm.js CHANGED
@@ -455,7 +455,7 @@ var styles = {"root":"Drawer-module_root__9H22a","overlay":"Drawer-module_overla
455
455
  styleInject(css_248z);
456
456
 
457
457
  const classNames = (...classes) => classes.filter(Boolean).join(" ");
458
- const Drawer = ({ isOpen, onClose, position = "right", size = "md", title, children, showOverlay = true, closeOnOverlayClick = true, closeOnEscape = true, className = "", footer, headerAlign = "space-between", footerAlign = "right", contentContained = false, }) => {
458
+ const Drawer = ({ isOpen, onClose, position = "right", size = "md", title, children, showOverlay = true, closeOnOverlayClick = true, closeOnEscape = true, closeLabel = "Cerrar", className = "", footer, headerAlign = "space-between", footerAlign = "right", contentContained = false, }) => {
459
459
  const drawerRef = useRef(null);
460
460
  const [isAnimating, setIsAnimating] = useState(false);
461
461
  const [shouldRender, setShouldRender] = useState(isOpen);
@@ -563,7 +563,7 @@ const Drawer = ({ isOpen, onClose, position = "right", size = "md", title, child
563
563
  right: styles.footerEnd,
564
564
  "space-between": styles.footerSpaceBetween,
565
565
  }[footerAlign];
566
- return (jsxRuntimeExports.jsxs("div", { className: styles.root, role: "dialog", "aria-modal": "true", "aria-labelledby": title ? "drawer-title" : undefined, children: [showOverlay && (jsxRuntimeExports.jsx("div", { className: classNames(styles.overlay, isAnimating ? styles.overlayVisible : styles.overlayHidden), "data-testid": "drawer-overlay", onClick: handleOverlayClick, "aria-hidden": "true" })), jsxRuntimeExports.jsxs("div", { ref: drawerRef, tabIndex: -1, className: getPositionClasses(), "data-position": position, "data-size": size, children: [title && (jsxRuntimeExports.jsx("div", { className: classNames(styles.header, headerAlign === "center" && styles.headerCenter), children: jsxRuntimeExports.jsxs("div", { className: styles.headerContent, children: [jsxRuntimeExports.jsx("h2", { id: "drawer-title", className: styles.title, children: title }), jsxRuntimeExports.jsx("button", { onClick: onClose, className: styles.closeButton, "aria-label": "Close drawer", children: jsxRuntimeExports.jsx(CloseIcon, { size: "md" }) })] }) })), jsxRuntimeExports.jsx("div", { className: styles.body, children: contentContained ? (jsxRuntimeExports.jsx("div", { className: styles.contained, children: children })) : (children) }), footer && (jsxRuntimeExports.jsx("div", { className: classNames(styles.footer, footerAlignClass), children: contentContained ? (jsxRuntimeExports.jsx("div", { className: styles.contained, children: footer })) : (footer) }))] })] }));
566
+ return (jsxRuntimeExports.jsxs("div", { className: styles.root, role: "dialog", "aria-modal": "true", "aria-labelledby": title ? "drawer-title" : undefined, children: [showOverlay && (jsxRuntimeExports.jsx("div", { className: classNames(styles.overlay, isAnimating ? styles.overlayVisible : styles.overlayHidden), "data-testid": "drawer-overlay", onClick: handleOverlayClick, "aria-hidden": "true" })), jsxRuntimeExports.jsxs("div", { ref: drawerRef, tabIndex: -1, className: getPositionClasses(), "data-position": position, "data-size": size, children: [title && (jsxRuntimeExports.jsx("div", { className: classNames(styles.header, headerAlign === "center" && styles.headerCenter), children: jsxRuntimeExports.jsxs("div", { className: styles.headerContent, children: [jsxRuntimeExports.jsx("h2", { id: "drawer-title", className: styles.title, children: title }), jsxRuntimeExports.jsx("button", { onClick: onClose, className: styles.closeButton, "aria-label": closeLabel, children: jsxRuntimeExports.jsx(CloseIcon, { size: "md" }) })] }) })), jsxRuntimeExports.jsx("div", { className: styles.body, children: contentContained ? (jsxRuntimeExports.jsx("div", { className: styles.contained, children: children })) : (children) }), footer && (jsxRuntimeExports.jsx("div", { className: classNames(styles.footer, footerAlignClass), children: contentContained ? (jsxRuntimeExports.jsx("div", { className: styles.contained, children: footer })) : (footer) }))] })] }));
567
567
  };
568
568
 
569
569
  export { Drawer as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubenpazch/drawer",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "Flexible drawer/sidebar component with multiple positions and animations",
5
5
  "private": false,
6
6
  "main": "dist/index.cjs.js",
@@ -27,10 +27,10 @@
27
27
  }
28
28
  },
29
29
  "peerDependencies": {
30
- "@rubenpazch/tokens": "0.2.0"
30
+ "@rubenpazch/tokens": "0.4.0"
31
31
  },
32
32
  "dependencies": {
33
- "@rubenpazch/icons": "6.1.0"
33
+ "@rubenpazch/icons": "6.2.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/react": "^19.2.18",
@@ -40,6 +40,12 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
+ "lbyte": {
44
+ "categoria": "navegacion",
45
+ "resumen": "Panel lateral (izquierda/derecha/arriba/abajo) con animación y fondo.",
46
+ "usarCuando": "Menús laterales, filtros o formularios de edición que no requieren cambiar de página.",
47
+ "evitarCuando": "Confirmaciones breves: usa ConfirmationDialog."
48
+ },
43
49
  "scripts": {
44
50
  "build": "rollup -c",
45
51
  "test": "jest --passWithNoTests"