@cronocode/react-box 1.7.9 → 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 CHANGED
@@ -1 +1 @@
1
- "use strict";const s=require("react"),u=require("./core.cjs");function d(t,n){const{tag:r="div",children:o,props:i,className:f,style:a}=t,m=u.useStyles(t,r==="svg"),v=s.useMemo(()=>u.classNames(m,f).join(" "),[t]),e={...i,className:v};a&&(e.style=a),n&&(e.ref=n);const[y,c]=s.useState(!1),l=typeof o=="function";return l&&(e.onMouseEnter=()=>c(!0),e.onMouseLeave=()=>c(!1)),s.createElement(r,e,l?o({isHover:y}):o)}const g=s.forwardRef(d);module.exports=g;
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 v, { forwardRef as d, useMemo as y, useState as g } from "react";
2
- import { u as p, c as N } from "./core.mjs";
3
- function x(s, o) {
4
- const { tag: a = "div", children: t, props: l, className: u, style: n } = s, f = p(s, a === "svg"), i = y(() => N(f, u).join(" "), [s]), e = { ...l, className: i };
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 [m, r] = g(!1), c = typeof t == "function";
7
- return c && (e.onMouseEnter = () => r(!0), e.onMouseLeave = () => r(!1)), v.createElement(a, e, c ? t({ isHover: m }) : t);
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 S = d(x);
9
+ const $ = v(H);
10
10
  export {
11
- S as default
11
+ $ as default
12
12
  };
@@ -1,9 +1,8 @@
1
1
  /// <reference types="react" />
2
- import Box from '../box';
2
+ import { BoxTagProps } from '../box';
3
3
  import { BoxSvgStyles } from '../core/types';
4
4
  import { ClassNameType } from '../core/classNames';
5
- type SvgTagProps = Required<React.ComponentProps<typeof Box<'svg'>>>['props'];
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;
@@ -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","disabled"];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;
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;
@@ -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", "disabled"];
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'];
@@ -1,14 +1,14 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { forwardRef as p } from "react";
3
- import s from "../box.mjs";
4
- import { O as i } from "../utils.mjs";
3
+ import m from "../box.mjs";
4
+ import { O as s } from "../utils.mjs";
5
5
  import "../core.mjs";
6
- const m = ["type", "onClick", "disabled"];
6
+ const i = ["type", "onClick"];
7
7
  function e(o, t) {
8
- const r = i.buildProps(o, m);
9
- return /* @__PURE__ */ n(s, { ref: t, tag: "button", component: "button", ...r });
8
+ const r = s.buildProps(o, i);
9
+ return /* @__PURE__ */ n(m, { ref: t, tag: "button", component: "button", ...r });
10
10
  }
11
- const d = p(e);
11
+ const l = p(e);
12
12
  export {
13
- d as default
13
+ l as default
14
14
  };
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),s=require("react"),t=require("../box.cjs"),c=require("../utils.cjs"),u=require("./flex.cjs");require("../core.cjs");const l=["name","onInput","onChange","disabled","autoFocus","readOnly","required","value","checked","defaultChecked"];function d(n,r){const{native:o}=n,i=c.ObjectUtils.buildProps(n,l,{type:"checkbox"});return e.jsxs(u,{inline:!0,position:"relative",children:[e.jsx(t,{ref:r,tag:"input",component:"checkbox",...i,appearance:o?void 0:"none"}),!o&&e.jsx(t,{position:"absolute",pointerEvents:"none",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:"0 0 20 20",children:e.jsx("g",{fill:"none",fillRule:"evenodd",children:e.jsx("path",{stroke:"#000",strokeLinecap:"round",strokeLinejoin:"round",d:"M6 10.15L8.5 13 14 7"})})})})]})}const a=s.forwardRef(d);module.exports=a;
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;
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
- import Box from '../box';
3
- type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
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 CheckboxTagProps = Omit<BoxTagProps, TagPropsType | 'type'>;
8
- interface Props extends Omit<BoxProps, 'props'> {
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,7 +15,7 @@ interface Props extends Omit<BoxProps, 'props'> {
16
15
  required?: boolean;
17
16
  checked?: boolean;
18
17
  defaultChecked?: boolean;
19
- native?: boolean;
18
+ indeterminate?: boolean;
20
19
  }
21
20
  declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
22
21
  export default _default;
@@ -1,29 +1,16 @@
1
- import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
- import { forwardRef as s } from "react";
3
- import t from "../box.mjs";
4
- import { O as a } from "../utils.mjs";
5
- import d from "./flex.mjs";
1
+ import { jsx as r } from "react/jsx-runtime";
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";
6
5
  import "../core.mjs";
7
- const l = [
8
- "name",
9
- "onInput",
10
- "onChange",
11
- "disabled",
12
- "autoFocus",
13
- "readOnly",
14
- "required",
15
- "value",
16
- "checked",
17
- "defaultChecked"
18
- ];
19
- function p(o, r) {
20
- const { native: n } = o, i = a.buildProps(o, l, { type: "checkbox" });
21
- return /* @__PURE__ */ c(d, { inline: !0, position: "relative", children: [
22
- /* @__PURE__ */ e(t, { ref: r, tag: "input", component: "checkbox", ...i, appearance: n ? void 0 : "none" }),
23
- !n && /* @__PURE__ */ e(t, { position: "absolute", pointerEvents: "none", children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", width: "100%", viewBox: "0 0 20 20", children: /* @__PURE__ */ e("g", { fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ e("path", { stroke: "#000", strokeLinecap: "round", strokeLinejoin: "round", d: "M6 10.15L8.5 13 14 7" }) }) }) })
24
- ] });
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 });
25
12
  }
26
- const v = s(p);
13
+ const k = i(p);
27
14
  export {
28
- v as default
15
+ k as default
29
16
  };
@@ -1,12 +1,12 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { forwardRef as f } from "react";
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { forwardRef as i } from "react";
3
3
  import n from "../box.mjs";
4
4
  import "../core.mjs";
5
5
  function l(o, r) {
6
6
  const { inline: e, ...t } = o;
7
- return /* @__PURE__ */ i(n, { ref: r, display: e ? "inline-flex" : "flex", ...t });
7
+ return /* @__PURE__ */ f(n, { ref: r, display: e ? "inline-flex" : "flex", ...t });
8
8
  }
9
- const a = f(l);
9
+ const a = i(l);
10
10
  export {
11
11
  a as default
12
12
  };
@@ -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","disabled","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;
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", "disabled", "value", "autoFocus", "readOnly", "required", "checked", "defaultChecked"];
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 d = [
7
- "name",
8
- "onInput",
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(u);
11
+ const l = n(p);
23
12
  export {
24
13
  l as default
25
14
  };
@@ -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","disabled","value","defaultValue","rows","cols","autoFocus","maxLength","minLength","readOnly","required"];function i(e,t){const r=s.ObjectUtils.buildProps(e,u);return n.jsx(a,{ref:t,tag:"textarea",component:"textarea",...r})}const c=o.forwardRef(i);module.exports=c;
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;
@@ -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", "disabled", "value", "defaultValue", "rows", "cols", "autoFocus", "maxLength", "minLength", "readOnly", "required"];
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'> {
@@ -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 s } from "../utils.mjs";
4
+ import { O as m } from "../utils.mjs";
5
5
  import "../core.mjs";
6
- const m = [
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, e) {
23
- const o = s.buildProps(t, m);
24
- return /* @__PURE__ */ r(n, { ref: e, tag: "textarea", component: "textarea", ...o });
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 f = a(p);
25
+ const x = a(p);
27
26
  export {
28
- f as default
27
+ x as default
29
28
  };
@@ -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","disabled","defaultValue","autoFocus","readOnly","required","value","pattern"];function a(e,t){const r=s.ObjectUtils.buildProps(e,i);return o.jsx(u,{ref:t,tag:"input",component:"textbox",...r})}const c=n.forwardRef(a);module.exports=c;
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;
@@ -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", "disabled", "defaultValue", "autoFocus", "readOnly", "required", "value", "pattern"];
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';
@@ -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 s = [
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 u(o, t) {
21
- const e = p.buildProps(o, s);
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 x = n(u);
23
+ const c = n(m);
25
24
  export {
26
- x as default
25
+ c as default
27
26
  };
@@ -1182,6 +1182,10 @@ export declare const boxThemeStyles: {
1182
1182
  cssNames: string[];
1183
1183
  formatValue: (key: string, value: string | number | boolean) => string;
1184
1184
  };
1185
+ backgroundImage: {
1186
+ cssNames: string[];
1187
+ formatValue: (key: string, value: string | number | boolean) => string;
1188
+ };
1185
1189
  color: {
1186
1190
  cssNames: string[];
1187
1191
  formatValue: (key: string, value: string | number | boolean) => string;
@@ -1211,8 +1215,10 @@ export declare const svgThemeStyles: {
1211
1215
  formatSelector: typeof BoxStylesFormatters.ClassName.svg;
1212
1216
  };
1213
1217
  };
1214
- 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"];
1215
1220
  export type PseudoClassSuffix = (typeof pseudoClassSuffixes)[number];
1221
+ export type PseudoClassSuffixExtended = (typeof pseudoClassSuffixesExtended)[number];
1216
1222
  export declare const pseudoClassClassName: {
1217
1223
  hover: {
1218
1224
  className: string;
package/core/theme.d.ts CHANGED
@@ -1,36 +1,35 @@
1
1
  import { BoxStyleProps } from './types';
2
- export interface ThemeStyles {
3
- styles: BoxStyleProps;
4
- disabled?: BoxStyleProps;
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>;
28
26
  shadows: Record<string, string>;
29
27
  backgrounds: Record<string, string>;
28
+ backgroundImages: Record<string, string>;
30
29
  }
31
30
  declare namespace Theme {
32
- let Styles: ThemeSetup;
33
- function setup(styles: ThemeSetup): void;
31
+ let Styles: ThemeSetup<BoxStyleProps>;
32
+ function setup(styles: ThemeSetup<BoxThemeProps>): void;
34
33
  function setupAugmentedProps(props: BoxAugmentedProps, options?: {
35
34
  namespacePath?: string;
36
35
  }): {
package/core/types.d.ts CHANGED
@@ -1,16 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { StyleItem, aliases, boxStyles } from './boxStyles';
2
+ import { PseudoClassSuffix, StyleItem, aliases, boxStyles } from './boxStyles';
3
3
  import { ThemeComponentProps } from './useTheme';
4
4
  export type ExtractElementType<T> = T extends React.DetailedHTMLProps<React.HTMLAttributes<infer E>, infer E> ? E : T extends React.SVGProps<infer E> ? E : never;
5
5
  export type ExtractElementFromTag<T extends keyof React.JSX.IntrinsicElements> = ExtractElementType<React.JSX.IntrinsicElements[T]>;
6
- export type Hovered<T> = {
7
- [K in keyof T as K extends string ? `${K}H` : never]: T[K];
8
- };
9
- export type Focused<T> = {
10
- [K in keyof T as K extends string ? `${K}F` : never]: T[K];
11
- };
12
- export type Activated<T> = {
13
- [K in keyof T as K extends string ? `${K}A` : never]: T[K];
6
+ export type PseudoClass<T, TSuffix extends PseudoClassSuffix> = {
7
+ [K in keyof T as K extends string ? `${K}${TSuffix}` : never]: T[K];
14
8
  };
15
9
  export declare namespace Augmented {
16
10
  interface BoxProps {
@@ -21,16 +15,24 @@ export declare namespace Augmented {
21
15
  type BoxStyles<T extends Record<string, StyleItem>> = {
22
16
  [K in keyof T]?: T[K]['values1']['values'][number] | T[K]['values2']['values'][number] | T[K]['values3']['values'][number];
23
17
  };
24
- type BoxNormalStyles = BoxStyles<typeof boxStyles> & BoxStyles<typeof aliases>;
18
+ type BoxNormalStyles = BoxStyles<typeof boxStyles> & BoxStyles<typeof aliases> & Augmented.BoxProps;
25
19
  interface BoxPseudoClasses {
26
20
  hover?: boolean;
27
21
  focus?: boolean;
28
22
  }
29
- export type BoxStyleProps = BoxNormalStyles & BoxPseudoClasses & Hovered<BoxNormalStyles> & Focused<BoxNormalStyles> & Activated<BoxNormalStyles> & ThemeComponentProps & Augmented.BoxProps;
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;
30
32
  interface SvgNormalStyles {
31
33
  rotate?: BoxNormalStyles['rotate'];
32
34
  flip?: BoxNormalStyles['flip'];
33
35
  transitionDuration?: BoxNormalStyles['transitionDuration'];
34
36
  }
35
- export type BoxSvgStyles = SvgNormalStyles & Hovered<SvgNormalStyles> & Focused<SvgNormalStyles> & Activated<SvgNormalStyles> & ThemeComponentProps & Augmented.SvgProps;
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;
36
38
  export {};
@@ -3,7 +3,6 @@ import { BoxStyleProps } from './types';
3
3
  type ReservedComponentName = Exclude<string, keyof Omit<ThemeSetup, 'components'>>;
4
4
  export interface ThemeComponentProps {
5
5
  clean?: boolean;
6
- disabled?: boolean;
7
6
  component?: ReservedComponentName;
8
7
  theme?: string;
9
8
  }