@wrdagency/blockout 1.0.7 → 1.0.8
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
-
import { Colourway as
|
|
3
|
-
import { noop as
|
|
4
|
-
import { useState as
|
|
2
|
+
import { Colourway as _ } from "../../../primitives/colourway/index.js";
|
|
3
|
+
import { noop as O } from "../../../utils/noop.js";
|
|
4
|
+
import { useState as g, useMemo as R } from "react";
|
|
5
5
|
import '../../../assets/style18.css';import '../../../assets/styles.css';import '../../../assets/style7.css';import '../../../assets/style6.css';import '../../../assets/style5.css';import '../../../assets/style4.css';import '../../../assets/style3.css';import '../../../assets/style2.css';import '../../../assets/style.css';/* empty css */
|
|
6
6
|
/* empty css */
|
|
7
7
|
/* empty css */
|
|
@@ -13,73 +13,75 @@ import "../../../primitives/symbol/index.js";
|
|
|
13
13
|
/* empty css */
|
|
14
14
|
/* empty css */
|
|
15
15
|
/* empty css */
|
|
16
|
-
import { o as
|
|
17
|
-
import { e as
|
|
18
|
-
import { e as
|
|
19
|
-
import { m as
|
|
20
|
-
import { BaseControl as
|
|
21
|
-
import { useBaseControlProps as
|
|
22
|
-
import { T as
|
|
23
|
-
import { normalizeTag as
|
|
16
|
+
import { o as k } from "../../../Check.es-CMkTf2It.js";
|
|
17
|
+
import { e as B } from "../../../Plus.es-DJ5SuqNv.js";
|
|
18
|
+
import { e as I } from "../../../X.es-TbGOnXOO.js";
|
|
19
|
+
import { m as j } from "../../../match-sorter.esm-MNVE8H_6.js";
|
|
20
|
+
import { BaseControl as L } from "../base-control/index.js";
|
|
21
|
+
import { useBaseControlProps as M } from "../base-control/props.js";
|
|
22
|
+
import { T as A, a as K, b as U, c as $, d as q, C as D, e as E } from "../../../tag-remove-BVa8oSsq.js";
|
|
23
|
+
import { normalizeTag as d, normalizeCreateTagRules as F } from "./props.js";
|
|
24
24
|
/* empty css */
|
|
25
|
-
import { C as
|
|
26
|
-
function
|
|
27
|
-
const { baseProps:
|
|
25
|
+
import { C as G, a as H, c as h } from "../../../MAXQOH4L-DBaf8WKp.js";
|
|
26
|
+
function Co(v) {
|
|
27
|
+
const { baseProps: b, controlProps: f } = M(v, {
|
|
28
28
|
className: "component-tag-control"
|
|
29
|
-
}), [a,
|
|
30
|
-
value:
|
|
31
|
-
onChangeValue:
|
|
32
|
-
options:
|
|
33
|
-
create:
|
|
34
|
-
} =
|
|
35
|
-
baseSort: (o,
|
|
29
|
+
}), [a, C] = g(""), [N, w] = g([]), {
|
|
30
|
+
value: x = [],
|
|
31
|
+
onChangeValue: T = O,
|
|
32
|
+
options: P = [],
|
|
33
|
+
create: S = !1
|
|
34
|
+
} = f, c = [...P.map(d), ...N], p = x.map(d), n = F(S), l = R(() => j(c, a, {
|
|
35
|
+
baseSort: (o, s) => o.index < s.index ? -1 : 1,
|
|
36
36
|
keys: ["label", "value"]
|
|
37
|
-
}), [a]),
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
return
|
|
42
|
-
if (
|
|
43
|
-
|
|
37
|
+
}), [a]), i = !l.length && n.allow(a), V = l.length > 0 || i, y = (o) => {
|
|
38
|
+
const s = o.map((m) => {
|
|
39
|
+
const u = c.find((r) => r.value == m);
|
|
40
|
+
if (u)
|
|
41
|
+
return u;
|
|
42
|
+
if (n.allow(m)) {
|
|
43
|
+
const r = n.create(m);
|
|
44
|
+
return w((z) => [...z, r]), r;
|
|
45
|
+
}
|
|
44
46
|
}).filter(Boolean);
|
|
45
|
-
|
|
47
|
+
T(s);
|
|
46
48
|
};
|
|
47
49
|
return /* @__PURE__ */ e(
|
|
48
|
-
|
|
50
|
+
A,
|
|
49
51
|
{
|
|
50
|
-
values:
|
|
51
|
-
setValues:
|
|
52
|
+
values: p.map((o) => String(o.value)),
|
|
53
|
+
setValues: y,
|
|
52
54
|
value: a,
|
|
53
|
-
setValue:
|
|
54
|
-
children: /* @__PURE__ */ e(
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
setValue: C,
|
|
56
|
+
children: /* @__PURE__ */ e(L, { ...b, children: /* @__PURE__ */ t(K, { className: "component-tag-control__box", children: [
|
|
57
|
+
p.map((o) => /* @__PURE__ */ t(
|
|
58
|
+
_,
|
|
57
59
|
{
|
|
58
60
|
value: String(o.value),
|
|
59
|
-
as:
|
|
61
|
+
as: U,
|
|
60
62
|
theme: o.colourway,
|
|
61
63
|
className: "component-tag-control__tag",
|
|
62
64
|
children: [
|
|
63
65
|
/* @__PURE__ */ e("span", { className: "component-tag-control__tag__label", children: o.label }),
|
|
64
|
-
/* @__PURE__ */ e(
|
|
66
|
+
/* @__PURE__ */ e($, { className: "component-tag-control__tag__remove", children: /* @__PURE__ */ e(I, {}) })
|
|
65
67
|
]
|
|
66
68
|
},
|
|
67
69
|
o.value
|
|
68
70
|
)),
|
|
69
|
-
/* @__PURE__ */ t(
|
|
71
|
+
/* @__PURE__ */ t(G, { children: [
|
|
70
72
|
/* @__PURE__ */ e(
|
|
71
|
-
|
|
73
|
+
H,
|
|
72
74
|
{
|
|
73
75
|
autoSelect: !0,
|
|
74
76
|
showMinLength: 1,
|
|
75
77
|
showOnKeyPress: !0,
|
|
76
78
|
autoComplete: "both",
|
|
77
|
-
render: /* @__PURE__ */ e(
|
|
79
|
+
render: /* @__PURE__ */ e(q, {}),
|
|
78
80
|
className: "component-tag-control__input"
|
|
79
81
|
}
|
|
80
82
|
),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
V && /* @__PURE__ */ t(
|
|
84
|
+
D,
|
|
83
85
|
{
|
|
84
86
|
className: "component-tag-control__popover",
|
|
85
87
|
"data-colour-scheme": "invert",
|
|
@@ -90,32 +92,32 @@ function vo(d) {
|
|
|
90
92
|
gutter: 8,
|
|
91
93
|
overflowPadding: 4,
|
|
92
94
|
children: [
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
l.map((o) => /* @__PURE__ */ t(
|
|
96
|
+
h,
|
|
95
97
|
{
|
|
96
98
|
value: String(o.value),
|
|
97
99
|
className: "component-tag-control__option",
|
|
98
100
|
children: [
|
|
99
101
|
/* @__PURE__ */ e(
|
|
100
|
-
|
|
102
|
+
_,
|
|
101
103
|
{
|
|
102
104
|
className: "component-tag-control__option__chip",
|
|
103
105
|
theme: o.colourway
|
|
104
106
|
}
|
|
105
107
|
),
|
|
106
108
|
/* @__PURE__ */ e("span", { className: "component-tag-control__option__label", children: o.label }),
|
|
107
|
-
/* @__PURE__ */ e(
|
|
109
|
+
/* @__PURE__ */ e(E, { className: "component-tag-control__option__check", children: /* @__PURE__ */ e(k, {}) })
|
|
108
110
|
]
|
|
109
111
|
},
|
|
110
112
|
o.value
|
|
111
113
|
)),
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
i && /* @__PURE__ */ t(
|
|
115
|
+
h,
|
|
114
116
|
{
|
|
115
117
|
value: a,
|
|
116
118
|
className: "component-tag-control__option component-tag-control__option--create",
|
|
117
119
|
children: [
|
|
118
|
-
/* @__PURE__ */ e(
|
|
120
|
+
/* @__PURE__ */ e(B, { className: "component-tag-control__option--add" }),
|
|
119
121
|
/* @__PURE__ */ t("span", { className: "component-tag-control__option__label", children: [
|
|
120
122
|
'Add "',
|
|
121
123
|
a.toUpperCase(),
|
|
@@ -133,5 +135,5 @@ function vo(d) {
|
|
|
133
135
|
);
|
|
134
136
|
}
|
|
135
137
|
export {
|
|
136
|
-
|
|
138
|
+
Co as TagControl
|
|
137
139
|
};
|
|
@@ -13,8 +13,8 @@ import "../../../primitives/symbol/index.js";
|
|
|
13
13
|
/* empty css */
|
|
14
14
|
/* empty css */
|
|
15
15
|
/* empty css */
|
|
16
|
-
import { slugify as
|
|
17
|
-
function
|
|
16
|
+
import { slugify as i } from "../../../utils/string.js";
|
|
17
|
+
function S(r) {
|
|
18
18
|
return typeof r == "string" || typeof r == "number" ? {
|
|
19
19
|
value: r,
|
|
20
20
|
label: String(r),
|
|
@@ -25,33 +25,26 @@ function U(r) {
|
|
|
25
25
|
...r
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
allow: () => !0
|
|
46
|
-
} : r === !1 ? {
|
|
47
|
-
create: e,
|
|
48
|
-
allow: () => !1
|
|
49
|
-
} : {
|
|
50
|
-
create: e,
|
|
51
|
-
allow: r.allow ? r.allow : () => !0
|
|
28
|
+
function U(r) {
|
|
29
|
+
return {
|
|
30
|
+
create: (e) => {
|
|
31
|
+
var o = e;
|
|
32
|
+
if (typeof r == "boolean" || typeof r.create > "u" || r.create === "slugify")
|
|
33
|
+
o = i(e);
|
|
34
|
+
else if (r.create === "uuid")
|
|
35
|
+
o = crypto.randomUUID();
|
|
36
|
+
else
|
|
37
|
+
return {
|
|
38
|
+
label: e,
|
|
39
|
+
colourway: t(e),
|
|
40
|
+
...r.create(e)
|
|
41
|
+
};
|
|
42
|
+
return { label: e, colourway: t(e), value: o };
|
|
43
|
+
},
|
|
44
|
+
allow: (e) => r === !1 ? !1 : r === !0 || typeof r.allow > "u" ? e.trim().length >= 1 : r.allow(e)
|
|
52
45
|
};
|
|
53
46
|
}
|
|
54
47
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
U as normalizeCreateTagRules,
|
|
49
|
+
S as normalizeTag
|
|
57
50
|
};
|