@uniai-fe/uds-primitives 0.0.6 → 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.
Files changed (60) hide show
  1. package/README.md +126 -3
  2. package/dist/styles.css +3571 -0
  3. package/package.json +20 -8
  4. package/src/components/badge/markup/Badge.tsx +10 -0
  5. package/src/components/badge/styles/index.scss +2 -2
  6. package/src/components/badge/types/index.ts +1 -1
  7. package/src/components/button/index.scss +3 -1
  8. package/src/components/button/index.tsx +9 -1
  9. package/src/components/button/markup/ButtonDefault.tsx +162 -0
  10. package/src/components/button/markup/ButtonRounded.tsx +48 -0
  11. package/src/components/button/markup/ButtonText.tsx +49 -0
  12. package/src/components/button/markup/index.ts +3 -0
  13. package/src/components/button/styles/{index.scss → button.scss} +148 -362
  14. package/src/components/button/styles/round-button.scss +56 -0
  15. package/src/components/button/styles/text-button.scss +96 -0
  16. package/src/components/button/types/index.ts +110 -35
  17. package/src/components/button/types/templates.ts +33 -0
  18. package/src/components/button/utils/index.ts +19 -19
  19. package/src/components/checkbox/markup/Checkbox.tsx +20 -2
  20. package/src/components/checkbox/types/checkbox.ts +16 -0
  21. package/src/components/chip/markup/Chip.tsx +8 -0
  22. package/src/components/dialog/markup/{confirm-dialog.tsx → ConfirmDialog.tsx} +23 -0
  23. package/src/components/dialog/markup/{notice-dialog.tsx → NoticeDialog.tsx} +18 -0
  24. package/src/components/dialog/markup/index.tsx +2 -2
  25. package/src/components/dialog/types/index.ts +43 -0
  26. package/src/components/drawer/markup/{drawer.tsx → Drawer.tsx} +58 -0
  27. package/src/components/drawer/markup/index.tsx +1 -1
  28. package/src/components/drawer/types/index.ts +24 -0
  29. package/src/components/input/markup/text/Base.tsx +32 -3
  30. package/src/components/input/markup/text/Identification.tsx +15 -2
  31. package/src/components/input/markup/text/Password.tsx +35 -2
  32. package/src/components/input/markup/text/Phone.tsx +38 -2
  33. package/src/components/input/markup/text/Search.tsx +30 -1
  34. package/src/components/input/styles/index.scss +6 -6
  35. package/src/components/input/types/index.ts +22 -1
  36. package/src/components/input/utils/index.ts +6 -0
  37. package/src/components/navigation/index.tsx +5 -0
  38. package/src/components/navigation/markup/mobile/BottomNavigation.tsx +11 -0
  39. package/src/components/navigation/types/index.ts +22 -0
  40. package/src/components/pagination/markup/Carousel.tsx +1 -0
  41. package/src/components/pagination/markup/Count.tsx +1 -0
  42. package/src/components/pagination/markup/Pagination.tsx +2 -0
  43. package/src/components/radio/markup/Radio.tsx +16 -2
  44. package/src/components/radio/markup/RadioCard.tsx +8 -0
  45. package/src/components/radio/markup/RadioCardGroup.tsx +8 -0
  46. package/src/components/radio/types/radio.ts +39 -0
  47. package/src/components/segmented-control/markup/SegmentedControl.tsx +12 -0
  48. package/src/components/segmented-control/types/index.ts +16 -0
  49. package/src/components/tab/markup/TabContent.tsx +5 -0
  50. package/src/components/tab/markup/TabList.tsx +19 -2
  51. package/src/components/tab/markup/TabRoot.tsx +50 -4
  52. package/src/components/tab/markup/TabTrigger.tsx +9 -1
  53. package/src/components/tab/styles/index.scss +28 -10
  54. package/src/components/tab/types/index.ts +10 -0
  55. package/src/components/tab/utils/tab-context.ts +8 -2
  56. package/src/index.scss +22 -1
  57. package/src/theme/ThemeProvider.tsx +2 -2
  58. package/styles.scss +1 -0
  59. package/src/components/button/markup/Button.tsx +0 -175
  60. 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";