@datalayer/primer-addons 1.0.17 → 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 (84) 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 +1 -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/content-loader/ContentLoader.js +4 -2
  20. package/lib/components/icons/CircleIcon.js +6 -4
  21. package/lib/components/index.d.ts +7 -1
  22. package/lib/components/index.js +7 -1
  23. package/lib/components/logo/AI2.d.ts +20 -0
  24. package/lib/components/logo/AI2.js +23 -0
  25. package/lib/components/logo/DI.d.ts +19 -0
  26. package/lib/components/logo/DI.js +20 -0
  27. package/lib/components/logo/DatalayerLogo.js +49 -1
  28. package/lib/components/logo/index.d.ts +2 -0
  29. package/lib/components/logo/index.js +2 -0
  30. package/lib/components/{overlay/Overlay.d.ts → side-overlay/SideOverlay.d.ts} +3 -3
  31. package/lib/components/{overlay/Overlay.js → side-overlay/SideOverlay.js} +16 -16
  32. package/lib/components/side-overlay/SideOverlay.stories.d.ts +16 -0
  33. package/lib/components/{overlay/Overlay.stories.js → side-overlay/SideOverlay.stories.js} +13 -13
  34. package/lib/components/slider/Slider.js +2 -1
  35. package/lib/components/sliding-panel/SlidingPanel.d.ts +19 -0
  36. package/lib/components/sliding-panel/SlidingPanel.js +217 -0
  37. package/lib/components/sliding-panel/SlidingPanel.stories.d.ts +16 -0
  38. package/lib/components/sliding-panel/SlidingPanel.stories.js +68 -0
  39. package/lib/components/toolbar/FloatingToolbar.js +2 -2
  40. package/lib/theme/colors/datalayerColors.d.ts +12 -0
  41. package/lib/theme/colors/datalayerColors.js +13 -0
  42. package/lib/theme/colors/earthColors.d.ts +12 -0
  43. package/lib/theme/colors/earthColors.js +13 -0
  44. package/lib/theme/colors/index.d.ts +3 -0
  45. package/lib/theme/colors/index.js +9 -0
  46. package/lib/theme/colors/ivoryColors.d.ts +46 -0
  47. package/lib/theme/colors/ivoryColors.js +56 -0
  48. package/lib/theme/colors/lovelyColors.d.ts +12 -0
  49. package/lib/theme/colors/lovelyColors.js +13 -0
  50. package/lib/theme/colors/matrixColors.d.ts +12 -0
  51. package/lib/theme/colors/matrixColors.js +13 -0
  52. package/lib/theme/colors/sandColors.d.ts +45 -0
  53. package/lib/theme/colors/sandColors.js +55 -0
  54. package/lib/theme/colors/spatialColors.d.ts +12 -0
  55. package/lib/theme/colors/spatialColors.js +13 -0
  56. package/lib/theme/colors/sunColors.d.ts +45 -0
  57. package/lib/theme/colors/sunColors.js +55 -0
  58. package/lib/theme/css/createThemeCSSVars.d.ts +25 -1
  59. package/lib/theme/css/createThemeCSSVars.js +63 -3
  60. package/lib/theme/index.d.ts +3 -0
  61. package/lib/theme/index.js +3 -0
  62. package/lib/theme/palettes/ColorPalette.js +121 -1
  63. package/lib/theme/themeRegistry.d.ts +1 -1
  64. package/lib/theme/themeRegistry.js +151 -1
  65. package/lib/theme/themes/datalayerTheme.js +58 -7
  66. package/lib/theme/themes/earthTheme.js +50 -0
  67. package/lib/theme/themes/ivoryTheme.d.ts +1091 -0
  68. package/lib/theme/themes/ivoryTheme.js +257 -0
  69. package/lib/theme/themes/lovelyTheme.js +58 -7
  70. package/lib/theme/themes/matrixTheme.js +57 -8
  71. package/lib/theme/themes/sandTheme.d.ts +1091 -0
  72. package/lib/theme/themes/sandTheme.js +256 -0
  73. package/lib/theme/themes/spatialTheme.js +58 -7
  74. package/lib/theme/themes/sunTheme.d.ts +1091 -0
  75. package/lib/theme/themes/sunTheme.js +257 -0
  76. package/lib/theme/useThemeStore.d.ts +5 -3
  77. package/lib/theme/useThemeStore.js +78 -9
  78. package/lib/utils/Helper.d.ts +1 -1
  79. package/lib/utils/Portals.d.ts +0 -1
  80. package/lib/utils/Portals.js +0 -1
  81. package/package.json +14 -8
  82. package/lib/App.d.ts +0 -13
  83. package/lib/App.js +0 -25
  84. package/lib/components/overlay/Overlay.stories.d.ts +0 -16
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2023-2025 Datalayer, Inc.
4
+ * Distributed under the terms of the Modified BSD License.
5
+ */
6
+ import { useLayoutEffect, useRef, useState } from "react";
7
+ import { Box, Text } from "@primer/react";
8
+ import { useThemeStore } from "../../theme/useThemeStore";
9
+ /** Convert an `rgb()` / `rgba()` string to a `#rrggbb` hex value. */
10
+ function rgbToHex(rgb) {
11
+ const match = rgb.match(/rgba?\(([^)]+)\)/);
12
+ if (!match) {
13
+ return null;
14
+ }
15
+ const parts = match[1].split(",").map((part) => part.trim());
16
+ if (parts.length < 3) {
17
+ return null;
18
+ }
19
+ const [r, g, b] = parts.map((part) => parseInt(part, 10));
20
+ if ([r, g, b].some((channel) => Number.isNaN(channel))) {
21
+ return null;
22
+ }
23
+ const toHex = (channel) => channel.toString(16).padStart(2, "0");
24
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
25
+ }
26
+ /**
27
+ * Theme-aware color swatch. Renders a block filled with `color`, then reads
28
+ * the resolved value via `getComputedStyle` and displays it as a hex string.
29
+ * The resolved value recomputes whenever the active theme or color mode
30
+ * changes, so swatches backed by CSS custom properties stay in sync.
31
+ */
32
+ export function ColorSwatch({ color, label, showValue = true, height = 54, }) {
33
+ const ref = useRef(null);
34
+ const { theme, colorMode } = useThemeStore();
35
+ const [hex, setHex] = useState(null);
36
+ useLayoutEffect(() => {
37
+ const raf = requestAnimationFrame(() => {
38
+ if (!ref.current) {
39
+ return;
40
+ }
41
+ const rgb = getComputedStyle(ref.current).backgroundColor;
42
+ setHex(rgbToHex(rgb));
43
+ });
44
+ return () => cancelAnimationFrame(raf);
45
+ }, [color, theme, colorMode]);
46
+ return (_jsxs(Box, { sx: {
47
+ display: "grid",
48
+ gridTemplateRows: `${height}px auto`,
49
+ border: "1px solid",
50
+ borderColor: "var(--borderColor-default)",
51
+ borderRadius: 2,
52
+ overflow: "hidden",
53
+ minWidth: 0,
54
+ }, children: [_jsx(Box, { ref: ref, style: { backgroundColor: color } }), _jsxs(Box, { sx: { p: 2, display: "grid", gap: 1 }, children: [_jsx(Text, { sx: {
55
+ fontSize: 0,
56
+ color: "fg.default",
57
+ whiteSpace: "nowrap",
58
+ overflow: "hidden",
59
+ textOverflow: "ellipsis",
60
+ }, title: label ?? color, children: label ?? color }), showValue && hex ? (_jsx(Text, { sx: { fontSize: 0, color: "fg.muted", fontFamily: "mono" }, children: hex })) : null] })] }));
61
+ }
62
+ export default ColorSwatch;
@@ -0,0 +1 @@
1
+ export * from "./ColorSwatch";
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ export * from "./ColorSwatch";
@@ -1,8 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Box } from "@primer/react";
2
+ import { Box, useTheme } from "@primer/react";
3
3
  import Skeleton, { SkeletonTheme } from "react-loading-skeleton";
