fleetcor-lwc 3.18.0 → 3.20.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 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
@@ -231,9 +307,9 @@ Add / update `lwc.config.json` file in your project
231
307
 
232
308
  #### Icon variables
233
309
 
234
- | @api variables | type | values | required | description |
235
- | -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ----------- |
236
- | icon | string | `arrow-left, ev, carwash, car, van, unleaded, fuel, driver, vehicle, both, shared-card, ev-and-fuel, oil, key, blocked, multiple-users,arrow-right, diesel, hydrogen, signature, plus, plus-small, document, close, hgv, eye, sign, check, discount, pin-drop, credit-card, receipt, gear-wheel, app-shortcut, drug-indicator, sell, parking-sign, headset-mic, gas-station, directions-car, local-shipping, public, place, info, warning` | - | |
310
+ | @api variables | type | values | required | description |
311
+ | -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ----------- |
312
+ | icon | string | `arrow-left, ev, carwash, car, van, unleaded, fuel, driver, vehicle, both, shared-card, ev-and-fuel, oil, key, blocked, multiple-users,arrow-right, diesel, hydrogen, signature, plus, plus-small, document, close, hgv, eye, sign, check, discount, pin-drop, credit-card, receipt, gear-wheel, app-shortcut, drug-indicator, sell, parking-sign, headset-mic, gas-station, directions-car, local-shipping, public, place, info, warning, arrow-back, arrow-next` | - | |
237
313
 
238
314
  </details>
239
315
 
@@ -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
  ---
@@ -786,6 +890,7 @@ You can override them as you wish by global css variables as priority.
786
890
  --flt-tooltip-bg-color: #374151;
787
891
  --flt-tooltip-color: #f9fafb;
788
892
  --flt-icon-color: #111827;
893
+ --flt-icon-size: 24px;
789
894
  --flt-button-primary-bg-color: #3782c8;
790
895
  --flt-button-primary-color: #f9fafb;
791
896
  --flt-button-primary-disabled-color: #6b7280;
@@ -901,22 +1006,6 @@ You can override them as you wish by global css variables as priority.
901
1006
  --flt-input-phone-border-color-error: #ed123d;
902
1007
  --flt-input-with-picklist-border-color-success: #59eb9c;
903
1008
  --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
1009
  --flt-collapsible-section-background: initial;
921
1010
  --flt-collapsible-section-padding: initial;
922
1011
  --flt-collapsible-section-border: initial;
@@ -952,6 +1041,20 @@ You can override them as you wish by global css variables as priority.
952
1041
  <details>
953
1042
  <summary>Click to expand/collapse</summary>
954
1043
 
1044
+ v.3.20.0
1045
+
1046
+ - Added Btn component
1047
+ - Updated `flt-icon`
1048
+ - Updated `alert-info`
1049
+
1050
+ ---
1051
+
1052
+ v.3.19.0
1053
+
1054
+ - Added 2 new icons `arrow-back` and `arrow-next`
1055
+
1056
+ ---
1057
+
955
1058
  v.3.18.0
956
1059
 
957
1060
  - Bug fix `flt-picklist` component
@@ -966,7 +1069,7 @@ v.3.17.0
966
1069
 
967
1070
  v.3.16.0
968
1071
 
969
- - Update `flt-input-text` - it's become more powerfull with type number
1072
+ - Update `flt-input-text` - it's become more powerfull with type number
970
1073
 
971
1074
  ---
972
1075
 
@@ -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.icon = 'warning'
24
- return Promise.resolve().then(async () => {
25
- expect(alertInfoEl.firstChild.classList).toContain('flt-alert-info_warning')
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
  })
@@ -1,5 +1,5 @@
1
1
  <template lwc:render-mode="light">
2
- <div class={alertClass}>
2
+ <div class="flt-alert-info">
3
3
  <div class="flt-alert-info__icon">
4
4
  <slot name="icon">
5
5
  <flt-icon icon={icon}></flt-icon>
@@ -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
- .flt-icon {
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
+ }
@@ -54,6 +54,8 @@ import TMPL_PLACE from './icons/tmpl-place.html'
54
54
  import TMPL_WARNING from './icons/tmpl-warning.html'
55
55
  import TMPL_INFO from './icons/tmpl-info.html'
56
56
  import TMPL_QUESTION from './icons/tmpl-question.html'
