mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-02 02:30:29 +00:00
Setup library for publishing to npm
This commit is contained in:
@@ -8,7 +8,7 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
tags: ['!autodocs'],
|
||||
argTypes: {
|
||||
text: { control: 'text' },
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin'] },
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Wrapper } from './styles';
|
||||
|
||||
type AlertProps = {
|
||||
export type AlertProps = {
|
||||
className?: string;
|
||||
color:
|
||||
| 'client'
|
||||
|
||||
@@ -8,7 +8,6 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
text: { control: 'text' },
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin'] },
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Wrapper } from './styles';
|
||||
|
||||
type AvatarProps = {
|
||||
export type AvatarProps = {
|
||||
className?: string;
|
||||
color?: 'client' | 'productOwner' | 'developer' | 'admin' | string;
|
||||
size?: 'small' | 'big';
|
||||
|
||||
@@ -8,7 +8,6 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
color: { control: 'text' },
|
||||
children: { control: 'text' },
|
||||
|
||||
@@ -8,7 +8,6 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin', 'error'] },
|
||||
text: { control: 'text' },
|
||||
|
||||
@@ -2,7 +2,7 @@ import Spinner from '../Spinner';
|
||||
|
||||
import { Wrapper } from './styles';
|
||||
|
||||
type ButtonProps = {
|
||||
export type ButtonProps = {
|
||||
color: 'client' | 'productOwner' | 'developer' | 'admin' | 'error';
|
||||
size?: 'small' | 'big';
|
||||
variant?: 'primary-action' | 'secondary-action' | 'outlined' | 'text';
|
||||
|
||||
@@ -8,7 +8,6 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin', 'error'] },
|
||||
},
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import Box from '../Box';
|
||||
import Text from '../Text';
|
||||
|
||||
import { theme } from '../../themes';
|
||||
import { defaultTheme } from '../../themes';
|
||||
|
||||
type CardProps = {
|
||||
export type CardProps = {
|
||||
title: string;
|
||||
description: string;
|
||||
selectable?: boolean;
|
||||
@@ -25,7 +25,7 @@ const Card = ({
|
||||
padding='10px'
|
||||
background='white'
|
||||
boxShadow='1px 1px 10px rgba(50, 59, 105, 0.25)'
|
||||
border={selected ? `2px solid ${theme.colors[color].main}` : undefined}
|
||||
border={selected ? `2px solid ${defaultTheme.colors[color].main}` : undefined}
|
||||
onClick={selectable ? toggleSelect : () => {}}
|
||||
display='grid'
|
||||
gridTemplateRows='auto'
|
||||
|
||||
@@ -8,7 +8,7 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
tags: ['!autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin'] },
|
||||
label: { control: 'text' },
|
||||
|
||||
@@ -4,7 +4,7 @@ import Text from '../Text';
|
||||
|
||||
import { Check } from '../../assets';
|
||||
|
||||
type CheckBoxProps = {
|
||||
export type CheckBoxProps = {
|
||||
className?: string;
|
||||
color?: 'client' | 'productOwner' | 'developer' | 'admin';
|
||||
label: string;
|
||||
|
||||
@@ -8,7 +8,6 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin'] },
|
||||
text: { control: 'text' },
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Wrapper } from './styles';
|
||||
|
||||
import Text from '../Text';
|
||||
|
||||
type ChipProps = {
|
||||
export type ChipProps = {
|
||||
variant?: 'outlined' | 'filled';
|
||||
color:
|
||||
| 'client'
|
||||
|
||||
@@ -6,7 +6,9 @@ import Box from '../Box';
|
||||
const meta = {
|
||||
title: 'ContextMenu',
|
||||
component: ContextMenu,
|
||||
tags: ['autodocs'],
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
} satisfies Meta<typeof ContextMenu>;
|
||||
|
||||
export default meta;
|
||||
@@ -27,4 +29,4 @@ export const Example: Story = {
|
||||
</>
|
||||
)
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Wrapper } from './styles';
|
||||
|
||||
import Text from '../Text';
|
||||
|
||||
type ContextMenuProps = {
|
||||
export type ContextMenuProps = {
|
||||
className?: string;
|
||||
items: Array<{ label: string; action?: () => void }>;
|
||||
component: string;
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import IconButton from '.';
|
||||
|
||||
const meta = {
|
||||
title: 'IconButton',
|
||||
component: IconButton,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin'] },
|
||||
size: { options: ['small', 'medium', 'big'] },
|
||||
},
|
||||
} satisfies Meta<typeof IconButton>;
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Example: Story = {
|
||||
args: {
|
||||
color: 'admin',
|
||||
size: 'medium',
|
||||
onClick: () => window.alert('Hello, World!')
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import IconButton from '.';
|
||||
import Add from '../../assets/icons/add.svg?react';
|
||||
|
||||
const meta = {
|
||||
title: 'IconButton',
|
||||
component: IconButton,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['!autodocs'],
|
||||
} satisfies Meta<typeof IconButton>;
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof IconButton>;
|
||||
|
||||
export const Example: Story = {
|
||||
render: () => {
|
||||
return (
|
||||
<IconButton
|
||||
color='admin'
|
||||
icon={<Add />}
|
||||
size='medium'
|
||||
onClick={() => window.alert('Hello, World!')}
|
||||
/>
|
||||
)
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Wrapper } from './styles';
|
||||
|
||||
type IconButtonProps = {
|
||||
export type IconButtonProps = {
|
||||
color?: 'client' | 'productOwner' | 'developer' | 'admin';
|
||||
size?: 'small' | 'medium' | 'big';
|
||||
icon?: React.ReactNode;
|
||||
|
||||
@@ -22,6 +22,7 @@ export const Wrapper = styled.button<WrapperProps>`
|
||||
svg {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
path {
|
||||
stroke: ${({ theme }) => theme.colors.white.main};
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import ImagePreview from '.';
|
||||
|
||||
const meta = {
|
||||
title: 'ImagePreview',
|
||||
component: ImagePreview,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin'] },
|
||||
},
|
||||
} satisfies Meta<typeof ImagePreview>;
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Example: Story = {
|
||||
args: {
|
||||
color: 'developer',
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import ImagePreview, {ImagePreviewProps} from '.';
|
||||
|
||||
const meta = {
|
||||
title: 'ImagePreview',
|
||||
component: ImagePreview,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
} satisfies Meta<typeof ImagePreview>;
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof ImagePreview>;
|
||||
|
||||
export const Example: Story = {
|
||||
render: (args) => {
|
||||
const [image, setImage] = useState<ImagePreviewProps['image']>(undefined);
|
||||
|
||||
return (
|
||||
<>
|
||||
<ImagePreview
|
||||
image={image}
|
||||
onChange={(event) => {
|
||||
console.log(event)
|
||||
setImage({
|
||||
name: 'image',
|
||||
src: event.target.value
|
||||
})
|
||||
}}
|
||||
color={args.color}
|
||||
/>
|
||||
<p>{image?.src}</p>
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Wrapper } from './styles';
|
||||
import { Upload, Close } from '../../assets';
|
||||
|
||||
type ImagePreviewProps = {
|
||||
export type ImagePreviewProps = {
|
||||
className?: string;
|
||||
color?:
|
||||
| 'client'
|
||||
|
||||
@@ -8,7 +8,6 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin'] },
|
||||
},
|
||||
|
||||
@@ -3,7 +3,7 @@ import Text from '../Text';
|
||||
import { Upload } from '../../assets';
|
||||
import { Wrapper } from './styles';
|
||||
|
||||
type InputProps = {
|
||||
export type InputProps = {
|
||||
className?: string;
|
||||
color?:
|
||||
| 'client'
|
||||
|
||||
@@ -8,7 +8,7 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
tags: ['!autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['success', 'error', 'warning', 'black'] },
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { JSX } from 'react';
|
||||
import { Wrapper } from './styles';
|
||||
|
||||
type LinkProps = {
|
||||
export type LinkProps = {
|
||||
href?: string;
|
||||
url?: boolean;
|
||||
children?: React.ReactNode | JSX.Element | string;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import Menu from '.';
|
||||
|
||||
const meta = {
|
||||
title: 'Menu',
|
||||
component: Menu,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
} satisfies Meta<typeof Menu>;
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Example: Story = {
|
||||
args: {
|
||||
items: [
|
||||
{
|
||||
label: 'Hello, World!',
|
||||
}
|
||||
],
|
||||
component: 'component',
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import Menu from '.';
|
||||
import Box from '../Box';
|
||||
|
||||
import Add from '../../assets/icons/add.svg?react';
|
||||
|
||||
const meta = {
|
||||
title: 'Menu',
|
||||
component: Menu,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['!autodocs'],
|
||||
} satisfies Meta<typeof Menu>;
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof Menu>;
|
||||
|
||||
export const Example: Story = {
|
||||
render: () => {
|
||||
return (
|
||||
<>
|
||||
<Menu
|
||||
component='box'
|
||||
items={[
|
||||
{ icon: <Add />, label: 'Item', action: () => window.alert('Adding item!') }
|
||||
]}
|
||||
/>
|
||||
<Box id='box'>Has a Menu!</Box>
|
||||
</>
|
||||
)
|
||||
},
|
||||
};
|
||||
@@ -3,7 +3,7 @@ import { Wrapper } from './styles';
|
||||
|
||||
import Text from '../Text';
|
||||
|
||||
type MenuProps = {
|
||||
export type MenuProps = {
|
||||
className?: string;
|
||||
items: Array<{
|
||||
icon?: React.ReactNode;
|
||||
|
||||
@@ -8,7 +8,6 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin', 'error'] },
|
||||
title: { control: 'text' },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { JSX } from 'react';
|
||||
import { theme } from '../../themes';
|
||||
import { defaultTheme } from '../../themes';
|
||||
|
||||
import Box from '../Box';
|
||||
import Button from '../Button';
|
||||
@@ -7,7 +7,7 @@ import Text from '../Text';
|
||||
|
||||
import { Wrapper } from './styles';
|
||||
|
||||
type ModalProps = {
|
||||
export type ModalProps = {
|
||||
color: 'client' | 'productOwner' | 'developer' | 'admin';
|
||||
title: string;
|
||||
description: string;
|
||||
@@ -27,7 +27,7 @@ const Modal = ({
|
||||
return (
|
||||
<Wrapper>
|
||||
<Box
|
||||
background={theme.colors.white.main}
|
||||
background={defaultTheme.colors.white.main}
|
||||
borderRadius='10px'
|
||||
padding='20px'
|
||||
display='grid'
|
||||
@@ -38,7 +38,7 @@ const Modal = ({
|
||||
<Text variant='headline' weight='bold' color={color}>
|
||||
{title}
|
||||
</Text>
|
||||
<Text variant='body' color={theme.colors.black.main}>
|
||||
<Text variant='body' color={defaultTheme.colors.black.main}>
|
||||
{description}
|
||||
</Text>
|
||||
{children}
|
||||
|
||||
@@ -8,7 +8,6 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin', 'error'] },
|
||||
value: { control: 'text' },
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Wrapper } from './styles';
|
||||
|
||||
import SearchIcon from '../../assets/icons/search.svg?react';
|
||||
|
||||
type SearchProps = {
|
||||
export type SearchProps = {
|
||||
className?: string;
|
||||
color?:
|
||||
| 'client'
|
||||
|
||||
@@ -8,7 +8,6 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin', 'error'] },
|
||||
value: { control: 'text' },
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Wrapper } from './styles';
|
||||
|
||||
import Text from '../Text';
|
||||
|
||||
type SelectProps = {
|
||||
export type SelectProps = {
|
||||
className?: string;
|
||||
color?:
|
||||
| 'client'
|
||||
|
||||
@@ -8,7 +8,7 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
tags: ['!autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin', 'error'] },
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Wrapper } from './styles';
|
||||
|
||||
type SpinnerProps = {
|
||||
export type SpinnerProps = {
|
||||
color?:
|
||||
| 'client'
|
||||
| 'productOwner'
|
||||
@@ -9,12 +9,12 @@ type SpinnerProps = {
|
||||
| 'white'
|
||||
| 'black'
|
||||
| 'gray';
|
||||
fullScreen?: boolean;
|
||||
fullWidth?: boolean;
|
||||
};
|
||||
|
||||
const Spinner = ({ fullScreen = false, color = 'client' }: SpinnerProps) => {
|
||||
const Spinner = ({ fullWidth = false, color = 'client' }: SpinnerProps) => {
|
||||
return (
|
||||
<Wrapper fullScreen={fullScreen} color={color}>
|
||||
<Wrapper fullWidth={fullWidth} color={color}>
|
||||
<div className='lds-dual-ring'></div>
|
||||
</Wrapper>
|
||||
);
|
||||
|
||||
@@ -9,12 +9,12 @@ type WrapperProps = {
|
||||
| 'white'
|
||||
| 'black'
|
||||
| 'gray';
|
||||
fullScreen?: boolean;
|
||||
fullWidth?: boolean;
|
||||
};
|
||||
|
||||
export const Wrapper = styled.div<WrapperProps>`
|
||||
${({ fullScreen }) =>
|
||||
fullScreen &&
|
||||
${({ fullWidth }) =>
|
||||
fullWidth &&
|
||||
css`
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
@@ -28,6 +28,7 @@ export const Wrapper = styled.div<WrapperProps>`
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.lds-dual-ring:after {
|
||||
content: ' ';
|
||||
display: block;
|
||||
@@ -46,6 +47,7 @@ export const Wrapper = styled.div<WrapperProps>`
|
||||
transparent;
|
||||
animation: lds-dual-ring 1.2s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes lds-dual-ring {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
|
||||
@@ -8,7 +8,7 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
tags: ['!autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin', 'error'] },
|
||||
variant: { options: ['display', 'headline', 'title', 'subheader', 'body', 'caption'] },
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Wrapper } from './styles';
|
||||
|
||||
type TextProps = {
|
||||
export type TextProps = {
|
||||
children?: string;
|
||||
className?: string;
|
||||
variant?: 'display' | 'headline' | 'title' | 'subheader' | 'body' | 'caption';
|
||||
|
||||
@@ -8,7 +8,6 @@ const meta = {
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
color: { options: ['client', 'productOwner', 'developer', 'admin', 'error'] },
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Wrapper } from './styles';
|
||||
|
||||
import Text from '../Text';
|
||||
|
||||
type TextAreaProps = {
|
||||
export type TextAreaProps = {
|
||||
className?: string;
|
||||
color?:
|
||||
| 'client'
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { ThemeProvider as StyledThemeProvider } from 'styled-components';
|
||||
import { DefaultTheme } from 'styled-components';
|
||||
|
||||
import { defaultTheme } from '../../themes';
|
||||
|
||||
export type ThemeProviderProps = {
|
||||
children: React.ReactNode;
|
||||
theme?: DefaultTheme;
|
||||
};
|
||||
|
||||
function ThemeProvider({ children, theme = defaultTheme }: ThemeProviderProps) {
|
||||
return (
|
||||
<StyledThemeProvider theme={theme}>
|
||||
{children}
|
||||
</StyledThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default ThemeProvider;
|
||||
Reference in New Issue
Block a user