@superslate/ui 0.0.0-stage → 0.1.1
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 +85 -2
- package/dist/base.css +110 -0
- package/dist/cli.js +205 -0
- package/dist/components/accordion/Accordion.d.ts +24 -0
- package/dist/components/alert/Alert.d.ts +13 -0
- package/dist/components/alert-dialog/AlertDialog.d.ts +33 -0
- package/dist/components/avatar/Avatar.d.ts +14 -0
- package/dist/components/badge/Badge.d.ts +9 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +15 -0
- package/dist/components/button/Button.d.ts +17 -0
- package/dist/components/card/Card.d.ts +18 -0
- package/dist/components/checkbox/Checkbox.d.ts +19 -0
- package/dist/components/dialog/Dialog.d.ts +43 -0
- package/dist/components/drawer/Drawer.d.ts +44 -0
- package/dist/components/empty-state/EmptyState.d.ts +9 -0
- package/dist/components/field/Field.d.ts +29 -0
- package/dist/components/input/Input.d.ts +15 -0
- package/dist/components/kbd/Kbd.d.ts +5 -0
- package/dist/components/menu/Menu.d.ts +41 -0
- package/dist/components/pagination/Pagination.d.ts +14 -0
- package/dist/components/popover/Popover.d.ts +38 -0
- package/dist/components/select/Select.d.ts +38 -0
- package/dist/components/separator/Separator.d.ts +6 -0
- package/dist/components/skeleton/Skeleton.d.ts +7 -0
- package/dist/components/spinner/Spinner.d.ts +7 -0
- package/dist/components/switch/Switch.d.ts +18 -0
- package/dist/components/tabs/Tabs.d.ts +28 -0
- package/dist/components/toast/Toast.d.ts +15 -0
- package/dist/components/tooltip/Tooltip.d.ts +29 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +2047 -0
- package/dist/registry/accordion.json +26 -0
- package/dist/registry/alert-dialog.json +26 -0
- package/dist/registry/alert.json +23 -0
- package/dist/registry/avatar.json +22 -0
- package/dist/registry/badge.json +22 -0
- package/dist/registry/breadcrumb.json +23 -0
- package/dist/registry/button.json +22 -0
- package/dist/registry/card.json +22 -0
- package/dist/registry/checkbox.json +26 -0
- package/dist/registry/dialog.json +27 -0
- package/dist/registry/drawer.json +27 -0
- package/dist/registry/empty-state.json +22 -0
- package/dist/registry/field.json +22 -0
- package/dist/registry/input.json +23 -0
- package/dist/registry/kbd.json +22 -0
- package/dist/registry/menu.json +26 -0
- package/dist/registry/pagination.json +26 -0
- package/dist/registry/popover.json +27 -0
- package/dist/registry/registry.json +385 -0
- package/dist/registry/select.json +27 -0
- package/dist/registry/separator.json +22 -0
- package/dist/registry/shared.json +37 -0
- package/dist/registry/skeleton.json +22 -0
- package/dist/registry/spinner.json +22 -0
- package/dist/registry/switch.json +25 -0
- package/dist/registry/tabs.json +25 -0
- package/dist/registry/toast.json +26 -0
- package/dist/registry/tooltip.json +26 -0
- package/dist/styles.css +231 -0
- package/dist/themes.css +83 -0
- package/dist/tokens.css +118 -0
- package/dist/utils/cn.d.ts +1 -0
- package/dist/utils/icons.d.ts +15 -0
- package/dist/utils/slot.d.ts +8 -0
- package/package.json +115 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Supercollective (https://superslate.dev)
|
|
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
CHANGED
|
@@ -1,3 +1,86 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@superslate/ui`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Accessible React 19 UI primitives built on **Zag.js** state machines, **plain CSS Modules**, and **OKLCH semantic tokens**. Zero Tailwind required.
|
|
4
|
+
|
|
5
|
+
Use it as a versioned npm library **or** copy the uncompiled `.tsx` and `.module.css` source directly into your repository via the built-in CLI.
|
|
6
|
+
|
|
7
|
+
- **Interactive Studio & Playground:** [superslate.dev/ui](https://superslate.dev/ui/)
|
|
8
|
+
- **Static Component Registry:** [superslate.dev/ui/r/registry.json](https://superslate.dev/ui/r/registry.json)
|
|
9
|
+
- **Built by:** [Superslate](https://superslate.dev/?ref=ui) — source-owned TypeScript SaaS foundation
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
### Option A: Copy source into your repo (CLI)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @superslate/ui init
|
|
17
|
+
npx @superslate/ui add button dialog select tabs toast
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Import the generated `styles/index.css` once in your application entry and install only the `@zag-js/*` machines required by the components you added.
|
|
21
|
+
|
|
22
|
+
### Option B: Install as an npm package
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @superslate/ui
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import '@superslate/ui/styles.css'
|
|
30
|
+
import {Button, Dialog} from '@superslate/ui'
|
|
31
|
+
|
|
32
|
+
export function Example() {
|
|
33
|
+
return (
|
|
34
|
+
<Dialog.Root>
|
|
35
|
+
<Dialog.Trigger asChild>
|
|
36
|
+
<Button>Open dialog</Button>
|
|
37
|
+
</Dialog.Trigger>
|
|
38
|
+
<Dialog.Content>
|
|
39
|
+
<Dialog.Header>
|
|
40
|
+
<Dialog.Title>Workspace settings</Dialog.Title>
|
|
41
|
+
<Dialog.Description>Powered by Zag.js and plain CSS Modules.</Dialog.Description>
|
|
42
|
+
</Dialog.Header>
|
|
43
|
+
</Dialog.Content>
|
|
44
|
+
</Dialog.Root>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Theme Presets
|
|
50
|
+
|
|
51
|
+
Neutral light and dark OKLCH tokens ship by default (`.dark` or `[data-ui-mode="dark"]`). For additional presets, import `@superslate/ui/themes.css` and set `data-ui-theme="cobalt"` or `data-ui-theme="stone"` on `<html>`.
|
|
52
|
+
|
|
53
|
+
## Components (26)
|
|
54
|
+
|
|
55
|
+
### Zag.js Interactive Primitives (13)
|
|
56
|
+
|
|
57
|
+
| Component | State Machine | Exports |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
| `accordion` | `@zag-js/accordion` | `Accordion.Root`, `Item`, `Trigger`, `Content` |
|
|
60
|
+
| `alert-dialog` | `@zag-js/dialog` | `AlertDialog.Root`, `Trigger`, `Content`, `Header`, `Title`, `Description`, `Footer`, `Cancel`, `Action` |
|
|
61
|
+
| `checkbox` | `@zag-js/checkbox` | `Checkbox` |
|
|
62
|
+
| `dialog` | `@zag-js/dialog` | `Dialog.Root`, `Trigger`, `Content`, `Header`, `Title`, `Description`, `Body`, `Footer`, `Close` |
|
|
63
|
+
| `drawer` | `@zag-js/dialog` | `Drawer.Root`, `Trigger`, `Content`, `Header`, `Title`, `Description`, `Body`, `Footer`, `Close` |
|
|
64
|
+
| `menu` | `@zag-js/menu` | `Menu.Root`, `Trigger`, `Content`, `Item`, `Separator`, `Group` |
|
|
65
|
+
| `pagination` | `@zag-js/pagination` | `Pagination` |
|
|
66
|
+
| `popover` | `@zag-js/popover` | `Popover.Root`, `Trigger`, `Content`, `Header`, `Title`, `Description`, `Close` |
|
|
67
|
+
| `select` | `@zag-js/select` | `Select.Root`, `Trigger`, `Content`, `Item` |
|
|
68
|
+
| `switch` | `@zag-js/switch` | `Switch` |
|
|
69
|
+
| `tabs` | `@zag-js/tabs` | `Tabs.Root`, `List`, `Trigger`, `Content` |
|
|
70
|
+
| `toast` | `@zag-js/toast` | `Toaster`, `toaster`, `createToaster` |
|
|
71
|
+
| `tooltip` | `@zag-js/tooltip` | `Tooltip.Root`, `Trigger`, `Content` |
|
|
72
|
+
|
|
73
|
+
### Core Form & Presentation Primitives (13)
|
|
74
|
+
|
|
75
|
+
`alert`, `avatar`, `badge`, `breadcrumb`, `button`, `card`, `empty-state`, `field`, `input` (`Input` + `Textarea`), `kbd`, `separator`, `skeleton`, `spinner`.
|
|
76
|
+
|
|
77
|
+
## Development
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
bun install --frozen-lockfile
|
|
81
|
+
bun run verify
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT — see [LICENSE](./LICENSE).
|
package/dist/base.css
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
.ss-sr-only {
|
|
2
|
+
position: absolute;
|
|
3
|
+
width: 1px;
|
|
4
|
+
height: 1px;
|
|
5
|
+
padding: 0;
|
|
6
|
+
margin: -1px;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
clip: rect(0, 0, 0, 0);
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
border: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@keyframes ss-fade-in {
|
|
14
|
+
from {
|
|
15
|
+
opacity: 0;
|
|
16
|
+
}
|
|
17
|
+
to {
|
|
18
|
+
opacity: 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@keyframes ss-fade-out {
|
|
23
|
+
from {
|
|
24
|
+
opacity: 1;
|
|
25
|
+
}
|
|
26
|
+
to {
|
|
27
|
+
opacity: 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@keyframes ss-enter {
|
|
32
|
+
from {
|
|
33
|
+
opacity: 0;
|
|
34
|
+
transform: scale(0.96) translateY(-2px);
|
|
35
|
+
}
|
|
36
|
+
to {
|
|
37
|
+
opacity: 1;
|
|
38
|
+
transform: scale(1) translateY(0);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@keyframes ss-dialog-enter {
|
|
43
|
+
from {
|
|
44
|
+
opacity: 0;
|
|
45
|
+
transform: translate(-50%, -48%) scale(0.96);
|
|
46
|
+
}
|
|
47
|
+
to {
|
|
48
|
+
opacity: 1;
|
|
49
|
+
transform: translate(-50%, -50%) scale(1);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@keyframes ss-slide-right {
|
|
54
|
+
from {
|
|
55
|
+
transform: translateX(100%);
|
|
56
|
+
}
|
|
57
|
+
to {
|
|
58
|
+
transform: translateX(0);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@keyframes ss-slide-left {
|
|
63
|
+
from {
|
|
64
|
+
transform: translateX(-100%);
|
|
65
|
+
}
|
|
66
|
+
to {
|
|
67
|
+
transform: translateX(0);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@keyframes ss-slide-bottom {
|
|
72
|
+
from {
|
|
73
|
+
transform: translateY(100%);
|
|
74
|
+
}
|
|
75
|
+
to {
|
|
76
|
+
transform: translateY(0);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@keyframes ss-toast-in {
|
|
81
|
+
from {
|
|
82
|
+
opacity: 0;
|
|
83
|
+
transform: translateY(8px) scale(0.98);
|
|
84
|
+
}
|
|
85
|
+
to {
|
|
86
|
+
opacity: 1;
|
|
87
|
+
transform: translateY(0) scale(1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@keyframes ss-pulse {
|
|
92
|
+
50% {
|
|
93
|
+
opacity: 0.45;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@keyframes ss-spin {
|
|
98
|
+
to {
|
|
99
|
+
transform: rotate(360deg);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@media (prefers-reduced-motion: reduce) {
|
|
104
|
+
[data-scope] *,
|
|
105
|
+
[data-ss-ui] * {
|
|
106
|
+
animation-duration: 0.01ms !important;
|
|
107
|
+
animation-iteration-count: 1 !important;
|
|
108
|
+
transition-duration: 0.01ms !important;
|
|
109
|
+
}
|
|
110
|
+
}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli.ts
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
5
|
+
import { dirname, join, resolve } from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
var DEFAULT_CONFIG = {
|
|
8
|
+
uiDir: "src/components/ui",
|
|
9
|
+
overwrite: false
|
|
10
|
+
};
|
|
11
|
+
var CONFIG_FILE = "superslate-ui.json";
|
|
12
|
+
function getBundledRegistryDir() {
|
|
13
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
const candidates = [join(here, "registry"), join(here, "../dist/registry")];
|
|
15
|
+
for (const candidate of candidates) {
|
|
16
|
+
if (existsSync(join(candidate, "registry.json"))) return candidate;
|
|
17
|
+
}
|
|
18
|
+
throw new Error("Bundled registry not found. Run `bun run build:registry` first.");
|
|
19
|
+
}
|
|
20
|
+
function readJson(filePath) {
|
|
21
|
+
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
22
|
+
}
|
|
23
|
+
function loadConfig(cwd) {
|
|
24
|
+
const configPath = join(cwd, CONFIG_FILE);
|
|
25
|
+
if (!existsSync(configPath)) return DEFAULT_CONFIG;
|
|
26
|
+
const parsed = readJson(configPath);
|
|
27
|
+
return {
|
|
28
|
+
uiDir: parsed.uiDir ?? DEFAULT_CONFIG.uiDir,
|
|
29
|
+
overwrite: parsed.overwrite ?? DEFAULT_CONFIG.overwrite
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function writeTargetFile(fullPath, content, overwrite) {
|
|
33
|
+
if (existsSync(fullPath) && !overwrite) return "skipped";
|
|
34
|
+
mkdirSync(dirname(fullPath), { recursive: true });
|
|
35
|
+
writeFileSync(fullPath, content);
|
|
36
|
+
return "written";
|
|
37
|
+
}
|
|
38
|
+
function parseFlags(args) {
|
|
39
|
+
let cwd = process.cwd();
|
|
40
|
+
let dirOverride;
|
|
41
|
+
let overwrite = false;
|
|
42
|
+
let all = false;
|
|
43
|
+
const positionals = [];
|
|
44
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
45
|
+
const arg = args[i];
|
|
46
|
+
if (!arg) continue;
|
|
47
|
+
if (arg === "--yes" || arg === "--overwrite" || arg === "-y") {
|
|
48
|
+
overwrite = true;
|
|
49
|
+
} else if (arg === "--all") {
|
|
50
|
+
all = true;
|
|
51
|
+
} else if (arg === "--dir" || arg === "-d") {
|
|
52
|
+
dirOverride = args[++i];
|
|
53
|
+
} else if (arg === "--cwd") {
|
|
54
|
+
cwd = resolve(args[++i] ?? process.cwd());
|
|
55
|
+
} else if (!arg.startsWith("-")) {
|
|
56
|
+
positionals.push(arg);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return { cwd, dirOverride, overwrite, all, positionals };
|
|
60
|
+
}
|
|
61
|
+
function runInit(args) {
|
|
62
|
+
const { cwd, dirOverride, overwrite } = parseFlags(args);
|
|
63
|
+
const registryDir = getBundledRegistryDir();
|
|
64
|
+
const shared = readJson(join(registryDir, "shared.json"));
|
|
65
|
+
const config = {
|
|
66
|
+
uiDir: dirOverride ?? DEFAULT_CONFIG.uiDir,
|
|
67
|
+
overwrite
|
|
68
|
+
};
|
|
69
|
+
const configPath = join(cwd, CONFIG_FILE);
|
|
70
|
+
writeFileSync(configPath, JSON.stringify({ uiDir: config.uiDir }, null, 2) + "\n");
|
|
71
|
+
const baseDir = resolve(cwd, config.uiDir);
|
|
72
|
+
const keys = ["styles/tokens", "styles/themes", "styles/base", "styles/index", "utils/cn", "utils/icons", "utils/slot"];
|
|
73
|
+
const written = [];
|
|
74
|
+
const skipped = [];
|
|
75
|
+
for (const key of keys) {
|
|
76
|
+
const entry = shared[key];
|
|
77
|
+
if (!entry) continue;
|
|
78
|
+
const target = join(baseDir, entry.path);
|
|
79
|
+
const status = writeTargetFile(target, entry.content, overwrite);
|
|
80
|
+
const rel = join(config.uiDir, entry.path);
|
|
81
|
+
if (status === "written") written.push(rel);
|
|
82
|
+
else skipped.push(rel);
|
|
83
|
+
}
|
|
84
|
+
console.log(`Initialized @superslate/ui in ${config.uiDir}`);
|
|
85
|
+
console.log(` config: ${CONFIG_FILE}`);
|
|
86
|
+
if (written.length > 0) console.log(` wrote: ${written.length} files`);
|
|
87
|
+
if (skipped.length > 0) console.log(` skipped: ${skipped.length} existing files (use --overwrite to replace)`);
|
|
88
|
+
console.log(`
|
|
89
|
+
Import ${config.uiDir}/styles/index.css in your app entry, then run:`);
|
|
90
|
+
console.log(" npx @superslate/ui add button dialog select");
|
|
91
|
+
}
|
|
92
|
+
function runList() {
|
|
93
|
+
const registryDir = getBundledRegistryDir();
|
|
94
|
+
const index = readJson(join(registryDir, "registry.json"));
|
|
95
|
+
console.log(`${index.name} v${index.version} \u2014 ${index.items.length} components
|
|
96
|
+
`);
|
|
97
|
+
for (const item of index.items) {
|
|
98
|
+
const tag = item.zag ? `[${item.zag}]` : "[core]";
|
|
99
|
+
console.log(` ${item.name.padEnd(15)} ${tag.padEnd(22)} ${item.description}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function runAdd(args) {
|
|
103
|
+
const { cwd, dirOverride, overwrite, all, positionals } = parseFlags(args);
|
|
104
|
+
const registryDir = getBundledRegistryDir();
|
|
105
|
+
const index = readJson(join(registryDir, "registry.json"));
|
|
106
|
+
const shared = readJson(join(registryDir, "shared.json"));
|
|
107
|
+
const config = loadConfig(cwd);
|
|
108
|
+
const uiDir = dirOverride ?? config.uiDir;
|
|
109
|
+
const forceOverwrite = overwrite || config.overwrite;
|
|
110
|
+
const baseDir = resolve(cwd, uiDir);
|
|
111
|
+
const requested = all ? index.items.map((i) => i.name) : positionals;
|
|
112
|
+
if (requested.length === 0) {
|
|
113
|
+
console.error("Specify at least one component name, or pass --all. Run `superslate-ui list` to see available components.");
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
const available = new Set(index.items.map((i) => i.name));
|
|
117
|
+
for (const name of requested) {
|
|
118
|
+
if (!available.has(name)) {
|
|
119
|
+
console.error(`Unknown component "${name}". Run \`superslate-ui list\` to see available components.`);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const componentQueue = [...requested];
|
|
124
|
+
const resolvedComponents = /* @__PURE__ */ new Set();
|
|
125
|
+
const resolvedShared = /* @__PURE__ */ new Set(["styles/tokens", "styles/base", "styles/index"]);
|
|
126
|
+
const npmDeps = /* @__PURE__ */ new Set();
|
|
127
|
+
while (componentQueue.length > 0) {
|
|
128
|
+
const name = componentQueue.shift();
|
|
129
|
+
if (resolvedComponents.has(name)) continue;
|
|
130
|
+
resolvedComponents.add(name);
|
|
131
|
+
const item = readJson(join(registryDir, `${name}.json`));
|
|
132
|
+
for (const dep of item.dependencies) npmDeps.add(dep);
|
|
133
|
+
for (const regDep of item.registryDependencies) {
|
|
134
|
+
if (regDep.startsWith("utils/") || regDep.startsWith("styles/")) {
|
|
135
|
+
resolvedShared.add(regDep);
|
|
136
|
+
} else if (available.has(regDep) && !resolvedComponents.has(regDep)) {
|
|
137
|
+
componentQueue.push(regDep);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const written = [];
|
|
142
|
+
const skipped = [];
|
|
143
|
+
for (const sharedKey of resolvedShared) {
|
|
144
|
+
const entry = shared[sharedKey];
|
|
145
|
+
if (!entry) continue;
|
|
146
|
+
const target = join(baseDir, entry.path);
|
|
147
|
+
const status = writeTargetFile(target, entry.content, forceOverwrite);
|
|
148
|
+
const rel = join(uiDir, entry.path);
|
|
149
|
+
if (status === "written") written.push(rel);
|
|
150
|
+
else skipped.push(rel);
|
|
151
|
+
}
|
|
152
|
+
for (const name of resolvedComponents) {
|
|
153
|
+
const item = readJson(join(registryDir, `${name}.json`));
|
|
154
|
+
for (const file of item.files) {
|
|
155
|
+
const target = join(baseDir, file.path);
|
|
156
|
+
const status = writeTargetFile(target, file.content, forceOverwrite);
|
|
157
|
+
const rel = join(uiDir, file.path);
|
|
158
|
+
if (status === "written") written.push(rel);
|
|
159
|
+
else skipped.push(rel);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
console.log(`Added ${resolvedComponents.size} component(s) to ${uiDir}:`);
|
|
163
|
+
for (const rel of written) console.log(` + ${rel}`);
|
|
164
|
+
if (skipped.length > 0) {
|
|
165
|
+
console.log(` (${skipped.length} existing file(s) kept; pass --overwrite to replace)`);
|
|
166
|
+
}
|
|
167
|
+
if (npmDeps.size > 0) {
|
|
168
|
+
console.log("\nInstall required Zag.js packages:");
|
|
169
|
+
console.log(` npm install ${[...npmDeps].sort().join(" ")}`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function showHelp() {
|
|
173
|
+
console.log(`@superslate/ui \u2014 Zag.js + CSS Modules UI CLI
|
|
174
|
+
|
|
175
|
+
Usage:
|
|
176
|
+
npx @superslate/ui init [--dir src/components/ui] [--overwrite]
|
|
177
|
+
npx @superslate/ui add <component...> [--all] [--dir path] [--overwrite]
|
|
178
|
+
npx @superslate/ui list
|
|
179
|
+
npx @superslate/ui help
|
|
180
|
+
|
|
181
|
+
Docs & interactive studio:
|
|
182
|
+
https://superslate.dev/ui/`);
|
|
183
|
+
}
|
|
184
|
+
var [, , command = "help", ...rest] = process.argv;
|
|
185
|
+
switch (command) {
|
|
186
|
+
case "init":
|
|
187
|
+
runInit(rest);
|
|
188
|
+
break;
|
|
189
|
+
case "add":
|
|
190
|
+
runAdd(rest);
|
|
191
|
+
break;
|
|
192
|
+
case "list":
|
|
193
|
+
case "ls":
|
|
194
|
+
runList();
|
|
195
|
+
break;
|
|
196
|
+
case "help":
|
|
197
|
+
case "-h":
|
|
198
|
+
case "--help":
|
|
199
|
+
showHelp();
|
|
200
|
+
break;
|
|
201
|
+
default:
|
|
202
|
+
console.error(`Unknown command: ${command}`);
|
|
203
|
+
showHelp();
|
|
204
|
+
process.exit(1);
|
|
205
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface AccordionRootProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue'> {
|
|
3
|
+
value?: string[];
|
|
4
|
+
defaultValue?: string[];
|
|
5
|
+
onValueChange?: (value: string[]) => void;
|
|
6
|
+
multiple?: boolean;
|
|
7
|
+
collapsible?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
variant?: 'default' | 'bordered';
|
|
10
|
+
}
|
|
11
|
+
export declare function AccordionRoot({ value, defaultValue, onValueChange, multiple, collapsible, disabled, variant, className, children, ...props }: AccordionRootProps): React.JSX.Element;
|
|
12
|
+
export interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
13
|
+
value: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function AccordionItem({ value, disabled, className, children, ...props }: AccordionItemProps): React.JSX.Element;
|
|
17
|
+
export declare function AccordionTrigger({ className, children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>): React.JSX.Element;
|
|
18
|
+
export declare function AccordionContent({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
19
|
+
export declare const Accordion: {
|
|
20
|
+
Root: typeof AccordionRoot;
|
|
21
|
+
Item: typeof AccordionItem;
|
|
22
|
+
Trigger: typeof AccordionTrigger;
|
|
23
|
+
Content: typeof AccordionContent;
|
|
24
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type AlertVariant = 'info' | 'success' | 'warning' | 'destructive';
|
|
3
|
+
export interface AlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
4
|
+
variant?: AlertVariant;
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
description?: React.ReactNode;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
closeLabel?: string;
|
|
9
|
+
icon?: React.ReactNode | false;
|
|
10
|
+
}
|
|
11
|
+
export declare function Alert({ variant, title, description, onClose, closeLabel, icon, children, className, ...props }: AlertProps): React.JSX.Element;
|
|
12
|
+
export declare function AlertTitle({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>): React.JSX.Element;
|
|
13
|
+
export declare function AlertDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>): React.JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface AlertDialogRootProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
open?: boolean;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function AlertDialogRoot({ children, open, defaultOpen, onOpenChange, }: AlertDialogRootProps): React.JSX.Element;
|
|
9
|
+
export interface AlertDialogTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function AlertDialogTrigger({ asChild, children, ...props }: AlertDialogTriggerProps): React.JSX.Element;
|
|
13
|
+
export declare function AlertDialogContent({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element | null;
|
|
14
|
+
export declare function AlertDialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
15
|
+
export declare function AlertDialogTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>): React.JSX.Element;
|
|
16
|
+
export declare function AlertDialogDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>): React.JSX.Element;
|
|
17
|
+
export declare function AlertDialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
18
|
+
export interface AlertDialogActionProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
19
|
+
asChild?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function AlertDialogCancel({ asChild, children, ...props }: AlertDialogActionProps): React.JSX.Element;
|
|
22
|
+
export declare function AlertDialogAction({ asChild, onClick, children, ...props }: AlertDialogActionProps): React.JSX.Element;
|
|
23
|
+
export declare const AlertDialog: {
|
|
24
|
+
Root: typeof AlertDialogRoot;
|
|
25
|
+
Trigger: typeof AlertDialogTrigger;
|
|
26
|
+
Content: typeof AlertDialogContent;
|
|
27
|
+
Header: typeof AlertDialogHeader;
|
|
28
|
+
Title: typeof AlertDialogTitle;
|
|
29
|
+
Description: typeof AlertDialogDescription;
|
|
30
|
+
Footer: typeof AlertDialogFooter;
|
|
31
|
+
Cancel: typeof AlertDialogCancel;
|
|
32
|
+
Action: typeof AlertDialogAction;
|
|
33
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
export type AvatarShape = 'circle' | 'rounded';
|
|
4
|
+
export type AvatarStatus = 'online' | 'busy' | 'away' | 'offline';
|
|
5
|
+
export interface AvatarProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
6
|
+
src?: string | null;
|
|
7
|
+
alt?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
fallback?: React.ReactNode;
|
|
10
|
+
size?: AvatarSize;
|
|
11
|
+
shape?: AvatarShape;
|
|
12
|
+
status?: AvatarStatus;
|
|
13
|
+
}
|
|
14
|
+
export declare function Avatar({ src, alt, name, fallback, size, shape, status, className, style, ...props }: AvatarProps): React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type BadgeVariant = 'default' | 'secondary' | 'outline' | 'success' | 'warning' | 'destructive' | 'info';
|
|
3
|
+
export type BadgeSize = 'sm' | 'md';
|
|
4
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
5
|
+
variant?: BadgeVariant;
|
|
6
|
+
size?: BadgeSize;
|
|
7
|
+
dot?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function Badge({ children, variant, size, dot, className, ...props }: BadgeProps): React.JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare function BreadcrumbRoot({ 'aria-label': ariaLabel, className, ...props }: React.HTMLAttributes<HTMLElement>): React.JSX.Element;
|
|
3
|
+
export declare function BreadcrumbList({ className, ...props }: React.OlHTMLAttributes<HTMLOListElement>): React.JSX.Element;
|
|
4
|
+
export declare function BreadcrumbItem({ className, ...props }: React.LiHTMLAttributes<HTMLLIElement>): React.JSX.Element;
|
|
5
|
+
export declare function BreadcrumbLink({ className, ...props }: React.AnchorHTMLAttributes<HTMLAnchorElement>): React.JSX.Element;
|
|
6
|
+
export declare function BreadcrumbPage({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): React.JSX.Element;
|
|
7
|
+
export declare function BreadcrumbSeparator({ children, className, ...props }: React.HTMLAttributes<HTMLSpanElement>): React.JSX.Element;
|
|
8
|
+
export declare const Breadcrumb: {
|
|
9
|
+
Root: typeof BreadcrumbRoot;
|
|
10
|
+
List: typeof BreadcrumbList;
|
|
11
|
+
Item: typeof BreadcrumbItem;
|
|
12
|
+
Link: typeof BreadcrumbLink;
|
|
13
|
+
Page: typeof BreadcrumbPage;
|
|
14
|
+
Separator: typeof BreadcrumbSeparator;
|
|
15
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type ButtonVariant = 'default' | 'secondary' | 'outline' | 'ghost' | 'destructive' | 'link';
|
|
3
|
+
export type ButtonSize = 'sm' | 'md' | 'lg' | 'icon';
|
|
4
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
size?: ButtonSize;
|
|
7
|
+
isLoading?: boolean;
|
|
8
|
+
leftIcon?: React.ReactNode;
|
|
9
|
+
rightIcon?: React.ReactNode;
|
|
10
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
11
|
+
}
|
|
12
|
+
export declare function buttonClassName({ variant, size, className, }?: {
|
|
13
|
+
variant?: ButtonVariant;
|
|
14
|
+
size?: ButtonSize;
|
|
15
|
+
className?: string;
|
|
16
|
+
}): string;
|
|
17
|
+
export declare function Button({ children, variant, size, type, isLoading, leftIcon, rightIcon, disabled, className, ref, ...props }: ButtonProps): React.JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
interactive?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function Card({ interactive, className, ...props }: CardProps): React.JSX.Element;
|
|
6
|
+
export interface CardHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
bordered?: boolean;
|
|
8
|
+
hasAction?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function CardHeader({ bordered, hasAction, className, ...props }: CardHeaderProps): React.JSX.Element;
|
|
11
|
+
export declare function CardTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>): React.JSX.Element;
|
|
12
|
+
export declare function CardDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>): React.JSX.Element;
|
|
13
|
+
export declare function CardAction({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
14
|
+
export declare function CardContent({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
15
|
+
export interface CardFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
16
|
+
bordered?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function CardFooter({ bordered, className, ...props }: CardFooterProps): React.JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type CheckedState = boolean | 'indeterminate';
|
|
3
|
+
export interface CheckboxProps {
|
|
4
|
+
label?: React.ReactNode;
|
|
5
|
+
description?: React.ReactNode;
|
|
6
|
+
checked?: CheckedState;
|
|
7
|
+
defaultChecked?: CheckedState;
|
|
8
|
+
onCheckedChange?: (checked: CheckedState) => void;
|
|
9
|
+
size?: 'sm' | 'md' | 'lg';
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
invalid?: boolean;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
readOnly?: boolean;
|
|
14
|
+
name?: string;
|
|
15
|
+
value?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function Checkbox({ label, description, checked, defaultChecked, onCheckedChange, size, disabled, invalid, required, readOnly, name, value, className, 'aria-label': ariaLabel, }: CheckboxProps): React.JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type DialogSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
export interface DialogRootProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
open?: boolean;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
onOpenChange?: (open: boolean) => void;
|
|
8
|
+
role?: 'dialog' | 'alertdialog';
|
|
9
|
+
closeOnInteractOutside?: boolean;
|
|
10
|
+
closeOnEscape?: boolean;
|
|
11
|
+
preventScroll?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function DialogRoot({ children, open, defaultOpen, onOpenChange, role, closeOnInteractOutside, closeOnEscape, preventScroll, }: DialogRootProps): React.JSX.Element;
|
|
14
|
+
export interface DialogTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
15
|
+
asChild?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function DialogTrigger({ asChild, children, ...props }: DialogTriggerProps): React.JSX.Element;
|
|
18
|
+
export interface DialogContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
19
|
+
size?: DialogSize;
|
|
20
|
+
showClose?: boolean;
|
|
21
|
+
closeLabel?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function DialogContent({ size, showClose, closeLabel, className, children, ...props }: DialogContentProps): React.JSX.Element | null;
|
|
24
|
+
export declare function DialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
25
|
+
export declare function DialogTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>): React.JSX.Element;
|
|
26
|
+
export declare function DialogDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>): React.JSX.Element;
|
|
27
|
+
export declare function DialogBody({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
28
|
+
export declare function DialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
29
|
+
export interface DialogCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
30
|
+
asChild?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function DialogClose({ asChild, children, ...props }: DialogCloseProps): React.JSX.Element;
|
|
33
|
+
export declare const Dialog: {
|
|
34
|
+
Root: typeof DialogRoot;
|
|
35
|
+
Trigger: typeof DialogTrigger;
|
|
36
|
+
Content: typeof DialogContent;
|
|
37
|
+
Header: typeof DialogHeader;
|
|
38
|
+
Title: typeof DialogTitle;
|
|
39
|
+
Description: typeof DialogDescription;
|
|
40
|
+
Body: typeof DialogBody;
|
|
41
|
+
Footer: typeof DialogFooter;
|
|
42
|
+
Close: typeof DialogClose;
|
|
43
|
+
};
|