@cronocode/react-box 1.5.4 → 1.5.6

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 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
+ ```
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),u=require("../box.cjs");require("react");require("../box.module.css.cjs");require("../utils/utils.cjs");require("../theme.cjs");function o(r){if(!(r!=null&&r.length))return{rows:[],columns:[]};const t=Object.keys(r[0]);return{rows:r.map(e=>({dataRow:e,cells:t.map(n=>({key:n,value:e[n]}))})),columns:t.map(e=>({key:e}))}}function c(r){const{data:t}=r,e=o(t);return e.columns.length===0?i.jsx(u.default,{display:"grid",children:"empty grid"}):i.jsxs(u.default,{display:"grid",children:[e.columns.map((n,s)=>i.jsx(u.default,{style:{gridColumn:s+1},children:n.key.toString()},n.key.toString())),e.rows.map((n,s)=>n.cells.map(l=>i.jsx(u.default,{children:l.value},l.key.toString()+s)))]})}exports.default=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("../box.cjs");require("react");require("../box.module.css.cjs");require("../utils/utils.cjs");require("../theme.cjs");function o(r){if(!(r!=null&&r.length))return{rows:[],columns:[]};const i=Object.keys(r[0]);return{rows:r.map(e=>({dataRow:e,cells:i.map(n=>({key:n,value:e[n]}))})),columns:i.map(e=>({key:e}))}}function c(r){const{data:i}=r,e=o(i);return t.jsx(u.default,{display:"grid",b:1,borderRadius:1,children:e.columns.length===0?t.jsx(t.Fragment,{children:"empty grid"}):t.jsxs(t.Fragment,{children:[e.columns.map((n,s)=>t.jsx(u.default,{style:{gridColumn:s+1},children:n.key.toString()},n.key.toString())),e.rows.map((n,s)=>n.cells.map(l=>t.jsx(u.default,{children:l.value},l.key.toString()+s)))]})})}exports.default=c;
@@ -1,36 +1,36 @@
1
- import { jsx as s, jsxs as l } from "react/jsx-runtime";
2
- import t from "../box.mjs";
1
+ import { jsx as o, Fragment as l, jsxs as u } from "react/jsx-runtime";
2
+ import s from "../box.mjs";
3
3
  import "react";
4
4
  import "../box.module.css.mjs";
5
5
  import "../utils/utils.mjs";
6
6
  import "../theme.mjs";
7
- function p(i) {
8
- if (!(i != null && i.length))
7
+ function c(e) {
8
+ if (!(e != null && e.length))
9
9
  return {
10
10
  rows: [],
11
11
  columns: []
12
12
  };
13
- const e = Object.keys(i[0]);
13
+ const i = Object.keys(e[0]);
14
14
  return {
15
- rows: i.map((r) => ({
15
+ rows: e.map((r) => ({
16
16
  dataRow: r,
17
- cells: e.map((n) => ({
17
+ cells: i.map((n) => ({
18
18
  key: n,
19
19
  value: r[n]
20
20
  }))
21
21
  })),
22
- columns: e.map((r) => ({
22
+ columns: i.map((r) => ({
23
23
  key: r
24
24
  }))
25
25
  };
26
26
  }
27
- function h(i) {
28
- const { data: e } = i, r = p(e);
29
- return r.columns.length === 0 ? /* @__PURE__ */ s(t, { display: "grid", children: "empty grid" }) : /* @__PURE__ */ l(t, { display: "grid", children: [
30
- r.columns.map((n, o) => /* @__PURE__ */ s(t, { style: { gridColumn: o + 1 }, children: n.key.toString() }, n.key.toString())),
31
- r.rows.map((n, o) => n.cells.map((m) => /* @__PURE__ */ s(t, { children: m.value }, m.key.toString() + o)))
32
- ] });
27
+ function k(e) {
28
+ const { data: i } = e, r = c(i);
29
+ return /* @__PURE__ */ o(s, { display: "grid", b: 1, borderRadius: 1, children: r.columns.length === 0 ? /* @__PURE__ */ o(l, { children: "empty grid" }) : /* @__PURE__ */ u(l, { children: [
30
+ r.columns.map((n, t) => /* @__PURE__ */ o(s, { style: { gridColumn: t + 1 }, children: n.key.toString() }, n.key.toString())),
31
+ r.rows.map((n, t) => n.cells.map((m) => /* @__PURE__ */ o(s, { children: m.value }, m.key.toString() + t)))
32
+ ] }) });
33
33
  }
34
34
  export {
35
- h as default
35
+ k as default
36
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronocode/react-box",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
4
4
  "main": "./box.cjs",
5
5
  "module": "./box.mjs",
6
6
  "types": "./box.d.ts",
@@ -36,7 +36,7 @@
36
36
  "preview": "vite preview",
37
37
  "build": "vite build",
38
38
  "build:dev": "vite build --mode dev",
39
- "postbuild": "cp package.json dist & cp LICENSE dist & rm ./dist/index.d.ts & rm ./dist/index.js",
39
+ "postbuild": "cp package.json dist & cp LICENSE dist & cp README.md dist & cp docs -r dist & rm ./dist/index.d.ts & rm ./dist/index.js",
40
40
  "compile": "tsc --noEmit --skipLibCheck",
41
41
  "test": "echo \"Error: no test specified\" && exit 1"
42
42
  },
@@ -60,6 +60,7 @@
60
60
  "@rollup/pluginutils": "^5.0.2",
61
61
  "@types/node": "^18.15.7",
62
62
  "@types/postcss-mixins": "^9.0.0",
63
+ "@types/prismjs": "^1.26.3",
63
64
  "@types/react": "^18.0.27",
64
65
  "@types/react-dom": "^18.0.10",
65
66
  "@vitejs/plugin-react": "^3.1.0",
@@ -70,6 +71,7 @@
70
71
  "postcss-nested": "^6.0.1",
71
72
  "postcss-simple-vars": "^7.0.1",
72
73
  "prettier": "^2.8.7",
74
+ "prismjs": "^1.29.0",
73
75
  "react": "^18.1.0",
74
76
  "react-dom": "^18.2.0",
75
77
  "react-router-dom": "^6.16.0",
package/plugins.cjs CHANGED
@@ -148,11 +148,11 @@
148
148
 
149
149
  .bg_a_${o}:active {
150
150
  background: var(--background${o});
151
- }`),s=Object.keys(r.colors).map(o=>`'${o}'`).join(" | "),$=Object.keys(r.backgrounds).map(o=>`'${o}'`).join(" | "),b=Object.keys(r.shadows).map(o=>`'${o}'`).join(" | "),p=`import {ColorType} from '@cronocode/react-box/types';
151
+ }`),$=Object.keys(r.colors).map(o=>`'${o}'`).join(" | "),s=Object.keys(r.backgrounds).map(o=>`'${o}'`).join(" | "),b=Object.keys(r.shadows).map(o=>`'${o}'`).join(" | "),p=`import '@cronocode/react-box';
152
152
 
153
153
  declare module '@cronocode/react-box/types' {
154
- type ColorType = ${s};
155
- type BackgroundType = ${$};
154
+ type ColorType = ${$};
155
+ type BackgroundType = ${s};
156
156
  type ShadowType = ${b};
157
157
 
158
158
  namespace Augmented {
package/plugins.mjs CHANGED
@@ -1,4 +1,4 @@
1
- function C(r) {
1
+ function u(r) {
2
2
  const _ = Object.entries(r.colors).map(([o, e]) => `--color${o}: ${e};`).join(`
