@tidbcloud/uikit 2.0.0-beta.96 → 2.0.0-beta.97

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,16 @@
1
1
  # @tidbcloud/uikit
2
2
 
3
+ ## 2.0.0-beta.97
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: make default key exported and add some desc, this is still a PR for the release
8
+ - Feat/search area bug fix ([#364](https://github.com/tidbcloud/tidbcloud-uikit/pull/364))
9
+ - feat: Commit the generated changeset file
10
+ - Feat/search area fix ([#363](https://github.com/tidbcloud/tidbcloud-uikit/pull/363))
11
+ - fix(theme): enhance ActionIcon styles with size and hover effects ([#362](https://github.com/tidbcloud/tidbcloud-uikit/pull/362))
12
+ - fix(theme): add border bottom to Modal header for improved styling consistency ([#361](https://github.com/tidbcloud/tidbcloud-uikit/pull/361))
13
+
3
14
  ## 2.0.0-beta.96
4
15
 
5
16
  ### Patch Changes
@@ -132,11 +132,11 @@ function FormItemRender(props) {
132
132
  return null;
133
133
  }
134
134
  }
135
- const FORM_STATE_KEY = "__fs__";
135
+ const DEFAULT_FORM_STATE_KEY = "__fs__";
136
136
  function SearchArea(props) {
137
137
  const { data, onSubmit, recoverFromURLEnabled, defaultValues, formStateQueryKey, ...rest } = props;
138
138
  const [resetSeed, setResetSeed] = React.useState(0);
139
- const [formState, setFormState] = useURLQueryState.useURLQueryState(formStateQueryKey ?? FORM_STATE_KEY, defaultValues);
139
+ const [formState, setFormState] = useURLQueryState.useURLQueryState(formStateQueryKey ?? DEFAULT_FORM_STATE_KEY, defaultValues);
140
140
  const state = recoverFromURLEnabled ? formState : defaultValues;
141
141
  const form = reactHookForm.useForm({ defaultValues: state });
142
142
  const handleSubmit = () => {
@@ -149,6 +149,11 @@ function SearchArea(props) {
149
149
  form.reset(defaultValues);
150
150
  recoverFromURLEnabled && setFormState(defaultValues);
151
151
  };
152
+ React.useEffect(() => {
153
+ if (recoverFromURLEnabled) {
154
+ handleSubmit();
155
+ }
156
+ }, []);
152
157
  return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Box.Box, { children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Form.Form, { onSubmit, ...rest, form, errorMessageProps: { mx: 16 }, withActions: false, children: [
153
158
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Box.Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Box.Box, { sx: { display: "flex", gap: 16, flexWrap: "wrap" }, children: [
154
159
  data.map((x) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
@@ -162,11 +167,11 @@ function SearchArea(props) {
162
167
  x.name
163
168
  )),
164
169
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Box.Box, { sx: SX_Y_MID, children: [
165
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Box.Box, { sx: SX_Y_MID, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(index.Button, { variant: "subtle", color: "carbon.8", onClick: handleReset, children: [
170
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Box.Box, { sx: SX_Y_MID, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(index.Button, { variant: "subtle", onClick: handleReset, children: [
166
171
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(index$1.IconEraser, { size: 16, style: { marginRight: 4 } }),
167
172
  "Clear Filters"
168
173
  ] }) }),
169
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Box.Box, { ml: 16, sx: SX_Y_MID, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(index.Button, { variant: "subtle", color: "carbon.8", onClick: handleSubmit, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(index$1.IconRefreshCw01, { size: 16 }) }) })
174
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Box.Box, { ml: 16, sx: SX_Y_MID, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(index.Button, { variant: "subtle", onClick: handleSubmit, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(index$1.IconRefreshCw01, { size: 16 }) }) })
170
175
  ] })
171
176
  ] }) }),
172
177
  props.debugEnabled && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Box.Box, { sx: { height: 320 }, children: [
@@ -174,8 +179,9 @@ function SearchArea(props) {
174
179
  "result = ",
175
180
  JSON.stringify(form.getValues(), null, 4)
176
181
  ] }),
177
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(index.Button, { onClick: () => window.location.reload(), children: "Refresh Page" })
182
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(index.Button, { variant: "light", onClick: () => window.location.reload(), children: "Refresh Page" })
178
183
  ] })
179
184
  ] }) });
180
185
  }
186
+ exports.DEFAULT_FORM_STATE_KEY = DEFAULT_FORM_STATE_KEY;
181
187
  exports.SearchArea = SearchArea;
