@vellira-ui/react 2.50.0 → 2.52.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 CHANGED
@@ -1,30 +1,15 @@
1
1
  # @vellira-ui/react
2
2
 
3
- React component package for Vellira.
3
+ React implementation of the Vellira design system.
4
4
 
5
- This package contains the web implementation of the design system. It extends shared contracts from `@vellira-ui/types`, uses shared tokens from `@vellira-ui/tokens`, and keeps DOM, CSS, accessibility ids, and browser events inside the web layer.
6
-
7
- ## Components
8
-
9
- - Button
10
- - Checkbox
11
- - Input
12
- - FormField
13
- - Radio
14
- - RadioGroup
15
- - Select
16
- - Dropdown
17
- - Tabs
18
- - Tooltip
19
- - Modal
20
-
21
- Each public component has Storybook coverage and Vitest unit coverage.
22
-
23
- For detailed props, shared types, examples, and compound component APIs, see
24
- [Web Component API](./API.md).
5
+ It extends shared contracts from `@vellira-ui/types`, uses shared tokens from
6
+ `@vellira-ui/tokens`, and keeps DOM, CSS, accessibility ids, and browser
7
+ events inside the web layer.
25
8
 
26
9
  ## Installation
27
10
 
11
+ Requires React 19 or later.
12
+
28
13
  ```bash
29
14
  pnpm add @vellira-ui/react
30
15
  ```
@@ -69,248 +54,44 @@ export function Example() {
69
54
  }
70
55
  ```
71
56
 
72
- ### Button Notes
73
-
74
- Use the standard `aria-label` attribute for icon-only web buttons:
75
-
76
- ```tsx
77
- import { Search } from '@vellira-ui/icons';
78
-
79
- <Button aria-label='Search' iconOnly iconStart={<Search />} />;
80
- ```
81
-
82
- `loading` disables interaction and can replace the visible label with
83
- `loadingText`.
84
-
85
- ### Checkbox Notes
86
-
87
- Use `description` for settings-style helper text when the checkbox is not
88
- wrapped in `FormField`. For checkbox rows without a visible label, provide
89
- `aria-label` or `aria-labelledby`.
90
-
91
- ```tsx
92
- import { Checkbox } from '@vellira-ui/react';
93
- import { useState } from 'react';
94
-
95
- export function TermsCheckbox() {
96
- const [accepted, setAccepted] = useState(false);
97
-
98
- return (
99
- <Checkbox
100
- label='Accept terms'
101
- description='Required to continue.'
102
- checked={accepted}
103
- onCheckedChange={setAccepted}
104
- required
105
- color='primary'
106
- size='md'
107
- />
108
- );
109
- }
110
- ```
111
-
112
- ### Radio Notes
113
-
114
- Use standalone `Radio` for low-level composition. Prefer `RadioGroup` when the
115
- choice belongs to a single saved form value.
116
-
117
- ```tsx
118
- import { Radio, RadioGroup } from '@vellira-ui/react';
119
- import { useState } from 'react';
120
-
121
- export function PlanRadioGroup() {
122
- const [plan, setPlan] = useState('pro');
123
-
124
- return (
125
- <RadioGroup
126
- name='plan'
127
- label='Plan'
128
- description='Choose the billing plan.'
129
- value={plan}
130
- onValueChange={setPlan}
131
- color='primary'
132
- size='md'
133
- >
134
- <Radio value='starter' label='Starter' />
135
- <Radio value='pro' label='Pro' />
136
- <Radio value='enterprise' label='Enterprise' />
137
- </RadioGroup>
138
- );
139
- }
140
- ```
141
-
142
- ### FormField Notes
143
-
144
- Use `FormField` for custom controls that do not render their own field chrome.
145
- `bindControl` is useful for native form controls because it injects generated
146
- ids and ARIA state into the direct child.
147
-
148
- ```tsx
149
- import { FormField } from '@vellira-ui/react';
150
-
151
- <FormField
152
- label='Workspace'
153
- description='Connected through generated id and aria props.'
154
- error='Use lowercase letters, numbers and hyphens.'
155
- required
156
- bindControl
157
- >
158
- <input placeholder='vellira-design' />
159
- </FormField>;
160
- ```
161
-
162
- ### Select Notes
163
-
164
- Use `Select` for one or more saved form values from a compact list,
165
- `RadioGroup` for a few visible choices, and `Dropdown` for action menus. Prefer
166
- a visible `label`; if the design has no visible label, provide `aria-label`.
167
-
168
- ```tsx
169
- import { Select } from '@vellira-ui/react';
170
- import { useState } from 'react';
171
-
172
- export function RoleSelect() {
173
- const [role, setRole] = useState('editor');
174
-
175
- return (
176
- <Select label='Role' value={role} onValueChange={setRole}>
177
- <Select.Item value='admin'>Admin</Select.Item>
178
- <Select.Item value='editor'>Editor</Select.Item>
179
- <Select.Item value='viewer'>Viewer</Select.Item>
180
- </Select>
181
- );
182
- }
183
- ```
184
-
185
- ```tsx
186
- export function TeamSelect() {
187
- const [teams, setTeams] = useState<string[]>(['product']);
188
-
189
- return (
190
- <Select
191
- label='Teams'
192
- description='Choose teams by item or group.'
193
- value={teams}
194
- onValueChange={setTeams}
195
- multiple
196
- maxSelected={12}
197
- closeOnSelect={false}
198
- searchable
199
- clearable
200
- color='primary'
201
- variant='outline'
202
- >
203
- <Select.Group label='Core teams' selectable selectLabel='All core teams'>
204
- <Select.Item value='product'>Product</Select.Item>
205
- <Select.Item value='engineering'>Engineering</Select.Item>
206
- <Select.Item value='design'>Design</Select.Item>
207
- <Select.Item value='research'>Research</Select.Item>
208
- <Select.Item value='data'>Data</Select.Item>
209
- </Select.Group>
210
- <Select.Separator />
211
- <Select.Group label='Operations' selectable>
212
- <Select.Item value='support'>Support</Select.Item>
213
- <Select.Item value='success'>Success</Select.Item>
214
- <Select.Item value='sales'>Sales</Select.Item>
215
- <Select.Item value='marketing'>Marketing</Select.Item>
216
- <Select.Item value='finance'>Finance</Select.Item>
217
- </Select.Group>
218
- <Select.Separator />
219
- <Select.Group label='Platform' selectable>
220
- <Select.Item value='infrastructure'>Infrastructure</Select.Item>
221
- <Select.Item value='security'>Security</Select.Item>
222
- <Select.Item value='devex'>Developer Experience</Select.Item>
223
- <Select.Item value='qa'>QA</Select.Item>
224
- </Select.Group>
225
- </Select>
226
- );
227
- }
228
- ```
229
-
230
- For custom composition, use the compound parts directly:
231
-
232
- ```tsx
233
- <Select label='Country' value={country} onValueChange={setCountry}>
234
- <Select.Trigger>
235
- <Select.Value />
236
- <Select.Icon />
237
- </Select.Trigger>
238
- <Select.Content>
239
- <Select.Search placeholder='Search country' />
240
- <Select.Label>Europe</Select.Label>
241
- <Select.Item value='fr'>
242
- <Select.ItemIcon>FR</Select.ItemIcon>
243
- France
244
- <Select.ItemDescription>Paris workspace</Select.ItemDescription>
245
- <Select.ItemBadge>EU</Select.ItemBadge>
246
- </Select.Item>
247
- <Select.Separator />
248
- <Select.Empty>No countries found</Select.Empty>
249
- <Select.Loading>Loading countries...</Select.Loading>
250
- </Select.Content>
251
- </Select>
252
- ```
253
-
254
- In multiple mode, `Select.Group selectable` adds a group-level action. It
255
- selects enabled items until `maxSelected` is reached and clears the group when
256
- all selectable group items are already selected. For long lists, reopening the
257
- dropdown keeps the selected item active and visible.
57
+ ## Components
258
58
 
259
- ### Dropdown Notes
59
+ ### Inputs
260
60
 
261
- Use `Dropdown` for contextual actions, not saved form values. Compose actions
262
- with `Dropdown.Trigger`, `Dropdown.Content`, `Dropdown.Item`, groups, labels,
263
- and separators. Use `open`, `defaultOpen`, and `onOpenChange` for menu state.
264
- Use root `color` for the semantic trigger and menu palette, and item
265
- `color='danger'` for destructive commands.
61
+ - Button
62
+ - Checkbox
63
+ - Input
64
+ - Radio
65
+ - RadioGroup
66
+ - Select
266
67
 
267
- ```tsx
268
- import { Dropdown } from '@vellira-ui/react';
68
+ ### Overlays
269
69
 
