@uniai-fe/uds-primitives 0.0.1
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/README.md +63 -0
- package/package.json +85 -0
- package/src/components/alternate/hooks/index.ts +4 -0
- package/src/components/alternate/img/.gitkeep +0 -0
- package/src/components/alternate/index.scss +1 -0
- package/src/components/alternate/index.tsx +4 -0
- package/src/components/alternate/markup/index.tsx +4 -0
- package/src/components/alternate/styles/index.scss +3 -0
- package/src/components/alternate/types/index.ts +4 -0
- package/src/components/alternate/utils/index.ts +4 -0
- package/src/components/badge/hooks/index.ts +4 -0
- package/src/components/badge/img/.gitkeep +0 -0
- package/src/components/badge/index.scss +1 -0
- package/src/components/badge/index.tsx +6 -0
- package/src/components/badge/markup/Badge.tsx +51 -0
- package/src/components/badge/markup/index.tsx +1 -0
- package/src/components/badge/styles/index.scss +189 -0
- package/src/components/badge/types/index.ts +55 -0
- package/src/components/badge/utils/index.ts +21 -0
- package/src/components/button/hooks/index.ts +4 -0
- package/src/components/button/img/.gitkeep +0 -0
- package/src/components/button/index.scss +1 -0
- package/src/components/button/index.tsx +6 -0
- package/src/components/button/markup/Button.tsx +175 -0
- package/src/components/button/markup/index.tsx +1 -0
- package/src/components/button/styles/index.scss +847 -0
- package/src/components/button/types/index.ts +79 -0
- package/src/components/button/utils/index.ts +58 -0
- package/src/components/calendar/hooks/index.ts +4 -0
- package/src/components/calendar/img/.gitkeep +0 -0
- package/src/components/calendar/index.scss +1 -0
- package/src/components/calendar/index.tsx +4 -0
- package/src/components/calendar/markup/index.tsx +4 -0
- package/src/components/calendar/styles/index.scss +3 -0
- package/src/components/calendar/types/index.ts +4 -0
- package/src/components/calendar/utils/index.ts +4 -0
- package/src/components/checkbox/hooks/index.ts +4 -0
- package/src/components/checkbox/img/.gitkeep +0 -0
- package/src/components/checkbox/img/check-large.svg +3 -0
- package/src/components/checkbox/img/check-medium.svg +3 -0
- package/src/components/checkbox/img/check.svg +3 -0
- package/src/components/checkbox/index.scss +1 -0
- package/src/components/checkbox/index.tsx +4 -0
- package/src/components/checkbox/markup/Checkbox.tsx +127 -0
- package/src/components/checkbox/markup/index.ts +1 -0
- package/src/components/checkbox/styles/index.scss +164 -0
- package/src/components/checkbox/types/checkbox.ts +21 -0
- package/src/components/checkbox/types/index.ts +1 -0
- package/src/components/chip/hooks/index.ts +4 -0
- package/src/components/chip/img/.gitkeep +0 -0
- package/src/components/chip/img/remove.svg +3 -0
- package/src/components/chip/index.scss +1 -0
- package/src/components/chip/index.tsx +6 -0
- package/src/components/chip/markup/Chip.tsx +103 -0
- package/src/components/chip/markup/index.tsx +1 -0
- package/src/components/chip/styles/index.scss +140 -0
- package/src/components/chip/types/index.ts +52 -0
- package/src/components/chip/utils/index.ts +36 -0
- package/src/components/dialog/hooks/index.ts +4 -0
- package/src/components/dialog/img/.gitkeep +0 -0
- package/src/components/dialog/index.scss +1 -0
- package/src/components/dialog/index.tsx +3 -0
- package/src/components/dialog/markup/confirm-dialog.tsx +316 -0
- package/src/components/dialog/markup/index.tsx +4 -0
- package/src/components/dialog/markup/notice-dialog.tsx +191 -0
- package/src/components/dialog/styles/base.scss +153 -0
- package/src/components/dialog/styles/confirm.scss +58 -0
- package/src/components/dialog/styles/index.scss +3 -0
- package/src/components/dialog/styles/notice.scss +65 -0
- package/src/components/dialog/types/index.ts +70 -0
- package/src/components/dialog/utils/index.ts +4 -0
- package/src/components/drawer/hooks/index.ts +113 -0
- package/src/components/drawer/img/.gitkeep +0 -0
- package/src/components/drawer/img/close.svg +3 -0
- package/src/components/drawer/index.scss +1 -0
- package/src/components/drawer/index.tsx +3 -0
- package/src/components/drawer/markup/drawer.tsx +421 -0
- package/src/components/drawer/markup/index.tsx +3 -0
- package/src/components/drawer/styles/index.scss +232 -0
- package/src/components/drawer/types/index.ts +51 -0
- package/src/components/drawer/utils/context.ts +15 -0
- package/src/components/drawer/utils/index.tsx +77 -0
- package/src/components/dropdown/hooks/index.ts +4 -0
- package/src/components/dropdown/img/.gitkeep +0 -0
- package/src/components/dropdown/index.scss +1 -0
- package/src/components/dropdown/index.tsx +4 -0
- package/src/components/dropdown/markup/index.tsx +4 -0
- package/src/components/dropdown/styles/index.scss +3 -0
- package/src/components/dropdown/types/index.ts +4 -0
- package/src/components/dropdown/utils/index.ts +4 -0
- package/src/components/input/hooks/index.ts +4 -0
- package/src/components/input/img/.gitkeep +0 -0
- package/src/components/input/img/check-correct.svg +3 -0
- package/src/components/input/img/check-default.svg +3 -0
- package/src/components/input/img/check-incorrect.svg +3 -0
- package/src/components/input/img/error.svg +5 -0
- package/src/components/input/img/hide-off.svg +4 -0
- package/src/components/input/img/hide-on.svg +6 -0
- package/src/components/input/img/reset.svg +3 -0
- package/src/components/input/img/search.svg +4 -0
- package/src/components/input/img/success.svg +3 -0
- package/src/components/input/index.scss +1 -0
- package/src/components/input/index.tsx +6 -0
- package/src/components/input/markup/index.tsx +1 -0
- package/src/components/input/markup/text/Base.tsx +311 -0
- package/src/components/input/markup/text/Identification.tsx +145 -0
- package/src/components/input/markup/text/Password.tsx +71 -0
- package/src/components/input/markup/text/Phone.tsx +115 -0
- package/src/components/input/markup/text/Search.tsx +35 -0
- package/src/components/input/markup/text/index.ts +10 -0
- package/src/components/input/styles/index.scss +375 -0
- package/src/components/input/types/index.ts +56 -0
- package/src/components/input/utils/index.ts +54 -0
- package/src/components/label/hooks/index.ts +4 -0
- package/src/components/label/img/.gitkeep +0 -0
- package/src/components/label/index.scss +1 -0
- package/src/components/label/index.tsx +4 -0
- package/src/components/label/markup/index.tsx +4 -0
- package/src/components/label/styles/index.scss +3 -0
- package/src/components/label/types/index.ts +4 -0
- package/src/components/label/utils/index.ts +4 -0
- package/src/components/navigation/hooks/index.ts +4 -0
- package/src/components/navigation/img/.gitkeep +0 -0
- package/src/components/navigation/index.scss +1 -0
- package/src/components/navigation/index.tsx +8 -0
- package/src/components/navigation/markup/index.tsx +2 -0
- package/src/components/navigation/markup/mobile/BottomNavigation.tsx +127 -0
- package/src/components/navigation/markup/mobile/index.ts +1 -0
- package/src/components/navigation/markup/web/index.ts +4 -0
- package/src/components/navigation/styles/index.scss +133 -0
- package/src/components/navigation/types/index.ts +38 -0
- package/src/components/navigation/utils/index.ts +23 -0
- package/src/components/pagination/hooks/index.ts +4 -0
- package/src/components/pagination/img/.gitkeep +0 -0
- package/src/components/pagination/index.scss +1 -0
- package/src/components/pagination/index.tsx +6 -0
- package/src/components/pagination/markup/Carousel.tsx +76 -0
- package/src/components/pagination/markup/Count.tsx +54 -0
- package/src/components/pagination/markup/Pagination.tsx +83 -0
- package/src/components/pagination/markup/index.tsx +3 -0
- package/src/components/pagination/styles/index.scss +155 -0
- package/src/components/pagination/types/index.ts +68 -0
- package/src/components/pagination/utils/index.ts +58 -0
- package/src/components/radio/hooks/index.ts +4 -0
- package/src/components/radio/img/.gitkeep +0 -0
- package/src/components/radio/index.scss +1 -0
- package/src/components/radio/index.tsx +7 -0
- package/src/components/radio/markup/Radio.tsx +121 -0
- package/src/components/radio/markup/RadioCard.tsx +68 -0
- package/src/components/radio/markup/RadioCardGroup.tsx +75 -0
- package/src/components/radio/markup/index.tsx +3 -0
- package/src/components/radio/styles/index.scss +252 -0
- package/src/components/radio/types/index.ts +1 -0
- package/src/components/radio/types/radio.ts +63 -0
- package/src/components/radio/utils/index.ts +4 -0
- package/src/components/scrollbar/hooks/index.ts +4 -0
- package/src/components/scrollbar/img/.gitkeep +0 -0
- package/src/components/scrollbar/index.scss +1 -0
- package/src/components/scrollbar/index.tsx +4 -0
- package/src/components/scrollbar/markup/index.tsx +4 -0
- package/src/components/scrollbar/styles/index.scss +3 -0
- package/src/components/scrollbar/types/index.ts +4 -0
- package/src/components/scrollbar/utils/index.ts +4 -0
- package/src/components/segmented-control/index.scss +1 -0
- package/src/components/segmented-control/index.tsx +7 -0
- package/src/components/segmented-control/markup/SegmentedControl.tsx +117 -0
- package/src/components/segmented-control/markup/index.ts +1 -0
- package/src/components/segmented-control/styles/index.scss +113 -0
- package/src/components/segmented-control/types/index.ts +22 -0
- package/src/components/select/hooks/index.ts +4 -0
- package/src/components/select/img/.gitkeep +0 -0
- package/src/components/select/index.scss +1 -0
- package/src/components/select/index.tsx +4 -0
- package/src/components/select/markup/index.tsx +4 -0
- package/src/components/select/styles/index.scss +3 -0
- package/src/components/select/types/index.ts +4 -0
- package/src/components/select/utils/index.ts +4 -0
- package/src/components/spinner/hooks/index.ts +4 -0
- package/src/components/spinner/img/.gitkeep +0 -0
- package/src/components/spinner/index.scss +1 -0
- package/src/components/spinner/index.tsx +4 -0
- package/src/components/spinner/markup/index.tsx +4 -0
- package/src/components/spinner/styles/index.scss +3 -0
- package/src/components/spinner/types/index.ts +4 -0
- package/src/components/spinner/utils/index.ts +4 -0
- package/src/components/tab/hooks/index.ts +4 -0
- package/src/components/tab/img/.gitkeep +0 -0
- package/src/components/tab/index.scss +1 -0
- package/src/components/tab/index.tsx +6 -0
- package/src/components/tab/markup/TabContent.tsx +29 -0
- package/src/components/tab/markup/TabList.tsx +60 -0
- package/src/components/tab/markup/TabRoot.tsx +74 -0
- package/src/components/tab/markup/TabTrigger.tsx +47 -0
- package/src/components/tab/markup/index.tsx +4 -0
- package/src/components/tab/styles/index.scss +182 -0
- package/src/components/tab/types/index.ts +46 -0
- package/src/components/tab/utils/index.ts +5 -0
- package/src/components/tab/utils/tab-context.ts +20 -0
- package/src/components/table/hooks/index.ts +4 -0
- package/src/components/table/img/.gitkeep +0 -0
- package/src/components/table/index.scss +1 -0
- package/src/components/table/index.tsx +4 -0
- package/src/components/table/markup/index.tsx +4 -0
- package/src/components/table/styles/index.scss +3 -0
- package/src/components/table/types/index.ts +4 -0
- package/src/components/table/utils/index.ts +4 -0
- package/src/hooks/index.ts +4 -0
- package/src/img/.gitkeep +0 -0
- package/src/index.scss +3 -0
- package/src/index.tsx +26 -0
- package/src/init/dayjs.ts +14 -0
- package/src/theme/ThemeProvider.tsx +25 -0
- package/src/theme/config.ts +29 -0
- package/src/theme/index.ts +3 -0
- package/src/theme/overrides.scss +215 -0
- package/src/types/index.ts +4 -0
- package/src/utils/index.ts +4 -0
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@use "./styles/index.scss";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import type { TabContentProps } from "../types";
|
|
5
|
+
import { useTabContext } from "../utils";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* TabContent: trigger와 동일한 data attr을 전달해 스타일 일관성을 유지한다.
|
|
9
|
+
*/
|
|
10
|
+
const TabContent = forwardRef<HTMLDivElement, TabContentProps>(
|
|
11
|
+
({ className, children, ...restProps }, forwardedRef) => {
|
|
12
|
+
const { variant } = useTabContext();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<TabsPrimitive.Content
|
|
16
|
+
{...restProps}
|
|
17
|
+
ref={forwardedRef}
|
|
18
|
+
className={clsx("tab-content", className)}
|
|
19
|
+
data-variant={variant}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
</TabsPrimitive.Content>
|
|
23
|
+
);
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
TabContent.displayName = "TabContent";
|
|
28
|
+
|
|
29
|
+
export { TabContent };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { forwardRef, useEffect, useMemo } from "react";
|
|
4
|
+
import type { CSSProperties } from "react";
|
|
5
|
+
import type { TabListProps } from "../types";
|
|
6
|
+
import { useTabContext, DEFAULT_TAB_CONTEXT_VALUE } from "../utils";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* TabList: Tab trigger container with variant/tone propagation.
|
|
10
|
+
*/
|
|
11
|
+
const TabList = forwardRef<HTMLDivElement, TabListProps>(
|
|
12
|
+
(
|
|
13
|
+
{
|
|
14
|
+
variant,
|
|
15
|
+
color,
|
|
16
|
+
fullWidth = false,
|
|
17
|
+
className,
|
|
18
|
+
children,
|
|
19
|
+
style,
|
|
20
|
+
...restProps
|
|
21
|
+
},
|
|
22
|
+
forwardedRef,
|
|
23
|
+
) => {
|
|
24
|
+
const parentContext = useTabContext();
|
|
25
|
+
const resolvedVariant =
|
|
26
|
+
variant ?? parentContext.variant ?? DEFAULT_TAB_CONTEXT_VALUE.variant;
|
|
27
|
+
const resolvedColor =
|
|
28
|
+
color ?? parentContext.color ?? DEFAULT_TAB_CONTEXT_VALUE.color;
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
parentContext.setVariantColor?.(resolvedVariant, resolvedColor);
|
|
32
|
+
}, [parentContext, resolvedVariant, resolvedColor]);
|
|
33
|
+
|
|
34
|
+
const listStyle = useMemo<CSSProperties>(
|
|
35
|
+
() => ({
|
|
36
|
+
...(style ?? {}),
|
|
37
|
+
"--tab-color-active": resolvedColor,
|
|
38
|
+
}),
|
|
39
|
+
[style, resolvedColor],
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<TabsPrimitive.List
|
|
44
|
+
{...restProps}
|
|
45
|
+
ref={forwardedRef}
|
|
46
|
+
className={clsx("tab-list", className)}
|
|
47
|
+
data-variant={resolvedVariant}
|
|
48
|
+
data-full-width={fullWidth ? "true" : undefined}
|
|
49
|
+
data-color={resolvedColor}
|
|
50
|
+
style={listStyle}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
</TabsPrimitive.List>
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
TabList.displayName = "TabList";
|
|
59
|
+
|
|
60
|
+
export { TabList };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { forwardRef, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import type { CSSProperties } from "react";
|
|
5
|
+
import type { TabRootProps } from "../types";
|
|
6
|
+
import { TabContext, DEFAULT_TAB_CONTEXT_VALUE } from "../utils";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* TabRoot: TabsPrimitive.Root thin wrapper with tab data context.
|
|
10
|
+
*/
|
|
11
|
+
const TabRoot = forwardRef<HTMLDivElement, TabRootProps>(
|
|
12
|
+
(
|
|
13
|
+
{
|
|
14
|
+
variant: variantProp = DEFAULT_TAB_CONTEXT_VALUE.variant,
|
|
15
|
+
color: colorProp = DEFAULT_TAB_CONTEXT_VALUE.color,
|
|
16
|
+
className,
|
|
17
|
+
children,
|
|
18
|
+
style,
|
|
19
|
+
...restProps
|
|
20
|
+
},
|
|
21
|
+
forwardedRef,
|
|
22
|
+
) => {
|
|
23
|
+
const [variant, setVariant] = useState(variantProp);
|
|
24
|
+
const [color, setColor] = useState(colorProp);
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setVariant(variantProp);
|
|
28
|
+
}, [variantProp]);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setColor(colorProp);
|
|
32
|
+
}, [colorProp]);
|
|
33
|
+
|
|
34
|
+
const contextValue = useMemo(
|
|
35
|
+
() => ({
|
|
36
|
+
variant,
|
|
37
|
+
color,
|
|
38
|
+
setVariantColor: (
|
|
39
|
+
nextVariant: typeof variant,
|
|
40
|
+
nextColor: typeof color,
|
|
41
|
+
) => {
|
|
42
|
+
setVariant(nextVariant);
|
|
43
|
+
setColor(nextColor);
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
[variant, color],
|
|
47
|
+
);
|
|
48
|
+
const rootStyle = useMemo<CSSProperties>(
|
|
49
|
+
() => ({
|
|
50
|
+
...(style ?? {}),
|
|
51
|
+
"--tab-color-active": color,
|
|
52
|
+
}),
|
|
53
|
+
[style, color],
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<TabContext.Provider value={contextValue}>
|
|
58
|
+
<TabsPrimitive.Root
|
|
59
|
+
{...restProps}
|
|
60
|
+
ref={forwardedRef}
|
|
61
|
+
className={clsx("tab-root", className)}
|
|
62
|
+
data-variant={variant}
|
|
63
|
+
style={rootStyle}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
</TabsPrimitive.Root>
|
|
67
|
+
</TabContext.Provider>
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
TabRoot.displayName = "TabRoot";
|
|
73
|
+
|
|
74
|
+
export { TabRoot };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import type { ReactNode } from "react";
|
|
5
|
+
import type { TabTriggerProps } from "../types";
|
|
6
|
+
import { useTabContext } from "../utils";
|
|
7
|
+
|
|
8
|
+
const wrapLabel = (children: ReactNode) => {
|
|
9
|
+
if (children === null || children === undefined) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (typeof children === "string" || typeof children === "number") {
|
|
14
|
+
return <span className="tab-trigger-label">{children}</span>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return children;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* TabTrigger: 개별 탭 버튼. icon slot을 지원한다.
|
|
22
|
+
*/
|
|
23
|
+
const TabTrigger = forwardRef<HTMLButtonElement, TabTriggerProps>(
|
|
24
|
+
({ icon, children, className, ...restProps }, forwardedRef) => {
|
|
25
|
+
const { variant } = useTabContext();
|
|
26
|
+
const hasIcon = Boolean(icon);
|
|
27
|
+
const normalizedChildren = wrapLabel(children);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<TabsPrimitive.Trigger
|
|
31
|
+
{...restProps}
|
|
32
|
+
ref={forwardedRef}
|
|
33
|
+
className={clsx("tab-trigger", className)}
|
|
34
|
+
data-variant={variant}
|
|
35
|
+
data-has-icon={hasIcon ? "true" : undefined}
|
|
36
|
+
data-disabled={restProps.disabled ? "true" : undefined}
|
|
37
|
+
>
|
|
38
|
+
{icon ? <span className="tab-trigger-icon">{icon}</span> : null}
|
|
39
|
+
{normalizedChildren}
|
|
40
|
+
</TabsPrimitive.Trigger>
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
TabTrigger.displayName = "TabTrigger";
|
|
46
|
+
|
|
47
|
+
export { TabTrigger };
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
@use "@uniai-fe/uds-foundation/css";
|
|
2
|
+
|
|
3
|
+
.tab-root {
|
|
4
|
+
/* Figma node 694:4619 측정값을 CSS 변수로 고정해 Storybook과 실 서비스 간 시각 편차를 줄인다. */
|
|
5
|
+
--tab-label-font-size: var(--font-heading-xsmall-size, 17px);
|
|
6
|
+
--tab-label-font-weight: var(--font-heading-xsmall-weight, 600);
|
|
7
|
+
--tab-label-line-height: var(--font-heading-xsmall-line-height, 1.5em);
|
|
8
|
+
--tab-label-letter-spacing: var(--font-heading-xsmall-letter-spacing, 0px);
|
|
9
|
+
--tab-gap: 10px;
|
|
10
|
+
--tab-padding-y: 10px;
|
|
11
|
+
--tab-padding-x: 20px;
|
|
12
|
+
--tab-icon-gap: 6px;
|
|
13
|
+
--tab-line-track-color: var(
|
|
14
|
+
--color-border-divider,
|
|
15
|
+
var(--color-cool-gray-85)
|
|
16
|
+
);
|
|
17
|
+
--tab-line-track-height: 1.6px;
|
|
18
|
+
--tab-line-indicator-height: 2px;
|
|
19
|
+
--tab-color-active-default: #1a6aff;
|
|
20
|
+
--tab-color-active: var(--tab-color-active-default);
|
|
21
|
+
--tab-color-hover: color-mix(in srgb, var(--tab-color-active), #000 15%);
|
|
22
|
+
--tab-line-hover-color: var(--tab-color-hover, var(--tab-color-active));
|
|
23
|
+
--tab-fill-hover-bg: var(--color-bg-alternative-cool-gray, #f2f2f3);
|
|
24
|
+
--tab-fill-active-color: var(--color-common-100, #ffffff);
|
|
25
|
+
--tab-inactive-color: var(--color-label-alternative, #afb1b6);
|
|
26
|
+
--tab-disabled-opacity: 0.4;
|
|
27
|
+
width: 100%;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
gap: var(--spacing-gap-3);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.tab-list {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: stretch;
|
|
36
|
+
gap: var(--tab-gap);
|
|
37
|
+
width: fit-content;
|
|
38
|
+
overflow-x: auto;
|
|
39
|
+
scrollbar-width: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.tab-list::-webkit-scrollbar {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.tab-list:where([data-full-width="true"]) {
|
|
47
|
+
width: 100%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.tab-trigger {
|
|
51
|
+
position: relative;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
gap: var(--tab-icon-gap);
|
|
56
|
+
padding: var(--tab-padding-y) var(--tab-padding-x);
|
|
57
|
+
background: transparent;
|
|
58
|
+
border: none;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
transition: background-color 0.2s ease;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.tab-trigger:where(:focus-visible) {
|
|
64
|
+
outline: 2px solid var(--color-focus-ring, var(--color-primary-default));
|
|
65
|
+
outline-offset: 2px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.tab-trigger:where([data-disabled="true"]) {
|
|
69
|
+
cursor: not-allowed;
|
|
70
|
+
opacity: var(--tab-disabled-opacity);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.tab-trigger-icon {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.tab-trigger-label {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
font-size: var(--tab-label-font-size);
|
|
84
|
+
font-weight: var(--tab-label-font-weight);
|
|
85
|
+
line-height: var(--tab-label-line-height);
|
|
86
|
+
letter-spacing: var(--tab-label-letter-spacing);
|
|
87
|
+
color: var(--tab-inactive-color);
|
|
88
|
+
transition: color 0.2s ease;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.tab-list:where([data-variant="line"]) {
|
|
92
|
+
position: relative;
|
|
93
|
+
width: 100%;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.tab-list:where([data-variant="line"])::before {
|
|
97
|
+
content: "";
|
|
98
|
+
position: absolute;
|
|
99
|
+
inset: auto 0 0;
|
|
100
|
+
height: var(--tab-line-track-height, 1px);
|
|
101
|
+
background: var(--tab-line-track-color);
|
|
102
|
+
z-index: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.tab-list:where([data-variant="line"][data-full-width="true"]) > .tab-trigger {
|
|
106
|
+
flex: 1;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.tab-trigger:where([data-variant="line"])::after {
|
|
110
|
+
content: "";
|
|
111
|
+
position: absolute;
|
|
112
|
+
left: 0;
|
|
113
|
+
right: 0;
|
|
114
|
+
bottom: -1px;
|
|
115
|
+
height: var(--tab-line-indicator-height, 2px);
|
|
116
|
+
background: transparent;
|
|
117
|
+
transform: scaleX(0);
|
|
118
|
+
transform-origin: center;
|
|
119
|
+
z-index: 1;
|
|
120
|
+
transition:
|
|
121
|
+
transform 0.2s ease,
|
|
122
|
+
background-color 0.2s ease;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.tab-trigger:where([data-variant="line"][data-state="active"])
|
|
126
|
+
.tab-trigger-label {
|
|
127
|
+
color: var(--tab-color-active);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.tab-trigger:where([data-variant="line"][data-state="active"])::after {
|
|
131
|
+
background: var(--tab-color-active);
|
|
132
|
+
transform: scaleX(1);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.tab-trigger:where([data-variant="line"]):where(
|
|
136
|
+
:not([data-state="active"])
|
|
137
|
+
):hover
|
|
138
|
+
.tab-trigger-label {
|
|
139
|
+
color: var(--tab-line-hover-color);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.tab-list:where([data-variant="fill"]) {
|
|
143
|
+
width: fit-content;
|
|
144
|
+
border: none;
|
|
145
|
+
background: transparent;
|
|
146
|
+
border-radius: 0;
|
|
147
|
+
gap: 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.tab-list:where([data-variant="fill"][data-full-width="true"]) {
|
|
151
|
+
width: 100%;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.tab-list:where([data-variant="fill"][data-full-width="true"]) > .tab-trigger {
|
|
155
|
+
flex: 1;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.tab-trigger:where([data-variant="fill"]) {
|
|
159
|
+
border-radius: 12px;
|
|
160
|
+
min-width: 0;
|
|
161
|
+
padding: var(--tab-padding-y) var(--tab-padding-x);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.tab-trigger:where([data-variant="fill"][data-state="active"]) {
|
|
165
|
+
background: var(--tab-color-active);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.tab-trigger:where([data-variant="fill"][data-state="active"])
|
|
169
|
+
.tab-trigger-label {
|
|
170
|
+
color: var(--tab-fill-active-color);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.tab-trigger:where([data-variant="fill"]):where(
|
|
174
|
+
:not([data-state="active"])
|
|
175
|
+
):hover {
|
|
176
|
+
background: var(--tab-fill-hover-bg);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.tab-content {
|
|
180
|
+
display: block;
|
|
181
|
+
padding: var(--spacing-padding-6) 0;
|
|
182
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
TabsContentProps,
|
|
3
|
+
TabsListProps,
|
|
4
|
+
TabsProps,
|
|
5
|
+
TabsTriggerProps,
|
|
6
|
+
} from "@radix-ui/react-tabs";
|
|
7
|
+
import type { ReactNode } from "react";
|
|
8
|
+
|
|
9
|
+
export const TAB_VARIANTS = ["line", "fill"] as const;
|
|
10
|
+
|
|
11
|
+
export type TabVariant = (typeof TAB_VARIANTS)[number];
|
|
12
|
+
|
|
13
|
+
export interface TabRootProps extends TabsProps {
|
|
14
|
+
/**
|
|
15
|
+
* line / fill 스타일 토글. 기본 line.
|
|
16
|
+
*/
|
|
17
|
+
variant?: TabVariant;
|
|
18
|
+
/**
|
|
19
|
+
* 활성 색상(hex, rgba, css 변수 등). 지정하지 않으면 기본 블루.
|
|
20
|
+
*/
|
|
21
|
+
color?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TabListProps extends TabsListProps {
|
|
25
|
+
/**
|
|
26
|
+
* 루트와 동일한 variant를 재지정할 수 있다.
|
|
27
|
+
*/
|
|
28
|
+
variant?: TabVariant;
|
|
29
|
+
/**
|
|
30
|
+
* 리스트 단위 활성 색상 지정.
|
|
31
|
+
*/
|
|
32
|
+
color?: string;
|
|
33
|
+
/**
|
|
34
|
+
* true면 trigger들이 flex:1로 균등 분배된다.
|
|
35
|
+
*/
|
|
36
|
+
fullWidth?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface TabTriggerProps extends TabsTriggerProps {
|
|
40
|
+
/**
|
|
41
|
+
* label 앞에 표시할 아이콘.
|
|
42
|
+
*/
|
|
43
|
+
icon?: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type TabContentProps = TabsContentProps;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import type { TabVariant } from "../types";
|
|
3
|
+
|
|
4
|
+
interface TabContextValue {
|
|
5
|
+
variant: TabVariant;
|
|
6
|
+
color: string;
|
|
7
|
+
setVariantColor?: (nextVariant: TabVariant, nextColor: string) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const DEFAULT_TAB_CONTEXT_VALUE: TabContextValue = {
|
|
11
|
+
variant: "line",
|
|
12
|
+
color: "var(--tab-color-active-default, #1a6aff)",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const TabContext = createContext<TabContextValue>(DEFAULT_TAB_CONTEXT_VALUE);
|
|
16
|
+
|
|
17
|
+
const useTabContext = () => useContext(TabContext);
|
|
18
|
+
|
|
19
|
+
export { TabContext, useTabContext, DEFAULT_TAB_CONTEXT_VALUE };
|
|
20
|
+
export type { TabContextValue };
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@use "./styles/index.scss";
|
package/src/img/.gitkeep
ADDED
|
File without changes
|
package/src/index.scss
ADDED
package/src/index.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// dayjs 초기화를 가장 먼저 수행해 날짜 계열 컴포넌트가 동일 컨텍스트를 사용한다.
|
|
2
|
+
import "./init/dayjs";
|
|
3
|
+
|
|
4
|
+
export * from "./theme";
|
|
5
|
+
|
|
6
|
+
// 루트 배럴: 카테고리별 export를 집계한다.
|
|
7
|
+
export * from "./components/button";
|
|
8
|
+
export * from "./components/label";
|
|
9
|
+
export * from "./components/input";
|
|
10
|
+
export * from "./components/checkbox";
|
|
11
|
+
export * from "./components/radio";
|
|
12
|
+
export * from "./components/select";
|
|
13
|
+
export * from "./components/tab";
|
|
14
|
+
export * from "./components/navigation";
|
|
15
|
+
export * from "./components/dialog";
|
|
16
|
+
export * from "./components/dropdown";
|
|
17
|
+
export * from "./components/drawer";
|
|
18
|
+
export * from "./components/scrollbar";
|
|
19
|
+
export * from "./components/calendar";
|
|
20
|
+
export * from "./components/pagination";
|
|
21
|
+
export * from "./components/table";
|
|
22
|
+
export * from "./components/chip";
|
|
23
|
+
export * from "./components/badge";
|
|
24
|
+
export * from "./components/spinner";
|
|
25
|
+
export * from "./components/alternate";
|
|
26
|
+
export * from "./components/segmented-control";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// dayjs 플러그인/locale을 한 번만 초기화해 Mantine Calendar에서 동일한 포맷을 사용한다.
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import utc from "dayjs/plugin/utc";
|
|
4
|
+
import timezone from "dayjs/plugin/timezone";
|
|
5
|
+
import localizedFormat from "dayjs/plugin/localizedFormat";
|
|
6
|
+
import "dayjs/locale/ko";
|
|
7
|
+
|
|
8
|
+
dayjs.extend(utc);
|
|
9
|
+
dayjs.extend(timezone);
|
|
10
|
+
dayjs.extend(localizedFormat);
|
|
11
|
+
dayjs.locale("ko");
|
|
12
|
+
|
|
13
|
+
// 필요 시 컴포넌트에서 동일 인스턴스를 사용하도록 재노출한다.
|
|
14
|
+
export { dayjs };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Theme } from "@radix-ui/themes";
|
|
2
|
+
import "@radix-ui/themes/styles.css";
|
|
3
|
+
import "@uniai-fe/uds-foundation/css";
|
|
4
|
+
import type { PropsWithChildren } from "react";
|
|
5
|
+
import "./overrides.scss";
|
|
6
|
+
import { defaultThemeOptions, type ThemeProviderProps } from "./config";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Radix Theme와 foundation 토큰을 한 번에 초기화하는 Provider.
|
|
10
|
+
* Storybook 데코레이터 및 애플리케이션 루트에서 활용한다.
|
|
11
|
+
*/
|
|
12
|
+
function ThemeProvider({
|
|
13
|
+
children,
|
|
14
|
+
theme = defaultThemeOptions,
|
|
15
|
+
className,
|
|
16
|
+
}: PropsWithChildren<ThemeProviderProps>) {
|
|
17
|
+
const composedClass = className ?? "theme-root";
|
|
18
|
+
return (
|
|
19
|
+
<Theme {...theme} className={composedClass}>
|
|
20
|
+
{children}
|
|
21
|
+
</Theme>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { ThemeProvider };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ThemeProps } from "@radix-ui/themes";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Radix Theme 설정 옵션. foundation 토큰과 매핑할 예정이므로
|
|
5
|
+
* appearance/accentColor 등은 추후 토큰 담당자와 확정 후 업데이트한다.
|
|
6
|
+
*/
|
|
7
|
+
export type ThemeOptions = ThemeProps;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* foundation 토큰 → Radix Theme 옵션 초기 매핑.
|
|
11
|
+
* 현재는 Radix Theme 기본 키를 사용하고, CSS override(`overrides.scss`)에서
|
|
12
|
+
* 실제 색상/폰트/간격 값을 foundation 토큰으로 덮어쓴다.
|
|
13
|
+
*/
|
|
14
|
+
export const defaultThemeOptions: ThemeOptions = {
|
|
15
|
+
appearance: "light",
|
|
16
|
+
accentColor: "blue",
|
|
17
|
+
grayColor: "gray",
|
|
18
|
+
scaling: "95%",
|
|
19
|
+
radius: "medium",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Theme Provider에 전달할 props 타입.
|
|
24
|
+
* `children`은 React node이며, `theme`를 전달하지 않으면 `defaultThemeOptions`가 사용된다.
|
|
25
|
+
*/
|
|
26
|
+
export type ThemeProviderProps = {
|
|
27
|
+
theme?: ThemeOptions;
|
|
28
|
+
className?: string;
|
|
29
|
+
};
|