@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 +96 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +96 -48
- package/dist/index.js.map +1 -1
- package/dist/styled-system/styles.css +136 -16
- package/dist/types/components/Input/index.d.ts +4 -11
- package/dist/types/components/Input/input.recipe.d.ts +1 -0
- package/dist/types/components/Tabs/Tabs.stories.d.ts +10 -0
- package/dist/types/components/Tabs/index.d.ts +26 -0
- package/dist/types/components/Tabs/tabs.recipe.d.ts +66 -0
- package/dist/types/components/TextArea/index.d.ts +3 -12
- package/package.json +1 -1
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:
|
|
9165
|
-
const Description = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(ark.span, { className:
|
|
9166
|
-
const Input = React.forwardRef(
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
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
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
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
|
-
|
|
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:
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
|
|
9217
|
-
|
|
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
|
);
|