@onereach/ui-components 2.70.1-beta.2196.0 → 2.70.2-beta.2198.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 (78) hide show
  1. package/dist/bundled/v2/{OrExpansionPanel-995caa85.js → OrExpansionPanel-d9a260e2.js} +32 -5
  2. package/dist/bundled/v2/{OrSelect-67dc7976.js → OrSelect-c49e1bcf.js} +2 -2
  3. package/dist/bundled/v2/OrSidebar-2a7d62a8.js +455 -0
  4. package/dist/bundled/v2/{OrTag-30fecee5.js → OrTag-e3e6fdd6.js} +1 -1
  5. package/dist/bundled/v2/components/index.js +4 -4
  6. package/dist/bundled/v2/components/or-expansion-panel-v3/OrExpansionPanel.vue.d.ts +22 -3
  7. package/dist/bundled/v2/components/or-expansion-panel-v3/index.js +1 -1
  8. package/dist/bundled/v2/components/or-select-v3/index.js +3 -3
  9. package/dist/bundled/v2/components/or-sidebar-v3/OrSidebar.stories3.d.ts +36 -1
  10. package/dist/bundled/v2/components/or-sidebar-v3/OrSidebar.vue.d.ts +49 -4
  11. package/dist/bundled/v2/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.d.ts +12 -0
  12. package/dist/bundled/v2/components/or-sidebar-v3/OrSidebarCollapseButton.vue.d.ts +59 -0
  13. package/dist/bundled/v2/components/or-sidebar-v3/index.js +13 -1
  14. package/dist/bundled/v2/components/or-sidebar-v3/styles.d.ts +7 -1
  15. package/dist/bundled/v2/components/or-tag-v3/index.js +1 -1
  16. package/dist/bundled/v2/index.js +5 -5
  17. package/dist/bundled/v3/{OrExpansionPanel.vue_vue_type_script_lang-7f9c6721.js → OrExpansionPanel.vue_vue_type_script_lang-5360f580.js} +31 -4
  18. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-29aed61b.js → OrSelect.vue_vue_type_script_lang-58e5a52b.js} +3 -3
  19. package/dist/bundled/v3/OrSidebar.vue_vue_type_script_lang-b4fa1550.js +347 -0
  20. package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-3e30f662.js → OrTag.vue_vue_type_script_lang-e45c345b.js} +1 -1
  21. package/dist/bundled/v3/components/index.js +4 -4
  22. package/dist/bundled/v3/components/or-expansion-panel-v3/OrExpansionPanel.vue.d.ts +22 -3
  23. package/dist/bundled/v3/components/or-expansion-panel-v3/index.js +1 -1
  24. package/dist/bundled/v3/components/or-select-v3/index.js +3 -3
  25. package/dist/bundled/v3/components/or-sidebar-v3/OrSidebar.stories3.d.ts +36 -1
  26. package/dist/bundled/v3/components/or-sidebar-v3/OrSidebar.vue.d.ts +49 -4
  27. package/dist/bundled/v3/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.d.ts +12 -0
  28. package/dist/bundled/v3/components/or-sidebar-v3/OrSidebarCollapseButton.vue.d.ts +59 -0
  29. package/dist/bundled/v3/components/or-sidebar-v3/index.js +15 -1
  30. package/dist/bundled/v3/components/or-sidebar-v3/styles.d.ts +7 -1
  31. package/dist/bundled/v3/components/or-tag-v3/index.js +1 -1
  32. package/dist/bundled/v3/index.js +29 -13
  33. package/dist/esm/v2/{OrExpansionPanel-968ddc61.js → OrExpansionPanel-a123024e.js} +32 -5
  34. package/dist/esm/v2/{OrSelect-ae7a13a5.js → OrSelect-1d705445.js} +2 -2
  35. package/dist/esm/v2/OrSidebar-1e02702f.js +452 -0
  36. package/dist/esm/v2/{OrTag-5c404031.js → OrTag-52e4cc94.js} +1 -1
  37. package/dist/esm/v2/components/index.js +4 -4
  38. package/dist/esm/v2/components/or-expansion-panel-v3/OrExpansionPanel.vue.d.ts +22 -3
  39. package/dist/esm/v2/components/or-expansion-panel-v3/index.js +1 -1
  40. package/dist/esm/v2/components/or-select-v3/index.js +3 -3
  41. package/dist/esm/v2/components/or-sidebar-v3/OrSidebar.stories3.d.ts +36 -1
  42. package/dist/esm/v2/components/or-sidebar-v3/OrSidebar.vue.d.ts +49 -4
  43. package/dist/esm/v2/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.d.ts +12 -0
  44. package/dist/esm/v2/components/or-sidebar-v3/OrSidebarCollapseButton.vue.d.ts +59 -0
  45. package/dist/esm/v2/components/or-sidebar-v3/index.js +13 -1
  46. package/dist/esm/v2/components/or-sidebar-v3/styles.d.ts +7 -1
  47. package/dist/esm/v2/components/or-tag-v3/index.js +1 -1
  48. package/dist/esm/v2/index.js +4 -4
  49. package/dist/esm/v3/{OrExpansionPanel-311e64cf.js → OrExpansionPanel-f8d7ff8d.js} +32 -5
  50. package/dist/esm/v3/{OrSelect-7ef568f4.js → OrSelect-dfa4885f.js} +2 -2
  51. package/dist/esm/v3/OrSidebar-749bbcba.js +387 -0
  52. package/dist/esm/v3/{OrTag-5d54f37d.js → OrTag-efa7578f.js} +1 -1
  53. package/dist/esm/v3/components/index.js +4 -4
  54. package/dist/esm/v3/components/or-expansion-panel-v3/OrExpansionPanel.vue.d.ts +22 -3
  55. package/dist/esm/v3/components/or-expansion-panel-v3/index.js +1 -1
  56. package/dist/esm/v3/components/or-select-v3/index.js +3 -3
  57. package/dist/esm/v3/components/or-sidebar-v3/OrSidebar.stories3.d.ts +36 -1
  58. package/dist/esm/v3/components/or-sidebar-v3/OrSidebar.vue.d.ts +49 -4
  59. package/dist/esm/v3/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.d.ts +12 -0
  60. package/dist/esm/v3/components/or-sidebar-v3/OrSidebarCollapseButton.vue.d.ts +59 -0
  61. package/dist/esm/v3/components/or-sidebar-v3/index.js +12 -1
  62. package/dist/esm/v3/components/or-sidebar-v3/styles.d.ts +7 -1
  63. package/dist/esm/v3/components/or-tag-v3/index.js +1 -1
  64. package/dist/esm/v3/index.js +4 -4
  65. package/package.json +1 -1
  66. package/src/components/or-expansion-panel-v3/OrExpansionPanel.stories3.ts +12 -2
  67. package/src/components/or-expansion-panel-v3/OrExpansionPanel.vue +39 -3
  68. package/src/components/or-sidebar-v3/OrSidebar.docs.mdx +6 -0
  69. package/src/components/or-sidebar-v3/OrSidebar.stories3.ts +219 -6
  70. package/src/components/or-sidebar-v3/OrSidebar.vue +121 -22
  71. package/src/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.ts +48 -0
  72. package/src/components/or-sidebar-v3/OrSidebarCollapseButton.vue +64 -0
  73. package/src/components/or-sidebar-v3/styles.ts +153 -9
  74. package/src/components/or-tag-v3/styles.ts +0 -3
  75. package/dist/bundled/v2/OrSidebar-c95ef614.js +0 -230
  76. package/dist/bundled/v3/OrSidebar.vue_vue_type_script_lang-ce0b152c.js +0 -181
  77. package/dist/esm/v2/OrSidebar-fabc7bc9.js +0 -228
  78. package/dist/esm/v3/OrSidebar-a62972f5.js +0 -206
