@empathyco/x-components 5.0.0-alpha.21 → 5.0.0-alpha.23

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 (59) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/design-system/deprecated-full-theme.css +634 -634
  3. package/docs/API-reference/api/x-components.basemodal.md +51 -25
  4. package/docs/API-reference/api/x-components.basevariablecolumngrid.md +30 -11
  5. package/docs/API-reference/api/x-components.md +3 -3
  6. package/docs/API-reference/api/x-components.slidingpanel.md +46 -12
  7. package/docs/API-reference/components/common/modals/x-components.base-modal.md +9 -7
  8. package/docs/API-reference/components/common/x-components.base-variable-column-grid.md +5 -5
  9. package/docs/API-reference/components/common/x-components.sliding-panel.md +2 -0
  10. package/js/components/animations/fade.vue.js +1 -1
  11. package/js/components/animations/fade.vue.js.map +1 -1
  12. package/js/components/animations/fade.vue3.js +1 -1
  13. package/js/components/base-variable-column-grid.vue.js +1 -1
  14. package/js/components/base-variable-column-grid.vue.js.map +1 -1
  15. package/js/components/base-variable-column-grid.vue2.js +63 -49
  16. package/js/components/base-variable-column-grid.vue2.js.map +1 -1
  17. package/js/components/dynamic-props.mixin.js +1 -1
  18. package/js/components/dynamic-props.mixin.js.map +1 -1
  19. package/js/components/modals/base-modal.vue.js +3 -3
  20. package/js/components/modals/base-modal.vue.js.map +1 -1
  21. package/js/components/modals/base-modal.vue2.js +160 -166
  22. package/js/components/modals/base-modal.vue2.js.map +1 -1
  23. package/js/components/modals/base-modal.vue3.js +1 -1
  24. package/js/components/sliding-panel.vue.js +6 -6
  25. package/js/components/sliding-panel.vue.js.map +1 -1
  26. package/js/components/sliding-panel.vue2.js +112 -136
  27. package/js/components/sliding-panel.vue2.js.map +1 -1
  28. package/js/components/sliding-panel.vue3.js +1 -1
  29. package/js/x-modules/facets/components/lists/sliced-filters.vue.js.map +1 -1
  30. package/js/x-modules/facets/components/lists/sliced-filters.vue2.js +1 -7
  31. package/js/x-modules/facets/components/lists/sliced-filters.vue2.js.map +1 -1
  32. package/package.json +2 -2
  33. package/report/x-components.api.json +2339 -1293
  34. package/report/x-components.api.md +124 -81
  35. package/types/components/base-variable-column-grid.vue.d.ts +38 -17
  36. package/types/components/base-variable-column-grid.vue.d.ts.map +1 -1
  37. package/types/components/dynamic-props.mixin.d.ts +1 -1
  38. package/types/components/modals/base-modal.vue.d.ts +68 -97
  39. package/types/components/modals/base-modal.vue.d.ts.map +1 -1
  40. package/types/components/sliding-panel.vue.d.ts +50 -87
  41. package/types/components/sliding-panel.vue.d.ts.map +1 -1
  42. package/types/x-modules/facets/components/lists/sliced-filters.vue.d.ts +2 -14
  43. package/types/x-modules/facets/components/lists/sliced-filters.vue.d.ts.map +1 -1
  44. package/docs/API-reference/api/x-components.basemodal._refs.md +0 -14
  45. package/docs/API-reference/api/x-components.basemodal.animation.md +0 -13
  46. package/docs/API-reference/api/x-components.basemodal.focusonopen.md +0 -13
  47. package/docs/API-reference/api/x-components.basemodal.iswaitingforleave.md +0 -13
  48. package/docs/API-reference/api/x-components.basemodal.mounted.md +0 -15
  49. package/docs/API-reference/api/x-components.basemodal.open.md +0 -13
  50. package/docs/API-reference/api/x-components.basemodal.overlayanimation.md +0 -13
  51. package/docs/API-reference/api/x-components.basemodal.previousbodyoverflow.md +0 -13
  52. package/docs/API-reference/api/x-components.basemodal.previoushtmloverflow.md +0 -13
  53. package/docs/API-reference/api/x-components.basemodal.referenceelement.md +0 -13
  54. package/docs/API-reference/api/x-components.basemodal.referenceselector.md +0 -13
  55. package/docs/API-reference/api/x-components.basevariablecolumngrid.animation.md +0 -13
  56. package/docs/API-reference/api/x-components.basevariablecolumngrid.items.md +0 -18
  57. package/docs/API-reference/api/x-components.slidingpanel.resetoncontentchange.md +0 -13
  58. package/docs/API-reference/api/x-components.slidingpanel.scrollfactor.md +0 -13
  59. package/docs/API-reference/api/x-components.slidingpanel.showbuttons.md +0 -13
@@ -2,35 +2,61 @@
2
2
 
3
3
  [Home](./index.md) > [@empathyco/x-components](./x-components.md) > [BaseModal](./x-components.basemodal.md)
4
4
 
5
- ## BaseModal class
5
+ ## BaseModal variable
6
6
 
7
7
  Base component with no XPlugin dependencies that serves as a utility for constructing more complex modals.
