@vllnt/ui 0.4.0-canary.sha36bfa21 → 0.4.0-canary.sha49f831b

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 (105) hide show
  1. package/CHANGELOG.md +170 -6
  2. package/README.md +61 -3
  3. package/dist/components/atoms/accordion/accordion.js +28 -7
  4. package/dist/components/atoms/agent-activity/agent-activity.js +1 -1
  5. package/dist/components/atoms/ai-source-citation/ai-source-citation.js +1 -1
  6. package/dist/components/atoms/alert/alert.js +1 -1
  7. package/dist/components/atoms/alert-pulse/alert-pulse.js +7 -4
  8. package/dist/components/atoms/avatar/avatar.js +129 -24
  9. package/dist/components/atoms/badge/badge.js +84 -5
  10. package/dist/components/atoms/bottom-activity-strip/bottom-activity-strip.js +3 -2
  11. package/dist/components/atoms/breadcrumb/breadcrumb.js +89 -37
  12. package/dist/components/atoms/checklist/checklist.js +2 -2
  13. package/dist/components/atoms/curriculum/curriculum.js +4 -4
  14. package/dist/components/atoms/dialog/dialog.js +4 -2
  15. package/dist/components/atoms/drawer/drawer.js +1 -1
  16. package/dist/components/atoms/dropdown-menu/dropdown-menu.js +1 -1
  17. package/dist/components/atoms/floating-toolbar/floating-toolbar.js +23 -2
  18. package/dist/components/atoms/gauge-chart/gauge-chart.js +1 -1
  19. package/dist/components/atoms/glass-progress/glass-progress.js +1 -1
  20. package/dist/components/atoms/heat-overlay/heat-overlay.js +3 -2
  21. package/dist/components/atoms/jarvis-dock/jarvis-dock.js +2 -2
  22. package/dist/components/atoms/kbd/kbd.js +41 -11
  23. package/dist/components/atoms/keyboard-shortcuts-help/keyboard-shortcuts-help.js +1 -1
  24. package/dist/components/atoms/menubar/menubar.js +1 -1
  25. package/dist/components/atoms/meter/meter.js +2 -2
  26. package/dist/components/atoms/metric-cluster/metric-cluster.js +2 -1
  27. package/dist/components/atoms/policy-delivery-panel/policy-delivery-panel.js +19 -10
  28. package/dist/components/atoms/presence-stack/presence-stack.js +1 -1
  29. package/dist/components/atoms/progress-bar/progress-bar.js +190 -30
  30. package/dist/components/atoms/pull-quote/pull-quote.js +77 -0
  31. package/dist/components/atoms/quiz/quiz.js +2 -2
  32. package/dist/components/atoms/relationship-inspector/relationship-inspector.js +1 -1
  33. package/dist/components/atoms/routing-assignment-panel/routing-assignment-panel.js +20 -11
  34. package/dist/components/atoms/runtime-overview-panel/runtime-overview-panel.js +2 -1
  35. package/dist/components/atoms/scrim/scrim.js +32 -0
  36. package/dist/components/atoms/segmented-control/segmented-control.js +2 -2
  37. package/dist/components/atoms/select/select.js +3 -3
  38. package/dist/components/atoms/sheet/sheet.js +3 -2
  39. package/dist/components/atoms/skeleton/skeleton.js +1 -1
  40. package/dist/components/atoms/state-badge-overlay/state-badge-overlay.js +14 -16
  41. package/dist/components/atoms/stepper/stepper.js +1 -1
  42. package/dist/components/atoms/sticky-metric/sticky-metric.js +2 -1
  43. package/dist/components/atoms/table/table.js +1 -1
  44. package/dist/components/atoms/table-of-contents/table-of-contents.js +1 -1
  45. package/dist/components/atoms/table-of-contents-panel/table-of-contents-panel.js +4 -4
  46. package/dist/components/atoms/tabs/tabs.js +34 -11
  47. package/dist/components/atoms/tag-group/tag-group.js +10 -5
  48. package/dist/components/atoms/tags-input/tags-input.js +1 -1
  49. package/dist/components/atoms/thread-bubble/thread-bubble.js +1 -1
  50. package/dist/components/atoms/threshold-ring/threshold-ring.js +3 -2
  51. package/dist/components/atoms/timeline/timeline.js +15 -3
  52. package/dist/components/atoms/timeline-scrubber/timeline-scrubber.js +3 -2
  53. package/dist/components/atoms/tldr-section/tldr-section.js +5 -5
  54. package/dist/components/atoms/toggle/toggle.js +1 -1
  55. package/dist/components/atoms/view-switcher/view-switcher.js +1 -1
  56. package/dist/components/atoms/viewport-bookmarks/viewport-bookmarks.js +1 -1
  57. package/dist/components/atoms/watchlist/watchlist.js +1 -1
  58. package/dist/components/atoms/workspace-switcher/workspace-switcher.js +1 -1
  59. package/dist/components/index.js +38 -2
  60. package/dist/components/molecules/ai-artifact/ai-artifact.js +2 -12
  61. package/dist/components/molecules/approval-request/approval-request.js +168 -0
  62. package/dist/components/molecules/civilization-card/civilization-card.js +1 -1
  63. package/dist/components/molecules/completion-dialog/completion-dialog.js +1 -1
  64. package/dist/components/molecules/content-intro/content-intro.js +2 -2
  65. package/dist/components/molecules/conversation-thread/conversation-thread.js +5 -5
  66. package/dist/components/molecules/cookie-consent/cookie-consent.js +188 -80
  67. package/dist/components/molecules/copy-button/use-copy-to-clipboard.js +10 -12
  68. package/dist/components/molecules/countdown-timer/countdown-timer.js +1 -1
  69. package/dist/components/molecules/credit-badge/credit-badge.js +13 -16
  70. package/dist/components/molecules/filter-bar/filter-bar.js +2 -2
  71. package/dist/components/molecules/historical-figure-card/historical-figure-card.js +1 -1
  72. package/dist/components/molecules/plan-badge/plan-badge.js +12 -13
  73. package/dist/components/molecules/pricing-table/pricing-table.js +1 -1
  74. package/dist/components/molecules/progress-tracker/progress-tracker.js +8 -17
  75. package/dist/components/molecules/sidebar/sidebar.js +24 -9
  76. package/dist/components/molecules/tour/tour.js +1 -1
  77. package/dist/components/molecules/transaction-list/transaction-list.js +7 -9
  78. package/dist/components/molecules/tutorial-filters/tutorial-filters.js +2 -2
  79. package/dist/components/molecules/usage-breakdown/usage-breakdown.js +1 -1
  80. package/dist/components/organisms/access-matrix/access-matrix.js +271 -0
  81. package/dist/components/organisms/activity-heatmap/activity-heatmap.js +1 -1
  82. package/dist/components/organisms/code-block/code-block.js +145 -81
  83. package/dist/components/organisms/cta-band/cta-band.js +79 -0
  84. package/dist/components/organisms/flow-diagram/flow-controls.js +1 -1
  85. package/dist/components/organisms/flow-diagram/flow-fullscreen.js +1 -1
  86. package/dist/components/organisms/gantt-chart/gantt-chart.js +1 -1
  87. package/dist/components/organisms/historic-timeline/historic-timeline.js +1 -1
  88. package/dist/components/organisms/navbar-saas/navbar-saas.js +1 -1
  89. package/dist/components/organisms/order-summary/order-summary.js +172 -0
  90. package/dist/components/organisms/settings-list/settings-list.js +125 -0
  91. package/dist/components/organisms/share-dialog-people/share-dialog-people.js +412 -0
  92. package/dist/components/organisms/slideshow/slideshow.js +6 -6
  93. package/dist/components/organisms/subscription-card/subscription-card.js +10 -10
  94. package/dist/components/organisms/tutorial-complete/tutorial-complete.js +2 -2
  95. package/dist/components/organisms/tutorial-mdx/tutorial-mdx.js +1 -1
  96. package/dist/index.d.ts +1143 -82
  97. package/dist/index.js +10 -0
  98. package/dist/lib/copy-text.js +64 -0
  99. package/dist/lib/status-dot.js +33 -0
  100. package/dist/tailwind-preset.js +16 -0
  101. package/package.json +17 -4
  102. package/styles.css +48 -7
  103. package/themes/default.css +48 -7
  104. package/themes/presets.css +24 -24
  105. package/themes/products.css +146 -0
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import {
4
4
  useEffect,
5
5
  useRef,
@@ -9,45 +9,59 @@ import { Check, Copy } from "lucide-react";
9
9
  import { cn } from "../../../lib/utils.js";
10
10
  import { Button } from "../../atoms/button/button.js";
11
11
  import { useCopyToClipboard } from "../../molecules/copy-button/use-copy-to-clipboard.js";
12
- function codeToken(name, fallback) {
13
- return { color: `oklch(var(--vllnt-code-${name}, ${fallback}))` };
12
+ const TOKEN_FALLBACKS = {
13
+ class: "0.5078 0.108 73.3",
14
+ comment: "0.521 0.0234 264.4",
15
+ function: "0.4882 0.2172 264.4",
16
+ keyword: "0.5236 0.211 328.8",
17
+ number: "0.5237 0.1156 76.9",
18
+ operator: "0.3496 0.0141 274.5",
19
+ string: "0.5084 0.1347 144.2",
20
+ text: "0.3496 0.0141 274.5",
21
+ variable: "0.5003 0.1821 29.5"
22
+ };
23
+ function codeToken(name) {
24
+ return {
25
+ color: `oklch(var(--vllnt-code-${name}, ${TOKEN_FALLBACKS[name]}))`
26
+ };
14
27
  }
15
28
  const CODE_THEME = {
16
- atrule: codeToken("keyword", "0.5236 0.211 328.8"),
17
- "attr-name": codeToken("number", "0.5237 0.1156 76.9"),
18
- "attr-value": codeToken("string", "0.5084 0.1347 144.2"),
19
- boolean: codeToken("number", "0.5237 0.1156 76.9"),
20
- builtin: codeToken("class", "0.5078 0.108 73.3"),
21
- cdata: codeToken("comment", "0.521 0.0234 264.4"),
22
- char: codeToken("string", "0.5084 0.1347 144.2"),
23
- "class-name": codeToken("class", "0.5078 0.108 73.3"),
24
- 'code[class*="language-"]': codeToken("text", "0.3496 0.0141 274.5"),
29
+ atrule: codeToken("keyword"),
30
+ "attr-name": codeToken("number"),
31
+ "attr-value": codeToken("string"),
32
+ boolean: codeToken("number"),
33
+ builtin: codeToken("class"),
34
+ cdata: codeToken("comment"),
35
+ char: codeToken("string"),
36
+ "class-name": codeToken("class"),
37
+ 'code[class*="language-"]': codeToken("text"),
25
38
  comment: {
26
- ...codeToken("comment", "0.521 0.0234 264.4"),
39
+ ...codeToken("comment"),
27
40
  fontStyle: "italic"
28
41
  },
29
- constant: codeToken("number", "0.5237 0.1156 76.9"),
30
- deleted: codeToken("variable", "0.5003 0.1821 29.5"),
31
- doctype: codeToken("comment", "0.521 0.0234 264.4"),
32
- entity: codeToken("operator", "0.3496 0.0141 274.5"),
33
- function: codeToken("function", "0.4882 0.2172 264.4"),
34
- important: codeToken("keyword", "0.5236 0.211 328.8"),
35
- inserted: codeToken("string", "0.5084 0.1347 144.2"),
36
- keyword: codeToken("keyword", "0.5236 0.211 328.8"),
37
- number: codeToken("number", "0.5237 0.1156 76.9"),
38
- operator: codeToken("operator", "0.3496 0.0141 274.5"),
39
- 'pre[class*="language-"]': codeToken("text", "0.3496 0.0141 274.5"),
40
- prolog: codeToken("comment", "0.521 0.0234 264.4"),
41
- property: codeToken("variable", "0.5003 0.1821 29.5"),
42
- punctuation: codeToken("operator", "0.3496 0.0141 274.5"),
43
- regex: codeToken("string", "0.5084 0.1347 144.2"),
44
- selector: codeToken("string", "0.5084 0.1347 144.2"),
45
- string: codeToken("string", "0.5084 0.1347 144.2"),
46
- symbol: codeToken("number", "0.5237 0.1156 76.9"),
47
- tag: codeToken("variable", "0.5003 0.1821 29.5"),
48
- url: codeToken("operator", "0.3496 0.0141 274.5"),
49
- variable: codeToken("variable", "0.5003 0.1821 29.5")
42
+ constant: codeToken("number"),
43
+ deleted: codeToken("variable"),
44
+ doctype: codeToken("comment"),
45
+ entity: codeToken("operator"),
46
+ function: codeToken("function"),
47
+ important: codeToken("keyword"),
48
+ inserted: codeToken("string"),
49
+ keyword: codeToken("keyword"),
50
+ number: codeToken("number"),
51
+ operator: codeToken("operator"),
52
+ 'pre[class*="language-"]': codeToken("text"),
53
+ prolog: codeToken("comment"),
54
+ property: codeToken("variable"),
55
+ punctuation: codeToken("operator"),
56
+ regex: codeToken("string"),
57
+ selector: codeToken("string"),
58
+ string: codeToken("string"),
59
+ symbol: codeToken("number"),
60
+ tag: codeToken("variable"),
61
+ url: codeToken("operator"),
62
+ variable: codeToken("variable")
50
63
  };
64
+ const WRAP_CLASS = "whitespace-pre-wrap break-words";
51
65
  function extractTextFromChildren(node) {
52
66
  if (typeof node === "string") {
53
67
  return node;
@@ -72,7 +86,11 @@ function CodeBlock({
72
86
  children,
73
87
  className,
74
88
  language = "typescript",
75
- showLanguage = false
89
+ ref,
90
+ showLanguage = false,
91
+ showLineNumbers = false,
92
+ title,
93
+ wrap = false
76
94
  }) {
77
95
  const { copied, copy } = useCopyToClipboard();
78
96
  const [highlighter, setHighlighter] = useState(
@@ -110,62 +128,108 @@ function CodeBlock({
110
128
  void copy(code);
111
129
  };
112
130
  const SyntaxHighlighter = highlighter?.SyntaxHighlighter;
113
- return /* @__PURE__ */ jsx(
131
+ const hasHeader = Boolean(title);
132
+ const languageLabel = /* @__PURE__ */ jsx("span", { className: "mr-2 text-xs font-mono text-muted-foreground uppercase tracking-wider", children: language });
133
+ const Icon = copied ? Check : Copy;
134
+ const copyControl = /* @__PURE__ */ jsxs(Fragment, { children: [
135
+ /* @__PURE__ */ jsx(
136
+ "span",
137
+ {
138
+ "aria-live": "polite",
139
+ className: cn(
140
+ "text-xs text-muted-foreground",
141
+ copied && "rounded-sm bg-background px-1"
142
+ ),
143
+ role: "status",
144
+ children: copied ? "Copied" : null
145
+ }
146
+ ),
147
+ /* @__PURE__ */ jsx(
148
+ Button,
149
+ {
150
+ "aria-label": "Copy code",
151
+ className: "size-8",
152
+ onClick: handleCopy,
153
+ size: "icon",
154
+ variant: "ghost",
155
+ children: /* @__PURE__ */ jsx(Icon, { className: "size-3" })
156
+ }
157
+ )
158
+ ] });
159
+ return /* @__PURE__ */ jsxs(
114
160
  "div",
115
161
  {
116
162
  className: cn(
117
- "relative w-full overflow-hidden rounded-md border bg-background",
163
+ "relative w-full overflow-hidden rounded-md border bg-background text-foreground",
118
164
  className
119
165
  ),
120
- children: /* @__PURE__ */ jsxs(
121
- "div",
122
- {
123
- className: "relative overflow-x-auto overflow-y-hidden touch-pan-y",
124
- ref: scrollRef,
125
- children: [
126
- SyntaxHighlighter ? /* @__PURE__ */ jsx(
127
- SyntaxHighlighter,
128
- {
129
- codeTagProps: {
130
- className: "font-mono text-sm",
131
- style: {
132
- background: "transparent",
133
- display: "block"
134
- }
135
- },
136
- customStyle: {
137
- background: "oklch(var(--background))",
138
- fontSize: "0.875rem",
139
- margin: 0,
140
- minWidth: "fit-content",
141
- overflowY: "hidden",
142
- padding: "1rem"
143
- },
144
- language,
145
- style: CODE_THEME,
146
- children: code
147
- }
148
- ) : /* @__PURE__ */ jsx("pre", { className: "m-0 min-w-fit overflow-y-hidden p-4 font-mono text-sm", children: /* @__PURE__ */ jsx("code", { className: "block bg-transparent", children: code }) }),
149
- /* @__PURE__ */ jsxs("div", { className: "absolute right-2 top-2 flex items-center gap-2", children: [
150
- showLanguage ? /* @__PURE__ */ jsx("span", { className: "text-xs font-mono text-muted-foreground uppercase tracking-wider", children: language }) : null,
151
- /* @__PURE__ */ jsx(
152
- Button,
166
+ ref,
167
+ children: [
168
+ hasHeader ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 border-b bg-muted/50 py-1 pl-4 pr-2", children: [
169
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate font-mono text-xs", children: title }),
170
+ /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center", children: [
171
+ languageLabel,
172
+ copyControl
173
+ ] })
174
+ ] }) : null,
175
+ /* @__PURE__ */ jsxs(
176
+ "div",
177
+ {
178
+ "aria-label": `${language} code`,
179
+ className: "relative overflow-x-auto overflow-y-hidden touch-pan-y focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
180
+ ref: scrollRef,
181
+ role: "region",
182
+ tabIndex: 0,
183
+ children: [
184
+ SyntaxHighlighter ? /* @__PURE__ */ jsx(
185
+ SyntaxHighlighter,
186
+ {
187
+ codeTagProps: {
188
+ className: cn(
189
+ "font-mono text-sm [&_.linenumber]:!not-italic",
190
+ wrap && WRAP_CLASS
191
+ ),
192
+ style: {
193
+ background: "transparent",
194
+ display: "block",
195
+ whiteSpace: wrap ? "pre-wrap" : "pre"
196
+ }
197
+ },
198
+ customStyle: {
199
+ background: "oklch(var(--background))",
200
+ fontSize: "0.875rem",
201
+ margin: 0,
202
+ minWidth: "fit-content",
203
+ overflowY: "hidden",
204
+ padding: "1rem"
205
+ },
206
+ language,
207
+ showLineNumbers,
208
+ style: CODE_THEME,
209
+ children: code
210
+ }
211
+ ) : /* @__PURE__ */ jsx(
212
+ "pre",
153
213
  {
154
- "aria-label": copied ? "Copied" : "Copy code",
155
- className: "size-8",
156
- onClick: handleCopy,
157
- size: "icon",
158
- variant: "ghost",
159
- children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-3" }) : /* @__PURE__ */ jsx(Copy, { className: "size-3" })
214
+ className: cn(
215
+ "m-0 min-w-fit overflow-y-hidden p-4 font-mono text-sm",
216
+ wrap && WRAP_CLASS
217
+ ),
218
+ children: /* @__PURE__ */ jsx("code", { className: "block bg-transparent", children: code })
160
219
  }
161
- )
162
- ] })
163
- ]
164
- }
165
- )
220
+ ),
221
+ hasHeader ? null : /* @__PURE__ */ jsxs("div", { className: "absolute right-2 top-2 flex items-center", children: [
222
+ showLanguage ? languageLabel : null,
223
+ copyControl
224
+ ] })
225
+ ]
226
+ }
227
+ )
228
+ ]
166
229
  }
167
230
  );
168
231
  }
232
+ CodeBlock.displayName = "CodeBlock";
169
233
  export {
170
234
  CodeBlock
171
235
  };
@@ -0,0 +1,79 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import { cn } from "../../../lib/utils.js";
4
+ import { Heading } from "../../atoms/heading/heading.js";
5
+ import { Separator } from "../../atoms/separator/separator.js";
6
+ import { Text } from "../../atoms/text/text.js";
7
+ const ctaBandVariants = cva(
8
+ "flex w-full flex-col gap-6 border-y border-border px-6 py-10 text-foreground md:flex-row md:items-center md:justify-between md:gap-10 md:px-10 md:py-12",
9
+ {
10
+ defaultVariants: {
11
+ tone: "default"
12
+ },
13
+ variants: {
14
+ tone: {
15
+ default: "bg-background",
16
+ muted: "bg-muted"
17
+ }
18
+ }
19
+ }
20
+ );
21
+ const CtaBand = ({
22
+ actions,
23
+ className,
24
+ description,
25
+ divider = false,
26
+ headingLevel = 2,
27
+ icon,
28
+ ref: reference,
29
+ title,
30
+ tone = "default",
31
+ ...props
32
+ }) => /* @__PURE__ */ jsxs(
33
+ "section",
34
+ {
35
+ className: cn(ctaBandVariants({ tone }), className),
36
+ "data-slot": "cta-band",
37
+ "data-tone": tone,
38
+ ref: reference,
39
+ ...props,
40
+ children: [
41
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-3", children: [
42
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
43
+ icon ? /* @__PURE__ */ jsx(
44
+ "span",
45
+ {
46
+ "aria-hidden": "true",
47
+ className: "inline-flex shrink-0 text-muted-foreground [&_svg]:size-6",
48
+ "data-slot": "cta-band-icon",
49
+ children: icon
50
+ }
51
+ ) : null,
52
+ /* @__PURE__ */ jsx(Heading, { level: headingLevel, size: 2, children: title })
53
+ ] }),
54
+ divider ? /* @__PURE__ */ jsx(Separator, { "data-slot": "cta-band-divider" }) : null,
55
+ description ? /* @__PURE__ */ jsx(
56
+ Text,
57
+ {
58
+ "data-slot": "cta-band-description",
59
+ size: "lead",
60
+ tone: tone === "muted" ? "default" : "muted",
61
+ children: description
62
+ }
63
+ ) : null
64
+ ] }),
65
+ actions ? /* @__PURE__ */ jsx(
66
+ "div",
67
+ {
68
+ className: "flex shrink-0 flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center",
69
+ "data-slot": "cta-band-actions",
70
+ children: actions
71
+ }
72
+ ) : null
73
+ ]
74
+ }
75
+ );
76
+ CtaBand.displayName = "CtaBand";
77
+ export {
78
+ CtaBand
79
+ };
@@ -12,7 +12,7 @@ import {
12
12
  X
13
13
  } from "lucide-react";
