musae 1.0.27-beta.2 → 1.0.27-beta.21

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.
Files changed (77) hide show
  1. package/dist/components/calendar/calendar.cjs +2 -2
  2. package/dist/components/calendar/calendar.mjs +2 -2
  3. package/dist/components/calendar/hooks.cjs +17 -17
  4. package/dist/components/calendar/hooks.d.ts +2 -2
  5. package/dist/components/calendar/hooks.mjs +17 -17
  6. package/dist/components/checkbox/checkbox.cjs +5 -26
  7. package/dist/components/checkbox/checkbox.mjs +3 -24
  8. package/dist/components/icon/icons/action/calendar-today.cjs +22 -0
  9. package/dist/components/icon/icons/action/calendar-today.d.ts +3 -0
  10. package/dist/components/icon/icons/action/calendar-today.mjs +18 -0
  11. package/dist/components/icon/icons/action/index.cjs +2 -0
  12. package/dist/components/icon/icons/action/index.d.ts +2 -1
  13. package/dist/components/icon/icons/action/index.mjs +1 -0
  14. package/dist/components/icon/icons/communication/index.d.ts +2 -0
  15. package/dist/components/icon/icons/communication/location-on.cjs +25 -0
  16. package/dist/components/icon/icons/communication/location-on.d.ts +3 -0
  17. package/dist/components/icon/icons/communication/location-on.mjs +21 -0
  18. package/dist/components/icon/icons/content/add.cjs +22 -0
  19. package/dist/components/icon/icons/content/add.d.ts +3 -0
  20. package/dist/components/icon/icons/content/add.mjs +18 -0
  21. package/dist/components/icon/icons/content/clear.cjs +2 -2
  22. package/dist/components/icon/icons/content/clear.d.ts +2 -2
  23. package/dist/components/icon/icons/content/clear.mjs +2 -2
  24. package/dist/components/icon/icons/content/index.cjs +4 -0
  25. package/dist/components/icon/icons/content/index.d.ts +3 -1
  26. package/dist/components/icon/icons/content/index.mjs +2 -0
  27. package/dist/components/icon/icons/content/remove.cjs +22 -0
  28. package/dist/components/icon/icons/content/remove.d.ts +3 -0
  29. package/dist/components/icon/icons/content/remove.mjs +18 -0
  30. package/dist/components/icon/icons/index.cjs +10 -0
  31. package/dist/components/icon/icons/index.d.ts +2 -0
  32. package/dist/components/icon/icons/index.mjs +5 -0
  33. package/dist/components/icon/icons/social/index.d.ts +2 -0
  34. package/dist/components/icon/icons/social/share.cjs +22 -0
  35. package/dist/components/icon/icons/social/share.d.ts +3 -0
  36. package/dist/components/icon/icons/social/share.mjs +18 -0
  37. package/dist/components/progress/linear.cjs +2 -2
  38. package/dist/components/progress/linear.mjs +2 -2
  39. package/dist/components/rich-text-editor/plugins/controlled-state/index.cjs +12 -26
  40. package/dist/components/rich-text-editor/plugins/controlled-state/index.mjs +13 -27
  41. package/dist/components/rich-text-editor/rich-text-editor.cjs +3 -11
  42. package/dist/components/rich-text-editor/rich-text-editor.mjs +3 -11
  43. package/dist/components/tabs/context.cjs +1 -4
  44. package/dist/components/tabs/context.d.ts +2 -2
  45. package/dist/components/tabs/context.mjs +1 -4
  46. package/dist/components/tabs/hooks/use-navigation.cjs +87 -0
  47. package/dist/components/tabs/hooks/use-navigation.d.ts +12 -0
  48. package/dist/components/tabs/hooks/use-navigation.mjs +85 -0
  49. package/dist/components/tabs/hooks/use-tabs-context.cjs +18 -0
  50. package/dist/components/tabs/hooks/use-tabs-context.d.ts +7 -0
  51. package/dist/components/tabs/hooks/use-tabs-context.mjs +16 -0
  52. package/dist/components/tabs/hooks/use-tabs.cjs +46 -0
  53. package/dist/components/tabs/hooks/use-tabs.d.ts +17 -0
  54. package/dist/components/tabs/hooks/use-tabs.mjs +44 -0
  55. package/dist/components/tabs/navigation.cjs +48 -18
  56. package/dist/components/tabs/navigation.mjs +47 -17
  57. package/dist/components/tabs/panels.cjs +56 -39
  58. package/dist/components/tabs/panels.mjs +56 -39
  59. package/dist/components/tabs/tab.cjs +6 -4
  60. package/dist/components/tabs/tab.mjs +5 -3
  61. package/dist/components/tabs/tabs.cjs +11 -6
  62. package/dist/components/tabs/tabs.d.ts +1 -1
  63. package/dist/components/tabs/tabs.mjs +10 -5
  64. package/dist/components/tag/tag.cjs +51 -28
  65. package/dist/components/tag/tag.d.ts +1 -1
  66. package/dist/components/tag/tag.mjs +51 -28
  67. package/dist/components/theme/tokens.stylex.d.ts +2 -0
  68. package/dist/hooks/use-theme-color-vars.cjs +7 -9
  69. package/dist/hooks/use-theme-color-vars.d.ts +2 -1
  70. package/dist/hooks/use-theme-color-vars.mjs +6 -8
  71. package/dist/styles.css +37 -21
  72. package/dist/types/tabs.d.ts +18 -2
  73. package/dist/types/tag.d.ts +7 -0
  74. package/package.json +6 -6
  75. package/dist/components/tabs/hooks.cjs +0 -145
  76. package/dist/components/tabs/hooks.d.ts +0 -43
  77. package/dist/components/tabs/hooks.mjs +0 -140
