@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.
Files changed (250) hide show
  1. package/package.json +3 -2
  2. package/src/build-utils/generate-component-meta.ts +0 -80
  3. package/src/build-utils/update-component-list.js +0 -31
  4. package/src/build-utils/update-component-list.ts +0 -32
  5. package/src/components/Accordion/Accordion.vue +0 -20
  6. package/src/components/Accordion/AccordionContent.vue +0 -43
  7. package/src/components/Accordion/AccordionItem.vue +0 -21
  8. package/src/components/Accordion/AccordionTrigger.vue +0 -38
  9. package/src/components/Accordion/README.md +0 -56
  10. package/src/components/Accordion/index.ts +0 -4
  11. package/src/components/ActionList/ActionList.vue +0 -9
  12. package/src/components/ActionList/ActionListBody.vue +0 -11
  13. package/src/components/ActionList/ActionListItem.vue +0 -37
  14. package/src/components/ActionList/ActionListSection.vue +0 -7
  15. package/src/components/ActionList/ActionListTrigger.vue +0 -9
  16. package/src/components/ActionList/README.md +0 -113
  17. package/src/components/ActionList/index.ts +0 -5
  18. package/src/components/Alert/Alert.vue +0 -68
  19. package/src/components/Alert/AlertDescription.vue +0 -20
  20. package/src/components/Alert/AlertTitle.vue +0 -11
  21. package/src/components/Alert/DismissableAlertButton.vue +0 -36
  22. package/src/components/Alert/README.md +0 -150
  23. package/src/components/Alert/index.ts +0 -5
  24. package/src/components/Alert/types.ts +0 -1
  25. package/src/components/AlertDialog/AlertDialog.vue +0 -54
  26. package/src/components/AlertDialog/AlertDialogActionButton.vue +0 -16
  27. package/src/components/AlertDialog/AlertDialogCancelButton.vue +0 -15
  28. package/src/components/AlertDialog/AlertDialogContent.vue +0 -8
  29. package/src/components/AlertDialog/AlertDialogDescription.vue +0 -17
  30. package/src/components/AlertDialog/AlertDialogFooter.vue +0 -11
  31. package/src/components/AlertDialog/AlertDialogHeader.vue +0 -8
  32. package/src/components/AlertDialog/AlertDialogTitle.vue +0 -15
  33. package/src/components/AlertDialog/README.md +0 -84
  34. package/src/components/AlertDialog/index.ts +0 -8
  35. package/src/components/AspectRatio/AspectRatio.vue +0 -19
  36. package/src/components/AspectRatio/README.md +0 -36
  37. package/src/components/AspectRatio/index.ts +0 -1
  38. package/src/components/Avatar/Avatar.vue +0 -122
  39. package/src/components/Avatar/README.md +0 -116
  40. package/src/components/Avatar/index.ts +0 -1
  41. package/src/components/Badge/Badge.vue +0 -51
  42. package/src/components/Badge/BadgeContent.vue +0 -9
  43. package/src/components/Badge/BadgeIcon.vue +0 -7
  44. package/src/components/Badge/README.md +0 -131
  45. package/src/components/Badge/index.ts +0 -3
  46. package/src/components/BarChart/BarChart.vue +0 -80
  47. package/src/components/BarChart/BarChartContainer.vue +0 -7
  48. package/src/components/BarChart/BarChartStacked.vue +0 -93
  49. package/src/components/BarChart/README.md +0 -83
  50. package/src/components/BarChart/index.ts +0 -3
  51. package/src/components/Breadcrumbs/Breadcrumb.vue +0 -7
  52. package/src/components/Breadcrumbs/BreadcrumbEllipsis.vue +0 -12
  53. package/src/components/Breadcrumbs/BreadcrumbItem.vue +0 -8
  54. package/src/components/Breadcrumbs/BreadcrumbLink.vue +0 -13
  55. package/src/components/Breadcrumbs/BreadcrumbList.vue +0 -8
  56. package/src/components/Breadcrumbs/BreadcrumbPage.vue +0 -13
  57. package/src/components/Breadcrumbs/BreadcrumbSeparator.vue +0 -12
  58. package/src/components/Breadcrumbs/README.md +0 -91
  59. package/src/components/Breadcrumbs/index.ts +0 -7
  60. package/src/components/Button/Button.vue +0 -75
  61. package/src/components/Button/ButtonContent.vue +0 -7
  62. package/src/components/Button/ButtonIcon.vue +0 -32
  63. package/src/components/Button/README.md +0 -231
  64. package/src/components/Button/index.ts +0 -5
  65. package/src/components/Button/types.ts +0 -30
  66. package/src/components/ButtonGroup/ButtonGroup.vue +0 -7
  67. package/src/components/ButtonGroup/README.md +0 -42
  68. package/src/components/ButtonGroup/index.ts +0 -1
  69. package/src/components/Card/Card.vue +0 -7
  70. package/src/components/Card/CardDescription.vue +0 -11
  71. package/src/components/Card/CardFooter.vue +0 -7
  72. package/src/components/Card/CardHeader.vue +0 -7
  73. package/src/components/Card/CardHelp.vue +0 -23
  74. package/src/components/Card/CardSection.vue +0 -22
  75. package/src/components/Card/CardTitle.vue +0 -11
  76. package/src/components/Card/README.md +0 -156
  77. package/src/components/Card/index.ts +0 -7
  78. package/src/components/Checkbox/Checkbox.vue +0 -73
  79. package/src/components/Checkbox/README.md +0 -111
  80. package/src/components/Checkbox/index.ts +0 -1
  81. package/src/components/Collapsible/README.md +0 -25
  82. package/src/components/DataTable/README.md +0 -56
  83. package/src/components/DatePicker/DatePicker.vue +0 -120
  84. package/src/components/DatePicker/DatePickerCard.vue +0 -9
  85. package/src/components/DatePicker/README.md +0 -59
  86. package/src/components/DatePicker/index.ts +0 -2
  87. package/src/components/DescriptionList/DescriptionList.vue +0 -18
  88. package/src/components/DescriptionList/DescriptionListDescription.vue +0 -8
  89. package/src/components/DescriptionList/DescriptionListItem.vue +0 -21
  90. package/src/components/DescriptionList/DescriptionListTerm.vue +0 -11
  91. package/src/components/DescriptionList/README.md +0 -159
  92. package/src/components/DescriptionList/index.ts +0 -4
  93. package/src/components/Dialog/README.md +0 -2
  94. package/src/components/Dialog/index.ts +0 -0
  95. package/src/components/DropZone/DropZone.vue +0 -105
  96. package/src/components/DropZone/README.md +0 -48
  97. package/src/components/DropZone/index.ts +0 -1
  98. package/src/components/EmptyState/EmptyState.vue +0 -13
  99. package/src/components/EmptyState/EmptyStateActions.vue +0 -11
  100. package/src/components/EmptyState/EmptyStateContent.vue +0 -7
  101. package/src/components/EmptyState/EmptyStateDescription.vue +0 -11
  102. package/src/components/EmptyState/EmptyStateTitle.vue +0 -7
  103. package/src/components/EmptyState/README.md +0 -102
  104. package/src/components/EmptyState/index.ts +0 -5
  105. package/src/components/Feed/Feed.vue +0 -7
  106. package/src/components/Feed/FeedItem.vue +0 -19
  107. package/src/components/Feed/FeedItemBlock.vue +0 -11
  108. package/src/components/Feed/FeedItemDateIndicator.vue +0 -11
  109. package/src/components/Feed/FeedItemIcon.vue +0 -26
  110. package/src/components/Feed/FeedItemSimple.vue +0 -8
  111. package/src/components/Feed/README.md +0 -115
  112. package/src/components/Feed/index.ts +0 -6
  113. package/src/components/FileUploadButton/FileUploadButton.vue +0 -62
  114. package/src/components/FileUploadButton/index.ts +0 -1
  115. package/src/components/Form/Form.vue +0 -35
  116. package/src/components/Form/README.md +0 -52
  117. package/src/components/Form/index.ts +0 -1
  118. package/src/components/FormLayout/FormLayout.vue +0 -25
  119. package/src/components/FormLayout/README.md +0 -97
  120. package/src/components/FormLayout/index.ts +0 -1
  121. package/src/components/Heading/Heading.vue +0 -32
  122. package/src/components/Heading/index.ts +0 -3
  123. package/src/components/Heading/types.ts +0 -3
  124. package/src/components/Image/Image.vue +0 -30
  125. package/src/components/Image/index.ts +0 -1
  126. package/src/components/InertiaLink/InertiaLink.vue +0 -11
  127. package/src/components/InertiaLink/index.ts +0 -1
  128. package/src/components/InlineError/InlineError.vue +0 -21
  129. package/src/components/InlineError/README.md +0 -63
  130. package/src/components/InlineError/index.ts +0 -1
  131. package/src/components/InputLabel/InputLabel.vue +0 -32
  132. package/src/components/InputLabel/index.ts +0 -1
  133. package/src/components/KPICard/KPICard.vue +0 -28
  134. package/src/components/KPICard/KPICardSection.vue +0 -30
  135. package/src/components/KPICard/README.md +0 -124
  136. package/src/components/KPICard/index.ts +0 -2
  137. package/src/components/Legend/Legend.vue +0 -7
  138. package/src/components/Legend/LegendItem.vue +0 -34
  139. package/src/components/Legend/README.md +0 -32
  140. package/src/components/Legend/index.ts +0 -2
  141. package/src/components/Link/Link.vue +0 -38
  142. package/src/components/Link/README.md +0 -119
  143. package/src/components/Link/index.ts +0 -1
  144. package/src/components/Navigation/Navigation.vue +0 -8
  145. package/src/components/Navigation/NavigationItem.vue +0 -47
  146. package/src/components/Navigation/NavigationSecondarySection.vue +0 -12
  147. package/src/components/Navigation/NavigationSection.vue +0 -27
  148. package/src/components/Navigation/README.md +0 -83
  149. package/src/components/Navigation/index.ts +0 -4
  150. package/src/components/Page/Page.vue +0 -7
  151. package/src/components/Page/PageBody.vue +0 -36
  152. package/src/components/Page/PageDescription.vue +0 -11
  153. package/src/components/Page/PageHeader.vue +0 -34
  154. package/src/components/Page/PageTitle.vue +0 -12
  155. package/src/components/Page/README.md +0 -226
  156. package/src/components/Page/index.ts +0 -5
  157. package/src/components/Pagination/Pagination.vue +0 -8
  158. package/src/components/Pagination/PaginationNextButton.vue +0 -10
  159. package/src/components/Pagination/PaginationPreviousButton.vue +0 -10
  160. package/src/components/Pagination/README.md +0 -45
  161. package/src/components/Pagination/index.ts +0 -3
  162. package/src/components/PinInput/PinInput.vue +0 -169
  163. package/src/components/PinInput/README.md +0 -35
  164. package/src/components/PinInput/index.ts +0 -1
  165. package/src/components/Popover/Popover.vue +0 -18
  166. package/src/components/Popover/PopoverBody.vue +0 -11
  167. package/src/components/Popover/PopoverTrigger.vue +0 -9
  168. package/src/components/Popover/README.md +0 -79
  169. package/src/components/Popover/index.ts +0 -3
  170. package/src/components/Popper/Popper.vue +0 -91
  171. package/src/components/Popper/PopperBody.vue +0 -19
  172. package/src/components/Popper/PopperTrigger.vue +0 -14
  173. package/src/components/Popper/README.md +0 -42
  174. package/src/components/Popper/index.ts +0 -3
  175. package/src/components/ProgressBar/ProgressBar.vue +0 -51
  176. package/src/components/ProgressBar/ProgressBarIndicator.vue +0 -7
  177. package/src/components/ProgressBar/README.md +0 -98
  178. package/src/components/ProgressBar/index.ts +0 -2
  179. package/src/components/RadioButton/README.md +0 -111
  180. package/src/components/RadioButton/RadioButton.vue +0 -49
  181. package/src/components/RadioButton/index.ts +0 -1
  182. package/src/components/ResourceList/README.md +0 -160
  183. package/src/components/ResourceList/ResourceList.vue +0 -7
  184. package/src/components/ResourceList/ResourceListItem.vue +0 -7
  185. package/src/components/ResourceList/ResourceListItemContent.vue +0 -7
  186. package/src/components/ResourceList/index.ts +0 -3
  187. package/src/components/Select/README.md +0 -74
  188. package/src/components/Select/Select.vue +0 -91
  189. package/src/components/Select/SelectGroup.vue +0 -12
  190. package/src/components/Select/SelectOption.vue +0 -12
  191. package/src/components/Select/index.ts +0 -3
  192. package/src/components/Separator/README.md +0 -39
  193. package/src/components/Separator/Separator.vue +0 -24
  194. package/src/components/Separator/index.ts +0 -1
  195. package/src/components/Spinner/README.md +0 -53
  196. package/src/components/Spinner/Spinner.vue +0 -64
  197. package/src/components/Spinner/index.ts +0 -1
  198. package/src/components/StatusIndicator/README.md +0 -51
  199. package/src/components/StatusIndicator/StatusIndicator.vue +0 -44
  200. package/src/components/StatusIndicator/index.ts +0 -1
  201. package/src/components/Stepper/README.md +0 -38
  202. package/src/components/Stepper/Stepper.vue +0 -104
  203. package/src/components/Stepper/index.ts +0 -1
  204. package/src/components/Tabs/README.md +0 -53
  205. package/src/components/Tabs/TabTrigger.vue +0 -44
  206. package/src/components/Tabs/Tabs.vue +0 -16
  207. package/src/components/Tabs/index.ts +0 -2
  208. package/src/components/Tag/README.md +0 -27
  209. package/src/components/Tag/Tag.vue +0 -45
  210. package/src/components/Tag/index.ts +0 -1
  211. package/src/components/TextField/README.md +0 -335
  212. package/src/components/TextField/TextField.vue +0 -135
  213. package/src/components/TextField/TextFieldIcon.vue +0 -19
  214. package/src/components/TextField/TextFieldPasswordIcon.vue +0 -28
  215. package/src/components/TextField/TextFieldSearchIcon.vue +0 -11
  216. package/src/components/TextField/index.ts +0 -1
  217. package/src/components/TextStyle/README.md +0 -39
  218. package/src/components/TextStyle/TextStyle.vue +0 -24
  219. package/src/components/TextStyle/index.ts +0 -1
  220. package/src/components/Toast/DismissToastAction.vue +0 -34
  221. package/src/components/Toast/README.md +0 -167
  222. package/src/components/Toast/Toast.vue +0 -39
  223. package/src/components/Toast/ToastGroup.vue +0 -9
  224. package/src/components/Toast/index.ts +0 -2
  225. package/src/components/Toggle/README.md +0 -66
  226. package/src/components/Toggle/Toggle.vue +0 -89
  227. package/src/components/Toggle/index.ts +0 -1
  228. package/src/components/Tooltip/README.md +0 -51
  229. package/src/components/Tooltip/Tooltip.vue +0 -24
  230. package/src/components/Tooltip/index.ts +0 -1
  231. package/src/components/TopBar/README.md +0 -43
  232. package/src/components/TopBar/TopBar.vue +0 -7
  233. package/src/components/TopBar/TopBarLogo.vue +0 -8
  234. package/src/components/TopBar/TopBarNavigation.vue +0 -7
  235. package/src/components/TopBar/TopBarNavigationItem.vue +0 -13
  236. package/src/components/TopBar/TopBarSearch.vue +0 -15
  237. package/src/components/TopBar/TopBarUserMenu.vue +0 -20
  238. package/src/components/TopBar/index.ts +0 -6
  239. package/src/components/VisuallyHidden/README.md +0 -19
  240. package/src/components/VisuallyHidden/VisuallyHidden.vue +0 -25
  241. package/src/components/VisuallyHidden/index.ts +0 -1
  242. package/src/components/index.ts +0 -197
  243. package/src/components/types.ts +0 -5
  244. package/src/composables/index.ts +0 -7
  245. package/src/composables/useTailwindColor.ts +0 -17
  246. package/src/composables/useTheme.ts +0 -41
  247. package/src/composables/useToastNotifications.ts +0 -55
  248. package/src/composables/useUniqueId.ts +0 -6
  249. package/src/index.css +0 -24
  250. package/src/index.ts +0 -1
