@konstructio/ui 0.1.2-alpha.70 → 0.1.2-alpha.72

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 (83) hide show
  1. package/dist/{Modal-BGcucTHv.js → Modal-CXRo8f-h.js} +1 -1
  2. package/dist/assets/icons/components/CheckCircleFilled.d.ts +3 -0
  3. package/dist/assets/icons/components/CheckCircleFilled.js +31 -0
  4. package/dist/assets/icons/components/CheckCircleOutline.d.ts +3 -0
  5. package/dist/assets/icons/components/{CheckCircle.js → CheckCircleOutline.js} +8 -8
  6. package/dist/assets/icons/components/CheckboxMarkedCircleOutline.d.ts +3 -0
  7. package/dist/assets/icons/components/CheckboxMarkedCircleOutline.js +26 -0
  8. package/dist/assets/icons/components/InfoCircle.d.ts +3 -0
  9. package/dist/assets/icons/components/InfoCircle.js +31 -0
  10. package/dist/assets/icons/components/WarningTriangle.d.ts +3 -0
  11. package/dist/assets/icons/components/WarningTriangle.js +28 -0
  12. package/dist/assets/icons/components/index.d.ts +5 -1
  13. package/dist/assets/icons/components/index.js +124 -116
  14. package/dist/assets/icons/index.js +124 -116
  15. package/dist/components/Alert/Alert.d.ts +5 -16
  16. package/dist/components/Alert/Alert.js +46 -32
  17. package/dist/components/Alert/Alert.types.d.ts +8 -8
  18. package/dist/components/Alert/Alert.variants.d.ts +11 -2
  19. package/dist/components/Alert/Alert.variants.js +77 -32
  20. package/dist/components/Badge/Badge.variants.d.ts +2 -2
  21. package/dist/components/Button/Button.variants.d.ts +1 -1
  22. package/dist/components/ButtonGroup/ButtonGroup.js +1 -1
  23. package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.js +1 -1
  24. package/dist/components/DateRangePicker/components/CalendarPanel/components/IndependentModeCalendar/IndependentModeCalendar.js +1 -1
  25. package/dist/components/DateRangePicker/components/CalendarPanel/components/TogetherModeCalendar/TogetherModeCalendar.js +1 -1
  26. package/dist/components/DateRangePicker/components/DateTimeInputs/hooks/useDateTimeInputs.d.ts +1 -1
  27. package/dist/components/Filter/Filter.d.ts +2 -2
  28. package/dist/components/Filter/Filter.js +20 -14
  29. package/dist/components/Filter/Filter.types.d.ts +3 -1
  30. package/dist/components/Filter/components/TextMultiSelect/TextMultiSelect.d.ts +3 -0
  31. package/dist/components/Filter/components/TextMultiSelect/TextMultiSelect.js +122 -0
  32. package/dist/components/Filter/components/TextMultiSelect/TextMultiSelect.types.d.ts +7 -0
  33. package/dist/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.d.ts +3 -0
  34. package/dist/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.hook.d.ts +14 -0
  35. package/dist/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.hook.js +74 -0
  36. package/dist/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.js +155 -0
  37. package/dist/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.types.d.ts +13 -0
  38. package/dist/components/Filter/components/index.d.ts +4 -0
  39. package/dist/components/Filter/components/index.js +8 -4
  40. package/dist/components/LineChart/LineChart.d.ts +17 -0
  41. package/dist/components/LineChart/LineChart.js +154 -0
  42. package/dist/components/LineChart/LineChart.types.d.ts +54 -0
  43. package/dist/components/Modal/Modal.js +1 -1
  44. package/dist/components/Modal/components/Wrapper/Wrapper.js +2 -2
  45. package/dist/components/Modal/components/index.js +1 -1
  46. package/dist/components/PhoneNumberInput/components/TruncateText/TruncateText.js +1 -1
  47. package/dist/components/PieChart/PieChart.js +51 -5095
  48. package/dist/components/ProgressBar/ProgressBar.variants.d.ts +1 -1
  49. package/dist/components/RadioCardGroup/RadioCardGroup.variants.d.ts +1 -1
  50. package/dist/components/RadioGroup/RadioGroup.variants.d.ts +1 -1
  51. package/dist/components/Tabs/Tabs.variants.d.ts +1 -1
  52. package/dist/components/Toast/Toast.variants.d.ts +1 -1
  53. package/dist/components/Tooltip/Tooltip.d.ts +4 -9
  54. package/dist/components/Tooltip/Tooltip.js +35 -33
  55. package/dist/components/Tooltip/Tooltip.types.d.ts +22 -11
  56. package/dist/components/Typography/Typography.variants.d.ts +1 -1
  57. package/dist/components/VirtualizedTable/VirtualizedTable.js +61 -59
  58. package/dist/components/VirtualizedTable/VirtualizedTable.types.d.ts +93 -8
  59. package/dist/components/VirtualizedTable/components/Filter/Filter.js +153 -71
  60. package/dist/components/VirtualizedTable/components/Filter/Filter.types.d.ts +7 -8
  61. package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.js +1 -1
  62. package/dist/components/VirtualizedTable/contexts/table.context.d.ts +12 -0
  63. package/dist/components/VirtualizedTable/contexts/table.context.js +9 -0
  64. package/dist/components/VirtualizedTable/contexts/table.provider.js +198 -162
  65. package/dist/components/index.d.ts +2 -1
  66. package/dist/components/index.js +124 -118
  67. package/dist/icons.d.ts +1 -1
  68. package/dist/icons.js +124 -116
  69. package/dist/{index-DPcwqB8q.js → index-B7-5g1Sm.js} +169 -168
  70. package/dist/index-qDQP8rW4.js +7281 -0
  71. package/dist/index.d.ts +1 -1
  72. package/dist/index.js +142 -135
  73. package/dist/package.json +8 -8
  74. package/dist/{proxy-CngVm5qA.js → proxy-0sbyKj-k.js} +732 -728
  75. package/dist/styles.css +1 -1
  76. package/dist/utils/index.d.ts +1 -0
  77. package/dist/utils/index.js +16 -15
  78. package/package.json +8 -8
  79. package/dist/assets/icons/components/CheckCircle.d.ts +0 -3
  80. package/dist/components/Tooltip/Tooltip.variants.d.ts +0 -6
  81. package/dist/components/Tooltip/Tooltip.variants.js +0 -86
  82. package/dist/components/Tooltip/hooks/useTooltip.d.ts +0 -4
  83. package/dist/components/Tooltip/hooks/useTooltip.js +0 -24
