@nation-a/ui 0.8.0 → 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 CHANGED
@@ -4681,7 +4681,7 @@ const textRecipe = cva({
4681
4681
  }
4682
4682
  });
4683
4683
  const Text = React.forwardRef((props, ref) => {
4684
- const { variant = "body.md", font = "notoSans", children, ...rest } = props;
4684
+ const { variant = "body.md", font, children, ...rest } = props;
4685
4685
  const textType = (variant == null ? void 0 : variant.split(".")[0]) || "body";
4686
4686
  const componentMap = {
4687
4687
  display: styled("h1", textRecipe),
@@ -4691,7 +4691,7 @@ const Text = React.forwardRef((props, ref) => {
4691
4691
  label: styled("span", textRecipe)
4692
4692
  };
4693
4693
  const TextComponent = componentMap[textType];
4694
- return /* @__PURE__ */ jsxRuntime.jsx(TextComponent, { ref, css: { textStyle: variant, fontFamily: font }, ...rest, children });
4694
+ return /* @__PURE__ */ jsxRuntime.jsx(TextComponent, { ref, variant, font, ...rest, children });
4695
4695
  });
4696
4696
  Text.displayName = "Text";
4697
4697
  const shouldForwardProp = (prop, variantKeys, options = {}) => {
@@ -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
- ({ color, background, radius, imageSrc, text, onDeleteClick, ...rest }, ref) => {
8913
- const StyledTag = styled(ark.div, tagRecipe);
8914
- return /* @__PURE__ */ jsxRuntime.jsxs(StyledTag, { color, background, radius, avatar: !!imageSrc, ref, ...rest, children: [
8915
- imageSrc && /* @__PURE__ */ jsxRuntime.jsx(
8916
- styled.img,
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
- src: imageSrc,
8919
- css: {
8920
- width: "8",
8921
- height: "8",
8922
- borderRadius: "full",
8923
- overflow: "hidden"
8924
- },
8925
- alt: "avatar thumbnail"
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
- text,
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
- Tag.displayName = "Tag";
9294
+ Textarea.displayName = "Textarea";
8934
9295
  function definePreset(preset2) {
8935
9296
  return preset2;
8936
9297
  }
@@ -8949,7 +9310,15 @@ function createProxy() {
8949
9310
  });
8950
9311
  }
8951
9312
  var defineTokens = /* @__PURE__ */ createProxy();
8952
- const globalCss = defineGlobalStyles({});
9313
+ const globalCss = defineGlobalStyles({
9314
+ "html, body": {
9315
+ margin: 0,
9316
+ padding: 0,
9317
+ maxWidth: "100vw",
9318
+ color: "content.neutral.default",
9319
+ backgroundColor: "surface.base"
9320
+ }
9321
+ });
8953
9322
  const keyframes = defineKeyframes({
8954
9323
  "fade-in": {
8955
9324
  from: { opacity: "0" },
@@ -9198,29 +9567,30 @@ const zIndex = defineTokens.zIndex({
9198
9567
  }
9199
9568
  });
9200
9569
  const tokens = defineTokens({
9201
- animations,
9202
- blurs,
9203
- borders,
9204
9570
  // colors,
9205
- durations,
9206
- easings,
9207
9571
  // fonts,
9208
9572
  // fontSizes,
9209
9573
  // fontWeights,
9210
9574
  // letterSpacings,
9211
9575
  // lineHeights,
9212
9576
  // radii,
9577
+ animations,
9578
+ blurs,
9579
+ borders,
9580
+ durations,
9581
+ easings,
9213
9582
  sizes,
9214
- // spacing,
9215
9583
  zIndex,
9216
- ...g.primitive
9584
+ ...g.primitive,
9585
+ spacing: {
9586
+ ...spacing,
9587
+ ...g.primitive.spacing
9588
+ }
9217
9589
  });
9218
9590
  const preset = definePreset({
9219
9591
  name: "@nation-a/theme",
9220
9592
  conditions,
9221
- globalCss: {
9222
- ...globalCss
9223
- },
9593
+ globalCss,
9224
9594
  theme: {
9225
9595
  extend: {
9226
9596
  breakpoints,
@@ -9241,12 +9611,14 @@ exports.Grid = Grid2;
9241
9611
  exports.GridItem = GridItem2;
9242
9612
  exports.HStack = HStack2;
9243
9613
  exports.IconButton = index;
9614
+ exports.Input = Input;
9244
9615
  exports.Navigation = Navigation;
9245
9616
  exports.Portal = Portal;
9246
9617
  exports.Spinner = Spinner;
9247
9618
  exports.Stack = Stack2;
9248
9619
  exports.Tag = Tag;
9249
9620
  exports.Text = Text;
9621
+ exports.TextArea = Textarea;
9250
9622
  exports.VStack = VStack2;
9251
9623
  exports.preset = preset;
9252
9624
  //# sourceMappingURL=index.cjs.map