@nation-a/ui 0.8.1 → 0.9.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/index.cjs +383 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +383 -20
- package/dist/index.js.map +1 -1
- package/dist/styled-system/styles.css +144 -12
- package/dist/types/components/Input/Input.stories.d.ts +10 -0
- package/dist/types/components/Input/index.d.ts +25 -0
- package/dist/types/components/Input/input.recipe.d.ts +84 -0
- package/dist/types/components/TextArea/TextArea.stories.d.ts +11 -0
- package/dist/types/components/TextArea/index.d.ts +23 -0
- package/dist/types/components/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4832,7 +4832,7 @@ const Backdrop$1 = withContext$1(DialogBackdrop, "backdrop");
|
|
|
4832
4832
|
const Trigger$1 = withContext$1(DialogTrigger, "trigger");
|
|
4833
4833
|
const Content = withContext$1(DialogContent, "content");
|
|
4834
4834
|
const Title = withContext$1(DialogTitle, "title");
|
|
4835
|
-
const Description = withContext$1(DialogDescription, "description");
|
|
4835
|
+
const Description$1 = withContext$1(DialogDescription, "description");
|
|
4836
4836
|
const Positioner = withContext$1(DialogPositioner, "positioner");
|
|
4837
4837
|
const Header = withContext$1(ark.header, "header");
|
|
4838
4838
|
const Footer = withContext$1(
|
|
@@ -4861,7 +4861,7 @@ const Dialog = {
|
|
|
4861
4861
|
Trigger: Trigger$1,
|
|
4862
4862
|
Content,
|
|
4863
4863
|
Title,
|
|
4864
|
-
Description,
|
|
4864
|
+
Description: Description$1,
|
|
4865
4865
|
Positioner,
|
|
4866
4866
|
Header,
|
|
4867
4867
|
Footer,
|
|
@@ -8772,7 +8772,8 @@ const tagRecipe = cva({
|
|
|
8772
8772
|
textStyle: "label.md",
|
|
8773
8773
|
height: "fit-content",
|
|
8774
8774
|
width: "fit-content",
|
|
8775
|
-
cursor: "default"
|
|
8775
|
+
cursor: "default",
|
|
8776
|
+
outline: "none"
|
|
8776
8777
|
},
|
|
8777
8778
|
variants: {
|
|
8778
8779
|
color: {
|
|
@@ -8908,29 +8909,389 @@ function P({ size: C = 24, color: n = "currentColor", ...o }) {
|
|
|
8908
8909
|
}
|
|
8909
8910
|
);
|
|
8910
8911
|
}
|
|
8911
|
-
const Tag = React.forwardRef(
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8912
|
+
const Tag = React.forwardRef(({ imageSrc, text, onDeleteClick, ...rest }, ref) => {
|
|
8913
|
+
const StyledTag = styled(ark.div, tagRecipe);
|
|
8914
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(StyledTag, { avatar: !!imageSrc, ref, ...rest, children: [
|
|
8915
|
+
imageSrc ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8916
|
+
styled.img,
|
|
8917
|
+
{
|
|
8918
|
+
src: imageSrc,
|
|
8919
|
+
width: 8,
|
|
8920
|
+
height: 8,
|
|
8921
|
+
className: css$1({ borderRadius: "full", overflow: "hidden" }),
|
|
8922
|
+
alt: "avatar thumbnail"
|
|
8923
|
+
}
|
|
8924
|
+
) : null,
|
|
8925
|
+
text,
|
|
8926
|
+
onDeleteClick ? /* @__PURE__ */ jsxRuntime.jsx(P, { size: 12, onClick: onDeleteClick, cursor: "pointer" }) : null
|
|
8927
|
+
] });
|
|
8928
|
+
});
|
|
8929
|
+
Tag.displayName = "Tag";
|
|
8930
|
+
const inputRecipe = cva({
|
|
8931
|
+
base: {
|
|
8932
|
+
display: "flex",
|
|
8933
|
+
flexDirection: "column",
|
|
8934
|
+
alignItems: "center",
|
|
8935
|
+
justifyContent: "center",
|
|
8936
|
+
width: "100%",
|
|
8937
|
+
textStyle: "body.md",
|
|
8938
|
+
cursor: "text",
|
|
8939
|
+
color: "content.neutral.bold",
|
|
8940
|
+
gap: 1,
|
|
8941
|
+
borderStyle: "solid",
|
|
8942
|
+
border: 1,
|
|
8943
|
+
outline: "none",
|
|
8944
|
+
p: 2,
|
|
8945
|
+
"& textarea, & input": {
|
|
8946
|
+
outline: "none",
|
|
8947
|
+
width: "100%",
|
|
8948
|
+
height: "100%"
|
|
8949
|
+
}
|
|
8950
|
+
},
|
|
8951
|
+
variants: {
|
|
8952
|
+
isTextArea: {
|
|
8953
|
+
true: {
|
|
8954
|
+
minHeight: "56px",
|
|
8955
|
+
"& textarea": {
|
|
8956
|
+
background: "transparent",
|
|
8957
|
+
height: "100%",
|
|
8958
|
+
resize: "none",
|
|
8959
|
+
overflowY: "auto"
|
|
8960
|
+
}
|
|
8961
|
+
},
|
|
8962
|
+
false: {
|
|
8963
|
+
minHeight: "48px",
|
|
8964
|
+
maxHeight: "60px"
|
|
8965
|
+
}
|
|
8966
|
+
},
|
|
8967
|
+
variant: {
|
|
8968
|
+
solid: {
|
|
8969
|
+
borderColor: "transparent"
|
|
8970
|
+
},
|
|
8971
|
+
line: {
|
|
8972
|
+
background: "transparent"
|
|
8973
|
+
}
|
|
8974
|
+
},
|
|
8975
|
+
color: {
|
|
8976
|
+
alpha: {
|
|
8977
|
+
"&::placeholder": {
|
|
8978
|
+
color: "content.static.white.subtlest"
|
|
8979
|
+
}
|
|
8980
|
+
},
|
|
8981
|
+
neutral: {
|
|
8982
|
+
"&::placeholder": {
|
|
8983
|
+
color: "content.neutral.subtlest"
|
|
8984
|
+
}
|
|
8985
|
+
}
|
|
8986
|
+
},
|
|
8987
|
+
radius: {
|
|
8988
|
+
md: {
|
|
8989
|
+
borderRadius: 8,
|
|
8990
|
+
px: 2
|
|
8991
|
+
},
|
|
8992
|
+
lg: {
|
|
8993
|
+
borderRadius: 16,
|
|
8994
|
+
px: 2
|
|
8995
|
+
},
|
|
8996
|
+
full: {
|
|
8997
|
+
borderRadius: 9999,
|
|
8998
|
+
px: 4
|
|
8999
|
+
}
|
|
9000
|
+
},
|
|
9001
|
+
state: {
|
|
9002
|
+
// state: Input 컴포넌트 내부 로직, 외부 노출 X (외부에선 disabled만 제어)
|
|
9003
|
+
default: {
|
|
9004
|
+
color: "content.neutral.bold"
|
|
9005
|
+
},
|
|
9006
|
+
selected: {
|
|
9007
|
+
color: "content.neutral.bold"
|
|
9008
|
+
},
|
|
9009
|
+
disabled: {
|
|
9010
|
+
color: "content.neutral.disabled"
|
|
9011
|
+
}
|
|
9012
|
+
}
|
|
9013
|
+
},
|
|
9014
|
+
compoundVariants: [
|
|
9015
|
+
{
|
|
9016
|
+
color: "alpha",
|
|
9017
|
+
state: "disabled",
|
|
9018
|
+
css: {
|
|
9019
|
+
"&::placeholder": {
|
|
9020
|
+
color: "content.static.white.disabled"
|
|
9021
|
+
}
|
|
9022
|
+
}
|
|
9023
|
+
},
|
|
9024
|
+
{
|
|
9025
|
+
color: "neutral",
|
|
9026
|
+
state: "disabled",
|
|
9027
|
+
css: {
|
|
9028
|
+
"&::placeholder": {
|
|
9029
|
+
color: "content.neutral.disabled"
|
|
9030
|
+
}
|
|
9031
|
+
}
|
|
9032
|
+
},
|
|
9033
|
+
{
|
|
9034
|
+
variant: "solid",
|
|
9035
|
+
color: "alpha",
|
|
9036
|
+
state: "default",
|
|
9037
|
+
css: {
|
|
9038
|
+
background: "black.500A"
|
|
9039
|
+
}
|
|
9040
|
+
},
|
|
9041
|
+
{
|
|
9042
|
+
variant: "solid",
|
|
9043
|
+
color: "alpha",
|
|
9044
|
+
state: "selected",
|
|
9045
|
+
css: {
|
|
9046
|
+
background: "black.500A",
|
|
9047
|
+
border: 1,
|
|
9048
|
+
borderColor: "border.neutral.default"
|
|
9049
|
+
}
|
|
9050
|
+
},
|
|
9051
|
+
{
|
|
9052
|
+
variant: "solid",
|
|
9053
|
+
color: "alpha",
|
|
9054
|
+
state: "disabled",
|
|
9055
|
+
css: {
|
|
9056
|
+
background: "black.500A"
|
|
9057
|
+
}
|
|
9058
|
+
},
|
|
9059
|
+
{
|
|
9060
|
+
variant: "solid",
|
|
9061
|
+
color: "neutral",
|
|
9062
|
+
state: "default",
|
|
9063
|
+
css: {
|
|
9064
|
+
background: "background.neutral.default"
|
|
9065
|
+
}
|
|
9066
|
+
},
|
|
9067
|
+
{
|
|
9068
|
+
variant: "solid",
|
|
9069
|
+
color: "neutral",
|
|
9070
|
+
state: "selected",
|
|
9071
|
+
css: {
|
|
9072
|
+
background: "background.neutral.default",
|
|
9073
|
+
border: 1,
|
|
9074
|
+
borderColor: "border.neutral.default"
|
|
9075
|
+
}
|
|
9076
|
+
},
|
|
9077
|
+
{
|
|
9078
|
+
variant: "solid",
|
|
9079
|
+
color: "neutral",
|
|
9080
|
+
state: "disabled",
|
|
9081
|
+
css: {
|
|
9082
|
+
background: "background.neutral.disabled"
|
|
9083
|
+
}
|
|
9084
|
+
},
|
|
9085
|
+
{
|
|
9086
|
+
variant: "line",
|
|
9087
|
+
state: "default",
|
|
9088
|
+
css: {
|
|
9089
|
+
background: "transparent",
|
|
9090
|
+
border: 1,
|
|
9091
|
+
borderColor: "border.neutral.subtle"
|
|
9092
|
+
}
|
|
9093
|
+
},
|
|
9094
|
+
{
|
|
9095
|
+
variant: "line",
|
|
9096
|
+
state: "selected",
|
|
9097
|
+
css: {
|
|
9098
|
+
background: "transparent",
|
|
9099
|
+
border: 1,
|
|
9100
|
+
borderColor: "border.neutral.default"
|
|
9101
|
+
}
|
|
9102
|
+
},
|
|
9103
|
+
{
|
|
9104
|
+
variant: "line",
|
|
9105
|
+
state: "disabled",
|
|
9106
|
+
css: {
|
|
9107
|
+
background: "transparent",
|
|
9108
|
+
border: 1,
|
|
9109
|
+
borderColor: "border.neutral.disabled"
|
|
9110
|
+
}
|
|
9111
|
+
}
|
|
9112
|
+
],
|
|
9113
|
+
defaultVariants: {
|
|
9114
|
+
isTextArea: false,
|
|
9115
|
+
variant: "solid",
|
|
9116
|
+
color: "neutral",
|
|
9117
|
+
state: "default",
|
|
9118
|
+
radius: "md"
|
|
9119
|
+
}
|
|
9120
|
+
});
|
|
9121
|
+
const labelRecipe = cva({
|
|
9122
|
+
base: {
|
|
9123
|
+
textStyle: "label.sm",
|
|
9124
|
+
textAlign: "start",
|
|
9125
|
+
width: "100%",
|
|
9126
|
+
display: "inline-block"
|
|
9127
|
+
},
|
|
9128
|
+
variants: {
|
|
9129
|
+
state: {
|
|
9130
|
+
default: {},
|
|
9131
|
+
selected: {},
|
|
9132
|
+
disabled: {}
|
|
9133
|
+
},
|
|
9134
|
+
color: {
|
|
9135
|
+
alpha: {
|
|
9136
|
+
color: "content.static.white.bold"
|
|
9137
|
+
},
|
|
9138
|
+
neutral: {
|
|
9139
|
+
color: "content.neutral.subtle"
|
|
9140
|
+
}
|
|
9141
|
+
},
|
|
9142
|
+
radius: {
|
|
9143
|
+
md: {},
|
|
9144
|
+
lg: {},
|
|
9145
|
+
full: {}
|
|
9146
|
+
}
|
|
9147
|
+
},
|
|
9148
|
+
compoundVariants: [
|
|
9149
|
+
{
|
|
9150
|
+
state: "disabled",
|
|
9151
|
+
css: {
|
|
9152
|
+
color: "content.neutral.disabled"
|
|
9153
|
+
}
|
|
9154
|
+
}
|
|
9155
|
+
],
|
|
9156
|
+
defaultVariants: {
|
|
9157
|
+
color: "neutral",
|
|
9158
|
+
state: "default",
|
|
9159
|
+
radius: "md"
|
|
9160
|
+
}
|
|
9161
|
+
});
|
|
9162
|
+
const StyledInputWrapper = styled(ark.div, inputRecipe);
|
|
9163
|
+
const StyledLabel$1 = styled(ark.label, labelRecipe);
|
|
9164
|
+
const RequiredStar = () => /* @__PURE__ */ jsxRuntime.jsx(ark.span, { className: css$1({ color: "content.danger.default", paddingLeft: 1 }), children: "*" });
|
|
9165
|
+
const Description = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(ark.span, { className: css$1({ textStyle: "label.sm", color: "content.neutral.subtle", paddingLeft: 1, width: "100%", textAlign: "start" }), children });
|
|
9166
|
+
const Input = React.forwardRef(({ value, required, disabled, label, description, labelPosition = "outside", textLimit, variant, color, radius, onChange, className, ...rest }, ref) => {
|
|
9167
|
+
const [state, setState] = React.useState(disabled ? "disabled" : "default");
|
|
9168
|
+
React.useEffect(() => {
|
|
9169
|
+
setState(disabled ? "disabled" : "default");
|
|
9170
|
+
}, [disabled]);
|
|
9171
|
+
const handleInputChange = (e) => {
|
|
9172
|
+
if (disabled) return;
|
|
9173
|
+
const value2 = e.target.value;
|
|
9174
|
+
if (textLimit && value2.length > textLimit) return;
|
|
9175
|
+
setState(value2 ? "selected" : "default");
|
|
9176
|
+
onChange == null ? void 0 : onChange(e);
|
|
9177
|
+
};
|
|
9178
|
+
const Label = ({ visible, children }) => {
|
|
9179
|
+
console.log("color", color);
|
|
9180
|
+
return visible ? /* @__PURE__ */ jsxRuntime.jsxs(StyledLabel$1, { state, color, radius, children: [
|
|
9181
|
+
children,
|
|
9182
|
+
required && /* @__PURE__ */ jsxRuntime.jsx(RequiredStar, {})
|
|
9183
|
+
] }) : null;
|
|
9184
|
+
};
|
|
9185
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(VStack$1, { gap: 1, children: [
|
|
9186
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { visible: !!(label && labelPosition === "outside"), children: label }),
|
|
9187
|
+
/* @__PURE__ */ jsxRuntime.jsxs(StyledInputWrapper, { state, variant, color, radius, className: cx(css$1({ display: "flex", flexDirection: "column", gap: 1 }), className), children: [
|
|
9188
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { visible: !!(label && labelPosition === "inside"), children: label }),
|
|
9189
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9190
|
+
"input",
|
|
8917
9191
|
{
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
9192
|
+
value,
|
|
9193
|
+
disabled,
|
|
9194
|
+
onFocus: () => !disabled && setState("selected"),
|
|
9195
|
+
onBlur: () => !disabled && setState("default"),
|
|
9196
|
+
onChange: handleInputChange,
|
|
9197
|
+
ref,
|
|
9198
|
+
...rest
|
|
9199
|
+
}
|
|
9200
|
+
)
|
|
9201
|
+
] }),
|
|
9202
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(Description, { children: description })
|
|
9203
|
+
] });
|
|
9204
|
+
});
|
|
9205
|
+
Input.displayName = "Input";
|
|
9206
|
+
const StyledTextAreaWrapper = styled(ark.div, inputRecipe);
|
|
9207
|
+
const StyledLabel = styled(ark.label, labelRecipe);
|
|
9208
|
+
const TextLengthIndicator = ({ count, limit, disabled }) => {
|
|
9209
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9210
|
+
ark.span,
|
|
9211
|
+
{
|
|
9212
|
+
className: css$1({
|
|
9213
|
+
display: "inline-block",
|
|
9214
|
+
width: "100%",
|
|
9215
|
+
textAlign: "end",
|
|
9216
|
+
paddingRight: 1,
|
|
9217
|
+
marginTop: -0.5,
|
|
9218
|
+
textStyle: "label.sm",
|
|
9219
|
+
color: disabled ? "content.neutral.disabled" : "content.neutral.subtlest"
|
|
9220
|
+
}),
|
|
9221
|
+
children: `${count}${limit ? ` / ${limit}` : ""}`
|
|
9222
|
+
}
|
|
9223
|
+
);
|
|
9224
|
+
};
|
|
9225
|
+
const Textarea = React.forwardRef(
|
|
9226
|
+
({
|
|
9227
|
+
value,
|
|
9228
|
+
required = false,
|
|
9229
|
+
disabled = false,
|
|
9230
|
+
label,
|
|
9231
|
+
description,
|
|
9232
|
+
labelPosition = "outside",
|
|
9233
|
+
textLimit,
|
|
9234
|
+
showTextCount = false,
|
|
9235
|
+
isTextArea,
|
|
9236
|
+
color,
|
|
9237
|
+
radius,
|
|
9238
|
+
variant,
|
|
9239
|
+
onChange,
|
|
9240
|
+
className,
|
|
9241
|
+
...rest
|
|
9242
|
+
}, ref) => {
|
|
9243
|
+
const [state, setState] = React.useState(disabled ? "disabled" : "default");
|
|
9244
|
+
React.useEffect(() => {
|
|
9245
|
+
setState(disabled ? "disabled" : "default");
|
|
9246
|
+
}, [disabled]);
|
|
9247
|
+
const handleTextareaChange = (e) => {
|
|
9248
|
+
if (disabled) return;
|
|
9249
|
+
const value2 = e.target.value;
|
|
9250
|
+
if (textLimit && value2.length > textLimit) return;
|
|
9251
|
+
setState(value2 ? "selected" : "default");
|
|
9252
|
+
onChange == null ? void 0 : onChange(e);
|
|
9253
|
+
e.target.scrollTop = e.target.scrollHeight;
|
|
9254
|
+
};
|
|
9255
|
+
const Label = ({ visible, children }) => {
|
|
9256
|
+
return visible ? /* @__PURE__ */ jsxRuntime.jsxs(StyledLabel, { state, color, radius, children: [
|
|
9257
|
+
children,
|
|
9258
|
+
required && /* @__PURE__ */ jsxRuntime.jsx(RequiredStar, {})
|
|
9259
|
+
] }) : null;
|
|
9260
|
+
};
|
|
9261
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(VStack$1, { gap: 1, children: [
|
|
9262
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { visible: !!(label && labelPosition === "outside"), children: label }),
|
|
9263
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
9264
|
+
StyledTextAreaWrapper,
|
|
9265
|
+
{
|
|
9266
|
+
isTextArea: true,
|
|
9267
|
+
state,
|
|
9268
|
+
color,
|
|
9269
|
+
radius,
|
|
9270
|
+
variant,
|
|
9271
|
+
className: cx(css$1({ position: "relative", display: "flex", flexDirection: "column", gap: 1 }), className),
|
|
9272
|
+
children: [
|
|
9273
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { visible: !!(label && labelPosition === "inside"), children: label }),
|
|
9274
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9275
|
+
"textarea",
|
|
9276
|
+
{
|
|
9277
|
+
value,
|
|
9278
|
+
disabled,
|
|
9279
|
+
onChange: handleTextareaChange,
|
|
9280
|
+
onFocus: () => !disabled && setState("selected"),
|
|
9281
|
+
onBlur: () => !disabled && setState("default"),
|
|
9282
|
+
ref,
|
|
9283
|
+
...rest
|
|
9284
|
+
}
|
|
9285
|
+
),
|
|
9286
|
+
showTextCount && /* @__PURE__ */ jsxRuntime.jsx(TextLengthIndicator, { count: value.length, limit: textLimit, disabled })
|
|
9287
|
+
]
|
|
8926
9288
|
}
|
|
8927
9289
|
),
|
|
8928
|
-
|
|
8929
|
-
onDeleteClick ? /* @__PURE__ */ jsxRuntime.jsx(P, { size: 12, onClick: onDeleteClick, cursor: "pointer" }) : null
|
|
9290
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(Description, { children: description })
|
|
8930
9291
|
] });
|
|
8931
9292
|
}
|
|
8932
9293
|
);
|
|
8933
|
-
|
|
9294
|
+
Textarea.displayName = "Textarea";
|
|
8934
9295
|
function definePreset(preset2) {
|
|
8935
9296
|
return preset2;
|
|
8936
9297
|
}
|
|
@@ -9250,12 +9611,14 @@ exports.Grid = Grid2;
|
|
|
9250
9611
|
exports.GridItem = GridItem2;
|
|
9251
9612
|
exports.HStack = HStack2;
|
|
9252
9613
|
exports.IconButton = index;
|
|
9614
|
+
exports.Input = Input;
|
|
9253
9615
|
exports.Navigation = Navigation;
|
|
9254
9616
|
exports.Portal = Portal;
|
|
9255
9617
|
exports.Spinner = Spinner;
|
|
9256
9618
|
exports.Stack = Stack2;
|
|
9257
9619
|
exports.Tag = Tag;
|
|
9258
9620
|
exports.Text = Text;
|
|
9621
|
+
exports.TextArea = Textarea;
|
|
9259
9622
|
exports.VStack = VStack2;
|
|
9260
9623
|
exports.preset = preset;
|
|
9261
9624
|
//# sourceMappingURL=index.cjs.map
|