@cashub/ui 0.49.0-beta.5 → 0.49.0-beta.6

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/Tab/TabTab.js CHANGED
@@ -26,6 +26,7 @@ const TabTab = _ref => {
26
26
  } = (0, _react.useContext)(_TabContext.default);
27
27
  const [isModify, setIsModify] = (0, _react.useState)(false);
28
28
  const [currentTitle, setCurrentTitle] = (0, _react.useState)(title);
29
+ const active = selected === name;
29
30
  const handleClick = (0, _react.useCallback)(() => {
30
31
  if (selected !== name) {
31
32
  onChange(name);
@@ -63,35 +64,47 @@ const TabTab = _ref => {
63
64
  role: "tab",
64
65
  onClick: handleClick,
65
66
  onDoubleClick: handleDoubleClick,
66
- active: selected === name,
67
+ active: active,
67
68
  ...props,
68
- children: children
69
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TabLabel, {
70
+ active: active,
71
+ children: children
72
+ })
69
73
  });
70
74
  };
71
75
  const Tab = _styledComponents.default.div`
72
76
  background: transparent;
73
77
  padding: 10px var(--spacing-s);
74
78
  border: none;
75
- border-bottom: 4px solid transparent;
76
79
  `;
77
80
  const ButtonTab = (0, _styledComponents.default)(Tab).attrs({
78
81
  as: 'button'
79
82
  })`
80
83
  color: var(--font-on-mute);
81
- transition: color 0.3s, border 0.3s;
84
+ transition: color 0.3s;
82
85
  cursor: pointer;
83
-
84
86
  &:hover {
85
87
  color: var(--font-on-background);
86
88
  }
87
-
88
89
  ${_ref2 => {
89
90
  let {
90
91
  active
91
92
  } = _ref2;
93
+ return active && `
94
+ color: var(--color-primary);
95
+ `;
96
+ }}
97
+ `;
98
+ const TabLabel = _styledComponents.default.span`
99
+ display: inline-block;
100
+ padding-bottom: 10px;
101
+ border-bottom: 4px solid transparent;
102
+ ${_ref3 => {
103
+ let {
104
+ active
105
+ } = _ref3;
92
106
  return active && `
93
107
  border-color: var(--color-primary);
94
- color: var(--font-on-background);
95
108
  `;
96
109
  }}
97
110
  `;
