@companix/uikit 0.0.58 → 0.0.60
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/SelectTags/index.d.ts +2 -0
- package/dist/Skeleton/index.d.ts +1 -1
- package/dist/bundle.es27.js +67 -62
- package/dist/bundle.es35.js +3 -3
- package/package.json +1 -1
|
@@ -3,6 +3,8 @@ import { SelectAddOption } from '../Select/SelectOptions';
|
|
|
3
3
|
export interface SelectTagsProps<T> {
|
|
4
4
|
options: Option<T>[];
|
|
5
5
|
onChange: (event: T[]) => void;
|
|
6
|
+
onInputChange?: (text: string) => void;
|
|
7
|
+
onPopoverOpen?: (open: boolean) => void;
|
|
6
8
|
placeholder?: string;
|
|
7
9
|
value: T[];
|
|
8
10
|
children?: React.ReactNode;
|
package/dist/Skeleton/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export interface SkeletonProps extends Pick<React.CSSProperties, 'width' | 'height' | '
|
|
1
|
+
export interface SkeletonProps extends Pick<React.CSSProperties, 'width' | 'height' | 'minWidth' | 'maxWidth' | 'inlineSize' | 'blockSize' | 'maxInlineSize' | 'borderRadius' | 'margin'> {
|
|
2
2
|
}
|
|
3
3
|
export declare const Skeleton: ({ ...styles }: SkeletonProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/bundle.es27.js
CHANGED
|
@@ -1,95 +1,100 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useFroozeClosing as
|
|
3
|
-
import { Popover as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { attr as
|
|
7
|
-
import { mergeRefs as
|
|
8
|
-
import { faXmark as
|
|
9
|
-
import { matchPattern as
|
|
10
|
-
import { SelectOptionsList as
|
|
11
|
-
import { SelectLoader as
|
|
12
|
-
const
|
|
1
|
+
import { jsx as n, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { useFroozeClosing as B } from "./bundle.es47.js";
|
|
3
|
+
import { Popover as X } from "./bundle.es10.js";
|
|
4
|
+
import { useState as G, useRef as f, useMemo as d } from "react";
|
|
5
|
+
import { Icon as h } from "./bundle.es33.js";
|
|
6
|
+
import { attr as g, getActiveElementByAnotherElement as H, contains as J } from "@companix/utils-browser";
|
|
7
|
+
import { mergeRefs as K } from "react-merge-refs";
|
|
8
|
+
import { faXmark as Q, faChevronDown as U } from "@companix/icons-solid";
|
|
9
|
+
import { matchPattern as W } from "@companix/utils-js";
|
|
10
|
+
import { SelectOptionsList as Y } from "./bundle.es50.js";
|
|
11
|
+
import { SelectLoader as Z } from "./bundle.es51.js";
|
|
12
|
+
const ue = (v) => {
|
|
13
13
|
const {
|
|
14
14
|
options: r,
|
|
15
|
-
closeAfterSelect:
|
|
15
|
+
closeAfterSelect: C,
|
|
16
16
|
placeholder: x,
|
|
17
17
|
onChange: s,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
onInputChange: N,
|
|
19
|
+
emptyText: R,
|
|
20
|
+
readOnly: l,
|
|
21
|
+
size: A = "md",
|
|
22
|
+
value: o,
|
|
23
|
+
inputRef: O,
|
|
24
|
+
onPopoverOpen: P,
|
|
25
|
+
minimalOptions: z,
|
|
26
|
+
isLoading: D,
|
|
25
27
|
disabled: m,
|
|
26
|
-
required:
|
|
27
|
-
addOption:
|
|
28
|
-
} =
|
|
28
|
+
required: S,
|
|
29
|
+
addOption: b
|
|
30
|
+
} = v, [a, E] = G(""), i = f(null), k = f(null), { popoverRef: c, froozePopoverPosition: y, handleAnimationEnd: I } = B(), p = d(() => {
|
|
29
31
|
const e = {};
|
|
30
32
|
return r.forEach((t) => {
|
|
31
33
|
e[t.value] = t;
|
|
32
34
|
}), e;
|
|
33
|
-
}, [r]),
|
|
34
|
-
|
|
35
|
-
},
|
|
35
|
+
}, [r]), T = (e) => o.includes(e) ? [...o] : [...o, e], w = (e) => o.filter((t) => e !== t), F = (e, t) => {
|
|
36
|
+
C ? (y(), s(e), t()) : s(e);
|
|
37
|
+
}, L = d(() => a.trim() ? r.filter(({ title: e }) => W(e, a)) : r, [a, r]), M = (e) => {
|
|
36
38
|
if (m) return;
|
|
37
|
-
|
|
38
|
-
const t =
|
|
39
|
-
e.defaultPrevented ||
|
|
40
|
-
},
|
|
39
|
+
c.current && c.current.getAttribute("data-state") === "open" && e.preventDefault();
|
|
40
|
+
const t = H(e.currentTarget);
|
|
41
|
+
e.defaultPrevented || J(e.currentTarget, t) || i.current && i.current.focus();
|
|
42
|
+
}, j = (e) => {
|
|
41
43
|
e.target !== i.current && e.preventDefault();
|
|
42
|
-
},
|
|
43
|
-
e.stopPropagation(), s(
|
|
44
|
+
}, q = (e, t) => {
|
|
45
|
+
e.stopPropagation(), s(w(t));
|
|
46
|
+
}, V = ({ target: e }) => {
|
|
47
|
+
E(e.value), N?.(e.value);
|
|
44
48
|
};
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
|
|
49
|
+
return /* @__PURE__ */ n(
|
|
50
|
+
X,
|
|
47
51
|
{
|
|
48
52
|
minimal: !0,
|
|
49
|
-
ref:
|
|
53
|
+
ref: c,
|
|
50
54
|
sideOffset: 0,
|
|
51
55
|
matchTarget: "width",
|
|
52
|
-
onAnimationEnd:
|
|
56
|
+
onAnimationEnd: I,
|
|
53
57
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
54
58
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
onOpenChange: P,
|
|
60
|
+
content: ({ close: e }) => D ? /* @__PURE__ */ n(Z, {}) : /* @__PURE__ */ n(
|
|
61
|
+
Y,
|
|
57
62
|
{
|
|
58
|
-
isActive: (t) =>
|
|
59
|
-
options:
|
|
60
|
-
emptyText:
|
|
61
|
-
onSelect: (t) =>
|
|
62
|
-
minimalOptions:
|
|
63
|
-
addOption:
|
|
63
|
+
isActive: (t) => o.includes(t),
|
|
64
|
+
options: L,
|
|
65
|
+
emptyText: R,
|
|
66
|
+
onSelect: (t) => F(T(t), e),
|
|
67
|
+
minimalOptions: z,
|
|
68
|
+
addOption: b
|
|
64
69
|
}
|
|
65
70
|
),
|
|
66
|
-
children: /* @__PURE__ */
|
|
71
|
+
children: /* @__PURE__ */ n(
|
|
67
72
|
"div",
|
|
68
73
|
{
|
|
69
74
|
className: "form",
|
|
70
|
-
onClick:
|
|
71
|
-
onMouseDown:
|
|
72
|
-
"data-size":
|
|
73
|
-
"data-required":
|
|
75
|
+
onClick: M,
|
|
76
|
+
onMouseDown: j,
|
|
77
|
+
"data-size": A,
|
|
78
|
+
"data-required": g(S),
|
|
74
79
|
children: /* @__PURE__ */ u("div", { className: "select-tags-container", children: [
|
|
75
80
|
/* @__PURE__ */ u("div", { className: "select-tags", children: [
|
|
76
|
-
|
|
81
|
+
o.length > 0 && /* @__PURE__ */ n(
|
|
77
82
|
"div",
|
|
78
83
|
{
|
|
79
84
|
className: "tag-container",
|
|
80
|
-
ref:
|
|
85
|
+
ref: k,
|
|
81
86
|
role: "listbox",
|
|
82
|
-
"data-readonly":
|
|
83
|
-
children:
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
] }, `tag-option-${e}-${t}`))
|
|
87
|
+
"data-readonly": g(l),
|
|
88
|
+
children: o.map((e, t) => p[e] ? /* @__PURE__ */ u("div", { className: "tag", children: [
|
|
89
|
+
/* @__PURE__ */ n("span", { className: "tag-name", children: p[e].title }),
|
|
90
|
+
/* @__PURE__ */ n("button", { className: "tag-close-button", onClick: ($) => q($, e), children: /* @__PURE__ */ n(h, { className: "tag-close-icon", icon: Q, size: "xxxs" }) })
|
|
91
|
+
] }, `tag-option-${e}-${t}`) : null)
|
|
87
92
|
}
|
|
88
93
|
),
|
|
89
|
-
(!
|
|
94
|
+
(!l || o.length === 0) && /* @__PURE__ */ n(
|
|
90
95
|
"input",
|
|
91
96
|
{
|
|
92
|
-
ref:
|
|
97
|
+
ref: K([O, i]),
|
|
93
98
|
type: "text",
|
|
94
99
|
autoCapitalize: "none",
|
|
95
100
|
autoComplete: "off",
|
|
@@ -98,13 +103,13 @@ const se = (g) => {
|
|
|
98
103
|
spellCheck: !1,
|
|
99
104
|
value: a,
|
|
100
105
|
disabled: m,
|
|
101
|
-
readOnly:
|
|
106
|
+
readOnly: l,
|
|
102
107
|
placeholder: x,
|
|
103
|
-
onChange:
|
|
108
|
+
onChange: V
|
|
104
109
|
}
|
|
105
110
|
)
|
|
106
111
|
] }),
|
|
107
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ n(h, { className: "expand-icon", icon: U, size: "xxxs" })
|
|
108
113
|
] })
|
|
109
114
|
}
|
|
110
115
|
)
|
|
@@ -112,5 +117,5 @@ const se = (g) => {
|
|
|
112
117
|
);
|
|
113
118
|
};
|
|
114
119
|
export {
|
|
115
|
-
|
|
120
|
+
ue as SelectTags
|
|
116
121
|
};
|
package/dist/bundle.es35.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as e, Fragment as
|
|
2
|
-
const
|
|
1
|
+
import { jsx as e, Fragment as t } from "react/jsx-runtime";
|
|
2
|
+
const l = ({ ...r }) => /* @__PURE__ */ e("div", { className: "skeleton", style: r, children: /* @__PURE__ */ e(t, { children: "" }) });
|
|
3
3
|
export {
|
|
4
|
-
|
|
4
|
+
l as Skeleton
|
|
5
5
|
};
|