@sovereignsquad/gds-core 3.9.0 → 6.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/dist/GdsBadge-DqTdnomt.d.mts +417 -0
- package/dist/GdsBadge-DqTdnomt.d.ts +417 -0
- package/dist/PartnerDiscovery-As_-JKtb.d.ts +732 -0
- package/dist/PartnerDiscovery-Bwxixtka.d.mts +732 -0
- package/dist/QuickStartCard-Bgjdfs_t.d.ts +20798 -0
- package/dist/QuickStartCard-DnZMDjzb.d.mts +20798 -0
- package/dist/chunk-3B5MK2PG.mjs +6349 -0
- package/dist/{chunk-TQ7ZYMEA.mjs → chunk-5G3XZWSW.mjs} +4916 -6400
- package/dist/chunk-5GH7XD7X.mjs +430 -0
- package/dist/chunk-6WDH57MJ.mjs +430 -0
- package/dist/chunk-A32PWTD2.mjs +430 -0
- package/dist/chunk-BD5XQH5Z.mjs +430 -0
- package/dist/chunk-DBJE4TRO.mjs +430 -0
- package/dist/chunk-EQ7Y2PUI.mjs +1842 -0
- package/dist/chunk-F76YTG3S.mjs +430 -0
- package/dist/chunk-HJVDKPVW.mjs +245 -0
- package/dist/chunk-IMT3UTOT.mjs +430 -0
- package/dist/chunk-J66ITCXC.mjs +473 -0
- package/dist/chunk-KEYBUMOR.mjs +430 -0
- package/dist/chunk-KLFTBWEG.mjs +430 -0
- package/dist/chunk-KNP35WAB.mjs +27 -0
- package/dist/chunk-LERXSJHD.mjs +430 -0
- package/dist/chunk-MKEWYVTJ.mjs +430 -0
- package/dist/chunk-NTNVQZJU.mjs +89 -0
- package/dist/chunk-OH5HH4G3.mjs +430 -0
- package/dist/chunk-SPPTDVJC.mjs +211 -0
- package/dist/chunk-W5O2JSVK.mjs +20 -0
- package/dist/{chunk-BUC7QXRO.mjs → chunk-WI24JME4.mjs} +13 -5
- package/dist/chunk-ZFGYQSNR.mjs +33 -0
- package/dist/client.d.mts +1616 -64
- package/dist/client.d.ts +1616 -64
- package/dist/client.js +13417 -6683
- package/dist/client.mjs +303 -60
- package/dist/en-D9CWSH3F.d.mts +428 -0
- package/dist/en-D9CWSH3F.d.ts +428 -0
- package/dist/index.d.mts +632 -5
- package/dist/index.d.ts +632 -5
- package/dist/index.js +22423 -13558
- package/dist/index.mjs +2198 -61
- package/dist/locales/lazy/all.d.mts +2 -0
- package/dist/locales/lazy/all.d.ts +2 -0
- package/dist/locales/lazy/all.js +5150 -0
- package/dist/locales/lazy/all.mjs +50 -0
- package/dist/locales/lazy/ar.d.mts +2 -0
- package/dist/locales/lazy/ar.d.ts +2 -0
- package/dist/locales/lazy/ar.js +870 -0
- package/dist/locales/lazy/ar.mjs +10 -0
- package/dist/locales/lazy/de.d.mts +2 -0
- package/dist/locales/lazy/de.d.ts +2 -0
- package/dist/locales/lazy/de.js +870 -0
- package/dist/locales/lazy/de.mjs +10 -0
- package/dist/locales/lazy/es.d.mts +2 -0
- package/dist/locales/lazy/es.d.ts +2 -0
- package/dist/locales/lazy/es.js +870 -0
- package/dist/locales/lazy/es.mjs +10 -0
- package/dist/locales/lazy/fr.d.mts +2 -0
- package/dist/locales/lazy/fr.d.ts +2 -0
- package/dist/locales/lazy/fr.js +870 -0
- package/dist/locales/lazy/fr.mjs +10 -0
- package/dist/locales/lazy/he.d.mts +2 -0
- package/dist/locales/lazy/he.d.ts +2 -0
- package/dist/locales/lazy/he.js +870 -0
- package/dist/locales/lazy/he.mjs +10 -0
- package/dist/locales/lazy/hu.d.mts +2 -0
- package/dist/locales/lazy/hu.d.ts +2 -0
- package/dist/locales/lazy/hu.js +870 -0
- package/dist/locales/lazy/hu.mjs +10 -0
- package/dist/locales/lazy/index.d.mts +25 -0
- package/dist/locales/lazy/index.d.ts +25 -0
- package/dist/locales/lazy/index.js +479 -0
- package/dist/locales/lazy/index.mjs +9 -0
- package/dist/locales/lazy/it.d.mts +2 -0
- package/dist/locales/lazy/it.d.ts +2 -0
- package/dist/locales/lazy/it.js +870 -0
- package/dist/locales/lazy/it.mjs +10 -0
- package/dist/locales/lazy/ja.d.mts +2 -0
- package/dist/locales/lazy/ja.d.ts +2 -0
- package/dist/locales/lazy/ja.js +870 -0
- package/dist/locales/lazy/ja.mjs +10 -0
- package/dist/locales/lazy/ko.d.mts +2 -0
- package/dist/locales/lazy/ko.d.ts +2 -0
- package/dist/locales/lazy/ko.js +870 -0
- package/dist/locales/lazy/ko.mjs +10 -0
- package/dist/locales/lazy/ru.d.mts +2 -0
- package/dist/locales/lazy/ru.d.ts +2 -0
- package/dist/locales/lazy/ru.js +870 -0
- package/dist/locales/lazy/ru.mjs +10 -0
- package/dist/locales/lazy/zh.d.mts +2 -0
- package/dist/locales/lazy/zh.d.ts +2 -0
- package/dist/locales/lazy/zh.js +870 -0
- package/dist/locales/lazy/zh.mjs +10 -0
- package/dist/map.css +658 -0
- package/dist/map.d.mts +118 -0
- package/dist/map.d.ts +118 -0
- package/dist/map.js +778 -0
- package/dist/map.mjs +395 -0
- package/dist/reference-theme-explorer.d.mts +34 -0
- package/dist/reference-theme-explorer.d.ts +34 -0
- package/dist/reference-theme-explorer.js +9488 -0
- package/dist/reference-theme-explorer.mjs +1988 -0
- package/dist/rich-text-editor.d.mts +32 -0
- package/dist/rich-text-editor.d.ts +32 -0
- package/dist/rich-text-editor.js +469 -0
- package/dist/rich-text-editor.mjs +115 -0
- package/dist/server.d.mts +112 -248
- package/dist/server.d.ts +112 -248
- package/dist/server.js +8461 -1889
- package/dist/server.mjs +598 -57
- package/package.json +110 -10
- package/dist/AISearchCard-Bbnsd-yl.d.mts +0 -7786
- package/dist/AISearchCard-Bbnsd-yl.d.ts +0 -7786
- package/dist/chunk-5AJJNRZF.mjs +0 -5847
|
@@ -0,0 +1,1842 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GdsBadgeShapes,
|
|
3
|
+
GdsBadgeStack,
|
|
4
|
+
GdsBadgeStackLayer,
|
|
5
|
+
StateBlock,
|
|
6
|
+
resolveSurfacePresentationStyles
|
|
7
|
+
} from "./chunk-SPPTDVJC.mjs";
|
|
8
|
+
import {
|
|
9
|
+
GdsIcon,
|
|
10
|
+
GdsIcons
|
|
11
|
+
} from "./chunk-J66ITCXC.mjs";
|
|
12
|
+
import {
|
|
13
|
+
ko
|
|
14
|
+
} from "./chunk-F76YTG3S.mjs";
|
|
15
|
+
import {
|
|
16
|
+
ru
|
|
17
|
+
} from "./chunk-KLFTBWEG.mjs";
|
|
18
|
+
import {
|
|
19
|
+
zh
|
|
20
|
+
} from "./chunk-DBJE4TRO.mjs";
|
|
21
|
+
import {
|
|
22
|
+
de
|
|
23
|
+
} from "./chunk-5GH7XD7X.mjs";
|
|
24
|
+
import {
|
|
25
|
+
es
|
|
26
|
+
} from "./chunk-MKEWYVTJ.mjs";
|
|
27
|
+
import {
|
|
28
|
+
fr
|
|
29
|
+
} from "./chunk-6WDH57MJ.mjs";
|
|
30
|
+
import {
|
|
31
|
+
he
|
|
32
|
+
} from "./chunk-LERXSJHD.mjs";
|
|
33
|
+
import {
|
|
34
|
+
hu
|
|
35
|
+
} from "./chunk-IMT3UTOT.mjs";
|
|
36
|
+
import {
|
|
37
|
+
it
|
|
38
|
+
} from "./chunk-OH5HH4G3.mjs";
|
|
39
|
+
import {
|
|
40
|
+
ja
|
|
41
|
+
} from "./chunk-A32PWTD2.mjs";
|
|
42
|
+
import {
|
|
43
|
+
ar
|
|
44
|
+
} from "./chunk-KEYBUMOR.mjs";
|
|
45
|
+
import {
|
|
46
|
+
en
|
|
47
|
+
} from "./chunk-BD5XQH5Z.mjs";
|
|
48
|
+
|
|
49
|
+
// src/vocabulary.ts
|
|
50
|
+
var GdsVocabulary = {
|
|
51
|
+
settings: { id: "gds.action.settings", defaultMessage: "Settings", icon: GdsIcons.Settings, feedback: { icon: GdsIcons.Settings, color: "teal", messageId: "gds.feedback.saved" } },
|
|
52
|
+
analytics: { id: "gds.action.analytics", defaultMessage: "Analytics", icon: GdsIcons.Analytics, feedback: { icon: GdsIcons.Analytics, color: "teal", messageId: "gds.feedback.loaded" } },
|
|
53
|
+
dashboard: { id: "gds.action.dashboard", defaultMessage: "Dashboard", icon: GdsIcons.Dashboard, feedback: { icon: GdsIcons.Dashboard, color: "teal", messageId: "gds.feedback.loaded" } },
|
|
54
|
+
play: { id: "gds.action.play", defaultMessage: "Play", icon: GdsIcons.Play, feedback: { icon: GdsIcons.Play, color: "teal", messageId: "gds.feedback.started" } },
|
|
55
|
+
start: { id: "gds.action.start", defaultMessage: "Start", icon: GdsIcons.Start, feedback: { icon: GdsIcons.Start, color: "teal", messageId: "gds.feedback.started" } },
|
|
56
|
+
users: { id: "gds.action.users", defaultMessage: "Users", icon: GdsIcons.Users, feedback: { icon: GdsIcons.Users, color: "teal", messageId: "gds.feedback.loaded" } },
|
|
57
|
+
add: { id: "gds.action.add", defaultMessage: "Add", icon: GdsIcons.Add, feedback: { icon: GdsIcons.Add, color: "teal", messageId: "gds.feedback.added" } },
|
|
58
|
+
edit: { id: "gds.action.edit", defaultMessage: "Edit", icon: GdsIcons.Edit, feedback: { icon: GdsIcons.Edit, color: "teal", messageId: "gds.feedback.edited" } },
|
|
59
|
+
delete: { id: "gds.action.delete", defaultMessage: "Delete", icon: GdsIcons.Delete, feedback: { icon: GdsIcons.Delete, color: "red", messageId: "gds.feedback.deleted" } },
|
|
60
|
+
save: { id: "gds.action.save", defaultMessage: "Save", icon: GdsIcons.Save, feedback: { icon: GdsIcons.Save, color: "teal", messageId: "gds.feedback.saved" } },
|
|
61
|
+
cancel: { id: "gds.action.cancel", defaultMessage: "Cancel", icon: GdsIcons.Cancel, feedback: { icon: GdsIcons.Cancel, color: "red", messageId: "gds.feedback.canceled" } },
|
|
62
|
+
confirm: { id: "gds.action.confirm", defaultMessage: "Confirm", icon: GdsIcons.Confirm, feedback: { icon: GdsIcons.Confirm, color: "teal", messageId: "gds.feedback.confirmed" } },
|
|
63
|
+
close: { id: "gds.action.close", defaultMessage: "Close", icon: GdsIcons.Close, feedback: { icon: GdsIcons.Close, color: "gray", messageId: "gds.feedback.closed" } },
|
|
64
|
+
language: { id: "gds.action.language", defaultMessage: "Language", icon: GdsIcons.Language, feedback: { icon: GdsIcons.Language, color: "teal", messageId: "gds.feedback.changed" } },
|
|
65
|
+
theme: { id: "gds.action.theme", defaultMessage: "Theme", icon: GdsIcons.Theme, feedback: { icon: GdsIcons.Theme, color: "teal", messageId: "gds.feedback.changed" } },
|
|
66
|
+
home: { id: "gds.action.home", defaultMessage: "Home", icon: GdsIcons.Home, feedback: { icon: GdsIcons.Home, color: "teal", messageId: "gds.feedback.opened" } },
|
|
67
|
+
inbox: { id: "gds.action.inbox", defaultMessage: "Inbox", icon: GdsIcons.Inbox, feedback: { icon: GdsIcons.Inbox, color: "teal", messageId: "gds.feedback.opened" } },
|
|
68
|
+
calendar: { id: "gds.action.calendar", defaultMessage: "Calendar", icon: GdsIcons.Calendar, feedback: { icon: GdsIcons.Calendar, color: "teal", messageId: "gds.feedback.opened" } },
|
|
69
|
+
gallery: { id: "gds.action.gallery", defaultMessage: "Gallery", icon: GdsIcons.Gallery, feedback: { icon: GdsIcons.Gallery, color: "teal", messageId: "gds.feedback.opened" } },
|
|
70
|
+
history: { id: "gds.action.history", defaultMessage: "History", icon: GdsIcons.History, feedback: { icon: GdsIcons.History, color: "teal", messageId: "gds.feedback.opened" } },
|
|
71
|
+
profile: { id: "gds.action.profile", defaultMessage: "Profile", icon: GdsIcons.Profile, feedback: { icon: GdsIcons.Profile, color: "teal", messageId: "gds.feedback.opened" } },
|
|
72
|
+
send: { id: "gds.action.send", defaultMessage: "Send", icon: GdsIcons.Send, feedback: { icon: GdsIcons.Send, color: "blue", messageId: "gds.feedback.sent" } },
|
|
73
|
+
reply: { id: "gds.action.reply", defaultMessage: "Reply", icon: GdsIcons.Reply, feedback: { icon: GdsIcons.Reply, color: "blue", messageId: "gds.feedback.replied" } },
|
|
74
|
+
forward: { id: "gds.action.forward", defaultMessage: "Forward", icon: GdsIcons.Forward, feedback: { icon: GdsIcons.Forward, color: "blue", messageId: "gds.feedback.forwarded" } },
|
|
75
|
+
attach: { id: "gds.action.attach", defaultMessage: "Attach", icon: GdsIcons.Attach, feedback: { icon: GdsIcons.Attach, color: "teal", messageId: "gds.feedback.attached" } },
|
|
76
|
+
upload: { id: "gds.action.upload", defaultMessage: "Upload", icon: GdsIcons.Upload, feedback: { icon: GdsIcons.Upload, color: "teal", messageId: "gds.feedback.uploaded" } },
|
|
77
|
+
download: { id: "gds.action.download", defaultMessage: "Download", icon: GdsIcons.Download, feedback: { icon: GdsIcons.Download, color: "teal", messageId: "gds.feedback.downloaded" } },
|
|
78
|
+
print: { id: "gds.action.print", defaultMessage: "Print", icon: GdsIcons.Print, feedback: { icon: GdsIcons.Print, color: "teal", messageId: "gds.feedback.printed" } },
|
|
79
|
+
copy: { id: "gds.action.copy", defaultMessage: "Copy", icon: GdsIcons.Copy, feedback: { icon: GdsIcons.Copy, color: "teal", messageId: "gds.feedback.copied" } },
|
|
80
|
+
duplicate: { id: "gds.action.duplicate", defaultMessage: "Duplicate", icon: GdsIcons.Duplicate, feedback: { icon: GdsIcons.Duplicate, color: "teal", messageId: "gds.feedback.duplicated" } },
|
|
81
|
+
check: { id: "gds.action.check", defaultMessage: "Check", icon: GdsIcons.Check, feedback: { icon: GdsIcons.Check, color: "teal", messageId: "gds.feedback.checked" } },
|
|
82
|
+
uncheck: { id: "gds.action.uncheck", defaultMessage: "Uncheck", icon: GdsIcons.Uncheck, feedback: { icon: GdsIcons.Uncheck, color: "red", messageId: "gds.feedback.unchecked" } },
|
|
83
|
+
complete: { id: "gds.action.complete", defaultMessage: "Complete", icon: GdsIcons.Complete, feedback: { icon: GdsIcons.Complete, color: "teal", messageId: "gds.feedback.completed" } },
|
|
84
|
+
clear: { id: "gds.action.clear", defaultMessage: "Clear", icon: GdsIcons.Clear, feedback: { icon: GdsIcons.Clear, color: "red", messageId: "gds.feedback.cleared" } },
|
|
85
|
+
capture: { id: "gds.action.capture", defaultMessage: "Capture", icon: GdsIcons.Capture, feedback: { icon: GdsIcons.Capture, color: "teal", messageId: "gds.feedback.captured" } },
|
|
86
|
+
record: { id: "gds.action.record", defaultMessage: "Record", icon: GdsIcons.Record, feedback: { icon: GdsIcons.Record, color: "teal", messageId: "gds.feedback.recorded" } },
|
|
87
|
+
flip: { id: "gds.action.flip", defaultMessage: "Flip", icon: GdsIcons.Flip, feedback: { icon: GdsIcons.Flip, color: "teal", messageId: "gds.feedback.flipped" } },
|
|
88
|
+
flash: { id: "gds.action.flash", defaultMessage: "Flash", icon: GdsIcons.Flash, feedback: { icon: GdsIcons.Flash, color: "teal", messageId: "gds.feedback.flashed" } },
|
|
89
|
+
course: { id: "gds.action.course", defaultMessage: "Course", icon: GdsIcons.Course, feedback: { icon: GdsIcons.Course, color: "teal", messageId: "gds.feedback.done" } },
|
|
90
|
+
lesson: { id: "gds.action.lesson", defaultMessage: "Lesson", icon: GdsIcons.Lesson, feedback: { icon: GdsIcons.Lesson, color: "teal", messageId: "gds.feedback.done" } },
|
|
91
|
+
certificate: { id: "gds.action.certificate", defaultMessage: "Certificate", icon: GdsIcons.Certificate, feedback: { icon: GdsIcons.Certificate, color: "teal", messageId: "gds.feedback.done" } },
|
|
92
|
+
student: { id: "gds.action.student", defaultMessage: "Student", icon: GdsIcons.Student, feedback: { icon: GdsIcons.Student, color: "teal", messageId: "gds.feedback.done" } },
|
|
93
|
+
class: { id: "gds.action.class", defaultMessage: "Class", icon: GdsIcons.Class, feedback: { icon: GdsIcons.Class, color: "teal", messageId: "gds.feedback.done" } },
|
|
94
|
+
grade: { id: "gds.action.grade", defaultMessage: "Grade", icon: GdsIcons.Grade, feedback: { icon: GdsIcons.Grade, color: "teal", messageId: "gds.feedback.done" } },
|
|
95
|
+
child: { id: "gds.action.child", defaultMessage: "Child", icon: GdsIcons.Child, feedback: { icon: GdsIcons.Child, color: "teal", messageId: "gds.feedback.done" } },
|
|
96
|
+
family: { id: "gds.action.family", defaultMessage: "Family", icon: GdsIcons.Family, feedback: { icon: GdsIcons.Family, color: "teal", messageId: "gds.feedback.done" } },
|
|
97
|
+
habit: { id: "gds.action.habit", defaultMessage: "Habit", icon: GdsIcons.Habit, feedback: { icon: GdsIcons.Habit, color: "teal", messageId: "gds.feedback.done" } },
|
|
98
|
+
goal: { id: "gds.action.goal", defaultMessage: "Goal", icon: GdsIcons.Goal, feedback: { icon: GdsIcons.Goal, color: "teal", messageId: "gds.feedback.done" } },
|
|
99
|
+
streak: { id: "gds.action.streak", defaultMessage: "Streak", icon: GdsIcons.Streak, feedback: { icon: GdsIcons.Streak, color: "teal", messageId: "gds.feedback.done" } },
|
|
100
|
+
reward: { id: "gds.action.reward", defaultMessage: "Reward", icon: GdsIcons.Reward, feedback: { icon: GdsIcons.Reward, color: "yellow", messageId: "gds.feedback.rewarded" } },
|
|
101
|
+
trophy: { id: "gds.action.trophy", defaultMessage: "Trophy", icon: GdsIcons.Trophy, feedback: { icon: GdsIcons.Trophy, color: "yellow", messageId: "gds.feedback.rewarded" } },
|
|
102
|
+
crown: { id: "gds.action.crown", defaultMessage: "Crown", icon: GdsIcons.Crown, feedback: { icon: GdsIcons.Crown, color: "yellow", messageId: "gds.feedback.rewarded" } },
|
|
103
|
+
pause: { id: "gds.action.pause", defaultMessage: "Pause", icon: GdsIcons.Pause, feedback: { icon: GdsIcons.Pause, color: "teal", messageId: "gds.feedback.paused" } },
|
|
104
|
+
message: { id: "gds.action.message", defaultMessage: "Message", icon: GdsIcons.Message, feedback: { icon: GdsIcons.Message, color: "blue", messageId: "gds.feedback.sent" } },
|
|
105
|
+
mail: { id: "gds.action.mail", defaultMessage: "Mail", icon: GdsIcons.Mail, feedback: { icon: GdsIcons.Mail, color: "blue", messageId: "gds.feedback.mailed" } },
|
|
106
|
+
refresh: { id: "gds.action.refresh", defaultMessage: "Refresh", icon: GdsIcons.Refresh, feedback: { icon: GdsIcons.Refresh, color: "teal", messageId: "gds.feedback.refreshed" } },
|
|
107
|
+
trendingUp: { id: "gds.action.trendingUp", defaultMessage: "Trending Up", icon: GdsIcons.TrendingUp, feedback: { icon: GdsIcons.TrendingUp, color: "teal", messageId: "gds.feedback.done" } },
|
|
108
|
+
trendingDown: { id: "gds.action.trendingDown", defaultMessage: "Trending Down", icon: GdsIcons.TrendingDown, feedback: { icon: GdsIcons.TrendingDown, color: "teal", messageId: "gds.feedback.done" } },
|
|
109
|
+
currency: { id: "gds.action.currency", defaultMessage: "Currency", icon: GdsIcons.Currency, feedback: { icon: GdsIcons.Currency, color: "teal", messageId: "gds.feedback.done" } },
|
|
110
|
+
grid: { id: "gds.action.grid", defaultMessage: "Grid", icon: GdsIcons.Grid, feedback: { icon: GdsIcons.Grid, color: "teal", messageId: "gds.feedback.done" } },
|
|
111
|
+
list: { id: "gds.action.list", defaultMessage: "List", icon: GdsIcons.List, feedback: { icon: GdsIcons.List, color: "teal", messageId: "gds.feedback.done" } },
|
|
112
|
+
logout: { id: "gds.action.logout", defaultMessage: "Logout", icon: GdsIcons.Logout, feedback: { icon: GdsIcons.Logout, color: "teal", messageId: "gds.feedback.loggedOut" } },
|
|
113
|
+
notifications: { id: "gds.action.notifications", defaultMessage: "Notifications", icon: GdsIcons.Notifications, feedback: { icon: GdsIcons.Notifications, color: "teal", messageId: "gds.feedback.done" } },
|
|
114
|
+
back: { id: "gds.action.back", defaultMessage: "Back", icon: GdsIcons.Back, feedback: { icon: GdsIcons.Back, color: "teal", messageId: "gds.feedback.done" } },
|
|
115
|
+
eye: { id: "gds.action.eye", defaultMessage: "View", icon: GdsIcons.Eye, feedback: { icon: GdsIcons.Eye, color: "teal", messageId: "gds.feedback.done" } },
|
|
116
|
+
eyeOff: { id: "gds.action.eyeOff", defaultMessage: "Hide", icon: GdsIcons.EyeOff, feedback: { icon: GdsIcons.EyeOff, color: "teal", messageId: "gds.feedback.done" } },
|
|
117
|
+
help: { id: "gds.action.help", defaultMessage: "Help", icon: GdsIcons.Help, feedback: { icon: GdsIcons.Help, color: "teal", messageId: "gds.feedback.done" } },
|
|
118
|
+
filter: { id: "gds.action.filter", defaultMessage: "Filter", icon: GdsIcons.Filter, feedback: { icon: GdsIcons.Filter, color: "teal", messageId: "gds.feedback.filtered" } },
|
|
119
|
+
sort: { id: "gds.action.sort", defaultMessage: "Sort", icon: GdsIcons.Sort, feedback: { icon: GdsIcons.Sort, color: "teal", messageId: "gds.feedback.sorted" } },
|
|
120
|
+
export: { id: "gds.action.export", defaultMessage: "Export", icon: GdsIcons.Export, feedback: { icon: GdsIcons.Export, color: "teal", messageId: "gds.feedback.exported" } },
|
|
121
|
+
import: { id: "gds.action.import", defaultMessage: "Import", icon: GdsIcons.Import, feedback: { icon: GdsIcons.Import, color: "teal", messageId: "gds.feedback.imported" } },
|
|
122
|
+
preview: { id: "gds.action.preview", defaultMessage: "Preview", icon: GdsIcons.Preview, feedback: { icon: GdsIcons.Preview, color: "teal", messageId: "gds.feedback.previewed" } },
|
|
123
|
+
clone: { id: "gds.action.clone", defaultMessage: "Clone", icon: GdsIcons.Clone, feedback: { icon: GdsIcons.Clone, color: "teal", messageId: "gds.feedback.cloned" } },
|
|
124
|
+
restore: { id: "gds.action.restore", defaultMessage: "Restore", icon: GdsIcons.Restore, feedback: { icon: GdsIcons.Restore, color: "teal", messageId: "gds.feedback.restored" } },
|
|
125
|
+
toggle: { id: "gds.action.toggle", defaultMessage: "Toggle", icon: GdsIcons.Toggle, feedback: { icon: GdsIcons.Toggle, color: "teal", messageId: "gds.feedback.toggled" } },
|
|
126
|
+
search: { id: "gds.action.search", defaultMessage: "Search", icon: GdsIcons.Search, feedback: { icon: GdsIcons.Search, color: "teal", messageId: "gds.feedback.searched" } },
|
|
127
|
+
submit: { id: "gds.action.submit", defaultMessage: "Submit", icon: GdsIcons.Submit, feedback: { icon: GdsIcons.Submit, color: "teal", messageId: "gds.feedback.submitted" } },
|
|
128
|
+
reset: { id: "gds.action.reset", defaultMessage: "Reset", icon: GdsIcons.Reset, feedback: { icon: GdsIcons.Reset, color: "red", messageId: "gds.feedback.reset" } },
|
|
129
|
+
login: { id: "gds.action.login", defaultMessage: "Login", icon: GdsIcons.Login, feedback: { icon: GdsIcons.Login, color: "teal", messageId: "gds.feedback.loggedIn" } },
|
|
130
|
+
register: { id: "gds.action.register", defaultMessage: "Register", icon: GdsIcons.Register, feedback: { icon: GdsIcons.Register, color: "teal", messageId: "gds.feedback.registered" } },
|
|
131
|
+
verify: { id: "gds.action.verify", defaultMessage: "Verify", icon: GdsIcons.Verify, feedback: { icon: GdsIcons.Verify, color: "teal", messageId: "gds.feedback.verified" } },
|
|
132
|
+
launch: { id: "gds.action.launch", defaultMessage: "Launch", icon: GdsIcons.Launch, feedback: { icon: GdsIcons.Launch, color: "purple", messageId: "gds.feedback.launched" } },
|
|
133
|
+
draft: { id: "gds.action.draft", defaultMessage: "Draft", icon: GdsIcons.Draft, feedback: { icon: GdsIcons.Draft, color: "teal", messageId: "gds.feedback.drafted" } },
|
|
134
|
+
refer: { id: "gds.action.refer", defaultMessage: "Refer", icon: GdsIcons.Refer, feedback: { icon: GdsIcons.Refer, color: "teal", messageId: "gds.feedback.referred" } },
|
|
135
|
+
evidence: { id: "gds.action.evidence", defaultMessage: "Evidence", icon: GdsIcons.Evidence, feedback: { icon: GdsIcons.Evidence, color: "teal", messageId: "gds.feedback.added" } }
|
|
136
|
+
};
|
|
137
|
+
function createGdsVocabularyPack(namespace, actions) {
|
|
138
|
+
return {
|
|
139
|
+
namespace,
|
|
140
|
+
actions: Object.fromEntries(
|
|
141
|
+
Object.entries(actions).map(([key, definition]) => [
|
|
142
|
+
`${namespace}:${key}`,
|
|
143
|
+
{
|
|
144
|
+
...definition,
|
|
145
|
+
id: `gds.action.${namespace}.${key}`
|
|
146
|
+
}
|
|
147
|
+
])
|
|
148
|
+
)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function mergeGdsVocabularyPacks(packs = []) {
|
|
152
|
+
return packs.reduce((acc, pack) => {
|
|
153
|
+
for (const [key, definition] of Object.entries(pack.actions)) {
|
|
154
|
+
acc[key] = definition;
|
|
155
|
+
}
|
|
156
|
+
return acc;
|
|
157
|
+
}, {});
|
|
158
|
+
}
|
|
159
|
+
function resolveSemanticActionConfig(action, packs = []) {
|
|
160
|
+
const baseConfig = GdsVocabulary[action];
|
|
161
|
+
if (baseConfig) {
|
|
162
|
+
return baseConfig;
|
|
163
|
+
}
|
|
164
|
+
const merged = mergeGdsVocabularyPacks(packs);
|
|
165
|
+
const packConfig = merged[action];
|
|
166
|
+
if (packConfig) {
|
|
167
|
+
return packConfig;
|
|
168
|
+
}
|
|
169
|
+
throw new Error(`Unknown semantic action: ${action}`);
|
|
170
|
+
}
|
|
171
|
+
function getSemanticActionConfig(action, packs = []) {
|
|
172
|
+
return resolveSemanticActionConfig(action, packs);
|
|
173
|
+
}
|
|
174
|
+
function getSemanticActionLabel(action, translate, packs = []) {
|
|
175
|
+
const config = resolveSemanticActionConfig(action, packs);
|
|
176
|
+
return translate ? translate(config.id, config.defaultMessage) : config.defaultMessage;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// src/GdsBadge.tsx
|
|
180
|
+
import { Badge } from "@mantine/core";
|
|
181
|
+
import { GDS_ACCENT_NAMES, GDS_ACCENT_SHADES, gdsDevWarnOnce, resolveGdsAccentTokens, useGdsBadgeIconStyle } from "@sovereignsquad/gds-theme";
|
|
182
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
183
|
+
var toneColors = {
|
|
184
|
+
success: { bg: "var(--gds-badge-solid-success)", fg: "var(--gds-badge-solid-success-fg)" },
|
|
185
|
+
warning: { bg: "var(--gds-badge-solid-warning)", fg: "var(--gds-badge-solid-warning-fg)" },
|
|
186
|
+
danger: { bg: "var(--gds-badge-solid-danger)", fg: "var(--gds-badge-solid-danger-fg)" },
|
|
187
|
+
info: { bg: "var(--gds-badge-solid-info)", fg: "var(--gds-badge-solid-info-fg)" },
|
|
188
|
+
neutral: {
|
|
189
|
+
bg: "var(--gds-bg-card, var(--mantine-color-gray-1, #f1f3f5))",
|
|
190
|
+
fg: "var(--gds-text-primary, var(--mantine-color-dark-7, #1f2937))",
|
|
191
|
+
border: "1px solid var(--gds-border-card, var(--mantine-color-gray-4, #ced4da))"
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
var gdsResolvedAccentTokens = resolveGdsAccentTokens(void 0, "light");
|
|
195
|
+
var accentToken = (accent, shade = "base") => `var(--gds-accent-${accent}-${shade}, ${gdsResolvedAccentTokens[`--gds-accent-${accent}-${shade}`]})`;
|
|
196
|
+
var gdsBadgeAccentColors = Object.fromEntries(
|
|
197
|
+
GDS_ACCENT_NAMES.map((name) => [name, gdsResolvedAccentTokens[`--gds-accent-${name}-base`]])
|
|
198
|
+
);
|
|
199
|
+
var gdsBadgeAccentShades = Object.fromEntries(
|
|
200
|
+
GDS_ACCENT_NAMES.map((name) => [
|
|
201
|
+
name,
|
|
202
|
+
Object.fromEntries(GDS_ACCENT_SHADES.map((shade) => [shade, gdsResolvedAccentTokens[`--gds-accent-${name}-${shade}`]]))
|
|
203
|
+
])
|
|
204
|
+
);
|
|
205
|
+
function GdsBadgeEmojiCoin({ emoji }) {
|
|
206
|
+
return /* @__PURE__ */ jsx(
|
|
207
|
+
"span",
|
|
208
|
+
{
|
|
209
|
+
"data-gds-badge-emoji-coin": "",
|
|
210
|
+
"aria-hidden": "true",
|
|
211
|
+
style: {
|
|
212
|
+
display: "inline-flex",
|
|
213
|
+
alignItems: "center",
|
|
214
|
+
justifyContent: "center",
|
|
215
|
+
width: "1.35em",
|
|
216
|
+
height: "1.35em",
|
|
217
|
+
borderRadius: "50%",
|
|
218
|
+
background: "var(--mantine-color-dark-7, #1f2937)",
|
|
219
|
+
fontSize: "0.75em",
|
|
220
|
+
lineHeight: 1,
|
|
221
|
+
flexShrink: 0
|
|
222
|
+
},
|
|
223
|
+
children: emoji
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
function GdsBadge(props) {
|
|
228
|
+
const { label, icon, shape, tone, accent, emoji, iconStyle, style, ...rest } = props;
|
|
229
|
+
const resolvedIconStyle = useGdsBadgeIconStyle(iconStyle);
|
|
230
|
+
if (!label) {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
const colors = accent ? { bg: accentToken(accent), fg: `var(--gds-accent-${accent}-on, #ffffff)` } : toneColors[tone ?? "neutral"];
|
|
234
|
+
const useEmoji = resolvedIconStyle === "emoji" && Boolean(emoji);
|
|
235
|
+
let leading = null;
|
|
236
|
+
if (useEmoji) {
|
|
237
|
+
if (shape) {
|
|
238
|
+
gdsDevWarnOnce(
|
|
239
|
+
"GdsBadge:emoji-with-shape",
|
|
240
|
+
"GdsBadge received both `shape` and an active `emoji` glyph \u2014 shape composition is not supported in emoji mode yet, so `shape` is ignored and the emoji renders on its own disc instead."
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
leading = /* @__PURE__ */ jsx(GdsBadgeEmojiCoin, { emoji });
|
|
244
|
+
} else if (shape) {
|
|
245
|
+
const Shape = GdsBadgeShapes[shape];
|
|
246
|
+
leading = /* @__PURE__ */ jsxs(GdsBadgeStack, { size: "1.1em", children: [
|
|
247
|
+
/* @__PURE__ */ jsx(GdsBadgeStackLayer, { children: /* @__PURE__ */ jsx(Shape, { size: "100%", stroke: 1.75, "aria-hidden": "true" }) }),
|
|
248
|
+
icon ? /* @__PURE__ */ jsx(
|
|
249
|
+
GdsBadgeStackLayer,
|
|
250
|
+
{
|
|
251
|
+
scale: shape === "pin" ? 0.42 : 0.55,
|
|
252
|
+
style: shape === "pin" ? { transform: "translateY(-4.1667%) scale(0.42)" } : void 0,
|
|
253
|
+
children: /* @__PURE__ */ jsx(GdsIcon, { icon, size: "100%" })
|
|
254
|
+
}
|
|
255
|
+
) : null
|
|
256
|
+
] });
|
|
257
|
+
} else if (icon) {
|
|
258
|
+
leading = /* @__PURE__ */ jsx(GdsIcon, { icon, size: "xs" });
|
|
259
|
+
}
|
|
260
|
+
return /* @__PURE__ */ jsx(
|
|
261
|
+
Badge,
|
|
262
|
+
{
|
|
263
|
+
"data-gds-badge": "",
|
|
264
|
+
"data-gds-badge-fixed-tone": "true",
|
|
265
|
+
variant: "filled",
|
|
266
|
+
leftSection: leading,
|
|
267
|
+
...rest,
|
|
268
|
+
style: { backgroundColor: colors.bg, color: colors.fg, border: colors.border ?? "none", ...style },
|
|
269
|
+
children: label
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// src/SectionPanel.tsx
|
|
275
|
+
import { Box, Divider, Group, Paper, Stack, Text, Title } from "@mantine/core";
|
|
276
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
277
|
+
var toneBackgrounds = {
|
|
278
|
+
default: "var(--mantine-color-body)",
|
|
279
|
+
supporting: "light-dark(var(--mantine-color-gray-0), color-mix(in srgb, var(--mantine-color-dark-7) 92%, black))",
|
|
280
|
+
warning: "light-dark(var(--mantine-color-yellow-0), color-mix(in srgb, var(--mantine-color-yellow-9) 18%, var(--mantine-color-body)))",
|
|
281
|
+
critical: "light-dark(var(--mantine-color-red-0), color-mix(in srgb, var(--mantine-color-red-9) 18%, var(--mantine-color-body)))"
|
|
282
|
+
};
|
|
283
|
+
function SectionPanel({
|
|
284
|
+
eyebrow,
|
|
285
|
+
title,
|
|
286
|
+
titleOrder = 3,
|
|
287
|
+
description,
|
|
288
|
+
action,
|
|
289
|
+
children,
|
|
290
|
+
tone = "default",
|
|
291
|
+
id,
|
|
292
|
+
divided = true,
|
|
293
|
+
presentation = "inline",
|
|
294
|
+
minHeight,
|
|
295
|
+
contentAlign,
|
|
296
|
+
contentJustify
|
|
297
|
+
}) {
|
|
298
|
+
const bodyLayout = resolveSurfacePresentationStyles({
|
|
299
|
+
presentation,
|
|
300
|
+
minHeight,
|
|
301
|
+
contentAlign,
|
|
302
|
+
contentJustify
|
|
303
|
+
});
|
|
304
|
+
return (
|
|
305
|
+
// Responsive padding, not a flat `p="lg"`: this Paper is the outer shell
|
|
306
|
+
// every SectionPanel consumer nests further Paper-based cards inside (see
|
|
307
|
+
// ReferenceThemeExplorer's grid cards). Two flat-`lg` Paper shells
|
|
308
|
+
// stacking their own full padding ate up to ~35% of a narrow mobile
|
|
309
|
+
// viewport in unusable side margin before either card's own content
|
|
310
|
+
// started — confirmed live on a 390px viewport. `radius` drops one token
|
|
311
|
+
// (`xl` → `lg`) rather than going responsive: Mantine's `radius` prop is
|
|
312
|
+
// typed as a single `MantineRadius`, not the breakpoint-object `StyleProp`
|
|
313
|
+
// that spacing props like `p` accept, and a flat `lg` still keeps the
|
|
314
|
+
// corner proportional enough not to visually clip content at the new
|
|
315
|
+
// smaller mobile padding (the original `xl` would, at `xs` padding).
|
|
316
|
+
/* @__PURE__ */ jsx2(
|
|
317
|
+
Paper,
|
|
318
|
+
{
|
|
319
|
+
id,
|
|
320
|
+
withBorder: true,
|
|
321
|
+
radius: "lg",
|
|
322
|
+
p: { base: "xs", sm: "sm", md: "lg" },
|
|
323
|
+
style: { background: toneBackgrounds[tone] },
|
|
324
|
+
children: /* @__PURE__ */ jsxs2(Stack, { gap: "md", children: [
|
|
325
|
+
eyebrow || title || description || action ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
326
|
+
/* @__PURE__ */ jsxs2(Group, { justify: "space-between", align: "flex-start", gap: "md", wrap: "wrap", children: [
|
|
327
|
+
eyebrow || title || description ? /* @__PURE__ */ jsxs2(Stack, { gap: 4, children: [
|
|
328
|
+
eyebrow ? /* @__PURE__ */ jsx2(Text, { size: "xs", fw: 700, c: "dimmed", children: eyebrow }) : null,
|
|
329
|
+
title ? /* @__PURE__ */ jsx2(Title, { order: titleOrder, children: title }) : null,
|
|
330
|
+
description ? /* @__PURE__ */ jsx2(Text, { size: "sm", c: "dimmed", children: description }) : null
|
|
331
|
+
] }) : null,
|
|
332
|
+
action
|
|
333
|
+
] }),
|
|
334
|
+
divided ? /* @__PURE__ */ jsx2(Divider, {}) : null
|
|
335
|
+
] }) : null,
|
|
336
|
+
/* @__PURE__ */ jsx2(Box, { style: bodyLayout, children })
|
|
337
|
+
] })
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// src/ReferenceSection.tsx
|
|
344
|
+
import { Anchor } from "@mantine/core";
|
|
345
|
+
import { useGdsTranslation } from "@sovereignsquad/gds-theme";
|
|
346
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
347
|
+
function ReferenceSection({
|
|
348
|
+
title,
|
|
349
|
+
description,
|
|
350
|
+
eyebrow,
|
|
351
|
+
action,
|
|
352
|
+
href,
|
|
353
|
+
linkLabel,
|
|
354
|
+
tone = "default",
|
|
355
|
+
id,
|
|
356
|
+
children
|
|
357
|
+
}) {
|
|
358
|
+
const { t } = useGdsTranslation();
|
|
359
|
+
return /* @__PURE__ */ jsx3(
|
|
360
|
+
SectionPanel,
|
|
361
|
+
{
|
|
362
|
+
id,
|
|
363
|
+
tone,
|
|
364
|
+
eyebrow,
|
|
365
|
+
title,
|
|
366
|
+
description,
|
|
367
|
+
action: action ?? (href ? /* @__PURE__ */ jsx3(Anchor, { href, fw: 600, children: linkLabel ?? t("gds.reference.openSection", "Open section") }) : null),
|
|
368
|
+
divided: false,
|
|
369
|
+
children
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// src/ActionBar.tsx
|
|
375
|
+
import { ActionIcon, Button, Group as Group2, Stack as Stack2 } from "@mantine/core";
|
|
376
|
+
import { useGdsTranslation as useGdsTranslation2 } from "@sovereignsquad/gds-theme";
|
|
377
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
378
|
+
function renderSemanticAction(action, slot, vocabularyPacks, t) {
|
|
379
|
+
const { action: actionId, variant, ariaLabel, ...props } = action;
|
|
380
|
+
const fallbackVariant = slot === "primary" ? "filled" : slot === "secondary" ? "default" : "subtle";
|
|
381
|
+
const config = resolveSemanticActionConfig(actionId, vocabularyPacks);
|
|
382
|
+
const Icon = config.icon;
|
|
383
|
+
const label = getSemanticActionLabel(actionId, t, vocabularyPacks);
|
|
384
|
+
return /* @__PURE__ */ jsx4(
|
|
385
|
+
Button,
|
|
386
|
+
{
|
|
387
|
+
leftSection: /* @__PURE__ */ jsx4(Icon, { size: "1rem", stroke: 1.75 }),
|
|
388
|
+
"aria-label": ariaLabel ?? label,
|
|
389
|
+
variant: variant ?? fallbackVariant,
|
|
390
|
+
...props,
|
|
391
|
+
children: label
|
|
392
|
+
},
|
|
393
|
+
`${slot}-${actionId}`
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
function ActionBar({
|
|
397
|
+
primary,
|
|
398
|
+
secondary = [],
|
|
399
|
+
tertiary = [],
|
|
400
|
+
iconOnly = [],
|
|
401
|
+
gap = "sm",
|
|
402
|
+
vocabularyPacks = []
|
|
403
|
+
}) {
|
|
404
|
+
const { t } = useGdsTranslation2();
|
|
405
|
+
return /* @__PURE__ */ jsx4(Stack2, { gap, children: /* @__PURE__ */ jsxs3(Group2, { justify: "space-between", align: "center", gap, wrap: "wrap", children: [
|
|
406
|
+
/* @__PURE__ */ jsxs3(Group2, { gap, wrap: "wrap", children: [
|
|
407
|
+
secondary.map((action) => renderSemanticAction(action, "secondary", vocabularyPacks, t)),
|
|
408
|
+
tertiary.map((action) => renderSemanticAction(action, "tertiary", vocabularyPacks, t))
|
|
409
|
+
] }),
|
|
410
|
+
/* @__PURE__ */ jsxs3(Group2, { gap, wrap: "wrap", justify: "flex-end", children: [
|
|
411
|
+
iconOnly.map(({ action, ariaLabel, ...props }) => {
|
|
412
|
+
const config = resolveSemanticActionConfig(action, vocabularyPacks);
|
|
413
|
+
const Icon = config.icon;
|
|
414
|
+
return /* @__PURE__ */ jsx4(
|
|
415
|
+
ActionIcon,
|
|
416
|
+
{
|
|
417
|
+
variant: "subtle",
|
|
418
|
+
size: "lg",
|
|
419
|
+
"aria-label": ariaLabel ?? getSemanticActionLabel(action, t, vocabularyPacks),
|
|
420
|
+
...props,
|
|
421
|
+
children: /* @__PURE__ */ jsx4(Icon, { size: "1rem", stroke: 1.75 })
|
|
422
|
+
},
|
|
423
|
+
`icon-${action}`
|
|
424
|
+
);
|
|
425
|
+
}),
|
|
426
|
+
primary ? renderSemanticAction(primary, "primary", vocabularyPacks, t) : null
|
|
427
|
+
] })
|
|
428
|
+
] }) });
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// src/generated-art-engine.ts
|
|
432
|
+
import { mixCssColors, resolveGdsAccentTokens as resolveGdsAccentTokens2 } from "@sovereignsquad/gds-theme";
|
|
433
|
+
import { getGdsVibeThemeCssVariables, resolveGdsVibeTheme } from "@sovereignsquad/gds-theme";
|
|
434
|
+
var gdsResolvedAccentFallback = resolveGdsAccentTokens2(void 0, "light");
|
|
435
|
+
function gdsSeededRandom(seed) {
|
|
436
|
+
let hash = 2166136261;
|
|
437
|
+
for (let i = 0; i < seed.length; i += 1) {
|
|
438
|
+
hash ^= seed.charCodeAt(i);
|
|
439
|
+
hash = Math.imul(hash, 16777619);
|
|
440
|
+
}
|
|
441
|
+
let state = hash >>> 0;
|
|
442
|
+
return () => {
|
|
443
|
+
state |= 0;
|
|
444
|
+
state = state + 1831565813 | 0;
|
|
445
|
+
let t = Math.imul(state ^ state >>> 15, 1 | state);
|
|
446
|
+
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
|
|
447
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
var DEFAULT_VIBE = resolveGdsVibeTheme("default");
|
|
451
|
+
function resolveCategoryColorToken(options) {
|
|
452
|
+
if (!options.category) {
|
|
453
|
+
throw new Error("gds-core generated-art-engine: paletteSource 'category' requires a `category` option (a GdsBadgeAccentName).");
|
|
454
|
+
}
|
|
455
|
+
const shade = options.shade ?? "base";
|
|
456
|
+
return `var(--gds-accent-${options.category}-${shade}, ${gdsResolvedAccentFallback[`--gds-accent-${options.category}-${shade}`]})`;
|
|
457
|
+
}
|
|
458
|
+
function resolveCategoryColorHex(options) {
|
|
459
|
+
if (!options.category) {
|
|
460
|
+
throw new Error("gds-core generated-art-engine: paletteSource 'category' requires a `category` option (a GdsBadgeAccentName).");
|
|
461
|
+
}
|
|
462
|
+
const shade = options.shade ?? "base";
|
|
463
|
+
const tokens = options.themePresetId ? getGdsVibeThemeCssVariables(options.themePresetId, options.colorScheme ?? "light") : gdsResolvedAccentFallback;
|
|
464
|
+
const resolved = tokens[`--gds-accent-${options.category}-${shade}`];
|
|
465
|
+
if (!resolved) {
|
|
466
|
+
throw new Error(
|
|
467
|
+
`gds-core generated-art-engine: no resolved value for --gds-accent-${options.category}-${shade}. A missing accent token must fail here rather than emit an unpainted shape.`
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
return resolved;
|
|
471
|
+
}
|
|
472
|
+
function applyCssTint(color, options) {
|
|
473
|
+
if (!options.tintWithBackground || options.mixRatio === void 0) {
|
|
474
|
+
return color;
|
|
475
|
+
}
|
|
476
|
+
return `color-mix(in srgb, ${color} ${Math.round(options.mixRatio * 100)}%, ${options.tintWithBackground})`;
|
|
477
|
+
}
|
|
478
|
+
function gdsGeneratedPaletteCssRefs(options = {}) {
|
|
479
|
+
if (options.colors) {
|
|
480
|
+
return { ...options.colors, source: "override" };
|
|
481
|
+
}
|
|
482
|
+
const source = options.paletteSource ?? "theme";
|
|
483
|
+
if (source === "category") {
|
|
484
|
+
const color = applyCssTint(resolveCategoryColorToken(options), options);
|
|
485
|
+
return { primary: color, accent: color, source: "category" };
|
|
486
|
+
}
|
|
487
|
+
return {
|
|
488
|
+
primary: applyCssTint(`var(--gds-brand-primary, ${DEFAULT_VIBE.primary})`, options),
|
|
489
|
+
accent: applyCssTint(`var(--gds-brand-accent, ${DEFAULT_VIBE.accent})`, options),
|
|
490
|
+
source: "theme"
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
function applyHexTint(color, options) {
|
|
494
|
+
if (!options.tintWithBackground || options.mixRatio === void 0) {
|
|
495
|
+
return color;
|
|
496
|
+
}
|
|
497
|
+
return mixCssColors(color, options.tintWithBackground, options.mixRatio, "#ffffff");
|
|
498
|
+
}
|
|
499
|
+
function resolveGdsGeneratedPaletteHex(options = {}) {
|
|
500
|
+
if (options.colors) {
|
|
501
|
+
return { ...options.colors, source: "override" };
|
|
502
|
+
}
|
|
503
|
+
const source = options.paletteSource ?? "theme";
|
|
504
|
+
if (source === "category") {
|
|
505
|
+
const color = applyHexTint(resolveCategoryColorHex(options), options);
|
|
506
|
+
return { primary: color, accent: color, source: "category" };
|
|
507
|
+
}
|
|
508
|
+
if (!options.themePresetId) {
|
|
509
|
+
throw new Error(
|
|
510
|
+
"gds-core generated-art-engine: resolveGdsGeneratedPaletteHex with paletteSource 'theme' requires either `themePresetId` (one of the built-in presets) or an explicit `colors` override for a custom brand theme \u2014 there is no live DOM to read CSS variables from outside a browser."
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
const variables = getGdsVibeThemeCssVariables(options.themePresetId, options.colorScheme ?? "light");
|
|
514
|
+
return {
|
|
515
|
+
primary: applyHexTint(variables["--gds-brand-primary"] ?? DEFAULT_VIBE.primary, options),
|
|
516
|
+
accent: applyHexTint(variables["--gds-brand-accent"] ?? DEFAULT_VIBE.accent, options),
|
|
517
|
+
source: "theme"
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// src/GdsGeneratedThumbnail.tsx
|
|
522
|
+
import { cloneElement, isValidElement, useId, useMemo } from "react";
|
|
523
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
524
|
+
var ASPECT_RATIO_VIEWBOX = {
|
|
525
|
+
"3:2": { width: 300, height: 200 },
|
|
526
|
+
"16:9": { width: 320, height: 180 },
|
|
527
|
+
"4:3": { width: 320, height: 240 },
|
|
528
|
+
"1:1": { width: 240, height: 240 }
|
|
529
|
+
};
|
|
530
|
+
var isIconKey = (icon) => typeof icon === "string";
|
|
531
|
+
function renderIcon(icon, size = "100%") {
|
|
532
|
+
if (isIconKey(icon)) {
|
|
533
|
+
return /* @__PURE__ */ jsx5(GdsIcon, { icon, size, tone: "default" });
|
|
534
|
+
}
|
|
535
|
+
if (isValidElement(icon)) {
|
|
536
|
+
return cloneElement(icon, { stroke: 1.75 });
|
|
537
|
+
}
|
|
538
|
+
return icon;
|
|
539
|
+
}
|
|
540
|
+
function darkSurface(colorRef) {
|
|
541
|
+
return `color-mix(in srgb, ${colorRef} 30%, black)`;
|
|
542
|
+
}
|
|
543
|
+
function computeMotifTransform(seed, viewBoxWidth, viewBoxHeight) {
|
|
544
|
+
const next = gdsSeededRandom(seed);
|
|
545
|
+
const rotationDeg = (next() - 0.5) * 26;
|
|
546
|
+
const scale = viewBoxHeight / 24 * (1.7 + next() * 0.3);
|
|
547
|
+
const centerX = viewBoxWidth * (0.78 + (next() - 0.5) * 0.12);
|
|
548
|
+
const centerY = viewBoxHeight * (0.28 + (next() - 0.5) * 0.14);
|
|
549
|
+
return { rotationDeg, scale, centerX, centerY };
|
|
550
|
+
}
|
|
551
|
+
function computeMosaicTiles(seed, viewBoxWidth, viewBoxHeight) {
|
|
552
|
+
const next = gdsSeededRandom(`${seed}:mosaic`);
|
|
553
|
+
const columns = 9;
|
|
554
|
+
const rows = 4;
|
|
555
|
+
const cellWidth = viewBoxWidth / columns;
|
|
556
|
+
const cellHeight = viewBoxHeight / rows;
|
|
557
|
+
const tiles = [];
|
|
558
|
+
for (let row = 0; row < rows; row += 1) {
|
|
559
|
+
for (let col = 0; col < columns; col += 1) {
|
|
560
|
+
if (next() < 0.32) {
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
const inset = 0.08 + next() * 0.1;
|
|
564
|
+
tiles.push({
|
|
565
|
+
x: col * cellWidth + cellWidth * inset,
|
|
566
|
+
y: row * cellHeight + cellHeight * inset,
|
|
567
|
+
width: cellWidth * (1 - inset * 2),
|
|
568
|
+
height: cellHeight * (1 - inset * 2),
|
|
569
|
+
opacity: 0.05 + next() * 0.11,
|
|
570
|
+
usePrimary: next() < 0.5
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return tiles;
|
|
575
|
+
}
|
|
576
|
+
function computeIconFieldPlacements(seed, count, viewBoxWidth, viewBoxHeight) {
|
|
577
|
+
const next = gdsSeededRandom(`${seed}:icon-field`);
|
|
578
|
+
return Array.from({ length: count }, () => ({
|
|
579
|
+
x: viewBoxWidth * (0.08 + next() * 0.84),
|
|
580
|
+
y: viewBoxHeight * (0.1 + next() * 0.8),
|
|
581
|
+
size: viewBoxHeight * (0.22 + next() * 0.16),
|
|
582
|
+
rotationDeg: (next() - 0.5) * 40
|
|
583
|
+
}));
|
|
584
|
+
}
|
|
585
|
+
function renderBackground(background, categories, seed, palette, viewBoxWidth, viewBoxHeight) {
|
|
586
|
+
if (background === "mosaic-abstract") {
|
|
587
|
+
const tiles = computeMosaicTiles(seed, viewBoxWidth, viewBoxHeight);
|
|
588
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: tiles.map((tile, index) => /* @__PURE__ */ jsx5(
|
|
589
|
+
"rect",
|
|
590
|
+
{
|
|
591
|
+
x: tile.x,
|
|
592
|
+
y: tile.y,
|
|
593
|
+
width: tile.width,
|
|
594
|
+
height: tile.height,
|
|
595
|
+
rx: Math.min(tile.width, tile.height) * 0.12,
|
|
596
|
+
fill: tile.usePrimary ? palette.primary : palette.accent,
|
|
597
|
+
opacity: tile.opacity
|
|
598
|
+
},
|
|
599
|
+
index
|
|
600
|
+
)) });
|
|
601
|
+
}
|
|
602
|
+
if (background === "icon-field") {
|
|
603
|
+
if (categories.length === 0) {
|
|
604
|
+
return null;
|
|
605
|
+
}
|
|
606
|
+
const next = gdsSeededRandom(`${seed}:icon-field-pick`);
|
|
607
|
+
const placements = computeIconFieldPlacements(seed, Math.min(categories.length, 8), viewBoxWidth, viewBoxHeight);
|
|
608
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: placements.map((placement, index) => {
|
|
609
|
+
const entry = categories[Math.floor(next() * categories.length)];
|
|
610
|
+
return /* @__PURE__ */ jsx5(
|
|
611
|
+
"g",
|
|
612
|
+
{
|
|
613
|
+
transform: `translate(${placement.x} ${placement.y}) rotate(${placement.rotationDeg}) scale(${placement.size / 24})`,
|
|
614
|
+
opacity: 0.1,
|
|
615
|
+
style: { color: "var(--gds-text-on-inverse, var(--mantine-color-white))" },
|
|
616
|
+
children: /* @__PURE__ */ jsx5("svg", { x: -12, y: -12, width: 24, height: 24, viewBox: "0 0 24 24", children: renderIcon(entry.icon) })
|
|
617
|
+
},
|
|
618
|
+
index
|
|
619
|
+
);
|
|
620
|
+
}) });
|
|
621
|
+
}
|
|
622
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: background.regions.map((region, index) => {
|
|
623
|
+
const weight = region.weight ?? 1;
|
|
624
|
+
return /* @__PURE__ */ jsx5(
|
|
625
|
+
"rect",
|
|
626
|
+
{
|
|
627
|
+
x: region.x0 * viewBoxWidth,
|
|
628
|
+
y: region.y0 * viewBoxHeight,
|
|
629
|
+
width: (region.x1 - region.x0) * viewBoxWidth,
|
|
630
|
+
height: (region.y1 - region.y0) * viewBoxHeight,
|
|
631
|
+
fill: palette.accent,
|
|
632
|
+
opacity: Math.min(0.85, 0.06 + weight * 0.05)
|
|
633
|
+
},
|
|
634
|
+
index
|
|
635
|
+
);
|
|
636
|
+
}) });
|
|
637
|
+
}
|
|
638
|
+
function GdsGeneratedThumbnail({
|
|
639
|
+
seed,
|
|
640
|
+
categories,
|
|
641
|
+
paletteSource,
|
|
642
|
+
category,
|
|
643
|
+
shade,
|
|
644
|
+
colors,
|
|
645
|
+
tintWithBackground,
|
|
646
|
+
mixRatio,
|
|
647
|
+
aspectRatio = "3:2",
|
|
648
|
+
maxBadges = 3,
|
|
649
|
+
badges = "ranked",
|
|
650
|
+
motifOpacity = 0.14,
|
|
651
|
+
background = "wash",
|
|
652
|
+
label,
|
|
653
|
+
className,
|
|
654
|
+
style
|
|
655
|
+
}) {
|
|
656
|
+
if (categories.length === 0) {
|
|
657
|
+
throw new Error("GdsGeneratedThumbnail: `categories` must contain at least one entry.");
|
|
658
|
+
}
|
|
659
|
+
const gradientId = useId();
|
|
660
|
+
const palette = useMemo(
|
|
661
|
+
() => gdsGeneratedPaletteCssRefs({ paletteSource, category, shade, colors, tintWithBackground, mixRatio }),
|
|
662
|
+
[paletteSource, category, shade, colors, tintWithBackground, mixRatio]
|
|
663
|
+
);
|
|
664
|
+
const { width: viewBoxWidth, height: viewBoxHeight } = ASPECT_RATIO_VIEWBOX[aspectRatio];
|
|
665
|
+
const motif = useMemo(() => computeMotifTransform(seed, viewBoxWidth, viewBoxHeight), [seed, viewBoxWidth, viewBoxHeight]);
|
|
666
|
+
const lead = categories[0];
|
|
667
|
+
const secondary = categories.slice(1, Math.max(maxBadges, 1));
|
|
668
|
+
const inverseColor = "var(--gds-text-on-inverse, var(--mantine-color-white))";
|
|
669
|
+
const pillBg = darkSurface(palette.accent);
|
|
670
|
+
return /* @__PURE__ */ jsxs4(
|
|
671
|
+
"div",
|
|
672
|
+
{
|
|
673
|
+
"data-gds-generated-thumbnail": "",
|
|
674
|
+
role: label ? "group" : void 0,
|
|
675
|
+
"aria-label": label || void 0,
|
|
676
|
+
className,
|
|
677
|
+
style: {
|
|
678
|
+
position: "relative",
|
|
679
|
+
aspectRatio: aspectRatio.replace(":", " / "),
|
|
680
|
+
overflow: "hidden",
|
|
681
|
+
borderRadius: "var(--mantine-radius-md, 12px)",
|
|
682
|
+
...style
|
|
683
|
+
},
|
|
684
|
+
children: [
|
|
685
|
+
/* @__PURE__ */ jsxs4(
|
|
686
|
+
"svg",
|
|
687
|
+
{
|
|
688
|
+
viewBox: `0 0 ${viewBoxWidth} ${viewBoxHeight}`,
|
|
689
|
+
preserveAspectRatio: "xMidYMid slice",
|
|
690
|
+
"aria-hidden": "true",
|
|
691
|
+
style: { position: "absolute", inset: 0, width: "100%", height: "100%", display: "block" },
|
|
692
|
+
children: [
|
|
693
|
+
/* @__PURE__ */ jsx5("defs", { children: /* @__PURE__ */ jsxs4("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
694
|
+
/* @__PURE__ */ jsx5("stop", { offset: "0%", stopColor: palette.primary }),
|
|
695
|
+
/* @__PURE__ */ jsx5("stop", { offset: "100%", stopColor: darkSurface(palette.primary) })
|
|
696
|
+
] }) }),
|
|
697
|
+
/* @__PURE__ */ jsx5("rect", { width: viewBoxWidth, height: viewBoxHeight, fill: `url(#${gradientId})` }),
|
|
698
|
+
background === "wash" ? /* @__PURE__ */ jsx5(
|
|
699
|
+
"g",
|
|
700
|
+
{
|
|
701
|
+
transform: `translate(${motif.centerX} ${motif.centerY}) rotate(${motif.rotationDeg}) scale(${motif.scale})`,
|
|
702
|
+
opacity: motifOpacity,
|
|
703
|
+
style: { color: inverseColor },
|
|
704
|
+
children: /* @__PURE__ */ jsx5("svg", { x: -12, y: -12, width: 24, height: 24, viewBox: "0 0 24 24", children: renderIcon(lead.icon) })
|
|
705
|
+
}
|
|
706
|
+
) : renderBackground(background, categories, seed, palette, viewBoxWidth, viewBoxHeight)
|
|
707
|
+
]
|
|
708
|
+
}
|
|
709
|
+
),
|
|
710
|
+
badges === "none" ? null : /* @__PURE__ */ jsxs4(
|
|
711
|
+
"div",
|
|
712
|
+
{
|
|
713
|
+
style: {
|
|
714
|
+
position: "absolute",
|
|
715
|
+
insetInline: 0,
|
|
716
|
+
insetBlockEnd: 0,
|
|
717
|
+
padding: "var(--gds-space-xs) var(--gds-space-sm)",
|
|
718
|
+
display: "flex",
|
|
719
|
+
alignItems: "center",
|
|
720
|
+
background: `linear-gradient(to top, ${darkSurface(palette.primary)} 0%, transparent 100%)`
|
|
721
|
+
},
|
|
722
|
+
children: [
|
|
723
|
+
(() => {
|
|
724
|
+
const LeadTag = lead.onSelect ? "button" : "span";
|
|
725
|
+
return /* @__PURE__ */ jsxs4(
|
|
726
|
+
LeadTag,
|
|
727
|
+
{
|
|
728
|
+
"data-gds-generated-thumbnail-badge": "lead",
|
|
729
|
+
type: lead.onSelect ? "button" : void 0,
|
|
730
|
+
onClick: lead.onSelect ? () => lead.onSelect?.(lead.key) : void 0,
|
|
731
|
+
style: {
|
|
732
|
+
display: "inline-flex",
|
|
733
|
+
alignItems: "center",
|
|
734
|
+
gap: "0.35em",
|
|
735
|
+
padding: "0.3em 0.65em 0.3em 0.45em",
|
|
736
|
+
borderRadius: "var(--gds-radius-pill)",
|
|
737
|
+
background: pillBg,
|
|
738
|
+
color: inverseColor,
|
|
739
|
+
fontSize: "13px",
|
|
740
|
+
fontWeight: 600,
|
|
741
|
+
lineHeight: 1.2,
|
|
742
|
+
whiteSpace: "nowrap",
|
|
743
|
+
border: "none",
|
|
744
|
+
font: lead.onSelect ? "inherit" : void 0,
|
|
745
|
+
cursor: lead.onSelect ? "pointer" : void 0
|
|
746
|
+
},
|
|
747
|
+
children: [
|
|
748
|
+
/* @__PURE__ */ jsx5("span", { "aria-hidden": "true", style: { width: "1.1em", height: "1.1em", display: "inline-flex" }, children: renderIcon(lead.icon, "100%") }),
|
|
749
|
+
lead.label
|
|
750
|
+
]
|
|
751
|
+
}
|
|
752
|
+
);
|
|
753
|
+
})(),
|
|
754
|
+
secondary.map((entry, index) => {
|
|
755
|
+
const SecondaryTag = entry.onSelect ? "button" : "span";
|
|
756
|
+
return /* @__PURE__ */ jsx5(
|
|
757
|
+
SecondaryTag,
|
|
758
|
+
{
|
|
759
|
+
"data-gds-generated-thumbnail-badge": "secondary",
|
|
760
|
+
type: entry.onSelect ? "button" : void 0,
|
|
761
|
+
onClick: entry.onSelect ? () => entry.onSelect?.(entry.key) : void 0,
|
|
762
|
+
role: entry.onSelect ? void 0 : "img",
|
|
763
|
+
"aria-label": entry.label,
|
|
764
|
+
title: entry.onSelect ? void 0 : entry.label,
|
|
765
|
+
style: {
|
|
766
|
+
display: "inline-flex",
|
|
767
|
+
alignItems: "center",
|
|
768
|
+
justifyContent: "center",
|
|
769
|
+
width: "1.9em",
|
|
770
|
+
height: "1.9em",
|
|
771
|
+
marginInlineStart: index === 0 ? "-0.3em" : "-0.5em",
|
|
772
|
+
borderRadius: "50%",
|
|
773
|
+
background: pillBg,
|
|
774
|
+
color: inverseColor,
|
|
775
|
+
border: "2px solid " + darkSurface(palette.primary),
|
|
776
|
+
opacity: 1 - index * 0.12,
|
|
777
|
+
flexShrink: 0,
|
|
778
|
+
font: entry.onSelect ? "inherit" : void 0,
|
|
779
|
+
cursor: entry.onSelect ? "pointer" : void 0
|
|
780
|
+
},
|
|
781
|
+
children: /* @__PURE__ */ jsx5("span", { "aria-hidden": "true", style: { width: "1em", height: "1em", display: "inline-flex" }, children: renderIcon(entry.icon, "100%") })
|
|
782
|
+
},
|
|
783
|
+
entry.key
|
|
784
|
+
);
|
|
785
|
+
})
|
|
786
|
+
]
|
|
787
|
+
}
|
|
788
|
+
)
|
|
789
|
+
]
|
|
790
|
+
}
|
|
791
|
+
);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
// src/CardContracts.ts
|
|
795
|
+
var gdsCardSizePaddingMap = {
|
|
796
|
+
xs: "xs",
|
|
797
|
+
sm: "sm",
|
|
798
|
+
md: "md",
|
|
799
|
+
lg: "lg",
|
|
800
|
+
xl: "xl"
|
|
801
|
+
};
|
|
802
|
+
var gdsCardDensityPaddingMap = {
|
|
803
|
+
xs: { compact: "xs", comfortable: "xs", spacious: "sm" },
|
|
804
|
+
sm: { compact: "xs", comfortable: "sm", spacious: "md" },
|
|
805
|
+
md: { compact: "sm", comfortable: "md", spacious: "lg" },
|
|
806
|
+
lg: { compact: "md", comfortable: "lg", spacious: "xl" },
|
|
807
|
+
xl: { compact: "lg", comfortable: "xl", spacious: "xl" }
|
|
808
|
+
};
|
|
809
|
+
var gdsCardTitleOrderMap = {
|
|
810
|
+
xs: 6,
|
|
811
|
+
sm: 5,
|
|
812
|
+
md: 4,
|
|
813
|
+
lg: 4,
|
|
814
|
+
xl: 3
|
|
815
|
+
};
|
|
816
|
+
var gdsCardGapMap = {
|
|
817
|
+
compact: "sm",
|
|
818
|
+
comfortable: "md",
|
|
819
|
+
spacious: "lg"
|
|
820
|
+
};
|
|
821
|
+
var gdsCardMediaRatioMap = {
|
|
822
|
+
default: 4 / 3,
|
|
823
|
+
"media-top": 4 / 3,
|
|
824
|
+
"media-left": 1,
|
|
825
|
+
compact: 16 / 9
|
|
826
|
+
};
|
|
827
|
+
function resolveGdsCardContract({
|
|
828
|
+
size = "md",
|
|
829
|
+
density = "comfortable",
|
|
830
|
+
variant = "default",
|
|
831
|
+
compact = false
|
|
832
|
+
} = {}) {
|
|
833
|
+
const resolvedSize = compact ? "sm" : size;
|
|
834
|
+
const resolvedDensity = compact ? "compact" : density;
|
|
835
|
+
const resolvedVariant = compact ? "compact" : variant;
|
|
836
|
+
return {
|
|
837
|
+
size: resolvedSize,
|
|
838
|
+
density: resolvedDensity,
|
|
839
|
+
variant: resolvedVariant,
|
|
840
|
+
padding: gdsCardDensityPaddingMap[resolvedSize][resolvedDensity],
|
|
841
|
+
gap: gdsCardGapMap[resolvedDensity],
|
|
842
|
+
titleOrder: gdsCardTitleOrderMap[resolvedSize],
|
|
843
|
+
descriptionClamp: resolvedDensity === "compact" ? 2 : resolvedSize === "xl" ? 4 : 3,
|
|
844
|
+
mediaRatio: gdsCardMediaRatioMap[resolvedVariant],
|
|
845
|
+
mediaPlacement: resolvedVariant === "media-left" ? "left" : "top",
|
|
846
|
+
actionWrap: resolvedDensity === "compact" ? "nowrap" : "wrap",
|
|
847
|
+
minTouchTarget: resolvedDensity === "compact" ? 40 : 44,
|
|
848
|
+
dataAttributes: {
|
|
849
|
+
"data-gds-card-size": resolvedSize,
|
|
850
|
+
"data-gds-card-density": resolvedDensity,
|
|
851
|
+
"data-gds-card-variant": resolvedVariant
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
// src/ListingCard.tsx
|
|
857
|
+
import { useState } from "react";
|
|
858
|
+
import { useGdsTranslation as useGdsTranslation3 } from "@sovereignsquad/gds-theme";
|
|
859
|
+
import { ActionIcon as ActionIcon2, Badge as Badge2, Box as Box2, Card, Group as Group3, Stack as Stack3, Text as Text2, Title as Title2 } from "@mantine/core";
|
|
860
|
+
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
861
|
+
var toneColorMap = {
|
|
862
|
+
default: void 0,
|
|
863
|
+
positive: "teal",
|
|
864
|
+
warning: "orange",
|
|
865
|
+
muted: "gray"
|
|
866
|
+
};
|
|
867
|
+
var MAX_LISTING_CARD_ACTIONS = 4;
|
|
868
|
+
var GDS_LISTING_TILE_SIZE_PX = 96;
|
|
869
|
+
var GDS_LISTING_PICK_BADGE_INSET_PX = 6;
|
|
870
|
+
var GDS_LISTING_PICK_BADGE_ICON_PX = 9;
|
|
871
|
+
var GDS_LISTING_PICK_BADGE_FONT_SIZE_PX = 9;
|
|
872
|
+
var GDS_LISTING_PICK_BADGE_LINE_HEIGHT_PX = 13.5;
|
|
873
|
+
var GDS_LISTING_PICK_BADGE_PADDING_BLOCK_PX = 2;
|
|
874
|
+
var GDS_LISTING_PICK_BADGE_PADDING_INLINE_PX = 6;
|
|
875
|
+
function resolveCardActions(actions) {
|
|
876
|
+
if (!actions || actions.length === 0) {
|
|
877
|
+
return null;
|
|
878
|
+
}
|
|
879
|
+
if (actions.length > MAX_LISTING_CARD_ACTIONS) {
|
|
880
|
+
throw new Error(`ListingCard supports at most ${MAX_LISTING_CARD_ACTIONS} actions, received ${actions.length}.`);
|
|
881
|
+
}
|
|
882
|
+
return actions;
|
|
883
|
+
}
|
|
884
|
+
function isNestedInteractiveTarget(eventTarget, currentTarget) {
|
|
885
|
+
if (!(eventTarget instanceof Element) || !(currentTarget instanceof Element)) {
|
|
886
|
+
return false;
|
|
887
|
+
}
|
|
888
|
+
const nestedInteractive = eventTarget.closest('a, button, input, select, textarea, [role="button"], [role="link"]');
|
|
889
|
+
return Boolean(nestedInteractive && nestedInteractive !== currentTarget);
|
|
890
|
+
}
|
|
891
|
+
function ListingImageFallback({
|
|
892
|
+
mediaRatio,
|
|
893
|
+
seed,
|
|
894
|
+
title
|
|
895
|
+
}) {
|
|
896
|
+
return /* @__PURE__ */ jsx6(
|
|
897
|
+
GdsGeneratedThumbnail,
|
|
898
|
+
{
|
|
899
|
+
seed,
|
|
900
|
+
categories: [{ key: "listing", label: title, icon: "Gallery" }],
|
|
901
|
+
badges: "none",
|
|
902
|
+
aspectRatio: mediaRatio === "1:1" ? "1:1" : mediaRatio === "16:9" ? "16:9" : "4:3"
|
|
903
|
+
}
|
|
904
|
+
);
|
|
905
|
+
}
|
|
906
|
+
function ListingAffordance({ affordance }) {
|
|
907
|
+
const config = GdsVocabulary[affordance.action];
|
|
908
|
+
const Icon = config.icon;
|
|
909
|
+
const label = affordance.ariaLabel ?? getSemanticActionLabel(affordance.action);
|
|
910
|
+
const onMedia = affordance.presentation === "outline-on-media";
|
|
911
|
+
const mediaStyle = onMedia ? {
|
|
912
|
+
background: "transparent",
|
|
913
|
+
color: "var(--gds-text-on-inverse, var(--mantine-color-white))",
|
|
914
|
+
filter: "drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55))"
|
|
915
|
+
} : void 0;
|
|
916
|
+
const activeStyle = affordance.active ? {
|
|
917
|
+
// Accent on its own tint is 1.60:1 in high-contrast dark; use the tint's derived foreground.
|
|
918
|
+
color: "var(--gds-brand-accent-tint-fg, var(--gds-brand-accent-action, var(--gds-vibe-accent, var(--mantine-primary-color-filled))))",
|
|
919
|
+
background: "var(--gds-brand-accent-tint, var(--mantine-color-default-hover))"
|
|
920
|
+
} : void 0;
|
|
921
|
+
if (affordance.href) {
|
|
922
|
+
return /* @__PURE__ */ jsx6(
|
|
923
|
+
ActionIcon2,
|
|
924
|
+
{
|
|
925
|
+
component: "a",
|
|
926
|
+
href: affordance.href,
|
|
927
|
+
variant: onMedia ? "transparent" : "subtle",
|
|
928
|
+
size: "xl",
|
|
929
|
+
"aria-label": label,
|
|
930
|
+
"data-gds-active": affordance.active ? "true" : void 0,
|
|
931
|
+
style: { ...mediaStyle, ...activeStyle },
|
|
932
|
+
disabled: affordance.disabled,
|
|
933
|
+
children: /* @__PURE__ */ jsx6(Icon, { size: "1rem", stroke: 1.75 })
|
|
934
|
+
}
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
return /* @__PURE__ */ jsx6(
|
|
938
|
+
ActionIcon2,
|
|
939
|
+
{
|
|
940
|
+
variant: onMedia ? "transparent" : "subtle",
|
|
941
|
+
size: "xl",
|
|
942
|
+
"aria-label": label,
|
|
943
|
+
onClick: affordance.onClick,
|
|
944
|
+
"data-gds-active": affordance.active ? "true" : void 0,
|
|
945
|
+
style: { ...mediaStyle, ...activeStyle },
|
|
946
|
+
disabled: affordance.disabled,
|
|
947
|
+
children: /* @__PURE__ */ jsx6(Icon, { size: "1rem", stroke: 1.75 })
|
|
948
|
+
}
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
function ListingPickBadge({
|
|
952
|
+
config,
|
|
953
|
+
defaultLabel
|
|
954
|
+
}) {
|
|
955
|
+
const override = typeof config === "object" ? config : void 0;
|
|
956
|
+
const label = override?.label ?? defaultLabel;
|
|
957
|
+
const ariaLabel = override?.ariaLabel ?? (typeof label === "string" ? label : defaultLabel);
|
|
958
|
+
return /* @__PURE__ */ jsxs5(
|
|
959
|
+
Group3,
|
|
960
|
+
{
|
|
961
|
+
gap: 4,
|
|
962
|
+
wrap: "nowrap",
|
|
963
|
+
align: "center",
|
|
964
|
+
role: "group",
|
|
965
|
+
"aria-label": ariaLabel,
|
|
966
|
+
"data-gds-listing-pick-badge": true,
|
|
967
|
+
style: {
|
|
968
|
+
width: "fit-content",
|
|
969
|
+
borderRadius: "var(--gds-radius-pill)",
|
|
970
|
+
backgroundColor: "var(--gds-badge-pick-bg, color-mix(in srgb, var(--gds-text-primary) 60%, transparent))",
|
|
971
|
+
color: "var(--gds-text-on-inverse, var(--mantine-color-white))",
|
|
972
|
+
fontSize: `${GDS_LISTING_PICK_BADGE_FONT_SIZE_PX}px`,
|
|
973
|
+
lineHeight: `${GDS_LISTING_PICK_BADGE_LINE_HEIGHT_PX}px`,
|
|
974
|
+
fontWeight: 700,
|
|
975
|
+
paddingBlock: `${GDS_LISTING_PICK_BADGE_PADDING_BLOCK_PX}px`,
|
|
976
|
+
paddingInline: `${GDS_LISTING_PICK_BADGE_PADDING_INLINE_PX}px`
|
|
977
|
+
},
|
|
978
|
+
children: [
|
|
979
|
+
/* @__PURE__ */ jsx6(GdsIcons.Star, { size: GDS_LISTING_PICK_BADGE_ICON_PX, stroke: 1.75, fill: "currentColor", "aria-hidden": "true" }),
|
|
980
|
+
/* @__PURE__ */ jsx6("span", { children: label })
|
|
981
|
+
]
|
|
982
|
+
}
|
|
983
|
+
);
|
|
984
|
+
}
|
|
985
|
+
function ListingCard({
|
|
986
|
+
title,
|
|
987
|
+
href,
|
|
988
|
+
description,
|
|
989
|
+
image,
|
|
990
|
+
imageAlt,
|
|
991
|
+
mediaSeed,
|
|
992
|
+
mediaRatio = "4:3",
|
|
993
|
+
metadata = [],
|
|
994
|
+
featured = false,
|
|
995
|
+
selected = false,
|
|
996
|
+
sponsoredDisclosure,
|
|
997
|
+
price,
|
|
998
|
+
rating,
|
|
999
|
+
ratingLabel: ratingLabelProp,
|
|
1000
|
+
primaryAction,
|
|
1001
|
+
reason,
|
|
1002
|
+
reasonLabel: reasonLabelProp,
|
|
1003
|
+
score,
|
|
1004
|
+
actions,
|
|
1005
|
+
mediaOverlay,
|
|
1006
|
+
mediaAffordance,
|
|
1007
|
+
pickBadge,
|
|
1008
|
+
saveAction,
|
|
1009
|
+
saved = false,
|
|
1010
|
+
shareAction,
|
|
1011
|
+
compact = false,
|
|
1012
|
+
size = "md",
|
|
1013
|
+
density = "comfortable",
|
|
1014
|
+
variant = "default",
|
|
1015
|
+
interactiveMode = "none",
|
|
1016
|
+
revealContent,
|
|
1017
|
+
onSurfaceActivate,
|
|
1018
|
+
defaultFlipped = false
|
|
1019
|
+
}) {
|
|
1020
|
+
const { t } = useGdsTranslation3();
|
|
1021
|
+
const ratingLabel = ratingLabelProp ?? t("gds.listingCard.ratingLabel", "Rating");
|
|
1022
|
+
const reasonLabel = reasonLabelProp ?? t("gds.listingCard.reasonLabel", "Why this fits");
|
|
1023
|
+
const featuredLabel = t("gds.listingCard.featuredLabel", "Featured");
|
|
1024
|
+
const pickLabel = t("gds.listingCard.pickLabel", "Pick");
|
|
1025
|
+
const [flipped, setFlipped] = useState(defaultFlipped);
|
|
1026
|
+
const resolvedActions = resolveCardActions(actions);
|
|
1027
|
+
const contract = resolveGdsCardContract({ compact, size, density, variant });
|
|
1028
|
+
const resolvedSaveAction = saveAction ? { ...saveAction, active: saveAction.active ?? saved } : void 0;
|
|
1029
|
+
const cardPadding = contract.padding;
|
|
1030
|
+
const isInteractive = interactiveMode !== "none";
|
|
1031
|
+
const isFlipMode = interactiveMode === "flip" && Boolean(revealContent);
|
|
1032
|
+
const isRowTile = contract.mediaPlacement === "left";
|
|
1033
|
+
const emphasized = featured || selected;
|
|
1034
|
+
const titleContent = href && typeof title === "string" && interactiveMode === "none" ? /* @__PURE__ */ jsx6(Text2, { component: "a", href, inherit: true, td: "none", children: title }) : title;
|
|
1035
|
+
const activateSurface = (event) => {
|
|
1036
|
+
if (isNestedInteractiveTarget(event.target, event.currentTarget)) {
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
1039
|
+
if (isFlipMode) {
|
|
1040
|
+
setFlipped((current) => !current);
|
|
1041
|
+
onSurfaceActivate?.();
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
if (interactiveMode === "surface-button") {
|
|
1045
|
+
onSurfaceActivate?.();
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
if (interactiveMode === "surface-link" && href) {
|
|
1049
|
+
onSurfaceActivate?.();
|
|
1050
|
+
if (typeof window !== "undefined") {
|
|
1051
|
+
window.location.assign(href);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
const handleKeyDown = (event) => {
|
|
1056
|
+
if (!isInteractive || isNestedInteractiveTarget(event.target, event.currentTarget)) {
|
|
1057
|
+
return;
|
|
1058
|
+
}
|
|
1059
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
1060
|
+
event.preventDefault();
|
|
1061
|
+
activateSurface(event);
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
const surfaceLabel = typeof title === "string" ? title : "listing";
|
|
1065
|
+
const interactiveProps = isInteractive ? {
|
|
1066
|
+
role: interactiveMode === "surface-link" ? "link" : "button",
|
|
1067
|
+
tabIndex: 0,
|
|
1068
|
+
onClick: activateSurface,
|
|
1069
|
+
onKeyDown: handleKeyDown,
|
|
1070
|
+
"aria-expanded": isFlipMode ? flipped : void 0,
|
|
1071
|
+
"aria-current": selected && interactiveMode === "surface-link" ? "true" : void 0,
|
|
1072
|
+
"aria-label": isFlipMode ? `Toggle details for ${surfaceLabel}` : surfaceLabel
|
|
1073
|
+
} : {};
|
|
1074
|
+
const mediaSeedValue = mediaSeed ?? href ?? imageAlt ?? (typeof title === "string" ? title : "gds-listing");
|
|
1075
|
+
const fallbackTitle = typeof title === "string" ? title : imageAlt ?? "Listing";
|
|
1076
|
+
const mediaContent = image ?? /* @__PURE__ */ jsx6(
|
|
1077
|
+
ListingImageFallback,
|
|
1078
|
+
{
|
|
1079
|
+
mediaRatio: isRowTile ? "1:1" : mediaRatio,
|
|
1080
|
+
seed: mediaSeedValue,
|
|
1081
|
+
title: fallbackTitle
|
|
1082
|
+
}
|
|
1083
|
+
);
|
|
1084
|
+
const pickBadgeElement = pickBadge ? /* @__PURE__ */ jsx6(ListingPickBadge, { config: pickBadge, defaultLabel: pickLabel }) : null;
|
|
1085
|
+
const topLeftOverlay = pickBadgeElement ? /* @__PURE__ */ jsx6(
|
|
1086
|
+
Box2,
|
|
1087
|
+
{
|
|
1088
|
+
style: {
|
|
1089
|
+
position: "absolute",
|
|
1090
|
+
insetBlockStart: `${GDS_LISTING_PICK_BADGE_INSET_PX}px`,
|
|
1091
|
+
insetInlineStart: `${GDS_LISTING_PICK_BADGE_INSET_PX}px`,
|
|
1092
|
+
zIndex: 1
|
|
1093
|
+
},
|
|
1094
|
+
children: mediaOverlay ? /* @__PURE__ */ jsxs5(Stack3, { gap: "xs", children: [
|
|
1095
|
+
pickBadgeElement,
|
|
1096
|
+
mediaOverlay
|
|
1097
|
+
] }) : pickBadgeElement
|
|
1098
|
+
}
|
|
1099
|
+
) : mediaOverlay ? /* @__PURE__ */ jsx6(Box2, { style: { position: "absolute", top: "var(--mantine-spacing-xs)", left: "var(--mantine-spacing-xs)", zIndex: 1 }, children: mediaOverlay }) : null;
|
|
1100
|
+
const affordanceOverlay = mediaAffordance ? /* @__PURE__ */ jsx6(Box2, { style: { position: "absolute", top: 0, right: 0, zIndex: 1 }, children: /* @__PURE__ */ jsx6(ListingAffordance, { affordance: mediaAffordance }) }) : null;
|
|
1101
|
+
const hasMediaOverlayContent = Boolean(mediaOverlay || mediaAffordance || pickBadge);
|
|
1102
|
+
const mediaBlock = isRowTile ? /* @__PURE__ */ jsxs5(
|
|
1103
|
+
Box2,
|
|
1104
|
+
{
|
|
1105
|
+
"data-gds-listing-row-tile": true,
|
|
1106
|
+
style: {
|
|
1107
|
+
position: "relative",
|
|
1108
|
+
flex: `0 0 ${GDS_LISTING_TILE_SIZE_PX}px`,
|
|
1109
|
+
width: GDS_LISTING_TILE_SIZE_PX,
|
|
1110
|
+
height: GDS_LISTING_TILE_SIZE_PX,
|
|
1111
|
+
overflow: "hidden",
|
|
1112
|
+
borderRadius: "var(--gds-radius-thumbnail)"
|
|
1113
|
+
},
|
|
1114
|
+
children: [
|
|
1115
|
+
mediaContent,
|
|
1116
|
+
topLeftOverlay,
|
|
1117
|
+
affordanceOverlay
|
|
1118
|
+
]
|
|
1119
|
+
}
|
|
1120
|
+
) : hasMediaOverlayContent ? (
|
|
1121
|
+
// Positioned wrapper only when something is actually overlaid, so a card without
|
|
1122
|
+
// overlays keeps its previous DOM exactly (issue 679).
|
|
1123
|
+
/* @__PURE__ */ jsxs5(Box2, { style: { position: "relative" }, children: [
|
|
1124
|
+
mediaContent,
|
|
1125
|
+
topLeftOverlay,
|
|
1126
|
+
affordanceOverlay
|
|
1127
|
+
] })
|
|
1128
|
+
) : mediaContent;
|
|
1129
|
+
const contentItems = /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1130
|
+
featured || sponsoredDisclosure ? /* @__PURE__ */ jsxs5(Group3, { justify: "space-between", gap: "sm", wrap: "wrap", children: [
|
|
1131
|
+
featured ? /* @__PURE__ */ jsx6(
|
|
1132
|
+
Badge2,
|
|
1133
|
+
{
|
|
1134
|
+
variant: "light",
|
|
1135
|
+
style: {
|
|
1136
|
+
color: "var(--gds-brand-accent-tint-fg, var(--gds-brand-accent-action, var(--gds-vibe-accent, var(--mantine-primary-color-filled))))",
|
|
1137
|
+
backgroundColor: "var(--gds-brand-accent-tint, var(--mantine-color-default-hover))"
|
|
1138
|
+
},
|
|
1139
|
+
children: featuredLabel
|
|
1140
|
+
}
|
|
1141
|
+
) : /* @__PURE__ */ jsx6("span", {}),
|
|
1142
|
+
sponsoredDisclosure ? /* @__PURE__ */ jsx6(Text2, { size: "xs", c: "dimmed", children: sponsoredDisclosure }) : null
|
|
1143
|
+
] }) : null,
|
|
1144
|
+
/* @__PURE__ */ jsxs5(Stack3, { gap: 4, children: [
|
|
1145
|
+
/* @__PURE__ */ jsx6(Title2, { order: contract.titleOrder, lineClamp: 2, children: titleContent }),
|
|
1146
|
+
description ? /* @__PURE__ */ jsx6(Text2, { size: "sm", c: "dimmed", lineClamp: contract.descriptionClamp, children: description }) : null
|
|
1147
|
+
] }),
|
|
1148
|
+
metadata.length ? /* @__PURE__ */ jsx6(Stack3, { gap: "xs", children: metadata.map((item) => /* @__PURE__ */ jsxs5(Group3, { justify: "space-between", align: "flex-start", gap: "sm", wrap: "nowrap", children: [
|
|
1149
|
+
/* @__PURE__ */ jsxs5(Group3, { gap: "xs", wrap: "nowrap", style: { minWidth: 0, flex: 1 }, children: [
|
|
1150
|
+
item.icon,
|
|
1151
|
+
/* @__PURE__ */ jsx6(Text2, { size: "sm", c: item.tone ? toneColorMap[item.tone] : "dimmed", lineClamp: 1, children: item.label })
|
|
1152
|
+
] }),
|
|
1153
|
+
item.value ? /* @__PURE__ */ jsx6(Text2, { size: "sm", fw: 500, ta: "right", children: item.value }) : null
|
|
1154
|
+
] }, item.id)) }) : null,
|
|
1155
|
+
reason ? /* @__PURE__ */ jsxs5(Stack3, { gap: 4, role: "group", "aria-label": reasonLabel, children: [
|
|
1156
|
+
/* @__PURE__ */ jsx6(Text2, { size: "xs", fw: 700, tt: "uppercase", c: "dimmed", children: reasonLabel }),
|
|
1157
|
+
reason
|
|
1158
|
+
] }) : null,
|
|
1159
|
+
/* @__PURE__ */ jsxs5(Group3, { justify: "space-between", align: "center", gap: "sm", wrap: "wrap", children: [
|
|
1160
|
+
/* @__PURE__ */ jsxs5(Stack3, { gap: 2, style: { minWidth: 0, flex: 1 }, children: [
|
|
1161
|
+
price ? /* @__PURE__ */ jsx6(
|
|
1162
|
+
Text2,
|
|
1163
|
+
{
|
|
1164
|
+
fw: 700,
|
|
1165
|
+
size: contract.size === "xs" || contract.size === "sm" ? "md" : "lg",
|
|
1166
|
+
style: { color: "var(--gds-price, var(--gds-brand-accent-action, var(--gds-vibe-accent, var(--mantine-primary-color-filled))))" },
|
|
1167
|
+
children: price
|
|
1168
|
+
}
|
|
1169
|
+
) : null,
|
|
1170
|
+
rating ? /* @__PURE__ */ jsxs5(Group3, { gap: 4, wrap: "nowrap", "aria-label": ratingLabel, children: [
|
|
1171
|
+
/* @__PURE__ */ jsx6(
|
|
1172
|
+
GdsIcons.Star,
|
|
1173
|
+
{
|
|
1174
|
+
size: "1rem",
|
|
1175
|
+
stroke: 1.75,
|
|
1176
|
+
fill: "currentColor",
|
|
1177
|
+
style: { color: "var(--gds-star, var(--gds-brand-accent-action, var(--gds-vibe-accent, var(--mantine-primary-color-filled))))" }
|
|
1178
|
+
}
|
|
1179
|
+
),
|
|
1180
|
+
/* @__PURE__ */ jsx6(Text2, { size: "sm", fw: 600, style: { color: "var(--gds-star, var(--gds-brand-accent-action, var(--gds-vibe-accent, var(--mantine-primary-color-filled))))" }, children: rating })
|
|
1181
|
+
] }) : null
|
|
1182
|
+
] }),
|
|
1183
|
+
score ? /* @__PURE__ */ jsx6(Group3, { gap: "xs", wrap: "nowrap", children: score }) : null,
|
|
1184
|
+
/* @__PURE__ */ jsxs5(Group3, { gap: "xs", wrap: "nowrap", justify: "flex-end", style: { marginInlineStart: "auto" }, children: [
|
|
1185
|
+
resolvedSaveAction ? /* @__PURE__ */ jsx6(ListingAffordance, { affordance: resolvedSaveAction }) : null,
|
|
1186
|
+
shareAction ? /* @__PURE__ */ jsx6(ListingAffordance, { affordance: shareAction }) : null,
|
|
1187
|
+
resolvedActions ? null : primaryAction,
|
|
1188
|
+
isFlipMode ? /* @__PURE__ */ jsx6(Text2, { size: "xs", c: "dimmed", children: "Press Enter or Space to reveal details." }) : null
|
|
1189
|
+
] })
|
|
1190
|
+
] }),
|
|
1191
|
+
resolvedActions ? /* @__PURE__ */ jsx6(Group3, { gap: "sm", wrap: "wrap", role: "group", "aria-label": "Listing actions", children: resolvedActions.map((action, index) => (
|
|
1192
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
1193
|
+
/* @__PURE__ */ jsx6("span", { children: action }, index)
|
|
1194
|
+
)) }) : null
|
|
1195
|
+
] });
|
|
1196
|
+
return /* @__PURE__ */ jsx6(
|
|
1197
|
+
Card,
|
|
1198
|
+
{
|
|
1199
|
+
withBorder: true,
|
|
1200
|
+
radius: "lg",
|
|
1201
|
+
padding: cardPadding,
|
|
1202
|
+
...contract.dataAttributes,
|
|
1203
|
+
"data-gds-listing-card": true,
|
|
1204
|
+
"data-gds-card-interactive-mode": interactiveMode,
|
|
1205
|
+
"data-gds-card-flipped": isFlipMode ? String(flipped) : void 0,
|
|
1206
|
+
"data-gds-listing-featured": featured ? "true" : void 0,
|
|
1207
|
+
"data-gds-listing-selected": selected ? "true" : void 0,
|
|
1208
|
+
style: {
|
|
1209
|
+
background: "var(--gds-bg-card, var(--gds-vibe-surface, var(--mantine-color-body)))",
|
|
1210
|
+
borderColor: "var(--gds-border-card, var(--gds-vibe-border, var(--mantine-color-default-border)))",
|
|
1211
|
+
...isInteractive ? { cursor: "pointer", transition: "transform var(--gds-motion-duration-fast) var(--gds-motion-ease-standard), box-shadow var(--gds-motion-duration-fast) var(--gds-motion-ease-standard)" } : {},
|
|
1212
|
+
// Emphasis is a ring, never a lift: no transform is set here, in any state.
|
|
1213
|
+
...emphasized ? {
|
|
1214
|
+
borderColor: "var(--gds-listing-featured-border, var(--gds-brand-accent-action, var(--gds-vibe-accent, var(--mantine-primary-color-filled))))",
|
|
1215
|
+
boxShadow: "var(--gds-ring-featured, 0 0 0 3px color-mix(in srgb, var(--gds-vibe-accent) 14%, transparent)), var(--gds-elevation-panel)"
|
|
1216
|
+
} : {}
|
|
1217
|
+
},
|
|
1218
|
+
...interactiveProps,
|
|
1219
|
+
children: /* @__PURE__ */ jsx6(Stack3, { gap: contract.gap, children: isFlipMode && flipped ? revealContent : isRowTile ? /* @__PURE__ */ jsxs5(Group3, { gap: contract.gap, wrap: "nowrap", align: "flex-start", "data-gds-listing-row": true, children: [
|
|
1220
|
+
mediaBlock,
|
|
1221
|
+
/* @__PURE__ */ jsx6(Stack3, { gap: contract.gap, style: { minWidth: 0, flex: 1 }, children: contentItems })
|
|
1222
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1223
|
+
mediaBlock,
|
|
1224
|
+
contentItems
|
|
1225
|
+
] }) })
|
|
1226
|
+
}
|
|
1227
|
+
);
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
// src/locales/index.ts
|
|
1231
|
+
var gdsLocales = {
|
|
1232
|
+
en,
|
|
1233
|
+
es,
|
|
1234
|
+
hu,
|
|
1235
|
+
de,
|
|
1236
|
+
fr,
|
|
1237
|
+
it,
|
|
1238
|
+
ru,
|
|
1239
|
+
he,
|
|
1240
|
+
ar,
|
|
1241
|
+
zh,
|
|
1242
|
+
ja,
|
|
1243
|
+
ko
|
|
1244
|
+
};
|
|
1245
|
+
function getGdsMessages(locale) {
|
|
1246
|
+
return gdsLocales[locale] ?? en;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
// src/OwnedContrastSurface.tsx
|
|
1250
|
+
function createGdsOwnedContrastTokens(vibe, options) {
|
|
1251
|
+
const text = options.text ?? vibe.textLight;
|
|
1252
|
+
const muted = options.muted ?? vibe.mutedLight;
|
|
1253
|
+
const surface = options.surface ?? vibe.surfaceLight;
|
|
1254
|
+
const border = options.border ?? vibe.borderLight;
|
|
1255
|
+
return {
|
|
1256
|
+
text,
|
|
1257
|
+
muted,
|
|
1258
|
+
background: options.background,
|
|
1259
|
+
radius: options.radius,
|
|
1260
|
+
primary: vibe.primary,
|
|
1261
|
+
accent: vibe.accent,
|
|
1262
|
+
surface,
|
|
1263
|
+
border,
|
|
1264
|
+
link: options.link ?? `color-mix(in srgb, ${vibe.primary} 64%, ${text})`,
|
|
1265
|
+
control: options.control ?? `color-mix(in srgb, ${surface} 88%, ${vibe.primary} 8%)`,
|
|
1266
|
+
controlText: options.controlText ?? text,
|
|
1267
|
+
backgroundColor: options.backgroundColor ?? surface,
|
|
1268
|
+
borderColor: options.borderColor ?? border,
|
|
1269
|
+
boxShadow: options.boxShadow
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1272
|
+
function getGdsOwnedContrastProps({ role, tokens }) {
|
|
1273
|
+
const style = {
|
|
1274
|
+
"--mantine-color-text": tokens.text,
|
|
1275
|
+
"--mantine-color-dimmed": tokens.muted,
|
|
1276
|
+
"--gds-local-background": tokens.background,
|
|
1277
|
+
"--gds-local-radius": tokens.radius,
|
|
1278
|
+
"--gds-vibe-primary": tokens.primary,
|
|
1279
|
+
"--gds-vibe-accent": tokens.accent,
|
|
1280
|
+
"--gds-vibe-surface": tokens.surface,
|
|
1281
|
+
"--gds-vibe-border": tokens.border,
|
|
1282
|
+
"--gds-vibe-text": tokens.text,
|
|
1283
|
+
"--gds-vibe-muted": tokens.muted,
|
|
1284
|
+
"--gds-vibe-link": tokens.link,
|
|
1285
|
+
"--gds-vibe-control": tokens.control,
|
|
1286
|
+
"--gds-vibe-control-text": tokens.controlText,
|
|
1287
|
+
color: tokens.text,
|
|
1288
|
+
backgroundColor: tokens.backgroundColor,
|
|
1289
|
+
backgroundImage: "var(--gds-local-background)",
|
|
1290
|
+
borderColor: tokens.borderColor,
|
|
1291
|
+
boxShadow: tokens.boxShadow
|
|
1292
|
+
};
|
|
1293
|
+
return {
|
|
1294
|
+
"data-gds-owned-contrast": role,
|
|
1295
|
+
"data-gds-local-contrast": role,
|
|
1296
|
+
style
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
// src/FormField.tsx
|
|
1301
|
+
import { Box as Box3, Stack as Stack4, Text as Text3 } from "@mantine/core";
|
|
1302
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1303
|
+
function FormField({ label, description, error, children }) {
|
|
1304
|
+
return /* @__PURE__ */ jsx7(Box3, { component: "label", children: /* @__PURE__ */ jsxs6(Stack4, { gap: 4, children: [
|
|
1305
|
+
typeof label === "string" ? /* @__PURE__ */ jsx7(Text3, { size: "xs", fw: 600, c: "dimmed", children: label }) : label,
|
|
1306
|
+
description ? typeof description === "string" ? /* @__PURE__ */ jsx7(Text3, { size: "xs", c: "dimmed", children: description }) : description : null,
|
|
1307
|
+
children,
|
|
1308
|
+
error ? typeof error === "string" ? /* @__PURE__ */ jsx7(Text3, { size: "xs", c: "red.7", children: error }) : error : null
|
|
1309
|
+
] }) });
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
// src/SimpleDataTable.tsx
|
|
1313
|
+
import { useGdsTranslation as useGdsTranslation4 } from "@sovereignsquad/gds-theme";
|
|
1314
|
+
import { ScrollArea, Table } from "@mantine/core";
|
|
1315
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1316
|
+
function SimpleDataTable({
|
|
1317
|
+
columns,
|
|
1318
|
+
rows,
|
|
1319
|
+
loading = false,
|
|
1320
|
+
error = null,
|
|
1321
|
+
emptyTitle: emptyTitleProp,
|
|
1322
|
+
emptyDescription: emptyDescriptionProp,
|
|
1323
|
+
getRowKey,
|
|
1324
|
+
stateTitleOrder
|
|
1325
|
+
}) {
|
|
1326
|
+
const { t } = useGdsTranslation4();
|
|
1327
|
+
const emptyTitle = emptyTitleProp ?? t("gds.simpleDataTable.emptyTitle", "No data available");
|
|
1328
|
+
const emptyDescription = emptyDescriptionProp ?? t("gds.simpleDataTable.emptyDescription", "There is no live data to show yet.");
|
|
1329
|
+
if (error) {
|
|
1330
|
+
return /* @__PURE__ */ jsx8(StateBlock, { variant: "error", title: "Unable to load data", description: error, compact: true, titleOrder: stateTitleOrder });
|
|
1331
|
+
}
|
|
1332
|
+
if (loading) {
|
|
1333
|
+
return /* @__PURE__ */ jsx8(StateBlock, { variant: "loading", title: "Loading data", description: "Please wait while the shared dataset is prepared.", compact: true, titleOrder: stateTitleOrder });
|
|
1334
|
+
}
|
|
1335
|
+
if (!rows.length) {
|
|
1336
|
+
return /* @__PURE__ */ jsx8(StateBlock, { variant: "empty", title: emptyTitle, description: emptyDescription, compact: true, titleOrder: stateTitleOrder });
|
|
1337
|
+
}
|
|
1338
|
+
return /* @__PURE__ */ jsx8(ScrollArea, { children: /* @__PURE__ */ jsxs7(Table, { striped: true, highlightOnHover: true, withTableBorder: true, withColumnBorders: true, children: [
|
|
1339
|
+
/* @__PURE__ */ jsx8(Table.Thead, { children: /* @__PURE__ */ jsx8(Table.Tr, { children: columns.map((column) => /* @__PURE__ */ jsx8(Table.Th, { children: column.header }, String(column.key))) }) }),
|
|
1340
|
+
/* @__PURE__ */ jsx8(Table.Tbody, { children: rows.map((row, index) => /* @__PURE__ */ jsx8(Table.Tr, { children: columns.map((column) => /* @__PURE__ */ jsx8(Table.Td, { children: column.render ? column.render(row) : String(row[column.key] ?? "") }, String(column.key))) }, getRowKey ? getRowKey(row, index) : index)) })
|
|
1341
|
+
] }) });
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
// src/chart-colors.ts
|
|
1345
|
+
var gdsSeriesPalette = {
|
|
1346
|
+
primary: "var(--gds-brand-primary, var(--gds-vibe-primary, var(--mantine-primary-color-filled)))",
|
|
1347
|
+
success: "var(--gds-state-success, var(--mantine-color-green-6))",
|
|
1348
|
+
warning: "var(--gds-state-warning, var(--mantine-color-yellow-7))",
|
|
1349
|
+
danger: "var(--gds-state-danger, var(--mantine-color-red-6))",
|
|
1350
|
+
info: "var(--gds-state-info, var(--gds-vibe-accent, var(--mantine-primary-color-filled)))",
|
|
1351
|
+
neutral: "var(--gds-text-meta, var(--gds-vibe-muted, var(--mantine-color-gray-6)))",
|
|
1352
|
+
accent: "var(--gds-brand-accent-action, var(--gds-brand-accent, var(--gds-vibe-accent, var(--mantine-primary-color-filled))))"
|
|
1353
|
+
};
|
|
1354
|
+
function getGdsSeriesColor(tone = "primary") {
|
|
1355
|
+
return gdsSeriesPalette[tone];
|
|
1356
|
+
}
|
|
1357
|
+
var GDS_CHART_SERIES_COLORS = [
|
|
1358
|
+
"var(--gds-chart-series-1)",
|
|
1359
|
+
"var(--gds-chart-series-2)",
|
|
1360
|
+
"var(--gds-chart-series-3)",
|
|
1361
|
+
"var(--gds-chart-series-4)",
|
|
1362
|
+
"var(--gds-chart-series-5)",
|
|
1363
|
+
"var(--gds-chart-series-6)",
|
|
1364
|
+
"var(--gds-chart-series-7)",
|
|
1365
|
+
"var(--gds-chart-series-8)"
|
|
1366
|
+
];
|
|
1367
|
+
var GDS_CHART_SERIES_SLOTS = GDS_CHART_SERIES_COLORS.length;
|
|
1368
|
+
function getGdsChartSeriesColor(index) {
|
|
1369
|
+
const slot = Number.isFinite(index) ? Math.max(1, Math.trunc(index)) : 1;
|
|
1370
|
+
return GDS_CHART_SERIES_COLORS[(slot - 1) % GDS_CHART_SERIES_SLOTS];
|
|
1371
|
+
}
|
|
1372
|
+
function resolveGdsChartTokenColor(token) {
|
|
1373
|
+
const value = token.trim();
|
|
1374
|
+
if (Object.hasOwn(gdsSeriesPalette, value)) return gdsSeriesPalette[value];
|
|
1375
|
+
if (value.startsWith("--")) return `var(${value})`;
|
|
1376
|
+
if (/^[a-z][\w-]*(\.[\w-]+)+$/i.test(value)) {
|
|
1377
|
+
return `var(--gds-${value.replace(/\./g, "-")})`;
|
|
1378
|
+
}
|
|
1379
|
+
return value;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
// src/ChartTokenPanel.tsx
|
|
1383
|
+
import { Badge as Badge3, Box as Box4, Group as Group4, Paper as Paper2, Stack as Stack5, Text as Text4, Title as Title3 } from "@mantine/core";
|
|
1384
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1385
|
+
function ChartTokenPanel({
|
|
1386
|
+
title,
|
|
1387
|
+
description,
|
|
1388
|
+
summary,
|
|
1389
|
+
state = "ready",
|
|
1390
|
+
legend = [],
|
|
1391
|
+
children,
|
|
1392
|
+
tableFallback,
|
|
1393
|
+
retryAction
|
|
1394
|
+
}) {
|
|
1395
|
+
if (state === "loading") {
|
|
1396
|
+
return /* @__PURE__ */ jsx9(StateBlock, { variant: "loading", title: "Loading chart", description: summary, compact: true, action: retryAction });
|
|
1397
|
+
}
|
|
1398
|
+
if (state === "empty") {
|
|
1399
|
+
return /* @__PURE__ */ jsx9(StateBlock, { variant: "empty", title: "No chart data", description: summary, compact: true, action: retryAction });
|
|
1400
|
+
}
|
|
1401
|
+
if (state === "below-threshold") {
|
|
1402
|
+
return /* @__PURE__ */ jsx9(StateBlock, { variant: "not-enough-data", title: "Not enough data for chart", description: summary, compact: true, action: retryAction });
|
|
1403
|
+
}
|
|
1404
|
+
if (state === "error") {
|
|
1405
|
+
return /* @__PURE__ */ jsx9(StateBlock, { variant: "error", title: "Unable to load chart", description: summary, compact: true, action: retryAction });
|
|
1406
|
+
}
|
|
1407
|
+
return /* @__PURE__ */ jsx9(Paper2, { withBorder: true, radius: "xl", p: "lg", children: /* @__PURE__ */ jsxs8(Stack5, { gap: "md", children: [
|
|
1408
|
+
/* @__PURE__ */ jsxs8(Group4, { justify: "space-between", align: "flex-start", gap: "sm", children: [
|
|
1409
|
+
/* @__PURE__ */ jsxs8(Stack5, { gap: 4, children: [
|
|
1410
|
+
/* @__PURE__ */ jsx9(Title3, { order: 4, children: title }),
|
|
1411
|
+
description ? /* @__PURE__ */ jsx9(Text4, { size: "sm", c: "dimmed", children: description }) : null
|
|
1412
|
+
] }),
|
|
1413
|
+
state !== "ready" ? /* @__PURE__ */ jsx9(
|
|
1414
|
+
Badge3,
|
|
1415
|
+
{
|
|
1416
|
+
variant: "filled",
|
|
1417
|
+
style: {
|
|
1418
|
+
background: `var(--gds-badge-soft-${state === "permission-limited" ? "info" : "warning"})`,
|
|
1419
|
+
color: `var(--gds-badge-soft-${state === "permission-limited" ? "info" : "warning"}-fg)`
|
|
1420
|
+
},
|
|
1421
|
+
children: state.replace("-", " ")
|
|
1422
|
+
}
|
|
1423
|
+
) : null
|
|
1424
|
+
] }),
|
|
1425
|
+
/* @__PURE__ */ jsx9(Text4, { size: "sm", children: summary }),
|
|
1426
|
+
legend.length ? /* @__PURE__ */ jsx9(Group4, { component: "ul", role: "list", gap: "md", wrap: "wrap", "aria-label": "Chart legend", className: "gds-chart-legend", children: legend.map((item, index) => /* @__PURE__ */ jsxs8(
|
|
1427
|
+
Group4,
|
|
1428
|
+
{
|
|
1429
|
+
component: "li",
|
|
1430
|
+
gap: "xs",
|
|
1431
|
+
wrap: "nowrap",
|
|
1432
|
+
"data-token": item.token,
|
|
1433
|
+
title: typeof item.description === "string" ? item.description : void 0,
|
|
1434
|
+
children: [
|
|
1435
|
+
/* @__PURE__ */ jsx9(
|
|
1436
|
+
Box4,
|
|
1437
|
+
{
|
|
1438
|
+
component: "span",
|
|
1439
|
+
"aria-hidden": true,
|
|
1440
|
+
className: "gds-chart-legend-swatch",
|
|
1441
|
+
style: { background: resolveGdsChartTokenColor(item.token) }
|
|
1442
|
+
}
|
|
1443
|
+
),
|
|
1444
|
+
/* @__PURE__ */ jsx9(Text4, { component: "span", size: "sm", children: item.label })
|
|
1445
|
+
]
|
|
1446
|
+
},
|
|
1447
|
+
`${String(item.label)}-${index}`
|
|
1448
|
+
)) }) : null,
|
|
1449
|
+
children,
|
|
1450
|
+
tableFallback ? /* @__PURE__ */ jsxs8(Stack5, { gap: "xs", children: [
|
|
1451
|
+
/* @__PURE__ */ jsx9(Text4, { size: "sm", fw: 600, children: "Accessible data fallback" }),
|
|
1452
|
+
tableFallback
|
|
1453
|
+
] }) : null
|
|
1454
|
+
] }) });
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
// src/GdsChart.tsx
|
|
1458
|
+
import { useId as useId2 } from "react";
|
|
1459
|
+
import { Badge as Badge4, Group as Group5, Paper as Paper3, Stack as Stack6, Text as Text5 } from "@mantine/core";
|
|
1460
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1461
|
+
var gdsChartTypeRegistry = {
|
|
1462
|
+
line: { type: "line", label: "Line", family: "cartesian", minDataPoints: 2, maxDataPoints: 500, summaryHint: "Trend over an ordered series." },
|
|
1463
|
+
area: { type: "area", label: "Area", family: "cartesian", minDataPoints: 2, maxDataPoints: 500, summaryHint: "Filled trend over an ordered series." },
|
|
1464
|
+
bar: { type: "bar", label: "Bar", family: "cartesian", minDataPoints: 1, maxDataPoints: 200, summaryHint: "Category comparison." },
|
|
1465
|
+
"stacked-bar": { type: "stacked-bar", label: "Stacked bar", family: "cartesian", minDataPoints: 2, maxDataPoints: 300, requiresGroup: true, summaryHint: "Grouped category contribution." },
|
|
1466
|
+
pie: { type: "pie", label: "Pie", family: "part-to-whole", minDataPoints: 2, maxDataPoints: 12, summaryHint: "Part-to-whole split." },
|
|
1467
|
+
donut: { type: "donut", label: "Donut", family: "part-to-whole", minDataPoints: 2, maxDataPoints: 12, summaryHint: "Part-to-whole split with center context." },
|
|
1468
|
+
radar: { type: "radar", label: "Radar", family: "radial", minDataPoints: 3, maxDataPoints: 24, summaryHint: "Multi-dimension profile." },
|
|
1469
|
+
scatter: { type: "scatter", label: "Scatter", family: "cartesian", minDataPoints: 2, maxDataPoints: 500, supportsSecondaryValue: true, summaryHint: "Correlation or distribution map." },
|
|
1470
|
+
bubble: { type: "bubble", label: "Bubble", family: "cartesian", minDataPoints: 2, maxDataPoints: 300, supportsSecondaryValue: true, summaryHint: "Weighted distribution map." },
|
|
1471
|
+
heatmap: { type: "heatmap", label: "Heatmap", family: "matrix", minDataPoints: 2, maxDataPoints: 400, summaryHint: "Intensity matrix." },
|
|
1472
|
+
funnel: { type: "funnel", label: "Funnel", family: "process", minDataPoints: 2, maxDataPoints: 12, summaryHint: "Stage conversion progression." },
|
|
1473
|
+
treemap: { type: "treemap", label: "Treemap", family: "hierarchy", minDataPoints: 2, maxDataPoints: 200, summaryHint: "Hierarchical distribution." },
|
|
1474
|
+
candlestick: { type: "candlestick", label: "Candlestick", family: "cartesian", minDataPoints: 1, maxDataPoints: 500, summaryHint: "Open-high-low-close price movement over time." },
|
|
1475
|
+
sankey: { type: "sankey", label: "Sankey", family: "process", minDataPoints: 1, maxDataPoints: 200, requiresGroup: false, summaryHint: "Flow volume between source and target stages." }
|
|
1476
|
+
};
|
|
1477
|
+
var gdsDefaultChartLegend = [
|
|
1478
|
+
{ label: "Primary series", token: "chart.series-1", description: "Primary measured value" },
|
|
1479
|
+
{ label: "Secondary series", token: "chart.series-2", description: "Grouped or comparative value" }
|
|
1480
|
+
];
|
|
1481
|
+
var gdsChartSetATypeRegistry = {
|
|
1482
|
+
line: gdsChartTypeRegistry.line,
|
|
1483
|
+
area: gdsChartTypeRegistry.area,
|
|
1484
|
+
bar: gdsChartTypeRegistry.bar,
|
|
1485
|
+
"stacked-bar": gdsChartTypeRegistry["stacked-bar"],
|
|
1486
|
+
pie: gdsChartTypeRegistry.pie,
|
|
1487
|
+
donut: gdsChartTypeRegistry.donut,
|
|
1488
|
+
radar: gdsChartTypeRegistry.radar,
|
|
1489
|
+
scatter: gdsChartTypeRegistry.scatter
|
|
1490
|
+
};
|
|
1491
|
+
var gdsChartSetBTypeRegistry = {
|
|
1492
|
+
bubble: gdsChartTypeRegistry.bubble,
|
|
1493
|
+
heatmap: gdsChartTypeRegistry.heatmap,
|
|
1494
|
+
funnel: gdsChartTypeRegistry.funnel,
|
|
1495
|
+
treemap: gdsChartTypeRegistry.treemap
|
|
1496
|
+
};
|
|
1497
|
+
var gdsChartSetCTypeRegistry = {
|
|
1498
|
+
candlestick: gdsChartTypeRegistry.candlestick,
|
|
1499
|
+
sankey: gdsChartTypeRegistry.sankey
|
|
1500
|
+
};
|
|
1501
|
+
function isGdsChartSetAType(type) {
|
|
1502
|
+
return type in gdsChartSetATypeRegistry;
|
|
1503
|
+
}
|
|
1504
|
+
function isGdsChartSetBType(type) {
|
|
1505
|
+
return type in gdsChartSetBTypeRegistry;
|
|
1506
|
+
}
|
|
1507
|
+
function isGdsChartSetCType(type) {
|
|
1508
|
+
return type in gdsChartSetCTypeRegistry;
|
|
1509
|
+
}
|
|
1510
|
+
function isFiniteNumber(value) {
|
|
1511
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
1512
|
+
}
|
|
1513
|
+
function decimateGdsChartData(data, maxDataPoints) {
|
|
1514
|
+
if (data.length <= maxDataPoints) {
|
|
1515
|
+
return data;
|
|
1516
|
+
}
|
|
1517
|
+
if (maxDataPoints <= 1) {
|
|
1518
|
+
return data.slice(0, 1);
|
|
1519
|
+
}
|
|
1520
|
+
const lastIndex = data.length - 1;
|
|
1521
|
+
const selectedIndexes = /* @__PURE__ */ new Set();
|
|
1522
|
+
for (let index = 0; index < maxDataPoints; index += 1) {
|
|
1523
|
+
selectedIndexes.add(Math.round(index * lastIndex / (maxDataPoints - 1)));
|
|
1524
|
+
}
|
|
1525
|
+
return Array.from(selectedIndexes).sort((a, b) => a - b).map((index) => data[index]);
|
|
1526
|
+
}
|
|
1527
|
+
function getSetARendererLabel(type) {
|
|
1528
|
+
const labels = {
|
|
1529
|
+
line: "ordered trend path",
|
|
1530
|
+
area: "filled trend surface",
|
|
1531
|
+
bar: "category bars",
|
|
1532
|
+
"stacked-bar": "grouped category stacks",
|
|
1533
|
+
pie: "part-to-whole slices",
|
|
1534
|
+
donut: "part-to-whole ring",
|
|
1535
|
+
radar: "radial dimension profile",
|
|
1536
|
+
scatter: "x/y point field"
|
|
1537
|
+
};
|
|
1538
|
+
return labels[type] ?? "vendor-neutral chart surface";
|
|
1539
|
+
}
|
|
1540
|
+
function getSetBRendererLabel(type) {
|
|
1541
|
+
const labels = {
|
|
1542
|
+
bubble: "weighted x/y bubble field",
|
|
1543
|
+
heatmap: "row/column intensity matrix",
|
|
1544
|
+
funnel: "stage conversion progression",
|
|
1545
|
+
treemap: "hierarchical area distribution"
|
|
1546
|
+
};
|
|
1547
|
+
return labels[type] ?? "advanced chart surface";
|
|
1548
|
+
}
|
|
1549
|
+
function getSetCRendererLabel(type) {
|
|
1550
|
+
const labels = {
|
|
1551
|
+
candlestick: "open-high-low-close price series",
|
|
1552
|
+
sankey: "source-to-target flow diagram"
|
|
1553
|
+
};
|
|
1554
|
+
return labels[type] ?? "specialized chart surface";
|
|
1555
|
+
}
|
|
1556
|
+
function validateGdsChartData(type, data, config = {}) {
|
|
1557
|
+
const definition = gdsChartTypeRegistry[type];
|
|
1558
|
+
const minDataPoints = config.minDataPoints ?? definition.minDataPoints;
|
|
1559
|
+
const maxDataPoints = config.maxDataPoints ?? definition.maxDataPoints;
|
|
1560
|
+
const issues = [];
|
|
1561
|
+
let visibleData = data;
|
|
1562
|
+
let decimated = false;
|
|
1563
|
+
if (!data.length) {
|
|
1564
|
+
return { state: "empty", issues: ["Dataset is empty."], visibleData: [], definition };
|
|
1565
|
+
}
|
|
1566
|
+
if (data.length < minDataPoints) {
|
|
1567
|
+
return {
|
|
1568
|
+
state: "below-threshold",
|
|
1569
|
+
issues: [`${definition.label} charts require at least ${minDataPoints} data points.`],
|
|
1570
|
+
visibleData: data,
|
|
1571
|
+
definition
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
if (data.length > maxDataPoints) {
|
|
1575
|
+
if (!config.decimateLargeSeries) {
|
|
1576
|
+
return {
|
|
1577
|
+
state: "error",
|
|
1578
|
+
issues: [`Dataset has ${data.length} points, above the ${maxDataPoints} point rendering budget.`],
|
|
1579
|
+
visibleData: data.slice(0, maxDataPoints),
|
|
1580
|
+
definition
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
visibleData = decimateGdsChartData(data, maxDataPoints);
|
|
1584
|
+
decimated = true;
|
|
1585
|
+
issues.push(`Dataset has ${data.length} points and was decimated to ${visibleData.length} points for rendering.`);
|
|
1586
|
+
}
|
|
1587
|
+
visibleData.forEach((item, index) => {
|
|
1588
|
+
if (!item.label.trim()) {
|
|
1589
|
+
issues.push(`Point ${index + 1} is missing a visible label.`);
|
|
1590
|
+
}
|
|
1591
|
+
if (item.value === null && (type === "line" || type === "area") && "connectNulls" in config && config.connectNulls) {
|
|
1592
|
+
return;
|
|
1593
|
+
}
|
|
1594
|
+
if (type === "candlestick") {
|
|
1595
|
+
return;
|
|
1596
|
+
}
|
|
1597
|
+
if (!isFiniteNumber(item.value)) {
|
|
1598
|
+
issues.push(`Point ${index + 1} has an invalid numeric value.`);
|
|
1599
|
+
}
|
|
1600
|
+
});
|
|
1601
|
+
if (definition.requiresGroup && visibleData.some((item) => !item.group)) {
|
|
1602
|
+
issues.push(`${definition.label} charts require a group value for every data point.`);
|
|
1603
|
+
}
|
|
1604
|
+
if (type === "pie" || type === "donut") {
|
|
1605
|
+
const numericValues = visibleData.map((item) => item.value).filter(isFiniteNumber);
|
|
1606
|
+
const total = numericValues.reduce((sum, value) => sum + value, 0);
|
|
1607
|
+
if (numericValues.some((value) => value < 0)) {
|
|
1608
|
+
issues.push(`${definition.label} charts cannot render negative slice values.`);
|
|
1609
|
+
}
|
|
1610
|
+
if (total <= 0) {
|
|
1611
|
+
issues.push(`${definition.label} charts require a positive total.`);
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
if (type === "radar") {
|
|
1615
|
+
const numericValues = visibleData.map((item) => item.value).filter(isFiniteNumber);
|
|
1616
|
+
if (numericValues.some((value) => value < 0)) {
|
|
1617
|
+
issues.push("Radar charts cannot render negative axis values.");
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
if (type === "scatter" && (!("requireSecondaryValue" in config) || config.requireSecondaryValue !== false)) {
|
|
1621
|
+
visibleData.forEach((item, index) => {
|
|
1622
|
+
if (!isFiniteNumber(item.secondaryValue)) {
|
|
1623
|
+
issues.push(`Scatter point ${index + 1} requires a numeric secondaryValue.`);
|
|
1624
|
+
}
|
|
1625
|
+
});
|
|
1626
|
+
}
|
|
1627
|
+
if (type === "bubble") {
|
|
1628
|
+
visibleData.forEach((item, index) => {
|
|
1629
|
+
if (!isFiniteNumber(item.secondaryValue)) {
|
|
1630
|
+
issues.push(`Bubble point ${index + 1} requires a numeric secondaryValue for bubble size.`);
|
|
1631
|
+
} else if (item.secondaryValue <= 0) {
|
|
1632
|
+
issues.push(`Bubble point ${index + 1} requires a positive secondaryValue for bubble size.`);
|
|
1633
|
+
}
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
if (type === "heatmap") {
|
|
1637
|
+
visibleData.forEach((item, index) => {
|
|
1638
|
+
if (!item.group) {
|
|
1639
|
+
issues.push(`Heatmap cell ${index + 1} requires a group value for the matrix row.`);
|
|
1640
|
+
}
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
if (type === "funnel") {
|
|
1644
|
+
const numericValues = visibleData.map((item) => item.value).filter(isFiniteNumber);
|
|
1645
|
+
if (numericValues.some((value) => value < 0)) {
|
|
1646
|
+
issues.push("Funnel charts cannot render negative stage values.");
|
|
1647
|
+
}
|
|
1648
|
+
const shouldEnforceDescending = !("enforceDescending" in config) || config.enforceDescending !== false;
|
|
1649
|
+
if (shouldEnforceDescending) {
|
|
1650
|
+
numericValues.forEach((value, index) => {
|
|
1651
|
+
const previousValue = numericValues[index - 1];
|
|
1652
|
+
if (index > 0 && value > previousValue) {
|
|
1653
|
+
issues.push(`Funnel stage ${index + 1} cannot be greater than the previous stage.`);
|
|
1654
|
+
}
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
if (type === "treemap") {
|
|
1659
|
+
visibleData.forEach((item, index) => {
|
|
1660
|
+
if (isFiniteNumber(item.value) && item.value <= 0) {
|
|
1661
|
+
issues.push(`Treemap node ${index + 1} requires a positive area value.`);
|
|
1662
|
+
}
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
if (type === "candlestick") {
|
|
1666
|
+
visibleData.forEach((item, index) => {
|
|
1667
|
+
const { open, high, low, close } = item;
|
|
1668
|
+
if (![open, high, low, close].every(isFiniteNumber)) {
|
|
1669
|
+
issues.push(`Candlestick point ${index + 1} requires numeric open, high, low, and close values.`);
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
if (high < Math.max(open, close) || low > Math.min(open, close)) {
|
|
1673
|
+
issues.push(`Candlestick point ${index + 1} has a high/low range that doesn't contain its open/close values.`);
|
|
1674
|
+
}
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
if (type === "sankey") {
|
|
1678
|
+
visibleData.forEach((item, index) => {
|
|
1679
|
+
if (!item.source || !item.target) {
|
|
1680
|
+
issues.push(`Sankey flow ${index + 1} requires both a source and a target node.`);
|
|
1681
|
+
}
|
|
1682
|
+
if (isFiniteNumber(item.value) && item.value < 0) {
|
|
1683
|
+
issues.push(`Sankey flow ${index + 1} cannot render a negative flow value.`);
|
|
1684
|
+
}
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
return {
|
|
1688
|
+
state: issues.length ? decimated && issues.length === 1 ? "partial" : "error" : "ready",
|
|
1689
|
+
issues,
|
|
1690
|
+
visibleData,
|
|
1691
|
+
definition
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
function DefaultChartRenderer({ type, title, summary, data, definition, labelledBy, describedBy }) {
|
|
1695
|
+
return /* @__PURE__ */ jsx10(Paper3, { withBorder: true, radius: "md", p: "md", role: "img", "aria-labelledby": labelledBy, "aria-describedby": describedBy, children: /* @__PURE__ */ jsxs9(Stack6, { gap: "sm", children: [
|
|
1696
|
+
/* @__PURE__ */ jsxs9(Group5, { justify: "space-between", children: [
|
|
1697
|
+
/* @__PURE__ */ jsx10(Text5, { id: labelledBy, fw: 700, children: title }),
|
|
1698
|
+
/* @__PURE__ */ jsx10(Badge4, { variant: "light", children: type })
|
|
1699
|
+
] }),
|
|
1700
|
+
/* @__PURE__ */ jsx10(Text5, { id: describedBy, size: "sm", c: "dimmed", children: summary }),
|
|
1701
|
+
/* @__PURE__ */ jsxs9(Text5, { size: "xs", c: "dimmed", children: [
|
|
1702
|
+
"Type lane: ",
|
|
1703
|
+
type
|
|
1704
|
+
] }),
|
|
1705
|
+
/* @__PURE__ */ jsxs9(Text5, { size: "xs", c: "dimmed", children: [
|
|
1706
|
+
"Registry family: ",
|
|
1707
|
+
definition.family
|
|
1708
|
+
] }),
|
|
1709
|
+
isGdsChartSetAType(type) ? /* @__PURE__ */ jsxs9(Text5, { size: "xs", c: "dimmed", children: [
|
|
1710
|
+
"Set A primitive: ",
|
|
1711
|
+
getSetARendererLabel(type)
|
|
1712
|
+
] }) : null,
|
|
1713
|
+
isGdsChartSetBType(type) ? /* @__PURE__ */ jsxs9(Text5, { size: "xs", c: "dimmed", children: [
|
|
1714
|
+
"Set B primitive: ",
|
|
1715
|
+
getSetBRendererLabel(type)
|
|
1716
|
+
] }) : null,
|
|
1717
|
+
isGdsChartSetCType(type) ? /* @__PURE__ */ jsxs9(Text5, { size: "xs", c: "dimmed", children: [
|
|
1718
|
+
"Set C primitive: ",
|
|
1719
|
+
getSetCRendererLabel(type)
|
|
1720
|
+
] }) : null,
|
|
1721
|
+
/* @__PURE__ */ jsxs9(Text5, { size: "xs", c: "dimmed", children: [
|
|
1722
|
+
"Data points: ",
|
|
1723
|
+
data.length
|
|
1724
|
+
] })
|
|
1725
|
+
] }) });
|
|
1726
|
+
}
|
|
1727
|
+
function GdsChart({
|
|
1728
|
+
type,
|
|
1729
|
+
title,
|
|
1730
|
+
summary,
|
|
1731
|
+
data,
|
|
1732
|
+
config = {},
|
|
1733
|
+
legend = gdsDefaultChartLegend,
|
|
1734
|
+
state,
|
|
1735
|
+
retryAction,
|
|
1736
|
+
renderer
|
|
1737
|
+
}) {
|
|
1738
|
+
const labelledBy = useId2();
|
|
1739
|
+
const describedBy = useId2();
|
|
1740
|
+
const validation = validateGdsChartData(type, data, config);
|
|
1741
|
+
const resolvedState = state ?? validation.state;
|
|
1742
|
+
const tableRows = validation.visibleData.map((item) => ({
|
|
1743
|
+
label: item.label,
|
|
1744
|
+
value: config.valueFormatter ? config.valueFormatter(item.value) : String(item.value ?? "missing"),
|
|
1745
|
+
secondaryValue: item.secondaryValue === void 0 || item.secondaryValue === null ? "-" : String(item.secondaryValue),
|
|
1746
|
+
group: item.group ?? "-"
|
|
1747
|
+
}));
|
|
1748
|
+
const Renderer = renderer ?? DefaultChartRenderer;
|
|
1749
|
+
return /* @__PURE__ */ jsx10(
|
|
1750
|
+
ChartTokenPanel,
|
|
1751
|
+
{
|
|
1752
|
+
title,
|
|
1753
|
+
description: `${validation.definition.label} chart. ${validation.definition.summaryHint}`,
|
|
1754
|
+
summary: validation.issues.length ? `${summary} ${validation.issues.join(" ")}` : summary,
|
|
1755
|
+
state: resolvedState,
|
|
1756
|
+
retryAction,
|
|
1757
|
+
legend,
|
|
1758
|
+
tableFallback: /* @__PURE__ */ jsx10(
|
|
1759
|
+
SimpleDataTable,
|
|
1760
|
+
{
|
|
1761
|
+
columns: [
|
|
1762
|
+
{ key: "label", header: "Label" },
|
|
1763
|
+
{ key: "value", header: config.tableValueHeader ?? "Value" },
|
|
1764
|
+
{ key: "secondaryValue", header: "Secondary value" },
|
|
1765
|
+
{ key: "group", header: config.groupLabel ?? "Group" }
|
|
1766
|
+
],
|
|
1767
|
+
rows: tableRows
|
|
1768
|
+
}
|
|
1769
|
+
),
|
|
1770
|
+
children: resolvedState === "ready" || resolvedState === "partial" || resolvedState === "permission-limited" ? /* @__PURE__ */ jsx10(
|
|
1771
|
+
Renderer,
|
|
1772
|
+
{
|
|
1773
|
+
type,
|
|
1774
|
+
title,
|
|
1775
|
+
summary,
|
|
1776
|
+
data: validation.visibleData,
|
|
1777
|
+
config,
|
|
1778
|
+
definition: validation.definition,
|
|
1779
|
+
labelledBy,
|
|
1780
|
+
describedBy
|
|
1781
|
+
}
|
|
1782
|
+
) : null
|
|
1783
|
+
}
|
|
1784
|
+
);
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
export {
|
|
1788
|
+
GdsVocabulary,
|
|
1789
|
+
createGdsVocabularyPack,
|
|
1790
|
+
mergeGdsVocabularyPacks,
|
|
1791
|
+
resolveSemanticActionConfig,
|
|
1792
|
+
getSemanticActionConfig,
|
|
1793
|
+
getSemanticActionLabel,
|
|
1794
|
+
gdsBadgeAccentColors,
|
|
1795
|
+
gdsBadgeAccentShades,
|
|
1796
|
+
GdsBadge,
|
|
1797
|
+
SectionPanel,
|
|
1798
|
+
ReferenceSection,
|
|
1799
|
+
ActionBar,
|
|
1800
|
+
gdsSeededRandom,
|
|
1801
|
+
gdsGeneratedPaletteCssRefs,
|
|
1802
|
+
resolveGdsGeneratedPaletteHex,
|
|
1803
|
+
GdsGeneratedThumbnail,
|
|
1804
|
+
gdsCardSizePaddingMap,
|
|
1805
|
+
gdsCardDensityPaddingMap,
|
|
1806
|
+
gdsCardTitleOrderMap,
|
|
1807
|
+
gdsCardGapMap,
|
|
1808
|
+
gdsCardMediaRatioMap,
|
|
1809
|
+
resolveGdsCardContract,
|
|
1810
|
+
MAX_LISTING_CARD_ACTIONS,
|
|
1811
|
+
GDS_LISTING_TILE_SIZE_PX,
|
|
1812
|
+
GDS_LISTING_PICK_BADGE_INSET_PX,
|
|
1813
|
+
GDS_LISTING_PICK_BADGE_ICON_PX,
|
|
1814
|
+
GDS_LISTING_PICK_BADGE_FONT_SIZE_PX,
|
|
1815
|
+
GDS_LISTING_PICK_BADGE_LINE_HEIGHT_PX,
|
|
1816
|
+
GDS_LISTING_PICK_BADGE_PADDING_BLOCK_PX,
|
|
1817
|
+
GDS_LISTING_PICK_BADGE_PADDING_INLINE_PX,
|
|
1818
|
+
ListingCard,
|
|
1819
|
+
gdsLocales,
|
|
1820
|
+
getGdsMessages,
|
|
1821
|
+
createGdsOwnedContrastTokens,
|
|
1822
|
+
getGdsOwnedContrastProps,
|
|
1823
|
+
FormField,
|
|
1824
|
+
SimpleDataTable,
|
|
1825
|
+
gdsSeriesPalette,
|
|
1826
|
+
getGdsSeriesColor,
|
|
1827
|
+
GDS_CHART_SERIES_COLORS,
|
|
1828
|
+
GDS_CHART_SERIES_SLOTS,
|
|
1829
|
+
getGdsChartSeriesColor,
|
|
1830
|
+
resolveGdsChartTokenColor,
|
|
1831
|
+
ChartTokenPanel,
|
|
1832
|
+
gdsChartTypeRegistry,
|
|
1833
|
+
gdsDefaultChartLegend,
|
|
1834
|
+
gdsChartSetATypeRegistry,
|
|
1835
|
+
gdsChartSetBTypeRegistry,
|
|
1836
|
+
gdsChartSetCTypeRegistry,
|
|
1837
|
+
isGdsChartSetAType,
|
|
1838
|
+
isGdsChartSetBType,
|
|
1839
|
+
isGdsChartSetCType,
|
|
1840
|
+
validateGdsChartData,
|
|
1841
|
+
GdsChart
|
|
1842
|
+
};
|