@cronocode/react-box 1.6.9 → 1.7.0
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 +7 -0
- package/components/baseSvg.js +6 -0
- package/components/{button.mjs → button.js} +3 -3
- package/components/{checkbox.mjs → checkbox.js} +5 -5
- package/components/dataGrid.js +5 -0
- package/components/{dox.mjs → dox.js} +2 -2
- package/components/{doxSvg.mjs → doxSvg.js} +3 -3
- package/components/{flex.mjs → flex.js} +3 -3
- package/components/form.js +5 -0
- package/components/{grid.mjs → grid.js} +3 -3
- package/components/{radioButton.mjs → radioButton.js} +3 -3
- package/components/{textarea.mjs → textarea.js} +3 -3
- package/components/{textbox.mjs → textbox.js} +3 -3
- package/components/tooltip.js +6 -0
- package/package.json +9 -14
- package/theme.d.ts +12 -0
- package/{plugins.mjs → theme.js} +95 -31
- 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/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/flex.cjs +0 -1
- package/components/form.cjs +0 -1
- package/components/form.mjs +0 -5
- package/components/grid.cjs +0 -1
- package/components/radioButton.cjs +0 -1
- package/components/textarea.cjs +0 -1
- package/components/textbox.cjs +0 -1
- 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/{box.module.css.mjs → box.module.css.js} +0 -0
- /package/{utils.mjs → utils.js} +0 -0
package/box.js
ADDED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as i } from "react";
|
|
3
|
-
import m from "./dox.
|
|
4
|
-
import { O as p } from "../utils.
|
|
5
|
-
import "../theme.
|
|
3
|
+
import m from "./dox.js";
|
|
4
|
+
import { O as p } from "../utils.js";
|
|
5
|
+
import "../theme.js";
|
|
6
6
|
const s = ["type", "onClick", "disabled"];
|
|
7
7
|
function e(o, t) {
|
|
8
8
|
const r = p.buildProps(o, s);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as c } from "react";
|
|
3
|
-
import t from "./dox.
|
|
4
|
-
import { O as a } from "../utils.
|
|
5
|
-
import l from "./flex.
|
|
6
|
-
import { c as d } from "../box.module.css.
|
|
7
|
-
import "../theme.
|
|
3
|
+
import t from "./dox.js";
|
|
4
|
+
import { O as a } from "../utils.js";
|
|
5
|
+
import l from "./flex.js";
|
|
6
|
+
import { c as d } from "../box.module.css.js";
|
|
7
|
+
import "../theme.js";
|
|
8
8
|
const p = [
|
|
9
9
|
"name",
|
|
10
10
|
"onInput",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import O, { useMemo as j, useLayoutEffect as I, useEffect as _, forwardRef as D, useState as P } from "react";
|
|
2
|
-
import { I as M, C as W } from "../utils.
|
|
3
|
-
import { useTheme as G } from "../theme.
|
|
2
|
+
import { I as M, C as W } from "../utils.js";
|
|
3
|
+
import { useTheme as G } from "../theme.js";
|
|
4
4
|
var e;
|
|
5
5
|
((a) => {
|
|
6
6
|
((r) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as f } from "react";
|
|
3
|
-
import g from "./dox.
|
|
4
|
-
import "../utils.
|
|
5
|
-
import "../theme.
|
|
3
|
+
import g from "./dox.js";
|
|
4
|
+
import "../utils.js";
|
|
5
|
+
import "../theme.js";
|
|
6
6
|
function n(o, r) {
|
|
7
7
|
const { viewBox: t = "0 0 24 24", width: p = "1.5rem", height: i, props: m, ...s } = o;
|
|
8
8
|
return /* @__PURE__ */ e(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as f } from "react";
|
|
3
|
-
import n from "./dox.
|
|
4
|
-
import "../utils.
|
|
5
|
-
import "../theme.
|
|
3
|
+
import n from "./dox.js";
|
|
4
|
+
import "../utils.js";
|
|
5
|
+
import "../theme.js";
|
|
6
6
|
function l(o, r) {
|
|
7
7
|
const { inline: t, ...e } = o;
|
|
8
8
|
return /* @__PURE__ */ i(n, { ref: r, display: t ? "inline-flex" : "flex", ...e });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as n } from "react";
|
|
3
|
-
import p from "./dox.
|
|
4
|
-
import "../utils.
|
|
5
|
-
import "../theme.
|
|
3
|
+
import p from "./dox.js";
|
|
4
|
+
import "../utils.js";
|
|
5
|
+
import "../theme.js";
|
|
6
6
|
function f(r, i) {
|
|
7
7
|
const { inline: o, ...t } = r;
|
|
8
8
|
return /* @__PURE__ */ m(p, { ref: i, display: o ? "inline-grid" : "grid", ...t });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as n } from "react";
|
|
3
|
-
import a from "./dox.
|
|
4
|
-
import { O as i } from "../utils.
|
|
5
|
-
import "../theme.
|
|
3
|
+
import a from "./dox.js";
|
|
4
|
+
import { O as i } from "../utils.js";
|
|
5
|
+
import "../theme.js";
|
|
6
6
|
const d = [
|
|
7
7
|
"name",
|
|
8
8
|
"onInput",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as a } from "react";
|
|
3
|
-
import n from "./dox.
|
|
4
|
-
import { O as m } from "../utils.
|
|
5
|
-
import "../theme.
|
|
3
|
+
import n from "./dox.js";
|
|
4
|
+
import { O as m } from "../utils.js";
|
|
5
|
+
import "../theme.js";
|
|
6
6
|
const s = [
|
|
7
7
|
"name",
|
|
8
8
|
"onInput",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as n } from "react";
|
|
3
|
-
import a from "./dox.
|
|
4
|
-
import { O as p } from "../utils.
|
|
5
|
-
import "../theme.
|
|
3
|
+
import a from "./dox.js";
|
|
4
|
+
import { O as p } from "../utils.js";
|
|
5
|
+
import "../theme.js";
|
|
6
6
|
const i = [
|
|
7
7
|
"name",
|
|
8
8
|
"onInput",
|
package/package.json
CHANGED
|
@@ -1,33 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cronocode/react-box",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"main": "./box.
|
|
5
|
-
"module": "./box.
|
|
3
|
+
"version": "1.7.0",
|
|
4
|
+
"main": "./box.js",
|
|
5
|
+
"module": "./box.js",
|
|
6
6
|
"types": "./box.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"import": "./box.
|
|
10
|
-
"require": "./box.
|
|
9
|
+
"import": "./box.js",
|
|
10
|
+
"require": "./box.js",
|
|
11
11
|
"types": "./box.d.ts"
|
|
12
12
|
},
|
|
13
13
|
"./style.css": "./style.css",
|
|
14
14
|
"./theme": {
|
|
15
|
-
"import": "./theme.
|
|
16
|
-
"require": "./theme.
|
|
15
|
+
"import": "./theme.js",
|
|
16
|
+
"require": "./theme.js",
|
|
17
17
|
"types": "./theme.d.ts"
|
|
18
18
|
},
|
|
19
19
|
"./types": {
|
|
20
20
|
"types": "./types.d.ts"
|
|
21
21
|
},
|
|
22
22
|
"./components/*": {
|
|
23
|
-
"import": "./components/*.
|
|
24
|
-
"require": "./components/*.
|
|
23
|
+
"import": "./components/*.js",
|
|
24
|
+
"require": "./components/*.js",
|
|
25
25
|
"types": "./components/*.d.ts"
|
|
26
|
-
},
|
|
27
|
-
"./plugins": {
|
|
28
|
-
"import": "./plugins.mjs",
|
|
29
|
-
"require": "./plugins.cjs",
|
|
30
|
-
"types": "./plugins.d.ts"
|
|
31
26
|
}
|
|
32
27
|
},
|
|
33
28
|
"scripts": {
|
package/theme.d.ts
CHANGED
|
@@ -20,8 +20,20 @@ export interface ThemeSetup {
|
|
|
20
20
|
checkbox?: ThemeComponentStyles;
|
|
21
21
|
radioButton?: ThemeComponentStyles;
|
|
22
22
|
}
|
|
23
|
+
interface BoxAugmentedProps {
|
|
24
|
+
colors: Record<string, string>;
|
|
25
|
+
shadows: Record<string, string>;
|
|
26
|
+
backgrounds: Record<string, string>;
|
|
27
|
+
}
|
|
23
28
|
declare namespace Theme {
|
|
24
29
|
function setup(styles: ThemeSetup): void;
|
|
30
|
+
function setupAugmentedProps(props: BoxAugmentedProps, options?: {
|
|
31
|
+
namespacePath?: string;
|
|
32
|
+
}): {
|
|
33
|
+
variables: string;
|
|
34
|
+
themeCss: string;
|
|
35
|
+
boxDts: string;
|
|
36
|
+
};
|
|
25
37
|
}
|
|
26
38
|
export default Theme;
|
|
27
39
|
type ReservedComponentName = Exclude<string, keyof Omit<ThemeSetup, 'components'>>;
|
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 $ = {
|
|
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 _ = $;
|
|
46
|
+
var u;
|
|
47
|
+
((h) => {
|
|
48
|
+
function d(r) {
|
|
49
|
+
_ = r, i();
|
|
50
|
+
}
|
|
51
|
+
h.setup = d;
|
|
52
|
+
function b(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,33 @@ 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 = b;
|
|
263
|
+
function i() {
|
|
264
|
+
Object.keys($).forEach((e) => {
|
|
265
|
+
const t = _[e], l = $[e];
|
|
266
|
+
t ? (t.styles = { ...l.styles, ...t.styles }, t.disabled && l.disabled && (t.disabled = { ...l.disabled, ...t.disabled })) : _[e] = $[e];
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
})(u || (u = {}));
|
|
270
|
+
function j(h) {
|
|
271
|
+
const { clean: d, disabled: b, theme: i, component: r } = h;
|
|
272
|
+
return g(() => {
|
|
273
|
+
var l, n, s;
|
|
274
|
+
if (d)
|
|
275
|
+
return;
|
|
276
|
+
let e = _[r] ?? ((l = _.components) == null ? void 0 : l[r]);
|
|
277
|
+
if (!e)
|
|
278
|
+
return;
|
|
279
|
+
let t = i ? { ...e.styles, ...(n = e.themes) == null ? void 0 : n[i].styles } : e.styles;
|
|
280
|
+
return b ? i ? { ...t, ...e.disabled, ...(s = e.themes) == null ? void 0 : s[i].disabled } : { ...t, ...e.disabled } : t;
|
|
281
|
+
}, [r, d, b, i]);
|
|
282
|
+
}
|
|
283
|
+
export {
|
|
284
|
+
j as useTheme
|
|
285
|
+
};
|
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;
|