@wire-ui/solid 0.1.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/LICENSE +21 -0
- package/README.md +341 -0
- package/dist/components/accordion/Accordion.d.ts +13 -0
- package/dist/components/accordion/Accordion.types.d.ts +48 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/alert/Alert.d.ts +30 -0
- package/dist/components/alert/Alert.types.d.ts +25 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/avatar/Avatar.d.ts +35 -0
- package/dist/components/avatar/Avatar.types.d.ts +29 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/badge/Badge.d.ts +3 -0
- package/dist/components/badge/Badge.types.d.ts +14 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/button/Button.d.ts +4 -0
- package/dist/components/button/Button.types.d.ts +26 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/card/Card.d.ts +3 -0
- package/dist/components/card/Card.types.d.ts +18 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/checkbox/Checkbox.d.ts +13 -0
- package/dist/components/checkbox/Checkbox.types.d.ts +33 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/divider/Divider.d.ts +24 -0
- package/dist/components/divider/Divider.types.d.ts +27 -0
- package/dist/components/divider/index.d.ts +2 -0
- package/dist/components/drawer/Drawer.d.ts +17 -0
- package/dist/components/drawer/Drawer.types.d.ts +30 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/dropdown/Dropdown.d.ts +11 -0
- package/dist/components/dropdown/Dropdown.types.d.ts +22 -0
- package/dist/components/dropdown/index.d.ts +2 -0
- package/dist/components/icon/Icon.d.ts +3 -0
- package/dist/components/icon/Icon.types.d.ts +15 -0
- package/dist/components/icon/index.d.ts +3 -0
- package/dist/components/image/Image.d.ts +3 -0
- package/dist/components/image/Image.types.d.ts +20 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/input/Input.d.ts +12 -0
- package/dist/components/input/Input.types.d.ts +37 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/list/List.d.ts +3 -0
- package/dist/components/list/List.types.d.ts +9 -0
- package/dist/components/list/index.d.ts +2 -0
- package/dist/components/modal/Modal.d.ts +15 -0
- package/dist/components/modal/Modal.types.d.ts +26 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/otp/OTP.d.ts +10 -0
- package/dist/components/otp/OTP.types.d.ts +32 -0
- package/dist/components/otp/index.d.ts +2 -0
- package/dist/components/password/Password.d.ts +15 -0
- package/dist/components/password/Password.types.d.ts +37 -0
- package/dist/components/password/index.d.ts +2 -0
- package/dist/components/progress-bar/ProgressBar.d.ts +3 -0
- package/dist/components/progress-bar/ProgressBar.types.d.ts +16 -0
- package/dist/components/progress-bar/index.d.ts +2 -0
- package/dist/components/radio/Radio.d.ts +13 -0
- package/dist/components/radio/Radio.types.d.ts +33 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/rating/Rating.d.ts +20 -0
- package/dist/components/rating/Rating.types.d.ts +20 -0
- package/dist/components/rating/index.d.ts +2 -0
- package/dist/components/search/Search.d.ts +15 -0
- package/dist/components/search/Search.types.d.ts +51 -0
- package/dist/components/search/index.d.ts +2 -0
- package/dist/components/select/Select.d.ts +21 -0
- package/dist/components/select/Select.types.d.ts +38 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/switch/Switch.d.ts +9 -0
- package/dist/components/switch/Switch.types.d.ts +16 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/textarea/Textarea.d.ts +12 -0
- package/dist/components/textarea/Textarea.types.d.ts +39 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/timeago/Timeago.d.ts +3 -0
- package/dist/components/timeago/Timeago.types.d.ts +45 -0
- package/dist/components/timeago/index.d.ts +2 -0
- package/dist/components/tooltip/Tooltip.d.ts +11 -0
- package/dist/components/tooltip/Tooltip.types.d.ts +21 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/index.d.ts +31 -0
- package/dist/primitives/create-click-outside.d.ts +12 -0
- package/dist/primitives/create-interactive-state.d.ts +50 -0
- package/dist/primitives/index.d.ts +3 -0
- package/dist/types/common.d.ts +19 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/helper.d.ts +3 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/merge-props.d.ts +26 -0
- package/dist/wire-ui-solid.cjs.js +1 -0
- package/dist/wire-ui-solid.es.js +2627 -0
- package/package.json +92 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jerald Austero
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/wire-ui/wire-ui/main/apps/docs/public/images/logo/wire-ui-logo.svg" alt="Wire UI" height="52" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h3 align="center">Wire UI — SolidJS</h3>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
AI-native unstyled primitives framework. Headless, compound components with zero CSS.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/@wire-ui/solid"><img src="https://img.shields.io/npm/v/@wire-ui/solid?style=flat-square&colorA=0a0a0a&colorB=0a0a0a" alt="npm version" /></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@wire-ui/solid"><img src="https://img.shields.io/npm/dm/@wire-ui/solid?style=flat-square&colorA=0a0a0a&colorB=0a0a0a" alt="npm downloads" /></a>
|
|
14
|
+
<img src="https://img.shields.io/badge/solid--js-%3E%3D1.9.0-blue?style=flat-square&colorA=0a0a0a&colorB=0a0a0a" alt="solid-js >= 1.9" />
|
|
15
|
+
<a href="https://github.com/wire-ui/wire-ui/blob/main/packages/solid/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square&colorA=0a0a0a&colorB=0a0a0a" alt="MIT license" /></a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## What is Wire UI?
|
|
21
|
+
|
|
22
|
+
Wire UI is an AI-native, headless component library. Every component ships with **zero CSS** — style everything using your own classes by targeting `data-*` attributes that reflect interactive state. AI-integrated docs with `llms.txt` and machine-readable API references make it built for AI-assisted workflows.
|
|
23
|
+
|
|
24
|
+
- **AI-native.** AI-integrated docs with `llms.txt`, machine-readable API references, and MCP server support. Built for AI-assisted development.
|
|
25
|
+
- **Unstyled primitives.** No colors, spacing, or fonts baked in. You own every pixel of your design.
|
|
26
|
+
- **Compound components.** Complex widgets follow the `Component.Part` pattern, giving you full control over markup structure and element nesting.
|
|
27
|
+
- **State via `data-*` attributes.** Hover, focus, pressed, disabled, open — all exposed as `data-hover`, `data-focus-visible`, `data-active`, etc.
|
|
28
|
+
- **`asChild` polymorphism.** Merge all behaviour onto your own element — perfect for router links, icon buttons, and custom wrappers.
|
|
29
|
+
- **Consumer-owned validation.** Form components expose `invalidType` and `errorMessage` but never validate internally. Your logic, your rules.
|
|
30
|
+
|
|
31
|
+
> **Solid edition.** This is the SolidJS port of `@wire-ui/react`, targeting **Solid 1.9**. Behaviour and data-attribute APIs match the React package exactly. See the [Solid-specific notes](#solid-specific-notes) below for the small idiomatic differences.
|
|
32
|
+
|
|
33
|
+
## Documentation
|
|
34
|
+
|
|
35
|
+
Full documentation with live examples is at **[wire-ui.com](https://wire-ui.com)**.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install @wire-ui/solid
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Peer requirement**
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"solid-js": ">=1.9.0"
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Quick start
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { Button } from '@wire-ui/solid'
|
|
59
|
+
|
|
60
|
+
export default function App() {
|
|
61
|
+
return (
|
|
62
|
+
<Button
|
|
63
|
+
class="
|
|
64
|
+
px-4 py-2 rounded-lg bg-indigo-600 text-white font-medium
|
|
65
|
+
[data-hover]:bg-indigo-700
|
|
66
|
+
[data-active]:scale-95
|
|
67
|
+
[data-focus-visible]:ring-2 [data-focus-visible]:ring-indigo-500
|
|
68
|
+
[data-disabled]:opacity-40 [data-disabled]:cursor-not-allowed
|
|
69
|
+
"
|
|
70
|
+
>
|
|
71
|
+
Save changes
|
|
72
|
+
</Button>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Components
|
|
80
|
+
|
|
81
|
+
### Form inputs
|
|
82
|
+
|
|
83
|
+
| Component | Description |
|
|
84
|
+
|---|---|
|
|
85
|
+
| `Input` | Text input with label, error, and success states |
|
|
86
|
+
| `Textarea` | Multi-line input with the same compound API as Input |
|
|
87
|
+
| `Password` | Input with a built-in show/hide toggle |
|
|
88
|
+
| `Checkbox` | Group and individual checkbox items |
|
|
89
|
+
| `Radio` | Single-selection radio group |
|
|
90
|
+
| `Switch` | Toggle on/off with a thumb element |
|
|
91
|
+
| `OTP` | One-time password input with individual slots |
|
|
92
|
+
| `Select` | Accessible select menu with groups and separators |
|
|
93
|
+
| `Search` | Search input with keyboard-navigable results list |
|
|
94
|
+
|
|
95
|
+
### Overlay & dialog
|
|
96
|
+
|
|
97
|
+
| Component | Description |
|
|
98
|
+
|---|---|
|
|
99
|
+
| `Modal` | Dialog with portal rendering, overlay click-to-close, and Escape key |
|
|
100
|
+
| `Drawer` | Side-panel dialog — same structure as Modal |
|
|
101
|
+
| `Dropdown` | Trigger + floating menu with click-outside support |
|
|
102
|
+
| `Tooltip` | Hover/focus tooltip with configurable delay and side |
|
|
103
|
+
|
|
104
|
+
### Layout & navigation
|
|
105
|
+
|
|
106
|
+
| Component | Description |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `Accordion` | Collapsible sections — `single` or `multiple` open mode |
|
|
109
|
+
| `Divider` | Horizontal or vertical separator |
|
|
110
|
+
|
|
111
|
+
### Display
|
|
112
|
+
|
|
113
|
+
| Component | Description |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `Alert` | Dismissible alert with optional auto-dismiss |
|
|
116
|
+
| `Avatar` | Image with a text/initial fallback |
|
|
117
|
+
| `Badge` | Numeric count badge, capped at 9+ |
|
|
118
|
+
| `Card` | Container with optional color and size variants |
|
|
119
|
+
| `Icon` | SVG renderer from a consumer-supplied icon map |
|
|
120
|
+
| `Image` | Image with a loading placeholder |
|
|
121
|
+
| `List` | Ordered/unordered list with optional dividers and striping |
|
|
122
|
+
| `ProgressBar` | Accessible progress indicator |
|
|
123
|
+
| `Rating` | Interactive or read-only star rating |
|
|
124
|
+
| `Timeago` | Relative or formatted timestamp that updates live |
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Key concepts
|
|
129
|
+
|
|
130
|
+
### Data attributes
|
|
131
|
+
|
|
132
|
+
Attributes are present as an **empty string** when active, and **absent** when not — never `"true"` or `"false"`.
|
|
133
|
+
|
|
134
|
+
| Attribute | When present |
|
|
135
|
+
|---|---|
|
|
136
|
+
| `data-hover` | Mouse is over the element |
|
|
137
|
+
| `data-focus-visible` | Keyboard focus (mirrors `:focus-visible`) |
|
|
138
|
+
| `data-active` | Element is being pressed |
|
|
139
|
+
| `data-disabled` | Element is disabled |
|
|
140
|
+
| `data-state` | Open/closed, checked/unchecked — varies per component |
|
|
141
|
+
| `data-invalid` | Consumer-controlled via `invalidType` |
|
|
142
|
+
| `data-success` | Consumer-controlled via `isSuccess` |
|
|
143
|
+
|
|
144
|
+
Style them in Tailwind:
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
<Button class="[data-hover]:bg-blue-700 [data-active]:scale-95 [data-disabled]:opacity-50">
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Or in plain CSS:
|
|
151
|
+
|
|
152
|
+
```css
|
|
153
|
+
button[data-hover] { background: #1d4ed8; }
|
|
154
|
+
button[data-active] { transform: scale(0.95); }
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Compound components
|
|
158
|
+
|
|
159
|
+
Complex widgets follow the `Component.Part` pattern so you control the structure:
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
import { createSignal } from 'solid-js'
|
|
163
|
+
import { Input } from '@wire-ui/solid'
|
|
164
|
+
|
|
165
|
+
function EmailField() {
|
|
166
|
+
const [email, setEmail] = createSignal('')
|
|
167
|
+
const [error, setError] = createSignal('')
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<Input.Root value={email()} onChange={setEmail} invalidType={error()}>
|
|
171
|
+
<Input.Label>Email</Input.Label>
|
|
172
|
+
<Input.Field type="email" placeholder="you@example.com" />
|
|
173
|
+
<Input.Error />
|
|
174
|
+
</Input.Root>
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### `asChild` polymorphism
|
|
180
|
+
|
|
181
|
+
Pass `asChild` to merge behaviour onto your own element. The component evaluates the child to a DOM node and applies its `data-*` attributes and event listeners imperatively, so the child element renders as-is:
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
// Renders as <a> but with all Button data attributes
|
|
185
|
+
<Button asChild>
|
|
186
|
+
<a href="/dashboard">Go to dashboard</a>
|
|
187
|
+
</Button>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Consumer-owned validation
|
|
191
|
+
|
|
192
|
+
Set `invalidType` to a key and the component renders the matching error message — no internal validation ever runs:
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
<Input.Root
|
|
196
|
+
invalidType={error()} // e.g. "required" or "email"
|
|
197
|
+
errorMessage={{
|
|
198
|
+
required: 'Email is required',
|
|
199
|
+
email: 'Enter a valid email address',
|
|
200
|
+
}}
|
|
201
|
+
>
|
|
202
|
+
<Input.Field type="email" />
|
|
203
|
+
<Input.Error /> {/* renders the matching message */}
|
|
204
|
+
</Input.Root>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Primitives
|
|
210
|
+
|
|
211
|
+
### `createInteractiveState`
|
|
212
|
+
|
|
213
|
+
The same primitive used internally by `Button`, `Accordion.Trigger`, `Modal.Close`, and the rest — exported for building your own interactive elements. Pass an options object with a `disabled` getter to keep the value reactive:
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
import { createInteractiveState } from '@wire-ui/solid'
|
|
217
|
+
|
|
218
|
+
function MyCard(props: { disabled?: boolean }) {
|
|
219
|
+
const state = createInteractiveState({
|
|
220
|
+
get disabled() { return !!props.disabled },
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
return (
|
|
224
|
+
<div
|
|
225
|
+
{...state.handlers}
|
|
226
|
+
{...state.dataAttributes}
|
|
227
|
+
class="[data-hover]:bg-gray-100 [data-active]:scale-95"
|
|
228
|
+
>
|
|
229
|
+
Card content
|
|
230
|
+
</div>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### `createClickOutside`
|
|
236
|
+
|
|
237
|
+
Fires a callback when the user clicks outside a referenced element. Pass a getter accessor so the listener picks up ref changes:
|
|
238
|
+
|
|
239
|
+
```tsx
|
|
240
|
+
import { createSignal } from 'solid-js'
|
|
241
|
+
import { createClickOutside } from '@wire-ui/solid'
|
|
242
|
+
|
|
243
|
+
function Popover() {
|
|
244
|
+
const [, setOpen] = createSignal(true)
|
|
245
|
+
let rootEl: HTMLDivElement | undefined
|
|
246
|
+
|
|
247
|
+
createClickOutside(() => rootEl, () => setOpen(false))
|
|
248
|
+
|
|
249
|
+
return <div ref={rootEl}>Popover content</div>
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Solid-specific notes
|
|
256
|
+
|
|
257
|
+
`@wire-ui/solid` mirrors the React package's behaviour and data-attribute API exactly. The differences are idiomatic to Solid:
|
|
258
|
+
|
|
259
|
+
- **`class`, not `className`.** Solid uses the native HTML `class` attribute throughout.
|
|
260
|
+
- **`createSignal` over `useState`.** Same controlled/uncontrolled pattern, just with accessors.
|
|
261
|
+
- **Primitives instead of hooks.** `useInteractiveState` → `createInteractiveState`, `useClickOutside` → `createClickOutside`.
|
|
262
|
+
- **No `forwardRef`.** Refs are passed as plain props or callbacks in Solid 1.x.
|
|
263
|
+
- **`Show` / `For` instead of conditional / array rendering.** Necessary because Solid components run once at setup time.
|
|
264
|
+
- **`Portal` from `solid-js/web`.** Used internally by Modal and Drawer in place of `react-dom`'s `createPortal`.
|
|
265
|
+
- **Reactive options.** Where React passes plain values (e.g. `useInteractiveState({ disabled })`), the Solid equivalent expects either a static value or an object with a `get disabled()` getter so reactivity is preserved.
|
|
266
|
+
|
|
267
|
+
Targets **Solid 1.9** — Solid 2.0 is in beta as of March 2026; this package will track the 1.x line until 2.0 stabilises and a 2.x release lands.
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## TypeScript
|
|
272
|
+
|
|
273
|
+
All component props and utility types are exported:
|
|
274
|
+
|
|
275
|
+
```ts
|
|
276
|
+
import type {
|
|
277
|
+
ButtonProps,
|
|
278
|
+
InputRootProps,
|
|
279
|
+
TextareaRootProps,
|
|
280
|
+
PasswordRootProps,
|
|
281
|
+
ModalRootProps,
|
|
282
|
+
AccordionRootProps,
|
|
283
|
+
SearchOption,
|
|
284
|
+
IconName,
|
|
285
|
+
IconSize,
|
|
286
|
+
Size,
|
|
287
|
+
Status,
|
|
288
|
+
InteractiveStateOptions,
|
|
289
|
+
InteractiveStateResult,
|
|
290
|
+
} from '@wire-ui/solid'
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Development
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
# Install dependencies (from monorepo root)
|
|
299
|
+
npm install
|
|
300
|
+
|
|
301
|
+
# Run Storybook
|
|
302
|
+
npm run storybook
|
|
303
|
+
|
|
304
|
+
# Unit tests (watch mode)
|
|
305
|
+
npm test
|
|
306
|
+
|
|
307
|
+
# Unit tests (single run)
|
|
308
|
+
npm run test:run
|
|
309
|
+
|
|
310
|
+
# Unit tests with coverage
|
|
311
|
+
npm run test:coverage
|
|
312
|
+
|
|
313
|
+
# Type check + build
|
|
314
|
+
npm run build
|
|
315
|
+
|
|
316
|
+
# Lint
|
|
317
|
+
npm run lint
|
|
318
|
+
|
|
319
|
+
# Format
|
|
320
|
+
npm run format
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Community
|
|
326
|
+
|
|
327
|
+
- Follow on X: [@wireuijs](https://x.com/wireuijs)
|
|
328
|
+
|
|
329
|
+
## Authors
|
|
330
|
+
|
|
331
|
+
- Jerald Austero ([@jaoaustero](https://github.com/jaoaustero))
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Contributing
|
|
336
|
+
|
|
337
|
+
See the [contributing guide](../../CONTRIBUTING.md) for local development instructions and pull request guidelines.
|
|
338
|
+
|
|
339
|
+
## License
|
|
340
|
+
|
|
341
|
+
MIT License © 2026 Wire UI. See [LICENSE](./LICENSE) for details.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { AccordionContentProps, AccordionItemProps, AccordionRootProps, AccordionTriggerProps } from './Accordion.types';
|
|
3
|
+
declare function Root(props: AccordionRootProps): JSX.Element;
|
|
4
|
+
declare function Item(props: AccordionItemProps): JSX.Element;
|
|
5
|
+
declare function Trigger(props: AccordionTriggerProps): JSX.Element;
|
|
6
|
+
declare function Content(props: AccordionContentProps): JSX.Element;
|
|
7
|
+
export declare const Accordion: {
|
|
8
|
+
Root: typeof Root;
|
|
9
|
+
Item: typeof Item;
|
|
10
|
+
Trigger: typeof Trigger;
|
|
11
|
+
Content: typeof Content;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface AccordionContextValue {
|
|
3
|
+
isOpen: (value: string) => boolean;
|
|
4
|
+
toggle: (value: string) => void;
|
|
5
|
+
readonly disabled: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface AccordionItemContextValue {
|
|
8
|
+
value: string;
|
|
9
|
+
readonly isOpen: boolean;
|
|
10
|
+
readonly disabled: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface AccordionRootBase extends Omit<JSX.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
13
|
+
/** Disables all items */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface AccordionRootSingleProps extends AccordionRootBase {
|
|
17
|
+
type: 'single';
|
|
18
|
+
/** Controlled open value */
|
|
19
|
+
value?: string;
|
|
20
|
+
/** Initial open value (uncontrolled) */
|
|
21
|
+
defaultValue?: string;
|
|
22
|
+
/** Called when the open item changes */
|
|
23
|
+
onChange?: (value: string) => void;
|
|
24
|
+
/** Allow closing the open item by clicking it again (default: false) */
|
|
25
|
+
collapsible?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface AccordionRootMultipleProps extends AccordionRootBase {
|
|
28
|
+
type: 'multiple';
|
|
29
|
+
/** Controlled open values */
|
|
30
|
+
value?: string[];
|
|
31
|
+
/** Initial open values (uncontrolled) */
|
|
32
|
+
defaultValue?: string[];
|
|
33
|
+
/** Called when open items change */
|
|
34
|
+
onChange?: (value: string[]) => void;
|
|
35
|
+
}
|
|
36
|
+
export type AccordionRootProps = AccordionRootSingleProps | AccordionRootMultipleProps;
|
|
37
|
+
export interface AccordionItemProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
38
|
+
/** Unique identifier — must match the value used in Root */
|
|
39
|
+
value: string;
|
|
40
|
+
/** Disables this item only */
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export type AccordionTriggerProps = JSX.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
44
|
+
export interface AccordionContentProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
45
|
+
/** Keep content mounted in the DOM even when closed (useful for CSS animations) */
|
|
46
|
+
forceMount?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { AlertDescriptionProps, AlertDismissProps, AlertRootProps, AlertTitleProps } from './Alert.types';
|
|
3
|
+
/**
|
|
4
|
+
* The container for the Alert. Manages dismissal state and exposes:
|
|
5
|
+
* - `data-status` — for styling by status ('success', 'warning', 'danger', etc.)
|
|
6
|
+
*
|
|
7
|
+
* Renders nothing once dismissed.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <Alert.Root status="success" isAutoDismissable onDismiss={() => console.log('dismissed')}>
|
|
11
|
+
* <Alert.Title>Success!</Alert.Title>
|
|
12
|
+
* <Alert.Description>Your changes were saved.</Alert.Description>
|
|
13
|
+
* <Alert.Dismiss aria-label="Close" />
|
|
14
|
+
* </Alert.Root>
|
|
15
|
+
*/
|
|
16
|
+
declare function Root(props: AlertRootProps): JSX.Element;
|
|
17
|
+
declare function Title(props: AlertTitleProps): JSX.Element;
|
|
18
|
+
declare function Description(props: AlertDescriptionProps): JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* The dismiss button. Fires the Root's dismiss handler when clicked.
|
|
21
|
+
* Tracks hover/focus-visible/active state via data attributes.
|
|
22
|
+
*/
|
|
23
|
+
declare function Dismiss(props: AlertDismissProps): JSX.Element;
|
|
24
|
+
export declare const Alert: {
|
|
25
|
+
Root: typeof Root;
|
|
26
|
+
Title: typeof Title;
|
|
27
|
+
Description: typeof Description;
|
|
28
|
+
Dismiss: typeof Dismiss;
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/**
|
|
3
|
+
* Alert Component Types
|
|
4
|
+
*/
|
|
5
|
+
export type AlertContextValue = {
|
|
6
|
+
readonly status?: string;
|
|
7
|
+
dismiss: () => void;
|
|
8
|
+
};
|
|
9
|
+
/** Props for Alert.Root — the container. */
|
|
10
|
+
export interface AlertRootProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
/** Status data attribute for styling: 'success' | 'warning' | 'danger' or any string */
|
|
12
|
+
status?: string;
|
|
13
|
+
/** Auto-dismiss after timeout */
|
|
14
|
+
isAutoDismissable?: boolean;
|
|
15
|
+
/** Milliseconds before auto-dismiss (default: 3000) */
|
|
16
|
+
dismissCountdown?: number;
|
|
17
|
+
/** Fired when the alert is dismissed */
|
|
18
|
+
onDismiss?: () => void;
|
|
19
|
+
}
|
|
20
|
+
/** Props for Alert.Title */
|
|
21
|
+
export type AlertTitleProps = JSX.HTMLAttributes<HTMLParagraphElement>;
|
|
22
|
+
/** Props for Alert.Description */
|
|
23
|
+
export type AlertDescriptionProps = JSX.HTMLAttributes<HTMLParagraphElement>;
|
|
24
|
+
/** Props for Alert.Dismiss — the close button */
|
|
25
|
+
export type AlertDismissProps = JSX.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { AvatarFallbackProps, AvatarImageProps, AvatarRootProps } from './Avatar.types';
|
|
3
|
+
/**
|
|
4
|
+
* The container for the Avatar. Exposes `data-status` reflecting the current
|
|
5
|
+
* image load state: `"loading"`, `"loaded"`, or `"error"`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Avatar.Root class="...">
|
|
9
|
+
* <Avatar.Image src="..." alt="Jane Doe" />
|
|
10
|
+
* <Avatar.Fallback>JD</Avatar.Fallback>
|
|
11
|
+
* </Avatar.Root>
|
|
12
|
+
*/
|
|
13
|
+
declare function Root(props: AvatarRootProps): JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* The avatar image. Automatically reports its load state back to `Avatar.Root`
|
|
16
|
+
* via context — the Root's `data-status` updates to `"loaded"` or `"error"`.
|
|
17
|
+
*
|
|
18
|
+
* Hidden (not rendered) when `src` is empty/undefined so the Fallback shows
|
|
19
|
+
* immediately without a broken-image icon.
|
|
20
|
+
*/
|
|
21
|
+
declare function AvatarImage(props: AvatarImageProps): JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* Rendered when the image is still loading or has failed.
|
|
24
|
+
* Supply `delayMs` to avoid a flash of the fallback during fast loads.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <Avatar.Fallback delayMs={300}>JD</Avatar.Fallback>
|
|
28
|
+
*/
|
|
29
|
+
declare function Fallback(props: AvatarFallbackProps): JSX.Element;
|
|
30
|
+
export declare const Avatar: typeof Root & {
|
|
31
|
+
Root: typeof Root;
|
|
32
|
+
Image: typeof AvatarImage;
|
|
33
|
+
Fallback: typeof Fallback;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/**
|
|
3
|
+
* Avatar Component Types
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Image load status shared via context between Avatar sub-components.
|
|
7
|
+
*/
|
|
8
|
+
export type AvatarImageStatus = 'loading' | 'loaded' | 'error';
|
|
9
|
+
/**
|
|
10
|
+
* Props for Avatar.Root — the wrapping container element.
|
|
11
|
+
* Exposes `data-status` reflecting the current image load state.
|
|
12
|
+
*/
|
|
13
|
+
export type AvatarRootProps = JSX.HTMLAttributes<HTMLDivElement>;
|
|
14
|
+
/**
|
|
15
|
+
* Props for Avatar.Image — the actual `<img>` element.
|
|
16
|
+
* Automatically tracks load/error state and updates the Root's `data-status`.
|
|
17
|
+
*/
|
|
18
|
+
export type AvatarImageProps = JSX.ImgHTMLAttributes<HTMLImageElement>;
|
|
19
|
+
/**
|
|
20
|
+
* Props for Avatar.Fallback — rendered when the image is loading or failed.
|
|
21
|
+
*/
|
|
22
|
+
export interface AvatarFallbackProps extends JSX.HTMLAttributes<HTMLSpanElement> {
|
|
23
|
+
/**
|
|
24
|
+
* Delay in milliseconds before the fallback becomes visible.
|
|
25
|
+
* Useful to avoid a flash of the fallback during fast image loads.
|
|
26
|
+
* @default 0
|
|
27
|
+
*/
|
|
28
|
+
delayMs?: number;
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/**
|
|
3
|
+
* Badge Component Types
|
|
4
|
+
*
|
|
5
|
+
* Type definitions for the Badge component including props
|
|
6
|
+
* and related types.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Props interface for Badge component
|
|
10
|
+
*/
|
|
11
|
+
export interface BadgeProps extends JSX.HTMLAttributes<HTMLSpanElement> {
|
|
12
|
+
/** Count of notifications. Displays "9+" when count exceeds 9. */
|
|
13
|
+
count?: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/**
|
|
3
|
+
* Button Component Types
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Props for the Button component.
|
|
7
|
+
*
|
|
8
|
+
* When `asChild` is true, the component renders the child element as-is and
|
|
9
|
+
* applies its data-attributes / event listeners imperatively — useful for
|
|
10
|
+
* rendering as a router link, anchor, etc. The child must be a single element.
|
|
11
|
+
*
|
|
12
|
+
* When `asChild` is false (default), renders a native `<button>` element.
|
|
13
|
+
*/
|
|
14
|
+
export interface ButtonProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
15
|
+
/**
|
|
16
|
+
* When true, renders the child element directly instead of a `<button>`,
|
|
17
|
+
* applying data-state attributes and interactive-state event listeners to
|
|
18
|
+
* that element. The child must be a single element.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <Button asChild>
|
|
22
|
+
* <a href="/about">About</a>
|
|
23
|
+
* </Button>
|
|
24
|
+
*/
|
|
25
|
+
asChild?: boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/**
|
|
3
|
+
* Card Component Types
|
|
4
|
+
*
|
|
5
|
+
* Type definitions for the Card component including props
|
|
6
|
+
* and related types.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Props interface for Card component
|
|
10
|
+
*/
|
|
11
|
+
export interface CardProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
/** Color modifier for the card */
|
|
13
|
+
color?: string;
|
|
14
|
+
/** Size modifier that controls padding around the card */
|
|
15
|
+
size?: string;
|
|
16
|
+
/** Card content */
|
|
17
|
+
children?: JSX.Element;
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { CheckboxIndicatorProps, CheckboxItemProps, CheckboxLabelProps, CheckboxRootProps } from './Checkbox.types';
|
|
3
|
+
declare function Root(props: CheckboxRootProps): JSX.Element;
|
|
4
|
+
declare function Item(props: CheckboxItemProps): JSX.Element;
|
|
5
|
+
declare function Indicator(props: CheckboxIndicatorProps): JSX.Element;
|
|
6
|
+
declare function Label(props: CheckboxLabelProps): JSX.Element;
|
|
7
|
+
export declare const Checkbox: {
|
|
8
|
+
Root: typeof Root;
|
|
9
|
+
Item: typeof Item;
|
|
10
|
+
Indicator: typeof Indicator;
|
|
11
|
+
Label: typeof Label;
|
|
12
|
+
};
|
|
13
|
+
export {};
|