@datalayer/primer-addons 1.0.3 → 1.0.4
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/lib/components/index.d.ts +7 -0
- package/lib/components/index.js +7 -0
- package/lib/index.d.ts +2 -7
- package/lib/index.js +2 -7
- package/lib/utils/Helper.d.ts +32 -0
- package/lib/utils/Helper.js +21 -0
- package/lib/utils/Portals.d.ts +10 -0
- package/lib/utils/Portals.js +23 -0
- package/lib/utils/Styles.d.ts +2 -0
- package/lib/utils/Styles.js +10 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./box/Box";
|
|
2
|
+
export * from "./card/Card";
|
|
3
|
+
export * from "./content-loader/ContentLoader";
|
|
4
|
+
export * from "./closeable-flash/CloseableFlash";
|
|
5
|
+
export * from "./icons/CircleIcon";
|
|
6
|
+
export * from "./overlay/Overlay";
|
|
7
|
+
export * from "./slider/Slider";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./box/Box";
|
|
2
|
+
export * from "./card/Card";
|
|
3
|
+
export * from "./content-loader/ContentLoader";
|
|
4
|
+
export * from "./closeable-flash/CloseableFlash";
|
|
5
|
+
export * from "./icons/CircleIcon";
|
|
6
|
+
export * from "./overlay/Overlay";
|
|
7
|
+
export * from "./slider/Slider";
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
export * from "./components
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./components/content-loader/ContentLoader";
|
|
4
|
-
export * from "./components/closeable-flash/CloseableFlash";
|
|
5
|
-
export * from "./components/icons/CircleIcon";
|
|
6
|
-
export * from "./components/overlay/Overlay";
|
|
7
|
-
export * from "./components/slider/Slider";
|
|
1
|
+
export * from "./components";
|
|
2
|
+
export * from "./utils";
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
export * from "./components
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./components/content-loader/ContentLoader";
|
|
4
|
-
export * from "./components/closeable-flash/CloseableFlash";
|
|
5
|
-
export * from "./components/icons/CircleIcon";
|
|
6
|
-
export * from "./components/overlay/Overlay";
|
|
7
|
-
export * from "./components/slider/Slider";
|
|
1
|
+
export * from "./components";
|
|
2
|
+
export * from "./utils";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { Ref, PropsWithChildren } from 'react';
|
|
2
|
+
import { AnimateProps } from '@primer/react-brand';
|
|
3
|
+
/**
|
|
4
|
+
* Layout
|
|
5
|
+
*/
|
|
6
|
+
export declare const Container: ({ children, style, }: {
|
|
7
|
+
children: React.ReactElement[] | React.ReactElement;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
type RedlineBackgroundProps = {
|
|
11
|
+
height?: number;
|
|
12
|
+
hasBorder?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function RedlineBackground({ height, hasBorder, ...rest }: PropsWithChildren<RedlineBackgroundProps>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* Base Types
|
|
17
|
+
*
|
|
18
|
+
* Component helper type to be extended by component types, e.g.:
|
|
19
|
+
* type CustomComponentProps = BaseProps<HTMLDivElement> & { ... }
|
|
20
|
+
*
|
|
21
|
+
* Example use:
|
|
22
|
+
* const CustomComponent = forwardRef<HTMLDivElement, CustomComponentProps>(({className, ...props}, ref) => { ... })
|
|
23
|
+
* // OR:
|
|
24
|
+
* const CustomComponent = forwardRef(({className: CustomComponentProps, ...props}, ref: Ref<HTMLDivElement>) => { ... })
|
|
25
|
+
*/
|
|
26
|
+
export type BaseProps<T> = {
|
|
27
|
+
className?: string;
|
|
28
|
+
id?: string;
|
|
29
|
+
ref?: Ref<T>;
|
|
30
|
+
animate?: AnimateProps;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Layout
|
|
4
|
+
*/
|
|
5
|
+
export const Container = ({ children, style, }) => (_jsx("div", { style: { maxWidth: 1024, margin: '0 auto', ...style }, children: children }));
|
|
6
|
+
export function RedlineBackground({ height, hasBorder = true, ...rest }) {
|
|
7
|
+
return (_jsx("div", { style: {
|
|
8
|
+
display: 'flex',
|
|
9
|
+
overflow: 'hidden',
|
|
10
|
+
border: hasBorder
|
|
11
|
+
? '1px solid var(--base-color-scale-red-2)'
|
|
12
|
+
: undefined,
|
|
13
|
+
backgroundImage: 'linear-gradient(45deg, var(--base-color-scale-red-0) 12.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 12.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 50%, var(--base-color-scale-red-0) 50%, var(--base-color-scale-red-0) 62.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 62.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 100%)',
|
|
14
|
+
backgroundSize: '5.66px 5.66px',
|
|
15
|
+
WebkitBoxPack: 'center',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
width: '100%',
|
|
19
|
+
height,
|
|
20
|
+
}, ...rest }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '@primer/react-brand/lib/css/main.css';
|
|
2
|
+
type Colormode = 'light' | 'dark' | 'auto';
|
|
3
|
+
/**
|
|
4
|
+
* Ensure we define a root for Primer portal root.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/primer/react/blob/main/packages/react/src/Portal/Portal.tsx#L23
|
|
7
|
+
* @see https://github.com/primer/react/blob/030fe020b48b7f12c2994c6614e5d4191fe764ee/src/Portal/Portal.tsx#L33
|
|
8
|
+
*/
|
|
9
|
+
export declare const setupPrimerPortals: (colormode?: Colormode) => void;
|
|
10
|
+
export default setupPrimerPortals;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import { registerPortalRoot } from '@primer/react';
|
|
6
|
+
import '@primer/react-brand/lib/css/main.css';
|
|
7
|
+
const PRIMER_PORTAL_ROOT_ID = '__primerPortalRoot__';
|
|
8
|
+
/**
|
|
9
|
+
* Ensure we define a root for Primer portal root.
|
|
10
|
+
*
|
|
11
|
+
* @see https://github.com/primer/react/blob/main/packages/react/src/Portal/Portal.tsx#L23
|
|
12
|
+
* @see https://github.com/primer/react/blob/030fe020b48b7f12c2994c6614e5d4191fe764ee/src/Portal/Portal.tsx#L33
|
|
13
|
+
*/
|
|
14
|
+
export const setupPrimerPortals = (colormode = 'light') => {
|
|
15
|
+
const body = document.body;
|
|
16
|
+
body.dataset['portalRoot'] = 'true';
|
|
17
|
+
body.dataset['colorMode'] = colormode;
|
|
18
|
+
body.dataset['lightTheme'] = 'light';
|
|
19
|
+
body.dataset['darkTheme'] = 'dark';
|
|
20
|
+
body.id = PRIMER_PORTAL_ROOT_ID;
|
|
21
|
+
registerPortalRoot(body);
|
|
22
|
+
};
|
|
23
|
+
export default setupPrimerPortals;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } 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 { ThemeProvider, BaseStyles } from '@primer/react';
|
|
7
|
+
export const Styles = () => {
|
|
8
|
+
return (_jsx(_Fragment, { children: _jsx(ThemeProvider, { children: _jsx(BaseStyles, {}) }) }));
|
|
9
|
+
};
|
|
10
|
+
export default Styles;
|