@wrdagency/blockout 0.0.11 → 0.0.13
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/dist/{2NBKRL7C-raj2vrMY.js → 2NBKRL7C-C6mXReCE.js} +3 -3
- package/dist/{P7GR5CS5-PkUYC6hd.js → P7GR5CS5-DNbthaqU.js} +11 -11
- package/dist/{T7VMP3TM-BeJUiw28.js → T7VMP3TM-B3jxXFmj.js} +2 -2
- package/dist/{UQQRIHDV-xtNCxi0H.js → UQQRIHDV-CFdrMoqW.js} +1 -1
- package/dist/{VIIRIBF3-B3f0V2Nc.js → VIIRIBF3-B585VK9r.js} +1 -1
- package/dist/assets/form.css +1 -0
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -0
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index4.css +1 -1
- package/dist/assets/index5.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index7.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/components/breadcrumbs/index.d.ts +7 -0
- package/dist/components/breadcrumbs/index.js +29 -0
- package/dist/components/breadcrumbs/types.d.ts +4 -0
- package/dist/components/button/index.js +1 -1
- package/dist/components/controls/base-control/index.js +1 -1
- package/dist/components/controls/choice-control/index.d.ts +12 -3
- package/dist/components/controls/choice-control/index.js +32 -22
- package/dist/components/controls/number-control/index.d.ts +1 -0
- package/dist/components/controls/number-control/index.js +33 -25
- package/dist/components/controls/select-control/index.d.ts +2 -0
- package/dist/components/controls/select-control/index.js +337 -334
- package/dist/components/controls/text-control/index.d.ts +1 -0
- package/dist/components/controls/text-control/index.js +15 -8
- package/dist/components/controls/textarea-control/index.d.ts +1 -0
- package/dist/components/controls/textarea-control/index.js +17 -9
- package/dist/components/controls/toggle-control/index.d.ts +3 -1
- package/dist/components/controls/toggle-control/index.js +35 -23
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/form/components/description.d.ts +2 -0
- package/dist/components/form/components/description.js +15 -0
- package/dist/components/form/components/form.d.ts +9 -0
- package/dist/components/form/components/form.js +41 -0
- package/dist/components/form/components/index.js +18 -0
- package/dist/components/form/components/pagination.d.ts +6 -0
- package/dist/components/form/components/pagination.js +46 -0
- package/dist/components/form/components/progress.d.ts +5 -0
- package/dist/components/form/components/progress.js +22 -0
- package/dist/components/form/components/row.d.ts +6 -0
- package/dist/components/form/components/row.js +22 -0
- package/dist/components/form/components/step.d.ts +6 -0
- package/dist/components/form/components/step.js +24 -0
- package/dist/components/form/components/title.d.ts +2 -0
- package/dist/components/form/components/title.js +15 -0
- package/dist/components/form/index.d.ts +9 -0
- package/dist/components/form/index.js +6 -0
- package/dist/components/form/types/fields.d.ts +21 -0
- package/dist/components/form/types/fields.js +11 -0
- package/dist/components/form/types/form.d.ts +28 -0
- package/dist/components/form/types/form.js +7 -0
- package/dist/components/form/types/steps.d.ts +5 -0
- package/dist/components/form/types/steps.js +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +29 -23
- package/dist/components/markdown/formats.d.ts +11 -0
- package/dist/components/markdown/formats.js +318 -0
- package/dist/components/markdown/index.js +1 -0
- package/dist/components/markdown/types/format.d.ts +27 -0
- package/dist/components/markdown/types/format.js +4 -0
- package/dist/components/menu/index.js +11 -11
- package/dist/components/menu/item.js +1 -1
- package/dist/components/menu/items/action.js +1 -1
- package/dist/components/menu/items/spacer.js +10 -10
- package/dist/components/menu/items/submenu.js +2 -2
- package/dist/components/menu/items/toggle.js +1 -1
- package/dist/components/progress/index.js +13 -11
- package/dist/index.js +33 -27
- package/dist/{item-Bcbx6pI-.js → item-C0kyELlf.js} +36 -36
- package/package.json +3 -2
- /package/dist/components/{controls/ranked-choice-control/index.js → breadcrumbs/types.js} +0 -0
- /package/dist/components/{controls/ranked-choice-control → markdown}/index.d.ts +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
import { ControlFC } from '../base-control/props';
|
|
3
3
|
interface TextControlProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
+
onChangeValue?: (value: string) => void;
|
|
4
5
|
}
|
|
5
6
|
export declare const TextControl: ControlFC<TextControlProps>;
|
|
6
7
|
export {};
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { noop as r } from "../../../utils/noop.js";
|
|
3
|
+
import { BaseControl as c } from "../base-control/index.js";
|
|
4
|
+
import { useBaseControlProps as m } from "../base-control/props.js";
|
|
5
|
+
const f = (t) => {
|
|
6
|
+
const { baseProps: e, controlProps: s } = m(t, {
|
|
6
7
|
className: "component-text-control"
|
|
7
|
-
})
|
|
8
|
-
|
|
8
|
+
}), {
|
|
9
|
+
onChangeValue: a = r,
|
|
10
|
+
onChange: l = r,
|
|
11
|
+
...p
|
|
12
|
+
} = s;
|
|
13
|
+
return /* @__PURE__ */ n(c, { ...e, children: /* @__PURE__ */ n("input", { onChange: (o) => {
|
|
14
|
+
a(o.currentTarget.value), l(o);
|
|
15
|
+
}, ...p }) });
|
|
9
16
|
};
|
|
10
17
|
export {
|
|
11
|
-
|
|
18
|
+
f as TextControl
|
|
12
19
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TextareaHTMLAttributes } from 'react';
|
|
2
2
|
import { ControlFC } from '../base-control/props';
|
|
3
3
|
interface TextareaControlProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
4
|
+
onChangeValue?: (value: string) => void;
|
|
4
5
|
}
|
|
5
6
|
export declare const TextareaControl: ControlFC<TextareaControlProps>;
|
|
6
7
|
export {};
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { noop as e } from "../../../utils/noop.js";
|
|
3
|
+
import { BaseControl as p } from "../base-control/index.js";
|
|
4
|
+
import { useBaseControlProps as m } from "../base-control/props.js";
|
|
5
|
+
import '../../../assets/index6.css';const x = (n) => {
|
|
6
|
+
const { baseProps: t, controlProps: a } = m(n, {
|
|
6
7
|
className: "component-textarea-control"
|
|
7
|
-
})
|
|
8
|
-
|
|
8
|
+
}), {
|
|
9
|
+
onChangeValue: s = e,
|
|
10
|
+
onChange: l = e,
|
|
11
|
+
...c
|
|
12
|
+
} = a;
|
|
13
|
+
return /* @__PURE__ */ r(p, { ...t, children: /* @__PURE__ */ r(
|
|
9
14
|
"textarea",
|
|
10
15
|
{
|
|
11
16
|
className: "component-textarea-control__input",
|
|
12
|
-
|
|
17
|
+
onChange: (o) => {
|
|
18
|
+
s(o.currentTarget.value), l(o);
|
|
19
|
+
},
|
|
20
|
+
...c
|
|
13
21
|
}
|
|
14
22
|
) });
|
|
15
23
|
};
|
|
16
24
|
export {
|
|
17
|
-
|
|
25
|
+
x as TextareaControl
|
|
18
26
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
import { ControlFC } from '../base-control/props';
|
|
3
|
-
interface ToggleControlProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
3
|
+
interface ToggleControlProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "checked"> {
|
|
4
|
+
value?: boolean;
|
|
5
|
+
onChangeValue?: (value: boolean) => void;
|
|
4
6
|
onLabel?: string;
|
|
5
7
|
offLabel?: string;
|
|
6
8
|
}
|
|
@@ -1,49 +1,61 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as e, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { noop as l } from "../../../utils/noop.js";
|
|
3
|
+
import { useRef as d } from "react";
|
|
4
|
+
import '../../../assets/style.css';import '../../../assets/index7.css';/* empty css */
|
|
5
|
+
import { VisuallyHidden as g } from "../../../primitives/visually-hidden/index.js";
|
|
6
|
+
import { BaseControl as b } from "../base-control/index.js";
|
|
7
|
+
import { useBaseControlProps as C } from "../base-control/props.js";
|
|
8
|
+
const L = (c) => {
|
|
9
|
+
const { baseProps: s, controlProps: a } = C(c, {
|
|
9
10
|
className: "component-toggle-control"
|
|
10
|
-
}), {
|
|
11
|
-
|
|
11
|
+
}), {
|
|
12
|
+
onLabel: i = "On",
|
|
13
|
+
offLabel: f = "Off",
|
|
14
|
+
value: p = !1,
|
|
15
|
+
onChange: m = l,
|
|
16
|
+
onChangeValue: r = l,
|
|
17
|
+
...u
|
|
18
|
+
} = a, n = d(null), t = (o) => {
|
|
19
|
+
n.current && (n.current.checked = o, n.current.focus(), r(o));
|
|
12
20
|
};
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ e(b, { ...s, children: /* @__PURE__ */ h("div", { className: "component-toggle-control__buttons", children: [
|
|
22
|
+
/* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(
|
|
15
23
|
"input",
|
|
16
24
|
{
|
|
17
25
|
type: "checkbox",
|
|
18
|
-
onKeyDown: (
|
|
19
|
-
|
|
26
|
+
onKeyDown: (o) => {
|
|
27
|
+
o.key === "ArrowLeft" ? t(!1) : o.key === "ArrowRight" && t(!0);
|
|
20
28
|
},
|
|
21
|
-
ref:
|
|
22
|
-
|
|
29
|
+
ref: n,
|
|
30
|
+
checked: p,
|
|
31
|
+
onChange: (o) => {
|
|
32
|
+
r(o.currentTarget.checked), m(o);
|
|
33
|
+
},
|
|
34
|
+
...u
|
|
23
35
|
}
|
|
24
36
|
) }),
|
|
25
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ e(
|
|
26
38
|
"button",
|
|
27
39
|
{
|
|
28
40
|
type: "button",
|
|
29
41
|
className: "component-toggle-control__off",
|
|
30
|
-
onClick: () =>
|
|
42
|
+
onClick: () => t(!1),
|
|
31
43
|
tabIndex: -1,
|
|
32
|
-
children:
|
|
44
|
+
children: f
|
|
33
45
|
}
|
|
34
46
|
),
|
|
35
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ e(
|
|
36
48
|
"button",
|
|
37
49
|
{
|
|
38
50
|
type: "button",
|
|
39
51
|
className: "component-toggle-control__on",
|
|
40
|
-
onClick: () =>
|
|
52
|
+
onClick: () => t(!0),
|
|
41
53
|
tabIndex: -1,
|
|
42
|
-
children:
|
|
54
|
+
children: i
|
|
43
55
|
}
|
|
44
56
|
)
|
|
45
57
|
] }) });
|
|
46
58
|
};
|
|
47
59
|
export {
|
|
48
|
-
|
|
60
|
+
L as ToggleControl
|
|
49
61
|
};
|
|
@@ -3,7 +3,7 @@ import { cn as c } from "../../utils/css.js";
|
|
|
3
3
|
import { createDataTable as m, dataTableContext as p } from "./context.js";
|
|
4
4
|
import { Footer as b } from "./footer.js";
|
|
5
5
|
import { Th as _ } from "./header.js";
|
|
6
|
-
import '../../assets/
|
|
6
|
+
import '../../assets/index9.css';const h = [
|
|
7
7
|
{
|
|
8
8
|
id: "123213213",
|
|
9
9
|
title: "Complete my Tasks",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { cn as s } from "../../../utils/css.js";
|
|
3
|
+
import { useForm as n } from "../types/form.js";
|
|
4
|
+
const f = ({
|
|
5
|
+
className: r,
|
|
6
|
+
children: t,
|
|
7
|
+
...e
|
|
8
|
+
}) => {
|
|
9
|
+
var o;
|
|
10
|
+
const { step: i } = n();
|
|
11
|
+
return /* @__PURE__ */ m("p", { className: s("component-form-description", r), ...e, children: ((o = i.details) == null ? void 0 : o.description) || t });
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
f as FormDescription
|
|
15
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { FieldsShape } from '../types/fields';
|
|
3
|
+
import { FormContext, Form } from '../types/form';
|
|
4
|
+
interface FormProps<TShape extends FieldsShape> extends Omit<FormHTMLAttributes<HTMLFormElement>, "children"> {
|
|
5
|
+
definition: Form<TShape>;
|
|
6
|
+
children: (args: FormContext<TShape>) => ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function Form<TShape extends FieldsShape>({ className, definition, children, ...formProps }: FormProps<TShape>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { cn as d } from "../../../utils/css.js";
|
|
3
|
+
import { useMemo as f, useState as x, useCallback as g } from "react";
|
|
4
|
+
import { getDefaultValues as b } from "../types/fields.js";
|
|
5
|
+
import { FormContext as k } from "../types/form.js";
|
|
6
|
+
import '../../../assets/form.css';function N({
|
|
7
|
+
className: V,
|
|
8
|
+
definition: t,
|
|
9
|
+
children: v,
|
|
10
|
+
...h
|
|
11
|
+
}) {
|
|
12
|
+
const r = f(() => t.steps.length, [t.steps]), o = f(
|
|
13
|
+
() => b(t.fields),
|
|
14
|
+
[t.fields]
|
|
15
|
+
), [l, a] = x(1), [u, c] = x(o), m = g(
|
|
16
|
+
(e, s) => c((C) => ({ ...C, [e]: s })),
|
|
17
|
+
[c]
|
|
18
|
+
), n = {
|
|
19
|
+
step: {
|
|
20
|
+
all: t.steps,
|
|
21
|
+
current: l,
|
|
22
|
+
max: r,
|
|
23
|
+
details: t.steps[l - 1],
|
|
24
|
+
next: () => a((e) => e === r ? e : e + 1),
|
|
25
|
+
back: () => a((e) => e === 1 ? 1 : e - 1)
|
|
26
|
+
},
|
|
27
|
+
values: {
|
|
28
|
+
default: o,
|
|
29
|
+
current: u,
|
|
30
|
+
set: m
|
|
31
|
+
},
|
|
32
|
+
control: (e) => ({
|
|
33
|
+
value: u[e],
|
|
34
|
+
onChangeValue: (s) => m(e, s)
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ p(k.Provider, { value: n, children: /* @__PURE__ */ p("form", { className: d("component-form", V), ...h, children: v(n) }) });
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
N as Form
|
|
41
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormDescription as o } from "./description.js";
|
|
2
|
+
import { FormPagination as r } from "./pagination.js";
|
|
3
|
+
import { FormProgress as m } from "./progress.js";
|
|
4
|
+
import { FormStep as i } from "./step.js";
|
|
5
|
+
import { FormTitle as t } from "./title.js";
|
|
6
|
+
import { Form as p } from "./form.js";
|
|
7
|
+
import { FormRow as e } from "./row.js";
|
|
8
|
+
const P = Object.assign(p, {
|
|
9
|
+
Title: t,
|
|
10
|
+
Description: o,
|
|
11
|
+
Pagination: r,
|
|
12
|
+
Progress: m,
|
|
13
|
+
Step: i,
|
|
14
|
+
Row: e
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
P as Form
|
|
18
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsxs as m, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Button as i } from "../../button/index.js";
|
|
3
|
+
import { cn as l } from "../../../utils/css.js";
|
|
4
|
+
import { useForm as u } from "../types/form.js";
|
|
5
|
+
const f = ({
|
|
6
|
+
className: o,
|
|
7
|
+
submitText: c = "Submit",
|
|
8
|
+
...a
|
|
9
|
+
}) => {
|
|
10
|
+
const { step: t } = u(), r = t.all[t.current - 2], e = t.all[t.current];
|
|
11
|
+
return /* @__PURE__ */ m("nav", { className: l("component-form-pagination", o), ...a, children: [
|
|
12
|
+
/* @__PURE__ */ n(
|
|
13
|
+
i,
|
|
14
|
+
{
|
|
15
|
+
wide: !0,
|
|
16
|
+
variant: "light",
|
|
17
|
+
disabled: t.current === 1,
|
|
18
|
+
onClick: t.back,
|
|
19
|
+
children: `Back${r != null && r.title ? `: ${r.title}` : ""}`
|
|
20
|
+
},
|
|
21
|
+
t.current + "back"
|
|
22
|
+
),
|
|
23
|
+
t.current === t.max ? /* @__PURE__ */ n(
|
|
24
|
+
i,
|
|
25
|
+
{
|
|
26
|
+
wide: !0,
|
|
27
|
+
variant: "primary",
|
|
28
|
+
type: "submit",
|
|
29
|
+
children: c
|
|
30
|
+
},
|
|
31
|
+
t.current + "next"
|
|
32
|
+
) : /* @__PURE__ */ n(
|
|
33
|
+
i,
|
|
34
|
+
{
|
|
35
|
+
wide: !0,
|
|
36
|
+
variant: "primary",
|
|
37
|
+
onClick: t.next,
|
|
38
|
+
children: `Next${e != null && e.title ? `: ${e.title}` : ""}`
|
|
39
|
+
},
|
|
40
|
+
t.current + "next"
|
|
41
|
+
)
|
|
42
|
+
] });
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
f as FormPagination
|
|
46
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Progress as e } from "../../progress/index.js";
|
|
3
|
+
import { cn as t } from "../../../utils/css.js";
|
|
4
|
+
import { useForm as p } from "../types/form.js";
|
|
5
|
+
const i = ({
|
|
6
|
+
className: o,
|
|
7
|
+
...m
|
|
8
|
+
}) => {
|
|
9
|
+
const { step: r } = p();
|
|
10
|
+
return /* @__PURE__ */ s(
|
|
11
|
+
e,
|
|
12
|
+
{
|
|
13
|
+
...m,
|
|
14
|
+
className: t("component-form-progress", o),
|
|
15
|
+
value: r.current / r.max,
|
|
16
|
+
steps: r.max
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
i as FormProgress
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { cn as c } from "../../../utils/css.js";
|
|
3
|
+
const s = ({
|
|
4
|
+
columns: o = 2,
|
|
5
|
+
className: r,
|
|
6
|
+
children: m,
|
|
7
|
+
...n
|
|
8
|
+
}) => /* @__PURE__ */ t(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
className: c(
|
|
12
|
+
"component-form-row",
|
|
13
|
+
`component-form-row--${o}-cols`,
|
|
14
|
+
r
|
|
15
|
+
),
|
|
16
|
+
...n,
|
|
17
|
+
children: m
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
export {
|
|
21
|
+
s as FormRow
|
|
22
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { cn as p } from "../../../utils/css.js";
|
|
3
|
+
import { useForm as s } from "../types/form.js";
|
|
4
|
+
const u = ({
|
|
5
|
+
className: t,
|
|
6
|
+
index: r,
|
|
7
|
+
children: e,
|
|
8
|
+
...m
|
|
9
|
+
}) => {
|
|
10
|
+
const { step: o } = s();
|
|
11
|
+
return /* @__PURE__ */ n(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: p("component-form-step", t),
|
|
15
|
+
hidden: o.current !== r,
|
|
16
|
+
inert: o.current !== r,
|
|
17
|
+
...m,
|
|
18
|
+
children: e
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
u as FormStep
|
|
24
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { cn as s } from "../../../utils/css.js";
|
|
3
|
+
import { useForm as n } from "../types/form.js";
|
|
4
|
+
const f = ({
|
|
5
|
+
className: o,
|
|
6
|
+
children: r,
|
|
7
|
+
...e
|
|
8
|
+
}) => {
|
|
9
|
+
var t;
|
|
10
|
+
const { step: m } = n();
|
|
11
|
+
return /* @__PURE__ */ i("h1", { className: s("component-form-title", o), ...e, children: ((t = m.details) == null ? void 0 : t.title) || r });
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
f as FormTitle
|
|
15
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export type PrimitiveValue = string | number | boolean;
|
|
3
|
+
export type Value = PrimitiveValue | PrimitiveValue[] | Record<string, PrimitiveValue>;
|
|
4
|
+
export type FieldsShape = Record<string, Value>;
|
|
5
|
+
export type Field<TSchema extends z.ZodTypeAny, TFields extends Fields<any>> = {
|
|
6
|
+
validation: TSchema;
|
|
7
|
+
default: z.infer<TSchema>;
|
|
8
|
+
calculate?: (values: FieldValues<TFields>) => z.infer<TSchema>;
|
|
9
|
+
condition?: (values: FieldValues<TFields>, fields: TFields) => boolean;
|
|
10
|
+
};
|
|
11
|
+
export type Fields<TShape extends FieldsShape> = {
|
|
12
|
+
[Key in keyof TShape]: Field<z.ZodType<TShape[Key]>, Fields<TShape>>;
|
|
13
|
+
};
|
|
14
|
+
export type FieldValues<TFields extends Fields<any>> = {
|
|
15
|
+
[Key in keyof TFields]: z.infer<TFields[Key]["validation"]>;
|
|
16
|
+
};
|
|
17
|
+
export type Values<TShape extends FieldsShape> = {
|
|
18
|
+
[Key in keyof TShape]: TShape[Key];
|
|
19
|
+
};
|
|
20
|
+
export declare const createFields: <TShape extends FieldsShape>(shape: Fields<TShape>) => Fields<TShape>;
|
|
21
|
+
export declare const getDefaultValues: <TShape extends FieldsShape>(fields: Fields<TShape>) => Values<TShape>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Fields, FieldsShape, Values } from './fields';
|
|
2
|
+
import { Step, Steps } from './steps';
|
|
3
|
+
export type Form<TShape extends FieldsShape> = {
|
|
4
|
+
fields: Fields<TShape>;
|
|
5
|
+
steps: Steps;
|
|
6
|
+
};
|
|
7
|
+
export type FormContext<TShape extends FieldsShape, TKeys extends keyof TShape = keyof TShape, TValues extends Values<TShape> = Values<TShape>> = {
|
|
8
|
+
step: {
|
|
9
|
+
all: Steps;
|
|
10
|
+
current: number;
|
|
11
|
+
max: number;
|
|
12
|
+
details?: Step;
|
|
13
|
+
next: () => void;
|
|
14
|
+
back: () => void;
|
|
15
|
+
};
|
|
16
|
+
values: {
|
|
17
|
+
default: TValues;
|
|
18
|
+
current: TValues;
|
|
19
|
+
set: <TKey extends TKeys = TKeys>(key: TKey, value: TValues[TKey]) => void;
|
|
20
|
+
};
|
|
21
|
+
control: <TKey extends TKeys = TKeys, TValue extends TValues[TKey] = TValues[TKey]>(name: TKey) => {
|
|
22
|
+
value: TValue;
|
|
23
|
+
onChangeValue: (value: TValue) => void;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const FormContext: import('react').Context<FormContext<any, string | number | symbol, Values<any>>>;
|
|
27
|
+
export declare const useForm: <TShape extends FieldsShape>() => FormContext<TShape, keyof TShape, Values<TShape>>;
|
|
28
|
+
export declare const createForm: <TShape extends FieldsShape>(definition: Form<TShape>) => Form<TShape>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
export { Breadcrumbs } from './breadcrumbs';
|
|
1
2
|
export { Button } from './button';
|
|
2
3
|
export { BaseControl, ChoiceControl, NumberControl, SelectControl, TextareaControl, TextControl, ToggleControl, } from './controls';
|
|
3
4
|
export { DataTable, ExampleDataTable } from './data-table';
|
|
5
|
+
export { createForm, Form } from './form';
|
|
4
6
|
export { Menu } from './menu';
|
|
5
7
|
export { Progress } from './progress';
|
package/dist/components/index.js
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import { Breadcrumbs as e } from "./breadcrumbs/index.js";
|
|
2
|
+
import { Button as m } from "./button/index.js";
|
|
3
|
+
import { BaseControl as p } from "./controls/base-control/index.js";
|
|
4
|
+
import { ChoiceControl as a } from "./controls/choice-control/index.js";
|
|
5
|
+
import { NumberControl as n } from "./controls/number-control/index.js";
|
|
6
|
+
import { SelectControl as T } from "./controls/select-control/index.js";
|
|
7
|
+
import { TextControl as c } from "./controls/text-control/index.js";
|
|
8
|
+
import { TextareaControl as u } from "./controls/textarea-control/index.js";
|
|
9
|
+
import { ToggleControl as B } from "./controls/toggle-control/index.js";
|
|
10
|
+
import { DataTable as F, ExampleDataTable as d } from "./data-table/index.js";
|
|
11
|
+
import { Form as i } from "./form/components/index.js";
|
|
12
|
+
import { createForm as M } from "./form/types/form.js";
|
|
13
|
+
import { Menu as P } from "./menu/index.js";
|
|
14
|
+
import { Progress as j } from "./progress/index.js";
|
|
12
15
|
export {
|
|
13
|
-
|
|
14
|
-
e as
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
n as
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
p as BaseControl,
|
|
17
|
+
e as Breadcrumbs,
|
|
18
|
+
m as Button,
|
|
19
|
+
a as ChoiceControl,
|
|
20
|
+
F as DataTable,
|
|
21
|
+
d as ExampleDataTable,
|
|
22
|
+
i as Form,
|
|
23
|
+
P as Menu,
|
|
24
|
+
n as NumberControl,
|
|
25
|
+
j as Progress,
|
|
26
|
+
T as SelectControl,
|
|
27
|
+
c as TextControl,
|
|
28
|
+
u as TextareaControl,
|
|
29
|
+
B as ToggleControl,
|
|
30
|
+
M as createForm
|
|
25
31
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const bold: import('./types/format').Format;
|
|
2
|
+
declare const italic: import('./types/format').Format;
|
|
3
|
+
declare const strikethrough: import('./types/format').Format;
|
|
4
|
+
declare const anchor: import('./types/format').Format;
|
|
5
|
+
declare const heading: import('./types/format').Format;
|
|
6
|
+
declare const orderedList: import('./types/format').Format;
|
|
7
|
+
declare const unorderedList: import('./types/format').Format;
|
|
8
|
+
declare const task: import('./types/format').Format;
|
|
9
|
+
declare const callout: import('./types/format').Format;
|
|
10
|
+
declare const topic: import('./types/format').Format;
|
|
11
|
+
export { anchor, bold, callout, heading, italic, orderedList, strikethrough, task, topic, unorderedList, };
|