@kapiuara/ui 0.14.0 → 0.15.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/README.md +234 -1
- package/dist/components/chat/KapiChatList.js +19 -19
- package/dist/components/chat/KapiChatThread.js +23 -23
- package/dist/components/chat/KapiComposer.js +19 -19
- package/dist/components/chat/KapiMessageBubble.js +4 -4
- package/dist/components/chat/KapiTypingIndicator.js +4 -4
- package/dist/components/closeReason.d.ts +34 -0
- package/dist/components/data/KapiBarChart.js +1 -1
- package/dist/components/data/KapiDataTable.js +31 -31
- package/dist/components/data/KapiEventCalendar.js +78 -78
- package/dist/components/data/KapiHeatmap.js +23 -23
- package/dist/components/data/KapiLineChart.js +1 -1
- package/dist/components/data/KapiPagination.js +4 -4
- package/dist/components/data/KapiSparkline.js +1 -1
- package/dist/components/data/KapiTable.js +122 -122
- package/dist/components/data/KapiTableFilter.js +18 -18
- package/dist/components/data/KapiTableRow.js +24 -24
- package/dist/components/data/KapiTableToolbar.js +49 -49
- package/dist/components/data/chartFrame.js +21 -21
- package/dist/components/data/useColumnResize.js +8 -8
- package/dist/components/data/useTableSelection.js +8 -8
- package/dist/components/display/KapiAnnotation.js +53 -53
- package/dist/components/display/KapiComment.js +4 -4
- package/dist/components/display/KapiCommentComposer.js +16 -16
- package/dist/components/display/KapiFileItem.js +6 -6
- package/dist/components/display/KapiFileViewer.js +9 -9
- package/dist/components/display/KapiTruncate.js +7 -7
- package/dist/components/feedback/KapiAlert.d.ts +2 -1
- package/dist/components/feedback/KapiAlert.js +8 -8
- package/dist/components/feedback/KapiCountdown.js +8 -8
- package/dist/components/feedback/KapiFab.js +31 -31
- package/dist/components/feedback/KapiOfflineBanner.js +8 -8
- package/dist/components/feedback/KapiToastContainer.js +21 -21
- package/dist/components/feedback/KapiTour.d.ts +2 -1
- package/dist/components/feedback/KapiTour.js +32 -32
- package/dist/components/inputs/KapiAutocomplete.js +14 -14
- package/dist/components/inputs/KapiButton.d.ts +17 -1
- package/dist/components/inputs/KapiButton.js +41 -25
- package/dist/components/inputs/KapiCalendar.js +5 -5
- package/dist/components/inputs/KapiCalendarGrid.js +10 -10
- package/dist/components/inputs/KapiChecklist.js +71 -71
- package/dist/components/inputs/KapiDatePicker.js +28 -28
- package/dist/components/inputs/KapiDateRangePicker.js +27 -27
- package/dist/components/inputs/KapiFacetedSearch.js +24 -24
- package/dist/components/inputs/KapiField.js +14 -14
- package/dist/components/inputs/KapiFileUpload.js +27 -27
- package/dist/components/inputs/KapiIconButton.d.ts +9 -1
- package/dist/components/inputs/KapiIconButton.js +27 -10
- package/dist/components/inputs/KapiInput.js +21 -21
- package/dist/components/inputs/KapiInputGroup.js +8 -8
- package/dist/components/inputs/KapiMaskedInput.js +22 -22
- package/dist/components/inputs/KapiNumberStepper.js +12 -12
- package/dist/components/inputs/KapiRating.js +1 -1
- package/dist/components/inputs/KapiSearchChip.js +8 -8
- package/dist/components/inputs/KapiSegmented.js +27 -27
- package/dist/components/inputs/KapiSelect.js +166 -166
- package/dist/components/inputs/KapiSelectMenu.js +60 -60
- package/dist/components/inputs/KapiSlider.js +1 -1
- package/dist/components/inputs/KapiSwitch.js +6 -6
- package/dist/components/inputs/KapiTagInput.js +22 -22
- package/dist/components/inputs/KapiTextarea.js +8 -8
- package/dist/components/inputs/ownField.js +4 -4
- package/dist/components/layout/KapiAccountMenu.d.ts +2 -1
- package/dist/components/layout/KapiAccountMenu.js +51 -51
- package/dist/components/layout/KapiContextSlot.js +35 -35
- package/dist/components/layout/KapiMasonry.js +6 -6
- package/dist/components/layout/KapiNotificationBell.js +60 -60
- package/dist/components/layout/KapiPageHeader.js +19 -19
- package/dist/components/layout/KapiRail.js +60 -60
- package/dist/components/layout/KapiRailAccount.js +9 -9
- package/dist/components/layout/KapiRoot.js +21 -21
- package/dist/components/layout/KapiScrollArea.js +11 -11
- package/dist/components/layout/KapiShell.js +12 -12
- package/dist/components/locale/KapiLocaleProvider.js +13 -13
- package/dist/components/navigation/KapiAccordion.js +12 -12
- package/dist/components/navigation/KapiBreadcrumb.js +11 -11
- package/dist/components/navigation/KapiCollapsiblePanel.js +23 -23
- package/dist/components/navigation/KapiContextPanel.js +76 -76
- package/dist/components/navigation/KapiFilterChips.js +9 -9
- package/dist/components/navigation/KapiNavBadge.d.ts +4 -2
- package/dist/components/navigation/KapiNavBadge.js +11 -10
- package/dist/components/navigation/KapiPanelGroup.js +25 -25
- package/dist/components/navigation/KapiSteps.js +4 -4
- package/dist/components/navigation/KapiTabs.d.ts +4 -1
- package/dist/components/navigation/KapiTabs.js +18 -17
- package/dist/components/navigation/KapiTree.js +72 -72
- package/dist/components/navigation/KapiWizard.d.ts +2 -1
- package/dist/components/navigation/KapiWizard.js +30 -30
- package/dist/components/overlays/KapiCanvasForm.d.ts +6 -2
- package/dist/components/overlays/KapiCanvasForm.js +12 -12
- package/dist/components/overlays/KapiCommandPalette.d.ts +2 -1
- package/dist/components/overlays/KapiCommandPalette.js +23 -23
- package/dist/components/overlays/KapiConfirm.d.ts +2 -1
- package/dist/components/overlays/KapiConfirm.js +12 -12
- package/dist/components/overlays/KapiContextMenu.d.ts +2 -1
- package/dist/components/overlays/KapiContextMenu.js +15 -15
- package/dist/components/overlays/KapiDialogHost.js +22 -22
- package/dist/components/overlays/KapiLoading.js +16 -16
- package/dist/components/overlays/KapiMenuButton.js +12 -12
- package/dist/components/overlays/KapiModal.d.ts +2 -1
- package/dist/components/overlays/KapiModal.js +28 -28
- package/dist/components/overlays/KapiOffcanvas.d.ts +3 -2
- package/dist/components/overlays/KapiOffcanvas.js +63 -63
- package/dist/components/overlays/KapiOffcanvasStack.js +38 -38
- package/dist/components/overlays/KapiPhotoView.js +14 -14
- package/dist/components/overlays/KapiPopover.d.ts +2 -1
- package/dist/components/overlays/KapiPopover.js +7 -7
- package/dist/components/overlays/KapiShapeSheet.js +17 -17
- package/dist/components/overlays/KapiSplitModal.js +29 -29
- package/dist/components/overlays/KapiTooltip.js +20 -20
- package/dist/components/overlays/menuList.js +60 -60
- package/dist/components/overlays/useNativeDialog.d.ts +5 -0
- package/dist/components/overlays/useNativeDialog.js +2 -2
- package/dist/components/renderSlot.d.ts +27 -0
- package/dist/components/renderSlot.js +23 -0
- package/dist/hooks/portalRoot.js +6 -6
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -4,11 +4,11 @@ import { fieldControlProps as e, joinIds as t, resolveValidation as n } from "./
|
|
|
4
4
|
import { useOwnField as r } from "./ownField.js";
|
|
5
5
|
import { resolveGroupSize as i } from "./inputGroupLogic.js";
|
|
6
6
|
import { useKapiInputGroup as ee } from "./KapiInputGroup.js";
|
|
7
|
-
import { hasAdornments as
|
|
8
|
-
import { useLabels as
|
|
7
|
+
import { hasAdornments as a, hasValue as o, inputBoxClasses as te, present as s } from "./inputLogic.js";
|
|
8
|
+
import { useLabels as ne } from "../locale/KapiLocaleProvider.js";
|
|
9
9
|
/* empty css */
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useId as re, useRef as c, useState as l } from "react";
|
|
11
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
12
12
|
import { X as f } from "lucide-react";
|
|
13
13
|
//#region src/components/inputs/KapiInput.tsx
|
|
14
14
|
var p = { clear: "Limpiar" }, m = (e) => {
|
|
@@ -20,14 +20,14 @@ var p = { clear: "Limpiar" }, m = (e) => {
|
|
|
20
20
|
t && `kapi-input--${t}`,
|
|
21
21
|
r
|
|
22
22
|
].filter(Boolean).join(" "), g = (g) => {
|
|
23
|
-
let { size: ie, invalid: _, status: v, num: y, label: b, required: x, help: S, fieldClassName: C, className: w, multiline: T, id: ae, startIcon: E, endIcon: D, prefix: O, suffix: k, clearable: A, onClear: j, shortcut: M, labels: N, ref: P, ...F } = g, I = P, { invalid: L, status: R } = n(_, v), z =
|
|
23
|
+
let { size: ie, invalid: _, status: v, num: y, label: b, required: x, help: S, fieldClassName: C, className: w, multiline: T, id: ae, startIcon: E, endIcon: D, prefix: O, suffix: k, clearable: A, onClear: j, shortcut: M, labels: N, ref: P, ...F } = g, I = P, { invalid: L, status: R } = n(_, v), z = ne("input", p, N), B = i(ie, ee()?.size), V = !T && a({
|
|
24
24
|
startIcon: E,
|
|
25
25
|
endIcon: D,
|
|
26
26
|
prefix: O,
|
|
27
27
|
suffix: k,
|
|
28
28
|
clearable: A,
|
|
29
29
|
shortcut: M
|
|
30
|
-
}), H =
|
|
30
|
+
}), H = c(null), U = F, [W, G] = l(() => o(U.defaultValue)), K = r({
|
|
31
31
|
id: ae,
|
|
32
32
|
label: b,
|
|
33
33
|
help: S,
|
|
@@ -35,7 +35,7 @@ var p = { clear: "Limpiar" }, m = (e) => {
|
|
|
35
35
|
invalid: _,
|
|
36
36
|
status: v,
|
|
37
37
|
fieldClassName: C
|
|
38
|
-
}), { controlId: q, helpId: J } = K, Y =
|
|
38
|
+
}), { controlId: q, helpId: J } = K, Y = re(), X = V && s(O) ? `${Y}-prefix` : void 0, Z = V && s(k) ? `${Y}-suffix` : void 0, Q = {
|
|
39
39
|
...e(K.outer, {
|
|
40
40
|
id: q,
|
|
41
41
|
describedBy: t(J, F["aria-describedby"], X, Z),
|
|
@@ -50,15 +50,15 @@ var p = { clear: "Limpiar" }, m = (e) => {
|
|
|
50
50
|
})
|
|
51
51
|
}, oe = (e) => {
|
|
52
52
|
H.current = e, typeof I == "function" ? I(e) : I && (I.current = e);
|
|
53
|
-
}, $ = U.value === void 0 ? W :
|
|
53
|
+
}, $ = U.value === void 0 ? W : o(U.value), se = () => {
|
|
54
54
|
let e = H.current;
|
|
55
55
|
e && (m(e), G(!1), e.focus(), j?.());
|
|
56
|
-
}, ce = T ? /* @__PURE__ */
|
|
56
|
+
}, ce = T ? /* @__PURE__ */ u("textarea", {
|
|
57
57
|
ref: I,
|
|
58
58
|
...F,
|
|
59
59
|
...Q
|
|
60
|
-
}) : V ? /* @__PURE__ */
|
|
61
|
-
className:
|
|
60
|
+
}) : V ? /* @__PURE__ */ d("div", {
|
|
61
|
+
className: te({
|
|
62
62
|
size: B,
|
|
63
63
|
status: R,
|
|
64
64
|
disabled: U.disabled,
|
|
@@ -68,50 +68,50 @@ var p = { clear: "Limpiar" }, m = (e) => {
|
|
|
68
68
|
e.target === H.current || U.disabled || (e.preventDefault(), H.current?.focus());
|
|
69
69
|
},
|
|
70
70
|
children: [
|
|
71
|
-
|
|
71
|
+
s(E) && /* @__PURE__ */ u("span", {
|
|
72
72
|
className: "kapi-inputbox__icon",
|
|
73
73
|
"aria-hidden": "true",
|
|
74
74
|
children: E
|
|
75
75
|
}),
|
|
76
|
-
|
|
76
|
+
s(O) && /* @__PURE__ */ u("span", {
|
|
77
77
|
id: X,
|
|
78
78
|
className: "kapi-inputbox__affix",
|
|
79
79
|
children: O
|
|
80
80
|
}),
|
|
81
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ u("input", {
|
|
82
82
|
ref: oe,
|
|
83
83
|
...U,
|
|
84
84
|
...Q,
|
|
85
85
|
"aria-keyshortcuts": U["aria-keyshortcuts"] ?? (M || void 0),
|
|
86
86
|
onChange: (e) => {
|
|
87
|
-
G(
|
|
87
|
+
G(o(e.target.value)), U.onChange?.(e);
|
|
88
88
|
}
|
|
89
89
|
}),
|
|
90
|
-
|
|
90
|
+
s(k) && /* @__PURE__ */ u("span", {
|
|
91
91
|
id: Z,
|
|
92
92
|
className: "kapi-inputbox__affix",
|
|
93
93
|
children: k
|
|
94
94
|
}),
|
|
95
|
-
A && $ && !U.disabled && !U.readOnly && /* @__PURE__ */
|
|
95
|
+
A && $ && !U.disabled && !U.readOnly && /* @__PURE__ */ u("button", {
|
|
96
96
|
type: "button",
|
|
97
97
|
tabIndex: -1,
|
|
98
98
|
className: "kapi-inputbox__clear",
|
|
99
99
|
"aria-label": z.clear,
|
|
100
100
|
onClick: se,
|
|
101
|
-
children: /* @__PURE__ */
|
|
101
|
+
children: /* @__PURE__ */ u(f, { "aria-hidden": "true" })
|
|
102
102
|
}),
|
|
103
|
-
M && !$ && /* @__PURE__ */
|
|
103
|
+
M && !$ && /* @__PURE__ */ u("kbd", {
|
|
104
104
|
className: "kapi-inputbox__kbd",
|
|
105
105
|
"aria-hidden": "true",
|
|
106
106
|
children: M
|
|
107
107
|
}),
|
|
108
|
-
|
|
108
|
+
s(D) && /* @__PURE__ */ u("span", {
|
|
109
109
|
className: "kapi-inputbox__icon",
|
|
110
110
|
"aria-hidden": "true",
|
|
111
111
|
children: D
|
|
112
112
|
})
|
|
113
113
|
]
|
|
114
|
-
}) : /* @__PURE__ */
|
|
114
|
+
}) : /* @__PURE__ */ u("input", {
|
|
115
115
|
ref: I,
|
|
116
116
|
...U,
|
|
117
117
|
...Q
|
|
@@ -3,18 +3,18 @@ import "#kapi-css/components/inputs/KapiInputGroup.css";
|
|
|
3
3
|
import { resolveValidation as e } from "./fieldLogic.js";
|
|
4
4
|
import { inputGroupAddonClasses as t, inputGroupClasses as n } from "./inputGroupLogic.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { createContext as r, useContext as i, useMemo as a } from "react";
|
|
7
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/inputs/KapiInputGroup.tsx
|
|
9
|
-
var s =
|
|
9
|
+
var s = r(null), c = () => i(s), l = ({ decorative: e = !1, className: n, children: r }) => /* @__PURE__ */ o("span", {
|
|
10
10
|
className: t(n),
|
|
11
11
|
"aria-hidden": e || void 0,
|
|
12
|
-
children:
|
|
13
|
-
}), u = ({ size: t, invalid:
|
|
14
|
-
let { status: d } = e(
|
|
15
|
-
return /* @__PURE__ */
|
|
12
|
+
children: r
|
|
13
|
+
}), u = ({ size: t, invalid: r, status: i, className: c, children: l, ...u }) => {
|
|
14
|
+
let { status: d } = e(r, i), f = a(() => ({ size: t }), [t]);
|
|
15
|
+
return /* @__PURE__ */ o(s.Provider, {
|
|
16
16
|
value: f,
|
|
17
|
-
children: /* @__PURE__ */
|
|
17
|
+
children: /* @__PURE__ */ o("div", {
|
|
18
18
|
...u,
|
|
19
19
|
role: "group",
|
|
20
20
|
className: n({
|
|
@@ -6,16 +6,16 @@ import { useControllableState as r } from "../../hooks/useControllableState.js";
|
|
|
6
6
|
import { activeElementOf as i } from "../../hooks/ownerDocument.js";
|
|
7
7
|
import { useFormReset as a } from "../../hooks/useFormReset.js";
|
|
8
8
|
import { caretForSignificant as o, countSignificant as s, formatCuit as c, formatCurrency as l, formatDni as u, isValidCuit as d, maskCurrencyInput as f, onlyDigits as p, parseCurrency as m } from "./maskLogic.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { useCallback as h, useRef as g, useState as _ } from "react";
|
|
10
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
11
11
|
//#region src/components/inputs/KapiMaskedInput.tsx
|
|
12
|
-
var x = (e, t, n) => e ? /* @__PURE__ */
|
|
12
|
+
var x = (e, t, n) => e ? /* @__PURE__ */ y("input", {
|
|
13
13
|
type: "hidden",
|
|
14
14
|
name: e,
|
|
15
15
|
value: t,
|
|
16
16
|
disabled: n
|
|
17
17
|
}) : null, S = (t, n, r, a) => ({
|
|
18
|
-
setRef:
|
|
18
|
+
setRef: h((t) => {
|
|
19
19
|
e(n, t), a?.(t);
|
|
20
20
|
}, [n, a]),
|
|
21
21
|
apply: (e, n) => {
|
|
@@ -32,27 +32,27 @@ var x = (e, t, n) => e ? /* @__PURE__ */ g("input", {
|
|
|
32
32
|
return u;
|
|
33
33
|
}
|
|
34
34
|
}), C = ({ value: e, defaultValue: t = "", onValueChange: i, onChange: o, ref: s, name: c, disabled: l, placeholder: d = "12.345.678", ...f }) => {
|
|
35
|
-
let [m,
|
|
36
|
-
return /* @__PURE__ */
|
|
35
|
+
let [m, h, , g] = r(e, () => p(t, 8), i), _ = p(m, 8), { setRef: C, apply: w } = S(u, s, 8, a(g));
|
|
36
|
+
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(n, {
|
|
37
37
|
...f,
|
|
38
38
|
ref: C,
|
|
39
39
|
disabled: l,
|
|
40
|
-
value: u(
|
|
40
|
+
value: u(_),
|
|
41
41
|
placeholder: d,
|
|
42
42
|
inputMode: "numeric",
|
|
43
43
|
autoComplete: "off",
|
|
44
44
|
onChange: (e) => {
|
|
45
|
-
let t = p(w(e, u(
|
|
46
|
-
t !==
|
|
45
|
+
let t = p(w(e, u(_)));
|
|
46
|
+
t !== _ && h(t), o?.(e);
|
|
47
47
|
}
|
|
48
|
-
}), x(c,
|
|
49
|
-
}, w = { invalid: "CUIT inválido: revisa el dígito verificador" }, T = ({ value: e, defaultValue: i = "", onValueChange: o, onChange: s, invalidMessage: l, invalid: u, status: f, help: m, label:
|
|
50
|
-
let D = t("cuitInput", w), [O, k, , A] = r(e, () => p(i, 11), o && ((e) => o(e, d(e)))), j = p(O, 11), M = a(A), N = j.length === 11 && !d(j), P = u !== void 0 || f !== void 0, F =
|
|
51
|
-
return /* @__PURE__ */
|
|
48
|
+
}), x(c, _, l)] });
|
|
49
|
+
}, w = { invalid: "CUIT inválido: revisa el dígito verificador" }, T = ({ value: e, defaultValue: i = "", onValueChange: o, onChange: s, invalidMessage: l, invalid: u, status: f, help: m, label: h, ref: g, name: _, disabled: C, placeholder: T = "20-12345678-9", ...E }) => {
|
|
50
|
+
let D = t("cuitInput", w), [O, k, , A] = r(e, () => p(i, 11), o && ((e) => o(e, d(e)))), j = p(O, 11), M = a(A), N = j.length === 11 && !d(j), P = u !== void 0 || f !== void 0, F = h != null || !!m, { setRef: I, apply: L } = S(c, g, 11, M);
|
|
51
|
+
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(n, {
|
|
52
52
|
...E,
|
|
53
53
|
ref: I,
|
|
54
54
|
disabled: C,
|
|
55
|
-
label:
|
|
55
|
+
label: h,
|
|
56
56
|
help: F && N ? l ?? D.invalid : m,
|
|
57
57
|
status: f,
|
|
58
58
|
invalid: P ? u : N || void 0,
|
|
@@ -64,29 +64,29 @@ var x = (e, t, n) => e ? /* @__PURE__ */ g("input", {
|
|
|
64
64
|
let t = p(L(e, c(j)));
|
|
65
65
|
t !== j && k(t), s?.(e);
|
|
66
66
|
}
|
|
67
|
-
}), x(
|
|
67
|
+
}), x(_, j, C)] });
|
|
68
68
|
}, E = ({ value: e, defaultValue: t = null, onValueChange: r, onChange: i, onBlur: o, ref: s, name: c, disabled: u, placeholder: d = "$ 0,00", ...p }) => {
|
|
69
|
-
let [
|
|
70
|
-
e !== void 0 && e !== E && (D(e), e !== m(
|
|
69
|
+
let [h, C] = _(() => l(e === void 0 ? t : e)), w = g(m(h)), T = g(h), [E, D] = _(e);
|
|
70
|
+
e !== void 0 && e !== E && (D(e), e !== m(h) && (C(l(e)), w.current = e));
|
|
71
71
|
let O = a(() => {
|
|
72
72
|
e === void 0 && (C(T.current), w.current = m(T.current));
|
|
73
|
-
}), { setRef: k, apply: A } = S(f, s, void 0, O), j = m(
|
|
74
|
-
return /* @__PURE__ */
|
|
73
|
+
}), { setRef: k, apply: A } = S(f, s, void 0, O), j = m(h);
|
|
74
|
+
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(n, {
|
|
75
75
|
...p,
|
|
76
76
|
ref: k,
|
|
77
77
|
disabled: u,
|
|
78
|
-
value:
|
|
78
|
+
value: h,
|
|
79
79
|
placeholder: d,
|
|
80
80
|
inputMode: "decimal",
|
|
81
81
|
autoComplete: "off",
|
|
82
82
|
onChange: (e) => {
|
|
83
|
-
let t = A(e,
|
|
83
|
+
let t = A(e, h);
|
|
84
84
|
C(t);
|
|
85
85
|
let n = m(t);
|
|
86
86
|
n !== w.current && (w.current = n, r?.(n)), i?.(e);
|
|
87
87
|
},
|
|
88
88
|
onBlur: (e) => {
|
|
89
|
-
C(l(m(
|
|
89
|
+
C(l(m(h))), o?.(e);
|
|
90
90
|
}
|
|
91
91
|
}), x(c, j === null ? "" : String(j), u)] });
|
|
92
92
|
};
|
|
@@ -6,9 +6,9 @@ import { useLabels as a } from "../locale/KapiLocaleProvider.js";
|
|
|
6
6
|
/* empty css */
|
|
7
7
|
import { inputClasses as o } from "./KapiInput.js";
|
|
8
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
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { canDecrement as te, canIncrement as c, clampNumber as l, parseTypedNumber as u, snapToStep as d, stepValue as f } from "./numberStepLogic.js";
|
|
10
|
+
import { useEffect as ne, useState as p } from "react";
|
|
11
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
12
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 = "" } = {}) => [
|
|
@@ -35,8 +35,8 @@ var _ = ({ size: e = "md", className: t = "" } = {}) => [
|
|
|
35
35
|
min: S,
|
|
36
36
|
max: C,
|
|
37
37
|
step: w
|
|
38
|
-
}, [Y, X] =
|
|
39
|
-
|
|
38
|
+
}, [Y, X] = p(null);
|
|
39
|
+
ne(() => X(null), [B]);
|
|
40
40
|
let Z = (e) => {
|
|
41
41
|
let t = l(e, J);
|
|
42
42
|
t !== B && V(t), X(null);
|
|
@@ -47,26 +47,26 @@ var _ = ({ size: e = "md", className: t = "" } = {}) => [
|
|
|
47
47
|
}, $ = (e) => {
|
|
48
48
|
if (q) return;
|
|
49
49
|
let t = Y === null ? null : u(Y), n = t === null ? B : d(t, J);
|
|
50
|
-
Z(
|
|
51
|
-
}, ie = /* @__PURE__ */
|
|
50
|
+
Z(f(n, e, J));
|
|
51
|
+
}, ie = /* @__PURE__ */ h("div", {
|
|
52
52
|
className: _({
|
|
53
53
|
size: T,
|
|
54
54
|
className: n(j, M)
|
|
55
55
|
}),
|
|
56
56
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ m("button", {
|
|
58
58
|
type: "button",
|
|
59
59
|
className: "kapi-stepper__btn",
|
|
60
60
|
"aria-label": z.decrease,
|
|
61
61
|
tabIndex: -1,
|
|
62
62
|
disabled: F || q || !te(B, J),
|
|
63
63
|
onClick: () => $(-1),
|
|
64
|
-
children: /* @__PURE__ */
|
|
64
|
+
children: /* @__PURE__ */ m(g, {
|
|
65
65
|
size: 15,
|
|
66
66
|
strokeWidth: 2.4
|
|
67
67
|
})
|
|
68
68
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ m("input", {
|
|
70
70
|
...R,
|
|
71
71
|
...e(W.outer, {
|
|
72
72
|
id: G,
|
|
@@ -95,14 +95,14 @@ 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__ */ m("button", {
|
|
99
99
|
type: "button",
|
|
100
100
|
className: "kapi-stepper__btn",
|
|
101
101
|
"aria-label": z.increase,
|
|
102
102
|
tabIndex: -1,
|
|
103
103
|
disabled: F || q || !c(B, J),
|
|
104
104
|
onClick: () => $(1),
|
|
105
|
-
children: /* @__PURE__ */
|
|
105
|
+
children: /* @__PURE__ */ m(re, {
|
|
106
106
|
size: 15,
|
|
107
107
|
strokeWidth: 2.4
|
|
108
108
|
})
|
|
@@ -9,8 +9,8 @@ import { directionOf as ee, logicalKeyOf as te } from "../../hooks/directionLogi
|
|
|
9
9
|
import { useFormReset as ne } from "../../hooks/useFormReset.js";
|
|
10
10
|
import { useMergedRefs as a } from "../../hooks/mergeRefs.js";
|
|
11
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
12
|
import { useState as ie } from "react";
|
|
13
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
14
14
|
import { Star as d } from "lucide-react";
|
|
15
15
|
//#region src/components/inputs/KapiRating.tsx
|
|
16
16
|
var f = {
|
|
@@ -5,8 +5,8 @@ import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
|
5
5
|
import { useControllableState as n } from "../../hooks/useControllableState.js";
|
|
6
6
|
import { searchChipClasses as r, searchChipName as i } from "./searchChipLogic.js";
|
|
7
7
|
/* empty css */
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useRef as a } from "react";
|
|
9
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
10
10
|
import { Search as c, X as l } from "lucide-react";
|
|
11
11
|
//#region src/components/inputs/KapiSearchChip.tsx
|
|
12
12
|
var u = {
|
|
@@ -16,7 +16,7 @@ var u = {
|
|
|
16
16
|
}, d = (e) => {
|
|
17
17
|
Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
18
18
|
}, f = ({ value: f, defaultValue: p, onChange: m, onSubmit: h, disabled: g = !1, placeholder: _, "aria-label": v, labels: y, className: b, style: x, ref: S, onKeyDown: C, ...w }) => {
|
|
19
|
-
let T = t("searchChip", u, y), E =
|
|
19
|
+
let T = t("searchChip", u, y), E = a(null), [D, O] = n(f, p ?? ""), k = _ ?? T.placeholder, A = i({
|
|
20
20
|
ariaLabel: v,
|
|
21
21
|
placeholder: k,
|
|
22
22
|
fallback: T.search
|
|
@@ -30,7 +30,7 @@ var u = {
|
|
|
30
30
|
}, F = (e) => {
|
|
31
31
|
C?.(e), !e.defaultPrevented && e.key === "Enter" && h && (e.preventDefault(), h(e.currentTarget.value));
|
|
32
32
|
};
|
|
33
|
-
return /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ s("div", {
|
|
34
34
|
className: r({
|
|
35
35
|
disabled: g,
|
|
36
36
|
className: b
|
|
@@ -38,13 +38,13 @@ var u = {
|
|
|
38
38
|
style: x,
|
|
39
39
|
onMouseDown: P,
|
|
40
40
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ o(c, {
|
|
42
42
|
className: "kapi-searchchip__icon",
|
|
43
43
|
size: 15,
|
|
44
44
|
strokeWidth: 1.9,
|
|
45
45
|
"aria-hidden": "true"
|
|
46
46
|
}),
|
|
47
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ o("input", {
|
|
48
48
|
...w,
|
|
49
49
|
ref: M,
|
|
50
50
|
type: "search",
|
|
@@ -59,12 +59,12 @@ var u = {
|
|
|
59
59
|
},
|
|
60
60
|
onKeyDown: F
|
|
61
61
|
}),
|
|
62
|
-
j && /* @__PURE__ */
|
|
62
|
+
j && /* @__PURE__ */ o("button", {
|
|
63
63
|
type: "button",
|
|
64
64
|
className: "kapi-searchchip__clear",
|
|
65
65
|
"aria-label": T.clear,
|
|
66
66
|
onClick: N,
|
|
67
|
-
children: /* @__PURE__ */
|
|
67
|
+
children: /* @__PURE__ */ o(l, {
|
|
68
68
|
size: 14,
|
|
69
69
|
strokeWidth: 2.2,
|
|
70
70
|
"aria-hidden": "true"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/inputsExtra.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
import { resolveTone as t } from "../tone.js";
|
|
5
|
+
import { assignRef as n, fieldControlProps as r, resolveReadOnly as i } from "./fieldLogic.js";
|
|
6
|
+
import { useOwnField as a } from "./ownField.js";
|
|
7
|
+
import { useKapiFormatLocale as o } from "../locale/KapiLocaleProvider.js";
|
|
7
8
|
/* empty css */
|
|
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
11
|
import { useDuplicateValueWarning as l, useMutedControlWarning as ee } from "./misuseWarnings.js";
|
|
@@ -14,11 +14,11 @@ import { useSlidingIndicator as d } from "../../hooks/useSlidingIndicator.js";
|
|
|
14
14
|
import { formatCount as f } from "../../hooks/numberFormatLogic.js";
|
|
15
15
|
import { KapiTooltip as p } from "../overlays/KapiTooltip.js";
|
|
16
16
|
import { nextRadioIndex as m } from "./segmentedLogic.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
17
|
+
import { useMemo as h } from "react";
|
|
18
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
19
19
|
//#region src/components/inputs/KapiSegmented.tsx
|
|
20
|
-
var y = (
|
|
21
|
-
let B =
|
|
20
|
+
var y = (e) => t(e.activeTone, e.color, void 0), b = ({ items: t, 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 = o(), V = a({
|
|
22
22
|
id: I,
|
|
23
23
|
label: A,
|
|
24
24
|
help: j,
|
|
@@ -26,38 +26,38 @@ var y = (t) => e(t.activeTone, t.color, void 0), b = ({ items: e, value: b, defa
|
|
|
26
26
|
invalid: O,
|
|
27
27
|
readOnly: P,
|
|
28
28
|
fieldClassName: M
|
|
29
|
-
}), H =
|
|
29
|
+
}), H = i(P, V.field), U = (e) => N || t[e]?.disabled === !0, W = r(V.field, {
|
|
30
30
|
id: I,
|
|
31
31
|
describedBy: L,
|
|
32
32
|
invalid: O,
|
|
33
33
|
required: k,
|
|
34
34
|
labelable: !1,
|
|
35
35
|
ariaLabel: w
|
|
36
|
-
}), [G, K, , q] = s(b, () => x ??
|
|
36
|
+
}), [G, K, , q] = s(b, () => x ?? t[0]?.id, S), J = u(q), Y = h(() => t.map((e) => e.id), [t]);
|
|
37
37
|
l("KapiSegmented", Y), ee("KapiSegmented", {
|
|
38
38
|
controlled: b !== void 0,
|
|
39
39
|
hasOnChange: !!S,
|
|
40
40
|
readOnly: H,
|
|
41
41
|
disabled: N
|
|
42
42
|
});
|
|
43
|
-
let X =
|
|
43
|
+
let X = t.find((e) => e.id === G), { containerRef: Z, indicatorRef: Q } = d({
|
|
44
44
|
active: G ?? null,
|
|
45
|
-
deps: [
|
|
45
|
+
deps: [t, C],
|
|
46
46
|
findActive: (e) => e.querySelector("[role=\"radio\"][aria-checked=\"true\"]")
|
|
47
|
-
}), $ =
|
|
47
|
+
}), $ = t.findIndex((e) => e.id === G), te = $ >= 0 && !U($) ? $ : t.findIndex((e, t) => !U(t)), ne = (e) => {
|
|
48
48
|
if (H) return;
|
|
49
|
-
let n = m(
|
|
50
|
-
n !== void 0 && r && (
|
|
49
|
+
let n = m(t.length, $, c(e), U), r = n === void 0 ? void 0 : t[n];
|
|
50
|
+
n !== void 0 && r && (e.preventDefault(), K(r.id), Z.current?.querySelectorAll("[role=\"radio\"]")[n]?.focus());
|
|
51
51
|
}, re = (e) => {
|
|
52
52
|
e.currentTarget.contains(e.relatedTarget) || D?.(e);
|
|
53
53
|
};
|
|
54
|
-
return V.wrap(/* @__PURE__ */
|
|
54
|
+
return V.wrap(/* @__PURE__ */ v("div", {
|
|
55
55
|
...z,
|
|
56
56
|
...W,
|
|
57
57
|
ref: (e) => {
|
|
58
|
-
Z.current = e, J(e),
|
|
58
|
+
Z.current = e, J(e), n(R, e);
|
|
59
59
|
},
|
|
60
|
-
className:
|
|
60
|
+
className: e("kapi-seg", F === "sm" && "kapi-seg--sm", H && "kapi-seg--readonly", T),
|
|
61
61
|
role: "radiogroup",
|
|
62
62
|
"aria-label": w,
|
|
63
63
|
"aria-disabled": N || void 0,
|
|
@@ -65,14 +65,14 @@ var y = (t) => e(t.activeTone, t.color, void 0), b = ({ items: e, value: b, defa
|
|
|
65
65
|
onKeyDown: ne,
|
|
66
66
|
onBlur: re,
|
|
67
67
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ _("span", {
|
|
69
69
|
ref: Q,
|
|
70
70
|
className: "kapi-seg__indicator",
|
|
71
71
|
"data-color": X ? y(X) : void 0,
|
|
72
72
|
"aria-hidden": "true"
|
|
73
73
|
}),
|
|
74
|
-
|
|
75
|
-
let n = G === e.id, r = /* @__PURE__ */
|
|
74
|
+
t.map((e, t) => {
|
|
75
|
+
let n = G === e.id, r = /* @__PURE__ */ v("button", {
|
|
76
76
|
type: "button",
|
|
77
77
|
role: "radio",
|
|
78
78
|
"aria-checked": n,
|
|
@@ -86,24 +86,24 @@ var y = (t) => e(t.activeTone, t.color, void 0), b = ({ items: e, value: b, defa
|
|
|
86
86
|
H || K(e.id);
|
|
87
87
|
},
|
|
88
88
|
children: [
|
|
89
|
-
(C === "icon" || C === "both") && e.icon && /* @__PURE__ */
|
|
89
|
+
(C === "icon" || C === "both") && e.icon && /* @__PURE__ */ _("span", {
|
|
90
90
|
className: "kapi-seg__ico",
|
|
91
91
|
children: e.icon
|
|
92
92
|
}),
|
|
93
|
-
C !== "icon" && /* @__PURE__ */
|
|
94
|
-
e.count != null && /* @__PURE__ */
|
|
93
|
+
C !== "icon" && /* @__PURE__ */ _("span", { children: e.label }),
|
|
94
|
+
e.count != null && /* @__PURE__ */ v(g, { children: [" ", /* @__PURE__ */ _("span", {
|
|
95
95
|
className: "kapi-seg__n",
|
|
96
96
|
children: f(e.count, B)
|
|
97
97
|
})] })
|
|
98
98
|
]
|
|
99
99
|
}, e.id);
|
|
100
|
-
return C === "icon" && e.label ? /* @__PURE__ */
|
|
100
|
+
return C === "icon" && e.label ? /* @__PURE__ */ _(p, {
|
|
101
101
|
label: e.label,
|
|
102
102
|
prefer: "top",
|
|
103
103
|
children: r
|
|
104
104
|
}, e.id) : r;
|
|
105
105
|
}),
|
|
106
|
-
E && /* @__PURE__ */
|
|
106
|
+
E && /* @__PURE__ */ _("input", {
|
|
107
107
|
type: "hidden",
|
|
108
108
|
name: E,
|
|
109
109
|
value: G === void 0 ? "" : String(G),
|