@@ -101,5 +114,6 @@ const InputTab = (0, _styledComponents.default)(Tab).attrs({
101
114
  color: var(--font-on-background);
102
115
  border-color: var(--color-primary);
103
116
  outline: none;
117
+ border-bottom: 4px solid var(--color-primary);
104
118
  `;
105
119
  var _default = exports.default = TabTab;
Binary file
Binary file
Binary file
@@ -0,0 +1,17 @@
1
+ const InfoIcon = (props) => (
2
+ <svg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg' {...props}>
3
+ <g clipPath='url(#clip0_249_12353)'>
4
+ <path
5
+ d='M9 18C4.02975 18 0 13.9703 0 9C0 4.02975 4.02975 0 9 0C13.9703 0 18 4.02975 18 9C18 13.9703 13.9703 18 9 18ZM9 16.5C13.1422 16.5 16.5 13.1422 16.5 9C16.5 4.85775 13.1422 1.5 9 1.5C4.85775 1.5 1.5 4.85775 1.5 9C1.5 13.1422 4.85775 16.5 9 16.5ZM8.25 8.25C8.25 8.05109 8.32902 7.86032 8.46967 7.71967C8.61032 7.57902 8.80109 7.5 9 7.5C9.19891 7.5 9.38968 7.57902 9.53033 7.71967C9.67098 7.86032 9.75 8.05109 9.75 8.25V13.5C9.75 13.6989 9.67098 13.8897 9.53033 14.0303C9.38968 14.171 9.19891 14.25 9 14.25C8.80109 14.25 8.61032 14.171 8.46967 14.0303C8.32902 13.8897 8.25 13.6989 8.25 13.5V8.25ZM8.925 5.85C8.64652 5.85 8.37945 5.73938 8.18254 5.54246C7.98562 5.34555 7.875 5.07848 7.875 4.8C7.875 4.52152 7.98562 4.25445 8.18254 4.05754C8.37945 3.86062 8.64652 3.75 8.925 3.75C9.20348 3.75 9.47055 3.86062 9.66746 4.05754C9.86438 4.25445 9.975 4.52152 9.975 4.8C9.975 5.07848 9.86438 5.34555 9.66746 5.54246C9.47055 5.73938 9.20348 5.85 8.925 5.85Z'
6
+ fill='currentColor'
7
+ />
8
+ </g>
9
+ <defs>
10
+ <clipPath id='clip0_249_12353'>
11
+ <rect width='18' height='18' fill='currentColor' />
12
+ </clipPath>
13
+ </defs>
14
+ </svg>
15
+ );
16
+
17
+ export default InfoIcon;
@@ -0,0 +1,17 @@
1
+ const RedirectPortalIcon = () => (
2
+ <svg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'>
3
+ <g clipPath='url(#clip0_249_12351)'>
4
+ <path
5
+ d='M7.85672 2.14244V7.85672H2.14244V2.14244H7.85672ZM7.85672 0.713867H2.14244C1.35672 0.713867 0.713867 1.35672 0.713867 2.14244V7.85672C0.713867 8.64244 1.35672 9.2853 2.14244 9.2853H7.85672C8.64244 9.2853 9.2853 8.64244 9.2853 7.85672V2.14244C9.2853 1.35672 8.64244 0.713867 7.85672 0.713867ZM7.85672 12.1424V17.8567H2.14244V12.1424H7.85672ZM7.85672 10.7139H2.14244C1.35672 10.7139 0.713867 11.3567 0.713867 12.1424V17.8567C0.713867 18.6424 1.35672 19.2853 2.14244 19.2853H7.85672C8.64244 19.2853 9.2853 18.6424 9.2853 17.8567V12.1424C9.2853 11.3567 8.64244 10.7139 7.85672 10.7139ZM17.8567 2.14244V7.85672H12.1424V2.14244H17.8567ZM17.8567 0.713867H12.1424C11.3567 0.713867 10.7139 1.35672 10.7139 2.14244V7.85672C10.7139 8.64244 11.3567 9.2853 12.1424 9.2853H17.8567C18.6424 9.2853 19.2853 8.64244 19.2853 7.85672V2.14244C19.2853 1.35672 18.6424 0.713867 17.8567 0.713867ZM17.8567 12.1424V17.8567H12.1424V12.1424H17.8567ZM17.8567 10.7139H12.1424C11.3567 10.7139 10.7139 11.3567 10.7139 12.1424V17.8567C10.7139 18.6424 11.3567 19.2853 12.1424 19.2853H17.8567C18.6424 19.2853 19.2853 18.6424 19.2853 17.8567V12.1424C19.2853 11.3567 18.6424 10.7139 17.8567 10.7139Z'
6
+ fill='currentColor'
7
+ />
8
+ </g>
9
+ <defs>
10
+ <clipPath id='clip0_249_12351'>
11
+ <rect width='20' height='20' fill='currentColor' />
12
+ </clipPath>
13
+ </defs>
14
+ </svg>
15
+ );
16
+
17
+ export default RedirectPortalIcon;
package/icon/registry.js CHANGED
@@ -42,6 +42,8 @@ var _key = _interopRequireDefault(require("./assets/key"));
42
42
  var _task = _interopRequireDefault(require("./assets/task"));
43
43
  var _priceChange = _interopRequireDefault(require("./assets/price-change"));
44
44
  var _productManagement = _interopRequireDefault(require("./assets/product-management"));
45
+ var _redirectPortal = _interopRequireDefault(require("./assets/redirect-portal"));
46
+ var _info = _interopRequireDefault(require("./assets/info"));
45
47
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
46
48
  const iconOverrides = {
47
49
  merchant: _merchant.default,
@@ -81,6 +83,8 @@ const iconOverrides = {
81
83
  key: _key.default,
82
84
  task: _task.default,
83
85
  'price-change': _priceChange.default,
84
- 'product-management': _productManagement.default
86
+ 'product-management': _productManagement.default,
87
+ 'redirect-portal': _redirectPortal.default,
88
+ info: _info.default
85
89
  };
86
90
  var _default = exports.default = iconOverrides;
@@ -4,13 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _styledComponents = _interopRequireDefault(require("styled-components"));
7
+ var _react = require("react");
8
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
9
  var _IconBoxFigure = _interopRequireDefault(require("./subComponent/IconBoxFigure"));
9
10
  var _IconBoxImage = _interopRequireDefault(require("./subComponent/IconBoxImage"));
10
11
  var _bgChartTriangle = _interopRequireDefault(require("../assets/images/bg-chart-triangle.png"));
11
12
  var _bgImageRegistry = _interopRequireDefault(require("./bgImageRegistry"));
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
17
  const withAlpha = (hex, alphaHex) => hex ? `${hex}${alphaHex}` : undefined;
15
18
  const IconBox = _ref => {
16
19
  let {
@@ -26,20 +29,30 @@ const IconBox = _ref => {
26
29
  bgImageKey,
27
30
  gradientFrom,
28
31
  gradientTo,
29
- accentColor
32
+ colors
30
33
  } = _ref;
31
- if (accentColor) {
34
+ const theme = (0, _react.useContext)(_styledComponents.ThemeContext);
35
+ const mode = colors ? theme?.cardMode || 'accent' : 'image';
36
+ if (mode === 'accent' || mode === 'gradient') {
37
+ const accent = colors.accent;
38
+ const gradientEnd = colors.gradient || accent;
39
+ const borderColor = colors.border || accent;
32
40
  const circleSize = size || 60;
33
41
  const innerIconSize = iconSize || Math.round(circleSize * 0.5);
42
+ const iconColorFinal = mode === 'gradient' ? '#FFFFFF' : accent;
34
43
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(AccentWrapper, {
35
- accentColor: accentColor,
44
+ mode: mode,
45
+ accent: accent,
46
+ gradientEnd: gradientEnd,
47
+ borderColor: borderColor,
36
48
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(IconCircle, {
37
- accentColor: accentColor,
49
+ mode: mode,
50
+ accent: accent,
38
51
  circleSize: circleSize,
39
52
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconBoxImage.default, {
40
53
  size: innerIconSize,
41
54
  iconKey: iconKey,
42
- iconColor: accentColor || iconColor,
55
+ iconColor: iconColorFinal,
43
56
  src: icon,
44
57
  alt: `${title}'s icon`
45
58
  })
