@optilogic/core 1.0.0-beta.16 → 1.0.0-beta.18

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
@@ -67,17 +67,17 @@ function cn(...inputs) {
67
67
  return tailwindMerge.twMerge(clsx.clsx(inputs));
68
68
  }
69
69
  var buttonVariants = classVarianceAuthority.cva(
70
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
70
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
71
71
  {
72
72
  variants: {
73
73
  variant: {
74
- default: "bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground",
75
- primary: "bg-accent text-accent-foreground shadow hover:shadow-md",
76
- destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 hover:shadow-md",
77
- outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
78
- secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
79
- ghost: "hover:bg-accent hover:text-accent-foreground",
80
- link: "text-primary underline-offset-4 hover:underline"
74
+ default: "bg-muted text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:text-muted-foreground",
75
+ primary: "bg-accent text-accent-foreground shadow hover:shadow-md disabled:opacity-50",
76
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 hover:shadow-md disabled:opacity-50",
77
+ outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:bg-muted/20 disabled:text-muted-foreground",
78
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 disabled:opacity-50",
79
+ ghost: "text-foreground hover:bg-accent hover:text-accent-foreground disabled:text-muted-foreground disabled:bg-muted/30 disabled:opacity-70",
80
+ link: "text-primary underline-offset-4 hover:underline disabled:opacity-50 disabled:text-muted-foreground"
81
81
  },
82
82
  size: {
83
83
  default: "h-9 px-4 py-2",
@@ -113,7 +113,7 @@ var Input = React20__namespace.forwardRef(
113
113
  {
114
114
  type,
115
115
  className: cn(
116
- "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
116
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground hover:border-input-hover focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-input md:text-sm",
117
117
  className
118
118
  ),
119
119
  ref,
@@ -141,7 +141,7 @@ var Textarea = React20__namespace.forwardRef(
141
141
  "textarea",
142
142
  {
143
143
  className: cn(
144
- "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
144
+ "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground hover:border-input-hover focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-input md:text-sm",
145
145
  className
146
146
  ),
147
147
  ref,
@@ -229,9 +229,11 @@ var Switch = React20__namespace.forwardRef(({ className, ...props }, ref) => /*
229
229
  // Focus styles
230
230
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
231
231
  // Disabled styles
232
- "disabled:cursor-not-allowed disabled:opacity-50",
232
+ "disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-muted",
233
233
  // Unchecked state
234
- "bg-input",
234
+ "bg-toggle-track",
235
+ // Hover
236
+ "hover:bg-toggle-track/80 data-[state=checked]:hover:bg-primary/80",
235
237
  // Checked state
236
238
  "data-[state=checked]:bg-primary",
237
239
  className
@@ -244,7 +246,7 @@ var Switch = React20__namespace.forwardRef(({ className, ...props }, ref) => /*
244
246
  className: cn(
245
247
  // Base styles
246
248
  "pointer-events-none block h-4 w-4 rounded-full",
247
- "bg-background shadow-lg ring-0",
249
+ "bg-toggle-track-foreground shadow-lg ring-0",
248
250
  "transition-transform",
249
251
  // Position based on state
250
252
  "data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
@@ -307,7 +309,7 @@ var SelectTrigger = React20__namespace.forwardRef(({ className, children, ...pro
307
309
  {
308
310
  ref,
309
311
  className: cn(
310
- "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
312
+ "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground hover:border-input-hover focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-input [&>span]:line-clamp-1",
311
313
  className
312
314
  ),
313
315
  ...props,
@@ -643,7 +645,7 @@ var PopoverContent = React20__namespace.forwardRef(({ className, align = "center
643
645
  align,
644
646
  sideOffset,
645
647
  className: cn(
646
- "z-50 w-72 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md outline-none",
648
+ "z-50 w-auto max-w-[90vw] rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md outline-none",
647
649
  // Animation
648
650
  "data-[state=open]:animate-in data-[state=closed]:animate-out",
649
651
  "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
@@ -704,7 +706,7 @@ var DropdownMenuContent = React20__namespace.forwardRef(({ className, sideOffset
704
706
  ref,
705
707
  sideOffset,
706
708
  className: cn(
707
- "z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md",
709
+ "z-50 min-w-[8rem] max-w-[90vw] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md",
708
710
  "data-[state=open]:animate-in data-[state=closed]:animate-out",
709
711
  "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
710
712
  "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
@@ -2741,19 +2743,19 @@ function Calendar({
2741
2743
  className: cn("p-3", className),
2742
2744
  classNames: {
2743
2745
  months: "flex flex-col sm:flex-row gap-4",
2744
- month: "flex flex-col gap-4",
2745
- month_caption: "flex justify-center pt-1 relative items-center h-7 px-10",
2746
+ month: "flex flex-col gap-2 relative px-8",
2747
+ month_caption: "flex justify-center pt-1 items-center h-7",
2746
2748
  caption_label: "text-sm font-medium hidden",
2747
2749
  nav: "flex items-center gap-1",
2748
2750
  button_previous: cn(
2749
2751
  buttonVariants({ variant: "outline" }),
2750
- "absolute left-1 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"
2752
+ "absolute left-1 top-1/2 -translate-y-1/2 h-6 w-6 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"
2751
2753
  ),
2752
2754
  button_next: cn(
2753
2755
  buttonVariants({ variant: "outline" }),
2754
- "absolute right-1 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"
2756
+ "absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"
2755
2757
  ),
2756
- month_grid: "w-full border-collapse px-1",
2758
+ month_grid: "border-collapse mx-auto",
2757
2759
  weekdays: "flex",
2758
2760
  weekday: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
2759
2761
  week: "flex w-full mt-2",
@@ -2778,12 +2780,12 @@ function Calendar({
2778
2780
  components: {
2779
2781
  Chevron: ({ orientation }) => {
2780
2782
  const Icon2 = orientation === "left" ? lucideReact.ChevronLeft : lucideReact.ChevronRight;
2781
- return /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "h-4 w-4" });
2783
+ return /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "h-3.5 w-3.5" });
2782
2784
  },
2783
2785
  MonthCaption: ({ calendarMonth }) => {
2784
2786
  const month = calendarMonth.date.getMonth();
2785
2787
  const year = calendarMonth.date.getFullYear();
2786
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-1 px-10", children: [
2788
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-1", children: [
2787
2789
  /* @__PURE__ */ jsxRuntime.jsxs(
2788
2790
  Select,
2789
2791
  {
@@ -3019,8 +3021,9 @@ function DatePickerInput({
3019
3021
  {
3020
3022
  className: cn(
3021
3023
  "flex items-center rounded-md border border-input bg-background ring-offset-background",
3024
+ "hover:border-input-hover",
3022
3025
  "focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
3023
- disabled && "opacity-50 cursor-not-allowed",
3026
+ disabled && "opacity-50 cursor-not-allowed hover:border-input",
3024
3027
  sizeClasses[size]
3025
3028
  ),
3026
3029
  children: [
@@ -3652,7 +3655,7 @@ function CellEditor({
3652
3655
  onKeyDown: handleKeyDown,
3653
3656
  onBlur: handleBlur,
3654
3657
  className: cn(
3655
- "h-full w-full border-0 rounded-none focus:ring-2 focus:ring-primary text-sm px-2",
3658
+ "h-full w-full border-0 rounded-none bg-background focus:ring-0 text-sm px-2",
3656
3659
  validationError && "ring-2 ring-destructive focus:ring-destructive",
3657
3660
  className
3658
3661
  ),
@@ -3670,7 +3673,7 @@ function CellEditor({
3670
3673
  onKeyDown: handleKeyDown,
3671
3674
  onBlur: handleBlur,
3672
3675
  className: cn(
3673
- "h-full w-full border-0 rounded-none focus:ring-2 focus:ring-primary text-sm px-2",
3676
+ "h-full w-full border-0 rounded-none bg-background focus:ring-0 text-sm px-2",
3674
3677
  validationError && "ring-2 ring-destructive focus:ring-destructive",
3675
3678
  className
3676
3679
  ),
@@ -3740,7 +3743,7 @@ function CellEditor({
3740
3743
  {
3741
3744
  ref: selectRef,
3742
3745
  className: cn(
3743
- "h-full w-full border-0 rounded-none focus:ring-2 focus:ring-primary text-sm",
3746
+ "h-full w-full border-0 rounded-none bg-background focus:ring-0 text-sm",
3744
3747
  validationError && "ring-2 ring-destructive focus:ring-destructive",
3745
3748
  className
3746
3749
  ),
@@ -3885,6 +3888,7 @@ function useDataGridState(options) {
3885
3888
  const [internalColumnWidths, setInternalColumnWidths] = React20.useState(defaultColumnWidths);
3886
3889
  const [internalFocusedCell, setInternalFocusedCell] = React20.useState(null);
3887
3890
  const [editingCell, setEditingCell] = React20.useState(null);
3891
+ const processedDataRef = React20.useRef([]);
3888
3892
  const sorting = isControlled.sorting ? controlledSorting : internalSorting;
3889
3893
  const filters = isControlled.filters ? controlledFilters : internalFilters;
3890
3894
  const focusedCell = isControlled.focusedCell ? controlledFocusedCell : internalFocusedCell;
@@ -4005,7 +4009,8 @@ function useDataGridState(options) {
4005
4009
  }
4006
4010
  const column = columns.find((c) => c.key === columnKey);
4007
4011
  if (!column || !column.editable) return;
4008
- const row = data[rowIndex];
4012
+ const resolvedData = processedDataRef.current.length > 0 ? processedDataRef.current : data;
4013
+ const row = resolvedData[rowIndex];
4009
4014
  if (!row) return;
4010
4015
  const value = getCellValue2(row, column);
4011
4016
  setEditingCell({
@@ -4027,7 +4032,8 @@ function useDataGridState(options) {
4027
4032
  const value = valueOverride !== void 0 ? valueOverride : editingCell.value;
4028
4033
  const column = columns.find((c) => c.key === columnKey);
4029
4034
  if (column?.validator) {
4030
- const row = data[rowIndex];
4035
+ const resolvedData = processedDataRef.current.length > 0 ? processedDataRef.current : data;
4036
+ const row = resolvedData[rowIndex];
4031
4037
  const validationResult = column.validator(value, row);
4032
4038
  if (validationResult !== true && typeof validationResult === "string") {
4033
4039
  return;
@@ -4059,6 +4065,7 @@ function useDataGridState(options) {
4059
4065
  commitEdit,
4060
4066
  cancelEdit
4061
4067
  },
4068
+ processedDataRef,
4062
4069
  isControlled
4063
4070
  };
4064
4071
  }
@@ -4512,16 +4519,44 @@ function applySorting(data, sorting, columns) {
4512
4519
  if (aVal == null) return sort.direction === "asc" ? 1 : -1;
4513
4520
  if (bVal == null) return sort.direction === "asc" ? -1 : 1;
4514
4521
  let comparison = 0;
4515
- if (typeof aVal === "string" && typeof bVal === "string") {
4516
- comparison = aVal.localeCompare(bVal);
4517
- } else if (typeof aVal === "number" && typeof bVal === "number") {
4518
- comparison = aVal - bVal;
4519
- } else if (aVal instanceof Date && bVal instanceof Date) {
4520
- comparison = aVal.getTime() - bVal.getTime();
4521
- } else if (typeof aVal === "boolean" && typeof bVal === "boolean") {
4522
- comparison = aVal === bVal ? 0 : aVal ? 1 : -1;
4523
- } else {
4522
+ if (column.dataType === "number") {
4523
+ const aNum = Number(aVal);
4524
+ const bNum = Number(bVal);
4525
+ if (!isNaN(aNum) && !isNaN(bNum)) {
4526
+ comparison = aNum - bNum;
4527
+ } else {
4528
+ comparison = String(aVal).localeCompare(String(bVal));
4529
+ }
4530
+ } else if (column.dataType === "date") {
4531
+ const aDate = aVal instanceof Date ? aVal : new Date(aVal);
4532
+ const bDate = bVal instanceof Date ? bVal : new Date(bVal);
4533
+ const aTime = isNaN(aDate.getTime()) ? 0 : aDate.getTime();
4534
+ const bTime = isNaN(bDate.getTime()) ? 0 : bDate.getTime();
4535
+ comparison = aTime - bTime;
4536
+ } else if (column.dataType === "boolean") {
4537
+ const aBool = aVal === true || aVal === "true" || aVal === 1;
4538
+ const bBool = bVal === true || bVal === "true" || bVal === 1;
4539
+ comparison = aBool === bBool ? 0 : aBool ? 1 : -1;
4540
+ } else if (column.dataType === "string") {
4524
4541
  comparison = String(aVal).localeCompare(String(bVal));
4542
+ } else {
4543
+ if (typeof aVal === "number" && typeof bVal === "number") {
4544
+ comparison = aVal - bVal;
4545
+ } else if (aVal instanceof Date && bVal instanceof Date) {
4546
+ comparison = aVal.getTime() - bVal.getTime();
4547
+ } else if (typeof aVal === "boolean" && typeof bVal === "boolean") {
4548
+ comparison = aVal === bVal ? 0 : aVal ? 1 : -1;
4549
+ } else {
4550
+ const aStr = String(aVal);
4551
+ const bStr = String(bVal);
4552
+ const aNum = Number(aStr);
4553
+ const bNum = Number(bStr);
4554
+ if (!isNaN(aNum) && !isNaN(bNum) && aStr !== "" && bStr !== "") {
4555
+ comparison = aNum - bNum;
4556
+ } else {
4557
+ comparison = aStr.localeCompare(bStr);
4558
+ }
4559
+ }
4525
4560
  }
4526
4561
  return sort.direction === "asc" ? comparison : -comparison;
4527
4562
  });
@@ -4743,7 +4778,7 @@ function DataGrid({
4743
4778
  },
4744
4779
  []
4745
4780
  );
4746
- const { state, actions, isControlled } = useDataGridState({
4781
+ const { state, actions, processedDataRef, isControlled } = useDataGridState({
4747
4782
  sorting: controlledSorting,
4748
4783
  filters: controlledFilters,
4749
4784
  columnWidths: controlledColumnWidths,
@@ -4782,6 +4817,7 @@ function DataGrid({
4782
4817
  state.sorting,
4783
4818
  visibleColumns
4784
4819
  ]);
4820
+ processedDataRef.current = processedData;
4785
4821
  const { resizingColumn, getResizeProps } = useColumnResizeManager({
4786
4822
  columns: visibleColumns,
4787
4823
  columnWidths: state.columnWidths,
@@ -5117,6 +5153,7 @@ function DataGrid({
5117
5153
  "flex-shrink-0 px-3 py-2 text-sm overflow-hidden",
5118
5154
  showColumnBorders && "border-r border-border last:border-r-0",
5119
5155
  isFocused && !isEditingThisCell && "ring-2 ring-inset ring-primary",
5156
+ isEditingThisCell && "ring-2 ring-inset ring-primary bg-background",
5120
5157
  column.align === "center" && "text-center",
5121
5158
  column.align === "right" && "text-right"
5122
5159
  ),
@@ -5286,6 +5323,7 @@ function DataGrid({
5286
5323
  "flex-shrink-0 px-3 py-2 text-sm overflow-hidden",
5287
5324
  showColumnBorders && "border-r border-border last:border-r-0",
5288
5325
  isFocused && !isEditingThisCell && "ring-2 ring-inset ring-primary",
5326
+ isEditingThisCell && "ring-2 ring-inset ring-primary bg-background",
5289
5327
  column.align === "center" && "text-center",
5290
5328
  column.align === "right" && "text-right"
5291
5329
  ),
@@ -5541,8 +5579,9 @@ function Autocomplete({
5541
5579
  disabled,
5542
5580
  className: cn(
5543
5581
  "flex h-9 w-full items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background",
5582
+ "hover:border-input-hover",
5544
5583
  "focus:outline-none focus:ring-1 focus:ring-ring",
5545
- "disabled:cursor-not-allowed disabled:opacity-50",
5584
+ "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-input",
5546
5585
  !selectedOption && "text-muted-foreground",
5547
5586
  className
5548
5587
  ),
@@ -5773,6 +5812,9 @@ var GREEN_THEME = {
5773
5812
  border: "#243630",
5774
5813
  input: "#243630",
5775
5814
  ring: "#6FCF97",
5815
+ toggleTrack: "#354840",
5816
+ toggleTrackForeground: "#E6F5EC",
5817
+ inputHover: "#6FCF97",
5776
5818
  chart1: "#6FCF97",
5777
5819
  chart2: "#8FE3B0",
5778
5820
  chart3: "#9DB8A8",
@@ -5808,8 +5850,11 @@ var OPTILOGIC_LEGACY_THEME = {
5808
5850
  chip: "#B8C5F9",
5809
5851
  chipForeground: "#0C0A5A",
5810
5852
  border: "#D0D0D0",
5811
- input: "#FFFFFF",
5853
+ input: "#D0D0D0",
5812
5854
  ring: "#5766F2",
5855
+ toggleTrack: "#D0D0D0",
5856
+ toggleTrackForeground: "#FFFFFF",
5857
+ inputHover: "#5766F2",
5813
5858
  chart1: "#78D237",
5814
5859
  chart2: "#F5CF47",
5815
5860
  chart3: "#5766F2",
@@ -5847,6 +5892,9 @@ var FUTURISTIC_THEME = {
5847
5892
  border: "#1e293b",
5848
5893
  input: "#1e293b",
5849
5894
  ring: "#6366f1",
5895
+ toggleTrack: "#334155",
5896
+ toggleTrackForeground: "#e0e7ff",
5897
+ inputHover: "#6366f1",
5850
5898
  chart1: "#6366f1",
5851
5899
  chart2: "#8b5cf6",
5852
5900
  chart3: "#a855f7",
@@ -5884,6 +5932,9 @@ var NATURE_THEME = {
5884
5932
  border: "#243824",
5885
5933
  input: "#243824",
5886
5934
  ring: "#4caf50",
5935
+ toggleTrack: "#3d5a3d",
5936
+ toggleTrackForeground: "#e8f5e9",
5937
+ inputHover: "#4caf50",
5887
5938
  chart1: "#4caf50",
5888
5939
  chart2: "#66bb6a",
5889
5940
  chart3: "#81c784",
@@ -5921,6 +5972,9 @@ var SCIFI_THEME = {
5921
5972
  border: "#30363d",
5922
5973
  input: "#21262d",
5923
5974
  ring: "#00d9ff",
5975
+ toggleTrack: "#30363d",
5976
+ toggleTrackForeground: "#c9d1d9",
5977
+ inputHover: "#00d9ff",
5924
5978
  chart1: "#00d9ff",
5925
5979
  chart2: "#ff00ff",
5926
5980
  chart3: "#00ff88",
@@ -5958,6 +6012,9 @@ var OCEAN_THEME = {
5958
6012
  border: "#1e3a5f",
5959
6013
  input: "#1e3a5f",
5960
6014
  ring: "#2196f3",
6015
+ toggleTrack: "#264a6e",
6016
+ toggleTrackForeground: "#e3f2fd",
6017
+ inputHover: "#2196f3",
5961
6018
  chart1: "#2196f3",
5962
6019
  chart2: "#00bcd4",
5963
6020
  chart3: "#03a9f4",
@@ -5995,6 +6052,9 @@ var SUNSET_THEME = {
5995
6052
  border: "#241424",
5996
6053
  input: "#241424",
5997
6054
  ring: "#ff6b35",
6055
+ toggleTrack: "#3d2a3d",
6056
+ toggleTrackForeground: "#ffe0e6",
6057
+ inputHover: "#ff6b35",
5998
6058
  chart1: "#ff6b35",
5999
6059
  chart2: "#c44569",
6000
6060
  chart3: "#f7931e",
@@ -6032,6 +6092,9 @@ var FOREST_THEME = {
6032
6092
  border: "#1b5e20",
6033
6093
  input: "#1a2e1a",
6034
6094
  ring: "#2e7d32",
6095
+ toggleTrack: "#2d4a2d",
6096
+ toggleTrackForeground: "#e8f5e9",
6097
+ inputHover: "#2e7d32",
6035
6098
  chart1: "#2e7d32",
6036
6099
  chart2: "#388e3c",
6037
6100
  chart3: "#43a047",
@@ -6069,6 +6132,9 @@ var CYBERPUNK_THEME = {
6069
6132
  border: "#1a1a2e",
6070
6133
  input: "#16213e",
6071
6134
  ring: "#ff00ff",
6135
+ toggleTrack: "#2a2a4e",
6136
+ toggleTrackForeground: "#f0f0f0",
6137
+ inputHover: "#ff00ff",
6072
6138
  chart1: "#ff00ff",
6073
6139
  chart2: "#00ffff",
6074
6140
  chart3: "#00ff88",
@@ -6104,8 +6170,11 @@ var MINIMALIST_LIGHT_THEME = {
6104
6170
  chip: "#e9ecef",
6105
6171
  chipForeground: "#495057",
6106
6172
  border: "#dee2e6",
6107
- input: "#ffffff",
6173
+ input: "#dee2e6",
6108
6174
  ring: "#000000",
6175
+ toggleTrack: "#ced4da",
6176
+ toggleTrackForeground: "#ffffff",
6177
+ inputHover: "#6c757d",
6109
6178
  chart1: "#000000",
6110
6179
  chart2: "#6c757d",
6111
6180
  chart3: "#adb5bd",
@@ -6143,6 +6212,9 @@ var DARK_ELEGANT_THEME = {
6143
6212
  border: "#2d2d2d",
6144
6213
  input: "#1e1e1e",
6145
6214
  ring: "#bb86fc",
6215
+ toggleTrack: "#3d3d3d",
6216
+ toggleTrackForeground: "#e0e0e0",
6217
+ inputHover: "#bb86fc",
6146
6218
  chart1: "#bb86fc",
6147
6219
  chart2: "#03dac6",
6148
6220
  chart3: "#4caf50",
@@ -6233,6 +6305,9 @@ function themeToHsl(theme) {
6233
6305
  border: hexToHsl(theme.border),
6234
6306
  input: hexToHsl(theme.input),
6235
6307
  ring: hexToHsl(theme.ring),
6308
+ toggleTrack: theme.toggleTrack ? hexToHsl(theme.toggleTrack) : void 0,
6309
+ toggleTrackForeground: theme.toggleTrackForeground ? hexToHsl(theme.toggleTrackForeground) : void 0,
6310
+ inputHover: theme.inputHover ? hexToHsl(theme.inputHover) : void 0,
6236
6311
  chart1: hexToHsl(theme.chart1),
6237
6312
  chart2: hexToHsl(theme.chart2),
6238
6313
  chart3: hexToHsl(theme.chart3),
@@ -6240,6 +6315,15 @@ function themeToHsl(theme) {
6240
6315
  chart5: hexToHsl(theme.chart5)
6241
6316
  };
6242
6317
  }
6318
+ function deriveInputHoverHsl(hslTheme) {
6319
+ const parts = hslTheme.foreground.split(/\s+/);
6320
+ if (parts.length >= 3) {
6321
+ const h = parts[0];
6322
+ const s = parts[1];
6323
+ return `${h} ${s} 50%`;
6324
+ }
6325
+ return hslTheme.foreground;
6326
+ }
6243
6327
  function applyTheme(theme, targetElement) {
6244
6328
  const element = targetElement || document.documentElement;
6245
6329
  const hslTheme = themeToHsl(theme);
@@ -6274,11 +6358,26 @@ function applyTheme(theme, targetElement) {
6274
6358
  element.style.setProperty("--border", hslTheme.border);
6275
6359
  element.style.setProperty("--input", hslTheme.input);
6276
6360
  element.style.setProperty("--ring", hslTheme.ring);
6361
+ element.style.setProperty(
6362
+ "--toggle-track",
6363
+ hslTheme.toggleTrack ?? hslTheme.muted
6364
+ );
6365
+ element.style.setProperty(
6366
+ "--toggle-track-foreground",
6367
+ hslTheme.toggleTrackForeground ?? hslTheme.background
6368
+ );
6369
+ element.style.setProperty(
6370
+ "--input-hover",
6371
+ hslTheme.inputHover ?? deriveInputHoverHsl(hslTheme)
6372
+ );
6277
6373
  element.style.setProperty("--chart-1", hslTheme.chart1);
6278
6374
  element.style.setProperty("--chart-2", hslTheme.chart2);
6279
6375
  element.style.setProperty("--chart-3", hslTheme.chart3);
6280
6376
  element.style.setProperty("--chart-4", hslTheme.chart4);
6281
6377
  element.style.setProperty("--chart-5", hslTheme.chart5);
6378
+ if (theme.disabledOpacity) {
6379
+ element.style.setProperty("--disabled-opacity", theme.disabledOpacity);
6380
+ }
6282
6381
  if (theme.radius) {
6283
6382
  element.style.setProperty("--radius", theme.radius);
6284
6383
  }
@@ -6369,6 +6468,9 @@ function areThemesEqual(theme1, theme2) {
6369
6468
  "border",
6370
6469
  "input",
6371
6470
  "ring",
6471
+ "toggleTrack",
6472
+ "toggleTrackForeground",
6473
+ "inputHover",
6372
6474
  "chart1",
6373
6475
  "chart2",
6374
6476
  "chart3",
@@ -7549,7 +7651,7 @@ function HtmlRenderer({
7549
7651
  "iframe",
7550
7652
  {
7551
7653
  srcDoc: content ?? "",
7552
- sandbox: "",
7654
+ sandbox: "allow-scripts",
7553
7655
  title: fileName,
7554
7656
  className: cn("h-full w-full border-0", className)
7555
7657
  }