@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
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { flattenMenuRows as e } from "./selectLogic.js";
|
|
3
3
|
import { useVirtualList as t } from "../../hooks/useVirtualList.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { memo as n, useCallback as r, useLayoutEffect as i, useMemo as a, useRef as o } from "react";
|
|
5
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
6
|
import { Check as l } from "lucide-react";
|
|
7
7
|
import { createPortal as u } from "react-dom";
|
|
8
8
|
//#region src/components/inputs/KapiSelectMenu.tsx
|
|
9
|
-
var d = 38, f = 264, p = 4, m =
|
|
10
|
-
id:
|
|
9
|
+
var d = 38, f = 264, p = 4, m = n(({ option: e, index: t, id: n, selected: r, active: i, create: a, vindex: o, setSize: u, renderOption: d, query: f, onHover: p, onChoose: m }) => /* @__PURE__ */ c("li", {
|
|
10
|
+
id: n,
|
|
11
11
|
role: "option",
|
|
12
|
-
"aria-selected":
|
|
12
|
+
"aria-selected": r,
|
|
13
13
|
"aria-disabled": e.disabled || void 0,
|
|
14
14
|
"data-kapisel-index": t,
|
|
15
|
-
"data-vindex":
|
|
16
|
-
"aria-setsize":
|
|
17
|
-
"aria-posinset":
|
|
15
|
+
"data-vindex": o,
|
|
16
|
+
"aria-setsize": o === void 0 ? void 0 : u,
|
|
17
|
+
"aria-posinset": o === void 0 ? void 0 : t + 1,
|
|
18
18
|
className: [
|
|
19
19
|
"kapisel__opt",
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
i && "kapisel__opt--active",
|
|
21
|
+
r && "kapisel__opt--selected",
|
|
22
|
+
a && "kapisel__opt--create",
|
|
23
23
|
e.disabled && "kapisel__opt--disabled"
|
|
24
24
|
].filter(Boolean).join(" "),
|
|
25
25
|
onMouseMove: () => {
|
|
26
|
-
!e.disabled && !
|
|
26
|
+
!e.disabled && !i && p(t);
|
|
27
27
|
},
|
|
28
28
|
onClick: (t) => m(e, t.shiftKey),
|
|
29
|
-
children: [/* @__PURE__ */
|
|
29
|
+
children: [/* @__PURE__ */ s("span", {
|
|
30
30
|
className: "kapisel__opt-body",
|
|
31
|
-
children: d && !
|
|
32
|
-
selected:
|
|
33
|
-
active:
|
|
31
|
+
children: d && !a ? d(e, {
|
|
32
|
+
selected: r,
|
|
33
|
+
active: i,
|
|
34
34
|
disabled: e.disabled === !0,
|
|
35
35
|
query: f
|
|
36
36
|
}) : e.label
|
|
37
|
-
}),
|
|
37
|
+
}), r && /* @__PURE__ */ s(l, {
|
|
38
38
|
className: "kapisel__check",
|
|
39
39
|
size: 15,
|
|
40
40
|
strokeWidth: 2.4,
|
|
41
41
|
"aria-hidden": "true"
|
|
42
42
|
})]
|
|
43
|
-
})), h = ({ root:
|
|
44
|
-
let F =
|
|
43
|
+
})), h = ({ root: n, ref: l, side: h, hug: g, style: _, listboxId: v, optionId: y, multiple: b, "aria-label": x, rows: S, createRow: C, createIndex: w, loading: T, empty: E, message: D, active: O, values: k, renderOption: A, query: j, virtual: M, onHover: N, onChoose: P }) => {
|
|
44
|
+
let F = o(null), I = a(() => M ? e(S, C, w) : null, [
|
|
45
45
|
M,
|
|
46
46
|
S,
|
|
47
47
|
C,
|
|
48
48
|
w
|
|
49
|
-
]), L =
|
|
49
|
+
]), L = a(() => I?.rows.map((e) => e.key), [I]), R = t({
|
|
50
50
|
enabled: M && !T,
|
|
51
51
|
count: I?.rows.length ?? 0,
|
|
52
52
|
scrollRef: F,
|
|
@@ -56,42 +56,42 @@ var d = 38, f = 264, p = 4, m = i(({ option: e, index: t, id: i, selected: a, ac
|
|
|
56
56
|
overscan: p,
|
|
57
57
|
fallbackViewHeight: f
|
|
58
58
|
}), { scrollToIndex: z } = R, B = O >= 0 ? I?.rowOf[O] : void 0;
|
|
59
|
-
|
|
59
|
+
i(() => {
|
|
60
60
|
B !== void 0 && z(B);
|
|
61
61
|
}, [B, z]);
|
|
62
|
-
let V =
|
|
62
|
+
let V = a(() => new Set(k), [k]), H = o({
|
|
63
63
|
onHover: N,
|
|
64
64
|
onChoose: P
|
|
65
65
|
});
|
|
66
|
-
|
|
66
|
+
i(() => {
|
|
67
67
|
H.current = {
|
|
68
68
|
onHover: N,
|
|
69
69
|
onChoose: P
|
|
70
70
|
};
|
|
71
71
|
});
|
|
72
|
-
let U =
|
|
73
|
-
let
|
|
74
|
-
return /* @__PURE__ */
|
|
72
|
+
let U = r((e) => H.current.onHover(e), []), W = r((e, t) => H.current.onChoose(e, t), []), G = w + 1, K = ({ option: e, index: t }, n) => {
|
|
73
|
+
let r = e === C, i = A && !r ? A : void 0;
|
|
74
|
+
return /* @__PURE__ */ s(m, {
|
|
75
75
|
option: e,
|
|
76
76
|
index: t,
|
|
77
77
|
id: y(t),
|
|
78
78
|
selected: V.has(e.value),
|
|
79
79
|
active: t === O,
|
|
80
|
-
create:
|
|
81
|
-
vindex:
|
|
82
|
-
setSize:
|
|
83
|
-
renderOption:
|
|
84
|
-
query:
|
|
80
|
+
create: r,
|
|
81
|
+
vindex: n,
|
|
82
|
+
setSize: n === void 0 ? void 0 : G,
|
|
83
|
+
renderOption: i,
|
|
84
|
+
query: i ? j : "",
|
|
85
85
|
onHover: U,
|
|
86
86
|
onChoose: W
|
|
87
87
|
}, `${e.value}-${t}`);
|
|
88
88
|
};
|
|
89
|
-
return u(/* @__PURE__ */
|
|
89
|
+
return u(/* @__PURE__ */ c("div", {
|
|
90
90
|
ref: l,
|
|
91
91
|
className: `kapisel__menu kapisel__menu--${h}${g ? " kapisel__menu--hug" : ""}`,
|
|
92
92
|
style: _,
|
|
93
93
|
onMouseDown: (e) => e.preventDefault(),
|
|
94
|
-
children: [/* @__PURE__ */
|
|
94
|
+
children: [/* @__PURE__ */ c("ul", {
|
|
95
95
|
id: v,
|
|
96
96
|
role: "listbox",
|
|
97
97
|
"aria-multiselectable": b || void 0,
|
|
@@ -101,55 +101,55 @@ var d = 38, f = 264, p = 4, m = i(({ option: e, index: t, id: i, selected: a, ac
|
|
|
101
101
|
ref: F,
|
|
102
102
|
onScroll: M ? R.onScroll : void 0,
|
|
103
103
|
children: [
|
|
104
|
-
!T && I && ((e, t,
|
|
105
|
-
let
|
|
106
|
-
|
|
104
|
+
!T && I && ((e, t, n, r, i) => {
|
|
105
|
+
let a = [];
|
|
106
|
+
r > 0 && a.push(/* @__PURE__ */ s("li", {
|
|
107
107
|
role: "presentation",
|
|
108
108
|
"aria-hidden": !0,
|
|
109
|
-
style: { height:
|
|
109
|
+
style: { height: r }
|
|
110
110
|
}, "pad-top"));
|
|
111
|
-
let
|
|
112
|
-
for (;
|
|
113
|
-
let t = e[
|
|
111
|
+
let o = t;
|
|
112
|
+
for (; o < n;) {
|
|
113
|
+
let t = e[o];
|
|
114
114
|
if (t.group === null) {
|
|
115
|
-
t.kind === "option" &&
|
|
115
|
+
t.kind === "option" && a.push(K(t.item, o)), o += 1;
|
|
116
116
|
continue;
|
|
117
117
|
}
|
|
118
|
-
let
|
|
119
|
-
for (;
|
|
120
|
-
let t = e[
|
|
121
|
-
t.kind === "header" ?
|
|
118
|
+
let r = t.group, i = null, l = [];
|
|
119
|
+
for (; o < n && e[o].group?.key === r.key;) {
|
|
120
|
+
let t = e[o];
|
|
121
|
+
t.kind === "header" ? i = /* @__PURE__ */ s("div", {
|
|
122
122
|
className: "kapisel__group-label",
|
|
123
123
|
"aria-hidden": "true",
|
|
124
|
-
"data-vindex":
|
|
125
|
-
children:
|
|
126
|
-
}, "h") : l.push(K(t.item,
|
|
124
|
+
"data-vindex": o,
|
|
125
|
+
children: r.label
|
|
126
|
+
}, "h") : l.push(K(t.item, o)), o += 1;
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
a.push(/* @__PURE__ */ c("li", {
|
|
129
129
|
role: "presentation",
|
|
130
130
|
className: "kapisel__group",
|
|
131
|
-
children: [
|
|
131
|
+
children: [i, l.length > 0 && /* @__PURE__ */ s("ul", {
|
|
132
132
|
role: "group",
|
|
133
|
-
"aria-label":
|
|
133
|
+
"aria-label": r.label,
|
|
134
134
|
className: "kapisel__group-list",
|
|
135
135
|
children: l
|
|
136
136
|
})]
|
|
137
|
-
},
|
|
137
|
+
}, r.key));
|
|
138
138
|
}
|
|
139
|
-
return
|
|
139
|
+
return i > 0 && a.push(/* @__PURE__ */ s("li", {
|
|
140
140
|
role: "presentation",
|
|
141
141
|
"aria-hidden": !0,
|
|
142
|
-
style: { height:
|
|
143
|
-
}, "pad-bottom")),
|
|
142
|
+
style: { height: i }
|
|
143
|
+
}, "pad-bottom")), a;
|
|
144
144
|
})(I.rows, R.start, R.end, R.padTop, R.padBottom),
|
|
145
|
-
!T && !I && S.map((e) => e.kind === "option" ? K(e.item) : /* @__PURE__ */
|
|
145
|
+
!T && !I && S.map((e) => e.kind === "option" ? K(e.item) : /* @__PURE__ */ c("li", {
|
|
146
146
|
role: "presentation",
|
|
147
147
|
className: "kapisel__group",
|
|
148
|
-
children: [/* @__PURE__ */
|
|
148
|
+
children: [/* @__PURE__ */ s("div", {
|
|
149
149
|
className: "kapisel__group-label",
|
|
150
150
|
"aria-hidden": "true",
|
|
151
151
|
children: e.label
|
|
152
|
-
}), /* @__PURE__ */
|
|
152
|
+
}), /* @__PURE__ */ s("ul", {
|
|
153
153
|
role: "group",
|
|
154
154
|
"aria-label": e.label,
|
|
155
155
|
className: "kapisel__group-list",
|
|
@@ -161,13 +161,13 @@ var d = 38, f = 264, p = 4, m = i(({ option: e, index: t, id: i, selected: a, ac
|
|
|
161
161
|
index: w
|
|
162
162
|
})
|
|
163
163
|
]
|
|
164
|
-
}), D != null && D !== !1 && D !== "" && /* @__PURE__ */
|
|
164
|
+
}), D != null && D !== !1 && D !== "" && /* @__PURE__ */ s("div", {
|
|
165
165
|
className: "kapisel__status",
|
|
166
166
|
role: "status",
|
|
167
167
|
"aria-live": "polite",
|
|
168
168
|
children: D
|
|
169
169
|
})]
|
|
170
|
-
}),
|
|
170
|
+
}), n);
|
|
171
171
|
};
|
|
172
172
|
//#endregion
|
|
173
173
|
export { h as KapiSelectMenu };
|
|
@@ -5,8 +5,8 @@ import { useOwnField as r } from "./ownField.js";
|
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { useControllableState as i } from "../../hooks/useControllableState.js";
|
|
7
7
|
import { clampToStep as a, percentOf as o } from "./sliderLogic.js";
|
|
8
|
-
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
8
|
import "react";
|
|
9
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/inputs/KapiSlider.tsx
|
|
11
11
|
var l = ({ tone: e = "primary", disabled: t = !1, readOnly: n = !1, className: r = "" } = {}) => [
|
|
12
12
|
"kapi-slider",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/checkControl.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
import { nativeFieldProps as t } from "./fieldLogic.js";
|
|
5
|
+
import { useKapiField as n } from "./KapiField.js";
|
|
5
6
|
/* empty css */
|
|
6
|
-
import { joinClasses as n } from "../rootProps.js";
|
|
7
7
|
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/inputs/KapiSwitch.tsx
|
|
9
9
|
var o = ({ label: o, className: s, ref: c, invalid: l, id: u, required: d, "aria-describedby": f, "aria-invalid": p, "aria-required": m, ...h }) => {
|
|
10
|
-
let g =
|
|
10
|
+
let g = t(n(), {
|
|
11
11
|
id: u,
|
|
12
12
|
describedBy: f,
|
|
13
13
|
invalid: l,
|
|
@@ -23,10 +23,10 @@ var o = ({ label: o, className: s, ref: c, invalid: l, id: u, required: d, "aria
|
|
|
23
23
|
required: d
|
|
24
24
|
}), /* @__PURE__ */ i("span", { className: "kapi-switch__track" })] });
|
|
25
25
|
return o == null ? /* @__PURE__ */ i("label", {
|
|
26
|
-
className:
|
|
26
|
+
className: e("kapi-switch", s),
|
|
27
27
|
children: _
|
|
28
28
|
}) : /* @__PURE__ */ a("label", {
|
|
29
|
-
className:
|
|
29
|
+
className: e("kapi-switchfield", s),
|
|
30
30
|
children: [/* @__PURE__ */ i("span", {
|
|
31
31
|
className: "kapi-switch",
|
|
32
32
|
children: _
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/KapiTagInput.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
import { assignRef as t, fieldControlProps as n, focusLeaves as r, joinIds as i, resolveReadOnly as a } from "./fieldLogic.js";
|
|
5
|
+
import { useOwnField as o } from "./ownField.js";
|
|
6
|
+
import { useLabels as s } from "../locale/KapiLocaleProvider.js";
|
|
7
7
|
import { useControllableState as ee } from "../../hooks/useControllableState.js";
|
|
8
8
|
import { useFormReset as te } from "../../hooks/useFormReset.js";
|
|
9
9
|
import { useMergedRefs as ne } from "../../hooks/mergeRefs.js";
|
|
10
10
|
/* empty css */
|
|
11
11
|
import { addTags as re, hasSeparator as c, removeTagAt as l, spliceText as u, splitDraft as d, splitTags as f } from "./tagInputLogic.js";
|
|
12
12
|
import { KapiTag as ie } from "../display/KapiTag.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { useCallback as ae, useId as oe, useRef as p, useState as m } from "react";
|
|
14
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
15
15
|
//#region src/components/inputs/KapiTagInput.tsx
|
|
16
16
|
var _ = {
|
|
17
17
|
remove: "Quitar",
|
|
18
18
|
duplicate: "Ya está en la lista:",
|
|
19
19
|
max: "Llegaste al máximo de"
|
|
20
|
-
}, v = ({ size:
|
|
21
|
-
function y({ value:
|
|
22
|
-
let R =
|
|
20
|
+
}, v = ({ size: t = "md", invalid: n, disabled: r, readOnly: i, className: a }) => e("kapi-taginput", t !== "md" && `kapi-taginput--${t}`, n && "kapi-taginput--err", r && "kapi-taginput--disabled", i && "kapi-taginput--readonly", a);
|
|
21
|
+
function y({ value: e, defaultValue: y = [], onChange: b, validate: se, maxTags: x, allowDuplicates: ce, caseSensitive: le, placeholder: ue, disabled: S = !1, size: C = "md", name: w, id: T, invalid: E, required: D, label: de, help: fe, fieldClassName: pe, readOnly: O, "aria-label": k, "aria-labelledby": A, "aria-describedby": j, onBlur: M, ref: N, labels: P, className: F, onClick: I, ...L }) {
|
|
22
|
+
let R = s("tagInput", _, P), z = o({
|
|
23
23
|
id: T,
|
|
24
24
|
label: de,
|
|
25
25
|
help: fe,
|
|
@@ -27,8 +27,8 @@ function y({ value: s, defaultValue: y = [], onChange: b, validate: se, maxTags:
|
|
|
27
27
|
invalid: E,
|
|
28
28
|
readOnly: O,
|
|
29
29
|
fieldClassName: pe
|
|
30
|
-
}), B = z.field, V =
|
|
31
|
-
X.current =
|
|
30
|
+
}), B = z.field, V = a(O, B), H = oe(), [U, W, , me] = ee(e, y, b), [G, K] = m(""), [q, J] = m(null), Y = p(null), he = ne(Y, te(me)), X = p(null), ge = ae((e) => {
|
|
31
|
+
X.current = e, t(N, e);
|
|
32
32
|
}, [N]), _e = (e) => e.reason === "invalid" ? e.message : e.reason === "duplicate" ? `${R.duplicate} ${e.tag}` : `${R.max} ${x}`, Z = (e, t = "") => {
|
|
33
33
|
let { values: n, rejected: r } = re(U, e, {
|
|
34
34
|
validate: se,
|
|
@@ -55,13 +55,13 @@ function y({ value: s, defaultValue: y = [], onChange: b, validate: se, maxTags:
|
|
|
55
55
|
let n = e.currentTarget, r = u(G, n.selectionStart ?? G.length, n.selectionEnd ?? G.length, t);
|
|
56
56
|
Z(f(r));
|
|
57
57
|
}, be = (e) => {
|
|
58
|
-
|
|
58
|
+
r(e.relatedTarget, Y.current) && (G.trim() && !V && Z(f(G)), M?.(e));
|
|
59
59
|
}, xe = (e) => {
|
|
60
60
|
I?.(e), !(e.defaultPrevented || S) && (e.target.closest("button, input") || X.current?.focus());
|
|
61
61
|
}, Se = (e) => {
|
|
62
62
|
J(null), W(l(U, e)), X.current?.focus();
|
|
63
63
|
}, $ = q !== null || (E ?? B?.invalid ?? !1);
|
|
64
|
-
return z.wrap(/* @__PURE__ */
|
|
64
|
+
return z.wrap(/* @__PURE__ */ g("div", {
|
|
65
65
|
...L,
|
|
66
66
|
ref: he,
|
|
67
67
|
className: v({
|
|
@@ -74,13 +74,13 @@ function y({ value: s, defaultValue: y = [], onChange: b, validate: se, maxTags:
|
|
|
74
74
|
onClick: xe,
|
|
75
75
|
onBlur: be,
|
|
76
76
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ g("div", {
|
|
78
78
|
className: "kapi-taginput__box",
|
|
79
|
-
children: [U.length > 0 && /* @__PURE__ */
|
|
79
|
+
children: [U.length > 0 && /* @__PURE__ */ h("ul", {
|
|
80
80
|
className: "kapi-taginput__tags",
|
|
81
|
-
children: U.map((e, t) => /* @__PURE__ */
|
|
81
|
+
children: U.map((e, t) => /* @__PURE__ */ h("li", {
|
|
82
82
|
className: "kapi-taginput__item",
|
|
83
|
-
children: /* @__PURE__ */
|
|
83
|
+
children: /* @__PURE__ */ h(ie, {
|
|
84
84
|
tone: "primary",
|
|
85
85
|
size: C === "sm" ? "sm" : "md",
|
|
86
86
|
onRemove: S || V ? void 0 : () => Se(t),
|
|
@@ -88,13 +88,13 @@ function y({ value: s, defaultValue: y = [], onChange: b, validate: se, maxTags:
|
|
|
88
88
|
children: e
|
|
89
89
|
})
|
|
90
90
|
}, `${t}-${e}`))
|
|
91
|
-
}), /* @__PURE__ */
|
|
91
|
+
}), /* @__PURE__ */ h("input", {
|
|
92
92
|
ref: ge,
|
|
93
93
|
type: "text",
|
|
94
94
|
className: "kapi-taginput__input",
|
|
95
|
-
...
|
|
95
|
+
...n(B, {
|
|
96
96
|
id: T,
|
|
97
|
-
describedBy:
|
|
97
|
+
describedBy: i(q !== null && H, j),
|
|
98
98
|
invalid: $,
|
|
99
99
|
required: D
|
|
100
100
|
}),
|
|
@@ -110,13 +110,13 @@ function y({ value: s, defaultValue: y = [], onChange: b, validate: se, maxTags:
|
|
|
110
110
|
onPaste: ye
|
|
111
111
|
})]
|
|
112
112
|
}),
|
|
113
|
-
q !== null && /* @__PURE__ */
|
|
113
|
+
q !== null && /* @__PURE__ */ h("span", {
|
|
114
114
|
id: H,
|
|
115
115
|
className: "kapi-taginput__error",
|
|
116
116
|
role: "alert",
|
|
117
117
|
children: q
|
|
118
118
|
}),
|
|
119
|
-
w && U.map((e, t) => /* @__PURE__ */
|
|
119
|
+
w && U.map((e, t) => /* @__PURE__ */ h("input", {
|
|
120
120
|
type: "hidden",
|
|
121
121
|
name: w,
|
|
122
122
|
value: e
|
|
@@ -7,8 +7,8 @@ import { inputClasses as i } from "./KapiInput.js";
|
|
|
7
7
|
import { computedStyleOf as a } from "../../hooks/ownerDocument.js";
|
|
8
8
|
import { rafThrottle as o } from "../../hooks/rafThrottle.js";
|
|
9
9
|
import { autosizeHeight as s, rowsToHeight as c } from "./textareaLogic.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useCallback as l, useEffect as u, useLayoutEffect as d, useRef as f } from "react";
|
|
11
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
12
12
|
//#region src/components/inputs/KapiTextarea.tsx
|
|
13
13
|
var m = ({ status: e, autosize: t = !1, className: n = "" } = {}) => i({
|
|
14
14
|
status: e,
|
|
@@ -26,9 +26,9 @@ var m = ({ status: e, autosize: t = !1, className: n = "" } = {}) => i({
|
|
|
26
26
|
invalid: i,
|
|
27
27
|
status: h,
|
|
28
28
|
fieldClassName: y
|
|
29
|
-
}), { controlId: j, helpId: M } = A, N =
|
|
29
|
+
}), { controlId: j, helpId: M } = A, N = f(null), P = l((e) => {
|
|
30
30
|
N.current = e, typeof E == "function" ? E(e) : E && (E.current = e);
|
|
31
|
-
}, [E]), F =
|
|
31
|
+
}, [E]), F = f(null), I = l(() => {
|
|
32
32
|
let e = N.current;
|
|
33
33
|
if (!e || !b) return;
|
|
34
34
|
let t = a(e), n = (e) => parseFloat(e) || 0;
|
|
@@ -45,11 +45,11 @@ var m = ({ status: e, autosize: t = !1, className: n = "" } = {}) => i({
|
|
|
45
45
|
x,
|
|
46
46
|
w
|
|
47
47
|
]), L = D.value;
|
|
48
|
-
|
|
48
|
+
d(() => {
|
|
49
49
|
I();
|
|
50
50
|
}, [I, L]);
|
|
51
|
-
let R =
|
|
52
|
-
R.current = I,
|
|
51
|
+
let R = f(I);
|
|
52
|
+
R.current = I, u(() => {
|
|
53
53
|
let e = N.current;
|
|
54
54
|
if (!e || !b || typeof ResizeObserver > "u") return;
|
|
55
55
|
let t = null, n = o(() => R.current()), r = new ResizeObserver((e) => {
|
|
@@ -66,7 +66,7 @@ var m = ({ status: e, autosize: t = !1, className: n = "" } = {}) => i({
|
|
|
66
66
|
}, [b]);
|
|
67
67
|
let z = (e) => {
|
|
68
68
|
I(), T?.(e);
|
|
69
|
-
}, B = /* @__PURE__ */
|
|
69
|
+
}, B = /* @__PURE__ */ p("textarea", {
|
|
70
70
|
...D,
|
|
71
71
|
ref: P,
|
|
72
72
|
...e(A.outer, {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { fieldContextValue as e, resolveValidation as t } from "./fieldLogic.js";
|
|
3
3
|
import { KapiField as n, useKapiField as r } from "./KapiField.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useId as i } from "react";
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/inputs/ownField.tsx
|
|
7
7
|
var o = ({ id: o, label: s, help: c, required: l, invalid: u, status: d, readOnly: f, fieldClassName: p }) => {
|
|
8
|
-
let m = r(), h =
|
|
8
|
+
let m = r(), h = i(), g = s != null || !!c, _ = o ?? (g ? h : m?.controlId), v = c ? `${_}-help` : void 0, { status: y } = t(u, d);
|
|
9
9
|
return {
|
|
10
10
|
wraps: g,
|
|
11
11
|
field: g ? e({
|
|
@@ -20,7 +20,7 @@ var o = ({ id: o, label: s, help: c, required: l, invalid: u, status: d, readOnl
|
|
|
20
20
|
controlId: _,
|
|
21
21
|
autoId: h,
|
|
22
22
|
helpId: v,
|
|
23
|
-
wrap: (e) => g ? /* @__PURE__ */
|
|
23
|
+
wrap: (e) => g ? /* @__PURE__ */ a(n, {
|
|
24
24
|
label: s,
|
|
25
25
|
htmlFor: _,
|
|
26
26
|
required: l,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
|
+
import type { KapiCloseReason } from "../closeReason.js";
|
|
2
3
|
import type { KapiMenuItem } from "../overlays/KapiContextMenu.js";
|
|
3
4
|
import { type KapiRootProps } from "../rootProps.js";
|
|
4
5
|
import type { KapiLabelsOverride } from "../labelsLogic.js";
|
|
@@ -16,7 +17,7 @@ export type KapiAccountMenuProps = KapiRootProps<HTMLDivElement> & {
|
|
|
16
17
|
/** Muestra u oculta el menú (controlado). */
|
|
17
18
|
open: boolean;
|
|
18
19
|
/** Pide cerrar el menú (Escape, click afuera o tras elegir una acción); el foco vuelve al disparador. */
|
|
19
|
-
onClose: () => void;
|
|
20
|
+
onClose: (reason: KapiCloseReason) => void;
|
|
20
21
|
/** Usuario de la cabecera: nombre, email, rol e iniciales opcionales. */
|
|
21
22
|
user: KapiAccountMenuUser;
|
|
22
23
|
/** Cantidad de notificaciones sin leer; con 0 o sin valor no se muestra el badge. */
|