14
14
  import { cn } from "../../../lib/utils.js";
15
- const BUTTON_CLASS = "flex size-8 items-center justify-center rounded hover:bg-muted transition-colors disabled:opacity-50 disabled:cursor-not-allowed";
15
+ const BUTTON_CLASS = "flex size-8 items-center justify-center rounded hover:bg-secondary transition-colors disabled:opacity-50 disabled:cursor-not-allowed";
16
16
  function ControlButton({
17
17
  disabled,
18
18
  icon,
@@ -33,7 +33,7 @@ const FlowFullscreen = memo(function FlowFullscreen2({
33
33
  "button",
34
34
  {
35
35
  "aria-label": "Close fullscreen",
36
- className: "flex size-8 items-center justify-center rounded hover:bg-muted transition-colors",
36
+ className: "flex size-8 items-center justify-center rounded hover:bg-secondary transition-colors",
37
37
  onClick: onClose,
38
38
  title: "Close fullscreen (Esc)",
39
39
  type: "button",
@@ -18,7 +18,7 @@ const COLOR_CLASSES = {
18
18
  progress: "bg-emerald-600 dark:bg-emerald-500"
19
19
  },
20
20
  neutral: {
21
- bar: "bg-muted",
21
+ bar: "bg-secondary",
22
22
  progress: "bg-muted-foreground"
23
23
  },
24
24
  purple: {
@@ -20,7 +20,7 @@ const COLOR_PALETTE = {
20
20
  marker: "border-emerald-500 bg-emerald-500"
21
21
  },
22
22
  neutral: {
23
- band: "bg-muted",
23
+ band: "bg-secondary",
24
24
  chip: "bg-muted text-muted-foreground",
25
25
  marker: "border-muted-foreground bg-muted-foreground"
26
26
  },
@@ -57,7 +57,7 @@ function NavbarSaas({
57
57
  {
58
58
  "aria-current": pathname === getHrefPathname(item.href) ? "page" : void 0,
59
59
  className: cn(
60
- "text-sm font-medium transition-colors hover:text-foreground/80",
60
+ "inline-flex min-h-6 items-center text-sm font-medium transition-colors hover:text-foreground/80",
61
61
  pathname === getHrefPathname(item.href) ? "text-foreground" : "text-foreground/60"
62
62
  ),
63
63
  href: item.href,
@@ -0,0 +1,172 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cva } from "class-variance-authority";
5
+ import { cn } from "../../../lib/utils.js";
6
+ import { Button } from "../../atoms/button/button.js";
7
+ import { Card } from "../../atoms/card/card.js";
8
+ import { Input } from "../../atoms/input/input.js";
9
+ import { Label } from "../../atoms/label/label.js";
10
+ import { Separator } from "../../atoms/separator/separator.js";
11
+ import { Spinner } from "../../atoms/spinner/spinner.js";
12
+ const DEFAULT_APPLY_LABEL = "Apply";
13
+ const DEFAULT_CHECKOUT_LABEL = "Checkout";
14
+ const DEFAULT_PROMO_ERROR = "This code can't be applied";
15
+ const DEFAULT_PROMO_TITLE = "Promo code";
16
+ const surfaceVariants = cva("flex w-full flex-col", {
17
+ defaultVariants: { layout: "desktop" },
18
+ variants: {
19
+ layout: {
20
+ desktop: "gap-4 p-6",
21
+ phone: "gap-3 p-4"
22
+ }
23
+ }
24
+ });
25
+ function SummaryRow({
26
+ emphasis = false,
27
+ line
28
+ }) {
29
+ return /* @__PURE__ */ jsxs(
30
+ "div",
31
+ {
32
+ className: cn(
33
+ "flex items-baseline justify-between gap-4",
34
+ emphasis && "text-base font-semibold"
35
+ ),
36
+ children: [
37
+ /* @__PURE__ */ jsx("dt", { className: cn(!emphasis && "text-muted-foreground"), children: line.label }),
38
+ /* @__PURE__ */ jsx("dd", { className: "text-right tabular-nums", children: line.value })
39
+ ]
40
+ }
41
+ );
42
+ }
43
+ function SummaryRows({ lines, total }) {
44
+ return /* @__PURE__ */ jsxs("dl", { className: "flex flex-col gap-2 text-sm", children: [
45
+ lines.map((line, index) => /* @__PURE__ */ jsx(SummaryRow, { line }, `${String(index)}-${line.label}`)),
46
+ /* @__PURE__ */ jsx(SummaryRow, { emphasis: true, line: total })
47
+ ] });
48
+ }
49
+ function PromoForm({ promo }) {
50
+ const baseId = React.useId();
51
+ const inputId = `${baseId}-promo`;
52
+ const hintId = `${baseId}-promo-hint`;
53
+ const status = promo.status ?? "idle";
54
+ const isApplying = status === "applying";
55
+ const isError = status === "error";
56
+ const errorWords = promo.labels?.error ?? DEFAULT_PROMO_ERROR;
57
+ const hint = promo.hint || (isError ? errorWords : "");
58
+ const handleSubmit = (event) => {
59
+ event.preventDefault();
60
+ if (!isApplying) {
61
+ promo.onApply();
62
+ }
63
+ };
64
+ return /* @__PURE__ */ jsxs("form", { className: "flex flex-col gap-2", onSubmit: handleSubmit, children: [
65
+ /* @__PURE__ */ jsx(Label, { htmlFor: inputId, children: promo.labels?.title ?? DEFAULT_PROMO_TITLE }),
66
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
67
+ /* @__PURE__ */ jsx(
68
+ Input,
69
+ {
70
+ "aria-describedby": hint ? hintId : void 0,
71
+ "aria-invalid": isError ? true : void 0,
72
+ className: cn(isError && "border-destructive"),
73
+ id: inputId,
74
+ onChange: (event) => {
75
+ promo.onValueChange(event.currentTarget.value);
76
+ },
77
+ placeholder: promo.labels?.placeholder,
78
+ value: promo.value
79
+ }
80
+ ),
81
+ /* @__PURE__ */ jsxs(Button, { disabled: isApplying, type: "submit", variant: "outline", children: [
82
+ isApplying ? /* @__PURE__ */ jsx(Spinner, { size: "sm" }) : null,
83
+ promo.labels?.apply ?? DEFAULT_APPLY_LABEL
84
+ ] })
85
+ ] }),
86
+ hint ? /* @__PURE__ */ jsx(
87
+ "p",
88
+ {
89
+ className: cn(
90
+ "text-xs",
91
+ isError ? "text-destructive" : "text-muted-foreground"
92
+ ),
93
+ id: hintId,
94
+ role: isError ? "alert" : void 0,
95
+ children: hint
96
+ }
97
+ ) : null
98
+ ] });
99
+ }
100
+ function CheckoutButton({
101
+ label,
102
+ loading,
103
+ onCheckout
104
+ }) {
105
+ return /* @__PURE__ */ jsxs(
106
+ Button,
107
+ {
108
+ "aria-busy": loading ? true : void 0,
109
+ className: "w-full",
110
+ disabled: loading,
111
+ onClick: () => {
112
+ onCheckout?.();
113
+ },
114
+ size: "lg",
115
+ type: "button",
116
+ children: [
117
+ loading ? /* @__PURE__ */ jsx(Spinner, { size: "sm" }) : null,
118
+ label
119
+ ]
120
+ }
121
+ );
122
+ }
123
+ const OrderSummary = ({
124
+ checkoutLabel = DEFAULT_CHECKOUT_LABEL,
125
+ checkoutLoading = false,
126
+ className,
127
+ layout = "desktop",
128
+ lines,
129
+ onCheckout,
130
+ promo,
131
+ ref: reference,
132
+ title,
133
+ total,
134
+ ...props
135
+ }) => {
136
+ const titleId = React.useId();
137
+ return /* @__PURE__ */ jsx(
138
+ "section",
139
+ {
140
+ "aria-labelledby": title ? titleId : void 0,
141
+ className,
142
+ "data-layout": layout,
143
+ ref: reference,
144
+ ...props,
145
+ children: /* @__PURE__ */ jsxs(Card, { className: surfaceVariants({ layout }), children: [
146
+ title ? /* @__PURE__ */ jsx(
147
+ "h2",
148
+ {
149
+ className: "text-lg font-semibold leading-none tracking-tight",
150
+ id: titleId,
151
+ children: title
152
+ }
153
+ ) : null,
154
+ /* @__PURE__ */ jsx(SummaryRows, { lines, total }),
155
+ /* @__PURE__ */ jsx(Separator, {}),
156
+ promo ? /* @__PURE__ */ jsx(PromoForm, { promo }) : null,
157
+ /* @__PURE__ */ jsx(
158
+ CheckoutButton,
159
+ {
160
+ label: checkoutLabel,
161
+ loading: checkoutLoading,
162
+ onCheckout
163
+ }
164
+ )
165
+ ] })
166
+ }
167
+ );
168
+ };
169
+ OrderSummary.displayName = "OrderSummary";
170
+ export {
171
+ OrderSummary
172
+ };