@ably/ui 17.9.16 → 17.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.
Files changed (2) hide show
  1. package/AGENTS.md +197 -0
  2. package/package.json +4 -2
package/AGENTS.md ADDED
@@ -0,0 +1,197 @@
1
+ # Agent Development Guide
2
+
3
+ This file is not necessarily for people, the intended audience is automated agents.
4
+
5
+ ## Other references
6
+
7
+ Consider the content of `README.md` as well, it contains technical information
8
+ used by contributors to this project, as well as consumers of this project
9
+
10
+ ## Consumers
11
+
12
+ This project is intended to primarily be consumed by the Ably website, voltaire
13
+ & docs projects. It is distributed via NPM as the `@ably/ui` package.
14
+
15
+ ## Build & Test Commands
16
+
17
+ - `pnpm build` - Build the library (prebuild, icons, swc, tsc, cleanup)
18
+ - `pnpm test` - Run all tests with Vitest
19
+ - `pnpm test -- src/core/insights/index.test.ts` - Run a single test file
20
+ - `pnpm lint` - Run ESLint on all files
21
+ - `pnpm format:check` - Check formatting with Prettier
22
+ - `pnpm format:write` - Auto-format all files with Prettier
23
+ - `pnpm storybook` - Start Storybook dev server on port 6006
24
+ - `pnpm start` - Start Vite dev server on port 5000
25
+
26
+ ## Code Style
27
+
28
+ - **Language**: TypeScript with strict mode enabled
29
+ - **React**: Use functional components with hooks; React 18.x
30
+ - **Imports**: Default export for main component, named exports for types/utils
31
+ - **Naming**: PascalCase for components/types, camelCase for functions/variables,
32
+ kebab-case for files
33
+ - **Types**: Define prop types as `ComponentNameProps`, use `PropsWithChildren<T>`
34
+ when needed
35
+ - **Styling**: Tailwind 3.4.
36
+ - **Utility**: Use `cn()` from `./src/core/utils/cn` for className merging (clsx
37
+ & tailwind-merge)
38
+ - **Formatting**: Prettier defaults (no config = defaults), 2-space indent
39
+ - **Error Handling**: Wrap external service calls in try-catch, log with logger module
40
+ - **Comments**: JSDoc for props, inline comments for complex logic
41
+
42
+ Keep emojis in the code to a minimum, only introduce them if there is precedent
43
+ in the file you're working on.
44
+
45
+ Comments and commit messages should not include statements like "local tests pass",
46
+ this is a given for how we work.
47
+
48
+ ## Development
49
+
50
+ - Run `pnpm lint` & `pnpm format:write` on files after making changes, we lint
51
+ files in CI and don't want preventable failures. `pnpm lint:fix` should also
52
+ apply our formatting rules while trying to fix most things for you
53
+ - Run tests with `pnpm test` after making file changes
54
+
55
+ ## Styling Guide
56
+
57
+ ### Color Palettes
58
+
59
+ The design system uses semantic color palettes defined in `src/core/styles/properties.css`
60
+ and configured for Tailwind in `tailwind.config.js`. Each palette has a different
61
+ number of color values:
62
+
63
+ - **Neutral**: 000, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300 (14 values)
64
+ - **Orange**: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100 (11 values)
65
+ - **Yellow**: 100, 200, 300, 400, 500, 600, 700, 800, 900 (9 values)
66
+ - **Green**: 100, 200, 300, 400, 500, 600, 700, 800, 900 (9 values)
67
+ - **Blue**: 100, 200, 300, 400, 500, 600, 700, 800, 900 (9 values)
68
+ - **Violet**: 100, 200, 300, 400, 500, 600, 700, 800, 900 (9 values)
69
+ - **Pink**: 100, 200, 300, 400, 500, 600, 700, 800, 900 (9 values)
70
+
71
+ ### Interactive Element Styling Patterns
72
+
73
+ When developing components with @ably/ui, **always** use Tailwind classes following
74
+ these established patterns to ensure consistent interactive behavior across light
75
+ and dark modes:
76
+
77
+ #### Dark Mode Mirroring
78
+
79
+ For any given color, add a dark mode class that mirrors it across the palette.
80
+ Lower values (lighter colors) in light mode should map to higher values (darker
81
+ colors) in dark mode, and vice versa.
82
+
83
+ **Examples:**
84
+
85
+ - `bg-neutral-100` pairs with `dark:bg-neutral-1200`
86
+ - `bg-neutral-200` pairs with `dark:bg-neutral-1100`
87
+ - `bg-neutral-1200` pairs with `dark:bg-neutral-100`
88
+ - `text-neutral-1300` pairs with `dark:text-neutral-000`
89
+ - `bg-orange-200` pairs with `dark:bg-orange-900` (orange has 11 values: 200 + 900 = 1100)
90
+ - `bg-blue-300` pairs with `dark:bg-blue-700` (blue has 9 values: 300 + 700 = 1000)
91
+
92
+ The sum of mirrored color numbers should equal the total palette range. Different
93
+ palettes have different ranges, so calculate mirrors accordingly:
94
+
95
+ - Neutral (000-1300): `light + dark = 1300`
96
+ - Orange (100-1100): `light + dark = 1200`
97
+ - Secondary colors (100-900): `light + dark = 1000`
98
+
99
+ #### Hover States
100
+
101
+ Use the **next color value** along the palette for hover states:
102
+
103
+ - `bg-neutral-100` → `hover:bg-neutral-200`
104
+ - `bg-neutral-200` → `hover:bg-neutral-300`
105
+ - `bg-orange-600` → `hover:bg-orange-700`
106
+
107
+ Apply this pattern to both light and dark mode classes:
108
+
109
+ ```
110
+ bg-neutral-200 hover:bg-neutral-300
111
+ dark:bg-neutral-1100 dark:hover:bg-neutral-1000
112
+ ```
113
+
114
+ #### Active States
115
+
116
+ Use **two color values** along the palette for active/pressed states:
117
+
118
+ - `bg-neutral-100` → `active:bg-neutral-300`
119
+ - `bg-neutral-200` → `active:bg-neutral-400`
120
+ - `bg-orange-600` → `active:bg-orange-800`
121
+
122
+ Apply to both modes:
123
+
124
+ ```
125
+ bg-neutral-200 hover:bg-neutral-300 active:bg-neutral-400
126
+ dark:bg-neutral-1100 dark:hover:bg-neutral-1000 dark:active:bg-neutral-900
127
+ ```
128
+
129
+ #### Focus Styles
130
+
131
+ Add the `focus-base` class to all interactive elements (buttons, links, inputs,
132
+ selects, etc.). This class is defined in `src/core/styles/utils.css` and provides
133
+ consistent focus styling with an accessible outline:
134
+
135
+ ```css
136
+ .focus-base {
137
+ @apply focus:outline-none focus-visible:outline-4 focus-visible:outline-offset-0 focus-visible:outline-gui-focus;
138
+ }
139
+ ```
140
+
141
+ #### Transitions
142
+
143
+ Add `transition-colors` to interactive elements unless a higher-specificity
144
+ `transition` class is already present (e.g., `transition-all`, `transition-transform`).
145
+ This ensures smooth visual feedback for state changes.
146
+
147
+ ### Complete Example
148
+
149
+ Here's a complete button component demonstrating all patterns:
150
+
151
+ ```tsx
152
+ <button
153
+ className={cn(
154
+ "px-4 py-2 rounded",
155
+ "bg-neutral-200 hover:bg-neutral-300 active:bg-neutral-400",
156
+ "dark:bg-neutral-1100 dark:hover:bg-neutral-1000 dark:active:bg-neutral-900",
157
+ "text-neutral-1300 dark:text-neutral-000",
158
+ "focus-base transition-colors",
159
+ )}
160
+ >
161
+ Click me
162
+ </button>
163
+ ```
164
+
165
+ ### Additional Examples
166
+
167
+ **Select dropdown:**
168
+
169
+ ```tsx
170
+ <Select.Trigger
171
+ className="bg-neutral-200 hover:bg-neutral-300 active:bg-neutral-400 dark:bg-neutral-1100 dark:hover:bg-neutral-1000 dark:active:bg-neutral-900 focus-base transition-colors border border-neutral-300 dark:border-neutral-1000"
172
+ >
173
+ ```
174
+
175
+ **Badge with orange:**
176
+
177
+ ```tsx
178
+ <span
179
+ className="bg-orange-200 hover:bg-orange-300 active:bg-orange-400 dark:bg-orange-900 dark:hover:bg-orange-800 dark:active:bg-orange-700 focus-base transition-colors"
180
+ >
181
+ ```
182
+
183
+ **Toggle/Switch:**
184
+
185
+ ```tsx
186
+ <Switch
187
+ className="bg-neutral-600 hover:bg-neutral-700 active:bg-neutral-800 data-[state=checked]:bg-orange-600 data-[state=checked]:hover:bg-orange-700 data-[state=checked]:active:bg-orange-800 focus-base transition-colors"
188
+ >
189
+ ```
190
+
191
+ ## Git workflow
192
+
193
+ - Always do work on a new branch, start the branch on the HEAD of `origin/main`
194
+ - Before pushing the branch run the tests and linters to ensure they are happy
195
+ - When updating a branch, rebase on `origin/main` and force-push (with lease)
196
+ - Use our PR template in the `.github` folder as a reference for the pull request
197
+ - Keep commit messages concise
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ably/ui",
3
- "version": "17.9.16",
3
+ "version": "17.10.0",
4
4
  "description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,7 +12,9 @@
12
12
  "reset",
13
13
  "tailwind.config.js",
14
14
  "tailwind.extend.js",
15
- "index.d.ts"
15
+ "index.d.ts",
16
+ "AGENTS.md",
17
+ "CLAUDE.md"
16
18
  ],
17
19
  "types": "index.d.ts",
18
20
  "msw": {