@bridge-ui/vue 0.16.0 → 0.17.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.
- package/ai/skills/bridge-ui-components/SKILL.md +2 -1
- package/dist/Actions/Snackbar/createBridgeSnackbarApi.js +1 -1
- package/dist/Actions/actionHostRegistry.d.ts +2 -1
- package/dist/Actions/actionHostRegistry.js +11 -7
- package/dist/Components/DataTable/DataTable.vue.d.ts +5 -3
- package/dist/Components/DataTable/DataTable.vue_vue_type_script_setup_true_lang.js +138 -117
- package/dist/Components/DataTable/composables/useDataTable.d.ts +4 -2
- package/dist/Components/DataTable/composables/useDataTable.js +293 -273
- package/dist/Components/DataTable/dataTable.types.d.ts +35 -2
- package/dist/Components/Drawer/Drawer.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/Components/Drawer/composables/useDrawer.js +68 -67
- package/dist/Components/Menu/Menu.vue_vue_type_script_setup_true_lang.js +3 -5
- package/dist/Components/Modal/Modal.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/Components/Modal/composables/useModal.js +129 -119
- package/dist/Components/Pagination/Pagination.vue.d.ts +6 -0
- package/dist/Components/Pagination/Pagination.vue_vue_type_script_setup_true_lang.js +23 -11
- package/dist/Components/Pagination/composables/usePagination.d.ts +3 -3
- package/dist/Components/Pagination/composables/usePagination.js +95 -84
- package/dist/Components/Pagination/pagination.types.d.ts +30 -2
- package/dist/Components/Resizable/Resizable.js +5 -0
- package/dist/Components/Resizable/Resizable.vue.d.ts +17 -0
- package/dist/Components/Resizable/Resizable.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/Components/Resizable/composables/useResizable.d.ts +18 -0
- package/dist/Components/Resizable/composables/useResizable.js +195 -0
- package/dist/Components/Resizable/index.d.ts +4 -0
- package/dist/Components/Resizable/index.js +4 -0
- package/dist/Components/Resizable/resizable.types.d.ts +53 -0
- package/dist/Components/Resizable/resizableInjectionKey.d.ts +111 -0
- package/dist/Components/Resizable/resizableInjectionKey.js +4 -0
- package/dist/Components/ResizableHandle/ResizableHandle.js +5 -0
- package/dist/Components/ResizableHandle/ResizableHandle.vue.d.ts +14 -0
- package/dist/Components/ResizableHandle/ResizableHandle.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/Components/ResizableHandle/composables/useResizableHandle.d.ts +35 -0
- package/dist/Components/ResizableHandle/composables/useResizableHandle.js +85 -0
- package/dist/Components/ResizableHandle/index.d.ts +3 -0
- package/dist/Components/ResizableHandle/index.js +3 -0
- package/dist/Components/ResizableHandle/resizableHandle.types.d.ts +58 -0
- package/dist/Components/ResizablePanel/ResizablePanel.js +5 -0
- package/dist/Components/ResizablePanel/ResizablePanel.vue.d.ts +24 -0
- package/dist/Components/ResizablePanel/ResizablePanel.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +21 -0
- package/dist/Components/ResizablePanel/composables/useResizablePanel.js +87 -0
- package/dist/Components/ResizablePanel/index.d.ts +3 -0
- package/dist/Components/ResizablePanel/index.js +3 -0
- package/dist/Components/ResizablePanel/resizablePanel.types.d.ts +71 -0
- package/dist/Components/Snackbar/composables/useSnackbar.js +140 -146
- package/dist/Components/Tooltip/Tooltip.vue_vue_type_script_setup_true_lang.js +4 -6
- package/dist/augments.d.ts +15 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +70 -63
- package/docs/README.md +1 -0
- package/docs/components/DataTable.md +19 -0
- package/docs/components/Pagination.md +17 -5
- package/docs/components/Resizable.md +224 -0
- package/package.json +2 -2
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { HTMLAttributes, Slot } from 'vue';
|
|
2
|
+
import { ResizableOrientation } from '@bridge-ui/core/Tokens';
|
|
3
|
+
import { MergeHtmlProps } from '@bridge-ui/core/Utils';
|
|
4
|
+
export interface ResizableClasses {
|
|
5
|
+
/**
|
|
6
|
+
* Classes merged onto the group root.
|
|
7
|
+
*/
|
|
8
|
+
root?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ResizableEmits {
|
|
11
|
+
/**
|
|
12
|
+
* Emitted when a drag, key press, or collapse changes the panel sizes.
|
|
13
|
+
* Sizes are percentages, in panel order.
|
|
14
|
+
*/
|
|
15
|
+
layoutChange: [layout: number[]];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Group of panels the user can resize. Compose with `ResizablePanel` and
|
|
19
|
+
* `ResizableHandle`.
|
|
20
|
+
*/
|
|
21
|
+
export interface ResizableOwnProps {
|
|
22
|
+
/**
|
|
23
|
+
* Classes for the group root.
|
|
24
|
+
*
|
|
25
|
+
* @default undefined
|
|
26
|
+
*/
|
|
27
|
+
classes?: ResizableClasses;
|
|
28
|
+
/**
|
|
29
|
+
* Lock every handle in the group.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Percent an arrow key moves a focused handle.
|
|
36
|
+
*
|
|
37
|
+
* @default 10
|
|
38
|
+
*/
|
|
39
|
+
keyboardStep?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Axis the panels are laid out on. Horizontal places panels side by side.
|
|
42
|
+
*
|
|
43
|
+
* @default "horizontal"
|
|
44
|
+
*/
|
|
45
|
+
orientation?: keyof ResizableOrientation;
|
|
46
|
+
}
|
|
47
|
+
export interface ResizableSlots {
|
|
48
|
+
/**
|
|
49
|
+
* Panels and handles (`ResizablePanel`, `ResizableHandle`).
|
|
50
|
+
*/
|
|
51
|
+
default?: Slot<undefined>;
|
|
52
|
+
}
|
|
53
|
+
export type ResizableProps = MergeHtmlProps<ResizableOwnProps, HTMLAttributes>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
import { ResizableHandleAria, ResizablePanelConstraints } from '@bridge-ui/core/Domain';
|
|
3
|
+
import { ResizableOrientationItem } from '@bridge-ui/core/Tokens';
|
|
4
|
+
/**
|
|
5
|
+
* What a `ResizablePanel` shares with its group.
|
|
6
|
+
*/
|
|
7
|
+
export type ResizablePanelEntry = {
|
|
8
|
+
/**
|
|
9
|
+
* Bound `collapsed` model. A collapsed panel starts at `collapsedSize`.
|
|
10
|
+
*/
|
|
11
|
+
collapsed: boolean | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Size constraints, in percent.
|
|
14
|
+
*/
|
|
15
|
+
constraints: ResizablePanelConstraints;
|
|
16
|
+
/**
|
|
17
|
+
* Rendered panel element.
|
|
18
|
+
*/
|
|
19
|
+
element: null | HTMLElement;
|
|
20
|
+
/**
|
|
21
|
+
* DOM id the handles point to with `aria-controls`.
|
|
22
|
+
*/
|
|
23
|
+
elementId: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* What a `ResizableHandle` shares with its group.
|
|
27
|
+
*/
|
|
28
|
+
export type ResizableHandleEntry = {
|
|
29
|
+
/**
|
|
30
|
+
* Rendered handle element.
|
|
31
|
+
*/
|
|
32
|
+
element: null | HTMLElement;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Position and ARIA values for a handle.
|
|
36
|
+
*/
|
|
37
|
+
export type ResizableHandleState = {
|
|
38
|
+
/**
|
|
39
|
+
* ARIA values for the panel before the handle.
|
|
40
|
+
*/
|
|
41
|
+
aria: ResizableHandleAria;
|
|
42
|
+
/**
|
|
43
|
+
* DOM id of the panel before the handle.
|
|
44
|
+
*/
|
|
45
|
+
controls: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* 0-based handle index.
|
|
48
|
+
*/
|
|
49
|
+
index: number;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Shared group state for `ResizablePanel` and `ResizableHandle` descendants.
|
|
53
|
+
*/
|
|
54
|
+
export type ResizableContextValue = {
|
|
55
|
+
/**
|
|
56
|
+
* Collapses a collapsible panel.
|
|
57
|
+
*/
|
|
58
|
+
collapsePanel: (id: string) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Group-level `disabled`.
|
|
61
|
+
*/
|
|
62
|
+
disabled: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Id of the handle being dragged.
|
|
65
|
+
*/
|
|
66
|
+
draggingHandleId: null | string;
|
|
67
|
+
/**
|
|
68
|
+
* Expands a collapsed panel to its last expanded size.
|
|
69
|
+
*/
|
|
70
|
+
expandPanel: (id: string) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Position and ARIA values for a handle, or `null` outside two panels.
|
|
73
|
+
*/
|
|
74
|
+
getHandleState: (id: string) => null | ResizableHandleState;
|
|
75
|
+
/**
|
|
76
|
+
* Stable id prefix for panel elements.
|
|
77
|
+
*/
|
|
78
|
+
id: string;
|
|
79
|
+
/**
|
|
80
|
+
* Panel sizes (percent) by panel id. Empty until panels register.
|
|
81
|
+
*/
|
|
82
|
+
layout: Record<string, number>;
|
|
83
|
+
/**
|
|
84
|
+
* Group axis.
|
|
85
|
+
*/
|
|
86
|
+
orientation: "vertical" | "horizontal";
|
|
87
|
+
/**
|
|
88
|
+
* Orientation class map.
|
|
89
|
+
*/
|
|
90
|
+
orientationItem: undefined | ResizableOrientationItem;
|
|
91
|
+
/**
|
|
92
|
+
* Registers a handle and returns unregister. `entry` is read on demand.
|
|
93
|
+
*/
|
|
94
|
+
registerHandle: (id: string, entry: () => ResizableHandleEntry) => () => void;
|
|
95
|
+
/**
|
|
96
|
+
* Registers a panel and returns unregister. `entry` is read on demand.
|
|
97
|
+
*/
|
|
98
|
+
registerPanel: (id: string, entry: () => ResizablePanelEntry) => () => void;
|
|
99
|
+
/**
|
|
100
|
+
* Applies a key press on a handle. Returns whether the key resized.
|
|
101
|
+
*/
|
|
102
|
+
resizeFromKey: (id: string, key: string) => boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Starts dragging a handle from a pointer position.
|
|
105
|
+
*/
|
|
106
|
+
startDrag: (id: string, point: {
|
|
107
|
+
clientX: number;
|
|
108
|
+
clientY: number;
|
|
109
|
+
}) => void;
|
|
110
|
+
};
|
|
111
|
+
export declare const RESIZABLE_INJECTION_KEY: InjectionKey<ComputedRef<ResizableContextValue>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ResizableHandleOwnProps, ResizableHandleSlots } from './resizableHandle.types';
|
|
2
|
+
type __VLS_Slots = ResizableHandleSlots;
|
|
3
|
+
declare const __VLS_base: import('vue').DefineComponent<ResizableHandleOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ResizableHandleOwnProps> & Readonly<{}>, {
|
|
4
|
+
disabled: boolean;
|
|
5
|
+
hideGrip: boolean;
|
|
6
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
10
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
11
|
+
new (): {
|
|
12
|
+
$slots: S;
|
|
13
|
+
};
|
|
14
|
+
};
|
package/dist/Components/ResizableHandle/ResizableHandle.vue_vue_type_script_setup_true_lang.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useResizableHandle as e } from "./composables/useResizableHandle.js";
|
|
2
|
+
import { createCommentVNode as t, createElementBlock as n, defineComponent as r, mergeProps as i, normalizeProps as a, openBlock as o, renderSlot as s, unref as c } from "vue";
|
|
3
|
+
//#region src/Components/ResizableHandle/ResizableHandle.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var l = /*@__PURE__*/ r({
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "ResizableHandle",
|
|
7
|
+
props: {
|
|
8
|
+
classes: {},
|
|
9
|
+
customProps: {},
|
|
10
|
+
disabled: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: void 0
|
|
13
|
+
},
|
|
14
|
+
hideGrip: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: void 0
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
setup(r) {
|
|
20
|
+
let { gripBind: l, rootBind: u, showGrip: d, elementRef: f } = e(r, {
|
|
21
|
+
disabled: !1,
|
|
22
|
+
hideGrip: !1
|
|
23
|
+
});
|
|
24
|
+
return (e, r) => (o(), n("div", i({
|
|
25
|
+
ref_key: "elementRef",
|
|
26
|
+
ref: f
|
|
27
|
+
}, c(u)), [c(d) ? (o(), n("div", a(i({ key: 0 }, c(l))), [s(e.$slots, "grip")], 16)) : t("", !0)], 16));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
//#endregion
|
|
31
|
+
export { l as default };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LibDefaultsShape } from '@bridge-ui/core/Utils';
|
|
2
|
+
import { ResizableHandleOwnProps, ResizableHandleProps } from '../resizableHandle.types';
|
|
3
|
+
type ResizableHandleLibDefaults = LibDefaultsShape<ResizableHandleOwnProps, "disabled" | "hideGrip">;
|
|
4
|
+
export declare function useResizableHandle(props: ResizableHandleOwnProps, libDefaults: ResizableHandleLibDefaults): {
|
|
5
|
+
index: import('vue').ComputedRef<number>;
|
|
6
|
+
dragging: import('vue').ComputedRef<boolean>;
|
|
7
|
+
disabled: import('vue').ComputedRef<boolean>;
|
|
8
|
+
gripBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
9
|
+
"aria-hidden": boolean;
|
|
10
|
+
"data-part": string;
|
|
11
|
+
class: string;
|
|
12
|
+
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
13
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
14
|
+
"data-part": string;
|
|
15
|
+
role: "separator";
|
|
16
|
+
"data-orientation": "horizontal" | "vertical";
|
|
17
|
+
tabindex: number;
|
|
18
|
+
"aria-controls": string | undefined;
|
|
19
|
+
"aria-disabled": true | undefined;
|
|
20
|
+
"aria-label": string;
|
|
21
|
+
"data-dragging": string | undefined;
|
|
22
|
+
"data-disabled": string | undefined;
|
|
23
|
+
"aria-orientation": "horizontal" | "vertical";
|
|
24
|
+
class: string;
|
|
25
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
26
|
+
onPointerdown: (event: PointerEvent) => void;
|
|
27
|
+
"aria-valuemax"?: number | undefined;
|
|
28
|
+
"aria-valuemin"?: number | undefined;
|
|
29
|
+
"aria-valuenow"?: number | undefined;
|
|
30
|
+
}, "class", {}, Omit<Omit<ResizableHandleProps, "classes" | "customProps" | "disabled" | "hideGrip">, "onKeydown" | "onPointerdown">>>;
|
|
31
|
+
showGrip: import('vue').ComputedRef<boolean>;
|
|
32
|
+
elementRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
|
|
33
|
+
id: string;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useResolveMessage as e } from "../../../Adapters/I18n/useI18nAdapter.js";
|
|
2
|
+
import { mergePartBind as t, useBridgeUIComponent as n, useBridgeUIMergedRegistryClasses as r } from "../../../Utils/index.js";
|
|
3
|
+
import { RESIZABLE_INJECTION_KEY as i } from "../../Resizable/resizableInjectionKey.js";
|
|
4
|
+
import { computed as a, inject as o, onBeforeUnmount as s, onMounted as c, ref as l, useAttrs as u, useId as d } from "vue";
|
|
5
|
+
import { get as f, isFunction as p, omit as m } from "es-toolkit/compat";
|
|
6
|
+
import { cn as h, splitComponentProps as g } from "@bridge-ui/core/Utils";
|
|
7
|
+
//#region src/Components/ResizableHandle/composables/useResizableHandle.ts
|
|
8
|
+
var _ = [
|
|
9
|
+
"classes",
|
|
10
|
+
"disabled",
|
|
11
|
+
"hideGrip",
|
|
12
|
+
"customProps"
|
|
13
|
+
], v = ["onKeydown", "onPointerdown"];
|
|
14
|
+
function y(e) {
|
|
15
|
+
return p(e) ? e : void 0;
|
|
16
|
+
}
|
|
17
|
+
function b(p, b) {
|
|
18
|
+
let x = u(), S = d(), C = e(), w = o(i, null);
|
|
19
|
+
if (!w) throw Error("ResizableHandle must be used within a Resizable");
|
|
20
|
+
let T = w, E = l(null), D = a(() => g({
|
|
21
|
+
props: {
|
|
22
|
+
...x,
|
|
23
|
+
...p
|
|
24
|
+
},
|
|
25
|
+
bridgeKeys: _
|
|
26
|
+
})), { merged: O, entry: k } = n({
|
|
27
|
+
libDefaults: b,
|
|
28
|
+
componentName: "ResizableHandle",
|
|
29
|
+
props: () => D.value.componentProps
|
|
30
|
+
}), A = r({
|
|
31
|
+
entry: k,
|
|
32
|
+
props: () => D.value.componentProps
|
|
33
|
+
}), j = null;
|
|
34
|
+
c(() => {
|
|
35
|
+
j = T.value.registerHandle(S, () => ({ element: E.value }));
|
|
36
|
+
}), s(() => {
|
|
37
|
+
j?.(), j = null;
|
|
38
|
+
});
|
|
39
|
+
let M = a(() => T.value.getHandleState(S)), N = a(() => T.value.disabled || O.value.disabled === !0), P = a(() => T.value.draggingHandleId === S), F = a(() => O.value.hideGrip !== !0), I = a(() => M.value?.index ?? -1), L = a(() => {
|
|
40
|
+
let e = D.value.inheritedAttrs, n = y(e.onKeydown), r = y(e.onPointerdown), i = T.value.orientation;
|
|
41
|
+
return t({}, m(e, [...v]), {
|
|
42
|
+
...M.value?.aria,
|
|
43
|
+
"data-part": "handle",
|
|
44
|
+
role: "separator",
|
|
45
|
+
"data-orientation": i,
|
|
46
|
+
tabindex: N.value ? -1 : 0,
|
|
47
|
+
"aria-controls": M.value?.controls,
|
|
48
|
+
"aria-disabled": N.value || void 0,
|
|
49
|
+
"aria-label": C("Resize panels"),
|
|
50
|
+
"data-dragging": P.value ? "" : void 0,
|
|
51
|
+
"data-disabled": N.value ? "" : void 0,
|
|
52
|
+
"aria-orientation": i === "vertical" ? "horizontal" : "vertical",
|
|
53
|
+
class: h({
|
|
54
|
+
[f(T.value.orientationItem, "handle") ?? ""]: !0,
|
|
55
|
+
[f(T.value.orientationItem, "handleDisabled") ?? ""]: N.value,
|
|
56
|
+
[f(A.value, "root") ?? ""]: !0
|
|
57
|
+
}),
|
|
58
|
+
onKeydown: (e) => {
|
|
59
|
+
n?.(e), !(N.value || e.defaultPrevented) && T.value.resizeFromKey(S, e.key) && e.preventDefault();
|
|
60
|
+
},
|
|
61
|
+
onPointerdown: (e) => {
|
|
62
|
+
r?.(e), !(N.value || e.defaultPrevented || e.pointerType === "mouse" && e.button !== 0) && T.value.startDrag(S, e);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
index: I,
|
|
68
|
+
dragging: P,
|
|
69
|
+
disabled: N,
|
|
70
|
+
gripBind: a(() => t(O.value.customProps?.grip, {}, {
|
|
71
|
+
"aria-hidden": !0,
|
|
72
|
+
"data-part": "grip",
|
|
73
|
+
class: h({
|
|
74
|
+
[f(T.value.orientationItem, "grip") ?? ""]: !0,
|
|
75
|
+
[f(A.value, "grip") ?? ""]: !0
|
|
76
|
+
})
|
|
77
|
+
})),
|
|
78
|
+
rootBind: L,
|
|
79
|
+
showGrip: F,
|
|
80
|
+
elementRef: E,
|
|
81
|
+
id: S
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
export { b as useResizableHandle };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { useResizableHandle } from './composables/useResizableHandle';
|
|
2
|
+
export type { ResizableHandleClasses, ResizableHandleCustomProps, ResizableHandleOwnProps, ResizableHandleProps, ResizableHandleSlots, } from './resizableHandle.types';
|
|
3
|
+
export { default as ResizableHandle } from './ResizableHandle.vue';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { HTMLAttributes, Slot } from 'vue';
|
|
2
|
+
import { MergeHtmlProps } from '@bridge-ui/core/Utils';
|
|
3
|
+
export interface ResizableHandleClasses {
|
|
4
|
+
/**
|
|
5
|
+
* Classes merged onto the grip.
|
|
6
|
+
*/
|
|
7
|
+
grip?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Classes merged onto the handle root.
|
|
10
|
+
*/
|
|
11
|
+
root?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ResizableHandleCustomProps {
|
|
14
|
+
/**
|
|
15
|
+
* Props forwarded to the grip.
|
|
16
|
+
*
|
|
17
|
+
* @default undefined
|
|
18
|
+
*/
|
|
19
|
+
grip?: HTMLAttributes;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Drag handle between two `ResizablePanel`s. Focusable, with arrow keys,
|
|
23
|
+
* `Home` / `End`, and `Enter` to collapse a collapsible panel.
|
|
24
|
+
*/
|
|
25
|
+
export interface ResizableHandleOwnProps {
|
|
26
|
+
/**
|
|
27
|
+
* Classes for handle parts.
|
|
28
|
+
*
|
|
29
|
+
* @default undefined
|
|
30
|
+
*/
|
|
31
|
+
classes?: ResizableHandleClasses;
|
|
32
|
+
/**
|
|
33
|
+
* Extra props for internal parts (`grip`).
|
|
34
|
+
* Root HTML attributes stay on the component top level.
|
|
35
|
+
*
|
|
36
|
+
* @default undefined
|
|
37
|
+
*/
|
|
38
|
+
customProps?: ResizableHandleCustomProps;
|
|
39
|
+
/**
|
|
40
|
+
* Lock this handle.
|
|
41
|
+
*
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Hide the grip on the handle and show only the line.
|
|
47
|
+
*
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
hideGrip?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface ResizableHandleSlots {
|
|
53
|
+
/**
|
|
54
|
+
* Content inside the grip.
|
|
55
|
+
*/
|
|
56
|
+
grip?: Slot<undefined>;
|
|
57
|
+
}
|
|
58
|
+
export type ResizableHandleProps = MergeHtmlProps<ResizableHandleOwnProps, HTMLAttributes>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ResizablePanelOwnProps, ResizablePanelSlots } from './resizablePanel.types';
|
|
2
|
+
type __VLS_Slots = ResizablePanelSlots;
|
|
3
|
+
type __VLS_Props = ResizablePanelOwnProps;
|
|
4
|
+
type __VLS_ModelProps = {
|
|
5
|
+
"collapsed"?: boolean | undefined;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
8
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
9
|
+
resize: (size: number) => any;
|
|
10
|
+
"update:collapsed": (...args: unknown[]) => any;
|
|
11
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
12
|
+
onResize?: ((size: number) => any) | undefined;
|
|
13
|
+
"onUpdate:collapsed"?: ((...args: unknown[]) => any) | undefined;
|
|
14
|
+
}>, {
|
|
15
|
+
collapsible: boolean;
|
|
16
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useResizablePanel as e } from "./composables/useResizablePanel.js";
|
|
2
|
+
import { createElementBlock as t, defineComponent as n, mergeModels as r, mergeProps as i, openBlock as a, renderSlot as o, unref as s, useModel as c } from "vue";
|
|
3
|
+
//#region src/Components/ResizablePanel/ResizablePanel.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var l = /*@__PURE__*/ n({
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "ResizablePanel",
|
|
7
|
+
props: /*@__PURE__*/ r({
|
|
8
|
+
classes: {},
|
|
9
|
+
collapsedSize: {},
|
|
10
|
+
collapsible: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: void 0
|
|
13
|
+
},
|
|
14
|
+
defaultSize: {},
|
|
15
|
+
maxSize: {},
|
|
16
|
+
minSize: {}
|
|
17
|
+
}, {
|
|
18
|
+
collapsed: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: void 0
|
|
21
|
+
},
|
|
22
|
+
collapsedModifiers: {}
|
|
23
|
+
}),
|
|
24
|
+
emits: /*@__PURE__*/ r(["resize", "update:collapsed"], ["update:collapsed"]),
|
|
25
|
+
setup(n, { emit: r }) {
|
|
26
|
+
let l = r, u = n, d = c(n, "collapsed"), { rootBind: f, elementRef: p } = e(u, {
|
|
27
|
+
minSize: 0,
|
|
28
|
+
maxSize: 100,
|
|
29
|
+
collapsedSize: 0,
|
|
30
|
+
collapsible: !1
|
|
31
|
+
}, d, l);
|
|
32
|
+
return (e, n) => (a(), t("div", i({
|
|
33
|
+
ref_key: "elementRef",
|
|
34
|
+
ref: p
|
|
35
|
+
}, s(f)), [o(e.$slots, "default")], 16));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
//#endregion
|
|
39
|
+
export { l as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Ref, SetupContext } from 'vue';
|
|
2
|
+
import { LibDefaultsShape } from '@bridge-ui/core/Utils';
|
|
3
|
+
import { ResizablePanelEmits, ResizablePanelOwnProps, ResizablePanelProps } from '../resizablePanel.types';
|
|
4
|
+
type ResizablePanelLibDefaults = LibDefaultsShape<ResizablePanelOwnProps, "maxSize" | "minSize" | "collapsible" | "collapsedSize">;
|
|
5
|
+
export declare function useResizablePanel(props: ResizablePanelOwnProps, libDefaults: ResizablePanelLibDefaults, model: Ref<boolean | undefined>, emit?: SetupContext<ResizablePanelEmits>["emit"]): {
|
|
6
|
+
size: import('vue').ComputedRef<number>;
|
|
7
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
8
|
+
id: string;
|
|
9
|
+
"data-part": string;
|
|
10
|
+
"data-orientation": "horizontal" | "vertical";
|
|
11
|
+
"data-collapsed": string | undefined;
|
|
12
|
+
style: {
|
|
13
|
+
[x: string]: string;
|
|
14
|
+
};
|
|
15
|
+
class: string;
|
|
16
|
+
}, "class", {}, Omit<Omit<ResizablePanelProps, "classes" | "maxSize" | "collapsedSize" | "collapsible" | "defaultSize" | "minSize">, "style">>>;
|
|
17
|
+
collapsed: import('vue').ComputedRef<boolean>;
|
|
18
|
+
elementRef: Ref<HTMLElement | null, HTMLElement | null>;
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
|
|
2
|
+
import { RESIZABLE_INJECTION_KEY as r } from "../../Resizable/resizableInjectionKey.js";
|
|
3
|
+
import { computed as i, inject as a, onBeforeUnmount as o, onMounted as s, ref as c, useAttrs as l, useId as u, watch as d } from "vue";
|
|
4
|
+
import { get as f, omit as p } from "es-toolkit/compat";
|
|
5
|
+
import { getResizablePanelStyle as m, isResizablePanelCollapsed as h } from "@bridge-ui/core/Domain";
|
|
6
|
+
import { cn as g, splitComponentProps as _ } from "@bridge-ui/core/Utils";
|
|
7
|
+
//#region src/Components/ResizablePanel/composables/useResizablePanel.ts
|
|
8
|
+
var v = [
|
|
9
|
+
"classes",
|
|
10
|
+
"maxSize",
|
|
11
|
+
"minSize",
|
|
12
|
+
"collapsible",
|
|
13
|
+
"defaultSize",
|
|
14
|
+
"collapsedSize"
|
|
15
|
+
];
|
|
16
|
+
function y(e) {
|
|
17
|
+
return e && typeof e == "object" && !Array.isArray(e) ? e : {};
|
|
18
|
+
}
|
|
19
|
+
function b(b, x, S, C) {
|
|
20
|
+
let w = l(), T = u(), E = a(r, null);
|
|
21
|
+
if (!E) throw Error("ResizablePanel must be used within a Resizable");
|
|
22
|
+
let D = E, O = c(null), k = i(() => _({
|
|
23
|
+
props: {
|
|
24
|
+
...w,
|
|
25
|
+
...b
|
|
26
|
+
},
|
|
27
|
+
bridgeKeys: v
|
|
28
|
+
})), { merged: A, entry: j } = t({
|
|
29
|
+
libDefaults: x,
|
|
30
|
+
componentName: "ResizablePanel",
|
|
31
|
+
props: () => k.value.componentProps
|
|
32
|
+
}), M = n({
|
|
33
|
+
entry: j,
|
|
34
|
+
props: () => k.value.componentProps
|
|
35
|
+
}), N = i(() => {
|
|
36
|
+
let e = k.value.inheritedAttrs.id;
|
|
37
|
+
return typeof e == "string" && e ? e : `${D.value.id}-panel${T}`;
|
|
38
|
+
}), P = i(() => ({
|
|
39
|
+
maxSize: A.value.maxSize,
|
|
40
|
+
minSize: A.value.minSize,
|
|
41
|
+
collapsible: A.value.collapsible,
|
|
42
|
+
defaultSize: A.value.defaultSize,
|
|
43
|
+
collapsedSize: A.value.collapsedSize
|
|
44
|
+
})), F = null;
|
|
45
|
+
s(() => {
|
|
46
|
+
F = D.value.registerPanel(T, () => ({
|
|
47
|
+
collapsed: S.value,
|
|
48
|
+
element: O.value,
|
|
49
|
+
elementId: N.value,
|
|
50
|
+
constraints: P.value
|
|
51
|
+
}));
|
|
52
|
+
}), o(() => {
|
|
53
|
+
F?.(), F = null;
|
|
54
|
+
});
|
|
55
|
+
let I = i(() => D.value.layout[T]), L = i(() => h(P.value, I.value));
|
|
56
|
+
d(I, (e, t) => {
|
|
57
|
+
e === void 0 || t === void 0 || Math.abs(t - e) < 1e-6 || (C?.("resize", e), h(P.value, t) !== L.value && (S.value = L.value));
|
|
58
|
+
}), d(S, (e) => {
|
|
59
|
+
e === !0 ? D.value.collapsePanel(T) : e === !1 && D.value.expandPanel(T);
|
|
60
|
+
});
|
|
61
|
+
let R = i(() => S.value && A.value.collapsible ? A.value.collapsedSize : A.value.defaultSize);
|
|
62
|
+
return {
|
|
63
|
+
size: I,
|
|
64
|
+
rootBind: i(() => {
|
|
65
|
+
let t = k.value.inheritedAttrs;
|
|
66
|
+
return e({}, p(t, ["style"]), {
|
|
67
|
+
id: N.value,
|
|
68
|
+
"data-part": "panel",
|
|
69
|
+
"data-orientation": D.value.orientation,
|
|
70
|
+
"data-collapsed": L.value ? "" : void 0,
|
|
71
|
+
style: {
|
|
72
|
+
...m(I.value ?? R.value),
|
|
73
|
+
...y(t.style)
|
|
74
|
+
},
|
|
75
|
+
class: g({
|
|
76
|
+
[f(D.value.orientationItem, "panel") ?? ""]: !0,
|
|
77
|
+
[f(M.value, "root") ?? ""]: !0
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
}),
|
|
81
|
+
collapsed: L,
|
|
82
|
+
elementRef: O,
|
|
83
|
+
id: T
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { b as useResizablePanel };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { useResizablePanel } from './composables/useResizablePanel';
|
|
2
|
+
export type { ResizablePanelClasses, ResizablePanelEmits, ResizablePanelOwnProps, ResizablePanelProps, ResizablePanelSlots, } from './resizablePanel.types';
|
|
3
|
+
export { default as ResizablePanel } from './ResizablePanel.vue';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { HTMLAttributes, Slot } from 'vue';
|
|
2
|
+
import { MergeHtmlProps } from '@bridge-ui/core/Utils';
|
|
3
|
+
export interface ResizablePanelClasses {
|
|
4
|
+
/**
|
|
5
|
+
* Classes merged onto the panel root.
|
|
6
|
+
*/
|
|
7
|
+
root?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ResizablePanelEmits {
|
|
10
|
+
/**
|
|
11
|
+
* Emitted when the panel size changes (percent of the group).
|
|
12
|
+
*/
|
|
13
|
+
resize: [size: number];
|
|
14
|
+
/**
|
|
15
|
+
* Emitted when the panel collapses or expands (`v-model:collapsed`).
|
|
16
|
+
*/
|
|
17
|
+
"update:collapsed": [collapsed: boolean];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* One panel inside `Resizable`. Sizes are percentages of the group.
|
|
21
|
+
*/
|
|
22
|
+
export interface ResizablePanelOwnProps {
|
|
23
|
+
/**
|
|
24
|
+
* Classes for the panel.
|
|
25
|
+
*
|
|
26
|
+
* @default undefined
|
|
27
|
+
*/
|
|
28
|
+
classes?: ResizablePanelClasses;
|
|
29
|
+
/**
|
|
30
|
+
* Size while collapsed, in percent.
|
|
31
|
+
*
|
|
32
|
+
* @default 0
|
|
33
|
+
*/
|
|
34
|
+
collapsedSize?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Let the panel collapse once it is dragged past half of `minSize`.
|
|
37
|
+
*
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
collapsible?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Initial size, in percent. Panels without one share the space left.
|
|
43
|
+
*
|
|
44
|
+
* @default undefined
|
|
45
|
+
*/
|
|
46
|
+
defaultSize?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Largest size, in percent.
|
|
49
|
+
*
|
|
50
|
+
* @default 100
|
|
51
|
+
*/
|
|
52
|
+
maxSize?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Smallest size while expanded, in percent.
|
|
55
|
+
*
|
|
56
|
+
* @default 0
|
|
57
|
+
*/
|
|
58
|
+
minSize?: number;
|
|
59
|
+
}
|
|
60
|
+
export interface ResizablePanelSlots {
|
|
61
|
+
/**
|
|
62
|
+
* Panel content.
|
|
63
|
+
*/
|
|
64
|
+
default?: Slot<undefined>;
|
|
65
|
+
}
|
|
66
|
+
export type ResizablePanelProps = MergeHtmlProps<ResizablePanelOwnProps, HTMLAttributes> & {
|
|
67
|
+
/**
|
|
68
|
+
* Collapsed state, bound with `v-model:collapsed`. Needs `collapsible`.
|
|
69
|
+
*/
|
|
70
|
+
collapsed?: boolean;
|
|
71
|
+
};
|