@konstructio/ui 0.1.2-alpha.4 → 0.1.2-alpha.6

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 (95) hide show
  1. package/dist/{Modal-V67Uz78z.js → Modal-D-NOEWMX.js} +3 -3
  2. package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
  3. package/dist/{chevron-down-BLZPftpV.js → chevron-down-MZvQoT2F.js} +2 -2
  4. package/dist/chevron-right-VYBOBhRt.js +19 -0
  5. package/dist/components/Alert/Alert.js +2 -2
  6. package/dist/components/AlertDialog/AlertDialog.js +1 -1
  7. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  8. package/dist/components/AlertDialog/components/index.js +1 -1
  9. package/dist/components/Badge/Badge.js +2 -2
  10. package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
  11. package/dist/components/Breadcrumb/components/Item/Item.js +24 -23
  12. package/dist/components/Checkbox/Checkbox.js +5 -4
  13. package/dist/components/Command/Command.js +2 -2
  14. package/dist/components/Command/components/Command.js +1 -1
  15. package/dist/components/Command/components/CommandEmpty.js +1 -1
  16. package/dist/components/Command/components/CommandGroup.js +1 -1
  17. package/dist/components/Command/components/CommandInput.js +2 -2
  18. package/dist/components/Command/components/CommandItem.js +1 -1
  19. package/dist/components/Command/components/CommandList.js +1 -1
  20. package/dist/components/Command/components/CommandSeparator.js +1 -1
  21. package/dist/components/Command/components/DialogContent.js +2 -2
  22. package/dist/components/Command/components/DialogOverlay.js +1 -1
  23. package/dist/components/Datepicker/DatePicker.js +545 -543
  24. package/dist/components/Dropdown/components/List/List.js +36 -33
  25. package/dist/components/Dropdown/components/ListItem/ListItem.js +19 -18
  26. package/dist/components/Dropdown/components/Wrapper.js +3 -3
  27. package/dist/components/Dropdown/contexts/dropdown.provider.js +18 -18
  28. package/dist/components/Dropdown/hooks/useNavigationList.js +25 -25
  29. package/dist/components/DropdownButton/DropdownButton.js +1 -1
  30. package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +1 -1
  31. package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +1 -1
  32. package/dist/components/Input/Input.js +1 -1
  33. package/dist/components/Loading/Loading.js +2 -2
  34. package/dist/components/Modal/Modal.js +2 -2
  35. package/dist/components/Modal/components/Wrapper/Wrapper.js +3 -3
  36. package/dist/components/Modal/components/index.js +1 -1
  37. package/dist/components/NumberInput/NumberInput.js +2 -2
  38. package/dist/components/PieChart/PieChart.js +217 -215
  39. package/dist/components/Range/Range.js +1 -1
  40. package/dist/components/Sidebar/components/Wrapper/Wrapper.js +29 -28
  41. package/dist/components/Slider/Slider.js +1 -1
  42. package/dist/components/Switch/Switch.js +6 -5
  43. package/dist/components/Tabs/Tabs.js +1 -1
  44. package/dist/components/Tabs/components/Content.js +1 -1
  45. package/dist/components/Tabs/components/List.js +1 -1
  46. package/dist/components/Tabs/components/Trigger.js +1 -1
  47. package/dist/components/TagSelect/components/Wrapper/Wrapper.js +2 -2
  48. package/dist/components/TimePicker/components/Wrapper/Wrapper.js +1 -1
  49. package/dist/components/Toast/Toast.js +8 -7
  50. package/dist/components/VirtualizedTable/VirtualizedTable.js +99 -0
  51. package/dist/components/VirtualizedTable/VirtualizedTable.variants.js +5 -0
  52. package/dist/components/VirtualizedTable/assets/chevron-down.js +25 -0
  53. package/dist/components/VirtualizedTable/assets/chevron-up.js +25 -0
  54. package/dist/components/VirtualizedTable/assets/index.js +6 -0
  55. package/dist/components/VirtualizedTable/components/Actions/Actions.js +46 -0
  56. package/dist/components/VirtualizedTable/components/Body/Body.js +25 -0
  57. package/dist/components/VirtualizedTable/components/DotPaginate/DotPaginate.js +165 -0
  58. package/dist/components/VirtualizedTable/components/DropdownPaginate/DropdownPaginate.js +34 -0
  59. package/dist/components/VirtualizedTable/components/Filter/Filter.js +73 -0
  60. package/dist/components/VirtualizedTable/components/FormPaginate/FormPaginate.js +48 -0
  61. package/dist/components/VirtualizedTable/components/Header/Header.js +82 -0
  62. package/dist/components/VirtualizedTable/components/Pagination/Pagination.js +45 -0
  63. package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.js +1870 -0
  64. package/dist/components/VirtualizedTable/components/index.js +14 -0
  65. package/dist/components/VirtualizedTable/constants/index.js +5 -0
  66. package/dist/components/VirtualizedTable/constants/pagination.js +5 -0
  67. package/dist/components/VirtualizedTable/contexts/index.js +8 -0
  68. package/dist/components/VirtualizedTable/contexts/table.context.js +31 -0
  69. package/dist/components/VirtualizedTable/contexts/table.hook.js +11 -0
  70. package/dist/components/VirtualizedTable/contexts/table.provider.js +778 -0
  71. package/dist/components/index.js +44 -40
  72. package/dist/{createLucideIcon-DbC6TvM5.js → createLucideIcon-D2CN7Ma9.js} +4 -4
  73. package/dist/debounce-BFejQm9P.js +200 -0
  74. package/dist/{index-D3xzCzcO.js → index-B7t8D14s.js} +2 -2
  75. package/dist/index-BAEWsOG1.js +27 -0
  76. package/dist/{index-C9T9HQaa.js → index-BITvcJAz.js} +1 -1
  77. package/dist/index-BZPx6jYI.js +8 -0
  78. package/dist/{index-BAraV3ai.js → index-Bnb0ezr3.js} +1 -1
  79. package/dist/{index-DB2XhXHn.js → index-C84F4YyO.js} +11 -10
  80. package/dist/index-Cd2vhaop.js +137 -0
  81. package/dist/{index-iXyXtdgP.js → index-DBbEcSUG.js} +1 -1
  82. package/dist/index-Dx2grAuN.js +1742 -0
  83. package/dist/{index-BXuxPoz7.js → index-DzIBBMjs.js} +18 -17
  84. package/dist/{index-h-Ul0anl.js → index-N2OStZoU.js} +1 -1
  85. package/dist/{index-Oq5GlCHP.js → index-os7vysFS.js} +1 -1
  86. package/dist/index-ti1b9kqV.js +14 -0
  87. package/dist/index.d.ts +88 -3
  88. package/dist/index.js +41 -37
  89. package/dist/package.json +19 -15
  90. package/dist/styles.css +1 -1
  91. package/dist/{x-BPcqkRZd.js → x-4F_5p77m.js} +1 -1
  92. package/package.json +19 -15
  93. package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
  94. package/dist/index-CZnD2QxM.js +0 -32
  95. package/dist/index-CrBonFvu.js +0 -144
