@ramme-io/ui 5.1.0 → 5.3.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/README.md CHANGED
@@ -216,7 +216,7 @@ Props, variants and live examples are in Storybook (`pnpm run storybook`) and at
216
216
  | `KeyInjectionOverlay` | `@molecule/ai/key-injection-overlay` | Blocks the app and collects an AI provider key when the gateway reports one is missing or expired. |
217
217
  | `KpiGrid` | `@atom/templates-patterns/kpi-grid` | A framework-level abstraction that takes raw data and metric configurations to auto-calculate values and render a grid of StatCards. |
218
218
  | `Label` | `@molecule/form/label` | The accessible caption for a form control. |
219
- | `LineChart` | `@atom/charts/line-chart` | A theme-aware line chart component... |
219
+ | `LineChart` | `@atom/charts/line-chart` | A theme-aware line chart component for one or more series over a shared x-axis. |
220
220
  | `Loader` | `@molecule/ai/loader` | A compact, theme-aware animation for indicating AI processing states. |
221
221
  | `LoginPage` | `@atom/auth/login-page` | The standard sign-in screen — email and password, with inline error and loading states already wired. |
222
222
  | `Menu` | `@atom/primitive/menu` | A dropdown menu component, useful for navigation or contextual actions. |
@@ -7,14 +7,29 @@ export interface LineChartProps {
7
7
  lineKeys: string[];
8
8
  colors?: string[];
9
9
  connectNulls?: boolean;
10
+ /** Draw a dot on every point. Turn off for long or many series, where dots hide the lines. */
11
+ dot?: boolean;
12
+ /** Series keys to draw thicker than the rest: the line a reader should follow. */
13
+ emphasis?: string[];
14
+ /** Series keys drawn dotted: a reference level rather than a measurement, such as a long-run average. */
15
+ dashed?: string[];
10
16
  xAxisProps?: XAxisProps;
11
17
  yAxisProps?: YAxisProps;
12
18
  }
13
19
  /**
14
20
  * @wizard
15
21
  * @name LineChart
16
- * @description A theme-aware line chart component...
22
+ * @description A theme-aware line chart component for one or more series over a shared x-axis. Set `dot={false}` for long or many series, `emphasis` to draw the series a reader should follow thicker, and `dashed` for a reference level such as a long-run average.
17
23
  * @tags charts, data-visualization, rechart
24
+ * @param {any[]} data - One object per x value, with a key per series.
25
+ * @param {string} dataKeyX - The key holding the x value.
26
+ * @param {string[]} lineKeys - The keys of the series to draw.
27
+ * @param {string[]} colors - Stroke colours by series order; defaults to the theme's chart palette.
28
+ * @param {boolean} dot - Draw a dot on every point (default true).
29
+ * @param {string[]} emphasis - Series keys drawn thicker than the rest.
30
+ * @param {string[]} dashed - Series keys drawn dotted, for a reference level such as a long-run average.
31
+ * @param {XAxisProps} xAxisProps - Passed to the x-axis: label, domain, tick formatter.
32
+ * @param {YAxisProps} yAxisProps - Passed to the y-axis: label, domain, tick formatter.
18
33
  * @category charts
19
34
  * @id line-chart
20
35
  */
