@oceanbase/design 1.0.0-alpha.20 → 1.0.0-alpha.22

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.
@@ -140,6 +140,17 @@ var ConfigProvider = function ConfigProvider(_ref5) {
140
140
  var parentStyleContext = React.useContext(StyleContext);
141
141
  var mergedStyleProviderProps = merge({}, parentStyleContext, styleProviderProps);
142
142
  var mergedLocale = merge({}, parentContext.locale, locale);
143
+ var resolvedAntTheme = merge({}, mergedTheme, getLocaleFontSizeThemePatch(mergedLocale, mergedTheme, fontSize), {
144
+ token: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontFamily', fontFamily, fontFamilyEn)), getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeightWeak', fontWeightWeak, fontWeightWeakEn)), getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeight', fontWeight, fontWeightEn)), getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeightStrong', fontWeightStrong, fontWeightStrongEn))
145
+ });
146
+
147
+ // cssVar 模式下 App 必须有真实 DOM 节点挂载 cssVarCls,component={false} 会导致变量作用域丢失
148
+ var cssVarEnabled = Boolean(resolvedAntTheme === null || resolvedAntTheme === void 0 ? void 0 : resolvedAntTheme.cssVar);
149
+ var resolvedAppProps = merge({}, cssVarEnabled ? {
150
+ component: 'div'
151
+ } : {
152
+ component: false
153
+ }, appProps);
143
154
  return /*#__PURE__*/_jsx(AntConfigProvider, _objectSpread(_objectSpread({
144
155
  locale: mergedLocale,
145
156
  wave: merge({}, {
@@ -181,9 +192,7 @@ var ConfigProvider = function ConfigProvider(_ref5) {
181
192
  }
182
193
  }, parentContext.table, table),
183
194
  tabs: merge({}, parentContext.tabs, tabs),
184
- theme: merge({}, mergedTheme, getLocaleFontSizeThemePatch(mergedLocale, mergedTheme, fontSize), {
185
- token: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontFamily', fontFamily, fontFamilyEn)), getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeightWeak', fontWeightWeak, fontWeightWeakEn)), getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeight', fontWeight, fontWeightEn)), getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeightStrong', fontWeightStrong, fontWeightStrongEn))
186
- }),
195
+ theme: resolvedAntTheme,
187
196
  renderEmpty: parentContext.renderEmpty || function (componentName) {
188
197
  return /*#__PURE__*/_jsx(DefaultRenderEmpty, {
189
198
  componentName: componentName
@@ -201,9 +210,7 @@ var ConfigProvider = function ConfigProvider(_ref5) {
201
210
  children: [/*#__PURE__*/_jsx(CssVariablesStyle, {}), /*#__PURE__*/_jsx(GlobalStyle, {
202
211
  prefixCls: restProps.prefixCls,
203
212
  iconPrefixCls: restProps.iconPrefixCls
204
- }), /*#__PURE__*/_jsxs(App, _objectSpread(_objectSpread({
205
- component: false
206
- }, appProps), {}, {
213
+ }), /*#__PURE__*/_jsxs(App, _objectSpread(_objectSpread({}, resolvedAppProps), {}, {
207
214
  children: [children, parentExtendedContext.injectStaticFunction && /*#__PURE__*/_jsx(StaticFunction, {})]
208
215
  }))]
209
216
  }))
@@ -3,19 +3,19 @@ import type { DescriptionsItemType } from '..';
3
3
  export default function useItems(items?: DescriptionsItemType[], children?: React.ReactNode, bordered?: boolean): {
4
4
  children: string | number | boolean | Iterable<React.ReactNode> | import("@emotion/react/jsx-runtime").JSX.Element;
5
5
  key?: React.Key;
6
- className?: string;
7
6
  label?: React.ReactNode;
8
7
  span?: number | "filled" | {
9
- xxl?: number;
10
- xl?: number;
11
- lg?: number;
12
- md?: number;
13
- sm?: number;
14
8
  xs?: number;
9
+ sm?: number;
10
+ md?: number;
11
+ lg?: number;
12
+ xl?: number;
13
+ xxl?: number;
15
14
  };
16
15
  style?: React.CSSProperties;
17
16
  classNames?: Partial<Record<"label" | "content", string>>;
18
17
  styles?: Partial<Record<"label" | "content", React.CSSProperties>>;
18
+ className?: string;
19
19
  labelStyle?: React.CSSProperties;
20
20
  contentStyle?: React.CSSProperties;
21
21
  }[];
@@ -4,7 +4,7 @@ import type { FormItemProps as AntFormItemProps } from 'antd/es/form';
4
4
  import type { TooltipProps } from '../tooltip';
5
5
  declare const AntFormItem: (<Values = any>(props: AntFormItemProps<Values>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
6
6
  useStatus: () => {
7
- status?: "" | "error" | "warning" | "success" | "validating";
7
+ status?: "" | "success" | "warning" | "error" | "validating";
8
8
  errors: React.ReactNode[];
9
9
  warnings: React.ReactNode[];
10
10
  };
@@ -10,10 +10,15 @@ var genSizeStyle = function genSizeStyle(spinDotSize, token) {
10
10
  colorText = token.colorText;
11
11
  var spinDotWidth = spinDotSize;
12
12
  var spinDotHight = spinDotWidth;
13
- return _defineProperty({}, "&".concat(componentCls, "-oceanbase"), _defineProperty(_defineProperty({}, "".concat(componentCls, "-dot"), {
13
+ return _defineProperty({}, "&".concat(componentCls, "-oceanbase"), _defineProperty(_defineProperty({}, "".concat(componentCls, "-dot"), _defineProperty({
14
14
  width: spinDotWidth,
15
- height: spinDotHight
16
- }), "".concat(componentCls, "-text"), {
15
+ height: spinDotHight,
16
+ overflow: 'hidden',
17
+ lineHeight: 0
18
+ }, "> div", {
19
+ width: '100%',
20
+ height: '100%'
21
+ })), "".concat(componentCls, "-text"), {
17
22
  width: spinDotWidth,
18
23
  color: colorText
19
24
  }));
@@ -15,7 +15,7 @@ import 'antd/dist/reset.css';
15
15
  import { Fragment as _Fragment } from "react/jsx-runtime";
16
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
17
  var genGlobalStyle = function genGlobalStyle(token, prefixCls, iconPrefixCls) {
18
- var _token$lineWidthFocus, _ref;
18
+ var _ref;
19
19
  var antCls = ".".concat(prefixCls);
20
20
  var iconCls = ".".concat(iconPrefixCls);
21
21
  var buttonComponentCls = "".concat(antCls, "-btn");
@@ -80,15 +80,26 @@ var genGlobalStyle = function genGlobalStyle(token, prefixCls, iconPrefixCls) {
80
80
  'input::placeholder': {
81
81
  // affact all placeholder excluding select
82
82
  fontWeight: token.fontWeightWeak
83
+ },
84
+ // WCAG 2.4.7: native / non-ant focusables still need a visible ring (antd controls use token lineWidthFocus)
85
+ // [[
86
+ // `button:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`,
87
+ // `a:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`,
88
+ // `textarea:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`,
89
+ // `select:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`,
90
+ // `input:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`,
91
+ // `[role="button"]:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`,
92
+ // ].join(', ')]: {
93
+ // outline: `${token.lineWidthFocus ?? 2}px solid ${token.colorPrimary}`,
94
+ // outlineOffset: 2,
95
+ // },
96
+ '*': {
97
+ scrollbarColor: "".concat(token.colorFillSecondary, " transparent")
98
+ },
99
+ '.rc-virtual-list-scrollbar-thumb': {
100
+ background: "".concat(token.colorFillSecondary, " !important")
83
101
  }
84
- }, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, ["button:not([class^=\"".concat(prefixCls, "-\"]):not([class*=\" ").concat(prefixCls, "-\"]):focus-visible"), "a:not([class^=\"".concat(prefixCls, "-\"]):not([class*=\" ").concat(prefixCls, "-\"]):focus-visible"), "textarea:not([class^=\"".concat(prefixCls, "-\"]):not([class*=\" ").concat(prefixCls, "-\"]):focus-visible"), "select:not([class^=\"".concat(prefixCls, "-\"]):not([class*=\" ").concat(prefixCls, "-\"]):focus-visible"), "input:not([class^=\"".concat(prefixCls, "-\"]):not([class*=\" ").concat(prefixCls, "-\"]):focus-visible"), "[role=\"button\"]:not([class^=\"".concat(prefixCls, "-\"]):not([class*=\" ").concat(prefixCls, "-\"]):focus-visible")].join(', '), {
85
- outline: "".concat((_token$lineWidthFocus = token.lineWidthFocus) !== null && _token$lineWidthFocus !== void 0 ? _token$lineWidthFocus : 2, "px solid ").concat(token.colorPrimary),
86
- outlineOffset: 2
87
- }), '*', {
88
- scrollbarColor: "".concat(token.colorFillSecondary, " transparent")
89
- }), '.rc-virtual-list-scrollbar-thumb', {
90
- background: "".concat(token.colorFillSecondary, " !important")
91
- }), "[style*='font-size: 12px']", {
102
+ }, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, "[style*='font-size: 12px']", {
92
103
  fontWeight: token.fontWeightWeak
93
104
  }), 'a[href], a[data-aspm-param^="obcloud_openLink="]', _defineProperty({}, "&:not([disabled]):not([class^=\"".concat(prefixCls, "-\"]):hover"), {
94
105
  textDecoration: 'underline'
@@ -112,7 +123,7 @@ var genGlobalStyle = function genGlobalStyle(token, prefixCls, iconPrefixCls) {
112
123
  color: token.colorIcon
113
124
  }))), "".concat(selectComponentCls).concat(selectComponentCls, "-single").concat(selectComponentCls, "-open ").concat(selectComponentCls, "-selection-item"), {
114
125
  color: token.colorTextSecondary
115
- }), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, "".concat(pickerComponentCls), _defineProperty({}, "".concat(pickerComponentCls, "-clear ").concat(iconCls), _defineProperty({
126
+ }), "".concat(pickerComponentCls), _defineProperty({}, "".concat(pickerComponentCls, "-clear ").concat(iconCls), _defineProperty({
116
127
  color: token.gray7
117
128
  }, '&:hover', {
118
129
  color: token.gray8
@@ -125,7 +136,7 @@ var genGlobalStyle = function genGlobalStyle(token, prefixCls, iconPrefixCls) {
125
136
  color: token.colorIcon,
126
137
  // to avoid icon to be hidden when hover
127
138
  position: 'relative'
128
- })), "".concat(treeComponentCls, " ").concat(treeComponentCls, "-iconEle, ").concat(treeSelectComponentCls, " ").concat(treeSelectComponentCls, "-iconEle"), _defineProperty({}, "".concat(iconCls), {
139
+ })), _defineProperty(_defineProperty(_ref, "".concat(treeComponentCls, " ").concat(treeComponentCls, "-iconEle, ").concat(treeSelectComponentCls, " ").concat(treeSelectComponentCls, "-iconEle"), _defineProperty({}, "".concat(iconCls), {
129
140
  color: token.colorIcon
130
141
  })), "".concat(uploadComponentCls), _defineProperty({}, "".concat(iconCls), {
131
142
  color: token.colorIcon
@@ -198,6 +198,22 @@ const ConfigProvider = ({
198
198
  const parentStyleContext = _react.default.useContext(_StyleContext.default);
199
199
  const mergedStyleProviderProps = (0, _lodash.merge)({}, parentStyleContext, styleProviderProps);
200
200
  const mergedLocale = (0, _lodash.merge)({}, parentContext.locale, locale);
201
+ const resolvedAntTheme = (0, _lodash.merge)({}, mergedTheme, getLocaleFontSizeThemePatch(mergedLocale, mergedTheme, fontSize), {
202
+ token: {
203
+ ...getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontFamily', fontFamily, _default2.fontFamilyEn),
204
+ ...getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeightWeak', fontWeightWeak, _default2.fontWeightWeakEn),
205
+ ...getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeight', fontWeight, _default2.fontWeightEn),
206
+ ...getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeightStrong', fontWeightStrong, _default2.fontWeightStrongEn)
207
+ }
208
+ });
209
+
210
+ // cssVar 模式下 App 必须有真实 DOM 节点挂载 cssVarCls,component={false} 会导致变量作用域丢失
211
+ const cssVarEnabled = Boolean(resolvedAntTheme?.cssVar);
212
+ const resolvedAppProps = (0, _lodash.merge)({}, cssVarEnabled ? {
213
+ component: 'div'
214
+ } : {
215
+ component: false
216
+ }, appProps);
201
217
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.ConfigProvider, {
202
218
  locale: mergedLocale,
203
219
  wave: (0, _lodash.merge)({}, {
@@ -234,14 +250,7 @@ const ConfigProvider = ({
234
250
  }
235
251
  }, parentContext.table, table),
236
252
  tabs: (0, _lodash.merge)({}, parentContext.tabs, tabs),
237
- theme: (0, _lodash.merge)({}, mergedTheme, getLocaleFontSizeThemePatch(mergedLocale, mergedTheme, fontSize), {
238
- token: {
239
- ...getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontFamily', fontFamily, _default2.fontFamilyEn),
240
- ...getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeightWeak', fontWeightWeak, _default2.fontWeightWeakEn),
241
- ...getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeight', fontWeight, _default2.fontWeightEn),
242
- ...getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeightStrong', fontWeightStrong, _default2.fontWeightStrongEn)
243
- }
244
- }),
253
+ theme: resolvedAntTheme,
245
254
  renderEmpty: parentContext.renderEmpty || (componentName => /*#__PURE__*/(0, _jsxRuntime.jsx)(_DefaultRenderEmpty.default, {
246
255
  componentName: componentName
247
256
  })),
@@ -259,8 +268,7 @@ const ConfigProvider = ({
259
268
  prefixCls: restProps.prefixCls,
260
269
  iconPrefixCls: restProps.iconPrefixCls
261
270
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_app.default, {
262
- component: false,
263
- ...appProps,
271
+ ...resolvedAppProps,
264
272
  children: [children, parentExtendedContext.injectStaticFunction && /*#__PURE__*/(0, _jsxRuntime.jsx)(_staticFunction.default, {})]
265
273
  })]
266
274
  })
@@ -3,19 +3,19 @@ import type { DescriptionsItemType } from '..';
3
3
  export default function useItems(items?: DescriptionsItemType[], children?: React.ReactNode, bordered?: boolean): {
4
4
  children: string | number | boolean | Iterable<React.ReactNode> | import("@emotion/react/jsx-runtime").JSX.Element;
5
5
  key?: React.Key;
6
- className?: string;
7
6
  label?: React.ReactNode;
8
7
  span?: number | "filled" | {
9
- xxl?: number;
10
- xl?: number;
11
- lg?: number;
12
- md?: number;
13
- sm?: number;
14
8
  xs?: number;
9
+ sm?: number;
10
+ md?: number;
11
+ lg?: number;
12
+ xl?: number;
13
+ xxl?: number;
15
14
  };
16
15
  style?: React.CSSProperties;
17
16
  classNames?: Partial<Record<"label" | "content", string>>;
18
17
  styles?: Partial<Record<"label" | "content", React.CSSProperties>>;
18
+ className?: string;
19
19
  labelStyle?: React.CSSProperties;
20
20
  contentStyle?: React.CSSProperties;
21
21
  }[];
@@ -4,7 +4,7 @@ import type { FormItemProps as AntFormItemProps } from 'antd/es/form';
4
4
  import type { TooltipProps } from '../tooltip';
5
5
  declare const AntFormItem: (<Values = any>(props: AntFormItemProps<Values>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
6
6
  useStatus: () => {
7
- status?: "" | "error" | "warning" | "success" | "validating";
7
+ status?: "" | "success" | "warning" | "error" | "validating";
8
8
  errors: React.ReactNode[];
9
9
  warnings: React.ReactNode[];
10
10
  };
@@ -17,7 +17,13 @@ const genSizeStyle = (spinDotSize, token) => {
17
17
  [`&${componentCls}-oceanbase`]: {
18
18
  [`${componentCls}-dot`]: {
19
19
  width: spinDotWidth,
20
- height: spinDotHight
20
+ height: spinDotHight,
21
+ overflow: 'hidden',
22
+ lineHeight: 0,
23
+ [`> div`]: {
24
+ width: '100%',
25
+ height: '100%'
26
+ }
21
27
  },
22
28
  [`${componentCls}-text`]: {
23
29
  width: spinDotWidth,
@@ -82,10 +82,17 @@ const genGlobalStyle = (token, prefixCls, iconPrefixCls) => {
82
82
  fontWeight: token.fontWeightWeak
83
83
  },
84
84
  // WCAG 2.4.7: native / non-ant focusables still need a visible ring (antd controls use token lineWidthFocus)
85
- [[`button:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`, `a:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`, `textarea:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`, `select:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`, `input:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`, `[role="button"]:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`].join(', ')]: {
86
- outline: `${token.lineWidthFocus ?? 2}px solid ${token.colorPrimary}`,
87
- outlineOffset: 2
88
- },
85
+ // [[
86
+ // `button:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`,
87
+ // `a:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`,
88
+ // `textarea:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`,
89
+ // `select:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`,
90
+ // `input:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`,
91
+ // `[role="button"]:not([class^="${prefixCls}-"]):not([class*=" ${prefixCls}-"]):focus-visible`,
92
+ // ].join(', ')]: {
93
+ // outline: `${token.lineWidthFocus ?? 2}px solid ${token.colorPrimary}`,
94
+ // outlineOffset: 2,
95
+ // },
89
96
  '*': {
90
97
  scrollbarColor: `${token.colorFillSecondary} transparent`
91
98
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oceanbase/design",
3
- "version": "1.0.0-alpha.20",
3
+ "version": "1.0.0-alpha.22",
4
4
  "description": "The Design System of OceanBase",
5
5
  "keywords": [
6
6
  "oceanbase",
@@ -66,5 +66,5 @@
66
66
  "react": ">=16.9.0",
67
67
  "react-dom": ">=16.9.0"
68
68
  },
69
- "gitHead": "f61500e847937943de57d0d67d18df4abe5fe03b"
69
+ "gitHead": "5eca952eb89ecccc408d803fd6ab84cc4a878eef"
70
70
  }