4
4
  import 'react-loading-skeleton/dist/skeleton.css';
5
5
  export const ContentLoader = (props) => {
6
- return (_jsx(Box, { children: _jsx(SkeletonTheme, { children: _jsx(Skeleton, { ...props }) }) }));
6
+ const { colorMode } = useTheme();
7
+ const isDark = colorMode !== 'day';
8
+ return (_jsx(Box, { children: _jsx(SkeletonTheme, { baseColor: isDark ? 'var(--bgColor-muted, #21262d)' : 'var(--bgColor-muted, #ebebeb)', highlightColor: isDark ? 'var(--borderColor-muted, #30363d)' : 'var(--borderColor-muted, #f5f5f5)', children: _jsx(Skeleton, { ...props }) }) }));
7
9
  };
8
10
  export default ContentLoader;
@@ -1,11 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useTheme } from '@primer/react';
3
3
  import { CircleCurrentColorIcon } from '@datalayer/icons-react';
4
- const COLORS = {
5
- 'danger': 'danger',
6
- };
7
4
  export const CircleIcon = ({ color = 'white', variant = 'fg', }) => {
8
5
  const { theme } = useTheme();
9
- return (_jsx(CircleCurrentColorIcon, { fill: theme?.colors[COLORS[color]][variant] ?? color ?? 'white' }));
6
+ const colorGroup = theme?.colors?.[color];
7
+ const resolvedColor = colorGroup && typeof colorGroup === 'object'
8
+ ? colorGroup[variant] ??
9
+ colorGroup.fg
10
+ : undefined;
11
+ return (_jsx(CircleCurrentColorIcon, { fill: resolvedColor ?? color ?? 'currentColor', color: resolvedColor ?? color ?? 'currentColor' }));
10
12
  };
