@kimdw-rtk/ui 0.0.0 → 0.0.2
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/package.json +6 -2
- package/.babelrc +0 -12
- package/.turbo/turbo-check-types.log +0 -2
- package/.turbo/turbo-lint.log +0 -12
- package/.turbo/turbo-test.log +0 -4084
- package/.vscode/settings.json +0 -4
- package/eslint.config.mjs +0 -4
- package/jest.config.json +0 -10
- package/jest.setup.js +0 -2
- package/src/components/Accordion/Accordion.css.ts +0 -29
- package/src/components/Accordion/Accordion.spec.tsx +0 -6
- package/src/components/Accordion/Accordion.tsx +0 -44
- package/src/components/Accordion/AccordionContent.css.ts +0 -29
- package/src/components/Accordion/AccordionContent.tsx +0 -87
- package/src/components/Accordion/AccordionContext.ts +0 -9
- package/src/components/Accordion/AccordionTrigger.css.ts +0 -46
- package/src/components/Accordion/AccordionTrigger.tsx +0 -41
- package/src/components/Accordion/index.ts +0 -3
- package/src/components/Alert/index.tsx +0 -25
- package/src/components/Box/Box.css.ts +0 -18
- package/src/components/Box/Box.spec.tsx +0 -6
- package/src/components/Box/index.tsx +0 -41
- package/src/components/Button/Button.css.ts +0 -241
- package/src/components/Button/Button.spec.tsx +0 -30
- package/src/components/Button/index.tsx +0 -60
- package/src/components/Card/Card.css.ts +0 -93
- package/src/components/Card/Card.spec.tsx +0 -24
- package/src/components/Card/Card.tsx +0 -41
- package/src/components/Card/CardContent.css.ts +0 -8
- package/src/components/Card/CardContent.tsx +0 -23
- package/src/components/Card/CardInteraction.css.ts +0 -11
- package/src/components/Card/CardInteraction.tsx +0 -36
- package/src/components/Card/CardThumbnail.css.ts +0 -6
- package/src/components/Card/CardThumbnail.tsx +0 -23
- package/src/components/Card/index.ts +0 -4
- package/src/components/Chip/Chip.css.ts +0 -75
- package/src/components/Chip/Chip.spec.tsx +0 -6
- package/src/components/Chip/Chip.tsx +0 -37
- package/src/components/Chip/index.ts +0 -1
- package/src/components/Confirm/index.tsx +0 -44
- package/src/components/Dialog/Dialog.css.ts +0 -25
- package/src/components/Dialog/Dialog.spec.tsx +0 -26
- package/src/components/Dialog/Dialog.tsx +0 -30
- package/src/components/Dialog/DialogContent.css.ts +0 -16
- package/src/components/Dialog/DialogContent.tsx +0 -26
- package/src/components/Dialog/DialogFooter.css.ts +0 -20
- package/src/components/Dialog/DialogFooter.tsx +0 -26
- package/src/components/Dialog/DialogHeader.css.ts +0 -31
- package/src/components/Dialog/DialogHeader.tsx +0 -37
- package/src/components/Dialog/index.ts +0 -4
- package/src/components/Navigation/Navigation.spec.tsx +0 -19
- package/src/components/Navigation/NavigationAside.css.ts +0 -7
- package/src/components/Navigation/NavigationAside.tsx +0 -23
- package/src/components/Navigation/NavigationBar.css.ts +0 -42
- package/src/components/Navigation/NavigationBar.tsx +0 -25
- package/src/components/Navigation/NavigationContainer.css.ts +0 -11
- package/src/components/Navigation/NavigationContainer.tsx +0 -26
- package/src/components/Navigation/NavigationDrawer.css.ts +0 -61
- package/src/components/Navigation/NavigationDrawer.tsx +0 -67
- package/src/components/Navigation/NavigationItem.css.ts +0 -43
- package/src/components/Navigation/NavigationItem.tsx +0 -24
- package/src/components/Navigation/NavigationLogo.css.ts +0 -5
- package/src/components/Navigation/NavigationLogo.tsx +0 -28
- package/src/components/Navigation/NavigationMenu.css.ts +0 -23
- package/src/components/Navigation/NavigationMenu.tsx +0 -25
- package/src/components/Navigation/index.ts +0 -7
- package/src/components/Range/Range.css.ts +0 -132
- package/src/components/Range/Range.spec.tsx +0 -6
- package/src/components/Range/Range.tsx +0 -90
- package/src/components/Range/index.ts +0 -1
- package/src/components/ScrollArea/ScrollArea.css.ts +0 -40
- package/src/components/ScrollArea/ScrollArea.spec.tsx +0 -6
- package/src/components/ScrollArea/ScrollArea.tsx +0 -68
- package/src/components/ScrollArea/index.ts +0 -1
- package/src/components/Select/Select.css.ts +0 -22
- package/src/components/Select/Select.spec.tsx +0 -65
- package/src/components/Select/Select.tsx +0 -111
- package/src/components/Select/SelectContext.ts +0 -59
- package/src/components/Select/SelectOption.css.ts +0 -14
- package/src/components/Select/SelectOption.tsx +0 -40
- package/src/components/Select/SelectOptionList.css.ts +0 -68
- package/src/components/Select/SelectOptionList.tsx +0 -59
- package/src/components/Select/SelectTrigger.css.ts +0 -73
- package/src/components/Select/SelectTrigger.tsx +0 -49
- package/src/components/Select/index.tsx +0 -2
- package/src/components/Skeleton/Skeleton.css.ts +0 -26
- package/src/components/Skeleton/Skeleton.spec.tsx +0 -6
- package/src/components/Skeleton/index.tsx +0 -27
- package/src/components/Table/Table.css.ts +0 -10
- package/src/components/Table/Table.spec.tsx +0 -12
- package/src/components/Table/Table.tsx +0 -27
- package/src/components/Table/TableBody.tsx +0 -14
- package/src/components/Table/TableCell.css.ts +0 -43
- package/src/components/Table/TableCell.tsx +0 -30
- package/src/components/Table/TableHead.css.ts +0 -10
- package/src/components/Table/TableHead.tsx +0 -30
- package/src/components/Table/TableHeader.tsx +0 -14
- package/src/components/Table/TableRow.css.ts +0 -3
- package/src/components/Table/TableRow.tsx +0 -24
- package/src/components/Table/index.ts +0 -6
- package/src/components/Tabs/Tabs.spec.tsx +0 -46
- package/src/components/Tabs/Tabs.tsx +0 -34
- package/src/components/Tabs/TabsContent.tsx +0 -32
- package/src/components/Tabs/TabsList.css.ts +0 -11
- package/src/components/Tabs/TabsList.tsx +0 -25
- package/src/components/Tabs/TabsProvider.tsx +0 -17
- package/src/components/Tabs/TabsTrigger.css.ts +0 -38
- package/src/components/Tabs/TabsTrigger.tsx +0 -43
- package/src/components/Tabs/index.ts +0 -4
- package/src/components/TextField/TextField.css.ts +0 -81
- package/src/components/TextField/TextField.spec.tsx +0 -6
- package/src/components/TextField/index.tsx +0 -38
- package/src/components/Toast/Toast.css.ts +0 -79
- package/src/components/Toast/Toast.spec.tsx +0 -6
- package/src/components/Toast/index.tsx +0 -48
- package/src/components/Typography/Typography.css.ts +0 -17
- package/src/components/Typography/Typography.spec.tsx +0 -35
- package/src/components/Typography/index.tsx +0 -57
- package/src/components/index.ts +0 -18
- package/src/contexts/UIProvider.tsx +0 -30
- package/src/contexts/index.ts +0 -1
- package/src/hooks/index.ts +0 -5
- package/src/hooks/useDialog/index.tsx +0 -51
- package/src/hooks/useDialog/useDialog.spec.tsx +0 -80
- package/src/hooks/useMouseScroll/index.ts +0 -63
- package/src/hooks/usePointerSlider/index.ts +0 -79
- package/src/hooks/useRipple/index.tsx +0 -152
- package/src/hooks/useRipple/ripple.css.ts +0 -40
- package/src/hooks/useToast/ToastContainer.css.ts +0 -12
- package/src/hooks/useToast/ToastContainer.tsx +0 -11
- package/src/hooks/useToast/ToastProvider.tsx +0 -131
- package/src/hooks/useToast/index.ts +0 -15
- package/src/index.ts +0 -8
- package/src/styles/globalStyle.css.ts +0 -36
- package/src/styles/index.ts +0 -4
- package/src/styles/layers.css.ts +0 -4
- package/src/styles/overlay.css.ts +0 -40
- package/src/styles/sprinkles.css.ts +0 -149
- package/src/styles/sx.ts +0 -13
- package/src/tests/uiTest.tsx +0 -54
- package/src/themes/darkTheme.css.ts +0 -30
- package/src/themes/index.ts +0 -3
- package/src/themes/lightTheme.css.ts +0 -30
- package/src/themes/theme.css.ts +0 -32
- package/src/tokens/index.ts +0 -5
- package/src/tokens/scale/color.ts +0 -604
- package/src/tokens/semantic/breakpoint.ts +0 -6
- package/src/tokens/semantic/color.ts +0 -10
- package/src/tokens/semantic/spacing.ts +0 -9
- package/src/tokens/semantic/typography.ts +0 -32
- package/src/types/index.ts +0 -1
- package/src/types/ui.types.ts +0 -26
- package/src/utils/index.ts +0 -1
- package/src/utils/sprinklesUtils.ts +0 -28
- package/src/utils/styleUtils.css.ts +0 -109
- package/tsconfig.json +0 -11
- package/turbo/generators/config.ts +0 -30
- package/turbo/generators/templates/component.hbs +0 -8
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { forwardRef, type ReactElement } from 'react';
|
|
4
|
-
|
|
5
|
-
import { clsx } from 'clsx';
|
|
6
|
-
|
|
7
|
-
import { useRipple } from '#hooks';
|
|
8
|
-
import { sx } from '#styles';
|
|
9
|
-
import type { UIComponent } from '#types';
|
|
10
|
-
|
|
11
|
-
import * as s from './Button.css';
|
|
12
|
-
|
|
13
|
-
interface ButtonProps
|
|
14
|
-
extends Omit<UIComponent<'button', typeof s.button>, 'hasIcon'> {
|
|
15
|
-
icon?: ReactElement;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
19
|
-
(
|
|
20
|
-
{
|
|
21
|
-
children,
|
|
22
|
-
color = 'primary',
|
|
23
|
-
size = 'md',
|
|
24
|
-
variant = 'contained',
|
|
25
|
-
pulse = false,
|
|
26
|
-
className,
|
|
27
|
-
sx: propSx,
|
|
28
|
-
icon,
|
|
29
|
-
...props
|
|
30
|
-
},
|
|
31
|
-
ref,
|
|
32
|
-
) => {
|
|
33
|
-
const { ripple } = useRipple<HTMLButtonElement>(ref);
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<button
|
|
37
|
-
ref={ref}
|
|
38
|
-
className={clsx(
|
|
39
|
-
className,
|
|
40
|
-
s.button({
|
|
41
|
-
color,
|
|
42
|
-
size,
|
|
43
|
-
variant,
|
|
44
|
-
pulse,
|
|
45
|
-
hasIcon: icon !== undefined,
|
|
46
|
-
}),
|
|
47
|
-
sx(propSx),
|
|
48
|
-
)}
|
|
49
|
-
{...props}
|
|
50
|
-
>
|
|
51
|
-
{icon !== undefined && <span className={s.icon}>{icon}</span>}
|
|
52
|
-
<span className={s.span({ size })}>{children}</span>
|
|
53
|
-
{ripple}
|
|
54
|
-
</button>
|
|
55
|
-
);
|
|
56
|
-
},
|
|
57
|
-
);
|
|
58
|
-
Button.displayName = 'Button';
|
|
59
|
-
|
|
60
|
-
export { s as buttonCss };
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { recipeWithLayer, styleWithLayer } from '#styleUtils';
|
|
2
|
-
import { theme } from '#themes';
|
|
3
|
-
import { semanticColor } from '#tokens';
|
|
4
|
-
|
|
5
|
-
import { SCALE_COLOR, type ScaleColor } from '../../tokens/scale/color';
|
|
6
|
-
import { cardInteraction } from './CardInteraction.css';
|
|
7
|
-
|
|
8
|
-
const semanticColors = semanticColor.reduce(
|
|
9
|
-
(prev, color) => ({
|
|
10
|
-
...prev,
|
|
11
|
-
[color]: styleWithLayer({
|
|
12
|
-
backgroundColor: `rgb(${theme.color[color]})`,
|
|
13
|
-
}),
|
|
14
|
-
}),
|
|
15
|
-
{} as Record<(typeof semanticColor)[number], string>,
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
const scaleColors = SCALE_COLOR.reduce(
|
|
19
|
-
(prev, value) => ({
|
|
20
|
-
...prev,
|
|
21
|
-
[value]: styleWithLayer({
|
|
22
|
-
backgroundColor: `color-mix(in srgb, rgb(${theme.color[value][500]}) 20%, rgb(${theme.color.background}) 80%)`,
|
|
23
|
-
}),
|
|
24
|
-
}),
|
|
25
|
-
{} as Record<ScaleColor, string>,
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
export const card = recipeWithLayer({
|
|
29
|
-
base: {
|
|
30
|
-
display: 'flex',
|
|
31
|
-
flexDirection: 'column',
|
|
32
|
-
overflow: 'hidden',
|
|
33
|
-
position: 'relative',
|
|
34
|
-
|
|
35
|
-
borderRadius: theme.borderRadius,
|
|
36
|
-
|
|
37
|
-
color: `rgb(${theme.color.foreground})`,
|
|
38
|
-
|
|
39
|
-
transition: 'border-color 0.2s ease, transform 0.4s ease',
|
|
40
|
-
|
|
41
|
-
selectors: {
|
|
42
|
-
[`&:has(${cardInteraction}:hover)`]: {
|
|
43
|
-
borderColor: `color-mix(in srgb, rgb(${theme.color.primary}) 10%, rgb(${theme.color.border}) 90%)`,
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
[`&:has(${cardInteraction}:active)`]: {
|
|
47
|
-
borderColor: `color-mix(in srgb, rgb(${theme.color.primary}) 40%, rgb(${theme.color.border}) 60%)`,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
variants: {
|
|
52
|
-
variant: {
|
|
53
|
-
contained: {},
|
|
54
|
-
|
|
55
|
-
outlined: {
|
|
56
|
-
border: '1px solid',
|
|
57
|
-
borderColor: `rgb(${theme.color.border})`,
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
glass: {
|
|
61
|
-
border: `1px solid rgb(${theme.color['border.weak']})`,
|
|
62
|
-
borderRadius: '0.75rem',
|
|
63
|
-
|
|
64
|
-
background: `linear-gradient(rgba(${theme.color['card.gradient']}, 0.06) 0%, rgba(${theme.color['card.gradient']}, 0.02) 100%)`,
|
|
65
|
-
backdropFilter: 'blur(1rem)',
|
|
66
|
-
|
|
67
|
-
'::before': {
|
|
68
|
-
position: 'absolute',
|
|
69
|
-
inset: '0',
|
|
70
|
-
|
|
71
|
-
background:
|
|
72
|
-
'linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.05) 100%)',
|
|
73
|
-
|
|
74
|
-
opacity: '0',
|
|
75
|
-
transition: 'opacity 0.3s ease',
|
|
76
|
-
|
|
77
|
-
content: '',
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
selectors: {
|
|
81
|
-
'&:hover::before': {
|
|
82
|
-
opacity: '1',
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
color: {
|
|
89
|
-
...semanticColors,
|
|
90
|
-
...scaleColors,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { render, screen, fireEvent } from '@testing-library/react';
|
|
2
|
-
|
|
3
|
-
import { uiTest } from '../../tests/uiTest';
|
|
4
|
-
import { Card, CardContent, CardInteraction, CardThumbnail } from './';
|
|
5
|
-
|
|
6
|
-
describe('Card 컴포넌트', () => {
|
|
7
|
-
uiTest(Card, 'Card');
|
|
8
|
-
uiTest(CardContent, 'CardContent');
|
|
9
|
-
uiTest(CardInteraction, 'CardInteraction');
|
|
10
|
-
uiTest(CardThumbnail, 'CardThumbnail');
|
|
11
|
-
|
|
12
|
-
it('CardInteraction을 클릭하면 onClick이 호출되어야 한다', () => {
|
|
13
|
-
const handleClick = jest.fn();
|
|
14
|
-
render(
|
|
15
|
-
<Card onClick={handleClick}>
|
|
16
|
-
<CardInteraction>Click</CardInteraction>
|
|
17
|
-
</Card>,
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
fireEvent.click(screen.getByText('Click'));
|
|
21
|
-
|
|
22
|
-
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type CSSProperties } from 'react';
|
|
2
|
-
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
|
|
5
|
-
import { sx } from '#styles';
|
|
6
|
-
import type { UIComponent } from '#types';
|
|
7
|
-
|
|
8
|
-
import * as s from './Card.css';
|
|
9
|
-
|
|
10
|
-
interface CardProps extends UIComponent<'div', typeof s.card> {
|
|
11
|
-
width?: CSSProperties['width'];
|
|
12
|
-
height?: CSSProperties['height'];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const Card = forwardRef<HTMLDivElement, CardProps>(
|
|
16
|
-
(
|
|
17
|
-
{
|
|
18
|
-
width,
|
|
19
|
-
height,
|
|
20
|
-
color = 'card',
|
|
21
|
-
variant = 'outlined',
|
|
22
|
-
className,
|
|
23
|
-
style,
|
|
24
|
-
sx: propSx,
|
|
25
|
-
...props
|
|
26
|
-
},
|
|
27
|
-
ref,
|
|
28
|
-
) => {
|
|
29
|
-
return (
|
|
30
|
-
<div
|
|
31
|
-
ref={ref}
|
|
32
|
-
className={clsx(s.card({ color, variant }), className, sx(propSx))}
|
|
33
|
-
style={{ width, height, ...style }}
|
|
34
|
-
{...props}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
37
|
-
},
|
|
38
|
-
);
|
|
39
|
-
Card.displayName = 'Card';
|
|
40
|
-
|
|
41
|
-
export { s as cardCss };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
|
|
3
|
-
import { clsx } from 'clsx';
|
|
4
|
-
|
|
5
|
-
import { sx } from '#styles';
|
|
6
|
-
import type { UIComponent } from '#types';
|
|
7
|
-
|
|
8
|
-
import * as s from './CardContent.css';
|
|
9
|
-
|
|
10
|
-
type CardContentProps = UIComponent<'div'>;
|
|
11
|
-
|
|
12
|
-
export const CardContent = forwardRef<HTMLDivElement, CardContentProps>(
|
|
13
|
-
({ className, sx: propSx, ...props }, ref) => {
|
|
14
|
-
return (
|
|
15
|
-
<div
|
|
16
|
-
ref={ref}
|
|
17
|
-
className={clsx(s.cardContent, className, sx(propSx))}
|
|
18
|
-
{...props}
|
|
19
|
-
/>
|
|
20
|
-
);
|
|
21
|
-
},
|
|
22
|
-
);
|
|
23
|
-
CardContent.displayName = 'CardContent';
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
|
|
5
|
-
import clsx from 'clsx';
|
|
6
|
-
|
|
7
|
-
import { useRipple } from '#hooks';
|
|
8
|
-
import { sx } from '#styles';
|
|
9
|
-
import type { UIComponent } from '#types';
|
|
10
|
-
|
|
11
|
-
import * as s from './CardInteraction.css';
|
|
12
|
-
|
|
13
|
-
type CardInteractionProps = UIComponent<'div'>;
|
|
14
|
-
|
|
15
|
-
export const CardInteraction = forwardRef<HTMLDivElement, CardInteractionProps>(
|
|
16
|
-
({ children, className, sx: propSx, ...props }, ref) => {
|
|
17
|
-
const { ripple } = useRipple<HTMLDivElement>(ref);
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div
|
|
21
|
-
ref={ref}
|
|
22
|
-
className={clsx(
|
|
23
|
-
className,
|
|
24
|
-
s.cardInteraction,
|
|
25
|
-
s.cardInteraction,
|
|
26
|
-
sx(propSx),
|
|
27
|
-
)}
|
|
28
|
-
{...props}
|
|
29
|
-
>
|
|
30
|
-
{children}
|
|
31
|
-
{ripple}
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
},
|
|
35
|
-
);
|
|
36
|
-
CardInteraction.displayName = 'CardInteraction';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
|
|
5
|
-
import { sx } from '#styles';
|
|
6
|
-
import type { UIComponent } from '#types';
|
|
7
|
-
|
|
8
|
-
import * as s from './CardThumbnail.css';
|
|
9
|
-
|
|
10
|
-
type CardThumbnailProps = UIComponent<'img'>;
|
|
11
|
-
|
|
12
|
-
export const CardThumbnail = forwardRef<HTMLImageElement, CardThumbnailProps>(
|
|
13
|
-
({ className, sx: propSx, ...props }, ref) => {
|
|
14
|
-
return (
|
|
15
|
-
<img
|
|
16
|
-
ref={ref}
|
|
17
|
-
className={clsx(s.thumbnail, className, sx(propSx))}
|
|
18
|
-
{...props}
|
|
19
|
-
/>
|
|
20
|
-
);
|
|
21
|
-
},
|
|
22
|
-
);
|
|
23
|
-
CardThumbnail.displayName = 'CardThumbnail';
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { createVar } from '@vanilla-extract/css';
|
|
2
|
-
|
|
3
|
-
import { recipeWithLayer, styleWithLayer } from '#styleUtils';
|
|
4
|
-
import { theme } from '#themes';
|
|
5
|
-
import { semanticColor } from '#tokens';
|
|
6
|
-
|
|
7
|
-
import { SCALE_COLOR, type ScaleColor } from '../../tokens/scale/color';
|
|
8
|
-
|
|
9
|
-
const backgroundVar = createVar();
|
|
10
|
-
const foregroundVar = createVar();
|
|
11
|
-
|
|
12
|
-
const semanticColors = semanticColor.reduce(
|
|
13
|
-
(prev, color) => ({
|
|
14
|
-
...prev,
|
|
15
|
-
[color]: styleWithLayer({
|
|
16
|
-
vars: {
|
|
17
|
-
[backgroundVar]: theme.color[color],
|
|
18
|
-
[foregroundVar]: theme.color[`${color}-foreground`],
|
|
19
|
-
},
|
|
20
|
-
}),
|
|
21
|
-
}),
|
|
22
|
-
{} as Record<(typeof semanticColor)[number], string>,
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const scaleColors = SCALE_COLOR.reduce(
|
|
26
|
-
(prev, value) => ({
|
|
27
|
-
...prev,
|
|
28
|
-
[value]: styleWithLayer({
|
|
29
|
-
vars: {
|
|
30
|
-
[backgroundVar]: theme.color[value][500],
|
|
31
|
-
[foregroundVar]: theme.color[value][50],
|
|
32
|
-
},
|
|
33
|
-
}),
|
|
34
|
-
}),
|
|
35
|
-
{} as Record<ScaleColor, string>,
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
export const chip = recipeWithLayer({
|
|
39
|
-
base: {
|
|
40
|
-
display: 'inline-flex',
|
|
41
|
-
alignItems: 'center',
|
|
42
|
-
lineHeight: '0',
|
|
43
|
-
gap: '0.125em',
|
|
44
|
-
|
|
45
|
-
height: '2em',
|
|
46
|
-
padding: '0 0.75em',
|
|
47
|
-
borderRadius: theme.borderRadius,
|
|
48
|
-
|
|
49
|
-
backgroundColor: `rgb(${backgroundVar})`,
|
|
50
|
-
color: `rgb(${foregroundVar})`,
|
|
51
|
-
|
|
52
|
-
userSelect: 'none',
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
variants: {
|
|
56
|
-
color: {
|
|
57
|
-
...semanticColors,
|
|
58
|
-
...scaleColors,
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
size: {
|
|
62
|
-
sm: {
|
|
63
|
-
fontSize: '0.75em',
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
md: {
|
|
67
|
-
fontSize: '0.875em',
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
lg: {
|
|
71
|
-
fontSize: '1em',
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
|
|
5
|
-
import { sx } from '#styles';
|
|
6
|
-
import type { UIComponent } from '#types';
|
|
7
|
-
|
|
8
|
-
import * as s from './Chip.css';
|
|
9
|
-
|
|
10
|
-
type ChipProps = UIComponent<'div', typeof s.chip>;
|
|
11
|
-
|
|
12
|
-
export const Chip = forwardRef<HTMLDivElement, ChipProps>(
|
|
13
|
-
(
|
|
14
|
-
{
|
|
15
|
-
children,
|
|
16
|
-
className,
|
|
17
|
-
color = 'primary',
|
|
18
|
-
size = 'md',
|
|
19
|
-
sx: propSx,
|
|
20
|
-
...props
|
|
21
|
-
},
|
|
22
|
-
ref,
|
|
23
|
-
) => {
|
|
24
|
-
return (
|
|
25
|
-
<div
|
|
26
|
-
ref={ref}
|
|
27
|
-
className={clsx(s.chip({ color, size }), className, sx(propSx))}
|
|
28
|
-
{...props}
|
|
29
|
-
>
|
|
30
|
-
<span>{children}</span>
|
|
31
|
-
</div>
|
|
32
|
-
);
|
|
33
|
-
},
|
|
34
|
-
);
|
|
35
|
-
Chip.displayName = 'Chip';
|
|
36
|
-
|
|
37
|
-
export { s as chipCss };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Chip';
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useImperativeHandle, type ReactNode, type Ref } from 'react';
|
|
4
|
-
|
|
5
|
-
import { useOverlay, usePreventKeyboardInput } from '@kimdw-rtk/utils';
|
|
6
|
-
|
|
7
|
-
import { Box, Button, Dialog, DialogContent, DialogFooter } from '#components';
|
|
8
|
-
|
|
9
|
-
interface ConfirmProps {
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
ref?: Ref<{ close: () => void }>;
|
|
12
|
-
onConfirm: () => void;
|
|
13
|
-
onCancle: () => void;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const Confirm = ({
|
|
17
|
-
children,
|
|
18
|
-
ref,
|
|
19
|
-
onConfirm,
|
|
20
|
-
onCancle,
|
|
21
|
-
}: ConfirmProps) => {
|
|
22
|
-
const { close } = useOverlay();
|
|
23
|
-
usePreventKeyboardInput();
|
|
24
|
-
|
|
25
|
-
useImperativeHandle(ref, () => ({
|
|
26
|
-
close,
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<Dialog>
|
|
31
|
-
<DialogContent>{children}</DialogContent>
|
|
32
|
-
<DialogFooter>
|
|
33
|
-
<Box flex gap="md">
|
|
34
|
-
<Button size="sm" onClick={onConfirm}>
|
|
35
|
-
확인
|
|
36
|
-
</Button>
|
|
37
|
-
<Button color="secondary" size="sm" onClick={onCancle}>
|
|
38
|
-
취소
|
|
39
|
-
</Button>
|
|
40
|
-
</Box>
|
|
41
|
-
</DialogFooter>
|
|
42
|
-
</Dialog>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
|
|
3
|
-
import { theme } from '#themes';
|
|
4
|
-
|
|
5
|
-
export const container = style({
|
|
6
|
-
display: 'flex',
|
|
7
|
-
flexDirection: 'column',
|
|
8
|
-
gap: '1rem',
|
|
9
|
-
overflowY: 'auto',
|
|
10
|
-
|
|
11
|
-
maxWidth: 'calc(100vw - 2rem)',
|
|
12
|
-
minWidth: 'min(20rem, calc(100vw - 2rem))',
|
|
13
|
-
maxHeight: 'calc(100vh - 2rem)',
|
|
14
|
-
borderRadius: theme.borderRadius,
|
|
15
|
-
boxSizing: 'border-box',
|
|
16
|
-
|
|
17
|
-
backgroundColor: `rgb(${theme.color.background})`,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export const message = style({
|
|
21
|
-
marginBottom: '1rem',
|
|
22
|
-
|
|
23
|
-
lineHeight: '150%',
|
|
24
|
-
wordBreak: 'break-all',
|
|
25
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { render, screen, fireEvent } from '@testing-library/react';
|
|
2
|
-
|
|
3
|
-
import { Dialog, DialogContent, DialogFooter, DialogHeader } from '#components';
|
|
4
|
-
|
|
5
|
-
import { uiTest } from '../../tests/uiTest';
|
|
6
|
-
|
|
7
|
-
describe('Dialog 컴포넌트', () => {
|
|
8
|
-
uiTest(Dialog, 'Dialog');
|
|
9
|
-
uiTest(DialogHeader, 'DialogHeader');
|
|
10
|
-
uiTest(DialogContent, 'DialogContent');
|
|
11
|
-
uiTest(DialogFooter, 'DialogFooter');
|
|
12
|
-
|
|
13
|
-
it('DialogHeader의 닫기 버튼을 클릭하면 onCloseClick이 호출되어야 한다', () => {
|
|
14
|
-
const handleCloseClick = jest.fn();
|
|
15
|
-
render(
|
|
16
|
-
<Dialog>
|
|
17
|
-
<DialogHeader onCloseClick={handleCloseClick}>Header</DialogHeader>
|
|
18
|
-
<DialogContent>Content</DialogContent>
|
|
19
|
-
</Dialog>,
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
fireEvent.click(screen.getByRole('button', { name: '닫기' }));
|
|
23
|
-
|
|
24
|
-
expect(handleCloseClick).toHaveBeenCalledTimes(1);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
|
|
5
|
-
import { Box } from '#components';
|
|
6
|
-
import { sx } from '#styles';
|
|
7
|
-
import type { UIComponent } from '#types';
|
|
8
|
-
|
|
9
|
-
import * as s from './Dialog.css';
|
|
10
|
-
|
|
11
|
-
type DialogProps = Omit<UIComponent<'div'>, 'color'>;
|
|
12
|
-
|
|
13
|
-
export const Dialog = forwardRef<HTMLDivElement, DialogProps>(
|
|
14
|
-
({ children, className, sx: propSx, ...props }, ref) => {
|
|
15
|
-
return (
|
|
16
|
-
<Box
|
|
17
|
-
ref={ref}
|
|
18
|
-
flex
|
|
19
|
-
flexDirection="row"
|
|
20
|
-
gap="lg"
|
|
21
|
-
boxShadow="border-sm"
|
|
22
|
-
className={clsx(s.container, className, sx(propSx))}
|
|
23
|
-
{...props}
|
|
24
|
-
>
|
|
25
|
-
{children}
|
|
26
|
-
</Box>
|
|
27
|
-
);
|
|
28
|
-
},
|
|
29
|
-
);
|
|
30
|
-
Dialog.displayName = 'Dialog';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { styleWithLayer } from '#styleUtils';
|
|
2
|
-
import { theme } from '#themes';
|
|
3
|
-
|
|
4
|
-
import * as header from './DialogHeader.css';
|
|
5
|
-
|
|
6
|
-
export const container = styleWithLayer({
|
|
7
|
-
padding: '0 1.5rem 1.5rem 1.5rem',
|
|
8
|
-
|
|
9
|
-
wordBreak: 'break-all',
|
|
10
|
-
|
|
11
|
-
selectors: {
|
|
12
|
-
[`${header.container} + &`]: {
|
|
13
|
-
color: `rgb(${theme.color['muted-foreground']})`,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
|
|
5
|
-
import { Box } from '#components';
|
|
6
|
-
import { sx } from '#styles';
|
|
7
|
-
import type { UIComponent } from '#types';
|
|
8
|
-
|
|
9
|
-
import * as s from './DialogContent.css';
|
|
10
|
-
|
|
11
|
-
type DialogContentProps = Omit<UIComponent<'div'>, 'color'>;
|
|
12
|
-
|
|
13
|
-
export const DialogContent = forwardRef<HTMLDivElement, DialogContentProps>(
|
|
14
|
-
({ children, className, sx: propSx, ...props }, ref) => {
|
|
15
|
-
return (
|
|
16
|
-
<Box
|
|
17
|
-
ref={ref}
|
|
18
|
-
className={clsx(s.container, className, sx(propSx))}
|
|
19
|
-
{...props}
|
|
20
|
-
>
|
|
21
|
-
{children}
|
|
22
|
-
</Box>
|
|
23
|
-
);
|
|
24
|
-
},
|
|
25
|
-
);
|
|
26
|
-
DialogContent.displayName = 'DialogContent';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { styleWithLayer } from '#styleUtils';
|
|
2
|
-
|
|
3
|
-
export const container = styleWithLayer({
|
|
4
|
-
maxWidth: 'calc(100vw - 2rem)',
|
|
5
|
-
minWidth: 'min(20rem, calc(100vw - 2rem))',
|
|
6
|
-
padding: '1rem',
|
|
7
|
-
borderRadius: '0.25rem',
|
|
8
|
-
boxSizing: 'border-box',
|
|
9
|
-
|
|
10
|
-
backgroundColor: '#fff',
|
|
11
|
-
|
|
12
|
-
userSelect: 'none',
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const message = styleWithLayer({
|
|
16
|
-
marginBottom: '1rem',
|
|
17
|
-
|
|
18
|
-
lineHeight: '150%',
|
|
19
|
-
wordBreak: 'break-all',
|
|
20
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
|
|
5
|
-
import { Box } from '#components';
|
|
6
|
-
import { sx } from '#styles';
|
|
7
|
-
import type { UIComponent } from '#types';
|
|
8
|
-
|
|
9
|
-
type DialogFooterProps = Omit<UIComponent<'div'>, 'color'>;
|
|
10
|
-
|
|
11
|
-
export const DialogFooter = forwardRef<HTMLDivElement, DialogFooterProps>(
|
|
12
|
-
({ children, className, sx: propSx, ...props }, ref) => {
|
|
13
|
-
return (
|
|
14
|
-
<Box
|
|
15
|
-
ref={ref}
|
|
16
|
-
flex
|
|
17
|
-
justifyContent="flex-end"
|
|
18
|
-
className={clsx(className, sx(propSx))}
|
|
19
|
-
{...props}
|
|
20
|
-
>
|
|
21
|
-
{children}
|
|
22
|
-
</Box>
|
|
23
|
-
);
|
|
24
|
-
},
|
|
25
|
-
);
|
|
26
|
-
DialogFooter.displayName = 'DialogFooter';
|