@kapiuara/ui 0.14.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 +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/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,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 };
|
|
@@ -14,8 +14,8 @@ import { chipFieldSize as le, datePatternFor as ue, formDateValue as de, formatV
|
|
|
14
14
|
import { KapiCalendarGrid as be } from "./KapiCalendarGrid.js";
|
|
15
15
|
import { useCalendarFocus as xe } from "./useCalendarFocus.js";
|
|
16
16
|
import { useDatePopSide as Se } from "./useDatePopSide.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
17
|
+
import { useId as Ce, useMemo as we, useRef as c, useState as l } from "react";
|
|
18
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
19
19
|
import { Calendar as Te, ChevronLeft as Ee, ChevronRight as De, Clock as Oe } from "lucide-react";
|
|
20
20
|
//#region src/components/inputs/KapiDatePicker.tsx
|
|
21
21
|
var ke = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t, Ae = Array.from({ length: 24 }, (e, t) => t), f = ({ mode: f = "date", value: p, defaultValue: je, onChange: Me, placeholder: Ne, variant: Pe, icon: m, chipLabel: h, label: g, help: Fe, fieldClassName: _, readOnly: v, disabled: y = !1, id: b, name: x, className: Ie, style: Le, "aria-label": Re, labels: ze, minuteStep: Be = 1, invalid: S, required: C, ref: Ve, onBlur: He, weekStartsOn: Ue }) => {
|
|
@@ -36,7 +36,7 @@ var ke = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
36
36
|
invalid: S,
|
|
37
37
|
readOnly: v,
|
|
38
38
|
fieldClassName: _
|
|
39
|
-
}), M = j.field, N = r(v, M), P = Ne ?? ke(f, E.placeholder), Ge = Ce(), F = b ?? M?.controlId ?? (k ? Ge : void 0), [I, L] =
|
|
39
|
+
}), M = j.field, N = r(v, M), P = Ne ?? ke(f, E.placeholder), Ge = Ce(), F = b ?? M?.controlId ?? (k ? Ge : void 0), [I, L] = l(!1), Ke = p !== void 0, [R, qe, , Je] = ie(p === void 0 ? void 0 : s(p), s(je ?? null), Me), [z, B] = l(() => i(R, f, E)), [V, H] = l(() => R ?? /* @__PURE__ */ new Date()), U = c(null), Ye = se(U, oe(Je)), W = c(null), G = c(null), { inputRef: Xe, focusRequest: Ze, openFromKeyboard: K, openFromFocus: Qe, returnFocus: q } = xe(L), J = R ? R.getTime() : null, [$e, et] = l(J), [tt, Y] = l(f), [nt, rt] = l(E);
|
|
40
40
|
($e !== J || tt !== f || nt !== E) && (et(J), Y(f), rt(E), B(i(R, f, E)), R && H(R)), ce(I, [U], () => {
|
|
41
41
|
let e = ae(U.current);
|
|
42
42
|
e && G.current?.contains(e) && e.blur(), L(!1);
|
|
@@ -57,7 +57,7 @@ var ke = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
57
57
|
let n = new Date(R ?? /* @__PURE__ */ new Date());
|
|
58
58
|
e != null && n.setHours(e), t != null && n.setMinutes(t), X(n);
|
|
59
59
|
}, $ = (e) => H(new Date(V.getFullYear(), V.getMonth() + e, 1)), at = Se(I && !y && !N, W, G);
|
|
60
|
-
return j.wrap(/* @__PURE__ */
|
|
60
|
+
return j.wrap(/* @__PURE__ */ d("div", {
|
|
61
61
|
className: [
|
|
62
62
|
"kapi-dp",
|
|
63
63
|
k && "kapi-dp--chip",
|
|
@@ -70,17 +70,17 @@ var ke = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
70
70
|
n(e.relatedTarget, e.currentTarget) && He?.(e);
|
|
71
71
|
},
|
|
72
72
|
children: [
|
|
73
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ d("div", {
|
|
74
74
|
className: ["kapi-dp__field", k && "kapi-filterchip"].filter(Boolean).join(" "),
|
|
75
75
|
ref: W,
|
|
76
76
|
children: [
|
|
77
77
|
k && m,
|
|
78
|
-
A && /* @__PURE__ */
|
|
78
|
+
A && /* @__PURE__ */ d("label", {
|
|
79
79
|
className: "kapi-dp__label",
|
|
80
80
|
htmlFor: F,
|
|
81
81
|
children: [A, ":"]
|
|
82
82
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ u("input", {
|
|
84
84
|
ref: (t) => {
|
|
85
85
|
Xe.current = t, e(Ve, t);
|
|
86
86
|
},
|
|
@@ -105,59 +105,59 @@ var ke = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
105
105
|
e.key === "Escape" && I && (e.preventDefault(), e.stopPropagation(), L(!1)), e.key === "ArrowDown" && D && !N && (e.preventDefault(), K());
|
|
106
106
|
}
|
|
107
107
|
}),
|
|
108
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ u("button", {
|
|
109
109
|
type: "button",
|
|
110
110
|
className: "kapi-dp__toggle",
|
|
111
111
|
disabled: y || N,
|
|
112
112
|
"aria-label": T.openPicker,
|
|
113
113
|
"aria-expanded": I,
|
|
114
114
|
onClick: () => I ? L(!1) : K(),
|
|
115
|
-
children:
|
|
115
|
+
children: u(D ? Te : Oe, {
|
|
116
116
|
size: 16,
|
|
117
117
|
strokeWidth: 1.9
|
|
118
118
|
})
|
|
119
119
|
})
|
|
120
120
|
]
|
|
121
121
|
}),
|
|
122
|
-
x && /* @__PURE__ */
|
|
122
|
+
x && /* @__PURE__ */ u("input", {
|
|
123
123
|
type: "hidden",
|
|
124
124
|
name: x,
|
|
125
125
|
value: de(R, f),
|
|
126
126
|
disabled: y
|
|
127
127
|
}),
|
|
128
|
-
I && !y && !N && /* @__PURE__ */
|
|
128
|
+
I && !y && !N && /* @__PURE__ */ d("div", {
|
|
129
129
|
ref: G,
|
|
130
130
|
className: `kapi-dp__pop${at === "top" ? " kapi-dp__pop--up" : ""}`,
|
|
131
131
|
onKeyDown: (e) => {
|
|
132
132
|
e.key === "Escape" && (e.preventDefault(), q());
|
|
133
133
|
},
|
|
134
|
-
children: [D && /* @__PURE__ */
|
|
134
|
+
children: [D && /* @__PURE__ */ d("div", {
|
|
135
135
|
className: "kapi-dp__cal",
|
|
136
136
|
children: [
|
|
137
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ d("div", {
|
|
138
138
|
className: "kapi-dp__head",
|
|
139
139
|
children: [
|
|
140
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ u("button", {
|
|
141
141
|
type: "button",
|
|
142
142
|
className: "kapi-dp__nav",
|
|
143
143
|
"aria-label": T.prevMonth,
|
|
144
144
|
onClick: () => $(-1),
|
|
145
|
-
children: /* @__PURE__ */
|
|
145
|
+
children: /* @__PURE__ */ u(Ee, {
|
|
146
146
|
className: "kapi-flip-rtl",
|
|
147
147
|
size: 15,
|
|
148
148
|
strokeWidth: 2.2
|
|
149
149
|
})
|
|
150
150
|
}),
|
|
151
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ u("span", {
|
|
152
152
|
className: "kapi-dp__title",
|
|
153
153
|
children: _e(V, T.months)
|
|
154
154
|
}),
|
|
155
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ u("button", {
|
|
156
156
|
type: "button",
|
|
157
157
|
className: "kapi-dp__nav",
|
|
158
158
|
"aria-label": T.nextMonth,
|
|
159
159
|
onClick: () => $(1),
|
|
160
|
-
children: /* @__PURE__ */
|
|
160
|
+
children: /* @__PURE__ */ u(De, {
|
|
161
161
|
className: "kapi-flip-rtl",
|
|
162
162
|
size: 15,
|
|
163
163
|
strokeWidth: 2.2
|
|
@@ -165,7 +165,7 @@ var ke = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
165
165
|
})
|
|
166
166
|
]
|
|
167
167
|
}),
|
|
168
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ u(be, {
|
|
169
169
|
weekStartsOn: Ue,
|
|
170
170
|
view: V,
|
|
171
171
|
onViewChange: H,
|
|
@@ -176,16 +176,16 @@ var ke = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
176
176
|
dayClassName: (e) => o(e, R) && "kapi-dp__day--sel",
|
|
177
177
|
onPick: Z
|
|
178
178
|
}),
|
|
179
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ d("div", {
|
|
180
180
|
className: "kapi-dp__foot",
|
|
181
|
-
children: [/* @__PURE__ */
|
|
181
|
+
children: [/* @__PURE__ */ u("button", {
|
|
182
182
|
type: "button",
|
|
183
183
|
className: "kapi-dp__link",
|
|
184
184
|
onClick: () => {
|
|
185
185
|
X(null), L(!1);
|
|
186
186
|
},
|
|
187
187
|
children: T.clear
|
|
188
|
-
}), /* @__PURE__ */
|
|
188
|
+
}), /* @__PURE__ */ u("button", {
|
|
189
189
|
type: "button",
|
|
190
190
|
className: "kapi-dp__link",
|
|
191
191
|
onClick: () => {
|
|
@@ -196,21 +196,21 @@ var ke = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
196
196
|
})]
|
|
197
197
|
})
|
|
198
198
|
]
|
|
199
|
-
}), O && /* @__PURE__ */
|
|
199
|
+
}), O && /* @__PURE__ */ u("div", {
|
|
200
200
|
className: "kapi-dp__time",
|
|
201
|
-
children: /* @__PURE__ */
|
|
201
|
+
children: /* @__PURE__ */ d("div", {
|
|
202
202
|
className: "kapi-dp__time-cols",
|
|
203
|
-
children: [/* @__PURE__ */
|
|
203
|
+
children: [/* @__PURE__ */ u("div", {
|
|
204
204
|
className: "kapi-dp__time-col",
|
|
205
|
-
children: Ae.map((e) => /* @__PURE__ */
|
|
205
|
+
children: Ae.map((e) => /* @__PURE__ */ u("button", {
|
|
206
206
|
type: "button",
|
|
207
207
|
className: `kapi-dp__time-opt${R?.getHours() === e ? " kapi-dp__time-opt--sel" : ""}`,
|
|
208
208
|
onClick: () => Q(e, null),
|
|
209
209
|
children: a(e)
|
|
210
210
|
}, e))
|
|
211
|
-
}), /* @__PURE__ */
|
|
211
|
+
}), /* @__PURE__ */ u("div", {
|
|
212
212
|
className: "kapi-dp__time-col",
|
|
213
|
-
children: ge(Be, R?.getMinutes()).map((e) => /* @__PURE__ */
|
|
213
|
+
children: ge(Be, R?.getMinutes()).map((e) => /* @__PURE__ */ u("button", {
|
|
214
214
|
type: "button",
|
|
215
215
|
className: `kapi-dp__time-opt${R?.getMinutes() === e ? " kapi-dp__time-opt--sel" : ""}`,
|
|
216
216
|
onClick: () => Q(null, e),
|