11
13
  export default CircleIcon;
@@ -1,11 +1,17 @@
1
1
  export * from "./appearance/AppearanceControls";
2
2
  export * from "./appearance/AppearanceControlsWithStore";
3
+ export * from "./appearance/AppearanceMenu";
4
+ export * from "./appearance/ColorModeCircle";
5
+ export * from "./appearance/ThemePreviewCard";
6
+ export * from "./appearance/ThemeCircle";
3
7
  export * from "./box/Box";
4
8
  export * from "./card/Card";
9
+ export * from "./color";
5
10
  export * from "./content-loader/ContentLoader";
6
11
  export * from "./closeable-flash/CloseableFlash";
7
12
  export * from "./icons/CircleIcon";
8
- export * from "./overlay/Overlay";
13
+ export * from "./side-overlay/SideOverlay";
14
+ export * from "./sliding-panel/SlidingPanel";
9
15
  export * from "./slider/Slider";
10
16
  export * from "./logo";
11
17
  export * from "./appearance";
@@ -1,11 +1,17 @@
1
1
  export * from "./appearance/AppearanceControls";
2
2
  export * from "./appearance/AppearanceControlsWithStore";
3
+ export * from "./appearance/AppearanceMenu";
4
+ export * from "./appearance/ColorModeCircle";
5
+ export * from "./appearance/ThemePreviewCard";
6
+ export * from "./appearance/ThemeCircle";
3
7
  export * from "./box/Box";
4
8
  export * from "./card/Card";
9
+ export * from "./color";
5
10
  export * from "./content-loader/ContentLoader";
6
11
  export * from "./closeable-flash/CloseableFlash";
7
12
  export * from "./icons/CircleIcon";
8
- export * from "./overlay/Overlay";
13
+ export * from "./side-overlay/SideOverlay";
14
+ export * from "./sliding-panel/SlidingPanel";
9
15
  export * from "./slider/Slider";
10
16
  export * from "./logo";
11
17
  export * from "./appearance";
