@alexandregme/zljs 1.8.0 → 1.10.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 +83 -0
- package/README.md +4 -0
- package/dist/{chunk-WZNUKE6S.js → chunk-2RTPRD3E.js} +9 -2
- package/dist/index.d.ts +11 -4
- package/dist/index.js +2 -2
- package/dist/rhf/index.js +1 -1
- package/package.json +4 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
A change that needs action in an app has a **Migration** note. When updating, read every version newer than the one the app has, oldest first. This file ships with the package, in `node_modules/@alexandregme/zljs/CHANGELOG.md`. Versions before 1.8.0 are in the [GitHub Releases](https://github.com/alexandregme/zljs/releases).
|
|
8
|
+
|
|
9
|
+
## [Unreleased]
|
|
10
|
+
|
|
11
|
+
## [1.10.0] - 2026-11-02
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `Input` takes `autoComplete` and `required`
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- `Input` requires `label` or `aria-label` in its type, so a field can't be left without a name
|
|
20
|
+
- `Input` draws a real `focus-visible` outline in the theme's `primary` color instead of a `focus:ring`, so focus stays visible in forced colors mode, and an app's own color reaches it
|
|
21
|
+
- `Input` border is now `gray-500` instead of `gray-300`, for 3:1 contrast, and its placeholder is `gray-500`, for 4.5:1
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- `Input` with `error` sets `aria-invalid` and points `aria-describedby` to the message, so a screen reader announces both
|
|
26
|
+
|
|
27
|
+
#### Migration
|
|
28
|
+
|
|
29
|
+
Only an `Input` with neither `label` nor `aria-label`, code that extends `InputProps`, and tests that assert its old classes need a change. To find them, run the commands below from the app's root. The first also finds other components named `Input`, and those stay as they are:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
grep -rnE "<Input([[:space:]/>]|$)|\bInputProps\b" . --include='*.ts' --include='*.tsx' --exclude-dir=node_modules --exclude-dir=.next
|
|
33
|
+
grep -rnE "border-gray-300|focus:ring-blue-500|focus:border-transparent" . --include='*.test.*' --exclude-dir=node_modules --exclude-dir=.next
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Give each field a `label`, or an `aria-label` when the context already says what it is. Replace `interface X extends InputProps` with `type X = InputProps & { ... }`, because `InputProps` is now a union. In tests, replace those classes with `focus-visible:outline-zl-primary` and `border-gray-500`.
|
|
37
|
+
|
|
38
|
+
`FormInput` already requires `label`, so it doesn't change.
|
|
39
|
+
|
|
40
|
+
## [1.9.0] - 2026-11-02
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- `CHANGELOG.md` now ships with the package, and has a `Foundations/Changelog` page in Storybook
|
|
45
|
+
|
|
46
|
+
## [1.8.0] - 2026-11-01
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
|
|
50
|
+
- Theme values for the semantic colors. Apps work with no setup, and can use their own colors by redefining `--color-zl-<color>` after importing the styles. See `Colors` in the README. Only the defaults are checked for contrast
|
|
51
|
+
- `Foundations/Colors` page in Storybook
|
|
52
|
+
|
|
53
|
+
### Changed
|
|
54
|
+
|
|
55
|
+
- `Button`, `Heading`, `Text`, `Error` and the `Checkbox` card use theme classes such as `text-zl-success` instead of Tailwind shades such as `text-green-700`
|
|
56
|
+
- `info` on `Heading` and `Text` is now `cyan-700` instead of `sky-700`
|
|
57
|
+
- `Button` and link hovers are now derived from their color, so they are slightly different
|
|
58
|
+
|
|
59
|
+
#### Migration
|
|
60
|
+
|
|
61
|
+
Only tests that assert a shade on a zljs component need a change. To find them, run the command below. It also finds classes the app sets itself, and those stay as they are:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
grep -rnE "(hover:)?(text|bg)-(blue|green|red|yellow|sky|cyan|gray)-(\\\\d|[0-9])" src --include='*.test.*'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Replace the shade with the class of the `color` being tested, for example `/(^|\s)text-green-\d+/` with `/(^|\s)text-zl-success(\s|$)/`. Then run the app's tests.
|
|
68
|
+
|
|
69
|
+
| `color` | `Text`, `Heading`, `link` | Link hover | `Button` background | `Button` hover |
|
|
70
|
+
| --------- | ------------------------- | ------------------------------ | ------------------- | --------------------------- |
|
|
71
|
+
| `primary` | `text-zl-primary` | `hover:text-zl-primary-strong` | `bg-zl-primary-bg` | `hover:bg-zl-primary-hover` |
|
|
72
|
+
| `success` | `text-zl-success` | `hover:text-zl-success-strong` | `bg-zl-success-bg` | `hover:bg-zl-success-hover` |
|
|
73
|
+
| `danger` | `text-zl-danger` | `hover:text-zl-danger-strong` | `bg-zl-danger-bg` | `hover:bg-zl-danger-hover` |
|
|
74
|
+
| `warning` | `text-zl-warning` | `hover:text-zl-warning-strong` | `bg-zl-warning-bg` | `hover:bg-zl-warning-hover` |
|
|
75
|
+
| `info` | `text-zl-info` | `hover:text-zl-info-strong` | `bg-zl-info-bg` | `hover:bg-zl-info-hover` |
|
|
76
|
+
| `muted` | `text-zl-muted` | `hover:text-zl-muted-strong` | `bg-zl-muted-bg` | `hover:bg-zl-muted-hover` |
|
|
77
|
+
|
|
78
|
+
The message of `Error` is `text-zl-danger`. `none` and `ghost` didn't change.
|
|
79
|
+
|
|
80
|
+
[Unreleased]: https://github.com/alexandregme/zljs/compare/v1.10.0...HEAD
|
|
81
|
+
[1.10.0]: https://github.com/alexandregme/zljs/compare/v1.9.0...v1.10.0
|
|
82
|
+
[1.9.0]: https://github.com/alexandregme/zljs/compare/v1.8.0...v1.9.0
|
|
83
|
+
[1.8.0]: https://github.com/alexandregme/zljs/compare/v1.7.0...v1.8.0
|
package/README.md
CHANGED
|
@@ -67,6 +67,10 @@ The components work with no setup, using the default colors. To use your own, re
|
|
|
67
67
|
|
|
68
68
|
Only the defaults are checked for contrast. Check your own choice: 4.5:1 for text, on `--color-zl-<color>` against the page and on `-on` against `-bg`, and 3:1 for the focus outline. A value set on a nested element doesn't reach the values derived from it, so set them in `@theme` or `:root`.
|
|
69
69
|
|
|
70
|
+
## Updating
|
|
71
|
+
|
|
72
|
+
See [`CHANGELOG.md`](./CHANGELOG.md), in the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format. A change that needs action in an app has a **Migration** note, written so an agent can follow it. The file ships with the package, in `node_modules/@alexandregme/zljs/CHANGELOG.md`.
|
|
73
|
+
|
|
70
74
|
## Getting Started
|
|
71
75
|
|
|
72
76
|
```bash
|
|
@@ -49,7 +49,7 @@ var label = tv2({
|
|
|
49
49
|
base: "text-sm font-medium text-gray-700"
|
|
50
50
|
});
|
|
51
51
|
var input = tv2({
|
|
52
|
-
base: "px-3 py-2 border border-gray-
|
|
52
|
+
base: "px-3 py-2 border border-gray-500 rounded-md text-sm placeholder:text-gray-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zl-primary disabled:bg-gray-100 disabled:cursor-not-allowed"
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
// core/forms/input/input.tsx
|
|
@@ -61,14 +61,17 @@ var Input = forwardRef(
|
|
|
61
61
|
name,
|
|
62
62
|
type = "text",
|
|
63
63
|
placeholder,
|
|
64
|
+
autoComplete,
|
|
64
65
|
value,
|
|
65
66
|
error: error2,
|
|
66
67
|
disabled,
|
|
68
|
+
required,
|
|
67
69
|
onChange,
|
|
68
70
|
onBlur,
|
|
69
71
|
onKeyDown
|
|
70
72
|
}, ref) => {
|
|
71
73
|
const id = useId();
|
|
74
|
+
const errorId = `${id}-error`;
|
|
72
75
|
return /* @__PURE__ */ jsxs("div", { className: wrapper(), children: [
|
|
73
76
|
labelText && /* @__PURE__ */ jsx3("label", { htmlFor: id, className: label(), children: labelText }),
|
|
74
77
|
/* @__PURE__ */ jsx3(
|
|
@@ -79,16 +82,20 @@ var Input = forwardRef(
|
|
|
79
82
|
name,
|
|
80
83
|
type,
|
|
81
84
|
placeholder,
|
|
85
|
+
autoComplete,
|
|
82
86
|
value,
|
|
83
87
|
disabled,
|
|
88
|
+
required,
|
|
84
89
|
onChange,
|
|
85
90
|
onBlur,
|
|
86
91
|
onKeyDown,
|
|
87
92
|
"aria-label": ariaLabel,
|
|
93
|
+
"aria-invalid": error2 ? true : void 0,
|
|
94
|
+
"aria-describedby": error2 ? errorId : void 0,
|
|
88
95
|
className: input()
|
|
89
96
|
}
|
|
90
97
|
),
|
|
91
|
-
error2 && /* @__PURE__ */ jsx3(Error, { message: error2 })
|
|
98
|
+
error2 && /* @__PURE__ */ jsx3(Error, { id: errorId, message: error2 })
|
|
92
99
|
] });
|
|
93
100
|
}
|
|
94
101
|
);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, ChangeEvent, FormEvent, FocusEvent, KeyboardEvent } from 'react';
|
|
2
|
+
import { ReactNode, ChangeEvent, FormEvent, HTMLInputAutoCompleteAttribute, FocusEvent, KeyboardEvent } from 'react';
|
|
3
3
|
export { FormInput, FormInputProps, FormProvider, FormProviderProps } from './rhf/index.js';
|
|
4
4
|
export { toast } from 'sonner';
|
|
5
5
|
import * as zustand from 'zustand';
|
|
@@ -98,19 +98,26 @@ interface FormProps {
|
|
|
98
98
|
|
|
99
99
|
declare const Form: ({ children, onSubmit, disabled }: FormProps) => react.JSX.Element;
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
label
|
|
101
|
+
type InputName = {
|
|
102
|
+
label: string;
|
|
103
103
|
"aria-label"?: string;
|
|
104
|
+
} | {
|
|
105
|
+
label?: undefined;
|
|
106
|
+
"aria-label": string;
|
|
107
|
+
};
|
|
108
|
+
type InputProps = InputName & {
|
|
104
109
|
name?: string;
|
|
105
110
|
type?: "text" | "password" | "email";
|
|
106
111
|
placeholder?: string;
|
|
112
|
+
autoComplete?: HTMLInputAutoCompleteAttribute;
|
|
107
113
|
value?: string;
|
|
108
114
|
error?: string;
|
|
109
115
|
disabled?: boolean;
|
|
116
|
+
required?: boolean;
|
|
110
117
|
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
111
118
|
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
112
119
|
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
113
|
-
}
|
|
120
|
+
};
|
|
114
121
|
|
|
115
122
|
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
116
123
|
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
FormInput,
|
|
5
5
|
FormProvider,
|
|
6
6
|
Input
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2RTPRD3E.js";
|
|
8
8
|
|
|
9
9
|
// core/icon/icon.tsx
|
|
10
10
|
import * as LucideIcons from "lucide-react";
|
|
@@ -679,7 +679,7 @@ var DataGrid = ({
|
|
|
679
679
|
// core/text/text.styles.ts
|
|
680
680
|
import { tv as tv8 } from "tailwind-variants";
|
|
681
681
|
|
|
682
|
-
// core/types/colors.const.ts
|
|
682
|
+
// core/types/colors/colors.const.ts
|
|
683
683
|
var semanticTextColors = {
|
|
684
684
|
primary: "text-zl-primary",
|
|
685
685
|
success: "text-zl-success",
|
package/dist/rhf/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexandregme/zljs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"./package.json": "./package.json"
|
|
43
43
|
},
|
|
44
44
|
"files": [
|
|
45
|
-
"dist"
|
|
45
|
+
"dist",
|
|
46
|
+
"CHANGELOG.md"
|
|
46
47
|
],
|
|
47
48
|
"sideEffects": [
|
|
48
49
|
"*.css"
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
"test:coverage": "vitest run --project unit --coverage",
|
|
61
62
|
"test:storybook": "vitest run --project storybook",
|
|
62
63
|
"test:visual": "chromatic",
|
|
64
|
+
"version": "node scripts/stamp-changelog.mjs && git add CHANGELOG.md",
|
|
63
65
|
"eslint": "eslint ./ --color --fix",
|
|
64
66
|
"prettier": "prettier --write .",
|
|
65
67
|
"stylelint": "stylelint '**/*.{css,scss}' --allow-empty-input",
|