x-ui-design 0.6.25 → 0.6.27

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.
@@ -1,7 +1,5 @@
1
- import React, { FC } from 'react';
2
- import { FormInstance, FormItemProps, FormProps } from '../../types/form';
1
+ import React from 'react';
2
+ import { FormInstance, FormProps } from '../../types/form';
3
3
  export declare const FormContext: React.Context<FormInstance | null>;
4
- declare const Form: FC<FormProps> & {
5
- Item: FC<FormItemProps>;
6
- };
7
- export default Form;
4
+ declare const _default: React.NamedExoticComponent<FormProps>;
5
+ export default _default;
@@ -1,9 +1,57 @@
1
- import React, { ReactElement } from 'react';
2
- import { SelectProps } from '../../types/select';
1
+ import React, { ReactElement, ReactNode } from 'react';
2
+ import { OptionType, SelectProps } from '../../types/select';
3
3
  import './style.css';
4
- declare const Select: {
5
- ({ prefixCls, id, searchValue, autoClearSearchValue, filterOption, optionFilterProp, children, options, listHeight, menuItemSelectedIcon, mode, value, defaultValue, maxCount, disabled, loading, placeholder, allowClear, filterable, defaultOpen, size, error, dropdownClassName, className, suffixIcon, searchIcon, style, showSearch, open, closeFromParent, showArrow, notFoundContent, noStyle, feedbackIcons, placement, removeIcon, maxTagCount, onSearch, onSelect, onDeselect, onClear, onChange, onClose, tagRender, getPopupContainer, dropdownRender, onDropdownVisibleChange, ref }: SelectProps): ReactElement;
6
- displayName: string;
4
+ declare const Select: React.NamedExoticComponent<import("../../types").DefaultProps & {
5
+ id?: string;
6
+ searchValue?: string;
7
+ onSearch?: (value: string) => void;
8
+ autoClearSearchValue?: boolean;
9
+ onSelect?: (value: import("../../types").RuleTypes, option?: OptionType) => void;
10
+ onDeselect?: (value: string, option?: OptionType) => void;
11
+ filterOption?: boolean | ((input: string, option: OptionType) => boolean);
12
+ optionFilterProp?: string;
13
+ options?: OptionType[];
14
+ children?: ReactNode;
15
+ defaultActiveFirstOption?: boolean;
16
+ listHeight?: number;
17
+ menuItemSelectedIcon?: ReactNode;
18
+ mode?: "default" | "multiple" | "tags";
19
+ value?: import("../../types").RuleTypes;
20
+ defaultValue?: import("../../types").RuleTypes;
21
+ maxCount?: number;
22
+ onChange?: (e: import("../../types").RuleTypes, option?: OptionType) => void;
23
+ onClose?: () => void;
24
+ disabled?: boolean;
25
+ loading?: boolean;
26
+ placeholder?: string;
27
+ allowClear?: boolean;
28
+ filterable?: boolean;
29
+ defaultOpen?: boolean;
30
+ size?: "small" | "middle" | "large";
31
+ onClear?: () => void;
32
+ error?: boolean;
33
+ showSearch?: boolean;
34
+ tagRender?: ((props: import("../../types/select").CustomTagProps) => ReactElement) | undefined;
35
+ maxTagPlaceholder?: ReactNode | ((omittedValues: import("../../types/select").DisplayValueType[]) => ReactNode);
36
+ dropdownClassName?: string;
37
+ showArrow?: boolean;
38
+ onBlur?: React.FocusEventHandler<HTMLElement> | undefined;
39
+ onDropdownVisibleChange?: ((open: boolean, selected: import("../../types").RuleType) => void) | undefined;
40
+ showAction?: ("click" | "focus")[] | undefined;
41
+ suffixIcon?: ReactNode;
42
+ searchIcon?: ReactNode;
43
+ open?: boolean;
44
+ notFoundContent?: ReactNode;
45
+ getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
46
+ dropdownRender?: (menu: ReactNode) => ReactNode;
47
+ feedbackIcons?: boolean;
48
+ placement?: "bottomLeft" | "bottomRight" | "topLeft" | "topRight";
49
+ removeIcon?: ReactNode;
50
+ maxTagCount?: number | "responsive";
51
+ ref?: React.ForwardedRef<HTMLDivElement>;
52
+ closeFromParent?: boolean;
53
+ }> & {
54
+ readonly type: ({ prefixCls, id, searchValue, autoClearSearchValue, filterOption, optionFilterProp, children, options, listHeight, menuItemSelectedIcon, mode, value, defaultValue, maxCount, disabled, loading, placeholder, allowClear, filterable, defaultOpen, size, error, dropdownClassName, className, suffixIcon, searchIcon, style, showSearch, open, closeFromParent, showArrow, notFoundContent, noStyle, feedbackIcons, placement, removeIcon, maxTagCount, onSearch, onSelect, onDeselect, onClear, onChange, onClose, tagRender, getPopupContainer, dropdownRender, onDropdownVisibleChange, ref }: SelectProps) => ReactElement;
7
55
  } & {
8
56
  Option: React.FC<import("../../types/select").OptionProps>;
9
57
  };
@@ -35,7 +35,56 @@ declare const Textarea: import("react").ComponentType<import("@/types/input").Te
35
35
  declare const Radio: import("react").ComponentType<import("@/types/radio").RadioProps>;
36
36
  declare const RadioButton: import("react").ComponentType<import("@/types/radio").RadioButtonProps>;
37
37
  declare const RadioGroup: import("react").ComponentType<import("@/types/radio").RadioGroupProps>;
38
- declare const Select: import("react").ComponentType<import("@/types/select").SelectProps>;
38
+ declare const Select: import("react").ComponentType<import("@/types").DefaultProps & {
39
+ id?: string;
40
+ searchValue?: string;
41
+ onSearch?: (value: string) => void;
42
+ autoClearSearchValue?: boolean;
43
+ onSelect?: (value: import("@/types").RuleTypes, option?: import("@/types/select").OptionType) => void;
44
+ onDeselect?: (value: string, option?: import("@/types/select").OptionType) => void;
45
+ filterOption?: boolean | ((input: string, option: import("@/types/select").OptionType) => boolean);
46
+ optionFilterProp?: string;
47
+ options?: import("@/types/select").OptionType[];
48
+ children?: import("react").ReactNode;
49
+ defaultActiveFirstOption?: boolean;
50
+ listHeight?: number;
51
+ menuItemSelectedIcon?: import("react").ReactNode;
52
+ mode?: "default" | "multiple" | "tags";
53
+ value?: import("@/types").RuleTypes;
54
+ defaultValue?: import("@/types").RuleTypes;
55
+ maxCount?: number;
56
+ onChange?: (e: import("@/types").RuleTypes, option?: import("@/types/select").OptionType) => void;
57
+ onClose?: () => void;
58
+ disabled?: boolean;
59
+ loading?: boolean;
60
+ placeholder?: string;
61
+ allowClear?: boolean;
62
+ filterable?: boolean;
63
+ defaultOpen?: boolean;
64
+ size?: "small" | "middle" | "large";
65
+ onClear?: () => void;
66
+ error?: boolean;
67
+ showSearch?: boolean;
68
+ tagRender?: ((props: import("@/types/select").CustomTagProps) => import("react").ReactElement) | undefined;
69
+ maxTagPlaceholder?: import("react").ReactNode | ((omittedValues: import("@/types/select").DisplayValueType[]) => import("react").ReactNode);
70
+ dropdownClassName?: string;
71
+ showArrow?: boolean;
72
+ onBlur?: import("react").FocusEventHandler<HTMLElement> | undefined;
73
+ onDropdownVisibleChange?: ((open: boolean, selected: import("@/types").RuleType) => void) | undefined;
74
+ showAction?: ("click" | "focus")[] | undefined;
75
+ suffixIcon?: import("react").ReactNode;
76
+ searchIcon?: import("react").ReactNode;
77
+ open?: boolean;
78
+ notFoundContent?: import("react").ReactNode;
79
+ getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
80
+ dropdownRender?: (menu: import("react").ReactNode) => import("react").ReactNode;
81
+ feedbackIcons?: boolean;
82
+ placement?: "bottomLeft" | "bottomRight" | "topLeft" | "topRight";
83
+ removeIcon?: import("react").ReactNode;
84
+ maxTagCount?: number | "responsive";
85
+ ref?: import("react").ForwardedRef<HTMLDivElement>;
86
+ closeFromParent?: boolean;
87
+ }>;
39
88
  declare const Option: import("react").ComponentType<import("@/types/select").OptionProps>;
40
89
  declare const Tag: import("react").ComponentType<import("@/types/select").CustomTagProps>;
41
90
  declare const Skeleton: import("react").ComponentType<import("./types/skeleton").SkeletonProps>;
@@ -101,6 +101,7 @@ export interface FormInstance {
101
101
  subscribeToField: (name: string, callback: (value: RuleTypes) => void) => () => void;
102
102
  subscribeToForm: (callback: (values: Record<string, RuleTypes>) => void) => () => void;
103
103
  subscribeToFields: (names: string[], callback: (values: Record<string, RuleTypes>) => void) => () => void;
104
+ subscribeToFieldError: (name: string, callback: (errors: string[]) => void) => () => void;
104
105
  isFieldValidating: (name: string) => boolean;
105
106
  onFieldsChange?: (changedFields: FieldData[]) => void;
106
107
  onValuesChange?: (changedValues: Record<string, RuleTypes>, allValues: Record<string, RuleTypes>) => void;
@@ -108,6 +109,7 @@ export interface FormInstance {
108
109
  setFieldInstance: (fieldName: string, fieldRef: FieldInstancesRef | null) => void;
109
110
  setScrollToFirstError: (value: boolean) => void;
110
111
  scrollToFirstError?: boolean;
112
+ isReseting: boolean;
111
113
  setOnFieldsChange?: (onFieldsChange?: (changedFields: FieldData[]) => void) => void;
112
114
  setOnFinish?: (onFinish?: ((values: Record<string, RuleTypes>) => void) | undefined) => void;
113
115
  setOnValuesChange?: (onValuesChange?: (changedValues: Record<string, RuleTypes>, allValues: Record<string, RuleTypes>) => void) => void;
package/dist/index.d.ts CHANGED
@@ -139,7 +139,56 @@ declare const Textarea: react.ComponentType<__types_input.TextareaProps>;
139
139
  declare const Radio: react.ComponentType<__types_radio.RadioProps>;
140
140
  declare const RadioButton: react.ComponentType<__types_radio.RadioButtonProps>;
141
141
  declare const RadioGroup: react.ComponentType<__types_radio.RadioGroupProps>;
142
- declare const Select: react.ComponentType<__types_select.SelectProps>;
142
+ declare const Select: react.ComponentType<__types.DefaultProps & {
143
+ id?: string;
144
+ searchValue?: string;
145
+ onSearch?: (value: string) => void;
146
+ autoClearSearchValue?: boolean;
147
+ onSelect?: (value: __types.RuleTypes, option?: __types_select.OptionType) => void;
148
+ onDeselect?: (value: string, option?: __types_select.OptionType) => void;
149
+ filterOption?: boolean | ((input: string, option: __types_select.OptionType) => boolean);
150
+ optionFilterProp?: string;
151
+ options?: __types_select.OptionType[];
152
+ children?: react.ReactNode;
153
+ defaultActiveFirstOption?: boolean;
154
+ listHeight?: number;
155
+ menuItemSelectedIcon?: react.ReactNode;
156
+ mode?: "default" | "multiple" | "tags";
157
+ value?: __types.RuleTypes;
158
+ defaultValue?: __types.RuleTypes;
159
+ maxCount?: number;
160
+ onChange?: (e: __types.RuleTypes, option?: __types_select.OptionType) => void;
161
+ onClose?: () => void;
162
+ disabled?: boolean;
163
+ loading?: boolean;
164
+ placeholder?: string;
165
+ allowClear?: boolean;
166
+ filterable?: boolean;
167
+ defaultOpen?: boolean;
168
+ size?: "small" | "middle" | "large";
169
+ onClear?: () => void;
170
+ error?: boolean;
171
+ showSearch?: boolean;
172
+ tagRender?: ((props: __types_select.CustomTagProps) => react.ReactElement) | undefined;
173
+ maxTagPlaceholder?: react.ReactNode | ((omittedValues: __types_select.DisplayValueType[]) => react.ReactNode);
174
+ dropdownClassName?: string;
175
+ showArrow?: boolean;
176
+ onBlur?: react.FocusEventHandler<HTMLElement> | undefined;
177
+ onDropdownVisibleChange?: ((open: boolean, selected: __types.RuleType) => void) | undefined;
178
+ showAction?: ("click" | "focus")[] | undefined;
179
+ suffixIcon?: react.ReactNode;
180
+ searchIcon?: react.ReactNode;
181
+ open?: boolean;
182
+ notFoundContent?: react.ReactNode;
183
+ getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
184
+ dropdownRender?: (menu: react.ReactNode) => react.ReactNode;
185
+ feedbackIcons?: boolean;
186
+ placement?: "bottomLeft" | "bottomRight" | "topLeft" | "topRight";
187
+ removeIcon?: react.ReactNode;
188
+ maxTagCount?: number | "responsive";
189
+ ref?: react.ForwardedRef<HTMLDivElement>;
190
+ closeFromParent?: boolean;
191
+ }>;
143
192
  declare const Option: react.ComponentType<__types_select.OptionProps>;
144
193
  declare const Tag: react.ComponentType<__types_select.CustomTagProps>;
145
194
  declare const Skeleton: react.ComponentType<SkeletonProps>;
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import require$$1 from 'react/jsx-runtime';
2
- import React, { useRef, Children, isValidElement, Fragment, Suspense, memo, useContext, useState, useMemo, useEffect, createContext, useCallback, useImperativeHandle, useLayoutEffect } from 'react';
2
+ import React, { useRef, useState, Children, isValidElement, Fragment, Suspense, memo, useContext, useMemo, useEffect, useCallback, createContext, useImperativeHandle, useLayoutEffect } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
4
  import ReactDOMServer from 'react-dom/server';
5
5
 
@@ -618,10 +618,11 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange, scrollToFir
618
618
  ...initialValues
619
619
  });
620
620
  const fieldInstancesRef = useRef({});
621
- // const [isReseting, setIsReseting] = useState(false);
621
+ const [isReseting, setIsReseting] = useState(false);
622
622
  const errorsRef = useRef({});
623
623
  const fieldSubscribers = useRef({});
624
624
  const formSubscribers = useRef([]);
625
+ const errorSubscribers = useRef({});
625
626
  function getFormFields() {
626
627
  return Object.assign({}, ...Object.values(formRef.current));
627
628
  }
@@ -765,6 +766,7 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange, scrollToFir
765
766
  [name]: fieldErrors
766
767
  };
