@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.
Files changed (132) hide show
  1. package/README.md +239 -1
  2. package/dist/components/chat/KapiChatDivider.d.ts +7 -3
  3. package/dist/components/chat/KapiChatDivider.js +6 -6
  4. package/dist/components/chat/KapiChatList.js +19 -19
  5. package/dist/components/chat/KapiChatThread.js +23 -23
  6. package/dist/components/chat/KapiComposer.js +19 -19
  7. package/dist/components/chat/KapiMessageBubble.js +4 -4
  8. package/dist/components/chat/KapiTypingIndicator.js +4 -4
  9. package/dist/components/chat/index.d.ts +1 -1
  10. package/dist/components/closeReason.d.ts +34 -0
  11. package/dist/components/data/KapiBarChart.js +1 -1
  12. package/dist/components/data/KapiDataTable.js +31 -31
  13. package/dist/components/data/KapiEventCalendar.js +78 -78
  14. package/dist/components/data/KapiHeatmap.js +23 -23
  15. package/dist/components/data/KapiLineChart.js +1 -1
  16. package/dist/components/data/KapiPagination.js +4 -4
  17. package/dist/components/data/KapiSparkline.js +1 -1
  18. package/dist/components/data/KapiTable.js +122 -122
  19. package/dist/components/data/KapiTableFilter.js +18 -18
  20. package/dist/components/data/KapiTableRow.js +24 -24
  21. package/dist/components/data/KapiTableToolbar.js +49 -49
  22. package/dist/components/data/chartFrame.js +21 -21
  23. package/dist/components/data/useColumnResize.js +8 -8
  24. package/dist/components/data/useTableSelection.js +8 -8
  25. package/dist/components/display/KapiAnnotation.js +55 -55
  26. package/dist/components/display/KapiComment.js +4 -4
  27. package/dist/components/display/KapiCommentComposer.js +16 -16
  28. package/dist/components/display/KapiFileItem.js +6 -6
  29. package/dist/components/display/KapiFileViewer.js +9 -9
  30. package/dist/components/display/KapiTruncate.js +7 -7
  31. package/dist/components/feedback/KapiAlert.d.ts +2 -1
  32. package/dist/components/feedback/KapiAlert.js +8 -8
  33. package/dist/components/feedback/KapiCountdown.js +8 -8
  34. package/dist/components/feedback/KapiFab.js +30 -30
  35. package/dist/components/feedback/KapiOfflineBanner.js +8 -8
  36. package/dist/components/feedback/KapiToastContainer.js +25 -25
  37. package/dist/components/feedback/KapiTour.d.ts +2 -1
  38. package/dist/components/feedback/KapiTour.js +35 -35
  39. package/dist/components/inputs/KapiAutocomplete.js +14 -14
  40. package/dist/components/inputs/KapiButton.d.ts +17 -1
  41. package/dist/components/inputs/KapiButton.js +41 -25
  42. package/dist/components/inputs/KapiCalendar.js +5 -5
  43. package/dist/components/inputs/KapiCalendarGrid.js +10 -10
  44. package/dist/components/inputs/KapiChecklist.js +71 -71
  45. package/dist/components/inputs/KapiDatePicker.js +124 -122
  46. package/dist/components/inputs/KapiDateRangePicker.js +138 -136
  47. package/dist/components/inputs/KapiFacetedSearch.js +29 -29
  48. package/dist/components/inputs/KapiField.js +14 -14
  49. package/dist/components/inputs/KapiFileUpload.js +27 -27
  50. package/dist/components/inputs/KapiIconButton.d.ts +9 -1
  51. package/dist/components/inputs/KapiIconButton.js +27 -10
  52. package/dist/components/inputs/KapiInput.js +21 -21
  53. package/dist/components/inputs/KapiInputGroup.js +8 -8
  54. package/dist/components/inputs/KapiMaskedInput.d.ts +8 -3
  55. package/dist/components/inputs/KapiMaskedInput.js +64 -51
  56. package/dist/components/inputs/KapiNumberStepper.js +29 -29
  57. package/dist/components/inputs/KapiRating.js +61 -59
  58. package/dist/components/inputs/KapiSearchChip.js +8 -8
  59. package/dist/components/inputs/KapiSegmented.js +74 -64
  60. package/dist/components/inputs/KapiSelect.js +232 -222
  61. package/dist/components/inputs/KapiSelectMenu.js +60 -60
  62. package/dist/components/inputs/KapiSlider.js +1 -1
  63. package/dist/components/inputs/KapiSwitch.js +6 -6
  64. package/dist/components/inputs/KapiTagInput.js +83 -81
  65. package/dist/components/inputs/KapiTextarea.js +8 -8
  66. package/dist/components/inputs/misuseWarnings.d.ts +37 -0
  67. package/dist/components/inputs/misuseWarnings.js +36 -0
  68. package/dist/components/inputs/numberStepLogic.d.ts +10 -0
  69. package/dist/components/inputs/numberStepLogic.js +16 -7
  70. package/dist/components/inputs/ownField.js +4 -4
  71. package/dist/components/layout/KapiAccountMenu.d.ts +2 -1
  72. package/dist/components/layout/KapiAccountMenu.js +53 -53
  73. package/dist/components/layout/KapiContextSlot.js +35 -35
  74. package/dist/components/layout/KapiMasonry.js +6 -6
  75. package/dist/components/layout/KapiNotificationBell.js +60 -60
  76. package/dist/components/layout/KapiPageHeader.js +19 -19
  77. package/dist/components/layout/KapiRail.js +60 -60
  78. package/dist/components/layout/KapiRailAccount.js +9 -9
  79. package/dist/components/layout/KapiRoot.js +21 -21
  80. package/dist/components/layout/KapiScrollArea.js +11 -11
  81. package/dist/components/layout/KapiShell.js +12 -12
  82. package/dist/components/locale/KapiLocaleProvider.js +13 -13
  83. package/dist/components/navigation/CtxSlidingList.js +4 -4
  84. package/dist/components/navigation/KapiAccordion.js +12 -12
  85. package/dist/components/navigation/KapiBreadcrumb.js +11 -11
  86. package/dist/components/navigation/KapiCollapsiblePanel.js +23 -23
  87. package/dist/components/navigation/KapiContextPanel.js +76 -76
  88. package/dist/components/navigation/KapiFilterChips.js +9 -9
  89. package/dist/components/navigation/KapiNavBadge.d.ts +4 -2
  90. package/dist/components/navigation/KapiNavBadge.js +11 -10
  91. package/dist/components/navigation/KapiPanelGroup.js +25 -25
  92. package/dist/components/navigation/KapiSteps.js +4 -4
  93. package/dist/components/navigation/KapiTabs.d.ts +4 -1
  94. package/dist/components/navigation/KapiTabs.js +63 -55
  95. package/dist/components/navigation/KapiTree.js +75 -75
  96. package/dist/components/navigation/KapiWizard.d.ts +2 -1
  97. package/dist/components/navigation/KapiWizard.js +30 -30
  98. package/dist/components/overlays/KapiCanvasForm.d.ts +6 -2
  99. package/dist/components/overlays/KapiCanvasForm.js +12 -12
  100. package/dist/components/overlays/KapiCommandPalette.d.ts +2 -1
  101. package/dist/components/overlays/KapiCommandPalette.js +23 -23
  102. package/dist/components/overlays/KapiConfirm.d.ts +2 -1
  103. package/dist/components/overlays/KapiConfirm.js +12 -12
  104. package/dist/components/overlays/KapiContextMenu.d.ts +2 -1
  105. package/dist/components/overlays/KapiContextMenu.js +18 -18
  106. package/dist/components/overlays/KapiDialogHost.js +22 -22
  107. package/dist/components/overlays/KapiLoading.js +16 -16
  108. package/dist/components/overlays/KapiMenuButton.js +15 -15
  109. package/dist/components/overlays/KapiModal.d.ts +2 -1
  110. package/dist/components/overlays/KapiModal.js +28 -28
  111. package/dist/components/overlays/KapiOffcanvas.d.ts +3 -2
  112. package/dist/components/overlays/KapiOffcanvas.js +63 -63
  113. package/dist/components/overlays/KapiOffcanvasStack.js +38 -38
  114. package/dist/components/overlays/KapiPhotoView.js +15 -15
  115. package/dist/components/overlays/KapiPopover.d.ts +2 -1
  116. package/dist/components/overlays/KapiPopover.js +10 -10
  117. package/dist/components/overlays/KapiShapeSheet.js +20 -20
  118. package/dist/components/overlays/KapiSplitModal.js +29 -29
  119. package/dist/components/overlays/KapiTooltip.js +21 -21
  120. package/dist/components/overlays/menuList.js +60 -60
  121. package/dist/components/renderSlot.d.ts +27 -0
  122. package/dist/components/renderSlot.js +23 -0
  123. package/dist/css/components/chat/chat.css +1 -1
  124. package/dist/hooks/portalRoot.js +6 -6
  125. package/dist/hooks/useControllableState.d.ts +6 -2
  126. package/dist/hooks/useControllableState.js +14 -11
  127. package/dist/hooks/useFormReset.d.ts +22 -0
  128. package/dist/hooks/useFormReset.js +17 -0
  129. package/dist/index.d.ts +2 -0
  130. package/dist/kapi.css +1 -1
  131. package/dist/kapi.layered.css +1 -1
  132. package/package.json +5 -2
