@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.
Files changed (107) hide show
  1. package/README.md +8 -2
  2. package/component-manifest.json +37 -18
  3. package/dist/components/alert/alert.css +1 -0
  4. package/dist/components/avatar/avatar.js +1 -1
  5. package/dist/components/calendar/calendar.css +10 -60
  6. package/dist/components/calendar/calendar.js +46 -43
  7. package/dist/components/card/card.css +1 -1
  8. package/dist/components/carousel/carousel.css +1 -0
  9. package/dist/components/carousel/carousel.js +62 -7
  10. package/dist/components/collapse/collapse-panels.d.ts +4 -0
  11. package/dist/components/collapse/collapse-panels.js +413 -0
  12. package/dist/components/collapse/collapse.css +199 -0
  13. package/dist/components/collapse/collapse.d.ts +77 -0
  14. package/dist/components/{collapsible/collapsible.js → collapse/collapse.js} +26 -10
  15. package/dist/components/color-picker/color-picker.css +8 -42
  16. package/dist/components/color-picker/color-picker.js +220 -145
  17. package/dist/components/date-picker/date-picker.css +18 -56
  18. package/dist/components/date-picker/date-picker.d.ts +2 -0
  19. package/dist/components/date-picker/date-picker.js +11 -6
  20. package/dist/components/date-picker/presets.js +5 -2
  21. package/dist/components/date-picker/range-picker.d.ts +2 -0
  22. package/dist/components/date-picker/range-picker.js +3 -1
  23. package/dist/components/form/field-control.d.ts +6 -0
  24. package/dist/components/form/field-control.js +42 -0
  25. package/dist/components/form/form-context.d.ts +3 -0
  26. package/dist/components/form/form-item.d.ts +2 -1
  27. package/dist/components/form/form-item.js +56 -42
  28. package/dist/components/form/form.css +15 -0
  29. package/dist/components/form/form.d.ts +5 -5
  30. package/dist/components/form/form.js +87 -68
  31. package/dist/components/form/index.d.ts +1 -0
  32. package/dist/components/form/use-form.d.ts +16 -0
  33. package/dist/components/form/use-form.js +69 -0
  34. package/dist/components/form-field/form-field-view.d.ts +6 -2
  35. package/dist/components/form-field/form-field-view.js +116 -84
  36. package/dist/components/input/base-input.d.ts +25 -0
  37. package/dist/components/input/base-input.js +104 -0
  38. package/dist/components/input/input-shared.css +75 -0
  39. package/dist/components/input/input-shared.d.ts +59 -0
  40. package/dist/components/input/input-shared.js +152 -0
  41. package/dist/components/input/input.css +99 -4
  42. package/dist/components/input/input.d.ts +12 -16
  43. package/dist/components/input/input.js +11 -154
  44. package/dist/components/input/otp.d.ts +29 -0
  45. package/dist/components/input/otp.js +335 -0
  46. package/dist/components/input/password.d.ts +12 -0
  47. package/dist/components/input/password.js +117 -0
  48. package/dist/components/input/search.d.ts +16 -0
  49. package/dist/components/input/search.js +99 -0
  50. package/dist/components/input-number/input-number.d.ts +2 -2
  51. package/dist/components/input-number/input-number.js +2 -2
  52. package/dist/components/list/list-pagination.css +5 -5
  53. package/dist/components/list/list-pagination.js +1 -0
  54. package/dist/components/mentions/mentions.css +7 -0
  55. package/dist/components/modal/modal.css +1 -0
  56. package/dist/components/radio/radio.d.ts +1 -1
  57. package/dist/components/radio/radio.js +78 -73
  58. package/dist/components/select/mobile-select.css +1 -16
  59. package/dist/components/select/mobile-select.d.ts +2 -1
  60. package/dist/components/select/mobile-select.js +68 -63
  61. package/dist/components/select/select-types.d.ts +2 -0
  62. package/dist/components/select/select.css +19 -0
  63. package/dist/components/select/select.js +31 -17
  64. package/dist/components/spinner/spinner.css +1 -1
  65. package/dist/components/steps/steps.css +53 -3
  66. package/dist/components/table/table.css +0 -5
  67. package/dist/components/table/table.js +21 -22
  68. package/dist/components/textarea/textarea.css +20 -0
  69. package/dist/components/textarea/textarea.d.ts +12 -6
  70. package/dist/components/textarea/textarea.js +120 -219
  71. package/dist/components/time-picker/time-picker.css +7 -0
  72. package/dist/components/tree/tree-check.d.ts +1 -0
  73. package/dist/components/tree/tree-check.js +36 -0
  74. package/dist/components/tree/tree.css +13 -18
  75. package/dist/components/tree/tree.js +2 -3
  76. package/dist/components/tree-select/select-engine.css +7 -0
  77. package/dist/components/tree-select/tree-select.js +2 -3
  78. package/dist/components/upload/upload.css +0 -11
  79. package/dist/components/upload/upload.js +13 -3
  80. package/dist/docs/component-docs.js +2 -2
  81. package/dist/docs/components/{collapsible.doc.d.ts → collapse.doc.d.ts} +1 -1
  82. package/dist/docs/components/collapse.doc.js +47 -0
  83. package/dist/docs/components/form.doc.js +3 -1
  84. package/dist/docs/components/input.doc.js +11 -4
  85. package/dist/docs/components/textarea.doc.js +4 -2
  86. package/dist/entries/collapse.d.ts +3 -0
  87. package/dist/entries/{collapsible.js → collapse.js} +1 -1
  88. package/dist/entries/form.d.ts +2 -2
  89. package/dist/entries/input.d.ts +1 -1
  90. package/dist/entries/textarea.d.ts +1 -1
  91. package/dist/index.d.ts +5 -5
  92. package/dist/index.js +1 -1
  93. package/dist/provider/locale.d.ts +6 -0
  94. package/dist/provider/locale.js +10 -0
  95. package/dist/provider/tao-provider.js +1 -0
  96. package/dist/theme/control.css +2 -2
  97. package/dist/theme/theme.css +3 -1
  98. package/dist/theme/tokens.d.ts +2 -2
  99. package/dist/theme/tokens.js +1 -0
  100. package/dist/utils/field-label.d.ts +4 -0
  101. package/dist/utils/field-label.js +7 -0
  102. package/llms.txt +19 -16
  103. package/package.json +10 -5
  104. package/dist/components/collapsible/collapsible.css +0 -49
  105. package/dist/components/collapsible/collapsible.d.ts +0 -39
  106. package/dist/docs/components/collapsible.doc.js +0 -39
  107. 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, { FieldContext, FormProvider, List, useForm, useWatch } from "@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(31);
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] = rcProps;
31
- $[6] = size;
32
- $[7] = style;
33
- $[8] = styles;
34
- $[9] = t1;
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
- rcProps = $[5];
41
- size = $[6];
42
- style = $[7];
43
- styles = $[8];
44
- t1 = $[9];
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
- let t2;
48
- if ($[10] !== layout) {
49
- t2 = {
50
- layout
51
- };
52
- $[10] = layout;
53
- $[11] = t2;
54
- } else t2 = $[11];
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 ($[12] !== className || $[13] !== t3) {
59
- t4 = cx(t3, className);
60
- $[12] = className;
61
- $[13] = t3;
62
- $[14] = t4;
63
- } else t4 = $[14];
64
- const t5 = styles?.root;
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 ($[15] !== style || $[16] !== t5) {
67
- t6 = {
68
- ...t5,
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
- $[15] = style;
72
- $[16] = t5;
73
- $[17] = t6;
74
- } else t6 = $[17];
75
- let t7;
76
- if ($[18] !== children || $[19] !== rcProps || $[20] !== ref || $[21] !== t4 || $[22] !== t6) {
77
- t7 = /*#__PURE__*/ jsx(RcFormComponent, {
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: t4,
80
- style: t6,
96
+ className: t6,
97
+ style: t8,
81
98
  ...rcProps,
99
+ form: instance,
82
100
  children: children
83
101
  });
84
- $[18] = children;
85
- $[19] = rcProps;
86
- $[20] = ref;
87
- $[21] = t4;
88
- $[22] = t6;
89
- $[23] = t7;
90
- } else t7 = $[23];
91
- let t8;
92
- if ($[24] !== disabled || $[25] !== size || $[26] !== t7) {
93
- t8 = /*#__PURE__*/ jsx(TaoProvider, {
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: t7
115
+ children: t9
97
116
  });
98
- $[24] = disabled;
99
- $[25] = size;
100
- $[26] = t7;
101
- $[27] = t8;
102
- } else t8 = $[27];
103
- let t9;
104
- if ($[28] !== layoutValue || $[29] !== t8) {
105
- t9 = /*#__PURE__*/ jsx(FormLayoutContext.Provider, {
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: t8
126
+ children: t10
108
127
  });
109
- $[28] = layoutValue;
110
- $[29] = t8;
111
- $[30] = t9;
112
- } else t9 = $[30];
113
- return t9;
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(FieldContext);
136
+ return useContext(FormLayoutContext).form;
118
137
  }