767
768
  warningsRef.current[name] = fieldWarnings;
769
+ errorSubscribers.current[name]?.forEach(callback => callback(fieldErrors));
768
770
  return fieldErrors.length === 0;
769
771
  }
770
772
  async function validateFields(nameList) {
@@ -793,6 +795,7 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange, scrollToFir
793
795
  [name]: []
794
796
  };
795
797
  setFieldValue(name, initialValues[name], undefined, showError);
798
+ errorSubscribers.current[name]?.forEach(callback => callback([]));
796
799
  });
797
800
  } else {
798
801
  touchedFieldsRef.current.clear();
@@ -801,10 +804,11 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange, scrollToFir
801
804
  ...formData
802
805
  }).forEach(name => {
803
806
  setFieldValue(name, initialValues[name], undefined, showError);
807
+ errorSubscribers.current[name]?.forEach(callback => callback([]));
804
808
  });
805
809
  }
806
810
  formSubscribers.current.forEach(callback => callback(getFieldsValue()));
807
- // setIsReseting(prev => !prev);
811
+ setIsReseting(prev => !prev);
808
812
  }
809
813
  async function submit() {
810
814
  const formData = getFormFields();
@@ -836,6 +840,16 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange, scrollToFir
836
840
  fieldCallbacks.forEach(unsubscribe => unsubscribe());
837
841
  };
