@cronocode/react-box 1.6.9 → 1.7.1
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/box.js +1 -0
- package/components/baseSvg.d.ts +19 -2
- package/components/baseSvg.js +19 -0
- package/components/button.js +13 -0
- package/components/{checkbox.mjs → checkbox.js} +8 -6
- package/components/dataGrid.js +32 -0
- package/components/{dox.mjs → dox.js} +78 -78
- package/components/flex.js +11 -0
- package/components/form.js +15 -0
- package/components/grid.js +11 -0
- package/components/{radioButton.mjs → radioButton.js} +7 -5
- package/components/textarea.js +28 -0
- package/components/textbox.js +26 -0
- package/components/tooltip.js +63 -0
- package/package.json +9 -14
- package/theme.d.ts +12 -0
- package/{plugins.mjs → theme.js} +97 -31
- package/utils.js +107 -0
- package/box.cjs +0 -1
- package/box.mjs +0 -7
- package/box.module.css.cjs +0 -1
- package/components/baseSvg.cjs +0 -1
- package/components/baseSvg.mjs +0 -6
- package/components/button.cjs +0 -1
- package/components/button.mjs +0 -11
- package/components/checkbox.cjs +0 -1
- package/components/dataGrid.cjs +0 -1
- package/components/dataGrid.mjs +0 -5
- package/components/dox.cjs +0 -7
- package/components/doxSvg.cjs +0 -1
- package/components/doxSvg.d.ts +0 -19
- package/components/doxSvg.mjs +0 -18
- package/components/flex.cjs +0 -1
- package/components/flex.mjs +0 -13
- package/components/form.cjs +0 -1
- package/components/form.mjs +0 -5
- package/components/grid.cjs +0 -1
- package/components/grid.mjs +0 -10
- package/components/radioButton.cjs +0 -1
- package/components/textarea.cjs +0 -1
- package/components/textarea.mjs +0 -26
- package/components/textbox.cjs +0 -1
- package/components/textbox.mjs +0 -24
- package/components/tooltip.cjs +0 -1
- package/components/tooltip.mjs +0 -6
- package/plugins.cjs +0 -209
- package/plugins.d.ts +0 -13
- package/theme.cjs +0 -1
- package/theme.mjs +0 -74
- package/utils.cjs +0 -1
- package/utils.mjs +0 -97
- /package/{box.module.css.mjs → box.module.css.js} +0 -0
package/{plugins.mjs → theme.js}
RENAMED
|
@@ -1,12 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { useMemo as g } from "react";
|
|
2
|
+
const b = {
|
|
3
|
+
button: {
|
|
4
|
+
styles: {
|
|
5
|
+
display: "inline-block",
|
|
6
|
+
p: 3,
|
|
7
|
+
cursor: "pointer",
|
|
8
|
+
b: 1,
|
|
9
|
+
borderRadius: 1
|
|
10
|
+
},
|
|
11
|
+
disabled: {
|
|
12
|
+
cursor: "default"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
checkbox: {
|
|
16
|
+
styles: {
|
|
17
|
+
display: "inline-block",
|
|
18
|
+
b: 1,
|
|
19
|
+
p: 2
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
radioButton: {
|
|
23
|
+
styles: {
|
|
24
|
+
display: "inline-block",
|
|
25
|
+
b: 1,
|
|
26
|
+
p: 2
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
textbox: {
|
|
30
|
+
styles: {
|
|
31
|
+
display: "inline-block",
|
|
32
|
+
b: 1,
|
|
33
|
+
borderRadius: 1,
|
|
34
|
+
p: 3
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
textarea: {
|
|
38
|
+
styles: {
|
|
39
|
+
display: "inline-block",
|
|
40
|
+
b: 1,
|
|
41
|
+
borderRadius: 1
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
let _ = b;
|
|
46
|
+
var u;
|
|
47
|
+
((h) => {
|
|
48
|
+
function d(r) {
|
|
49
|
+
_ = r, i();
|
|
50
|
+
}
|
|
51
|
+
h.setup = d;
|
|
52
|
+
function $(r, e) {
|
|
53
|
+
const t = Object.entries(r.colors).map(([o, c]) => `--color${o}: ${c};`).join(`
|
|
54
|
+
`), l = Object.entries(r.shadows).map(([o, c]) => `--shadow${o}: ${c};`).join(`
|
|
55
|
+
`), n = Object.entries(r.backgrounds).map(([o, c]) => `--background${o}: ${c};`).join(`
|
|
56
|
+
`), s = [":root {"];
|
|
57
|
+
t && s.push(` ${t}`), l && s.push(` ${l}`), n && s.push(` ${n}`), s.push("}");
|
|
58
|
+
const a = Object.keys(r.colors).map((o) => `
|
|
10
59
|
.color_${o},
|
|
11
60
|
.color_h_${o}:hover,
|
|
12
61
|
._h:hover>.color_h_${o} {
|
|
@@ -125,7 +174,7 @@ var c;
|
|
|
125
174
|
line {
|
|
126
175
|
stroke: var(--color${o});
|
|
127
176
|
}
|
|
128
|
-
}`),
|
|
177
|
+
}`), y = Object.keys(r.shadows).map((o) => `
|
|
129
178
|
.shadow_${o},
|
|
130
179
|
.shadow_h_${o}:hover,
|
|
131
180
|
._h:hover>.shadow_h_${o} {
|
|
@@ -139,7 +188,7 @@ var c;
|
|
|
139
188
|
|
|
140
189
|
.shadow_a_${o}:active {
|
|
141
190
|
box-shadow: var(--shadow${o});
|
|
142
|
-
}`),
|
|
191
|
+
}`), f = Object.keys(r.backgrounds).map((o) => `
|
|
143
192
|
.bg_${o},
|
|
144
193
|
.bg_h_${o}:hover,
|
|
145
194
|
._h:hover>.bg_h_${o} {
|
|
@@ -153,12 +202,14 @@ var c;
|
|
|
153
202
|
|
|
154
203
|
.bg_a_${o}:active {
|
|
155
204
|
background: var(--background${o});
|
|
156
|
-
}`), p =
|
|
205
|
+
}`), p = [...a, ...y, ...f].join(`
|
|
206
|
+
`) + `
|
|
207
|
+
`, C = Object.keys(r.colors).map((o) => `'${o}'`).join(" | "), v = Object.keys(r.backgrounds).map((o) => `'${o}'`).join(" | "), k = Object.keys(r.shadows).map((o) => `'${o}'`).join(" | "), T = `import '@cronocode/react-box';
|
|
157
208
|
|
|
158
|
-
declare module '@cronocode/react-box/types' {
|
|
159
|
-
type ColorType = ${
|
|
160
|
-
type BackgroundType = ${
|
|
161
|
-
type ShadowType = ${
|
|
209
|
+
declare module '${(e == null ? void 0 : e.namespacePath) ?? "@cronocode/react-box/types"}' {
|
|
210
|
+
type ColorType = ${C};
|
|
211
|
+
type BackgroundType = ${v};
|
|
212
|
+
type ShadowType = ${k};
|
|
162
213
|
|
|
163
214
|
namespace Augmented {
|
|
164
215
|
interface BoxProps {
|
|
@@ -170,10 +221,6 @@ var c;
|
|
|
170
221
|
bgColorH?: ColorType;
|
|
171
222
|
bgColorF?: ColorType;
|
|
172
223
|
bgColorA?: ColorType;
|
|
173
|
-
backgroundColor?: ColorType;
|
|
174
|
-
backgroundColorH?: ColorType;
|
|
175
|
-
backgroundColorF?: ColorType;
|
|
176
|
-
backgroundColorA?: ColorType;
|
|
177
224
|
borderColor?: ColorType;
|
|
178
225
|
borderColorH?: ColorType;
|
|
179
226
|
borderColorF?: ColorType;
|
|
@@ -182,10 +229,6 @@ var c;
|
|
|
182
229
|
outlineColorH?: ColorType;
|
|
183
230
|
outlineColorF?: ColorType;
|
|
184
231
|
outlineColorA?: ColorType;
|
|
185
|
-
bg?: BackgroundType;
|
|
186
|
-
bgH?: BackgroundType;
|
|
187
|
-
bgF?: BackgroundType;
|
|
188
|
-
bgA?: BackgroundType;
|
|
189
232
|
background?: BackgroundType;
|
|
190
233
|
backgroundH?: BackgroundType;
|
|
191
234
|
backgroundF?: BackgroundType;
|
|
@@ -210,12 +253,35 @@ var c;
|
|
|
210
253
|
}
|
|
211
254
|
`;
|
|
212
255
|
return {
|
|
213
|
-
|
|
214
|
-
`),
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
boxDts: d
|
|
256
|
+
variables: s.join(`
|
|
257
|
+
`),
|
|
258
|
+
themeCss: p,
|
|
259
|
+
boxDts: T
|
|
218
260
|
};
|
|
219
261
|
}
|
|
220
|
-
|
|
221
|
-
|
|
262
|
+
h.setupAugmentedProps = $;
|
|
263
|
+
function i() {
|
|
264
|
+
Object.keys(b).forEach((e) => {
|
|
265
|
+
const t = _[e], l = b[e];
|
|
266
|
+
t ? (t.styles = { ...l.styles, ...t.styles }, t.disabled && l.disabled && (t.disabled = { ...l.disabled, ...t.disabled })) : _[e] = b[e];
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
})(u || (u = {}));
|
|
270
|
+
const j = u;
|
|
271
|
+
function x(h) {
|
|
272
|
+
const { clean: d, disabled: $, theme: i, component: r } = h;
|
|
273
|
+
return g(() => {
|
|
274
|
+
var l, n, s;
|
|
275
|
+
if (d)
|
|
276
|
+
return;
|
|
277
|
+
let e = _[r] ?? ((l = _.components) == null ? void 0 : l[r]);
|
|
278
|
+
if (!e)
|
|
279
|
+
return;
|
|
280
|
+
let t = i ? { ...e.styles, ...(n = e.themes) == null ? void 0 : n[i].styles } : e.styles;
|
|
281
|
+
return $ ? i ? { ...t, ...e.disabled, ...(s = e.themes) == null ? void 0 : s[i].disabled } : { ...t, ...e.disabled } : t;
|
|
282
|
+
}, [r, d, $, i]);
|
|
283
|
+
}
|
|
284
|
+
export {
|
|
285
|
+
j as T,
|
|
286
|
+
x as u
|
|
287
|
+
};
|
package/utils.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { useMemo as x } from "react";
|
|
2
|
+
var p;
|
|
3
|
+
((c) => {
|
|
4
|
+
function i(...u) {
|
|
5
|
+
return u.reduce((n, o) => o ? typeof o == "string" ? (n.push(o), n) : Array.isArray(o) ? (n.push(...i(...o)), n) : (Object.entries(o).forEach(([r, e]) => {
|
|
6
|
+
e && n.push(r);
|
|
7
|
+
}), n) : n, []);
|
|
8
|
+
}
|
|
9
|
+
c.classNames = i;
|
|
10
|
+
})(p || (p = {}));
|
|
11
|
+
const y = p;
|
|
12
|
+
class I {
|
|
13
|
+
constructor() {
|
|
14
|
+
this._index = 0, this._cache = {};
|
|
15
|
+
}
|
|
16
|
+
getIdentity(i) {
|
|
17
|
+
return this._cache[i] || (this._cache[i] = this.getByIndex(this._index++)), this._cache[i];
|
|
18
|
+
}
|
|
19
|
+
getByIndex(i) {
|
|
20
|
+
const { first: u, next: n } = m, o = i - u.length;
|
|
21
|
+
if (o < 0)
|
|
22
|
+
return u[i];
|
|
23
|
+
const r = Math.floor(o / n.length), e = o - r * n.length;
|
|
24
|
+
return this.getByIndex(r) + n[e];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const m = {
|
|
28
|
+
first: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
29
|
+
next: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
|
30
|
+
};
|
|
31
|
+
var l;
|
|
32
|
+
((c) => {
|
|
33
|
+
function i(n, ...o) {
|
|
34
|
+
const r = { ...n }, e = {};
|
|
35
|
+
return o.forEach((t) => {
|
|
36
|
+
t in r && (e[t] = r[t], delete r[t]);
|
|
37
|
+
}), [e, r];
|
|
38
|
+
}
|
|
39
|
+
c.moveToTagProps = i;
|
|
40
|
+
function u(n, o, r) {
|
|
41
|
+
const e = { ...n }, t = e.props || {};
|
|
42
|
+
return o.forEach((s) => {
|
|
43
|
+
if (s in e) {
|
|
44
|
+
if (t[s] = e[s], s === "disabled")
|
|
45
|
+
return;
|
|
46
|
+
delete e[s];
|
|
47
|
+
}
|
|
48
|
+
}), r && Object.entries(r).forEach(([s, f]) => {
|
|
49
|
+
t[s] = f;
|
|
50
|
+
}), e.props = t, e;
|
|
51
|
+
}
|
|
52
|
+
c.buildProps = u;
|
|
53
|
+
})(l || (l = {}));
|
|
54
|
+
const E = l;
|
|
55
|
+
var g;
|
|
56
|
+
((c) => {
|
|
57
|
+
function i(n) {
|
|
58
|
+
const o = Array.from(n.elements).reduce((r, e) => {
|
|
59
|
+
const t = e.name;
|
|
60
|
+
return t && (r[t] || (r[t] = []), r[t].push(e)), r;
|
|
61
|
+
}, {});
|
|
62
|
+
return Object.entries(o).reduce((r, [e, t]) => {
|
|
63
|
+
if (t.length === 1) {
|
|
64
|
+
const s = t[0];
|
|
65
|
+
u(r, e, s.type === "checkbox" || s.type === "radio" ? s.checked : s.value);
|
|
66
|
+
} else {
|
|
67
|
+
const s = t.reduce((f, d) => (d.type === "checkbox" || d.type === "radio" ? d.checked && f.push(d.value) : f.push(d.value), f), []);
|
|
68
|
+
u(r, e, s);
|
|
69
|
+
}
|
|
70
|
+
return r;
|
|
71
|
+
}, {});
|
|
72
|
+
}
|
|
73
|
+
c.getFormEntries = i;
|
|
74
|
+
function u(n, o, r) {
|
|
75
|
+
if (o.includes(".")) {
|
|
76
|
+
const e = o.split(".");
|
|
77
|
+
let t = n;
|
|
78
|
+
e.forEach((s, f) => {
|
|
79
|
+
if (e.length > f + 1) {
|
|
80
|
+
const d = s.match(/^(.+)\[(\d)\]$/);
|
|
81
|
+
if (d) {
|
|
82
|
+
const [, h, a] = d;
|
|
83
|
+
t[h] = t[h] || [], t[h][a] = t[h][a] || {}, t = t[h][a];
|
|
84
|
+
} else
|
|
85
|
+
t[s] = t[s] || {}, t = t[s];
|
|
86
|
+
} else
|
|
87
|
+
t[s] = r;
|
|
88
|
+
});
|
|
89
|
+
} else
|
|
90
|
+
n[o] = r;
|
|
91
|
+
}
|
|
92
|
+
})(g || (g = {}));
|
|
93
|
+
const P = g;
|
|
94
|
+
function v() {
|
|
95
|
+
return x(() => {
|
|
96
|
+
const c = "crono-box";
|
|
97
|
+
let i = document.getElementById(c);
|
|
98
|
+
return i || (i = document.createElement("div"), i.id = c, document.body.appendChild(i)), i;
|
|
99
|
+
}, []);
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
y as C,
|
|
103
|
+
P as F,
|
|
104
|
+
I,
|
|
105
|
+
E as O,
|
|
106
|
+
v as u
|
|
107
|
+
};
|
package/box.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./components/dox.cjs");require("react");require("./utils.cjs");require("./theme.cjs");exports.default=e.default;
|