@rubenpazch/checkbox-input 3.4.0 → 3.5.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
@@ -57,12 +57,12 @@ opciones de una lista corta (permisos, días, especialidades).
57
57
  | `labels` | `Partial<{ selectAll: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
58
58
  | `maxSelected` | `number` | | | Máximo de opciones marcadas: al llegar, las demás se deshabilitan. |
59
59
  | `name` | `string` | | | name de cada casilla (formularios nativos: se envía una vez por valor marcado). |
60
- | `orientation` | `"vertical" \| "horizontal"` | | `vertical` | `vertical` (por defecto) o `horizontal` (se ajusta a la siguiente línea). |
60
+ | `orientation` | `"horizontal" \| "vertical"` | | `vertical` | `vertical` (por defecto) o `horizontal` (se ajusta a la siguiente línea). |
61
61
  | `required` | `boolean` | | `false` | Marca el grupo como obligatorio (muestra *); la validación "al menos uno" va en `error`. |
62
62
  | `selectAll` | `boolean \| string` | | `false` | Agrega una casilla "Seleccionar todos" (queda indeterminada si hay algunas marcadas). `true` usa el texto por defecto; un texto lo reemplaza. |
63
63
  | `size` | `"sm" \| "md" \| "lg"` | | `md` | Tamaño de las casillas. |
64
64
  | `variant` | `"default" \| "primary" \| "success" \| "warning" \| "danger"` | | `primary` | Color de las casillas marcadas. |
65
65
 
66
- Tipos: `CheckboxInputProps`, `CheckboxGroupProps`, `CheckboxOption`.
66
+ Tipos: `CheckboxInputProps`, `CheckboxInputNativeProps`, `CheckboxGroupProps`, `CheckboxOption`.
67
67
 
68
68
  <!-- catalogo:fin -->
@@ -1,7 +1,9 @@
1
1
  import React from "react";
2
2
  type CheckboxSize = "sm" | "md" | "lg";
3
3
  type CheckboxVariant = "default" | "primary" | "success" | "warning" | "danger";
4
- export interface CheckboxInputProps {
4
+ /** Atributos nativos del <input> que se pasan tal cual (aria-*, data-*, autoFocus, form…). */
5
+ export type CheckboxInputNativeProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "id" | "name" | "value" | "checked" | "defaultChecked" | "onChange" | "disabled" | "className" | "required" | "size" | "type">;
6
+ export interface CheckboxInputProps extends CheckboxInputNativeProps {
5
7
  /** id del input; si no se pasa se genera uno estable. */
6
8
  id?: string;
7
9
  /** name del input (formularios nativos, react-hook-form…). */
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../src/CheckboxInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAIjD,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACvC,KAAK,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEhF,MAAM,WAAW,kBAAkB;IACjC,yDAAyD;IACzD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA0CD,iEAAiE;AACjE,QAAA,MAAM,aAAa,6FA8FlB,CAAC;AAIF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"CheckboxInput.d.ts","s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};
488
488
  const classNames = (...classes) => classes.filter(Boolean).join(" ");
489
489
  /** Casilla de verificación con etiqueta, descripción y error. */
490
- const CheckboxInput = React.forwardRef(function CheckboxInput({ id, name, value, label, checked = false, onChange, disabled = false, description, error, className = "", required = false, size = "md", variant = "default", indeterminate = false, }, ref) {
490
+ const CheckboxInput = React.forwardRef(function CheckboxInput({ id, name, value, label, checked = false, onChange, disabled = false, description, error, className = "", required = false, size = "md", variant = "default", indeterminate = false, ...nativeProps }, ref) {
491
491
  const field = shared.useFieldIds({ id, name, required, error, hint: description });
492
492
  const sizeConfig = sizeClasses[size];
493
493
  const variantConfig = variantClasses[variant];
@@ -497,7 +497,7 @@ const CheckboxInput = React.forwardRef(function CheckboxInput({ id, name, value,
497
497
  checkboxRef.current.indeterminate = indeterminate;
498
498
  }
499
499
  }, [indeterminate]);
500
- return (jsxRuntimeExports.jsxs("div", { className: classNames(styles$1.wrapper, className), children: [jsxRuntimeExports.jsx("div", { className: classNames(styles$1.checkboxContainer, sizeConfig.container), children: jsxRuntimeExports.jsx("input", { ref: shared.mergeRefs(checkboxRef, ref), ...field.controlProps, name: name, value: value, type: "checkbox", checked: checked, "aria-checked": indeterminate ? "mixed" : undefined, onChange: (e) => {
500
+ return (jsxRuntimeExports.jsxs("div", { className: classNames(styles$1.wrapper, className), children: [jsxRuntimeExports.jsx("div", { className: classNames(styles$1.checkboxContainer, sizeConfig.container), children: jsxRuntimeExports.jsx("input", { ...nativeProps, ref: shared.mergeRefs(checkboxRef, ref), ...field.controlProps, name: name, value: value, type: "checkbox", checked: checked, "aria-checked": indeterminate ? "mixed" : undefined, onChange: (e) => {
501
501
  if (disabled) {
502
502
  return;
503
503
  }
package/dist/index.d.ts CHANGED
@@ -3,7 +3,9 @@ import { UiMessages } from '@rubenpazch/shared';
3
3
 
4
4
  type CheckboxSize = "sm" | "md" | "lg";
5
5
  type CheckboxVariant = "default" | "primary" | "success" | "warning" | "danger";
6
- interface CheckboxInputProps {
6
+ /** Atributos nativos del <input> que se pasan tal cual (aria-*, data-*, autoFocus, form…). */
7
+ type CheckboxInputNativeProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "id" | "name" | "value" | "checked" | "defaultChecked" | "onChange" | "disabled" | "className" | "required" | "size" | "type">;
8
+ interface CheckboxInputProps extends CheckboxInputNativeProps {
7
9
  /** id del input; si no se pasa se genera uno estable. */
8
10
  id?: string;
9
11
  /** name del input (formularios nativos, react-hook-form…). */
@@ -88,4 +90,4 @@ interface CheckboxGroupProps {
88
90
  declare function CheckboxGroup({ label, options, value, onChange, name, orientation, columns, size, variant, disabled, required, hint, error, selectAll, maxSelected, hideLabel, className, id, labels, }: CheckboxGroupProps): React.JSX.Element;
89
91
 
90
92
  export { CheckboxGroup, CheckboxInput as default };
91
- export type { CheckboxGroupProps, CheckboxInputProps, CheckboxOption };
93
+ export type { CheckboxGroupProps, CheckboxInputNativeProps, CheckboxInputProps, CheckboxOption };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,YAAY,EACV,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.esm.js CHANGED
@@ -483,7 +483,7 @@ const variantClasses = {
483
483
  };
484
484
  const classNames = (...classes) => classes.filter(Boolean).join(" ");
485
485
  /** Casilla de verificación con etiqueta, descripción y error. */
486
- const CheckboxInput = React.forwardRef(function CheckboxInput({ id, name, value, label, checked = false, onChange, disabled = false, description, error, className = "", required = false, size = "md", variant = "default", indeterminate = false, }, ref) {
486
+ const CheckboxInput = React.forwardRef(function CheckboxInput({ id, name, value, label, checked = false, onChange, disabled = false, description, error, className = "", required = false, size = "md", variant = "default", indeterminate = false, ...nativeProps }, ref) {
487
487
  const field = useFieldIds({ id, name, required, error, hint: description });
488
488
  const sizeConfig = sizeClasses[size];
489
489
  const variantConfig = variantClasses[variant];
@@ -493,7 +493,7 @@ const CheckboxInput = React.forwardRef(function CheckboxInput({ id, name, value,
493
493
  checkboxRef.current.indeterminate = indeterminate;
494
494
  }
495
495
  }, [indeterminate]);
496
- return (jsxRuntimeExports.jsxs("div", { className: classNames(styles$1.wrapper, className), children: [jsxRuntimeExports.jsx("div", { className: classNames(styles$1.checkboxContainer, sizeConfig.container), children: jsxRuntimeExports.jsx("input", { ref: mergeRefs(checkboxRef, ref), ...field.controlProps, name: name, value: value, type: "checkbox", checked: checked, "aria-checked": indeterminate ? "mixed" : undefined, onChange: (e) => {
496
+ return (jsxRuntimeExports.jsxs("div", { className: classNames(styles$1.wrapper, className), children: [jsxRuntimeExports.jsx("div", { className: classNames(styles$1.checkboxContainer, sizeConfig.container), children: jsxRuntimeExports.jsx("input", { ...nativeProps, ref: mergeRefs(checkboxRef, ref), ...field.controlProps, name: name, value: value, type: "checkbox", checked: checked, "aria-checked": indeterminate ? "mixed" : undefined, onChange: (e) => {
497
497
  if (disabled) {
498
498
  return;
499
499
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubenpazch/checkbox-input",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "CheckboxInput component",
5
5
  "private": false,
6
6
  "main": "dist/index.cjs.js",