3
3
  `), t = Object.entries(r.shadows).map(([o, e]) => `--shadow${o}: ${e};`).join(`
4
4
  `), c = Object.entries(r.backgrounds).map(([o, e]) => `--background${o}: ${e};`).join(`
@@ -151,7 +151,7 @@ function C(r) {
151
151
 
152
152
  .bg_a_${o}:active {
153
153
  background: var(--background${o});
154
- }`), $ = Object.keys(r.colors).map((o) => `'${o}'`).join(" | "), s = Object.keys(r.backgrounds).map((o) => `'${o}'`).join(" | "), b = Object.keys(r.shadows).map((o) => `'${o}'`).join(" | "), p = `import {ColorType} from '@cronocode/react-box/types';
154
+ }`), $ = Object.keys(r.colors).map((o) => `'${o}'`).join(" | "), s = Object.keys(r.backgrounds).map((o) => `'${o}'`).join(" | "), b = Object.keys(r.shadows).map((o) => `'${o}'`).join(" | "), p = `import '@cronocode/react-box';
155
155
 
156
156
  declare module '@cronocode/react-box/types' {
157
157
  type ColorType = ${$};
@@ -215,5 +215,5 @@ declare module '@cronocode/react-box/types' {
215
215
  };
216
216
  }
217
217
  export {
218
- C as boxTheme
218
+ u as boxTheme
219
219
  };
package/src/index.d.ts ADDED
File without changes
@@ -217,7 +217,7 @@ interface BoxPointerEvents {
217
217
  pointerEvents?: PointerEventsType;
218
218
  }
219
219
  type BoxNormalStyles = BoxPseudoClasses & BoxDisplay & BoxSizing & BoxPosition & BoxSize & BoxMargin & BoxPadding & BoxBorder & BoxCursor & BoxZIndex & BoxOverflow & BoxOpacity & BoxFont & BoxText & BoxFlex & BoxOutline & BoxTransition & BoxUserSelect & BoxAppearance & BoxPointerEvents;
220
- declare namespace Augmented {
220
+ export declare namespace Augmented {
221
221
  interface BoxProps {
222
222
  }
223
223
  interface SvgProps {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes