@blocklet/ui-react 3.0.5 → 3.0.7

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 (62) hide show
  1. package/lib/BlockletStudio/index.d.ts +15 -15
  2. package/lib/BlockletStudio/index.js +66 -66
  3. package/lib/ComponentManager/components/add-component.d.ts +6 -6
  4. package/lib/ComponentManager/components/add-component.js +29 -29
  5. package/lib/ComponentManager/components/publish-component.d.ts +3 -3
  6. package/lib/ComponentManager/components/publish-component.js +19 -19
  7. package/lib/ComponentManager/components/resource-dialog.d.ts +1 -1
  8. package/lib/ComponentManager/components/resource-dialog.js +1 -1
  9. package/lib/Footer/internal-footer.d.ts +3 -1
  10. package/lib/Footer/internal-footer.js +1 -1
  11. package/lib/Footer/layout/standard.d.ts +1 -1
  12. package/lib/Footer/layout/standard.js +1 -1
  13. package/lib/Footer/links.d.ts +1 -1
  14. package/lib/Footer/links.js +3 -3
  15. package/lib/Header/index.d.ts +2 -2
  16. package/lib/Header/index.js +17 -17
  17. package/lib/Icon/index.d.ts +2 -2
  18. package/lib/Icon/index.js +6 -6
  19. package/lib/Notifications/Snackbar.d.ts +1 -1
  20. package/lib/Notifications/Snackbar.js +1 -1
  21. package/lib/Notifications/hooks/use-title.d.ts +2 -2
  22. package/lib/Notifications/hooks/use-title.js +9 -9
  23. package/lib/UserCenter/components/editable-field.d.ts +6 -6
  24. package/lib/UserCenter/components/editable-field.js +12 -12
  25. package/lib/UserCenter/components/notification.js +5 -5
  26. package/lib/UserCenter/components/status-dialog/date-picker.d.ts +5 -5
  27. package/lib/UserCenter/components/status-dialog/date-picker.js +17 -10
  28. package/lib/UserCenter/components/status-dialog/index.d.ts +1 -1
  29. package/lib/UserCenter/components/status-dialog/index.js +8 -1
  30. package/lib/UserCenter/components/status-selector/index.d.ts +2 -2
  31. package/lib/UserCenter/components/status-selector/index.js +5 -5
  32. package/lib/UserCenter/components/status-selector/menu-item.d.ts +4 -4
  33. package/lib/UserCenter/components/status-selector/menu-item.js +11 -6
  34. package/lib/UserCenter/components/third-party-login/index.js +23 -29
  35. package/lib/UserCenter/components/user-info/user-info-item.d.ts +1 -1
  36. package/lib/UserCenter/components/user-info/user-info-item.js +1 -1
  37. package/lib/UserCenter/components/user-info/user-status.d.ts +4 -4
  38. package/lib/UserCenter/components/user-info/user-status.js +17 -17
  39. package/package.json +7 -5
  40. package/src/BlockletStudio/index.tsx +13 -13
  41. package/src/ComponentManager/components/add-component.tsx +6 -6
  42. package/src/ComponentManager/components/publish-component.tsx +2 -2
  43. package/src/ComponentManager/components/resource-dialog.tsx +1 -1
  44. package/src/Footer/internal-footer.jsx +1 -1
  45. package/src/Footer/layout/standard.jsx +1 -1
  46. package/src/Footer/links.jsx +1 -1
  47. package/src/Header/index.tsx +2 -2
  48. package/src/Icon/index.tsx +2 -2
  49. package/src/Notifications/Snackbar.tsx +2 -2
  50. package/src/Notifications/hooks/use-title.tsx +1 -1
  51. package/src/UserCenter/components/editable-field.tsx +6 -6
  52. package/src/UserCenter/components/notification.tsx +2 -2
  53. package/src/UserCenter/components/status-dialog/date-picker.tsx +8 -1
  54. package/src/UserCenter/components/status-dialog/index.tsx +8 -1
  55. package/src/UserCenter/components/status-selector/index.tsx +1 -1
  56. package/src/UserCenter/components/status-selector/menu-item.tsx +6 -1
  57. package/src/UserCenter/components/third-party-login/index.tsx +0 -2
  58. package/src/UserCenter/components/user-center.tsx +1 -1
  59. package/src/UserCenter/components/user-info/link-preview-input.tsx +2 -2
  60. package/src/UserCenter/components/user-info/user-info-item.tsx +1 -1
  61. package/src/UserCenter/components/user-info/user-info.tsx +1 -1
  62. package/src/UserCenter/components/user-info/user-status.tsx +2 -2
