@starasia/input 4.2.2 → 4.3.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/Kbd.d.ts +7 -1
- package/dist/index.d.ts +1 -1
- package/dist/input.es.js +180 -126
- package/dist/input.umd.js +51 -4
- package/package.json +1 -1
package/dist/Kbd.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
export type KbdSize = "xs" | "sm" | "md" | "lg";
|
|
2
3
|
export interface KbdProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
3
4
|
/** Keys to render, one cap each. e.g. ['⌘', 'K'] */
|
|
4
5
|
keys: React.ReactNode[];
|
|
5
6
|
/** Optional separator rendered between caps. Default: none (gap only). */
|
|
6
7
|
separator?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Cap size — matches Input's scale so a `<Kbd>` embedded as an Input icon
|
|
10
|
+
* pairs 1:1. Default `"sm"` (12px, unchanged from before this prop existed).
|
|
11
|
+
*/
|
|
12
|
+
size?: KbdSize;
|
|
7
13
|
}
|
|
8
|
-
export declare function Kbd({ keys, separator, className, ...rest }: KbdProps): React.JSX.Element;
|
|
14
|
+
export declare function Kbd({ keys, separator, size, className, ...rest }: KbdProps): React.JSX.Element;
|
package/dist/index.d.ts
CHANGED
package/dist/input.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import Z, { forwardRef as mn, useState as I, useRef as R, useEffect as F, useImperativeHandle as En, useLayoutEffect as
|
|
1
|
+
import { jsx as a, jsxs as l, Fragment as Ln } from "react/jsx-runtime";
|
|
2
|
+
import Z, { forwardRef as mn, useState as I, useRef as R, useEffect as F, useImperativeHandle as En, useLayoutEffect as bn } from "react";
|
|
3
3
|
const $n = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
|
|
4
4
|
|
|
5
5
|
:root {
|
|
@@ -631,33 +631,33 @@ function Fn(n, e) {
|
|
|
631
631
|
if (e <= 0)
|
|
632
632
|
return 0;
|
|
633
633
|
let r = 0;
|
|
634
|
-
for (let
|
|
635
|
-
if (/\d/.test(n[
|
|
636
|
-
return
|
|
634
|
+
for (let o = 0; o < n.length; o++)
|
|
635
|
+
if (/\d/.test(n[o]) && (r += 1, r === e))
|
|
636
|
+
return o + 1;
|
|
637
637
|
return n.length;
|
|
638
638
|
}
|
|
639
639
|
const Tn = mn(
|
|
640
|
-
({ options: n, value: e, setValue: r, isComponentVisible:
|
|
641
|
-
const [
|
|
642
|
-
if (f != null && f.current &&
|
|
643
|
-
const
|
|
644
|
-
|
|
640
|
+
({ options: n, value: e, setValue: r, isComponentVisible: o, onOptionChange: d }, f) => {
|
|
641
|
+
const [c, T] = I([]), u = R(null), p = () => {
|
|
642
|
+
if (f != null && f.current && u.current) {
|
|
643
|
+
const g = window.innerHeight, b = f == null ? void 0 : f.current.getBoundingClientRect(), m = u.current.getBoundingClientRect(), v = b.bottom + m.height;
|
|
644
|
+
u.current.style.left = `${b.left}px`, u.current.style.width = `${b.width}px`, v >= g - 10 ? u.current.style.top = `${b.top - m.height - 5}px` : u.current.style.top = `${b.top + b.height}px`;
|
|
645
645
|
}
|
|
646
646
|
};
|
|
647
|
-
return F(() => (window.addEventListener("scroll",
|
|
648
|
-
window.removeEventListener("scroll",
|
|
649
|
-
}), [f,
|
|
650
|
-
|
|
651
|
-
}, [
|
|
647
|
+
return F(() => (window.addEventListener("scroll", p), window.addEventListener("resize", p), () => {
|
|
648
|
+
window.removeEventListener("scroll", p), window.removeEventListener("resize", p);
|
|
649
|
+
}), [f, u]), F(() => {
|
|
650
|
+
p();
|
|
651
|
+
}, [o]), F(() => {
|
|
652
652
|
T(
|
|
653
653
|
(n == null ? void 0 : n.filter(
|
|
654
|
-
(
|
|
654
|
+
(g) => g.toLowerCase().startsWith(e.toLowerCase())
|
|
655
655
|
)) || []
|
|
656
656
|
);
|
|
657
|
-
}, [e, n]), /* @__PURE__ */
|
|
657
|
+
}, [e, n]), /* @__PURE__ */ a(
|
|
658
658
|
"div",
|
|
659
659
|
{
|
|
660
|
-
ref:
|
|
660
|
+
ref: u,
|
|
661
661
|
style: {
|
|
662
662
|
position: "fixed",
|
|
663
663
|
padding: "8px",
|
|
@@ -668,15 +668,15 @@ const Tn = mn(
|
|
|
668
668
|
overflow: "auto",
|
|
669
669
|
zIndex: 5e4
|
|
670
670
|
},
|
|
671
|
-
children:
|
|
672
|
-
(
|
|
671
|
+
children: c == null ? void 0 : c.map(
|
|
672
|
+
(g) => Vn(g, e, r, d)
|
|
673
673
|
)
|
|
674
674
|
}
|
|
675
675
|
);
|
|
676
676
|
}
|
|
677
|
-
), Vn = (n, e, r,
|
|
677
|
+
), Vn = (n, e, r, o) => {
|
|
678
678
|
const d = n.toLowerCase().indexOf(e.toLowerCase());
|
|
679
|
-
return /* @__PURE__ */
|
|
679
|
+
return /* @__PURE__ */ l(
|
|
680
680
|
"p",
|
|
681
681
|
{
|
|
682
682
|
style: {
|
|
@@ -687,23 +687,23 @@ const Tn = mn(
|
|
|
687
687
|
cursor: "pointer"
|
|
688
688
|
},
|
|
689
689
|
onClick: () => {
|
|
690
|
-
r(n),
|
|
690
|
+
r(n), o && o(n);
|
|
691
691
|
},
|
|
692
692
|
children: [
|
|
693
693
|
n.slice(0, d),
|
|
694
|
-
/* @__PURE__ */
|
|
694
|
+
/* @__PURE__ */ a("span", { style: { color: "var(--sa-text-primary, #292a2e)" }, children: n.slice(d, d + e.length) }),
|
|
695
695
|
n.slice(d + e.length)
|
|
696
696
|
]
|
|
697
697
|
}
|
|
698
698
|
);
|
|
699
699
|
};
|
|
700
700
|
function On(n) {
|
|
701
|
-
const [e, r] = I(n),
|
|
702
|
-
|
|
701
|
+
const [e, r] = I(n), o = R(null), d = (f) => {
|
|
702
|
+
o.current && !o.current.contains(f.target) && r(!1);
|
|
703
703
|
};
|
|
704
704
|
return F(() => (document.addEventListener("click", d, !0), () => {
|
|
705
705
|
document.removeEventListener("click", d, !0);
|
|
706
|
-
}), []), { ref:
|
|
706
|
+
}), []), { ref: o, isComponentVisible: e, setIsComponentVisible: r };
|
|
707
707
|
}
|
|
708
708
|
const gn = "sa-input-styles", jn = (n) => {
|
|
709
709
|
if (!(typeof document > "u") && !document.getElementById(gn)) {
|
|
@@ -712,7 +712,7 @@ const gn = "sa-input-styles", jn = (n) => {
|
|
|
712
712
|
}
|
|
713
713
|
};
|
|
714
714
|
jn($n);
|
|
715
|
-
const Yn = (n) => /* @__PURE__ */
|
|
715
|
+
const Yn = (n) => /* @__PURE__ */ l(
|
|
716
716
|
"svg",
|
|
717
717
|
{
|
|
718
718
|
viewBox: "0 0 16 16",
|
|
@@ -720,8 +720,8 @@ const Yn = (n) => /* @__PURE__ */ o(
|
|
|
720
720
|
xmlns: "http://www.w3.org/2000/svg",
|
|
721
721
|
...n,
|
|
722
722
|
children: [
|
|
723
|
-
/* @__PURE__ */
|
|
724
|
-
/* @__PURE__ */
|
|
723
|
+
/* @__PURE__ */ a("circle", { cx: "8", cy: "8", r: "6.5", stroke: "currentColor", strokeWidth: "1.2" }),
|
|
724
|
+
/* @__PURE__ */ a(
|
|
725
725
|
"path",
|
|
726
726
|
{
|
|
727
727
|
d: "M5.2 8.2l1.8 1.8 3.8-4.2",
|
|
@@ -733,7 +733,7 @@ const Yn = (n) => /* @__PURE__ */ o(
|
|
|
733
733
|
)
|
|
734
734
|
]
|
|
735
735
|
}
|
|
736
|
-
), An = (n) => /* @__PURE__ */
|
|
736
|
+
), An = (n) => /* @__PURE__ */ l(
|
|
737
737
|
"svg",
|
|
738
738
|
{
|
|
739
739
|
viewBox: "0 0 16 16",
|
|
@@ -741,8 +741,8 @@ const Yn = (n) => /* @__PURE__ */ o(
|
|
|
741
741
|
xmlns: "http://www.w3.org/2000/svg",
|
|
742
742
|
...n,
|
|
743
743
|
children: [
|
|
744
|
-
/* @__PURE__ */
|
|
745
|
-
/* @__PURE__ */
|
|
744
|
+
/* @__PURE__ */ a("circle", { cx: "8", cy: "8", r: "7", fill: "currentColor", opacity: "0.2" }),
|
|
745
|
+
/* @__PURE__ */ a(
|
|
746
746
|
"path",
|
|
747
747
|
{
|
|
748
748
|
d: "M5.5 5.5l5 5M10.5 5.5l-5 5",
|
|
@@ -757,62 +757,62 @@ const Yn = (n) => /* @__PURE__ */ o(
|
|
|
757
757
|
(n, e) => {
|
|
758
758
|
const {
|
|
759
759
|
size: r = "sm",
|
|
760
|
-
variant:
|
|
760
|
+
variant: o = "outline",
|
|
761
761
|
status: d = "default",
|
|
762
762
|
label: f,
|
|
763
|
-
labelPosition:
|
|
763
|
+
labelPosition: c = "outside-top",
|
|
764
764
|
required: T,
|
|
765
|
-
optional:
|
|
766
|
-
description:
|
|
767
|
-
helperText:
|
|
765
|
+
optional: u,
|
|
766
|
+
description: p,
|
|
767
|
+
helperText: g,
|
|
768
768
|
errorText: b,
|
|
769
769
|
leftIcon: m,
|
|
770
770
|
rightIcon: v,
|
|
771
771
|
leftAddons: B,
|
|
772
|
-
rightAddons:
|
|
772
|
+
rightAddons: S,
|
|
773
773
|
onClickLeftIcon: nn,
|
|
774
774
|
onClickRightIcon: V,
|
|
775
775
|
fullWidth: vn = !0,
|
|
776
776
|
highlightPlaceholder: O,
|
|
777
|
-
currency:
|
|
777
|
+
currency: L,
|
|
778
778
|
options: E,
|
|
779
779
|
onOptionChange: j,
|
|
780
780
|
clearable: wn = !0,
|
|
781
781
|
onClear: Y,
|
|
782
|
-
...
|
|
783
|
-
} = n, A =
|
|
784
|
-
const t =
|
|
785
|
-
return
|
|
786
|
-
}), [tn, en] = I(!1), [
|
|
782
|
+
...s
|
|
783
|
+
} = n, A = s.value !== void 0, [W, k] = I(() => {
|
|
784
|
+
const t = s.value !== void 0 ? String(s.value ?? "") : String(s.defaultValue ?? "");
|
|
785
|
+
return L ? Q(t) : t;
|
|
786
|
+
}), [tn, en] = I(!1), [kn, sn] = I(""), y = R(null), C = R(null);
|
|
787
787
|
En(e, () => C.current);
|
|
788
|
-
const
|
|
789
|
-
|
|
788
|
+
const an = R(
|
|
789
|
+
s.id ?? `sa-input-${Math.random().toString(36).slice(2, 9)}`
|
|
790
790
|
), {
|
|
791
791
|
isComponentVisible: rn,
|
|
792
792
|
ref: _,
|
|
793
|
-
setIsComponentVisible:
|
|
793
|
+
setIsComponentVisible: yn
|
|
794
794
|
} = On(!1);
|
|
795
|
-
|
|
795
|
+
bn(() => {
|
|
796
796
|
if (!A)
|
|
797
797
|
return;
|
|
798
|
-
const t =
|
|
799
|
-
|
|
800
|
-
}, [
|
|
801
|
-
if (
|
|
798
|
+
const t = s.value === void 0 || s.value === null ? "" : String(s.value), i = L ? Q(t) : t;
|
|
799
|
+
k((x) => x === i ? x : i);
|
|
800
|
+
}, [s.value, L, A]), bn(() => {
|
|
801
|
+
if (y.current === null)
|
|
802
802
|
return;
|
|
803
|
-
const t = C.current, i =
|
|
804
|
-
if (
|
|
803
|
+
const t = C.current, i = y.current;
|
|
804
|
+
if (y.current = null, !!t)
|
|
805
805
|
try {
|
|
806
806
|
t.setSelectionRange(i, i);
|
|
807
807
|
} catch {
|
|
808
808
|
}
|
|
809
809
|
}, [W]);
|
|
810
|
-
const N = W, $ = N !== "" && N !== void 0, w = d === "disable" ||
|
|
810
|
+
const N = W, $ = N !== "" && N !== void 0, w = d === "disable" || s.disabled, M = w ? "disable" : d, P = c === "inside", zn = P && ($ || tn), H = [
|
|
811
811
|
"sa-tf",
|
|
812
|
-
`sa-tf-variant-${
|
|
812
|
+
`sa-tf-variant-${o}`,
|
|
813
813
|
`sa-tf-size-${r}`,
|
|
814
814
|
`sa-tf-status-${M}`,
|
|
815
|
-
`sa-tf-label-${
|
|
815
|
+
`sa-tf-label-${c}`,
|
|
816
816
|
tn ? "sa-tf-focused" : "",
|
|
817
817
|
w ? "sa-tf-disabled" : "",
|
|
818
818
|
zn ? "sa-tf-floating" : "",
|
|
@@ -822,42 +822,42 @@ const Yn = (n) => /* @__PURE__ */ o(
|
|
|
822
822
|
var t;
|
|
823
823
|
return (t = C.current) == null ? void 0 : t.focus();
|
|
824
824
|
}, Nn = (t) => {
|
|
825
|
-
var un,
|
|
826
|
-
if (!
|
|
825
|
+
var un, pn;
|
|
826
|
+
if (!L) {
|
|
827
827
|
const D = t.target.selectionStart;
|
|
828
|
-
D !== null && (
|
|
828
|
+
D !== null && (y.current = D), k(t.target.value), (un = s.onChange) == null || un.call(s, t);
|
|
829
829
|
return;
|
|
830
830
|
}
|
|
831
831
|
const i = t.target.value;
|
|
832
|
-
let
|
|
833
|
-
if (
|
|
834
|
-
const D = W.replace(/\D/g, ""),
|
|
835
|
-
D.length ===
|
|
832
|
+
let x = i, h = t.target.selectionStart ?? i.length;
|
|
833
|
+
if (kn === "Backspace") {
|
|
834
|
+
const D = W.replace(/\D/g, ""), Sn = i.replace(/\D/g, "");
|
|
835
|
+
D.length === Sn.length && h > 0 && (x = i.slice(0, h - 1) + i.slice(h), h -= 1);
|
|
836
836
|
}
|
|
837
|
-
const G = Q(
|
|
838
|
-
|
|
837
|
+
const G = Q(x), Rn = x.slice(0, h).replace(/\D/g, "").length, Bn = Fn(G, Rn);
|
|
838
|
+
y.current = Bn, k(G), (pn = s.onChange) == null || pn.call(s, {
|
|
839
839
|
...t,
|
|
840
840
|
target: {
|
|
841
841
|
...t.target,
|
|
842
842
|
value: String(Dn(G)),
|
|
843
843
|
name: t.target.name
|
|
844
844
|
}
|
|
845
|
-
}),
|
|
846
|
-
}, q = (t) => f ? /* @__PURE__ */
|
|
847
|
-
/* @__PURE__ */
|
|
845
|
+
}), sn("");
|
|
846
|
+
}, q = (t) => f ? /* @__PURE__ */ l("div", { className: t, children: [
|
|
847
|
+
/* @__PURE__ */ a(
|
|
848
848
|
"label",
|
|
849
849
|
{
|
|
850
|
-
htmlFor:
|
|
850
|
+
htmlFor: an.current,
|
|
851
851
|
style: { cursor: w ? "not-allowed" : "pointer" },
|
|
852
852
|
children: f
|
|
853
853
|
}
|
|
854
854
|
),
|
|
855
|
-
|
|
856
|
-
T ? /* @__PURE__ */
|
|
857
|
-
] }) : null, K = /* @__PURE__ */
|
|
858
|
-
|
|
859
|
-
b && d === "error" ? /* @__PURE__ */
|
|
860
|
-
] }), U = (t, i) => /* @__PURE__ */
|
|
855
|
+
u ? /* @__PURE__ */ a("span", { className: "sa-tf-optional", children: "Optional" }) : null,
|
|
856
|
+
T ? /* @__PURE__ */ a("span", { className: "sa-tf-required", "aria-hidden": "true", children: "*" }) : null
|
|
857
|
+
] }) : null, K = /* @__PURE__ */ l(Ln, { children: [
|
|
858
|
+
g ? /* @__PURE__ */ a("p", { className: "sa-tf-helper", children: g }) : null,
|
|
859
|
+
b && d === "error" ? /* @__PURE__ */ a("p", { className: "sa-tf-error", children: b }) : null
|
|
860
|
+
] }), U = (t, i) => /* @__PURE__ */ a(
|
|
861
861
|
"span",
|
|
862
862
|
{
|
|
863
863
|
className: `sa-tf-icon${i ? " sa-tf-icon-clickable" : ""}`,
|
|
@@ -871,7 +871,7 @@ const Yn = (n) => /* @__PURE__ */ o(
|
|
|
871
871
|
}
|
|
872
872
|
), on = () => {
|
|
873
873
|
var i;
|
|
874
|
-
return v == null ? null : !Z.isValidElement(v) || ((i = v.type) == null ? void 0 : i.__saRaw) === !0 ? /* @__PURE__ */
|
|
874
|
+
return v == null ? null : !Z.isValidElement(v) || ((i = v.type) == null ? void 0 : i.__saRaw) === !0 ? /* @__PURE__ */ a(
|
|
875
875
|
"span",
|
|
876
876
|
{
|
|
877
877
|
className: `sa-tf-icon${V ? " sa-tf-icon-clickable" : ""}`,
|
|
@@ -879,13 +879,13 @@ const Yn = (n) => /* @__PURE__ */ o(
|
|
|
879
879
|
children: v
|
|
880
880
|
}
|
|
881
881
|
) : U(v, V);
|
|
882
|
-
}, ln = d === "success" ? /* @__PURE__ */
|
|
882
|
+
}, ln = d === "success" ? /* @__PURE__ */ a("span", { className: "sa-tf-icon sa-tf-success-mark", "aria-hidden": "true", children: /* @__PURE__ */ a(
|
|
883
883
|
Yn,
|
|
884
884
|
{
|
|
885
885
|
width: z(r),
|
|
886
886
|
height: z(r)
|
|
887
887
|
}
|
|
888
|
-
) }) : null, dn = wn && !w ? /* @__PURE__ */
|
|
888
|
+
) }) : null, dn = wn && !w ? /* @__PURE__ */ a(
|
|
889
889
|
"button",
|
|
890
890
|
{
|
|
891
891
|
type: "button",
|
|
@@ -894,19 +894,19 @@ const Yn = (n) => /* @__PURE__ */ o(
|
|
|
894
894
|
"aria-hidden": !$,
|
|
895
895
|
tabIndex: -1,
|
|
896
896
|
onClick: (t) => {
|
|
897
|
-
var
|
|
898
|
-
t.stopPropagation(), A ||
|
|
897
|
+
var x;
|
|
898
|
+
t.stopPropagation(), A || k("");
|
|
899
899
|
const i = {
|
|
900
|
-
target: { value: "", name:
|
|
901
|
-
currentTarget: { value: "", name:
|
|
900
|
+
target: { value: "", name: s.name },
|
|
901
|
+
currentTarget: { value: "", name: s.name }
|
|
902
902
|
};
|
|
903
|
-
(
|
|
904
|
-
var
|
|
905
|
-
return (
|
|
903
|
+
(x = s.onChange) == null || x.call(s, i), Y == null || Y(), y.current = 0, requestAnimationFrame(() => {
|
|
904
|
+
var h;
|
|
905
|
+
return (h = C.current) == null ? void 0 : h.focus();
|
|
906
906
|
});
|
|
907
907
|
},
|
|
908
908
|
onMouseDown: (t) => t.preventDefault(),
|
|
909
|
-
children: /* @__PURE__ */
|
|
909
|
+
children: /* @__PURE__ */ a(
|
|
910
910
|
An,
|
|
911
911
|
{
|
|
912
912
|
width: z(r),
|
|
@@ -914,94 +914,94 @@ const Yn = (n) => /* @__PURE__ */ o(
|
|
|
914
914
|
}
|
|
915
915
|
)
|
|
916
916
|
}
|
|
917
|
-
) : null, In = !$ && !!
|
|
918
|
-
/* @__PURE__ */
|
|
917
|
+
) : null, In = !$ && !!s.placeholder && !!O, fn = /* @__PURE__ */ l("div", { className: "sa-tf-field-wrap", children: [
|
|
918
|
+
/* @__PURE__ */ a(
|
|
919
919
|
"input",
|
|
920
920
|
{
|
|
921
|
-
...
|
|
922
|
-
id:
|
|
921
|
+
...s,
|
|
922
|
+
id: an.current,
|
|
923
923
|
ref: C,
|
|
924
924
|
className: "sa-tf-input",
|
|
925
925
|
disabled: w,
|
|
926
|
-
placeholder: O ? "" :
|
|
926
|
+
placeholder: O ? "" : s.placeholder,
|
|
927
927
|
value: N,
|
|
928
928
|
onFocus: (t) => {
|
|
929
929
|
var i;
|
|
930
|
-
en(!0),
|
|
930
|
+
en(!0), yn(!0), (i = s.onFocus) == null || i.call(s, t);
|
|
931
931
|
},
|
|
932
932
|
onBlur: (t) => {
|
|
933
933
|
var i;
|
|
934
|
-
en(!1), (i =
|
|
934
|
+
en(!1), (i = s.onBlur) == null || i.call(s, t);
|
|
935
935
|
},
|
|
936
936
|
onKeyDown: (t) => {
|
|
937
937
|
var i;
|
|
938
|
-
t.key === "Backspace" &&
|
|
938
|
+
t.key === "Backspace" && sn(t.key), (i = s.onKeyDown) == null || i.call(s, t);
|
|
939
939
|
},
|
|
940
940
|
onChange: Nn
|
|
941
941
|
}
|
|
942
942
|
),
|
|
943
|
-
In ? _n(
|
|
944
|
-
] }), cn = N && rn && (E != null && E.length) ? /* @__PURE__ */
|
|
943
|
+
In ? _n(s.placeholder, O) : null
|
|
944
|
+
] }), cn = N && rn && (E != null && E.length) ? /* @__PURE__ */ a(
|
|
945
945
|
Tn,
|
|
946
946
|
{
|
|
947
947
|
options: E,
|
|
948
948
|
value: N,
|
|
949
|
-
setValue:
|
|
949
|
+
setValue: k,
|
|
950
950
|
ref: _,
|
|
951
951
|
isComponentVisible: rn,
|
|
952
952
|
onOptionChange: (t) => {
|
|
953
|
-
j == null || j(t),
|
|
953
|
+
j == null || j(t), k(t);
|
|
954
954
|
}
|
|
955
955
|
}
|
|
956
|
-
) : null, X = P ? /* @__PURE__ */
|
|
956
|
+
) : null, X = P ? /* @__PURE__ */ l(
|
|
957
957
|
"div",
|
|
958
958
|
{
|
|
959
959
|
className: "sa-tf-box",
|
|
960
960
|
ref: _,
|
|
961
961
|
onClick: Cn,
|
|
962
962
|
children: [
|
|
963
|
-
B ? /* @__PURE__ */
|
|
964
|
-
/* @__PURE__ */
|
|
963
|
+
B ? /* @__PURE__ */ a("div", { className: "sa-tf-addon sa-tf-addon-left", children: B }) : null,
|
|
964
|
+
/* @__PURE__ */ l("div", { className: "sa-tf-box-content", children: [
|
|
965
965
|
m ? U(m, nn) : null,
|
|
966
|
-
/* @__PURE__ */
|
|
966
|
+
/* @__PURE__ */ l("div", { className: "sa-tf-inside-stack", children: [
|
|
967
967
|
q("sa-tf-inside-label-row"),
|
|
968
|
-
/* @__PURE__ */
|
|
968
|
+
/* @__PURE__ */ a("div", { className: "sa-tf-inside-row", children: fn })
|
|
969
969
|
] }),
|
|
970
970
|
dn,
|
|
971
971
|
ln,
|
|
972
972
|
on()
|
|
973
973
|
] }),
|
|
974
|
-
|
|
974
|
+
S ? /* @__PURE__ */ a("div", { className: "sa-tf-addon sa-tf-addon-right", children: S }) : null,
|
|
975
975
|
cn
|
|
976
976
|
]
|
|
977
977
|
}
|
|
978
|
-
) : /* @__PURE__ */
|
|
979
|
-
B ? /* @__PURE__ */
|
|
980
|
-
/* @__PURE__ */
|
|
978
|
+
) : /* @__PURE__ */ l("div", { className: "sa-tf-box", ref: _, children: [
|
|
979
|
+
B ? /* @__PURE__ */ a("div", { className: "sa-tf-addon sa-tf-addon-left", children: B }) : null,
|
|
980
|
+
/* @__PURE__ */ l("div", { className: "sa-tf-box-content", children: [
|
|
981
981
|
m ? U(m, nn) : null,
|
|
982
982
|
fn,
|
|
983
983
|
dn,
|
|
984
984
|
ln,
|
|
985
985
|
on()
|
|
986
986
|
] }),
|
|
987
|
-
|
|
987
|
+
S ? /* @__PURE__ */ a("div", { className: "sa-tf-addon sa-tf-addon-right", children: S }) : null,
|
|
988
988
|
cn
|
|
989
989
|
] });
|
|
990
|
-
return
|
|
991
|
-
/* @__PURE__ */
|
|
990
|
+
return c === "outside-left" ? /* @__PURE__ */ l("div", { className: H, children: [
|
|
991
|
+
/* @__PURE__ */ l("div", { className: "sa-tf-label-col", children: [
|
|
992
992
|
q("sa-tf-label"),
|
|
993
|
-
|
|
993
|
+
p ? /* @__PURE__ */ a("p", { className: "sa-tf-desc-top", children: p }) : null
|
|
994
994
|
] }),
|
|
995
|
-
/* @__PURE__ */
|
|
995
|
+
/* @__PURE__ */ l("div", { className: "sa-tf-input-col", children: [
|
|
996
996
|
X,
|
|
997
997
|
K
|
|
998
998
|
] })
|
|
999
|
-
] }) : P ? /* @__PURE__ */
|
|
999
|
+
] }) : P ? /* @__PURE__ */ l("div", { className: H, children: [
|
|
1000
1000
|
X,
|
|
1001
1001
|
K
|
|
1002
|
-
] }) : /* @__PURE__ */
|
|
1002
|
+
] }) : /* @__PURE__ */ l("div", { className: H, children: [
|
|
1003
1003
|
q("sa-tf-label"),
|
|
1004
|
-
|
|
1004
|
+
p ? /* @__PURE__ */ a("p", { className: "sa-tf-desc-top", children: p }) : null,
|
|
1005
1005
|
X,
|
|
1006
1006
|
K
|
|
1007
1007
|
] });
|
|
@@ -1010,11 +1010,11 @@ const Yn = (n) => /* @__PURE__ */ o(
|
|
|
1010
1010
|
if (!n)
|
|
1011
1011
|
return null;
|
|
1012
1012
|
if (!e)
|
|
1013
|
-
return /* @__PURE__ */
|
|
1013
|
+
return /* @__PURE__ */ a("p", { className: "sa-tf-placeholder", children: n });
|
|
1014
1014
|
const r = n.toLowerCase().indexOf(e.toLowerCase());
|
|
1015
|
-
return r === -1 ? /* @__PURE__ */
|
|
1015
|
+
return r === -1 ? /* @__PURE__ */ a("p", { className: "sa-tf-placeholder", children: n }) : /* @__PURE__ */ l("p", { className: "sa-tf-placeholder", children: [
|
|
1016
1016
|
n.slice(0, r),
|
|
1017
|
-
/* @__PURE__ */
|
|
1017
|
+
/* @__PURE__ */ a("span", { className: "sa-tf-placeholder-highlight", children: n.slice(r, r + e.length) }),
|
|
1018
1018
|
n.slice(r + e.length)
|
|
1019
1019
|
] });
|
|
1020
1020
|
};
|
|
@@ -1030,7 +1030,7 @@ const Mn = `.sa-kbd {
|
|
|
1030
1030
|
display: inline-flex;
|
|
1031
1031
|
align-items: center;
|
|
1032
1032
|
justify-content: center;
|
|
1033
|
-
min-width: 1.5em;
|
|
1033
|
+
min-width: 1.5em; /* relative to font-size → scales with \`size\` */
|
|
1034
1034
|
padding: 0 var(--sa-spacing-6, 6px);
|
|
1035
1035
|
background-color: var(--sa-background-neutral, #f0f1f2);
|
|
1036
1036
|
border: 1px solid var(--sa-border-subtle, #0b120e24);
|
|
@@ -1050,6 +1050,53 @@ const Mn = `.sa-kbd {
|
|
|
1050
1050
|
font-size: var(--sa-font-size-sm, 12px);
|
|
1051
1051
|
user-select: none;
|
|
1052
1052
|
}
|
|
1053
|
+
|
|
1054
|
+
/* ── Sizes (matches Input's xs/sm/md/lg). \`min-width: 1.5em\` auto-scales;
|
|
1055
|
+
font-size + horizontal padding + gap driven per size. Default \`sm\` keeps
|
|
1056
|
+
the pre-existing look. ── */
|
|
1057
|
+
.sa-kbd-size-xs {
|
|
1058
|
+
gap: 3px;
|
|
1059
|
+
}
|
|
1060
|
+
.sa-kbd-size-xs .sa-kbd-key {
|
|
1061
|
+
padding: 0 4px;
|
|
1062
|
+
font-size: 10px;
|
|
1063
|
+
}
|
|
1064
|
+
.sa-kbd-size-xs .sa-kbd-sep {
|
|
1065
|
+
font-size: 10px;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
.sa-kbd-size-sm {
|
|
1069
|
+
gap: var(--sa-spacing-4, 4px);
|
|
1070
|
+
}
|
|
1071
|
+
.sa-kbd-size-sm .sa-kbd-key {
|
|
1072
|
+
padding: 0 var(--sa-spacing-6, 6px);
|
|
1073
|
+
font-size: var(--sa-font-size-sm, 12px);
|
|
1074
|
+
}
|
|
1075
|
+
.sa-kbd-size-sm .sa-kbd-sep {
|
|
1076
|
+
font-size: var(--sa-font-size-sm, 12px);
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
.sa-kbd-size-md {
|
|
1080
|
+
gap: 5px;
|
|
1081
|
+
}
|
|
1082
|
+
.sa-kbd-size-md .sa-kbd-key {
|
|
1083
|
+
padding: 0 8px;
|
|
1084
|
+
font-size: 14px;
|
|
1085
|
+
}
|
|
1086
|
+
.sa-kbd-size-md .sa-kbd-sep {
|
|
1087
|
+
font-size: 14px;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
.sa-kbd-size-lg {
|
|
1091
|
+
gap: 6px;
|
|
1092
|
+
}
|
|
1093
|
+
.sa-kbd-size-lg .sa-kbd-key {
|
|
1094
|
+
padding: 0 10px;
|
|
1095
|
+
font-size: 16px;
|
|
1096
|
+
}
|
|
1097
|
+
.sa-kbd-size-lg .sa-kbd-sep {
|
|
1098
|
+
font-size: 16px;
|
|
1099
|
+
}
|
|
1053
1100
|
`, hn = "sa-kbd-styles", Pn = (n) => {
|
|
1054
1101
|
if (!(typeof document > "u") && !document.getElementById(hn)) {
|
|
1055
1102
|
const e = document.createElement("style");
|
|
@@ -1057,11 +1104,18 @@ const Mn = `.sa-kbd {
|
|
|
1057
1104
|
}
|
|
1058
1105
|
};
|
|
1059
1106
|
Pn(Mn);
|
|
1060
|
-
function Hn({ keys: n, separator: e,
|
|
1061
|
-
return /* @__PURE__ */
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1107
|
+
function Hn({ keys: n, separator: e, size: r = "sm", className: o, ...d }) {
|
|
1108
|
+
return /* @__PURE__ */ a(
|
|
1109
|
+
"span",
|
|
1110
|
+
{
|
|
1111
|
+
className: `sa-kbd sa-kbd-size-${r}${o ? ` ${o}` : ""}`,
|
|
1112
|
+
...d,
|
|
1113
|
+
children: n.map((f, c) => /* @__PURE__ */ l(Z.Fragment, { children: [
|
|
1114
|
+
c > 0 && e != null ? /* @__PURE__ */ a("span", { className: "sa-kbd-sep", "aria-hidden": "true", children: e }) : null,
|
|
1115
|
+
/* @__PURE__ */ a("kbd", { className: "sa-kbd-key", children: f })
|
|
1116
|
+
] }, c))
|
|
1117
|
+
}
|
|
1118
|
+
);
|
|
1065
1119
|
}
|
|
1066
1120
|
Hn.__saRaw = !0;
|
|
1067
1121
|
export {
|
package/dist/input.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(b,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],n):(b=typeof globalThis<"u"?globalThis:b||self,n(b.Input={},b.jsxRuntime,b.React))})(this,function(b,n,o){"use strict";const gn=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
|
|
2
2
|
|
|
3
3
|
:root {
|
|
4
4
|
/* Layer 3 — references Layer 2 semantic tokens */
|
|
@@ -612,7 +612,7 @@
|
|
|
612
612
|
.sa-tf-label-inside.sa-tf-floating.sa-tf-size-xl .sa-tf-box {
|
|
613
613
|
min-height: 80px;
|
|
614
614
|
}
|
|
615
|
-
`,
|
|
615
|
+
`,y=t=>t==="lg"||t==="xl"?18:t==="xs"?14:16,j={default:"var(--sa-color-gray-800, #505258)",error:"var(--sa-text-error, #a4133c)",success:"var(--sa-text-success, #208958)",disable:"var(--sa-icon-disable, #181a198f)"},Q=(t,e)=>e?j.disable:j[t]??j.default;function hn(t){return Number(t.replace(/\./g,""))}function F(t){let e=t.replace(/[^\d]/g,"");return e=e.replace(/^0+(?=\d)/,""),e.replace(/\B(?=(\d{3})+(?!\d))/g,".")}function vn(t,e){if(e<=0)return 0;let r=0;for(let l=0;l<t.length;l++)if(/\d/.test(t[l])&&(r+=1,r===e))return l+1;return t.length}const mn=o.forwardRef(({options:t,value:e,setValue:r,isComponentVisible:l,onOptionChange:d},f)=>{const[c,T]=o.useState([]),u=o.useRef(null),p=()=>{if(f!=null&&f.current&&u.current){const h=window.innerHeight,x=f==null?void 0:f.current.getBoundingClientRect(),m=u.current.getBoundingClientRect(),w=x.bottom+m.height;u.current.style.left=`${x.left}px`,u.current.style.width=`${x.width}px`,w>=h-10?u.current.style.top=`${x.top-m.height-5}px`:u.current.style.top=`${x.top+x.height}px`}};return o.useEffect(()=>(window.addEventListener("scroll",p),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p),window.removeEventListener("resize",p)}),[f,u]),o.useEffect(()=>{p()},[l]),o.useEffect(()=>{T((t==null?void 0:t.filter(h=>h.toLowerCase().startsWith(e.toLowerCase())))||[])},[e,t]),n.jsx("div",{ref:u,style:{position:"fixed",padding:"8px",boxSizing:"border-box",boxShadow:"0px 8px 12px 0px var(--sa-color-black-alpha-a8, #00000014)",borderRadius:"8px",background:"white",overflow:"auto",zIndex:5e4},children:c==null?void 0:c.map(h=>wn(h,e,r,d))})}),wn=(t,e,r,l)=>{const d=t.toLowerCase().indexOf(e.toLowerCase());return n.jsxs("p",{style:{fontFamily:"Poppins",color:"var(--sa-color-gray-400, #b7b9be)",fontWeight:500,padding:"8px 14px",cursor:"pointer"},onClick:()=>{r(t),l&&l(t)},children:[t.slice(0,d),n.jsx("span",{style:{color:"var(--sa-text-primary, #292a2e)"},children:t.slice(d,d+e.length)}),t.slice(d+e.length)]})};function kn(t){const[e,r]=o.useState(t),l=o.useRef(null),d=f=>{l.current&&!l.current.contains(f.target)&&r(!1)};return o.useEffect(()=>(document.addEventListener("click",d,!0),()=>{document.removeEventListener("click",d,!0)}),[]),{ref:l,isComponentVisible:e,setIsComponentVisible:r}}const Z="sa-input-styles";(t=>{if(!(typeof document>"u")&&!document.getElementById(Z)){const e=document.createElement("style");e.id=Z,e.textContent=t,document.head.appendChild(e)}})(gn);const yn=t=>n.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[n.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M5.2 8.2l1.8 1.8 3.8-4.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),zn=t=>n.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[n.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"currentColor",opacity:"0.2"}),n.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]}),R=o.forwardRef((t,e)=>{const{size:r="sm",variant:l="outline",status:d="default",label:f,labelPosition:c="outside-top",required:T,optional:u,description:p,helperText:h,errorText:x,leftIcon:m,rightIcon:w,leftAddons:S,rightAddons:B,onClickLeftIcon:sn,onClickRightIcon:O,fullWidth:In=!0,highlightPlaceholder:V,currency:E,options:L,onOptionChange:Y,clearable:Sn=!0,onClear:A,...a}=t,M=a.value!==void 0,[P,z]=o.useState(()=>{const s=a.value!==void 0?String(a.value??""):String(a.defaultValue??"");return E?F(s):s}),[en,an]=o.useState(!1),[Bn,rn]=o.useState(""),C=o.useRef(null),N=o.useRef(null);o.useImperativeHandle(e,()=>N.current);const on=o.useRef(a.id??`sa-input-${Math.random().toString(36).slice(2,9)}`),{isComponentVisible:ln,ref:W,setIsComponentVisible:En}=kn(!1);o.useLayoutEffect(()=>{if(!M)return;const s=a.value===void 0||a.value===null?"":String(a.value),i=E?F(s):s;z(g=>g===i?g:i)},[a.value,E,M]),o.useLayoutEffect(()=>{if(C.current===null)return;const s=N.current,i=C.current;if(C.current=null,!!s)try{s.setSelectionRange(i,i)}catch{}},[P]);const I=P,$=I!==""&&I!==void 0,k=d==="disable"||a.disabled,_=k?"disable":d,q=c==="inside",Ln=q&&($||en),H=["sa-tf",`sa-tf-variant-${l}`,`sa-tf-size-${r}`,`sa-tf-status-${_}`,`sa-tf-label-${c}`,en?"sa-tf-focused":"",k?"sa-tf-disabled":"",Ln?"sa-tf-floating":"",f?"":"sa-tf-no-label",In?"sa-tf-fullwidth":""].filter(Boolean).join(" "),$n=()=>{var s;return(s=N.current)==null?void 0:s.focus()},Dn=s=>{var bn,xn;if(!E){const D=s.target.selectionStart;D!==null&&(C.current=D),z(s.target.value),(bn=a.onChange)==null||bn.call(a,s);return}const i=s.target.value;let g=i,v=s.target.selectionStart??i.length;if(Bn==="Backspace"){const D=P.replace(/\D/g,""),Vn=i.replace(/\D/g,"");D.length===Vn.length&&v>0&&(g=i.slice(0,v-1)+i.slice(v),v-=1)}const J=F(g),Tn=g.slice(0,v).replace(/\D/g,"").length,On=vn(J,Tn);C.current=On,z(J),(xn=a.onChange)==null||xn.call(a,{...s,target:{...s.target,value:String(hn(J)),name:s.target.name}}),rn("")},K=s=>f?n.jsxs("div",{className:s,children:[n.jsx("label",{htmlFor:on.current,style:{cursor:k?"not-allowed":"pointer"},children:f}),u?n.jsx("span",{className:"sa-tf-optional",children:"Optional"}):null,T?n.jsx("span",{className:"sa-tf-required","aria-hidden":"true",children:"*"}):null]}):null,U=n.jsxs(n.Fragment,{children:[h?n.jsx("p",{className:"sa-tf-helper",children:h}):null,x&&d==="error"?n.jsx("p",{className:"sa-tf-error",children:x}):null]}),X=(s,i)=>n.jsx("span",{className:`sa-tf-icon${i?" sa-tf-icon-clickable":""}`,onClick:i,children:o.cloneElement(s,{width:y(r),height:y(r),color:Q(_,k),style:{color:Q(_,k)}})}),dn=()=>{var i;return w==null?null:!o.isValidElement(w)||((i=w.type)==null?void 0:i.__saRaw)===!0?n.jsx("span",{className:`sa-tf-icon${O?" sa-tf-icon-clickable":""}`,onClick:O,children:w}):X(w,O)},fn=d==="success"?n.jsx("span",{className:"sa-tf-icon sa-tf-success-mark","aria-hidden":"true",children:n.jsx(yn,{width:y(r),height:y(r)})}):null,jn=s=>{var g;s.stopPropagation(),M||z("");const i={target:{value:"",name:a.name},currentTarget:{value:"",name:a.name}};(g=a.onChange)==null||g.call(a,i),A==null||A(),C.current=0,requestAnimationFrame(()=>{var v;return(v=N.current)==null?void 0:v.focus()})},cn=Sn&&!k?n.jsx("button",{type:"button",className:`sa-tf-icon sa-tf-clear${$?"":" sa-tf-clear-hidden"}`,"aria-label":"Clear input","aria-hidden":!$,tabIndex:-1,onClick:jn,onMouseDown:s=>s.preventDefault(),children:n.jsx(zn,{width:y(r),height:y(r)})}):null,Fn=!$&&!!a.placeholder&&!!V,un=n.jsxs("div",{className:"sa-tf-field-wrap",children:[n.jsx("input",{...a,id:on.current,ref:N,className:"sa-tf-input",disabled:k,placeholder:V?"":a.placeholder,value:I,onFocus:s=>{var i;an(!0),En(!0),(i=a.onFocus)==null||i.call(a,s)},onBlur:s=>{var i;an(!1),(i=a.onBlur)==null||i.call(a,s)},onKeyDown:s=>{var i;s.key==="Backspace"&&rn(s.key),(i=a.onKeyDown)==null||i.call(a,s)},onChange:Dn}),Fn?Cn(a.placeholder,V):null]}),pn=I&&ln&&(L!=null&&L.length)?n.jsx(mn,{options:L,value:I,setValue:z,ref:W,isComponentVisible:ln,onOptionChange:s=>{Y==null||Y(s),z(s)}}):null,G=q?n.jsxs("div",{className:"sa-tf-box",ref:W,onClick:$n,children:[S?n.jsx("div",{className:"sa-tf-addon sa-tf-addon-left",children:S}):null,n.jsxs("div",{className:"sa-tf-box-content",children:[m?X(m,sn):null,n.jsxs("div",{className:"sa-tf-inside-stack",children:[K("sa-tf-inside-label-row"),n.jsx("div",{className:"sa-tf-inside-row",children:un})]}),cn,fn,dn()]}),B?n.jsx("div",{className:"sa-tf-addon sa-tf-addon-right",children:B}):null,pn]}):n.jsxs("div",{className:"sa-tf-box",ref:W,children:[S?n.jsx("div",{className:"sa-tf-addon sa-tf-addon-left",children:S}):null,n.jsxs("div",{className:"sa-tf-box-content",children:[m?X(m,sn):null,un,cn,fn,dn()]}),B?n.jsx("div",{className:"sa-tf-addon sa-tf-addon-right",children:B}):null,pn]});return c==="outside-left"?n.jsxs("div",{className:H,children:[n.jsxs("div",{className:"sa-tf-label-col",children:[K("sa-tf-label"),p?n.jsx("p",{className:"sa-tf-desc-top",children:p}):null]}),n.jsxs("div",{className:"sa-tf-input-col",children:[G,U]})]}):q?n.jsxs("div",{className:H,children:[G,U]}):n.jsxs("div",{className:H,children:[K("sa-tf-label"),p?n.jsx("p",{className:"sa-tf-desc-top",children:p}):null,G,U]})}),Cn=(t,e)=>{if(!t)return null;if(!e)return n.jsx("p",{className:"sa-tf-placeholder",children:t});const r=t.toLowerCase().indexOf(e.toLowerCase());return r===-1?n.jsx("p",{className:"sa-tf-placeholder",children:t}):n.jsxs("p",{className:"sa-tf-placeholder",children:[t.slice(0,r),n.jsx("span",{className:"sa-tf-placeholder-highlight",children:t.slice(r,r+e.length)}),t.slice(r+e.length)]})};R.displayName="Input";const Nn=`.sa-kbd {
|
|
616
616
|
display: inline-flex;
|
|
617
617
|
align-items: center;
|
|
618
618
|
gap: var(--sa-spacing-4, 4px);
|
|
@@ -623,7 +623,7 @@
|
|
|
623
623
|
display: inline-flex;
|
|
624
624
|
align-items: center;
|
|
625
625
|
justify-content: center;
|
|
626
|
-
min-width: 1.5em;
|
|
626
|
+
min-width: 1.5em; /* relative to font-size → scales with \`size\` */
|
|
627
627
|
padding: 0 var(--sa-spacing-6, 6px);
|
|
628
628
|
background-color: var(--sa-background-neutral, #f0f1f2);
|
|
629
629
|
border: 1px solid var(--sa-border-subtle, #0b120e24);
|
|
@@ -643,4 +643,51 @@
|
|
|
643
643
|
font-size: var(--sa-font-size-sm, 12px);
|
|
644
644
|
user-select: none;
|
|
645
645
|
}
|
|
646
|
-
|
|
646
|
+
|
|
647
|
+
/* ── Sizes (matches Input's xs/sm/md/lg). \`min-width: 1.5em\` auto-scales;
|
|
648
|
+
font-size + horizontal padding + gap driven per size. Default \`sm\` keeps
|
|
649
|
+
the pre-existing look. ── */
|
|
650
|
+
.sa-kbd-size-xs {
|
|
651
|
+
gap: 3px;
|
|
652
|
+
}
|
|
653
|
+
.sa-kbd-size-xs .sa-kbd-key {
|
|
654
|
+
padding: 0 4px;
|
|
655
|
+
font-size: 10px;
|
|
656
|
+
}
|
|
657
|
+
.sa-kbd-size-xs .sa-kbd-sep {
|
|
658
|
+
font-size: 10px;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
.sa-kbd-size-sm {
|
|
662
|
+
gap: var(--sa-spacing-4, 4px);
|
|
663
|
+
}
|
|
664
|
+
.sa-kbd-size-sm .sa-kbd-key {
|
|
665
|
+
padding: 0 var(--sa-spacing-6, 6px);
|
|
666
|
+
font-size: var(--sa-font-size-sm, 12px);
|
|
667
|
+
}
|
|
668
|
+
.sa-kbd-size-sm .sa-kbd-sep {
|
|
669
|
+
font-size: var(--sa-font-size-sm, 12px);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
.sa-kbd-size-md {
|
|
673
|
+
gap: 5px;
|
|
674
|
+
}
|
|
675
|
+
.sa-kbd-size-md .sa-kbd-key {
|
|
676
|
+
padding: 0 8px;
|
|
677
|
+
font-size: 14px;
|
|
678
|
+
}
|
|
679
|
+
.sa-kbd-size-md .sa-kbd-sep {
|
|
680
|
+
font-size: 14px;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
.sa-kbd-size-lg {
|
|
684
|
+
gap: 6px;
|
|
685
|
+
}
|
|
686
|
+
.sa-kbd-size-lg .sa-kbd-key {
|
|
687
|
+
padding: 0 10px;
|
|
688
|
+
font-size: 16px;
|
|
689
|
+
}
|
|
690
|
+
.sa-kbd-size-lg .sa-kbd-sep {
|
|
691
|
+
font-size: 16px;
|
|
692
|
+
}
|
|
693
|
+
`,nn="sa-kbd-styles";(t=>{if(!(typeof document>"u")&&!document.getElementById(nn)){const e=document.createElement("style");e.id=nn,e.textContent=t,document.head.appendChild(e)}})(Nn);function tn({keys:t,separator:e,size:r="sm",className:l,...d}){return n.jsx("span",{className:`sa-kbd sa-kbd-size-${r}${l?` ${l}`:""}`,...d,children:t.map((f,c)=>n.jsxs(o.Fragment,{children:[c>0&&e!=null?n.jsx("span",{className:"sa-kbd-sep","aria-hidden":"true",children:e}):null,n.jsx("kbd",{className:"sa-kbd-key",children:f})]},c))})}tn.__saRaw=!0,b.Input=R,b.Kbd=tn,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|