@onereach/ui-components 2.72.1 → 2.72.2-beta.2260.0

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 (56) hide show
  1. package/dist/bundled/v2/{OrSidebar-c95ef614.js → OrSidebar-64cc9127.js} +92 -86
  2. package/dist/bundled/v2/OrSidebarCollapseButton-fcc085c7.js +235 -0
  3. package/dist/bundled/v2/components/index.js +2 -1
  4. package/dist/bundled/v2/components/or-sidebar-v3/OrSidebar.stories3.d.ts +36 -1
  5. package/dist/bundled/v2/components/or-sidebar-v3/OrSidebar.vue.d.ts +49 -4
  6. package/dist/bundled/v2/components/or-sidebar-v3/index.js +13 -1
  7. package/dist/bundled/v2/components/or-sidebar-v3/partials/OrSidebarCollapseButton.stories3.d.ts +12 -0
  8. package/dist/bundled/v2/components/or-sidebar-v3/partials/OrSidebarCollapseButton.vue.d.ts +53 -0
  9. package/dist/bundled/v2/components/or-sidebar-v3/partials/index.d.ts +1 -0
  10. package/dist/bundled/v2/components/or-sidebar-v3/partials/index.js +18 -0
  11. package/dist/bundled/v2/components/or-sidebar-v3/styles.d.ts +9 -1
  12. package/dist/bundled/v2/index.js +3 -2
  13. package/dist/bundled/v3/{OrSidebar.vue_vue_type_script_lang-ce0b152c.js → OrSidebar.vue_vue_type_script_lang-a150808b.js} +75 -80
  14. package/dist/bundled/v3/OrSidebarCollapseButton.vue_vue_type_script_lang-d3e3cd4f.js +185 -0
  15. package/dist/bundled/v3/components/index.js +2 -1
  16. package/dist/bundled/v3/components/or-sidebar-v3/OrSidebar.stories3.d.ts +36 -1
  17. package/dist/bundled/v3/components/or-sidebar-v3/OrSidebar.vue.d.ts +49 -4
  18. package/dist/bundled/v3/components/or-sidebar-v3/index.js +16 -2
  19. package/dist/bundled/v3/components/or-sidebar-v3/partials/OrSidebarCollapseButton.stories3.d.ts +12 -0
  20. package/dist/bundled/v3/components/or-sidebar-v3/partials/OrSidebarCollapseButton.vue.d.ts +53 -0
  21. package/dist/bundled/v3/components/or-sidebar-v3/partials/index.d.ts +1 -0
  22. package/dist/bundled/v3/components/or-sidebar-v3/partials/index.js +17 -0
  23. package/dist/bundled/v3/components/or-sidebar-v3/styles.d.ts +9 -1
  24. package/dist/bundled/v3/index.js +26 -9
  25. package/dist/esm/v2/{OrSidebar-fabc7bc9.js → OrSidebar-a10424d2.js} +92 -86
  26. package/dist/esm/v2/OrSidebarCollapseButton-3b461dfe.js +233 -0
  27. package/dist/esm/v2/components/index.js +2 -1
  28. package/dist/esm/v2/components/or-sidebar-v3/OrSidebar.stories3.d.ts +36 -1
  29. package/dist/esm/v2/components/or-sidebar-v3/OrSidebar.vue.d.ts +49 -4
  30. package/dist/esm/v2/components/or-sidebar-v3/index.js +13 -1
  31. package/dist/esm/v2/components/or-sidebar-v3/partials/OrSidebarCollapseButton.stories3.d.ts +12 -0
  32. package/dist/esm/v2/components/or-sidebar-v3/partials/OrSidebarCollapseButton.vue.d.ts +53 -0
  33. package/dist/esm/v2/components/or-sidebar-v3/partials/index.d.ts +1 -0
  34. package/dist/esm/v2/components/or-sidebar-v3/partials/index.js +16 -0
  35. package/dist/esm/v2/components/or-sidebar-v3/styles.d.ts +9 -1
  36. package/dist/esm/v2/index.js +2 -1
  37. package/dist/esm/v3/{OrSidebar-a62972f5.js → OrSidebar-3be35e8d.js} +81 -89
  38. package/dist/esm/v3/OrSidebarCollapseButton-30d0033b.js +204 -0
  39. package/dist/esm/v3/components/index.js +2 -1
  40. package/dist/esm/v3/components/or-sidebar-v3/OrSidebar.stories3.d.ts +36 -1
  41. package/dist/esm/v3/components/or-sidebar-v3/OrSidebar.vue.d.ts +49 -4
  42. package/dist/esm/v3/components/or-sidebar-v3/index.js +12 -1
  43. package/dist/esm/v3/components/or-sidebar-v3/partials/OrSidebarCollapseButton.stories3.d.ts +12 -0
  44. package/dist/esm/v3/components/or-sidebar-v3/partials/OrSidebarCollapseButton.vue.d.ts +53 -0
  45. package/dist/esm/v3/components/or-sidebar-v3/partials/index.d.ts +1 -0
  46. package/dist/esm/v3/components/or-sidebar-v3/partials/index.js +15 -0
  47. package/dist/esm/v3/components/or-sidebar-v3/styles.d.ts +9 -1
  48. package/dist/esm/v3/index.js +2 -1
  49. package/package.json +2 -3
  50. package/src/components/or-sidebar-v3/OrSidebar.docs.mdx +6 -0
  51. package/src/components/or-sidebar-v3/OrSidebar.stories3.ts +253 -12
  52. package/src/components/or-sidebar-v3/OrSidebar.vue +130 -23
  53. package/src/components/or-sidebar-v3/partials/OrSidebarCollapseButton.stories3.ts +48 -0
  54. package/src/components/or-sidebar-v3/partials/OrSidebarCollapseButton.vue +74 -0
  55. package/src/components/or-sidebar-v3/partials/index.ts +1 -0
  56. package/src/components/or-sidebar-v3/styles.ts +164 -9
