@datalayer/primer-addons 1.0.18 → 1.0.19

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 (68) hide show
  1. package/lib/components/appearance/AppearanceControls.d.ts +3 -2
  2. package/lib/components/appearance/AppearanceControls.js +71 -3
  3. package/lib/components/appearance/AppearanceMenu.d.ts +30 -0
  4. package/lib/components/appearance/AppearanceMenu.js +15 -0
  5. package/lib/components/appearance/ColorModeCircle.d.ts +28 -0
  6. package/lib/components/appearance/ColorModeCircle.js +132 -0
  7. package/lib/components/appearance/ThemeCircle.d.ts +21 -0
  8. package/lib/components/appearance/ThemeCircle.js +46 -0
  9. package/lib/components/appearance/ThemePreviewCard.d.ts +12 -0
  10. package/lib/components/appearance/ThemePreviewCard.js +83 -0
  11. package/lib/components/appearance/index.d.ts +4 -0
  12. package/lib/components/appearance/index.js +4 -0
  13. package/lib/components/box/Box.d.ts +2 -1
  14. package/lib/components/closeable-flash/CloseableFlash.js +58 -1
  15. package/lib/components/color/ColorSwatch.d.ts +23 -0
  16. package/lib/components/color/ColorSwatch.js +62 -0
  17. package/lib/components/color/index.d.ts +1 -0
  18. package/lib/components/color/index.js +5 -0
  19. package/lib/components/index.d.ts +6 -0
  20. package/lib/components/index.js +6 -0
  21. package/lib/components/logo/DatalayerLogo.js +49 -1
  22. package/lib/components/side-overlay/SideOverlay.js +1 -1
  23. package/lib/components/sliding-panel/SlidingPanel.d.ts +19 -0
  24. package/lib/components/sliding-panel/SlidingPanel.js +217 -0
  25. package/lib/components/sliding-panel/SlidingPanel.stories.d.ts +16 -0
  26. package/lib/components/sliding-panel/SlidingPanel.stories.js +68 -0
  27. package/lib/theme/colors/datalayerColors.d.ts +12 -0
  28. package/lib/theme/colors/datalayerColors.js +13 -0
  29. package/lib/theme/colors/earthColors.d.ts +12 -0
  30. package/lib/theme/colors/earthColors.js +13 -0
  31. package/lib/theme/colors/index.d.ts +3 -0
  32. package/lib/theme/colors/index.js +9 -0
  33. package/lib/theme/colors/ivoryColors.d.ts +46 -0
  34. package/lib/theme/colors/ivoryColors.js +56 -0
  35. package/lib/theme/colors/lovelyColors.d.ts +12 -0
  36. package/lib/theme/colors/lovelyColors.js +13 -0
  37. package/lib/theme/colors/matrixColors.d.ts +12 -0
  38. package/lib/theme/colors/matrixColors.js +13 -0
  39. package/lib/theme/colors/sandColors.d.ts +45 -0
  40. package/lib/theme/colors/sandColors.js +55 -0
  41. package/lib/theme/colors/spatialColors.d.ts +12 -0
  42. package/lib/theme/colors/spatialColors.js +13 -0
  43. package/lib/theme/colors/sunColors.d.ts +45 -0
  44. package/lib/theme/colors/sunColors.js +55 -0
  45. package/lib/theme/css/createThemeCSSVars.d.ts +25 -1
  46. package/lib/theme/css/createThemeCSSVars.js +56 -3
  47. package/lib/theme/index.d.ts +3 -0
  48. package/lib/theme/index.js +3 -0
  49. package/lib/theme/palettes/ColorPalette.js +121 -1
  50. package/lib/theme/themeRegistry.d.ts +1 -1
  51. package/lib/theme/themeRegistry.js +151 -1
  52. package/lib/theme/themes/datalayerTheme.js +58 -7
  53. package/lib/theme/themes/earthTheme.js +50 -0
  54. package/lib/theme/themes/ivoryTheme.d.ts +1091 -0
  55. package/lib/theme/themes/ivoryTheme.js +257 -0
  56. package/lib/theme/themes/lovelyTheme.js +58 -7
  57. package/lib/theme/themes/matrixTheme.js +57 -8
  58. package/lib/theme/themes/sandTheme.d.ts +1091 -0
  59. package/lib/theme/themes/sandTheme.js +256 -0
  60. package/lib/theme/themes/spatialTheme.js +58 -7
  61. package/lib/theme/themes/sunTheme.d.ts +1091 -0
  62. package/lib/theme/themes/sunTheme.js +257 -0
  63. package/lib/utils/Helper.d.ts +1 -1
  64. package/lib/utils/Portals.d.ts +0 -1
  65. package/lib/utils/Portals.js +0 -1
  66. package/package.json +9 -5
  67. package/lib/App.d.ts +0 -13
  68. package/lib/App.js +0 -25
