@arcblock/ux 2.6.8 → 2.7.0

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 (164) hide show
  1. package/babel.config.es.js +12 -0
  2. package/es/ActionButton/index.js +99 -0
  3. package/es/ActivityIndicator/index.js +180 -0
  4. package/es/Address/compact-text.js +105 -0
  5. package/es/Address/did-address.js +211 -0
  6. package/es/Address/index.js +23 -0
  7. package/es/Address/responsive-did-address.js +88 -0
  8. package/es/Alert/index.js +134 -0
  9. package/es/AnimationWaiter/default-animation.json +1 -0
  10. package/es/AnimationWaiter/index.js +239 -0
  11. package/es/Async/index.js +38 -0
  12. package/es/Avatar/did-motif.js +64 -0
  13. package/es/Avatar/etherscan-blockies.js +83 -0
  14. package/es/Avatar/index.js +176 -0
  15. package/es/Badge/index.js +98 -0
  16. package/es/Blocklet/blocklet.js +298 -0
  17. package/es/Blocklet/index.js +4 -0
  18. package/es/Blocklet/utils.js +52 -0
  19. package/es/BlockletNFT/index.js +412 -0
  20. package/es/Button/index.js +8 -0
  21. package/es/Button/wrap.js +140 -0
  22. package/es/ButtonGroup/index.js +6 -0
  23. package/es/CardSelector/index.js +131 -0
  24. package/es/Center/index.js +41 -0
  25. package/es/ClickToCopy/copy-button.js +72 -0
  26. package/es/ClickToCopy/hook.js +39 -0
  27. package/es/ClickToCopy/index.js +93 -0
  28. package/es/CodeBlock/LightBox.js +85 -0
  29. package/es/CodeBlock/index.js +226 -0
  30. package/es/Colors/index.js +2 -0
  31. package/es/Colors/themes/default.js +78 -0
  32. package/es/ContactForm/index.js +230 -0
  33. package/es/CookieConsent/index.js +113 -0
  34. package/es/CountDown/index.js +178 -0
  35. package/es/DID/index.js +105 -0
  36. package/es/Datatable/CustomToolbar.js +396 -0
  37. package/es/Datatable/DatatableContext.js +34 -0
  38. package/es/Datatable/TableSearch.js +165 -0
  39. package/es/Datatable/index.js +627 -0
  40. package/es/Datatable/utils.js +132 -0
  41. package/es/Dialog/confirm.js +90 -0
  42. package/es/Dialog/dialog.js +192 -0
  43. package/es/Dialog/index.js +3 -0
  44. package/es/DidLogo/index.js +31 -0
  45. package/es/DriftBot/index.js +70 -0
  46. package/es/Earth/countries.json +8057 -0
  47. package/es/Earth/index.js +521 -0
  48. package/es/Earth/util.js +51 -0
  49. package/es/Empty/index.js +64 -0
  50. package/es/ErrorBoundary/fallback.js +73 -0
  51. package/es/ErrorBoundary/index.js +1 -0
  52. package/es/Footer/index.js +172 -0
  53. package/es/Header/auto-hidden.js +35 -0
  54. package/es/Header/header.js +211 -0
  55. package/es/Header/index.js +2 -0
  56. package/es/Header/responsive-header.js +111 -0
  57. package/es/Icon/image.js +65 -0
  58. package/es/Icon/index.js +84 -0
  59. package/es/Img/index.js +217 -0
  60. package/es/InfoRow/index.js +87 -0
  61. package/es/Layout/dashboard/external-link.js +58 -0
  62. package/es/Layout/dashboard/full-page.js +53 -0
  63. package/es/Layout/dashboard/index.js +275 -0
  64. package/es/Layout/dashboard/sidebar.js +209 -0
  65. package/es/Layout/dashboard-legacy/header.js +174 -0
  66. package/es/Layout/dashboard-legacy/index.js +149 -0
  67. package/es/Layout/dashboard-legacy/sidebar.js +129 -0
  68. package/es/Layout/index.js +335 -0
  69. package/es/Locale/browser-lang.js +52 -0
  70. package/es/Locale/context.js +114 -0
  71. package/es/Locale/languages.js +60 -0
  72. package/es/Locale/selector.js +180 -0
  73. package/es/Locale/util.js +13 -0
  74. package/es/Logo/images/logo-dark-text.svg +3 -0
  75. package/es/Logo/images/logo-dark-top.svg +6 -0
  76. package/es/Logo/images/logo-light-text.svg +3 -0
  77. package/es/Logo/images/logo-light-top.svg +6 -0
  78. package/es/Logo/index.js +136 -0
  79. package/es/Metric/index.js +132 -0
  80. package/es/NFTDisplay/README.md +59 -0
  81. package/es/NFTDisplay/aspect-ratio-container.js +39 -0
  82. package/es/NFTDisplay/broken.js +18 -0
  83. package/es/NFTDisplay/demo/data/asset-state-display-url.json +7 -0
  84. package/es/NFTDisplay/demo/data/asset-state-gzipped-svg-1-1.json +10 -0
  85. package/es/NFTDisplay/demo/data/asset-state-gzipped-svg-374-130.json +10 -0
  86. package/es/NFTDisplay/demo/data/asset-state-gzipped-svg-with-foreign-object.json +20 -0
  87. package/es/NFTDisplay/demo/data/asset-state-svg.json +29 -0
  88. package/es/NFTDisplay/demo/data/asset-state-url.json +10 -0
  89. package/es/NFTDisplay/index.js +323 -0
  90. package/es/NFTDisplay/loading.js +18 -0
  91. package/es/NFTDisplay/svg-embedder/img.js +45 -0
  92. package/es/NFTDisplay/svg-embedder/inline-svg.js +39 -0
  93. package/es/NavMenu/index.js +2 -0
  94. package/es/NavMenu/nav-menu.js +286 -0
  95. package/es/NavMenu/style.js +176 -0
  96. package/es/PageScroller/index.js +286 -0
  97. package/es/PageScroller/story/FifthComponent.js +9 -0
  98. package/es/PageScroller/story/FirstComponent.js +9 -0
  99. package/es/PageScroller/story/FourthComponent.js +12 -0
  100. package/es/PageScroller/story/FullPage.js +47 -0
  101. package/es/PageScroller/story/PageContain.js +59 -0
  102. package/es/PageScroller/story/SecondComponent.js +9 -0
  103. package/es/PageScroller/story/ThirdComponent.js +9 -0
  104. package/es/PageScroller/story/index.css +115 -0
  105. package/es/PageScroller/usePrevValue.js +9 -0
  106. package/es/PricingTable/PricingPlan.js +124 -0
  107. package/es/PricingTable/index.js +53 -0
  108. package/es/QRCode/index.js +72 -0
  109. package/es/RelativeTime/index.js +98 -0
  110. package/es/Result/common.js +140 -0
  111. package/es/Result/demo/fixtures/result-image-404.svg +1 -0
  112. package/es/Result/index.js +33 -0
  113. package/es/Result/result.js +59 -0
  114. package/es/Result/translations.js +54 -0
  115. package/es/Screenshot/BaseScreenshot/index.js +91 -0
  116. package/es/Screenshot/BaseScreenshot/shells/Macbook.js +51 -0
  117. package/es/Screenshot/BaseScreenshot/shells/Phone.js +36 -0
  118. package/es/Screenshot/demo/images/bg-00.jpg +0 -0
  119. package/es/Screenshot/demo/images/bg-01.jpg +0 -0
  120. package/es/Screenshot/demo/images/bg-02.jpg +0 -0
  121. package/es/Screenshot/demo/images/bg-03.jpg +0 -0
  122. package/es/Screenshot/demo/images/bg-04.jpg +0 -0
  123. package/es/Screenshot/demo/images/bg-05.jpg +0 -0
  124. package/es/Screenshot/demo/images/bg-06.jpg +0 -0
  125. package/es/Screenshot/demo/images/bg-07.jpg +0 -0
  126. package/es/Screenshot/demo/images/bg-08.jpg +0 -0
  127. package/es/Screenshot/demo/images/bg-09.jpg +0 -0
  128. package/es/Screenshot/devices.css +1366 -0
  129. package/es/Screenshot/index.js +299 -0
  130. package/es/SessionManager/federated-login-detecter.js +166 -0
  131. package/es/SessionManager/index.js +468 -0
  132. package/es/SessionManager/user-popper.js +132 -0
  133. package/es/Sparkline/index.js +193 -0
  134. package/es/Spinner/index.js +28 -0
  135. package/es/SplitButton/index.js +144 -0
  136. package/es/Switch/index.js +96 -0
  137. package/es/Tabs/index.js +48 -0
  138. package/es/Tag/index.js +108 -0
  139. package/es/TextCollapse/index.js +92 -0
  140. package/es/Theme/index.js +16 -0
  141. package/es/Theme/theme-provider.js +39 -0
  142. package/es/Theme/theme.js +133 -0
  143. package/es/Toast/index.js +95 -0
  144. package/es/Util/deprecate.js +28 -0
  145. package/es/Util/index.js +298 -0
  146. package/es/Util/wallet.js +32 -0
  147. package/es/Video/index.js +89 -0
  148. package/es/Wallet/Action.js +119 -0
  149. package/es/Wallet/Download.js +331 -0
  150. package/es/Wallet/Open.js +45 -0
  151. package/es/Wallet/images/abtwallet.png +0 -0
  152. package/es/Wallet/images/android_download.svg +23 -0
  153. package/es/Wallet/images/app-store.svg +20 -0
  154. package/es/Wallet/images/google-play.svg +70 -0
  155. package/es/WebWalletSWKeeper/index.js +115 -0
  156. package/es/WechatPrompt/images/android.png +0 -0
  157. package/es/WechatPrompt/images/ios.png +0 -0
  158. package/es/WechatPrompt/index.js +88 -0
  159. package/es/index.js +38 -0
  160. package/es/withTheme/index.js +69 -0
  161. package/es/withTracker/README.md +34 -0
  162. package/es/withTracker/error_boundary.js +34 -0
  163. package/es/withTracker/index.js +56 -0
  164. package/package.json +272 -5
