@onereach/ui-components 2.72.0 → 2.72.1-beta.2249.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 (47) hide show
  1. package/dist/bundled/v2/OrSidebar-efd4b98a.js +464 -0
  2. package/dist/bundled/v2/components/index.js +1 -1
  3. package/dist/bundled/v2/components/or-sidebar-v3/OrSidebar.stories3.d.ts +36 -1
  4. package/dist/bundled/v2/components/or-sidebar-v3/OrSidebar.vue.d.ts +49 -4
  5. package/dist/bundled/v2/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.d.ts +12 -0
  6. package/dist/bundled/v2/components/or-sidebar-v3/OrSidebarCollapseButton.vue.d.ts +53 -0
  7. package/dist/bundled/v2/components/or-sidebar-v3/index.js +12 -1
  8. package/dist/bundled/v2/components/or-sidebar-v3/styles.d.ts +9 -1
  9. package/dist/bundled/v2/index.js +2 -2
  10. package/dist/bundled/v3/OrSidebar.vue_vue_type_script_lang-66f8f0fd.js +356 -0
  11. package/dist/bundled/v3/components/index.js +1 -1
  12. package/dist/bundled/v3/components/or-sidebar-v3/OrSidebar.stories3.d.ts +36 -1
  13. package/dist/bundled/v3/components/or-sidebar-v3/OrSidebar.vue.d.ts +49 -4
  14. package/dist/bundled/v3/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.d.ts +12 -0
  15. package/dist/bundled/v3/components/or-sidebar-v3/OrSidebarCollapseButton.vue.d.ts +53 -0
  16. package/dist/bundled/v3/components/or-sidebar-v3/index.js +14 -1
  17. package/dist/bundled/v3/components/or-sidebar-v3/styles.d.ts +9 -1
  18. package/dist/bundled/v3/index.js +25 -9
  19. package/dist/esm/v2/OrSidebar-b7202f16.js +461 -0
  20. package/dist/esm/v2/components/index.js +1 -1
  21. package/dist/esm/v2/components/or-sidebar-v3/OrSidebar.stories3.d.ts +36 -1
  22. package/dist/esm/v2/components/or-sidebar-v3/OrSidebar.vue.d.ts +49 -4
  23. package/dist/esm/v2/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.d.ts +12 -0
  24. package/dist/esm/v2/components/or-sidebar-v3/OrSidebarCollapseButton.vue.d.ts +53 -0
  25. package/dist/esm/v2/components/or-sidebar-v3/index.js +12 -1
  26. package/dist/esm/v2/components/or-sidebar-v3/styles.d.ts +9 -1
  27. package/dist/esm/v2/index.js +1 -1
  28. package/dist/esm/v3/OrSidebar-3567338f.js +396 -0
  29. package/dist/esm/v3/components/index.js +1 -1
  30. package/dist/esm/v3/components/or-sidebar-v3/OrSidebar.stories3.d.ts +36 -1
  31. package/dist/esm/v3/components/or-sidebar-v3/OrSidebar.vue.d.ts +49 -4
  32. package/dist/esm/v3/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.d.ts +12 -0
  33. package/dist/esm/v3/components/or-sidebar-v3/OrSidebarCollapseButton.vue.d.ts +53 -0
  34. package/dist/esm/v3/components/or-sidebar-v3/index.js +11 -1
  35. package/dist/esm/v3/components/or-sidebar-v3/styles.d.ts +9 -1
  36. package/dist/esm/v3/index.js +1 -1
  37. package/package.json +2 -3
  38. package/src/components/or-sidebar-v3/OrSidebar.docs.mdx +6 -0
  39. package/src/components/or-sidebar-v3/OrSidebar.stories3.ts +253 -12
  40. package/src/components/or-sidebar-v3/OrSidebar.vue +130 -23
  41. package/src/components/or-sidebar-v3/OrSidebarCollapseButton.stories3.ts +48 -0
  42. package/src/components/or-sidebar-v3/OrSidebarCollapseButton.vue +74 -0
  43. package/src/components/or-sidebar-v3/styles.ts +164 -9
  44. package/dist/bundled/v2/OrSidebar-c95ef614.js +0 -230
  45. package/dist/bundled/v3/OrSidebar.vue_vue_type_script_lang-ce0b152c.js +0 -181
  46. package/dist/esm/v2/OrSidebar-fabc7bc9.js +0 -228
  47. package/dist/esm/v3/OrSidebar-a62972f5.js +0 -206
