x-star-design 0.0.45 → 0.0.46

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.
@@ -387,20 +387,6 @@
387
387
  margin: 15px 10px 20px 0;
388
388
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
389
389
  }
390
- .x-star-design-titleSection img {
391
- width: 1em;
392
- height: 1em;
393
- display: inline-flex;
394
- align-items: center;
395
- color: inherit;
396
- font-style: normal;
397
- line-height: 0;
398
- text-align: center;
399
- text-transform: none;
400
- vertical-align: -0.125em;
401
- text-rendering: optimizelegibility;
402
- -webkit-font-smoothing: antialiased;
403
- }
404
390
  .x-star-design-titleSection .x-star-design-title {
405
391
  color: #000;
406
392
  margin: 0 10px;
@@ -472,29 +458,37 @@
472
458
  }
473
459
  .x-star-design-XTabs .x-star-design-tabs-nav-wrap,
474
460
  .x-star-design-XTabs .ant-tabs-nav-wrap {
475
- background-color: #e3ecff;
461
+ background-color: var(--xtabs-secondary-color);
476
462
  }
477
463
  .x-star-design-XTabs.x-star-design-tabs-card > .x-star-design-tabs-nav .x-star-design-tabs-tab, .x-star-design-XTabs.ant-tabs-card > .ant-tabs-nav .ant-tabs-tab {
478
464
  width: 130px;
479
465
  height: 130px;
480
- background-color: #e3ecff;
466
+ background-color: unset;
481
467
  display: flex;
482
468
  align-content: center;
483
469
  align-items: center;
484
470
  justify-content: center;
485
471
  border: 0;
472
+ color: #9e9e9e;
486
473
  }
487
474
  .x-star-design-XTabs.x-star-design-tabs-card > .x-star-design-tabs-nav .x-star-design-tabs-tab-active, .x-star-design-XTabs.ant-tabs-card > .ant-tabs-nav .ant-tabs-tab-active {
488
- border-left: 6px solid #1890ff;
475
+ border-left: 6px solid var(--xtabs-primary-color);
489
476
  background-color: #fff;
490
477
  transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
491
478
  border-radius: 0;
492
479
  }
480
+ .x-star-design-XTabs.x-star-design-tabs .x-star-design-tabs-tab:hover, .x-star-design-XTabs.ant-tabs .ant-tabs-tab:hover {
481
+ color: var(--xtabs-primary-color);
482
+ }
493
483
  .x-star-design-XTabs .x-star-design-tabs-tab-btn,
494
484
  .x-star-design-XTabs .ant-tabs-tab-btn {
495
485
  text-align: center;
496
486
  white-space: normal;
497
487
  }
488
+ .x-star-design-XTabs .x-star-design-tabs-content-holder,
489
+ .x-star-design-XTabs .ant-tabs-content-holder {
490
+ border-left: 0;
491
+ }
498
492
  .x-star-design-XTabs .x-star-design-tabs-content,
