@crystallize/design-system 0.0.0

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 (48) hide show
  1. package/dist/index.css +926 -0
  2. package/dist/index.d.ts +123 -0
  3. package/dist/index.js +1023 -0
  4. package/dist/index.mjs +981 -0
  5. package/package.json +73 -0
  6. package/src/action-menu/ActionMenu.stories.tsx +23 -0
  7. package/src/action-menu/action-item.tsx +24 -0
  8. package/src/action-menu/action-menu.tsx +37 -0
  9. package/src/action-menu/index.tsx +1 -0
  10. package/src/button/Button.stories.tsx +63 -0
  11. package/src/button/button.tsx +50 -0
  12. package/src/button/index.ts +3 -0
  13. package/src/button copy/ButtonCopy.stories.tsx +86 -0
  14. package/src/button copy/button.tsx +61 -0
  15. package/src/button copy/index.ts +3 -0
  16. package/src/card/card.stories.tsx +24 -0
  17. package/src/card/card.tsx +25 -0
  18. package/src/card/index.ts +1 -0
  19. package/src/colors/Colors.stories.mdx +33 -0
  20. package/src/dialog/Dialog.stories.tsx +165 -0
  21. package/src/dialog/config.tsx +134 -0
  22. package/src/dialog/confirm-dialog.tsx +59 -0
  23. package/src/dialog/destroyFns.ts +1 -0
  24. package/src/dialog/dialog.tsx +85 -0
  25. package/src/dialog/index.tsx +40 -0
  26. package/src/dialog/types.ts +38 -0
  27. package/src/dropdown-menu/DropdownMenu.stories.tsx +47 -0
  28. package/src/dropdown-menu/dropdown-menu-item.tsx +24 -0
  29. package/src/dropdown-menu/dropdown-menu-label.tsx +17 -0
  30. package/src/dropdown-menu/dropdown-menu-root.tsx +20 -0
  31. package/src/dropdown-menu/index.ts +9 -0
  32. package/src/icon-button/IconButton.stories.tsx +35 -0
  33. package/src/icon-button/icon-button.tsx +42 -0
  34. package/src/icon-button/index.ts +3 -0
  35. package/src/icons/Iconography.stories.mdx +45 -0
  36. package/src/icons/arrow.tsx +15 -0
  37. package/src/icons/cancel.tsx +26 -0
  38. package/src/icons/dots.tsx +24 -0
  39. package/src/icons/error.tsx +50 -0
  40. package/src/icons/glasses.tsx +62 -0
  41. package/src/icons/graphQL.tsx +90 -0
  42. package/src/icons/index.ts +21 -0
  43. package/src/icons/info.tsx +53 -0
  44. package/src/icons/nail-polish.tsx +84 -0
  45. package/src/icons/warning.tsx +62 -0
  46. package/src/index.css +3 -0
  47. package/src/index.ts +8 -0
  48. package/src/vite-env.d.ts +1 -0
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@crystallize/design-system",
3
+ "version": "0.0.0",
4
+ "types": "./dist/index.d.ts",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "require": "./dist/index.js",
13
+ "import": "./dist/index.mjs",
14
+ "types": "./dist/index.d.ts"
15
+ }
16
+ },
17
+ "dependencies": {
18
+ "@radix-ui/react-dialog": "1.0.2",
19
+ "@radix-ui/react-dropdown-menu": "2.0.1",
20
+ "class-variance-authority": "^0.3.0",
21
+ "clsx": "^1.2.1",
22
+ "react": "17.0.1",
23
+ "react-dom": "17.0.1"
24
+ },
25
+ "devDependencies": {
26
+ "@mdx-js/react": "^2.1.5",
27
+ "@storybook/addon-actions": "7.0.0-alpha.47",
28
+ "@storybook/addon-backgrounds": "7.0.0-alpha.47",
29
+ "@storybook/addon-docs": "^7.0.0-alpha.47",
30
+ "@storybook/addon-essentials": "^7.0.0-alpha.47",
31
+ "@storybook/addon-highlight": "7.0.0-alpha.47",
32
+ "@storybook/addon-interactions": "^7.0.0-alpha.47",
33
+ "@storybook/addon-links": "^7.0.0-alpha.47",
34
+ "@storybook/addon-measure": "7.0.0-alpha.47",
35
+ "@storybook/addon-outline": "7.0.0-alpha.47",
36
+ "@storybook/react": "^7.0.0-alpha.47",
37
+ "@storybook/react-vite": "^7.0.0-alpha.47",
38
+ "@storybook/testing-library": "^0.0.13",
39
+ "@types/react": "17.0.1",
40
+ "@types/react-dom": "17.0.1",
41
+ "@vitejs/plugin-react": "^2.2.0",
42
+ "postcss": "^8.4.18",
43
+ "storybook": "^7.0.0-alpha.47",
44
+ "tailwindcss": "^3.2.1",
45
+ "tsconfig": "0.0.0",
46
+ "tsup": "^6.3.0",
47
+ "typescript": "^4.8.4",
48
+ "vite": "^3.2.2"
49
+ },
50
+ "keywords": [
51
+ "react",
52
+ "design system"
53
+ ],
54
+ "license": "MIT",
55
+ "contributors": [
56
+ {
57
+ "email": "daniel.salvado@gmail.com",
58
+ "name": "Daniel Salvado",
59
+ "url": "https://www.danielsalvado.com/"
60
+ }
61
+ ],
62
+ "files": [
63
+ "dist",
64
+ "src",
65
+ "CHANGELOG.md"
66
+ ],
67
+ "scripts": {
68
+ "build": "tsup src/index.ts --format esm,cjs --dts",
69
+ "build-storybook": "storybook build",
70
+ "storybook": "storybook dev -p 6006 --no-open",
71
+ "dev": "tsup src/index.ts --format esm --dts --watch"
72
+ }
73
+ }
@@ -0,0 +1,23 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { ActionMenu } from '.';
4
+
5
+ const meta: Meta<typeof ActionMenu> = {
6
+ title: 'Components/ActionMenu',
7
+ component: ActionMenu,
8
+ argTypes: {},
9
+ };
10
+
11
+ export default meta;
12
+
13
+ type Story = StoryObj<typeof ActionMenu>;
14
+
15
+ export const Default: Story = {
16
+ args: {},
17
+ render: () => (
18
+ <ActionMenu>
19
+ <ActionMenu.Item onSelect={() => console.warn('Download')}>Download</ActionMenu.Item>
20
+ <ActionMenu.Item onSelect={() => console.warn('Delete')}>Delete</ActionMenu.Item>
21
+ </ActionMenu>
22
+ ),
23
+ };
@@ -0,0 +1,24 @@
1
+ import clsx from 'clsx';
2
+ import type { HTMLAttributes } from 'react';
3
+
4
+ import { DropdownMenu } from '../dropdown-menu';
5
+
6
+ type ItemProps = HTMLAttributes<HTMLLIElement> & {
7
+ onSelect?: () => void;
8
+ };
9
+
10
+ export function Item({ children, className, onSelect }: ItemProps) {
11
+ return (
12
+ <DropdownMenu.Item
13
+ onClick={onSelect}
14
+ className={clsx(
15
+ 'items-center text-density cursor-pointer flex font-sans font-medium text-sm gap-2 py-2.5 px-5',
16
+ 'hover:bg-[#f4f4f4]',
17
+ '[&.danger]:text-error',
18
+ className,
19
+ )}
20
+ >
21
+ {children}
22
+ </DropdownMenu.Item>
23
+ );
24
+ }
@@ -0,0 +1,37 @@
1
+ import clsx from 'clsx';
2
+ import type { ReactNode } from 'react';
3
+
4
+ import { DropdownMenu } from '../dropdown-menu';
5
+ import { Icon } from '../icons';
6
+
7
+ import { Item } from './action-item';
8
+
9
+ type ActionMenuProps = {
10
+ children: ReactNode;
11
+ className?: string;
12
+ tabIndex?: number;
13
+ };
14
+
15
+ export function ActionMenu({ children, className, tabIndex }: ActionMenuProps) {
16
+ return (
17
+ // @ts-expect-error
18
+ <DropdownMenu.Root content={children}>
19
+ <button
20
+ tabIndex={tabIndex}
21
+ type="button"
22
+ className={clsx(
23
+ 'items-center bg-transparent rounded-full border-none cursor-pointer flex justify-center p-1',
24
+ 'hover:bg-gray-6 focus:bg-gray-6 focus:outline-offset-2 focus:outline focus:outline-1 focus:outline-glacier focus-visible:outline-offset-2 focus-visible:outline focus-visible:outline-1 focus-visible:outline-glacier',
25
+ 'active:scale-95',
26
+ className,
27
+ )}
28
+ aria-label="more options"
29
+ >
30
+ <span className="sr-only">Open more options</span>
31
+ <Icon.Dots />
32
+ </button>
33
+ </DropdownMenu.Root>
34
+ );
35
+ }
36
+
37
+ ActionMenu.Item = Item;
@@ -0,0 +1 @@
1
+ export { ActionMenu } from './action-menu';
@@ -0,0 +1,63 @@
1
+ import type { StoryObj, Meta } from '@storybook/react';
2
+ import { Button } from '.';
3
+
4
+ const meta: Meta<typeof Button> = {
5
+ title: 'Components/Button',
6
+ component: Button,
7
+ argTypes: {},
8
+ };
9
+
10
+ export default meta;
11
+ type Story = StoryObj<typeof Button>;
12
+
13
+ const variants = ['primary', 'secondary', 'secondary-dark', 'danger'] as const;
14
+ const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
15
+
16
+ export const AllButton: Story = {
17
+ name: 'All Buttons',
18
+ render: () => {
19
+ return (
20
+ <div className="grid grid-cols-5 gap-6 justify-items-center">
21
+ {sizes.map(size => {
22
+ return variants.map((variant, idx) => (
23
+ <>
24
+ {idx === 0 && <span className="place-self-start text-slate-500">{size}</span>}
25
+ <Button variant={variant} size={size}>
26
+ Click me
27
+ </Button>
28
+ </>
29
+ ));
30
+ })}
31
+ </div>
32
+ );
33
+ },
34
+ };
35
+
36
+ export const Primary: Story = {
37
+ args: {
38
+ variant: 'primary',
39
+ children: 'Button',
40
+ },
41
+ };
42
+
43
+ export const Secondary: Story = {
44
+ args: {
45
+ variant: 'secondary',
46
+ children: 'Button',
47
+ },
48
+ };
49
+
50
+ export const Danger: Story = {
51
+ args: {
52
+ variant: 'danger',
53
+ children: 'Button',
54
+ },
55
+ };
56
+
57
+ export const Disabled: Story = {
58
+ args: {
59
+ variant: 'primary',
60
+ children: 'Button',
61
+ disabled: true,
62
+ },
63
+ };
@@ -0,0 +1,50 @@
1
+ import { ComponentPropsWithRef, forwardRef } from 'react';
2
+ import { cva, VariantProps } from 'class-variance-authority';
3
+
4
+ const DEFAULT_TEXT_COLOR = 'text-black-text disabled:text-black-text/50';
5
+
6
+ type ButtonStylesProps = VariantProps<typeof buttonStyles>;
7
+ const buttonStyles = cva(
8
+ [
9
+ 'inline-grid grid-flow-col items-center gap-2 rounded border-none font-medium cursor-pointer whitespace-nowrap',
10
+ 'disabled:cursor-default disabled:scale-100 disabled:drop-shadow-none',
11
+ 'active:scale-95',
12
+ 'focus:drop-shadow-active',
13
+ 'hover:drop-shadow-hover',
14
+ ],
15
+ {
16
+ variants: {
17
+ variant: {
18
+ primary: `bg-neptune disabled:bg-neptune-light ${DEFAULT_TEXT_COLOR}`,
19
+ secondary: `bg-white disabled:bg-[#FBFCFC] ${DEFAULT_TEXT_COLOR}`,
20
+ 'secondary-dark': `bg-cosmos disabled:bg-[#F7F8F9] ${DEFAULT_TEXT_COLOR}`,
21
+ danger: 'text-white bg-error disabled:bg-error/50 disabled:text-white/75',
22
+ },
23
+ size: {
24
+ xs: 'h-8 px-5',
25
+ sm: 'h-9 px-6',
26
+ md: 'h-10 px-7',
27
+ lg: 'h-10 px-8',
28
+ xl: 'h-11 px-9',
29
+ },
30
+ },
31
+ defaultVariants: {
32
+ variant: 'primary',
33
+ size: 'sm',
34
+ },
35
+ },
36
+ );
37
+
38
+ export type ButtonProps = ComponentPropsWithRef<'button'> & ButtonStylesProps;
39
+
40
+ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
41
+ ({ children, className, type = 'button', size, variant, ...delegated }, ref) => {
42
+ return (
43
+ <button ref={ref} type={type} className={buttonStyles({ size, variant, className })} {...delegated}>
44
+ {children}
45
+ </button>
46
+ );
47
+ },
48
+ );
49
+
50
+ Button.displayName = 'Button';
@@ -0,0 +1,3 @@
1
+ export { Button } from './button';
2
+
3
+ export type { ButtonProps } from './button';
@@ -0,0 +1,86 @@
1
+ import type { StoryObj, Meta } from '@storybook/react';
2
+ import { Button } from '.';
3
+
4
+ const meta: Meta<typeof Button> = {
5
+ title: 'Components/ButtonCopy',
6
+ component: Button,
7
+ argTypes: {},
8
+ };
9
+
10
+ export default meta;
11
+ type Story = StoryObj<typeof Button>;
12
+
13
+ const variants = ['contained', 'outline', 'link', 'text'] as const;
14
+ const intent = ['default', 'primary', 'success', 'danger'] as const;
15
+ const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
16
+
17
+ export const AllButton: Story = {
18
+ name: 'All Buttons',
19
+ render: () => {
20
+ return (
21
+ <div className="grid grid-cols-4 gap-6 justify-items-center">
22
+ {sizes.map(size =>
23
+ variants.map(variant =>
24
+ intent.map(intent => (
25
+ <Button variant={variant} size={size} intent={intent}>
26
+ Click me
27
+ </Button>
28
+ )),
29
+ ),
30
+ )}
31
+ </div>
32
+ );
33
+ },
34
+ };
35
+
36
+ export const Contained: Story = {
37
+ args: {
38
+ variant: 'contained',
39
+ children: 'Button',
40
+ },
41
+ };
42
+
43
+ export const Outline: Story = {
44
+ args: {
45
+ variant: 'outline',
46
+ children: 'Button',
47
+ },
48
+ };
49
+
50
+ export const Link: Story = {
51
+ args: {
52
+ variant: 'link',
53
+ children: 'Button',
54
+ },
55
+ };
56
+
57
+ export const Text: Story = {
58
+ args: {
59
+ variant: 'text',
60
+ children: 'Button',
61
+ },
62
+ };
63
+
64
+ export const Primary: Story = {
65
+ args: {
66
+ variant: 'contained',
67
+ children: 'Button',
68
+ intent: 'primary',
69
+ },
70
+ };
71
+
72
+ export const Success: Story = {
73
+ args: {
74
+ variant: 'contained',
75
+ children: 'Button',
76
+ intent: 'success',
77
+ },
78
+ };
79
+
80
+ export const Danger: Story = {
81
+ args: {
82
+ variant: 'contained',
83
+ children: 'Button',
84
+ intent: 'danger',
85
+ },
86
+ };
@@ -0,0 +1,61 @@
1
+ import { ComponentPropsWithRef, forwardRef } from 'react';
2
+ import { cva, VariantProps } from 'class-variance-authority';
3
+
4
+ type ButtonStylesProps = VariantProps<typeof buttonStyles>;
5
+ const buttonStyles = cva(
6
+ [
7
+ 'inline-grid grid-flow-col items-center gap-2 rounded font-medium cursor-pointer whitespace-nowrap',
8
+ 'disabled:cursor-default disabled:scale-100 disabled:shadow-none',
9
+ 'active:scale-95',
10
+ 'focus:shadow',
11
+ 'hover:shadow',
12
+ 'focus-visible:outline-inherit focus-visible:outline-offset-1 focus-visible:outline focus-visible:outline-1',
13
+ ],
14
+ {
15
+ variants: {
16
+ variant: {
17
+ contained: 'bg-cosmos',
18
+ outline: 'bg-transparent border border-galaxy border-solid text-galaxy',
19
+ link: [
20
+ 'text-sky-700',
21
+ 'hover:shadow-none hover:text-sky-500',
22
+ 'focus:shadow-none focus:text-sky-500',
23
+ 'active:scale-100',
24
+ ],
25
+ text: ['hover:shadow-none hover:bg-cosmos', 'focus:shadow-none focus:bg-cosmos'],
26
+ },
27
+ intent: {
28
+ default: '',
29
+ primary: ['bg-cyan-200 text-cyan-800', 'hover:bg-cyan-300', 'focus:bg-cyan-300'],
30
+ success: ['bg-emerald-200 text-emerald-800', 'hover:bg-emerald-300', 'focus:bg-emerald-300'],
31
+ danger: ['bg-red-200 text-red-800', 'hover:bg-red-300', 'focus:bg-red-300'],
32
+ },
33
+ size: {
34
+ xs: 'h-8 px-5',
35
+ sm: 'h-9 px-6',
36
+ md: 'h-10 px-7',
37
+ lg: 'h-10 px-8',
38
+ xl: 'h-11 px-9',
39
+ },
40
+ },
41
+ defaultVariants: {
42
+ variant: 'contained',
43
+ intent: 'default',
44
+ size: 'sm',
45
+ },
46
+ },
47
+ );
48
+
49
+ export type ButtonProps = ComponentPropsWithRef<'button'> & ButtonStylesProps;
50
+
51
+ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
52
+ ({ children, className, type = 'button', size, variant, intent, ...delegated }, ref) => {
53
+ return (
54
+ <button ref={ref} type={type} className={buttonStyles({ size, variant, intent, className })} {...delegated}>
55
+ {children}
56
+ </button>
57
+ );
58
+ },
59
+ );
60
+
61
+ Button.displayName = 'Button';
@@ -0,0 +1,3 @@
1
+ export { Button } from './button';
2
+
3
+ export type { ButtonProps } from './button';
@@ -0,0 +1,24 @@
1
+ import type { StoryObj, Meta } from '@storybook/react';
2
+ import { Card } from '.';
3
+
4
+ const meta: Meta<typeof Card> = {
5
+ title: 'Components/Card',
6
+ component: Card,
7
+ };
8
+
9
+ export default meta;
10
+ type Story = StoryObj<typeof Card>;
11
+
12
+ export const Default: Story = {
13
+ args: {
14
+ children: 'Hello World 🌍',
15
+ },
16
+ };
17
+
18
+ export const WhiteCard: Story = {
19
+ name: 'White Card',
20
+ args: {
21
+ children: 'Hello World 🌍',
22
+ variant: 'white',
23
+ },
24
+ };
@@ -0,0 +1,25 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ import { cva, VariantProps } from 'class-variance-authority';
3
+
4
+ type CardStylesProps = VariantProps<typeof cardStyles>;
5
+ const cardStyles = cva('rounded-lg p-4 sm:p-8', {
6
+ variants: {
7
+ variant: {
8
+ gray: 'bg-jupiter',
9
+ white: 'bg-white',
10
+ },
11
+ },
12
+ defaultVariants: {
13
+ variant: 'gray',
14
+ },
15
+ });
16
+
17
+ type CardProps = HTMLAttributes<HTMLDivElement> & CardStylesProps;
18
+
19
+ export function Card({ children, className, variant, ...delegated }: CardProps) {
20
+ return (
21
+ <section className={cardStyles({ variant, className })} {...delegated}>
22
+ {children}
23
+ </section>
24
+ );
25
+ }
@@ -0,0 +1 @@
1
+ export { Card } from './card';
@@ -0,0 +1,33 @@
1
+ import { Meta, ColorPalette, ColorItem } from '@storybook/addon-docs';
2
+
3
+ <Meta title="Colors" />
4
+
5
+ # Colors
6
+
7
+ <ColorPalette>
8
+ <ColorItem
9
+ title="color.density"
10
+ subtitle="Lorem ispum"
11
+ colors={{ Density: '#4d525b'}}
12
+ />
13
+ <ColorItem
14
+ title="color.label"
15
+ subtitle="Lorem ispum"
16
+ colors={{ Label: '#9095a8'}}
17
+ />
18
+ <ColorItem
19
+ title="color.neptune"
20
+ subtitle="Lorem ispum"
21
+ colors={{ Neptune: '#bff6f8'}}
22
+ />
23
+ <ColorItem
24
+ title="color.jupiter"
25
+ subtitle="Lorem ispum"
26
+ colors={{ Jupiter: '#eeeff1'}}
27
+ />
28
+ <ColorItem
29
+ title="color.gray"
30
+ subtitle="Shades of gray"
31
+ colors={{ 'gray-1': '#333333', 'gray-2': '#4f4f4f', 'gray-3': '#828282', 'gray-4': '#bdbdbd', 'gray-5': '#e0e0e0', 'gray-6': '#f2f2f2' }}
32
+ />
33
+ </ColorPalette>
@@ -0,0 +1,165 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { Dialog, showDialog, showWarning, showConfirm, showInfo, showError } from '.';
4
+ import { ActionMenu } from '../action-menu';
5
+ import { Button } from '../button';
6
+
7
+ const meta: Meta<typeof Dialog> = {
8
+ title: 'Components/Dialog',
9
+ component: Dialog,
10
+ argTypes: {},
11
+ };
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<typeof Dialog>;
16
+
17
+ const Lorem = () => (
18
+ <p className="py-6">
19
+ Lorem ipsum, dolor sit amet consectetur adipisicing elit. Reiciendis neque id, blanditiis exercitationem doloremque
20
+ quam ab minima architecto culpa, nam nobis labore quibusdam veniam maiores. Veritatis non maxime ut magnam?
21
+ </p>
22
+ );
23
+
24
+ export const Component: Story = {
25
+ render: () => (
26
+ <Dialog>
27
+ <Dialog.Trigger asChild>
28
+ <Button>Open dialog</Button>
29
+ </Dialog.Trigger>
30
+ <Dialog.Content>
31
+ <Dialog.Title>This is a normal Dialog</Dialog.Title>
32
+ <Dialog.Description>That is described in a declarative way</Dialog.Description>
33
+ <div className="flex items-center justify-between">
34
+ Here will go the main content
35
+ <ActionMenu>
36
+ <ActionMenu.Item onSelect={() => console.warn('Download')}>Download</ActionMenu.Item>
37
+ <ActionMenu.Item className="danger" onSelect={() => console.warn('Delete')}>
38
+ Delete
39
+ </ActionMenu.Item>
40
+ </ActionMenu>
41
+ </div>
42
+ </Dialog.Content>
43
+ </Dialog>
44
+ ),
45
+ };
46
+
47
+ export const ComponentWithDangerAction: Story = {
48
+ name: 'With danger action',
49
+ render: () => (
50
+ <Dialog>
51
+ <Dialog.Trigger asChild>
52
+ <Button>Open dialog</Button>
53
+ </Dialog.Trigger>
54
+ <Dialog.Content>
55
+ <Dialog.Title>A Dialog</Dialog.Title>
56
+ <div>
57
+ <Lorem />
58
+ <div className="flex gap-4 justify-end">
59
+ <Button variant="secondary-dark">Cancel</Button>
60
+ <Button variant="danger">Delete</Button>
61
+ </div>
62
+ </div>
63
+ </Dialog.Content>
64
+ </Dialog>
65
+ ),
66
+ };
67
+
68
+ export const ShowConfirm: Story = {
69
+ name: 'Show confirm',
70
+ render: () => {
71
+ const handleClick = () => {
72
+ showConfirm({
73
+ title: 'We need your confirmation',
74
+ description: 'In order to proceed to you account we need your confirmation',
75
+ content: (
76
+ <p className="my-6">
77
+ We really like cookies and our cookies is what allow us to provide you with an awesome user experience. Do
78
+ you allow us to set some cookies for you?
79
+ </p>
80
+ ),
81
+ okText: 'Yes sure',
82
+ cancelText: `I don't really like cookies`,
83
+ onCancel() {
84
+ console.warn('you canceled');
85
+ },
86
+ onOk() {
87
+ console.warn('you confirmed');
88
+ },
89
+ });
90
+ };
91
+
92
+ return <Button onClick={handleClick}>showConfirm</Button>;
93
+ },
94
+ };
95
+
96
+ export const ShowWarning: Story = {
97
+ name: 'Show warning',
98
+ render: () => {
99
+ const handleClick = () => {
100
+ showWarning({
101
+ title: 'A warning',
102
+ description: 'This is a warning dialog',
103
+ content: <Lorem />,
104
+ okText: `That's OK`,
105
+ onOk() {
106
+ console.warn('ok');
107
+ },
108
+ });
109
+ };
110
+
111
+ return <Button onClick={handleClick}>showWarning</Button>;
112
+ },
113
+ };
114
+
115
+ export const ShowError: Story = {
116
+ name: 'Show error',
117
+ render: () => {
118
+ const handleClick = () => {
119
+ showError({
120
+ title: 'Error',
121
+ description: 'This is an error dialog',
122
+ content: <Lorem />,
123
+ okText: `That's not good`,
124
+ onOk() {
125
+ console.warn('ok');
126
+ },
127
+ });
128
+ };
129
+
130
+ return <Button onClick={handleClick}>showError</Button>;
131
+ },
132
+ };
133
+
134
+ export const ShowInfo: Story = {
135
+ name: 'Show info',
136
+ render: () => {
137
+ const handleClick = () => {
138
+ showInfo({
139
+ title: 'Information',
140
+ description: 'This is an informative dialog',
141
+ content: <Lorem />,
142
+ okText: `I'm fine with that`,
143
+ onOk() {
144
+ console.warn('ok');
145
+ },
146
+ });
147
+ };
148
+
149
+ return <Button onClick={handleClick}>showInfo</Button>;
150
+ },
151
+ };
152
+
153
+ export const ShowDialog: Story = {
154
+ name: 'Show dialog',
155
+ render: () => {
156
+ const handleClick = () => {
157
+ showDialog({
158
+ title: 'Just to let you know',
159
+ content: <Lorem />,
160
+ });
161
+ };
162
+
163
+ return <Button onClick={handleClick}>showDialog</Button>;
164
+ },
165
+ };