fleetcor-lwc 3.19.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
@@ -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,14 @@ 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
+
955
1052
  v.3.19.0
956
1053
 
957
1054
  - 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.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
+ }
@@ -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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetcor-lwc",
3
- "version": "3.19.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",