Skip to content

Commit 82255bc

Browse files
authored
Merge branch 'develop' into feat/mmassets-432_network-filter-extension
2 parents cf78624 + 3ecc7f4 commit 82255bc

File tree

4 files changed

+117
-89
lines changed

4 files changed

+117
-89
lines changed

app/scripts/metamask-controller.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ import {
156156
NotificationServicesPushController,
157157
NotificationServicesController,
158158
} from '@metamask/notification-services-controller';
159-
import { isProduction } from '../../shared/modules/environment';
160159
import { methodsRequiringNetworkSwitch } from '../../shared/constants/methods-tags';
161160

162161
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
@@ -1559,7 +1558,7 @@ export default class MetamaskController extends EventEmitter {
15591558
},
15601559
},
15611560
env: {
1562-
isAccountSyncingEnabled: !isProduction() && isManifestV3,
1561+
isAccountSyncingEnabled: isManifestV3,
15631562
},
15641563
messenger: this.controllerMessenger.getRestricted({
15651564
name: 'UserStorageController',

ui/components/component-library/sensitive-text/README.md

-71
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import { Controls, Canvas } from '@storybook/blocks';
2+
3+
import * as SensitiveTextStories from './sensitive-text.stories';
4+
5+
# SensitiveText
6+
7+
SensitiveText is a component that extends the Text component to handle sensitive information. It provides the ability to hide or show the text content, replacing it with dots when hidden.
8+
9+
<Canvas of={SensitiveTextStories.DefaultStory} />
10+
11+
## Props
12+
13+
The `SensitiveText` component extends the `Text` component. See the `Text` component for an extended list of props.
14+
15+
<Controls of={SensitiveTextStories.DefaultStory} />
16+
17+
### Children
18+
19+
The text content to be displayed or hidden.
20+
21+
<Canvas of={SensitiveTextStories.Children} />
22+
23+
```jsx
24+
import { SensitiveText } from '../../component-library';
25+
26+
<SensitiveText>
27+
Sensitive Information
28+
</SensitiveText>
29+
```
30+
31+
32+
### IsHidden
33+
34+
Use the `isHidden` prop to determine whether the text should be hidden or visible. When `isHidden` is `true`, the component will display dots instead of the actual text.
35+
36+
<Canvas of={SensitiveTextStories.IsHidden} />
37+
38+
```jsx
39+
import { SensitiveText } from '../../component-library';
40+
41+
<SensitiveText isHidden>
42+
Sensitive Information
43+
</SensitiveText>
44+
```
45+
46+
### Length
47+
48+
Use the `length` prop to determine the length of the hidden text (number of dots). Can be a predefined `SensitiveTextLength` or a custom string number.
49+
50+
The following predefined length options are available:
51+
52+
- `SensitiveTextLength.Short`: `6`
53+
- `SensitiveTextLength.Medium`: `9`
54+
- `SensitiveTextLength.Long`: `12`
55+
- `SensitiveTextLength.ExtraLong`: `20`
56+
57+
- The number of dots displayed is determined by the `length` prop.
58+
- If an invalid `length` is provided, the component will fall back to `SensitiveTextLength.Short` and log a warning.
59+
- Custom length values can be provided as strings, e.g. `15`.
60+
61+
<Canvas of={SensitiveTextStories.Length} />
62+
63+
```jsx
64+
import { SensitiveText, SensitiveTextLength } from '../../component-library';
65+
66+
<SensitiveText length={SensitiveTextLength.Short}>
67+
Length "short" (6 characters)
68+
</SensitiveText>
69+
<SensitiveText length={SensitiveTextLength.Medium}>
70+
Length "medium" (9 characters)
71+
</SensitiveText>
72+
<SensitiveText length={SensitiveTextLength.Long}>
73+
Length "long" (12 characters)
74+
</SensitiveText>
75+
<SensitiveText length={SensitiveTextLength.ExtraLong}>
76+
Length "extra long" (20 characters)
77+
</SensitiveText>
78+
<SensitiveText length="15">
79+
Length "15" (15 characters)
80+
</SensitiveText>
81+
```
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,58 @@
1-
import { StoryFn, Meta } from '@storybook/react';
1+
import type { Meta, StoryObj } from '@storybook/react';
22
import React from 'react';
33
import { SensitiveText } from '.';
44
import { SensitiveTextLength } from './sensitive-text.types';
5+
import README from './README.mdx';
56
import { Box } from '../box';
67
import {
78
Display,
89
FlexDirection,
910
} from '../../../helpers/constants/design-system';
1011

11-
export default {
12+
const meta: Meta<typeof SensitiveText> = {
1213
title: 'Components/ComponentLibrary/SensitiveText',
1314
component: SensitiveText,
15+
parameters: {
16+
docs: {
17+
page: README,
18+
},
19+
},
1420
args: {
1521
children: 'Sensitive information',
1622
isHidden: false,
1723
length: SensitiveTextLength.Short,
1824
},
1925
} as Meta<typeof SensitiveText>;
2026

21-
const Template: StoryFn<typeof SensitiveText> = (args) => {
22-
return <SensitiveText {...args} />;
23-
};
27+
export default meta;
28+
type Story = StoryObj<typeof SensitiveText>;
2429

25-
export const DefaultStory = Template.bind({});
30+
export const DefaultStory: Story = {};
2631
DefaultStory.storyName = 'Default';
2732

28-
export const HiddenText: StoryFn<typeof SensitiveText> = (args) => {
29-
return <SensitiveText {...args} />;
33+
export const Children: Story = {
34+
args: {
35+
children: 'Sensitive information',
36+
},
37+
render: (args) => (
38+
<SensitiveText {...args} />
39+
),
3040
};
31-
HiddenText.args = {
32-
isHidden: true,
41+
42+
export const IsHidden: Story = {
43+
args: {
44+
isHidden: true,
45+
},
46+
render: (args) => (
47+
<SensitiveText {...args} />
48+
),
3349
};
3450

35-
export const LengthVariants: StoryFn<typeof SensitiveText> = (args) => {
36-
return (
51+
export const Length: Story = {
52+
args: {
53+
isHidden: true,
54+
},
55+
render: (args) => (
3756
<Box display={Display.Flex} flexDirection={FlexDirection.Column} gap={2}>
3857
<SensitiveText {...args} length={SensitiveTextLength.Short}>
3958
Length "short" (6 characters)
@@ -47,9 +66,9 @@ export const LengthVariants: StoryFn<typeof SensitiveText> = (args) => {
4766
<SensitiveText {...args} length={SensitiveTextLength.ExtraLong}>
4867
Length "extra long" (20 characters)
4968
</SensitiveText>
69+
<SensitiveText {...args} length="15">
70+
Length "15" (15 characters)
71+
</SensitiveText>
5072
</Box>
51-
);
52-
};
53-
LengthVariants.args = {
54-
isHidden: true,
73+
),
5574
};

0 commit comments

Comments
 (0)