@datalayer/primer-addons 1.0.52 → 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.
- package/lib/components/appearance/ThemePalettePreview.d.ts +1 -1
- package/lib/theme/colorMode.d.ts +6 -0
- package/lib/theme/{themes-brand/index.js → colorMode.js} +1 -1
- package/lib/theme/index.d.ts +2 -2
- package/lib/theme/index.js +2 -2
- package/lib/theme/portableTheme.d.ts +1 -1
- package/lib/theme/themeTokens.d.ts +1 -1
- package/lib/theme/themes/ivoryThemeStyles.d.ts +4 -1
- package/lib/theme/themes/ivoryThemeStyles.js +7 -1
- package/lib/theme/themes/loopThemeStyles.js +4 -14
- package/lib/theme/themes/metalThemeStyles.js +2 -6
- package/lib/theme/themes/roundedShape.d.ts +18 -0
- package/lib/theme/themes/roundedShape.js +24 -0
- package/lib/theme/themes/sandThemeStyles.d.ts +4 -1
- package/lib/theme/themes/sandThemeStyles.js +7 -1
- package/lib/theme/themes/sunThemeStyles.d.ts +4 -1
- package/lib/theme/themes/sunThemeStyles.js +7 -1
- package/lib/theme/useThemeStore.d.ts +1 -1
- package/lib/utils/Helper.d.ts +1 -16
- package/lib/utils/Helper.js +4 -20
- package/package.json +1 -2
- package/lib/theme/DatalayerBrandThemeProvider.d.ts +0 -41
- package/lib/theme/DatalayerBrandThemeProvider.js +0 -32
- package/lib/theme/themes-brand/index.d.ts +0 -1
- package/lib/theme/themes-brand/spatialBrandTheme.d.ts +0 -16
- package/lib/theme/themes-brand/spatialBrandTheme.js +0 -157
|
@@ -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/
|
|
7
|
+
import type { ColorMode } from '../../theme/colorMode';
|
|
8
8
|
import type { ThemeVariant } from '../../theme/themeTokens';
|
|
9
9
|
export interface ThemePalettePreviewProps {
|
|
10
10
|
variant: ThemeVariant;
|
package/lib/theme/index.d.ts
CHANGED
|
@@ -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 './
|
|
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
|
|
19
|
+
export * from './themes/roundedShape';
|
|
20
20
|
export * from './themeRegistry';
|
|
21
21
|
export * from './portableTheme';
|
|
22
22
|
export * from './fontStacks';
|
package/lib/theme/index.js
CHANGED
|
@@ -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 './
|
|
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
|
|
23
|
+
export * from './themes/roundedShape';
|
|
24
24
|
export * from './themeRegistry';
|
|
25
25
|
export * from './portableTheme';
|
|
26
26
|
export * from './fontStacks';
|
|
@@ -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 './
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
'
|
|
267
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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 './
|
|
24
|
+
import type { ColorMode } from './colorMode';
|
|
25
25
|
export type VariantPreference = {
|
|
26
26
|
theme: ThemeVariant;
|
|
27
27
|
colorMode: ColorMode;
|
package/lib/utils/Helper.d.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import
|
|
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 {};
|
package/lib/utils/Helper.js
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
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.
|
|
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
|
-
};
|