@aleph-alpha/ui-library 2.3.0 → 2.4.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/dist/system/components/UiAlert/UiAlert.vue.d.ts +1 -0
- package/dist/system/components/UiAlert/constants.d.ts +16 -2
- package/dist/system/components/UiResizable/UiResizableHandle.vue.d.ts +22 -0
- package/dist/system/components/UiResizable/UiResizablePanel.vue.d.ts +31 -0
- package/dist/system/components/UiResizable/UiResizablePanelGroup.vue.d.ts +23 -0
- package/dist/system/components/UiResizable/index.d.ts +4 -0
- package/dist/system/components/UiResizable/types.d.ts +37 -0
- package/dist/system/components/core/resizable/ResizableHandle.vue.d.ts +27 -0
- package/dist/system/components/core/resizable/ResizablePanel.vue.d.ts +32 -0
- package/dist/system/components/core/resizable/ResizablePanelGroup.vue.d.ts +28 -0
- package/dist/system/components/core/resizable/index.d.ts +3 -0
- package/dist/system/components/core/sidebar/Sidebar.vue.d.ts +7 -0
- package/dist/system/components/core/sidebar/SidebarResizeHandle.vue.d.ts +16 -0
- package/dist/system/components/core/sidebar/index.d.ts +16 -0
- package/dist/system/components/core/sidebar/utils.d.ts +4 -0
- package/dist/system/components/index.d.ts +1 -0
- package/dist/system/lib.js +21860 -20130
- package/dist/system/patterns/UiSidebar/UiSidebar.vue.d.ts +1 -0
- package/dist/system/patterns/UiSidebar/__tests__/sidebar-test-helpers.d.ts +6 -0
- package/package.json +2 -2
- package/src/components/UiAlert/UiAlert.stories.ts +3 -15
- package/src/components/UiAlert/UiAlert.vue +16 -10
- package/src/components/UiAlert/constants.ts +21 -2
- package/src/components/UiResizable/UiResizable.stories.ts +424 -0
- package/src/components/UiResizable/UiResizableHandle.vue +17 -0
- package/src/components/UiResizable/UiResizablePanel.vue +30 -0
- package/src/components/UiResizable/UiResizablePanelGroup.vue +27 -0
- package/src/components/UiResizable/__tests__/UiResizableHandle.test.ts +64 -0
- package/src/components/UiResizable/__tests__/UiResizablePanel.test.ts +82 -0
- package/src/components/UiResizable/__tests__/UiResizablePanelGroup.test.ts +79 -0
- package/src/components/UiResizable/index.ts +4 -0
- package/src/components/UiResizable/types.ts +50 -0
- package/src/components/core/resizable/ResizableHandle.vue +45 -0
- package/src/components/core/resizable/ResizablePanel.vue +21 -0
- package/src/components/core/resizable/ResizablePanelGroup.vue +31 -0
- package/src/components/core/resizable/index.ts +3 -0
- package/src/components/core/sidebar/Sidebar.vue +208 -2
- package/src/components/core/sidebar/SidebarRail.vue +1 -2
- package/src/components/core/sidebar/SidebarResizeHandle.vue +46 -0
- package/src/components/core/sidebar/index.ts +17 -0
- package/src/components/core/sidebar/utils.ts +4 -0
- package/src/components/index.ts +1 -0
- package/src/patterns/UiSidebar/UiSidebar.stories.ts +42 -1
- package/src/patterns/UiSidebar/UiSidebar.vue +20 -0
- package/src/patterns/UiSidebar/__tests__/UiSidebar.test.ts +204 -2
- package/src/patterns/UiSidebar/__tests__/UiSidebarRail.test.ts +14 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useForwardExpose } from 'reka-ui';
|
|
3
|
+
import { ResizablePanel } from '@/components/core/resizable';
|
|
4
|
+
import type { UiResizablePanelEmits, UiResizablePanelProps } from './types';
|
|
5
|
+
|
|
6
|
+
defineOptions({
|
|
7
|
+
name: 'UiResizablePanel',
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const props = defineProps<UiResizablePanelProps>();
|
|
11
|
+
const emit = defineEmits<UiResizablePanelEmits>();
|
|
12
|
+
const { forwardRef } = useForwardExpose();
|
|
13
|
+
|
|
14
|
+
function handleResize(size: number, prevSize: number | undefined) {
|
|
15
|
+
emit('resize', size, prevSize);
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<ResizablePanel
|
|
21
|
+
:ref="forwardRef"
|
|
22
|
+
v-slot="slotProps"
|
|
23
|
+
v-bind="props"
|
|
24
|
+
@collapse="emit('collapse')"
|
|
25
|
+
@expand="emit('expand')"
|
|
26
|
+
@resize="handleResize"
|
|
27
|
+
>
|
|
28
|
+
<slot v-bind="slotProps" />
|
|
29
|
+
</ResizablePanel>
|
|
30
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useForwardExpose } from 'reka-ui';
|
|
3
|
+
import { ResizablePanelGroup } from '@/components/core/resizable';
|
|
4
|
+
import type {
|
|
5
|
+
UiResizablePanelGroupEmits,
|
|
6
|
+
UiResizablePanelGroupProps,
|
|
7
|
+
} from './types';
|
|
8
|
+
|
|
9
|
+
defineOptions({
|
|
10
|
+
name: 'UiResizablePanelGroup',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const props = defineProps<UiResizablePanelGroupProps>();
|
|
14
|
+
const emit = defineEmits<UiResizablePanelGroupEmits>();
|
|
15
|
+
const { forwardRef } = useForwardExpose();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<ResizablePanelGroup
|
|
20
|
+
:ref="forwardRef"
|
|
21
|
+
v-slot="slotProps"
|
|
22
|
+
v-bind="props"
|
|
23
|
+
@layout="emit('layout', $event)"
|
|
24
|
+
>
|
|
25
|
+
<slot v-bind="slotProps" />
|
|
26
|
+
</ResizablePanelGroup>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { render } from '@testing-library/vue';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
4
|
+
import { defineComponent, h } from 'vue';
|
|
5
|
+
import UiResizableHandle from '../UiResizableHandle.vue';
|
|
6
|
+
|
|
7
|
+
vi.mock('@/components/core/resizable', () => ({
|
|
8
|
+
ResizableHandle: defineComponent({
|
|
9
|
+
name: 'ResizableHandleMock',
|
|
10
|
+
props: {
|
|
11
|
+
disabled: Boolean,
|
|
12
|
+
id: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: undefined,
|
|
15
|
+
},
|
|
16
|
+
withHandle: Boolean,
|
|
17
|
+
},
|
|
18
|
+
emits: ['dragging'],
|
|
19
|
+
setup(props, { attrs, emit, slots }) {
|
|
20
|
+
return () =>
|
|
21
|
+
h(
|
|
22
|
+
'button',
|
|
23
|
+
{
|
|
24
|
+
...attrs,
|
|
25
|
+
'data-disabled': String(props.disabled),
|
|
26
|
+
'data-id': props.id,
|
|
27
|
+
'data-testid': 'resizable-handle',
|
|
28
|
+
'data-with-handle': String(props.withHandle),
|
|
29
|
+
type: 'button',
|
|
30
|
+
onClick: () => emit('dragging', true),
|
|
31
|
+
},
|
|
32
|
+
slots.default?.(),
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
describe('UiResizableHandle', () => {
|
|
39
|
+
test('renders default slot and forwards handle props', () => {
|
|
40
|
+
const { getByTestId, getByText } = render(UiResizableHandle, {
|
|
41
|
+
props: {
|
|
42
|
+
disabled: true,
|
|
43
|
+
id: 'resize-sidebar',
|
|
44
|
+
withHandle: true,
|
|
45
|
+
},
|
|
46
|
+
slots: { default: '<span>Grip</span>' },
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const handle = getByTestId('resizable-handle');
|
|
50
|
+
expect(handle).toHaveAttribute('data-disabled', 'true');
|
|
51
|
+
expect(handle).toHaveAttribute('data-id', 'resize-sidebar');
|
|
52
|
+
expect(handle).toHaveAttribute('data-with-handle', 'true');
|
|
53
|
+
expect(getByText('Grip')).toBeInTheDocument();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('re-emits dragging changes', async () => {
|
|
57
|
+
const user = userEvent.setup();
|
|
58
|
+
const { emitted, getByTestId } = render(UiResizableHandle);
|
|
59
|
+
|
|
60
|
+
await user.click(getByTestId('resizable-handle'));
|
|
61
|
+
|
|
62
|
+
expect(emitted('dragging')?.[0]).toEqual([true]);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { render } from '@testing-library/vue';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
4
|
+
import { defineComponent, h } from 'vue';
|
|
5
|
+
import UiResizablePanel from '../UiResizablePanel.vue';
|
|
6
|
+
|
|
7
|
+
vi.mock('@/components/core/resizable', () => ({
|
|
8
|
+
ResizablePanel: defineComponent({
|
|
9
|
+
name: 'ResizablePanelMock',
|
|
10
|
+
props: {
|
|
11
|
+
defaultSize: {
|
|
12
|
+
type: Number,
|
|
13
|
+
default: undefined,
|
|
14
|
+
},
|
|
15
|
+
minSize: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default: undefined,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
emits: ['collapse', 'expand', 'resize'],
|
|
21
|
+
setup(props, { attrs, emit, slots }) {
|
|
22
|
+
return () =>
|
|
23
|
+
h(
|
|
24
|
+
'button',
|
|
25
|
+
{
|
|
26
|
+
...attrs,
|
|
27
|
+
'data-default-size': props.defaultSize,
|
|
28
|
+
'data-min-size': props.minSize,
|
|
29
|
+
'data-testid': 'resizable-panel',
|
|
30
|
+
type: 'button',
|
|
31
|
+
onClick: () => {
|
|
32
|
+
emit('collapse');
|
|
33
|
+
emit('expand');
|
|
34
|
+
emit('resize', 40, 30);
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
slots.default?.({ isCollapsed: false, isExpanded: true }),
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
describe('UiResizablePanel', () => {
|
|
44
|
+
test('renders default slot and forwards size props', () => {
|
|
45
|
+
const { getByTestId, getByText } = render(UiResizablePanel, {
|
|
46
|
+
props: {
|
|
47
|
+
defaultSize: 60,
|
|
48
|
+
minSize: 20,
|
|
49
|
+
},
|
|
50
|
+
slots: { default: '<span>Panel content</span>' },
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const panel = getByTestId('resizable-panel');
|
|
54
|
+
expect(panel).toHaveAttribute('data-default-size', '60');
|
|
55
|
+
expect(panel).toHaveAttribute('data-min-size', '20');
|
|
56
|
+
expect(getByText('Panel content')).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('passes slot props through from the core panel', () => {
|
|
60
|
+
const { getByText } = render({
|
|
61
|
+
components: { UiResizablePanel },
|
|
62
|
+
template: `
|
|
63
|
+
<UiResizablePanel :default-size="50" v-slot="{ isCollapsed, isExpanded }">
|
|
64
|
+
Collapsed: {{ isCollapsed }}, expanded: {{ isExpanded }}
|
|
65
|
+
</UiResizablePanel>
|
|
66
|
+
`,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
expect(getByText('Collapsed: false, expanded: true')).toBeInTheDocument();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('re-emits panel lifecycle events', async () => {
|
|
73
|
+
const user = userEvent.setup();
|
|
74
|
+
const { emitted, getByTestId } = render(UiResizablePanel);
|
|
75
|
+
|
|
76
|
+
await user.click(getByTestId('resizable-panel'));
|
|
77
|
+
|
|
78
|
+
expect(emitted('collapse')?.[0]).toEqual([]);
|
|
79
|
+
expect(emitted('expand')?.[0]).toEqual([]);
|
|
80
|
+
expect(emitted('resize')?.[0]).toEqual([40, 30]);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { render } from '@testing-library/vue';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
4
|
+
import { defineComponent, h } from 'vue';
|
|
5
|
+
import UiResizablePanelGroup from '../UiResizablePanelGroup.vue';
|
|
6
|
+
|
|
7
|
+
vi.mock('@/components/core/resizable', () => ({
|
|
8
|
+
ResizablePanelGroup: defineComponent({
|
|
9
|
+
name: 'ResizablePanelGroupMock',
|
|
10
|
+
props: {
|
|
11
|
+
autoSaveId: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: undefined,
|
|
14
|
+
},
|
|
15
|
+
direction: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: undefined,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
emits: ['layout'],
|
|
21
|
+
setup(props, { attrs, emit, slots }) {
|
|
22
|
+
return () =>
|
|
23
|
+
h(
|
|
24
|
+
'div',
|
|
25
|
+
{
|
|
26
|
+
...attrs,
|
|
27
|
+
'data-auto-save-id': props.autoSaveId,
|
|
28
|
+
'data-direction': props.direction,
|
|
29
|
+
'data-testid': 'resizable-panel-group',
|
|
30
|
+
onClick: () => emit('layout', [25, 75]),
|
|
31
|
+
},
|
|
32
|
+
slots.default?.({ layout: [25, 75] }),
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
describe('UiResizablePanelGroup', () => {
|
|
39
|
+
test('renders default slot and forwards props and classes', () => {
|
|
40
|
+
const { getByTestId, getByText } = render(UiResizablePanelGroup, {
|
|
41
|
+
props: {
|
|
42
|
+
autoSaveId: 'main-layout',
|
|
43
|
+
class: 'custom-panel-group',
|
|
44
|
+
direction: 'horizontal',
|
|
45
|
+
},
|
|
46
|
+
slots: { default: '<span>Resizable panels</span>' },
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const panelGroup = getByTestId('resizable-panel-group');
|
|
50
|
+
expect(panelGroup).toHaveAttribute('data-auto-save-id', 'main-layout');
|
|
51
|
+
expect(panelGroup).toHaveAttribute('data-direction', 'horizontal');
|
|
52
|
+
expect(panelGroup).toHaveClass('custom-panel-group');
|
|
53
|
+
expect(getByText('Resizable panels')).toBeInTheDocument();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('passes slot props through from the core panel group', () => {
|
|
57
|
+
const { getByText } = render({
|
|
58
|
+
components: { UiResizablePanelGroup },
|
|
59
|
+
template: `
|
|
60
|
+
<UiResizablePanelGroup direction="horizontal" v-slot="{ layout }">
|
|
61
|
+
Layout: {{ layout.join('/') }}
|
|
62
|
+
</UiResizablePanelGroup>
|
|
63
|
+
`,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
expect(getByText('Layout: 25/75')).toBeInTheDocument();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('re-emits layout changes', async () => {
|
|
70
|
+
const user = userEvent.setup();
|
|
71
|
+
const { emitted, getByTestId } = render(UiResizablePanelGroup, {
|
|
72
|
+
props: { direction: 'horizontal' },
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
await user.click(getByTestId('resizable-panel-group'));
|
|
76
|
+
|
|
77
|
+
expect(emitted('layout')?.[0]).toEqual([[25, 75]]);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SplitterGroupEmits,
|
|
3
|
+
SplitterGroupProps,
|
|
4
|
+
SplitterPanelEmits,
|
|
5
|
+
SplitterPanelProps,
|
|
6
|
+
SplitterResizeHandleEmits,
|
|
7
|
+
SplitterResizeHandleProps,
|
|
8
|
+
} from 'reka-ui';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A resizable panel layout for splitting available space into user-adjustable regions.
|
|
12
|
+
* Use for sidebars, inspectors, editors, and other dense layouts where users need
|
|
13
|
+
* control over panel sizes.
|
|
14
|
+
* @category Layout
|
|
15
|
+
* @useCases split pane, resizable sidebar, editor layout, inspector panel
|
|
16
|
+
* @keywords resizable, splitter, panel, pane, layout, sidebar
|
|
17
|
+
* @related UiSheet, UiSeparator
|
|
18
|
+
*/
|
|
19
|
+
export type UiResizablePanelGroupProps = SplitterGroupProps;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Emits for the UiResizablePanelGroup component.
|
|
23
|
+
*/
|
|
24
|
+
export type UiResizablePanelGroupEmits = SplitterGroupEmits;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Props for an individual resizable panel.
|
|
28
|
+
*/
|
|
29
|
+
export type UiResizablePanelProps = SplitterPanelProps;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Emits for the UiResizablePanel component.
|
|
33
|
+
*/
|
|
34
|
+
export type UiResizablePanelEmits = SplitterPanelEmits;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Props for the drag handle between two resizable panels.
|
|
38
|
+
*/
|
|
39
|
+
export type UiResizableHandleProps = SplitterResizeHandleProps & {
|
|
40
|
+
/**
|
|
41
|
+
* Show the small grip affordance inside the resize handle.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
withHandle?: boolean;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Emits for the UiResizableHandle component.
|
|
49
|
+
*/
|
|
50
|
+
export type UiResizableHandleEmits = SplitterResizeHandleEmits;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type {
|
|
3
|
+
SplitterResizeHandleEmits,
|
|
4
|
+
SplitterResizeHandleProps,
|
|
5
|
+
} from 'reka-ui';
|
|
6
|
+
import type { HTMLAttributes } from 'vue';
|
|
7
|
+
import { reactiveOmit } from '@vueuse/core';
|
|
8
|
+
import { GripVertical } from 'lucide-vue-next';
|
|
9
|
+
import { SplitterResizeHandle, useForwardPropsEmits } from 'reka-ui';
|
|
10
|
+
import { cn } from '@/lib/utils';
|
|
11
|
+
|
|
12
|
+
const props = defineProps<
|
|
13
|
+
SplitterResizeHandleProps & {
|
|
14
|
+
class?: HTMLAttributes['class'];
|
|
15
|
+
withHandle?: boolean;
|
|
16
|
+
}
|
|
17
|
+
>();
|
|
18
|
+
const emits = defineEmits<SplitterResizeHandleEmits>();
|
|
19
|
+
|
|
20
|
+
const delegatedProps = reactiveOmit(props, 'class', 'withHandle');
|
|
21
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<SplitterResizeHandle
|
|
26
|
+
data-slot="resizable-handle"
|
|
27
|
+
v-bind="forwarded"
|
|
28
|
+
:class="
|
|
29
|
+
cn(
|
|
30
|
+
'bg-border focus-visible:bg-border-surface-focus-ring focus-visible:ring-ring relative flex w-px items-center justify-center border border-transparent hover:border-accent-default after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:border-accent-default focus-visible:after:bg-border-surface-focus-ring focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[orientation=vertical]:h-px data-[orientation=vertical]:w-full data-[orientation=vertical]:after:left-0 data-[orientation=vertical]:after:h-1 data-[orientation=vertical]:after:w-full data-[orientation=vertical]:after:-translate-y-1/2 data-[orientation=vertical]:after:translate-x-0 data-[state=drag]:border-accent-default data-[resize-handle-active=pointer]:border-accent-default [&:focus-visible>div]:border-accent-default [&:focus-visible>div]:bg-border-surface-focus-ring [&:hover>div]:border-accent-default [&[data-state=drag]>div]:border-accent-default [&[data-orientation=vertical]>div]:rotate-90',
|
|
31
|
+
props.class,
|
|
32
|
+
)
|
|
33
|
+
"
|
|
34
|
+
>
|
|
35
|
+
<template v-if="props.withHandle">
|
|
36
|
+
<div
|
|
37
|
+
class="bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border border-transparent hover:border-accent-default"
|
|
38
|
+
>
|
|
39
|
+
<slot>
|
|
40
|
+
<GripVertical class="size-2.5" />
|
|
41
|
+
</slot>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
</SplitterResizeHandle>
|
|
45
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SplitterPanelEmits, SplitterPanelProps } from 'reka-ui';
|
|
3
|
+
import { SplitterPanel, useForwardExpose, useForwardPropsEmits } from 'reka-ui';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<SplitterPanelProps>();
|
|
6
|
+
const emits = defineEmits<SplitterPanelEmits>();
|
|
7
|
+
|
|
8
|
+
const forwarded = useForwardPropsEmits(props, emits);
|
|
9
|
+
const { forwardRef } = useForwardExpose();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<SplitterPanel
|
|
14
|
+
:ref="forwardRef"
|
|
15
|
+
v-slot="slotProps"
|
|
16
|
+
data-slot="resizable-panel"
|
|
17
|
+
v-bind="forwarded"
|
|
18
|
+
>
|
|
19
|
+
<slot v-bind="slotProps" />
|
|
20
|
+
</SplitterPanel>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SplitterGroupEmits, SplitterGroupProps } from 'reka-ui';
|
|
3
|
+
import type { HTMLAttributes } from 'vue';
|
|
4
|
+
import { reactiveOmit } from '@vueuse/core';
|
|
5
|
+
import { SplitterGroup, useForwardExpose, useForwardPropsEmits } from 'reka-ui';
|
|
6
|
+
import { cn } from '@/lib/utils';
|
|
7
|
+
|
|
8
|
+
const props = defineProps<
|
|
9
|
+
SplitterGroupProps & { class?: HTMLAttributes['class'] }
|
|
10
|
+
>();
|
|
11
|
+
const emits = defineEmits<SplitterGroupEmits>();
|
|
12
|
+
|
|
13
|
+
const delegatedProps = reactiveOmit(props, 'class');
|
|
14
|
+
|
|
15
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
16
|
+
const { forwardRef } = useForwardExpose();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<SplitterGroup
|
|
21
|
+
:ref="forwardRef"
|
|
22
|
+
v-slot="slotProps"
|
|
23
|
+
data-slot="resizable-panel-group"
|
|
24
|
+
v-bind="forwarded"
|
|
25
|
+
:class="
|
|
26
|
+
cn('flex h-full w-full data-[orientation=vertical]:flex-col', props.class)
|
|
27
|
+
"
|
|
28
|
+
>
|
|
29
|
+
<slot v-bind="slotProps" />
|
|
30
|
+
</SplitterGroup>
|
|
31
|
+
</template>
|