@sabrenski/spire-ui 0.0.1

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 (237) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +233 -0
  3. package/dist/index.d.ts +4981 -0
  4. package/dist/spire-ui.css +1 -0
  5. package/dist/spire-ui.es.js +18403 -0
  6. package/dist/spire-ui.umd.js +45 -0
  7. package/package.json +83 -0
  8. package/src/components/Accordion/Accordion.test.ts +218 -0
  9. package/src/components/Accordion/AccordionContent.vue +112 -0
  10. package/src/components/Accordion/AccordionItem.vue +87 -0
  11. package/src/components/Accordion/AccordionRoot.vue +111 -0
  12. package/src/components/Accordion/AccordionTrigger.vue +125 -0
  13. package/src/components/Accordion/index.ts +11 -0
  14. package/src/components/Accordion/keys.ts +23 -0
  15. package/src/components/Avatar/Avatar.test.ts +181 -0
  16. package/src/components/Avatar/Avatar.vue +150 -0
  17. package/src/components/Avatar/index.ts +2 -0
  18. package/src/components/Badge/Badge.test.ts +141 -0
  19. package/src/components/Badge/Badge.vue +133 -0
  20. package/src/components/Badge/index.ts +2 -0
  21. package/src/components/BadgeContainer/BadgeContainer.test.ts +150 -0
  22. package/src/components/BadgeContainer/BadgeContainer.vue +90 -0
  23. package/src/components/BadgeContainer/index.ts +2 -0
  24. package/src/components/Breadcrumb/Breadcrumb.test.ts +342 -0
  25. package/src/components/Breadcrumb/BreadcrumbEllipsis.vue +96 -0
  26. package/src/components/Breadcrumb/BreadcrumbItem.vue +16 -0
  27. package/src/components/Breadcrumb/BreadcrumbLink.vue +67 -0
  28. package/src/components/Breadcrumb/BreadcrumbList.vue +20 -0
  29. package/src/components/Breadcrumb/BreadcrumbPage.vue +25 -0
  30. package/src/components/Breadcrumb/BreadcrumbRoot.vue +41 -0
  31. package/src/components/Breadcrumb/BreadcrumbSeparator.vue +63 -0
  32. package/src/components/Breadcrumb/index.ts +13 -0
  33. package/src/components/Breadcrumb/keys.ts +7 -0
  34. package/src/components/Button/Button.test.ts +231 -0
  35. package/src/components/Button/Button.vue +349 -0
  36. package/src/components/Button/index.ts +2 -0
  37. package/src/components/Callout/Callout.test.ts +260 -0
  38. package/src/components/Callout/Callout.vue +341 -0
  39. package/src/components/Callout/index.ts +2 -0
  40. package/src/components/Card/Card.test.ts +565 -0
  41. package/src/components/Card/Card.vue +209 -0
  42. package/src/components/Card/CardContent.vue +57 -0
  43. package/src/components/Card/CardFooter.vue +72 -0
  44. package/src/components/Card/CardHeader.vue +111 -0
  45. package/src/components/Card/CardImage.vue +124 -0
  46. package/src/components/Card/index.ts +14 -0
  47. package/src/components/Chart/BarChart.vue +208 -0
  48. package/src/components/Chart/BaseChart.vue +444 -0
  49. package/src/components/Chart/Chart.test.ts +359 -0
  50. package/src/components/Chart/DonutChart.vue +283 -0
  51. package/src/components/Chart/LineChart.vue +211 -0
  52. package/src/components/Chart/index.ts +20 -0
  53. package/src/components/Chart/useChartTheme.ts +192 -0
  54. package/src/components/Checkbox/Checkbox.test.ts +209 -0
  55. package/src/components/Checkbox/Checkbox.vue +285 -0
  56. package/src/components/Checkbox/index.ts +2 -0
  57. package/src/components/ChoiceChip/ChoiceChip.test.ts +142 -0
  58. package/src/components/ChoiceChip/ChoiceChip.vue +218 -0
  59. package/src/components/ChoiceChip/index.ts +2 -0
  60. package/src/components/ChoiceChipGroup/ChoiceChipGroup.test.ts +151 -0
  61. package/src/components/ChoiceChipGroup/ChoiceChipGroup.vue +70 -0
  62. package/src/components/ChoiceChipGroup/index.ts +2 -0
  63. package/src/components/ColorPicker/ColorArea.vue +159 -0
  64. package/src/components/ColorPicker/ColorPicker.test.ts +250 -0
  65. package/src/components/ColorPicker/ColorPicker.vue +339 -0
  66. package/src/components/ColorPicker/ColorSlider.vue +191 -0
  67. package/src/components/ColorPicker/index.ts +7 -0
  68. package/src/components/Combobox/Combobox.test.ts +891 -0
  69. package/src/components/Combobox/Combobox.vue +934 -0
  70. package/src/components/Combobox/index.ts +2 -0
  71. package/src/components/DataTable/DataTable.test.ts +1221 -0
  72. package/src/components/DataTable/DataTable.vue +1415 -0
  73. package/src/components/DataTable/index.ts +10 -0
  74. package/src/components/DatePicker/DatePicker.test.ts +625 -0
  75. package/src/components/DatePicker/DatePicker.vue +1586 -0
  76. package/src/components/DatePicker/index.ts +2 -0
  77. package/src/components/Drawer/Drawer.test.ts +336 -0
  78. package/src/components/Drawer/Drawer.vue +466 -0
  79. package/src/components/Drawer/index.ts +2 -0
  80. package/src/components/Dropdown/Dropdown.test.ts +607 -0
  81. package/src/components/Dropdown/Dropdown.vue +807 -0
  82. package/src/components/Dropdown/DropdownItem.vue +227 -0
  83. package/src/components/Dropdown/DropdownSeparator.vue +14 -0
  84. package/src/components/Dropdown/DropdownSub.vue +104 -0
  85. package/src/components/Dropdown/DropdownSubContent.vue +187 -0
  86. package/src/components/Dropdown/DropdownSubTrigger.vue +151 -0
  87. package/src/components/Dropdown/index.ts +14 -0
  88. package/src/components/EmptyState/EmptyState.test.ts +180 -0
  89. package/src/components/EmptyState/EmptyState.vue +137 -0
  90. package/src/components/EmptyState/index.ts +2 -0
  91. package/src/components/FileUpload/FileUpload.test.ts +1151 -0
  92. package/src/components/FileUpload/FileUpload.vue +1042 -0
  93. package/src/components/FileUpload/index.ts +2 -0
  94. package/src/components/Heading/Heading.test.ts +107 -0
  95. package/src/components/Heading/Heading.vue +67 -0
  96. package/src/components/Heading/index.ts +2 -0
  97. package/src/components/Icon/Icon.test.ts +157 -0
  98. package/src/components/Icon/Icon.vue +86 -0
  99. package/src/components/Icon/index.ts +2 -0
  100. package/src/components/Input/Input.test.ts +273 -0
  101. package/src/components/Input/Input.vue +388 -0
  102. package/src/components/Input/index.ts +2 -0
  103. package/src/components/Layout/Container.vue +67 -0
  104. package/src/components/Layout/Grid.vue +159 -0
  105. package/src/components/Layout/GridItem.vue +154 -0
  106. package/src/components/Layout/Layout.test.ts +202 -0
  107. package/src/components/Layout/Stack.vue +128 -0
  108. package/src/components/Layout/index.ts +9 -0
  109. package/src/components/Layout/keys.ts +7 -0
  110. package/src/components/Modal/Modal.test.ts +311 -0
  111. package/src/components/Modal/Modal.vue +336 -0
  112. package/src/components/Modal/index.ts +2 -0
  113. package/src/components/Pagination/Pagination.test.ts +303 -0
  114. package/src/components/Pagination/Pagination.vue +212 -0
  115. package/src/components/Pagination/index.ts +3 -0
  116. package/src/components/Pagination/utils.ts +86 -0
  117. package/src/components/Popover/Popover.test.ts +285 -0
  118. package/src/components/Popover/Popover.vue +441 -0
  119. package/src/components/Popover/index.ts +2 -0
  120. package/src/components/Progress/Progress.test.ts +361 -0
  121. package/src/components/Progress/Progress.vue +363 -0
  122. package/src/components/Progress/index.ts +7 -0
  123. package/src/components/Radio/Radio.test.ts +216 -0
  124. package/src/components/Radio/Radio.vue +214 -0
  125. package/src/components/Radio/index.ts +2 -0
  126. package/src/components/Rating/Rating.test.ts +319 -0
  127. package/src/components/Rating/Rating.vue +247 -0
  128. package/src/components/Rating/index.ts +2 -0
  129. package/src/components/SegmentedControl/SegmentedControl.test.ts +292 -0
  130. package/src/components/SegmentedControl/SegmentedControl.vue +288 -0
  131. package/src/components/SegmentedControl/index.ts +2 -0
  132. package/src/components/Select/Select.test.ts +589 -0
  133. package/src/components/Select/Select.vue +666 -0
  134. package/src/components/Select/index.ts +2 -0
  135. package/src/components/Sidebar/Sidebar.test.ts +301 -0
  136. package/src/components/Sidebar/SidebarGroup.vue +103 -0
  137. package/src/components/Sidebar/SidebarItem.vue +196 -0
  138. package/src/components/Sidebar/SidebarLayout.vue +42 -0
  139. package/src/components/Sidebar/SidebarRoot.vue +122 -0
  140. package/src/components/Sidebar/index.ts +11 -0
  141. package/src/components/Sidebar/keys.ts +14 -0
  142. package/src/components/Skeleton/Skeleton.test.ts +130 -0
  143. package/src/components/Skeleton/Skeleton.vue +104 -0
  144. package/src/components/Skeleton/index.ts +2 -0
  145. package/src/components/Slider/Slider.test.ts +416 -0
  146. package/src/components/Slider/Slider.vue +435 -0
  147. package/src/components/Slider/index.ts +2 -0
  148. package/src/components/Slider/utils.ts +91 -0
  149. package/src/components/Spinner/Spinner.test.ts +79 -0
  150. package/src/components/Spinner/Spinner.vue +159 -0
  151. package/src/components/Spinner/index.ts +2 -0
  152. package/src/components/SpireProvider/SpireProvider.vue +71 -0
  153. package/src/components/SpireProvider/index.ts +11 -0
  154. package/src/components/Stepper/Stepper.test.ts +221 -0
  155. package/src/components/Stepper/StepperContent.vue +51 -0
  156. package/src/components/Stepper/StepperItem.vue +89 -0
  157. package/src/components/Stepper/StepperRoot.vue +101 -0
  158. package/src/components/Stepper/StepperSeparator.vue +52 -0
  159. package/src/components/Stepper/StepperTrigger.vue +144 -0
  160. package/src/components/Stepper/index.ts +11 -0
  161. package/src/components/Stepper/keys.ts +27 -0
  162. package/src/components/Switch/Switch.test.ts +214 -0
  163. package/src/components/Switch/Switch.vue +235 -0
  164. package/src/components/Switch/index.ts +2 -0
  165. package/src/components/Tabs/Tabs.test.ts +363 -0
  166. package/src/components/Tabs/Tabs.vue +318 -0
  167. package/src/components/Tabs/index.ts +2 -0
  168. package/src/components/Text/Text.test.ts +154 -0
  169. package/src/components/Text/Text.vue +100 -0
  170. package/src/components/Text/index.ts +2 -0
  171. package/src/components/Textarea/Textarea.test.ts +432 -0
  172. package/src/components/Textarea/Textarea.vue +411 -0
  173. package/src/components/Textarea/index.ts +2 -0
  174. package/src/components/TimePicker/TimePicker.test.ts +352 -0
  175. package/src/components/TimePicker/TimePicker.vue +569 -0
  176. package/src/components/TimePicker/index.ts +2 -0
  177. package/src/components/Timeline/Timeline.test.ts +193 -0
  178. package/src/components/Timeline/Timeline.vue +111 -0
  179. package/src/components/Timeline/TimelineItem.vue +167 -0
  180. package/src/components/Timeline/index.ts +13 -0
  181. package/src/components/Timeline/keys.ts +21 -0
  182. package/src/components/Toast/ToastItem.test.ts +289 -0
  183. package/src/components/Toast/ToastItem.vue +370 -0
  184. package/src/components/Toast/ToastProvider.test.ts +158 -0
  185. package/src/components/Toast/ToastProvider.vue +181 -0
  186. package/src/components/Toast/index.ts +83 -0
  187. package/src/components/Toast/toastState.test.ts +165 -0
  188. package/src/components/Toast/toastState.ts +161 -0
  189. package/src/components/ToggleButton/ToggleButton.test.ts +166 -0
  190. package/src/components/ToggleButton/ToggleButton.vue +197 -0
  191. package/src/components/ToggleButton/index.ts +2 -0
  192. package/src/components/ToggleGroup/ToggleGroup.test.ts +181 -0
  193. package/src/components/ToggleGroup/ToggleGroup.vue +130 -0
  194. package/src/components/ToggleGroup/index.ts +2 -0
  195. package/src/components/Tooltip/Tooltip.test.ts +238 -0
  196. package/src/components/Tooltip/Tooltip.vue +217 -0
  197. package/src/components/Tooltip/index.ts +2 -0
  198. package/src/components/TreeView/TreeView.test.ts +357 -0
  199. package/src/components/TreeView/TreeView.vue +251 -0
  200. package/src/components/TreeView/TreeViewItem.vue +288 -0
  201. package/src/components/TreeView/index.ts +11 -0
  202. package/src/components/TreeView/keys.ts +35 -0
  203. package/src/composables/index.ts +12 -0
  204. package/src/composables/useClickOutside.ts +36 -0
  205. package/src/composables/useClipboard.ts +35 -0
  206. package/src/composables/useEventListener.ts +48 -0
  207. package/src/composables/useFocusTrap.ts +58 -0
  208. package/src/composables/useHoverReveal.ts +98 -0
  209. package/src/composables/useId.ts +10 -0
  210. package/src/composables/useMagnetic.ts +171 -0
  211. package/src/composables/useRelativePosition.ts +127 -0
  212. package/src/composables/useRipple.ts +146 -0
  213. package/src/composables/useScrollLock.ts +25 -0
  214. package/src/composables/useSpireConfig.ts +27 -0
  215. package/src/composables/useStagger.ts +224 -0
  216. package/src/config/icons.test.ts +115 -0
  217. package/src/config/icons.ts +170 -0
  218. package/src/index.ts +361 -0
  219. package/src/styles/depth.css +129 -0
  220. package/src/styles/effects.css +169 -0
  221. package/src/styles/fallback.css +152 -0
  222. package/src/styles/main.css +25 -0
  223. package/src/styles/mood.css +211 -0
  224. package/src/styles/motion.css +159 -0
  225. package/src/styles/reset.css +97 -0
  226. package/src/styles/theme.css +708 -0
  227. package/src/styles/tokens.css +183 -0
  228. package/src/utils/.gitkeep +0 -0
  229. package/src/utils/color.ts +277 -0
  230. package/src/utils/date.test.ts +522 -0
  231. package/src/utils/date.ts +380 -0
  232. package/src/utils/index.ts +23 -0
  233. package/src/utils/object.test.ts +80 -0
  234. package/src/utils/object.ts +25 -0
  235. package/src/utils/string.test.ts +64 -0
  236. package/src/utils/string.ts +32 -0
  237. package/src/utils/time.ts +156 -0
