@cronocode/react-box 1.7.1 → 1.7.2

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 CHANGED
@@ -1,2 +1,21 @@
1
- import Dox from './components/dox';
2
- export default Dox;
1
+ import React, { RefAttributes } from 'react';
2
+ import ClassNameUtils from './utils/className/classNameUtils';
3
+ import { DoxStyleProps } from './components/dox/doxStyles';
4
+ import { StylesContext } from './components/dox/stylesContext';
5
+ type ExtractElementType<T> = T extends React.DetailedHTMLProps<React.HTMLAttributes<infer E>, infer E> ? E : T extends React.SVGProps<infer E> ? E : never;
6
+ type ExtractElementFromTag<T extends keyof React.JSX.IntrinsicElements> = ExtractElementType<React.JSX.IntrinsicElements[T]>;
7
+ type AllProps<TTag extends keyof React.JSX.IntrinsicElements> = React.ComponentProps<TTag>;
8
+ type TagPropsType<TTag extends keyof React.JSX.IntrinsicElements> = Omit<AllProps<TTag>, 'className' | 'style' | 'ref'>;
9
+ interface Props<TTag extends keyof React.JSX.IntrinsicElements> extends DoxStyleProps {
10
+ children?: React.ReactNode | ((props: {
11
+ isHover: boolean;
12
+ }) => React.ReactNode);
13
+ tag?: TTag;
14
+ props?: TagPropsType<TTag>;
15
+ className?: ClassNameUtils.ClassNameType;
16
+ style?: React.ComponentProps<TTag>['style'];
17
+ }
18
+ declare const _default: <TTag extends keyof React.JSX.IntrinsicElements = "div">(props: Props<TTag> & React.RefAttributes<ExtractElementType<React.JSX.IntrinsicElements[TTag]>>) => React.ReactNode;
19
+ export default _default;
20
+ declare const flushStyles: typeof StylesContext.flush;
21
+ export { flushStyles };
package/box.js CHANGED
@@ -1 +1,14 @@
1
- import "./components/dox.js";
1
+ import y, { forwardRef as N, useMemo as v, useState as S } from "react";
2
+ import { C as p } from "./utils.js";
3
+ import { u as C, S as d } from "./components/dox.js";
4
+ function g(e, o) {
5
+ const { tag: a = "div", children: t, props: c, className: f, style: n } = e, m = C(e, a === "svg"), u = v(() => p.classNames(f, m).join(" "), [e]), s = { ...c, className: u };
6
+ n && (s.style = n), o && (s.ref = o);
7
+ const [i, l] = S(!1), r = typeof t == "function";
8
+ return r && (s.onMouseEnter = () => l(!0), s.onMouseLeave = () => l(!1)), y.createElement(a, s, r ? t({ isHover: i }) : t);
9
+ }
10
+ const M = N(g), { flush: E } = d;
11
+ export {
12
+ M as B,
13
+ E as f
14
+ };
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
- import Dox from './dox';
2
+ import Box from '../box';
3
3
  import ClassNameUtils from '../utils/className/classNameUtils';
4
4
  import { DoxSvgStyles } from './dox/doxStyles';
5
- type SvgTagProps = Required<React.ComponentProps<typeof Dox<'svg'>>>['props'];
5
+ type SvgTagProps = Required<React.ComponentProps<typeof Box<'svg'>>>['props'];
6
6
  type DoxSvgTagProps = Omit<SvgTagProps, 'viewBox' | 'width' | 'height'>;
