@causw/core 0.0.8 → 0.0.9
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/index.d.mts +186 -284
- package/dist/index.d.ts +186 -284
- package/dist/index.js +619 -228
- package/dist/index.mjs +611 -228
- package/package.json +5 -3
- package/src/styles/global.css +123 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React4 = require('react');
|
|
4
4
|
var clsx = require('clsx');
|
|
5
5
|
var tailwindMerge = require('tailwind-merge');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
6
8
|
|
|
7
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
10
|
|
|
9
|
-
var
|
|
11
|
+
var React4__default = /*#__PURE__*/_interopDefault(React4);
|
|
10
12
|
|
|
11
13
|
// src/components/Text/Text.tsx
|
|
14
|
+
function mergeStyles(...inputs) {
|
|
15
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
16
|
+
}
|
|
12
17
|
|
|
13
18
|
// src/components/Text/Text.styles.ts
|
|
14
19
|
var colorClasses = {
|
|
@@ -30,245 +35,73 @@ var colorClasses = {
|
|
|
30
35
|
white: "text-white-main",
|
|
31
36
|
black: "text-black-main"
|
|
32
37
|
};
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
lineHeight: "leading-normal",
|
|
39
|
-
fontWeight: "font-regular"
|
|
40
|
-
},
|
|
41
|
-
point: {
|
|
42
|
-
fontSize: "text-12",
|
|
43
|
-
lineHeight: "leading-normal",
|
|
44
|
-
fontWeight: "font-semibold"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
md: {
|
|
48
|
-
normal: {
|
|
49
|
-
fontSize: "text-14",
|
|
50
|
-
lineHeight: "leading-normal",
|
|
51
|
-
fontWeight: "font-medium"
|
|
52
|
-
},
|
|
53
|
-
point: {
|
|
54
|
-
fontSize: "text-14",
|
|
55
|
-
lineHeight: "leading-normal",
|
|
56
|
-
fontWeight: "font-semibold"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
body2: {
|
|
61
|
-
sm: {
|
|
62
|
-
normal: {
|
|
63
|
-
fontSize: "text-14",
|
|
64
|
-
lineHeight: "leading-normal",
|
|
65
|
-
fontWeight: "font-regular"
|
|
66
|
-
},
|
|
67
|
-
point: {
|
|
68
|
-
fontSize: "text-14",
|
|
69
|
-
lineHeight: "leading-normal",
|
|
70
|
-
fontWeight: "font-semibold"
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
md: {
|
|
74
|
-
normal: {
|
|
75
|
-
fontSize: "text-16",
|
|
76
|
-
lineHeight: "leading-normal",
|
|
77
|
-
fontWeight: "font-medium"
|
|
78
|
-
},
|
|
79
|
-
point: {
|
|
80
|
-
fontSize: "text-16",
|
|
81
|
-
lineHeight: "leading-normal",
|
|
82
|
-
fontWeight: "font-semibold"
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
body: {
|
|
87
|
-
sm: {
|
|
88
|
-
normal: {
|
|
89
|
-
fontSize: "text-16",
|
|
90
|
-
lineHeight: "leading-tight",
|
|
91
|
-
fontWeight: "font-regular"
|
|
92
|
-
},
|
|
93
|
-
point: {
|
|
94
|
-
fontSize: "text-16",
|
|
95
|
-
lineHeight: "leading-normal",
|
|
96
|
-
fontWeight: "font-bold"
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
md: {
|
|
100
|
-
normal: {
|
|
101
|
-
fontSize: "text-18",
|
|
102
|
-
lineHeight: "leading-normal",
|
|
103
|
-
fontWeight: "font-medium"
|
|
104
|
-
},
|
|
105
|
-
point: {
|
|
106
|
-
fontSize: "text-18",
|
|
107
|
-
lineHeight: "leading-normal",
|
|
108
|
-
fontWeight: "font-bold"
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
subtitle: {
|
|
113
|
-
sm: {
|
|
114
|
-
normal: {
|
|
115
|
-
fontSize: "text-18",
|
|
116
|
-
lineHeight: "leading-normal",
|
|
117
|
-
fontWeight: "font-medium"
|
|
118
|
-
},
|
|
119
|
-
point: {
|
|
120
|
-
fontSize: "text-18",
|
|
121
|
-
lineHeight: "leading-normal",
|
|
122
|
-
fontWeight: "font-bold"
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
md: {
|
|
126
|
-
normal: {
|
|
127
|
-
fontSize: "text-20",
|
|
128
|
-
lineHeight: "leading-normal",
|
|
129
|
-
fontWeight: "font-medium"
|
|
130
|
-
},
|
|
131
|
-
point: {
|
|
132
|
-
fontSize: "text-20",
|
|
133
|
-
lineHeight: "leading-normal",
|
|
134
|
-
fontWeight: "font-bold"
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
title: {
|
|
139
|
-
sm: {
|
|
140
|
-
normal: {
|
|
141
|
-
fontSize: "text-22",
|
|
142
|
-
lineHeight: "leading-normal",
|
|
143
|
-
fontWeight: "font-bold"
|
|
144
|
-
},
|
|
145
|
-
point: {
|
|
146
|
-
fontSize: "text-22",
|
|
147
|
-
lineHeight: "leading-normal",
|
|
148
|
-
fontWeight: "font-bold"
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
md: {
|
|
152
|
-
normal: {
|
|
153
|
-
fontSize: "text-32",
|
|
154
|
-
lineHeight: "leading-normal",
|
|
155
|
-
fontWeight: "font-bold"
|
|
156
|
-
},
|
|
157
|
-
point: {
|
|
158
|
-
fontSize: "text-32",
|
|
159
|
-
lineHeight: "leading-normal",
|
|
160
|
-
fontWeight: "font-bold"
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
head: {
|
|
165
|
-
sm: {
|
|
166
|
-
normal: {
|
|
167
|
-
fontSize: "text-30",
|
|
168
|
-
lineHeight: "leading-normal",
|
|
169
|
-
fontWeight: "font-bold"
|
|
170
|
-
},
|
|
171
|
-
point: {
|
|
172
|
-
fontSize: "text-30",
|
|
173
|
-
lineHeight: "leading-normal",
|
|
174
|
-
fontWeight: "font-bold"
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
md: {
|
|
178
|
-
normal: {
|
|
179
|
-
fontSize: "text-48",
|
|
180
|
-
lineHeight: "leading-normal",
|
|
181
|
-
fontWeight: "font-bold"
|
|
182
|
-
},
|
|
183
|
-
point: {
|
|
184
|
-
fontSize: "text-48",
|
|
185
|
-
lineHeight: "leading-normal",
|
|
186
|
-
fontWeight: "font-bold"
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
38
|
+
var alignClasses = {
|
|
39
|
+
left: "text-left",
|
|
40
|
+
center: "text-center",
|
|
41
|
+
right: "text-right",
|
|
42
|
+
justify: "text-justify"
|
|
190
43
|
};
|
|
191
|
-
var
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
44
|
+
var typographyStyles = {
|
|
45
|
+
// Caption variants
|
|
46
|
+
"caption-sm": "typo-caption-sm",
|
|
47
|
+
"caption-sm-point": "typo-caption-sm-point",
|
|
48
|
+
"caption-md": "typo-caption-md",
|
|
49
|
+
"caption-md-point": "typo-caption-md-point",
|
|
50
|
+
// Body2 variants
|
|
51
|
+
"body2-sm": "typo-body2-sm",
|
|
52
|
+
"body2-sm-point": "typo-body2-sm-point",
|
|
53
|
+
"body2-md": "typo-body2-md",
|
|
54
|
+
"body2-md-point": "typo-body2-md-point",
|
|
55
|
+
// Body variants
|
|
56
|
+
"body-sm": "typo-body-sm",
|
|
57
|
+
"body-sm-point": "typo-body-sm-point",
|
|
58
|
+
"body-md": "typo-body-md",
|
|
59
|
+
"body-md-point": "typo-body-md-point",
|
|
60
|
+
// Subtitle variants
|
|
61
|
+
"subtitle-sm": "typo-subtitle-sm",
|
|
62
|
+
"subtitle-sm-point": "typo-subtitle-sm-point",
|
|
63
|
+
"subtitle-md": "typo-subtitle-md",
|
|
64
|
+
"subtitle-md-point": "typo-subtitle-md-point",
|
|
65
|
+
// Title variants (always bold)
|
|
66
|
+
"title-sm": "typo-title-sm",
|
|
67
|
+
"title-md": "typo-title-md",
|
|
68
|
+
// Head variants (always bold)
|
|
69
|
+
"head-sm": "typo-head-sm",
|
|
70
|
+
"head-md": "typo-head-md",
|
|
71
|
+
// Fixed size variants
|
|
72
|
+
"fixed-12": "typo-fixed-12",
|
|
73
|
+
"fixed-14": "typo-fixed-14",
|
|
74
|
+
"fixed-15": "typo-fixed-15",
|
|
75
|
+
"fixed-16": "typo-fixed-16",
|
|
76
|
+
"fixed-18": "typo-fixed-18",
|
|
77
|
+
"fixed-20": "typo-fixed-20",
|
|
78
|
+
"fixed-24": "typo-fixed-24"
|
|
227
79
|
};
|
|
228
80
|
function textStyles({
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
point,
|
|
233
|
-
color
|
|
81
|
+
typography,
|
|
82
|
+
textColor,
|
|
83
|
+
align
|
|
234
84
|
}) {
|
|
235
85
|
const baseStyles = "font-sans";
|
|
236
|
-
const colorClass = colorClasses[
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
} else if (variant !== "fixed") {
|
|
241
|
-
const variantConfig = variantStyles[variant][size];
|
|
242
|
-
config = point ? variantConfig.point : variantConfig.normal;
|
|
243
|
-
} else {
|
|
244
|
-
config = fixedStyles[16];
|
|
245
|
-
}
|
|
246
|
-
return `${baseStyles} ${colorClass} ${config.fontSize} ${config.lineHeight} ${config.fontWeight}`.trim();
|
|
247
|
-
}
|
|
248
|
-
function mergeStyles(...inputs) {
|
|
249
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
86
|
+
const colorClass = colorClasses[textColor];
|
|
87
|
+
const typographyClass = typographyStyles[typography];
|
|
88
|
+
const alignClass = align ? alignClasses[align] : "";
|
|
89
|
+
return mergeStyles([baseStyles, colorClass, typographyClass, alignClass]);
|
|
250
90
|
}
|
|
251
91
|
|
|
252
92
|
// src/components/Text/Text.tsx
|
|
253
93
|
var Text = ({
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
color = "gray-700",
|
|
259
|
-
as: Component = "span",
|
|
94
|
+
typography = "body-sm",
|
|
95
|
+
textColor = "gray-700",
|
|
96
|
+
align,
|
|
97
|
+
as,
|
|
260
98
|
children,
|
|
261
99
|
className = "",
|
|
262
100
|
...props
|
|
263
101
|
}) => {
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
fixedSize,
|
|
268
|
-
point,
|
|
269
|
-
color
|
|
270
|
-
});
|
|
271
|
-
return React__default.default.createElement(
|
|
102
|
+
const Component = as || "span";
|
|
103
|
+
const classes = textStyles({ typography, textColor, align });
|
|
104
|
+
return React4__default.default.createElement(
|
|
272
105
|
Component,
|
|
273
106
|
{
|
|
274
107
|
className: mergeStyles(classes, className),
|
|
@@ -278,6 +111,564 @@ var Text = ({
|
|
|
278
111
|
);
|
|
279
112
|
};
|
|
280
113
|
Text.displayName = "Text";
|
|
114
|
+
var FieldContext = React4.createContext(null);
|
|
115
|
+
var useFieldContext = () => {
|
|
116
|
+
const context = React4.useContext(FieldContext);
|
|
117
|
+
if (!context) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
return context;
|
|
121
|
+
};
|
|
122
|
+
var FieldRoot = ({
|
|
123
|
+
children,
|
|
124
|
+
disabled = false,
|
|
125
|
+
error = false,
|
|
126
|
+
className,
|
|
127
|
+
...props
|
|
128
|
+
}) => {
|
|
129
|
+
const id = React4.useId();
|
|
130
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FieldContext.Provider, { value: { id, disabled, error }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: mergeStyles("flex flex-col gap-2", className), ...props, children }) });
|
|
131
|
+
};
|
|
132
|
+
var FieldLabel = ({
|
|
133
|
+
children,
|
|
134
|
+
className,
|
|
135
|
+
typography = "body-sm-point",
|
|
136
|
+
textColor = "gray-700",
|
|
137
|
+
...labelProps
|
|
138
|
+
}) => {
|
|
139
|
+
const fieldContext = useFieldContext();
|
|
140
|
+
const id = fieldContext?.id;
|
|
141
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
142
|
+
Text,
|
|
143
|
+
{
|
|
144
|
+
typography,
|
|
145
|
+
textColor,
|
|
146
|
+
htmlFor: id,
|
|
147
|
+
className: mergeStyles("px-1", className),
|
|
148
|
+
...labelProps,
|
|
149
|
+
children
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
var FieldDescription = ({
|
|
154
|
+
children,
|
|
155
|
+
className,
|
|
156
|
+
...props
|
|
157
|
+
}) => {
|
|
158
|
+
const fieldContext = useFieldContext();
|
|
159
|
+
const id = fieldContext?.id;
|
|
160
|
+
const error = fieldContext?.error;
|
|
161
|
+
if (error) return null;
|
|
162
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
163
|
+
Text,
|
|
164
|
+
{
|
|
165
|
+
typography: "body2-sm",
|
|
166
|
+
textColor: "gray-400",
|
|
167
|
+
id: id ? `${id}-description` : void 0,
|
|
168
|
+
className,
|
|
169
|
+
...props,
|
|
170
|
+
children
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
};
|
|
174
|
+
var FieldErrorDescription = ({
|
|
175
|
+
children,
|
|
176
|
+
className,
|
|
177
|
+
...props
|
|
178
|
+
}) => {
|
|
179
|
+
const fieldContext = useFieldContext();
|
|
180
|
+
const id = fieldContext?.id;
|
|
181
|
+
const error = fieldContext?.error;
|
|
182
|
+
if (!error) return null;
|
|
183
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
184
|
+
Text,
|
|
185
|
+
{
|
|
186
|
+
typography: "body2-sm",
|
|
187
|
+
textColor: "red-400",
|
|
188
|
+
id: id ? `${id}-error` : void 0,
|
|
189
|
+
className,
|
|
190
|
+
...props,
|
|
191
|
+
children
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
};
|
|
195
|
+
FieldRoot.displayName = "Field";
|
|
196
|
+
FieldLabel.displayName = "Field.Label";
|
|
197
|
+
FieldDescription.displayName = "Field.Description";
|
|
198
|
+
FieldErrorDescription.displayName = "Field.ErrorDescription";
|
|
199
|
+
var Field = Object.assign(FieldRoot, {
|
|
200
|
+
Label: FieldLabel,
|
|
201
|
+
Description: FieldDescription,
|
|
202
|
+
ErrorDescription: FieldErrorDescription
|
|
203
|
+
});
|
|
204
|
+
var TextInput = ({
|
|
205
|
+
id: idProp,
|
|
206
|
+
disabled: disabledProp,
|
|
207
|
+
error: errorProp,
|
|
208
|
+
className,
|
|
209
|
+
leftIcon,
|
|
210
|
+
rightIcon,
|
|
211
|
+
variant = "default",
|
|
212
|
+
typography = "body2-sm",
|
|
213
|
+
textColor = "gray-700",
|
|
214
|
+
...props
|
|
215
|
+
}) => {
|
|
216
|
+
const field = useFieldContext();
|
|
217
|
+
const id = idProp ?? field?.id;
|
|
218
|
+
const disabled = disabledProp ?? field?.disabled ?? false;
|
|
219
|
+
const error = errorProp ?? field?.error ?? false;
|
|
220
|
+
const classes = textStyles({ typography, textColor });
|
|
221
|
+
const inputStyles = mergeStyles(
|
|
222
|
+
"w-full bg-transparent outline-none",
|
|
223
|
+
"placeholder:text-gray-400",
|
|
224
|
+
"caret-gray-600"
|
|
225
|
+
);
|
|
226
|
+
const variantStyles = {
|
|
227
|
+
default: mergeStyles(
|
|
228
|
+
"rounded-md p-4",
|
|
229
|
+
"bg-white",
|
|
230
|
+
"focus-within:ring-2 focus-within:ring-gray-600"
|
|
231
|
+
),
|
|
232
|
+
underline: mergeStyles(
|
|
233
|
+
"py-2 px-0",
|
|
234
|
+
"border-b border-gray-400",
|
|
235
|
+
"bg-transparent",
|
|
236
|
+
"focus-within:border-gray-600"
|
|
237
|
+
)
|
|
238
|
+
};
|
|
239
|
+
const wrapperStyles = mergeStyles(
|
|
240
|
+
"flex items-center gap-2 self-stretch",
|
|
241
|
+
variantStyles[variant],
|
|
242
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
243
|
+
error && variant === "default" && "ring-2 ring-red-400 focus-within:ring-red-400",
|
|
244
|
+
error && variant === "underline" && "border-red-400 focus-within:border-red-400",
|
|
245
|
+
className
|
|
246
|
+
);
|
|
247
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperStyles, children: [
|
|
248
|
+
leftIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 text-gray-400", children: leftIcon }),
|
|
249
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
250
|
+
"input",
|
|
251
|
+
{
|
|
252
|
+
id,
|
|
253
|
+
disabled,
|
|
254
|
+
className: mergeStyles(inputStyles, classes),
|
|
255
|
+
...props
|
|
256
|
+
}
|
|
257
|
+
),
|
|
258
|
+
rightIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 text-gray-400", children: rightIcon })
|
|
259
|
+
] });
|
|
260
|
+
};
|
|
261
|
+
TextInput.displayName = "TextInput";
|
|
262
|
+
function createPrimitive(node) {
|
|
263
|
+
const Node = (props) => {
|
|
264
|
+
const { asChild, ...primitiveProps } = props;
|
|
265
|
+
const Comp = asChild ? reactSlot.Slot : node;
|
|
266
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps });
|
|
267
|
+
};
|
|
268
|
+
Node.displayName = `Primitive.${node}`;
|
|
269
|
+
return Node;
|
|
270
|
+
}
|
|
271
|
+
var Primitive = {
|
|
272
|
+
div: createPrimitive("div"),
|
|
273
|
+
span: createPrimitive("span"),
|
|
274
|
+
img: createPrimitive("img"),
|
|
275
|
+
button: createPrimitive("button"),
|
|
276
|
+
label: createPrimitive("label"),
|
|
277
|
+
input: createPrimitive("input"),
|
|
278
|
+
textarea: createPrimitive("textarea"),
|
|
279
|
+
a: createPrimitive("a"),
|
|
280
|
+
p: createPrimitive("p"),
|
|
281
|
+
h2: createPrimitive("h2"),
|
|
282
|
+
ul: createPrimitive("ul"),
|
|
283
|
+
li: createPrimitive("li"),
|
|
284
|
+
svg: createPrimitive("svg"),
|
|
285
|
+
circle: createPrimitive("circle")
|
|
286
|
+
};
|
|
287
|
+
var TextAreaRoot = ({ className, children, ...props }) => {
|
|
288
|
+
const field = useFieldContext();
|
|
289
|
+
const wrapperStyles = mergeStyles(
|
|
290
|
+
"rounded-md p-4",
|
|
291
|
+
"bg-white",
|
|
292
|
+
"focus-within:ring-2 focus-within:ring-gray-600",
|
|
293
|
+
field?.disabled && "cursor-not-allowed opacity-50",
|
|
294
|
+
field?.error && "ring-2 ring-red-400 focus-within:ring-red-400",
|
|
295
|
+
className
|
|
296
|
+
);
|
|
297
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { className: wrapperStyles, ...props, children });
|
|
298
|
+
};
|
|
299
|
+
var TextAreaInput = ({
|
|
300
|
+
resize = true,
|
|
301
|
+
disabled: disabledProp,
|
|
302
|
+
className,
|
|
303
|
+
...props
|
|
304
|
+
}) => {
|
|
305
|
+
const field = useFieldContext();
|
|
306
|
+
const disabled = disabledProp ?? field?.disabled ?? false;
|
|
307
|
+
const textareaStyles = mergeStyles(
|
|
308
|
+
"w-full min-w-0 min-h-10 bg-transparent outline-none",
|
|
309
|
+
"typo-body-sm",
|
|
310
|
+
"text-gray-700 placeholder:text-gray-400",
|
|
311
|
+
"caret-gray-600",
|
|
312
|
+
resize ? "resize-y" : "resize-none",
|
|
313
|
+
disabled && "cursor-not-allowed",
|
|
314
|
+
className
|
|
315
|
+
);
|
|
316
|
+
return /* @__PURE__ */ jsxRuntime.jsx("textarea", { className: textareaStyles, disabled, ...props });
|
|
317
|
+
};
|
|
318
|
+
var TextAreaFooter = ({
|
|
319
|
+
className,
|
|
320
|
+
children,
|
|
321
|
+
...props
|
|
322
|
+
}) => {
|
|
323
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { className: mergeStyles("mt-2", className), ...props, children });
|
|
324
|
+
};
|
|
325
|
+
TextAreaRoot.displayName = "TextArea";
|
|
326
|
+
TextAreaInput.displayName = "TextArea.Input";
|
|
327
|
+
TextAreaFooter.displayName = "TextArea.Footer";
|
|
328
|
+
var TextArea = Object.assign(TextAreaRoot, {
|
|
329
|
+
Input: TextAreaInput,
|
|
330
|
+
Footer: TextAreaFooter
|
|
331
|
+
});
|
|
332
|
+
var RadioGroupContext = React4.createContext(null);
|
|
333
|
+
var useRadioGroupContext = () => {
|
|
334
|
+
return React4.useContext(RadioGroupContext);
|
|
335
|
+
};
|
|
336
|
+
var RadioGroup = ({
|
|
337
|
+
name,
|
|
338
|
+
value,
|
|
339
|
+
defaultValue,
|
|
340
|
+
onValueChange,
|
|
341
|
+
className,
|
|
342
|
+
children,
|
|
343
|
+
...props
|
|
344
|
+
}) => {
|
|
345
|
+
const [internalValue, setInternalValue] = React4__default.default.useState(defaultValue);
|
|
346
|
+
const currentValue = value ?? internalValue;
|
|
347
|
+
const handleChange = (newValue) => {
|
|
348
|
+
if (value === void 0) {
|
|
349
|
+
setInternalValue(newValue);
|
|
350
|
+
}
|
|
351
|
+
onValueChange?.(newValue);
|
|
352
|
+
};
|
|
353
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
354
|
+
RadioGroupContext.Provider,
|
|
355
|
+
{
|
|
356
|
+
value: { name, value: currentValue, onChange: handleChange },
|
|
357
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
358
|
+
Primitive.div,
|
|
359
|
+
{
|
|
360
|
+
role: "radiogroup",
|
|
361
|
+
className: mergeStyles("flex flex-col gap-5", className),
|
|
362
|
+
...props,
|
|
363
|
+
children
|
|
364
|
+
}
|
|
365
|
+
)
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
};
|
|
369
|
+
var RadioIcon = ({ checked }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
370
|
+
"svg",
|
|
371
|
+
{
|
|
372
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
373
|
+
width: "20",
|
|
374
|
+
height: "20",
|
|
375
|
+
viewBox: "0 0 20 20",
|
|
376
|
+
fill: "none",
|
|
377
|
+
className: "transition-all duration-150 ease-in-out",
|
|
378
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
379
|
+
"circle",
|
|
380
|
+
{
|
|
381
|
+
cx: "10",
|
|
382
|
+
cy: "10",
|
|
383
|
+
r: checked ? 7 : 7.5,
|
|
384
|
+
stroke: "currentColor",
|
|
385
|
+
strokeWidth: checked ? 6 : 5,
|
|
386
|
+
className: "transition-all duration-150 ease-in-out"
|
|
387
|
+
}
|
|
388
|
+
)
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
var Radio = ({
|
|
392
|
+
value,
|
|
393
|
+
children,
|
|
394
|
+
className,
|
|
395
|
+
checked: checkedProp,
|
|
396
|
+
onChange,
|
|
397
|
+
...props
|
|
398
|
+
}) => {
|
|
399
|
+
const group = useRadioGroupContext();
|
|
400
|
+
const isChecked = group ? group.value === value : checkedProp;
|
|
401
|
+
const name = group?.name ?? props.name;
|
|
402
|
+
const handleChange = (e) => {
|
|
403
|
+
group?.onChange?.(value);
|
|
404
|
+
onChange?.(e);
|
|
405
|
+
};
|
|
406
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
407
|
+
"label",
|
|
408
|
+
{
|
|
409
|
+
className: mergeStyles(
|
|
410
|
+
"flex cursor-pointer items-center gap-2",
|
|
411
|
+
"transition-opacity duration-150 hover:opacity-80",
|
|
412
|
+
className
|
|
413
|
+
),
|
|
414
|
+
children: [
|
|
415
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
416
|
+
"input",
|
|
417
|
+
{
|
|
418
|
+
type: "radio",
|
|
419
|
+
name,
|
|
420
|
+
value,
|
|
421
|
+
checked: isChecked,
|
|
422
|
+
onChange: handleChange,
|
|
423
|
+
className: "sr-only",
|
|
424
|
+
...props
|
|
425
|
+
}
|
|
426
|
+
),
|
|
427
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
428
|
+
"span",
|
|
429
|
+
{
|
|
430
|
+
className: mergeStyles(
|
|
431
|
+
"flex-shrink-0 transition-colors duration-150",
|
|
432
|
+
isChecked ? "text-gray-800 hover:text-gray-800" : "text-gray-200 hover:text-gray-400"
|
|
433
|
+
),
|
|
434
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(RadioIcon, { checked: !!isChecked })
|
|
435
|
+
}
|
|
436
|
+
),
|
|
437
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text, { typography: "body-sm", textColor: "gray-800", children })
|
|
438
|
+
]
|
|
439
|
+
}
|
|
440
|
+
);
|
|
441
|
+
};
|
|
442
|
+
RadioGroup.displayName = "RadioGroup";
|
|
443
|
+
Radio.displayName = "Radio";
|
|
444
|
+
var ToggleContext = React4__default.default.createContext(null);
|
|
445
|
+
var useToggleContext = () => {
|
|
446
|
+
const context = React4__default.default.useContext(ToggleContext);
|
|
447
|
+
if (!context) {
|
|
448
|
+
throw new Error(
|
|
449
|
+
"Toggle \uC11C\uBE0C \uCEF4\uD3EC\uB10C\uD2B8\uB294 <Toggle> \uCEF4\uD3EC\uB10C\uD2B8 \uB0B4\uBD80\uC5D0\uC11C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4. ex) <Toggle><Toggle.Switch /></Toggle>"
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
return context;
|
|
453
|
+
};
|
|
454
|
+
var ToggleRoot = ({
|
|
455
|
+
checked: checkedProp,
|
|
456
|
+
defaultChecked = false,
|
|
457
|
+
onCheckedChange,
|
|
458
|
+
disabled,
|
|
459
|
+
children,
|
|
460
|
+
className,
|
|
461
|
+
...props
|
|
462
|
+
}) => {
|
|
463
|
+
const [internalChecked, setInternalChecked] = React4.useState(defaultChecked);
|
|
464
|
+
const isChecked = checkedProp !== void 0 ? checkedProp : internalChecked;
|
|
465
|
+
const handleChange = () => {
|
|
466
|
+
if (disabled) return;
|
|
467
|
+
const newChecked = !isChecked;
|
|
468
|
+
if (checkedProp === void 0) {
|
|
469
|
+
setInternalChecked(newChecked);
|
|
470
|
+
}
|
|
471
|
+
onCheckedChange?.(newChecked);
|
|
472
|
+
};
|
|
473
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToggleContext.Provider, { value: { checked: isChecked, disabled }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
474
|
+
"label",
|
|
475
|
+
{
|
|
476
|
+
className: mergeStyles(
|
|
477
|
+
"inline-flex cursor-pointer items-center gap-2",
|
|
478
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
479
|
+
className
|
|
480
|
+
),
|
|
481
|
+
...props,
|
|
482
|
+
children: [
|
|
483
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
484
|
+
"input",
|
|
485
|
+
{
|
|
486
|
+
type: "checkbox",
|
|
487
|
+
checked: isChecked,
|
|
488
|
+
onChange: handleChange,
|
|
489
|
+
disabled,
|
|
490
|
+
className: "sr-only"
|
|
491
|
+
}
|
|
492
|
+
),
|
|
493
|
+
children
|
|
494
|
+
]
|
|
495
|
+
}
|
|
496
|
+
) });
|
|
497
|
+
};
|
|
498
|
+
var ToggleSwitch = () => {
|
|
499
|
+
const { checked } = useToggleContext();
|
|
500
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
501
|
+
"span",
|
|
502
|
+
{
|
|
503
|
+
className: mergeStyles(
|
|
504
|
+
"relative inline-flex items-center rounded-full p-1 transition-colors duration-200 ease-in-out",
|
|
505
|
+
"h-7 w-12",
|
|
506
|
+
// 48px x 28px
|
|
507
|
+
checked ? "bg-gray-600" : "bg-gray-200"
|
|
508
|
+
),
|
|
509
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
510
|
+
"span",
|
|
511
|
+
{
|
|
512
|
+
className: mergeStyles(
|
|
513
|
+
"pointer-events-none inline-block rounded-full bg-white shadow-sm transition-transform duration-200 ease-in-out",
|
|
514
|
+
"h-5 w-5",
|
|
515
|
+
// 20px
|
|
516
|
+
checked ? "translate-x-5" : "translate-x-0"
|
|
517
|
+
)
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
}
|
|
521
|
+
);
|
|
522
|
+
};
|
|
523
|
+
var ToggleLabel = ({
|
|
524
|
+
children,
|
|
525
|
+
typography = "fixed-16",
|
|
526
|
+
textColor = "gray-700",
|
|
527
|
+
...props
|
|
528
|
+
}) => {
|
|
529
|
+
const { disabled } = useToggleContext();
|
|
530
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
531
|
+
Text,
|
|
532
|
+
{
|
|
533
|
+
typography,
|
|
534
|
+
textColor: disabled ? "gray-400" : textColor,
|
|
535
|
+
...props,
|
|
536
|
+
children
|
|
537
|
+
}
|
|
538
|
+
);
|
|
539
|
+
};
|
|
540
|
+
ToggleRoot.displayName = "Toggle";
|
|
541
|
+
ToggleSwitch.displayName = "Toggle.Switch";
|
|
542
|
+
ToggleLabel.displayName = "Toggle.Label";
|
|
543
|
+
var Toggle = Object.assign(ToggleRoot, {
|
|
544
|
+
Switch: ToggleSwitch,
|
|
545
|
+
Label: ToggleLabel
|
|
546
|
+
});
|
|
547
|
+
var CheckboxContext = React4__default.default.createContext(null);
|
|
548
|
+
var useCheckboxContext = () => {
|
|
549
|
+
const context = React4__default.default.useContext(CheckboxContext);
|
|
550
|
+
if (!context) {
|
|
551
|
+
throw new Error(
|
|
552
|
+
"Checkbox \uC11C\uBE0C \uCEF4\uD3EC\uB10C\uD2B8\uB294 <Checkbox> \uCEF4\uD3EC\uB10C\uD2B8 \uB0B4\uBD80\uC5D0\uC11C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4. ex) <Checkbox><Checkbox.Indicator /></Checkbox>"
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
return context;
|
|
556
|
+
};
|
|
557
|
+
var CheckboxRoot = ({
|
|
558
|
+
checked: checkedProp,
|
|
559
|
+
defaultChecked = false,
|
|
560
|
+
onCheckedChange,
|
|
561
|
+
disabled,
|
|
562
|
+
children,
|
|
563
|
+
className,
|
|
564
|
+
...props
|
|
565
|
+
}) => {
|
|
566
|
+
const [internalChecked, setInternalChecked] = React4.useState(defaultChecked);
|
|
567
|
+
const isChecked = checkedProp !== void 0 ? checkedProp : internalChecked;
|
|
568
|
+
const handleChange = () => {
|
|
569
|
+
if (disabled) return;
|
|
570
|
+
const newChecked = !isChecked;
|
|
571
|
+
if (checkedProp === void 0) {
|
|
572
|
+
setInternalChecked(newChecked);
|
|
573
|
+
}
|
|
574
|
+
onCheckedChange?.(newChecked);
|
|
575
|
+
};
|
|
576
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckboxContext.Provider, { value: { checked: isChecked, disabled }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
577
|
+
"label",
|
|
578
|
+
{
|
|
579
|
+
className: mergeStyles(
|
|
580
|
+
"inline-flex cursor-pointer items-center gap-2",
|
|
581
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
582
|
+
className
|
|
583
|
+
),
|
|
584
|
+
...props,
|
|
585
|
+
children: [
|
|
586
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
587
|
+
"input",
|
|
588
|
+
{
|
|
589
|
+
type: "checkbox",
|
|
590
|
+
checked: isChecked,
|
|
591
|
+
onChange: handleChange,
|
|
592
|
+
disabled,
|
|
593
|
+
className: "sr-only"
|
|
594
|
+
}
|
|
595
|
+
),
|
|
596
|
+
children
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
) });
|
|
600
|
+
};
|
|
601
|
+
var CheckboxIndicator = () => {
|
|
602
|
+
const { checked } = useCheckboxContext();
|
|
603
|
+
if (checked) {
|
|
604
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
605
|
+
"svg",
|
|
606
|
+
{
|
|
607
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
608
|
+
width: "18",
|
|
609
|
+
height: "18",
|
|
610
|
+
viewBox: "0 0 18 18",
|
|
611
|
+
fill: "none",
|
|
612
|
+
className: "flex-shrink-0",
|
|
613
|
+
children: [
|
|
614
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "18", height: "18", rx: "4", fill: "#1E2939" }),
|
|
615
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
616
|
+
"path",
|
|
617
|
+
{
|
|
618
|
+
d: "M5 9.08333L7.94737 12L13 7",
|
|
619
|
+
stroke: "white",
|
|
620
|
+
strokeWidth: "2",
|
|
621
|
+
strokeLinecap: "round",
|
|
622
|
+
strokeLinejoin: "round"
|
|
623
|
+
}
|
|
624
|
+
)
|
|
625
|
+
]
|
|
626
|
+
}
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
630
|
+
"span",
|
|
631
|
+
{
|
|
632
|
+
className: mergeStyles(
|
|
633
|
+
"flex-shrink-0",
|
|
634
|
+
"aspect-square h-[18px] w-[18px]",
|
|
635
|
+
"rounded border-2 border-gray-200 bg-white"
|
|
636
|
+
)
|
|
637
|
+
}
|
|
638
|
+
);
|
|
639
|
+
};
|
|
640
|
+
var CheckboxLabel = ({
|
|
641
|
+
children,
|
|
642
|
+
typography = "body-sm",
|
|
643
|
+
textColor = "gray-600",
|
|
644
|
+
...props
|
|
645
|
+
}) => {
|
|
646
|
+
const { disabled } = useCheckboxContext();
|
|
647
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
648
|
+
Text,
|
|
649
|
+
{
|
|
650
|
+
typography,
|
|
651
|
+
textColor: disabled ? "gray-400" : textColor,
|
|
652
|
+
...props,
|
|
653
|
+
children
|
|
654
|
+
}
|
|
655
|
+
);
|
|
656
|
+
};
|
|
657
|
+
CheckboxRoot.displayName = "Checkbox";
|
|
658
|
+
CheckboxIndicator.displayName = "Checkbox.Indicator";
|
|
659
|
+
CheckboxLabel.displayName = "Checkbox.Label";
|
|
660
|
+
var Checkbox = Object.assign(CheckboxRoot, {
|
|
661
|
+
Indicator: CheckboxIndicator,
|
|
662
|
+
Label: CheckboxLabel
|
|
663
|
+
});
|
|
281
664
|
|
|
665
|
+
exports.Checkbox = Checkbox;
|
|
666
|
+
exports.Field = Field;
|
|
667
|
+
exports.Radio = Radio;
|
|
668
|
+
exports.RadioGroup = RadioGroup;
|
|
282
669
|
exports.Text = Text;
|
|
670
|
+
exports.TextArea = TextArea;
|
|
671
|
+
exports.TextInput = TextInput;
|
|
672
|
+
exports.Toggle = Toggle;
|
|
283
673
|
exports.mergeStyles = mergeStyles;
|
|
674
|
+
exports.useRadioGroupContext = useRadioGroupContext;
|