@epicbagel/saas-kit 1.2.3 → 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.
Files changed (80) hide show
  1. package/README.md +115 -0
  2. package/dist/chunk-2TKLS73N.js +121 -0
  3. package/dist/chunk-4UUTKR3V.cjs +53 -0
  4. package/dist/chunk-BTHYGHOH.cjs +143 -0
  5. package/dist/chunk-D5EHW3O2.cjs +52 -0
  6. package/dist/chunk-F3DAFAMD.js +271 -0
  7. package/dist/chunk-GRY77463.cjs +121 -0
  8. package/dist/chunk-HAP6USTP.cjs +46 -0
  9. package/dist/chunk-HAQOT2CD.js +46 -0
  10. package/dist/chunk-HHV4G77I.js +55 -0
  11. package/dist/{chunk-KYQPX754.js → chunk-HRLP4BHJ.js} +7 -7
  12. package/dist/{chunk-N6V3DDKU.cjs → chunk-IH3COANJ.cjs} +7 -7
  13. package/dist/chunk-JTI4244T.js +143 -0
  14. package/dist/chunk-QEJ2STIV.js +53 -0
  15. package/dist/chunk-TWCJMFST.js +260 -0
  16. package/dist/chunk-U3YFP6ZV.cjs +273 -0
  17. package/dist/chunk-VLXPLKFR.cjs +55 -0
  18. package/dist/chunk-X3PRMR5G.js +52 -0
  19. package/dist/chunk-ZJFYOXSM.cjs +260 -0
  20. package/dist/lib/neutral-theme.cjs +39 -236
  21. package/dist/lib/neutral-theme.d.cts +44 -2
  22. package/dist/lib/neutral-theme.d.ts +44 -2
  23. package/dist/lib/neutral-theme.js +23 -219
  24. package/dist/primitives/activity-feed.cjs +3 -3
  25. package/dist/primitives/activity-feed.js +4 -4
  26. package/dist/primitives/board-view.cjs +6 -6
  27. package/dist/primitives/board-view.js +5 -5
  28. package/dist/primitives/chat.cjs +14 -14
  29. package/dist/primitives/chat.js +12 -12
  30. package/dist/primitives/code-block.cjs +5 -50
  31. package/dist/primitives/code-block.js +5 -50
  32. package/dist/primitives/connection.cjs +6 -6
  33. package/dist/primitives/connection.js +7 -7
  34. package/dist/primitives/copy-button.cjs +3 -3
  35. package/dist/primitives/copy-button.js +2 -2
  36. package/dist/primitives/document-preview.cjs +54 -0
  37. package/dist/primitives/document-preview.d.cts +30 -0
  38. package/dist/primitives/document-preview.d.ts +30 -0
  39. package/dist/primitives/document-preview.js +54 -0
  40. package/dist/primitives/editable-list.cjs +1 -1
  41. package/dist/primitives/editable-list.js +1 -1
  42. package/dist/primitives/field.cjs +12 -239
  43. package/dist/primitives/field.js +16 -243
  44. package/dist/primitives/file-dropzone.cjs +3 -3
  45. package/dist/primitives/file-dropzone.js +2 -2
  46. package/dist/primitives/file-preview-internals.cjs +20 -0
  47. package/dist/primitives/file-preview-internals.d.cts +44 -0
  48. package/dist/primitives/file-preview-internals.d.ts +44 -0
  49. package/dist/primitives/file-preview-internals.js +20 -0
  50. package/dist/primitives/file-preview.cjs +327 -0
  51. package/dist/primitives/file-preview.d.cts +92 -0
  52. package/dist/primitives/file-preview.d.ts +92 -0
  53. package/dist/primitives/file-preview.js +327 -0
  54. package/dist/primitives/filter-bar.cjs +4 -4
  55. package/dist/primitives/filter-bar.js +3 -3
  56. package/dist/primitives/image.cjs +4 -48
  57. package/dist/primitives/image.js +3 -47
  58. package/dist/primitives/radio-group.cjs +4 -39
  59. package/dist/primitives/radio-group.js +4 -39
  60. package/dist/primitives/resource-list.cjs +6 -6
  61. package/dist/primitives/resource-list.js +5 -5
  62. package/dist/primitives/responsive-dialog.cjs +26 -142
  63. package/dist/primitives/responsive-dialog.js +13 -129
  64. package/dist/primitives/section.cjs +2 -2
  65. package/dist/primitives/section.js +3 -3
  66. package/dist/primitives/switch-field.cjs +2 -2
  67. package/dist/primitives/switch-field.js +3 -3
  68. package/dist/primitives/theme-selector.cjs +188 -0
  69. package/dist/primitives/theme-selector.d.cts +78 -0
  70. package/dist/primitives/theme-selector.d.ts +78 -0
  71. package/dist/primitives/theme-selector.js +188 -0
  72. package/dist/primitives/toggle-group.cjs +5 -45
  73. package/dist/primitives/toggle-group.js +5 -45
  74. package/package.json +31 -1
  75. package/dist/{chunk-6OTAGP2I.cjs → chunk-KADJ56AH.cjs} +2 -2
  76. package/dist/{chunk-EHKMVJ6O.js → chunk-M7FYGAGO.js} +3 -3
  77. package/dist/{chunk-PVZ4JGDU.js → chunk-MLHNYRFX.js} +6 -6
  78. package/dist/{chunk-PWOQMTPX.js → chunk-NW3OWKBN.js} +3 -3
  79. package/dist/{chunk-CYH63OCL.cjs → chunk-SGW4FWBX.cjs} +6 -6
  80. package/dist/{chunk-ENJNZ323.cjs → chunk-VKIGJNJR.cjs} +2 -2
