@rockshin/tao-ui 0.0.42 → 0.0.44
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/README.md +8 -2
- package/component-manifest.json +37 -18
- package/dist/components/alert/alert.css +1 -0
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/calendar/calendar.css +10 -60
- package/dist/components/calendar/calendar.js +46 -43
- package/dist/components/card/card.css +1 -1
- package/dist/components/carousel/carousel.css +1 -0
- package/dist/components/carousel/carousel.js +62 -7
- package/dist/components/collapse/collapse-panels.d.ts +4 -0
- package/dist/components/collapse/collapse-panels.js +413 -0
- package/dist/components/collapse/collapse.css +199 -0
- package/dist/components/collapse/collapse.d.ts +77 -0
- package/dist/components/{collapsible/collapsible.js → collapse/collapse.js} +26 -10
- package/dist/components/color-picker/color-picker.css +8 -42
- package/dist/components/color-picker/color-picker.js +220 -145
- package/dist/components/date-picker/date-picker.css +18 -56
- package/dist/components/date-picker/date-picker.d.ts +2 -0
- package/dist/components/date-picker/date-picker.js +11 -6
- package/dist/components/date-picker/presets.js +5 -2
- package/dist/components/date-picker/range-picker.d.ts +2 -0
- package/dist/components/date-picker/range-picker.js +3 -1
- package/dist/components/form/field-control.d.ts +6 -0
- package/dist/components/form/field-control.js +42 -0
- package/dist/components/form/form-context.d.ts +3 -0
- package/dist/components/form/form-item.d.ts +2 -1
- package/dist/components/form/form-item.js +56 -42
- package/dist/components/form/form.css +15 -0
- package/dist/components/form/form.d.ts +5 -5
- package/dist/components/form/form.js +87 -68
- package/dist/components/form/index.d.ts +1 -0
- package/dist/components/form/use-form.d.ts +16 -0
- package/dist/components/form/use-form.js +69 -0
- package/dist/components/form-field/form-field-view.d.ts +6 -2
- package/dist/components/form-field/form-field-view.js +116 -84
- package/dist/components/input/base-input.d.ts +25 -0
- package/dist/components/input/base-input.js +104 -0
- package/dist/components/input/input-shared.css +75 -0
- package/dist/components/input/input-shared.d.ts +59 -0
- package/dist/components/input/input-shared.js +152 -0
- package/dist/components/input/input.css +99 -4
- package/dist/components/input/input.d.ts +12 -16
- package/dist/components/input/input.js +11 -154
- package/dist/components/input/otp.d.ts +29 -0
- package/dist/components/input/otp.js +335 -0
- package/dist/components/input/password.d.ts +12 -0
- package/dist/components/input/password.js +117 -0
- package/dist/components/input/search.d.ts +16 -0
- package/dist/components/input/search.js +99 -0
- package/dist/components/input-number/input-number.d.ts +2 -2
- package/dist/components/input-number/input-number.js +2 -2
- package/dist/components/list/list-pagination.css +5 -5
- package/dist/components/list/list-pagination.js +1 -0
- package/dist/components/mentions/mentions.css +7 -0
- package/dist/components/modal/modal.css +1 -0
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.js +78 -73
- package/dist/components/select/mobile-select.css +1 -16
- package/dist/components/select/mobile-select.d.ts +2 -1
- package/dist/components/select/mobile-select.js +68 -63
- package/dist/components/select/select-types.d.ts +2 -0
- package/dist/components/select/select.css +19 -0
- package/dist/components/select/select.js +31 -17
- package/dist/components/spinner/spinner.css +1 -1
- package/dist/components/steps/steps.css +53 -3
- package/dist/components/table/table.css +0 -5
- package/dist/components/table/table.js +21 -22
- package/dist/components/textarea/textarea.css +20 -0
- package/dist/components/textarea/textarea.d.ts +12 -6
- package/dist/components/textarea/textarea.js +120 -219
- package/dist/components/time-picker/time-picker.css +7 -0
- package/dist/components/tree/tree-check.d.ts +1 -0
- package/dist/components/tree/tree-check.js +36 -0
- package/dist/components/tree/tree.css +13 -18
- package/dist/components/tree/tree.js +2 -3
- package/dist/components/tree-select/select-engine.css +7 -0
- package/dist/components/tree-select/tree-select.js +2 -3
- package/dist/components/upload/upload.css +0 -11
- package/dist/components/upload/upload.js +13 -3
- package/dist/docs/component-docs.js +2 -2
- package/dist/docs/components/{collapsible.doc.d.ts → collapse.doc.d.ts} +1 -1
- package/dist/docs/components/collapse.doc.js +47 -0
- package/dist/docs/components/form.doc.js +3 -1
- package/dist/docs/components/input.doc.js +11 -4
- package/dist/docs/components/textarea.doc.js +4 -2
- package/dist/entries/collapse.d.ts +3 -0
- package/dist/entries/{collapsible.js → collapse.js} +1 -1
- package/dist/entries/form.d.ts +2 -2
- package/dist/entries/input.d.ts +1 -1
- package/dist/entries/textarea.d.ts +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/provider/locale.d.ts +6 -0
- package/dist/provider/locale.js +10 -0
- package/dist/provider/tao-provider.js +1 -0
- package/dist/theme/control.css +2 -2
- package/dist/theme/theme.css +3 -1
- package/dist/theme/tokens.d.ts +2 -2
- package/dist/theme/tokens.js +1 -0
- package/dist/utils/field-label.d.ts +4 -0
- package/dist/utils/field-label.js +7 -0
- package/llms.txt +19 -16
- package/package.json +10 -5
- package/dist/components/collapsible/collapsible.css +0 -49
- package/dist/components/collapsible/collapsible.d.ts +0 -39
- package/dist/docs/components/collapsible.doc.js +0 -39
- package/dist/entries/collapsible.d.ts +0 -3
|
@@ -1,120 +1,139 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import _rc_component_form, {
|
|
3
|
+
import _rc_component_form, { FormProvider, List, useWatch } from "@rc-component/form";
|
|
4
4
|
import { forwardRef, useContext } from "react";
|
|
5
5
|
import { TaoProvider } from "../../provider/tao-provider.js";
|
|
6
6
|
import { cx } from "../../utils/semantic.js";
|
|
7
7
|
import { FormLayoutContext } from "./form-context.js";
|
|
8
8
|
import { FormItem } from "./form-item.js";
|
|
9
|
+
import { getFieldRegistry, useForm } from "./use-form.js";
|
|
9
10
|
import "./form.css";
|
|
10
11
|
import { interopDefault } from "../../utils/interop-default.js";
|
|
11
12
|
const RcFormComponent = /*#__PURE__*/ interopDefault(_rc_component_form);
|
|
12
13
|
function FormInner(t0, ref) {
|
|
13
|
-
const $ = c(
|
|
14
|
+
const $ = c(37);
|
|
14
15
|
let children;
|
|
15
16
|
let className;
|
|
16
17
|
let classNames;
|
|
17
18
|
let disabled;
|
|
19
|
+
let form;
|
|
18
20
|
let rcProps;
|
|
19
21
|
let size;
|
|
20
22
|
let style;
|
|
21
23
|
let styles;
|
|
22
24
|
let t1;
|
|
23
25
|
if ($[0] !== t0) {
|
|
24
|
-
({ layout: t1, size, disabled, children, className, style, classNames, styles, ...rcProps } = t0);
|
|
26
|
+
({ layout: t1, size, disabled, children, className, style, classNames, styles, form, ...rcProps } = t0);
|
|
25
27
|
$[0] = t0;
|
|
26
28
|
$[1] = children;
|
|
27
29
|
$[2] = className;
|
|
28
30
|
$[3] = classNames;
|
|
29
31
|
$[4] = disabled;
|
|
30
|
-
$[5] =
|
|
31
|
-
$[6] =
|
|
32
|
-
$[7] =
|
|
33
|
-
$[8] =
|
|
34
|
-
$[9] =
|
|
32
|
+
$[5] = form;
|
|
33
|
+
$[6] = rcProps;
|
|
34
|
+
$[7] = size;
|
|
35
|
+
$[8] = style;
|
|
36
|
+
$[9] = styles;
|
|
37
|
+
$[10] = t1;
|
|
35
38
|
} else {
|
|
36
39
|
children = $[1];
|
|
37
40
|
className = $[2];
|
|
38
41
|
classNames = $[3];
|
|
39
42
|
disabled = $[4];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
form = $[5];
|
|
44
|
+
rcProps = $[6];
|
|
45
|
+
size = $[7];
|
|
46
|
+
style = $[8];
|
|
47
|
+
styles = $[9];
|
|
48
|
+
t1 = $[10];
|
|
45
49
|
}
|
|
46
50
|
const layout = void 0 === t1 ? "vertical" : t1;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
$[
|
|
53
|
-
$[
|
|
54
|
-
} else
|
|
55
|
-
const layoutValue = t2;
|
|
56
|
-
const t3 = classNames?.root;
|
|
51
|
+
const [instance] = useForm(form);
|
|
52
|
+
const t2 = instance;
|
|
53
|
+
let t3;
|
|
54
|
+
if ($[11] !== instance) {
|
|
55
|
+
t3 = getFieldRegistry(instance);
|
|
56
|
+
$[11] = instance;
|
|
57
|
+
$[12] = t3;
|
|
58
|
+
} else t3 = $[12];
|
|
57
59
|
let t4;
|
|
58
|
-
if ($[
|
|
59
|
-
t4 =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
if ($[13] !== layout || $[14] !== t2 || $[15] !== t3) {
|
|
61
|
+
t4 = {
|
|
62
|
+
layout,
|
|
63
|
+
form: t2,
|
|
64
|
+
fields: t3
|
|
65
|
+
};
|
|
66
|
+
$[13] = layout;
|
|
67
|
+
$[14] = t2;
|
|
68
|
+
$[15] = t3;
|
|
69
|
+
$[16] = t4;
|
|
70
|
+
} else t4 = $[16];
|
|
71
|
+
const layoutValue = t4;
|
|
72
|
+
const t5 = classNames?.root;
|
|
65
73
|
let t6;
|
|
66
|
-
if ($[
|
|
67
|
-
t6 =
|
|
68
|
-
|
|
74
|
+
if ($[17] !== className || $[18] !== t5) {
|
|
75
|
+
t6 = cx(t5, className);
|
|
76
|
+
$[17] = className;
|
|
77
|
+
$[18] = t5;
|
|
78
|
+
$[19] = t6;
|
|
79
|
+
} else t6 = $[19];
|
|
80
|
+
const t7 = styles?.root;
|
|
81
|
+
let t8;
|
|
82
|
+
if ($[20] !== style || $[21] !== t7) {
|
|
83
|
+
t8 = {
|
|
84
|
+
...t7,
|
|
69
85
|
...style
|
|
70
86
|
};
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
74
|
-
} else
|
|
75
|
-
let
|
|
76
|
-
if ($[
|
|
77
|
-
|
|
87
|
+
$[20] = style;
|
|
88
|
+
$[21] = t7;
|
|
89
|
+
$[22] = t8;
|
|
90
|
+
} else t8 = $[22];
|
|
91
|
+
let t9;
|
|
92
|
+
if ($[23] !== children || $[24] !== instance || $[25] !== rcProps || $[26] !== ref || $[27] !== t6 || $[28] !== t8) {
|
|
93
|
+
t9 = /*#__PURE__*/ jsx(RcFormComponent, {
|
|
94
|
+
"data-tao-form": "",
|
|
78
95
|
ref: ref,
|
|
79
|
-
className:
|
|
80
|
-
style:
|
|
96
|
+
className: t6,
|
|
97
|
+
style: t8,
|
|
81
98
|
...rcProps,
|
|
99
|
+
form: instance,
|
|
82
100
|
children: children
|
|
83
101
|
});
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
102
|
+
$[23] = children;
|
|
103
|
+
$[24] = instance;
|
|
104
|
+
$[25] = rcProps;
|
|
105
|
+
$[26] = ref;
|
|
106
|
+
$[27] = t6;
|
|
107
|
+
$[28] = t8;
|
|
108
|
+
$[29] = t9;
|
|
109
|
+
} else t9 = $[29];
|
|
110
|
+
let t10;
|
|
111
|
+
if ($[30] !== disabled || $[31] !== size || $[32] !== t9) {
|
|
112
|
+
t10 = /*#__PURE__*/ jsx(TaoProvider, {
|
|
94
113
|
size: size,
|
|
95
114
|
disabled: disabled,
|
|
96
|
-
children:
|
|
115
|
+
children: t9
|
|
97
116
|
});
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
} else
|
|
103
|
-
let
|
|
104
|
-
if ($[
|
|
105
|
-
|
|
117
|
+
$[30] = disabled;
|
|
118
|
+
$[31] = size;
|
|
119
|
+
$[32] = t9;
|
|
120
|
+
$[33] = t10;
|
|
121
|
+
} else t10 = $[33];
|
|
122
|
+
let t11;
|
|
123
|
+
if ($[34] !== layoutValue || $[35] !== t10) {
|
|
124
|
+
t11 = /*#__PURE__*/ jsx(FormLayoutContext.Provider, {
|
|
106
125
|
value: layoutValue,
|
|
107
|
-
children:
|
|
126
|
+
children: t10
|
|
108
127
|
});
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
} else
|
|
113
|
-
return
|
|
128
|
+
$[34] = layoutValue;
|
|
129
|
+
$[35] = t10;
|
|
130
|
+
$[36] = t11;
|
|
131
|
+
} else t11 = $[36];
|
|
132
|
+
return t11;
|
|
114
133
|
}
|
|
115
134
|
const ForwardedForm = /*#__PURE__*/ forwardRef(FormInner);
|
|
116
135
|
function useFormInstance() {
|
|
117
|
-
return useContext(
|
|
136
|
+
return useContext(FormLayoutContext).form;
|
|
118
137
|
}
|
|
119
138
|
const Form = Object.assign(ForwardedForm, {
|
|
120
139
|
Item: FormItem,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type FormInstance as RcFormInstance, type NamePath } from '@rc-component/form';
|
|
2
|
+
import { type Options } from 'scroll-into-view-if-needed';
|
|
3
|
+
export type FormScrollOptions = Options & {
|
|
4
|
+
focus?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export interface FormInstance<Values = any> extends RcFormInstance<Values> {
|
|
7
|
+
/** Scroll a mounted field into view; optionally focus its control. */
|
|
8
|
+
scrollToField: (name: NamePath<Values>, options?: FormScrollOptions) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface FieldTarget {
|
|
11
|
+
id: string;
|
|
12
|
+
instance: unknown;
|
|
13
|
+
}
|
|
14
|
+
export declare function getFieldRegistry(form: object): Map<string, FieldTarget> | undefined;
|
|
15
|
+
export declare function fieldKey(name: unknown): string;
|
|
16
|
+
export declare function useForm<Values = any>(form?: FormInstance<Values>): [FormInstance<Values>];
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { c } from "react-compiler-runtime";
|
|
2
|
+
import { useForm } from "@rc-component/form";
|
|
3
|
+
import { getDOM } from "@rc-component/util/es/Dom/findDOMNode";
|
|
4
|
+
import scroll_into_view_if_needed from "scroll-into-view-if-needed";
|
|
5
|
+
const use_form_scroll = scroll_into_view_if_needed;
|
|
6
|
+
const fieldRegistries = new WeakMap();
|
|
7
|
+
function getFieldRegistry(form) {
|
|
8
|
+
return fieldRegistries.get(form);
|
|
9
|
+
}
|
|
10
|
+
function fieldKey(name) {
|
|
11
|
+
return JSON.stringify(Array.isArray(name) ? name : [
|
|
12
|
+
name
|
|
13
|
+
]);
|
|
14
|
+
}
|
|
15
|
+
function use_form_useForm(form) {
|
|
16
|
+
const $ = c(4);
|
|
17
|
+
const [rcForm] = useForm(form);
|
|
18
|
+
let t0;
|
|
19
|
+
bb0: {
|
|
20
|
+
if (form) {
|
|
21
|
+
t0 = form;
|
|
22
|
+
break bb0;
|
|
23
|
+
}
|
|
24
|
+
let instance;
|
|
25
|
+
if ($[0] !== rcForm) {
|
|
26
|
+
const fields = new Map();
|
|
27
|
+
instance = {
|
|
28
|
+
...rcForm,
|
|
29
|
+
scrollToField (name, t1) {
|
|
30
|
+
const options = void 0 === t1 ? {} : t1;
|
|
31
|
+
const target = fields.get(fieldKey(name));
|
|
32
|
+
if (!target) return;
|
|
33
|
+
const node = getDOM(target.instance) ?? document.getElementById(target.id);
|
|
34
|
+
if (!node) return;
|
|
35
|
+
const { focus, ...scrollOptions } = options;
|
|
36
|
+
use_form_scroll(node, {
|
|
37
|
+
scrollMode: "if-needed",
|
|
38
|
+
block: "nearest",
|
|
39
|
+
...scrollOptions
|
|
40
|
+
});
|
|
41
|
+
if (focus) {
|
|
42
|
+
const control = target.instance;
|
|
43
|
+
if ("function" == typeof control?.focus) control.focus({
|
|
44
|
+
preventScroll: true
|
|
45
|
+
});
|
|
46
|
+
else node.focus({
|
|
47
|
+
preventScroll: true
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
fieldRegistries.set(instance, fields);
|
|
53
|
+
$[0] = rcForm;
|
|
54
|
+
$[1] = instance;
|
|
55
|
+
} else instance = $[1];
|
|
56
|
+
t0 = instance;
|
|
57
|
+
}
|
|
58
|
+
const wrapped = t0;
|
|
59
|
+
let t1;
|
|
60
|
+
if ($[2] !== wrapped) {
|
|
61
|
+
t1 = [
|
|
62
|
+
wrapped
|
|
63
|
+
];
|
|
64
|
+
$[2] = wrapped;
|
|
65
|
+
$[3] = t1;
|
|
66
|
+
} else t1 = $[3];
|
|
67
|
+
return t1;
|
|
68
|
+
}
|
|
69
|
+
export { fieldKey, getFieldRegistry, use_form_useForm as useForm };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { type CSSProperties, type ReactNode } from 'react';
|
|
1
|
+
import { type CSSProperties, type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
|
|
3
3
|
export type FormFieldLayout = 'vertical' | 'horizontal';
|
|
4
4
|
export interface FormFieldViewProps {
|
|
5
|
+
/** Identifies Form.Item without changing standalone FormField spacing. */
|
|
6
|
+
formItem?: boolean;
|
|
5
7
|
label?: ReactNode;
|
|
6
8
|
htmlFor?: string;
|
|
7
9
|
required?: boolean;
|
|
@@ -15,6 +17,8 @@ export interface FormFieldViewProps {
|
|
|
15
17
|
* `value`/`onChange`/`status`). View-owned id/aria attributes win.
|
|
16
18
|
*/
|
|
17
19
|
controlProps?: Record<string, unknown>;
|
|
20
|
+
/** Internal hook for bound forms to register the final control and its id. */
|
|
21
|
+
renderControl?: (control: ReactElement<Record<string, unknown>>) => ReactNode;
|
|
18
22
|
children?: ReactNode;
|
|
19
23
|
className?: string;
|
|
20
24
|
style?: CSSProperties;
|
|
@@ -27,4 +31,4 @@ export interface FormFieldViewProps {
|
|
|
27
31
|
* with the aria wiring (describedby/errormessage/invalid/required) applied
|
|
28
32
|
* to the child control. Not part of the public API.
|
|
29
33
|
*/
|
|
30
|
-
export declare function FormFieldView({ label, htmlFor, required, error, warning, description, layout, controlProps, children, className, style, classNames, styles, }: FormFieldViewProps): import("react").JSX.Element;
|
|
34
|
+
export declare function FormFieldView({ formItem, label, htmlFor, required, error, warning, description, layout, controlProps, renderControl, children, className, style, classNames, styles, }: FormFieldViewProps): import("react").JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { cloneElement, isValidElement, useId } from "react";
|
|
4
|
+
import { FieldLabelContext } from "../../utils/field-label.js";
|
|
4
5
|
import { cx } from "../../utils/semantic.js";
|
|
5
6
|
function FormFieldView(t0) {
|
|
6
|
-
const $ = c(
|
|
7
|
-
const { label, htmlFor, required, error, warning, description, layout: t1, controlProps, children, className, style, classNames, styles } = t0;
|
|
7
|
+
const $ = c(57);
|
|
8
|
+
const { formItem, label, htmlFor, required, error, warning, description, layout: t1, controlProps, renderControl, children, className, style, classNames, styles } = t0;
|
|
8
9
|
const layout = void 0 === t1 ? "vertical" : t1;
|
|
9
10
|
const generatedId = useId();
|
|
10
11
|
const child = /*#__PURE__*/ isValidElement(children) ? children : null;
|
|
@@ -51,29 +52,59 @@ function FormFieldView(t0) {
|
|
|
51
52
|
$[14] = t4;
|
|
52
53
|
} else t4 = $[14];
|
|
53
54
|
const control = t4;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
let t5;
|
|
56
|
+
if ($[15] !== classNames?.description || $[16] !== classNames?.error || $[17] !== description || $[18] !== descriptionId || $[19] !== error || $[20] !== errorId || $[21] !== styles?.description || $[22] !== styles?.error || $[23] !== warning) {
|
|
57
|
+
t5 = error ? /*#__PURE__*/ jsx("p", {
|
|
58
|
+
className: classNames?.error,
|
|
59
|
+
style: styles?.error,
|
|
60
|
+
"data-tao-form-error": "",
|
|
61
|
+
"data-tao-status": warning ? "warning" : void 0,
|
|
62
|
+
id: errorId,
|
|
63
|
+
role: "alert",
|
|
64
|
+
children: error
|
|
65
|
+
}) : description ? /*#__PURE__*/ jsx("p", {
|
|
66
|
+
className: classNames?.description,
|
|
67
|
+
style: styles?.description,
|
|
68
|
+
"data-tao-form-description": "",
|
|
69
|
+
id: descriptionId,
|
|
70
|
+
children: description
|
|
71
|
+
}) : null;
|
|
72
|
+
$[15] = classNames?.description;
|
|
73
|
+
$[16] = classNames?.error;
|
|
74
|
+
$[17] = description;
|
|
75
|
+
$[18] = descriptionId;
|
|
76
|
+
$[19] = error;
|
|
77
|
+
$[20] = errorId;
|
|
78
|
+
$[21] = styles?.description;
|
|
79
|
+
$[22] = styles?.error;
|
|
80
|
+
$[23] = warning;
|
|
81
|
+
$[24] = t5;
|
|
82
|
+
} else t5 = $[24];
|
|
83
|
+
const message = t5;
|
|
84
|
+
const t6 = classNames?.root;
|
|
85
|
+
let t7;
|
|
86
|
+
if ($[25] !== className || $[26] !== t6) {
|
|
87
|
+
t7 = cx(t6, className);
|
|
88
|
+
$[25] = className;
|
|
89
|
+
$[26] = t6;
|
|
90
|
+
$[27] = t7;
|
|
91
|
+
} else t7 = $[27];
|
|
92
|
+
const t8 = styles?.root;
|
|
93
|
+
let t9;
|
|
94
|
+
if ($[28] !== style || $[29] !== t8) {
|
|
95
|
+
t9 = {
|
|
96
|
+
...t8,
|
|
67
97
|
...style
|
|
68
98
|
};
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
} else
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
99
|
+
$[28] = style;
|
|
100
|
+
$[29] = t8;
|
|
101
|
+
$[30] = t9;
|
|
102
|
+
} else t9 = $[30];
|
|
103
|
+
const t10 = formItem ? "" : void 0;
|
|
104
|
+
const t11 = "horizontal" === layout ? "horizontal" : void 0;
|
|
105
|
+
let t12;
|
|
106
|
+
if ($[31] !== classNames?.label || $[32] !== controlId || $[33] !== label || $[34] !== labelId || $[35] !== required || $[36] !== styles?.label) {
|
|
107
|
+
t12 = null != label && /*#__PURE__*/ jsxs("label", {
|
|
77
108
|
id: labelId,
|
|
78
109
|
htmlFor: controlId,
|
|
79
110
|
className: classNames?.label,
|
|
@@ -88,74 +119,75 @@ function FormFieldView(t0) {
|
|
|
88
119
|
})
|
|
89
120
|
]
|
|
90
121
|
});
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
} else
|
|
99
|
-
let
|
|
100
|
-
if ($[
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
t12 = /*#__PURE__*/ jsxs("div", {
|
|
122
|
+
$[31] = classNames?.label;
|
|
123
|
+
$[32] = controlId;
|
|
124
|
+
$[33] = label;
|
|
125
|
+
$[34] = labelId;
|
|
126
|
+
$[35] = required;
|
|
127
|
+
$[36] = styles?.label;
|
|
128
|
+
$[37] = t12;
|
|
129
|
+
} else t12 = $[37];
|
|
130
|
+
let t13;
|
|
131
|
+
if ($[38] !== control || $[39] !== renderControl) {
|
|
132
|
+
t13 = renderControl && /*#__PURE__*/ isValidElement(control) ? renderControl(control) : control;
|
|
133
|
+
$[38] = control;
|
|
134
|
+
$[39] = renderControl;
|
|
135
|
+
$[40] = t13;
|
|
136
|
+
} else t13 = $[40];
|
|
137
|
+
let t14;
|
|
138
|
+
if ($[41] !== label || $[42] !== t13) {
|
|
139
|
+
t14 = /*#__PURE__*/ jsx(FieldLabelContext.Provider, {
|
|
140
|
+
value: label,
|
|
141
|
+
children: t13
|
|
142
|
+
});
|
|
143
|
+
$[41] = label;
|
|
144
|
+
$[42] = t13;
|
|
145
|
+
$[43] = t14;
|
|
146
|
+
} else t14 = $[43];
|
|
147
|
+
let t15;
|
|
148
|
+
if ($[44] !== formItem || $[45] !== message) {
|
|
149
|
+
t15 = formItem ? /*#__PURE__*/ jsx("div", {
|
|
150
|
+
"data-tao-form-message": "",
|
|
151
|
+
children: message
|
|
152
|
+
}) : message;
|
|
153
|
+
$[44] = formItem;
|
|
154
|
+
$[45] = message;
|
|
155
|
+
$[46] = t15;
|
|
156
|
+
} else t15 = $[46];
|
|
157
|
+
let t16;
|
|
158
|
+
if ($[47] !== t14 || $[48] !== t15) {
|
|
159
|
+
t16 = /*#__PURE__*/ jsxs("div", {
|
|
130
160
|
"data-tao-form-control": "",
|
|
131
161
|
children: [
|
|
132
|
-
|
|
133
|
-
|
|
162
|
+
t14,
|
|
163
|
+
t15
|
|
134
164
|
]
|
|
135
165
|
});
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
} else
|
|
140
|
-
let
|
|
141
|
-
if ($[
|
|
142
|
-
|
|
143
|
-
className:
|
|
144
|
-
style:
|
|
166
|
+
$[47] = t14;
|
|
167
|
+
$[48] = t15;
|
|
168
|
+
$[49] = t16;
|
|
169
|
+
} else t16 = $[49];
|
|
170
|
+
let t17;
|
|
171
|
+
if ($[50] !== t10 || $[51] !== t11 || $[52] !== t12 || $[53] !== t16 || $[54] !== t7 || $[55] !== t9) {
|
|
172
|
+
t17 = /*#__PURE__*/ jsxs("div", {
|
|
173
|
+
className: t7,
|
|
174
|
+
style: t9,
|
|
145
175
|
"data-tao-form-field": "",
|
|
146
|
-
"data-tao-
|
|
176
|
+
"data-tao-form-item": t10,
|
|
177
|
+
"data-tao-layout": t11,
|
|
147
178
|
children: [
|
|
148
|
-
|
|
149
|
-
|
|
179
|
+
t12,
|
|
180
|
+
t16
|
|
150
181
|
]
|
|
151
182
|
});
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
|
|
159
|
-
|
|
183
|
+
$[50] = t10;
|
|
184
|
+
$[51] = t11;
|
|
185
|
+
$[52] = t12;
|
|
186
|
+
$[53] = t16;
|
|
187
|
+
$[54] = t7;
|
|
188
|
+
$[55] = t9;
|
|
189
|
+
$[56] = t17;
|
|
190
|
+
} else t17 = $[56];
|
|
191
|
+
return t17;
|
|
160
192
|
}
|
|
161
193
|
export { FormFieldView };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type InputHTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type TaoSize, type TaoStatus } from '../../provider/tao-provider.js';
|
|
3
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
|
|
4
|
+
import './input.css';
|
|
5
|
+
import { type InputFocusOptions, type InputSemanticValue, type InputVariant, type TextControlProps } from './input-shared.js';
|
|
6
|
+
export type InputSemanticPart = 'root' | 'input' | 'prefix' | 'suffix' | 'clear' | 'count' | 'addonBefore' | 'addonAfter';
|
|
7
|
+
export type InputRef = HTMLInputElement & {
|
|
8
|
+
input: HTMLInputElement;
|
|
9
|
+
nativeElement: HTMLDivElement;
|
|
10
|
+
focus: (options?: InputFocusOptions) => void;
|
|
11
|
+
};
|
|
12
|
+
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'>, TextControlProps<HTMLInputElement> {
|
|
13
|
+
size?: TaoSize;
|
|
14
|
+
variant?: InputVariant;
|
|
15
|
+
prefix?: ReactNode;
|
|
16
|
+
suffix?: ReactNode;
|
|
17
|
+
/** Attached content before the input. Prefer composition for complex controls. */
|
|
18
|
+
addonBefore?: ReactNode;
|
|
19
|
+
addonAfter?: ReactNode;
|
|
20
|
+
error?: boolean;
|
|
21
|
+
status?: TaoStatus;
|
|
22
|
+
classNames?: InputSemanticValue<SemanticClassNames<InputSemanticPart>, InputProps>;
|
|
23
|
+
styles?: InputSemanticValue<SemanticStyles<InputSemanticPart>, InputProps>;
|
|
24
|
+
}
|
|
25
|
+
export declare const BaseInput: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|