@returnless/focus-ui 0.0.4 → 0.0.6
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/package.json +3 -2
- package/src/build-utils/generate-component-meta.ts +0 -80
- package/src/build-utils/update-component-list.js +0 -31
- package/src/build-utils/update-component-list.ts +0 -32
- package/src/components/Accordion/Accordion.vue +0 -20
- package/src/components/Accordion/AccordionContent.vue +0 -43
- package/src/components/Accordion/AccordionItem.vue +0 -21
- package/src/components/Accordion/AccordionTrigger.vue +0 -38
- package/src/components/Accordion/README.md +0 -56
- package/src/components/Accordion/index.ts +0 -4
- package/src/components/ActionList/ActionList.vue +0 -9
- package/src/components/ActionList/ActionListBody.vue +0 -11
- package/src/components/ActionList/ActionListItem.vue +0 -37
- package/src/components/ActionList/ActionListSection.vue +0 -7
- package/src/components/ActionList/ActionListTrigger.vue +0 -9
- package/src/components/ActionList/README.md +0 -113
- package/src/components/ActionList/index.ts +0 -5
- package/src/components/Alert/Alert.vue +0 -68
- package/src/components/Alert/AlertDescription.vue +0 -20
- package/src/components/Alert/AlertTitle.vue +0 -11
- package/src/components/Alert/DismissableAlertButton.vue +0 -36
- package/src/components/Alert/README.md +0 -150
- package/src/components/Alert/index.ts +0 -5
- package/src/components/Alert/types.ts +0 -1
- package/src/components/AlertDialog/AlertDialog.vue +0 -54
- package/src/components/AlertDialog/AlertDialogActionButton.vue +0 -16
- package/src/components/AlertDialog/AlertDialogCancelButton.vue +0 -15
- package/src/components/AlertDialog/AlertDialogContent.vue +0 -8
- package/src/components/AlertDialog/AlertDialogDescription.vue +0 -17
- package/src/components/AlertDialog/AlertDialogFooter.vue +0 -11
- package/src/components/AlertDialog/AlertDialogHeader.vue +0 -8
- package/src/components/AlertDialog/AlertDialogTitle.vue +0 -15
- package/src/components/AlertDialog/README.md +0 -84
- package/src/components/AlertDialog/index.ts +0 -8
- package/src/components/AspectRatio/AspectRatio.vue +0 -19
- package/src/components/AspectRatio/README.md +0 -36
- package/src/components/AspectRatio/index.ts +0 -1
- package/src/components/Avatar/Avatar.vue +0 -122
- package/src/components/Avatar/README.md +0 -116
- package/src/components/Avatar/index.ts +0 -1
- package/src/components/Badge/Badge.vue +0 -51
- package/src/components/Badge/BadgeContent.vue +0 -9
- package/src/components/Badge/BadgeIcon.vue +0 -7
- package/src/components/Badge/README.md +0 -131
- package/src/components/Badge/index.ts +0 -3
- package/src/components/BarChart/BarChart.vue +0 -80
- package/src/components/BarChart/BarChartContainer.vue +0 -7
- package/src/components/BarChart/BarChartStacked.vue +0 -93
- package/src/components/BarChart/README.md +0 -83
- package/src/components/BarChart/index.ts +0 -3
- package/src/components/Breadcrumbs/Breadcrumb.vue +0 -7
- package/src/components/Breadcrumbs/BreadcrumbEllipsis.vue +0 -12
- package/src/components/Breadcrumbs/BreadcrumbItem.vue +0 -8
- package/src/components/Breadcrumbs/BreadcrumbLink.vue +0 -13
- package/src/components/Breadcrumbs/BreadcrumbList.vue +0 -8
- package/src/components/Breadcrumbs/BreadcrumbPage.vue +0 -13
- package/src/components/Breadcrumbs/BreadcrumbSeparator.vue +0 -12
- package/src/components/Breadcrumbs/README.md +0 -91
- package/src/components/Breadcrumbs/index.ts +0 -7
- package/src/components/Button/Button.vue +0 -75
- package/src/components/Button/ButtonContent.vue +0 -7
- package/src/components/Button/ButtonIcon.vue +0 -32
- package/src/components/Button/README.md +0 -231
- package/src/components/Button/index.ts +0 -5
- package/src/components/Button/types.ts +0 -30
- package/src/components/ButtonGroup/ButtonGroup.vue +0 -7
- package/src/components/ButtonGroup/README.md +0 -42
- package/src/components/ButtonGroup/index.ts +0 -1
- package/src/components/Card/Card.vue +0 -7
- package/src/components/Card/CardDescription.vue +0 -11
- package/src/components/Card/CardFooter.vue +0 -7
- package/src/components/Card/CardHeader.vue +0 -7
- package/src/components/Card/CardHelp.vue +0 -23
- package/src/components/Card/CardSection.vue +0 -22
- package/src/components/Card/CardTitle.vue +0 -11
- package/src/components/Card/README.md +0 -156
- package/src/components/Card/index.ts +0 -7
- package/src/components/Checkbox/Checkbox.vue +0 -73
- package/src/components/Checkbox/README.md +0 -111
- package/src/components/Checkbox/index.ts +0 -1
- package/src/components/Collapsible/README.md +0 -25
- package/src/components/DataTable/README.md +0 -56
- package/src/components/DatePicker/DatePicker.vue +0 -120
- package/src/components/DatePicker/DatePickerCard.vue +0 -9
- package/src/components/DatePicker/README.md +0 -59
- package/src/components/DatePicker/index.ts +0 -2
- package/src/components/DescriptionList/DescriptionList.vue +0 -18
- package/src/components/DescriptionList/DescriptionListDescription.vue +0 -8
- package/src/components/DescriptionList/DescriptionListItem.vue +0 -21
- package/src/components/DescriptionList/DescriptionListTerm.vue +0 -11
- package/src/components/DescriptionList/README.md +0 -159
- package/src/components/DescriptionList/index.ts +0 -4
- package/src/components/Dialog/README.md +0 -2
- package/src/components/Dialog/index.ts +0 -0
- package/src/components/DropZone/DropZone.vue +0 -105
- package/src/components/DropZone/README.md +0 -48
- package/src/components/DropZone/index.ts +0 -1
- package/src/components/EmptyState/EmptyState.vue +0 -13
- package/src/components/EmptyState/EmptyStateActions.vue +0 -11
- package/src/components/EmptyState/EmptyStateContent.vue +0 -7
- package/src/components/EmptyState/EmptyStateDescription.vue +0 -11
- package/src/components/EmptyState/EmptyStateTitle.vue +0 -7
- package/src/components/EmptyState/README.md +0 -102
- package/src/components/EmptyState/index.ts +0 -5
- package/src/components/Feed/Feed.vue +0 -7
- package/src/components/Feed/FeedItem.vue +0 -19
- package/src/components/Feed/FeedItemBlock.vue +0 -11
- package/src/components/Feed/FeedItemDateIndicator.vue +0 -11
- package/src/components/Feed/FeedItemIcon.vue +0 -26
- package/src/components/Feed/FeedItemSimple.vue +0 -8
- package/src/components/Feed/README.md +0 -115
- package/src/components/Feed/index.ts +0 -6
- package/src/components/FileUploadButton/FileUploadButton.vue +0 -62
- package/src/components/FileUploadButton/index.ts +0 -1
- package/src/components/Form/Form.vue +0 -35
- package/src/components/Form/README.md +0 -52
- package/src/components/Form/index.ts +0 -1
- package/src/components/FormLayout/FormLayout.vue +0 -25
- package/src/components/FormLayout/README.md +0 -97
- package/src/components/FormLayout/index.ts +0 -1
- package/src/components/Heading/Heading.vue +0 -32
- package/src/components/Heading/index.ts +0 -3
- package/src/components/Heading/types.ts +0 -3
- package/src/components/Image/Image.vue +0 -30
- package/src/components/Image/index.ts +0 -1
- package/src/components/InertiaLink/InertiaLink.vue +0 -11
- package/src/components/InertiaLink/index.ts +0 -1
- package/src/components/InlineError/InlineError.vue +0 -21
- package/src/components/InlineError/README.md +0 -63
- package/src/components/InlineError/index.ts +0 -1
- package/src/components/InputLabel/InputLabel.vue +0 -32
- package/src/components/InputLabel/index.ts +0 -1
- package/src/components/KPICard/KPICard.vue +0 -28
- package/src/components/KPICard/KPICardSection.vue +0 -30
- package/src/components/KPICard/README.md +0 -124
- package/src/components/KPICard/index.ts +0 -2
- package/src/components/Legend/Legend.vue +0 -7
- package/src/components/Legend/LegendItem.vue +0 -34
- package/src/components/Legend/README.md +0 -32
- package/src/components/Legend/index.ts +0 -2
- package/src/components/Link/Link.vue +0 -38
- package/src/components/Link/README.md +0 -119
- package/src/components/Link/index.ts +0 -1
- package/src/components/Navigation/Navigation.vue +0 -8
- package/src/components/Navigation/NavigationItem.vue +0 -47
- package/src/components/Navigation/NavigationSecondarySection.vue +0 -12
- package/src/components/Navigation/NavigationSection.vue +0 -27
- package/src/components/Navigation/README.md +0 -83
- package/src/components/Navigation/index.ts +0 -4
- package/src/components/Page/Page.vue +0 -7
- package/src/components/Page/PageBody.vue +0 -36
- package/src/components/Page/PageDescription.vue +0 -11
- package/src/components/Page/PageHeader.vue +0 -34
- package/src/components/Page/PageTitle.vue +0 -12
- package/src/components/Page/README.md +0 -226
- package/src/components/Page/index.ts +0 -5
- package/src/components/Pagination/Pagination.vue +0 -8
- package/src/components/Pagination/PaginationNextButton.vue +0 -10
- package/src/components/Pagination/PaginationPreviousButton.vue +0 -10
- package/src/components/Pagination/README.md +0 -45
- package/src/components/Pagination/index.ts +0 -3
- package/src/components/PinInput/PinInput.vue +0 -169
- package/src/components/PinInput/README.md +0 -35
- package/src/components/PinInput/index.ts +0 -1
- package/src/components/Popover/Popover.vue +0 -18
- package/src/components/Popover/PopoverBody.vue +0 -11
- package/src/components/Popover/PopoverTrigger.vue +0 -9
- package/src/components/Popover/README.md +0 -79
- package/src/components/Popover/index.ts +0 -3
- package/src/components/Popper/Popper.vue +0 -91
- package/src/components/Popper/PopperBody.vue +0 -19
- package/src/components/Popper/PopperTrigger.vue +0 -14
- package/src/components/Popper/README.md +0 -42
- package/src/components/Popper/index.ts +0 -3
- package/src/components/ProgressBar/ProgressBar.vue +0 -51
- package/src/components/ProgressBar/ProgressBarIndicator.vue +0 -7
- package/src/components/ProgressBar/README.md +0 -98
- package/src/components/ProgressBar/index.ts +0 -2
- package/src/components/RadioButton/README.md +0 -111
- package/src/components/RadioButton/RadioButton.vue +0 -49
- package/src/components/RadioButton/index.ts +0 -1
- package/src/components/ResourceList/README.md +0 -160
- package/src/components/ResourceList/ResourceList.vue +0 -7
- package/src/components/ResourceList/ResourceListItem.vue +0 -7
- package/src/components/ResourceList/ResourceListItemContent.vue +0 -7
- package/src/components/ResourceList/index.ts +0 -3
- package/src/components/Select/README.md +0 -74
- package/src/components/Select/Select.vue +0 -91
- package/src/components/Select/SelectGroup.vue +0 -12
- package/src/components/Select/SelectOption.vue +0 -12
- package/src/components/Select/index.ts +0 -3
- package/src/components/Separator/README.md +0 -39
- package/src/components/Separator/Separator.vue +0 -24
- package/src/components/Separator/index.ts +0 -1
- package/src/components/Spinner/README.md +0 -53
- package/src/components/Spinner/Spinner.vue +0 -64
- package/src/components/Spinner/index.ts +0 -1
- package/src/components/StatusIndicator/README.md +0 -51
- package/src/components/StatusIndicator/StatusIndicator.vue +0 -44
- package/src/components/StatusIndicator/index.ts +0 -1
- package/src/components/Stepper/README.md +0 -38
- package/src/components/Stepper/Stepper.vue +0 -104
- package/src/components/Stepper/index.ts +0 -1
- package/src/components/Tabs/README.md +0 -53
- package/src/components/Tabs/TabTrigger.vue +0 -44
- package/src/components/Tabs/Tabs.vue +0 -16
- package/src/components/Tabs/index.ts +0 -2
- package/src/components/Tag/README.md +0 -27
- package/src/components/Tag/Tag.vue +0 -45
- package/src/components/Tag/index.ts +0 -1
- package/src/components/TextField/README.md +0 -335
- package/src/components/TextField/TextField.vue +0 -135
- package/src/components/TextField/TextFieldIcon.vue +0 -19
- package/src/components/TextField/TextFieldPasswordIcon.vue +0 -28
- package/src/components/TextField/TextFieldSearchIcon.vue +0 -11
- package/src/components/TextField/index.ts +0 -1
- package/src/components/TextStyle/README.md +0 -39
- package/src/components/TextStyle/TextStyle.vue +0 -24
- package/src/components/TextStyle/index.ts +0 -1
- package/src/components/Toast/DismissToastAction.vue +0 -34
- package/src/components/Toast/README.md +0 -167
- package/src/components/Toast/Toast.vue +0 -39
- package/src/components/Toast/ToastGroup.vue +0 -9
- package/src/components/Toast/index.ts +0 -2
- package/src/components/Toggle/README.md +0 -66
- package/src/components/Toggle/Toggle.vue +0 -89
- package/src/components/Toggle/index.ts +0 -1
- package/src/components/Tooltip/README.md +0 -51
- package/src/components/Tooltip/Tooltip.vue +0 -24
- package/src/components/Tooltip/index.ts +0 -1
- package/src/components/TopBar/README.md +0 -43
- package/src/components/TopBar/TopBar.vue +0 -7
- package/src/components/TopBar/TopBarLogo.vue +0 -8
- package/src/components/TopBar/TopBarNavigation.vue +0 -7
- package/src/components/TopBar/TopBarNavigationItem.vue +0 -13
- package/src/components/TopBar/TopBarSearch.vue +0 -15
- package/src/components/TopBar/TopBarUserMenu.vue +0 -20
- package/src/components/TopBar/index.ts +0 -6
- package/src/components/VisuallyHidden/README.md +0 -19
- package/src/components/VisuallyHidden/VisuallyHidden.vue +0 -25
- package/src/components/VisuallyHidden/index.ts +0 -1
- package/src/components/index.ts +0 -197
- package/src/components/types.ts +0 -5
- package/src/composables/index.ts +0 -7
- package/src/composables/useTailwindColor.ts +0 -17
- package/src/composables/useTheme.ts +0 -41
- package/src/composables/useToastNotifications.ts +0 -55
- package/src/composables/useUniqueId.ts +0 -6
- package/src/index.css +0 -24
- package/src/index.ts +0 -1
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { XMarkIcon } from '@heroicons/vue/16/solid';
|
|
3
|
-
import { computed } from 'vue';
|
|
4
|
-
import { AlertVariant } from './types';
|
|
5
|
-
|
|
6
|
-
const props = withDefaults(defineProps<{
|
|
7
|
-
/** The variant of the alert. */
|
|
8
|
-
variant?: AlertVariant;
|
|
9
|
-
}>(), {
|
|
10
|
-
variant: 'default',
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
defineEmits<{
|
|
14
|
-
dismiss: [];
|
|
15
|
-
}>();
|
|
16
|
-
|
|
17
|
-
const classList = computed((): Record<string, boolean> => {
|
|
18
|
-
return {
|
|
19
|
-
'hover:bg-red-900/20': props.variant === 'destructive',
|
|
20
|
-
'hover:bg-yellow-900/20': props.variant === 'warning',
|
|
21
|
-
'hover:bg-slate-200': props.variant === 'default',
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<template>
|
|
27
|
-
<button
|
|
28
|
-
:class="classList"
|
|
29
|
-
aria-label="Dismiss notification"
|
|
30
|
-
class="absolute top-2 right-2 flex h-5 w-5 items-center justify-center rounded"
|
|
31
|
-
type="button"
|
|
32
|
-
@click="$emit('dismiss')"
|
|
33
|
-
>
|
|
34
|
-
<XMarkIcon class="h-4 w-4" />
|
|
35
|
-
</button>
|
|
36
|
-
</template>
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { Alert, AlertTitle, AlertDescription } from '../../src/components';
|
|
3
|
-
import api from '../component-meta/Alert.json';
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
# Alert
|
|
7
|
-
|
|
8
|
-
Informs users about important changes or persistent conditions. Use this component if you need to communicate to
|
|
9
|
-
users in a prominent way. Alerts are placed at the top of the page or section they apply to, and below the page or
|
|
10
|
-
section header.
|
|
11
|
-
|
|
12
|
-
<ComponentApi :api="api" />
|
|
13
|
-
|
|
14
|
-
## Variants
|
|
15
|
-
|
|
16
|
-
### Default
|
|
17
|
-
|
|
18
|
-
Use to convey general information or actions that aren't critical. For example, you might show an alert that asks
|
|
19
|
-
for users feedback. Default alerts contain lower priority information and should always be dismissable.
|
|
20
|
-
|
|
21
|
-
<ComponentWrapper>
|
|
22
|
-
<Alert>
|
|
23
|
-
<AlertTitle>Heads up!</AlertTitle>
|
|
24
|
-
<AlertDescription>
|
|
25
|
-
You can add components to your app using the cli.
|
|
26
|
-
</AlertDescription>
|
|
27
|
-
</Alert>
|
|
28
|
-
</ComponentWrapper>
|
|
29
|
-
|
|
30
|
-
```js-vue
|
|
31
|
-
<script lang="ts" setup>
|
|
32
|
-
import { Alert, AlertDescription, AlertTitle } from '@returnless/focus-ui';
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
<template>
|
|
36
|
-
<Alert>
|
|
37
|
-
<AlertTitle>Heads up!</AlertTitle>
|
|
38
|
-
<AlertDescription>
|
|
39
|
-
You can add components to your app using the cli.
|
|
40
|
-
</AlertDescription>
|
|
41
|
-
</Alert>
|
|
42
|
-
</template>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Destructive
|
|
46
|
-
|
|
47
|
-
Use to communicate critical information or actions that require immediate attention. For example, you might show an
|
|
48
|
-
alert that warns users about a critical system failure. Destructive alerts contain higher priority information.
|
|
49
|
-
|
|
50
|
-
<ComponentWrapper>
|
|
51
|
-
<Alert variant="destructive">
|
|
52
|
-
<AlertTitle>Error</AlertTitle>
|
|
53
|
-
<AlertDescription>
|
|
54
|
-
Your session has expired. Please log in again.
|
|
55
|
-
</AlertDescription>
|
|
56
|
-
</Alert>
|
|
57
|
-
</ComponentWrapper>
|
|
58
|
-
|
|
59
|
-
```js-vue
|
|
60
|
-
<script lang="ts" setup>
|
|
61
|
-
import { Alert, AlertDescription, AlertTitle } from '@returnless/focus-ui';
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<template>
|
|
65
|
-
<Alert variant="destructive">
|
|
66
|
-
<AlertTitle>Error</AlertTitle>
|
|
67
|
-
<AlertDescription>
|
|
68
|
-
Your session has expired. Please log in again.
|
|
69
|
-
</AlertDescription>
|
|
70
|
-
</Alert>
|
|
71
|
-
</template>
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Warning
|
|
75
|
-
|
|
76
|
-
Use to display information that needs attention or that user need to take action on. Seeing these banners can be
|
|
77
|
-
stressful for user so be cautious about using them.
|
|
78
|
-
|
|
79
|
-
<ComponentWrapper>
|
|
80
|
-
<Alert variant="warning">
|
|
81
|
-
<AlertTitle>Before you can purchase a shipping label, this change needs to be made:</AlertTitle>
|
|
82
|
-
<AlertDescription>
|
|
83
|
-
The name of the city you’re shipping to has characters that aren’t allowed. City name can only include spaces and hyphens.
|
|
84
|
-
</AlertDescription>
|
|
85
|
-
</Alert>
|
|
86
|
-
</ComponentWrapper>
|
|
87
|
-
|
|
88
|
-
```js-vue
|
|
89
|
-
<script lang="ts" setup>
|
|
90
|
-
import { Alert, AlertDescription, AlertTitle } from '@returnless/focus-ui';
|
|
91
|
-
</script>
|
|
92
|
-
|
|
93
|
-
<template>
|
|
94
|
-
<Alert variant="warning">
|
|
95
|
-
<AlertTitle>Before you can purchase a shipping label, this change needs to be made:</AlertTitle>
|
|
96
|
-
<AlertDescription>
|
|
97
|
-
The name of the city you’re shipping to has characters that aren’t allowed. City name can only include spaces and hyphens.
|
|
98
|
-
</AlertDescription>
|
|
99
|
-
</Alert>
|
|
100
|
-
</template>
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
## Best practices
|
|
104
|
-
|
|
105
|
-
Alerts should:
|
|
106
|
-
|
|
107
|
-
- Be used thoughtfully and sparingly for only the most important information.
|
|
108
|
-
- Not be used to call attention to what a user needs to do in the UI instead of making the action clear in the UI
|
|
109
|
-
itself.
|
|
110
|
-
- Not be the primary entry point of information or actions users need on a regular basis.
|
|
111
|
-
- Be dismissible unless they contain critical information or an important step users need to take.
|
|
112
|
-
|
|
113
|
-
### Placement
|
|
114
|
-
|
|
115
|
-
Alerts should be placed in the appropriate context:
|
|
116
|
-
|
|
117
|
-
- Alerts relevant to an entire page should be placed at the top of that page, below the page header. They should
|
|
118
|
-
occupy the full width of the content area.
|
|
119
|
-
- Alerts related to a section of a page (like a card, popover, or modal) should be placed inside that section, below
|
|
120
|
-
any section heading.
|
|
121
|
-
- Alerts related to an element more specific that a section should be placed immediately above or below that element.
|
|
122
|
-
|
|
123
|
-
## Content guidelines
|
|
124
|
-
|
|
125
|
-
Alerts should:
|
|
126
|
-
|
|
127
|
-
- Focus on a single theme, piece of information, or required action to avoid overwhelming users.
|
|
128
|
-
- Be concise and scannable - users shouldn't need to spend a lot of time figuring out what the alert is trying to
|
|
129
|
-
communicate.
|
|
130
|
-
- Be limited to a few important calls to action with no more than one primary action.
|
|
131
|
-
|
|
132
|
-
### Body content
|
|
133
|
-
|
|
134
|
-
Body content should:
|
|
135
|
-
|
|
136
|
-
- Be concise: keep the content to 1 or 2 sentences where possible.
|
|
137
|
-
- Clarify the benefit of the main task.
|
|
138
|
-
- Be written in sentence case and use appropriate punctuation.
|
|
139
|
-
- Avoid repeating the heading.
|
|
140
|
-
- Explain how to resolve the issue, particularly for destructive alerts.
|
|
141
|
-
|
|
142
|
-
## Accessibility
|
|
143
|
-
|
|
144
|
-
Alerts provide context and assist workflows for users with disabilities.
|
|
145
|
-
|
|
146
|
-
- Destructive alerts have a `role="alert"` attribute and are announced by assistive technologies when they appear.
|
|
147
|
-
- All other alerts have a `role="status"` attribute and are read after any critical announcements.
|
|
148
|
-
- Alert containers have a `tabindex="0"` attribute and display a visible keyboard focus indicator. Because of this,
|
|
149
|
-
merchants can discover banners while tabbing through forms or other interactions, and developers can programmatically
|
|
150
|
-
move focus to banners.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type AlertVariant = 'default' | 'destructive' | 'warning';
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { onMounted, onUnmounted, provide } from 'vue';
|
|
3
|
-
import { useUniqueId } from '../../composables';
|
|
4
|
-
|
|
5
|
-
withDefaults(defineProps<{
|
|
6
|
-
/** Whether the alert dialog is open. */
|
|
7
|
-
open?: boolean;
|
|
8
|
-
}>(), {
|
|
9
|
-
open: false,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const emits = defineEmits<{
|
|
13
|
-
cancel: [];
|
|
14
|
-
}>();
|
|
15
|
-
|
|
16
|
-
function cancelAlertDialog(): void {
|
|
17
|
-
emits('cancel');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function onKeyDown(e: KeyboardEvent): void {
|
|
21
|
-
if (e.key === 'Escape') {
|
|
22
|
-
cancelAlertDialog();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted((): void => {
|
|
27
|
-
document.addEventListener('keydown', onKeyDown);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
onUnmounted((): void => {
|
|
31
|
-
document.removeEventListener('keydown', onKeyDown);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const alertDialogLabelledBy = useUniqueId('alertDialogLabel');
|
|
35
|
-
const alertDialogDescribedBy = useUniqueId('alertDialogDescription');
|
|
36
|
-
|
|
37
|
-
provide('cancelAlertDialog', cancelAlertDialog);
|
|
38
|
-
provide('alertDialogLabelledBy', alertDialogLabelledBy);
|
|
39
|
-
provide('alertDialogDescribedBy', alertDialogDescribedBy);
|
|
40
|
-
</script>
|
|
41
|
-
|
|
42
|
-
<template>
|
|
43
|
-
<div
|
|
44
|
-
v-if="open"
|
|
45
|
-
:aria-describedby="alertDialogDescribedBy"
|
|
46
|
-
:aria-labelledby="alertDialogLabelledBy"
|
|
47
|
-
class="fixed top-0 left-0 z-10 h-screen w-screen bg-slate-500/50 px-2 text-sm"
|
|
48
|
-
role="alertdialog"
|
|
49
|
-
>
|
|
50
|
-
<div class="flex min-h-full items-center justify-center">
|
|
51
|
-
<slot />
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</template>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { type ButtonVariant, Button } from '../Button';
|
|
3
|
-
|
|
4
|
-
withDefaults(defineProps<{
|
|
5
|
-
/** The variant of the button. */
|
|
6
|
-
variant?: ButtonVariant;
|
|
7
|
-
}>(), {
|
|
8
|
-
variant: 'primary',
|
|
9
|
-
});
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<template>
|
|
13
|
-
<Button :variant="variant">
|
|
14
|
-
<slot />
|
|
15
|
-
</Button>
|
|
16
|
-
</template>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { Button } from '../Button';
|
|
3
|
-
import { inject } from 'vue';
|
|
4
|
-
|
|
5
|
-
const cancelAlertDialog = inject<() => void>('cancelAlertDialog');
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<template>
|
|
9
|
-
<Button
|
|
10
|
-
variant="secondary"
|
|
11
|
-
@click="cancelAlertDialog"
|
|
12
|
-
>
|
|
13
|
-
<slot />
|
|
14
|
-
</Button>
|
|
15
|
-
</template>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { TextStyle } from '../TextStyle';
|
|
3
|
-
import { inject } from 'vue';
|
|
4
|
-
|
|
5
|
-
const alertDialogDescribedBy = inject<string>('alertDialogLabelledBy')!;
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<template>
|
|
9
|
-
<p>
|
|
10
|
-
<TextStyle
|
|
11
|
-
:id="alertDialogDescribedBy"
|
|
12
|
-
variant="subdued"
|
|
13
|
-
>
|
|
14
|
-
<slot />
|
|
15
|
-
</TextStyle>
|
|
16
|
-
</p>
|
|
17
|
-
</template>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { Heading } from '../Heading';
|
|
3
|
-
import { inject } from 'vue';
|
|
4
|
-
|
|
5
|
-
const alertDialogLabelledBy = inject<string>('alertDialogLabelledBy')!;
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<template>
|
|
9
|
-
<Heading
|
|
10
|
-
:id="alertDialogLabelledBy"
|
|
11
|
-
level="h2"
|
|
12
|
-
>
|
|
13
|
-
<slot />
|
|
14
|
-
</Heading>
|
|
15
|
-
</template>
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { ref } from "vue";
|
|
3
|
-
import {
|
|
4
|
-
AlertDialog,
|
|
5
|
-
AlertDialogActionButton,
|
|
6
|
-
AlertDialogCancelButton,
|
|
7
|
-
AlertDialogContent,
|
|
8
|
-
AlertDialogDescription,
|
|
9
|
-
AlertDialogFooter,
|
|
10
|
-
AlertDialogHeader,
|
|
11
|
-
AlertDialogTitle,
|
|
12
|
-
Button,
|
|
13
|
-
} from '../../src/components';
|
|
14
|
-
import api from '../component-meta/AlertDialog.json';
|
|
15
|
-
|
|
16
|
-
const alertDialogOpen = ref(false);
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
# Alert Dialog
|
|
20
|
-
|
|
21
|
-
A modal dialog that interrupts the user with important content and expects a response.
|
|
22
|
-
|
|
23
|
-
<ComponentApi :api="api" />
|
|
24
|
-
|
|
25
|
-
## Usage
|
|
26
|
-
|
|
27
|
-
<ComponentWrapper>
|
|
28
|
-
<Button @click="alertDialogOpen = true">
|
|
29
|
-
Open Dialog
|
|
30
|
-
</Button>
|
|
31
|
-
<AlertDialog :open="alertDialogOpen" @cancel="alertDialogOpen = false">
|
|
32
|
-
<AlertDialogContent>
|
|
33
|
-
<AlertDialogHeader>
|
|
34
|
-
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
35
|
-
<AlertDialogDescription>
|
|
36
|
-
This action cannot be undone. This will permanently delete your account and remove your data from our servers.
|
|
37
|
-
</AlertDialogDescription>
|
|
38
|
-
</AlertDialogHeader>
|
|
39
|
-
<AlertDialogFooter>
|
|
40
|
-
<AlertDialogCancelButton>Cancel</AlertDialogCancelButton>
|
|
41
|
-
<AlertDialogActionButton>Continue</AlertDialogActionButton>
|
|
42
|
-
</AlertDialogFooter>
|
|
43
|
-
</AlertDialogContent>
|
|
44
|
-
</AlertDialog>
|
|
45
|
-
</ComponentWrapper>
|
|
46
|
-
|
|
47
|
-
```js-vue
|
|
48
|
-
<script lang="ts" setup>
|
|
49
|
-
import {
|
|
50
|
-
AlertDialog,
|
|
51
|
-
AlertDialogActionButton,
|
|
52
|
-
AlertDialogCancelButton,
|
|
53
|
-
AlertDialogContent,
|
|
54
|
-
AlertDialogDescription,
|
|
55
|
-
AlertDialogFooter,
|
|
56
|
-
AlertDialogHeader,
|
|
57
|
-
AlertDialogTitle,
|
|
58
|
-
Button,
|
|
59
|
-
} from '@returnless/focus-ui';
|
|
60
|
-
|
|
61
|
-
const alertDialogOpen = ref(false);
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<template>
|
|
65
|
-
<Button v-on:click="alertDialogOpen = true">
|
|
66
|
-
Open Dialog
|
|
67
|
-
</Button>
|
|
68
|
-
|
|
69
|
-
<AlertDialog :open="alertDialogOpen" v-on:cancel="alertDialogOpen = false">
|
|
70
|
-
<AlertDialogContent>
|
|
71
|
-
<AlertDialogHeader>
|
|
72
|
-
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
73
|
-
<AlertDialogDescription>
|
|
74
|
-
This action cannot be undone. This will permanently delete your account and remove your data from our servers.
|
|
75
|
-
</AlertDialogDescription>
|
|
76
|
-
</AlertDialogHeader>
|
|
77
|
-
<AlertDialogFooter>
|
|
78
|
-
<AlertDialogCancelButton>Cancel</AlertDialogCancelButton>
|
|
79
|
-
<AlertDialogActionButton>Continue</AlertDialogActionButton>
|
|
80
|
-
</AlertDialogFooter>
|
|
81
|
-
</AlertDialogContent>
|
|
82
|
-
</AlertDialog>
|
|
83
|
-
</template>
|
|
84
|
-
```
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { default as AlertDialog } from './AlertDialog.vue';
|
|
2
|
-
export { default as AlertDialogActionButton } from './AlertDialogActionButton.vue';
|
|
3
|
-
export { default as AlertDialogCancelButton } from './AlertDialogCancelButton.vue';
|
|
4
|
-
export { default as AlertDialogContent } from './AlertDialogContent.vue';
|
|
5
|
-
export { default as AlertDialogDescription } from './AlertDialogDescription.vue';
|
|
6
|
-
export { default as AlertDialogFooter } from './AlertDialogFooter.vue';
|
|
7
|
-
export { default as AlertDialogHeader } from './AlertDialogHeader.vue';
|
|
8
|
-
export { default as AlertDialogTitle } from './AlertDialogTitle.vue';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
withDefaults(defineProps<{
|
|
3
|
-
/** The aspect ratio of the element. */
|
|
4
|
-
ratio?: number;
|
|
5
|
-
}>(), {
|
|
6
|
-
ratio: 1,
|
|
7
|
-
});
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<div
|
|
12
|
-
:style="{ paddingBottom: `${100 / ratio}%` }"
|
|
13
|
-
class="relative w-full"
|
|
14
|
-
>
|
|
15
|
-
<div class="absolute inset-0 [&>*]:object-cover [&>*]:w-full [&>*]:h-full">
|
|
16
|
-
<slot />
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</template>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { AspectRatio } from '../../src/components';
|
|
3
|
-
import api from '../component-meta/AspectRatio.json';
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
# Aspect Ratio
|
|
7
|
-
|
|
8
|
-
The AspectRatio component is a layout component that enforces a fixed aspect ratio on its children. This is useful when
|
|
9
|
-
you want to ensure that a child component maintains a specific aspect ratio, regardless of the size of the parent
|
|
10
|
-
component.
|
|
11
|
-
|
|
12
|
-
<ComponentApi :api="api" />
|
|
13
|
-
|
|
14
|
-
## Usage
|
|
15
|
-
|
|
16
|
-
<ComponentWrapper>
|
|
17
|
-
<div style="width: 400px;">
|
|
18
|
-
<AspectRatio :ratio="16 / 9">
|
|
19
|
-
<img src="https://www.retourneren.nl/media/catalog/product/cache/8d4d2075b1a30681853bef5bdc41b164/r/e/returnless_afbeelding.jpg">
|
|
20
|
-
</AspectRatio>
|
|
21
|
-
</div>
|
|
22
|
-
</ComponentWrapper>
|
|
23
|
-
|
|
24
|
-
```js-vue
|
|
25
|
-
<script lang="ts" setup>
|
|
26
|
-
import { AspectRatio } from '@returnless/focus-ui';
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<template>
|
|
30
|
-
<div style="width: 400px;">
|
|
31
|
-
<AspectRatio :ratio="16 / 9">
|
|
32
|
-
<img src="https://www.retourneren.nl/media/catalog/product/cache/8d4d2075b1a30681853bef5bdc41b164/r/e/returnless_afbeelding.jpg">
|
|
33
|
-
</AspectRatio>
|
|
34
|
-
</div>
|
|
35
|
-
</template>
|
|
36
|
-
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as AspectRatio } from './AspectRatio.vue';
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { UserIcon } from '@heroicons/vue/16/solid';
|
|
3
|
-
import { computed, ref } from 'vue';
|
|
4
|
-
import { AspectRatio } from '../AspectRatio';
|
|
5
|
-
import { Image } from '../Image';
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(defineProps<{
|
|
8
|
-
/** The size of the avatar */
|
|
9
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
10
|
-
|
|
11
|
-
/** The name of the person, company or entity */
|
|
12
|
-
name?: string | undefined;
|
|
13
|
-
|
|
14
|
-
/** Initials of person to display. */
|
|
15
|
-
initials?: string | null;
|
|
16
|
-
|
|
17
|
-
/** URL of the avatar image which falls back to initials if the image fails to load. */
|
|
18
|
-
source?: string | undefined;
|
|
19
|
-
|
|
20
|
-
/** Accessible label for the avatar image. */
|
|
21
|
-
accessibilityLabel?: string | null;
|
|
22
|
-
}>(), {
|
|
23
|
-
size: 'md',
|
|
24
|
-
name: undefined,
|
|
25
|
-
initials: null,
|
|
26
|
-
source: undefined,
|
|
27
|
-
accessibilityLabel: null,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
enum ImageLoadingState {
|
|
31
|
-
Pending = 'PENDING',
|
|
32
|
-
Loaded = 'LOADED',
|
|
33
|
-
Errored = 'ERRORED',
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const imageLoadingState = ref<ImageLoadingState>(ImageLoadingState.Pending);
|
|
37
|
-
|
|
38
|
-
const classList = computed((): Record<string, boolean>[] => {
|
|
39
|
-
return [
|
|
40
|
-
{ 'w-4 h-4': props.size === 'xs' },
|
|
41
|
-
{ 'w-6 h-6': props.size === 'sm' },
|
|
42
|
-
{ 'w-8 h-8': props.size === 'md' },
|
|
43
|
-
{ 'w-10 h-10': props.size === 'lg' },
|
|
44
|
-
{ 'w-12 h-12': props.size === 'xl' },
|
|
45
|
-
|
|
46
|
-
{ 'bg-slate-200': imageLoadingState.value !== ImageLoadingState.Loaded },
|
|
47
|
-
];
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const iconSize = computed((): Record<string, boolean>[] => {
|
|
51
|
-
return [
|
|
52
|
-
{ 'w-3 h-3': props.size === 'xs' },
|
|
53
|
-
];
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const textSize = computed((): Record<string, boolean>[] => {
|
|
57
|
-
return [
|
|
58
|
-
{ 'text-xs': props.size === 'xs' },
|
|
59
|
-
{ 'text-xs': props.size === 'sm' },
|
|
60
|
-
{ 'text-md': props.size === 'md' },
|
|
61
|
-
{ 'text-lg': props.size === 'lg' },
|
|
62
|
-
{ 'text-lg': props.size === 'xl' },
|
|
63
|
-
];
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
function renderInitials(initials: string): string {
|
|
67
|
-
return props.size === 'xs'
|
|
68
|
-
? initials?.slice(0, 1)
|
|
69
|
-
: initials;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function handleImageError(): void {
|
|
73
|
-
imageLoadingState.value = ImageLoadingState.Errored;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function handleImageLoad(): void {
|
|
77
|
-
imageLoadingState.value = ImageLoadingState.Loaded;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const accessibilityLabelValue = computed((): string | undefined => {
|
|
81
|
-
const accessibilityLabel = props.accessibilityLabel || props.name;
|
|
82
|
-
|
|
83
|
-
return accessibilityLabel
|
|
84
|
-
? accessibilityLabel
|
|
85
|
-
: undefined;
|
|
86
|
-
});
|
|
87
|
-
</script>
|
|
88
|
-
|
|
89
|
-
<template>
|
|
90
|
-
<span
|
|
91
|
-
:aria-label="accessibilityLabelValue"
|
|
92
|
-
:class="classList"
|
|
93
|
-
class="relative flex items-center justify-center overflow-hidden rounded"
|
|
94
|
-
>
|
|
95
|
-
<UserIcon
|
|
96
|
-
v-if="!initials"
|
|
97
|
-
:class="iconSize"
|
|
98
|
-
role="img"
|
|
99
|
-
/>
|
|
100
|
-
<span
|
|
101
|
-
v-if="source"
|
|
102
|
-
class="absolute h-full w-full"
|
|
103
|
-
>
|
|
104
|
-
<AspectRatio>
|
|
105
|
-
<Image
|
|
106
|
-
:alt="name!"
|
|
107
|
-
:class="{ 'hidden': imageLoadingState !== ImageLoadingState.Loaded}"
|
|
108
|
-
:source="source"
|
|
109
|
-
@error="handleImageError"
|
|
110
|
-
@load="handleImageLoad"
|
|
111
|
-
/>
|
|
112
|
-
</AspectRatio>
|
|
113
|
-
</span>
|
|
114
|
-
<span
|
|
115
|
-
v-if="initials && imageLoadingState !== ImageLoadingState.Loaded"
|
|
116
|
-
:class="textSize"
|
|
117
|
-
class="font-semibold"
|
|
118
|
-
>
|
|
119
|
-
{{ renderInitials(initials) }}
|
|
120
|
-
</span>
|
|
121
|
-
</span>
|
|
122
|
-
</template>
|