@companix/uikit 0.0.12 → 0.0.15
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/dist/DatePicker/index.d.ts +0 -1
- package/dist/Input/index.d.ts +1 -1
- package/dist/Select/SelectInput.d.ts +1 -0
- package/dist/Select/index.d.ts +12 -7
- package/dist/SelectTags/index.d.ts +1 -0
- package/dist/TextArea/index.d.ts +2 -1
- package/dist/__hooks/use-loading.d.ts +2 -2
- package/dist/bundle.es23.js +17 -15
- package/dist/bundle.es24.js +36 -34
- package/dist/bundle.es32.js +24 -22
- package/dist/bundle.es37.js +13 -20
- package/dist/bundle.es45.js +2 -2
- package/dist/bundle.es8.js +48 -50
- package/package.json +3 -4
|
@@ -2,7 +2,6 @@ import { FormProps } from '../Input';
|
|
|
2
2
|
import { CalendarProps } from './Calendar';
|
|
3
3
|
interface DatePickerProps extends Omit<CalendarProps, 'onChange'>, Omit<FormProps, 'value' | 'onChange' | 'rightElement'> {
|
|
4
4
|
onChange?: (value: Date | null) => void;
|
|
5
|
-
placeholder?: string;
|
|
6
5
|
clearButton?: boolean;
|
|
7
6
|
clearButtonIcon?: boolean;
|
|
8
7
|
children?: React.ReactNode;
|
package/dist/Input/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface FormProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
8
8
|
readOnly?: boolean;
|
|
9
9
|
onValueChange?: (value: string, targetElement: HTMLInputElement) => void;
|
|
10
10
|
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
11
|
-
inputRef?: React.
|
|
11
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
12
12
|
size?: 'sm' | 'md' | 'lg';
|
|
13
13
|
fill?: boolean;
|
|
14
14
|
mask?: string;
|
|
@@ -9,6 +9,7 @@ export interface SelectFormProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
9
9
|
fill?: boolean;
|
|
10
10
|
clearButton?: boolean;
|
|
11
11
|
clearButtonIcon?: boolean;
|
|
12
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
12
13
|
onClear?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
13
14
|
}
|
|
14
15
|
export declare const SelectInput: import('react').ForwardRefExoticComponent<SelectFormProps & import('react').RefAttributes<HTMLDivElement>>;
|
package/dist/Select/index.d.ts
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import { FormProps } from '../Input';
|
|
2
1
|
import { Option } from '../types';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { SelectFormProps } from './SelectInput';
|
|
3
|
+
interface Cleanable<T> {
|
|
4
|
+
clearButton: true;
|
|
5
5
|
onChange: (event: T | null) => void;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
}
|
|
7
|
+
interface UnCleanable<T> {
|
|
8
|
+
clearButton?: false;
|
|
9
|
+
onChange: (event: T) => void;
|
|
10
|
+
}
|
|
11
|
+
type DependedValueType<T> = Cleanable<T> | UnCleanable<T>;
|
|
12
|
+
type SelectProps<T> = Omit<SelectFormProps, 'value' | 'onChange' | 'closeButton'> & DependedValueType<T> & {
|
|
9
13
|
value: T | null;
|
|
14
|
+
options: Option<T>[];
|
|
10
15
|
children?: React.ReactNode;
|
|
11
16
|
minimalOptions?: boolean;
|
|
12
17
|
matchTarget?: 'width' | 'min-width';
|
|
13
|
-
}
|
|
18
|
+
};
|
|
14
19
|
export declare const Select: <T>(props: SelectProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
15
20
|
export {};
|
|
@@ -11,5 +11,6 @@ export interface SelectTagsProps<T> {
|
|
|
11
11
|
emptyText?: string;
|
|
12
12
|
size?: 'sm' | 'md' | 'lg';
|
|
13
13
|
fill?: boolean;
|
|
14
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
14
15
|
}
|
|
15
16
|
export declare const SelectTags: <T extends string | number>(props: SelectTagsProps<T>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/TextArea/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement
|
|
|
2
2
|
grow?: boolean;
|
|
3
3
|
onResize?: (el: HTMLTextAreaElement) => void;
|
|
4
4
|
fill?: boolean;
|
|
5
|
+
textAreaRef?: React.Ref<HTMLTextAreaElement>;
|
|
5
6
|
}
|
|
6
|
-
export declare const TextArea: ({ onResize, grow, value, onChange, disabled, required, rows, fill, ...textAreaProps }: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const TextArea: ({ onResize, grow, value, onChange, disabled, required, rows, fill, textAreaRef, ...textAreaProps }: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export interface UseLoadingProps<T = unknown> {
|
|
2
|
-
onClick: (startLoad: () => void,
|
|
2
|
+
onClick: (startLoad: () => void, value: T) => Promise<any>;
|
|
3
3
|
}
|
|
4
4
|
export declare const useLoading: <T = unknown>({ onClick }: UseLoadingProps<T>) => {
|
|
5
|
-
handleClick: (
|
|
5
|
+
handleClick: (value: T) => void;
|
|
6
6
|
isLoading: boolean;
|
|
7
7
|
isError: boolean;
|
|
8
8
|
};
|
package/dist/bundle.es23.js
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
-
import { useResizeTextarea as
|
|
3
|
-
import { attr as e, callMultiple as
|
|
4
|
-
import { useEffect as
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { useResizeTextarea as x } from "./bundle.es38.js";
|
|
3
|
+
import { attr as e, callMultiple as u } from "@companix/utils-browser";
|
|
4
|
+
import { useEffect as z } from "react";
|
|
5
|
+
import { mergeRefs as R } from "react-merge-refs";
|
|
6
|
+
const q = ({
|
|
7
|
+
onResize: m,
|
|
7
8
|
grow: a = !1,
|
|
8
9
|
value: t,
|
|
9
|
-
onChange:
|
|
10
|
+
onChange: s,
|
|
10
11
|
disabled: o,
|
|
11
|
-
required:
|
|
12
|
+
required: i,
|
|
12
13
|
rows: l = 2,
|
|
13
|
-
fill:
|
|
14
|
+
fill: p = !1,
|
|
15
|
+
textAreaRef: c,
|
|
14
16
|
...d
|
|
15
17
|
}) => {
|
|
16
|
-
const [n, r] =
|
|
17
|
-
return
|
|
18
|
+
const [n, r] = x(m, a);
|
|
19
|
+
return z(r, [r, t]), /* @__PURE__ */ f(
|
|
18
20
|
"div",
|
|
19
21
|
{
|
|
20
22
|
className: "form form-textarea",
|
|
21
|
-
"data-required": e(
|
|
23
|
+
"data-required": e(i),
|
|
22
24
|
"data-disabled": e(o),
|
|
23
|
-
"data-fill": e(
|
|
25
|
+
"data-fill": e(p),
|
|
24
26
|
children: /* @__PURE__ */ f(
|
|
25
27
|
"textarea",
|
|
26
28
|
{
|
|
27
29
|
className: "form-input",
|
|
28
30
|
"data-grow": e(a),
|
|
29
31
|
value: t,
|
|
30
|
-
ref: n,
|
|
32
|
+
ref: R([c, n]),
|
|
31
33
|
rows: l,
|
|
32
34
|
disabled: o,
|
|
33
|
-
onChange:
|
|
35
|
+
onChange: u(s, r),
|
|
34
36
|
...d
|
|
35
37
|
}
|
|
36
38
|
)
|
|
@@ -38,5 +40,5 @@ const R = ({
|
|
|
38
40
|
);
|
|
39
41
|
};
|
|
40
42
|
export {
|
|
41
|
-
|
|
43
|
+
q as TextArea
|
|
42
44
|
};
|
package/dist/bundle.es24.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as o, jsxs as c } from "react/jsx-runtime";
|
|
2
2
|
import { useFroozeClosing as F } from "./bundle.es31.js";
|
|
3
|
-
import { Popover as
|
|
4
|
-
import { OptionItem as
|
|
5
|
-
import { OptionsList as
|
|
6
|
-
import { useState as
|
|
3
|
+
import { Popover as L } from "./bundle.es6.js";
|
|
4
|
+
import { OptionItem as M } from "./bundle.es10.js";
|
|
5
|
+
import { OptionsList as j } from "./bundle.es12.js";
|
|
6
|
+
import { useState as V, useRef as d, useMemo as h } from "react";
|
|
7
7
|
import { Icon as g } from "./bundle.es35.js";
|
|
8
|
-
import { faClose as
|
|
9
|
-
import { attr as
|
|
10
|
-
|
|
8
|
+
import { faClose as B, faChevronDown as H } from "@fortawesome/free-solid-svg-icons";
|
|
9
|
+
import { attr as Q, getActiveElementByAnotherElement as q, contains as G } from "@companix/utils-browser";
|
|
10
|
+
import { mergeRefs as J } from "react-merge-refs";
|
|
11
|
+
const ne = (v) => {
|
|
11
12
|
const {
|
|
12
13
|
options: r,
|
|
13
14
|
closeAfterSelect: x,
|
|
@@ -15,46 +16,47 @@ const ee = (v) => {
|
|
|
15
16
|
onChange: l,
|
|
16
17
|
emptyText: N = "Ничего не найдено",
|
|
17
18
|
readOnly: m,
|
|
18
|
-
size:
|
|
19
|
+
size: R = "md",
|
|
19
20
|
value: n,
|
|
21
|
+
inputRef: z,
|
|
20
22
|
disabled: f
|
|
21
|
-
} = v, [
|
|
23
|
+
} = v, [i, A] = V(""), a = d(null), y = d(null), { popoverRef: u, froozePopoverPosition: D, handleAnimationEnd: b } = F(), w = h(() => {
|
|
22
24
|
const e = {};
|
|
23
25
|
return r.forEach((t) => {
|
|
24
26
|
e[t.value] = t;
|
|
25
27
|
}), e;
|
|
26
|
-
}, [r]),
|
|
28
|
+
}, [r]), E = (e) => n.includes(e) ? [...n] : [...n, e], O = (e) => n.filter((t) => e !== t), P = (e, t) => {
|
|
27
29
|
x ? (D(), l(e), t()) : l(e);
|
|
28
|
-
}, p = h(() =>
|
|
29
|
-
const t = e.toLowerCase(), s =
|
|
30
|
+
}, p = h(() => i.trim() ? r.filter(({ title: e }) => {
|
|
31
|
+
const t = e.toLowerCase(), s = i.trim().toLowerCase();
|
|
30
32
|
return t.indexOf(s) >= 0;
|
|
31
|
-
}) : r, [
|
|
33
|
+
}) : r, [i, r]), T = (e) => {
|
|
32
34
|
if (f) return;
|
|
33
35
|
u.current && u.current.getAttribute("data-state") === "open" && e.preventDefault();
|
|
34
|
-
const t =
|
|
35
|
-
e.defaultPrevented ||
|
|
36
|
-
},
|
|
37
|
-
e.target !==
|
|
38
|
-
},
|
|
39
|
-
e.stopPropagation(), l(
|
|
36
|
+
const t = q(e.currentTarget);
|
|
37
|
+
e.defaultPrevented || G(e.currentTarget, t) || a.current && a.current.focus();
|
|
38
|
+
}, k = (e) => {
|
|
39
|
+
e.target !== a.current && e.preventDefault();
|
|
40
|
+
}, I = (e, t) => {
|
|
41
|
+
e.stopPropagation(), l(O(t));
|
|
40
42
|
};
|
|
41
43
|
return /* @__PURE__ */ o(
|
|
42
|
-
|
|
44
|
+
L,
|
|
43
45
|
{
|
|
44
46
|
minimal: !0,
|
|
45
47
|
ref: u,
|
|
46
48
|
sideOffset: 0,
|
|
47
49
|
matchTarget: "width",
|
|
48
|
-
onAnimationEnd:
|
|
50
|
+
onAnimationEnd: b,
|
|
49
51
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
50
52
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
51
|
-
content: ({ close: e }) => /* @__PURE__ */ c(
|
|
53
|
+
content: ({ close: e }) => /* @__PURE__ */ c(j, { maxHeight: 300, children: [
|
|
52
54
|
p.length === 0 && /* @__PURE__ */ o("div", { className: "select-tags-empty", children: N }),
|
|
53
55
|
p.map(({ value: t, title: s, icon: S }, $) => /* @__PURE__ */ o(
|
|
54
|
-
|
|
56
|
+
M,
|
|
55
57
|
{
|
|
56
58
|
active: n.includes(t),
|
|
57
|
-
onClick: () =>
|
|
59
|
+
onClick: () => P(E(t), e),
|
|
58
60
|
title: s,
|
|
59
61
|
icon: S
|
|
60
62
|
},
|
|
@@ -65,9 +67,9 @@ const ee = (v) => {
|
|
|
65
67
|
"div",
|
|
66
68
|
{
|
|
67
69
|
className: "form",
|
|
68
|
-
onClick:
|
|
69
|
-
onMouseDown:
|
|
70
|
-
"data-size":
|
|
70
|
+
onClick: T,
|
|
71
|
+
onMouseDown: k,
|
|
72
|
+
"data-size": R,
|
|
71
73
|
children: /* @__PURE__ */ c("div", { className: "select-tags-container", children: [
|
|
72
74
|
/* @__PURE__ */ c("div", { className: "select-tags", children: [
|
|
73
75
|
n.length > 0 && /* @__PURE__ */ o(
|
|
@@ -76,24 +78,24 @@ const ee = (v) => {
|
|
|
76
78
|
className: "tag-container",
|
|
77
79
|
ref: y,
|
|
78
80
|
role: "listbox",
|
|
79
|
-
"data-readonly":
|
|
81
|
+
"data-readonly": Q(m),
|
|
80
82
|
children: n.map((e, t) => /* @__PURE__ */ c("div", { className: "tag", children: [
|
|
81
|
-
/* @__PURE__ */ o("span", { className: "tag-name", children:
|
|
82
|
-
/* @__PURE__ */ o("button", { className: "tag-close-button", onClick: (s) =>
|
|
83
|
+
/* @__PURE__ */ o("span", { className: "tag-name", children: w[e].title }),
|
|
84
|
+
/* @__PURE__ */ o("button", { className: "tag-close-button", onClick: (s) => I(s, e), children: /* @__PURE__ */ o(g, { className: "tag-close-icon", icon: B, size: "xxxs" }) })
|
|
83
85
|
] }, `tag-option-${e}-${t}`))
|
|
84
86
|
}
|
|
85
87
|
),
|
|
86
88
|
(!m || n.length === 0) && /* @__PURE__ */ o(
|
|
87
89
|
"input",
|
|
88
90
|
{
|
|
89
|
-
ref:
|
|
91
|
+
ref: J([z, a]),
|
|
90
92
|
type: "text",
|
|
91
93
|
autoCapitalize: "none",
|
|
92
94
|
autoComplete: "off",
|
|
93
95
|
autoCorrect: "off",
|
|
94
96
|
className: "form-input",
|
|
95
97
|
spellCheck: !1,
|
|
96
|
-
value:
|
|
98
|
+
value: i,
|
|
97
99
|
disabled: f,
|
|
98
100
|
readOnly: m,
|
|
99
101
|
placeholder: C,
|
|
@@ -101,7 +103,7 @@ const ee = (v) => {
|
|
|
101
103
|
}
|
|
102
104
|
)
|
|
103
105
|
] }),
|
|
104
|
-
/* @__PURE__ */ o(g, { className: "expand-icon", icon:
|
|
106
|
+
/* @__PURE__ */ o(g, { className: "expand-icon", icon: H, size: "xxxs" })
|
|
105
107
|
] })
|
|
106
108
|
}
|
|
107
109
|
)
|
|
@@ -109,5 +111,5 @@ const ee = (v) => {
|
|
|
109
111
|
);
|
|
110
112
|
};
|
|
111
113
|
export {
|
|
112
|
-
|
|
114
|
+
ne as SelectTags
|
|
113
115
|
};
|
package/dist/bundle.es32.js
CHANGED
|
@@ -1,53 +1,55 @@
|
|
|
1
1
|
import { jsxs as n, jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import R from "classnames";
|
|
3
3
|
import { attr as r } from "@companix/utils-browser";
|
|
4
|
-
import { forwardRef as
|
|
4
|
+
import { forwardRef as b, useRef as w, useCallback as y } from "react";
|
|
5
5
|
import { Icon as a } from "./bundle.es35.js";
|
|
6
|
-
import { faClose as D, faChevronDown as
|
|
7
|
-
import { VisuallyHidden as
|
|
8
|
-
|
|
6
|
+
import { faClose as D, faChevronDown as T } from "@fortawesome/free-solid-svg-icons";
|
|
7
|
+
import { VisuallyHidden as j } from "@radix-ui/react-visually-hidden";
|
|
8
|
+
import { mergeRefs as O } from "react-merge-refs";
|
|
9
|
+
const J = b(
|
|
9
10
|
({
|
|
10
11
|
required: u,
|
|
11
12
|
size: d,
|
|
12
13
|
fill: m,
|
|
13
14
|
leftElement: l,
|
|
14
|
-
className:
|
|
15
|
+
className: f,
|
|
15
16
|
value: o,
|
|
16
|
-
clearButton:
|
|
17
|
+
clearButton: p,
|
|
17
18
|
placeholder: C,
|
|
18
19
|
clearButtonIcon: h,
|
|
19
20
|
disabled: s,
|
|
20
21
|
onClear: I,
|
|
22
|
+
inputRef: N,
|
|
21
23
|
...i
|
|
22
|
-
},
|
|
23
|
-
const e = w(null),
|
|
24
|
+
}, k) => {
|
|
25
|
+
const e = w(null), x = y(
|
|
24
26
|
(t) => {
|
|
25
27
|
if (!e.current || !document)
|
|
26
28
|
return;
|
|
27
29
|
t.target !== e.current && (e.current.click(), document.activeElement !== e.current && e.current.focus());
|
|
28
30
|
},
|
|
29
31
|
[e]
|
|
30
|
-
),
|
|
32
|
+
), v = (t) => {
|
|
31
33
|
document && document.activeElement === e.current && t.preventDefault();
|
|
32
|
-
}, v = (t) => {
|
|
33
|
-
s || k(t);
|
|
34
34
|
}, F = (t) => {
|
|
35
|
-
x(t);
|
|
35
|
+
s || x(t);
|
|
36
|
+
}, g = (t) => {
|
|
37
|
+
v(t);
|
|
36
38
|
}, z = (t) => {
|
|
37
39
|
e.current && e.current.focus(), I?.(t);
|
|
38
40
|
};
|
|
39
41
|
return /* @__PURE__ */ n(
|
|
40
42
|
"div",
|
|
41
43
|
{
|
|
42
|
-
ref:
|
|
43
|
-
className:
|
|
44
|
+
ref: k,
|
|
45
|
+
className: R("form select", f),
|
|
44
46
|
"data-size": d ?? "md",
|
|
45
47
|
"data-fill": r(m),
|
|
46
48
|
"data-required": r(u),
|
|
47
49
|
"data-disabled": r(s),
|
|
48
|
-
onMouseDown:
|
|
50
|
+
onMouseDown: g,
|
|
49
51
|
...i,
|
|
50
|
-
onClick:
|
|
52
|
+
onClick: F,
|
|
51
53
|
children: [
|
|
52
54
|
/* @__PURE__ */ n("div", { className: "select-layout form-input", children: [
|
|
53
55
|
l && /* @__PURE__ */ c("div", { className: "select-element", children: l }),
|
|
@@ -56,14 +58,14 @@ const V = g(
|
|
|
56
58
|
o
|
|
57
59
|
] }) }),
|
|
58
60
|
/* @__PURE__ */ n("div", { className: "select-element", children: [
|
|
59
|
-
|
|
60
|
-
/* @__PURE__ */ c(a, { className: "expand-icon select-expand", icon:
|
|
61
|
+
p && o && /* @__PURE__ */ c("button", { className: "select-close-button", onClick: z, children: h ?? /* @__PURE__ */ c(a, { className: "select-close-icon", icon: D, size: "xxxs" }) }),
|
|
62
|
+
/* @__PURE__ */ c(a, { className: "expand-icon select-expand", icon: T, size: "xxxs" })
|
|
61
63
|
] })
|
|
62
64
|
] }),
|
|
63
|
-
/* @__PURE__ */ c(
|
|
65
|
+
/* @__PURE__ */ c(j, { asChild: !0, children: /* @__PURE__ */ c(
|
|
64
66
|
"input",
|
|
65
67
|
{
|
|
66
|
-
ref: e,
|
|
68
|
+
ref: O([N, e]),
|
|
67
69
|
autoComplete: "off",
|
|
68
70
|
autoCapitalize: "none",
|
|
69
71
|
autoCorrect: "off",
|
|
@@ -79,5 +81,5 @@ const V = g(
|
|
|
79
81
|
}
|
|
80
82
|
);
|
|
81
83
|
export {
|
|
82
|
-
|
|
84
|
+
J as SelectInput
|
|
83
85
|
};
|
package/dist/bundle.es37.js
CHANGED
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
const
|
|
3
|
-
const [
|
|
4
|
-
return {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
console.log(r), s({
|
|
14
|
-
isLoading: !1,
|
|
15
|
-
isError: !0
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
};
|
|
1
|
+
import { useState as e } from "react";
|
|
2
|
+
const d = ({ onClick: t }) => {
|
|
3
|
+
const [a, s] = e({ isLoading: !1, isError: !1 });
|
|
4
|
+
return { ...a, handleClick: (r) => {
|
|
5
|
+
a.isLoading || t(() => {
|
|
6
|
+
s({ isLoading: !0, isError: !1 });
|
|
7
|
+
}, r).then(() => {
|
|
8
|
+
s({ isLoading: !1, isError: !1 });
|
|
9
|
+
}).catch(() => {
|
|
10
|
+
s({ isLoading: !1, isError: !0 });
|
|
11
|
+
});
|
|
12
|
+
} };
|
|
20
13
|
};
|
|
21
14
|
export {
|
|
22
|
-
|
|
15
|
+
d as useLoading
|
|
23
16
|
};
|
package/dist/bundle.es45.js
CHANGED
|
@@ -52,7 +52,7 @@ const y = ({
|
|
|
52
52
|
value: e,
|
|
53
53
|
minimalOptions: !0,
|
|
54
54
|
matchTarget: "min-width",
|
|
55
|
-
onChange: (t) => x(t
|
|
55
|
+
onChange: (t) => x(t)
|
|
56
56
|
}
|
|
57
57
|
),
|
|
58
58
|
/* @__PURE__ */ o(
|
|
@@ -65,7 +65,7 @@ const y = ({
|
|
|
65
65
|
value: r,
|
|
66
66
|
minimalOptions: !0,
|
|
67
67
|
matchTarget: "min-width",
|
|
68
|
-
onChange: (t) => M(t
|
|
68
|
+
onChange: (t) => M(t)
|
|
69
69
|
}
|
|
70
70
|
)
|
|
71
71
|
] }),
|
package/dist/bundle.es8.js
CHANGED
|
@@ -1,87 +1,85 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
2
|
+
import { useMemo as A, useEffect as E } from "react";
|
|
3
3
|
import { OptionsList as b } from "./bundle.es12.js";
|
|
4
|
-
import { OptionItem as
|
|
5
|
-
import { Popover as
|
|
4
|
+
import { OptionItem as F } from "./bundle.es10.js";
|
|
5
|
+
import { Popover as I } from "./bundle.es6.js";
|
|
6
6
|
import { useFroozeClosing as z } from "./bundle.es31.js";
|
|
7
|
-
import { SelectInput as
|
|
8
|
-
import { useScrollListController as
|
|
9
|
-
const
|
|
7
|
+
import { SelectInput as B } from "./bundle.es32.js";
|
|
8
|
+
import { useScrollListController as D } from "./bundle.es33.js";
|
|
9
|
+
const q = (c) => {
|
|
10
10
|
const {
|
|
11
|
-
options:
|
|
11
|
+
options: t,
|
|
12
12
|
onChange: i,
|
|
13
|
-
minimalOptions: a,
|
|
14
|
-
clearButton: m,
|
|
15
|
-
clearButtonIcon: u,
|
|
16
|
-
matchTarget: f = "width",
|
|
17
13
|
value: l,
|
|
18
|
-
|
|
14
|
+
minimalOptions: a,
|
|
15
|
+
matchTarget: m = "width",
|
|
16
|
+
children: u,
|
|
19
17
|
disabled: s,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
clearButton: e,
|
|
19
|
+
...f
|
|
20
|
+
} = c, p = A(() => {
|
|
21
|
+
const o = t.findIndex((n) => n.value === l);
|
|
23
22
|
return {
|
|
24
23
|
index: o,
|
|
25
|
-
option:
|
|
24
|
+
option: t[o]
|
|
26
25
|
};
|
|
27
|
-
}, [
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
o.stopPropagation(), i(null);
|
|
31
|
-
},
|
|
32
|
-
p.index !== -1 &&
|
|
26
|
+
}, [t, l]), d = p.option?.value ?? null, { popoverRef: v, froozePopoverPosition: h, handleAnimationEnd: x } = z(), { scrollToElement: O, optionsWrapperRef: C, scrollBoxRef: g } = D(), P = (o, n) => {
|
|
27
|
+
h(), i(o), n();
|
|
28
|
+
}, R = (o) => {
|
|
29
|
+
o.stopPropagation(), e && i(null);
|
|
30
|
+
}, S = () => {
|
|
31
|
+
p.index !== -1 && O(p.index, !0);
|
|
33
32
|
};
|
|
34
33
|
return /* @__PURE__ */ r(
|
|
35
|
-
|
|
34
|
+
I,
|
|
36
35
|
{
|
|
37
36
|
minimal: !0,
|
|
38
|
-
ref:
|
|
37
|
+
ref: v,
|
|
39
38
|
sideOffset: 0,
|
|
40
|
-
matchTarget:
|
|
41
|
-
onAnimationEnd:
|
|
39
|
+
matchTarget: m,
|
|
40
|
+
onAnimationEnd: x,
|
|
42
41
|
onOpenAutoFocus: (o) => o.preventDefault(),
|
|
43
42
|
onCloseAutoFocus: (o) => o.preventDefault(),
|
|
44
43
|
disabled: s,
|
|
45
44
|
content: ({ close: o }) => /* @__PURE__ */ r(
|
|
46
|
-
|
|
45
|
+
L,
|
|
47
46
|
{
|
|
48
|
-
options:
|
|
49
|
-
active:
|
|
50
|
-
scrollboxRef:
|
|
51
|
-
optionsWrapperRef:
|
|
47
|
+
options: t,
|
|
48
|
+
active: d,
|
|
49
|
+
scrollboxRef: g,
|
|
50
|
+
optionsWrapperRef: C,
|
|
52
51
|
minimalOptions: a,
|
|
53
|
-
onOpened:
|
|
54
|
-
onSelect: (
|
|
52
|
+
onOpened: S,
|
|
53
|
+
onSelect: (n) => P(n, o)
|
|
55
54
|
}
|
|
56
55
|
),
|
|
57
|
-
children:
|
|
58
|
-
|
|
56
|
+
children: u ?? /* @__PURE__ */ r(
|
|
57
|
+
B,
|
|
59
58
|
{
|
|
60
|
-
...
|
|
59
|
+
...f,
|
|
61
60
|
disabled: s,
|
|
61
|
+
clearButton: e,
|
|
62
62
|
value: p.option?.title ?? "",
|
|
63
|
-
onClear:
|
|
64
|
-
clearButton: m,
|
|
65
|
-
clearButtonIcon: u
|
|
63
|
+
onClear: R
|
|
66
64
|
}
|
|
67
65
|
)
|
|
68
66
|
}
|
|
69
67
|
);
|
|
70
|
-
},
|
|
71
|
-
const { active:
|
|
72
|
-
return
|
|
68
|
+
}, L = (c) => {
|
|
69
|
+
const { active: t, onOpened: i, scrollboxRef: l, optionsWrapperRef: a, options: m, onSelect: u, minimalOptions: s } = c;
|
|
70
|
+
return E(() => {
|
|
73
71
|
i?.();
|
|
74
|
-
}, []), /* @__PURE__ */ r(b, { scrollboxRef:
|
|
75
|
-
|
|
72
|
+
}, []), /* @__PURE__ */ r(b, { scrollboxRef: l, optionsWrapperRef: a, maxHeight: 300, children: m.map((e, f) => /* @__PURE__ */ r(
|
|
73
|
+
F,
|
|
76
74
|
{
|
|
77
|
-
active:
|
|
78
|
-
onClick: () =>
|
|
79
|
-
minimal:
|
|
80
|
-
...
|
|
75
|
+
active: t === e.value,
|
|
76
|
+
onClick: () => u?.(e.value),
|
|
77
|
+
minimal: s,
|
|
78
|
+
...e
|
|
81
79
|
},
|
|
82
|
-
`option-item-${
|
|
80
|
+
`option-item-${e.value}-${f}`
|
|
83
81
|
)) });
|
|
84
82
|
};
|
|
85
83
|
export {
|
|
86
|
-
|
|
84
|
+
q as Select
|
|
87
85
|
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@companix/uikit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"module": "./dist/bundle.es.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
|
-
"dist"
|
|
9
|
-
"README.md"
|
|
8
|
+
"dist"
|
|
10
9
|
],
|
|
11
|
-
"author": "Pavel Victorov
|
|
10
|
+
"author": "Pavel Victorov",
|
|
12
11
|
"scripts": {
|
|
13
12
|
"echo": "echo \"uikit\"",
|
|
14
13
|
"dev": "vite --config vite.config.ts",
|