@luxfi/ui 7.4.0 → 7.4.3

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 (131) hide show
  1. package/dist/avatar.cjs +7 -6
  2. package/dist/avatar.js +7 -5
  3. package/dist/badge.cjs +33 -35
  4. package/dist/badge.js +33 -35
  5. package/dist/bank.d.cts +3 -3
  6. package/dist/bank.d.ts +3 -3
  7. package/dist/checkbox.cjs +4 -4
  8. package/dist/checkbox.d.cts +3 -2
  9. package/dist/checkbox.d.ts +3 -2
  10. package/dist/checkbox.js +5 -4
  11. package/dist/chrome.cjs +960 -0
  12. package/dist/chrome.d.cts +93 -0
  13. package/dist/chrome.d.ts +93 -0
  14. package/dist/chrome.js +931 -0
  15. package/dist/drawer.cjs +86 -20
  16. package/dist/drawer.js +85 -19
  17. package/dist/expiration-selector.cjs +3 -2
  18. package/dist/expiration-selector.js +3 -2
  19. package/dist/greeks-display.cjs +6 -6
  20. package/dist/greeks-display.js +6 -6
  21. package/dist/gui.cjs +13 -0
  22. package/dist/gui.d.cts +2 -0
  23. package/dist/gui.d.ts +2 -0
  24. package/dist/gui.js +2 -0
  25. package/dist/heading.cjs +4 -2
  26. package/dist/heading.js +4 -2
  27. package/dist/iam.cjs +216 -0
  28. package/dist/iam.d.cts +65 -0
  29. package/dist/iam.d.ts +65 -0
  30. package/dist/iam.js +211 -0
  31. package/dist/icons.cjs +13 -0
  32. package/dist/icons.d.cts +1 -0
  33. package/dist/icons.d.ts +1 -0
  34. package/dist/icons.js +2 -0
  35. package/dist/identity.cjs +430 -0
  36. package/dist/identity.d.cts +64 -0
  37. package/dist/identity.d.ts +64 -0
  38. package/dist/identity.js +408 -0
  39. package/dist/index.cjs +1610 -836
  40. package/dist/index.d.cts +7 -3
  41. package/dist/index.d.ts +7 -3
  42. package/dist/index.js +1587 -831
  43. package/dist/input.cjs +3 -1
  44. package/dist/input.d.cts +3 -5
  45. package/dist/input.d.ts +3 -5
  46. package/dist/input.js +3 -1
  47. package/dist/lux.config.cjs +23 -2
  48. package/dist/lux.config.d.cts +28 -10
  49. package/dist/lux.config.d.ts +28 -10
  50. package/dist/lux.config.js +23 -2
  51. package/dist/menu.cjs +4 -4
  52. package/dist/menu.js +4 -4
  53. package/dist/next.cjs +132 -0
  54. package/dist/next.d.cts +32 -0
  55. package/dist/next.d.ts +32 -0
  56. package/dist/next.js +129 -0
  57. package/dist/option-chain.cjs +1 -1
  58. package/dist/option-chain.js +1 -1
  59. package/dist/option-position.cjs +2 -1
  60. package/dist/option-position.js +2 -1
  61. package/dist/pnl-diagram.cjs +8 -6
  62. package/dist/pnl-diagram.js +8 -6
  63. package/dist/progress.cjs +7 -6
  64. package/dist/progress.js +7 -5
  65. package/dist/provider.cjs +146 -4
  66. package/dist/provider.d.cts +15 -3
  67. package/dist/provider.d.ts +15 -3
  68. package/dist/provider.js +146 -5
  69. package/dist/radio.cjs +9 -7
  70. package/dist/radio.js +10 -7
  71. package/dist/separator.cjs +3 -1
  72. package/dist/separator.js +3 -1
  73. package/dist/slider.cjs +28 -16
  74. package/dist/slider.js +28 -15
  75. package/dist/strategy-builder.cjs +2 -1
  76. package/dist/strategy-builder.js +2 -1
  77. package/dist/switch.cjs +11 -12
  78. package/dist/switch.js +12 -12
  79. package/dist/tag.cjs +34 -36
  80. package/dist/tag.js +33 -35
  81. package/dist/textarea.cjs +3 -1
  82. package/dist/textarea.js +3 -1
  83. package/dist/tooltip.cjs +28 -30
  84. package/dist/tooltip.js +27 -29
  85. package/dist/use-narrow.cjs +46 -0
  86. package/dist/use-narrow.d.cts +12 -0
  87. package/dist/use-narrow.d.ts +12 -0
  88. package/dist/use-narrow.js +20 -0
  89. package/dist/vite.cjs +109 -0
  90. package/dist/vite.d.cts +29 -0
  91. package/dist/vite.d.ts +29 -0
  92. package/dist/vite.js +107 -0
  93. package/dist/white-label.cjs +142 -0
  94. package/dist/white-label.d.cts +59 -0
  95. package/dist/white-label.d.ts +59 -0
  96. package/dist/white-label.js +134 -0
  97. package/package.json +85 -19
  98. package/src/avatar.tsx +22 -16
  99. package/src/checkbox.tsx +15 -10
  100. package/src/chrome.tsx +459 -0
  101. package/src/drawer.tsx +83 -10
  102. package/src/engine.ts +130 -0
  103. package/src/expiration-selector.tsx +3 -2
  104. package/src/greeks-display.tsx +9 -6
  105. package/src/gui.ts +17 -0
  106. package/src/heading.tsx +12 -8
  107. package/src/iam.ts +170 -0
  108. package/src/icons.ts +18 -0
  109. package/src/identity.tsx +318 -0
  110. package/src/index.ts +44 -1
  111. package/src/input.tsx +13 -9
  112. package/src/lux.config.ts +16 -15
  113. package/src/menu.tsx +4 -4
  114. package/src/next.ts +89 -0
  115. package/src/option-chain.tsx +1 -1
  116. package/src/option-position.tsx +2 -1
  117. package/src/pnl-diagram.tsx +11 -6
  118. package/src/progress.tsx +15 -8
  119. package/src/provider.tsx +48 -7
  120. package/src/radio.tsx +15 -11
  121. package/src/separator.tsx +8 -3
  122. package/src/slider.tsx +35 -19
  123. package/src/strategy-builder.tsx +3 -2
  124. package/src/switch.tsx +17 -16
  125. package/src/textarea.tsx +8 -4
  126. package/src/tooltip.tsx +15 -24
  127. package/src/use-narrow.ts +40 -0
  128. package/src/vite.ts +80 -0
  129. package/src/white-label.ts +254 -0
  130. package/tokens.css +613 -319
  131. package/src/tokens.css +0 -438
