@cronocode/react-box 1.6.4 → 1.6.5

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.
@@ -3,5 +3,5 @@ html{font-size: 16px;font-family: Arial, sans-serif;}
3
3
  body{margin: 0;line-height: var(--lineHeight);font-size: var(--fontSize);}
4
4
  a,ul{all: unset;}
5
5
  .${a.doxClassName}{display: block;border: 0 solid var(--borderColor);outline: 0px solid var(--outlineColor);margin: 0;padding: 0;background-color: initial;transition: all var(--transitionTime);box-sizing: border-box;font-family: inherit;font-size: inherit;}
6
- .${a.svgClassName}{width: 1.5rem;transition: all var(--svgTransitionTime);}.${a.svgClassName} path,.${a.svgClassName} circle,.${a.svgClassName} rect,.${a.svgClassName} line {transition: all var(--svgTransitionTime);}
7
- `,n=new L.IdentityFactory,v=Object.keys(t),o=b();let d=!1;const g=v.reduce((u,l)=>(u[l]=new Set,u),{});function x(u,l){if(u in t)return f(u,l);if(u in H)return H[u].className;if(u in T)return f(u,l)}a.get=x;function S(){if(d){console.info("%c💬Flush Dox Styles","color: #00ffff");let u=h([r]);u=h(u,"H"),u=h(u,"F"),u=h(u,"A"),o.innerHTML=u.join(""),d=!1}}a.flush=S;function f(u,l){var m;g[u].has(l)||(d=!0,g[u].add(l));const i=V(u,l),c=((m=i.formatClassName)==null?void 0:m.call(i,u,l))??`${u}${l}`;return`-${n.getIdentity(c)}`}function h(u,l){return Object.entries(g).filter(([c])=>{var m;return((m=t[c])==null?void 0:m.pseudoSuffix)===l}).reduce((c,[m,O])=>(O.forEach(k=>{var R;const p=V(m,k),N=`.${f(m,k)}`;let $=[];l?l==="H"?$=[...i(`${N}:hover`,p),...i(`.${H.hover.className}:hover>${N}`,p)]:l==="F"?$=[...i(`${N}:focus-within`,p),...i(`.${H.focus.className}:focus-within>${N}`,p)]:l==="A"&&($=i(`${N}:active`,p)):$=i(N,p);const A=((R=p.formatValue)==null?void 0:R.call(p,m,k))??k,B=t[m].cssNames.map(F=>`${F}:${A};`).join("");c.push(`${$.join(",")}{${B}}`)}),c),u);function i(c,m){return m.formatSelector?m.formatSelector(c):[c]}}function V(u,l){const i=t[u];return i.isThemeStyle?i:i.values1.values.includes(l)?i.values1:i.values2.values.includes(l)?i.values2:i.values3}function b(){const u="crono-styles";let l=document.getElementById(u);return l||(l=document.createElement("style"),l.setAttribute("id",u),l.setAttribute("type","text/css"),document.head.insertBefore(l,document.head.firstChild)),l}})(w||(w={}));function P(a,r){const n=I.useTheme(a);return y.useLayoutEffect(w.flush,[a]),y.useMemo(()=>{const v=[r?w.svgClassName:w.doxClassName],o=n?{...C(n),...C(a)}:C(a);return Object.entries(o).forEach(([d,g])=>{v.push(w.get(d,g))}),v},[a,n])}function C(a){const r={...a};return Object.keys(r).forEach(v=>{const o=z[v];o&&(o.key in r||(r[o.key]=r[v]),delete r[v])}),r}function q(a,r){const{tag:n,children:v,props:o,className:d,style:g}=a,x=P(a,n==="svg"),S=y.useMemo(()=>L.ClassNameUtils.classNames(d,x).join(" "),[a]),f={...o,className:S};g&&(f.style=g),r&&(f.ref=r);const[h,V]=y.useState(!1),b=typeof v=="function";return b&&(f.onMouseEnter=()=>V(!0),f.onMouseLeave=()=>V(!1)),y.createElement(n||"div",f,b?v({isHover:h}):v)}const W=y.forwardRef(q);exports.default=W;
6
+ .${a.svgClassName}{transition: all var(--svgTransitionTime);}.${a.svgClassName} path,.${a.svgClassName} circle,.${a.svgClassName} rect,.${a.svgClassName} line {transition: all var(--svgTransitionTime);}
7
+ `,n=new L.IdentityFactory,v=Object.keys(t),o=b();let d=!1;const g=v.reduce((u,l)=>(u[l]=new Set,u),{});function x(u,l){if(u in t)return f(u,l);if(u in H)return H[u].className;if(u in T)return f(u,l)}a.get=x;function S(){if(d){console.info("%c💬Flush Dox Styles","color: #00ffff");let u=h([r]);u=h(u,"H"),u=h(u,"F"),u=h(u,"A"),o.innerHTML=u.join(""),d=!1}}a.flush=S;function f(u,l){var m;g[u].has(l)||(d=!0,g[u].add(l));const i=V(u,l),c=((m=i.formatClassName)==null?void 0:m.call(i,u,l))??`${u}${l}`;return`-${n.getIdentity(c)}`}function h(u,l){return Object.entries(g).filter(([c])=>{var m;return((m=t[c])==null?void 0:m.pseudoSuffix)===l}).reduce((c,[m,O])=>(O.forEach(k=>{var R;const p=V(m,k),N=`.${f(m,k)}`;let $=[];l?l==="H"?$=[...i(`${N}:hover`,p),...i(`.${H.hover.className}:hover>${N}`,p)]:l==="F"?$=[...i(`${N}:focus-within`,p),...i(`.${H.focus.className}:focus-within>${N}`,p)]:l==="A"&&($=i(`${N}:active`,p)):$=i(N,p);const A=((R=p.formatValue)==null?void 0:R.call(p,m,k))??k,B=t[m].cssNames.map(F=>`${F}:${A};`).join("");c.push(`${$.join(",")}{${B}}`)}),c),u);function i(c,m){return m.formatSelector?m.formatSelector(c):[c]}}function V(u,l){const i=t[u];return i.isThemeStyle?i:i.values1.values.includes(l)?i.values1:i.values2.values.includes(l)?i.values2:i.values3}function b(){const u="crono-styles";let l=document.getElementById(u);return l||(l=document.createElement("style"),l.setAttribute("id",u),l.setAttribute("type","text/css"),document.head.insertBefore(l,document.head.firstChild)),l}})(w||(w={}));function P(a,r){const n=I.useTheme(a);return y.useLayoutEffect(w.flush,[a]),y.useMemo(()=>{const v=[r?w.svgClassName:w.doxClassName],o=n?{...C(n),...C(a)}:C(a);return Object.entries(o).forEach(([d,g])=>{v.push(w.get(d,g))}),v},[a,n])}function C(a){const r={...a};return Object.keys(r).forEach(v=>{const o=z[v];o&&(o.key in r||(r[o.key]=r[v]),delete r[v])}),r}function q(a,r){const{tag:n="div",children:v,props:o,className:d,style:g}=a,x=P(a,n==="svg"),S=y.useMemo(()=>L.ClassNameUtils.classNames(d,x).join(" "),[a]),f={...o,className:S};g&&(f.style=g),r&&(f.ref=r);const[h,V]=y.useState(!1),b=typeof v=="function";return b&&(f.onMouseEnter=()=>V(!0),f.onMouseLeave=()=>V(!1)),y.createElement(n,f,b?v({isHover:h}):v)}const W=y.forwardRef(q);exports.default=W;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { RefAttributes } from 'react';
2
2
  import ClassNameUtils from '../utils/className/classNameUtils';