499
493
  .x-star-design-XTabs .ant-tabs-content {
500
494
  display: flex;
@@ -1,19 +1,25 @@
1
+ import { RightSquareFilled } from '@ant-design/icons';
2
+ import { ConfigContext } from 'antd/es/config-provider';
1
3
  import classNames from 'classnames';
2
- import React from 'react';
3
- import rightSvg from "../assets/title-with-icon/right.svg";
4
+ import React, { useContext } from 'react';
4
5
  import { prefix } from "../utils/global";
5
6
  var TitleWithIcon = function TitleWithIcon(_ref) {
6
7
  var className = _ref.className,
7
8
  title = _ref.title,
8
9
  description = _ref.description,
9
10
  id = _ref.id;
11
+ var _useContext = useContext(ConfigContext),
12
+ theme = _useContext.theme;
13
+ var _ref2 = (theme === null || theme === void 0 ? void 0 : theme.token) || {},
14
+ colorPrimary = _ref2.colorPrimary;
10
15
  return /*#__PURE__*/React.createElement("div", {
11
16
  "data-testid": "wrapper",
12
17
  className: classNames(className, "".concat(prefix, "-titleSection")),
13
18
  id: id
14
- }, /*#__PURE__*/React.createElement("img", {
15
- src: rightSvg,
16
- alt: ""
19
+ }, /*#__PURE__*/React.createElement(RightSquareFilled, {
20
+ style: {
21
+ color: colorPrimary || '#1990fe'
22
+ }
17
23
  }), /*#__PURE__*/React.createElement("span", {
18
24
  "data-testid": "title",
19
25
  className: "".concat(prefix, "-title")
@@ -3,12 +3,46 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
4
  var _excluded = ["items"];
5
5
  import { Tabs } from 'antd';
6
- import React, { useMemo } from 'react';
6
+ import { ConfigContext } from 'antd/es/config-provider';
7
+ import React, { useContext, useEffect, useMemo, useRef } from 'react';
7
8
  import ConfigProviderWrapper from "../config-provider-wrapper";
8
9
  import { prefix } from "../utils/global";
10
+ //hash颜色转换rgba
11
+ function hexToRGBA(hex, alpha) {
12
+ var r = '',
13
+ g = '',
14
+ b = '';
15
+ if (hex.length === 4) {
16
+ r = '0x' + hex[1] + hex[1];
17
+ g = '0x' + hex[2] + hex[2];
18
+ b = '0x' + hex[3] + hex[3];
19
+ } else {
20
+ r = '0x' + hex[1] + hex[2];
21
+ g = '0x' + hex[3] + hex[4];
22
+ b = '0x' + hex[5] + hex[6];
23
+ }
24
+ return "rgba(".concat(+r, ",").concat(+g, ",").concat(+b, ",").concat(alpha, ")");
25
+ }
9
26
  var XTabs = function XTabs(_ref) {
10
27
  var items = _ref.items,
11
28
  props = _objectWithoutProperties(_ref, _excluded);
29
+ var _useContext = useContext(ConfigContext),
30
+ theme = _useContext.theme;
31
+ var _ref2 = (theme === null || theme === void 0 ? void 0 : theme.token) || {},
32
+ _ref2$colorPrimary = _ref2.colorPrimary,
33
+ colorPrimary = _ref2$colorPrimary === void 0 ? '#1990fe' : _ref2$colorPrimary;
34
+ var colorThemeRef = useRef(null);
35
+ useEffect(function () {
36
+ var _colorThemeRef$curren, _colorThemeRef$curren2;
37
+ //设置主题色
38
+ (_colorThemeRef$curren = colorThemeRef.current) === null || _colorThemeRef$curren === void 0 ? void 0 : _colorThemeRef$curren.style.setProperty('--xtabs-primary-color', colorPrimary);
39
+ (_colorThemeRef$curren2 = colorThemeRef.current) === null || _colorThemeRef$curren2 === void 0 ? void 0 : _colorThemeRef$curren2.style.setProperty('--xtabs-secondary-color', hexToRGBA(colorPrimary, 0.15));
40
+ return function () {
41
+ var _colorThemeRef$curren3, _colorThemeRef$curren4;
42
+ (_colorThemeRef$curren3 = colorThemeRef.current) === null || _colorThemeRef$curren3 === void 0 ? void 0 : _colorThemeRef$curren3.style.removeProperty('--xtabs-primary-color');
43
+ (_colorThemeRef$curren4 = colorThemeRef.current) === null || _colorThemeRef$curren4 === void 0 ? void 0 : _colorThemeRef$curren4.style.removeProperty('--xtabs-secondary-color');
44
+ };
45
+ }, []);
12
46
  var newItems = useMemo(function () {
13
47
  return items === null || items === void 0 ? void 0 : items.map(function (item) {
14
48
  return _objectSpread(_objectSpread({}, item), {}, {
@@ -22,13 +56,16 @@ var XTabs = function XTabs(_ref) {
22
56
  });
23
57
  });
24
58
  }, [items]);
25
- return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement(Tabs, _extends({
59
+ return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement("div", {
60
+ ref: colorThemeRef,
61
+ "data-testid": 'xtabsColorTheme'
62
+ }, /*#__PURE__*/React.createElement(Tabs, _extends({
26
63
  className: "".concat(prefix, "-XTabs"),
27
64
  tabPosition: 'left',
28
65
  size: "large",
29
66
  type: "card",
30
67
  destroyInactiveTabPane: true,
31
68
  items: newItems
32
- }, props)));
69
+ }, props))));
33
70
  };
34
71
  export default XTabs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-star-design",
3
- "version": "0.0.45",
3
+ "version": "0.0.46",
4
4
  "description": "A react component library developed by turingstar",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -82,7 +82,7 @@
82
82
  "@types/react-dom": "^18.0.0",
83
83
  "@types/react-window": "^1.8.5",
84
84
  "@umijs/lint": "^4.0.0",
85
- "antd": "5.2.2",
85
+ "antd": "5.10.0",
86
86
  "babel-plugin-inline-import-data-uri": "^1.0.1",
87
87
  "dumi": "^2.2.0",
88
88
  "eslint": "^8.23.0",