@velora-cms/ui 0.9.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.
Files changed (37) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +33 -0
  3. package/dist/components/alert-dialog.d.ts +14 -0
  4. package/dist/components/alert-dialog.js +38 -0
  5. package/dist/components/badge.d.ts +9 -0
  6. package/dist/components/badge.js +26 -0
  7. package/dist/components/button.d.ts +11 -0
  8. package/dist/components/button.js +35 -0
  9. package/dist/components/checkbox.d.ts +5 -0
  10. package/dist/components/checkbox.js +7 -0
  11. package/dist/components/dropdown-menu.d.ts +16 -0
  12. package/dist/components/dropdown-menu.js +28 -0
  13. package/dist/components/empty-state.d.ts +13 -0
  14. package/dist/components/empty-state.js +9 -0
  15. package/dist/components/input.d.ts +4 -0
  16. package/dist/components/input.js +6 -0
  17. package/dist/components/panel.d.ts +5 -0
  18. package/dist/components/panel.js +6 -0
  19. package/dist/components/property-field.d.ts +12 -0
  20. package/dist/components/property-field.js +6 -0
  21. package/dist/components/skeleton.d.ts +3 -0
  22. package/dist/components/skeleton.js +9 -0
  23. package/dist/components/switch.d.ts +5 -0
  24. package/dist/components/switch.js +7 -0
  25. package/dist/components/tab-strip.d.ts +30 -0
  26. package/dist/components/tab-strip.js +50 -0
  27. package/dist/components/toast.d.ts +18 -0
  28. package/dist/components/toast.js +39 -0
  29. package/dist/components/toaster.d.ts +12 -0
  30. package/dist/components/toaster.js +11 -0
  31. package/dist/components/use-toast.d.ts +17 -0
  32. package/dist/components/use-toast.js +62 -0
  33. package/dist/index.d.ts +16 -0
  34. package/dist/index.js +16 -0
  35. package/dist/lib/cn.d.ts +2 -0
  36. package/dist/lib/cn.js +5 -0
  37. package/package.json +47 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # @velora-cms/ui
