Skip to content

Commit 59ee775

Browse files
Merge pull request #130 from multiversx/development
v0.0.7
2 parents da30af3 + 19ca585 commit 59ee775

File tree

171 files changed

+4986
-4589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+4986
-4589
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [[0.0.7](https://github.com/multiversx/mx-sdk-dapp-ui/pull/130)] - 2025-06-23
11+
12+
- [Fixed Ledger connect header close button not working](https://github.com/multiversx/mx-sdk-dapp-ui/pull/129)
13+
- [Fixed the ExplorerLink shadow DOM status and layout](https://github.com/multiversx/mx-sdk-dapp-ui/pull/128)
14+
- [Updated the Ledger mobile layout and converted styles to Tailwind](https://github.com/multiversx/mx-sdk-dapp-ui/pull/127)
15+
- [Unify colors in global variables for light / dark themes](https://github.com/multiversx/mx-sdk-dapp-ui/pull/126)
16+
- [Removed Satoshi font and allow custom fonts from dApp](https://github.com/multiversx/mx-sdk-dapp-ui/pull/125)
17+
- [Updated Unlock Panel to be responsive and mobile friendly](https://github.com/multiversx/mx-sdk-dapp-ui/pull/124)
18+
- [Mobile version for notifications feed](https://github.com/multiversx/mx-sdk-dapp-ui/pull/123)
19+
- [Updated the CSS to leverage on Tailwind classes in multiple elements](https://github.com/multiversx/mx-sdk-dapp-ui/pull/122)
20+
- [Added "data" field decoding methods support](https://github.com/multiversx/mx-sdk-dapp-ui/pull/121)
21+
- [Updated README](https://github.com/multiversx/mx-sdk-dapp-ui/pull/120)
22+
- [Migrate styles from css to tailwind](https://github.com/multiversx/mx-sdk-dapp-ui/pull/119)
23+
- [Added dynamic gas](https://github.com/multiversx/mx-sdk-dapp-ui/pull/118)
24+
1025
## [[0.0.6](https://github.com/multiversx/mx-sdk-dapp-ui/pull/117)] - 2025-05-30
1126

1227
- [Refactor Transactions Table types][https://github.com/multiversx/mx-sdk-dapp-ui/pull/116]

README.md

Lines changed: 104 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@ MultiversX Front-End Library for JavaScript and TypeScript (written in TypeScrip
66

77
`sdk-dapp-ui` is a library that holds components to display user information from the MultiversX blockchain.
88

9-
Since the library is built using [Stencil](https://stenciljs.com/), it can be used in any front-end framework, such as React, Angular, or Vue, but also in back-end frameworks like Next.js.
9+
Since the library is built using [Stencil](https://stenciljs.com/), it can be used in any front-end framework, such as [React](https://github.com/multiversx/mx-template-dapp), Angular, or [Solid.js](https://github.com/multiversx/mx-solidjs-template-dapp), but also in back-end frameworks like [Next.js](https://github.com/multiversx/mx-template-dapp-nextjs).
1010

1111
## GitHub project
12+
1213
The GitHub repository can be found here: [https://github.com/multiversx/mx-sdk-dapp-ui](https://github.com/multiversx/mx-sdk-dapp-ui)
1314

1415
## Live demo: template-dapp
15-
See [Template dApp](https://template-dapp.multiversx.com/) for live demo or checkout usage in the [Github repo](https://github.com/multiversx/mx-template-dapp)
1616

17+
See [Template dApp](https://template-dapp.multiversx.com/) for live demo or checkout usage in the [Github repo](https://github.com/multiversx/mx-template-dapp)
1718

1819
## Requirements
20+
1921
- Node.js version 20.13.1+
2022
- Npm version 10.5.2+
2123

@@ -41,96 +43,120 @@ yarn add @multiversx/sdk-dapp-ui
4143

4244
`sdk-dapp-ui` library is primarily designed to work with [@multiversx/sdk-dapp](https://www.npmjs.com/package/@multiversx/sdk-dapp), since components are designed to display data and emit user events, but do not hold any business logic.
4345

44-
The library is divided into three main categories:
45-
There are three types of components in the library:
46-
1. The ones that only display data (visual)
47-
2. The ones that display data provided by a controller (controlled)
48-
3. The ones that are designed for user interaction (functional).
49-
50-
Below we will detail these categories:
51-
52-
### 1. Visual components
46+
The basic usage of the components would be importing the component and its corresponding interface and creating a wrapper for it in your application.
5347

54-
The basic usage of the component would be importing the component and its corresponding interface and creating a wrapper for it in your application.
48+
It outputs both web components (working out of the box) and React components (you need to create a wrapper for them).
5549

56-
React example where the component does not need any processed data:
50+
### React Components import
5751

5852
```tsx
59-
import type { CopyButton as CopyButtonPropsType } from '@multiversx/sdk-dapp-ui/dist/types/components/visual/copy-button/copy-button.d.ts';
60-
export { CopyButton as ReactCopyButton } from '@multiversx/sdk-dapp-ui/react';
61-
62-
export const CopyButton = (props: CopyButtonPropsType) => {
63-
return <ReactCopyButton {...props} />;
64-
};
53+
export {
54+
MvxCopyButton,
55+
MvxExplorerLink,
56+
MvxFormatAmount,
57+
MvxTransactionsTable,
58+
MvxUnlockButton,
59+
} from '@multiversx/sdk-dapp-ui/react';
6560
```
6661

67-
### 2. Controlled components
62+
The library is divided into three main categories of components:
6863

69-
Controlled components are designed to display data that is processed by a controller. The controller is responsible for processing the data and providing it to the component.
64+
1. The ones that only display data (visual)
65+
2. The ones that display data provided by a controller (controlled)
66+
3. The ones that are designed for user interaction (functional)
7067

71-
A typycal flow of data would be:
68+
### 1. Visual Components
7269

73-
```mermaid
74-
flowchart LR
75-
A["user data"] <--> B["sdk-dapp controller"] <--> C["sdk-dapp-ui webcomponent"]
76-
```
70+
Visual components are the most basic building blocks that handle pure presentation. They are controlled through props and don't contain any business logic. These components focus on consistent styling and user interface elements.
7771

78-
Vanilla example where the component makes use of a controller from `sdk-dapp`:
72+
Components:
7973

80-
```tsx
81-
export { FormatAmountController } from "@multiversx/sdk-dapp/out/controllers/FormatAmountController";
82-
import { DIGITS, DECIMALS } from "@multiversx/sdk-dapp-utils/out/constants";
83-
84-
85-
export const FormatAmount = (props: {
86-
egldLabel?: string;
87-
value: string;
88-
}) => {
89-
const { isValid, valueDecimal, valueInteger, label } =
90-
FormatAmountController.getData({
91-
digits: DIGITS,
92-
decimals: DECIMALS,
93-
...props,
94-
input: props.value
95-
});
74+
- **Preloader** (`mvx-preloader`): A loading indicator for asynchronous operations
75+
- **Font Awesome Icon** (`mvx-fa-icon`): Icon component with Font Awesome integration
76+
- **Side Panel** (`mvx-side-panel`): Sliding panel with header and content sections
77+
- **Tooltip** (`mvx-tooltip`): Contextual information display with hover/click activation
78+
- **Transaction List Item**: Structured display of transaction information
79+
- **Pagination** (`mvx-pagination`): Navigation controls for paginated content
80+
81+
### Visual Component Example
9682

83+
```tsx
84+
export { getStore } from '@multiversx/sdk-dapp/out/store/store';
85+
export type { ExplorerLink as ExplorerLinkSDKPropsType } from '@multiversx/sdk-dapp-ui/dist/types/components/visual/explorer-link/explorer-link.d.ts';
86+
export { networkSelector } from '@multiversx/sdk-dapp/out/store/selectors/networkSelectors';
87+
import { IPropsWithClass, IPropsWithChildren } from 'types';
88+
89+
interface ExplorerLinkPropsType extends Partial<ExplorerLinkSDKPropsType> {
90+
'page': string;
91+
'class'?: string;
92+
'data-testid'?: string;
93+
'children'?: JSX.Element;
94+
}
95+
96+
export const ExplorerLink = ({
97+
children,
98+
page,
99+
'class': className,
100+
'data-testid': dataTestId,
101+
...rest
102+
}: ExplorerLinkPropsType) => {
103+
const store = getStore();
104+
const network = networkSelector(store.getState());
97105
return (
98-
<format-amount
99-
class={props.class}
100-
data-testid={props["data-testid"]}
101-
isValid={isValid}
102-
label={label}
103-
valueDecimal={valueDecimal}
104-
valueInteger={valueInteger}
105-
/>
106+
<mvx-explorer-link link={`${network.explorerAddress}${page}`} class={className} data-testid={dataTestId} {...rest}>
107+
{children ? <div>{children}</div> : null}
108+
</mvx-explorer-link>
106109
);
107110
};
108111
```
109112

113+
### 2. Controlled Components
110114

111-
### 3. Functional components
115+
Controlled components are designed to display data that is processed by a controller. They receive formatted data through props and focus on consistent data presentation. These components are typically used in data-heavy sections of the application.
112116

113-
Functional components in the `sdk-dapp-ui` library are designed to create interactive UIs and handle user events effectively. Typically, these components are embedded in login or signing transactions flows. They typically leverage the functionality provided by the `@multiversx/sdk-dapp` library to manage state and actions.
117+
Components:
114118

115-
The way functional components are controlled are trough a [pub-sub pattern](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern) called EventBus. Each webcomponent has a method of exposing its EventBus, thus allowing sdk-dapp to get a reference to it and use it for communication.
119+
- **Format Amount** (`mvx-format-amount`): Numerical amount formatting with validation
120+
- **Transactions Table** (`mvx-transactions-table`): Structured display of transaction data
116121

117-
```mermaid
118-
flowchart LR
119-
A["Controller"] <--> B["Event Bus"] <--> C["webcomponent"]
120-
```
122+
### Controlled Component Example
121123

122-
```typescript
123-
const modalElement = await createUIElement<LedgerConnectModal>(
124-
'ledger-connect-modal'
125-
);
126-
const eventBus = await modalElement.getEventBus();
127-
eventBus.publish('TRANSACTION_TOAST_DATA_UPDATE', someData);
124+
```tsx
125+
import { TransactionsTableController } from '@multiversx/sdk-dapp/out/controllers/TransactionsTableController';
126+
import { accountSelector } from '@multiversx/sdk-dapp/out/store/selectors/accountSelectors';
127+
import { networkSelector } from '@multiversx/sdk-dapp/out/store/selectors/networkSelectors';
128+
import { getStore } from '@multiversx/sdk-dapp/out/store/store';
129+
130+
export const TransactionsTable = () => {
131+
const store = getStore();
132+
const network = networkSelector(store.getState());
133+
const account = accountSelector(store.getState());
134+
135+
const data = await TransactionsTableController.processTransactions({
136+
address: account().address,
137+
egldLabel: network().egldLabel,
138+
explorerAddress: network().explorerAddress,
139+
transactions: props.transactions || [],
140+
});
141+
142+
return <mvx-transactions-table transactions={data} />;
143+
};
128144
```
129145

130-
If you need to have a custom implementation of a functional component, you have to follow some simple steps:
146+
### 3. Functional Components
147+
148+
Functional components handle specific application functionality and business logic. They integrate with the application's event system and manage user interactions. These components are typically used in complex workflows like authentication and transaction signing.
131149

132-
- design a UI component that has a method called `getEventBus`, implementing the `IEventBus` interface found in `src/utils/EventBus.ts`
133-
- make sure to implement the same interfaces as the original component. For example, if overriding the `ledger-connect-modal`, you can find the interfaces in `src/components/ledger-connect-modal/ledger-connect-modal.types.ts`
150+
Components:
151+
152+
- **Sign Transactions Panel** (`mvx-sign-transactions-panel`): Transaction signing workflow
153+
- **Notifications Feed** (`mvx-notifications-feed`): Transaction notifications and history
154+
- **Wallet Connect** (`mvx-wallet-connect`): Wallet connection flow
155+
- **Unlock Panel** (`mvx-unlock-panel`): Wallet authentication
156+
- **Toast List** (`mvx-toast-list`): Notification management
157+
- **Ledger Connect** (`mvx-ledger-connect`): Hardware wallet connection
158+
159+
You can check out the way these components are used in `@multiversx/sdk-dapp` [here](https://github.com/multiversx/mx-sdk-dapp/blob/main/src/managers/UnlockPanelManager/UnlockPanelManager.ts).
134160

135161
## Debugging your dApp
136162

@@ -159,3 +185,14 @@ To run the unit tests, run:
159185
npm test
160186
```
161187

188+
To run a specific test file in Stencil, run:
189+
190+
```bash
191+
npx stencil test src/components/visual/transaction-list-item/tests/transaction-list-item.spec.tsx --spec
192+
```
193+
194+
To run an individual test from a specific test file in Stencil, run:
195+
196+
```bash
197+
npx stencil test src/components/visual/transaction-list-item/tests/transaction-list-item.spec.tsx --spec -t 'renders with asset icon'
198+
```

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@multiversx/sdk-dapp-ui",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "A library to hold UI components for a dApp on the MultiversX blockchain",
55
"author": "MultiversX",
66
"license": "MIT",
@@ -28,6 +28,10 @@
2828
"./react": {
2929
"import": "./dist/react/components.ts",
3030
"require": "./dist/react/components.ts"
31+
},
32+
"./react/constants": {
33+
"import": "./dist/react/constants.ts",
34+
"require": "./dist/react/constants.ts"
3135
}
3236
},
3337
"repository": {
-24.6 KB
Binary file not shown.
-24.9 KB
Binary file not shown.
-24.8 KB
Binary file not shown.

src/assets/icons/angle-left-icon/angle-left-icon.scss

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/assets/icons/angle-right-icon/angle-right-icon.scss

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
:host {
2-
display: flex;
2+
@apply mvx:flex;
33

44
.arrow-right-icon {
5-
width: 16px;
6-
height: 16px;
5+
@apply mvx:w-4 mvx:h-4;
76
}
87
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
:host {
2+
@apply mvx:flex;
3+
4+
.arrow-up-right-from-square-icon {
5+
@apply mvx:w-4 mvx:h-4 mvx:flex;
6+
fill: var(--mvx-text-color-primary);
7+
}
8+
}

0 commit comments

Comments
 (0)