57
+ import TMPL_ARROW_BACK from './icons/tmpl-arrow-back.html'
58
+ import TMPL_ARROW_NEXT from './icons/tmpl-arrow-next.html'
57
59
 
58
60
  /**
59
61
  * @class Icon
@@ -76,6 +78,8 @@ export default class Icon extends LightningDomElement {
76
78
 
77
79
  const ICONS = {
78
80
  search: TMPL_SEARCH,
81
+ 'arrow-back': TMPL_ARROW_BACK,
82
+ 'arrow-next': TMPL_ARROW_NEXT,
79
83
  plus: TMPL_PLUS,
80
84
  'plus-small': TMPL_SMALL_PLUS,
81
85
  document: TMPL_DOCUMENT,
@@ -123,7 +127,7 @@ const ICONS = {
123
127
  place: TMPL_PLACE,
124
128
  warning: TMPL_WARNING,
125
129
  info: TMPL_INFO,
126
- question: TMPL_QUESTION,
130
+ question: TMPL_QUESTION
127
131
  }
128
132
 
129
133
  export const ICONS_LIST = Object.keys(ICONS)
@@ -1,6 +1,6 @@
1
1
  .flt-icon {
2
- width: 24px;
3
- height: 24px;
2
+ width: var(--flt-icon-size, 24px);
3
+ height: var(--flt-icon-size, 24px);
4
4
  display: inline-flex;
5
5
 
6
6
  &__prop-stroke {
@@ -0,0 +1,7 @@
1
+ <template lwc:render-mode="light">
2
+ <svg class="flt-icon flt-icon__arrow-back" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path
4
+ d="M15.6599 9.17148H6.35156L10.4182 5.10482C10.7432 4.77982 10.7432 4.24648 10.4182 3.92148C10.0932 3.59648 9.56823 3.59648 9.24323 3.92148L3.75156 9.41315C3.42656 9.73815 3.42656 10.2632 3.75156 10.5882L9.24323 16.0798C9.56823 16.4048 10.0932 16.4048 10.4182 16.0798C10.7432 15.7548 10.7432 15.2298 10.4182 14.9048L6.35156 10.8382H15.6599C16.1182 10.8382 16.4932 10.4632 16.4932 10.0048C16.4932 9.54648 16.1182 9.17148 15.6599 9.17148Z"
5
+ class="flt-icon__prop-fill" />
6
+ </svg>
7
+ </template>
@@ -0,0 +1,13 @@
1
+ <template lwc:render-mode="light">
2
+ <svg
3
+ class="flt-icon flt-icon__arrow-next"
4
+ width="20"
5
+ height="20"
6
+ viewBox="0 0 20 20"
7
+ fill="none"
8
+ xmlns="http://www.w3.org/2000/svg">
9
+ <path
10
+ d="M4.34115 10.8342H13.6495L9.58281 14.9009C9.25781 15.2259 9.25781 15.7592 9.58281 16.0842C9.90781 16.4092 10.4328 16.4092 10.7578 16.0842L16.2495 10.5926C16.5745 10.2676 16.5745 9.74258 16.2495 9.41758L10.7661 3.91758C10.4411 3.59258 9.91615 3.59258 9.59115 3.91758C9.26615 4.24258 9.26615 4.76758 9.59115 5.09258L13.6495 9.16758H4.34115C3.88281 9.16758 3.50781 9.54258 3.50781 10.0009C3.50781 10.4592 3.88281 10.8342 4.34115 10.8342Z"
11
+ class="flt-icon__prop-fill" />
12
+ </svg>
13
+ </template>
@@ -3,11 +3,6 @@
3
3
  <div class="flt-loader__circle">
4
4
  <div class="flt-loader__inner-circle"></div>
5
5
  </div>
6
- <template lwc:if={tempMessage}>
7
- <p>{tempMessage}</p>
8
- </template>
9
- <template lwc:else>
10
- <slot></slot>
11
- </template>
6
+ <slot></slot>
12
7
  </div>
13
8
  </template>
@@ -1,7 +1,4 @@
1
1
  import { LightningDomElement } from 'fleetcor-lwc'
2
- import { api } from 'lwc'
3
2
  import './loader.scss'
4
3
 
5
- export default class Loader extends LightningDomElement {
6
- @api tempMessage;
7
- }
4
+ export default class Loader extends LightningDomElement {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetcor-lwc",
3
- "version": "3.18.0",
3
+ "version": "3.20.0",
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",