@cronocode/react-box 1.1.6 → 1.1.9
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.d.ts +2 -2
- package/box.mjs +1 -1
- package/box.module.css.mjs +1 -1
- package/components/baseSvg.d.ts +4 -4
- package/components/baseSvg.mjs +9 -9
- package/components/buttonCore.d.ts +4 -4
- package/components/checkboxCore.d.ts +3 -3
- package/components/flex.d.ts +2 -2
- package/components/formAsync.d.ts +3 -3
- package/components/radioButtonCore.d.ts +3 -3
- package/components/textareaCore.d.ts +3 -3
- package/components/textboxCore.d.ts +4 -4
- package/package.json +8 -8
- package/style.css +1 -1
- package/types.d.ts +31 -24
- package/utils/form/formUtils.d.ts +1 -1
- package/vite-env.d.ts +0 -1
package/components/baseSvg.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ interface SvgNormalStyles {
|
|
|
7
7
|
rotate?: 0 | 90 | 180 | 270;
|
|
8
8
|
flip?: 'xAxis' | 'yAxis';
|
|
9
9
|
}
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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;
|
package/components/baseSvg.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import w, { useState as L } from "react";
|
|
2
2
|
import { C as v } from "../utils/utils.mjs";
|
|
3
|
-
const s = { base: "
|
|
3
|
+
const s = { base: "cLT", fillnone: "cLU", fillHnone: "cLV", hovertrue: "d", filltransparent: "cLW", fillHtransparent: "cLX", fillblack: "cLY", fillHblack: "cLZ", fillwhite: "cL0", fillHwhite: "cL1", fillblue: "cL2", fillHblue: "cL3", fillred: "cL4", fillHred: "cL5", fillpurple: "cL6", fillHpurple: "cL7", fillyellow: "cL8", fillHyellow: "cL9", fillpink: "cMa", fillHpink: "cMb", fillgreen: "cMc", fillHgreen: "cMd", fillorange: "cMe", fillHorange: "cMf", fillnavy: "cMg", fillHnavy: "cMh", fillteal: "cMi", fillHteal: "cMj", fillviolet: "cMk", fillHviolet: "cMl", fillgray: "cMm", fillHgray: "cMn", fillbrown: "cMo", fillHbrown: "cMp", strokenone: "cMq", strokeHnone: "cMr", stroketransparent: "cMs", strokeHtransparent: "cMt", strokeblack: "cMu", strokeHblack: "cMv", strokewhite: "cMw", strokeHwhite: "cMx", strokeblue: "cMy", strokeHblue: "cMz", strokered: "cMA", strokeHred: "cMB", strokepurple: "cMC", strokeHpurple: "cMD", strokeyellow: "cME", strokeHyellow: "cMF", strokepink: "cMG", strokeHpink: "cMH", strokegreen: "cMI", strokeHgreen: "cMJ", strokeorange: "cMK", strokeHorange: "cML", strokenavy: "cMM", strokeHnavy: "cMN", stroketeal: "cMO", strokeHteal: "cMP", strokeviolet: "cMQ", strokeHviolet: "cMR", strokegray: "cMS", strokeHgray: "cMT", strokebrown: "cMU", strokeHbrown: "cMV", rotate0: "cMW", rotateH0: "cMX", rotate90: "cMY", rotateH90: "cMZ", rotate180: "cM0", rotateH180: "cM1", rotate270: "cM2", rotateH270: "cM3", flipxAxis: "cM4", flipHxAxis: "cM5", flipyAxis: "cM6", flipHyAxis: "cM7" }, b = ["fill", "fillH", "stroke", "strokeH"];
|
|
4
4
|
function m(o) {
|
|
5
|
-
const { children: e, props:
|
|
5
|
+
const { children: e, props: f, className: r, style: H, viewBox: k, width: p, height: u } = o, l = r ? v.classNames(r, s.base) : [s.base];
|
|
6
6
|
Object.entries(o).forEach(([c, n]) => {
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const M = s[c + n];
|
|
8
|
+
M ? l.push(M) : b.includes(c) && l.push(`${c}${n}`);
|
|
9
9
|
});
|
|
10
10
|
const t = {
|
|
11
|
-
...
|
|
12
|
-
style: { ...H, width:
|
|
11
|
+
...f,
|
|
12
|
+
style: { ...H, width: p, height: u },
|
|
13
13
|
className: l.join(" "),
|
|
14
14
|
viewBox: k || "0 0 24 24",
|
|
15
15
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16
16
|
fill: "none"
|
|
17
|
-
}, [
|
|
18
|
-
return a && (t.onMouseEnter = () => i(!0), t.onMouseLeave = () => i(!1)),
|
|
17
|
+
}, [g, i] = L(!1), a = typeof e == "function";
|
|
18
|
+
return a && (t.onMouseEnter = () => i(!0), t.onMouseLeave = () => i(!1)), w.createElement("svg", t, a ? e({ isHover: g }) : e);
|
|
19
19
|
}
|
|
20
20
|
export {
|
|
21
21
|
m as default
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Box from '../box';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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;
|
package/components/flex.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Box from '../box';
|
|
2
2
|
import { Activated, Focused, Hovered } from '../types';
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"main": "./box.mjs",
|
|
5
5
|
"module": "./box.mjs",
|
|
6
6
|
"types": "./box.d.ts",
|
|
@@ -43,20 +43,20 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@cronocode/identity-factory": "^0.0.6",
|
|
45
45
|
"@rollup/pluginutils": "^5.0.2",
|
|
46
|
-
"@types/node": "^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
|
|
51
|
-
"autoprefixer": "^10.4.
|
|
50
|
+
"@vitejs/plugin-react": "^3.1.0",
|
|
51
|
+
"autoprefixer": "^10.4.14",
|
|
52
52
|
"postcss": "^8.4.21",
|
|
53
53
|
"postcss-mixins": "^9.0.4",
|
|
54
54
|
"postcss-nested": "^6.0.1",
|
|
55
|
-
"prettier": "^2.8.
|
|
55
|
+
"prettier": "^2.8.7",
|
|
56
56
|
"react": "^18.1.0",
|
|
57
57
|
"react-dom": "^18.2.0",
|
|
58
|
-
"typescript": "^
|
|
59
|
-
"vite": "^4.
|
|
60
|
-
"vite-plugin-dts": "^1.
|
|
58
|
+
"typescript": "^5.0.2",
|
|
59
|
+
"vite": "^4.2.1",
|
|
60
|
+
"vite-plugin-dts": "^2.1.0"
|
|
61
61
|
}
|
|
62
62
|
}
|