@optilogic/core 1.4.0 → 1.6.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/dist/index.cjs +249 -102
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -10
- package/dist/index.d.ts +59 -10
- package/dist/index.js +247 -103
- package/dist/index.js.map +1 -1
- package/dist/styles.css +12 -0
- package/dist/tailwind-preset.cjs +10 -2
- package/dist/tailwind-preset.cjs.map +1 -1
- package/dist/tailwind-preset.js +10 -2
- package/dist/tailwind-preset.js.map +1 -1
- package/package.json +2 -2
- package/src/components/confirmation-modal.tsx +41 -6
- package/src/components/data-grid/components/CellEditor.tsx +5 -2
- package/src/components/data-grid/components/FilterPopover.tsx +7 -4
- package/src/components/data-grid/utils/dataProcessing.ts +2 -1
- package/src/components/modal.tsx +55 -1
- package/src/components/resizable-panel.tsx +1 -1
- package/src/components/theme-picker.tsx +4 -2
- package/src/index.ts +3 -0
- package/src/styles.css +12 -0
- package/src/tailwind-preset.ts +9 -0
- package/src/theme/index.ts +3 -0
- package/src/theme/presets.ts +166 -91
- package/src/theme/types.ts +8 -0
- package/src/theme/utils.ts +57 -0
package/dist/index.cjs
CHANGED
|
@@ -2129,7 +2129,9 @@ function Modal({
|
|
|
2129
2129
|
size = "md",
|
|
2130
2130
|
zIndex = 50,
|
|
2131
2131
|
className,
|
|
2132
|
-
contentClassName
|
|
2132
|
+
contentClassName,
|
|
2133
|
+
responsive = false,
|
|
2134
|
+
forceMobile = false
|
|
2133
2135
|
}) {
|
|
2134
2136
|
React20__namespace.useEffect(() => {
|
|
2135
2137
|
if (!isOpen) return;
|
|
@@ -2160,10 +2162,18 @@ function Modal({
|
|
|
2160
2162
|
"2xl": "max-w-6xl",
|
|
2161
2163
|
full: "max-w-[95vw]"
|
|
2162
2164
|
};
|
|
2165
|
+
const responsiveOuter = "[@media(pointer:coarse)and(hover:none)]:!p-0";
|
|
2166
|
+
const responsiveFrame = "[@media(pointer:coarse)and(hover:none)]:!w-screen [@media(pointer:coarse)and(hover:none)]:!h-[100dvh] [@media(pointer:coarse)and(hover:none)]:!max-h-[100dvh] [@media(pointer:coarse)and(hover:none)]:!max-w-none [@media(pointer:coarse)and(hover:none)]:!rounded-none [@media(pointer:coarse)and(hover:none)]:!border-0";
|
|
2167
|
+
const forcedOuter = "!p-0";
|
|
2168
|
+
const forcedFrame = "!w-screen !h-[100dvh] !max-h-[100dvh] !max-w-none !rounded-none !border-0";
|
|
2163
2169
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2164
2170
|
"div",
|
|
2165
2171
|
{
|
|
2166
|
-
className:
|
|
2172
|
+
className: cn(
|
|
2173
|
+
"fixed inset-0 flex items-center justify-center p-4",
|
|
2174
|
+
responsive && responsiveOuter,
|
|
2175
|
+
forceMobile && forcedOuter
|
|
2176
|
+
),
|
|
2167
2177
|
style: { zIndex },
|
|
2168
2178
|
onClick: onClose,
|
|
2169
2179
|
children: [
|
|
@@ -2177,6 +2187,8 @@ function Modal({
|
|
|
2177
2187
|
"flex flex-col",
|
|
2178
2188
|
"max-h-[90vh]",
|
|
2179
2189
|
sizeClasses[size],
|
|
2190
|
+
responsive && responsiveFrame,
|
|
2191
|
+
forceMobile && forcedFrame,
|
|
2180
2192
|
contentClassName
|
|
2181
2193
|
),
|
|
2182
2194
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -2222,6 +2234,27 @@ function ModalButton({
|
|
|
2222
2234
|
}
|
|
2223
2235
|
);
|
|
2224
2236
|
}
|
|
2237
|
+
var mobileSheetContentClasses = [
|
|
2238
|
+
"[@media(pointer:coarse)and(hover:none)]:!top-auto",
|
|
2239
|
+
"[@media(pointer:coarse)and(hover:none)]:!bottom-0",
|
|
2240
|
+
"[@media(pointer:coarse)and(hover:none)]:!left-0",
|
|
2241
|
+
"[@media(pointer:coarse)and(hover:none)]:!translate-x-0",
|
|
2242
|
+
"[@media(pointer:coarse)and(hover:none)]:!translate-y-0",
|
|
2243
|
+
"[@media(pointer:coarse)and(hover:none)]:!w-screen",
|
|
2244
|
+
"[@media(pointer:coarse)and(hover:none)]:!max-w-none",
|
|
2245
|
+
"[@media(pointer:coarse)and(hover:none)]:!rounded-t-xl",
|
|
2246
|
+
"[@media(pointer:coarse)and(hover:none)]:!rounded-b-none",
|
|
2247
|
+
"[@media(pointer:coarse)and(hover:none)]:!pb-[calc(1.5rem+env(safe-area-inset-bottom))]"
|
|
2248
|
+
].join(" ");
|
|
2249
|
+
var mobileSheetFooterClasses = [
|
|
2250
|
+
// Stack buttons full-width with comfortable tap targets on touch devices.
|
|
2251
|
+
"[@media(pointer:coarse)and(hover:none)]:!flex-col",
|
|
2252
|
+
"[@media(pointer:coarse)and(hover:none)]:!gap-2"
|
|
2253
|
+
].join(" ");
|
|
2254
|
+
var mobileSheetActionClasses = [
|
|
2255
|
+
"[@media(pointer:coarse)and(hover:none)]:!w-full",
|
|
2256
|
+
"[@media(pointer:coarse)and(hover:none)]:!min-h-11"
|
|
2257
|
+
].join(" ");
|
|
2225
2258
|
function ConfirmationModal({
|
|
2226
2259
|
open,
|
|
2227
2260
|
onOpenChange,
|
|
@@ -2241,18 +2274,28 @@ function ConfirmationModal({
|
|
|
2241
2274
|
onConfirm();
|
|
2242
2275
|
onOpenChange(false);
|
|
2243
2276
|
};
|
|
2244
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogContent, { children: [
|
|
2277
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogContent, { className: mobileSheetContentClasses, children: [
|
|
2245
2278
|
/* @__PURE__ */ jsxRuntime.jsxs(AlertDialogHeader, { children: [
|
|
2246
2279
|
/* @__PURE__ */ jsxRuntime.jsx(AlertDialogTitle, { children: title }),
|
|
2247
2280
|
/* @__PURE__ */ jsxRuntime.jsx(AlertDialogDescription, { children: description })
|
|
2248
2281
|
] }),
|
|
2249
|
-
/* @__PURE__ */ jsxRuntime.jsxs(AlertDialogFooter, { children: [
|
|
2250
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2282
|
+
/* @__PURE__ */ jsxRuntime.jsxs(AlertDialogFooter, { className: mobileSheetFooterClasses, children: [
|
|
2283
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2284
|
+
AlertDialogCancel,
|
|
2285
|
+
{
|
|
2286
|
+
onClick: handleCancel,
|
|
2287
|
+
className: mobileSheetActionClasses,
|
|
2288
|
+
children: cancelLabel
|
|
2289
|
+
}
|
|
2290
|
+
),
|
|
2251
2291
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2252
2292
|
AlertDialogAction,
|
|
2253
2293
|
{
|
|
2254
2294
|
onClick: handleConfirm,
|
|
2255
|
-
className:
|
|
2295
|
+
className: [
|
|
2296
|
+
destructive ? "bg-destructive text-destructive-foreground hover:bg-destructive/90" : "",
|
|
2297
|
+
mobileSheetActionClasses
|
|
2298
|
+
].filter(Boolean).join(" "),
|
|
2256
2299
|
children: confirmLabel
|
|
2257
2300
|
}
|
|
2258
2301
|
)
|
|
@@ -2447,7 +2490,7 @@ function ResizablePanel({
|
|
|
2447
2490
|
const currentWidthVW = isExpanded ? (isDragging && localWidth !== null ? localWidth : expandedWidthVW) || collapsedSizeVW : collapsedSizeVW;
|
|
2448
2491
|
const clampWidth = React20__namespace.useCallback(
|
|
2449
2492
|
(width) => {
|
|
2450
|
-
|
|
2493
|
+
const effectiveMinWidth = minWidthVW;
|
|
2451
2494
|
let effectiveMaxWidth = maxWidthVW;
|
|
2452
2495
|
if (orientation === "right" && leftWidthVW !== void 0 && !isOverlay) {
|
|
2453
2496
|
const availableSpace = 100 - leftWidthVW - 3;
|
|
@@ -3337,7 +3380,7 @@ function FilterPopover({
|
|
|
3337
3380
|
] })
|
|
3338
3381
|
] });
|
|
3339
3382
|
const renderDateFilter = () => {
|
|
3340
|
-
const dateValue =
|
|
3383
|
+
const dateValue = (() => {
|
|
3341
3384
|
if (!value) return void 0;
|
|
3342
3385
|
if (value instanceof Date) return value;
|
|
3343
3386
|
if (typeof value === "string") {
|
|
@@ -3345,8 +3388,8 @@ function FilterPopover({
|
|
|
3345
3388
|
return dateFns.isValid(parsed) ? parsed : void 0;
|
|
3346
3389
|
}
|
|
3347
3390
|
return void 0;
|
|
3348
|
-
}
|
|
3349
|
-
const dateToValue =
|
|
3391
|
+
})();
|
|
3392
|
+
const dateToValue = (() => {
|
|
3350
3393
|
if (!valueTo) return void 0;
|
|
3351
3394
|
if (valueTo instanceof Date) return valueTo;
|
|
3352
3395
|
if (typeof valueTo === "string") {
|
|
@@ -3354,7 +3397,7 @@ function FilterPopover({
|
|
|
3354
3397
|
return dateFns.isValid(parsed) ? parsed : void 0;
|
|
3355
3398
|
}
|
|
3356
3399
|
return void 0;
|
|
3357
|
-
}
|
|
3400
|
+
})();
|
|
3358
3401
|
const handleDateChange = (date) => {
|
|
3359
3402
|
setValue(date ? dateFns.format(date, "yyyy-MM-dd") : "");
|
|
3360
3403
|
};
|
|
@@ -3744,7 +3787,7 @@ function CellEditor({
|
|
|
3744
3787
|
}
|
|
3745
3788
|
);
|
|
3746
3789
|
const renderDateEditor = () => {
|
|
3747
|
-
const dateValue =
|
|
3790
|
+
const dateValue = (() => {
|
|
3748
3791
|
if (!currentValue) return void 0;
|
|
3749
3792
|
if (currentValue instanceof Date) return currentValue;
|
|
3750
3793
|
if (typeof currentValue === "string") {
|
|
@@ -3752,7 +3795,7 @@ function CellEditor({
|
|
|
3752
3795
|
return dateFns.isValid(parsed) ? parsed : void 0;
|
|
3753
3796
|
}
|
|
3754
3797
|
return void 0;
|
|
3755
|
-
}
|
|
3798
|
+
})();
|
|
3756
3799
|
const handleDateChange = (date) => {
|
|
3757
3800
|
const stringValue = date ? dateFns.format(date, "yyyy-MM-dd") : "";
|
|
3758
3801
|
if (validate(stringValue)) {
|
|
@@ -4715,10 +4758,11 @@ function applyFilterOperator(value, filterValue, filterValueTo, operator, filter
|
|
|
4715
4758
|
return numValue < numFilterValue;
|
|
4716
4759
|
case "lte":
|
|
4717
4760
|
return numValue <= numFilterValue;
|
|
4718
|
-
case "between":
|
|
4761
|
+
case "between": {
|
|
4719
4762
|
const singleFilterValueTo = extractSingleValue(filterValueTo);
|
|
4720
4763
|
const numFilterValueTo = Number(singleFilterValueTo);
|
|
4721
4764
|
return numValue >= numFilterValue && numValue <= numFilterValueTo;
|
|
4765
|
+
}
|
|
4722
4766
|
default:
|
|
4723
4767
|
return true;
|
|
4724
4768
|
}
|
|
@@ -6406,104 +6450,112 @@ function CopyButton({ content, className, size = "md" }) {
|
|
|
6406
6450
|
}
|
|
6407
6451
|
|
|
6408
6452
|
// src/theme/presets.ts
|
|
6409
|
-
var
|
|
6410
|
-
id: "optilogic-
|
|
6411
|
-
name: "Optilogic
|
|
6412
|
-
description: "
|
|
6453
|
+
var OPTILOGIC_LIGHT_THEME = {
|
|
6454
|
+
id: "optilogic-light",
|
|
6455
|
+
name: "Optilogic Light",
|
|
6456
|
+
description: "The default Optilogic light theme",
|
|
6413
6457
|
author: "Optilogic",
|
|
6414
|
-
background: "#
|
|
6415
|
-
foreground: "#
|
|
6416
|
-
card: "#
|
|
6417
|
-
cardForeground: "#
|
|
6418
|
-
popover: "#
|
|
6419
|
-
popoverForeground: "#
|
|
6420
|
-
primary: "#
|
|
6421
|
-
primaryForeground: "#
|
|
6422
|
-
|
|
6458
|
+
background: "#F3F4FF",
|
|
6459
|
+
foreground: "#000000",
|
|
6460
|
+
card: "#EDEEFF",
|
|
6461
|
+
cardForeground: "#000000",
|
|
6462
|
+
popover: "#EDEEFF",
|
|
6463
|
+
popoverForeground: "#000000",
|
|
6464
|
+
primary: "#5766F2",
|
|
6465
|
+
primaryForeground: "#000000",
|
|
6466
|
+
primaryHover: "#4555E0",
|
|
6467
|
+
accent: "#929BEF",
|
|
6423
6468
|
accentForeground: "#0C0A5A",
|
|
6424
|
-
secondary: "#
|
|
6425
|
-
secondaryForeground: "#
|
|
6426
|
-
muted: "#
|
|
6427
|
-
mutedForeground: "#
|
|
6428
|
-
destructive: "#
|
|
6469
|
+
secondary: "#CFD4FB",
|
|
6470
|
+
secondaryForeground: "#000000",
|
|
6471
|
+
muted: "#E8ECFF",
|
|
6472
|
+
mutedForeground: "#2E2D5E",
|
|
6473
|
+
destructive: "#DC2626",
|
|
6429
6474
|
destructiveForeground: "#FFFFFF",
|
|
6430
|
-
success: "#
|
|
6431
|
-
successForeground: "#
|
|
6432
|
-
warning: "#
|
|
6433
|
-
warningForeground: "#
|
|
6434
|
-
chip: "#
|
|
6435
|
-
chipForeground: "#
|
|
6436
|
-
border: "#
|
|
6437
|
-
input: "#
|
|
6475
|
+
success: "#929BEF",
|
|
6476
|
+
successForeground: "#0C0A5A",
|
|
6477
|
+
warning: "#B45309",
|
|
6478
|
+
warningForeground: "#FFFFFF",
|
|
6479
|
+
chip: "#5766F2",
|
|
6480
|
+
chipForeground: "#FFFFFF",
|
|
6481
|
+
border: "#C8CEFF",
|
|
6482
|
+
input: "#C8CEFF",
|
|
6438
6483
|
ring: "#5766F2",
|
|
6439
|
-
popoverBorder: "#
|
|
6440
|
-
divider: "#
|
|
6441
|
-
toggleTrack: "#
|
|
6484
|
+
popoverBorder: "#C8CEFF",
|
|
6485
|
+
divider: "#B8BEE0",
|
|
6486
|
+
toggleTrack: "#929BEF",
|
|
6442
6487
|
toggleTrackForeground: "#FFFFFF",
|
|
6443
6488
|
inputHover: "#5766F2",
|
|
6444
|
-
chart1: "#
|
|
6445
|
-
chart2: "#
|
|
6446
|
-
chart3: "#
|
|
6447
|
-
chart4: "#
|
|
6448
|
-
chart5: "#
|
|
6449
|
-
chart6: "#
|
|
6450
|
-
chart7: "#
|
|
6451
|
-
chart8: "#
|
|
6452
|
-
chart9: "#
|
|
6453
|
-
chart10: "#
|
|
6454
|
-
chart11: "#
|
|
6455
|
-
chart12: "#
|
|
6456
|
-
radius: "0.5rem"
|
|
6489
|
+
chart1: "#5766F2",
|
|
6490
|
+
chart2: "#929BEF",
|
|
6491
|
+
chart3: "#CFD4FB",
|
|
6492
|
+
chart4: "#0C0A5A",
|
|
6493
|
+
chart5: "#B45309",
|
|
6494
|
+
chart6: "#DC2626",
|
|
6495
|
+
chart7: "#A855F7",
|
|
6496
|
+
chart8: "#EC4899",
|
|
6497
|
+
chart9: "#55548C",
|
|
6498
|
+
chart10: "#0C0A5A",
|
|
6499
|
+
chart11: "#C05621",
|
|
6500
|
+
chart12: "#06B6D4",
|
|
6501
|
+
radius: "0.5rem",
|
|
6502
|
+
brandGradientFrom: "#1A7B4A",
|
|
6503
|
+
brandGradientTo: "#72DA60"
|
|
6457
6504
|
};
|
|
6458
6505
|
var OPTILOGIC_DARK_THEME = {
|
|
6459
6506
|
id: "optilogic-dark",
|
|
6460
6507
|
name: "Optilogic Dark",
|
|
6461
|
-
description: "Optilogic
|
|
6508
|
+
description: "The default Optilogic dark theme",
|
|
6462
6509
|
author: "Optilogic",
|
|
6463
|
-
background: "#
|
|
6464
|
-
foreground: "#
|
|
6465
|
-
card: "#
|
|
6466
|
-
cardForeground: "#
|
|
6467
|
-
popover: "#
|
|
6468
|
-
popoverForeground: "#
|
|
6469
|
-
primary: "#
|
|
6470
|
-
primaryForeground: "#
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6510
|
+
background: "#141826",
|
|
6511
|
+
foreground: "#E8EAF0",
|
|
6512
|
+
card: "#2D3252",
|
|
6513
|
+
cardForeground: "#E8EAF0",
|
|
6514
|
+
popover: "#2D3252",
|
|
6515
|
+
popoverForeground: "#E8EAF0",
|
|
6516
|
+
primary: "#5766F2",
|
|
6517
|
+
primaryForeground: "#FFFFFF",
|
|
6518
|
+
primaryHover: "#7B8FF7",
|
|
6519
|
+
accent: "#5766F2",
|
|
6520
|
+
accentForeground: "#FFFFFF",
|
|
6521
|
+
accentHover: "#7B8FF7",
|
|
6522
|
+
secondary: "#2D3252",
|
|
6523
|
+
secondaryForeground: "#E8EAF0",
|
|
6524
|
+
muted: "#2D3252",
|
|
6525
|
+
mutedForeground: "#C5C9D4",
|
|
6477
6526
|
destructive: "#EF4444",
|
|
6478
6527
|
destructiveForeground: "#FFFFFF",
|
|
6479
|
-
success: "#
|
|
6480
|
-
successForeground: "#
|
|
6481
|
-
warning: "#
|
|
6482
|
-
warningForeground: "#
|
|
6483
|
-
chip: "#
|
|
6484
|
-
chipForeground: "#
|
|
6485
|
-
border: "#
|
|
6486
|
-
input: "#
|
|
6487
|
-
ring: "#
|
|
6488
|
-
popoverBorder: "#
|
|
6489
|
-
divider: "#
|
|
6490
|
-
toggleTrack: "#
|
|
6491
|
-
toggleTrackForeground: "#
|
|
6492
|
-
inputHover: "#
|
|
6493
|
-
chart1: "#
|
|
6494
|
-
chart2: "#
|
|
6495
|
-
chart3: "#
|
|
6496
|
-
chart4: "#
|
|
6497
|
-
chart5: "#
|
|
6528
|
+
success: "#22C55E",
|
|
6529
|
+
successForeground: "#141826",
|
|
6530
|
+
warning: "#F59E0B",
|
|
6531
|
+
warningForeground: "#141826",
|
|
6532
|
+
chip: "#5766F2",
|
|
6533
|
+
chipForeground: "#FFFFFF",
|
|
6534
|
+
border: "#3A3F5C",
|
|
6535
|
+
input: "#2D3252",
|
|
6536
|
+
ring: "#7B8FF7",
|
|
6537
|
+
popoverBorder: "#3A3F5C",
|
|
6538
|
+
divider: "#363B5C",
|
|
6539
|
+
toggleTrack: "#4A5068",
|
|
6540
|
+
toggleTrackForeground: "#141826",
|
|
6541
|
+
inputHover: "#7B8FF7",
|
|
6542
|
+
chart1: "#7B8FF7",
|
|
6543
|
+
chart2: "#5766F2",
|
|
6544
|
+
chart3: "#22D3EE",
|
|
6545
|
+
chart4: "#22C55E",
|
|
6546
|
+
chart5: "#F59E0B",
|
|
6498
6547
|
chart6: "#EF4444",
|
|
6499
|
-
chart7: "#
|
|
6548
|
+
chart7: "#A855F7",
|
|
6500
6549
|
chart8: "#EC4899",
|
|
6501
|
-
chart9: "#
|
|
6550
|
+
chart9: "#C5C9D4",
|
|
6502
6551
|
chart10: "#14B8A6",
|
|
6503
|
-
chart11: "#
|
|
6504
|
-
chart12: "#
|
|
6505
|
-
radius: "0.5rem"
|
|
6552
|
+
chart11: "#FB923C",
|
|
6553
|
+
chart12: "#60A5FA",
|
|
6554
|
+
radius: "0.5rem",
|
|
6555
|
+
brandGradientFrom: "#1A7B4A",
|
|
6556
|
+
brandGradientTo: "#50FFA7"
|
|
6506
6557
|
};
|
|
6558
|
+
var OPTILOGIC_LEGACY_THEME = OPTILOGIC_LIGHT_THEME;
|
|
6507
6559
|
var MODERN_LIGHT_THEME = {
|
|
6508
6560
|
id: "modern-light",
|
|
6509
6561
|
name: "Modern Light",
|
|
@@ -6652,22 +6704,72 @@ var DARK_ELEGANT_THEME = {
|
|
|
6652
6704
|
chart12: "#F06292",
|
|
6653
6705
|
radius: "0.5rem"
|
|
6654
6706
|
};
|
|
6707
|
+
var GREEN_THEME = {
|
|
6708
|
+
id: "green-theme",
|
|
6709
|
+
name: "Green Theme",
|
|
6710
|
+
description: "A green theme with natural, earthy tones",
|
|
6711
|
+
author: "Optilogic",
|
|
6712
|
+
background: "#1a2820",
|
|
6713
|
+
foreground: "#E6F5EC",
|
|
6714
|
+
card: "#2d4038",
|
|
6715
|
+
cardForeground: "#E6F5EC",
|
|
6716
|
+
popover: "#243630",
|
|
6717
|
+
popoverForeground: "#E6F5EC",
|
|
6718
|
+
primary: "#6FCF97",
|
|
6719
|
+
primaryForeground: "#1a2820",
|
|
6720
|
+
accent: "#6FCF97",
|
|
6721
|
+
accentForeground: "#1a2820",
|
|
6722
|
+
secondary: "#1f3329",
|
|
6723
|
+
secondaryForeground: "#E6F5EC",
|
|
6724
|
+
muted: "#354840",
|
|
6725
|
+
mutedForeground: "#9DB8A8",
|
|
6726
|
+
destructive: "#EB5757",
|
|
6727
|
+
destructiveForeground: "#E6F5EC",
|
|
6728
|
+
success: "#6FCF97",
|
|
6729
|
+
successForeground: "#1a2820",
|
|
6730
|
+
warning: "#F2C94C",
|
|
6731
|
+
warningForeground: "#1a2820",
|
|
6732
|
+
chip: "#3a5045",
|
|
6733
|
+
chipForeground: "#C5E3D1",
|
|
6734
|
+
border: "#243630",
|
|
6735
|
+
input: "#243630",
|
|
6736
|
+
ring: "#6FCF97",
|
|
6737
|
+
chart1: "#6FCF97",
|
|
6738
|
+
chart2: "#8FE3B0",
|
|
6739
|
+
chart3: "#9DB8A8",
|
|
6740
|
+
chart4: "#2d4038",
|
|
6741
|
+
chart5: "#354840",
|
|
6742
|
+
chart6: "#EB5757",
|
|
6743
|
+
chart7: "#F2C94C",
|
|
6744
|
+
chart8: "#56CCF2",
|
|
6745
|
+
chart9: "#BB6BD9",
|
|
6746
|
+
chart10: "#4ECDC4",
|
|
6747
|
+
chart11: "#A8D8B9",
|
|
6748
|
+
chart12: "#E07B39",
|
|
6749
|
+
radius: "0.5rem"
|
|
6750
|
+
};
|
|
6655
6751
|
var PRESET_THEMES = [
|
|
6656
|
-
|
|
6752
|
+
OPTILOGIC_LIGHT_THEME,
|
|
6657
6753
|
OPTILOGIC_DARK_THEME,
|
|
6658
6754
|
MODERN_LIGHT_THEME,
|
|
6659
6755
|
MODERN_DARK_THEME,
|
|
6660
|
-
|
|
6756
|
+
GREEN_THEME
|
|
6661
6757
|
];
|
|
6662
6758
|
var ALL_THEMES = PRESET_THEMES;
|
|
6759
|
+
var LEGACY_THEME_ID_MAP = {
|
|
6760
|
+
"optilogic-legacy": OPTILOGIC_LIGHT_THEME.id,
|
|
6761
|
+
"dark-elegant": OPTILOGIC_DARK_THEME.id
|
|
6762
|
+
};
|
|
6663
6763
|
function getPresetTheme(id) {
|
|
6664
|
-
|
|
6764
|
+
const resolvedId = LEGACY_THEME_ID_MAP[id] ?? id;
|
|
6765
|
+
return ALL_THEMES.find((theme) => theme.id === resolvedId);
|
|
6665
6766
|
}
|
|
6666
6767
|
function getDefaultTheme() {
|
|
6667
|
-
return
|
|
6768
|
+
return OPTILOGIC_LIGHT_THEME;
|
|
6668
6769
|
}
|
|
6669
6770
|
function isPresetTheme(themeId) {
|
|
6670
|
-
|
|
6771
|
+
const resolvedId = LEGACY_THEME_ID_MAP[themeId] ?? themeId;
|
|
6772
|
+
return ALL_THEMES.some((theme) => theme.id === resolvedId);
|
|
6671
6773
|
}
|
|
6672
6774
|
|
|
6673
6775
|
// src/theme/utils.ts
|
|
@@ -6749,6 +6851,21 @@ function themeToHsl(theme) {
|
|
|
6749
6851
|
chart12: hexToHsl(theme.chart12)
|
|
6750
6852
|
};
|
|
6751
6853
|
}
|
|
6854
|
+
function blendHex(base, blend, amount) {
|
|
6855
|
+
const a = base.replace(/^#/, "");
|
|
6856
|
+
const b = blend.replace(/^#/, "");
|
|
6857
|
+
const ar = parseInt(a.substring(0, 2), 16);
|
|
6858
|
+
const ag = parseInt(a.substring(2, 4), 16);
|
|
6859
|
+
const ab = parseInt(a.substring(4, 6), 16);
|
|
6860
|
+
const br = parseInt(b.substring(0, 2), 16);
|
|
6861
|
+
const bg = parseInt(b.substring(2, 4), 16);
|
|
6862
|
+
const bb = parseInt(b.substring(4, 6), 16);
|
|
6863
|
+
const r = Math.round(ar + (br - ar) * amount);
|
|
6864
|
+
const g = Math.round(ag + (bg - ag) * amount);
|
|
6865
|
+
const bl = Math.round(ab + (bb - ab) * amount);
|
|
6866
|
+
const hex = (v) => Math.max(0, Math.min(255, v)).toString(16).padStart(2, "0");
|
|
6867
|
+
return "#" + hex(r) + hex(g) + hex(bl);
|
|
6868
|
+
}
|
|
6752
6869
|
function deriveInputHoverHsl(hslTheme) {
|
|
6753
6870
|
const parts = hslTheme.foreground.split(/\s+/);
|
|
6754
6871
|
if (parts.length >= 3) {
|
|
@@ -6821,6 +6938,27 @@ function applyTheme(theme, targetElement) {
|
|
|
6821
6938
|
"--hover",
|
|
6822
6939
|
`${hslTheme.hover ?? deriveHoverChannels(theme, hslTheme)} / 0.18`
|
|
6823
6940
|
);
|
|
6941
|
+
if (theme.primaryHover) {
|
|
6942
|
+
element.style.setProperty("--primary-hover", hexToHsl(theme.primaryHover));
|
|
6943
|
+
} else {
|
|
6944
|
+
element.style.removeProperty("--primary-hover");
|
|
6945
|
+
}
|
|
6946
|
+
if (theme.card && theme.accent) {
|
|
6947
|
+
const accentHover = theme.accentHover ? theme.accentHover : blendHex(theme.card, theme.accent, 0.08);
|
|
6948
|
+
const accentActive = blendHex(theme.card, theme.accent, 0.15);
|
|
6949
|
+
element.style.setProperty("--accent-hover", hexToHsl(accentHover));
|
|
6950
|
+
element.style.setProperty("--accent-active", hexToHsl(accentActive));
|
|
6951
|
+
}
|
|
6952
|
+
if (theme.brandGradientFrom) {
|
|
6953
|
+
element.style.setProperty("--brand-from", hexToHsl(theme.brandGradientFrom));
|
|
6954
|
+
} else {
|
|
6955
|
+
element.style.removeProperty("--brand-from");
|
|
6956
|
+
}
|
|
6957
|
+
if (theme.brandGradientTo) {
|
|
6958
|
+
element.style.setProperty("--brand-to", hexToHsl(theme.brandGradientTo));
|
|
6959
|
+
} else {
|
|
6960
|
+
element.style.removeProperty("--brand-to");
|
|
6961
|
+
}
|
|
6824
6962
|
element.style.setProperty("--chart-1", hslTheme.chart1);
|
|
6825
6963
|
element.style.setProperty("--chart-2", hslTheme.chart2);
|
|
6826
6964
|
element.style.setProperty("--chart-3", hslTheme.chart3);
|
|
@@ -6939,6 +7077,10 @@ function areThemesEqual(theme1, theme2) {
|
|
|
6939
7077
|
"toggleTrackForeground",
|
|
6940
7078
|
"inputHover",
|
|
6941
7079
|
"hover",
|
|
7080
|
+
"primaryHover",
|
|
7081
|
+
"accentHover",
|
|
7082
|
+
"brandGradientFrom",
|
|
7083
|
+
"brandGradientTo",
|
|
6942
7084
|
"chart1",
|
|
6943
7085
|
"chart2",
|
|
6944
7086
|
"chart3",
|
|
@@ -7093,17 +7235,19 @@ function ThemePicker({
|
|
|
7093
7235
|
const currentIndex = themes.findIndex((t) => t.id === selectedTheme?.id);
|
|
7094
7236
|
switch (e.key) {
|
|
7095
7237
|
case "ArrowRight":
|
|
7096
|
-
case "ArrowDown":
|
|
7238
|
+
case "ArrowDown": {
|
|
7097
7239
|
e.preventDefault();
|
|
7098
7240
|
const nextIndex = (currentIndex + 1) % themes.length;
|
|
7099
7241
|
handleThemeSelect(themes[nextIndex]);
|
|
7100
7242
|
break;
|
|
7243
|
+
}
|
|
7101
7244
|
case "ArrowLeft":
|
|
7102
|
-
case "ArrowUp":
|
|
7245
|
+
case "ArrowUp": {
|
|
7103
7246
|
e.preventDefault();
|
|
7104
7247
|
const prevIndex = currentIndex <= 0 ? themes.length - 1 : currentIndex - 1;
|
|
7105
7248
|
handleThemeSelect(themes[prevIndex]);
|
|
7106
7249
|
break;
|
|
7250
|
+
}
|
|
7107
7251
|
}
|
|
7108
7252
|
};
|
|
7109
7253
|
return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
@@ -8642,11 +8786,13 @@ exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
|
|
|
8642
8786
|
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
8643
8787
|
exports.FileView = FileView;
|
|
8644
8788
|
exports.FilterPopover = FilterPopover;
|
|
8789
|
+
exports.GREEN_THEME = GREEN_THEME;
|
|
8645
8790
|
exports.HeaderCell = HeaderCell;
|
|
8646
8791
|
exports.HtmlRenderer = HtmlRenderer;
|
|
8647
8792
|
exports.IconButton = IconButton;
|
|
8648
8793
|
exports.ImageRenderer = ImageRenderer;
|
|
8649
8794
|
exports.Input = Input;
|
|
8795
|
+
exports.LEGACY_THEME_ID_MAP = LEGACY_THEME_ID_MAP;
|
|
8650
8796
|
exports.Label = Label;
|
|
8651
8797
|
exports.LoadingSpinner = LoadingSpinner;
|
|
8652
8798
|
exports.MINIMALIST_LIGHT_THEME = MINIMALIST_LIGHT_THEME;
|
|
@@ -8658,6 +8804,7 @@ exports.ModalButton = ModalButton;
|
|
|
8658
8804
|
exports.MultiSelect = MultiSelect;
|
|
8659
8805
|
exports.OPTILOGIC_DARK_THEME = OPTILOGIC_DARK_THEME;
|
|
8660
8806
|
exports.OPTILOGIC_LEGACY_THEME = OPTILOGIC_LEGACY_THEME;
|
|
8807
|
+
exports.OPTILOGIC_LIGHT_THEME = OPTILOGIC_LIGHT_THEME;
|
|
8661
8808
|
exports.OptilogicLogo = OptilogicLogo;
|
|
8662
8809
|
exports.OptilogicLogoWithText = OptilogicLogoWithText;
|
|
8663
8810
|
exports.PRESET_THEMES = PRESET_THEMES;
|