@cronocode/react-box 1.5.5 → 1.5.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.
- package/README.md +90 -0
- package/baseSvg.module.css.cjs +1 -1
- package/baseSvg.module.css.mjs +2 -2
- package/box.cjs +1 -1
- package/box.mjs +10 -10
- package/box.module.css.cjs +1 -1
- package/box.module.css.mjs +2 -2
- package/components/dataGrid.cjs +1 -1
- package/components/dataGrid.mjs +15 -15
- package/components/dox.cjs +1 -0
- package/components/dox.d.ts +1463 -0
- package/components/dox.mjs +854 -0
- package/components/grid.cjs +1 -0
- package/components/grid.d.ts +4 -0
- package/components/grid.mjs +14 -0
- package/package.json +7 -3
- package/plugins.cjs +6 -5
- package/plugins.mjs +6 -5
- package/style.css +1 -1
- package/theme.cjs +1 -1
- package/theme.d.ts +1 -1
- package/theme.mjs +2 -2
- package/types.d.ts +48 -37
- package/utils/utils.cjs +1 -1
- package/utils/utils.mjs +90 -70
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# React box
|
|
2
|
+
|
|
3
|
+
This is a react base component which will reduce considerably necessity to write css code.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
1. Installation
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm install @cronocode/react-box
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. Import styles
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
import "@cronocode/react-box/styles.css";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
OR
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
@import "@cronocode/react-box/styles.css";
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
3. Use component
|
|
26
|
+
|
|
27
|
+
Sizes are divided to `4`
|
|
28
|
+
`padding={3}` means `1rem/4 => 0.75rem`
|
|
29
|
+
|
|
30
|
+
In the example below is creating a box with `maring: 0.5rem` and `padding: 1.75rem`
|
|
31
|
+
|
|
32
|
+
Root `font-size` is set to `16px`
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
import Box from "@cronocode/react-box";
|
|
36
|
+
|
|
37
|
+
export default function Component(props: Props) {
|
|
38
|
+
return (
|
|
39
|
+
<Box className="custom-class" m={2} p={7}>
|
|
40
|
+
basic example
|
|
41
|
+
</Box>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Components
|
|
47
|
+
|
|
48
|
+
- **Box** - base component with a tons of props
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
import Box from "@cronocode/react-box";
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
<br/>
|
|
55
|
+
|
|
56
|
+
### Alias-shortcuts components
|
|
57
|
+
|
|
58
|
+
- **Flex** - this is a `Box` component with `display: flex` style
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
import Flex from "@cronocode/react-box/components/flex";
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- **Button** - this is a `Box` component with html tag `button` and `onClick` prop
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
import Button from "@cronocode/react-box/components/button";
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- **Textbox**
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
import Textbox from "@cronocode/react-box/components/textbox";
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
- **Tooltip** - this is useful when you need a position absolute and the parent has overflow hidden.
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
import Tooltip from "@cronocode/react-box/components/tooltip";
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Theme variables
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
--borderColor: black;
|
|
86
|
+
--outlineColor: black;
|
|
87
|
+
--lineHeight: 1.2;
|
|
88
|
+
--fontSize: 14px;
|
|
89
|
+
--transitionTime: 0.25s;
|
|
90
|
+
```
|
package/baseSvg.module.css.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const a={base:"cal",rotate0:"cam",rotateH0:"can",hovertrue:"_h",rotate90:"cao",rotateH90:"cap",rotate180:"caq",rotateH180:"car",rotate270:"cas",rotateH270:"cat",flipxAxis:"cau",flipHxAxis:"cav",flipyAxis:"caw",flipHyAxis:"cax",rotateF0:"cay",focustrue:"_f",rotateF90:"caz",rotateF180:"caA",rotateF270:"caB",flipFxAxis:"caC",flipFyAxis:"caD",rotateA0:"caE",rotateA90:"caF",rotateA180:"caG",rotateA270:"caH",flipAxAxis:"caI",flipAyAxis:"caJ"};exports.classes=a;
|
package/baseSvg.module.css.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a = { base: "cal", rotate0: "cam", rotateH0: "can", hovertrue: "_h", rotate90: "cao", rotateH90: "cap", rotate180: "caq", rotateH180: "car", rotate270: "cas", rotateH270: "cat", flipxAxis: "cau", flipHxAxis: "cav", flipyAxis: "caw", flipHyAxis: "cax", rotateF0: "cay", focustrue: "_f", rotateF90: "caz", rotateF180: "caA", rotateF270: "caB", flipFxAxis: "caC", flipFyAxis: "caD", rotateA0: "caE", rotateA90: "caF", rotateA180: "caG", rotateA270: "caH", flipAxAxis: "caI", flipAyAxis: "caJ" };
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
a as c
|
|
4
4
|
};
|
package/box.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),c=require("./box.module.css.cjs"),d=require("./utils/utils.cjs"),j=require("./theme.cjs");function y(s,e){const{tag:t,children:o,props:n,className:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),c=require("./box.module.css.cjs"),d=require("./utils/utils.cjs"),j=require("./theme.cjs");function y(s,e){const{tag:t,children:o,props:n,className:u,style:b}=s,f=j.useTheme(s),$=a.useMemo(()=>{const i=u?d.ClassNameUtils.classNames(c.classes.box,u):[c.classes.box],T=f?{...m(f),...m(s)}:m(s);return Object.entries(T).forEach(([l,h])=>{const x=c.classes[l+h];x?i.push(x):l in d.themeClasses&&i.push(`${d.themeClasses[l]}${h}`)}),i.join(" ")},[s]),r={...n,className:$};b&&(r.style=b),e&&(r.ref=e);const[H,g]=a.useState(!1),p=typeof o=="function";return p&&(r.onMouseEnter=()=>g(!0),r.onMouseLeave=()=>g(!1)),a.createElement(t||"div",r,p?o({isHover:H}):o)}const C=a.forwardRef(y),N={m:"margin",mx:"marginHorizontal",my:"marginVertical",mt:"marginTop",mr:"marginRight",mb:"marginBottom",ml:"marginLeft",p:"padding",px:"paddingHorizontal",py:"paddingVertical",pt:"paddingTop",pr:"paddingRight",pb:"paddingBottom",pl:"paddingLeft",b:"border",bx:"borderHorizontal",by:"borderVertical",bt:"borderTop",br:"borderRight",bb:"borderBottom",bl:"borderLeft",jc:"justifyContent",ai:"alignItems",ac:"alignContent",d:"flexDirection"},P=Object.entries(N).reduce((s,[e,t])=>(s[e]=t,s[`${e}H`]=`${t}H`,s[`${e}F`]=`${t}F`,s[`${e}A`]=`${t}A`,s),{});function m(s){const e={...s};return Object.keys(e).forEach(o=>{const n=P[o];n&&(n in e||(e[n]=e[o]),delete e[o])}),e}exports.default=C;
|
package/box.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import T, { forwardRef as j, useMemo as C, useState as N } from "react";
|
|
2
2
|
import { c as m } from "./box.module.css.mjs";
|
|
3
|
-
import { C as y, a as
|
|
3
|
+
import { C as y, a as h } from "./utils/utils.mjs";
|
|
4
4
|
import { useTheme as B } from "./theme.mjs";
|
|
5
5
|
function P(t, e) {
|
|
6
|
-
const { tag: s, children: o, props: n, className:
|
|
7
|
-
const a =
|
|
8
|
-
return Object.entries(H).forEach(([i,
|
|
9
|
-
const
|
|
10
|
-
|
|
6
|
+
const { tag: s, children: o, props: n, className: c, style: d } = t, f = B(t), x = C(() => {
|
|
7
|
+
const a = c ? y.classNames(m.box, c) : [m.box], H = f ? { ...l(f), ...l(t) } : l(t);
|
|
8
|
+
return Object.entries(H).forEach(([i, p]) => {
|
|
9
|
+
const u = m[i + p];
|
|
10
|
+
u ? a.push(u) : i in h && a.push(`${h[i]}${p}`);
|
|
11
11
|
}), a.join(" ");
|
|
12
12
|
}, [t]), r = { ...n, className: x };
|
|
13
|
-
|
|
14
|
-
const [$,
|
|
15
|
-
return
|
|
13
|
+
d && (r.style = d), e && (r.ref = e);
|
|
14
|
+
const [$, b] = N(!1), g = typeof o == "function";
|
|
15
|
+
return g && (r.onMouseEnter = () => b(!0), r.onMouseLeave = () => b(!1)), T.createElement(s || "div", r, g ? o({ isHover: $ }) : o);
|
|
16
16
|
}
|
|
17
17
|
const z = j(P), R = {
|
|
18
18
|
m: "margin",
|
|
@@ -41,7 +41,7 @@ const z = j(P), R = {
|
|
|
41
41
|
ac: "alignContent",
|
|
42
42
|
d: "flexDirection"
|
|
43
43
|
}, v = Object.entries(R).reduce((t, [e, s]) => (t[e] = s, t[`${e}H`] = `${s}H`, t[`${e}F`] = `${s}F`, t[`${e}A`] = `${s}A`, t), {});
|
|
44
|
-
function
|
|
44
|
+
function l(t) {
|
|
45
45
|
const e = { ...t };
|
|
46
46
|
return Object.keys(e).forEach((o) => {
|
|
47
47
|
const n = v[o];
|