@returnless/focus-ui 0.0.5 → 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 +2 -3
- 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
- package/src/vite-env.d.ts +0 -1
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { Avatar } from '../../src/components';
|
|
3
|
-
import api from '../component-meta/Avatar.json';
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
# Avatar
|
|
7
|
-
|
|
8
|
-
Avatars are used to show a thumbnail representation of an individual or business in the interface.
|
|
9
|
-
|
|
10
|
-
<ComponentApi :api="api" />
|
|
11
|
-
|
|
12
|
-
## Usage
|
|
13
|
-
|
|
14
|
-
<ComponentWrapper>
|
|
15
|
-
<Avatar name="John Doe" />
|
|
16
|
-
</ComponentWrapper>
|
|
17
|
-
|
|
18
|
-
```js-vue
|
|
19
|
-
<script lang="ts" setup>
|
|
20
|
-
import { Avatar } from '@returnless/focus-ui';
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<template>
|
|
24
|
-
<Avatar name="John Doe" />
|
|
25
|
-
</template>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Variants
|
|
29
|
-
|
|
30
|
-
### With initials
|
|
31
|
-
|
|
32
|
-
<ComponentWrapper>
|
|
33
|
-
<Avatar name="John Doe" initials="JD" />
|
|
34
|
-
</ComponentWrapper>
|
|
35
|
-
|
|
36
|
-
```js-vue
|
|
37
|
-
<script lang="ts" setup>
|
|
38
|
-
import { Avatar } from '@returnless/focus-ui';
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<template>
|
|
42
|
-
<Avatar name="John Doe" initials="JD" />
|
|
43
|
-
</template>
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Sizes
|
|
47
|
-
|
|
48
|
-
<ComponentWrapper>
|
|
49
|
-
<ComponentGrid>
|
|
50
|
-
<ComponentGrid>
|
|
51
|
-
<Avatar name="John Doe" size="xs" />
|
|
52
|
-
<Avatar name="John Doe" size="sm" />
|
|
53
|
-
<Avatar name="John Doe" size="md" />
|
|
54
|
-
<Avatar name="John Doe" size="lg" />
|
|
55
|
-
<Avatar name="John Doe" size="xl" />
|
|
56
|
-
</ComponentGrid>
|
|
57
|
-
<ComponentGrid>
|
|
58
|
-
<Avatar name="John Doe" size="xs" initials="JD" />
|
|
59
|
-
<Avatar name="John Doe" size="sm" initials="JD" />
|
|
60
|
-
<Avatar name="John Doe" size="md" initials="JD" />
|
|
61
|
-
<Avatar name="John Doe" size="lg" initials="JD" />
|
|
62
|
-
<Avatar name="John Doe" size="xl" initials="JD" />
|
|
63
|
-
</ComponentGrid>
|
|
64
|
-
</ComponentGrid>
|
|
65
|
-
</ComponentWrapper>
|
|
66
|
-
|
|
67
|
-
```js-vue
|
|
68
|
-
<script lang="ts" setup>
|
|
69
|
-
import { Avatar } from '@returnless/focus-ui';
|
|
70
|
-
</script>
|
|
71
|
-
|
|
72
|
-
<template>
|
|
73
|
-
<Avatar name="John Doe" size="xs" />
|
|
74
|
-
<Avatar name="John Doe" size="sm" />
|
|
75
|
-
<Avatar name="John Doe" size="md" />
|
|
76
|
-
<Avatar name="John Doe" size="lg" />
|
|
77
|
-
<Avatar name="John Doe" size="xl" />
|
|
78
|
-
|
|
79
|
-
// Or with initials...
|
|
80
|
-
<Avatar name="John Doe" size="xs" initials="JD" />
|
|
81
|
-
<Avatar name="John Doe" size="sm" initials="JD" />
|
|
82
|
-
<Avatar name="John Doe" size="md" initials="JD" />
|
|
83
|
-
<Avatar name="John Doe" size="lg" initials="JD" />
|
|
84
|
-
<Avatar name="John Doe" size="xl" initials="JD" />
|
|
85
|
-
</template>
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## Best practices
|
|
89
|
-
|
|
90
|
-
Avatars should be one of 5 sizes:
|
|
91
|
-
|
|
92
|
-
- Extra-small (20 x 20 px): use in tightly condensed layouts
|
|
93
|
-
- Small (24 × 24 px): use when the medium size is too big for the layout, or when the avatar has less importance
|
|
94
|
-
- Medium (28 × 28 px): use as the default size
|
|
95
|
-
- Large (32 × 32 px): use when an avatar is a focal point, such as on a single customer card
|
|
96
|
-
- Extra large (40 × 40 px): use when an avatar is a focal point, such as on a single customer card
|
|
97
|
-
|
|
98
|
-
## Content guidelines
|
|
99
|
-
|
|
100
|
-
Any time you use an image to communicate a concept in the interface, it's important to use descriptive alt text.
|
|
101
|
-
Doing this is important for accessibility because it allows screen readers to describe what's in the image to people
|
|
102
|
-
who may not be able to see it.
|
|
103
|
-
|
|
104
|
-
For avatars, we recommend using a format that describes what will show in the image:
|
|
105
|
-
|
|
106
|
-
- `alt=Person's name"` if the avatar represents a person
|
|
107
|
-
- `alt=Company name"` if the avatar represents a business
|
|
108
|
-
- `alt=""` if the name of the person/business appears next to the avatar as text
|
|
109
|
-
|
|
110
|
-
## Accessibility
|
|
111
|
-
|
|
112
|
-
### Labeling
|
|
113
|
-
|
|
114
|
-
The avatar component represents content, and should have a text equivalent for users using assistive technologies.
|
|
115
|
-
By default, the value of the `name` prop is used for the alternative text. If different text would be more accurate,
|
|
116
|
-
use the `accessibilityLabel` prop to replace the value provided by `name`.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Avatar } from './Avatar.vue';
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed, CSSProperties } from 'vue';
|
|
3
|
-
import { VisuallyHidden } from '../VisuallyHidden';
|
|
4
|
-
import { TextStyle } from '../TextStyle';
|
|
5
|
-
import { TailwindColor, useTailwindColor } from '../../composables';
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(defineProps<{
|
|
8
|
-
/** Accessible label for the avatar image. */
|
|
9
|
-
accessibilityLabel?: string | null;
|
|
10
|
-
|
|
11
|
-
/** The color of the badge. */
|
|
12
|
-
color: TailwindColor;
|
|
13
|
-
|
|
14
|
-
/** The size of the badge */
|
|
15
|
-
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
16
|
-
}>(), {
|
|
17
|
-
accessibilityLabel: null,
|
|
18
|
-
size: 'sm',
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const colorValues = computed((): CSSProperties => {
|
|
22
|
-
return {
|
|
23
|
-
backgroundColor: useTailwindColor(props.color, '200'),
|
|
24
|
-
color: useTailwindColor(props.color, '900'),
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const classList = computed((): Record<string, any> => {
|
|
29
|
-
return [
|
|
30
|
-
{ 'text-xs px-2 py-1': props.size === 'sm' },
|
|
31
|
-
{ 'text-sm px-3 py-1.5': props.size === 'md' },
|
|
32
|
-
{ 'text-md px-4 py-2': props.size === 'lg' },
|
|
33
|
-
];
|
|
34
|
-
});
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<template>
|
|
38
|
-
<span
|
|
39
|
-
class="inline-flex rounded bg-slate-200"
|
|
40
|
-
:class="classList"
|
|
41
|
-
:style="colorValues"
|
|
42
|
-
>
|
|
43
|
-
<TextStyle variant="strong">
|
|
44
|
-
<div class="flex items-center space-x-2">
|
|
45
|
-
<slot />
|
|
46
|
-
</div>
|
|
47
|
-
</TextStyle>
|
|
48
|
-
|
|
49
|
-
<VisuallyHidden v-if="accessibilityLabel">{{ accessibilityLabel }}</VisuallyHidden>
|
|
50
|
-
</span>
|
|
51
|
-
</template>
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { Badge, BadgeContent, BadgeIcon } from '../../src/components';
|
|
3
|
-
import { ArrowTrendingUpIcon, ArrowTrendingDownIcon } from '@heroicons/vue/16/solid';
|
|
4
|
-
import api from '../component-meta/Badge.json';
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
# Badge
|
|
8
|
-
|
|
9
|
-
Badges are used to inform users of the tone of an object or of an action that's been taken.
|
|
10
|
-
|
|
11
|
-
<ComponentApi :api="api" />
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
<ComponentWrapper>
|
|
16
|
-
<ComponentGrid>
|
|
17
|
-
<Badge color="slate">Fulfilled</Badge>
|
|
18
|
-
<Badge color="blue">Draft</Badge>
|
|
19
|
-
<Badge color="green">Active</Badge>
|
|
20
|
-
<Badge color="yellow">Open</Badge>
|
|
21
|
-
<Badge color="red">Action required</Badge>
|
|
22
|
-
</ComponentGrid>
|
|
23
|
-
</ComponentWrapper>
|
|
24
|
-
|
|
25
|
-
```js-vue
|
|
26
|
-
<script lang="ts" setup>
|
|
27
|
-
import { Badge } from '@returnless/focus-ui';
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<template>
|
|
31
|
-
<Badge color="slate">Fulfilled</Badge>
|
|
32
|
-
<Badge color="blue">Draft</Badge>
|
|
33
|
-
<Badge color="green">Active</Badge>
|
|
34
|
-
<Badge color="yellow">Open</Badge>
|
|
35
|
-
<Badge color="red">Action required</Badge>
|
|
36
|
-
</template>
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Badges with icons
|
|
40
|
-
|
|
41
|
-
Badges can include icons to help users quickly identify the tone of an object or action.
|
|
42
|
-
|
|
43
|
-
<ComponentWrapper>
|
|
44
|
-
<ComponentGrid>
|
|
45
|
-
<Badge color="green">
|
|
46
|
-
<BadgeContent>+ 25%</BadgeContent>
|
|
47
|
-
<BadgeIcon>
|
|
48
|
-
<ArrowTrendingUpIcon />
|
|
49
|
-
</BadgeIcon>
|
|
50
|
-
</Badge>
|
|
51
|
-
<Badge color="red">
|
|
52
|
-
<BadgeIcon>
|
|
53
|
-
<ArrowTrendingDownIcon />
|
|
54
|
-
</BadgeIcon>
|
|
55
|
-
<BadgeContent>- 25%</BadgeContent>
|
|
56
|
-
</Badge>
|
|
57
|
-
</ComponentGrid>
|
|
58
|
-
</ComponentWrapper>
|
|
59
|
-
|
|
60
|
-
```js-vue
|
|
61
|
-
<script lang="ts" setup>
|
|
62
|
-
import { Badge, BadgeContent, BadgeIcon } from '@returnless/focus-ui';
|
|
63
|
-
import { ArrowTrendingUpIcon, ArrowTrendingDownIcon } from '@heroicons/vue/16/solid';
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
<template>
|
|
67
|
-
<Badge color="green">
|
|
68
|
-
<BadgeContent>+ 25%</BadgeContent>
|
|
69
|
-
<BadgeIcon>
|
|
70
|
-
<ArrowTrendingUpIcon />
|
|
71
|
-
</BadgeIcon>
|
|
72
|
-
</Badge>
|
|
73
|
-
<Badge color="red">
|
|
74
|
-
<BadgeIcon>
|
|
75
|
-
<ArrowTrendingDownIcon />
|
|
76
|
-
</BadgeIcon>
|
|
77
|
-
<BadgeContent>- 25%</BadgeContent>
|
|
78
|
-
</Badge>
|
|
79
|
-
</template>
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Badge sizes
|
|
83
|
-
|
|
84
|
-
Badges come in three sizes: small, medium, and large.
|
|
85
|
-
|
|
86
|
-
<ComponentWrapper>
|
|
87
|
-
<ComponentGrid>
|
|
88
|
-
<Badge color="slate" size="sm">sm badge</Badge>
|
|
89
|
-
<Badge color="slate" size="md">md badge</Badge>
|
|
90
|
-
<Badge color="slate" size="lg">lg badge</Badge>
|
|
91
|
-
<Badge color="green">
|
|
92
|
-
<BadgeIcon>
|
|
93
|
-
<ArrowTrendingUpIcon />
|
|
94
|
-
</BadgeIcon>
|
|
95
|
-
<BadgeContent>sm with icon</BadgeContent>
|
|
96
|
-
</Badge>
|
|
97
|
-
<Badge color="blue" size="md">
|
|
98
|
-
<BadgeIcon>
|
|
99
|
-
<ArrowTrendingUpIcon />
|
|
100
|
-
</BadgeIcon>
|
|
101
|
-
<BadgeContent>md with icon</BadgeContent>
|
|
102
|
-
</Badge>
|
|
103
|
-
<Badge color="red" size="lg">
|
|
104
|
-
<BadgeIcon>
|
|
105
|
-
<ArrowTrendingDownIcon />
|
|
106
|
-
</BadgeIcon>
|
|
107
|
-
<BadgeContent>lg with icon</BadgeContent>
|
|
108
|
-
</Badge>
|
|
109
|
-
</ComponentGrid>
|
|
110
|
-
</ComponentWrapper>
|
|
111
|
-
|
|
112
|
-
## Best practices
|
|
113
|
-
|
|
114
|
-
Badges benefit users by:
|
|
115
|
-
|
|
116
|
-
- Using established color patterns so that users can quickly identify their tone or importance level.
|
|
117
|
-
- Being clearly labeled with short, scannable text.
|
|
118
|
-
- Being positioned to clearly identify the object they're informing or labelling.
|
|
119
|
-
|
|
120
|
-
## Content guidelines
|
|
121
|
-
|
|
122
|
-
Badge labels should:
|
|
123
|
-
|
|
124
|
-
- Use a single word to describe the tone of an object.
|
|
125
|
-
- Only use two words if you need to describe a complex state. For example "Partially refunded" and "Partially paid".
|
|
126
|
-
- Always describe the tone in the past tense. For example, refunded not refund.
|
|
127
|
-
|
|
128
|
-
## Accessibility
|
|
129
|
-
|
|
130
|
-
Badges that convey information with icons or color include text provided by the `visually hidden component`. The text is
|
|
131
|
-
read out by assistive technologies so that users with vision issues can access meaning of the badge in context.
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import collect, { Collection } from 'collect.js';
|
|
3
|
-
import { computed } from 'vue';
|
|
4
|
-
import { TailwindColor, useTailwindColor } from '../../composables';
|
|
5
|
-
import { BarChartContainer } from './';
|
|
6
|
-
import { Legend, LegendItem } from '../Legend';
|
|
7
|
-
|
|
8
|
-
type DataPoint = {
|
|
9
|
-
label: string;
|
|
10
|
-
value: number;
|
|
11
|
-
color: TailwindColor;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const props = defineProps<{
|
|
15
|
-
/** The data points to display */
|
|
16
|
-
dataPoints: DataPoint[];
|
|
17
|
-
|
|
18
|
-
/** The height of the chart */
|
|
19
|
-
height: number;
|
|
20
|
-
}>();
|
|
21
|
-
|
|
22
|
-
const dataPointCollection = computed((): Collection<DataPoint> => {
|
|
23
|
-
return collect(props.dataPoints);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const max = computed((): number => {
|
|
27
|
-
return dataPointCollection.value.max('value');
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
function dataPointHeight(dataPoint: DataPoint): number {
|
|
31
|
-
return dataPoint.value / max.value * 100;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function getColorValue(dataPoint: DataPoint): string {
|
|
35
|
-
return useTailwindColor(dataPoint.color, '400');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const axisLabels = computed(() => {
|
|
39
|
-
return [
|
|
40
|
-
props.dataPoints[0].label,
|
|
41
|
-
props.dataPoints[props.dataPoints.length - 1].label,
|
|
42
|
-
];
|
|
43
|
-
});
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<template>
|
|
47
|
-
<BarChartContainer>
|
|
48
|
-
<Legend>
|
|
49
|
-
<LegendItem color="blue">
|
|
50
|
-
En-route
|
|
51
|
-
</LegendItem>
|
|
52
|
-
</Legend>
|
|
53
|
-
|
|
54
|
-
<div class="space-y-2">
|
|
55
|
-
<div
|
|
56
|
-
class="flex space-x-1"
|
|
57
|
-
:style="{ height: `${height}px` }"
|
|
58
|
-
>
|
|
59
|
-
<div
|
|
60
|
-
v-for="(dataPoint, dataPointIndex) in dataPoints"
|
|
61
|
-
:key="dataPointIndex"
|
|
62
|
-
:style="{ width: `${100 / dataPoints.length}%` }"
|
|
63
|
-
class="flex h-full items-end rounded-sm bg-slate-100"
|
|
64
|
-
>
|
|
65
|
-
<div
|
|
66
|
-
class="w-full rounded-sm"
|
|
67
|
-
:style="{
|
|
68
|
-
height: `${dataPointHeight(dataPoint)}%`,
|
|
69
|
-
backgroundColor: getColorValue(dataPoint),
|
|
70
|
-
}"
|
|
71
|
-
/>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
<div class="flex justify-between">
|
|
75
|
-
<div>{{ axisLabels[0] }}</div>
|
|
76
|
-
<div>{{ axisLabels[1] }}</div>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
</BarChartContainer>
|
|
80
|
-
</template>
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import collect from 'collect.js';
|
|
3
|
-
import { computed } from 'vue';
|
|
4
|
-
import { TailwindColor, useTailwindColor } from '../../composables';
|
|
5
|
-
import { Legend, LegendItem } from '../Legend';
|
|
6
|
-
import { BarChartContainer } from './index';
|
|
7
|
-
|
|
8
|
-
type DataPointStack = {
|
|
9
|
-
label: string;
|
|
10
|
-
dataPoints: DataPoint[];
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
type DataPoint = {
|
|
14
|
-
label: string;
|
|
15
|
-
value: number;
|
|
16
|
-
color: TailwindColor;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const props = defineProps<{
|
|
20
|
-
dataPoints: DataPointStack[];
|
|
21
|
-
height: number;
|
|
22
|
-
}>();
|
|
23
|
-
|
|
24
|
-
const max = computed((): number => {
|
|
25
|
-
return collect(props.dataPoints)
|
|
26
|
-
.map((dataPointStack: DataPointStack) => collect(dataPointStack.dataPoints).sum('value'))
|
|
27
|
-
.max();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
function getDataPointHeight(dataPoint: DataPoint): number {
|
|
31
|
-
return dataPoint.value / max.value * 100;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function getColorValue(dataPoint: DataPoint): string {
|
|
35
|
-
return useTailwindColor(dataPoint.color, '400');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const axisLabels = computed((): string[] => {
|
|
39
|
-
return [
|
|
40
|
-
props.dataPoints[0].label,
|
|
41
|
-
props.dataPoints[props.dataPoints.length - 1].label,
|
|
42
|
-
];
|
|
43
|
-
});
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<template>
|
|
47
|
-
<BarChartContainer>
|
|
48
|
-
<Legend>
|
|
49
|
-
<LegendItem color="teal">
|
|
50
|
-
Announced
|
|
51
|
-
</LegendItem>
|
|
52
|
-
<LegendItem color="green">
|
|
53
|
-
Sent
|
|
54
|
-
</LegendItem>
|
|
55
|
-
<LegendItem color="lime">
|
|
56
|
-
En-route
|
|
57
|
-
</LegendItem>
|
|
58
|
-
<LegendItem color="yellow">
|
|
59
|
-
Delivered
|
|
60
|
-
</LegendItem>
|
|
61
|
-
<LegendItem color="amber">
|
|
62
|
-
En-route
|
|
63
|
-
</LegendItem>
|
|
64
|
-
</Legend>
|
|
65
|
-
<div class="space-y-2">
|
|
66
|
-
<div
|
|
67
|
-
class="flex space-x-1"
|
|
68
|
-
:style="{ height: `${height}px` }"
|
|
69
|
-
>
|
|
70
|
-
<div
|
|
71
|
-
v-for="(dataStack, dataStackIndex) in dataPoints"
|
|
72
|
-
:key="dataStackIndex"
|
|
73
|
-
:style="{ width: `${100 / dataPoints.length}%` }"
|
|
74
|
-
class="flex flex-col-reverse h-full items-end rounded-sm bg-slate-100 overflow-hidden"
|
|
75
|
-
>
|
|
76
|
-
<div
|
|
77
|
-
v-for="(dataPoint, dataPointIndex) in dataStack.dataPoints"
|
|
78
|
-
:key="dataPointIndex"
|
|
79
|
-
class="w-full"
|
|
80
|
-
:style="{
|
|
81
|
-
height: `${getDataPointHeight(dataPoint)}%`,
|
|
82
|
-
backgroundColor: getColorValue(dataPoint),
|
|
83
|
-
}"
|
|
84
|
-
/>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
<div class="flex justify-between">
|
|
88
|
-
<div>{{ axisLabels[0] }}</div>
|
|
89
|
-
<div>{{ axisLabels[1] }}</div>
|
|
90
|
-
</div>
|
|
91
|
-
</div>
|
|
92
|
-
</BarChartContainer>
|
|
93
|
-
</template>
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { BarChart, BarChartStacked, Card, CardSection, Legend, LegendItem } from '../../src/components';
|
|
3
|
-
import api from '../component-meta/BarChart.json';
|
|
4
|
-
|
|
5
|
-
const dataPoints = Array.from({ length: 30 }).map((_, index) => {
|
|
6
|
-
return {
|
|
7
|
-
value: Math.floor(Math.random() * 200),
|
|
8
|
-
label: `data-point ${index}`,
|
|
9
|
-
color: 'blue',
|
|
10
|
-
};
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const stackedDataPoints = Array.from({ length: 30 }).map((_, index) => {
|
|
14
|
-
return {
|
|
15
|
-
label: `data-point ${index}`,
|
|
16
|
-
dataPoints: Array.from({ length: 5 }).map((_, index) => {
|
|
17
|
-
return {
|
|
18
|
-
value: Math.floor(Math.random() * 200),
|
|
19
|
-
label: `data-point ${index}`,
|
|
20
|
-
color: ['teal', 'green', 'lime', 'yellow', 'amber'][index],
|
|
21
|
-
};
|
|
22
|
-
}),
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
# Bar Chart
|
|
28
|
-
|
|
29
|
-
<ComponentApi :api="api" />
|
|
30
|
-
|
|
31
|
-
## Usage
|
|
32
|
-
|
|
33
|
-
Use the `BarChart` component to display a single data point in a bar.
|
|
34
|
-
|
|
35
|
-
<ComponentWrapper>
|
|
36
|
-
<Card>
|
|
37
|
-
<CardSection>
|
|
38
|
-
<BarChart :data-points="dataPoints" height="150" />
|
|
39
|
-
</CardSection>
|
|
40
|
-
</Card>
|
|
41
|
-
</ComponentWrapper>
|
|
42
|
-
|
|
43
|
-
```js-vue
|
|
44
|
-
<script lang="ts" setup>
|
|
45
|
-
import { BarChart, Card, CardSection } from '@returnless/focus-ui';
|
|
46
|
-
</script>
|
|
47
|
-
|
|
48
|
-
<template>
|
|
49
|
-
<Card>
|
|
50
|
-
<CardSection>
|
|
51
|
-
<BarChart :data-points="dataPoints" height="200" />
|
|
52
|
-
</CardSection>
|
|
53
|
-
</Card>
|
|
54
|
-
</template>
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Stacked Bar Chart
|
|
58
|
-
|
|
59
|
-
Use the `BarChartStacked` component to display multiple data points in a single bar.
|
|
60
|
-
|
|
61
|
-
<ComponentWrapper>
|
|
62
|
-
<Card>
|
|
63
|
-
<CardSection>
|
|
64
|
-
<BarChartStacked :data-points="stackedDataPoints" height="150">
|
|
65
|
-
test
|
|
66
|
-
</BarChartStacked>
|
|
67
|
-
</CardSection>
|
|
68
|
-
</Card>
|
|
69
|
-
</ComponentWrapper>
|
|
70
|
-
|
|
71
|
-
```js-vue
|
|
72
|
-
<script lang="ts" setup>
|
|
73
|
-
import { BarChartStacked, Card, CardSection } from '@returnless/focus-ui';
|
|
74
|
-
</script>
|
|
75
|
-
|
|
76
|
-
<template>
|
|
77
|
-
<Card>
|
|
78
|
-
<CardSection>
|
|
79
|
-
<BarChartStacked :data-points="dataPoints" height="200" />
|
|
80
|
-
</CardSection>
|
|
81
|
-
</Card>
|
|
82
|
-
</template>
|
|
83
|
-
```
|