@returnless/focus-ui 0.0.5 → 0.0.7

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.
Files changed (257) hide show
  1. package/dist/components/Button/Button.vue.d.ts +4 -1
  2. package/dist/components/Button/types.d.ts +2 -0
  3. package/dist/components/Link/Link.vue.d.ts +1 -1
  4. package/dist/components/Tag/Tag.vue.d.ts +6 -2
  5. package/dist/focus-ui.js +1779 -1769
  6. package/dist/focus-ui.umd.cjs +21 -21
  7. package/package.json +2 -3
  8. package/src/build-utils/generate-component-meta.ts +0 -80
  9. package/src/build-utils/update-component-list.js +0 -31
  10. package/src/build-utils/update-component-list.ts +0 -32
  11. package/src/components/Accordion/Accordion.vue +0 -20
  12. package/src/components/Accordion/AccordionContent.vue +0 -43
  13. package/src/components/Accordion/AccordionItem.vue +0 -21
  14. package/src/components/Accordion/AccordionTrigger.vue +0 -38
  15. package/src/components/Accordion/README.md +0 -56
  16. package/src/components/Accordion/index.ts +0 -4
  17. package/src/components/ActionList/ActionList.vue +0 -9
  18. package/src/components/ActionList/ActionListBody.vue +0 -11
  19. package/src/components/ActionList/ActionListItem.vue +0 -37
  20. package/src/components/ActionList/ActionListSection.vue +0 -7
  21. package/src/components/ActionList/ActionListTrigger.vue +0 -9
  22. package/src/components/ActionList/README.md +0 -113
  23. package/src/components/ActionList/index.ts +0 -5
  24. package/src/components/Alert/Alert.vue +0 -68
  25. package/src/components/Alert/AlertDescription.vue +0 -20
  26. package/src/components/Alert/AlertTitle.vue +0 -11
  27. package/src/components/Alert/DismissableAlertButton.vue +0 -36
  28. package/src/components/Alert/README.md +0 -150
  29. package/src/components/Alert/index.ts +0 -5
  30. package/src/components/Alert/types.ts +0 -1
  31. package/src/components/AlertDialog/AlertDialog.vue +0 -54
  32. package/src/components/AlertDialog/AlertDialogActionButton.vue +0 -16
  33. package/src/components/AlertDialog/AlertDialogCancelButton.vue +0 -15
  34. package/src/components/AlertDialog/AlertDialogContent.vue +0 -8
  35. package/src/components/AlertDialog/AlertDialogDescription.vue +0 -17
  36. package/src/components/AlertDialog/AlertDialogFooter.vue +0 -11
  37. package/src/components/AlertDialog/AlertDialogHeader.vue +0 -8
  38. package/src/components/AlertDialog/AlertDialogTitle.vue +0 -15
  39. package/src/components/AlertDialog/README.md +0 -84
  40. package/src/components/AlertDialog/index.ts +0 -8
  41. package/src/components/AspectRatio/AspectRatio.vue +0 -19
  42. package/src/components/AspectRatio/README.md +0 -36
  43. package/src/components/AspectRatio/index.ts +0 -1
  44. package/src/components/Avatar/Avatar.vue +0 -122
  45. package/src/components/Avatar/README.md +0 -116
  46. package/src/components/Avatar/index.ts +0 -1
  47. package/src/components/Badge/Badge.vue +0 -51
  48. package/src/components/Badge/BadgeContent.vue +0 -9
  49. package/src/components/Badge/BadgeIcon.vue +0 -7
  50. package/src/components/Badge/README.md +0 -131
  51. package/src/components/Badge/index.ts +0 -3
  52. package/src/components/BarChart/BarChart.vue +0 -80
  53. package/src/components/BarChart/BarChartContainer.vue +0 -7
  54. package/src/components/BarChart/BarChartStacked.vue +0 -93
  55. package/src/components/BarChart/README.md +0 -83
  56. package/src/components/BarChart/index.ts +0 -3
  57. package/src/components/Breadcrumbs/Breadcrumb.vue +0 -7
  58. package/src/components/Breadcrumbs/BreadcrumbEllipsis.vue +0 -12
  59. package/src/components/Breadcrumbs/BreadcrumbItem.vue +0 -8
  60. package/src/components/Breadcrumbs/BreadcrumbLink.vue +0 -13
  61. package/src/components/Breadcrumbs/BreadcrumbList.vue +0 -8
  62. package/src/components/Breadcrumbs/BreadcrumbPage.vue +0 -13
  63. package/src/components/Breadcrumbs/BreadcrumbSeparator.vue +0 -12
  64. package/src/components/Breadcrumbs/README.md +0 -91
  65. package/src/components/Breadcrumbs/index.ts +0 -7
  66. package/src/components/Button/Button.vue +0 -75
  67. package/src/components/Button/ButtonContent.vue +0 -7
  68. package/src/components/Button/ButtonIcon.vue +0 -32
  69. package/src/components/Button/README.md +0 -231
  70. package/src/components/Button/index.ts +0 -5
  71. package/src/components/Button/types.ts +0 -30
  72. package/src/components/ButtonGroup/ButtonGroup.vue +0 -7
  73. package/src/components/ButtonGroup/README.md +0 -42
  74. package/src/components/ButtonGroup/index.ts +0 -1
  75. package/src/components/Card/Card.vue +0 -7
  76. package/src/components/Card/CardDescription.vue +0 -11
  77. package/src/components/Card/CardFooter.vue +0 -7
  78. package/src/components/Card/CardHeader.vue +0 -7
  79. package/src/components/Card/CardHelp.vue +0 -23
  80. package/src/components/Card/CardSection.vue +0 -22
  81. package/src/components/Card/CardTitle.vue +0 -11
  82. package/src/components/Card/README.md +0 -156
  83. package/src/components/Card/index.ts +0 -7
  84. package/src/components/Checkbox/Checkbox.vue +0 -73
  85. package/src/components/Checkbox/README.md +0 -111
  86. package/src/components/Checkbox/index.ts +0 -1
  87. package/src/components/Collapsible/README.md +0 -25
  88. package/src/components/DataTable/README.md +0 -56
  89. package/src/components/DatePicker/DatePicker.vue +0 -120
  90. package/src/components/DatePicker/DatePickerCard.vue +0 -9
  91. package/src/components/DatePicker/README.md +0 -59
  92. package/src/components/DatePicker/index.ts +0 -2
  93. package/src/components/DescriptionList/DescriptionList.vue +0 -18
  94. package/src/components/DescriptionList/DescriptionListDescription.vue +0 -8
  95. package/src/components/DescriptionList/DescriptionListItem.vue +0 -21
  96. package/src/components/DescriptionList/DescriptionListTerm.vue +0 -11
  97. package/src/components/DescriptionList/README.md +0 -159
  98. package/src/components/DescriptionList/index.ts +0 -4
  99. package/src/components/Dialog/README.md +0 -2
  100. package/src/components/Dialog/index.ts +0 -0
  101. package/src/components/DropZone/DropZone.vue +0 -105
  102. package/src/components/DropZone/README.md +0 -48
  103. package/src/components/DropZone/index.ts +0 -1
  104. package/src/components/EmptyState/EmptyState.vue +0 -13
  105. package/src/components/EmptyState/EmptyStateActions.vue +0 -11
  106. package/src/components/EmptyState/EmptyStateContent.vue +0 -7
  107. package/src/components/EmptyState/EmptyStateDescription.vue +0 -11
  108. package/src/components/EmptyState/EmptyStateTitle.vue +0 -7
  109. package/src/components/EmptyState/README.md +0 -102
  110. package/src/components/EmptyState/index.ts +0 -5
  111. package/src/components/Feed/Feed.vue +0 -7
  112. package/src/components/Feed/FeedItem.vue +0 -19
  113. package/src/components/Feed/FeedItemBlock.vue +0 -11
  114. package/src/components/Feed/FeedItemDateIndicator.vue +0 -11
  115. package/src/components/Feed/FeedItemIcon.vue +0 -26
  116. package/src/components/Feed/FeedItemSimple.vue +0 -8
  117. package/src/components/Feed/README.md +0 -115
  118. package/src/components/Feed/index.ts +0 -6
  119. package/src/components/FileUploadButton/FileUploadButton.vue +0 -62
  120. package/src/components/FileUploadButton/index.ts +0 -1
  121. package/src/components/Form/Form.vue +0 -35
  122. package/src/components/Form/README.md +0 -52
  123. package/src/components/Form/index.ts +0 -1
  124. package/src/components/FormLayout/FormLayout.vue +0 -25
  125. package/src/components/FormLayout/README.md +0 -97
  126. package/src/components/FormLayout/index.ts +0 -1
  127. package/src/components/Heading/Heading.vue +0 -32
  128. package/src/components/Heading/index.ts +0 -3
  129. package/src/components/Heading/types.ts +0 -3
  130. package/src/components/Image/Image.vue +0 -30
  131. package/src/components/Image/index.ts +0 -1
  132. package/src/components/InertiaLink/InertiaLink.vue +0 -11
  133. package/src/components/InertiaLink/index.ts +0 -1
  134. package/src/components/InlineError/InlineError.vue +0 -21
  135. package/src/components/InlineError/README.md +0 -63
  136. package/src/components/InlineError/index.ts +0 -1
  137. package/src/components/InputLabel/InputLabel.vue +0 -32
  138. package/src/components/InputLabel/index.ts +0 -1
  139. package/src/components/KPICard/KPICard.vue +0 -28
  140. package/src/components/KPICard/KPICardSection.vue +0 -30
  141. package/src/components/KPICard/README.md +0 -124
  142. package/src/components/KPICard/index.ts +0 -2
  143. package/src/components/Legend/Legend.vue +0 -7
  144. package/src/components/Legend/LegendItem.vue +0 -34
  145. package/src/components/Legend/README.md +0 -32
  146. package/src/components/Legend/index.ts +0 -2
  147. package/src/components/Link/Link.vue +0 -38
  148. package/src/components/Link/README.md +0 -119
  149. package/src/components/Link/index.ts +0 -1
  150. package/src/components/Navigation/Navigation.vue +0 -8
  151. package/src/components/Navigation/NavigationItem.vue +0 -47
  152. package/src/components/Navigation/NavigationSecondarySection.vue +0 -12
  153. package/src/components/Navigation/NavigationSection.vue +0 -27
  154. package/src/components/Navigation/README.md +0 -83
  155. package/src/components/Navigation/index.ts +0 -4
  156. package/src/components/Page/Page.vue +0 -7
  157. package/src/components/Page/PageBody.vue +0 -36
  158. package/src/components/Page/PageDescription.vue +0 -11
  159. package/src/components/Page/PageHeader.vue +0 -34
  160. package/src/components/Page/PageTitle.vue +0 -12
  161. package/src/components/Page/README.md +0 -226
  162. package/src/components/Page/index.ts +0 -5
  163. package/src/components/Pagination/Pagination.vue +0 -8
  164. package/src/components/Pagination/PaginationNextButton.vue +0 -10
  165. package/src/components/Pagination/PaginationPreviousButton.vue +0 -10
  166. package/src/components/Pagination/README.md +0 -45
  167. package/src/components/Pagination/index.ts +0 -3
  168. package/src/components/PinInput/PinInput.vue +0 -169
  169. package/src/components/PinInput/README.md +0 -35
  170. package/src/components/PinInput/index.ts +0 -1
  171. package/src/components/Popover/Popover.vue +0 -18
  172. package/src/components/Popover/PopoverBody.vue +0 -11
  173. package/src/components/Popover/PopoverTrigger.vue +0 -9
  174. package/src/components/Popover/README.md +0 -79
  175. package/src/components/Popover/index.ts +0 -3
  176. package/src/components/Popper/Popper.vue +0 -91
  177. package/src/components/Popper/PopperBody.vue +0 -19
  178. package/src/components/Popper/PopperTrigger.vue +0 -14
  179. package/src/components/Popper/README.md +0 -42
  180. package/src/components/Popper/index.ts +0 -3
  181. package/src/components/ProgressBar/ProgressBar.vue +0 -51
  182. package/src/components/ProgressBar/ProgressBarIndicator.vue +0 -7
  183. package/src/components/ProgressBar/README.md +0 -98
  184. package/src/components/ProgressBar/index.ts +0 -2
  185. package/src/components/RadioButton/README.md +0 -111
  186. package/src/components/RadioButton/RadioButton.vue +0 -49
  187. package/src/components/RadioButton/index.ts +0 -1
  188. package/src/components/ResourceList/README.md +0 -160
  189. package/src/components/ResourceList/ResourceList.vue +0 -7
  190. package/src/components/ResourceList/ResourceListItem.vue +0 -7
  191. package/src/components/ResourceList/ResourceListItemContent.vue +0 -7
  192. package/src/components/ResourceList/index.ts +0 -3
  193. package/src/components/Select/README.md +0 -74
  194. package/src/components/Select/Select.vue +0 -91
  195. package/src/components/Select/SelectGroup.vue +0 -12
  196. package/src/components/Select/SelectOption.vue +0 -12
  197. package/src/components/Select/index.ts +0 -3
  198. package/src/components/Separator/README.md +0 -39
  199. package/src/components/Separator/Separator.vue +0 -24
  200. package/src/components/Separator/index.ts +0 -1
  201. package/src/components/Spinner/README.md +0 -53
  202. package/src/components/Spinner/Spinner.vue +0 -64
  203. package/src/components/Spinner/index.ts +0 -1
  204. package/src/components/StatusIndicator/README.md +0 -51
  205. package/src/components/StatusIndicator/StatusIndicator.vue +0 -44
  206. package/src/components/StatusIndicator/index.ts +0 -1
  207. package/src/components/Stepper/README.md +0 -38
  208. package/src/components/Stepper/Stepper.vue +0 -104
  209. package/src/components/Stepper/index.ts +0 -1
  210. package/src/components/Tabs/README.md +0 -53
  211. package/src/components/Tabs/TabTrigger.vue +0 -44
  212. package/src/components/Tabs/Tabs.vue +0 -16
  213. package/src/components/Tabs/index.ts +0 -2
  214. package/src/components/Tag/README.md +0 -27
  215. package/src/components/Tag/Tag.vue +0 -45
  216. package/src/components/Tag/index.ts +0 -1
  217. package/src/components/TextField/README.md +0 -335
  218. package/src/components/TextField/TextField.vue +0 -135
  219. package/src/components/TextField/TextFieldIcon.vue +0 -19
  220. package/src/components/TextField/TextFieldPasswordIcon.vue +0 -28
  221. package/src/components/TextField/TextFieldSearchIcon.vue +0 -11
  222. package/src/components/TextField/index.ts +0 -1
  223. package/src/components/TextStyle/README.md +0 -39
  224. package/src/components/TextStyle/TextStyle.vue +0 -24
  225. package/src/components/TextStyle/index.ts +0 -1
  226. package/src/components/Toast/DismissToastAction.vue +0 -34
  227. package/src/components/Toast/README.md +0 -167
  228. package/src/components/Toast/Toast.vue +0 -39
  229. package/src/components/Toast/ToastGroup.vue +0 -9
  230. package/src/components/Toast/index.ts +0 -2
  231. package/src/components/Toggle/README.md +0 -66
  232. package/src/components/Toggle/Toggle.vue +0 -89
  233. package/src/components/Toggle/index.ts +0 -1
  234. package/src/components/Tooltip/README.md +0 -51
  235. package/src/components/Tooltip/Tooltip.vue +0 -24
  236. package/src/components/Tooltip/index.ts +0 -1
  237. package/src/components/TopBar/README.md +0 -43
  238. package/src/components/TopBar/TopBar.vue +0 -7
  239. package/src/components/TopBar/TopBarLogo.vue +0 -8
  240. package/src/components/TopBar/TopBarNavigation.vue +0 -7
  241. package/src/components/TopBar/TopBarNavigationItem.vue +0 -13
  242. package/src/components/TopBar/TopBarSearch.vue +0 -15
  243. package/src/components/TopBar/TopBarUserMenu.vue +0 -20
  244. package/src/components/TopBar/index.ts +0 -6
  245. package/src/components/VisuallyHidden/README.md +0 -19
  246. package/src/components/VisuallyHidden/VisuallyHidden.vue +0 -25
  247. package/src/components/VisuallyHidden/index.ts +0 -1
  248. package/src/components/index.ts +0 -197
  249. package/src/components/types.ts +0 -5
  250. package/src/composables/index.ts +0 -7
  251. package/src/composables/useTailwindColor.ts +0 -17
  252. package/src/composables/useTheme.ts +0 -41
  253. package/src/composables/useToastNotifications.ts +0 -55
  254. package/src/composables/useUniqueId.ts +0 -6
  255. package/src/index.css +0 -24
  256. package/src/index.ts +0 -1
  257. 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,9 +0,0 @@