838
842
  }
843
+ function subscribeToFieldError(name, callback) {
844
+ if (!errorSubscribers.current[name]) {
845
+ errorSubscribers.current[name] = [];
846
+ }
847
+ errorSubscribers.current[name].push(callback);
848
+ callback(errorsRef.current[name] || []);
849
+ return () => {
850
+ errorSubscribers.current[name] = errorSubscribers.current[name].filter(cb => cb !== callback);
851
+ };
852
+ }
839
853
  function setScrollToFirstError(value) {
840
854
  _scrollToFirstError.current = value;
841
855
  }
@@ -872,6 +886,7 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange, scrollToFir
872
886
  isFieldValidating,
873
887
  subscribeToField,
874
888
  subscribeToForm,
889
+ subscribeToFieldError,
875
890
  onFieldsChange,
876
891
  onValuesChange,
877
892
  getFieldInstance,
@@ -879,7 +894,7 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange, scrollToFir
879
894
  subscribeToFields,
880
895
  setScrollToFirstError,
881
896
  scrollToFirstError,
882
- // isReseting,
897
+ isReseting,
883
898
  setOnFinish,
884
899
  setOnFieldsChange,
885
900
  setOnValuesChange,
@@ -986,17 +1001,19 @@ const FormItem$1 = /*#__PURE__*/memo(({
986
1001
  }) => {
987
1002
  const formContext = useContext(FormContext);
988
1003
  const errorRef = useRef(null);
989
- const [errorMessage, setErrorMessage] = useState('');
990
1004
  const fieldRef = useRef(null);
991
1005
  if (!formContext) {
992
1006
  throw new Error('FormItem must be used within a Form');
993
1007
  }
994
1008
  const {
995
- // isReseting,
1009
+ isReseting,
996
1010
  registerField,
997
1011
  getFieldInstance,
998
- setFieldInstance
1012
+ setFieldInstance,
1013
+ getFieldError,
1014
+ subscribeToFieldError
999
1015
  } = formContext;
1016
+ const [errors, setErrors] = useState(getFieldError(name)?.[0]);
1000
1017
  const childrenList = useMemo(() => flattenChildren(children), [children]);
1001
1018
  useEffect(() => {
1002
1019
  if (name && !getFieldInstance(name)) {
@@ -1007,6 +1024,14 @@ const FormItem$1 = /*#__PURE__*/memo(({
1007
1024
  setFieldInstance(name, fieldRef.current);
1008
1025
  }, [name, fieldRef.current]);
1009
1026
  useEffect(() => () => registerField(name, undefined, true), [name]);
1027
+ useEffect(() => {
1028
+ const unsubscribe = subscribeToFieldError(name, errors => {
1029
+ setErrors(errors?.[0]);
1030
+ });
1031
+ return () => {
1032
+ unsubscribe?.();
1033
+ };
1034
+ }, [name]);
1010
1035
  const isRequired = useMemo(() => rules.some(rule => rule.required), [rules]);
1011
1036
  return /*#__PURE__*/React.createElement("div", {
1012
1037
  style: style,
@@ -1024,19 +1049,20 @@ const FormItem$1 = /*#__PURE__*/memo(({
1024
1049
  }, "*")), Children.map(childrenList, (child, key) => {
1025
1050
  if (/*#__PURE__*/isValidElement(child)) {
1026
1051
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FormItemChildComponent, _extends({}, props, {
1027
- // key={`${key}_${isReseting}`}
1052
+ key: `${key}_${name}_${isReseting}`
1028
1053
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1029
1054
  // @ts-expect-error
1055
+ ,
1030
1056
  ref: fieldRef,
1031
1057
  name: name,
1032
1058
  child: child,
1033
- error: !!errorMessage
1059
+ error: !!errors
1034
1060
  })), extra ? /*#__PURE__*/React.createElement("div", {
1035
1061
  className: `${prefixCls}-extra`
1036
1062
  }, extra || '') : null, !props.noStyle && /*#__PURE__*/React.createElement("span", {
1037
1063
  ref: errorRef,
1038
1064
  className: clsx([`${prefixCls}-error`, {
1039
- [`${prefixCls}-has-error`]: errorMessage?.length
1065
+ [`${prefixCls}-has-error`]: errors?.length
1040
1066
  }]),
1041
1067
  style: {
1042
1068
  ...(removeErrorMessageHeight ? {
@@ -1046,7 +1072,7 @@ const FormItem$1 = /*#__PURE__*/memo(({
1046
1072
  marginBottom: 0
1047
1073
  } : {})
1048
1074
  }
1049
- }, errorMessage || ''));
1075
+ }, errors || ''));
1050
1076
  }
1051
1077
  return child;
1052
1078
  }));
@@ -1063,12 +1089,13 @@ const FormItemChildComponent = /*#__PURE__*/memo(({
1063
1089
  ...props
1064
1090
  }) => {
1065
1091
  const formContext = useContext(FormContext);
1092
+ const _formFieldValue = useWatch({
1093
+ name
1094
+ });
1066
1095
  const [wasNormalize, setWasNormalize] = useState(false);
1067
1096
  const {
1068
1097
  getFieldsValue,
1069
- getFieldValue,
1070
1098
  setFieldValue,
1071
- subscribeToField,
1072
1099
  subscribeToFields,
1073
1100
  validateFields
1074
1101
  } = formContext || {};
@@ -1078,18 +1105,12 @@ const FormItemChildComponent = /*#__PURE__*/memo(({
1078
1105
  onChange,
1079
1106
  value
1080
1107
  } = child.props;
1081
- const [fieldValue, _setFieldValue] = useState(value ?? getFieldValue?.(name) ?? initialValue);
1108
+ const fieldValue = useMemo(() => value ?? _formFieldValue ?? initialValue, [value, _formFieldValue, initialValue]);
1082
1109
  useEffect(() => {
1083
1110
  if (initialValue) {
1084
1111
  setFieldValue?.(name, initialValue);
1085
1112
  }
1086
- const unsubscribe = subscribeToField?.(name, value => {
1087
- _setFieldValue(value);
1088
- });
1089
- return () => {
1090
- unsubscribe?.();
1091
- };
1092
- }, []);
1113
+ }, [name]);
1093
1114
  useEffect(() => {
1094
1115
  if (name && dependencies.length > 0) {
1095
1116
  const unsubscribe = subscribeToFields?.(dependencies, () => {
@@ -1119,7 +1140,7 @@ const FormItemChildComponent = /*#__PURE__*/memo(({
1119
1140
  setFieldValue?.(name, rawValue, undefined, undefined, true);
1120
1141
  onChange?.(e, option);
1121
1142
  };
1122
- const injectPropsIntoFinalLeaf = child => {
1143
+ const injectPropsIntoFinalLeaf = useCallback(child => {
1123
1144
  if (! /*#__PURE__*/isValidElement(child)) {
1124
1145
  return child;
1125
1146
  }
@@ -1150,7 +1171,7 @@ const FormItemChildComponent = /*#__PURE__*/memo(({
1150
1171
  error
1151
1172
  } : {})
1152
1173
  }));
1153
- };
1174
+ }, [name, fieldValue, wasNormalize, error, handleChange, props, ref]);
1154
1175
  return injectPropsIntoFinalLeaf(child);
1155
1176
  });
1156
1177
  FormItem$1.displayName = 'FormItem';
@@ -1179,7 +1200,7 @@ const Form$1 = ({
1179
1200
  const internalForm = useForm(initialValues, onFieldsChange, onValuesChange);
1180
1201
  const formRef = useRef(null);
1181
1202
  const formInstance = useMemo(() => form || internalForm, [form, internalForm]);
1182
- const handleSubmit = async e => {
1203
+ const handleSubmit = useCallback(async e => {
1183
1204
  e.preventDefault();
1184
1205
  if (await formInstance.validateFields()) {
1185
1206
  onFinish?.(formInstance.getFieldsValue());
@@ -1190,7 +1211,7 @@ const Form$1 = ({
1190
1211
  errorFields
1191
1212
  });
1192
1213
  }
1193
- };
1214
+ }, [formInstance, onFinish, onFinishFailed]);
1194
1215
  const childrenList = useMemo(() => flattenChildren(children), [children]);
1195
1216
  const formClassName = useMemo(() => `${prefixCls} ${className}`.trim(), [prefixCls, className]);
1196
1217
  useEffect(() => {
@@ -1225,17 +1246,7 @@ const Form$1 = ({
1225
1246
  layout: childProps.layout || layout
1226
1247
  }));
1227
1248
  }, [rest.size, layout]);
1228
- console.info({
1229
- children,
1230
- form,
1231
- style,
1232
- prefixCls,
1233
- className,
1234
- initialValues,
1235
- layout,
1236
- scrollToFirstError,
1237
- ...rest
1238
- });
1249
+ const injectedChildren = useMemo(() => Children.map(childrenList, child => injectPropsIntoFinalLeaf(child)), [childrenList, injectPropsIntoFinalLeaf]);
1239
1250
  return /*#__PURE__*/React.createElement(FormContext.Provider, {
1240
1251
  value: formInstance
1241
1252
  }, /*#__PURE__*/React.createElement("form", {
@@ -1243,14 +1254,15 @@ const Form$1 = ({
1243
1254
  ref: formRef,
1244
1255
  onSubmit: handleSubmit,
1245
1256
  className: formClassName
1246
- }, Children.map(childrenList, child => injectPropsIntoFinalLeaf(child))));
1257
+ }, injectedChildren));
1247
1258
  };
1248
- Form$1.Item = FormItem$1;
1259
+ Form$1.Item = /*#__PURE__*/memo(FormItem$1);
1260
+ var Form$2 = /*#__PURE__*/memo(Form$1);
1249
1261
 
1250
- var Form$2 = /*#__PURE__*/Object.freeze({
1262
+ var Form$3 = /*#__PURE__*/Object.freeze({
1251
1263
  __proto__: null,
1252
1264
  FormContext: FormContext,
1253
- default: Form$1
1265
+ default: Form$2
1254
1266
  });
1255
1267
 
1256
1268
  const useWatch = ({
@@ -1302,7 +1314,7 @@ const RangePicker$2 = dynamic$1(() => Promise.resolve().then(function () { retur
1302
1314
  const TimePicker$2 = dynamic$1(() => Promise.resolve().then(function () { return TimePicker$1; }), {
1303
1315
  ssr: false
1304
1316
  });
1305
- const Form = dynamic$1(() => Promise.resolve().then(function () { return Form$2; }), {
1317
+ const Form = dynamic$1(() => Promise.resolve().then(function () { return Form$3; }), {
1306
1318
  ssr: false
1307
1319
  });
1308
1320
  const FormItem = dynamic$1(() => Promise.resolve().then(function () { return Item; }), {
@@ -1348,7 +1360,7 @@ const SkeletonInput$1 = dynamic$1(() => Promise.resolve().then(function () { ret
1348
1360
  ssr: false
1349
1361
  });
1350
1362
 
1351
- var css_248z$k = ".xUi-button{border:1px solid transparent;border-radius:6px;cursor:pointer;font-weight:400;line-height:1.5715;transition:all .3s ease;user-select:none;vertical-align:middle;white-space:nowrap}.xUi-button,.xUi-button-content,.xUi-button-icon{align-items:center;display:inline-flex;justify-content:center}.xUi-button-icon{line-height:0;margin-right:.5em}.xUi-button-icon:last-child{margin-left:.5em;margin-right:0}.xUi-button-spinner{animation:xUi-spin 1s linear infinite;border:1px solid transparent;border-radius:50%;border-top:1px solid var(--xui-text-color);height:1em;width:1em}@keyframes xUi-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.xUi-button-size-small{font-size:12px;height:24px;padding:4px 12px}.xUi-button-size-middle{font-size:14px;height:32px;padding:0 16px}.xUi-button-size-large{font-size:16px;height:44px;padding:8px 20px}.xUi-button-circle{border-radius:50%;justify-content:center;padding:0}.xUi-button-circle.xUi-button-size-small{height:24px;width:24px}.xUi-button-circle.xUi-button-size-large{height:44px;width:44px}.xUi-button-round{border-radius:9999px}.xUi-button-default{background-color:#fff;border-color:var(--xui-border-color);color:rgba(0,0,0,.85)}.xUi-button-default:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-primary{background-color:var(--xui-primary-color);border-color:var(--xui-primary-color);color:#fff}.xUi-button-primary:hover{background-color:var(--xui-color-hover);border-color:var(--xui-color-hover);color:#fff}.xUi-button-dashed{background-color:#fff;border-color:var(--xui-border-color);border-style:dashed;color:rgba(0,0,0,.85)}.xUi-button-dashed:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-text{background-color:transparent;border-color:transparent!important;color:rgba(0,0,0,.88)}.xUi-button-text:hover{background-color:rgba(0,0,0,.04);border-color:transparent;color:rgba(0,0,0,.88)}.xUi-button-link{background-color:transparent;border-color:transparent!important;color:var(--xui-primary-color)}.xUi-button-link:hover{border-color:transparent;color:var(--xui-primary-color-light)}.xUi-button-outlined{color:#fff}.xUi-button-filled,.xUi-button-outlined{background-color:transparent;border-color:var(--xui-border-color)}.xUi-button-filled{color:var(--xui-text-color)}.xUi-button-danger{background-color:transparent;border-color:var(--xui-error-color);color:var(--xui-error-color)}.xUi-button-danger:hover{border-color:var(--xui-error-color-light);color:var(--xui-error-color-light)}.xUi-button-ghost{opacity:0}.xUi-button-ghost:hover{opacity:1}.xUi-button-block{display:flex;width:100%}.xUi-button-disabled,.xUi-button-loading{background-color:var(--xui-color-disabled);border-color:var(--xui-border-color);color:var(--xui-text-color);cursor:not-allowed;opacity:.5;pointer-events:none}.xUi-button-loading{background-color:transparent}";
1363
+ var css_248z$k = ".xUi-button{border:1px solid transparent;border-radius:6px;cursor:pointer;font-weight:400;line-height:1.5715;transition:all .3s ease;user-select:none;vertical-align:middle;white-space:nowrap}.xUi-button,.xUi-button-content,.xUi-button-icon{align-items:center;display:inline-flex;justify-content:center}.xUi-button-icon{line-height:0;margin-right:.5em}.xUi-button-icon:last-child{margin-left:.5em;margin-right:0}.xUi-button-spinner{animation:xUi-spin 1s linear infinite;border:1px solid transparent;border-radius:50%;border-top:1px solid var(--xui-text-color);height:1em;width:1em}@keyframes xUi-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.xUi-button-size-small{font-size:12px;height:24px;padding:4px 12px}.xUi-button-size-middle{font-size:14px;height:32px;padding:0 16px}.xUi-button-size-large{font-size:16px;height:44px;padding:8px 20px}.xUi-button-shape-circle{border-radius:50%;justify-content:center;padding:0}.xUi-button-shape-circle.xUi-button-size-small{height:24px;width:24px}.xUi-button-shape-circle.xUi-button-size-large{height:44px;width:44px}.xUi-button-shape-round{border-radius:9999px}.xUi-button-default{background-color:#fff;border-color:var(--xui-border-color);color:rgba(0,0,0,.85)}.xUi-button-default:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-primary{background-color:var(--xui-primary-color);border-color:var(--xui-primary-color);color:#fff}.xUi-button-primary:hover{background-color:var(--xui-primary-color-hover);border-color:var(--xui-primary-color-hover);color:#fff}.xUi-button-variant-dashed{background-color:#fff;border-color:var(--xui-border-color);border-style:dashed;color:rgba(0,0,0,.85)}.xUi-button-variant-dashed:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-variant-text{background-color:transparent;border-color:transparent!important;color:rgba(0,0,0,.88)}.xUi-button-variant-text:hover{background-color:rgba(0,0,0,.04);border-color:transparent;color:rgba(0,0,0,.88)}.xUi-button-variant-link{background-color:transparent;border-color:transparent!important;color:var(--xui-primary-color)}.xUi-button-variant-link:hover{border-color:transparent;color:var(--xui-primary-color-light)}.xUi-button-variant-outlined{color:#fff}.xUi-button-variant-filled,.xUi-button-variant-outlined{background-color:transparent;border-color:var(--xui-border-color)}.xUi-button-variant-filled{color:var(--xui-text-color)}.xUi-button-danger{background-color:transparent;border-color:var(--xui-error-color);color:var(--xui-error-color)}.xUi-button-danger:hover{border-color:var(--xui-error-color-light);color:var(--xui-error-color-light)}.xUi-button-ghost{opacity:0}.xUi-button-ghost:hover{opacity:1}.xUi-button-block{display:flex;width:100%}.xUi-button-disabled,.xUi-button-loading{background-color:var(--xui-color-disabled);border-color:var(--xui-border-color);color:var(--xui-text-color);cursor:not-allowed;opacity:.5;pointer-events:none}.xUi-button-loading{background-color:transparent}";
1352
1364
  styleInject(css_248z$k);
1353
1365
 
1354
1366
  const ButtonComponent = ({
@@ -1392,7 +1404,7 @@ const ButtonComponent = ({
1392
1404
  }
1393
1405
  }, [loading]);
1394
1406
  const classes = useMemo(() => {
1395
- return clsx([...new Set([prefixCls, rootClassName, `${prefixCls}-${type}`, `${prefixCls}-${variant}`, `${prefixCls}-${color}`, `${prefixCls}-${shape}`, `${prefixCls}-size-${size}`, {
1407
+ return clsx([...new Set([prefixCls, rootClassName, `${prefixCls}-${type}`, `${prefixCls}-variant-${variant}`, `${prefixCls}-color-${color}`, `${prefixCls}-shape-${shape}`, `${prefixCls}-size-${size}`, {
1396
1408
  [`${prefixCls}-block`]: block,
1397
1409
  [`${prefixCls}-ghost`]: ghost,
1398
1410
  [`${prefixCls}-danger`]: danger,
@@ -3326,7 +3338,7 @@ function getTextFromNode(node) {
3326
3338
  }
3327
3339
  return '';
3328
3340
  }
3329
- const SelectComponent = ({
3341
+ const SelectComponent = /*#__PURE__*/memo(({
3330
3342
  prefixCls = prefixClsSelect,
3331
3343
  id,
3332
3344
  searchValue = '',
@@ -3628,11 +3640,7 @@ const SelectComponent = ({
3628
3640
  isOpen: isOpen
3629
3641
  }));
3630
3642
  }, [showArrow, showSearch, isOpen, suffixIcon, searchIcon]);
3631
- const extractedOptions = children ? extractOptions(children) : Array.isArray(options) ? options : [];
3632
- const triggerNode = useMemo(() => {
3633
- return selectRef.current?.querySelector(`.${prefixCls}-trigger`);
3634
- }, [prefixCls]);
3635
- function extractOptions(children, options) {
3643
+ const extractOptions = useCallback((children, options) => {
3636
3644
  const result = [];
3637
3645
  const flatten = nodes => {
3638
3646
  try {
@@ -3656,7 +3664,13 @@ const SelectComponent = ({
3656
3664
  return result;
3657
3665
  }
3658
3666
  return options || [];
3659
- }
3667
+ }, []);
3668
+ const extractedOptions = useMemo(() => {
3669
+ return children ? extractOptions(children) : Array.isArray(options) ? options : [];
3670
+ }, [children, options]);
3671
+ const triggerNode = useMemo(() => {
3672
+ return selectRef.current?.querySelector(`.${prefixCls}-trigger`);
3673
+ }, [prefixCls]);
3660
3674
  const filteredOptions = extractedOptions.filter(option => {
3661
3675
  if (typeof filterOption === 'function') {
3662
3676
  return filterOption(searchQuery, option);
@@ -3891,7 +3905,7 @@ const SelectComponent = ({
3891
3905
  }, ArrowContainer, error && feedbackIcons ? /*#__PURE__*/React.createElement(ErrorIcon, null) : null), loading && /*#__PURE__*/React.createElement("span", {
3892
3906
  className: `${prefixCls}-loading`
3893
3907
  }, /*#__PURE__*/React.createElement(LoadingIcon, null)))), getPopupContainer?.(triggerNode) ? /*#__PURE__*/createPortal(dropdownContent, getPopupContainer(triggerNode)) : dropdownContent);
3894
- };
3908
+ });
3895
3909
  SelectComponent.displayName = 'Select';
3896
3910
  const Select = Object.assign(SelectComponent, {
3897
3911
  Option