@x-plat/design-system 0.9.0 → 0.11.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/dist/components/AutoResizeTextArea/index.cjs +14 -5
- package/dist/components/AutoResizeTextArea/index.css +15 -0
- package/dist/components/AutoResizeTextArea/index.d.cts +5 -0
- package/dist/components/AutoResizeTextArea/index.d.ts +5 -0
- package/dist/components/AutoResizeTextArea/index.js +14 -5
- package/dist/components/Badge/index.cjs +5 -1
- package/dist/components/Badge/index.css +1 -0
- package/dist/components/Badge/index.d.cts +1 -0
- package/dist/components/Badge/index.d.ts +1 -0
- package/dist/components/Badge/index.js +5 -1
- package/dist/components/Box/index.d.cts +3 -0
- package/dist/components/Box/index.d.ts +3 -0
- package/dist/components/Chart/index.cjs +7 -6
- package/dist/components/Chart/index.d.cts +12 -1
- package/dist/components/Chart/index.d.ts +12 -1
- package/dist/components/Chart/index.js +7 -6
- package/dist/components/ChatInput/index.cjs +20 -7
- package/dist/components/ChatInput/index.css +15 -0
- package/dist/components/ChatInput/index.d.cts +10 -0
- package/dist/components/ChatInput/index.d.ts +10 -0
- package/dist/components/ChatInput/index.js +20 -7
- package/dist/components/CheckBox/index.cjs +14 -5
- package/dist/components/CheckBox/index.css +17 -0
- package/dist/components/CheckBox/index.d.cts +10 -2
- package/dist/components/CheckBox/index.d.ts +10 -2
- package/dist/components/CheckBox/index.js +14 -5
- package/dist/components/Chip/index.d.cts +2 -0
- package/dist/components/Chip/index.d.ts +2 -0
- package/dist/components/DatePicker/index.cjs +181 -65
- package/dist/components/DatePicker/index.css +19 -0
- package/dist/components/DatePicker/index.js +181 -65
- package/dist/components/Drawer/index.cjs +83 -4
- package/dist/components/Drawer/index.d.cts +1 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Drawer/index.js +83 -4
- package/dist/components/Dropdown/index.cjs +35 -7
- package/dist/components/Dropdown/index.js +35 -7
- package/dist/components/Editor/index.cjs +178 -21
- package/dist/components/Editor/index.js +178 -21
- package/dist/components/FieldMessage/index.cjs +8 -3
- package/dist/components/FieldMessage/index.css +15 -0
- package/dist/components/FieldMessage/index.d.cts +11 -4
- package/dist/components/FieldMessage/index.d.ts +11 -4
- package/dist/components/FieldMessage/index.js +8 -3
- package/dist/components/FileUpload/index.cjs +8 -3
- package/dist/components/FileUpload/index.css +15 -0
- package/dist/components/FileUpload/index.d.cts +6 -0
- package/dist/components/FileUpload/index.d.ts +6 -0
- package/dist/components/FileUpload/index.js +8 -3
- package/dist/components/ImageSelector/index.cjs +8 -3
- package/dist/components/ImageSelector/index.css +15 -0
- package/dist/components/ImageSelector/index.d.cts +3 -0
- package/dist/components/ImageSelector/index.d.ts +3 -0
- package/dist/components/ImageSelector/index.js +8 -3
- package/dist/components/Input/index.cjs +15 -5
- package/dist/components/Input/index.css +15 -0
- package/dist/components/Input/index.d.cts +8 -0
- package/dist/components/Input/index.d.ts +8 -0
- package/dist/components/Input/index.js +15 -5
- package/dist/components/Modal/index.cjs +84 -5
- package/dist/components/Modal/index.js +84 -5
- package/dist/components/NotificationBadge/index.cjs +5 -1
- package/dist/components/NotificationBadge/index.css +1 -0
- package/dist/components/NotificationBadge/index.d.cts +6 -2
- package/dist/components/NotificationBadge/index.d.ts +6 -2
- package/dist/components/NotificationBadge/index.js +5 -1
- package/dist/components/Pagination/index.cjs +6 -2
- package/dist/components/Pagination/index.css +1 -0
- package/dist/components/Pagination/index.d.cts +13 -2
- package/dist/components/Pagination/index.d.ts +13 -2
- package/dist/components/Pagination/index.js +6 -2
- package/dist/components/PopOver/index.cjs +34 -6
- package/dist/components/PopOver/index.js +34 -6
- package/dist/components/Progress/index.cjs +6 -2
- package/dist/components/Progress/index.css +1 -0
- package/dist/components/Progress/index.d.cts +11 -2
- package/dist/components/Progress/index.d.ts +11 -2
- package/dist/components/Progress/index.js +6 -2
- package/dist/components/Radio/index.cjs +14 -5
- package/dist/components/Radio/index.css +17 -0
- package/dist/components/Radio/index.d.cts +11 -2
- package/dist/components/Radio/index.d.ts +11 -2
- package/dist/components/Radio/index.js +14 -5
- package/dist/components/Select/index.cjs +99 -31
- package/dist/components/Select/index.css +54 -0
- package/dist/components/Select/index.d.cts +16 -1
- package/dist/components/Select/index.d.ts +16 -1
- package/dist/components/Select/index.js +99 -31
- package/dist/components/Skeleton/index.d.cts +3 -0
- package/dist/components/Skeleton/index.d.ts +3 -0
- package/dist/components/Spinner/index.cjs +6 -2
- package/dist/components/Spinner/index.css +1 -0
- package/dist/components/Spinner/index.d.cts +8 -2
- package/dist/components/Spinner/index.d.ts +8 -2
- package/dist/components/Spinner/index.js +6 -2
- package/dist/components/Stat/index.cjs +84 -0
- package/dist/components/Stat/index.css +96 -0
- package/dist/components/Stat/index.d.cts +37 -0
- package/dist/components/Stat/index.d.ts +37 -0
- package/dist/components/Stat/index.js +57 -0
- package/dist/components/Steps/index.cjs +6 -2
- package/dist/components/Steps/index.css +11 -0
- package/dist/components/Steps/index.d.cts +9 -2
- package/dist/components/Steps/index.d.ts +9 -2
- package/dist/components/Steps/index.js +6 -2
- package/dist/components/Switch/index.cjs +20 -7
- package/dist/components/Switch/index.css +17 -0
- package/dist/components/Switch/index.d.cts +15 -2
- package/dist/components/Switch/index.d.ts +15 -2
- package/dist/components/Switch/index.js +20 -7
- package/dist/components/Tab/index.cjs +51 -26
- package/dist/components/Tab/index.css +4 -0
- package/dist/components/Tab/index.d.cts +12 -1
- package/dist/components/Tab/index.d.ts +12 -1
- package/dist/components/Tab/index.js +51 -26
- package/dist/components/Tag/index.cjs +5 -3
- package/dist/components/Tag/index.d.cts +12 -2
- package/dist/components/Tag/index.d.ts +12 -2
- package/dist/components/Tag/index.js +5 -3
- package/dist/components/TextArea/index.cjs +14 -4
- package/dist/components/TextArea/index.css +15 -0
- package/dist/components/TextArea/index.d.cts +7 -0
- package/dist/components/TextArea/index.d.ts +7 -0
- package/dist/components/TextArea/index.js +14 -4
- package/dist/components/TimePicker/index.cjs +448 -0
- package/dist/components/TimePicker/index.css +172 -0
- package/dist/components/TimePicker/index.d.cts +42 -0
- package/dist/components/TimePicker/index.d.ts +42 -0
- package/dist/components/TimePicker/index.js +411 -0
- package/dist/components/Tooltip/index.cjs +4 -2
- package/dist/components/Tooltip/index.d.cts +11 -1
- package/dist/components/Tooltip/index.d.ts +11 -1
- package/dist/components/Tooltip/index.js +4 -2
- package/dist/components/index.cjs +916 -385
- package/dist/components/index.css +296 -0
- package/dist/components/index.d.cts +3 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +914 -385
- package/dist/index.cjs +940 -409
- package/dist/index.css +296 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +938 -409
- package/dist/status-njWqQWFV.d.cts +20 -0
- package/dist/status-njWqQWFV.d.ts +20 -0
- package/guidelines/AGENT_PROMPT.md +18 -3
- package/guidelines/Guidelines.md +3 -0
- package/guidelines/components/card.md +3 -3
- package/guidelines/components/editor.md +86 -0
- package/guidelines/components/feedback.md +1 -1
- package/guidelines/components/form.md +19 -0
- package/guidelines/components/navigation.md +16 -15
- package/guidelines/components/overlay.md +43 -4
- package/guidelines/components/stat.md +31 -0
- package/guidelines/components/time-picker.md +49 -0
- package/package.json +1 -1
|
@@ -35,7 +35,7 @@ __export(PopOver_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(PopOver_exports);
|
|
36
36
|
|
|
37
37
|
// src/components/PopOver/PopOver.tsx
|
|
38
|
-
var
|
|
38
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
39
39
|
|
|
40
40
|
// src/tokens/hooks/Portal.tsx
|
|
41
41
|
var import_react_dom = __toESM(require("react-dom"), 1);
|
|
@@ -132,6 +132,30 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
132
132
|
};
|
|
133
133
|
var useClickOutside_default = useClickOutside;
|
|
134
134
|
|
|
135
|
+
// src/tokens/hooks/useOverlayKeyboard.ts
|
|
136
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
137
|
+
var FOCUSABLE = [
|
|
138
|
+
"a[href]",
|
|
139
|
+
"button:not([disabled])",
|
|
140
|
+
"input:not([disabled]):not([type='hidden'])",
|
|
141
|
+
"select:not([disabled])",
|
|
142
|
+
"textarea:not([disabled])",
|
|
143
|
+
"[tabindex]:not([tabindex='-1'])"
|
|
144
|
+
].join(",");
|
|
145
|
+
var useEscapeKey = (enabled, onEscape) => {
|
|
146
|
+
import_react3.default.useEffect(() => {
|
|
147
|
+
if (!enabled) return;
|
|
148
|
+
const onKey = (e) => {
|
|
149
|
+
if (e.key !== "Escape") return;
|
|
150
|
+
if (e.defaultPrevented) return;
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
onEscape();
|
|
153
|
+
};
|
|
154
|
+
document.addEventListener("keydown", onKey);
|
|
155
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
156
|
+
}, [enabled, onEscape]);
|
|
157
|
+
};
|
|
158
|
+
|
|
135
159
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
136
160
|
function r(e) {
|
|
137
161
|
var t, f, n = "";
|
|
@@ -152,13 +176,17 @@ var clsx_default = clsx;
|
|
|
152
176
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
153
177
|
var PopOver = (props) => {
|
|
154
178
|
const { children, isOpen, onClose, PopOverEl } = props;
|
|
155
|
-
const popRef =
|
|
156
|
-
const triggerRef =
|
|
157
|
-
const [localOpen, setLocalOpen] =
|
|
158
|
-
const [eventTrigger, setEventTrigger] =
|
|
179
|
+
const popRef = import_react4.default.useRef(null);
|
|
180
|
+
const triggerRef = import_react4.default.useRef(null);
|
|
181
|
+
const [localOpen, setLocalOpen] = import_react4.default.useState(false);
|
|
182
|
+
const [eventTrigger, setEventTrigger] = import_react4.default.useState(false);
|
|
159
183
|
useClickOutside_default([popRef, triggerRef], onClose, isOpen);
|
|
184
|
+
useEscapeKey(isOpen, () => {
|
|
185
|
+
onClose();
|
|
186
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
187
|
+
});
|
|
160
188
|
const position = useAutoPosition_default(triggerRef, popRef, localOpen);
|
|
161
|
-
|
|
189
|
+
import_react4.default.useEffect(() => {
|
|
162
190
|
if (isOpen) {
|
|
163
191
|
setLocalOpen(isOpen);
|
|
164
192
|
setTimeout(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/PopOver/PopOver.tsx
|
|
2
|
-
import
|
|
2
|
+
import React4 from "react";
|
|
3
3
|
|
|
4
4
|
// src/tokens/hooks/Portal.tsx
|
|
5
5
|
import ReactDOM from "react-dom";
|
|
@@ -96,6 +96,30 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
96
96
|
};
|
|
97
97
|
var useClickOutside_default = useClickOutside;
|
|
98
98
|
|
|
99
|
+
// src/tokens/hooks/useOverlayKeyboard.ts
|
|
100
|
+
import React3 from "react";
|
|
101
|
+
var FOCUSABLE = [
|
|
102
|
+
"a[href]",
|
|
103
|
+
"button:not([disabled])",
|
|
104
|
+
"input:not([disabled]):not([type='hidden'])",
|
|
105
|
+
"select:not([disabled])",
|
|
106
|
+
"textarea:not([disabled])",
|
|
107
|
+
"[tabindex]:not([tabindex='-1'])"
|
|
108
|
+
].join(",");
|
|
109
|
+
var useEscapeKey = (enabled, onEscape) => {
|
|
110
|
+
React3.useEffect(() => {
|
|
111
|
+
if (!enabled) return;
|
|
112
|
+
const onKey = (e) => {
|
|
113
|
+
if (e.key !== "Escape") return;
|
|
114
|
+
if (e.defaultPrevented) return;
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
onEscape();
|
|
117
|
+
};
|
|
118
|
+
document.addEventListener("keydown", onKey);
|
|
119
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
120
|
+
}, [enabled, onEscape]);
|
|
121
|
+
};
|
|
122
|
+
|
|
99
123
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
100
124
|
function r(e) {
|
|
101
125
|
var t, f, n = "";
|
|
@@ -116,13 +140,17 @@ var clsx_default = clsx;
|
|
|
116
140
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
117
141
|
var PopOver = (props) => {
|
|
118
142
|
const { children, isOpen, onClose, PopOverEl } = props;
|
|
119
|
-
const popRef =
|
|
120
|
-
const triggerRef =
|
|
121
|
-
const [localOpen, setLocalOpen] =
|
|
122
|
-
const [eventTrigger, setEventTrigger] =
|
|
143
|
+
const popRef = React4.useRef(null);
|
|
144
|
+
const triggerRef = React4.useRef(null);
|
|
145
|
+
const [localOpen, setLocalOpen] = React4.useState(false);
|
|
146
|
+
const [eventTrigger, setEventTrigger] = React4.useState(false);
|
|
123
147
|
useClickOutside_default([popRef, triggerRef], onClose, isOpen);
|
|
148
|
+
useEscapeKey(isOpen, () => {
|
|
149
|
+
onClose();
|
|
150
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
151
|
+
});
|
|
124
152
|
const position = useAutoPosition_default(triggerRef, popRef, localOpen);
|
|
125
|
-
|
|
153
|
+
React4.useEffect(() => {
|
|
126
154
|
if (isOpen) {
|
|
127
155
|
setLocalOpen(isOpen);
|
|
128
156
|
setTimeout(() => {
|
|
@@ -24,6 +24,9 @@ __export(Progress_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(Progress_exports);
|
|
26
26
|
|
|
27
|
+
// src/tokens/interface/status.ts
|
|
28
|
+
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
29
|
+
|
|
27
30
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
28
31
|
function r(e) {
|
|
29
32
|
var t, f, n = "";
|
|
@@ -47,11 +50,12 @@ var Progress = (props) => {
|
|
|
47
50
|
value,
|
|
48
51
|
max = 100,
|
|
49
52
|
size = "md",
|
|
50
|
-
type = "
|
|
53
|
+
type = "primary",
|
|
51
54
|
showLabel = false
|
|
52
55
|
} = props;
|
|
56
|
+
const statusType = normalizeStatus(type);
|
|
53
57
|
const percentage = Math.min(100, Math.max(0, value / max * 100));
|
|
54
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: clsx_default("lib-xplat-progress", size,
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: clsx_default("lib-xplat-progress", size, statusType), children: [
|
|
55
59
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
60
|
"div",
|
|
57
61
|
{
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { L as LegacyStatusType } from '../../status-njWqQWFV.cjs';
|
|
2
3
|
|
|
3
4
|
type ProgressSize = "sm" | "md" | "lg";
|
|
4
|
-
|
|
5
|
+
/** Progress 의 상태 색 */
|
|
6
|
+
type ProgressType = "primary" | "success" | "error" | "warning" | "info";
|
|
7
|
+
/** 입력으로는 예전 이름 `brand` 도 받는다 (= `primary`) */
|
|
8
|
+
type ProgressTypeInput = ProgressType | LegacyStatusType;
|
|
5
9
|
interface ProgressProps {
|
|
10
|
+
/** 현재 값. max 에 대한 비율로 채워진다 */
|
|
6
11
|
value: number;
|
|
12
|
+
/** 최대값. 기본 100 */
|
|
7
13
|
max?: number;
|
|
14
|
+
/** 막대 두께 */
|
|
8
15
|
size?: ProgressSize;
|
|
9
|
-
|
|
16
|
+
/** 막대 색 */
|
|
17
|
+
type?: ProgressTypeInput;
|
|
18
|
+
/** 오른쪽에 퍼센트 글자를 표시한다 */
|
|
10
19
|
showLabel?: boolean;
|
|
11
20
|
}
|
|
12
21
|
declare const Progress: {
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { L as LegacyStatusType } from '../../status-njWqQWFV.js';
|
|
2
3
|
|
|
3
4
|
type ProgressSize = "sm" | "md" | "lg";
|
|
4
|
-
|
|
5
|
+
/** Progress 의 상태 색 */
|
|
6
|
+
type ProgressType = "primary" | "success" | "error" | "warning" | "info";
|
|
7
|
+
/** 입력으로는 예전 이름 `brand` 도 받는다 (= `primary`) */
|
|
8
|
+
type ProgressTypeInput = ProgressType | LegacyStatusType;
|
|
5
9
|
interface ProgressProps {
|
|
10
|
+
/** 현재 값. max 에 대한 비율로 채워진다 */
|
|
6
11
|
value: number;
|
|
12
|
+
/** 최대값. 기본 100 */
|
|
7
13
|
max?: number;
|
|
14
|
+
/** 막대 두께 */
|
|
8
15
|
size?: ProgressSize;
|
|
9
|
-
|
|
16
|
+
/** 막대 색 */
|
|
17
|
+
type?: ProgressTypeInput;
|
|
18
|
+
/** 오른쪽에 퍼센트 글자를 표시한다 */
|
|
10
19
|
showLabel?: boolean;
|
|
11
20
|
}
|
|
12
21
|
declare const Progress: {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/tokens/interface/status.ts
|
|
2
|
+
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
3
|
+
|
|
1
4
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
2
5
|
function r(e) {
|
|
3
6
|
var t, f, n = "";
|
|
@@ -21,11 +24,12 @@ var Progress = (props) => {
|
|
|
21
24
|
value,
|
|
22
25
|
max = 100,
|
|
23
26
|
size = "md",
|
|
24
|
-
type = "
|
|
27
|
+
type = "primary",
|
|
25
28
|
showLabel = false
|
|
26
29
|
} = props;
|
|
30
|
+
const statusType = normalizeStatus(type);
|
|
27
31
|
const percentage = Math.min(100, Math.max(0, value / max * 100));
|
|
28
|
-
return /* @__PURE__ */ jsxs("div", { className: clsx_default("lib-xplat-progress", size,
|
|
32
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx_default("lib-xplat-progress", size, statusType), children: [
|
|
29
33
|
/* @__PURE__ */ jsx(
|
|
30
34
|
"div",
|
|
31
35
|
{
|
|
@@ -35,6 +35,9 @@ __export(Radio_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(Radio_exports);
|
|
37
37
|
|
|
38
|
+
// src/tokens/interface/status.ts
|
|
39
|
+
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
40
|
+
|
|
38
41
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
39
42
|
function r(e) {
|
|
40
43
|
var t, f, n = "";
|
|
@@ -174,11 +177,16 @@ var FieldMessage = (props) => {
|
|
|
174
177
|
};
|
|
175
178
|
FieldMessage.displayName = "FieldMessage";
|
|
176
179
|
var Field = (props) => {
|
|
177
|
-
const { validations, children } = props;
|
|
178
|
-
|
|
180
|
+
const { label, required = false, htmlFor, validations, children } = props;
|
|
181
|
+
const hasMessages = !!validations && validations.length > 0;
|
|
182
|
+
if (!label && !hasMessages) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
|
|
179
183
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "lib-xplat-field", children: [
|
|
184
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "lib-xplat-field-label", htmlFor, children: [
|
|
185
|
+
label,
|
|
186
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "required", "aria-hidden": "true", children: "*" })
|
|
187
|
+
] }),
|
|
180
188
|
children,
|
|
181
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldMessage, { validations })
|
|
189
|
+
hasMessages && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldMessage, { validations })
|
|
182
190
|
] });
|
|
183
191
|
};
|
|
184
192
|
Field.displayName = "Field";
|
|
@@ -202,10 +210,11 @@ var Radio = (props) => {
|
|
|
202
210
|
className,
|
|
203
211
|
value,
|
|
204
212
|
size: sizeProp,
|
|
205
|
-
type = "
|
|
213
|
+
type = "primary",
|
|
206
214
|
validations,
|
|
207
215
|
...rest
|
|
208
216
|
} = props;
|
|
217
|
+
const statusType = normalizeStatus(type);
|
|
209
218
|
const context = useRadioGroupContext();
|
|
210
219
|
const size = sizeProp ?? context?.size ?? "md";
|
|
211
220
|
const isGroup = !!context;
|
|
@@ -221,7 +230,7 @@ var Radio = (props) => {
|
|
|
221
230
|
className: clsx_default(
|
|
222
231
|
"lib-xplat-radio",
|
|
223
232
|
size,
|
|
224
|
-
|
|
233
|
+
statusType,
|
|
225
234
|
localChecked ? "checked" : void 0,
|
|
226
235
|
className
|
|
227
236
|
),
|
|
@@ -4,6 +4,21 @@
|
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
gap: var(--spacing-space-2);
|
|
6
6
|
}
|
|
7
|
+
.lib-xplat-field-label {
|
|
8
|
+
font-family: var(--semantic-typo-label-2-m-font);
|
|
9
|
+
font-size: var(--semantic-typo-label-2-m-size);
|
|
10
|
+
line-height: var(--semantic-typo-label-2-m-lh);
|
|
11
|
+
font-weight: var(--semantic-typo-label-2-m-weight);
|
|
12
|
+
letter-spacing: var(--semantic-typo-label-2-m-ls);
|
|
13
|
+
color: var(--semantic-text-secondary);
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: var(--spacing-space-1);
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
.lib-xplat-field-label > .required {
|
|
20
|
+
color: var(--semantic-text-error);
|
|
21
|
+
}
|
|
7
22
|
.lib-xplat-field-message-wrap {
|
|
8
23
|
display: flex;
|
|
9
24
|
gap: var(--spacing-space-2);
|
|
@@ -112,6 +127,7 @@
|
|
|
112
127
|
border-color: var(--semantic-icon-primary);
|
|
113
128
|
background-color: var(--semantic-surface-neutral-secondary);
|
|
114
129
|
}
|
|
130
|
+
.lib-xplat-radio.primary > .circle.checked,
|
|
115
131
|
.lib-xplat-radio.brand > .circle.checked {
|
|
116
132
|
background-color: var(--semantic-surface-brand-default);
|
|
117
133
|
border-color: var(--semantic-surface-brand-default);
|
|
@@ -132,6 +148,7 @@
|
|
|
132
148
|
background-color: var(--semantic-surface-info-default);
|
|
133
149
|
border-color: var(--semantic-surface-info-default);
|
|
134
150
|
}
|
|
151
|
+
.lib-xplat-radio:hover.primary > .circle.checked,
|
|
135
152
|
.lib-xplat-radio:hover.brand > .circle.checked {
|
|
136
153
|
background-color: var(--semantic-surface-brand-strong);
|
|
137
154
|
border-color: var(--semantic-surface-brand-strong);
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { I as InputAttributes } from '../../attributes-DJIWir_0.cjs';
|
|
3
|
+
import { L as LegacyStatusType } from '../../status-njWqQWFV.cjs';
|
|
3
4
|
import { V as Validation } from '../../validation-Dqo1zqhT.cjs';
|
|
4
5
|
import React from 'react';
|
|
5
6
|
|
|
6
7
|
type RadioSize = "sm" | "md" | "lg";
|
|
7
|
-
|
|
8
|
+
/** Radio 의 상태 색 */
|
|
9
|
+
type RadioType = "primary" | "success" | "error" | "warning" | "info";
|
|
10
|
+
/** 입력으로는 예전 이름 `brand` 도 받는다 (= `primary`) */
|
|
11
|
+
type RadioTypeInput = RadioType | LegacyStatusType;
|
|
8
12
|
interface RadioProps extends Omit<InputAttributes, "size"> {
|
|
9
13
|
label?: string;
|
|
10
14
|
/**
|
|
@@ -14,8 +18,10 @@ interface RadioProps extends Omit<InputAttributes, "size"> {
|
|
|
14
18
|
value: string | number;
|
|
15
19
|
/** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
|
|
16
20
|
validations?: Validation[];
|
|
21
|
+
/** 컨트롤 크기 */
|
|
17
22
|
size?: RadioSize;
|
|
18
|
-
|
|
23
|
+
/** 선택됐을 때의 색 */
|
|
24
|
+
type?: RadioTypeInput;
|
|
19
25
|
}
|
|
20
26
|
/**
|
|
21
27
|
* 그룹모드 check 조건 : RadioGroup value === radio value
|
|
@@ -27,9 +33,12 @@ declare const Radio: {
|
|
|
27
33
|
};
|
|
28
34
|
|
|
29
35
|
interface RadioGroupContextProps {
|
|
36
|
+
/** 이 항목의 값. 그룹의 선택값과 비교된다 */
|
|
30
37
|
value?: string | number;
|
|
38
|
+
/** 같은 name 끼리 한 그룹이 된다. RadioGroup 안에서는 자동으로 채워진다 */
|
|
31
39
|
name: string;
|
|
32
40
|
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
41
|
+
/** 컨트롤 크기 */
|
|
33
42
|
size?: "sm" | "md" | "lg";
|
|
34
43
|
}
|
|
35
44
|
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { I as InputAttributes } from '../../attributes-DJIWir_0.js';
|
|
3
|
+
import { L as LegacyStatusType } from '../../status-njWqQWFV.js';
|
|
3
4
|
import { V as Validation } from '../../validation-Dqo1zqhT.js';
|
|
4
5
|
import React from 'react';
|
|
5
6
|
|
|
6
7
|
type RadioSize = "sm" | "md" | "lg";
|
|
7
|
-
|
|
8
|
+
/** Radio 의 상태 색 */
|
|
9
|
+
type RadioType = "primary" | "success" | "error" | "warning" | "info";
|
|
10
|
+
/** 입력으로는 예전 이름 `brand` 도 받는다 (= `primary`) */
|
|
11
|
+
type RadioTypeInput = RadioType | LegacyStatusType;
|
|
8
12
|
interface RadioProps extends Omit<InputAttributes, "size"> {
|
|
9
13
|
label?: string;
|
|
10
14
|
/**
|
|
@@ -14,8 +18,10 @@ interface RadioProps extends Omit<InputAttributes, "size"> {
|
|
|
14
18
|
value: string | number;
|
|
15
19
|
/** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
|
|
16
20
|
validations?: Validation[];
|
|
21
|
+
/** 컨트롤 크기 */
|
|
17
22
|
size?: RadioSize;
|
|
18
|
-
|
|
23
|
+
/** 선택됐을 때의 색 */
|
|
24
|
+
type?: RadioTypeInput;
|
|
19
25
|
}
|
|
20
26
|
/**
|
|
21
27
|
* 그룹모드 check 조건 : RadioGroup value === radio value
|
|
@@ -27,9 +33,12 @@ declare const Radio: {
|
|
|
27
33
|
};
|
|
28
34
|
|
|
29
35
|
interface RadioGroupContextProps {
|
|
36
|
+
/** 이 항목의 값. 그룹의 선택값과 비교된다 */
|
|
30
37
|
value?: string | number;
|
|
38
|
+
/** 같은 name 끼리 한 그룹이 된다. RadioGroup 안에서는 자동으로 채워진다 */
|
|
31
39
|
name: string;
|
|
32
40
|
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
41
|
+
/** 컨트롤 크기 */
|
|
33
42
|
size?: "sm" | "md" | "lg";
|
|
34
43
|
}
|
|
35
44
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/tokens/interface/status.ts
|
|
2
|
+
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
3
|
+
|
|
1
4
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
2
5
|
function r(e) {
|
|
3
6
|
var t, f, n = "";
|
|
@@ -137,11 +140,16 @@ var FieldMessage = (props) => {
|
|
|
137
140
|
};
|
|
138
141
|
FieldMessage.displayName = "FieldMessage";
|
|
139
142
|
var Field = (props) => {
|
|
140
|
-
const { validations, children } = props;
|
|
141
|
-
|
|
143
|
+
const { label, required = false, htmlFor, validations, children } = props;
|
|
144
|
+
const hasMessages = !!validations && validations.length > 0;
|
|
145
|
+
if (!label && !hasMessages) return /* @__PURE__ */ jsx4(Fragment, { children });
|
|
142
146
|
return /* @__PURE__ */ jsxs3("div", { className: "lib-xplat-field", children: [
|
|
147
|
+
label && /* @__PURE__ */ jsxs3("label", { className: "lib-xplat-field-label", htmlFor, children: [
|
|
148
|
+
label,
|
|
149
|
+
required && /* @__PURE__ */ jsx4("span", { className: "required", "aria-hidden": "true", children: "*" })
|
|
150
|
+
] }),
|
|
143
151
|
children,
|
|
144
|
-
/* @__PURE__ */ jsx4(FieldMessage, { validations })
|
|
152
|
+
hasMessages && /* @__PURE__ */ jsx4(FieldMessage, { validations })
|
|
145
153
|
] });
|
|
146
154
|
};
|
|
147
155
|
Field.displayName = "Field";
|
|
@@ -165,10 +173,11 @@ var Radio = (props) => {
|
|
|
165
173
|
className,
|
|
166
174
|
value,
|
|
167
175
|
size: sizeProp,
|
|
168
|
-
type = "
|
|
176
|
+
type = "primary",
|
|
169
177
|
validations,
|
|
170
178
|
...rest
|
|
171
179
|
} = props;
|
|
180
|
+
const statusType = normalizeStatus(type);
|
|
172
181
|
const context = useRadioGroupContext();
|
|
173
182
|
const size = sizeProp ?? context?.size ?? "md";
|
|
174
183
|
const isGroup = !!context;
|
|
@@ -184,7 +193,7 @@ var Radio = (props) => {
|
|
|
184
193
|
className: clsx_default(
|
|
185
194
|
"lib-xplat-radio",
|
|
186
195
|
size,
|
|
187
|
-
|
|
196
|
+
statusType,
|
|
188
197
|
localChecked ? "checked" : void 0,
|
|
189
198
|
className
|
|
190
199
|
),
|