package/dist/next.js ADDED
@@ -0,0 +1,129 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // src/engine.ts
9
+ var GUI_PACKAGES = [
10
+ "@hanzo/gui",
11
+ "@hanzogui/accordion",
12
+ "@hanzogui/adapt",
13
+ "@hanzogui/alert-dialog",
14
+ "@hanzogui/animate",
15
+ "@hanzogui/animate-presence",
16
+ "@hanzogui/avatar",
17
+ "@hanzogui/button",
18
+ "@hanzogui/card",
19
+ "@hanzogui/checkbox",
20
+ "@hanzogui/collapsible",
21
+ "@hanzogui/component-helpers",
22
+ "@hanzogui/compose-refs",
23
+ "@hanzogui/config",
24
+ "@hanzogui/context-menu",
25
+ "@hanzogui/core",
26
+ "@hanzogui/create-context",
27
+ "@hanzogui/create-menu",
28
+ "@hanzogui/dialog",
29
+ "@hanzogui/dismissable",
30
+ "@hanzogui/element",
31
+ "@hanzogui/elements",
32
+ "@hanzogui/floating",
33
+ "@hanzogui/focus-scope",
34
+ "@hanzogui/font-size",
35
+ "@hanzogui/form",
36
+ "@hanzogui/get-token",
37
+ "@hanzogui/group",
38
+ "@hanzogui/helpers",
39
+ "@hanzogui/image",
40
+ "@hanzogui/input",
41
+ "@hanzogui/label",
42
+ "@hanzogui/list-item",
43
+ "@hanzogui/menu",
44
+ "@hanzogui/popover",
45
+ "@hanzogui/popper",
46
+ "@hanzogui/portal",
47
+ "@hanzogui/progress",
48
+ "@hanzogui/radio-group",
49
+ "@hanzogui/react-native-media-driver",
50
+ "@hanzogui/remove-scroll",
51
+ "@hanzogui/scroll-view",
52
+ "@hanzogui/select",
53
+ "@hanzogui/separator",
54
+ "@hanzogui/shapes",
55
+ "@hanzogui/sheet",
56
+ "@hanzogui/slider",
57
+ "@hanzogui/spacer",
58
+ "@hanzogui/spinner",
59
+ "@hanzogui/stacks",
60
+ "@hanzogui/switch",
61
+ "@hanzogui/tabs",
62
+ "@hanzogui/text",
63
+ "@hanzogui/theme",
64
+ "@hanzogui/toast",
65
+ "@hanzogui/toggle-group",
66
+ "@hanzogui/tooltip",
67
+ "@hanzogui/use-controllable-state",
68
+ "@hanzogui/use-debounce",
69
+ "@hanzogui/use-force-update",
70
+ "@hanzogui/use-presence",
71
+ "@hanzogui/use-window-dimensions",
72
+ "@hanzogui/visually-hidden",
73
+ "@hanzogui/web",
74
+ "@hanzogui/z-index-stack",
75
+ "@luxfi/ui"
76
+ ];
77
+ var GUI_DEFINES = {
78
+ "process.env.EXPO_OS": JSON.stringify("web"),
79
+ "process.env.IS_WEB": JSON.stringify("true")
80
+ };
81
+ function guiAliases(from) {
82
+ const { createRequire } = __require("module");
83
+ const require_ = createRequire(`${from.replace(/\/?$/, "/")}noop.js`);
84
+ const alias = {};
85
+ for (const pkg of GUI_PACKAGES) {
86
+ try {
87
+ alias[`${pkg}$`] = require_.resolve(pkg);
88
+ } catch {
89
+ }
90
+ }
91
+ return alias;
92
+ }
93
+
94
+ // src/next.ts
95
+ function withLuxUi(config = {}) {
96
+ const userWebpack = config.webpack;
97
+ const engine = guiAliases(config.dir ?? process.cwd());
98
+ const { dir: _dir, ...rest } = config;
99
+ return {
100
+ ...rest,
101
+ transpilePackages: [.../* @__PURE__ */ new Set([...config.transpilePackages ?? [], ...GUI_PACKAGES])],
102
+ turbopack: {
103
+ ...config.turbopack,
104
+ resolveAlias: {
105
+ "react-native": "react-native-web",
106
+ ...config.turbopack?.resolveAlias
107
+ }
108
+ },
109
+ // Next inlines `env` into the client bundle, which is how the engine's
110
+ // module-scope platform checks get their answer under Turbopack too.
111
+ env: { EXPO_OS: "web", IS_WEB: "true", ...config.env },
112
+ webpack(webpackConfig, context) {
113
+ const next = userWebpack ? userWebpack(webpackConfig, context) : webpackConfig;
114
+ next.resolve = {
115
+ ...next.resolve,
116
+ // The app's own aliases win — an app pinning a package on purpose is not
117
+ // something the umbrella should override.
118
+ alias: { "react-native$": "react-native-web", ...engine, ...next.resolve?.alias }
119
+ };
120
+ const webpackModule = context?.webpack;
121
+ if (webpackModule?.DefinePlugin) {
122
+ next.plugins = [...next.plugins ?? [], new webpackModule.DefinePlugin({ ...GUI_DEFINES })];
123
+ }
124
+ return next;
125
+ }
126
+ };
127
+ }
128
+
129
+ export { GUI_PACKAGES, withLuxUi };
@@ -179,7 +179,7 @@ var OptionChain = React__namespace.forwardRef(
179
179
  {
180
180
  className: cn(
181
181
  "px-2 py-1 text-center font-mono tabular-nums text-xs font-semibold",
182
- isATM ? "text-amber-400 bg-zinc-800/80" : "text-zinc-300"
182
+ isATM ? "text-[var(--foreground)] bg-[var(--secondary)]" : "text-[var(--muted-foreground)]"
183
183
  ),
184
184
  children: fmt(row.strike)
185
185
  }
@@ -157,7 +157,7 @@ var OptionChain = React.forwardRef(
157
157
  {
158
158
  className: cn(
159
159
  "px-2 py-1 text-center font-mono tabular-nums text-xs font-semibold",
160
- isATM ? "text-amber-400 bg-zinc-800/80" : "text-zinc-300"
160
+ isATM ? "text-[var(--foreground)] bg-[var(--secondary)]" : "text-[var(--muted-foreground)]"
161
161
  ),
162
162
  children: fmt(row.strike)
163
163
  }
@@ -59,7 +59,8 @@ var OptionPositionCard = React__namespace.forwardRef(
59
59
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
60
60
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn(
61
61
  "inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs font-semibold",
62
- isCall ? "bg-blue-900/40 text-blue-400" : "bg-orange-900/40 text-orange-400"
62
+ // Call vs put is a rank difference, not a hue difference.
63
+ isCall ? "bg-[var(--secondary)] text-[var(--foreground)]" : "bg-[var(--muted)] text-[var(--muted-foreground)]"
63
64
  ), children: [
64
65
  position.underlying,
65
66
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono tabular-nums", children: position.strike }),
@@ -37,7 +37,8 @@ var OptionPositionCard = React.forwardRef(
37
37
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
38
38
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs("span", { className: cn(
39
39
  "inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs font-semibold",
40
- isCall ? "bg-blue-900/40 text-blue-400" : "bg-orange-900/40 text-orange-400"
40
+ // Call vs put is a rank difference, not a hue difference.
41
+ isCall ? "bg-[var(--secondary)] text-[var(--foreground)]" : "bg-[var(--muted)] text-[var(--muted-foreground)]"
41
42
  ), children: [
42
43
  position.underlying,
43
44
  /* @__PURE__ */ jsx("span", { className: "font-mono tabular-nums", children: position.strike }),
@@ -54,7 +54,9 @@ function buildPath(points, vb, width, height) {
54
54
  });
55
55
  return parts.join(" ");
56
56
  }
57
- var LEG_COLORS = ["#6366f1", "#f59e0b", "#ec4899", "#06b6d4"];
57
+ var LEG_COLORS = ["var(--chart-1)", "var(--chart-2)", "var(--chart-3)", "var(--chart-4)"];
58
+ var BREAKEVEN_COLOR = "var(--chart-1)";
59
+ var BREAKEVEN_RING = "var(--background)";
58
60
  var PnlDiagram = React__namespace.forwardRef(
59
61
  function PnlDiagram2(props, ref) {
60
62
  const {
@@ -296,13 +298,13 @@ var PnlDiagram = React__namespace.forwardRef(
296
298
  }
297
299
  ),
298
300
  breakevens.map((be, i) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
299
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: scaleX(be), cy: zeroY, r: "3", fill: "#fbbf24", stroke: "#18181b", strokeWidth: "1" }),
301
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: scaleX(be), cy: zeroY, r: "3", fill: BREAKEVEN_COLOR, stroke: BREAKEVEN_RING, strokeWidth: "1" }),
300
302
  /* @__PURE__ */ jsxRuntime.jsx(
301
303
  "text",
302
304
  {
303
305
  x: scaleX(be),
304
306
  y: PADDING.top + chartH + 14,
305
- fill: "#fbbf24",
307
+ fill: BREAKEVEN_COLOR,
306
308
  fontSize: "8",
307
309
  fontFamily: "monospace",
308
310
  textAnchor: "middle",
@@ -343,7 +345,7 @@ var PnlDiagram = React__namespace.forwardRef(
343
345
  cy: scaleY(hoverPnl),
344
346
  r: "3",
345
347
  fill: hoverPnl >= 0 ? "#22c55e" : "#ef4444",
346
- stroke: "#18181b",
348
+ stroke: BREAKEVEN_RING,
347
349
  strokeWidth: "1"
348
350
  }
349
351
  ),
@@ -355,7 +357,7 @@ var PnlDiagram = React__namespace.forwardRef(
355
357
  width: "90",
356
358
  height: "28",
357
359
  rx: "3",
358
- fill: "#18181b",
360
+ fill: BREAKEVEN_RING,
359
361
  stroke: "#3f3f46",
360
362
  strokeWidth: "1"
361
363
  }
@@ -437,7 +439,7 @@ var PnlDiagram = React__namespace.forwardRef(
437
439
  ] })
438
440
  ] }, i)),