@@ -42,26 +42,26 @@ interface BlockletStudioProps {
42
42
  function BlockletStudio({
43
43
  open,
44
44
  setOpen,
45
- onOpened,
45
+ onOpened = undefined,
46
46
  componentDid,
47
- tenantScope,
47
+ tenantScope = undefined,
48
48
  resourcesParams = {},
49
49
  mode = 'dialog',
50
- title,
51
- logo,
52
- description,
53
- introduction,
54
- note,
55
- componentsTitle,
56
- resourcesTitle,
57
- onUploaded,
58
- onReleased,
59
- onConnected,
50
+ title = undefined,
51
+ logo = undefined,
52
+ description = undefined,
53
+ introduction = undefined,
54
+ note = undefined,
55
+ componentsTitle = undefined,
56
+ resourcesTitle = undefined,
57
+ onUploaded = undefined,
58
+ onReleased = undefined,
59
+ onConnected = undefined,
60
60
  components = [],
61
61
  resources = {},
62
62
  style = {},
63
63
  zIndex = 9999,
64
- dependentComponentsMode,
64
+ dependentComponentsMode = undefined,
65
65
  ...rest
66
66
  }: BlockletStudioProps) {
67
67
  const [opened, setOpened] = useState(false);
@@ -14,20 +14,20 @@ import type { SessionContext as TSessionContext } from '../../@types';
14
14
 
15
15
  export default function AddComponent({
16
16
  componentDid,
17
- resourceType,
18
- resourceDid,
17
+ resourceType = undefined,
18
+ resourceDid = undefined,
19
19
  grantedRoles = ['admin', 'owner'],
20
20
  autoClose = true,
21
- selectedMeta,
22
- storeUrl,
21
+ selectedMeta = undefined,
22
+ storeUrl = undefined,
23
23
  onComplete,
24
24
  onClose,
25
- render,
25
+ render = undefined,
26
26
  }: {
27
27
  componentDid: string;
28
28
  resourceType?: string;
29
29
  resourceDid?: string;
30
- autoClose: boolean;
30
+ autoClose?: boolean;
31
31
  selectedMeta?: any;
32
32
  storeUrl?: string;
33
33
  grantedRoles?: string[];
@@ -13,9 +13,9 @@ import { translations } from '../libs/locales';
13
13
 
14
14
  export default function PublishComponent({
15
15
  componentDid,
16
- grantedRoles,
16
+ grantedRoles = undefined,
17
17
  onClose,
18
- render,
18
+ render = undefined,
19
19
  }: {
20
20
  componentDid: string;
21
21
  grantedRoles?: string[];
@@ -7,7 +7,7 @@ function ResourceDialog(
7
7
  open = false,
8
8
  componentDid,
9
9
  loading = true,
10
- storeUrl,
10
+ storeUrl = '',
11
11
  onClose = () => {},
12
12
  onComplete = () => {},
13
13
  onLoad = () => {},
@@ -29,7 +29,7 @@ const layoutsKeyByName = layouts.reduce((acc, cur) => ({ ...acc, [cur.name]: cur
29
29
  /**
30
30
  * 通用的内部 footer 组件, 定义并渲染常见的几种 footer 元素: brand/navigation/social medial 等
31
31
  */
32
- function InternalFooter(props) {
32
+ function InternalFooter({ ...props }) {
33
33
  const {
34
34
  brand = null,
35
35
  navigation = null,
@@ -8,7 +8,7 @@ import Row from './row';
8
8
  /**
9
9
  * footer standard layout
10
10
  */
11
- function StandardLayout({ elements, data, className, ...rest }) {
11
+ function StandardLayout({ elements, data, className = '', ...rest }) {
12
12
  const withNavigation = !!data.navigation?.length;
13
13
 
14
14
  let topSection = null;
@@ -159,7 +159,7 @@ Links.propTypes = {
159
159
  // 流动布局, 简单的从左到右排列
160
160
  flowLayout: PropTypes.bool,
161
161
  // 列布局
162
- columns: PropTypes.number,
162
+ columns: PropTypes.number.isRequired,
163
163
  };
164
164
 
165
165
  const Root = styled('div')`
@@ -102,12 +102,12 @@ type HeaderProps = {
102
102
 
103
103
  function Header({
104
104
  meta = {},
105
- addons,
105
+ addons = undefined,
106
106
  sessionManagerProps = {
107
107
  showRole: true,
108
108
  },
109
109
  homeLink = publicPath,
110
- theme: themeOverrides,
110
+ theme: themeOverrides = undefined,
111
111
  hideNavMenu = false,
112
112
  showDomainWarningDialog = true,
113
113
  ...rest
@@ -11,8 +11,8 @@ import { isUrl } from '../utils';
11
11
  */
12
12
  export default function Icon({
13
13
  icon,
14
- size,
15
- sx,
14
+ size = undefined,
15
+ sx = {},
16
16
  ...rest
17
17
  }: {
18
18
  icon: string;
@@ -139,7 +139,7 @@ const ClickableDiv = styled.div`
139
139
  interface NotificationComponentProps {
140
140
  viewAllUrl: string;
141
141
  keyId: number;
142
- notification: {
142
+ notification?: {
143
143
  severity?: string;
144
144
  title?: string;
145
145
  description?: string;
@@ -151,7 +151,7 @@ interface NotificationComponentProps {
151
151
  }
152
152
 
153
153
  export default function NotificationComponent({
154
- ref,
154
+ ref = undefined,
155
155
  keyId: key,
156
156
  notification = {},
157
157
  viewAllUrl,
@@ -61,7 +61,7 @@ interface CustomMouseEvent extends MouseEvent<HTMLAnchorElement> {
61
61
  * UserLink component for rendering a user's name as a profile link
62
62
  * Memoized to prevent unnecessary re-renders
63
63
  */
64
- function UserLink({ user, color }: UserLinkProps) {
64
+ function UserLink({ user, color = undefined }: UserLinkProps) {
65
65
  const { palette } = useTheme();
66
66
  const profileLink = withQuery(joinURL(WELLKNOWN_SERVICE_PATH_PREFIX, 'user'), { did: user.did });
67
67
  // eslint-disable-next-line @typescript-eslint/naming-convention
@@ -11,7 +11,7 @@ interface EditableFieldProps {
11
11
  value: string;
12
12
  onChange?: (value: string) => void;
13
13
  onValueValidate?: (value: string) => void;
14
- editable: boolean;
14
+ editable?: boolean;
15
15
  disabled?: boolean;
16
16
  component?: 'input' | 'textarea';
17
17
  placeholder?: string;
@@ -69,16 +69,16 @@ function EditableField({
69
69
  component = 'input',
70
70
  placeholder = '',
71
71
  rows = 2,
72
- maxLength,
73
- icon,
72
+ maxLength = undefined,
73
+ icon = undefined,
74
74
  label = '',
75
- children,
76
- tooltip,
75
+ children = undefined,
76
+ tooltip = undefined,
77
77
  inline = true,
78
78
  style = {},
79
79
  verified = false,
80
80
  canEdit = true,
81
- renderValue,
81
+ renderValue = undefined,
82
82
  disabled = false,
83
83
  hidePreview = false,
84
84
  }: EditableFieldProps) {
@@ -19,8 +19,8 @@ import { formatAxiosError } from '../libs/utils';
19
19
  import { client } from '../../libs/client';
20
20
 
21
21
  function NotificationItem({
22
- title,
23
- description,
22
+ title = undefined,
23
+ description = undefined,
24
24
  value,
25
25
  onChange,
26
26
  isMobile,
@@ -12,7 +12,14 @@ interface DateTimeInputProps {
12
12
  timezone?: string;
13
13
  }
14
14
 
15
- export default function DateTimeInput({ value, onChange, error, helperText, label, timezone }: DateTimeInputProps) {
15
+ export default function DateTimeInput({
16
+ value,
17
+ onChange,
18
+ error = undefined,
19
+ helperText = undefined,
20
+ label = undefined,
21
+ timezone = undefined,
22
+ }: DateTimeInputProps) {
16
23
  const inputRef = useRef<HTMLInputElement>(null);
17
24
  const minDateTime = dayjs().format('YYYY-MM-DDTHH:mm');
18
25
 
@@ -53,7 +53,14 @@ interface StatusDialogProps {
53
53
  timezone?: string;
54
54
  }
55
55
 
56
- export default function StatusDialog({ open, onClose, data, selected, onSelect, timezone }: StatusDialogProps) {
56
+ export default function StatusDialog({
57
+ open,
58
+ onClose,
59
+ data,
60
+ selected,
61
+ onSelect,
62
+ timezone = undefined,
63
+ }: StatusDialogProps) {
57
64
  const { locale } = useLocaleContext();
58
65
  const t = useMemoizedFn((key, _data = {}) => {
59
66
  return translate(translations, key, locale, 'en', _data);
@@ -13,7 +13,7 @@ interface StatusSelectorProps extends BaseStatusProps {
13
13
  anchorEl?: PopoverProps['anchorEl'];
14
14
  }
15
15
 
16
- function StatusSelector({ data, open, onSelect, anchorEl, selected }: StatusSelectorProps) {
16
+ function StatusSelector({ data, open, onSelect, anchorEl = undefined, selected }: StatusSelectorProps) {
17
17
  const { locale } = useLocaleContext();
18
18
  const t = useMemoizedFn((key, _data = {}) => {
19
19
  return translate(translations, key, locale, 'en', _data);
@@ -9,7 +9,12 @@ interface StatusMenuItemProps {
9
9
  children: React.ReactNode;
10
10
  }
11
11
 
12
- export default function StatusMenuItem({ icon, selected, onClick, children }: StatusMenuItemProps) {
12
+ export default function StatusMenuItem({
13
+ icon = undefined,
14
+ selected = undefined,
15
+ onClick,
16
+ children,
17
+ }: StatusMenuItemProps) {
13
18
  return (
14
19
  <MenuItem onClick={onClick} className={selected ? 'selected' : ''}>
15
20
  {icon && (
@@ -156,7 +156,6 @@ export default function ThirdPartyLogin({ user }: { user: User }) {
156
156
  gridTemplateColumns: '1fr min-content',
157
157
  }}>
158
158
  {!oauthAccounts.length && !passkeyAccounts.length && !walletAccounts.length ? (
159
- // @ts-expect-error 忽略 ref 类型
160
159
  <PasskeyActions
161
160
  behavior="only-new"
162
161
  action="connect"
@@ -178,7 +177,6 @@ export default function ThirdPartyLogin({ user }: { user: User }) {
178
177
  return <ThirdPartyItem key={account.id} item={account as OAuthAccount} />;
179
178
  })}
180
179
  {browser.wallet || browser.arcSphere ? null : (
181
- // @ts-expect-error 忽略 ref 类型
182
180
  <PasskeyActions
183
181
  behavior="only-new"
184
182
  action="connect"
@@ -92,7 +92,7 @@ export default function UserCenter({
92
92
  onlyProfile = false, // 只显示 profile 页面,用于 ArcSphere 只需要显示 Profile 的内容
93
93
  }: {
94
94
  readonly children: any;
95
- readonly notLoginContent: any;
95
+ readonly notLoginContent?: any;
96
96
  readonly currentTab: string;
97
97
  readonly contentProps?: BoxProps;
98
98
  readonly disableAutoRedirect?: boolean;
@@ -54,7 +54,7 @@ function LinkInput({
54
54
  /**
55
55
  * 动态链接输入框
56
56
  */
57
- function DynamicLinkForm({ links = [], onChange }: { links: string[]; onChange: (links: string[]) => void }) {
57
+ function DynamicLinkForm({ links = [], onChange }: { links?: string[]; onChange: (links: string[]) => void }) {
58
58
  const { locale } = useLocaleContext();
59
59
  const t = useMemoizedFn((key, data = {}) => {
60
60
  return translate(translations, key, locale, 'en', data);
@@ -176,7 +176,7 @@ export function LinkPreviewInput({
176
176
  onChange,
177
177
  }: {
178
178
  editable?: boolean;
179
- links: string[];
179
+ links?: string[];
180
180
  onChange: (links: string[]) => void;
181
181
  }) {
182
182
  if (editable) {
@@ -10,7 +10,7 @@ type TUserInfoItemProps = {
10
10
  verified?: boolean;
11
11
  };
12
12
 
13
- export default function UserInfoItem({ data, verified, ...rest }: TUserInfoItemProps & BoxProps) {
13
+ export default function UserInfoItem({ data, verified = false, ...rest }: TUserInfoItemProps & BoxProps) {
14
14
  return (
15
15
  <Box
16
16
  {...rest}
@@ -22,7 +22,7 @@ export default function UserInfo({
22
22
  ...rest
23
23
  }: {
24
24
  user: User;
25
- isMySelf: boolean;
25
+ isMySelf?: boolean;
26
26
  } & BoxProps) {
27
27
  const { locale } = useLocaleContext();
28
28
  const t = useMemoizedFn((key, data = {}) => {
@@ -50,12 +50,12 @@ const QuickSettings = {
50
50
  };
51
51
 
52
52
  export default function UserStatus({
53
- isMobile,
53
+ isMobile = undefined,
54
54
  size,
55
55
  isMyself,
56
56
  status,
57
57
  onChange,
58
- timezone,
58
+ timezone = undefined,
59
59
  }: {
60
60
  isMobile?: boolean;
61
61
  size: number;