@kapiuara/ui 0.13.0 → 0.15.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 +239 -1
- package/dist/components/chat/KapiChatDivider.d.ts +7 -3
- package/dist/components/chat/KapiChatDivider.js +6 -6
- 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/chat/index.d.ts +1 -1
- 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 +55 -55
- 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 +30 -30
- package/dist/components/feedback/KapiOfflineBanner.js +8 -8
- package/dist/components/feedback/KapiToastContainer.js +25 -25
- package/dist/components/feedback/KapiTour.d.ts +2 -1
- package/dist/components/feedback/KapiTour.js +35 -35
- 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 +124 -122
- package/dist/components/inputs/KapiDateRangePicker.js +138 -136
- package/dist/components/inputs/KapiFacetedSearch.js +29 -29
- 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.d.ts +8 -3
- package/dist/components/inputs/KapiMaskedInput.js +64 -51
- package/dist/components/inputs/KapiNumberStepper.js +29 -29
- package/dist/components/inputs/KapiRating.js +61 -59
- package/dist/components/inputs/KapiSearchChip.js +8 -8
- package/dist/components/inputs/KapiSegmented.js +74 -64
- package/dist/components/inputs/KapiSelect.js +232 -222
- 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 +83 -81
- package/dist/components/inputs/KapiTextarea.js +8 -8
- 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/inputs/ownField.js +4 -4
- package/dist/components/layout/KapiAccountMenu.d.ts +2 -1
- package/dist/components/layout/KapiAccountMenu.js +53 -53
- 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/CtxSlidingList.js +4 -4
- 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 +63 -55
- package/dist/components/navigation/KapiTree.js +75 -75
- 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 +18 -18
- package/dist/components/overlays/KapiDialogHost.js +22 -22
- package/dist/components/overlays/KapiLoading.js +16 -16
- package/dist/components/overlays/KapiMenuButton.js +15 -15
- 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 +15 -15
- package/dist/components/overlays/KapiPopover.d.ts +2 -1
- package/dist/components/overlays/KapiPopover.js +10 -10
- package/dist/components/overlays/KapiShapeSheet.js +20 -20
- package/dist/components/overlays/KapiSplitModal.js +29 -29
- package/dist/components/overlays/KapiTooltip.js +21 -21
- package/dist/components/overlays/menuList.js +60 -60
- package/dist/components/renderSlot.d.ts +27 -0
- package/dist/components/renderSlot.js +23 -0
- package/dist/css/components/chat/chat.css +1 -1
- package/dist/hooks/portalRoot.js +6 -6
- 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/index.d.ts +2 -0
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +5 -2
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/KapiButton.css";
|
|
3
|
-
import {
|
|
3
|
+
import { renderSlot as e } from "../renderSlot.js";
|
|
4
|
+
import { buttonLookModifier as t, resolveButtonLook as n } from "../tone.js";
|
|
4
5
|
/* empty css */
|
|
5
|
-
import { Fragment as
|
|
6
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
7
|
//#region src/components/inputs/KapiButton.tsx
|
|
7
|
-
var
|
|
8
|
-
let l =
|
|
8
|
+
var o = ({ tone: e, variant: r, size: i = "md", iconOnly: a = !1, bordered: o = !1, loading: s = !1, className: c = "" } = {}) => {
|
|
9
|
+
let l = t(n(e, r));
|
|
9
10
|
return [
|
|
10
11
|
"kapi-btn",
|
|
11
12
|
l !== null && `kapi-btn--${l}`,
|
|
@@ -15,28 +16,43 @@ var a = ({ tone: n, variant: r, size: i = "md", iconOnly: a = !1, bordered: o =
|
|
|
15
16
|
s && "is-loading",
|
|
16
17
|
c
|
|
17
18
|
].filter(Boolean).join(" ");
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
type: p,
|
|
21
|
-
className: a({
|
|
22
|
-
tone: e,
|
|
23
|
-
variant: t,
|
|
24
|
-
size: o,
|
|
25
|
-
iconOnly: s,
|
|
26
|
-
bordered: c,
|
|
27
|
-
loading: u,
|
|
28
|
-
className: f
|
|
29
|
-
}),
|
|
30
|
-
...g,
|
|
31
|
-
disabled: u || d,
|
|
32
|
-
...u ? { "aria-busy": !0 } : {},
|
|
33
|
-
children: u ? /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r("span", {
|
|
19
|
+
}, s = ({ tone: t, variant: n, size: s = "md", iconOnly: c = !1, bordered: l = !1, icon: u, loading: d = !1, disabled: f, className: p, type: m = "button", children: h, ref: g, render: _, ...v }) => {
|
|
20
|
+
let y = d || f, b = d ? /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("span", {
|
|
34
21
|
className: "kapi-spinner kapi-btn__spinner",
|
|
35
22
|
"aria-hidden": "true"
|
|
36
|
-
}), /* @__PURE__ */
|
|
23
|
+
}), /* @__PURE__ */ a("span", {
|
|
37
24
|
className: "kapi-btn__content",
|
|
38
|
-
children: [
|
|
39
|
-
})] }) : /* @__PURE__ */
|
|
40
|
-
|
|
25
|
+
children: [u, h]
|
|
26
|
+
})] }) : /* @__PURE__ */ a(r, { children: [u, h] }), x = {
|
|
27
|
+
className: o({
|
|
28
|
+
tone: t,
|
|
29
|
+
variant: n,
|
|
30
|
+
size: s,
|
|
31
|
+
iconOnly: c,
|
|
32
|
+
bordered: l,
|
|
33
|
+
loading: d,
|
|
34
|
+
className: p
|
|
35
|
+
}),
|
|
36
|
+
...v
|
|
37
|
+
};
|
|
38
|
+
return _ === void 0 ? /* @__PURE__ */ i("button", {
|
|
39
|
+
ref: g,
|
|
40
|
+
type: m,
|
|
41
|
+
...x,
|
|
42
|
+
disabled: y,
|
|
43
|
+
...d ? { "aria-busy": !0 } : {},
|
|
44
|
+
children: b
|
|
45
|
+
}) : e(_, x, {
|
|
46
|
+
"aria-disabled": y || void 0,
|
|
47
|
+
"aria-busy": d || void 0,
|
|
48
|
+
onClick: y ? (e) => e.preventDefault() : void 0,
|
|
49
|
+
ref: g,
|
|
50
|
+
children: b
|
|
51
|
+
}, (e) => /* @__PURE__ */ i("button", {
|
|
52
|
+
...e,
|
|
53
|
+
type: m,
|
|
54
|
+
children: b
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
41
57
|
//#endregion
|
|
42
|
-
export {
|
|
58
|
+
export { s as KapiButton, o as buttonClasses };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/KapiDatePicker.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
import { useKapiLocale as t, useLabels as n } from "../locale/KapiLocaleProvider.js";
|
|
5
5
|
import { useControllableState as r } from "../../hooks/useControllableState.js";
|
|
6
6
|
import { localizedCalendarLabels as i, monthTitle as a, sameDay as o } from "./datePickerLogic.js";
|
|
7
7
|
/* empty css */
|
|
8
8
|
import { KapiCalendarGrid as s } from "./KapiCalendarGrid.js";
|
|
9
|
-
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
10
9
|
import "react";
|
|
10
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
11
11
|
import { ChevronLeft as u, ChevronRight as d } from "lucide-react";
|
|
12
12
|
//#region src/components/inputs/KapiCalendar.tsx
|
|
13
13
|
var f = ({ value: f, defaultValue: p = null, onChange: m, month: h, defaultMonth: g, onMonthChange: _, labels: v, weekStartsOn: y, className: b, ref: x, ...S }) => {
|
|
14
|
-
let C =
|
|
14
|
+
let C = t(), w = n("calendar", i(C), v), [T, E] = r(f, p, m), [D, O] = r(h, () => g ?? T ?? /* @__PURE__ */ new Date(), _), k = (e) => O(new Date(D.getFullYear(), D.getMonth() + e, 1));
|
|
15
15
|
return /* @__PURE__ */ l("div", {
|
|
16
16
|
...S,
|
|
17
17
|
ref: x,
|
|
18
|
-
className:
|
|
18
|
+
className: e("kapi-cal", "kapi-dp__cal", b),
|
|
19
19
|
children: [/* @__PURE__ */ l("div", {
|
|
20
20
|
className: "kapi-dp__head",
|
|
21
21
|
children: [
|
|
@@ -4,18 +4,18 @@ import { useKapiLocale as e, useKapiWeekStart as t } from "../locale/KapiLocaleP
|
|
|
4
4
|
import { logicalKeyOf as n } from "../../hooks/directionLogic.js";
|
|
5
5
|
import { buildDays as r, calendarDayLabel as i, calendarRows as a, monthTitle as o, moveCalendarFocus as s, sameDay as c, sameMonth as l, weekdayOrder as u } from "./datePickerLogic.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useEffect as d, useRef as f, useState as p } from "react";
|
|
8
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/inputs/KapiCalendarGrid.tsx
|
|
10
10
|
var g = ({ view: g, onViewChange: _, labels: v, focusTarget: y, focusRequest: b = 0, isSelected: x, dayClassName: S, onPick: C, onDayHover: w, weekStartsOn: T }) => {
|
|
11
|
-
let E = t(T), D = e(), O = /* @__PURE__ */ new Date(), k =
|
|
11
|
+
let E = t(T), D = e(), O = /* @__PURE__ */ new Date(), k = f(null), [A, j] = p(null), M = f(!1), N = [
|
|
12
12
|
A,
|
|
13
13
|
y,
|
|
14
14
|
O
|
|
15
15
|
].find((e) => !!e && l(e, g)) ?? new Date(g.getFullYear(), g.getMonth(), 1);
|
|
16
|
-
|
|
16
|
+
d(() => {
|
|
17
17
|
b > 0 && (M.current = !0);
|
|
18
|
-
}, [b]),
|
|
18
|
+
}, [b]), d(() => {
|
|
19
19
|
M.current && (M.current = !1, k.current?.querySelector("[role=\"gridcell\"][tabindex=\"0\"]")?.focus());
|
|
20
20
|
});
|
|
21
21
|
let P = (e) => {
|
|
@@ -25,26 +25,26 @@ var g = ({ view: g, onViewChange: _, labels: v, focusTarget: y, focusRequest: b
|
|
|
25
25
|
}, E);
|
|
26
26
|
t && (e.preventDefault(), j(t), l(t, g) || _(new Date(t.getFullYear(), t.getMonth(), 1)), M.current = !0);
|
|
27
27
|
}, F = a(r(g.getFullYear(), g.getMonth(), E)), I = u(v.weekdays, E), L = u(v.weekdayNames, E);
|
|
28
|
-
return /* @__PURE__ */
|
|
28
|
+
return /* @__PURE__ */ h("div", {
|
|
29
29
|
ref: k,
|
|
30
30
|
className: "kapi-dp__grid",
|
|
31
31
|
role: "grid",
|
|
32
32
|
"aria-label": o(g, v.months),
|
|
33
33
|
onKeyDown: P,
|
|
34
34
|
onMouseLeave: w ? () => w(null) : void 0,
|
|
35
|
-
children: [/* @__PURE__ */
|
|
35
|
+
children: [/* @__PURE__ */ m("div", {
|
|
36
36
|
role: "row",
|
|
37
37
|
className: "kapi-dp__row",
|
|
38
|
-
children: I.map((e, t) => /* @__PURE__ */
|
|
38
|
+
children: I.map((e, t) => /* @__PURE__ */ m("div", {
|
|
39
39
|
role: "columnheader",
|
|
40
40
|
className: "kapi-dp__wd",
|
|
41
41
|
"aria-label": L[t],
|
|
42
42
|
children: e
|
|
43
43
|
}, t))
|
|
44
|
-
}), F.map((e) => /* @__PURE__ */
|
|
44
|
+
}), F.map((e) => /* @__PURE__ */ m("div", {
|
|
45
45
|
role: "row",
|
|
46
46
|
className: "kapi-dp__row",
|
|
47
|
-
children: e.map((e) => /* @__PURE__ */
|
|
47
|
+
children: e.map((e) => /* @__PURE__ */ m("button", {
|
|
48
48
|
type: "button",
|
|
49
49
|
role: "gridcell",
|
|
50
50
|
tabIndex: c(e.date, N) ? 0 : -1,
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/KapiChecklist.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { useRangeSelect as
|
|
9
|
-
import { navKeyOf as
|
|
10
|
-
import { checklistBulkState as re, filterChecklistItems as o, orderedChecklistValue as s, setChecklistItems as
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
import { fieldControlProps as t, resolveReadOnly as n } from "./fieldLogic.js";
|
|
5
|
+
import { useOwnField as r } from "./ownField.js";
|
|
6
|
+
import { useLabels as i } from "../locale/KapiLocaleProvider.js";
|
|
7
|
+
import { KapiInput as ee } from "./KapiInput.js";
|
|
8
|
+
import { useRangeSelect as te } from "../../hooks/useRangeSelect.js";
|
|
9
|
+
import { navKeyOf as ne, nextEnabledIndex as a } from "../overlays/menuKeyboardLogic.js";
|
|
10
|
+
import { checklistBulkState as re, filterChecklistItems as o, orderedChecklistValue as s, setChecklistItems as ie } from "./checklistLogic.js";
|
|
11
11
|
/* empty css */
|
|
12
|
-
import { useControllableState as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { Check as
|
|
12
|
+
import { useControllableState as c } from "../../hooks/useControllableState.js";
|
|
13
|
+
import { useEffect as ae, useId as oe, useMemo as l, useRef as u, useState as se } from "react";
|
|
14
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
15
|
+
import { Check as ce, Search as p } from "lucide-react";
|
|
16
16
|
//#region src/components/inputs/KapiChecklist.tsx
|
|
17
|
-
var
|
|
17
|
+
var m = {
|
|
18
18
|
search: "Buscar en la lista",
|
|
19
19
|
searchPlaceholder: "Buscar…",
|
|
20
20
|
selectAll: "Marcar todo",
|
|
21
21
|
clearAll: "Desmarcar todo",
|
|
22
22
|
empty: "Sin coincidencias"
|
|
23
|
-
},
|
|
24
|
-
function
|
|
25
|
-
let D =
|
|
26
|
-
help:
|
|
27
|
-
required:
|
|
28
|
-
invalid:
|
|
29
|
-
readOnly:
|
|
30
|
-
fieldClassName:
|
|
31
|
-
}), k = O.field, A =
|
|
32
|
-
A || ve(s(
|
|
33
|
-
}, [R, z] =
|
|
34
|
-
|
|
23
|
+
}, h = 7;
|
|
24
|
+
function g({ items: h, value: g, defaultValue: le, onChange: _, label: v, help: ue, fieldClassName: de, readOnly: y, invalid: b, required: x, searchable: S, query: C, defaultQuery: w, onQueryChange: fe, selectAll: pe = !1, rangeSelect: T = !0, disabled: E = !1, labels: me, className: he, "aria-label": ge, ..._e }) {
|
|
25
|
+
let D = i("checklist", m, me), O = r({
|
|
26
|
+
help: ue,
|
|
27
|
+
required: x,
|
|
28
|
+
invalid: b,
|
|
29
|
+
readOnly: y,
|
|
30
|
+
fieldClassName: de
|
|
31
|
+
}), k = O.field, A = n(y, k), j = oe(), M = `${j}-label`, N = u(null), P = u(null), [F, ve] = c(g, le ?? [], _), I = l(() => new Set(F), [F]), L = (e) => {
|
|
32
|
+
A || ve(s(h, e));
|
|
33
|
+
}, [R, z] = c(C, w ?? "", fe), B = S ?? h.length > 7, V = l(() => o(h, R), [h, R]), H = l(() => V.map((e) => e.id), [V]), U = l(() => E ? [] : V.flatMap((e, t) => e.disabled ? [] : [t]), [V, E]), W = (e) => !E && h.some((t) => t.id === e && !t.disabled), G = te(), [K, q] = se(null), J = K === null ? -1 : H.indexOf(K), Y = (e) => `${j}-opt-${h.findIndex((t) => t.id === e)}`;
|
|
34
|
+
ae(() => {
|
|
35
35
|
J < 0 || N.current?.querySelector(`[data-index="${J}"]`)?.scrollIntoView?.({ block: "nearest" });
|
|
36
36
|
}, [J]);
|
|
37
37
|
let X = (e, t) => {
|
|
@@ -39,20 +39,20 @@ function _({ items: g, value: _, defaultValue: v, onChange: y, label: b, help: c
|
|
|
39
39
|
selected: I,
|
|
40
40
|
ids: H,
|
|
41
41
|
target: e,
|
|
42
|
-
shift:
|
|
42
|
+
shift: T && t,
|
|
43
43
|
isSelectable: W
|
|
44
44
|
}));
|
|
45
45
|
}, Z = re(V, I), Q = (e) => {
|
|
46
|
-
|
|
46
|
+
E || L(ie(h, I, H, e));
|
|
47
47
|
}, ye = (e) => {
|
|
48
|
-
if (
|
|
49
|
-
let t =
|
|
48
|
+
if (E) return;
|
|
49
|
+
let t = ne(e.key, "vertical");
|
|
50
50
|
if (t) {
|
|
51
51
|
e.preventDefault();
|
|
52
|
-
let n =
|
|
52
|
+
let n = a(J, t, U);
|
|
53
53
|
if (n < 0) return;
|
|
54
54
|
let r = t === "next" && n < J || t === "prev" && n > J;
|
|
55
|
-
if (e.shiftKey &&
|
|
55
|
+
if (e.shiftKey && T && J >= 0) {
|
|
56
56
|
if (r) return;
|
|
57
57
|
let e = H[n];
|
|
58
58
|
L(G.extend({
|
|
@@ -67,20 +67,20 @@ function _({ items: g, value: _, defaultValue: v, onChange: y, label: b, help: c
|
|
|
67
67
|
} else e.key === " " || e.key === "Enter" ? (e.preventDefault(), K !== null && J >= 0 && X(K, e.shiftKey)) : (e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "a" ? (e.preventDefault(), Q(Z !== "all")) : B && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (e.preventDefault(), z(R + e.key), P.current?.focus());
|
|
68
68
|
}, be = () => {
|
|
69
69
|
J < 0 && U.length > 0 && q(H[U[0]]), N.current?.focus();
|
|
70
|
-
}, xe =
|
|
71
|
-
invalid:
|
|
72
|
-
required:
|
|
70
|
+
}, xe = v == null ? { "aria-label": ge } : { "aria-labelledby": M }, $ = t(k, {
|
|
71
|
+
invalid: b,
|
|
72
|
+
required: x
|
|
73
73
|
});
|
|
74
|
-
return O.wrap(/* @__PURE__ */
|
|
74
|
+
return O.wrap(/* @__PURE__ */ f("div", {
|
|
75
75
|
..._e,
|
|
76
|
-
className:
|
|
76
|
+
className: e("kapi-checklist", E && "is-disabled", A && "is-readonly", he),
|
|
77
77
|
children: [
|
|
78
|
-
|
|
78
|
+
v != null && /* @__PURE__ */ d("div", {
|
|
79
79
|
id: M,
|
|
80
80
|
className: "kapi-checklist__label",
|
|
81
|
-
children:
|
|
81
|
+
children: v
|
|
82
82
|
}),
|
|
83
|
-
B && /* @__PURE__ */
|
|
83
|
+
B && /* @__PURE__ */ d(ee, {
|
|
84
84
|
ref: P,
|
|
85
85
|
type: "search",
|
|
86
86
|
size: "sm",
|
|
@@ -88,30 +88,30 @@ function _({ items: g, value: _, defaultValue: v, onChange: y, label: b, help: c
|
|
|
88
88
|
"aria-label": D.search,
|
|
89
89
|
placeholder: D.searchPlaceholder,
|
|
90
90
|
spellCheck: !1,
|
|
91
|
-
startIcon: /* @__PURE__ */
|
|
91
|
+
startIcon: /* @__PURE__ */ d(p, {}),
|
|
92
92
|
clearable: !0,
|
|
93
|
-
disabled:
|
|
93
|
+
disabled: E,
|
|
94
94
|
value: R,
|
|
95
95
|
onChange: (e) => z(e.target.value),
|
|
96
96
|
onKeyDown: (e) => {
|
|
97
97
|
(e.key === "ArrowDown" || e.key === "Enter") && (e.preventDefault(), be());
|
|
98
98
|
}
|
|
99
99
|
}),
|
|
100
|
-
|
|
100
|
+
pe && /* @__PURE__ */ f("div", {
|
|
101
101
|
className: "kapi-checklist__bulk",
|
|
102
|
-
children: [/* @__PURE__ */
|
|
102
|
+
children: [/* @__PURE__ */ d("button", {
|
|
103
103
|
type: "button",
|
|
104
|
-
disabled:
|
|
104
|
+
disabled: E || A || Z === "all",
|
|
105
105
|
onClick: () => Q(!0),
|
|
106
106
|
children: D.selectAll
|
|
107
|
-
}), /* @__PURE__ */
|
|
107
|
+
}), /* @__PURE__ */ d("button", {
|
|
108
108
|
type: "button",
|
|
109
|
-
disabled:
|
|
109
|
+
disabled: E || A || Z === "none",
|
|
110
110
|
onClick: () => Q(!1),
|
|
111
111
|
children: D.clearAll
|
|
112
112
|
})]
|
|
113
113
|
}),
|
|
114
|
-
V.length > 0 ? /* @__PURE__ */
|
|
114
|
+
V.length > 0 ? /* @__PURE__ */ d("div", {
|
|
115
115
|
ref: N,
|
|
116
116
|
role: "listbox",
|
|
117
117
|
"aria-multiselectable": "true",
|
|
@@ -119,57 +119,57 @@ function _({ items: g, value: _, defaultValue: v, onChange: y, label: b, help: c
|
|
|
119
119
|
"aria-required": $["aria-required"],
|
|
120
120
|
"aria-describedby": O.wraps ? $["aria-describedby"] : void 0,
|
|
121
121
|
"aria-readonly": A || void 0,
|
|
122
|
-
"aria-disabled":
|
|
122
|
+
"aria-disabled": E || void 0,
|
|
123
123
|
"aria-activedescendant": J >= 0 && K !== null ? Y(K) : void 0,
|
|
124
|
-
tabIndex:
|
|
124
|
+
tabIndex: E ? -1 : 0,
|
|
125
125
|
className: "kapi-checklist__list",
|
|
126
126
|
onKeyDown: ye,
|
|
127
127
|
onFocus: (e) => {
|
|
128
128
|
e.target === e.currentTarget && J < 0 && U.length > 0 && q(H[U[0]]);
|
|
129
129
|
},
|
|
130
130
|
...xe,
|
|
131
|
-
children: V.map((
|
|
132
|
-
let
|
|
133
|
-
return /* @__PURE__ */
|
|
134
|
-
id: Y(
|
|
135
|
-
"data-index":
|
|
131
|
+
children: V.map((t, n) => {
|
|
132
|
+
let r = I.has(t.id), i = E || t.disabled === !0;
|
|
133
|
+
return /* @__PURE__ */ f("div", {
|
|
134
|
+
id: Y(t.id),
|
|
135
|
+
"data-index": n,
|
|
136
136
|
role: "option",
|
|
137
|
-
"aria-selected":
|
|
138
|
-
"aria-disabled":
|
|
139
|
-
"aria-label": typeof
|
|
140
|
-
className:
|
|
137
|
+
"aria-selected": r,
|
|
138
|
+
"aria-disabled": i || void 0,
|
|
139
|
+
"aria-label": typeof t.label == "string" ? void 0 : t.text,
|
|
140
|
+
className: e("kapi-checklist__option", r && "is-on", n === J && "is-active", i && "is-disabled"),
|
|
141
141
|
onMouseDown: (e) => {
|
|
142
142
|
e.shiftKey && e.preventDefault();
|
|
143
143
|
},
|
|
144
|
-
onClick: (
|
|
145
|
-
|
|
144
|
+
onClick: (e) => {
|
|
145
|
+
i || (q(t.id), X(t.id, e.shiftKey));
|
|
146
146
|
},
|
|
147
|
-
children: [/* @__PURE__ */
|
|
147
|
+
children: [/* @__PURE__ */ d("span", {
|
|
148
148
|
className: "kapi-checklist__box",
|
|
149
149
|
"aria-hidden": "true",
|
|
150
|
-
children:
|
|
150
|
+
children: r && /* @__PURE__ */ d(ce, {
|
|
151
151
|
size: 12,
|
|
152
152
|
strokeWidth: 3
|
|
153
153
|
})
|
|
154
|
-
}), /* @__PURE__ */
|
|
154
|
+
}), /* @__PURE__ */ f("span", {
|
|
155
155
|
className: "kapi-checklist__text",
|
|
156
|
-
children: [/* @__PURE__ */
|
|
156
|
+
children: [/* @__PURE__ */ d("span", {
|
|
157
157
|
className: "kapi-checklist__name",
|
|
158
|
-
children:
|
|
159
|
-
}),
|
|
158
|
+
children: t.label
|
|
159
|
+
}), t.description != null && /* @__PURE__ */ d("span", {
|
|
160
160
|
className: "kapi-checklist__desc",
|
|
161
|
-
children:
|
|
161
|
+
children: t.description
|
|
162
162
|
})]
|
|
163
163
|
})]
|
|
164
|
-
},
|
|
164
|
+
}, t.id);
|
|
165
165
|
})
|
|
166
|
-
}) : /* @__PURE__ */
|
|
166
|
+
}) : /* @__PURE__ */ d("div", {
|
|
167
167
|
className: "kapi-checklist__empty",
|
|
168
168
|
role: "status",
|
|
169
|
-
children:
|
|
169
|
+
children: h.length > 0 ? D.empty : null
|
|
170
170
|
})
|
|
171
171
|
]
|
|
172
172
|
}));
|
|
173
173
|
}
|
|
174
174
|
//#endregion
|
|
175
|
-
export {
|
|
175
|
+
export { h as CHECKLIST_SEARCH_THRESHOLD, m as DEFAULT_CHECKLIST_LABELS, g as KapiChecklist };
|