@@ -0,0 +1,260 @@
1
+ import { describe, it, expect, vi } from 'vitest'
2
+ import { mount } from '@vue/test-utils'
3
+ import Callout from './Callout.vue'
4
+
5
+ describe('Callout', () => {
6
+ describe('Rendering', () => {
7
+ it('renders with default props', () => {
8
+ const wrapper = mount(Callout)
9
+ expect(wrapper.find('.ui-callout').exists()).toBe(true)
10
+ expect(wrapper.find('.ui-callout--info').exists()).toBe(true)
11
+ })
12
+
13
+ it('renders title from prop', () => {
14
+ const wrapper = mount(Callout, {
15
+ props: { title: 'Test Title' }
16
+ })
17
+ expect(wrapper.find('.ui-callout__title').text()).toBe('Test Title')
18
+ })
19
+
20
+ it('renders title from slot', () => {
21
+ const wrapper = mount(Callout, {
22
+ slots: {
23
+ title: 'Slot Title'
24
+ }
25
+ })
26
+ expect(wrapper.find('.ui-callout__title').text()).toBe('Slot Title')
27
+ })
28
+
29
+ it('renders body content from default slot', () => {
30
+ const wrapper = mount(Callout, {
31
+ slots: {
32
+ default: '<p>Body content</p>'
33
+ }
34
+ })
35
+ expect(wrapper.find('.ui-callout__body').exists()).toBe(true)
36
+ expect(wrapper.find('.ui-callout__body p').text()).toBe('Body content')
37
+ })
38
+
39
+ it('renders both title and body', () => {
40
+ const wrapper = mount(Callout, {
41
+ props: { title: 'Title' },
42
+ slots: {
43
+ default: 'Body text'
44
+ }
45
+ })
46
+ expect(wrapper.find('.ui-callout__title').text()).toBe('Title')
47
+ expect(wrapper.find('.ui-callout__body').text()).toBe('Body text')
48
+ })
49
+
50
+ it('does not render title element when no title provided', () => {
51
+ const wrapper = mount(Callout, {
52
+ slots: {
53
+ default: 'Body only'
54
+ }
55
+ })
56
+ expect(wrapper.find('.ui-callout__title').exists()).toBe(false)
57
+ })
58
+
59
+ it('does not render body element when no default slot', () => {
60
+ const wrapper = mount(Callout, {
61
+ props: { title: 'Title only' }
62
+ })
63
+ expect(wrapper.find('.ui-callout__body').exists()).toBe(false)
64
+ })
65
+ })
66
+
67
+ describe('Variants', () => {
68
+ it.each([
69
+ ['info', '.ui-callout--info'],
70
+ ['success', '.ui-callout--success'],
71
+ ['warning', '.ui-callout--warning'],
72
+ ['error', '.ui-callout--error'],
73
+ ['neutral', '.ui-callout--neutral']
74
+ ])('applies %s variant class', (variant, expectedClass) => {
75
+ const wrapper = mount(Callout, {
76
+ props: { variant: variant as any }
77
+ })
78
+ expect(wrapper.find(expectedClass).exists()).toBe(true)
79
+ })
80
+ })
81
+
82
+ describe('Accent border', () => {
83
+ it('applies accent class when accent prop is true', () => {
84
+ const wrapper = mount(Callout, {
85
+ props: { accent: true }
86
+ })
87
+ expect(wrapper.find('.ui-callout--accent').exists()).toBe(true)
88
+ })
89
+
90
+ it('does not apply accent class by default', () => {
91
+ const wrapper = mount(Callout)
92
+ expect(wrapper.find('.ui-callout--accent').exists()).toBe(false)
93
+ })
94
+ })
95
+
96
+ describe('Icons', () => {
97
+ it('renders icon by default', () => {
98
+ const wrapper = mount(Callout)
99
+ expect(wrapper.find('.ui-callout__icon').exists()).toBe(true)
100
+ expect(wrapper.find('.ui-callout__icon svg').exists()).toBe(true)
101
+ })
102
+
103
+ it('hides icon when hideIcon is true', () => {
104
+ const wrapper = mount(Callout, {
105
+ props: { hideIcon: true }
106
+ })
107
+ expect(wrapper.find('.ui-callout__icon').exists()).toBe(false)
108
+ })
109
+
110
+ it('renders custom icon from slot', () => {
111
+ const wrapper = mount(Callout, {
112
+ slots: {
113
+ icon: '<span data-testid="custom-icon">★</span>'
114
+ }
115
+ })
116
+ expect(wrapper.find('[data-testid="custom-icon"]').exists()).toBe(true)
117
+ })
118
+
119
+ it('does not render icon slot when hideIcon is true', () => {
120
+ const wrapper = mount(Callout, {
121
+ props: { hideIcon: true },
122
+ slots: {
123
+ icon: '<span data-testid="custom-icon">★</span>'
124
+ }
125
+ })
126
+ expect(wrapper.find('[data-testid="custom-icon"]').exists()).toBe(false)
127
+ expect(wrapper.find('.ui-callout__icon').exists()).toBe(false)
128
+ })
129
+
130
+ it.each([
131
+ ['info', 'info icon'],
132
+ ['success', 'checkmark icon'],
133
+ ['warning', 'triangle icon'],
134
+ ['error', 'x icon'],
135
+ ['neutral', 'info icon']
136
+ ])('renders appropriate icon for %s variant', (variant) => {
137
+ const wrapper = mount(Callout, {
138
+ props: { variant: variant as any }
139
+ })
140
+ expect(wrapper.find('.ui-callout__icon svg').exists()).toBe(true)
141
+ })
142
+ })
143
+
144
+ describe('Dismissible', () => {
145
+ it('does not render close button by default', () => {
146
+ const wrapper = mount(Callout)
147
+ expect(wrapper.find('.ui-callout__close').exists()).toBe(false)
148
+ })
149
+
150
+ it('renders close button when dismissible is true', () => {
151
+ const wrapper = mount(Callout, {
152
+ props: { dismissible: true }
153
+ })
154
+ expect(wrapper.find('.ui-callout__close').exists()).toBe(true)
155
+ })
156
+
157
+ it('emits close event when close button clicked', async () => {
158
+ const wrapper = mount(Callout, {
159
+ props: { dismissible: true }
160
+ })
161
+ await wrapper.find('.ui-callout__close').trigger('click')
162
+ expect(wrapper.emitted('close')).toHaveLength(1)
163
+ })
164
+
165
+ it('close button has aria-label', () => {
166
+ const wrapper = mount(Callout, {
167
+ props: { dismissible: true }
168
+ })
169
+ expect(wrapper.find('.ui-callout__close').attributes('aria-label')).toBe('Dismiss')
170
+ })
171
+ })
172
+
173
+ describe('Action slot', () => {
174
+ it('renders action slot content', () => {
175
+ const wrapper = mount(Callout, {
176
+ slots: {
177
+ action: '<button data-testid="action-btn">Action</button>'
178
+ }
179
+ })
180
+ expect(wrapper.find('[data-testid="action-btn"]').exists()).toBe(true)
181
+ })
182
+
183
+ it('renders action slot alongside close button', () => {
184
+ const wrapper = mount(Callout, {
185
+ props: { dismissible: true },
186
+ slots: {
187
+ action: '<button data-testid="action-btn">Action</button>'
188
+ }
189
+ })
190
+ expect(wrapper.find('[data-testid="action-btn"]').exists()).toBe(true)
191
+ expect(wrapper.find('.ui-callout__close').exists()).toBe(true)
192
+ })
193
+
194
+ it('does not render actions container when no action or dismissible', () => {
195
+ const wrapper = mount(Callout, {
196
+ props: { title: 'Title' }
197
+ })
198
+ expect(wrapper.find('.ui-callout__actions').exists()).toBe(false)
199
+ })
200
+ })
201
+
202
+ describe('Accessibility', () => {
203
+ it('has role="alert" for error variant', () => {
204
+ const wrapper = mount(Callout, {
205
+ props: { variant: 'error' }
206
+ })
207
+ expect(wrapper.find('.ui-callout').attributes('role')).toBe('alert')
208
+ })
209
+
210
+ it('has role="status" for info variant', () => {
211
+ const wrapper = mount(Callout, {
212
+ props: { variant: 'info' }
213
+ })
214
+ expect(wrapper.find('.ui-callout').attributes('role')).toBe('status')
215
+ })
216
+
217
+ it('has role="status" for success variant', () => {
218
+ const wrapper = mount(Callout, {
219
+ props: { variant: 'success' }
220
+ })
221
+ expect(wrapper.find('.ui-callout').attributes('role')).toBe('status')
222
+ })
223
+
224
+ it('has role="status" for warning variant', () => {
225
+ const wrapper = mount(Callout, {
226
+ props: { variant: 'warning' }
227
+ })
228
+ expect(wrapper.find('.ui-callout').attributes('role')).toBe('status')
229
+ })
230
+
231
+ it('has role="status" for neutral variant', () => {
232
+ const wrapper = mount(Callout, {
233
+ props: { variant: 'neutral' }
234
+ })
235
+ expect(wrapper.find('.ui-callout').attributes('role')).toBe('status')
236
+ })
237
+
238
+ it('icons have aria-hidden', () => {
239
+ const wrapper = mount(Callout)
240
+ expect(wrapper.find('.ui-callout__icon svg').attributes('aria-hidden')).toBe('true')
241
+ })
242
+ })
243
+
244
+ describe('Layout', () => {
245
+ it('icon container has flex-shrink-0', () => {
246
+ const wrapper = mount(Callout)
247
+ const icon = wrapper.find('.ui-callout__icon')
248
+ expect(icon.exists()).toBe(true)
249
+ })
250
+
251
+ it('content container takes remaining space', () => {
252
+ const wrapper = mount(Callout, {
253
+ props: { title: 'Title' },
254
+ slots: { default: 'Body' }
255
+ })
256
+ const content = wrapper.find('.ui-callout__content')
257
+ expect(content.exists()).toBe(true)
258
+ })
259
+ })
260
+ })
@@ -0,0 +1,341 @@
1
+ <script setup lang="ts">
2
+ import { computed, useSlots } from 'vue'
3
+
4
+ export type CalloutVariant = 'info' | 'success' | 'warning' | 'error' | 'neutral'
5
+
6
+ export interface CalloutProps {
7
+ /** Visual variant determining color and icon */
8
+ variant?: CalloutVariant
9
+ /** Title text (alternative to #title slot) */
10
+ title?: string
11
+ /** Show left accent border instead of full border */
12
+ accent?: boolean
13
+ /** Show dismiss button */
14
+ dismissible?: boolean
15
+ /** Hide the default icon */
16
+ hideIcon?: boolean
17
+ }
18
+
19
+ const props = withDefaults(defineProps<CalloutProps>(), {
20
+ variant: 'info',
21
+ accent: false,
22
+ dismissible: false,
23
+ hideIcon: false
24
+ })
25
+
26
+ const emit = defineEmits<{
27
+ close: []
28
+ }>()
29
+
30
+ defineSlots<{
31
+ default?(): unknown
32
+ title?(): unknown
33
+ icon?(): unknown
34
+ action?(): unknown
35
+ }>()
36
+
37
+ const slots = useSlots()
38
+
39
+ const hasTitle = computed(() => !!props.title || !!slots.title)
40
+
41
+ const ariaRole = computed(() => {
42
+ if (props.variant === 'error') return 'alert'
43
+ return 'status'
44
+ })
45
+
46
+ const calloutClasses = computed(() => [
47
+ 'ui-callout',
48
+ `ui-callout--${props.variant}`,
49
+ {
50
+ 'ui-callout--accent': props.accent
51
+ }
52
+ ])
53
+ </script>
54
+
55
+ <template>
56
+ <div
57
+ :class="calloutClasses"
58
+ :role="ariaRole"
59
+ >
60
+ <div v-if="!hideIcon" class="ui-callout__icon">
61
+ <slot name="icon">
62
+ <!-- Info icon -->
63
+ <svg
64
+ v-if="variant === 'info' || variant === 'neutral'"
65
+ width="20"
66
+ height="20"
67
+ viewBox="0 0 24 24"
68
+ fill="none"
69
+ stroke="currentColor"
70
+ stroke-width="2"
71
+ stroke-linecap="round"
72
+ stroke-linejoin="round"
73
+ aria-hidden="true"
74
+ >
75
+ <circle cx="12" cy="12" r="10" />
76
+ <path d="M12 16v-4" />
77
+ <path d="M12 8h.01" />
78
+ </svg>
79
+
80
+ <!-- Success icon -->
81
+ <svg
82
+ v-else-if="variant === 'success'"
83
+ width="20"
84
+ height="20"
85
+ viewBox="0 0 24 24"
86
+ fill="none"
87
+ stroke="currentColor"
88
+ stroke-width="2"
89
+ stroke-linecap="round"
90
+ stroke-linejoin="round"
91
+ aria-hidden="true"
92
+ >
93
+ <circle cx="12" cy="12" r="10" />
94
+ <path d="M9 12l2 2 4-4" />
95
+ </svg>
96
+
97
+ <!-- Warning icon -->
98
+ <svg
99
+ v-else-if="variant === 'warning'"
100
+ width="20"
101
+ height="20"
102
+ viewBox="0 0 24 24"
103
+ fill="none"
104
+ stroke="currentColor"
105
+ stroke-width="2"
106
+ stroke-linecap="round"
107
+ stroke-linejoin="round"
108
+ aria-hidden="true"
109
+ >
110
+ <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" />
111
+ <path d="M12 9v4" />
112
+ <path d="M12 17h.01" />
113
+ </svg>
114
+
115
+ <!-- Error icon -->
116
+ <svg
117
+ v-else-if="variant === 'error'"
118
+ width="20"
119
+ height="20"
120
+ viewBox="0 0 24 24"
121
+ fill="none"
122
+ stroke="currentColor"
123
+ stroke-width="2"
124
+ stroke-linecap="round"
125
+ stroke-linejoin="round"
126
+ aria-hidden="true"
127
+ >
128
+ <circle cx="12" cy="12" r="10" />
129
+ <path d="M15 9l-6 6" />
130
+ <path d="M9 9l6 6" />
131
+ </svg>
132
+ </slot>
133
+ </div>
134
+
135
+ <div class="ui-callout__content">
136
+ <div v-if="hasTitle" class="ui-callout__title">
137
+ <slot name="title">{{ title }}</slot>
138
+ </div>
139
+ <div v-if="$slots.default" class="ui-callout__body">
140
+ <slot />
141
+ </div>
142
+ </div>
143
+
144
+ <div v-if="$slots.action || dismissible" class="ui-callout__actions">
145
+ <slot name="action" />
146
+ <button
147
+ v-if="dismissible"
148
+ type="button"
149
+ class="ui-callout__close"
150
+ aria-label="Dismiss"
151
+ @click="emit('close')"
152
+ >
153
+ <svg
154
+ width="16"
155
+ height="16"
156
+ viewBox="0 0 24 24"
157
+ fill="none"
158
+ stroke="currentColor"
159
+ stroke-width="2"
160
+ stroke-linecap="round"
161
+ stroke-linejoin="round"
162
+ aria-hidden="true"
163
+ >
164
+ <path d="M18 6L6 18" />
165
+ <path d="M6 6l12 12" />
166
+ </svg>
167
+ </button>
168
+ </div>
169
+ </div>
170
+ </template>
171
+
172
+ <style scoped>
173
+ .ui-callout {
174
+ display: flex;
175
+ gap: var(--space-3);
176
+ padding: var(--space-4);
177
+ border-radius: var(--radius-lg);
178
+ font-family: var(--font-sans);
179
+ }
180
+
181
+ /* Info variant */
182
+ .ui-callout--info {
183
+ background-color: var(--callout-info-bg, var(--status-info-bg));
184
+ border: 1px solid var(--callout-info-border, var(--color-indigo-200));
185
+ color: var(--callout-info-text, var(--color-indigo-900));
186
+ }
187
+
188
+ .ui-callout--info.ui-callout--accent {
189
+ border: none;
190
+ border-left: 4px solid var(--callout-info-accent, var(--color-indigo-500));
191
+ border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
192
+ }
193
+
194
+ .ui-callout--info .ui-callout__icon {
195
+ color: var(--callout-info-icon, var(--color-indigo-500));
196
+ }
197
+
198
+ /* Success variant */
199
+ .ui-callout--success {
200
+ background-color: var(--callout-success-bg, var(--status-success-bg));
201
+ border: 1px solid var(--callout-success-border, var(--color-teal-200));
202
+ color: var(--callout-success-text, var(--color-teal-900));
203
+ }
204
+
205
+ .ui-callout--success.ui-callout--accent {
206
+ border: none;
207
+ border-left: 4px solid var(--callout-success-accent, var(--color-teal-500));
208
+ border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
209
+ }
210
+
211
+ .ui-callout--success .ui-callout__icon {
212
+ color: var(--callout-success-icon, var(--color-teal-500));
213
+ }
214
+
215
+ /* Warning variant */
216
+ .ui-callout--warning {
217
+ background-color: var(--callout-warning-bg, var(--status-warning-bg));
218
+ border: 1px solid var(--callout-warning-border, var(--color-amber-200));
219
+ color: var(--callout-warning-text, var(--color-amber-900));
220
+ }
221
+
222
+ .ui-callout--warning.ui-callout--accent {
223
+ border: none;
224
+ border-left: 4px solid var(--callout-warning-accent, var(--color-amber-500));
225
+ border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
226
+ }
227
+
228
+ .ui-callout--warning .ui-callout__icon {
229
+ color: var(--callout-warning-icon, var(--color-amber-500));
230
+ }
231
+
232
+ /* Error variant */
233
+ .ui-callout--error {
234
+ background-color: var(--callout-error-bg, var(--status-error-bg));
235
+ border: 1px solid var(--callout-error-border, var(--color-coral-200));
236
+ color: var(--callout-error-text, var(--color-coral-900));
237
+ }
238
+
239
+ .ui-callout--error.ui-callout--accent {
240
+ border: none;
241
+ border-left: 4px solid var(--callout-error-accent, var(--color-coral-500));
242
+ border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
243
+ }
244
+
245
+ .ui-callout--error .ui-callout__icon {
246
+ color: var(--callout-error-icon, var(--color-coral-500));
247
+ }
248
+
249
+ /* Neutral variant */
250
+ .ui-callout--neutral {
251
+ background-color: var(--callout-neutral-bg, var(--color-stone-100));
252
+ border: 1px solid var(--callout-neutral-border, var(--color-stone-200));
253
+ color: var(--callout-neutral-text, var(--color-stone-900));
254
+ }
255
+
256
+ .ui-callout--neutral.ui-callout--accent {
257
+ border: none;
258
+ border-left: 4px solid var(--callout-neutral-accent, var(--color-stone-400));
259
+ border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
260
+ }
261
+
262
+ .ui-callout--neutral .ui-callout__icon {
263
+ color: var(--callout-neutral-icon, var(--color-stone-500));
264
+ }
265
+
266
+ /* Icon - pinned to top */
267
+ .ui-callout__icon {
268
+ flex-shrink: 0;
269
+ align-self: flex-start;
270
+ display: flex;
271
+ align-items: center;
272
+ justify-content: center;
273
+ }
274
+
275
+ /* Content */
276
+ .ui-callout__content {
277
+ flex: 1;
278
+ min-width: 0;
279
+ }
280
+
281
+ .ui-callout__title {
282
+ font-weight: var(--font-medium);
283
+ font-size: var(--text-sm);
284
+ line-height: var(--leading-tight);
285
+ }
286
+
287
+ .ui-callout__body {
288
+ font-size: var(--text-sm);
289
+ line-height: var(--leading-relaxed);
290
+ margin-top: var(--space-1);
291
+ }
292
+
293
+ .ui-callout__title + .ui-callout__body {
294
+ margin-top: var(--space-1);
295
+ }
296
+
297
+ /* Actions */
298
+ .ui-callout__actions {
299
+ flex-shrink: 0;
300
+ align-self: flex-start;
301
+ display: flex;
302
+ align-items: center;
303
+ gap: var(--space-2);
304
+ }
305
+
306
+ .ui-callout__close {
307
+ display: flex;
308
+ align-items: center;
309
+ justify-content: center;
310
+ width: 24px;
311
+ height: 24px;
312
+ padding: 0;
313
+ background: transparent;
314
+ border: none;
315
+ border-radius: var(--radius-sm);
316
+ cursor: pointer;
317
+ opacity: 0.7;
318
+ transition: opacity var(--duration-fast) var(--ease-default);
319
+ }
320
+
321
+ .ui-callout__close:hover {
322
+ opacity: 1;
323
+ }
324
+
325
+ .ui-callout__close:focus-visible {
326
+ outline: 2px solid currentColor;
327
+ outline-offset: 2px;
328
+ opacity: 1;
329
+ }
330
+
331
+ /* Links inside callout body */
332
+ .ui-callout__body :deep(a) {
333
+ font-weight: var(--font-medium);
334
+ text-decoration: underline;
335
+ text-underline-offset: 2px;
336
+ }
337
+
338
+ .ui-callout__body :deep(a:hover) {
339
+ text-decoration-thickness: 2px;
340
+ }
341
+ </style>
@@ -0,0 +1,2 @@
1
+ export { default as Callout } from './Callout.vue'
2
+ export type { CalloutProps, CalloutVariant } from './Callout.vue'