@aleph-alpha/ui-library 2.2.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/UiToggle/UiToggle.vue.d.ts +5 -0
- package/dist/system/components/UiToggle/types.d.ts +13 -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/heightTransition.d.ts +5 -0
- package/dist/system/lib/useDrag.d.ts +52 -0
- package/dist/system/lib.js +22198 -19966
- package/dist/system/patterns/UiDataTable/UiDataTable.vue.d.ts +22 -3
- package/dist/system/patterns/UiDataTable/UiDataTableColumnFilter.vue.d.ts +14 -0
- package/dist/system/patterns/UiDataTable/constants.d.ts +13 -0
- package/dist/system/patterns/UiDataTable/index.d.ts +2 -0
- package/dist/system/patterns/UiDataTable/types.d.ts +32 -1
- 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/UiTable/__tests__/UiTableRow.test.ts +14 -5
- package/src/components/UiToggle/UiToggle.vue +18 -1
- package/src/components/UiToggle/__tests__/UiToggle.test.ts +33 -3
- package/src/components/UiToggle/types.ts +13 -0
- package/src/components/core/accordion/AccordionContent.vue +36 -1
- 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/core/table/TableRow.vue +1 -1
- package/src/components/core/toggle/index.ts +2 -2
- package/src/components/index.ts +1 -0
- package/src/lib/heightTransition.ts +27 -0
- package/src/lib/useDrag.stories.ts +295 -0
- package/src/lib/useDrag.ts +212 -0
- package/src/patterns/UiDataTable/UiDataTable.stories.ts +348 -0
- package/src/patterns/UiDataTable/UiDataTable.vue +558 -22
- package/src/patterns/UiDataTable/UiDataTableColumnFilter.vue +83 -0
- package/src/patterns/UiDataTable/UiDataTableColumnHeader.vue +4 -13
- package/src/patterns/UiDataTable/__tests__/UiDataTable.test.ts +329 -0
- package/src/patterns/UiDataTable/__tests__/UiDataTableColumnFilter.test.ts +194 -0
- package/src/patterns/UiDataTable/__tests__/UiDataTableColumnHeader.test.ts +11 -0
- package/src/patterns/UiDataTable/constants.ts +15 -0
- package/src/patterns/UiDataTable/index.ts +2 -0
- package/src/patterns/UiDataTable/types.ts +33 -0
- package/src/patterns/UiSidebar/UiSidebar.stories.ts +42 -1
- package/src/patterns/UiSidebar/UiSidebar.vue +20 -0
- package/src/patterns/UiSidebar/UiSidebarGroupContent.vue +13 -36
- package/src/patterns/UiSidebar/__tests__/UiSidebar.test.ts +204 -2
- package/src/patterns/UiSidebar/__tests__/UiSidebarRail.test.ts +14 -0
|
@@ -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;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '@testing-library/jest-dom/vitest';
|
|
2
1
|
import { render } from '@testing-library/vue';
|
|
3
2
|
import { describe, expect, test } from 'vitest';
|
|
4
3
|
import UiTableRow from '../UiTableRow.vue';
|
|
@@ -10,7 +9,7 @@ describe('UiTableRow', () => {
|
|
|
10
9
|
slots: { default: '<td>Cell</td>' },
|
|
11
10
|
});
|
|
12
11
|
|
|
13
|
-
expect(getByRole('row')).
|
|
12
|
+
expect(getByRole('row').className).toContain('hover:bg-muted');
|
|
14
13
|
});
|
|
15
14
|
|
|
16
15
|
test('uses muted-subtle hover fill by default', () => {
|
|
@@ -18,18 +17,28 @@ describe('UiTableRow', () => {
|
|
|
18
17
|
slots: { default: '<td>Cell</td>' },
|
|
19
18
|
});
|
|
20
19
|
|
|
21
|
-
expect(getByRole('row')).
|
|
20
|
+
expect(getByRole('row').className).toContain(
|
|
22
21
|
'hover:bg-background-surface-muted-subtle',
|
|
23
22
|
);
|
|
24
23
|
});
|
|
25
24
|
|
|
25
|
+
test('does not apply row hover fill when hovering a button inside the row', () => {
|
|
26
|
+
const { getByRole } = render(UiTableRow, {
|
|
27
|
+
slots: { default: '<td><button type="button">Expand</button></td>' },
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
expect(getByRole('row').className).toContain(
|
|
31
|
+
'has-[button:hover]:hover:bg-transparent',
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
26
35
|
test('applies data-state="selected" when selected prop is true', () => {
|
|
27
36
|
const { getByRole } = render(UiTableRow, {
|
|
28
37
|
props: { selected: true },
|
|
29
38
|
slots: { default: '<td>Cell</td>' },
|
|
30
39
|
});
|
|
31
40
|
|
|
32
|
-
expect(getByRole('row')
|
|
41
|
+
expect(getByRole('row').getAttribute('data-state')).toBe('selected');
|
|
33
42
|
});
|
|
34
43
|
|
|
35
44
|
test('defaults to not selected', () => {
|
|
@@ -37,6 +46,6 @@ describe('UiTableRow', () => {
|
|
|
37
46
|
slots: { default: '<td>Cell</td>' },
|
|
38
47
|
});
|
|
39
48
|
|
|
40
|
-
expect(getByRole('row')
|
|
49
|
+
expect(getByRole('row').hasAttribute('data-state')).toBe(false);
|
|
41
50
|
});
|
|
42
51
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { Toggle as ShadcnToggle } from '@/components/core/toggle';
|
|
3
|
+
import { UiIcon } from '@/components/UiIcon';
|
|
3
4
|
import type { UiToggleProps } from './types';
|
|
4
5
|
|
|
5
6
|
defineOptions({
|
|
@@ -10,19 +11,35 @@ const props = withDefaults(defineProps<UiToggleProps>(), {
|
|
|
10
11
|
disabled: false,
|
|
11
12
|
variant: 'default',
|
|
12
13
|
size: 'default',
|
|
14
|
+
active: undefined,
|
|
15
|
+
leftIcon: undefined,
|
|
16
|
+
rightIcon: undefined,
|
|
13
17
|
});
|
|
14
18
|
|
|
15
19
|
const modelValue = defineModel<boolean>();
|
|
20
|
+
|
|
21
|
+
function handleUpdateModelValue(value: boolean) {
|
|
22
|
+
if (props.active !== undefined) return;
|
|
23
|
+
|
|
24
|
+
modelValue.value = value;
|
|
25
|
+
}
|
|
16
26
|
</script>
|
|
17
27
|
|
|
18
28
|
<template>
|
|
19
29
|
<ShadcnToggle
|
|
20
|
-
|
|
30
|
+
:model-value="props.active ?? modelValue"
|
|
21
31
|
:default-value="props.defaultValue"
|
|
22
32
|
:disabled="props.disabled"
|
|
23
33
|
:variant="props.variant"
|
|
24
34
|
:size="props.size"
|
|
35
|
+
@update:model-value="handleUpdateModelValue"
|
|
25
36
|
>
|
|
37
|
+
<slot name="left-icon">
|
|
38
|
+
<UiIcon v-if="props.leftIcon" :name="props.leftIcon" :size="16" />
|
|
39
|
+
</slot>
|
|
26
40
|
<slot />
|
|
41
|
+
<slot name="right-icon">
|
|
42
|
+
<UiIcon v-if="props.rightIcon" :name="props.rightIcon" :size="16" />
|
|
43
|
+
</slot>
|
|
27
44
|
</ShadcnToggle>
|
|
28
45
|
</template>
|
|
@@ -25,6 +25,14 @@ describe('UiToggle', () => {
|
|
|
25
25
|
expect(getByRole('button')).toHaveAttribute('data-state', 'off');
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
test('uses active prop as controlled visual state', () => {
|
|
29
|
+
const { getByRole } = render(UiToggle, {
|
|
30
|
+
props: { active: true },
|
|
31
|
+
slots: { default: 'Toggle' },
|
|
32
|
+
});
|
|
33
|
+
expect(getByRole('button')).toHaveAttribute('data-state', 'on');
|
|
34
|
+
});
|
|
35
|
+
|
|
28
36
|
test('uses muted-subtle hover fill', () => {
|
|
29
37
|
const { getByRole } = render(UiToggle, {
|
|
30
38
|
slots: { default: 'Toggle' },
|
|
@@ -34,6 +42,16 @@ describe('UiToggle', () => {
|
|
|
34
42
|
);
|
|
35
43
|
});
|
|
36
44
|
|
|
45
|
+
test('uses outlined button border by default', () => {
|
|
46
|
+
const { getByRole } = render(UiToggle, {
|
|
47
|
+
slots: { default: 'Toggle' },
|
|
48
|
+
});
|
|
49
|
+
expect(getByRole('button')).toHaveClass(
|
|
50
|
+
'border',
|
|
51
|
+
'border-border-button-outlined',
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
37
55
|
test('is disabled when disabled prop is true', () => {
|
|
38
56
|
const { getByRole } = render(UiToggle, {
|
|
39
57
|
props: { disabled: true },
|
|
@@ -58,11 +76,15 @@ describe('UiToggle', () => {
|
|
|
58
76
|
});
|
|
59
77
|
const toggle = container.querySelector('button');
|
|
60
78
|
expect(toggle).toHaveClass('bg-transparent');
|
|
61
|
-
expect(toggle).toHaveClass('
|
|
79
|
+
expect(toggle).toHaveClass('border-border-button-outlined');
|
|
80
|
+
expect(toggle).toHaveClass('data-[state=on]:bg-background-accent-soft');
|
|
81
|
+
expect(toggle).toHaveClass('data-[state=on]:text-content-on-accent-soft');
|
|
62
82
|
expect(toggle).toHaveClass('data-[state=on]:border-accent-default');
|
|
63
|
-
expect(toggle).toHaveClass('data-[state=open]:bg-accent');
|
|
83
|
+
expect(toggle).toHaveClass('data-[state=open]:bg-background-accent-soft');
|
|
84
|
+
expect(toggle).toHaveClass('data-[state=open]:text-content-on-accent-soft');
|
|
64
85
|
expect(toggle).toHaveClass('data-[state=open]:border-accent-default');
|
|
65
|
-
expect(toggle).toHaveClass('aria-pressed:bg-accent');
|
|
86
|
+
expect(toggle).toHaveClass('aria-pressed:bg-background-accent-soft');
|
|
87
|
+
expect(toggle).toHaveClass('aria-pressed:text-content-on-accent-soft');
|
|
66
88
|
expect(toggle).toHaveClass('aria-pressed:border-accent-default');
|
|
67
89
|
});
|
|
68
90
|
|
|
@@ -83,4 +105,12 @@ describe('UiToggle', () => {
|
|
|
83
105
|
const toggle = container.querySelector('button');
|
|
84
106
|
expect(toggle).toHaveClass('h-10');
|
|
85
107
|
});
|
|
108
|
+
|
|
109
|
+
test('renders left and right icons', () => {
|
|
110
|
+
const { container } = render(UiToggle, {
|
|
111
|
+
props: { leftIcon: 'columns3', rightIcon: 'chevron-down' },
|
|
112
|
+
slots: { default: 'Toggle' },
|
|
113
|
+
});
|
|
114
|
+
expect(container.querySelectorAll('[data-slot="icon"]')).toHaveLength(2);
|
|
115
|
+
});
|
|
86
116
|
});
|
|
@@ -16,6 +16,11 @@ export interface UiToggleProps {
|
|
|
16
16
|
* Use when you do not need to control its state.
|
|
17
17
|
*/
|
|
18
18
|
defaultValue?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Controlled visual active state. Useful when another component, such as a dropdown,
|
|
21
|
+
* owns the active/open state.
|
|
22
|
+
*/
|
|
23
|
+
active?: boolean;
|
|
19
24
|
/**
|
|
20
25
|
* Whether the toggle is disabled.
|
|
21
26
|
* @default false
|
|
@@ -31,4 +36,12 @@ export interface UiToggleProps {
|
|
|
31
36
|
* @default 'default'
|
|
32
37
|
*/
|
|
33
38
|
size?: 'default' | 'sm' | 'lg';
|
|
39
|
+
/**
|
|
40
|
+
* Optional icon rendered before the default slot.
|
|
41
|
+
*/
|
|
42
|
+
leftIcon?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Optional icon rendered after the default slot.
|
|
45
|
+
*/
|
|
46
|
+
rightIcon?: string;
|
|
34
47
|
}
|
|
@@ -16,10 +16,45 @@ const delegatedProps = reactiveOmit(props, 'class');
|
|
|
16
16
|
<AccordionContent
|
|
17
17
|
data-slot="accordion-content"
|
|
18
18
|
v-bind="delegatedProps"
|
|
19
|
-
class="
|
|
19
|
+
class="ui-accordion-content overflow-hidden text-sm"
|
|
20
20
|
>
|
|
21
21
|
<div :class="cn('pt-0 pb-4', props.class)">
|
|
22
22
|
<slot />
|
|
23
23
|
</div>
|
|
24
24
|
</AccordionContent>
|
|
25
25
|
</template>
|
|
26
|
+
|
|
27
|
+
<style scoped>
|
|
28
|
+
.ui-accordion-content[data-state='open'] {
|
|
29
|
+
animation: ui-accordion-down 200ms linear;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ui-accordion-content[data-state='closed'] {
|
|
33
|
+
animation: ui-accordion-up 200ms linear;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media (prefers-reduced-motion: reduce) {
|
|
37
|
+
.ui-accordion-content[data-state='open'],
|
|
38
|
+
.ui-accordion-content[data-state='closed'] {
|
|
39
|
+
animation-duration: 1ms;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@keyframes ui-accordion-down {
|
|
44
|
+
from {
|
|
45
|
+
height: 0;
|
|
46
|
+
}
|
|
47
|
+
to {
|
|
48
|
+
height: var(--reka-accordion-content-height);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@keyframes ui-accordion-up {
|
|
53
|
+
from {
|
|
54
|
+
height: var(--reka-accordion-content-height);
|
|
55
|
+
}
|
|
56
|
+
to {
|
|
57
|
+
height: 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
</style>
|
|
@@ -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>
|