@@ -47,7 +60,7 @@ const IconBox = _ref => {
47
60
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(IconBoxTitle, {
48
61
  children: title
49
62
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(IconBoxBody, {
50
- accentColor: accentColor,
63
+ accentColor: accent,
51
64
  children: children
52
65
  })]
53
66
  })]
@@ -81,6 +94,9 @@ const IconBox = _ref => {
81
94
  })]
82
95
  });
83
96
  };
97
+
98
+ /* ---------- image 模式 ---------- */
99
+
84
100
  const Wrapper = _styledComponents.default.div`
85
101
  display: flex;
86
102
  flex-direction: column;
@@ -118,55 +134,68 @@ const IconBoxHead = _styledComponents.default.div`
118
134
  align-items: center;
119
135
  margin-bottom: var(--spacing);
120
136
  `;
137
+
138
+ /* ---------- accent / gradient 模式 ---------- */
139
+
121
140
  const AccentWrapper = _styledComponents.default.div`
122
141
  display: flex;
123
142
  align-items: center;
124
143
  padding: var(--spacing);
125
144
  border-radius: var(--border-radius);
126
145
  color: var(--font-on-background);
127
- background: ${_ref3 => {
146
+ ${_ref3 => {
128
147
  let {
129
- accentColor
148
+ mode,
149
+ accent,
150
+ gradientEnd,
151
+ borderColor
130
152
  } = _ref3;
131
- return withAlpha(accentColor, '0D');
132
- }};
133
- border: 2px solid ${_ref4 => {
134
- let {
135
- accentColor
136
- } = _ref4;
137
- return withAlpha(accentColor, '1A');
138
- }};
153
+ if (mode === 'gradient') {
154
+ return `
155
+ background: linear-gradient(45deg, var(--color-background2), ${gradientEnd});
156
+ border: 2px solid ${borderColor};
157
+ `;
158
+ }
159
+ return `
160
+ background: ${withAlpha(accent, '0D')};
161
+ border: 2px solid ${withAlpha(accent, '1A')};
162
+ `;
163
+ }}
139
164
  `;
140
165
  const IconCircle = _styledComponents.default.span`