@@ -1,142 +1,26 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }"use client";
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
- var _chunk2BHI5ZWJcjs = require('../chunk-2BHI5ZWJ.cjs');
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
- var _chunkWDXEJDMOcjs = require('../chunk-WDXEJDMO.cjs');
22
-
23
-
24
- var _chunkKWLSBTB2cjs = require('../chunk-KWLSBTB2.cjs');
25
-
26
- // src/primitives/responsive-dialog.tsx
27
- var _react = require('react'); var React = _interopRequireWildcard(_react);
28
- var _reactresponsive = require('react-responsive');
29
- var _jsxruntime = require('react/jsx-runtime');
30
- var DesktopContext = React.createContext(false);
31
- var useIsDesktop = () => React.useContext(DesktopContext);
32
- var DESKTOP_QUERY = { minWidth: 1024 };
33
- var ResponsiveDialog = ({ children, ...props }) => {
34
- const isDesktop = _reactresponsive.useMediaQuery.call(void 0, DESKTOP_QUERY);
35
- const Root = isDesktop ? _chunkWDXEJDMOcjs.Dialog : _chunk2BHI5ZWJcjs.Drawer;
36
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DesktopContext.Provider, { value: isDesktop, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ...props, children }) });
37
- };
38
- ResponsiveDialog.displayName = "ResponsiveDialog";
39
- var ResponsiveDialogTrigger = ({
40
- children,
41
- ...props
42
- }) => {
43
- const Trigger = useIsDesktop() ? _chunkWDXEJDMOcjs.DialogTrigger : _chunk2BHI5ZWJcjs.DrawerTrigger;
44
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Trigger, { ...props, children });
45
- };
46
- ResponsiveDialogTrigger.displayName = "ResponsiveDialogTrigger";
47
- var ResponsiveDialogClose = ({
48
- children,
49
- ...props
50
- }) => {
51
- const Close = useIsDesktop() ? _chunkWDXEJDMOcjs.DialogClose : _chunk2BHI5ZWJcjs.DrawerClose;
52
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Close, { ...props, children });
53
- };
54
- ResponsiveDialogClose.displayName = "ResponsiveDialogClose";
55
- var ResponsiveDialogContent = React.forwardRef(({ className, children, presentation = "default", ...props }, ref) => {
56
- if (useIsDesktop()) {
57
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
58
- _chunkWDXEJDMOcjs.DialogContent,
59
- {
60
- ref,
61
- className: _chunkKWLSBTB2cjs.cn.call(void 0,
62
- "flex max-h-[85vh] max-w-md flex-col gap-0 overflow-hidden p-0",
63
- presentation === "preview" && "max-w-2xl sm:h-[85vh] [&>button:last-child]:hidden",
64
- className
65
- ),
66
- ...props,
67
- children
68
- }
69
- );
70
- }
71
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
72
- _chunk2BHI5ZWJcjs.DrawerContent,
73
- {
74
- ref,
75
- className: _chunkKWLSBTB2cjs.cn.call(void 0, "max-h-[92vh]", className),
76
- ...props,
77
- children
78
- }
79
- );
80
- });
81
- ResponsiveDialogContent.displayName = "ResponsiveDialogContent";
82
- var ResponsiveDialogHeader = ({
83
- className,
84
- visibility = "visible",
85
- ...props
86
- }) => {
87
- const Header = useIsDesktop() ? _chunkWDXEJDMOcjs.DialogHeader : _chunk2BHI5ZWJcjs.DrawerHeader;
88
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
89
- Header,
90
- {
91
- className: _chunkKWLSBTB2cjs.cn.call(void 0, useIsDesktop() && "p-4", visibility === "screen-reader" && "sr-only", className),
92
- ...props
93
- }
94
- );
95
- };
96
- ResponsiveDialogHeader.displayName = "ResponsiveDialogHeader";
97
- var ResponsiveDialogBody = ({
98
- className,
99
- ...props
100
- }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunkKWLSBTB2cjs.cn.call(void 0, "min-h-0 flex-1 overflow-y-auto px-4 pb-6", className), ...props });
101
- ResponsiveDialogBody.displayName = "ResponsiveDialogBody";
102
- var ResponsiveDialogFooter = ({
103
- className,
104
- layout = "auto",
105
- ...props
106
- }) => {
107
- const isDesktop = useIsDesktop();
108
- const Footer = isDesktop ? _chunkWDXEJDMOcjs.DialogFooter : _chunk2BHI5ZWJcjs.DrawerFooter;
109
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
110
- Footer,
111
- {
112
- className: _chunkKWLSBTB2cjs.cn.call(void 0,
113
- "mt-0 shrink-0 gap-2 border-t bg-background p-4",
114
- layout === "fill" ? "flex-row space-x-0 [&>*]:min-w-0 [&>*]:flex-1" : isDesktop ? "flex-row justify-end space-x-0 [&>*]:flex-none" : "grid grid-cols-2 [&>*]:w-full",
115
- className
116
- ),
117
- ...props
118
- }
119
- );
120
- };
121
- ResponsiveDialogFooter.displayName = "ResponsiveDialogFooter";
122
- var ResponsiveDialogTitle = React.forwardRef(({ className, visuallyHidden = false, ...props }, ref) => {
123
- const Title = useIsDesktop() ? _chunkWDXEJDMOcjs.DialogTitle : _chunk2BHI5ZWJcjs.DrawerTitle;
124
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Title, { ref, className: _chunkKWLSBTB2cjs.cn.call(void 0, visuallyHidden && "sr-only", className), ...props });
125
- });
126
- ResponsiveDialogTitle.displayName = "ResponsiveDialogTitle";
127
- var ResponsiveDialogDescription = React.forwardRef(({ className, visuallyHidden = false, ...props }, ref) => {
128
- const Description = useIsDesktop() ? _chunkWDXEJDMOcjs.DialogDescription : _chunk2BHI5ZWJcjs.DrawerDescription;
129
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Description, { ref, className: _chunkKWLSBTB2cjs.cn.call(void 0, visuallyHidden && "sr-only", className), ...props });
130
- });
131
- ResponsiveDialogDescription.displayName = "ResponsiveDialogDescription";
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
- exports.ResponsiveDialog = ResponsiveDialog; exports.ResponsiveDialogBody = ResponsiveDialogBody; exports.ResponsiveDialogClose = ResponsiveDialogClose; exports.ResponsiveDialogContent = ResponsiveDialogContent; exports.ResponsiveDialogDescription = ResponsiveDialogDescription; exports.ResponsiveDialogFooter = ResponsiveDialogFooter; exports.ResponsiveDialogHeader = ResponsiveDialogHeader; exports.ResponsiveDialogTitle = ResponsiveDialogTitle; exports.ResponsiveDialogTrigger = ResponsiveDialogTrigger;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+ var _chunkBTHYGHOHcjs = require('../chunk-BTHYGHOH.cjs');
13
+ require('../chunk-2BHI5ZWJ.cjs');
14
+ require('../chunk-WDXEJDMO.cjs');
15
+ require('../chunk-KWLSBTB2.cjs');
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+ exports.ResponsiveDialog = _chunkBTHYGHOHcjs.ResponsiveDialog; exports.ResponsiveDialogBody = _chunkBTHYGHOHcjs.ResponsiveDialogBody; exports.ResponsiveDialogClose = _chunkBTHYGHOHcjs.ResponsiveDialogClose; exports.ResponsiveDialogContent = _chunkBTHYGHOHcjs.ResponsiveDialogContent; exports.ResponsiveDialogDescription = _chunkBTHYGHOHcjs.ResponsiveDialogDescription; exports.ResponsiveDialogFooter = _chunkBTHYGHOHcjs.ResponsiveDialogFooter; exports.ResponsiveDialogHeader = _chunkBTHYGHOHcjs.ResponsiveDialogHeader; exports.ResponsiveDialogTitle = _chunkBTHYGHOHcjs.ResponsiveDialogTitle; exports.ResponsiveDialogTrigger = _chunkBTHYGHOHcjs.ResponsiveDialogTrigger;
@@ -1,134 +1,18 @@
1
1
  "use client";
