@datalayer/primer-addons 1.0.38 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -20
- package/lib/components/appearance/AppearanceControls.d.ts +6 -1
- package/lib/components/appearance/AppearanceControls.js +7 -3
- package/lib/components/appearance/AppearanceControlsWithStore.d.ts +4 -0
- package/lib/components/appearance/AppearanceControlsWithStore.js +4 -4
- package/lib/components/appearance/CollaboratorPalette.js +7 -20
- package/lib/components/box/Box.d.ts +103 -16
- package/lib/components/box/Box.js +157 -2
- package/lib/components/box/boxCss.d.ts +805 -0
- package/lib/components/box/boxCss.js +492 -0
- package/lib/components/box/boxTokens.d.ts +129 -0
- package/lib/components/box/boxTokens.js +124 -0
- package/lib/components/calendar-picker/CalendarPicker.js +2 -1
- package/lib/components/card/Card.js +19 -10
- package/lib/components/color/ColorSwatch.js +2 -1
- package/lib/components/color-picker/ColorPicker.js +8 -4
- package/lib/components/date-picker/DatePicker.d.ts +12 -3
- package/lib/components/date-picker/DatePicker.js +24 -8
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/sheet/Sheet.d.ts +15 -0
- package/lib/components/sheet/Sheet.js +21 -0
- package/lib/reactor/page-layout/PageLayout.js +4 -6
- package/lib/story-helpers.d.ts +2 -2
- package/lib/theme/DatalayerThemeProvider.d.ts +21 -0
- package/lib/theme/DatalayerThemeProvider.js +8 -2
- package/lib/theme/colors/index.d.ts +2 -1
- package/lib/theme/colors/index.js +2 -1
- package/lib/theme/colors/loopColors.d.ts +2 -48
- package/lib/theme/colors/loopColors.js +2 -98
- package/lib/theme/colors/themeAccents.d.ts +81 -0
- package/lib/theme/colors/themeAccents.js +139 -0
- package/lib/theme/css/createThemeCSSVars.js +3 -0
- package/lib/theme/css/primerBaseVars.d.ts +1 -0
- package/lib/theme/css/primerBaseVars.js +72 -0
- package/lib/theme/index.d.ts +1 -0
- package/lib/theme/index.js +1 -0
- package/lib/theme/themes/loopThemeStyles.d.ts +0 -6
- package/lib/theme/themes/loopThemeStyles.js +22 -12
- package/package.json +1 -1
|
@@ -12,10 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* The accent of the theme itself is mint — a soft green, lighter than
|
|
14
14
|
* the platform's (decided 2026-10-03, after a day on sky). An
|
|
15
|
-
* application may take one of five others
|
|
16
|
-
*
|
|
17
|
-
* on it, the tint of the stage behind an application, and a quiet tint.
|
|
18
|
-
* Dark text on every accent: the lowest contrast of the six is 8.8 to 1.
|
|
15
|
+
* application may take one of five others: the accents are the theme
|
|
16
|
+
* system's, over every theme (`themeAccents`, decided 2026-10-07).
|
|
19
17
|
*/
|
|
20
18
|
export const loopColors = {
|
|
21
19
|
// Core neutrals
|
|
@@ -76,97 +74,3 @@ export const loopColors = {
|
|
|
76
74
|
brightLightFlame: '#B4571A', // Deep orange
|
|
77
75
|
brightLightGold: '#8A6A00', // Deep sun
|
|
78
76
|
};
|
|
79
|
-
/** The six accents. One per application; everything else is neutral. Green — mint — is the theme's own. */
|
|
80
|
-
export const loopAccents = {
|
|
81
|
-
green: {
|
|
82
|
-
accent: '#7ADBB8',
|
|
83
|
-
on: '#06281E',
|
|
84
|
-
stage: { light: '#DDF5EC', dark: '#10261F' },
|
|
85
|
-
quiet: { light: '#F0FAF6', dark: '#17211D' },
|
|
86
|
-
text: { light: '#248462', dark: '#8FE5C6' },
|
|
87
|
-
},
|
|
88
|
-
rose: {
|
|
89
|
-
accent: '#F6A5C1',
|
|
90
|
-
on: '#3A0A1C',
|
|
91
|
-
stage: { light: '#FCE3EC', dark: '#2B141C' },
|
|
92
|
-
quiet: { light: '#FDF2F6', dark: '#22181C' },
|
|
93
|
-
text: { light: '#B83A6B', dark: '#F6A5C1' },
|
|
94
|
-
},
|
|
95
|
-
sky: {
|
|
96
|
-
accent: '#8CCBF9',
|
|
97
|
-
on: '#06243B',
|
|
98
|
-
stage: { light: '#DFF0FD', dark: '#0F2333' },
|
|
99
|
-
quiet: { light: '#F0F8FE', dark: '#161E25' },
|
|
100
|
-
text: { light: '#1F6FB0', dark: '#8CCBF9' },
|
|
101
|
-
},
|
|
102
|
-
lime: {
|
|
103
|
-
accent: '#BEDC55',
|
|
104
|
-
on: '#1F2A00',
|
|
105
|
-
stage: { light: '#EEF6CC', dark: '#1E2609' },
|
|
106
|
-
quiet: { light: '#F7FBE6', dark: '#1C2014' },
|
|
107
|
-
text: { light: '#5F7A00', dark: '#BEDC55' },
|
|
108
|
-
},
|
|
109
|
-
sun: {
|
|
110
|
-
accent: '#F8D469',
|
|
111
|
-
on: '#2E2200',
|
|
112
|
-
stage: { light: '#FDF3CD', dark: '#2A2209' },
|
|
113
|
-
quiet: { light: '#FEF9E7', dark: '#221F14' },
|
|
114
|
-
text: { light: '#8A6A00', dark: '#F8D469' },
|
|
115
|
-
},
|
|
116
|
-
violet: {
|
|
117
|
-
accent: '#C0AEF6',
|
|
118
|
-
on: '#1C0F47',
|
|
119
|
-
stage: { light: '#ECE7FD', dark: '#1B1533' },
|
|
120
|
-
quiet: { light: '#F6F3FE', dark: '#1C1A27' },
|
|
121
|
-
text: { light: '#6B53C9', dark: '#C0AEF6' },
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
/** The names of the accents, in the order a picker shows them. */
|
|
125
|
-
export const loopAccentNames = ['green', 'rose', 'sky', 'lime', 'sun', 'violet'];
|
|
126
|
-
/**
|
|
127
|
-
* An accent as CSS custom properties, for a color mode: what an
|
|
128
|
-
* application sets on its root to take its colour.
|
|
129
|
-
*/
|
|
130
|
-
export function loopAccentVars(name, mode = 'light') {
|
|
131
|
-
const accent = loopAccents[name] ?? loopAccents.green;
|
|
132
|
-
return {
|
|
133
|
-
'--loop-accent': accent.accent,
|
|
134
|
-
'--loop-accent-on': accent.on,
|
|
135
|
-
'--loop-stage': accent.stage[mode],
|
|
136
|
-
'--loop-quiet': accent.quiet[mode],
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* An application's accent as everything it colours (LOOP T-05): the four
|
|
141
|
-
* `--loop-*` properties of `loopAccentVars`, and Primer's accent fill and
|
|
142
|
-
* filled button — the person's bubble, the assistant's avatar, the one
|
|
143
|
-
* button to press — in the accent with the text that sits on it. Set on an
|
|
144
|
-
* application's root, it wears its own colour; the page around keeps mint.
|
|
145
|
-
*/
|
|
146
|
-
export function loopAccentStyles(name, mode = 'light') {
|
|
147
|
-
const accent = loopAccents[name];
|
|
148
|
-
if (!accent) {
|
|
149
|
-
throw new Error(`There is no accent "${name}"; the accents are ${loopAccentNames.join(', ')}.`);
|
|
150
|
-
}
|
|
151
|
-
return {
|
|
152
|
-
...loopAccentVars(name, mode),
|
|
153
|
-
'--bgColor-accent-emphasis': accent.accent,
|
|
154
|
-
'--borderColor-accent-emphasis': accent.accent,
|
|
155
|
-
// Its text, its muted border and tint: so that nothing on the page keeps
|
|
156
|
-
// the theme's default accent beside the application's own (T-18).
|
|
157
|
-
'--fgColor-accent': accent.text[mode],
|
|
158
|
-
'--fgColor-link': accent.text[mode],
|
|
159
|
-
'--borderColor-accent-muted': accent.accent,
|
|
160
|
-
'--bgColor-accent-muted': accent.quiet[mode],
|
|
161
|
-
// The selected tab: underlined in the accent (T-14).
|
|
162
|
-
'--underlineNav-borderColor-active': accent.accent,
|
|
163
|
-
'--button-primary-bgColor-rest': accent.accent,
|
|
164
|
-
'--button-primary-borderColor-rest': accent.accent,
|
|
165
|
-
'--button-primary-bgColor-hover': accent.accent,
|
|
166
|
-
'--button-primary-borderColor-hover': accent.accent,
|
|
167
|
-
'--button-primary-bgColor-active': accent.accent,
|
|
168
|
-
'--button-primary-borderColor-active': accent.accent,
|
|
169
|
-
'--button-primary-fgColor-rest': accent.on,
|
|
170
|
-
'--button-primary-iconColor-rest': accent.on,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme accents – the colour an application names, over any theme.
|
|
3
|
+
*
|
|
4
|
+
* Six soft accents, each with the dark text that sits on it (the lowest
|
|
5
|
+
* contrast of the six is 8.8 to 1), the tint of the stage behind an
|
|
6
|
+
* application, a quiet tint, and the accent as text. They were drawn for
|
|
7
|
+
* the `loop` theme — green, mint, is `loop`'s own — and, since 2026-10-07
|
|
8
|
+
* (decided by the user), they colour every theme: `themeAccentVars` sets
|
|
9
|
+
* Primer's own accent and primary properties, so the filled button, links,
|
|
10
|
+
* the accent tokens and a selected tab take the accent whatever theme an
|
|
11
|
+
* application wears.
|
|
12
|
+
*/
|
|
13
|
+
import type { ThemeColorDefs } from '../css/createThemeCSSVars';
|
|
14
|
+
/** The accents an application may take, by name. */
|
|
15
|
+
export type ThemeAccentName = 'green' | 'rose' | 'sky' | 'lime' | 'sun' | 'violet';
|
|
16
|
+
/** An accent: its values, in light and in dark. */
|
|
17
|
+
export interface ThemeAccent {
|
|
18
|
+
/** The accent itself: a bubble, a send button. The same in both modes. */
|
|
19
|
+
accent: string;
|
|
20
|
+
/** The text that sits on the accent. */
|
|
21
|
+
on: string;
|
|
22
|
+
/** The stage behind an application. */
|
|
23
|
+
stage: {
|
|
24
|
+
light: string;
|
|
25
|
+
dark: string;
|
|
26
|
+
};
|
|
27
|
+
/** A quiet tint: a draft, something waiting. */
|
|
28
|
+
quiet: {
|
|
29
|
+
light: string;
|
|
30
|
+
dark: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The accent as text: a link, a starter, an accent's word — deep enough on
|
|
34
|
+
* white (4.5 to 1), and the pastel itself on dark.
|
|
35
|
+
*/
|
|
36
|
+
text: {
|
|
37
|
+
light: string;
|
|
38
|
+
dark: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** The six accents. One per application; everything else is the theme's. Green — mint — is `loop`'s own. */
|
|
42
|
+
export declare const themeAccents: Record<ThemeAccentName, ThemeAccent>;
|
|
43
|
+
/** The names of the accents, in the order a picker shows them. */
|
|
44
|
+
export declare const themeAccentNames: ThemeAccentName[];
|
|
45
|
+
/**
|
|
46
|
+
* The stage, lit: a soft fall from the stage tint at the top to the quiet
|
|
47
|
+
* tint at the bottom, for the page an application sits on. Written with the
|
|
48
|
+
* colours themselves, not with `var(--theme-stage)`: a custom property is
|
|
49
|
+
* resolved where it is set, so a gradient inherited from the theme's root
|
|
50
|
+
* would keep the theme's tints under an application's own.
|
|
51
|
+
*/
|
|
52
|
+
export declare function themeStageGradient(stage: string, quiet: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* The accent's own custom properties, which every theme sets (its default
|
|
55
|
+
* from its colours, `themeTintVars`) and an application's accent replaces:
|
|
56
|
+
* the accent, the text on it, the stage, the quiet tint and the stage lit.
|
|
57
|
+
*/
|
|
58
|
+
export declare function themeAccentTints(accent: Pick<ThemeAccent, 'accent' | 'on'> & {
|
|
59
|
+
stage: string;
|
|
60
|
+
quiet: string;
|
|
61
|
+
}): Record<string, string>;
|
|
62
|
+
/**
|
|
63
|
+
* A theme's default accent properties, from its own colours: its accent
|
|
64
|
+
* fill and the text of its filled button, the accent's subtle tint as the
|
|
65
|
+
* stage, the subtle canvas as the quiet tint.
|
|
66
|
+
*/
|
|
67
|
+
export declare function themeTintVars(defs: ThemeColorDefs): Record<string, string>;
|
|
68
|
+
/**
|
|
69
|
+
* An application's accent as everything it colours, over any theme (LOOP
|
|
70
|
+
* T-05, T-30): the accent's own properties (`--theme-accent`,
|
|
71
|
+
* `--theme-accent-on`, `--theme-stage`, `--theme-quiet`,
|
|
72
|
+
* `--theme-stage-gradient`), and Primer's — the accent fill, text, links,
|
|
73
|
+
* muted border and tint, the filled button, a checked switch, a selected
|
|
74
|
+
* tab — so that nothing on its page keeps the theme's default accent beside
|
|
75
|
+
* its own (T-18). The theme's focus ring is kept: it is drawn to show around
|
|
76
|
+
* every accent (T-15). Set on an application's root, it wears its own
|
|
77
|
+
* colour; the page around keeps the theme's.
|
|
78
|
+
*
|
|
79
|
+
* An unknown name is refused.
|
|
80
|
+
*/
|
|
81
|
+
export declare function themeAccentVars(name: ThemeAccentName, mode?: 'light' | 'dark'): Record<string, string>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/** The six accents. One per application; everything else is the theme's. Green — mint — is `loop`'s own. */
|
|
6
|
+
export const themeAccents = {
|
|
7
|
+
green: {
|
|
8
|
+
accent: '#7ADBB8',
|
|
9
|
+
on: '#06281E',
|
|
10
|
+
stage: { light: '#DDF5EC', dark: '#10261F' },
|
|
11
|
+
quiet: { light: '#F0FAF6', dark: '#17211D' },
|
|
12
|
+
text: { light: '#248462', dark: '#8FE5C6' },
|
|
13
|
+
},
|
|
14
|
+
rose: {
|
|
15
|
+
accent: '#F6A5C1',
|
|
16
|
+
on: '#3A0A1C',
|
|
17
|
+
stage: { light: '#FCE3EC', dark: '#2B141C' },
|
|
18
|
+
quiet: { light: '#FDF2F6', dark: '#22181C' },
|
|
19
|
+
text: { light: '#B83A6B', dark: '#F6A5C1' },
|
|
20
|
+
},
|
|
21
|
+
sky: {
|
|
22
|
+
accent: '#8CCBF9',
|
|
23
|
+
on: '#06243B',
|
|
24
|
+
stage: { light: '#DFF0FD', dark: '#0F2333' },
|
|
25
|
+
quiet: { light: '#F0F8FE', dark: '#161E25' },
|
|
26
|
+
text: { light: '#1F6FB0', dark: '#8CCBF9' },
|
|
27
|
+
},
|
|
28
|
+
lime: {
|
|
29
|
+
accent: '#BEDC55',
|
|
30
|
+
on: '#1F2A00',
|
|
31
|
+
stage: { light: '#EEF6CC', dark: '#1E2609' },
|
|
32
|
+
quiet: { light: '#F7FBE6', dark: '#1C2014' },
|
|
33
|
+
text: { light: '#5F7A00', dark: '#BEDC55' },
|
|
34
|
+
},
|
|
35
|
+
sun: {
|
|
36
|
+
accent: '#F8D469',
|
|
37
|
+
on: '#2E2200',
|
|
38
|
+
stage: { light: '#FDF3CD', dark: '#2A2209' },
|
|
39
|
+
quiet: { light: '#FEF9E7', dark: '#221F14' },
|
|
40
|
+
text: { light: '#8A6A00', dark: '#F8D469' },
|
|
41
|
+
},
|
|
42
|
+
violet: {
|
|
43
|
+
accent: '#C0AEF6',
|
|
44
|
+
on: '#1C0F47',
|
|
45
|
+
stage: { light: '#ECE7FD', dark: '#1B1533' },
|
|
46
|
+
quiet: { light: '#F6F3FE', dark: '#1C1A27' },
|
|
47
|
+
text: { light: '#6B53C9', dark: '#C0AEF6' },
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
/** The names of the accents, in the order a picker shows them. */
|
|
51
|
+
export const themeAccentNames = ['green', 'rose', 'sky', 'lime', 'sun', 'violet'];
|
|
52
|
+
/**
|
|
53
|
+
* The stage, lit: a soft fall from the stage tint at the top to the quiet
|
|
54
|
+
* tint at the bottom, for the page an application sits on. Written with the
|
|
55
|
+
* colours themselves, not with `var(--theme-stage)`: a custom property is
|
|
56
|
+
* resolved where it is set, so a gradient inherited from the theme's root
|
|
57
|
+
* would keep the theme's tints under an application's own.
|
|
58
|
+
*/
|
|
59
|
+
export function themeStageGradient(stage, quiet) {
|
|
60
|
+
return `radial-gradient(140% 100% at 50% 0%, ${stage} 0%, ${quiet} 100%)`;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The accent's own custom properties, which every theme sets (its default
|
|
64
|
+
* from its colours, `themeTintVars`) and an application's accent replaces:
|
|
65
|
+
* the accent, the text on it, the stage, the quiet tint and the stage lit.
|
|
66
|
+
*/
|
|
67
|
+
export function themeAccentTints(accent) {
|
|
68
|
+
return {
|
|
69
|
+
'--theme-accent': accent.accent,
|
|
70
|
+
'--theme-accent-on': accent.on,
|
|
71
|
+
'--theme-stage': accent.stage,
|
|
72
|
+
'--theme-quiet': accent.quiet,
|
|
73
|
+
'--theme-stage-gradient': themeStageGradient(accent.stage, accent.quiet),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A theme's default accent properties, from its own colours: its accent
|
|
78
|
+
* fill and the text of its filled button, the accent's subtle tint as the
|
|
79
|
+
* stage, the subtle canvas as the quiet tint.
|
|
80
|
+
*/
|
|
81
|
+
export function themeTintVars(defs) {
|
|
82
|
+
return themeAccentTints({
|
|
83
|
+
accent: defs.accent.emphasis,
|
|
84
|
+
on: defs.btn.primary.text,
|
|
85
|
+
stage: defs.accent.subtle ?? defs.canvas.subtle ?? defs.canvas.default,
|
|
86
|
+
quiet: defs.canvas.subtle ?? defs.canvas.default,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* An application's accent as everything it colours, over any theme (LOOP
|
|
91
|
+
* T-05, T-30): the accent's own properties (`--theme-accent`,
|
|
92
|
+
* `--theme-accent-on`, `--theme-stage`, `--theme-quiet`,
|
|
93
|
+
* `--theme-stage-gradient`), and Primer's — the accent fill, text, links,
|
|
94
|
+
* muted border and tint, the filled button, a checked switch, a selected
|
|
95
|
+
* tab — so that nothing on its page keeps the theme's default accent beside
|
|
96
|
+
* its own (T-18). The theme's focus ring is kept: it is drawn to show around
|
|
97
|
+
* every accent (T-15). Set on an application's root, it wears its own
|
|
98
|
+
* colour; the page around keeps the theme's.
|
|
99
|
+
*
|
|
100
|
+
* An unknown name is refused.
|
|
101
|
+
*/
|
|
102
|
+
export function themeAccentVars(name, mode = 'light') {
|
|
103
|
+
const accent = themeAccents[name];
|
|
104
|
+
if (!accent) {
|
|
105
|
+
throw new Error(`There is no accent "${name}"; the accents are ${themeAccentNames.join(', ')}.`);
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
...themeAccentTints({
|
|
109
|
+
accent: accent.accent,
|
|
110
|
+
on: accent.on,
|
|
111
|
+
stage: accent.stage[mode],
|
|
112
|
+
quiet: accent.quiet[mode],
|
|
113
|
+
}),
|
|
114
|
+
'--bgColor-accent-emphasis': accent.accent,
|
|
115
|
+
'--borderColor-accent-emphasis': accent.accent,
|
|
116
|
+
'--fgColor-accent': accent.text[mode],
|
|
117
|
+
'--fgColor-link': accent.text[mode],
|
|
118
|
+
'--borderColor-accent-muted': accent.accent,
|
|
119
|
+
'--bgColor-accent-muted': accent.quiet[mode],
|
|
120
|
+
'--underlineNav-borderColor-active': accent.accent,
|
|
121
|
+
'--button-primary-bgColor-rest': accent.accent,
|
|
122
|
+
'--button-primary-borderColor-rest': accent.accent,
|
|
123
|
+
'--button-primary-bgColor-hover': accent.accent,
|
|
124
|
+
'--button-primary-borderColor-hover': accent.accent,
|
|
125
|
+
'--button-primary-bgColor-active': accent.accent,
|
|
126
|
+
'--button-primary-borderColor-active': accent.accent,
|
|
127
|
+
'--button-primary-fgColor-rest': accent.on,
|
|
128
|
+
'--button-primary-iconColor-rest': accent.on,
|
|
129
|
+
'--buttonCounter-primary-fgColor-rest': accent.on,
|
|
130
|
+
'--color-btn-primary-bg': accent.accent,
|
|
131
|
+
'--color-btn-primary-hover-bg': accent.accent,
|
|
132
|
+
'--control-checked-bgColor-rest': accent.accent,
|
|
133
|
+
'--control-checked-bgColor-hover': accent.accent,
|
|
134
|
+
'--control-checked-bgColor-active': accent.accent,
|
|
135
|
+
'--control-checked-fgColor-rest': accent.on,
|
|
136
|
+
'--controlKnob-borderColor-checked': accent.accent,
|
|
137
|
+
'--datalayer-icon-fg': accent.text[mode],
|
|
138
|
+
};
|
|
139
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
+
import { themeTintVars } from '../colors/themeAccents';
|
|
5
6
|
/* ─── Helper ──────────────────────────────────────────────────────────── */
|
|
6
7
|
/**
|
|
7
8
|
* Convert a structured `ThemeColorDefs` object into a flat
|
|
@@ -310,6 +311,7 @@ export function buildThemeStyles(light, dark, options) {
|
|
|
310
311
|
...colorDefsToCSS(light, 'light'),
|
|
311
312
|
...fontVars,
|
|
312
313
|
...shapeVars(options?.shape),
|
|
314
|
+
...themeTintVars(light),
|
|
313
315
|
...(options?.variables?.light ?? {}),
|
|
314
316
|
},
|
|
315
317
|
dark: {
|
|
@@ -320,6 +322,7 @@ export function buildThemeStyles(light, dark, options) {
|
|
|
320
322
|
...colorDefsToCSS(dark, 'dark'),
|
|
321
323
|
...fontVars,
|
|
322
324
|
...shapeVars(options?.shape),
|
|
325
|
+
...themeTintVars(dark),
|
|
323
326
|
...(options?.variables?.dark ?? {}),
|
|
324
327
|
},
|
|
325
328
|
...(options?.css ? { css: options.css } : {}),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const primerBaseVars: Record<'light' | 'dark', Record<string, string>>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Primer's own CSS variables that no theme sets but that a page still reads
|
|
7
|
+
* — the radii, the neutral and sponsor colours, the open and closed states,
|
|
8
|
+
* the four elevation shadows — at Primer's own values (`@primer/primitives`,
|
|
9
|
+
* functional themes light and dark).
|
|
10
|
+
*
|
|
11
|
+
* The apps do not load the primitives' stylesheets, so Primer components
|
|
12
|
+
* draw these through the fallbacks written in their own CSS. `Box` emits
|
|
13
|
+
* the variable alone, with no fallback (see `components/box/Box.tsx`), so
|
|
14
|
+
* the theme provider sets every variable `Box` can emit: these, under the
|
|
15
|
+
* theme's own (`themeStyles`), which win where a theme says otherwise — the
|
|
16
|
+
* `loop` theme's radii and shadows.
|
|
17
|
+
*/
|
|
18
|
+
const radii = {
|
|
19
|
+
'--borderRadius-small': '3px',
|
|
20
|
+
'--borderRadius-medium': '6px',
|
|
21
|
+
'--borderRadius-large': '12px',
|
|
22
|
+
'--borderRadius-full': '9999px',
|
|
23
|
+
};
|
|
24
|
+
/** The open and closed states are success and danger, as in Primer. */
|
|
25
|
+
const states = {
|
|
26
|
+
'--fgColor-open': 'var(--fgColor-success)',
|
|
27
|
+
'--bgColor-open-emphasis': 'var(--bgColor-success-emphasis)',
|
|
28
|
+
'--borderColor-open-muted': 'var(--borderColor-success-muted)',
|
|
29
|
+
'--bgColor-open-muted': 'var(--bgColor-success-muted)',
|
|
30
|
+
'--fgColor-closed': 'var(--fgColor-danger)',
|
|
31
|
+
'--bgColor-closed-emphasis': 'var(--bgColor-danger-emphasis)',
|
|
32
|
+
'--borderColor-closed-muted': 'var(--borderColor-danger-muted)',
|
|
33
|
+
'--bgColor-closed-muted': 'var(--bgColor-danger-muted)',
|
|
34
|
+
};
|
|
35
|
+
export const primerBaseVars = {
|
|
36
|
+
light: {
|
|
37
|
+
...radii,
|
|
38
|
+
...states,
|
|
39
|
+
'--bgColor-emphasis': '#25292e',
|
|
40
|
+
'--bgColor-neutral-emphasis': '#59636e',
|
|
41
|
+
'--bgColor-neutral-muted': '#818b981f',
|
|
42
|
+
'--fgColor-sponsors': '#bf3989',
|
|
43
|
+
'--bgColor-sponsors-emphasis': '#bf3989',
|
|
44
|
+
'--borderColor-sponsors-muted': '#ff80c866',
|
|
45
|
+
'--bgColor-sponsors-muted': '#ffeff7',
|
|
46
|
+
'--shadow-resting-xsmall': '0px 1px 1px 0px #1f23280f',
|
|
47
|
+
'--shadow-resting-small': '0px 1px 1px 0px #1f23280f, 0px 1px 3px 0px #1f23280f',
|
|
48
|
+
'--shadow-resting-medium': '0px 1px 1px 0px #25292e1a, 0px 3px 6px 0px #25292e1f',
|
|
49
|
+
'--shadow-floating-small': '0px 0px 0px 1px #d1d9e080, 0px 6px 12px -3px #25292e0a, 0px 6px 18px 0px #25292e1f',
|
|
50
|
+
'--shadow-floating-medium': '0px 0px 0px 1px #d1d9e0, 0px 8px 16px -4px #25292e14, 0px 4px 32px -4px #25292e14, 0px 24px 48px -12px #25292e14, 0px 48px 96px -24px #25292e14',
|
|
51
|
+
'--shadow-floating-large': '0px 0px 0px 1px #d1d9e0, 0px 40px 80px 0px #25292e3d',
|
|
52
|
+
'--shadow-floating-xlarge': '0px 0px 0px 1px #d1d9e0, 0px 56px 112px 0px #25292e52',
|
|
53
|
+
},
|
|
54
|
+
dark: {
|
|
55
|
+
...radii,
|
|
56
|
+
...states,
|
|
57
|
+
'--bgColor-emphasis': '#3d444d',
|
|
58
|
+
'--bgColor-neutral-emphasis': '#656c76',
|
|
59
|
+
'--bgColor-neutral-muted': '#656c7633',
|
|
60
|
+
'--fgColor-sponsors': '#db61a2',
|
|
61
|
+
'--bgColor-sponsors-emphasis': '#bf4b8a',
|
|
62
|
+
'--borderColor-sponsors-muted': '#db61a266',
|
|
63
|
+
'--bgColor-sponsors-muted': '#db61a21a',
|
|
64
|
+
'--shadow-resting-xsmall': '0px 1px 1px 0px #010409cc',
|
|
65
|
+
'--shadow-resting-small': '0px 1px 1px 0px #01040999, 0px 1px 3px 0px #01040999',
|
|
66
|
+
'--shadow-resting-medium': '0px 1px 1px 0px #01040966, 0px 3px 6px 0px #010409cc',
|
|
67
|
+
'--shadow-floating-small': '0px 0px 0px 1px #3d444d, 0px 6px 12px -3px #01040966, 0px 6px 18px 0px #01040966',
|
|
68
|
+
'--shadow-floating-medium': '0px 0px 0px 1px #3d444d, 0px 8px 16px -4px #01040966, 0px 4px 32px -4px #01040966, 0px 24px 48px -12px #01040966, 0px 48px 96px -24px #01040966',
|
|
69
|
+
'--shadow-floating-large': '0px 0px 0px 1px #3d444d, 0px 24px 48px 0px #010409',
|
|
70
|
+
'--shadow-floating-xlarge': '0px 0px 0px 1px #3d444d, 0px 32px 64px 0px #010409',
|
|
71
|
+
},
|
|
72
|
+
};
|
package/lib/theme/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './colors';
|
|
2
2
|
export * from './indicators';
|
|
3
3
|
export * from './css/createThemeCSSVars';
|
|
4
|
+
export * from './css/primerBaseVars';
|
|
4
5
|
export * from './themes/datalayerTheme';
|
|
5
6
|
export * from './DatalayerThemeProvider';
|
|
6
7
|
export * from './DatalayerBrandThemeProvider';
|
package/lib/theme/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export * from './colors';
|
|
6
6
|
export * from './indicators';
|
|
7
7
|
export * from './css/createThemeCSSVars';
|
|
8
|
+
export * from './css/primerBaseVars';
|
|
8
9
|
export * from './themes/datalayerTheme';
|
|
9
10
|
export * from './DatalayerThemeProvider';
|
|
10
11
|
export * from './DatalayerBrandThemeProvider';
|
|
@@ -63,12 +63,6 @@ export declare const loopFontWeights: {
|
|
|
63
63
|
readonly semibold: 600;
|
|
64
64
|
};
|
|
65
65
|
export declare const loopTypeVars: (font: string) => Record<string, string>;
|
|
66
|
-
/**
|
|
67
|
-
* The stage, lit: a soft fall from the stage tint at the top to the quiet
|
|
68
|
-
* tint at the bottom, for the page an application sits on. Both tints are
|
|
69
|
-
* the accent's, so an application's own colour lights its stage.
|
|
70
|
-
*/
|
|
71
|
-
export declare const loopStageGradient = "radial-gradient(140% 100% at 50% 0%, var(--loop-stage) 0%, var(--loop-quiet) 100%)";
|
|
72
66
|
/**
|
|
73
67
|
* Inter, then its metric-matched fallback, then the system's own sans-serif
|
|
74
68
|
* (LOOP T-04). One face, two weights (400 and 600). The face is served by the
|
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Unlike the other themes it also sets **shape**: rounder corners, and
|
|
17
17
|
* its own `--loop-*` properties for what an application is drawn with —
|
|
18
|
-
*
|
|
18
|
+
* a bubble, a frame, a face. Its accent and stage are the theme system's
|
|
19
|
+
* (`--theme-accent`, `--theme-stage` and the rest, `themeAccents`): mint.
|
|
19
20
|
*/
|
|
20
|
-
import {
|
|
21
|
+
import { loopColors } from '../colors/loopColors';
|
|
22
|
+
import { themeAccentTints, themeAccents } from '../colors/themeAccents';
|
|
21
23
|
import { buildThemeStyles } from '../css/createThemeCSSVars';
|
|
22
24
|
/* ── Light-mode colour definitions ───────────────────────────────────── */
|
|
23
25
|
export const loopLight = {
|
|
@@ -386,11 +388,15 @@ export const loopTypeVars = (font) => {
|
|
|
386
388
|
};
|
|
387
389
|
};
|
|
388
390
|
/**
|
|
389
|
-
* The
|
|
390
|
-
*
|
|
391
|
-
* the accent's, so an application's own colour lights its stage.
|
|
391
|
+
* The accent's properties in a mode, mint's (`themeAccents.green`): the
|
|
392
|
+
* stage and the quiet tint are mint's own, not derived from the colours.
|
|
392
393
|
*/
|
|
393
|
-
|
|
394
|
+
const loopTints = (mode) => themeAccentTints({
|
|
395
|
+
accent: themeAccents.green.accent,
|
|
396
|
+
on: themeAccents.green.on,
|
|
397
|
+
stage: themeAccents.green.stage[mode],
|
|
398
|
+
quiet: themeAccents.green.quiet[mode],
|
|
399
|
+
});
|
|
394
400
|
/* ── Exports ─────────────────────────────────────────────────────────── */
|
|
395
401
|
/**
|
|
396
402
|
* Inter, then its metric-matched fallback, then the system's own sans-serif
|
|
@@ -495,27 +501,31 @@ export const loopThemeStyles = buildThemeStyles(loopLight, loopDark, {
|
|
|
495
501
|
variables: {
|
|
496
502
|
light: {
|
|
497
503
|
...loopShapeVars,
|
|
498
|
-
...
|
|
504
|
+
...loopTints('light'),
|
|
499
505
|
...loopMotionVars,
|
|
500
506
|
...loopShadows.light,
|
|
501
507
|
...loopTypeVars(loopFontFamily),
|
|
502
|
-
'--loop-stage-gradient': loopStageGradient,
|
|
503
508
|
'--loop-hairline': loopHairline.light,
|
|
509
|
+
// The hairline is Primer's default border: a card drawn with
|
|
510
|
+
// `borderColor="border.default"` gets it, no fallback chain at the call site.
|
|
511
|
+
'--borderColor-default': loopHairline.light,
|
|
504
512
|
'--focus-outlineColor': loopFocusRing.light,
|
|
505
513
|
// The selected tab underlined in the accent, not Primer's coral (LOOP T-14).
|
|
506
|
-
'--underlineNav-borderColor-active':
|
|
514
|
+
'--underlineNav-borderColor-active': themeAccents.green.accent,
|
|
507
515
|
},
|
|
508
516
|
dark: {
|
|
509
517
|
...loopShapeVars,
|
|
510
|
-
...
|
|
518
|
+
...loopTints('dark'),
|
|
511
519
|
...loopMotionVars,
|
|
512
520
|
...loopShadows.dark,
|
|
513
521
|
...loopTypeVars(loopFontFamily),
|
|
514
|
-
'--loop-stage-gradient': loopStageGradient,
|
|
515
522
|
'--loop-hairline': loopHairline.dark,
|
|
523
|
+
// The hairline is Primer's default border: a card drawn with
|
|
524
|
+
// `borderColor="border.default"` gets it, no fallback chain at the call site.
|
|
525
|
+
'--borderColor-default': loopHairline.dark,
|
|
516
526
|
'--focus-outlineColor': loopFocusRing.dark,
|
|
517
527
|
// The selected tab underlined in the accent, not Primer's coral (LOOP T-14).
|
|
518
|
-
'--underlineNav-borderColor-active':
|
|
528
|
+
'--underlineNav-borderColor-active': themeAccents.green.accent,
|
|
519
529
|
},
|
|
520
530
|
},
|
|
521
531
|
});
|