270
- <Dropdown color='primary'>
271
- <Dropdown.Trigger>Actions</Dropdown.Trigger>
272
- <Dropdown.Content>
273
- <Dropdown.Group>
274
- <Dropdown.Label>File</Dropdown.Label>
275
- <Dropdown.Item description='Creates a copy' onSelect={duplicate}>
276
- Duplicate
277
- </Dropdown.Item>
278
- </Dropdown.Group>
279
- <Dropdown.Separator />
280
- <Dropdown.Item color='danger' onSelect={deleteFile}>
281
- Delete
282
- </Dropdown.Item>
283
- </Dropdown.Content>
284
- </Dropdown>;
285
- ```
70
+ - Dropdown
71
+ - Tooltip
72
+ - Popover
73
+ - Modal
286
74
 
287
- ### FormField Notes
75
+ ### Forms
288
76
 
289
- `FormField` is a presentational wrapper for custom web controls. Pass `id` to
290
- `FormField` and the same `id` to the wrapped control; the root wrapper does not
291
- receive that `id`, which avoids duplicate DOM ids. The child control remains
292
- responsible for `aria-describedby`, `aria-invalid`, `required`, `disabled` and
293
- interaction behavior.
77
+ - FormField
78
+ - Tabs
294
79
 
295
- ## Testing
80
+ Every public component includes Storybook stories and Vitest unit tests.
296
81
 
297
- Run only web tests:
82
+ For detailed props, shared types, examples, and compound component APIs, see
83
+ [Web Component API](./API.md).
298
84
 
299
- ```bash
300
- pnpm --filter @vellira-ui/react test
301
- ```
85
+ ## Documentation
302
86
 
303
- The web package uses Vitest with `jsdom`. Tests live next to components as `*.test.tsx` and use a small local render helper based on `react-dom/client`.
87
+ - [Getting Started](https://docs.vellira.dev/getting-started)
88
+ - [Components](https://docs.vellira.dev/components)
89
+ - [Web Component API](./API.md)
304
90
 
305
91
  ## Storybook
306
92
 
307
- Run web Storybook from the workspace root:
308
-
309
- ```bash
310
- pnpm --filter @vellira-ui/react-storybook dev
311
- ```
312
-
313
- Stories live next to components as `*.stories.tsx` and are also used for Chromatic visual review.
93
+ Explore every component in
94
+ [Storybook](https://storybook.vellira.dev/).
314
95
 
315
96
  ## Development
316
97