@companix/uikit 0.1.17 → 0.1.18
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/OptionItem/Option.scss +12 -0
- package/dist/Select/SelectInput.d.ts +1 -0
- package/dist/Select/SelectRight.d.ts +1 -0
- package/dist/bundle.es13.js +31 -30
- package/dist/bundle.es16.js +22 -19
- package/dist/bundle.es62.js +30 -28
- package/dist/bundle.es64.js +21 -20
- package/dist/bundle.es73.js +9 -8
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -31,12 +31,24 @@
|
|
|
31
31
|
max-width: 100%;
|
|
32
32
|
gap: 8px;
|
|
33
33
|
|
|
34
|
+
&-layout {
|
|
35
|
+
width: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
&-inner {
|
|
35
39
|
@include mixins.use-styles(option, content, layout);
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
|
|
43
|
+
&-header {
|
|
44
|
+
align-items: center;
|
|
45
|
+
width: 100%;
|
|
46
|
+
display: flex;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
}
|
|
49
|
+
|
|
39
50
|
&-title {
|
|
51
|
+
flex: 1;
|
|
40
52
|
word-break: break-word;
|
|
41
53
|
}
|
|
42
54
|
|
|
@@ -9,6 +9,7 @@ export interface SelectFormProps {
|
|
|
9
9
|
fill?: boolean;
|
|
10
10
|
clearButton?: boolean;
|
|
11
11
|
clearButtonIcon?: boolean;
|
|
12
|
+
customElement?: React.ReactNode;
|
|
12
13
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
13
14
|
onClear?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
14
15
|
onClick?: () => void;
|
|
@@ -2,6 +2,7 @@ interface SelectRightElementsProps {
|
|
|
2
2
|
onClear?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
3
3
|
clearButton?: boolean;
|
|
4
4
|
clearButtonIcon?: React.ReactNode;
|
|
5
|
+
customElement?: React.ReactNode;
|
|
5
6
|
value: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare const SelectRightElements: (props: SelectRightElementsProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/bundle.es13.js
CHANGED
|
@@ -10,33 +10,33 @@ const Z = (t) => {
|
|
|
10
10
|
const {
|
|
11
11
|
onChange: i,
|
|
12
12
|
value: n,
|
|
13
|
-
matchTarget:
|
|
14
|
-
children:
|
|
15
|
-
scrollRef:
|
|
16
|
-
popoverRef:
|
|
13
|
+
matchTarget: f = "width",
|
|
14
|
+
children: m,
|
|
15
|
+
scrollRef: d,
|
|
16
|
+
popoverRef: v,
|
|
17
17
|
clearButton: s,
|
|
18
18
|
// select props
|
|
19
19
|
disabled: a,
|
|
20
|
-
required:
|
|
21
|
-
className:
|
|
22
|
-
clearButtonIcon:
|
|
23
|
-
leftElement:
|
|
24
|
-
inputRef:
|
|
20
|
+
required: h,
|
|
21
|
+
className: O,
|
|
22
|
+
clearButtonIcon: R,
|
|
23
|
+
leftElement: C,
|
|
24
|
+
inputRef: P,
|
|
25
25
|
onClear: y,
|
|
26
|
-
fill:
|
|
26
|
+
fill: E,
|
|
27
27
|
size: g,
|
|
28
|
-
placeholder:
|
|
29
|
-
onClick:
|
|
28
|
+
placeholder: A,
|
|
29
|
+
onClick: S,
|
|
30
30
|
// options popover
|
|
31
|
-
...
|
|
31
|
+
...x
|
|
32
32
|
} = t, r = L({});
|
|
33
33
|
j(() => {
|
|
34
34
|
(t.options ?? t.defaultOptions ?? []).forEach((e) => {
|
|
35
35
|
r.current[e.value] = e;
|
|
36
36
|
});
|
|
37
37
|
}, [t.options, t.defaultOptions]);
|
|
38
|
-
const
|
|
39
|
-
k(
|
|
38
|
+
const c = n === null ? null : r.current[n] ?? null, { popoverRef: z, froozePopoverPosition: B, handleAnimationEnd: F } = w(), { scrollToElement: p, optionsWrapperRef: I, scrollBoxRef: T } = M();
|
|
39
|
+
k(d, () => ({
|
|
40
40
|
scrollTo: (o) => p(o, "top")
|
|
41
41
|
}));
|
|
42
42
|
const b = (o, e) => {
|
|
@@ -48,9 +48,9 @@ const Z = (t) => {
|
|
|
48
48
|
q,
|
|
49
49
|
{
|
|
50
50
|
minimal: !0,
|
|
51
|
-
ref: W([z,
|
|
51
|
+
ref: W([z, v]),
|
|
52
52
|
sideOffset: 0,
|
|
53
|
-
matchTarget:
|
|
53
|
+
matchTarget: f,
|
|
54
54
|
onAnimationEnd: F,
|
|
55
55
|
onOpenAutoFocus: (o) => o.preventDefault(),
|
|
56
56
|
onCloseAutoFocus: (o) => o.preventDefault(),
|
|
@@ -58,7 +58,7 @@ const Z = (t) => {
|
|
|
58
58
|
content: ({ close: o }) => /* @__PURE__ */ l(
|
|
59
59
|
N,
|
|
60
60
|
{
|
|
61
|
-
...
|
|
61
|
+
...x,
|
|
62
62
|
close: o,
|
|
63
63
|
isActive: (e) => e === n,
|
|
64
64
|
onSelect: (e) => b(e, o),
|
|
@@ -66,28 +66,29 @@ const Z = (t) => {
|
|
|
66
66
|
optionsWrapperRef: I,
|
|
67
67
|
onOpened: (e) => p(e, "center"),
|
|
68
68
|
onOptionsLoaded: (e) => {
|
|
69
|
-
e.forEach((
|
|
70
|
-
r.current[
|
|
69
|
+
e.forEach((u) => {
|
|
70
|
+
r.current[u.value] = u;
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
children:
|
|
75
|
+
children: m ?? /* @__PURE__ */ l(
|
|
76
76
|
H,
|
|
77
77
|
{
|
|
78
|
-
required:
|
|
79
|
-
className:
|
|
80
|
-
leftElement:
|
|
81
|
-
inputRef:
|
|
78
|
+
required: h,
|
|
79
|
+
className: O,
|
|
80
|
+
leftElement: C,
|
|
81
|
+
inputRef: P,
|
|
82
82
|
onClear: D,
|
|
83
|
-
fill:
|
|
83
|
+
fill: E,
|
|
84
84
|
size: g,
|
|
85
|
-
placeholder:
|
|
86
|
-
onClick:
|
|
85
|
+
placeholder: A,
|
|
86
|
+
onClick: S,
|
|
87
87
|
disabled: a,
|
|
88
88
|
clearButton: s,
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
customElement: c?.indicator,
|
|
90
|
+
clearButtonIcon: R,
|
|
91
|
+
value: c?.title ?? ""
|
|
91
92
|
}
|
|
92
93
|
)
|
|
93
94
|
}
|
package/dist/bundle.es16.js
CHANGED
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
import { jsxs as i, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { Icon as
|
|
2
|
+
import v from "classnames";
|
|
3
|
+
import { Icon as k } from "./bundle.es36.js";
|
|
4
4
|
import { attr as t } from "@companix/utils-browser";
|
|
5
|
-
import { forwardRef as
|
|
6
|
-
import { faCheck as
|
|
7
|
-
const
|
|
8
|
-
({ title: d, icon:
|
|
9
|
-
const f = (
|
|
10
|
-
|
|
5
|
+
import { forwardRef as x } from "react";
|
|
6
|
+
import { faCheck as C } from "@companix/icons-solid";
|
|
7
|
+
const R = x(
|
|
8
|
+
({ title: d, icon: e, active: n, label: c, indicator: l, disabled: a, minimal: r, onClick: s, className: m, ...p }, h) => {
|
|
9
|
+
const f = (N) => {
|
|
10
|
+
a || s?.(N);
|
|
11
11
|
};
|
|
12
12
|
return /* @__PURE__ */ i(
|
|
13
13
|
"div",
|
|
14
14
|
{
|
|
15
|
-
ref:
|
|
16
|
-
...
|
|
17
|
-
className:
|
|
18
|
-
"data-selected": t(
|
|
19
|
-
"data-disabled": t(
|
|
20
|
-
"data-minimal": t(
|
|
15
|
+
ref: h,
|
|
16
|
+
...p,
|
|
17
|
+
className: v("option", m),
|
|
18
|
+
"data-selected": t(n),
|
|
19
|
+
"data-disabled": t(a),
|
|
20
|
+
"data-minimal": t(r),
|
|
21
21
|
onClick: f,
|
|
22
22
|
children: [
|
|
23
23
|
/* @__PURE__ */ i("div", { className: "option-content", children: [
|
|
24
|
-
|
|
24
|
+
e && /* @__PURE__ */ o("div", { className: "option-icon", children: e }),
|
|
25
25
|
/* @__PURE__ */ i("div", { className: "option-content-layout", children: [
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
|
|
26
|
+
/* @__PURE__ */ i("div", { className: "option-header", children: [
|
|
27
|
+
/* @__PURE__ */ o("div", { className: "option-title", children: d }),
|
|
28
|
+
l
|
|
29
|
+
] }),
|
|
30
|
+
c && /* @__PURE__ */ o("div", { className: "option-label", children: c })
|
|
28
31
|
] })
|
|
29
32
|
] }),
|
|
30
|
-
|
|
33
|
+
n && !r && /* @__PURE__ */ o("div", { className: "option-check", children: /* @__PURE__ */ o(k, { icon: C }) })
|
|
31
34
|
]
|
|
32
35
|
}
|
|
33
36
|
);
|
|
34
37
|
}
|
|
35
38
|
);
|
|
36
39
|
export {
|
|
37
|
-
|
|
40
|
+
R as OptionItem
|
|
38
41
|
};
|
package/dist/bundle.es62.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as o, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import y from "classnames";
|
|
3
3
|
import { attr as s } from "@companix/utils-browser";
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { VisuallyHidden as
|
|
6
|
-
import { mergeRefs as
|
|
7
|
-
import { SelectRightElements as
|
|
8
|
-
const
|
|
4
|
+
import { forwardRef as D, useRef as S, useCallback as T } from "react";
|
|
5
|
+
import { VisuallyHidden as j } from "@radix-ui/react-visually-hidden";
|
|
6
|
+
import { mergeRefs as z } from "react-merge-refs";
|
|
7
|
+
import { SelectRightElements as B } from "./bundle.es73.js";
|
|
8
|
+
const G = D(
|
|
9
9
|
({
|
|
10
10
|
required: a,
|
|
11
11
|
size: i,
|
|
@@ -16,40 +16,41 @@ const W = y(
|
|
|
16
16
|
clearButton: m,
|
|
17
17
|
placeholder: p,
|
|
18
18
|
clearButtonIcon: f,
|
|
19
|
+
customElement: h,
|
|
19
20
|
disabled: r,
|
|
20
|
-
onClear:
|
|
21
|
-
inputRef:
|
|
22
|
-
onClick:
|
|
23
|
-
...
|
|
24
|
-
},
|
|
25
|
-
const e =
|
|
21
|
+
onClear: C,
|
|
22
|
+
inputRef: I,
|
|
23
|
+
onClick: N,
|
|
24
|
+
...k
|
|
25
|
+
}, v) => {
|
|
26
|
+
const e = S(null), F = T(
|
|
26
27
|
(t) => {
|
|
27
28
|
if (!e.current || !document)
|
|
28
29
|
return;
|
|
29
30
|
t.target !== e.current && (e.current.click(), document.activeElement !== e.current && e.current.focus());
|
|
30
31
|
},
|
|
31
32
|
[e]
|
|
32
|
-
),
|
|
33
|
+
), g = (t) => {
|
|
33
34
|
document && document.activeElement === e.current && t.preventDefault();
|
|
34
|
-
}, g = (t) => {
|
|
35
|
-
r || v(t);
|
|
36
35
|
}, R = (t) => {
|
|
37
|
-
F(t);
|
|
36
|
+
r || F(t);
|
|
38
37
|
}, x = (t) => {
|
|
39
|
-
|
|
38
|
+
g(t);
|
|
39
|
+
}, A = (t) => {
|
|
40
|
+
e.current && e.current.focus(), C?.(t);
|
|
40
41
|
};
|
|
41
42
|
return /* @__PURE__ */ o(
|
|
42
43
|
"div",
|
|
43
44
|
{
|
|
44
|
-
ref:
|
|
45
|
-
className:
|
|
45
|
+
ref: v,
|
|
46
|
+
className: y("form select", d),
|
|
46
47
|
"data-size": i ?? "md",
|
|
47
48
|
"data-fill": s(u),
|
|
48
49
|
"data-required": s(a),
|
|
49
50
|
"data-disabled": s(r),
|
|
50
|
-
onMouseDown:
|
|
51
|
-
onClick:
|
|
52
|
-
...
|
|
51
|
+
onMouseDown: x,
|
|
52
|
+
onClick: R,
|
|
53
|
+
...k,
|
|
53
54
|
children: [
|
|
54
55
|
/* @__PURE__ */ o("div", { className: "select-layout form-input", children: [
|
|
55
56
|
l && /* @__PURE__ */ n("div", { className: "select-element", children: l }),
|
|
@@ -58,25 +59,26 @@ const W = y(
|
|
|
58
59
|
c
|
|
59
60
|
] }) }),
|
|
60
61
|
/* @__PURE__ */ n("div", { className: "select-element", children: /* @__PURE__ */ n(
|
|
61
|
-
|
|
62
|
+
B,
|
|
62
63
|
{
|
|
64
|
+
customElement: h,
|
|
63
65
|
clearButton: m,
|
|
64
66
|
value: !!c,
|
|
65
67
|
clearButtonIcon: f,
|
|
66
|
-
onClear:
|
|
68
|
+
onClear: A
|
|
67
69
|
}
|
|
68
70
|
) })
|
|
69
71
|
] }),
|
|
70
|
-
/* @__PURE__ */ n(
|
|
72
|
+
/* @__PURE__ */ n(j, { asChild: !0, children: /* @__PURE__ */ n(
|
|
71
73
|
"input",
|
|
72
74
|
{
|
|
73
|
-
ref:
|
|
75
|
+
ref: z([I, e]),
|
|
74
76
|
autoComplete: "off",
|
|
75
77
|
autoCapitalize: "none",
|
|
76
78
|
autoCorrect: "off",
|
|
77
79
|
spellCheck: "false",
|
|
78
80
|
"aria-autocomplete": "none",
|
|
79
|
-
onClick:
|
|
81
|
+
onClick: N,
|
|
80
82
|
readOnly: !0
|
|
81
83
|
}
|
|
82
84
|
) })
|
|
@@ -86,5 +88,5 @@ const W = y(
|
|
|
86
88
|
}
|
|
87
89
|
);
|
|
88
90
|
export {
|
|
89
|
-
|
|
91
|
+
G as SelectInput
|
|
90
92
|
};
|
package/dist/bundle.es64.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { Spinner as
|
|
1
|
+
import { jsx as i, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as P, useEffect as C } from "react";
|
|
3
|
+
import { Spinner as T } from "./bundle.es7.js";
|
|
4
4
|
import { OptionItem as L } from "./bundle.es16.js";
|
|
5
|
-
import { OptionsList as
|
|
6
|
-
import { Icon as
|
|
7
|
-
import { faPlus as
|
|
8
|
-
const
|
|
9
|
-
const { onOptionsLoaded: n, useOptions: s =
|
|
5
|
+
import { OptionsList as R } from "./bundle.es18.js";
|
|
6
|
+
import { Icon as S } from "./bundle.es36.js";
|
|
7
|
+
import { faPlus as b } from "@companix/icons-solid";
|
|
8
|
+
const I = () => ({ isLoading: !1, options: [] }), N = (e) => {
|
|
9
|
+
const { onOptionsLoaded: n, useOptions: s = I, options: o } = e, t = s();
|
|
10
10
|
return C(() => {
|
|
11
11
|
t.options.length > 0 && n?.(t.options);
|
|
12
12
|
}, [t.options]), o ? { options: o, isLoading: !1 } : t;
|
|
13
|
-
},
|
|
13
|
+
}, M = (e) => {
|
|
14
14
|
const {
|
|
15
15
|
isActive: n,
|
|
16
16
|
emptyText: s,
|
|
@@ -25,9 +25,9 @@ const b = () => ({ isLoading: !1, options: [] }), I = (e) => {
|
|
|
25
25
|
disableFiltering: l,
|
|
26
26
|
close: c,
|
|
27
27
|
...m
|
|
28
|
-
} = e, { emptyText: x, options: a, isLoading: g } =
|
|
29
|
-
return g ?? o ? /* @__PURE__ */ i("div", { className: "select-popover-loading", children: /* @__PURE__ */ i(
|
|
30
|
-
|
|
28
|
+
} = e, { emptyText: x, options: a, isLoading: g } = N(m), v = P(() => r && !l ? a.filter(r) : a, [a, r, l]);
|
|
29
|
+
return g ?? o ? /* @__PURE__ */ i("div", { className: "select-popover-loading", children: /* @__PURE__ */ i(T, { size: 24 }) }) : /* @__PURE__ */ i(
|
|
30
|
+
j,
|
|
31
31
|
{
|
|
32
32
|
options: v,
|
|
33
33
|
isActive: n,
|
|
@@ -41,7 +41,7 @@ const b = () => ({ isLoading: !1, options: [] }), I = (e) => {
|
|
|
41
41
|
close: c
|
|
42
42
|
}
|
|
43
43
|
);
|
|
44
|
-
},
|
|
44
|
+
}, j = (e) => {
|
|
45
45
|
const {
|
|
46
46
|
isActive: n,
|
|
47
47
|
onOpened: s,
|
|
@@ -61,7 +61,7 @@ const b = () => ({ isLoading: !1, options: [] }), I = (e) => {
|
|
|
61
61
|
L,
|
|
62
62
|
{
|
|
63
63
|
className: "select-add-option",
|
|
64
|
-
icon: /* @__PURE__ */ i(
|
|
64
|
+
icon: /* @__PURE__ */ i(S, { icon: b }),
|
|
65
65
|
title: o.text,
|
|
66
66
|
onClick: o.onClick,
|
|
67
67
|
onClickCapture: () => {
|
|
@@ -69,10 +69,10 @@ const b = () => ({ isLoading: !1, options: [] }), I = (e) => {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
) : void 0;
|
|
72
|
-
return /* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ y(R, { scrollboxRef: t, optionsWrapperRef: d, maxHeight: 300, children: [
|
|
73
73
|
(o?.position === void 0 || o?.position === "first") && l,
|
|
74
74
|
p.length === 0 && !o && /* @__PURE__ */ i("div", { className: "select-tags-noneresults", children: u }),
|
|
75
|
-
p.map(({ title: c, value: m, className: x, icon: a, disabled: g,
|
|
75
|
+
p.map(({ title: c, value: m, className: x, icon: a, disabled: g, indicator: v, label: h }, k) => /* @__PURE__ */ i(
|
|
76
76
|
L,
|
|
77
77
|
{
|
|
78
78
|
active: n(m),
|
|
@@ -81,15 +81,16 @@ const b = () => ({ isLoading: !1, options: [] }), I = (e) => {
|
|
|
81
81
|
disabled: g,
|
|
82
82
|
className: x,
|
|
83
83
|
title: c,
|
|
84
|
-
label:
|
|
84
|
+
label: h,
|
|
85
|
+
indicator: v,
|
|
85
86
|
icon: a
|
|
86
87
|
},
|
|
87
|
-
`select-option-${
|
|
88
|
+
`select-option-${k}`
|
|
88
89
|
)),
|
|
89
90
|
o?.position === "last" && l
|
|
90
91
|
] });
|
|
91
92
|
};
|
|
92
93
|
export {
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
M as OptionsPopover,
|
|
95
|
+
j as SelectOptionsList
|
|
95
96
|
};
|
package/dist/bundle.es73.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { faXmark as i, faChevronDown as
|
|
1
|
+
import { jsxs as a, Fragment as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { faXmark as i, faChevronDown as x } from "@companix/icons-solid";
|
|
3
3
|
import { Icon as o } from "./bundle.es36.js";
|
|
4
|
-
const
|
|
5
|
-
const { clearButton: c, clearButtonIcon:
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
|
|
8
|
-
/* @__PURE__ */ e(
|
|
4
|
+
const d = (n) => {
|
|
5
|
+
const { customElement: t, clearButton: c, clearButtonIcon: s, value: l, onClear: r } = n;
|
|
6
|
+
return /* @__PURE__ */ a(m, { children: [
|
|
7
|
+
t,
|
|
8
|
+
c && l && /* @__PURE__ */ e("button", { className: "select-close-button", onClick: r, children: s ?? /* @__PURE__ */ e(o, { className: "select-close-icon", icon: i, size: "xxxs" }) }),
|
|
9
|
+
/* @__PURE__ */ e(o, { className: "expand-icon select-expand", icon: x, size: "xxxs" })
|
|
9
10
|
] });
|
|
10
11
|
};
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
+
d as SelectRightElements
|
|
13
14
|
};
|
package/dist/types.d.ts
CHANGED