@datalayer/design 1.0.9 → 1.0.12

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.
@@ -1,18 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { useNavigate, useParams } from 'react-router-dom';
4
- import { ActionList, ActionMenu, Box, Button, Heading, Text, TextInput } from '@primer/react';
4
+ import { ActionList, ActionMenu, Button, Heading, Text, TextInput } from '@primer/react';
5
5
  import { ArrowLeftIcon } from '@primer/octicons-react';
6
6
  import GIF from 'gif.js';
7
7
  import gifWorkerUrl from 'gif.js/dist/gif.worker.js?url';
8
- import { DatalayerLogo, DatalayerLogoText, DatalayerTextAI, getLogoColors, useColorPalette, useThemeStore, } from '@datalayer/primer-addons';
8
+ import { Box, Card, DatalayerLogo, DatalayerLogoText, DatalayerTextAI, getLogoColors, useColorPalette, useThemeStore, } from '@datalayer/primer-addons';
9
9
  import { DATALAYER_SVG_GALLERY } from '../svg/gallery';
10
- import { SvgAvatarOrb } from '../avatar';
10
+ import { AVATAR_ORB_STATES, SvgAvatarOrb } from '../avatar';
11
11
  import DI from '../svg/SvgDI';
12
12
  import { SvgDla as DlaMark } from '../svg/SvgDla';
13
13
  import * as SvgAssets from '../svg';
14
14
  import SpitfireAssetUrl from '../svg/images/datalayer-1.3.0-spitfire.svg';
15
15
  import BlackSnakeAssetUrl from '../svg/images/datalayer-1.2.0-black-snake.svg';
16
+ import KingKongAssetUrl from '../svg/images/datalayer-king-kong.svg';
17
+ import KingKong2AssetUrl from '../svg/images/datalayer-king-kong-2.svg';
16
18
  const SEGMENTS = ['All', 'Artifacts', 'Avatar', 'Cases', 'Communication', 'Features', 'Heros', 'Logos', 'Partners', 'Pictos', 'Pixels', 'Releases', 'Systems'];