@@ -0,0 +1,20 @@
1
+ import { type SVGProps } from 'react';
2
+ import { type ThemeVariant } from '../../theme';
3
+ export interface AI2Props extends Omit<SVGProps<SVGSVGElement>, 'ref'> {
4
+ size?: number;
5
+ variant?: ThemeVariant;
6
+ colorMode?: 'light' | 'dark' | 'auto';
7
+ /** Colour of the "I" glyph. */
8
+ primaryColor?: string;
9
+ /** Colour of the "A" glyph. */
10
+ secondaryColor?: string;
11
+ }
12
+ /**
13
+ * Alternate AI glyph mark.
14
+ *
15
+ * A is rendered with an oblique left bar, a right vertical bar,
16
+ * and a horizontal crossbar.
17
+ * I is rendered as a simple vertical bar.
18
+ */
19
+ export declare const AI2: import("react").ForwardRefExoticComponent<AI2Props & import("react").RefAttributes<SVGSVGElement>>;
20
+ export default AI2;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2023-2026 Datalayer, Inc.
4
+ * Distributed under the terms of the Modified BSD License.
5
+ */
6
+ import { forwardRef } from 'react';
7
+ import { getLogoColors } from './DatalayerLogo';
8
+ /**
9
+ * Alternate AI glyph mark.
10
+ *
11
+ * A is rendered with an oblique left bar, a right vertical bar,
12
+ * and a horizontal crossbar.
13
+ * I is rendered as a simple vertical bar.
14
+ */
15
+ export const AI2 = forwardRef(function AI2({ size = 24, variant = 'datalayer', colorMode = 'light', primaryColor, secondaryColor, ...svgProps }, ref) {
16
+ const themed = getLogoColors(variant, colorMode);
17
+ const resolvedPrimary = primaryColor ?? themed.primary;
18
+ const resolvedSecondary = secondaryColor ?? themed.textColor;
19
+ const barWidth = 3.1;
20
+ const leftBarBottomInnerX = -2.2 + barWidth;
21
+ return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "-2.2 0 26.2 24", width: size, height: size, role: "img", "aria-label": "AI2", ref: ref, ...svgProps, children: [_jsx("path", { d: `M15.35 3.5h${barWidth}V20h-${barWidth}z`, fill: resolvedPrimary }), _jsx("path", { d: `M-2.2 20 9.8 3.5h${barWidth}L${leftBarBottomInnerX} 20H-2.2z`, fill: resolvedSecondary }), _jsx("path", { d: `M10.35 3.5h${barWidth}V20h-${barWidth}z`, fill: resolvedSecondary }), _jsx("path", { d: "M3.5 12.95h9.6v2.75H3.5z", fill: resolvedSecondary })] }));
22
+ });
23
+ export default AI2;
@@ -0,0 +1,19 @@
1
+ import { type SVGProps } from 'react';
2
+ import { type ThemeVariant } from '../../theme';
3
+ export interface DIProps extends Omit<SVGProps<SVGSVGElement>, 'ref'> {
4
+ size?: number;
5
+ variant?: ThemeVariant;
6
+ colorMode?: 'light' | 'dark' | 'auto';
7
+ /** Colour of the "I" glyph. */
8
+ primaryColor?: string;
9
+ /** Colour of the "D" glyph. */
10
+ secondaryColor?: string;
11
+ }
12
+ /**
13
+ * DI glyph mark.
14
+ *
15
+ * Uses the same public API and semantic color mapping as AI:
16
+ * primaryColor styles the "I", secondaryColor styles the "D".
17
+ */
18
+ export declare const DI: import("react").ForwardRefExoticComponent<DIProps & import("react").RefAttributes<SVGSVGElement>>;
19
+ export default DI;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2023-2026 Datalayer, Inc.
4
+ * Distributed under the terms of the Modified BSD License.
5
+ */
6
+ import { forwardRef } from 'react';
7
+ import { getLogoColors } from './DatalayerLogo';
8
+ /**
9
+ * DI glyph mark.
10
+ *
11
+ * Uses the same public API and semantic color mapping as AI:
12
+ * primaryColor styles the "I", secondaryColor styles the "D".
13
+ */
14
+ export const DI = forwardRef(function DI({ size = 24, variant = 'datalayer', colorMode = 'light', primaryColor, secondaryColor, ...svgProps }, ref) {
15
+ const themed = getLogoColors(variant, colorMode);
16
+ const resolvedPrimary = primaryColor ?? themed.primary;
17
+ const resolvedSecondary = secondaryColor ?? themed.textColor;
18
+ return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", width: size, height: size, role: "img", "aria-label": "DI", ref: ref, ...svgProps, children: [_jsx("path", { d: "M2 3.932H5V20.068075H2ZM3.5 3.932H6.5L12.933 20.068075H9.933ZM2 17.068075H11.4V20.068075H2Z", fill: resolvedSecondary, strokeWidth: 0.25 }), _jsx("path", { d: "m10.788825 3.932 6.43325 16.136075h3.5279L14.316725 3.932H10.788825Z", fill: resolvedPrimary, strokeWidth: 0.25 })] }));
19
+ });
20
+ export default DI;
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  * Distributed under the terms of the Modified BSD License.
5
5
  */
6
6
  import { forwardRef, useId } from 'react';