2
+
3
+ Velora's shadcn/ui-derived component library — the primitives the admin UI
4
+ is built from (`Panel`, `PropertyField`, `Input`, `Button`, `Switch`,
5
+ `Badge`, and more). Components consume `@velora-cms/design-tokens` CSS
6
+ variables, so plugin UIs built on top of these automatically match
7
+ whichever theme (built-in or third-party) is active.
8
+
9
+ `@velora-cms/plugin-sdk` has a runtime dependency on this package and
10
+ re-exports a curated subset for plugin authors — install it directly only
11
+ if you need components the SDK doesn't re-export yet.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ npm install @velora-cms/ui
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```tsx
22
+ import { Button, Panel } from "@velora-cms/ui";
23
+
24
+ function Example() {
25
+ return (
26
+ <Panel>
27
+ <Button>Save</Button>
28
+ </Panel>
29
+ );
30
+ }
31
+ ```
32
+
33
+ Part of [Velora](https://github.com/velora-cms/velora). Apache-2.0.
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
3
+ declare const AlertDialog: React.FC<AlertDialogPrimitive.AlertDialogProps>;
4
+ declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogPrimitive.AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
+ declare const AlertDialogPortal: React.FC<AlertDialogPrimitive.AlertDialogPortalProps>;
6
+ declare function AlertDialogOverlay({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>): React.JSX.Element;
7
+ declare function AlertDialogContent({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content>): React.JSX.Element;
8
+ declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
9
+ declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
10
+ declare function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>): React.JSX.Element;
11
+ declare function AlertDialogDescription({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Description>): React.JSX.Element;
12
+ declare function AlertDialogAction({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Action>): React.JSX.Element;
13
+ declare function AlertDialogCancel({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>): React.JSX.Element;
14
+ export { AlertDialog, AlertDialogTrigger, AlertDialogPortal, AlertDialogOverlay, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, };
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
3
+ import { cn } from '../lib/cn.js';
4
+ import { buttonVariants } from './button.js';
5
+ // Ported from shadcn/ui's AlertDialog (Radix under the hood), retargeted
6
+ // to @velora-cms/design-tokens classes, no tailwindcss-animate dependency,
7
+ // and no owned strings — title/description/action labels all come from
8
+ // the caller. For consequential confirmations (snapshot restore, future
9
+ // destructive flows); Radix provides the focus trap, escape handling,
10
+ // and aria wiring.
11
+ const AlertDialog = AlertDialogPrimitive.Root;
12
+ const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
13
+ const AlertDialogPortal = AlertDialogPrimitive.Portal;
14
+ function AlertDialogOverlay({ className, ...props }) {
15
+ return (_jsx(AlertDialogPrimitive.Overlay, { className: cn('fixed inset-0 z-50 bg-background-overlay', className), ...props }));
16
+ }
17
+ function AlertDialogContent({ className, ...props }) {
18
+ return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx(AlertDialogPrimitive.Content, { className: cn('fixed start-1/2 top-1/2 z-50 w-full max-w-lg -translate-y-1/2 ltr:-translate-x-1/2 rtl:translate-x-1/2 rounded-lg border border-border-default bg-background-elevated p-6 shadow-xl', className), ...props })] }));
19
+ }
20
+ function AlertDialogHeader({ className, ...props }) {
21
+ return _jsx("div", { className: cn('flex flex-col gap-2 text-start', className), ...props });
22
+ }
23
+ function AlertDialogFooter({ className, ...props }) {
24
+ return _jsx("div", { className: cn('mt-6 flex justify-end gap-2', className), ...props });
25
+ }
26
+ function AlertDialogTitle({ className, ...props }) {
27
+ return (_jsx(AlertDialogPrimitive.Title, { className: cn('text-base font-semibold text-text-primary', className), ...props }));
28
+ }
29
+ function AlertDialogDescription({ className, ...props }) {
30
+ return (_jsx(AlertDialogPrimitive.Description, { className: cn('text-sm text-text-secondary', className), ...props }));
31
+ }
32
+ function AlertDialogAction({ className, ...props }) {
33
+ return (_jsx(AlertDialogPrimitive.Action, { className: cn(buttonVariants(), className), ...props }));
34
+ }
35
+ function AlertDialogCancel({ className, ...props }) {
36
+ return (_jsx(AlertDialogPrimitive.Cancel, { className: cn(buttonVariants({ variant: 'outline' }), className), ...props }));
37
+ }
38
+ export { AlertDialog, AlertDialogTrigger, AlertDialogPortal, AlertDialogOverlay, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, };
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
+ declare const badgeVariants: (props?: ({
4
+ variant?: "neutral" | "primary" | "success" | "warning" | "danger" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ export interface BadgeProps extends React.ComponentProps<'span'>, VariantProps<typeof badgeVariants> {
7
+ }
8
+ declare function Badge({ className, variant, ...props }: BadgeProps): React.JSX.Element;
9
+ export { Badge, badgeVariants };
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cva } from 'class-variance-authority';
3
+ import { cn } from '../lib/cn.js';
4
+ // Status pill (Draft/Published/Scheduled...). Soft style on purpose:
5
+ // 100-shade fill + 800-shade text are fixed scale values with strong
6
+ // internal contrast, so the pill stays readable in BOTH themes without
7
+ // any theme-remapped color — a solid 500 fill would need per-variant
8
+ // text-contrast juggling (white on amber/emerald 500 fails AA).
9
+ const badgeVariants = cva('inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap', {
10
+ variants: {
11
+ variant: {
12
+ neutral: 'bg-neutral-100 text-neutral-800',
13
+ primary: 'bg-primary-100 text-primary-800',
14
+ success: 'bg-success-100 text-success-800',
15
+ warning: 'bg-warning-100 text-warning-800',
16
+ danger: 'bg-danger-100 text-danger-800',
17
+ },
18
+ },
19
+ defaultVariants: {
20
+ variant: 'neutral',
21
+ },
22
+ });
23
+ function Badge({ className, variant, ...props }) {
24
+ return _jsx("span", { "data-slot": "badge", className: cn(badgeVariants({ variant, className })), ...props });
25
+ }
26
+ export { Badge, badgeVariants };
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
5
+ size?: "default" | "sm" | "lg" | "icon" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends React.ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
8
+ asChild?: boolean;
9
+ }
10
+ declare function Button({ className, variant, size, asChild, ...props }: ButtonProps): React.JSX.Element;
11
+ export { Button, buttonVariants };
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Slot } from '@radix-ui/react-slot';
3
+ import { cva } from 'class-variance-authority';
4
+ import { cn } from '../lib/cn.js';
5
+ // Ported from shadcn/ui's Button, with every utility retargeted to the
6
+ // @velora-cms/design-tokens Tailwind theme — all of these classes resolve
7
+ // to var(--...) references, never baked values (host-provided
8
+ // components constraint).
9
+ const buttonVariants = cva('inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-background-base disabled:pointer-events-none disabled:opacity-50', {
10
+ variants: {
11
+ variant: {
12
+ default: 'bg-primary-500 text-text-inverse hover:bg-primary-600',
13
+ secondary: 'bg-secondary-500 text-text-inverse hover:bg-secondary-600',
14
+ destructive: 'bg-danger-500 text-text-inverse hover:bg-danger-600',
15
+ outline: 'border border-border-default bg-background-elevated text-text-primary hover:bg-background-hover',
16
+ ghost: 'text-text-primary hover:bg-background-hover',
17
+ link: 'text-primary-600 underline-offset-4 hover:underline',
18
+ },
19
+ size: {
20
+ default: 'h-10 px-4 py-2',
21
+ sm: 'h-9 px-3',
22
+ lg: 'h-11 px-8',
23
+ icon: 'h-10 w-10',
24
+ },
25
+ },
26
+ defaultVariants: {
27
+ variant: 'default',
28
+ size: 'default',
29
+ },
30
+ });
31
+ function Button({ className, variant, size, asChild = false, ...props }) {
32
+ const Comp = asChild ? Slot : 'button';
33
+ return (_jsx(Comp, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ...props }));
34
+ }
35
+ export { Button, buttonVariants };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
+ export type CheckboxProps = React.ComponentProps<typeof CheckboxPrimitive.Root>;
4
+ declare function Checkbox({ className, ...props }: CheckboxProps): React.JSX.Element;
5
+ export { Checkbox };
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
+ import { cn } from '../lib/cn.js';
4
+ function Checkbox({ className, ...props }) {
5
+ return (_jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", className: cn('peer h-4 w-4 shrink-0 rounded-sm border border-border-default bg-background-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-background-base disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary-500 data-[state=checked]:bg-primary-500 data-[state=checked]:text-text-inverse', className), ...props, children: _jsx(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: _jsx("svg", { viewBox: "0 0 16 16", fill: "none", className: "h-3.5 w-3.5", "aria-hidden": "true", children: _jsx("path", { d: "M3.5 8.5L6.5 11.5L12.5 4.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }) }));
6
+ }
7
+ export { Checkbox };
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
3
+ declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
4
+ declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
+ declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
6
+ declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
7
+ declare function DropdownMenuContent({ className, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): React.JSX.Element;
8
+ declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
9
+ inset?: boolean;
10
+ variant?: 'default' | 'destructive';
11
+ }): React.JSX.Element;
12
+ declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
13
+ inset?: boolean;
14
+ }): React.JSX.Element;
15
+ declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): React.JSX.Element;
16
+ export { DropdownMenu, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuGroup, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, };
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
3
+ import { cn } from '../lib/cn.js';
4
+ // Ported from shadcn/ui's DropdownMenu (Radix under the hood), retargeted
5
+ // to @velora-cms/design-tokens classes, no tailwindcss-animate dependency —
6
+ // same porting convention as alert-dialog.tsx (no owned strings, Radix
7
+ // handles focus trap / typeahead / aria wiring). Added for Session 154's
8
+ // row overflow (⋯) menu, the first place this admin needs more than two
9
+ // row actions.
10
+ const DropdownMenu = DropdownMenuPrimitive.Root;
11
+ const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
12
+ const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
13
+ const DropdownMenuGroup = DropdownMenuPrimitive.Group;
14
+ function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
15
+ return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { sideOffset: sideOffset, className: cn('z-50 min-w-[10rem] overflow-hidden rounded-md border border-border-default bg-background-elevated p-1 text-text-primary shadow-xl', className), ...props }) }));
16
+ }
17
+ function DropdownMenuItem({ className, inset, variant = 'default', ...props }) {
18
+ return (_jsx(DropdownMenuPrimitive.Item, { className: cn('relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50', variant === 'destructive'
19
+ ? 'text-danger-600 data-[highlighted]:bg-danger-100 data-[highlighted]:text-danger-700'
20
+ : 'text-text-primary data-[highlighted]:bg-background-hover', inset && 'ps-8', className), ...props }));
21
+ }
22
+ function DropdownMenuLabel({ className, inset, ...props }) {
23
+ return (_jsx(DropdownMenuPrimitive.Label, { className: cn('px-2 py-1.5 text-xs font-semibold text-text-secondary', inset && 'ps-8', className), ...props }));
24
+ }
25
+ function DropdownMenuSeparator({ className, ...props }) {
26
+ return (_jsx(DropdownMenuPrimitive.Separator, { className: cn('-mx-1 my-1 h-px bg-border-default', className), ...props }));
27
+ }
28
+ export { DropdownMenu, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuGroup, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, };
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ export interface EmptyStateProps extends React.ComponentProps<'div'> {
3
+ /** Icon element (e.g. a lucide icon) — sized/colored by the caller. */
4
+ icon?: React.ReactNode;
5
+ /** Translated title — this component owns no strings. */
6
+ title: string;
7
+ /** Optional translated supporting text. */
8
+ description?: string;
9
+ /** Optional primary action (usually a Button). */
10
+ action?: React.ReactNode;
11
+ }
12
+ declare function EmptyState({ icon, title, description, action, className, ...props }: EmptyStateProps): React.JSX.Element;
13
+ export { EmptyState };
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from '../lib/cn.js';
3
+ // Standard empty-state pattern: icon + message + primary action, used
4
+ // wherever a list can be empty (content tree, document type list, media
5
+ // grid, ...) instead of a raw blank area.
6
+ function EmptyState({ icon, title, description, action, className, ...props }) {
7
+ return (_jsxs("div", { "data-slot": "empty-state", className: cn('flex flex-col items-center justify-center gap-2 rounded-md border border-dashed border-border-default px-6 py-10 text-center', className), ...props, children: [icon && _jsx("div", { className: "text-text-secondary [&>svg]:h-8 [&>svg]:w-8", children: icon }), _jsx("p", { className: "text-sm font-medium text-text-primary", children: title }), description && _jsx("p", { className: "max-w-sm text-sm text-text-secondary", children: description }), action && _jsx("div", { className: "mt-2", children: action })] }));
8
+ }
9
+ export { EmptyState };
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ export type InputProps = React.ComponentProps<'input'>;
3
+ declare function Input({ className, type, ...props }: InputProps): React.JSX.Element;
4
+ export { Input };
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from '../lib/cn.js';
3
+ function Input({ className, type, ...props }) {
4
+ return (_jsx("input", { type: type, "data-slot": "input", className: cn('flex h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 py-2 text-sm text-text-primary placeholder:text-text-disabled file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-background-base disabled:cursor-not-allowed disabled:opacity-50', className), ...props }));
5
+ }
6
+ export { Input };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface PanelProps extends React.ComponentProps<'div'> {
3
+ }
4
+ declare function Panel({ className, ...props }: PanelProps): React.JSX.Element;
5
+ export { Panel };
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from '../lib/cn.js';
3
+ function Panel({ className, ...props }) {
4
+ return (_jsx("div", { "data-slot": "panel", className: cn('rounded-lg border border-border-default bg-background-elevated p-6 shadow-sm', className), ...props }));
5
+ }
6
+ export { Panel };
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ export interface PropertyFieldProps extends Omit<React.ComponentProps<'div'>, 'children'> {
3
+ label: React.ReactNode;
4
+ htmlFor?: string;
5
+ required?: boolean;
6
+ requiredText?: string;
7
+ helpText?: React.ReactNode;
8
+ error?: React.ReactNode;
9
+ children: React.ReactNode;
10
+ }
11
+ declare function PropertyField({ label, htmlFor, required, requiredText, helpText, error, className, children, ...props }: PropertyFieldProps): React.JSX.Element;
12
+ export { PropertyField };
@@ -0,0 +1,6 @@
1
+ import { jsxs as _jsxs, Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from '../lib/cn.js';
3
+ function PropertyField({ label, htmlFor, required, requiredText, helpText, error, className, children, ...props }) {
4
+ return (_jsxs("div", { "data-slot": "property-field", className: cn('flex flex-col gap-1.5', className), ...props, children: [_jsxs("label", { htmlFor: htmlFor, className: "text-sm font-medium text-text-primary", children: [label, required && (_jsxs(_Fragment, { children: [_jsxs("span", { "aria-hidden": "true", className: "text-danger-600", children: [' ', "*"] }), requiredText && _jsxs("span", { className: "sr-only", children: [" (", requiredText, ")"] })] }))] }), children, error ? (_jsx("p", { role: "alert", className: "text-xs text-danger-600", children: error })) : (helpText && _jsx("p", { className: "text-xs text-text-secondary", children: helpText }))] }));
5
+ }
6
+ export { PropertyField };
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare function Skeleton({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
3
+ export { Skeleton };
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from '../lib/cn.js';
3
+ // Loading placeholder for async lists. background.hover is deliberately
4
+ // reused as the shimmer base — it's the "subtle wash" token and is
5
+ // theme-remapped, so the skeleton stays subtle in dark mode too.
6
+ function Skeleton({ className, ...props }) {
7
+ return (_jsx("div", { "data-slot": "skeleton", "aria-hidden": "true", className: cn('animate-pulse rounded-md bg-background-hover', className), ...props }));
8
+ }
9
+ export { Skeleton };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import * as SwitchPrimitive from '@radix-ui/react-switch';
3
+ export type SwitchProps = React.ComponentProps<typeof SwitchPrimitive.Root>;
4
+ declare function Switch({ className, ...props }: SwitchProps): React.JSX.Element;
5
+ export { Switch };
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as SwitchPrimitive from '@radix-ui/react-switch';
3
+ import { cn } from '../lib/cn.js';
4
+ function Switch({ className, ...props }) {
5
+ return (_jsx(SwitchPrimitive.Root, { "data-slot": "switch", className: cn('peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-background-base disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary-500 data-[state=unchecked]:bg-border-strong', className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: "pointer-events-none block h-5 w-5 rounded-full bg-background-elevated shadow-sm ring-0 transition-transform data-[state=unchecked]:translate-x-0 ltr:data-[state=checked]:translate-x-5 rtl:data-[state=checked]:-translate-x-5" }) }));
6
+ }
7
+ export { Switch };
@@ -0,0 +1,30 @@
1
+ import * as React from 'react';
2
+ export interface TabStripItem {
3
+ id: string;
4
+ label: string;
5
+ /** Shows a small error dot next to the label (e.g. a blocked-save
6
+ * validation error on a field that lives in this tab, when the tab
7
+ * itself isn't the active one). */
8
+ hasError?: boolean;
9
+ }
10
+ export interface TabStripProps {
11
+ tabs: TabStripItem[];
12
+ activeId: string;
13
+ onChange: (id: string) => void;
14
+ /** Accessible name for the tablist — pass translated text. */
15
+ label: string;
16
+ /** Appended to a tab's accessible name when that tab's `hasError` is
17
+ * set (e.g. "Has an error") — pass translated text. Only needed if any
18
+ * tab uses `hasError`. */
19
+ errorLabel?: string;
20
+ /**
21
+ * Prefix for the generated tab/panel DOM ids so aria-controls /
22
+ * aria-labelledby wiring stays consistent — pair with tabStripTabId /
23
+ * tabStripPanelId on the consumer's panel element.
24
+ */
25
+ idPrefix: string;
26
+ className?: string;
27
+ }
28
+ export declare function tabStripTabId(idPrefix: string, id: string): string;
29
+ export declare function tabStripPanelId(idPrefix: string, id: string): string;
30
+ export declare function TabStrip({ tabs, activeId, onChange, label, errorLabel, idPrefix, className }: TabStripProps): React.JSX.Element;
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from '../lib/cn.js';
3
+ export function tabStripTabId(idPrefix, id) {
4
+ return `${idPrefix}-tab-${id}`;
5
+ }
6
+ export function tabStripPanelId(idPrefix, id) {
7
+ return `${idPrefix}-panel-${id}`;
8
+ }
9
+ // Roving-tabindex tab strip (WAI-ARIA tabs pattern): the active tab is the
10
+ // only tab stop; Arrow/Home/End move activation. Arrow direction flips
11
+ // under dir="rtl" to follow the visual order.
12
+ export function TabStrip({ tabs, activeId, onChange, label, errorLabel, idPrefix, className }) {
13
+ function handleKeyDown(event) {
14
+ const index = tabs.findIndex((tab) => tab.id === activeId);
15
+ if (index === -1)
16
+ return;
17
+ const rtl = event.currentTarget.ownerDocument.documentElement.dir === 'rtl';
18
+ let next;
19
+ switch (event.key) {
20
+ case 'ArrowRight':
21
+ next = rtl ? index - 1 : index + 1;
22
+ break;
23
+ case 'ArrowLeft':
24
+ next = rtl ? index + 1 : index - 1;
25
+ break;
26
+ case 'Home':
27
+ next = 0;
28
+ break;
29
+ case 'End':
30
+ next = tabs.length - 1;
31
+ break;
32
+ default:
33
+ return;
34
+ }
35
+ event.preventDefault();
36
+ const target = tabs[(next + tabs.length) % tabs.length];
37
+ if (!target)
38
+ return;
39
+ onChange(target.id);
40
+ event.currentTarget
41
+ .querySelector(`#${CSS.escape(tabStripTabId(idPrefix, target.id))}`)
42
+ ?.focus();
43
+ }
44
+ return (_jsx("div", { role: "tablist", "aria-label": label, onKeyDown: handleKeyDown, className: cn('flex items-end gap-1 overflow-x-auto border-b border-border-default', className), children: tabs.map((tab) => {
45
+ const active = tab.id === activeId;
46
+ return (_jsxs("button", { type: "button", role: "tab", id: tabStripTabId(idPrefix, tab.id), "aria-selected": active, "aria-controls": tabStripPanelId(idPrefix, tab.id), "aria-label": tab.hasError && errorLabel ? `${tab.label} — ${errorLabel}` : undefined, tabIndex: active ? 0 : -1, onClick: () => onChange(tab.id), className: cn('-mb-px inline-flex items-center gap-1 whitespace-nowrap rounded-t-md border-b-2 px-4 py-2 text-sm transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-background-base', active
47
+ ? 'border-primary-500 font-medium text-text-primary'
48
+ : 'border-transparent text-text-secondary hover:text-text-primary'), children: [tab.label, tab.hasError && (_jsx("span", { "aria-hidden": "true", className: "size-1 shrink-0 rounded-full bg-danger-500" }))] }, tab.id));
49
+ }) }));
50
+ }
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import * as ToastPrimitives from '@radix-ui/react-toast';
3
+ import { type VariantProps } from 'class-variance-authority';
4
+ declare const ToastProvider: React.FC<ToastPrimitives.ToastProviderProps>;
5
+ declare function ToastViewport({ className, ...props }: React.ComponentProps<typeof ToastPrimitives.Viewport>): React.JSX.Element;
6
+ declare const toastVariants: (props?: ({
7
+ variant?: "default" | "success" | "danger" | null | undefined;
8
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
+ export interface ToastProps extends React.ComponentProps<typeof ToastPrimitives.Root>, VariantProps<typeof toastVariants> {
10
+ }
11
+ declare function Toast({ className, variant, ...props }: ToastProps): React.JSX.Element;
12
+ declare function ToastTitle({ className, ...props }: React.ComponentProps<typeof ToastPrimitives.Title>): React.JSX.Element;
13
+ declare function ToastDescription({ className, ...props }: React.ComponentProps<typeof ToastPrimitives.Description>): React.JSX.Element;
14
+ interface ToastCloseProps extends React.ComponentProps<typeof ToastPrimitives.Close> {
15
+ 'aria-label': string;
16
+ }
17
+ declare function ToastClose({ className, ...props }: ToastCloseProps): React.JSX.Element;
18
+ export { ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose };
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as ToastPrimitives from '@radix-ui/react-toast';
3
+ import { cva } from 'class-variance-authority';
4
+ import { cn } from '../lib/cn.js';
5
+ // Ported from shadcn/ui's Toast (Radix @radix-ui/react-toast under the
6
+ // hood), retargeted to @velora-cms/design-tokens classes and trimmed: no
7
+ // tailwindcss-animate dependency (swipe transforms via arbitrary values
8
+ // only), logical properties for the viewport position, and no owned
9
+ // strings — the close button's aria-label comes from the caller
10
+ // (see Toaster).
11
+ const ToastProvider = ToastPrimitives.Provider;
12
+ function ToastViewport({ className, ...props }) {
13
+ return (_jsx(ToastPrimitives.Viewport, { className: cn('fixed bottom-0 end-0 z-50 flex max-h-screen w-full flex-col gap-2 p-4 sm:max-w-sm', className), ...props }));
14
+ }
15
+ const toastVariants = cva('group pointer-events-auto relative flex w-full items-center justify-between gap-4 overflow-hidden rounded-md border bg-background-elevated p-4 pe-8 text-text-primary shadow-lg transition-opacity data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[swipe=cancel]:translate-x-0 data-[swipe=end]:opacity-0 data-[state=closed]:opacity-0', {
16
+ variants: {
17
+ variant: {
18
+ default: 'border-border-default',
19
+ success: 'border-success-500',
20
+ danger: 'border-danger-500',
21
+ },
22
+ },
23
+ defaultVariants: {
24
+ variant: 'default',
25
+ },
26
+ });
27
+ function Toast({ className, variant, ...props }) {
28
+ return (_jsx(ToastPrimitives.Root, { className: cn(toastVariants({ variant, className })), ...props }));
29
+ }
30
+ function ToastTitle({ className, ...props }) {
31
+ return _jsx(ToastPrimitives.Title, { className: cn('text-sm font-semibold', className), ...props });
32
+ }
33
+ function ToastDescription({ className, ...props }) {
34
+ return (_jsx(ToastPrimitives.Description, { className: cn('text-sm text-text-secondary', className), ...props }));
35
+ }
36
+ function ToastClose({ className, ...props }) {
37
+ return (_jsx(ToastPrimitives.Close, { className: cn('absolute end-2 top-2 rounded-md p-1 text-text-secondary transition-colors duration-fast hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500', className), ...props, children: _jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "h-4 w-4", children: [_jsx("path", { d: "M18 6 6 18" }), _jsx("path", { d: "m6 6 12 12" })] }) }));
38
+ }
39
+ export { ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose };
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ export interface ToasterProps {
3
+ /** Translated aria-label for each toast's close button. */
4
+ closeLabel: string;
5
+ /**
6
+ * Translated screen-reader announcement label (Radix prepends it to
7
+ * each toast's announced text; its built-in default is English
8
+ * "Notification", which would bypass i18n).
9
+ */
10
+ label: string;
11
+ }
12
+ export declare function Toaster({ closeLabel, label }: ToasterProps): React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, } from './toast.js';
3
+ import { useToast } from './use-toast.js';
4
+ // Mount once at the app root; toast() calls from anywhere render here.
5
+ export function Toaster({ closeLabel, label }) {
6
+ const { toasts } = useToast();
7
+ // Swipe-to-dismiss should push toward the nearest screen edge, which is
8
+ // direction-dependent (the viewport sits at inset-inline-end).
9
+ const swipeDirection = typeof document !== 'undefined' && document.documentElement.dir === 'rtl' ? 'left' : 'right';
10
+ return (_jsxs(ToastProvider, { label: label, swipeDirection: swipeDirection, children: [toasts.map(({ id, title, description, ...props }) => (_jsxs(Toast, { ...props, children: [_jsxs("div", { className: "grid gap-1", children: [title && _jsx(ToastTitle, { children: title }), description && _jsx(ToastDescription, { children: description })] }), _jsx(ToastClose, { "aria-label": closeLabel })] }, id))), _jsx(ToastViewport, {})] }));
11
+ }
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import type { ToastProps } from './toast.js';
3
+ export interface ToasterToast extends Omit<ToastProps, 'title'> {
4
+ id: string;
5
+ title?: React.ReactNode;
6
+ description?: React.ReactNode;
7
+ }
8
+ export declare function dismiss(id?: string): void;
9
+ export declare function toast(props: Omit<ToasterToast, 'id' | 'open' | 'onOpenChange'>): {
10
+ id: string;
11
+ dismiss: () => void;
12
+ };
13
+ export declare function useToast(): {
14
+ toast: typeof toast;
15
+ dismiss: typeof dismiss;
16
+ toasts: ToasterToast[];
17
+ };
@@ -0,0 +1,62 @@
1
+ import * as React from 'react';
2
+ // Module-level toast store (shadcn/ui's use-toast pattern, trimmed):
3
+ // toast() can be called from anywhere — event handlers, async completions
4
+ // — and every mounted useToast() subscriber re-renders. The Toaster is
5
+ // the one subscriber in practice.
6
+ const TOAST_LIMIT = 3;
7
+ // How long a dismissed toast stays in state after close, so Radix can
8
+ // finish its exit transition before the element unmounts.
9
+ const TOAST_REMOVE_DELAY = 300;
10
+ let counter = 0;
11
+ function nextId() {
12
+ counter = (counter + 1) % Number.MAX_SAFE_INTEGER;
13
+ return counter.toString();
14
+ }
15
+ const listeners = new Set();
16
+ let memoryState = { toasts: [] };
17
+ const removeTimeouts = new Map();
18
+ function setState(next) {
19
+ memoryState = next;
20
+ listeners.forEach((listener) => listener(memoryState));
21
+ }
22
+ function scheduleRemove(id) {
23
+ if (removeTimeouts.has(id))
24
+ return;
25
+ removeTimeouts.set(id, setTimeout(() => {
26
+ removeTimeouts.delete(id);
27
+ setState({ toasts: memoryState.toasts.filter((toast) => toast.id !== id) });
28
+ }, TOAST_REMOVE_DELAY));
29
+ }
30
+ export function dismiss(id) {
31
+ const targets = id === undefined ? memoryState.toasts.map((toast) => toast.id) : [id];
32
+ setState({
33
+ toasts: memoryState.toasts.map((toast) => targets.includes(toast.id) ? { ...toast, open: false } : toast),
34
+ });
35
+ targets.forEach(scheduleRemove);
36
+ }
37
+ export function toast(props) {
38
+ const id = nextId();
39
+ const entry = {
40
+ ...props,
41
+ id,
42
+ open: true,
43
+ // Radix drives open=false on auto-dismiss timeout and swipe-away;
44
+ // route both through dismiss() so removal is scheduled either way.
45
+ onOpenChange: (open) => {
46
+ if (!open)
47
+ dismiss(id);
48
+ },
49
+ };
50
+ setState({ toasts: [entry, ...memoryState.toasts].slice(0, TOAST_LIMIT) });
51
+ return { id, dismiss: () => dismiss(id) };
52
+ }
53
+ export function useToast() {
54
+ const [state, setLocal] = React.useState(memoryState);
55
+ React.useEffect(() => {
56
+ listeners.add(setLocal);
57
+ return () => {
58
+ listeners.delete(setLocal);
59
+ };
60
+ }, []);
61
+ return { ...state, toast, dismiss };
62
+ }
@@ -0,0 +1,16 @@
1
+ export { Button, buttonVariants, type ButtonProps } from './components/button.js';
2
+ export { Input, type InputProps } from './components/input.js';
3
+ export { Checkbox, type CheckboxProps } from './components/checkbox.js';
4
+ export { Switch, type SwitchProps } from './components/switch.js';
5
+ export { Panel, type PanelProps } from './components/panel.js';
6
+ export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, } from './components/alert-dialog.js';
7
+ export { Badge, badgeVariants, type BadgeProps } from './components/badge.js';
8
+ export { DropdownMenu, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuGroup, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, } from './components/dropdown-menu.js';
9
+ export { EmptyState, type EmptyStateProps } from './components/empty-state.js';
10
+ export { Skeleton } from './components/skeleton.js';
11
+ export { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, type ToastProps, } from './components/toast.js';
12
+ export { Toaster, type ToasterProps } from './components/toaster.js';
13
+ export { toast, dismiss, useToast, type ToasterToast } from './components/use-toast.js';
14
+ export { PropertyField, type PropertyFieldProps } from './components/property-field.js';
15
+ export { TabStrip, tabStripPanelId, tabStripTabId, type TabStripItem, type TabStripProps, } from './components/tab-strip.js';
16
+ export { cn } from './lib/cn.js';
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ export { Button, buttonVariants } from './components/button.js';
2
+ export { Input } from './components/input.js';
3
+ export { Checkbox } from './components/checkbox.js';
4
+ export { Switch } from './components/switch.js';
5
+ export { Panel } from './components/panel.js';
6
+ export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, } from './components/alert-dialog.js';
7
+ export { Badge, badgeVariants } from './components/badge.js';
8
+ export { DropdownMenu, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuGroup, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, } from './components/dropdown-menu.js';
9
+ export { EmptyState } from './components/empty-state.js';
10
+ export { Skeleton } from './components/skeleton.js';
11
+ export { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, } from './components/toast.js';
12
+ export { Toaster } from './components/toaster.js';
13
+ export { toast, dismiss, useToast } from './components/use-toast.js';
14
+ export { PropertyField } from './components/property-field.js';
15
+ export { TabStrip, tabStripPanelId, tabStripTabId, } from './components/tab-strip.js';
16
+ export { cn } from './lib/cn.js';
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
package/dist/lib/cn.js ADDED
@@ -0,0 +1,5 @@
1
+ import { clsx } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+ export function cn(...inputs) {
4
+ return twMerge(clsx(inputs));
5
+ }
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@velora-cms/ui",
3
+ "version": "0.9.0",
4
+ "license": "Apache-2.0",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/velora-cms/velora.git",
14
+ "directory": "packages/ui"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "dependencies": {
20
+ "@radix-ui/react-alert-dialog": "1.1.18",
21
+ "@radix-ui/react-checkbox": "1.3.6",
22
+ "@radix-ui/react-dropdown-menu": "2.1.24",
23
+ "@radix-ui/react-slot": "1.3.0",
24
+ "@radix-ui/react-switch": "1.3.7",
25
+ "@radix-ui/react-toast": "1.2.18",
26
+ "class-variance-authority": "0.7.1",
27
+ "clsx": "2.1.1",
28
+ "tailwind-merge": "3.6.0"
29
+ },
30
+ "peerDependencies": {
31
+ "react": "^19.0.0",
32
+ "react-dom": "^19.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "@testing-library/react": "16.3.2",
36
+ "@types/react": "19.2.17",
37
+ "@types/react-dom": "19.2.3",
38
+ "jsdom": "26.1.0",
39
+ "react": "19.2.7",
40
+ "react-dom": "19.2.7",
41
+ "vitest": "3.2.6"
42
+ },
43
+ "scripts": {
44
+ "build": "tsc -p .",
45
+ "test": "vitest run"
46
+ }
47
+ }