@@ -1,39 +0,0 @@
1
- <script lang="ts" setup>
2
- import { TextStyle } from '../../src/components';
3
- import api from '../component-meta/TextStyle.json';
4
- </script>
5
-
6
- # Test style
7
-
8
- Text style enhances text with additional visual meaning. For example, using subdued text to de-emphasize it from its
9
- surrounding text.
10
-
11
- <ComponentApi :api="api" />
12
-
13
- ## Usage
14
-
15
- <ComponentWrapper>
16
- <ComponentGrid>
17
- <TextStyle variant="strong">Strong text</TextStyle>
18
- <TextStyle variant="subdued">Subdued text</TextStyle>
19
- </ComponentGrid>
20
- </ComponentWrapper>
21
-
22
- ```js-vue
23
- <script lang="ts" setup>
24
- import { TextStyle } from '@returnless/focus-ui';
25
- </script>
26
-
27
- <template>
28
- <TextStyle variant="strong">Strong text</TextStyle>
29
- <TextStyle variant="subdued">Subdued text</TextStyle>
30
- </template>
31
- ```
32
-
33
- ## Best practices
34
-
35
- Text style should be:
36
-
37
- - Used when enhancing the text to help users understand its meaning.
38
- - Subdued if the text is less important than its surrounding text.
39
- - Strong for input fields, or for a row total in a table.
@@ -1,24 +0,0 @@
1
- <script lang="ts" setup>
2
- import { computed } from 'vue';
3
-
4
- const props = defineProps<{
5
- /** The text style variant. */
6
- variant: 'subdued' | 'strong';
7
- }>();
8
-
9
- const classList = computed((): Record<string, boolean>[] => {
10
- return [
11
- { 'text-slate-500': props.variant === 'subdued' },
12
- { 'font-medium': props.variant === 'strong' },
13
- ];
14
- });
15
- </script>
16
-
17
- <template>
18
- <span
19
- :class="classList"
20
- class="inline-block"
21
- >
22
- <slot />
23
- </span>
24
- </template>
@@ -1 +0,0 @@
1
- export { default as TextStyle } from './TextStyle.vue';
@@ -1,34 +0,0 @@
1
- <script lang="ts" setup>
2
- import { XMarkIcon } from '@heroicons/vue/16/solid';
3
- import { computed } from 'vue';
4
-
5
- const props = withDefaults(defineProps<{
6
- /** The variant of the alert. */
7
- variant?: 'default' | 'destructive';
8
- }>(), {
9
- variant: 'default',
10
- });
11
-
12
- defineEmits<{
13
- dismiss: [];
14
- }>();
15
-
16
- const classList = computed((): Record<string, boolean> => {
17
- return {
18
- 'hover:bg-red-200': props.variant === 'destructive',
19
- 'hover:bg-slate-200': props.variant === 'default',
20
- };
21
- });
22
- </script>
23
-
24
- <template>
25
- <button
26
- aria-label="Dismiss notification"
27
- class="flex h-5 w-5 items-center justify-center rounded"
28
- :class="classList"
29
- type="button"
30
- @click="$emit('dismiss')"
31
- >
32
- <XMarkIcon class="h-4 w-4" />
33
- </button>
34
- </template>
@@ -1,167 +0,0 @@
1
- <script lang="ts" setup>
2
- import { ref, computed, onMounted, watch } from "vue";
3
- import { Button, Toast, ToastGroup } from '../../src/components';
4
- import { useToastNotifications } from '../../src/composables/useToastNotifications';
5
- import api from '../component-meta/Toast.json';
6
-
7
- const {
8
- initializeNotificationHandlers,
9
- emitToastNotificationEvent,
10
- emitToastNotificationEvents,
11
- toastNotifications,
12
- closeToastNotification,
13
- } = useToastNotifications();
14
-
15
- const notifications = ref([{
16
- message: 'This is a toast message',
17
- duration: 5_000,
18
- }]);
19
-
20
- onMounted(() => {
21
- initializeNotificationHandlers();
22
- });
23
-
24
- watch(notifications, (newValue): void => {
25
- if (newValue) {
26
- setTimeout(() => {
27
- emitToastNotificationEvents(newValue);
28
- });
29
- }
30
- }, { immediate: true });
31
-
32
- function closeToast(toastNotification: ToastNotification): void {
33
- closeToastNotification(toastNotification);
34
- }
35
-
36
- function addToast(): void {
37
- emitToastNotificationEvent({
38
- message: 'This is a new toast message',
39
- duration: 5_000,
40
- });
41
- }
42
- </script>
43
-
44
- # Toast
45
-
46
- The toast component is a non-disruptive message that appears at the top of the interface to provide a quick, at-a-glance
47
- feedback on the outcome of an action. Toasts are often used to confirm that an action has been completed
48
- successfully or to inform users of a change in state.
49
-
50
- <ComponentApi :api="api" />
51
-
52
- ## Usage
53
-
54
- <ComponentWrapper>
55
- <Button @click="addToast">Add toast notification</Button>
56
- <ToastGroup>
57
- <Toast
58
- v-for="toastNotification in toastNotifications"
59
- :key="toastNotification.id"
60
- open
61
- :duration="toastNotification.duration"
62
- @close="() => closeToast(toastNotification)"
63
- >
64
- {{ toastNotification.message }}
65
- </Toast>
66
- </ToastGroup>
67
- </ComponentWrapper>
68
-
69
- ```js-vue
70
- <script lang="ts" setup>
71
- import { useToastNotifications } from '@returnless/focus-ui';
72
-
73
- const {
74
- initializeNotificationHandlers,
75
- emitToastNotificationEvent,
76
- emitToastNotificationEvents,
77
- toastNotifications,
78
- closeToastNotification,
79
- } = useToastNotifications();
80
-
81
- const TOAST_MESSAGE_DURATION = 5_000;
82
-
83
- const notifications = ref([{
84
- message: 'This is a toast message',
85
- duration: TOAST_MESSAGE_DURATION,
86
- }]);
87
-
88
- onMounted(() => {
89
- initializeNotificationHandlers();
90
- });
91
-
92
- watch(notifications, (newValue): void => {
93
- if (newValue) {
94
- setTimeout(() => {
95
- emitToastNotificationEvents(newValue);
96
- });
97
- }
98
- }, { immediate: true });
99
-
100
- function closeToast(toastNotification: ToastNotification): void {
101
- closeToastNotification(toastNotification);
102
- }
103
-
104
- function addToast(): void {
105
- emitToastNotificationEvent({
106
- message: 'This is a new toast message',
107
- duration: TOAST_MESSAGE_DURATION,
108
- });
109
- }
110
- </script>
111
- ```
112
-
113
- ## Best practices
114
-
115
- Toast should:
116
-
117
- - Be used for short messages to confirm an action.
118
- - Not go over 3 words.
119
- - Rarely be used for error messages.
120
- - Be used for success messages.
121
- - Be used only for non-critical errors that are relevant at the moment and can be explained in 3 words. For example,
122
- if there's an internet connection issue, the toast would say, "No internet connection."
123
- - Avoid using toasts for error messages. Always try to use a banner to prominently inform users about persistent errors.
124
-
125
- ## Content guidelines
126
-
127
- Toast messages should be:
128
-
129
- - Short and affirmative.
130
- - Written in the pattern of {noun + verb}.
131
-
132
- ### Toast with action
133
-
134
- Only include an action in toast if the same action is available elsewhere o n the page. For example:
135
-
136
- - If users need to reload a section, offer the call to action [Reload] in the toast. If they miss the toast message,
137
- they can also refresh the entire page.
138
- - If users delete an image, offer the option to [Undo] the deletion. If they miss it in the toast message, they can
139
- still retrieve it from somewhere else.
140
-
141
- Actions should:
142
-
143
- - Keep the action label short, preferably 1 verb.
144
- - Not have actions, like `Cancel`, for dismissing toast. The `X` to dismiss is already included in the component.
145
- - Be used with a duration of at least 10,000 milliseconds for accessibility. This gives users enough time to read the
146
- message and take action.
147
-
148
- ## Accessibility
149
-
150
- The content of the toast component is implemented as an ARIA live region using `aria-live"assertive"`. When the
151
- toast appears, screen readers will interrupt any announcement a screen reader is currently making.
152
-
153
- Avoid using toast for critical information that users need to act on immediately. Toast might be difficult for users
154
- with low vision or low dexterity to access because it:
155
-
156
- - Disappears automatically.
157
- - Can't be easily accessed with the keyboard.
158
- - Might appear outside the proximity of the user's current focus.
159
-
160
- ### Toast with action
161
-
162
- Make sure that users can also accomplish the action in the toast another way, since the toast action may be
163
- difficult to access for some users. If the toast action is not available somewhere else on the page, for example a
164
- retry action that reloads a section, it should have a fallback action, for example a browser refresh.
165
-
166
- Toast with action should persist for at least 10,000 milliseconds to give users enough time to read the message and
167
- act on it.
@@ -1,39 +0,0 @@
1
- <script lang="ts" setup>
2
- import DismissToastAction from './DismissToastAction.vue';
3
- import { watch } from 'vue';
4
-
5
- const props = withDefaults(defineProps<{
6
- /** Whether the toast is open or not */
7
- open?: boolean;
8
-
9
- /** The duration in milliseconds before the toast is automatically closed */
10
- duration?: number;
11
- }>(), {
12
- open: false,
13
- duration: 5_000,
14
- });
15
-
16
- const emit = defineEmits<{
17
- close: [];
18
- }>();
19
-
20
- function closeToast(): void {
21
- emit('close');
22
- }
23
-
24
- watch(() => props.open, async (newValue: boolean): Promise<void> => {
25
- if (newValue) {
26
- setTimeout(() => closeToast(), props.duration);
27
- }
28
- }, { immediate: true });
29
- </script>
30
-
31
- <template>
32
- <div class="w-auto flex relative rounded border bg-white px-4 py-3 shadow-lg">
33
- <div class="mr-2">
34
- <slot />
35
- </div>
36
-
37
- <DismissToastAction @dismiss="closeToast" />
38
- </div>
39
- </template>
@@ -1,9 +0,0 @@
1
- <script lang="ts" setup>
2
-
3
- </script>
4
-
5
- <template>
6
- <div class="fixed top-4 right-4 flex flex-col-reverse items-end space-y-3 space-y-reverse z-[999]">
7
- <slot />
8
- </div>
9
- </template>
@@ -1,2 +0,0 @@
1
- export { default as Toast } from './Toast.vue';
2
- export { default as ToastGroup } from './ToastGroup.vue';
@@ -1,66 +0,0 @@
1
- <script lang="ts" setup>
2
- import { Card, CardSection, Separator, Toggle, FormLayout, TextField } from '../../src/components';
3
- import api from '../component-meta/Toggle.json';
4
- </script>
5
-
6
- # Toggle
7
-
8
- Use toggle switches to present each option as an on/off switch. Toggles are best used for changing the state of system
9
- features.
10
-
11
- <ComponentApi :api="api" />
12
-
13
- ## Usage
14
-
15
- <ComponentWrapper>
16
- <Card>
17
- <CardSection>
18
- <FormLayout>
19
- <Toggle label="Toggle element" help-text="Customers will only be able to check out as guests." />
20
- <Toggle label="Toggle element" help-text="Customers will be able to check out with a customer account or as a guest." />
21
- </FormLayout>
22
- </CardSection>
23
- </Card>
24
- </ComponentWrapper>
25
-
26
- ```js-vue
27
- <script lang="ts" setup>
28
- import { Toggle } from '@returnless/focus-ui';
29
- </script>
30
-
31
- <template>
32
- <Toggle help-text="gaaf" />
33
- </template>
34
- ```
35
-
36
- ## Best practices
37
-
38
- Toggles should:
39
-
40
- - Always be used with an associated label component.
41
- - Be part of a one or more switches that:
42
- - List options in a rational order that makes logical sense.
43
- - Have a default option selected whenever possible.
44
-
45
- ## Accessibility
46
-
47
- Screen readers convey the state of the toggle automatically. The toggle is read as "on" or "off" when the user navigates
48
- to it.
49
-
50
- - Use the `disabled` prop to apply the HTML `disabled` attribute to the toggle. This prevents users from being able
51
- to interact with the toggle, and conveys its inactive state to assistive technologies.
52
- - Use the `id` prop to provide a unique `id` attribute value for the toggle. If an `id` isn't provided, then the
53
- component generates one. All toggle switches must have a unique `id` attribute value to work correctly with
54
- assistive technologies.
55
-
56
- ### Labeling
57
-
58
- - The required `label` prop conveys the purpose of the toggle to all users.
59
- - Use the `labelHidden` prop to visually hide the label while still making it accessible to assistive technologies.
60
- - When you provide help text via the `helpText` prop or an inline error message via the `error` prop, the help or
61
- error content is conveyed to screen reader users with the `aria-describedby` attribute.
62
-
63
- ### Keyboard support
64
-
65
- - Move focus to the toggle using the tab key (or shift + tab when tabbing backwards)
66
- - Use the up and down arrow keys to change which toggle is selected.
@@ -1,89 +0,0 @@
1
- <script lang="ts" setup>
2
- import { InputLabel } from '../InputLabel';
3
- import { computed, onMounted, ref, watch } from 'vue';
4
- import { TextStyle } from '../TextStyle';
5
- import { useUniqueId } from '../../composables';
6
-
7
- const props = withDefaults(defineProps<{
8
- /** The ID of the toggle. */
9
- id?: string | null;
10
-
11
- /** The label for the toggle. */
12
- label: string;
13
-
14
- /** The help text to be displayed below the toggle. */
15
- helpText?: string | null;
16
-
17
- /** The value of the toggle. */
18
- value?: any;
19
- }>(), {
20
- id: null,
21
- helpText: null,
22
- value: null,
23
- });
24
-
25
- const model = defineModel<boolean>();
26
-
27
- const internalValue = ref<boolean>(false);
28
- const $input = ref<HTMLInputElement | null>(null);
29
- const elementId = props.id || useUniqueId('toggle');
30
-
31
- onMounted((): void => {
32
- watch(model, (): void => {
33
- internalValue.value = $input.value!.checked;
34
- }, { immediate: true });
35
- });
36
-
37
- const classList = computed((): Record<string, boolean>[] => {
38
- return [
39
- { 'bg-brand-500 border-brand-700': internalValue.value },
40
- { 'bg-slate-200 border-slate-300': !internalValue.value },
41
- ];
42
- });
43
-
44
- const toggleClass = computed((): Record<string, boolean>[] => {
45
- return [
46
- { 'translate-x-4 border-brand-600': internalValue.value },
47
- { 'translate-x-0 border-slate-300': !internalValue.value },
48
- ];
49
- });
50
- </script>
51
-
52
- <template>
53
- <div class="flex items-start">
54
- <label>
55
- <input
56
- :id="elementId"
57
- ref="$input"
58
- v-model="model"
59
- type="checkbox"
60
- :value="value"
61
- class="hidden"
62
- >
63
-
64
- <span
65
- class="relative inline-flex h-6 w-10 flex-shrink-0 cursor-pointer rounded-full transition-colors ease-in-out duration-50"
66
- :class="classList"
67
- >
68
- <span
69
- class="pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0 transition ease-in-out mt-[4px] ml-[4px] duration-50"
70
- :class="toggleClass"
71
- />
72
- </span>
73
- </label>
74
-
75
- <span class="ml-4 font-normal pt-0.5 space-y-1">
76
- <InputLabel
77
- :label="label"
78
- :label-for="elementId"
79
- />
80
-
81
- <TextStyle
82
- v-if="helpText"
83
- variant="subdued"
84
- >
85
- {{ helpText }}
86
- </TextStyle>
87
- </span>
88
- </div>
89
- </template>
@@ -1 +0,0 @@
1
- export { default as Toggle } from './Toggle.vue';
@@ -1,51 +0,0 @@
1
- <script lang="ts" setup>
2
- import { Button, Tooltip } from '../../src/components';
3
- import api from '../component-meta/Tooltip.json';
4
- </script>
5
-
6
- # Tooltip
7
-
8
- Tooltips are floating labels that briefly explain the function of a user interface element. They can be triggered when
9
- users hover, focus, tap, or click.
10
-
11
- <ComponentApi :api="api" />
12
-
13
- ## Usage
14
-
15
- <ComponentWrapper>
16
- <Tooltip content="Tooltip contents">
17
- <Button>Trigger button for tooltip</Button>
18
- </Tooltip>
19
- </ComponentWrapper>
20
-
21
- ```js-vue
22
- <script lang="ts" setup>
23
- import { Button, Tooltip } from '@returnless/focus-ui';
24
- </script>
25
-
26
- <template>
27
- <Tooltip content="Tooltip contents">
28
- <Button>Trigger button for tooltip</Button>
29
- </Tooltip>
30
- </template>
31
- ```
32
-
33
- ## Best practices
34
-
35
- Tooltips should:
36
-
37
- - Provide useful, additional information or clarification.
38
- - Succinctly describe or expand on the element they point to.
39
- - Be provided for icon-only buttons or a button with an associated keyboard shortcut.
40
- - Not be used to communicate critical information, including errors in forms or other interaction feedback.
41
- - Not contain any links or buttons.
42
- - Be used sparingly. If you're building something that requires a lot of tooltips, work on clarifying the design and
43
- the language in experience.
44
-
45
- ## Content guidelines
46
-
47
- Tooltips should:
48
-
49
- - Be written in sentence case.
50
- - Be concise and scannable.
51
- - Not be used to communicate error messages or important account information.
@@ -1,24 +0,0 @@
1
- <script lang="ts" setup>
2
- import { PopperBody, Popper, PopperTrigger } from '../Popper';
3
-
4
- defineProps<{
5
- /** The content of the tooltip. */
6
- content: string;
7
- }>();
8
- </script>
9
-
10
- <template>
11
- <Popper
12
- trigger="hover"
13
- placement="top"
14
- >
15
- <PopperTrigger>
16
- <slot />
17
- </PopperTrigger>
18
- <PopperBody>
19
- <div class="rounded bg-black px-2 py-1 text-sm text-white">
20
- {{ content }}
21
- </div>
22
- </PopperBody>
23
- </Popper>
24
- </template>
@@ -1 +0,0 @@
1
- export { default as Tooltip } from './Tooltip.vue';
@@ -1,43 +0,0 @@
1
- <script lang="ts" setup>
2
- import {
3
- TopBar,
4
- TopBarLogo,
5
- TopBarNavigation,
6
- TopBarNavigationItem,
7
- TopBarSearch,
8
- TopBarUserMenu,
9
- } from '../../src/components';
10
- import api from '../component-meta/TopBar.json';
11
- </script>
12
-
13
- # Top bar
14
-
15
- The top bar is a header component that allows users to search, access menus, and navigate by clicking the logo. It's
16
- always visible at the top of the interface.
17
-
18
- <ComponentApi :api="api" />
19
-
20
- ## Usage
21
-
22
- <ComponentWrapper>
23
- <TopBar>
24
- <TopBarLogo />
25
- <TopBarNavigation>
26
- <TopBarNavigationItem>Item 1</TopBarNavigationItem>
27
- <TopBarNavigationItem>Item 2</TopBarNavigationItem>
28
- <TopBarNavigationItem>Item 3</TopBarNavigationItem>
29
- </TopBarNavigation>
30
- <TopBarSearch />
31
- <TopBarUserMenu />
32
- </TopBar>
33
- </ComponentWrapper>
34
-
35
- ## Best practices
36
-
37
- The top bar component should:
38
-
39
- - Not provide global navigation for an application. Use the navigation component instead.
40
- - Include search to help users find resources and navigate an application.
41
- - Include a user menu component to indicate the logged-in user and provide them with global actions.
42
- - Use an SVG file for the logo.
43
- - Show a navigation toggle, so it appears on small screens.
@@ -1,7 +0,0 @@
1
- <script lang="ts" setup></script>
2
-
3
- <template>
4
- <div class="flex h-16 items-center border-b bg-white px-4 shadow-sm space-x-4">
5
- <slot />
6
- </div>
7
- </template>
@@ -1,8 +0,0 @@
1
- <script lang="ts" setup>
2
- </script>
3
-
4
- <template>
5
- <div class="flex h-10 w-10 items-center justify-center rounded text-white bg-brand-500">
6
- logo
7
- </div>
8
- </template>
@@ -1,7 +0,0 @@
1
- <script lang="ts" setup></script>
2
-
3
- <template>
4
- <div class="flex flex-1 space-x-2">
5
- <slot />
6
- </div>
7
- </template>
@@ -1,13 +0,0 @@
1
- <script lang="ts" setup>
2
- import { useTheme } from '../../composables';
3
- </script>
4
-
5
- <template>
6
- <a
7
- class="hover:bg-slate-100 px-3 py-2 rounded border border-transparent"
8
- :class="useTheme('focus')"
9
- href="#"
10
- >
11
- <slot />
12
- </a>
13
- </template>
@@ -1,15 +0,0 @@
1
- <script lang="ts" setup>
2
- import { TextField } from '../TextField';
3
- </script>
4
-
5
- <template>
6
- <form role="search">
7
- <TextField
8
- label="Search"
9
- label-hidden
10
- name="search"
11
- type="search"
12
- placeholder="Search"
13
- />
14
- </form>
15
- </template>
@@ -1,20 +0,0 @@
1
- <script lang="ts" setup>
2
- import { Avatar } from '../Avatar';
3
- import { ChevronDownIcon } from '@heroicons/vue/16/solid';
4
- import { useTheme } from '../../composables';
5
- </script>
6
-
7
- <template>
8
- <button
9
- class="flex items-center rounded border px-3 py-2 shadow-sm space-x-2 hover:bg-slate-100"
10
- :class="useTheme('focus')"
11
- >
12
- <Avatar
13
- size="xs"
14
- name="demo user"
15
- initials="DU"
16
- />
17
- <p>demo@app.com</p>
18
- <ChevronDownIcon class="h-4 w-4" />
19
- </button>
20
- </template>