7
- import { datalayerColors, spatialColors, lovelyColors, matrixColors, earthColors, } from '../../theme';
7
+ import { datalayerColors, spatialColors, lovelyColors, matrixColors, earthColors, sandColors, ivoryColors, sunColors, } from '../../theme';
8
8
  /**
9
9
  * Gradient pattern derived from the original brand logo SVG:
10
10
  * - Left bars: accent → brand (bright → mid)
@@ -93,6 +93,54 @@ export const THEME_LOGO_COLORS = {
93
93
  secondaryGradient: [earthColors.oceanHover, earthColors.oceanAccent],
94
94
  },
95
95
  },
96
+ sand: {
97
+ light: {
98
+ primary: sandColors.sandBrand,
99
+ secondary: sandColors.sandText,
100
+ textColor: sandColors.gray,
101
+ primaryGradient: [sandColors.sandAccent, sandColors.sandBrand],
102
+ secondaryGradient: [sandColors.sandHover, sandColors.sandText],
103
+ },
104
+ dark: {
105
+ primary: sandColors.sandBright,
106
+ secondary: sandColors.sandAccent,
107
+ textColor: sandColors.gray,
108
+ primaryGradient: [sandColors.sandBright, sandColors.sandBrand],
109
+ secondaryGradient: [sandColors.sandHover, sandColors.sandAccent],
110
+ },
111
+ },
112
+ ivory: {
113
+ light: {
114
+ primary: ivoryColors.ivoryBrand,
115
+ secondary: ivoryColors.ivoryText,
116
+ textColor: ivoryColors.gray,
117
+ primaryGradient: [ivoryColors.ivoryAccent, ivoryColors.ivoryBrand],
118
+ secondaryGradient: [ivoryColors.ivoryHover, ivoryColors.ivoryText],
119
+ },
120
+ dark: {
121
+ primary: ivoryColors.ivoryBright,
122
+ secondary: ivoryColors.ivoryAccent,
123
+ textColor: ivoryColors.gray,
124
+ primaryGradient: [ivoryColors.ivoryBright, ivoryColors.ivoryBrand],
125
+ secondaryGradient: [ivoryColors.ivoryHover, ivoryColors.ivoryAccent],
126
+ },
127
+ },
128
+ sun: {
129
+ light: {
130
+ primary: sunColors.sunBrand,
131
+ secondary: sunColors.sunText,
132
+ textColor: sunColors.gray,
133
+ primaryGradient: [sunColors.sunAccent, sunColors.sunBrand],
134
+ secondaryGradient: [sunColors.sunHover, sunColors.sunText],
135
+ },
136
+ dark: {
137
+ primary: sunColors.sunBright,
138
+ secondary: sunColors.sunAccent,
139
+ textColor: sunColors.gray,
140
+ primaryGradient: [sunColors.sunBright, sunColors.sunBrand],
141
+ secondaryGradient: [sunColors.sunHover, sunColors.sunAccent],
142
+ },
143
+ },
96
144
  };
97
145
  export function getLogoColors(variant = 'datalayer', colorMode = 'light') {
98
146
  const mode = colorMode === 'auto' ? 'light' : colorMode;
@@ -1,4 +1,6 @@
1
1
  export * from './AI';
2
+ export * from './AI2';
3
+ export * from './DI';
2
4
  export * from './DatalayerLogo';
3
5
  export * from './DatalayerLogoText';
4
6
  export * from './DatalayerText';
@@ -1,4 +1,6 @@
1
1
  export * from './AI';
2
+ export * from './AI2';
3
+ export * from './DI';
2
4
  export * from './DatalayerLogo';
3
5
  export * from './DatalayerLogoText';
4
6
  export * from './DatalayerText';
@@ -1,4 +1,4 @@
1
- export interface OverlayProps {
1
+ export interface SideOverlayProps {
2
2
  closeButtonRef?: React.RefObject<HTMLButtonElement>;
3
3
  content: JSX.Element;
4
4
  direction?: 'left' | 'right';
@@ -9,5 +9,5 @@ export interface OverlayProps {
9
9
  width?: number | string;
10
10
  zIndex?: number;
11
11
  }
12
- export declare const Overlay: ({ width, direction, zIndex, ...rest }: OverlayProps) => import("react/jsx-runtime").JSX.Element;
13
- export default Overlay;
12
+ export declare const SideOverlay: ({ width, direction, zIndex, ...rest }: SideOverlayProps) => import("react/jsx-runtime").JSX.Element;
13
+ export default SideOverlay;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
- import { IconButton, Overlay as PrimerOverlay, BaseStyles, ThemeProvider, useTheme } from "@primer/react";
3
+ import { IconButton, Overlay as PrimerOverlay, ThemeProvider, useTheme } from "@primer/react";
4
4
  import { XIcon } from "@primer/octicons-react";
5
5
  import { Box } from '../box/Box';
6
6
  const PrimerAddonOverlay = (props) => {
@@ -25,19 +25,19 @@ const PrimerAddonOverlay = (props) => {
25
25
  }
26
26
  closeOverlay();
27
27
  };
28
- const overlayContent = (_jsx(ThemeProvider, { theme: theme, colorMode: colorMode, children: _jsx(BaseStyles, { children: _jsxs(Box, { sx: {
29
- /* We need to remove the padding */
30
- height: `calc(100vh - ${top}px - 8px)`,
31
- width,
32
- display: 'flex',
33
- flexDirection: 'column',
34
- alignItems: 'center',
35
- padding: '4px'
36
- }, children: [_jsx(Box, { sx: {
37
- display: 'flex',
38
- justifyContent: 'right',
39
- width: '100%'
40
- }, children: _jsx(IconButton, { variant: 'invisible', ref: closeButtonRef, onClick: closeOverlay, icon: XIcon, "aria-labelledby": "close" }) }), content] }) }) }));
28
+ const overlayContent = (_jsx(ThemeProvider, { theme: theme, colorMode: colorMode, children: _jsxs(Box, { sx: {
29
+ /* We need to remove the padding */
30
+ height: `calc(100vh - ${top}px - 8px)`,
31
+ width,
32
+ display: 'flex',
33
+ flexDirection: 'column',
34
+ alignItems: 'center',
35
+ padding: '4px'
36
+ }, children: [_jsx(Box, { sx: {
37
+ display: 'flex',
38
+ justifyContent: 'right',
39
+ width: '100%'
40
+ }, children: _jsx(IconButton, { variant: 'invisible', ref: closeButtonRef, onClick: closeOverlay, icon: XIcon, "aria-label": "Close" }) }), content] }) }));
41
41
  return (closeButtonRef && openButtonRef ?
42
42
  _jsx(_Fragment, { children: isOpen ?
43
43
  direction === 'left' ?
@@ -48,7 +48,7 @@ const PrimerAddonOverlay = (props) => {
48
48
  :
49
49
  _jsx(_Fragment, {}));
50
50
  };
51
- export const Overlay = ({ width = '500px', direction = 'left', zIndex = 100, ...rest }) => {
51
+ export const SideOverlay = ({ width = '500px', direction = 'left', zIndex = 100, ...rest }) => {
52
52
  return (_jsx(PrimerAddonOverlay, { width: width, direction: direction, zIndex: zIndex, ...rest }));
53
53
  };
54
- export default Overlay;
54
+ export default SideOverlay;
@@ -0,0 +1,16 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ import { SideOverlayProps } from '../..';
3
+ declare const meta: {
4
+ title: string;
5
+ component: ({ width, direction, zIndex, ...rest }: SideOverlayProps) => import("react/jsx-runtime").JSX.Element;
6
+ tags: string[];
7
+ parameters: {
8
+ layout: string;
9
+ };
10
+ };
11
+ export default meta;
12
+ type Story = StoryObj<typeof meta>;
13
+ export declare const SideOverlayDayLeft: Story;
14
+ export declare const SideOverlayDayRight: Story;
15
+ export declare const SideOverlayNightLeft: Story;
16
+ export declare const SideOverlayNightRight: Story;
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState, useRef } from "react";
3
3
  import { Heading, Text, Box, Button } from "@primer/react";
4
- import { Overlay } from '../..';
4
+ import { SideOverlay } from '../..';
5
5
  const meta = {
6
- title: 'Components/Overlay',
7
- component: Overlay,
6
+ title: 'Components/SideOverlay',
7
+ component: SideOverlay,
8
8
  // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
9
9
  tags: ['autodocs'],
10
10
  parameters: {
@@ -13,42 +13,42 @@ const meta = {
13
13
  },
14
14
  };
15
15
  export default meta;
16
- const ThemedOverlay = (props) => {
16
+ const ThemedSideOverlay = (props) => {
17
17
  const [isOpen, setIsOpen] = useState(false);
18
18
  const openButtonRef = useRef(null);
19
19
  const closeButtonRef = useRef(null);
20
20
  const headingRef = useRef(null);
21
- return (_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(Overlay, { ...props, isOpen: isOpen, setIsOpen: setIsOpen, openButtonRef: openButtonRef, closeButtonRef: closeButtonRef })] })] }) }));
21
+ return (_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, { ...props, isOpen: isOpen, setIsOpen: setIsOpen, openButtonRef: openButtonRef, closeButtonRef: closeButtonRef })] })] }) }));
22
22
  };
