@empathyco/x-components 3.0.0-alpha.366 → 3.0.0-alpha.367

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/design-system/deprecated-full-theme.css +78 -78
  3. package/docs/API-reference/api/x-components.basecurrency.md +20 -11
  4. package/docs/API-reference/api/x-components.basesuggestion.md +48 -23
  5. package/docs/API-reference/api/x-components.md +2 -2
  6. package/js/components/currency/base-currency.vue.js.map +1 -1
  7. package/js/components/currency/base-currency.vue_rollup-plugin-vue_script.vue.js +51 -38
  8. package/js/components/currency/base-currency.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  9. package/js/components/result/base-result-image.vue.js +1 -1
  10. package/js/components/result/base-result-image.vue.js.map +1 -1
  11. package/js/components/result/base-result-image.vue_rollup-plugin-vue_script.vue.js +6 -1
  12. package/js/components/result/base-result-image.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  13. package/js/components/result/base-result-image.vue_rollup-plugin-vue_styles.0.vue.js +1 -1
  14. package/js/components/suggestions/base-suggestion.vue.js +6 -2
  15. package/js/components/suggestions/base-suggestion.vue.js.map +1 -1
  16. package/js/components/suggestions/base-suggestion.vue_rollup-plugin-vue_script.vue.js +124 -94
  17. package/js/components/suggestions/base-suggestion.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  18. package/package.json +2 -2
  19. package/report/x-components.api.json +345 -409
  20. package/report/x-components.api.md +67 -23
  21. package/types/components/currency/base-currency.vue.d.ts +26 -20
  22. package/types/components/currency/base-currency.vue.d.ts.map +1 -1
  23. package/types/components/result/base-result-image.vue.d.ts.map +1 -1
  24. package/types/components/suggestions/base-suggestion.vue.d.ts +55 -36
  25. package/types/components/suggestions/base-suggestion.vue.d.ts.map +1 -1
  26. package/docs/API-reference/api/x-components.basecurrency.format.md +0 -13
  27. package/docs/API-reference/api/x-components.basecurrency.injectedformat.md +0 -13
  28. package/docs/API-reference/api/x-components.basecurrency.value.md +0 -18
  29. package/docs/API-reference/api/x-components.basesuggestion.dynamiccssclasses.md +0 -18
  30. package/docs/API-reference/api/x-components.basesuggestion.emitevents.md +0 -17
  31. package/docs/API-reference/api/x-components.basesuggestion.events.md +0 -18
  32. package/docs/API-reference/api/x-components.basesuggestion.feature.md +0 -13
  33. package/docs/API-reference/api/x-components.basesuggestion.filter.md +0 -13
  34. package/docs/API-reference/api/x-components.basesuggestion.highlightcurated.md +0 -13
  35. package/docs/API-reference/api/x-components.basesuggestion.query.md +0 -13
  36. package/docs/API-reference/api/x-components.basesuggestion.suggestion.md +0 -13
  37. package/docs/API-reference/api/x-components.basesuggestion.suggestionselectedevents.md +0 -13
