@companix/uikit 0.0.43 → 0.0.45
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/Spinner/Spinner.scss +6 -1
- package/dist/Spinner/index.d.ts +1 -3
- package/dist/bundle.es12.js +34 -37
- package/dist/bundle.es4.js +17 -17
- package/dist/bundle.es48.js +26 -29
- package/dist/bundle.es6.js +5 -5
- 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 {};
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
@use '../mixins.scss';
|
|
2
|
+
|
|
1
3
|
@keyframes spinner-border {
|
|
2
4
|
to {
|
|
3
5
|
transform: rotate(360deg);
|
|
4
6
|
}
|
|
5
7
|
}
|
|
6
8
|
|
|
7
|
-
.spinner
|
|
9
|
+
.spinner {
|
|
8
10
|
display: inline-block;
|
|
9
11
|
border-style: solid;
|
|
10
12
|
border-color: currentColor;
|
|
13
|
+
border-width: 2px;
|
|
11
14
|
border-right-color: transparent;
|
|
12
15
|
border-radius: 50%;
|
|
13
16
|
animation: 0.75s linear infinite spinner-border;
|
|
17
|
+
|
|
18
|
+
@include mixins.use-styles(spinner);
|
|
14
19
|
}
|
package/dist/Spinner/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export interface SpinnerProps {
|
|
2
2
|
size?: number;
|
|
3
|
-
width?: number;
|
|
4
|
-
color?: string;
|
|
5
3
|
className?: string;
|
|
6
4
|
}
|
|
7
|
-
export declare const Spinner: ({ size, className
|
|
5
|
+
export declare const Spinner: ({ size, className }: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
|
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.es4.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { jsx as e, jsxs as x, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { Spinner as
|
|
4
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as e, jsxs as x, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import k from "classnames";
|
|
3
|
+
import { Spinner as z } from "./bundle.es6.js";
|
|
4
|
+
import { forwardRef as N } from "react";
|
|
5
5
|
import { attr as r } from "@companix/utils-browser";
|
|
6
|
-
const F =
|
|
6
|
+
const F = N(
|
|
7
7
|
({
|
|
8
8
|
children: d,
|
|
9
9
|
fill: l,
|
|
10
|
-
text:
|
|
10
|
+
text: m,
|
|
11
11
|
active: c,
|
|
12
12
|
mode: f = "default",
|
|
13
13
|
appearance: s = "neutral",
|
|
14
14
|
size: p = "md",
|
|
15
15
|
align: u,
|
|
16
|
-
icon:
|
|
16
|
+
icon: n,
|
|
17
17
|
loading: t,
|
|
18
18
|
className: b,
|
|
19
|
-
iconRight:
|
|
20
|
-
Component:
|
|
19
|
+
iconRight: o,
|
|
20
|
+
Component: i = "button",
|
|
21
21
|
...a
|
|
22
22
|
}, v) => /* @__PURE__ */ e(
|
|
23
|
-
|
|
23
|
+
i,
|
|
24
24
|
{
|
|
25
25
|
ref: v,
|
|
26
|
-
className:
|
|
26
|
+
className: k("button", b),
|
|
27
27
|
"data-size": p,
|
|
28
28
|
"data-loading": r(t),
|
|
29
|
-
"data-align": t ? "center" : u ?? (
|
|
29
|
+
"data-align": t ? "center" : u ?? (n && o ? "left" : "center"),
|
|
30
30
|
"data-appearance": s,
|
|
31
31
|
"data-mode": f,
|
|
32
32
|
"data-fill": r(l),
|
|
33
33
|
"data-active": r(c),
|
|
34
|
-
type:
|
|
34
|
+
type: i === "button" ? "button" : void 0,
|
|
35
35
|
...a,
|
|
36
36
|
onClick: t ?? a.disabled ? void 0 : a.onClick,
|
|
37
|
-
children: t ? /* @__PURE__ */ e(
|
|
38
|
-
|
|
39
|
-
(d ??
|
|
40
|
-
|
|
37
|
+
children: t ? /* @__PURE__ */ e(z, { size: 14 }) : /* @__PURE__ */ x(j, { children: [
|
|
38
|
+
n,
|
|
39
|
+
(d ?? m) && /* @__PURE__ */ e("span", { className: "button-text", children: m ?? d }),
|
|
40
|
+
o
|
|
41
41
|
] })
|
|
42
42
|
}
|
|
43
43
|
)
|
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/bundle.es6.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import n from "classnames";
|
|
3
|
-
const
|
|
3
|
+
const s = ({ size: r = 40, className: t }) => /* @__PURE__ */ e(
|
|
4
4
|
"div",
|
|
5
5
|
{
|
|
6
|
-
style: { width: `${r}px`, height: `${r}px
|
|
7
|
-
className: n("spinner
|
|
6
|
+
style: { width: `${r}px`, height: `${r}px` },
|
|
7
|
+
className: n("spinner", t),
|
|
8
8
|
role: "status"
|
|
9
9
|
}
|
|
10
10
|
);
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
s as Spinner
|
|
13
13
|
};
|
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';
|