@@ -0,0 +1,257 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Sun Theme for Primer React.
7
+ *
8
+ * Warm, radiant golden light with a deep amber accent — energetic,
9
+ * optimistic, and welcoming. Uses a friendly humanist-sans type stack
10
+ * for an approachable, cheerful feel.
11
+ * Theming is applied via **CSS custom-property overrides**.
12
+ */
13
+ import { theme as primerTheme } from '@primer/react';
14
+ import { sunColors } from '../colors/sunColors';
15
+ import { buildThemeStyles } from '../css/createThemeCSSVars';
16
+ /* ── Light-mode colour definitions ───────────────────────────────────── */
17
+ const sunLight = {
18
+ canvas: {
19
+ default: sunColors.white,
20
+ subtle: '#FFF3D6',
21
+ },
22
+ fg: {
23
+ default: '#2A2210',
24
+ muted: sunColors.gray,
25
+ onEmphasis: '#FFFBF0',
26
+ },
27
+ accent: {
28
+ fg: sunColors.sunText,
29
+ emphasis: sunColors.sunText,
30
+ muted: sunColors.sunAccent,
31
+ subtle: sunColors.sunTint,
32
+ },
33
+ success: {
34
+ fg: '#3E6B47',
35
+ emphasis: '#3E6B47',
36
+ muted: '#5E8A5E',
37
+ subtle: '#E1EEE0',
38
+ },
39
+ attention: {
40
+ fg: sunColors.attentionBrand,
41
+ emphasis: sunColors.attentionBrand,
42
+ muted: sunColors.attentionAccent,
43
+ subtle: sunColors.attentionTint,
44
+ },
45
+ danger: {
46
+ fg: sunColors.dangerBrand,
47
+ emphasis: sunColors.dangerBrand,
48
+ muted: sunColors.dangerAccent,
49
+ subtle: sunColors.dangerTint,
50
+ },
51
+ severe: {
52
+ fg: sunColors.severeBrand,
53
+ emphasis: sunColors.severeBrand,
54
+ muted: sunColors.severeAccent,
55
+ subtle: sunColors.severeTint,
56
+ },
57
+ done: {
58
+ fg: sunColors.doneBrand,
59
+ emphasis: sunColors.doneBrand,
60
+ muted: sunColors.doneAccent,
61
+ subtle: sunColors.doneTint,
62
+ },
63
+ border: {
64
+ default: '#F0E2BE',
65
+ muted: '#F6ECCF',
66
+ },
67
+ btn: {
68
+ text: '#2A2210',
69
+ bg: '#FFFCF3',
70
+ border: '#EEDCB2',
71
+ hoverBg: sunColors.sunTint,
72
+ hoverBorder: sunColors.gray,
73
+ activeBg: sunColors.sunTint,
74
+ activeBorder: sunColors.gray,
75
+ selectedBg: '#FFFCF3',
76
+ counterBg: sunColors.gray,
77
+ primary: {
78
+ text: '#FFFBF0',
79
+ bg: sunColors.sunText,
80
+ border: sunColors.sunText,
81
+ hoverBg: sunColors.sunHover,
82
+ hoverBorder: sunColors.sunHover,
83
+ selectedBg: sunColors.sunHover,
84
+ disabledText: 'rgba(255, 255, 255, 0.8)',
85
+ disabledBg: '#E0BE73',
86
+ disabledBorder: '#E0BE73',
87
+ icon: '#FFFBF0',
88
+ counterBg: 'rgba(0, 0, 0, 0.2)',
89
+ },
90
+ outline: {
91
+ text: sunColors.sunText,
92
+ hoverText: '#FFFBF0',
93
+ hoverBg: sunColors.sunText,
94
+ hoverBorder: sunColors.sunText,
95
+ hoverCounterBg: 'rgba(255, 255, 255, 0.2)',
96
+ selectedText: '#FFFBF0',
97
+ selectedBg: sunColors.sunHover,
98
+ selectedBorder: sunColors.sunHover,
99
+ disabledText: sunColors.gray,
100
+ disabledBg: sunColors.sunTint,
101
+ disabledCounterBg: 'rgba(0, 0, 0, 0.05)',
102
+ counterBg: 'rgba(0, 0, 0, 0.05)',
103
+ counterFg: sunColors.sunText,
104
+ hoverCounterFg: '#FFFBF0',
105
+ disabledCounterFg: sunColors.gray,
106
+ },
107
+ danger: {
108
+ text: '#B42318',
109
+ hoverText: '#FFFBF0',
110
+ hoverBg: '#B42318',
111
+ hoverBorder: '#B42318',
112
+ hoverCounterBg: 'rgba(255, 255, 255, 0.2)',
113
+ selectedText: '#FFFBF0',
114
+ selectedBg: '#8E1B12',
115
+ selectedBorder: '#8E1B12',
116
+ disabledText: 'rgba(180, 35, 24, 0.5)',
117
+ disabledBg: sunColors.sunTint,
118
+ disabledCounterBg: 'rgba(180, 35, 24, 0.05)',
119
+ counterBg: 'rgba(180, 35, 24, 0.1)',
120
+ counterFg: '#B42318',
121
+ hoverCounterFg: '#FFFBF0',
122
+ disabledCounterFg: 'rgba(180, 35, 24, 0.5)',
123
+ icon: '#B42318',
124
+ },
125
+ },
126
+ };
127
+ /* ── Dark-mode colour definitions ────────────────────────────────────── */
128
+ const sunDark = {
129
+ canvas: {
130
+ default: sunColors.black,
131
+ subtle: '#2A2109',
132
+ },
133
+ fg: {
134
+ default: '#F3E9CF',
135
+ muted: '#BEAC82',
136
+ onEmphasis: '#FFFBF0',
137
+ },
138
+ accent: {
139
+ fg: sunColors.sunBright,
140
+ emphasis: '#8A6E00',
141
+ muted: sunColors.sunBrand,
142
+ subtle: '#33290C',
143
+ },
144
+ success: {
145
+ fg: '#7CB07E',
146
+ emphasis: '#3E6B47',
147
+ muted: '#5E8A5E',
148
+ subtle: '#16261A',
149
+ },
150
+ attention: {
151
+ fg: '#E7C24E',
152
+ emphasis: '#8A6D08',
153
+ muted: sunColors.attentionAccent,
154
+ subtle: '#2E2606',
155
+ },
156
+ danger: {
157
+ fg: '#F08A70',
158
+ emphasis: '#B23A1E',
159
+ muted: sunColors.dangerAccent,
160
+ subtle: '#2E140E',
161
+ },
162
+ severe: {
163
+ fg: '#E6A566',
164
+ emphasis: '#A85D0C',
165
+ muted: sunColors.severeAccent,
166
+ subtle: '#2E1D0A',
167
+ },
168
+ done: {
169
+ fg: '#B09AD0',
170
+ emphasis: '#6A4E9E',
171
+ muted: sunColors.doneAccent,
172
+ subtle: '#1F1830',
173
+ },
174
+ btn: {
175
+ text: '#F3E9CF',
176
+ bg: '#2E2509',
177
+ border: 'rgba(243, 233, 207, 0.12)',
178
+ hoverBg: '#3A2F0D',
179
+ hoverBorder: '#BEAC82',
180
+ activeBg: '#2E2509',
181
+ activeBorder: '#8C7C4A',
182
+ selectedBg: '#241D07',
183
+ counterBg: '#3A2F0D',
184
+ primary: {
185
+ text: '#211A08',
186
+ bg: sunColors.sunBright,
187
+ border: 'rgba(243, 233, 207, 0.12)',
188
+ hoverBg: sunColors.sunAccent,
189
+ hoverBorder: 'rgba(243, 233, 207, 0.12)',
190
+ selectedBg: sunColors.sunAccent,
191
+ disabledText: 'rgba(33, 26, 8, 0.5)',
192
+ disabledBg: 'rgba(255, 213, 74, 0.35)',
193
+ disabledBorder: 'rgba(255, 213, 74, 0.2)',
194
+ icon: '#211A08',
195
+ counterBg: 'rgba(0, 0, 0, 0.2)',
196
+ },
197
+ outline: {
198
+ text: sunColors.sunBright,
199
+ hoverText: '#211A08',
200
+ hoverBg: sunColors.sunBright,
201
+ hoverBorder: sunColors.sunBright,
202
+ hoverCounterBg: 'rgba(0, 0, 0, 0.2)',
203
+ selectedText: '#211A08',
204
+ selectedBg: sunColors.sunAccent,
205
+ selectedBorder: sunColors.sunAccent,
206
+ disabledText: 'rgba(255, 213, 74, 0.5)',
207
+ disabledBg: 'rgba(255, 213, 74, 0.1)',
208
+ disabledCounterBg: 'rgba(255, 213, 74, 0.05)',
209
+ counterBg: 'rgba(255, 213, 74, 0.1)',
210
+ counterFg: sunColors.sunBright,
211
+ hoverCounterFg: '#211A08',
212
+ disabledCounterFg: 'rgba(255, 213, 74, 0.5)',
213
+ },
214
+ danger: {
215
+ text: '#f85149',
216
+ hoverText: '#FFFBF0',
217
+ hoverBg: '#da3633',
218
+ hoverBorder: '#f85149',
219
+ hoverCounterBg: 'rgba(255, 255, 255, 0.2)',
220
+ selectedText: '#FFFBF0',
221
+ selectedBg: '#b62324',
222
+ selectedBorder: '#ff7b72',
223
+ disabledText: 'rgba(248, 81, 73, 0.5)',
224
+ disabledBg: 'rgba(248, 81, 73, 0.1)',
225
+ disabledCounterBg: 'rgba(248, 81, 73, 0.05)',
226
+ counterBg: 'rgba(248, 81, 73, 0.1)',
227
+ counterFg: '#f85149',
228
+ hoverCounterFg: '#FFFBF0',
229
+ disabledCounterFg: 'rgba(248, 81, 73, 0.5)',
230
+ icon: '#f85149',
231
+ },
232
+ },
233
+ };
234
+ /* ── Exports ─────────────────────────────────────────────────────────── */
235
+ /**
236
+ * The Primer theme object.
237
+ *
238
+ * Since theming is done entirely via CSS custom properties
239
+ * (see `sunThemeStyles`), this is just the unmodified default Primer
240
+ * theme kept for backward compatibility.
241
+ */
242
+ export const sunTheme = primerTheme;
243
+ /**
244
+ * Friendly humanist-sans font stack for the Sun aesthetic.
245
+ *
246
+ * Leads with warm geometric-humanist sans-serifs (Avenir / Segoe UI /
247
+ * Ubuntu / Cantarell) for an approachable, optimistic feel, with
248
+ * cross-platform fallbacks across macOS / Windows / Linux so it renders
249
+ * consistently everywhere without web-font loading (same no-download
250
+ * approach as the Matrix monospace stack).
251
+ */
252
+ const sunFontFamily = '"Avenir Next", Avenir, "Segoe UI", Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif';
253
+ /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
254
+ export const sunThemeStyles = buildThemeStyles(sunLight, sunDark, {
255
+ fontFamily: sunFontFamily,
256
+ });
257
+ export default sunTheme;
@@ -1,5 +1,5 @@
1
1
  import React, { Ref, PropsWithChildren } from 'react';