7
7
  interface Props extends DoxSvgStyles {
8
8
  children?: React.ReactNode | ((props: {
@@ -1,6 +1,6 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import { forwardRef as m } from "react";
3
- import { D as n } from "./dox.js";
3
+ import { B as n } from "../box.js";
4
4
  function a(o, r) {
5
5
  const { viewBox: s = "0 0 24 24", width: t = "1.5rem", height: p, props: e, ...g } = o;
6
6
  return /* @__PURE__ */ i(
@@ -1,6 +1,6 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { forwardRef as s } from "react";
3
- import { D as p } from "./dox.js";
3
+ import { B as p } from "../box.js";
4
4
  import { O as i } from "../utils.js";
5
5
  const m = ["type", "onClick", "disabled"];
6
6
  function e(o, t) {
@@ -1,6 +1,6 @@
1
1
  import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
2
  import { forwardRef as c } from "react";
3
- import { D as t } from "./dox.js";
3
+ import { B as t } from "../box.js";
4
4
  import { O as a } from "../utils.js";
5
5
  import { F as l } from "./flex.js";
6
6
  import { c as d } from "../box.module.css.js";
@@ -1,5 +1,5 @@
1
1
  import { jsx as i, Fragment as m, jsxs as c } from "react/jsx-runtime";
2
- import { D as t } from "./dox.js";
2
+ import { B as t } from "../box.js";
3
3
  function u(n) {
4
4
  if (!(n != null && n.length))
5
5
  return {
package/components/dox.js CHANGED
@@ -1,26 +1,26 @@
1
- import O, { useMemo as j, useLayoutEffect as I, useEffect as D, forwardRef as _, useState as P } from "react";
2
- import { I as M, C as W } from "../utils.js";
3
- import { u as G } from "../theme.js";
1
+ import { useMemo as L, useLayoutEffect as O, useEffect as I } from "react";
2
+ import { I as _ } from "../utils.js";
3
+ import { u as D } from "../theme.js";
4
4
  var e;
5
5
  ((a) => {
6
6
  ((r) => {
7
- function m(l, d) {
7
+ function c(l, d) {
8
8
  return `${l}${d.replace("/", "-")}`;
9
9
  }
10
- r.fraction = m;
11
- function n(l) {
10
+ r.fraction = c;
11
+ function m(l) {
12
12
  return [`${l} path`, `${l} circle`, `${l} rect`, `${l} line`];
13
13
  }
14
- r.svg = n;
14
+ r.svg = m;
15
15
  })(a.ClassName || (a.ClassName = {})), ((r) => {
16
- function m(u, i) {
16
+ function c(u, i) {
17
17
  return `${i / 4}rem`;
18
18
  }
19
- r.rem = m;
20
- function n(u, i) {
19
+ r.rem = c;
20
+ function m(u, i) {
21
21
  return `${i}px`;
22
22
  }
23
- r.px = n;
23
+ r.px = m;
24
24
  function l(u, i) {
25
25
  const [o, v] = i.split("/");
26
26
  return `${+o / +v * 100}%`;
@@ -41,33 +41,33 @@ var e;
41
41
  return (i, o) => `var(--${u}${o});`;
42
42
  }
43
43
  r.variables = g;
44
- function z(u) {
44
+ function S(u) {
45
45
  return (i, o) => `var(--${u}${o});`;
46
46
  }
47
- r.svgVariables = z;
48
- function x(u, i) {
47
+ r.svgVariables = S;
48
+ function k(u, i) {
49
49
  return `repeat(${i},minmax(0,1fr))`;
50
50
  }
51
- r.gridColumns = x;
52
- function f(u, i) {
51
+ r.gridColumns = k;
52
+ function N(u, i) {
53
53
  return i === "full-row" ? "1/-1" : `span ${i}/span ${i}`;
54
54
  }
55
- r.gridColumn = f;
56
- function h(u, i) {
55
+ r.gridColumn = N;
56
+ function p(u, i) {
57
57
  return `${i}ms`;
58
58
  }
59
- r.ms = h;
60
- function V(u, i) {
59
+ r.ms = p;
60
+ function y(u, i) {
61
61
  return `${i}deg`;
62
62
  }
63
- r.rotate = V;
64
- function b(u, i) {
63
+ r.rotate = y;
64
+ function $(u, i) {
65
65
  return i === "xAxis" ? "-1 1" : "1 -1";
66
66
  }
67
- r.flip = b;
67
+ r.flip = $;
68
68
  })(a.Value || (a.Value = {}));
69
69
  })(e || (e = {}));
70
- const q = ["H", "F", "A"];
70
+ const W = ["H", "F", "A"];
71
71
  var s;
72
72
  ((a) => {
73
73
  a.positiveSizes = [
@@ -208,14 +208,14 @@ var s;
208
208
  "11/12"
209
209
  ], a.widthHeightValues = ["fit", "fit-screen", "auto", "fit-content", "max-content", "min-content"], a.alignSelf = ["auto", "flex-start", "flex-end", "center", "baseline", "stretch"];
210
210
  })(s || (s = {}));
211
- const R = {
211
+ const A = {
212
212
  shadow: { cssNames: ["box-shadow"], formatValue: e.Value.variables("shadow") },
213
213
  background: { cssNames: ["background"], formatValue: e.Value.variables("background") },
214
214
  color: { cssNames: ["color"], formatValue: e.Value.variables("color") },
215
215
  bgColor: { cssNames: ["background-color"], formatValue: e.Value.variables("color") },
216
216
  borderColor: { cssNames: ["border-color"], formatValue: e.Value.variables("color") },
217
217
  outlineColor: { cssNames: ["outline-color"], formatValue: e.Value.variables("color") }
218
- }, A = {
218
+ }, R = {
219
219
  fill: {
220
220
  cssNames: ["fill"],
221
221
  formatValue: e.Value.svgVariables("color"),
@@ -226,7 +226,7 @@ const R = {
226
226
  formatValue: e.Value.svgVariables("color"),
227
227
  formatSelector: e.ClassName.svg
228
228
  }
229
- }, H = {
229
+ }, x = {
230
230
  hover: { className: "_h" },
231
231
  focus: { className: "_f" }
232
232
  }, t = {
@@ -872,13 +872,13 @@ const R = {
872
872
  Object.keys(C).forEach((a) => {
873
873
  t[a] = C[a];
874
874
  });
875
- Object.keys(R).forEach((a) => {
876
- t[a] = R[a], t[a].isThemeStyle = !0;
877
- });
878
875
  Object.keys(A).forEach((a) => {
879
876
  t[a] = A[a], t[a].isThemeStyle = !0;
880
877
  });
881
- const y = {
878
+ Object.keys(R).forEach((a) => {
879
+ t[a] = R[a], t[a].isThemeStyle = !0;
880
+ });
881
+ const V = {
882
882
  w: { ...t.width, key: "width" },
883
883
  h: { ...t.height, key: "height" },
884
884
  m: { ...t.margin, key: "margin" },
@@ -906,15 +906,15 @@ const y = {
906
906
  ai: { ...t.alignItems, key: "alignItems" },
907
907
  ac: { ...t.alignContent, key: "alignContent" },
908
908
  d: { ...t.flexDirection, key: "flexDirection" }
909
- }, U = Object.keys(t), X = Object.keys(y);
910
- q.forEach((a) => {
911
- U.forEach((r) => {
909
+ }, G = Object.keys(t), P = Object.keys(V);
910
+ W.forEach((a) => {
911
+ G.forEach((r) => {
912
912
  t[`${r}${a}`] = { ...t[r] }, t[`${r}${a}`].pseudoSuffix = a;
913
- }), X.forEach((r) => {
914
- y[`${r}${a}`] = { ...y[r], key: `${y[r].key}${a}` }, y[`${r}${a}`].pseudoSuffix = a;
913
+ }), P.forEach((r) => {
914
+ V[`${r}${a}`] = { ...V[r], key: `${V[r].key}${a}` }, V[`${r}${a}`].pseudoSuffix = a;
915
915
  });
916
916
  });
917
- var w;
917
+ var b;
918
918
  ((a) => {
919
919
  a.doxClassName = "_dox", a.svgClassName = "_svg";
920
920
  const r = `:root{--borderColor: black;--outlineColor: black;--lineHeight: 1.2;--fontSize: 14px;--transitionTime: 0.25s;--svgTransitionTime: 0.3s;#crono-box {position: absolute;top: 0;left: 0;height: 0;}}
@@ -923,88 +923,82 @@ body{margin: 0;line-height: var(--lineHeight);font-size: var(--fontSize);}
923
923
  a,ul{all: unset;}
924
924
  .${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;}
925
925
  .${a.svgClassName}{transition: all var(--svgTransitionTime);}.${a.svgClassName} path,.${a.svgClassName} circle,.${a.svgClassName} rect,.${a.svgClassName} line {transition: all var(--svgTransitionTime);}
926
- `, m = new M(), n = Object.keys(t), l = b();
926
+ `, c = new _(), m = Object.keys(t), l = $();
927
927
  let d = !1;
928
- const g = n.reduce((u, i) => (u[i] = /* @__PURE__ */ new Set(), u), {});
929
- function z(u, i) {
928
+ const g = m.reduce((u, i) => (u[i] = /* @__PURE__ */ new Set(), u), {});
929
+ function S(u, i) {
930
930
  if (u in t)
931
- return f(u, i);
932
- if (u in H)
933
- return H[u].className;
931
+ return N(u, i);
932
+ if (u in x)
933
+ return x[u].className;
934
934
  if (u in C)
935
- return f(u, i);
935
+ return N(u, i);
936
936
  }
937
- a.get = z;
938
- function x() {
937
+ a.get = S;
938
+ function k() {
939
939
  if (d) {
940
940
  console.info("%c💬Flush Dox Styles", "color: #00ffff");
941
- let u = h([r]);
942
- u = h(u, "H"), u = h(u, "F"), u = h(u, "A"), l.innerHTML = u.join(""), d = !1;
941
+ let u = p([r]);
942
+ u = p(u, "H"), u = p(u, "F"), u = p(u, "A"), l.innerHTML = u.join(""), d = !1;
943
943
  }
944
944
  }
945
- a.flush = x;
946
- function f(u, i) {
947
- var c;
945
+ a.flush = k;
946
+ function N(u, i) {
947
+ var n;
948
948
  g[u].has(i) || (d = !0, g[u].add(i));
949
- const o = V(u, i), v = ((c = o.formatClassName) == null ? void 0 : c.call(o, u, i)) ?? `${u}${i}`;
950
- return `-${m.getIdentity(v)}`;
949
+ const o = y(u, i), v = ((n = o.formatClassName) == null ? void 0 : n.call(o, u, i)) ?? `${u}${i}`;
950
+ return `-${c.getIdentity(v)}`;
951
951
  }
952
- function h(u, i) {
952
+ function p(u, i) {
953
953
  return Object.entries(g).filter(([v]) => {
954
- var c;
955
- return ((c = t[v]) == null ? void 0 : c.pseudoSuffix) === i;
956
- }).reduce((v, [c, E]) => (E.forEach((k) => {
954
+ var n;
955
+ return ((n = t[v]) == null ? void 0 : n.pseudoSuffix) === i;
956
+ }).reduce((v, [n, j]) => (j.forEach((z) => {
957
957
  var T;
958
- const p = V(c, k), N = `.${f(c, k)}`;
959
- let S = [];
960
- i ? i === "H" ? S = [
961
- ...o(`${N}:hover`, p),
962
- ...o(`.${H.hover.className}:hover>${N}`, p)
963
- ] : i === "F" ? S = [
964
- ...o(`${N}:focus-within`, p),
965
- ...o(`.${H.focus.className}:focus-within>${N}`, p)
966
- ] : i === "A" && (S = o(`${N}:active`, p)) : S = o(N, p);
967
- const F = ((T = p.formatValue) == null ? void 0 : T.call(p, c, k)) ?? k, B = t[c].cssNames.map((L) => `${L}:${F};`).join("");
968
- v.push(`${S.join(",")}{${B}}`);
958
+ const f = y(n, z), h = `.${N(n, z)}`;
959
+ let w = [];
960
+ i ? i === "H" ? w = [
961
+ ...o(`${h}:hover`, f),
962
+ ...o(`.${x.hover.className}:hover>${h}`, f)
963
+ ] : i === "F" ? w = [
964
+ ...o(`${h}:focus-within`, f),
965
+ ...o(`.${x.focus.className}:focus-within>${h}`, f)
966
+ ] : i === "A" && (w = o(`${h}:active`, f)) : w = o(h, f);
967
+ const F = ((T = f.formatValue) == null ? void 0 : T.call(f, n, z)) ?? z, B = t[n].cssNames.map((E) => `${E}:${F};`).join("");
968
+ v.push(`${w.join(",")}{${B}}`);
969
969
  }), v), u);
970
- function o(v, c) {
971
- return c.formatSelector ? c.formatSelector(v) : [v];
970
+ function o(v, n) {
971
+ return n.formatSelector ? n.formatSelector(v) : [v];
972
972
  }
973
973
  }
974
- function V(u, i) {
974
+ function y(u, i) {
975
975
  const o = t[u];
976
976
  return o.isThemeStyle ? o : o.values1.values.includes(i) ? o.values1 : o.values2.values.includes(i) ? o.values2 : o.values3;
977
977
  }
978
- function b() {
978
+ function $() {
979
979
  const u = "crono-styles", o = typeof window < "u" && typeof window.document < "u" ? window.document : global.document;
980
980
  let v = o.getElementById(u);
981
981
  return v || (v = o.createElement("style"), v.setAttribute("id", u), v.setAttribute("type", "text/css"), o.head.insertBefore(v, o.head.firstChild)), v;
982
982
  }
983
- })(w || (w = {}));
984
- const Y = typeof window < "u" && typeof window.document < "u", J = Y ? I : D;
983
+ })(b || (b = {}));
984
+ const q = typeof window < "u" && typeof window.document < "u", M = q ? O : I;
985
985
  function Q(a, r) {
986
- const m = G(a);
987
- return J(w.flush, [a]), j(() => {
988
- const n = [r ? w.svgClassName : w.doxClassName], l = m ? { ...$(m), ...$(a) } : $(a);
986
+ const c = D(a);
987
+ return M(b.flush, [a]), L(() => {
988
+ const m = [r ? b.svgClassName : b.doxClassName], l = c ? { ...H(c), ...H(a) } : H(a);
989
989
  return "inline" in l && (l.display === "block" ? l.display = "inline-block" : l.display === "flex" ? l.display = "inline-flex" : l.display === "grid" && (l.display = "inline-grid"), delete l.inline), "inlineH" in l && (l.displayH === "block" ? l.displayH = "inline-block" : l.displayH === "flex" ? l.displayH = "inline-flex" : l.displayH === "grid" && (l.displayH = "inline-grid"), delete l.inlineH), "inlineF" in l && (l.displayF === "block" ? l.displayF = "inline-block" : l.displayF === "flex" ? l.displayF = "inline-flex" : l.displayF === "grid" && (l.displayF = "inline-grid"), delete l.inlineF), "inlineA" in l && (l.displayA === "block" ? l.displayA = "inline-block" : l.displayA === "flex" ? l.displayA = "inline-flex" : l.displayA === "grid" && (l.displayA = "inline-grid"), delete l.inlineA), Object.entries(l).forEach(([d, g]) => {
990
- n.push(w.get(d, g));
991
- }), n;
992
- }, [a, m]);
990
+ m.push(b.get(d, g));
991
+ }), m;
992
+ }, [a, c]);
993
993
  }
994
- function $(a) {
994
+ function H(a) {
995
995
  const r = { ...a };
996
- return Object.keys(r).forEach((n) => {
997
- const l = y[n];
998
- l && (l.key in r || (r[l.key] = r[n]), delete r[n]);
996
+ return Object.keys(r).forEach((m) => {
997
+ const l = V[m];
998
+ l && (l.key in r || (r[l.key] = r[m]), delete r[m]);
999
999
  }), r;
1000
1000
  }
1001
- function Z(a, r) {
1002
- const { tag: m = "div", children: n, props: l, className: d, style: g } = a, z = Q(a, m === "svg"), x = j(() => W.classNames(d, z).join(" "), [a]), f = { ...l, className: x };
1003
- g && (f.style = g), r && (f.ref = r);
1004
- const [h, V] = P(!1), b = typeof n == "function";
1005
- return b && (f.onMouseEnter = () => V(!0), f.onMouseLeave = () => V(!1)), O.createElement(m, f, b ? n({ isHover: h }) : n);
1006
- }
1007
- const le = _(Z);
1008
1001
  export {
1009
- le as D
1002
+ b as S,
1003
+ Q as u
1010
1004
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { forwardRef as t } from "react";
3
- import { D as f } from "./dox.js";
3
+ import { B as f } from "../box.js";
4
4
  function s(o, r) {
5
5
  const { inline: e, ...i } = o;
6
6
  return /* @__PURE__ */ n(f, { ref: r, display: e ? "inline-flex" : "flex", ...i });
@@ -1,6 +1,6 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
2
  import { useRef as i, useCallback as p } from "react";
3
- import { D as u } from "./dox.js";
3
+ import { B as u } from "../box.js";
4
4
  import { F as c } from "../utils.js";
5
5
  function x(o) {
6
6
  const { onSubmit: m, props: n } = o, r = i(null), s = p((t) => {
@@ -1,6 +1,6 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import { forwardRef as s } from "react";
3
- import { D as d } from "./dox.js";
3
+ import { B as d } from "../box.js";
4
4
  function e(r, i) {
5
5
  const { inline: o, ...n } = r;
6
6
  return /* @__PURE__ */ t(d, { ref: i, display: o ? "inline-grid" : "grid", ...n });
@@ -1,6 +1,6 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import { forwardRef as n } from "react";
3
- import { D as a } from "./dox.js";
3
+ import { B as a } from "../box.js";
4
4
  import { O as i } from "../utils.js";
5
5
  const d = [
6
6
  "name",
@@ -1,6 +1,6 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import { forwardRef as a } from "react";
3
- import { D as n } from "./dox.js";
3
+ import { B as n } from "../box.js";
4
4
  import { O as s } from "../utils.js";
5
5
  const m = [
6
6
  "name",
@@ -1,6 +1,6 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import { forwardRef as n } from "react";
3
- import { D as a } from "./dox.js";
3
+ import { B as a } from "../box.js";
4
4
  import { O as p } from "../utils.js";
5
5
  const s = [
6
6
  "name",
@@ -1,11 +1,11 @@
1
1
  import { jsxs as v, Fragment as x, jsx as a } from "react/jsx-runtime";
2
2
  import { createPortal as b } from "react-dom";
3
- import { D as u } from "./dox.js";
4
- import { useRef as D, useState as E, useCallback as d, useLayoutEffect as L } from "react";
5
- import { u as g } from "../utils.js";
3
+ import { B as u } from "../box.js";
4
+ import { useRef as E, useState as L, useCallback as d, useLayoutEffect as g } from "react";
5
+ import { u as z } from "../utils.js";
6
6
  const i = 2;
7
- function y(f) {
8
- const { onPositionChange: c } = f, s = D(null), [t, p] = E(), m = g(), w = d(
7
+ function j(f) {
8
+ const { onPositionChange: c } = f, s = E(null), [t, p] = L(), m = z(), w = d(
9
9
  (o, e) => {
10
10
  const r = (n) => {
11
11
  n.target.contains(o) && e(o);
@@ -32,7 +32,7 @@ function y(f) {
32
32
  },
33
33
  [t]
34
34
  );
35
- return L(() => {
35
+ return g(() => {
36
36
  if (s.current) {
37
37
  l(s.current);
38
38
  const o = w(s.current, l), e = h(s.current, l);
@@ -59,5 +59,5 @@ function y(f) {
59
59
  ] });
60
60
  }
61
61
  export {
62
- y as T
62
+ j as T
63
63
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronocode/react-box",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "main": "./box.js",
5
5
  "module": "./box.js",
6
6
  "types": "./box.d.ts",
@@ -1,21 +0,0 @@
1
- import React, { RefAttributes } from 'react';
2
- import ClassNameUtils from '../utils/className/classNameUtils';
3
- import { DoxStyleProps } from './dox/doxStyles';
4
- import { StylesContext } from './dox/stylesContext';
5
- type ExtractElementType<T> = T extends React.DetailedHTMLProps<React.HTMLAttributes<infer E>, infer E> ? E : T extends React.SVGProps<infer E> ? E : never;
6
- type ExtractElementFromTag<T extends keyof React.JSX.IntrinsicElements> = ExtractElementType<React.JSX.IntrinsicElements[T]>;
7
- type AllProps<TTag extends keyof React.JSX.IntrinsicElements> = React.ComponentProps<TTag>;
8
- type TagPropsType<TTag extends keyof React.JSX.IntrinsicElements> = Omit<AllProps<TTag>, 'className' | 'style' | 'ref'>;
9
- interface Props<TTag extends keyof React.JSX.IntrinsicElements> extends DoxStyleProps {
10
- children?: React.ReactNode | ((props: {
11
- isHover: boolean;
12
- }) => React.ReactNode);
13
- tag?: TTag;
14
- props?: TagPropsType<TTag>;
15
- className?: ClassNameUtils.ClassNameType;
16
- style?: React.ComponentProps<TTag>['style'];
17
- }
18
- declare const _default: <TTag extends keyof React.JSX.IntrinsicElements = "div">(props: Props<TTag> & React.RefAttributes<ExtractElementType<React.JSX.IntrinsicElements[TTag]>>) => React.ReactNode;
19
- export default _default;
20
- declare const flushStyles: typeof StylesContext.flush;
21
- export { flushStyles };