@konstructio/ui 0.1.2-alpha.108 → 0.1.2-alpha.109

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 (27) hide show
  1. package/dist/Wrapper-Bbaaa7YA.js +218 -0
  2. package/dist/components/DateRangePicker/DateRangePicker.js +33 -32
  3. package/dist/components/DateRangePicker/components/DateTimeInputs/DateTimeInputs.js +49 -47
  4. package/dist/components/DateRangePicker/components/DateTimeInputs/components/EndInputFields/EndInputFields.js +27 -26
  5. package/dist/components/DateRangePicker/components/DateTimeInputs/components/StartInputFields/StartInputFields.js +27 -26
  6. package/dist/components/Filter/components/FilterDropdown/FilterDropdown.js +3 -3
  7. package/dist/components/Select/Select.js +17 -16
  8. package/dist/components/Select/components/Wrapper.js +1 -1
  9. package/dist/components/Select/components/index.js +1 -1
  10. package/dist/components/Select/contexts/select.provider.js +34 -33
  11. package/dist/components/Select/hooks/useSelect.js +35 -34
  12. package/dist/components/VirtualizedTable/components/Actions/components/PortalActions/hooks/use-menu-interactions/use-menu-interactions.js +9 -9
  13. package/dist/components/VirtualizedTable/components/DropdownPaginate/DropdownPaginate.js +16 -16
  14. package/dist/dist-ByCJijZd.js +174 -0
  15. package/dist/hooks/useClickOutside.js +8 -8
  16. package/dist/lib/components/DateRangePicker/DateRangePicker.types.d.ts +7 -1
  17. package/dist/lib/components/DateRangePicker/components/DateTimeInputs/DateTimeInputs.types.d.ts +3 -0
  18. package/dist/lib/components/DateRangePicker/components/DateTimeInputs/components/EndInputFields/EndInputFields.types.d.ts +3 -1
  19. package/dist/lib/components/DateRangePicker/components/DateTimeInputs/components/StartInputFields/StartInputFields.types.d.ts +3 -1
  20. package/dist/lib/components/Select/Select.types.d.ts +3 -0
  21. package/dist/lib/components/Select/contexts/select.provider.d.ts +1 -0
  22. package/dist/lib/components/Select/hooks/useSelect.d.ts +3 -1
  23. package/dist/lib/hooks/useClickOutside.d.ts +3 -1
  24. package/dist/package.json +1 -1
  25. package/package.json +1 -1
  26. package/dist/Wrapper-2AUlYAHQ.js +0 -195
  27. package/dist/dist-BnCbAI-c.js +0 -166
@@ -7,4 +7,5 @@ export declare const SelectProvider: FC<PropsWithChildren & {
7
7
  options: Option[];
8
8
  onChange?: SelectProps['onChange'];
9
9
  onBlur?: SelectProps['onBlur'];
10
+ onValueChange?: SelectProps['onValueChange'];
10
11
  }>;
@@ -4,9 +4,11 @@ type UseSelectParams = {
4
4
  inputRef?: RefObject<ComponentRef<'input'> | null>;
5
5
  searchInputRef?: RefObject<ComponentRef<'input'> | null>;
6
6
  internalValue?: Option;
7
+ listRef?: RefObject<HTMLElement | null>;
7
8
  onBlur?: SelectProps['onBlur'];
8
9
  };