@@ -4,26 +4,36 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
4
4
  root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
5
5
  resizeBar: import("@vue/composition-api").Ref<HTMLElement | null>;
6
6
  isResizing: import("@vue/composition-api").Ref<boolean>;
7
+ isCollapsed: import("@vue/composition-api").Ref<boolean>;
7
8
  localWidth: import("@vue/composition-api").Ref<number>;
9
+ isShowingToolbar: import("@vue/composition-api").ComputedRef<boolean>;
8
10
  sidebarStyle: import("@vue/composition-api").ComputedRef<{
9
11
  width: string;
10
12
  }>;
11
13
  rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
14
+ sidebarStyles: import("@vue/composition-api").ComputedRef<string[]>;
15
+ toolbarStyles: import("@vue/composition-api").ComputedRef<string[]>;
12
16
  resizeStyles: import("@vue/composition-api").ComputedRef<string[]>;
17
+ collapsibleButtonStyles: import("@vue/composition-api").ComputedRef<string[]>;
13
18
  mainStyles: import("@vue/composition-api").ComputedRef<string[]>;
14
19
  headerStyles: import("@vue/composition-api").ComputedRef<string[]>;
15
20
  contentStyles: import("@vue/composition-api").ComputedRef<string[]>;
16
21
  footerStyles: import("@vue/composition-api").ComputedRef<string[]>;
22
+ open: () => void;
23
+ close: () => void;
17
24
  }> & import("@vue/composition-api").Data, {}, {}, {
18
25
  width: {
19
26
  type: NumberConstructor;
20
- required: false;
21
27
  default: number;
22
28
  validator: (value?: any) => boolean;
23
29
  };
24
30
  minimumWidth: {
25
31
  type: NumberConstructor;
26
- required: false;
32
+ default: number;
33
+ validator: (value?: any) => boolean;
34
+ };
35
+ maximumWidth: {
36
+ type: NumberConstructor;
27
37
  default: number;
28
38
  validator: (value?: any) => boolean;
29
39
  };
@@ -39,16 +49,27 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
39
49
  default: OrSidebarPlacement;
40
50
  validator: (value?: any) => boolean;
41
51
  };