8
8
 
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- export default class BaseModal extends BaseModal_base
12
+ _default: import("vue").DefineComponent<{
13
+ open: {
14
+ type: BooleanConstructor;
15
+ required: true;
16
+ };
17
+ focusOnOpen: {
18
+ type: BooleanConstructor;
19
+ default: boolean;
20
+ };
21
+ referenceSelector: StringConstructor;
22
+ animation: {
23
+ type: PropType<string | import("vue").VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>>>;
24
+ default: () => import("vue").DefineComponent<{}, () => import("vue").VNode | import("vue").VNode[], {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
25
+ };
26
+ overlayAnimation: {
27
+ type: PropType<string | import("vue").VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>>>;
28
+ default: () => import("vue").VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>>;
29
+ };
30
+ contentClass: StringConstructor;
31
+ overlayClass: StringConstructor;
32
+ }, {
33
+ emitOverlayClicked: (event: MouseEvent) => void;
34
+ isWaitingForLeave: import("vue").Ref<boolean>;
35
+ modalContentRef: import("vue").Ref<HTMLDivElement | undefined>;
36
+ modalRef: import("vue").Ref<HTMLDivElement | undefined>;
37
+ }, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, ("click:overlay" | "focusin:body")[], string, Readonly<import("vue").ExtractPropTypes<{
38
+ open: {
39
+ type: BooleanConstructor;
40
+ required: true;
41
+ };
42
+ focusOnOpen: {
43
+ type: BooleanConstructor;
44
+ default: boolean;
45
+ };
46
+ referenceSelector: StringConstructor;
47
+ animation: {
48
+ type: PropType<string | import("vue").VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>>>;
49
+ default: () => import("vue").DefineComponent<{}, () => import("vue").VNode | import("vue").VNode[], {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
50
+ };
51
+ overlayAnimation: {
52
+ type: PropType<string | import("vue").VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>>>;
53
+ default: () => import("vue").VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>>;
54
+ };
55
+ contentClass: StringConstructor;
56
+ overlayClass: StringConstructor;
57
+ }>>, {
58
+ focusOnOpen: boolean;
59
+ animation: string | import("vue").VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>>;
60
+ overlayAnimation: string | import("vue").VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>>;
61
+ }>
13
62
  ```
14
- **Extends:** BaseModal\_base
15
-
16
- ## Properties
17
-
18
- | Property | Modifiers | Type | Description |
19
- | --- | --- | --- | --- |
20
- | [$refs](./x-components.basemodal._refs.md) | | { modal: HTMLDivElement; modalContent: HTMLDivElement; } | |
21
- | [animation](./x-components.basemodal.animation.md) | | Vue \| string | Animation to use for opening/closing the modal. This animation only affects the content. |
22
- | [focusOnOpen](./x-components.basemodal.focusonopen.md) | | boolean | Determines if the focused element changes to one inside the modal when it opens. Either the first element with a positive tabindex or just the first focusable element. |
23
- | [isWaitingForLeave](./x-components.basemodal.iswaitingforleave.md) | <code>protected</code> | boolean | Boolean to delay the leave animation until it has completed. |
24
- | [open](./x-components.basemodal.open.md) | | boolean | Determines if the modal is open or not. |
25
- | [overlayAnimation](./x-components.basemodal.overlayanimation.md) | | Vue \| string | Animation to use for the overlay (backdrop) part of the modal. By default, it uses a fade transition. |
26
- | [previousBodyOverflow](./x-components.basemodal.previousbodyoverflow.md) | <code>protected</code> | string | The previous value of the body overflow style. |
27
- | [previousHTMLOverflow](./x-components.basemodal.previoushtmloverflow.md) | <code>protected</code> | string | The previous value of the HTML element overflow style. |
28
- | [referenceElement](./x-components.basemodal.referenceelement.md) | <code>protected</code> | HTMLElement | The reference element to use to find the modal's position. |
29
- | [referenceSelector?](./x-components.basemodal.referenceselector.md) | | string | _(Optional)_ The reference selector of a DOM element to use as reference to position the modal. This selector can be an ID or a class, if it is a class, it will use the first element that matches. |
30
-
31
- ## Methods
32
-
33
- | Method | Modifiers | Description |
34
- | --- | --- | --- |
35
- | [mounted()](./x-components.basemodal.mounted.md) | <code>protected</code> | |
36
-
@@ -2,21 +2,40 @@
2
2
 
3
3
  [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [BaseVariableColumnGrid](./x-components.basevariablecolumngrid.md)
4
4
 
5
- ## BaseVariableColumnGrid class
5
+ ## BaseVariableColumnGrid variable
6
6
 
7
7
  The `BaseVariableColumnGrid` component is a wrapper of the `BaseGrid` component that listens to the `UserClickedColumnPicker` and the `ColumnsNumberProvided` events and passes the selected number of columns to the grid. It also allows to customize the grid items using the available `scopedSlots`<!-- -->.
8
8
 
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- export default class BaseVariableColumnGrid extends Vue
12
+ _default: import("vue").DefineComponent<{
13
+ animation: {
14
+ type: PropType<string | import("vue").DefineComponent<{}, {}, {}, import("vue").ComponentComputedOptions, import("vue").ComponentMethodOptions, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>>;
15
+ default: string;
16
+ };
17
+ items: PropType<ListItem[]>;
18
+ columns: {
19
+ type: NumberConstructor;
20
+ default: number;
21
+ };
22
+ }, {
23
+ columnsToRender: import("vue").ComputedRef<number>;
24
+ slots: import("vue/types/v3-setup-context").Slots;
25
+ }, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{
26
+ animation: {
27
+ type: PropType<string | import("vue").DefineComponent<{}, {}, {}, import("vue").ComponentComputedOptions, import("vue").ComponentMethodOptions, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>>;
28
+ default: string;
29
+ };
30
+ items: PropType<ListItem[]>;
31
+ columns: {
32
+ type: NumberConstructor;
33
+ default: number;
34
+ };
35
+ }>>, {
36
+ animation: string | import("vue").DefineComponent<{}, {}, {}, import("vue").ComponentComputedOptions, import("vue").ComponentMethodOptions, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}> | (import("vue/types/v3-component-public-instance").ComponentPublicInstanceConstructor<import("vue/types/v3-component-public-instance").Vue3Instance<{}, Readonly<import("vue").ExtractPropTypes<{}>>, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, true, import("vue/types/v3-component-options").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any>> & Readonly<Readonly<import("vue").ExtractPropTypes<{}>>> & import("vue").ShallowUnwrapRef<{}> & import("vue/types/v3-component-options").ExtractComputedReturns<import("vue").ComponentComputedOptions> & import("vue").ComponentMethodOptions & import("vue").ComponentCustomProperties & Readonly<import("vue").ExtractPropTypes<{}>>, any, any, any, import("vue").ComponentComputedOptions, import("vue").ComponentMethodOptions> & import("vue/types/v3-component-options").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, import("vue").ComponentComputedOptions, import("vue").ComponentMethodOptions, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, {}> & {
37
+ props: {};
38
+ });
39
+ columns: number;
40
+ }>
13
41
  ```
14
- **Extends:** Vue
15
-
16
- ## Properties
17
-
18
- | Property | Modifiers | Type | Description |
19
- | --- | --- | --- | --- |
20
- | [animation](./x-components.basevariablecolumngrid.animation.md) | <code>protected</code> | Vue \| string | Animation component that will be used to animate the grid. |
21
- | [items?](./x-components.basevariablecolumngrid.items.md) | <code>protected</code> | [ListItem](./x-components.listitem.md)<!-- -->\[\] | _(Optional)_ The list of items to be rendered. |
22
-
@@ -19,10 +19,8 @@ X-Components is a library usable everywhere not only for search experiences.
19
19
  | [BaseIdTogglePanel](./x-components.baseidtogglepanel.md) | <p>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.</p><p>It reacts to <code>UserClickedPanelToggleButton</code> event, when their payload matches the component's 'panelId' prop, to handle its open/close state.</p><p>The default slot offers the possibility to customise the modal content.</p> |
20
20
  | [BaseIdTogglePanelButton](./x-components.baseidtogglepanelbutton.md) | <p>Component containing an event button that emits [XEventsTypes.UserClickedPanelToggleButton](./x-components.xeventstypes.userclickedpaneltogglebutton.md) when clicked with the panelId as payload.</p><p>It has a default slot to customize its contents.</p> |
21
21
  | [BaseKeyboardNavigation](./x-components.basekeyboardnavigation.md) | Base component to handle keyboard navigation for elements inside it. It has a required slot to include the navigable elements. |
22
- | [BaseModal](./x-components.basemodal.md) | Base component with no XPlugin dependencies that serves as a utility for constructing more complex modals. |
23
22
  | [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. |
24
23
  | [BaseTabsPanel](./x-components.basetabspanel.md) | Base Tabs Panel. |
25
- | [BaseVariableColumnGrid](./x-components.basevariablecolumngrid.md) | The <code>BaseVariableColumnGrid</code> component is a wrapper of the <code>BaseGrid</code> component that listens to the <code>UserClickedColumnPicker</code> and the <code>ColumnsNumberProvided</code> events and passes the selected number of columns to the grid. It also allows to customize the grid items using the available <code>scopedSlots</code>. |
26
24
  | [BaseXAPI](./x-components.basexapi.md) | Default implementation for [XAPI](./x-components.xapi.md)<!-- -->. |
27
25
  | [ClearHistoryQueries](./x-components.clearhistoryqueries.md) | A button that when is pressed, emits the [HistoryQueriesXEvents.UserPressedClearHistoryQueries](./x-components.historyqueriesxevents.userpressedclearhistoryqueries.md) event, expressing the user intention to clear the whole history of queries. |
28
26
  | [DefaultFacetsService](./x-components.defaultfacetsservice.md) | Default implementation for the [FacetsService](./x-components.facetsservice.md)<!-- -->. |
@@ -70,7 +68,6 @@ X-Components is a library usable everywhere not only for search experiences.
70
68
  | [SemanticQueries](./x-components.semanticqueries.md) | Retrieves a list of semantic queries from the state and exposes them in the slots. |
71
69
  | [SemanticQuery](./x-components.semanticquery.md) | This component renders a semantic query. A semantic query is a recommended query that is similar in its meaning to another one. It contains the query and the distance, which indicates how similar the query is compared to the searched query. |
72
70
  | [SimpleFilter](./x-components.simplefilter.md) | Renders a simple filter, emitting the needed events when clicked. |
73
- | [SlidingPanel](./x-components.slidingpanel.md) | <p>This component allows for any other component or element inside it to be horizontally navigable. It also implements customizable buttons as well as other minor customizations to its general behavior.</p><p>Additionally, this component exposes the following props to modify the classes of the elements: <code>buttonClass</code>.</p> |
74
71
  | [SnippetConfigExtraParams](./x-components.snippetconfigextraparams.md) | Extracts the extra parameters from the [SnippetConfig](./x-components.snippetconfig.md) and syncs it with the request objects of every x-module. |
75
72
  | [Spellcheck](./x-components.spellcheck.md) | <p>The <code>Spellcheck</code> component allows to inform the user with a friendly message that he might have misspelled the search query. This message can be set using the default slot of the component, which gives access to the searched query using the <code>query</code> scope property, and the spellchecked query proposal, using the <code>spellcheckedQuery</code> scope property.</p><p>The component will only render itself if the <code>spellcheckedQuery</code> property has value.</p> |
76
73
  | [SpellcheckButton](./x-components.spellcheckbutton.md) | A button that when pressed emits the [XEventsTypes.UserAcceptedAQuery](./x-components.xeventstypes.useracceptedaquery.md) and [XEventsTypes.UserAcceptedSpellcheckQuery](./x-components.xeventstypes.useracceptedspellcheckquery.md) events, expressing the user intention to set the spellchecked query. |
@@ -371,6 +368,7 @@ X-Components is a library usable everywhere not only for search experiences.
371
368
  | [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. |
372
369
  | [BaseIdModalClose](./x-components.baseidmodalclose.md) | Component that allows to close a modal by emitting [XEventsTypes.UserClickedCloseModal](./x-components.xeventstypes.userclickedclosemodal.md)<!-- -->. It allows full customization with the 'closing-element' slot and exposes the 'closeModal' function. |
373
370
  | [BaseIdModalOpen](./x-components.baseidmodalopen.md) | Component that allows to open a modal by emitting [XEventsTypes.UserClickedOpenModal](./x-components.xeventstypes.userclickedopenmodal.md) with the modalId as payload. It allows full customization with the 'opening-element' slot and exposes the 'openModal' function. |
371
+ | [BaseModal](./x-components.basemodal.md) | Base component with no XPlugin dependencies that serves as a utility for constructing more complex modals. |
374
372
  | [BasePlaceholderImage](./x-components.baseplaceholderimage.md) | |
375
373
  | [BasePriceFilterLabel](./x-components.basepricefilterlabel.md) | Renders a label for a price filter, allowing to select different messages depending on the value of the filter. |
376
374
  | [BaseRating](./x-components.baserating.md) | Rating component. This component renders a set of elements filled based on the value passed as prop. |
@@ -384,6 +382,7 @@ X-Components is a library usable everywhere not only for search experiences.
384
382
  | [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 [XEvent](./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> |
385
383
  | [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. |
386
384
  | [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. |
385
+ | [BaseVariableColumnGrid](./x-components.basevariablecolumngrid.md) | The <code>BaseVariableColumnGrid</code> component is a wrapper of the <code>BaseGrid</code> component that listens to the <code>UserClickedColumnPicker</code> and the <code>ColumnsNumberProvided</code> events and passes the selected number of columns to the grid. It also allows to customize the grid items using the available <code>scopedSlots</code>. |
387
386
  | [bus](./x-components.bus.md) | Default implementation. |
388
387
  | [cancelFetchAndSaveControls](./x-components.cancelfetchandsavecontrols.md) | Default implementation for fetchAndSaveExperienceControls action. |
389
388
  | [cancelFetchAndSaveIdentifierResults](./x-components.cancelfetchandsaveidentifierresults.md) | Default implementation for [IdentifierResultsActions.cancelFetchAndSaveIdentifierResults()](./x-components.identifierresultsactions.cancelfetchandsaveidentifierresults.md) action. |
@@ -670,6 +669,7 @@ X-Components is a library usable everywhere not only for search experiences.
670
669
  | [ShowIcon](./x-components.showicon.md) | |
671
670
  | [SingleColumnLayout](./x-components.singlecolumnlayout.md) | Component for use as Layout to be filled with the rest of the Components. |
672
671
  | [SlicedFilters](./x-components.slicedfilters.md) | Component that slices a list of filters and returns them using the default scoped slot, allowing the user to show the full list of them or slicing them again using the show more/less buttons. |
672
+ | [SlidingPanel](./x-components.slidingpanel.md) | <p>This component allows for any other component or element inside it to be horizontally navigable. It also implements customizable buttons as well as other minor customizations to its general behavior.</p><p>Additionally, this component exposes the following props to modify the classes of the elements: <code>buttonClass</code>.</p> |
673
673
  | [SnippetCallbacks](./x-components.snippetcallbacks.md) | This component subscribes to any [XEvent](./x-components.xevent.md) with a custom callbacks provided by the snippet configuration. |
674
674
  | [SortAZIcon](./x-components.sortazicon.md) | |
675
675
  | [SortDropdown](./x-components.sortdropdown.md) | The <code>SortDropdown</code> component allows user to select the search results order. This component also allows to change the selected sort programmatically. |
@@ -2,7 +2,7 @@
2
2
 
3
3
  [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [SlidingPanel](./x-components.slidingpanel.md)
4
4
 
5
- ## SlidingPanel class
5
+ ## SlidingPanel variable
6
6
 
7
7
  This component allows for any other component or element inside it to be horizontally navigable. It also implements customizable buttons as well as other minor customizations to its general behavior.
8
8
 
@@ -11,15 +11,49 @@ Additionally, this component exposes the following props to modify the classes o
11
11
  **Signature:**
12
12
 
13
13
  ```typescript
14
- export default class SlidingPanel extends SlidingPanel_base
14
+ _default: import("vue").DefineComponent<{
15
+ scrollFactor: {
16
+ type: NumberConstructor;
17
+ default: number;
18
+ };
19
+ showButtons: {
20
+ type: BooleanConstructor;
21
+ default: boolean;
22
+ };
23
+ resetOnContentChange: {
24
+ type: BooleanConstructor;
25
+ default: boolean;
26
+ };
27
+ buttonClass: StringConstructor;
28
+ scrollContainerClass: StringConstructor;
29
+ }, {
30
+ cssClasses: import("vue").ComputedRef<{
31
+ 'x-sliding-panel-at-start': boolean;
32
+ 'x-sliding-panel-at-end': boolean;
33
+ }>;
34
+ debouncedUpdateScroll: import("..").DebouncedFunction<[]>;
35
+ scrollContainerRef: import("vue").Ref<HTMLDivElement | undefined>;
36
+ scrollLeft: () => void;
37
+ scrollRight: () => void;
38
+ slots: import("vue/types/v3-setup-context").Slots;
39
+ }, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{
40
+ scrollFactor: {
41
+ type: NumberConstructor;
42
+ default: number;
43
+ };
44
+ showButtons: {
45
+ type: BooleanConstructor;
46
+ default: boolean;
47
+ };
48
+ resetOnContentChange: {
49
+ type: BooleanConstructor;
50
+ default: boolean;
51
+ };
52
+ buttonClass: StringConstructor;
53
+ scrollContainerClass: StringConstructor;
54
+ }>>, {
55
+ scrollFactor: number;
56
+ showButtons: boolean;
57
+ resetOnContentChange: boolean;
58
+ }>
15
59
  ```
16
- **Extends:** SlidingPanel\_base
17
-
18
- ## Properties
19
-
20
- | Property | Modifiers | Type | Description |
21
- | --- | --- | --- | --- |
22
- | [resetOnContentChange](./x-components.slidingpanel.resetoncontentchange.md) | | boolean | When true, whenever the DOM content in the sliding panel slot changes, it will reset the scroll position to 0. |
23
- | [scrollFactor](./x-components.slidingpanel.scrollfactor.md) | | number | Scroll factor that will dictate how much the scroll moves when pressing a navigation button. |
24
- | [showButtons](./x-components.slidingpanel.showbuttons.md) | | boolean | Would make the navigation buttons visible when they're needed or always hide them. |
25
-
@@ -11,13 +11,15 @@ modals.
11
11
 
12
12
  ## Props
13
13
 
14
- | Name | Description | Type | Default |
15
- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ---------------------------- |
16
- | <code>animation</code> | Animation to use for opening/closing the modal. This animation only affects the content. | <code>union</code> | <code>() => NoElement</code> |
17
- | <code>overlayAnimation</code> | Animation to use for the overlay (backdrop) part of the modal. By default, it uses<br />a fade transition. | <code>union</code> | <code>() => Fade</code> |
18
- | <code>open</code> | Determines if the modal is open or not. | <code>boolean</code> | <code></code> |
19
- | <code>focusOnOpen</code> | Determines if the focused element changes to one inside the modal when it opens. Either the<br />first element with a positive tabindex or just the first focusable element. | <code>boolean</code> | <code>true</code> |
20
- | <code>referenceSelector</code> | The reference selector of a DOM element to use as reference to position the modal.<br />This selector can be an ID or a class, if it is a class, it will use the first<br />element that matches. | <code>string</code> | <code></code> |
14
+ | Name | Description | Type | Default |
15
+ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | ---------------------------- |
16
+ | <code>open</code> | Determines if the modal is open or not. | <code>boolean</code> | <code></code> |
17
+ | <code>focusOnOpen</code> | Determines if the focused element changes to one inside the modal when it opens. Either the<br />first element with a positive tabindex or just the first focusable element. | <code>boolean</code> | <code>true</code> |
18
+ | <code>referenceSelector</code> | The reference selector of a DOM element to use as reference to position the modal.<br />This selector can be an ID or a class, if it is a class, it will use the first<br />element that matches. | <code>string</code> | <code></code> |
19
+ | <code>animation</code> | Animation to use for opening/closing the modal.This animation only affects the content. | <code>string \| typeof Vue</code> | <code>() => NoElement</code> |
20
+ | <code>overlayAnimation</code> | Animation to use for the overlay (backdrop) part of the modal. By default, it uses<br />a fade transition. | <code>string \| typeof Vue</code> | <code>() => Fade</code> |
21
+ | <code>contentClass</code> | Class inherited by content element. | <code>string</code> | <code></code> |
22
+ | <code>overlayClass</code> | Class inherited by overlay element. | <code>string</code> | <code></code> |
21
23
 
22
24
  ## Events
23
25
 
@@ -12,11 +12,11 @@ columns to the grid. It also allows to customize the grid items using the availa
12
12
 
13
13
  ## Props
14
14
 
15
- | Name | Description | Type | Default |
16
- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ----------------- |
17
- | <code>animation</code> | Animation component that will be used to animate the grid. | <code>union</code> | <code>'ul'</code> |
18
- | <code>items</code> | The list of items to be rendered. | <code>Array</code> | <code></code> |
19
- | <code>columns</code> | The columns to render by default in the grid. This property is used when the user has not<br />selected any value in the column picker. | <code>number</code> | <code>0</code> |
15
+ | Name | Description | Type | Default |
16
+ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- | ----------------- |
17
+ | <code>animation</code> | Animation component that will be used to animate the grid. | <code>AnimationProp</code> | <code>'ul'</code> |
18
+ | <code>items</code> | The list of items to be rendered. | <code>ListItem[]</code> | <code></code> |
19
+ | <code>columns</code> | The columns to render by default in the grid. This property is used when the user has not<br />selected any value in the column picker. | <code>number</code> | <code>0</code> |
20
20
 
21
21
  ## Slots
22
22
 
@@ -19,6 +19,8 @@ Additionally, this component exposes the following props to modify the classes o
19
19
  | <code>scrollFactor</code> | Scroll factor that will dictate how much the scroll moves when pressing a navigation button. | <code>number</code> | <code>0.7</code> |
20
20
  | <code>showButtons</code> | Would make the navigation buttons visible when they're needed or always hide them. | <code>boolean</code> | <code>true</code> |
21
21
  | <code>resetOnContentChange</code> | When true, whenever the DOM content in the sliding panel slot changes, it will reset<br />the scroll position to 0. | <code>boolean</code> | <code>true</code> |
22
+ | <code>buttonClass</code> | | <code>string</code> | <code></code> |
23
+ | <code>scrollContainerClass</code> | | <code>string</code> | <code></code> |
22
24
 
23
25
  ## Slots
24
26
 
@@ -30,7 +30,7 @@ __vue_render__._withStripped = true;
30
30
  /* style */
31
31
  const __vue_inject_styles__ = undefined;
32
32
  /* scoped */
33
- const __vue_scope_id__ = "data-v-e7f99a48";
33
+ const __vue_scope_id__ = "data-v-37c760ff";
34
34
  /* module identifier */
35
35
  const __vue_module_identifier__ = undefined;
36
36
  /* functional template */
@@ -1 +1 @@
1
- {"version":3,"file":"fade.vue.js","sources":["../../../../src/components/animations/fade.vue"],"sourcesContent":["<template>\n <!-- eslint-disable-next-line vue/attributes-order -->\n <transition v-bind=\"$attrs\" v-on=\"$listeners\" name=\"x-fade-\" :appear=\"appear\">\n <!-- @slot (Required) to add content to the transition -->\n <slot />\n </transition>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent } from 'vue';\n\n /**\n * Renders a transition wrapping the element passed in the default slot. The animation just fades\n * in/out the element by changing its opacity.\n *\n * @public\n */\n export default defineComponent({\n name: 'Fade',\n inheritAttrs: false,\n props: {\n /** Indicates if the transition must be applied on the initial render of the node. */\n appear: {\n type: Boolean,\n default: true\n }\n }\n });\n</script>\n\n<style lang=\"scss\" scoped>\n .x-fade {\n &--enter-active,\n &--leave-active {\n transition: opacity 0.25s ease-in-out;\n }\n\n &--leave-to,\n &--enter {\n opacity: 0;\n }\n }\n</style>\n\n<docs lang=\"mdx\">\n## Example\n\nThe `Fade` component is intended to be used as animation to wrap an element with v-if or v-show and\nanimate it. The animation just fades in/out the element by changing its opacity.\n\nWrapping a component:\n\n```vue live\n<template>\n <div>\n <button @click=\"shouldRender = !shouldRender\">Toggle</button>\n <Fade>\n <p v-if=\"shouldRender\">León is southern Spain</p>\n </Fade>\n </div>\n</template>\n<script>\n import { Fade } from '@empathyco/x-components';\n export default {\n name: 'FadeAnimationDemo',\n components: {\n Fade\n },\n data() {\n return {\n shouldRender: false\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"fade.vue.js","sources":["../../../../src/components/animations/fade.vue"],"sourcesContent":["<template>\n <!-- eslint-disable-next-line vue/attributes-order -->\n <transition v-bind=\"$attrs\" v-on=\"$listeners\" name=\"x-fade-\" :appear=\"appear\">\n <!-- @slot (Required) to add content to the transition -->\n <slot />\n </transition>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent } from 'vue';\n\n /**\n * Renders a transition wrapping the element passed in the default slot. The animation just fades\n * in/out the element by changing its opacity.\n *\n * @public\n */\n export default defineComponent({\n name: 'Fade',\n inheritAttrs: false,\n props: {\n /** Indicates if the transition must be applied on the initial render of the node. */\n appear: {\n type: Boolean,\n default: true\n }\n }\n });\n</script>\n\n<style lang=\"scss\" scoped>\n .x-fade {\n &--enter-active,\n &--leave-active {\n transition: opacity 0.25s ease-in-out;\n }\n\n &--leave-to,\n &--enter {\n opacity: 0 !important;\n }\n }\n</style>\n\n<docs lang=\"mdx\">\n## Example\n\nThe `Fade` component is intended to be used as animation to wrap an element with v-if or v-show and\nanimate it. The animation just fades in/out the element by changing its opacity.\n\nWrapping a component:\n\n```vue live\n<template>\n <div>\n <button @click=\"shouldRender = !shouldRender\">Toggle</button>\n <Fade>\n <p v-if=\"shouldRender\">León is southern Spain</p>\n </Fade>\n </div>\n</template>\n<script>\n import { Fade } from '@empathyco/x-components';\n export default {\n name: 'FadeAnimationDemo',\n components: {\n Fade\n },\n data() {\n return {\n shouldRender: false\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { createInjector, createInjectorSSR } from 'vue-runtime-helpers';
2
2
 
3
- var css = ".x-fade--enter-active[data-v-e7f99a48], .x-fade--leave-active[data-v-e7f99a48] {\n transition: opacity 0.25s ease-in-out;\n}\n.x-fade--leave-to[data-v-e7f99a48], .x-fade--enter[data-v-e7f99a48] {\n opacity: 0;\n}";
3
+ var css = ".x-fade--enter-active[data-v-37c760ff], .x-fade--leave-active[data-v-37c760ff] {\n transition: opacity 0.25s ease-in-out;\n}\n.x-fade--leave-to[data-v-37c760ff], .x-fade--enter[data-v-37c760ff] {\n opacity: 0 !important;\n}";
4
4
  const isBrowser = /*#__PURE__*/ (function () {
5
5
  return (
6
6
  Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) !==
@@ -17,7 +17,7 @@ var __vue_render__ = function () {
17
17
  },
18
18
  scopedSlots: _vm._u(
19
19
  [
20
- _vm._l(_vm.$scopedSlots, function (_, name) {
20
+ _vm._l(_vm.slots, function (_, name) {
21
21
  return {
22
22
  key: name,
23
23
  fn: function (ref) {
@@ -1 +1 @@
1
- {"version":3,"file":"base-variable-column-grid.vue.js","sources":["../../../src/components/base-variable-column-grid.vue"],"sourcesContent":["<template>\n <BaseGrid :animation=\"animation\" :columns=\"columnsToRender\" :items=\"items\">\n <template v-for=\"(_, name) in $scopedSlots\" v-slot:[name]=\"{ item }\">\n <!--\n @slot Customized item rendering. The slot name can either be default or the item's model\n name.\n @binding {GridItem} item - Item to render.\n -->\n <slot :name=\"name\" v-bind=\"{ item }\" />\n </template>\n </BaseGrid>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { ListItem } from '../utils/types';\n import BaseGrid from './base-grid.vue';\n import { XOn } from './decorators/bus.decorators';\n\n /**\n * The `BaseVariableColumnGrid` component is a wrapper of the `BaseGrid` component that listens to\n * the `UserClickedColumnPicker` and the `ColumnsNumberProvided` events and passes the\n * selected number of columns to the grid. It also allows to customize the grid items using the\n * available `scopedSlots`.\n *\n * @public\n */\n @Component({\n components: {\n BaseGrid\n }\n })\n export default class BaseVariableColumnGrid extends Vue {\n /**\n * Animation component that will be used to animate the grid.\n *\n * @public\n */\n @Prop({ default: 'ul' })\n protected animation!: Vue | string;\n\n /**\n * The list of items to be rendered.\n *\n * @remarks The items must have an id property.\n *\n * @public\n */\n @Prop()\n protected items?: ListItem[];\n\n /**\n * The columns to render by default in the grid. This property is used when the user has not\n * selected any value in the column picker.\n *\n * @internal\n */\n @Prop({ default: 0 })\n protected columns!: number;\n\n /**\n * The number of columns provided by a user interaction.\n *\n * @internal\n */\n protected providedColumns: number | null = null;\n\n /**\n * The number of columns to render in the grid.\n *\n * @returns The number of columns.\n *\n * @internal\n */\n protected get columnsToRender(): number {\n return this.providedColumns === null ? this.columns : this.providedColumns;\n }\n\n /**\n * Handler to update the number of columns when the user selects a new value.\n *\n * @param newColumns - The new columns value.\n *\n * @internal\n */\n @XOn(['ColumnsNumberProvided'])\n setColumns(newColumns: number): void {\n this.providedColumns = newColumns;\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nThe `BaseVariableColumnGrid` component is a wrapper of the `BaseGrid` component that listens to the\n`ColumnsNumberProvided` events and passes the selected amount of columns to the grid. It also allows\nyou to customize the grid items using the available `scopedSlots`.\n\n```vue\n<template>\n <section class=\"results\">\n <button @click=\"setColumns(4)\" class=\"column-picker-selector\">\n <span class=\"column-picker-selector__text\">4 columns</span>\n </button>\n <BaseVariableColumnGrid :animation=\"animation\" :items=\"items\">\n <template #default=\"{ item }\">\n <span data-test=\"default-slot\">{{ item.id }}</span>\n </template>\n <template #result=\"{ item }\">\n <span data-test=\"result-slot\">{{ 'Result ' + item.id }}</span>\n </template>\n </BaseVariableColumnGrid>\n </section>\n</template>\n\n<script>\n import { BaseVariableColumnGrid, StaggeredFadeAndSlide } from '@empathyco/x-components';\n\n export default {\n name: 'ResultsSection',\n components: {\n BaseVariableColumnGrid\n },\n data() {\n return {\n animation: StaggeredFadeAndSlide,\n items: [\n {\n id: 'res-1',\n modelName: 'Result',\n name: 'Product 1'\n },\n {\n id: 'res-2',\n modelName: 'Result',\n name: 'Product 2'\n }\n ]\n };\n },\n methods: {\n setColumns(columns) {\n this.$x.emit('UserClickedColumnPicker', columns);\n }\n }\n };\n</script>\n```\n\n### Playing with props\n\nConfiguring the default columns to be rendered. These columns will be the default value until the\n`ColumnsNumberProvided` is emitted and changes the value.\n\n```vue\n<template>\n <section class=\"results\">\n <button @click=\"setColumns(5)\" class=\"column-picker-selector\">\n <span class=\"column-picker-selector__text\">5 columns</span>\n </button>\n <BaseVariableColumnGrid :animation=\"animation\" :items=\"items\" :columns=\"3\">\n <template #default=\"{ item }\">\n <span data-test=\"default-slot\">{{ item.id }}</span>\n </template>\n <template #result=\"{ item }\">\n <span data-test=\"result-slot\">{{ 'Result ' + item.id }}</span>\n </template>\n </BaseVariableColumnGrid>\n </section>\n</template>\n\n<script>\n import { BaseVariableColumnGrid, StaggeredFadeAndSlide } from '@empathyco/x-components';\n\n export default {\n name: 'ResultsSection',\n components: {\n BaseVariableColumnGrid\n },\n data() {\n return {\n animation: StaggeredFadeAndSlide,\n items: [\n {\n id: 'res-1',\n modelName: 'Result',\n name: 'Product 1'\n },\n {\n id: 'res-2',\n modelName: 'Result',\n name: 'Product 2'\n }\n ]\n };\n },\n methods: {\n setColumns(columns) {\n this.$x.emit('UserClickedColumnPicker', columns);\n }\n }\n };\n</script>\n```\n\n### Customizing the items width\n\nThe `--x-size-min-width-grid-item` variable can be used to customize the min width of the grid\nitems.\n\n```vue\n<template>\n <BaseVariableColumnGrid\n :animation=\"animation\"\n :items=\"items\"\n style=\"--x-size-min-width-grid-item: 150px\"\n >\n <template #default=\"{ item }\">\n {{ `Default slot content: ${item.id}` }}\n </template>\n </BaseVariableColumnGrid>\n</template>\n\n<script>\n import { BaseVariableColumnGrid, StaggeredFadeAndSlide } from '@empathyco/x-components';\n\n export default {\n name: 'ResultsSection',\n components: {\n BaseVariableColumnGrid\n },\n data() {\n return {\n animation: StaggeredFadeAndSlide,\n items: [\n {\n id: 'res-1',\n modelName: 'Result',\n name: 'Product 1'\n },\n {\n id: 'res-2',\n modelName: 'Result',\n name: 'Product 2'\n }\n ]\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"base-variable-column-grid.vue.js","sources":["../../../src/components/base-variable-column-grid.vue"],"sourcesContent":["<template>\n <BaseGrid :animation=\"animation\" :columns=\"columnsToRender\" :items=\"items\">\n <template v-for=\"(_, name) in slots\" v-slot:[name]=\"{ item }\">\n <!--\n @slot Customized item rendering. The slot name can either be default or the item's model\n name.\n @binding {GridItem} item - Item to render.\n -->\n <slot :name=\"name\" v-bind=\"{ item }\" />\n </template>\n </BaseGrid>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, ref } from 'vue';\n import { ListItem } from '../utils/types';\n import { AnimationProp } from '../types/animation-prop';\n import { useXBus } from '../composables/use-x-bus';\n import BaseGrid from './base-grid.vue';\n\n /**\n * The `BaseVariableColumnGrid` component is a wrapper of the `BaseGrid` component that listens to\n * the `UserClickedColumnPicker` and the `ColumnsNumberProvided` events and passes the\n * selected number of columns to the grid. It also allows to customize the grid items using the\n * available `scopedSlots`.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseVariableColumnGrid',\n components: {\n BaseGrid\n },\n props: {\n /**\n * Animation component that will be used to animate the grid.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: 'ul'\n },\n /**\n * The list of items to be rendered.\n *\n * @remarks The items must have an id property.\n *\n * @public\n */\n items: Array as PropType<ListItem[]>,\n /**\n * The columns to render by default in the grid. This property is used when the user has not\n * selected any value in the column picker.\n *\n * @internal\n */\n columns: {\n type: Number,\n default: 0\n }\n },\n setup(props, { slots }) {\n const bus = useXBus();\n /**\n * The number of columns provided by a user interaction.\n *\n * @internal\n */\n const providedColumns = ref<number | null>(null);\n\n /**\n * The number of columns to render in the grid.\n *\n * @returns The number of columns.\n *\n * @internal\n */\n const columnsToRender = computed(() =>\n providedColumns.value === null ? props.columns : providedColumns.value\n );\n\n /**\n * Handler to update the number of columns when the user selects a new value.\n *\n * @param newColumns - The new columns value.\n *\n * @internal\n */\n bus\n .on('ColumnsNumberProvided', false)\n .subscribe(newColumns => (providedColumns.value = newColumns));\n\n return {\n columnsToRender,\n slots\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nThe `BaseVariableColumnGrid` component is a wrapper of the `BaseGrid` component that listens to the\n`ColumnsNumberProvided` events and passes the selected amount of columns to the grid. It also allows\nyou to customize the grid items using the available `scopedSlots`.\n\n```vue\n<template>\n <section class=\"results\">\n <button @click=\"setColumns(4)\" class=\"column-picker-selector\">\n <span class=\"column-picker-selector__text\">4 columns</span>\n </button>\n <BaseVariableColumnGrid :animation=\"animation\" :items=\"items\">\n <template #default=\"{ item }\">\n <span data-test=\"default-slot\">{{ item.id }}</span>\n </template>\n <template #result=\"{ item }\">\n <span data-test=\"result-slot\">{{ 'Result ' + item.id }}</span>\n </template>\n </BaseVariableColumnGrid>\n </section>\n</template>\n\n<script>\n import { BaseVariableColumnGrid, StaggeredFadeAndSlide } from '@empathyco/x-components';\n\n export default {\n name: 'ResultsSection',\n components: {\n BaseVariableColumnGrid\n },\n data() {\n return {\n animation: StaggeredFadeAndSlide,\n items: [\n {\n id: 'res-1',\n modelName: 'Result',\n name: 'Product 1'\n },\n {\n id: 'res-2',\n modelName: 'Result',\n name: 'Product 2'\n }\n ]\n };\n },\n methods: {\n setColumns(columns) {\n this.$x.emit('UserClickedColumnPicker', columns);\n }\n }\n };\n</script>\n```\n\n### Playing with props\n\nConfiguring the default columns to be rendered. These columns will be the default value until the\n`ColumnsNumberProvided` is emitted and changes the value.\n\n```vue\n<template>\n <section class=\"results\">\n <button @click=\"setColumns(5)\" class=\"column-picker-selector\">\n <span class=\"column-picker-selector__text\">5 columns</span>\n </button>\n <BaseVariableColumnGrid :animation=\"animation\" :items=\"items\" :columns=\"3\">\n <template #default=\"{ item }\">\n <span data-test=\"default-slot\">{{ item.id }}</span>\n </template>\n <template #result=\"{ item }\">\n <span data-test=\"result-slot\">{{ 'Result ' + item.id }}</span>\n </template>\n </BaseVariableColumnGrid>\n </section>\n</template>\n\n<script>\n import { BaseVariableColumnGrid, StaggeredFadeAndSlide } from '@empathyco/x-components';\n\n export default {\n name: 'ResultsSection',\n components: {\n BaseVariableColumnGrid\n },\n data() {\n return {\n animation: StaggeredFadeAndSlide,\n items: [\n {\n id: 'res-1',\n modelName: 'Result',\n name: 'Product 1'\n },\n {\n id: 'res-2',\n modelName: 'Result',\n name: 'Product 2'\n }\n ]\n };\n },\n methods: {\n setColumns(columns) {\n this.$x.emit('UserClickedColumnPicker', columns);\n }\n }\n };\n</script>\n```\n\n### Customizing the items width\n\nThe `--x-size-min-width-grid-item` variable can be used to customize the min width of the grid\nitems.\n\n```vue\n<template>\n <BaseVariableColumnGrid\n :animation=\"animation\"\n :items=\"items\"\n style=\"--x-size-min-width-grid-item: 150px\"\n >\n <template #default=\"{ item }\">\n {{ `Default slot content: ${item.id}` }}\n </template>\n </BaseVariableColumnGrid>\n</template>\n\n<script>\n import { BaseVariableColumnGrid, StaggeredFadeAndSlide } from '@empathyco/x-components';\n\n export default {\n name: 'ResultsSection',\n components: {\n BaseVariableColumnGrid\n },\n data() {\n return {\n animation: StaggeredFadeAndSlide,\n items: [\n {\n id: 'res-1',\n modelName: 'Result',\n name: 'Product 1'\n },\n {\n id: 'res-2',\n modelName: 'Result',\n name: 'Product 2'\n }\n ]\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,7 @@
1
- import { __decorate } from 'tslib';
2
- import Vue from 'vue';
3
- import { Prop, Component } from 'vue-property-decorator';
1
+ import { defineComponent, ref, computed } from 'vue';
2
+ import { AnimationProp } from '../types/animation-prop.js';
3
+ import { useXBus } from '../composables/use-x-bus.js';
4
4
  import __vue_component__ from './base-grid.vue.js';
5
- import { XOn } from './decorators/bus.decorators.js';
6
5
 
7
6
  /**
8
7
  * The `BaseVariableColumnGrid` component is a wrapper of the `BaseGrid` component that listens to
@@ -12,57 +11,72 @@ import { XOn } from './decorators/bus.decorators.js';
12
11
  *
13
12
  * @public
14
13
  */
15
- let BaseVariableColumnGrid = class BaseVariableColumnGrid extends Vue {
16
- constructor() {
17
- super(...arguments);
14
+ var script = defineComponent({
15
+ name: 'BaseVariableColumnGrid',
16
+ components: {
17
+ BaseGrid: __vue_component__
18
+ },
19
+ props: {
20
+ /**
21
+ * Animation component that will be used to animate the grid.
22
+ *
23
+ * @public
24
+ */
25
+ animation: {
26
+ type: AnimationProp,
27
+ default: 'ul'
28
+ },
29
+ /**
30
+ * The list of items to be rendered.
31
+ *
32
+ * @remarks The items must have an id property.
33
+ *
34
+ * @public
35
+ */
36
+ items: Array,
37
+ /**
38
+ * The columns to render by default in the grid. This property is used when the user has not
39
+ * selected any value in the column picker.
40
+ *
41
+ * @internal
42
+ */
43
+ columns: {
44
+ type: Number,
45
+ default: 0
46
+ }
47
+ },
48
+ setup(props, { slots }) {
49
+ const bus = useXBus();
18
50
  /**
19
51
  * The number of columns provided by a user interaction.
20
52
  *
21
53
  * @internal
22
54
  */
23
- this.providedColumns = null;
24
- }
25
- /**
26
- * The number of columns to render in the grid.
27
- *
28
- * @returns The number of columns.
29
- *
30
- * @internal
31
- */
32
- get columnsToRender() {
33
- return this.providedColumns === null ? this.columns : this.providedColumns;
34
- }
35
- /**
36
- * Handler to update the number of columns when the user selects a new value.
37
- *
38
- * @param newColumns - The new columns value.
39
- *
40
- * @internal
41
- */
42
- setColumns(newColumns) {
43
- this.providedColumns = newColumns;
55
+ const providedColumns = ref(null);
56
+ /**
57
+ * The number of columns to render in the grid.
58
+ *
59
+ * @returns The number of columns.
60
+ *
61
+ * @internal
62
+ */
63
+ const columnsToRender = computed(() => providedColumns.value === null ? props.columns : providedColumns.value);
64
+ /**
65
+ * Handler to update the number of columns when the user selects a new value.
66
+ *
67
+ * @param newColumns - The new columns value.
68
+ *
69
+ * @internal
70
+ */
71
+ bus
72
+ .on('ColumnsNumberProvided', false)
73
+ .subscribe(newColumns => (providedColumns.value = newColumns));
74
+ return {
75
+ columnsToRender,
76
+ slots
77
+ };
44
78
  }
45
- };
46
- __decorate([
47
- Prop({ default: 'ul' })
48
- ], BaseVariableColumnGrid.prototype, "animation", void 0);
49
- __decorate([
50
- Prop()
51
- ], BaseVariableColumnGrid.prototype, "items", void 0);
52
- __decorate([
53
- Prop({ default: 0 })
54
- ], BaseVariableColumnGrid.prototype, "columns", void 0);
55
- __decorate([
56
- XOn(['ColumnsNumberProvided'])
57
- ], BaseVariableColumnGrid.prototype, "setColumns", null);
58
- BaseVariableColumnGrid = __decorate([
59
- Component({
60
- components: {
61
- BaseGrid: __vue_component__
62
- }
63
- })
64
- ], BaseVariableColumnGrid);
65
- var script = BaseVariableColumnGrid;
79
+ });
66
80
 
67
81
  export { script as default };
68
82
  //# sourceMappingURL=base-variable-column-grid.vue2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-variable-column-grid.vue2.js","sources":["../../../src/components/base-variable-column-grid.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { ListItem } from '../utils/types';\n import BaseGrid from './base-grid.vue';\n import { XOn } from './decorators/bus.decorators';\n\n /**\n * The `BaseVariableColumnGrid` component is a wrapper of the `BaseGrid` component that listens to\n * the `UserClickedColumnPicker` and the `ColumnsNumberProvided` events and passes the\n * selected number of columns to the grid. It also allows to customize the grid items using the\n * available `scopedSlots`.\n *\n * @public\n */\n @Component({\n components: {\n BaseGrid\n }\n })\n export default class BaseVariableColumnGrid extends Vue {\n /**\n * Animation component that will be used to animate the grid.\n *\n * @public\n */\n @Prop({ default: 'ul' })\n protected animation!: Vue | string;\n\n /**\n * The list of items to be rendered.\n *\n * @remarks The items must have an id property.\n *\n * @public\n */\n @Prop()\n protected items?: ListItem[];\n\n /**\n * The columns to render by default in the grid. This property is used when the user has not\n * selected any value in the column picker.\n *\n * @internal\n */\n @Prop({ default: 0 })\n protected columns!: number;\n\n /**\n * The number of columns provided by a user interaction.\n *\n * @internal\n */\n protected providedColumns: number | null = null;\n\n /**\n * The number of columns to render in the grid.\n *\n * @returns The number of columns.\n *\n * @internal\n */\n protected get columnsToRender(): number {\n return this.providedColumns === null ? this.columns : this.providedColumns;\n }\n\n /**\n * Handler to update the number of columns when the user selects a new value.\n *\n * @param newColumns - The new columns value.\n *\n * @internal\n */\n @XOn(['ColumnsNumberProvided'])\n setColumns(newColumns: number): void {\n this.providedColumns = newColumns;\n }\n }\n"],"names":["BaseGrid"],"mappings":";;;;;;AAoBE;;;;;;;AAOG;AAMY,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,GAAG,CAAA;AAAxC,IAAA,WAAA,GAAA;;AA4Bb;;;;AAIG;QACO,IAAe,CAAA,eAAA,GAAkB,IAAI,CAAC;KAwBjD;AAtBC;;;;;;AAMG;AACH,IAAA,IAAc,eAAe,GAAA;AAC3B,QAAA,OAAO,IAAI,CAAC,eAAe,KAAK,IAAI,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC;KAC5E;AAED;;;;;;AAMG;AAEH,IAAA,UAAU,CAAC,UAAkB,EAAA;AAC3B,QAAA,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC;KACnC;CACF,CAAA;AAlDC,UAAA,CAAA;AADC,IAAA,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACW,CAAA,EAAA,sBAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAUnC,UAAA,CAAA;AADC,IAAA,IAAI,EAAE;AACsB,CAAA,EAAA,sBAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAS7B,UAAA,CAAA;AADC,IAAA,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACM,CAAA,EAAA,sBAAA,CAAA,SAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AA4B3B,UAAA,CAAA;AADC,IAAA,GAAG,CAAC,CAAC,uBAAuB,CAAC,CAAC;AAG9B,CAAA,EAAA,sBAAA,CAAA,SAAA,EAAA,YAAA,EAAA,IAAA,CAAA,CAAA;AAxDkB,sBAAsB,GAAA,UAAA,CAAA;AAL1C,IAAA,SAAS,CAAC;AACT,QAAA,UAAU,EAAE;sBACVA,iBAAQ;AACT,SAAA;KACF,CAAC;AACmB,CAAA,EAAA,sBAAsB,CAyD1C,CAAA;aAzDoB,sBAAsB;;;;"}
1
+ {"version":3,"file":"base-variable-column-grid.vue2.js","sources":["../../../src/components/base-variable-column-grid.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n import { computed, defineComponent, PropType, ref } from 'vue';\n import { ListItem } from '../utils/types';\n import { AnimationProp } from '../types/animation-prop';\n import { useXBus } from '../composables/use-x-bus';\n import BaseGrid from './base-grid.vue';\n\n /**\n * The `BaseVariableColumnGrid` component is a wrapper of the `BaseGrid` component that listens to\n * the `UserClickedColumnPicker` and the `ColumnsNumberProvided` events and passes the\n * selected number of columns to the grid. It also allows to customize the grid items using the\n * available `scopedSlots`.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseVariableColumnGrid',\n components: {\n BaseGrid\n },\n props: {\n /**\n * Animation component that will be used to animate the grid.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: 'ul'\n },\n /**\n * The list of items to be rendered.\n *\n * @remarks The items must have an id property.\n *\n * @public\n */\n items: Array as PropType<ListItem[]>,\n /**\n * The columns to render by default in the grid. This property is used when the user has not\n * selected any value in the column picker.\n *\n * @internal\n */\n columns: {\n type: Number,\n default: 0\n }\n },\n setup(props, { slots }) {\n const bus = useXBus();\n /**\n * The number of columns provided by a user interaction.\n *\n * @internal\n */\n const providedColumns = ref<number | null>(null);\n\n /**\n * The number of columns to render in the grid.\n *\n * @returns The number of columns.\n *\n * @internal\n */\n const columnsToRender = computed(() =>\n providedColumns.value === null ? props.columns : providedColumns.value\n );\n\n /**\n * Handler to update the number of columns when the user selects a new value.\n *\n * @param newColumns - The new columns value.\n *\n * @internal\n */\n bus\n .on('ColumnsNumberProvided', false)\n .subscribe(newColumns => (providedColumns.value = newColumns));\n\n return {\n columnsToRender,\n slots\n };\n }\n });\n"],"names":["BaseGrid"],"mappings":";;;;;AAoBE;;;;;;;AAOG;AACH,aAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,wBAAwB;AAC9B,IAAA,UAAU,EAAE;kBACVA,iBAAQ;AACT,KAAA;AACD,IAAA,KAAK,EAAE;AACL;;;;AAIG;AACH,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;;;;;AAMG;AACH,QAAA,KAAK,EAAE,KAA6B;AACpC;;;;;AAKG;AACH,QAAA,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,CAAC;AACX,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAA;AACpB,QAAA,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;AACtB;;;;AAIG;AACH,QAAA,MAAM,eAAe,GAAG,GAAG,CAAgB,IAAI,CAAC,CAAC;AAEjD;;;;;;AAMG;QACH,MAAM,eAAe,GAAG,QAAQ,CAAC,MAC/B,eAAe,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,OAAO,GAAG,eAAe,CAAC,KAAK,CACvE,CAAC;AAEF;;;;;;AAMG;QACH,GAAG;AACA,aAAA,EAAE,CAAC,uBAAuB,EAAE,KAAK,CAAC;AAClC,aAAA,SAAS,CAAC,UAAU,KAAK,eAAe,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC;QAEjE,OAAO;YACL,eAAe;YACf,KAAK;SACN,CAAC;KACH;AACF,CAAA,CAAC;;;;"}
@@ -17,7 +17,7 @@ import Vue from 'vue';
17
17
  * }
18
18
  * ```
19
19
  * @returns Mixin for the component.
20
- *
20
+ * @deprecated Use props.
21
21
  */
22
22
  function dynamicPropsMixin(propNames) {
23
23
  return Vue.extend({
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-props.mixin.js","sources":["../../../src/components/dynamic-props.mixin.ts"],"sourcesContent":["import Vue from 'vue';\nimport { PropValidator } from 'vue/types/options';\nimport { ExtendedVue } from 'vue/types/vue';\n\n/**\n * Mixin that creates a string prop in the component for each element\n * within the array passed as `propNames` argument.\n *\n * @param propNames - Array with the names of the props to create.\n * @example\n * ```typescript\n *\n * @Component({\n * components: { RelatedTag },\n * mixins: [xComponentMixin(relatedTagsXModule)]\n * })\n * export default class RelatedTags extends Mixins(dynamicPropsMixin(['list', 'li', 'tag'])) {\n * // This component will have available 3 props: 'list', 'li' and 'tag'\n * }\n * ```\n * @returns Mixin for the component.\n *\n */\nexport function dynamicPropsMixin<PropNames extends string>(\n propNames: PropNames[]\n): ExtendedVue<Vue, unknown, unknown, unknown, Partial<Record<PropNames, string>>> {\n return Vue.extend({\n props: propNames.reduce(\n (props, propName) => ({ ...props, [propName]: { type: String } }),\n {} as Record<PropNames, PropValidator<string>>\n )\n });\n}\n"],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;;;;;;AAkBG;AACG,SAAU,iBAAiB,CAC/B,SAAsB,EAAA;IAEtB,OAAO,GAAG,CAAC,MAAM,CAAC;AAChB,QAAA,KAAK,EAAE,SAAS,CAAC,MAAM,CACrB,CAAC,KAAK,EAAE,QAAQ,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC,QAAQ,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EACjE,EAA8C,CAC/C;AACF,KAAA,CAAC,CAAC;AACL;;;;"}
1
+ {"version":3,"file":"dynamic-props.mixin.js","sources":["../../../src/components/dynamic-props.mixin.ts"],"sourcesContent":["import Vue from 'vue';\nimport { PropValidator } from 'vue/types/options';\nimport { ExtendedVue } from 'vue/types/vue';\n\n/**\n * Mixin that creates a string prop in the component for each element\n * within the array passed as `propNames` argument.\n *\n * @param propNames - Array with the names of the props to create.\n * @example\n * ```typescript\n *\n * @Component({\n * components: { RelatedTag },\n * mixins: [xComponentMixin(relatedTagsXModule)]\n * })\n * export default class RelatedTags extends Mixins(dynamicPropsMixin(['list', 'li', 'tag'])) {\n * // This component will have available 3 props: 'list', 'li' and 'tag'\n * }\n * ```\n * @returns Mixin for the component.\n * @deprecated Use props.\n */\nexport function dynamicPropsMixin<PropNames extends string>(\n propNames: PropNames[]\n): ExtendedVue<Vue, unknown, unknown, unknown, Partial<Record<PropNames, string>>> {\n return Vue.extend({\n props: propNames.reduce(\n (props, propName) => ({ ...props, [propName]: { type: String } }),\n {} as Record<PropNames, PropValidator<string>>\n )\n });\n}\n"],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;;;;;;AAkBG;AACG,SAAU,iBAAiB,CAC/B,SAAsB,EAAA;IAEtB,OAAO,GAAG,CAAC,MAAM,CAAC;AAChB,QAAA,KAAK,EAAE,SAAS,CAAC,MAAM,CACrB,CAAC,KAAK,EAAE,QAAQ,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC,QAAQ,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EACjE,EAA8C,CAC/C;AACF,KAAA,CAAC,CAAC;AACL;;;;"}