@datalayer/primer-addons 1.0.21 → 1.0.23
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 +14 -0
- package/lib/components/appearance/AppearanceMenuWithStore.d.ts +26 -0
- package/lib/components/appearance/AppearanceMenuWithStore.js +21 -0
- package/lib/components/appearance/CollaboratorPalette.d.ts +65 -0
- package/lib/components/appearance/CollaboratorPalette.js +160 -0
- package/lib/components/appearance/index.d.ts +2 -0
- package/lib/components/appearance/index.js +2 -0
- package/lib/components/box/Box.d.ts +17 -5
- package/lib/components/box/Box.js +4 -7
- package/lib/components/box/sx.js +1 -2
- package/lib/components/calendar-picker/CalendarPicker.d.ts +35 -0
- package/lib/components/calendar-picker/CalendarPicker.js +146 -0
- package/lib/components/calendar-picker/index.d.ts +1 -0
- package/lib/components/calendar-picker/index.js +5 -0
- package/lib/components/card/Card.d.ts +6 -1
- package/lib/components/card/Card.js +1 -1
- package/lib/components/closeable-flash/CloseableFlash.d.ts +23 -1
- package/lib/components/closeable-flash/CloseableFlash.js +52 -4
- package/lib/components/color/ColorSwatch.d.ts +1 -1
- package/lib/components/color-picker/ColorPicker.d.ts +97 -0
- package/lib/components/color-picker/ColorPicker.js +358 -0
- package/lib/components/color-picker/index.d.ts +1 -0
- package/lib/components/color-picker/index.js +5 -0
- package/lib/components/content-loader/ContentLoader.d.ts +1 -1
- package/lib/components/content-loader/ContentLoader.js +4 -0
- package/lib/components/content-loader/ContentLoader.stories.d.ts +1 -1
- package/lib/components/date-picker/DatePicker.d.ts +81 -0
- package/lib/components/date-picker/DatePicker.js +204 -0
- package/lib/components/date-picker/TimeColumns.d.ts +23 -0
- package/lib/components/date-picker/TimeColumns.js +88 -0
- package/lib/components/date-picker/index.d.ts +1 -0
- package/lib/components/date-picker/index.js +5 -0
- package/lib/components/icons/CircleIcon.d.ts +1 -1
- package/lib/components/icons/CircleIcon.js +4 -0
- package/lib/components/icons/CircleIcon.stories.d.ts +1 -1
- package/lib/components/index.d.ts +5 -0
- package/lib/components/index.js +9 -0
- package/lib/components/logo/DatalayerText.d.ts +1 -1
- package/lib/components/logo/index.d.ts +0 -1
- package/lib/components/logo/index.js +4 -1
- package/lib/components/side-overlay/SideOverlay.d.ts +5 -5
- package/lib/components/side-overlay/SideOverlay.js +4 -0
- package/lib/components/side-overlay/SideOverlay.stories.d.ts +1 -1
- package/lib/components/side-overlay/SideOverlay.stories.js +4 -0
- package/lib/components/slider/Slider.d.ts +1 -1
- package/lib/components/slider/Slider.js +4 -0
- package/lib/components/slider/Slider.stories.d.ts +1 -1
- package/lib/components/slider/Slider.stories.js +4 -0
- package/lib/components/sliding-panel/SlidingPanel.d.ts +1 -1
- package/lib/components/sliding-panel/SlidingPanel.js +17 -1
- package/lib/components/sliding-panel/SlidingPanel.stories.d.ts +1 -1
- package/lib/components/sliding-panel/SlidingPanel.stories.js +4 -0
- package/lib/components/toolbar/Toolbar.d.ts +2 -2
- package/lib/components/toolbar/Toolbar.js +0 -0
- package/lib/components/toolbar/ToolbarButton.d.ts +3 -1
- package/lib/components/toolbar/ToolbarButton.js +54 -22
- package/lib/components/toolbar/ToolbarDivider.d.ts +1 -1
- package/lib/components/toolbar/ToolbarDropdown.d.ts +3 -3
- package/lib/components/toolbar/ToolbarDropdown.js +66 -35
- package/lib/components/toolbar/ToolbarRenderer.d.ts +20 -3
- package/lib/components/toolbar/ToolbarRenderer.js +16 -16
- package/lib/components/toolbar/types.d.ts +8 -8
- package/lib/index.js +4 -0
- package/lib/reactor/AppearancePlugin.d.ts +31 -0
- package/lib/reactor/AppearancePlugin.js +63 -0
- package/lib/reactor/ThemePlugin.d.ts +5 -0
- package/lib/reactor/ThemePlugin.js +98 -0
- package/lib/reactor/index.d.ts +30 -0
- package/lib/reactor/index.js +34 -0
- package/lib/reactor/page-layout/PageLayout.d.ts +148 -0
- package/lib/reactor/page-layout/PageLayout.js +326 -0
- package/lib/reactor/page-layout/PageLayoutPlugin.d.ts +59 -0
- package/lib/reactor/page-layout/PageLayoutPlugin.js +105 -0
- package/lib/reactor/page-layout/PagePanelToggle.d.ts +21 -0
- package/lib/reactor/page-layout/PagePanelToggle.js +29 -0
- package/lib/reactor/page-layout/SlotPageLayout.d.ts +36 -0
- package/lib/reactor/page-layout/SlotPageLayout.js +25 -0
- package/lib/reactor/page-layout/panelState.d.ts +28 -0
- package/lib/reactor/page-layout/panelState.js +49 -0
- package/lib/story-helpers.d.ts +2 -2
- package/lib/theme/DatalayerBrandThemeProvider.d.ts +1 -1
- package/lib/theme/DatalayerThemeProvider.d.ts +5 -5
- package/lib/theme/DatalayerThemeProvider.js +119 -58
- package/lib/theme/css/createThemeCSSVars.d.ts +1 -0
- package/lib/theme/css/createThemeCSSVars.js +9 -0
- package/lib/theme/fontStacks.d.ts +2 -0
- package/lib/theme/fontStacks.js +6 -0
- package/lib/theme/index.d.ts +2 -0
- package/lib/theme/index.js +2 -0
- package/lib/theme/palettes/ColorPalette.d.ts +3 -3
- package/lib/theme/palettes/ColorPalette.js +1 -2
- package/lib/theme/palettes/index.js +1 -2
- package/lib/theme/portableTheme.d.ts +32 -0
- package/lib/theme/portableTheme.js +45 -0
- package/lib/utils/Helper.d.ts +2 -2
- package/lib/utils/Portals.js +3 -1
- package/lib/utils/Styles.d.ts +1 -1
- package/package.json +21 -14
- package/lib/components/logo/DI.d.ts +0 -19
- package/lib/components/logo/DI.js +0 -20
|
@@ -21,12 +21,12 @@ export declare function getColorPalette(theme?: ThemeVariant, colorMode?: 'light
|
|
|
21
21
|
export declare function useColorPalette(): ColorPalette;
|
|
22
22
|
/** @deprecated Use `useColorPalette` instead. */
|
|
23
23
|
export declare const useBlogColorPalette: typeof useColorPalette;
|
|
24
|
-
export declare const LightBoostFilter: () => import("react
|
|
24
|
+
export declare const LightBoostFilter: () => import("react").JSX.Element;
|
|
25
25
|
export declare const SharedDefs: ({ p }: {
|
|
26
26
|
p: ColorPalette;
|
|
27
|
-
}) => import("react
|
|
27
|
+
}) => import("react").JSX.Element;
|
|
28
28
|
export declare const svgLightFilter: (p: ColorPalette) => "url(#svgLightBoost)" | undefined;
|
|
29
29
|
export declare const BgGrid: ({ w, h }: {
|
|
30
30
|
w?: number;
|
|
31
31
|
h?: number;
|
|
32
|
-
}) => import("react
|
|
32
|
+
}) => import("react").JSX.Element;
|
|
@@ -1,8 +1,7 @@
|
|
|
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
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ColorMode } from './DatalayerBrandThemeProvider';
|
|
2
|
+
import { type ThemeVariant } from './themeRegistry';
|
|
3
|
+
/** A valid CSS custom-property name. */
|
|
4
|
+
export type CssVariableName = `--${string}`;
|
|
5
|
+
/**
|
|
6
|
+
* A JSON-safe CSS-variable map.
|
|
7
|
+
*
|
|
8
|
+
* Theme values retain Primer's canonical functional and component token names
|
|
9
|
+
* (`--bgColor-*`, `--fgColor-*`, `--button-*`, and so on), allowing consumers
|
|
10
|
+
* to use the map without depending on React, styled-components, or Primer.
|
|
11
|
+
*/
|
|
12
|
+
export type CssVariableMap = Record<CssVariableName, string>;
|
|
13
|
+
/** A portable theme with explicit light and dark CSS-variable modes. */
|
|
14
|
+
export interface PortableTheme {
|
|
15
|
+
id: ThemeVariant;
|
|
16
|
+
label: string;
|
|
17
|
+
description: string;
|
|
18
|
+
defaultColorMode: ColorMode;
|
|
19
|
+
modes: {
|
|
20
|
+
light: CssVariableMap;
|
|
21
|
+
dark: CssVariableMap;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Export a Primer Addons theme as a framework-neutral, JSON-safe token map.
|
|
26
|
+
*
|
|
27
|
+
* Framework adapters should consume these canonical CSS variables directly
|
|
28
|
+
* instead of translating them into framework-specific color names.
|
|
29
|
+
*/
|
|
30
|
+
export declare function exportPortableTheme(variant: ThemeVariant): PortableTheme;
|
|
31
|
+
/** Serialize a trusted portable map for a CSS declaration block. */
|
|
32
|
+
export declare function cssVariableDeclarations(tokens: CssVariableMap): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import { systemFontStack } from './fontStacks';
|
|
6
|
+
import { themeConfigs } from './themeRegistry';
|
|
7
|
+
function cssVariables(styles) {
|
|
8
|
+
const variables = Object.fromEntries(Object.entries(styles)
|
|
9
|
+
.filter(([name, value]) => name.startsWith('--') && value !== undefined && value !== null)
|
|
10
|
+
.map(([name, value]) => [name, String(value)]));
|
|
11
|
+
const fontFamily = variables['--fontStack-sansSerif'] ??
|
|
12
|
+
styles.fontFamily ??
|
|
13
|
+
systemFontStack;
|
|
14
|
+
return {
|
|
15
|
+
'--fontStack-sansSerif': fontFamily,
|
|
16
|
+
'--fontStack-sansSerifDisplay': fontFamily,
|
|
17
|
+
'--fontStack-system': fontFamily,
|
|
18
|
+
...variables,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Export a Primer Addons theme as a framework-neutral, JSON-safe token map.
|
|
23
|
+
*
|
|
24
|
+
* Framework adapters should consume these canonical CSS variables directly
|
|
25
|
+
* instead of translating them into framework-specific color names.
|
|
26
|
+
*/
|
|
27
|
+
export function exportPortableTheme(variant) {
|
|
28
|
+
const config = themeConfigs[variant];
|
|
29
|
+
return {
|
|
30
|
+
id: variant,
|
|
31
|
+
label: config.label,
|
|
32
|
+
description: config.description,
|
|
33
|
+
defaultColorMode: config.defaultColorMode,
|
|
34
|
+
modes: {
|
|
35
|
+
light: cssVariables(config.themeStyles.light),
|
|
36
|
+
dark: cssVariables(config.themeStyles.dark),
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Serialize a trusted portable map for a CSS declaration block. */
|
|
41
|
+
export function cssVariableDeclarations(tokens) {
|
|
42
|
+
return Object.entries(tokens)
|
|
43
|
+
.map(([name, value]) => `${name}:${value}`)
|
|
44
|
+
.join(';');
|
|
45
|
+
}
|
package/lib/utils/Helper.d.ts
CHANGED
|
@@ -6,12 +6,12 @@ import type { AnimateProps } from '@primer/react-brand';
|
|
|
6
6
|
export declare const Container: ({ children, style, }: {
|
|
7
7
|
children: React.ReactElement[] | React.ReactElement;
|
|
8
8
|
style?: React.CSSProperties;
|
|
9
|
-
}) =>
|
|
9
|
+
}) => React.JSX.Element;
|
|
10
10
|
type RedlineBackgroundProps = {
|
|
11
11
|
height?: number;
|
|
12
12
|
hasBorder?: boolean;
|
|
13
13
|
};
|
|
14
|
-
export declare function RedlineBackground({ height, hasBorder, ...rest }: PropsWithChildren<RedlineBackgroundProps>):
|
|
14
|
+
export declare function RedlineBackground({ height, hasBorder, ...rest }: PropsWithChildren<RedlineBackgroundProps>): React.JSX.Element;
|
|
15
15
|
/**
|
|
16
16
|
* Base Types
|
|
17
17
|
*
|
package/lib/utils/Portals.js
CHANGED
|
@@ -119,7 +119,9 @@ export const setupPrimerPortals = (colormode) => {
|
|
|
119
119
|
* `setupPrimerPortals` creates it; before that call there is none, and this
|
|
120
120
|
* answers `null` rather than inventing one.
|
|
121
121
|
*/
|
|
122
|
-
export const getPrimerPortalRoot = () => document
|
|
122
|
+
export const getPrimerPortalRoot = () => typeof document === 'undefined'
|
|
123
|
+
? null
|
|
124
|
+
: document.getElementById(PRIMER_PORTAL_ROOT_ID);
|
|
123
125
|
/* ─── camelCase → kebab-case ─────────────────────────────────────────── */
|
|
124
126
|
const camelToKebab = (s) => s.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
125
127
|
/**
|
package/lib/utils/Styles.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const Styles: () => import("react
|
|
1
|
+
export declare const Styles: () => import("react").JSX.Element;
|
|
2
2
|
export default Styles;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/primer-addons",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run build:lib",
|
|
@@ -33,16 +33,23 @@
|
|
|
33
33
|
"homepage": "https://primer-addons.datalayer.tech",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@datalayer/icons-react": "^1.0.0",
|
|
36
|
-
"@
|
|
36
|
+
"@datalayer/reactor": "^1.0.0",
|
|
37
|
+
"@primer/octicons-react": "^19.35.0",
|
|
37
38
|
"@primer/primitives": "^10.7.0",
|
|
38
39
|
"@primer/react": "^37.31.0",
|
|
39
|
-
"react": "^
|
|
40
|
-
"react-dom": "^18.3.1 || ^19.0.0",
|
|
40
|
+
"@primer/react-brand": "^0.58.2",
|
|
41
41
|
"react-loading-skeleton": "^3.5.0",
|
|
42
42
|
"styled-components": "^5.3.10",
|
|
43
43
|
"zustand": "^5.0.0"
|
|
44
44
|
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"react": "^18.3.1 || ^19.0.0",
|
|
47
|
+
"react-dom": "^18.3.1 || ^19.0.0"
|
|
48
|
+
},
|
|
45
49
|
"devDependencies": {
|
|
50
|
+
"react": "19.2.8",
|
|
51
|
+
"react-dom": "19.2.8",
|
|
52
|
+
"rimraf": "^6.0.1",
|
|
46
53
|
"@storybook/addon-docs": "^9.0.15",
|
|
47
54
|
"@storybook/addon-essentials": "9.0.0-alpha.12",
|
|
48
55
|
"@storybook/addon-interactions": "^9.0.0-alpha.10",
|
|
@@ -52,21 +59,21 @@
|
|
|
52
59
|
"@storybook/react-vite": "^9.0.15",
|
|
53
60
|
"@storybook/testing-library": "^0.2.2",
|
|
54
61
|
"@types/prettier": "^3.0.0",
|
|
55
|
-
"@types/react": "
|
|
56
|
-
"@types/react-dom": "
|
|
62
|
+
"@types/react": "19.2.18",
|
|
63
|
+
"@types/react-dom": "19.2.5",
|
|
57
64
|
"@types/styled-components": "^5.1.34",
|
|
58
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
59
|
-
"@typescript-eslint/parser": "^8.
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^8.69.0",
|
|
66
|
+
"@typescript-eslint/parser": "^8.69.0",
|
|
60
67
|
"@vitejs/plugin-react": "^4.5.2",
|
|
61
68
|
"crypto-browserify": "^3.12.0",
|
|
62
|
-
"eslint": "^9.
|
|
63
|
-
"eslint-plugin-react-hooks": "^
|
|
64
|
-
"eslint-plugin-react-refresh": "^0.
|
|
65
|
-
"eslint-plugin-storybook": "^
|
|
69
|
+
"eslint": "^10.9.1",
|
|
70
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
71
|
+
"eslint-plugin-react-refresh": "^0.5.5",
|
|
72
|
+
"eslint-plugin-storybook": "^10.5.10",
|
|
66
73
|
"prettier": "^3.3.2",
|
|
67
74
|
"prop-types": "^15.8.1",
|
|
68
75
|
"storybook": "^9.0.15",
|
|
69
|
-
"typescript": "
|
|
70
|
-
"vite": "
|
|
76
|
+
"typescript": "5.9.3",
|
|
77
|
+
"vite": "7.3.6"
|
|
71
78
|
}
|
|
72
79
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
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;
|
|
@@ -1,20 +0,0 @@
|
|
|
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;
|