439
441
  breakevens.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
440
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1.5 w-1.5 rounded-full bg-amber-400" }),
442
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1.5 w-1.5 rounded-full", style: { background: BREAKEVEN_COLOR } }),
441
443
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] text-zinc-500", children: [
442
444
  "BE: ",
443
445
  breakevens.map((b) => b.toFixed(1)).join(", ")
@@ -32,7 +32,9 @@ function buildPath(points, vb, width, height) {
32
32
  });
33
33
  return parts.join(" ");
34
34
  }
35
- var LEG_COLORS = ["#6366f1", "#f59e0b", "#ec4899", "#06b6d4"];
35
+ var LEG_COLORS = ["var(--chart-1)", "var(--chart-2)", "var(--chart-3)", "var(--chart-4)"];
36
+ var BREAKEVEN_COLOR = "var(--chart-1)";
37
+ var BREAKEVEN_RING = "var(--background)";
36
38
  var PnlDiagram = React.forwardRef(
37
39
  function PnlDiagram2(props, ref) {
38
40
  const {
@@ -274,13 +276,13 @@ var PnlDiagram = React.forwardRef(
274
276
  }
275
277
  ),
276
278
  breakevens.map((be, i) => /* @__PURE__ */ jsxs("g", { children: [
277
- /* @__PURE__ */ jsx("circle", { cx: scaleX(be), cy: zeroY, r: "3", fill: "#fbbf24", stroke: "#18181b", strokeWidth: "1" }),
279
+ /* @__PURE__ */ jsx("circle", { cx: scaleX(be), cy: zeroY, r: "3", fill: BREAKEVEN_COLOR, stroke: BREAKEVEN_RING, strokeWidth: "1" }),
278
280
  /* @__PURE__ */ jsx(
279
281
  "text",
280
282
  {
281
283
  x: scaleX(be),
282
284
  y: PADDING.top + chartH + 14,
283
- fill: "#fbbf24",
285
+ fill: BREAKEVEN_COLOR,
284
286
  fontSize: "8",
285
287
  fontFamily: "monospace",
286
288
  textAnchor: "middle",
@@ -321,7 +323,7 @@ var PnlDiagram = React.forwardRef(
321
323
  cy: scaleY(hoverPnl),
322
324
  r: "3",
323
325
  fill: hoverPnl >= 0 ? "#22c55e" : "#ef4444",
324
- stroke: "#18181b",
326
+ stroke: BREAKEVEN_RING,
325
327
  strokeWidth: "1"
326
328
  }
327
329
  ),
@@ -333,7 +335,7 @@ var PnlDiagram = React.forwardRef(
333
335
  width: "90",
334
336
  height: "28",
335
337
  rx: "3",
336
- fill: "#18181b",
338
+ fill: BREAKEVEN_RING,
337
339
  stroke: "#3f3f46",
338
340
  strokeWidth: "1"
339
341
  }
@@ -415,7 +417,7 @@ var PnlDiagram = React.forwardRef(
415
417
  ] })
416
418
  ] }, i)),
417
419
  breakevens.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
418
- /* @__PURE__ */ jsx("div", { className: "h-1.5 w-1.5 rounded-full bg-amber-400" }),
420
+ /* @__PURE__ */ jsx("div", { className: "h-1.5 w-1.5 rounded-full", style: { background: BREAKEVEN_COLOR } }),
419
421
  /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-zinc-500", children: [
420
422
  "BE: ",
421
423
  breakevens.map((b) => b.toFixed(1)).join(", ")
package/dist/progress.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var RadixProgress = require('@radix-ui/react-progress');
4
+ var gui = require('@hanzo/gui');
5
5
  var React = require('react');
6
6
  var clsx = require('clsx');
7
7
  var tailwindMerge = require('tailwind-merge');
@@ -25,7 +25,6 @@ function _interopNamespace(e) {
25
25
  return Object.freeze(n);
26
26
  }
27
27
 
28
- var RadixProgress__namespace = /*#__PURE__*/_interopNamespace(RadixProgress);
29
28
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
30
29
 
31
30
  // src/progress.tsx
@@ -83,10 +82,11 @@ var Progress = React__namespace.forwardRef(
83
82
  style: rootStyle,
84
83
  ...rest,
85
84
  children: /* @__PURE__ */ jsxRuntime.jsx(
86
- RadixProgress__namespace.Root,
85
+ gui.Progress,
87
86
  {
88
87
  value: percent,
89
88
  max: 100,
89
+ unstyled: true,
90
90
  className: cn(
91
91
  "w-full overflow-hidden rounded-full",
92
92
  "bg-[var(--color-progress-track)]",
@@ -95,14 +95,15 @@ var Progress = React__namespace.forwardRef(
95
95
  ),
96
96
  style: trackStyle,
97
97
  children: /* @__PURE__ */ jsxRuntime.jsx(
98
- RadixProgress__namespace.Indicator,
98
+ gui.Progress.Indicator,
99
99
  {
100
+ unstyled: true,
101
+ transition: "slow",
100
102
  className: cn(
101
- "h-full rounded-full transition-transform duration-500 ease-out",
103
+ "h-full rounded-full",
102
104
  !color && "bg-[var(--color-progress-indicator)]"
103
105
  ),
104
106
  style: {
105
- width: `${percent}%`,
106
107
  ...color && { backgroundColor: `var(--color-${color.replace(".", "-")}, ${color})` }
107
108
  }
108
109
  }
package/dist/progress.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import * as RadixProgress from '@radix-ui/react-progress';
2
+ import { Progress as Progress$1 } from '@hanzo/gui';
3
3
  import * as React from 'react';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
@@ -60,10 +60,11 @@ var Progress = React.forwardRef(
60
60
  style: rootStyle,
61
61
  ...rest,
62
62
  children: /* @__PURE__ */ jsx(
63
- RadixProgress.Root,
63
+ Progress$1,
64
64
  {
65
65
  value: percent,
66
66
  max: 100,
67
+ unstyled: true,
67
68
  className: cn(
68
69
  "w-full overflow-hidden rounded-full",
69
70
  "bg-[var(--color-progress-track)]",
@@ -72,14 +73,15 @@ var Progress = React.forwardRef(
72
73
  ),
73
74
  style: trackStyle,
74
75
  children: /* @__PURE__ */ jsx(
75
- RadixProgress.Indicator,
76
+ Progress$1.Indicator,
76
77
  {
78
+ unstyled: true,
79
+ transition: "slow",
77
80
  className: cn(
78
- "h-full rounded-full transition-transform duration-500 ease-out",
81
+ "h-full rounded-full",
79
82
  !color && "bg-[var(--color-progress-indicator)]"
80
83
  ),
81
84
  style: {
82
- width: `${percent}%`,
83
85
  ...color && { backgroundColor: `var(--color-${color.replace(".", "-")}, ${color})` }
84
86
  }
85
87
  }
package/dist/provider.cjs CHANGED
@@ -5,19 +5,144 @@ var gui = require('@hanzo/gui');
5
5
  var reactQuery = require('@tanstack/react-query');
6
6
  var React = require('react');
7
7
  var v5 = require('@hanzogui/config/v5');
8
+ var v5Css = require('@hanzogui/config/v5-css');
8
9
  var jsxRuntime = require('react/jsx-runtime');
9
10
 
10
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
12
 
12
13
  var React__default = /*#__PURE__*/_interopDefault(React);
13
14
 
15
+ // src/white-label.ts
14
16
  var LUX_BRAND = {
15
17
  lux: "#7000FF",
16
18
  zoo: "#6C5EFB",
17
19
  hanzo: "#EA580C",
18
- pars: "#1C3879"
20
+ pars: "#1C3879",
21
+ // bootno.de is its own white label with its own IdP (id.bootno.de) — accent
22
+ // taken from the bootnode console's own brand default, not invented here.
23
+ bootnode: "#3B82F6"
19
24
  };
20
25
  var PARS_GOLD = "#C8A45C";
26
+ var ORGS = {
27
+ lux: {
28
+ org: "lux",
29
+ name: "Lux",
30
+ domain: "lux.network",
31
+ iamDomain: "lux.id",
32
+ accent: LUX_BRAND.lux,
33
+ accentForeground: "#FFFFFF"
34
+ },
35
+ zoo: {
36
+ org: "zoo",
37
+ name: "Zoo",
38
+ domain: "zoo.ngo",
39
+ // Zoo's issuer is `zoolabs.id` — the one row where it is not `<org>.id`,
40
+ // and the one every hand-rolled branding map gets wrong. `id.zoo.network`
41
+ // ANSWERS, which is why it keeps being copied around, but it is an alias:
42
+ // its own discovery document advertises
43
+ // issuer https://zoolabs.id
44
+ // authorization_endpoint https://zoolabs.id/v1/iam/oauth/authorize
45
+ // jwks_uri https://zoolabs.id/v1/iam/.well-known/jwks
46
+ // so a client configured on the alias validates `iss` against a string the
47
+ // IdP never emits and rejects every token it is given — the exact shape of
48
+ // the lux.id outage. `zoo.id` is not an IdP at all (no discovery document).
49
+ iamDomain: "zoolabs.id",
50
+ accent: LUX_BRAND.zoo,
51
+ accentForeground: "#FFFFFF"
52
+ },
53
+ bootnode: {
54
+ org: "bootnode",
55
+ name: "Bootnode",
56
+ domain: "bootno.de",
57
+ iamDomain: "id.bootno.de",
58
+ accent: LUX_BRAND.lux,
59
+ accentForeground: "#FFFFFF"
60
+ },
61
+ hanzo: {
62
+ org: "hanzo",
63
+ name: "Hanzo",
64
+ domain: "hanzo.ai",
65
+ iamDomain: "hanzo.id",
66
+ accent: LUX_BRAND.hanzo,
67
+ accentForeground: "#FFFFFF"
68
+ },
69
+ pars: {
70
+ org: "pars",
71
+ name: "Pars",
72
+ domain: "pars.id",
73
+ iamDomain: "pars.id",
74
+ accent: LUX_BRAND.pars,
75
+ accentForeground: PARS_GOLD
76
+ }
77
+ };
78
+ var DOMAIN_ORG = [
79
+ ["lux.network", "lux"],
80
+ ["lux.cloud", "lux"],
81
+ ["lux.id", "lux"],
82
+ ["lux.finance", "lux"],
83
+ ["lux.market", "lux"],
84
+ ["lux.exchange", "lux"],
85
+ ["zoo.ngo", "zoo"],
86
+ ["zoo.network", "zoo"],
87
+ ["zoo.cloud", "zoo"],
88
+ ["zoolabs.id", "zoo"],
89
+ ["hanzo.ai", "hanzo"],
90
+ ["hanzo.cloud", "hanzo"],
91
+ ["hanzo.id", "hanzo"],
92
+ ["pars.id", "pars", "app"],
93
+ ["pars.network", "pars", "app"],
94
+ ["parsdao.org", "pars", "app"],
95
+ ["bootno.de", "bootnode", "platform"]
96
+ ];
97
+ var DEFAULT_ORG = "lux";
98
+ function normalizeHost(host) {
99
+ const noPort = host.trim().toLowerCase().split(":")[0] ?? "";
100
+ return noPort.replace(/\.$/, "");
101
+ }
102
+ function isUnder(host, domain) {
103
+ return host === domain || host.endsWith(`.${domain}`);
104
+ }
105
+ function matchDomain(host) {
106
+ let best;
107
+ for (const entry of DOMAIN_ORG) {
108
+ if (isUnder(host, entry[0]) && (!best || entry[0].length > best[0].length)) {
109
+ best = entry;
110
+ }
111
+ }
112
+ return best;
113
+ }
114
+ function appSlug(host, domain, pinned) {
115
+ if (pinned) return pinned;
116
+ const sub = host === domain ? "" : host.slice(0, -(domain.length + 1));
117
+ const leftmost = sub.split(".")[0] ?? "";
118
+ if (leftmost && leftmost !== "www") return leftmost;
119
+ const label = domain.split(".")[0] ?? "";
120
+ const tld = domain.split(".").slice(1).join(".");
121
+ return tld.split(".")[0] || label;
122
+ }
123
+ function isLocal(host) {
124
+ return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "0.0.0.0" || host === "[::1]" || host.endsWith(".local");
125
+ }
126
+ function resolveWhiteLabel(host) {
127
+ const h = normalizeHost(host ?? "");
128
+ const match = h ? matchDomain(h) : void 0;
129
+ const org = match ? match[1] : DEFAULT_ORG;
130
+ const identity = ORGS[org];
131
+ const app = match ? appSlug(h, match[0], match[2]) : h && isLocal(h) ? "local" : "app";
132
+ return {
133
+ ...identity,
134
+ host: h,
135
+ app,
136
+ theme: `dark_${org}`,
137
+ issuer: `https://${identity.iamDomain}`,
138
+ clientId: `${org}-${app}`
139
+ };
140
+ }
141
+ function currentHost() {
142
+ return typeof window === "undefined" ? "" : window.location.host;
143
+ }
144
+
145
+ // src/lux.config.ts
21
146
  var TRUE_BLACK = "#000000";
22
147
  var darkBase = {
23
148
  ...v5.defaultConfig.themes.dark,
@@ -39,10 +164,12 @@ var luxThemes = {
39
164
  dark_lux: brandTheme(LUX_BRAND.lux),
40
165
  dark_zoo: brandTheme(LUX_BRAND.zoo),
41
166
  dark_hanzo: brandTheme(LUX_BRAND.hanzo),
42
- dark_pars: brandTheme(LUX_BRAND.pars, { accentColor: PARS_GOLD })
167
+ dark_pars: brandTheme(LUX_BRAND.pars, { accentColor: PARS_GOLD }),
168
+ dark_bootnode: brandTheme(LUX_BRAND.bootnode)
43
169
  };
44
170
  var config = gui.createGui({
45
171
  ...v5.defaultConfig,
172
+ animations: v5Css.animations,
46
173
  settings: {
47
174
  ...v5.defaultConfig.settings,
48
175
  onlyAllowShorthands: false
@@ -68,13 +195,27 @@ var useFontBodyReset = () => {
68
195
  document.head.appendChild(style);
69
196
  }, []);
70
197
  };
198
+ var WhiteLabelContext = React__default.default.createContext(resolveWhiteLabel(""));
199
+ var useWhiteLabel = () => React__default.default.useContext(WhiteLabelContext);
200
+ var useHostWhiteLabel = (host) => {
201
+ const [resolvedHost, setResolvedHost] = React__default.default.useState(host ?? "");
202
+ React__default.default.useEffect(() => {
203
+ if (host !== void 0) return;
204
+ const browserHost = currentHost();
205
+ if (browserHost) setResolvedHost(browserHost);
206
+ }, [host]);
207
+ return React__default.default.useMemo(() => resolveWhiteLabel(resolvedHost), [resolvedHost]);
208
+ };
71
209
  var AppProvider = ({
72
210
  children,
73
211
  queryClient,
74
- defaultTheme = "dark_lux"
212
+ host,
213
+ defaultTheme
75
214
  }) => {
76
215
  useFontBodyReset();
77
- return /* @__PURE__ */ jsxRuntime.jsx(gui.GuiProvider, { config: lux_config_default, defaultTheme, children: /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient ?? defaultQueryClient, children }) });
216
+ const whiteLabel = useHostWhiteLabel(host);
217
+ const theme = defaultTheme ?? whiteLabel.theme;
218
+ return /* @__PURE__ */ jsxRuntime.jsx(WhiteLabelContext.Provider, { value: whiteLabel, children: /* @__PURE__ */ jsxRuntime.jsx(gui.GuiProvider, { config: lux_config_default, defaultTheme: theme, children: /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient ?? defaultQueryClient, children }) }) });
78
219
  };
79
220
 
80
221
  Object.defineProperty(exports, "QueryClient", {
@@ -98,3 +239,4 @@ Object.defineProperty(exports, "useQueryClient", {
98
239
  get: function () { return reactQuery.useQueryClient; }
99
240
  });
100
241
  exports.AppProvider = AppProvider;
242
+ exports.useWhiteLabel = useWhiteLabel;
@@ -1,13 +1,25 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
2
  export { QueryClient, useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
3
3
  import React__default from 'react';
4
+ import { WhiteLabel } from './white-label.cjs';
4
5
 
6
+ /** The white-label identity for the host this page is being served under. */
7
+ declare const useWhiteLabel: () => WhiteLabel;
5
8
  interface AppProviderProps {
6
9
  children: React__default.ReactNode;
7
10
  queryClient?: QueryClient;
8
- /** Lux brand child-theme row: dark_lux | dark_zoo | dark_hanzo | dark_pars */
11
+ /**
12
+ * Host header value, for server rendering. Omit in the browser and the host
13
+ * is read from `location`. Never bake a brand into a deployment — pass the
14
+ * request's host and the same image serves every org.
15
+ */
16
+ host?: string;
17
+ /**
18
+ * Escape hatch: pin the gui child-theme row (`dark_lux` | `dark_zoo` |
19
+ * `dark_hanzo` | `dark_pars`). Leave unset so the theme follows the host.
20
+ */
9
21
  defaultTheme?: string;
10
22
  }
11
- declare const AppProvider: ({ children, queryClient, defaultTheme, }: AppProviderProps) => React__default.ReactElement;
23
+ declare const AppProvider: ({ children, queryClient, host, defaultTheme, }: AppProviderProps) => React__default.ReactElement;
12
24
 
13
- export { AppProvider };
25
+ export { AppProvider, useWhiteLabel };
@@ -1,13 +1,25 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
2
  export { QueryClient, useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
3
3
  import React__default from 'react';
4
+ import { WhiteLabel } from './white-label.js';
4
5
 
6
+ /** The white-label identity for the host this page is being served under. */
7
+ declare const useWhiteLabel: () => WhiteLabel;
5
8
  interface AppProviderProps {
6
9
  children: React__default.ReactNode;
7
10
  queryClient?: QueryClient;
8
- /** Lux brand child-theme row: dark_lux | dark_zoo | dark_hanzo | dark_pars */
11
+ /**
12
+ * Host header value, for server rendering. Omit in the browser and the host
13
+ * is read from `location`. Never bake a brand into a deployment — pass the
14
+ * request's host and the same image serves every org.
15
+ */
16
+ host?: string;
17
+ /**
18
+ * Escape hatch: pin the gui child-theme row (`dark_lux` | `dark_zoo` |
19
+ * `dark_hanzo` | `dark_pars`). Leave unset so the theme follows the host.
20
+ */
9
21
  defaultTheme?: string;
10
22
  }
11
- declare const AppProvider: ({ children, queryClient, defaultTheme, }: AppProviderProps) => React__default.ReactElement;
23
+ declare const AppProvider: ({ children, queryClient, host, defaultTheme, }: AppProviderProps) => React__default.ReactElement;
12
24
 
13
- export { AppProvider };
25
+ export { AppProvider, useWhiteLabel };