@aleph-alpha/ui-library 6.3.4 → 6.5.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/config.js +2 -1
- package/dist/system/components/UiDropdownMenu/UiDropdownMenuSubContent.vue.d.ts +102 -2
- package/dist/system/components/UiDropdownMenu/UiDropdownMenuViewport.vue.d.ts +23 -0
- package/dist/system/components/UiDropdownMenu/menu-metrics.d.ts +4 -0
- package/dist/system/components/UiDropdownMenu/placeMobileSubmenu.d.ts +55 -0
- package/dist/system/components/UiDropdownMenu/types.d.ts +3 -0
- package/dist/system/components/UiDropdownMenu/useMobileSubmenuPlacement.d.ts +18 -0
- package/dist/system/components/UiFileItem/UiFileItem.vue.d.ts +10 -1
- package/dist/system/components/UiFileItem/index.d.ts +1 -1
- package/dist/system/components/UiFileItem/types.d.ts +81 -5
- package/dist/system/components/UiFileUploadBox/UiFileUploadBox.vue.d.ts +2 -2
- package/dist/system/components/UiPopover/UiPopoverContent.vue.d.ts +1 -0
- package/dist/system/components/UiPopover/types.d.ts +6 -0
- package/dist/system/components/UiResizable/UiResizablePanel.vue.d.ts +2 -2
- package/dist/system/components/UiToggle/UiToggle.vue.d.ts +2 -1
- package/dist/system/components/UiToggle/types.d.ts +10 -2
- package/dist/system/components/UiToggleGroup/UiToggleGroupItem.vue.d.ts +5 -1
- package/dist/system/components/UiToggleGroup/types.d.ts +12 -2
- package/dist/system/components/core/dropdown-menu/DropdownMenuSubContent.vue.d.ts +2 -6
- package/dist/system/components/core/popover/PopoverContent.vue.d.ts +1 -0
- package/dist/system/components/core/resizable/ResizablePanel.vue.d.ts +2 -2
- package/dist/system/components/core/toggle/Toggle.vue.d.ts +3 -1
- package/dist/system/components/core/toggle/index.d.ts +47 -2
- package/dist/system/components/core/toggle-group/ToggleGroup.vue.d.ts +3 -1
- package/dist/system/components/core/toggle-group/ToggleGroupItem.vue.d.ts +11 -1
- package/dist/system/components/core/toggle-group/context.d.ts +1 -0
- package/dist/system/components/core/toggle-group/index.d.ts +10 -2
- package/dist/system/lib.js +10646 -10369
- package/dist/system/patterns/UiFileUpload/UiFileUpload.vue.d.ts +2 -2
- package/dist/system/patterns/UiLayout/layout-shell.d.ts +171 -12
- package/dist/system/patterns/UiProfileCard/profile-card.d.ts +51 -1
- package/dist/system/patterns/UiTopBar/accessory-dropdown.d.ts +9 -4
- package/package.json +2 -2
- package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +819 -31
- package/src/components/UiDropdownMenu/UiDropdownMenuContent.vue +4 -1
- package/src/components/UiDropdownMenu/UiDropdownMenuSubContent.vue +142 -1
- package/src/components/UiDropdownMenu/UiDropdownMenuSubTrigger.vue +28 -0
- package/src/components/UiDropdownMenu/UiDropdownMenuViewport.vue +171 -0
- package/src/components/UiDropdownMenu/__tests__/UiDropdownMenu.test.ts +326 -0
- package/src/components/UiDropdownMenu/__tests__/placeMobileSubmenu.test.ts +128 -0
- package/src/components/UiDropdownMenu/menu-metrics.ts +5 -0
- package/src/components/UiDropdownMenu/placeMobileSubmenu.ts +96 -0
- package/src/components/UiDropdownMenu/types.ts +3 -0
- package/src/components/UiDropdownMenu/useMobileSubmenuPlacement.ts +163 -0
- package/src/components/UiFileItem/UiFileItem.vue +111 -6
- package/src/components/UiFileItem/__tests__/UiFileItem.test.ts +52 -0
- package/src/components/UiFileItem/index.ts +1 -0
- package/src/components/UiFileItem/types.ts +82 -5
- package/src/components/UiPopover/UiPopover.stories.ts +141 -0
- package/src/components/UiPopover/UiPopoverContent.vue +2 -0
- package/src/components/UiPopover/__tests__/UiPopover.test.ts +48 -0
- package/src/components/UiPopover/types.ts +7 -0
- package/src/components/UiSnackbar/UiSnackbar.stories.ts +104 -32
- package/src/components/UiToggle/UiToggle.stories.ts +386 -261
- package/src/components/UiToggle/UiToggle.vue +2 -0
- package/src/components/UiToggle/__tests__/UiToggle.test.ts +63 -10
- package/src/components/UiToggle/types.ts +10 -2
- package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +765 -30
- package/src/components/UiToggleGroup/UiToggleGroup.vue +2 -0
- package/src/components/UiToggleGroup/UiToggleGroupItem.vue +10 -1
- package/src/components/UiToggleGroup/__tests__/UiToggleGroup.test.ts +83 -4
- package/src/components/UiToggleGroup/types.ts +12 -2
- package/src/components/core/dropdown-menu/DropdownMenuContent.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuItem.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuSubContent.vue +31 -20
- package/src/components/core/popover/PopoverContent.vue +9 -3
- package/src/components/core/toggle/Toggle.vue +12 -5
- package/src/components/core/toggle/index.ts +47 -19
- package/src/components/core/toggle-group/ToggleGroup.vue +20 -4
- package/src/components/core/toggle-group/ToggleGroupItem.vue +36 -8
- package/src/components/core/toggle-group/context.ts +1 -0
- package/src/components/core/toggle-group/index.ts +10 -24
- package/src/patterns/UiDataTable/UiDataTableColumnFilter.vue +1 -1
- package/src/patterns/UiDataTable/UiDataTableFilterMenu.vue +1 -1
- package/src/patterns/UiFileUpload/UiFileItem.stories.ts +808 -22
- package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +188 -6
- package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +13 -6
- package/src/patterns/UiTopBar/accessory-dropdown.ts +5 -3
|
@@ -10,6 +10,7 @@ const props = withDefaults(defineProps<UiPopoverContentProps>(), {
|
|
|
10
10
|
side: 'bottom',
|
|
11
11
|
sideOffset: 4,
|
|
12
12
|
align: 'center',
|
|
13
|
+
compact: false,
|
|
13
14
|
});
|
|
14
15
|
|
|
15
16
|
const emit = defineEmits<UiPopoverContentEmits>();
|
|
@@ -20,6 +21,7 @@ const emit = defineEmits<UiPopoverContentEmits>();
|
|
|
20
21
|
:side="props.side"
|
|
21
22
|
:side-offset="props.sideOffset"
|
|
22
23
|
:align="props.align"
|
|
24
|
+
:compact="props.compact"
|
|
23
25
|
@escape-key-down="emit('escapeKeyDown', $event)"
|
|
24
26
|
>
|
|
25
27
|
<slot />
|
|
@@ -46,4 +46,52 @@ describe('UiPopoverContent', () => {
|
|
|
46
46
|
|
|
47
47
|
expect(onEscapeKeyDown).toHaveBeenCalled();
|
|
48
48
|
});
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Renders an open popover and returns its panel.
|
|
52
|
+
* @param content The `UiPopoverContent` markup to render.
|
|
53
|
+
*/
|
|
54
|
+
async function renderOpen(content: string) {
|
|
55
|
+
const { findByRole } = render({
|
|
56
|
+
components: { UiPopover, UiPopoverTrigger, UiPopoverContent },
|
|
57
|
+
template: `
|
|
58
|
+
<UiPopover :open="true">
|
|
59
|
+
<UiPopoverTrigger>Open</UiPopoverTrigger>
|
|
60
|
+
${content}
|
|
61
|
+
</UiPopover>
|
|
62
|
+
`,
|
|
63
|
+
});
|
|
64
|
+
return findByRole('dialog');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
test('uses the default padding and radius without compact', async () => {
|
|
68
|
+
const panel = await renderOpen(
|
|
69
|
+
'<UiPopoverContent>Content</UiPopoverContent>',
|
|
70
|
+
);
|
|
71
|
+
expect(panel).toHaveClass('p-4', 'rounded-md');
|
|
72
|
+
expect(panel).not.toHaveClass('p-2');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('compact applies the dense padding and radius', async () => {
|
|
76
|
+
const panel = await renderOpen(
|
|
77
|
+
'<UiPopoverContent compact>Content</UiPopoverContent>',
|
|
78
|
+
);
|
|
79
|
+
expect(panel).toHaveClass('p-2', 'rounded-[14px]');
|
|
80
|
+
expect(panel).not.toHaveClass('p-4', 'rounded-md');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('compact is not forwarded to the DOM as an attribute', async () => {
|
|
84
|
+
const panel = await renderOpen(
|
|
85
|
+
'<UiPopoverContent compact>Content</UiPopoverContent>',
|
|
86
|
+
);
|
|
87
|
+
expect(panel).not.toHaveAttribute('compact');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('compact keeps the side and alignment props', async () => {
|
|
91
|
+
const panel = await renderOpen(
|
|
92
|
+
'<UiPopoverContent compact side="top" align="end">Content</UiPopoverContent>',
|
|
93
|
+
);
|
|
94
|
+
expect(panel).toHaveAttribute('data-side', 'top');
|
|
95
|
+
expect(panel).toHaveAttribute('data-align', 'end');
|
|
96
|
+
});
|
|
49
97
|
});
|
|
@@ -84,6 +84,13 @@ export interface UiPopoverContentProps {
|
|
|
84
84
|
* @default 'center'
|
|
85
85
|
*/
|
|
86
86
|
align?: UiPopoverAlign;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Tighter padding (`p-2`) and a larger radius, for dense content such as
|
|
90
|
+
* lists or menus inside the panel.
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
compact?: boolean;
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
/**
|
|
@@ -345,30 +345,6 @@ export const IconModes: Story = {
|
|
|
345
345
|
|
|
346
346
|
type ShowSnackbarStoryOptions = Parameters<typeof showSnackbar>[0];
|
|
347
347
|
|
|
348
|
-
/**
|
|
349
|
-
* Builds the docs source for an individual state story: one trigger opening a
|
|
350
|
-
* single snackbar with the given options.
|
|
351
|
-
* @param optionsSource Extra `showSnackbar` option lines after the title.
|
|
352
|
-
* @param toasterAttrs Extra attributes rendered on the `UiSnackbar` toaster.
|
|
353
|
-
*/
|
|
354
|
-
function stateTemplateSource(optionsSource = '', toasterAttrs = ''): string {
|
|
355
|
-
const optionBlock = optionsSource ? `\n ${optionsSource}` : '';
|
|
356
|
-
return `<script setup lang="ts">
|
|
357
|
-
import { UiSnackbar, showSnackbar, UiButton } from '@aleph-alpha/ui-library'
|
|
358
|
-
</script>
|
|
359
|
-
|
|
360
|
-
<template>
|
|
361
|
-
<UiButton
|
|
362
|
-
@click="showSnackbar({
|
|
363
|
-
title: 'Event has been created',${optionBlock}
|
|
364
|
-
})"
|
|
365
|
-
>
|
|
366
|
-
Show snackbar
|
|
367
|
-
</UiButton>
|
|
368
|
-
<UiSnackbar${toasterAttrs} />
|
|
369
|
-
</template>`;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
348
|
/**
|
|
373
349
|
* Render factory for the individual state stories: one trigger that opens a
|
|
374
350
|
* single snackbar with the given options. The play leaves the toast mounted
|
|
@@ -412,6 +388,22 @@ async function openStateSnackbar(canvas: ReturnType<typeof within>) {
|
|
|
412
388
|
});
|
|
413
389
|
}
|
|
414
390
|
|
|
391
|
+
const successTemplateSource = `<script setup lang="ts">
|
|
392
|
+
import { UiSnackbar, showSnackbar, UiButton } from '@aleph-alpha/ui-library'
|
|
393
|
+
</script>
|
|
394
|
+
|
|
395
|
+
<template>
|
|
396
|
+
<UiButton
|
|
397
|
+
@click="showSnackbar({
|
|
398
|
+
title: '${SNACKBAR_ACTION_TITLE}',
|
|
399
|
+
iconMode: 'success',
|
|
400
|
+
})"
|
|
401
|
+
>
|
|
402
|
+
Show snackbar
|
|
403
|
+
</UiButton>
|
|
404
|
+
<UiSnackbar />
|
|
405
|
+
</template>`;
|
|
406
|
+
|
|
415
407
|
/**
|
|
416
408
|
* Success state with its status icon, rendered mounted so visual and
|
|
417
409
|
* accessibility checks exercise it independently of the grouped `IconModes`
|
|
@@ -424,7 +416,7 @@ export const Success: Story = {
|
|
|
424
416
|
}),
|
|
425
417
|
parameters: {
|
|
426
418
|
docs: {
|
|
427
|
-
source: { code:
|
|
419
|
+
source: { code: successTemplateSource },
|
|
428
420
|
},
|
|
429
421
|
},
|
|
430
422
|
play: async ({ canvasElement, step }) => {
|
|
@@ -441,6 +433,22 @@ export const Success: Story = {
|
|
|
441
433
|
},
|
|
442
434
|
};
|
|
443
435
|
|
|
436
|
+
const warningTemplateSource = `<script setup lang="ts">
|
|
437
|
+
import { UiSnackbar, showSnackbar, UiButton } from '@aleph-alpha/ui-library'
|
|
438
|
+
</script>
|
|
439
|
+
|
|
440
|
+
<template>
|
|
441
|
+
<UiButton
|
|
442
|
+
@click="showSnackbar({
|
|
443
|
+
title: '${SNACKBAR_ACTION_TITLE}',
|
|
444
|
+
iconMode: 'warning',
|
|
445
|
+
})"
|
|
446
|
+
>
|
|
447
|
+
Show snackbar
|
|
448
|
+
</UiButton>
|
|
449
|
+
<UiSnackbar />
|
|
450
|
+
</template>`;
|
|
451
|
+
|
|
444
452
|
/**
|
|
445
453
|
* Warning state with its status icon, rendered mounted so visual and
|
|
446
454
|
* accessibility checks exercise it independently of the grouped `IconModes`
|
|
@@ -453,7 +461,7 @@ export const Warning: Story = {
|
|
|
453
461
|
}),
|
|
454
462
|
parameters: {
|
|
455
463
|
docs: {
|
|
456
|
-
source: { code:
|
|
464
|
+
source: { code: warningTemplateSource },
|
|
457
465
|
},
|
|
458
466
|
},
|
|
459
467
|
play: async ({ canvasElement, step }) => {
|
|
@@ -470,6 +478,22 @@ export const Warning: Story = {
|
|
|
470
478
|
},
|
|
471
479
|
};
|
|
472
480
|
|
|
481
|
+
const errorTemplateSource = `<script setup lang="ts">
|
|
482
|
+
import { UiSnackbar, showSnackbar, UiButton } from '@aleph-alpha/ui-library'
|
|
483
|
+
</script>
|
|
484
|
+
|
|
485
|
+
<template>
|
|
486
|
+
<UiButton
|
|
487
|
+
@click="showSnackbar({
|
|
488
|
+
title: '${SNACKBAR_ACTION_TITLE}',
|
|
489
|
+
iconMode: 'error',
|
|
490
|
+
})"
|
|
491
|
+
>
|
|
492
|
+
Show snackbar
|
|
493
|
+
</UiButton>
|
|
494
|
+
<UiSnackbar />
|
|
495
|
+
</template>`;
|
|
496
|
+
|
|
473
497
|
/**
|
|
474
498
|
* Error state with its status icon, rendered mounted so visual and
|
|
475
499
|
* accessibility checks exercise it independently of the grouped `IconModes`
|
|
@@ -483,7 +507,7 @@ export const ErrorState: Story = {
|
|
|
483
507
|
}),
|
|
484
508
|
parameters: {
|
|
485
509
|
docs: {
|
|
486
|
-
source: { code:
|
|
510
|
+
source: { code: errorTemplateSource },
|
|
487
511
|
},
|
|
488
512
|
},
|
|
489
513
|
play: async ({ canvasElement, step }) => {
|
|
@@ -500,6 +524,22 @@ export const ErrorState: Story = {
|
|
|
500
524
|
},
|
|
501
525
|
};
|
|
502
526
|
|
|
527
|
+
const loadingTemplateSource = `<script setup lang="ts">
|
|
528
|
+
import { UiSnackbar, showSnackbar, UiButton } from '@aleph-alpha/ui-library'
|
|
529
|
+
</script>
|
|
530
|
+
|
|
531
|
+
<template>
|
|
532
|
+
<UiButton
|
|
533
|
+
@click="showSnackbar({
|
|
534
|
+
title: '${SNACKBAR_ACTION_TITLE}',
|
|
535
|
+
iconMode: 'loading',
|
|
536
|
+
})"
|
|
537
|
+
>
|
|
538
|
+
Show snackbar
|
|
539
|
+
</UiButton>
|
|
540
|
+
<UiSnackbar />
|
|
541
|
+
</template>`;
|
|
542
|
+
|
|
503
543
|
/**
|
|
504
544
|
* Loading state with its spinner, rendered mounted so visual and
|
|
505
545
|
* accessibility checks exercise it independently of the grouped `IconModes`
|
|
@@ -513,7 +553,7 @@ export const Loading: Story = {
|
|
|
513
553
|
}),
|
|
514
554
|
parameters: {
|
|
515
555
|
docs: {
|
|
516
|
-
source: { code:
|
|
556
|
+
source: { code: loadingTemplateSource },
|
|
517
557
|
},
|
|
518
558
|
},
|
|
519
559
|
play: async ({ canvasElement, step }) => {
|
|
@@ -602,6 +642,24 @@ export const ActionModes: Story = {
|
|
|
602
642
|
},
|
|
603
643
|
};
|
|
604
644
|
|
|
645
|
+
const secondaryActionTemplateSource = `<script setup lang="ts">
|
|
646
|
+
import { UiSnackbar, showSnackbar, UiButton } from '@aleph-alpha/ui-library'
|
|
647
|
+
</script>
|
|
648
|
+
|
|
649
|
+
<template>
|
|
650
|
+
<UiButton
|
|
651
|
+
@click="showSnackbar({
|
|
652
|
+
title: '${SNACKBAR_ACTION_TITLE}',
|
|
653
|
+
actionLabel: '${SNACKBAR_ACTION_LABEL}',
|
|
654
|
+
actionMode: 'secondary',
|
|
655
|
+
onAction: () => {},
|
|
656
|
+
})"
|
|
657
|
+
>
|
|
658
|
+
Show snackbar
|
|
659
|
+
</UiButton>
|
|
660
|
+
<UiSnackbar />
|
|
661
|
+
</template>`;
|
|
662
|
+
|
|
605
663
|
/**
|
|
606
664
|
* Secondary action button mode, rendered mounted so visual and accessibility
|
|
607
665
|
* checks exercise it independently of the grouped `ActionModes` demo. For the
|
|
@@ -617,9 +675,7 @@ export const SecondaryAction: Story = {
|
|
|
617
675
|
parameters: {
|
|
618
676
|
docs: {
|
|
619
677
|
source: {
|
|
620
|
-
code:
|
|
621
|
-
`actionLabel: 'Undo',\n actionMode: 'secondary',\n onAction: () => {},`,
|
|
622
|
-
),
|
|
678
|
+
code: secondaryActionTemplateSource,
|
|
623
679
|
},
|
|
624
680
|
},
|
|
625
681
|
},
|
|
@@ -748,6 +804,22 @@ export const WithAction: Story = {
|
|
|
748
804
|
},
|
|
749
805
|
};
|
|
750
806
|
|
|
807
|
+
const withoutCloseButtonTemplateSource = `<script setup lang="ts">
|
|
808
|
+
import { UiSnackbar, showSnackbar, UiButton } from '@aleph-alpha/ui-library'
|
|
809
|
+
</script>
|
|
810
|
+
|
|
811
|
+
<template>
|
|
812
|
+
<UiButton
|
|
813
|
+
@click="showSnackbar({
|
|
814
|
+
title: '${SNACKBAR_ACTION_TITLE}',
|
|
815
|
+
closeButton: false,
|
|
816
|
+
})"
|
|
817
|
+
>
|
|
818
|
+
Show snackbar
|
|
819
|
+
</UiButton>
|
|
820
|
+
<UiSnackbar />
|
|
821
|
+
</template>`;
|
|
822
|
+
|
|
751
823
|
/**
|
|
752
824
|
* Snackbar without a dismiss control (`closeButton: false`), rendered mounted
|
|
753
825
|
* so visual and accessibility checks exercise it independently. Reserve this
|
|
@@ -762,7 +834,7 @@ export const WithoutCloseButton: Story = {
|
|
|
762
834
|
parameters: {
|
|
763
835
|
docs: {
|
|
764
836
|
source: {
|
|
765
|
-
code:
|
|
837
|
+
code: withoutCloseButtonTemplateSource,
|
|
766
838
|
},
|
|
767
839
|
},
|
|
768
840
|
},
|