@uniai-fe/uds-primitives 0.2.0 → 0.2.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/dist/styles.css +105 -13
- package/package.json +5 -3
- package/src/components/button/index.tsx +0 -2
- package/src/components/button/markup/Base.tsx +22 -1
- package/src/components/button/styles/button.scss +24 -2
- package/src/components/button/styles/variables.scss +4 -0
- package/src/components/button/types/index.ts +7 -0
- package/src/components/checkbox/markup/Checkbox.tsx +31 -25
- package/src/components/dropdown/markup/Template.tsx +4 -8
- package/src/components/dropdown/markup/foundation/Container.tsx +35 -7
- package/src/components/dropdown/markup/foundation/MenuItem.tsx +10 -10
- package/src/components/dropdown/markup/index.tsx +10 -1
- package/src/components/dropdown/styles/dropdown.scss +2 -2
- package/src/components/dropdown/styles/variables.scss +4 -4
- package/src/components/dropdown/types/base.ts +13 -0
- package/src/components/dropdown/types/props.ts +23 -27
- package/src/components/input/hooks/index.ts +1 -0
- package/src/components/input/hooks/useAddress.ts +247 -0
- package/src/components/input/index.scss +5 -1
- package/src/components/input/markup/address/Button.tsx +65 -0
- package/src/components/input/markup/address/Template.tsx +135 -0
- package/src/components/input/markup/address/index.ts +9 -0
- package/src/components/input/markup/foundation/Input.tsx +20 -1
- package/src/components/input/markup/index.tsx +2 -0
- package/src/components/input/styles/address.scss +24 -0
- package/src/components/input/styles/foundation.scss +28 -2
- package/src/components/input/styles/variables.scss +4 -0
- package/src/components/input/types/address.ts +249 -0
- package/src/components/input/types/foundation.ts +6 -0
- package/src/components/input/types/index.ts +1 -0
- package/src/components/input/utils/address.ts +165 -0
- package/src/components/input/utils/index.tsx +1 -0
- package/src/components/radio/markup/Radio.tsx +10 -2
- package/src/components/radio/markup/RadioCard.tsx +6 -1
- package/src/components/radio/markup/RadioCardGroup.tsx +6 -1
- package/src/components/select/markup/Default.tsx +6 -4
- package/src/components/select/markup/foundation/Container.tsx +23 -0
- package/src/components/select/markup/multiple/Multiple.tsx +6 -4
- package/src/components/select/styles/select.scss +25 -2
- package/src/components/select/styles/variables.scss +4 -0
- package/src/components/select/types/index.ts +1 -0
- package/src/components/select/types/option.ts +43 -0
- package/src/components/select/types/props.ts +29 -9
- package/src/components/input/styles/index.scss +0 -4
|
@@ -38,6 +38,7 @@ const SelectMultipleTrigger = forwardRef<
|
|
|
38
38
|
size = "medium",
|
|
39
39
|
state = "default",
|
|
40
40
|
block,
|
|
41
|
+
width,
|
|
41
42
|
isOpen,
|
|
42
43
|
disabled,
|
|
43
44
|
tags,
|
|
@@ -45,7 +46,7 @@ const SelectMultipleTrigger = forwardRef<
|
|
|
45
46
|
selectedOptionIds,
|
|
46
47
|
onOptionSelect,
|
|
47
48
|
dropdownSize,
|
|
48
|
-
|
|
49
|
+
dropdownWidth = "match",
|
|
49
50
|
dropdownRootProps,
|
|
50
51
|
dropdownContainerProps,
|
|
51
52
|
dropdownMenuListProps,
|
|
@@ -113,6 +114,7 @@ const SelectMultipleTrigger = forwardRef<
|
|
|
113
114
|
<Container
|
|
114
115
|
className={clsx("select-trigger-multiple", className)}
|
|
115
116
|
block={block}
|
|
117
|
+
width={width}
|
|
116
118
|
>
|
|
117
119
|
<Dropdown.Root
|
|
118
120
|
open={dropdownOpen}
|
|
@@ -168,7 +170,7 @@ const SelectMultipleTrigger = forwardRef<
|
|
|
168
170
|
<Dropdown.Container
|
|
169
171
|
{...dropdownContainerProps}
|
|
170
172
|
size={panelSize}
|
|
171
|
-
|
|
173
|
+
width={dropdownWidth}
|
|
172
174
|
>
|
|
173
175
|
<Dropdown.Menu.List {...dropdownMenuListProps}>
|
|
174
176
|
{/* multi select 전용 옵션을 Dropdown.Menu.Item으로 노출한다. */}
|
|
@@ -178,8 +180,8 @@ const SelectMultipleTrigger = forwardRef<
|
|
|
178
180
|
label={option.label}
|
|
179
181
|
description={option.description}
|
|
180
182
|
disabled={option.disabled}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
left={option.left}
|
|
184
|
+
right={option.right}
|
|
183
185
|
multiple
|
|
184
186
|
isSelected={resolvedSelectedIds.includes(option.id)}
|
|
185
187
|
onSelect={event => {
|
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
.select {
|
|
2
2
|
display: flex;
|
|
3
|
-
width:
|
|
3
|
+
width: var(--select-width);
|
|
4
|
+
flex: var(--select-flex);
|
|
4
5
|
flex-direction: column;
|
|
5
6
|
gap: var(--spacing-gap-2);
|
|
7
|
+
min-width: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.select[data-width="auto"] {
|
|
11
|
+
--select-width: auto;
|
|
12
|
+
--select-flex: 0 1 auto;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.select[data-width="fill"] {
|
|
16
|
+
--select-width: auto;
|
|
17
|
+
--select-flex: 1 1 0%;
|
|
6
18
|
}
|
|
7
19
|
|
|
20
|
+
.select[data-width="full"],
|
|
8
21
|
.select-block {
|
|
9
|
-
width: 100%;
|
|
22
|
+
--select-width: 100%;
|
|
23
|
+
--select-flex: 0 0 100%;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.select[data-width="fit"] {
|
|
27
|
+
--select-width: fit-content;
|
|
28
|
+
--select-flex: 0 0 auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.select[data-width="custom"] {
|
|
32
|
+
--select-flex: 0 0 auto;
|
|
10
33
|
}
|
|
11
34
|
|
|
12
35
|
.select-button {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/* Select tokens mapped to Input primary tokens for visual parity */
|
|
2
2
|
:root {
|
|
3
|
+
/* layout presets */
|
|
4
|
+
--select-width: 100%;
|
|
5
|
+
--select-flex: 0 1 auto;
|
|
6
|
+
|
|
3
7
|
--select-primary-height-small: var(--input-default-height-small);
|
|
4
8
|
--select-primary-height-medium: var(--input-default-height-medium);
|
|
5
9
|
--select-primary-height-large: var(--input-default-height-large);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Select option 값 타입
|
|
5
|
+
* @typedef {string | number} SelectOptionValue
|
|
6
|
+
*/
|
|
7
|
+
export type SelectOptionValue = string | number;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Select option 데이터 구조; legacy SelectDataType과 호환되는 구조다.
|
|
11
|
+
* @property {string} key 렌더링 키
|
|
12
|
+
* @property {SelectOptionValue} value 실제 값
|
|
13
|
+
* @property {ReactNode} optionName 사용자 노출 라벨
|
|
14
|
+
* @property {boolean} [selected] 선택 여부
|
|
15
|
+
* @property {boolean} [disabled] 비활성 여부
|
|
16
|
+
* @property {OptionData} [data] 추가 데이터 payload
|
|
17
|
+
*/
|
|
18
|
+
export interface SelectOption<OptionData = unknown> {
|
|
19
|
+
/**
|
|
20
|
+
* 렌더링 키
|
|
21
|
+
*/
|
|
22
|
+
key: string;
|
|
23
|
+
/**
|
|
24
|
+
* 실제 값
|
|
25
|
+
*/
|
|
26
|
+
value: SelectOptionValue;
|
|
27
|
+
/**
|
|
28
|
+
* 사용자 노출 라벨
|
|
29
|
+
*/
|
|
30
|
+
optionName: ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* 선택 여부
|
|
33
|
+
*/
|
|
34
|
+
selected?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 비활성 여부
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 추가 데이터 payload
|
|
41
|
+
*/
|
|
42
|
+
data?: OptionData;
|
|
43
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
4
|
DropdownContainerProps,
|
|
5
5
|
DropdownMenuListProps,
|
|
6
|
+
DropdownPanelWidth,
|
|
6
7
|
DropdownRootProps,
|
|
7
8
|
DropdownTemplateItem,
|
|
8
9
|
} from "../../dropdown/types";
|
|
10
|
+
import type { FormFieldWidth } from "../../form/types";
|
|
9
11
|
import type { SelectPriority, SelectSize, SelectState } from "./base";
|
|
10
12
|
import type {
|
|
11
13
|
SelectTriggerDefaultProps,
|
|
@@ -81,7 +83,7 @@ export interface SelectComponentState {
|
|
|
81
83
|
* @property {ReactNode} children trigger/Dropdown 등 내부 콘텐츠
|
|
82
84
|
* @property {boolean} [block] block 여부
|
|
83
85
|
*/
|
|
84
|
-
export interface SelectContainerProps {
|
|
86
|
+
export interface SelectContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
85
87
|
/**
|
|
86
88
|
* 사용자 정의 className
|
|
87
89
|
*/
|
|
@@ -94,6 +96,21 @@ export interface SelectContainerProps {
|
|
|
94
96
|
* block 여부
|
|
95
97
|
*/
|
|
96
98
|
block?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* width preset
|
|
101
|
+
*/
|
|
102
|
+
width?: FormFieldWidth;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Select width 옵션
|
|
107
|
+
* @property {FormFieldWidth} [width] width preset 옵션
|
|
108
|
+
*/
|
|
109
|
+
export interface SelectWidthOption {
|
|
110
|
+
/**
|
|
111
|
+
* width preset 옵션
|
|
112
|
+
*/
|
|
113
|
+
width?: FormFieldWidth;
|
|
97
114
|
}
|
|
98
115
|
|
|
99
116
|
/**
|
|
@@ -102,7 +119,8 @@ export interface SelectContainerProps {
|
|
|
102
119
|
*/
|
|
103
120
|
export type SelectProps = SelectStyleOptions &
|
|
104
121
|
SelectValueOptions &
|
|
105
|
-
SelectComponentState
|
|
122
|
+
SelectComponentState &
|
|
123
|
+
SelectWidthOption;
|
|
106
124
|
|
|
107
125
|
/**
|
|
108
126
|
* Select dropdown option; Dropdown.Template item 계약을 그대로 따른다.
|
|
@@ -116,7 +134,7 @@ export interface SelectDropdownOption extends DropdownTemplateItem {}
|
|
|
116
134
|
* @property {string[]} [selectedOptionIds] 선택된 option id 리스트
|
|
117
135
|
* @property {(option: SelectDropdownOption) => void} [onOptionSelect] option 선택 콜백
|
|
118
136
|
* @property {SelectSize} [dropdownSize] dropdown surface size 스케일
|
|
119
|
-
* @property {
|
|
137
|
+
* @property {DropdownPanelWidth} [dropdownWidth="match"] dropdown panel width 옵션
|
|
120
138
|
* @property {DropdownRootProps} [dropdownRootProps] Dropdown.Root 전달 props(제어 props 제외)
|
|
121
139
|
* @property {DropdownContainerProps} [dropdownContainerProps] Dropdown.Container 전달 props(children/size 제외)
|
|
122
140
|
* @property {DropdownMenuListProps} [dropdownMenuListProps] Dropdown.Menu.List 전달 props
|
|
@@ -139,9 +157,9 @@ export interface SelectDropdownConfigProps {
|
|
|
139
157
|
*/
|
|
140
158
|
dropdownSize?: SelectSize;
|
|
141
159
|
/**
|
|
142
|
-
*
|
|
160
|
+
* dropdown panel width 옵션
|
|
143
161
|
*/
|
|
144
|
-
|
|
162
|
+
dropdownWidth?: DropdownPanelWidth;
|
|
145
163
|
/**
|
|
146
164
|
* Dropdown.Root 전달 props(제어 props 제외)
|
|
147
165
|
*/
|
|
@@ -154,7 +172,7 @@ export interface SelectDropdownConfigProps {
|
|
|
154
172
|
*/
|
|
155
173
|
dropdownContainerProps?: Omit<
|
|
156
174
|
DropdownContainerProps,
|
|
157
|
-
"children" | "size" | "
|
|
175
|
+
"children" | "size" | "width"
|
|
158
176
|
>;
|
|
159
177
|
/**
|
|
160
178
|
* Dropdown.Menu.List 전달 props
|
|
@@ -193,7 +211,8 @@ export interface SelectDefaultComponentProps
|
|
|
193
211
|
extends
|
|
194
212
|
SelectTriggerDefaultProps,
|
|
195
213
|
SelectDropdownConfigProps,
|
|
196
|
-
SelectDropdownBehaviorProps
|
|
214
|
+
SelectDropdownBehaviorProps,
|
|
215
|
+
SelectWidthOption {}
|
|
197
216
|
|
|
198
217
|
/**
|
|
199
218
|
* Select.Multiple 컴포넌트 props
|
|
@@ -205,4 +224,5 @@ export interface SelectMultipleComponentProps
|
|
|
205
224
|
extends
|
|
206
225
|
SelectTriggerMultipleProps,
|
|
207
226
|
SelectDropdownConfigProps,
|
|
208
|
-
SelectDropdownBehaviorProps
|
|
227
|
+
SelectDropdownBehaviorProps,
|
|
228
|
+
SelectWidthOption {}
|