1
- <script lang="ts" setup>
2
- import { TextStyle } from '../TextStyle';
3
- </script>
4
-
5
- <template>
6
- <TextStyle variant="strong">
7
- <slot />
8
- </TextStyle>
9
- </template>
@@ -1,7 +0,0 @@
1
- <script lang="ts" setup></script>
2
-
3
- <template>
4
- <div class="w-4 h-4">
5
- <slot />
6
- </div>
7
- </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,3 +0,0 @@
1
- export { default as Badge } from './Badge.vue';
2
- export { default as BadgeContent } from './BadgeContent.vue';
3
- export { default as BadgeIcon } from './BadgeIcon.vue';
@@ -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,7 +0,0 @@
1
- <script lang="ts" setup></script>
2
-
3
- <template>
4
- <div class="space-y-4">
5
- <slot />
6
- </div>
7
- </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
- ```
@@ -1,3 +0,0 @@
1
- export { default as BarChart } from './BarChart.vue';
2
- export { default as BarChartContainer } from './BarChartContainer.vue';
3
- export { default as BarChartStacked } from './BarChartStacked.vue';
@@ -1,7 +0,0 @@
1
- <script lang="ts" setup></script>
2
-
3
- <template>
4
- <nav aria-label="breadcrumb">
5
- <slot />
6
- </nav>
7
- </template>
@@ -1,12 +0,0 @@
1
- <script lang="ts" setup>
2
- import { EllipsisHorizontalIcon } from '@heroicons/vue/16/solid';
3
- </script>
4
-
5
- <template>
6
- <span
7
- role="presentation"
8
- aria-hidden="true"
9
- >
10
- <EllipsisHorizontalIcon class="w-4 h-4" />
11
- </span>
12
- </template>
@@ -1,8 +0,0 @@
1
- <script lang="ts" setup>
2
- </script>
3
-
4
- <template>
5
- <li class="inline-flex items-center text-slate-500">
6
- <slot />
7
- </li>
8
- </template>
@@ -1,13 +0,0 @@
1
- <script lang="ts" setup>
2
- import { InertiaLink } from '../InertiaLink';
3
- </script>
4
-
5
- <template>
6
- <InertiaLink
7
- class="hover:underline hover:text-black"
8
- href="/"
9
- role="link"
10
- >
11
- <slot />
12
- </InertiaLink>
13
- </template>
@@ -1,8 +0,0 @@
1
- <script lang="ts" setup>
2
- </script>
3
-
4
- <template>
5
- <ol class="flex flex-wrap items-center gap-2 break-words">
6
- <slot />
7
- </ol>
8
- </template>
@@ -1,13 +0,0 @@
1
- <script lang="ts" setup>
2
- </script>
3
-
4
- <template>
5
- <span
6
- aria-current="page"
7
- aria-disabled="true"
8
- class="text-black"
9
- role="link"
10
- >
11
- <slot />
12
- </span>
13
- </template>
@@ -1,12 +0,0 @@
1
- <script lang="ts" setup>
2
- import { ChevronRightIcon } from '@heroicons/vue/16/solid';
3
- </script>
4
-
5
- <template>
6
- <li
7
- aria-hidden="true"
8
- role="presentation"
9
- >
10
- <ChevronRightIcon class="w-4 h-4" />
11
- </li>
12
- </template>