@empathyco/x-components 3.0.0-alpha.313 → 3.0.0-alpha.314
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.314](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.313...@empathyco/x-components@3.0.0-alpha.314) (2023-02-15)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **desing-system:** Add layout `layout-stack` util. (#1076)
|
|
11
|
+
([38db5b3](https://github.com/empathyco/x/commit/38db5b3b4c10a2bd288e9e79b15232f063002156)),
|
|
12
|
+
closes [EX-8000](https://searchbroker.atlassian.net/browse/EX-8000)
|
|
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.313](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.312...@empathyco/x-components@3.0.0-alpha.313) (2023-02-14)
|
|
7
20
|
|
|
8
21
|
### ⚠ BREAKING CHANGES
|
|
@@ -3035,16 +3035,6 @@
|
|
|
3035
3035
|
--x-size-padding-row-05: var(--x-size-base-05);
|
|
3036
3036
|
--x-size-padding-row-06: var(--x-size-base-06);
|
|
3037
3037
|
}
|
|
3038
|
-
.x-tag--card.x-tag,
|
|
3039
|
-
.x-tag--card .x-tag {
|
|
3040
|
-
--x-size-border-radius-tag-default: var(--x-size-border-radius-tag-card);
|
|
3041
|
-
--x-size-border-radius-top-left-tag-default: var(--x-size-border-radius-top-left-tag-card);
|
|
3042
|
-
--x-size-border-radius-top-right-tag-default: var(--x-size-border-radius-top-right-tag-card);
|
|
3043
|
-
--x-size-border-radius-bottom-right-tag-default: var(
|
|
3044
|
-
--x-size-border-radius-bottom-right-tag-card
|
|
3045
|
-
);
|
|
3046
|
-
--x-size-border-radius-bottom-left-tag-default: var(--x-size-border-radius-bottom-left-tag-card);
|
|
3047
|
-
}
|
|
3048
3038
|
:root {
|
|
3049
3039
|
--x-size-border-radius-tag-card: var(--x-size-border-radius-base-s);
|
|
3050
3040
|
--x-size-border-radius-top-left-tag-card: var(--x-size-border-radius-tag-card);
|
|
@@ -6425,3 +6415,14 @@
|
|
|
6425
6415
|
.x-sticky {
|
|
6426
6416
|
position: sticky !important;
|
|
6427
6417
|
}
|
|
6418
|
+
|
|
6419
|
+
.x-tag--card.x-tag,
|
|
6420
|
+
.x-tag--card .x-tag {
|
|
6421
|
+
--x-size-border-radius-tag-default: var(--x-size-border-radius-tag-card);
|
|
6422
|
+
--x-size-border-radius-top-left-tag-default: var(--x-size-border-radius-top-left-tag-card);
|
|
6423
|
+
--x-size-border-radius-top-right-tag-default: var(--x-size-border-radius-top-right-tag-card);
|
|
6424
|
+
--x-size-border-radius-bottom-right-tag-default: var(
|
|
6425
|
+
--x-size-border-radius-bottom-right-tag-card
|
|
6426
|
+
);
|
|
6427
|
+
--x-size-border-radius-bottom-left-tag-default: var(--x-size-border-radius-bottom-left-tag-card);
|
|
6428
|
+
}
|
|
@@ -80,7 +80,7 @@ __vue_render__._withStripped = true;
|
|
|
80
80
|
/* style */
|
|
81
81
|
const __vue_inject_styles__ = undefined;
|
|
82
82
|
/* scoped */
|
|
83
|
-
const __vue_scope_id__ = "data-v-
|
|
83
|
+
const __vue_scope_id__ = "data-v-5b52bd92";
|
|
84
84
|
/* module identifier */
|
|
85
85
|
const __vue_module_identifier__ = undefined;
|
|
86
86
|
/* functional template */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sliding-panel.vue.js","sources":["../../../src/components/sliding-panel.vue"],"sourcesContent":["<template>\n <div v-if=\"$slots.default\" class=\"x-sliding-panel\" :class=\"cssClasses\" data-test=\"sliding-panel\">\n <button\n v-if=\"showButtons\"\n @click=\"scrollLeft\"\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-left\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-left-button\"\n >\n <!-- @slot Left button content -->\n <slot name=\"sliding-panel-left-button\">ᐸ</slot>\n </button>\n <div\n ref=\"scrollContainer\"\n @scroll=\"debouncedUpdateScrollPosition\"\n @transitionend=\"debouncedUpdateScrollPosition\"\n @animationend=\"debouncedUpdateScrollPosition\"\n :class=\"scrollContainerClass\"\n class=\"x-list x-list--horizontal x-sliding-panel__scroll\"\n data-test=\"sliding-panel-scroll\"\n >\n <!-- @slot (Required) Sliding panel content -->\n <slot />\n </div>\n <button\n v-if=\"showButtons\"\n @click=\"scrollRight\"\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-right\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-right-button\"\n >\n <!-- @slot Right button content -->\n <slot name=\"sliding-panel-right-button\">ᐳ</slot>\n </button>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { Component, Mixins, Prop } from 'vue-property-decorator';\n import { VueCSSClasses } from '../utils/types';\n import { Debounce } from './decorators/debounce.decorators';\n import { dynamicPropsMixin } from './dynamic-props.mixin';\n\n /**\n * This component allows for any other component or element inside it to be horizontally\n * navigable. It also implements customizable buttons as well as other minor customizations to its\n * general behavior.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\n @Component\n export default class SlidingPanel extends Mixins(\n dynamicPropsMixin(['buttonClass', 'scrollContainerClass'])\n ) {\n /**\n * Scroll factor that will dictate how much the scroll moves when pressing a navigation button.\n *\n * @public\n */\n @Prop({ default: 0.7 })\n public scrollFactor!: number;\n\n /**\n * Would make the navigation buttons visible when they're needed or always hide them.\n *\n * @public\n */\n @Prop({ default: true })\n public showButtons!: boolean;\n\n /**\n * When true, whenever the DOM content in the sliding panel slot changes, it will reset\n * the scroll position to 0.\n *\n * @public\n */\n @Prop({ default: true })\n public resetOnContentChange!: boolean;\n\n /**\n * Indicates if the scroll is at the start of the sliding panel.\n *\n * @internal\n */\n protected isScrollAtStart = true;\n\n /**\n * Indicates if the scroll is at the end of the sliding panel.\n *\n * @internal\n */\n protected isScrollAtEnd = true;\n\n /**\n * HTMLElement referencing the scroll of the component.\n *\n * @internal\n */\n public $refs!: {\n scrollContainer: HTMLElement;\n };\n\n /**\n * CSS classes to apply based on the scroll position.\n *\n * @returns The CSS classes to apply.\n *\n * @internal\n */\n protected get cssClasses(): VueCSSClasses {\n return {\n 'x-sliding-panel-at-start': this.isScrollAtStart,\n 'x-sliding-panel-at-end': this.isScrollAtEnd\n };\n }\n\n /**\n * Initialises browser platform code:\n * - Creates a mutation observer to detect content changes and reset scroll position.\n * - Stores initial size and scroll position values.\n *\n * @internal\n */\n mounted(): void {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const resizeObserver = new ResizeObserver(this.debouncedUpdateScrollPosition);\n resizeObserver.observe(this.$el);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const contentChangedObserver = new MutationObserver(this.restoreAndUpdateScroll);\n this.$watch(\n () => this.resetOnContentChange,\n shouldReset => {\n if (shouldReset) {\n contentChangedObserver.observe(this.$refs.scrollContainer, {\n attributes: false,\n childList: true,\n subtree: true,\n characterData: false\n });\n } else {\n contentChangedObserver.disconnect();\n }\n },\n { immediate: true }\n );\n this.$on('hook:beforeDestroy', () => {\n contentChangedObserver.disconnect();\n resizeObserver.disconnect();\n });\n\n this.updateScrollPosition();\n }\n\n /**\n * Resets the scroll and updates the values of the scroll for the buttons to react.\n *\n * @internal\n */\n @Debounce(100, { leading: true })\n restoreAndUpdateScroll(): void {\n this.$refs.scrollContainer.scroll({ left: 0, behavior: 'smooth' });\n this.updateScrollPosition();\n }\n\n /**\n * Updates the values of the scroll positions to show or hide the buttons depending on it.\n *\n * @internal\n */\n protected updateScrollPosition(): void {\n if (this.$refs.scrollContainer !== undefined) {\n const { scrollLeft, clientWidth, scrollWidth } = this.$refs.scrollContainer;\n this.isScrollAtStart = !scrollLeft;\n /* The 2 px extra is to fix some cases in some resolutions where the scroll + client size is\n * less than the scroll width even when the scroll is at the end */\n this.isScrollAtEnd = scrollLeft + clientWidth + 2 >= scrollWidth;\n }\n }\n\n /**\n * Debounced version of the {@link SlidingPanel.updateScrollPosition | updateScrollPosition}\n * method.\n *\n * @internal\n */\n @Debounce(100, { leading: true })\n debouncedUpdateScrollPosition(): void {\n this.updateScrollPosition();\n }\n\n /**\n * Scrolls the wrapper element to the left.\n *\n * @internal\n */\n protected scrollLeft(): void {\n this.scrollTo(-this.$refs.scrollContainer.clientWidth);\n }\n\n /**\n * Scrolls the wrapper element to the right.\n *\n * @internal\n */\n protected scrollRight(): void {\n this.scrollTo(this.$refs.scrollContainer.clientWidth);\n }\n\n /**\n * Scrolls the wrapper element towards the provided scroll value.\n *\n * @param scrollValue - The value the scroll will go towards.\n *\n * @internal\n */\n protected scrollTo(scrollValue: number): void {\n this.$refs.scrollContainer.scrollBy({\n left: scrollValue * this.scrollFactor,\n behavior: 'smooth'\n });\n }\n }\n</script>\n\n<style lang=\"scss\" scoped>\n .x-sliding-panel {\n align-items: center;\n display: flex;\n flex-flow: row nowrap;\n height: 100%;\n position: relative;\n\n &__button {\n opacity: 0;\n pointer-events: none;\n position: absolute;\n transition: all ease-out 0.2s;\n z-index: 2; /* To overlay the design system gradient with z-index:1 */\n }\n .x-sliding-panel-button-left {\n left: 0;\n }\n\n .x-sliding-panel-button-right {\n right: 0;\n }\n\n &__scroll {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none; // Firefox\n -ms-overflow-style: none; // IE\n\n // Chrome, Edge & Safari\n &::-webkit-scrollbar {\n display: none;\n }\n\n > * {\n flex: 0 0 auto;\n }\n }\n\n &:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-start) {\n .x-sliding-panel-button-left {\n opacity: 1;\n pointer-events: all;\n }\n }\n\n &:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-end) {\n .x-sliding-panel-button-right {\n opacity: 1;\n pointer-events: all;\n }\n }\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nSimplest implementation of the component, just a list-based component inside its slot.\n\n```vue\n<template>\n <SlidingPanel>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel\n }\n };\n</script>\n\n<style>\n .x-sliding-panel {\n width: 200px;\n }\n\n .item {\n display: inline-block;\n width: 100px;\n }\n</style>\n```\n\n### Play with props\n\n#### Modifying scroll buttons travel distance\n\nEdit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`\nprop.\n\n```vue\n<template>\n <SlidingPanel :scrollFactor=\"1.5\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel\n }\n };\n</script>\n\n<style>\n .x-sliding-panel {\n width: 200px;\n }\n\n .item {\n display: inline-block;\n width: 100px;\n }\n</style>\n```\n\n#### Hiding scroll buttons\n\nHide the navigational buttons completely by setting the `showButtons` prop to `false`. This is\nintended to be used when other scrolling options are available, like in mobile, where you can scroll\njust by swiping.\n\n```vue\n<template>\n <SlidingPanel :showButtons=\"false\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel\n }\n };\n</script>\n\n<style>\n .x-sliding-panel {\n width: 200px;\n }\n\n .item {\n display: inline-block;\n width: 100px;\n }\n</style>\n```\n\n#### Customizing the content with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\nThe `scrollContainerClass` prop can be used to add classes to the scroll content.\n\n```vue\n<template>\n <SlidingPanel buttonClass=\"x-button--round\" scrollContainerClass=\"x-sliding-panel-fade\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel\n }\n };\n</script>\n\n<style>\n .x-sliding-panel {\n width: 200px;\n }\n\n .item {\n display: inline-block;\n width: 100px;\n }\n</style>\n```\n\n#### Disabling reset the scroll when content changes\n\nBy default, whenever the content of the sliding panel changes, it auto resets its scroll position.\nYou can disable this behavior setting the `resetOnContentChange` prop to `false`.\n\n```vue\n<template>\n <div>\n <button @click=\"items++\">Add item</button>\n <label>\n <input type=\"checkbox\" v-model=\"resetOnContentChange\" />\n Reset content onchange\n </label>\n <SlidingPanel :resetOnContentChange=\"resetOnContentChange\">\n <div class=\"item\" v-for=\"item in items\" :key=\"item\">Item {{ item }}</div>\n </SlidingPanel>\n </div>\n</template>\n\n<script>\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel\n },\n data() {\n return {\n items: 4,\n resetOnContentChange: false\n };\n }\n };\n</script>\n\n<style>\n .x-sliding-panel {\n width: 200px;\n }\n\n .item {\n display: inline-block;\n width: 100px;\n }\n</style>\n```\n\n## Extending the component\n\n### Overriding Button content\n\nBy default the buttons show an arrow depicting the direction the scroll would go to when clicked,\nbut this content can be customized with anything, from characters to SVG and images.\n\n```vue\n<template>\n <SlidingPanel>\n <template #sliding-panel-left-button>Left</template>\n <template #default>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </template>\n <template #sliding-panel-right-button>Right</template>\n </SlidingPanel>\n</template>\n\n<script>\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel\n }\n };\n</script>\n\n<style>\n .x-sliding-panel {\n width: 200px;\n }\n\n .item {\n display: inline-block;\n width: 100px;\n }\n</style>\n```\n</docs>\n"],"names":[],"mappings":";;;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sliding-panel.vue.js","sources":["../../../src/components/sliding-panel.vue"],"sourcesContent":["<template>\n <div v-if=\"$slots.default\" class=\"x-sliding-panel\" :class=\"cssClasses\" data-test=\"sliding-panel\">\n <button\n v-if=\"showButtons\"\n @click=\"scrollLeft\"\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-left\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-left-button\"\n >\n <!-- @slot Left button content -->\n <slot name=\"sliding-panel-left-button\">ᐸ</slot>\n </button>\n <div\n ref=\"scrollContainer\"\n @scroll=\"debouncedUpdateScrollPosition\"\n @transitionend=\"debouncedUpdateScrollPosition\"\n @animationend=\"debouncedUpdateScrollPosition\"\n :class=\"scrollContainerClass\"\n class=\"x-list x-list--horizontal x-sliding-panel__scroll\"\n data-test=\"sliding-panel-scroll\"\n >\n <!-- @slot (Required) Sliding panel content -->\n <slot />\n </div>\n <button\n v-if=\"showButtons\"\n @click=\"scrollRight\"\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-right\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-right-button\"\n >\n <!-- @slot Right button content -->\n <slot name=\"sliding-panel-right-button\">ᐳ</slot>\n </button>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { Component, Mixins, Prop } from 'vue-property-decorator';\n import { VueCSSClasses } from '../utils/types';\n import { Debounce } from './decorators/debounce.decorators';\n import { dynamicPropsMixin } from './dynamic-props.mixin';\n\n /**\n * This component allows for any other component or element inside it to be horizontally\n * navigable. It also implements customizable buttons as well as other minor customizations to its\n * general behavior.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\n @Component\n export default class SlidingPanel extends Mixins(\n dynamicPropsMixin(['buttonClass', 'scrollContainerClass'])\n ) {\n /**\n * Scroll factor that will dictate how much the scroll moves when pressing a navigation button.\n *\n * @public\n */\n @Prop({ default: 0.7 })\n public scrollFactor!: number;\n\n /**\n * Would make the navigation buttons visible when they're needed or always hide them.\n *\n * @public\n */\n @Prop({ default: true })\n public showButtons!: boolean;\n\n /**\n * When true, whenever the DOM content in the sliding panel slot changes, it will reset\n * the scroll position to 0.\n *\n * @public\n */\n @Prop({ default: true })\n public resetOnContentChange!: boolean;\n\n /**\n * Indicates if the scroll is at the start of the sliding panel.\n *\n * @internal\n */\n protected isScrollAtStart = true;\n\n /**\n * Indicates if the scroll is at the end of the sliding panel.\n *\n * @internal\n */\n protected isScrollAtEnd = true;\n\n /**\n * HTMLElement referencing the scroll of the component.\n *\n * @internal\n */\n public $refs!: {\n scrollContainer: HTMLElement;\n };\n\n /**\n * CSS classes to apply based on the scroll position.\n *\n * @returns The CSS classes to apply.\n *\n * @internal\n */\n protected get cssClasses(): VueCSSClasses {\n return {\n 'x-sliding-panel-at-start': this.isScrollAtStart,\n 'x-sliding-panel-at-end': this.isScrollAtEnd\n };\n }\n\n /**\n * Initialises browser platform code:\n * - Creates a mutation observer to detect content changes and reset scroll position.\n * - Stores initial size and scroll position values.\n *\n * @internal\n */\n mounted(): void {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const resizeObserver = new ResizeObserver(this.debouncedUpdateScrollPosition);\n resizeObserver.observe(this.$el);\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const contentChangedObserver = new MutationObserver(this.restoreAndUpdateScroll);\n this.$watch(\n () => this.resetOnContentChange,\n shouldReset => {\n if (shouldReset) {\n contentChangedObserver.observe(this.$refs.scrollContainer, {\n attributes: false,\n childList: true,\n subtree: true,\n characterData: false\n });\n } else {\n contentChangedObserver.disconnect();\n }\n },\n { immediate: true }\n );\n this.$on('hook:beforeDestroy', () => {\n contentChangedObserver.disconnect();\n resizeObserver.disconnect();\n });\n\n this.updateScrollPosition();\n }\n\n /**\n * Resets the scroll and updates the values of the scroll for the buttons to react.\n *\n * @internal\n */\n @Debounce(100, { leading: true })\n restoreAndUpdateScroll(): void {\n this.$refs.scrollContainer.scroll({ left: 0, behavior: 'smooth' });\n this.updateScrollPosition();\n }\n\n /**\n * Updates the values of the scroll positions to show or hide the buttons depending on it.\n *\n * @internal\n */\n protected updateScrollPosition(): void {\n if (this.$refs.scrollContainer !== undefined) {\n const { scrollLeft, clientWidth, scrollWidth } = this.$refs.scrollContainer;\n this.isScrollAtStart = !scrollLeft;\n /* The 2 px extra is to fix some cases in some resolutions where the scroll + client size is\n * less than the scroll width even when the scroll is at the end */\n this.isScrollAtEnd = scrollLeft + clientWidth + 2 >= scrollWidth;\n }\n }\n\n /**\n * Debounced version of the {@link SlidingPanel.updateScrollPosition | updateScrollPosition}\n * method.\n *\n * @internal\n */\n @Debounce(100, { leading: true })\n debouncedUpdateScrollPosition(): void {\n this.updateScrollPosition();\n }\n\n /**\n * Scrolls the wrapper element to the left.\n *\n * @internal\n */\n protected scrollLeft(): void {\n this.scrollTo(-this.$refs.scrollContainer.clientWidth);\n }\n\n /**\n * Scrolls the wrapper element to the right.\n *\n * @internal\n */\n protected scrollRight(): void {\n this.scrollTo(this.$refs.scrollContainer.clientWidth);\n }\n\n /**\n * Scrolls the wrapper element towards the provided scroll value.\n *\n * @param scrollValue - The value the scroll will go towards.\n *\n * @internal\n */\n protected scrollTo(scrollValue: number): void {\n this.$refs.scrollContainer.scrollBy({\n left: scrollValue * this.scrollFactor,\n behavior: 'smooth'\n });\n }\n }\n</script>\n\n<style lang=\"scss\" scoped>\n .x-sliding-panel {\n align-items: center;\n display: flex;\n flex-flow: row nowrap;\n position: relative;\n\n &__button {\n opacity: 0;\n pointer-events: none;\n position: absolute;\n transition: all ease-out 0.2s;\n z-index: 2; /* To overlay the design system gradient with z-index:1 */\n }\n .x-sliding-panel-button-left {\n left: 0;\n }\n\n .x-sliding-panel-button-right {\n right: 0;\n }\n\n &__scroll {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none; // Firefox\n -ms-overflow-style: none; // IE\n\n // Chrome, Edge & Safari\n &::-webkit-scrollbar {\n display: none;\n }\n\n > * {\n flex: 0 0 auto;\n }\n }\n\n &:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-start) {\n .x-sliding-panel-button-left {\n opacity: 1;\n pointer-events: all;\n }\n }\n\n &:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-end) {\n .x-sliding-panel-button-right {\n opacity: 1;\n pointer-events: all;\n }\n }\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nSimplest implementation of the component, just a list-based component inside its slot.\n\n```vue\n<template>\n <SlidingPanel>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel\n }\n };\n</script>\n\n<style>\n .x-sliding-panel {\n width: 200px;\n }\n\n .item {\n display: inline-block;\n width: 100px;\n }\n</style>\n```\n\n### Play with props\n\n#### Modifying scroll buttons travel distance\n\nEdit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`\nprop.\n\n```vue\n<template>\n <SlidingPanel :scrollFactor=\"1.5\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel\n }\n };\n</script>\n\n<style>\n .x-sliding-panel {\n width: 200px;\n }\n\n .item {\n display: inline-block;\n width: 100px;\n }\n</style>\n```\n\n#### Hiding scroll buttons\n\nHide the navigational buttons completely by setting the `showButtons` prop to `false`. This is\nintended to be used when other scrolling options are available, like in mobile, where you can scroll\njust by swiping.\n\n```vue\n<template>\n <SlidingPanel :showButtons=\"false\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel\n }\n };\n</script>\n\n<style>\n .x-sliding-panel {\n width: 200px;\n }\n\n .item {\n display: inline-block;\n width: 100px;\n }\n</style>\n```\n\n#### Customizing the content with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\nThe `scrollContainerClass` prop can be used to add classes to the scroll content.\n\n```vue\n<template>\n <SlidingPanel buttonClass=\"x-button--round\" scrollContainerClass=\"x-sliding-panel-fade\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel\n }\n };\n</script>\n\n<style>\n .x-sliding-panel {\n width: 200px;\n }\n\n .item {\n display: inline-block;\n width: 100px;\n }\n</style>\n```\n\n#### Disabling reset the scroll when content changes\n\nBy default, whenever the content of the sliding panel changes, it auto resets its scroll position.\nYou can disable this behavior setting the `resetOnContentChange` prop to `false`.\n\n```vue\n<template>\n <div>\n <button @click=\"items++\">Add item</button>\n <label>\n <input type=\"checkbox\" v-model=\"resetOnContentChange\" />\n Reset content onchange\n </label>\n <SlidingPanel :resetOnContentChange=\"resetOnContentChange\">\n <div class=\"item\" v-for=\"item in items\" :key=\"item\">Item {{ item }}</div>\n </SlidingPanel>\n </div>\n</template>\n\n<script>\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel\n },\n data() {\n return {\n items: 4,\n resetOnContentChange: false\n };\n }\n };\n</script>\n\n<style>\n .x-sliding-panel {\n width: 200px;\n }\n\n .item {\n display: inline-block;\n width: 100px;\n }\n</style>\n```\n\n## Extending the component\n\n### Overriding Button content\n\nBy default the buttons show an arrow depicting the direction the scroll would go to when clicked,\nbut this content can be customized with anything, from characters to SVG and images.\n\n```vue\n<template>\n <SlidingPanel>\n <template #sliding-panel-left-button>Left</template>\n <template #default>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </template>\n <template #sliding-panel-right-button>Right</template>\n </SlidingPanel>\n</template>\n\n<script>\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel\n }\n };\n</script>\n\n<style>\n .x-sliding-panel {\n width: 200px;\n }\n\n .item {\n display: inline-block;\n width: 100px;\n }\n</style>\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-sliding-panel[data-v-
|
|
3
|
+
var css = ".x-sliding-panel[data-v-5b52bd92] {\n align-items: center;\n display: flex;\n flex-flow: row nowrap;\n position: relative;\n}\n.x-sliding-panel__button[data-v-5b52bd92] {\n opacity: 0;\n pointer-events: none;\n position: absolute;\n transition: all ease-out 0.2s;\n z-index: 2; /* To overlay the design system gradient with z-index:1 */\n}\n.x-sliding-panel .x-sliding-panel-button-left[data-v-5b52bd92] {\n left: 0;\n}\n.x-sliding-panel .x-sliding-panel-button-right[data-v-5b52bd92] {\n right: 0;\n}\n.x-sliding-panel__scroll[data-v-5b52bd92] {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n.x-sliding-panel__scroll[data-v-5b52bd92]::-webkit-scrollbar {\n display: none;\n}\n.x-sliding-panel__scroll > *[data-v-5b52bd92] {\n flex: 0 0 auto;\n}\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-start) .x-sliding-panel-button-left[data-v-5b52bd92] {\n opacity: 1;\n pointer-events: all;\n}\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-end) .x-sliding-panel-button-right[data-v-5b52bd92] {\n opacity: 1;\n pointer-events: all;\n}";
|
|
4
4
|
const isBrowser = /*#__PURE__*/ (function () {
|
|
5
5
|
return (
|
|
6
6
|
Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) !==
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empathyco/x-components",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.314",
|
|
4
4
|
"description": "Empathy X Components",
|
|
5
5
|
"author": "Empathy Systems Corporation S.L.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@bahmutov/cypress-esbuild-preprocessor": "~2.1.5",
|
|
92
92
|
"@cypress/vue": "~2.2.4",
|
|
93
93
|
"@empathyco/x-adapter-platform": "^1.0.0-alpha.63",
|
|
94
|
-
"@empathyco/x-tailwindcss": "^1.0.0-alpha.
|
|
94
|
+
"@empathyco/x-tailwindcss": "^1.0.0-alpha.6",
|
|
95
95
|
"@microsoft/api-documenter": "~7.21.3",
|
|
96
96
|
"@microsoft/api-extractor": "~7.33.7",
|
|
97
97
|
"@rollup/plugin-commonjs": "~24.0.0",
|
|
@@ -141,5 +141,5 @@
|
|
|
141
141
|
"access": "public",
|
|
142
142
|
"directory": "dist"
|
|
143
143
|
},
|
|
144
|
-
"gitHead": "
|
|
144
|
+
"gitHead": "6e267470efdcef5c24fe6c1f94296596187017b1"
|
|
145
145
|
}
|