@companix/uikit 0.0.43 → 0.0.44
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/Select/SelectOptions.d.ts +6 -6
- package/dist/Select/index.d.ts +8 -8
- package/dist/bundle.es12.js +34 -37
- package/dist/bundle.es48.js +26 -29
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { Option } from '..';
|
|
2
|
+
export interface SelectAddOption {
|
|
3
|
+
text: string;
|
|
4
|
+
closeOnClick?: boolean;
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
}
|
|
2
7
|
interface SelectPopoverProps<T> {
|
|
3
8
|
scrollboxRef?: React.RefObject<HTMLDivElement>;
|
|
4
9
|
optionsWrapperRef?: React.RefObject<HTMLDivElement>;
|
|
@@ -7,12 +12,7 @@ interface SelectPopoverProps<T> {
|
|
|
7
12
|
active?: T | null;
|
|
8
13
|
onSelect?: (value: T) => void;
|
|
9
14
|
onOpened?: () => void;
|
|
10
|
-
|
|
11
|
-
addOption?: {
|
|
12
|
-
text: string;
|
|
13
|
-
closeOnClick?: boolean;
|
|
14
|
-
onClick: () => void;
|
|
15
|
-
};
|
|
15
|
+
addOption?: SelectAddOption;
|
|
16
16
|
}
|
|
17
17
|
export declare const SelectOptions: <T>(props: SelectPopoverProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
export {};
|
package/dist/Select/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Option } from '../types';
|
|
2
2
|
import { SelectFormProps } from './SelectInput';
|
|
3
|
+
import { SelectAddOption } from './SelectOptions';
|
|
3
4
|
interface Cleanable<T> {
|
|
4
5
|
clearButton: true;
|
|
5
6
|
onChange: (event: T | null) => void;
|
|
@@ -9,20 +10,19 @@ interface UnCleanable<T> {
|
|
|
9
10
|
onChange: (event: T) => void;
|
|
10
11
|
}
|
|
11
12
|
type DependedValueType<T> = Cleanable<T> | UnCleanable<T>;
|
|
12
|
-
export
|
|
13
|
-
value: T | null;
|
|
14
|
-
options: Option<T>[];
|
|
15
|
-
children?: React.ReactNode;
|
|
13
|
+
export interface SelectParams {
|
|
16
14
|
minimalOptions?: boolean;
|
|
17
15
|
matchTarget?: 'width' | 'min-width';
|
|
18
16
|
popoverRef?: React.Ref<HTMLDivElement>;
|
|
19
17
|
scrollRef?: React.Ref<{
|
|
20
18
|
scrollTo: (index: number) => void;
|
|
21
19
|
}>;
|
|
22
|
-
addOption?:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
addOption?: SelectAddOption;
|
|
21
|
+
}
|
|
22
|
+
export type SelectProps<T> = Omit<SelectFormProps, 'value' | 'onChange' | 'closeButton'> & DependedValueType<T> & SelectParams & {
|
|
23
|
+
value: T | null;
|
|
24
|
+
options: Option<T>[];
|
|
25
|
+
children?: React.ReactNode;
|
|
26
26
|
};
|
|
27
27
|
export declare const Select: <T>(props: SelectProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
export {};
|
package/dist/bundle.es12.js
CHANGED
|
@@ -1,82 +1,79 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { Popover as
|
|
4
|
-
import { useFroozeClosing as
|
|
5
|
-
import { SelectInput as
|
|
6
|
-
import { useScrollListController as
|
|
7
|
-
import { SelectOptions as
|
|
8
|
-
import { mergeRefs as
|
|
9
|
-
const
|
|
2
|
+
import { useMemo as I, useImperativeHandle as T } from "react";
|
|
3
|
+
import { Popover as b } from "./bundle.es10.js";
|
|
4
|
+
import { useFroozeClosing as z } from "./bundle.es45.js";
|
|
5
|
+
import { SelectInput as B } from "./bundle.es46.js";
|
|
6
|
+
import { useScrollListController as D } from "./bundle.es47.js";
|
|
7
|
+
import { SelectOptions as j } from "./bundle.es48.js";
|
|
8
|
+
import { mergeRefs as w } from "react-merge-refs";
|
|
9
|
+
const J = (a) => {
|
|
10
10
|
const {
|
|
11
11
|
options: n,
|
|
12
12
|
onChange: i,
|
|
13
13
|
value: r,
|
|
14
|
-
minimalOptions:
|
|
15
|
-
matchTarget:
|
|
16
|
-
children:
|
|
14
|
+
minimalOptions: m,
|
|
15
|
+
matchTarget: f = "width",
|
|
16
|
+
children: u,
|
|
17
17
|
disabled: p,
|
|
18
|
-
scrollRef:
|
|
19
|
-
popoverRef:
|
|
18
|
+
scrollRef: d,
|
|
19
|
+
popoverRef: v,
|
|
20
20
|
clearButton: s,
|
|
21
|
-
addOption:
|
|
22
|
-
...
|
|
23
|
-
} =
|
|
21
|
+
addOption: h,
|
|
22
|
+
...x
|
|
23
|
+
} = a, t = I(() => {
|
|
24
24
|
const o = r === null ? -1 : n.findIndex((e) => e.value === r);
|
|
25
25
|
return {
|
|
26
26
|
index: o,
|
|
27
27
|
option: n[o]
|
|
28
28
|
};
|
|
29
|
-
}, [n, r]), R = t.option?.value ?? null, { popoverRef:
|
|
30
|
-
|
|
31
|
-
scrollTo: (o) =>
|
|
29
|
+
}, [n, r]), R = t.option?.value ?? null, { popoverRef: C, froozePopoverPosition: O, handleAnimationEnd: g } = z(), { scrollToElement: c, optionsWrapperRef: P, scrollBoxRef: S } = D();
|
|
30
|
+
T(d, () => ({
|
|
31
|
+
scrollTo: (o) => c(o, "top")
|
|
32
32
|
}));
|
|
33
33
|
const A = (o, e) => {
|
|
34
|
-
|
|
34
|
+
O(), i(o), e();
|
|
35
35
|
}, E = (o) => {
|
|
36
|
-
c(), o();
|
|
37
|
-
}, F = (o) => {
|
|
38
36
|
o.stopPropagation(), s && i(null);
|
|
39
|
-
},
|
|
40
|
-
t.index !== -1 &&
|
|
37
|
+
}, F = () => {
|
|
38
|
+
t.index !== -1 && c(t.index, "center");
|
|
41
39
|
};
|
|
42
40
|
return /* @__PURE__ */ l(
|
|
43
|
-
|
|
41
|
+
b,
|
|
44
42
|
{
|
|
45
43
|
minimal: !0,
|
|
46
|
-
ref:
|
|
44
|
+
ref: w([C, v]),
|
|
47
45
|
sideOffset: 0,
|
|
48
|
-
matchTarget:
|
|
46
|
+
matchTarget: f,
|
|
49
47
|
onAnimationEnd: g,
|
|
50
48
|
onOpenAutoFocus: (o) => o.preventDefault(),
|
|
51
49
|
onCloseAutoFocus: (o) => o.preventDefault(),
|
|
52
50
|
disabled: p,
|
|
53
51
|
content: ({ close: o }) => /* @__PURE__ */ l(
|
|
54
|
-
|
|
52
|
+
j,
|
|
55
53
|
{
|
|
56
54
|
options: n,
|
|
57
55
|
active: R,
|
|
58
56
|
scrollboxRef: S,
|
|
59
57
|
optionsWrapperRef: P,
|
|
60
|
-
minimalOptions:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
onOpened: I,
|
|
58
|
+
minimalOptions: m,
|
|
59
|
+
addOption: h,
|
|
60
|
+
onOpened: F,
|
|
64
61
|
onSelect: (e) => A(e, o)
|
|
65
62
|
}
|
|
66
63
|
),
|
|
67
|
-
children:
|
|
68
|
-
|
|
64
|
+
children: u ?? /* @__PURE__ */ l(
|
|
65
|
+
B,
|
|
69
66
|
{
|
|
70
|
-
...
|
|
67
|
+
...x,
|
|
71
68
|
disabled: p,
|
|
72
69
|
clearButton: s,
|
|
73
70
|
value: t.option?.title ?? "",
|
|
74
|
-
onClear:
|
|
71
|
+
onClear: E
|
|
75
72
|
}
|
|
76
73
|
)
|
|
77
74
|
}
|
|
78
75
|
);
|
|
79
76
|
};
|
|
80
77
|
export {
|
|
81
|
-
|
|
78
|
+
J as Select
|
|
82
79
|
};
|
package/dist/bundle.es48.js
CHANGED
|
@@ -1,47 +1,44 @@
|
|
|
1
|
-
import { jsxs as d, jsx as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { OptionItem as
|
|
4
|
-
import { OptionsList as
|
|
5
|
-
import { Icon as
|
|
1
|
+
import { jsxs as d, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as x } from "react";
|
|
3
|
+
import { OptionItem as e } from "./bundle.es14.js";
|
|
4
|
+
import { OptionsList as O } from "./bundle.es16.js";
|
|
5
|
+
import { Icon as u } from "./bundle.es33.js";
|
|
6
6
|
import { faPlus as v } from "@companix/icons-solid";
|
|
7
|
-
const
|
|
7
|
+
const S = (n) => {
|
|
8
8
|
const {
|
|
9
|
-
active:
|
|
10
|
-
onOpened:
|
|
9
|
+
active: m,
|
|
10
|
+
onOpened: r,
|
|
11
11
|
addOption: o,
|
|
12
|
-
scrollboxRef:
|
|
13
|
-
optionsWrapperRef:
|
|
12
|
+
scrollboxRef: c,
|
|
13
|
+
optionsWrapperRef: p,
|
|
14
14
|
options: s,
|
|
15
|
-
onSelect:
|
|
16
|
-
|
|
17
|
-
minimalOptions: f
|
|
15
|
+
onSelect: l,
|
|
16
|
+
minimalOptions: a
|
|
18
17
|
} = n;
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
}, []), /* @__PURE__ */ d(
|
|
22
|
-
o && /* @__PURE__ */
|
|
23
|
-
|
|
18
|
+
return x(() => {
|
|
19
|
+
r?.();
|
|
20
|
+
}, []), /* @__PURE__ */ d(O, { scrollboxRef: c, optionsWrapperRef: p, maxHeight: 300, children: [
|
|
21
|
+
o && /* @__PURE__ */ i(
|
|
22
|
+
e,
|
|
24
23
|
{
|
|
25
24
|
className: "select-add-option",
|
|
26
|
-
icon: /* @__PURE__ */
|
|
25
|
+
icon: /* @__PURE__ */ i(u, { icon: v }),
|
|
27
26
|
title: o.text,
|
|
28
|
-
onClick:
|
|
29
|
-
(o.closeOnClick ?? !0) && a(), o.onClick();
|
|
30
|
-
}
|
|
27
|
+
onClick: o.onClick
|
|
31
28
|
}
|
|
32
29
|
),
|
|
33
|
-
s.map((t,
|
|
34
|
-
|
|
30
|
+
s.map((t, f) => /* @__PURE__ */ i(
|
|
31
|
+
e,
|
|
35
32
|
{
|
|
36
|
-
active:
|
|
37
|
-
onClick: () =>
|
|
38
|
-
minimal:
|
|
33
|
+
active: m === t.value,
|
|
34
|
+
onClick: () => l?.(t.value),
|
|
35
|
+
minimal: a,
|
|
39
36
|
...t
|
|
40
37
|
},
|
|
41
|
-
`select-option-${
|
|
38
|
+
`select-option-${f}`
|
|
42
39
|
))
|
|
43
40
|
] });
|
|
44
41
|
};
|
|
45
42
|
export {
|
|
46
|
-
|
|
43
|
+
S as SelectOptions
|
|
47
44
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type { PopoverProps } from './Popover';
|
|
|
18
18
|
export { Tooltip } from './Tooltip';
|
|
19
19
|
export type { TooltipProps } from './Tooltip';
|
|
20
20
|
export { Select } from './Select';
|
|
21
|
-
export type { SelectProps } from './Select';
|
|
21
|
+
export type { SelectProps, SelectParams } from './Select';
|
|
22
22
|
export { Input } from './Input/Input';
|
|
23
23
|
export type { InputProps } from './Input/Input';
|
|
24
24
|
export { OptionItem } from './OptionItem/OptionItem';
|