@humu-tech/ui 0.1.17 → 0.1.19
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.js +13 -6
- package/dist/index.mjs +13 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -862,6 +862,10 @@ function applyMask(mask, raw) {
|
|
|
862
862
|
function stripToRaw(value) {
|
|
863
863
|
return value.replace(/[^0-9a-zA-Z]/g, "");
|
|
864
864
|
}
|
|
865
|
+
function capToMaskSlots(mask, raw) {
|
|
866
|
+
const maxSlots = countMaskSlots(selectMask(mask, raw));
|
|
867
|
+
return maxSlots > 0 && raw.length > maxSlots ? raw.slice(0, maxSlots) : raw;
|
|
868
|
+
}
|
|
865
869
|
var MaskedInput = (0, import_react10.forwardRef)(
|
|
866
870
|
({
|
|
867
871
|
mask,
|
|
@@ -882,8 +886,11 @@ var MaskedInput = (0, import_react10.forwardRef)(
|
|
|
882
886
|
const isDark = surface === "dark";
|
|
883
887
|
const [internalValue, setInternalValue] = (0, import_react10.useState)("");
|
|
884
888
|
const isControlled = valueProp !== void 0;
|
|
885
|
-
const rawDisplay = (
|
|
886
|
-
|
|
889
|
+
const rawDisplay = capToMaskSlots(
|
|
890
|
+
mask,
|
|
891
|
+
(normalizeRaw ?? stripToRaw)(
|
|
892
|
+
String((isControlled ? valueProp : internalValue) ?? "")
|
|
893
|
+
)
|
|
887
894
|
);
|
|
888
895
|
const displayValue = rawDisplay ? applyMask(selectMask(mask, rawDisplay), rawDisplay) : "";
|
|
889
896
|
const generatedId = (0, import_react10.useId)();
|
|
@@ -893,7 +900,7 @@ var MaskedInput = (0, import_react10.forwardRef)(
|
|
|
893
900
|
const describedBy = [helperId, errorId].filter(Boolean).join(" ") || void 0;
|
|
894
901
|
const handleChange = (e) => {
|
|
895
902
|
const inputVal = e.target.value;
|
|
896
|
-
const raw = (normalizeRaw ?? stripToRaw)(inputVal);
|
|
903
|
+
const raw = capToMaskSlots(mask, (normalizeRaw ?? stripToRaw)(inputVal));
|
|
897
904
|
const activeMask = selectMask(mask, raw);
|
|
898
905
|
const formatted = applyMask(activeMask, raw);
|
|
899
906
|
if (!isControlled) setInternalValue(formatted);
|
|
@@ -1685,7 +1692,7 @@ var Content4 = (0, import_react18.forwardRef)(({ size, hideCloseButton, classNam
|
|
|
1685
1692
|
DialogPrimitive.Close,
|
|
1686
1693
|
{
|
|
1687
1694
|
"aria-label": "Fechar",
|
|
1688
|
-
className: "absolute right-
|
|
1695
|
+
className: "absolute right-3 top-3 inline-flex size-8 items-center justify-center rounded-v2-md text-v2-fg-subtle opacity-70 transition-opacity hover:bg-v2-raised hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-v2-focus-ring/30 disabled:pointer-events-none motion-reduce:transition-none",
|
|
1689
1696
|
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react19.X, { size: 16, weight: "bold", "aria-hidden": "true" })
|
|
1690
1697
|
}
|
|
1691
1698
|
)
|
|
@@ -1699,7 +1706,7 @@ var Header2 = (0, import_react18.forwardRef)(
|
|
|
1699
1706
|
"div",
|
|
1700
1707
|
{
|
|
1701
1708
|
ref,
|
|
1702
|
-
className: cn("flex flex-col gap-1.5 text-left", className),
|
|
1709
|
+
className: cn("flex flex-col gap-1.5 pr-8 text-left", className),
|
|
1703
1710
|
...props
|
|
1704
1711
|
}
|
|
1705
1712
|
)
|
|
@@ -5647,7 +5654,7 @@ function AppShell({
|
|
|
5647
5654
|
"a",
|
|
5648
5655
|
{
|
|
5649
5656
|
href: "#main-content",
|
|
5650
|
-
className: "sr-only focus:not-sr-only focus:absolute focus:left-
|
|
5657
|
+
className: "sr-only focus:not-sr-only focus:absolute focus:left-1/2 focus:top-3 focus:z-50 focus:-translate-x-1/2 focus:rounded-v2-md focus:bg-v2-action-primary focus:px-4 focus:py-2 focus:text-v2-action-on-primary focus:shadow-lg",
|
|
5651
5658
|
children: "Pular para o conte\xFAdo"
|
|
5652
5659
|
}
|
|
5653
5660
|
),
|
package/dist/index.mjs
CHANGED
|
@@ -730,6 +730,10 @@ function applyMask(mask, raw) {
|
|
|
730
730
|
function stripToRaw(value) {
|
|
731
731
|
return value.replace(/[^0-9a-zA-Z]/g, "");
|
|
732
732
|
}
|
|
733
|
+
function capToMaskSlots(mask, raw) {
|
|
734
|
+
const maxSlots = countMaskSlots(selectMask(mask, raw));
|
|
735
|
+
return maxSlots > 0 && raw.length > maxSlots ? raw.slice(0, maxSlots) : raw;
|
|
736
|
+
}
|
|
733
737
|
var MaskedInput = forwardRef7(
|
|
734
738
|
({
|
|
735
739
|
mask,
|
|
@@ -750,8 +754,11 @@ var MaskedInput = forwardRef7(
|
|
|
750
754
|
const isDark = surface === "dark";
|
|
751
755
|
const [internalValue, setInternalValue] = useState2("");
|
|
752
756
|
const isControlled = valueProp !== void 0;
|
|
753
|
-
const rawDisplay = (
|
|
754
|
-
|
|
757
|
+
const rawDisplay = capToMaskSlots(
|
|
758
|
+
mask,
|
|
759
|
+
(normalizeRaw ?? stripToRaw)(
|
|
760
|
+
String((isControlled ? valueProp : internalValue) ?? "")
|
|
761
|
+
)
|
|
755
762
|
);
|
|
756
763
|
const displayValue = rawDisplay ? applyMask(selectMask(mask, rawDisplay), rawDisplay) : "";
|
|
757
764
|
const generatedId = useId();
|
|
@@ -761,7 +768,7 @@ var MaskedInput = forwardRef7(
|
|
|
761
768
|
const describedBy = [helperId, errorId].filter(Boolean).join(" ") || void 0;
|
|
762
769
|
const handleChange = (e) => {
|
|
763
770
|
const inputVal = e.target.value;
|
|
764
|
-
const raw = (normalizeRaw ?? stripToRaw)(inputVal);
|
|
771
|
+
const raw = capToMaskSlots(mask, (normalizeRaw ?? stripToRaw)(inputVal));
|
|
765
772
|
const activeMask = selectMask(mask, raw);
|
|
766
773
|
const formatted = applyMask(activeMask, raw);
|
|
767
774
|
if (!isControlled) setInternalValue(formatted);
|
|
@@ -1563,7 +1570,7 @@ var Content4 = forwardRef13(({ size, hideCloseButton, className, children, ...pr
|
|
|
1563
1570
|
DialogPrimitive.Close,
|
|
1564
1571
|
{
|
|
1565
1572
|
"aria-label": "Fechar",
|
|
1566
|
-
className: "absolute right-
|
|
1573
|
+
className: "absolute right-3 top-3 inline-flex size-8 items-center justify-center rounded-v2-md text-v2-fg-subtle opacity-70 transition-opacity hover:bg-v2-raised hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-v2-focus-ring/30 disabled:pointer-events-none motion-reduce:transition-none",
|
|
1567
1574
|
children: /* @__PURE__ */ jsx18(X2, { size: 16, weight: "bold", "aria-hidden": "true" })
|
|
1568
1575
|
}
|
|
1569
1576
|
)
|
|
@@ -1577,7 +1584,7 @@ var Header2 = forwardRef13(
|
|
|
1577
1584
|
"div",
|
|
1578
1585
|
{
|
|
1579
1586
|
ref,
|
|
1580
|
-
className: cn("flex flex-col gap-1.5 text-left", className),
|
|
1587
|
+
className: cn("flex flex-col gap-1.5 pr-8 text-left", className),
|
|
1581
1588
|
...props
|
|
1582
1589
|
}
|
|
1583
1590
|
)
|
|
@@ -5579,7 +5586,7 @@ function AppShell({
|
|
|
5579
5586
|
"a",
|
|
5580
5587
|
{
|
|
5581
5588
|
href: "#main-content",
|
|
5582
|
-
className: "sr-only focus:not-sr-only focus:absolute focus:left-
|
|
5589
|
+
className: "sr-only focus:not-sr-only focus:absolute focus:left-1/2 focus:top-3 focus:z-50 focus:-translate-x-1/2 focus:rounded-v2-md focus:bg-v2-action-primary focus:px-4 focus:py-2 focus:text-v2-action-on-primary focus:shadow-lg",
|
|
5583
5590
|
children: "Pular para o conte\xFAdo"
|
|
5584
5591
|
}
|
|
5585
5592
|
),
|