@mekari/pixel3-scrollbar 0.1.0-dev.0 → 0.1.0-dev.2

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.
@@ -8,7 +8,7 @@ var scrollbarProps = {
8
8
  default: () => {
9
9
  return {
10
10
  overflow: {
11
- x: "scroll",
11
+ x: "hide",
12
12
  y: "scroll"
13
13
  },
14
14
  scrollbars: {
@@ -0,0 +1,77 @@
1
+ import {
2
+ __name,
3
+ scrollbarProps
4
+ } from "./chunk-2PBD4DCT.mjs";
5
+
6
+ // src/scrollbar.tsx
7
+ import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
8
+ import { defineComponent, onMounted, ref, computed } from "vue";
9
+ import { useOverlayScrollbars } from "overlayscrollbars-vue";
10
+ import { scrollbarRecipe } from "@mekari/pixel3-styled-system/recipes";
11
+ import { css, cx } from "@mekari/pixel3-styled-system/css";
12
+ import { splitCssProps } from "@mekari/pixel3-styled-system/jsx";
13
+ import { merge } from "lodash-es";
14
+ var MpScrollbar = defineComponent({
15
+ name: "MpScrollbar",
16
+ props: scrollbarProps,
17
+ inheritAttrs: false,
18
+ emits: ["initialized", "scroll"],
19
+ setup(props, {
20
+ slots,
21
+ attrs,
22
+ emit
23
+ }) {
24
+ const wrapperRef = ref();
25
+ const [cssProps, restProps] = splitCssProps(attrs);
26
+ const classes = computed(() => {
27
+ return cx(scrollbarRecipe(), css({
28
+ ...cssProps
29
+ }));
30
+ });
31
+ const basicOptions = {
32
+ overflow: {
33
+ x: "hide",
34
+ y: "scroll"
35
+ },
36
+ scrollbars: {
37
+ autoHide: "scroll",
38
+ autoHideDelay: 1e3
39
+ }
40
+ };
41
+ const mergedOptions = merge(basicOptions, props.options);
42
+ const [initialize] = useOverlayScrollbars({
43
+ defer: true,
44
+ options: mergedOptions,
45
+ events: {
46
+ initialized: (e) => activateEvent("initialized", e),
47
+ scroll: (e) => activateEvent("scroll", e)
48
+ }
49
+ });
50
+ onMounted(() => {
51
+ if (wrapperRef.value) {
52
+ initialize({
53
+ target: wrapperRef.value
54
+ });
55
+ }
56
+ });
57
+ function activateEvent(type, event) {
58
+ if (!event) {
59
+ return;
60
+ }
61
+ emit(type, event);
62
+ }
63
+ __name(activateEvent, "activateEvent");
64
+ return () => {
65
+ const children = slots.default && slots.default();
66
+ return _createVNode("div", _mergeProps({
67
+ "data-pixel-component": "MpScrollbar",
68
+ "ref": wrapperRef,
69
+ "class": classes.value
70
+ }, restProps), [children]);
71
+ };
72
+ }
73
+ });
74
+
75
+ export {
76
+ MpScrollbar
77
+ };
package/dist/index.js CHANGED
@@ -29,8 +29,10 @@ module.exports = __toCommonJS(src_exports);
29
29
  var import_vue = require("vue");
30
30
  var import_vue2 = require("vue");
31
31
  var import_overlayscrollbars_vue = require("overlayscrollbars-vue");
32
- var import_jsx = require("@mekari/pixel3-styled-system/jsx");
32
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
33
33
  var import_css = require("@mekari/pixel3-styled-system/css");
34
+ var import_jsx = require("@mekari/pixel3-styled-system/jsx");
35
+ var import_lodash_es = require("lodash-es");
34
36
 
35
37
  // src/modules/scrollbar.props.ts
36
38
  var scrollbarProps = {
@@ -39,7 +41,7 @@ var scrollbarProps = {
39
41
  default: () => {
40
42
  return {
41
43
  overflow: {
42
- x: "scroll",
44
+ x: "hide",
43
45
  y: "scroll"
44
46
  },
45
47
  scrollbars: {
@@ -52,39 +54,37 @@ var scrollbarProps = {
52
54
  };
53
55
 
54
56
  // src/scrollbar.tsx
55
- var import_overlayscrollbars = require("overlayscrollbars/overlayscrollbars.css");
56
- function _isSlot(s) {
57
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, import_vue.isVNode)(s);
58
- }
59
- __name(_isSlot, "_isSlot");
60
57
  var MpScrollbar = (0, import_vue2.defineComponent)({
61
58
  name: "MpScrollbar",
62
59
  props: scrollbarProps,
60
+ inheritAttrs: false,
63
61
  emits: ["initialized", "scroll"],
64
62
  setup(props, {
65
63
  slots,
64
+ attrs,
66
65
  emit
67
66
  }) {
68
67
  const wrapperRef = (0, import_vue2.ref)();
69
- const wrapperClass = (0, import_vue2.computed)(() => {
70
- return (0, import_css.css)({
71
- "& .os-scrollbar": {
72
- "--os-handle-bg": "colors.gray.100!",
73
- "--os-handle-bg-hover": "colors.gray.400!",
74
- "--os-handle-bg-active": "colors.gray.400!"
75
- },
76
- _nextTheme: {
77
- "& .os-scrollbar": {
78
- "--os-handle-bg": "colors.icon.subtle!",
79
- "--os-handle-bg-hover": "colors.icon.default!",
80
- "--os-handle-bg-active": "colors.icon.default!"
81
- }
82
- }
83
- });
68
+ const [cssProps, restProps] = (0, import_jsx.splitCssProps)(attrs);
69
+ const classes = (0, import_vue2.computed)(() => {
70
+ return (0, import_css.cx)((0, import_recipes.scrollbarRecipe)(), (0, import_css.css)({
71
+ ...cssProps
72
+ }));
84
73
  });
74
+ const basicOptions = {
75
+ overflow: {
76
+ x: "hide",
77
+ y: "scroll"
78
+ },
79
+ scrollbars: {
80
+ autoHide: "scroll",
81
+ autoHideDelay: 1e3
82
+ }
83
+ };
84
+ const mergedOptions = (0, import_lodash_es.merge)(basicOptions, props.options);
85
85
  const [initialize] = (0, import_overlayscrollbars_vue.useOverlayScrollbars)({
86
86
  defer: true,
87
- options: props.options,
87
+ options: mergedOptions,
88
88
  events: {
89
89
  initialized: (e) => activateEvent("initialized", e),
90
90
  scroll: (e) => activateEvent("scroll", e)
@@ -93,7 +93,7 @@ var MpScrollbar = (0, import_vue2.defineComponent)({
93
93
  (0, import_vue2.onMounted)(() => {
94
94
  if (wrapperRef.value) {
95
95
  initialize({
96
- target: wrapperRef.value.$el
96
+ target: wrapperRef.value
97
97
  });
98
98
  }
99
99
  });
@@ -106,13 +106,11 @@ var MpScrollbar = (0, import_vue2.defineComponent)({
106
106
  __name(activateEvent, "activateEvent");
107
107
  return () => {
108
108
  const children = slots.default && slots.default();
109
- return (0, import_vue.createVNode)(import_jsx.Pixel.div, {
110
- "ref": wrapperRef,
109
+ return (0, import_vue.createVNode)("div", (0, import_vue.mergeProps)({
111
110
  "data-pixel-component": "MpScrollbar",
112
- "class": wrapperClass.value
113
- }, _isSlot(children) ? children : {
114
- default: () => [children]
115
- });
111
+ "ref": wrapperRef,
112
+ "class": classes.value
113
+ }, restProps), [children]);
116
114
  };
117
115
  }
118
116
  });
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MpScrollbar
3
- } from "./chunk-3YFVWLNU.mjs";
4
- import "./chunk-TYS4GN6M.mjs";
3
+ } from "./chunk-4UVXXKIM.mjs";
4
+ import "./chunk-2PBD4DCT.mjs";
5
5
  export {
6
6
  MpScrollbar
7
7
  };
@@ -1 +1 @@
1
- {"inputs":{"src/modules/scrollbar.props.ts":{"bytes":373,"imports":[],"format":"esm"},"src/scrollbar.tsx":{"bytes":2281,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"overlayscrollbars-vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/jsx","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"import-statement","external":true},{"path":"src/modules/scrollbar.props.ts","kind":"import-statement","original":"./modules/scrollbar.props"},{"path":"overlayscrollbars/overlayscrollbars.css","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":127,"imports":[{"path":"src/scrollbar.tsx","kind":"import-statement","original":"./scrollbar"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"overlayscrollbars-vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/jsx","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true},{"path":"overlayscrollbars/overlayscrollbars.css","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":127},"src/scrollbar.tsx":{"bytesInOutput":2247},"src/modules/scrollbar.props.ts":{"bytesInOutput":279}},"bytes":3743},"dist/scrollbar.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"overlayscrollbars-vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/jsx","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true},{"path":"overlayscrollbars/overlayscrollbars.css","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/scrollbar.tsx","inputs":{"src/scrollbar.tsx":{"bytesInOutput":2392},"src/modules/scrollbar.props.ts":{"bytesInOutput":279}},"bytes":3744},"dist/modules/scrollbar.props.js":{"imports":[],"exports":[],"entryPoint":"src/modules/scrollbar.props.ts","inputs":{"src/modules/scrollbar.props.ts":{"bytesInOutput":448}},"bytes":1390}}}
1
+ {"inputs":{"src/modules/scrollbar.props.ts":{"bytes":371,"imports":[],"format":"esm"},"src/scrollbar.tsx":{"bytes":2184,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"overlayscrollbars-vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/jsx","kind":"import-statement","external":true},{"path":"lodash-es","kind":"import-statement","external":true},{"path":"src/modules/scrollbar.props.ts","kind":"import-statement","original":"./modules/scrollbar.props"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":127,"imports":[{"path":"src/scrollbar.tsx","kind":"import-statement","original":"./scrollbar"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"overlayscrollbars-vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/jsx","kind":"require-call","external":true},{"path":"lodash-es","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":127},"src/scrollbar.tsx":{"bytesInOutput":2057},"src/modules/scrollbar.props.ts":{"bytesInOutput":277}},"bytes":3551},"dist/scrollbar.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"overlayscrollbars-vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/jsx","kind":"require-call","external":true},{"path":"lodash-es","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/scrollbar.tsx","inputs":{"src/scrollbar.tsx":{"bytesInOutput":2202},"src/modules/scrollbar.props.ts":{"bytesInOutput":277}},"bytes":3552},"dist/modules/scrollbar.props.js":{"imports":[],"exports":[],"entryPoint":"src/modules/scrollbar.props.ts","inputs":{"src/modules/scrollbar.props.ts":{"bytesInOutput":446}},"bytes":1388}}}
@@ -1 +1 @@
1
- {"inputs":{"src/modules/scrollbar.props.ts":{"bytes":373,"imports":[],"format":"esm"},"src/scrollbar.tsx":{"bytes":2281,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"overlayscrollbars-vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/jsx","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"import-statement","external":true},{"path":"src/modules/scrollbar.props.ts","kind":"import-statement","original":"./modules/scrollbar.props"},{"path":"overlayscrollbars/overlayscrollbars.css","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":127,"imports":[{"path":"src/scrollbar.tsx","kind":"import-statement","original":"./scrollbar"}],"format":"esm"}},"outputs":{"dist/index.mjs":{"imports":[{"path":"dist/chunk-3YFVWLNU.mjs","kind":"import-statement"},{"path":"dist/chunk-TYS4GN6M.mjs","kind":"import-statement"}],"exports":["MpScrollbar"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":111},"dist/scrollbar.mjs":{"imports":[{"path":"dist/chunk-3YFVWLNU.mjs","kind":"import-statement"},{"path":"dist/chunk-TYS4GN6M.mjs","kind":"import-statement"}],"exports":["MpScrollbar"],"entryPoint":"src/scrollbar.tsx","inputs":{},"bytes":111},"dist/chunk-3YFVWLNU.mjs":{"imports":[{"path":"dist/chunk-TYS4GN6M.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"overlayscrollbars-vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/jsx","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"import-statement","external":true},{"path":"overlayscrollbars/overlayscrollbars.css","kind":"import-statement","external":true}],"exports":["MpScrollbar"],"inputs":{"src/scrollbar.tsx":{"bytesInOutput":2108}},"bytes":2224},"dist/modules/scrollbar.props.mjs":{"imports":[{"path":"dist/chunk-TYS4GN6M.mjs","kind":"import-statement"}],"exports":["scrollbarProps"],"entryPoint":"src/modules/scrollbar.props.ts","inputs":{},"bytes":87},"dist/chunk-TYS4GN6M.mjs":{"imports":[],"exports":["__name","scrollbarProps"],"inputs":{"src/modules/scrollbar.props.ts":{"bytesInOutput":279}},"bytes":483}}}
1
+ {"inputs":{"src/modules/scrollbar.props.ts":{"bytes":371,"imports":[],"format":"esm"},"src/scrollbar.tsx":{"bytes":2184,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"overlayscrollbars-vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/jsx","kind":"import-statement","external":true},{"path":"lodash-es","kind":"import-statement","external":true},{"path":"src/modules/scrollbar.props.ts","kind":"import-statement","original":"./modules/scrollbar.props"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":127,"imports":[{"path":"src/scrollbar.tsx","kind":"import-statement","original":"./scrollbar"}],"format":"esm"}},"outputs":{"dist/index.mjs":{"imports":[{"path":"dist/chunk-4UVXXKIM.mjs","kind":"import-statement"},{"path":"dist/chunk-2PBD4DCT.mjs","kind":"import-statement"}],"exports":["MpScrollbar"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":111},"dist/scrollbar.mjs":{"imports":[{"path":"dist/chunk-4UVXXKIM.mjs","kind":"import-statement"},{"path":"dist/chunk-2PBD4DCT.mjs","kind":"import-statement"}],"exports":["MpScrollbar"],"entryPoint":"src/scrollbar.tsx","inputs":{},"bytes":111},"dist/chunk-4UVXXKIM.mjs":{"imports":[{"path":"dist/chunk-2PBD4DCT.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"overlayscrollbars-vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/jsx","kind":"import-statement","external":true},{"path":"lodash-es","kind":"import-statement","external":true}],"exports":["MpScrollbar"],"inputs":{"src/scrollbar.tsx":{"bytesInOutput":1898}},"bytes":2014},"dist/modules/scrollbar.props.mjs":{"imports":[{"path":"dist/chunk-2PBD4DCT.mjs","kind":"import-statement"}],"exports":["scrollbarProps"],"entryPoint":"src/modules/scrollbar.props.ts","inputs":{},"bytes":87},"dist/chunk-2PBD4DCT.mjs":{"imports":[],"exports":["__name","scrollbarProps"],"inputs":{"src/modules/scrollbar.props.ts":{"bytesInOutput":277}},"bytes":481}}}
@@ -29,7 +29,7 @@ var scrollbarProps = {
29
29
  default: () => {
30
30
  return {
31
31
  overflow: {
32
- x: "scroll",
32
+ x: "hide",
33
33
  y: "scroll"
34
34
  },
35
35
  scrollbars: {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  scrollbarProps
3
- } from "../chunk-TYS4GN6M.mjs";
3
+ } from "../chunk-2PBD4DCT.mjs";
4
4
  export {
5
5
  scrollbarProps
6
6
  };
@@ -15,7 +15,7 @@ declare const MpScrollbar: vue.DefineComponent<vue.ExtractPropTypes<{
15
15
  };
16
16
  };
17
17
  };
18
- }>, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("initialized" | "scroll")[], "initialized" | "scroll", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
18
+ }>, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("scroll" | "initialized")[], "scroll" | "initialized", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
19
19
  options: {
20
20
  type: ObjectConstructor;
21
21
  default: () => {
@@ -30,8 +30,8 @@ declare const MpScrollbar: vue.DefineComponent<vue.ExtractPropTypes<{
30
30
  };
31
31
  };
32
32
  }>> & Readonly<{
33
- onInitialized?: ((...args: any[]) => any) | undefined;
34
33
  onScroll?: ((...args: any[]) => any) | undefined;
34
+ onInitialized?: ((...args: any[]) => any) | undefined;
35
35
  }>, {
36
36
  options: Record<string, any>;
37
37
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
@@ -15,7 +15,7 @@ declare const MpScrollbar: vue.DefineComponent<vue.ExtractPropTypes<{
15
15
  };
16
16
  };
17
17
  };
18
- }>, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("initialized" | "scroll")[], "initialized" | "scroll", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
18
+ }>, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("scroll" | "initialized")[], "scroll" | "initialized", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
19
19
  options: {
20
20
  type: ObjectConstructor;
21
21
  default: () => {
@@ -30,8 +30,8 @@ declare const MpScrollbar: vue.DefineComponent<vue.ExtractPropTypes<{
30
30
  };
31
31
  };
32
32
  }>> & Readonly<{
33
- onInitialized?: ((...args: any[]) => any) | undefined;
34
33
  onScroll?: ((...args: any[]) => any) | undefined;
34
+ onInitialized?: ((...args: any[]) => any) | undefined;
35
35
  }>, {
36
36
  options: Record<string, any>;
37
37
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
package/dist/scrollbar.js CHANGED
@@ -27,8 +27,10 @@ module.exports = __toCommonJS(scrollbar_exports);
27
27
  var import_vue = require("vue");
28
28
  var import_vue2 = require("vue");
29
29
  var import_overlayscrollbars_vue = require("overlayscrollbars-vue");
30
- var import_jsx = require("@mekari/pixel3-styled-system/jsx");
30
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
31
31
  var import_css = require("@mekari/pixel3-styled-system/css");
32
+ var import_jsx = require("@mekari/pixel3-styled-system/jsx");
33
+ var import_lodash_es = require("lodash-es");
32
34
 
33
35
  // src/modules/scrollbar.props.ts
34
36
  var scrollbarProps = {
@@ -37,7 +39,7 @@ var scrollbarProps = {
37
39
  default: () => {
38
40
  return {
39
41
  overflow: {
40
- x: "scroll",
42
+ x: "hide",
41
43
  y: "scroll"
42
44
  },
43
45
  scrollbars: {
@@ -50,39 +52,37 @@ var scrollbarProps = {
50
52
  };
51
53
 
52
54
  // src/scrollbar.tsx
53
- var import_overlayscrollbars = require("overlayscrollbars/overlayscrollbars.css");
54
- function _isSlot(s) {
55
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, import_vue.isVNode)(s);
56
- }
57
- __name(_isSlot, "_isSlot");
58
55
  var MpScrollbar = (0, import_vue2.defineComponent)({
59
56
  name: "MpScrollbar",
60
57
  props: scrollbarProps,
58
+ inheritAttrs: false,
61
59
  emits: ["initialized", "scroll"],
62
60
  setup(props, {
63
61
  slots,
62
+ attrs,
64
63
  emit
65
64
  }) {
66
65
  const wrapperRef = (0, import_vue2.ref)();
67
- const wrapperClass = (0, import_vue2.computed)(() => {
68
- return (0, import_css.css)({
69
- "& .os-scrollbar": {
70
- "--os-handle-bg": "colors.gray.100!",
71
- "--os-handle-bg-hover": "colors.gray.400!",
72
- "--os-handle-bg-active": "colors.gray.400!"
73
- },
74
- _nextTheme: {
75
- "& .os-scrollbar": {
76
- "--os-handle-bg": "colors.icon.subtle!",
77
- "--os-handle-bg-hover": "colors.icon.default!",
78
- "--os-handle-bg-active": "colors.icon.default!"
79
- }
80
- }
81
- });
66
+ const [cssProps, restProps] = (0, import_jsx.splitCssProps)(attrs);
67
+ const classes = (0, import_vue2.computed)(() => {
68
+ return (0, import_css.cx)((0, import_recipes.scrollbarRecipe)(), (0, import_css.css)({
69
+ ...cssProps
70
+ }));
82
71
  });
72
+ const basicOptions = {
73
+ overflow: {
74
+ x: "hide",
75
+ y: "scroll"
76
+ },
77
+ scrollbars: {
78
+ autoHide: "scroll",
79
+ autoHideDelay: 1e3
80
+ }
81
+ };
82
+ const mergedOptions = (0, import_lodash_es.merge)(basicOptions, props.options);
83
83
  const [initialize] = (0, import_overlayscrollbars_vue.useOverlayScrollbars)({
84
84
  defer: true,
85
- options: props.options,
85
+ options: mergedOptions,
86
86
  events: {
87
87
  initialized: (e) => activateEvent("initialized", e),
88
88
  scroll: (e) => activateEvent("scroll", e)
@@ -91,7 +91,7 @@ var MpScrollbar = (0, import_vue2.defineComponent)({
91
91
  (0, import_vue2.onMounted)(() => {
92
92
  if (wrapperRef.value) {
93
93
  initialize({
94
- target: wrapperRef.value.$el
94
+ target: wrapperRef.value
95
95
  });
96
96
  }
97
97
  });
@@ -104,13 +104,11 @@ var MpScrollbar = (0, import_vue2.defineComponent)({
104
104
  __name(activateEvent, "activateEvent");
105
105
  return () => {
106
106
  const children = slots.default && slots.default();
107
- return (0, import_vue.createVNode)(import_jsx.Pixel.div, {
108
- "ref": wrapperRef,
107
+ return (0, import_vue.createVNode)("div", (0, import_vue.mergeProps)({
109
108
  "data-pixel-component": "MpScrollbar",
110
- "class": wrapperClass.value
111
- }, _isSlot(children) ? children : {
112
- default: () => [children]
113
- });
109
+ "ref": wrapperRef,
110
+ "class": classes.value
111
+ }, restProps), [children]);
114
112
  };
115
113
  }
116
114
  });
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MpScrollbar
3
- } from "./chunk-3YFVWLNU.mjs";
4
- import "./chunk-TYS4GN6M.mjs";
3
+ } from "./chunk-4UVXXKIM.mjs";
4
+ import "./chunk-2PBD4DCT.mjs";
5
5
  export {
6
6
  MpScrollbar
7
7
  };
package/package.json CHANGED
@@ -1,22 +1,23 @@
1
1
  {
2
2
  "name": "@mekari/pixel3-scrollbar",
3
3
  "description": "Mekari Pixel 3 | Custom scrollbar component",
4
- "version": "0.1.0-dev.0",
4
+ "version": "0.1.0-dev.2",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
7
7
  "files": [
8
8
  "dist"
9
9
  ],
10
10
  "dependencies": {
11
+ "lodash-es": "^4.17.21",
11
12
  "overlayscrollbars-vue": "0.5.9",
12
- "overlayscrollbars": "2.11.1",
13
- "@mekari/pixel3-styled-system": "0.1.3-dev.1",
14
- "@mekari/pixel3-utils": "0.0.7"
13
+ "@mekari/pixel3-utils": "0.0.7",
14
+ "@mekari/pixel3-styled-system": "0.1.3-dev.3"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "vue": "^3.4.9"
18
18
  },
19
19
  "devDependencies": {
20
+ "@types/lodash-es": "^4.17.12",
20
21
  "vue": "^3.4.9"
21
22
  },
22
23
  "publishConfig": {
@@ -1,79 +0,0 @@
1
- import {
2
- __name,
3
- scrollbarProps
4
- } from "./chunk-TYS4GN6M.mjs";
5
-
6
- // src/scrollbar.tsx
7
- import { createVNode as _createVNode, isVNode as _isVNode } from "vue";
8
- import { defineComponent, onMounted, ref, computed } from "vue";
9
- import { useOverlayScrollbars } from "overlayscrollbars-vue";
10
- import { Pixel } from "@mekari/pixel3-styled-system/jsx";
11
- import { css } from "@mekari/pixel3-styled-system/css";
12
- import "overlayscrollbars/overlayscrollbars.css";
13
- function _isSlot(s) {
14
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !_isVNode(s);
15
- }
16
- __name(_isSlot, "_isSlot");
17
- var MpScrollbar = defineComponent({
18
- name: "MpScrollbar",
19
- props: scrollbarProps,
20
- emits: ["initialized", "scroll"],
21
- setup(props, {
22
- slots,
23
- emit
24
- }) {
25
- const wrapperRef = ref();
26
- const wrapperClass = computed(() => {
27
- return css({
28
- "& .os-scrollbar": {
29
- "--os-handle-bg": "colors.gray.100!",
30
- "--os-handle-bg-hover": "colors.gray.400!",
31
- "--os-handle-bg-active": "colors.gray.400!"
32
- },
33
- _nextTheme: {
34
- "& .os-scrollbar": {
35
- "--os-handle-bg": "colors.icon.subtle!",
36
- "--os-handle-bg-hover": "colors.icon.default!",
37
- "--os-handle-bg-active": "colors.icon.default!"
38
- }
39
- }
40
- });
41
- });
42
- const [initialize] = useOverlayScrollbars({
43
- defer: true,
44
- options: props.options,
45
- events: {
46
- initialized: (e) => activateEvent("initialized", e),
47
- scroll: (e) => activateEvent("scroll", e)
48
- }
49
- });
50
- onMounted(() => {
51
- if (wrapperRef.value) {
52
- initialize({
53
- target: wrapperRef.value.$el
54
- });
55
- }
56
- });
57
- function activateEvent(type, event) {
58
- if (!event) {
59
- return;
60
- }
61
- emit(type, event);
62
- }
63
- __name(activateEvent, "activateEvent");
64
- return () => {
65
- const children = slots.default && slots.default();
66
- return _createVNode(Pixel.div, {
67
- "ref": wrapperRef,
68
- "data-pixel-component": "MpScrollbar",
69
- "class": wrapperClass.value
70
- }, _isSlot(children) ? children : {
71
- default: () => [children]
72
- });
73
- };
74
- }
75
- });
76
-
77
- export {
78
- MpScrollbar
79
- };