@epicbagel/saas-kit 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/dist/chunk-D5EHW3O2.cjs +52 -0
- package/dist/chunk-F3DAFAMD.js +271 -0
- package/dist/chunk-HAP6USTP.cjs +46 -0
- package/dist/chunk-HAQOT2CD.js +46 -0
- package/dist/chunk-TWCJMFST.js +260 -0
- package/dist/chunk-U3YFP6ZV.cjs +273 -0
- package/dist/chunk-X3PRMR5G.js +52 -0
- package/dist/chunk-ZJFYOXSM.cjs +260 -0
- package/dist/lib/neutral-theme.cjs +39 -236
- package/dist/lib/neutral-theme.d.cts +44 -2
- package/dist/lib/neutral-theme.d.ts +44 -2
- package/dist/lib/neutral-theme.js +23 -219
- package/dist/primitives/field.cjs +12 -239
- package/dist/primitives/field.js +16 -243
- package/dist/primitives/radio-group.cjs +4 -39
- package/dist/primitives/radio-group.js +4 -39
- package/dist/primitives/theme-selector.cjs +188 -0
- package/dist/primitives/theme-selector.d.cts +78 -0
- package/dist/primitives/theme-selector.d.ts +78 -0
- package/dist/primitives/theme-selector.js +188 -0
- package/dist/primitives/toggle-group.cjs +5 -45
- package/dist/primitives/toggle-group.js +5 -45
- package/package.json +11 -1
package/dist/primitives/field.js
CHANGED
|
@@ -1,249 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
{
|
|
21
|
-
"data-slot": "field-set",
|
|
22
|
-
className: cn(
|
|
23
|
-
"flex flex-col gap-6",
|
|
24
|
-
"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
25
|
-
className
|
|
26
|
-
),
|
|
27
|
-
...props
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
function FieldLegend({
|
|
32
|
-
className,
|
|
33
|
-
variant = "legend",
|
|
34
|
-
...props
|
|
35
|
-
}) {
|
|
36
|
-
return /* @__PURE__ */ jsx(
|
|
37
|
-
"legend",
|
|
38
|
-
{
|
|
39
|
-
"data-slot": "field-legend",
|
|
40
|
-
"data-variant": variant,
|
|
41
|
-
className: cn(
|
|
42
|
-
"mb-3 font-medium",
|
|
43
|
-
"data-[variant=legend]:text-base",
|
|
44
|
-
"data-[variant=label]:text-sm",
|
|
45
|
-
className
|
|
46
|
-
),
|
|
47
|
-
...props
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
function FieldGroup({ className, ...props }) {
|
|
52
|
-
return /* @__PURE__ */ jsx(
|
|
53
|
-
"div",
|
|
54
|
-
{
|
|
55
|
-
"data-slot": "field-group",
|
|
56
|
-
className: cn(
|
|
57
|
-
"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
|
|
58
|
-
className
|
|
59
|
-
),
|
|
60
|
-
...props
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
var fieldVariants = cva(
|
|
65
|
-
"group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
|
|
66
|
-
{
|
|
67
|
-
variants: {
|
|
68
|
-
orientation: {
|
|
69
|
-
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
70
|
-
horizontal: [
|
|
71
|
-
"flex-row items-center",
|
|
72
|
-
"[&>[data-slot=field-label]]:flex-auto",
|
|
73
|
-
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
74
|
-
],
|
|
75
|
-
responsive: [
|
|
76
|
-
"flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto",
|
|
77
|
-
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
78
|
-
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
defaultVariants: { orientation: "vertical" }
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
function Field({
|
|
86
|
-
className,
|
|
87
|
-
orientation = "vertical",
|
|
88
|
-
...props
|
|
89
|
-
}) {
|
|
90
|
-
return /* @__PURE__ */ jsx(
|
|
91
|
-
"div",
|
|
92
|
-
{
|
|
93
|
-
role: "group",
|
|
94
|
-
"data-slot": "field",
|
|
95
|
-
"data-orientation": orientation,
|
|
96
|
-
className: cn(fieldVariants({ orientation }), className),
|
|
97
|
-
...props
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
function FieldContent({ className, ...props }) {
|
|
102
|
-
return /* @__PURE__ */ jsx(
|
|
103
|
-
"div",
|
|
104
|
-
{
|
|
105
|
-
"data-slot": "field-content",
|
|
106
|
-
className: cn(
|
|
107
|
-
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
|
|
108
|
-
className
|
|
109
|
-
),
|
|
110
|
-
...props
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
function FieldLabel({ className, ...props }) {
|
|
115
|
-
return /* @__PURE__ */ jsx(
|
|
116
|
-
Label,
|
|
117
|
-
{
|
|
118
|
-
"data-slot": "field-label",
|
|
119
|
-
className: cn(
|
|
120
|
-
"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
|
|
121
|
-
"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4",
|
|
122
|
-
"has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10",
|
|
123
|
-
className
|
|
124
|
-
),
|
|
125
|
-
...props
|
|
126
|
-
}
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
function FieldTitle({ className, ...props }) {
|
|
130
|
-
return /* @__PURE__ */ jsx(
|
|
131
|
-
"div",
|
|
132
|
-
{
|
|
133
|
-
"data-slot": "field-label",
|
|
134
|
-
className: cn(
|
|
135
|
-
"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
|
|
136
|
-
className
|
|
137
|
-
),
|
|
138
|
-
...props
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
function FieldDescription({ className, ...props }) {
|
|
143
|
-
return /* @__PURE__ */ jsx(
|
|
144
|
-
"p",
|
|
145
|
-
{
|
|
146
|
-
"data-slot": "field-description",
|
|
147
|
-
className: cn(
|
|
148
|
-
"text-sm leading-normal font-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance",
|
|
149
|
-
"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
|
|
150
|
-
"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
151
|
-
className
|
|
152
|
-
),
|
|
153
|
-
...props
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
function FieldSeparator({
|
|
158
|
-
children,
|
|
159
|
-
className,
|
|
160
|
-
...props
|
|
161
|
-
}) {
|
|
162
|
-
return /* @__PURE__ */ jsxs(
|
|
163
|
-
"div",
|
|
164
|
-
{
|
|
165
|
-
"data-slot": "field-separator",
|
|
166
|
-
"data-content": !!children,
|
|
167
|
-
className: cn(
|
|
168
|
-
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
|
|
169
|
-
className
|
|
170
|
-
),
|
|
171
|
-
...props,
|
|
172
|
-
children: [
|
|
173
|
-
/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }),
|
|
174
|
-
children && /* @__PURE__ */ jsx(
|
|
175
|
-
"span",
|
|
176
|
-
{
|
|
177
|
-
className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
|
|
178
|
-
"data-slot": "field-separator-content",
|
|
179
|
-
children
|
|
180
|
-
}
|
|
181
|
-
)
|
|
182
|
-
]
|
|
183
|
-
}
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
function FieldError({
|
|
187
|
-
className,
|
|
188
|
-
children,
|
|
189
|
-
errors,
|
|
190
|
-
...props
|
|
191
|
-
}) {
|
|
192
|
-
const content = useMemo(() => {
|
|
193
|
-
if (children) return children;
|
|
194
|
-
if (!errors?.length) return null;
|
|
195
|
-
const uniqueErrors = [
|
|
196
|
-
...new Map(errors.map((error) => [error?.message, error])).values()
|
|
197
|
-
];
|
|
198
|
-
if (uniqueErrors.length === 1) return uniqueErrors[0]?.message;
|
|
199
|
-
return /* @__PURE__ */ jsx("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
|
|
200
|
-
(error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index)
|
|
201
|
-
) });
|
|
202
|
-
}, [children, errors]);
|
|
203
|
-
if (!content) return null;
|
|
204
|
-
return /* @__PURE__ */ jsx(
|
|
205
|
-
"div",
|
|
206
|
-
{
|
|
207
|
-
role: "alert",
|
|
208
|
-
"data-slot": "field-error",
|
|
209
|
-
className: cn("text-sm font-normal text-destructive", className),
|
|
210
|
-
...props,
|
|
211
|
-
children: content
|
|
212
|
-
}
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
function FormField({
|
|
216
|
-
label,
|
|
217
|
-
htmlFor,
|
|
218
|
-
actions,
|
|
219
|
-
description,
|
|
220
|
-
children,
|
|
221
|
-
className,
|
|
222
|
-
...props
|
|
223
|
-
}) {
|
|
224
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-1.5", className), ...props, children: [
|
|
225
|
-
(label || actions) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
226
|
-
typeof label === "string" ? /* @__PURE__ */ jsx(Label, { htmlFor, children: label }) : label,
|
|
227
|
-
actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: actions })
|
|
228
|
-
] }),
|
|
229
|
-
children,
|
|
230
|
-
description && /* @__PURE__ */ jsx("p", { className: "text-sm leading-relaxed text-muted-foreground", children: description })
|
|
231
|
-
] });
|
|
232
|
-
}
|
|
233
|
-
var columnStyles = {
|
|
234
|
-
1: "grid-cols-1",
|
|
235
|
-
2: "grid-cols-1 sm:grid-cols-2",
|
|
236
|
-
3: "grid-cols-1 sm:grid-cols-3"
|
|
237
|
-
};
|
|
238
|
-
function FieldGrid({ columns = 2, gap = "default", className, ...props }) {
|
|
239
|
-
return /* @__PURE__ */ jsx(
|
|
240
|
-
"div",
|
|
241
|
-
{
|
|
242
|
-
className: cn("grid", gap === "default" ? "gap-4" : "gap-8", columnStyles[columns], className),
|
|
243
|
-
...props
|
|
244
|
-
}
|
|
245
|
-
);
|
|
246
|
-
}
|
|
4
|
+
Field,
|
|
5
|
+
FieldContent,
|
|
6
|
+
FieldDescription,
|
|
7
|
+
FieldError,
|
|
8
|
+
FieldGrid,
|
|
9
|
+
FieldGroup,
|
|
10
|
+
FieldLabel,
|
|
11
|
+
FieldLegend,
|
|
12
|
+
FieldSeparator,
|
|
13
|
+
FieldSet,
|
|
14
|
+
FieldTitle,
|
|
15
|
+
FormField
|
|
16
|
+
} from "../chunk-TWCJMFST.js";
|
|
17
|
+
import "../chunk-HYTILYE5.js";
|
|
18
|
+
import "../chunk-E2TQMDO7.js";
|
|
19
|
+
import "../chunk-G6SRSWXB.js";
|
|
247
20
|
export {
|
|
248
21
|
Field,
|
|
249
22
|
FieldContent,
|
|
@@ -1,46 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var _chunkKWLSBTB2cjs = require('../chunk-KWLSBTB2.cjs');
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _react = require('react'); var React = _interopRequireWildcard(_react);
|
|
10
|
-
var _lucidereact = require('lucide-react');
|
|
11
|
-
var _jsxruntime = require('react/jsx-runtime');
|
|
12
|
-
var RadioGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
13
|
-
RadioGroupPrimitive.Root,
|
|
14
|
-
{
|
|
15
|
-
ref,
|
|
16
|
-
"data-slot": "radio-group",
|
|
17
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0, "grid gap-3", className),
|
|
18
|
-
...props
|
|
19
|
-
}
|
|
20
|
-
));
|
|
21
|
-
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
22
|
-
var RadioGroupItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
23
|
-
RadioGroupPrimitive.Item,
|
|
24
|
-
{
|
|
25
|
-
ref,
|
|
26
|
-
"data-slot": "radio-group-item",
|
|
27
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
28
|
-
"aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
|
|
29
|
-
className
|
|
30
|
-
),
|
|
31
|
-
...props,
|
|
32
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
33
|
-
RadioGroupPrimitive.Indicator,
|
|
34
|
-
{
|
|
35
|
-
"data-slot": "radio-group-indicator",
|
|
36
|
-
className: "relative flex items-center justify-center",
|
|
37
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CircleIcon, { className: "absolute left-1/2 top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 fill-primary" })
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
));
|
|
42
|
-
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
6
|
+
var _chunkHAP6USTPcjs = require('../chunk-HAP6USTP.cjs');
|
|
7
|
+
require('../chunk-KWLSBTB2.cjs');
|
|
43
8
|
|
|
44
9
|
|
|
45
10
|
|
|
46
|
-
exports.RadioGroup = RadioGroup; exports.RadioGroupItem = RadioGroupItem;
|
|
11
|
+
exports.RadioGroup = _chunkHAP6USTPcjs.RadioGroup; exports.RadioGroupItem = _chunkHAP6USTPcjs.RadioGroupItem;
|
|
@@ -1,45 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
9
|
-
import * as React from "react";
|
|
10
|
-
import { CircleIcon } from "lucide-react";
|
|
11
|
-
import { jsx } from "react/jsx-runtime";
|
|
12
|
-
var RadioGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
13
|
-
RadioGroupPrimitive.Root,
|
|
14
|
-
{
|
|
15
|
-
ref,
|
|
16
|
-
"data-slot": "radio-group",
|
|
17
|
-
className: cn("grid gap-3", className),
|
|
18
|
-
...props
|
|
19
|
-
}
|
|
20
|
-
));
|
|
21
|
-
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
22
|
-
var RadioGroupItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
23
|
-
RadioGroupPrimitive.Item,
|
|
24
|
-
{
|
|
25
|
-
ref,
|
|
26
|
-
"data-slot": "radio-group-item",
|
|
27
|
-
className: cn(
|
|
28
|
-
"aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
|
|
29
|
-
className
|
|
30
|
-
),
|
|
31
|
-
...props,
|
|
32
|
-
children: /* @__PURE__ */ jsx(
|
|
33
|
-
RadioGroupPrimitive.Indicator,
|
|
34
|
-
{
|
|
35
|
-
"data-slot": "radio-group-indicator",
|
|
36
|
-
className: "relative flex items-center justify-center",
|
|
37
|
-
children: /* @__PURE__ */ jsx(CircleIcon, { className: "absolute left-1/2 top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 fill-primary" })
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
));
|
|
42
|
-
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
4
|
+
RadioGroup,
|
|
5
|
+
RadioGroupItem
|
|
6
|
+
} from "../chunk-HAQOT2CD.js";
|
|
7
|
+
import "../chunk-G6SRSWXB.js";
|
|
43
8
|
export {
|
|
44
9
|
RadioGroup,
|
|
45
10
|
RadioGroupItem
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkD5EHW3O2cjs = require('../chunk-D5EHW3O2.cjs');
|
|
7
|
+
require('../chunk-GXHGMI3Z.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkHAP6USTPcjs = require('../chunk-HAP6USTP.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunkZJFYOXSMcjs = require('../chunk-ZJFYOXSM.cjs');
|
|
22
|
+
require('../chunk-NQK5ZWC7.cjs');
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _chunkT2ZFSPE4cjs = require('../chunk-T2ZFSPE4.cjs');
|
|
26
|
+
require('../chunk-IQZLUT2Y.cjs');
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var _chunkU3YFP6ZVcjs = require('../chunk-U3YFP6ZV.cjs');
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var _chunkKWLSBTB2cjs = require('../chunk-KWLSBTB2.cjs');
|
|
35
|
+
|
|
36
|
+
// src/primitives/theme-selector.tsx
|
|
37
|
+
var _react = require('react');
|
|
38
|
+
var _lucidereact = require('lucide-react');
|
|
39
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
40
|
+
var MODES = ["light", "dark", "system"];
|
|
41
|
+
var DEFAULT_PALETTES = [_chunkU3YFP6ZVcjs.NEUTRAL_PALETTE];
|
|
42
|
+
function isMode(value) {
|
|
43
|
+
return MODES.includes(value);
|
|
44
|
+
}
|
|
45
|
+
function PalettePreview({ palette, mode, className }) {
|
|
46
|
+
const tokens = mode ? palette[mode] : void 0;
|
|
47
|
+
const style = _react.useMemo.call(void 0,
|
|
48
|
+
() => tokens ? _chunkU3YFP6ZVcjs.paletteStyle.call(void 0, tokens, palette.radius) : void 0,
|
|
49
|
+
[tokens, palette.radius]
|
|
50
|
+
);
|
|
51
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
52
|
+
"span",
|
|
53
|
+
{
|
|
54
|
+
"data-slot": "palette-preview",
|
|
55
|
+
"data-theme": palette.id,
|
|
56
|
+
"data-mode": mode,
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
style,
|
|
59
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
60
|
+
"pointer-events-none flex h-24 w-full select-none overflow-hidden rounded-md border border-border bg-background",
|
|
61
|
+
className
|
|
62
|
+
),
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex w-1/4 flex-col gap-1.5 bg-sidebar p-2", children: [
|
|
65
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "h-1.5 w-3/4 rounded-full bg-sidebar-primary" }),
|
|
66
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "h-1.5 w-full rounded-full bg-sidebar-accent" }),
|
|
67
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "h-1.5 w-2/3 rounded-full bg-sidebar-accent" }),
|
|
68
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "h-1.5 w-5/6 rounded-full bg-sidebar-accent" })
|
|
69
|
+
] }),
|
|
70
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex min-w-0 flex-1 flex-col gap-2 p-2", children: [
|
|
71
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1.5", children: [
|
|
72
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "h-2 w-1/3 rounded-full bg-foreground/70" }),
|
|
73
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "ml-auto h-3 w-8 rounded-sm bg-primary" })
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-1 flex-col gap-1.5 rounded-lg border border-border bg-card p-2", children: [
|
|
76
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "h-1.5 w-full rounded-full bg-muted-foreground/40" }),
|
|
77
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "h-1.5 w-4/5 rounded-full bg-muted-foreground/40" }),
|
|
78
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex gap-1 pt-0.5", children: [
|
|
79
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "h-1.5 w-4 rounded-full bg-[hsl(var(--chart-1))]" }),
|
|
80
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "h-1.5 w-4 rounded-full bg-[hsl(var(--chart-2))]" }),
|
|
81
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "h-1.5 w-4 rounded-full bg-[hsl(var(--chart-3))]" })
|
|
82
|
+
] })
|
|
83
|
+
] })
|
|
84
|
+
] })
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
function PaletteOption({ palette, id }) {
|
|
90
|
+
const titleId = `${id}-title`;
|
|
91
|
+
const descriptionId = `${id}-description`;
|
|
92
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
93
|
+
_chunkZJFYOXSMcjs.FieldLabel,
|
|
94
|
+
{
|
|
95
|
+
htmlFor: id,
|
|
96
|
+
className: "cursor-pointer transition-colors not-has-data-[state=checked]:hover:border-foreground/30",
|
|
97
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkZJFYOXSMcjs.Field, { children: [
|
|
98
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex overflow-hidden rounded-md border border-border", children: [
|
|
99
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
100
|
+
PalettePreview,
|
|
101
|
+
{
|
|
102
|
+
palette,
|
|
103
|
+
mode: "light",
|
|
104
|
+
className: "w-1/2 rounded-none border-0 border-r border-border"
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PalettePreview, { palette, mode: "dark", className: "w-1/2 rounded-none border-0" })
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkZJFYOXSMcjs.Field, { orientation: "horizontal", children: [
|
|
110
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkZJFYOXSMcjs.FieldContent, { children: [
|
|
111
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZJFYOXSMcjs.FieldTitle, { id: titleId, children: palette.label }),
|
|
112
|
+
palette.description ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZJFYOXSMcjs.FieldDescription, { id: descriptionId, children: palette.description }) : null
|
|
113
|
+
] }),
|
|
114
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
115
|
+
_chunkHAP6USTPcjs.RadioGroupItem,
|
|
116
|
+
{
|
|
117
|
+
value: palette.id,
|
|
118
|
+
id,
|
|
119
|
+
"aria-labelledby": titleId,
|
|
120
|
+
"aria-describedby": palette.description ? descriptionId : void 0
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
] })
|
|
124
|
+
] })
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
function ThemeSelector({
|
|
129
|
+
palettes = DEFAULT_PALETTES,
|
|
130
|
+
palette = _chunkU3YFP6ZVcjs.NEUTRAL_THEME_ID,
|
|
131
|
+
onPaletteChange,
|
|
132
|
+
mode = "system",
|
|
133
|
+
onModeChange,
|
|
134
|
+
paletteLabel = "Theme",
|
|
135
|
+
paletteDescription,
|
|
136
|
+
modeLabel = "Mode",
|
|
137
|
+
modeDescription,
|
|
138
|
+
lightLabel = "Light",
|
|
139
|
+
darkLabel = "Dark",
|
|
140
|
+
systemLabel = "System",
|
|
141
|
+
className
|
|
142
|
+
}) {
|
|
143
|
+
const id = _react.useId.call(void 0, );
|
|
144
|
+
const modeOptions = [
|
|
145
|
+
{ value: "light", label: lightLabel, icon: _lucidereact.Sun },
|
|
146
|
+
{ value: "dark", label: darkLabel, icon: _lucidereact.Moon },
|
|
147
|
+
{ value: "system", label: systemLabel, icon: _lucidereact.Monitor }
|
|
148
|
+
];
|
|
149
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkZJFYOXSMcjs.FieldGroup, { "data-slot": "theme-selector", className: _chunkKWLSBTB2cjs.cn.call(void 0, "gap-6", className), children: [
|
|
150
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkZJFYOXSMcjs.FieldSet, { className: "gap-3", children: [
|
|
151
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZJFYOXSMcjs.FieldLegend, { variant: "label", children: modeLabel }),
|
|
152
|
+
modeDescription ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZJFYOXSMcjs.FieldDescription, { children: modeDescription }) : null,
|
|
153
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
154
|
+
_chunkD5EHW3O2cjs.ToggleGroup,
|
|
155
|
+
{
|
|
156
|
+
type: "single",
|
|
157
|
+
variant: "outline",
|
|
158
|
+
value: _nullishCoalesce(mode, () => ( "")),
|
|
159
|
+
onValueChange: (next) => {
|
|
160
|
+
if (isMode(next)) _optionalChain([onModeChange, 'optionalCall', _ => _(next)]);
|
|
161
|
+
},
|
|
162
|
+
className: "grid w-full grid-cols-3",
|
|
163
|
+
children: modeOptions.map((option) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkD5EHW3O2cjs.ToggleGroupItem, { value: option.value, className: "min-w-0", children: [
|
|
164
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2ZFSPE4cjs.Icon, { icon: option.icon }),
|
|
165
|
+
option.label
|
|
166
|
+
] }, option.value))
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
] }),
|
|
170
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkZJFYOXSMcjs.FieldSet, { className: "gap-3", children: [
|
|
171
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZJFYOXSMcjs.FieldLegend, { variant: "label", children: paletteLabel }),
|
|
172
|
+
paletteDescription ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZJFYOXSMcjs.FieldDescription, { children: paletteDescription }) : null,
|
|
173
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
174
|
+
_chunkHAP6USTPcjs.RadioGroup,
|
|
175
|
+
{
|
|
176
|
+
value: _nullishCoalesce(palette, () => ( "")),
|
|
177
|
+
onValueChange: (next) => _optionalChain([onPaletteChange, 'optionalCall', _2 => _2(next)]),
|
|
178
|
+
className: "grid-cols-1 sm:@sm/field-group:grid-cols-2 @2xl/field-group:grid-cols-3",
|
|
179
|
+
children: palettes.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaletteOption, { palette: option, id: `${id}-palette-${option.id}` }, option.id))
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
] })
|
|
183
|
+
] });
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
exports.PalettePreview = PalettePreview; exports.ThemeSelector = ThemeSelector;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { ThemePalette, ThemeMode } from '../lib/neutral-theme.cjs';
|
|
4
|
+
|
|
5
|
+
/** Light, dark, or whatever the device prefers. */
|
|
6
|
+
type ThemeSelectorMode = ThemeMode | "system";
|
|
7
|
+
interface PalettePreviewProps {
|
|
8
|
+
/** The palette to paint. */
|
|
9
|
+
palette: ThemePalette;
|
|
10
|
+
/**
|
|
11
|
+
* Pin one mode. When the palette has that mode's tokens, they paint the
|
|
12
|
+
* preview directly, whatever palette or mode the page is in. Without
|
|
13
|
+
* them, or without a mode, the preview carries `data-theme` (and
|
|
14
|
+
* `data-mode`) and the page's palette CSS paints it; left off, it follows
|
|
15
|
+
* the page's mode.
|
|
16
|
+
*/
|
|
17
|
+
mode?: ThemeMode;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A miniature app in one palette: a sidebar, a header with a primary
|
|
22
|
+
* action, and a card holding the first three chart colours. Built from the
|
|
23
|
+
* same token utilities the app uses (`bg-sidebar`, `bg-primary`,
|
|
24
|
+
* `rounded-lg`, ...), so the corners follow the palette's radius too.
|
|
25
|
+
* Decorative: hidden from assistive technology.
|
|
26
|
+
*/
|
|
27
|
+
declare function PalettePreview({ palette, mode, className }: PalettePreviewProps): react_jsx_runtime.JSX.Element;
|
|
28
|
+
interface ThemeSelectorProps {
|
|
29
|
+
/**
|
|
30
|
+
* The palettes to offer, in display order. Defaults to the kit's neutral
|
|
31
|
+
* palette alone. A palette with tokens previews from them; one without
|
|
32
|
+
* relies on the page's palette CSS (see `ThemePalette`).
|
|
33
|
+
*/
|
|
34
|
+
palettes?: readonly ThemePalette[];
|
|
35
|
+
/**
|
|
36
|
+
* The chosen palette's id. Defaults to the neutral palette's. Pass `null`
|
|
37
|
+
* while it isn't known yet (before the stored pick is read), so no card
|
|
38
|
+
* is marked rather than the wrong one.
|
|
39
|
+
*/
|
|
40
|
+
palette?: string | null;
|
|
41
|
+
/** Called with a palette's id when someone picks it. */
|
|
42
|
+
onPaletteChange?: (palette: string) => void;
|
|
43
|
+
/** The chosen mode. Defaults to `system`; `null` marks none. */
|
|
44
|
+
mode?: ThemeSelectorMode | null;
|
|
45
|
+
/** Called when someone picks a mode. */
|
|
46
|
+
onModeChange?: (mode: ThemeSelectorMode) => void;
|
|
47
|
+
/** The palette group's legend. Defaults to "Theme". */
|
|
48
|
+
paletteLabel?: ReactNode;
|
|
49
|
+
/** A line under the palette group's legend. */
|
|
50
|
+
paletteDescription?: ReactNode;
|
|
51
|
+
/** The mode group's legend. Defaults to "Mode". */
|
|
52
|
+
modeLabel?: ReactNode;
|
|
53
|
+
/** A line under the mode group's legend. */
|
|
54
|
+
modeDescription?: ReactNode;
|
|
55
|
+
lightLabel?: string;
|
|
56
|
+
darkLabel?: string;
|
|
57
|
+
systemLabel?: string;
|
|
58
|
+
className?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Appearance settings: light, dark or system, then a grid of palettes.
|
|
62
|
+
*
|
|
63
|
+
* The two are independent axes (every palette ships both modes), and the
|
|
64
|
+
* selector owns neither: it shows the values it is given and reports picks
|
|
65
|
+
* through `onModeChange` and `onPaletteChange`. Wire it to whatever applies
|
|
66
|
+
* them, typically next-themes for the mode and a `data-theme` attribute on
|
|
67
|
+
* `<html>` for the palette.
|
|
68
|
+
*
|
|
69
|
+
* It knows no palette but the kit's neutral one, its default: pass the
|
|
70
|
+
* palettes a host offers. Each palette is a radio card (arrow keys move
|
|
71
|
+
* between them) previewing both modes. The grid is one column on a phone
|
|
72
|
+
* (below `sm`), and otherwise sizes to the selector rather than the
|
|
73
|
+
* viewport, so it fits a dialog as well as a settings page: one column while
|
|
74
|
+
* the selector is narrower than 24rem, two from there, three from 42rem.
|
|
75
|
+
*/
|
|
76
|
+
declare function ThemeSelector({ palettes, palette, onPaletteChange, mode, onModeChange, paletteLabel, paletteDescription, modeLabel, modeDescription, lightLabel, darkLabel, systemLabel, className, }: ThemeSelectorProps): react_jsx_runtime.JSX.Element;
|
|
77
|
+
|
|
78
|
+
export { PalettePreview, type PalettePreviewProps, ThemeSelector, type ThemeSelectorMode, type ThemeSelectorProps };
|