@indielayer/ui 1.0.0-alpha.9 → 1.0.2

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 (293) hide show
  1. package/README.md +6 -3
  2. package/lib/common/icons.d.ts +15 -0
  3. package/lib/common/utils.d.ts +32 -0
  4. package/lib/components/alert/Alert.theme.d.ts +8 -0
  5. package/lib/components/alert/Alert.vue.d.ts +1 -12
  6. package/lib/components/alert/__tests__/Alert.spec.d.ts +1 -0
  7. package/lib/components/avatar/Avatar.theme.d.ts +8 -0
  8. package/lib/components/avatar/Avatar.vue.d.ts +5 -8
  9. package/lib/components/avatar/__tests__/Avatar.spec.d.ts +1 -0
  10. package/lib/components/badge/Badge.theme.d.ts +8 -0
  11. package/lib/components/badge/Badge.vue.d.ts +5 -6
  12. package/lib/components/badge/__tests__/Badge.spec.d.ts +1 -0
  13. package/lib/components/breadcrumbs/Breadcrumbs.theme.d.ts +8 -0
  14. package/lib/components/breadcrumbs/Breadcrumbs.vue.d.ts +19 -8
  15. package/lib/components/breadcrumbs/__tests__/Breadcrumbs.spec.d.ts +1 -0
  16. package/lib/components/button/Button.theme.d.ts +10 -0
  17. package/lib/components/button/Button.vue.d.ts +10 -16
  18. package/lib/components/button/ButtonGroup.theme.d.ts +6 -0
  19. package/lib/components/button/ButtonGroup.vue.d.ts +5 -2
  20. package/lib/components/button/__tests__/ Button.spec.d.ts +1 -0
  21. package/lib/components/button/__tests__/ ButtonGroup.spec.d.ts +1 -0
  22. package/lib/components/card/Card.theme.d.ts +7 -0
  23. package/lib/components/card/Card.vue.d.ts +2 -2
  24. package/lib/components/card/__tests__/Card.spec.d.ts +1 -0
  25. package/lib/components/checkbox/Checkbox.theme.d.ts +11 -0
  26. package/lib/components/checkbox/Checkbox.vue.d.ts +10 -14
  27. package/lib/components/checkbox/__tests__/Checkbox.spec.d.ts +1 -0
  28. package/lib/components/collapse/Collapse.theme.d.ts +9 -0
  29. package/lib/components/collapse/Collapse.vue.d.ts +12 -19
  30. package/lib/components/collapse/__tests__/Collapse.spec.d.ts +1 -0
  31. package/lib/components/container/Container.theme.d.ts +6 -0
  32. package/lib/components/container/Container.vue.d.ts +1 -1
  33. package/lib/components/container/__tests__/Container.spec.d.ts +1 -0
  34. package/lib/components/divider/Divider.theme.d.ts +9 -0
  35. package/lib/components/divider/Divider.vue.d.ts +1 -1
  36. package/lib/components/divider/__tests__/Divider.spec.d.ts +1 -0
  37. package/lib/components/drawer/Drawer.theme.d.ts +7 -0
  38. package/lib/components/drawer/Drawer.vue.d.ts +3 -15
  39. package/lib/components/drawer/__tests__/Drawer.spec.d.ts +1 -0
  40. package/lib/components/form/Form.theme.d.ts +6 -0
  41. package/lib/components/form/Form.vue.d.ts +9 -7
  42. package/lib/components/form/__tests__/Form.spec.d.ts +1 -0
  43. package/lib/components/helpers/InputError.d.ts +8 -0
  44. package/lib/components/icon/Icon.theme.d.ts +7 -0
  45. package/lib/components/icon/Icon.vue.d.ts +4 -8
  46. package/lib/components/icon/__tests__/Icon.spec.d.ts +1 -0
  47. package/lib/components/image/Image.theme.d.ts +6 -0
  48. package/lib/components/image/Image.vue.d.ts +1 -3
  49. package/lib/components/image/__tests__/Image.spec.d.ts +1 -0
  50. package/lib/components/index.d.ts +3 -3
  51. package/lib/components/input/Input.theme.d.ts +11 -0
  52. package/lib/components/input/Input.vue.d.ts +27 -25
  53. package/lib/components/input/__tests__/Input.spec.d.ts +1 -0
  54. package/lib/components/link/Link.theme.d.ts +8 -0
  55. package/lib/components/link/Link.vue.d.ts +3 -5
  56. package/lib/components/link/__tests__/Link.spec.d.ts +1 -0
  57. package/lib/components/menu/Menu.theme.d.ts +6 -0
  58. package/lib/components/menu/Menu.vue.d.ts +6 -3
  59. package/lib/components/menu/MenuItem.theme.d.ts +8 -0
  60. package/lib/components/menu/MenuItem.vue.d.ts +5 -30
  61. package/lib/components/menu/__tests__/Menu.spec.d.ts +1 -0
  62. package/lib/components/menu/__tests__/MenuItem.spec.d.ts +1 -0
  63. package/lib/components/modal/Modal.theme.d.ts +13 -0
  64. package/lib/components/modal/Modal.vue.d.ts +1 -6
  65. package/lib/components/modal/__tests__/Modal.spec.d.ts +1 -0
  66. package/lib/components/notifications/Notifications.theme.d.ts +8 -0
  67. package/lib/components/notifications/Notifications.vue.d.ts +11 -24
  68. package/lib/components/notifications/__tests__/Notifications.spec.d.ts +1 -0
  69. package/lib/components/pagination/Pagination.theme.d.ts +9 -0
  70. package/lib/components/pagination/Pagination.vue.d.ts +7 -16
  71. package/lib/components/pagination/PaginationItem.theme.d.ts +7 -0
  72. package/lib/components/pagination/PaginationItem.vue.d.ts +4 -3
  73. package/lib/components/pagination/__tests__/Pagination.spec.d.ts +1 -0
  74. package/lib/components/pagination/__tests__/PaginationItem.spec.d.ts +1 -0
  75. package/lib/components/popover/Popover.theme.d.ts +7 -0
  76. package/lib/components/popover/Popover.vue.d.ts +13 -13
  77. package/lib/components/popover/PopoverContainer.theme.d.ts +6 -0
  78. package/lib/components/popover/PopoverContainer.vue.d.ts +1 -1
  79. package/lib/components/popover/__tests__/Popover.spec.d.ts +1 -0
  80. package/lib/components/popover/__tests__/PopoverContainer.spec.d.ts +1 -0
  81. package/lib/components/progress/Progress.theme.d.ts +10 -0
  82. package/lib/components/progress/Progress.vue.d.ts +1 -3
  83. package/lib/components/progress/__tests__/Progress.spec.d.ts +1 -0
  84. package/lib/components/radio/Radio.theme.d.ts +12 -0
  85. package/lib/components/radio/Radio.vue.d.ts +12 -13
  86. package/lib/components/radio/__tests__/Radio.spec.d.ts +1 -0
  87. package/lib/components/scroll/Scroll.theme.d.ts +6 -0
  88. package/lib/components/scroll/Scroll.vue.d.ts +1 -7
  89. package/lib/components/scroll/__tests__/Scroll.spec.d.ts +1 -0
  90. package/lib/components/select/Select.theme.d.ts +13 -0
  91. package/lib/components/select/Select.vue.d.ts +8 -28
  92. package/lib/components/select/__tests__/Select.spec.d.ts +1 -0
  93. package/lib/components/skeleton/Skeleton.theme.d.ts +6 -0
  94. package/lib/components/skeleton/Skeleton.vue.d.ts +1 -1
  95. package/lib/components/skeleton/__tests__/Skeleton.spec.d.ts +1 -0
  96. package/lib/components/slider/Slider.theme.d.ts +10 -0
  97. package/lib/components/slider/Slider.vue.d.ts +8 -17
  98. package/lib/components/slider/__tests__/Slider.spec.d.ts +1 -0
  99. package/lib/components/spacer/Spacer.d.ts +2 -0
  100. package/lib/components/spacer/__tests__/Spacer.spec.d.ts +1 -0
  101. package/lib/components/spinner/Spinner.vue.d.ts +15 -6
  102. package/lib/components/spinner/__tests__/Spinner.spec.d.ts +1 -0
  103. package/lib/components/tab/Tab.theme.d.ts +9 -0
  104. package/lib/components/tab/Tab.vue.d.ts +4 -13
  105. package/lib/components/tab/TabGroup.theme.d.ts +10 -0
  106. package/lib/components/tab/TabGroup.vue.d.ts +4 -8
  107. package/lib/components/tab/__tests__/Tab.spec.d.ts +1 -0
  108. package/lib/components/tab/__tests__/TabGroup.spec.d.ts +1 -0
  109. package/lib/components/table/Table.theme.d.ts +8 -0
  110. package/lib/components/table/Table.vue.d.ts +6 -10
  111. package/lib/components/table/TableBody.d.ts +2 -0
  112. package/lib/components/table/TableCell.theme.d.ts +7 -0
  113. package/lib/components/table/TableCell.vue.d.ts +1 -1
  114. package/lib/components/table/TableHead.d.ts +2 -0
  115. package/lib/components/table/TableHeader.vue.d.ts +2 -2
  116. package/lib/components/table/TableRow.vue.d.ts +1 -1
  117. package/lib/components/table/__tests__/Table.spec.d.ts +1 -0
  118. package/lib/components/tag/Tag.theme.d.ts +9 -0
  119. package/lib/components/tag/Tag.vue.d.ts +5 -5
  120. package/lib/components/tag/__tests__/Tag.spec.d.ts +1 -0
  121. package/lib/components/textarea/Textarea.theme.d.ts +10 -0
  122. package/lib/components/textarea/Textarea.vue.d.ts +18 -24
  123. package/lib/components/textarea/__tests__/Textarea.spec.d.ts +1 -0
  124. package/lib/components/toggle/Toggle.theme.d.ts +11 -0
  125. package/lib/components/toggle/Toggle.vue.d.ts +10 -11
  126. package/lib/components/toggle/__tests__/Toggle.spec.d.ts +1 -0
  127. package/lib/components/tooltip/Tooltip.theme.d.ts +11 -0
  128. package/lib/components/tooltip/__tests__/Tooltip.spec.d.ts +1 -0
  129. package/lib/composables/colors-utils.d.ts +0 -1
  130. package/lib/composables/colors.d.ts +8 -4
  131. package/lib/composables/common.d.ts +1 -0
  132. package/lib/composables/css.d.ts +6 -5
  133. package/lib/composables/index.d.ts +1 -1
  134. package/lib/composables/inputtable.d.ts +1 -1
  135. package/lib/composables/interactive.d.ts +7 -2
  136. package/lib/composables/keys.d.ts +1 -0
  137. package/lib/composables/notifications.d.ts +1 -0
  138. package/lib/composables/theme.d.ts +20 -0
  139. package/lib/create.d.ts +3 -2
  140. package/lib/index.cjs.js +1 -15
  141. package/lib/index.es.js +4479 -3667
  142. package/lib/nuxt.js +2 -1
  143. package/lib/version.d.ts +1 -1
  144. package/package.json +16 -6
  145. package/src/common/icons.ts +15 -0
  146. package/src/common/utils.ts +68 -0
  147. package/src/components/alert/Alert.theme.ts +57 -0
  148. package/src/components/alert/Alert.vue +51 -127
  149. package/src/components/alert/__tests__/Alert.spec.ts +14 -0
  150. package/src/components/avatar/Avatar.theme.ts +39 -0
  151. package/src/components/avatar/Avatar.vue +61 -97
  152. package/src/components/avatar/__tests__/Avatar.spec.ts +11 -0
  153. package/src/components/badge/Badge.theme.ts +13 -0
  154. package/src/components/badge/Badge.vue +58 -65
  155. package/src/components/badge/__tests__/Badge.spec.ts +11 -0
  156. package/src/components/breadcrumbs/Breadcrumbs.theme.ts +9 -0
  157. package/src/components/breadcrumbs/Breadcrumbs.vue +34 -24
  158. package/src/components/breadcrumbs/__tests__/Breadcrumbs.spec.ts +11 -0
  159. package/src/components/button/Button.theme.ts +234 -0
  160. package/src/components/button/Button.vue +94 -356
  161. package/src/components/button/ButtonGroup.theme.ts +5 -0
  162. package/src/components/button/ButtonGroup.vue +30 -29
  163. package/src/components/button/__tests__/ Button.spec.ts +11 -0
  164. package/src/components/button/__tests__/ ButtonGroup.spec.ts +11 -0
  165. package/src/components/card/Card.theme.ts +7 -0
  166. package/src/components/card/Card.vue +18 -11
  167. package/src/components/card/__tests__/Card.spec.ts +11 -0
  168. package/src/components/checkbox/Checkbox.theme.ts +92 -0
  169. package/src/components/checkbox/Checkbox.vue +69 -156
  170. package/src/components/checkbox/__tests__/Checkbox.spec.ts +11 -0
  171. package/src/components/collapse/Collapse.theme.ts +11 -0
  172. package/src/components/collapse/Collapse.vue +99 -118
  173. package/src/components/collapse/__tests__/Collapse.spec.ts +11 -0
  174. package/src/components/container/Container.theme.ts +7 -0
  175. package/src/components/container/Container.vue +17 -9
  176. package/src/components/container/__tests__/Container.spec.ts +11 -0
  177. package/src/components/divider/Divider.theme.ts +11 -0
  178. package/src/components/divider/Divider.vue +22 -18
  179. package/src/components/divider/__tests__/Divider.spec.ts +11 -0
  180. package/src/components/drawer/Drawer.theme.ts +9 -0
  181. package/src/components/drawer/Drawer.vue +167 -179
  182. package/src/components/drawer/__tests__/Drawer.spec.ts +11 -0
  183. package/src/components/form/Form.theme.ts +7 -0
  184. package/src/components/form/Form.vue +90 -73
  185. package/src/components/form/__tests__/Form.spec.ts +11 -0
  186. package/src/components/helpers/InputError.tsx +14 -0
  187. package/src/components/icon/Icon.theme.ts +16 -0
  188. package/src/components/icon/Icon.vue +72 -88
  189. package/src/components/icon/__tests__/Icon.spec.ts +11 -0
  190. package/src/components/image/Image.theme.ts +7 -0
  191. package/src/components/image/Image.vue +22 -23
  192. package/src/components/image/__tests__/Image.spec.ts +11 -0
  193. package/src/components/index.ts +3 -3
  194. package/src/components/input/Input.theme.ts +44 -0
  195. package/src/components/input/Input.vue +97 -130
  196. package/src/components/input/__tests__/Input.spec.ts +11 -0
  197. package/src/components/link/Link.theme.ts +26 -0
  198. package/src/components/link/Link.vue +41 -66
  199. package/src/components/link/__tests__/Link.spec.ts +11 -0
  200. package/src/components/menu/Menu.theme.ts +7 -0
  201. package/src/components/menu/Menu.vue +54 -45
  202. package/src/components/menu/MenuItem.theme.ts +107 -0
  203. package/src/components/menu/MenuItem.vue +97 -199
  204. package/src/components/menu/__tests__/Menu.spec.ts +11 -0
  205. package/src/components/menu/__tests__/MenuItem.spec.ts +11 -0
  206. package/src/components/modal/Modal.theme.ts +29 -0
  207. package/src/components/modal/Modal.vue +78 -101
  208. package/src/components/modal/__tests__/Modal.spec.ts +11 -0
  209. package/src/components/notifications/Notifications.theme.ts +11 -0
  210. package/src/components/notifications/Notifications.vue +233 -249
  211. package/src/components/notifications/__tests__/Notifications.spec.ts +11 -0
  212. package/src/components/pagination/Pagination.theme.ts +27 -0
  213. package/src/components/pagination/Pagination.vue +142 -164
  214. package/src/components/pagination/PaginationItem.theme.ts +14 -0
  215. package/src/components/pagination/PaginationItem.vue +26 -33
  216. package/src/components/pagination/__tests__/Pagination.spec.ts +11 -0
  217. package/src/components/pagination/__tests__/PaginationItem.spec.ts +11 -0
  218. package/src/components/popover/Popover.theme.ts +9 -0
  219. package/src/components/popover/Popover.vue +153 -101
  220. package/src/components/popover/PopoverContainer.theme.ts +7 -0
  221. package/src/components/popover/PopoverContainer.vue +17 -9
  222. package/src/components/popover/__tests__/Popover.spec.ts +11 -0
  223. package/src/components/popover/__tests__/PopoverContainer.spec.ts +11 -0
  224. package/src/components/progress/Progress.theme.ts +26 -0
  225. package/src/components/progress/Progress.vue +29 -53
  226. package/src/components/progress/__tests__/Progress.spec.ts +11 -0
  227. package/src/components/radio/Radio.theme.ts +121 -0
  228. package/src/components/radio/Radio.vue +81 -158
  229. package/src/components/radio/__tests__/Radio.spec.ts +11 -0
  230. package/src/components/scroll/Scroll.theme.ts +7 -0
  231. package/src/components/scroll/Scroll.vue +34 -36
  232. package/src/components/scroll/__tests__/Scroll.spec.ts +11 -0
  233. package/src/components/select/Select.theme.ts +54 -0
  234. package/src/components/select/Select.vue +219 -273
  235. package/src/components/select/__tests__/Select.spec.ts +11 -0
  236. package/src/components/skeleton/Skeleton.theme.ts +7 -0
  237. package/src/components/skeleton/Skeleton.vue +17 -9
  238. package/src/components/skeleton/__tests__/Skeleton.spec.ts +11 -0
  239. package/src/components/slider/Slider.theme.ts +30 -0
  240. package/src/components/slider/Slider.vue +137 -168
  241. package/src/components/slider/__tests__/Slider.spec.ts +11 -0
  242. package/src/components/spacer/{Spacer.vue → Spacer.tsx} +3 -6
  243. package/src/components/spacer/__tests__/Spacer.spec.ts +11 -0
  244. package/src/components/spinner/Spinner.vue +10 -34
  245. package/src/components/spinner/__tests__/Spinner.spec.ts +11 -0
  246. package/src/components/tab/Tab.theme.ts +22 -0
  247. package/src/components/tab/Tab.vue +89 -93
  248. package/src/components/tab/TabGroup.theme.ts +43 -0
  249. package/src/components/tab/TabGroup.vue +94 -127
  250. package/src/components/tab/__tests__/Tab.spec.ts +11 -0
  251. package/src/components/tab/__tests__/TabGroup.spec.ts +11 -0
  252. package/src/components/table/Table.theme.ts +19 -0
  253. package/src/components/table/Table.vue +136 -147
  254. package/src/components/table/{TableBody.vue → TableBody.tsx} +3 -8
  255. package/src/components/table/TableCell.theme.ts +27 -0
  256. package/src/components/table/TableCell.vue +30 -58
  257. package/src/components/table/TableHead.tsx +14 -0
  258. package/src/components/table/TableHeader.vue +18 -20
  259. package/src/components/table/TableRow.vue +23 -20
  260. package/src/components/table/__tests__/Table.spec.ts +11 -0
  261. package/src/components/tag/Tag.theme.ts +32 -0
  262. package/src/components/tag/Tag.vue +40 -68
  263. package/src/components/tag/__tests__/Tag.spec.ts +11 -0
  264. package/src/components/textarea/Textarea.theme.ts +62 -0
  265. package/src/components/textarea/Textarea.vue +100 -115
  266. package/src/components/textarea/__tests__/Textarea.spec.ts +11 -0
  267. package/src/components/toggle/Toggle.theme.ts +51 -0
  268. package/src/components/toggle/Toggle.vue +51 -81
  269. package/src/components/toggle/__tests__/Toggle.spec.ts +11 -0
  270. package/src/components/tooltip/Tooltip.theme.ts +51 -0
  271. package/src/components/tooltip/Tooltip.vue +9 -14
  272. package/src/components/tooltip/__tests__/Tooltip.spec.ts +11 -0
  273. package/src/composables/colors-utils.ts +68 -68
  274. package/src/composables/colors.ts +18 -6
  275. package/src/composables/common.ts +1 -0
  276. package/src/composables/css.ts +7 -2
  277. package/src/composables/index.ts +1 -1
  278. package/src/composables/inputtable.ts +1 -1
  279. package/src/composables/interactive.ts +8 -4
  280. package/src/composables/keys.ts +1 -0
  281. package/src/composables/notifications.ts +10 -0
  282. package/src/composables/theme.ts +88 -0
  283. package/src/create.ts +8 -3
  284. package/src/exports/nuxt.js +2 -1
  285. package/src/version.ts +1 -1
  286. package/volar.d.ts +1 -0
  287. package/lib/components/spacer/Spacer.vue.d.ts +0 -2
  288. package/lib/components/table/TableBody.vue.d.ts +0 -2
  289. package/lib/components/table/TableHead.vue.d.ts +0 -2
  290. package/lib/composables/notification.d.ts +0 -1
  291. package/lib/style.css +0 -1
  292. package/src/components/table/TableHead.vue +0 -15
  293. package/src/composables/notification.ts +0 -10
