@onereach/ui-components 2.72.1-beta.2252.0 → 2.72.1
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/dist/bundled/v2/OrSidebar-c95ef614.js +230 -0
- package/dist/bundled/v2/components/index.js +1 -1
- package/dist/bundled/v2/components/or-sidebar-v3/OrSidebar.stories3.d.ts +1 -36
- package/dist/bundled/v2/components/or-sidebar-v3/OrSidebar.vue.d.ts +4 -49
- package/dist/bundled/v2/components/or-sidebar-v3/index.js +1 -12
- package/dist/bundled/v2/components/or-sidebar-v3/styles.d.ts +1 -9
- package/dist/bundled/v2/index.js +2 -2
- package/dist/bundled/v3/OrSidebar.vue_vue_type_script_lang-ce0b152c.js +181 -0
- package/dist/bundled/v3/components/index.js +1 -1
- package/dist/bundled/v3/components/or-sidebar-v3/OrSidebar.stories3.d.ts +1 -36
- package/dist/bundled/v3/components/or-sidebar-v3/OrSidebar.vue.d.ts +4 -49
- package/dist/bundled/v3/components/or-sidebar-v3/index.js +1 -14
- package/dist/bundled/v3/components/or-sidebar-v3/styles.d.ts +1 -9
- package/dist/bundled/v3/index.js +9 -25
- package/dist/esm/v2/OrSidebar-fabc7bc9.js +228 -0
- package/dist/esm/v2/components/index.js +1 -1
- package/dist/esm/v2/components/or-sidebar-v3/OrSidebar.stories3.d.ts +1 -36
- package/dist/esm/v2/components/or-sidebar-v3/OrSidebar.vue.d.ts +4 -49
- package/dist/esm/v2/components/or-sidebar-v3/index.js +1 -12
- package/dist/esm/v2/components/or-sidebar-v3/styles.d.ts +1 -9
- package/dist/esm/v2/index.js +1 -1
- package/dist/esm/v3/OrSidebar-a62972f5.js +206 -0
- package/dist/esm/v3/components/index.js +1 -1
- package/dist/esm/v3/components/or-sidebar-v3/OrSidebar.stories3.d.ts +1 -36
- package/dist/esm/v3/components/or-sidebar-v3/OrSidebar.vue.d.ts +4 -49
- package/dist/esm/v3/components/or-sidebar-v3/index.js +1 -11
- package/dist/esm/v3/components/or-sidebar-v3/styles.d.ts +1 -9
- package/dist/esm/v3/index.js +1 -1
- package/package.json +4 -3
- package/src/components/or-sidebar-v3/OrSidebar.docs.mdx +0 -6
- package/src/components/or-sidebar-v3/OrSidebar.stories3.ts +12 -253
- package/src/components/or-sidebar-v3/OrSidebar.vue +23 -130
- package/src/components/or-sidebar-v3/styles.ts +9 -164
- package/dist/bundled/v2/OrSidebar-efd4b98a.js +0 -464
- package/dist/bundled/v2/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.d.ts +0 -12
- package/dist/bundled/v2/components/or-sidebar-v3/OrSidebarCollapseButton.vue.d.ts +0 -53
- package/dist/bundled/v3/OrSidebar.vue_vue_type_script_lang-66f8f0fd.js +0 -356
- package/dist/bundled/v3/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.d.ts +0 -12
- package/dist/bundled/v3/components/or-sidebar-v3/OrSidebarCollapseButton.vue.d.ts +0 -53
- package/dist/esm/v2/OrSidebar-b7202f16.js +0 -461
- package/dist/esm/v2/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.d.ts +0 -12
- package/dist/esm/v2/components/or-sidebar-v3/OrSidebarCollapseButton.vue.d.ts +0 -53
- package/dist/esm/v3/OrSidebar-3567338f.js +0 -396
- package/dist/esm/v3/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.d.ts +0 -12
- package/dist/esm/v3/components/or-sidebar-v3/OrSidebarCollapseButton.vue.d.ts +0 -53
- package/src/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.ts +0 -48
- package/src/components/or-sidebar-v3/OrSidebarCollapseButton.vue +0 -74
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
import { useDraggable, useElementBounding } from '@vueuse/core';
|
|
2
|
-
import _ from 'lodash';
|
|
3
|
-
import { defineComponent, ref, computed, useSlots, watch } from 'vue-demi';
|
|
4
|
-
import { s as script$2 } from './OrIconButton-2dcfb83e.js';
|
|
5
|
-
import { resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, renderSlot, createCommentVNode, createElementVNode, normalizeStyle, createBlock, withDirectives, vShow } from 'vue';
|
|
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-row', 'shrink-0',
|
|
18
|
-
// Box
|
|
19
|
-
'min-w-0', 'h-auto', 'p-0',
|
|
20
|
-
// Theme
|
|
21
|
-
'bg-background', 'dark:bg-background-dark'];
|
|
22
|
-
const SidebarBar = [
|
|
23
|
-
// Position
|
|
24
|
-
'relative',
|
|
25
|
-
// Layout
|
|
26
|
-
'flex', 'flex-col', 'shrink-0', 'grow',
|
|
27
|
-
// Box
|
|
28
|
-
'min-h-0', 'p-0',
|
|
29
|
-
// Theme
|
|
30
|
-
'text-on-background', 'dark:text-on-background-dark',
|
|
31
|
-
// Transition
|
|
32
|
-
'transition-[width]'];
|
|
33
|
-
const SidebarToolbar = [
|
|
34
|
-
// Position
|
|
35
|
-
'relative',
|
|
36
|
-
// Layout
|
|
37
|
-
'flex', 'flex-col', 'shrink-0', 'grow', 'overflow-auto', 'items-center',
|
|
38
|
-
// Sizing
|
|
39
|
-
'gap-md',
|
|
40
|
-
// Box
|
|
41
|
-
'min-h-0', 'min-w-xl', 'p-[6px]', 'py-md+',
|
|
42
|
-
// Theme
|
|
43
|
-
'text-outline', 'dark:text-outline-dark'];
|
|
44
|
-
const CollapsibleSidebarToolbar = ['pt-[56px]'];
|
|
45
|
-
const SidebarSides = {
|
|
46
|
-
[OrSidebarPlacement.left]: [
|
|
47
|
-
// Borders
|
|
48
|
-
'border-r-[1px]', 'border-r-solid', 'border-r-outline-variant dark:border-r-outline-variant-dark'],
|
|
49
|
-
[OrSidebarPlacement.right]: [
|
|
50
|
-
// Borders
|
|
51
|
-
'border-l-[1px]', 'border-l-solid', 'border-l-outline-variant dark:border-l-outline-variant-dark']
|
|
52
|
-
};
|
|
53
|
-
const SidebarToolbarSides = {
|
|
54
|
-
[OrSidebarPlacement.left]: [
|
|
55
|
-
// Borders
|
|
56
|
-
'border-r-[1px]', 'border-r-solid', 'border-r-outline-variant dark:border-r-outline-variant-dark'],
|
|
57
|
-
[OrSidebarPlacement.right]: [
|
|
58
|
-
// Borders
|
|
59
|
-
'border-l-[1px]', 'border-l-solid', 'border-l-outline-variant dark:border-l-outline-variant-dark']
|
|
60
|
-
};
|
|
61
|
-
const SidebarResize = [
|
|
62
|
-
// Position
|
|
63
|
-
'absolute', 'inset-y-none', 'z-[1]',
|
|
64
|
-
// Box
|
|
65
|
-
'w-sm+', 'h-[100%]',
|
|
66
|
-
// Cursor
|
|
67
|
-
'cursor-ew-resize'];
|
|
68
|
-
const SidebarResizeSides = {
|
|
69
|
-
[OrSidebarPlacement.left]: [
|
|
70
|
-
// Position
|
|
71
|
-
'-right-[1px]',
|
|
72
|
-
// Borders
|
|
73
|
-
'hover:border-r-2', 'hover:border-r-primary-hover hover:dark:border-r-primary-hover-dark',
|
|
74
|
-
// Transition
|
|
75
|
-
'transition-[border-right]'],
|
|
76
|
-
[OrSidebarPlacement.right]: [
|
|
77
|
-
// Position
|
|
78
|
-
'-left-[1px]',
|
|
79
|
-
// Borders
|
|
80
|
-
'hover:border-l-2', 'hover:border-l-primary-hover hover:dark:border-l-primary-hover-dark',
|
|
81
|
-
// Transition
|
|
82
|
-
'transition-[border-left]']
|
|
83
|
-
};
|
|
84
|
-
const SidebarCollapseButton = [
|
|
85
|
-
// Position
|
|
86
|
-
'absolute', 'top-md', 'inset-y-none', 'z-[1]'];
|
|
87
|
-
const SidebarCollapseButtonSides = {
|
|
88
|
-
[OrSidebarPlacement.left]: [
|
|
89
|
-
// Position
|
|
90
|
-
'-right-[12px]'],
|
|
91
|
-
[OrSidebarPlacement.right]: [
|
|
92
|
-
// Position
|
|
93
|
-
'-left-[12px]']
|
|
94
|
-
};
|
|
95
|
-
const SidebarResizingSides = {
|
|
96
|
-
[OrSidebarPlacement.left]: [
|
|
97
|
-
// Borders
|
|
98
|
-
'border-r-2', 'border-r-primary-hover dark:border-r-primary-hover-dark'],
|
|
99
|
-
[OrSidebarPlacement.right]: [
|
|
100
|
-
// Borders
|
|
101
|
-
'border-l-2', 'border-l-primary-hover dark:border-l-primary-hover-dark']
|
|
102
|
-
};
|
|
103
|
-
const SidebarMain = [
|
|
104
|
-
// Layout
|
|
105
|
-
'flex', 'flex-col', 'grow', 'overflow-x-hidden',
|
|
106
|
-
// Box
|
|
107
|
-
'min-h-0'];
|
|
108
|
-
const SidebarHeader = [
|
|
109
|
-
// Layout
|
|
110
|
-
'shrink-0', 'overflow-hidden',
|
|
111
|
-
// Sizing
|
|
112
|
-
'p-md',
|
|
113
|
-
// Typography
|
|
114
|
-
'typography-headline-2', 'whitespace-nowrap', 'text-ellipsis'];
|
|
115
|
-
const SidebarContent = [
|
|
116
|
-
// Layout
|
|
117
|
-
'grow', 'overflow-auto',
|
|
118
|
-
// Sizing
|
|
119
|
-
'p-md'];
|
|
120
|
-
const SidebarFooter = [
|
|
121
|
-
// Layout
|
|
122
|
-
'shrink-0', 'overflow-x-hidden',
|
|
123
|
-
// Sizing
|
|
124
|
-
'p-md',
|
|
125
|
-
// Borders
|
|
126
|
-
'border-t-[1px]', 'border-t-solid', 'border-t-outline-variant dark:border-t-outline-variant-dark'];
|
|
127
|
-
const CollapseButtonContainer = [
|
|
128
|
-
// Box
|
|
129
|
-
'w-[24px]', 'h-[24px]', 'rounded-full',
|
|
130
|
-
// Theme
|
|
131
|
-
'text-primary dark:text-primary-dark', 'bg-background dark:bg-background-dark'];
|
|
132
|
-
const CollapseButton = [
|
|
133
|
-
// Box
|
|
134
|
-
'w-[24px]', 'h-[24px]',
|
|
135
|
-
// Typography
|
|
136
|
-
'!text-[16px]',
|
|
137
|
-
// Borders
|
|
138
|
-
'!border-[1px]', '!border-solid',
|
|
139
|
-
// Theme
|
|
140
|
-
'!text-primary dark:!text-primary-dark', '!bg-background dark:!bg-background-dark', '!border-outline-variant dark:!border-outline-variant-dark', '!outline-none',
|
|
141
|
-
// Theme (hover)
|
|
142
|
-
'hover:!text-primary hover:dark:!text-primary-dark', 'hover:!bg-primary-opacity-0-08 dark:hover:!bg-primary-opacity-0-08-dark', 'hover:!border-outline dark:hover:!border-outline-dark',
|
|
143
|
-
// Theme (active)
|
|
144
|
-
'active:!text-primary active:dark:!text-primary-dark', 'active:!bg-primary-opacity-0-12 dark:active:!bg-primary-opacity-0-12-dark', 'active:!border-primary dark:active:!border-primary-dark',
|
|
145
|
-
// Theme (focus)
|
|
146
|
-
'focus:!text-primary focus:dark:!text-primary-dark', 'focus:!bg-primary-opacity-0-12 dark:focus:!bg-primary-opacity-0-12-dark', 'focus:!border-outline dark:focus:!border-outline-dark',
|
|
147
|
-
// Theme (disabled)
|
|
148
|
-
'disabled:!text-on-disabled disabled:dark:!text-on-disabled-dark', 'disabled:!bg-background disabled:dark:!bg-background-dark', 'disabled:!border-outline-variant disabled:dark:!border-outline-variant-dark'];
|
|
149
|
-
|
|
150
|
-
var script$1 = defineComponent({
|
|
151
|
-
name: 'OrSidebarCollapseButton',
|
|
152
|
-
components: {
|
|
153
|
-
OrIconButton: script$2
|
|
154
|
-
},
|
|
155
|
-
props: {
|
|
156
|
-
/**
|
|
157
|
-
* Must be `true` if sidebar is collapsed.
|
|
158
|
-
*/
|
|
159
|
-
modelValue: {
|
|
160
|
-
type: Boolean,
|
|
161
|
-
default: false
|
|
162
|
-
},
|
|
163
|
-
side: {
|
|
164
|
-
type: String,
|
|
165
|
-
default: OrSidebarPlacement.right,
|
|
166
|
-
validator: value => _.includes(_.values(OrSidebarPlacement), value)
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
emits: ['update:modelValue'],
|
|
170
|
-
expose: ['root'],
|
|
171
|
-
setup(props) {
|
|
172
|
-
// Refs
|
|
173
|
-
const root = ref();
|
|
174
|
-
const rootStyles = computed(() => ['or-sidebar-collapse-button', ...CollapseButtonContainer]);
|
|
175
|
-
const buttonStyles = computed(() => [...CollapseButton]);
|
|
176
|
-
const icon = computed(() => props.side === OrSidebarPlacement.left !== props.modelValue ? 'keyboard_arrow_left' : 'keyboard_arrow_right');
|
|
177
|
-
return {
|
|
178
|
-
root,
|
|
179
|
-
rootStyles,
|
|
180
|
-
buttonStyles,
|
|
181
|
-
icon
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
187
|
-
const _component_or_icon_button = resolveComponent("or-icon-button");
|
|
188
|
-
return openBlock(), createElementBlock("div", {
|
|
189
|
-
ref: "root",
|
|
190
|
-
class: normalizeClass(_ctx.rootStyles)
|
|
191
|
-
}, [createVNode(_component_or_icon_button, {
|
|
192
|
-
class: normalizeClass(_ctx.buttonStyles),
|
|
193
|
-
icon: {
|
|
194
|
-
icon: _ctx.icon,
|
|
195
|
-
size: 'inherit'
|
|
196
|
-
},
|
|
197
|
-
color: "inherit",
|
|
198
|
-
onClick: _cache[0] || (_cache[0] = $event => _ctx.$emit('update:modelValue', !_ctx.modelValue))
|
|
199
|
-
}, null, 8 /* PROPS */, ["class", "icon"])], 2 /* CLASS */);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
script$1.render = render$1;
|
|
203
|
-
script$1.__file = "src/components/or-sidebar-v3/OrSidebarCollapseButton.vue";
|
|
204
|
-
|
|
205
|
-
var script = defineComponent({
|
|
206
|
-
name: 'OrSidebar',
|
|
207
|
-
components: {
|
|
208
|
-
OrSidebarCollapseButton: script$1
|
|
209
|
-
},
|
|
210
|
-
props: {
|
|
211
|
-
width: {
|
|
212
|
-
type: Number,
|
|
213
|
-
default: 320,
|
|
214
|
-
validator: value => _.isNumber(value) && value >= 0
|
|
215
|
-
},
|
|
216
|
-
minimumWidth: {
|
|
217
|
-
type: Number,
|
|
218
|
-
default: 256,
|
|
219
|
-
validator: value => _.isNumber(value) && value >= 0
|
|
220
|
-
},
|
|
221
|
-
maximumWidth: {
|
|
222
|
-
type: Number,
|
|
223
|
-
default: 384,
|
|
224
|
-
validator: value => _.isNumber(value) && value >= 0
|
|
225
|
-
},
|
|
226
|
-
/**
|
|
227
|
-
* User may put the component on the right or the left side of a container.
|
|
228
|
-
* This property mirrors the resizing behavior (drag direction) and styling (horizontal border) of the sidebar.
|
|
229
|
-
*
|
|
230
|
-
* Note: the property doesn't reposition the component in the parent container.
|
|
231
|
-
* @values left, right
|
|
232
|
-
*/
|
|
233
|
-
side: {
|
|
234
|
-
type: String,
|
|
235
|
-
default: OrSidebarPlacement.right,
|
|
236
|
-
validator: value => _.includes(_.values(OrSidebarPlacement), value)
|
|
237
|
-
},
|
|
238
|
-
draggable: {
|
|
239
|
-
type: Boolean,
|
|
240
|
-
default: true
|
|
241
|
-
},
|
|
242
|
-
collapsible: {
|
|
243
|
-
type: Boolean,
|
|
244
|
-
default: false
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
emits: ['change:width', 'open', 'close'],
|
|
248
|
-
expose: ['root', 'open', 'close'],
|
|
249
|
-
setup(props, {
|
|
250
|
-
emit
|
|
251
|
-
}) {
|
|
252
|
-
// Refs
|
|
253
|
-
const root = ref();
|
|
254
|
-
const resizeBar = ref(null);
|
|
255
|
-
const parentContainer = computed(() => {
|
|
256
|
-
var _a;
|
|
257
|
-
return (_a = root.value) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
258
|
-
});
|
|
259
|
-
// Slots
|
|
260
|
-
const {
|
|
261
|
-
toolbar: toolbarSlot
|
|
262
|
-
} = useSlots();
|
|
263
|
-
// State
|
|
264
|
-
const startPositionX = ref(0);
|
|
265
|
-
const isResizing = ref(false);
|
|
266
|
-
const isCollapsed = ref(false);
|
|
267
|
-
const maximumWidth = ref(props.maximumWidth || 384);
|
|
268
|
-
const localWidth = ref(props.width >= props.minimumWidth ? props.width : props.minimumWidth);
|
|
269
|
-
const isShowingToolbar = computed(() => !!toolbarSlot);
|
|
270
|
-
// Styles
|
|
271
|
-
const sidebarStyle = computed(() => ({
|
|
272
|
-
width: (isCollapsed.value ? 16 : localWidth.value) + 'px'
|
|
273
|
-
}));
|
|
274
|
-
const rootStyles = computed(() => ['or-sidebar', ...SidebarRoot]);
|
|
275
|
-
const sidebarStyles = computed(() => [...SidebarBar, ...SidebarSides[props.side]]);
|
|
276
|
-
const toolbarStyles = computed(() => [...SidebarToolbar, ...(props.collapsible ? CollapsibleSidebarToolbar : []), ...SidebarToolbarSides[props.side]]);
|
|
277
|
-
const resizeStyles = computed(() => [...SidebarResize, ...SidebarResizeSides[props.side], ...(isResizing.value ? SidebarResizingSides[props.side] : [])]);
|
|
278
|
-
const collapsibleButtonStyles = computed(() => [...SidebarCollapseButton, ...SidebarCollapseButtonSides[props.side]]);
|
|
279
|
-
const mainStyles = computed(() => [...SidebarMain]);
|
|
280
|
-
const headerStyles = computed(() => [...SidebarHeader]);
|
|
281
|
-
const contentStyles = computed(() => [...SidebarContent]);
|
|
282
|
-
const footerStyles = computed(() => [...SidebarFooter]);
|
|
283
|
-
// Effects
|
|
284
|
-
useDraggable(resizeBar, {
|
|
285
|
-
preventDefault: true,
|
|
286
|
-
onStart: (position, event) => {
|
|
287
|
-
document.body.style.cursor = 'ew-resize';
|
|
288
|
-
document.body.style.userSelect = 'none';
|
|
289
|
-
startPositionX.value = event.x;
|
|
290
|
-
isResizing.value = true;
|
|
291
|
-
},
|
|
292
|
-
onMove: position => {
|
|
293
|
-
const delta = (position.x - startPositionX.value) * (props.side === OrSidebarPlacement.left ? -1 : 1);
|
|
294
|
-
const newWidth = localWidth.value - delta;
|
|
295
|
-
localWidth.value = newWidth > maximumWidth.value ? maximumWidth.value : newWidth < props.minimumWidth ? props.minimumWidth : newWidth;
|
|
296
|
-
startPositionX.value = position.x;
|
|
297
|
-
},
|
|
298
|
-
onEnd: () => {
|
|
299
|
-
document.body.style.cursor = '';
|
|
300
|
-
document.body.style.userSelect = '';
|
|
301
|
-
isResizing.value = false;
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
// Methods
|
|
305
|
-
function open() {
|
|
306
|
-
isCollapsed.value = false;
|
|
307
|
-
}
|
|
308
|
-
function close() {
|
|
309
|
-
isCollapsed.value = true;
|
|
310
|
-
}
|
|
311
|
-
const {
|
|
312
|
-
width: containerWidth
|
|
313
|
-
} = useElementBounding(parentContainer);
|
|
314
|
-
watch(() => props.width, newValue => {
|
|
315
|
-
if (newValue !== localWidth.value) {
|
|
316
|
-
localWidth.value = newValue > maximumWidth.value ? maximumWidth.value : newValue < props.minimumWidth ? props.minimumWidth : newValue;
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
watch(() => props.minimumWidth, newMinimum => {
|
|
320
|
-
if (newMinimum > localWidth.value) localWidth.value = newMinimum;
|
|
321
|
-
});
|
|
322
|
-
watch(() => props.maximumWidth, newMaximum => {
|
|
323
|
-
if (newMaximum < maximumWidth.value) maximumWidth.value = newMaximum;
|
|
324
|
-
});
|
|
325
|
-
watch(containerWidth, newMaximum => {
|
|
326
|
-
if (newMaximum < maximumWidth.value) maximumWidth.value = newMaximum;
|
|
327
|
-
});
|
|
328
|
-
watch(maximumWidth, newMaximum => {
|
|
329
|
-
if (newMaximum < localWidth.value) localWidth.value = newMaximum;
|
|
330
|
-
});
|
|
331
|
-
watch(localWidth, val => emit('change:width', val));
|
|
332
|
-
watch(isCollapsed, val => emit(val ? 'close' : 'open'));
|
|
333
|
-
return {
|
|
334
|
-
root,
|
|
335
|
-
resizeBar,
|
|
336
|
-
isResizing,
|
|
337
|
-
isCollapsed,
|
|
338
|
-
localWidth,
|
|
339
|
-
isShowingToolbar,
|
|
340
|
-
sidebarStyle,
|
|
341
|
-
rootStyles,
|
|
342
|
-
sidebarStyles,
|
|
343
|
-
toolbarStyles,
|
|
344
|
-
resizeStyles,
|
|
345
|
-
collapsibleButtonStyles,
|
|
346
|
-
mainStyles,
|
|
347
|
-
headerStyles,
|
|
348
|
-
contentStyles,
|
|
349
|
-
footerStyles,
|
|
350
|
-
open,
|
|
351
|
-
close
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
357
|
-
const _component_or_sidebar_collapse_button = resolveComponent("or-sidebar-collapse-button");
|
|
358
|
-
return openBlock(), createElementBlock("aside", {
|
|
359
|
-
ref: "root",
|
|
360
|
-
class: normalizeClass(_ctx.rootStyles)
|
|
361
|
-
}, [_ctx.side === 'right' && _ctx.isShowingToolbar ? (openBlock(), createElementBlock("div", {
|
|
362
|
-
key: 0,
|
|
363
|
-
class: normalizeClass(_ctx.toolbarStyles)
|
|
364
|
-
}, [renderSlot(_ctx.$slots, "toolbar")], 2 /* CLASS */)) : createCommentVNode("v-if", true), createElementVNode("div", {
|
|
365
|
-
class: normalizeClass(_ctx.sidebarStyles),
|
|
366
|
-
style: normalizeStyle(_ctx.sidebarStyle)
|
|
367
|
-
}, [_ctx.draggable && !_ctx.isCollapsed ? (openBlock(), createElementBlock("div", {
|
|
368
|
-
key: 0,
|
|
369
|
-
ref: "resizeBar",
|
|
370
|
-
class: normalizeClass(_ctx.resizeStyles)
|
|
371
|
-
}, null, 2 /* CLASS */)) : createCommentVNode("v-if", true), _ctx.collapsible ? (openBlock(), createBlock(_component_or_sidebar_collapse_button, {
|
|
372
|
-
key: 1,
|
|
373
|
-
modelValue: _ctx.isCollapsed,
|
|
374
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => _ctx.isCollapsed = $event),
|
|
375
|
-
class: normalizeClass(_ctx.collapsibleButtonStyles),
|
|
376
|
-
side: _ctx.side
|
|
377
|
-
}, null, 8 /* PROPS */, ["modelValue", "class", "side"])) : createCommentVNode("v-if", true), withDirectives(createElementVNode("div", {
|
|
378
|
-
class: normalizeClass(_ctx.mainStyles)
|
|
379
|
-
}, [_ctx.$slots.header ? (openBlock(), createElementBlock("div", {
|
|
380
|
-
key: 0,
|
|
381
|
-
class: normalizeClass(_ctx.headerStyles)
|
|
382
|
-
}, [renderSlot(_ctx.$slots, "header")], 2 /* CLASS */)) : createCommentVNode("v-if", true), createElementVNode("div", {
|
|
383
|
-
class: normalizeClass(_ctx.contentStyles)
|
|
384
|
-
}, [renderSlot(_ctx.$slots, "default")], 2 /* CLASS */)], 2 /* CLASS */), [[vShow, !_ctx.isCollapsed]]), _ctx.$slots.footer ? withDirectives((openBlock(), createElementBlock("div", {
|
|
385
|
-
key: 2,
|
|
386
|
-
class: normalizeClass(_ctx.footerStyles)
|
|
387
|
-
}, [renderSlot(_ctx.$slots, "footer")], 2 /* CLASS */)), [[vShow, !_ctx.isCollapsed]]) : createCommentVNode("v-if", true)], 6 /* CLASS, STYLE */), _ctx.side === 'left' && _ctx.isShowingToolbar ? (openBlock(), createElementBlock("div", {
|
|
388
|
-
key: 1,
|
|
389
|
-
class: normalizeClass(_ctx.toolbarStyles)
|
|
390
|
-
}, [renderSlot(_ctx.$slots, "toolbar")], 2 /* CLASS */)) : createCommentVNode("v-if", true)], 2 /* CLASS */);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
script.render = render;
|
|
394
|
-
script.__file = "src/components/or-sidebar-v3/OrSidebar.vue";
|
|
395
|
-
|
|
396
|
-
export { OrSidebarPlacement as O, script as s };
|
|
@@ -1,12 +0,0 @@
|
|
|
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>)>;
|
|
@@ -1,53 +0,0 @@
|
|
|
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;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/vue3';
|
|
2
|
-
import OrSidebarCollapseButton from './OrSidebarCollapseButton.vue';
|
|
3
|
-
import { OrSidebarPlacement } from './props';
|
|
4
|
-
import { action } from '@storybook/addon-actions';
|
|
5
|
-
import { ref } from 'vue-demi';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'Components/Sidebar/Parts/CollapseButton',
|
|
9
|
-
component: OrSidebarCollapseButton,
|
|
10
|
-
|
|
11
|
-
argTypes: {
|
|
12
|
-
// Props
|
|
13
|
-
modelValue: {
|
|
14
|
-
control: { type: 'boolean' },
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
side: {
|
|
18
|
-
control: { type: 'select' },
|
|
19
|
-
options: Object.values(OrSidebarPlacement),
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
} as Meta<typeof OrSidebarCollapseButton>;
|
|
23
|
-
|
|
24
|
-
const DefaultTemplate: StoryFn<typeof OrSidebarCollapseButton> = (args) => ({
|
|
25
|
-
components: {
|
|
26
|
-
OrSidebarCollapseButton,
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
setup() {
|
|
30
|
-
const collapsed = ref<boolean>(!!args.modelValue);
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
args,
|
|
34
|
-
collapsed,
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
methods: {
|
|
39
|
-
onUpdateModelValue: action('update:modelValue'),
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
template: '<OrSidebarCollapseButton v-model="collapsed" v-bind="args" @update:modelValue="onUpdateModelValue" />',
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
export const Default = DefaultTemplate.bind({});
|
|
46
|
-
Default.args = {
|
|
47
|
-
side: OrSidebarPlacement.right,
|
|
48
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
ref="root"
|
|
4
|
-
:class="rootStyles"
|
|
5
|
-
>
|
|
6
|
-
<or-icon-button
|
|
7
|
-
:class="buttonStyles"
|
|
8
|
-
:icon="{ icon, size: 'inherit' }"
|
|
9
|
-
color="inherit"
|
|
10
|
-
@click="$emit('update:modelValue', !modelValue)"
|
|
11
|
-
/>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script lang="ts">
|
|
16
|
-
import _ from 'lodash';
|
|
17
|
-
import { computed, defineComponent, PropType, ref } from 'vue-demi';
|
|
18
|
-
import { OrSidebarPlacement } from './props';
|
|
19
|
-
import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
|
|
20
|
-
import { CollapseButton, CollapseButtonContainer } from './styles';
|
|
21
|
-
|
|
22
|
-
export default defineComponent({
|
|
23
|
-
name: 'OrSidebarCollapseButton',
|
|
24
|
-
|
|
25
|
-
components: {
|
|
26
|
-
OrIconButton,
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
props: {
|
|
30
|
-
/**
|
|
31
|
-
* Must be `true` if sidebar is collapsed.
|
|
32
|
-
*/
|
|
33
|
-
modelValue: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
default: false,
|
|
36
|
-
},
|
|
37
|
-
side: {
|
|
38
|
-
type: String as PropType<OrSidebarPlacement>,
|
|
39
|
-
default: OrSidebarPlacement.right,
|
|
40
|
-
validator: (value?: any) => _.includes(_.values(OrSidebarPlacement), value),
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
emits: ['update:modelValue'],
|
|
45
|
-
|
|
46
|
-
expose: ['root'],
|
|
47
|
-
|
|
48
|
-
setup(props) {
|
|
49
|
-
// Refs
|
|
50
|
-
const root = ref<InstanceType<typeof HTMLDivElement>>();
|
|
51
|
-
|
|
52
|
-
const rootStyles = computed(() => [
|
|
53
|
-
'or-sidebar-collapse-button',
|
|
54
|
-
...CollapseButtonContainer,
|
|
55
|
-
]);
|
|
56
|
-
|
|
57
|
-
const buttonStyles = computed(() => [
|
|
58
|
-
...CollapseButton,
|
|
59
|
-
]);
|
|
60
|
-
|
|
61
|
-
const icon = computed(() => (props.side === OrSidebarPlacement.left !== props.modelValue) ?
|
|
62
|
-
'keyboard_arrow_left' :
|
|
63
|
-
'keyboard_arrow_right',
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
root,
|
|
68
|
-
rootStyles,
|
|
69
|
-
buttonStyles,
|
|
70
|
-
icon,
|
|
71
|
-
};
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
</script>
|