@@ -1,206 +0,0 @@
1
- import { useDraggable, useElementBounding } from '@vueuse/core';
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'];
76
-
77
- var script = defineComponent({
78
- name: 'OrSidebar',
79
- props: {
80
- width: {
81
- type: Number,
82
- required: false,
83
- default: 0,
84
- validator: value => _.isNumber(value) && value >= 0
85
- },
86
- minimumWidth: {
87
- type: Number,
88
- required: false,
89
- default: 350,
90
- validator: value => _.isNumber(value) && value >= 0
91
- },
92
- /**
93
- * User may put the component on the right or the left side of a container.
94
- * This property mirrors the resizing behavior (drag direction) and styling (horizontal border) of the sidebar.
95
- *
96
- * Note: the property doesn't reposition the component in the parent container.
97
- * @values left, right
98
- */
99
- side: {
100
- type: String,
101
- default: OrSidebarPlacement.right,
102
- validator: value => _.includes(_.values(OrSidebarPlacement), value)
103
- }
104
- },
105
- emits: ['change:width'],
106
- setup(props, {
107
- emit
108
- }) {
109
- // Refs
110
- const root = ref();
111
- const resizeBar = ref(null);
112
- const parentContainer = computed(() => {
113
- var _a;
114
- return (_a = root.value) === null || _a === void 0 ? void 0 : _a.parentElement;
115
- });
116
- // State
117
- const startPositionX = ref(0);
118
- const isResizing = ref(false);
119
- const localWidth = ref(props.width >= props.minimumWidth ? props.width : props.minimumWidth);
120
- // Styles
121
- const sidebarStyle = computed(() => ({
122
- width: localWidth.value + 'px'
123
- }));
124
- const rootStyles = computed(() => ['or-sidebar', ...SidebarRoot, ...SidebarRootSides[props.side]]);
125
- const resizeStyles = computed(() => [...SidebarResize, ...SidebarResizeSides[props.side], ...(isResizing.value ? SidebarResizingSides[props.side] : [])]);
126
- const mainStyles = computed(() => [...SidebarMain]);
127
- const headerStyles = computed(() => [...SidebarHeader]);
128
- const contentStyles = computed(() => [...SidebarContent]);
129
- const footerStyles = computed(() => [...SidebarFooter]);
130
- // Effects
131
- useDraggable(resizeBar, {
132
- preventDefault: true,
133
- onStart: (position, event) => {
134
- document.body.style.cursor = 'ew-resize';
135
- document.body.style.userSelect = 'none';
136
- startPositionX.value = event.x;
137
- isResizing.value = true;
138
- },
139
- onMove: position => {
140
- const delta = (position.x - startPositionX.value) * (props.side === OrSidebarPlacement.left ? -1 : 1);
141
- const newWidth = localWidth.value - delta;
142
- localWidth.value = newWidth > maximumWidth.value ? maximumWidth.value : newWidth < props.minimumWidth ? props.minimumWidth : newWidth;
143
- startPositionX.value = position.x;
144
- },
145
- onEnd: () => {
146
- document.body.style.cursor = '';
147
- document.body.style.userSelect = '';
148
- isResizing.value = false;
149
- }
150
- });
151
- const {
152
- width: maximumWidth
153
- } = useElementBounding(parentContainer);
154
- watch(() => props.width, newValue => {
155
- if (newValue !== localWidth.value) {
156
- localWidth.value = newValue > maximumWidth.value ? maximumWidth.value : newValue < props.minimumWidth ? props.minimumWidth : newValue;
157
- }
158
- });
159
- watch(() => props.minimumWidth, newMinimum => {
160
- if (newMinimum > localWidth.value) localWidth.value = newMinimum;
161
- });
162
- watch(maximumWidth, newMaximum => {
163
- if (newMaximum < localWidth.value) localWidth.value = newMaximum;
164
- });
165
- watch(localWidth, val => emit('change:width', val));
166
- return {
167
- root,
168
- resizeBar,
169
- isResizing,
170
- localWidth,
171
- sidebarStyle,
172
- rootStyles,
173
- resizeStyles,
174
- mainStyles,
175
- headerStyles,
176
- contentStyles,
177
- footerStyles
178
- };
179
- }
180
- });
181
-
182
- function render(_ctx, _cache, $props, $setup, $data, $options) {
183
- return openBlock(), createElementBlock("aside", {
184
- ref: "root",
185
- class: normalizeClass(_ctx.rootStyles),
186
- style: normalizeStyle(_ctx.sidebarStyle)
187
- }, [createElementVNode("div", {
188
- ref: "resizeBar",
189
- class: normalizeClass(_ctx.resizeStyles)
190
- }, null, 2 /* CLASS */), createElementVNode("div", {
191
- class: normalizeClass(_ctx.mainStyles)
192
- }, [_ctx.$slots.header ? (openBlock(), createElementBlock("div", {
193
- key: 0,
194
- class: normalizeClass(_ctx.headerStyles)
195
- }, [renderSlot(_ctx.$slots, "header")], 2 /* CLASS */)) : createCommentVNode("v-if", true), createElementVNode("div", {
196
- class: normalizeClass(_ctx.contentStyles)
197
- }, [renderSlot(_ctx.$slots, "default")], 2 /* CLASS */)], 2 /* CLASS */), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
198
- key: 0,
199
- class: normalizeClass(_ctx.footerStyles)
200
- }, [renderSlot(_ctx.$slots, "footer")], 2 /* CLASS */)) : createCommentVNode("v-if", true)], 6 /* CLASS, STYLE */);
201
- }
202
-
203
- script.render = render;
204
- script.__file = "src/components/or-sidebar-v3/OrSidebar.vue";
205
-
206
- export { OrSidebarPlacement as O, script as s };