package/lib/nuxt.js CHANGED
@@ -6,7 +6,7 @@ export default defineNuxtModule({
6
6
  name: '@indielayer/ui',
7
7
  configKey: 'indielayer',
8
8
  compatibility: {
9
- nuxt: '^3.0.0',
9
+ nuxt: '^3.0.0-rc.1',
10
10
  },
11
11
  },
12
12
  defaults: {
@@ -25,6 +25,7 @@ export default defineNuxtModule({
25
25
  nuxt.hook('components:dirs', (dirs) => {
26
26
  dirs.push({
27
27
  path: fileURLToPath(new URL('../src/components', import.meta.url)),
28
+ extensions: ['vue', 'tsx'],
28
29
  prefix: options?.prefix ? options?.prefix : 'X',
29
30
  })
30
31
  })
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.0.0-alpha.9";
1
+ declare const _default: "1.0.2";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indielayer/ui",
3
- "version": "1.0.0-alpha.9",
3
+ "version": "1.0.2",
4
4
  "description": "Indielayer UI Components with Tailwind CSS build for Vue 3",
5
5
  "author": {
6
6
  "name": "João Teixeira",
@@ -41,16 +41,19 @@
41
41
  },
42
42
  "sideEffects": false,
43
43
  "scripts": {
44
- "dev": "pnpm build-only && chokidar \"./src/**\" -c \"pnpm build-only\"",
45
- "dev2": "vite build --watch",
44
+ "dev": "vite build --watch",
45
+ "dev2": "pnpm build-only && chokidar \"./src/**\" -c \"pnpm build-only\"",
46
46
  "build": "pnpm generate && vite build",
47
47
  "build-prod": "pnpm build && pnpm gen-types",
48
- "typecheck": "vue-tsc --noEmit",
49
48
  "build-only": "vite build",
50
49
  "generate": "pnpm gen-version",
51
- "gen-types": "vue-tsc --declaration --emitDeclarationOnly",
50
+ "gen-types": "vue-tsc --declaration --emitDeclarationOnly -p tsconfig.vitest.json --composite false",
52
51
  "gen-version": "node .scripts/gen-version.js",
53
- "test": "echo \"Error: no test specified\" && exit 1"
52
+ "test": "pnpm test:unit",
53
+ "test:unit": "vitest --environment jsdom",
54
+ "test:e2e": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress open'",
55
+ "test:e2e:ci": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress run'",
56
+ "typecheck": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false"
54
57
  },
55
58
  "peerDependencies": {
56
59
  "tailwindcss": "^3.0.0",
@@ -60,22 +63,29 @@
60
63
  "@cypress/vite-dev-server": "^2.2.2",
61
64
  "@cypress/vue": "^3.1.1",
62
65
  "@rushstack/eslint-patch": "^1.1.3",
66
+ "@types/jsdom": "^16.2.14",
63
67
  "@types/node": "^17.0.30",
68
+ "@types/ramda": "^0.28.15",
64
69
  "@vitejs/plugin-vue": "^2.3.1",
65
70
  "@vitejs/plugin-vue-jsx": "^1.3.10",
71
+ "@vue/test-utils": "^2.0.0-rc.20",
66
72
  "@vue/tsconfig": "^0.1.3",
67
73
  "@vueuse/core": "^8.4.2",
68
74
  "autoprefixer": "^10.4.0",
75
+ "c8": "^7.12.0",
69
76
  "chokidar-cli": "^3.0.0",
70
77
  "clean-css": "^5.3.0",
71
78
  "cypress": "^9.6.0",
72
79
  "eslint": "^8.16.0",
73
80
  "eslint-plugin-cypress": "^2.12.1",
81
+ "jsdom": "^19.0.0",
74
82
  "postcss": "^8.4.4",
83
+ "ramda": "^0.28.0",
75
84
  "start-server-and-test": "^1.14.0",
76
85
  "tailwindcss": "^3.0.0",
77
86
  "typescript": "~4.6.3",
78
87
  "vite": "^2.9.5",
88
+ "vitest": "^0.9.3",
79
89
  "vue": "^3.2.33",
80
90
  "vue-tsc": "^0.34.15"
81
91
  },
@@ -0,0 +1,15 @@
1
+ export const infoIcon = '<path d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />'
2
+ export const successIcon = '<path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />'
3
+ export const errorIcon = '<path d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />'
4
+ export const warningIcon = '<path d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />'
5
+ export const closeIcon = '<path d="M6 18L18 6M6 6l12 12" />'
6
+ export const avatarIcon = '<path d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />'
7
+ export const arrowRightIcon = '<path d="M13 7l5 5m0 0l-5 5m5-5H6" />'
8
+ export const eyeIcon = '<path d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /><path d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />'
9
+ export const eyeVisibleIcon = '<path d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />'
10
+ export const dotsIcon = '<path d="M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z" />'
11
+ export const prevIcon = '<path d="M15 19l-7-7 7-7" />'
12
+ export const nextIcon = '<path d="M9 5l7 7-7 7" />'
13
+ export const checkIcon = '<path d="M5 13l4 4L19 7" />'
14
+ export const chevronDownIcon = '<path d="M8 9l4-4 4 4m0 6l-4 4-4-4" />'
15
+ export const externalIcon = '<line x1="7" y1="17" x2="17" y2="7" /><polyline points="7 7 17 7 17 17" />'
@@ -0,0 +1,68 @@
1
+ import { unref, isRef } from 'vue'
2
+
3
+ const isObject = (val: any) => val !== null && typeof val === 'object'
4
+ const isArray = Array.isArray
5
+
6
+ /**
7
+ * Deeply unref a value, recursing into objects and arrays.
8
+ *
9
+ * @param {Mixed} val - The value to deeply unref.
10
+ *
11
+ * @return {Mixed}
12
+ */
13
+ export const deepUnref = (val: any) => {
14
+ const checkedVal = isRef(val) ? unref(val) : val
15
+
16
+ if (!isObject(checkedVal)) {
17
+ return checkedVal
18
+ }
19
+
20
+ if (isArray(checkedVal)) {
21
+ return unrefArray(checkedVal)
22
+ }
23
+
24
+ return unrefObject(checkedVal)
25
+ }
26
+
27
+ /**
28
+ * Unref a value, recursing into it if it's an object.
29
+ *
30
+ * @param {Mixed} val - The value to unref.
31
+ *
32
+ * @return {Mixed}
33
+ */
34
+ export const smartUnref = (val: any) => {
35
+ // Non-ref object? Go deeper!
36
+ if (val !== null && !isRef(val) && typeof val === 'object') {
37
+ return deepUnref(val)
38
+ }
39
+
40
+ return unref(val)
41
+ }
42
+
43
+ /**
44
+ * Unref an array, recursively.
45
+ *
46
+ * @param {Array} arr - The array to unref.
47
+ *
48
+ * @return {Array}
49
+ */
50
+ export const unrefArray: any = (arr: []) => arr.map(smartUnref)
51
+
52
+ /**
53
+ * Unref an object, recursively.
54
+ *
55
+ * @param {Object} obj - The object to unref.
56
+ *
57
+ * @return {Object}
58
+ */
59
+ export const unrefObject = (obj: any) => {
60
+ const unreffed: any = {}
61
+
62
+ // Object? un-ref it!
63
+ Object.keys(obj).forEach((key) => {
64
+ unreffed[key] = smartUnref(obj[key])
65
+ })
66
+
67
+ return unreffed
68
+ }
@@ -0,0 +1,57 @@
1
+ import type { ThemeParams } from '../../composables/theme'
2
+
3
+ export default {
4
+ classes: {
5
+ /*tw*/
6
+ wrapper: 'flex rounded-md space-x-2 px-4 py-2 border items-center',
7
+ },
8
+ styles: ({ props, colors, css }: ThemeParams) => {
9
+ const color = colors.getPalette(props.color)
10
+ const vars: (object | string)[] = []
11
+
12
+ if (props.glow) vars.push(css.get('glow', colors.getColorOpacity(color[500], 0.5)))
13
+
14
+ if (props.color) {
15
+ if (props.light) {
16
+ vars.push(css.variables({
17
+ bg: color[50],
18
+ text: color[600],
19
+ icon: color[600],
20
+ border: props.outlined ? color[600] : color[50],
21
+ dark: {
22
+ bg: color[200],
23
+ text: color[800],
24
+ icon: color[600],
25
+ border: props.outlined ? color[500] : color[200],
26
+ },
27
+ }))
28
+ } else {
29
+ vars.push(css.variables({
30
+ bg: props.outlined ? 'transparent' : color[600],
31
+ text: props.outlined ? color[600] : color[50],
32
+ icon: props.outlined ? color[600] : color[50],
33
+ border: color[600],
34
+ dark: {
35
+ border: color[400],
36
+ text: props.outlined ? color[400] : color[50],
37
+ },
38
+ }))
39
+ }
40
+
41
+ return vars
42
+ }
43
+
44
+ vars.push(css.variables({
45
+ bg: 'transparent',
46
+ text: color[500],
47
+ border: color[300],
48
+ dark: {
49
+ bg: 'transparent',
50
+ text: color[300],
51
+ border: color[500],
52
+ },
53
+ }))
54
+
55
+ return vars
56
+ },
57
+ }
@@ -1,151 +1,75 @@
1
1
  <script lang="ts">
2
- import { computed, defineComponent, type PropType } from 'vue'
3
- import { useColors } from '../../composables/colors'
4
- import { useCSS } from '../../composables/css'
5
-
6
- export default defineComponent({
7
- name: 'XAlert',
8
-
9
- props: {
10
- ...useColors.props(),
11
- tag: {
12
- type: String,
13
- default: 'div',
14
- },
15
- type: String as PropType<'info' | 'success' | 'error' | 'warning' | undefined>,
16
- glow: Boolean,
17
- light: Boolean,
18
- outlined: Boolean,
19
- removable: Boolean,
20
- },
21
-
22
- emits: ['remove'],
2
+ export default { name: 'XAlert' }
3
+ </script>
23
4
 
24
- setup(props) {
25
- const css = useCSS('alert')
26
- const colors = useColors()
27
- const gray = colors.getPalette('gray')
28
- const styles = computed(() => {
29
- const color = colors.getPalette(props.color)
30
- const vars: (object | string)[] = []
5
+ <script setup lang="ts">
6
+ import { computed, type PropType } from 'vue'
7
+ import { useColors } from '../../composables/colors'
8
+ import { useTheme } from '../../composables/theme'
9
+ import { closeIcon, successIcon, errorIcon, warningIcon, infoIcon } from '../../common/icons'
31
10
 
32
- if (props.glow) vars.push(css.get('glow', colors.getColorOpacity(color[500], 0.5)))
11
+ import XIcon from '../icon/Icon.vue'
33
12
 
34
- if (props.color) {
35
- if (props.light) {
36
- vars.push(css.variables({
37
- bg: color[50],
38
- text: color[600],
39
- icon: color[600],
40
- border: props.outlined ? color[600] : color[50],
41
- dark: {
42
- bg: color[200],
43
- text: color[800],
44
- icon: color[600],
45
- border: props.outlined ? color[500] : color[200],
46
- },
47
- }))
48
- } else {
49
- vars.push(css.variables({
50
- bg: props.outlined ? 'transparent' : color[600],
51
- text: props.outlined ? color[600] : color[50],
52
- icon: props.outlined ? color[600] : color[50],
53
- border: color[600],
54
- dark: {
55
- border: color[400],
56
- text: props.outlined ? color[400] : color[50],
57
- },
58
- }))
59
- }
13
+ import theme from './Alert.theme'
60
14
 
61
- return vars
62
- }
15
+ const props = defineProps({
16
+ ...useColors.props(),
17
+ type: String as PropType<'info' | 'success' | 'error' | 'warning' | undefined>,
18
+ glow: Boolean,
19
+ light: Boolean,
20
+ outlined: Boolean,
21
+ removable: Boolean,
22
+ })
63
23
 
64
- vars.push(css.variables({
65
- bg: 'transparent',
66
- text: color[500],
67
- border: color[300],
68
- dark: {
69
- bg: 'transparent',
70
- text: color[300],
71
- border: color[500],
72
- },
73
- }))
24
+ defineEmits(['remove'])
74
25
 
75
- return vars
76
- })
26
+ const icon = computed(() => {
27
+ if (props.type === 'info') return infoIcon
28
+ else if (props.type === 'success') return successIcon
29
+ else if (props.type === 'error') return errorIcon
30
+ else if (props.type === 'warning') return warningIcon
77
31
 
78
- return {
79
- styles,
80
- }
81
- },
32
+ return ''
82
33
  })
34
+
35
+ const { styles, classes, className } = useTheme('alert', theme, props)
83
36
  </script>
84
37
 
85
38
  <template>
86
- <component
87
- :is="tag"
88
- class="flex rounded-md px-4 py-2 border items-center"
39
+ <div
40
+ :style="styles"
89
41
  :class="[
42
+ className,
90
43
  $style['alert'],
91
44
  glow ? $style['alert--glow'] : '',
45
+ classes.wrapper,
92
46
  ]"
93
- :style="styles"
94
47
  >
95
- <div v-if="$slots.icon" class="flex-none pr-2">
96
- <slot name="icon"></slot>
97
- </div>
98
- <svg
99
- v-else-if="type"
100
- width="24"
101
- height="24"
102
- viewBox="0 0 24 24"
103
- stroke="currentColor"
104
- stroke-linejoin="round"
105
- stroke-linecap="round"
106
- fill="none"
107
- role="presentation"
108
- class="flex-none stroke-2 w-5 h-5 mr-2 text-[color:var(--x-alert-icon)] dark:text-[color:var(--x-dark-alert-icon)]"
109
- >
110
- <template v-if="type === 'info'">
111
- <path d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
112
- </template>
113
-
114
- <template v-if="type === 'success'">
115
- <path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
116
- </template>
117
48
 
118
- <template v-if="type === 'error'">
119
- <path d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
120
- </template>
121
- <template v-if="type === 'warning'">
122
- <path d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
123
- </template>
124
- </svg>
49
+ <slot name="icon">
50
+ <x-icon
51
+ v-if="type"
52
+ :icon="icon"
53
+ class="text-[color:var(--x-alert-icon)] dark:text-[color:var(--x-alert-dark-icon)]"
54
+ />
55
+ </slot>
125
56
 
126
- <slot></slot>
57
+ <div>
58
+ <slot></slot>
59
+ </div>
127
60
 
128
61
  <template v-if="removable">
129
62
  <div class="flex-grow"></div>
130
- <svg
131
- width="24"
132
- height="24"
133
- viewBox="0 0 24 24"
134
- stroke="currentColor"
135
- stroke-linejoin="round"
136
- stroke-linecap="round"
137
- fill="none"
138
- role="presentation"
139
- class="stroke-2 w-5 h-5 ml-1 cursor-pointer shrink-0"
140
- @click="(e) => $emit('remove', e)"
141
- >
142
- <path d="M6 18L18 6M6 6l12 12" />
143
- </svg>
63
+ <span class="flex items-center cursor-pointer shrink-0" @click="(e) => $emit('remove', e)">
64
+ <slot name="removeIcon">
65
+ <x-icon :icon="closeIcon"/>
66
+ </slot>
67
+ </span>
144
68
  </template>
145
- </component>
69
+ </div>
146
70
  </template>
147
71
 
148
- <style lang="postcss" module scoped>
72
+ <style lang="postcss" module>
149
73
  .alert {
150
74
  color: var(--x-alert-text);
151
75
  background-color: var(--x-alert-bg);
@@ -155,10 +79,10 @@ export default defineComponent({
155
79
  box-shadow: 0 0 #000, 0 0 #000, 0 10px 15px -3px var(--x-alert-glow), 0 4px 6px -4px var(--x-alert-glow);
156
80
  }
157
81
 
158
- :global(.dark) & {
159
- color: var(--x-dark-alert-text, var(--x-alert-text));
160
- background-color: var(--x-dark-alert-bg, var(--x-alert-bg));
161
- border-color: var(--x-dark-alert-border, var(--x-alert-border));
82
+ :global(.dark) &, &:global(.dark) {
83
+ color: var(--x-alert-dark-text, var(--x-alert-text));
84
+ background-color: var(--x-alert-dark-bg, var(--x-alert-bg));
85
+ border-color: var(--x-alert-dark-border, var(--x-alert-border));
162
86
  }
163
87
  }
164
88
  </style>
@@ -0,0 +1,14 @@
1
+ import { describe, it, expect } from 'vitest'
2
+ import { mount } from '@vue/test-utils'
3
+ import Alert from '../Alert.vue'
4
+
5
+ describe('Alert', () => {
6
+ it('renders properly', () => {
7
+ const wrapper = mount(Alert)
8
+
9
+ expect(wrapper.vm).toBeTruthy()
10
+ // expect(wrapper.isVueInstance()).toBeTruthy()
11
+
12
+ // expect(wrapper.text()).toContain('Hi there!')
13
+ })
14
+ })
@@ -0,0 +1,39 @@
1
+ import type { ThemeParams } from '../../composables/theme'
2
+
3
+ export default {
4
+ classes: {
5
+ wrapper({ props }: ThemeParams) {
6
+ const classes = ['relative inline-flex items-center justify-center overflow-hidden align-middle border box-content']
7
+
8
+ // radius
9
+ classes.push(props.rounded ? 'rounded-full' : 'rounded-md')
10
+
11
+ // size
12
+ if (props.size === 'xs') classes.push('h-6 w-6 text-xs')
13
+ else if (props.size === 'sm') classes.push('h-9 w-9 text-sm')
14
+ else if (props.size === 'lg') classes.push('h-12 w-12 text-lg')
15
+ else if (props.size === 'xl') classes.push('h-[3.75rem] w-[3.75rem] text-xl')
16
+ else classes.push('h-10 w-10')
17
+
18
+ return classes
19
+ },
20
+ },
21
+
22
+ styles({ props, colors, css, data }: ThemeParams) {
23
+ const color = colors.getPalette(props.color)
24
+
25
+ if (data.source) return css.variables({
26
+ bg: 'transparent',
27
+ border: props.outlined ? color[500] : 'transparent',
28
+ })
29
+
30
+ return css.variables({
31
+ bg: color[100],
32
+ text: color[500],
33
+ border: props.outlined ? color[500] : 'transparent',
34
+ dark: {
35
+ bg: color[900],
36
+ },
37
+ })
38
+ },
39
+ }