@datalayer/primer-addons 1.0.51 → 1.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/lib/components/appearance/AppearanceControls.d.ts +9 -2
  2. package/lib/components/appearance/AppearanceControls.js +4 -3
  3. package/lib/components/appearance/AppearanceMenu.d.ts +12 -4
  4. package/lib/components/appearance/AppearanceMenu.js +6 -3
  5. package/lib/components/appearance/AppearanceMenu.stories.d.ts +6 -0
  6. package/lib/components/appearance/AppearanceMenu.stories.js +15 -2
  7. package/lib/components/appearance/ColorModeCircle.d.ts +6 -1
  8. package/lib/components/appearance/ColorModeCircle.js +2 -2
  9. package/lib/components/appearance/ThemePalettePreview.d.ts +1 -1
  10. package/lib/components/card/Card.d.ts +9 -2
  11. package/lib/components/card/Card.js +4 -2
  12. package/lib/components/sliding-panel/SlidingPanel.d.ts +26 -1
  13. package/lib/components/sliding-panel/SlidingPanel.js +21 -10
  14. package/lib/components/sliding-panel/SlidingPanel.stories.d.ts +2 -1
  15. package/lib/components/sliding-panel/SlidingPanel.stories.js +31 -0
  16. package/lib/reactor/AppearancePlugin.d.ts +5 -0
  17. package/lib/reactor/AppearancePlugin.js +2 -0
  18. package/lib/theme/colorMode.d.ts +6 -0
  19. package/lib/theme/{themes-brand/index.js → colorMode.js} +1 -1
  20. package/lib/theme/index.d.ts +2 -2
  21. package/lib/theme/index.js +2 -2
  22. package/lib/theme/portableTheme.d.ts +1 -1
  23. package/lib/theme/themeTokens.d.ts +1 -1
  24. package/lib/theme/themes/ivoryThemeStyles.d.ts +4 -1
  25. package/lib/theme/themes/ivoryThemeStyles.js +7 -1
  26. package/lib/theme/themes/loopThemeStyles.js +4 -14
  27. package/lib/theme/themes/metalThemeStyles.js +2 -6
  28. package/lib/theme/themes/roundedShape.d.ts +18 -0
  29. package/lib/theme/themes/roundedShape.js +24 -0
  30. package/lib/theme/themes/sandThemeStyles.d.ts +4 -1
  31. package/lib/theme/themes/sandThemeStyles.js +7 -1
  32. package/lib/theme/themes/sunThemeStyles.d.ts +4 -1
  33. package/lib/theme/themes/sunThemeStyles.js +7 -1
  34. package/lib/theme/useThemeStore.d.ts +1 -1
  35. package/lib/utils/Helper.d.ts +1 -16
  36. package/lib/utils/Helper.js +4 -20
  37. package/package.json +1 -2
  38. package/lib/theme/DatalayerBrandThemeProvider.d.ts +0 -41
  39. package/lib/theme/DatalayerBrandThemeProvider.js +0 -32
  40. package/lib/theme/themes-brand/index.d.ts +0 -1
  41. package/lib/theme/themes-brand/spatialBrandTheme.d.ts +0 -16
  42. package/lib/theme/themes-brand/spatialBrandTheme.js +0 -157