17
19
  const SEGMENT_BY_SLUG = SEGMENTS.reduce((acc, segment) => {
18
20
  acc[segment.toLowerCase()] = segment;
@@ -23,15 +25,33 @@ SEGMENT_BY_SLUG.hero = 'Heros';
23
25
  SEGMENT_BY_SLUG.system = 'Systems';
24
26
  SEGMENT_BY_SLUG.partner = 'Partners';
25
27
  const slugForSegment = (segment) => segment.toLowerCase();
28
+ /** A name too long for the row of tabs; the tab keeps the full one as its title. */
29
+ const SEGMENT_SHORT_LABELS = { Communication: 'Comms' };
26
30
  const BaseSvgLinesLogo = SvgAssets.SvgLinesLogo;
27
- function SvgSpitfireInline() {
31
+ /** What holds a logo in the gallery: centred, with room around it. */
32
+ const LOGO_HOST = {
33
+ width: '100%',
34
+ height: '100%',
35
+ minHeight: 120,
36
+ px: 2,
37
+ display: 'flex',
38
+ alignItems: 'center',
39
+ justifyContent: 'center',
40
+ overflow: 'hidden',
41
+ };
42
+ /**
43
+ * A release's trace, fetched and tinted from the theme (the Spitfire, the
44
+ * Black Snake, King Kong): its black ink in the palette's primary on a light
45
+ * theme and its spark on a dark one, on the palette's background.
46
+ */
47
+ function TintedSvgInline({ url, label }) {
28
48
  const p = useColorPalette();
29
49
  const tint = p.isLight ? p.primary : p.spark;
30
50
  const [svgMarkup, setSvgMarkup] = useState('');
31
51
  useEffect(() => {
32
52
  let cancelled = false;
33
53
  const loadAndTint = async () => {
34
- const response = await fetch(SpitfireAssetUrl);
54
+ const response = await fetch(url);
35
55
  const source = await response.text();
36
56
  if (cancelled) {
37
57
  return;
@@ -67,64 +87,20 @@ function SvgSpitfireInline() {
67
87
  return () => {
68
88
  cancelled = true;
69
89
  };
70
- }, [p.bg, tint]);
71
- return (_jsx(Box, { "aria-label": "Spitfire aircraft", sx: {
72
- width: '100%',
73
- height: '100%',
74
- display: 'block',
75
- overflow: 'hidden',
76
- }, dangerouslySetInnerHTML: { __html: svgMarkup } }));
90
+ }, [url, p.bg, tint]);
91
+ return (_jsx(Box, { "aria-label": label, width: "100%", height: "100%", display: "block", overflow: "hidden", dangerouslySetInnerHTML: { __html: svgMarkup } }));
92
+ }
93
+ function SvgSpitfireInline() {
94
+ return _jsx(TintedSvgInline, { url: SpitfireAssetUrl, label: "Spitfire aircraft" });
77
95
  }
78
96
  function SvgBlackSnakeInline() {
79
- const p = useColorPalette();
80
- const tint = p.isLight ? p.primary : p.spark;
81
- const [svgMarkup, setSvgMarkup] = useState('');
82
- useEffect(() => {
83
- let cancelled = false;
84
- const loadAndTint = async () => {
85
- const response = await fetch(BlackSnakeAssetUrl);
86
- const source = await response.text();
87
- if (cancelled) {
88
- return;
89
- }
90
- const parser = new DOMParser();
91
- const doc = parser.parseFromString(source, 'image/svg+xml');
92
- const svg = doc.querySelector('svg');
93
- if (!svg) {
94
- setSvgMarkup(source);
95
- return;
96
- }
97
- svg.setAttribute('width', '100%');
98
- svg.setAttribute('height', '100%');
99
- svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');
100
- svg.setAttribute('style', `width:100%;height:100%;display:block;background:${p.bg};color:${tint};`);
101
- const blackFills = new Set(['#000', '#000000', 'black', 'rgb(0,0,0)']);
102
- doc.querySelectorAll('[fill]').forEach((node) => {
103
- const fill = (node.getAttribute('fill') || '').replace(/\s+/g, '').toLowerCase();
104
- if (blackFills.has(fill)) {
105
- node.setAttribute('fill', tint);
106
- }
107
- });
108
- doc.querySelectorAll('[stroke]').forEach((node) => {
109
- const stroke = (node.getAttribute('stroke') || '').replace(/\s+/g, '').toLowerCase();
110
- if (blackFills.has(stroke)) {
111
- node.setAttribute('stroke', tint);
112
- }
113
- });
114
- const serialized = new XMLSerializer().serializeToString(svg);
115
- setSvgMarkup(serialized);
116
- };
117
- loadAndTint().catch(() => setSvgMarkup(''));
118
- return () => {
119
- cancelled = true;
120
- };
121
- }, [p.bg, tint]);
122
- return (_jsx(Box, { "aria-label": "Black snake", sx: {
123
- width: '100%',
124
- height: '100%',
125
- display: 'block',
126
- overflow: 'hidden',
127
- }, dangerouslySetInnerHTML: { __html: svgMarkup } }));
97
+ return _jsx(TintedSvgInline, { url: BlackSnakeAssetUrl, label: "Black snake" });
98
+ }
99
+ function SvgKingKongInline() {
100
+ return _jsx(TintedSvgInline, { url: KingKongAssetUrl, label: "King Kong facing a tyrannosaur" });
101
+ }
102
+ function SvgKingKong2Inline() {
103
+ return _jsx(TintedSvgInline, { url: KingKong2AssetUrl, label: "A tyrannosaur facing King Kong" });
128
104
  }
129
105
  function SvgLinesLogo(props) {
130
106
  const { colorMode, theme } = useThemeStore();
@@ -133,29 +109,11 @@ function SvgLinesLogo(props) {
133
109
  : colorMode;
134
110
  const logoColors = getLogoColors(theme, effectiveColorMode);
135
111
  const hostStyle = props?.style;
136
- return (_jsx(Box, { "aria-label": "Lines logo", sx: {
137
- width: '100%',
138
- height: '100%',
139
- minHeight: 120,
140
- px: 2,
141
- display: 'flex',
142
- alignItems: 'center',
143
- justifyContent: 'center',
144
- overflow: 'hidden',
145
- }, style: hostStyle, children: _jsx(BaseSvgLinesLogo, { height: 42, colored: true, primaryColor: logoColors.primary, secondaryColor: logoColors.secondary, textColor: logoColors.textColor }) }));
112
+ return (_jsx(Box, { "aria-label": "Lines logo", ...LOGO_HOST, style: hostStyle, children: _jsx(BaseSvgLinesLogo, { height: 42, colored: true, primaryColor: logoColors.primary, secondaryColor: logoColors.secondary, textColor: logoColors.textColor }) }));
146
113
  }
147
114
  function SvgLinesColored(props) {
148
115
  const hostStyle = props?.style;
149
- return (_jsx(Box, { "aria-label": "Colored lines", sx: {
150
- width: '100%',
151
- height: '100%',
152
- minHeight: 120,
153
- px: 2,
154
- display: 'flex',
155
- alignItems: 'center',
156
- justifyContent: 'center',
157
- overflow: 'hidden',
158
- }, style: hostStyle, children: _jsx(SvgAssets.SvgLines, { colored: true, width: "100%", height: 44 }) }));
116
+ return (_jsx(Box, { "aria-label": "Colored lines", ...LOGO_HOST, style: hostStyle, children: _jsx(SvgAssets.SvgLines, { colored: true, width: "100%", height: 44 }) }));
159
117
  }
160
118
  function SvgDatalayerLogo(props) {
161
119
  const { colorMode, theme } = useThemeStore();
@@ -164,16 +122,7 @@ function SvgDatalayerLogo(props) {
164
122
  : colorMode;
165
123
  const logoColors = getLogoColors(theme, effectiveColorMode);
166
124
  const hostStyle = props?.style;
167
- return (_jsx(Box, { "aria-label": "Datalayer logo", sx: {
168
- width: '100%',
169
- height: '100%',
170
- minHeight: 120,
171
- px: 2,
172
- display: 'flex',
173
- alignItems: 'center',
174
- justifyContent: 'center',
175
- overflow: 'hidden',
176
- }, style: hostStyle, children: _jsx(DatalayerLogo, { size: 64, variant: theme, colorMode: effectiveColorMode, primaryColor: logoColors.primary, secondaryColor: logoColors.secondary, primaryGradient: logoColors.primaryGradient, secondaryGradient: logoColors.secondaryGradient }) }));
125
+ return (_jsx(Box, { "aria-label": "Datalayer logo", ...LOGO_HOST, style: hostStyle, children: _jsx(DatalayerLogo, { size: 64, variant: theme, colorMode: effectiveColorMode, primaryColor: logoColors.primary, secondaryColor: logoColors.secondary, primaryGradient: logoColors.primaryGradient, secondaryGradient: logoColors.secondaryGradient }) }));
177
126
  }
178
127
  function SvgDatalayerTextLogo(props) {
179
128
  const { colorMode, theme } = useThemeStore();
@@ -182,16 +131,7 @@ function SvgDatalayerTextLogo(props) {
182
131
  : colorMode;
183
132
  const logoColors = getLogoColors(theme, effectiveColorMode);
184
133
  const hostStyle = props?.style;
185
- return (_jsx(Box, { "aria-label": "Datalayer text logo", sx: {
186
- width: '100%',
187
- height: '100%',
188
- minHeight: 120,
189
- px: 2,
190
- display: 'flex',
191
- alignItems: 'center',
192
- justifyContent: 'center',
193
- overflow: 'hidden',
194
- }, style: hostStyle, children: _jsx(DatalayerLogoText, { size: 30, variant: theme, colorMode: effectiveColorMode, primaryColor: logoColors.primary, secondaryColor: logoColors.secondary, textColor: logoColors.textColor }) }));
134
+ return (_jsx(Box, { "aria-label": "Datalayer text logo", ...LOGO_HOST, style: hostStyle, children: _jsx(DatalayerLogoText, { size: 30, variant: theme, colorMode: effectiveColorMode, primaryColor: logoColors.primary, secondaryColor: logoColors.secondary, textColor: logoColors.textColor }) }));
195
135
  }
196
136
  function SvgDatalayerTextLogoFirst(props) {
197
137
  const { colorMode, theme } = useThemeStore();
@@ -200,16 +140,7 @@ function SvgDatalayerTextLogoFirst(props) {
200
140
  : colorMode;
201
141
  const logoColors = getLogoColors(theme, effectiveColorMode);
202
142
  const hostStyle = props?.style;
203
- return (_jsx(Box, { "aria-label": "Datalayer text logo first", sx: {
204
- width: '100%',
205
- height: '100%',
206
- minHeight: 120,
207
- px: 2,
208
- display: 'flex',
209
- alignItems: 'center',
210
- justifyContent: 'center',
211
- overflow: 'hidden',
212
- }, style: hostStyle, children: _jsx(DatalayerLogoText, { size: 30, inverse: true, variant: theme, colorMode: effectiveColorMode, primaryColor: logoColors.primary, secondaryColor: logoColors.secondary, textColor: logoColors.textColor }) }));
143
+ return (_jsx(Box, { "aria-label": "Datalayer text logo first", ...LOGO_HOST, style: hostStyle, children: _jsx(DatalayerLogoText, { size: 30, inverse: true, variant: theme, colorMode: effectiveColorMode, primaryColor: logoColors.primary, secondaryColor: logoColors.secondary, textColor: logoColors.textColor }) }));
213
144
  }
214
145
  function SvgDI(props) {
215
146
  const { colorMode, theme } = useThemeStore();
@@ -217,16 +148,7 @@ function SvgDI(props) {
217
148
  ? (typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
218
149
  : colorMode;
219
150
  const hostStyle = props?.style;
220
- return (_jsx(Box, { "aria-label": "DI mark", sx: {
221
- width: '100%',
222
- height: '100%',
223
- minHeight: 120,
224
- px: 2,
225
- display: 'flex',
226
- alignItems: 'center',
227
- justifyContent: 'center',
228
- overflow: 'hidden',
229
- }, style: hostStyle, children: _jsx(DI, { size: 96, variant: theme, colorMode: effectiveColorMode }) }));
151
+ return (_jsx(Box, { "aria-label": "DI mark", ...LOGO_HOST, style: hostStyle, children: _jsx(DI, { size: 96, variant: theme, colorMode: effectiveColorMode }) }));
230
152
  }
231
153
  function SvgDla(props) {
232
154
  const { colorMode, theme } = useThemeStore();
@@ -234,16 +156,7 @@ function SvgDla(props) {
234
156
  ? (typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
235
157
  : colorMode;
236
158
  const hostStyle = props?.style;
237
- return (_jsx(Box, { "aria-label": "Datalayer mark", sx: {
238
- width: '100%',
239
- height: '100%',
240
- minHeight: 120,
241
- px: 2,
242
- display: 'flex',
243
- alignItems: 'center',
244
- justifyContent: 'center',
245
- overflow: 'hidden',
246
- }, style: hostStyle, children: _jsx(DlaMark, { size: 96, variant: theme, colorMode: effectiveColorMode }) }));
159
+ return (_jsx(Box, { "aria-label": "Datalayer mark", ...LOGO_HOST, style: hostStyle, children: _jsx(DlaMark, { size: 96, variant: theme, colorMode: effectiveColorMode }) }));
247
160
  }
248
161
  function SvgDatalayerTextAI(props) {
249
162
  const { colorMode, theme } = useThemeStore();
@@ -251,16 +164,7 @@ function SvgDatalayerTextAI(props) {
251
164
  ? (typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
252
165
  : colorMode;
253
166
  const hostStyle = props?.style;
254
- return (_jsx(Box, { "aria-label": "Datalayer text AI", sx: {
255
- width: '100%',
256
- height: '100%',
257
- minHeight: 120,
258
- px: 2,
259
- display: 'flex',
260
- alignItems: 'center',
261
- justifyContent: 'center',
262
- overflow: 'hidden',
263
- }, style: hostStyle, children: _jsx(DatalayerTextAI, { aiGap: 1, variant: theme, colorMode: effectiveColorMode }) }));
167
+ return (_jsx(Box, { "aria-label": "Datalayer text AI", ...LOGO_HOST, style: hostStyle, children: _jsx(DatalayerTextAI, { aiGap: 1, variant: theme, colorMode: effectiveColorMode }) }));
264
168
  }
265
169
  function SvgAIMarkPreview({ ariaLabel, Component, props, }) {
266
170
  const { colorMode, theme } = useThemeStore();
@@ -268,16 +172,7 @@ function SvgAIMarkPreview({ ariaLabel, Component, props, }) {
268
172
  ? (typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
269
173
  : colorMode;
270
174
  const hostStyle = props?.style;
271
- return (_jsx(Box, { "aria-label": ariaLabel, sx: {
272
- width: '100%',
273
- height: '100%',
274
- minHeight: 120,
275
- px: 2,
276
- display: 'flex',
277
- alignItems: 'center',
278
- justifyContent: 'center',
279
- overflow: 'hidden',
280
- }, style: hostStyle, children: _jsx(Component, { size: 96, variant: theme, colorMode: effectiveColorMode }) }));
175
+ return (_jsx(Box, { "aria-label": ariaLabel, ...LOGO_HOST, style: hostStyle, children: _jsx(Component, { size: 96, variant: theme, colorMode: effectiveColorMode }) }));
281
176
  }
282
177
  function SvgAIPreview(props) {
283
178
  return _jsx(SvgAIMarkPreview, { ariaLabel: "AI mark", Component: SvgAssets.SvgAI, props: props });
@@ -288,22 +183,30 @@ function SvgAI2Preview(props) {
288
183
  function SvgAI3Preview(props) {
289
184
  return _jsx(SvgAIMarkPreview, { ariaLabel: "AI3 mark", Component: SvgAssets.SvgAI3, props: props });
290
185
  }
291
- /* The avatar in the gallery: one card for each way it is drawn. */
292
- function AvatarOrbCard({ state, tone, title }) {
293
- return (_jsx(Box, { sx: { width: '100%', minHeight: 160, display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx(SvgAvatarOrb, { size: 120, state: state, tone: tone, title: title }) }));
186
+ /*
187
+ * The avatar in the gallery: one card for each tone, and under it a button
188
+ * for each state the floating assistant acts out, to see each one. Pressing
189
+ * the state shown again plays it again (greeting and goodbye play once).
190
+ */
191
+ function AvatarOrbCard({ tone, title }) {
192
+ const [state, setState] = useState('idle');
193
+ const [replay, setReplay] = useState(0);
194
+ return (_jsxs(Box, { width: "100%", display: "flex", flexDirection: "column", alignItems: "center", gap: 2, py: 2, children: [_jsx(Box, { minHeight: 150, display: "flex", alignItems: "center", justifyContent: "center", children: _jsx(SvgAvatarOrb, { size: 120, state: state, tone: tone, title: `${title}, ${state}` }, replay) }), _jsx(Box, { role: "group", "aria-label": "Avatar state", onClick: (event) => event.stopPropagation(), display: "flex", flexWrap: "wrap", gap: 1, justifyContent: "center", children: AVATAR_ORB_STATES.map(one => (_jsx(Button, { size: "small", variant: one === state ? 'primary' : 'default', "aria-pressed": one === state, onClick: () => {
195
+ setState(one);
196
+ setReplay(count => count + 1);
197
+ }, children: one }, one))) })] }));
294
198
  }
295
199
  function SvgAvatarOrbPreview() {
296
- return _jsx(AvatarOrbCard, { state: "idle", tone: "iridescent", title: "Avatar, idle" });
297
- }
298
- function SvgAvatarOrbThinkingPreview() {
299
- return _jsx(AvatarOrbCard, { state: "thinking", tone: "iridescent", title: "Avatar, thinking" });
200
+ return _jsx(AvatarOrbCard, { tone: "iridescent", title: "Avatar" });
300
201
  }
301
202
  function SvgAvatarOrbThemePreview() {
302
- return _jsx(AvatarOrbCard, { state: "idle", tone: "theme", title: "Avatar, in the theme's colours" });
203
+ return _jsx(AvatarOrbCard, { tone: "theme", title: "Avatar, in the theme's colours" });
303
204
  }
304
205
  const SVG_COMPONENT_OVERRIDES = {
305
206
  SvgSpitfire: SvgSpitfireInline,
306
207
  SvgBlackSnake: SvgBlackSnakeInline,
208
+ SvgKingKong: SvgKingKongInline,
209
+ SvgKingKong2: SvgKingKong2Inline,
307
210
  SvgAI: SvgAIPreview,
308
211
  SvgAI2: SvgAI2Preview,
309
212
  SvgAI3: SvgAI3Preview,
@@ -371,16 +274,12 @@ const DATALAYER_SVGS = [
371
274
  name: 'SvgAvatarOrb',
372
275
  Component: SvgAvatarOrbPreview,
373
276
  },
374
- {
375
- name: 'SvgAvatarOrbThinking',
376
- Component: SvgAvatarOrbThinkingPreview,
377
- },
378
277
  {
379
278
  name: 'SvgAvatarOrbTheme',
380
279
  Component: SvgAvatarOrbThemePreview,
381
280
  },
382
281
  ];
383
- const RELEASE_SVG_NAMES = new Set(['SvgSpitfire', 'SvgBlackSnake']);
282
+ const RELEASE_SVG_NAMES = new Set(['SvgSpitfire', 'SvgBlackSnake', 'SvgKingKong', 'SvgKingKong2']);
384
283
  const SYSTEM_SVG_NAMES = new Set(['SvgNotFound', 'SvgUnauthorized']);
385
284
  const LOGO_SVG_NAMES = new Set([
386
285
  'SvgAI',
@@ -396,7 +295,7 @@ const LOGO_SVG_NAMES = new Set([
396
295
  'SvgLinesColored',
397
296
  'SvgLinesLogo',
398
297
  ]);
399
- const COMMUNICATION_SVG_NAMES = new Set(['SvgDiscord', 'SvgFastA2ADonation', 'SvgJupyterMcp', 'SvgJupyterMcp2', 'SvgOSAContributions', 'SvgOg', 'SvgRadar']);
298
+ const COMMUNICATION_SVG_NAMES = new Set(['SvgDiscord', 'SvgFastA2ADonation', 'SvgJupyterMcp', 'SvgJupyterMcp2', 'SvgOSAContributions', 'SvgOg', 'SvgOgStacked', 'SvgPoppy1_0', 'SvgRadar']);
400
299
  const CASES_SVG_NAMES = new Set(['SvgEarthHero', 'SvgUsecasesHero', 'SvgLightHouse']);
401
300
  const ARTIFACTS_SVG_NAMES = new Set([
402
301
  'SvgNotebookArtifact',
@@ -411,7 +310,7 @@ const ARTIFACTS_SVG_NAMES = new Set([
411
310
  ]);
412
311
  const PIXELS_SVG_NAMES = new Set(['SvgPixel1', 'SvgPixel2']);
413
312
  /* An agent's avatar, drawn in the theme's colours (src/avatar). */
414
- const AVATAR_SVG_NAMES = new Set(['SvgAvatarOrb', 'SvgAvatarOrbThinking', 'SvgAvatarOrbTheme']);
313
+ const AVATAR_SVG_NAMES = new Set(['SvgAvatarOrb', 'SvgAvatarOrbTheme']);
415
314
  const PICTOS_SVG_NAMES = new Set(['SvgSkubble']);
416
315
  /*
417
316
  * The marks of the companies Datalayer works WITH, which are not
@@ -503,16 +402,10 @@ function svgInSegment(entry, segment) {
503
402
  }
504
403
  function SegmentControl({ value, onChange, counts, }) {
505
404
  const segments = SEGMENTS;
506
- return (_jsx(Box, { role: "tablist", "aria-label": "SVG segment filter", sx: {
507
- display: 'inline-flex',
508
- border: '1px solid',
509
- borderColor: 'border.default',
510
- borderRadius: 2,
511
- overflow: 'hidden',
512
- bg: 'canvas.default',
513
- }, children: segments.map((segment, index) => {
405
+ return (_jsx(Box, { role: "tablist", "aria-label": "SVG segment filter", display: "inline-flex", flexWrap: "wrap", maxWidth: "100%", border: "1px solid", borderColor: "border.default", borderRadius: "medium", overflow: "hidden", bg: "canvas.default", children: segments.map((segment, index) => {
514
406
  const active = value === segment;
515
- return (_jsxs(Button, { role: "tab", "aria-selected": active, onClick: () => onChange(segment), sx: {
407
+ return (_jsxs(Button, { role: "tab", size: "small", "aria-selected": active, "aria-label": `${segment}, ${counts[segment]}`, title: segment, onClick: () => onChange(segment), sx: {
408
+ paddingInline: '6px',
516
409
  border: 'none',
517
410
  borderRadius: 0,
518
411
  borderLeft: index === 0 ? 'none' : '1px solid',
@@ -523,7 +416,7 @@ function SegmentControl({ value, onChange, counts, }) {
523
416
  ':hover': {
524
417
  bg: active ? 'accent.subtle' : 'canvas.subtle',
525
418
  },
526
- }, children: [segment, " (", counts[segment], ")"] }, segment));
419
+ }, children: [SEGMENT_SHORT_LABELS[segment] ?? segment, " ", _jsx("span", { style: { opacity: 0.7 }, children: counts[segment] })] }, segment));
527
420
  }) }));
528
421
  }
529
422
  function getSvgExportDimensions(svg) {
@@ -837,35 +730,12 @@ function SvgCard({ name, Component }) {
837
730
  const navigate = useNavigate();
838
731
  const ref = useRef(null);
839
732
  const openDetail = () => navigate(`/svg/${name}`);
840
- return (_jsxs(Box, { sx: { border: '1px solid', borderColor: 'border.default', borderRadius: 2, p: 3, bg: 'canvas.default' }, children: [_jsx(Text, { sx: { fontWeight: 600, display: 'block', mb: 2 }, children: name }), _jsx(Box, { ref: ref, role: "button", tabIndex: 0, "aria-label": `Open ${name}`, onClick: openDetail, onKeyDown: (event) => {
733
+ return (_jsxs(Card, { border: true, p: 3, children: [_jsx(Text, { sx: { fontWeight: 600, display: 'block', mb: 2 }, children: name }), _jsx(Card, { ref: ref, role: "button", tabIndex: 0, "aria-label": `Open ${name}`, onClick: openDetail, onKeyDown: (event) => {
841
734
  if (event.key === 'Enter' || event.key === ' ') {
842
735
  event.preventDefault();
843
736
  openDetail();
844
737
  }
845
- }, sx: {
846
- p: 2,
847
- border: '1px dashed',
848
- borderColor: 'border.default',
849
- bg: 'canvas.subtle',
850
- borderRadius: 2,
851
- minHeight: 160,
852
- display: 'flex',
853
- alignItems: 'center',
854
- justifyContent: 'center',
855
- mb: 2,
856
- overflow: 'hidden',
857
- position: 'relative',
858
- isolation: 'isolate',
859
- cursor: 'pointer',
860
- ':hover': {
861
- borderColor: 'accent.fg',
862
- },
863
- ':focus-visible': {
864
- outline: '2px solid',
865
- outlineColor: 'accent.fg',
866
- outlineOffset: '2px',
867
- },
868
- }, children: _jsx(Component, { style: { width: '100%', height: '100%' } }) }), _jsxs(Box, { sx: { display: 'flex', gap: 2, flexWrap: 'wrap' }, children: [_jsx(Button, { onClick: openDetail, children: "View" }), _jsx(RasterDownloadMenu, { label: "Download PNG", format: "png", fileName: name, containerRef: ref }), _jsx(RasterDownloadMenu, { label: "Download JPG", format: "jpg", fileName: name, containerRef: ref }), _jsx(GifDownloadMenu, { fileName: name, containerRef: ref }), _jsx(Button, { onClick: async () => {
738
+ }, variant: "subtle", dashed: true, interactive: true, shadow: "none", rounded: "small", p: 2, minHeight: 160, flexDirection: "row", alignItems: "center", justifyContent: "center", mb: 2, overflow: "hidden", position: "relative", isolation: "isolate", children: _jsx(Component, { style: { width: '100%', height: '100%' } }) }), _jsxs(Box, { display: "flex", gap: 2, flexWrap: "wrap", children: [_jsx(Button, { onClick: openDetail, children: "View" }), _jsx(RasterDownloadMenu, { label: "Download PNG", format: "png", fileName: name, containerRef: ref }), _jsx(RasterDownloadMenu, { label: "Download JPG", format: "jpg", fileName: name, containerRef: ref }), _jsx(GifDownloadMenu, { fileName: name, containerRef: ref }), _jsx(Button, { onClick: async () => {
869
739
  const svg = ref.current?.querySelector('svg');
870
740
  if (!svg)
871
741
  return;
@@ -879,15 +749,15 @@ function SvgDetailPage() {
879
749
  const entry = useMemo(() => DATALAYER_SVGS.find((item) => item.name === resolvedName), [resolvedName]);
880
750
  const ref = useRef(null);
881
751
  if (!entry) {
882
- return (_jsx(Box, { sx: { px: 4, py: 5 }, children: _jsx(Box, { sx: { maxWidth: 1200, mx: 'auto' }, children: _jsx(Text, { children: "SVG not found." }) }) }));
752
+ return (_jsx(Box, { px: 4, py: 5, children: _jsx(Box, { maxWidth: 1200, mx: "auto", children: _jsx(Text, { children: "SVG not found." }) }) }));
883
753
  }
884
754
  const Component = entry.Component;
885
- return (_jsx(Box, { sx: { px: 4, py: 5 }, children: _jsxs(Box, { sx: { maxWidth: 1200, mx: 'auto' }, children: [_jsxs(Box, { sx: { display: 'flex', gap: 2, flexWrap: 'wrap' }, children: [_jsx(Button, { variant: "invisible", leadingVisual: ArrowLeftIcon, onClick: () => navigate('/svg'), children: "Back" }), _jsx(RasterDownloadMenu, { label: "Download PNG", format: "png", fileName: entry.name, containerRef: ref }), _jsx(RasterDownloadMenu, { label: "Download JPG", format: "jpg", fileName: entry.name, containerRef: ref }), _jsx(GifDownloadMenu, { fileName: entry.name, containerRef: ref }), _jsx(Button, { onClick: async () => {
755
+ return (_jsx(Box, { px: 4, py: 5, children: _jsxs(Box, { maxWidth: 1200, mx: "auto", children: [_jsxs(Box, { display: "flex", gap: 2, flexWrap: "wrap", children: [_jsx(Button, { variant: "invisible", leadingVisual: ArrowLeftIcon, onClick: () => navigate('/svg'), children: "Back" }), _jsx(RasterDownloadMenu, { label: "Download PNG", format: "png", fileName: entry.name, containerRef: ref }), _jsx(RasterDownloadMenu, { label: "Download JPG", format: "jpg", fileName: entry.name, containerRef: ref }), _jsx(GifDownloadMenu, { fileName: entry.name, containerRef: ref }), _jsx(Button, { onClick: async () => {
886
756
  const svg = ref.current?.querySelector('svg');
887
757
  if (!svg)
888
758
  return;
889
759
  await downloadSvgElement(svg, entry.name, 'svg');
890
- }, children: "Download SVG" })] }), _jsx(Heading, { as: "h2", sx: { mt: 3, mb: 3 }, children: entry.name }), _jsx(Box, { ref: ref, sx: { p: 4, border: '1px solid', borderColor: 'border.default', borderRadius: 2, display: 'flex', justifyContent: 'center', minHeight: 280, overflow: 'hidden', position: 'relative', isolation: 'isolate' }, children: _jsx(Component, { style: { width: '100%', maxWidth: 900 } }) })] }) }));
760
+ }, children: "Download SVG" })] }), _jsx(Heading, { as: "h2", sx: { mt: 3, mb: 3 }, children: entry.name }), _jsx(Card, { ref: ref, border: true, rounded: "small", p: 4, flexDirection: "row", justifyContent: "center", minHeight: 280, overflow: "hidden", position: "relative", isolation: "isolate", children: _jsx(Component, { style: { width: '100%', maxWidth: 900 } }) })] }) }));
891
761
  }
892
762
  export function SvgPage() {
893
763
  const navigate = useNavigate();
@@ -940,6 +810,6 @@ export function SvgPage() {
940
810
  if (isDetailRoute) {
941
811
  return _jsx(SvgDetailPage, {});
942
812
  }
943
- return (_jsx(Box, { sx: { px: 4, py: 5 }, children: _jsxs(Box, { sx: { maxWidth: 1200, mx: 'auto' }, children: [_jsxs(Box, { sx: { border: '1px solid', borderColor: 'border.default', borderRadius: 2, bg: 'canvas.subtle', p: [3, 4], mb: 4 }, children: [_jsx(Heading, { as: "h2", sx: { fontSize: 4, mb: 2 }, children: "SVG Gallery" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Gallery generated from local design SVG exports." }), _jsx(Box, { sx: { mt: 3, maxWidth: 420 }, children: _jsx(TextInput, { block: true, value: filter, onChange: (event) => setFilter(event.target.value), placeholder: "Filter SVGs by name...", "aria-label": "Filter SVGs by name" }) }), _jsx(Box, { sx: { mt: 3, display: 'flex', alignItems: 'center', gap: 2, flexWrap: 'wrap' }, children: _jsx(SegmentControl, { value: segment, onChange: setSegment, counts: segmentCounts }) })] }), _jsxs(Box, { sx: { display: 'grid', gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'], gap: 3 }, children: [filteredSvgs.length === 0 && (_jsx(Box, { sx: { gridColumn: '1 / -1', p: 4, border: '1px solid', borderColor: 'border.default', borderRadius: 2, bg: 'canvas.subtle' }, children: _jsx(Text, { sx: { color: 'fg.muted' }, children: "No SVG matches this filter in the current segment." }) })), filteredSvgs.map((entry) => (_jsx(SvgCard, { ...entry }, entry.name)))] })] }) }));
813
+ return (_jsx(Box, { px: 4, py: 5, children: _jsxs(Box, { maxWidth: 1200, mx: "auto", children: [_jsxs(Card, { variant: "subtle", border: true, shadow: "none", p: [3, 4], mb: 4, children: [_jsx(Heading, { as: "h2", sx: { fontSize: 4, mb: 2 }, children: "SVG Gallery" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Gallery generated from local design SVG exports." }), _jsx(Box, { mt: 3, maxWidth: 420, children: _jsx(TextInput, { block: true, value: filter, onChange: (event) => setFilter(event.target.value), placeholder: "Filter SVGs by name...", "aria-label": "Filter SVGs by name" }) }), _jsx(Box, { mt: 3, display: "flex", alignItems: "center", gap: 2, flexWrap: "wrap", children: _jsx(SegmentControl, { value: segment, onChange: setSegment, counts: segmentCounts }) })] }), _jsxs(Box, { display: "grid", gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'], gap: 3, children: [filteredSvgs.length === 0 && (_jsx(Card, { variant: "subtle", border: true, shadow: "none", gridColumn: "1 / -1", p: 4, children: _jsx(Text, { sx: { color: 'fg.muted' }, children: "No SVG matches this filter in the current segment." }) })), filteredSvgs.map((entry) => (_jsx(SvgCard, { ...entry }, entry.name)))] })] }) }));
944
814
  }
945
815
  export default SvgPage;
@@ -0,0 +1,5 @@
1
+ import { type ColorPalette } from '@datalayer/primer-addons';
2
+ export declare function SvgHorizonHero({ palette: paletteProp }?: {
3
+ palette?: ColorPalette;
4
+ }): import("react").JSX.Element;
5
+ export default SvgHorizonHero;