@hyddenlabs/hydn-ui 0.3.0-alpha.164 → 0.3.0-alpha.166
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 +50 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -18
- package/dist/index.d.ts +29 -18
- package/dist/index.js +50 -58
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -262,6 +262,11 @@ var colorVariants = {
|
|
|
262
262
|
error: "bg-destructive/20 text-foreground border-destructive/50 backdrop-blur-sm"
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
|
+
var inputAlignClasses = {
|
|
266
|
+
left: "mr-auto",
|
|
267
|
+
center: "mx-auto",
|
|
268
|
+
right: "ml-auto"
|
|
269
|
+
};
|
|
265
270
|
|
|
266
271
|
// src/theme/size-tokens.ts
|
|
267
272
|
var visualSizes = {
|
|
@@ -410,8 +415,10 @@ var inputWidthSizes = {
|
|
|
410
415
|
// 50% of container
|
|
411
416
|
"3/4": "w-3/4",
|
|
412
417
|
// 75% of container
|
|
413
|
-
full: "w-full"
|
|
418
|
+
full: "w-full",
|
|
414
419
|
// 100% of container
|
|
420
|
+
auto: "w-auto"
|
|
421
|
+
// width based on content
|
|
415
422
|
};
|
|
416
423
|
var badgeSizes = {
|
|
417
424
|
sm: {
|
|
@@ -1005,7 +1012,7 @@ function Container({
|
|
|
1005
1012
|
minHeight = "none",
|
|
1006
1013
|
maxHeight = "none"
|
|
1007
1014
|
}) {
|
|
1008
|
-
const
|
|
1015
|
+
const alignClasses2 = {
|
|
1009
1016
|
start: "mr-auto",
|
|
1010
1017
|
center: "mx-auto",
|
|
1011
1018
|
end: "ml-auto"
|
|
@@ -1025,7 +1032,7 @@ function Container({
|
|
|
1025
1032
|
const minHeightClass = minHeight !== "none" ? containerMinHeights[minHeight] : "";
|
|
1026
1033
|
const maxHeightClass = maxHeight !== "none" ? containerMaxHeights[maxHeight] : "";
|
|
1027
1034
|
const dimensionClasses = [widthClass, heightClass, minWidthClass, minHeightClass, maxWidthClass, maxHeightClass].join(" ").trim();
|
|
1028
|
-
const alignClass = mX === "none" || mX === "auto" ?
|
|
1035
|
+
const alignClass = mX === "none" || mX === "auto" ? alignClasses2[align] : "";
|
|
1029
1036
|
const alignItemsClass = alignItems ? alignItemsClasses[alignItems] : "";
|
|
1030
1037
|
const inlineStyles = {};
|
|
1031
1038
|
if (minWidth && !containerMinWidths[minWidth]) {
|
|
@@ -1179,7 +1186,7 @@ function Text({
|
|
|
1179
1186
|
bold: "font-bold",
|
|
1180
1187
|
extrabold: "font-extrabold"
|
|
1181
1188
|
};
|
|
1182
|
-
const
|
|
1189
|
+
const alignClasses2 = {
|
|
1183
1190
|
left: "text-left",
|
|
1184
1191
|
center: "text-center",
|
|
1185
1192
|
right: "text-right",
|
|
@@ -1257,7 +1264,7 @@ function Text({
|
|
|
1257
1264
|
sizeClasses[finalSize],
|
|
1258
1265
|
weightClasses[weight],
|
|
1259
1266
|
margin,
|
|
1260
|
-
align &&
|
|
1267
|
+
align && alignClasses2[align],
|
|
1261
1268
|
leading && leadingClasses[leading],
|
|
1262
1269
|
tracking && trackingClasses[tracking],
|
|
1263
1270
|
transform && transformClasses[transform],
|
|
@@ -1333,13 +1340,13 @@ function Stack({
|
|
|
1333
1340
|
margin = "none"
|
|
1334
1341
|
}) {
|
|
1335
1342
|
const spacingClasses = gapSizes[spacing];
|
|
1336
|
-
const
|
|
1343
|
+
const alignClasses2 = {
|
|
1337
1344
|
start: "items-start",
|
|
1338
1345
|
center: "items-center",
|
|
1339
1346
|
end: "items-end",
|
|
1340
1347
|
stretch: "items-stretch"
|
|
1341
1348
|
};
|
|
1342
|
-
const
|
|
1349
|
+
const justifyClasses2 = {
|
|
1343
1350
|
start: "justify-start",
|
|
1344
1351
|
center: "justify-center",
|
|
1345
1352
|
end: "justify-end",
|
|
@@ -1347,7 +1354,7 @@ function Stack({
|
|
|
1347
1354
|
around: "justify-around"
|
|
1348
1355
|
};
|
|
1349
1356
|
const directionClass = direction === "horizontal" ? "flex-row" : "flex-col";
|
|
1350
|
-
const justifyClass = justify ?
|
|
1357
|
+
const justifyClass = justify ? justifyClasses2[justify] : "";
|
|
1351
1358
|
const paddingClass = padding ? cardPadding[padding] : "";
|
|
1352
1359
|
const marginClass = margin ? cardMargin[margin] : "";
|
|
1353
1360
|
const minWidthClass = minWidth !== "none" ? containerMinWidths[minWidth] : "";
|
|
@@ -1358,7 +1365,7 @@ function Stack({
|
|
|
1358
1365
|
"div",
|
|
1359
1366
|
{
|
|
1360
1367
|
"data-component": "Stack",
|
|
1361
|
-
className: `flex flex-wrap ${directionClass} ${spacingClasses} ${
|
|
1368
|
+
className: `flex flex-wrap ${directionClass} ${spacingClasses} ${alignClasses2[align]} ${justifyClass} ${paddingClass} ${minWidthClass} ${maxWidthClass} ${widthClass} ${heightClass} ${marginClass} ${className}`,
|
|
1362
1369
|
children
|
|
1363
1370
|
}
|
|
1364
1371
|
);
|
|
@@ -1760,7 +1767,7 @@ function CardFooter({
|
|
|
1760
1767
|
md: "p-6",
|
|
1761
1768
|
lg: "p-8"
|
|
1762
1769
|
};
|
|
1763
|
-
const
|
|
1770
|
+
const alignClasses2 = {
|
|
1764
1771
|
start: "justify-start",
|
|
1765
1772
|
center: "justify-center",
|
|
1766
1773
|
end: "justify-end"
|
|
@@ -1773,7 +1780,7 @@ function CardFooter({
|
|
|
1773
1780
|
flex items-center gap-1
|
|
1774
1781
|
${paddingClasses[padding]}
|
|
1775
1782
|
${bordered ? "border-t border-border" : ""}
|
|
1776
|
-
${
|
|
1783
|
+
${alignClasses2[align]}
|
|
1777
1784
|
${className}
|
|
1778
1785
|
`.trim().replace(/\s+/g, " "),
|
|
1779
1786
|
children
|
|
@@ -1783,7 +1790,7 @@ function CardFooter({
|
|
|
1783
1790
|
CardFooter.displayName = "CardFooter";
|
|
1784
1791
|
var card_footer_default = CardFooter;
|
|
1785
1792
|
function CardActions({ children, className = "", align = "end", direction = "row" }) {
|
|
1786
|
-
const
|
|
1793
|
+
const alignClasses2 = {
|
|
1787
1794
|
start: "justify-start",
|
|
1788
1795
|
center: "justify-center",
|
|
1789
1796
|
end: "justify-end",
|
|
@@ -1799,7 +1806,7 @@ function CardActions({ children, className = "", align = "end", direction = "row
|
|
|
1799
1806
|
className: `
|
|
1800
1807
|
flex gap-2 px-6 pb-6 pt-2
|
|
1801
1808
|
${directionClasses[direction]}
|
|
1802
|
-
${
|
|
1809
|
+
${alignClasses2[align]}
|
|
1803
1810
|
${className}
|
|
1804
1811
|
`.trim().replace(/\s+/g, " "),
|
|
1805
1812
|
children
|
|
@@ -2265,8 +2272,8 @@ var Button = React4__default.default.forwardRef(
|
|
|
2265
2272
|
size = "md",
|
|
2266
2273
|
rounded = "default",
|
|
2267
2274
|
loading = false,
|
|
2268
|
-
|
|
2269
|
-
|
|
2275
|
+
width = "auto",
|
|
2276
|
+
align,
|
|
2270
2277
|
active = false
|
|
2271
2278
|
}, ref) => {
|
|
2272
2279
|
const isIconOnly = icon && !children;
|
|
@@ -2309,7 +2316,8 @@ var Button = React4__default.default.forwardRef(
|
|
|
2309
2316
|
)
|
|
2310
2317
|
] }) : icon;
|
|
2311
2318
|
const styleClasses = getStyleClasses();
|
|
2312
|
-
const widthClasses =
|
|
2319
|
+
const widthClasses = inputWidthSizes[width];
|
|
2320
|
+
const alignmentClass = align ? inputAlignClasses[align] : "";
|
|
2313
2321
|
const activeClasses = active ? "active:scale-95" : "";
|
|
2314
2322
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2315
2323
|
"button",
|
|
@@ -2319,7 +2327,7 @@ var Button = React4__default.default.forwardRef(
|
|
|
2319
2327
|
onClick,
|
|
2320
2328
|
"aria-label": ariaLabel,
|
|
2321
2329
|
disabled: disabled || loading,
|
|
2322
|
-
className: `inline-flex items-center justify-center ${roundedClasses[rounded]} font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 ${styleClasses} ${sizeClasses} ${isIconOnly ? "p-0" : ""} ${widthClasses} ${activeClasses} ${className}`,
|
|
2330
|
+
className: `inline-flex items-center justify-center ${alignmentClass} ${roundedClasses[rounded]} font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 ${styleClasses} ${sizeClasses} ${isIconOnly ? "p-0" : ""} ${widthClasses} ${activeClasses} ${className}`,
|
|
2323
2331
|
children: [
|
|
2324
2332
|
displayIcon && iconPosition === "left" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `inline-flex ${children ? "mr-2" : ""}`, children: displayIcon }),
|
|
2325
2333
|
children,
|
|
@@ -2802,7 +2810,7 @@ function Nav({
|
|
|
2802
2810
|
lg: "gap-7 sm:gap-6",
|
|
2803
2811
|
xl: "gap-10 sm:gap-8"
|
|
2804
2812
|
};
|
|
2805
|
-
const
|
|
2813
|
+
const alignClasses2 = {
|
|
2806
2814
|
start: "items-start",
|
|
2807
2815
|
center: "items-center",
|
|
2808
2816
|
end: "items-end",
|
|
@@ -2810,7 +2818,7 @@ function Nav({
|
|
|
2810
2818
|
};
|
|
2811
2819
|
const directionClass = direction === "horizontal" ? "flex-row" : "flex-col";
|
|
2812
2820
|
const spacingClass = spacingClasses[spacing];
|
|
2813
|
-
const alignClass =
|
|
2821
|
+
const alignClass = alignClasses2[align];
|
|
2814
2822
|
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": ariaLabel, className: `flex ${directionClass} ${spacingClass} ${alignClass} ${className}`, children });
|
|
2815
2823
|
}
|
|
2816
2824
|
Nav.displayName = "Nav";
|
|
@@ -3499,20 +3507,20 @@ function TableHeadCell({
|
|
|
3499
3507
|
scope = "col",
|
|
3500
3508
|
...props
|
|
3501
3509
|
}) {
|
|
3502
|
-
const
|
|
3510
|
+
const alignClasses2 = {
|
|
3503
3511
|
left: "text-left",
|
|
3504
3512
|
center: "text-center",
|
|
3505
3513
|
right: "text-right"
|
|
3506
3514
|
};
|
|
3507
|
-
return /* @__PURE__ */ jsxRuntime.jsx("th", { scope, className: `px-6 py-3 font-medium ${
|
|
3515
|
+
return /* @__PURE__ */ jsxRuntime.jsx("th", { scope, className: `px-6 py-3 font-medium ${alignClasses2[align]} ${className}`, ...props, children });
|
|
3508
3516
|
}
|
|
3509
3517
|
function TableCell({ children, className = "", align = "left", ...props }) {
|
|
3510
|
-
const
|
|
3518
|
+
const alignClasses2 = {
|
|
3511
3519
|
left: "text-left",
|
|
3512
3520
|
center: "text-center",
|
|
3513
3521
|
right: "text-right"
|
|
3514
3522
|
};
|
|
3515
|
-
return /* @__PURE__ */ jsxRuntime.jsx("td", { className: `px-6 py-4 whitespace-nowrap ${
|
|
3523
|
+
return /* @__PURE__ */ jsxRuntime.jsx("td", { className: `px-6 py-4 whitespace-nowrap ${alignClasses2[align]} ${className}`, ...props, children });
|
|
3516
3524
|
}
|
|
3517
3525
|
var table_default = Table;
|
|
3518
3526
|
function Checkbox({
|
|
@@ -4842,19 +4850,6 @@ function Fieldset({
|
|
|
4842
4850
|
}
|
|
4843
4851
|
Fieldset.displayName = "Fieldset";
|
|
4844
4852
|
var fieldset_default = Fieldset;
|
|
4845
|
-
var alignClasses2 = {
|
|
4846
|
-
start: "items-start",
|
|
4847
|
-
center: "items-center",
|
|
4848
|
-
end: "items-end",
|
|
4849
|
-
stretch: "items-stretch"
|
|
4850
|
-
};
|
|
4851
|
-
var justifyClasses2 = {
|
|
4852
|
-
start: "justify-start",
|
|
4853
|
-
center: "justify-center",
|
|
4854
|
-
end: "justify-end",
|
|
4855
|
-
between: "justify-between",
|
|
4856
|
-
around: "justify-around"
|
|
4857
|
-
};
|
|
4858
4853
|
function Form({
|
|
4859
4854
|
children,
|
|
4860
4855
|
onSubmit,
|
|
@@ -4863,11 +4858,7 @@ function Form({
|
|
|
4863
4858
|
noValidate = false,
|
|
4864
4859
|
id,
|
|
4865
4860
|
ariaLabel,
|
|
4866
|
-
|
|
4867
|
-
spacing = "md",
|
|
4868
|
-
align = "stretch",
|
|
4869
|
-
justify,
|
|
4870
|
-
fullWidth = true
|
|
4861
|
+
spacing = "md"
|
|
4871
4862
|
}) {
|
|
4872
4863
|
const handleSubmit = (e) => {
|
|
4873
4864
|
if (onSubmit) {
|
|
@@ -4875,17 +4866,6 @@ function Form({
|
|
|
4875
4866
|
onSubmit(e);
|
|
4876
4867
|
}
|
|
4877
4868
|
};
|
|
4878
|
-
let spacingClass;
|
|
4879
|
-
if (spacing in formSpacing) {
|
|
4880
|
-
spacingClass = formSpacing[spacing];
|
|
4881
|
-
} else if (spacing in gapSizes) {
|
|
4882
|
-
spacingClass = gapSizes[spacing];
|
|
4883
|
-
} else {
|
|
4884
|
-
spacingClass = formSpacing["md"];
|
|
4885
|
-
}
|
|
4886
|
-
const directionClass = direction === "horizontal" ? "flex-row flex-wrap" : "flex-col";
|
|
4887
|
-
const justifyClass = justify ? justifyClasses2[justify] : "";
|
|
4888
|
-
const widthClass = fullWidth ? "w-full" : "";
|
|
4889
4869
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4890
4870
|
"form",
|
|
4891
4871
|
{
|
|
@@ -4895,7 +4875,7 @@ function Form({
|
|
|
4895
4875
|
noValidate,
|
|
4896
4876
|
id,
|
|
4897
4877
|
"aria-label": ariaLabel,
|
|
4898
|
-
className: `flex
|
|
4878
|
+
className: `flex flex-col ${formSpacing[spacing]}`,
|
|
4899
4879
|
children
|
|
4900
4880
|
}
|
|
4901
4881
|
);
|
|
@@ -4910,7 +4890,10 @@ function FormField({
|
|
|
4910
4890
|
required = false,
|
|
4911
4891
|
spacing = "sm",
|
|
4912
4892
|
disabled = false,
|
|
4913
|
-
id: providedId
|
|
4893
|
+
id: providedId,
|
|
4894
|
+
width = "full",
|
|
4895
|
+
align = "center",
|
|
4896
|
+
reserveMessageSpace = false
|
|
4914
4897
|
}) {
|
|
4915
4898
|
const autoId = React4.useId();
|
|
4916
4899
|
const inputId = providedId ?? autoId;
|
|
@@ -4925,18 +4908,22 @@ function FormField({
|
|
|
4925
4908
|
...hasMessage ? { "aria-describedby": `${inputId}-message` } : {}
|
|
4926
4909
|
}
|
|
4927
4910
|
) : children;
|
|
4928
|
-
|
|
4911
|
+
const widthClass = inputWidthSizes[width];
|
|
4912
|
+
const alignmentClass = inputAlignClasses[align];
|
|
4913
|
+
const shouldReserveSpace = reserveMessageSpace && !helperText;
|
|
4914
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex flex-col ${widthClass} ${alignmentClass} ${formSpacing[spacing]}`, children: [
|
|
4929
4915
|
label && /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: inputId, className: "text-sm font-semibold text-foreground", children: [
|
|
4930
4916
|
label,
|
|
4931
4917
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
4932
4918
|
] }),
|
|
4933
4919
|
enhancedChild,
|
|
4934
|
-
(error ||
|
|
4920
|
+
(helperText || error || shouldReserveSpace) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4935
4921
|
"p",
|
|
4936
4922
|
{
|
|
4937
4923
|
id: `${inputId}-message`,
|
|
4938
4924
|
className: `text-sm ${error ? validationTextClasses.error : validationTextClasses.default}`,
|
|
4939
|
-
|
|
4925
|
+
"aria-live": "polite",
|
|
4926
|
+
children: error || helperText || "\xA0"
|
|
4940
4927
|
}
|
|
4941
4928
|
)
|
|
4942
4929
|
] });
|
|
@@ -5009,7 +4996,9 @@ function FormInput({
|
|
|
5009
4996
|
id,
|
|
5010
4997
|
pattern,
|
|
5011
4998
|
title,
|
|
5012
|
-
|
|
4999
|
+
width,
|
|
5000
|
+
align = "center",
|
|
5001
|
+
reserveMessageSpace = false,
|
|
5013
5002
|
...inputProps
|
|
5014
5003
|
}) {
|
|
5015
5004
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5022,6 +5011,9 @@ function FormInput({
|
|
|
5022
5011
|
required,
|
|
5023
5012
|
disabled,
|
|
5024
5013
|
id,
|
|
5014
|
+
width,
|
|
5015
|
+
align,
|
|
5016
|
+
reserveMessageSpace,
|
|
5025
5017
|
children: /* @__PURE__ */ jsxRuntime.jsx(input_default, { ...inputProps, required, disabled, id, pattern, title })
|
|
5026
5018
|
}
|
|
5027
5019
|
);
|