@@ -0,0 +1,298 @@
1
+ /* eslint-disable react/no-danger */
2
+ import { isValidElement } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import Typography from '@mui/material/Typography';
5
+ import CircularProgress from '@mui/material/CircularProgress';
6
+ import useMediaQuery from '@mui/material/useMediaQuery';
7
+ import Avatar from '../Avatar';
8
+ import Button from '../Button';
9
+ import Img from '../Img';
10
+ import { useTheme, styled } from '../Theme';
11
+ import { strippedString } from './utils';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ const Div = styled('div')`
15
+ &.arcblock-blocklet {
16
+ padding: ${props => props.theme.spacing(2)} ${props => props.theme.spacing(2)} 0
17
+ ${props => props.theme.spacing(2)};
18
+ }
19
+ .arcblock-blocklet__content {
20
+ cursor: pointer;
21
+ display: flex;
22
+ ${props => props.theme.breakpoints.up('sm')} {
23
+ align-items: center;
24
+ }
25
+ }
26
+ .arcblock-blocklet__cover {
27
+ width: 64px;
28
+ height: 64px;
29
+ margin-right: ${props => props.theme.spacing(2)};
30
+ overflow: hidden;
31
+ border-radius: 12px;
32
+ /* see: https://stackoverflow.com/questions/49066011/overflow-hidden-with-border-radius-not-working-on-safari */
33
+ transform: translateZ(0);
34
+ ${props => props.theme.breakpoints.up('sm')} {
35
+ width: 80px;
36
+ height: 80px;
37
+ margin-bottom: 12px;
38
+ }
39
+ }
40
+ .arcblock-blocklet__button--hover {
41
+ &:not(.Mui-disabled) {
42
+ position: relative;
43
+ z-index: 1;
44
+ &::before {
45
+ content: '';
46
+ position: absolute;
47
+ height: 100%;
48
+ width: 100%;
49
+ left: 0;
50
+ top: 0;
51
+ transition: opacity 0.3s;
52
+ }
53
+ &:hover::before {
54
+ opacity: 0;
55
+ }
56
+ &::after {
57
+ content: '';
58
+ position: absolute;
59
+ height: 100%;
60
+ width: 100%;
61
+ background-color: ${props => props.theme.palette.primary.main};
62
+ transform: scale(0.1);
63
+ opacity: 0;
64
+ z-index: -1;
65
+ transition: transform 0.3s, opacity 0.3s, background-color 0.3s;
66
+ }
67
+ &:hover::after {
68
+ opacity: 1;
69
+ transform-origin: center;
70
+ transform: scale(1);
71
+ }
72
+ }
73
+
74
+ &:not(.Mui-disabled) {
75
+ background-color: transparent !important;
76
+ color: ${props => props.theme.palette.primary.main};
77
+ }
78
+ &:not(.Mui-disabled) {
79
+ &:hover {
80
+ color: ${props => props.theme.palette.common.white};
81
+ }
82
+ }
83
+ }
84
+ .arcblock-blocklet__info {
85
+ flex: 1;
86
+ overflow: hidden;
87
+ border-bottom: 1px solid ${props => props.theme.palette.divider};
88
+ padding-bottom: ${props => props.theme.spacing(2)};
89
+ }
90
+ .arcblock-blocklet__text {
91
+ height: 57px;
92
+ overflow: hidden;
93
+ }
94
+ /* 设置多行文本溢出显示省略号 兼容fireFox、safari */
95
+ .arcblock-blocklet__title {
96
+ margin: 0;
97
+ font-size: 16px;
98
+ font-weight: 500;
99
+ overflow: hidden;
100
+ text-overflow: ellipsis;
101
+ white-space: nowrap;
102
+ }
103
+ .arcblock-blocklet__describe {
104
+ margin-top: ${props => props.theme.spacing(0.5)};
105
+ color: ${props => props.theme.palette.grey[600]};
106
+ font-size: 14px;
107
+ font-weight: 500;
108
+ line-height: 17px;
109
+ max-height: 34px;
110
+ overflow: hidden;
111
+ text-overflow: ellipsis;
112
+ display: -webkit-box;
113
+ -webkit-line-clamp: 2;
114
+ -webkit-box-orient: vertical;
115
+ word-break: break-word;
116
+ }
117
+ .arcblock-blocklet__version {
118
+ color: ${props => props.theme.palette.grey[600]};
119
+ font-size: 12px;
120
+ }
121
+ `;
122
+
123
+ /**
124
+ * BlockletStore component
125
+ * @typedef {{
126
+ * title?: string | JSX.Element;
127
+ * did?: string;
128
+ * description?: string | JSX.Element;
129
+ * cover?: string;
130
+ * version?: string;
131
+ * buttonText?: string;
132
+ * buttonDisabled?: boolean;
133
+ * buttonLoading?: boolean;
134
+ * button?: JSX.Element;
135
+ * onButtonClick?: Function;
136
+ * onMainClick?: Function;
137
+ * className?: string;
138
+ * } & import('react').ComponentPropsWithoutRef<"div"> } BlockletStoreProps
139
+ */
140
+
141
+ /**
142
+ * BlockletStore component
143
+ * @param {BlockletStoreProps} props
144
+ * @returns {JSX.Element}
145
+ */
146
+ export default function BlockletStore({
147
+ title,
148
+ did,
149
+ description,
150
+ cover,
151
+ version,
152
+ button,
153
+ buttonText,
154
+ buttonDisabled,
155
+ buttonLoading,
156
+ onButtonClick,
157
+ onMainClick,
158
+ className,
159
+ ...rest
160
+ }) {
161
+ const wrapHandler = (handler, stopFn = () => false) => (e, ...args) => {
162
+ if (stopFn()) {
163
+ e.preventDefault();
164
+ e.stopPropagation();
165
+ } else if (handler instanceof Function) {
166
+ e.preventDefault();
167
+ e.stopPropagation();
168
+ handler(...args);
169
+ }
170
+ };
171
+ const _onButtonClick = wrapHandler(onButtonClick, () => {
172
+ // stop click while custom button or buttonDisabled or buttondLoading
173
+ if (button || buttonDisabled || buttonLoading) {
174
+ return true;
175
+ }
176
+ return false;
177
+ });
178
+ const theme = useTheme();
179
+ const isUpSm = useMediaQuery(theme.breakpoints.up('sm'));
180
+ const _onMainClick = wrapHandler(onMainClick);
181
+ const didAvatarSize = isUpSm ? 80 : 64;
182
+ return /*#__PURE__*/_jsx(Div, {
183
+ className: `${className} arcblock-blocklet`,
184
+ ...rest,
185
+ children: /*#__PURE__*/_jsxs("div", {
186
+ className: "arcblock-blocklet__content",
187
+ onClick: _onMainClick,
188
+ children: [cover ? /*#__PURE__*/_jsx("div", {
189
+ className: "arcblock-blocklet__cover",
190
+ children: /*#__PURE__*/_jsx(Img, {
191
+ src: cover
192
+ })
193
+ }) : did && /*#__PURE__*/_jsx("div", {
194
+ className: "arcblock-blocklet__cover",
195
+ children: /*#__PURE__*/_jsx(Avatar, {
196
+ did: did,
197
+ size: didAvatarSize
198
+ })
199
+ }), /*#__PURE__*/_jsxs("div", {
200
+ className: "arcblock-blocklet__info",
201
+ children: [/*#__PURE__*/_jsxs("div", {
202
+ className: "arcblock-blocklet__text",
203
+ children: [/*#__PURE__*/isValidElement(title) ? /*#__PURE__*/_jsx(Typography, {
204
+ component: "h3",
205
+ variant: "h3",
206
+ className: "arcblock-blocklet__title",
207
+ children: title
208
+ }) : /*#__PURE__*/_jsx(Typography, {
209
+ component: "h3",
210
+ variant: "h3",
211
+ className: "arcblock-blocklet__title",
212
+ title: strippedString(title),
213
+ dangerouslySetInnerHTML: {
214
+ __html: title
215
+ }
216
+ }), /*#__PURE__*/isValidElement(description) ? /*#__PURE__*/_jsx(Typography, {
217
+ component: "div",
218
+ variant: "body2",
219
+ className: "arcblock-blocklet__describe",
220
+ children: description
221
+ }) : /*#__PURE__*/_jsx(Typography, {
222
+ component: "div",
223
+ variant: "body2",
224
+ className: "arcblock-blocklet__describe",
225
+ title: strippedString(description),
226
+ dangerouslySetInnerHTML: {
227
+ __html: description
228
+ }
229
+ })]
230
+ }), /*#__PURE__*/_jsxs("div", {
231
+ style: {
232
+ display: 'flex',
233
+ alignItems: 'center',
234
+ marginTop: '10px',
235
+ flexFlow: 'wrap'
236
+ },
237
+ children: [/*#__PURE__*/_jsx("div", {
238
+ onClick: _onButtonClick,
239
+ style: {
240
+ marginRight: '12px'
241
+ },
242
+ children: button || onButtonClick && /*#__PURE__*/_jsxs(Button, {
243
+ className: "arcblock-blocklet__button--hover",
244
+ variant: "outlined",
245
+ color: "primary",
246
+ size: "small",
247
+ disabled: buttonDisabled || buttonLoading,
248
+ style: {
249
+ padding: '3px 6px',
250
+ fontSize: '14px',
251
+ minWidth: '92px',
252
+ textAlign: 'center'
253
+ },
254
+ children: [buttonLoading && /*#__PURE__*/_jsx(CircularProgress, {
255
+ size: 15,
256
+ style: {
257
+ marginRight: 3,
258
+ color: 'inherit'
259
+ }
260
+ }), buttonText]
261
+ })
262
+ }), /*#__PURE__*/_jsx("div", {
263
+ className: "arcblock-blocklet__version",
264
+ children: version && `v${version}`
265
+ })]
266
+ })]
267
+ })]
268
+ })
269
+ });
270
+ }
271
+ BlockletStore.propTypes = {
272
+ title: PropTypes.string || PropTypes.node,
273
+ did: PropTypes.string,
274
+ description: PropTypes.string || PropTypes.node,
275
+ cover: PropTypes.string,
276
+ buttonText: PropTypes.string,
277
+ buttonDisabled: PropTypes.bool,
278
+ buttonLoading: PropTypes.bool,
279
+ button: PropTypes.element,
280
+ version: PropTypes.string,
281
+ onButtonClick: PropTypes.func,
282
+ onMainClick: PropTypes.func,
283
+ className: PropTypes.string
284
+ };
285
+ BlockletStore.defaultProps = {
286
+ title: '',
287
+ description: '',
288
+ cover: null,
289
+ did: null,
290
+ buttonText: 'Install',
291
+ buttonDisabled: false,
292
+ buttonLoading: false,
293
+ button: null,
294
+ version: null,
295
+ onButtonClick: null,
296
+ onMainClick: null,
297
+ className: null
298
+ };
@@ -0,0 +1,4 @@
1
+ import ActionButton, { strippedString } from './utils';
2
+ import Blocklet from './blocklet';
3
+ export { ActionButton, strippedString };
4
+ export default Blocklet;
@@ -0,0 +1,52 @@
1
+ import { styled } from '../Theme';
2
+ const ActionButton = styled('div')`
3
+ background-color: transparent !important;
4
+ & > :not(.Mui-disabled) {
5
+ position: relative;
6
+ z-index: 1;
7
+ &::before {
8
+ content: '';
9
+ position: absolute;
10
+ height: 100%;
11
+ width: 100%;
12
+ left: 0;
13
+ top: 0;
14
+ transition: opacity 0.3s;
15
+ }
16
+ &:hover::before {
17
+ opacity: 0;
18
+ }
19
+ &::after {
20
+ content: '';
21
+ position: absolute;
22
+ height: 100%;
23
+ width: 100%;
24
+ top: 0;
25
+ left: 0;
26
+ border-radius: 2px;
27
+ background-color: ${props => props.theme.palette.primary.main};
28
+ transform: scale(0.1);
29
+ opacity: 0;
30
+ z-index: -1;
31
+ transition: transform 0.3s, opacity 0.3s, background-color 0.3s;
32
+ }
33
+ &:hover::after {
34
+ opacity: 1;
35
+ transform-origin: center;
36
+ transform: scale(1);
37
+ }
38
+ }
39
+ & > :not(.Mui-disabled) {
40
+ background-color: transparent !important;
41
+ color: ${props => props.theme.palette.primary.main}!important;
42
+ }
43
+ & > :not(.Mui-disabled) {
44
+ &:hover {
45
+ color: ${props => props.theme.palette.common.white}!important;
46
+ }
47
+ }
48
+ `;
49
+ export default ActionButton;
50
+ export const strippedString = (originalString = '') => {
51
+ return originalString.replace(/(<([^>]+)>)/gi, '').trim();
52
+ };