@@ -43,5 +43,9 @@ export interface SearchAreaProps<T extends FieldValues> extends FormProps<T> {
43
43
  */
44
44
  formStateQueryKey?: string;
45
45
  }
46
+ /**
47
+ * Please use `formStateQueryKey` instead if you have multiple <SearchArea /> components in the same page
48
+ */
49
+ export declare const DEFAULT_FORM_STATE_KEY = "__fs__";
46
50
  export declare function SearchArea<T extends object>(props: SearchAreaProps<T>): import("react/jsx-runtime.js").JSX.Element;
47
51
  export {};
@@ -43,5 +43,9 @@ export interface SearchAreaProps<T extends FieldValues> extends FormProps<T> {
43
43
  */
44
44
  formStateQueryKey?: string;
45
45
  }
46
+ /**
47
+ * Please use `formStateQueryKey` instead if you have multiple <SearchArea /> components in the same page
48
+ */
49
+ export declare const DEFAULT_FORM_STATE_KEY = "__fs__";
46
50
  export declare function SearchArea<T extends object>(props: SearchAreaProps<T>): import("react/jsx-runtime.js").JSX.Element;
47
51
  export {};
@@ -130,11 +130,11 @@ function FormItemRender(props) {
130
130
  return null;
131
131
  }
132
132
  }
133
- const FORM_STATE_KEY = "__fs__";
133
+ const DEFAULT_FORM_STATE_KEY = "__fs__";
134
134
  function SearchArea(props) {
135
135
  const { data, onSubmit, recoverFromURLEnabled, defaultValues, formStateQueryKey, ...rest } = props;
136
136
  const [resetSeed, setResetSeed] = useState(0);
137
- const [formState, setFormState] = useURLQueryState(formStateQueryKey ?? FORM_STATE_KEY, defaultValues);
137
+ const [formState, setFormState] = useURLQueryState(formStateQueryKey ?? DEFAULT_FORM_STATE_KEY, defaultValues);
138
138
  const state = recoverFromURLEnabled ? formState : defaultValues;
139
139
  const form = useForm({ defaultValues: state });
140
140
  const handleSubmit = () => {
@@ -147,6 +147,11 @@ function SearchArea(props) {
147
147
  form.reset(defaultValues);
148
148
  recoverFromURLEnabled && setFormState(defaultValues);
149
149
  };
150
+ useEffect(() => {
151
+ if (recoverFromURLEnabled) {
152
+ handleSubmit();
153
+ }
154
+ }, []);
150
155
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Form, { onSubmit, ...rest, form, errorMessageProps: { mx: 16 }, withActions: false, children: [
151
156
  /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { sx: { display: "flex", gap: 16, flexWrap: "wrap" }, children: [
152
157
  data.map((x) => /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -160,11 +165,11 @@ function SearchArea(props) {
160
165
  x.name
161
166
  )),
162
167
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { sx: SX_Y_MID, children: [
163
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { sx: SX_Y_MID, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "subtle", color: "carbon.8", onClick: handleReset, children: [
168
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { sx: SX_Y_MID, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "subtle", onClick: handleReset, children: [
164
169
  /* @__PURE__ */ jsxRuntimeExports.jsx(IconEraser, { size: 16, style: { marginRight: 4 } }),
165
170
  "Clear Filters"
166
171
  ] }) }),
167
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { ml: 16, sx: SX_Y_MID, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "subtle", color: "carbon.8", onClick: handleSubmit, children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconRefreshCw01, { size: 16 }) }) })
172
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { ml: 16, sx: SX_Y_MID, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "subtle", onClick: handleSubmit, children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconRefreshCw01, { size: 16 }) }) })
168
173
  ] })
169
174
  ] }) }),
170
175
  props.debugEnabled && /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { sx: { height: 320 }, children: [
@@ -172,10 +177,11 @@ function SearchArea(props) {
172
177
  "result = ",
173
178
  JSON.stringify(form.getValues(), null, 4)
174
179
  ] }),
175
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: () => window.location.reload(), children: "Refresh Page" })
180
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "light", onClick: () => window.location.reload(), children: "Refresh Page" })
176
181
  ] })
177
182
  ] }) });
178
183
  }
179
184
  export {
185
+ DEFAULT_FORM_STATE_KEY,
180
186
  SearchArea
181
187
  };
@@ -41,6 +41,7 @@ exports.CodeBlock = index$1.CodeBlock;
41
41
  exports.CopyText = index$1.CopyText;
42
42
  exports.PhoneInput = index$2.PhoneInput;
