@datalayer/primer-addons 0.3.2 → 1.0.1
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 +2 -2
- package/lib/App.d.ts +9 -0
- package/lib/App.js +20 -4
- package/lib/components/card/Card.js +2 -2
- package/lib/components/card/{stories/Card.stories.d.ts → Card.stories.d.ts} +5 -6
- package/lib/components/card/{stories/Card.stories.js → Card.stories.js} +2 -2
- package/lib/components/closeable-flash/CloseableFlash.d.ts +1 -1
- package/lib/components/closeable-flash/CloseableFlash.js +2 -2
- package/lib/components/closeable-flash/{stories/CloseableFlash.stories.d.ts → CloseableFlash.stories.d.ts} +1 -2
- package/lib/components/closeable-flash/{stories/CloseableFlash.stories.js → CloseableFlash.stories.js} +1 -1
- package/lib/components/content-loader/{stories/ContentLoader.stories.d.ts → ContentLoader.stories.d.ts} +1 -1
- package/lib/components/content-loader/{stories/ContentLoader.stories.js → ContentLoader.stories.js} +1 -1
- package/lib/components/icons/{stories/CircleIcon.stories.d.ts → CircleIcon.stories.d.ts} +1 -1
- package/lib/components/icons/{stories/CircleIcon.stories.js → CircleIcon.stories.js} +1 -1
- package/lib/components/overlay/Overlay.d.ts +0 -1
- package/lib/components/overlay/Overlay.js +2 -2
- package/lib/components/overlay/{stories/Overlay.stories.d.ts → Overlay.stories.d.ts} +1 -1
- package/lib/components/overlay/{stories/Overlay.stories.js → Overlay.stories.js} +3 -5
- package/package.json +17 -15
package/README.md
CHANGED
package/lib/App.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import "@primer/primitives/dist/css/base/typography/typography.css";
|
|
2
|
+
import "@primer/primitives/dist/css/functional/themes/light.css";
|
|
3
|
+
import "@primer/primitives/dist/css/functional/size/border.css";
|
|
4
|
+
import "@primer/primitives/dist/css/functional/size/breakpoints.css";
|
|
5
|
+
import "@primer/primitives/dist/css/functional/size/size-coarse.css";
|
|
6
|
+
import "@primer/primitives/dist/css/functional/size/size-fine.css";
|
|
7
|
+
import "@primer/primitives/dist/css/functional/size/size.css";
|
|
8
|
+
import "@primer/primitives/dist/css/functional/size/viewport.css";
|
|
9
|
+
import "@primer/primitives/dist/css/functional/typography/typography.css";
|
|
1
10
|
import "./App.css";
|
|
2
11
|
declare const App: () => import("react/jsx-runtime").JSX.Element;
|
|
3
12
|
export default App;
|
package/lib/App.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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, Overlay } from ".";
|
|
7
|
+
import "@primer/primitives/dist/css/base/typography/typography.css";
|
|
8
|
+
import "@primer/primitives/dist/css/functional/themes/light.css";
|
|
9
|
+
import "@primer/primitives/dist/css/functional/size/border.css";
|
|
10
|
+
import "@primer/primitives/dist/css/functional/size/breakpoints.css";
|
|
11
|
+
import "@primer/primitives/dist/css/functional/size/size-coarse.css";
|
|
12
|
+
import "@primer/primitives/dist/css/functional/size/size-fine.css";
|
|
13
|
+
import "@primer/primitives/dist/css/functional/size/size.css";
|
|
14
|
+
import "@primer/primitives/dist/css/functional/size/viewport.css";
|
|
15
|
+
import "@primer/primitives/dist/css/functional/typography/typography.css";
|
|
4
16
|
import "./App.css";
|
|
5
17
|
const App = () => {
|
|
6
|
-
|
|
18
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
19
|
+
const openButtonRef = useRef(null);
|
|
20
|
+
const closeButtonRef = useRef(null);
|
|
21
|
+
const headingRef = useRef(null);
|
|
22
|
+
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(Overlay, { isOpen: isOpen, content: _jsxs(Text, { children: ["Look, I am an ", _jsx(Button, { children: "Overlay \uD83D\uDC49" })] }), setIsOpen: setIsOpen, openButtonRef: openButtonRef, closeButtonRef: closeButtonRef, headingRef: headingRef })] })] }) })] })] })] }) }));
|
|
7
23
|
};
|
|
8
24
|
export default App;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box,
|
|
2
|
+
import { Box, IconButton, Text } from "@primer/react";
|
|
3
3
|
const roundedVals = {
|
|
4
4
|
small: "3px",
|
|
5
5
|
medium: "6px",
|
|
@@ -35,7 +35,7 @@ export const Card = (props) => {
|
|
|
35
35
|
};
|
|
36
36
|
Card.Header = (props) => {
|
|
37
37
|
const { title, description, leadingVisual, action } = props;
|
|
38
|
-
return _jsxs(Box, { display: "flex", alignItems: "center", sx: { p: 3 }, children: [leadingVisual && _jsx(Box, { sx: { mr: 3 }, children: _jsx(
|
|
38
|
+
return _jsxs(Box, { display: "flex", alignItems: "center", sx: { p: 3 }, children: [leadingVisual && _jsx(Box, { sx: { mr: 3 }, children: _jsx(IconButton, { size: "medium", icon: leadingVisual, "aria-label": "" }) }), _jsxs(Box, { sx: { flexGrow: 1 }, children: [_jsx(Text, { display: "block", children: title }), _jsx(Text, { display: "block", color: "fg.muted", children: description })] }), action && _jsx(Box, { children: action })] });
|
|
39
39
|
};
|
|
40
40
|
Card.Image = ({ url, image, svg, height }) => {
|
|
41
41
|
return (_jsxs(Box, { display: "block", width: "100%", height: `${height}px`, backgroundImage: `url(${url})`, sx: {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { StoryObj } from '@storybook/react';
|
|
3
|
-
import { CardProps } from '
|
|
2
|
+
import { CardProps } from '../..';
|
|
4
3
|
declare const meta: {
|
|
5
4
|
title: string;
|
|
6
5
|
component: import("react").FC<CardProps> & {
|
|
7
|
-
Header:
|
|
8
|
-
Image:
|
|
9
|
-
Content:
|
|
10
|
-
Actions:
|
|
6
|
+
Header: React.FC<import("./Card").CardHeaderProps>;
|
|
7
|
+
Image: React.FC<import("./Card").CardImageProps>;
|
|
8
|
+
Content: React.FC<import("./Card").CardContentProps>;
|
|
9
|
+
Actions: React.FC<import("./Card").CardActionsProps>;
|
|
11
10
|
};
|
|
12
11
|
tags: string[];
|
|
13
12
|
parameters: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ThemeProvider, BaseStyles, Box, Button, IconButton, Text, ButtonGroup
|
|
3
|
-
import { Card } from '../../../index';
|
|
2
|
+
import { ThemeProvider, BaseStyles, Box, Button, IconButton, Text, ButtonGroup } from "@primer/react";
|
|
4
3
|
import { ProjectIcon, ThreeBarsIcon } from '@primer/octicons-react';
|
|
4
|
+
import { Card } from '../..';
|
|
5
5
|
const meta = {
|
|
6
6
|
title: 'Components/Card',
|
|
7
7
|
component: Card,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import { FlashProps } from "@primer/react";
|
|
3
3
|
export type CloseableFlashProps = FlashProps & {
|
|
4
|
-
leadingVisual?: React.
|
|
4
|
+
leadingVisual?: React.ComponentType;
|
|
5
5
|
onClose?: () => void;
|
|
6
6
|
};
|
|
7
7
|
export declare const CloseableFlash: FC<CloseableFlashProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import { Box, Flash,
|
|
3
|
+
import { Box, Flash, CircleOcticon, Text } from "@primer/react";
|
|
4
4
|
import { XIcon } from "@primer/octicons-react";
|
|
5
5
|
export const CloseableFlash = (props) => {
|
|
6
6
|
const { leadingVisual, variant, onClose, ...otherProps } = props;
|
|
@@ -14,5 +14,5 @@ export const CloseableFlash = (props) => {
|
|
|
14
14
|
if (!isVisible) {
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
|
-
return (_jsx(Flash, { variant: variant, ...otherProps, children: _jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [_jsxs(Box, { sx: { flexGrow: 1 }, children: [leadingVisual && _jsx(
|
|
17
|
+
return (_jsx(Flash, { variant: variant, ...otherProps, children: _jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [_jsxs(Box, { sx: { flexGrow: 1 }, children: [leadingVisual && _jsx(CircleOcticon, { icon: leadingVisual }), _jsx(Text, { color: `${variant === "default" ? "accent" : (variant === "warning" ? "attention" : variant)}.fg`, children: props.children })] }), _jsx(Box, { onClick: handleClose, sx: { cursor: "pointer" }, children: _jsx(XIcon, { size: 20 }) })] }) }));
|
|
18
18
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { StoryObj } from '@storybook/react';
|
|
3
|
-
import { CloseableFlashProps } from '
|
|
2
|
+
import { CloseableFlashProps } from '../..';
|
|
4
3
|
declare const meta: {
|
|
5
4
|
title: string;
|
|
6
5
|
component: import("react").FC<CloseableFlashProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ThemeProvider, BaseStyles, Box } from "@primer/react";
|
|
3
3
|
import { CheckIcon } from "@primer/octicons-react";
|
|
4
|
-
import { CloseableFlash } from '
|
|
4
|
+
import { CloseableFlash } from '../..';
|
|
5
5
|
const meta = {
|
|
6
6
|
title: 'Components/CloseableFlash',
|
|
7
7
|
component: CloseableFlash,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
import { ContentLoaderProps } from '
|
|
2
|
+
import { ContentLoaderProps } from '../..';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
5
|
component: (props: ContentLoaderProps) => import("react/jsx-runtime").JSX.Element;
|
package/lib/components/content-loader/{stories/ContentLoader.stories.js → ContentLoader.stories.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ThemeProvider, BaseStyles, Box } from "@primer/react";
|
|
3
|
-
import { ContentLoader } from '
|
|
3
|
+
import { ContentLoader } from '../..';
|
|
4
4
|
const meta = {
|
|
5
5
|
title: 'Components/ContentLoader',
|
|
6
6
|
component: ContentLoader,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
import { CircleIconProps } from '
|
|
2
|
+
import { CircleIconProps } from '../..';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
5
|
component: ({ color, variant, }: CircleIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ThemeProvider, BaseStyles, Box } from "@primer/react";
|
|
3
|
-
import { CircleIcon } from '
|
|
3
|
+
import { CircleIcon } from '../..';
|
|
4
4
|
const meta = {
|
|
5
5
|
title: 'Components/CircleIcon',
|
|
6
6
|
component: CircleIcon,
|
|
@@ -3,8 +3,8 @@ import { useEffect, useState } from 'react';
|
|
|
3
3
|
import { Box, IconButton, Overlay as PrimerOverlay } from "@primer/react";
|
|
4
4
|
import { XIcon } from "@primer/octicons-react";
|
|
5
5
|
const PrimerAddonOverlay = (props) => {
|
|
6
|
-
const { closeButtonRef, content, headingRef, isOpen, openButtonRef, setIsOpen, width, } = props;
|
|
7
|
-
const [direction, _] = useState(
|
|
6
|
+
const { closeButtonRef, content, direction: propsDirection, headingRef, isOpen, openButtonRef, setIsOpen, width, } = props;
|
|
7
|
+
const [direction, _] = useState(propsDirection);
|
|
8
8
|
const [top, setTop] = useState(0);
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
setTop(headingRef?.current?.getBoundingClientRect().bottom ?? 0);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef } from "react";
|
|
3
|
-
import { Heading, Text, ThemeProvider, BaseStyles, Box, Button
|
|
4
|
-
import { Overlay } from '
|
|
3
|
+
import { Heading, Text, ThemeProvider, BaseStyles, Box, Button } from "@primer/react";
|
|
4
|
+
import { Overlay } from '../..';
|
|
5
5
|
const meta = {
|
|
6
6
|
title: 'Components/Overlay',
|
|
7
7
|
component: Overlay,
|
|
@@ -18,9 +18,7 @@ const ThemedOverlay = (props) => {
|
|
|
18
18
|
const openButtonRef = useRef(null);
|
|
19
19
|
const closeButtonRef = useRef(null);
|
|
20
20
|
const headingRef = useRef(null);
|
|
21
|
-
return (_jsx(ThemeProvider, { colorMode: props.colorMode, children: _jsx(BaseStyles, { children: _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: () => {
|
|
22
|
-
setIsOpen(!isOpen);
|
|
23
|
-
}, children: "Open overlay" }), _jsx(Overlay, { ...props, isOpen: isOpen, setIsOpen: setIsOpen, openButtonRef: openButtonRef, closeButtonRef: closeButtonRef, headingRef: props.direction === 'left' ? headingRef : undefined })] })] }) }) }) }));
|
|
21
|
+
return (_jsx(ThemeProvider, { colorMode: props.colorMode, children: _jsx(BaseStyles, { children: _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, headingRef: props.direction === 'left' ? headingRef : undefined })] })] }) }) }) }));
|
|
24
22
|
};
|
|
25
23
|
export const OverlayDayLeft = {
|
|
26
24
|
args: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/primer-addons",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -23,12 +23,13 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://primer-addons.datalayer.tech",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@datalayer/icons-react": "^0.
|
|
27
|
-
"@primer/octicons-react": "^19.
|
|
28
|
-
"@primer/
|
|
29
|
-
"react": "^
|
|
30
|
-
"react
|
|
31
|
-
"react-
|
|
26
|
+
"@datalayer/icons-react": "^1.0.0",
|
|
27
|
+
"@primer/octicons-react": "^19.15.1",
|
|
28
|
+
"@primer/primitives": "^10.5.0",
|
|
29
|
+
"@primer/react": "^37.19.0",
|
|
30
|
+
"react": "18.3.1",
|
|
31
|
+
"react-dom": "18.3.1",
|
|
32
|
+
"react-loading-skeleton": "^3.5.0",
|
|
32
33
|
"styled-components": "^5.3.10"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
@@ -39,18 +40,19 @@
|
|
|
39
40
|
"@storybook/react": "^8.0.10",
|
|
40
41
|
"@storybook/react-vite": "^8.0.10",
|
|
41
42
|
"@storybook/testing-library": "^0.2.2",
|
|
42
|
-
"@types/react": "
|
|
43
|
-
"@types/react-dom": "
|
|
44
|
-
"@
|
|
45
|
-
"@typescript-eslint/
|
|
43
|
+
"@types/react": "18.3.20",
|
|
44
|
+
"@types/react-dom": "18.3.6",
|
|
45
|
+
"@types/styled-components": "^5.1.34",
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^8.29.1",
|
|
47
|
+
"@typescript-eslint/parser": "^8.29.1",
|
|
46
48
|
"@vitejs/plugin-react": "^4.2.1",
|
|
47
|
-
"eslint": "^
|
|
48
|
-
"eslint-plugin-react-hooks": "^
|
|
49
|
+
"eslint": "^9.0.0",
|
|
50
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
49
51
|
"eslint-plugin-react-refresh": "^0.3.4",
|
|
50
52
|
"eslint-plugin-storybook": "^0.6.12",
|
|
51
53
|
"prop-types": "^15.8.1",
|
|
52
54
|
"storybook": "^8.0.10",
|
|
53
|
-
"typescript": "^5.
|
|
54
|
-
"vite": "^
|
|
55
|
+
"typescript": "^5.8.3",
|
|
56
|
+
"vite": "^6.2.6"
|
|
55
57
|
}
|
|
56
58
|
}
|