@@ -30,13 +30,20 @@ export interface AppearanceControlsProps {
30
30
  themeVariant?: ThemeVariant;
31
31
  /** Called on a new colour mode; required without the store, called after it with the store. */
32
32
  onColorModeChange?: (mode: ColorMode) => void;
33
- /** Called on a new theme; required without the store, called after it with the store. */
33
+ /**
34
+ * Called on a new theme; required without the store when the theme chooser
35
+ * shows, called after it with the store.
36
+ */
34
37
  onThemeChange?: (theme: ThemeVariant) => void;
35
38
  /** `stacked` by default; see {@link AppearanceControlsLayout}. */
36
39
  layout?: AppearanceControlsLayout;
37
40
  /** Show the light / dark / auto switch. Default: shown. */
38
41
  showColorMode?: boolean;
39
- /** Show the theme chooser. Default: shown. */
42
+ /**
43
+ * Show the theme chooser (the swatches, and with `showThemePreviews` the
44
+ * chosen theme's preview). Default: shown; `false` for a site that wears
45
+ * one theme, where the controls are the light / dark / auto switch alone.
46
+ */
40
47
  showThemeChooser?: boolean;
41
48
  /** Stacked, with the chooser: the chosen theme's name, description and preview under its swatches. Default: swatches only. */
42
49
  showThemePreviews?: boolean;
@@ -35,13 +35,14 @@ export function AppearanceControls({ withStore = true, useStore = useThemeStore,
35
35
  if (givenColorMode === undefined ||
36
36
  givenThemeVariant === undefined ||
37
37
  !givenOnColorModeChange ||
38
- !givenOnThemeChange) {
39
- throw new Error("AppearanceControls without the store needs colorMode, themeVariant, onColorModeChange and onThemeChange.");
38
+ (showThemeChooser && !givenOnThemeChange)) {
39
+ throw new Error("AppearanceControls without the store needs colorMode, themeVariant, onColorModeChange, and onThemeChange when the theme chooser shows.");
40
40
  }
41
41
  colorMode = givenColorMode;
42
42
  themeVariant = givenThemeVariant;
43
43
  onColorModeChange = givenOnColorModeChange;
44
- onThemeChange = givenOnThemeChange;
44
+ // Never called without the chooser: nothing in the controls picks a theme then.
45
+ onThemeChange = givenOnThemeChange ?? (() => undefined);
45
46
  }
46
47
  // At most `themesPerLine` swatches on a line when given, each line centred,
47
48
  // so a shorter last line sits in the middle under the full ones; one line
@@ -8,14 +8,21 @@ export interface AppearanceMenuProps {
8
8
  themeVariant: ThemeVariant;
9
9
  /** Called with the next color mode. */
10
10
  onColorModeChange: (mode: ColorMode) => void;
11
- /** Called with the next theme variant. */
12
- onThemeChange: (theme: ThemeVariant) => void;
11
+ /** Called with the next theme variant; required when the theme chooser shows. */
12
+ onThemeChange?: (theme: ThemeVariant) => void;
13
13
  /** Diameter of the trigger circle in pixels. */
14
14
  size?: number;
15
15
  /** Visual shape of the trigger control. */
16
16
  shape?: 'square' | 'circle';
17
17
  /** Overlay placement relative to the circle. */
18
18
  hoverOverlayPlacement?: HoverOverlayPlacement;
19
+ /**
20
+ * Whether the overlay offers the themes (their swatches, and with
21
+ * `showThemePreviews` the chosen one's preview). Default: shown; `false`
22
+ * for a site that wears one theme — the overlay is the light / dark / auto
23
+ * switch alone.
24
+ */
25
+ showThemeChooser?: boolean;
19
26
  /** Whether the overlay shows the live theme previews. */
20
27
  showThemePreviews?: boolean;
21
28
  /** The most theme swatches on one line in the overlay; undefined, they wrap freely. */
@@ -23,11 +30,12 @@ export interface AppearanceMenuProps {
23
30
  }
24
31
  /**
25
32
  * A single color-mode circle that reveals, on hover, an appearance overlay
26
- * with color-mode controls, theme circles and live theme previews.
33
+ * with color-mode controls, theme circles and live theme previews — or the
34
+ * color-mode controls alone, with `showThemeChooser={false}`.
27
35
  *
28
36
  * This bundles the {@link ColorModeCircle} trigger together with the
29
37
  * {@link AppearanceControls} overlay so the whole appearance menu can be
30
38
  * dropped into any header with a single component.
31
39
  */
32
- export declare function AppearanceMenu({ colorMode, themeVariant, onColorModeChange, onThemeChange, size, shape, hoverOverlayPlacement, showThemePreviews, themesPerLine, }: AppearanceMenuProps): ReactElement;
40
+ export declare function AppearanceMenu({ colorMode, themeVariant, onColorModeChange, onThemeChange, size, shape, hoverOverlayPlacement, showThemeChooser, showThemePreviews, themesPerLine, }: AppearanceMenuProps): ReactElement;
33
41
  export default AppearanceMenu;
@@ -3,13 +3,16 @@ import { ColorModeCircle } from './ColorModeCircle';
3
3
  import { AppearanceControls } from './AppearanceControls';
4
4
  /**
5
5
  * A single color-mode circle that reveals, on hover, an appearance overlay
6
- * with color-mode controls, theme circles and live theme previews.
6
+ * with color-mode controls, theme circles and live theme previews — or the
7
+ * color-mode controls alone, with `showThemeChooser={false}`.
7
8
  *
8
9
  * This bundles the {@link ColorModeCircle} trigger together with the
9
10
  * {@link AppearanceControls} overlay so the whole appearance menu can be
10
11
  * dropped into any header with a single component.
11
12
  */
12
- export function AppearanceMenu({ colorMode, themeVariant, onColorModeChange, onThemeChange, size = 26, shape = 'square', hoverOverlayPlacement = 'bottom-end', showThemePreviews = true, themesPerLine, }) {
13
- return (_jsx(ColorModeCircle, { colorMode: colorMode, onColorModeChange: onColorModeChange, cycleOnClick: false, themeVariant: themeVariant, hoverOverlayPlacement: hoverOverlayPlacement, shape: shape, size: size, hoverOverlay: _jsx(AppearanceControls, { withStore: false, colorMode: colorMode, themeVariant: themeVariant, onColorModeChange: onColorModeChange, onThemeChange: onThemeChange, showThemePreviews: showThemePreviews, themesPerLine: themesPerLine }) }));
13
+ export function AppearanceMenu({ colorMode, themeVariant, onColorModeChange, onThemeChange, size = 26, shape = 'square', hoverOverlayPlacement = 'bottom-end', showThemeChooser = true, showThemePreviews = true, themesPerLine, }) {
14
+ return (_jsx(ColorModeCircle, { colorMode: colorMode, onColorModeChange: onColorModeChange, cycleOnClick: false, themeVariant: themeVariant, hoverOverlayPlacement: hoverOverlayPlacement,
15
+ // The switch alone needs no room for the swatches.
16
+ hoverOverlayMinWidth: showThemeChooser ? 340 : 'auto', shape: shape, size: size, hoverOverlay: _jsx(AppearanceControls, { withStore: false, colorMode: colorMode, themeVariant: themeVariant, onColorModeChange: onColorModeChange, onThemeChange: onThemeChange, showThemeChooser: showThemeChooser, showThemePreviews: showThemePreviews, themesPerLine: themesPerLine }) }));
14
17
  }
15
18
  export default AppearanceMenu;
@@ -40,6 +40,7 @@ declare const meta: {
40
40
  size: number;
41
41
  shape: "square";
42
42
  hoverOverlayPlacement: "bottom-start";
43
+ showThemeChooser: true;
43
44
  showThemePreviews: true;
44
45
  };
45
46
  };
@@ -49,6 +50,11 @@ type Story = StoryObj<typeof meta>;
49
50
  export declare const Default: Story;
50
51
  /** A round trigger, larger, without the theme previews in its overlay. */
51
52
  export declare const CircleWithoutPreviews: Story;
53
+ /**
54
+ * The colour mode alone: light, dark and auto, no theme swatches — the menu
55
+ * of a site that wears one theme (the Datalayer landing, on loop).
56
+ */
57
+ export declare const ColorModeOnly: Story;
52
58
  /**
53
59
  * `AppearanceMenuWithStore`: the menu wired to a theme store, as the
54
60
  * appearance plugin puts it in a header.
@@ -42,6 +42,7 @@ const meta = {
42
42
  size: 26,
43
43
  shape: "square",
44
44
  hoverOverlayPlacement: "bottom-start",
45
+ showThemeChooser: true,
45
46
  showThemePreviews: true,
46
47
  },
47
48
  };
@@ -58,7 +59,7 @@ const ThemedAppearanceMenu = (props) => {
58
59
  props.onColorModeChange(mode);
59
60
  }, onThemeChange: (variant) => {
60
61
  setThemeVariant(variant);
61
- props.onThemeChange(variant);
62
+ props.onThemeChange?.(variant);
62
63
  } }), _jsx(Text, { sx: { color: "fg.muted", fontSize: 1 }, children: "Hover the control: colour mode, theme, the theme's description and a preview." })] }) }) }));
63
64
  };
64
65
  /** The square a header wears. */
@@ -74,10 +75,22 @@ export const CircleWithoutPreviews = {
74
75
  },
75
76
  render: (args) => _jsx(ThemedAppearanceMenu, { ...args }),
76
77
  };
78
+ /**
79
+ * The colour mode alone: light, dark and auto, no theme swatches — the menu
80
+ * of a site that wears one theme (the Datalayer landing, on loop).
81
+ */
82
+ export const ColorModeOnly = {
83
+ args: {
84
+ themeVariant: "loop",
85
+ colorMode: "dark",
86
+ showThemeChooser: false,
87
+ },
88
+ render: (args) => _jsx(ThemedAppearanceMenu, { ...args }),
89
+ };
77
90
  /**
78
91
  * `AppearanceMenuWithStore`: the menu wired to a theme store, as the
79
92
  * appearance plugin puts it in a header.
80
93
  */
81
94
  export const WithStore = {
82
- render: (args) => (_jsx(ThemedProvider, { useStore: useThemeStore, children: _jsx(Box, { p: 3, bg: "canvas.default", minHeight: 520, children: _jsx(AppearanceMenuWithStore, { useStore: useThemeStore, size: args.size, shape: args.shape, hoverOverlayPlacement: args.hoverOverlayPlacement, showThemePreviews: args.showThemePreviews }) }) })),
95
+ render: (args) => (_jsx(ThemedProvider, { useStore: useThemeStore, children: _jsx(Box, { p: 3, bg: "canvas.default", minHeight: 520, children: _jsx(AppearanceMenuWithStore, { useStore: useThemeStore, size: args.size, shape: args.shape, hoverOverlayPlacement: args.hoverOverlayPlacement, showThemeChooser: args.showThemeChooser, showThemePreviews: args.showThemePreviews }) }) })),
83
96
  };
@@ -15,6 +15,11 @@ export interface ColorModeCircleProps {
15
15
  cycleOnClick?: boolean;
16
16
  /** Overlay placement relative to the circle. */
17
17
  hoverOverlayPlacement?: HoverOverlayPlacement;
18
+ /**
19
+ * The overlay's least width: 340 by default, room for the theme swatches;
20
+ * `auto` sizes it to what it holds (the colour-mode switch alone).
21
+ */
22
+ hoverOverlayMinWidth?: number | 'auto';
18
23
  /** Optional theme used to tint the circle border. */
19
24
  themeVariant?: ThemeVariant;
20
25
  /** Visual shape of the control. */
@@ -24,5 +29,5 @@ export interface ColorModeCircleProps {
24
29
  * A single clickable circle that cycles the color mode through
25
30
  * light → dark → system (auto). The icon reflects the current mode.
26
31
  */
27
- export declare function ColorModeCircle({ colorMode, onColorModeChange, size, hoverOverlay, cycleOnClick, hoverOverlayPlacement, themeVariant, shape, }: ColorModeCircleProps): ReactElement;
32
+ export declare function ColorModeCircle({ colorMode, onColorModeChange, size, hoverOverlay, cycleOnClick, hoverOverlayPlacement, hoverOverlayMinWidth, themeVariant, shape, }: ColorModeCircleProps): ReactElement;
28
33
  export default ColorModeCircle;
@@ -34,7 +34,7 @@ const OVERLAY_MARGIN = 12;
34
34
  * A single clickable circle that cycles the color mode through
35
35
  * light → dark → system (auto). The icon reflects the current mode.
36
36
  */
37
- export function ColorModeCircle({ colorMode, onColorModeChange, size = 28, hoverOverlay, cycleOnClick = true, hoverOverlayPlacement = 'bottom-end', themeVariant, shape = 'square', }) {
37
+ export function ColorModeCircle({ colorMode, onColorModeChange, size = 28, hoverOverlay, cycleOnClick = true, hoverOverlayPlacement = 'bottom-end', hoverOverlayMinWidth = 340, themeVariant, shape = 'square', }) {
38
38
  const meta = COLOR_MODE_META[colorMode] ?? COLOR_MODE_META.light;
39
39
  const next = COLOR_MODE_CYCLE[colorMode] ?? 'light';
40
40
  const nextMeta = COLOR_MODE_META[next];
@@ -145,7 +145,7 @@ export function ColorModeCircle({ colorMode, onColorModeChange, size = 28, hover
145
145
  left: isRight ? `calc(100% + 8px)` : isBottomStart ? 0 : 'auto',
146
146
  right: isRight || isBottomStart ? 'auto' : 0,
147
147
  zIndex: 220,
148
- minWidth: 340,
148
+ minWidth: hoverOverlayMinWidth,
149
149
  maxHeight: overlayMaxHeight ?? `calc(100vh - ${OVERLAY_MARGIN * 2}px)`,
150
150
  overflowY: 'auto',
151
151
  overscrollBehavior: 'contain',
@@ -4,7 +4,7 @@
4
4
  * the theme and the colour mode previewed, whatever the page around wears.
5
5
  */
6
6
  import type { ReactElement } from 'react';
7
- import type { ColorMode } from '../../theme/DatalayerBrandThemeProvider';
7
+ import type { ColorMode } from '../../theme/colorMode';
8
8
  import type { ThemeVariant } from '../../theme/themeTokens';
9
9
  export interface ThemePalettePreviewProps {
10
10
  variant: ThemeVariant;
@@ -68,10 +68,14 @@ type CardBoxProps = Omit<BoxStyleProps, 'border'> & BoxPseudoProps & Omit<React.
68
68
  * - `subtle` — a quieter ground, `canvas.subtle`, for a card among cards
69
69
  * or one inside a panel;
70
70
  * - `inset` — sunk into the page, `canvas.inset`, for code, logs, a prompt;
71
+ * - `overlay` — a panel floating over the page (a menu, a popover, a
72
+ * picker), `canvas.overlay`: opaque in every theme, where `canvas.default`
73
+ * may be glass (Metal's dark panels) and let the page read through it.
74
+ * The default of a card with `rounded="overlay"`;
71
75
  * - `accent`, `success`, `attention`, `danger` — a note in that tone: the
72
76
  * tone's wash with the tone's muted hairline.
73
77
  */
74
- export type CardVariant = 'default' | 'subtle' | 'inset' | 'accent' | 'success' | 'attention' | 'danger';
78
+ export type CardVariant = 'default' | 'subtle' | 'inset' | 'overlay' | 'accent' | 'success' | 'attention' | 'danger';
75
79
  /** The gradient a card is made of; see {@link CardProps.surface}. */
76
80
  export type CardSurface = 'sage' | 'steel' | 'mauve' | 'clay';
77
81
  export type CardProps = CardBoxProps & {
@@ -82,7 +86,10 @@ export type CardProps = CardBoxProps & {
82
86
  * or an index of Primer's radii. The theme's `card` corner by default.
83
87
  */
84
88
  rounded?: BoxRadiusToken | number;
85
- /** The card's flavour, `default` by default; see {@link CardVariant}. */
89
+ /**
90
+ * The card's flavour: `overlay` with `rounded="overlay"`, `default`
91
+ * otherwise; see {@link CardVariant}.
92
+ */
86
93
  variant?: CardVariant;
87
94
  /**
88
95
  * The card as a gradient, with white text on it and no hairline; it lies
@@ -3,6 +3,7 @@ import { IconButton, Text } from "@primer/react";
3
3
  import { Box, } from "../box/Box";
4
4
  const VARIANTS = {
5
5
  default: { bg: 'canvas.default', borderColor: 'border.default' },
6
+ overlay: { bg: 'canvas.overlay', borderColor: 'border.default' },
6
7
  subtle: { bg: 'canvas.subtle', borderColor: 'border.default' },
7
8
  inset: { bg: 'canvas.inset', borderColor: 'border.default' },
8
9
  accent: { bg: 'accent.subtle', borderColor: 'accent.muted' },
@@ -107,10 +108,11 @@ const DISABLED = {
107
108
  hover: {},
108
109
  };
109
110
  export const Card = (props) => {
110
- const { rounded, border, shadow, variant = 'default', surface, interactive, selected, dashed, disabled, accent, hoverEffect, sx, style, children, ...otherProps } = props;
111
+ const { rounded, border, shadow, variant, surface, interactive, selected, dashed, disabled, accent, hoverEffect, sx, style, children, ...otherProps } = props;
111
112
  const lift = hoverEffect === 'lift' && !disabled;
112
113
  const outlined = border || interactive || selected || dashed || lift;
113
- const flavour = VARIANTS[variant];
114
+ // A floating panel's ground is the overlay's, opaque whatever the theme.
115
+ const flavour = VARIANTS[variant ?? (rounded === 'overlay' ? 'overlay' : 'default')];
114
116
  // An interactive card's hover hairline is the accent, lifted or not.
115
117
  const effectSx = lift ? liftSx(interactive ? 'accent.emphasis' : 'border.muted') : undefined;
116
118
  const mergedSx = effectSx ? { ...effectSx, ...sx } : sx;
@@ -14,6 +14,31 @@ export interface SlidingPanelProps {
14
14
  offset?: number;
15
15
  panelSize?: number | string;
16
16
  fullWidth?: boolean;
17
+ /**
18
+ * Slide within the nearest positioned ancestor rather than over the
19
+ * viewport: the panel is `position: absolute` and takes that box's width
20
+ * (north, south) or height (east, west). For a panel that belongs to one
21
+ * region of a page — a chat embedded in a section — and must not cover
22
+ * the rest of it. Off by default: over the viewport, as before.
23
+ */
24
+ contained?: boolean;
25
+ /**
26
+ * Whether a click on the panel's background dismisses it, as it always
27
+ * did. Off for a panel whose content is read and used (a table, a card):
28
+ * its Close button and Escape still dismiss it.
29
+ */
30
+ dismissOnPanelClick?: boolean;
31
+ /** The Close button's name, said to a screen reader. */
32
+ closeLabel?: string;
33
+ /**
34
+ * Whether the panel is a live region that a screen reader reads out when
35
+ * it opens (`status`, or `alert` for an error), as it always was. Off for
36
+ * a panel with content to read at one's pace: it is then a named region
37
+ * (`ariaLabel`), reached like any other part of the page.
38
+ */
39
+ live?: boolean;
40
+ /** The panel's name, for a region that is not live. */
41
+ ariaLabel?: string;
17
42
  }
18
- export declare const SlidingPanel: ({ isOpen, message, details, onDismiss, position, variant, durationMs, transitionMs, zIndex, offset, panelSize, fullWidth, }: SlidingPanelProps) => import("react").JSX.Element | null;
43
+ export declare const SlidingPanel: ({ isOpen, message, details, onDismiss, position, variant, durationMs, transitionMs, zIndex, offset, panelSize, fullWidth, contained, dismissOnPanelClick, closeLabel, live, ariaLabel, }: SlidingPanelProps) => import("react").JSX.Element | null;
19
44
  export default SlidingPanel;
@@ -97,7 +97,7 @@ const edgeBorderStyles = {
97
97
  borderLeft: '1px solid',
98
98
  },
99
99
  };
100
- export const SlidingPanel = ({ isOpen, message, details, onDismiss, position = 'north', variant = 'default', durationMs, transitionMs = 260, zIndex = 200, offset = 0, panelSize = 360, fullWidth = true, }) => {
100
+ export const SlidingPanel = ({ isOpen, message, details, onDismiss, position = 'north', variant = 'default', durationMs, transitionMs = 260, zIndex = 200, offset = 0, panelSize = 360, fullWidth = true, contained = false, dismissOnPanelClick = true, closeLabel = 'Close panel', live = true, ariaLabel, }) => {
101
101
  const [isMounted, setIsMounted] = useState(isOpen);
102
102
  const [isVisible, setIsVisible] = useState(isOpen);
103
103
  useEffect(() => {
@@ -164,16 +164,27 @@ export const SlidingPanel = ({ isOpen, message, details, onDismiss, position = '
164
164
  return null;
165
165
  }
166
166
  const style = variantStyles[variant];
167
+ const alerting = variant === 'error' || variant === 'danger';
168
+ // Over the viewport, or over its own region of the page.
169
+ const across = contained ? '100%' : '100vw';
170
+ const along = contained ? '100%' : '100vh';
167
171
  const closeStyle = closeButtonStyles[variant];
168
172
  const horizontal = position === 'north' || position === 'south';
169
173
  const edgeBorder = edgeBorderStyles[position];
170
174
  return (_jsx(Box, { sx: {
171
- position: 'fixed',
175
+ position: contained ? 'absolute' : 'fixed',
172
176
  zIndex,
173
177
  display: 'flex',
174
178
  pointerEvents: 'none',
175
179
  ...anchorStyles,
176
- }, children: _jsxs(Box, { role: variant === 'error' || variant === 'danger' ? 'alert' : 'status', "aria-live": variant === 'error' || variant === 'danger' ? 'assertive' : 'polite', onClick: onDismiss
180
+ }, children: _jsxs(Box, { role: live ? (alerting ? 'alert' : 'status') : 'region', "aria-live": live ? (alerting ? 'assertive' : 'polite') : undefined, "aria-label": live ? undefined : ariaLabel, "data-sliding-panel": position, onKeyDown: onDismiss
181
+ ? (event) => {
182
+ if (event.key === 'Escape') {
183
+ event.stopPropagation();
184
+ onDismiss();
185
+ }
186
+ }
187
+ : undefined, onClick: onDismiss && dismissOnPanelClick
177
188
  ? (event) => {
178
189
  // A tap on the panel dismisses it — but not a click on a
179
190
  // link, button or field in its content, nor the end of a
@@ -191,15 +202,15 @@ export const SlidingPanel = ({ isOpen, message, details, onDismiss, position = '
191
202
  display: 'flex',
192
203
  alignItems: 'center',
193
204
  justifyContent: 'flex-start',
194
- cursor: onDismiss ? 'pointer' : 'default',
205
+ cursor: onDismiss && dismissOnPanelClick ? 'pointer' : 'default',
195
206
  width: horizontal
196
207
  ? fullWidth
197
- ? '100vw'
198
- : 'min(960px, 96vw)'
208
+ ? across
209
+ : `min(960px, ${contained ? '100%' : '96vw'})`
199
210
  : panelSize,
200
- maxWidth: horizontal ? '100vw' : undefined,
201
- height: horizontal ? undefined : '100vh',
202
- maxHeight: horizontal ? undefined : '100vh',
211
+ maxWidth: horizontal ? across : '100%',
212
+ height: horizontal ? undefined : along,
213
+ maxHeight: horizontal ? undefined : along,
203
214
  borderColor: style.border,
204
215
  borderTop: edgeBorder.borderTop,
205
216
  borderRight: edgeBorder.borderRight,
@@ -219,7 +230,7 @@ export const SlidingPanel = ({ isOpen, message, details, onDismiss, position = '
219
230
  position: 'absolute',
220
231
  top: 2,
221
232
  right: 3,
222
- }, children: _jsx(IconButton, { variant: "invisible", icon: XIcon, "aria-label": "Close panel", onClick: event => {
233
+ }, children: _jsx(IconButton, { variant: "invisible", icon: XIcon, "aria-label": closeLabel, onClick: event => {
223
234
  event.stopPropagation();
224
235
  onDismiss();
225
236
  }, sx: {
@@ -2,7 +2,7 @@ import type { StoryObj } from '@storybook/react';
2
2
  import { type SlidingPanelProps } from './SlidingPanel';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ isOpen, message, details, onDismiss, position, variant, durationMs, transitionMs, zIndex, offset, panelSize, fullWidth, }: SlidingPanelProps) => import("react").JSX.Element | null;
5
+ component: ({ isOpen, message, details, onDismiss, position, variant, durationMs, transitionMs, zIndex, offset, panelSize, fullWidth, contained, dismissOnPanelClick, closeLabel, live, ariaLabel, }: SlidingPanelProps) => import("react").JSX.Element | null;
6
6
  tags: string[];
7
7
  parameters: {
8
8
  layout: string;
@@ -14,3 +14,4 @@ export declare const NorthInfo: Story;
14
14
  export declare const SouthWarning: Story;
15
15
  export declare const EastSuccess: Story;
16
16
  export declare const WestError: Story;
17
+ export declare const ContainedEast: Story;
@@ -70,3 +70,34 @@ export const WestError = {
70
70
  },
71
71
  render: args => _jsx(Demo, { ...args }),
72
72
  };
73
+ /**
74
+ * Contained: the panel slides within its region of the page (here a box
75
+ * standing for a chat embedded in a section), never over the rest of it.
76
+ */
77
+ const ContainedDemo = (props) => {
78
+ const [isOpen, setIsOpen] = useState(false);
79
+ return (_jsxs(Box, { sx: { p: 4, minHeight: '100vh', bg: 'canvas.default' }, children: [_jsx(Heading, { as: "h2", sx: { fontSize: 3, mb: 3 }, children: "A panel inside its region" }), _jsx(Button, { onClick: () => setIsOpen(true), children: "Open panel" }), _jsxs(Box, { sx: {
80
+ position: 'relative',
81
+ overflow: 'hidden',
82
+ mt: 3,
83
+ height: 360,
84
+ maxWidth: 720,
85
+ border: '1px solid',
86
+ borderColor: 'border.default',
87
+ borderRadius: 2,
88
+ }, children: [_jsx(Box, { sx: { p: 3, color: 'fg.muted' }, children: "The region the panel belongs to." }), _jsx(SlidingPanel, { ...props, isOpen: isOpen, onDismiss: () => setIsOpen(false) })] })] }));
89
+ };
90
+ export const ContainedEast = {
91
+ args: {
92
+ isOpen: false,
93
+ message: 'Deck ready',
94
+ details: 'Six slides on the roast-day launch.',
95
+ position: 'east',
96
+ variant: 'success',
97
+ contained: true,
98
+ panelSize: 320,
99
+ dismissOnPanelClick: false,
100
+ closeLabel: 'Close the notice',
101
+ },
102
+ render: args => _jsx(ContainedDemo, { ...args }),
103
+ };
@@ -16,6 +16,11 @@ export type AppearancePluginConfig = {
16
16
  shape: "square" | "circle";
17
17
  /** Which way the overlay opens from the trigger. */
18
18
  placement: "bottom-start" | "bottom-end";
19
+ /**
20
+ * Whether the overlay offers the themes, or only light, dark and auto: a
21
+ * host that wears one theme turns it off.
22
+ */
23
+ showThemeChooser: boolean;
19
24
  /**
20
25
  * Whether the overlay carries the chosen theme's description and its
21
26
  * preview, or only the circles.
@@ -40,6 +40,7 @@ export const AppearancePlugin = definePlugin({
40
40
  size: 26,
41
41
  shape: "square",
42
42
  placement: "bottom-end",
43
+ showThemeChooser: true,
43
44
  showThemePreviews: true,
44
45
  applyThemeColorMode: false,
45
46
  themesPerLine: 6,
@@ -54,6 +55,7 @@ export const AppearancePlugin = definePlugin({
54
55
  size: config.size,
55
56
  shape: config.shape,
56
57
  hoverOverlayPlacement: config.placement,
58
+ showThemeChooser: config.showThemeChooser,
57
59
  showThemePreviews: config.showThemePreviews,
58
60
  applyThemeColorMode: config.applyThemeColorMode,
59
61
  themesPerLine: config.themesPerLine,
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Color mode to use.
3
+ * - `'light'` / `'dark'` — explicit override
4
+ * - `'auto'` — follow the operating system preference (prefers-color-scheme)
5
+ */
6
+ export type ColorMode = 'light' | 'dark' | 'auto';
@@ -2,4 +2,4 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export * from './spatialBrandTheme';
5
+ export {};
@@ -5,7 +5,7 @@ export * from './css/primerComponentsCss';
5
5
  export * from './css/primerBaseVars';
6
6
  export * from './themes/datalayerTheme';
7
7
  export * from './DatalayerThemeProvider';
8
- export * from './DatalayerBrandThemeProvider';
8
+ export * from './colorMode';
9
9
  export * from './themes/spatialTheme';
10
10
  export * from './themes/lovelyTheme';
11
11
  export * from './themes/matrixTheme';
@@ -16,7 +16,7 @@ export * from './themes/sunTheme';
16
16
  export * from './themes/loopTheme';
17
17
  export * from './themes/metalTheme';
18
18
  export * from './themes/vscodeTheme';
19
- export * from './themes-brand/spatialBrandTheme';
19
+ export * from './themes/roundedShape';
20
20
  export * from './themeRegistry';
21
21
  export * from './portableTheme';
22
22
  export * from './fontStacks';
@@ -9,7 +9,7 @@ export * from './css/primerComponentsCss';
9
9
  export * from './css/primerBaseVars';
10
10
  export * from './themes/datalayerTheme';
11
11
  export * from './DatalayerThemeProvider';
12
- export * from './DatalayerBrandThemeProvider';
12
+ export * from './colorMode';
13
13
  export * from './themes/spatialTheme';
14
14
  export * from './themes/lovelyTheme';
15
15
  export * from './themes/matrixTheme';
@@ -20,7 +20,7 @@ export * from './themes/sunTheme';
20
20
  export * from './themes/loopTheme';
21
21
  export * from './themes/metalTheme';
22
22
  export * from './themes/vscodeTheme';
23
- export * from './themes-brand/spatialBrandTheme';
23
+ export * from './themes/roundedShape';
24
24
  export * from './themeRegistry';
25
25
  export * from './portableTheme';
26
26
  export * from './fontStacks';
@@ -1,4 +1,4 @@
1
- import { type ColorMode } from './DatalayerBrandThemeProvider';
1
+ import { type ColorMode } from './colorMode';
2
2
  import { type ThemeVariant } from './themeTokens';
3
3
  /** A valid CSS custom-property name. */
4
4
  export type CssVariableName = `--${string}`;
@@ -4,7 +4,7 @@
4
4
  * native app or a build script reads. `themeRegistry` adds the Primer theme
5
5
  * object and the browser-aware helpers on top.
6
6
  */
7
- import { type ColorMode } from './DatalayerBrandThemeProvider';
7
+ import { type ColorMode } from './colorMode';
8
8
  import { type ThemeStyles } from './css/createThemeCSSVars';
9
9
  /** Available theme variants. */
10
10
  export type ThemeVariant = 'datalayer' | 'spatial' | 'lovely' | 'matrix' | 'earth' | 'sand' | 'ivory' | 'sun' | 'loop' | 'metal' | 'vscode';
@@ -1,2 +1,5 @@
1
- /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
1
+ /**
2
+ * Comprehensive Primer CSS-variable overrides for light & dark mode, with
3
+ * the rounded shape: Loop's and Metal's corners, pill controls (`roundedShape`).
4
+ */
2
5
  export declare const ivoryThemeStyles: import("../css/createThemeCSSVars").ThemeStyles;
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import { ivoryColors } from '../colors/ivoryColors';
14
14
  import { buildThemeStyles } from '../css/createThemeCSSVars';
15
+ import { roundedRadiusVars, roundedShape } from './roundedShape';
15
16
  /* ── Light-mode colour definitions ───────────────────────────────────── */
16
17
  const ivoryLight = {
17
18
  canvas: {
@@ -241,7 +242,12 @@ const ivoryDark = {
241
242
  * approach as the Matrix monospace stack).
242
243
  */
243
244
  const ivoryFontFamily = '"Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", P052, Georgia, serif';
244
- /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
245
+ /**
246
+ * Comprehensive Primer CSS-variable overrides for light & dark mode, with
247
+ * the rounded shape: Loop's and Metal's corners, pill controls (`roundedShape`).
248
+ */
245
249
  export const ivoryThemeStyles = buildThemeStyles(ivoryLight, ivoryDark, {
246
250
  fontFamily: ivoryFontFamily,
251
+ shape: roundedShape,
252
+ variables: { light: roundedRadiusVars, dark: roundedRadiusVars },
247
253
  });
@@ -21,6 +21,7 @@
21
21
  import { loopColors } from '../colors/loopColors';
22
22
  import { themeAccentTints, themeAccents } from '../colors/themeAccents';
23
23
  import { buildThemeStyles } from '../css/createThemeCSSVars';
24
+ import { roundedRadiusVars, roundedShape } from './roundedShape';
24
25
  /* ── Light-mode colour definitions ───────────────────────────────────── */
25
26
  export const loopLight = {
26
27
  canvas: {
@@ -263,14 +264,8 @@ export const loopDark = {
263
264
  * motion has three durations and one easing.
264
265
  */
265
266
  export const loopShapeVars = {
266
- '--borderRadius-small': '10px',
267
- '--borderRadius-medium': '14px',
268
- '--borderRadius-large': '20px',
269
- '--borderRadius-default': '14px',
270
- '--loop-radius-control': '999px',
271
- '--loop-radius-card': '20px',
272
- '--loop-radius-bubble': '22px',
273
- '--loop-radius-frame': '28px',
267
+ // The rounded shape's radii, shared with Metal, Sand, Ivory and Sun.
268
+ ...roundedRadiusVars,
274
269
  // Light mode's; `loopShadows` says dark mode's.
275
270
  '--loop-shadow-frame': '0 1px 2px rgba(0, 0, 0, 0.03), 0 10px 30px rgba(0, 0, 0, 0.06)',
276
271
  '--loop-face-large': '72px',
@@ -452,12 +447,7 @@ export const loopThemeStyles = buildThemeStyles(loopLight, loopDark, {
452
447
  // Rounder than the others: a pill for a control (LOOP T-09), soft cards,
453
448
  // round bubbles, a table with the corners of a list item.
454
449
  shape: {
455
- radiusControl: loopShapeVars['--loop-radius-control'],
456
- radiusTable: loopShapeVars['--borderRadius-medium'],
457
- radiusOverlay: loopShapeVars['--loop-radius-card'],
458
- radiusCard: loopShapeVars['--loop-radius-card'],
459
- radiusBubble: loopShapeVars['--loop-radius-bubble'],
460
- radiusFrame: loopShapeVars['--loop-radius-frame'],
450
+ ...roundedShape,
461
451
  shadow: loopShapeVars['--loop-shadow-frame'],
462
452
  motionStatus: loopMotionVars['--loop-motion-status'],
463
453
  motionMessage: loopMotionVars['--loop-motion-message'],
@@ -17,6 +17,7 @@ import { metalColors } from '../colors/metalColors';
17
17
  import { themeAccentTints } from '../colors/themeAccents';
18
18
  import { buildThemeStyles } from '../css/createThemeCSSVars';
19
19
  import { loopDark, loopLight, loopMotionVars, loopShapeVars, loopTypeScale, loopTypeVars, } from './loopThemeStyles';
20
+ import { roundedShape } from './roundedShape';
20
21
  /* ── Colour definitions ────────────────────────────────────────── */
21
22
  export const metalLight = {
22
23
  ...loopLight,
@@ -323,12 +324,7 @@ export const metalThemeStyles = buildThemeStyles(metalLight, metalDark, {
323
324
  fontFamily: metalFontFamily,
324
325
  css: metalOwnCss,
325
326
  shape: {
326
- radiusControl: loopShapeVars['--loop-radius-control'],
327
- radiusTable: loopShapeVars['--borderRadius-medium'],
328
- radiusOverlay: loopShapeVars['--loop-radius-card'],
329
- radiusCard: loopShapeVars['--loop-radius-card'],
330
- radiusBubble: loopShapeVars['--loop-radius-bubble'],
331
- radiusFrame: loopShapeVars['--loop-radius-frame'],
327
+ ...roundedShape,
332
328
  shadow: 'none',
333
329
  motionStatus: loopMotionVars['--loop-motion-status'],
334
330
  motionMessage: loopMotionVars['--loop-motion-message'],
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The rounded shape: Loop's corners, which Metal, Sand, Ivory and Sun share.
3
+ *
4
+ * Primer's own radii made rounder (a list item, a card, a menu take them),
5
+ * the `--loop-radius-*` properties an application is drawn with, and the
6
+ * theme shape that says so: a pill for every single-line control (a button,
7
+ * an icon button, a text input, a select, a segmented control), soft cards
8
+ * and overlays, round bubbles, a table with the corners of a list item.
9
+ * `primerComponentsCss` draws the controls and the table from it.
10
+ *
11
+ * A theme that is rounded passes `roundedShape` (with its own shadow, motion
12
+ * and the rest beside it) and sets `roundedRadiusVars` in both modes.
13
+ */
14
+ import type { ThemeShape } from '../css/createThemeCSSVars';
15
+ /** The radii as custom properties, the same in both modes. */
16
+ export declare const roundedRadiusVars: Record<string, string>;
17
+ /** The radii of the theme shape (`--theme-radius-*`). */
18
+ export declare const roundedShape: Pick<ThemeShape, 'radiusControl' | 'radiusTable' | 'radiusOverlay' | 'radiusCard' | 'radiusBubble' | 'radiusFrame'>;
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright (c) 2023-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /** The radii as custom properties, the same in both modes. */
6
+ export const roundedRadiusVars = {
7
+ '--borderRadius-small': '10px',
8
+ '--borderRadius-medium': '14px',
9
+ '--borderRadius-large': '20px',
10
+ '--borderRadius-default': '14px',
11
+ '--loop-radius-control': '999px',
12
+ '--loop-radius-card': '20px',
13
+ '--loop-radius-bubble': '22px',
14
+ '--loop-radius-frame': '28px',
15
+ };
16
+ /** The radii of the theme shape (`--theme-radius-*`). */
17
+ export const roundedShape = {
18
+ radiusControl: roundedRadiusVars['--loop-radius-control'],
19
+ radiusTable: roundedRadiusVars['--borderRadius-medium'],
20
+ radiusOverlay: roundedRadiusVars['--loop-radius-card'],
21
+ radiusCard: roundedRadiusVars['--loop-radius-card'],
22
+ radiusBubble: roundedRadiusVars['--loop-radius-bubble'],
23
+ radiusFrame: roundedRadiusVars['--loop-radius-frame'],
24
+ };
@@ -1,2 +1,5 @@
1
- /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
1
+ /**
2
+ * Comprehensive Primer CSS-variable overrides for light & dark mode, with
3
+ * the rounded shape: Loop's and Metal's corners, pill controls (`roundedShape`).
4
+ */
2
5
  export declare const sandThemeStyles: import("../css/createThemeCSSVars").ThemeStyles;
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import { sandColors } from '../colors/sandColors';
14
14
  import { buildThemeStyles } from '../css/createThemeCSSVars';
15
+ import { roundedRadiusVars, roundedShape } from './roundedShape';
15
16
  /* ── Light-mode colour definitions ───────────────────────────────────── */
16
17
  const sandLight = {
17
18
  canvas: {
@@ -240,7 +241,12 @@ const sandDark = {
240
241
  * loading (same no-download approach as the Matrix monospace stack).
241
242
  */
242
243
  const sandFontFamily = 'Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Cambria, serif';
243
- /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
244
+ /**
245
+ * Comprehensive Primer CSS-variable overrides for light & dark mode, with
246
+ * the rounded shape: Loop's and Metal's corners, pill controls (`roundedShape`).
247
+ */
244
248
  export const sandThemeStyles = buildThemeStyles(sandLight, sandDark, {
245
249
  fontFamily: sandFontFamily,
250
+ shape: roundedShape,
251
+ variables: { light: roundedRadiusVars, dark: roundedRadiusVars },
246
252
  });
@@ -1,2 +1,5 @@
1
- /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
1
+ /**
2
+ * Comprehensive Primer CSS-variable overrides for light & dark mode, with
3
+ * the rounded shape: Loop's and Metal's corners, pill controls (`roundedShape`).
4
+ */
2
5
  export declare const sunThemeStyles: import("../css/createThemeCSSVars").ThemeStyles;
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import { sunColors } from '../colors/sunColors';
14
14
  import { buildThemeStyles } from '../css/createThemeCSSVars';
15
+ import { roundedRadiusVars, roundedShape } from './roundedShape';
15
16
  /* ── Light-mode colour definitions ───────────────────────────────────── */
16
17
  const sunLight = {
17
18
  canvas: {
@@ -241,7 +242,12 @@ const sunDark = {
241
242
  * approach as the Matrix monospace stack).
242
243
  */
243
244
  const sunFontFamily = '"Avenir Next", Avenir, "Segoe UI", Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif';
244
- /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
245
+ /**
246
+ * Comprehensive Primer CSS-variable overrides for light & dark mode, with
247
+ * the rounded shape: Loop's and Metal's corners, pill controls (`roundedShape`).
248
+ */
245
249
  export const sunThemeStyles = buildThemeStyles(sunLight, sunDark, {
246
250
  fontFamily: sunFontFamily,
251
+ shape: roundedShape,
252
+ variables: { light: roundedRadiusVars, dark: roundedRadiusVars },
247
253
  });
@@ -21,7 +21,7 @@
21
21
  */
22
22
  import { type StoreApi, type UseBoundStore } from 'zustand';
23
23
  import type { ThemeVariant } from './themeRegistry';
24
- import type { ColorMode } from './DatalayerBrandThemeProvider';
24
+ import type { ColorMode } from './colorMode';
25
25
  export type VariantPreference = {
26
26
  theme: ThemeVariant;
27
27
  colorMode: ColorMode;
@@ -1,17 +1,4 @@
1
- import React, { Ref, PropsWithChildren } from 'react';
2
- import type { AnimateProps } from '@primer/react-brand';
3
- /**
4
- * Layout
5
- */
6
- export declare const Container: ({ children, style, }: {
7
- children: React.ReactElement[] | React.ReactElement;
8
- style?: React.CSSProperties;
9
- }) => React.JSX.Element;
10
- type RedlineBackgroundProps = {
11
- height?: number;
12
- hasBorder?: boolean;
13
- };
14
- export declare function RedlineBackground({ height, hasBorder, ...rest }: PropsWithChildren<RedlineBackgroundProps>): React.JSX.Element;
1
+ import { Ref } from 'react';
15
2
  /**
16
3
  * Base Types
17
4
  *
@@ -27,6 +14,4 @@ export type BaseProps<T> = {
27
14
  className?: string;
28
15
  id?: string;
29
16
  ref?: Ref<T>;
30
- animate?: AnimateProps;
31
17
  };
32
- export {};
@@ -1,21 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- /**
3
- * Layout
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export const Container = ({ children, style, }) => (_jsx("div", { style: { maxWidth: 1024, margin: '0 auto', ...style }, children: children }));
6
- export function RedlineBackground({ height, hasBorder = true, ...rest }) {
7
- return (_jsx("div", { style: {
8
- display: 'flex',
9
- overflow: 'hidden',
10
- border: hasBorder
11
- ? '1px solid var(--base-color-scale-red-2)'
12
- : undefined,
13
- backgroundImage: 'linear-gradient(45deg, var(--base-color-scale-red-0) 12.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 12.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 50%, var(--base-color-scale-red-0) 50%, var(--base-color-scale-red-0) 62.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 62.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 100%)',
14
- backgroundSize: '5.66px 5.66px',
15
- WebkitBoxPack: 'center',
16
- justifyContent: 'center',
17
- alignItems: 'center',
18
- width: '100%',
19
- height,
20
- }, ...rest }));
21
- }
5
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/primer-addons",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "license": "BSD-3-Clause",
5
5
  "scripts": {
6
6
  "build": "npm run build:lib",
@@ -39,7 +39,6 @@
39
39
  "@primer/octicons-react": "^19.42.0",
40
40
  "@primer/primitives": "^10.7.0",
41
41
  "@primer/react": "^37.31.0",
42
- "@primer/react-brand": "^0.58.2",
43
42
  "react-loading-skeleton": "^3.5.0",
44
43
  "styled-components": "^5.3.10",
45
44
  "zustand": "^5.0.0"
@@ -1,41 +0,0 @@
1
- import { type CSSProperties, type ReactNode } from 'react';
2
- import type { BrandTheme } from './themes-brand/spatialBrandTheme';
3
- export type ColorMode = 'light' | 'dark' | 'auto';
4
- export interface IDatalayerBrandThemeProviderProps {
5
- /**
6
- * Color mode to use.
7
- * - `'light'` / `'dark'` — explicit override
8
- * - `'auto'` — follow the operating system preference (prefers-color-scheme)
9
- */
10
- colorMode?: ColorMode;
11
- /**
12
- * A brand theme object with per-mode CSS variable overrides.
13
- * Each key (`light` / `dark`) is a `CSSProperties` map whose entries
14
- * are `--brand-color-*` / `--brand-button-*` custom properties.
15
- *
16
- * When omitted, the default Primer Brand tokens are used unchanged.
17
- */
18
- brandTheme?: BrandTheme;
19
- /**
20
- * Additional inline styles merged on top of the resolved brand theme.
21
- */
22
- style?: CSSProperties;
23
- children: ReactNode;
24
- }
25
- /**
26
- * Theme provider for Primer Brand (`@primer/react-brand`) components.
27
- *
28
- * Works by passing CSS custom-property overrides as inline `style` to
29
- * `ThemeProvider`, which scopes them to its DOM subtree — exactly how
30
- * the VS Code extension re-skins Primer via CSS variables.
31
- *
32
- * ```tsx
33
- * import { DatalayerBrandThemeProvider } from '@datalayer/core/lib/theme';
34
- * import { spatialBrandTheme } from '@datalayer/core/lib/theme/themes-brand/spatialBrandTheme';
35
- *
36
- * <DatalayerBrandThemeProvider colorMode="dark" brandTheme={spatialBrandTheme}>
37
- * <Hero>…</Hero>
38
- * </DatalayerBrandThemeProvider>
39
- * ```
40
- */
41
- export declare function DatalayerBrandThemeProvider({ colorMode, brandTheme, style, children, }: IDatalayerBrandThemeProviderProps): React.JSX.Element;
@@ -1,32 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ThemeProvider as PrimerBrandThemeProvider } from '@primer/react-brand';
3
- import { useSystemColorMode } from './useSystemColorMode';
4
- /**
5
- * Theme provider for Primer Brand (`@primer/react-brand`) components.
6
- *
7
- * Works by passing CSS custom-property overrides as inline `style` to
8
- * `ThemeProvider`, which scopes them to its DOM subtree — exactly how
9
- * the VS Code extension re-skins Primer via CSS variables.
10
- *
11
- * ```tsx
12
- * import { DatalayerBrandThemeProvider } from '@datalayer/core/lib/theme';
13
- * import { spatialBrandTheme } from '@datalayer/core/lib/theme/themes-brand/spatialBrandTheme';
14
- *
15
- * <DatalayerBrandThemeProvider colorMode="dark" brandTheme={spatialBrandTheme}>
16
- * <Hero>…</Hero>
17
- * </DatalayerBrandThemeProvider>
18
- * ```
19
- */
20
- export function DatalayerBrandThemeProvider({ colorMode = 'light', brandTheme, style, children, }) {
21
- const systemMode = useSystemColorMode();
22
- const resolved = colorMode === 'auto' ? systemMode : colorMode;
23
- const themeOverrides = brandTheme
24
- ? resolved === 'dark'
25
- ? brandTheme.dark
26
- : brandTheme.light
27
- : undefined;
28
- return (_jsx(PrimerBrandThemeProvider, { colorMode: resolved, style: {
29
- ...themeOverrides,
30
- ...style,
31
- }, children: children }));
32
- }
@@ -1 +0,0 @@
1
- export * from './spatialBrandTheme';
@@ -1,16 +0,0 @@
1
- import { type CSSProperties } from 'react';
2
- export declare const spatialBrandLight: CSSProperties;
3
- export declare const spatialBrandDark: CSSProperties;
4
- /**
5
- * Spatial Brand Theme — combined light + dark overrides.
6
- *
7
- * Pass to `DatalayerBrandThemeProvider`'s `brandTheme` prop.
8
- */
9
- export declare const spatialBrandTheme: {
10
- light: CSSProperties;
11
- dark: CSSProperties;
12
- };
13
- export type BrandTheme = {
14
- light: CSSProperties;
15
- dark: CSSProperties;
16
- };
@@ -1,157 +0,0 @@
1
- /*
2
- * Copyright (c) 2023-2025 Datalayer, Inc.
3
- * Distributed under the terms of the Modified BSD License.
4
- */
5
- /**
6
- * Spatial Brand Theme — Cosmic & Space-Inspired
7
- *
8
- * Overrides Primer Brand (`@primer/react-brand`) CSS custom properties
9
- * to produce an indigo / deep-blue aesthetic. The tokens listed here
10
- * mirror the `--brand-color-*` and `--brand-button-*` variables defined
11
- * in `@primer/react-brand/lib/css/main.css`.
12
- *
13
- * Primer Brand components resolve their colours exclusively through
14
- * CSS custom properties scoped under `[data-color-mode]` selectors.
15
- * By providing higher-specificity inline style overrides through the
16
- * `DatalayerBrandThemeProvider`, we swap the entire palette without
17
- * touching the Brand stylesheet itself — the same technique the
18
- * VS Code extension uses to re-skin Primer for its webviews.
19
- */
20
- import { spatialColors } from '../colors';
21
- /* ── Light mode ─────────────────────────────────────────────────────── */
22
- export const spatialBrandLight = {
23
- // Canvas
24
- '--brand-color-canvas-default': spatialColors.white,
25
- '--brand-color-canvas-overlay': spatialColors.white,
26
- '--brand-color-canvas-inset': spatialColors.indigoTint,
27
- '--brand-color-canvas-subtle': spatialColors.indigoTint,
28
- // Text
29
- '--brand-color-text-default': '#1E1E3F',
30
- '--brand-color-text-muted': spatialColors.gray,
31
- '--brand-color-text-subtle': '#A0AEC0',
32
- '--brand-color-text-onEmphasis': spatialColors.white,
33
- // Accent
34
- '--brand-color-accent-primary': spatialColors.indigoBrand,
35
- '--brand-color-accent-secondary': spatialColors.indigoAccent,
36
- // Borders
37
- '--brand-color-border-default': '#C7D2FE',
38
- '--brand-color-border-muted': '#DDD6FE',
39
- '--brand-color-border-subtle': spatialColors.indigoTint,
40
- // Focus
41
- '--brand-color-focus': spatialColors.indigoBrand,
42
- // Neutral
43
- '--brand-color-neutral-emphasisPlus': '#1E1E3F',
44
- '--brand-color-neutral-emphasis': spatialColors.gray,
45
- '--brand-color-neutral-muted': 'rgba(99, 102, 241, 0.20)',
46
- '--brand-color-neutral-subtle': 'rgba(99, 102, 241, 0.08)',
47
- // Success / Error (keep semantic)
48
- '--brand-color-success-fg': '#1a7f37',
49
- '--brand-color-success-emphasis': '#2da44e',
50
- '--brand-color-success-muted': 'rgba(75, 195, 107, 0.6)',
51
- '--brand-color-success-subtle': '#dafbe1',
52
- '--brand-color-error-fg': '#d32f2f',
53
- '--brand-color-error-emphasis': '#d32f2f',
54
- '--brand-color-error-muted': 'rgba(255, 135, 133, 0.6)',
55
- '--brand-color-error-subtle': '#ffdcd7',
56
- // Buttons — primary
57
- '--brand-button-primary-bgColor-rest': spatialColors.indigoText,
58
- '--brand-button-primary-bgColor-hover': spatialColors.indigoHover,
59
- '--brand-button-primary-bgColor-active': spatialColors.indigoHover,
60
- '--brand-button-primary-bgColor-disabled': '#B4B0D8',
61
- '--brand-button-primary-borderColor-rest': spatialColors.indigoText,
62
- '--brand-button-primary-borderColor-hover': spatialColors.indigoHover,
63
- '--brand-button-primary-borderColor-active': spatialColors.indigoHover,
64
- '--brand-button-primary-borderColor-disabled': '#B4B0D8',
65
- '--brand-button-primary-fgColor-rest': spatialColors.white,
66
- '--brand-button-primary-fgColor-disabled': 'rgba(255, 255, 255, 0.5)',
67
- // Buttons — accent
68
- '--brand-button-accent-bgColor-rest': spatialColors.indigoBrand,
69
- '--brand-button-accent-bgColor-hover': spatialColors.indigoAccent,
70
- '--brand-button-accent-bgColor-active': spatialColors.indigoBrand,
71
- '--brand-button-accent-bgColor-disabled': '#B4B0D8',
72
- '--brand-button-accent-fgColor-rest': spatialColors.white,
73
- '--brand-button-accent-fgColor-disabled': 'rgba(255, 255, 255, 0.5)',
74
- // Buttons — secondary
75
- '--brand-button-secondary-bgColor-rest': 'transparent',
76
- '--brand-button-secondary-borderColor-rest': 'rgba(79, 70, 229, 0.25)',
77
- '--brand-button-secondary-borderColor-hover': 'rgba(79, 70, 229, 0.5)',
78
- '--brand-button-secondary-borderColor-active': 'rgba(79, 70, 229, 0.5)',
79
- '--brand-button-secondary-fgColor-rest': spatialColors.indigoText,
80
- '--brand-button-secondary-fgColor-disabled': '#B4B0D8',
81
- // Applied styles
82
- backgroundColor: spatialColors.white,
83
- color: '#1E1E3F',
84
- };
85
- /* ── Dark mode ──────────────────────────────────────────────────────── */
86
- export const spatialBrandDark = {
87
- // Canvas
88
- '--brand-color-canvas-default': spatialColors.black,
89
- '--brand-color-canvas-overlay': '#111827',
90
- '--brand-color-canvas-inset': spatialColors.black,
91
- '--brand-color-canvas-subtle': '#111827',
92
- // Text
93
- '--brand-color-text-default': '#E0E7FF',
94
- '--brand-color-text-muted': '#94A3B8',
95
- '--brand-color-text-subtle': '#64748B',
96
- '--brand-color-text-onEmphasis': spatialColors.white,
97
- // Accent
98
- '--brand-color-accent-primary': spatialColors.indigoAccent,
99
- '--brand-color-accent-secondary': spatialColors.indigoBright,
100
- // Borders
101
- '--brand-color-border-default': 'rgba(199, 210, 254, 0.15)',
102
- '--brand-color-border-muted': 'rgba(199, 210, 254, 0.10)',
103
- '--brand-color-border-subtle': 'rgba(199, 210, 254, 0.06)',
104
- // Focus
105
- '--brand-color-focus': spatialColors.indigoAccent,
106
- // Neutral
107
- '--brand-color-neutral-emphasisPlus': '#94A3B8',
108
- '--brand-color-neutral-emphasis': '#64748B',
109
- '--brand-color-neutral-muted': 'rgba(99, 102, 241, 0.25)',
110
- '--brand-color-neutral-subtle': 'rgba(99, 102, 241, 0.12)',
111
- // Success / Error
112
- '--brand-color-success-fg': '#3fb950',
113
- '--brand-color-success-emphasis': '#238636',
114
- '--brand-color-success-muted': 'rgba(46, 158, 66, 0.6)',
115
- '--brand-color-success-subtle': 'rgba(46, 158, 66, 0.85)',
116
- '--brand-color-error-fg': '#f85149',
117
- '--brand-color-error-emphasis': '#da3633',
118
- '--brand-color-error-muted': 'rgba(248, 82, 73, 0.6)',
119
- '--brand-color-error-subtle': 'rgba(248, 82, 73, 0.85)',
120
- // Buttons — primary
121
- '--brand-button-primary-bgColor-rest': spatialColors.indigoAccent,
122
- '--brand-button-primary-bgColor-hover': spatialColors.indigoBright,
123
- '--brand-button-primary-bgColor-active': spatialColors.indigoBright,
124
- '--brand-button-primary-bgColor-disabled': 'rgba(79, 70, 229, 0.35)',
125
- '--brand-button-primary-borderColor-rest': 'rgba(199, 210, 254, 0.15)',
126
- '--brand-button-primary-borderColor-hover': 'rgba(199, 210, 254, 0.15)',
127
- '--brand-button-primary-borderColor-active': 'rgba(199, 210, 254, 0.15)',
128
- '--brand-button-primary-borderColor-disabled': 'rgba(79, 70, 229, 0.2)',
129
- '--brand-button-primary-fgColor-rest': spatialColors.white,
130
- '--brand-button-primary-fgColor-disabled': 'rgba(255, 255, 255, 0.5)',
131
- // Buttons — accent
132
- '--brand-button-accent-bgColor-rest': spatialColors.indigoBrand,
133
- '--brand-button-accent-bgColor-hover': spatialColors.indigoAccent,
134
- '--brand-button-accent-bgColor-active': spatialColors.indigoBrand,
135
- '--brand-button-accent-bgColor-disabled': 'rgba(79, 70, 229, 0.35)',
136
- '--brand-button-accent-fgColor-rest': spatialColors.white,
137
- '--brand-button-accent-fgColor-disabled': 'rgba(255, 255, 255, 0.5)',
138
- // Buttons — secondary
139
- '--brand-button-secondary-bgColor-rest': 'transparent',
140
- '--brand-button-secondary-borderColor-rest': 'rgba(199, 210, 254, 0.15)',
141
- '--brand-button-secondary-borderColor-hover': 'rgba(199, 210, 254, 0.3)',
142
- '--brand-button-secondary-borderColor-active': 'rgba(199, 210, 254, 0.3)',
143
- '--brand-button-secondary-fgColor-rest': '#E0E7FF',
144
- '--brand-button-secondary-fgColor-disabled': 'rgba(99, 102, 241, 0.5)',
145
- // Applied styles
146
- backgroundColor: spatialColors.black,
147
- color: '#E0E7FF',
148
- };
149
- /**
150
- * Spatial Brand Theme — combined light + dark overrides.
151
- *
152
- * Pass to `DatalayerBrandThemeProvider`'s `brandTheme` prop.
153
- */
154
- export const spatialBrandTheme = {
155
- light: spatialBrandLight,
156
- dark: spatialBrandDark,
157
- };