@uniai-fe/uds-primitives 0.0.7 → 0.0.8
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 +64 -5
- package/dist/styles.css +236 -279
- package/package.json +4 -4
- package/src/components/badge/markup/Badge.tsx +10 -0
- package/src/components/badge/styles/index.scss +2 -2
- package/src/components/badge/types/index.ts +1 -1
- package/src/components/button/index.scss +3 -1
- package/src/components/button/index.tsx +9 -1
- package/src/components/button/markup/ButtonDefault.tsx +162 -0
- package/src/components/button/markup/ButtonRounded.tsx +48 -0
- package/src/components/button/markup/ButtonText.tsx +49 -0
- package/src/components/button/markup/index.ts +3 -0
- package/src/components/button/styles/{index.scss → button.scss} +148 -362
- package/src/components/button/styles/round-button.scss +56 -0
- package/src/components/button/styles/text-button.scss +96 -0
- package/src/components/button/types/index.ts +110 -35
- package/src/components/button/types/templates.ts +33 -0
- package/src/components/button/utils/index.ts +19 -19
- package/src/components/checkbox/markup/Checkbox.tsx +20 -2
- package/src/components/checkbox/types/checkbox.ts +16 -0
- package/src/components/chip/markup/Chip.tsx +8 -0
- package/src/components/dialog/markup/{confirm-dialog.tsx → ConfirmDialog.tsx} +23 -0
- package/src/components/dialog/markup/{notice-dialog.tsx → NoticeDialog.tsx} +18 -0
- package/src/components/dialog/markup/index.tsx +2 -2
- package/src/components/dialog/types/index.ts +43 -0
- package/src/components/drawer/markup/{drawer.tsx → Drawer.tsx} +58 -0
- package/src/components/drawer/markup/index.tsx +1 -1
- package/src/components/drawer/types/index.ts +24 -0
- package/src/components/input/markup/text/Base.tsx +32 -3
- package/src/components/input/markup/text/Identification.tsx +15 -2
- package/src/components/input/markup/text/Password.tsx +35 -2
- package/src/components/input/markup/text/Phone.tsx +38 -2
- package/src/components/input/markup/text/Search.tsx +30 -1
- package/src/components/input/styles/index.scss +6 -6
- package/src/components/input/types/index.ts +22 -1
- package/src/components/input/utils/index.ts +6 -0
- package/src/components/navigation/markup/mobile/BottomNavigation.tsx +11 -0
- package/src/components/navigation/types/index.ts +22 -0
- package/src/components/pagination/markup/Carousel.tsx +1 -0
- package/src/components/pagination/markup/Count.tsx +1 -0
- package/src/components/pagination/markup/Pagination.tsx +2 -0
- package/src/components/radio/markup/Radio.tsx +16 -2
- package/src/components/radio/markup/RadioCard.tsx +8 -0
- package/src/components/radio/markup/RadioCardGroup.tsx +8 -0
- package/src/components/radio/types/radio.ts +39 -0
- package/src/components/segmented-control/markup/SegmentedControl.tsx +12 -0
- package/src/components/segmented-control/types/index.ts +16 -0
- package/src/components/tab/markup/TabContent.tsx +5 -0
- package/src/components/tab/markup/TabList.tsx +19 -2
- package/src/components/tab/markup/TabRoot.tsx +50 -4
- package/src/components/tab/markup/TabTrigger.tsx +9 -1
- package/src/components/tab/styles/index.scss +28 -10
- package/src/components/tab/types/index.ts +10 -0
- package/src/components/tab/utils/tab-context.ts +8 -2
- package/src/components/button/markup/Button.tsx +0 -175
- package/src/components/button/markup/index.tsx +0 -1
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { Button as RadixButton } from "@radix-ui/themes";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import type { ComponentProps } from "react";
|
|
4
|
-
import type { ButtonProps } from "../types";
|
|
5
|
-
import { composeButtonClassName } from "../utils";
|
|
6
|
-
|
|
7
|
-
const BUTTON_INTENT_COLOR: Record<
|
|
8
|
-
NonNullable<ButtonProps["intent"]>,
|
|
9
|
-
NonNullable<ComponentProps<typeof RadixButton>["color"]>
|
|
10
|
-
> = {
|
|
11
|
-
primary: "blue",
|
|
12
|
-
secondary: "sky",
|
|
13
|
-
teritary: "gray",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const BUTTON_VARIANT_MAP: Record<
|
|
17
|
-
NonNullable<ButtonProps["variant"]>,
|
|
18
|
-
NonNullable<ComponentProps<typeof RadixButton>["variant"]>
|
|
19
|
-
> = {
|
|
20
|
-
solid: "solid",
|
|
21
|
-
outlined: "outline",
|
|
22
|
-
"text-button": "ghost",
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const BUTTON_SIZE_MAP: Record<
|
|
26
|
-
NonNullable<ButtonProps["size"]>,
|
|
27
|
-
NonNullable<ComponentProps<typeof RadixButton>["size"]>
|
|
28
|
-
> = {
|
|
29
|
-
xlarge: "4",
|
|
30
|
-
large: "3",
|
|
31
|
-
medium: "2",
|
|
32
|
-
small: "1",
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* 버튼 컴포넌트; Radix Theme 기반 범용 버튼
|
|
37
|
-
* @component
|
|
38
|
-
* @param {ButtonProps} props
|
|
39
|
-
* @param {ButtonVariant} [props.variant] solid / outlined / text-button
|
|
40
|
-
* @param {ButtonIntent} [props.intent] primary / secondary / teritary
|
|
41
|
-
* @param {ButtonSize} [props.size] small / medium / large / xlarge
|
|
42
|
-
* @param {ButtonShape} [props.shape] default / round
|
|
43
|
-
* @param {ButtonState} [props.state] default / readonly / disabled
|
|
44
|
-
* @param {boolean} [props.block] true면 width:100%
|
|
45
|
-
* @param {boolean} [props.loading] 로딩 상태 표시
|
|
46
|
-
* @param {ButtonIconSlot} [props.iconSlot] none / left / right
|
|
47
|
-
* @param {React.ReactNode} [props.icon] iconSlot에 표시할 아이콘
|
|
48
|
-
* @param {React.ReactElement} [props.prefix] 라벨 앞 slot
|
|
49
|
-
* @param {React.ReactElement} [props.suffix] 라벨 뒤 slot
|
|
50
|
-
* @param {React.ReactNode} [props.children] 버튼 라벨
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```tsx
|
|
54
|
-
* <Button variant="solid" intent="primary" icon={<Icon />} iconSlot="left">
|
|
55
|
-
* 저장
|
|
56
|
-
* </Button>
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
60
|
-
(
|
|
61
|
-
{
|
|
62
|
-
children,
|
|
63
|
-
icon,
|
|
64
|
-
prefix,
|
|
65
|
-
suffix,
|
|
66
|
-
iconSlot = "none",
|
|
67
|
-
variant = "solid",
|
|
68
|
-
intent = "primary",
|
|
69
|
-
size = "medium",
|
|
70
|
-
shape = "default",
|
|
71
|
-
state: stateProp = "default",
|
|
72
|
-
block = false,
|
|
73
|
-
loading = false,
|
|
74
|
-
className,
|
|
75
|
-
"data-simulated-state": simulatedState,
|
|
76
|
-
disabled: disabledProp,
|
|
77
|
-
type: typeProp,
|
|
78
|
-
...restProps
|
|
79
|
-
},
|
|
80
|
-
forwardedRef,
|
|
81
|
-
) => {
|
|
82
|
-
const normalizedChildren =
|
|
83
|
-
children === null || children === undefined ? null : typeof children ===
|
|
84
|
-
"string" || typeof children === "number" ? (
|
|
85
|
-
<span className="button-label" data-slot="label">
|
|
86
|
-
{children}
|
|
87
|
-
</span>
|
|
88
|
-
) : (
|
|
89
|
-
children
|
|
90
|
-
);
|
|
91
|
-
const resolvedState = disabledProp ? "disabled" : stateProp;
|
|
92
|
-
const isReadonly = resolvedState === "readonly";
|
|
93
|
-
const isDisabled = resolvedState === "disabled" || isReadonly;
|
|
94
|
-
const isIconOnly =
|
|
95
|
-
Boolean(icon) &&
|
|
96
|
-
iconSlot !== "none" &&
|
|
97
|
-
!normalizedChildren &&
|
|
98
|
-
!prefix &&
|
|
99
|
-
!suffix;
|
|
100
|
-
const combinedClassName = composeButtonClassName({
|
|
101
|
-
variant,
|
|
102
|
-
intent,
|
|
103
|
-
size,
|
|
104
|
-
shape,
|
|
105
|
-
block,
|
|
106
|
-
loading,
|
|
107
|
-
iconSlot,
|
|
108
|
-
iconOnly: isIconOnly,
|
|
109
|
-
state: resolvedState,
|
|
110
|
-
className,
|
|
111
|
-
});
|
|
112
|
-
const content = (
|
|
113
|
-
<>
|
|
114
|
-
{prefix ? (
|
|
115
|
-
<span className="button-prefix" data-slot="prefix">
|
|
116
|
-
{prefix}
|
|
117
|
-
</span>
|
|
118
|
-
) : null}
|
|
119
|
-
{iconSlot === "left" && icon ? (
|
|
120
|
-
<span className="button-icon" data-slot="left">
|
|
121
|
-
{icon}
|
|
122
|
-
</span>
|
|
123
|
-
) : null}
|
|
124
|
-
{normalizedChildren}
|
|
125
|
-
{iconSlot === "right" && icon ? (
|
|
126
|
-
<span className="button-icon" data-slot="right">
|
|
127
|
-
{icon}
|
|
128
|
-
</span>
|
|
129
|
-
) : null}
|
|
130
|
-
{suffix ? (
|
|
131
|
-
<span className="button-suffix" data-slot="suffix">
|
|
132
|
-
{suffix}
|
|
133
|
-
</span>
|
|
134
|
-
) : null}
|
|
135
|
-
</>
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
return (
|
|
139
|
-
<RadixButton
|
|
140
|
-
{...restProps}
|
|
141
|
-
ref={forwardedRef}
|
|
142
|
-
variant={BUTTON_VARIANT_MAP[variant]}
|
|
143
|
-
color={BUTTON_INTENT_COLOR[intent]}
|
|
144
|
-
size={BUTTON_SIZE_MAP[size]}
|
|
145
|
-
radius={shape === "round" ? "full" : "medium"}
|
|
146
|
-
highContrast={false}
|
|
147
|
-
loading={loading}
|
|
148
|
-
disabled={isDisabled}
|
|
149
|
-
aria-busy={loading || undefined}
|
|
150
|
-
aria-disabled={isReadonly ? true : undefined}
|
|
151
|
-
type={typeProp ?? "button"}
|
|
152
|
-
className={combinedClassName}
|
|
153
|
-
data-variant={variant}
|
|
154
|
-
data-intent={intent}
|
|
155
|
-
data-size={size}
|
|
156
|
-
data-shape={shape}
|
|
157
|
-
data-state={resolvedState}
|
|
158
|
-
data-block={block ? "true" : undefined}
|
|
159
|
-
data-disabled={isDisabled ? "true" : undefined}
|
|
160
|
-
data-loading={loading ? "true" : undefined}
|
|
161
|
-
data-icon-slot={iconSlot}
|
|
162
|
-
data-icon-only={isIconOnly ? "true" : undefined}
|
|
163
|
-
data-prefix={prefix ? "true" : undefined}
|
|
164
|
-
data-suffix={suffix ? "true" : undefined}
|
|
165
|
-
data-simulated-state={simulatedState}
|
|
166
|
-
>
|
|
167
|
-
{content}
|
|
168
|
-
</RadixButton>
|
|
169
|
-
);
|
|
170
|
-
},
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
Button.displayName = "Button";
|
|
174
|
-
|
|
175
|
-
export { Button };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Button } from "./Button";
|