141
166
  display: inline-flex;
142
167
  align-items: center;
143
168
  justify-content: center;
144
169
  border-radius: 50%;
145
- width: ${_ref5 => {
170
+ width: ${_ref4 => {
146
171
  let {
147
172
  circleSize
148
- } = _ref5;
173
+ } = _ref4;
149
174
  return `${circleSize}px`;
150
175
  }};
151
- height: ${_ref6 => {
176
+ height: ${_ref5 => {
152
177
  let {
153
178
  circleSize
154
- } = _ref6;
179
+ } = _ref5;
155
180
  return `${circleSize}px`;
156
181
  }};
157
182
  flex-shrink: 0;
158
183
  margin-right: var(--spacing-s);
159
- background: ${_ref7 => {
184
+ background: ${_ref6 => {
160
185
  let {
161
- accentColor
162
- } = _ref7;
163
- return withAlpha(accentColor, '14');
186
+ mode,
187
+ accent
188
+ } = _ref6;
189
+ return mode === 'gradient' ? 'rgba(255, 255, 255, 0.2)' : withAlpha(accent, '14');
164
190
  }};
165
191
  `;
166
192
  const TextColumn = _styledComponents.default.div`
167
193
  display: flex;
168
194
  flex-direction: column;
169
195
  `;
196
+
197
+ /* ---------- 共用 ---------- */
198
+
170
199
  const IconBoxTitle = _styledComponents.default.div`
171
200
  font-size: var(--font-h2);
172
201
  font-weight: bold;
@@ -177,16 +206,16 @@ const IconBoxBody = _styledComponents.default.div`
177
206
  font-size: var(--font-h1);
178
207
  font-weight: bold;
179
208
  line-height: 1.3;
180
- text-align: ${_ref8 => {
209
+ text-align: ${_ref7 => {
181
210
  let {
182
211
  accentColor
183
- } = _ref8;
212
+ } = _ref7;
184
213
  return accentColor ? 'left' : 'center';
185
214
  }};
186
- color: ${_ref9 => {
215
+ color: ${_ref8 => {
187
216
  let {
188
217
  accentColor
189
- } = _ref9;
218
+ } = _ref8;
190
219
  return accentColor || 'inherit';
191
220
  }};
192
221
  `;
@@ -69,7 +69,7 @@ const IconBoxImage = _ref6 => {
69
69
  ...rest
70
70
  } = _ref6;
71
71
  const theme = (0, _react.useContext)(_styledComponents.ThemeContext);
72
- const override = theme?.useModernIcons && iconKey && _registry.default[iconKey];
72
+ const override = theme?.useModernCardIcons && iconKey && _registry.default[iconKey];
73
73
  const IconComponent = override || icon;
74
74
  const isComponent = typeof IconComponent === 'function';
75
75
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
@@ -203,6 +203,8 @@ const MenuItem = styled.li`
203
203
  props.active === true &&
204
204
  css`
205
205
  background: var(--color-active-sidebar);
206
+ border-top-right-radius: 10px;
207
+ border-bottom-right-radius: 10px;
206
208
  `};
207
209
  `;
208
210
  const MenuItemLink = styled(Link)`
@@ -244,12 +246,19 @@ const SubMenuItem = styled.li`
244
246
  padding: 0 calc(var(--spacing) * 2 + 1.5rem);
245
247
  padding-left: ${({ $level }) =>
246
248
  `calc(var(--spacing) * 2 + 1.5rem + ${$level} * var(--spacing))`};
247
- height: 48px;
249
+ min-height: 48px;
250
+ padding-top: 0.5rem;
251
+ padding-bottom: 0.5rem;
248
252
  ${({ active }) =>
249
253
  active === true &&
250
254
  css`
251
255
  background: var(--color-active-sidebar);
256
+ border-top-right-radius: 10px;
257
+ border-bottom-right-radius: 10px;
252
258
  `};
259
+ span {
260
+ line-height: 1.4;
261
+ }
253
262
  }
254
263
  `;
255
264
  const EmptyIcon = styled.span`
@@ -6,9 +6,17 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _bgMain = _interopRequireDefault(require("../assets/images/bg-main.png"));
8
8
  var _bgMainVivid = _interopRequireDefault(require("../assets/images/bg-main-vivid.png"));
9
+ var _bgMainDark = _interopRequireDefault(require("../assets/images/bg-main-dark.png"));
10
+ var _bgMainLight = _interopRequireDefault(require("../assets/images/bg-main-light.png"));
11
+ var _bgMainWhite = _interopRequireDefault(require("../assets/images/bg-main-white.png"));
12
+ var _bgMainMidnight = _interopRequireDefault(require("../assets/images/bg-main-midnight.png"));
9
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
14
  const bgMainRegistry = {
11
15
  default: _bgMain.default,
12
- vivid: _bgMainVivid.default
16
+ vivid: _bgMainVivid.default,
17
+ dark: _bgMainDark.default,
18
+ light: _bgMainLight.default,
19
+ white: _bgMainWhite.default,
20
+ midnight: _bgMainMidnight.default
13
21
  };
14
22
  var _default = exports.default = bgMainRegistry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cashub/ui",
3
- "version": "0.49.0-beta.5",
3
+ "version": "0.49.0-beta.6",
4
4
  "private": false,
5
5
  "author": "CasHUB Team",
6
6
  "description": "CasHUB UI components library",
@@ -22,8 +22,11 @@ const colorStyle = {
22
22
  bgColor3: '#2d2a5d',
23
23
  bgColor4: '#222143',
24
24
  backdropBg: 'rgba(0, 0, 0, 0.75)',
25
+ cardMode: 'gradient',
26
+ bgMainKey: 'dark',
27
+ useModernCardIcons: true,
25
28
  useLightBrand: true,
26
- hideMainDecoration: true
29
+ hideMainDecoration: false
27
30
  };
28
31
 
29
32
  // Common font style
@@ -21,7 +21,9 @@ const colorStyle = {
21
21
  bgColor4: 'linear-gradient(90deg, #E62B27 0%, #D9211E 45%, #C60E27 100%)',
22
22
  backdropBg: 'rgba(0, 0, 0, 0.75)',
23
23
  useModernIcons: true,
24
+ useModernCardIcons: true,
24
25
  useLightBrand: true,
26
+ cardMode: 'accent',
25
27
  bgMainKey: 'vivid',
26
28
  colorHoverSidebar: 'rgba(255, 255, 255, 0.15)',
27
29
  colorActiveSidebar: 'rgba(255, 255, 255, 0.22)',
@@ -21,7 +21,9 @@ const colorStyle = {
21
21
  bgColor2: '#F8F4FF',
22
22
  bgColor3: '#E6E1FF',
23
23
  bgColor4: '#F8F4FF',
24
- backdropBg: 'rgba(0, 0, 0, 0.75)'
24
+ backdropBg: 'rgba(0, 0, 0, 0.75)',
25
+ cardMode: 'accent',
26
+ bgMainKey: 'light'
25
27
  };
26
28
 
27
29
  // Common font style
@@ -20,6 +20,8 @@ const colorStyle = {
20
20
  bgColor3: '#EDEFF3',
21
21
  bgColor4: '#00255B',
22
22
  backdropBg: 'rgba(0, 0, 0, 0.75)',
23
+ cardMode: 'accent',
24
+ bgMainKey: 'midnight',
23
25
  useModernIcons: false,
24
26
  useLightBrand: true,
25
27
  colorHoverSidebar: 'rgba(255, 255, 255, 0.12)',
@@ -22,10 +22,11 @@ const colorStyle = {
22
22
  bgColor3: '#FFFFFF',
23
23
  bgColor4: '#F7F7F7',
24
24
  backdropBg: 'rgba(0, 0, 0, 0.75)',
25
+ cardMode: 'accent',
26
+ bgMainKey: 'white',
25
27
  useModernIcons: false,
26
28
  useLightBrand: false,
27
- hideMainDecoration: false,
28
- bgMainKey: 'default'
29
+ hideMainDecoration: false
29
30
  };
30
31
 
31
32
  // Common font style