fleetcor-lwc 3.7.0 → 3.8.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 +70 -17
- package/frontend/components/flt/inputPhone/__test__/inputPhone.test.js +113 -0
- package/frontend/components/flt/inputPhone/inputPhone.html +24 -103
- package/frontend/components/flt/inputPhone/inputPhone.js +91 -187
- package/frontend/components/flt/inputPhone/inputPhone.scss +56 -238
- package/frontend/components/flt/inputText/inputText.js +3 -3
- package/frontend/components/flt/inputText/inputText.scss +7 -7
- package/frontend/components/flt/picklist/picklist.html +5 -7
- package/frontend/components/flt/picklist/picklist.js +32 -3
- package/frontend/components/flt/picklist/picklist.scss +16 -2
- package/frontend/components/flt/picklist/picklistModal.html +5 -7
- package/package.json +3 -3
- package/frontend/components/flt/inputPhone/__test__/radioItem.test.js +0 -56
- package/frontend/components/flt/inputPhone/arrow.svg +0 -3
- package/frontend/components/flt/inputPhone/close-button.svg +0 -3
|
@@ -40,7 +40,7 @@ export default class InputText extends InputElement {
|
|
|
40
40
|
'flt-input-text': true,
|
|
41
41
|
'flt-input-text_disabled': this.disabled,
|
|
42
42
|
'flt-input-text_active': this.value || this.focused || this.placeholderVisible,
|
|
43
|
-
'flt-input-text_error': this.touched && !this.isValid(),
|
|
43
|
+
'flt-input-text_error': !this.focused && this.touched && !this.isValid(),
|
|
44
44
|
'flt-input-text_success': this.value && this.isValid()
|
|
45
45
|
})
|
|
46
46
|
}
|
|
@@ -50,7 +50,7 @@ export default class InputText extends InputElement {
|
|
|
50
50
|
if (this.disabled) return
|
|
51
51
|
this.focused = true
|
|
52
52
|
this.dispatchEvent(
|
|
53
|
-
new CustomEvent('
|
|
53
|
+
new CustomEvent('focus', {
|
|
54
54
|
detail: null,
|
|
55
55
|
cancelable: true,
|
|
56
56
|
bubbles: true
|
|
@@ -66,7 +66,7 @@ export default class InputText extends InputElement {
|
|
|
66
66
|
this.value = (event.target.value || '').trimEnd()
|
|
67
67
|
event.target.value = this.value
|
|
68
68
|
this.dispatchEvent(
|
|
69
|
-
new CustomEvent('
|
|
69
|
+
new CustomEvent('blur', {
|
|
70
70
|
detail: null,
|
|
71
71
|
cancelable: true,
|
|
72
72
|
bubbles: true
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
cursor: pointer;
|
|
6
6
|
|
|
7
7
|
&__prefix {
|
|
8
|
-
|
|
8
|
+
flex-shrink: 0;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
&_disabled {
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
&_activate {
|
|
33
33
|
.flt-input-text__input-block {
|
|
34
34
|
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: var(--flt-input-prefix-gap, 8px);
|
|
35
37
|
height: 20px;
|
|
36
38
|
opacity: 1;
|
|
37
39
|
}
|
|
@@ -48,11 +50,11 @@
|
|
|
48
50
|
|
|
49
51
|
&_error {
|
|
50
52
|
.flt-input-text__wrapp {
|
|
51
|
-
border-color: #
|
|
53
|
+
border-color: var(--flt-input-border-color-error, #ed123d);
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
.flt-input-text__error {
|
|
55
|
-
height:
|
|
57
|
+
line-height: 1.5;
|
|
56
58
|
opacity: 1;
|
|
57
59
|
}
|
|
58
60
|
}
|
|
@@ -96,12 +98,10 @@
|
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
&__error {
|
|
99
|
-
height: 0;
|
|
101
|
+
line-height: 0;
|
|
100
102
|
opacity: 0;
|
|
101
|
-
margin-top: 4px;
|
|
102
103
|
font-size: 12px;
|
|
103
|
-
|
|
104
|
-
color: #ef4444;
|
|
104
|
+
color: var(--flt-input-border-color-error, #ed123d);
|
|
105
105
|
transition: all 0.3s;
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div class="flt-picklist__wrapp">
|
|
4
4
|
<div class="flt-picklist__wrapp-text">
|
|
5
5
|
<div class="flt-picklist__placeholder">{placeholder}</div>
|
|
6
|
-
<div class="flt-picklist__value"
|
|
6
|
+
<div class="flt-picklist__value" lwc:inner-html={displayLabel}></div>
|
|
7
7
|
</div>
|
|
8
8
|
<svg
|
|
9
9
|
width="24"
|
|
@@ -27,17 +27,15 @@
|
|
|
27
27
|
key={option.value}
|
|
28
28
|
onclick={handleChange}
|
|
29
29
|
data-value={option.value}
|
|
30
|
-
class="flt-picklist__option flt-picklist__option_selected"
|
|
31
|
-
{option.label}
|
|
32
|
-
</div>
|
|
30
|
+
class="flt-picklist__option flt-picklist__option_selected"
|
|
31
|
+
lwc:inner-html={option.label}></div>
|
|
33
32
|
<div
|
|
34
33
|
lwc:else
|
|
35
34
|
onclick={handleChange}
|
|
36
35
|
key={option.value}
|
|
37
36
|
data-value={option.value}
|
|
38
|
-
class="flt-picklist__option"
|
|
39
|
-
{option.label}
|
|
40
|
-
</div>
|
|
37
|
+
class="flt-picklist__option"
|
|
38
|
+
lwc:inner-html={option.label}></div>
|
|
41
39
|
</template>
|
|
42
40
|
</div>
|
|
43
41
|
</div>
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { api } from 'lwc'
|
|
1
|
+
import { api, setHooks } from 'lwc'
|
|
2
2
|
import { SelectElement } from 'fleetcor-lwc'
|
|
3
3
|
import './picklist.scss'
|
|
4
4
|
import picklistModal from './picklistModal.html'
|
|
5
5
|
import picklist from './picklist.html'
|
|
6
6
|
|
|
7
|
+
setHooks({
|
|
8
|
+
sanitizeHtmlContent(content) {
|
|
9
|
+
return content
|
|
10
|
+
}
|
|
11
|
+
})
|
|
12
|
+
|
|
7
13
|
export default class Picklist extends SelectElement {
|
|
8
14
|
error
|
|
9
15
|
showOptions
|
|
@@ -28,7 +34,7 @@ export default class Picklist extends SelectElement {
|
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
get displayLabel() {
|
|
31
|
-
return this.optionsToDisplay.find((item) => item.selected)?.label
|
|
37
|
+
return this.optionsToDisplay.find((item) => item.selected)?.label || ''
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
connectedCallback() {
|
|
@@ -53,6 +59,13 @@ export default class Picklist extends SelectElement {
|
|
|
53
59
|
if (!this.disabled) {
|
|
54
60
|
this.showOptions = false
|
|
55
61
|
}
|
|
62
|
+
this.dispatchEvent(
|
|
63
|
+
new CustomEvent('blur', {
|
|
64
|
+
detail: null,
|
|
65
|
+
cancelable: true,
|
|
66
|
+
bubbles: true
|
|
67
|
+
})
|
|
68
|
+
)
|
|
56
69
|
}
|
|
57
70
|
|
|
58
71
|
handleCloseModal() {
|
|
@@ -64,12 +77,19 @@ export default class Picklist extends SelectElement {
|
|
|
64
77
|
if (!this.disabled) {
|
|
65
78
|
this.showOptions = true
|
|
66
79
|
}
|
|
80
|
+
this.dispatchEvent(
|
|
81
|
+
new CustomEvent('focus', {
|
|
82
|
+
detail: null,
|
|
83
|
+
cancelable: true,
|
|
84
|
+
bubbles: true
|
|
85
|
+
})
|
|
86
|
+
)
|
|
67
87
|
}
|
|
68
88
|
|
|
69
89
|
handleChange(event) {
|
|
70
90
|
event.stopPropagation()
|
|
71
91
|
if (!this.disabled) {
|
|
72
|
-
this.value = event.
|
|
92
|
+
this.value = event.currentTarget.dataset.value
|
|
73
93
|
this.dispatchEvent(
|
|
74
94
|
new CustomEvent('change', {
|
|
75
95
|
detail: this.getData()
|
|
@@ -83,6 +103,7 @@ export default class Picklist extends SelectElement {
|
|
|
83
103
|
get computedStyles() {
|
|
84
104
|
return this.generateClassNameList({
|
|
85
105
|
'flt-picklist': true,
|
|
106
|
+
'flt-picklist_disabled': this.disabled,
|
|
86
107
|
'flt-picklist_active': this.showOptions,
|
|
87
108
|
'flt-picklist_selected': this.value,
|
|
88
109
|
'flt-picklist_modal': this.showDropdownAsModal && this.showOptions && !this.isDesktop
|
|
@@ -95,4 +116,12 @@ export default class Picklist extends SelectElement {
|
|
|
95
116
|
'flt-picklist__error-message_active': this.error
|
|
96
117
|
})
|
|
97
118
|
}
|
|
119
|
+
|
|
120
|
+
renderedCallback() {
|
|
121
|
+
super.renderedCallback()
|
|
122
|
+
this.setAttribute(
|
|
123
|
+
'user-data-modal',
|
|
124
|
+
!!(this.showDropdownAsModal && this.showOptions && !this.isDesktop)
|
|
125
|
+
)
|
|
126
|
+
}
|
|
98
127
|
}
|
|
@@ -20,6 +20,20 @@
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
&_disabled {
|
|
24
|
+
color: #d1d5db;
|
|
25
|
+
|
|
26
|
+
.flt-picklist__wrapp {
|
|
27
|
+
border-color: #d1d5db !important;
|
|
28
|
+
background: #f9fafb !important;
|
|
29
|
+
cursor: not-allowed;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.flt-picklist__view-arrow {
|
|
33
|
+
opacity: 0.25;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
23
37
|
&_modal {
|
|
24
38
|
position: initial;
|
|
25
39
|
z-index: initial;
|
|
@@ -127,14 +141,14 @@
|
|
|
127
141
|
background-color: #fff;
|
|
128
142
|
overflow: hidden;
|
|
129
143
|
border-radius: var(--flt-picklist-border-radius, 12px);
|
|
130
|
-
width:
|
|
144
|
+
width: 80vw;
|
|
131
145
|
|
|
132
146
|
.flt-picklist__dropdown {
|
|
133
147
|
position: relative;
|
|
134
148
|
top: initial;
|
|
135
149
|
left: initial;
|
|
136
150
|
animation: initial;
|
|
137
|
-
max-height:
|
|
151
|
+
max-height: 80vh;
|
|
138
152
|
}
|
|
139
153
|
|
|
140
154
|
.flt-picklist__option {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div class="flt-picklist__wrapp">
|
|
4
4
|
<div class="flt-picklist__wrapp-text">
|
|
5
5
|
<div class="flt-picklist__placeholder">{placeholder}</div>
|
|
6
|
-
<div class="flt-picklist__value"
|
|
6
|
+
<div class="flt-picklist__value" lwc:inner-html={displayLabel}></div>
|
|
7
7
|
</div>
|
|
8
8
|
<svg
|
|
9
9
|
width="24"
|
|
@@ -49,17 +49,15 @@
|
|
|
49
49
|
key={option.value}
|
|
50
50
|
onclick={handleChange}
|
|
51
51
|
data-value={option.value}
|
|
52
|
-
class="flt-picklist__option flt-picklist__option_selected"
|
|
53
|
-
{option.label}
|
|
54
|
-
</div>
|
|
52
|
+
class="flt-picklist__option flt-picklist__option_selected"
|
|
53
|
+
lwc:inner-html={option.label}></div>
|
|
55
54
|
<div
|
|
56
55
|
lwc:else
|
|
57
56
|
onclick={handleChange}
|
|
58
57
|
key={option.value}
|
|
59
58
|
data-value={option.value}
|
|
60
|
-
class="flt-picklist__option"
|
|
61
|
-
{option.label}
|
|
62
|
-
</div>
|
|
59
|
+
class="flt-picklist__option"
|
|
60
|
+
lwc:inner-html={option.label}></div>
|
|
63
61
|
</template>
|
|
64
62
|
</div>
|
|
65
63
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fleetcor-lwc",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "LWC framework by Fleetcor",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"flt/icon",
|
|
33
33
|
"flt/inputText",
|
|
34
34
|
"flt/inputEmail",
|
|
35
|
+
"flt/inputPhone",
|
|
35
36
|
"flt/picklist",
|
|
36
37
|
"flt/modal",
|
|
37
38
|
"flt/radioGroup",
|
|
@@ -77,7 +78,6 @@
|
|
|
77
78
|
"terser-webpack-plugin": "^5.3.16",
|
|
78
79
|
"webpack": "^5.105.2",
|
|
79
80
|
"webpack-cli": "^6.0.1",
|
|
80
|
-
"webpack-dev-server": "^5.2.3"
|
|
81
|
-
"imask": "^7.6.1"
|
|
81
|
+
"webpack-dev-server": "^5.2.3"
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { createElement } from 'lwc'
|
|
2
|
-
|
|
3
|
-
import RadioItem from 'flt/radioItem'
|
|
4
|
-
|
|
5
|
-
describe('flt-radio-item', () => {
|
|
6
|
-
afterEach(() => {
|
|
7
|
-
while (document.body.firstChild) {
|
|
8
|
-
document.body.removeChild(document.body.firstChild)
|
|
9
|
-
}
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
it('Generate active radio item', async () => {
|
|
13
|
-
const radioItemDefault = createElement('flt-radio-item', { is: RadioItem })
|
|
14
|
-
radioItemDefault.option = {
|
|
15
|
-
label: 'Label 1',
|
|
16
|
-
value: 'value 1',
|
|
17
|
-
selected: true,
|
|
18
|
-
disabled: false
|
|
19
|
-
}
|
|
20
|
-
document.body.appendChild(radioItemDefault)
|
|
21
|
-
|
|
22
|
-
await expect(radioItemDefault.firstChild.classList).toContain('flt-radio-item_selected')
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('Generate default radio item', async () => {
|
|
26
|
-
const radioItemDefault = createElement('flt-radio-item', { is: RadioItem })
|
|
27
|
-
radioItemDefault.option = {
|
|
28
|
-
label: 'Label 1',
|
|
29
|
-
value: 'value 1',
|
|
30
|
-
selected: false,
|
|
31
|
-
disabled: false
|
|
32
|
-
}
|
|
33
|
-
document.body.appendChild(radioItemDefault)
|
|
34
|
-
|
|
35
|
-
await expect(radioItemDefault.firstChild.classList).toContain('flt-radio-item')
|
|
36
|
-
await expect(radioItemDefault.firstChild.classList).toContain('flt-radio-item_size_s')
|
|
37
|
-
await expect(radioItemDefault.firstChild.classList).not.toContain('flt-radio-item_disabled')
|
|
38
|
-
await expect(radioItemDefault.firstChild.classList).not.toContain('flt-radio-item_selected')
|
|
39
|
-
|
|
40
|
-
await radioItemDefault.firstChild.click()
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
it('Generate disabled radio item', async () => {
|
|
44
|
-
const radioItemDefault = createElement('flt-radio-item', { is: RadioItem })
|
|
45
|
-
radioItemDefault.option = {
|
|
46
|
-
label: 'Label 1',
|
|
47
|
-
value: 'value 1',
|
|
48
|
-
selected: false,
|
|
49
|
-
disabled: true
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
document.body.appendChild(radioItemDefault)
|
|
53
|
-
|
|
54
|
-
await expect(radioItemDefault.firstChild.classList).toContain('flt-radio-item_disabled')
|
|
55
|
-
})
|
|
56
|
-
})
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.2762 8.65164C6.6345 8.30713 7.20424 8.3183 7.54875 8.67659L12 13.4019L16.4513 8.67659C16.7958 8.3183 17.3655 8.30713 17.7238 8.65164C18.0821 8.99616 18.0933 9.5659 17.7487 9.92419L12.6488 15.3242C12.4791 15.5007 12.2448 15.6004 12 15.6004C11.7552 15.6004 11.5209 15.5007 11.3513 15.3242L6.25125 9.92419C5.90674 9.5659 5.91791 8.99616 6.2762 8.65164Z" fill="#111827"/>
|
|
3
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.46967 5.46967C5.76256 5.17678 6.23744 5.17678 6.53033 5.46967L12 10.9393L17.4697 5.46967C17.7626 5.17678 18.2374 5.17678 18.5303 5.46967C18.8232 5.76256 18.8232 6.23744 18.5303 6.53033L13.0607 12L18.5303 17.4697C18.8232 17.7626 18.8232 18.2374 18.5303 18.5303C18.2374 18.8232 17.7626 18.8232 17.4697 18.5303L12 13.0607L6.53033 18.5303C6.23744 18.8232 5.76256 18.8232 5.46967 18.5303C5.17678 18.2374 5.17678 17.7626 5.46967 17.4697L10.9393 12L5.46967 6.53033C5.17678 6.23744 5.17678 5.76256 5.46967 5.46967Z" fill="black"/>
|
|
3
|
-
</svg>
|