2
- import { AnimateProps } from '@primer/react-brand';
2
+ import type { AnimateProps } from '@primer/react-brand';
3
3
  /**
4
4
  * Layout
5
5
  */
@@ -1,5 +1,4 @@
1
1
  import { type CSSProperties } from 'react';
2
- import '@primer/react-brand/lib/css/main.css';
3
2
  type Colormode = 'light' | 'dark' | 'auto';
4
3
  /**
5
4
  * Ensure we define a root for Primer portal root.
@@ -3,7 +3,6 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  import { registerPortalRoot } from '@primer/react';
6
- import '@primer/react-brand/lib/css/main.css';
7
6
  const PRIMER_PORTAL_ROOT_ID = '__primerPortalRoot__';
8
7
  /**
9
8
  * Key used on `document.body` to track the CSS-property names we
package/package.json CHANGED
@@ -1,23 +1,27 @@
1
1
  {
2
2
  "name": "@datalayer/primer-addons",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "license": "BSD-3-Clause",
5
5
  "scripts": {
6
- "build": "tsc && vite build",
6
+ "build": "npm run build:lib",
7
7
  "build-storybook": "storybook build",
8
8
  "build:lib": "npm run clean:lib&& tsc -b",
9
9
  "clean:lib": "rimraf lib tsconfig.tsbuildinfo",
10
- "dev": "vite",
10
+ "dev": "npm run gallery",
11
11
  "gallery": "npm --prefix examples/gallery run dev",
12
12
  "gallery:build": "npm --prefix examples/gallery run build",
13
13
  "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
14
- "preview": "vite preview",
15
- "start": "vite",
14
+ "preview": "npm --prefix examples/gallery run preview",
15
+ "start": "npm run gallery",
16
16
  "storybook": "storybook dev -p 6006",
17
17
  "watch": "tsc -w",
18
18
  "watch:lib": "tsc -b -w"
19
19
  },
20
20
  "main": "lib/index.js",
21
+ "sideEffects": [
22
+ "*.css",
23
+ "**/*.css"
24
+ ],
21
25
  "files": [
22
26
  "lib",
23
27
  "style"
package/lib/App.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import "@primer/primitives/dist/css/base/typography/typography.css";
2
- import "@primer/primitives/dist/css/base/motion/motion.css";
3
- import "@primer/primitives/dist/css/functional/themes/light.css";
4
- import "@primer/primitives/dist/css/functional/size/border.css";
5
- import "@primer/primitives/dist/css/functional/size/breakpoints.css";
6
- import "@primer/primitives/dist/css/functional/size/size-coarse.css";
7
- import "@primer/primitives/dist/css/functional/size/size-fine.css";
8
- import "@primer/primitives/dist/css/functional/size/size.css";
9
- import "@primer/primitives/dist/css/functional/size/viewport.css";
10
- import "@primer/primitives/dist/css/functional/typography/typography.css";
11
- import "./App.css";
12
- declare const App: () => import("react/jsx-runtime").JSX.Element;
13
- export default App;
package/lib/App.js DELETED
@@ -1,25 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState, useRef } from "react";
3
- import { BaseStyles, Box, Text, NavList, Heading, ThemeProvider, Button, theme, ActionMenu, IconButton, ActionList } from "@primer/react";
4
- import { KebabHorizontalIcon } from "@primer/octicons-react";
5
- import { DatalayerIcon, LogOutIcon, SettingsIcon } from "@datalayer/icons-react";
6
- import { Slider, SideOverlay } from ".";
7
- import "@primer/primitives/dist/css/base/typography/typography.css";
8
- import "@primer/primitives/dist/css/base/motion/motion.css";
9
- import "@primer/primitives/dist/css/functional/themes/light.css";
10
- import "@primer/primitives/dist/css/functional/size/border.css";
11
- import "@primer/primitives/dist/css/functional/size/breakpoints.css";
12
- import "@primer/primitives/dist/css/functional/size/size-coarse.css";
13
- import "@primer/primitives/dist/css/functional/size/size-fine.css";
14
- import "@primer/primitives/dist/css/functional/size/size.css";
15
- import "@primer/primitives/dist/css/functional/size/viewport.css";
16
- import "@primer/primitives/dist/css/functional/typography/typography.css";
17
- import "./App.css";
18
- const App = () => {
19
- const [isOpen, setIsOpen] = useState(false);
20
- const openButtonRef = useRef(null);
21
- const closeButtonRef = useRef(null);
22
- const headingRef = useRef(null);
23
- return (_jsx(ThemeProvider, { colorMode: "day", theme: theme, children: _jsxs(BaseStyles, { children: [_jsxs(ActionMenu, { children: [_jsx(ActionMenu.Anchor, { children: _jsx(IconButton, { icon: KebabHorizontalIcon, variant: "invisible", "aria-label": "jupyter-runtimes-more" }) }), _jsx(ActionMenu.Overlay, { width: "medium", children: _jsxs(ActionList, { children: [_jsxs(ActionList.Group, { children: [_jsx(ActionList.GroupHeading, { children: "More\u2026" }), _jsxs(ActionList.Item, { onSelect: () => alert('click'), children: [_jsx(ActionList.LeadingVisual, { children: _jsx(SettingsIcon, {}) }), "Settings", _jsx(ActionList.Description, { variant: "block", children: "Configure your personal settings." })] }), _jsxs(ActionList.Item, { onSelect: () => alert('click'), children: [_jsx(ActionList.LeadingVisual, { children: _jsx(DatalayerIcon, {}) }), "About", _jsx(ActionList.Description, { variant: "block", children: "About Runtimes." })] })] }), _jsxs(_Fragment, { children: [_jsx(ActionList.Divider, {}), _jsxs(ActionList.Item, { variant: "danger", onSelect: () => alert('click'), children: [_jsx(ActionList.LeadingVisual, { children: _jsx(LogOutIcon, {}) }), "Logout"] })] })] }) })] }), _jsxs(Box, { bg: "canvas.default", sx: { display: 'flex' }, children: [_jsx(Box, { children: _jsxs(NavList, { children: [_jsx(NavList.Item, { href: "/", "aria-current": "page", children: "Home" }), _jsx(NavList.Item, { href: "/about", children: "About" }), _jsx(NavList.Item, { href: "/contact", children: "Contact" })] }) }), _jsxs(Box, { p: 3, sx: { flexGrow: 1 }, children: [_jsx(Box, { children: _jsx(Text, { children: "Primer React Addons" }) }), _jsx(Box, { children: _jsx(Slider, { id: "slider", name: "slider", min: 1, max: 10, onChange: () => { } }) }), _jsx(Box, { p: 3, bg: "canvas.default", children: _jsxs(Box, { children: [_jsx(Box, { sx: { width: '100%', bg: 'darkgray' }, children: _jsx(Heading, { ref: headingRef, children: "Header" }) }), _jsxs(Box, { children: [_jsx(Button, { ref: openButtonRef, onClick: () => { setIsOpen(!isOpen); }, children: "Open overlay" }), _jsx(SideOverlay, { isOpen: isOpen, content: _jsxs(Text, { children: ["Look, I am an ", _jsx(Button, { children: "Overlay \uD83D\uDC49" })] }), setIsOpen: setIsOpen, openButtonRef: openButtonRef, closeButtonRef: closeButtonRef, headingRef: headingRef })] })] }) })] })] })] }) }));
24
- };
25
- export default App;