@epilot/spark-ui 1.0.0-alpha.8 → 1.0.0-alpha.9

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.
Files changed (134) hide show
  1. package/dist/components/accordion.cjs +1 -1
  2. package/dist/components/accordion.d.ts +1 -1
  3. package/dist/components/accordion.js +1 -1
  4. package/dist/components/badge.cjs +2 -2
  5. package/dist/components/badge.cjs.map +1 -1
  6. package/dist/components/badge.d.ts +1 -1
  7. package/dist/components/badge.js +1 -1
  8. package/dist/components/bar-chart.js +1 -1
  9. package/dist/components/battery-progress-row.d.cts +1 -1
  10. package/dist/components/battery-progress-row.d.ts +1 -1
  11. package/dist/components/bubble.d.cts +1 -1
  12. package/dist/components/bubble.d.ts +1 -1
  13. package/dist/components/button.cjs +2 -2
  14. package/dist/components/button.cjs.map +1 -1
  15. package/dist/components/button.d.cts +2 -2
  16. package/dist/components/button.d.ts +3 -3
  17. package/dist/components/button.js +1 -1
  18. package/dist/components/callout.cjs +4 -4
  19. package/dist/components/callout.cjs.map +1 -1
  20. package/dist/components/callout.d.cts +7 -2
  21. package/dist/components/callout.d.ts +7 -2
  22. package/dist/components/callout.js +4 -4
  23. package/dist/components/callout.js.map +1 -1
  24. package/dist/components/card.d.ts +1 -1
  25. package/dist/components/checkbox.cjs +2 -2
  26. package/dist/components/checkbox.cjs.map +1 -1
  27. package/dist/components/checkbox.d.ts +1 -1
  28. package/dist/components/checkbox.js +1 -1
  29. package/dist/components/circular-gauge.d.cts +1 -1
  30. package/dist/components/circular-gauge.d.ts +1 -1
  31. package/dist/components/device-card.d.cts +1 -1
  32. package/dist/components/device-card.d.ts +1 -1
  33. package/dist/components/energy-bar-chart.d.cts +1 -1
  34. package/dist/components/energy-bar-chart.d.ts +1 -1
  35. package/dist/components/feed-in-hero.d.cts +1 -1
  36. package/dist/components/feed-in-hero.d.ts +1 -1
  37. package/dist/components/field.cjs +3 -3
  38. package/dist/components/field.cjs.map +1 -1
  39. package/dist/components/field.d.ts +1 -1
  40. package/dist/components/field.js +1 -1
  41. package/dist/components/input-group.cjs +2 -2
  42. package/dist/components/input-group.cjs.map +1 -1
  43. package/dist/components/input-group.js +1 -1
  44. package/dist/components/input-otp.cjs +10 -10
  45. package/dist/components/input-otp.cjs.map +1 -1
  46. package/dist/components/input-otp.js +1 -1
  47. package/dist/components/input.cjs +10 -10
  48. package/dist/components/input.cjs.map +1 -1
  49. package/dist/components/input.d.ts +1 -1
  50. package/dist/components/input.js +1 -1
  51. package/dist/components/line-chart.js +1 -1
  52. package/dist/components/metering-row.d.cts +1 -1
  53. package/dist/components/metering-row.d.ts +1 -1
  54. package/dist/components/number-flow.d.cts +1 -1
  55. package/dist/components/number-flow.d.ts +1 -1
  56. package/dist/components/power-history-chart.js +1 -1
  57. package/dist/components/power-history.cjs +1 -1
  58. package/dist/components/power-history.js +1 -1
  59. package/dist/components/power-network.cjs +1 -1
  60. package/dist/components/power-network.js +1 -1
  61. package/dist/components/radio.cjs +3 -3
  62. package/dist/components/radio.cjs.map +1 -1
  63. package/dist/components/radio.d.ts +1 -1
  64. package/dist/components/radio.js +1 -1
  65. package/dist/components/sankey-chart.d.cts +1 -1
  66. package/dist/components/sankey-chart.d.ts +1 -1
  67. package/dist/components/segmented-control.d.ts +1 -1
  68. package/dist/components/select.cjs +2 -2
  69. package/dist/components/select.cjs.map +1 -1
  70. package/dist/components/select.d.ts +1 -1
  71. package/dist/components/select.js +1 -1
  72. package/dist/components/switch.cjs +2 -2
  73. package/dist/components/switch.cjs.map +1 -1
  74. package/dist/components/switch.d.ts +1 -1
  75. package/dist/components/switch.js +1 -1
  76. package/dist/components/theme.cjs +119 -3
  77. package/dist/components/theme.cjs.map +1 -0
  78. package/dist/components/theme.d.cts +1 -3
  79. package/dist/components/theme.d.ts +2 -4
  80. package/dist/components/theme.js +115 -1
  81. package/dist/components/theme.js.map +1 -0
  82. package/dist/components/toast.cjs +158 -65
  83. package/dist/components/toast.cjs.map +1 -1
  84. package/dist/components/toast.d.cts +51 -9
  85. package/dist/components/toast.d.ts +51 -9
  86. package/dist/components/toast.js +158 -65
  87. package/dist/components/toast.js.map +1 -1
  88. package/dist/generate-radix-colors-BW09KT9m.d.ts +33 -0
  89. package/dist/generate-radix-colors-C5mWRWnQ.d.cts +33 -0
  90. package/dist/{accent-colors-CjHCf8fH.cjs → lib/accent-colors.cjs} +3 -7
  91. package/dist/lib/accent-colors.cjs.map +1 -0
  92. package/dist/lib/accent-colors.d.cts +8 -0
  93. package/dist/lib/accent-colors.d.ts +8 -0
  94. package/dist/{accent-colors-Ch2J0EEY.js → lib/accent-colors.js} +2 -2
  95. package/dist/lib/accent-colors.js.map +1 -0
  96. package/dist/lib/accent-theme.cjs +130 -0
  97. package/dist/lib/accent-theme.cjs.map +1 -0
  98. package/dist/lib/accent-theme.d.cts +35 -0
  99. package/dist/lib/accent-theme.d.ts +35 -0
  100. package/dist/lib/accent-theme.js +122 -0
  101. package/dist/lib/accent-theme.js.map +1 -0
  102. package/dist/{theme-ClRJhexF.cjs → lib/generate-radix-colors.cjs} +12 -240
  103. package/dist/lib/generate-radix-colors.cjs.map +1 -0
  104. package/dist/lib/generate-radix-colors.d.cts +4 -0
  105. package/dist/lib/generate-radix-colors.d.ts +4 -0
  106. package/dist/{theme-8PDO9E0S.js → lib/generate-radix-colors.js} +8 -225
  107. package/dist/lib/generate-radix-colors.js.map +1 -0
  108. package/dist/{input-box-variants-ZCtgs-1S.cjs → lib/input-box-variants.cjs} +5 -14
  109. package/dist/lib/input-box-variants.cjs.map +1 -0
  110. package/dist/lib/input-box-variants.d.cts +10 -0
  111. package/dist/lib/input-box-variants.d.ts +10 -0
  112. package/dist/{input-box-variants-DcajYXvo.js → lib/input-box-variants.js} +3 -3
  113. package/dist/lib/input-box-variants.js.map +1 -0
  114. package/dist/lib/theme-types.cjs +1 -0
  115. package/dist/lib/theme-types.d.cts +4 -0
  116. package/dist/lib/theme-types.d.ts +4 -0
  117. package/dist/lib/theme-types.js +2 -0
  118. package/dist/lib/tones.cjs +14 -0
  119. package/dist/lib/tones.cjs.map +1 -0
  120. package/dist/{tones-PXJGlSpe.d.ts → lib/tones.d.cts} +2 -2
  121. package/dist/{tones-DjgKOX3s.d.cts → lib/tones.d.ts} +2 -2
  122. package/dist/lib/tones.js +13 -0
  123. package/dist/lib/tones.js.map +1 -0
  124. package/dist/{number-flow-DMJouddg.d.cts → number-flow-CVIvQhZn.d.cts} +1 -1
  125. package/dist/{number-flow-D9zsxH0-.d.ts → number-flow-DVUHTv9D.d.ts} +1 -1
  126. package/dist/styles/index.css +158 -0
  127. package/dist/{theme-types-BDdoRxXa.d.ts → theme-types-BKlzRiyw.d.ts} +1 -1
  128. package/package.json +18 -3
  129. package/dist/accent-colors-Ch2J0EEY.js.map +0 -1
  130. package/dist/accent-colors-CjHCf8fH.cjs.map +0 -1
  131. package/dist/input-box-variants-DcajYXvo.js.map +0 -1
  132. package/dist/input-box-variants-ZCtgs-1S.cjs.map +0 -1
  133. package/dist/theme-8PDO9E0S.js.map +0 -1
  134. package/dist/theme-ClRJhexF.cjs.map +0 -1