@@ -4,28 +4,97 @@ export const SidebarRoot: string[] = [
4
4
  // Position
5
5
  'relative',
6
6
 
7
+ // Layout
8
+ 'flex',
9
+ 'flex-row',
10
+ 'shrink-0',
11
+
12
+ // Box
13
+ 'min-w-0',
14
+ 'h-auto',
15
+ 'p-0',
16
+
17
+ // Theme
18
+ 'bg-background',
19
+ 'dark:bg-background-dark',
20
+ ];
21
+
22
+ export const SidebarBar: string[] = [
23
+ // Position
24
+ 'relative',
25
+
7
26
  // Layout
8
27
  'flex',
9
28
  'flex-col',
10
29
  'shrink-0',
30
+ 'grow',
11
31
 
12
32
  // Box
13
33
  'min-h-0',
14
34
  'p-0',
35
+
36
+ // Theme
37
+ 'text-on-background',
38
+ 'dark:text-on-background-dark',
39
+
40
+ // Transition
41
+ 'transition-[width]',
42
+ ];
43
+
44
+ export const SidebarToolbar: string[] = [
45
+ // Position
46
+ 'relative',
47
+
48
+ // Layout
49
+ 'flex',
50
+ 'flex-col',
51
+ 'shrink-0',
52
+ 'grow',
53
+ 'overflow-auto',
54
+ 'items-center',
55
+
56
+ // Sizing
57
+ 'gap-md',
58
+
59
+ // Box
60
+ 'min-h-0',
61
+ 'min-w-xl',
62
+ 'p-[6px]',
63
+ 'pt-[56px]',
64
+ 'pb-md+',
65
+
66
+ // Theme
67
+ 'text-outline',
68
+ 'dark:text-outline-dark',
15
69
  ];
