@cronocode/react-box 1.1.7 → 1.2.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.
@@ -7,10 +7,10 @@ interface SvgNormalStyles {
7
7
  rotate?: 0 | 90 | 180 | 270;
8
8
  flip?: 'xAxis' | 'yAxis';
9
9
  }
10
- export declare type SvgStyles = SvgNormalStyles & Hovered<SvgNormalStyles>;
11
- declare type AllSvgProps = React.SVGProps<SVGElement>;
12
- declare type SvgPropsType = Omit<AllSvgProps, 'className' | 'style' | 'width' | 'height'>;
13
- declare type SvgStyleType = Omit<React.CSSProperties, 'width' | 'height'>;
10
+ export type SvgStyles = SvgNormalStyles & Hovered<SvgNormalStyles>;
11
+ type AllSvgProps = React.SVGProps<SVGElement>;
12
+ type SvgPropsType = Omit<AllSvgProps, 'className' | 'style' | 'width' | 'height'>;
13
+ type SvgStyleType = Omit<React.CSSProperties, 'width' | 'height'>;
14
14
  interface Props extends SvgStyles {
15
15
  children?: React.ReactNode | ((props: {
16
16
  isHover: boolean;
@@ -1,22 +1,22 @@
1
- import g, { useState as w } from "react";
2
- import { C as v } from "../utils/utils.mjs";
3
- const s = { base: "cLL", fillnone: "cLM", fillHnone: "cLN", hovertrue: "d", filltransparent: "cLO", fillHtransparent: "cLP", fillblack: "cLQ", fillHblack: "cLR", fillwhite: "cLS", fillHwhite: "cLT", fillblue: "cLU", fillHblue: "cLV", fillred: "cLW", fillHred: "cLX", fillpurple: "cLY", fillHpurple: "cLZ", fillyellow: "cL0", fillHyellow: "cL1", fillpink: "cL2", fillHpink: "cL3", fillgreen: "cL4", fillHgreen: "cL5", fillorange: "cL6", fillHorange: "cL7", fillnavy: "cL8", fillHnavy: "cL9", fillteal: "cMa", fillHteal: "cMb", fillviolet: "cMc", fillHviolet: "cMd", fillgray: "cMe", fillHgray: "cMf", fillbrown: "cMg", fillHbrown: "cMh", strokenone: "cMi", strokeHnone: "cMj", stroketransparent: "cMk", strokeHtransparent: "cMl", strokeblack: "cMm", strokeHblack: "cMn", strokewhite: "cMo", strokeHwhite: "cMp", strokeblue: "cMq", strokeHblue: "cMr", strokered: "cMs", strokeHred: "cMt", strokepurple: "cMu", strokeHpurple: "cMv", strokeyellow: "cMw", strokeHyellow: "cMx", strokepink: "cMy", strokeHpink: "cMz", strokegreen: "cMA", strokeHgreen: "cMB", strokeorange: "cMC", strokeHorange: "cMD", strokenavy: "cME", strokeHnavy: "cMF", stroketeal: "cMG", strokeHteal: "cMH", strokeviolet: "cMI", strokeHviolet: "cMJ", strokegray: "cMK", strokeHgray: "cML", strokebrown: "cMM", strokeHbrown: "cMN", rotate0: "cMO", rotateH0: "cMP", rotate90: "cMQ", rotateH90: "cMR", rotate180: "cMS", rotateH180: "cMT", rotate270: "cMU", rotateH270: "cMV", flipxAxis: "cMW", flipHxAxis: "cMX", flipyAxis: "cMY", flipHyAxis: "cMZ" }, b = ["fill", "fillH", "stroke", "strokeH"];
4
- function m(o) {
5
- const { children: e, props: f, className: r, style: H, viewBox: k, width: p, height: L } = o, l = r ? v.classNames(r, s.base) : [s.base];
6
- Object.entries(o).forEach(([c, n]) => {
7
- const M = s[c + n];
8
- M ? l.push(M) : b.includes(c) && l.push(`${c}${n}`);
1
+ import x, { useState as v } from "react";
2
+ import { C as d } from "../utils/utils.mjs";
3
+ const a = { base: "cGH", rotate0: "cGI", rotateH0: "cGJ", hovertrue: "_h", rotate90: "cGK", rotateH90: "cGL", rotate180: "cGM", rotateH180: "cGN", rotate270: "cGO", rotateH270: "cGP", flipxAxis: "cGQ", flipHxAxis: "cGR", flipyAxis: "cGS", flipHyAxis: "cGT" }, g = ["fill", "fillH", "stroke", "strokeH"];
4
+ function A(c) {
5
+ const { children: s, props: m, className: r, style: p, viewBox: G, width: u, height: H } = c, e = r ? d.classNames(r, a.base) : [a.base];
6
+ Object.entries(c).forEach(([o, n]) => {
7
+ const f = a[o + n];
8
+ f ? e.push(f) : g.includes(o) && e.push(`${o}${n}`);
9
9
  });
10
10
  const t = {
11
- ...f,
12
- style: { ...H, width: p, height: L },
13
- className: l.join(" "),
14
- viewBox: k || "0 0 24 24",
11
+ ...m,
12
+ style: { ...p, width: u, height: H },
13
+ className: e.join(" "),
14
+ viewBox: G || "0 0 24 24",
15
15
  xmlns: "http://www.w3.org/2000/svg",
16
16
  fill: "none"
17
- }, [u, i] = w(!1), a = typeof e == "function";
18
- return a && (t.onMouseEnter = () => i(!0), t.onMouseLeave = () => i(!1)), g.createElement("svg", t, a ? e({ isHover: u }) : e);
17
+ }, [h, i] = v(!1), l = typeof s == "function";
18
+ return l && (t.onMouseEnter = () => i(!0), t.onMouseLeave = () => i(!1)), x.createElement("svg", t, l ? s({ isHover: h }) : s);
19
19
  }
20
20
  export {
21
- m as default
21
+ A as default
22
22
  };
@@ -1,8 +1,8 @@
1
1
  import Box from '../box';
2
- declare type BoxProps = Omit<React.ComponentProps<typeof Box<'button'>>, 'ref' | 'tag'>;
3
- declare type BoxTagProps = Required<BoxProps>['props'];
4
- declare type ButtonTagProps = Omit<BoxTagProps, 'type' | 'onClick' | 'disabled'>;
5
- declare type ButtonType = Required<React.ComponentProps<'button'>>['type'];
2
+ type BoxProps = Omit<React.ComponentProps<typeof Box<'button'>>, 'ref' | 'tag'>;
3
+ type BoxTagProps = Required<BoxProps>['props'];
4
+ type ButtonTagProps = Omit<BoxTagProps, 'type' | 'onClick' | 'disabled'>;
5
+ type ButtonType = Required<React.ComponentProps<'button'>>['type'];
6
6
  interface Props extends Omit<BoxProps, 'props'> {
7
7
  props?: ButtonTagProps;
8
8
  type?: ButtonType;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import Box from '../box';
3
- declare type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
4
- declare type BoxTagProps = Required<BoxProps>['props'];
5
- declare type CheckboxCoreTagProps = Omit<BoxTagProps, 'name' | 'onInput' | 'onChange' | 'type' | 'placeholder' | 'disabled' | 'value' | 'autoFocus' | 'readOnly' | 'required' | 'checked' | 'defaultChecked'>;
3
+ type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
4
+ type BoxTagProps = Required<BoxProps>['props'];
5
+ type CheckboxCoreTagProps = Omit<BoxTagProps, 'name' | 'onInput' | 'onChange' | 'type' | 'placeholder' | 'disabled' | 'value' | 'autoFocus' | 'readOnly' | 'required' | 'checked' | 'defaultChecked'>;
6
6
  interface Props extends Omit<BoxProps, 'props'> {
7
7
  name?: string;
8
8
  props?: CheckboxCoreTagProps;
@@ -1,6 +1,6 @@
1
1
  import Box from '../box';
2
2
  import { Activated, Focused, Hovered } from '../types';
3
- declare type BoxProps = React.ComponentProps<typeof Box>;
3
+ type BoxProps = React.ComponentProps<typeof Box>;
4
4
  interface FlexStylesShortCuts {
5
5
  wrap?: BoxProps['flexWrap'];
6
6
  jc?: BoxProps['justifyContent'];
@@ -12,6 +12,6 @@ interface FlexStylesShortCuts {
12
12
  as?: BoxProps['alignSelf'];
13
13
  js?: BoxProps['justifySelf'];
14
14
  }
15
- declare type Props = BoxProps & FlexStylesShortCuts & Hovered<FlexStylesShortCuts> & Focused<FlexStylesShortCuts> & Activated<FlexStylesShortCuts>;
15
+ type Props = BoxProps & FlexStylesShortCuts & Hovered<FlexStylesShortCuts> & Focused<FlexStylesShortCuts> & Activated<FlexStylesShortCuts>;
16
16
  export default function Flex(props: Props): JSX.Element;
17
17
  export {};
@@ -1,7 +1,7 @@
1
1
  import Box from '../box';
2
- declare type BoxProps = React.ComponentProps<typeof Box<'form'>>;
3
- declare type BoxTagProps = Required<BoxProps>['props'];
4
- declare type FormAsyncTagProps = Omit<BoxTagProps, 'onSubmit' | 'ref'>;
2
+ type BoxProps = React.ComponentProps<typeof Box<'form'>>;
3
+ type BoxTagProps = Required<BoxProps>['props'];
4
+ type FormAsyncTagProps = Omit<BoxTagProps, 'onSubmit' | 'ref'>;
5
5
  interface Props<T> extends Omit<BoxProps, 'props' | 'tag'> {
6
6
  props?: FormAsyncTagProps;
7
7
  onSubmit: (obj: T, e: React.FormEvent<HTMLFormElement>) => void;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import Box from '../box';
3
- declare type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
4
- declare type BoxTagProps = Required<BoxProps>['props'];
5
- declare type RadioButtonCoreTagProps = Omit<BoxTagProps, 'name' | 'onInput' | 'onChange' | 'type' | 'placeholder' | 'disabled' | 'value' | 'autoFocus' | 'readOnly' | 'required' | 'checked' | 'defaultChecked'>;
3
+ type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
4
+ type BoxTagProps = Required<BoxProps>['props'];
5
+ type RadioButtonCoreTagProps = Omit<BoxTagProps, 'name' | 'onInput' | 'onChange' | 'type' | 'placeholder' | 'disabled' | 'value' | 'autoFocus' | 'readOnly' | 'required' | 'checked' | 'defaultChecked'>;
6
6
  interface Props extends Omit<BoxProps, 'props'> {
7
7
  name?: string;
8
8
  props?: RadioButtonCoreTagProps;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import Box from '../box';
3
- declare type BoxProps = Omit<React.ComponentProps<typeof Box<'textarea'>>, 'ref' | 'tag'>;
4
- declare type BoxTagProps = Required<BoxProps>['props'];
5
- declare type TextareaCoreTagProps = Omit<BoxTagProps, 'name' | 'onInput' | 'onChange' | 'placeholder' | 'disabled' | 'value' | 'defaultValue' | 'rows' | 'cols' | 'autoFocus' | 'maxLength' | 'minLength' | 'readOnly' | 'required'>;
3
+ type BoxProps = Omit<React.ComponentProps<typeof Box<'textarea'>>, 'ref' | 'tag'>;
4
+ type BoxTagProps = Required<BoxProps>['props'];
5
+ type TextareaCoreTagProps = Omit<BoxTagProps, 'name' | 'onInput' | 'onChange' | 'placeholder' | 'disabled' | 'value' | 'defaultValue' | 'rows' | 'cols' | 'autoFocus' | 'maxLength' | 'minLength' | 'readOnly' | 'required'>;
6
6
  interface Props extends Omit<BoxProps, 'props'> {
7
7
  name?: string;
8
8
  props?: TextareaCoreTagProps;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import Box from '../box';
3
- declare type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
4
- declare type BoxTagProps = Required<BoxProps>['props'];
5
- declare type TextboxCoreTagProps = Omit<BoxTagProps, 'name' | 'onInput' | 'onChange' | 'type' | 'placeholder' | 'disabled' | 'defaultValue' | 'autoFocus' | 'readOnly' | 'required' | 'value' | 'pattern'>;
6
- declare type TextboxCoreType = 'date' | 'datetime-local' | 'email' | 'hidden' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
3
+ type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
4
+ type BoxTagProps = Required<BoxProps>['props'];
5
+ type TextboxCoreTagProps = Omit<BoxTagProps, 'name' | 'onInput' | 'onChange' | 'type' | 'placeholder' | 'disabled' | 'defaultValue' | 'autoFocus' | 'readOnly' | 'required' | 'value' | 'pattern'>;
6
+ type TextboxCoreType = 'date' | 'datetime-local' | 'email' | 'hidden' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
7
7
  interface Props extends Omit<BoxProps, 'props'> {
8
8
  name?: string;
9
9
  props?: TextboxCoreTagProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronocode/react-box",
3
- "version": "1.1.7",
3
+ "version": "1.2.0",
4
4
  "main": "./box.mjs",
5
5
  "module": "./box.mjs",
6
6
  "types": "./box.d.ts",
@@ -43,20 +43,22 @@
43
43
  "devDependencies": {
44
44
  "@cronocode/identity-factory": "^0.0.6",
45
45
  "@rollup/pluginutils": "^5.0.2",
46
- "@types/node": "^18.11.18",
46
+ "@types/node": "^18.15.7",
47
47
  "@types/postcss-mixins": "^9.0.0",
48
48
  "@types/react": "^18.0.27",
49
49
  "@types/react-dom": "^18.0.10",
50
- "@vitejs/plugin-react": "^3.0.1",
51
- "autoprefixer": "^10.4.13",
50
+ "@vitejs/plugin-react": "^3.1.0",
51
+ "autoprefixer": "^10.4.14",
52
52
  "postcss": "^8.4.21",
53
+ "postcss-each": "^1.1.0",
53
54
  "postcss-mixins": "^9.0.4",
54
55
  "postcss-nested": "^6.0.1",
55
- "prettier": "^2.8.3",
56
+ "postcss-simple-vars": "^7.0.1",
57
+ "prettier": "^2.8.7",
56
58
  "react": "^18.1.0",
57
59
  "react-dom": "^18.2.0",
58
- "typescript": "^4.9.4",
59
- "vite": "^4.0.4",
60
- "vite-plugin-dts": "^1.7.1"
60
+ "typescript": "^5.0.2",
61
+ "vite": "^4.2.1",
62
+ "vite-plugin-dts": "^2.1.0"
61
63
  }
62
64
  }