package/CHANGELOG.md CHANGED
@@ -1,3 +1,38 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [3.0.0-alpha.367](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.366...@empathyco/x-components@3.0.0-alpha.367) (2023-05-11)
7
+
8
+
9
+ ### ⚠ BREAKING CHANGES
10
+
11
+ * **deps:** minimum version required is node v18
12
+
13
+ EMP-274
14
+
15
+ ### Features
16
+
17
+ * migrate suggestions and currency components to vue 3 syntax (#1159) ([67beb82](https://github.com/empathyco/x/commit/67beb820722521e0db3cfdc9ae039e52e6d268f7))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * `BaseResultImage` not showing the right size on load (#1176) ([c7ebf54](https://github.com/empathyco/x/commit/c7ebf54f03e23bdf8cd1a64e1e008369ca1a643d))
23
+
24
+
25
+ ### Others
26
+
27
+ * **deps:** update node to v18 (#1175) ([14e64e1](https://github.com/empathyco/x/commit/14e64e11fdf7f3d27d59baf56b027857df9e61e7))
28
+
29
+
30
+ ### Continuous Integration
31
+
32
+ * parallelize steps (#1174) ([3013595](https://github.com/empathyco/x/commit/3013595857c8dac33f36b2c0d08e747b0735c6a0))
33
+
34
+
35
+
1
36
  # Change Log
2
37
 
3
38
  All notable changes to this project will be documented in this file. See
@@ -286,49 +286,6 @@
286
286
  --x-size-border-width-bottom-button-default: var(--x-size-border-width-bottom-button-tertiary);
287
287
  --x-size-border-width-left-button-default: var(--x-size-border-width-left-button-tertiary);
288
288
  }
289
- :root {
290
- --x-size-gap-dropdown-card: var(--x-size-base-03);
291
- --x-size-border-radius-dropdown-card: var(--x-size-border-radius-base-s);
292
- --x-size-border-radius-top-left-dropdown-card: var(--x-size-border-radius-dropdown-card);
293
- --x-size-border-radius-top-right-dropdown-card: var(--x-size-border-radius-dropdown-card);
294
- --x-size-border-radius-bottom-right-dropdown-card: var(--x-size-border-radius-dropdown-card);
295
- --x-size-border-radius-bottom-left-dropdown-card: var(--x-size-border-radius-dropdown-card);
296
- --x-size-border-width-dropdown-list-card: var(--x-size-border-width-base);
297
- --x-size-border-width-top-dropdown-list-card: var(--x-size-border-width-dropdown-list-card);
298
- --x-size-border-width-right-dropdown-list-card: var(--x-size-border-width-dropdown-list-card);
299
- --x-size-border-width-bottom-dropdown-list-card: var(--x-size-border-width-dropdown-list-card);
300
- --x-size-border-width-left-dropdown-list-card: var(--x-size-border-width-dropdown-list-card);
301
- }
302
-
303
- .x-dropdown--card {
304
- --x-size-gap-dropdown-default: var(--x-size-gap-dropdown-card);
305
- --x-size-border-radius-dropdown-default: var(--x-size-border-radius-dropdown-card);
306
- --x-size-border-radius-top-left-dropdown-default: var(
307
- --x-size-border-radius-top-left-dropdown-card
308
- );
309
- --x-size-border-radius-top-right-dropdown-default: var(
310
- --x-size-border-radius-top-right-dropdown-card
311
- );
312
- --x-size-border-radius-bottom-right-dropdown-default: var(
313
- --x-size-border-radius-bottom-right-dropdown-card
314
- );
315
- --x-size-border-radius-bottom-left-dropdown-default: var(
316
- --x-size-border-radius-bottom-left-dropdown-card
317
- );
318
- --x-size-border-width-dropdown-list-default: var(--x-size-border-width-dropdown-list-card);
319
- --x-size-border-width-top-dropdown-list-default: var(
320
- --x-size-border-width-top-dropdown-list-card
321
- );
322
- --x-size-border-width-right-dropdown-list-default: var(
323
- --x-size-border-width-right-dropdown-list-card
324
- );
325
- --x-size-border-width-bottom-dropdown-list-default: var(
326
- --x-size-border-width-bottom-dropdown-list-card
327
- );
328
- --x-size-border-width-left-dropdown-list-default: var(
329
- --x-size-border-width-left-dropdown-list-card
330
- );
331
- }
332
289
  :root {
333
290
  --x-size-border-radius-dropdown-default: var(--x-size-border-radius-base-none);
334
291
  --x-size-border-radius-top-left-dropdown-default: var(--x-size-border-radius-dropdown-default);
@@ -571,6 +528,49 @@
571
528
  [dir="rtl"] .x-dropdown--right .x-dropdown__items-list {
572
529
  left: 0;
573
530
  }
531
+ :root {
532
+ --x-size-gap-dropdown-card: var(--x-size-base-03);
533
+ --x-size-border-radius-dropdown-card: var(--x-size-border-radius-base-s);
534
+ --x-size-border-radius-top-left-dropdown-card: var(--x-size-border-radius-dropdown-card);
535
+ --x-size-border-radius-top-right-dropdown-card: var(--x-size-border-radius-dropdown-card);
536
+ --x-size-border-radius-bottom-right-dropdown-card: var(--x-size-border-radius-dropdown-card);
537
+ --x-size-border-radius-bottom-left-dropdown-card: var(--x-size-border-radius-dropdown-card);
538
+ --x-size-border-width-dropdown-list-card: var(--x-size-border-width-base);
539
+ --x-size-border-width-top-dropdown-list-card: var(--x-size-border-width-dropdown-list-card);
540
+ --x-size-border-width-right-dropdown-list-card: var(--x-size-border-width-dropdown-list-card);
541
+ --x-size-border-width-bottom-dropdown-list-card: var(--x-size-border-width-dropdown-list-card);
542
+ --x-size-border-width-left-dropdown-list-card: var(--x-size-border-width-dropdown-list-card);
543
+ }
544
+
545
+ .x-dropdown--card {
546
+ --x-size-gap-dropdown-default: var(--x-size-gap-dropdown-card);
547
+ --x-size-border-radius-dropdown-default: var(--x-size-border-radius-dropdown-card);
548
+ --x-size-border-radius-top-left-dropdown-default: var(
549
+ --x-size-border-radius-top-left-dropdown-card
550
+ );
551
+ --x-size-border-radius-top-right-dropdown-default: var(
552
+ --x-size-border-radius-top-right-dropdown-card
553
+ );
554
+ --x-size-border-radius-bottom-right-dropdown-default: var(
555
+ --x-size-border-radius-bottom-right-dropdown-card
556
+ );
557
+ --x-size-border-radius-bottom-left-dropdown-default: var(
558
+ --x-size-border-radius-bottom-left-dropdown-card
559
+ );
560
+ --x-size-border-width-dropdown-list-default: var(--x-size-border-width-dropdown-list-card);
561
+ --x-size-border-width-top-dropdown-list-default: var(
562
+ --x-size-border-width-top-dropdown-list-card
563
+ );
564
+ --x-size-border-width-right-dropdown-list-default: var(
565
+ --x-size-border-width-right-dropdown-list-card
566
+ );
567
+ --x-size-border-width-bottom-dropdown-list-default: var(
568
+ --x-size-border-width-bottom-dropdown-list-card
569
+ );
570
+ --x-size-border-width-left-dropdown-list-default: var(
571
+ --x-size-border-width-left-dropdown-list-card
572
+ );
573
+ }
574
574
  :root {
575
575
  --x-size-width-dropdown-l: 202px;
576
576
  }
@@ -1055,12 +1055,6 @@
1055
1055
  .x-hierarchical-filter-container .x-filter, .x-hierarchical-filter-container .x-facet-filter {
1056
1056
  width: 100%;
1057
1057
  }
1058
- .x-filter--justified.x-filter > *:last-child:not(.x-filter__label),
1059
- .x-filter--justified.x-facet-filter > *:last-child:not(.x-filter__label),
1060
- .x-filter--justified .x-filter > *:last-child:not(.x-filter__label),
1061
- .x-filter--justified .x-facet-filter > *:last-child:not(.x-filter__label) {
1062
- margin-left: auto;
1063
- }
1064
1058
  :root {
1065
1059
  --x-size-padding-grid: 0;
1066
1060
  --x-size-gap-grid: var(--x-size-base-03);
@@ -1087,6 +1081,12 @@
1087
1081
  .x-grid-list--cols-auto .x-grid-list__item {
1088
1082
  min-width: var(--x-size-min-width-grid-item);
1089
1083
  }
1084
+ .x-filter--justified.x-filter > *:last-child:not(.x-filter__label),
1085
+ .x-filter--justified.x-facet-filter > *:last-child:not(.x-filter__label),
1086
+ .x-filter--justified .x-filter > *:last-child:not(.x-filter__label),
1087
+ .x-filter--justified .x-facet-filter > *:last-child:not(.x-filter__label) {
1088
+ margin-left: auto;
1089
+ }
1090
1090
  :root {
1091
1091
  --x-color-stroke-icon-default: currentColor;
1092
1092
  --x-color-fill-icon-default: none;
@@ -3484,35 +3484,6 @@
3484
3484
  .x-row--gap-20 {
3485
3485
  --x-size-gap-row: var(--x-size-gap-row-20);
3486
3486
  }
3487
- /* @deprecated */
3488
- :root {
3489
- --x-size-padding-row-02: var(--x-size-base-02);
3490
- --x-size-padding-row-03: var(--x-size-base-03);
3491
- --x-size-padding-row-04: var(--x-size-base-04);
3492
- --x-size-padding-row-05: var(--x-size-base-05);
3493
- --x-size-padding-row-06: var(--x-size-base-06);
3494
- }
3495
-
3496
- /* @deprecated */
3497
- .x-row--padding-02 {
3498
- --x-size-padding-row: var(--x-size-padding-row-02);
3499
- }
3500
-
3501
- .x-row--padding-03 {
3502
- --x-size-padding-row: var(--x-size-padding-row-03);
3503
- }
3504
-
3505
- .x-row--padding-04 {
3506
- --x-size-padding-row: var(--x-size-padding-row-04);
3507
- }
3508
-
3509
- .x-row--padding-05 {
3510
- --x-size-padding-row: var(--x-size-padding-row-05);
3511
- }
3512
-
3513
- .x-row--padding-06 {
3514
- --x-size-padding-row: var(--x-size-padding-row-06);
3515
- }
3516
3487
  :root {
3517
3488
  --x-string-overflow-scroll: auto;
3518
3489
  --x-color-background-scroll-bar: transparent;
@@ -3551,6 +3522,35 @@
3551
3522
  .x-base-scroll {
3552
3523
  overflow-y: var(--x-string-overflow-scroll, auto);
3553
3524
  }
3525
+ /* @deprecated */
3526
+ :root {
3527
+ --x-size-padding-row-02: var(--x-size-base-02);
3528
+ --x-size-padding-row-03: var(--x-size-base-03);
3529
+ --x-size-padding-row-04: var(--x-size-base-04);
3530
+ --x-size-padding-row-05: var(--x-size-base-05);
3531
+ --x-size-padding-row-06: var(--x-size-base-06);
3532
+ }
3533
+
3534
+ /* @deprecated */
3535
+ .x-row--padding-02 {
3536
+ --x-size-padding-row: var(--x-size-padding-row-02);
3537
+ }
3538
+
3539
+ .x-row--padding-03 {
3540
+ --x-size-padding-row: var(--x-size-padding-row-03);
3541
+ }
3542
+
3543
+ .x-row--padding-04 {
3544
+ --x-size-padding-row: var(--x-size-padding-row-04);
3545
+ }
3546
+
3547
+ .x-row--padding-05 {
3548
+ --x-size-padding-row: var(--x-size-padding-row-05);
3549
+ }
3550
+
3551
+ .x-row--padding-06 {
3552
+ --x-size-padding-row: var(--x-size-padding-row-06);
3553
+ }
3554
3554
  .x-sliding-panel {
3555
3555
  z-index: 0;
3556
3556
  background-color: var(--x-color-background-sliding-panel);
@@ -2,7 +2,7 @@
2
2
 
3
3
  [Home](./index.md) > [@empathyco/x-components](./x-components.md) > [BaseCurrency](./x-components.basecurrency.md)
4
4
 
5
- ## BaseCurrency class
5
+ ## BaseCurrency variable
6
6
 
7
7
  Renders the value received as a property which always must be a JavaScript number, with the proper format provided as a string property or by injection. The rendered tag is a span in order to render a default inline HTML element.
8
8
 
@@ -11,9 +11,26 @@ Regarding the format or mask to be defined as string: - Use 'i' to define intege
11
11
  **Signature:**
12
12
 
13
13
  ```typescript
14
- export default class BaseCurrency extends Vue
14
+ _default: import("vue").DefineComponent<{
15
+ value: {
16
+ type: NumberConstructor;
17
+ required: true;
18
+ };
19
+ format: {
20
+ type: StringConstructor;
21
+ };
22
+ }, {
23
+ currency: import("vue").ComputedRef<string>;
24
+ }, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{
25
+ value: {
26
+ type: NumberConstructor;
27
+ required: true;
28
+ };
29
+ format: {
30
+ type: StringConstructor;
31
+ };
32
+ }>>, {}>
15
33
  ```
16
- **Extends:** Vue
17
34
 
18
35
  ## Remarks
19
36
 
@@ -33,11 +50,3 @@ It will render: `123.456,7890 €`<!-- -->.
33
50
 
34
51
  See docs below for more examples.
35
52
 
36
- ## Properties
37
-
38
- | Property | Modifiers | Type | Description |
39
- | --- | --- | --- | --- |
40
- | [format?](./x-components.basecurrency.format.md) | <code>protected</code> | string | _(Optional)_ The format as string. |
41
- | [injectedFormat](./x-components.basecurrency.injectedformat.md) | | string | The injected format as string. |
42
- | [value](./x-components.basecurrency.value.md) | <code>protected</code> | number | Numeric value to be formatted. |
43
-
@@ -2,7 +2,7 @@
2
2
 
3
3
  [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [BaseSuggestion](./x-components.basesuggestion.md)
4
4
 
5
- ## BaseSuggestion class
5
+ ## BaseSuggestion variable
6
6
 
7
7
  Renders a button with a default slot. It receives a query, which should be the query of the module using this component, a suggestion, the [XEvents](./x-components.xevent.md) that will be emitted on click with a given feature.
8
8
 
@@ -11,26 +11,51 @@ The default slot receives the suggestion and the matched query has props.
11
11
  **Signature:**
12
12
 
13
13
  ```typescript
14
- export default class BaseSuggestion extends Vue
14
+ _default: import("vue").DefineComponent<{
15
+ query: {
16
+ type: StringConstructor;
17
+ default: string;
18
+ };
19
+ suggestion: {
20
+ type: PropType<Suggestion>;
21
+ required: true;
22
+ };
23
+ feature: {
24
+ type: PropType<QueryFeature>;
25
+ };
26
+ suggestionSelectedEvents: {
27
+ type: PropType<Partial<XEventsTypes>>;
28
+ required: true;
29
+ };
30
+ highlightCurated: {
31
+ type: BooleanConstructor;
32
+ };
33
+ }, {
34
+ el: import("vue").Ref<HTMLElement | null>;
35
+ filter: import("vue").ComputedRef<BooleanFilter | undefined>;
36
+ emitEvents: () => void;
37
+ dynamicCSSClasses: import("vue").ComputedRef<VueCSSClasses>;
38
+ }, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{
39
+ query: {
40
+ type: StringConstructor;
41
+ default: string;
42
+ };
43
+ suggestion: {
44
+ type: PropType<Suggestion>;
45
+ required: true;
46
+ };
47
+ feature: {
48
+ type: PropType<QueryFeature>;
49
+ };
50
+ suggestionSelectedEvents: {
51
+ type: PropType<Partial<XEventsTypes>>;
52
+ required: true;
53
+ };
54
+ highlightCurated: {
55
+ type: BooleanConstructor;
56
+ };
57
+ }>>, {
58
+ query: string;
59
+ highlightCurated: boolean;
60
+ }>
15
61
  ```
16
- **Extends:** Vue
17
-
18
- ## Properties
19
-
20
- | Property | Modifiers | Type | Description |
21
- | --- | --- | --- | --- |
22
- | [dynamicCSSClasses](./x-components.basesuggestion.dynamiccssclasses.md) | <p><code>protected</code></p><p><code>readonly</code></p> | [VueCSSClasses](./x-components.vuecssclasses.md) | Generates css classes dynamically. |
23
- | [events](./x-components.basesuggestion.events.md) | <p><code>protected</code></p><p><code>readonly</code></p> | Partial&lt;[XEventsTypes](./x-components.xeventstypes.md)<!-- -->&gt; | The event handler that will be triggered when clicking on a suggestion. |
24
- | [feature?](./x-components.basesuggestion.feature.md) | <code>protected</code> | [QueryFeature](./x-components.queryfeature.md) | _(Optional)_ The feature from which the events will be emitted. |
25
- | [filter](./x-components.basesuggestion.filter.md) | <p><code>protected</code></p><p><code>readonly</code></p> | BooleanFilter \| undefined | Returns the suggestion filter object. It is a BooleanFilter because the label is needed. It returns only the first element because the facets and filters are being planned in the BaseSuggestions component. |
26
- | [highlightCurated](./x-components.basesuggestion.highlightcurated.md) | <code>protected</code> | boolean | Indicates if the curated suggestion should be highlighted. |
27
- | [query](./x-components.basesuggestion.query.md) | <code>protected</code> | string | The normalized query of the module using this component. |
28
- | [suggestion](./x-components.basesuggestion.suggestion.md) | <code>protected</code> | Suggestion | The suggestion to render and use in the default slot. |
29
- | [suggestionSelectedEvents](./x-components.basesuggestion.suggestionselectedevents.md) | <code>protected</code> | Partial&lt;[XEventsTypes](./x-components.xeventstypes.md)<!-- -->&gt; | The [XEvents](./x-components.xevent.md) that will be emitted when selecting a suggestion. |
30
-
31
- ## Methods
32
-
33
- | Method | Modifiers | Description |
34
- | --- | --- | --- |
35
- | [emitEvents()](./x-components.basesuggestion.emitevents.md) | <code>protected</code> | Emits the events when the button is clicked. |
36
-
@@ -17,7 +17,6 @@ X-Components is a library usable everywhere not only for search experiences.
17
17
  | [BannersList](./x-components.bannerslist.md) | <p>It renders a [ItemsList](./x-components.itemslist.md) list of banners from [SearchState.banners](./x-components.searchstate.banners.md) by default using the <code>ItemsInjectionMixin</code>.</p><p>The component provides a default slot which wraps the whole component with the <code>banners</code> plus the <code>searchInjectedItems</code> which also contains the injected list items from the ancestor.</p><p>It also provides the parent slots to customize the items.</p> |
18
18
  | [BaseColumnPickerDropdown](./x-components.basecolumnpickerdropdown.md) | <p>Column picker dropdown component renders [dropdown](./x-components.basedropdown.md) component which options are the different columns you can set for a grid.</p><p>It emits [UserClickedColumnPicker](./x-components.xeventstypes.userclickedcolumnpicker.md) on dropdown input.</p> |
19
19
  | [BaseColumnPickerList](./x-components.basecolumnpickerlist.md) | <p>Column picker list component renders a list of buttons to choose the columns number.</p><p>Additionally, this component exposes the following props to modify the classes of the elements: <code>buttonClass</code>.</p> |
20
- | [BaseCurrency](./x-components.basecurrency.md) | <p>Renders the value received as a property which always must be a JavaScript number, with the proper format provided as a string property or by injection. The rendered tag is a span in order to render a default inline HTML element.</p><p>Regarding the format or mask to be defined as string: - Use 'i' to define integer numbers. - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the format doesn't include decimals, it is filled with zeros until reach the length defined with 'd's. - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group. - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more than one character. - If you want to hide the decimal part if it's zero, you can add the <code>?</code> symbol after the decimal characters (e.g. 'i.iii,dd?', for <code>1234</code> you would get <code>1.234</code> instead of <code>1.234,00</code>). - Set whatever you need around the integers and decimals marks. - Default mask: 'i.iii,dd' which returns '1.345,67'.</p> |
21
20
  | [BaseDropdown](./x-components.basedropdown.md) | Dropdown component that mimics a Select element behavior, but with the option to customize the toggle button and each item contents. |
22
21
  | [BaseEventButton](./x-components.baseeventbutton.md) | Component to be reused that renders a <code>&lt;button&gt;</code> with the logic of emitting events to the bus on click. The events are passed as an object to prop [events](./x-components.xeventstypes.md)<!-- -->. The keys are the event name and the values are the payload of each event. All events are emitted with its respective payload. If any event doesn't need payload a <code>undefined</code> must be passed as value. |
23
22
  | [BaseEventsModal](./x-components.baseeventsmodal.md) | Component containing a modal that emits a [XEventsTypes.UserClickedCloseEventsModal](./x-components.xeventstypes.userclickedcloseeventsmodal.md) when clicking outside the content rendered in the default slot and can receive, through the eventsToCloseModal prop, a list of [xEvents](./x-components.xevent.md) to listen to in order to close also the modal, eventsToOpenModal prop, another list of [xEvents](./x-components.xevent.md) to customize the events to listen to open the modal and a prop, displayOverlay, to display an overlay over the rest of the html. The default slot offers the possibility to customize the modal content. |
@@ -30,7 +29,6 @@ X-Components is a library usable everywhere not only for search experiences.
30
29
  | [BaseModal](./x-components.basemodal.md) | Base component with no XPlugin dependencies that serves as a utility for constructing more complex modals. |
31
30
  | [BaseRating](./x-components.baserating.md) | Rating component. This component renders a set of elements filled based on the value passed as prop. |
32
31
  | [BaseScroll](./x-components.basescroll.md) | Base scroll component that depending on the user interactivity emits different events for knowing when the user scrolls, the direction of scroll and if user reaches the start or end. |
33
- | [BaseSuggestion](./x-components.basesuggestion.md) | <p>Renders a button with a default slot. It receives a query, which should be the query of the module using this component, a suggestion, the [XEvents](./x-components.xevent.md) that will be emitted on click with a given feature.</p><p>The default slot receives the suggestion and the matched query has props.</p> |
34
32
  | [BaseSuggestions](./x-components.basesuggestions.md) | Paints a list of suggestions passed in by prop. Requires a component for a single suggestion in the default slot for working. |
35
33
  | [BaseSwitch](./x-components.baseswitch.md) | Basic switch component to handle boolean values. This component receives its selected state using a prop, and emits a Vue event whenever the user clicks it. |
36
34
  | [BaseTabsPanel](./x-components.basetabspanel.md) | Base Tabs Panel. |
@@ -380,6 +378,7 @@ X-Components is a library usable everywhere not only for search experiences.
380
378
  | [BarCodeIcon](./x-components.barcodeicon.md) | |
381
379
  | [BarcodeTinyIcon](./x-components.barcodetinyicon.md) | |
382
380
  | [BaseAddToCart](./x-components.baseaddtocart.md) | Renders a button with a default slot. It receives the result with the data and emits [XEventsTypes.UserClickedResultAddToCart](./x-components.xeventstypes.userclickedresultaddtocart.md) to the bus on click mouse event. |
381
+ | [BaseCurrency](./x-components.basecurrency.md) | <p>Renders the value received as a property which always must be a JavaScript number, with the proper format provided as a string property or by injection. The rendered tag is a span in order to render a default inline HTML element.</p><p>Regarding the format or mask to be defined as string: - Use 'i' to define integer numbers. - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the format doesn't include decimals, it is filled with zeros until reach the length defined with 'd's. - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group. - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more than one character. - If you want to hide the decimal part if it's zero, you can add the <code>?</code> symbol after the decimal characters (e.g. 'i.iii,dd?', for <code>1234</code> you would get <code>1.234</code> instead of <code>1.234,00</code>). - Set whatever you need around the integers and decimals marks. - Default mask: 'i.iii,dd' which returns '1.345,67'.</p> |
383
382
  | [BaseEventsModalClose](./x-components.baseeventsmodalclose.md) | Component contains an event button that emits [XEventsTypes.UserClickedCloseEventsModal](./x-components.xeventstypes.userclickedcloseeventsmodal.md) when clicked. It has a default slot to customize its contents. |
384
383
  | [BaseEventsModalOpen](./x-components.baseeventsmodalopen.md) | Component contains an event button that emits [XEventsTypes.UserClickedOpenEventsModal](./x-components.xeventstypes.userclickedopeneventsmodal.md) when clicked. It has a default slot to customize its contents. |
385
384
  | [BaseFallbackImage](./x-components.basefallbackimage.md) | |
@@ -393,6 +392,7 @@ X-Components is a library usable everywhere not only for search experiences.
393
392
  | [BaseResultLink](./x-components.baseresultlink.md) | Component to be reused that renders an <code>&lt;a&gt;</code> wrapping the result contents. |
394
393
  | [BaseResultPreviousPrice](./x-components.baseresultpreviousprice.md) | Component that renders the [result](./x-types.result.md) previous price. |
395
394
  | [BaseResultRating](./x-components.baseresultrating.md) | This component renders a [BaseRating](./x-components.baserating.md) for a result passed as prop. |
395
+ | [BaseSuggestion](./x-components.basesuggestion.md) | <p>Renders a button with a default slot. It receives a query, which should be the query of the module using this component, a suggestion, the [XEvents](./x-components.xevent.md) that will be emitted on click with a given feature.</p><p>The default slot receives the suggestion and the matched query has props.</p> |
396
396
  | [BaseTogglePanel](./x-components.basetogglepanel.md) | Simple panel that receives its open state via prop, which is responsible of rendering default slot inside a configurable transition. |
397
397
  | [bus](./x-components.bus.md) | Default implementation. |
398
398
  | [cancelFetchAndSaveIdentifierResults](./x-components.cancelfetchandsaveidentifierresults.md) | Default implementation for [IdentifierResultsActions.cancelFetchAndSaveIdentifierResults()](./x-components.identifierresultsactions.cancelfetchandsaveidentifierresults.md) action. |
@@ -1 +1 @@
1
- {"version":3,"file":"base-currency.vue.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span v-if=\"value !== undefined\" class=\"x-currency\">{{ currency }}</span>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { currencyFormatter } from '../../utils/currency-formatter';\n import { XInject } from '../decorators/injection.decorators';\n\n /**\n * Renders the value received as a property which always must be a JavaScript number, with the\n * proper format provided as a string property or by injection. The rendered tag is a span in\n * order to render a default inline HTML element.\n *\n * Regarding the format or mask to be defined as string:\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * format doesn't include decimals, it is filled with zeros until reach the length defined with\n * 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - If you want to hide the decimal part if it's zero, you can add the `?` symbol after the\n * decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of `1.234,00`).\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST matches with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, it deletes significant digits.\n *\n * @example\n * Basic example:\n *\n * ```vue\n * <BaseCurrency\n * :value=\"123456.789\"\n * format=\"i.iiii,dddd €\"\n * />\n * ```\n *\n * It will render: `123.456,7890 €`.\n *\n * See docs below for more examples.\n *\n * @public\n */\n @Component\n export default class BaseCurrency extends Vue {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n @Prop({ required: true })\n protected value!: number;\n\n /**\n * The format as string.\n *\n * @public\n */\n @Prop()\n protected format?: string;\n\n /**\n * The injected format as string.\n *\n * @public\n */\n @XInject('currencyFormat')\n public injectedFormat!: string;\n\n /**\n * A format which can be passed through prop or injected.\n *\n * @returns A format as string.\n *\n * @internal\n */\n protected get renderedFormat(): string {\n return this.format ?? this.injectedFormat ?? 'i.iii,dd';\n }\n\n /**\n * Returns the formatted result as string.\n *\n * @returns Formatted number.\n *\n * @internal\n */\n protected get currency(): string {\n return currencyFormatter(this.value, this.renderedFormat);\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders the value received as a property, which always must be a JavaScript number, with the proper\nformat provided as string property. The rendered tag is a span in order to render a default inline\nHTML element.\n\n### Basic usage\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" />\n <!-- output: '12.345.678,87' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,ddd? €\" />\n <!-- output: '12.345.678,876 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678\" format=\"i.iii,ddd? €\" />\n <!-- output: '12.345.678 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"$ i.iii,dd\" />\n <!-- output: '$ 12.345.678,87' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"$i.iii,dd\" />\n <!-- output: '$12.345.678,87' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd €\" />\n <!-- output: '12.345.678,87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd€\" />\n <!-- output: '12.345.678,87€' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i,iii.dd €\" />\n <!-- output: '12,345,678.87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i iii.dd €\" />\n <!-- output: '12 345 678.87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i iii - dd €\" />\n <!-- output: '12 345 678 - 87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,876543 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,870000 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,000000 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd €\" />\n <!-- output: '12.345.678,87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii €\" />\n <!-- output: '12.345.678 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"base-currency.vue.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span v-if=\"value !== undefined\" class=\"x-currency\">{{ currency }}</span>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, inject } from 'vue';\n import { currencyFormatter } from '../../utils/currency-formatter';\n\n /**\n * Renders the value received as a property which always must be a JavaScript number, with the\n * proper format provided as a string property or by injection. The rendered tag is a span in\n * order to render a default inline HTML element.\n *\n * Regarding the format or mask to be defined as string:\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * format doesn't include decimals, it is filled with zeros until reach the length defined with\n * 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - If you want to hide the decimal part if it's zero, you can add the `?` symbol after the\n * decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of `1.234,00`).\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST matches with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, it deletes significant digits.\n *\n * @example\n * Basic example:\n *\n * ```vue\n * <BaseCurrency\n * :value=\"123456.789\"\n * format=\"i.iiii,dddd €\"\n * />\n * ```\n *\n * It will render: `123.456,7890 €`.\n *\n * See docs below for more examples.\n *\n * @public\n */\n export default defineComponent({\n props: {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n value: {\n type: Number,\n required: true\n },\n\n /**\n * The format as string.\n *\n * @public\n */\n format: {\n type: String\n }\n },\n\n setup(props) {\n /**\n * The injected format as string.\n *\n * @public\n */\n const injectedFormat = inject<string>('currencyFormat', 'i.iii,dd');\n\n /**\n * A format which can be passed through prop or injected.\n *\n * @returns A format as string.\n *\n * @internal\n */\n const renderedFormat = computed<string>(() => props.format ?? injectedFormat);\n\n /**\n * Returns the formatted result as string.\n *\n * @returns Formatted number.\n *\n * @internal\n */\n const currency = computed<string>(() => currencyFormatter(props.value, renderedFormat.value));\n\n return {\n currency\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders the value received as a property, which always must be a JavaScript number, with the proper\nformat provided as string property. The rendered tag is a span in order to render a default inline\nHTML element.\n\n### Basic usage\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" />\n <!-- output: '12.345.678,87' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,ddd? €\" />\n <!-- output: '12.345.678,876 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678\" format=\"i.iii,ddd? €\" />\n <!-- output: '12.345.678 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"$ i.iii,dd\" />\n <!-- output: '$ 12.345.678,87' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"$i.iii,dd\" />\n <!-- output: '$12.345.678,87' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd €\" />\n <!-- output: '12.345.678,87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd€\" />\n <!-- output: '12.345.678,87€' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i,iii.dd €\" />\n <!-- output: '12,345,678.87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i iii.dd €\" />\n <!-- output: '12 345 678.87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i iii - dd €\" />\n <!-- output: '12 345 678 - 87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,876543 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,870000 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,000000 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd €\" />\n <!-- output: '12.345.678,87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii €\" />\n <!-- output: '12.345.678 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,5 @@
1
- import { __decorate } from 'tslib';
2
- import Vue from 'vue';
3
- import { Prop, Component } from 'vue-property-decorator';
1
+ import { defineComponent, inject, computed } from 'vue';
4
2
  import { currencyFormatter } from '../../utils/currency-formatter.js';
5
- import { XInject } from '../decorators/injection.decorators.js';
6
3
 
7
4
  /**
8
5
  * Renders the value received as a property which always must be a JavaScript number, with the
@@ -42,41 +39,57 @@ import { XInject } from '../decorators/injection.decorators.js';
42
39
  *
43
40
  * @public
44
41
  */
45
- let BaseCurrency = class BaseCurrency extends Vue {
46
- /**
47
- * A format which can be passed through prop or injected.
48
- *
49
- * @returns A format as string.
50
- *
51
- * @internal
52
- */
53
- get renderedFormat() {
54
- return this.format ?? this.injectedFormat ?? 'i.iii,dd';
42
+ var script = defineComponent({
43
+ props: {
44
+ /**
45
+ * Numeric value to be formatted.
46
+ *
47
+ * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.
48
+ * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.
49
+ *
50
+ * @public
51
+ */
52
+ value: {
53
+ type: Number,
54
+ required: true
55
+ },
56
+ /**
57
+ * The format as string.
58
+ *
59
+ * @public
60
+ */
61
+ format: {
62
+ type: String
63
+ }
64
+ },
65
+ setup(props) {
66
+ /**
67
+ * The injected format as string.
68
+ *
69
+ * @public
70
+ */
71
+ const injectedFormat = inject('currencyFormat', 'i.iii,dd');
72
+ /**
73
+ * A format which can be passed through prop or injected.
74
+ *
75
+ * @returns A format as string.
76
+ *
77
+ * @internal
78
+ */
79
+ const renderedFormat = computed(() => props.format ?? injectedFormat);
80
+ /**
81
+ * Returns the formatted result as string.
82
+ *
83
+ * @returns Formatted number.
84
+ *
85
+ * @internal
86
+ */
87
+ const currency = computed(() => currencyFormatter(props.value, renderedFormat.value));
88
+ return {
89
+ currency
90
+ };
55
91
  }
56
- /**
57
- * Returns the formatted result as string.
58
- *
59
- * @returns Formatted number.
60
- *
61
- * @internal
62
- */
63
- get currency() {
64
- return currencyFormatter(this.value, this.renderedFormat);
65
- }
66
- };
67
- __decorate([
68
- Prop({ required: true })
69
- ], BaseCurrency.prototype, "value", void 0);
70
- __decorate([
71
- Prop()
72
- ], BaseCurrency.prototype, "format", void 0);
73
- __decorate([
74
- XInject('currencyFormat')
75
- ], BaseCurrency.prototype, "injectedFormat", void 0);
76
- BaseCurrency = __decorate([
77
- Component
78
- ], BaseCurrency);
79
- var script = BaseCurrency;
92
+ });
80
93
 
81
94
  export { script as default };
82
95
  //# sourceMappingURL=base-currency.vue_rollup-plugin-vue_script.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-currency.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/currency/base-currency.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { currencyFormatter } from '../../utils/currency-formatter';\n import { XInject } from '../decorators/injection.decorators';\n\n /**\n * Renders the value received as a property which always must be a JavaScript number, with the\n * proper format provided as a string property or by injection. The rendered tag is a span in\n * order to render a default inline HTML element.\n *\n * Regarding the format or mask to be defined as string:\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * format doesn't include decimals, it is filled with zeros until reach the length defined with\n * 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - If you want to hide the decimal part if it's zero, you can add the `?` symbol after the\n * decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of `1.234,00`).\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST matches with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, it deletes significant digits.\n *\n * @example\n * Basic example:\n *\n * ```vue\n * <BaseCurrency\n * :value=\"123456.789\"\n * format=\"i.iiii,dddd €\"\n * />\n * ```\n *\n * It will render: `123.456,7890 €`.\n *\n * See docs below for more examples.\n *\n * @public\n */\n @Component\n export default class BaseCurrency extends Vue {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n @Prop({ required: true })\n protected value!: number;\n\n /**\n * The format as string.\n *\n * @public\n */\n @Prop()\n protected format?: string;\n\n /**\n * The injected format as string.\n *\n * @public\n */\n @XInject('currencyFormat')\n public injectedFormat!: string;\n\n /**\n * A format which can be passed through prop or injected.\n *\n * @returns A format as string.\n *\n * @internal\n */\n protected get renderedFormat(): string {\n return this.format ?? this.injectedFormat ?? 'i.iii,dd';\n }\n\n /**\n * Returns the formatted result as string.\n *\n * @returns Formatted number.\n *\n * @internal\n */\n protected get currency(): string {\n return currencyFormatter(this.value, this.renderedFormat);\n }\n }\n"],"names":[],"mappings":";;;;;;AAUE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCG;AAEY,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,GAAG,CAAA;AA4B3C;;;;;;AAMG;AACH,IAAA,IAAc,cAAc,GAAA;QAC1B,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,cAAc,IAAI,UAAU,CAAC;KACzD;AAED;;;;;;AAMG;AACH,IAAA,IAAc,QAAQ,GAAA;QACpB,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;KAC3D;CACF,CAAA;AAvCC,UAAA,CAAA;AADC,IAAA,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACA,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAQzB,UAAA,CAAA;AADC,IAAA,IAAI,EAAE;AACmB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAQ1B,UAAA,CAAA;IADC,OAAO,CAAC,gBAAgB,CAAC;AACK,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AA1BZ,YAAY,GAAA,UAAA,CAAA;IADhC,SAAS;AACW,CAAA,EAAA,YAAY,CAiDhC,CAAA;aAjDoB,YAAY;;;;"}
1
+ {"version":3,"file":"base-currency.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/currency/base-currency.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n import { computed, defineComponent, inject } from 'vue';\n import { currencyFormatter } from '../../utils/currency-formatter';\n\n /**\n * Renders the value received as a property which always must be a JavaScript number, with the\n * proper format provided as a string property or by injection. The rendered tag is a span in\n * order to render a default inline HTML element.\n *\n * Regarding the format or mask to be defined as string:\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * format doesn't include decimals, it is filled with zeros until reach the length defined with\n * 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - If you want to hide the decimal part if it's zero, you can add the `?` symbol after the\n * decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of `1.234,00`).\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST matches with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, it deletes significant digits.\n *\n * @example\n * Basic example:\n *\n * ```vue\n * <BaseCurrency\n * :value=\"123456.789\"\n * format=\"i.iiii,dddd €\"\n * />\n * ```\n *\n * It will render: `123.456,7890 €`.\n *\n * See docs below for more examples.\n *\n * @public\n */\n export default defineComponent({\n props: {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n value: {\n type: Number,\n required: true\n },\n\n /**\n * The format as string.\n *\n * @public\n */\n format: {\n type: String\n }\n },\n\n setup(props) {\n /**\n * The injected format as string.\n *\n * @public\n */\n const injectedFormat = inject<string>('currencyFormat', 'i.iii,dd');\n\n /**\n * A format which can be passed through prop or injected.\n *\n * @returns A format as string.\n *\n * @internal\n */\n const renderedFormat = computed<string>(() => props.format ?? injectedFormat);\n\n /**\n * Returns the formatted result as string.\n *\n * @returns Formatted number.\n *\n * @internal\n */\n const currency = computed<string>(() => currencyFormatter(props.value, renderedFormat.value));\n\n return {\n currency\n };\n }\n });\n"],"names":[],"mappings":";;;AAQE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCG;AACH,aAAe,eAAe,CAAC;AAC7B,IAAA,KAAK,EAAE;AACL;;;;;;;AAOG;AACH,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED;;;;AAIG;AACH,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACb,SAAA;AACF,KAAA;AAED,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;AAIG;QACH,MAAM,cAAc,GAAG,MAAM,CAAS,gBAAgB,EAAE,UAAU,CAAC,CAAC;AAEpE;;;;;;AAMG;AACH,QAAA,MAAM,cAAc,GAAG,QAAQ,CAAS,MAAM,KAAK,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC;AAE9E;;;;;;AAMG;AACH,QAAA,MAAM,QAAQ,GAAG,QAAQ,CAAS,MAAM,iBAAiB,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;QAE9F,OAAO;YACL,QAAQ;SACT,CAAC;KACH;AACF,CAAA,CAAC;;;;"}
@@ -75,7 +75,7 @@ __vue_render__._withStripped = true;
75
75
  /* style */
76
76
  const __vue_inject_styles__ = undefined;
77
77
  /* scoped */
78
- const __vue_scope_id__ = "data-v-1ae01006";
78
+ const __vue_scope_id__ = "data-v-17f375f7";
79
79
  /* module identifier */
80
80
  const __vue_module_identifier__ = undefined;
81
81
  /* functional template */