beez-ui 2.4.0 → 2.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/CHANGELOG.md +10 -0
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/components/field.d.ts +51 -0
- package/dist/components/field.js +700 -0
- package/dist/components/input-group.js +3 -3
- package/dist/components/input.d.ts +16 -2
- package/dist/components/input.js +117 -10
- package/dist/components/textarea.d.ts +13 -5
- package/dist/components/textarea.js +107 -12
- package/dist/constants/field.d.ts +24 -0
- package/dist/constants/field.js +24 -0
- package/dist/motion/arc-tokens.d.ts +7 -0
- package/dist/motion/arc-tokens.js +7 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ Todos los cambios relevantes de beez-ui se documentan en este archivo con el for
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [2.5.0] - 2026-10-15
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `Input` y `Textarea` aceptan `label`, `description` y `error`, de Arc: si se pasa cualquiera de ellos (aunque valga `undefined`, así el control no se vuelve a montar cuando aparece la validación) renderizan el campo completo, con el label asociado al control, la ayuda y el error enlazados por `aria-describedby`, y filas que se abren con un resorte y cambian solo las palabras que cambiaron; los números de la ayuda (por ejemplo un contador de caracteres) giran solo los dígitos que cambian. El error marca `aria-invalid` y se anuncia con `role="alert"`. Con movimiento reducido los cambios son instantáneos. Sin esas props siguen renderizando solo el control.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- `Input` y `Textarea` toman el diseño de Arc: alto mínimo de 44 px (`Textarea`, 110 px con redimensión vertical y sin crecer con el contenido), radio de control, fondo `surface`, borde fuerte que pasa a `foreground` con hover de puntero fino y con foco de teclado, sin anillos de foco, y borde `danger` cuando son inválidos. `InputGroup` usa el mismo marco.
|
|
16
|
+
|
|
7
17
|
## [2.4.0] - 2026-10-14
|
|
8
18
|
|
|
9
19
|
### Added
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -4,7 +4,7 @@ beez-ui includes code adapted from the following projects.
|
|
|
4
4
|
|
|
5
5
|
## Arc
|
|
6
6
|
|
|
7
|
-
The theme tokens (`theme.css`, from Arc's `foundation.css`) and the `Button` API, styles and motion (`src/components/button.tsx`, `src/components/button-label.tsx`, `src/components/control-button.tsx`, `src/motion/arc-press.ts`, `src/motion/arc-tokens.ts`, `src/motion/use-morph-width.ts`), and the `ActionButton` and `SplitButton` components and their label morph (`src/components/action-button.tsx`, `src/components/split-button.tsx`, `src/components/morph-text.tsx`) are adapted from the free Arc library: https://uiarc.dev, https://github.com/kuratlielia/arc-library
|
|
7
|
+
The theme tokens (`theme.css`, from Arc's `foundation.css`) and the `Button` API, styles and motion (`src/components/button.tsx`, `src/components/button-label.tsx`, `src/components/control-button.tsx`, `src/motion/arc-press.ts`, `src/motion/arc-tokens.ts`, `src/motion/use-morph-width.ts`), and the `ActionButton` and `SplitButton` components and their label morph (`src/components/action-button.tsx`, `src/components/split-button.tsx`, `src/components/morph-text.tsx`), and the `Input` and `Textarea` fields with their animated helper and error rows (`src/components/input.tsx`, `src/components/textarea.tsx`, `src/components/field.tsx`) are adapted from the free Arc library: https://uiarc.dev, https://github.com/kuratlielia/arc-library
|
|
8
8
|
|
|
9
9
|
```
|
|
10
10
|
MIT License
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AriaAttributes, ReactNode } from "react";
|
|
2
|
+
/** Copy that turns a bare control into a labelled field. */
|
|
3
|
+
export type FieldCopyProps = {
|
|
4
|
+
/** Visible label, tied to the control with `htmlFor`. */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** Helper copy under the control, linked through `aria-describedby`; counts in it roll their digits. */
|
|
7
|
+
description?: string;
|
|
8
|
+
/** Error copy: sets `aria-invalid` and renders in a `role="alert"` row that rewords in place. */
|
|
9
|
+
error?: string;
|
|
10
|
+
};
|
|
11
|
+
type FieldAriaOptions = FieldCopyProps & {
|
|
12
|
+
id?: string;
|
|
13
|
+
"aria-describedby"?: string;
|
|
14
|
+
"aria-invalid"?: AriaAttributes["aria-invalid"];
|
|
15
|
+
};
|
|
16
|
+
/** Ids and ARIA wiring a labelled field passes to its control. */
|
|
17
|
+
export type FieldAria = {
|
|
18
|
+
controlId: string;
|
|
19
|
+
descriptionId: string;
|
|
20
|
+
errorId: string;
|
|
21
|
+
"aria-describedby"?: string;
|
|
22
|
+
"aria-invalid"?: AriaAttributes["aria-invalid"];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the control id (the caller's or a generated one) and merges the helper and error ids into the caller's
|
|
26
|
+
* `aria-describedby`. An error always marks the control invalid.
|
|
27
|
+
* @param options - Field copy and the caller's id and ARIA attributes.
|
|
28
|
+
* @returns The ids and ARIA attributes for the control.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useFieldAria({ id, description, error, ...aria }: FieldAriaOptions): FieldAria;
|
|
31
|
+
/**
|
|
32
|
+
* Tells whether a control renders as a labelled field. It looks at which props were passed, not at their values, so a
|
|
33
|
+
* field whose error or description comes and goes keeps the same tree and its control never remounts (losing an
|
|
34
|
+
* uncontrolled value or the focus) when validation appears.
|
|
35
|
+
* @param props - Props passed to the control.
|
|
36
|
+
* @returns `true` when the caller passed `label`, `description` or `error`, even as `undefined`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function usesFieldCopy(props: FieldCopyProps): boolean;
|
|
39
|
+
type FieldProps = Omit<FieldCopyProps, "label"> & {
|
|
40
|
+
label?: string;
|
|
41
|
+
aria: FieldAria;
|
|
42
|
+
className?: string;
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Arc's field layout: label, control, then the helper and error rows. There is no row gap, because grid tracks clamp
|
|
47
|
+
* a negative margin at zero and a closed row would still pay it; each row carries its own space instead. The wrapper
|
|
48
|
+
* keeps the bare control's full-width contract, so a field fills a flex row like the control alone does.
|
|
49
|
+
*/
|
|
50
|
+
export declare function Field({ label, description, error, aria, className, children }: FieldProps): import("react").JSX.Element;
|
|
51
|
+
export {};
|