3
3
  import { DoxStyleProps } from './dox/doxStyles';
4
4
  type AllProps<TTag extends keyof JSX.IntrinsicElements> = React.ComponentProps<TTag>;
@@ -12,5 +12,5 @@ interface Props<TTag extends keyof JSX.IntrinsicElements> extends DoxStyleProps
12
12
  className?: ClassNameUtils.ClassNameType;
13
13
  style?: React.ComponentProps<TTag>['style'];
14
14
  }
15
- declare const _default: <TTag extends keyof JSX.IntrinsicElements = "div">(props: Props<TTag>) => JSX.Element;
15
+ declare const _default: <TTag extends keyof JSX.IntrinsicElements = "div">(props: Props<TTag> & React.RefAttributes<ExtractElementType<JSX.IntrinsicElements[TTag]>>) => JSX.Element;
16
16
  export default _default;
@@ -916,7 +916,7 @@ html{font-size: 16px;font-family: Arial, sans-serif;}
916
916
  body{margin: 0;line-height: var(--lineHeight);font-size: var(--fontSize);}
917
917
  a,ul{all: unset;}
918
918
  .${a.doxClassName}{display: block;border: 0 solid var(--borderColor);outline: 0px solid var(--outlineColor);margin: 0;padding: 0;background-color: initial;transition: all var(--transitionTime);box-sizing: border-box;font-family: inherit;font-size: inherit;}
