@empathyco/x-components 3.0.0-alpha.142 → 3.0.0-alpha.143

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/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.0.0-alpha.143](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.142...@empathyco/x-components@3.0.0-alpha.143) (2022-08-01)
7
+
8
+ ### Features
9
+
10
+ - **components:** make `BaseIdModalClose` rendering configurable (#627)
11
+ ([4bf97af](https://github.com/empathyco/x/commit/4bf97af19ac5f2fd1b08b6e4097dec45eef00679)),
12
+ closes [EX-6726](https://searchbroker.atlassian.net/browse/EX-6726)
13
+
14
+ # Change Log
15
+
16
+ All notable changes to this project will be documented in this file. See
17
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
18
+
6
19
  ## [3.0.0-alpha.142](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.141...@empathyco/x-components@3.0.0-alpha.142) (2022-07-29)
7
20
 
8
21
  ### Features
@@ -2858,6 +2858,19 @@
2858
2858
  --x-size-border-radius-base-pill: 99999px;
2859
2859
  --x-size-border-width-base: 1px;
2860
2860
  }
2861
+ :root {
2862
+ --x-color-base-lead: #36515b;
2863
+ --x-color-base-auxiliary: #667981;
2864
+ --x-color-base-neutral-10: #1a1a1a;
2865
+ --x-color-base-neutral-35: #595959;
2866
+ --x-color-base-neutral-70: #b3b3b3;
2867
+ --x-color-base-neutral-95: #f2f2f2;
2868
+ --x-color-base-neutral-100: #ffffff;
2869
+ --x-color-base-accent: #b90276;
2870
+ --x-color-base-enable: #00705c;
2871
+ --x-color-base-disable: #e11f26;
2872
+ --x-color-base-transparent: transparent;
2873
+ }
2861
2874
  :root {
2862
2875
  --x-size-base-01: 2px;
2863
2876
  --x-size-base-02: 4px;
@@ -2893,17 +2906,4 @@
2893
2906
  --x-size-line-height-base-s: 16px;
2894
2907
  --x-size-line-height-base-m: 24px;
2895
2908
  --x-size-line-height-base-l: 32px;
2896
- }
2897
- :root {
2898
- --x-color-base-lead: #36515b;
2899
- --x-color-base-auxiliary: #667981;
2900
- --x-color-base-neutral-10: #1a1a1a;
2901
- --x-color-base-neutral-35: #595959;
2902
- --x-color-base-neutral-70: #b3b3b3;
2903
- --x-color-base-neutral-95: #f2f2f2;
2904
- --x-color-base-neutral-100: #ffffff;
2905
- --x-color-base-accent: #b90276;
2906
- --x-color-base-enable: #00705c;
2907
- --x-color-base-disable: #e11f26;
2908
- --x-color-base-transparent: transparent;
2909
2909
  }
@@ -925,78 +925,6 @@
925
925
  --x-size-padding-bottom-facet-header-outlined: var(--x-size-padding-facet-header-outlined);
926
926
  --x-size-padding-left-facet-header-outlined: var(--x-size-padding-facet-header-outlined);
927
927
  }
928
- [dir="ltr"] .x-filter {
929
- padding-left: var(--x-size-padding-left-filter-default);
930
- }
931
- [dir="rtl"] .x-filter {
932
- padding-right: var(--x-size-padding-left-filter-default);
933
- }
934
- [dir="ltr"] .x-filter {
935
- padding-right: var(--x-size-padding-right-filter-default);
936
- }
937
- [dir="rtl"] .x-filter {
938
- padding-left: var(--x-size-padding-right-filter-default);
939
- }
940
- [dir="ltr"] .x-filter {
941
- border-right-width: var(--x-size-border-width-right-filter-default);
942
- }
943
- [dir="rtl"] .x-filter {
944
- border-left-width: var(--x-size-border-width-right-filter-default);
945
- }
946
- [dir="ltr"] .x-filter {
947
- border-left-width: var(--x-size-border-width-left-filter-default);
948
- }
949
- [dir="rtl"] .x-filter {
950
- border-right-width: var(--x-size-border-width-left-filter-default);
951
- }
952
- .x-filter {
953
- display: inline-flex;
954
- justify-content: flex-start;
955
- align-items: flex-start;
956
- box-sizing: border-box;
957
- text-align: left;
958
- gap: var(--x-size-gap-filter-default);
959
- padding-top: var(--x-size-padding-top-filter-default);
960
- padding-bottom: var(--x-size-padding-bottom-filter-default);
961
- background-color: var(--x-color-background-filter-default);
962
- border-color: var(--x-color-border-filter-default);
963
- color: var(--x-color-text-filter-default);
964
- border-style: solid;
965
- border-top-width: var(--x-size-border-width-top-filter-default);
966
- border-bottom-width: var(--x-size-border-width-bottom-filter-default);
967
- border-radius: var(--x-size-border-radius-top-left-filter-default) var(--x-size-border-radius-top-right-filter-default) var(--x-size-border-radius-bottom-right-filter-default) var(--x-size-border-radius-bottom-left-filter-default);
968
- font-family: var(--x-font-family-filter-default);
969
- font-size: var(--x-size-font-filter-default);
970
- font-weight: var(--x-number-font-weight-filter-default);
971
- line-height: var(--x-size-line-height-filter-default);
972
- cursor: pointer;
973
- }
974
- @media not all and (min-resolution: 0.001dpcm) {
975
- .x-filter {
976
- gap: 0;
977
- }
978
- .x-filter > *:not(:last-child) {
979
- margin-right: var(--x-size-gap-filter-default);
980
- }
981
- }
982
- .x-filter > * {
983
- flex: 0 0 auto;
984
- }
985
- .x-filter__label {
986
- flex: 0 1 auto;
987
- }
988
- .x-filter__count {
989
- font-weight: var(--x-number-font-weight-filter-count-default);
990
- }
991
- .x-filter--is-selected {
992
- --x-color-background-filter-default: var(--x-color-background-filter-default-selected);
993
- --x-color-border-filter-default: var(--x-color-border-filter-default-selected);
994
- --x-color-text-filter-default: var(--x-color-text-filter-default-selected);
995
- --x-number-font-weight-filter-default: var(--x-number-font-weight-filter-default-selected);
996
- --x-number-font-weight-filter-count-default: var(
997
- --x-number-font-weight-filter-count-default-selected
998
- );
999
- }
1000
928
  :root {
1001
929
  --x-color-background-filter-default: transparent;
1002
930
  --x-color-border-filter-default: var(--x-color-background-filter-default);
@@ -6468,6 +6396,49 @@
6468
6396
  .x-self-baseline {
6469
6397
  align-self: baseline !important;
6470
6398
  }
6399
+ .x-font-color--lead {
6400
+ color: var(--x-color-base-lead) !important;
6401
+ }
6402
+
6403
+ .x-font-color--auxiliary {
6404
+ color: var(--x-color-base-auxiliary) !important;
6405
+ }
6406
+
6407
+ .x-font-color--neutral-10 {
6408
+ color: var(--x-color-base-neutral-10) !important;
6409
+ }
6410
+
6411
+ .x-font-color--neutral-35 {
6412
+ color: var(--x-color-base-neutral-35) !important;
6413
+ }
6414
+
6415
+ .x-font-color--neutral-70 {
6416
+ color: var(--x-color-base-neutral-70) !important;
6417
+ }
6418
+
6419
+ .x-font-color--neutral-95 {
6420
+ color: var(--x-color-base-neutral-95) !important;
6421
+ }
6422
+
6423
+ .x-font-color--neutral-100 {
6424
+ color: var(--x-color-base-neutral-100) !important;
6425
+ }
6426
+
6427
+ .x-font-color--accent {
6428
+ color: var(--x-color-base-accent) !important;
6429
+ }
6430
+
6431
+ .x-font-color--enable {
6432
+ color: var(--x-color-base-enable) !important;
6433
+ }
6434
+
6435
+ .x-font-color--disable {
6436
+ color: var(--x-color-base-disable) !important;
6437
+ }
6438
+
6439
+ .x-font-color--transparent {
6440
+ color: var(--x-color-base-transparent) !important;
6441
+ }
6471
6442
  .x-font-size--01 {
6472
6443
  font-size: var(--x-size-base-01) !important;
6473
6444
  line-height: 1.5;
@@ -6614,49 +6585,6 @@
6614
6585
  .x-line-height--loose {
6615
6586
  line-height: 2 !important;
6616
6587
  }
6617
- .x-font-color--lead {
6618
- color: var(--x-color-base-lead) !important;
6619
- }
6620
-
6621
- .x-font-color--auxiliary {
6622
- color: var(--x-color-base-auxiliary) !important;
6623
- }
6624
-
6625
- .x-font-color--neutral-10 {
6626
- color: var(--x-color-base-neutral-10) !important;
6627
- }
6628
-
6629
- .x-font-color--neutral-35 {
6630
- color: var(--x-color-base-neutral-35) !important;
6631
- }
6632
-
6633
- .x-font-color--neutral-70 {
6634
- color: var(--x-color-base-neutral-70) !important;
6635
- }
6636
-
6637
- .x-font-color--neutral-95 {
6638
- color: var(--x-color-base-neutral-95) !important;
6639
- }
6640
-
6641
- .x-font-color--neutral-100 {
6642
- color: var(--x-color-base-neutral-100) !important;
6643
- }
6644
-
6645
- .x-font-color--accent {
6646
- color: var(--x-color-base-accent) !important;
6647
- }
6648
-
6649
- .x-font-color--enable {
6650
- color: var(--x-color-base-enable) !important;
6651
- }
6652
-
6653
- .x-font-color--disable {
6654
- color: var(--x-color-base-disable) !important;
6655
- }
6656
-
6657
- .x-font-color--transparent {
6658
- color: var(--x-color-base-transparent) !important;
6659
- }
6660
6588
  .x-margin--auto {
6661
6589
  margin: auto !important;
6662
6590
  }
@@ -7613,3 +7541,76 @@
7613
7541
  .x-normal-case {
7614
7542
  text-transform: none;
7615
7543
  }
7544
+
7545
+ [dir="ltr"] .x-filter {
7546
+ padding-left: var(--x-size-padding-left-filter-default);
7547
+ }
7548
+ [dir="rtl"] .x-filter {
7549
+ padding-right: var(--x-size-padding-left-filter-default);
7550
+ }
7551
+ [dir="ltr"] .x-filter {
7552
+ padding-right: var(--x-size-padding-right-filter-default);
7553
+ }
7554
+ [dir="rtl"] .x-filter {
7555
+ padding-left: var(--x-size-padding-right-filter-default);
7556
+ }
7557
+ [dir="ltr"] .x-filter {
7558
+ border-right-width: var(--x-size-border-width-right-filter-default);
7559
+ }
7560
+ [dir="rtl"] .x-filter {
7561
+ border-left-width: var(--x-size-border-width-right-filter-default);
7562
+ }
7563
+ [dir="ltr"] .x-filter {
7564
+ border-left-width: var(--x-size-border-width-left-filter-default);
7565
+ }
7566
+ [dir="rtl"] .x-filter {
7567
+ border-right-width: var(--x-size-border-width-left-filter-default);
7568
+ }
7569
+ .x-filter {
7570
+ display: inline-flex;
7571
+ justify-content: flex-start;
7572
+ align-items: flex-start;
7573
+ box-sizing: border-box;
7574
+ text-align: left;
7575
+ gap: var(--x-size-gap-filter-default);
7576
+ padding-top: var(--x-size-padding-top-filter-default);
7577
+ padding-bottom: var(--x-size-padding-bottom-filter-default);
7578
+ background-color: var(--x-color-background-filter-default);
7579
+ border-color: var(--x-color-border-filter-default);
7580
+ color: var(--x-color-text-filter-default);
7581
+ border-style: solid;
7582
+ border-top-width: var(--x-size-border-width-top-filter-default);
7583
+ border-bottom-width: var(--x-size-border-width-bottom-filter-default);
7584
+ border-radius: var(--x-size-border-radius-top-left-filter-default) var(--x-size-border-radius-top-right-filter-default) var(--x-size-border-radius-bottom-right-filter-default) var(--x-size-border-radius-bottom-left-filter-default);
7585
+ font-family: var(--x-font-family-filter-default);
7586
+ font-size: var(--x-size-font-filter-default);
7587
+ font-weight: var(--x-number-font-weight-filter-default);
7588
+ line-height: var(--x-size-line-height-filter-default);
7589
+ cursor: pointer;
7590
+ }
7591
+ @media not all and (min-resolution: 0.001dpcm) {
7592
+ .x-filter {
7593
+ gap: 0;
7594
+ }
7595
+ .x-filter > *:not(:last-child) {
7596
+ margin-right: var(--x-size-gap-filter-default);
7597
+ }
7598
+ }
7599
+ .x-filter > * {
7600
+ flex: 0 0 auto;
7601
+ }
7602
+ .x-filter__label {
7603
+ flex: 0 1 auto;
7604
+ }
7605
+ .x-filter__count {
7606
+ font-weight: var(--x-number-font-weight-filter-count-default);
7607
+ }
7608
+ .x-filter--is-selected {
7609
+ --x-color-background-filter-default: var(--x-color-background-filter-default-selected);
7610
+ --x-color-border-filter-default: var(--x-color-border-filter-default-selected);
7611
+ --x-color-text-filter-default: var(--x-color-text-filter-default-selected);
7612
+ --x-number-font-weight-filter-default: var(--x-number-font-weight-filter-default-selected);
7613
+ --x-number-font-weight-filter-count-default: var(
7614
+ --x-number-font-weight-filter-count-default-selected
7615
+ );
7616
+ }
@@ -1,11 +1,15 @@
1
1
  <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
2
 
3
- [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [BaseIdModalClose](./x-components.baseidmodalclose.md) &gt; [events](./x-components.baseidmodalclose.events.md)
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [BaseIdModalClose](./x-components.baseidmodalclose.md) &gt; [emitCloseModalEvent](./x-components.baseidmodalclose.emitclosemodalevent.md)
4
4
 
5
- ## BaseIdModalClose.events property
5
+ ## BaseIdModalClose.emitCloseModalEvent() method
6
6
 
7
7
  <b>Signature:</b>
8
8
 
9
9
  ```typescript
10
- protected get events(): Partial<XEventsTypes>;
10
+ protected emitCloseModalEvent(): void;
11
11
  ```
12
+ <b>Returns:</b>
13
+
14
+ void
15
+
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## BaseIdModalClose class
6
6
 
7
- Component containing an event button that emits [XEventsTypes.UserClickedCloseModal](./x-components.xeventstypes.userclickedclosemodal.md) when clicked with the modalId as payload. It has a default slot to customize its contents.
7
+ Component that allows to close a modal by emitting [XEventsTypes.UserClickedCloseModal](./x-components.xeventstypes.userclickedclosemodal.md)<!-- -->. It's fully customizable as it exposes the closing event but by default it renders a customizable button.
8
8
 
9
9
  <b>Signature:</b>
10
10
 
@@ -17,6 +17,11 @@ export default class BaseIdModalClose extends Vue
17
17
 
18
18
  | Property | Modifiers | Type | Description |
19
19
  | --- | --- | --- | --- |
20
- | [events](./x-components.baseidmodalclose.events.md) | | Partial&lt;[XEventsTypes](./x-components.xeventstypes.md)<!-- -->&gt; | |
21
20
  | [modalId](./x-components.baseidmodalclose.modalid.md) | | string | |
22
21
 
22
+ ## Methods
23
+
24
+ | Method | Modifiers | Description |
25
+ | --- | --- | --- |
26
+ | [emitCloseModalEvent()](./x-components.baseidmodalclose.emitclosemodalevent.md) | | |
27
+
@@ -28,7 +28,7 @@ X-Components is a library usable everywhere not only for search experiences.
28
28
  | [BaseGrid](./x-components.basegrid.md) | Grid component that is able to render different items based on their modelName value. In order to achieve this, it exposes a scopedSlot for each different modelName. In case the items used do not have modelName property, the default slot is used instead. It has a required property: the <code>items</code> to render; and an optional one: the number <code>columns</code> the grid is divided in. If the number of columns is not specified, the grid automatically fills the rows with as many columns as it can fit. |
29
29
  | [BaseHeaderTogglePanel](./x-components.baseheadertogglepanel.md) | Toggle panel which uses the base toggle panel, adds a header and manage the open / close state of the panel. |
30
30
  | [BaseIdModal](./x-components.baseidmodal.md) | Component containing a modal expecting a required prop, named <code>modalId</code>. It reacts to <code>UserClickedOpenModal</code>, <code>UserClickedCloseModal</code> and <code>UserClickedOutOfModal</code> events, when their payload matches the component's 'modalId' prop, to handle its open/close state. The default slot offers the possibility to customise the modal content. |
31
- | [BaseIdModalClose](./x-components.baseidmodalclose.md) | Component containing an event button that emits [XEventsTypes.UserClickedCloseModal](./x-components.xeventstypes.userclickedclosemodal.md) when clicked with the modalId as payload. It has a default slot to customize its contents. |
31
+ | [BaseIdModalClose](./x-components.baseidmodalclose.md) | Component that allows to close a modal by emitting [XEventsTypes.UserClickedCloseModal](./x-components.xeventstypes.userclickedclosemodal.md)<!-- -->. It's fully customizable as it exposes the closing event but by default it renders a customizable button. |
32
32
  | [BaseIdModalOpen](./x-components.baseidmodalopen.md) | Component containing an event button that emits [XEventsTypes.UserClickedOpenModal](./x-components.xeventstypes.userclickedopenmodal.md) when clicked with the modalId as payload. It has a default slot to customize its contents. |
33
33
  | [BaseIdTogglePanel](./x-components.baseidtogglepanel.md) | Simple panel that could receives its initial open state via prop, if not the default is opens and a required prop, named <code>panelId</code>, which are responsible of rendering default slot inside a configurable transition.<!-- -->It reacts to <code>UserClickedPanelToggleButton</code> event, when their payload matches the component's 'panelId' prop, to handle its open/close state.<!-- -->The default slot offers the possibility to customise the modal content. |
34
34
  | [BaseIdTogglePanelButton](./x-components.baseidtogglepanelbutton.md) | Component containing an event button that emits [XEventsTypes.UserClickedPanelToggleButton](./x-components.xeventstypes.userclickedpaneltogglebutton.md) when clicked with the panelId as payload.<!-- -->It has a default slot to customize its contents. |
@@ -6,8 +6,9 @@ title: BaseIdModalClose
6
6
 
7
7
  # BaseIdModalClose
8
8
 
9
- Component containing an event button that emits {@link XEventsTypes.UserClickedCloseModal} when
10
- clicked with the modalId as payload. It has a default slot to customize its contents.
9
+ Component that allows to close a modal by emitting {@link XEventsTypes.UserClickedCloseModal}.
10
+ It's fully customizable as it exposes the closing event but by default it renders a
11
+ customizable button.
11
12
 
12
13
  ## Props
13
14
 
@@ -17,19 +18,21 @@ clicked with the modalId as payload. It has a default slot to customize its cont
17
18
 
18
19
  ## Slots
19
20
 
20
- | Name | Description | Bindings<br />(name - type - description) |
21
- | -------------------- | ------------------------------------------------------ | ----------------------------------------- |
22
- | <code>default</code> | (Required) Button content with a text, an icon or both | None |
21
+ | Name | Description | Bindings<br />(name - type - description) |
22
+ | ---------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
23
+ | <code>closing-element</code> | closing-element. It's the element that will trigger the modal closing. It's a | **closeModal** <code>Function</code> - The function to close the modal. |
24
+ | <code>default</code> | | None |
23
25
 
24
26
  ## Examples
25
27
 
26
28
  Component containing an event button that emits `UserClickedCloseModal` when clicked with the
27
- modalId as payload. It has a default slot to customize its contents.
29
+ modalId as payload. It has a default slot to customize its contents and can also be fully
30
+ customized, replacing the default button with any other element.
28
31
 
29
32
  ### Basic example
30
33
 
31
- The component renders whatever is passed to it in the default slot and closing the modal with
32
- modalId `my-modal`.
34
+ The component renders whatever is passed to it in the default slot inside the button and closes the
35
+ modal with modalId `my-modal`.
33
36
 
34
37
  ```vue
35
38
  <template>
@@ -50,6 +53,35 @@ export default {
50
53
  </script>
51
54
  ```
52
55
 
56
+ ### Replacing the default button
57
+
58
+ The component renders whatever element is passed, replacing the default button and exposing the
59
+ function to close the modal with modalId `my-modal`.
60
+
61
+ ```vue
62
+ <template>
63
+ <BaseIdModalClose modalId="my-modal">
64
+ <template #closing-element="{ closeModal }">
65
+ <ul>
66
+ <li @click="closeModal">Close here</li>
67
+ <li>Not here</li>
68
+ </ul>
69
+ </template>
70
+ </BaseIdModalClose>
71
+ </template>
72
+
73
+ <script>
74
+ import { BaseIdModalClose } from "@empathyco/x-components";
75
+
76
+ export default {
77
+ name: "BaseIdModalCloseTest",
78
+ components: {
79
+ BaseIdModalClose
80
+ }
81
+ };
82
+ </script>
83
+ ```
84
+
53
85
  ## Events
54
86
 
55
87
  A list of events that the component will emit:
@@ -10,15 +10,27 @@ var __vue_render__ = function () {
10
10
  var _h = _vm.$createElement;
11
11
  var _c = _vm._self._c || _h;
12
12
  return _c(
13
- "BaseEventButton",
14
- _vm._g(
15
- {
16
- staticClass: "x-button x-events-modal-id-close-button",
17
- attrs: { events: _vm.events, "data-test": "close-modal-id" },
18
- },
19
- _vm.$listeners
20
- ),
21
- [_vm._t("default")],
13
+ "NoElement",
14
+ _vm._g({ attrs: { "data-test": "close-modal-id" } }, _vm.$listeners),
15
+ [
16
+ _vm._t(
17
+ "closing-element",
18
+ function () {
19
+ return [
20
+ _c(
21
+ "button",
22
+ {
23
+ staticClass: "x-button x-events-modal-id-close-button",
24
+ on: { click: _vm.emitCloseModalEvent },
25
+ },
26
+ [_vm._t("default")],
27
+ 2
28
+ ),
29
+ ]
30
+ },
31
+ { closeModal: _vm.emitCloseModalEvent }
32
+ ),
33
+ ],
22
34
  2
23
35
  )
24
36
  };
@@ -1 +1 @@
1
- {"version":3,"file":"base-id-modal-close.vue.js","sources":["../../../../src/components/modals/base-id-modal-close.vue"],"sourcesContent":["<template>\n <BaseEventButton\n v-on=\"$listeners\"\n :events=\"events\"\n class=\"x-button x-events-modal-id-close-button\"\n data-test=\"close-modal-id\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { XEventsTypes } from '../../wiring/events.types';\n import BaseEventButton from '../base-event-button.vue';\n\n /**\n * Component containing an event button that emits {@link XEventsTypes.UserClickedCloseModal} when\n * clicked with the modalId as payload. It has a default slot to customize its contents.\n *\n * @public\n */\n @Component({\n components: { BaseEventButton }\n })\n export default class BaseIdModalClose extends Vue {\n @Prop({ required: true })\n protected modalId!: string;\n\n protected get events(): Partial<XEventsTypes> {\n return { UserClickedCloseModal: this.modalId };\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nComponent containing an event button that emits `UserClickedCloseModal` when clicked with the\nmodalId as payload. It has a default slot to customize its contents.\n\n### Basic example\n\nThe component renders whatever is passed to it in the default slot and closing the modal with\nmodalId `my-modal`.\n\n```vue\n<template>\n <BaseIdModalClose modalId=\"my-modal\">\n <img src=\"./close-button-icon.svg\" />\n </BaseIdModalClose>\n</template>\n\n<script>\n import { BaseIdModalClose } from '@empathyco/x-components';\n\n export default {\n name: 'BaseIdModalCloseTest',\n components: {\n BaseIdModalClose\n }\n };\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserClickedCloseModal`: the event is emitted after the user clicks the button. The event payload\n is the id of the modal that is going to be closed.\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"base-id-modal-close.vue.js","sources":["../../../../src/components/modals/base-id-modal-close.vue"],"sourcesContent":["<template>\n <NoElement v-on=\"$listeners\" data-test=\"close-modal-id\">\n <!--\n @slot closing-element. It's the element that will trigger the modal closing. It's a\n button by default.\n @binding {Function} closeModal - The function to close the modal.\n -->\n <slot :closeModal=\"emitCloseModalEvent\" name=\"closing-element\">\n <button @click=\"emitCloseModalEvent\" class=\"x-button x-events-modal-id-close-button\">\n <slot />\n </button>\n </slot>\n </NoElement>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import BaseEventButton from '../base-event-button.vue';\n import { NoElement } from '../no-element';\n\n /**\n * Component that allows to close a modal by emitting {@link XEventsTypes.UserClickedCloseModal}.\n * It's fully customizable as it exposes the closing event but by default it renders a\n * customizable button.\n *\n * @public\n */\n @Component({\n components: { BaseEventButton, NoElement }\n })\n export default class BaseIdModalClose extends Vue {\n @Prop({ required: true })\n protected modalId!: string;\n\n protected emitCloseModalEvent(): void {\n this.$x.emit('UserClickedCloseModal', this.modalId, { target: this.$el as HTMLElement });\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nComponent containing an event button that emits `UserClickedCloseModal` when clicked with the\nmodalId as payload. It has a default slot to customize its contents and can also be fully\ncustomized, replacing the default button with any other element.\n\n### Basic example\n\nThe component renders whatever is passed to it in the default slot inside the button and closes the\nmodal with modalId `my-modal`.\n\n```vue\n<template>\n <BaseIdModalClose modalId=\"my-modal\">\n <img src=\"./close-button-icon.svg\" />\n </BaseIdModalClose>\n</template>\n\n<script>\n import { BaseIdModalClose } from '@empathyco/x-components';\n\n export default {\n name: 'BaseIdModalCloseTest',\n components: {\n BaseIdModalClose\n }\n };\n</script>\n```\n\n### Replacing the default button\n\nThe component renders whatever element is passed, replacing the default button and exposing the\nfunction to close the modal with modalId `my-modal`.\n\n```vue\n<template>\n <BaseIdModalClose modalId=\"my-modal\">\n <template #closing-element=\"{ closeModal }\">\n <ul>\n <li @click=\"closeModal\">Close here</li>\n <li>Not here</li>\n </ul>\n </template>\n </BaseIdModalClose>\n</template>\n\n<script>\n import { BaseIdModalClose } from '@empathyco/x-components';\n\n export default {\n name: 'BaseIdModalCloseTest',\n components: {\n BaseIdModalClose\n }\n };\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserClickedCloseModal`: the event is emitted after the user clicks the button. The event payload\n is the id of the modal that is going to be closed.\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,16 +2,18 @@ import { __decorate } from 'tslib';
2
2
  import Vue from 'vue';
3
3
  import { Prop, Component } from 'vue-property-decorator';
4
4
  import __vue_component__ from '../base-event-button.vue.js';
5
+ import { NoElement } from '../no-element.js';
5
6
 
6
7
  /**
7
- * Component containing an event button that emits {@link XEventsTypes.UserClickedCloseModal} when
8
- * clicked with the modalId as payload. It has a default slot to customize its contents.
8
+ * Component that allows to close a modal by emitting {@link XEventsTypes.UserClickedCloseModal}.
9
+ * It's fully customizable as it exposes the closing event but by default it renders a
10
+ * customizable button.
9
11
  *
10
12
  * @public
11
13
  */
12
14
  let BaseIdModalClose = class BaseIdModalClose extends Vue {
13
- get events() {
14
- return { UserClickedCloseModal: this.modalId };
15
+ emitCloseModalEvent() {
16
+ this.$x.emit('UserClickedCloseModal', this.modalId, { target: this.$el });
15
17
  }
16
18
  };
17
19
  __decorate([
@@ -19,7 +21,7 @@ __decorate([
19
21
  ], BaseIdModalClose.prototype, "modalId", void 0);
20
22
  BaseIdModalClose = __decorate([
21
23
  Component({
22
- components: { BaseEventButton: __vue_component__ }
24
+ components: { BaseEventButton: __vue_component__, NoElement }
23
25
  })
24
26
  ], BaseIdModalClose);
25
27
  var script = BaseIdModalClose;
@@ -1 +1 @@
1
- {"version":3,"file":"base-id-modal-close.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/modals/base-id-modal-close.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { XEventsTypes } from '../../wiring/events.types';\nimport BaseEventButton from '../base-event-button.vue';\n\n/**\n * Component containing an event button that emits {@link XEventsTypes.UserClickedCloseModal} when\n * clicked with the modalId as payload. It has a default slot to customize its contents.\n *\n * @public\n */\n@Component({\n components: { BaseEventButton }\n})\nexport default class BaseIdModalClose extends Vue {\n @Prop({ required: true })\n protected modalId!: string;\n\n protected get events(): Partial<XEventsTypes> {\n return { UserClickedCloseModal: this.modalId };\n }\n}\n"],"names":["BaseEventButton"],"mappings":";;;;;AAkBA;;;;;;AASA,IAAqB,gBAAgB,GAArC,MAAqB,gBAAiB,SAAQ,GAAG;IAI/C,IAAc,MAAM;QAClB,OAAO,EAAE,qBAAqB,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;KAChD;CACF,CAAA;AALC;IADC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;iDACE;AAFR,gBAAgB;IAHpC,SAAS,CAAC;QACT,UAAU,EAAE,mBAAEA,iBAAe,EAAE;KAChC,CAAC;GACmB,gBAAgB,CAOpC;aAPoB,gBAAgB;;;;"}
1
+ {"version":3,"file":"base-id-modal-close.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/modals/base-id-modal-close.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport BaseEventButton from '../base-event-button.vue';\nimport { NoElement } from '../no-element';\n\n/**\n * Component that allows to close a modal by emitting {@link XEventsTypes.UserClickedCloseModal}.\n * It's fully customizable as it exposes the closing event but by default it renders a\n * customizable button.\n *\n * @public\n */\n@Component({\n components: { BaseEventButton, NoElement }\n})\nexport default class BaseIdModalClose extends Vue {\n @Prop({ required: true })\n protected modalId!: string;\n\n protected emitCloseModalEvent(): void {\n this.$x.emit('UserClickedCloseModal', this.modalId, { target: this.$el as HTMLElement });\n }\n}\n"],"names":["BaseEventButton"],"mappings":";;;;;;AAqBA;;;;;;;AAUA,IAAqB,gBAAgB,GAArC,MAAqB,gBAAiB,SAAQ,GAAG;IAIrC,mBAAmB;QAC3B,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,GAAkB,EAAE,CAAC,CAAC;KAC1F;CACF,CAAA;AALC;IADC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;iDACE;AAFR,gBAAgB;IAHpC,SAAS,CAAC;QACT,UAAU,EAAE,mBAAEA,iBAAe,EAAE,SAAS,EAAE;KAC3C,CAAC;GACmB,gBAAgB,CAOpC;aAPoB,gBAAgB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empathyco/x-components",
3
- "version": "3.0.0-alpha.142",
3
+ "version": "3.0.0-alpha.143",
4
4
  "description": "Empathy X Components",
5
5
  "author": "Empathy Systems Corporation S.L.",
6
6
  "license": "Apache-2.0",
@@ -125,5 +125,5 @@
125
125
  "access": "public",
126
126
  "directory": "dist"
127
127
  },
128
- "gitHead": "e9cc9a0b4467dfef61680a9f7214d01cfea3986b"
128
+ "gitHead": "0a4ffde06d515171513348ccfafbafbffcd8fb11"
129
129
  }
@@ -3702,7 +3702,7 @@
3702
3702
  {
3703
3703
  "kind": "Class",
3704
3704
  "canonicalReference": "@empathyco/x-components!BaseIdModalClose:class",
3705
- "docComment": "/**\n * Component containing an event button that emits {@link XEventsTypes.UserClickedCloseModal} when clicked with the modalId as payload. It has a default slot to customize its contents.\n *\n * @public\n */\n",
3705
+ "docComment": "/**\n * Component that allows to close a modal by emitting {@link XEventsTypes.UserClickedCloseModal}. It's fully customizable as it exposes the closing event but by default it renders a customizable button.\n *\n * @public\n */\n",
3706
3706
  "excerptTokens": [
3707
3707
  {
3708
3708
  "kind": "Content",
@@ -3722,31 +3722,17 @@
3722
3722
  "name": "BaseIdModalClose",
3723
3723
  "members": [
3724
3724
  {
3725
- "kind": "Property",
3726
- "canonicalReference": "@empathyco/x-components!BaseIdModalClose#events:member",
3725
+ "kind": "Method",
3726
+ "canonicalReference": "@empathyco/x-components!BaseIdModalClose#emitCloseModalEvent:member(1)",
3727
3727
  "docComment": "",
3728
3728
  "excerptTokens": [
3729
3729
  {
3730
3730
  "kind": "Content",
3731
- "text": "protected get events(): "
3732
- },
3733
- {
3734
- "kind": "Reference",
3735
- "text": "Partial",
3736
- "canonicalReference": "!Partial:type"
3737
- },
3738
- {
3739
- "kind": "Content",
3740
- "text": "<"
3741
- },
3742
- {
3743
- "kind": "Reference",
3744
- "text": "XEventsTypes",
3745
- "canonicalReference": "@empathyco/x-components!XEventsTypes:interface"
3731
+ "text": "protected emitCloseModalEvent(): "
3746
3732
  },
3747
3733
  {
3748
3734
  "kind": "Content",
3749
- "text": ">"
3735
+ "text": "void"
3750
3736
  },
3751
3737
  {
3752
3738
  "kind": "Content",
@@ -3754,13 +3740,15 @@
3754
3740
  }
3755
3741
  ],
3756
3742
  "isOptional": false,
3757
- "releaseTag": "Public",
3758
- "name": "events",
3759
- "propertyTypeTokenRange": {
3743
+ "isStatic": false,
3744
+ "returnTypeTokenRange": {
3760
3745
  "startIndex": 1,
3761
- "endIndex": 5
3746
+ "endIndex": 2
3762
3747
  },
3763
- "isStatic": false
3748
+ "releaseTag": "Public",
3749
+ "overloadIndex": 1,
3750
+ "parameters": [],
3751
+ "name": "emitCloseModalEvent"
3764
3752
  },
3765
3753
  {
3766
3754
  "kind": "Property",
@@ -385,7 +385,7 @@ export class BaseIdModal extends Vue_2 {
385
385
  // @public
386
386
  export class BaseIdModalClose extends Vue_2 {
387
387
  // (undocumented)
388
- protected get events(): Partial<XEventsTypes>;
388
+ protected emitCloseModalEvent(): void;
389
389
  // (undocumented)
390
390
  protected modalId: string;
391
391
  }
@@ -1,13 +1,13 @@
1
1
  import Vue from 'vue';
2
- import { XEventsTypes } from '../../wiring/events.types';
3
2
  /**
4
- * Component containing an event button that emits {@link XEventsTypes.UserClickedCloseModal} when
5
- * clicked with the modalId as payload. It has a default slot to customize its contents.
3
+ * Component that allows to close a modal by emitting {@link XEventsTypes.UserClickedCloseModal}.
4
+ * It's fully customizable as it exposes the closing event but by default it renders a
5
+ * customizable button.
6
6
  *
7
7
  * @public
8
8
  */
9
9
  export default class BaseIdModalClose extends Vue {
10
10
  protected modalId: string;
11
- protected get events(): Partial<XEventsTypes>;
11
+ protected emitCloseModalEvent(): void;
12
12
  }
13
13
  //# sourceMappingURL=base-id-modal-close.vue?rollup-plugin-vue=script.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-id-modal-close.vue?rollup-plugin-vue=script.d.ts","sourceRoot":"","sources":["../../../../src/components/modals/base-id-modal-close.vue?rollup-plugin-vue=script.ts"],"names":[],"mappings":"AAaA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD;;;;;GAKG;AAIH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,GAAG;IAE/C,SAAS,CAAC,OAAO,EAAG,MAAM,CAAC;IAE3B,SAAS,KAAK,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC,CAE5C;CACF"}
1
+ {"version":3,"file":"base-id-modal-close.vue?rollup-plugin-vue=script.d.ts","sourceRoot":"","sources":["../../../../src/components/modals/base-id-modal-close.vue?rollup-plugin-vue=script.ts"],"names":[],"mappings":"AAgBA,OAAO,GAAG,MAAM,KAAK,CAAC;AAKtB;;;;;;GAMG;AAIH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,GAAG;IAE/C,SAAS,CAAC,OAAO,EAAG,MAAM,CAAC;IAE3B,SAAS,CAAC,mBAAmB,IAAI,IAAI;CAGtC"}