@kimdw-rtk/ui 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.
- package/.babelrc +12 -0
- package/.turbo/turbo-check-types.log +2 -0
- package/.turbo/turbo-lint.log +12 -0
- package/.turbo/turbo-test.log +4084 -0
- package/.vscode/settings.json +4 -0
- package/eslint.config.mjs +4 -0
- package/jest.config.json +10 -0
- package/jest.setup.js +2 -0
- package/package.json +53 -0
- package/src/components/Accordion/Accordion.css.ts +29 -0
- package/src/components/Accordion/Accordion.spec.tsx +6 -0
- package/src/components/Accordion/Accordion.tsx +44 -0
- package/src/components/Accordion/AccordionContent.css.ts +29 -0
- package/src/components/Accordion/AccordionContent.tsx +87 -0
- package/src/components/Accordion/AccordionContext.ts +9 -0
- package/src/components/Accordion/AccordionTrigger.css.ts +46 -0
- package/src/components/Accordion/AccordionTrigger.tsx +41 -0
- package/src/components/Accordion/index.ts +3 -0
- package/src/components/Alert/index.tsx +25 -0
- package/src/components/Box/Box.css.ts +18 -0
- package/src/components/Box/Box.spec.tsx +6 -0
- package/src/components/Box/index.tsx +41 -0
- package/src/components/Button/Button.css.ts +241 -0
- package/src/components/Button/Button.spec.tsx +30 -0
- package/src/components/Button/index.tsx +60 -0
- package/src/components/Card/Card.css.ts +93 -0
- package/src/components/Card/Card.spec.tsx +24 -0
- package/src/components/Card/Card.tsx +41 -0
- package/src/components/Card/CardContent.css.ts +8 -0
- package/src/components/Card/CardContent.tsx +23 -0
- package/src/components/Card/CardInteraction.css.ts +11 -0
- package/src/components/Card/CardInteraction.tsx +36 -0
- package/src/components/Card/CardThumbnail.css.ts +6 -0
- package/src/components/Card/CardThumbnail.tsx +23 -0
- package/src/components/Card/index.ts +4 -0
- package/src/components/Chip/Chip.css.ts +75 -0
- package/src/components/Chip/Chip.spec.tsx +6 -0
- package/src/components/Chip/Chip.tsx +37 -0
- package/src/components/Chip/index.ts +1 -0
- package/src/components/Confirm/index.tsx +44 -0
- package/src/components/Dialog/Dialog.css.ts +25 -0
- package/src/components/Dialog/Dialog.spec.tsx +26 -0
- package/src/components/Dialog/Dialog.tsx +30 -0
- package/src/components/Dialog/DialogContent.css.ts +16 -0
- package/src/components/Dialog/DialogContent.tsx +26 -0
- package/src/components/Dialog/DialogFooter.css.ts +20 -0
- package/src/components/Dialog/DialogFooter.tsx +26 -0
- package/src/components/Dialog/DialogHeader.css.ts +31 -0
- package/src/components/Dialog/DialogHeader.tsx +37 -0
- package/src/components/Dialog/index.ts +4 -0
- package/src/components/Navigation/Navigation.spec.tsx +19 -0
- package/src/components/Navigation/NavigationAside.css.ts +7 -0
- package/src/components/Navigation/NavigationAside.tsx +23 -0
- package/src/components/Navigation/NavigationBar.css.ts +42 -0
- package/src/components/Navigation/NavigationBar.tsx +25 -0
- package/src/components/Navigation/NavigationContainer.css.ts +11 -0
- package/src/components/Navigation/NavigationContainer.tsx +26 -0
- package/src/components/Navigation/NavigationDrawer.css.ts +61 -0
- package/src/components/Navigation/NavigationDrawer.tsx +67 -0
- package/src/components/Navigation/NavigationItem.css.ts +43 -0
- package/src/components/Navigation/NavigationItem.tsx +24 -0
- package/src/components/Navigation/NavigationLogo.css.ts +5 -0
- package/src/components/Navigation/NavigationLogo.tsx +28 -0
- package/src/components/Navigation/NavigationMenu.css.ts +23 -0
- package/src/components/Navigation/NavigationMenu.tsx +25 -0
- package/src/components/Navigation/index.ts +7 -0
- package/src/components/Range/Range.css.ts +132 -0
- package/src/components/Range/Range.spec.tsx +6 -0
- package/src/components/Range/Range.tsx +90 -0
- package/src/components/Range/index.ts +1 -0
- package/src/components/ScrollArea/ScrollArea.css.ts +40 -0
- package/src/components/ScrollArea/ScrollArea.spec.tsx +6 -0
- package/src/components/ScrollArea/ScrollArea.tsx +68 -0
- package/src/components/ScrollArea/index.ts +1 -0
- package/src/components/Select/Select.css.ts +22 -0
- package/src/components/Select/Select.spec.tsx +65 -0
- package/src/components/Select/Select.tsx +111 -0
- package/src/components/Select/SelectContext.ts +59 -0
- package/src/components/Select/SelectOption.css.ts +14 -0
- package/src/components/Select/SelectOption.tsx +40 -0
- package/src/components/Select/SelectOptionList.css.ts +68 -0
- package/src/components/Select/SelectOptionList.tsx +59 -0
- package/src/components/Select/SelectTrigger.css.ts +73 -0
- package/src/components/Select/SelectTrigger.tsx +49 -0
- package/src/components/Select/index.tsx +2 -0
- package/src/components/Skeleton/Skeleton.css.ts +26 -0
- package/src/components/Skeleton/Skeleton.spec.tsx +6 -0
- package/src/components/Skeleton/index.tsx +27 -0
- package/src/components/Table/Table.css.ts +10 -0
- package/src/components/Table/Table.spec.tsx +12 -0
- package/src/components/Table/Table.tsx +27 -0
- package/src/components/Table/TableBody.tsx +14 -0
- package/src/components/Table/TableCell.css.ts +43 -0
- package/src/components/Table/TableCell.tsx +30 -0
- package/src/components/Table/TableHead.css.ts +10 -0
- package/src/components/Table/TableHead.tsx +30 -0
- package/src/components/Table/TableHeader.tsx +14 -0
- package/src/components/Table/TableRow.css.ts +3 -0
- package/src/components/Table/TableRow.tsx +24 -0
- package/src/components/Table/index.ts +6 -0
- package/src/components/Tabs/Tabs.spec.tsx +46 -0
- package/src/components/Tabs/Tabs.tsx +34 -0
- package/src/components/Tabs/TabsContent.tsx +32 -0
- package/src/components/Tabs/TabsList.css.ts +11 -0
- package/src/components/Tabs/TabsList.tsx +25 -0
- package/src/components/Tabs/TabsProvider.tsx +17 -0
- package/src/components/Tabs/TabsTrigger.css.ts +38 -0
- package/src/components/Tabs/TabsTrigger.tsx +43 -0
- package/src/components/Tabs/index.ts +4 -0
- package/src/components/TextField/TextField.css.ts +81 -0
- package/src/components/TextField/TextField.spec.tsx +6 -0
- package/src/components/TextField/index.tsx +38 -0
- package/src/components/Toast/Toast.css.ts +79 -0
- package/src/components/Toast/Toast.spec.tsx +6 -0
- package/src/components/Toast/index.tsx +48 -0
- package/src/components/Typography/Typography.css.ts +17 -0
- package/src/components/Typography/Typography.spec.tsx +35 -0
- package/src/components/Typography/index.tsx +57 -0
- package/src/components/index.ts +18 -0
- package/src/contexts/UIProvider.tsx +30 -0
- package/src/contexts/index.ts +1 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/useDialog/index.tsx +51 -0
- package/src/hooks/useDialog/useDialog.spec.tsx +80 -0
- package/src/hooks/useMouseScroll/index.ts +63 -0
- package/src/hooks/usePointerSlider/index.ts +79 -0
- package/src/hooks/useRipple/index.tsx +152 -0
- package/src/hooks/useRipple/ripple.css.ts +40 -0
- package/src/hooks/useToast/ToastContainer.css.ts +12 -0
- package/src/hooks/useToast/ToastContainer.tsx +11 -0
- package/src/hooks/useToast/ToastProvider.tsx +131 -0
- package/src/hooks/useToast/index.ts +15 -0
- package/src/index.ts +8 -0
- package/src/styles/globalStyle.css.ts +36 -0
- package/src/styles/index.ts +4 -0
- package/src/styles/layers.css.ts +4 -0
- package/src/styles/overlay.css.ts +40 -0
- package/src/styles/sprinkles.css.ts +149 -0
- package/src/styles/sx.ts +13 -0
- package/src/tests/uiTest.tsx +54 -0
- package/src/themes/darkTheme.css.ts +30 -0
- package/src/themes/index.ts +3 -0
- package/src/themes/lightTheme.css.ts +30 -0
- package/src/themes/theme.css.ts +32 -0
- package/src/tokens/index.ts +5 -0
- package/src/tokens/scale/color.ts +604 -0
- package/src/tokens/semantic/breakpoint.ts +6 -0
- package/src/tokens/semantic/color.ts +10 -0
- package/src/tokens/semantic/spacing.ts +9 -0
- package/src/tokens/semantic/typography.ts +32 -0
- package/src/types/index.ts +1 -0
- package/src/types/ui.types.ts +26 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/sprinklesUtils.ts +28 -0
- package/src/utils/styleUtils.css.ts +109 -0
- package/tsconfig.json +11 -0
- package/turbo/generators/config.ts +30 -0
- package/turbo/generators/templates/component.hbs +8 -0
package/jest.config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"testEnvironment": "jsdom",
|
|
3
|
+
"setupFilesAfterEnv": ["<rootDir>/jest.setup.js"],
|
|
4
|
+
"transform": {
|
|
5
|
+
"\\.css\\.ts$": "@vanilla-extract/jest-transform",
|
|
6
|
+
"^.+\\.(ts|tsx)?$": "ts-jest",
|
|
7
|
+
"^.+\\.[t|j]sx?$": "babel-jest"
|
|
8
|
+
},
|
|
9
|
+
"testPathIgnorePatterns": ["/node_modules/", "/dist/"]
|
|
10
|
+
}
|
package/jest.setup.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kimdw-rtk/ui",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"imports": {
|
|
7
|
+
"#*": "./src/*/index.ts",
|
|
8
|
+
"#styleUtils": "./src/utils/styleUtils.css.ts"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./src/index.ts",
|
|
12
|
+
"./*": "./src/*/index.ts"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@vanilla-extract/css": "^1.17.0",
|
|
16
|
+
"@vanilla-extract/dynamic": "^2.1.0",
|
|
17
|
+
"@vanilla-extract/recipes": "^0.5.0",
|
|
18
|
+
"@vanilla-extract/sprinkles": "^1.6.0",
|
|
19
|
+
"clsx": "^2.1.0",
|
|
20
|
+
"lucide-react": "^0.503.0"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
24
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
25
|
+
"@kimdw-rtk/utils": "0.1.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@babel/preset-env": "^7.26.9",
|
|
29
|
+
"@babel/preset-react": "^7.26.3",
|
|
30
|
+
"@babel/preset-typescript": "^7.27.0",
|
|
31
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
32
|
+
"@testing-library/react": "^16.3.0",
|
|
33
|
+
"@turbo/gen": "^2.4.4",
|
|
34
|
+
"@types/jest": "^29.5.14",
|
|
35
|
+
"@types/node": "^22.13.10",
|
|
36
|
+
"@types/react": "^18.0.0 || ^19.0.0",
|
|
37
|
+
"@types/react-dom": "^18.0.0 || ^19.0.0",
|
|
38
|
+
"@vanilla-extract/jest-transform": "^1.1.14",
|
|
39
|
+
"eslint": "^9.22.0",
|
|
40
|
+
"jest": "^29.7.0",
|
|
41
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
42
|
+
"ts-jest": "^29.3.4",
|
|
43
|
+
"typescript": "5.8.2",
|
|
44
|
+
"@repo/eslint-config": "0.0.0",
|
|
45
|
+
"@repo/typescript-config": "0.0.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"lint": "eslint . --max-warnings 0",
|
|
49
|
+
"generate:component": "turbo gen react-component",
|
|
50
|
+
"check-types": "tsc --noEmit",
|
|
51
|
+
"test": "jest --verbose"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createVar } from '@vanilla-extract/css';
|
|
2
|
+
|
|
3
|
+
import { recipeWithLayer } from '#styleUtils';
|
|
4
|
+
import { theme } from '#themes';
|
|
5
|
+
|
|
6
|
+
export const paddingVar = createVar();
|
|
7
|
+
|
|
8
|
+
export const accordion = recipeWithLayer({
|
|
9
|
+
base: {
|
|
10
|
+
width: '100%',
|
|
11
|
+
borderBottom: `1px solid rgb(${theme.color.border})`,
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
variants: {
|
|
15
|
+
isPadding: {
|
|
16
|
+
true: {
|
|
17
|
+
vars: {
|
|
18
|
+
[paddingVar]: '0.75em',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
false: {
|
|
23
|
+
vars: {
|
|
24
|
+
[paddingVar]: '0.75em 0',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useReducer } from 'react';
|
|
4
|
+
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
|
|
7
|
+
import { sx } from '#styles';
|
|
8
|
+
import type { UIComponent } from '#types';
|
|
9
|
+
|
|
10
|
+
import * as s from './Accordion.css';
|
|
11
|
+
import { AccordionContext, accordionReducer } from './AccordionContext';
|
|
12
|
+
|
|
13
|
+
interface AccordionProps extends UIComponent<'div', typeof s.accordion> {
|
|
14
|
+
isExpanded?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Accordion = forwardRef<HTMLDivElement, AccordionProps>(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
isPadding = true,
|
|
23
|
+
isExpanded: initIsExpaned = false,
|
|
24
|
+
sx: propSx,
|
|
25
|
+
...props
|
|
26
|
+
},
|
|
27
|
+
ref,
|
|
28
|
+
) => {
|
|
29
|
+
const [isExpanded, dispatch] = useReducer(accordionReducer, initIsExpaned);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
ref={ref}
|
|
34
|
+
className={clsx(s.accordion({ isPadding }), className, sx(propSx))}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
<AccordionContext.Provider value={{ isExpanded, dispatch }}>
|
|
38
|
+
{children}
|
|
39
|
+
</AccordionContext.Provider>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
Accordion.displayName = 'Accordion';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { recipeWithLayer, styleWithLayer } from '#styleUtils';
|
|
2
|
+
|
|
3
|
+
import { paddingVar } from './Accordion.css';
|
|
4
|
+
|
|
5
|
+
export const container = recipeWithLayer({
|
|
6
|
+
base: {
|
|
7
|
+
overflow: 'hidden',
|
|
8
|
+
|
|
9
|
+
transition: 'height 0.2s ease, opacity 0.2s ease',
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
variants: {
|
|
13
|
+
isExpanded: {
|
|
14
|
+
true: {
|
|
15
|
+
opacity: '1',
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
false: {
|
|
19
|
+
height: '0',
|
|
20
|
+
|
|
21
|
+
opacity: '0',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const inner = styleWithLayer({
|
|
28
|
+
padding: paddingVar,
|
|
29
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type ReactNode,
|
|
5
|
+
useContext,
|
|
6
|
+
useEffect,
|
|
7
|
+
useLayoutEffect,
|
|
8
|
+
useRef,
|
|
9
|
+
} from 'react';
|
|
10
|
+
|
|
11
|
+
import * as s from './AccordionContent.css';
|
|
12
|
+
import { AccordionContext } from './AccordionContext';
|
|
13
|
+
|
|
14
|
+
interface AccordionContentProps {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const AccordionContent = ({ children }: AccordionContentProps) => {
|
|
19
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
20
|
+
const accordionContext = useContext(AccordionContext);
|
|
21
|
+
const initRef = useRef<boolean>(true);
|
|
22
|
+
|
|
23
|
+
if (!accordionContext) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
'AccordionContent must be used within an Accordion component.',
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const { isExpanded } = accordionContext;
|
|
30
|
+
|
|
31
|
+
useLayoutEffect(() => {
|
|
32
|
+
const container = containerRef.current;
|
|
33
|
+
if (!container) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!isExpanded) {
|
|
38
|
+
container.style.height = `${container.scrollHeight}px`;
|
|
39
|
+
container.className = s.container({ isExpanded });
|
|
40
|
+
//eslint-disable-next-line
|
|
41
|
+
container.offsetTop;
|
|
42
|
+
container.style.height = '0';
|
|
43
|
+
initRef.current = false;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (initRef.current) {
|
|
48
|
+
container.style.height = 'auto';
|
|
49
|
+
} else {
|
|
50
|
+
container.style.height = `${container.scrollHeight}px`;
|
|
51
|
+
}
|
|
52
|
+
container.className = s.container({ isExpanded });
|
|
53
|
+
|
|
54
|
+
initRef.current = false;
|
|
55
|
+
}, [isExpanded]);
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const container = containerRef.current;
|
|
59
|
+
if (!container) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const handleTransitionEnd = (e: TransitionEvent) => {
|
|
64
|
+
if (
|
|
65
|
+
e.target !== container ||
|
|
66
|
+
e.propertyName !== 'height' ||
|
|
67
|
+
!isExpanded
|
|
68
|
+
) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
container.style.height = 'auto';
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
container.addEventListener('transitionend', handleTransitionEnd);
|
|
76
|
+
|
|
77
|
+
return () => {
|
|
78
|
+
container.removeEventListener('transitionend', handleTransitionEnd);
|
|
79
|
+
};
|
|
80
|
+
}, [containerRef, isExpanded]);
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<div ref={containerRef} className={s.container({ isExpanded })}>
|
|
84
|
+
<div className={s.inner}>{children}</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext, type Dispatch } from 'react';
|
|
2
|
+
|
|
3
|
+
export const AccordionContext = createContext<
|
|
4
|
+
{ isExpanded: boolean; dispatch: Dispatch<boolean> } | undefined
|
|
5
|
+
>(undefined);
|
|
6
|
+
|
|
7
|
+
export const accordionReducer = (_: boolean, action: boolean) => {
|
|
8
|
+
return action;
|
|
9
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { recipeWithLayer } from '#styleUtils';
|
|
2
|
+
|
|
3
|
+
import { paddingVar } from './Accordion.css';
|
|
4
|
+
|
|
5
|
+
export const triggerContainer = recipeWithLayer({
|
|
6
|
+
base: {
|
|
7
|
+
display: 'flex',
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
gap: '0.25em',
|
|
10
|
+
|
|
11
|
+
width: '100%',
|
|
12
|
+
padding: paddingVar,
|
|
13
|
+
|
|
14
|
+
cursor: 'pointer',
|
|
15
|
+
|
|
16
|
+
':hover': {
|
|
17
|
+
textDecoration: 'underline',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
variants: {
|
|
21
|
+
iconPosition: {
|
|
22
|
+
text: {},
|
|
23
|
+
right: {
|
|
24
|
+
justifyContent: 'space-between',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const arrow = recipeWithLayer({
|
|
31
|
+
base: {
|
|
32
|
+
lineHeight: '0',
|
|
33
|
+
|
|
34
|
+
transition: 'transform 0.2s ease',
|
|
35
|
+
},
|
|
36
|
+
variants: {
|
|
37
|
+
expand: {
|
|
38
|
+
true: {
|
|
39
|
+
transform: 'rotate(-180deg)',
|
|
40
|
+
},
|
|
41
|
+
false: {
|
|
42
|
+
transform: 'rotate(0)',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type ReactNode, useContext } from 'react';
|
|
4
|
+
|
|
5
|
+
import { ChevronDownIcon } from 'lucide-react';
|
|
6
|
+
|
|
7
|
+
import { AccordionContext } from './AccordionContext';
|
|
8
|
+
import * as s from './AccordionTrigger.css';
|
|
9
|
+
|
|
10
|
+
interface AccordionTriggerProps {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
iconPosition?: 'text' | 'right';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const AccordionTrigger = ({
|
|
16
|
+
children,
|
|
17
|
+
iconPosition = 'right',
|
|
18
|
+
}: AccordionTriggerProps) => {
|
|
19
|
+
const accordionContext = useContext(AccordionContext);
|
|
20
|
+
|
|
21
|
+
if (!accordionContext) {
|
|
22
|
+
throw new Error(
|
|
23
|
+
'AccordionTrigger must be used within an Accordion component.',
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { dispatch, isExpanded } = accordionContext;
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
className={s.triggerContainer({ iconPosition })}
|
|
32
|
+
aria-expanded={isExpanded}
|
|
33
|
+
onClick={() => dispatch(!isExpanded)}
|
|
34
|
+
>
|
|
35
|
+
<span>{children}</span>
|
|
36
|
+
<span className={s.arrow({ expand: isExpanded })}>
|
|
37
|
+
<ChevronDownIcon size="1em" />
|
|
38
|
+
</span>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useOverlay, usePreventKeyboardInput } from '@kimdw-rtk/utils';
|
|
4
|
+
|
|
5
|
+
import { Button, Dialog, DialogContent, DialogFooter } from '#components';
|
|
6
|
+
|
|
7
|
+
interface AlertProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Alert = ({ children }: AlertProps) => {
|
|
12
|
+
const { close } = useOverlay();
|
|
13
|
+
usePreventKeyboardInput();
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Dialog>
|
|
17
|
+
<DialogContent>{children}</DialogContent>
|
|
18
|
+
<DialogFooter>
|
|
19
|
+
<Button size="sm" onClick={close}>
|
|
20
|
+
확인
|
|
21
|
+
</Button>
|
|
22
|
+
</DialogFooter>
|
|
23
|
+
</Dialog>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { recipeWithLayer } from '#styleUtils';
|
|
2
|
+
import { theme } from '#themes';
|
|
3
|
+
|
|
4
|
+
export const box = recipeWithLayer({
|
|
5
|
+
variants: {
|
|
6
|
+
flex: {
|
|
7
|
+
true: {
|
|
8
|
+
display: 'flex',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
rounded: {
|
|
13
|
+
true: {
|
|
14
|
+
borderRadius: theme.borderRadius,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
|
|
5
|
+
import { sprinkles, sx, type SprinklesProps } from '#styles';
|
|
6
|
+
import type { UIComponent } from '#types';
|
|
7
|
+
import { filterSprinkles, omitSprinkles } from '#utils';
|
|
8
|
+
|
|
9
|
+
import * as s from './Box.css';
|
|
10
|
+
|
|
11
|
+
type BoxProps = UIComponent<'div', typeof s.box> & SprinklesProps;
|
|
12
|
+
|
|
13
|
+
export const Box = forwardRef<HTMLDivElement, BoxProps>(
|
|
14
|
+
(
|
|
15
|
+
{
|
|
16
|
+
children,
|
|
17
|
+
flex = false,
|
|
18
|
+
rounded = false,
|
|
19
|
+
className,
|
|
20
|
+
sx: propSx,
|
|
21
|
+
...props
|
|
22
|
+
},
|
|
23
|
+
ref,
|
|
24
|
+
) => {
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
ref={ref}
|
|
28
|
+
className={clsx(
|
|
29
|
+
className,
|
|
30
|
+
s.box({ flex, rounded }),
|
|
31
|
+
sx(propSx),
|
|
32
|
+
sprinkles(filterSprinkles(props)),
|
|
33
|
+
)}
|
|
34
|
+
{...omitSprinkles(props)}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
Box.displayName = 'Box';
|