@alexandregme/zljs 1.7.0 → 1.9.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 ADDED
@@ -0,0 +1,53 @@
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.9.0] - 2026-11-02
12
+
13
+ ### Added
14
+
15
+ - `CHANGELOG.md` now ships with the package, and has a `Foundations/Changelog` page in Storybook
16
+
17
+ ## [1.8.0] - 2026-11-01
18
+
19
+ ### Added
20
+
21
+ - 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
22
+ - `Foundations/Colors` page in Storybook
23
+
24
+ ### Changed
25
+
26
+ - `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`
27
+ - `info` on `Heading` and `Text` is now `cyan-700` instead of `sky-700`
28
+ - `Button` and link hovers are now derived from their color, so they are slightly different
29
+
30
+ #### Migration
31
+
32
+ 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:
33
+
34
+ ```sh
35
+ grep -rnE "(hover:)?(text|bg)-(blue|green|red|yellow|sky|cyan|gray)-(\\\\d|[0-9])" src --include='*.test.*'
36
+ ```
37
+
38
+ 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.
39
+
40
+ | `color` | `Text`, `Heading`, `link` | Link hover | `Button` background | `Button` hover |
41
+ | --------- | ------------------------- | ------------------------------ | ------------------- | --------------------------- |
42
+ | `primary` | `text-zl-primary` | `hover:text-zl-primary-strong` | `bg-zl-primary-bg` | `hover:bg-zl-primary-hover` |
43
+ | `success` | `text-zl-success` | `hover:text-zl-success-strong` | `bg-zl-success-bg` | `hover:bg-zl-success-hover` |
44
+ | `danger` | `text-zl-danger` | `hover:text-zl-danger-strong` | `bg-zl-danger-bg` | `hover:bg-zl-danger-hover` |
45
+ | `warning` | `text-zl-warning` | `hover:text-zl-warning-strong` | `bg-zl-warning-bg` | `hover:bg-zl-warning-hover` |
46
+ | `info` | `text-zl-info` | `hover:text-zl-info-strong` | `bg-zl-info-bg` | `hover:bg-zl-info-hover` |
47
+ | `muted` | `text-zl-muted` | `hover:text-zl-muted-strong` | `bg-zl-muted-bg` | `hover:bg-zl-muted-hover` |
48
+
49
+ The message of `Error` is `text-zl-danger`. `none` and `ghost` didn't change.
50
+
51
+ [Unreleased]: https://github.com/alexandregme/zljs/compare/v1.9.0...HEAD
52
+ [1.9.0]: https://github.com/alexandregme/zljs/compare/v1.8.0...v1.9.0
53
+ [1.8.0]: https://github.com/alexandregme/zljs/compare/v1.7.0...v1.8.0
package/README.md CHANGED
@@ -43,6 +43,34 @@ import { FormProvider, FormInput } from "@alexandregme/zljs/rhf";
43
43
  <Button onClick={handleClick}>Submit</Button>;
44
44
  ```
45
45
 
46
+ ## Colors
47
+
48
+ The components work with no setup, using the default colors. To use your own, redefine the values you want after importing the styles:
49
+
50
+ ```css
51
+ @import "tailwindcss";
52
+ @import "@alexandregme/zljs/styles.css";
53
+
54
+ @theme {
55
+ --color-zl-primary: #2e7d32;
56
+ }
57
+ ```
58
+
59
+ `primary`, `success`, `danger`, `warning`, `info` and `muted` each take one value (`--color-zl-<color>`), used for text and the focus outline. The others follow it, and you can redefine them too:
60
+
61
+ | Value | Used for | Default |
62
+ | --------------------------- | ---------------------- | ------------------------------------------ |
63
+ | `--color-zl-<color>-strong` | Link hover | 30% darker |
64
+ | `--color-zl-<color>-bg` | Button background | The color itself (`warning`: `yellow-500`) |
65
+ | `--color-zl-<color>-hover` | Button hover | The background, 15% darker |
66
+ | `--color-zl-<color>-on` | Text on the background | White (`warning`: `gray-900`) |
67
+
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
+
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
+
46
74
  ## Getting Started
47
75
 
48
76
  ```bash
@@ -28,7 +28,7 @@ import { forwardRef, useId } from "react";
28
28
  // core/forms/error/error.styles.ts
29
29
  import { tv } from "tailwind-variants";
30
30
  var error = tv({
31
- base: "text-sm text-red-600"
31
+ base: "text-sm text-zl-danger"
32
32
  });
33
33
 
34
34
  // core/forms/error/error.tsx
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  FormInput,
5
5
  FormProvider,
6
6
  Input
7
- } from "./chunk-GDE6UMXP.js";
7
+ } from "./chunk-WZNUKE6S.js";
8
8
 
