@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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://superslate.dev/ui/r/schema.json",
|
|
3
|
+
"name": "popover",
|
|
4
|
+
"title": "Popover",
|
|
5
|
+
"category": "interactive",
|
|
6
|
+
"zag": "@zag-js/popover",
|
|
7
|
+
"description": "Floating surface anchored to a trigger with arrow support and click-outside dismissal.",
|
|
8
|
+
"dependencies": [
|
|
9
|
+
"@zag-js/popover@1.48.0",
|
|
10
|
+
"@zag-js/react@1.48.0"
|
|
11
|
+
],
|
|
12
|
+
"registryDependencies": [
|
|
13
|
+
"utils/cn",
|
|
14
|
+
"utils/icons",
|
|
15
|
+
"utils/slot"
|
|
16
|
+
],
|
|
17
|
+
"files": [
|
|
18
|
+
{
|
|
19
|
+
"path": "components/popover/Popover.tsx",
|
|
20
|
+
"content": "import * as React from 'react'\nimport * as popover from '@zag-js/popover'\nimport type {Placement} from '@zag-js/popover'\nimport {Portal, normalizeProps, useMachine} from '@zag-js/react'\nimport {cn} from '../../utils/cn'\nimport {CloseIcon} from '../../utils/icons'\nimport {Slot} from '../../utils/slot'\nimport classes from './popover.module.css'\n\ntype PopoverApi = ReturnType<typeof popover.connect>\nexport type PopoverPlacement = Placement\n\nconst PopoverContext = React.createContext<PopoverApi | null>(null)\n\nfunction usePopoverApi(): PopoverApi {\n const ctx = React.useContext(PopoverContext)\n if (!ctx) throw new Error('Popover parts must be rendered inside Popover.Root')\n return ctx\n}\n\nexport interface PopoverRootProps {\n children: React.ReactNode\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n placement?: PopoverPlacement\n offset?: number\n modal?: boolean\n portalled?: boolean\n}\n\nexport function PopoverRoot({\n children,\n open,\n defaultOpen,\n onOpenChange,\n placement = 'bottom-start',\n offset = 8,\n modal = false,\n portalled = true,\n}: PopoverRootProps) {\n const isControlled = open !== undefined\n const service = useMachine(popover.machine, {\n id: React.useId(),\n ...(isControlled ? {open} : {defaultOpen}),\n modal,\n portalled,\n positioning: {\n placement,\n offset: {mainAxis: offset},\n },\n onOpenChange: details => onOpenChange?.(details.open),\n })\n const api = popover.connect(service, normalizeProps)\n return <PopoverContext.Provider value={api}>{children}</PopoverContext.Provider>\n}\n\nexport interface PopoverTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean\n}\n\nexport function PopoverTrigger({asChild = false, children, ...props}: PopoverTriggerProps) {\n const api = usePopoverApi()\n if (asChild) {\n return (\n <Slot {...api.getTriggerProps()} {...props}>\n {children}\n </Slot>\n )\n }\n return (\n <button type=\"button\" {...api.getTriggerProps()} {...props}>\n {children}\n </button>\n )\n}\n\nexport interface PopoverContentProps extends React.HTMLAttributes<HTMLDivElement> {\n hasArrow?: boolean\n}\n\nexport function PopoverContent({\n hasArrow = false,\n className,\n children,\n ...props\n}: PopoverContentProps) {\n const api = usePopoverApi()\n if (!api.open) return null\n const Wrapper = api.portalled ? Portal : React.Fragment\n\n return (\n <Wrapper>\n <div {...api.getPositionerProps()} className={classes.positioner}>\n <div\n {...api.getContentProps()}\n data-ss-ui=\"popover\"\n className={cn(classes.content, className)}\n {...props}\n >\n {hasArrow && (\n <div {...api.getArrowProps()} className={classes.arrow}>\n <div {...api.getArrowTipProps()} className={classes.arrowTip} />\n </div>\n )}\n {children}\n </div>\n </div>\n </Wrapper>\n )\n}\n\nexport function PopoverHeader({className, ...props}: React.HTMLAttributes<HTMLDivElement>) {\n return <div className={cn(classes.header, className)} {...props} />\n}\n\nexport function PopoverTitle({className, ...props}: React.HTMLAttributes<HTMLHeadingElement>) {\n const api = usePopoverApi()\n return <h3 {...api.getTitleProps()} className={cn(classes.title, className)} {...props} />\n}\n\nexport function PopoverDescription({\n className,\n ...props\n}: React.HTMLAttributes<HTMLParagraphElement>) {\n const api = usePopoverApi()\n return (\n <p {...api.getDescriptionProps()} className={cn(classes.description, className)} {...props} />\n )\n}\n\nexport interface PopoverCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean\n}\n\nexport function PopoverClose({\n asChild = false,\n className,\n children,\n 'aria-label': ariaLabel = 'Close popover',\n ...props\n}: PopoverCloseProps) {\n const api = usePopoverApi()\n if (asChild) {\n return (\n <Slot {...api.getCloseTriggerProps()} {...props}>\n {children}\n </Slot>\n )\n }\n return (\n <button\n type=\"button\"\n {...api.getCloseTriggerProps()}\n aria-label={ariaLabel}\n className={cn(classes.close, className)}\n {...props}\n >\n {children ?? <CloseIcon size={14} />}\n </button>\n )\n}\n\nexport const Popover = {\n Root: PopoverRoot,\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n Header: PopoverHeader,\n Title: PopoverTitle,\n Description: PopoverDescription,\n Close: PopoverClose,\n}\n"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"path": "components/popover/popover.module.css",
|
|
24
|
+
"content": ".positioner {\n --z-index: var(--z-overlay);\n z-index: var(--z-overlay);\n}\n\n.content {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 0.75rem;\n min-width: 14rem;\n max-width: 22rem;\n padding: 1rem;\n border: 1px solid var(--border);\n border-radius: var(--radius-md);\n background-color: var(--popover);\n color: var(--popover-foreground);\n font-family: var(--font-sans);\n box-shadow: var(--shadow-md);\n outline: none;\n animation: ss-enter var(--duration-fast) var(--ease-out);\n}\n\n.header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 0.75rem;\n}\n\n.title {\n margin: 0;\n font-size: var(--text-sm);\n line-height: var(--text-sm--line-height);\n font-weight: var(--font-weight-semibold);\n color: var(--popover-foreground);\n}\n\n.description {\n margin: 0;\n font-size: var(--text-xs);\n line-height: 1.45;\n color: var(--muted-foreground);\n}\n\n.close {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 1.5rem;\n height: 1.5rem;\n border: 0;\n border-radius: var(--radius-xs);\n background: transparent;\n color: var(--muted-foreground);\n cursor: pointer;\n}\n\n.close:hover {\n color: var(--foreground);\n background-color: var(--accent);\n}\n\n.arrow {\n --arrow-size: 8px;\n --arrow-background: var(--popover);\n}\n\n.arrowTip {\n border-top: 1px solid var(--border);\n border-left: 1px solid var(--border);\n}\n"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@superslate/ui",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"homepage": "https://superslate.dev/ui/",
|
|
5
|
+
"items": [
|
|
6
|
+
{
|
|
7
|
+
"name": "accordion",
|
|
8
|
+
"title": "Accordion",
|
|
9
|
+
"category": "interactive",
|
|
10
|
+
"zag": "@zag-js/accordion",
|
|
11
|
+
"description": "Vertically stacked disclosure sections powered by Zag.js.",
|
|
12
|
+
"dependencies": [
|
|
13
|
+
"@zag-js/accordion@1.48.0",
|
|
14
|
+
"@zag-js/react@1.48.0"
|
|
15
|
+
],
|
|
16
|
+
"registryDependencies": [
|
|
17
|
+
"utils/cn",
|
|
18
|
+
"utils/icons"
|
|
19
|
+
],
|
|
20
|
+
"url": "https://superslate.dev/ui/r/accordion.json"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "alert",
|
|
24
|
+
"title": "Alert",
|
|
25
|
+
"category": "core",
|
|
26
|
+
"zag": null,
|
|
27
|
+
"description": "Inline feedback callout with semantic status variants and optional dismiss trigger.",
|
|
28
|
+
"dependencies": [],
|
|
29
|
+
"registryDependencies": [
|
|
30
|
+
"utils/cn",
|
|
31
|
+
"utils/icons"
|
|
32
|
+
],
|
|
33
|
+
"url": "https://superslate.dev/ui/r/alert.json"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "alert-dialog",
|
|
37
|
+
"title": "Alert Dialog",
|
|
38
|
+
"category": "interactive",
|
|
39
|
+
"zag": "@zag-js/dialog",
|
|
40
|
+
"description": "Blocking confirmation modal with role=\"alertdialog\" and focus trapping.",
|
|
41
|
+
"dependencies": [
|
|
42
|
+
"@zag-js/dialog@1.48.0",
|
|
43
|
+
"@zag-js/react@1.48.0"
|
|
44
|
+
],
|
|
45
|
+
"registryDependencies": [
|
|
46
|
+
"utils/cn",
|
|
47
|
+
"utils/slot"
|
|
48
|
+
],
|
|
49
|
+
"url": "https://superslate.dev/ui/r/alert-dialog.json"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "avatar",
|
|
53
|
+
"title": "Avatar",
|
|
54
|
+
"category": "core",
|
|
55
|
+
"zag": null,
|
|
56
|
+
"description": "User or entity thumbnail with image fallback, deterministic OKLCH initials, and status dot.",
|
|
57
|
+
"dependencies": [],
|
|
58
|
+
"registryDependencies": [
|
|
59
|
+
"utils/cn"
|
|
60
|
+
],
|
|
61
|
+
"url": "https://superslate.dev/ui/r/avatar.json"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "badge",
|
|
65
|
+
"title": "Badge",
|
|
66
|
+
"category": "core",
|
|
67
|
+
"zag": null,
|
|
68
|
+
"description": "Compact status and category tag with semantic color tokens.",
|
|
69
|
+
"dependencies": [],
|
|
70
|
+
"registryDependencies": [
|
|
71
|
+
"utils/cn"
|
|
72
|
+
],
|
|
73
|
+
"url": "https://superslate.dev/ui/r/badge.json"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "breadcrumb",
|
|
77
|
+
"title": "Breadcrumb",
|
|
78
|
+
"category": "core",
|
|
79
|
+
"zag": null,
|
|
80
|
+
"description": "Semantic hierarchical trail with aria-current page indicator.",
|
|
81
|
+
"dependencies": [],
|
|
82
|
+
"registryDependencies": [
|
|
83
|
+
"utils/cn",
|
|
84
|
+
"utils/icons"
|
|
85
|
+
],
|
|
86
|
+
"url": "https://superslate.dev/ui/r/breadcrumb.json"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "button",
|
|
90
|
+
"title": "Button",
|
|
91
|
+
"category": "core",
|
|
92
|
+
"zag": null,
|
|
93
|
+
"description": "Action trigger with six variants, four sizes, icon slots, and loading spinner.",
|
|
94
|
+
"dependencies": [],
|
|
95
|
+
"registryDependencies": [
|
|
96
|
+
"utils/cn"
|
|
97
|
+
],
|
|
98
|
+
"url": "https://superslate.dev/ui/r/button.json"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "card",
|
|
102
|
+
"title": "Card",
|
|
103
|
+
"category": "core",
|
|
104
|
+
"zag": null,
|
|
105
|
+
"description": "Structured surface container with header, action, content, and footer slots.",
|
|
106
|
+
"dependencies": [],
|
|
107
|
+
"registryDependencies": [
|
|
108
|
+
"utils/cn"
|
|
109
|
+
],
|
|
110
|
+
"url": "https://superslate.dev/ui/r/card.json"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "checkbox",
|
|
114
|
+
"title": "Checkbox",
|
|
115
|
+
"category": "interactive",
|
|
116
|
+
"zag": "@zag-js/checkbox",
|
|
117
|
+
"description": "Accessible checkbox supporting controlled, uncontrolled, and indeterminate states.",
|
|
118
|
+
"dependencies": [
|
|
119
|
+
"@zag-js/checkbox@1.48.0",
|
|
120
|
+
"@zag-js/react@1.48.0"
|
|
121
|
+
],
|
|
122
|
+
"registryDependencies": [
|
|
123
|
+
"utils/cn",
|
|
124
|
+
"utils/icons"
|
|
125
|
+
],
|
|
126
|
+
"url": "https://superslate.dev/ui/r/checkbox.json"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "dialog",
|
|
130
|
+
"title": "Dialog",
|
|
131
|
+
"category": "interactive",
|
|
132
|
+
"zag": "@zag-js/dialog",
|
|
133
|
+
"description": "Accessible modal dialog with portal rendering, backdrop, focus trap, and Escape dismissal.",
|
|
134
|
+
"dependencies": [
|
|
135
|
+
"@zag-js/dialog@1.48.0",
|
|
136
|
+
"@zag-js/react@1.48.0"
|
|
137
|
+
],
|
|
138
|
+
"registryDependencies": [
|
|
139
|
+
"utils/cn",
|
|
140
|
+
"utils/icons",
|
|
141
|
+
"utils/slot"
|
|
142
|
+
],
|
|
143
|
+
"url": "https://superslate.dev/ui/r/dialog.json"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"name": "drawer",
|
|
147
|
+
"title": "Drawer",
|
|
148
|
+
"category": "interactive",
|
|
149
|
+
"zag": "@zag-js/dialog",
|
|
150
|
+
"description": "Edge-anchored slide-over panel supporting right, left, and bottom sheets.",
|
|
151
|
+
"dependencies": [
|
|
152
|
+
"@zag-js/dialog@1.48.0",
|
|
153
|
+
"@zag-js/react@1.48.0"
|
|
154
|
+
],
|
|
155
|
+
"registryDependencies": [
|
|
156
|
+
"utils/cn",
|
|
157
|
+
"utils/icons",
|
|
158
|
+
"utils/slot"
|
|
159
|
+
],
|
|
160
|
+
"url": "https://superslate.dev/ui/r/drawer.json"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": "empty-state",
|
|
164
|
+
"title": "Empty State",
|
|
165
|
+
"category": "core",
|
|
166
|
+
"zag": null,
|
|
167
|
+
"description": "Zero-data placeholder with optional icon, guidance copy, and primary action.",
|
|
168
|
+
"dependencies": [],
|
|
169
|
+
"registryDependencies": [
|
|
170
|
+
"utils/cn"
|
|
171
|
+
],
|
|
172
|
+
"url": "https://superslate.dev/ui/r/empty-state.json"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "field",
|
|
176
|
+
"title": "Field",
|
|
177
|
+
"category": "core",
|
|
178
|
+
"zag": null,
|
|
179
|
+
"description": "Form field wrapper that automatically wires label, description, and error ARIA ids.",
|
|
180
|
+
"dependencies": [],
|
|
181
|
+
"registryDependencies": [
|
|
182
|
+
"utils/cn"
|
|
183
|
+
],
|
|
184
|
+
"url": "https://superslate.dev/ui/r/field.json"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"name": "input",
|
|
188
|
+
"title": "Input",
|
|
189
|
+
"category": "core",
|
|
190
|
+
"zag": null,
|
|
191
|
+
"description": "Text Input and Textarea controls with prefix/suffix slots and Field context integration.",
|
|
192
|
+
"dependencies": [],
|
|
193
|
+
"registryDependencies": [
|
|
194
|
+
"utils/cn",
|
|
195
|
+
"field"
|
|
196
|
+
],
|
|
197
|
+
"url": "https://superslate.dev/ui/r/input.json"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"name": "kbd",
|
|
201
|
+
"title": "Kbd",
|
|
202
|
+
"category": "core",
|
|
203
|
+
"zag": null,
|
|
204
|
+
"description": "Monospace keyboard shortcut keycap.",
|
|
205
|
+
"dependencies": [],
|
|
206
|
+
"registryDependencies": [
|
|
207
|
+
"utils/cn"
|
|
208
|
+
],
|
|
209
|
+
"url": "https://superslate.dev/ui/r/kbd.json"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "menu",
|
|
213
|
+
"title": "Menu",
|
|
214
|
+
"category": "interactive",
|
|
215
|
+
"zag": "@zag-js/menu",
|
|
216
|
+
"description": "Dropdown action menu with arrow-key navigation, groups, shortcuts, and destructive items.",
|
|
217
|
+
"dependencies": [
|
|
218
|
+
"@zag-js/menu@1.48.0",
|
|
219
|
+
"@zag-js/react@1.48.0"
|
|
220
|
+
],
|
|
221
|
+
"registryDependencies": [
|
|
222
|
+
"utils/cn",
|
|
223
|
+
"utils/slot"
|
|
224
|
+
],
|
|
225
|
+
"url": "https://superslate.dev/ui/r/menu.json"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"name": "pagination",
|
|
229
|
+
"title": "Pagination",
|
|
230
|
+
"category": "interactive",
|
|
231
|
+
"zag": "@zag-js/pagination",
|
|
232
|
+
"description": "Page-range navigation bar with automatic ellipsis calculation and keyboard focus.",
|
|
233
|
+
"dependencies": [
|
|
234
|
+
"@zag-js/pagination@1.48.0",
|
|
235
|
+
"@zag-js/react@1.48.0"
|
|
236
|
+
],
|
|
237
|
+
"registryDependencies": [
|
|
238
|
+
"utils/cn",
|
|
239
|
+
"utils/icons"
|
|
240
|
+
],
|
|
241
|
+
"url": "https://superslate.dev/ui/r/pagination.json"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"name": "popover",
|
|
245
|
+
"title": "Popover",
|
|
246
|
+
"category": "interactive",
|
|
247
|
+
"zag": "@zag-js/popover",
|
|
248
|
+
"description": "Floating surface anchored to a trigger with arrow support and click-outside dismissal.",
|
|
249
|
+
"dependencies": [
|
|
250
|
+
"@zag-js/popover@1.48.0",
|
|
251
|
+
"@zag-js/react@1.48.0"
|
|
252
|
+
],
|
|
253
|
+
"registryDependencies": [
|
|
254
|
+
"utils/cn",
|
|
255
|
+
"utils/icons",
|
|
256
|
+
"utils/slot"
|
|
257
|
+
],
|
|
258
|
+
"url": "https://superslate.dev/ui/r/popover.json"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"name": "select",
|
|
262
|
+
"title": "Select",
|
|
263
|
+
"category": "interactive",
|
|
264
|
+
"zag": "@zag-js/select",
|
|
265
|
+
"description": "Custom listbox selector with single and multi-select, typeahead search, and Field wiring.",
|
|
266
|
+
"dependencies": [
|
|
267
|
+
"@zag-js/select@1.48.0",
|
|
268
|
+
"@zag-js/react@1.48.0"
|
|
269
|
+
],
|
|
270
|
+
"registryDependencies": [
|
|
271
|
+
"utils/cn",
|
|
272
|
+
"utils/icons",
|
|
273
|
+
"field"
|
|
274
|
+
],
|
|
275
|
+
"url": "https://superslate.dev/ui/r/select.json"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"name": "separator",
|
|
279
|
+
"title": "Separator",
|
|
280
|
+
"category": "core",
|
|
281
|
+
"zag": null,
|
|
282
|
+
"description": "Horizontal or vertical hairline divider with optional semantic separator role.",
|
|
283
|
+
"dependencies": [],
|
|
284
|
+
"registryDependencies": [
|
|
285
|
+
"utils/cn"
|
|
286
|
+
],
|
|
287
|
+
"url": "https://superslate.dev/ui/r/separator.json"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"name": "skeleton",
|
|
291
|
+
"title": "Skeleton",
|
|
292
|
+
"category": "core",
|
|
293
|
+
"zag": null,
|
|
294
|
+
"description": "Pulsing loading placeholder in rect, text, and circle variants.",
|
|
295
|
+
"dependencies": [],
|
|
296
|
+
"registryDependencies": [
|
|
297
|
+
"utils/cn"
|
|
298
|
+
],
|
|
299
|
+
"url": "https://superslate.dev/ui/r/skeleton.json"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"name": "spinner",
|
|
303
|
+
"title": "Spinner",
|
|
304
|
+
"category": "core",
|
|
305
|
+
"zag": null,
|
|
306
|
+
"description": "Accessible status spinner with screen-reader label.",
|
|
307
|
+
"dependencies": [],
|
|
308
|
+
"registryDependencies": [
|
|
309
|
+
"utils/cn"
|
|
310
|
+
],
|
|
311
|
+
"url": "https://superslate.dev/ui/r/spinner.json"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"name": "switch",
|
|
315
|
+
"title": "Switch",
|
|
316
|
+
"category": "interactive",
|
|
317
|
+
"zag": "@zag-js/switch",
|
|
318
|
+
"description": "Binary toggle switch with sm, md, and lg sizes plus label and description.",
|
|
319
|
+
"dependencies": [
|
|
320
|
+
"@zag-js/switch@1.48.0",
|
|
321
|
+
"@zag-js/react@1.48.0"
|
|
322
|
+
],
|
|
323
|
+
"registryDependencies": [
|
|
324
|
+
"utils/cn"
|
|
325
|
+
],
|
|
326
|
+
"url": "https://superslate.dev/ui/r/switch.json"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"name": "tabs",
|
|
330
|
+
"title": "Tabs",
|
|
331
|
+
"category": "interactive",
|
|
332
|
+
"zag": "@zag-js/tabs",
|
|
333
|
+
"description": "Horizontal or vertical tabbed panels in line and pill styles with roving focus.",
|
|
334
|
+
"dependencies": [
|
|
335
|
+
"@zag-js/tabs@1.48.0",
|
|
336
|
+
"@zag-js/react@1.48.0"
|
|
337
|
+
],
|
|
338
|
+
"registryDependencies": [
|
|
339
|
+
"utils/cn"
|
|
340
|
+
],
|
|
341
|
+
"url": "https://superslate.dev/ui/r/tabs.json"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"name": "toast",
|
|
345
|
+
"title": "Toast",
|
|
346
|
+
"category": "interactive",
|
|
347
|
+
"zag": "@zag-js/toast",
|
|
348
|
+
"description": "Stacking notification toasts powered by Zag.js with pause-on-hover and action buttons.",
|
|
349
|
+
"dependencies": [
|
|
350
|
+
"@zag-js/toast@1.48.0",
|
|
351
|
+
"@zag-js/react@1.48.0"
|
|
352
|
+
],
|
|
353
|
+
"registryDependencies": [
|
|
354
|
+
"utils/cn",
|
|
355
|
+
"utils/icons"
|
|
356
|
+
],
|
|
357
|
+
"url": "https://superslate.dev/ui/r/toast.json"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"name": "tooltip",
|
|
361
|
+
"title": "Tooltip",
|
|
362
|
+
"category": "interactive",
|
|
363
|
+
"zag": "@zag-js/tooltip",
|
|
364
|
+
"description": "Hover and focus hint anchored to any trigger with configurable delay and arrow.",
|
|
365
|
+
"dependencies": [
|
|
366
|
+
"@zag-js/tooltip@1.48.0",
|
|
367
|
+
"@zag-js/react@1.48.0"
|
|
368
|
+
],
|
|
369
|
+
"registryDependencies": [
|
|
370
|
+
"utils/cn",
|
|
371
|
+
"utils/slot"
|
|
372
|
+
],
|
|
373
|
+
"url": "https://superslate.dev/ui/r/tooltip.json"
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
"shared": [
|
|
377
|
+
"utils/cn",
|
|
378
|
+
"utils/icons",
|
|
379
|
+
"utils/slot",
|
|
380
|
+
"styles/tokens",
|
|
381
|
+
"styles/themes",
|
|
382
|
+
"styles/base",
|
|
383
|
+
"styles/index"
|
|
384
|
+
]
|
|
385
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://superslate.dev/ui/r/schema.json",
|
|
3
|
+
"name": "select",
|
|
4
|
+
"title": "Select",
|
|
5
|
+
"category": "interactive",
|
|
6
|
+
"zag": "@zag-js/select",
|
|
7
|
+
"description": "Custom listbox selector with single and multi-select, typeahead search, and Field wiring.",
|
|
8
|
+
"dependencies": [
|
|
9
|
+
"@zag-js/select@1.48.0",
|
|
10
|
+
"@zag-js/react@1.48.0"
|
|
11
|
+
],
|
|
12
|
+
"registryDependencies": [
|
|
13
|
+
"utils/cn",
|
|
14
|
+
"utils/icons",
|
|
15
|
+
"field"
|
|
16
|
+
],
|
|
17
|
+
"files": [
|
|
18
|
+
{
|
|
19
|
+
"path": "components/select/Select.tsx",
|
|
20
|
+
"content": "import * as React from 'react'\nimport * as select from '@zag-js/select'\nimport {Portal, normalizeProps, useMachine} from '@zag-js/react'\nimport {cn} from '../../utils/cn'\nimport {CheckIcon, ChevronsUpDownIcon} from '../../utils/icons'\nimport {useFieldContext} from '../field/Field'\nimport classes from './select.module.css'\n\nexport interface SelectOption {\n label: string\n value: string\n disabled?: boolean\n}\n\ntype SelectApi = ReturnType<typeof select.connect>\n\nconst SelectContext = React.createContext<{\n api: SelectApi\n items: SelectOption[]\n invalid: boolean\n} | null>(null)\n\nfunction useSelectContext() {\n const ctx = React.useContext(SelectContext)\n if (!ctx) throw new Error('Select parts must be rendered inside Select.Root')\n return ctx\n}\n\nexport interface SelectRootProps<T extends SelectOption = SelectOption> {\n items: T[]\n value?: string[]\n defaultValue?: string[]\n onValueChange?: (value: string[], items: T[]) => void\n onOpenChange?: (open: boolean) => void\n multiple?: boolean\n disabled?: boolean\n invalid?: boolean\n required?: boolean\n name?: string\n className?: string\n children: React.ReactNode\n}\n\nexport function SelectRoot<T extends SelectOption = SelectOption>({\n items,\n value,\n defaultValue,\n onValueChange,\n onOpenChange,\n multiple = false,\n disabled,\n invalid,\n required,\n name,\n className,\n children,\n}: SelectRootProps<T>) {\n const field = useFieldContext()\n const isInvalid = invalid ?? field?.invalid ?? false\n const isDisabled = disabled ?? field?.disabled ?? false\n const isRequired = required ?? field?.required ?? false\n const isControlled = value !== undefined\n\n const collection = React.useMemo(\n () =>\n select.collection({\n items,\n itemToString: item => item.label,\n itemToValue: item => item.value,\n isItemDisabled: item => Boolean(item.disabled),\n }),\n [items],\n )\n\n const service = useMachine(select.machine, {\n id: React.useId(),\n collection,\n ...(isControlled ? {value} : {defaultValue}),\n multiple,\n closeOnSelect: !multiple,\n disabled: isDisabled,\n invalid: isInvalid,\n required: isRequired,\n name,\n positioning: {sameWidth: true, offset: {mainAxis: 6}},\n onValueChange: details => onValueChange?.(details.value, details.items as T[]),\n onOpenChange: details => onOpenChange?.(details.open),\n })\n const api = select.connect(service, normalizeProps)\n const ctx = React.useMemo(() => ({api, items, invalid: isInvalid}), [api, items, isInvalid])\n\n return (\n <SelectContext.Provider value={ctx}>\n <div\n {...api.getRootProps()}\n data-ss-ui=\"select\"\n className={cn(classes.root, className)}\n >\n {children}\n </div>\n </SelectContext.Provider>\n )\n}\n\nexport interface SelectTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n placeholder?: string\n}\n\nexport function SelectTrigger({\n placeholder = 'Select an option',\n className,\n children,\n ...props\n}: SelectTriggerProps) {\n const {api, invalid} = useSelectContext()\n return (\n <div {...api.getControlProps()} className={classes.control}>\n <button\n {...api.getTriggerProps()}\n type=\"button\"\n data-placeholder-shown={api.valueAsString ? undefined : ''}\n aria-invalid={invalid || undefined}\n className={cn(classes.trigger, invalid && classes.invalid, className)}\n {...props}\n >\n <span className={classes.triggerText}>\n {children ?? (api.valueAsString || placeholder)}\n </span>\n <ChevronsUpDownIcon size={15} className={classes.triggerIcon} />\n </button>\n </div>\n )\n}\n\nexport function SelectContent({\n className,\n children,\n emptyText = 'No options',\n ...props\n}: React.HTMLAttributes<HTMLDivElement> & {emptyText?: string}) {\n const {api, items} = useSelectContext()\n if (!api.open) return null\n\n return (\n <Portal>\n <div {...api.getPositionerProps()} className={classes.positioner}>\n <div\n {...api.getContentProps()}\n data-ss-ui=\"select-content\"\n className={cn(classes.content, className)}\n {...props}\n >\n {children ??\n (items.length > 0 ? (\n items.map(item => (\n <SelectItem key={item.value} item={item}>\n {item.label}\n </SelectItem>\n ))\n ) : (\n <div className={classes.empty}>{emptyText}</div>\n ))}\n </div>\n </div>\n </Portal>\n )\n}\n\nexport interface SelectItemProps extends React.HTMLAttributes<HTMLDivElement> {\n item: SelectOption\n}\n\nexport function SelectItem({item, className, children, ...props}: SelectItemProps) {\n const {api} = useSelectContext()\n const isSelected = api.value.includes(item.value)\n return (\n <div {...api.getItemProps({item})} className={cn(classes.item, className)} {...props}>\n <span {...api.getItemTextProps({item})} className={classes.itemText}>\n {children ?? item.label}\n </span>\n {isSelected && (\n <span {...api.getItemIndicatorProps({item})} className={classes.indicator}>\n <CheckIcon size={14} strokeWidth={2.5} />\n </span>\n )}\n </div>\n )\n}\n\nexport const Select = {\n Root: SelectRoot,\n Trigger: SelectTrigger,\n Content: SelectContent,\n Item: SelectItem,\n}\n"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"path": "components/select/select.module.css",
|
|
24
|
+
"content": ".root {\n display: flex;\n flex-direction: column;\n width: 100%;\n font-family: var(--font-sans);\n}\n\n.control {\n position: relative;\n display: flex;\n width: 100%;\n}\n\n.trigger {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n width: 100%;\n height: 2.25rem;\n padding-inline: 0.75rem;\n border: 1px solid var(--input);\n border-radius: var(--radius-md);\n background-color: var(--control-surface);\n color: var(--foreground);\n font-family: var(--font-sans);\n font-size: var(--text-sm);\n line-height: var(--text-sm--line-height);\n text-align: left;\n box-shadow: var(--shadow-2xs);\n cursor: pointer;\n outline: none;\n transition:\n border-color var(--duration-fast) var(--ease-out),\n box-shadow var(--duration-fast) var(--ease-out);\n}\n\n.trigger:focus-visible {\n border-color: var(--ring);\n box-shadow: var(--ring-shadow);\n}\n\n.trigger[data-disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.trigger[data-placeholder-shown] .triggerText {\n color: var(--muted-foreground);\n}\n\n.invalid {\n border-color: var(--destructive);\n}\n\n.invalid:focus-visible {\n border-color: var(--destructive);\n box-shadow: var(--ring-shadow-destructive);\n}\n\n.triggerText {\n flex: 1;\n min-width: 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.triggerIcon {\n flex-shrink: 0;\n color: var(--muted-foreground);\n}\n\n.positioner {\n --z-index: var(--z-overlay);\n z-index: var(--z-overlay);\n}\n\n.content {\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n max-height: 16rem;\n overflow-y: auto;\n padding: 0.25rem;\n border: 1px solid var(--border);\n border-radius: var(--radius-md);\n background-color: var(--popover);\n color: var(--popover-foreground);\n font-family: var(--font-sans);\n box-shadow: var(--shadow-md);\n outline: none;\n animation: ss-enter var(--duration-fast) var(--ease-out);\n}\n\n.item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n padding: 0.4375rem 0.5625rem;\n border-radius: var(--radius-sm);\n font-size: var(--text-sm);\n line-height: var(--text-sm--line-height);\n cursor: pointer;\n user-select: none;\n outline: none;\n}\n\n.item[data-highlighted] {\n background-color: var(--accent);\n color: var(--accent-foreground);\n}\n\n.item[data-disabled] {\n opacity: 0.45;\n pointer-events: none;\n}\n\n.itemText {\n flex: 1;\n min-width: 0;\n}\n\n.indicator {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n color: var(--primary);\n flex-shrink: 0;\n}\n\n.empty {\n padding: 1rem 0.5rem;\n text-align: center;\n font-size: var(--text-sm);\n color: var(--muted-foreground);\n}\n"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://superslate.dev/ui/r/schema.json",
|
|
3
|
+
"name": "separator",
|
|
4
|
+
"title": "Separator",
|
|
5
|
+
"category": "core",
|
|
6
|
+
"zag": null,
|
|
7
|
+
"description": "Horizontal or vertical hairline divider with optional semantic separator role.",
|
|
8
|
+
"dependencies": [],
|
|
9
|
+
"registryDependencies": [
|
|
10
|
+
"utils/cn"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
{
|
|
14
|
+
"path": "components/separator/Separator.tsx",
|
|
15
|
+
"content": "import * as React from 'react'\nimport {cn} from '../../utils/cn'\nimport classes from './separator.module.css'\n\nexport interface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {\n orientation?: 'horizontal' | 'vertical'\n decorative?: boolean\n}\n\nexport function Separator({\n orientation = 'horizontal',\n decorative = true,\n className,\n ...props\n}: SeparatorProps) {\n return (\n <div\n role={decorative ? 'none' : 'separator'}\n aria-orientation={decorative ? undefined : orientation}\n data-ss-ui=\"separator\"\n data-orientation={orientation}\n className={cn(classes.root, classes[orientation], className)}\n {...props}\n />\n )\n}\n"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "components/separator/separator.module.css",
|
|
19
|
+
"content": ".root {\n flex-shrink: 0;\n background-color: var(--border);\n}\n\n.horizontal {\n height: 1px;\n width: 100%;\n}\n\n.vertical {\n width: 1px;\n height: 100%;\n min-height: 1rem;\n}\n"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"utils/cn": {
|
|
3
|
+
"name": "utils/cn",
|
|
4
|
+
"path": "utils/cn.ts",
|
|
5
|
+
"content": "export function cn(...values: Array<string | false | null | undefined>): string {\n let out = ''\n for (let i = 0; i < values.length; i += 1) {\n const value = values[i]\n if (!value) continue\n out = out ? `${out} ${value}` : value\n }\n return out\n}\n"
|
|
6
|
+
},
|
|
7
|
+
"utils/icons": {
|
|
8
|
+
"name": "utils/icons",
|
|
9
|
+
"path": "utils/icons.tsx",
|
|
10
|
+
"content": "import * as React from 'react'\n\nexport interface IconProps extends React.SVGProps<SVGSVGElement> {\n size?: number\n}\n\nfunction createIcon(paths: React.ReactNode) {\n return function Icon({size = 16, width, height, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={width ?? size}\n height={height ?? size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n {...props}\n >\n {paths}\n </svg>\n )\n }\n}\n\nexport const CheckIcon = createIcon(<path d=\"M20 6 9 17l-5-5\" />)\nexport const MinusIcon = createIcon(<path d=\"M5 12h14\" />)\nexport const CloseIcon = createIcon(\n <>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </>,\n)\nexport const ChevronDownIcon = createIcon(<path d=\"m6 9 6 6 6-6\" />)\nexport const ChevronLeftIcon = createIcon(<path d=\"m15 18-6-6 6-6\" />)\nexport const ChevronRightIcon = createIcon(<path d=\"m9 18 6-6-6-6\" />)\nexport const ChevronsUpDownIcon = createIcon(\n <>\n <path d=\"m7 15 5 5 5-5\" />\n <path d=\"m7 9 5-5 5 5\" />\n </>,\n)\nexport const InfoIcon = createIcon(\n <>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </>,\n)\nexport const CheckCircleIcon = createIcon(\n <>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m9 12 2 2 4-4\" />\n </>,\n)\nexport const AlertTriangleIcon = createIcon(\n <>\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n </>,\n)\nexport const AlertCircleIcon = createIcon(\n <>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m15 9-6 6\" />\n <path d=\"m9 9 6 6\" />\n </>,\n)\n"
|
|
11
|
+
},
|
|
12
|
+
"utils/slot": {
|
|
13
|
+
"name": "utils/slot",
|
|
14
|
+
"path": "utils/slot.tsx",
|
|
15
|
+
"content": "import * as React from 'react'\nimport {cn} from './cn'\n\ntype AnyProps = Record<string, unknown>\n\nfunction composeEventHandlers(\n first: unknown,\n second: unknown,\n): ((...args: unknown[]) => void) | undefined {\n if (typeof first !== 'function' && typeof second !== 'function') return undefined\n return (...args: unknown[]) => {\n if (typeof first === 'function') (first as (...a: unknown[]) => void)(...args)\n if (typeof second === 'function') (second as (...a: unknown[]) => void)(...args)\n }\n}\n\nexport function mergeElementProps(slotProps: AnyProps, childProps: AnyProps): AnyProps {\n const merged: AnyProps = {...slotProps, ...childProps}\n for (const key of Object.keys(slotProps)) {\n const a = slotProps[key]\n const b = childProps[key]\n if (key === 'className') {\n merged.className = cn(a as string | undefined, b as string | undefined)\n } else if (key === 'style') {\n merged.style = {\n ...(typeof a === 'object' && a !== null ? (a as React.CSSProperties) : {}),\n ...(typeof b === 'object' && b !== null ? (b as React.CSSProperties) : {}),\n }\n } else if (/^on[A-Z]/.test(key) && typeof a === 'function' && typeof b === 'function') {\n merged[key] = composeEventHandlers(b, a)\n }\n }\n return merged\n}\n\nexport interface SlotProps extends React.HTMLAttributes<HTMLElement> {\n children: React.ReactNode\n}\n\nexport function Slot({children, ...slotProps}: SlotProps) {\n if (!React.isValidElement<AnyProps>(children)) {\n return null\n }\n const merged = mergeElementProps(slotProps as AnyProps, children.props)\n return React.cloneElement(children, merged)\n}\n"
|
|
16
|
+
},
|
|
17
|
+
"styles/tokens": {
|
|
18
|
+
"name": "styles/tokens",
|
|
19
|
+
"path": "styles/tokens.css",
|
|
20
|
+
"content": ":root {\n --font-sans:\n ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,\n 'Helvetica Neue', Arial, sans-serif;\n --font-mono:\n ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, Consolas, 'Liberation Mono',\n 'Courier New', monospace;\n\n --text-xs: 0.75rem;\n --text-xs--line-height: 1rem;\n --text-sm: 0.875rem;\n --text-sm--line-height: 1.25rem;\n --text-base: 1rem;\n --text-base--line-height: 1.5rem;\n --text-lg: 1.125rem;\n --text-lg--line-height: 1.75rem;\n\n --font-weight-normal: 400;\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --font-weight-bold: 700;\n\n --radius: 0.625rem;\n --radius-xs: max(0px, calc(var(--radius) - 6px));\n --radius-sm: max(0px, calc(var(--radius) - 4px));\n --radius-md: max(0px, calc(var(--radius) - 2px));\n --radius-lg: var(--radius);\n --radius-xl: calc(var(--radius) + 4px);\n\n --background: oklch(1 0 0);\n --foreground: oklch(0.145 0 0);\n --card: oklch(1 0 0);\n --card-foreground: oklch(0.145 0 0);\n --popover: oklch(1 0 0);\n --popover-foreground: oklch(0.145 0 0);\n --primary: oklch(0.205 0 0);\n --primary-foreground: oklch(0.985 0 0);\n --secondary: oklch(0.965 0 0);\n --secondary-foreground: oklch(0.205 0 0);\n --muted: oklch(0.965 0 0);\n --muted-foreground: oklch(0.52 0 0);\n --accent: oklch(0.955 0 0);\n --accent-foreground: oklch(0.205 0 0);\n --destructive: oklch(0.577 0.245 27.325);\n --destructive-foreground: oklch(0.985 0 0);\n --success: oklch(0.57 0.145 162);\n --success-foreground: oklch(0.985 0 0);\n --warning: oklch(0.66 0.175 62);\n --warning-foreground: oklch(0.18 0.02 62);\n --info: oklch(0.55 0.17 252);\n --info-foreground: oklch(0.985 0 0);\n --border: oklch(0.91 0 0);\n --input: oklch(0.89 0 0);\n --ring: oklch(0.45 0 0);\n\n --overlay: oklch(0 0 0 / 50%);\n --control-surface: var(--background);\n --control-surface-hover: var(--accent);\n\n --shadow-2xs: 0 1px rgb(0 0 0 / 0.04);\n --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.09), 0 1px 2px -1px rgb(0 0 0 / 0.09);\n --shadow-md: 0 4px 10px -2px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.08);\n --shadow-lg: 0 12px 24px -6px rgb(0 0 0 / 0.14), 0 4px 8px -4px rgb(0 0 0 / 0.08);\n\n --ring-shadow: 0 0 0 2px color-mix(in oklab, var(--ring) 26%, transparent);\n --ring-shadow-destructive: 0 0 0 2px color-mix(in oklab, var(--destructive) 28%, transparent);\n\n --z-sticky: 30;\n --z-overlay: 50;\n --z-toast: 60;\n\n --ease-out: cubic-bezier(0.23, 1, 0.32, 1);\n --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);\n --duration-instant: 100ms;\n --duration-fast: 150ms;\n --duration-base: 200ms;\n --duration-slow: 280ms;\n --duration-spin: 600ms;\n}\n\n.dark,\n[data-ui-mode='dark'] {\n --background: oklch(0.145 0 0);\n --foreground: oklch(0.985 0 0);\n --card: oklch(0.19 0 0);\n --card-foreground: oklch(0.985 0 0);\n --popover: oklch(0.21 0 0);\n --popover-foreground: oklch(0.985 0 0);\n --primary: oklch(0.94 0 0);\n --primary-foreground: oklch(0.16 0 0);\n --secondary: oklch(0.25 0 0);\n --secondary-foreground: oklch(0.985 0 0);\n --muted: oklch(0.24 0 0);\n --muted-foreground: oklch(0.71 0 0);\n --accent: oklch(0.29 0 0);\n --accent-foreground: oklch(0.985 0 0);\n --destructive: oklch(0.68 0.2 24);\n --destructive-foreground: oklch(0.985 0 0);\n --success: oklch(0.7 0.165 162);\n --success-foreground: oklch(0.16 0.02 162);\n --warning: oklch(0.77 0.175 72);\n --warning-foreground: oklch(0.18 0.03 72);\n --info: oklch(0.74 0.14 250);\n --info-foreground: oklch(0.15 0.04 255);\n --border: oklch(1 0 0 / 12%);\n --input: oklch(1 0 0 / 16%);\n --ring: oklch(0.74 0 0);\n\n --overlay: oklch(0 0 0 / 68%);\n --control-surface: color-mix(in oklab, var(--input) 28%, transparent);\n --control-surface-hover: color-mix(in oklab, var(--input) 48%, transparent);\n\n --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.35);\n --shadow-sm: 0 2px 4px 0 rgb(0 0 0 / 0.4);\n --shadow-md: 0 8px 16px -4px rgb(0 0 0 / 0.5);\n --shadow-lg: 0 18px 36px -8px rgb(0 0 0 / 0.65);\n}\n"
|
|
21
|
+
},
|
|
22
|
+
"styles/themes": {
|
|
23
|
+
"name": "styles/themes",
|
|
24
|
+
"path": "styles/themes.css",
|
|
25
|
+
"content": "[data-ui-theme='cobalt'] {\n --background: oklch(0.985 0.004 250);\n --foreground: oklch(0.16 0.024 252);\n --card: oklch(0.996 0.002 250);\n --card-foreground: oklch(0.16 0.024 252);\n --popover: oklch(0.996 0.002 250);\n --popover-foreground: oklch(0.16 0.024 252);\n --primary: oklch(0.5 0.17 252);\n --primary-foreground: oklch(0.985 0.005 245);\n --secondary: oklch(0.945 0.012 250);\n --secondary-foreground: oklch(0.2 0.03 252);\n --muted: oklch(0.948 0.009 250);\n --muted-foreground: oklch(0.46 0.028 248);\n --accent: oklch(0.935 0.018 250);\n --accent-foreground: oklch(0.17 0.03 252);\n --border: oklch(0.89 0.014 250);\n --input: oklch(0.86 0.016 250);\n --ring: oklch(0.52 0.165 252);\n}\n\n[data-ui-theme='cobalt'].dark,\n[data-ui-theme='cobalt'][data-ui-mode='dark'],\n.dark [data-ui-theme='cobalt'] {\n --background: oklch(0.13 0.014 250);\n --foreground: oklch(0.95 0.008 240);\n --card: oklch(0.168 0.017 250);\n --card-foreground: oklch(0.95 0.008 240);\n --popover: oklch(0.185 0.018 250);\n --popover-foreground: oklch(0.95 0.008 240);\n --primary: oklch(0.75 0.135 245);\n --primary-foreground: oklch(0.15 0.045 255);\n --secondary: oklch(0.22 0.02 250);\n --secondary-foreground: oklch(0.95 0.008 240);\n --muted: oklch(0.21 0.018 250);\n --muted-foreground: oklch(0.71 0.03 245);\n --accent: oklch(0.25 0.025 250);\n --accent-foreground: oklch(0.95 0.008 240);\n --border: oklch(0.95 0.01 245 / 14%);\n --input: oklch(0.95 0.01 245 / 18%);\n --ring: oklch(0.75 0.135 245);\n}\n\n[data-ui-theme='stone'] {\n --background: oklch(0.985 0.004 80);\n --foreground: oklch(0.19 0.012 60);\n --card: oklch(0.996 0.002 80);\n --card-foreground: oklch(0.19 0.012 60);\n --popover: oklch(0.996 0.002 80);\n --popover-foreground: oklch(0.19 0.012 60);\n --primary: oklch(0.26 0.018 55);\n --primary-foreground: oklch(0.98 0.004 80);\n --secondary: oklch(0.95 0.008 75);\n --secondary-foreground: oklch(0.24 0.014 55);\n --muted: oklch(0.95 0.008 75);\n --muted-foreground: oklch(0.5 0.015 65);\n --accent: oklch(0.935 0.011 75);\n --accent-foreground: oklch(0.2 0.014 55);\n --border: oklch(0.9 0.01 75);\n --input: oklch(0.87 0.012 75);\n --ring: oklch(0.46 0.02 60);\n}\n\n[data-ui-theme='stone'].dark,\n[data-ui-theme='stone'][data-ui-mode='dark'],\n.dark [data-ui-theme='stone'] {\n --background: oklch(0.16 0.008 55);\n --foreground: oklch(0.96 0.006 80);\n --card: oklch(0.2 0.009 55);\n --card-foreground: oklch(0.96 0.006 80);\n --popover: oklch(0.22 0.01 55);\n --popover-foreground: oklch(0.96 0.006 80);\n --primary: oklch(0.92 0.012 75);\n --primary-foreground: oklch(0.18 0.01 55);\n --secondary: oklch(0.26 0.01 55);\n --secondary-foreground: oklch(0.96 0.006 80);\n --muted: oklch(0.25 0.01 55);\n --muted-foreground: oklch(0.71 0.014 70);\n --accent: oklch(0.3 0.012 55);\n --accent-foreground: oklch(0.96 0.006 80);\n --border: oklch(0.96 0.01 80 / 12%);\n --input: oklch(0.96 0.01 80 / 16%);\n --ring: oklch(0.75 0.018 70);\n}\n"
|
|
26
|
+
},
|
|
27
|
+
"styles/base": {
|
|
28
|
+
"name": "styles/base",
|
|
29
|
+
"path": "styles/base.css",
|
|
30
|
+
"content": ".ss-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n}\n\n@keyframes ss-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes ss-fade-out {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n@keyframes ss-enter {\n from {\n opacity: 0;\n transform: scale(0.96) translateY(-2px);\n }\n to {\n opacity: 1;\n transform: scale(1) translateY(0);\n }\n}\n\n@keyframes ss-dialog-enter {\n from {\n opacity: 0;\n transform: translate(-50%, -48%) scale(0.96);\n }\n to {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n}\n\n@keyframes ss-slide-right {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n@keyframes ss-slide-left {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n@keyframes ss-slide-bottom {\n from {\n transform: translateY(100%);\n }\n to {\n transform: translateY(0);\n }\n}\n\n@keyframes ss-toast-in {\n from {\n opacity: 0;\n transform: translateY(8px) scale(0.98);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n}\n\n@keyframes ss-pulse {\n 50% {\n opacity: 0.45;\n }\n}\n\n@keyframes ss-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n [data-scope] *,\n [data-ss-ui] * {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n }\n}\n"
|
|
31
|
+
},
|
|
32
|
+
"styles/index": {
|
|
33
|
+
"name": "styles/index",
|
|
34
|
+
"path": "styles/index.css",
|
|
35
|
+
"content": "@import './tokens.css';\n@import './base.css';\n"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://superslate.dev/ui/r/schema.json",
|
|
3
|
+
"name": "skeleton",
|
|
4
|
+
"title": "Skeleton",
|
|
5
|
+
"category": "core",
|
|
6
|
+
"zag": null,
|
|
7
|
+
"description": "Pulsing loading placeholder in rect, text, and circle variants.",
|
|
8
|
+
"dependencies": [],
|
|
9
|
+
"registryDependencies": [
|
|
10
|
+
"utils/cn"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
{
|
|
14
|
+
"path": "components/skeleton/Skeleton.tsx",
|
|
15
|
+
"content": "import * as React from 'react'\nimport {cn} from '../../utils/cn'\nimport classes from './skeleton.module.css'\n\nexport interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: 'rect' | 'text' | 'circle'\n width?: number | string\n height?: number | string\n}\n\nexport function Skeleton({\n variant = 'rect',\n width,\n height,\n style,\n className,\n ...props\n}: SkeletonProps) {\n return (\n <div\n aria-hidden=\"true\"\n data-ss-ui=\"skeleton\"\n data-variant={variant}\n className={cn(classes.root, classes[variant], className)}\n style={{width, height, ...style}}\n {...props}\n />\n )\n}\n"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "components/skeleton/skeleton.module.css",
|
|
19
|
+
"content": ".root {\n background-color: var(--muted);\n animation: ss-pulse 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n\n.rect {\n border-radius: var(--radius-md);\n}\n\n.text {\n height: 0.875rem;\n border-radius: var(--radius-xs);\n}\n\n.circle {\n border-radius: 9999px;\n}\n"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://superslate.dev/ui/r/schema.json",
|
|
3
|
+
"name": "spinner",
|
|
4
|
+
"title": "Spinner",
|
|
5
|
+
"category": "core",
|
|
6
|
+
"zag": null,
|
|
7
|
+
"description": "Accessible status spinner with screen-reader label.",
|
|
8
|
+
"dependencies": [],
|
|
9
|
+
"registryDependencies": [
|
|
10
|
+
"utils/cn"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
{
|
|
14
|
+
"path": "components/spinner/Spinner.tsx",
|
|
15
|
+
"content": "import * as React from 'react'\nimport {cn} from '../../utils/cn'\nimport classes from './spinner.module.css'\n\nexport type SpinnerSize = 'xs' | 'sm' | 'md' | 'lg'\n\nexport interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {\n size?: SpinnerSize\n label?: string\n}\n\nexport function Spinner({size = 'md', label = 'Loading', className, ...props}: SpinnerProps) {\n return (\n <span\n role=\"status\"\n aria-label={label}\n data-ss-ui=\"spinner\"\n data-size={size}\n className={cn(classes.root, classes[size], className)}\n {...props}\n >\n <span className=\"ss-sr-only\">{label}</span>\n </span>\n )\n}\n"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "components/spinner/spinner.module.css",
|
|
19
|
+
"content": ".root {\n display: inline-block;\n flex-shrink: 0;\n border-radius: 9999px;\n border: 2px solid color-mix(in oklab, currentColor 22%, transparent);\n border-top-color: currentColor;\n animation: ss-spin var(--duration-spin) linear infinite;\n}\n\n.xs {\n width: 0.75rem;\n height: 0.75rem;\n}\n\n.sm {\n width: 1rem;\n height: 1rem;\n}\n\n.md {\n width: 1.25rem;\n height: 1.25rem;\n}\n\n.lg {\n width: 1.75rem;\n height: 1.75rem;\n border-width: 2.5px;\n}\n"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://superslate.dev/ui/r/schema.json",
|
|
3
|
+
"name": "switch",
|
|
4
|
+
"title": "Switch",
|
|
5
|
+
"category": "interactive",
|
|
6
|
+
"zag": "@zag-js/switch",
|
|
7
|
+
"description": "Binary toggle switch with sm, md, and lg sizes plus label and description.",
|
|
8
|
+
"dependencies": [
|
|
9
|
+
"@zag-js/switch@1.48.0",
|
|
10
|
+
"@zag-js/react@1.48.0"
|
|
11
|
+
],
|
|
12
|
+
"registryDependencies": [
|
|
13
|
+
"utils/cn"
|
|
14
|
+
],
|
|
15
|
+
"files": [
|
|
16
|
+
{
|
|
17
|
+
"path": "components/switch/Switch.tsx",
|
|
18
|
+
"content": "import * as React from 'react'\nimport * as zagSwitch from '@zag-js/switch'\nimport {normalizeProps, useMachine} from '@zag-js/react'\nimport {cn} from '../../utils/cn'\nimport classes from './switch.module.css'\n\nexport interface SwitchProps {\n checked?: boolean\n defaultChecked?: boolean\n onCheckedChange?: (checked: boolean) => void\n size?: 'sm' | 'md' | 'lg'\n label?: React.ReactNode\n description?: React.ReactNode\n disabled?: boolean\n invalid?: boolean\n required?: boolean\n readOnly?: boolean\n name?: string\n value?: string | number\n className?: string\n 'aria-label'?: string\n}\n\nexport function Switch({\n checked,\n defaultChecked,\n onCheckedChange,\n size = 'md',\n label,\n description,\n disabled = false,\n invalid = false,\n required = false,\n readOnly = false,\n name,\n value,\n className,\n 'aria-label': ariaLabel,\n}: SwitchProps) {\n const isControlled = checked !== undefined\n const service = useMachine(zagSwitch.machine, {\n id: React.useId(),\n ...(isControlled ? {checked} : {defaultChecked}),\n disabled,\n invalid,\n required,\n readOnly,\n name,\n value,\n onCheckedChange: details => onCheckedChange?.(details.checked),\n })\n const api = zagSwitch.connect(service, normalizeProps)\n\n return (\n <label\n {...api.getRootProps()}\n data-ss-ui=\"switch\"\n data-size={size}\n className={cn(classes.root, classes[size], className)}\n >\n <input {...api.getHiddenInputProps()} aria-label={ariaLabel} />\n <span {...api.getControlProps()} className={classes.track}>\n <span {...api.getThumbProps()} className={classes.thumb} />\n </span>\n {(label || description) && (\n <span className={classes.text}>\n {label && (\n <span {...api.getLabelProps()} className={classes.label}>\n {label}\n </span>\n )}\n {description && <span className={classes.description}>{description}</span>}\n </span>\n )}\n </label>\n )\n}\n"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"path": "components/switch/switch.module.css",
|
|
22
|
+
"content": ".root {\n display: inline-flex;\n align-items: center;\n gap: 0.625rem;\n cursor: pointer;\n user-select: none;\n font-family: var(--font-sans);\n}\n\n.root[data-disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.track {\n position: relative;\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n padding: 2px;\n border-radius: 9999px;\n border: 1px solid transparent;\n background-color: var(--input);\n transition:\n background-color var(--duration-fast) var(--ease-out),\n box-shadow var(--duration-fast) var(--ease-out);\n}\n\n.track[data-state='checked'] {\n background-color: var(--primary);\n}\n\n.track[data-focus-visible] {\n box-shadow: var(--ring-shadow);\n}\n\n.thumb {\n display: block;\n border-radius: 9999px;\n background-color: var(--background);\n box-shadow: var(--shadow-xs);\n transition: transform var(--duration-fast) var(--ease-out);\n}\n\n.sm .track {\n width: 2rem;\n height: 1.125rem;\n}\n\n.sm .thumb {\n width: 0.75rem;\n height: 0.75rem;\n}\n\n.sm .thumb[data-state='checked'] {\n transform: translateX(0.875rem);\n}\n\n.md .track {\n width: 2.375rem;\n height: 1.375rem;\n}\n\n.md .thumb {\n width: 1rem;\n height: 1rem;\n}\n\n.md .thumb[data-state='checked'] {\n transform: translateX(1rem);\n}\n\n.lg .track {\n width: 2.875rem;\n height: 1.625rem;\n}\n\n.lg .thumb {\n width: 1.25rem;\n height: 1.25rem;\n}\n\n.lg .thumb[data-state='checked'] {\n transform: translateX(1.25rem);\n}\n\n.text {\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n}\n\n.label {\n font-size: var(--text-sm);\n line-height: var(--text-sm--line-height);\n font-weight: var(--font-weight-medium);\n color: var(--foreground);\n}\n\n.description {\n font-size: var(--text-xs);\n line-height: var(--text-xs--line-height);\n color: var(--muted-foreground);\n}\n"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|