@@ -1,11 +1,12 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/inputs/KapiButton.css";
3
- import { buttonLookModifier as e, resolveButtonLook as t } from "../tone.js";
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 n, jsx as r, jsxs as i } from "react/jsx-runtime";
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 a = ({ tone: n, variant: r, size: i = "md", iconOnly: a = !1, bordered: o = !1, loading: s = !1, className: c = "" } = {}) => {
8
- let l = e(t(n, r));
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
- }, o = ({ tone: e, variant: t, size: o = "md", iconOnly: s = !1, bordered: c = !1, icon: l, loading: u = !1, disabled: d, className: f, type: p = "button", children: m, ref: h, ...g }) => /* @__PURE__ */ r("button", {
19
- ref: h,
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__ */ i("span", {
23
+ }), /* @__PURE__ */ a("span", {
37
24
  className: "kapi-btn__content",
38
- children: [l, m]
39
- })] }) : /* @__PURE__ */ i(n, { children: [l, m] })
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 { o as KapiButton, a as buttonClasses };
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 { useKapiLocale as e, useLabels as t } from "../locale/KapiLocaleProvider.js";
4
- import { joinClasses as n } from "../rootProps.js";
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 = e(), w = t("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));
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: n("kapi-cal", "kapi-dp__cal", b),
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 { jsx as d, jsxs as f } from "react/jsx-runtime";
8
- import { useEffect as p, useRef as m, useState as h } from "react";
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 = m(null), [A, j] = h(null), M = m(!1), N = [
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
- p(() => {
16
+ d(() => {
17
17
  b > 0 && (M.current = !0);
18
- }, [b]), p(() => {
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__ */ f("div", {
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__ */ d("div", {
35
+ children: [/* @__PURE__ */ m("div", {
36
36
  role: "row",
37
37
  className: "kapi-dp__row",
38
- children: I.map((e, t) => /* @__PURE__ */ d("div", {
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__ */ d("div", {
44
+ }), F.map((e) => /* @__PURE__ */ m("div", {
45
45
  role: "row",
46
46
  className: "kapi-dp__row",
47
- children: e.map((e) => /* @__PURE__ */ d("button", {
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 { fieldControlProps as e, resolveReadOnly as t } from "./fieldLogic.js";
4
- import { useOwnField as n } from "./ownField.js";
5
- import { useLabels as r } from "../locale/KapiLocaleProvider.js";
6
- import { KapiInput as i } from "./KapiInput.js";
7
- import { joinClasses as a } from "../rootProps.js";
8
- import { useRangeSelect as ee } from "../../hooks/useRangeSelect.js";
9
- import { navKeyOf as te, nextEnabledIndex as ne } from "../overlays/menuKeyboardLogic.js";
10
- import { checklistBulkState as re, filterChecklistItems as o, orderedChecklistValue as s, setChecklistItems as c } from "./checklistLogic.js";
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 l } from "../../hooks/useControllableState.js";
13
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
14
- import { useEffect as ie, useId as ae, useMemo as f, useRef as p, useState as oe } from "react";
15
- import { Check as se, Search as m } from "lucide-react";
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 h = {
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
- }, g = 7;
24
- function _({ items: g, value: _, defaultValue: v, onChange: y, label: b, help: ce, fieldClassName: le, readOnly: x, invalid: S, required: C, searchable: ue, query: de, defaultQuery: fe, onQueryChange: pe, selectAll: me = !1, rangeSelect: w = !0, disabled: T = !1, labels: he, className: ge, "aria-label": E, ..._e }) {
25
- let D = r("checklist", h, he), O = n({
26
- help: ce,
27
- required: C,
28
- invalid: S,
29
- readOnly: x,
30
- fieldClassName: le
31
- }), k = O.field, A = t(x, k), j = ae(), M = `${j}-label`, N = p(null), P = p(null), [F, ve] = l(_, v ?? [], y), I = f(() => new Set(F), [F]), L = (e) => {
32
- A || ve(s(g, e));
33
- }, [R, z] = l(de, fe ?? "", pe), B = ue ?? g.length > 7, V = f(() => o(g, R), [g, R]), H = f(() => V.map((e) => e.id), [V]), U = f(() => T ? [] : V.flatMap((e, t) => e.disabled ? [] : [t]), [V, T]), W = (e) => !T && g.some((t) => t.id === e && !t.disabled), G = ee(), [K, q] = oe(null), J = K === null ? -1 : H.indexOf(K), Y = (e) => `${j}-opt-${g.findIndex((t) => t.id === e)}`;
34
- ie(() => {
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: w && t,
42
+ shift: T && t,
43
43
  isSelectable: W
44
44
  }));
45
45
  }, Z = re(V, I), Q = (e) => {
46
- T || L(c(g, I, H, e));
46
+ E || L(ie(h, I, H, e));
47
47
  }, ye = (e) => {
48
- if (T) return;
49
- let t = te(e.key, "vertical");
48
+ if (E) return;
49
+ let t = ne(e.key, "vertical");
50
50
  if (t) {
51
51
  e.preventDefault();
52
- let n = ne(J, t, U);
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 && w && J >= 0) {
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 = b == null ? { "aria-label": E } : { "aria-labelledby": M }, $ = e(k, {
71
- invalid: S,
72
- required: C
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__ */ d("div", {
74
+ return O.wrap(/* @__PURE__ */ f("div", {
75
75
  ..._e,
76
- className: a("kapi-checklist", T && "is-disabled", A && "is-readonly", ge),
76
+ className: e("kapi-checklist", E && "is-disabled", A && "is-readonly", he),
77
77
  children: [
78
- b != null && /* @__PURE__ */ u("div", {
78
+ v != null && /* @__PURE__ */ d("div", {
79
79
  id: M,
80
80
  className: "kapi-checklist__label",
81
- children: b
81
+ children: v
82
82
  }),
83
- B && /* @__PURE__ */ u(i, {
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__ */ u(m, {}),
91
+ startIcon: /* @__PURE__ */ d(p, {}),
92
92
  clearable: !0,
93
- disabled: T,
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
- me && /* @__PURE__ */ d("div", {
100
+ pe && /* @__PURE__ */ f("div", {
101
101
  className: "kapi-checklist__bulk",
102
- children: [/* @__PURE__ */ u("button", {
102
+ children: [/* @__PURE__ */ d("button", {
103
103
  type: "button",
104
- disabled: T || A || Z === "all",
104
+ disabled: E || A || Z === "all",
105
105
  onClick: () => Q(!0),
106
106
  children: D.selectAll
107
- }), /* @__PURE__ */ u("button", {
107
+ }), /* @__PURE__ */ d("button", {
108
108
  type: "button",
109
- disabled: T || A || Z === "none",
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__ */ u("div", {
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": T || void 0,
122
+ "aria-disabled": E || void 0,
123
123
  "aria-activedescendant": J >= 0 && K !== null ? Y(K) : void 0,
124
- tabIndex: T ? -1 : 0,
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((e, t) => {
132
- let n = I.has(e.id), r = T || e.disabled === !0;
133
- return /* @__PURE__ */ d("div", {
134
- id: Y(e.id),
135
- "data-index": t,
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": n,
138
- "aria-disabled": r || void 0,
139
- "aria-label": typeof e.label == "string" ? void 0 : e.text,
140
- className: a("kapi-checklist__option", n && "is-on", t === J && "is-active", r && "is-disabled"),
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: (t) => {
145
- r || (q(e.id), X(e.id, t.shiftKey));
144
+ onClick: (e) => {
145
+ i || (q(t.id), X(t.id, e.shiftKey));
146
146
  },
147
- children: [/* @__PURE__ */ u("span", {
147
+ children: [/* @__PURE__ */ d("span", {
148
148
  className: "kapi-checklist__box",
149
149
  "aria-hidden": "true",
150
- children: n && /* @__PURE__ */ u(se, {
150
+ children: r && /* @__PURE__ */ d(ce, {
151
151
  size: 12,
152
152
  strokeWidth: 3
153
153
  })
154
- }), /* @__PURE__ */ d("span", {
154
+ }), /* @__PURE__ */ f("span", {
155
155
  className: "kapi-checklist__text",
156
- children: [/* @__PURE__ */ u("span", {
156
+ children: [/* @__PURE__ */ d("span", {
157
157
  className: "kapi-checklist__name",
158
- children: e.label
159
- }), e.description != null && /* @__PURE__ */ u("span", {
158
+ children: t.label
159
+ }), t.description != null && /* @__PURE__ */ d("span", {
160
160
  className: "kapi-checklist__desc",
161
- children: e.description
161
+ children: t.description
162
162
  })]
163
163
  })]
164
- }, e.id);
164
+ }, t.id);
165
165
  })
166
- }) : /* @__PURE__ */ u("div", {
166
+ }) : /* @__PURE__ */ d("div", {
167
167
  className: "kapi-checklist__empty",
168
168
  role: "status",
169
- children: g.length > 0 ? D.empty : null
169
+ children: h.length > 0 ? D.empty : null
170
170
  })
171
171
  ]
172
172
  }));
173
173
  }
174
174
  //#endregion
175
- export { g as CHECKLIST_SEARCH_THRESHOLD, h as DEFAULT_CHECKLIST_LABELS, _ as KapiChecklist };
175
+ export { h as CHECKLIST_SEARCH_THRESHOLD, m as DEFAULT_CHECKLIST_LABELS, g as KapiChecklist };