Skip to content

Commit 1688a12

Browse files
committed
Merge branch 'main' of github.com:deriv-com/ui into aizad/FEQ-1566/add-accordion
2 parents 13461ab + 01e6529 commit 1688a12

File tree

16 files changed

+2421
-1677
lines changed

16 files changed

+2421
-1677
lines changed

.github/workflows/publish_npm_package.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
2929
with:
3030
node-version: '20'
31+
- name: Update to latest npm (temporary fix for audit below)
32+
run: npm install --global npm
3133
- name: Install dependencies
3234
run: npm clean-install
3335
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
@@ -40,4 +42,4 @@ jobs:
4042
CI: true
4143
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4244
NPM_TOKEN: ${{ secrets.NPM_TOKEN}}
43-
run: npx semantic-release
45+
run: npx semantic-release

.github/workflows/test_workflow.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ jobs:
2323
- name: Setup Node.js
2424
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
2525
with:
26-
node-version: "20"
26+
node-version: '20'
27+
- name: Update to latest npm (temporary fix for audit below)
28+
run: npm install --global npm
2729
- name: Install dependencies
2830
run: npm clean-install
2931
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies

CHANGELOG.md

+81
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,84 @@
1+
## [1.10.2](https://github.com/deriv-com/ui/compare/v1.10.1...v1.10.2) (2024-03-06)
2+
3+
4+
### ♻️ Chores
5+
6+
* fix ci/cd spelling ([1b40558](https://github.com/deriv-com/ui/commit/1b40558305f9aa9c9fab2cdc85b40d043a6d80c6))
7+
* rebuild package-lock ([6d96734](https://github.com/deriv-com/ui/commit/6d96734b0b14efc674e9ece22d2d5ad8afd29d32))
8+
* revert specific tag ([d829dba](https://github.com/deriv-com/ui/commit/d829dba9c879473da2e3d98ec019b67976e018d2))
9+
* revert specific tag ([2377475](https://github.com/deriv-com/ui/commit/23774756514750741cccf425518797a019a98804))
10+
* update ci/cd to latest npm ([4133dec](https://github.com/deriv-com/ui/commit/4133dec57e8b6c041a1e7948f42c6220e3aaf009))
11+
* update ci/cd to latest npm ([70232c3](https://github.com/deriv-com/ui/commit/70232c37132752d02c3cf8f05916197e241f5b4d))
12+
* upgrade dependencies ([b8747c7](https://github.com/deriv-com/ui/commit/b8747c762dc9a6f57e198b4137cd0ed5418d7ae9))
13+
* upgrade dependencies ([a46bc52](https://github.com/deriv-com/ui/commit/a46bc52529d44b7849391dd674dd0a602f6cd3a3))
14+
* use latest setup-node version ([daa4144](https://github.com/deriv-com/ui/commit/daa414443457440c8a756bdf60a8020abc3c1cca))
15+
16+
## [1.10.1](https://github.com/deriv-com/ui/compare/v1.10.0...v1.10.1) (2024-03-06)
17+
18+
19+
### ♻️ Chores
20+
21+
* exported linear progress bar component from lib ([14811d1](https://github.com/deriv-com/ui/commit/14811d15a64c40e561cc4d60de3b569d644ce40c))
22+
* exported linear progress bar component from lib ([37f408c](https://github.com/deriv-com/ui/commit/37f408c28d8233c6e066bb00480be290cc4e89e0))
23+
* fixed the import state orders ([61a428d](https://github.com/deriv-com/ui/commit/61a428db7192a9e7b5171a22985bce56d27075ed))
24+
25+
# [1.10.0](https://github.com/deriv-com/ui/compare/v1.9.7...v1.10.0) (2024-03-06)
26+
27+
28+
### ✨ Features
29+
30+
* added css properties from root file ([a2473aa](https://github.com/deriv-com/ui/commit/a2473aa671b628c0282cd475e610a9e8cd6fbed7))
31+
* added linear progress bar component ([0d7e936](https://github.com/deriv-com/ui/commit/0d7e9364b0c9e2422dde9f0b662dffd22a6e8d00))
32+
* added progress bar component ([92a6b68](https://github.com/deriv-com/ui/commit/92a6b68abe22c2043cec54e6dbc3a696b89dfe73))
33+
* changed css names ([5468817](https://github.com/deriv-com/ui/commit/54688171447e7796d9f48609a052b25d88855de7))
34+
* made changes in test cases and added div props ([9fde470](https://github.com/deriv-com/ui/commit/9fde4701c6bf001090d594e6b717083d1c4366d6))
35+
36+
37+
### 📦 Code Refactoring
38+
39+
* added limit props ([1a0d270](https://github.com/deriv-com/ui/commit/1a0d2707c2ed39ebb8eb3c3439e6122731516002))
40+
* added stories for linear progressbar ([bf77376](https://github.com/deriv-com/ui/commit/bf7737686c05cc64c59407db8db0ad47a49c21c7))
41+
* added test cases for progress bar component ([8e42f04](https://github.com/deriv-com/ui/commit/8e42f04aadf222b6d2a2a8340f48869ce8d9a6f0))
42+
* changes scss name to linearprogressbar ([9127a51](https://github.com/deriv-com/ui/commit/9127a51f1de7342e07fcdd65c98f9eb7c9737a13))
43+
* deleted test file ([110e45a](https://github.com/deriv-com/ui/commit/110e45a99312e28f91b811fc02f593ef39e0922c))
44+
* removed test component from main file ([255bc4c](https://github.com/deriv-com/ui/commit/255bc4ccba9e72e1ae3c4d6f9e975193ab735457))
45+
46+
## [1.9.7](https://github.com/deriv-com/ui/compare/v1.9.6...v1.9.7) (2024-03-06)
47+
48+
49+
### ♻️ Chores
50+
51+
* set margin-left for close-icon to auto ([ae9ec5e](https://github.com/deriv-com/ui/commit/ae9ec5ea062cca3d10737d110723c7a9848b3db4))
52+
53+
54+
### 🐛 Bug Fixes
55+
56+
* added new classname to modal header ([1f4a52e](https://github.com/deriv-com/ui/commit/1f4a52e4f7e17635a0c9347ef83bf06f771f7841))
57+
* added new classname to modal header ([7d719f1](https://github.com/deriv-com/ui/commit/7d719f14476389e51be1bec58762240a9af82d37))
58+
59+
## [1.9.6](https://github.com/deriv-com/ui/compare/v1.9.5...v1.9.6) (2024-03-06)
60+
61+
62+
### ♻️ Chores
63+
64+
* add unit tests for ActionScreen ([3f35736](https://github.com/deriv-com/ui/commit/3f357366b181294b3f0a369a9b02bd7a243de7e3))
65+
* add unit tests for ActionScreen ([41995fc](https://github.com/deriv-com/ui/commit/41995fc356e3f61c5c694748b0ac57aa8bbce674))
66+
67+
## [1.9.5](https://github.com/deriv-com/ui/compare/v1.9.4...v1.9.5) (2024-03-06)
68+
69+
70+
### 🐛 Bug Fixes
71+
72+
* fixed oveflow issue in modal body ([07cf63d](https://github.com/deriv-com/ui/commit/07cf63deab1178f68115701b78bc7332796e8531))
73+
* fixed oveflow issue in modal body ([e5627d8](https://github.com/deriv-com/ui/commit/e5627d8a7134732557ccc1efa851d7725933d237))
74+
75+
## [1.9.4](https://github.com/deriv-com/ui/compare/v1.9.3...v1.9.4) (2024-03-05)
76+
77+
78+
### 🐛 Bug Fixes
79+
80+
* change everything to use px as of now ([101d1a8](https://github.com/deriv-com/ui/commit/101d1a8869a3d7dfaf32ec2e03c651e8b621a8bd))
81+
182
## [1.9.3](https://github.com/deriv-com/ui/compare/v1.9.2...v1.9.3) (2024-03-05)
283

384

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import React from 'react';
2+
import { render, screen } from '@testing-library/react';
3+
import { ActionScreen } from '..';
4+
5+
describe('ActionScreen component', () => {
6+
it('should render without crashing', () => {
7+
render(<ActionScreen />);
8+
});
9+
10+
it('should display the title when provided', () => {
11+
const title = 'Test Title';
12+
render(<ActionScreen title={title} />);
13+
const titleElement = screen.getByText(title);
14+
expect(titleElement).toBeInTheDocument();
15+
});
16+
17+
it('should not display the title element when title prop is not provided', () => {
18+
const { queryByText } = render(<ActionScreen />);
19+
const titleElement = queryByText(/someTitle/i);
20+
expect(titleElement).toBeNull();
21+
});
22+
23+
it('should display the description when provided', () => {
24+
const description = 'Test description';
25+
render(<ActionScreen description={description} />);
26+
expect(screen.getByText(description)).toBeInTheDocument();
27+
});
28+
29+
it('should not display the description element when description prop is not provided', () => {
30+
const { queryByText } = render(<ActionScreen />);
31+
expect(queryByText(/.+/)).toBeNull();
32+
});
33+
34+
it('should apply the default descriptionSize when not provided', () => {
35+
render(<ActionScreen description="Sample description" />);
36+
const descriptionElement = screen.getByText('Sample description');
37+
expect(descriptionElement).toHaveClass('derivs-text__size--md');
38+
});
39+
40+
it('should apply the specified descriptionSize when provided', () => {
41+
render(
42+
<ActionScreen
43+
description="Test description"
44+
descriptionSize="lg"
45+
/>
46+
);
47+
const descriptionElement = screen.getByText('Test description');
48+
expect(descriptionElement).toHaveClass('derivs-text__size--lg');
49+
});
50+
51+
it('should apply the default titleSize when not provided', () => {
52+
render(<ActionScreen title="Sample Title" />);
53+
const titleElement = screen.getByText('Sample Title');
54+
expect(titleElement).toHaveClass('derivs-text__size--md');
55+
});
56+
57+
it('should apply the specified titleSize when provided', () => {
58+
const { getByText } = render(<ActionScreen title="Test Title" titleSize="lg" />);
59+
const titleElement = getByText('Test Title');
60+
expect(titleElement).toHaveClass('derivs-text__size--lg');
61+
});
62+
63+
it('should display the actionButtons when provided', () => {
64+
const actionButtons = <button>Click me</button>;
65+
const { getByText } = render(<ActionScreen actionButtons={actionButtons} />);
66+
expect(getByText('Click me')).toBeInTheDocument();
67+
});
68+
69+
it('should not display the actionButtons element when actionButtons prop is not provided', () => {
70+
const { queryByText } = render(<ActionScreen />);
71+
expect(queryByText('Click me')).not.toBeInTheDocument();
72+
});
73+
74+
it('should render the icon when provided', () => {
75+
const icon = <span className="custom-icon" />;
76+
const { container } = render(<ActionScreen icon={icon} />);
77+
expect(container.querySelector('.custom-icon')).toBeInTheDocument();
78+
});
79+
80+
it('should not render the icon element when icon prop is not provided', () => {
81+
const { container } = render(<ActionScreen />);
82+
expect(container.querySelector('.custom-icon')).not.toBeInTheDocument();
83+
});
84+
85+
it('should render Text component for title with correct props', () => {
86+
const { getByText } = render(<ActionScreen title="Test Title" titleSize="lg" />);
87+
const titleElement = getByText('Test Title').parentNode;
88+
expect(titleElement).toHaveClass('derivs-action-screen__info');
89+
});
90+
91+
it('should render Text component for description with correct props', () => {
92+
const description = "This is a test description";
93+
const { getByText } = render(<ActionScreen description={description} descriptionSize="sm" />);
94+
const descriptionElement = getByText(description).parentNode;
95+
expect(descriptionElement).toHaveClass('derivs-action-screen__info');
96+
});
97+
98+
it('should correctly render non-element description as Text component', () => {
99+
const description = "This is a test description";
100+
const { getByText } = render(<ActionScreen description={description} />);
101+
expect(getByText(description)).toBeInTheDocument();
102+
});
103+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
$inactive_color: var(--general-main-3, #999999);
2+
$success_color: var(--status-success, #4bb4b3 );
3+
$warning_color: var(--status-warning, #ffad3a);
4+
$error_color: var(--status-danger, #ec3f3f);
5+
$active_color:var(--state-active, #d6dadb);
6+
$border_section:var(--border-divider, #f2f3f4);
7+
$state_hover:var(--general-hover, #e6e9e9);
8+
$BORDER_RADIUS:4px;
9+
10+
.deriv-linear-progress-bar {
11+
position: relative;
12+
width: 100%;
13+
padding: unset;
14+
box-sizing: border-box;
15+
margin: 8px 0;
16+
border-bottom: 1px solid $border_section ;
17+
18+
&__track {
19+
background: $inactive_color;
20+
position: relative;
21+
margin: 2px 0 8px;
22+
height: 6px;
23+
width: 100%;
24+
border-radius: #{$BORDER_RADIUS * 2};
25+
}
26+
27+
&__line {
28+
background: $state_hover;
29+
position: absolute;
30+
top: 0;
31+
left: 0;
32+
height: 100%;
33+
border-radius: #{$BORDER_RADIUS * 2};
34+
pointer-events: none;
35+
transition: width 0.3s;
36+
37+
&--green {
38+
background: $success_color !important;
39+
}
40+
&--yellow {
41+
background: $warning_color !important;
42+
}
43+
&--red {
44+
background: $error_color !important;
45+
}
46+
}
47+
&__infinite-loader {
48+
position: relative;
49+
height: 4px;
50+
display: block;
51+
width: 100%;
52+
background-color: $state_hover;
53+
border-radius: 2px;
54+
background-clip: padding-box;
55+
margin: 0.5rem 0 1rem;
56+
overflow: hidden;
57+
58+
&--skelton-loader {
59+
background-color: $active_color;
60+
61+
&:before,
62+
&:after {
63+
content: '';
64+
position: absolute;
65+
background-color: inherit;
66+
top: 0;
67+
left: 0;
68+
bottom: 0;
69+
will-change: left, right;
70+
}
71+
&:before {
72+
animation: skelton-loader 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
73+
}
74+
&:after {
75+
animation: skelton-loader-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
76+
animation-delay: 1.15s;
77+
}
78+
}
79+
@keyframes skelton-loader {
80+
0% {
81+
left: -35%;
82+
right: 100%;
83+
}
84+
60% {
85+
left: 100%;
86+
right: -90%;
87+
}
88+
100% {
89+
left: 100%;
90+
right: -90%;
91+
}
92+
}
93+
@keyframes skelton-loader-short {
94+
0% {
95+
left: -200%;
96+
right: 100%;
97+
}
98+
60% {
99+
left: 107%;
100+
right: -8%;
101+
}
102+
100% {
103+
left: 107%;
104+
right: -8%;
105+
}
106+
}
107+
}
108+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import React from 'react';
2+
import { render,screen } from '@testing-library/react';
3+
import { LinearProgressBar } from '..';
4+
5+
describe('LinearProgressBar', () => {
6+
const props = {
7+
danger_limit:10,
8+
is_loading:false,
9+
label:"Test Label",
10+
percentage:50,
11+
warning_limit:80
12+
}
13+
it('renders with default props', () => {
14+
render(
15+
<LinearProgressBar {...props}/>
16+
);
17+
const progressBar = screen.getByText("Test Label")
18+
expect(progressBar).toBeInTheDocument();
19+
});
20+
21+
it('renders loading state', () => {
22+
render(
23+
<LinearProgressBar
24+
danger_limit={10}
25+
is_loading={true}
26+
label="Loading"
27+
percentage={0}
28+
warning_limit={80}
29+
/>
30+
);
31+
const loadingBar=document.querySelector(".deriv-linear-progress-bar__infinite-loader");
32+
expect(loadingBar).toBeInTheDocument();
33+
});
34+
35+
it('renders progress bar with custom label', () => {
36+
const { getByText } = render(
37+
<LinearProgressBar {...props} label={<span>Custom Label</span>} />
38+
);
39+
const label = getByText('Custom Label');
40+
expect(label).toBeInTheDocument();
41+
expect(label.nodeName).toBe('SPAN');
42+
});
43+
44+
it('renders progress bar with correct color based on percentage', () => {
45+
render(
46+
<LinearProgressBar {...props} percentage={70} />
47+
);
48+
const progressBar = document.querySelector('.deriv-linear-progress-bar__line');
49+
expect(progressBar).toHaveClass('deriv-linear-progress-bar__line--yellow');
50+
});
51+
52+
});

0 commit comments

Comments
 (0)