9
- export declare const useSelect: ({ inputRef, searchInputRef, internalValue, onBlur, }: UseSelectParams) => {
10
+ export declare const useSelect: ({ inputRef, searchInputRef, internalValue, listRef, onBlur, }: UseSelectParams) => {
11
+ isInside: (node: Node | null) => boolean;
10
12
  wrapperRef: RefObject<HTMLDivElement | null>;
11
13
  wrapperInputRef: RefObject<HTMLDivElement | null>;
12
14
  handleOpen: () => void;
@@ -1,2 +1,4 @@
1
1
  import { RefObject } from 'react';
2
- export declare const useClickOutside: (ref: RefObject<HTMLElement | null>, onClickOutside: () => void) => void;
2
+ type Target = RefObject<HTMLElement | null> | undefined;
3
+ export declare const useClickOutside: (refs: Target | Target[], onClickOutside: () => void) => void;
4
+ export {};
package/dist/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.2-alpha.107",
5
+ "version": "0.1.2-alpha.108",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.2-alpha.108",
5
+ "version": "0.1.2-alpha.109",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
@@ -1,195 +0,0 @@
1
- import { t as r } from "./utils-B-6R7kNE.js";
2
- import { LoaderIcon as ue } from "./assets/icons/components/Loader.js";
3
- import { t as me } from "./createLucideIcon-MbzNWCaI.js";
4
- import { t as de } from "./chevron-up-Bjpvg6ui.js";
5
- import { Typography as pe } from "./components/Typography/Typography.js";
6
- import { useSelectContext as fe } from "./components/Select/contexts/select.hook.js";
7
- import { List as xe } from "./components/Select/components/List/List.js";
8
- import { inputVariants as he, labelVariants as ve, selectVariants as ye } from "./components/Select/Select.variants.js";
9
- import { useSelect as we } from "./components/Select/hooks/useSelect.js";
10
- import { forwardRef as Ne, useEffect as ge, useImperativeHandle as ke, useMemo as Ce, useRef as y } from "react";
11
- import { jsx as n, jsxs as u } from "react/jsx-runtime";
12
- var be = [["path", {
13
- d: "m21 21-4.34-4.34",
14
- key: "14j7rj"
15
- }], ["circle", {
16
- cx: "11",
17
- cy: "11",
18
- r: "8",
19
- key: "4ej97u"
20
- }]], Ie = me("search", be), $e = Ne(({ additionalOptions: S, className: E, defaultValue: w, describedBy: k, fieldId: N, disabled: a = !1, error: s, groupedOptions: F, iconClassName: $, inputClassName: K, isInfiniteScrollEnabled: M = !1, isLoading: C, isRequired: f, loadingText: W, label: o, labelAction: _, labelClassName: q, labelWrapperClassName: A, listClassName: H, listItemClassName: P, listItemSecondRowClassName: U, name: b, noOptionsText: B, placeholder: x, searchable: I = !1, showSearchIcon: g, theme: G, visibleItems: J, wrapperClassName: Q, onFetchMoreOptions: X, onBlur: Y, onSearchChange: Z, ...j }, ee) => {
21
- const h = `${N}-label`, L = `${N}-control`, O = `${N}-listbox`, m = y(null), V = y(null), z = y(null), te = y(0), { isOpen: l, options: i, searchTerm: ae, value: c, setCanFilter: re, setSearchTerm: ne, setValue: d, toggleOpen: oe } = fe(), t = Ce(() => i.find(({ value: e }) => e === c), [i, c]), { wrapperRef: le, wrapperInputRef: D, handleOpen: v } = we({
22
- inputRef: m,
23
- searchInputRef: V,
24
- internalValue: t,
25
- onBlur: Y
26
- }), R = () => {
27
- if (!a) {
28
- if (l) {
29
- oe(!1);
30
- return;
31
- }
32
- v();
33
- }
34
- }, ie = (e) => {
35
- if (!a) {
36
- if (e.key === "ArrowDown") {
37
- if (e.preventDefault(), !l) {
38
- v();
39
- return;
40
- }
41
- z.current?.querySelector('li:not([data-action="true"])')?.focus();
42
- return;
43
- }
44
- e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), R());
45
- }
46
- };
47
- ke(ee, () => m.current, [m]), ge(() => {
48
- if (w && !c) {
49
- const e = i && i.find((p) => p.value === w);
50
- e && d(e.value);
51
- }
52
- }, [
53
- w,
54
- i,
55
- d,
56
- c
57
- ]);
58
- const se = (e) => {
59
- const p = e.target.value;
60
- re(!0), d(""), ne(p ?? ""), Z?.(p);
61
- const T = i.find((ce) => ce.value.toLocaleLowerCase() === p.toLocaleLowerCase());
62
- d(T ? T.value : t?.value ?? "");
63
- };
64
- return /* @__PURE__ */ u("div", {
65
- ref: le,
66
- className: r("flex flex-col gap-2 w-full relative", Q),
67
- "data-theme": G,
68
- children: [
69
- o ? /* @__PURE__ */ u("div", {
70
- className: r("flex items-center justify-between", A),
71
- children: [/* @__PURE__ */ u("label", {
72
- id: h,
73
- className: r(ve({ className: q })),
74
- htmlFor: L,
75
- onClick: () => !a && v(),
76
- children: [o, f && /* @__PURE__ */ n("span", {
77
- "aria-hidden": "true",
78
- className: "text-red-600 dark:text-red-500 ml-1",
79
- children: "*"
80
- })]
81
- }), _]
82
- }) : null,
83
- /* @__PURE__ */ u("div", {
84
- ref: D,
85
- id: L,
86
- className: r(ye({
87
- className: E,
88
- hasError: !!s,
89
- disabled: a
90
- })),
91
- role: "combobox",
92
- onClick: R,
93
- onKeyDown: ie,
94
- "aria-expanded": l,
95
- tabIndex: te.current,
96
- "aria-labelledby": o ? h : void 0,
97
- "aria-label": o ? void 0 : x,
98
- "aria-haspopup": "listbox",
99
- "aria-controls": l ? O : void 0,
100
- "aria-invalid": !!s || void 0,
101
- "aria-describedby": k,
102
- "aria-required": f || void 0,
103
- "aria-disabled": a || void 0,
104
- children: [/* @__PURE__ */ u("div", {
105
- className: "flex gap-2.5 items-center flex-1",
106
- children: [
107
- t?.leftIcon && !g && /* @__PURE__ */ n("span", {
108
- className: "w-4 h-4 flex justify-center items-center dark:text-metal-50",
109
- children: t.leftIcon
110
- }),
111
- g && /* @__PURE__ */ n(Ie, { className: r("w-4", "h-4", "text-zinc-500", "select-none", "transition-colors", "duration-300", "dark:text-metal-300", "dark:group-focus-within:text-metal-50") }),
112
- I ? /* @__PURE__ */ n("input", {
113
- ref: V,
114
- type: "text",
115
- value: l ? ae : t?.label ?? c ?? "",
116
- onChange: se,
117
- placeholder: x,
118
- className: r(he({ className: K }), { "text-red-700 placeholder:text-red-700": !!s }),
119
- onClick: (e) => {
120
- e.stopPropagation(), a || v();
121
- },
122
- "aria-labelledby": o ? h : void 0,
123
- "aria-label": o ? void 0 : x,
124
- "aria-invalid": !!s || void 0,
125
- "aria-describedby": k,
126
- required: f,
127
- autoComplete: "off",
128
- autoCapitalize: "words",
129
- disabled: a,
130
- tabIndex: -1,
131
- ...j
132
- }) : /* @__PURE__ */ u(pe, {
133
- variant: "body2",
134
- className: r("flex-1 text-zinc-400 text-sm dark:text-metal-400 flex gap-2 items-center", {
135
- "text-red-700": !!s,
136
- "select-none": !t,
137
- "text-metal-800 dark:text-metal-50": t,
138
- "text-metal-400/50 dark:text-metal-50/50": a
139
- }, t?.wrapperClassNameOnSelectedValue),
140
- children: [
141
- t?.label || x,
142
- " ",
143
- t?.showRightComponentOnselectedValue ? t?.rightComponent : null
144
- ]
145
- })
146
- ]
147
- }), C ? /* @__PURE__ */ n(ue, {
148
- size: 16,
149
- className: "text-metal-400 animate-spin select-none"
150
- }) : !g && /* @__PURE__ */ n(de, {
151
- "data-state": l ? "open" : "closed",
152
- className: r("w-4 h-4 text-zinc-500 transition-all duration-100 data-[state=open]:rotate-0 data-[state=closed]:rotate-180 select-none dark:group-focus-within:text-metal-50", $, {
153
- "text-red-700": !!s,
154
- "text-metal-400/50 dark:group-focus-within:text-zinc-500": a
155
- })
156
- })]
157
- }),
158
- /* @__PURE__ */ n("input", {
159
- ref: m,
160
- type: "text",
161
- name: b,
162
- className: "hidden",
163
- "aria-hidden": "true",
164
- required: f,
165
- inert: !0,
166
- defaultValue: t?.value ?? c ?? void 0,
167
- ...j
168
- }),
169
- l && /* @__PURE__ */ n(xe, {
170
- ref: z,
171
- id: O,
172
- labelledBy: o ? h : void 0,
173
- additionalOptions: S,
174
- className: H,
175
- groupedOptions: F,
176
- itemClassName: P,
177
- name: b,
178
- wrapperInputRef: D,
179
- inputRef: m,
180
- options: i,
181
- isLoading: !!C,
182
- searchable: I,
183
- listItemSecondRowClassName: U,
184
- isInfiniteScrollEnabled: M,
185
- onFetchMoreOptions: X,
186
- noOptionsText: B,
187
- loadingText: W,
188
- visibleItems: J
189
- })
190
- ]
191
- });
192
- });
193
- export {
194
- $e as t
195
- };
@@ -1,166 +0,0 @@
1
- import { a as _, n as D } from "./dist-xCbHbMLA.js";
2
- import { t as M } from "./dist-CCdbu9GU.js";
3
- import { i as I, r as m, t as T } from "./dist-D-yS0HN8.js";
4
- import { t as k } from "./dist-DYIabsrY.js";
5
- import { n as y } from "./dist-DKryKPmP.js";
6
- import { n as N, r as $, t as G } from "./es2015-CoHq2g4y.js";
7
- import { t as L } from "./dist-C4j75TwZ.js";
8
- import { t as A } from "./dist-BUocnzkM.js";
9
- import { t as j } from "./Combination-CnMM05mt.js";
10
- import { a as b, i as H, r as K, t as U } from "./dist-9WbMf_jT.js";
11
- import * as i from "react";
12
- import { jsx as s } from "react/jsx-runtime";
13
- var V = Object.defineProperty, l = (p, e) => V(p, "name", {
14
- value: e,
15
- configurable: !0
16
- }), R = "Popover", [F, fe] = I(R, [b]), O = b(), [Z, v] = F(R), q = /* @__PURE__ */ l((p) => {
17
- const { __scopePopover: e, children: c, open: r, defaultOpen: n, onOpenChange: t, modal: o = !1 } = p, a = O(e), u = i.useRef(null), [P, d] = i.useState(!1), [C, f] = T({
18
- prop: r,
19
- defaultProp: n ?? !1,
20
- onChange: t,
21
- caller: R
22
- });
23
- return /* @__PURE__ */ s(H, {
24
- ...a,
25
- children: /* @__PURE__ */ s(Z, {
26
- scope: e,
27
- contentId: k(),
28
- triggerRef: u,
29
- open: C,
30
- onOpenChange: f,
31
- onOpenToggle: i.useCallback(() => f((g) => !g), [f]),
32
- hasCustomAnchor: P,
33
- onCustomAnchorAdd: i.useCallback(() => d(!0), []),
34
- onCustomAnchorRemove: i.useCallback(() => d(!1), []),
35
- modal: o,
36
- children: c
37
- })
38
- });
39
- }, "Popover"), z = "PopoverTrigger", B = /* @__PURE__ */ i.forwardRef(/* @__PURE__ */ l(function(e, c) {
40
- const { __scopePopover: r, ...n } = e, t = v(z, r), o = O(r), a = _(c, t.triggerRef), u = /* @__PURE__ */ s(M.button, {
41
- type: "button",
42
- "aria-haspopup": "dialog",
43
- "aria-expanded": t.open,
44
- "aria-controls": t.open ? t.contentId : void 0,
45
- "data-state": x(t.open),
46
- ...n,
47
- ref: a,
48
- onClick: m(e.onClick, t.onOpenToggle)
49
- });
50
- return t.hasCustomAnchor ? u : /* @__PURE__ */ s(U, {
51
- asChild: !0,
52
- ...o,
53
- children: u
54
- });
55
- }, "PopoverTrigger")), E = "PopoverPortal", [J, Q] = F(E, { forceMount: void 0 }), W = /* @__PURE__ */ l((p) => {
56
- const { __scopePopover: e, forceMount: c, children: r, container: n } = p, t = v(E, e);
57
- return /* @__PURE__ */ s(J, {
58
- scope: e,
59
- forceMount: c,
60
- children: /* @__PURE__ */ s(A, {
61
- present: c || t.open,
62
- children: /* @__PURE__ */ s(L, {
63
- asChild: !0,
64
- container: n,
65
- children: r
66
- })
67
- })
68
- });
69
- }, "PopoverPortal"), h = "PopoverContent", X = /* @__PURE__ */ i.forwardRef(/* @__PURE__ */ l(function(e, c) {
70
- const r = Q(h, e.__scopePopover), { forceMount: n = r.forceMount, ...t } = e, o = v(h, e.__scopePopover);
71
- return /* @__PURE__ */ s(A, {
72
- present: n || o.open,
73
- children: o.modal ? /* @__PURE__ */ s(ee, {
74
- ...t,
75
- ref: c
76
- }) : /* @__PURE__ */ s(oe, {
77
- ...t,
78
- ref: c
79
- })
80
- });
81
- }, "PopoverContent")), Y = D("PopoverContent.RemoveScroll"), ee = /* @__PURE__ */ i.forwardRef(/* @__PURE__ */ l(function(e, c) {
82
- const r = v(h, e.__scopePopover), n = i.useRef(null), t = _(c, n), o = i.useRef(!1);
83
- return i.useEffect(() => {
84
- const a = n.current;
85
- if (a) return G(a);
86
- }, []), /* @__PURE__ */ s(j, {
87
- as: Y,
88
- allowPinchZoom: !0,
89
- children: /* @__PURE__ */ s(w, {
90
- ...e,
91
- ref: t,
92
- trapFocus: r.open,
93
- disableOutsidePointerEvents: !0,
94
- onCloseAutoFocus: m(e.onCloseAutoFocus, (a) => {
95
- a.preventDefault(), o.current || r.triggerRef.current?.focus();
96
- }),
97
- onPointerDownOutside: m(e.onPointerDownOutside, (a) => {
98
- const u = a.detail.originalEvent, P = u.button === 0 && u.ctrlKey === !0, d = u.button === 2 || P;
99
- o.current = d;
100
- }, { checkForDefaultPrevented: !1 }),
101
- onFocusOutside: m(e.onFocusOutside, (a) => a.preventDefault(), { checkForDefaultPrevented: !1 })
102
- })
103
- });
104
- }, "PopoverContentModal")), oe = /* @__PURE__ */ i.forwardRef(/* @__PURE__ */ l(function(e, c) {
105
- const r = v(h, e.__scopePopover), n = i.useRef(!1), t = i.useRef(!1);
106
- return /* @__PURE__ */ s(w, {
107
- ...e,
108
- ref: c,
109
- trapFocus: !1,
110
- disableOutsidePointerEvents: !1,
111
- onCloseAutoFocus: (o) => {
112
- e.onCloseAutoFocus?.(o), o.defaultPrevented || (n.current || r.triggerRef.current?.focus(), o.preventDefault()), n.current = !1, t.current = !1;
113
- },
114
- onInteractOutside: (o) => {
115
- e.onInteractOutside?.(o), o.defaultPrevented || (n.current = !0, o.detail.originalEvent.type === "pointerdown" && (t.current = !0));
116
- const a = o.target;
117
- r.triggerRef.current?.contains(a) && o.preventDefault(), o.detail.originalEvent.type === "focusin" && t.current && o.preventDefault();
118
- }
119
- });
120
- }, "PopoverContentNonModal")), w = /* @__PURE__ */ i.forwardRef(/* @__PURE__ */ l(function(e, c) {
121
- const { __scopePopover: r, trapFocus: n, onOpenAutoFocus: t, onCloseAutoFocus: o, disableOutsidePointerEvents: a, onEscapeKeyDown: u, onPointerDownOutside: P, onFocusOutside: d, onInteractOutside: C, ...f } = e, g = v(h, r), S = O(r);
122
- return N(), /* @__PURE__ */ s($, {
123
- asChild: !0,
124
- loop: !0,
125
- trapped: n,
126
- onMountAutoFocus: t,
127
- onUnmountAutoFocus: o,
128
- children: /* @__PURE__ */ s(y, {
129
- asChild: !0,
130
- disableOutsidePointerEvents: a,
131
- onInteractOutside: C,
132
- onEscapeKeyDown: u,
133
- onPointerDownOutside: P,
134
- onFocusOutside: d,
135
- onDismiss: () => g.onOpenChange(!1),
136
- deferPointerDownOutside: !0,
137
- children: /* @__PURE__ */ s(K, {
138
- "data-state": x(g.open),
139
- role: "dialog",
140
- id: g.contentId,
141
- ...S,
142
- ...f,
143
- ref: c,
144
- style: {
145
- ...f.style,
146
- "--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
147
- "--radix-popover-content-available-width": "var(--radix-popper-available-width)",
148
- "--radix-popover-content-available-height": "var(--radix-popper-available-height)",
149
- "--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
150
- "--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
151
- }
152
- })
153
- })
154
- });
155
- }, "PopoverContentImpl"));
156
- function x(p) {
157
- return p ? "open" : "closed";
158
- }
159
- l(x, "getState");
160
- var ve = q, Pe = B, ge = W, he = X;
161
- export {
162
- Pe as i,
163
- ge as n,
164
- ve as r,
165
- he as t
166
- };