@structyl/styled 1.0.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 +136 -0
- package/dist/index.cjs +8352 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4301 -0
- package/dist/index.d.ts +4301 -0
- package/dist/index.mjs +8202 -0
- package/dist/index.mjs.map +1 -0
- package/dist/tailwind-preset.cjs +677 -0
- package/dist/tailwind-preset.cjs.map +1 -0
- package/dist/tailwind-preset.d.cts +843 -0
- package/dist/tailwind-preset.d.ts +843 -0
- package/dist/tailwind-preset.mjs +675 -0
- package/dist/tailwind-preset.mjs.map +1 -0
- package/package.json +80 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 your-lib contributors
|
|
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,136 @@
|
|
|
1
|
+
# @structyl/styled
|
|
2
|
+
|
|
3
|
+
> The Tailwind-styled component layer for structyl — accessible behavior, ready-to-use styling.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
`@structyl/styled` pairs the headless, WAI-ARIA primitives from [`@structyl/primitives`](https://www.npmjs.com/package/@structyl/primitives) with a polished Tailwind CSS v4 styling layer. Every component is themable through CSS-variable design tokens, variants are type-safe via [tailwind-variants](https://www.tailwind-variants.org/), and the compound (dot-notation) API mirrors Radix. It is the drop-in styled tier of structyl for teams that want accessible components without building the design layer themselves.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# pnpm
|
|
14
|
+
pnpm add @structyl/styled
|
|
15
|
+
|
|
16
|
+
# npm
|
|
17
|
+
npm install @structyl/styled
|
|
18
|
+
|
|
19
|
+
# yarn
|
|
20
|
+
yarn add @structyl/styled
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Peer dependencies: `react`, `react-dom` (18 or 19) and `tailwindcss` (3.4+ or 4).
|
|
24
|
+
|
|
25
|
+
Add the theme preset to your Tailwind config so the design tokens and component styles resolve:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
// tailwind.config.ts
|
|
29
|
+
import type { Config } from 'tailwindcss';
|
|
30
|
+
import structylPreset from '@structyl/styled/tailwind-preset';
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
presets: [structylPreset],
|
|
34
|
+
content: [
|
|
35
|
+
'./src/**/*.{ts,tsx}',
|
|
36
|
+
'./node_modules/@structyl/styled/dist/**/*.{js,mjs}',
|
|
37
|
+
],
|
|
38
|
+
} satisfies Config;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
Simple components are named exports; multi-part components use the compound dot-notation API.
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { Button, Dialog } from '@structyl/styled';
|
|
47
|
+
|
|
48
|
+
export function Example() {
|
|
49
|
+
return (
|
|
50
|
+
<Dialog.Root>
|
|
51
|
+
<Dialog.Trigger asChild>
|
|
52
|
+
<Button variant="default" size="lg">
|
|
53
|
+
Open dialog
|
|
54
|
+
</Button>
|
|
55
|
+
</Dialog.Trigger>
|
|
56
|
+
|
|
57
|
+
<Dialog.Portal>
|
|
58
|
+
<Dialog.Overlay />
|
|
59
|
+
<Dialog.Content>
|
|
60
|
+
<Dialog.Header>
|
|
61
|
+
<Dialog.Title>Delete project</Dialog.Title>
|
|
62
|
+
<Dialog.Description>
|
|
63
|
+
This action cannot be undone.
|
|
64
|
+
</Dialog.Description>
|
|
65
|
+
</Dialog.Header>
|
|
66
|
+
|
|
67
|
+
<Dialog.Footer>
|
|
68
|
+
<Dialog.Close asChild>
|
|
69
|
+
<Button variant="outline">Cancel</Button>
|
|
70
|
+
</Dialog.Close>
|
|
71
|
+
<Button variant="destructive" loading loadingText="Deleting…">
|
|
72
|
+
Delete
|
|
73
|
+
</Button>
|
|
74
|
+
</Dialog.Footer>
|
|
75
|
+
</Dialog.Content>
|
|
76
|
+
</Dialog.Portal>
|
|
77
|
+
</Dialog.Root>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The imperative toast API is also exported directly:
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import { Toaster, toast } from '@structyl/styled';
|
|
86
|
+
|
|
87
|
+
function App() {
|
|
88
|
+
return (
|
|
89
|
+
<>
|
|
90
|
+
<Toaster />
|
|
91
|
+
<button onClick={() => toast({ title: 'Saved', description: 'Your changes are live.' })}>
|
|
92
|
+
Save
|
|
93
|
+
</button>
|
|
94
|
+
</>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Features
|
|
100
|
+
|
|
101
|
+
- **Accessible by default** — built on `@structyl/primitives`, conforming to WAI-ARIA APG patterns with full keyboard support.
|
|
102
|
+
- **Tailwind CSS v4 styling** — a shipped `tailwind-preset` wires up design tokens, dark mode, and animation utilities.
|
|
103
|
+
- **Runtime theming** — colors and surfaces are driven by CSS variables, so themes can change at runtime via `@structyl/themes`.
|
|
104
|
+
- **Type-safe variants** — `variant`, `size`, and `color` props are powered by `tailwind-variants` with exported `*Variants` helpers (e.g. `buttonVariants`).
|
|
105
|
+
- **Compound component API** — multi-part components use dot-notation namespaces (`Dialog.Root`, `Select.Trigger`, `Tabs.List`, …).
|
|
106
|
+
- **`asChild` composition** — interactive components forward behavior to a child element via the Slot pattern.
|
|
107
|
+
- **Imperative toasts** — `toast()`, `useToast()`, and `<Toaster />` for fire-and-forget notifications.
|
|
108
|
+
- **RSC compatible** — client components are marked `'use client'` and tested in the Next.js App Router.
|
|
109
|
+
|
|
110
|
+
## API
|
|
111
|
+
|
|
112
|
+
The package re-exports a large catalog of components. Highlights:
|
|
113
|
+
|
|
114
|
+
| Export | Kind | Description |
|
|
115
|
+
| --- | --- | --- |
|
|
116
|
+
| `Button`, `ButtonGroup` | Named | Action button with `variant`, `size`, `color`, `loading`, and icon props. |
|
|
117
|
+
| `Input`, `Textarea`, `Label`, `Checkbox`, `Switch`, `Slider` | Named | Form atoms. |
|
|
118
|
+
| `Dialog`, `AlertDialog`, `Sheet`, `Drawer` | Compound | Modal overlays. |
|
|
119
|
+
| `Popover`, `Tooltip`, `HoverCard` | Compound | Floating surfaces. |
|
|
120
|
+
| `DropdownMenu`, `ContextMenu`, `Menubar`, `NavigationMenu` | Compound | Menus and navigation. |
|
|
121
|
+
| `Select`, `MultiSelect`, `Combobox`, `Command` | Compound | Selection and command palettes. |
|
|
122
|
+
| `Tabs`, `Accordion`, `Collapsible`, `Stepper`, `Breadcrumb` | Compound | Disclosure and navigation. |
|
|
123
|
+
| `Toast`, `Toaster`, `toast`, `useToast` | Mixed | Declarative and imperative notifications. |
|
|
124
|
+
| `Calendar`, `DatePicker`, `DateRangePicker`, `TimePicker`, `DateTimePicker` | Mixed | Date and time pickers. |
|
|
125
|
+
| `Table`, `Chart`, `Timeline`, `Stat`, `Rating`, `Typography` | Mixed | Data display and content. |
|
|
126
|
+
| `buttonVariants`, `alertVariants` | Function | `tailwind-variants` helpers for composing class names. |
|
|
127
|
+
|
|
128
|
+
Component prop types are re-exported alongside each component (for example `ButtonProps`, `DialogContentProps`, `SelectRootProps`). See the [full reference](https://structyl.dev) for every export and prop.
|
|
129
|
+
|
|
130
|
+
## Part of structyl
|
|
131
|
+
|
|
132
|
+
This package is part of [structyl](https://github.com/imirfanul/structyl) — the React UI library with structure. Full documentation lives at [structyl.dev](https://structyl.dev).
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT
|