@aleph-alpha/ui-library 2.4.0 → 2.4.2

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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "storybook": {
3
+ "versions": {
4
+ "availableVersions": ["latest", "1.17.0", "1.23.0", "2.3.0"],
5
+ "hostname": "aleph-alpha.github.io/frontend-hub/ui-library",
6
+ "regex": "\\/([^\\/]+?)\\/?$"
7
+ }
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aleph-alpha/ui-library",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/system/lib.js",
@@ -62,6 +62,7 @@
62
62
  "http-server": "14.1.1",
63
63
  "playwright": "^1.57.0",
64
64
  "postcss": "8.5.10",
65
+ "sb-addon-versions": "^1.0.12",
65
66
  "storybook": "10.2.17",
66
67
  "storybook-addon-tag-badges": "^3.1.0",
67
68
  "typescript": "^5.2.2",
@@ -119,6 +119,23 @@ describe('UiAlertDialog', () => {
119
119
  });
120
120
  });
121
121
 
122
+ test('keeps content centered during open and close animations', async () => {
123
+ const { getByRole } = renderAlertDialog({ model: true });
124
+
125
+ await waitFor(() => {
126
+ expect(getByRole('alertdialog')).toBeInTheDocument();
127
+ });
128
+
129
+ const alertDialog = getByRole('alertdialog');
130
+
131
+ expect(alertDialog).toHaveClass('data-[state=open]:slide-in-from-left-1/2');
132
+ expect(alertDialog).toHaveClass('data-[state=open]:slide-in-from-top-1/2');
133
+ expect(alertDialog).toHaveClass(
134
+ 'data-[state=closed]:slide-out-to-left-1/2',
135
+ );
136
+ expect(alertDialog).toHaveClass('data-[state=closed]:slide-out-to-top-1/2');
137
+ });
138
+
122
139
  test('closes when Cancel button is clicked', async () => {
123
140
  const user = userEvent.setup();
124
141
  const { getByRole, queryByText } = renderAlertDialog();
@@ -117,6 +117,20 @@ describe('UiDialog', () => {
117
117
  });
118
118
  });
119
119
 
120
+ test('keeps content centered during open and close animations', async () => {
121
+ const { getByRole } = renderDialog({ open: true });
122
+
123
+ await waitFor(() => {
124
+ expect(getByRole('dialog')).toBeInTheDocument();
125
+ });
126
+
127
+ const dialog = getByRole('dialog');
128
+ expect(dialog).toHaveClass('data-[state=open]:slide-in-from-left-1/2');
129
+ expect(dialog).toHaveClass('data-[state=open]:slide-in-from-top-1/2');
130
+ expect(dialog).toHaveClass('data-[state=closed]:slide-out-to-left-1/2');
131
+ expect(dialog).toHaveClass('data-[state=closed]:slide-out-to-top-1/2');
132
+ });
133
+
120
134
  test('closes when Cancel is clicked', async () => {
121
135
  const user = userEvent.setup();
122
136
  const { getByRole, queryByText } = renderDialog();
@@ -41,7 +41,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
41
41
  v-bind="{ ...forwarded, ...$attrs }"
42
42
  :class="
43
43
  cn(
44
- 'bg-background-surface-modal data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border border-border-surface-default p-6 shadow-lg duration-200',
44
+ 'bg-background-surface-modal data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 fixed top-[50%] left-[50%] z-50 grid w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border border-border-surface-default p-6 shadow-lg duration-200',
45
45
  props.maxWidth ?? 'max-w-none',
46
46
  )
47
47
  "
@@ -37,7 +37,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
37
37
  v-bind="{ ...forwarded, ...$attrs }"
38
38
  :class="
39
39
  cn(
40
- 'bg-background-surface-modal data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 flex w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] flex-col rounded-lg border border-border-surface-default p-6 shadow-lg duration-200',
40
+ 'bg-background-surface-modal data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 fixed top-[50%] left-[50%] z-50 flex w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] flex-col rounded-lg border border-border-surface-default p-6 shadow-lg duration-200',
41
41
  props.maxWidth ?? 'max-w-[50vw]',
42
42
  )
43
43
  "
@@ -40,7 +40,11 @@ const delegatedProps = reactiveOmit(props, 'tooltip');
40
40
  <slot />
41
41
  </SidebarMenuButtonChild>
42
42
 
43
- <Tooltip :disabled="state !== 'collapsed' || isMobile" :delay-duration="0">
43
+ <Tooltip
44
+ v-else
45
+ :disabled="state !== 'collapsed' || isMobile"
46
+ :delay-duration="0"
47
+ >
44
48
  <TooltipTrigger as-child>
45
49
  <SidebarMenuButtonChild v-bind="{ ...delegatedProps, ...$attrs }">
46
50
  <slot />
@@ -14,6 +14,37 @@ beforeEach(() => mockMatchMediaDesktop());
14
14
  afterEach(() => vi.restoreAllMocks());
15
15
 
16
16
  describe('UiSidebarMenuButton', () => {
17
+ test('renders only one button when tooltip is not provided', () => {
18
+ const Harness = defineComponent({
19
+ components: {
20
+ UiSidebarProvider,
21
+ UiSidebar,
22
+ UiSidebarContent,
23
+ UiSidebarMenu,
24
+ UiSidebarMenuItem,
25
+ UiSidebarMenuButton,
26
+ },
27
+ template: `
28
+ <UiSidebarProvider :default-open="true">
29
+ <UiSidebar collapsible="none">
30
+ <UiSidebarContent>
31
+ <UiSidebarMenu>
32
+ <UiSidebarMenuItem>
33
+ <UiSidebarMenuButton>
34
+ Item
35
+ </UiSidebarMenuButton>
36
+ </UiSidebarMenuItem>
37
+ </UiSidebarMenu>
38
+ </UiSidebarContent>
39
+ </UiSidebar>
40
+ </UiSidebarProvider>
41
+ `,
42
+ });
43
+ const { getAllByRole } = render(Harness);
44
+
45
+ expect(getAllByRole('button', { name: 'Item' })).toHaveLength(1);
46
+ });
47
+
17
48
  test('renders label and emits end-icon-click when endIconClickable', async () => {
18
49
  const user = userEvent.setup();
19
50
  const onEndIconClick = vi.fn();