canvas-ui-sdk 0.3.12 → 0.3.13
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/dist/index.js +248 -331
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { Slot } from '@radix-ui/react-slot';
|
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
8
8
|
import * as React13 from 'react';
|
|
9
9
|
import React13__default, { createContext, useState, useContext, useEffect, useRef, Children, useMemo, useCallback } from 'react';
|
|
10
|
-
import { Check, Calendar as Calendar$1, Upload, FileText, Trash2, ChevronLeft, ChevronRight, X, Search, Layout, Settings, User, LogIn, List, MessageSquare, CreditCard, Video, Play, Table, LayoutGrid, Layers, SlidersHorizontal, Type, Users, Image, Star, Award, Hash, MapPin, Megaphone, Newspaper, Building, Square, CheckSquare, ToggleLeft, CircleDot, Tags, Key, Bell, Home, PieChart, ShoppingBag, Mail, Phone, MessageCircle, ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon, XIcon, CheckIcon, CircleIcon, ChevronUpIcon, PanelLeftIcon, Info, ShoppingCart, LogOut, Menu, ChevronDown, Filter, Wand2, Paperclip, MoreHorizontal, PenSquare, Briefcase as Briefcase$1, MoreVertical, Minus, Plus, Instagram, Linkedin, Twitter, Facebook, Globe as Globe$1, DollarSign, BookOpen, Eye, CheckCircle, Zap, Camera as Camera$1, VideoOff, Mic, MicOff, Cast, Pencil, GripHorizontal, ChevronUp, Sparkles, Copy, ArrowRight, GitBranch, FileBox, ExternalLink, Target as Target$1, AlertCircle, Quote, ArrowUp, Heart as Heart$1, Link2, FolderPlus, ThumbsUp, ChevronsRight, ChevronsLeft, RefreshCw, Send, Bookmark } from 'lucide-react';
|
|
10
|
+
import { Check, Calendar as Calendar$1, Upload, FileText, Trash2, ChevronLeft, ChevronRight, X, Search, Layout, Settings, User, LogIn, List, MessageSquare, CreditCard, Video, Play, Table, LayoutGrid, Layers, SlidersHorizontal, Type, Users, Image, Star, Award, Hash, MapPin, Megaphone, Newspaper, Building, Square, CheckSquare, ToggleLeft, CircleDot, Tags, Key, Bell, Home, PieChart, ShoppingBag, Mail, Phone, MessageCircle, ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon, XIcon, CheckIcon, CircleIcon, ChevronUpIcon, PanelLeftIcon, Info, ShoppingCart, LogOut, Menu, ChevronDown, Filter, Wand2, Paperclip, MoreHorizontal, PenSquare, Briefcase as Briefcase$1, MoreVertical, Minus, Plus, Instagram, Linkedin, Twitter, Facebook, Globe as Globe$1, DollarSign, BookOpen, Eye, CheckCircle, Zap, Camera as Camera$1, VideoOff, Mic, MicOff, Cast, Pencil, GripHorizontal, ChevronUp, Sparkles, Copy, ArrowRight, GitBranch, FileBox, ExternalLink, Target as Target$1, AlertCircle, Quote, GripVertical, ArrowUp, Heart as Heart$1, Link2, FolderPlus, ThumbsUp, ChevronsRight, ChevronsLeft, RefreshCw, Send, Bookmark } from 'lucide-react';
|
|
11
11
|
import { getDefaultClassNames, DayPicker } from 'react-day-picker';
|
|
12
12
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
13
13
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
@@ -25166,19 +25166,45 @@ function VariableColorRow({
|
|
|
25166
25166
|
padding: "8px 0"
|
|
25167
25167
|
},
|
|
25168
25168
|
children: [
|
|
25169
|
-
/* @__PURE__ */
|
|
25170
|
-
|
|
25171
|
-
|
|
25172
|
-
|
|
25173
|
-
|
|
25174
|
-
|
|
25175
|
-
|
|
25176
|
-
|
|
25177
|
-
|
|
25178
|
-
|
|
25169
|
+
/* @__PURE__ */ jsxs(Popover, { children: [
|
|
25170
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
25171
|
+
"button",
|
|
25172
|
+
{
|
|
25173
|
+
style: {
|
|
25174
|
+
width: "24px",
|
|
25175
|
+
height: "24px",
|
|
25176
|
+
borderRadius: "4px",
|
|
25177
|
+
border: "1px solid #e5e7eb",
|
|
25178
|
+
flexShrink: 0,
|
|
25179
|
+
backgroundColor: resolvedColor,
|
|
25180
|
+
cursor: "pointer",
|
|
25181
|
+
transition: "transform 150ms"
|
|
25182
|
+
},
|
|
25183
|
+
onMouseEnter: (e) => {
|
|
25184
|
+
e.currentTarget.style.transform = "scale(1.05)";
|
|
25185
|
+
},
|
|
25186
|
+
onMouseLeave: (e) => {
|
|
25187
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
25188
|
+
},
|
|
25189
|
+
"aria-label": `Edit ${label} color`
|
|
25179
25190
|
}
|
|
25180
|
-
}
|
|
25181
|
-
|
|
25191
|
+
) }),
|
|
25192
|
+
/* @__PURE__ */ jsx(
|
|
25193
|
+
PopoverContent,
|
|
25194
|
+
{
|
|
25195
|
+
className: "w-auto p-0",
|
|
25196
|
+
align: "start",
|
|
25197
|
+
onPointerDownOutside: (e) => e.preventDefault(),
|
|
25198
|
+
children: /* @__PURE__ */ jsx(
|
|
25199
|
+
HslColorPicker,
|
|
25200
|
+
{
|
|
25201
|
+
value: isVariable ? resolvedColor : value,
|
|
25202
|
+
onChange: (hex) => onChange(hex)
|
|
25203
|
+
}
|
|
25204
|
+
)
|
|
25205
|
+
}
|
|
25206
|
+
)
|
|
25207
|
+
] }),
|
|
25182
25208
|
/* @__PURE__ */ jsx(
|
|
25183
25209
|
"span",
|
|
25184
25210
|
{
|
|
@@ -25192,93 +25218,110 @@ function VariableColorRow({
|
|
|
25192
25218
|
}
|
|
25193
25219
|
),
|
|
25194
25220
|
/* @__PURE__ */ jsxs(
|
|
25195
|
-
|
|
25221
|
+
Select,
|
|
25196
25222
|
{
|
|
25197
25223
|
value: selectValue,
|
|
25198
|
-
|
|
25199
|
-
if (
|
|
25224
|
+
onValueChange: (v) => {
|
|
25225
|
+
if (v === "__custom__") {
|
|
25200
25226
|
onChange("#000000");
|
|
25201
25227
|
} else {
|
|
25202
|
-
onChange(
|
|
25228
|
+
onChange(v);
|
|
25203
25229
|
}
|
|
25204
25230
|
},
|
|
25231
|
+
children: [
|
|
25232
|
+
/* @__PURE__ */ jsx(
|
|
25233
|
+
SelectTrigger,
|
|
25234
|
+
{
|
|
25235
|
+
inputSize: "sm",
|
|
25236
|
+
className: "max-w-[140px] bg-white",
|
|
25237
|
+
style: { flexShrink: 0 },
|
|
25238
|
+
children: /* @__PURE__ */ jsx(SelectValue, { children: selectedOption ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
25239
|
+
/* @__PURE__ */ jsx(
|
|
25240
|
+
"span",
|
|
25241
|
+
{
|
|
25242
|
+
className: "w-2.5 h-2.5 rounded-sm border shrink-0",
|
|
25243
|
+
style: {
|
|
25244
|
+
backgroundColor: resolvedColor,
|
|
25245
|
+
borderColor: "#e5e7eb"
|
|
25246
|
+
}
|
|
25247
|
+
}
|
|
25248
|
+
),
|
|
25249
|
+
selectedOption.label
|
|
25250
|
+
] }) : "Custom" })
|
|
25251
|
+
}
|
|
25252
|
+
),
|
|
25253
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
25254
|
+
variableOptions.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value, className: "text-xs", children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
25255
|
+
/* @__PURE__ */ jsx(
|
|
25256
|
+
"span",
|
|
25257
|
+
{
|
|
25258
|
+
className: "w-3 h-3 rounded-sm border shrink-0",
|
|
25259
|
+
style: {
|
|
25260
|
+
backgroundColor: resolveBrandingColor(opt.value),
|
|
25261
|
+
borderColor: "#e5e7eb"
|
|
25262
|
+
}
|
|
25263
|
+
}
|
|
25264
|
+
),
|
|
25265
|
+
opt.label
|
|
25266
|
+
] }) }, opt.value)),
|
|
25267
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "__custom__", className: "text-xs", children: "Custom" })
|
|
25268
|
+
] })
|
|
25269
|
+
]
|
|
25270
|
+
}
|
|
25271
|
+
),
|
|
25272
|
+
!isVariable && /* @__PURE__ */ jsx(
|
|
25273
|
+
"input",
|
|
25274
|
+
{
|
|
25275
|
+
type: "text",
|
|
25276
|
+
value,
|
|
25277
|
+
onChange: (e) => {
|
|
25278
|
+
let hex = e.target.value;
|
|
25279
|
+
if (hex && !hex.startsWith("#")) hex = "#" + hex;
|
|
25280
|
+
if (/^#[0-9A-Fa-f]{0,6}$/.test(hex)) onChange(hex);
|
|
25281
|
+
},
|
|
25205
25282
|
style: {
|
|
25206
|
-
|
|
25283
|
+
width: "72px",
|
|
25207
25284
|
fontSize: "11px",
|
|
25208
|
-
|
|
25285
|
+
fontFamily: "monospace",
|
|
25286
|
+
padding: "4px 6px",
|
|
25209
25287
|
border: "1px solid #e5e7eb",
|
|
25210
25288
|
borderRadius: "4px",
|
|
25211
25289
|
color: "#374151",
|
|
25212
25290
|
background: "#ffffff",
|
|
25213
|
-
|
|
25214
|
-
|
|
25215
|
-
maxWidth: "120px"
|
|
25291
|
+
textTransform: "uppercase",
|
|
25292
|
+
textAlign: "center"
|
|
25216
25293
|
},
|
|
25217
|
-
|
|
25218
|
-
variableOptions.map((opt) => /* @__PURE__ */ jsx("option", { value: opt.value, children: opt.label }, opt.value)),
|
|
25219
|
-
/* @__PURE__ */ jsx("option", { value: "__custom__", children: "Custom" })
|
|
25220
|
-
]
|
|
25294
|
+
placeholder: "#000000"
|
|
25221
25295
|
}
|
|
25222
|
-
)
|
|
25223
|
-
!isVariable && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25224
|
-
/* @__PURE__ */ jsxs(Popover, { children: [
|
|
25225
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
25226
|
-
"button",
|
|
25227
|
-
{
|
|
25228
|
-
style: {
|
|
25229
|
-
width: "24px",
|
|
25230
|
-
height: "24px",
|
|
25231
|
-
borderRadius: "4px",
|
|
25232
|
-
border: "1px solid #e5e7eb",
|
|
25233
|
-
cursor: "pointer",
|
|
25234
|
-
flexShrink: 0,
|
|
25235
|
-
backgroundColor: value
|
|
25236
|
-
},
|
|
25237
|
-
"aria-label": `Edit ${label} color`
|
|
25238
|
-
}
|
|
25239
|
-
) }),
|
|
25240
|
-
/* @__PURE__ */ jsx(
|
|
25241
|
-
PopoverContent,
|
|
25242
|
-
{
|
|
25243
|
-
className: "w-auto p-0",
|
|
25244
|
-
align: "start",
|
|
25245
|
-
onPointerDownOutside: (e) => e.preventDefault(),
|
|
25246
|
-
children: /* @__PURE__ */ jsx(HslColorPicker, { value, onChange })
|
|
25247
|
-
}
|
|
25248
|
-
)
|
|
25249
|
-
] }),
|
|
25250
|
-
/* @__PURE__ */ jsx(
|
|
25251
|
-
"input",
|
|
25252
|
-
{
|
|
25253
|
-
type: "text",
|
|
25254
|
-
value,
|
|
25255
|
-
onChange: (e) => {
|
|
25256
|
-
let hex = e.target.value;
|
|
25257
|
-
if (hex && !hex.startsWith("#")) hex = "#" + hex;
|
|
25258
|
-
if (/^#[0-9A-Fa-f]{0,6}$/.test(hex)) onChange(hex);
|
|
25259
|
-
},
|
|
25260
|
-
style: {
|
|
25261
|
-
width: "72px",
|
|
25262
|
-
fontSize: "11px",
|
|
25263
|
-
fontFamily: "monospace",
|
|
25264
|
-
padding: "4px 6px",
|
|
25265
|
-
border: "1px solid #e5e7eb",
|
|
25266
|
-
borderRadius: "4px",
|
|
25267
|
-
color: "#374151",
|
|
25268
|
-
background: "#ffffff",
|
|
25269
|
-
textTransform: "uppercase",
|
|
25270
|
-
textAlign: "center"
|
|
25271
|
-
},
|
|
25272
|
-
placeholder: "#000000"
|
|
25273
|
-
}
|
|
25274
|
-
)
|
|
25275
|
-
] })
|
|
25296
|
+
)
|
|
25276
25297
|
]
|
|
25277
25298
|
}
|
|
25278
25299
|
);
|
|
25279
25300
|
}
|
|
25280
25301
|
function ColorsPanel({ theme }) {
|
|
25302
|
+
const resolvedPrimary = resolveBrandingColor("var(--canvas-primary)");
|
|
25281
25303
|
return /* @__PURE__ */ jsxs("div", { "data-theme-drawer-panel": true, className: "flex flex-col gap-6 p-4", children: [
|
|
25304
|
+
/* @__PURE__ */ jsx("style", { children: `
|
|
25305
|
+
[data-theme-drawer-panel] input[type=range]::-webkit-slider-thumb {
|
|
25306
|
+
-webkit-appearance: none;
|
|
25307
|
+
width: 16px;
|
|
25308
|
+
height: 16px;
|
|
25309
|
+
border-radius: 50%;
|
|
25310
|
+
background: ${resolvedPrimary};
|
|
25311
|
+
border: 2px solid #ffffff;
|
|
25312
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
|
|
25313
|
+
cursor: pointer;
|
|
25314
|
+
}
|
|
25315
|
+
[data-theme-drawer-panel] input[type=range]::-moz-range-thumb {
|
|
25316
|
+
width: 12px;
|
|
25317
|
+
height: 12px;
|
|
25318
|
+
border-radius: 50%;
|
|
25319
|
+
background: ${resolvedPrimary};
|
|
25320
|
+
border: 2px solid #ffffff;
|
|
25321
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
|
|
25322
|
+
cursor: pointer;
|
|
25323
|
+
}
|
|
25324
|
+
` }),
|
|
25282
25325
|
/* @__PURE__ */ jsxs(
|
|
25283
25326
|
"div",
|
|
25284
25327
|
{
|
|
@@ -25314,9 +25357,7 @@ function ColorsPanel({ theme }) {
|
|
|
25314
25357
|
const hsl = hexToHsl2(hex);
|
|
25315
25358
|
theme.setBrandHue(hsl.h);
|
|
25316
25359
|
theme.setBrandVibrancy(1);
|
|
25317
|
-
|
|
25318
|
-
theme.applyBrandHueVibrancy(hsl.h, 1, true);
|
|
25319
|
-
}
|
|
25360
|
+
theme.applyBrandHueVibrancy(hsl.h, 1, true);
|
|
25320
25361
|
}
|
|
25321
25362
|
}
|
|
25322
25363
|
}
|
|
@@ -25356,9 +25397,7 @@ function ColorsPanel({ theme }) {
|
|
|
25356
25397
|
onChange: (e) => {
|
|
25357
25398
|
const newHue = parseInt(e.target.value);
|
|
25358
25399
|
theme.setBrandHue(newHue);
|
|
25359
|
-
|
|
25360
|
-
theme.applyBrandHueVibrancy(newHue, theme.brandVibrancy);
|
|
25361
|
-
}
|
|
25400
|
+
theme.applyBrandHueVibrancy(newHue, theme.brandVibrancy);
|
|
25362
25401
|
},
|
|
25363
25402
|
style: {
|
|
25364
25403
|
width: "100%",
|
|
@@ -25372,7 +25411,7 @@ function ColorsPanel({ theme }) {
|
|
|
25372
25411
|
}
|
|
25373
25412
|
)
|
|
25374
25413
|
] }),
|
|
25375
|
-
/* @__PURE__ */ jsxs("div", {
|
|
25414
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
25376
25415
|
/* @__PURE__ */ jsxs(
|
|
25377
25416
|
"div",
|
|
25378
25417
|
{
|
|
@@ -25407,9 +25446,7 @@ function ColorsPanel({ theme }) {
|
|
|
25407
25446
|
onChange: (e) => {
|
|
25408
25447
|
const newVibrancy = parseInt(e.target.value) / 100;
|
|
25409
25448
|
theme.setBrandVibrancy(newVibrancy);
|
|
25410
|
-
|
|
25411
|
-
theme.applyBrandHueVibrancy(theme.brandHue, newVibrancy, true);
|
|
25412
|
-
}
|
|
25449
|
+
theme.applyBrandHueVibrancy(theme.brandHue, newVibrancy, true);
|
|
25413
25450
|
},
|
|
25414
25451
|
style: {
|
|
25415
25452
|
width: "100%",
|
|
@@ -25422,32 +25459,7 @@ function ColorsPanel({ theme }) {
|
|
|
25422
25459
|
}
|
|
25423
25460
|
}
|
|
25424
25461
|
)
|
|
25425
|
-
] })
|
|
25426
|
-
/* @__PURE__ */ jsxs(
|
|
25427
|
-
"label",
|
|
25428
|
-
{
|
|
25429
|
-
style: {
|
|
25430
|
-
display: "flex",
|
|
25431
|
-
alignItems: "center",
|
|
25432
|
-
gap: "8px",
|
|
25433
|
-
cursor: "pointer",
|
|
25434
|
-
fontSize: "13px",
|
|
25435
|
-
color: "#374151"
|
|
25436
|
-
},
|
|
25437
|
-
children: [
|
|
25438
|
-
/* @__PURE__ */ jsx(
|
|
25439
|
-
"input",
|
|
25440
|
-
{
|
|
25441
|
-
type: "checkbox",
|
|
25442
|
-
checked: theme.syncRelatedColors,
|
|
25443
|
-
onChange: (e) => theme.setSyncRelatedColors(e.target.checked),
|
|
25444
|
-
style: { width: "16px", height: "16px", cursor: "pointer" }
|
|
25445
|
-
}
|
|
25446
|
-
),
|
|
25447
|
-
"Apply to related colors"
|
|
25448
|
-
]
|
|
25449
|
-
}
|
|
25450
|
-
)
|
|
25462
|
+
] })
|
|
25451
25463
|
]
|
|
25452
25464
|
}
|
|
25453
25465
|
),
|
|
@@ -25572,6 +25584,7 @@ function ImagesPanel({ theme, onImageUpload }) {
|
|
|
25572
25584
|
const currentShape = iconShapes6.find((s) => s.id === theme.branding.iconShape) ?? iconShapes6[0];
|
|
25573
25585
|
const resolvedBgColor = resolveBrandingColor(theme.branding.bgColor);
|
|
25574
25586
|
const resolvedIconColor = resolveBrandingColor(theme.branding.iconColor);
|
|
25587
|
+
const resolvedPrimary = resolveBrandingColor("var(--canvas-primary)");
|
|
25575
25588
|
const SelectedIcon = logoIcons.find((i) => i.name === theme.branding.iconName)?.icon ?? Buildings;
|
|
25576
25589
|
return /* @__PURE__ */ jsxs("div", { "data-theme-drawer-panel": true, style: { display: "flex", flexDirection: "column", gap: "24px", padding: "16px" }, children: [
|
|
25577
25590
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -25750,8 +25763,8 @@ function ImagesPanel({ theme, onImageUpload }) {
|
|
|
25750
25763
|
alignItems: "center",
|
|
25751
25764
|
justifyContent: "center",
|
|
25752
25765
|
borderRadius: "6px",
|
|
25753
|
-
border: isSelected ?
|
|
25754
|
-
background: isSelected ?
|
|
25766
|
+
border: isSelected ? `2px solid ${resolvedPrimary}` : "1px solid transparent",
|
|
25767
|
+
background: isSelected ? resolvedPrimary : "transparent",
|
|
25755
25768
|
cursor: "pointer",
|
|
25756
25769
|
padding: 0,
|
|
25757
25770
|
transition: "background 100ms, border-color 100ms"
|
|
@@ -25923,20 +25936,22 @@ function ImageUploadRow({
|
|
|
25923
25936
|
style: {
|
|
25924
25937
|
fontSize: "12px",
|
|
25925
25938
|
fontWeight: 500,
|
|
25926
|
-
color: "#
|
|
25927
|
-
background: "#
|
|
25928
|
-
border: "1px solid #
|
|
25939
|
+
color: "#374151",
|
|
25940
|
+
background: "#f9fafb",
|
|
25941
|
+
border: "1px solid #e5e7eb",
|
|
25929
25942
|
borderRadius: "4px",
|
|
25930
25943
|
padding: "4px 10px",
|
|
25931
25944
|
cursor: "pointer",
|
|
25932
25945
|
flexShrink: 0,
|
|
25933
|
-
transition: "background 100ms"
|
|
25946
|
+
transition: "background 100ms, border-color 100ms"
|
|
25934
25947
|
},
|
|
25935
25948
|
onMouseEnter: (e) => {
|
|
25936
|
-
e.currentTarget.style.background = "#
|
|
25949
|
+
e.currentTarget.style.background = "#f3f4f6";
|
|
25950
|
+
e.currentTarget.style.borderColor = "#d1d5db";
|
|
25937
25951
|
},
|
|
25938
25952
|
onMouseLeave: (e) => {
|
|
25939
|
-
e.currentTarget.style.background = "#
|
|
25953
|
+
e.currentTarget.style.background = "#f9fafb";
|
|
25954
|
+
e.currentTarget.style.borderColor = "#e5e7eb";
|
|
25940
25955
|
},
|
|
25941
25956
|
children: "Upload"
|
|
25942
25957
|
}
|
|
@@ -26342,29 +26357,8 @@ function ButtonsPanel({ theme }) {
|
|
|
26342
26357
|
buttonSizeConfigs.map((size) => /* @__PURE__ */ jsx(SizeGroup, { size, theme }, size.id))
|
|
26343
26358
|
] }),
|
|
26344
26359
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
26345
|
-
/* @__PURE__ */
|
|
26346
|
-
|
|
26347
|
-
/* @__PURE__ */ jsx(
|
|
26348
|
-
"button",
|
|
26349
|
-
{
|
|
26350
|
-
onClick: theme.addCustomButtonStyle,
|
|
26351
|
-
className: "text-[11px] font-medium text-[var(--canvas-primary)] bg-transparent border border-[var(--canvas-border)] cursor-pointer px-2.5 py-1 rounded flex items-center gap-1 hover:bg-[var(--canvas-surface)]",
|
|
26352
|
-
children: "+ Add Style"
|
|
26353
|
-
}
|
|
26354
|
-
)
|
|
26355
|
-
] }),
|
|
26356
|
-
defaultButtonColorStyles.map((style) => /* @__PURE__ */ jsx(ButtonColorGroup, { style, theme }, style.id)),
|
|
26357
|
-
theme.customButtonStyles.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-4 pt-4 border-t border-[var(--canvas-border)]", children: [
|
|
26358
|
-
/* @__PURE__ */ jsx("h4", { className: "text-[11px] font-semibold text-[var(--canvas-text-muted)] mb-3", children: "Custom Styles" }),
|
|
26359
|
-
theme.customButtonStyles.map((style) => /* @__PURE__ */ jsx(
|
|
26360
|
-
CustomButtonColorGroup,
|
|
26361
|
-
{
|
|
26362
|
-
style,
|
|
26363
|
-
theme
|
|
26364
|
-
},
|
|
26365
|
-
style.id
|
|
26366
|
-
))
|
|
26367
|
-
] })
|
|
26360
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[11px] font-semibold text-[var(--canvas-text-muted)] uppercase tracking-wide mb-3", children: "Color Styles" }),
|
|
26361
|
+
defaultButtonColorStyles.map((style) => /* @__PURE__ */ jsx(ButtonColorGroup, { style, theme }, style.id))
|
|
26368
26362
|
] })
|
|
26369
26363
|
] });
|
|
26370
26364
|
}
|
|
@@ -26646,152 +26640,6 @@ function ButtonColorGroup({
|
|
|
26646
26640
|
)
|
|
26647
26641
|
] });
|
|
26648
26642
|
}
|
|
26649
|
-
function CustomButtonColorGroup({
|
|
26650
|
-
style,
|
|
26651
|
-
theme
|
|
26652
|
-
}) {
|
|
26653
|
-
const [expanded, setExpanded] = React13__default.useState(false);
|
|
26654
|
-
const [editing, setEditing] = React13__default.useState(false);
|
|
26655
|
-
const resolvedBg = resolveBrandingColor(style.bg);
|
|
26656
|
-
const resolvedText = resolveBrandingColor(style.text);
|
|
26657
|
-
const resolvedBorder = resolveBrandingColor(style.border);
|
|
26658
|
-
return /* @__PURE__ */ jsxs("div", { className: "py-3 border-b border-[var(--canvas-border)] last:border-b-0", children: [
|
|
26659
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between w-full", children: [
|
|
26660
|
-
editing ? /* @__PURE__ */ jsx(
|
|
26661
|
-
"input",
|
|
26662
|
-
{
|
|
26663
|
-
type: "text",
|
|
26664
|
-
value: style.label,
|
|
26665
|
-
onChange: (e) => theme.updateCustomButtonStyle(style.id, { label: e.target.value }),
|
|
26666
|
-
onBlur: () => setEditing(false),
|
|
26667
|
-
onKeyDown: (e) => e.key === "Enter" && setEditing(false),
|
|
26668
|
-
autoFocus: true,
|
|
26669
|
-
className: "text-sm font-semibold text-[var(--canvas-text)] border border-[var(--canvas-border)] rounded px-1.5 py-0.5 bg-white flex-1"
|
|
26670
|
-
}
|
|
26671
|
-
) : /* @__PURE__ */ jsxs(
|
|
26672
|
-
"button",
|
|
26673
|
-
{
|
|
26674
|
-
onClick: () => setExpanded(!expanded),
|
|
26675
|
-
className: "flex items-center gap-3 flex-1 min-w-0 text-left cursor-pointer",
|
|
26676
|
-
onDoubleClick: (e) => {
|
|
26677
|
-
e.stopPropagation();
|
|
26678
|
-
setEditing(true);
|
|
26679
|
-
},
|
|
26680
|
-
children: [
|
|
26681
|
-
/* @__PURE__ */ jsx(
|
|
26682
|
-
"div",
|
|
26683
|
-
{
|
|
26684
|
-
className: "w-8 h-6 rounded border shrink-0 flex items-center justify-center text-xs",
|
|
26685
|
-
style: {
|
|
26686
|
-
backgroundColor: resolvedBg === "transparent" ? "white" : resolvedBg,
|
|
26687
|
-
color: resolvedText,
|
|
26688
|
-
borderColor: resolvedBorder === "transparent" ? void 0 : resolvedBorder
|
|
26689
|
-
},
|
|
26690
|
-
children: "Aa"
|
|
26691
|
-
}
|
|
26692
|
-
),
|
|
26693
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-[var(--canvas-text)]", children: style.label })
|
|
26694
|
-
]
|
|
26695
|
-
}
|
|
26696
|
-
),
|
|
26697
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
26698
|
-
/* @__PURE__ */ jsx(
|
|
26699
|
-
"button",
|
|
26700
|
-
{
|
|
26701
|
-
onClick: () => theme.deleteCustomButtonStyle(style.id),
|
|
26702
|
-
className: "text-[11px] text-[var(--canvas-destructive)] bg-transparent border-none cursor-pointer px-1.5 py-0.5",
|
|
26703
|
-
children: "Delete"
|
|
26704
|
-
}
|
|
26705
|
-
),
|
|
26706
|
-
/* @__PURE__ */ jsx(
|
|
26707
|
-
ChevronDown,
|
|
26708
|
-
{
|
|
26709
|
-
onClick: () => setExpanded(!expanded),
|
|
26710
|
-
className: cn(
|
|
26711
|
-
"size-4 text-[var(--canvas-text-muted)] shrink-0 transition-transform duration-200 cursor-pointer",
|
|
26712
|
-
expanded && "rotate-180"
|
|
26713
|
-
)
|
|
26714
|
-
}
|
|
26715
|
-
)
|
|
26716
|
-
] })
|
|
26717
|
-
] }),
|
|
26718
|
-
/* @__PURE__ */ jsxs(
|
|
26719
|
-
"div",
|
|
26720
|
-
{
|
|
26721
|
-
className: cn(
|
|
26722
|
-
"overflow-hidden transition-all duration-200 ease-out",
|
|
26723
|
-
expanded ? "mt-3 max-h-[400px] opacity-100" : "max-h-0 opacity-0"
|
|
26724
|
-
),
|
|
26725
|
-
children: [
|
|
26726
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
|
|
26727
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-[var(--canvas-text-muted)] mb-2", children: "Normal" }),
|
|
26728
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-0", children: [
|
|
26729
|
-
/* @__PURE__ */ jsx(
|
|
26730
|
-
ColorInputRow,
|
|
26731
|
-
{
|
|
26732
|
-
label: "Background",
|
|
26733
|
-
value: style.bg,
|
|
26734
|
-
onChange: (val) => theme.updateCustomButtonStyle(style.id, { bg: val }),
|
|
26735
|
-
variableOptions: buttonColorVariableOptions
|
|
26736
|
-
}
|
|
26737
|
-
),
|
|
26738
|
-
/* @__PURE__ */ jsx(
|
|
26739
|
-
ColorInputRow,
|
|
26740
|
-
{
|
|
26741
|
-
label: "Text",
|
|
26742
|
-
value: style.text,
|
|
26743
|
-
onChange: (val) => theme.updateCustomButtonStyle(style.id, { text: val }),
|
|
26744
|
-
variableOptions: buttonColorVariableOptions
|
|
26745
|
-
}
|
|
26746
|
-
),
|
|
26747
|
-
/* @__PURE__ */ jsx(
|
|
26748
|
-
ColorInputRow,
|
|
26749
|
-
{
|
|
26750
|
-
label: "Border",
|
|
26751
|
-
value: style.border,
|
|
26752
|
-
onChange: (val) => theme.updateCustomButtonStyle(style.id, { border: val }),
|
|
26753
|
-
variableOptions: buttonColorVariableOptions
|
|
26754
|
-
}
|
|
26755
|
-
)
|
|
26756
|
-
] })
|
|
26757
|
-
] }),
|
|
26758
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
26759
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-[var(--canvas-text-muted)] mb-2", children: "Hover" }),
|
|
26760
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-0", children: [
|
|
26761
|
-
/* @__PURE__ */ jsx(
|
|
26762
|
-
ColorInputRow,
|
|
26763
|
-
{
|
|
26764
|
-
label: "Background",
|
|
26765
|
-
value: style.bgHover,
|
|
26766
|
-
onChange: (val) => theme.updateCustomButtonStyle(style.id, { bgHover: val }),
|
|
26767
|
-
variableOptions: buttonColorVariableOptions
|
|
26768
|
-
}
|
|
26769
|
-
),
|
|
26770
|
-
/* @__PURE__ */ jsx(
|
|
26771
|
-
ColorInputRow,
|
|
26772
|
-
{
|
|
26773
|
-
label: "Text",
|
|
26774
|
-
value: style.textHover,
|
|
26775
|
-
onChange: (val) => theme.updateCustomButtonStyle(style.id, { textHover: val }),
|
|
26776
|
-
variableOptions: buttonColorVariableOptions
|
|
26777
|
-
}
|
|
26778
|
-
),
|
|
26779
|
-
/* @__PURE__ */ jsx(
|
|
26780
|
-
ColorInputRow,
|
|
26781
|
-
{
|
|
26782
|
-
label: "Border",
|
|
26783
|
-
value: style.borderHover,
|
|
26784
|
-
onChange: (val) => theme.updateCustomButtonStyle(style.id, { borderHover: val }),
|
|
26785
|
-
variableOptions: buttonColorVariableOptions
|
|
26786
|
-
}
|
|
26787
|
-
)
|
|
26788
|
-
] })
|
|
26789
|
-
] })
|
|
26790
|
-
]
|
|
26791
|
-
}
|
|
26792
|
-
)
|
|
26793
|
-
] });
|
|
26794
|
-
}
|
|
26795
26643
|
var inputSizeConfigs = [
|
|
26796
26644
|
{ id: "small", label: "Small", description: "Compact inputs (30px)", prefix: "--input-small" },
|
|
26797
26645
|
{ id: "standard", label: "Standard", description: "Default inputs (40px)", prefix: "--input-standard" },
|
|
@@ -27249,29 +27097,11 @@ var drawerStyles = {
|
|
|
27249
27097
|
fontSize: "14px",
|
|
27250
27098
|
lineHeight: "1.5"
|
|
27251
27099
|
},
|
|
27252
|
-
trigger: (position) => ({
|
|
27253
|
-
position: "fixed",
|
|
27254
|
-
bottom: "20px",
|
|
27255
|
-
...position === "bottom-right" ? { right: "20px" } : { left: "20px" },
|
|
27256
|
-
zIndex: 9999,
|
|
27257
|
-
width: "48px",
|
|
27258
|
-
height: "48px",
|
|
27259
|
-
borderRadius: "12px",
|
|
27260
|
-
background: "#1f2937",
|
|
27261
|
-
color: "#ffffff",
|
|
27262
|
-
border: "none",
|
|
27263
|
-
cursor: "pointer",
|
|
27264
|
-
display: "flex",
|
|
27265
|
-
alignItems: "center",
|
|
27266
|
-
justifyContent: "center",
|
|
27267
|
-
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",
|
|
27268
|
-
transition: "transform 150ms, box-shadow 150ms"
|
|
27269
|
-
}),
|
|
27270
27100
|
tabBar: {
|
|
27271
27101
|
display: "flex",
|
|
27272
27102
|
borderBottom: "1px solid #e5e7eb",
|
|
27273
|
-
background: "#
|
|
27274
|
-
padding: "0",
|
|
27103
|
+
background: "#ffffff",
|
|
27104
|
+
padding: "0 8px",
|
|
27275
27105
|
gap: "0",
|
|
27276
27106
|
flexShrink: 0,
|
|
27277
27107
|
overflowX: "auto"
|
|
@@ -27280,11 +27110,11 @@ var drawerStyles = {
|
|
|
27280
27110
|
flex: 1,
|
|
27281
27111
|
padding: "10px 4px",
|
|
27282
27112
|
fontSize: "12px",
|
|
27283
|
-
fontWeight: active ?
|
|
27284
|
-
color: active ? "#
|
|
27113
|
+
fontWeight: active ? 500 : 400,
|
|
27114
|
+
color: active ? "#111827" : "#9ca3af",
|
|
27285
27115
|
background: "none",
|
|
27286
27116
|
border: "none",
|
|
27287
|
-
borderBottom: active ? "2px solid #
|
|
27117
|
+
borderBottom: active ? "2px solid #111827" : "2px solid transparent",
|
|
27288
27118
|
cursor: "pointer",
|
|
27289
27119
|
transition: "color 150ms, border-color 150ms",
|
|
27290
27120
|
textAlign: "center",
|
|
@@ -27304,8 +27134,8 @@ function PaletteIcon6() {
|
|
|
27304
27134
|
return /* @__PURE__ */ jsxs(
|
|
27305
27135
|
"svg",
|
|
27306
27136
|
{
|
|
27307
|
-
width: "
|
|
27308
|
-
height: "
|
|
27137
|
+
width: "16",
|
|
27138
|
+
height: "16",
|
|
27309
27139
|
viewBox: "0 0 24 24",
|
|
27310
27140
|
fill: "none",
|
|
27311
27141
|
stroke: "currentColor",
|
|
@@ -27346,6 +27176,44 @@ function ThemeDrawer({
|
|
|
27346
27176
|
const [open, setOpen] = useState(defaultOpen);
|
|
27347
27177
|
const [activeTab, setActiveTab] = useState("colors");
|
|
27348
27178
|
const [resetConfirmOpen, setResetConfirmOpen] = useState(false);
|
|
27179
|
+
const isRight = triggerPosition === "bottom-right";
|
|
27180
|
+
const [dragPos, setDragPos] = useState({ x: 20, y: 20 });
|
|
27181
|
+
const isDraggingRef = useRef(false);
|
|
27182
|
+
const dragStart = useRef({ pointerX: 0, pointerY: 0, startX: 0, startY: 0 });
|
|
27183
|
+
const handleDragPointerDown = useCallback(
|
|
27184
|
+
(e) => {
|
|
27185
|
+
e.preventDefault();
|
|
27186
|
+
e.stopPropagation();
|
|
27187
|
+
isDraggingRef.current = true;
|
|
27188
|
+
dragStart.current = {
|
|
27189
|
+
pointerX: e.clientX,
|
|
27190
|
+
pointerY: e.clientY,
|
|
27191
|
+
startX: dragPos.x,
|
|
27192
|
+
startY: dragPos.y
|
|
27193
|
+
};
|
|
27194
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
27195
|
+
},
|
|
27196
|
+
[dragPos]
|
|
27197
|
+
);
|
|
27198
|
+
const handleDragPointerMove = useCallback(
|
|
27199
|
+
(e) => {
|
|
27200
|
+
if (!isDraggingRef.current) return;
|
|
27201
|
+
const dx = e.clientX - dragStart.current.pointerX;
|
|
27202
|
+
const dy = e.clientY - dragStart.current.pointerY;
|
|
27203
|
+
setDragPos({
|
|
27204
|
+
x: Math.max(4, isRight ? dragStart.current.startX - dx : dragStart.current.startX + dx),
|
|
27205
|
+
y: Math.max(4, dragStart.current.startY - dy)
|
|
27206
|
+
});
|
|
27207
|
+
},
|
|
27208
|
+
[isRight]
|
|
27209
|
+
);
|
|
27210
|
+
const handleDragPointerUp = useCallback(
|
|
27211
|
+
(e) => {
|
|
27212
|
+
isDraggingRef.current = false;
|
|
27213
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
27214
|
+
},
|
|
27215
|
+
[]
|
|
27216
|
+
);
|
|
27349
27217
|
const theme = useThemeState({
|
|
27350
27218
|
storageKey,
|
|
27351
27219
|
initialOverrides,
|
|
@@ -27397,21 +27265,69 @@ function ThemeDrawer({
|
|
|
27397
27265
|
const activePanels = enabledPanels ? panelConfig.filter((p) => enabledPanels.includes(p.id)) : panelConfig;
|
|
27398
27266
|
const showFooter = theme.isDirty || resetConfirmOpen;
|
|
27399
27267
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27400
|
-
!open && /* @__PURE__ */
|
|
27401
|
-
"
|
|
27268
|
+
!open && /* @__PURE__ */ jsxs(
|
|
27269
|
+
"div",
|
|
27402
27270
|
{
|
|
27403
|
-
|
|
27404
|
-
|
|
27405
|
-
|
|
27406
|
-
|
|
27407
|
-
|
|
27408
|
-
|
|
27409
|
-
|
|
27410
|
-
|
|
27411
|
-
e.currentTarget.style.boxShadow = "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)";
|
|
27271
|
+
style: {
|
|
27272
|
+
position: "fixed",
|
|
27273
|
+
bottom: `${dragPos.y}px`,
|
|
27274
|
+
...isRight ? { right: `${dragPos.x}px` } : { left: `${dragPos.x}px` },
|
|
27275
|
+
zIndex: 9999,
|
|
27276
|
+
display: "flex",
|
|
27277
|
+
alignItems: "center",
|
|
27278
|
+
gap: "0"
|
|
27412
27279
|
},
|
|
27413
|
-
|
|
27414
|
-
|
|
27280
|
+
children: [
|
|
27281
|
+
/* @__PURE__ */ jsx(
|
|
27282
|
+
"div",
|
|
27283
|
+
{
|
|
27284
|
+
onPointerDown: handleDragPointerDown,
|
|
27285
|
+
onPointerMove: handleDragPointerMove,
|
|
27286
|
+
onPointerUp: handleDragPointerUp,
|
|
27287
|
+
style: {
|
|
27288
|
+
cursor: "grab",
|
|
27289
|
+
padding: "4px 2px",
|
|
27290
|
+
display: "flex",
|
|
27291
|
+
alignItems: "center",
|
|
27292
|
+
opacity: 0.25,
|
|
27293
|
+
touchAction: "none"
|
|
27294
|
+
},
|
|
27295
|
+
children: /* @__PURE__ */ jsx(GripVertical, { size: 12, color: "#9ca3af" })
|
|
27296
|
+
}
|
|
27297
|
+
),
|
|
27298
|
+
/* @__PURE__ */ jsx(
|
|
27299
|
+
"button",
|
|
27300
|
+
{
|
|
27301
|
+
onClick: () => setOpen(true),
|
|
27302
|
+
style: {
|
|
27303
|
+
width: "36px",
|
|
27304
|
+
height: "36px",
|
|
27305
|
+
borderRadius: "10px",
|
|
27306
|
+
background: "#ffffff",
|
|
27307
|
+
color: "#6b7280",
|
|
27308
|
+
border: "1px solid #e5e7eb",
|
|
27309
|
+
cursor: "pointer",
|
|
27310
|
+
display: "flex",
|
|
27311
|
+
alignItems: "center",
|
|
27312
|
+
justifyContent: "center",
|
|
27313
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06)",
|
|
27314
|
+
transition: "transform 150ms, box-shadow 150ms, border-color 150ms"
|
|
27315
|
+
},
|
|
27316
|
+
onMouseEnter: (e) => {
|
|
27317
|
+
e.currentTarget.style.transform = "scale(1.06)";
|
|
27318
|
+
e.currentTarget.style.boxShadow = "0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06)";
|
|
27319
|
+
e.currentTarget.style.borderColor = "#d1d5db";
|
|
27320
|
+
},
|
|
27321
|
+
onMouseLeave: (e) => {
|
|
27322
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
27323
|
+
e.currentTarget.style.boxShadow = "0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06)";
|
|
27324
|
+
e.currentTarget.style.borderColor = "#e5e7eb";
|
|
27325
|
+
},
|
|
27326
|
+
"aria-label": "Open theme editor",
|
|
27327
|
+
children: /* @__PURE__ */ jsx(PaletteIcon6, {})
|
|
27328
|
+
}
|
|
27329
|
+
)
|
|
27330
|
+
]
|
|
27415
27331
|
}
|
|
27416
27332
|
),
|
|
27417
27333
|
/* @__PURE__ */ jsx(Sheet, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs(
|
|
@@ -27455,6 +27371,7 @@ function ThemeDrawer({
|
|
|
27455
27371
|
fontSize: "13px",
|
|
27456
27372
|
color: "#6b7280",
|
|
27457
27373
|
marginTop: "2px",
|
|
27374
|
+
marginBottom: "4px",
|
|
27458
27375
|
fontFamily: drawerStyles.container.fontFamily
|
|
27459
27376
|
},
|
|
27460
27377
|
children: theme.unsavedChangesCount > 0 ? `${theme.unsavedChangesCount} unsaved change${theme.unsavedChangesCount !== 1 ? "s" : ""}` : "Customize your design system"
|