16
70
 
17
- export const SidebarRootSides: Record<OrSidebarPlacement, string[]> = {
71
+ export const SidebarSides: Record<OrSidebarPlacement, string[]> = {
18
72
  [OrSidebarPlacement.left]: [
19
73
  // Borders
20
74
  'border-r-[1px]',
21
75
  'border-r-solid',
22
- 'border-r-secondary dark:border-r-secondary-dark',
76
+ 'border-r-outline-variant dark:border-r-outline-variant-dark',
23
77
  ],
24
78
  [OrSidebarPlacement.right]: [
25
79
  // Borders
26
80
  'border-l-[1px]',
27
81
  'border-l-solid',
28
- 'border-l-secondary dark:border-l-secondary-dark',
82
+ 'border-l-outline-variant dark:border-l-outline-variant-dark',
83
+ ],
84
+ };
85
+
86
+ export const SidebarToolbarSides: Record<OrSidebarPlacement, string[]> = {
87
+ [OrSidebarPlacement.left]: [
88
+ // Borders
89
+ 'border-r-[1px]',
90
+ 'border-r-solid',
91
+ 'border-r-outline-variant dark:border-r-outline-variant-dark',
92
+ ],
93
+ [OrSidebarPlacement.right]: [
94
+ // Borders
95
+ 'border-l-[1px]',
96
+ 'border-l-solid',
97
+ 'border-l-outline-variant dark:border-l-outline-variant-dark',
29
98
  ],
30
99
  };
31
100
 
@@ -36,7 +105,7 @@ export const SidebarResize: string[] = [
36
105
  'z-[1]',
37
106
 
38
107
  // Box
39
- 'w-[12px]',
108
+ 'w-sm+',
40
109
  'h-[100%]',
41
110
 
42
111
  // Cursor
@@ -50,7 +119,7 @@ export const SidebarResizeSides: Record<OrSidebarPlacement, string[]> = {
50
119
 
51
120
  // Borders
52
121
  'hover:border-r-2',
53
- 'hover:border-r-primary hover:dark:border-r-primary-dark',
122
+ 'hover:border-r-primary-hover hover:dark:border-r-primary-hover-dark',
54
123
 
55
124
  // Transition
56
125
  'transition-[border-right]',
@@ -61,23 +130,45 @@ export const SidebarResizeSides: Record<OrSidebarPlacement, string[]> = {
61
130
 
62
131
  // Borders
63
132
  'hover:border-l-2',
64
- 'hover:border-l-primary hover:dark:border-l-primary-dark',
133
+ 'hover:border-l-primary-hover hover:dark:border-l-primary-hover-dark',
65
134
 
66
135
  // Transition
67
136
  'transition-[border-left]',
68
137
  ],
69
138
  };
70
139
 
140
+ export const SidebarCollapseButton: string[] = [
141
+ // Position
142
+ 'absolute',
143
+ 'top-md',
144
+ 'inset-y-none',
145
+ 'z-[1]',
146
+
147
+ // Cursor
148
+ 'cursor-ew-resize',
149
+ ];
150
+
151
+ export const SidebarCollapseButtonSides: Record<OrSidebarPlacement, string[]> = {
152
+ [OrSidebarPlacement.left]: [
153
+ // Position
154
+ '-right-[12px]',
155
+ ],
156
+ [OrSidebarPlacement.right]: [
157
+ // Position
158
+ '-left-[12px]',
159
+ ],
160
+ };
161
+
71
162
  export const SidebarResizingSides: Record<OrSidebarPlacement, string[]> = {
72
163
  [OrSidebarPlacement.left]: [
73
164
  // Borders
74
165
  'border-r-2',
75
- 'border-r-primary dark:border-r-primary-dark',
166
+ 'border-r-primary-hover dark:border-r-primary-hover-dark',
76
167
  ],
77
168
  [OrSidebarPlacement.right]: [
78
169
  // Borders
79
170
  'border-l-2',
80
- 'border-l-primary dark:border-l-primary-dark',
171
+ 'border-l-primary-hover dark:border-l-primary-hover-dark',
81
172
  ],
82
173
  };
83
174
 
@@ -86,14 +177,24 @@ export const SidebarMain: string[] = [
86
177
  'flex',
87
178
  'flex-col',
88
179
  'grow',
180
+ 'overflow-x-hidden',
89
181
 
90
182
  // Box
91
183
  'min-h-0',
92
184
  ];
93
185
 
94
186
  export const SidebarHeader: string[] = [
187
+ // Layout
188
+ 'shrink-0',
189
+ 'overflow-hidden',
190
+
95
191
  // Sizing
96
192
  'p-md',
193
+
194
+ // Typography
195
+ 'typography-headline-2',
196
+ 'whitespace-nowrap',
197
+ 'text-ellipsis',
97
198
  ];
98
199
 
99
200
  export const SidebarContent: string[] = [
@@ -106,11 +207,54 @@ export const SidebarContent: string[] = [
106
207
  ];
107
208
 
108
209
  export const SidebarFooter: string[] = [
210
+ // Layout
211
+ 'shrink-0',
212
+ 'overflow-x-hidden',
213
+
109
214
  // Sizing
110
215
  'p-md',
111
216
 
112
217
  // Borders
113
218
  'border-t-[1px]',
114
219
  'border-t-solid',
115
- 'border-t-secondary dark:border-t-secondary-dark',
220
+ 'border-t-outline-variant dark:border-t-outline-variant-dark',
221
+ ];
222
+
223
+ export const CollapseButton: string[] = [
224
+ // Box
225
+ 'w-[24px]',
226
+ 'h-[24px]',
227
+
228
+ // Typography
229
+ '!text-[16px]',
230
+
231
+ // Borders
232
+ '!border-[1px]',
233
+ '!border-solid',
234
+
235
+ // Theme
236
+ '!text-primary dark:!text-primary-dark',
237
+ '!bg-background dark:!bg-background-dark',
238
+ '!border-outline-variant dark:!border-outline-variant-dark',
239
+ '!outline-none',
240
+
241
+ // Theme (hover)
242
+ 'hover:!text-primary hover:dark:!text-primary-dark',
243
+ 'hover:!bg-primary-opacity-0-08 dark:hover:!bg-primary-opacity-0-08-dark',
244
+ 'hover:!border-outline dark:hover:!border-outline-dark',
245
+
246
+ // Theme (active)
247
+ 'active:!text-primary active:dark:!text-primary-dark',
248
+ 'active:!bg-primary-opacity-0-12 dark:active:!bg-primary-opacity-0-12-dark',
249
+ 'active:!border-primary dark:active:!border-primary-dark',
250
+
251
+ // Theme (focus)
252
+ 'focus:!text-primary focus:dark:!text-primary-dark',
253
+ 'focus:!bg-primary-opacity-0-12 dark:focus:!bg-primary-opacity-0-12-dark',
254
+ 'focus:!border-outline dark:focus:!border-outline-dark',
255
+
256
+ // Theme (disabled)
257
+ 'disabled:!text-on-disabled disabled:dark:!text-on-disabled-dark',
258
+ 'disabled:!bg-background disabled:dark:!bg-background-dark',
259
+ 'disabled:!border-outline-variant disabled:dark:!border-outline-variant-dark',
116
260
  ];
@@ -49,9 +49,6 @@ export const TagRootColors: Record<TagColor, string[]> = {
49
49
  // Theme
50
50
  'theme-preset-2-primary',
51
51
  'dark:theme-preset-2-primary-dark',
52
-
53
- 'theme-foreground-default',
54
- 'dark:theme-foreground-default-dark',
55
52
  ],
56
53
 
57
54
  'danger': [
@@ -1,230 +0,0 @@
1
- import { useDraggable, useElementBounding } from '@vueuse/core';
2
- import _ from 'lodash';
3
- import './index-fa6eb4ca.js';
4
- import { defineComponent, ref, computed, watch } from '@vue/composition-api/dist/vue-composition-api.mjs';
5
- import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
6
-
7
- var OrSidebarPlacement;
8
- (function (OrSidebarPlacement) {
9
- OrSidebarPlacement["left"] = "left";
10
- OrSidebarPlacement["right"] = "right";
11
- })(OrSidebarPlacement || (OrSidebarPlacement = {}));
12
-
13
- const SidebarRoot = [
14
- // Position
15
- 'relative',
16
- // Layout
17
- 'flex', 'flex-col', 'shrink-0',
18
- // Box
19
- 'min-h-0', 'p-0'];
20
- const SidebarRootSides = {
21
- [OrSidebarPlacement.left]: [
22
- // Borders
23
- 'border-r-[1px]', 'border-r-solid', 'border-r-secondary dark:border-r-secondary-dark'],
24
- [OrSidebarPlacement.right]: [
25
- // Borders
26
- 'border-l-[1px]', 'border-l-solid', 'border-l-secondary dark:border-l-secondary-dark']
27
- };
28
- const SidebarResize = [
29
- // Position
30
- 'absolute', 'inset-y-none', 'z-[1]',
31
- // Box
32
- 'w-[12px]', 'h-[100%]',
33
- // Cursor
34
- 'cursor-ew-resize'];
35
- const SidebarResizeSides = {
36
- [OrSidebarPlacement.left]: [
37
- // Position
38
- '-right-[1px]',
39
- // Borders
40
- 'hover:border-r-2', 'hover:border-r-primary hover:dark:border-r-primary-dark',
41
- // Transition
42
- 'transition-[border-right]'],
43
- [OrSidebarPlacement.right]: [
44
- // Position
45
- '-left-[1px]',
46
- // Borders
47
- 'hover:border-l-2', 'hover:border-l-primary hover:dark:border-l-primary-dark',
48
- // Transition
49
- 'transition-[border-left]']
50
- };
51
- const SidebarResizingSides = {
52
- [OrSidebarPlacement.left]: [
53
- // Borders
54
- 'border-r-2', 'border-r-primary dark:border-r-primary-dark'],
55
- [OrSidebarPlacement.right]: [
56
- // Borders
57
- 'border-l-2', 'border-l-primary dark:border-l-primary-dark']
58
- };
59
- const SidebarMain = [
60
- // Layout
61
- 'flex', 'flex-col', 'grow',
62
- // Box
63
- 'min-h-0'];
64
- const SidebarHeader = [
65
- // Sizing
66
- 'p-md'];
67
- const SidebarContent = [
68
- // Layout
69
- 'grow', 'overflow-auto',
70
- // Sizing
71
- 'p-md'];
72
- const SidebarFooter = [
73
- // Sizing
74
- 'p-md',
75
- // Borders
76
- 'border-t-[1px]', 'border-t-solid', 'border-t-secondary dark:border-t-secondary-dark'];
77
-
78
- var script = defineComponent({
79
- name: 'OrSidebar',
80
- props: {
81
- width: {
82
- type: Number,
83
- required: false,
84
- default: 0,
85
- validator: value => _.isNumber(value) && value >= 0
86
- },
87
- minimumWidth: {
88
- type: Number,
89
- required: false,
90
- default: 350,
91
- validator: value => _.isNumber(value) && value >= 0
92
- },
93
- /**
94
- * User may put the component on the right or the left side of a container.
95
- * This property mirrors the resizing behavior (drag direction) and styling (horizontal border) of the sidebar.
96
- *
97
- * Note: the property doesn't reposition the component in the parent container.
98
- * @values left, right
99
- */
100
- side: {
101
- type: String,
102
- default: OrSidebarPlacement.right,
103
- validator: value => _.includes(_.values(OrSidebarPlacement), value)
104
- }
105
- },
106
- emits: ['change:width'],
107
- setup(props, {
108
- emit
109
- }) {
110
- // Refs
111
- const root = ref();
112
- const resizeBar = ref(null);
113
- const parentContainer = computed(() => {
114
- var _a;
115
- return (_a = root.value) === null || _a === void 0 ? void 0 : _a.parentElement;
116
- });
117
- // State
118
- const startPositionX = ref(0);
119
- const isResizing = ref(false);
120
- const localWidth = ref(props.width >= props.minimumWidth ? props.width : props.minimumWidth);
121
- // Styles
122
- const sidebarStyle = computed(() => ({
123
- width: localWidth.value + 'px'
124
- }));
125
- const rootStyles = computed(() => ['or-sidebar', ...SidebarRoot, ...SidebarRootSides[props.side]]);
126
- const resizeStyles = computed(() => [...SidebarResize, ...SidebarResizeSides[props.side], ...(isResizing.value ? SidebarResizingSides[props.side] : [])]);
127
- const mainStyles = computed(() => [...SidebarMain]);
128
- const headerStyles = computed(() => [...SidebarHeader]);
129
- const contentStyles = computed(() => [...SidebarContent]);
130
- const footerStyles = computed(() => [...SidebarFooter]);
131
- // Effects
132
- useDraggable(resizeBar, {
133
- preventDefault: true,
134
- onStart: (position, event) => {
135
- document.body.style.cursor = 'ew-resize';
136
- document.body.style.userSelect = 'none';
137
- startPositionX.value = event.x;
138
- isResizing.value = true;
139
- },
140
- onMove: position => {
141
- const delta = (position.x - startPositionX.value) * (props.side === OrSidebarPlacement.left ? -1 : 1);
142
- const newWidth = localWidth.value - delta;
143
- localWidth.value = newWidth > maximumWidth.value ? maximumWidth.value : newWidth < props.minimumWidth ? props.minimumWidth : newWidth;
144
- startPositionX.value = position.x;
145
- },
146
- onEnd: () => {
147
- document.body.style.cursor = '';
148
- document.body.style.userSelect = '';
149
- isResizing.value = false;
150
- }
151
- });
152
- const {
153
- width: maximumWidth
154
- } = useElementBounding(parentContainer);
155
- watch(() => props.width, newValue => {
156
- if (newValue !== localWidth.value) {
157
- localWidth.value = newValue > maximumWidth.value ? maximumWidth.value : newValue < props.minimumWidth ? props.minimumWidth : newValue;
158
- }
159
- });
160
- watch(() => props.minimumWidth, newMinimum => {
161
- if (newMinimum > localWidth.value) localWidth.value = newMinimum;
162
- });
163
- watch(maximumWidth, newMaximum => {
164
- if (newMaximum < localWidth.value) localWidth.value = newMaximum;
165
- });
166
- watch(localWidth, val => emit('change:width', val));
167
- return {
168
- root,
169
- resizeBar,
170
- isResizing,
171
- localWidth,
172
- sidebarStyle,
173
- rootStyles,
174
- resizeStyles,
175
- mainStyles,
176
- headerStyles,
177
- contentStyles,
178
- footerStyles
179
- };
180
- }
181
- });
182
-
183
- /* script */
184
- const __vue_script__ = script;
185
-
186
- /* template */
187
- var __vue_render__ = function () {
188
- var _vm = this;
189
- var _h = _vm.$createElement;
190
- var _c = _vm._self._c || _h;
191
- return _c('aside', {
192
- ref: "root",
193
- class: _vm.rootStyles,
194
- style: _vm.sidebarStyle
195
- }, [_c('div', {
196
- ref: "resizeBar",
197
- class: _vm.resizeStyles
198
- }), _vm._v(" "), _c('div', {
199
- class: _vm.mainStyles
200
- }, [_vm.$slots.header ? _c('div', {
201
- class: _vm.headerStyles
202
- }, [_vm._t("header")], 2) : _vm._e(), _vm._v(" "), _c('div', {
203
- class: _vm.contentStyles
204
- }, [_vm._t("default")], 2)]), _vm._v(" "), _vm.$slots.footer ? _c('div', {
205
- class: _vm.footerStyles
206
- }, [_vm._t("footer")], 2) : _vm._e()]);
207
- };
208
- var __vue_staticRenderFns__ = [];
209
-
210
- /* style */
211
- const __vue_inject_styles__ = undefined;
212
- /* scoped */
213
- const __vue_scope_id__ = undefined;
214
- /* module identifier */
215
- const __vue_module_identifier__ = undefined;
216
- /* functional template */
217
- const __vue_is_functional_template__ = false;
218
- /* style inject */
219
-
220
- /* style inject SSR */
221
-
222
- /* style inject shadow dom */
223
-
224
- const __vue_component__ = /*#__PURE__*/normalizeComponent({
225
- render: __vue_render__,
226
- staticRenderFns: __vue_staticRenderFns__
227
- }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
228
- var __vue_component__$1 = __vue_component__;
229
-
230
- export { OrSidebarPlacement as O, __vue_component__$1 as _ };
@@ -1,181 +0,0 @@
1
- import { useDraggable, useElementBounding } from '@vueuse/core';
2
- import _ from 'lodash';
3
- import { defineComponent, ref, computed, watch } from 'vue';
4
-
5
- var OrSidebarPlacement;
6
- (function (OrSidebarPlacement) {
7
- OrSidebarPlacement["left"] = "left";
8
- OrSidebarPlacement["right"] = "right";
9
- })(OrSidebarPlacement || (OrSidebarPlacement = {}));
10
-
11
- const SidebarRoot = [
12
- // Position
13
- 'relative',
14
- // Layout
15
- 'flex', 'flex-col', 'shrink-0',
16
- // Box
17
- 'min-h-0', 'p-0'];
18
- const SidebarRootSides = {
19
- [OrSidebarPlacement.left]: [
20
- // Borders
21
- 'border-r-[1px]', 'border-r-solid', 'border-r-secondary dark:border-r-secondary-dark'],
22
- [OrSidebarPlacement.right]: [
23
- // Borders
24
- 'border-l-[1px]', 'border-l-solid', 'border-l-secondary dark:border-l-secondary-dark']
25
- };
26
- const SidebarResize = [
27
- // Position
28
- 'absolute', 'inset-y-none', 'z-[1]',
29
- // Box
30
- 'w-[12px]', 'h-[100%]',
31
- // Cursor
32
- 'cursor-ew-resize'];
33
- const SidebarResizeSides = {
34
- [OrSidebarPlacement.left]: [
35
- // Position
36
- '-right-[1px]',
37
- // Borders
38
- 'hover:border-r-2', 'hover:border-r-primary hover:dark:border-r-primary-dark',
39
- // Transition
40
- 'transition-[border-right]'],
41
- [OrSidebarPlacement.right]: [
42
- // Position
43
- '-left-[1px]',
44
- // Borders
45
- 'hover:border-l-2', 'hover:border-l-primary hover:dark:border-l-primary-dark',
46
- // Transition
47
- 'transition-[border-left]']
48
- };
49
- const SidebarResizingSides = {
50
- [OrSidebarPlacement.left]: [
51
- // Borders
52
- 'border-r-2', 'border-r-primary dark:border-r-primary-dark'],
53
- [OrSidebarPlacement.right]: [
54
- // Borders
55
- 'border-l-2', 'border-l-primary dark:border-l-primary-dark']
56
- };
57
- const SidebarMain = [
58
- // Layout
59
- 'flex', 'flex-col', 'grow',
60
- // Box
61
- 'min-h-0'];
62
- const SidebarHeader = [
63
- // Sizing
64
- 'p-md'];
65
- const SidebarContent = [
66
- // Layout
67
- 'grow', 'overflow-auto',
68
- // Sizing
69
- 'p-md'];
70
- const SidebarFooter = [
71
- // Sizing
72
- 'p-md',
73
- // Borders
74
- 'border-t-[1px]', 'border-t-solid', 'border-t-secondary dark:border-t-secondary-dark'];
75
-
76
- var script = defineComponent({
77
- name: 'OrSidebar',
78
- props: {
79
- width: {
80
- type: Number,
81
- required: false,
82
- default: 0,
83
- validator: value => _.isNumber(value) && value >= 0
84
- },
85
- minimumWidth: {
86
- type: Number,
87
- required: false,
88
- default: 350,
89
- validator: value => _.isNumber(value) && value >= 0
90
- },
91
- /**
92
- * User may put the component on the right or the left side of a container.
93
- * This property mirrors the resizing behavior (drag direction) and styling (horizontal border) of the sidebar.
94
- *
95
- * Note: the property doesn't reposition the component in the parent container.
96
- * @values left, right
97
- */
98
- side: {
99
- type: String,
100
- default: OrSidebarPlacement.right,
101
- validator: value => _.includes(_.values(OrSidebarPlacement), value)
102
- }
103
- },
104
- emits: ['change:width'],
105
- setup(props, {
106
- emit
107
- }) {
108
- // Refs
109
- const root = ref();
110
- const resizeBar = ref(null);
111
- const parentContainer = computed(() => {
112
- var _a;
113
- return (_a = root.value) === null || _a === void 0 ? void 0 : _a.parentElement;
114
- });
115
- // State
116
- const startPositionX = ref(0);
117
- const isResizing = ref(false);
118
- const localWidth = ref(props.width >= props.minimumWidth ? props.width : props.minimumWidth);
119
- // Styles
120
- const sidebarStyle = computed(() => ({
121
- width: localWidth.value + 'px'
122
- }));
123
- const rootStyles = computed(() => ['or-sidebar', ...SidebarRoot, ...SidebarRootSides[props.side]]);
124
- const resizeStyles = computed(() => [...SidebarResize, ...SidebarResizeSides[props.side], ...(isResizing.value ? SidebarResizingSides[props.side] : [])]);
125
- const mainStyles = computed(() => [...SidebarMain]);
126
- const headerStyles = computed(() => [...SidebarHeader]);
127
- const contentStyles = computed(() => [...SidebarContent]);
128
- const footerStyles = computed(() => [...SidebarFooter]);
129
- // Effects
130
- useDraggable(resizeBar, {
131
- preventDefault: true,
132
- onStart: (position, event) => {
133
- document.body.style.cursor = 'ew-resize';
134
- document.body.style.userSelect = 'none';
135
- startPositionX.value = event.x;
136
- isResizing.value = true;
137
- },
138
- onMove: position => {
139
- const delta = (position.x - startPositionX.value) * (props.side === OrSidebarPlacement.left ? -1 : 1);
140
- const newWidth = localWidth.value - delta;
141
- localWidth.value = newWidth > maximumWidth.value ? maximumWidth.value : newWidth < props.minimumWidth ? props.minimumWidth : newWidth;
142
- startPositionX.value = position.x;
143
- },
144
- onEnd: () => {
145
- document.body.style.cursor = '';
146
- document.body.style.userSelect = '';
147
- isResizing.value = false;
148
- }
149
- });
150
- const {
151
- width: maximumWidth
152
- } = useElementBounding(parentContainer);
153
- watch(() => props.width, newValue => {
154
- if (newValue !== localWidth.value) {
155
- localWidth.value = newValue > maximumWidth.value ? maximumWidth.value : newValue < props.minimumWidth ? props.minimumWidth : newValue;
156
- }
157
- });
158
- watch(() => props.minimumWidth, newMinimum => {
159
- if (newMinimum > localWidth.value) localWidth.value = newMinimum;
160
- });
161
- watch(maximumWidth, newMaximum => {
162
- if (newMaximum < localWidth.value) localWidth.value = newMaximum;
163
- });
164
- watch(localWidth, val => emit('change:width', val));
165
- return {
166
- root,
167
- resizeBar,
168
- isResizing,
169
- localWidth,
170
- sidebarStyle,
171
- rootStyles,
172
- resizeStyles,
173
- mainStyles,
174
- headerStyles,
175
- contentStyles,
176
- footerStyles
177
- };
178
- }
179
- });
180
-
181
- export { OrSidebarPlacement as O, script as s };