@@ -0,0 +1,34 @@
1
+ import { jsxs as i, jsx as a } from "react/jsx-runtime";
2
+ import { useMemo as p, useCallback as l } from "react";
3
+ import { Dropdown as c } from "../../../Dropdown/Dropdown.js";
4
+ import { DEFAULT_PAGE_SIZES as g } from "../../constants/pagination.js";
5
+ import { useTableContext as x } from "../../contexts/table.hook.js";
6
+ const b = ({
7
+ pageSizes: n = g
8
+ }) => {
9
+ const { pageSize: s, onPageSize: o, handlePage: t } = x(), r = p(
10
+ () => n.map(String).map((e) => ({ label: e, value: e })),
11
+ []
12
+ ), m = l(
13
+ (e) => {
14
+ o(Number(e)), t(0);
15
+ },
16
+ [t, o]
17
+ );
18
+ return /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
19
+ /* @__PURE__ */ a("span", { children: "Show" }),
20
+ /* @__PURE__ */ a(
21
+ c,
22
+ {
23
+ className: "w-[88px] [&>div>p]:text-xs bg-white",
24
+ listItemClassName: "[&>p]:text-xs",
25
+ options: r,
26
+ value: s.toString(),
27
+ onChange: ({ target: e }) => m(e.value)
28
+ }
29
+ )
30
+ ] });
31
+ };
32
+ export {
33
+ b as DropdownPaginate
34
+ };
@@ -0,0 +1,73 @@
1
+ import { jsxs as m, jsx as a } from "react/jsx-runtime";
2
+ import { d as M } from "../../../../debounce-BFejQm9P.js";
3
+ import { useRef as j, useCallback as u, useMemo as f } from "react";
4
+ import { Filter as n } from "../../../Filter/Filter.js";
5
+ import { Input as v } from "../../../Input/Input.js";
6
+ import { useTableContext as O } from "../../contexts/table.hook.js";
7
+ const B = ({
8
+ placeholder: h,
9
+ multiSelectFilter: d,
10
+ showFilterInput: p = !0
11
+ }) => {
12
+ const r = j(null), {
13
+ termOfSearch: o,
14
+ multiselectSelected: c,
15
+ onChangeTermOfSearch: t,
16
+ onSelectMultiselect: i
17
+ } = O(), g = u(
18
+ (e, l) => i(
19
+ e,
20
+ l.map((s) => s.id)
21
+ ),
22
+ [i]
23
+ ), x = u(() => {
24
+ t(""), r.current && (r.current.value = "");
25
+ }, [t]), C = f(
26
+ () => M((e) => {
27
+ t(e.target.value);
28
+ }, 500),
29
+ [t]
30
+ ), S = f(
31
+ () => !!o || Object.entries(c ?? {}).map(([, e]) => e).flat().length > 0,
32
+ [o, c]
33
+ );
34
+ return /* @__PURE__ */ m("div", { className: "w-full flex items-center justify-end pb-6", children: [
35
+ p && /* @__PURE__ */ a(
36
+ v,
37
+ {
38
+ ref: r,
39
+ placeholder: h,
40
+ isSearch: !0,
41
+ autoComplete: "false",
42
+ className: "w-72",
43
+ inputMode: "search",
44
+ onChange: C
45
+ }
46
+ ),
47
+ /* @__PURE__ */ m(n, { children: [
48
+ d?.map(
49
+ ({ key: e, label: l, position: s = "right", options: b }) => /* @__PURE__ */ a(
50
+ n.BadgeMultiSelect,
51
+ {
52
+ label: l,
53
+ position: s,
54
+ options: b,
55
+ onApply: (F) => g(e, F)
56
+ },
57
+ l
58
+ )
59
+ ),
60
+ /* @__PURE__ */ a(
61
+ n.ResetButton,
62
+ {
63
+ className: "text-slate-700 hover:text-slate-700 disabled:text-slate-700/45 select-none",
64
+ disabled: !S,
65
+ onClick: x
66
+ }
67
+ )
68
+ ] })
69
+ ] });
70
+ };
71
+ export {
72
+ B as Filter
73
+ };
@@ -0,0 +1,48 @@
1
+ import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
+ import { useRef as l, useCallback as p } from "react";
3
+ import { Input as c } from "../../../Input/Input.js";
4
+ import { useTableContext as f } from "../../contexts/table.hook.js";
5
+ const h = () => {
6
+ const r = l(null), { totalPages: e, handlePage: o } = f(), m = p(
7
+ (n) => {
8
+ n.preventDefault();
9
+ const s = new FormData(n.currentTarget), a = Number(s.get("jump-to")), u = (a < e ? a : e) || 1;
10
+ o(u - 1), r.current?.reset();
11
+ },
12
+ [o, e]
13
+ );
14
+ return /* @__PURE__ */ i(
15
+ "form",
16
+ {
17
+ "aria-label": "footer-pagination",
18
+ ref: r,
19
+ onSubmit: m,
20
+ className: "flex items-center gap-2",
21
+ children: [
22
+ /* @__PURE__ */ t("span", { className: "min-w-fit", children: "Jump to" }),
23
+ /* @__PURE__ */ t(
24
+ c,
25
+ {
26
+ type: "number",
27
+ className: "w-[72px] text-xs no-spinner",
28
+ name: "jump-to",
29
+ min: 1,
30
+ max: e,
31
+ required: !0
32
+ }
33
+ ),
34
+ /* @__PURE__ */ t(
35
+ "button",
36
+ {
37
+ type: "submit",
38
+ className: "text-xs text-blue-600 p-2 cursor-pointer",
39
+ children: "Go"
40
+ }
41
+ )
42
+ ]
43
+ }
44
+ );
45
+ };
46
+ export {
47
+ h as FormPaginate
48
+ };
@@ -0,0 +1,82 @@
1
+ import { jsx as s, jsxs as a } from "react/jsx-runtime";
2
+ import { f as u } from "../../../../index-Dx2grAuN.js";
3
+ import { useCallback as i } from "react";
4
+ import { cn as o } from "../../../../utils/index.js";
5
+ import b from "../../assets/chevron-up.js";
6
+ import g from "../../assets/chevron-down.js";
7
+ import { useTableContext as S } from "../../contexts/table.hook.js";
8
+ const y = ({
9
+ className: p,
10
+ classNameArrows: n,
11
+ classNameActiveArrows: l
12
+ }) => {
13
+ const { table: c, onSorting: r } = S(), d = i(
14
+ (t) => r([{ id: t.id, desc: !1 }]),
15
+ [r]
16
+ ), x = i(
17
+ (t) => r([{ id: t.id, desc: !0 }]),
18
+ [r]
19
+ );
20
+ return /* @__PURE__ */ s(
21
+ "thead",
22
+ {
23
+ className: o(
24
+ "font-semibold uppercase text-slate-500 text-xs not-italic bg-slate-100 w-full relative block overflow-hidden [clip-path:inset(-1px_-1px_0px_-1px_round_8px_8px_0px_0px)]",
25
+ p
26
+ ),
27
+ children: c.getHeaderGroups().map(({ id: t, headers: f }) => /* @__PURE__ */ s("tr", { className: "table w-full table-fixed", children: f.map(({ id: m, column: e, getContext: h }) => /* @__PURE__ */ s(
28
+ "th",
29
+ {
30
+ scope: "col",
31
+ className: "px-4 py-3 text-left text-xs",
32
+ style: { width: e.columnDef.size },
33
+ children: /* @__PURE__ */ a("span", { className: "flex items-center gap-2 w-full", children: [
34
+ u(e.columnDef.header, h()),
35
+ e.getCanSort() && /* @__PURE__ */ a(
36
+ "div",
37
+ {
38
+ className: o(
39
+ "flex flex-col text-slate-400 justify-center items-center gap-1",
40
+ n
41
+ ),
42
+ role: "presentation",
43
+ children: [
44
+ /* @__PURE__ */ s(
45
+ b,
46
+ {
47
+ className: o(
48
+ "w-2 h-2 cursor-pointer",
49
+ {
50
+ "text-blue-600": e.getIsSorted() === "asc"
51
+ },
52
+ l
53
+ ),
54
+ onClick: () => d(e)
55
+ }
56
+ ),
57
+ /* @__PURE__ */ s(
58
+ g,
59
+ {
60
+ className: o(
61
+ "w-2 h-2 cursor-pointer",
62
+ {
63
+ "text-blue-600": e.getIsSorted() === "desc"
64
+ },
65
+ l
66
+ ),
67
+ onClick: () => x(e)
68
+ }
69
+ )
70
+ ]
71
+ }
72
+ )
73
+ ] })
74
+ },
75
+ m
76
+ )) }, t))
77
+ }
78
+ );
79
+ };
80
+ export {
81
+ y as Header
82
+ };
@@ -0,0 +1,45 @@
1
+ import { jsxs as t, Fragment as c, jsx as e } from "react/jsx-runtime";
2
+ import { DotPaginate as d } from "../DotPaginate/DotPaginate.js";
3
+ import { DropdownPaginate as p } from "../DropdownPaginate/DropdownPaginate.js";
4
+ import { FormPaginate as f } from "../FormPaginate/FormPaginate.js";
5
+ import { cn as x } from "../../../../utils/index.js";
6
+ import { useTableContext as u } from "../../contexts/table.hook.js";
7
+ import { DEFAULT_PAGE_SIZE as g } from "../../constants/pagination.js";
8
+ const F = ({
9
+ showTotalItems: a = !0,
10
+ showDropdownPagination: i = !0,
11
+ showDotPagination: n = !0,
12
+ showFormPagination: s = !0,
13
+ pageSizes: l,
14
+ classNamePagination: o
15
+ }) => {
16
+ const { totalItems: r = -1 / 0, tableFetching: m } = u();
17
+ return r <= g || m ? null : /* @__PURE__ */ t(c, { children: [
18
+ /* @__PURE__ */ e(
19
+ "div",
20
+ {
21
+ className: x(
22
+ "bg-slate-50 border border-y-transparent border-x-slate-100 text-slate-500 text-xs not-italic py-2 px-6 rounded-b-lg shadow",
23
+ o
24
+ ),
25
+ children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
26
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-6", children: [
27
+ r && a ? /* @__PURE__ */ t("span", { className: "text-slate-800", children: [
28
+ r,
29
+ " Results"
30
+ ] }) : null,
31
+ i && /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e(p, { pageSizes: l }) })
32
+ ] }),
33
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-8", children: [
34
+ n && /* @__PURE__ */ e(d, {}),
35
+ s && /* @__PURE__ */ e(f, {})
36
+ ] })
37
+ ] })
38
+ }
39
+ ),
40
+ /* @__PURE__ */ e("div", { className: "w-full min-h-[150px]" })
41
+ ] });
42
+ };
43
+ export {
44
+ F as Pagination
45
+ };