119
138
  const Form = Object.assign(ForwardedForm, {
120
139
  Item: FormItem,
@@ -1,2 +1,3 @@
1
1
  export { Form, type FormProps, type FormSemanticPart } from './form.js';
2
+ export type { FormInstance, FormScrollOptions } from './use-form.js';
2
3
  export type { FormItemChildren, FormItemProps, FormItemSemanticPart, FormItemValidateStatus, } from './form-item.js';
@@ -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(47);
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
- const t5 = classNames?.root;
55
- let t6;
56
- if ($[15] !== className || $[16] !== t5) {
57
- t6 = cx(t5, className);
58
- $[15] = className;
59
- $[16] = t5;
60
- $[17] = t6;
61
- } else t6 = $[17];
62
- const t7 = styles?.root;
63
- let t8;
64
- if ($[18] !== style || $[19] !== t7) {
65
- t8 = {
66
- ...t7,
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
- $[18] = style;
70
- $[19] = t7;
71
- $[20] = t8;
72
- } else t8 = $[20];
73
- const t9 = "horizontal" === layout ? "horizontal" : void 0;
74
- let t10;
75
- if ($[21] !== classNames?.label || $[22] !== controlId || $[23] !== label || $[24] !== labelId || $[25] !== required || $[26] !== styles?.label) {
76
- t10 = null != label && /*#__PURE__*/ jsxs("label", {
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
- $[21] = classNames?.label;
92
- $[22] = controlId;
93
- $[23] = label;
94
- $[24] = labelId;
95
- $[25] = required;
96
- $[26] = styles?.label;
97
- $[27] = t10;
98
- } else t10 = $[27];
99
- let t11;
100
- if ($[28] !== classNames?.description || $[29] !== classNames?.error || $[30] !== description || $[31] !== descriptionId || $[32] !== error || $[33] !== errorId || $[34] !== styles?.description || $[35] !== styles?.error || $[36] !== warning) {
101
- t11 = error ? /*#__PURE__*/ jsx("p", {
102
- className: classNames?.error,
103
- style: styles?.error,
104
- "data-tao-form-error": "",
105
- "data-tao-status": warning ? "warning" : void 0,
106
- id: errorId,
107
- role: "alert",
108
- children: error
109
- }) : description ? /*#__PURE__*/ jsx("p", {
110
- className: classNames?.description,
111
- style: styles?.description,
112
- "data-tao-form-description": "",
113
- id: descriptionId,
114
- children: description
115
- }) : null;
116
- $[28] = classNames?.description;
117
- $[29] = classNames?.error;
118
- $[30] = description;
119
- $[31] = descriptionId;
120
- $[32] = error;
121
- $[33] = errorId;
122
- $[34] = styles?.description;
123
- $[35] = styles?.error;
124
- $[36] = warning;
125
- $[37] = t11;
126
- } else t11 = $[37];
127
- let t12;
128
- if ($[38] !== control || $[39] !== t11) {
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
- control,
133
- t11
162
+ t14,
163
+ t15
134
164
  ]
135
165
  });
136
- $[38] = control;
137
- $[39] = t11;
138
- $[40] = t12;
139
- } else t12 = $[40];
140
- let t13;
141
- if ($[41] !== t10 || $[42] !== t12 || $[43] !== t6 || $[44] !== t8 || $[45] !== t9) {
142
- t13 = /*#__PURE__*/ jsxs("div", {
143
- className: t6,
144
- style: t8,
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-layout": t9,
176
+ "data-tao-form-item": t10,
177
+ "data-tao-layout": t11,
147
178
  children: [
148
- t10,
149
- t12
179
+ t12,
180
+ t16
150
181
  ]
151
182
  });
152
- $[41] = t10;
153
- $[42] = t12;
154
- $[43] = t6;
155
- $[44] = t8;
156
- $[45] = t9;
157
- $[46] = t13;
158
- } else t13 = $[46];
159
- return t13;
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>>;