@optilogic/core 1.5.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 CHANGED
@@ -2490,7 +2490,7 @@ function ResizablePanel({
2490
2490
  const currentWidthVW = isExpanded ? (isDragging && localWidth !== null ? localWidth : expandedWidthVW) || collapsedSizeVW : collapsedSizeVW;
2491
2491
  const clampWidth = React20__namespace.useCallback(
2492
2492
  (width) => {
2493
- let effectiveMinWidth = minWidthVW;
2493
+ const effectiveMinWidth = minWidthVW;
2494
2494
  let effectiveMaxWidth = maxWidthVW;
2495
2495
  if (orientation === "right" && leftWidthVW !== void 0 && !isOverlay) {
2496
2496
  const availableSpace = 100 - leftWidthVW - 3;
@@ -3380,7 +3380,7 @@ function FilterPopover({
3380
3380
  ] })
3381
3381
  ] });
3382
3382
  const renderDateFilter = () => {
3383
- const dateValue = React20__namespace.useMemo(() => {
3383
+ const dateValue = (() => {
3384
3384
  if (!value) return void 0;
3385
3385
  if (value instanceof Date) return value;
3386
3386
  if (typeof value === "string") {
@@ -3388,8 +3388,8 @@ function FilterPopover({
3388
3388
  return dateFns.isValid(parsed) ? parsed : void 0;
3389
3389
  }
3390
3390
  return void 0;
3391
- }, [value]);
3392
- const dateToValue = React20__namespace.useMemo(() => {
3391
+ })();
3392
+ const dateToValue = (() => {
3393
3393
  if (!valueTo) return void 0;
3394
3394
  if (valueTo instanceof Date) return valueTo;
3395
3395
  if (typeof valueTo === "string") {
@@ -3397,7 +3397,7 @@ function FilterPopover({
3397
3397
  return dateFns.isValid(parsed) ? parsed : void 0;
3398
3398
  }
3399
3399
  return void 0;
3400
- }, [valueTo]);
3400
+ })();
3401
3401
  const handleDateChange = (date) => {
3402
3402
  setValue(date ? dateFns.format(date, "yyyy-MM-dd") : "");
3403
3403
  };
@@ -3787,7 +3787,7 @@ function CellEditor({
3787
3787
  }
3788
3788
  );
3789
3789
  const renderDateEditor = () => {
3790
- const dateValue = React20__namespace.useMemo(() => {
3790
+ const dateValue = (() => {
3791
3791
  if (!currentValue) return void 0;
3792
3792
  if (currentValue instanceof Date) return currentValue;
3793
3793
  if (typeof currentValue === "string") {
@@ -3795,7 +3795,7 @@ function CellEditor({
3795
3795
  return dateFns.isValid(parsed) ? parsed : void 0;
3796
3796
  }
3797
3797
  return void 0;
3798
- }, [currentValue]);
3798
+ })();
3799
3799
  const handleDateChange = (date) => {
3800
3800
  const stringValue = date ? dateFns.format(date, "yyyy-MM-dd") : "";
3801
3801
  if (validate(stringValue)) {
@@ -4758,10 +4758,11 @@ function applyFilterOperator(value, filterValue, filterValueTo, operator, filter
4758
4758
  return numValue < numFilterValue;
4759
4759
  case "lte":
4760
4760
  return numValue <= numFilterValue;
4761
- case "between":
4761
+ case "between": {
4762
4762
  const singleFilterValueTo = extractSingleValue(filterValueTo);
4763
4763
  const numFilterValueTo = Number(singleFilterValueTo);
4764
4764
  return numValue >= numFilterValue && numValue <= numFilterValueTo;
4765
+ }
4765
4766
  default:
4766
4767
  return true;
4767
4768
  }
@@ -6449,104 +6450,112 @@ function CopyButton({ content, className, size = "md" }) {
6449
6450
  }
6450
6451
 
6451
6452
  // src/theme/presets.ts
6452
- var OPTILOGIC_LEGACY_THEME = {
6453
- id: "optilogic-legacy",
6454
- name: "Optilogic Legacy",
6455
- description: "Classic Optilogic color scheme with blue accents",
6453
+ var OPTILOGIC_LIGHT_THEME = {
6454
+ id: "optilogic-light",
6455
+ name: "Optilogic Light",
6456
+ description: "The default Optilogic light theme",
6456
6457
  author: "Optilogic",
6457
- background: "#FFFFFF",
6458
- foreground: "#0C0A5A",
6459
- card: "#F9F9F9",
6460
- cardForeground: "#0C0A5A",
6461
- popover: "#FFFFFF",
6462
- popoverForeground: "#0C0A5A",
6463
- primary: "#0C0A5A",
6464
- primaryForeground: "#FFFFFF",
6465
- accent: "#CFD4FB",
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",
6466
6468
  accentForeground: "#0C0A5A",
6467
- secondary: "#5766F2",
6468
- secondaryForeground: "#FFFFFF",
6469
- muted: "#E6EAF0",
6470
- mutedForeground: "#737272",
6471
- destructive: "#DB2828",
6469
+ secondary: "#CFD4FB",
6470
+ secondaryForeground: "#000000",
6471
+ muted: "#E8ECFF",
6472
+ mutedForeground: "#2E2D5E",
6473
+ destructive: "#DC2626",
6472
6474
  destructiveForeground: "#FFFFFF",
6473
- success: "#44BD7E",
6474
- successForeground: "#FFFFFF",
6475
- warning: "#F5CF47",
6476
- warningForeground: "#0C0A5A",
6477
- chip: "#B8C5F9",
6478
- chipForeground: "#0C0A5A",
6479
- border: "#D0D0D0",
6480
- input: "#D0D0D0",
6475
+ success: "#929BEF",
6476
+ successForeground: "#0C0A5A",
6477
+ warning: "#B45309",
6478
+ warningForeground: "#FFFFFF",
6479
+ chip: "#5766F2",
6480
+ chipForeground: "#FFFFFF",
6481
+ border: "#C8CEFF",
6482
+ input: "#C8CEFF",
6481
6483
  ring: "#5766F2",
6482
- popoverBorder: "#D0D0D0",
6483
- divider: "#D0D0D0",
6484
- toggleTrack: "#D0D0D0",
6484
+ popoverBorder: "#C8CEFF",
6485
+ divider: "#B8BEE0",
6486
+ toggleTrack: "#929BEF",
6485
6487
  toggleTrackForeground: "#FFFFFF",
6486
6488
  inputHover: "#5766F2",
6487
- chart1: "#78D237",
6488
- chart2: "#F5CF47",
6489
- chart3: "#5766F2",
6490
- chart4: "#44BD7E",
6491
- chart5: "#929BEF",
6492
- chart6: "#DB2828",
6493
- chart7: "#E07B39",
6494
- chart8: "#2BBBAD",
6495
- chart9: "#A5673F",
6496
- chart10: "#00B5AD",
6497
- chart11: "#6435C9",
6498
- chart12: "#E03997",
6499
- 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"
6500
6504
  };
6501
6505
  var OPTILOGIC_DARK_THEME = {
6502
6506
  id: "optilogic-dark",
6503
6507
  name: "Optilogic Dark",
6504
- description: "Optilogic branded dark theme with signature green",
6508
+ description: "The default Optilogic dark theme",
6505
6509
  author: "Optilogic",
6506
- background: "#042926",
6507
- foreground: "#E0E7E6",
6508
- card: "#0A3F34",
6509
- cardForeground: "#E0E7E6",
6510
- popover: "#0A3F34",
6511
- popoverForeground: "#E0E7E6",
6512
- primary: "#23EF6A",
6513
- primaryForeground: "#042926",
6514
- accent: "#23EF6A",
6515
- accentForeground: "#042926",
6516
- secondary: "#0D4D3F",
6517
- secondaryForeground: "#E0E7E6",
6518
- muted: "#0D4D3F",
6519
- mutedForeground: "#9CB5B0",
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",
6520
6526
  destructive: "#EF4444",
6521
6527
  destructiveForeground: "#FFFFFF",
6522
- success: "#23EF6A",
6523
- successForeground: "#042926",
6524
- warning: "#FBBF24",
6525
- warningForeground: "#042926",
6526
- chip: "#0D4D3F",
6527
- chipForeground: "#A7D5CA",
6528
- border: "#1A5C4C",
6529
- input: "#1A5C4C",
6530
- ring: "#23EF6A",
6531
- popoverBorder: "#237A64",
6532
- divider: "#1A5C4C",
6533
- toggleTrack: "#1A5C4C",
6534
- toggleTrackForeground: "#E0E7E6",
6535
- inputHover: "#23EF6A",
6536
- chart1: "#23EF6A",
6537
- chart2: "#3B82F6",
6538
- chart3: "#FBBF24",
6539
- chart4: "#F97316",
6540
- chart5: "#A78BFA",
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",
6541
6547
  chart6: "#EF4444",
6542
- chart7: "#06B6D4",
6548
+ chart7: "#A855F7",
6543
6549
  chart8: "#EC4899",
6544
- chart9: "#84CC16",
6550
+ chart9: "#C5C9D4",
6545
6551
  chart10: "#14B8A6",
6546
- chart11: "#F59E0B",
6547
- chart12: "#8B5CF6",
6548
- radius: "0.5rem"
6552
+ chart11: "#FB923C",
6553
+ chart12: "#60A5FA",
6554
+ radius: "0.5rem",
6555
+ brandGradientFrom: "#1A7B4A",
6556
+ brandGradientTo: "#50FFA7"
6549
6557
  };
6558
+ var OPTILOGIC_LEGACY_THEME = OPTILOGIC_LIGHT_THEME;
6550
6559
  var MODERN_LIGHT_THEME = {
6551
6560
  id: "modern-light",
6552
6561
  name: "Modern Light",
@@ -6695,22 +6704,72 @@ var DARK_ELEGANT_THEME = {
6695
6704
  chart12: "#F06292",
6696
6705
  radius: "0.5rem"
6697
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
+ };
6698
6751
  var PRESET_THEMES = [
6699
- OPTILOGIC_LEGACY_THEME,
6752
+ OPTILOGIC_LIGHT_THEME,
6700
6753
  OPTILOGIC_DARK_THEME,
6701
6754
  MODERN_LIGHT_THEME,
6702
6755
  MODERN_DARK_THEME,
6703
- DARK_ELEGANT_THEME
6756
+ GREEN_THEME
6704
6757
  ];
6705
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
+ };
6706
6763
  function getPresetTheme(id) {
6707
- return ALL_THEMES.find((theme) => theme.id === id);
6764
+ const resolvedId = LEGACY_THEME_ID_MAP[id] ?? id;
6765
+ return ALL_THEMES.find((theme) => theme.id === resolvedId);
6708
6766
  }
6709
6767
  function getDefaultTheme() {
6710
- return OPTILOGIC_LEGACY_THEME;
6768
+ return OPTILOGIC_LIGHT_THEME;
6711
6769
  }
6712
6770
  function isPresetTheme(themeId) {
6713
- return ALL_THEMES.some((theme) => theme.id === themeId);
6771
+ const resolvedId = LEGACY_THEME_ID_MAP[themeId] ?? themeId;
6772
+ return ALL_THEMES.some((theme) => theme.id === resolvedId);
6714
6773
  }
6715
6774
 
6716
6775
  // src/theme/utils.ts
@@ -6792,6 +6851,21 @@ function themeToHsl(theme) {
6792
6851
  chart12: hexToHsl(theme.chart12)
6793
6852
  };
6794
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
+ }
6795
6869
  function deriveInputHoverHsl(hslTheme) {
6796
6870
  const parts = hslTheme.foreground.split(/\s+/);
6797
6871
  if (parts.length >= 3) {
@@ -6864,6 +6938,27 @@ function applyTheme(theme, targetElement) {
6864
6938
  "--hover",
6865
6939
  `${hslTheme.hover ?? deriveHoverChannels(theme, hslTheme)} / 0.18`
6866
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
+ }
6867
6962
  element.style.setProperty("--chart-1", hslTheme.chart1);
6868
6963
  element.style.setProperty("--chart-2", hslTheme.chart2);
6869
6964
  element.style.setProperty("--chart-3", hslTheme.chart3);
@@ -6982,6 +7077,10 @@ function areThemesEqual(theme1, theme2) {
6982
7077
  "toggleTrackForeground",
6983
7078
  "inputHover",
6984
7079
  "hover",
7080
+ "primaryHover",
7081
+ "accentHover",
7082
+ "brandGradientFrom",
7083
+ "brandGradientTo",
6985
7084
  "chart1",
6986
7085
  "chart2",
6987
7086
  "chart3",
@@ -7136,17 +7235,19 @@ function ThemePicker({
7136
7235
  const currentIndex = themes.findIndex((t) => t.id === selectedTheme?.id);
7137
7236
  switch (e.key) {
7138
7237
  case "ArrowRight":
7139
- case "ArrowDown":
7238
+ case "ArrowDown": {
7140
7239
  e.preventDefault();
7141
7240
  const nextIndex = (currentIndex + 1) % themes.length;
7142
7241
  handleThemeSelect(themes[nextIndex]);
7143
7242
  break;
7243
+ }
7144
7244
  case "ArrowLeft":
7145
- case "ArrowUp":
7245
+ case "ArrowUp": {
7146
7246
  e.preventDefault();
7147
7247
  const prevIndex = currentIndex <= 0 ? themes.length - 1 : currentIndex - 1;
7148
7248
  handleThemeSelect(themes[prevIndex]);
7149
7249
  break;
7250
+ }
7150
7251
  }
7151
7252
  };
7152
7253
  return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
@@ -8685,11 +8786,13 @@ exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
8685
8786
  exports.DropdownMenuTrigger = DropdownMenuTrigger;
8686
8787
  exports.FileView = FileView;
8687
8788
  exports.FilterPopover = FilterPopover;
8789
+ exports.GREEN_THEME = GREEN_THEME;
8688
8790
  exports.HeaderCell = HeaderCell;
8689
8791
  exports.HtmlRenderer = HtmlRenderer;
8690
8792
  exports.IconButton = IconButton;
8691
8793
  exports.ImageRenderer = ImageRenderer;
8692
8794
  exports.Input = Input;
8795
+ exports.LEGACY_THEME_ID_MAP = LEGACY_THEME_ID_MAP;
8693
8796
  exports.Label = Label;
8694
8797
  exports.LoadingSpinner = LoadingSpinner;
8695
8798
  exports.MINIMALIST_LIGHT_THEME = MINIMALIST_LIGHT_THEME;
@@ -8701,6 +8804,7 @@ exports.ModalButton = ModalButton;
8701
8804
  exports.MultiSelect = MultiSelect;
8702
8805
  exports.OPTILOGIC_DARK_THEME = OPTILOGIC_DARK_THEME;
8703
8806
  exports.OPTILOGIC_LEGACY_THEME = OPTILOGIC_LEGACY_THEME;
8807
+ exports.OPTILOGIC_LIGHT_THEME = OPTILOGIC_LIGHT_THEME;
8704
8808
  exports.OptilogicLogo = OptilogicLogo;
8705
8809
  exports.OptilogicLogoWithText = OptilogicLogoWithText;
8706
8810
  exports.PRESET_THEMES = PRESET_THEMES;