52
+ draggable: {
53
+ type: BooleanConstructor;
54
+ default: boolean;
55
+ };
56
+ collapsible: {
57
+ type: BooleanConstructor;
58
+ default: boolean;
59
+ };
42
60
  }, import("@vue/composition-api").ExtractPropTypes<{
43
61
  width: {
44
62
  type: NumberConstructor;
45
- required: false;
46
63
  default: number;
47
64
  validator: (value?: any) => boolean;
48
65
  };
49
66
  minimumWidth: {
50
67
  type: NumberConstructor;
51
- required: false;
68
+ default: number;
69
+ validator: (value?: any) => boolean;
70
+ };
71
+ maximumWidth: {
72
+ type: NumberConstructor;
52
73
  default: number;
53
74
  validator: (value?: any) => boolean;
54
75
  };
@@ -64,35 +85,59 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
64
85
  default: OrSidebarPlacement;
65
86
  validator: (value?: any) => boolean;
66
87
  };
88
+ draggable: {
89
+ type: BooleanConstructor;
90
+ default: boolean;
91
+ };
92
+ collapsible: {
93
+ type: BooleanConstructor;
94
+ default: boolean;
95
+ };
67
96
  }>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
68
97
  width: number;
69
98
  minimumWidth: number;
99
+ maximumWidth: number;
70
100
  side: OrSidebarPlacement;
101
+ draggable: boolean;
102
+ collapsible: boolean;
71
103
  } & {} & {
72
104
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
73
105
  }, import("@vue/composition-api").ShallowUnwrapRef<{
74
106
  root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
75
107
  resizeBar: import("@vue/composition-api").Ref<HTMLElement | null>;
76
108
  isResizing: import("@vue/composition-api").Ref<boolean>;
109
+ isCollapsed: import("@vue/composition-api").Ref<boolean>;
77
110
  localWidth: import("@vue/composition-api").Ref<number>;
111
+ isShowingToolbar: import("@vue/composition-api").ComputedRef<boolean>;
78
112
  sidebarStyle: import("@vue/composition-api").ComputedRef<{
79
113
  width: string;
80
114
  }>;
81
115
  rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
116
+ sidebarStyles: import("@vue/composition-api").ComputedRef<string[]>;
117
+ toolbarStyles: import("@vue/composition-api").ComputedRef<string[]>;
82
118
  resizeStyles: import("@vue/composition-api").ComputedRef<string[]>;
119
+ collapsibleButtonStyles: import("@vue/composition-api").ComputedRef<string[]>;
83
120
  mainStyles: import("@vue/composition-api").ComputedRef<string[]>;
84
121
  headerStyles: import("@vue/composition-api").ComputedRef<string[]>;
85
122
  contentStyles: import("@vue/composition-api").ComputedRef<string[]>;
86
123
  footerStyles: import("@vue/composition-api").ComputedRef<string[]>;
124
+ open: () => void;
125
+ close: () => void;
87
126
  }>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
88
127
  width: number;
89
128
  minimumWidth: number;
129
+ maximumWidth: number;
90
130
  side: OrSidebarPlacement;
131
+ draggable: boolean;
132
+ collapsible: boolean;
91
133
  } & {} & {
92
134
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
93
135
  }, {
94
136
  width: number;
95
137
  minimumWidth: number;
138
+ maximumWidth: number;
96
139
  side: OrSidebarPlacement;
140
+ draggable: boolean;
141
+ collapsible: boolean;
97
142
  }, true>);
98
143
  export default _default;
@@ -1,5 +1,17 @@
1
- export { O as OrSidebarPlacement, _ as OrSidebarV3 } from '../../OrSidebar-fabc7bc9.js';
1
+ export { _ as OrSidebarV3 } from '../../OrSidebar-a10424d2.js';
2
+ export { O as OrSidebarPlacement } from '../../OrSidebarCollapseButton-3b461dfe.js';
2
3
  import '@vueuse/core';
3
4
  import 'lodash';
4
5
  import 'vue-demi';
5
6
  import '../../normalize-component-6e8e3d80.js';
