fleetcor-lwc 3.19.0 → 3.20.2
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 +159 -39
- package/frontend/components/flt/alertInfo/__test__/alertInfo.test.js +6 -6
- package/frontend/components/flt/alertInfo/alertInfo.html +1 -1
- package/frontend/components/flt/alertInfo/alertInfo.js +0 -7
- package/frontend/components/flt/alertInfo/alertInfo.scss +2 -11
- package/frontend/components/flt/btn/__test__/btn.test.js +33 -0
- package/frontend/components/flt/btn/btn.html +17 -0
- package/frontend/components/flt/btn/btn.js +15 -0
- package/frontend/components/flt/btn/btn.scss +85 -0
- package/frontend/components/flt/icon/icon.scss +2 -2
- package/frontend/components/flt/inputPhone/inputPhone.js +50 -51
- package/frontend/components/flt/picklist/picklist.js +4 -9
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -220,6 +220,82 @@ Add / update `lwc.config.json` file in your project
|
|
|
220
220
|
|
|
221
221
|
---
|
|
222
222
|
|
|
223
|
+
### Btn
|
|
224
|
+
|
|
225
|
+
```html
|
|
226
|
+
<flt-btn icon-left="arrow-next" icon-right="arrow-back" disabled label="Next">
|
|
227
|
+
<!-- Any html element -->
|
|
228
|
+
</flt-btn>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
<details>
|
|
232
|
+
<summary>Details</summary>
|
|
233
|
+
|
|
234
|
+
#### Btn variables
|
|
235
|
+
|
|
236
|
+
| @api variables | type | values | required | description |
|
|
237
|
+
| -------------- | ------ | ----------------- | -------- | ------------------------------- |
|
|
238
|
+
| icon-left | string | `arrow-next, ...` | - | any value from `Icon` component |
|
|
239
|
+
| icon-right | string | `arrow-back, ...` | - | any value from `Icon` component |
|
|
240
|
+
| label | string | | - | |
|
|
241
|
+
| disabled | bool | | - | |
|
|
242
|
+
|
|
243
|
+
#### Btn slot
|
|
244
|
+
|
|
245
|
+
| slot | description |
|
|
246
|
+
| --------- | ---------------------------------------------- |
|
|
247
|
+
| default | any html element can be there |
|
|
248
|
+
| iconLeft | any html element can override left icon place |
|
|
249
|
+
| iconRight | any html element can override right icon place |
|
|
250
|
+
|
|
251
|
+
#### Btn Css
|
|
252
|
+
|
|
253
|
+
```css
|
|
254
|
+
/* this is aquamarine variables */
|
|
255
|
+
|
|
256
|
+
:root {
|
|
257
|
+
/* btn */
|
|
258
|
+
--flt-btn-fw: 700;
|
|
259
|
+
--flt-btn-border-radius: 32px;
|
|
260
|
+
--flt-btn-border: 1px solid #3782c8;
|
|
261
|
+
--flt-btn-padding: 0 24px;
|
|
262
|
+
--flt-btn-gap: 16px;
|
|
263
|
+
--flt-btn-color: #f9fafb;
|
|
264
|
+
--flt-btn-bg-color: #3782c8;
|
|
265
|
+
--flt-btn-box-shadow: none;
|
|
266
|
+
--flt-btn-transition: all 0.3s;
|
|
267
|
+
--flt-btn-height: 52px;
|
|
268
|
+
--flt-btn-font-size: 14px;
|
|
269
|
+
--flt-btn-text-transform: initial;
|
|
270
|
+
/* btn hover */
|
|
271
|
+
--flt-btn-hover-color: #f9fafb;
|
|
272
|
+
--flt-btn-hover-bg-color: #3782c8;
|
|
273
|
+
--flt-btn-hover-border: 1px solid #3782c8;
|
|
274
|
+
--flt-btn-hover-box-shadow: 0 4px 6px -1px rgba(16, 24, 40, 0.1), 0 2px
|
|
275
|
+
4px -2px rgba(16, 24, 40, 0.1);
|
|
276
|
+
/* btn disabled */
|
|
277
|
+
--flt-btn-disabled-color: #6b7280;
|
|
278
|
+
--flt-btn-disabled-bg-color: #f3f4f6;
|
|
279
|
+
--flt-btn-disabled-border: 1px solid #f3f4f6;
|
|
280
|
+
--flt-btndisabled-border-box-shadow: none;
|
|
281
|
+
/* btn disabled hover */
|
|
282
|
+
--flt-btn-disabled-hover-color: #6b7280;
|
|
283
|
+
--flt-btn-disabled-hover-bg-color: #f3f4f6;
|
|
284
|
+
--flt-btn-disabled-hover-border: 1px solid #f3f4f6;
|
|
285
|
+
--flt-btn-disabled-hover-box-shadow: none;
|
|
286
|
+
/* btn label */
|
|
287
|
+
--flt-btn-label-padding: 0;
|
|
288
|
+
--flt-btn-label-display: flex;
|
|
289
|
+
--flt-btn-label-align-items: center;
|
|
290
|
+
--flt-btn-label-justify-content: center;
|
|
291
|
+
--flt-btn-label-gap: 16px;
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
</details>
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
223
299
|
### Icon
|
|
224
300
|
|
|
225
301
|
```html
|
|
@@ -385,6 +461,34 @@ Add / update `lwc.config.json` file in your project
|
|
|
385
461
|
| title | any html element can be there instead of title |
|
|
386
462
|
| content | any html element can be there instead of content |
|
|
387
463
|
|
|
464
|
+
#### Alert Info Css
|
|
465
|
+
|
|
466
|
+
```css
|
|
467
|
+
/* this is aquamarine variables */
|
|
468
|
+
|
|
469
|
+
:root {
|
|
470
|
+
/* alert info */
|
|
471
|
+
--flt-alert-info-padding: 16px;
|
|
472
|
+
--flt-alert-info-border-radius: 8px;
|
|
473
|
+
--flt-alert-info-border: initial;
|
|
474
|
+
--flt-alert-info-gap: 16px;
|
|
475
|
+
--flt-alert-info-background: #d6e7fc;
|
|
476
|
+
|
|
477
|
+
/* alert info title */
|
|
478
|
+
--flt-alert-info-title-font-size: 16px;
|
|
479
|
+
--flt-alert-info-title-line-height: 24px;
|
|
480
|
+
--flt-alert-info-title-margin-bottom: 8px;
|
|
481
|
+
--flt-alert-info-title-font-weight: 700;
|
|
482
|
+
--flt-alert-info-title-color: #1a1a1a;
|
|
483
|
+
|
|
484
|
+
/* alert info content */
|
|
485
|
+
--flt-alert-info-content-font-size: 12px;
|
|
486
|
+
--flt-alert-info-content-line-height: 16px;
|
|
487
|
+
--flt-alert-info-content-font-weight: 400;
|
|
488
|
+
--flt-alert-info-content-color: #1a1a1a;
|
|
489
|
+
}
|
|
490
|
+
```
|
|
491
|
+
|
|
388
492
|
</details>
|
|
389
493
|
|
|
390
494
|
---
|
|
@@ -747,6 +851,39 @@ This component fully extends from `Input Text`
|
|
|
747
851
|
|
|
748
852
|
</details>
|
|
749
853
|
|
|
854
|
+
#### Collapsible Section Css
|
|
855
|
+
|
|
856
|
+
```css
|
|
857
|
+
/* this is aquamarine variables */
|
|
858
|
+
|
|
859
|
+
:root {
|
|
860
|
+
/* Collapsible Section */
|
|
861
|
+
--flt-collapsible-section-background: initial;
|
|
862
|
+
--flt-collapsible-section-padding: initial;
|
|
863
|
+
--flt-collapsible-section-border: initial;
|
|
864
|
+
--flt-collapsible-section-border-radius: initial;
|
|
865
|
+
--flt-collapsible-section-box-shadow: initial;
|
|
866
|
+
--flt-collapsible-section-opened-header-base-icon-transform: rotate(180deg) scale(
|
|
867
|
+
-1
|
|
868
|
+
);
|
|
869
|
+
--flt-collapsible-section-body-animation-duration: 0.5s;
|
|
870
|
+
--flt-collapsible-section-body-animation-type: ease;
|
|
871
|
+
--flt-collapsible-section-header-base-padding: initial;
|
|
872
|
+
--flt-collapsible-section-header-base-border: initial;
|
|
873
|
+
--flt-collapsible-section-header-base-border-radius: initial;
|
|
874
|
+
--flt-collapsible-section-header-base-background: initial;
|
|
875
|
+
--flt-collapsible-section-header-base-cursor: pointer;
|
|
876
|
+
--flt-collapsible-section-header-base-title-color: #1a1a1a;
|
|
877
|
+
--flt-collapsible-section-header-base-font-size: 16px;
|
|
878
|
+
--flt-collapsible-section-header-base-line-height: 24px;
|
|
879
|
+
--flt-collapsible-section-header-base-font-weight: 700;
|
|
880
|
+
--flt-collapsible-section-body-animation-duration: 0.5s;
|
|
881
|
+
--flt-collapsible-section-body-animation-type: ease;
|
|
882
|
+
--flt-collapsible-section-header-base-icon-transform: rotate(180deg);
|
|
883
|
+
--flt-collapsible-section-header-base-icon-fill: #1a1a1a;
|
|
884
|
+
}
|
|
885
|
+
```
|
|
886
|
+
|
|
750
887
|
---
|
|
751
888
|
|
|
752
889
|
## Interfaces
|
|
@@ -786,6 +923,7 @@ You can override them as you wish by global css variables as priority.
|
|
|
786
923
|
--flt-tooltip-bg-color: #374151;
|
|
787
924
|
--flt-tooltip-color: #f9fafb;
|
|
788
925
|
--flt-icon-color: #111827;
|
|
926
|
+
--flt-icon-size: 24px;
|
|
789
927
|
--flt-button-primary-bg-color: #3782c8;
|
|
790
928
|
--flt-button-primary-color: #f9fafb;
|
|
791
929
|
--flt-button-primary-disabled-color: #6b7280;
|
|
@@ -901,45 +1039,6 @@ You can override them as you wish by global css variables as priority.
|
|
|
901
1039
|
--flt-input-phone-border-color-error: #ed123d;
|
|
902
1040
|
--flt-input-with-picklist-border-color-success: #59eb9c;
|
|
903
1041
|
--flt-input-with-picklist-border-color-error: #ed123d;
|
|
904
|
-
--flt-alert-info-padding: 16px;
|
|
905
|
-
--flt-alert-info-border-radius: 8px;
|
|
906
|
-
--flt-alert-info-border: initial;
|
|
907
|
-
--flt-alert-info-background: #d6e7fc;
|
|
908
|
-
--flt-alert-info-warning-background: #f8d8d8;
|
|
909
|
-
--flt-alert-info-title-font-size: 16px;
|
|
910
|
-
--flt-alert-info-title-line-height: 24px;
|
|
911
|
-
--flt-alert-info-title-margin-bottom: 8px;
|
|
912
|
-
--flt-alert-info-title-font-weight: 700;
|
|
913
|
-
--flt-alert-info-title-color: #1a1a1a;
|
|
914
|
-
--flt-alert-info-content-font-size: 12px;
|
|
915
|
-
--flt-alert-info-content-line-height: 16px;
|
|
916
|
-
--flt-alert-info-content-font-weight: 400;
|
|
917
|
-
--flt-alert-info-content-color: #1a1a1a;
|
|
918
|
-
--flt-alert-info-icon-max-width: 20px;
|
|
919
|
-
--flt-alert-info-gap: 16px;
|
|
920
|
-
--flt-collapsible-section-background: initial;
|
|
921
|
-
--flt-collapsible-section-padding: initial;
|
|
922
|
-
--flt-collapsible-section-border: initial;
|
|
923
|
-
--flt-collapsible-section-border-radius: initial;
|
|
924
|
-
--flt-collapsible-section-box-shadow: initial;
|
|
925
|
-
--flt-collapsible-section-opened-header-base-icon-transform: rotate(180deg) scale(
|
|
926
|
-
-1
|
|
927
|
-
);
|
|
928
|
-
--flt-collapsible-section-body-animation-duration: 0.5s;
|
|
929
|
-
--flt-collapsible-section-body-animation-type: ease;
|
|
930
|
-
--flt-collapsible-section-header-base-padding: initial;
|
|
931
|
-
--flt-collapsible-section-header-base-border: initial;
|
|
932
|
-
--flt-collapsible-section-header-base-border-radius: initial;
|
|
933
|
-
--flt-collapsible-section-header-base-background: initial;
|
|
934
|
-
--flt-collapsible-section-header-base-cursor: pointer;
|
|
935
|
-
--flt-collapsible-section-header-base-title-color: #1a1a1a;
|
|
936
|
-
--flt-collapsible-section-header-base-font-size: 16px;
|
|
937
|
-
--flt-collapsible-section-header-base-line-height: 24px;
|
|
938
|
-
--flt-collapsible-section-header-base-font-weight: 700;
|
|
939
|
-
--flt-collapsible-section-body-animation-duration: 0.5s;
|
|
940
|
-
--flt-collapsible-section-body-animation-type: ease;
|
|
941
|
-
--flt-collapsible-section-header-base-icon-transform: rotate(180deg);
|
|
942
|
-
--flt-collapsible-section-header-base-icon-fill: #1a1a1a;
|
|
943
1042
|
}
|
|
944
1043
|
```
|
|
945
1044
|
|
|
@@ -952,6 +1051,27 @@ You can override them as you wish by global css variables as priority.
|
|
|
952
1051
|
<details>
|
|
953
1052
|
<summary>Click to expand/collapse</summary>
|
|
954
1053
|
|
|
1054
|
+
v.3.20.2
|
|
1055
|
+
|
|
1056
|
+
- Bug fix `flt-picklist`
|
|
1057
|
+
|
|
1058
|
+
---
|
|
1059
|
+
|
|
1060
|
+
v.3.20.1
|
|
1061
|
+
|
|
1062
|
+
- Bug fix `flt-input-phone`
|
|
1063
|
+
- Collapsible section component documentation updated
|
|
1064
|
+
|
|
1065
|
+
---
|
|
1066
|
+
|
|
1067
|
+
v.3.20.0
|
|
1068
|
+
|
|
1069
|
+
- Added Btn component
|
|
1070
|
+
- Updated `flt-icon`
|
|
1071
|
+
- Updated `alert-info`
|
|
1072
|
+
|
|
1073
|
+
---
|
|
1074
|
+
|
|
955
1075
|
v.3.19.0
|
|
956
1076
|
|
|
957
1077
|
- Added 2 new icons `arrow-back` and `arrow-next`
|
|
@@ -16,13 +16,13 @@ describe('flt-alert-info', () => {
|
|
|
16
16
|
|
|
17
17
|
it('flt alert info base', () => {
|
|
18
18
|
const alertInfoEl = createElement('flt-alert-info', { is: AlertInfo })
|
|
19
|
-
document.body.appendChild(alertInfoEl)
|
|
20
|
-
expect(alertInfoEl.firstChild.classList).toContain('flt-alert-info')
|
|
21
19
|
alertInfoEl.title = 'Test'
|
|
22
20
|
alertInfoEl.content = 'Hello world!'
|
|
23
|
-
alertInfoEl
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
document.body.appendChild(alertInfoEl)
|
|
22
|
+
|
|
23
|
+
const alertInfo = alertInfoEl.firstChild
|
|
24
|
+
expect(alertInfo.classList).toContain('flt-alert-info')
|
|
25
|
+
expect(alertInfo.textContent).toContain('Test')
|
|
26
|
+
expect(alertInfo.textContent).toContain('Hello world!')
|
|
27
27
|
})
|
|
28
28
|
})
|
|
@@ -11,11 +11,4 @@ export default class AlertInfo extends BaseElement {
|
|
|
11
11
|
@api title
|
|
12
12
|
@api content
|
|
13
13
|
@api icon = 'info'
|
|
14
|
-
|
|
15
|
-
get alertClass() {
|
|
16
|
-
return this.generateClassNameList({
|
|
17
|
-
'flt-alert-info': true,
|
|
18
|
-
'flt-alert-info_warning': this.icon === 'warning'
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
14
|
}
|
|
@@ -6,10 +6,6 @@
|
|
|
6
6
|
gap: var(--flt-alert-info-gap, 16px);
|
|
7
7
|
background: var(--flt-alert-info-background, #d6e7fc);
|
|
8
8
|
|
|
9
|
-
&_warning {
|
|
10
|
-
background: var(--flt-alert-info-warning-background, #f8d8d8);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
9
|
&__title {
|
|
14
10
|
font-size: var(--flt-alert-info-title-font-size, 16px);
|
|
15
11
|
line-height: var(--flt-alert-info-title-line-height, 24px);
|
|
@@ -27,12 +23,7 @@
|
|
|
27
23
|
|
|
28
24
|
&__icon {
|
|
29
25
|
flex-shrink: 0;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
max-width: var(--flt-alert-info-icon-max-width, 20px);
|
|
33
|
-
max-height: var(--flt-alert-info-icon-max-heigth, 20px);
|
|
34
|
-
}
|
|
35
|
-
max-height: var(--flt-alert-info-icon-max-heigth, 20px);
|
|
36
|
-
max-width: var(--flt-alert-info-icon-max-width, 20px);
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
--flt-icon-size: 20px;
|
|
37
28
|
}
|
|
38
29
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createElement } from 'lwc'
|
|
2
|
+
import Btn from 'flt/btn'
|
|
3
|
+
|
|
4
|
+
describe('flt-btn', () => {
|
|
5
|
+
afterEach(() => {
|
|
6
|
+
while (document.body.firstChild) {
|
|
7
|
+
document.body.removeChild(document.body.firstChild)
|
|
8
|
+
}
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
it('Btn base', () => {
|
|
12
|
+
const button = createElement('flt-btn', { is: Btn })
|
|
13
|
+
button.label = 'Default'
|
|
14
|
+
document.body.appendChild(button)
|
|
15
|
+
const buttonEl = button.firstChild
|
|
16
|
+
|
|
17
|
+
expect(buttonEl.classList).toContain('flt-btn')
|
|
18
|
+
expect(buttonEl.hasAttribute('disabled')).toBeFalsy()
|
|
19
|
+
expect(buttonEl.textContent).toContain('Default')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('Btn disabled', () => {
|
|
23
|
+
const button = createElement('flt-btn', { is: Btn })
|
|
24
|
+
button.label = 'Default'
|
|
25
|
+
button.disabled = true
|
|
26
|
+
document.body.appendChild(button)
|
|
27
|
+
const buttonEl = button.firstChild
|
|
28
|
+
|
|
29
|
+
expect(buttonEl.classList).toContain('flt-btn')
|
|
30
|
+
expect(buttonEl.hasAttribute('disabled')).toBeTruthy()
|
|
31
|
+
expect(buttonEl.textContent).toContain('Default')
|
|
32
|
+
})
|
|
33
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template lwc:render-mode="light">
|
|
2
|
+
<button class="flt-btn" disabled={disabled}>
|
|
3
|
+
<slot name="iconLeft">
|
|
4
|
+
<flt-icon
|
|
5
|
+
lwc:if={iconLeft}
|
|
6
|
+
class="flt-btn__icon flt-btn__icon_left"
|
|
7
|
+
icon={iconLeft}></flt-icon>
|
|
8
|
+
</slot>
|
|
9
|
+
<span class="flt-btn__label">{label}<slot></slot></span>
|
|
10
|
+
<slot name="iconRight">
|
|
11
|
+
<flt-icon
|
|
12
|
+
lwc:if={iconRight}
|
|
13
|
+
class="flt-btn__icon flt-btn__icon_right"
|
|
14
|
+
icon={iconRight}></flt-icon>
|
|
15
|
+
</slot>
|
|
16
|
+
</button>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import './btn.scss'
|
|
2
|
+
import { api } from 'lwc'
|
|
3
|
+
import { BaseElement } from 'fleetcor-lwc'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @class Btn
|
|
7
|
+
* @extends BaseElement
|
|
8
|
+
* @description Flt btn component
|
|
9
|
+
*/
|
|
10
|
+
export default class Btn extends BaseElement {
|
|
11
|
+
@api label
|
|
12
|
+
@api disabled
|
|
13
|
+
@api iconLeft
|
|
14
|
+
@api iconRight
|
|
15
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
flt-btn {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.flt-btn {
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
text-decoration: none;
|
|
8
|
+
list-style: none outside none;
|
|
9
|
+
background: none repeat scroll 0 0 transparent;
|
|
10
|
+
border-spacing: 0;
|
|
11
|
+
text-indent: 0;
|
|
12
|
+
margin: 0;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
font-family: inherit;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
font-weight: var(--flt-btn-fw, 700);
|
|
18
|
+
border-radius: var(--flt-btn-border-radius, 32px);
|
|
19
|
+
border: var(--flt-btn-border, 1px solid #3782c8);
|
|
20
|
+
padding: var(--flt-btn-padding, 0 24px);
|
|
21
|
+
gap: var(--flt-btn-gap, 16px);
|
|
22
|
+
color: var(--flt-btn-color, #f9fafb);
|
|
23
|
+
background-color: var(--flt-btn-bg-color, #3782c8);
|
|
24
|
+
box-shadow: var(--flt-btn-box-shadow, none);
|
|
25
|
+
transition: var(--flt-btn-transition, all 0.3s);
|
|
26
|
+
height: var(--flt-btn-height, 52px);
|
|
27
|
+
font-size: var(--flt-btn-font-size, 14px);
|
|
28
|
+
text-transform: var(--flt-btn-text-transform, initial);
|
|
29
|
+
|
|
30
|
+
--flt-icon-color: var(--flt-btn-color, #f9fafb);
|
|
31
|
+
|
|
32
|
+
&:hover {
|
|
33
|
+
color: var(--flt-btn-hover-color, #f9fafb);
|
|
34
|
+
background-color: var(--flt-btn-hover-bg-color, #3782c8);
|
|
35
|
+
border: var(--flt-btn-hover-border, 1px solid #3782c8);
|
|
36
|
+
box-shadow: var(
|
|
37
|
+
--flt-btn-hover-box-shadow,
|
|
38
|
+
0 4px 6px -1px rgba(16, 24, 40, 0.1),
|
|
39
|
+
0 2px 4px -2px rgba(16, 24, 40, 0.1)
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
--flt-icon-color: var(--flt-btn-hover-color, #f9fafb);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&[disabled] {
|
|
46
|
+
cursor: not-allowed;
|
|
47
|
+
color: var(--flt-btn-disabled-color, #6b7280);
|
|
48
|
+
background-color: var(--flt-btn-disabled-bg-color, #f3f4f6);
|
|
49
|
+
border: var(--flt-btn-disabled-border, 1px solid #f3f4f6);
|
|
50
|
+
box-shadow: var(--flt-btn-disabled-border-box-shadow, none);
|
|
51
|
+
|
|
52
|
+
--flt-icon-color: var(--flt-btn-disabled-color, #6b7280);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&[disabled]:hover {
|
|
56
|
+
color: var(--flt-btn-disabled-hover-color, #6b7280);
|
|
57
|
+
background-color: var(--flt-btn-disabled-hover-bg-color, #f3f4f6);
|
|
58
|
+
border: var(--flt-btn-disabled-hover-border, 1px solid #f3f4f6);
|
|
59
|
+
box-shadow: var(--flt-btn-disabled-hover-box-shadow, none);
|
|
60
|
+
|
|
61
|
+
--flt-icon-color: var(--flt-btn-disabled-hover-color, #6b7280);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&::-moz-focus-inner {
|
|
65
|
+
border: 0;
|
|
66
|
+
padding: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&__icon {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-shrink: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&__label {
|
|
75
|
+
padding: var(--flt-btn-label-padding, 0);
|
|
76
|
+
display: var(--flt-btn-label-display, flex);
|
|
77
|
+
align-items: var(--flt-btn-label-align-items, center);
|
|
78
|
+
justify-content: var(--flt-btn-label-justify-content, center);
|
|
79
|
+
gap: var(--flt-btn-label-gap, 16px);
|
|
80
|
+
|
|
81
|
+
&:empty {
|
|
82
|
+
display: none;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -9,6 +9,12 @@ const CODE_BY_DEFAULT = 'GB'
|
|
|
9
9
|
const CODE_VALUE_SB = '+44'
|
|
10
10
|
|
|
11
11
|
export default class InputPhone extends UserDataValidator {
|
|
12
|
+
codeValue = ''
|
|
13
|
+
phoneNumber = ''
|
|
14
|
+
touched
|
|
15
|
+
focused
|
|
16
|
+
mask
|
|
17
|
+
|
|
12
18
|
@api errorMessage
|
|
13
19
|
@api inputLabel
|
|
14
20
|
@api placeholder
|
|
@@ -42,26 +48,6 @@ export default class InputPhone extends UserDataValidator {
|
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
|
|
45
|
-
get maskOptions() {
|
|
46
|
-
let settings = {
|
|
47
|
-
mask: /[1-9]/,
|
|
48
|
-
overwrite: false,
|
|
49
|
-
lazy: false
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (this.codeValue == CODE_VALUE_SB) {
|
|
53
|
-
settings = {
|
|
54
|
-
mask: '#000000000',
|
|
55
|
-
definitions: {
|
|
56
|
-
'#': /[1-9]/
|
|
57
|
-
},
|
|
58
|
-
overwrite: false,
|
|
59
|
-
lazy: false
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return settings
|
|
63
|
-
}
|
|
64
|
-
|
|
65
51
|
@api getData(silent) {
|
|
66
52
|
return {
|
|
67
53
|
...super.getData(silent),
|
|
@@ -99,8 +85,6 @@ export default class InputPhone extends UserDataValidator {
|
|
|
99
85
|
return result
|
|
100
86
|
}
|
|
101
87
|
|
|
102
|
-
phoneNumber = ''
|
|
103
|
-
|
|
104
88
|
@api setCode(countryCode) {
|
|
105
89
|
const restore = !this.touched
|
|
106
90
|
this.codeValue = COUNTRIES.find((c) => c.code === countryCode)?.dialCode || this.codeValue
|
|
@@ -119,22 +103,28 @@ export default class InputPhone extends UserDataValidator {
|
|
|
119
103
|
}
|
|
120
104
|
}
|
|
121
105
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return this.codeValue === CODE_VALUE_SB ? CODE_VALUE_SB + '(0)' : this.codeValue
|
|
129
|
-
}
|
|
106
|
+
get maskOptions() {
|
|
107
|
+
let settings = {
|
|
108
|
+
mask: /^[1-9]\d*$/,
|
|
109
|
+
overwrite: false,
|
|
110
|
+
lazy: false
|
|
111
|
+
}
|
|
130
112
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
113
|
+
if (this.codeValue == CODE_VALUE_SB) {
|
|
114
|
+
settings = {
|
|
115
|
+
mask: '#000000000',
|
|
116
|
+
definitions: {
|
|
117
|
+
'#': /[1-9]/
|
|
118
|
+
},
|
|
119
|
+
overwrite: false,
|
|
120
|
+
lazy: false
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return settings
|
|
134
124
|
}
|
|
135
125
|
|
|
136
|
-
|
|
137
|
-
this.
|
|
126
|
+
get prefix() {
|
|
127
|
+
return this.codeValue === CODE_VALUE_SB ? CODE_VALUE_SB + '(0)' : this.codeValue
|
|
138
128
|
}
|
|
139
129
|
|
|
140
130
|
get inputStyle() {
|
|
@@ -171,6 +161,22 @@ export default class InputPhone extends UserDataValidator {
|
|
|
171
161
|
this.codeValue = this.codeValue || this.codePrefixByCountryCode
|
|
172
162
|
}
|
|
173
163
|
|
|
164
|
+
renderedCallback() {
|
|
165
|
+
super.renderedCallback()
|
|
166
|
+
if (!this.mask) {
|
|
167
|
+
this.reInitIMask()
|
|
168
|
+
this.querySelector('input').onpaste = (event) => {
|
|
169
|
+
let value = event.clipboardData.getData('text/plain').replace(/[^\w\\s]/gi, '')
|
|
170
|
+
if (value?.at(0) == '0') {
|
|
171
|
+
value = CODE_VALUE_SB + value.slice(1)
|
|
172
|
+
} else {
|
|
173
|
+
value = '+' + value
|
|
174
|
+
}
|
|
175
|
+
this.querySelector('input').value = ''
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
174
180
|
reInitIMask() {
|
|
175
181
|
this.mask?.destroy()
|
|
176
182
|
this.mask = null
|
|
@@ -208,22 +214,6 @@ export default class InputPhone extends UserDataValidator {
|
|
|
208
214
|
})
|
|
209
215
|
}
|
|
210
216
|
|
|
211
|
-
renderedCallback() {
|
|
212
|
-
super.renderedCallback()
|
|
213
|
-
if (!this.mask) {
|
|
214
|
-
this.reInitIMask()
|
|
215
|
-
this.querySelector('input').onpaste = (event) => {
|
|
216
|
-
let value = event.clipboardData.getData('text/plain').replace(/[^\w\\s]/gi, '')
|
|
217
|
-
if (value?.at(0) == '0') {
|
|
218
|
-
value = CODE_VALUE_SB + value.slice(1)
|
|
219
|
-
} else {
|
|
220
|
-
value = '+' + value
|
|
221
|
-
}
|
|
222
|
-
this.querySelector('input').value = ''
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
217
|
handleFlagChanged(event) {
|
|
228
218
|
this.codeValue = event.detail.value
|
|
229
219
|
this.reInitIMask()
|
|
@@ -237,4 +227,13 @@ export default class InputPhone extends UserDataValidator {
|
|
|
237
227
|
})
|
|
238
228
|
)
|
|
239
229
|
}
|
|
230
|
+
|
|
231
|
+
handleFocus() {
|
|
232
|
+
this.focused = true
|
|
233
|
+
this.touched = true
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
handleBlur() {
|
|
237
|
+
this.focused = false
|
|
238
|
+
}
|
|
240
239
|
}
|
|
@@ -76,15 +76,10 @@ export default class Picklist extends SelectElement {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
handleMousedownView(event) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
event.
|
|
83
|
-
!classList.contains('flt-picklist__dropdown') &&
|
|
84
|
-
!classList.contains('flt-picklist__dropdown-container')
|
|
85
|
-
) {
|
|
86
|
-
event.currentTarget.blur();
|
|
87
|
-
event.preventDefault();
|
|
79
|
+
const dropdown = event.target.closest('.flt-picklist__dropdown')
|
|
80
|
+
if (event.currentTarget === document.activeElement && !dropdown) {
|
|
81
|
+
event.currentTarget.blur()
|
|
82
|
+
event.preventDefault()
|
|
88
83
|
}
|
|
89
84
|
}
|
|
90
85
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fleetcor-lwc",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.20.2",
|
|
4
4
|
"description": "LWC framework by Fleetcor",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"expose": [
|
|
28
28
|
"flt/alertInfo",
|
|
29
29
|
"flt/button",
|
|
30
|
+
"flt/btn",
|
|
30
31
|
"flt/checkbox",
|
|
31
32
|
"flt/card",
|
|
32
33
|
"flt/loader",
|