@companix/uikit 0.1.43 → 0.1.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/index.d.ts +9 -1
- package/dist/bundle.es13.js +82 -76
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/Select/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SelectFormProps } from './SelectInput';
|
|
2
2
|
import { OptionsSource, SelectOptionsPopoverParams } from './OptionsPopover';
|
|
3
|
+
import { Option } from '../types';
|
|
3
4
|
interface Cleanable<T> {
|
|
4
5
|
clearButton: true;
|
|
5
6
|
onChange: (value: T | null) => void;
|
|
@@ -16,9 +17,16 @@ export interface SelectParams extends SelectOptionsPopoverParams {
|
|
|
16
17
|
scrollTo: (index: number) => void;
|
|
17
18
|
}>;
|
|
18
19
|
}
|
|
20
|
+
export interface SelectTriggerParams<T> {
|
|
21
|
+
option: Option<T> | null;
|
|
22
|
+
title: string;
|
|
23
|
+
isOpen: boolean;
|
|
24
|
+
clear: (event: React.MouseEvent) => void;
|
|
25
|
+
}
|
|
26
|
+
export type SelectTrigger<T> = (params: SelectTriggerParams<T>) => React.ReactNode;
|
|
19
27
|
export type SelectProps<T> = OptionsSource<T> & Omit<SelectFormProps, 'value'> & SelectParams & OnChangeValueType<T> & {
|
|
20
28
|
value: T | null;
|
|
21
|
-
children?: React.ReactNode
|
|
29
|
+
children?: React.ReactNode | SelectTrigger<T>;
|
|
22
30
|
};
|
|
23
31
|
export declare const Select: <T>(props: SelectProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
24
32
|
export {};
|
package/dist/bundle.es13.js
CHANGED
|
@@ -1,99 +1,105 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { Popover as
|
|
4
|
-
import { useFroozeClosing as
|
|
5
|
-
import { SelectInput as
|
|
6
|
-
import { useScrollListController as
|
|
7
|
-
import { OptionsPopover as
|
|
8
|
-
import { mergeRefs as
|
|
9
|
-
const
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as q, useState as w, useMemo as y, useImperativeHandle as H } from "react";
|
|
3
|
+
import { Popover as M } from "./bundle.es11.js";
|
|
4
|
+
import { useFroozeClosing as N } from "./bundle.es64.js";
|
|
5
|
+
import { SelectInput as W } from "./bundle.es65.js";
|
|
6
|
+
import { useScrollListController as G } from "./bundle.es66.js";
|
|
7
|
+
import { OptionsPopover as J } from "./bundle.es67.js";
|
|
8
|
+
import { mergeRefs as K } from "react-merge-refs";
|
|
9
|
+
const oe = (t) => {
|
|
10
10
|
const {
|
|
11
|
-
onChange:
|
|
12
|
-
value:
|
|
13
|
-
matchTarget:
|
|
14
|
-
children:
|
|
15
|
-
scrollRef:
|
|
16
|
-
popoverRef:
|
|
17
|
-
clearButton:
|
|
11
|
+
onChange: a,
|
|
12
|
+
value: r,
|
|
13
|
+
matchTarget: v = "width",
|
|
14
|
+
children: l,
|
|
15
|
+
scrollRef: h,
|
|
16
|
+
popoverRef: O,
|
|
17
|
+
clearButton: c,
|
|
18
18
|
// select props
|
|
19
|
-
disabled:
|
|
20
|
-
required:
|
|
21
|
-
className:
|
|
22
|
-
clearButtonIcon:
|
|
23
|
-
leftElement:
|
|
24
|
-
inputRef:
|
|
25
|
-
onClear:
|
|
26
|
-
fill:
|
|
27
|
-
size:
|
|
28
|
-
placeholder:
|
|
29
|
-
onClick:
|
|
19
|
+
disabled: p,
|
|
20
|
+
required: C,
|
|
21
|
+
className: R,
|
|
22
|
+
clearButtonIcon: g,
|
|
23
|
+
leftElement: P,
|
|
24
|
+
inputRef: E,
|
|
25
|
+
onClear: Q,
|
|
26
|
+
fill: S,
|
|
27
|
+
size: A,
|
|
28
|
+
placeholder: x,
|
|
29
|
+
onClick: I,
|
|
30
30
|
// options popover
|
|
31
|
-
...
|
|
32
|
-
} = t,
|
|
33
|
-
|
|
34
|
-
(t.options ?? t.defaultOptions ?? []).forEach((
|
|
35
|
-
|
|
31
|
+
...T
|
|
32
|
+
} = t, i = q({}), [z, B] = w(!1), u = typeof l == "function";
|
|
33
|
+
y(() => {
|
|
34
|
+
(t.options ?? t.defaultOptions ?? []).forEach((o) => {
|
|
35
|
+
i.current[o.value] = o;
|
|
36
36
|
});
|
|
37
37
|
}, [t.options, t.defaultOptions]);
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
scrollTo: (
|
|
38
|
+
const n = r === null ? null : i.current[r] ?? null, { popoverRef: F, froozePopoverPosition: b, handleAnimationEnd: D } = N(), { scrollToElement: f, optionsWrapperRef: L, scrollBoxRef: j } = G();
|
|
39
|
+
H(h, () => ({
|
|
40
|
+
scrollTo: (e) => f(e, "top")
|
|
41
41
|
}));
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
42
|
+
const k = (e, o) => {
|
|
43
|
+
b(), a(e), o();
|
|
44
|
+
}, m = (e) => {
|
|
45
|
+
e.stopPropagation(), c && a(null);
|
|
46
46
|
};
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
|
|
47
|
+
return /* @__PURE__ */ s(
|
|
48
|
+
M,
|
|
49
49
|
{
|
|
50
50
|
minimal: !0,
|
|
51
|
-
ref:
|
|
51
|
+
ref: K([F, O]),
|
|
52
52
|
sideOffset: 0,
|
|
53
|
-
matchTarget:
|
|
54
|
-
onAnimationEnd:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
matchTarget: v,
|
|
54
|
+
onAnimationEnd: D,
|
|
55
|
+
onOpenChange: u ? B : void 0,
|
|
56
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
57
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
58
|
+
disabled: p,
|
|
59
|
+
content: ({ close: e }) => /* @__PURE__ */ s(
|
|
60
|
+
J,
|
|
60
61
|
{
|
|
61
|
-
...
|
|
62
|
-
close:
|
|
63
|
-
isActive: (
|
|
64
|
-
onSelect: (
|
|
65
|
-
scrollboxRef:
|
|
66
|
-
optionsWrapperRef:
|
|
67
|
-
onOpened: (
|
|
68
|
-
onOptionsLoaded: (
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
...T,
|
|
63
|
+
close: e,
|
|
64
|
+
isActive: (o) => o === r,
|
|
65
|
+
onSelect: (o) => k(o, e),
|
|
66
|
+
scrollboxRef: j,
|
|
67
|
+
optionsWrapperRef: L,
|
|
68
|
+
onOpened: (o) => f(o, "center"),
|
|
69
|
+
onOptionsLoaded: (o) => {
|
|
70
|
+
o.forEach((d) => {
|
|
71
|
+
i.current[d.value] = d;
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
),
|
|
75
|
-
children:
|
|
76
|
-
|
|
76
|
+
children: u ? l({
|
|
77
|
+
option: n,
|
|
78
|
+
title: n?.title ?? "",
|
|
79
|
+
isOpen: z,
|
|
80
|
+
clear: m
|
|
81
|
+
}) : l ?? /* @__PURE__ */ s(
|
|
82
|
+
W,
|
|
77
83
|
{
|
|
78
|
-
required:
|
|
79
|
-
className:
|
|
80
|
-
leftElement:
|
|
81
|
-
inputRef:
|
|
82
|
-
onClear:
|
|
83
|
-
fill:
|
|
84
|
-
size:
|
|
85
|
-
placeholder:
|
|
86
|
-
onClick:
|
|
87
|
-
disabled:
|
|
88
|
-
clearButton:
|
|
89
|
-
customElement:
|
|
90
|
-
clearButtonIcon:
|
|
91
|
-
value:
|
|
84
|
+
required: C,
|
|
85
|
+
className: R,
|
|
86
|
+
leftElement: P,
|
|
87
|
+
inputRef: E,
|
|
88
|
+
onClear: m,
|
|
89
|
+
fill: S,
|
|
90
|
+
size: A,
|
|
91
|
+
placeholder: x,
|
|
92
|
+
onClick: I,
|
|
93
|
+
disabled: p,
|
|
94
|
+
clearButton: c,
|
|
95
|
+
customElement: n?.indicator,
|
|
96
|
+
clearButtonIcon: g,
|
|
97
|
+
value: n?.title ?? ""
|
|
92
98
|
}
|
|
93
99
|
)
|
|
94
100
|
}
|
|
95
101
|
);
|
|
96
102
|
};
|
|
97
103
|
export {
|
|
98
|
-
|
|
104
|
+
oe as Select
|
|
99
105
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type { PopoverProps } from './Popover';
|
|
|
19
19
|
export { Tooltip } from './Tooltip';
|
|
20
20
|
export type { TooltipProps } from './Tooltip';
|
|
21
21
|
export { Select } from './Select';
|
|
22
|
-
export type { SelectProps, SelectParams } from './Select';
|
|
22
|
+
export type { SelectProps, SelectParams, SelectTrigger, SelectTriggerParams } from './Select';
|
|
23
23
|
export { SelectTags } from './SelectTags';
|
|
24
24
|
export type { SelectTagsProps, SelectTagsParams } from './SelectTags';
|
|
25
25
|
export { Input } from './Input/Input';
|