fleetcor-lwc 3.5.1 → 3.6.0
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.
- package/README.md +43 -6
- package/frontend/components/flt/card/card.scss +2 -9
- package/frontend/components/flt/loader/__test__/loader.test.js +20 -0
- package/frontend/components/flt/loader/loader.html +8 -0
- package/frontend/components/flt/loader/loader.js +4 -0
- package/frontend/components/flt/loader/loader.scss +41 -0
- package/frontend/components/flt/modal/__test__/modal.test.js +22 -0
- package/frontend/components/flt/modal/modal.js +6 -1
- package/frontend/components/flt/modal/modal.scss +1 -0
- package/frontend/components/flt/progressStep/__test__/progressStep.test.js +6 -6
- package/frontend/core/interface/ModalViewer.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -243,16 +243,37 @@ Add / update `lwc.config.json` file in your project
|
|
|
243
243
|
| ------- | ----------------------------- |
|
|
244
244
|
| default | any html element can be there |
|
|
245
245
|
|
|
246
|
+
### Loader
|
|
247
|
+
|
|
248
|
+
```html
|
|
249
|
+
<flt-loader>
|
|
250
|
+
<flt-icon icon="arrow-left"></flt-icon>
|
|
251
|
+
</flt-loader>
|
|
252
|
+
...
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
#### Loader slot
|
|
256
|
+
|
|
257
|
+
| slot | description |
|
|
258
|
+
| ------- | ----------------------------- |
|
|
259
|
+
| default | any html element can be there |
|
|
260
|
+
|
|
246
261
|
### Modal
|
|
247
262
|
|
|
248
263
|
```html
|
|
249
|
-
<flt-modal>
|
|
264
|
+
<flt-modal deactive-glass>
|
|
250
265
|
<flt-icon icon="arrow-left"></flt-icon>
|
|
251
266
|
</flt-modal>
|
|
252
267
|
|
|
253
268
|
...
|
|
254
269
|
```
|
|
255
270
|
|
|
271
|
+
#### Modal variables
|
|
272
|
+
|
|
273
|
+
| @api variables | type | values | required | description |
|
|
274
|
+
| -------------- | ---- | ------ | -------- | --------------------------------------- |
|
|
275
|
+
| deactiveGlass | bool | | - | Depricate close modal by clicking glass |
|
|
276
|
+
|
|
256
277
|
#### Modal slot
|
|
257
278
|
|
|
258
279
|
| slot | description |
|
|
@@ -408,7 +429,7 @@ This component fully extends from `Input Text`
|
|
|
408
429
|
|
|
409
430
|
#### ModalViewer
|
|
410
431
|
|
|
411
|
-
- `ModalViewer.showModalWithComponent(element)` - to show modal window with element inside
|
|
432
|
+
- `ModalViewer.showModalWithComponent(element, options)` - to show modal window with element inside
|
|
412
433
|
- `ModalViewer.hideModals()` - remove all modals
|
|
413
434
|
|
|
414
435
|
```js
|
|
@@ -422,7 +443,7 @@ btn.onclick = () => {
|
|
|
422
443
|
ModalViewer.hideModals();
|
|
423
444
|
};
|
|
424
445
|
|
|
425
|
-
ModalViewer.showModalWithComponent(btn);
|
|
446
|
+
ModalViewer.showModalWithComponent(btn, { duration: 700, deactiveGlass: true });
|
|
426
447
|
```
|
|
427
448
|
|
|
428
449
|
## Override styles
|
|
@@ -497,18 +518,34 @@ You can override them as you wish by global css variables as priority.
|
|
|
497
518
|
--flt-input-border-color-success: #59eb9c;
|
|
498
519
|
--flt-input-border-radius: 12px;
|
|
499
520
|
--flt-card-bgc: #fff;
|
|
500
|
-
--flt-card-padding
|
|
501
|
-
--flt-card-border-radius
|
|
521
|
+
--flt-card-padding: 24px;
|
|
522
|
+
--flt-card-border-radius: 20px;
|
|
502
523
|
--flt-card-box-shadow: (
|
|
503
524
|
0px 2px 3px 0px #0000004d,
|
|
504
525
|
0px 6px 10px 4px #00000026
|
|
505
526
|
);
|
|
506
|
-
--flt-
|
|
527
|
+
--flt-loader-gap: 16px;
|
|
528
|
+
--flt-loader-background: #ffffff;
|
|
529
|
+
--flt-loader-spinner-circle: 80px;
|
|
530
|
+
--flt-loader-spinner-fill-first-part: #ffffff;
|
|
531
|
+
--flt-loader-spinner-fill: #85a2b6;
|
|
532
|
+
--flt-loader-spinner-inner-circle-percent: 88%;
|
|
533
|
+
--flt-loader-spinner-bgc-inner-circle: #ffffff;
|
|
534
|
+
--flt-loader-message-font-size: 16px;
|
|
535
|
+
--flt-loader-message-color: #80828a;
|
|
507
536
|
}
|
|
508
537
|
```
|
|
509
538
|
|
|
510
539
|
## Release Notes:
|
|
511
540
|
|
|
541
|
+
- v.3.6.0
|
|
542
|
+
|
|
543
|
+
- Added new component `flt-loader`
|
|
544
|
+
|
|
545
|
+
- v.3.5.2
|
|
546
|
+
|
|
547
|
+
- Update modal component with option `deactiveGlass`
|
|
548
|
+
|
|
512
549
|
- v.3.5.1
|
|
513
550
|
|
|
514
551
|
- Bug fix with progress component
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
.flt-card {
|
|
2
2
|
background-color: var(--flt-card-bgc, #fff);
|
|
3
|
-
padding: var(--flt-card-padding
|
|
4
|
-
border-radius: var(--flt-card-border-radius
|
|
3
|
+
padding: var(--flt-card-padding, 24px);
|
|
4
|
+
border-radius: var(--flt-card-border-radius, 20px);
|
|
5
5
|
box-shadow: var(--flt-card-box-shadow, (0px 2px 3px 0px #0000004d, 0px 6px 10px 4px #00000026));
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
@media (min-width: 1280px) {
|
|
9
|
-
.flt-card {
|
|
10
|
-
padding: var(--flt-card-padding-lg, 24px);
|
|
11
|
-
border-radius: var(--flt-card-border-radius-lg, 24px);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createElement } from 'lwc'
|
|
2
|
+
import Loader from 'flt/loader'
|
|
3
|
+
|
|
4
|
+
describe('flt-modal', () => {
|
|
5
|
+
afterEach(() => {
|
|
6
|
+
while (document.body.firstChild) {
|
|
7
|
+
document.body.removeChild(document.body.firstChild)
|
|
8
|
+
}
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
it('base test', () => {
|
|
12
|
+
const loader = createElement('flt-loader', { is: Loader })
|
|
13
|
+
document.body.appendChild(loader)
|
|
14
|
+
const bodyElement = document.body.querySelector('.flt-loader')
|
|
15
|
+
const pEl = document.createElement('p')
|
|
16
|
+
pEl.innerHTML = 'Hello world'
|
|
17
|
+
bodyElement.appendChild(pEl)
|
|
18
|
+
expect(loader.innerHTML).toContain('Hello world')
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.flt-loader {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--flt-loader-gap, 16px);
|
|
7
|
+
background-color: var(--flt-loader-background, #ffffff);
|
|
8
|
+
font-size: var(--flt-loader-message-font-size, 16px);
|
|
9
|
+
color: var(--flt-loader-message-color, #80828a);
|
|
10
|
+
|
|
11
|
+
&__circle {
|
|
12
|
+
width: var(--flt-loader-spinner-circle, 80px);
|
|
13
|
+
height: var(--flt-loader-spinner-circle, 80px);
|
|
14
|
+
display: flex;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
border-radius: 50%;
|
|
18
|
+
background: linear-gradient(
|
|
19
|
+
0deg,
|
|
20
|
+
var(--flt-loader-spinner-fill-first-part, #ffffff) 50%,
|
|
21
|
+
var(--flt-loader-spinner-fill, #85a2b6) 100%
|
|
22
|
+
);
|
|
23
|
+
animation: rotate 1s linear infinite;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&__inner-circle {
|
|
27
|
+
width: var(--flt-loader-spinner-inner-circle-percent, 88%);
|
|
28
|
+
height: var(--flt-loader-spinner-inner-circle-percent, 88%);
|
|
29
|
+
background-color: var(--flt-loader-spinner-bgc-inner-circle, #ffffff);
|
|
30
|
+
border-radius: 50%;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@keyframes rotate {
|
|
35
|
+
0% {
|
|
36
|
+
transform: rotate(0);
|
|
37
|
+
}
|
|
38
|
+
100% {
|
|
39
|
+
transform: rotate(360deg);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -29,4 +29,26 @@ describe('flt-modal', () => {
|
|
|
29
29
|
expect(removedModalElement).toBeFalsy()
|
|
30
30
|
}, 1000)
|
|
31
31
|
})
|
|
32
|
+
|
|
33
|
+
it('deactiveGlass test', () => {
|
|
34
|
+
const progressStep = createElement('flt-progress-step', { is: ProgressStep })
|
|
35
|
+
progressStep.total = 9
|
|
36
|
+
progressStep.current = 2
|
|
37
|
+
progressStep.title = 'Good job'
|
|
38
|
+
ModalViewer.showModalWithComponent(progressStep, { deactiveGlass: true })
|
|
39
|
+
|
|
40
|
+
const modalElement = document.body.querySelector('flt-modal')
|
|
41
|
+
expect(modalElement.firstChild.classList).toContain('flt-modal')
|
|
42
|
+
const progressStepElemet = modalElement.querySelector('flt-progress-step')
|
|
43
|
+
expect(progressStepElemet.total).toBe(9)
|
|
44
|
+
expect(progressStepElemet.current).toBe(2)
|
|
45
|
+
expect(progressStepElemet.title).toBe('Good job')
|
|
46
|
+
|
|
47
|
+
const glassEl = modalElement.querySelector('.flt-modal__glass')
|
|
48
|
+
glassEl.click()
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
const removedModalElement = document.body.querySelector('flt-modal')
|
|
51
|
+
expect(removedModalElement).toBeTruthy()
|
|
52
|
+
}, 1000)
|
|
53
|
+
})
|
|
32
54
|
})
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { BaseElement, ModalViewer } from 'fleetcor-lwc'
|
|
2
|
+
import { api } from 'lwc'
|
|
2
3
|
import './modal.scss'
|
|
3
4
|
|
|
4
5
|
export default class Modal extends BaseElement {
|
|
6
|
+
@api deactiveGlass
|
|
7
|
+
|
|
5
8
|
handleCloseButton() {
|
|
6
|
-
|
|
9
|
+
if (!this.deactiveGlass) {
|
|
10
|
+
ModalViewer.hideModals()
|
|
11
|
+
}
|
|
7
12
|
}
|
|
8
13
|
}
|
|
@@ -16,12 +16,12 @@ describe('flt-progress-step', () => {
|
|
|
16
16
|
progressStep.title = 'Good job'
|
|
17
17
|
document.body.appendChild(progressStep)
|
|
18
18
|
|
|
19
|
-
expect(progressStep.firstChild.classList).toContain('progress-step')
|
|
19
|
+
expect(progressStep.firstChild.classList).toContain('flt-progress-step')
|
|
20
20
|
|
|
21
|
-
const position = progressStep.firstChild.querySelector('.progress-step__number-propotion')
|
|
21
|
+
const position = progressStep.firstChild.querySelector('.flt-progress-step__number-propotion')
|
|
22
22
|
expect(position.textContent).toBe('2/9')
|
|
23
23
|
|
|
24
|
-
const title = progressStep.firstChild.querySelector('.progress-step__current-title')
|
|
24
|
+
const title = progressStep.firstChild.querySelector('.flt-progress-step__current-title')
|
|
25
25
|
expect(title.textContent).toBe('Good job')
|
|
26
26
|
})
|
|
27
27
|
|
|
@@ -32,12 +32,12 @@ describe('flt-progress-step', () => {
|
|
|
32
32
|
progressStep.title = 'Good job'
|
|
33
33
|
document.body.appendChild(progressStep)
|
|
34
34
|
|
|
35
|
-
expect(progressStep.firstChild.classList).toContain('progress-step')
|
|
35
|
+
expect(progressStep.firstChild.classList).toContain('flt-progress-step')
|
|
36
36
|
|
|
37
|
-
const position = progressStep.firstChild.querySelector('.progress-step__number-propotion')
|
|
37
|
+
const position = progressStep.firstChild.querySelector('.flt-progress-step__number-propotion')
|
|
38
38
|
expect(position.textContent).toBe('8/9')
|
|
39
39
|
|
|
40
|
-
const title = progressStep.firstChild.querySelector('.progress-step__current-title')
|
|
40
|
+
const title = progressStep.firstChild.querySelector('.flt-progress-step__current-title')
|
|
41
41
|
expect(title.textContent).toBe('Good job')
|
|
42
42
|
})
|
|
43
43
|
})
|
|
@@ -8,8 +8,9 @@ import Modal from 'flt/modal'
|
|
|
8
8
|
* @description This class is used to show and hide modal view
|
|
9
9
|
*/
|
|
10
10
|
export default class ModalViewer {
|
|
11
|
-
static showModalWithComponent(cmp, options = { duration: 300 }) {
|
|
11
|
+
static showModalWithComponent(cmp, options = { duration: 300, deactiveGlass: false }) {
|
|
12
12
|
const appEl = createElement('flt-modal', { is: Modal })
|
|
13
|
+
appEl.deactiveGlass = options?.deactiveGlass
|
|
13
14
|
document.body.appendChild(appEl)
|
|
14
15
|
appEl.querySelector('.flt-modal__container').appendChild(cmp)
|
|
15
16
|
Animation.fadeIn({
|