919
- .${a.svgClassName}{width: 1.5rem;transition: all var(--svgTransitionTime);}.${a.svgClassName} path,.${a.svgClassName} circle,.${a.svgClassName} rect,.${a.svgClassName} line {transition: all var(--svgTransitionTime);}
919
+ .${a.svgClassName}{transition: all var(--svgTransitionTime);}.${a.svgClassName} path,.${a.svgClassName} circle,.${a.svgClassName} rect,.${a.svgClassName} line {transition: all var(--svgTransitionTime);}
920
920
  `, n = new P(), v = Object.keys(t), o = b();
921
921
  let d = !1;
922
922
  const g = v.reduce((u, l) => (u[l] = /* @__PURE__ */ new Set(), u), {});
@@ -992,10 +992,10 @@ function H(a) {
992
992
  }), r;
993
993
  }
994
994
  function Y(a, r) {
995
- const { tag: n, children: v, props: o, className: d, style: g } = a, y = X(a, n === "svg"), x = E(() => M.classNames(d, y).join(" "), [a]), f = { ...o, className: x };
995
+ const { tag: n = "div", children: v, props: o, className: d, style: g } = a, y = X(a, n === "svg"), x = E(() => M.classNames(d, y).join(" "), [a]), f = { ...o, className: x };
996
996
  g && (f.style = g), r && (f.ref = r);
997
997
  const [h, V] = D(!1), b = typeof v == "function";
998
- return b && (f.onMouseEnter = () => V(!0), f.onMouseLeave = () => V(!1)), F.createElement(n || "div", f, b ? v({ isHover: h }) : v);
998
+ return b && (f.onMouseEnter = () => V(!0), f.onMouseLeave = () => V(!1)), F.createElement(n, f, b ? v({ isHover: h }) : v);
999
999
  }
1000
1000
  const ee = _(Y);
1001
1001
  export {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),l=require("./dox.cjs");require("react");require("../utils/utils.cjs");require("../theme.cjs");function g(e){const{props:t,style:r,width:s,height:o,viewBox:i="0 0 24 24",className:u}=e;return n.jsx(l.default,{tag:"svg",className:u,...e,props:{...t,viewBox:i,xmlns:"http://www.w3.org/2000/svg",fill:"none"},style:{...r,width:s,height:o}})}exports.default=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),g=require("react"),c=require("./dox.cjs");require("../utils/utils.cjs");require("../theme.cjs");function a(e,r){const{viewBox:t="0 0 24 24",width:o="1.5rem",height:s,props:i,...n}=e;return u.jsx(c.default,{tag:"svg",ref:r,props:{...i,viewBox:t,width:o,height:s,xmlns:"http://www.w3.org/2000/svg",fill:"none"},...n})}const d=g.forwardRef(a);exports.default=d;
@@ -1,19 +1,18 @@
1
- import React from 'react';
1
+ import Dox from './dox';
2
2
  import ClassNameUtils from '../utils/className/classNameUtils';
3
3
  import { DoxSvgStyles } from './dox/doxStyles';
4
- type AllSvgProps = React.SVGProps<SVGElement>;
5
- type SvgPropsType = Omit<AllSvgProps, 'className' | 'style' | 'width' | 'height'>;
6
- type SvgStyleType = Omit<React.CSSProperties, 'width' | 'height'>;
4
+ type SvgTagProps = Required<React.ComponentProps<typeof Dox<'svg'>>>['props'];
5
+ type DoxSvgTagProps = Omit<SvgTagProps, 'viewBox' | 'width' | 'height'>;
7
6
  interface Props extends DoxSvgStyles {
8
7
  children?: React.ReactNode | ((props: {
9
8
  isHover: boolean;
10
9
  }) => React.ReactNode);
11
- props?: SvgPropsType;
12
- style?: SvgStyleType;
10
+ props?: DoxSvgTagProps;
11
+ style?: React.ComponentProps<'svg'>['style'];
13
12
  className?: ClassNameUtils.ClassNameType;
14
13
  viewBox?: string;
15
14
  width?: string;
16
15
  height?: string;
17
16
  }
18
- export default function DoxSvg(props: Props): JSX.Element;
19
- export {};
17
+ declare const _default: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<SVGSVGElement>>;
18
+ export default _default;
@@ -1,21 +1,21 @@
1
- import { jsx as m } from "react/jsx-runtime";
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { forwardRef as f } from "react";
2
3
  import g from "./dox.mjs";
3
- import "react";
4
4
  import "../utils/utils.mjs";
5
5
  import "../theme.mjs";
6
- function f(t) {
7
- const { props: o, style: r, width: s, height: i, viewBox: p = "0 0 24 24", className: e } = t;
8
- return /* @__PURE__ */ m(
6
+ function n(o, r) {
7
+ const { viewBox: t = "0 0 24 24", width: p = "1.5rem", height: s, props: i, ...m } = o;
8
+ return /* @__PURE__ */ e(
9
9
  g,
10
10
  {
11
11
  tag: "svg",
12
- className: e,
13
- ...t,
14
- props: { ...o, viewBox: p, xmlns: "http://www.w3.org/2000/svg", fill: "none" },
15
- style: { ...r, width: s, height: i }
12
+ ref: r,
13
+ props: { ...i, viewBox: t, width: p, height: s, xmlns: "http://www.w3.org/2000/svg", fill: "none" },
14
+ ...m
16
15
  }
17
16
  );
18
17
  }
18
+ const h = f(n);
19
19
  export {
20
- f as default
20
+ h as default
21
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronocode/react-box",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "main": "./box.cjs",
5
5
  "module": "./box.mjs",
6
6
  "types": "./box.d.ts",