@aleph-alpha/ui-library 5.4.0 → 5.6.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/components/UiAutocomplete/UiAutocomplete.vue.d.ts +2 -0
- package/dist/system/components/UiButtonGroup/UiButtonGroup.vue.d.ts +20 -0
- package/dist/system/components/UiButtonGroup/index.d.ts +2 -0
- package/dist/system/components/UiButtonGroup/types.d.ts +20 -0
- package/dist/system/components/core/button-group/ButtonGroup.vue.d.ts +23 -0
- package/dist/system/components/core/button-group/ButtonGroupSeparator.vue.d.ts +9 -0
- package/dist/system/components/core/button-group/ButtonGroupText.vue.d.ts +26 -0
- package/dist/system/components/core/button-group/index.d.ts +8 -0
- package/dist/system/components/index.d.ts +1 -0
- package/dist/system/lib.js +8878 -8692
- 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 +8 -1
- package/package.json +5 -3
- package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +620 -0
- package/src/components/UiAutocomplete/UiAutocomplete.vue +28 -3
- package/src/components/UiAutocomplete/__tests__/UiAutocomplete.test.ts +14 -69
- package/src/components/UiButton/UiButton.stories.ts +9 -9
- package/src/components/UiButtonGroup/UiButtonGroup.stories.ts +690 -0
- package/src/components/UiButtonGroup/UiButtonGroup.vue +18 -0
- package/src/components/UiButtonGroup/__tests__/UiButtonGroup.test.ts +68 -0
- package/src/components/UiButtonGroup/index.ts +2 -0
- package/src/components/UiButtonGroup/types.ts +21 -0
- 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/UiSelect/UiSelect.stories.ts +769 -0
- package/src/components/UiSelect/__tests__/UiSelect.test.ts +4 -73
- package/src/components/UiSelect/__tests__/UiSelectItem.test.ts +3 -31
- package/src/components/UiSelect/__tests__/UiSelectTrigger.test.ts +14 -5
- 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/button-group/ButtonGroup.vue +24 -0
- package/src/components/core/button-group/ButtonGroupSeparator.vue +29 -0
- package/src/components/core/button-group/ButtonGroupText.vue +33 -0
- package/src/components/core/button-group/index.ts +25 -0
- package/src/components/core/checkbox/Checkbox.vue +0 -1
- package/src/components/core/select/SelectTrigger.vue +1 -1
- package/src/components/core/tabs/TabsTrigger.vue +1 -1
- package/src/components/index.ts +1 -0
- 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
|
@@ -82,79 +82,10 @@ describe('UiSelect', () => {
|
|
|
82
82
|
expect(queryByRole('listbox')).not.toBeInTheDocument();
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
await user.click(getByRole('combobox'));
|
|
90
|
-
|
|
91
|
-
await waitFor(() => {
|
|
92
|
-
expect(getByRole('listbox')).toBeInTheDocument();
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
test('renders all options when open', async () => {
|
|
97
|
-
const user = userEvent.setup();
|
|
98
|
-
const { getByRole, getAllByRole } = renderSelect({
|
|
99
|
-
items: [
|
|
100
|
-
{ value: 'a', label: 'Alpha' },
|
|
101
|
-
{ value: 'b', label: 'Beta' },
|
|
102
|
-
{ value: 'c', label: 'Gamma' },
|
|
103
|
-
],
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
await user.click(getByRole('combobox'));
|
|
107
|
-
|
|
108
|
-
await waitFor(() => {
|
|
109
|
-
const options = getAllByRole('option');
|
|
110
|
-
expect(options).toHaveLength(3);
|
|
111
|
-
expect(options[0]).toHaveTextContent('Alpha');
|
|
112
|
-
expect(options[1]).toHaveTextContent('Beta');
|
|
113
|
-
expect(options[2]).toHaveTextContent('Gamma');
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
test('selects an option when clicked', async () => {
|
|
118
|
-
const user = userEvent.setup();
|
|
119
|
-
const { getByRole } = renderSelect();
|
|
120
|
-
|
|
121
|
-
await user.click(getByRole('combobox'));
|
|
122
|
-
await waitFor(() => expect(getByRole('listbox')).toBeInTheDocument());
|
|
123
|
-
|
|
124
|
-
await user.click(getByRole('option', { name: 'Option 2' }));
|
|
125
|
-
|
|
126
|
-
await waitFor(() => {
|
|
127
|
-
expect(getByRole('combobox')).toHaveTextContent('Option 2');
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
test('closes dropdown after selection', async () => {
|
|
132
|
-
const user = userEvent.setup();
|
|
133
|
-
const { getByRole, queryByRole } = renderSelect();
|
|
134
|
-
|
|
135
|
-
await user.click(getByRole('combobox'));
|
|
136
|
-
await waitFor(() => expect(getByRole('listbox')).toBeInTheDocument());
|
|
137
|
-
|
|
138
|
-
await user.click(getByRole('option', { name: 'Option 1' }));
|
|
139
|
-
|
|
140
|
-
await waitFor(() => {
|
|
141
|
-
expect(queryByRole('listbox')).not.toBeInTheDocument();
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
test('closes dropdown when Escape is pressed', async () => {
|
|
146
|
-
const user = userEvent.setup();
|
|
147
|
-
const { getByRole, queryByRole } = renderSelect();
|
|
148
|
-
|
|
149
|
-
await user.click(getByRole('combobox'));
|
|
150
|
-
await waitFor(() => expect(getByRole('listbox')).toBeInTheDocument());
|
|
151
|
-
|
|
152
|
-
await user.keyboard('{Escape}');
|
|
153
|
-
|
|
154
|
-
await waitFor(() => {
|
|
155
|
-
expect(queryByRole('listbox')).not.toBeInTheDocument();
|
|
156
|
-
});
|
|
157
|
-
});
|
|
85
|
+
// Single-select interactions (opening the dropdown, rendering options,
|
|
86
|
+
// choosing a value, closing after selection or Escape, and focus returning
|
|
87
|
+
// to the trigger) are covered by the `test - Open Select Close` and
|
|
88
|
+
// `test - Keyboard Navigation` play functions in UiSelect.stories.ts.
|
|
158
89
|
|
|
159
90
|
test('renders with default value', async () => {
|
|
160
91
|
const { getByRole } = render({
|
|
@@ -182,35 +182,7 @@ describe('UiSelectItem', () => {
|
|
|
182
182
|
expect(end).toHaveClass('right-2');
|
|
183
183
|
});
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
components: {
|
|
189
|
-
UiSelect,
|
|
190
|
-
UiSelectTrigger,
|
|
191
|
-
UiSelectContent,
|
|
192
|
-
UiSelectItem,
|
|
193
|
-
UiSelectValue,
|
|
194
|
-
},
|
|
195
|
-
template: `
|
|
196
|
-
<UiSelect>
|
|
197
|
-
<UiSelectTrigger>
|
|
198
|
-
<UiSelectValue placeholder="Select" />
|
|
199
|
-
</UiSelectTrigger>
|
|
200
|
-
<UiSelectContent>
|
|
201
|
-
<UiSelectItem value="enabled">Enabled Option</UiSelectItem>
|
|
202
|
-
<UiSelectItem value="disabled" :disabled="true">Disabled Option</UiSelectItem>
|
|
203
|
-
</UiSelectContent>
|
|
204
|
-
</UiSelect>
|
|
205
|
-
`,
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
await user.click(getByRole('combobox'));
|
|
209
|
-
await waitFor(() => expect(getByRole('listbox')).toBeInTheDocument());
|
|
210
|
-
|
|
211
|
-
await user.click(getByRole('option', { name: 'Disabled Option' }));
|
|
212
|
-
|
|
213
|
-
// Listbox should still be open after clicking disabled item
|
|
214
|
-
expect(getByRole('listbox')).toBeInTheDocument();
|
|
215
|
-
});
|
|
185
|
+
// The disabled-option guard (a disabled item announces its state and cannot
|
|
186
|
+
// be chosen) is covered by the `test - Open Select Close` play function in
|
|
187
|
+
// UiSelect.stories.ts.
|
|
216
188
|
});
|
|
@@ -97,7 +97,9 @@ describe('UiSelectTrigger', () => {
|
|
|
97
97
|
expect(trigger).toHaveClass(
|
|
98
98
|
'focus-visible:border-border-surface-focus-ring',
|
|
99
99
|
);
|
|
100
|
-
|
|
100
|
+
// The pressed/active state no longer gets the focus-ring border; a
|
|
101
|
+
// selected value is represented by the filled surface instead.
|
|
102
|
+
expect(trigger).not.toHaveClass('active:border-border-surface-focus-ring');
|
|
101
103
|
expect(trigger).toHaveClass(
|
|
102
104
|
'data-[state=open]:border-border-surface-focus-ring',
|
|
103
105
|
);
|
|
@@ -124,7 +126,7 @@ describe('UiSelectTrigger', () => {
|
|
|
124
126
|
expect(trigger).toHaveClass(
|
|
125
127
|
'focus-visible:border-border-surface-focus-ring',
|
|
126
128
|
);
|
|
127
|
-
expect(trigger).toHaveClass('active:border-border-surface-focus-ring');
|
|
129
|
+
expect(trigger).not.toHaveClass('active:border-border-surface-focus-ring');
|
|
128
130
|
expect(trigger).toHaveClass(
|
|
129
131
|
'data-[state=open]:border-border-surface-focus-ring',
|
|
130
132
|
);
|
|
@@ -157,13 +159,18 @@ describe('UiSelectTrigger', () => {
|
|
|
157
159
|
const trigger = getByRole('combobox');
|
|
158
160
|
expect(trigger).not.toHaveAttribute('data-placeholder');
|
|
159
161
|
expect(trigger).toHaveTextContent('Option 1');
|
|
160
|
-
|
|
162
|
+
// Filled state: same input surface as the empty state — only the muted
|
|
163
|
+
// placeholder text switches to regular value text. The focus-ring
|
|
164
|
+
// border stays reserved for focus/open states.
|
|
165
|
+
expect(trigger).toHaveClass('bg-background-input-default');
|
|
166
|
+
expect(trigger).not.toHaveClass('bg-accent');
|
|
167
|
+
expect(trigger).not.toHaveClass(
|
|
161
168
|
'[&:not([data-placeholder])]:border-border-surface-focus-ring',
|
|
162
169
|
);
|
|
163
170
|
});
|
|
164
171
|
});
|
|
165
172
|
|
|
166
|
-
test('uses
|
|
173
|
+
test('uses the filled surface when multi-select has a value', async () => {
|
|
167
174
|
const { getByRole } = render({
|
|
168
175
|
components: {
|
|
169
176
|
UiSelect,
|
|
@@ -188,7 +195,9 @@ describe('UiSelectTrigger', () => {
|
|
|
188
195
|
const trigger = getByRole('combobox');
|
|
189
196
|
expect(trigger).not.toHaveAttribute('data-placeholder');
|
|
190
197
|
expect(trigger).toHaveTextContent('Option 1');
|
|
191
|
-
expect(trigger).toHaveClass(
|
|
198
|
+
expect(trigger).toHaveClass('bg-background-input-default');
|
|
199
|
+
expect(trigger).not.toHaveClass('bg-accent');
|
|
200
|
+
expect(trigger).not.toHaveClass(
|
|
192
201
|
'[&:not([data-placeholder])]:border-border-surface-focus-ring',
|
|
193
202
|
);
|
|
194
203
|
});
|
|
@@ -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">
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import type { ButtonGroupVariants } from '.';
|
|
4
|
+
import { cn } from '@/lib/utils';
|
|
5
|
+
import { buttonGroupVariants } from '.';
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
class?: HTMLAttributes['class'];
|
|
9
|
+
orientation?: ButtonGroupVariants['orientation'];
|
|
10
|
+
}>();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div
|
|
15
|
+
role="group"
|
|
16
|
+
data-slot="button-group"
|
|
17
|
+
:data-orientation="props.orientation"
|
|
18
|
+
:class="
|
|
19
|
+
cn(buttonGroupVariants({ orientation: props.orientation }), props.class)
|
|
20
|
+
"
|
|
21
|
+
>
|
|
22
|
+
<slot />
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SeparatorProps } from 'reka-ui';
|
|
3
|
+
import type { HTMLAttributes } from 'vue';
|
|
4
|
+
import { reactiveOmit } from '@vueuse/core';
|
|
5
|
+
import { cn } from '@/lib/utils';
|
|
6
|
+
import { Separator } from '@/components/core/separator';
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(
|
|
9
|
+
defineProps<SeparatorProps & { class?: HTMLAttributes['class'] }>(),
|
|
10
|
+
{
|
|
11
|
+
orientation: 'vertical',
|
|
12
|
+
},
|
|
13
|
+
);
|
|
14
|
+
const delegatedProps = reactiveOmit(props, 'class');
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<Separator
|
|
19
|
+
data-slot="button-group-separator"
|
|
20
|
+
v-bind="delegatedProps"
|
|
21
|
+
:orientation="props.orientation"
|
|
22
|
+
:class="
|
|
23
|
+
cn(
|
|
24
|
+
'bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto',
|
|
25
|
+
props.class,
|
|
26
|
+
)
|
|
27
|
+
"
|
|
28
|
+
/>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PrimitiveProps } from 'reka-ui';
|
|
3
|
+
import type { HTMLAttributes } from 'vue';
|
|
4
|
+
import type { ButtonGroupVariants } from '.';
|
|
5
|
+
import { Primitive } from 'reka-ui';
|
|
6
|
+
import { cn } from '@/lib/utils';
|
|
7
|
+
|
|
8
|
+
interface Props extends PrimitiveProps {
|
|
9
|
+
class?: HTMLAttributes['class'];
|
|
10
|
+
orientation?: ButtonGroupVariants['orientation'];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
14
|
+
as: 'div',
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<Primitive
|
|
20
|
+
role="group"
|
|
21
|
+
:data-orientation="props.orientation"
|
|
22
|
+
:as="as"
|
|
23
|
+
:as-child="asChild"
|
|
24
|
+
:class="
|
|
25
|
+
cn(
|
|
26
|
+
'bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*=\'size-\'])]:size-4',
|
|
27
|
+
props.class,
|
|
28
|
+
)
|
|
29
|
+
"
|
|
30
|
+
>
|
|
31
|
+
<slot />
|
|
32
|
+
</Primitive>
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
|
|
4
|
+
export { default as ButtonGroup } from './ButtonGroup.vue';
|
|
5
|
+
export { default as ButtonGroupSeparator } from './ButtonGroupSeparator.vue';
|
|
6
|
+
export { default as ButtonGroupText } from './ButtonGroupText.vue';
|
|
7
|
+
|
|
8
|
+
export const buttonGroupVariants = cva(
|
|
9
|
+
"flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
orientation: {
|
|
13
|
+
horizontal:
|
|
14
|
+
'[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none',
|
|
15
|
+
vertical:
|
|
16
|
+
'flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
orientation: 'horizontal',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export type ButtonGroupVariants = VariantProps<typeof buttonGroupVariants>;
|
|
@@ -27,7 +27,7 @@ const forwardedProps = useForwardProps(delegatedProps);
|
|
|
27
27
|
v-bind="forwardedProps"
|
|
28
28
|
:class="
|
|
29
29
|
cn(
|
|
30
|
-
'border-input data-[placeholder]:text-content-on-surface-muted
|
|
30
|
+
'border-input data-[placeholder]:text-content-on-surface-muted [&_svg:not([class*=\'text-\'])]:text-content-on-surface-muted focus:border-border-surface-focus-ring focus-visible:border-border-surface-focus-ring data-[state=open]:border-border-surface-focus-ring focus:ring-ring/50 focus-visible:ring-ring/50 focus:shadow-xs focus-visible:shadow-xs aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-fit items-center justify-between gap-2 rounded-md border bg-background-input-default px-3 py-2 label-14-regular whitespace-nowrap transition-[color,box-shadow] outline-none focus:ring-[3px] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([data-slot=icon]):not([class*=\'size-\'])]:size-4',
|
|
31
31
|
props.class,
|
|
32
32
|
)
|
|
33
33
|
"
|
|
@@ -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
|
"
|
package/src/components/index.ts
CHANGED