@datalayer/primer-addons 1.0.22 → 1.0.24
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 +1 -1
- package/lib/components/box/Box.js +1 -2
- package/lib/components/box/sx.js +1 -2
- package/lib/components/closeable-flash/CloseableFlash.d.ts +23 -1
- package/lib/components/closeable-flash/CloseableFlash.js +52 -4
- package/lib/components/content-loader/ContentLoader.js +4 -0
- package/lib/components/date-picker/DatePicker.d.ts +36 -1
- package/lib/components/date-picker/DatePicker.js +122 -16
- package/lib/components/date-picker/TimeColumns.d.ts +23 -0
- package/lib/components/date-picker/TimeColumns.js +88 -0
- package/lib/components/icons/CircleIcon.js +4 -0
- package/lib/components/index.js +4 -0
- package/lib/components/logo/DatalayerLogo.js +18 -1
- package/lib/components/logo/index.js +4 -0
- package/lib/components/side-overlay/SideOverlay.js +4 -0
- package/lib/components/side-overlay/SideOverlay.stories.js +4 -0
- package/lib/components/slider/Slider.js +4 -0
- package/lib/components/slider/Slider.stories.js +4 -0
- package/lib/components/sliding-panel/SlidingPanel.js +17 -1
- package/lib/components/sliding-panel/SlidingPanel.stories.js +4 -0
- package/lib/index.js +4 -0
- package/lib/reactor/page-layout/PageLayout.js +68 -52
- package/lib/story-helpers.d.ts +1 -1
- package/lib/theme/colors/index.d.ts +1 -0
- package/lib/theme/colors/index.js +3 -0
- package/lib/theme/colors/loopColors.d.ts +91 -0
- package/lib/theme/colors/loopColors.js +128 -0
- package/lib/theme/css/createThemeCSSVars.d.ts +8 -0
- package/lib/theme/css/createThemeCSSVars.js +2 -0
- package/lib/theme/index.d.ts +1 -0
- package/lib/theme/index.js +1 -0
- package/lib/theme/palettes/ColorPalette.js +42 -3
- package/lib/theme/palettes/index.js +1 -2
- package/lib/theme/themeRegistry.d.ts +1 -1
- package/lib/theme/themeRegistry.js +52 -1
- package/lib/theme/themes/loopTheme.d.ts +1105 -0
- package/lib/theme/themes/loopTheme.js +309 -0
- package/lib/utils/Portals.js +3 -1
- package/package.json +10 -4
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021-2026 Datalayer, Inc.
|
|
4
|
+
* Distributed under the terms of the Modified BSD License.
|
|
5
|
+
*/
|
|
2
6
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
7
|
import { IconButton } from '@primer/react';
|
|
4
8
|
import { XIcon } from '@primer/octicons-react';
|
|
@@ -169,7 +173,19 @@ export const SlidingPanel = ({ isOpen, message, details, onDismiss, position = '
|
|
|
169
173
|
display: 'flex',
|
|
170
174
|
pointerEvents: 'none',
|
|
171
175
|
...anchorStyles,
|
|
172
|
-
}, children: _jsxs(Box, { role: variant === 'error' || variant === 'danger' ? 'alert' : 'status', "aria-live": variant === 'error' || variant === 'danger' ? 'assertive' : 'polite', onClick: onDismiss
|
|
176
|
+
}, children: _jsxs(Box, { role: variant === 'error' || variant === 'danger' ? 'alert' : 'status', "aria-live": variant === 'error' || variant === 'danger' ? 'assertive' : 'polite', onClick: onDismiss
|
|
177
|
+
? (event) => {
|
|
178
|
+
// A tap on the panel dismisses it — but not a click on a
|
|
179
|
+
// link, button or field in its content, nor the end of a
|
|
180
|
+
// text selection: those are someone using what it says.
|
|
181
|
+
const target = event.target;
|
|
182
|
+
if (target.closest('a, button, input, select, textarea, label, [role="button"], [contenteditable="true"]') ||
|
|
183
|
+
(window.getSelection()?.toString() ?? '') !== '') {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
onDismiss();
|
|
187
|
+
}
|
|
188
|
+
: undefined, sx: {
|
|
173
189
|
pointerEvents: 'auto',
|
|
174
190
|
position: 'relative',
|
|
175
191
|
display: 'flex',
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021-2026 Datalayer, Inc.
|
|
4
|
+
* Distributed under the terms of the Modified BSD License.
|
|
5
|
+
*/
|
|
2
6
|
import { useRef, useState } from 'react';
|
|
3
7
|
import { Box, Button, Heading } from '@primer/react';
|
|
4
8
|
import { SlidingPanel } from './SlidingPanel';
|
package/lib/index.js
CHANGED
|
@@ -112,7 +112,6 @@ function ActivityLine({ label }) {
|
|
|
112
112
|
} }), _jsx(Text, { children: label })] }));
|
|
113
113
|
}
|
|
114
114
|
export function PageLayout({ page, hasPage = page !== undefined && page !== null, panel, band, chips, picker, transient, activity, bandMode = "docked", panelMode = "docked", panelSide = "right", sheetWidth = PAGE_SHEET_WIDTH, pageSize, panelWidth = PAGE_PANEL_WIDTH, }) {
|
|
115
|
-
const floating = bandMode === "floating";
|
|
116
115
|
const bandInPanel = bandMode === "panel";
|
|
117
116
|
const hasBand = band !== undefined && band !== null;
|
|
118
117
|
// One width for the sheet, the band's mount and the chips: the column.
|
|
@@ -238,73 +237,90 @@ export function PageLayout({ page, hasPage = page !== undefined && page !== null
|
|
|
238
237
|
pointerEvents: "none",
|
|
239
238
|
zIndex: -1,
|
|
240
239
|
display: "flex",
|
|
241
|
-
}, children: page }))] })] }), !hasPage || !panel ? null :
|
|
240
|
+
}, children: page }))] })] }), !hasPage || !panel ? null : (_jsxs(Box, { "data-page-panel": panelShown ? "" : undefined, "data-page-panel-mode": panelMode, "aria-hidden": panelShown ? undefined : "true", sx: {
|
|
242
241
|
minWidth: 0,
|
|
243
242
|
minHeight: 0,
|
|
244
243
|
display: "flex",
|
|
245
244
|
flexDirection: "column",
|
|
246
245
|
bg: "canvas.default",
|
|
247
246
|
borderColor: "border.default",
|
|
248
|
-
...(
|
|
247
|
+
...(!panelShown
|
|
249
248
|
? {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
//
|
|
255
|
-
|
|
256
|
-
|
|
249
|
+
// Out of sight, and out of the way of the pointer, while
|
|
250
|
+
// whatever is in it goes on running. No `z-index` here:
|
|
251
|
+
// it would make a stacking context, and the composer —
|
|
252
|
+
// which lives in this column whether the panel is open or
|
|
253
|
+
// not — has to be able to float over the page from it.
|
|
254
|
+
position: "absolute",
|
|
255
|
+
inset: 0,
|
|
256
|
+
visibility: "hidden",
|
|
257
|
+
pointerEvents: "none",
|
|
258
|
+
overflow: "visible",
|
|
257
259
|
}
|
|
258
|
-
: panelMode === "
|
|
260
|
+
: panelMode === "docked"
|
|
259
261
|
? {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
top: 0,
|
|
264
|
-
bottom: 0,
|
|
265
|
-
[panelSide]: 0,
|
|
266
|
-
width: panelWidth,
|
|
267
|
-
maxWidth: "85%",
|
|
262
|
+
flex: `0 0 ${panelWidth}px`,
|
|
263
|
+
maxWidth: "45%",
|
|
264
|
+
order: panelSide === "left" ? -1 : undefined,
|
|
268
265
|
[panelSide === "left" ? "borderRight" : "borderLeft"]: "1px solid",
|
|
269
|
-
|
|
270
|
-
|
|
266
|
+
// Over the canvas, and beside the band rather than under
|
|
267
|
+
// it: the band belongs to the page column.
|
|
268
|
+
zIndex: 1,
|
|
271
269
|
}
|
|
272
|
-
:
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
270
|
+
: panelMode === "overlay"
|
|
271
|
+
? {
|
|
272
|
+
// Over the page's right edge, the page untouched
|
|
273
|
+
// under it; against the root, as the float is.
|
|
274
|
+
position: "absolute",
|
|
275
|
+
top: 0,
|
|
276
|
+
bottom: 0,
|
|
277
|
+
[panelSide]: 0,
|
|
278
|
+
width: panelWidth,
|
|
279
|
+
maxWidth: "85%",
|
|
280
|
+
[panelSide === "left" ? "borderRight" : "borderLeft"]: "1px solid",
|
|
281
|
+
boxShadow: "shadow.large",
|
|
282
|
+
zIndex: 5,
|
|
283
|
+
}
|
|
284
|
+
: {
|
|
285
|
+
// A window in the page's corner.
|
|
286
|
+
position: "absolute",
|
|
287
|
+
[panelSide]: 16,
|
|
288
|
+
bottom: 16,
|
|
289
|
+
width: panelWidth,
|
|
290
|
+
maxWidth: "calc(100% - 32px)",
|
|
291
|
+
height: "min(70%, 560px)",
|
|
292
|
+
border: "1px solid",
|
|
293
|
+
borderRadius: 2,
|
|
294
|
+
boxShadow: "shadow.large",
|
|
295
|
+
overflow: "hidden",
|
|
296
|
+
zIndex: 5,
|
|
297
|
+
}),
|
|
286
298
|
}, children: [_jsx(Box, { sx: {
|
|
287
299
|
flex: "1 1 auto",
|
|
288
300
|
minHeight: 0,
|
|
289
301
|
display: "flex",
|
|
290
302
|
flexDirection: "column",
|
|
291
303
|
"& > *": { flex: "1 1 auto", minHeight: 0 },
|
|
292
|
-
}, children: panel }),
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
304
|
+
}, children: panel }), hasBand && bandMode !== "docked" ? (_jsxs(Box, { "data-page-panel-band": bandInPanel ? "" : undefined, sx: bandInPanel
|
|
305
|
+
? {
|
|
306
|
+
flex: "0 0 auto",
|
|
307
|
+
borderTop: "1px solid",
|
|
308
|
+
borderColor: "border.default",
|
|
309
|
+
// Visible even while the column itself is hidden —
|
|
310
|
+
// which it is until something opens the panel.
|
|
311
|
+
visibility: "visible",
|
|
312
|
+
pointerEvents: "auto",
|
|
313
|
+
"& > *": { justifyContent: "center" },
|
|
314
|
+
}
|
|
315
|
+
: {
|
|
316
|
+
/* The card positions itself against this layout's
|
|
317
|
+
root; this only has to stay out of its way, and
|
|
318
|
+
stay visible when the column around it is not. */
|
|
319
|
+
position: "absolute",
|
|
320
|
+
inset: 0,
|
|
321
|
+
visibility: "visible",
|
|
322
|
+
pointerEvents: "none",
|
|
323
|
+
"& > *": { pointerEvents: "auto" },
|
|
324
|
+
}, children: [bandInPanel ? chips : null, band] })) : null] }))] }), transient] }));
|
|
309
325
|
}
|
|
310
326
|
export default PageLayout;
|
package/lib/story-helpers.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ type StoryContext = Record<string, unknown> & {
|
|
|
8
8
|
parameters: Record<string, unknown>;
|
|
9
9
|
};
|
|
10
10
|
export declare const colormodeFromScheme: (colorScheme: string) => "light" | "dark";
|
|
11
|
-
export declare const withThemeProvider: (Story: React.FC<React.PropsWithChildren<StoryContext>>, context: StoryContext) => string | number | bigint | boolean | Iterable<React.ReactNode> | React.
|
|
11
|
+
export declare const withThemeProvider: (Story: React.FC<React.PropsWithChildren<StoryContext>>, context: StoryContext) => string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
12
12
|
export declare const toolbarTypes: {
|
|
13
13
|
colorScheme: {
|
|
14
14
|
name: string;
|
|
@@ -6,6 +6,7 @@ export { earthColors } from './earthColors';
|
|
|
6
6
|
export { sandColors } from './sandColors';
|
|
7
7
|
export { ivoryColors } from './ivoryColors';
|
|
8
8
|
export { sunColors } from './sunColors';
|
|
9
|
+
export { loopColors, loopAccents, loopAccentNames, loopAccentVars, type LoopAccent, type LoopAccentName, } from './loopColors';
|
|
9
10
|
import type { ThemeVariant } from '../themeRegistry';
|
|
10
11
|
/**
|
|
11
12
|
* Themed color palettes — maps each `ThemeVariant` to its corresponding
|
|
@@ -10,6 +10,7 @@ export { earthColors } from './earthColors';
|
|
|
10
10
|
export { sandColors } from './sandColors';
|
|
11
11
|
export { ivoryColors } from './ivoryColors';
|
|
12
12
|
export { sunColors } from './sunColors';
|
|
13
|
+
export { loopColors, loopAccents, loopAccentNames, loopAccentVars, } from './loopColors';
|
|
13
14
|
import { datalayerColors } from './datalayerColors';
|
|
14
15
|
import { spatialColors } from './spatialColors';
|
|
15
16
|
import { lovelyColors } from './lovelyColors';
|
|
@@ -18,6 +19,7 @@ import { earthColors } from './earthColors';
|
|
|
18
19
|
import { sandColors } from './sandColors';
|
|
19
20
|
import { ivoryColors } from './ivoryColors';
|
|
20
21
|
import { sunColors } from './sunColors';
|
|
22
|
+
import { loopColors } from './loopColors';
|
|
21
23
|
/**
|
|
22
24
|
* Themed color palettes — maps each `ThemeVariant` to its corresponding
|
|
23
25
|
* color object so consumers can pick the right palette at runtime.
|
|
@@ -37,4 +39,5 @@ export const themedColors = {
|
|
|
37
39
|
sand: sandColors,
|
|
38
40
|
ivory: ivoryColors,
|
|
39
41
|
sun: sunColors,
|
|
42
|
+
loop: loopColors,
|
|
40
43
|
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loop Color System – one accent, neutral everything else.
|
|
3
|
+
*
|
|
4
|
+
* The look of an application built in LOOP: a white (or near-black)
|
|
5
|
+
* canvas, near-black (or near-white) text, hairlines instead of borders,
|
|
6
|
+
* and a single soft accent that dark text sits on. Nothing else carries
|
|
7
|
+
* colour, apart from the three colours of a verdict.
|
|
8
|
+
*
|
|
9
|
+
* The accent of the theme itself is green — a lighter relative of
|
|
10
|
+
* Datalayer's brand green. An application may take one of five others
|
|
11
|
+
* (`loopAccents`); each is four values: the accent, the text that sits on
|
|
12
|
+
* it, the tint of the stage behind an application, and a quiet tint.
|
|
13
|
+
* Dark text on every accent: the lowest contrast of the six is 8.8 to 1.
|
|
14
|
+
*/
|
|
15
|
+
export declare const loopColors: {
|
|
16
|
+
black: string;
|
|
17
|
+
gray: string;
|
|
18
|
+
white: string;
|
|
19
|
+
ink: string;
|
|
20
|
+
inkDark: string;
|
|
21
|
+
subtle: string;
|
|
22
|
+
subtleDark: string;
|
|
23
|
+
grayDark: string;
|
|
24
|
+
loopBrand: string;
|
|
25
|
+
loopOn: string;
|
|
26
|
+
loopAccent: string;
|
|
27
|
+
loopText: string;
|
|
28
|
+
loopTint: string;
|
|
29
|
+
loopStage: string;
|
|
30
|
+
loopBright: string;
|
|
31
|
+
loopHover: string;
|
|
32
|
+
loopStageDark: string;
|
|
33
|
+
loopTintDark: string;
|
|
34
|
+
successBrand: string;
|
|
35
|
+
successAccent: string;
|
|
36
|
+
successTint: string;
|
|
37
|
+
attentionBrand: string;
|
|
38
|
+
attentionAccent: string;
|
|
39
|
+
attentionTint: string;
|
|
40
|
+
dangerBrand: string;
|
|
41
|
+
dangerAccent: string;
|
|
42
|
+
dangerTint: string;
|
|
43
|
+
severeBrand: string;
|
|
44
|
+
severeAccent: string;
|
|
45
|
+
severeTint: string;
|
|
46
|
+
doneBrand: string;
|
|
47
|
+
doneAccent: string;
|
|
48
|
+
doneTint: string;
|
|
49
|
+
brightGlow: string;
|
|
50
|
+
brightPop: string;
|
|
51
|
+
brightSpark: string;
|
|
52
|
+
brightBlaze: string;
|
|
53
|
+
brightSurge: string;
|
|
54
|
+
brightFlame: string;
|
|
55
|
+
brightGold: string;
|
|
56
|
+
brightLightGlow: string;
|
|
57
|
+
brightLightPop: string;
|
|
58
|
+
brightLightSpark: string;
|
|
59
|
+
brightLightBlaze: string;
|
|
60
|
+
brightLightSurge: string;
|
|
61
|
+
brightLightFlame: string;
|
|
62
|
+
brightLightGold: string;
|
|
63
|
+
};
|
|
64
|
+
/** The accents an application may take, by name. */
|
|
65
|
+
export type LoopAccentName = 'green' | 'rose' | 'sky' | 'lime' | 'sun' | 'violet';
|
|
66
|
+
/** An accent: four values, in light and in dark. */
|
|
67
|
+
export interface LoopAccent {
|
|
68
|
+
/** The accent itself: a bubble, a send button. The same in both modes. */
|
|
69
|
+
accent: string;
|
|
70
|
+
/** The text that sits on the accent. */
|
|
71
|
+
on: string;
|
|
72
|
+
/** The stage behind an application. */
|
|
73
|
+
stage: {
|
|
74
|
+
light: string;
|
|
75
|
+
dark: string;
|
|
76
|
+
};
|
|
77
|
+
/** A quiet tint: a draft, something waiting. */
|
|
78
|
+
quiet: {
|
|
79
|
+
light: string;
|
|
80
|
+
dark: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** The six accents. One per application; everything else is neutral. */
|
|
84
|
+
export declare const loopAccents: Record<LoopAccentName, LoopAccent>;
|
|
85
|
+
/** The names of the accents, in the order a picker shows them. */
|
|
86
|
+
export declare const loopAccentNames: LoopAccentName[];
|
|
87
|
+
/**
|
|
88
|
+
* An accent as CSS custom properties, for a color mode: what an
|
|
89
|
+
* application sets on its root to take its colour.
|
|
90
|
+
*/
|
|
91
|
+
export declare function loopAccentVars(name: LoopAccentName, mode?: 'light' | 'dark'): Record<string, string>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Loop Color System – one accent, neutral everything else.
|
|
7
|
+
*
|
|
8
|
+
* The look of an application built in LOOP: a white (or near-black)
|
|
9
|
+
* canvas, near-black (or near-white) text, hairlines instead of borders,
|
|
10
|
+
* and a single soft accent that dark text sits on. Nothing else carries
|
|
11
|
+
* colour, apart from the three colours of a verdict.
|
|
12
|
+
*
|
|
13
|
+
* The accent of the theme itself is green — a lighter relative of
|
|
14
|
+
* Datalayer's brand green. An application may take one of five others
|
|
15
|
+
* (`loopAccents`); each is four values: the accent, the text that sits on
|
|
16
|
+
* it, the tint of the stage behind an application, and a quiet tint.
|
|
17
|
+
* Dark text on every accent: the lowest contrast of the six is 8.8 to 1.
|
|
18
|
+
*/
|
|
19
|
+
export const loopColors = {
|
|
20
|
+
// Core neutrals
|
|
21
|
+
black: '#131314', // Near-black — primary dark background
|
|
22
|
+
gray: '#6A6A66', // Neutral gray, faintly warm — secondary text
|
|
23
|
+
white: '#FFFFFF', // White — primary light background
|
|
24
|
+
// Neutral surfaces and ink
|
|
25
|
+
ink: '#111111', // Text on light
|
|
26
|
+
inkDark: '#F3F3F1', // Text on dark
|
|
27
|
+
subtle: '#F5F5F3', // Subtle surface on light (a bubble, a chip)
|
|
28
|
+
subtleDark: '#1E1E20', // Subtle surface on dark
|
|
29
|
+
grayDark: '#A1A19C', // Secondary text on dark
|
|
30
|
+
// Loop palette (Brand) — green
|
|
31
|
+
loopBrand: '#7ADBB8', // The accent — a bubble, a send button, a swatch
|
|
32
|
+
loopOn: '#06281E', // Text that sits on the accent
|
|
33
|
+
loopAccent: '#4FC79C', // Deeper accent — charts, highlights
|
|
34
|
+
loopText: '#0F6B4F', // Accessible accent text & links on white (AA+)
|
|
35
|
+
loopTint: '#F0FAF6', // Quiet tint — a draft, a callout
|
|
36
|
+
loopStage: '#DDF5EC', // The stage behind an application
|
|
37
|
+
loopBright: '#8FE5C6', // Accent text & links on dark
|
|
38
|
+
loopHover: '#0A5640', // Accent text hover
|
|
39
|
+
// The stage and the quiet tint, on dark
|
|
40
|
+
loopStageDark: '#10261F',
|
|
41
|
+
loopTintDark: '#17211D',
|
|
42
|
+
// Semantic roles — kept for verdicts and rules only
|
|
43
|
+
successBrand: '#1F8A5B',
|
|
44
|
+
successAccent: '#58C797',
|
|
45
|
+
successTint: '#E4F5EC',
|
|
46
|
+
attentionBrand: '#A66A12',
|
|
47
|
+
attentionAccent: '#E0A54A',
|
|
48
|
+
attentionTint: '#FBF0DC',
|
|
49
|
+
dangerBrand: '#BF3F38',
|
|
50
|
+
dangerAccent: '#F08A83',
|
|
51
|
+
dangerTint: '#FBE7E5',
|
|
52
|
+
severeBrand: '#B4571A',
|
|
53
|
+
severeAccent: '#E8935A',
|
|
54
|
+
severeTint: '#FBEADD',
|
|
55
|
+
doneBrand: '#6B53C9',
|
|
56
|
+
doneAccent: '#C0AEF6',
|
|
57
|
+
doneTint: '#F6F3FE',
|
|
58
|
+
// Bright colours for SVG illustrations — the six accents themselves
|
|
59
|
+
brightGlow: '#7ADBB8', // Green — the accent
|
|
60
|
+
brightPop: '#8CCBF9', // Sky
|
|
61
|
+
brightSpark: '#BEDC55', // Lime
|
|
62
|
+
brightBlaze: '#F6A5C1', // Rose
|
|
63
|
+
brightSurge: '#C0AEF6', // Violet
|
|
64
|
+
brightFlame: '#F4A261', // Soft orange
|
|
65
|
+
brightGold: '#F8D469', // Sun
|
|
66
|
+
// The same, deeper, for light backgrounds
|
|
67
|
+
brightLightGlow: '#0F6B4F', // Deep green
|
|
68
|
+
brightLightPop: '#1F6FB0', // Deep sky
|
|
69
|
+
brightLightSpark: '#5F7A00', // Deep lime
|
|
70
|
+
brightLightBlaze: '#B83A6B', // Deep rose
|
|
71
|
+
brightLightSurge: '#6B53C9', // Deep violet
|
|
72
|
+
brightLightFlame: '#B4571A', // Deep orange
|
|
73
|
+
brightLightGold: '#8A6A00', // Deep sun
|
|
74
|
+
};
|
|
75
|
+
/** The six accents. One per application; everything else is neutral. */
|
|
76
|
+
export const loopAccents = {
|
|
77
|
+
green: {
|
|
78
|
+
accent: '#7ADBB8',
|
|
79
|
+
on: '#06281E',
|
|
80
|
+
stage: { light: '#DDF5EC', dark: '#10261F' },
|
|
81
|
+
quiet: { light: '#F0FAF6', dark: '#17211D' },
|
|
82
|
+
},
|
|
83
|
+
rose: {
|
|
84
|
+
accent: '#F6A5C1',
|
|
85
|
+
on: '#3A0A1C',
|
|
86
|
+
stage: { light: '#FCE3EC', dark: '#2B141C' },
|
|
87
|
+
quiet: { light: '#FDF2F6', dark: '#22181C' },
|
|
88
|
+
},
|
|
89
|
+
sky: {
|
|
90
|
+
accent: '#8CCBF9',
|
|
91
|
+
on: '#06243B',
|
|
92
|
+
stage: { light: '#DFF0FD', dark: '#0F2333' },
|
|
93
|
+
quiet: { light: '#F0F8FE', dark: '#161E25' },
|
|
94
|
+
},
|
|
95
|
+
lime: {
|
|
96
|
+
accent: '#BEDC55',
|
|
97
|
+
on: '#1F2A00',
|
|
98
|
+
stage: { light: '#EEF6CC', dark: '#1E2609' },
|
|
99
|
+
quiet: { light: '#F7FBE6', dark: '#1C2014' },
|
|
100
|
+
},
|
|
101
|
+
sun: {
|
|
102
|
+
accent: '#F8D469',
|
|
103
|
+
on: '#2E2200',
|
|
104
|
+
stage: { light: '#FDF3CD', dark: '#2A2209' },
|
|
105
|
+
quiet: { light: '#FEF9E7', dark: '#221F14' },
|
|
106
|
+
},
|
|
107
|
+
violet: {
|
|
108
|
+
accent: '#C0AEF6',
|
|
109
|
+
on: '#1C0F47',
|
|
110
|
+
stage: { light: '#ECE7FD', dark: '#1B1533' },
|
|
111
|
+
quiet: { light: '#F6F3FE', dark: '#1C1A27' },
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
/** The names of the accents, in the order a picker shows them. */
|
|
115
|
+
export const loopAccentNames = ['green', 'rose', 'sky', 'lime', 'sun', 'violet'];
|
|
116
|
+
/**
|
|
117
|
+
* An accent as CSS custom properties, for a color mode: what an
|
|
118
|
+
* application sets on its root to take its colour.
|
|
119
|
+
*/
|
|
120
|
+
export function loopAccentVars(name, mode = 'light') {
|
|
121
|
+
const accent = loopAccents[name] ?? loopAccents.green;
|
|
122
|
+
return {
|
|
123
|
+
'--loop-accent': accent.accent,
|
|
124
|
+
'--loop-accent-on': accent.on,
|
|
125
|
+
'--loop-stage': accent.stage[mode],
|
|
126
|
+
'--loop-quiet': accent.quiet[mode],
|
|
127
|
+
};
|
|
128
|
+
}
|
|
@@ -170,4 +170,12 @@ export interface ThemeStyles {
|
|
|
170
170
|
*/
|
|
171
171
|
export declare function buildThemeStyles(light: ThemeColorDefs, dark: ThemeColorDefs, options?: {
|
|
172
172
|
fontFamily?: string;
|
|
173
|
+
/**
|
|
174
|
+
* More custom properties, per mode, set after everything else: what a
|
|
175
|
+
* theme sets beside colour and font — its radii, its own tokens.
|
|
176
|
+
*/
|
|
177
|
+
variables?: {
|
|
178
|
+
light?: Record<string, string>;
|
|
179
|
+
dark?: Record<string, string>;
|
|
180
|
+
};
|
|
173
181
|
}): ThemeStyles;
|
|
@@ -290,6 +290,7 @@ export function buildThemeStyles(light, dark, options) {
|
|
|
290
290
|
...(options?.fontFamily ? { fontFamily: options.fontFamily } : {}),
|
|
291
291
|
...colorDefsToCSS(light, 'light'),
|
|
292
292
|
...fontVars,
|
|
293
|
+
...(options?.variables?.light ?? {}),
|
|
293
294
|
},
|
|
294
295
|
dark: {
|
|
295
296
|
backgroundColor: dark.canvas.default,
|
|
@@ -298,6 +299,7 @@ export function buildThemeStyles(light, dark, options) {
|
|
|
298
299
|
...(options?.fontFamily ? { fontFamily: options.fontFamily } : {}),
|
|
299
300
|
...colorDefsToCSS(dark, 'dark'),
|
|
300
301
|
...fontVars,
|
|
302
|
+
...(options?.variables?.dark ?? {}),
|
|
301
303
|
},
|
|
302
304
|
};
|
|
303
305
|
}
|
package/lib/theme/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './themes/earthTheme';
|
|
|
11
11
|
export * from './themes/sandTheme';
|
|
12
12
|
export * from './themes/ivoryTheme';
|
|
13
13
|
export * from './themes/sunTheme';
|
|
14
|
+
export * from './themes/loopTheme';
|
|
14
15
|
export * from './themes-brand/spatialBrandTheme';
|
|
15
16
|
export * from './themeRegistry';
|
|
16
17
|
export * from './portableTheme';
|
package/lib/theme/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export * from './themes/earthTheme';
|
|
|
15
15
|
export * from './themes/sandTheme';
|
|
16
16
|
export * from './themes/ivoryTheme';
|
|
17
17
|
export * from './themes/sunTheme';
|
|
18
|
+
export * from './themes/loopTheme';
|
|
18
19
|
export * from './themes-brand/spatialBrandTheme';
|
|
19
20
|
export * from './themeRegistry';
|
|
20
21
|
export * from './portableTheme';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
4
|
-
*
|
|
5
|
-
* Datalayer License
|
|
4
|
+
* Distributed under the terms of the Modified BSD License.
|
|
6
5
|
*/
|
|
7
6
|
/**
|
|
8
7
|
* Shared palette types, theme-aware colour resolution, and reusable
|
|
9
8
|
* gradient / grid definitions.
|
|
10
9
|
*/
|
|
11
|
-
import { datalayerColors, spatialColors, lovelyColors, matrixColors, earthColors, sandColors, ivoryColors, sunColors, } from '../colors';
|
|
10
|
+
import { datalayerColors, spatialColors, lovelyColors, matrixColors, earthColors, sandColors, ivoryColors, sunColors, loopColors, } from '../colors';
|
|
12
11
|
import { getBrightPalette, } from '../themeRegistry';
|
|
13
12
|
import { useThemeStore } from '../useThemeStore';
|
|
14
13
|
const dlBrightDark = getBrightPalette('datalayer');
|
|
@@ -27,6 +26,8 @@ const ivBrightDark = getBrightPalette('ivory');
|
|
|
27
26
|
const ivBrightLight = getBrightPalette('ivory', 'light');
|
|
28
27
|
const suBrightDark = getBrightPalette('sun');
|
|
29
28
|
const suBrightLight = getBrightPalette('sun', 'light');
|
|
29
|
+
const loBrightDark = getBrightPalette('loop');
|
|
30
|
+
const loBrightLight = getBrightPalette('loop', 'light');
|
|
30
31
|
const palettes = {
|
|
31
32
|
datalayer: {
|
|
32
33
|
light: {
|
|
@@ -332,6 +333,44 @@ const palettes = {
|
|
|
332
333
|
isLight: false,
|
|
333
334
|
},
|
|
334
335
|
},
|
|
336
|
+
loop: {
|
|
337
|
+
light: {
|
|
338
|
+
bg: loopColors.white,
|
|
339
|
+
bgPanel: '#ffffff',
|
|
340
|
+
bgAlt: loopColors.subtle,
|
|
341
|
+
primary: loopColors.loopBrand,
|
|
342
|
+
secondary: loopColors.loopText,
|
|
343
|
+
accent: loopColors.loopAccent,
|
|
344
|
+
glow: loBrightLight.glow,
|
|
345
|
+
pop: loBrightLight.pop,
|
|
346
|
+
spark: loBrightLight.spark,
|
|
347
|
+
blaze: loBrightLight.blaze,
|
|
348
|
+
surge: loBrightLight.surge,
|
|
349
|
+
flame: loBrightLight.flame,
|
|
350
|
+
gold: loBrightLight.gold,
|
|
351
|
+
textLight: loopColors.ink,
|
|
352
|
+
textMuted: loopColors.gray,
|
|
353
|
+
isLight: true,
|
|
354
|
+
},
|
|
355
|
+
dark: {
|
|
356
|
+
bg: loopColors.black,
|
|
357
|
+
bgPanel: '#19191B',
|
|
358
|
+
bgAlt: loopColors.subtleDark,
|
|
359
|
+
primary: loopColors.loopBrand,
|
|
360
|
+
secondary: loopColors.loopBright,
|
|
361
|
+
accent: loopColors.loopAccent,
|
|
362
|
+
glow: loBrightDark.glow,
|
|
363
|
+
pop: loBrightDark.pop,
|
|
364
|
+
spark: loBrightDark.spark,
|
|
365
|
+
blaze: loBrightDark.blaze,
|
|
366
|
+
surge: loBrightDark.surge,
|
|
367
|
+
flame: loBrightDark.flame,
|
|
368
|
+
gold: loBrightDark.gold,
|
|
369
|
+
textLight: loopColors.inkDark,
|
|
370
|
+
textMuted: loopColors.grayDark,
|
|
371
|
+
isLight: false,
|
|
372
|
+
},
|
|
373
|
+
},
|
|
335
374
|
};
|
|
336
375
|
export function getColorPalette(theme = 'datalayer', colorMode = 'auto') {
|
|
337
376
|
const mode = colorMode === 'auto'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CSSProperties } from 'react';
|
|
2
2
|
import { type ColorMode } from './DatalayerBrandThemeProvider';
|
|
3
3
|
/** Available theme variants. */
|
|
4
|
-
export type ThemeVariant = 'datalayer' | 'spatial' | 'lovely' | 'matrix' | 'earth' | 'sand' | 'ivory' | 'sun';
|
|
4
|
+
export type ThemeVariant = 'datalayer' | 'spatial' | 'lovely' | 'matrix' | 'earth' | 'sand' | 'ivory' | 'sun' | 'loop';
|
|
5
5
|
/** A pair of colours for a two-stop gradient. */
|
|
6
6
|
export interface GradientPair {
|
|
7
7
|
/** Start colour (brighter / brand). */
|