@wrdagency/blockout 1.0.7 → 1.0.9

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 u } from "../../../primitives/colourway/index.js";
3
- import { noop as S } from "../../../utils/noop.js";
4
- import { useState as V, useMemo as y } from "react";
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 z } from "../../../Check.es-CMkTf2It.js";
17
- import { e as R } from "../../../Plus.es-DJ5SuqNv.js";
18
- import { e as k } from "../../../X.es-TbGOnXOO.js";
19
- import { m as B } from "../../../match-sorter.esm-MNVE8H_6.js";
20
- import { BaseControl as I } from "../base-control/index.js";
21
- import { useBaseControlProps as j } from "../base-control/props.js";
22
- import { T as L, a as M, b as O, c as A, d as K, C as U, e as $ } from "../../../tag-remove-BVa8oSsq.js";
23
- import { normalizeTag as _, normalizeCreateTagRules as q } from "./props.js";
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 D, a as E, c as g } from "../../../MAXQOH4L-DBaf8WKp.js";
26
- function vo(d) {
27
- const { baseProps: h, controlProps: v } = j(d, {
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, b] = V(""), {
30
- value: f = [],
31
- onChangeValue: C = S,
32
- options: N = [],
33
- create: w = !1
34
- } = v, m = N.map(_), c = f.map(_), r = q(w), n = y(() => B(m, a, {
35
- baseSort: (o, l) => o.index < l.index ? -1 : 1,
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]), p = !n.length && r.allow(a), x = n.length > 0 || p, T = (o) => {
38
- const l = o.map((s) => {
39
- const i = m.find((P) => P.value == s);
40
- if (i)
41
- return i;
42
- if (r.allow(s))
43
- return r.create(s);
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
- C(l);
47
+ T(s);
46
48
  };
47
49
  return /* @__PURE__ */ e(
48
- L,
50
+ A,
49
51
  {
50
- values: c.map((o) => String(o.value)),
51
- setValues: T,
52
+ values: p.map((o) => String(o.value)),
53
+ setValues: y,
52
54
  value: a,
53
- setValue: b,
54
- children: /* @__PURE__ */ e(I, { ...h, children: /* @__PURE__ */ t(M, { className: "component-tag-control__box", children: [
55
- c.map((o) => /* @__PURE__ */ t(
56
- u,
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: O,
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(A, { className: "component-tag-control__tag__remove", children: /* @__PURE__ */ e(k, {}) })
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(D, { children: [
71
+ /* @__PURE__ */ t(G, { children: [
70
72
  /* @__PURE__ */ e(
71
- E,
73
+ H,
72
74
  {
73
75
  autoSelect: !0,
74
76
  showMinLength: 1,
75
77
  showOnKeyPress: !0,
76
78
  autoComplete: "both",
77
- render: /* @__PURE__ */ e(K, {}),
79
+ render: /* @__PURE__ */ e(q, {}),
78
80
  className: "component-tag-control__input"
79
81
  }
80
82
  ),
81
- x && /* @__PURE__ */ t(
82
- U,
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
- n.map((o) => /* @__PURE__ */ t(
94
- g,
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
- u,
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($, { className: "component-tag-control__option__check", children: /* @__PURE__ */ e(z, {}) })
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
- p && /* @__PURE__ */ t(
113
- g,
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(R, { className: "component-tag-control__option--add" }),
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
- vo as TagControl
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 a } from "../../../utils/string.js";
17
- function U(r) {
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 h(r) {
29
- const e = (o) => {
30
- var i = o;
31
- if (typeof r == "boolean" || typeof r.create > "u" || r.create === "slugify")
32
- i = a(o);
33
- else if (r.create === "uuid")
34
- i = crypto.randomUUID();
35
- else
36
- return {
37
- label: o,
38
- colourway: t(o),
39
- ...r.create(o)
40
- };
41
- return { label: o, colourway: t(o), value: i };
42
- };
43
- return r === !0 ? {
44
- create: e,
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
- h as normalizeCreateTagRules,
56
- U as normalizeTag
48
+ U as normalizeCreateTagRules,
49
+ S as normalizeTag
57
50
  };
@@ -1,8 +1,6 @@
1
- function o(e, u) {
2
- return u.split(".").reduce(function(t, n) {
3
- return t[n] = t[n] || {}, t[n];
4
- }, e);
1
+ function u(e, n) {
2
+ return n.split(".").reduce((t, o) => t == null ? void 0 : t[o], e);
5
3
  }
6
4
  export {
7
- o as dot
5
+ u as dot
8
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrdagency/blockout",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "A React component library created by WRD.agency",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",