@@ -1,8 +1,8 @@
1
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
1
+ import _createForOfIteratorHelper from '@babel/runtime/helpers/createForOfIteratorHelper';
2
2
  import React, { useMemo } from 'react';
3
3
  import { stringify } from '@aiszlab/relax/class-name';
4
- import { isUndefined, isVoid } from '@aiszlab/relax';
5
- import { useTabsContext } from './hooks.mjs';
4
+ import { isUndefined } from '@aiszlab/relax';
5
+ import { useTabsContext } from './hooks/use-tabs-context.mjs';
6
6
 
7
7
  var Panels = function Panels(_ref) {
8
8
  var forceRender = _ref.forceRender,
@@ -12,53 +12,70 @@ var Panels = function Panels(_ref) {
12
12
  items = _useTabsContext.items,
13
13
  activeKey = _useTabsContext.activeKey,
14
14
  classNames = _useTabsContext.classNames;
15
- var styled = {
16
- panels: {
17
- className: "musaex-bvu51n"
18
- },
19
- panel: {
20
- active: {},
21
- hidden: {
22
- className: "musaex-1s85apg"
23
- }
24
- }
25
- };
15
+ // 收集需要渲染的面板内容
26
16
  var panels = useMemo(function () {
17
+ var renderedPanels = [];
27
18
  if (isUndefined(activeKey)) {
28
- return [];
19
+ return renderedPanels;
29
20
  }
30
- if (destroyable) {
31
- var _items$find;
32
- return [[activeKey, (_items$find = items.find(function (item) {
33
- return item.key === activeKey;
34
- })) === null || _items$find === void 0 ? void 0 : _items$find.children]];
35
- }
36
- if (forceRender) {
37
- return items.map(function (item) {
38
- return [item.key, item.children];
39
- });
21
+ var _iterator = _createForOfIteratorHelper(items),
22
+ _step;
23
+ try {
24
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
25
+ var item = _step.value;
26
+ if (destroyable) {
27
+ if (item.key !== activeKey) {
28
+ continue;
29
+ }
30
+ if (item.children) {
31
+ renderedPanels.push({
32
+ key: item.key,
33
+ children: item.children
34
+ });
35
+ }
36
+ break;
37
+ }
38
+ if (forceRender || activatedKeys.has(item.key)) {
39
+ if (item.children) {
40
+ renderedPanels.push({
41
+ key: item.key,
42
+ children: item.children
43
+ });
44
+ }
45
+ }
46
+ }
47
+ } catch (err) {
48
+ _iterator.e(err);
49
+ } finally {
50
+ _iterator.f();
40
51
  }
41
- return items.map(function (item) {
42
- return [item.key, activatedKeys.has(item.key) ? item.children : null];
43
- });
52
+ return renderedPanels;
44
53
  }, [destroyable, forceRender, items, activeKey, activatedKeys]);
54
+ var styled = {
55
+ panels: {
56
+ 0: {},
57
+ 1: {
58
+ className: "musaex-1y9dh0z"
59
+ }
60
+ }[!!(panels.length > 0) << 0]
61
+ };
45
62
  return /*#__PURE__*/React.createElement("div", {
46
63
  className: stringify(classNames.panels, styled.panels.className),
47
64
  style: styled.panels.style
48
65
  }, panels.map(function (_ref2) {
49
- var _ref3 = _slicedToArray(_ref2, 2),
50
- key = _ref3[0],
51
- children = _ref3[1];
52
- var _ref4 = key === activeKey ? styled.panel.active : styled.panel.hidden,
53
- className = _ref4.className,
54
- style = _ref4.style;
55
- if (isVoid(children)) {
56
- return null;
57
- }
66
+ var key = _ref2.key,
67
+ children = _ref2.children;
68
+ var isActive = key === activeKey;
69
+ var panelStyled = {
70
+ 0: {},
71
+ 1: {
72
+ className: "musaex-1s85apg"
73
+ }
74
+ }[!!!isActive << 0];
58
75
  return /*#__PURE__*/React.createElement("div", {
59
76
  key: key,
60
- className: stringify(classNames.panel, className),
61
- style: style
77
+ className: stringify(classNames.panel, panelStyled.className),
78
+ style: panelStyled.style
62
79
  }, children);
63
80
  }));
64
81
  };
@@ -4,17 +4,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var button = require('../button/button.cjs');
7
- var hooks = require('./hooks.cjs');
8
7
  var className = require('@aiszlab/relax/class-name');
9
8
  var relax = require('@aiszlab/relax');
9
+ var useTabsContext = require('./hooks/use-tabs-context.cjs');
10
10
 
11
11
  var Tab = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
12
12
  var value = _ref.value,
13
13
  onClick = _ref.onClick,
14
14
  label = _ref.label;
15
- var _useTabsContext = hooks.useTabsContext(),
15
+ var _useTabsContext = useTabsContext.useTabsContext(),
16
16
  activeKey = _useTabsContext.activeKey,
17
- classNames = _useTabsContext.classNames;
17
+ classNames = _useTabsContext.classNames,
18
+ size = _useTabsContext.size;
18
19
  var isActive = activeKey === value;
19
20
  var click = relax.useEvent(function () {
20
21
  onClick(value);
@@ -29,7 +30,8 @@ var Tab = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
29
30
  onClick: click,
30
31
  className: className.stringify(classNames.tab, styled.className),
31
32
  ripple: false,
32
- style: styled.style
33
+ style: styled.style,
34
+ size: size
33
35
  }, label);
34
36
  });