7
+ import '../../OrIconButton-04a3566d.js';
8
+ import '../../OrIcon-f34e0e6f.js';
9
+ import '../../OrTooltip-629d44fc.js';
10
+ import '../../OrPopover-d5d4f62a.js';
11
+ import '@floating-ui/dom';
12
+ import '../../useElevation-31bfe1f6.js';
13
+ import '../../useResponsive-a02e95b7.js';
14
+ import '../../OrBottomSheet-37200385.js';
15
+ import '../../OrOverlay-a019186f.js';
16
+ import '../../OrTeleport.vue2-fb92f29f.js';
17
+ import 'portal-vue';
@@ -0,0 +1,12 @@
1
+ import { Meta, StoryFn } from '@storybook/vue3';
2
+ declare const _default: Meta<import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<unknown>, import("@vue/composition-api").MethodOptions, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>, import("@vue/composition-api").ExtractPropTypes<import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
3
+ [x: string]: ((...args: any[]) => any) | null;
4
+ } | string[], {} & {}, {
5
+ [x: number]: string;
6
+ } | {}, true>)>;
7
+ export default _default;
8
+ export declare const Default: StoryFn<import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<unknown>, import("@vue/composition-api").MethodOptions, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>, import("@vue/composition-api").ExtractPropTypes<import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
9
+ [x: string]: ((...args: any[]) => any) | null;
10
+ } | string[], {} & {}, {
11
+ [x: number]: string;
12
+ } | {}, true>)>;
@@ -0,0 +1,53 @@
1
+ import { PropType } from 'vue-demi';
2
+ import { OrSidebarPlacement } from '../props';
3
+ declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
4
+ root: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
5
+ rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
6
+ buttonStyles: import("@vue/composition-api").ComputedRef<string[]>;
7
+ icon: import("@vue/composition-api").ComputedRef<"keyboard_arrow_left" | "keyboard_arrow_right">;
8
+ }> & import("@vue/composition-api").Data, {}, {}, {
9
+ /**
10
+ * Must be `true` if sidebar is collapsed.
11
+ */
12
+ modelValue: {
13
+ type: BooleanConstructor;
14
+ default: boolean;
15
+ };
16
+ side: {
17
+ type: PropType<OrSidebarPlacement>;
18
+ default: OrSidebarPlacement;
19
+ validator: (value?: any) => boolean;
20
+ };
21
+ }, import("@vue/composition-api").ExtractPropTypes<{
22
+ /**
23
+ * Must be `true` if sidebar is collapsed.
24
+ */
25
+ modelValue: {
26
+ type: BooleanConstructor;
27
+ default: boolean;
28
+ };
29
+ side: {
30
+ type: PropType<OrSidebarPlacement>;
31
+ default: OrSidebarPlacement;
32
+ validator: (value?: any) => boolean;
33
+ };
34
+ }>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
35
+ modelValue: boolean;
36
+ side: OrSidebarPlacement;
37
+ } & {} & {
38
+ [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
39
+ }, import("@vue/composition-api").ShallowUnwrapRef<{
40
+ root: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
41
+ rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
42
+ buttonStyles: import("@vue/composition-api").ComputedRef<string[]>;
43
+ icon: import("@vue/composition-api").ComputedRef<"keyboard_arrow_left" | "keyboard_arrow_right">;
44
+ }>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
45
+ modelValue: boolean;
46
+ side: OrSidebarPlacement;
47
+ } & {} & {
48
+ [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
49
+ }, {
50
+ modelValue: boolean;
51
+ side: OrSidebarPlacement;
52
+ }, true>);
53
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default as OrSidebarCollapseButton } from './OrSidebarCollapseButton.vue';
@@ -0,0 +1,16 @@
1
+ export { _ as OrSidebarCollapseButton } from '../../../OrSidebarCollapseButton-3b461dfe.js';
2
+ import 'lodash';
3
+ import 'vue-demi';
4
+ import '../../../OrIconButton-04a3566d.js';
5
+ import '../../../OrIcon-f34e0e6f.js';
6
+ import '../../../normalize-component-6e8e3d80.js';
7
+ import '../../../OrTooltip-629d44fc.js';
8
+ import '@vueuse/core';
9
+ import '../../../OrPopover-d5d4f62a.js';
10
+ import '@floating-ui/dom';
11
+ import '../../../useElevation-31bfe1f6.js';
12
+ import '../../../useResponsive-a02e95b7.js';
13
+ import '../../../OrBottomSheet-37200385.js';
14
+ import '../../../OrOverlay-a019186f.js';
15
+ import '../../../OrTeleport.vue2-fb92f29f.js';
16
+ import 'portal-vue';
@@ -1,10 +1,18 @@
1
1
  import { OrSidebarPlacement } from './props';