@@ -1,90 +1,172 @@
1
- import { jsxs as m, jsx as a } from "react/jsx-runtime";
2
- import { d as R } from "../../../../debounce-DJveWHr_.js";
3
- import { useRef as v, useCallback as u, useMemo as p } from "react";
4
- import { Button as y } from "../../../Button/Button.js";
5
- import { Filter as l } from "../../../Filter/Filter.js";
6
- import { Input as B } from "../../../Input/Input.js";
7
- import { cn as N } from "../../../../utils/index.js";
8
- import { useTableContext as T } from "../../contexts/table.hook.js";
9
- const E = ({
10
- actions: f,
11
- multiSelectFilter: h,
12
- placeholder: d,
13
- showFilterInput: g = !0,
14
- showResetButton: C = !0,
15
- resetButtonClassName: S
1
+ import { jsxs as S, jsx as s } from "react/jsx-runtime";
2
+ import { d as q } from "../../../../debounce-DJveWHr_.js";
3
+ import { useRef as z, useMemo as m, useCallback as w } from "react";
4
+ import { Button as E } from "../../../Button/Button.js";
5
+ import { Filter as n } from "../../../Filter/Filter.js";
6
+ import { Input as G } from "../../../Input/Input.js";
7
+ import { cn as H } from "../../../../utils/index.js";
8
+ import { useTableContext as J } from "../../contexts/table.hook.js";
9
+ const C = ({
10
+ actions: p,
11
+ filters: u,
12
+ multiSelectFilter: d,
13
+ placeholder: T,
14
+ showFilterInput: v = !0,
15
+ showResetButton: x = !0,
16
+ resetButtonClassName: M
16
17
  }) => {
17
- const o = v(null), {
18
- termOfSearch: s,
19
- multiselectSelected: c,
20
- onChangeTermOfSearch: n,
21
- onSelectMultiselect: i
22
- } = T(), x = u(
23
- (e, t) => i(
18
+ const l = z(null), {
19
+ termOfSearch: i,
20
+ multiselectSelected: h,
21
+ dateFilters: y,
22
+ dateRangeFilters: F,
23
+ timeFilters: b,
24
+ onChangeTermOfSearch: c,
25
+ onSelectMultiselect: D,
26
+ onSelectDateFilter: j,
27
+ onSelectDateRangeFilter: O,
28
+ onSelectTimeFilter: A
29
+ } = J(), B = m(() => {
30
+ const e = u ?? d?.map((o) => ({
31
+ ...o,
32
+ type: "badgeMultiSelect"
33
+ })) ?? [], t = p ?? [];
34
+ return [...e, ...t];
35
+ }, [u, d, p]), R = w(
36
+ (e, t) => D(
24
37
  e,
25
- t.map((r) => r.id)
38
+ t.map((o) => o.id)
26
39
  ),
27
- [i]
28
- ), F = u(() => {
29
- n(""), o.current && (o.current.value = "");
30
- }, [n]), M = p(
31
- () => R((e) => {
32
- n(e.target.value);
40
+ [D]
41
+ ), k = w(() => {
42
+ c(""), l.current && (l.current.value = "");
43
+ }, [c]), P = m(
44
+ () => q((e) => {
45
+ c(e.target.value);
33
46
  }, 500),
34
- [n]
35
- ), b = p(
36
- () => !!s || Object.entries(c ?? {}).map(([, e]) => e).flat().length > 0,
37
- [s, c]
38
- );
39
- return /* @__PURE__ */ m("div", { className: "w-full flex items-center justify-end pb-6", children: [
40
- g && /* @__PURE__ */ a(
41
- B,
47
+ [c]
48
+ ), N = m(
49
+ () => !!i || Object.values(h ?? {}).flat().length > 0 || Object.values(y ?? {}).some(Boolean) || Object.values(F ?? {}).some(Boolean) || Object.values(b ?? {}).some(Boolean),
50
+ [
51
+ i,
52
+ h,
53
+ y,
54
+ F,
55
+ b
56
+ ]
57
+ ), I = (e) => {
58
+ if (e.type === "action") {
59
+ const {
60
+ label: a,
61
+ appearance: _ = "compact",
62
+ variant: $ = "secondary",
63
+ type: K,
64
+ ...g
65
+ } = e;
66
+ return /* @__PURE__ */ s(
67
+ E,
68
+ {
69
+ appearance: _,
70
+ variant: $,
71
+ ...g,
72
+ children: a
73
+ },
74
+ a
75
+ );
76
+ }
77
+ const { key: t, label: o, position: r = "right" } = e;
78
+ return e.type === "textMultiSelect" ? /* @__PURE__ */ s(
79
+ n.TextMultiSelect,
80
+ {
81
+ label: o,
82
+ position: r,
83
+ options: e.options,
84
+ onApply: (a) => {
85
+ R(t, a);
86
+ }
87
+ },
88
+ t
89
+ ) : e.type === "date" ? /* @__PURE__ */ s(
90
+ n.DateFilterDropdown,
91
+ {
92
+ label: o,
93
+ position: r,
94
+ countryCode: e.countryCode,
95
+ onApply: (a) => {
96
+ j(t, a);
97
+ }
98
+ },
99
+ t
100
+ ) : e.type === "dateRange" ? /* @__PURE__ */ s(
101
+ n.DateRangeFilterDropdown,
102
+ {
103
+ label: o,
104
+ position: r,
105
+ showTime: e.showTime,
106
+ timeFormat: e.timeFormat,
107
+ showPresets: e.showPresets,
108
+ defaultRange: e.defaultRange,
109
+ minDate: e.minDate,
110
+ maxDate: e.maxDate,
111
+ countryCode: e.countryCode,
112
+ onApply: (a) => {
113
+ O(t, a);
114
+ },
115
+ onRangeChange: e.onRangeChange
116
+ },
117
+ t
118
+ ) : e.type === "time" ? /* @__PURE__ */ s(
119
+ n.TimeFilterDropdown,
120
+ {
121
+ label: o,
122
+ position: r,
123
+ format: e.format,
124
+ presets: e.presets,
125
+ showTimePicker: e.showTimePicker,
126
+ onApply: (a) => {
127
+ A(t, a);
128
+ }
129
+ },
130
+ t
131
+ ) : /* @__PURE__ */ s(
132
+ n.BadgeMultiSelect,
42
133
  {
43
- ref: o,
44
- placeholder: d,
134
+ label: o,
135
+ position: r,
136
+ options: e.options,
137
+ onApply: (a) => {
138
+ R(t, a);
139
+ }
140
+ },
141
+ t
142
+ );
143
+ };
144
+ return /* @__PURE__ */ S("div", { className: "w-full flex items-center justify-end pb-6", children: [
145
+ v && /* @__PURE__ */ s(
146
+ G,
147
+ {
148
+ ref: l,
149
+ placeholder: T,
45
150
  isSearch: !0,
46
151
  autoComplete: "false",
47
152
  className: "w-72",
48
153
  inputMode: "search",
49
- onChange: M
154
+ onChange: P
50
155
  }
51
156
  ),
52
- /* @__PURE__ */ m(l, { children: [
53
- h?.map(
54
- ({ key: e, label: t, position: r = "right", options: j }) => /* @__PURE__ */ a(
55
- l.BadgeMultiSelect,
56
- {
57
- label: t,
58
- position: r,
59
- options: j,
60
- onApply: (O) => {
61
- x(e, O);
62
- }
63
- },
64
- t
65
- )
66
- ),
67
- f?.map(({ label: e, onClick: t, variant: r = "secondary" }) => /* @__PURE__ */ a(
68
- y,
69
- {
70
- variant: r,
71
- appearance: "compact",
72
- onClick: t,
73
- children: e
74
- },
75
- e
76
- )),
77
- C && /* @__PURE__ */ a(
78
- l.ResetButton,
157
+ /* @__PURE__ */ S(n, { children: [
158
+ B.map(I),
159
+ x && /* @__PURE__ */ s(
160
+ n.ResetButton,
79
161
  {
80
- className: N("select-none", S),
81
- disabled: !b,
82
- onClick: F
162
+ className: H("select-none", M),
163
+ disabled: !N,
164
+ onClick: k
83
165
  }
84
166
  )
85
167
  ] })
86
168
  ] });
87
169
  };
88
170
  export {
89
- E as Filter
171
+ C as Filter
90
172
  };
@@ -1,14 +1,13 @@
1
- import { ButtonProps } from '../../../Button/Button.types';
2
- import { MultiSelectFilter } from '../../VirtualizedTable.types';
1
+ import { ActionFilterConfig, FilterConfig, MultiSelectFilter } from '../../VirtualizedTable.types';
3
2
  export type { Option } from '../../../Filter/Filter.types';
4
- export type FilterAction = {
5
- label: string;
6
- onClick: () => void;
7
- variant?: ButtonProps['variant'];
8
- };
3
+ /** @deprecated Use `ActionFilterConfig` with `type: 'action'` in the `filters` array instead */
4
+ export type FilterAction = ActionFilterConfig;
9
5
  export type Props = {
10
- actions?: FilterAction[];
6
+ filters?: FilterConfig[];
7
+ /** @deprecated Use `filters` instead */
11
8
  multiSelectFilter?: MultiSelectFilter[];
9
+ /** @deprecated Use `ActionFilterConfig` items in `filters` instead */
10
+ actions?: FilterAction[];
12
11
  placeholder: string;
13
12
  showFilterInput?: boolean;
14
13
  showResetButton?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { jsx as r, jsxs as d } from "react/jsx-runtime";
2
- import { P as u, R as b, T as m, C as p } from "../../../../index-DPcwqB8q.js";
2
+ import { P as u, R as b, T as m, C as p } from "../../../../index-B7-5g1Sm.js";
3
3
  import { d as h } from "../../../../debounce-DJveWHr_.js";
4
4
  import { useRef as x, useState as w, useCallback as g, useEffect as s } from "react";
5
5
  const v = ({ getValue: l, value: i }) => {
@@ -11,6 +11,12 @@ export type ContextType<TData extends RowData = RowData> = {
11
11
  termOfSearch?: string;
12
12
  page: number;
13
13
  multiselectSelected?: Record<string, string[]>;
14
+ dateFilters?: Record<string, string | undefined>;
15
+ dateRangeFilters?: Record<string, {
16
+ from?: string;
17
+ to?: string;
18
+ } | undefined>;
19
+ timeFilters?: Record<string, string | undefined>;
14
20
  totalPages: number;
15
21
  isFirstLoad: boolean;
16
22
  enableExpandedRow?: boolean;
@@ -28,5 +34,11 @@ export type ContextType<TData extends RowData = RowData> = {
28
34
  onSorting: Dispatch<SetStateAction<SortingState>>;
29
35
  onChangeTermOfSearch: (term: string) => void;
30
36
  onSelectMultiselect: (key: string, selectedValues: string[]) => void;
37
+ onSelectDateFilter: (key: string, date?: Date) => void;
38
+ onSelectDateRangeFilter: (key: string, range?: {
39
+ from?: Date;
40
+ to?: Date;
41
+ }) => void;
42
+ onSelectTimeFilter: (key: string, time?: Date) => void;
31
43
  };
32
44
  export declare const TableContext: import('react').Context<ContextType<unknown>>;
@@ -20,6 +20,15 @@ const r = e({
20
20
  onSelectMultiselect() {
21
21
  throw new Error("onSelectMultiselect function is not implemented");
22
22
  },
23
+ onSelectDateFilter() {
24
+ throw new Error("onSelectDateFilter function is not implemented");
25
+ },
26
+ onSelectDateRangeFilter() {
27
+ throw new Error("onSelectDateRangeFilter function is not implemented");
28
+ },
29
+ onSelectTimeFilter() {
30
+ throw new Error("onSelectTimeFilter function is not implemented");
31
+ },
23
32
  handlePage() {
24
33
  throw new Error("handlePage function is not implemented");
25
34
  },