35
37
 
@@ -1,8 +1,8 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import { Button } from '../button/button.mjs';
3
- import { useTabsContext } from './hooks.mjs';
4
3
  import { stringify } from '@aiszlab/relax/class-name';
5
4
  import { useEvent } from '@aiszlab/relax';
5
+ import { useTabsContext } from './hooks/use-tabs-context.mjs';
6
6
 
7
7
  var Tab = /*#__PURE__*/forwardRef(function (_ref, ref) {
8
8
  var value = _ref.value,
@@ -10,7 +10,8 @@ var Tab = /*#__PURE__*/forwardRef(function (_ref, ref) {
10
10
  label = _ref.label;
11
11
  var _useTabsContext = useTabsContext(),
12
12
  activeKey = _useTabsContext.activeKey,
13
- classNames = _useTabsContext.classNames;
13
+ classNames = _useTabsContext.classNames,
14
+ size = _useTabsContext.size;
14
15
  var isActive = activeKey === value;
15
16
  var click = useEvent(function () {
16
17
  onClick(value);
@@ -25,7 +26,8 @@ var Tab = /*#__PURE__*/forwardRef(function (_ref, ref) {
25
26
  onClick: click,
26
27
  className: stringify(classNames.tab, styled.className),
27
28
  ripple: false,
28
- style: styled.style
29
+ style: styled.style,
30
+ size: size
29
31
  }, label);
30
32
  });
31
33
 
@@ -6,9 +6,9 @@ var React = require('react');
6
6
  var context = require('./context.cjs');
7
7
  var useClassNames = require('../../hooks/use-class-names.cjs');
8
8
  var className = require('@aiszlab/relax/class-name');
9
- var hooks = require('./hooks.cjs');
10
9
  var panels = require('./panels.cjs');
11
10
  var navigation = require('./navigation.cjs');
11
+ var useTabs = require('./hooks/use-tabs.cjs');
12
12
 
13
13
  var Tabs = function Tabs(_ref) {
14
14
  var _ref$items = _ref.items,
@@ -20,11 +20,15 @@ var Tabs = function Tabs(_ref) {
20
20
  _ref$forceRender = _ref.forceRender,
21
21
  forceRender = _ref$forceRender === void 0 ? false : _ref$forceRender,
22
22
  _ref$destroyable = _ref.destroyable,
23
- destroyable = _ref$destroyable === void 0 ? false : _ref$destroyable;
24
- var _useTabs = hooks.useTabs({
23
+ destroyable = _ref$destroyable === void 0 ? false : _ref$destroyable,
24
+ _ref$size = _ref.size,
25
+ size = _ref$size === void 0 ? "medium" : _ref$size,
26
+ onChange = _ref.onChange;
27
+ var _useTabs = useTabs.useTabs({
25
28
  items: items,
26
29
  activeKey: _activeKey,
27
- defaultActiveKey: defaultActiveKey
30
+ defaultActiveKey: defaultActiveKey,
31
+ onChange: onChange
28
32
  }),
29
33
  activeKey = _useTabs.activeKey,
30
34
  activatedKeys = _useTabs.activatedKeys,
@@ -35,9 +39,10 @@ var Tabs = function Tabs(_ref) {
35
39
  return {
36
40
  activeKey: activeKey,
37
41
  items: items,
38
- classNames: classNames
42
+ classNames: classNames,
43
+ size: size
39
44
  };
40
- }, [activeKey, items, classNames]);
45
+ }, [activeKey, items, classNames, size]);
41
46
  // if there is not any item, return null
42
47
  if (items.length === 0) return null;
43
48
  return /*#__PURE__*/React.createElement(context.Context.Provider, {
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { TabsProps } from "../../types/tabs";
3
- declare const Tabs: ({ items, className, style, activeKey: _activeKey, defaultActiveKey, forceRender, destroyable, }: TabsProps) => React.JSX.Element | null;
3
+ declare const Tabs: ({ items, className, style, activeKey: _activeKey, defaultActiveKey, forceRender, destroyable, size, onChange, }: TabsProps) => React.JSX.Element | null;
4
4
  export default Tabs;
@@ -2,9 +2,9 @@ import React, { useMemo } from 'react';
2
2
  import { Context, CLASS_NAMES } from './context.mjs';
3
3
  import { useClassNames } from '../../hooks/use-class-names.mjs';
4
4
  import { stringify } from '@aiszlab/relax/class-name';
5
- import { useTabs } from './hooks.mjs';
6
5
  import Panels from './panels.mjs';
7
6
  import Navigation from './navigation.mjs';
7
+ import { useTabs } from './hooks/use-tabs.mjs';
8
8
 
9
9
  var Tabs = function Tabs(_ref) {
10
10
  var _ref$items = _ref.items,
@@ -16,11 +16,15 @@ var Tabs = function Tabs(_ref) {
16
16
  _ref$forceRender = _ref.forceRender,
17
17
  forceRender = _ref$forceRender === void 0 ? false : _ref$forceRender,
18
18
  _ref$destroyable = _ref.destroyable,
19
- destroyable = _ref$destroyable === void 0 ? false : _ref$destroyable;
19
+ destroyable = _ref$destroyable === void 0 ? false : _ref$destroyable,
20
+ _ref$size = _ref.size,
21
+ size = _ref$size === void 0 ? "medium" : _ref$size,
22
+ onChange = _ref.onChange;
20
23
  var _useTabs = useTabs({
21
24
  items: items,
22
25
  activeKey: _activeKey,
23
- defaultActiveKey: defaultActiveKey
26
+ defaultActiveKey: defaultActiveKey,
27
+ onChange: onChange
24
28
  }),
25
29
  activeKey = _useTabs.activeKey,
26
30
  activatedKeys = _useTabs.activatedKeys,
@@ -31,9 +35,10 @@ var Tabs = function Tabs(_ref) {
31
35
  return {
32
36
  activeKey: activeKey,
33
37
  items: items,
34
- classNames: classNames
38
+ classNames: classNames,
39
+ size: size
35
40
  };
36
- }, [activeKey, items, classNames]);
41
+ }, [activeKey, items, classNames, size]);
37
42
  // if there is not any item, return null
38
43
  if (items.length === 0) return null;
39
44
  return /*#__PURE__*/React.createElement(Context.Provider, {
@@ -14,38 +14,61 @@ var close = require('../icon/icons/navigation/close.cjs');
14
14
 
15
15
  var styles = {
16
16
  tag: {
17
- kWkggS: "musaex-1ncffr6",
18
- kMwMTN: "musaex-cm04b4",
19
- k1xSpc: "musaex-3nfvp2",
20
- kXwgrk: "musaex-1q0g3np",
21
- kGNEyG: "musaex-6s0dn4",
22
- kZKoxP: "musaex-1r6gm7t",
23
- $$css: true
17
+ "default": {
18
+ k1xSpc: "musaex-3nfvp2",
19
+ kXwgrk: "musaex-1q0g3np",
20
+ kGNEyG: "musaex-6s0dn4",
21
+ kzqmXN: "musaex-1yklyfh",
22
+ kB7OPa: "musaex-9f619",
23
+ $$css: true
24
+ }
24
25
  },
25
- small: {
26
- kg3NbH: "musaex-1g3a7fl",
27
- k8WAf4: "musaex-11owsmz",
28
- kaIpWk: "musaex-dshwmh",
29
- kOIVth: "musaex-15wobh7",
30
- $$css: true
26
+ size: {
27
+ small: {
28
+ kaIpWk: "musaex-dshwmh",
29
+ kOIVth: "musaex-15wobh7",
30
+ kZKoxP: "musaex-1ksoi14",
31
+ "--padding-inline": "musaex-1rb5leg",
32
+ $$css: true
33
+ },
34
+ medium: {
35
+ kaIpWk: "musaex-1ezz4s",
36
+ kOIVth: "musaex-wcf3z5",
37
+ kZKoxP: "musaex-1si1pn3",
38
+ "--padding-inline": "musaex-1ur110t",
39
+ $$css: true
40
+ },
41
+ large: {
42
+ kg3NbH: "musaex-1v4gb6w",
43
+ kaIpWk: "musaex-142dr1e",
44
+ kOIVth: "musaex-1wm2zkp",
45
+ kZKoxP: "musaex-4etbzz",
46
+ "--padding-inline": "musaex-58z396",
47
+ $$css: true
48
+ }
31
49
  },
32
- medium: {
33
- kg3NbH: "musaex-81lxrv",
34
- k8WAf4: "musaex-1nsg7hs",
35
- kaIpWk: "musaex-1ezz4s",
36
- kOIVth: "musaex-wcf3z5",
37
- $$css: true
38
- },
39
- large: {
40
- kg3NbH: "musaex-1v4gb6w",
41
- k8WAf4: "musaex-a0rzc7",
42
- kaIpWk: "musaex-142dr1e",
43
- kOIVth: "musaex-1wm2zkp",
44
- $$css: true
50
+ variant: {
51
+ filled: {
52
+ kWkggS: "musaex-1ncffr6",
53
+ kMwMTN: "musaex-cm04b4",
54
+ kg3NbH: "musaex-1ioy7le",
55
+ $$css: true
56
+ },
57
+ outlined: {
58
+ kWkggS: "musaex-k7eln3",
59
+ kMzoRj: "musaex-1iyq3db",
60
+ ksu8eU: "musaex-1y0btm7",
61
+ kVAM5u: "musaex-axmpxa",
62
+ kMwMTN: "musaex-1heor9g",
63
+ kg3NbH: "musaex-13bwjiu",
64
+ $$css: true
65
+ }
45
66
  }
46
67
  };
47
68
  var Tag = function Tag(_ref) {
48
69
  var children = _ref.children,
70
+ _ref$variant = _ref.variant,
71
+ variant = _ref$variant === void 0 ? "filled" : _ref$variant,
49
72
  _ref$size = _ref.size,
50
73
  size = _ref$size === void 0 ? "medium" : _ref$size,
51
74
  className$1 = _ref.className,
@@ -55,8 +78,8 @@ var Tag = function Tag(_ref) {
55
78
  onClose = _ref.onClose,
56
79
  leading = _ref.leading;
57
80
  var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
58
- var _themeColorVars = useThemeColorVars.useThemeColorVars(["primary-container", "on-primary-container"]);
59
- var styled = stylex.props(theme.$label[size], styles.tag, styles[size]);
81
+ var _themeColorVars = useThemeColorVars.useThemeColorVars(["primary-container", "on-primary-container", "surface", "on-surface-variant", "outline"]);
82
+ var styled = stylex.props(theme.$label[size], styles.tag["default"], styles.size[size], styles.variant[variant]);
60
83
  return /*#__PURE__*/React.createElement("span", {
61
84
  className: className.stringify(classNames.tag, className$1, styled.className),
62
85
  style: _objectSpread(_objectSpread(_objectSpread({}, styled.style), _themeColorVars), style)
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { TagProps } from "../../types/tag";
3
- declare const Tag: ({ children, size, className, style, closable, onClose, leading, }: TagProps) => React.JSX.Element;
3
+ declare const Tag: ({ children, variant, size, className, style, closable, onClose, leading, }: TagProps) => React.JSX.Element;
4
4
  export default Tag;
@@ -10,38 +10,61 @@ import Close from '../icon/icons/navigation/close.mjs';
10
10
 
11
11
  var styles = {
12
12
  tag: {
13
- kWkggS: "musaex-1ncffr6",
14
- kMwMTN: "musaex-cm04b4",
15
- k1xSpc: "musaex-3nfvp2",
16
- kXwgrk: "musaex-1q0g3np",
17
- kGNEyG: "musaex-6s0dn4",
18
- kZKoxP: "musaex-1r6gm7t",
19
- $$css: true
13
+ "default": {
14
+ k1xSpc: "musaex-3nfvp2",
15
+ kXwgrk: "musaex-1q0g3np",
16
+ kGNEyG: "musaex-6s0dn4",
17
+ kzqmXN: "musaex-1yklyfh",
18
+ kB7OPa: "musaex-9f619",
19
+ $$css: true
20
+ }
20
21
  },
21
- small: {
22
- kg3NbH: "musaex-1g3a7fl",
23
- k8WAf4: "musaex-11owsmz",
24
- kaIpWk: "musaex-dshwmh",
25
- kOIVth: "musaex-15wobh7",
26
- $$css: true
22
+ size: {
23
+ small: {
24
+ kaIpWk: "musaex-dshwmh",
25
+ kOIVth: "musaex-15wobh7",
26
+ kZKoxP: "musaex-1ksoi14",
27
+ "--padding-inline": "musaex-1rb5leg",
28
+ $$css: true
29
+ },
30
+ medium: {
31
+ kaIpWk: "musaex-1ezz4s",
32
+ kOIVth: "musaex-wcf3z5",
33
+ kZKoxP: "musaex-1si1pn3",
34
+ "--padding-inline": "musaex-1ur110t",
35
+ $$css: true
36
+ },
37
+ large: {
38
+ kg3NbH: "musaex-1v4gb6w",
39
+ kaIpWk: "musaex-142dr1e",
40
+ kOIVth: "musaex-1wm2zkp",
41
+ kZKoxP: "musaex-4etbzz",
42
+ "--padding-inline": "musaex-58z396",
43
+ $$css: true
44
+ }
27
45
  },
28
- medium: {
29
- kg3NbH: "musaex-81lxrv",
30
- k8WAf4: "musaex-1nsg7hs",
31
- kaIpWk: "musaex-1ezz4s",
32
- kOIVth: "musaex-wcf3z5",
33
- $$css: true
34
- },
35
- large: {
36
- kg3NbH: "musaex-1v4gb6w",
37
- k8WAf4: "musaex-a0rzc7",
38
- kaIpWk: "musaex-142dr1e",
39
- kOIVth: "musaex-1wm2zkp",
40
- $$css: true
46
+ variant: {
47
+ filled: {
48
+ kWkggS: "musaex-1ncffr6",
49
+ kMwMTN: "musaex-cm04b4",
50
+ kg3NbH: "musaex-1ioy7le",
51
+ $$css: true
52
+ },
53
+ outlined: {
54
+ kWkggS: "musaex-k7eln3",
55
+ kMzoRj: "musaex-1iyq3db",
56
+ ksu8eU: "musaex-1y0btm7",
57
+ kVAM5u: "musaex-axmpxa",
58
+ kMwMTN: "musaex-1heor9g",
59
+ kg3NbH: "musaex-13bwjiu",
60
+ $$css: true
61
+ }
41
62
  }
42
63
  };
43
64
  var Tag = function Tag(_ref) {
44
65
  var children = _ref.children,
66
+ _ref$variant = _ref.variant,
67
+ variant = _ref$variant === void 0 ? "filled" : _ref$variant,
45
68
  _ref$size = _ref.size,
46
69
  size = _ref$size === void 0 ? "medium" : _ref$size,
47
70
  className = _ref.className,
@@ -51,8 +74,8 @@ var Tag = function Tag(_ref) {
51
74
  onClose = _ref.onClose,
52
75
  leading = _ref.leading;
53
76
  var classNames = useClassNames(CLASS_NAMES);
54
- var _themeColorVars = useThemeColorVars(["primary-container", "on-primary-container"]);
55
- var styled = props($label[size], styles.tag, styles[size]);
77
+ var _themeColorVars = useThemeColorVars(["primary-container", "on-primary-container", "surface", "on-surface-variant", "outline"]);
78
+ var styled = props($label[size], styles.tag["default"], styles.size[size], styles.variant[variant]);
56
79
  return /*#__PURE__*/React.createElement("span", {
57
80
  className: stringify(classNames.tag, className, styled.className),
58
81
  style: _objectSpread(_objectSpread(_objectSpread({}, styled.style), _themeColorVars), style)
@@ -1,3 +1,4 @@
1
+ import { ValueOf } from "@aiszlab/relax/types";
1
2
  /**
2
3
  * @description
3
4
  * elevations
@@ -117,6 +118,7 @@ export declare const OPACITY: {
117
118
  readonly heavier: 0.8;
118
119
  readonly heaviest: 0.9;
119
120
  };
121
+ export type Opacity = ValueOf<typeof OPACITY>;
120
122
  export declare const opacity: import("@stylexjs/stylex").VarGroup<Readonly<{
121
123
  readonly thin: 0.08;
122
124
  readonly medium: 0.12;
@@ -4,7 +4,6 @@ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
4
4
  var React = require('react');
5
5
  var hooks = require('../components/theme/hooks.cjs');
6
6
  var relax = require('@aiszlab/relax');
7
- var color = require('@aiszlab/fuzzy/color');
8
7
 
9
8
  /**
10
9
  * @description 主题色样式变量
@@ -18,14 +17,13 @@ var useThemeColorVars = function useThemeColorVars(tokens) {
18
17
  _toArray2 = _slicedToArray(_toArray, 2),
19
18
  token = _toArray2[0],
20
19
  opacity = _toArray2[1];
21
- var color$1 = colors[token];
22
- // 透明度特殊逻辑
23
- if (relax.isUndefined(opacity)) {
24
- prev["--color-".concat(token)] = color$1;
25
- } else {
26
- prev["--color-".concat(token, "-opacity-").concat((opacity * 100).toString().padStart(2, "0"))] =
27
- // 透明度场景下页面渲染统一使用`rgba`格式
28
- color.hexToRgba(color$1, opacity).toString();
20
+ var color = colors[token];
21
+ var colorVar = "--color-".concat(token);
22
+ // 指定透明度时,创建原颜色变量后,基于原颜色变量创建透明度变量
23
+ prev[colorVar] = color;
24
+ if (!relax.isUndefined(opacity) && opacity < 1) {
25
+ var _opacity = (opacity * 100).toString().padStart(2, "0");
26
+ prev["--color-".concat(token, "-opacity-").concat(_opacity)] = "color-mix(in srgb, var(".concat(colorVar, ") ").concat(_opacity, "%, transparent)");
29
27
  }
30
28
  return prev;
31
29
  }, {});
@@ -1,8 +1,9 @@
1
1
  import { type ColorRole } from "../utils/color-role";
2
+ import { type Opacity } from "../components/theme/tokens.stylex";
2
3
  type ThemeColorVarToken = `--color-${ColorRole}` | `--color-${ColorRole}-opacity-${string}`;
3
4
  export type ThemeColorVariable = `var(${ThemeColorVarToken})`;
4
5
  /**
5
6
  * @description 主题色样式变量
6
7
  */
7
- export declare const useThemeColorVars: (tokens: (ColorRole | [ColorRole, number])[]) => Partial<Record<ThemeColorVarToken, string>>;
8
+ export declare const useThemeColorVars: (tokens: (ColorRole | [ColorRole, Opacity])[]) => Partial<Record<ThemeColorVarToken, string>>;
8
9
  export {};
@@ -2,7 +2,6 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
2
  import { useMemo } from 'react';
3
3
  import { useTheme } from '../components/theme/hooks.mjs';
4
4
  import { toArray, isUndefined } from '@aiszlab/relax';
5
- import { hexToRgba } from '@aiszlab/fuzzy/color';
6
5
 
7
6
  /**
8
7
  * @description 主题色样式变量
@@ -17,13 +16,12 @@ var useThemeColorVars = function useThemeColorVars(tokens) {
17
16
  token = _toArray2[0],
18
17
  opacity = _toArray2[1];
19
18
  var color = colors[token];
20
- // 透明度特殊逻辑
21
- if (isUndefined(opacity)) {
22
- prev["--color-".concat(token)] = color;
23
- } else {
24
- prev["--color-".concat(token, "-opacity-").concat((opacity * 100).toString().padStart(2, "0"))] =
25
- // 透明度场景下页面渲染统一使用`rgba`格式
26
- hexToRgba(color, opacity).toString();
19
+ var colorVar = "--color-".concat(token);
20
+ // 指定透明度时,创建原颜色变量后,基于原颜色变量创建透明度变量
21
+ prev[colorVar] = color;
22
+ if (!isUndefined(opacity) && opacity < 1) {
23
+ var _opacity = (opacity * 100).toString().padStart(2, "0");
24
+ prev["--color-".concat(token, "-opacity-").concat(_opacity)] = "color-mix(in srgb, var(".concat(colorVar, ") ").concat(_opacity, "%, transparent)");
27
25
  }
28
26
  return prev;
29
27
  }, {});