@aleph-alpha/ui-library 5.4.0 → 5.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.d.ts +9 -0
- package/config.js +12 -3
- package/dist/system/lib.js +6461 -6397
- package/dist/system/patterns/UiFloatActions/UiFloatActionItems.vue.d.ts +173 -2
- package/dist/system/patterns/UiFloatActions/floatActionItemContext.d.ts +15 -1
- package/dist/system/patterns/UiFloatActions/types.d.ts +25 -1
- package/dist/system/story-sidebar-icons.json +5 -1
- package/package.json +5 -3
- package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +1 -0
- package/src/components/UiButton/UiButton.stories.ts +9 -9
- package/src/components/UiCheckbox/UiCheckbox.stories.ts +253 -0
- package/src/components/UiCheckbox/__tests__/UiCheckbox.test.ts +3 -18
- package/src/components/UiField/UiField.stories.ts +608 -1
- package/src/components/UiField/UiFieldDescription.vue +7 -2
- package/src/components/UiInput/UiInput.stories.ts +336 -2
- package/src/components/UiInput/__tests__/UiInput.test.ts +20 -28
- package/src/components/UiItem/UiItem.stories.ts +236 -1
- package/src/components/UiItem/__tests__/UiItem.test.ts +11 -72
- package/src/components/UiSnackbar/UiSnackbar.stories.ts +6 -6
- package/src/components/UiSnackbar/UiSnackbar.vue +4 -4
- package/src/components/UiSnackbar/UiSnackbarContent.vue +4 -4
- package/src/components/core/checkbox/Checkbox.vue +0 -1
- package/src/components/core/tabs/TabsTrigger.vue +1 -1
- package/src/patterns/UiDataTable/UiDataTable.stories.ts +495 -8
- package/src/patterns/UiDataTable/UiDataTableFilterMenu.vue +1 -1
- package/src/patterns/UiDataTable/__tests__/UiDataTable.test.ts +7 -184
- package/src/patterns/UiFloatActions/UiFloatActionItems.vue +138 -11
- package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +890 -3
- package/src/patterns/UiFloatActions/__tests__/UiFloatActionItems.test.ts +46 -24
- package/src/patterns/UiFloatActions/floatActionItemContext.ts +16 -1
- package/src/patterns/UiFloatActions/types.ts +28 -1
- package/src/components/UiField/__tests__/UiFieldError.test.ts +0 -39
- package/src/patterns/UiFloatActions/__tests__/UiFloatActions.a11y.test.ts +0 -152
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import { expect, fn, userEvent, within } from 'storybook/test';
|
|
2
3
|
import UiItem from './UiItem.vue';
|
|
3
4
|
import {
|
|
4
5
|
UiItemGroup,
|
|
@@ -87,6 +88,12 @@ export default meta;
|
|
|
87
88
|
|
|
88
89
|
type Story = StoryObj<typeof UiItem>;
|
|
89
90
|
|
|
91
|
+
// `UiItem` emits an `action` event from its built-in trailing action button.
|
|
92
|
+
// Play functions assert against this module-level spy bound via `@action`
|
|
93
|
+
// rather than through `args`. Each `play` clears it first, so it is safe to
|
|
94
|
+
// share across the interaction and keyboard test stories.
|
|
95
|
+
const onAction = fn();
|
|
96
|
+
|
|
90
97
|
const createSource = (
|
|
91
98
|
imports: string[],
|
|
92
99
|
template: string,
|
|
@@ -662,7 +669,15 @@ export const Actions: Story = {
|
|
|
662
669
|
UiIcon,
|
|
663
670
|
UiItem,
|
|
664
671
|
},
|
|
665
|
-
|
|
672
|
+
setup() {
|
|
673
|
+
return { onAction };
|
|
674
|
+
},
|
|
675
|
+
// Wire the first item's action to the spy for the play function while
|
|
676
|
+
// keeping the docs source snippet unchanged.
|
|
677
|
+
template: actionsTemplate.replace(
|
|
678
|
+
'@action="() => {}"',
|
|
679
|
+
'@action="onAction"',
|
|
680
|
+
),
|
|
666
681
|
}),
|
|
667
682
|
parameters: {
|
|
668
683
|
docs: {
|
|
@@ -671,6 +686,28 @@ export const Actions: Story = {
|
|
|
671
686
|
},
|
|
672
687
|
},
|
|
673
688
|
},
|
|
689
|
+
play: async ({ canvasElement, step }) => {
|
|
690
|
+
// Scenario (UiItem): the built-in trailing action exposes an accessible name and
|
|
691
|
+
// emits the `action` event when a pointer user activates it.
|
|
692
|
+
onAction.mockClear();
|
|
693
|
+
const canvas = within(canvasElement);
|
|
694
|
+
const [action] = canvas.getAllByRole('button', { name: 'More actions' });
|
|
695
|
+
|
|
696
|
+
await step(
|
|
697
|
+
'interaction: default action exposes an accessible name (WCAG 4.1.2)',
|
|
698
|
+
async () => {
|
|
699
|
+
await expect(action).toHaveAccessibleName('More actions');
|
|
700
|
+
},
|
|
701
|
+
);
|
|
702
|
+
|
|
703
|
+
await step(
|
|
704
|
+
'interaction: clicking the default action emits the action event',
|
|
705
|
+
async () => {
|
|
706
|
+
await userEvent.click(action);
|
|
707
|
+
await expect(onAction).toHaveBeenCalledTimes(1);
|
|
708
|
+
},
|
|
709
|
+
);
|
|
710
|
+
},
|
|
674
711
|
};
|
|
675
712
|
|
|
676
713
|
/**
|
|
@@ -803,6 +840,126 @@ export const AsLink: Story = {
|
|
|
803
840
|
},
|
|
804
841
|
},
|
|
805
842
|
},
|
|
843
|
+
play: async ({ canvasElement, step }) => {
|
|
844
|
+
// Scenario (UiItem): rendered as an anchor via `asChild`, the row exposes a link
|
|
845
|
+
// role with the child accessible name and preserves the destination,
|
|
846
|
+
// without leaking a redundant button role.
|
|
847
|
+
const canvas = within(canvasElement);
|
|
848
|
+
|
|
849
|
+
await step(
|
|
850
|
+
'interaction: asChild exposes a link role with the child accessible name (WCAG 4.1.2)',
|
|
851
|
+
async () => {
|
|
852
|
+
const link = canvas.getByRole('link', { name: /Documentation/ });
|
|
853
|
+
await expect(link).toHaveAttribute('href', '#');
|
|
854
|
+
},
|
|
855
|
+
);
|
|
856
|
+
|
|
857
|
+
await step(
|
|
858
|
+
'interaction: does not expose a redundant button role',
|
|
859
|
+
async () => {
|
|
860
|
+
await expect(canvas.queryByRole('button')).not.toBeInTheDocument();
|
|
861
|
+
},
|
|
862
|
+
);
|
|
863
|
+
},
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* The built-in trailing action is fully keyboard operable: `Tab` moves focus to
|
|
868
|
+
* it and `Enter` / `Space` activate it. Hidden test-only story.
|
|
869
|
+
*/
|
|
870
|
+
export const KeyboardNavigation: Story = {
|
|
871
|
+
name: 'test - Keyboard Navigation',
|
|
872
|
+
tags: ['!dev', '!autodocs'],
|
|
873
|
+
render: () => ({
|
|
874
|
+
components: { UiItem },
|
|
875
|
+
setup() {
|
|
876
|
+
return { onAction };
|
|
877
|
+
},
|
|
878
|
+
template: `
|
|
879
|
+
<div class="w-full max-w-md">
|
|
880
|
+
<UiItem title="Weekly report" description="Summary of this week's activity" @action="onAction" />
|
|
881
|
+
</div>
|
|
882
|
+
`,
|
|
883
|
+
}),
|
|
884
|
+
parameters: {
|
|
885
|
+
// Focus moves during the play function; skip the visual snapshot so the
|
|
886
|
+
// focus ring doesn't register as a Chromatic diff.
|
|
887
|
+
chromatic: { disableSnapshot: true },
|
|
888
|
+
docs: {
|
|
889
|
+
description: {
|
|
890
|
+
story:
|
|
891
|
+
'Press `Tab` to focus the trailing action, then `Enter` or `Space` to activate it.',
|
|
892
|
+
},
|
|
893
|
+
},
|
|
894
|
+
},
|
|
895
|
+
play: async ({ canvasElement, step }) => {
|
|
896
|
+
// Scenario (UiItem): a keyboard user tabs to the trailing action and activates it
|
|
897
|
+
// with Enter and Space.
|
|
898
|
+
onAction.mockClear();
|
|
899
|
+
const canvas = within(canvasElement);
|
|
900
|
+
const action = canvas.getByRole('button', { name: 'More actions' });
|
|
901
|
+
|
|
902
|
+
await step(
|
|
903
|
+
'keyboard: trailing action is reachable via Tab (WCAG 2.1.1)',
|
|
904
|
+
async () => {
|
|
905
|
+
await userEvent.tab();
|
|
906
|
+
await expect(action).toHaveFocus();
|
|
907
|
+
},
|
|
908
|
+
);
|
|
909
|
+
|
|
910
|
+
await step('keyboard: activates with Enter', async () => {
|
|
911
|
+
await userEvent.keyboard('{Enter}');
|
|
912
|
+
await expect(onAction).toHaveBeenCalledTimes(1);
|
|
913
|
+
});
|
|
914
|
+
|
|
915
|
+
await step('keyboard: activates with Space', async () => {
|
|
916
|
+
await userEvent.keyboard(' ');
|
|
917
|
+
await expect(onAction).toHaveBeenCalledTimes(2);
|
|
918
|
+
});
|
|
919
|
+
},
|
|
920
|
+
};
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* `withListSemantics` opts an item into `role="listitem"` so it can be a
|
|
924
|
+
* semantic child of a `role="list"` container, while omitting it keeps the item
|
|
925
|
+
* roleless. Hidden test-only story.
|
|
926
|
+
*/
|
|
927
|
+
export const ListSemantics: Story = {
|
|
928
|
+
name: 'test - List Semantics',
|
|
929
|
+
tags: ['!dev', '!autodocs'],
|
|
930
|
+
render: () => ({
|
|
931
|
+
components: { UiItem },
|
|
932
|
+
template: `
|
|
933
|
+
<div class="flex w-full max-w-md flex-col gap-3">
|
|
934
|
+
<div role="list">
|
|
935
|
+
<UiItem with-list-semantics title="List item" description="Exposes role=listitem" />
|
|
936
|
+
</div>
|
|
937
|
+
<UiItem title="Plain item" description="Stays roleless by default" />
|
|
938
|
+
</div>
|
|
939
|
+
`,
|
|
940
|
+
}),
|
|
941
|
+
parameters: {
|
|
942
|
+
docs: {
|
|
943
|
+
description: {
|
|
944
|
+
story:
|
|
945
|
+
'Only items with `withListSemantics` expose `role="listitem"`; the default item stays roleless.',
|
|
946
|
+
},
|
|
947
|
+
},
|
|
948
|
+
},
|
|
949
|
+
play: async ({ canvasElement, step }) => {
|
|
950
|
+
// Scenario (UiItem): assistive tech only sees a listitem for the item that opted in
|
|
951
|
+
// via `withListSemantics`; the default item exposes no list role.
|
|
952
|
+
const canvas = within(canvasElement);
|
|
953
|
+
|
|
954
|
+
await step(
|
|
955
|
+
'screen-reader: only the opted-in item exposes role=listitem (WCAG 1.3.1)',
|
|
956
|
+
async () => {
|
|
957
|
+
const listItems = canvas.getAllByRole('listitem');
|
|
958
|
+
await expect(listItems).toHaveLength(1);
|
|
959
|
+
await expect(listItems[0]).toHaveTextContent('List item');
|
|
960
|
+
},
|
|
961
|
+
);
|
|
962
|
+
},
|
|
806
963
|
};
|
|
807
964
|
|
|
808
965
|
/**
|
|
@@ -829,3 +986,81 @@ export const AllVariants: Story = {
|
|
|
829
986
|
},
|
|
830
987
|
},
|
|
831
988
|
};
|
|
989
|
+
|
|
990
|
+
const mobileBreakpointTemplate = `
|
|
991
|
+
<div class="w-full max-w-md">
|
|
992
|
+
<UiItem
|
|
993
|
+
title="Weekly report"
|
|
994
|
+
description="Summary of this week's activity"
|
|
995
|
+
/>
|
|
996
|
+
</div>
|
|
997
|
+
`;
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* Rendered at the mobile (320px reflow) breakpoint via the Media breakpoint
|
|
1001
|
+
* toolbar. The row and its trailing action stay operable and keyboard
|
|
1002
|
+
* navigable at 320px. Hidden test-only story.
|
|
1003
|
+
*/
|
|
1004
|
+
export const MobileBreakpoint: Story = {
|
|
1005
|
+
name: 'test - Mobile Breakpoint',
|
|
1006
|
+
tags: ['!dev', '!autodocs'],
|
|
1007
|
+
globals: { mediaBreakpoint: 'reflow' },
|
|
1008
|
+
render: () => ({
|
|
1009
|
+
components: { UiItem },
|
|
1010
|
+
setup() {
|
|
1011
|
+
return { onAction };
|
|
1012
|
+
},
|
|
1013
|
+
template: `
|
|
1014
|
+
<div class="w-full max-w-md">
|
|
1015
|
+
<UiItem title="Weekly report" description="Summary of this week's activity" @action="onAction" />
|
|
1016
|
+
</div>
|
|
1017
|
+
`,
|
|
1018
|
+
}),
|
|
1019
|
+
parameters: {
|
|
1020
|
+
// The play function focuses and activates the action; skip the snapshot.
|
|
1021
|
+
chromatic: { disableSnapshot: true },
|
|
1022
|
+
docs: {
|
|
1023
|
+
description: {
|
|
1024
|
+
story:
|
|
1025
|
+
'Switch the Media breakpoint toolbar to Mobile to preview the 320px layout.',
|
|
1026
|
+
},
|
|
1027
|
+
source: {
|
|
1028
|
+
code: createSource(['UiItem'], mobileBreakpointTemplate),
|
|
1029
|
+
},
|
|
1030
|
+
},
|
|
1031
|
+
},
|
|
1032
|
+
play: async ({ canvasElement, step }) => {
|
|
1033
|
+
// Scenario (UiItem): at the 320px mobile breakpoint the item's trailing action stays
|
|
1034
|
+
// labelled, keyboard operable, and sized for touch.
|
|
1035
|
+
onAction.mockClear();
|
|
1036
|
+
const canvas = within(canvasElement);
|
|
1037
|
+
const action = canvas.getByRole('button', { name: 'More actions' });
|
|
1038
|
+
|
|
1039
|
+
await step(
|
|
1040
|
+
'mobile: the trailing action exposes an accessible name at the 320px breakpoint (WCAG 4.1.2)',
|
|
1041
|
+
async () => {
|
|
1042
|
+
await expect(action).toBeVisible();
|
|
1043
|
+
await expect(action).toHaveAccessibleName('More actions');
|
|
1044
|
+
},
|
|
1045
|
+
);
|
|
1046
|
+
|
|
1047
|
+
await step(
|
|
1048
|
+
'mobile: stays keyboard operable — Tab focuses and Enter activates (WCAG 2.1.1)',
|
|
1049
|
+
async () => {
|
|
1050
|
+
await userEvent.tab();
|
|
1051
|
+
await expect(action).toHaveFocus();
|
|
1052
|
+
await userEvent.keyboard('{Enter}');
|
|
1053
|
+
await expect(onAction).toHaveBeenCalledTimes(1);
|
|
1054
|
+
},
|
|
1055
|
+
);
|
|
1056
|
+
|
|
1057
|
+
await step(
|
|
1058
|
+
'mobile: the action control stays visible and sized at the mobile breakpoint',
|
|
1059
|
+
async () => {
|
|
1060
|
+
const { width, height } = action.getBoundingClientRect();
|
|
1061
|
+
await expect(width).toBeGreaterThanOrEqual(16);
|
|
1062
|
+
await expect(height).toBeGreaterThanOrEqual(16);
|
|
1063
|
+
},
|
|
1064
|
+
);
|
|
1065
|
+
},
|
|
1066
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { describe, expect, test
|
|
1
|
+
import { render } from '@testing-library/vue';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
3
|
import {
|
|
4
4
|
UiItem,
|
|
5
5
|
UiItemGroup,
|
|
@@ -16,31 +16,9 @@ import { ItemActionVariants, ItemMediaVariants } from '../constants';
|
|
|
16
16
|
|
|
17
17
|
describe('UiItem', () => {
|
|
18
18
|
describe('Rendering', () => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
default: 'Item content',
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const element = container.querySelector('[data-slot="item"]');
|
|
27
|
-
expect(element?.tagName).toBe('DIV');
|
|
28
|
-
expect(element).not.toHaveAttribute('role');
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
test('applies listitem role only when list semantics are requested', () => {
|
|
32
|
-
const { container } = render(UiItem, {
|
|
33
|
-
props: {
|
|
34
|
-
withListSemantics: true,
|
|
35
|
-
},
|
|
36
|
-
slots: {
|
|
37
|
-
default: 'Item content',
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const element = container.querySelector('[data-slot="item"]');
|
|
42
|
-
expect(element).toHaveAttribute('role', 'listitem');
|
|
43
|
-
});
|
|
19
|
+
// Keyboard, focus, and a11y/role behavior (role="listitem" via
|
|
20
|
+
// withListSemantics, roleless by default) is covered by the `test - List
|
|
21
|
+
// Semantics` play story in UiItem.stories.ts.
|
|
44
22
|
|
|
45
23
|
test('renders slot content', () => {
|
|
46
24
|
const { getByText } = render(UiItem, {
|
|
@@ -303,20 +281,9 @@ describe('UiItem', () => {
|
|
|
303
281
|
expect(defaultAction.className).toContain('[&_svg]:size-3');
|
|
304
282
|
});
|
|
305
283
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
props: {
|
|
310
|
-
title: 'Item title',
|
|
311
|
-
onAction,
|
|
312
|
-
},
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
await fireEvent.click(getByRole('button', { name: 'More actions' }));
|
|
316
|
-
|
|
317
|
-
expect(onAction).toHaveBeenCalledTimes(1);
|
|
318
|
-
expect(onAction.mock.calls[0]?.[0]).toBeInstanceOf(MouseEvent);
|
|
319
|
-
});
|
|
284
|
+
// The default action's click/keyboard activation and accessible name are
|
|
285
|
+
// covered by the `Actions` and `test - Keyboard Navigation` play stories in
|
|
286
|
+
// UiItem.stories.ts.
|
|
320
287
|
|
|
321
288
|
test('does not infer hover background when action slot is present', () => {
|
|
322
289
|
const { container } = render(UiItem, {
|
|
@@ -336,37 +303,9 @@ describe('UiItem', () => {
|
|
|
336
303
|
});
|
|
337
304
|
|
|
338
305
|
describe('asChild behavior', () => {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
asChild: true,
|
|
343
|
-
},
|
|
344
|
-
slots: {
|
|
345
|
-
default: '<a href="/test">Link Item</a>',
|
|
346
|
-
},
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
const element = container.querySelector('[data-slot="item"]');
|
|
350
|
-
expect(element).toBeInTheDocument();
|
|
351
|
-
expect(element?.tagName).toBe('A');
|
|
352
|
-
expect(element).toHaveAttribute('href', '/test');
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
test('renders child element as root when asChild is true with button tag', () => {
|
|
356
|
-
const { container } = render(UiItem, {
|
|
357
|
-
props: {
|
|
358
|
-
asChild: true,
|
|
359
|
-
},
|
|
360
|
-
slots: {
|
|
361
|
-
default: '<button type="button">Button Item</button>',
|
|
362
|
-
},
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
const element = container.querySelector('[data-slot="item"]');
|
|
366
|
-
expect(element).toBeInTheDocument();
|
|
367
|
-
expect(element?.tagName).toBe('BUTTON');
|
|
368
|
-
expect(element).toHaveAttribute('type', 'button');
|
|
369
|
-
});
|
|
306
|
+
// The accessible role/name of the rendered child (link role + href) is
|
|
307
|
+
// covered by the `AsLink` play story in UiItem.stories.ts. Rendering a child
|
|
308
|
+
// button uses the same asChild passthrough, so it needs no separate test.
|
|
370
309
|
|
|
371
310
|
test('applies computed classes to child element when asChild is true', () => {
|
|
372
311
|
const { container } = render(UiItem, {
|
|
@@ -160,7 +160,7 @@ import { UiSnackbar, showSnackbar, UiButton } from '@aleph-alpha/ui-library'
|
|
|
160
160
|
</script>
|
|
161
161
|
|
|
162
162
|
<template>
|
|
163
|
-
<div class="flex flex-wrap items-center gap-
|
|
163
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
164
164
|
<UiButton @click="showSnackbar({ title: 'Event has been created', iconMode: 'success' })">
|
|
165
165
|
Success
|
|
166
166
|
</UiButton>
|
|
@@ -207,7 +207,7 @@ export const IconModes: Story = {
|
|
|
207
207
|
},
|
|
208
208
|
template: `
|
|
209
209
|
<div>
|
|
210
|
-
<div class="flex flex-wrap items-center gap-
|
|
210
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
211
211
|
<UiButton
|
|
212
212
|
v-for="mode in modes"
|
|
213
213
|
:key="mode"
|
|
@@ -232,7 +232,7 @@ import { UiSnackbar, showSnackbar, UiButton } from '@aleph-alpha/ui-library'
|
|
|
232
232
|
</script>
|
|
233
233
|
|
|
234
234
|
<template>
|
|
235
|
-
<div class="flex flex-wrap items-center gap-
|
|
235
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
236
236
|
<UiButton
|
|
237
237
|
@click="showSnackbar({
|
|
238
238
|
title: 'Event has been created',
|
|
@@ -280,7 +280,7 @@ export const ActionModes: Story = {
|
|
|
280
280
|
},
|
|
281
281
|
template: `
|
|
282
282
|
<div>
|
|
283
|
-
<div class="flex flex-wrap items-center gap-
|
|
283
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
284
284
|
<UiButton
|
|
285
285
|
v-for="mode in modes"
|
|
286
286
|
:key="mode"
|
|
@@ -378,7 +378,7 @@ function handleErrorPromise() {
|
|
|
378
378
|
</script>
|
|
379
379
|
|
|
380
380
|
<template>
|
|
381
|
-
<div class="flex flex-wrap items-center gap-
|
|
381
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
382
382
|
<UiButton @click="handleSuccessPromise">Success promise</UiButton>
|
|
383
383
|
<UiButton @click="handleErrorPromise">Error promise</UiButton>
|
|
384
384
|
</div>
|
|
@@ -437,7 +437,7 @@ export const PromiseSnackbar: Story = {
|
|
|
437
437
|
},
|
|
438
438
|
template: `
|
|
439
439
|
<div>
|
|
440
|
-
<div class="flex flex-wrap items-center gap-
|
|
440
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
441
441
|
<UiButton @click="showSuccess">Success promise</UiButton>
|
|
442
442
|
<UiButton @click="showError">Error promise</UiButton>
|
|
443
443
|
</div>
|
|
@@ -44,13 +44,13 @@ const toasterProps = computed(() => ({
|
|
|
44
44
|
display: flex;
|
|
45
45
|
flex-direction: row;
|
|
46
46
|
align-items: flex-start;
|
|
47
|
-
padding:
|
|
48
|
-
gap:
|
|
47
|
+
padding: 1rem 1rem 1rem 1.25rem;
|
|
48
|
+
gap: 0.5rem;
|
|
49
49
|
border-radius: var(--radius);
|
|
50
50
|
border: 1px solid oklch(var(--border-surface-default));
|
|
51
51
|
background: oklch(var(--background-surface-floating));
|
|
52
52
|
color: oklch(var(--content-on-surface-primary));
|
|
53
|
-
box-shadow:
|
|
53
|
+
box-shadow: 0px 4px 24px 0px #00000033;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
:global([data-sonner-toaster] [data-sonner-toast] [data-icon]:empty) {
|
|
@@ -73,7 +73,7 @@ const toasterProps = computed(() => ({
|
|
|
73
73
|
border: 1px solid oklch(var(--border-surface-default));
|
|
74
74
|
background: oklch(var(--background-surface-muted));
|
|
75
75
|
color: oklch(var(--content-on-surface-primary));
|
|
76
|
-
padding:
|
|
76
|
+
padding: 0.5rem 0.75rem;
|
|
77
77
|
font-weight: 500;
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -47,10 +47,10 @@ const showCloseButton = computed(
|
|
|
47
47
|
<div
|
|
48
48
|
:class="
|
|
49
49
|
cn(
|
|
50
|
-
'flex min-w-0 items-center gap-
|
|
50
|
+
'flex min-w-0 items-center gap-2',
|
|
51
51
|
props.embedded ? 'flex-1' : 'w-full',
|
|
52
52
|
!props.embedded &&
|
|
53
|
-
'rounded border border-border-surface-default bg-background-surface-floating p-
|
|
53
|
+
'rounded border border-border-surface-default bg-background-surface-floating p-4 pl-5 shadow-[0px_4px_24px_0px_#00000033]',
|
|
54
54
|
)
|
|
55
55
|
"
|
|
56
56
|
data-slot="snackbar-content"
|
|
@@ -64,7 +64,7 @@ const showCloseButton = computed(
|
|
|
64
64
|
<UiSnackbarIcon :mode="props.iconMode" />
|
|
65
65
|
</div>
|
|
66
66
|
|
|
67
|
-
<div class="flex min-w-0 flex-1 flex-col gap-
|
|
67
|
+
<div class="flex min-w-0 flex-1 flex-col gap-1">
|
|
68
68
|
<p
|
|
69
69
|
class="body-14-medium text-content-on-surface-primary"
|
|
70
70
|
data-slot="snackbar-title"
|
|
@@ -82,7 +82,7 @@ const showCloseButton = computed(
|
|
|
82
82
|
|
|
83
83
|
<div
|
|
84
84
|
v-if="hasAction || showCloseButton"
|
|
85
|
-
class="ml-auto flex shrink-0 items-center gap-
|
|
85
|
+
class="ml-auto flex shrink-0 items-center gap-2 self-center"
|
|
86
86
|
data-slot="snackbar-trailing-actions"
|
|
87
87
|
>
|
|
88
88
|
<div v-if="hasAction" class="shrink-0" data-slot="snackbar-action">
|
|
@@ -19,7 +19,7 @@ const forwardedProps = useForwardProps(delegatedProps);
|
|
|
19
19
|
data-slot="tabs-trigger"
|
|
20
20
|
:class="
|
|
21
21
|
cn(
|
|
22
|
-
'hover:bg-background-surface-secondary data-[state=active]:bg-background-surface-secondary ui-focus-ring text-foreground dark:text-content-on-surface-muted inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 label-14-medium whitespace-nowrap transition-[color,background-color
|
|
22
|
+
'hover:bg-background-surface-secondary data-[state=active]:bg-background-surface-secondary ui-focus-ring text-foreground dark:text-content-on-surface-muted inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 label-14-medium whitespace-nowrap transition-[color,background-color] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4',
|
|
23
23
|
props.class,
|
|
24
24
|
)
|
|
25
25
|
"
|