@nation-a/ui 0.9.0 → 0.9.1

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
@@ -8927,6 +8927,31 @@ const Tag = React.forwardRef(({ imageSrc, text, onDeleteClick, ...rest }, ref) =
8927
8927
  ] });
8928
8928
  });
8929
8929
  Tag.displayName = "Tag";
8930
+ const inputSlotRecipe = sva({
8931
+ className: "input",
8932
+ slots: ["requiredStar", "description", "textLengthIndicator"],
8933
+ base: {
8934
+ requiredStar: {
8935
+ color: "content.danger.default",
8936
+ paddingLeft: 1
8937
+ },
8938
+ description: {
8939
+ textStyle: "label.sm",
8940
+ color: "content.neutral.subtle",
8941
+ paddingLeft: 1,
8942
+ width: "100%",
8943
+ textAlign: "start"
8944
+ },
8945
+ textLengthIndicator: {
8946
+ display: "inline-block",
8947
+ width: "100%",
8948
+ textAlign: "end",
8949
+ paddingRight: 1,
8950
+ marginTop: -0.5,
8951
+ textStyle: "label.sm"
8952
+ }
8953
+ }
8954
+ });
8930
8955
  const inputRecipe = cva({
8931
8956
  base: {
8932
8957
  display: "flex",
@@ -9161,47 +9186,73 @@ const labelRecipe = cva({
9161
9186
  });
9162
9187
  const StyledInputWrapper = styled(ark.div, inputRecipe);
9163
9188
  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",
9189
+ const RequiredStar = () => /* @__PURE__ */ jsxRuntime.jsx(ark.span, { className: inputSlotRecipe().requiredStar, "aria-hidden": "true", children: "*" });
9190
+ const Description = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(ark.span, { className: inputSlotRecipe().description, children });
9191
+ const Input = React.forwardRef(
9192
+ ({
9193
+ value,
9194
+ required,
9195
+ disabled,
9196
+ label,
9197
+ description,
9198
+ labelPosition = "outside",
9199
+ textLimit,
9200
+ variant,
9201
+ color,
9202
+ radius,
9203
+ onChange,
9204
+ className,
9205
+ ...rest
9206
+ }, ref) => {
9207
+ const [state, setState] = React.useState(disabled ? "disabled" : "default");
9208
+ React.useEffect(() => {
9209
+ setState(disabled ? "disabled" : "default");
9210
+ }, [disabled]);
9211
+ const handleInputChange = (e) => {
9212
+ if (disabled) return;
9213
+ const value2 = e.target.value;
9214
+ if (textLimit && value2.length > textLimit) return;
9215
+ setState(value2 ? "selected" : "default");
9216
+ onChange == null ? void 0 : onChange(e);
9217
+ };
9218
+ const Label = ({ visible, children }) => {
9219
+ console.log("color", color);
9220
+ return visible ? /* @__PURE__ */ jsxRuntime.jsxs(StyledLabel$1, { state, color, radius, children: [
9221
+ children,
9222
+ required && /* @__PURE__ */ jsxRuntime.jsx(RequiredStar, {})
9223
+ ] }) : null;
9224
+ };
9225
+ return /* @__PURE__ */ jsxRuntime.jsxs(VStack$1, { gap: 1, children: [
9226
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { visible: !!(label && labelPosition === "outside"), children: label }),
9227
+ /* @__PURE__ */ jsxRuntime.jsxs(
9228
+ StyledInputWrapper,
9191
9229
  {
9192
- value,
9193
- disabled,
9194
- onFocus: () => !disabled && setState("selected"),
9195
- onBlur: () => !disabled && setState("default"),
9196
- onChange: handleInputChange,
9197
- ref,
9198
- ...rest
9230
+ state,
9231
+ variant,
9232
+ color,
9233
+ radius,
9234
+ className: cx(css$1({ display: "flex", flexDirection: "column", gap: 1 }), className),
9235
+ children: [
9236
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { visible: !!(label && labelPosition === "inside"), children: label }),
9237
+ /* @__PURE__ */ jsxRuntime.jsx(
9238
+ "input",
9239
+ {
9240
+ value,
9241
+ disabled,
9242
+ onFocus: () => !disabled && setState("selected"),
9243
+ onBlur: () => !disabled && setState("default"),
9244
+ onChange: handleInputChange,
9245
+ ref,
9246
+ ...rest
9247
+ }
9248
+ )
9249
+ ]
9199
9250
  }
9200
- )
9201
- ] }),
9202
- description && /* @__PURE__ */ jsxRuntime.jsx(Description, { children: description })
9203
- ] });
9204
- });
9251
+ ),
9252
+ description && /* @__PURE__ */ jsxRuntime.jsx(Description, { children: description })
9253
+ ] });
9254
+ }
9255
+ );
9205
9256
  Input.displayName = "Input";
9206
9257
  const StyledTextAreaWrapper = styled(ark.div, inputRecipe);
9207
9258
  const StyledLabel = styled(ark.label, labelRecipe);
@@ -9209,15 +9260,12 @@ const TextLengthIndicator = ({ count, limit, disabled }) => {
9209
9260
  return /* @__PURE__ */ jsxRuntime.jsx(
9210
9261
  ark.span,
9211
9262
  {
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
- }),
9263
+ className: cx(
9264
+ inputSlotRecipe().textLengthIndicator,
9265
+ css$1({
9266
+ color: disabled ? "content.neutral.disabled" : "content.neutral.subtlest"
9267
+ })
9268
+ ),
9221
9269
  children: `${count}${limit ? ` / ${limit}` : ""}`
9222
9270
  }
9223
9271
  );