2
2
  export declare const SidebarRoot: string[];
3
- export declare const SidebarRootSides: Record<OrSidebarPlacement, string[]>;
3
+ export declare const SidebarBar: string[];
4
+ export declare const SidebarToolbar: string[];
5
+ export declare const CollapsibleSidebarToolbar: string[];
6
+ export declare const SidebarSides: Record<OrSidebarPlacement, string[]>;
7
+ export declare const SidebarToolbarSides: Record<OrSidebarPlacement, string[]>;
4
8
  export declare const SidebarResize: string[];
5
9
  export declare const SidebarResizeSides: Record<OrSidebarPlacement, string[]>;
10
+ export declare const SidebarCollapseButton: string[];
11
+ export declare const SidebarCollapseButtonSides: Record<OrSidebarPlacement, string[]>;
6
12
  export declare const SidebarResizingSides: Record<OrSidebarPlacement, string[]>;
7
13
  export declare const SidebarMain: string[];
8
14
  export declare const SidebarHeader: string[];
9
15
  export declare const SidebarContent: string[];
10
16
  export declare const SidebarFooter: string[];
17
+ export declare const CollapseButtonContainer: string[];
18
+ export declare const CollapseButton: string[];
@@ -71,7 +71,8 @@ export { _ as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmen
71
71
  export { _ as OrSelect } from './OrSelect-dae2b069.js';
72
72
  export { _ as OrSelectV3 } from './OrSelect-e31d1c8b.js';
73
73
  export { _ as OrSidebar, O as OrSidebarSide } from './OrSidebar-7d6125bb.js';
74
- export { O as OrSidebarPlacement, _ as OrSidebarV3 } from './OrSidebar-fabc7bc9.js';
74
+ export { _ as OrSidebarV3 } from './OrSidebar-a10424d2.js';
75
+ export { O as OrSidebarPlacement } from './OrSidebarCollapseButton-3b461dfe.js';
75
76
  export { _ as OrSkeletonCircle, a as OrSkeletonRect, b as OrSkeletonText, O as OrSkeletonTextSizes } from './OrSkeletonText-cc94bdc9.js';
76
77
  export { _ as OrSkeletonCircleV3, a as OrSkeletonRectV3, b as OrSkeletonTextV3 } from './OrSkeletonText-6ee72718.js';
77
78
  export { _ as OrSlider } from './OrSlider-f7b9c7c2.js';
@@ -1,92 +1,28 @@
1
1
  import { useDraggable, useElementBounding } from '@vueuse/core';
2
2
  import _ from 'lodash';
3
- import { defineComponent, ref, computed, watch } from 'vue-demi';
4
- import { openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, createCommentVNode } from 'vue';
5
-
6
- var OrSidebarPlacement;
7
- (function (OrSidebarPlacement) {
8
- OrSidebarPlacement["left"] = "left";
9
- OrSidebarPlacement["right"] = "right";
10
- })(OrSidebarPlacement || (OrSidebarPlacement = {}));
11
-
12
- const SidebarRoot = [
13
- // Position
14
- 'relative',
15
- // Layout
16
- 'flex', 'flex-col', 'shrink-0',
17
- // Box
18
- 'min-h-0', 'p-0'];
19
- const SidebarRootSides = {
20
- [OrSidebarPlacement.left]: [
21
- // Borders
22
- 'border-r-[1px]', 'border-r-solid', 'border-r-secondary dark:border-r-secondary-dark'],
23
- [OrSidebarPlacement.right]: [
24
- // Borders
25
- 'border-l-[1px]', 'border-l-solid', 'border-l-secondary dark:border-l-secondary-dark']
26
- };
27
- const SidebarResize = [
28
- // Position
29
- 'absolute', 'inset-y-none', 'z-[1]',
30
- // Box
31
- 'w-[12px]', 'h-[100%]',
32
- // Cursor
33
- 'cursor-ew-resize'];
34
- const SidebarResizeSides = {
35
- [OrSidebarPlacement.left]: [
36
- // Position
37
- '-right-[1px]',
38
- // Borders
39
- 'hover:border-r-2', 'hover:border-r-primary hover:dark:border-r-primary-dark',
40
- // Transition
41
- 'transition-[border-right]'],
42
- [OrSidebarPlacement.right]: [
43
- // Position
44
- '-left-[1px]',
45
- // Borders
46
- 'hover:border-l-2', 'hover:border-l-primary hover:dark:border-l-primary-dark',
47
- // Transition
48
- 'transition-[border-left]']
49
- };
50
- const SidebarResizingSides = {
51
- [OrSidebarPlacement.left]: [
52
- // Borders
53
- 'border-r-2', 'border-r-primary dark:border-r-primary-dark'],
54
- [OrSidebarPlacement.right]: [
55
- // Borders
56
- 'border-l-2', 'border-l-primary dark:border-l-primary-dark']
57
- };
58
- const SidebarMain = [
59
- // Layout
60
- 'flex', 'flex-col', 'grow',
61
- // Box
62
- 'min-h-0'];
63
- const SidebarHeader = [
64
- // Sizing
65
- 'p-md'];
66
- const SidebarContent = [
67
- // Layout
68
- 'grow', 'overflow-auto',
69
- // Sizing
70
- 'p-md'];
71
- const SidebarFooter = [
72
- // Sizing
73
- 'p-md',
74
- // Borders
75
- 'border-t-[1px]', 'border-t-solid', 'border-t-secondary dark:border-t-secondary-dark'];
3
+ import { defineComponent, ref, computed, useSlots, watch } from 'vue-demi';
4
+ import { s as script$1, O as OrSidebarPlacement, S as SidebarRoot, a as SidebarBar, b as SidebarSides, c as SidebarToolbar, C as CollapsibleSidebarToolbar, d as SidebarToolbarSides, e as SidebarResize, f as SidebarResizeSides, g as SidebarResizingSides, h as SidebarCollapseButton, i as SidebarCollapseButtonSides, j as SidebarMain, k as SidebarHeader, l as SidebarContent, m as SidebarFooter } from './OrSidebarCollapseButton-30d0033b.js';
5
+ import { resolveComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createCommentVNode, createElementVNode, normalizeStyle, createBlock, withDirectives, vShow } from 'vue';
76
6
 
77
7
  var script = defineComponent({
78
8
  name: 'OrSidebar',
9
+ components: {
10
+ OrSidebarCollapseButton: script$1
11
+ },
79
12
  props: {
80
13
  width: {
81
14
  type: Number,
82
- required: false,
83
- default: 0,
15
+ default: 320,
84
16
  validator: value => _.isNumber(value) && value >= 0
85
17
  },
86
18
  minimumWidth: {
87
19
  type: Number,
88
- required: false,
89
- default: 350,
20
+ default: 256,
21
+ validator: value => _.isNumber(value) && value >= 0
22
+ },
23
+ maximumWidth: {
24
+ type: Number,
25
+ default: 384,
90
26
  validator: value => _.isNumber(value) && value >= 0
91
27
  },
92
28
  /**
@@ -100,9 +36,18 @@ var script = defineComponent({
100
36
  type: String,
101
37
  default: OrSidebarPlacement.right,
102
38
  validator: value => _.includes(_.values(OrSidebarPlacement), value)
39
+ },
40
+ draggable: {
41
+ type: Boolean,
42
+ default: true
43
+ },
44
+ collapsible: {
45
+ type: Boolean,
46
+ default: false
103
47
  }
104
48
  },
105
- emits: ['change:width'],
49
+ emits: ['change:width', 'open', 'close'],
50
+ expose: ['root', 'open', 'close'],
106
51
  setup(props, {
107
52
  emit
108
53
  }) {
@@ -113,16 +58,26 @@ var script = defineComponent({
113
58
  var _a;
114
59
  return (_a = root.value) === null || _a === void 0 ? void 0 : _a.parentElement;
115
60
  });
61
+ // Slots
62
+ const {
63
+ toolbar: toolbarSlot
64
+ } = useSlots();
116
65
  // State
117
66
  const startPositionX = ref(0);
118
67
  const isResizing = ref(false);
68
+ const isCollapsed = ref(false);
69
+ const maximumWidth = ref(props.maximumWidth || 384);
119
70
  const localWidth = ref(props.width >= props.minimumWidth ? props.width : props.minimumWidth);
71
+ const isShowingToolbar = computed(() => !!toolbarSlot);
120
72
  // Styles
121
73
  const sidebarStyle = computed(() => ({
122
- width: localWidth.value + 'px'
74
+ width: (isCollapsed.value ? 16 : localWidth.value) + 'px'
123
75
  }));
124
- const rootStyles = computed(() => ['or-sidebar', ...SidebarRoot, ...SidebarRootSides[props.side]]);
76
+ const rootStyles = computed(() => ['or-sidebar', ...SidebarRoot]);
77
+ const sidebarStyles = computed(() => [...SidebarBar, ...SidebarSides[props.side]]);
78
+ const toolbarStyles = computed(() => [...SidebarToolbar, ...(props.collapsible ? CollapsibleSidebarToolbar : []), ...SidebarToolbarSides[props.side]]);
125
79
  const resizeStyles = computed(() => [...SidebarResize, ...SidebarResizeSides[props.side], ...(isResizing.value ? SidebarResizingSides[props.side] : [])]);
80
+ const collapsibleButtonStyles = computed(() => [...SidebarCollapseButton, ...SidebarCollapseButtonSides[props.side]]);
126
81
  const mainStyles = computed(() => [...SidebarMain]);
127
82
  const headerStyles = computed(() => [...SidebarHeader]);
128
83
  const contentStyles = computed(() => [...SidebarContent]);
@@ -148,8 +103,15 @@ var script = defineComponent({
148
103
  isResizing.value = false;
149
104
  }
150
105
  });
106
+ // Methods
107
+ function open() {
108
+ isCollapsed.value = false;
109
+ }
110
+ function close() {
111
+ isCollapsed.value = true;
112
+ }
151
113
  const {
152
- width: maximumWidth
114
+ width: containerWidth
153
115
  } = useElementBounding(parentContainer);
154
116
  watch(() => props.width, newValue => {
155
117
  if (newValue !== localWidth.value) {
@@ -159,48 +121,78 @@ var script = defineComponent({
159
121
  watch(() => props.minimumWidth, newMinimum => {
160
122
  if (newMinimum > localWidth.value) localWidth.value = newMinimum;
161
123
  });
124
+ watch(() => props.maximumWidth, newMaximum => {
125
+ if (newMaximum < maximumWidth.value) maximumWidth.value = newMaximum;
126
+ });
127
+ watch(containerWidth, newMaximum => {
128
+ if (newMaximum < maximumWidth.value) maximumWidth.value = newMaximum;
129
+ });
162
130
  watch(maximumWidth, newMaximum => {
163
131
  if (newMaximum < localWidth.value) localWidth.value = newMaximum;
164
132
  });
165
133
  watch(localWidth, val => emit('change:width', val));
134
+ watch(isCollapsed, val => emit(val ? 'close' : 'open'));
166
135
  return {
167
136
  root,
168
137
  resizeBar,
169
138
  isResizing,
139
+ isCollapsed,
170
140
  localWidth,
141
+ isShowingToolbar,
171
142
  sidebarStyle,
172
143
  rootStyles,
144
+ sidebarStyles,
145
+ toolbarStyles,
173
146
  resizeStyles,
147
+ collapsibleButtonStyles,
174
148
  mainStyles,
175
149
  headerStyles,
176
150
  contentStyles,
177
- footerStyles
151
+ footerStyles,
152
+ open,
153
+ close
178
154
  };
179
155
  }
180
156
  });
181
157
 
182
158
  function render(_ctx, _cache, $props, $setup, $data, $options) {
159
+ const _component_or_sidebar_collapse_button = resolveComponent("or-sidebar-collapse-button");
183
160
  return openBlock(), createElementBlock("aside", {
184
161
  ref: "root",
185
- class: normalizeClass(_ctx.rootStyles),
162
+ class: normalizeClass(_ctx.rootStyles)
163
+ }, [_ctx.side === 'right' && _ctx.isShowingToolbar ? (openBlock(), createElementBlock("div", {
164
+ key: 0,
165
+ class: normalizeClass(_ctx.toolbarStyles)
166
+ }, [renderSlot(_ctx.$slots, "toolbar")], 2 /* CLASS */)) : createCommentVNode("v-if", true), createElementVNode("div", {
167
+ class: normalizeClass(_ctx.sidebarStyles),
186
168
  style: normalizeStyle(_ctx.sidebarStyle)
187
- }, [createElementVNode("div", {
169
+ }, [_ctx.draggable && !_ctx.isCollapsed ? (openBlock(), createElementBlock("div", {
170
+ key: 0,
188
171
  ref: "resizeBar",
189
172
  class: normalizeClass(_ctx.resizeStyles)
190
- }, null, 2 /* CLASS */), createElementVNode("div", {
173
+ }, null, 2 /* CLASS */)) : createCommentVNode("v-if", true), _ctx.collapsible ? (openBlock(), createBlock(_component_or_sidebar_collapse_button, {
174
+ key: 1,
175
+ modelValue: _ctx.isCollapsed,
176
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => _ctx.isCollapsed = $event),
177
+ class: normalizeClass(_ctx.collapsibleButtonStyles),
178
+ side: _ctx.side
179
+ }, null, 8 /* PROPS */, ["modelValue", "class", "side"])) : createCommentVNode("v-if", true), withDirectives(createElementVNode("div", {
191
180
  class: normalizeClass(_ctx.mainStyles)
192
181
  }, [_ctx.$slots.header ? (openBlock(), createElementBlock("div", {
193
182
  key: 0,
194
183
  class: normalizeClass(_ctx.headerStyles)
195
184
  }, [renderSlot(_ctx.$slots, "header")], 2 /* CLASS */)) : createCommentVNode("v-if", true), createElementVNode("div", {
196
185
  class: normalizeClass(_ctx.contentStyles)
197
- }, [renderSlot(_ctx.$slots, "default")], 2 /* CLASS */)], 2 /* CLASS */), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
198
- key: 0,
186
+ }, [renderSlot(_ctx.$slots, "default")], 2 /* CLASS */)], 2 /* CLASS */), [[vShow, !_ctx.isCollapsed]]), _ctx.$slots.footer ? withDirectives((openBlock(), createElementBlock("div", {
187
+ key: 2,
199
188
  class: normalizeClass(_ctx.footerStyles)
200
- }, [renderSlot(_ctx.$slots, "footer")], 2 /* CLASS */)) : createCommentVNode("v-if", true)], 6 /* CLASS, STYLE */);
189
+ }, [renderSlot(_ctx.$slots, "footer")], 2 /* CLASS */)), [[vShow, !_ctx.isCollapsed]]) : createCommentVNode("v-if", true)], 6 /* CLASS, STYLE */), _ctx.side === 'left' && _ctx.isShowingToolbar ? (openBlock(), createElementBlock("div", {
190
+ key: 1,
191
+ class: normalizeClass(_ctx.toolbarStyles)
192
+ }, [renderSlot(_ctx.$slots, "toolbar")], 2 /* CLASS */)) : createCommentVNode("v-if", true)], 2 /* CLASS */);
201
193
  }
202
194
 
203
195
  script.render = render;
204
196
  script.__file = "src/components/or-sidebar-v3/OrSidebar.vue";
205
197
 
206
- export { OrSidebarPlacement as O, script as s };
198
+ export { script as s };