43
43
  exports.DotBadge = index$3.DotBadge;
44
+ exports.DEFAULT_FORM_STATE_KEY = index$4.DEFAULT_FORM_STATE_KEY;
44
45
  exports.SearchArea = index$4.SearchArea;
45
46
  exports.LabelTooltip = index$5.LabelTooltip;
46
47
  exports.Tree = index$7.Tree;
package/dist/biz/index.js CHANGED
@@ -2,7 +2,7 @@ import { Dot } from "./Dot/index.js";
2
2
  import { CodeBlock, CopyText } from "./CodeBlock/index.js";
3
3
  import { PhoneInput } from "./PhoneInput/index.js";
4
4
  import { DotBadge } from "./DotBadge/index.js";
5
- import { SearchArea } from "./SearchArea/index.js";
5
+ import { DEFAULT_FORM_STATE_KEY, SearchArea } from "./SearchArea/index.js";
6
6
  import { LabelTooltip } from "./LabelTooltip/index.js";
7
7
  import { Tree } from "./Tree/index.js";
8
8
  import { TransferTree } from "./TransferTree/index.js";
@@ -37,6 +37,7 @@ import { DEFAULT_QUICK_RANGES, DEFAULT_TIME_FORMAT, DEFAULT_TIME_FORMAT_WITH_TIM
37
37
  export {
38
38
  CodeBlock,
39
39
  CopyText,
40
+ DEFAULT_FORM_STATE_KEY,
40
41
  DEFAULT_QUICK_RANGES,
41
42
  DEFAULT_TIME_FORMAT,
42
43
  DEFAULT_TIME_FORMAT_WITH_TIMEZONE,
@@ -813,7 +813,8 @@ const theme = createTheme.createTheme({
813
813
  borderTopRightRadius: theme2.defaultRadius,
814
814
  padding: "16px 16px 16px 24px",
815
815
  margin: 0,
816
- backgroundColor: themeColor(theme2, "carbon", 1)
816
+ backgroundColor: themeColor(theme2, "carbon", 1),
817
+ borderBottom: `1px solid ${themeColor(theme2, "carbon", 4)}`
817
818
  },
818
819
  title: {
819
820
  fontWeight: 700,
@@ -989,7 +990,8 @@ const theme = createTheme.createTheme({
989
990
  ActionIcon: {
990
991
  defaultProps: {
991
992
  variant: "subtle",
992
- color: "carbon"
993
+ color: "carbon",
994
+ size: "md"
993
995
  },
994
996
  styles(theme2, props) {
995
997
  const color = props.color ?? theme2.primaryColor;
@@ -1017,14 +1019,18 @@ const theme = createTheme.createTheme({
1017
1019
  },
1018
1020
  transparent: {
1019
1021
  backgroundColor: "transparent",
1020
- color: themeColor(theme2, color, shade)
1022
+ color: themeColor(theme2, color, shade),
1023
+ "&:hover": {
1024
+ color: themeColor(theme2, color, shade)
1025
+ }
1021
1026
  },
1022
1027
  subtle: {
1023
1028
  backgroundColor: "transparent",
1024
1029
  color: themeColor(theme2, color, 8),
1025
1030
  borderColor: "transparent",
1026
1031
  "&:hover": {
1027
- backgroundColor: themeColor(theme2, color, 3)
1032
+ backgroundColor: themeColor(theme2, color, 3),
1033
+ color: themeColor(theme2, color, 8)
1028
1034
  },
1029
1035
  "&:active": {
1030
1036
  backgroundColor: themeColor(theme2, color, 4)
@@ -1041,18 +1047,23 @@ const theme = createTheme.createTheme({
1041
1047
  color: themeColor(theme2, color, shade),
1042
1048
  border: `1px solid ${themeColor(theme2, color, 4)}`,
1043
1049
  "&:hover": {
1044
- backgroundColor: themeColor(theme2, color, 2)
1050
+ backgroundColor: themeColor(theme2, color, 2),
1051
+ color: themeColor(theme2, color, shade)
1045
1052
  }
1046
1053
  },
1047
1054
  filled: {
1048
1055
  backgroundColor: themeColor(theme2, color, color.includes("carbon") ? 9 : 7),
1049
- color: theme2.white
1056
+ color: theme2.white,
1057
+ "&:hover": {
1058
+ color: theme2.white
1059
+ }
1050
1060
  },
1051
1061
  light: {
1052
1062
  backgroundColor: themeColor(theme2, color, 3),
1053
1063
  color: themeColor(theme2, color, 8),
1054
1064
  "&:hover": {
1055
- backgroundColor: themeColor(theme2, color, 4)
1065
+ backgroundColor: themeColor(theme2, color, 4),
1066
+ color: themeColor(theme2, color, 8)
1056
1067
  },
1057
1068
  "&:active": {
1058
1069
  backgroundColor: themeColor(theme2, color, 5)
@@ -1071,10 +1082,7 @@ const theme = createTheme.createTheme({
1071
1082
  return {
1072
1083
  root: {
1073
1084
  ...variantStyle,
1074
- width: size,
1075
- height: size,
1076
- minWidth: size,
1077
- minHeight: size
1085
+ "--ai-size": size
1078
1086
  }
1079
1087
  };
1080
1088
  }
@@ -811,7 +811,8 @@ const theme = createTheme({
811
811
  borderTopRightRadius: theme2.defaultRadius,
812
812
  padding: "16px 16px 16px 24px",
813
813
  margin: 0,
814
- backgroundColor: themeColor(theme2, "carbon", 1)
814
+ backgroundColor: themeColor(theme2, "carbon", 1),
815
+ borderBottom: `1px solid ${themeColor(theme2, "carbon", 4)}`
815
816
  },
816
817
  title: {
817
818
  fontWeight: 700,
@@ -987,7 +988,8 @@ const theme = createTheme({
987
988
  ActionIcon: {
988
989
  defaultProps: {
989
990
  variant: "subtle",
990
- color: "carbon"
991
+ color: "carbon",
992
+ size: "md"
991
993
  },
992
994
  styles(theme2, props) {
993
995
  const color = props.color ?? theme2.primaryColor;
@@ -1015,14 +1017,18 @@ const theme = createTheme({
1015
1017
  },
1016
1018
  transparent: {
1017
1019
  backgroundColor: "transparent",
1018
- color: themeColor(theme2, color, shade)
1020
+ color: themeColor(theme2, color, shade),
1021
+ "&:hover": {
1022
+ color: themeColor(theme2, color, shade)
1023
+ }
1019
1024
  },
1020
1025
  subtle: {
1021
1026
  backgroundColor: "transparent",
1022
1027
  color: themeColor(theme2, color, 8),
1023
1028
  borderColor: "transparent",
1024
1029
  "&:hover": {
1025
- backgroundColor: themeColor(theme2, color, 3)
1030
+ backgroundColor: themeColor(theme2, color, 3),
1031
+ color: themeColor(theme2, color, 8)
1026
1032
  },
1027
1033
  "&:active": {
1028
1034
  backgroundColor: themeColor(theme2, color, 4)
@@ -1039,18 +1045,23 @@ const theme = createTheme({
1039
1045
  color: themeColor(theme2, color, shade),
1040
1046
  border: `1px solid ${themeColor(theme2, color, 4)}`,
1041
1047
  "&:hover": {
1042
- backgroundColor: themeColor(theme2, color, 2)
1048
+ backgroundColor: themeColor(theme2, color, 2),
1049
+ color: themeColor(theme2, color, shade)
1043
1050
  }
1044
1051
  },
1045
1052
  filled: {
1046
1053
  backgroundColor: themeColor(theme2, color, color.includes("carbon") ? 9 : 7),
1047
- color: theme2.white
1054
+ color: theme2.white,
1055
+ "&:hover": {
1056
+ color: theme2.white
1057
+ }
1048
1058
  },
1049
1059
  light: {
1050
1060
  backgroundColor: themeColor(theme2, color, 3),
1051
1061
  color: themeColor(theme2, color, 8),
1052
1062
  "&:hover": {
1053
- backgroundColor: themeColor(theme2, color, 4)
1063
+ backgroundColor: themeColor(theme2, color, 4),
1064
+ color: themeColor(theme2, color, 8)
1054
1065
  },
1055
1066
  "&:active": {
1056
1067
  backgroundColor: themeColor(theme2, color, 5)
@@ -1069,10 +1080,7 @@ const theme = createTheme({
1069
1080
  return {
1070
1081
  root: {
1071
1082
  ...variantStyle,
1072
- width: size,
1073
- height: size,
1074
- minWidth: size,
1075
- minHeight: size
1083
+ "--ai-size": size
1076
1084
  }
1077
1085
  };
1078
1086
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tidbcloud/uikit",
3
- "version": "2.0.0-beta.96",
3
+ "version": "2.0.0-beta.97",
4
4
  "description": "tidbcloud uikit",
5
5
  "type": "module",
6
6
  "main": "dist/primitive/index.cjs",