@cronocode/react-box 2.0.6 → 3.0.0-alpha.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.cjs +1 -1
- package/box.d.ts +13 -7
- package/box.mjs +15 -9
- package/components/baseSvg.d.ts +3 -4
- package/components/button.cjs +1 -1
- package/components/button.d.ts +0 -1
- package/components/button.mjs +1 -1
- package/components/checkbox.cjs +1 -1
- package/components/checkbox.d.ts +2 -5
- package/components/checkbox.mjs +10 -10
- package/components/dataGrid/dataGridContract.d.ts +19 -11
- package/components/dataGrid/useGridData.d.ts +7 -0
- package/components/dataGrid.cjs +1 -1
- package/components/dataGrid.d.ts +5 -3
- package/components/dataGrid.mjs +17 -28
- package/components/flex.d.ts +3 -5
- package/components/form.cjs +1 -1
- package/components/form.d.ts +0 -1
- package/components/form.mjs +1 -1
- package/components/grid.d.ts +3 -5
- package/components/label.d.ts +0 -1
- package/components/radioButton.cjs +1 -1
- package/components/radioButton.d.ts +1 -3
- package/components/radioButton.mjs +9 -9
- package/components/textarea.cjs +1 -1
- package/components/textarea.d.ts +1 -2
- package/components/textarea.mjs +8 -9
- package/components/textbox.cjs +1 -1
- package/components/textbox.d.ts +0 -2
- package/components/textbox.mjs +1 -1
- package/components/tooltip.cjs +1 -1
- package/components/tooltip.d.ts +1 -2
- package/components/tooltip.mjs +34 -40
- package/core/boxExtends.d.ts +6 -0
- package/core/boxStyles.d.ts +701 -1217
- package/core/boxStylesFormatters.d.ts +2 -2
- package/core/coreTypes.d.ts +31 -0
- package/core/theme.d.ts +13 -32
- package/core/useStyles.d.ts +12 -3
- package/core/useTheme.d.ts +7 -10
- package/core.cjs +4 -34
- package/core.mjs +1397 -1158
- package/package.json +20 -25
- package/ssg.d.ts +0 -1
- package/types.d.ts +26 -0
- package/utils/object/objectUtils.d.ts +2 -0
- package/components/dataGrid/useGrid.d.ts +0 -3
- package/core/stylesContext.d.ts +0 -13
- package/core/theme.cjs +0 -1
- package/core/theme.mjs +0 -4
- package/core/types.d.ts +0 -60
- package/utils.cjs +0 -1
- package/utils.mjs +0 -63
package/box.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("react"),
|
|
1
|
+
"use strict";const s=require("react"),a=require("./core.cjs");function g(n,l){const{tag:d="div",children:c,props:p,className:x,style:m,disabled:t,required:r,checked:o}=n,v=a.useStyles(n,d==="svg"),i=s.useMemo(()=>{const h=a.classNames(v,x).join(" "),e={...p,className:h};return t&&(e.disabled=Array.isArray(t)?t[0]:t),r&&(e.required=Array.isArray(r)?r[0]:r),o&&(e.checked=Array.isArray(o)?o[0]:o),m&&(e.style=m),l&&(e.ref=l),e},[n]),[A,y]=s.useState(!1),f=typeof c=="function";return f&&(i.onMouseEnter=()=>y(!0),i.onMouseLeave=()=>y(!1)),s.createElement(d,i,f?c({isHover:A}):c)}const u=s.memo(s.forwardRef(g));u.extend=a.BoxExtends.extend;u.themeSetup=a.Theme.setup;module.exports=u;
|
package/box.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { default as React, RefAttributes } from 'react';
|
|
1
2
|
import { ClassNameType } from './core/classNames';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { ExtractElementFromTag } from './core/coreTypes';
|
|
4
|
+
import { BoxStyleProps } from './types';
|
|
5
|
+
import { default as BoxExtends } from './core/boxExtends';
|
|
6
|
+
import { default as Theme } from './core/theme';
|
|
5
7
|
type AllProps<TTag extends keyof React.JSX.IntrinsicElements> = React.ComponentProps<TTag>;
|
|
6
|
-
type TagPropsType<TTag extends keyof React.JSX.IntrinsicElements> = Omit<AllProps<TTag>, 'className' | 'style' | 'ref' | 'disabled'>;
|
|
8
|
+
type TagPropsType<TTag extends keyof React.JSX.IntrinsicElements> = Omit<AllProps<TTag>, 'className' | 'style' | 'ref' | 'disabled' | 'required' | 'checked'>;
|
|
7
9
|
interface Props<TTag extends keyof React.JSX.IntrinsicElements> extends BoxStyleProps {
|
|
8
10
|
children?: React.ReactNode | ((props: {
|
|
9
11
|
isHover: boolean;
|
|
@@ -13,8 +15,12 @@ interface Props<TTag extends keyof React.JSX.IntrinsicElements> extends BoxStyle
|
|
|
13
15
|
className?: ClassNameType;
|
|
14
16
|
style?: React.ComponentProps<TTag>['style'];
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
interface BoxType {
|
|
19
|
+
<TTag extends keyof React.JSX.IntrinsicElements = 'div'>(props: Props<TTag> & RefAttributes<ExtractElementFromTag<TTag>>): React.ReactNode;
|
|
20
|
+
extend: typeof BoxExtends.extend;
|
|
21
|
+
themeSetup: typeof Theme.setup;
|
|
22
|
+
}
|
|
23
|
+
declare const Box: BoxType;
|
|
24
|
+
export default Box;
|
|
19
25
|
export type BoxProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = React.ComponentProps<typeof Box<TTag>>;
|
|
20
26
|
export type BoxTagProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = Required<BoxProps<TTag>>['props'];
|
package/box.mjs
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { u as
|
|
3
|
-
function
|
|
4
|
-
const { tag:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import A, { memo as h, forwardRef as g, useMemo as B, useState as N } from "react";
|
|
2
|
+
import { B as S, T as C, u as E, c as H } from "./core.mjs";
|
|
3
|
+
function M(a, c) {
|
|
4
|
+
const { tag: i = "div", children: o, props: f, className: y, style: l, disabled: s, required: t, checked: r } = a, p = E(a, i === "svg"), n = B(() => {
|
|
5
|
+
const v = H(p, y).join(" "), e = {
|
|
6
|
+
...f,
|
|
7
|
+
className: v
|
|
8
|
+
};
|
|
9
|
+
return s && (e.disabled = Array.isArray(s) ? s[0] : s), t && (e.required = Array.isArray(t) ? t[0] : t), r && (e.checked = Array.isArray(r) ? r[0] : r), l && (e.style = l), c && (e.ref = c), e;
|
|
10
|
+
}, [a]), [x, u] = N(!1), d = typeof o == "function";
|
|
11
|
+
return d && (n.onMouseEnter = () => u(!0), n.onMouseLeave = () => u(!1)), A.createElement(i, n, d ? o({ isHover: x }) : o);
|
|
8
12
|
}
|
|
9
|
-
const
|
|
13
|
+
const m = h(g(M));
|
|
14
|
+
m.extend = S.extend;
|
|
15
|
+
m.themeSetup = C.setup;
|
|
10
16
|
export {
|
|
11
|
-
|
|
17
|
+
m as default
|
|
12
18
|
};
|
package/components/baseSvg.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ClassNameType } from '../core/classNames';
|
|
2
|
-
import { BoxSvgStyles } from '../core/types';
|
|
3
1
|
import { BoxTagProps } from '../box';
|
|
4
|
-
|
|
2
|
+
import { BoxStyleProps } from '../types';
|
|
3
|
+
import { ClassNameType } from '../core/classNames';
|
|
5
4
|
type BoxSvgTagProps = Omit<BoxTagProps<'svg'>, 'viewBox' | 'width' | 'height'>;
|
|
6
|
-
interface Props extends Omit<
|
|
5
|
+
interface Props extends Omit<BoxStyleProps, 'width' | 'height'> {
|
|
7
6
|
children?: React.ReactNode | ((props: {
|
|
8
7
|
isHover: boolean;
|
|
9
8
|
}) => React.ReactNode);
|
package/components/button.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),r=require("react"),s=require("../box.cjs"),c=require("../core.cjs"),u=["type","onClick"];function i(t,o){const e=c.ObjectUtils.buildProps(t,u);return n.jsx(s,{ref:o,tag:"button",component:"button",...e})}const b=r.forwardRef(i);module.exports=b;
|
package/components/button.d.ts
CHANGED
package/components/button.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as p } from "react";
|
|
3
3
|
import s from "../box.mjs";
|
|
4
|
-
import { O as m } from "../
|
|
4
|
+
import { O as m } from "../core.mjs";
|
|
5
5
|
const e = ["type", "onClick"];
|
|
6
6
|
function f(o, t) {
|
|
7
7
|
const r = m.buildProps(o, e);
|
package/components/checkbox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const i=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs"),a=require("../core.cjs"),s=["name","onInput","onChange","autoFocus","readOnly","value","defaultChecked"];function d(t,c){const o=a.ObjectUtils.buildProps(t,s,{type:"checkbox"}),r=Array.isArray(t.indeterminate)?t.indeterminate[0]:t.indeterminate,e=n.useRef(null);return n.useImperativeHandle(c,()=>e.current),n.useEffect(()=>{e.current&&(e.current.indeterminate=!!r)},[e,r]),i.jsx(u,{tag:"input",ref:e,component:"checkbox",...o})}const f=n.forwardRef(d);module.exports=f;
|
package/components/checkbox.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BoxTagProps, BoxProps } from '../box';
|
|
2
|
-
|
|
3
|
-
declare const tagProps: readonly ["name", "onInput", "onChange", "autoFocus", "readOnly", "required", "value", "checked", "defaultChecked"];
|
|
2
|
+
declare const tagProps: readonly ["name", "onInput", "onChange", "autoFocus", "readOnly", "value", "defaultChecked"];
|
|
4
3
|
type TagPropsType = (typeof tagProps)[number];
|
|
5
4
|
type CheckboxProps = Omit<BoxProps<'input'>, 'tag' | 'props'>;
|
|
6
5
|
type CheckboxTagProps = Omit<BoxTagProps<'input'>, TagPropsType | 'type'>;
|
|
@@ -12,9 +11,7 @@ interface Props extends CheckboxProps {
|
|
|
12
11
|
value?: string | number;
|
|
13
12
|
autoFocus?: boolean;
|
|
14
13
|
readOnly?: boolean;
|
|
15
|
-
required?: boolean;
|
|
16
14
|
defaultChecked?: boolean;
|
|
17
|
-
indeterminate?: boolean;
|
|
18
15
|
}
|
|
19
|
-
declare const _default: import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<HTMLInputElement>>;
|
|
16
|
+
declare const _default: import('react').ForwardRefExoticComponent<Omit<Props, "ref"> & import('react').RefAttributes<HTMLInputElement>>;
|
|
20
17
|
export default _default;
|
package/components/checkbox.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import { O as
|
|
5
|
-
const d = ["name", "onInput", "onChange", "autoFocus", "readOnly", "
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
return
|
|
9
|
-
e.current && (e.current.indeterminate = !!
|
|
10
|
-
}, [e,
|
|
2
|
+
import { forwardRef as a, useRef as i, useImperativeHandle as u, useEffect as m } from "react";
|
|
3
|
+
import f from "../box.mjs";
|
|
4
|
+
import { O as s } from "../core.mjs";
|
|
5
|
+
const d = ["name", "onInput", "onChange", "autoFocus", "readOnly", "value", "defaultChecked"];
|
|
6
|
+
function l(t, r) {
|
|
7
|
+
const o = s.buildProps(t, d, { type: "checkbox" }), n = Array.isArray(t.indeterminate) ? t.indeterminate[0] : t.indeterminate, e = i(null);
|
|
8
|
+
return u(r, () => e.current), m(() => {
|
|
9
|
+
e.current && (e.current.indeterminate = !!n);
|
|
10
|
+
}, [e, n]), /* @__PURE__ */ c(f, { tag: "input", ref: e, component: "checkbox", ...o });
|
|
11
11
|
}
|
|
12
|
-
const k =
|
|
12
|
+
const k = a(l);
|
|
13
13
|
export {
|
|
14
14
|
k as default
|
|
15
15
|
};
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Key } from 'react';
|
|
2
|
+
type KeysMatching<T, V> = {
|
|
3
|
+
[K in keyof T]-?: T[K] extends V ? K : never;
|
|
4
|
+
}[keyof T];
|
|
5
|
+
export interface GridDef<TRow> {
|
|
6
|
+
rowKey?: KeysMatching<TRow, Key> | ((rowData: TRow) => Key);
|
|
7
|
+
columns: GridColumn<TRow>[];
|
|
8
|
+
}
|
|
9
|
+
export interface GridCell<TRow> {
|
|
10
|
+
key: keyof TRow;
|
|
4
11
|
value: React.ReactNode;
|
|
5
12
|
}
|
|
6
|
-
export interface GridColumn<
|
|
7
|
-
key: keyof
|
|
13
|
+
export interface GridColumn<TRow> {
|
|
14
|
+
key: keyof TRow;
|
|
8
15
|
}
|
|
9
|
-
export interface GridRow<
|
|
10
|
-
dataRow:
|
|
11
|
-
cells: GridCell<
|
|
16
|
+
export interface GridRow<TRow> {
|
|
17
|
+
dataRow: TRow;
|
|
18
|
+
cells: GridCell<TRow>[];
|
|
12
19
|
}
|
|
13
|
-
export interface
|
|
14
|
-
columns: GridColumn<
|
|
15
|
-
rows: GridRow<
|
|
20
|
+
export interface GridData<TRow> {
|
|
21
|
+
columns: GridColumn<TRow>[];
|
|
22
|
+
rows: GridRow<TRow>[];
|
|
16
23
|
}
|
|
24
|
+
export {};
|
package/components/dataGrid.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime");require("react");const i=require("../box.cjs"),c=require("./grid.cjs");function g(u){const{data:e,def:d}=u,{rowKey:t,columns:s}=d;return s.length===0?(console.error("Cannot render grid without column definitions"),null):n.jsx(i,{component:"dataGrid",children:n.jsxs(c,{b:1,borderRadius:1,children:[s.map((r,o)=>n.jsx(i,{style:{gridColumn:o+1},children:r.key.toString()},r.key.toString())),((e==null?void 0:e.length)??0)===0&&n.jsx(i,{children:"Empty table"}),((e==null?void 0:e.length)??0)>0&&n.jsx(n.Fragment,{children:e==null?void 0:e.map((r,o)=>{const m=t?typeof t=="function"?t(r):r[t]:o;return n.jsx(c,{style:{gridTemplateRows:"subgrid"},children:s.map((h,l)=>n.jsxs(i,{style:{gridColumn:l+1},children:["tes ",l]}))},m)})})]})})}module.exports=g;
|
package/components/dataGrid.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { GridDef } from './dataGrid/dataGridContract';
|
|
2
|
+
interface Props<TRow> {
|
|
3
|
+
data?: TRow[];
|
|
4
|
+
def: GridDef<TRow>;
|
|
3
5
|
}
|
|
4
|
-
export default function DataGrid<
|
|
6
|
+
export default function DataGrid<TRow extends {}>(props: Props<TRow>): import("react/jsx-runtime").JSX.Element | null;
|
|
5
7
|
export {};
|
package/components/dataGrid.mjs
CHANGED
|
@@ -1,32 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
})),
|
|
18
|
-
columns: s.map((r) => ({
|
|
19
|
-
key: r
|
|
20
|
-
}))
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function d(e) {
|
|
24
|
-
const { data: s } = e, r = c(s);
|
|
25
|
-
return /* @__PURE__ */ i(t, { display: "grid", b: 1, borderRadius: 1, children: r.columns.length === 0 ? /* @__PURE__ */ i(m, { children: "empty grid" }) : /* @__PURE__ */ u(m, { children: [
|
|
26
|
-
r.columns.map((n, o) => /* @__PURE__ */ i(t, { style: { gridColumn: o + 1 }, children: n.key.toString() }, n.key.toString())),
|
|
27
|
-
r.rows.map((n, o) => n.cells.map((l) => /* @__PURE__ */ i(t, { children: l.value }, l.key.toString() + o)))
|
|
1
|
+
import { jsx as n, jsxs as d, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import o from "../box.mjs";
|
|
4
|
+
import s from "./grid.mjs";
|
|
5
|
+
function x(c) {
|
|
6
|
+
const { data: r, def: u } = c, { rowKey: t, columns: i } = u;
|
|
7
|
+
return i.length === 0 ? (console.error("Cannot render grid without column definitions"), null) : /* @__PURE__ */ n(o, { component: "dataGrid", children: /* @__PURE__ */ d(s, { b: 1, borderRadius: 1, children: [
|
|
8
|
+
i.map((e, l) => /* @__PURE__ */ n(o, { style: { gridColumn: l + 1 }, children: e.key.toString() }, e.key.toString())),
|
|
9
|
+
((r == null ? void 0 : r.length) ?? 0) === 0 && /* @__PURE__ */ n(o, { children: "Empty table" }),
|
|
10
|
+
((r == null ? void 0 : r.length) ?? 0) > 0 && /* @__PURE__ */ n(g, { children: r == null ? void 0 : r.map((e, l) => {
|
|
11
|
+
const p = t ? typeof t == "function" ? t(e) : e[t] : l;
|
|
12
|
+
return /* @__PURE__ */ n(s, { style: { gridTemplateRows: "subgrid" }, children: i.map((h, m) => /* @__PURE__ */ d(o, { style: { gridColumn: m + 1 }, children: [
|
|
13
|
+
"tes ",
|
|
14
|
+
m
|
|
15
|
+
] })) }, p);
|
|
16
|
+
}) })
|
|
28
17
|
] }) });
|
|
29
18
|
}
|
|
30
19
|
export {
|
|
31
|
-
|
|
20
|
+
x as default
|
|
32
21
|
};
|
package/components/flex.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { default as Box } from '../box';
|
|
2
1
|
import { RefAttributes } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type ExtractElementFromTag<T extends keyof React.JSX.IntrinsicElements> = ExtractElementType<React.JSX.IntrinsicElements[T]>;
|
|
2
|
+
import { default as Box } from '../box';
|
|
3
|
+
import { ExtractElementFromTag } from '../core/coreTypes';
|
|
6
4
|
type BoxProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = Omit<React.ComponentProps<typeof Box<TTag>>, 'ref'>;
|
|
7
|
-
declare const _default: <TTag extends keyof
|
|
5
|
+
declare const _default: <TTag extends keyof React.JSX.IntrinsicElements = "div">(props: BoxProps<TTag> & RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
|
|
8
6
|
export default _default;
|
package/components/form.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const m=require("react/jsx-runtime"),o=require("react"),a=require("../box.cjs"),f=require("../
|
|
1
|
+
"use strict";const m=require("react/jsx-runtime"),o=require("react"),a=require("../box.cjs"),f=require("../core.cjs");function l(r){const{onSubmit:n,props:s}=r,t=o.useRef(null),u=o.useCallback(e=>{e.preventDefault();const i=f.FormUtils.getFormEntries(t.current);n(i,e)},[]),c={...s,onSubmit:u,ref:t};return m.jsx(a,{tag:"form",...r,props:c})}module.exports=l;
|
package/components/form.d.ts
CHANGED
package/components/form.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as u } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as a, useCallback as i } from "react";
|
|
3
3
|
import p from "../box.mjs";
|
|
4
|
-
import { F as c } from "../
|
|
4
|
+
import { F as c } from "../core.mjs";
|
|
5
5
|
function x(o) {
|
|
6
6
|
const { onSubmit: m, props: n } = o, r = a(null), e = i((t) => {
|
|
7
7
|
t.preventDefault();
|
package/components/grid.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { default as Box } from '../box';
|
|
2
1
|
import { RefAttributes } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type ExtractElementFromTag<T extends keyof React.JSX.IntrinsicElements> = ExtractElementType<React.JSX.IntrinsicElements[T]>;
|
|
2
|
+
import { default as Box } from '../box';
|
|
3
|
+
import { ExtractElementFromTag } from '../core/coreTypes';
|
|
6
4
|
type BoxProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = Omit<React.ComponentProps<typeof Box<TTag>>, 'ref'>;
|
|
7
|
-
declare const _default: <TTag extends keyof
|
|
5
|
+
declare const _default: <TTag extends keyof React.JSX.IntrinsicElements = "div">(props: BoxProps<TTag> & RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
|
|
8
6
|
export default _default;
|
package/components/label.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime"),r=require("react"),u=require("../box.cjs"),s=require("../
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),r=require("react"),u=require("../box.cjs"),s=require("../core.cjs"),c=["name","onInput","onChange","value","autoFocus","readOnly","defaultChecked"];function a(t,o){const e=s.ObjectUtils.buildProps(t,c,{type:"radio"});return n.jsx(u,{ref:o,tag:"input",component:"radioButton",...e})}const i=r.forwardRef(a);module.exports=i;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { default as Box } from '../box';
|
|
2
|
-
|
|
3
2
|
type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
|
|
4
3
|
type BoxTagProps = Required<BoxProps>['props'];
|
|
5
|
-
declare const tagProps: readonly ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "
|
|
4
|
+
declare const tagProps: readonly ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "defaultChecked"];
|
|
6
5
|
type TagPropsType = (typeof tagProps)[number];
|
|
7
6
|
type RadioButtonTagProps = Omit<BoxTagProps, TagPropsType | 'type'>;
|
|
8
7
|
interface Props extends Omit<BoxProps, 'props'> {
|
|
@@ -13,7 +12,6 @@ interface Props extends Omit<BoxProps, 'props'> {
|
|
|
13
12
|
value?: string | number;
|
|
14
13
|
autoFocus?: boolean;
|
|
15
14
|
readOnly?: boolean;
|
|
16
|
-
required?: boolean;
|
|
17
15
|
defaultChecked?: boolean;
|
|
18
16
|
}
|
|
19
17
|
declare const _default: import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import { O as u } from "../
|
|
5
|
-
const i = ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "
|
|
6
|
-
function
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as a } from "react";
|
|
3
|
+
import e from "../box.mjs";
|
|
4
|
+
import { O as u } from "../core.mjs";
|
|
5
|
+
const i = ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "defaultChecked"];
|
|
6
|
+
function p(o, t) {
|
|
7
7
|
const r = u.buildProps(o, i, { type: "radio" });
|
|
8
|
-
return /* @__PURE__ */ e
|
|
8
|
+
return /* @__PURE__ */ n(e, { ref: t, tag: "input", component: "radioButton", ...r });
|
|
9
9
|
}
|
|
10
|
-
const
|
|
10
|
+
const c = a(p);
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
c as default
|
|
13
13
|
};
|
package/components/textarea.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),n=require("react"),a=require("../box.cjs"),s=require("../core.cjs"),c=["name","onInput","onChange","placeholder","value","defaultValue","rows","cols","autoFocus","maxLength","minLength","readOnly"];function u(e,t){const r=s.ObjectUtils.buildProps(e,c);return o.jsx(a,{ref:t,tag:"textarea",component:"textarea",...r})}const i=n.forwardRef(u);module.exports=i;
|
package/components/textarea.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { default as Box } from '../box';
|
|
2
|
-
|
|
3
2
|
type BoxProps = Omit<React.ComponentProps<typeof Box<'textarea'>>, 'ref' | 'tag'>;
|
|
4
3
|
type BoxTagProps = Required<BoxProps>['props'];
|
|
5
|
-
declare const tagProps: readonly ["name", "onInput", "onChange", "placeholder", "value", "defaultValue", "rows", "cols", "autoFocus", "maxLength", "minLength", "readOnly"
|
|
4
|
+
declare const tagProps: readonly ["name", "onInput", "onChange", "placeholder", "value", "defaultValue", "rows", "cols", "autoFocus", "maxLength", "minLength", "readOnly"];
|
|
6
5
|
type TagPropsType = (typeof tagProps)[number];
|
|
7
6
|
type TextareaTagProps = Omit<BoxTagProps, TagPropsType>;
|
|
8
7
|
interface Props extends Omit<BoxProps, 'props'> {
|
package/components/textarea.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as r } from "react";
|
|
3
3
|
import n from "../box.mjs";
|
|
4
|
-
import { O as s } from "../
|
|
4
|
+
import { O as s } from "../core.mjs";
|
|
5
5
|
const m = [
|
|
6
6
|
"name",
|
|
7
7
|
"onInput",
|
|
@@ -14,14 +14,13 @@ const m = [
|
|
|
14
14
|
"autoFocus",
|
|
15
15
|
"maxLength",
|
|
16
16
|
"minLength",
|
|
17
|
-
"readOnly"
|
|
18
|
-
"required"
|
|
17
|
+
"readOnly"
|
|
19
18
|
];
|
|
20
|
-
function p(t,
|
|
21
|
-
const
|
|
22
|
-
return /* @__PURE__ */
|
|
19
|
+
function p(t, o) {
|
|
20
|
+
const e = s.buildProps(t, m);
|
|
21
|
+
return /* @__PURE__ */ a(n, { ref: o, tag: "textarea", component: "textarea", ...e });
|
|
23
22
|
}
|
|
24
|
-
const i =
|
|
23
|
+
const i = r(p);
|
|
25
24
|
export {
|
|
26
25
|
i as default
|
|
27
26
|
};
|
package/components/textbox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),n=require("react"),s=require("../box.cjs"),u=require("../core.cjs"),c=["name","onInput","onChange","type","placeholder","defaultValue","autoFocus","readOnly","required","value","pattern"];function a(e,t){const o=u.ObjectUtils.buildProps(e,c);return r.jsx(s,{ref:t,tag:"input",component:"textbox",...o})}const i=n.forwardRef(a);module.exports=i;
|
package/components/textbox.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { default as Box } from '../box';
|
|
2
|
-
|
|
3
2
|
type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
|
|
4
3
|
type BoxTagProps = Required<BoxProps>['props'];
|
|
5
4
|
declare const tagProps: readonly ["name", "onInput", "onChange", "type", "placeholder", "defaultValue", "autoFocus", "readOnly", "required", "value", "pattern"];
|
|
@@ -18,7 +17,6 @@ interface Props extends Omit<BoxProps, 'props'> {
|
|
|
18
17
|
pattern?: string;
|
|
19
18
|
autoFocus?: boolean;
|
|
20
19
|
readOnly?: boolean;
|
|
21
|
-
required?: boolean;
|
|
22
20
|
step?: number | string;
|
|
23
21
|
}
|
|
24
22
|
declare const _default: import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<HTMLInputElement>>;
|
package/components/textbox.mjs
CHANGED
package/components/tooltip.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const i=require("react/jsx-runtime"),v=require("react-dom"),d=require("../box.cjs"),s=require("react"),x=require("../core.cjs"),l=2;function b(f){const{onPositionChange:u}=f,c=s.useRef(null),[t,p]=s.useState(),w=x.usePortalContainer(),h=s.useCallback((n,e)=>{const r=o=>{o.target.contains(n)&&e(n)};return document.addEventListener("scroll",r,{capture:!0}),()=>{document.removeEventListener("scroll",r,{capture:!0})}},[t]),m=s.useCallback((n,e)=>{const r=o=>{e(n)};return window.addEventListener("resize",r,{capture:!0}),()=>{window.removeEventListener("resize",r,{capture:!0})}},[t]),a=s.useCallback(n=>{const e=n.getBoundingClientRect(),r=Math.round((e.top+window.scrollY)*l)/l,o=Math.round((e.left+window.scrollX)*l)/l;((t==null?void 0:t.top)!==r||(t==null?void 0:t.left)!==o)&&(u==null||u({top:r,left:o}),p({top:r,left:o,width:e.width>0?e.width:void 0}))},[t]);return s.useLayoutEffect(()=>{if(c.current){a(c.current);const n=h(c.current,a),e=m(c.current,a);return()=>{n(),e()}}},[t]),i.jsxs(i.Fragment,{children:[i.jsx(d,{ref:c}),t&&v.createPortal(i.jsx(d,{position:"absolute",top:0,left:0,transition:"none",style:{transform:`translate(${t.left}px,${t.top}px)`,width:t.width},children:i.jsx(d,{position:"absolute",width:"fit",...f})}),w)]})}module.exports=b;
|
package/components/tooltip.d.ts
CHANGED
package/components/tooltip.mjs
CHANGED
|
@@ -1,63 +1,57 @@
|
|
|
1
|
-
import { jsxs as v, Fragment as
|
|
2
|
-
import { createPortal as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const l = 2;
|
|
13
|
-
function M(i) {
|
|
14
|
-
const { onPositionChange: r } = i, c = C(null), [t, p] = g(), m = y(), w = f(
|
|
15
|
-
(n, e) => {
|
|
16
|
-
const o = (s) => {
|
|
17
|
-
s.target.contains(n) && e(n);
|
|
1
|
+
import { jsxs as v, Fragment as x, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { createPortal as b } from "react-dom";
|
|
3
|
+
import u from "../box.mjs";
|
|
4
|
+
import { useRef as E, useState as L, useCallback as d, useLayoutEffect as g } from "react";
|
|
5
|
+
import { a as z } from "../core.mjs";
|
|
6
|
+
const i = 2;
|
|
7
|
+
function y(f) {
|
|
8
|
+
const { onPositionChange: c } = f, s = E(null), [t, p] = L(), m = z(), w = d(
|
|
9
|
+
(o, e) => {
|
|
10
|
+
const r = (n) => {
|
|
11
|
+
n.target.contains(o) && e(o);
|
|
18
12
|
};
|
|
19
|
-
return document.addEventListener("scroll",
|
|
20
|
-
document.removeEventListener("scroll",
|
|
13
|
+
return document.addEventListener("scroll", r, { capture: !0 }), () => {
|
|
14
|
+
document.removeEventListener("scroll", r, { capture: !0 });
|
|
21
15
|
};
|
|
22
16
|
},
|
|
23
17
|
[t]
|
|
24
|
-
), h =
|
|
25
|
-
(
|
|
26
|
-
const
|
|
27
|
-
e(
|
|
18
|
+
), h = d(
|
|
19
|
+
(o, e) => {
|
|
20
|
+
const r = (n) => {
|
|
21
|
+
e(o);
|
|
28
22
|
};
|
|
29
|
-
return window.addEventListener("resize",
|
|
30
|
-
window.removeEventListener("resize",
|
|
23
|
+
return window.addEventListener("resize", r, { capture: !0 }), () => {
|
|
24
|
+
window.removeEventListener("resize", r, { capture: !0 });
|
|
31
25
|
};
|
|
32
26
|
},
|
|
33
27
|
[t]
|
|
34
|
-
),
|
|
35
|
-
(
|
|
36
|
-
const e =
|
|
37
|
-
((t == null ? void 0 : t.top) !==
|
|
28
|
+
), l = d(
|
|
29
|
+
(o) => {
|
|
30
|
+
const e = o.getBoundingClientRect(), r = Math.round((e.top + window.scrollY) * i) / i, n = Math.round((e.left + window.scrollX) * i) / i;
|
|
31
|
+
((t == null ? void 0 : t.top) !== r || (t == null ? void 0 : t.left) !== n) && (c == null || c({ top: r, left: n }), p({ top: r, left: n, width: e.width > 0 ? e.width : void 0 }));
|
|
38
32
|
},
|
|
39
33
|
[t]
|
|
40
34
|
);
|
|
41
|
-
return
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
const
|
|
35
|
+
return g(() => {
|
|
36
|
+
if (s.current) {
|
|
37
|
+
l(s.current);
|
|
38
|
+
const o = w(s.current, l), e = h(s.current, l);
|
|
45
39
|
return () => {
|
|
46
|
-
|
|
40
|
+
o(), e();
|
|
47
41
|
};
|
|
48
42
|
}
|
|
49
|
-
}, [t]), /* @__PURE__ */ v(
|
|
50
|
-
/* @__PURE__ */ a(
|
|
51
|
-
t &&
|
|
43
|
+
}, [t]), /* @__PURE__ */ v(x, { children: [
|
|
44
|
+
/* @__PURE__ */ a(u, { ref: s }),
|
|
45
|
+
t && b(
|
|
52
46
|
/* @__PURE__ */ a(
|
|
53
|
-
|
|
47
|
+
u,
|
|
54
48
|
{
|
|
55
49
|
position: "absolute",
|
|
56
50
|
top: 0,
|
|
57
51
|
left: 0,
|
|
58
52
|
transition: "none",
|
|
59
53
|
style: { transform: `translate(${t.left}px,${t.top}px)`, width: t.width },
|
|
60
|
-
children: /* @__PURE__ */ a(
|
|
54
|
+
children: /* @__PURE__ */ a(u, { position: "absolute", width: "fit", ...f })
|
|
61
55
|
}
|
|
62
56
|
),
|
|
63
57
|
m
|
|
@@ -65,5 +59,5 @@ function M(i) {
|
|
|
65
59
|
] });
|
|
66
60
|
}
|
|
67
61
|
export {
|
|
68
|
-
|
|
62
|
+
y as default
|
|
69
63
|
};
|