@arcblock/ux 2.13.41 → 2.13.42

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.
@@ -1,18 +1,29 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, IconButton, Tooltip, useMediaQuery } from '@mui/material';
2
+ import { Box, IconButton, Tooltip } from '@mui/material';
3
3
  import CheckIcon from '@iconify-icons/material-symbols/check';
4
4
  import { Icon } from '@iconify/react';
5
+ import { useCreation, useSize } from 'ahooks';
6
+ import { useRef } from 'react';
5
7
  import DID from '../DID';
6
8
  import { mergeSx } from '../Util/style';
7
9
  import AppIcon from './app-icon';
10
+ import { DID_CONNECT_MEDIUM_WIDTH } from '../Util/constant';
8
11
  export default function AppInfoItem({
9
12
  appInfo,
10
13
  active = false,
11
14
  appLogo = null,
12
15
  sx
13
16
  }) {
14
- const isTinyView = useMediaQuery('(max-width:400px)');
17
+ const rootRef = useRef(null);
18
+ const size = useSize(rootRef);
19
+ const isTinyView = useCreation(() => {
20
+ if (size) {
21
+ return size.width < DID_CONNECT_MEDIUM_WIDTH - 50;
22
+ }
23
+ return true;
24
+ }, [size, size?.width]);
15
25
  return /*#__PURE__*/_jsxs(Box, {
26
+ ref: rootRef,
16
27
  sx: mergeSx({
17
28
  display: 'flex',
18
29
  alignItems: 'center',
@@ -1,17 +1,28 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, useMediaQuery } from '@mui/material';
2
+ import { Box } from '@mui/material';
3
+ import { useCreation, useSize } from 'ahooks';
4
+ import { useRef } from 'react';
3
5
  import PoweredBy from './powered-by';
4
6
  import AppInfoItem from './app-info-item';
5
7
  import AppIcon from './app-icon';
6
8
  import { getDIDColor, hexToRgba } from '../Util';
7
9
  import { mergeSx } from '../Util/style';
10
+ import { DID_CONNECT_MEDIUM_WIDTH } from '../Util/constant';
8
11
  export default function DIDConnectFooter({
9
12
  currentAppInfo = globalThis.blocklet,
10
13
  currentAppColor = globalThis.blocklet?.appPid ? getDIDColor(globalThis.blocklet?.appPid) : '#fff',
11
14
  sx
12
15
  }) {
13
- const isSmallView = useMediaQuery('(max-width:640px)');
16
+ const rootRef = useRef(null);
17
+ const size = useSize(rootRef);
18
+ const isSmallView = useCreation(() => {
19
+ if (size) {
20
+ return size.width < DID_CONNECT_MEDIUM_WIDTH - 50;
21
+ }
22
+ return true;
23
+ }, [size, size?.width]);
14
24
  return /*#__PURE__*/_jsxs(Box, {
25
+ ref: rootRef,
15
26
  sx: mergeSx({
16
27
  display: 'flex',
17
28
  justifyContent: 'space-between',
@@ -34,3 +34,5 @@ export declare const OAUTH_PROVIDER: {
34
34
  github: string;
35
35
  google: string;
36
36
  };
37
+ export declare const DID_CONNECT_SMALL_WIDTH = 360;
38
+ export declare const DID_CONNECT_MEDIUM_WIDTH = 576;
@@ -42,4 +42,6 @@ export const OAUTH_PROVIDER = {
42
42
  apple: 'Apple',
43
43
  github: 'Github',
44
44
  google: 'Google'
45
- };
45
+ };
46
+ export const DID_CONNECT_SMALL_WIDTH = 360;
47
+ export const DID_CONNECT_MEDIUM_WIDTH = 576;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.13.41",
3
+ "version": "2.13.42",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -71,14 +71,14 @@
71
71
  "react": ">=18.2.0",
72
72
  "react-router-dom": ">=6.22.3"
73
73
  },
74
- "gitHead": "333c9629e6d8ec6a25b85baf28ccf1899c135279",
74
+ "gitHead": "30e0b6eaccfe6847ba5404894e8ce76b352053e6",
75
75
  "dependencies": {
76
76
  "@arcblock/did-motif": "^1.1.13",
77
- "@arcblock/icons": "^2.13.41",
78
- "@arcblock/nft-display": "^2.13.41",
79
- "@arcblock/react-hooks": "^2.13.41",
77
+ "@arcblock/icons": "^2.13.42",
78
+ "@arcblock/nft-display": "^2.13.42",
79
+ "@arcblock/react-hooks": "^2.13.42",
80
80
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
81
- "@blocklet/theme": "^2.13.41",
81
+ "@blocklet/theme": "^2.13.42",
82
82
  "@fontsource/roboto": "~5.1.1",
83
83
  "@fontsource/ubuntu-mono": "^5.0.18",
84
84
  "@iconify-icons/logos": "^1.2.36",
@@ -1,10 +1,13 @@
1
1
  import { Box, IconButton, SxProps, Tooltip, useMediaQuery } from '@mui/material';
2
2
  import CheckIcon from '@iconify-icons/material-symbols/check';
3
3
  import { Icon } from '@iconify/react';
4
+ import { useCreation, useSize } from 'ahooks';
5
+ import { useRef } from 'react';
4
6
 
5
7
  import DID from '../DID';
6
8
  import { mergeSx } from '../Util/style';
7
9
  import AppIcon from './app-icon';
10
+ import { DID_CONNECT_MEDIUM_WIDTH } from '../Util/constant';
8
11
 
9
12
  export default function AppInfoItem({
10
13
  appInfo,
@@ -17,10 +20,18 @@ export default function AppInfoItem({
17
20
  appLogo?: React.ReactNode;
18
21
  sx?: SxProps;
19
22
  }) {
20
- const isTinyView = useMediaQuery('(max-width:400px)');
23
+ const rootRef = useRef<HTMLDivElement>(null);
24
+ const size = useSize(rootRef);
25
+ const isTinyView = useCreation(() => {
26
+ if (size) {
27
+ return size.width < DID_CONNECT_MEDIUM_WIDTH - 50;
28
+ }
29
+ return true;
30
+ }, [size, size?.width]);
21
31
 
22
32
  return (
23
33
  <Box
34
+ ref={rootRef}
24
35
  sx={mergeSx(
25
36
  {
26
37
  display: 'flex',
@@ -1,10 +1,13 @@
1
- import { Box, SxProps, useMediaQuery } from '@mui/material';
1
+ import { Box, SxProps } from '@mui/material';
2
+ import { useCreation, useSize } from 'ahooks';
3
+ import { useRef } from 'react';
2
4
 
3
5
  import PoweredBy from './powered-by';
4
6
  import AppInfoItem from './app-info-item';
5
7
  import AppIcon from './app-icon';
6
8
  import { getDIDColor, hexToRgba } from '../Util';
7
9
  import { mergeSx } from '../Util/style';
10
+ import { DID_CONNECT_MEDIUM_WIDTH } from '../Util/constant';
8
11
 
9
12
  export default function DIDConnectFooter({
10
13
  currentAppInfo = globalThis.blocklet,
@@ -15,10 +18,18 @@ export default function DIDConnectFooter({
15
18
  currentAppColor?: string;
16
19
  sx?: SxProps;
17
20
  }) {
18
- const isSmallView = useMediaQuery('(max-width:640px)');
21
+ const rootRef = useRef<HTMLDivElement>(null);
22
+ const size = useSize(rootRef);
23
+ const isSmallView = useCreation(() => {
24
+ if (size) {
25
+ return size.width < DID_CONNECT_MEDIUM_WIDTH - 50;
26
+ }
27
+ return true;
28
+ }, [size, size?.width]);
19
29
 
20
30
  return (
21
31
  <Box
32
+ ref={rootRef}
22
33
  sx={mergeSx(
23
34
  {
24
35
  display: 'flex',
@@ -49,3 +49,6 @@ export const OAUTH_PROVIDER = {
49
49
  github: 'Github',
50
50
  google: 'Google',
51
51
  };
52
+
53
+ export const DID_CONNECT_SMALL_WIDTH = 360;
54
+ export const DID_CONNECT_MEDIUM_WIDTH = 576;