@epicbagel/saas-kit 1.3.0 → 1.5.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 +91 -0
- package/dist/chunk-D5EHW3O2.cjs +52 -0
- package/dist/chunk-F3DAFAMD.js +271 -0
- package/dist/{chunk-JZOBIPFC.js → chunk-FGISSYXG.js} +61 -2
- package/dist/chunk-HAP6USTP.cjs +46 -0
- package/dist/chunk-HAQOT2CD.js +46 -0
- package/dist/{chunk-2AU7ZRGX.cjs → chunk-LAN3K2JI.cjs} +61 -2
- 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/chat.cjs +65 -12
- package/dist/primitives/chat.d.cts +46 -2
- package/dist/primitives/chat.d.ts +46 -2
- package/dist/primitives/chat.js +55 -2
- package/dist/primitives/field.cjs +12 -239
- package/dist/primitives/field.js +16 -243
- package/dist/primitives/message.cjs +8 -2
- package/dist/primitives/message.d.cts +35 -1
- package/dist/primitives/message.d.ts +35 -1
- package/dist/primitives/message.js +7 -1
- 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
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { ButtonProps } from './button.cjs';
|
|
4
|
+
import { TooltipContent } from './tooltip.cjs';
|
|
5
|
+
import 'class-variance-authority/types';
|
|
6
|
+
import 'class-variance-authority';
|
|
7
|
+
import '@radix-ui/react-tooltip';
|
|
3
8
|
|
|
4
9
|
declare function MessageGroup({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
5
10
|
declare function Message({ className, align, ...props }: React.ComponentProps<"div"> & {
|
|
@@ -9,5 +14,34 @@ declare function MessageAvatar({ className, ...props }: React.ComponentProps<"di
|
|
|
9
14
|
declare function MessageContent({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
10
15
|
declare function MessageHeader({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
11
16
|
declare function MessageFooter({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* A row of `MessageAction`s under a message: copy, then any others (a thumbs
|
|
19
|
+
* up or down). It sits at the message's side, the start of a turn from the
|
|
20
|
+
* other party and the end of one aligned to the end, and collapses when it
|
|
21
|
+
* holds nothing.
|
|
22
|
+
*/
|
|
23
|
+
declare function MessageActions({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
24
|
+
type MessageActionProps = Omit<ButtonProps, "size" | "aria-label"> & {
|
|
25
|
+
/** What the action does: its tooltip, and its accessible name when it is text. */
|
|
26
|
+
tooltip: React.ReactNode;
|
|
27
|
+
/** The accessible name, for a `tooltip` that isn't plain text. */
|
|
28
|
+
label?: string;
|
|
29
|
+
/** Which side of the button the tooltip opens on. Defaults to `"bottom"`. */
|
|
30
|
+
side?: React.ComponentPropsWithoutRef<typeof TooltipContent>["side"];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* One action in a `MessageActions` row: an icon-only ghost button (pass the
|
|
34
|
+
* icon as its child) with a tooltip and an accessible name. It is 2rem
|
|
35
|
+
* square, and 2.75rem on a touch screen, where the tooltip can't show on
|
|
36
|
+
* hover, so a finger has the kit's usual target.
|
|
37
|
+
*/
|
|
38
|
+
declare const MessageAction: React.ForwardRefExoticComponent<Omit<ButtonProps, "aria-label" | "size"> & {
|
|
39
|
+
/** What the action does: its tooltip, and its accessible name when it is text. */
|
|
40
|
+
tooltip: React.ReactNode;
|
|
41
|
+
/** The accessible name, for a `tooltip` that isn't plain text. */
|
|
42
|
+
label?: string;
|
|
43
|
+
/** Which side of the button the tooltip opens on. Defaults to `"bottom"`. */
|
|
44
|
+
side?: React.ComponentPropsWithoutRef<typeof TooltipContent>["side"];
|
|
45
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
12
46
|
|
|
13
|
-
export { Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader };
|
|
47
|
+
export { Message, MessageAction, type MessageActionProps, MessageActions, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader };
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { ButtonProps } from './button.js';
|
|
4
|
+
import { TooltipContent } from './tooltip.js';
|
|
5
|
+
import 'class-variance-authority/types';
|
|
6
|
+
import 'class-variance-authority';
|
|
7
|
+
import '@radix-ui/react-tooltip';
|
|
3
8
|
|
|
4
9
|
declare function MessageGroup({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
5
10
|
declare function Message({ className, align, ...props }: React.ComponentProps<"div"> & {
|
|
@@ -9,5 +14,34 @@ declare function MessageAvatar({ className, ...props }: React.ComponentProps<"di
|
|
|
9
14
|
declare function MessageContent({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
10
15
|
declare function MessageHeader({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
11
16
|
declare function MessageFooter({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* A row of `MessageAction`s under a message: copy, then any others (a thumbs
|
|
19
|
+
* up or down). It sits at the message's side, the start of a turn from the
|
|
20
|
+
* other party and the end of one aligned to the end, and collapses when it
|
|
21
|
+
* holds nothing.
|
|
22
|
+
*/
|
|
23
|
+
declare function MessageActions({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
24
|
+
type MessageActionProps = Omit<ButtonProps, "size" | "aria-label"> & {
|
|
25
|
+
/** What the action does: its tooltip, and its accessible name when it is text. */
|
|
26
|
+
tooltip: React.ReactNode;
|
|
27
|
+
/** The accessible name, for a `tooltip` that isn't plain text. */
|
|
28
|
+
label?: string;
|
|
29
|
+
/** Which side of the button the tooltip opens on. Defaults to `"bottom"`. */
|
|
30
|
+
side?: React.ComponentPropsWithoutRef<typeof TooltipContent>["side"];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* One action in a `MessageActions` row: an icon-only ghost button (pass the
|
|
34
|
+
* icon as its child) with a tooltip and an accessible name. It is 2rem
|
|
35
|
+
* square, and 2.75rem on a touch screen, where the tooltip can't show on
|
|
36
|
+
* hover, so a finger has the kit's usual target.
|
|
37
|
+
*/
|
|
38
|
+
declare const MessageAction: React.ForwardRefExoticComponent<Omit<ButtonProps, "aria-label" | "size"> & {
|
|
39
|
+
/** What the action does: its tooltip, and its accessible name when it is text. */
|
|
40
|
+
tooltip: React.ReactNode;
|
|
41
|
+
/** The accessible name, for a `tooltip` that isn't plain text. */
|
|
42
|
+
label?: string;
|
|
43
|
+
/** Which side of the button the tooltip opens on. Defaults to `"bottom"`. */
|
|
44
|
+
side?: React.ComponentPropsWithoutRef<typeof TooltipContent>["side"];
|
|
45
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
12
46
|
|
|
13
|
-
export { Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader };
|
|
47
|
+
export { Message, MessageAction, type MessageActionProps, MessageActions, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader };
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Message,
|
|
4
|
+
MessageAction,
|
|
5
|
+
MessageActions,
|
|
4
6
|
MessageAvatar,
|
|
5
7
|
MessageContent,
|
|
6
8
|
MessageFooter,
|
|
7
9
|
MessageGroup,
|
|
8
10
|
MessageHeader
|
|
9
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-FGISSYXG.js";
|
|
12
|
+
import "../chunk-ZRLUUZHK.js";
|
|
13
|
+
import "../chunk-HQRWRRZJ.js";
|
|
10
14
|
import "../chunk-G6SRSWXB.js";
|
|
11
15
|
export {
|
|
12
16
|
Message,
|
|
17
|
+
MessageAction,
|
|
18
|
+
MessageActions,
|
|
13
19
|
MessageAvatar,
|
|
14
20
|
MessageContent,
|
|
15
21
|
MessageFooter,
|
|
@@ -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 };
|
|
@@ -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.js';
|
|
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 };
|