@@ -1,58 +1,63 @@
1
- import { jsx as t, jsxs as g } from "react/jsx-runtime";
2
- import { ResponsiveContainer as u, LineChart as C, CartesianGrid as x, XAxis as k, YAxis as y, Tooltip as b, Legend as L, Line as v } from "recharts";
3
- import { useChartTheme as S } from "../../lib/hooks/useChartTheme.js";
4
- const A = ({
5
- data: r,
6
- dataKeyX: s,
7
- lineKeys: i,
8
- colors: o,
9
- connectNulls: h = !0,
10
- xAxisProps: d,
11
- yAxisProps: c
1
+ import { jsx as t, jsxs as x } from "react/jsx-runtime";
2
+ import { ResponsiveContainer as k, LineChart as y, CartesianGrid as b, XAxis as v, YAxis as L, Tooltip as S, Legend as j, Line as w } from "recharts";
3
+ import { useChartTheme as D } from "../../lib/hooks/useChartTheme.js";
4
+ const T = ({
5
+ data: o,
6
+ dataKeyX: h,
7
+ lineKeys: l,
8
+ colors: i,
9
+ connectNulls: d = !0,
10
+ dot: n = !0,
11
+ emphasis: c = [],
12
+ dashed: m = [],
13
+ xAxisProps: p,
14
+ yAxisProps: u
12
15
  }) => {
13
- const { textColor: e, gridColor: l, tooltipBg: m, palette: p } = S(), n = o && o.length > 0 ? o : p;
14
- return !r || r.length === 0 ? /* @__PURE__ */ t("div", { className: "flex h-full w-full items-center justify-center", children: /* @__PURE__ */ t("p", { className: "text-sm text-muted-foreground", children: "No data to display" }) }) : /* @__PURE__ */ t(u, { width: "100%", height: "100%", children: /* @__PURE__ */ g(C, { data: r, margin: { top: 5, right: 20, left: 0, bottom: 5 }, children: [
15
- /* @__PURE__ */ t(x, { strokeDasharray: "3 3", stroke: l }),
16
+ const { textColor: e, gridColor: a, tooltipBg: f, palette: g } = D(), s = i && i.length > 0 ? i : g;
17
+ return !o || o.length === 0 ? /* @__PURE__ */ t("div", { className: "flex h-full w-full items-center justify-center", children: /* @__PURE__ */ t("p", { className: "text-sm text-muted-foreground", children: "No data to display" }) }) : /* @__PURE__ */ t(k, { width: "100%", height: "100%", children: /* @__PURE__ */ x(y, { data: o, margin: { top: 5, right: 20, left: 0, bottom: 5 }, children: [
18
+ /* @__PURE__ */ t(b, { strokeDasharray: "3 3", stroke: a }),
16
19
  /* @__PURE__ */ t(
17
- k,
20
+ v,
18
21
  {
19
- dataKey: s,
22
+ dataKey: h,
20
23
  stroke: e,
21
24
  tick: { fill: e },
22
- ...d
25
+ ...p
23
26
  }
24
27
  ),
25
28
  /* @__PURE__ */ t(
26
- y,
29
+ L,
27
30
  {
28
31
  stroke: e,
29
32
  tick: { fill: e },
30
- ...c
33
+ ...u
31
34
  }
32
35
  ),
33
36
  /* @__PURE__ */ t(
34
- b,
37
+ S,
35
38
  {
36
- contentStyle: { backgroundColor: m, borderColor: l, borderRadius: "0.5rem" },
39
+ contentStyle: { backgroundColor: f, borderColor: a, borderRadius: "0.5rem" },
37
40
  itemStyle: { color: e },
38
41
  labelStyle: { color: e, fontWeight: "bold" }
39
42
  }
40
43
  ),
41
- i.length > 1 && /* @__PURE__ */ t(L, { wrapperStyle: { color: e } }),
42
- i.map((a, f) => /* @__PURE__ */ t(
43
- v,
44
+ l.length > 1 && /* @__PURE__ */ t(j, { wrapperStyle: { color: e } }),
45
+ l.map((r, C) => /* @__PURE__ */ t(
46
+ w,
44
47
  {
45
48
  type: "monotone",
46
- dataKey: a,
47
- stroke: n[f % n.length],
48
- strokeWidth: 2,
49
- activeDot: { r: 8 },
50
- connectNulls: h
49
+ dataKey: r,
50
+ stroke: s[C % s.length],
51
+ strokeWidth: c.includes(r) ? 3.5 : 2,
52
+ strokeDasharray: m.includes(r) ? "2 4" : void 0,
53
+ dot: n,
54
+ activeDot: { r: n ? 8 : 4 },
55
+ connectNulls: d
51
56
  },
52
- a
57
+ r
53
58
  ))
54
59
  ] }) });
55
60
  };
56
61
  export {
57
- A as LineChart
62
+ T as LineChart
58
63
  };
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { IconName } from '../ui/Icon';
3
+ import { type ThemeMode } from '../../contexts/ThemeContext';
3
4
  /**
4
5
  * @wizard
5
6
  * @name UserNav
@@ -12,6 +13,7 @@ import { IconName } from '../ui/Icon';
12
13
  * @param {function} onSettings - Called when the user chooses settings.
13
14
  * @param {function} onProfile - Called when the user chooses profile.
14
15
  * @param {boolean} showThemeToggle - Adds a theme switcher inside the menu.
16
+ * @param {ThemeMode[]} themeOptions - The themes the switcher offers, in order. Defaults to light, dark and system; an app with its own theme names it here (the terminal: markets, light, dark, system), or a viewer who taps another can never get back to it.
15
17
  * @param {ReactNode} trigger - Replaces the default avatar trigger.
16
18
  * @param {string} align - Menu alignment against the trigger: 'start', 'center', or 'end'.
17
19
  * @param {string} side - Which side the menu opens on: 'top', 'bottom', 'left', or 'right'.
@@ -32,6 +34,8 @@ export interface UserNavProps {
32
34
  onSettings?: () => void;
33
35
  onProfile?: () => void;
34
36
  showThemeToggle?: boolean;
37
+ /** The themes the switcher offers, in order. Defaults to light, dark, system. */
38
+ themeOptions?: ThemeMode[];
35
39
  children?: React.ReactNode;
36
40
  }
37
41
  /**
@@ -1,18 +1,18 @@
1
1
  import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
- import { useState as z, useRef as E, useEffect as I } from "react";
3
- import { Avatar as L } from "../ui/Avatar.js";
4
- import { Icon as O } from "../ui/Icon.js";
2
+ import { useState as O, useRef as I, useEffect as L } from "react";
3
+ import { Avatar as z } from "../ui/Avatar.js";
4
+ import { Icon as U } from "../ui/Icon.js";
5
5
  import { cn as o } from "../../utils/cn.js";
6
6
  import { useTheme as j } from "../../contexts/ThemeContext.js";
7
- const R = () => {
8
- const { theme: t, setTheme: l } = j();
9
- return /* @__PURE__ */ e("div", { className: "flex bg-muted/50 rounded-md p-0.5 gap-0.5", children: ["light", "dark", "system"].map((r) => /* @__PURE__ */ e(
7
+ const A = ["light", "dark", "system"], M = ({ options: t }) => {
8
+ const { theme: l, setTheme: a } = j();
9
+ return /* @__PURE__ */ e("div", { className: "flex bg-muted/50 rounded-md p-0.5 gap-0.5", children: t.map((r) => /* @__PURE__ */ e(
10
10
  "button",
11
11
  {
12
- onClick: () => l(r),
12
+ onClick: () => a(r),
13
13
  className: o(
14
14
  "flex-1 text-[10px] py-1 rounded-sm capitalize font-medium transition-colors",
15
- t === r ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground hover:bg-muted/80"
15
+ l === r ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground hover:bg-muted/80"
16
16
  ),
17
17
  children: r
18
18
  },
@@ -23,7 +23,7 @@ const R = () => {
23
23
  label: l,
24
24
  onClick: a,
25
25
  variant: r = "default",
26
- className: m
26
+ className: i
27
27
  }) => /* @__PURE__ */ n(
28
28
  "button",
29
29
  {
@@ -31,30 +31,31 @@ const R = () => {
31
31
  className: o(
32
32
  "relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
33
33
  r === "destructive" ? "text-destructive hover:bg-destructive/10" : "text-foreground hover:bg-accent hover:text-accent-foreground",
34
- m
34
+ i
35
35
  ),
36
36
  children: [
37
- /* @__PURE__ */ e(O, { name: t, className: "mr-2 h-4 w-4" }),
37
+ /* @__PURE__ */ e(U, { name: t, className: "mr-2 h-4 w-4" }),
38
38
  /* @__PURE__ */ e("span", { children: l })
39
39
  ]
40
40
  }
41
- ), D = ({
41
+ ), H = ({
42
42
  user: t,
43
43
  trigger: l,
44
44
  align: a = "end",
45
45
  side: r = "bottom",
46
- className: m,
46
+ className: i,
47
47
  onLogout: h,
48
48
  onSettings: c,
49
49
  onProfile: u,
50
50
  showThemeToggle: k = !0,
51
+ themeOptions: y = A,
51
52
  children: g
52
53
  }) => {
53
54
  var N;
54
- const [d, s] = z(!1), f = E(null);
55
- I(() => {
56
- const w = (T) => {
57
- f.current && !f.current.contains(T.target) && s(!1);
55
+ const [d, s] = O(!1), f = I(null);
56
+ L(() => {
57
+ const w = (E) => {
58
+ f.current && !f.current.contains(E.target) && s(!1);
58
59
  };
59
60
  return d && document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
60
61
  }, [d]);
@@ -79,15 +80,15 @@ const R = () => {
79
80
  start: "left-auto right-full top-0 mr-2",
80
81
  center: "left-auto right-full top-1/2 -translate-y-1/2 mr-2"
81
82
  }
82
- }, y = ((N = x[r]) == null ? void 0 : N[a]) || x.bottom.end, i = !!(u || c), p = !!k, v = !!g, C = !!h;
83
- return /* @__PURE__ */ n("div", { className: o("relative", m), ref: f, children: [
83
+ }, C = ((N = x[r]) == null ? void 0 : N[a]) || x.bottom.end, m = !!(u || c), p = !!k, v = !!g, T = !!h;
84
+ return /* @__PURE__ */ n("div", { className: o("relative", i), ref: f, children: [
84
85
  /* @__PURE__ */ e(
85
86
  "button",
86
87
  {
87
88
  onClick: () => s(!d),
88
89
  className: "flex min-h-11 min-w-11 w-full items-center focus:outline-none",
89
90
  children: l || /* @__PURE__ */ e(
90
- L,
91
+ z,
91
92
  {
92
93
  name: t.name,
93
94
  src: t.avatarUrl,
@@ -106,14 +107,14 @@ const R = () => {
106
107
  "backdrop-blur-md",
107
108
  // Ensures content behind doesn't make text unreadable
108
109
  "animate-in fade-in zoom-in-95 duration-100 p-1",
109
- y
110
+ C
110
111
  ),
111
112
  children: [
112
113
  /* @__PURE__ */ n("div", { className: "flex flex-col space-y-1 p-2 border-b border-border/50 bg-muted/30", children: [
113
114
  /* @__PURE__ */ e("p", { className: "text-sm font-medium leading-none text-foreground", children: t.name }),
114
115
  /* @__PURE__ */ e("p", { className: "text-xs leading-none text-muted-foreground truncate", children: t.email })
115
116
  ] }),
116
- i && /* @__PURE__ */ n("div", { className: "p-1 space-y-0.5", children: [
117
+ m && /* @__PURE__ */ n("div", { className: "p-1 space-y-0.5", children: [
117
118
  u && /* @__PURE__ */ e(b, { icon: "user", label: "Profile", onClick: () => {
118
119
  u(), s(!1);
119
120
  } }),
@@ -121,12 +122,12 @@ const R = () => {
121
122
  c(), s(!1);
122
123
  } })
123
124
  ] }),
124
- p && /* @__PURE__ */ n("div", { className: o("p-2", i && "border-t border-border/50"), children: [
125
+ p && /* @__PURE__ */ n("div", { className: o("p-2", m && "border-t border-border/50"), children: [
125
126
  /* @__PURE__ */ e("p", { className: "text-[10px] font-bold uppercase tracking-widest text-muted-foreground mb-1", children: "Theme" }),
126
- /* @__PURE__ */ e(R, {})
127
+ /* @__PURE__ */ e(M, { options: y })
127
128
  ] }),
128
- v && /* @__PURE__ */ e("div", { className: o("p-1 space-y-0.5", (i || p) && "border-t border-border/50"), children: g }),
129
- C && /* @__PURE__ */ e("div", { className: o("p-1", (i || p || v) && "border-t border-border/50"), children: /* @__PURE__ */ e(
129
+ v && /* @__PURE__ */ e("div", { className: o("p-1 space-y-0.5", (m || p) && "border-t border-border/50"), children: g }),
130
+ T && /* @__PURE__ */ e("div", { className: o("p-1", (m || p || v) && "border-t border-border/50"), children: /* @__PURE__ */ e(
130
131
  b,
131
132
  {
132
133
  icon: "log-out",
@@ -144,5 +145,5 @@ const R = () => {
144
145
  };
145
146
  export {
146
147
  b as ButtonItem,
147
- D as UserNav
148
+ H as UserNav
148
149
  };
@@ -1,18 +1,18 @@
1
1
  import React from 'react';
2
2
  import { type VariantProps } from 'class-variance-authority';
3
3
  declare const badgeVariants: (props?: ({
4
- variant?: "primary" | "secondary" | "danger" | "success" | "warning" | "outline" | null | undefined;
4
+ variant?: "primary" | "secondary" | "danger" | "success" | "warning" | "outline" | "gain" | "loss" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
7
7
  }
8
8
  /**
9
9
  * @wizard
10
10
  * @name Badge
11
- * @description A small component to display a status, count, or label.
12
- * @tags ui, label, indicator
11
+ * @description A small component to display a status, count, or label. The `gain` and `loss` variants are price chips, as on a watchlist: a move up or down, in the theme's direction colours rather than success or danger, because a fall is not an error.
12
+ * @tags ui, label, indicator, price, gain, loss
13
13
  * @props
14
14
  * - name: variant
15
- * type: "'primary' | 'secondary' | 'danger' | 'success' | 'warning' | 'outline'"
15
+ * type: "'primary' | 'secondary' | 'danger' | 'success' | 'warning' | 'outline' | 'gain' | 'loss'"
16
16
  * description: The visual style of the badge.
17
17
  * - name: children
18
18
  * type: React.ReactNode
@@ -1,5 +1,5 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as a } from "react";
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { forwardRef as t } from "react";
3
3
  import { cva as s } from "class-variance-authority";
4
4
  import { cn as d } from "../../utils/cn.js";
5
5
  const i = s(
@@ -14,15 +14,18 @@ const i = s(
14
14
  // ✅ Fixed: Use semantic success token
15
15
  warning: "border-transparent bg-warning text-warning-foreground shadow hover:bg-warning/80",
16
16
  // ✅ Added: Missing variant
17
- outline: "text-foreground"
17
+ outline: "text-foreground",
18
+ // A price's direction, not a status: a fall is not an error.
19
+ gain: "border-transparent bg-gain text-gain-foreground tabular-nums shadow hover:bg-gain/80",
20
+ loss: "border-transparent bg-loss text-loss-foreground tabular-nums shadow hover:bg-loss/80"
18
21
  }
19
22
  },
20
23
  defaultVariants: {
21
24
  variant: "primary"
22
25
  }
23
26
  }
24
- ), g = a(
25
- ({ className: r, variant: e, ...o }, n) => /* @__PURE__ */ t(
27
+ ), g = t(
28
+ ({ className: r, variant: e, ...o }, n) => /* @__PURE__ */ a(
26
29
  "div",
27
30
  {
28
31
  ref: n,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export type ThemeMode = 'light' | 'dark' | 'system' | 'corporate' | 'midnight' | 'blueprint';
2
+ export type ThemeMode = 'light' | 'dark' | 'system' | 'corporate' | 'midnight' | 'blueprint' | 'markets';
3
3
  export declare const availableThemes: ThemeMode[];
4
4
  export interface ThemeColors {
5
5
  primary: string;
@@ -1,42 +1,50 @@
1
1
  import { jsx as W } from "react/jsx-runtime";
2
- import { useState as y, useEffect as M, useCallback as h, useMemo as X, createContext as Z, useContext as ee } from "react";
2
+ import { useState as h, useEffect as M, useCallback as S, useMemo as X, createContext as Z, useContext as ee } from "react";
3
3
  const E = [
4
4
  "light",
5
5
  "dark",
6
6
  "system",
7
7
  "corporate",
8
8
  "midnight",
9
- "blueprint"
10
- ], m = 'ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace', K = {
9
+ "blueprint",
10
+ "markets"
11
+ ], p = 'ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace', K = {
11
12
  light: {
12
13
  sans: '"Inter", system-ui, sans-serif',
13
14
  serif: "Georgia, serif",
14
- mono: `"Menlo", ${m}`
15
+ mono: `"Menlo", ${p}`
15
16
  },
16
17
  dark: {
17
18
  sans: '"Inter", system-ui, sans-serif',
18
19
  serif: "Georgia, serif",
19
- mono: `"Menlo", ${m}`
20
+ mono: `"Menlo", ${p}`
20
21
  },
21
22
  system: {
22
23
  sans: '"Inter", system-ui, sans-serif',
23
24
  serif: "Georgia, serif",
24
- mono: `"Menlo", ${m}`
25
+ mono: `"Menlo", ${p}`
25
26
  },
26
27
  corporate: {
27
28
  sans: '"Lato", sans-serif',
28
29
  serif: '"Merriweather", serif',
29
- mono: `"Menlo", ${m}`
30
+ mono: `"Menlo", ${p}`
30
31
  },
31
32
  midnight: {
32
33
  sans: '"Roboto Mono", monospace',
33
34
  serif: "Georgia, serif",
34
- mono: `"Roboto Mono", ${m}`
35
+ mono: `"Roboto Mono", ${p}`
35
36
  },
36
37
  blueprint: {
37
38
  sans: '"Courier New", monospace',
38
39
  serif: "Georgia, serif",
39
- mono: `"Courier New", ${m}`
40
+ mono: `"Courier New", ${p}`
41
+ },
42
+ // Inter, as the quote screens it is modelled on use a plain grotesque; the
43
+ // figures line up because index.css sets tabular-nums under .markets.
44
+ markets: {
45
+ sans: '"Inter", system-ui, sans-serif',
46
+ serif: "Georgia, serif",
47
+ mono: `"Menlo", ${p}`
40
48
  }
41
49
  }, oe = 550, re = 100, V = {
42
50
  name: "TAY Dreamboat",
@@ -54,7 +62,7 @@ const E = [
54
62
  // /fonts/Tay.woff2, which does not exist anywhere in the repo — a 404 in
55
63
  // the fallback slot of the hero font.
56
64
  serif: '"TAY Dreamboat", "TAY Dreamboat Fallback", serif',
57
- mono: `"Menlo", ${m}`
65
+ mono: `"Menlo", ${p}`
58
66
  },
59
67
  lightColors: {
60
68
  background: "253 251 247",
@@ -97,20 +105,20 @@ const E = [
97
105
  }, J = Z(void 0), q = {
98
106
  [V.name]: V
99
107
  }, se = ({
100
- children: S,
108
+ children: T,
101
109
  defaultTheme: l,
102
110
  defaultCustomTheme: i,
103
111
  appId: L,
104
112
  instanceConfig: c
105
113
  }) => {
106
114
  var O, z, G;
107
- const v = (O = c == null ? void 0 : c.fonts) == null ? void 0 : O.sans, F = (z = c == null ? void 0 : c.fonts) == null ? void 0 : z.serif, R = (G = c == null ? void 0 : c.fonts) == null ? void 0 : G.mono, t = L ? `ramme:theme:${L}` : "ramme:theme:global", [f, T] = y(() => {
115
+ const v = (O = c == null ? void 0 : c.fonts) == null ? void 0 : O.sans, F = (z = c == null ? void 0 : c.fonts) == null ? void 0 : z.serif, R = (G = c == null ? void 0 : c.fonts) == null ? void 0 : G.mono, t = L ? `ramme:theme:${L}` : "ramme:theme:global", [f, $] = h(() => {
108
116
  if (typeof window < "u") {
109
117
  const o = localStorage.getItem(`${t}:mode`);
110
118
  return i && !o ? l || "system" : o && E.includes(o) ? o : l || "system";
111
119
  }
112
120
  return l || "system";
113
- }), [x, _] = y("light"), [u, I] = y("0.5rem"), [w, k] = y("1rem"), [a, b] = y(() => {
121
+ }), [x, _] = h("light"), [u, k] = h("0.5rem"), [w, I] = h("1rem"), [a, b] = h(() => {
114
122
  if (typeof window < "u") {
115
123
  const o = localStorage.getItem(`${t}:custom`);
116
124
  if (o)
@@ -132,20 +140,20 @@ const E = [
132
140
  _(g.matches ? "dark" : "light");
133
141
  };
134
142
  o.addEventListener("change", e);
135
- const d = localStorage.getItem(`${t}:borderRadius`), $ = localStorage.getItem(`${t}:fontSize`);
136
- return d && I(d), $ && k($), () => o.removeEventListener("change", e);
143
+ const d = localStorage.getItem(`${t}:borderRadius`), A = localStorage.getItem(`${t}:fontSize`);
144
+ return d && k(d), A && I(A), () => o.removeEventListener("change", e);
137
145
  }
138
146
  }, [i, t]);
139
- const B = h(() => {
140
- localStorage.removeItem(`${t}:mode`), localStorage.removeItem(`${t}:custom`), localStorage.removeItem(`${t}:borderRadius`), localStorage.removeItem(`${t}:fontSize`), I("0.5rem"), k("1rem"), i ? (T("system"), b(i)) : l ? (T(l), b(null)) : (T("system"), b(null));
141
- }, [l, i, t]), N = h((o) => {
142
- T(o), localStorage.setItem(`${t}:mode`, o), ["light", "dark", "system"].includes(o) || (b(null), localStorage.removeItem(`${t}:custom`));
143
- }, [t]), Y = h((o) => {
147
+ const B = S(() => {
148
+ localStorage.removeItem(`${t}:mode`), localStorage.removeItem(`${t}:custom`), localStorage.removeItem(`${t}:borderRadius`), localStorage.removeItem(`${t}:fontSize`), k("0.5rem"), I("1rem"), i ? ($("system"), b(i)) : l ? ($(l), b(null)) : ($("system"), b(null));
149
+ }, [l, i, t]), N = S((o) => {
150
+ $(o), localStorage.setItem(`${t}:mode`, o), ["light", "dark", "system"].includes(o) || (b(null), localStorage.removeItem(`${t}:custom`));
151
+ }, [t]), Y = S((o) => {
144
152
  b(o), o ? localStorage.setItem(`${t}:custom`, JSON.stringify(o)) : localStorage.removeItem(`${t}:custom`);
145
- }, [t]), D = h((o) => {
146
- I(o), localStorage.setItem(`${t}:borderRadius`, o);
147
- }, [t]), P = h((o) => {
148
- k(o), localStorage.setItem(`${t}:fontSize`, o);
153
+ }, [t]), D = S((o) => {
154
+ k(o), localStorage.setItem(`${t}:borderRadius`, o);
155
+ }, [t]), P = S((o) => {
156
+ I(o), localStorage.setItem(`${t}:fontSize`, o);
149
157
  }, [t]);
150
158
  M(() => {
151
159
  const o = document.documentElement;
@@ -159,7 +167,7 @@ const E = [
159
167
  }, []), M(() => {
160
168
  const o = document.documentElement;
161
169
  E.forEach((s) => o.classList.remove(s)), o.classList.remove("custom-theme");
162
- const e = (s, n) => o.style.setProperty(s, n), d = (s) => o.style.removeProperty(s), $ = [
170
+ const e = (s, n) => o.style.setProperty(s, n), d = (s) => o.style.removeProperty(s), A = [
163
171
  "system-ui",
164
172
  "Inter",
165
173
  "Georgia",
@@ -178,15 +186,15 @@ const E = [
178
186
  "TAYKula"
179
187
  ], g = (s) => {
180
188
  const n = s.split(",")[0].replace(/['"]*/g, "").trim();
181
- if ($.some((p) => n.toLowerCase() === p.toLowerCase())) return;
189
+ if (A.some((m) => n.toLowerCase() === m.toLowerCase())) return;
182
190
  const r = n.replace(/\s+/g, "+").toLowerCase();
183
191
  if (Array.from(
184
192
  document.querySelectorAll('link[rel="stylesheet"]')
185
- ).some((p) => new RegExp(`family=${r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?=[:&]|$)`).test(p.href.toLowerCase()))) return;
193
+ ).some((m) => new RegExp(`family=${r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?=[:&]|$)`).test(m.href.toLowerCase()))) return;
186
194
  const C = `google-font-${n.replace(/\s+/g, "-")}`;
187
195
  if (!document.getElementById(C)) {
188
- const p = document.createElement("link");
189
- p.id = C, p.rel = "stylesheet", p.href = `https://fonts.googleapis.com/css2?family=${n.replace(/\s+/g, "+")}:wght@400;500;600;700&display=swap`, document.head.appendChild(p);
196
+ const m = document.createElement("link");
197
+ m.id = C, m.rel = "stylesheet", m.href = `https://fonts.googleapis.com/css2?family=${n.replace(/\s+/g, "+")}:wght@400;500;600;700&display=swap`, document.head.appendChild(m);
190
198
  }
191
199
  }, j = [
192
200
  "--app-primary-color",
@@ -219,10 +227,10 @@ const E = [
219
227
  "--app-border-radius-sm",
220
228
  "--app-border-radius-md",
221
229
  "--app-border-radius-lg"
222
- ], A = f === "system" ? x : f;
230
+ ], y = f === "system" ? x : f;
223
231
  if (a) {
224
232
  o.classList.add("custom-theme");
225
- const s = A === "dark" || A === "midnight";
233
+ const s = y === "dark" || y === "midnight" || y === "markets";
226
234
  s && o.classList.add("dark");
227
235
  const n = a.colors, r = s ? a.darkColors || n : a.lightColors || n;
228
236
  if (!r) {
@@ -231,8 +239,8 @@ const E = [
231
239
  }
232
240
  e("--app-primary-color", r.primary), e("--app-primary-foreground-color", r.primaryForeground), e("--app-secondary-color", r.secondary), e("--app-secondary-foreground-color", r.secondaryForeground), e("--app-accent-color", r.accent), e("--app-accent-foreground-color", r.accentForeground), e("--app-danger-color", r.danger), e("--app-danger-foreground-color", r.dangerForeground), r.success ? e("--app-success-color", r.success) : d("--app-success-color"), r.warning ? e("--app-warning-color", r.warning) : d("--app-warning-color"), e("--app-bg-color", r.background), e("--app-card-bg-color", r.card), e("--app-text-color", r.text), e("--app-border-color", r.border), e("--app-muted-bg", r.muted), e("--app-muted-text", r.mutedForeground), e("--app-input-bg-color", r.input), e("--app-input-border-color", r.inputBorder), e("--app-input-focus-ring-color", r.ring), e("--app-table-header-bg", r.muted), e("--app-table-header-text", r.text), e("--app-table-row-hover-bg", r.muted), e("--app-table-grid-line-color", r.border), a.fonts && (g(a.fonts.sans), a.fonts.serif && g(a.fonts.serif), e("--app-font-serif", a.fonts.serif), e("--app-font-sans", a.fonts.sans), e("--app-font-mono", a.fonts.mono)), document.body.style.backgroundColor = `rgb(${r.background})`, document.body.style.color = `rgb(${r.text})`, e("--app-border-radius-md", a.borderRadius), e("--app-border-radius-sm", `calc(${a.borderRadius} - 0.25rem)`), e("--app-border-radius-lg", `calc(${a.borderRadius} + 0.25rem)`);
233
241
  } else {
234
- o.classList.add(A), j.forEach(d);
235
- const s = K[A] || K.light, n = v || s.sans, r = F || s.serif, H = R || s.mono;
242
+ o.classList.add(y), j.forEach(d);
243
+ const s = K[y] || K.light, n = v || s.sans, r = F || s.serif, H = R || s.mono;
236
244
  v || g(n), F || g(r), e("--app-font-sans", n), e("--app-font-serif", r), e("--app-font-mono", H), document.body.style.backgroundColor = "", document.body.style.color = "", e("--app-border-radius-md", u), e("--app-border-radius-sm", `calc(${u} - 0.25rem)`), e("--app-border-radius-lg", `calc(${u} + 0.25rem)`);
237
245
  }
238
246
  if (e("--app-font-size-base", w), !o.hasAttribute("data-theme-ready")) return;
@@ -258,12 +266,12 @@ const E = [
258
266
  }),
259
267
  [f, N, B, u, D, w, P, a, Y]
260
268
  );
261
- return /* @__PURE__ */ W(J.Provider, { value: U, children: S });
269
+ return /* @__PURE__ */ W(J.Provider, { value: U, children: T });
262
270
  }, ne = () => {
263
- const S = ee(J);
264
- if (S === void 0)
271
+ const T = ee(J);
272
+ if (T === void 0)
265
273
  throw new Error("useTheme must be used within a ThemeProvider");
266
- return S;
274
+ return T;
267
275
  };
268
276
  export {
269
277
  V as TAY_DREAMBOAT_THEME,