@kapiuara/ui 0.13.0 → 0.14.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/README.md +5 -0
- package/dist/components/chat/KapiChatDivider.d.ts +7 -3
- package/dist/components/chat/KapiChatDivider.js +6 -6
- package/dist/components/chat/index.d.ts +1 -1
- package/dist/components/display/KapiAnnotation.js +4 -4
- package/dist/components/feedback/KapiFab.js +4 -4
- package/dist/components/feedback/KapiToastContainer.js +5 -5
- package/dist/components/feedback/KapiTour.js +4 -4
- package/dist/components/inputs/KapiDatePicker.js +124 -122
- package/dist/components/inputs/KapiDateRangePicker.js +138 -136
- package/dist/components/inputs/KapiFacetedSearch.js +8 -8
- package/dist/components/inputs/KapiMaskedInput.d.ts +8 -3
- package/dist/components/inputs/KapiMaskedInput.js +66 -53
- package/dist/components/inputs/KapiNumberStepper.js +29 -29
- package/dist/components/inputs/KapiRating.js +61 -59
- package/dist/components/inputs/KapiSegmented.js +68 -58
- package/dist/components/inputs/KapiSelect.js +204 -194
- package/dist/components/inputs/KapiTagInput.js +82 -80
- package/dist/components/inputs/misuseWarnings.d.ts +37 -0
- package/dist/components/inputs/misuseWarnings.js +36 -0
- package/dist/components/inputs/numberStepLogic.d.ts +10 -0
- package/dist/components/inputs/numberStepLogic.js +16 -7
- package/dist/components/layout/KapiAccountMenu.js +4 -4
- package/dist/components/navigation/CtxSlidingList.js +4 -4
- package/dist/components/navigation/KapiTabs.js +58 -51
- package/dist/components/navigation/KapiTree.js +5 -5
- package/dist/components/overlays/KapiContextMenu.js +4 -4
- package/dist/components/overlays/KapiMenuButton.js +4 -4
- package/dist/components/overlays/KapiPhotoView.js +1 -1
- package/dist/components/overlays/KapiPopover.js +4 -4
- package/dist/components/overlays/KapiShapeSheet.js +4 -4
- package/dist/components/overlays/KapiTooltip.js +1 -1
- package/dist/css/components/chat/chat.css +1 -1
- package/dist/hooks/useControllableState.d.ts +6 -2
- package/dist/hooks/useControllableState.js +14 -11
- package/dist/hooks/useFormReset.d.ts +22 -0
- package/dist/hooks/useFormReset.js +17 -0
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +5 -2
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/inputsExtra.css";
|
|
3
|
-
import { fieldControlProps as e, joinIds as t, resolveFieldClassName as n, resolveReadOnly as
|
|
4
|
-
import { useOwnField as
|
|
5
|
-
import { useLabels as
|
|
3
|
+
import { fieldControlProps as e, joinIds as t, resolveFieldClassName as n, resolveReadOnly as ee, resolveValidation as r } from "./fieldLogic.js";
|
|
4
|
+
import { useOwnField as i } from "./ownField.js";
|
|
5
|
+
import { useLabels as a } from "../locale/KapiLocaleProvider.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
import { inputClasses as
|
|
8
|
-
import { useControllableState as
|
|
9
|
-
import { canDecrement as
|
|
10
|
-
import { jsx as
|
|
11
|
-
import { useEffect as
|
|
12
|
-
import { Minus as
|
|
7
|
+
import { inputClasses as o } from "./KapiInput.js";
|
|
8
|
+
import { useControllableState as s } from "../../hooks/useControllableState.js";
|
|
9
|
+
import { canDecrement as te, canIncrement as c, clampNumber as l, parseTypedNumber as u, snapToStep as d, stepValue as ne } from "./numberStepLogic.js";
|
|
10
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
|
+
import { useEffect as m, useState as h } from "react";
|
|
12
|
+
import { Minus as g, Plus as re } from "lucide-react";
|
|
13
13
|
//#region src/components/inputs/KapiNumberStepper.tsx
|
|
14
14
|
var _ = ({ size: e = "md", className: t = "" } = {}) => [
|
|
15
15
|
"kapi-stepper",
|
|
@@ -19,11 +19,11 @@ var _ = ({ size: e = "md", className: t = "" } = {}) => [
|
|
|
19
19
|
decrease: "Disminuir",
|
|
20
20
|
increase: "Aumentar"
|
|
21
21
|
}, y = ({ value: y, defaultValue: b, onChange: x, min: S, max: C, step: w = 1, size: T = "md", invalid: E, status: D, required: O, label: k, help: A, fieldClassName: j, wrapperClassName: M, labels: N, className: P, disabled: F, readOnly: I, id: L, ...R }) => {
|
|
22
|
-
let z =
|
|
22
|
+
let z = a("numberStepper", v, N), [B, V] = s(y, () => l(b ?? 0, {
|
|
23
23
|
min: S,
|
|
24
24
|
max: C,
|
|
25
25
|
step: w
|
|
26
|
-
}), x), { invalid: H, status: U } =
|
|
26
|
+
}), x), { invalid: H, status: U } = r(E, D), W = i({
|
|
27
27
|
id: L,
|
|
28
28
|
label: k,
|
|
29
29
|
help: A,
|
|
@@ -31,42 +31,42 @@ var _ = ({ size: e = "md", className: t = "" } = {}) => [
|
|
|
31
31
|
invalid: E,
|
|
32
32
|
status: D,
|
|
33
33
|
readOnly: I
|
|
34
|
-
}), G = W.controlId ?? W.autoId, { helpId: K } = W, q =
|
|
34
|
+
}), G = W.controlId ?? W.autoId, { helpId: K } = W, q = ee(I, W.field), J = {
|
|
35
35
|
min: S,
|
|
36
36
|
max: C,
|
|
37
37
|
step: w
|
|
38
|
-
}, [Y, X] =
|
|
39
|
-
|
|
38
|
+
}, [Y, X] = h(null);
|
|
39
|
+
m(() => X(null), [B]);
|
|
40
40
|
let Z = (e) => {
|
|
41
|
-
let t =
|
|
41
|
+
let t = l(e, J);
|
|
42
42
|
t !== B && V(t), X(null);
|
|
43
43
|
}, Q = () => {
|
|
44
44
|
if (Y === null) return;
|
|
45
|
-
let e =
|
|
46
|
-
Z(
|
|
45
|
+
let e = u(Y);
|
|
46
|
+
Z(e === null ? B : d(e, J));
|
|
47
47
|
}, $ = (e) => {
|
|
48
48
|
if (q) return;
|
|
49
|
-
let t = Y === null
|
|
50
|
-
Z(
|
|
51
|
-
},
|
|
49
|
+
let t = Y === null ? null : u(Y), n = t === null ? B : d(t, J);
|
|
50
|
+
Z(ne(n, e, J));
|
|
51
|
+
}, ie = /* @__PURE__ */ p("div", {
|
|
52
52
|
className: _({
|
|
53
53
|
size: T,
|
|
54
54
|
className: n(j, M)
|
|
55
55
|
}),
|
|
56
56
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ f("button", {
|
|
58
58
|
type: "button",
|
|
59
59
|
className: "kapi-stepper__btn",
|
|
60
60
|
"aria-label": z.decrease,
|
|
61
61
|
tabIndex: -1,
|
|
62
|
-
disabled: F || q || !
|
|
62
|
+
disabled: F || q || !te(B, J),
|
|
63
63
|
onClick: () => $(-1),
|
|
64
|
-
children: /* @__PURE__ */
|
|
64
|
+
children: /* @__PURE__ */ f(g, {
|
|
65
65
|
size: 15,
|
|
66
66
|
strokeWidth: 2.4
|
|
67
67
|
})
|
|
68
68
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ f("input", {
|
|
70
70
|
...R,
|
|
71
71
|
...e(W.outer, {
|
|
72
72
|
id: G,
|
|
@@ -81,7 +81,7 @@ var _ = ({ size: e = "md", className: t = "" } = {}) => [
|
|
|
81
81
|
"aria-valuenow": B,
|
|
82
82
|
"aria-valuemin": S,
|
|
83
83
|
"aria-valuemax": C,
|
|
84
|
-
className:
|
|
84
|
+
className: o({
|
|
85
85
|
size: T,
|
|
86
86
|
status: U,
|
|
87
87
|
num: !0,
|
|
@@ -95,21 +95,21 @@ var _ = ({ size: e = "md", className: t = "" } = {}) => [
|
|
|
95
95
|
e.key === "ArrowUp" ? (e.preventDefault(), $(1)) : e.key === "ArrowDown" ? (e.preventDefault(), $(-1)) : e.key === "Enter" && Q();
|
|
96
96
|
}
|
|
97
97
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ f("button", {
|
|
99
99
|
type: "button",
|
|
100
100
|
className: "kapi-stepper__btn",
|
|
101
101
|
"aria-label": z.increase,
|
|
102
102
|
tabIndex: -1,
|
|
103
|
-
disabled: F || q || !
|
|
103
|
+
disabled: F || q || !c(B, J),
|
|
104
104
|
onClick: () => $(1),
|
|
105
|
-
children: /* @__PURE__ */
|
|
105
|
+
children: /* @__PURE__ */ f(re, {
|
|
106
106
|
size: 15,
|
|
107
107
|
strokeWidth: 2.4
|
|
108
108
|
})
|
|
109
109
|
})
|
|
110
110
|
]
|
|
111
111
|
});
|
|
112
|
-
return W.wrap(
|
|
112
|
+
return W.wrap(ie);
|
|
113
113
|
};
|
|
114
114
|
//#endregion
|
|
115
115
|
export { v as DEFAULT_NUMBER_STEPPER_LABELS, y as KapiNumberStepper, _ as stepperClasses };
|
|
@@ -5,110 +5,112 @@ import { useOwnField as n } from "./ownField.js";
|
|
|
5
5
|
import { useLabels as r } from "../locale/KapiLocaleProvider.js";
|
|
6
6
|
/* empty css */
|
|
7
7
|
import { useControllableState as i } from "../../hooks/useControllableState.js";
|
|
8
|
-
import { directionOf as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
8
|
+
import { directionOf as ee, logicalKeyOf as te } from "../../hooks/directionLogic.js";
|
|
9
|
+
import { useFormReset as ne } from "../../hooks/useFormReset.js";
|
|
10
|
+
import { useMergedRefs as a } from "../../hooks/mergeRefs.js";
|
|
11
|
+
import { normalizeRating as o, ratingFromKey as s, ratingFromPointer as c, starFills as re } from "./ratingLogic.js";
|
|
12
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
13
|
+
import { useState as ie } from "react";
|
|
14
|
+
import { Star as d } from "lucide-react";
|
|
13
15
|
//#region src/components/inputs/KapiRating.tsx
|
|
14
|
-
var
|
|
16
|
+
var f = {
|
|
15
17
|
rating: "Calificación",
|
|
16
18
|
of: "de"
|
|
17
|
-
},
|
|
19
|
+
}, p = {
|
|
18
20
|
sm: 16,
|
|
19
21
|
md: 22,
|
|
20
22
|
lg: 30
|
|
21
|
-
},
|
|
23
|
+
}, m = ({ size: e = "md", interactive: t = !1, disabled: n = !1, readOnly: r = !1, className: i = "" } = {}) => [
|
|
22
24
|
"kapi-rating",
|
|
23
25
|
e !== "md" && `kapi-rating--${e}`,
|
|
24
26
|
t && "kapi-rating--interactive",
|
|
25
27
|
n && "kapi-rating--disabled",
|
|
26
28
|
r && "kapi-rating--readonly",
|
|
27
29
|
i
|
|
28
|
-
].filter(Boolean).join(" "),
|
|
29
|
-
let
|
|
30
|
+
].filter(Boolean).join(" "), h = ({ value: h, defaultValue: g, onChange: _, max: v = 5, size: y = "md", disabled: b = !1, allowHalf: x = !1, className: ae, labels: S, "aria-label": C, name: w, invalid: T, required: E, label: D, help: O, fieldClassName: k, readOnly: A, id: j, "aria-describedby": M, ref: oe, ...N }) => {
|
|
31
|
+
let P = r("rating", f, S), F = n({
|
|
30
32
|
id: j,
|
|
31
|
-
label:
|
|
33
|
+
label: D,
|
|
32
34
|
help: O,
|
|
33
|
-
required:
|
|
34
|
-
invalid:
|
|
35
|
+
required: E,
|
|
36
|
+
invalid: T,
|
|
35
37
|
readOnly: A,
|
|
36
38
|
fieldClassName: k
|
|
37
|
-
}),
|
|
39
|
+
}), I = F.field, L = t(A, I), [R, z] = ie(null), [B, V, , H] = i(h, g ?? 0, _), U = a(oe, ne(H)), W = (_ !== void 0 || h === void 0 && g !== void 0) && !b, G = W && !L, K = e(W ? I : null, {
|
|
38
40
|
id: j,
|
|
39
41
|
describedBy: M,
|
|
40
|
-
invalid:
|
|
41
|
-
required:
|
|
42
|
+
invalid: T,
|
|
43
|
+
required: E,
|
|
42
44
|
labelable: !1,
|
|
43
|
-
ariaLabel:
|
|
44
|
-
}),
|
|
45
|
+
ariaLabel: C
|
|
46
|
+
}), q = C ?? P.rating, J = o(B, v, x), Y = w ? /* @__PURE__ */ l("input", {
|
|
45
47
|
type: "hidden",
|
|
46
|
-
name:
|
|
47
|
-
value:
|
|
48
|
-
disabled:
|
|
49
|
-
}) : null,
|
|
50
|
-
let n = e.currentTarget.getBoundingClientRect(), r =
|
|
51
|
-
return c(t, i,
|
|
52
|
-
},
|
|
53
|
-
if (!
|
|
54
|
-
let t = s(
|
|
55
|
-
t !== null && (e.preventDefault(), t !==
|
|
56
|
-
}, Q =
|
|
48
|
+
name: w,
|
|
49
|
+
value: J,
|
|
50
|
+
disabled: b
|
|
51
|
+
}) : null, se = re(G && R !== null ? R : J, v, x), X = p[y], Z = (e, t) => {
|
|
52
|
+
let n = e.currentTarget.getBoundingClientRect(), r = ee(e.currentTarget) === "rtl" ? n.right - e.clientX : e.clientX - n.left, i = n.width > 0 ? r / n.width : 1;
|
|
53
|
+
return c(t, i, x);
|
|
54
|
+
}, ce = (e) => {
|
|
55
|
+
if (!G) return;
|
|
56
|
+
let t = s(te(e), J, v, x);
|
|
57
|
+
t !== null && (e.preventDefault(), t !== J && V(t));
|
|
58
|
+
}, Q = se.map((e, t) => /* @__PURE__ */ u("span", {
|
|
57
59
|
className: "kapi-rating__star",
|
|
58
60
|
"data-fill": e,
|
|
59
|
-
onMouseMove:
|
|
60
|
-
onClick:
|
|
61
|
+
onMouseMove: G ? (e) => z(Z(e, t)) : void 0,
|
|
62
|
+
onClick: G ? (e) => {
|
|
61
63
|
let n = Z(e, t);
|
|
62
|
-
|
|
64
|
+
V(n === J ? 0 : n);
|
|
63
65
|
} : void 0,
|
|
64
|
-
children: [/* @__PURE__ */
|
|
66
|
+
children: [/* @__PURE__ */ l(d, {
|
|
65
67
|
size: X,
|
|
66
68
|
strokeWidth: 2,
|
|
67
69
|
className: "kapi-rating__base",
|
|
68
70
|
"aria-hidden": "true"
|
|
69
|
-
}), e !== "empty" && /* @__PURE__ */
|
|
71
|
+
}), e !== "empty" && /* @__PURE__ */ l("span", {
|
|
70
72
|
className: "kapi-rating__fill",
|
|
71
73
|
style: { width: e === "half" ? "50%" : "100%" },
|
|
72
|
-
children: /* @__PURE__ */
|
|
74
|
+
children: /* @__PURE__ */ l(d, {
|
|
73
75
|
size: X,
|
|
74
76
|
strokeWidth: 2,
|
|
75
77
|
fill: "currentColor",
|
|
76
78
|
"aria-hidden": "true"
|
|
77
79
|
})
|
|
78
80
|
})]
|
|
79
|
-
}, t)), $ =
|
|
80
|
-
size:
|
|
81
|
-
interactive:
|
|
82
|
-
disabled:
|
|
83
|
-
readOnly:
|
|
84
|
-
className:
|
|
81
|
+
}, t)), $ = m({
|
|
82
|
+
size: y,
|
|
83
|
+
interactive: W,
|
|
84
|
+
disabled: b,
|
|
85
|
+
readOnly: W && L,
|
|
86
|
+
className: ae
|
|
85
87
|
});
|
|
86
|
-
return
|
|
87
|
-
...
|
|
88
|
-
...
|
|
89
|
-
ref:
|
|
88
|
+
return W ? F.wrap(/* @__PURE__ */ u("div", {
|
|
89
|
+
...N,
|
|
90
|
+
...K,
|
|
91
|
+
ref: U,
|
|
90
92
|
className: $,
|
|
91
93
|
role: "slider",
|
|
92
94
|
tabIndex: 0,
|
|
93
|
-
"aria-label":
|
|
95
|
+
"aria-label": K["aria-labelledby"] ? void 0 : q,
|
|
94
96
|
"aria-valuemin": 0,
|
|
95
|
-
"aria-valuemax":
|
|
96
|
-
"aria-valuenow":
|
|
97
|
-
"aria-valuetext": `${
|
|
98
|
-
"aria-readonly":
|
|
99
|
-
onKeyDown:
|
|
100
|
-
onMouseLeave: () =>
|
|
101
|
-
children: [Q,
|
|
102
|
-
})) :
|
|
103
|
-
...
|
|
104
|
-
ref:
|
|
97
|
+
"aria-valuemax": v,
|
|
98
|
+
"aria-valuenow": J,
|
|
99
|
+
"aria-valuetext": `${J} ${P.of} ${v}`,
|
|
100
|
+
"aria-readonly": L || void 0,
|
|
101
|
+
onKeyDown: ce,
|
|
102
|
+
onMouseLeave: () => z(null),
|
|
103
|
+
children: [Q, Y]
|
|
104
|
+
})) : F.wrap(/* @__PURE__ */ u("div", {
|
|
105
|
+
...N,
|
|
106
|
+
ref: U,
|
|
105
107
|
id: j,
|
|
106
108
|
"aria-describedby": M,
|
|
107
109
|
className: $,
|
|
108
110
|
role: "img",
|
|
109
|
-
"aria-label": `${
|
|
110
|
-
children: [Q,
|
|
111
|
+
"aria-label": `${q}: ${J} ${P.of} ${v}`,
|
|
112
|
+
children: [Q, Y]
|
|
111
113
|
}));
|
|
112
114
|
};
|
|
113
115
|
//#endregion
|
|
114
|
-
export {
|
|
116
|
+
export { f as DEFAULT_RATING_LABELS, h as KapiRating, m as ratingClasses };
|
|
@@ -8,99 +8,109 @@ import { useKapiFormatLocale as a } from "../locale/KapiLocaleProvider.js";
|
|
|
8
8
|
import { joinClasses as o } from "../rootProps.js";
|
|
9
9
|
import { useControllableState as s } from "../../hooks/useControllableState.js";
|
|
10
10
|
import { logicalKeyOf as c } from "../../hooks/directionLogic.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
11
|
+
import { useDuplicateValueWarning as l, useMutedControlWarning as ee } from "./misuseWarnings.js";
|
|
12
|
+
import { useFormReset as u } from "../../hooks/useFormReset.js";
|
|
13
|
+
import { useSlidingIndicator as d } from "../../hooks/useSlidingIndicator.js";
|
|
14
|
+
import { formatCount as f } from "../../hooks/numberFormatLogic.js";
|
|
15
|
+
import { KapiTooltip as p } from "../overlays/KapiTooltip.js";
|
|
16
|
+
import { nextRadioIndex as m } from "./segmentedLogic.js";
|
|
17
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
18
|
+
import { useMemo as v } from "react";
|
|
16
19
|
//#region src/components/inputs/KapiSegmented.tsx
|
|
17
|
-
var
|
|
18
|
-
let
|
|
19
|
-
id:
|
|
20
|
-
label:
|
|
21
|
-
help:
|
|
22
|
-
required:
|
|
23
|
-
invalid:
|
|
24
|
-
readOnly:
|
|
25
|
-
fieldClassName:
|
|
26
|
-
}),
|
|
27
|
-
id:
|
|
28
|
-
describedBy:
|
|
29
|
-
invalid:
|
|
30
|
-
required:
|
|
20
|
+
var y = (t) => e(t.activeTone, t.color, void 0), b = ({ items: e, value: b, defaultValue: x, onChange: S, variant: C = "text", "aria-label": w, className: T, name: E, onBlur: D, invalid: O, required: k, label: A, help: j, fieldClassName: M, disabled: N = !1, readOnly: P, size: F = "md", id: I, "aria-describedby": L, ref: R, ...z }) => {
|
|
21
|
+
let B = a(), V = i({
|
|
22
|
+
id: I,
|
|
23
|
+
label: A,
|
|
24
|
+
help: j,
|
|
25
|
+
required: k,
|
|
26
|
+
invalid: O,
|
|
27
|
+
readOnly: P,
|
|
28
|
+
fieldClassName: M
|
|
29
|
+
}), H = r(P, V.field), U = (t) => N || e[t]?.disabled === !0, W = n(V.field, {
|
|
30
|
+
id: I,
|
|
31
|
+
describedBy: L,
|
|
32
|
+
invalid: O,
|
|
33
|
+
required: k,
|
|
31
34
|
labelable: !1,
|
|
32
|
-
ariaLabel:
|
|
33
|
-
}), [
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
ariaLabel: w
|
|
36
|
+
}), [G, K, , q] = s(b, () => x ?? e[0]?.id, S), J = u(q), Y = v(() => e.map((e) => e.id), [e]);
|
|
37
|
+
l("KapiSegmented", Y), ee("KapiSegmented", {
|
|
38
|
+
controlled: b !== void 0,
|
|
39
|
+
hasOnChange: !!S,
|
|
40
|
+
readOnly: H,
|
|
41
|
+
disabled: N
|
|
42
|
+
});
|
|
43
|
+
let X = e.find((e) => e.id === G), { containerRef: Z, indicatorRef: Q } = d({
|
|
44
|
+
active: G ?? null,
|
|
45
|
+
deps: [e, C],
|
|
36
46
|
findActive: (e) => e.querySelector("[role=\"radio\"][aria-checked=\"true\"]")
|
|
37
|
-
}),
|
|
38
|
-
if (
|
|
39
|
-
let n =
|
|
40
|
-
n !== void 0 && r && (t.preventDefault(),
|
|
41
|
-
},
|
|
42
|
-
e.currentTarget.contains(e.relatedTarget) ||
|
|
47
|
+
}), $ = e.findIndex((e) => e.id === G), te = $ >= 0 && !U($) ? $ : e.findIndex((e, t) => !U(t)), ne = (t) => {
|
|
48
|
+
if (H) return;
|
|
49
|
+
let n = m(e.length, $, c(t), U), r = n === void 0 ? void 0 : e[n];
|
|
50
|
+
n !== void 0 && r && (t.preventDefault(), K(r.id), Z.current?.querySelectorAll("[role=\"radio\"]")[n]?.focus());
|
|
51
|
+
}, re = (e) => {
|
|
52
|
+
e.currentTarget.contains(e.relatedTarget) || D?.(e);
|
|
43
53
|
};
|
|
44
|
-
return
|
|
45
|
-
...
|
|
46
|
-
...
|
|
54
|
+
return V.wrap(/* @__PURE__ */ _("div", {
|
|
55
|
+
...z,
|
|
56
|
+
...W,
|
|
47
57
|
ref: (e) => {
|
|
48
|
-
|
|
58
|
+
Z.current = e, J(e), t(R, e);
|
|
49
59
|
},
|
|
50
|
-
className: o("kapi-seg",
|
|
60
|
+
className: o("kapi-seg", F === "sm" && "kapi-seg--sm", H && "kapi-seg--readonly", T),
|
|
51
61
|
role: "radiogroup",
|
|
52
|
-
"aria-label":
|
|
53
|
-
"aria-disabled":
|
|
54
|
-
"aria-readonly":
|
|
55
|
-
onKeyDown:
|
|
56
|
-
onBlur:
|
|
62
|
+
"aria-label": w,
|
|
63
|
+
"aria-disabled": N || void 0,
|
|
64
|
+
"aria-readonly": H || void 0,
|
|
65
|
+
onKeyDown: ne,
|
|
66
|
+
onBlur: re,
|
|
57
67
|
children: [
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
ref:
|
|
68
|
+
/* @__PURE__ */ g("span", {
|
|
69
|
+
ref: Q,
|
|
60
70
|
className: "kapi-seg__indicator",
|
|
61
|
-
"data-color":
|
|
71
|
+
"data-color": X ? y(X) : void 0,
|
|
62
72
|
"aria-hidden": "true"
|
|
63
73
|
}),
|
|
64
74
|
e.map((e, t) => {
|
|
65
|
-
let n =
|
|
75
|
+
let n = G === e.id, r = /* @__PURE__ */ _("button", {
|
|
66
76
|
type: "button",
|
|
67
77
|
role: "radio",
|
|
68
78
|
"aria-checked": n,
|
|
69
|
-
tabIndex: t ===
|
|
70
|
-
"aria-label":
|
|
79
|
+
tabIndex: t === te ? 0 : -1,
|
|
80
|
+
"aria-label": C === "icon" ? e.label : void 0,
|
|
71
81
|
className: `kapi-seg__btn${n ? " is-on" : ""}`,
|
|
72
|
-
"data-color": n ?
|
|
82
|
+
"data-color": n ? y(e) : void 0,
|
|
73
83
|
"data-tone": e.tone,
|
|
74
|
-
disabled:
|
|
84
|
+
disabled: U(t) || void 0,
|
|
75
85
|
onClick: () => {
|
|
76
|
-
|
|
86
|
+
H || K(e.id);
|
|
77
87
|
},
|
|
78
88
|
children: [
|
|
79
|
-
(
|
|
89
|
+
(C === "icon" || C === "both") && e.icon && /* @__PURE__ */ g("span", {
|
|
80
90
|
className: "kapi-seg__ico",
|
|
81
91
|
children: e.icon
|
|
82
92
|
}),
|
|
83
|
-
|
|
84
|
-
e.count != null && /* @__PURE__ */ h
|
|
93
|
+
C !== "icon" && /* @__PURE__ */ g("span", { children: e.label }),
|
|
94
|
+
e.count != null && /* @__PURE__ */ _(h, { children: [" ", /* @__PURE__ */ g("span", {
|
|
85
95
|
className: "kapi-seg__n",
|
|
86
|
-
children:
|
|
96
|
+
children: f(e.count, B)
|
|
87
97
|
})] })
|
|
88
98
|
]
|
|
89
99
|
}, e.id);
|
|
90
|
-
return
|
|
100
|
+
return C === "icon" && e.label ? /* @__PURE__ */ g(p, {
|
|
91
101
|
label: e.label,
|
|
92
102
|
prefer: "top",
|
|
93
103
|
children: r
|
|
94
104
|
}, e.id) : r;
|
|
95
105
|
}),
|
|
96
|
-
|
|
106
|
+
E && /* @__PURE__ */ g("input", {
|
|
97
107
|
type: "hidden",
|
|
98
|
-
name:
|
|
99
|
-
value:
|
|
100
|
-
disabled:
|
|
108
|
+
name: E,
|
|
109
|
+
value: G === void 0 ? "" : String(G),
|
|
110
|
+
disabled: N || void 0
|
|
101
111
|
})
|
|
102
112
|
]
|
|
103
113
|
}));
|
|
104
114
|
};
|
|
105
115
|
//#endregion
|
|
106
|
-
export {
|
|
116
|
+
export { b as KapiSegmented };
|