@cronocode/react-box 1.8.0 → 1.8.1
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.cjs +1 -1
- package/box.d.ts +5 -2
- package/box.mjs +8 -8
- package/components/baseSvg.d.ts +2 -3
- package/components/button.cjs +1 -1
- package/components/button.d.ts +1 -1
- package/components/button.mjs +7 -7
- package/components/checkbox.cjs +1 -1
- package/components/checkbox.d.ts +6 -6
- package/components/checkbox.mjs +11 -20
- package/components/radioButton.cjs +1 -1
- package/components/radioButton.d.ts +1 -1
- package/components/radioButton.mjs +4 -15
- package/components/textarea.cjs +1 -1
- package/components/textarea.d.ts +1 -1
- package/components/textarea.mjs +7 -8
- package/components/textbox.cjs +1 -1
- package/components/textbox.d.ts +1 -1
- package/components/textbox.mjs +5 -6
- package/core/boxStyles.d.ts +3 -1
- package/core/theme.d.ts +15 -17
- package/core/types.d.ts +11 -3
- package/core/useTheme.d.ts +0 -1
- package/core.cjs +24 -60
- package/core.mjs +345 -359
- package/package.json +1 -1
- package/utils/object/objectUtils.d.ts +0 -1
- package/utils.cjs +1 -1
- package/utils.mjs +43 -54
package/box.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("react"),u=require("./core.cjs");function
|
|
1
|
+
"use strict";const s=require("react"),u=require("./core.cjs");function g(t,a){const{tag:n="div",children:o,props:f,className:d,style:c,disabled:r}=t,y=u.useStyles(t,n==="svg"),m=s.useMemo(()=>u.classNames(y,d).join(" "),[t]),e={...f,className:m,disabled:Array.isArray(r)?r[0]:r};c&&(e.style=c),a&&(e.ref=a);const[v,l]=s.useState(!1),i=typeof o=="function";return i&&(e.onMouseEnter=()=>l(!0),e.onMouseLeave=()=>l(!1)),s.createElement(n,e,i?o({isHover:v}):o)}const N=s.forwardRef(g);module.exports=N;
|
package/box.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { RefAttributes } from 'react';
|
|
1
|
+
import React, { Ref, RefAttributes } from 'react';
|
|
2
2
|
import { BoxStyleProps, ExtractElementFromTag } from './core/types';
|
|
3
3
|
import { ClassNameType } from './core/classNames';
|
|
4
4
|
type AllProps<TTag extends keyof React.JSX.IntrinsicElements> = React.ComponentProps<TTag>;
|
|
5
|
-
type TagPropsType<TTag extends keyof React.JSX.IntrinsicElements> = Omit<AllProps<TTag>, 'className' | 'style' | 'ref'>;
|
|
5
|
+
type TagPropsType<TTag extends keyof React.JSX.IntrinsicElements> = Omit<AllProps<TTag>, 'className' | 'style' | 'ref' | 'disabled'>;
|
|
6
6
|
interface Props<TTag extends keyof React.JSX.IntrinsicElements> extends BoxStyleProps {
|
|
7
7
|
children?: React.ReactNode | ((props: {
|
|
8
8
|
isHover: boolean;
|
|
@@ -12,5 +12,8 @@ interface Props<TTag extends keyof React.JSX.IntrinsicElements> extends BoxStyle
|
|
|
12
12
|
className?: ClassNameType;
|
|
13
13
|
style?: React.ComponentProps<TTag>['style'];
|
|
14
14
|
}
|
|
15
|
+
declare function Box<TTag extends keyof React.JSX.IntrinsicElements = 'div'>(props: Props<TTag>, ref: Ref<ExtractElementFromTag<TTag>>): React.ReactElement<React.ComponentProps<TTag>, string | React.JSXElementConstructor<any>>;
|
|
15
16
|
declare const _default: <TTag extends keyof React.JSX.IntrinsicElements = "div">(props: Props<TTag> & React.RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
|
|
16
17
|
export default _default;
|
|
18
|
+
export type BoxProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = React.ComponentProps<typeof Box<TTag>>;
|
|
19
|
+
export type BoxTagProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = Required<BoxProps<TTag>>['props'];
|
package/box.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { u as
|
|
3
|
-
function
|
|
4
|
-
const { tag:
|
|
1
|
+
import y, { forwardRef as v, useMemo as g, useState as p } from "react";
|
|
2
|
+
import { u as N, c as x } from "./core.mjs";
|
|
3
|
+
function H(s, o) {
|
|
4
|
+
const { tag: r = "div", children: t, props: i, className: u, style: n, disabled: a } = s, f = N(s, r === "svg"), m = g(() => x(f, u).join(" "), [s]), e = { ...i, className: m, disabled: Array.isArray(a) ? a[0] : a };
|
|
5
5
|
n && (e.style = n), o && (e.ref = o);
|
|
6
|
-
const [
|
|
7
|
-
return c && (e.onMouseEnter = () =>
|
|
6
|
+
const [d, l] = p(!1), c = typeof t == "function";
|
|
7
|
+
return c && (e.onMouseEnter = () => l(!0), e.onMouseLeave = () => l(!1)), y.createElement(r, e, c ? t({ isHover: d }) : t);
|
|
8
8
|
}
|
|
9
|
-
const
|
|
9
|
+
const $ = v(H);
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
$ as default
|
|
12
12
|
};
|
package/components/baseSvg.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
2
|
+
import { BoxTagProps } from '../box';
|
|
3
3
|
import { BoxSvgStyles } from '../core/types';
|
|
4
4
|
import { ClassNameType } from '../core/classNames';
|
|
5
|
-
type
|
|
6
|
-
type BoxSvgTagProps = Omit<SvgTagProps, 'viewBox' | 'width' | 'height'>;
|
|
5
|
+
type BoxSvgTagProps = Omit<BoxTagProps<'svg'>, 'viewBox' | 'width' | 'height'>;
|
|
7
6
|
interface Props extends BoxSvgStyles {
|
|
8
7
|
children?: React.ReactNode | ((props: {
|
|
9
8
|
isHover: boolean;
|
package/components/button.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const r=require("react/jsx-runtime"),n=require("react"),s=require("../box.cjs"),u=require("../utils.cjs");require("../core.cjs");const i=["type","onClick"
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),n=require("react"),s=require("../box.cjs"),u=require("../utils.cjs");require("../core.cjs");const i=["type","onClick"];function c(t,e){const o=u.ObjectUtils.buildProps(t,i);return r.jsx(s,{ref:e,tag:"button",component:"button",...o})}const b=n.forwardRef(c);module.exports=b;
|
package/components/button.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import Box from '../box';
|
|
3
3
|
type BoxProps = Omit<React.ComponentProps<typeof Box<'button'>>, 'ref' | 'tag'>;
|
|
4
4
|
type BoxTagProps = Required<BoxProps>['props'];
|
|
5
|
-
declare const tagProps: readonly ["type", "onClick"
|
|
5
|
+
declare const tagProps: readonly ["type", "onClick"];
|
|
6
6
|
type TagPropsType = (typeof tagProps)[number];
|
|
7
7
|
type ButtonTagProps = Omit<BoxTagProps, TagPropsType>;
|
|
8
8
|
type ButtonType = Required<React.ComponentProps<'button'>>['type'];
|
package/components/button.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as p } from "react";
|
|
3
|
-
import
|
|
4
|
-
import { O as
|
|
3
|
+
import m from "../box.mjs";
|
|
4
|
+
import { O as s } from "../utils.mjs";
|
|
5
5
|
import "../core.mjs";
|
|
6
|
-
const
|
|
6
|
+
const i = ["type", "onClick"];
|
|
7
7
|
function e(o, t) {
|
|
8
|
-
const r =
|
|
9
|
-
return /* @__PURE__ */ n(
|
|
8
|
+
const r = s.buildProps(o, i);
|
|
9
|
+
return /* @__PURE__ */ n(m, { ref: t, tag: "button", component: "button", ...r });
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const l = p(e);
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
l as default
|
|
14
14
|
};
|
package/components/checkbox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const u=require("react/jsx-runtime"),c=require("react"),i=require("../box.cjs"),s=require("../utils.cjs");require("../core.cjs");const a=["name","onInput","onChange","autoFocus","readOnly","required","value","checked","defaultChecked"];function l(o,e){const{indeterminate:n}=o,r=s.ObjectUtils.buildProps(o,a,{type:"checkbox"}),t=c.useRef(null);return c.useEffect(()=>{e&&typeof e!="function"&&e.current?e.current.indeterminate=!!n:t.current&&(t.current.indeterminate=!!n)},[e,t,n]),u.jsx(i,{tag:"input",ref:e||t,component:"checkbox",...r})}const d=c.forwardRef(l);module.exports=d;
|
package/components/checkbox.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
type BoxTagProps = Required<BoxProps>['props'];
|
|
5
|
-
declare const tagProps: readonly ["name", "onInput", "onChange", "disabled", "autoFocus", "readOnly", "required", "value", "checked", "defaultChecked"];
|
|
2
|
+
import { BoxTagProps, BoxProps } from '../box';
|
|
3
|
+
declare const tagProps: readonly ["name", "onInput", "onChange", "autoFocus", "readOnly", "required", "value", "checked", "defaultChecked"];
|
|
6
4
|
type TagPropsType = (typeof tagProps)[number];
|
|
7
|
-
type
|
|
8
|
-
|
|
5
|
+
type CheckboxProps = Omit<BoxProps<'input'>, 'tag' | 'props'>;
|
|
6
|
+
type CheckboxTagProps = Omit<BoxTagProps<'input'>, TagPropsType | 'type'>;
|
|
7
|
+
interface Props extends CheckboxProps {
|
|
9
8
|
name?: string;
|
|
10
9
|
props?: CheckboxTagProps;
|
|
11
10
|
onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -16,6 +15,7 @@ interface Props extends Omit<BoxProps, 'props'> {
|
|
|
16
15
|
required?: boolean;
|
|
17
16
|
checked?: boolean;
|
|
18
17
|
defaultChecked?: boolean;
|
|
18
|
+
indeterminate?: boolean;
|
|
19
19
|
}
|
|
20
20
|
declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
|
|
21
21
|
export default _default;
|
package/components/checkbox.mjs
CHANGED
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import { O as
|
|
2
|
+
import { forwardRef as i, useRef as u, useEffect as a } from "react";
|
|
3
|
+
import s from "../box.mjs";
|
|
4
|
+
import { O as m } from "../utils.mjs";
|
|
5
5
|
import "../core.mjs";
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
"readOnly",
|
|
13
|
-
"required",
|
|
14
|
-
"value",
|
|
15
|
-
"checked",
|
|
16
|
-
"defaultChecked"
|
|
17
|
-
];
|
|
18
|
-
function s(o, e) {
|
|
19
|
-
const t = a.buildProps(o, p, { type: "checkbox" });
|
|
20
|
-
return /* @__PURE__ */ r(n, { ref: e, tag: "input", component: "checkbox", ...t });
|
|
6
|
+
const f = ["name", "onInput", "onChange", "autoFocus", "readOnly", "required", "value", "checked", "defaultChecked"];
|
|
7
|
+
function p(n, e) {
|
|
8
|
+
const { indeterminate: t } = n, c = m.buildProps(n, f, { type: "checkbox" }), o = u(null);
|
|
9
|
+
return a(() => {
|
|
10
|
+
e && typeof e != "function" && e.current ? e.current.indeterminate = !!t : o.current && (o.current.indeterminate = !!t);
|
|
11
|
+
}, [e, o, t]), /* @__PURE__ */ r(s, { tag: "input", ref: e || o, component: "checkbox", ...c });
|
|
21
12
|
}
|
|
22
|
-
const
|
|
13
|
+
const k = i(p);
|
|
23
14
|
export {
|
|
24
|
-
|
|
15
|
+
k as default
|
|
25
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const r=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs"),i=require("../utils.cjs");require("../core.cjs");const s=["name","onInput","onChange","
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs"),i=require("../utils.cjs");require("../core.cjs");const s=["name","onInput","onChange","value","autoFocus","readOnly","required","checked","defaultChecked"];function c(e,t){const o=i.ObjectUtils.buildProps(e,s,{type:"radio"});return r.jsx(u,{ref:t,tag:"input",component:"radioButton",...o})}const a=n.forwardRef(c);module.exports=a;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import Box from '../box';
|
|
3
3
|
type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
|
|
4
4
|
type BoxTagProps = Required<BoxProps>['props'];
|
|
5
|
-
declare const tagProps: readonly ["name", "onInput", "onChange", "
|
|
5
|
+
declare const tagProps: readonly ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "required", "checked", "defaultChecked"];
|
|
6
6
|
type TagPropsType = (typeof tagProps)[number];
|
|
7
7
|
type RadioButtonTagProps = Omit<BoxTagProps, TagPropsType | 'type'>;
|
|
8
8
|
interface Props extends Omit<BoxProps, 'props'> {
|
|
@@ -3,23 +3,12 @@ import { forwardRef as n } from "react";
|
|
|
3
3
|
import a from "../box.mjs";
|
|
4
4
|
import { O as i } from "../utils.mjs";
|
|
5
5
|
import "../core.mjs";
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"onChange",
|
|
10
|
-
"disabled",
|
|
11
|
-
"value",
|
|
12
|
-
"autoFocus",
|
|
13
|
-
"readOnly",
|
|
14
|
-
"required",
|
|
15
|
-
"checked",
|
|
16
|
-
"defaultChecked"
|
|
17
|
-
];
|
|
18
|
-
function u(o, t) {
|
|
19
|
-
const r = i.buildProps(o, d, { type: "radio" });
|
|
6
|
+
const u = ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "required", "checked", "defaultChecked"];
|
|
7
|
+
function p(o, t) {
|
|
8
|
+
const r = i.buildProps(o, u, { type: "radio" });
|
|
20
9
|
return /* @__PURE__ */ e(a, { ref: t, tag: "input", component: "radioButton", ...r });
|
|
21
10
|
}
|
|
22
|
-
const l = n(
|
|
11
|
+
const l = n(p);
|
|
23
12
|
export {
|
|
24
13
|
l as default
|
|
25
14
|
};
|
package/components/textarea.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime"),o=require("react"),a=require("../box.cjs"),s=require("../utils.cjs");require("../core.cjs");const u=["name","onInput","onChange","placeholder","
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),o=require("react"),a=require("../box.cjs"),s=require("../utils.cjs");require("../core.cjs");const u=["name","onInput","onChange","placeholder","value","defaultValue","rows","cols","autoFocus","maxLength","minLength","readOnly","required"];function c(e,t){const r=s.ObjectUtils.buildProps(e,u);return n.jsx(a,{ref:t,tag:"textarea",component:"textarea",...r})}const i=o.forwardRef(c);module.exports=i;
|
package/components/textarea.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import Box from '../box';
|
|
3
3
|
type BoxProps = Omit<React.ComponentProps<typeof Box<'textarea'>>, 'ref' | 'tag'>;
|
|
4
4
|
type BoxTagProps = Required<BoxProps>['props'];
|
|
5
|
-
declare const tagProps: readonly ["name", "onInput", "onChange", "placeholder", "
|
|
5
|
+
declare const tagProps: readonly ["name", "onInput", "onChange", "placeholder", "value", "defaultValue", "rows", "cols", "autoFocus", "maxLength", "minLength", "readOnly", "required"];
|
|
6
6
|
type TagPropsType = (typeof tagProps)[number];
|
|
7
7
|
type TextareaTagProps = Omit<BoxTagProps, TagPropsType>;
|
|
8
8
|
interface Props extends Omit<BoxProps, 'props'> {
|
package/components/textarea.mjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as a } from "react";
|
|
3
3
|
import n from "../box.mjs";
|
|
4
|
-
import { O as
|
|
4
|
+
import { O as m } from "../utils.mjs";
|
|
5
5
|
import "../core.mjs";
|
|
6
|
-
const
|
|
6
|
+
const s = [
|
|
7
7
|
"name",
|
|
8
8
|
"onInput",
|
|
9
9
|
"onChange",
|
|
10
10
|
"placeholder",
|
|
11
|
-
"disabled",
|
|
12
11
|
"value",
|
|
13
12
|
"defaultValue",
|
|
14
13
|
"rows",
|
|
@@ -19,11 +18,11 @@ const m = [
|
|
|
19
18
|
"readOnly",
|
|
20
19
|
"required"
|
|
21
20
|
];
|
|
22
|
-
function p(t,
|
|
23
|
-
const
|
|
24
|
-
return /* @__PURE__ */ r(n, { ref:
|
|
21
|
+
function p(t, o) {
|
|
22
|
+
const e = m.buildProps(t, s);
|
|
23
|
+
return /* @__PURE__ */ r(n, { ref: o, tag: "textarea", component: "textarea", ...e });
|
|
25
24
|
}
|
|
26
|
-
const
|
|
25
|
+
const x = a(p);
|
|
27
26
|
export {
|
|
28
|
-
|
|
27
|
+
x as default
|
|
29
28
|
};
|
package/components/textbox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs"),s=require("../utils.cjs");require("../core.cjs");const i=["name","onInput","onChange","type","placeholder","
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs"),s=require("../utils.cjs");require("../core.cjs");const i=["name","onInput","onChange","type","placeholder","defaultValue","autoFocus","readOnly","required","value","pattern"];function c(e,t){const r=s.ObjectUtils.buildProps(e,i);return o.jsx(u,{ref:t,tag:"input",component:"textbox",...r})}const a=n.forwardRef(c);module.exports=a;
|
package/components/textbox.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import Box from '../box';
|
|
3
3
|
type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
|
|
4
4
|
type BoxTagProps = Required<BoxProps>['props'];
|
|
5
|
-
declare const tagProps: readonly ["name", "onInput", "onChange", "type", "placeholder", "
|
|
5
|
+
declare const tagProps: readonly ["name", "onInput", "onChange", "type", "placeholder", "defaultValue", "autoFocus", "readOnly", "required", "value", "pattern"];
|
|
6
6
|
type TagPropsType = (typeof tagProps)[number];
|
|
7
7
|
type TextboxTagProps = Omit<BoxTagProps, TagPropsType>;
|
|
8
8
|
type TextboxType = 'date' | 'datetime-local' | 'email' | 'hidden' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
|
package/components/textbox.mjs
CHANGED
|
@@ -3,13 +3,12 @@ import { forwardRef as n } from "react";
|
|
|
3
3
|
import a from "../box.mjs";
|
|
4
4
|
import { O as p } from "../utils.mjs";
|
|
5
5
|
import "../core.mjs";
|
|
6
|
-
const
|
|
6
|
+
const u = [
|
|
7
7
|
"name",
|
|
8
8
|
"onInput",
|
|
9
9
|
"onChange",
|
|
10
10
|
"type",
|
|
11
11
|
"placeholder",
|
|
12
|
-
"disabled",
|
|
13
12
|
"defaultValue",
|
|
14
13
|
"autoFocus",
|
|
15
14
|
"readOnly",
|
|
@@ -17,11 +16,11 @@ const s = [
|
|
|
17
16
|
"value",
|
|
18
17
|
"pattern"
|
|
19
18
|
];
|
|
20
|
-
function
|
|
21
|
-
const e = p.buildProps(o,
|
|
19
|
+
function m(o, t) {
|
|
20
|
+
const e = p.buildProps(o, u);
|
|
22
21
|
return /* @__PURE__ */ r(a, { ref: t, tag: "input", component: "textbox", ...e });
|
|
23
22
|
}
|
|
24
|
-
const
|
|
23
|
+
const c = n(m);
|
|
25
24
|
export {
|
|
26
|
-
|
|
25
|
+
c as default
|
|
27
26
|
};
|
package/core/boxStyles.d.ts
CHANGED
|
@@ -1215,8 +1215,10 @@ export declare const svgThemeStyles: {
|
|
|
1215
1215
|
formatSelector: typeof BoxStylesFormatters.ClassName.svg;
|
|
1216
1216
|
};
|
|
1217
1217
|
};
|
|
1218
|
-
export declare const pseudoClassSuffixes: readonly ["H", "F", "A", "
|
|
1218
|
+
export declare const pseudoClassSuffixes: readonly ["H", "F", "A", "Checked", "Indeterminate", "Valid", "Invalid", "Required", "Optional"];
|
|
1219
|
+
export declare const pseudoClassSuffixesExtended: readonly ["H", "F", "A", "Checked", "Indeterminate", "Valid", "Invalid", "Required", "Optional", "Disabled"];
|
|
1219
1220
|
export type PseudoClassSuffix = (typeof pseudoClassSuffixes)[number];
|
|
1221
|
+
export type PseudoClassSuffixExtended = (typeof pseudoClassSuffixesExtended)[number];
|
|
1220
1222
|
export declare const pseudoClassClassName: {
|
|
1221
1223
|
hover: {
|
|
1222
1224
|
className: string;
|
package/core/theme.d.ts
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import { BoxStyleProps } from './types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { BoxThemeProps } from './types';
|
|
3
|
+
export interface ThemeStyles<T> {
|
|
4
|
+
styles: T;
|
|
5
5
|
}
|
|
6
|
-
export interface ThemeComponentStyles {
|
|
7
|
-
styles: BoxStyleProps;
|
|
8
|
-
disabled?: BoxStyleProps;
|
|
6
|
+
export interface ThemeComponentStyles<T = BoxStyleProps> extends ThemeStyles<T> {
|
|
9
7
|
themes?: {
|
|
10
|
-
[name: string]: ThemeStyles
|
|
8
|
+
[name: string]: ThemeStyles<T>;
|
|
11
9
|
};
|
|
12
10
|
children?: {
|
|
13
|
-
[name: string]: ThemeComponentStyles
|
|
11
|
+
[name: string]: ThemeComponentStyles<T>;
|
|
14
12
|
};
|
|
15
13
|
}
|
|
16
|
-
export interface ThemeSetup {
|
|
14
|
+
export interface ThemeSetup<T = BoxStyleProps> {
|
|
17
15
|
components?: {
|
|
18
|
-
[name: string]: ThemeComponentStyles
|
|
16
|
+
[name: string]: ThemeComponentStyles<T>;
|
|
19
17
|
};
|
|
20
|
-
button?: ThemeComponentStyles
|
|
21
|
-
textbox?: ThemeComponentStyles
|
|
22
|
-
textarea?: ThemeComponentStyles
|
|
23
|
-
checkbox?: ThemeComponentStyles
|
|
24
|
-
radioButton?: ThemeComponentStyles
|
|
18
|
+
button?: ThemeComponentStyles<T>;
|
|
19
|
+
textbox?: ThemeComponentStyles<T>;
|
|
20
|
+
textarea?: ThemeComponentStyles<T>;
|
|
21
|
+
checkbox?: ThemeComponentStyles<T>;
|
|
22
|
+
radioButton?: ThemeComponentStyles<T>;
|
|
25
23
|
}
|
|
26
24
|
interface BoxAugmentedProps {
|
|
27
25
|
colors: Record<string, string>;
|
|
@@ -30,8 +28,8 @@ interface BoxAugmentedProps {
|
|
|
30
28
|
backgroundImages: Record<string, string>;
|
|
31
29
|
}
|
|
32
30
|
declare namespace Theme {
|
|
33
|
-
let Styles: ThemeSetup
|
|
34
|
-
function setup(styles: ThemeSetup): void;
|
|
31
|
+
let Styles: ThemeSetup<BoxStyleProps>;
|
|
32
|
+
function setup(styles: ThemeSetup<BoxThemeProps>): void;
|
|
35
33
|
function setupAugmentedProps(props: BoxAugmentedProps, options?: {
|
|
36
34
|
namespacePath?: string;
|
|
37
35
|
}): {
|
package/core/types.d.ts
CHANGED
|
@@ -15,16 +15,24 @@ export declare namespace Augmented {
|
|
|
15
15
|
type BoxStyles<T extends Record<string, StyleItem>> = {
|
|
16
16
|
[K in keyof T]?: T[K]['values1']['values'][number] | T[K]['values2']['values'][number] | T[K]['values3']['values'][number];
|
|
17
17
|
};
|
|
18
|
-
type BoxNormalStyles = BoxStyles<typeof boxStyles> & BoxStyles<typeof aliases
|
|
18
|
+
type BoxNormalStyles = BoxStyles<typeof boxStyles> & BoxStyles<typeof aliases> & Augmented.BoxProps;
|
|
19
19
|
interface BoxPseudoClasses {
|
|
20
20
|
hover?: boolean;
|
|
21
21
|
focus?: boolean;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
interface BoxPseudoClasses2 {
|
|
24
|
+
disabled?: boolean | [boolean, BoxNormalStyles];
|
|
25
|
+
}
|
|
26
|
+
type BoxPseudoClassStyles = PseudoClass<BoxNormalStyles, 'H'> & PseudoClass<BoxNormalStyles, 'F'> & PseudoClass<BoxNormalStyles, 'A'> & PseudoClass<BoxNormalStyles, 'Checked'> & PseudoClass<BoxNormalStyles, 'Indeterminate'> & PseudoClass<BoxNormalStyles, 'Valid'> & PseudoClass<BoxNormalStyles, 'Invalid'> & PseudoClass<BoxNormalStyles, 'Required'> & PseudoClass<BoxNormalStyles, 'Optional'>;
|
|
27
|
+
interface BoxThemePseudoClassProps {
|
|
28
|
+
disabled?: BoxNormalStyles;
|
|
29
|
+
}
|
|
30
|
+
export type BoxThemeProps = BoxNormalStyles & BoxThemePseudoClassProps & BoxPseudoClassStyles;
|
|
31
|
+
export type BoxStyleProps = BoxNormalStyles & BoxPseudoClasses & BoxPseudoClasses2 & BoxPseudoClassStyles & ThemeComponentProps;
|
|
24
32
|
interface SvgNormalStyles {
|
|
25
33
|
rotate?: BoxNormalStyles['rotate'];
|
|
26
34
|
flip?: BoxNormalStyles['flip'];
|
|
27
35
|
transitionDuration?: BoxNormalStyles['transitionDuration'];
|
|
28
36
|
}
|
|
29
|
-
export type BoxSvgStyles = SvgNormalStyles & PseudoClass<SvgNormalStyles, 'H'> & PseudoClass<SvgNormalStyles, 'F'> & PseudoClass<SvgNormalStyles, 'A'> & PseudoClass<SvgNormalStyles, '
|
|
37
|
+
export type BoxSvgStyles = SvgNormalStyles & PseudoClass<SvgNormalStyles, 'H'> & PseudoClass<SvgNormalStyles, 'F'> & PseudoClass<SvgNormalStyles, 'A'> & PseudoClass<SvgNormalStyles, 'Checked'> & PseudoClass<SvgNormalStyles, 'Indeterminate'> & PseudoClass<SvgNormalStyles, 'Valid'> & PseudoClass<SvgNormalStyles, 'Invalid'> & PseudoClass<SvgNormalStyles, 'Required'> & PseudoClass<SvgNormalStyles, 'Optional'> & ThemeComponentProps & Augmented.SvgProps;
|
|
30
38
|
export {};
|
package/core/useTheme.d.ts
CHANGED