9
9
  // core/icon/icon.tsx
10
10
  import * as LucideIcons from "lucide-react";
@@ -51,18 +51,18 @@ var button = tv({
51
51
  base: "cursor-pointer font-medium focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center justify-center",
52
52
  variants: {
53
53
  variant: {
54
- default: "px-4 py-2 text-white text-sm gap-2 rounded-md",
54
+ default: "px-4 py-2 text-sm gap-2 rounded-md",
55
55
  icon: "p-1 bg-transparent text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-md",
56
56
  // The invisible ::after grows the touch target to 44px without changing the layout.
57
57
  link: "relative text-xs hover:underline rounded-sm after:absolute after:top-1/2 after:left-1/2 after:h-11 after:w-full after:min-w-11 after:-translate-x-1/2 after:-translate-y-1/2"
58
58
  },
59
59
  color: {
60
- primary: "bg-blue-600 hover:bg-blue-700 focus-visible:outline-blue-600",
61
- success: "bg-green-700 hover:bg-green-800 focus-visible:outline-green-700",
62
- danger: "bg-red-600 hover:bg-red-700 focus-visible:outline-red-600",
63
- warning: "bg-yellow-500 hover:bg-yellow-600 focus-visible:outline-yellow-700 text-gray-900",
64
- info: "bg-cyan-700 hover:bg-cyan-800 focus-visible:outline-cyan-700",
65
- muted: "bg-gray-500 hover:bg-gray-600 focus-visible:outline-gray-500",
60
+ primary: "bg-zl-primary-bg hover:bg-zl-primary-hover text-zl-primary-on focus-visible:outline-zl-primary",
61
+ success: "bg-zl-success-bg hover:bg-zl-success-hover text-zl-success-on focus-visible:outline-zl-success",
62
+ danger: "bg-zl-danger-bg hover:bg-zl-danger-hover text-zl-danger-on focus-visible:outline-zl-danger",
63
+ warning: "bg-zl-warning-bg hover:bg-zl-warning-hover text-zl-warning-on focus-visible:outline-zl-warning",
64
+ info: "bg-zl-info-bg hover:bg-zl-info-hover text-zl-info-on focus-visible:outline-zl-info",
65
+ muted: "bg-zl-muted-bg hover:bg-zl-muted-hover text-zl-muted-on focus-visible:outline-zl-muted",
66
66
  ghost: "bg-transparent text-current hover:text-current hover:bg-neutral-500/20",
67
67
  none: ""
68
68
  },
@@ -104,32 +104,32 @@ var button = tv({
104
104
  {
105
105
  variant: "link",
106
106
  color: "primary",
107
- class: "text-blue-600 hover:text-blue-800"
107
+ class: "text-zl-primary hover:text-zl-primary-strong"
108
108
  },
109
109
  {
110
110
  variant: "link",
111
111
  color: "success",
112
- class: "text-green-700 hover:text-green-900"
112
+ class: "text-zl-success hover:text-zl-success-strong"
113
113
  },
114
114
  {
115
115
  variant: "link",
116
116
  color: "danger",
117
- class: "text-red-600 hover:text-red-800"
117
+ class: "text-zl-danger hover:text-zl-danger-strong"
118
118
  },
119
119
  {
120
120
  variant: "link",
121
121
  color: "warning",
122
- class: "text-yellow-700 hover:text-yellow-900"
122
+ class: "text-zl-warning hover:text-zl-warning-strong"
123
123
  },
124
124
  {
125
125
  variant: "link",
126
126
  color: "info",
127
- class: "text-cyan-700 hover:text-cyan-900"
127
+ class: "text-zl-info hover:text-zl-info-strong"
128
128
  },
129
129
  {
130
130
  variant: "link",
131
131
  color: "muted",
132
- class: "text-gray-500 hover:text-gray-700"
132
+ class: "text-zl-muted hover:text-zl-muted-strong"
133
133
  },
134
134
  {
135
135
  variant: "link",
@@ -224,7 +224,7 @@ var innerWrapper = tv2({
224
224
  variants: {
225
225
  variant: {
226
226
  default: "w-fit items-center gap-2",
227
- card: "items-start gap-3 rounded-lg border border-gray-500 p-3 has-checked:border-blue-600 has-checked:ring-1 has-checked:ring-blue-600 has-disabled:bg-gray-100"
227
+ card: "items-start gap-3 rounded-lg border border-gray-500 p-3 has-checked:border-zl-primary has-checked:ring-1 has-checked:ring-zl-primary has-disabled:bg-gray-100"
228
228
  }
229
229
  },
230
230
  defaultVariants: {
@@ -678,6 +678,19 @@ var DataGrid = ({
678
678
 
679
679
  // core/text/text.styles.ts
680
680
  import { tv as tv8 } from "tailwind-variants";
681
+
682
+ // core/types/colors/colors.const.ts
683
+ var semanticTextColors = {
684
+ primary: "text-zl-primary",
685
+ success: "text-zl-success",
686
+ danger: "text-zl-danger",
687
+ warning: "text-zl-warning",
688
+ info: "text-zl-info",
689
+ muted: "text-zl-muted",
690
+ none: ""
691
+ };
692
+
693
+ // core/text/text.styles.ts
681
694
  var text = tv8({
682
695
  variants: {
683
696
  variant: {
@@ -685,15 +698,7 @@ var text = tv8({
685
698
  caption: "text-sm",
686
699
  display: "text-3xl font-bold"
687
700
  },
688
- color: {
689
- primary: "text-blue-600",
690
- success: "text-green-700",
691
- danger: "text-red-600",
692
- warning: "text-yellow-700",
693
- info: "text-sky-700",
694
- muted: "text-gray-500",
695
- none: ""
696
- }
701
+ color: semanticTextColors
697
702
  },
698
703
  defaultVariants: {
699
704
  variant: "body"
@@ -858,15 +863,7 @@ var heading = tv11({
858
863
  5: "text-base font-medium",
859
864
  6: "text-sm font-medium"
860
865
  },
861
- color: {
862
- primary: "text-blue-600",
863
- success: "text-green-700",
864
- danger: "text-red-600",
865
- warning: "text-yellow-700",
866
- info: "text-sky-700",
867
- muted: "text-gray-500",
868
- none: ""
869
- }
866
+ color: semanticTextColors
870
867
  },
871
868
  defaultVariants: {
872
869
  level: 1
package/dist/rhf/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  FormInput,
4
4
  FormProvider
5
- } from "../chunk-GDE6UMXP.js";
5
+ } from "../chunk-WZNUKE6S.js";
6
6
  export {
7
7
  FormInput,
8
8
  FormProvider
@@ -0,0 +1,32 @@
1
+ /* AG Grid Custom Styles */
2
+ .ag-theme-alpine {
3
+ --ag-header-background-color: #f8fafc;
4
+ --ag-header-foreground-color: #334155;
5
+ --ag-header-cell-hover-background-color: #e2e8f0;
6
+ --ag-odd-row-background-color: #f8fafc;
7
+ --ag-row-hover-color: #e0f2fe;
8
+ --ag-selected-row-background-color: #dbeafe;
9
+ --ag-border-color: #e2e8f0;
10
+ --ag-font-family: inherit;
11
+ --ag-font-size: 14px;
12
+ }
13
+
14
+ .ag-theme-alpine .ag-header-cell {
15
+ font-weight: 600;
16
+ text-transform: uppercase;
17
+ font-size: 12px;
18
+ letter-spacing: 0.05em;
19
+ border-right: 1px solid #475569;
20
+ }
21
+
22
+ .ag-theme-alpine .ag-header-cell:last-child {
23
+ border-right: none;
24
+ }
25
+
26
+ .ag-theme-alpine .ag-row {
27
+ border-bottom: 1px solid #f1f5f9;
28
+ }
29
+
30
+ .ag-theme-alpine .ag-row:hover {
31
+ background-color: var(--ag-row-hover-color);
32
+ }
@@ -0,0 +1,57 @@
1
+ /* The semantic colors of the components. Works with no setup; an app changes a
2
+ color by redefining its --color-zl-* value in its own @theme, after importing
3
+ the styles. Only the defaults are checked for contrast.
4
+
5
+ Each color has five values, and the others follow the first unless redefined:
6
+ --color-zl-<color> text and focus outline
7
+ --color-zl-<color>-strong link hover
8
+ --color-zl-<color>-bg button background
9
+ --color-zl-<color>-hover button hover
10
+ --color-zl-<color>-on text on the background
11
+
12
+ Prettier is off for this block to keep one value per line. */
13
+
14
+ /* prettier-ignore */
15
+ @theme {
16
+ /* Primary */
17
+ --color-zl-primary: var(--color-blue-600);
18
+ --color-zl-primary-strong: color-mix(in oklab, var(--color-zl-primary), black 30%);
19
+ --color-zl-primary-bg: var(--color-zl-primary);
20
+ --color-zl-primary-hover: color-mix(in oklab, var(--color-zl-primary-bg), black 15%);
21
+ --color-zl-primary-on: var(--color-white);
22
+
23
+ /* Success */
24
+ --color-zl-success: var(--color-green-700);
25
+ --color-zl-success-strong: color-mix(in oklab, var(--color-zl-success), black 30%);
26
+ --color-zl-success-bg: var(--color-zl-success);
27
+ --color-zl-success-hover: color-mix(in oklab, var(--color-zl-success-bg), black 15%);
28
+ --color-zl-success-on: var(--color-white);
29
+
30
+ /* Danger */
31
+ --color-zl-danger: var(--color-red-600);
32
+ --color-zl-danger-strong: color-mix(in oklab, var(--color-zl-danger), black 30%);
33
+ --color-zl-danger-bg: var(--color-zl-danger);
34
+ --color-zl-danger-hover: color-mix(in oklab, var(--color-zl-danger-bg), black 15%);
35
+ --color-zl-danger-on: var(--color-white);
36
+
37
+ /* Warning */
38
+ --color-zl-warning: var(--color-yellow-700);
39
+ --color-zl-warning-strong: color-mix(in oklab, var(--color-zl-warning), black 30%);
40
+ --color-zl-warning-bg: var(--color-yellow-500);
41
+ --color-zl-warning-hover: color-mix(in oklab, var(--color-zl-warning-bg), black 15%);
42
+ --color-zl-warning-on: var(--color-gray-900);
43
+
44
+ /* Info */
45
+ --color-zl-info: var(--color-cyan-700);
46
+ --color-zl-info-strong: color-mix(in oklab, var(--color-zl-info), black 30%);
47
+ --color-zl-info-bg: var(--color-zl-info);
48
+ --color-zl-info-hover: color-mix(in oklab, var(--color-zl-info-bg), black 15%);
49
+ --color-zl-info-on: var(--color-white);
50
+
51
+ /* Muted */
52
+ --color-zl-muted: var(--color-gray-500);
53
+ --color-zl-muted-strong: color-mix(in oklab, var(--color-zl-muted), black 30%);
54
+ --color-zl-muted-bg: var(--color-zl-muted);
55
+ --color-zl-muted-hover: color-mix(in oklab, var(--color-zl-muted-bg), black 15%);
56
+ --color-zl-muted-on: var(--color-white);
57
+ }
@@ -0,0 +1,17 @@
1
+ /* Global Scrollbar */
2
+ ::-webkit-scrollbar {
3
+ width: 4px;
4
+ }
5
+
6
+ ::-webkit-scrollbar-track {
7
+ background: transparent;
8
+ }
9
+
10
+ ::-webkit-scrollbar-thumb {
11
+ background-color: rgba(228, 231, 234, 0.5);
12
+ border-radius: 2px;
13
+ }
14
+
15
+ ::-webkit-scrollbar-thumb:hover {
16
+ background-color: rgba(156, 163, 175, 0.75);
17
+ }
package/dist/styles.css CHANGED
@@ -1,54 +1,7 @@
1
+ @import "./styles/colors.css";
2
+ @import "./styles/scrollbar.css";
3
+ @import "./styles/ag-grid.css";
4
+
1
5
  /* Makes the consumer's Tailwind scan the component classes. The path is
2
6
  relative to this file, so it works from core/ and from the copy in dist/. */
3
7
  @source "./";
4
-
5
- /* Global Scrollbar */
6
- ::-webkit-scrollbar {
7
- width: 4px;
8
- }
9
-
10
- ::-webkit-scrollbar-track {
11
- background: transparent;
12
- }
13
-
14
- ::-webkit-scrollbar-thumb {
15
- background-color: rgba(228, 231, 234, 0.5);
16
- border-radius: 2px;
17
- }
18
-
19
- ::-webkit-scrollbar-thumb:hover {
20
- background-color: rgba(156, 163, 175, 0.75);
21
- }
22
-
23
- /* AG Grid Custom Styles */
24
- .ag-theme-alpine {
25
- --ag-header-background-color: #f8fafc;
26
- --ag-header-foreground-color: #334155;
27
- --ag-header-cell-hover-background-color: #e2e8f0;
28
- --ag-odd-row-background-color: #f8fafc;
29
- --ag-row-hover-color: #e0f2fe;
30
- --ag-selected-row-background-color: #dbeafe;
31
- --ag-border-color: #e2e8f0;
32
- --ag-font-family: inherit;
33
- --ag-font-size: 14px;
34
- }
35
-
36
- .ag-theme-alpine .ag-header-cell {
37
- font-weight: 600;
38
- text-transform: uppercase;
39
- font-size: 12px;
40
- letter-spacing: 0.05em;
41
- border-right: 1px solid #475569;
42
- }
43
-
44
- .ag-theme-alpine .ag-header-cell:last-child {
45
- border-right: none;
46
- }
47
-
48
- .ag-theme-alpine .ag-row {
49
- border-bottom: 1px solid #f1f5f9;
50
- }
51
-
52
- .ag-theme-alpine .ag-row:hover {
53
- background-color: var(--ag-row-hover-color);
54
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandregme/zljs",
3
- "version": "1.7.0",
3
+ "version": "1.9.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",