23
- export const OverlayDayLeft = {
23
+ export const SideOverlayDayLeft = {
24
24
  args: {
25
25
  content: _jsx(Text, { children: "\uD83D\uDC48 Look, left aligned, no heading." }),
26
26
  direction: "left",
27
27
  width: '500px',
28
28
  },
29
- render: (args) => _jsx(ThemedOverlay, { ...args, colorMode: "day" })
29
+ render: (args) => _jsx(ThemedSideOverlay, { ...args, colorMode: "day" })
30
30
  };
31
- export const OverlayDayRight = {
31
+ export const SideOverlayDayRight = {
32
32
  args: {
33
33
  content: _jsx(Text, { children: "Look, right aligned, on heading \uD83D\uDC49" }),
34
34
  direction: "right",
35
35
  width: '500px',
36
36
  },
37
- render: (args) => _jsx(ThemedOverlay, { ...args, colorMode: "day" })
37
+ render: (args) => _jsx(ThemedSideOverlay, { ...args, colorMode: "day" })
38
38
  };
39
- export const OverlayNightLeft = {
39
+ export const SideOverlayNightLeft = {
40
40
  args: {
41
41
  content: _jsx(Text, { children: "\uD83D\uDC48 Look, left aligned, no heading." }),
42
42
  direction: "left",
43
43
  width: '300px',
44
44
  },
45
- render: (args) => _jsx(ThemedOverlay, { ...args, colorMode: "night" })
45
+ render: (args) => _jsx(ThemedSideOverlay, { ...args, colorMode: "night" })
46
46
  };
47
- export const OverlayNightRight = {
47
+ export const SideOverlayNightRight = {
48
48
  args: {
49
49
  content: _jsx(Text, { children: "Look, right aligned, on heading \uD83D\uDC49" }),
50
50
  direction: "right",
51
51
  width: '300px',
52
52
  },
53
- render: (args) => _jsx(ThemedOverlay, { ...args, colorMode: "night" })
53
+ render: (args) => _jsx(ThemedSideOverlay, { ...args, colorMode: "night" })
54
54
  };
@@ -17,7 +17,8 @@ export const Slider = ({ name = "slider", id = "slider", min = 0, max = 10, valu
17
17
  const sliderStyle = {
18
18
  width,
19
19
  ...(orientation === "vertical" ? { transform: "rotate(-90deg)" } : {}),
20
- colorScheme: colorMode == 'day' ? 'light' : 'dark'
20
+ colorScheme: colorMode == 'day' ? 'light' : 'dark',
21
+ accentColor: 'var(--fgColor-accent)',
21
22
  };
22
23
  return (_jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx("input", { type: "range", id: id, name: name, min: min, max: max, value: sliderVal, step: step ?? "any", list: "slider-markers", style: sliderStyle, onChange: handleSliderChange, disabled: disabled }), markers && step && (_jsx("datalist", { id: "slider-markers", children: Array.from({ length: Math.floor((max - min) / step) + 1 }, (_, i) => min + i * step).map((e) => (
23
24
  // TODO: Supply markers as array and show them here
@@ -0,0 +1,19 @@
1
+ import { type ReactNode } from 'react';
2
+ export type SlidingPanelPosition = 'north' | 'south' | 'west' | 'east';
3
+ export type SlidingPanelVariant = 'default' | 'info' | 'success' | 'warning' | 'error' | 'danger';
4
+ export interface SlidingPanelProps {
5
+ isOpen: boolean;
6
+ message: ReactNode;
7
+ details?: ReactNode;
8
+ onDismiss?: () => void;
9
+ position?: SlidingPanelPosition;
10
+ variant?: SlidingPanelVariant;
11
+ durationMs?: number;
12
+ transitionMs?: number;
13
+ zIndex?: number;
14
+ offset?: number;
15
+ panelSize?: number | string;
16
+ fullWidth?: boolean;
17
+ }
18
+ export declare const SlidingPanel: ({ isOpen, message, details, onDismiss, position, variant, durationMs, transitionMs, zIndex, offset, panelSize, fullWidth, }: SlidingPanelProps) => import("react/jsx-runtime").JSX.Element | null;
19
+ export default SlidingPanel;