@tidbcloud/uikit 2.0.0-beta.50 → 2.0.0-beta.52

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @tidbcloud/uikit
2
2
 
3
+ ## 2.0.0-beta.52
4
+
5
+ ### Minor Changes
6
+
7
+ - adjust Dot and DotBadge color
8
+
9
+ ## 2.0.0-beta.51
10
+
11
+ ### Patch Changes
12
+
13
+ - update form
14
+
3
15
  ## 2.0.0-beta.50
4
16
 
5
17
  ### Minor Changes
@@ -9,7 +9,7 @@ const Dot = ({ color, size = 8, ...rest }) => {
9
9
  sx: (theme) => {
10
10
  var _a;
11
11
  return {
12
- backgroundColor: ((_a = theme.colors[color]) == null ? void 0 : _a[5]) ?? theme.colors.carbon[6],
12
+ backgroundColor: ((_a = theme.colors[color]) == null ? void 0 : _a[7]) ?? theme.colors.carbon[6],
13
13
  height: size,
14
14
  width: size,
15
15
  borderRadius: "50%"
@@ -7,7 +7,7 @@ const Dot = ({ color, size = 8, ...rest }) => {
7
7
  sx: (theme) => {
8
8
  var _a;
9
9
  return {
10
- backgroundColor: ((_a = theme.colors[color]) == null ? void 0 : _a[5]) ?? theme.colors.carbon[6],
10
+ backgroundColor: ((_a = theme.colors[color]) == null ? void 0 : _a[7]) ?? theme.colors.carbon[6],
11
11
  height: size,
12
12
  width: size,
13
13
  borderRadius: "50%"
@@ -11,7 +11,7 @@ const DotBadge = ({ color = "green", children, ...rest }) => {
11
11
  variant: "light",
12
12
  styles: (theme) => ({
13
13
  root: {
14
- backgroundColor: theme.colors[color][0],
14
+ backgroundColor: theme.colors[color][1],
15
15
  borderRadius: theme.defaultRadius,
16
16
  textTransform: "none",
17
17
  height: 28
@@ -19,7 +19,7 @@ const DotBadge = ({ color = "green", children, ...rest }) => {
19
19
  }),
20
20
  leftSection: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(index.Dot, { color, size: 8 }),
21
21
  ...rest,
22
- children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(index$1.Typography, { variant: "body3", c: `${color}.6`, children })
22
+ children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(index$1.Typography, { size: 14, fw: 500, c: `${color}.8`, children })
23
23
  }
24
24
  );
25
25
  };
@@ -9,7 +9,7 @@ const DotBadge = ({ color = "green", children, ...rest }) => {
9
9
  variant: "light",
10
10
  styles: (theme) => ({
11
11
  root: {
12
- backgroundColor: theme.colors[color][0],
12
+ backgroundColor: theme.colors[color][1],
13
13
  borderRadius: theme.defaultRadius,
14
14
  textTransform: "none",
15
15
  height: 28
@@ -17,7 +17,7 @@ const DotBadge = ({ color = "green", children, ...rest }) => {
17
17
  }),
18
18
  leftSection: /* @__PURE__ */ jsxRuntimeExports.jsx(Dot, { color, size: 8 }),
19
19
  ...rest,
20
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body3", c: `${color}.6`, children })
20
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { size: 14, fw: 500, c: `${color}.8`, children })
21
21
  }
22
22
  );
23
23
  };
@@ -24,6 +24,8 @@ const _Form = ({
24
24
  layout = "vertical",
25
25
  layoutProps,
26
26
  onError,
27
+ stopPropagation,
28
+ preventDefault,
27
29
  ...rest
28
30
  }) => {
29
31
  const [submitError, setSubmitError] = ahooks.useSafeState("");
@@ -51,21 +53,37 @@ const _Form = ({
51
53
  const handleDismissErrorMessage = () => {
52
54
  setSubmitError("");
53
55
  };
54
- return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(reactHookForm.FormProvider, { ...methods, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Box.Box, { component: "form", ...rest, onSubmit: handleSubmit(submit), children: [
55
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(FormLayout.FormLayout, { layout, ...layoutProps, children }),
56
- withActions && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment, { children: [
57
- submitError && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
58
- FormErrorMessage.FormErrorMessage,
59
- {
60
- mt: 24,
61
- message: submitError,
62
- onDismiss: handleDismissErrorMessage,
63
- ...errorMessageProps
56
+ return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(reactHookForm.FormProvider, { ...methods, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
57
+ Box.Box,
58
+ {
59
+ component: "form",
60
+ ...rest,
61
+ onSubmit: (e) => {
62
+ if (stopPropagation) {
63
+ e == null ? void 0 : e.stopPropagation();
64
64
  }
65
- ),
66
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(FormActions.FormActions, { onCancel, loading: submitting, ...actionsProps })
67
- ] })
68
- ] }) });
65
+ if (preventDefault) {
66
+ e == null ? void 0 : e.preventDefault();
67
+ }
68
+ return handleSubmit(submit)(e);
69
+ },
70
+ children: [
71
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(FormLayout.FormLayout, { layout, ...layoutProps, children }),
72
+ withActions && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment, { children: [
73
+ submitError && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
74
+ FormErrorMessage.FormErrorMessage,
75
+ {
76
+ mt: 24,
77
+ message: submitError,
78
+ onDismiss: handleDismissErrorMessage,
79
+ ...errorMessageProps
80
+ }
81
+ ),
82
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(FormActions.FormActions, { onCancel, loading: submitting, ...actionsProps })
83
+ ] })
84
+ ]
85
+ }
86
+ ) });
69
87
  };
70
88
  const Form = _Form;
71
89
  Form.Actions = FormActions.FormActions;
@@ -15,12 +15,14 @@ export interface FormProps<T extends FieldValues = object> extends BoxProps {
15
15
  errorMessageProps?: Omit<FormErrorMessageProps, 'message'>;
16
16
  layout?: FormLayoutType;
17
17
  layoutProps?: Omit<FormLayoutProps, 'layout'>;
18
+ stopPropagation?: boolean;
19
+ preventDefault?: boolean;
18
20
  onSubmit: SubmitHandler<T>;
19
21
  onError?: () => any;
20
22
  onCancel?: () => void;
21
23
  onFormUnMount?: () => void;
22
24
  }
23
- declare const _Form: <T extends object = {}>({ children, form, formMode, reValidateMode, defaultValues, onSubmit, onFormUnMount, onCancel, withActions, actionsProps, errorMessageProps, layout, layoutProps, onError, ...rest }: FormProps<T>) => import("react/jsx-runtime.js").JSX.Element;
25
+ declare const _Form: <T extends object = {}>({ children, form, formMode, reValidateMode, defaultValues, onSubmit, onFormUnMount, onCancel, withActions, actionsProps, errorMessageProps, layout, layoutProps, onError, stopPropagation, preventDefault, ...rest }: FormProps<T>) => import("react/jsx-runtime.js").JSX.Element;
24
26
  type FormType = typeof _Form;
25
27
  export declare const Form: FormType & {
26
28
  Actions: typeof FormActions;
@@ -15,12 +15,14 @@ export interface FormProps<T extends FieldValues = object> extends BoxProps {
15
15
  errorMessageProps?: Omit<FormErrorMessageProps, 'message'>;
16
16
  layout?: FormLayoutType;
17
17
  layoutProps?: Omit<FormLayoutProps, 'layout'>;
18
+ stopPropagation?: boolean;
19
+ preventDefault?: boolean;
18
20
  onSubmit: SubmitHandler<T>;
19
21
  onError?: () => any;
20
22
  onCancel?: () => void;
21
23
  onFormUnMount?: () => void;
22
24
  }
23
- declare const _Form: <T extends object = {}>({ children, form, formMode, reValidateMode, defaultValues, onSubmit, onFormUnMount, onCancel, withActions, actionsProps, errorMessageProps, layout, layoutProps, onError, ...rest }: FormProps<T>) => import("react/jsx-runtime.js").JSX.Element;
25
+ declare const _Form: <T extends object = {}>({ children, form, formMode, reValidateMode, defaultValues, onSubmit, onFormUnMount, onCancel, withActions, actionsProps, errorMessageProps, layout, layoutProps, onError, stopPropagation, preventDefault, ...rest }: FormProps<T>) => import("react/jsx-runtime.js").JSX.Element;
24
26
  type FormType = typeof _Form;
25
27
  export declare const Form: FormType & {
26
28
  Actions: typeof FormActions;
@@ -22,6 +22,8 @@ const _Form = ({
22
22
  layout = "vertical",
23
23
  layoutProps,
24
24
  onError,
25
+ stopPropagation,
26
+ preventDefault,
25
27
  ...rest
26
28
  }) => {
27
29
  const [submitError, setSubmitError] = useSafeState("");
@@ -49,21 +51,37 @@ const _Form = ({
49
51
  const handleDismissErrorMessage = () => {
50
52
  setSubmitError("");
51
53
  };
52
- return /* @__PURE__ */ jsxRuntimeExports.jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { component: "form", ...rest, onSubmit: handleSubmit(submit), children: [
53
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { layout, ...layoutProps, children }),
54
- withActions && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
55
- submitError && /* @__PURE__ */ jsxRuntimeExports.jsx(
56
- FormErrorMessage,
57
- {
58
- mt: 24,
59
- message: submitError,
60
- onDismiss: handleDismissErrorMessage,
61
- ...errorMessageProps
54
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
55
+ Box,
56
+ {
57
+ component: "form",
58
+ ...rest,
59
+ onSubmit: (e) => {
60
+ if (stopPropagation) {
61
+ e == null ? void 0 : e.stopPropagation();
62
62
  }
63
- ),
64
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormActions, { onCancel, loading: submitting, ...actionsProps })
65
- ] })
66
- ] }) });
63
+ if (preventDefault) {
64
+ e == null ? void 0 : e.preventDefault();
65
+ }
66
+ return handleSubmit(submit)(e);
67
+ },
68
+ children: [
69
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { layout, ...layoutProps, children }),
70
+ withActions && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
71
+ submitError && /* @__PURE__ */ jsxRuntimeExports.jsx(
72
+ FormErrorMessage,
73
+ {
74
+ mt: 24,
75
+ message: submitError,
76
+ onDismiss: handleDismissErrorMessage,
77
+ ...errorMessageProps
78
+ }
79
+ ),
80
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FormActions, { onCancel, loading: submitting, ...actionsProps })
81
+ ] })
82
+ ]
83
+ }
84
+ ) });
67
85
  };
68
86
  const Form = _Form;
69
87
  Form.Actions = FormActions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tidbcloud/uikit",
3
- "version": "2.0.0-beta.50",
3
+ "version": "2.0.0-beta.52",
4
4
  "description": "tidbcloud uikit",
5
5
  "type": "module",
6
6
  "main": "dist/primitive/index.cjs",