@kkkarsss/ui 1.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.
- package/dist/.storybook/main.d.ts +3 -0
- package/dist/.storybook/main.js +34 -0
- package/dist/.storybook/preview.d.ts +4 -0
- package/dist/.storybook/preview.js +19 -0
- package/dist/index.css +238 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/providers/alert/alert-context.d.ts +16 -0
- package/dist/providers/alert/alert-context.js +2 -0
- package/dist/providers/alert/alert-provider.d.ts +6 -0
- package/dist/providers/alert/alert-provider.js +50 -0
- package/dist/providers/alert/use-alerts.d.ts +1 -0
- package/dist/providers/alert/use-alerts.js +9 -0
- package/dist/providers/index.d.ts +9 -0
- package/dist/providers/index.js +9 -0
- package/dist/providers/theme/index.d.ts +3 -0
- package/dist/providers/theme/index.js +3 -0
- package/dist/providers/theme/theme-context.d.ts +7 -0
- package/dist/providers/theme/theme-context.js +6 -0
- package/dist/providers/theme/theme-provider.d.ts +9 -0
- package/dist/providers/theme/theme-provider.js +27 -0
- package/dist/providers/theme/use-theme.d.ts +4 -0
- package/dist/providers/theme/use-theme.js +8 -0
- package/dist/providers/widget/index.d.ts +3 -0
- package/dist/providers/widget/index.js +3 -0
- package/dist/providers/widget/use-widgets.d.ts +4 -0
- package/dist/providers/widget/use-widgets.js +8 -0
- package/dist/providers/widget/widget-context.d.ts +12 -0
- package/dist/providers/widget/widget-context.js +6 -0
- package/dist/providers/widget/widget-provider.d.ts +6 -0
- package/dist/providers/widget/widget-provider.js +13 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +4 -0
- package/dist/src/providers/alert/alert-context.d.ts +16 -0
- package/dist/src/providers/alert/alert-context.js +2 -0
- package/dist/src/providers/alert/alert-provider.d.ts +6 -0
- package/dist/src/providers/alert/alert-provider.js +50 -0
- package/dist/src/providers/alert/use-alerts.d.ts +1 -0
- package/dist/src/providers/alert/use-alerts.js +9 -0
- package/dist/src/providers/index.d.ts +9 -0
- package/dist/src/providers/index.js +9 -0
- package/dist/src/providers/theme/theme-context.d.ts +7 -0
- package/dist/src/providers/theme/theme-context.js +6 -0
- package/dist/src/providers/theme/theme-provider.d.ts +9 -0
- package/dist/src/providers/theme/theme-provider.js +27 -0
- package/dist/src/providers/theme/use-theme.d.ts +4 -0
- package/dist/src/providers/theme/use-theme.js +8 -0
- package/dist/src/providers/widget/use-widgets.d.ts +4 -0
- package/dist/src/providers/widget/use-widgets.js +8 -0
- package/dist/src/providers/widget/widget-context.d.ts +12 -0
- package/dist/src/providers/widget/widget-context.js +6 -0
- package/dist/src/providers/widget/widget-provider.d.ts +6 -0
- package/dist/src/providers/widget/widget-provider.js +15 -0
- package/dist/src/ui/controls/button/button.d.ts +10 -0
- package/dist/src/ui/controls/button/button.js +11 -0
- package/dist/src/ui/controls/button/button.stories.d.ts +9 -0
- package/dist/src/ui/controls/button/button.stories.js +38 -0
- package/dist/src/ui/controls/chip/chip.d.ts +12 -0
- package/dist/src/ui/controls/chip/chip.js +11 -0
- package/dist/src/ui/controls/chip/chip.stories.d.ts +9 -0
- package/dist/src/ui/controls/chip/chip.stories.js +42 -0
- package/dist/src/ui/controls/color-picker/color-picker.d.ts +8 -0
- package/dist/src/ui/controls/color-picker/color-picker.js +21 -0
- package/dist/src/ui/controls/color-picker/color-picker.stories.d.ts +7 -0
- package/dist/src/ui/controls/color-picker/color-picker.stories.js +21 -0
- package/dist/src/ui/controls/copy/copy.d.ts +6 -0
- package/dist/src/ui/controls/copy/copy.js +20 -0
- package/dist/src/ui/controls/copy/copy.stories.d.ts +7 -0
- package/dist/src/ui/controls/copy/copy.stories.js +20 -0
- package/dist/src/ui/controls/index.d.ts +7 -0
- package/dist/src/ui/controls/index.js +7 -0
- package/dist/src/ui/controls/input/input.d.ts +14 -0
- package/dist/src/ui/controls/input/input.js +12 -0
- package/dist/src/ui/controls/input/input.stories.d.ts +9 -0
- package/dist/src/ui/controls/input/input.stories.js +46 -0
- package/dist/src/ui/controls/select/select.d.ts +14 -0
- package/dist/src/ui/controls/select/select.js +80 -0
- package/dist/src/ui/controls/select/select.stories.d.ts +8 -0
- package/dist/src/ui/controls/select/select.stories.js +40 -0
- package/dist/src/ui/controls/textarea/textarea.d.ts +11 -0
- package/dist/src/ui/controls/textarea/textarea.js +20 -0
- package/dist/src/ui/controls/textarea/textarea.stories.d.ts +8 -0
- package/dist/src/ui/controls/textarea/textarea.stories.js +35 -0
- package/dist/src/ui/index.d.ts +3 -0
- package/dist/src/ui/index.js +3 -0
- package/dist/src/ui/information/block/block.d.ts +10 -0
- package/dist/src/ui/information/block/block.js +10 -0
- package/dist/src/ui/information/block/block.stories.d.ts +8 -0
- package/dist/src/ui/information/block/block.stories.js +38 -0
- package/dist/src/ui/information/cell/cell.d.ts +26 -0
- package/dist/src/ui/information/cell/cell.js +31 -0
- package/dist/src/ui/information/cell/cell.stories.d.ts +11 -0
- package/dist/src/ui/information/cell/cell.stories.js +62 -0
- package/dist/src/ui/information/cell/cells-block.d.ts +9 -0
- package/dist/src/ui/information/cell/cells-block.js +5 -0
- package/dist/src/ui/information/cell/cells-block.stories.d.ts +6 -0
- package/dist/src/ui/information/cell/cells-block.stories.js +20 -0
- package/dist/src/ui/information/index.d.ts +6 -0
- package/dist/src/ui/information/index.js +6 -0
- package/dist/src/ui/information/spinner/spinner.d.ts +2 -0
- package/dist/src/ui/information/spinner/spinner.js +5 -0
- package/dist/src/ui/information/spinner/spinner.stories.d.ts +6 -0
- package/dist/src/ui/information/spinner/spinner.stories.js +8 -0
- package/dist/src/ui/information/tag/tag.d.ts +6 -0
- package/dist/src/ui/information/tag/tag.js +7 -0
- package/dist/src/ui/information/tag/tag.stories.d.ts +8 -0
- package/dist/src/ui/information/tag/tag.stories.js +25 -0
- package/dist/src/ui/information/text/typo.d.ts +12 -0
- package/dist/src/ui/information/text/typo.js +41 -0
- package/dist/src/ui/information/text/typo.stories.d.ts +10 -0
- package/dist/src/ui/information/text/typo.stories.js +60 -0
- package/dist/src/ui/layout/dropdown/dropdown.d.ts +11 -0
- package/dist/src/ui/layout/dropdown/dropdown.js +59 -0
- package/dist/src/ui/layout/dropdown/dropdown.stories.d.ts +6 -0
- package/dist/src/ui/layout/dropdown/dropdown.stories.js +24 -0
- package/dist/src/ui/layout/flex/flex.d.ts +12 -0
- package/dist/src/ui/layout/flex/flex.js +36 -0
- package/dist/src/ui/layout/flex/flex.stories.d.ts +8 -0
- package/dist/src/ui/layout/flex/flex.stories.js +53 -0
- package/dist/src/ui/layout/icon-action/icon-action.d.ts +9 -0
- package/dist/src/ui/layout/icon-action/icon-action.js +11 -0
- package/dist/src/ui/layout/icon-action/icon-action.stories.d.ts +7 -0
- package/dist/src/ui/layout/icon-action/icon-action.stories.js +23 -0
- package/dist/src/ui/layout/index.d.ts +5 -0
- package/dist/src/ui/layout/index.js +5 -0
- package/dist/src/ui/layout/main-page-layout/main-page-layout.d.ts +7 -0
- package/dist/src/ui/layout/main-page-layout/main-page-layout.js +8 -0
- package/dist/src/ui/layout/main-page-layout/main-page-layout.stories.d.ts +6 -0
- package/dist/src/ui/layout/main-page-layout/main-page-layout.stories.js +19 -0
- package/dist/src/ui/layout/offset/offset.d.ts +6 -0
- package/dist/src/ui/layout/offset/offset.js +10 -0
- package/dist/src/ui/layout/offset/offset.stories.d.ts +8 -0
- package/dist/src/ui/layout/offset/offset.stories.js +33 -0
- package/dist/src/utils/classes.d.ts +1 -0
- package/dist/src/utils/classes.js +1 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -0
- package/dist/stories/Button.d.ts +15 -0
- package/dist/stories/Button.js +7 -0
- package/dist/stories/Button.stories.d.ts +23 -0
- package/dist/stories/Button.stories.js +44 -0
- package/dist/stories/Header.d.ts +12 -0
- package/dist/stories/Header.js +4 -0
- package/dist/stories/Header.stories.d.ts +18 -0
- package/dist/stories/Header.stories.js +26 -0
- package/dist/stories/Page.d.ts +3 -0
- package/dist/stories/Page.js +8 -0
- package/dist/stories/Page.stories.d.ts +12 -0
- package/dist/stories/Page.stories.js +24 -0
- package/dist/ui/controls/button/button.d.ts +10 -0
- package/dist/ui/controls/button/button.js +11 -0
- package/dist/ui/controls/button/button.stories.d.ts +9 -0
- package/dist/ui/controls/button/button.stories.js +38 -0
- package/dist/ui/controls/chip/chip.d.ts +12 -0
- package/dist/ui/controls/chip/chip.js +11 -0
- package/dist/ui/controls/chip/chip.stories.d.ts +9 -0
- package/dist/ui/controls/chip/chip.stories.js +42 -0
- package/dist/ui/controls/color-picker/color-picker.d.ts +8 -0
- package/dist/ui/controls/color-picker/color-picker.js +21 -0
- package/dist/ui/controls/color-picker/color-picker.stories.d.ts +7 -0
- package/dist/ui/controls/color-picker/color-picker.stories.js +21 -0
- package/dist/ui/controls/copy/copy.d.ts +6 -0
- package/dist/ui/controls/copy/copy.js +20 -0
- package/dist/ui/controls/copy/copy.stories.d.ts +7 -0
- package/dist/ui/controls/copy/copy.stories.js +20 -0
- package/dist/ui/controls/date-input/date-input.d.ts +10 -0
- package/dist/ui/controls/date-input/date-input.js +25 -0
- package/dist/ui/controls/date-picker/date-picker.d.ts +7 -0
- package/dist/ui/controls/date-picker/date-picker.js +32 -0
- package/dist/ui/controls/index.d.ts +9 -0
- package/dist/ui/controls/index.js +9 -0
- package/dist/ui/controls/input/input.d.ts +15 -0
- package/dist/ui/controls/input/input.js +12 -0
- package/dist/ui/controls/input/input.stories.d.ts +9 -0
- package/dist/ui/controls/input/input.stories.js +46 -0
- package/dist/ui/controls/select/select.d.ts +14 -0
- package/dist/ui/controls/select/select.js +80 -0
- package/dist/ui/controls/select/select.stories.d.ts +8 -0
- package/dist/ui/controls/select/select.stories.js +40 -0
- package/dist/ui/controls/textarea/textarea.d.ts +11 -0
- package/dist/ui/controls/textarea/textarea.js +20 -0
- package/dist/ui/controls/textarea/textarea.stories.d.ts +8 -0
- package/dist/ui/controls/textarea/textarea.stories.js +35 -0
- package/dist/ui/controls/theme-toggle/theme-toggle.d.ts +2 -0
- package/dist/ui/controls/theme-toggle/theme-toggle.js +10 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.js +3 -0
- package/dist/ui/information/block/block.d.ts +13 -0
- package/dist/ui/information/block/block.js +10 -0
- package/dist/ui/information/block/block.stories.d.ts +9 -0
- package/dist/ui/information/block/block.stories.js +47 -0
- package/dist/ui/information/calendar-like/calendar-like.d.ts +24 -0
- package/dist/ui/information/calendar-like/calendar-like.js +71 -0
- package/dist/ui/information/cell/cell.d.ts +26 -0
- package/dist/ui/information/cell/cell.js +31 -0
- package/dist/ui/information/cell/cell.stories.d.ts +11 -0
- package/dist/ui/information/cell/cell.stories.js +62 -0
- package/dist/ui/information/cell/cells-block.d.ts +9 -0
- package/dist/ui/information/cell/cells-block.js +5 -0
- package/dist/ui/information/cell/cells-block.stories.d.ts +6 -0
- package/dist/ui/information/cell/cells-block.stories.js +20 -0
- package/dist/ui/information/index.d.ts +8 -0
- package/dist/ui/information/index.js +8 -0
- package/dist/ui/information/not-found/not-found.d.ts +2 -0
- package/dist/ui/information/not-found/not-found.js +6 -0
- package/dist/ui/information/spinner/spinner.d.ts +2 -0
- package/dist/ui/information/spinner/spinner.js +5 -0
- package/dist/ui/information/spinner/spinner.stories.d.ts +6 -0
- package/dist/ui/information/spinner/spinner.stories.js +8 -0
- package/dist/ui/information/tag/tag.d.ts +6 -0
- package/dist/ui/information/tag/tag.js +7 -0
- package/dist/ui/information/tag/tag.stories.d.ts +8 -0
- package/dist/ui/information/tag/tag.stories.js +25 -0
- package/dist/ui/information/text/typo.d.ts +13 -0
- package/dist/ui/information/text/typo.js +41 -0
- package/dist/ui/information/text/typo.stories.d.ts +10 -0
- package/dist/ui/information/text/typo.stories.js +60 -0
- package/dist/ui/information/typo.d.ts +12 -0
- package/dist/ui/information/typo.js +41 -0
- package/dist/ui/layout/dropdown/dropdown.d.ts +11 -0
- package/dist/ui/layout/dropdown/dropdown.js +44 -0
- package/dist/ui/layout/dropdown/dropdown.stories.d.ts +6 -0
- package/dist/ui/layout/dropdown/dropdown.stories.js +24 -0
- package/dist/ui/layout/flex/flex.d.ts +13 -0
- package/dist/ui/layout/flex/flex.js +36 -0
- package/dist/ui/layout/flex/flex.stories.d.ts +8 -0
- package/dist/ui/layout/flex/flex.stories.js +53 -0
- package/dist/ui/layout/icon-action/icon-action.d.ts +9 -0
- package/dist/ui/layout/icon-action/icon-action.js +11 -0
- package/dist/ui/layout/icon-action/icon-action.stories.d.ts +7 -0
- package/dist/ui/layout/icon-action/icon-action.stories.js +23 -0
- package/dist/ui/layout/index.d.ts +5 -0
- package/dist/ui/layout/index.js +5 -0
- package/dist/ui/layout/main-page-layout/main-page-layout.d.ts +7 -0
- package/dist/ui/layout/main-page-layout/main-page-layout.js +8 -0
- package/dist/ui/layout/main-page-layout/main-page-layout.stories.d.ts +6 -0
- package/dist/ui/layout/main-page-layout/main-page-layout.stories.js +19 -0
- package/dist/ui/layout/offset/offset.d.ts +7 -0
- package/dist/ui/layout/offset/offset.js +10 -0
- package/dist/ui/layout/offset/offset.stories.d.ts +8 -0
- package/dist/ui/layout/offset/offset.stories.js +33 -0
- package/dist/utils/classes.d.ts +1 -0
- package/dist/utils/classes.js +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Typo } from './typo';
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Information/Typo',
|
|
4
|
+
component: Typo,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
argTypes: {
|
|
7
|
+
size: {
|
|
8
|
+
control: 'select',
|
|
9
|
+
options: ['inherit', 'xs', 's', 'm', 'l', 'xl'],
|
|
10
|
+
},
|
|
11
|
+
weight: {
|
|
12
|
+
control: 'select',
|
|
13
|
+
options: ['300', '400', '500'],
|
|
14
|
+
},
|
|
15
|
+
color: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
export const Default = {
|
|
22
|
+
args: {
|
|
23
|
+
children: 'This is a default typography example.',
|
|
24
|
+
size: 'm',
|
|
25
|
+
weight: '400',
|
|
26
|
+
color: 'default',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export const LargeHeading = {
|
|
30
|
+
args: {
|
|
31
|
+
children: 'Large Heading (XL)',
|
|
32
|
+
size: 'xl',
|
|
33
|
+
weight: '500',
|
|
34
|
+
color: 'default',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export const AccentText = {
|
|
38
|
+
args: {
|
|
39
|
+
children: 'Accentuated text',
|
|
40
|
+
size: 'm',
|
|
41
|
+
weight: '500',
|
|
42
|
+
color: 'accent',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
export const ErrorText = {
|
|
46
|
+
args: {
|
|
47
|
+
children: 'This is an error message',
|
|
48
|
+
size: 's',
|
|
49
|
+
weight: '400',
|
|
50
|
+
color: 'error',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
export const CustomColor = {
|
|
54
|
+
args: {
|
|
55
|
+
children: 'Text with custom hex color',
|
|
56
|
+
size: 'm',
|
|
57
|
+
weight: '400',
|
|
58
|
+
color: '#8b5cf6',
|
|
59
|
+
},
|
|
60
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode, type RefObject } from 'react';
|
|
2
|
+
type DropdownProps = {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
anchorRef: RefObject<HTMLElement | null>;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
matchWidth?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const Dropdown: ({ isOpen, onClose, anchorRef, children, className, matchWidth }: DropdownProps) => import("react").ReactPortal | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect, useState, useRef, useEffect, useCallback } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { jc } from '../../../utils';
|
|
5
|
+
export const Dropdown = ({ isOpen, onClose, anchorRef, children, className, matchWidth = true }) => {
|
|
6
|
+
const [coords, setCoords] = useState({ top: 0, left: 0, width: 0 });
|
|
7
|
+
const dropdownRef = useRef(null);
|
|
8
|
+
const updatePosition = useCallback(() => {
|
|
9
|
+
if (anchorRef.current) {
|
|
10
|
+
const rect = anchorRef.current.getBoundingClientRect();
|
|
11
|
+
setCoords({
|
|
12
|
+
top: rect.bottom + window.scrollY,
|
|
13
|
+
left: rect.left + window.scrollX,
|
|
14
|
+
width: rect.width,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}, [anchorRef]);
|
|
18
|
+
useLayoutEffect(() => {
|
|
19
|
+
if (isOpen) {
|
|
20
|
+
updatePosition();
|
|
21
|
+
}
|
|
22
|
+
}, [isOpen, anchorRef, updatePosition]);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!isOpen)
|
|
25
|
+
return;
|
|
26
|
+
const handleResize = () => updatePosition();
|
|
27
|
+
const handleClickOutside = (event) => {
|
|
28
|
+
if (dropdownRef.current &&
|
|
29
|
+
!dropdownRef.current.contains(event.target) &&
|
|
30
|
+
anchorRef.current &&
|
|
31
|
+
!anchorRef.current.contains(event.target)) {
|
|
32
|
+
onClose();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const handleKeyDown = (event) => {
|
|
36
|
+
if (event.key === 'Escape') {
|
|
37
|
+
onClose();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
window.addEventListener('resize', handleResize);
|
|
41
|
+
window.addEventListener('scroll', handleResize, true);
|
|
42
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
43
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
44
|
+
return () => {
|
|
45
|
+
window.removeEventListener('resize', handleResize);
|
|
46
|
+
window.removeEventListener('scroll', handleResize, true);
|
|
47
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
48
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
49
|
+
};
|
|
50
|
+
}, [isOpen, onClose, anchorRef, updatePosition]);
|
|
51
|
+
if (!isOpen)
|
|
52
|
+
return null;
|
|
53
|
+
return createPortal(_jsx("div", { ref: dropdownRef, style: {
|
|
54
|
+
position: 'absolute',
|
|
55
|
+
top: `${coords.top + 4}px`,
|
|
56
|
+
left: `${coords.left}px`,
|
|
57
|
+
width: matchWidth ? `${coords.width}px` : 'auto',
|
|
58
|
+
}, className: jc('z-[1000] py-m overflow-hidden rounded border-x-2 border-secondary bg-background-accent shadow-lg', className), children: children }), document.body);
|
|
59
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
|
+
import { Dropdown } from './dropdown';
|
|
4
|
+
import { Typo } from '../../information';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Layout/Dropdown',
|
|
7
|
+
component: Dropdown,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (_jsx("div", { style: { height: '200px', padding: '20px' }, children: _jsx(Story, {}) })),
|
|
11
|
+
],
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
const DropdownWithTrigger = (args) => {
|
|
15
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
16
|
+
const anchorRef = useRef(null);
|
|
17
|
+
return (_jsxs(_Fragment, { children: [_jsx("button", { ref: anchorRef, onClick: () => setIsOpen(!isOpen), className: "px-4 py-2 bg-primary text-white rounded", children: "Toggle Dropdown" }), _jsx(Dropdown, { ...args, isOpen: isOpen, onClose: () => setIsOpen(false), anchorRef: anchorRef, children: _jsxs("div", { className: "p-2", children: [_jsx(Typo, { children: "Dropdown Content" }), _jsx(Typo, { size: "s", color: "secondary", children: "More details here..." })] }) })] }));
|
|
18
|
+
};
|
|
19
|
+
export const Default = {
|
|
20
|
+
render: (args) => _jsx(DropdownWithTrigger, { ...args }),
|
|
21
|
+
args: {
|
|
22
|
+
matchWidth: true,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FC, PropsWithChildren, RefObject } from 'react';
|
|
2
|
+
type TProps = {
|
|
3
|
+
direction?: 'row' | 'column';
|
|
4
|
+
type?: 'hug' | 'fill';
|
|
5
|
+
justify?: 'start' | 'center' | 'end' | 'space-between';
|
|
6
|
+
align?: 'start' | 'center' | 'end';
|
|
7
|
+
gap?: '0' | '4px' | '8px' | '16px';
|
|
8
|
+
ref?: RefObject<HTMLDivElement | null>;
|
|
9
|
+
offset?: '0' | '4px' | '8px' | '16px';
|
|
10
|
+
};
|
|
11
|
+
export declare const Flex: FC<PropsWithChildren<TProps>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jc } from '../../../utils';
|
|
3
|
+
const directionMap = {
|
|
4
|
+
row: 'flex-row',
|
|
5
|
+
column: 'flex-col',
|
|
6
|
+
};
|
|
7
|
+
const typeMap = {
|
|
8
|
+
hug: 'w-auto h-auto',
|
|
9
|
+
fill: 'w-full h-auto',
|
|
10
|
+
};
|
|
11
|
+
const justifyMap = {
|
|
12
|
+
start: 'justify-start',
|
|
13
|
+
center: 'justify-center',
|
|
14
|
+
end: 'justify-end',
|
|
15
|
+
'space-between': 'justify-between',
|
|
16
|
+
};
|
|
17
|
+
const alignMap = {
|
|
18
|
+
start: 'items-start',
|
|
19
|
+
center: 'items-center',
|
|
20
|
+
end: 'items-end',
|
|
21
|
+
};
|
|
22
|
+
const gapMap = {
|
|
23
|
+
'0': 'gap-0',
|
|
24
|
+
'4px': 'gap-s',
|
|
25
|
+
'8px': 'gap-m',
|
|
26
|
+
'16px': 'gap-l',
|
|
27
|
+
};
|
|
28
|
+
const offsetMap = {
|
|
29
|
+
'0': 'p-0',
|
|
30
|
+
'4px': 'p-s',
|
|
31
|
+
'8px': 'p-m',
|
|
32
|
+
'16px': 'p-l',
|
|
33
|
+
};
|
|
34
|
+
export const Flex = ({ children, justify, align, direction = 'row', type = 'hug', gap = '4px', ref, offset = '0', }) => {
|
|
35
|
+
return (_jsx("div", { className: jc('flex', 'scrollbar-none', 'overflow-hidden', 'overflow-x-auto', directionMap[direction], typeMap[type], gapMap[gap], offsetMap[offset], align && alignMap[align], justify && justifyMap[justify]), ref: ref, children: children }));
|
|
36
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Flex } from './flex';
|
|
3
|
+
declare const meta: Meta<typeof Flex>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Row: Story;
|
|
7
|
+
export declare const Column: Story;
|
|
8
|
+
export declare const SpaceBetween: Story;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Flex } from './flex';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Layout/Flex',
|
|
5
|
+
component: Flex,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
argTypes: {
|
|
8
|
+
direction: {
|
|
9
|
+
control: 'select',
|
|
10
|
+
options: ['row', 'column'],
|
|
11
|
+
},
|
|
12
|
+
justify: {
|
|
13
|
+
control: 'select',
|
|
14
|
+
options: ['start', 'center', 'end', 'space-between'],
|
|
15
|
+
},
|
|
16
|
+
align: {
|
|
17
|
+
control: 'select',
|
|
18
|
+
options: ['start', 'center', 'end'],
|
|
19
|
+
},
|
|
20
|
+
gap: {
|
|
21
|
+
control: 'select',
|
|
22
|
+
options: ['0', '4px', '8px', '16px'],
|
|
23
|
+
},
|
|
24
|
+
offset: {
|
|
25
|
+
control: 'select',
|
|
26
|
+
options: ['0', '4px', '8px', '16px'],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export default meta;
|
|
31
|
+
const Box = ({ children }) => _jsx("div", { className: "bg-accent p-4 text-white rounded", children: children });
|
|
32
|
+
export const Row = {
|
|
33
|
+
args: {
|
|
34
|
+
direction: 'row',
|
|
35
|
+
gap: '8px',
|
|
36
|
+
children: [_jsx(Box, { children: "Box 1" }, "1"), _jsx(Box, { children: "Box 2" }, "2"), _jsx(Box, { children: "Box 3" }, "3")],
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export const Column = {
|
|
40
|
+
args: {
|
|
41
|
+
direction: 'column',
|
|
42
|
+
gap: '16px',
|
|
43
|
+
children: [_jsx(Box, { children: "Row 1" }, "1"), _jsx(Box, { children: "Row 2" }, "2"), _jsx(Box, { children: "Row 3" }, "3")],
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
export const SpaceBetween = {
|
|
47
|
+
args: {
|
|
48
|
+
direction: 'row',
|
|
49
|
+
justify: 'space-between',
|
|
50
|
+
type: 'fill',
|
|
51
|
+
children: [_jsx(Box, { children: "Left" }, "1"), _jsx(Box, { children: "Right" }, "2")],
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LucideProps } from 'lucide-react';
|
|
2
|
+
import type { FC, ReactElement } from 'react';
|
|
3
|
+
type TIconActionProps = {
|
|
4
|
+
icon: ReactElement<LucideProps>;
|
|
5
|
+
onClick?: VoidFunction;
|
|
6
|
+
bgc?: CSSStyleDeclaration['backgroundColor'];
|
|
7
|
+
};
|
|
8
|
+
export declare const IconAction: FC<TIconActionProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jc } from '../../../utils';
|
|
3
|
+
export const IconAction = ({ onClick, icon, bgc }) => {
|
|
4
|
+
const onClickHandler = (e) => {
|
|
5
|
+
e.stopPropagation();
|
|
6
|
+
if (onClick) {
|
|
7
|
+
onClick();
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
return (_jsx("div", { className: jc('relative z-10 flex h-8 w-8 items-center justify-center rounded transition-all duration-200 ease-in-out', onClick ? 'hover:bg-[var(--shadow)] cursor-pointer' : undefined), onClick: onClickHandler, children: _jsx("span", { className: "absolute left-1/2 top-1/2 h-4 w-4 -translate-x-1/2 -translate-y-1/2 rounded-full", style: { backgroundColor: bgc }, children: icon }) }));
|
|
11
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { IconAction } from './icon-action';
|
|
3
|
+
declare const meta: Meta<typeof IconAction>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithBackground: Story;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Settings } from 'lucide-react';
|
|
3
|
+
import { IconAction } from './icon-action';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Layout/IconAction',
|
|
6
|
+
component: IconAction,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
onClick: { action: 'clicked' },
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
export const Default = {
|
|
14
|
+
args: {
|
|
15
|
+
icon: _jsx(Settings, { size: 16 }),
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export const WithBackground = {
|
|
19
|
+
args: {
|
|
20
|
+
icon: _jsx(Settings, { size: 16, color: "white" }),
|
|
21
|
+
bgc: '#ef4444',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import { useWidget } from '../../../providers';
|
|
4
|
+
import { Flex } from '../flex/flex';
|
|
5
|
+
export const MainPageLayout = ({ children, leftPanel, rightPanel }) => {
|
|
6
|
+
const { widget } = useWidget();
|
|
7
|
+
return (_jsxs("main", { className: "grid h-[100dvh] w-full grid-cols-[300px_1fr_300px] py-xl px-l gap-l", children: [_jsx("aside", { className: "h-full w-full", children: leftPanel }), _jsxs(Flex, { justify: 'center', gap: '16px', type: 'fill', children: [children, widget && _jsx(Fragment, { children: widget.ui }, widget.id)] }), _jsx("aside", { className: "h-full w-full", children: rightPanel })] }));
|
|
8
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { MainPageLayout } from './main-page-layout';
|
|
3
|
+
import { Typo } from '../../information';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Layout/MainPageLayout',
|
|
6
|
+
component: MainPageLayout,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'fullscreen',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
export const Default = {
|
|
14
|
+
args: {
|
|
15
|
+
leftPanel: (_jsxs("div", { className: "h-full bg-secondary/20 p-4 border-r border-border", children: [_jsx(Typo, { weight: "500", children: "Left Panel" }), _jsx(Typo, { size: "s", children: "Navigation or filters" })] })),
|
|
16
|
+
rightPanel: (_jsxs("div", { className: "h-full bg-secondary/20 p-4 border-l border-border", children: [_jsx(Typo, { weight: "500", children: "Right Panel" }), _jsx(Typo, { size: "s", children: "Additional info" })] })),
|
|
17
|
+
children: (_jsxs("div", { className: "w-full h-full bg-background-accent p-4 rounded-xl shadow-sm", children: [_jsx(Typo, { size: "xl", weight: "500", children: "Main Content Area" }), _jsxs("div", { className: "mt-4 space-y-2", children: [_jsx(Typo, { children: "This is where the main application content goes." }), _jsx(Typo, { color: "secondary", children: "It is centered and has a gap between panels." })] })] })),
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jc } from '../../../utils';
|
|
3
|
+
const typeMap = {
|
|
4
|
+
horizontal: 'mx-l',
|
|
5
|
+
vertical: 'my-l',
|
|
6
|
+
both: 'm-l',
|
|
7
|
+
};
|
|
8
|
+
export const Offset = ({ children, type = 'horizontal', }) => {
|
|
9
|
+
return _jsx("div", { className: jc(typeMap[type]), children: children });
|
|
10
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Offset } from './offset';
|
|
3
|
+
declare const meta: Meta<typeof Offset>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Horizontal: Story;
|
|
7
|
+
export declare const Vertical: Story;
|
|
8
|
+
export declare const Both: Story;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Offset } from './offset';
|
|
3
|
+
import { Typo } from '../../information';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Layout/Offset',
|
|
6
|
+
component: Offset,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
type: {
|
|
10
|
+
control: 'select',
|
|
11
|
+
options: ['horizontal', 'vertical', 'both'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
export default meta;
|
|
16
|
+
export const Horizontal = {
|
|
17
|
+
args: {
|
|
18
|
+
type: 'horizontal',
|
|
19
|
+
children: (_jsx("div", { className: "bg-accent-secondary p-2", children: _jsx(Typo, { children: "Horizontal Offset (mx-l)" }) })),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const Vertical = {
|
|
23
|
+
args: {
|
|
24
|
+
type: 'vertical',
|
|
25
|
+
children: (_jsx("div", { className: "bg-accent-secondary p-2", children: _jsx(Typo, { children: "Vertical Offset (my-l)" }) })),
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const Both = {
|
|
29
|
+
args: {
|
|
30
|
+
type: 'both',
|
|
31
|
+
children: (_jsx("div", { className: "bg-accent-secondary p-2", children: _jsx(Typo, { children: "Both Offset (m-l)" }) })),
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const jc: (...classes: (string | undefined)[]) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const jc = (...classes) => classes.filter(Boolean).join(' ').trim();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { jc } from './classes';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { jc } from './classes';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import './button.css';
|
|
2
|
+
export interface ButtonProps {
|
|
3
|
+
/** Is this the principal call to action on the page? */
|
|
4
|
+
primary?: boolean;
|
|
5
|
+
/** What background color to use */
|
|
6
|
+
backgroundColor?: string;
|
|
7
|
+
/** How large should the button be? */
|
|
8
|
+
size?: 'small' | 'medium' | 'large';
|
|
9
|
+
/** Button contents */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Optional click handler */
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
}
|
|
14
|
+
/** Primary UI component for user interaction */
|
|
15
|
+
export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import './button.css';
|
|
3
|
+
/** Primary UI component for user interaction */
|
|
4
|
+
export const Button = ({ primary = false, size = 'medium', backgroundColor, label, ...props }) => {
|
|
5
|
+
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
6
|
+
return (_jsx("button", { type: "button", className: ['storybook-button', `storybook-button--${size}`, mode].join(' '), style: { backgroundColor }, ...props, children: label }));
|
|
7
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ primary, size, backgroundColor, label, ...props }: import("./Button").ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
argTypes: {
|
|
10
|
+
backgroundColor: {
|
|
11
|
+
control: "color";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
args: {
|
|
15
|
+
onClick: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
export declare const Primary: Story;
|
|
21
|
+
export declare const Secondary: Story;
|
|
22
|
+
export declare const Large: Story;
|
|
23
|
+
export declare const Small: Story;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { fn } from 'storybook/test';
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Example/Button',
|
|
6
|
+
component: Button,
|
|
7
|
+
parameters: {
|
|
8
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
14
|
+
argTypes: {
|
|
15
|
+
backgroundColor: { control: 'color' },
|
|
16
|
+
},
|
|
17
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#story-args
|
|
18
|
+
args: { onClick: fn() },
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
22
|
+
export const Primary = {
|
|
23
|
+
args: {
|
|
24
|
+
primary: true,
|
|
25
|
+
label: 'Button',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const Secondary = {
|
|
29
|
+
args: {
|
|
30
|
+
label: 'Button',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const Large = {
|
|
34
|
+
args: {
|
|
35
|
+
size: 'large',
|
|
36
|
+
label: 'Button',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export const Small = {
|
|
40
|
+
args: {
|
|
41
|
+
size: 'small',
|
|
42
|
+
label: 'Button',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import './header.css';
|
|
2
|
+
type User = {
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
5
|
+
export interface HeaderProps {
|
|
6
|
+
user?: User;
|
|
7
|
+
onLogin?: () => void;
|
|
8
|
+
onLogout?: () => void;
|
|
9
|
+
onCreateAccount?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const Header: ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
import './header.css';
|
|
4
|
+
export const Header = ({ user, onLogin, onLogout, onCreateAccount }) => (_jsx("header", { children: _jsxs("div", { className: "storybook-header", children: [_jsxs("div", { children: [_jsx("svg", { width: "32", height: "32", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", children: _jsxs("g", { fill: "none", fillRule: "evenodd", children: [_jsx("path", { d: "M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z", fill: "#FFF" }), _jsx("path", { d: "M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z", fill: "#555AB9" }), _jsx("path", { d: "M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z", fill: "#91BAF8" })] }) }), _jsx("h1", { children: "Acme" })] }), _jsx("div", { children: user ? (_jsxs(_Fragment, { children: [_jsxs("span", { className: "welcome", children: ["Welcome, ", _jsx("b", { children: user.name }), "!"] }), _jsx(Button, { size: "small", onClick: onLogout, label: "Log out" })] })) : (_jsxs(_Fragment, { children: [_jsx(Button, { size: "small", onClick: onLogin, label: "Log in" }), _jsx(Button, { primary: true, size: "small", onClick: onCreateAccount, label: "Sign up" })] })) })] }) }));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ user, onLogin, onLogout, onCreateAccount }: import("./Header").HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
tags: string[];
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
args: {
|
|
10
|
+
onLogin: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
11
|
+
onLogout: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
12
|
+
onCreateAccount: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
export declare const LoggedIn: Story;
|
|
18
|
+
export declare const LoggedOut: Story;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { fn } from 'storybook/test';
|
|
2
|
+
import { Header } from './Header';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Example/Header',
|
|
5
|
+
component: Header,
|
|
6
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {
|
|
9
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
10
|
+
layout: 'fullscreen',
|
|
11
|
+
},
|
|
12
|
+
args: {
|
|
13
|
+
onLogin: fn(),
|
|
14
|
+
onLogout: fn(),
|
|
15
|
+
onCreateAccount: fn(),
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export const LoggedIn = {
|
|
20
|
+
args: {
|
|
21
|
+
user: {
|
|
22
|
+
name: 'Jane Doe',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export const LoggedOut = {};
|