2
2
  import {
3
- Drawer,
4
- DrawerClose,
5
- DrawerContent,
6
- DrawerDescription,
7
- DrawerFooter,
8
- DrawerHeader,
9
- DrawerTitle,
10
- DrawerTrigger
11
- } from "../chunk-4HWCNRK4.js";
12
- import {
13
- Dialog,
14
- DialogClose,
15
- DialogContent,
16
- DialogDescription,
17
- DialogFooter,
18
- DialogHeader,
19
- DialogTitle,
20
- DialogTrigger
21
- } from "../chunk-3QT5VYZ3.js";
22
- import {
23
- cn
24
- } from "../chunk-G6SRSWXB.js";
25
-
26
- // src/primitives/responsive-dialog.tsx
27
- import * as React from "react";
28
- import { useMediaQuery } from "react-responsive";
29
- import { jsx } from "react/jsx-runtime";
30
- var DesktopContext = React.createContext(false);
31
- var useIsDesktop = () => React.useContext(DesktopContext);
32
- var DESKTOP_QUERY = { minWidth: 1024 };
33
- var ResponsiveDialog = ({ children, ...props }) => {
34
- const isDesktop = useMediaQuery(DESKTOP_QUERY);
35
- const Root = isDesktop ? Dialog : Drawer;
36
- return /* @__PURE__ */ jsx(DesktopContext.Provider, { value: isDesktop, children: /* @__PURE__ */ jsx(Root, { ...props, children }) });
37
- };
38
- ResponsiveDialog.displayName = "ResponsiveDialog";
39
- var ResponsiveDialogTrigger = ({
40
- children,
41
- ...props
42
- }) => {
43
- const Trigger = useIsDesktop() ? DialogTrigger : DrawerTrigger;
44
- return /* @__PURE__ */ jsx(Trigger, { ...props, children });
45
- };
46
- ResponsiveDialogTrigger.displayName = "ResponsiveDialogTrigger";
47
- var ResponsiveDialogClose = ({
48
- children,
49
- ...props
50
- }) => {
51
- const Close = useIsDesktop() ? DialogClose : DrawerClose;
52
- return /* @__PURE__ */ jsx(Close, { ...props, children });
53
- };
54
- ResponsiveDialogClose.displayName = "ResponsiveDialogClose";
55
- var ResponsiveDialogContent = React.forwardRef(({ className, children, presentation = "default", ...props }, ref) => {
56
- if (useIsDesktop()) {
57
- return /* @__PURE__ */ jsx(
58
- DialogContent,
59
- {
60
- ref,
61
- className: cn(
62
- "flex max-h-[85vh] max-w-md flex-col gap-0 overflow-hidden p-0",
63
- presentation === "preview" && "max-w-2xl sm:h-[85vh] [&>button:last-child]:hidden",
64
- className
65
- ),
66
- ...props,
67
- children
68
- }
69
- );
70
- }
71
- return /* @__PURE__ */ jsx(
72
- DrawerContent,
73
- {
74
- ref,
75
- className: cn("max-h-[92vh]", className),
76
- ...props,
77
- children
78
- }
79
- );
80
- });
81
- ResponsiveDialogContent.displayName = "ResponsiveDialogContent";
82
- var ResponsiveDialogHeader = ({
83
- className,
84
- visibility = "visible",
85
- ...props
86
- }) => {
87
- const Header = useIsDesktop() ? DialogHeader : DrawerHeader;
88
- return /* @__PURE__ */ jsx(
89
- Header,
90
- {
91
- className: cn(useIsDesktop() && "p-4", visibility === "screen-reader" && "sr-only", className),
92
- ...props
93
- }
94
- );
95
- };
96
- ResponsiveDialogHeader.displayName = "ResponsiveDialogHeader";
97
- var ResponsiveDialogBody = ({
98
- className,
99
- ...props
100
- }) => /* @__PURE__ */ jsx("div", { className: cn("min-h-0 flex-1 overflow-y-auto px-4 pb-6", className), ...props });
101
- ResponsiveDialogBody.displayName = "ResponsiveDialogBody";
102
- var ResponsiveDialogFooter = ({
103
- className,
104
- layout = "auto",
105
- ...props
106
- }) => {
107
- const isDesktop = useIsDesktop();
108
- const Footer = isDesktop ? DialogFooter : DrawerFooter;
109
- return /* @__PURE__ */ jsx(
110
- Footer,
111
- {
112
- className: cn(
113
- "mt-0 shrink-0 gap-2 border-t bg-background p-4",
114
- layout === "fill" ? "flex-row space-x-0 [&>*]:min-w-0 [&>*]:flex-1" : isDesktop ? "flex-row justify-end space-x-0 [&>*]:flex-none" : "grid grid-cols-2 [&>*]:w-full",
115
- className
116
- ),
117
- ...props
118
- }
119
- );
120
- };
121
- ResponsiveDialogFooter.displayName = "ResponsiveDialogFooter";
122
- var ResponsiveDialogTitle = React.forwardRef(({ className, visuallyHidden = false, ...props }, ref) => {
123
- const Title = useIsDesktop() ? DialogTitle : DrawerTitle;
124
- return /* @__PURE__ */ jsx(Title, { ref, className: cn(visuallyHidden && "sr-only", className), ...props });
125
- });
126
- ResponsiveDialogTitle.displayName = "ResponsiveDialogTitle";
127
- var ResponsiveDialogDescription = React.forwardRef(({ className, visuallyHidden = false, ...props }, ref) => {
128
- const Description = useIsDesktop() ? DialogDescription : DrawerDescription;
129
- return /* @__PURE__ */ jsx(Description, { ref, className: cn(visuallyHidden && "sr-only", className), ...props });
130
- });
131
- ResponsiveDialogDescription.displayName = "ResponsiveDialogDescription";
3
+ ResponsiveDialog,
4
+ ResponsiveDialogBody,
5
+ ResponsiveDialogClose,
6
+ ResponsiveDialogContent,
7
+ ResponsiveDialogDescription,
8
+ ResponsiveDialogFooter,
9
+ ResponsiveDialogHeader,
10
+ ResponsiveDialogTitle,
11
+ ResponsiveDialogTrigger
12
+ } from "../chunk-JTI4244T.js";
13
+ import "../chunk-4HWCNRK4.js";
14
+ import "../chunk-3QT5VYZ3.js";
15
+ import "../chunk-G6SRSWXB.js";
132
16
  export {
133
17
  ResponsiveDialog,
134
18
  ResponsiveDialogBody,
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _chunkLELBCBDTcjs = require('../chunk-LELBCBDT.cjs');
4
+ var _chunk373W6VADcjs = require('../chunk-373W6VAD.cjs');
5
5
 
6
6
 
7
- var _chunk373W6VADcjs = require('../chunk-373W6VAD.cjs');
7
+ var _chunkLELBCBDTcjs = require('../chunk-LELBCBDT.cjs');
8
8
 
9
9
 
10
10
  var _chunkKWLSBTB2cjs = require('../chunk-KWLSBTB2.cjs');
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import {
3
- Heading
4
- } from "../chunk-H2O6NMLZ.js";
5
2
  import {
6
3
  Text
7
4
  } from "../chunk-EIY5LLSP.js";
5
+ import {
6
+ Heading
7
+ } from "../chunk-H2O6NMLZ.js";
8
8
  import {
9
9
  cn
10
10
  } from "../chunk-G6SRSWXB.js";
@@ -7,10 +7,10 @@ var _chunk2XDFTB2Wcjs = require('../chunk-2XDFTB2W.cjs');
7
7
  var _chunkR3DQS6U4cjs = require('../chunk-R3DQS6U4.cjs');
8
8
 
9
9
 
10
- var _chunkIQZLUT2Ycjs = require('../chunk-IQZLUT2Y.cjs');
10
+ var _chunk373W6VADcjs = require('../chunk-373W6VAD.cjs');
11
11
 
12
12
 
13
- var _chunk373W6VADcjs = require('../chunk-373W6VAD.cjs');
13
+ var _chunkIQZLUT2Ycjs = require('../chunk-IQZLUT2Y.cjs');
14
14
 
15
15
 
16
16
  var _chunkKWLSBTB2cjs = require('../chunk-KWLSBTB2.cjs');
@@ -5,12 +5,12 @@ import {
5
5
  import {
6
6
  Card
7
7
  } from "../chunk-35YMAIEL.js";
8
- import {
9
- Label
10
- } from "../chunk-E2TQMDO7.js";
11
8
  import {
12
9
  Text
13
10
  } from "../chunk-EIY5LLSP.js";
11
+ import {
12
+ Label
13
+ } from "../chunk-E2TQMDO7.js";
14
14
  import {
15
15
  cn
16
16
  } from "../chunk-G6SRSWXB.js";
@@ -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 };