@@ -2,12 +2,13 @@
2
2
  "use client";
3
3
  import { cn } from "../utils/cn.js";
4
4
  import { MaterialSymbol } from "../icons/material-symbol.js";
5
+ import { buttonVariants } from "./button.js";
5
6
  import { Spinner } from "./spinner.js";
6
7
  import "react";
7
- import { jsx } from "react/jsx-runtime";
8
- import { Toaster as Toaster$1, toast } from "sonner";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { Toast } from "@base-ui/react/toast";
9
10
  //#region src/components/toast.tsx
10
- const ICONS = Object.fromEntries(Object.entries({
11
+ const TOAST_ICONS = {
11
12
  success: {
12
13
  name: "check_circle",
13
14
  className: "text-success-light"
@@ -24,71 +25,163 @@ const ICONS = Object.fromEntries(Object.entries({
24
25
  name: "cancel",
25
26
  className: "text-error-light"
26
27
  }
27
- }).map(([type, icon]) => [type, /* @__PURE__ */ jsx(MaterialSymbol, {
28
- className: cn("inline-flex shrink-0 items-center [--spark-icon-size:16px]", icon.className),
29
- name: icon.name
30
- }, type)]));
31
- ICONS.loading = /* @__PURE__ */ jsx(Spinner, {
32
- "aria-hidden": "true",
33
- className: "flex text-gray-11",
34
- label: "",
35
- role: "presentation",
36
- size: "sm"
37
- });
38
- const STYLE_VARS = {
39
- "--normal-bg": "var(--color-gray-2)",
40
- "--normal-text": "var(--color-gray-12)",
41
- "--normal-border": "var(--color-gray-a1)",
42
- "--border-radius": "var(--radius-lg)",
43
- "--gray1": "var(--color-gray-1)",
44
- "--gray2": "var(--color-gray-2)",
45
- "--gray3": "var(--color-gray-3)",
46
- "--gray4": "var(--color-gray-4)",
47
- "--gray5": "var(--color-gray-5)",
48
- "--gray11": "var(--color-gray-11)",
49
- "--gray12": "var(--color-gray-12)",
50
- "--toast-close-button-start": "unset",
51
- "--toast-close-button-end": "0",
52
- "--toast-close-button-transform": "translate(35%, -35%)",
53
- "--success-bg": "var(--color-green-2)",
54
- "--success-border": "transparent",
55
- "--success-text": "var(--color-green-11)",
56
- "--info-bg": "var(--color-blue-2)",
57
- "--info-border": "transparent",
58
- "--info-text": "var(--color-blue-11)",
59
- "--warning-bg": "var(--color-orange-2)",
60
- "--warning-border": "transparent",
61
- "--warning-text": "var(--color-orange-11)",
62
- "--error-bg": "var(--color-red-2)",
63
- "--error-border": "transparent",
64
- "--error-text": "var(--color-red-11)"
65
28
  };
66
- const CLASS_NAMES = {
67
- description: "text-gray-11! [[data-rich-colors=true][data-type]_&]:text-inherit!",
68
- actionButton: "bg-spark-9! text-spark-contrast! hover:bg-spark-10! rounded-md!",
69
- cancelButton: "bg-gray-a3! text-gray-12! hover:bg-gray-a4! rounded-md!"
29
+ const TONE_CLASSES = {
30
+ success: "border-green-6 bg-green-2 text-green-11",
31
+ info: "border-blue-6 bg-blue-2 text-blue-11",
32
+ warning: "border-orange-6 bg-orange-2 text-orange-11",
33
+ error: "border-red-6 bg-red-2 text-red-11"
70
34
  };
71
- const Toaster = ({ className, closeButton = true, icons, richColors = true, style, toastOptions, ...props }) => /* @__PURE__ */ jsx(Toaster$1, {
72
- className: cn("toaster group", className),
73
- closeButton,
74
- icons: {
75
- ...ICONS,
76
- ...icons
77
- },
78
- richColors,
79
- style: {
80
- ...STYLE_VARS,
81
- ...style
82
- },
83
- toastOptions: {
84
- ...toastOptions,
85
- classNames: {
86
- ...CLASS_NAMES,
87
- ...toastOptions?.classNames
88
- }
89
- },
90
- ...props
35
+ const POSITION_CLASSES = {
36
+ "top-left": "sm:top-4 sm:right-auto sm:bottom-auto sm:left-4",
37
+ "top-center": "sm:top-4 sm:right-auto sm:bottom-auto sm:left-1/2 sm:-translate-x-1/2",
38
+ "top-right": "sm:top-4 sm:right-4 sm:bottom-auto sm:left-auto",
39
+ "bottom-left": "sm:top-auto sm:right-auto sm:bottom-4 sm:left-4",
40
+ "bottom-center": "sm:top-auto sm:right-auto sm:bottom-4 sm:left-1/2 sm:-translate-x-1/2",
41
+ "bottom-right": "sm:top-auto sm:right-4 sm:bottom-4 sm:left-auto"
42
+ };
43
+ const manager = Toast.createToastManager();
44
+ let sequence = 0;
45
+ function actionRest({ label: _label, onClick: _onClick, ...rest }) {
46
+ return rest;
47
+ }
48
+ function toManagerOptions(id, title, type, options) {
49
+ const action = options?.action;
50
+ return {
51
+ id,
52
+ title,
53
+ type,
54
+ description: options?.description,
55
+ timeout: options?.duration,
56
+ priority: options?.priority,
57
+ onClose: options?.onDismiss,
58
+ actionProps: action && {
59
+ ...actionRest(action),
60
+ children: action.label,
61
+ onClick: (event) => {
62
+ action.onClick?.(event);
63
+ manager.close(id);
64
+ }
65
+ },
66
+ data: { closeButton: options?.closeButton }
67
+ };
68
+ }
69
+ const emit = (type) => (message, options) => {
70
+ const id = options?.id ?? `spark-toast-${sequence += 1}`;
71
+ return manager.add(toManagerOptions(id, message, type, options));
72
+ };
73
+ const phase = (value, type) => (result) => {
74
+ return {
75
+ title: typeof value === "function" ? value(result) : value,
76
+ type
77
+ };
78
+ };
79
+ const toast = Object.assign(emit(), {
80
+ success: emit("success"),
81
+ info: emit("info"),
82
+ warning: emit("warning"),
83
+ error: emit("error"),
84
+ loading: emit("loading"),
85
+ /** Dismiss one toast, or every toast when called without an id. */
86
+ dismiss: (id) => manager.close(id),
87
+ promise: (promiseValue, messages) => manager.promise(promiseValue, {
88
+ loading: {
89
+ title: messages.loading,
90
+ type: "loading"
91
+ },
92
+ success: phase(messages.success, "success"),
93
+ error: phase(messages.error, "error")
94
+ })
91
95
  });
96
+ function ToastIcon({ type }) {
97
+ const icon = TOAST_ICONS[type];
98
+ if (type !== "loading" && !icon) return null;
99
+ return /* @__PURE__ */ jsx("span", {
100
+ "aria-hidden": "true",
101
+ className: "flex h-5 w-5 shrink-0 items-center justify-center",
102
+ children: type === "loading" ? /* @__PURE__ */ jsx(Spinner, {
103
+ className: "text-gray-11",
104
+ label: "",
105
+ role: "presentation",
106
+ size: "sm"
107
+ }) : /* @__PURE__ */ jsx(MaterialSymbol, {
108
+ className: cn("[--spark-icon-size:20px]", icon.className),
109
+ name: icon.name
110
+ })
111
+ });
112
+ }
113
+ function ToastItem({ closeButton, richColors, toast: toastObject }) {
114
+ const tone = TONE_CLASSES[toastObject.type];
115
+ const showClose = toastObject.data?.closeButton ?? closeButton;
116
+ return /* @__PURE__ */ jsxs(Toast.Root, {
117
+ "data-slot": "toast",
118
+ className: cn("flex items-start gap-2 rounded-md border border-gray-a5 bg-gray-1 p-3 text-gray shadow-md select-none", richColors && tone),
119
+ swipeDirection: [
120
+ "up",
121
+ "down",
122
+ "right"
123
+ ],
124
+ toast: toastObject,
125
+ children: [
126
+ /* @__PURE__ */ jsx(ToastIcon, { type: toastObject.type }),
127
+ /* @__PURE__ */ jsxs(Toast.Content, {
128
+ className: "flex min-w-0 flex-1 flex-col gap-0.5",
129
+ children: [/* @__PURE__ */ jsx(Toast.Title, {
130
+ className: "text-sm font-medium",
131
+ "data-slot": "toast-title"
132
+ }), /* @__PURE__ */ jsx(Toast.Description, {
133
+ className: cn("text-sm", richColors && tone ? "text-inherit" : "text-gray-11"),
134
+ "data-slot": "toast-description"
135
+ })]
136
+ }),
137
+ toastObject.actionProps ? /* @__PURE__ */ jsx(Toast.Action, {
138
+ className: cn(buttonVariants({
139
+ size: "small",
140
+ variant: "primary"
141
+ }), "-my-2 shrink-0 self-center rounded-full"),
142
+ "data-slot": "toast-action"
143
+ }) : null,
144
+ showClose ? /* @__PURE__ */ jsx(Toast.Close, {
145
+ "aria-label": "Close",
146
+ className: cn(buttonVariants({
147
+ size: "icon-small",
148
+ variant: "tertiary"
149
+ }), "-my-1 -mr-1 size-7 shrink-0 self-center text-gray-11"),
150
+ "data-slot": "toast-close",
151
+ children: /* @__PURE__ */ jsx(MaterialSymbol, {
152
+ "aria-hidden": "true",
153
+ className: "[--spark-icon-size:18px]",
154
+ name: "close"
155
+ })
156
+ }) : null
157
+ ]
158
+ });
159
+ }
160
+ function ToastList({ closeButton, richColors }) {
161
+ const { toasts } = Toast.useToastManager();
162
+ return toasts.map((toastObject) => /* @__PURE__ */ jsx(ToastItem, {
163
+ closeButton,
164
+ richColors,
165
+ toast: toastObject
166
+ }, toastObject.id));
167
+ }
168
+ function Toaster({ className, closeButton = true, duration = 4e3, limit, mobilePosition = "top", position = "bottom-right", richColors = true }) {
169
+ return /* @__PURE__ */ jsx(Toast.Provider, {
170
+ limit,
171
+ timeout: duration,
172
+ toastManager: manager,
173
+ children: /* @__PURE__ */ jsx(Toast.Portal, { children: /* @__PURE__ */ jsx(Toast.Viewport, {
174
+ className: cn("fixed inset-x-4 z-50 block h-0 outline-none", mobilePosition === "top" ? "top-4" : "bottom-4", "sm:inset-x-auto sm:w-96 sm:max-w-[calc(100vw-2rem)]", POSITION_CLASSES[position], className),
175
+ "data-mobile-side": mobilePosition,
176
+ "data-side": position.startsWith("top") ? "top" : "bottom",
177
+ "data-slot": "toaster",
178
+ children: /* @__PURE__ */ jsx(ToastList, {
179
+ closeButton,
180
+ richColors
181
+ })
182
+ }) })
183
+ });
184
+ }
92
185
  //#endregion
93
186
  export { Toaster, toast };
94
187
 
@@ -1 +1 @@
1
- {"version":3,"file":"toast.js","names":["Sonner"],"sources":["../../src/components/toast.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { Toaster as Sonner, toast, type ToasterProps } from 'sonner'\nimport {\n MaterialSymbol,\n type MaterialSymbolIconName,\n} from '../icons/material-symbol'\nimport { cn } from '../utils/cn'\nimport { Spinner } from './spinner'\n\n// sonner's icon slot is a fixed 16px box that does not scale, so the glyphs\n// are pinned to 16px rather than the usual --spark-scaling formula\nconst TOAST_ICONS: Record<\n 'success' | 'info' | 'warning' | 'error',\n { name: MaterialSymbolIconName; className: string }\n> = {\n success: { name: 'check_circle', className: 'text-success-light' },\n info: { name: 'info', className: 'text-info-light' },\n warning: { name: 'warning', className: 'text-warning-light' },\n error: { name: 'cancel', className: 'text-error-light' },\n}\n\nconst ICONS: ToasterProps['icons'] = Object.fromEntries(\n Object.entries(TOAST_ICONS).map(([type, icon]) => [\n type,\n <MaterialSymbol\n className={cn(\n 'inline-flex shrink-0 items-center [--spark-icon-size:16px]',\n icon.className,\n )}\n key={type}\n name={icon.name}\n />,\n ]),\n)\n// decorative: the toast itself announces the loading message, so the spinner\n// must not add its own status live region; `flex` kills the inline baseline\n// gap that pushes it off-center inside sonner's loader wrapper\nICONS.loading = (\n <Spinner\n aria-hidden=\"true\"\n className=\"flex text-gray-11\"\n label=\"\"\n role=\"presentation\"\n size=\"sm\"\n />\n)\n\nconst STYLE_VARS = {\n '--normal-bg': 'var(--color-gray-2)',\n '--normal-text': 'var(--color-gray-12)',\n '--normal-border': 'var(--color-gray-a1)',\n '--border-radius': 'var(--radius-lg)',\n // sonner's own gray scale (close button, cancel button) — remapped so it\n // follows the spark theme instead of sonner's hardcoded light-only values\n '--gray1': 'var(--color-gray-1)',\n '--gray2': 'var(--color-gray-2)',\n '--gray3': 'var(--color-gray-3)',\n '--gray4': 'var(--color-gray-4)',\n '--gray5': 'var(--color-gray-5)',\n '--gray11': 'var(--color-gray-11)',\n '--gray12': 'var(--color-gray-12)',\n // close button on the top-right corner (sonner defaults to top-left in ltr)\n '--toast-close-button-start': 'unset',\n '--toast-close-button-end': '0',\n '--toast-close-button-transform': 'translate(35%, -35%)',\n // rich-color palette — opaque radix steps (bg 2, text 11) so floating\n // toasts don't let page content bleed through the way alpha `-soft`\n // tokens would; borders off per design\n '--success-bg': 'var(--color-green-2)',\n '--success-border': 'transparent',\n '--success-text': 'var(--color-green-11)',\n '--info-bg': 'var(--color-blue-2)',\n '--info-border': 'transparent',\n '--info-text': 'var(--color-blue-11)',\n '--warning-bg': 'var(--color-orange-2)',\n '--warning-border': 'transparent',\n '--warning-text': 'var(--color-orange-11)',\n '--error-bg': 'var(--color-red-2)',\n '--error-border': 'transparent',\n '--error-text': 'var(--color-red-11)',\n} as React.CSSProperties\n\nconst CLASS_NAMES = {\n // sonner hardcodes the description color (#3f3f3f) and its styles are\n // unlayered, so only important utilities win; typed rich toasts restore\n // the tinted inherit (untyped toasts carry data-rich-colors too, so the\n // guard needs both attributes)\n description:\n 'text-gray-11! [[data-rich-colors=true][data-type]_&]:text-inherit!',\n actionButton:\n 'bg-spark-9! text-spark-contrast! hover:bg-spark-10! rounded-md!',\n cancelButton: 'bg-gray-a3! text-gray-12! hover:bg-gray-a4! rounded-md!',\n}\n\n// consumer props merge with (not replace) the spark theming — React itself\n// would wholesale-replace object props like `style`\nconst Toaster = ({\n className,\n closeButton = true,\n icons,\n richColors = true,\n style,\n toastOptions,\n ...props\n}: ToasterProps) => (\n <Sonner\n className={cn('toaster group', className)}\n closeButton={closeButton}\n icons={{ ...ICONS, ...icons }}\n richColors={richColors}\n style={{ ...STYLE_VARS, ...style }}\n toastOptions={{\n ...toastOptions,\n classNames: { ...CLASS_NAMES, ...toastOptions?.classNames },\n }}\n {...props}\n />\n)\n\nexport { Toaster, toast }\nexport type { ToasterProps }\n"],"mappings":";;;;;;;;;AAuBA,MAAM,QAA+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],"sources":["../../src/components/toast.tsx"],"sourcesContent":["'use client'\n\nimport { Toast as ToastPrimitive } from '@base-ui/react/toast'\nimport * as React from 'react'\nimport {\n MaterialSymbol,\n type MaterialSymbolIconName,\n} from '../icons/material-symbol'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\nimport { Spinner } from './spinner'\n\ntype ToastType = 'success' | 'info' | 'warning' | 'error' | 'loading'\n\ntype ToastPosition =\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right'\n\n// Per-toast overrides Base UI carries through untouched as opaque `data`.\ntype ToastData = { closeButton?: boolean }\n\n// `label` is the button's content; everything else a `<button>` takes passes\n// straight through, so a caller can set `className`, `disabled`, `type`, and\n// the rest without a new prop for each one.\ntype ToastAction = Omit<\n React.ComponentPropsWithoutRef<'button'>,\n 'children'\n> & {\n label: React.ReactNode\n}\n\ntype ToastOptions = {\n description?: React.ReactNode\n /** Auto-dismiss time in ms. `0` keeps the toast until dismissed. */\n duration?: number\n /** Reuse an id to update a toast in place instead of stacking a new one. */\n id?: string\n closeButton?: boolean\n action?: ToastAction\n onDismiss?: () => void\n /** `high` announces urgently (assertive); the default is polite. */\n priority?: 'low' | 'high'\n}\n\ntype ToastPromiseMessages<Value> = {\n loading: string\n success: string | ((value: Value) => string)\n error: string | ((error: unknown) => string)\n}\n\nconst TOAST_ICONS: Record<\n Exclude<ToastType, 'loading'>,\n { name: MaterialSymbolIconName; className: string }\n> = {\n success: { name: 'check_circle', className: 'text-success-light' },\n info: { name: 'info', className: 'text-info-light' },\n warning: { name: 'warning', className: 'text-warning-light' },\n error: { name: 'cancel', className: 'text-error-light' },\n}\n\n// Opaque radix steps (bg 2, border 6, text 11) so a floating toast never lets\n// page content bleed through the way the alpha `-soft` tokens would. The border\n// carries the tone too, otherwise a tinted toast keeps a grey outline.\nconst TONE_CLASSES: Record<Exclude<ToastType, 'loading'>, string> = {\n success: 'border-green-6 bg-green-2 text-green-11',\n info: 'border-blue-6 bg-blue-2 text-blue-11',\n warning: 'border-orange-6 bg-orange-2 text-orange-11',\n error: 'border-red-6 bg-red-2 text-red-11',\n}\n\n// Mobile-first: every position drops to a full-width stack at the top, which\n// is what the end-customer portal ships. `position` only takes effect from the\n// `sm` breakpoint up.\nconst POSITION_CLASSES: Record<ToastPosition, string> = {\n 'top-left': 'sm:top-4 sm:right-auto sm:bottom-auto sm:left-4',\n 'top-center':\n 'sm:top-4 sm:right-auto sm:bottom-auto sm:left-1/2 sm:-translate-x-1/2',\n 'top-right': 'sm:top-4 sm:right-4 sm:bottom-auto sm:left-auto',\n 'bottom-left': 'sm:top-auto sm:right-auto sm:bottom-4 sm:left-4',\n 'bottom-center':\n 'sm:top-auto sm:right-auto sm:bottom-4 sm:left-1/2 sm:-translate-x-1/2',\n 'bottom-right': 'sm:top-auto sm:right-4 sm:bottom-4 sm:left-auto',\n}\n\nconst manager = ToastPrimitive.createToastManager<ToastData>()\n\nlet sequence = 0\n\n// `label` names the content and `onClick` is wrapped, so neither reaches the\n// DOM button as-is; everything else does.\nfunction actionRest({\n label: _label,\n onClick: _onClick,\n ...rest\n}: ToastAction) {\n return rest\n}\n\nfunction toManagerOptions(\n id: string,\n title: React.ReactNode,\n type: ToastType | undefined,\n options: ToastOptions | undefined,\n) {\n const action = options?.action\n return {\n id,\n title,\n type,\n description: options?.description,\n timeout: options?.duration,\n priority: options?.priority,\n onClose: options?.onDismiss,\n // Base UI leaves the toast open after an action; dismissing matches what\n // callers expect from an \"Undo\" button.\n actionProps: action && {\n ...actionRest(action),\n children: action.label,\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => {\n action.onClick?.(event)\n manager.close(id)\n },\n },\n data: { closeButton: options?.closeButton },\n }\n}\n\nconst emit =\n (type?: ToastType) =>\n (message: React.ReactNode, options?: ToastOptions): string => {\n // an id up front lets the action handler close the toast it belongs to\n const id = options?.id ?? `spark-toast-${(sequence += 1)}`\n return manager.add(toManagerOptions(id, message, type, options))\n }\n\n// A string phase becomes a titled toast of that type; an object phase keeps\n// whatever the caller set and only fills in the type.\nconst phase =\n <Value,>(\n value: ToastPromiseMessages<Value>[keyof ToastPromiseMessages<Value>],\n type: ToastType,\n ) =>\n (result: Value) => {\n const resolved = typeof value === 'function' ? value(result) : value\n return { title: resolved, type }\n }\n\nconst toast = Object.assign(emit(), {\n success: emit('success'),\n info: emit('info'),\n warning: emit('warning'),\n error: emit('error'),\n loading: emit('loading'),\n /** Dismiss one toast, or every toast when called without an id. */\n dismiss: (id?: string) => manager.close(id),\n promise: <Value,>(\n promiseValue: Promise<Value>,\n messages: ToastPromiseMessages<Value>,\n ) =>\n manager.promise(promiseValue, {\n loading: { title: messages.loading, type: 'loading' as const },\n success: phase(messages.success, 'success'),\n error: phase(messages.error as never, 'error'),\n }),\n})\n\nfunction ToastIcon({ type }: { type?: string }) {\n const icon = TOAST_ICONS[type as Exclude<ToastType, 'loading'>]\n if (type !== 'loading' && !icon) return null\n\n // Fixed box matching the title's line height, so the glyph and the spinner\n // both centre on the first line whether or not a description follows.\n return (\n <span\n aria-hidden=\"true\"\n className=\"flex h-5 w-5 shrink-0 items-center justify-center\"\n >\n {type === 'loading' ? (\n // Decorative: the toast already announces the loading message, so the\n // spinner must not add a second status live region.\n <Spinner\n className=\"text-gray-11\"\n label=\"\"\n role=\"presentation\"\n size=\"sm\"\n />\n ) : (\n <MaterialSymbol\n className={cn('[--spark-icon-size:20px]', icon.className)}\n name={icon.name}\n />\n )}\n </span>\n )\n}\n\nfunction ToastItem({\n closeButton,\n richColors,\n toast: toastObject,\n}: {\n closeButton: boolean\n richColors: boolean\n toast: ToastPrimitive.Root.ToastObject<ToastData>\n}) {\n const tone = TONE_CLASSES[toastObject.type as Exclude<ToastType, 'loading'>]\n const showClose = toastObject.data?.closeButton ?? closeButton\n\n return (\n <ToastPrimitive.Root\n data-slot=\"toast\"\n className={cn(\n // Skin only. All geometry (position, stacking, transitions, the\n // pointer bridge) lives in styles/index.css, because Tailwind's\n // `utilities` layer outranks `components` and a stray `bottom-0` here\n // would beat the stylesheet's `bottom: auto` on top-anchored stacks.\n // The border is what makes the cards behind the front one legible.\n 'flex items-start gap-2 rounded-md border border-gray-a5 bg-gray-1 p-3 text-gray shadow-md select-none',\n richColors && tone,\n )}\n // the stack is top-anchored on mobile and bottom-anchored above `sm`, so\n // both vertical directions have to dismiss\n swipeDirection={['up', 'down', 'right']}\n toast={toastObject}\n >\n <ToastIcon type={toastObject.type} />\n <ToastPrimitive.Content className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <ToastPrimitive.Title\n className=\"text-sm font-medium\"\n data-slot=\"toast-title\"\n />\n <ToastPrimitive.Description\n className={cn(\n 'text-sm',\n richColors && tone ? 'text-inherit' : 'text-gray-11',\n )}\n data-slot=\"toast-description\"\n />\n </ToastPrimitive.Content>\n {toastObject.actionProps ? (\n <ToastPrimitive.Action\n // -my-2 keeps the 36px control from stretching a single-line row past\n // the 20px text; self-center then lands it on the title when there is\n // no description, and mid-block when there is one\n className={cn(\n buttonVariants({ size: 'small', variant: 'primary' }),\n '-my-2 shrink-0 self-center rounded-full',\n )}\n data-slot=\"toast-action\"\n />\n ) : null}\n {showClose ? (\n <ToastPrimitive.Close\n aria-label=\"Close\"\n className={cn(\n buttonVariants({ size: 'icon-small', variant: 'tertiary' }),\n // -my-1: same reason as the action, for a 28px control\n '-my-1 -mr-1 size-7 shrink-0 self-center text-gray-11',\n )}\n data-slot=\"toast-close\"\n >\n <MaterialSymbol\n aria-hidden=\"true\"\n className=\"[--spark-icon-size:18px]\"\n name=\"close\"\n />\n </ToastPrimitive.Close>\n ) : null}\n </ToastPrimitive.Root>\n )\n}\n\nfunction ToastList({\n closeButton,\n richColors,\n}: {\n closeButton: boolean\n richColors: boolean\n}) {\n const { toasts } = ToastPrimitive.useToastManager<ToastData>()\n\n return toasts.map((toastObject) => (\n <ToastItem\n closeButton={closeButton}\n key={toastObject.id}\n richColors={richColors}\n toast={toastObject}\n />\n ))\n}\n\ntype ToasterProps = {\n className?: string\n /** Corner or edge the toasts stack in. */\n position?: ToastPosition\n /** Close button on every toast; a per-toast `closeButton` wins. */\n closeButton?: boolean\n /** Tinted surfaces for success/info/warning/error toasts. */\n richColors?: boolean\n /** Default auto-dismiss time in ms. `0` disables auto-dismiss. */\n duration?: number\n /** Toasts visible at once before older ones are marked `data-limited`. */\n limit?: number\n /**\n * Vertical edge below the `sm` breakpoint, where the stack is always\n * full-width and `position` does not apply. Defaults to `top`, matching the\n * end-customer portal.\n */\n mobilePosition?: 'top' | 'bottom'\n}\n\nfunction Toaster({\n className,\n closeButton = true,\n duration = 4000,\n limit,\n mobilePosition = 'top',\n position = 'bottom-right',\n richColors = true,\n}: ToasterProps) {\n return (\n <ToastPrimitive.Provider\n limit={limit}\n timeout={duration}\n toastManager={manager}\n >\n <ToastPrimitive.Portal>\n <ToastPrimitive.Viewport\n // block + zero height: the toasts are absolutely positioned against\n // this box's bottom edge, the way Base UI's stacked example works\n className={cn(\n 'fixed inset-x-4 z-50 block h-0 outline-none',\n mobilePosition === 'top' ? 'top-4' : 'bottom-4',\n 'sm:inset-x-auto sm:w-96 sm:max-w-[calc(100vw-2rem)]',\n POSITION_CLASSES[position],\n className,\n )}\n data-mobile-side={mobilePosition}\n data-side={position.startsWith('top') ? 'top' : 'bottom'}\n data-slot=\"toaster\"\n >\n <ToastList closeButton={closeButton} richColors={richColors} />\n </ToastPrimitive.Viewport>\n </ToastPrimitive.Portal>\n </ToastPrimitive.Provider>\n )\n}\n\nexport { Toaster, toast }\nexport type {\n ToastAction,\n ToasterProps,\n ToastOptions,\n ToastPosition,\n ToastPromiseMessages,\n ToastType,\n}\n"],"mappings":";;;;;;;;;;AAsDA,MAAM,cAGF;CACF,SAAS;EAAE,MAAM;EAAgB,WAAW;EAAsB;CAClE,MAAM;EAAE,MAAM;EAAQ,WAAW;EAAmB;CACpD,SAAS;EAAE,MAAM;EAAW,WAAW;EAAsB;CAC7D,OAAO;EAAE,MAAM;EAAU,WA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AA,GACrB;GACgB;;;AAI1B,SAAS,UAAU,EACjB,aACA,cAIC;CACD,MAAM,EAAE,WAAWA,MAAe,iBAA4B;AAE9D,QAAO,OAAO,KAAK,gBACjB,oBAAC,WAAD;EACe;EAED;EACZ,OAAO;EACP,EAHK,YAAY,GAGjB,CACF;;AAuBJ,SAAS,QAAQ,EACf,WACA,cAAc,MACd,WAAW,KACX,OACA,iBAAiB,OACjB,WAAW,gBACX,aAAa,QACE;AACf,QACE,oBAACA,MAAe,UAAhB;EACS;EACP,SAAS;EACT,cAAc;YAEd,oBAACA,MAAe,QAAhB,EAAA,UACE,oBAACA,MAAe,UAAhB;GAGE,WAAW,GACT,+CACA,mBAAmB,QAAQ,UAAU,YACrC,uDACA,iBAAiB,WACjB,UACD;GACD,oBAAkB;GAClB,aAAW,SAAS,WAAW,MAAM,GAAG,QAAQ;GAChD,aAAU;aAEV,oBAAC,WAAD;IAAwB;IAAyB;IAAc,CAAA;GACvC,CAAA,EACJ,CAAA;EACA,CAAA"}
@@ -0,0 +1,33 @@
1
+ "use client";
2
+
3
+ //#region src/lib/generate-radix-colors.d.ts
4
+ type ArrayOf12<T> = [T, T, T, T, T, T, T, T, T, T, T, T];
5
+ declare const generateRadixColors: ({
6
+ appearance,
7
+ ...args
8
+ }: {
9
+ appearance: "light" | "dark";
10
+ accent: string;
11
+ gray: string;
12
+ background: string;
13
+ }) => {
14
+ accentScale: ArrayOf12<string>;
15
+ accentScaleAlpha: ArrayOf12<string>;
16
+ accentScaleWideGamut: ArrayOf12<string>;
17
+ accentScaleAlphaWideGamut: ArrayOf12<string>;
18
+ accentContrast: string;
19
+ grayScale: ArrayOf12<string>;
20
+ grayScaleAlpha: ArrayOf12<string>;
21
+ grayScaleWideGamut: ArrayOf12<string>;
22
+ grayScaleAlphaWideGamut: ArrayOf12<string>;
23
+ graySurface: string;
24
+ graySurfaceWideGamut: string;
25
+ accentSurface: string;
26
+ accentSurfaceWideGamut: string;
27
+ background: string;
28
+ };
29
+ declare function transposeProgressionStart(to: number, arr: number[], curve: [number, number, number, number]): number[];
30
+ declare function transposeProgressionEnd(to: number, arr: number[], curve: [number, number, number, number]): number[];
31
+ //#endregion
32
+ export { transposeProgressionEnd as n, transposeProgressionStart as r, generateRadixColors as t };
33
+ //# sourceMappingURL=generate-radix-colors-BW09KT9m.d.ts.map
@@ -0,0 +1,33 @@
1
+ "use client";
2
+
3
+ //#region src/lib/generate-radix-colors.d.ts
4
+ type ArrayOf12<T> = [T, T, T, T, T, T, T, T, T, T, T, T];
5
+ declare const generateRadixColors: ({
6
+ appearance,
7
+ ...args
8
+ }: {
9
+ appearance: "light" | "dark";
10
+ accent: string;
11
+ gray: string;
12
+ background: string;
13
+ }) => {
14
+ accentScale: ArrayOf12<string>;
15
+ accentScaleAlpha: ArrayOf12<string>;
16
+ accentScaleWideGamut: ArrayOf12<string>;
17
+ accentScaleAlphaWideGamut: ArrayOf12<string>;
18
+ accentContrast: string;
19
+ grayScale: ArrayOf12<string>;
20
+ grayScaleAlpha: ArrayOf12<string>;
21
+ grayScaleWideGamut: ArrayOf12<string>;
22
+ grayScaleAlphaWideGamut: ArrayOf12<string>;
23
+ graySurface: string;
24
+ graySurfaceWideGamut: string;
25
+ accentSurface: string;
26
+ accentSurfaceWideGamut: string;
27
+ background: string;
28
+ };
29
+ declare function transposeProgressionStart(to: number, arr: number[], curve: [number, number, number, number]): number[];
30
+ declare function transposeProgressionEnd(to: number, arr: number[], curve: [number, number, number, number]): number[];
31
+ //#endregion
32
+ export { transposeProgressionEnd as n, transposeProgressionStart as r, generateRadixColors as t };
33
+ //# sourceMappingURL=generate-radix-colors-C5mWRWnQ.d.cts.map
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
3
  //#region src/lib/accent-colors.ts
3
4
  const accentByColor = {
4
5
  accent: void 0,
@@ -8,11 +9,6 @@ const accentByColor = {
8
9
  danger: "red"
9
10
  };
10
11
  //#endregion
11
- Object.defineProperty(exports, "accentByColor", {
12
- enumerable: true,
13
- get: function() {
14
- return accentByColor;
15
- }
16
- });
12
+ exports.accentByColor = accentByColor;
17
13
 
18
- //# sourceMappingURL=accent-colors-CjHCf8fH.cjs.map
14
+ //# sourceMappingURL=accent-colors.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accent-colors.cjs","names":[],"sources":["../../src/lib/accent-colors.ts"],"sourcesContent":["export type SparkAccentColor =\n | 'accent'\n | 'neutral'\n | 'success'\n | 'warning'\n | 'danger'\n\nexport const accentByColor: Record<\n SparkAccentColor,\n 'gray' | 'red' | 'green' | 'orange' | undefined\n> = {\n accent: undefined,\n neutral: 'gray',\n success: 'green',\n warning: 'orange',\n danger: 'red',\n}\n"],"mappings":";;;AAOA,MAAa,gBAGT;CACF,QAAQ,KAAA;CACR,SAAS;CACT,SAAS;CACT,SAAS;CACT,QAAQ;CACT"}
@@ -0,0 +1,8 @@
1
+ "use client";
2
+
3
+ //#region src/lib/accent-colors.d.ts
4
+ type SparkAccentColor = 'accent' | 'neutral' | 'success' | 'warning' | 'danger';
5
+ declare const accentByColor: Record<SparkAccentColor, 'gray' | 'red' | 'green' | 'orange' | undefined>;
6
+ //#endregion
7
+ export { SparkAccentColor, accentByColor };
8
+ //# sourceMappingURL=accent-colors.d.cts.map
@@ -0,0 +1,8 @@
1
+ "use client";
2
+
3
+ //#region src/lib/accent-colors.d.ts
4
+ type SparkAccentColor = 'accent' | 'neutral' | 'success' | 'warning' | 'danger';
5
+ declare const accentByColor: Record<SparkAccentColor, 'gray' | 'red' | 'green' | 'orange' | undefined>;
6
+ //#endregion
7
+ export { SparkAccentColor, accentByColor };
8
+ //# sourceMappingURL=accent-colors.d.ts.map
@@ -8,6 +8,6 @@ const accentByColor = {
8
8
  danger: "red"
9
9
  };
10
10
  //#endregion
11
- export { accentByColor as t };
11
+ export { accentByColor };
12
12
 
13
- //# sourceMappingURL=accent-colors-Ch2J0EEY.js.map
13
+ //# sourceMappingURL=accent-colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accent-colors.js","names":[],"sources":["../../src/lib/accent-colors.ts"],"sourcesContent":["export type SparkAccentColor =\n | 'accent'\n | 'neutral'\n | 'success'\n | 'warning'\n | 'danger'\n\nexport const accentByColor: Record<\n SparkAccentColor,\n 'gray' | 'red' | 'green' | 'orange' | undefined\n> = {\n accent: undefined,\n neutral: 'gray',\n success: 'green',\n warning: 'orange',\n danger: 'red',\n}\n"],"mappings":";;AAOA,MAAa,gBAGT;CACF,QAAQ,KAAA;CACR,SAAS;CACT,SAAS;CACT,SAAS;CACT,QAAQ;CACT"}
@@ -0,0 +1,130 @@
1
+ "use client";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const require_chunk = require("../chunk-aJGBMT86.cjs");
4
+ const require_lib_generate_radix_colors = require("./generate-radix-colors.cjs");
5
+ let _radix_ui_colors = require("@radix-ui/colors");
6
+ _radix_ui_colors = require_chunk.__toESM(_radix_ui_colors, 1);
7
+ let colorjs_io = require("colorjs.io");
8
+ colorjs_io = require_chunk.__toESM(colorjs_io, 1);
9
+ //#region src/lib/accent-theme.ts
10
+ /** Curated name → source color. `blue` = Radix blue; the no-attribute default `--spark-*` stays the epilot brand. */
11
+ const CURATED_ACCENTS = {
12
+ blue: _radix_ui_colors.blue.blue9,
13
+ indigo: _radix_ui_colors.indigo.indigo9,
14
+ violet: _radix_ui_colors.violet.violet9,
15
+ purple: _radix_ui_colors.purple.purple9,
16
+ cyan: _radix_ui_colors.cyan.cyan9,
17
+ teal: _radix_ui_colors.teal.teal9,
18
+ green: _radix_ui_colors.green.green9,
19
+ grass: _radix_ui_colors.grass.grass9,
20
+ orange: _radix_ui_colors.orange.orange9,
21
+ red: _radix_ui_colors.red.red9,
22
+ pink: _radix_ui_colors.pink.pink9,
23
+ gray: _radix_ui_colors.gray.gray9
24
+ };
25
+ /** ECP `DesignUtils` generator inputs, so a generated scale matches live portals. */
26
+ const DEFAULTS = {
27
+ light: {
28
+ gray: "#333333",
29
+ background: "#ffffff"
30
+ },
31
+ dark: {
32
+ gray: "#8b8d98",
33
+ background: "#000000"
34
+ }
35
+ };
36
+ /** Generate the Radix-style accent scale for one appearance from a single accent color. */
37
+ function generateAccentScale(accent, appearance) {
38
+ const scale = require_lib_generate_radix_colors.generateRadixColors({
39
+ appearance,
40
+ accent,
41
+ gray: DEFAULTS[appearance].gray,
42
+ background: DEFAULTS[appearance].background
43
+ });
44
+ return {
45
+ ...scale,
46
+ accentContrast: readableContrast(scale, MIN_TEXT_CONTRAST),
47
+ accentOnSolid: readableContrast(scale, MIN_GRAPHIC_CONTRAST)
48
+ };
49
+ }
50
+ const MIN_TEXT_CONTRAST = 4.5;
51
+ const MIN_GRAPHIC_CONTRAST = 3;
52
+ function readableContrast(scale, min) {
53
+ const step9 = new colorjs_io.default(scale.accentScale[8]);
54
+ const [, chroma, hue] = step9.to("oklch").coords;
55
+ const tinted = (lightness) => new colorjs_io.default("oklch", [
56
+ lightness,
57
+ Math.max(.08 * (chroma ?? 0), .04),
58
+ hue ?? 0
59
+ ]).to("srgb").toString({ format: "hex" });
60
+ const candidates = [
61
+ scale.accentContrast,
62
+ tinted(.25),
63
+ tinted(.15)
64
+ ];
65
+ const ratios = candidates.map((c) => new colorjs_io.default(c).contrast(step9, "WCAG21"));
66
+ const passing = ratios.findIndex((r) => r >= min);
67
+ if (passing !== -1) return candidates[passing];
68
+ return candidates[ratios.indexOf(Math.max(...ratios))];
69
+ }
70
+ /** sRGB `--spark-*` declarations for a generated accent scale. */
71
+ function accentSparkVars(scale) {
72
+ return sparkVars(scale.accentScale, scale.accentScaleAlpha, scale.accentContrast, scale.accentOnSolid, scale.accentSurface, scale.background);
73
+ }
74
+ /** Wide-gamut (P3) `--spark-*` declarations — for a `color-gamut: p3` `@supports` block. */
75
+ function accentSparkVarsP3(scale) {
76
+ return sparkVars(scale.accentScaleWideGamut, scale.accentScaleAlphaWideGamut, scale.accentContrast, scale.accentOnSolid, scale.accentSurfaceWideGamut, scale.background);
77
+ }
78
+ /** Radix's `grayColor="auto"` pairing (accent family → gray), mapped to our 6 neutrals. */
79
+ const NEUTRAL_BY_ACCENT = {
80
+ blue: "slate",
81
+ indigo: "slate",
82
+ cyan: "slate",
83
+ violet: "mauve",
84
+ purple: "mauve",
85
+ pink: "mauve",
86
+ red: "mauve",
87
+ teal: "sage",
88
+ green: "sage",
89
+ grass: "olive",
90
+ orange: "sand",
91
+ gray: "gray"
92
+ };
93
+ /** Radix's "auto" gray: curated names use Radix's table; a custom hex is classified by OKLCH hue. */
94
+ function getMatchingNeutral(accent) {
95
+ const byName = NEUTRAL_BY_ACCENT[accent];
96
+ if (byName) return byName;
97
+ try {
98
+ const [, chroma, hueRaw] = new colorjs_io.default(accent).to("oklch").coords;
99
+ if (!chroma || chroma < .04) return "gray";
100
+ const hue = ((hueRaw ?? 0) % 360 + 360) % 360;
101
+ if (hue >= 300 || hue < 35) return "mauve";
102
+ if (hue < 115) return "sand";
103
+ if (hue < 145) return "olive";
104
+ if (hue < 200) return "sage";
105
+ return "slate";
106
+ } catch {
107
+ return "slate";
108
+ }
109
+ }
110
+ function sparkVars(steps, alpha, contrast, onSolid, surface, background) {
111
+ const indicator = steps[8];
112
+ return [
113
+ ...steps.map((c, i) => `--spark-${i + 1}: ${c};`),
114
+ ...alpha.map((c, i) => `--spark-a${i + 1}: ${c};`),
115
+ `--spark-contrast: ${contrast};`,
116
+ `--spark-on-solid: ${onSolid};`,
117
+ `--spark-surface: ${surface};`,
118
+ `--spark-background: ${background};`,
119
+ `--spark-indicator: ${indicator};`,
120
+ `--spark-track: ${indicator};`
121
+ ];
122
+ }
123
+ //#endregion
124
+ exports.CURATED_ACCENTS = CURATED_ACCENTS;
125
+ exports.accentSparkVars = accentSparkVars;
126
+ exports.accentSparkVarsP3 = accentSparkVarsP3;
127
+ exports.generateAccentScale = generateAccentScale;
128
+ exports.getMatchingNeutral = getMatchingNeutral;
129
+
130
+ //# sourceMappingURL=accent-theme.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accent-theme.cjs","names":["RadixColors","generateRadixColors","Color"],"sources":["../../src/lib/accent-theme.ts"],"sourcesContent":["// Accent is the one runtime knob (colour math, not a CSS-var swap): generate the\n// `--spark-*` scale with the same Radix algorithm live portals use, apply as inline vars.\nimport * as RadixColors from '@radix-ui/colors'\nimport Color from 'colorjs.io'\nimport { generateRadixColors } from './generate-radix-colors'\nimport type { SparkNeutral } from './theme-types'\n\n/** Shape returned by the vendored Radix generator (it doesn't export a named type). */\nexport type GeneratedColors = ReturnType<typeof generateRadixColors>\n\n/**\n * generateAccentScale output: the raw scale, but with two readable foregrounds on the\n * solid (step-9) fill, each meeting a different WCAG bar:\n * - `accentContrast` — 4.5:1 (WCAG 1.4.3), for button/label **text**.\n * - `accentOnSolid` — 3:1 (WCAG 1.4.11), for a **graphical glyph** (the checkbox check).\n * A checkmark is graphical, not text, so it uses the looser-but-correct 3:1 bar: white\n * where it clears 3:1 (most accents, incl. neutral & red — the convention), and a dark\n * accent-tint where white is too weak (e.g. orange). Using the 4.5:1 text contrast for\n * the glyph over-darkened it (a black tick on a red/neutral checkbox).\n */\nexport type SparkAccentScale = GeneratedColors & { accentOnSolid: string }\n\nexport type Appearance = 'light' | 'dark'\n\n/** Curated name → source color. `blue` = Radix blue; the no-attribute default `--spark-*` stays the epilot brand. */\nexport const CURATED_ACCENTS: Record<string, string> = {\n blue: RadixColors.blue.blue9,\n indigo: RadixColors.indigo.indigo9,\n violet: RadixColors.violet.violet9,\n purple: RadixColors.purple.purple9,\n cyan: RadixColors.cyan.cyan9,\n teal: RadixColors.teal.teal9,\n green: RadixColors.green.green9,\n grass: RadixColors.grass.grass9,\n orange: RadixColors.orange.orange9,\n red: RadixColors.red.red9,\n pink: RadixColors.pink.pink9,\n gray: RadixColors.gray.gray9,\n}\n\n/** ECP `DesignUtils` generator inputs, so a generated scale matches live portals. */\nconst DEFAULTS: Record<Appearance, { gray: string; background: string }> = {\n light: { gray: '#333333', background: '#ffffff' },\n // Matches ECP DesignUtils' DEFAULT_DARK_BACKGROUND_COLOR -- the alpha ramp\n // is composited against this, so it must match what's actually painted.\n dark: { gray: '#8b8d98', background: '#000000' },\n}\n\n/** Generate the Radix-style accent scale for one appearance from a single accent color. */\nexport function generateAccentScale(\n accent: string,\n appearance: Appearance,\n): SparkAccentScale {\n const scale = generateRadixColors({\n appearance,\n accent,\n gray: DEFAULTS[appearance].gray,\n background: DEFAULTS[appearance].background,\n })\n // accentContrast → 4.5:1 (button text); accentOnSolid → 3:1 (graphical glyph,\n // see SparkAccentScale). Same picker, different WCAG threshold.\n return {\n ...scale,\n accentContrast: readableContrast(scale, MIN_TEXT_CONTRAST),\n accentOnSolid: readableContrast(scale, MIN_GRAPHIC_CONTRAST),\n }\n}\n\nconst MIN_TEXT_CONTRAST = 4.5 // WCAG 1.4.3 — button / label text\nconst MIN_GRAPHIC_CONTRAST = 3 // WCAG 1.4.11 — a check / indicator glyph on a solid fill\n\n// Pick the readable foreground on step 9: prefer the generator's native contrast\n// (usually white), else fall to progressively darker accent-tinted inks until one\n// clears `min`. Text uses 4.5:1; a graphical glyph (the checkmark) uses 3:1 — which\n// keeps white on most accents (incl. neutral 3.32:1, red 3.91:1) but flips to a dark\n// tint where white is too weak (e.g. orange, 2.97:1). The vendored generator keeps\n// white at APCA Lc >= 40, which can sit below both WCAG thresholds — hence this guard.\nfunction readableContrast(scale: GeneratedColors, min: number): string {\n const step9 = new Color(scale.accentScale[8]!)\n const [, chroma, hue] = step9.to('oklch').coords\n const tinted = (lightness: number) =>\n new Color('oklch', [\n lightness,\n Math.max(0.08 * (chroma ?? 0), 0.04),\n hue ?? 0,\n ])\n .to('srgb')\n .toString({ format: 'hex' })\n const candidates = [scale.accentContrast, tinted(0.25), tinted(0.15)]\n const ratios = candidates.map((c) => new Color(c).contrast(step9, 'WCAG21'))\n const passing = ratios.findIndex((r) => r >= min)\n if (passing !== -1) return candidates[passing]!\n return candidates[ratios.indexOf(Math.max(...ratios))]!\n}\n\n/** sRGB `--spark-*` declarations for a generated accent scale. */\nexport function accentSparkVars(scale: SparkAccentScale): string[] {\n return sparkVars(\n scale.accentScale,\n scale.accentScaleAlpha,\n scale.accentContrast,\n scale.accentOnSolid,\n scale.accentSurface,\n scale.background,\n )\n}\n\n/** Wide-gamut (P3) `--spark-*` declarations — for a `color-gamut: p3` `@supports` block. */\nexport function accentSparkVarsP3(scale: SparkAccentScale): string[] {\n return sparkVars(\n scale.accentScaleWideGamut,\n scale.accentScaleAlphaWideGamut,\n scale.accentContrast,\n scale.accentOnSolid,\n scale.accentSurfaceWideGamut,\n scale.background,\n )\n}\n\n/** Radix's `grayColor=\"auto\"` pairing (accent family → gray), mapped to our 6 neutrals. */\nconst NEUTRAL_BY_ACCENT: Record<string, SparkNeutral> = {\n blue: 'slate',\n indigo: 'slate',\n cyan: 'slate',\n violet: 'mauve',\n purple: 'mauve',\n pink: 'mauve',\n red: 'mauve',\n teal: 'sage',\n green: 'sage',\n grass: 'olive',\n orange: 'sand',\n gray: 'gray',\n}\n\n/** Radix's \"auto\" gray: curated names use Radix's table; a custom hex is classified by OKLCH hue. */\nexport function getMatchingNeutral(accent: string): SparkNeutral {\n const byName = NEUTRAL_BY_ACCENT[accent]\n if (byName) return byName\n try {\n const [, chroma, hueRaw] = new Color(accent).to('oklch').coords\n if (!chroma || chroma < 0.04) return 'gray'\n const hue = (((hueRaw ?? 0) % 360) + 360) % 360\n if (hue >= 300 || hue < 35) return 'mauve'\n if (hue < 115) return 'sand'\n if (hue < 145) return 'olive'\n if (hue < 200) return 'sage'\n return 'slate'\n } catch {\n return 'slate'\n }\n}\n\nfunction sparkVars(\n steps: string[],\n alpha: string[],\n contrast: string,\n onSolid: string,\n surface: string,\n background: string,\n): string[] {\n const indicator = steps[8]! // step 9 — the brand step (matches --spark-indicator/-track)\n return [\n ...steps.map((c, i) => `--spark-${i + 1}: ${c};`),\n ...alpha.map((c, i) => `--spark-a${i + 1}: ${c};`),\n `--spark-contrast: ${contrast};`,\n `--spark-on-solid: ${onSolid};`,\n `--spark-surface: ${surface};`,\n `--spark-background: ${background};`,\n `--spark-indicator: ${indicator};`,\n `--spark-track: ${indicator};`,\n ]\n}\n"],"mappings":";;;;;;;;;;AAyBA,MAAa,kBAA0C;CACrD,MAAMA,iBAAY,KAAK;CACvB,QAAQA,iBAAY,OAAO;CAC3B,QAAQA,iBAAY,OAAO;CAC3B,QAAQA,iBAAY,OAAO;CAC3B,MAAMA,iBAAY,KAAK;CACvB,MAAMA,iBAAY,KAAK;CACvB,OAAOA,iBAAY,MAAM;CACzB,OAAOA,iBAAY,MAAM;CACzB,QAAQA,iBAAY,OAAO;CAC3B,KAAKA,iBAAY,IAAI;CACrB,MAAMA,iBAAY,KAAK;CACvB,MAAMA,iBAAY,KAAK;CACxB;;AAGD,MAAM,WAAqE;CACzE,OAAO;EAAE,MAAM;EAAW,YAAY;EAAW;CAGjD,MAAM;EAAE,MAAM;EAAW,YAAY;EAAW;CACjD;;AAGD,SAAgB,oBACd,QACA,YACkB;CAClB,MAAM,QAAQC,kCAAAA,oBAAoB;EAChC;EACA;EACA,MAAM,SAAS,YAAY;EAC3B,YAAY,SAAS,YAAY;EAClC,CAAC;AAGF,QAAO;EACL,GAAG;EACH,gBAAgB,iBAAiB,OAAO,kBAAkB;EAC1D,eAAe,iBAAiB,OAAO,qBAAqB;EAC7D;;AAGH,MAAM,oBAAoB;AAC1B,MAAM,uBAAuB;AAQ7B,SAAS,iBAAiB,OAAwB,KAAqB;CACrE,MAAM,QAAQ,IAAIC,WAAAA,QAAM,MAAM,YAAY,GAAI;CAC9C,MAAM,GAAG,QAAQ,OAAO,MAAM,GAAG,QAAQ,CAAC;CAC1C,MAAM,UAAU,cACd,IAAIA,WAAAA,QAAM,SAAS;EACjB;EACA,KAAK,IAAI,OAAQ,UAAU,IAAI,IAAK;EACpC,OAAO;EACR,CAAC,CACC,GAAG,OAAO,CACV,SAAS,EAAE,QAAQ,OAAO,CAA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AM,KAAK,GAAG,MAAM,WAAW,IAAI,EAAE,IAAI,EAAE,GAAG;EACjD,GAAG,MAAM,KAAK,GAAG,MAAM,YAAY,IAAI,EAAE,IAAI,EAAE,GAAG;EAClD,qBAAqB,SAAS;EAC9B,qBAAqB,QAAQ;EAC7B,oBAAoB,QAAQ;EAC5B,uBAAuB,WAAW;EAClC,sBAAsB,UAAU;EAChC,kBAAkB,UAAU;EAC7B"}
@@ -0,0 +1,35 @@
1
+ "use client";
2
+
3
+ import { o as SparkNeutral } from "../theme-types-BwSJKdsB.cjs";
4
+ import { t as generateRadixColors } from "../generate-radix-colors-C5mWRWnQ.cjs";
5
+
6
+ //#region src/lib/accent-theme.d.ts
7
+ /** Shape returned by the vendored Radix generator (it doesn't export a named type). */
8
+ type GeneratedColors = ReturnType<typeof generateRadixColors>;
9
+ /**
10
+ * generateAccentScale output: the raw scale, but with two readable foregrounds on the
11
+ * solid (step-9) fill, each meeting a different WCAG bar:
12
+ * - `accentContrast` — 4.5:1 (WCAG 1.4.3), for button/label **text**.
13
+ * - `accentOnSolid` — 3:1 (WCAG 1.4.11), for a **graphical glyph** (the checkbox check).
14
+ * A checkmark is graphical, not text, so it uses the looser-but-correct 3:1 bar: white
15
+ * where it clears 3:1 (most accents, incl. neutral & red — the convention), and a dark
16
+ * accent-tint where white is too weak (e.g. orange). Using the 4.5:1 text contrast for
17
+ * the glyph over-darkened it (a black tick on a red/neutral checkbox).
18
+ */
19
+ type SparkAccentScale = GeneratedColors & {
20
+ accentOnSolid: string;
21
+ };
22
+ type Appearance = 'light' | 'dark';
23
+ /** Curated name → source color. `blue` = Radix blue; the no-attribute default `--spark-*` stays the epilot brand. */
24
+ declare const CURATED_ACCENTS: Record<string, string>;
25
+ /** Generate the Radix-style accent scale for one appearance from a single accent color. */
26
+ declare function generateAccentScale(accent: string, appearance: Appearance): SparkAccentScale;
27
+ /** sRGB `--spark-*` declarations for a generated accent scale. */
28
+ declare function accentSparkVars(scale: SparkAccentScale): string[];
29
+ /** Wide-gamut (P3) `--spark-*` declarations — for a `color-gamut: p3` `@supports` block. */
30
+ declare function accentSparkVarsP3(scale: SparkAccentScale): string[];
31
+ /** Radix's "auto" gray: curated names use Radix's table; a custom hex is classified by OKLCH hue. */
32
+ declare function getMatchingNeutral(accent: string): SparkNeutral;
33
+ //#endregion
34
+ export { Appearance, CURATED_ACCENTS, GeneratedColors, SparkAccentScale, accentSparkVars, accentSparkVarsP3, generateAccentScale, getMatchingNeutral };
35
+ //# sourceMappingURL=accent-theme.d.cts.map
@@ -0,0 +1,35 @@
1
+ "use client";
2
+
3
+ import { o as SparkNeutral } from "../theme-types-BKlzRiyw.js";
4
+ import { t as generateRadixColors } from "../generate-radix-colors-BW09KT9m.js";
5
+
6
+ //#region src/lib/accent-theme.d.ts
7
+ /** Shape returned by the vendored Radix generator (it doesn't export a named type). */
8
+ type GeneratedColors = ReturnType<typeof generateRadixColors>;
9
+ /**
10
+ * generateAccentScale output: the raw scale, but with two readable foregrounds on the
11
+ * solid (step-9) fill, each meeting a different WCAG bar:
12
+ * - `accentContrast` — 4.5:1 (WCAG 1.4.3), for button/label **text**.
13
+ * - `accentOnSolid` — 3:1 (WCAG 1.4.11), for a **graphical glyph** (the checkbox check).
14
+ * A checkmark is graphical, not text, so it uses the looser-but-correct 3:1 bar: white
15
+ * where it clears 3:1 (most accents, incl. neutral & red — the convention), and a dark
16
+ * accent-tint where white is too weak (e.g. orange). Using the 4.5:1 text contrast for
17
+ * the glyph over-darkened it (a black tick on a red/neutral checkbox).
18
+ */
19
+ type SparkAccentScale = GeneratedColors & {
20
+ accentOnSolid: string;
21
+ };
22
+ type Appearance = 'light' | 'dark';
23
+ /** Curated name → source color. `blue` = Radix blue; the no-attribute default `--spark-*` stays the epilot brand. */
24
+ declare const CURATED_ACCENTS: Record<string, string>;
25
+ /** Generate the Radix-style accent scale for one appearance from a single accent color. */
26
+ declare function generateAccentScale(accent: string, appearance: Appearance): SparkAccentScale;
27
+ /** sRGB `--spark-*` declarations for a generated accent scale. */
28
+ declare function accentSparkVars(scale: SparkAccentScale): string[];
29
+ /** Wide-gamut (P3) `--spark-*` declarations — for a `color-gamut: p3` `@supports` block. */
30
+ declare function accentSparkVarsP3(scale: SparkAccentScale): string[];
31
+ /** Radix's "auto" gray: curated names use Radix's table; a custom hex is classified by OKLCH hue. */
32
+ declare function getMatchingNeutral(accent: string): SparkNeutral;
33
+ //#endregion
34
+ export { Appearance, CURATED_ACCENTS, GeneratedColors, SparkAccentScale, accentSparkVars, accentSparkVarsP3, generateAccentScale, getMatchingNeutral };
35
+ //# sourceMappingURL=accent-theme.d.ts.map