@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,12 +0,0 @@
1
- <script lang="ts" setup>
2
- import { Heading } from '../Heading';
3
- </script>
4
-
5
- <template>
6
- <Heading
7
- level="h1"
8
- size="2xl"
9
- >
10
- <slot />
11
- </Heading>
12
- </template>
@@ -1,226 +0,0 @@
1
- <script lang="ts" setup>
2
- import {
3
- Button,
4
- ButtonGroup,
5
- Card,
6
- CardHeader,
7
- CardTitle,
8
- CardDescription,
9
- CardSection,
10
- Page,
11
- PageBody,
12
- PageDescription,
13
- PageHeader,
14
- PageTitle,
15
- Navigation,
16
- NavigationItem,
17
- NavigationSection,
18
- } from '../../src/components';
19
- import api from '../component-meta/Page.json';
20
- </script>
21
-
22
- # Page
23
-
24
- Use to build the outer wrapper of a page, including the page title and associated actions.
25
-
26
- <ComponentApi :api="api" />
27
-
28
- ## Usage
29
-
30
- <ComponentWrapper>
31
- <Page>
32
- <PageHeader :back-action="{ content: 'Overview', href: '#' }">
33
- <PageTitle>The page title</PageTitle>
34
- <PageDescription>The page title</PageDescription>
35
- <template v-slot:page-header-actions>
36
- <ButtonGroup>
37
- <Button variant="secondary">Secondary action</Button>
38
- <Button>Primary action</Button>
39
- </ButtonGroup>
40
- </template>
41
- </PageHeader>
42
- <Card>
43
- <CardHeader>
44
- <CardTitle>Notifications</CardTitle>
45
- <CardDescription>You have 3 unread messages.</CardDescription>
46
- </CardHeader>
47
- <CardSection>
48
- <div>Card content</div>
49
- </CardSection>
50
- </Card>
51
- </Page>
52
- </ComponentWrapper>
53
-
54
- ```js-vue
55
- <script lang="ts" setup>
56
- import {
57
- Button,
58
- ButtonGroup,
59
- Card,
60
- CardHeader,
61
- CardTitle,
62
- CardDescription,
63
- CardSection,
64
- Page,
65
- PageDescription,
66
- PageHeader,
67
- PageTitle,
68
- } from '@returnless/focus-ui';
69
- </script>
70
-
71
- <template>
72
- <Page>
73
- <PageHeader v-bind:back-action="{ content: 'Overview', href: '#' }">
74
- <PageTitle>The page title</PageTitle>
75
- <PageDescription>The page title</PageDescription>
76
- <template v-slot:page-header-actions>
77
- <ButtonGroup>
78
- <Button variant="secondary">Secondary action</Button>
79
- <Button>Primary action</Button>
80
- </ButtonGroup>
81
- </template>
82
- </PageHeader>
83
- <Card>
84
- <CardHeader>
85
- <CardTitle>Notifications</CardTitle>
86
- <CardDescription>You have 3 unread messages.</CardDescription>
87
- </CardHeader>
88
- <CardSection>
89
- <div>Card content</div>
90
- </CardSection>
91
- </Card>
92
- </Page>
93
- </template>
94
- ```
95
-
96
- ### Page with navigation
97
-
98
- <ComponentWrapper>
99
- <Page>
100
- <PageHeader :back-action="{ content: 'Overview', href: '#' }">
101
- <PageTitle>The page title</PageTitle>
102
- <PageDescription>The page title</PageDescription>
103
- <template v-slot:page-header-actions>
104
- <ButtonGroup>
105
- <Button variant="secondary">Secondary action</Button>
106
- <Button>Primary action</Button>
107
- </ButtonGroup>
108
- </template>
109
- </PageHeader>
110
- <PageBody>
111
- <template #page-navigation>
112
- <Navigation>
113
- <NavigationSection>
114
- <NavigationItem active href="#">Navigation item 1</NavigationItem>
115
- <NavigationItem href="#">Navigation item 2</NavigationItem>
116
- <NavigationItem href="#">Navigation item 3</NavigationItem>
117
- </NavigationSection>
118
- </Navigation>
119
- </template>
120
- <Card>
121
- <CardHeader>
122
- <CardTitle>Notifications</CardTitle>
123
- <CardDescription>You have 3 unread messages.</CardDescription>
124
- </CardHeader>
125
- <CardSection>
126
- <div>Card content</div>
127
- </CardSection>
128
- </Card>
129
- </PageBody>
130
- </Page>
131
- </ComponentWrapper>
132
-
133
-
134
-
135
- ```js-vue
136
- <script lang="ts" setup>
137
- import {
138
- Button,
139
- ButtonGroup,
140
- Card,
141
- CardHeader,
142
- CardTitle,
143
- CardDescription,
144
- CardSection,
145
- Page,
146
- PageBody,
147
- PageDescription,
148
- PageHeader,
149
- PageTitle,
150
- Navigation,
151
- NavigationItem,
152
- NavigationSection,
153
- } from '@returnless/focus-ui';
154
- </script>
155
-
156
- <template>
157
- <Page>
158
- <PageHeader :back-action="{ content: 'Overview', href: '#' }">
159
- <PageTitle>The page title</PageTitle>
160
- <PageDescription>The page title</PageDescription>
161
- <template v-slot:page-header-actions>
162
- <ButtonGroup>
163
- <Button variant="secondary">Secondary action</Button>
164
- <Button>Primary action</Button>
165
- </ButtonGroup>
166
- </template>
167
- </PageHeader>
168
- <PageBody>
169
- <template #page-navigation>
170
- <Navigation>
171
- <NavigationSection>
172
- <NavigationItem active>Navigation item 1</NavigationItem>
173
- <NavigationItem>Navigation item 2</NavigationItem>
174
- <NavigationItem>Navigation item 3</NavigationItem>
175
- </NavigationSection>
176
- </Navigation>
177
- </template>
178
- <Card>
179
- <CardHeader>
180
- <CardTitle>Notifications</CardTitle>
181
- <CardDescription>You have 3 unread messages.</CardDescription>
182
- </CardHeader>
183
- <CardSection>
184
- <div>Card content</div>
185
- </CardSection>
186
- </Card>
187
- </PageBody>
188
- </Page>
189
- </template>
190
- ```
191
-
192
- ## Best practices
193
-
194
- The page component should:
195
-
196
- - Always provide a title for the page header.
197
- - Always provide breadcrumbs when a page has a parent page.
198
- - Be organized around a primary activity. If that primary activity is a single action, provide it as a primary button in
199
- the page header.
200
- - Provide other page-level actions as secondary actions in the page header.
201
- - When the page represents an object of a certain type, provide pagination links to the previous and next object of
202
- the same type.
203
-
204
- ## Content guidelines
205
-
206
- ### Title
207
-
208
- Titles should:
209
-
210
- - Describe the page in as few words as possible.
211
- - Be the name of the object type (pluralized) when the age is a list of objects. For a list of orders, the page
212
- title should be "Orders".
213
- - Not be truncated.
214
-
215
- ### Breadcrumbs
216
-
217
- The content of each breadcrumb link should be the title of the page to which it links.
218
-
219
- ### Page header actions
220
-
221
- Page header action labels should be:
222
-
223
- - Clear and predictable: users should be able to anticipate what will happen when they click a page action. Never
224
- deceive users by mislabeling an action.
225
- - Action-led: they should always lead with a strong verb that encourages action. To provide enough context to users,
226
- use the {verb + noun} format.
@@ -1,5 +0,0 @@
1
- export { default as Page } from './Page.vue';
2
- export { default as PageBody } from './PageBody.vue';
3
- export { default as PageDescription } from './PageDescription.vue';
4
- export { default as PageHeader } from './PageHeader.vue';
5
- export { default as PageTitle } from './PageTitle.vue';
@@ -1,8 +0,0 @@
1
- <script lang="ts" setup>
2
- </script>
3
-
4
- <template>
5
- <div class="flex space-x-1">
6
- <slot />
7
- </div>
8
- </template>
@@ -1,10 +0,0 @@
1
- <script lang="ts" setup>
2
- import { Button } from '../Button';
3
- import { ChevronRightIcon } from '@heroicons/vue/16/solid';
4
- </script>
5
-
6
- <template>
7
- <Button variant="secondary">
8
- <ChevronRightIcon class="w-4 h-4" />
9
- </Button>
10
- </template>
@@ -1,10 +0,0 @@
1
- <script lang="ts" setup>
2
- import { Button } from '../Button';
3
- import { ChevronLeftIcon } from '@heroicons/vue/16/solid';
4
- </script>
5
-
6
- <template>
7
- <Button variant="secondary">
8
- <ChevronLeftIcon class="w-4 h-4" />
9
- </Button>
10
- </template>
@@ -1,45 +0,0 @@
1
- <script lang="ts" setup>
2
- import { Pagination, PaginationPreviousButton, PaginationNextButton } from '../../src/components';
3
- import api from '../component-meta/Pagination.json';
4
- </script>
5
-
6
- # Pagination
7
-
8
- Use pagination to let users move through an ordered collection of items that has been split into pages. Pagination uses
9
- buttons to move back and forth between pages.
10
-
11
- <ComponentApi :api="api" />
12
-
13
- ## Usage
14
-
15
- <ComponentWrapper>
16
- <Pagination>
17
- <PaginationPreviousButton>Previous</PaginationPreviousButton>
18
- <PaginationNextButton>Next</PaginationNextButton>
19
- </Pagination>
20
- </ComponentWrapper>
21
-
22
- ```js-vue
23
- <script lang="ts" setup>
24
- import {
25
- Pagination,
26
- PaginationPreviousButton,
27
- PaginationNextButton,
28
- } from '@returnless/focus-ui';
29
- </script>
30
-
31
- <template>
32
- <Pagination>
33
- <PaginationPreviousButton>Previous</PaginationPreviousButton>
34
- <PaginationNextButton>Next</PaginationNextButton>
35
- </Pagination>
36
- </template>
37
- ```
38
-
39
- ## Best practices
40
-
41
- Pagination should:
42
-
43
- - Be placed at the bottom of a long list that has been split into pages.
44
- - Pagination should navigate to the previous and next set of items in the paged list.
45
- - Hint when users are at the first or the last page by disabling the corresponding button.
@@ -1,3 +0,0 @@
1
- export { default as Pagination } from './Pagination.vue';
2
- export { default as PaginationNextButton } from './PaginationNextButton.vue';
3
- export { default as PaginationPreviousButton } from './PaginationPreviousButton.vue';
@@ -1,169 +0,0 @@
1
- <script lang="ts" setup>
2
- import { ref } from 'vue';
3
-
4
- const props = withDefaults(defineProps<{
5
- inputs?: number;
6
- }>(), {
7
- inputs: 6,
8
- });
9
-
10
- const emit = defineEmits<{
11
- complete: [string];
12
- }>();
13
-
14
- const $otpInput = ref<HTMLInputElement[]>([]);
15
- const otp = ref(Array(props.inputs).fill(''));
16
- const activeInput = ref(0);
17
-
18
- function isInputValueValid(value: string): boolean {
19
- return !isNaN(Number(value))
20
- && value.trim().length === 1;
21
- }
22
-
23
- function handleOtpChange(otp: string[]): void {
24
- const otpValue = otp.join('');
25
-
26
- if (otpValue.length === props.inputs) {
27
- emit('complete', otpValue);
28
- }
29
- }
30
-
31
- function changeCodeAtFocus(value: string): void {
32
- otp.value[activeInput.value] = value;
33
-
34
- $otpInput.value[activeInput.value].value = value;
35
-
36
- handleOtpChange(otp.value);
37
- }
38
-
39
- function focusInput(index: number): void {
40
- const currentInput = Math.max(Math.min(props.inputs - 1, index), 0);
41
-
42
- if ($otpInput.value[currentInput]) {
43
- $otpInput.value[currentInput].focus();
44
- $otpInput.value[currentInput].select();
45
-
46
- activeInput.value = currentInput;
47
- }
48
- }
49
-
50
- function handleChange(event: Event): void {
51
- const value = (event.target as HTMLInputElement).value;
52
-
53
- if (isInputValueValid(value)) {
54
- changeCodeAtFocus(value);
55
- focusInput(activeInput.value + 1);
56
- }
57
- }
58
-
59
- function handleFocus(index: number, event: FocusEvent): void {
60
- activeInput.value = index - 1;
61
-
62
- (event.target as HTMLInputElement).select();
63
- }
64
-
65
- function handleInput(event: InputEvent | Event): void {
66
- const target = event.target as HTMLInputElement;
67
- const value = target.value;
68
-
69
- if (!isInputValueValid(value)) {
70
- // Pasting from the native autofill suggestion on a mobile device can pass
71
- // the pasted string as one long input to one of the cells. This ensures
72
- // that we handle the fill input and not just the first character.
73
- if (value.length === props.inputs) {
74
- const hasValidInput = value.split('').some((cellInput: string): boolean => !isInputValueValid(cellInput));
75
-
76
- if (!hasValidInput) {
77
- handleOtpChange(value.split(''));
78
- focusInput(props.inputs - 1);
79
- }
80
- }
81
-
82
- // Clear the input if it's not a valid value because firefox allows
83
- // pasting non-numeric characters in a number type input.
84
- target.value = '';
85
- }
86
- }
87
-
88
- function handleKeyDown(event: KeyboardEvent): void {
89
- if ([event.code, event.key].includes('Backspace')) {
90
- event.preventDefault();
91
-
92
- changeCodeAtFocus('');
93
- focusInput(activeInput.value - 1);
94
- } else if (event.code === 'Delete') {
95
- event.preventDefault();
96
-
97
- changeCodeAtFocus('');
98
- } else if (event.code === 'ArrowLeft') {
99
- event.preventDefault();
100
-
101
- focusInput(activeInput.value - 1);
102
- } else if (event.code === 'ArrowRight') {
103
- event.preventDefault();
104
-
105
- focusInput(activeInput.value + 1);
106
- } else if (
107
- event.code === 'Spacebar'
108
- || event.code === 'Space'
109
- || event.code === 'ArrowUp'
110
- || event.code === 'ArrowDown'
111
- ) {
112
- event.preventDefault();
113
- } else if (/^[0-9]$/i.test(event.key)) {
114
- event.preventDefault();
115
-
116
- if (isInputValueValid(event.key)) {
117
- changeCodeAtFocus(event.key);
118
- focusInput(activeInput.value + 1);
119
- }
120
- }
121
- }
122
-
123
- function handlePaste(event: ClipboardEvent): void {
124
- event.preventDefault();
125
-
126
- const pastedData = event.clipboardData!
127
- .getData('text/plain')
128
- .slice(0, props.inputs - activeInput.value)
129
- .split('');
130
-
131
- // Prevent pasting if the clipboard data contains non-numeric characters.
132
- if (pastedData.some((value) => isNaN(Number(value)))) {
133
- return;
134
- }
135
-
136
- for (let pos = 0; pos < props.inputs; ++pos) {
137
- if (pos >= activeInput.value && pastedData.length > 0) {
138
- if (pos >= pastedData.length) {
139
- break;
140
- }
141
-
142
- changeCodeAtFocus(pastedData[pos]);
143
- focusInput(activeInput.value + 1);
144
- }
145
- }
146
- }
147
- </script>
148
-
149
- <template>
150
- <div class="flex items-center space-x-2">
151
- <input
152
- v-for="pinInputIndex in inputs"
153
- :key="pinInputIndex"
154
- ref="$otpInput"
155
- autocomplete="off"
156
- class="border w-10 px-3 py-2 text-center rounded"
157
- pattern="[0-9]"
158
- placeholder="•"
159
- required
160
- type="text"
161
- inputmode="numeric"
162
- @change="handleChange"
163
- @focus="handleFocus(pinInputIndex, $event)"
164
- @input="handleInput"
165
- @keydown="handleKeyDown"
166
- @paste="handlePaste"
167
- >
168
- </div>
169
- </template>
@@ -1,35 +0,0 @@
1
- <script lang="ts" setup>
2
- import { ref } from 'vue';
3
- import { PinInput } from '../../src/components';
4
- import api from '../component-meta/PinInput.json';
5
-
6
- const otpCode = ref<string | null>(null);
7
-
8
- function onOtpComplete(otp: string): void {
9
- otpCode.value = otp;
10
- }
11
- </script>
12
-
13
- # Pin Input
14
-
15
- A Pin Input component is a form input that allows users to enter a pin code. It is commonly used in forms that require a
16
- user to enter a pin code, such as a 2FA forms.
17
-
18
- <ComponentApi :api="api" />
19
-
20
- ## Usage
21
-
22
- <ComponentWrapper>
23
- <PinInput @complete="onOtpComplete" />
24
- <div v-if="otpCode">OTP complete: {{ otpCode }}</div>
25
- </ComponentWrapper>
26
-
27
- ```js-vue
28
- <script lang="ts" setup>
29
- import { PinInput } from '@returnless/focus-ui';
30
- </script>
31
-
32
- <template>
33
- <PinInput />
34
- </template>
35
- ```
@@ -1 +0,0 @@
1
- export { default as PinInput } from './PinInput.vue';
@@ -1,18 +0,0 @@
1
- <script lang="ts" setup>
2
- import { Popper } from '../Popper';
3
- import { Alignment } from '@floating-ui/vue';
4
-
5
- defineProps<{
6
- /** The alignment of the popover */
7
- alignment: Alignment;
8
- }>();
9
- </script>
10
-
11
- <template>
12
- <Popper
13
- trigger="click"
14
- :placement="`bottom-${alignment}`"
15
- >
16
- <slot />
17
- </Popper>
18
- </template>
@@ -1,11 +0,0 @@
1
- <script lang="ts" setup>
2
- import { PopperBody } from '../Popper';
3
- </script>
4
-
5
- <template>
6
- <PopperBody>
7
- <div class="overflow-hidden rounded-md border bg-white shadow-lg">
8
- <slot />
9
- </div>
10
- </PopperBody>
11
- </template>
@@ -1,9 +0,0 @@
1
- <script lang="ts" setup>
2
- import { PopperTrigger } from '../Popper';
3
- </script>
4
-
5
- <template>
6
- <PopperTrigger>
7
- <slot />
8
- </PopperTrigger>
9
- </template>
@@ -1,79 +0,0 @@
1
- <script lang="ts" setup>
2
- import {
3
- Button,
4
- PopoverBody,
5
- Popover,
6
- PopoverTrigger,
7
- } from '../../src/components';
8
- import api from '../component-meta/Popover.json';
9
- </script>
10
-
11
- # Popover
12
-
13
- Popovers are small overlays that open on demand. They let users access additional content and actions without cluttering
14
- the page.
15
-
16
- <ComponentApi :api="api" />
17
-
18
- ## Usage
19
-
20
- <ComponentWrapper>
21
- <Popover alignment="start">
22
- <PopoverTrigger>
23
- <Button>Popper trigger</Button>
24
- </PopoverTrigger>
25
- <PopoverBody>
26
- <div class="p-4">
27
- Popover body content here
28
- </div>
29
- </PopoverBody>
30
- </Popover>
31
- </ComponentWrapper>
32
-
33
-
34
- ## Best practices
35
-
36
- Popovers should:
37
-
38
- - Always be positioned next to the button or other interface elements that triggers them.
39
- - Be used for secondary or less important information and actions since they're hidden until users hit the trigger.
40
- - Contain navigation or actions that share a relationship to each other.
41
- - Be triggered by a clearly labeled button.
42
- - Use a default or tertiary button for the trigger.
43
-
44
- ## Content guidelines
45
-
46
- If a popover contains actions, they should:
47
-
48
- - Be clear and predictable: users should be able to anticipate what will happen when they click on an action item.
49
- Never deceive users by mislabeling an action.
50
- - Be action-led: buttons should always lead with a strong verb that encourages action. To provide enough context to
51
- users use the {verb + noun} format on buttons except in the case of common actions like Save, Close, Cancel, or OK.
52
- - Be scannable, especially when the popover contains a list of actions or options. Avoid unnecessary words and
53
- articles such as "the", "an", or "a".
54
-
55
- If the popover includes a series of navigational links, each item should:
56
-
57
- - Be concise but will give users enough information, so they can easily find and accurately navigate to the path they
58
- want.
59
-
60
- ## Accessibility
61
-
62
- Popovers usually contain an `option list` or `action list`, but can also contain other controls or content.
63
-
64
- To assist screen readers with sending focus to an `action list`, pass `autofocusTarget="first-node"` to the
65
- `Popover`. This will avoid known issues a screen reader may have with keyboard support once focus is moved off the
66
- activator.
67
-
68
- Web browsers assign a default value of `menu` to the `aria-haspopup` role. You can use the prop `ariaHaspopup` to
69
- specify a value. Screen readers may fail to send focus to the `Popover` content when they expect the content to be
70
- adjacent to the element with `aria-haspopup` in the DOM tree. In this scenario, it is recommended not to provide
71
- the `ariaHaspopup` prop.
72
-
73
- ### Keyboard support
74
-
75
- - When a popover opens, focus moves to the first focusable element or to the popover container.
76
- - Once focus is in the popover, users can access controls in the popover using the tab key (and shift + tab
77
- backwards) and standard keystrokes for interacting.
78
- - Users can dismiss the popover by tabbing out of it, pressing the esc key, or clicking outside of it.
79
- - When the popover is closed, focus returns to the element that launched it.
@@ -1,3 +0,0 @@
1
- export { default as Popover } from './Popover.vue';
2
- export { default as PopoverBody } from './PopoverBody.vue';
3
- export { default as PopoverTrigger } from './PopoverTrigger.vue';