@rubenpazch/checkbox-input 3.3.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 +3 -2
- package/dist/CheckboxGroup.d.ts +7 -1
- package/dist/CheckboxGroup.d.ts.map +1 -1
- package/dist/CheckboxInput.d.ts +3 -1
- package/dist/CheckboxInput.d.ts.map +1 -1
- package/dist/index.cjs.js +5 -4
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +6 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -54,14 +54,15 @@ opciones de una lista corta (permisos, días, especialidades).
|
|
|
54
54
|
| `hideLabel` | `boolean` | | `false` | Ocultar el título visualmente (sigue disponible para lectores de pantalla). |
|
|
55
55
|
| `hint` | `string` | | | Texto de ayuda bajo el título. |
|
|
56
56
|
| `id` | `string` | | | id del fieldset; si no se pasa se genera uno. |
|
|
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`. |
|
|
57
58
|
| `maxSelected` | `number` | | | Máximo de opciones marcadas: al llegar, las demás se deshabilitan. |
|
|
58
59
|
| `name` | `string` | | | name de cada casilla (formularios nativos: se envía una vez por valor marcado). |
|
|
59
|
-
| `orientation` | `"
|
|
60
|
+
| `orientation` | `"horizontal" \| "vertical"` | | `vertical` | `vertical` (por defecto) o `horizontal` (se ajusta a la siguiente línea). |
|
|
60
61
|
| `required` | `boolean` | | `false` | Marca el grupo como obligatorio (muestra *); la validación "al menos uno" va en `error`. |
|
|
61
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. |
|
|
62
63
|
| `size` | `"sm" \| "md" \| "lg"` | | `md` | Tamaño de las casillas. |
|
|
63
64
|
| `variant` | `"default" \| "primary" \| "success" \| "warning" \| "danger"` | | `primary` | Color de las casillas marcadas. |
|
|
64
65
|
|
|
65
|
-
Tipos: `CheckboxInputProps`, `CheckboxGroupProps`, `CheckboxOption`.
|
|
66
|
+
Tipos: `CheckboxInputProps`, `CheckboxInputNativeProps`, `CheckboxGroupProps`, `CheckboxOption`.
|
|
66
67
|
|
|
67
68
|
<!-- catalogo:fin -->
|
package/dist/CheckboxGroup.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { type UiMessages } from "@rubenpazch/shared";
|
|
2
3
|
export interface CheckboxOption {
|
|
3
4
|
/** Texto visible de la casilla. */
|
|
4
5
|
label: string;
|
|
@@ -49,10 +50,15 @@ export interface CheckboxGroupProps {
|
|
|
49
50
|
className?: string;
|
|
50
51
|
/** id del fieldset; si no se pasa se genera uno. */
|
|
51
52
|
id?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`);
|
|
55
|
+
* también se cambian para toda la app con su prop `messages`.
|
|
56
|
+
*/
|
|
57
|
+
labels?: Partial<UiMessages["checkboxGroup"]>;
|
|
52
58
|
}
|
|
53
59
|
/**
|
|
54
60
|
* Grupo de casillas con título (`fieldset`/`legend`), ayuda y error: para elegir varias
|
|
55
61
|
* opciones de una lista corta (permisos, días, especialidades).
|
|
56
62
|
*/
|
|
57
|
-
export default function CheckboxGroup({ label, options, value, onChange, name, orientation, columns, size, variant, disabled, required, hint, error, selectAll, maxSelected, hideLabel, className, id, }: CheckboxGroupProps): React.JSX.Element;
|
|
63
|
+
export default 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;
|
|
58
64
|
//# sourceMappingURL=CheckboxGroup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["../src/CheckboxGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["../src/CheckboxGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIpE,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,wBAAwB;IACxB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,4EAA4E;IAC5E,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACxC,oFAAoF;IACpF,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,sCAAsC;IACtC,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IACnE,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;CAC/C;AAKD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,KAAK,EACL,OAAO,EACP,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,WAAwB,EACxB,OAAO,EACP,IAAW,EACX,OAAmB,EACnB,QAAgB,EAChB,QAAgB,EAChB,IAAI,EACJ,KAAK,EACL,SAAiB,EACjB,WAAW,EACX,SAAiB,EACjB,SAAS,EACT,EAAE,EACF,MAAM,GACP,EAAE,kBAAkB,qBAgHpB"}
|
package/dist/CheckboxInput.d.ts
CHANGED
|
@@ -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
|
-
|
|
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,
|
|
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,8FAA8F;AAC9F,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EACzC,IAAI,GACJ,MAAM,GACN,OAAO,GACP,SAAS,GACT,gBAAgB,GAChB,UAAU,GACV,UAAU,GACV,WAAW,GACX,UAAU,GACV,MAAM,GACN,MAAM,CACT,CAAC;AAEF,MAAM,WAAW,kBAAmB,SAAQ,wBAAwB;IAClE,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,6FAgGlB,CAAC;AAIF,eAAe,aAAa,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -487,7 +487,7 @@ const variantClasses = {
|
|
|
487
487
|
};
|
|
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
|
}
|
|
@@ -515,7 +515,8 @@ const cx = (...c) => c.filter(Boolean).join(" ");
|
|
|
515
515
|
* Grupo de casillas con título (`fieldset`/`legend`), ayuda y error: para elegir varias
|
|
516
516
|
* opciones de una lista corta (permisos, días, especialidades).
|
|
517
517
|
*/
|
|
518
|
-
function CheckboxGroup({ label, options, value, onChange, name, orientation = "vertical", columns, size = "md", variant = "primary", disabled = false, required = false, hint, error, selectAll = false, maxSelected, hideLabel = false, className, id, }) {
|
|
518
|
+
function CheckboxGroup({ label, options, value, onChange, name, orientation = "vertical", columns, size = "md", variant = "primary", disabled = false, required = false, hint, error, selectAll = false, maxSelected, hideLabel = false, className, id, labels, }) {
|
|
519
|
+
const t = shared.useUiMessages("checkboxGroup", labels);
|
|
519
520
|
const generado = React.useId();
|
|
520
521
|
const baseId = id ?? `checkbox-group-${generado}`;
|
|
521
522
|
const hintId = `${baseId}-ayuda`;
|
|
@@ -551,7 +552,7 @@ function CheckboxGroup({ label, options, value, onChange, name, orientation = "v
|
|
|
551
552
|
...conservar.filter((v) => !options.some((o) => o.value === v)),
|
|
552
553
|
]);
|
|
553
554
|
};
|
|
554
|
-
return (jsxRuntimeExports.jsxs("fieldset", { id: baseId, className: cx(styles.fieldset, className), disabled: disabled, "aria-describedby": describedBy, "aria-invalid": error ? true : undefined, children: [jsxRuntimeExports.jsxs("legend", { className: cx(styles.legend, hideLabel && styles.srOnly), children: [label, required && (jsxRuntimeExports.jsxs("span", { className: styles.required, "aria-hidden": "true", children: [" ", "*"] }))] }), hint && (jsxRuntimeExports.jsx("p", { id: hintId, className: styles.hint, children: hint })), selectAll && (jsxRuntimeExports.jsx("div", { className: styles.selectAll, children: jsxRuntimeExports.jsx(CheckboxInput, { label: typeof selectAll === "string" ? selectAll :
|
|
555
|
+
return (jsxRuntimeExports.jsxs("fieldset", { id: baseId, className: cx(styles.fieldset, className), disabled: disabled, "aria-describedby": describedBy, "aria-invalid": error ? true : undefined, children: [jsxRuntimeExports.jsxs("legend", { className: cx(styles.legend, hideLabel && styles.srOnly), children: [label, required && (jsxRuntimeExports.jsxs("span", { className: styles.required, "aria-hidden": "true", children: [" ", "*"] }))] }), hint && (jsxRuntimeExports.jsx("p", { id: hintId, className: styles.hint, children: hint })), selectAll && (jsxRuntimeExports.jsx("div", { className: styles.selectAll, children: jsxRuntimeExports.jsx(CheckboxInput, { label: typeof selectAll === "string" ? selectAll : t.selectAll, checked: todasMarcadas, indeterminate: algunaMarcada && !todasMarcadas, onChange: alternarTodas, size: size, variant: variant, disabled: disabled }) })), jsxRuntimeExports.jsx("div", { className: cx(columns
|
|
555
556
|
? cx(styles.columns, styles[`cols${columns}`])
|
|
556
557
|
: orientation === "horizontal"
|
|
557
558
|
? styles.horizontal
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { UiMessages } from '@rubenpazch/shared';
|
|
2
3
|
|
|
3
4
|
type CheckboxSize = "sm" | "md" | "lg";
|
|
4
5
|
type CheckboxVariant = "default" | "primary" | "success" | "warning" | "danger";
|
|
5
|
-
|
|
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 {
|
|
6
9
|
/** id del input; si no se pasa se genera uno estable. */
|
|
7
10
|
id?: string;
|
|
8
11
|
/** name del input (formularios nativos, react-hook-form…). */
|
|
@@ -74,12 +77,17 @@ interface CheckboxGroupProps {
|
|
|
74
77
|
className?: string;
|
|
75
78
|
/** id del fieldset; si no se pasa se genera uno. */
|
|
76
79
|
id?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`);
|
|
82
|
+
* también se cambian para toda la app con su prop `messages`.
|
|
83
|
+
*/
|
|
84
|
+
labels?: Partial<UiMessages["checkboxGroup"]>;
|
|
77
85
|
}
|
|
78
86
|
/**
|
|
79
87
|
* Grupo de casillas con título (`fieldset`/`legend`), ayuda y error: para elegir varias
|
|
80
88
|
* opciones de una lista corta (permisos, días, especialidades).
|
|
81
89
|
*/
|
|
82
|
-
declare function CheckboxGroup({ label, options, value, onChange, name, orientation, columns, size, variant, disabled, required, hint, error, selectAll, maxSelected, hideLabel, className, id, }: CheckboxGroupProps): React.JSX.Element;
|
|
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;
|
|
83
91
|
|
|
84
92
|
export { CheckboxGroup, CheckboxInput as default };
|
|
85
|
-
export type { CheckboxGroupProps, CheckboxInputProps, CheckboxOption };
|
|
93
|
+
export type { CheckboxGroupProps, CheckboxInputNativeProps, CheckboxInputProps, CheckboxOption };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useRef, useEffect } from 'react';
|
|
2
|
-
import { useFieldIds, mergeRefs } from '@rubenpazch/shared';
|
|
2
|
+
import { useFieldIds, mergeRefs, useUiMessages } from '@rubenpazch/shared';
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = {exports: {}};
|
|
5
5
|
|
|
@@ -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
|
}
|
|
@@ -511,7 +511,8 @@ const cx = (...c) => c.filter(Boolean).join(" ");
|
|
|
511
511
|
* Grupo de casillas con título (`fieldset`/`legend`), ayuda y error: para elegir varias
|
|
512
512
|
* opciones de una lista corta (permisos, días, especialidades).
|
|
513
513
|
*/
|
|
514
|
-
function CheckboxGroup({ label, options, value, onChange, name, orientation = "vertical", columns, size = "md", variant = "primary", disabled = false, required = false, hint, error, selectAll = false, maxSelected, hideLabel = false, className, id, }) {
|
|
514
|
+
function CheckboxGroup({ label, options, value, onChange, name, orientation = "vertical", columns, size = "md", variant = "primary", disabled = false, required = false, hint, error, selectAll = false, maxSelected, hideLabel = false, className, id, labels, }) {
|
|
515
|
+
const t = useUiMessages("checkboxGroup", labels);
|
|
515
516
|
const generado = React.useId();
|
|
516
517
|
const baseId = id ?? `checkbox-group-${generado}`;
|
|
517
518
|
const hintId = `${baseId}-ayuda`;
|
|
@@ -547,7 +548,7 @@ function CheckboxGroup({ label, options, value, onChange, name, orientation = "v
|
|
|
547
548
|
...conservar.filter((v) => !options.some((o) => o.value === v)),
|
|
548
549
|
]);
|
|
549
550
|
};
|
|
550
|
-
return (jsxRuntimeExports.jsxs("fieldset", { id: baseId, className: cx(styles.fieldset, className), disabled: disabled, "aria-describedby": describedBy, "aria-invalid": error ? true : undefined, children: [jsxRuntimeExports.jsxs("legend", { className: cx(styles.legend, hideLabel && styles.srOnly), children: [label, required && (jsxRuntimeExports.jsxs("span", { className: styles.required, "aria-hidden": "true", children: [" ", "*"] }))] }), hint && (jsxRuntimeExports.jsx("p", { id: hintId, className: styles.hint, children: hint })), selectAll && (jsxRuntimeExports.jsx("div", { className: styles.selectAll, children: jsxRuntimeExports.jsx(CheckboxInput, { label: typeof selectAll === "string" ? selectAll :
|
|
551
|
+
return (jsxRuntimeExports.jsxs("fieldset", { id: baseId, className: cx(styles.fieldset, className), disabled: disabled, "aria-describedby": describedBy, "aria-invalid": error ? true : undefined, children: [jsxRuntimeExports.jsxs("legend", { className: cx(styles.legend, hideLabel && styles.srOnly), children: [label, required && (jsxRuntimeExports.jsxs("span", { className: styles.required, "aria-hidden": "true", children: [" ", "*"] }))] }), hint && (jsxRuntimeExports.jsx("p", { id: hintId, className: styles.hint, children: hint })), selectAll && (jsxRuntimeExports.jsx("div", { className: styles.selectAll, children: jsxRuntimeExports.jsx(CheckboxInput, { label: typeof selectAll === "string" ? selectAll : t.selectAll, checked: todasMarcadas, indeterminate: algunaMarcada && !todasMarcadas, onChange: alternarTodas, size: size, variant: variant, disabled: disabled }) })), jsxRuntimeExports.jsx("div", { className: cx(columns
|
|
551
552
|
? cx(styles.columns, styles[`cols${columns}`])
|
|
552
553
|
: orientation === "horizontal"
|
|
553
554
|
? styles.horizontal
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubenpazch/checkbox-input",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "CheckboxInput component",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"@rubenpazch/tokens": "0.5.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@rubenpazch/button": "6.2.
|
|
36
|
-
"@rubenpazch/shared": "5.
|
|
35
|
+
"@rubenpazch/button": "6.2.6",
|
|
36
|
+
"@rubenpazch/shared": "5.4.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@rubenpazch/typescript-config": "3.0.0"
|