@grantcodes/ui 2.0.0-beta.9 → 2.0.0

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 (314) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +6 -8
  3. package/custom-elements.json +4273 -0
  4. package/package.json +80 -90
  5. package/src/components/app-bar/app-bar.component.js +90 -0
  6. package/src/components/app-bar/app-bar.js +8 -0
  7. package/src/components/app-bar/app-bar.stories.js +84 -0
  8. package/src/components/app-bar/app-bar.styles.js +227 -0
  9. package/src/components/app-bar/app-bar.test.js +174 -0
  10. package/src/components/app-bar/index.js +3 -0
  11. package/src/components/avatar/avatar.component.js +78 -0
  12. package/src/components/avatar/avatar.js +18 -0
  13. package/src/components/avatar/avatar.stories.js +45 -0
  14. package/src/components/avatar/avatar.styles.js +42 -0
  15. package/src/components/avatar/avatar.test.js +85 -0
  16. package/src/components/avatar/index.js +13 -0
  17. package/src/components/badge/badge.component.js +36 -0
  18. package/src/components/badge/badge.js +8 -0
  19. package/src/components/badge/badge.stories.js +46 -0
  20. package/src/components/badge/badge.styles.js +94 -0
  21. package/src/components/badge/badge.test.js +70 -0
  22. package/src/components/badge/index.js +3 -0
  23. package/src/components/breadcrumb/breadcrumb.component.js +110 -0
  24. package/src/components/breadcrumb/breadcrumb.js +12 -0
  25. package/src/components/breadcrumb/breadcrumb.stories.js +25 -0
  26. package/src/components/breadcrumb/breadcrumb.styles.js +96 -0
  27. package/src/components/breadcrumb/breadcrumb.test.js +144 -0
  28. package/src/components/breadcrumb/index.js +3 -0
  29. package/src/components/button/button.component.js +64 -0
  30. package/src/components/button/button.js +6 -0
  31. package/src/components/button/button.stories.js +78 -0
  32. package/src/components/button/button.styles.js +97 -0
  33. package/src/components/button/button.test.js +98 -0
  34. package/src/components/button/index.js +1 -0
  35. package/src/components/button-group/button-group.component.js +27 -0
  36. package/src/components/button-group/button-group.js +6 -0
  37. package/src/components/button-group/button-group.stories.js +33 -0
  38. package/src/components/button-group/button-group.styles.js +43 -0
  39. package/src/components/button-group/button-group.test.js +57 -0
  40. package/src/components/button-group/index.js +1 -0
  41. package/src/components/card/card.component.js +17 -0
  42. package/src/components/card/card.js +6 -0
  43. package/src/components/card/card.stories.js +36 -0
  44. package/src/components/card/card.styles.js +128 -0
  45. package/src/components/card/card.test.js +59 -0
  46. package/src/components/card/index.js +1 -0
  47. package/src/components/code-preview/code-preview.component.js +53 -0
  48. package/src/components/code-preview/code-preview.js +7 -0
  49. package/src/components/code-preview/code-preview.stories.js +67 -0
  50. package/src/components/code-preview/code-preview.styles.js +18 -0
  51. package/src/components/code-preview/code-preview.test.js +118 -0
  52. package/src/components/code-preview/index.js +1 -0
  53. package/src/components/container/container.component.js +38 -0
  54. package/src/components/container/container.js +7 -0
  55. package/src/components/container/container.stories.js +59 -0
  56. package/src/components/container/container.styles.js +43 -0
  57. package/src/components/container/container.test.js +84 -0
  58. package/src/components/container/index.js +1 -0
  59. package/src/components/dialog/dialog.component.js +78 -0
  60. package/src/components/dialog/dialog.js +7 -0
  61. package/src/components/dialog/dialog.stories.js +43 -0
  62. package/src/components/dialog/dialog.styles.js +74 -0
  63. package/src/components/dialog/dialog.test.js +97 -0
  64. package/src/components/dialog/index.js +1 -0
  65. package/src/components/dropdown/dropdown.component.js +225 -0
  66. package/src/components/dropdown/dropdown.js +12 -0
  67. package/src/components/dropdown/dropdown.stories.js +107 -0
  68. package/src/components/dropdown/dropdown.styles.js +128 -0
  69. package/src/components/dropdown/dropdown.test.js +144 -0
  70. package/src/components/dropdown/index.js +3 -0
  71. package/src/components/dropzone/dropzone.component.js +141 -0
  72. package/src/components/dropzone/dropzone.js +6 -0
  73. package/src/components/dropzone/dropzone.stories.js +41 -0
  74. package/src/components/dropzone/dropzone.styles.js +64 -0
  75. package/src/components/dropzone/dropzone.test.js +112 -0
  76. package/src/components/dropzone/index.js +1 -0
  77. package/src/components/footer/footer-column.component.js +15 -0
  78. package/src/components/footer/footer-column.styles.js +51 -0
  79. package/src/components/footer/footer.component.js +38 -0
  80. package/src/components/footer/footer.js +9 -0
  81. package/src/components/footer/footer.stories.js +143 -0
  82. package/src/components/footer/footer.styles.js +90 -0
  83. package/src/components/footer/footer.test.js +107 -0
  84. package/src/components/footer/index.js +2 -0
  85. package/src/components/form-field/form-field.component.js +173 -0
  86. package/src/components/form-field/form-field.js +7 -0
  87. package/src/components/form-field/form-field.stories.js +104 -0
  88. package/src/components/form-field/form-field.styles.js +47 -0
  89. package/src/components/form-field/form-field.test.js +118 -0
  90. package/src/components/form-field/index.js +1 -0
  91. package/src/components/gallery/gallery-image.component.js +52 -0
  92. package/src/components/gallery/gallery-image.js +7 -0
  93. package/src/components/gallery/gallery.component.js +25 -0
  94. package/src/components/gallery/gallery.js +7 -0
  95. package/src/components/gallery/gallery.stories.js +60 -0
  96. package/src/components/gallery/gallery.styles.js +56 -0
  97. package/src/components/gallery/gallery.test.js +58 -0
  98. package/src/components/gallery/index.js +2 -0
  99. package/src/components/icon/icon.component.js +14 -0
  100. package/src/components/icon/icon.js +7 -0
  101. package/src/components/icon/icon.stories.js +26 -0
  102. package/src/components/icon/icon.styles.js +28 -0
  103. package/src/components/icon/icon.test.js +57 -0
  104. package/src/components/icon/index.js +1 -0
  105. package/src/components/loading/index.js +1 -0
  106. package/src/components/loading/loading.component.js +21 -0
  107. package/src/components/loading/loading.js +7 -0
  108. package/src/components/loading/loading.stories.js +25 -0
  109. package/src/components/loading/loading.styles.js +43 -0
  110. package/src/components/loading/loading.test.js +57 -0
  111. package/src/components/notice/index.js +1 -0
  112. package/src/components/notice/notice.component.js +77 -0
  113. package/src/components/notice/notice.js +7 -0
  114. package/src/components/notice/notice.stories.js +122 -0
  115. package/src/components/notice/notice.styles.js +72 -0
  116. package/src/components/notice/notice.test.js +146 -0
  117. package/src/components/pagination/index.js +1 -0
  118. package/src/components/pagination/pagination.component.js +62 -0
  119. package/src/components/pagination/pagination.js +7 -0
  120. package/src/components/pagination/pagination.stories.js +34 -0
  121. package/src/components/pagination/pagination.styles.js +19 -0
  122. package/src/components/pagination/pagination.test.js +98 -0
  123. package/src/components/sidebar/index.js +3 -0
  124. package/src/components/sidebar/sidebar.component.js +165 -0
  125. package/src/components/sidebar/sidebar.js +8 -0
  126. package/src/components/sidebar/sidebar.stories.js +155 -0
  127. package/src/components/sidebar/sidebar.styles.js +192 -0
  128. package/src/components/sidebar/sidebar.test.js +196 -0
  129. package/src/components/tabs/index.js +2 -0
  130. package/src/components/tabs/internal/tabs-button.component.js +39 -0
  131. package/src/components/tabs/internal/tabs-button.js +7 -0
  132. package/src/components/tabs/internal/tabs-item.component.js +39 -0
  133. package/src/components/tabs/tab.component.js +20 -0
  134. package/src/components/tabs/tab.js +7 -0
  135. package/src/components/tabs/tabs.component.js +130 -0
  136. package/src/components/tabs/tabs.js +7 -0
  137. package/src/components/tabs/tabs.stories.js +39 -0
  138. package/src/components/tabs/tabs.styles.js +88 -0
  139. package/src/components/tabs/tabs.test.js +148 -0
  140. package/src/components/toast/index.js +3 -0
  141. package/src/components/toast/toast.component.js +187 -0
  142. package/src/components/toast/toast.js +9 -0
  143. package/src/components/toast/toast.stories.js +169 -0
  144. package/src/components/toast/toast.styles.js +207 -0
  145. package/src/components/toast/toast.test.js +196 -0
  146. package/src/components/tooltip/index.js +1 -0
  147. package/src/components/tooltip/tooltip.component.js +70 -0
  148. package/src/components/tooltip/tooltip.js +7 -0
  149. package/src/components/tooltip/tooltip.stories.js +33 -0
  150. package/src/components/tooltip/tooltip.styles.js +78 -0
  151. package/src/components/tooltip/tooltip.test.js +150 -0
  152. package/src/css/all.css +1 -0
  153. package/src/css/base.css +31 -0
  154. package/src/css/colors.stories.js +192 -0
  155. package/src/css/elements/a.css +50 -0
  156. package/src/css/elements/forms/button.css +15 -0
  157. package/src/css/elements/forms/input.css +183 -0
  158. package/src/css/elements/forms/label.css +5 -0
  159. package/src/css/elements/media/image.css +3 -0
  160. package/src/css/elements.css +5 -0
  161. package/src/css/elements.stories.js +108 -0
  162. package/src/css/helpers.css +16 -0
  163. package/src/css/themes/grantcodes.css +3 -0
  164. package/src/css/themes/todomap.css +2 -0
  165. package/src/css/themes/wireframe.css +2 -0
  166. package/src/css/tokens.stories.js +183 -0
  167. package/src/css/typography.css +64 -0
  168. package/src/css/typography.stories.js +179 -0
  169. package/src/css/util/functions.css +16 -0
  170. package/src/css/util/index.css +2 -0
  171. package/src/css/util/mixins.css +63 -0
  172. package/src/icons.js +3 -0
  173. package/src/lib/classnames.js +61 -0
  174. package/src/lib/generate-id.js +10 -0
  175. package/src/main.js +17 -0
  176. package/src/test-utils/assert-helpers.js +150 -0
  177. package/src/test-utils/events.js +88 -0
  178. package/src/test-utils/fixture.js +77 -0
  179. package/src/test-utils/index.js +7 -0
  180. package/dist/_virtual/_commonjsHelpers.js +0 -1
  181. package/dist/_virtual/index.js +0 -1
  182. package/dist/_virtual/react.production.min.js +0 -1
  183. package/dist/_virtual/react.production.min2.js +0 -1
  184. package/dist/components/avatar/avatar.component.js +0 -3
  185. package/dist/components/avatar/avatar.js +0 -1
  186. package/dist/components/avatar/avatar.react.js +0 -1
  187. package/dist/components/avatar/avatar.scss.js +0 -1
  188. package/dist/components/avatar/index.js +0 -1
  189. package/dist/components/button/button.component.js +0 -5
  190. package/dist/components/button/button.js +0 -1
  191. package/dist/components/button/button.react.js +0 -1
  192. package/dist/components/button/button.scss.js +0 -1
  193. package/dist/components/button/index.js +0 -1
  194. package/dist/components/button-group/button-group.component.js +0 -5
  195. package/dist/components/button-group/button-group.js +0 -1
  196. package/dist/components/button-group/button-group.react.js +0 -1
  197. package/dist/components/button-group/button-group.scss.js +0 -1
  198. package/dist/components/button-group/index.js +0 -1
  199. package/dist/components/card/card.component.js +0 -8
  200. package/dist/components/card/card.js +0 -1
  201. package/dist/components/card/card.react.js +0 -1
  202. package/dist/components/card/card.scss.js +0 -1
  203. package/dist/components/card/index.js +0 -1
  204. package/dist/components/code-preview/code-preview.component.js +0 -3
  205. package/dist/components/code-preview/code-preview.js +0 -1
  206. package/dist/components/code-preview/code-preview.react.js +0 -1
  207. package/dist/components/code-preview/code-preview.scss.js +0 -1
  208. package/dist/components/code-preview/index.js +0 -1
  209. package/dist/components/container/container.component.js +0 -5
  210. package/dist/components/container/container.js +0 -1
  211. package/dist/components/container/container.react.js +0 -1
  212. package/dist/components/container/container.scss.js +0 -1
  213. package/dist/components/container/index.js +0 -1
  214. package/dist/components/dialog/dialog.component.js +0 -23
  215. package/dist/components/dialog/dialog.js +0 -1
  216. package/dist/components/dialog/dialog.react.js +0 -1
  217. package/dist/components/dialog/dialog.scss.js +0 -1
  218. package/dist/components/dialog/index.js +0 -1
  219. package/dist/components/dropzone/dropzone.component.js +0 -11
  220. package/dist/components/dropzone/dropzone.js +0 -1
  221. package/dist/components/dropzone/dropzone.react.js +0 -1
  222. package/dist/components/dropzone/dropzone.scss.js +0 -1
  223. package/dist/components/dropzone/index.js +0 -1
  224. package/dist/components/form-field/form-field.component.js +0 -22
  225. package/dist/components/form-field/form-field.js +0 -1
  226. package/dist/components/form-field/form-field.react.js +0 -1
  227. package/dist/components/form-field/form-field.scss.js +0 -1
  228. package/dist/components/form-field/index.js +0 -1
  229. package/dist/components/gallery/gallery-image.component.js +0 -14
  230. package/dist/components/gallery/gallery-image.js +0 -1
  231. package/dist/components/gallery/gallery.component.js +0 -5
  232. package/dist/components/gallery/gallery.js +0 -1
  233. package/dist/components/gallery/gallery.react.js +0 -1
  234. package/dist/components/gallery/gallery.scss.js +0 -1
  235. package/dist/components/gallery/index.js +0 -1
  236. package/dist/components/icon/icon.component.js +0 -1
  237. package/dist/components/icon/icon.js +0 -1
  238. package/dist/components/icon/icon.react.js +0 -1
  239. package/dist/components/icon/icon.scss.js +0 -1
  240. package/dist/components/icon/index.js +0 -1
  241. package/dist/components/loading/index.js +0 -1
  242. package/dist/components/loading/loading.component.js +0 -5
  243. package/dist/components/loading/loading.js +0 -1
  244. package/dist/components/loading/loading.react.js +0 -1
  245. package/dist/components/loading/loading.scss.js +0 -1
  246. package/dist/components/notice/index.js +0 -1
  247. package/dist/components/notice/notice.component.js +0 -16
  248. package/dist/components/notice/notice.js +0 -1
  249. package/dist/components/notice/notice.react.js +0 -1
  250. package/dist/components/notice/notice.scss.js +0 -1
  251. package/dist/components/pagination/index.js +0 -1
  252. package/dist/components/pagination/pagination.component.js +0 -13
  253. package/dist/components/pagination/pagination.js +0 -1
  254. package/dist/components/pagination/pagination.react.js +0 -1
  255. package/dist/components/pagination/pagination.scss.js +0 -1
  256. package/dist/components/tabs/index.js +0 -1
  257. package/dist/components/tabs/internal/tabs-button.component.js +0 -13
  258. package/dist/components/tabs/internal/tabs-button.js +0 -1
  259. package/dist/components/tabs/internal/tabs-item.component.js +0 -1
  260. package/dist/components/tabs/tab.component.js +0 -10
  261. package/dist/components/tabs/tab.js +0 -1
  262. package/dist/components/tabs/tabs.component.js +0 -22
  263. package/dist/components/tabs/tabs.js +0 -1
  264. package/dist/components/tabs/tabs.react.js +0 -1
  265. package/dist/components/tabs/tabs.scss.js +0 -1
  266. package/dist/components/tooltip/index.js +0 -1
  267. package/dist/components/tooltip/tooltip.component.js +0 -10
  268. package/dist/components/tooltip/tooltip.js +0 -1
  269. package/dist/components/tooltip/tooltip.react.js +0 -1
  270. package/dist/components/tooltip/tooltip.scss.js +0 -1
  271. package/dist/css/base.css +0 -1
  272. package/dist/css/themes/grantcodes.css +0 -1
  273. package/dist/fonts/greycliff-bold-oblique.woff +0 -0
  274. package/dist/fonts/greycliff-bold-oblique.woff2 +0 -0
  275. package/dist/fonts/greycliff-bold.woff +0 -0
  276. package/dist/fonts/greycliff-bold.woff2 +0 -0
  277. package/dist/fonts/greycliff-demi-bold-oblique.woff +0 -0
  278. package/dist/fonts/greycliff-demi-bold-oblique.woff2 +0 -0
  279. package/dist/fonts/greycliff-demi-bold.woff +0 -0
  280. package/dist/fonts/greycliff-demi-bold.woff2 +0 -0
  281. package/dist/fonts/greycliff-extra-bold-oblique.woff +0 -0
  282. package/dist/fonts/greycliff-extra-bold-oblique.woff2 +0 -0
  283. package/dist/fonts/greycliff-extra-bold.woff +0 -0
  284. package/dist/fonts/greycliff-extra-bold.woff2 +0 -0
  285. package/dist/fonts/greycliff-extra-light-oblique.woff +0 -0
  286. package/dist/fonts/greycliff-extra-light-oblique.woff2 +0 -0
  287. package/dist/fonts/greycliff-extra-light.woff +0 -0
  288. package/dist/fonts/greycliff-extra-light.woff2 +0 -0
  289. package/dist/fonts/greycliff-heavy-oblique.woff +0 -0
  290. package/dist/fonts/greycliff-heavy-oblique.woff2 +0 -0
  291. package/dist/fonts/greycliff-heavy.woff +0 -0
  292. package/dist/fonts/greycliff-heavy.woff2 +0 -0
  293. package/dist/fonts/greycliff-light-oblique.woff +0 -0
  294. package/dist/fonts/greycliff-light-oblique.woff2 +0 -0
  295. package/dist/fonts/greycliff-light.woff +0 -0
  296. package/dist/fonts/greycliff-light.woff2 +0 -0
  297. package/dist/fonts/greycliff-medium-oblique.woff +0 -0
  298. package/dist/fonts/greycliff-medium-oblique.woff2 +0 -0
  299. package/dist/fonts/greycliff-medium.woff +0 -0
  300. package/dist/fonts/greycliff-medium.woff2 +0 -0
  301. package/dist/fonts/greycliff-regular-oblique.woff +0 -0
  302. package/dist/fonts/greycliff-regular-oblique.woff2 +0 -0
  303. package/dist/fonts/greycliff-regular.woff +0 -0
  304. package/dist/fonts/greycliff-regular.woff2 +0 -0
  305. package/dist/fonts/greycliff-thin-oblique.woff +0 -0
  306. package/dist/fonts/greycliff-thin-oblique.woff2 +0 -0
  307. package/dist/fonts/greycliff-thin.woff +0 -0
  308. package/dist/fonts/greycliff-thin.woff2 +0 -0
  309. package/dist/icons.js +0 -1
  310. package/dist/lib/generate-id.js +0 -1
  311. package/dist/main.js +0 -1
  312. package/dist/node_modules/react/cjs/react.production.min.js +0 -9
  313. package/dist/node_modules/react/index.js +0 -1
  314. package/dist/react.js +0 -1
@@ -0,0 +1,61 @@
1
+ // classnames npm package moved to a local dependency
2
+
3
+ var hasOwn = {}.hasOwnProperty;
4
+
5
+ export function cx() {
6
+ var classes = "";
7
+ var i;
8
+ var arg;
9
+
10
+ for (i = 0; i < arguments.length; i++) {
11
+ arg = arguments[i];
12
+ if (arg) {
13
+ classes = appendClass(classes, parseValue(arg));
14
+ }
15
+ }
16
+
17
+ return classes;
18
+ }
19
+
20
+ function parseValue(arg) {
21
+ if (typeof arg === "string" || typeof arg === "number") {
22
+ return arg;
23
+ }
24
+
25
+ if (typeof arg !== "object") {
26
+ return "";
27
+ }
28
+
29
+ if (Array.isArray(arg)) {
30
+ return cx.apply(null, arg);
31
+ }
32
+
33
+ if (
34
+ arg.toString !== Object.prototype.toString &&
35
+ !arg.toString.toString().includes("[native code]")
36
+ ) {
37
+ return arg.toString();
38
+ }
39
+
40
+ var classes = "";
41
+
42
+ for (var key in arg) {
43
+ if (hasOwn.call(arg, key) && arg[key]) {
44
+ classes = appendClass(classes, key);
45
+ }
46
+ }
47
+
48
+ return classes;
49
+ }
50
+
51
+ function appendClass(value, newClass) {
52
+ if (!newClass) {
53
+ return value;
54
+ }
55
+
56
+ if (value) {
57
+ return `${value} ${newClass}`;
58
+ }
59
+
60
+ return value + newClass;
61
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Generate a unique ID with optional prefix
3
+ * @param {string | undefined} prefix - Optional prefix for the ID
4
+ * @returns {string} Generated unique ID
5
+ */
6
+ function generateId(prefix) {
7
+ return `${prefix || "id"}-${Math.random().toString(36).substr(2, 9)}`;
8
+ }
9
+
10
+ export { generateId };
package/src/main.js ADDED
@@ -0,0 +1,17 @@
1
+ export * from "./components/avatar/index.js";
2
+ export * from "./components/button/index.js";
3
+ export * from "./components/button-group/index.js";
4
+ export * from "./components/card/index.js";
5
+ export * from "./components/code-preview/index.js";
6
+ export * from "./components/container/index.js";
7
+ export * from "./components/dialog/index.js";
8
+ export * from "./components/dropzone/index.js";
9
+ export * from "./components/form-field/index.js";
10
+ export * from "./components/gallery/index.js";
11
+ export * from "./components/icon/index.js";
12
+ export * from "./components/loading/index.js";
13
+ export * from "./components/notice/index.js";
14
+ export * from "./components/pagination/index.js";
15
+ export * from "./components/tabs/index.js";
16
+ export * from "./components/tooltip/index.js";
17
+
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Custom assertions for web components
3
+ */
4
+
5
+ import { strict as assert } from "node:assert";
6
+
7
+ /**
8
+ * Asserts that an element has a specific attribute
9
+ * @param {HTMLElement} element - The element to check
10
+ * @param {string} attribute - The attribute name
11
+ * @param {string} expectedValue - The expected attribute value (optional)
12
+ */
13
+ export function assertAttribute(element, attribute, expectedValue) {
14
+ const hasAttribute = element.hasAttribute(attribute);
15
+ assert.ok(hasAttribute, `Element should have attribute "${attribute}"`);
16
+
17
+ if (expectedValue !== undefined) {
18
+ const actualValue = element.getAttribute(attribute);
19
+ assert.strictEqual(
20
+ actualValue,
21
+ expectedValue,
22
+ `Attribute "${attribute}" should be "${expectedValue}" but was "${actualValue}"`,
23
+ );
24
+ }
25
+ }
26
+
27
+ /**
28
+ * Asserts that an element does not have a specific attribute
29
+ * @param {HTMLElement} element - The element to check
30
+ * @param {string} attribute - The attribute name
31
+ */
32
+ export function assertNoAttribute(element, attribute) {
33
+ const hasAttribute = element.hasAttribute(attribute);
34
+ assert.ok(
35
+ !hasAttribute,
36
+ `Element should not have attribute "${attribute}"`,
37
+ );
38
+ }
39
+
40
+ /**
41
+ * Asserts that an element has a specific class
42
+ * @param {HTMLElement} element - The element to check
43
+ * @param {string} className - The class name
44
+ */
45
+ export function assertClass(element, className) {
46
+ assert.ok(
47
+ element.classList.contains(className),
48
+ `Element should have class "${className}"`,
49
+ );
50
+ }
51
+
52
+ /**
53
+ * Asserts that an element does not have a specific class
54
+ * @param {HTMLElement} element - The element to check
55
+ * @param {string} className - The class name
56
+ */
57
+ export function assertNoClass(element, className) {
58
+ assert.ok(
59
+ !element.classList.contains(className),
60
+ `Element should not have class "${className}"`,
61
+ );
62
+ }
63
+
64
+ /**
65
+ * Asserts that an element matches a CSS selector
66
+ * @param {HTMLElement} element - The element to check
67
+ * @param {string} selector - The CSS selector
68
+ */
69
+ export function assertSelector(element, selector) {
70
+ assert.ok(element.matches(selector), `Element should match selector "${selector}"`);
71
+ }
72
+
73
+ /**
74
+ * Asserts that an element contains specific text content
75
+ * @param {HTMLElement} element - The element to check
76
+ * @param {string} expectedText - The expected text
77
+ */
78
+ export function assertTextContent(element, expectedText) {
79
+ const actualText = element.textContent?.trim();
80
+ assert.strictEqual(
81
+ actualText,
82
+ expectedText,
83
+ `Element text content should be "${expectedText}" but was "${actualText}"`,
84
+ );
85
+ }
86
+
87
+ /**
88
+ * Asserts that an element contains a substring in its text content
89
+ * @param {HTMLElement} element - The element to check
90
+ * @param {string} substring - The substring to find
91
+ */
92
+ export function assertTextIncludes(element, substring) {
93
+ const text = element.textContent || "";
94
+ assert.ok(
95
+ text.includes(substring),
96
+ `Element text should include "${substring}" but was "${text}"`,
97
+ );
98
+ }
99
+
100
+ /**
101
+ * Asserts that a shadow root contains a specific element
102
+ * @param {HTMLElement} element - The element with shadow root
103
+ * @param {string} selector - The CSS selector to find in shadow root
104
+ */
105
+ export function assertShadowElement(element, selector) {
106
+ const shadowRoot = element.shadowRoot || element.renderRoot;
107
+ assert.ok(shadowRoot, "Element should have a shadow root");
108
+
109
+ const found = shadowRoot.querySelector(selector);
110
+ assert.ok(found, `Shadow root should contain element matching "${selector}"`);
111
+ }
112
+
113
+ /**
114
+ * Asserts that an element has a specific ARIA attribute
115
+ * @param {HTMLElement} element - The element to check
116
+ * @param {string} ariaAttribute - The ARIA attribute name (e.g., 'aria-label')
117
+ * @param {string} expectedValue - The expected value (optional)
118
+ */
119
+ export function assertAria(element, ariaAttribute, expectedValue) {
120
+ assertAttribute(element, ariaAttribute, expectedValue);
121
+ }
122
+
123
+ /**
124
+ * Asserts that an element is visible (not hidden by display or visibility)
125
+ * @param {HTMLElement} element - The element to check
126
+ */
127
+ export function assertVisible(element) {
128
+ const style = window.getComputedStyle(element);
129
+ assert.notStrictEqual(style.display, "none", "Element should not have display:none");
130
+ assert.notStrictEqual(
131
+ style.visibility,
132
+ "hidden",
133
+ "Element should not have visibility:hidden",
134
+ );
135
+ }
136
+
137
+ /**
138
+ * Asserts that an element is hidden
139
+ * @param {HTMLElement} element - The element to check
140
+ */
141
+ export function assertHidden(element) {
142
+ const style = window.getComputedStyle(element);
143
+ const isHidden =
144
+ style.display === "none" ||
145
+ style.visibility === "hidden" ||
146
+ element.hidden === true;
147
+ assert.ok(isHidden, "Element should be hidden");
148
+ }
149
+
150
+
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Test utilities for event testing
3
+ */
4
+
5
+ /**
6
+ * Creates and dispatches a custom event on an element
7
+ * @param {HTMLElement} element - The element to dispatch the event on
8
+ * @param {string} eventName - The name of the event
9
+ * @param {Object} detail - Event detail object
10
+ * @returns {boolean} Returns true if the event was not cancelled
11
+ */
12
+ export function dispatchEvent(element, eventName, detail = {}) {
13
+ const event = new CustomEvent(eventName, {
14
+ detail,
15
+ bubbles: true,
16
+ composed: true,
17
+ cancelable: true,
18
+ });
19
+ return element.dispatchEvent(event);
20
+ }
21
+
22
+ /**
23
+ * Waits for an event to be dispatched on an element
24
+ * @param {HTMLElement} element - The element to listen on
25
+ * @param {string} eventName - The name of the event to wait for
26
+ * @param {number} timeout - Maximum time to wait in milliseconds
27
+ * @returns {Promise<Event>} Resolves with the event object
28
+ */
29
+ export function waitForEvent(element, eventName, timeout = 3000) {
30
+ return new Promise((resolve, reject) => {
31
+ const timeoutId = setTimeout(() => {
32
+ element.removeEventListener(eventName, handler);
33
+ reject(
34
+ new Error(`Event "${eventName}" did not fire within ${timeout}ms`),
35
+ );
36
+ }, timeout);
37
+
38
+ const handler = (event) => {
39
+ clearTimeout(timeoutId);
40
+ element.removeEventListener(eventName, handler);
41
+ resolve(event);
42
+ };
43
+
44
+ element.addEventListener(eventName, handler);
45
+ });
46
+ }
47
+
48
+ /**
49
+ * Simulates a click on an element
50
+ * @param {HTMLElement} element - The element to click
51
+ */
52
+ export function click(element) {
53
+ element.click();
54
+ }
55
+
56
+ /**
57
+ * Simulates a keyboard event on an element
58
+ * @param {HTMLElement} element - The element to dispatch the event on
59
+ * @param {string} key - The key to press (e.g., 'Enter', 'Escape')
60
+ * @param {string} type - The event type ('keydown', 'keyup', 'keypress')
61
+ */
62
+ export function keyboard(element, key, type = "keydown") {
63
+ const event = new KeyboardEvent(type, {
64
+ key,
65
+ bubbles: true,
66
+ composed: true,
67
+ cancelable: true,
68
+ });
69
+ element.dispatchEvent(event);
70
+ }
71
+
72
+ /**
73
+ * Simulates focus on an element
74
+ * @param {HTMLElement} element - The element to focus
75
+ */
76
+ export function focus(element) {
77
+ element.focus();
78
+ element.dispatchEvent(new FocusEvent("focus", { bubbles: true }));
79
+ }
80
+
81
+ /**
82
+ * Simulates blur on an element
83
+ * @param {HTMLElement} element - The element to blur
84
+ */
85
+ export function blur(element) {
86
+ element.blur();
87
+ element.dispatchEvent(new FocusEvent("blur", { bubbles: true }));
88
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Test utilities for creating and cleaning up web component fixtures
3
+ */
4
+ import { Window } from "happy-dom";
5
+
6
+ // Initialize happy-dom window
7
+ const window = new Window();
8
+ const document = window.document;
9
+
10
+ // Set up global objects for web components
11
+ globalThis.window = window;
12
+ globalThis.document = document;
13
+ globalThis.HTMLElement = window.HTMLElement;
14
+ globalThis.customElements = window.customElements;
15
+ globalThis.CustomEvent = window.CustomEvent;
16
+ globalThis.Event = window.Event;
17
+
18
+ // Polyfill requestAnimationFrame for test environment
19
+ if (!globalThis.requestAnimationFrame) {
20
+ globalThis.requestAnimationFrame = (callback) => {
21
+ return setTimeout(callback, 0);
22
+ };
23
+ globalThis.cancelAnimationFrame = (id) => {
24
+ clearTimeout(id);
25
+ };
26
+ }
27
+
28
+ /**
29
+ * Creates a web component instance and appends it to the document body
30
+ * @param {string} tagName - The custom element tag name
31
+ * @param {Object} props - Properties to set on the element
32
+ * @returns {Promise<HTMLElement>} The created element after it's connected
33
+ */
34
+ export async function fixture(tagName, props = {}) {
35
+ const element = document.createElement(tagName);
36
+
37
+ // Set properties
38
+ for (const [key, value] of Object.entries(props)) {
39
+ element[key] = value;
40
+ }
41
+
42
+ // Append to body
43
+ document.body.appendChild(element);
44
+
45
+ // Wait for element to be fully connected and updated
46
+ await new Promise((resolve) => setTimeout(resolve, 0));
47
+
48
+ // If it's a LitElement, wait for updateComplete
49
+ if (element.updateComplete) {
50
+ await element.updateComplete;
51
+ }
52
+
53
+ return element;
54
+ }
55
+
56
+ /**
57
+ * Removes an element from the DOM
58
+ * @param {HTMLElement} element - The element to remove
59
+ */
60
+ export function cleanup(element) {
61
+ if (element?.parentNode) {
62
+ element.parentNode.removeChild(element);
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Removes all elements matching the selector from the document
68
+ * @param {string} selector - CSS selector for elements to remove
69
+ */
70
+ export function cleanupAll(selector = "*") {
71
+ const elements = document.querySelectorAll(selector);
72
+ elements.forEach((el) => {
73
+ if (el.parentNode) {
74
+ el.parentNode.removeChild(el);
75
+ }
76
+ });
77
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Test utilities for web components
3
+ */
4
+
5
+ export * from "./assert-helpers.js";
6
+ export * from "./events.js";
7
+ export * from "./fixture.js";
@@ -1 +0,0 @@
1
- var f=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function l(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function a(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.keys(e).length===1?e.default:e}function c(e){if(e.__esModule)return e;var o=e.default;if(typeof o=="function"){var t=function r(){return this instanceof r?Reflect.construct(o,arguments,this.constructor):o.apply(this,arguments)};t.prototype=o.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var u=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,u.get?u:{enumerable:!0,get:function(){return e[r]}})}),t}export{f as commonjsGlobal,c as getAugmentedNamespace,n as getDefaultExportFromCjs,a as getDefaultExportFromNamespaceIfNotNamed,l as getDefaultExportFromNamespaceIfPresent};
@@ -1 +0,0 @@
1
- var e={exports:{}};export{e as __module};
@@ -1 +0,0 @@
1
- import"../node_modules/react/cjs/react.production.min.js";
@@ -1 +0,0 @@
1
- var r={};export{r as __exports};
@@ -1,3 +0,0 @@
1
- import{LitElement as m,html as o,unsafeCSS as h}from"lit";import{property as l,customElement as u}from"lit/decorators.js";import f from"./avatar.scss.js";var v=Object.defineProperty,g=Object.getOwnPropertyDescriptor,e=(i,t,a,n)=>{for(var s=n>1?void 0:n?g(t,a):t,p=i.length-1,c;p>=0;p--)(c=i[p])&&(s=(n?c(t,a,s):c(s))||s);return n&&s&&v(t,a,s),s};let r=class extends m{constructor(){super(...arguments),this.src="",this.name="",this.alt="",this.initials=""}getInitials(){if(this.initials)return this.initials;if(this.name){const[i,t]=this.name.split(" ");return`${i[0]}${t?t[0]:""}`}return""}getAlt(){return this.alt?this.alt:`${this.name||this.initials} avatar`}getImg(){return this.src?o`<img src=${this.src} alt=${this.getAlt()} />`:o``}render(){const i=this.getImg(),t=o`<span class="avatar__initials"
2
- >${this.getInitials()}</span
3
- >`;return o` <div class="avatar">${i||t}</div> `}};r.styles=[h(f)];e([l()],r.prototype,"src",2);e([l()],r.prototype,"name",2);e([l()],r.prototype,"alt",2);e([l()],r.prototype,"initials",2);r=e([u("grantcodes-avatar")],r);export{r as GrantCodesAvatar};
@@ -1 +0,0 @@
1
- import{GrantCodesAvatar as a}from"./avatar.component.js";const r=a;export{a as GrantCodesAvatar,r as default};
@@ -1 +0,0 @@
1
- import*as a from"../../node_modules/react/index.js";import{createComponent as t}from"@lit/react";import{GrantCodesAvatar as r}from"./avatar.component.js";const m=t({tagName:"grantcodes-avatar",elementClass:r,react:a});export{m as Avatar};
@@ -1 +0,0 @@
1
- const e="*,*:before,*:after{box-sizing:border-box}:host{display:block}.avatar{display:flex;align-items:center;justify-content:center;width:3rem;height:3rem;border-radius:50%;overflow:hidden;background-color:var(--color-base-primary-200);color:var(--color-base-primary-900);text-align:center;font-size:1.2rem;font-weight:700}.avatar__image{width:100%;height:100%;object-fit:cover;object-position:center}.avatar__fallback{line-height:1}";export{e as default};
@@ -1 +0,0 @@
1
- import"./avatar.js";
@@ -1,5 +0,0 @@
1
- import{LitElement as a,unsafeCSS as u}from"lit";import{literal as f,html as h}from"lit/static-html.js";import{property as i,customElement as c}from"lit/decorators.js";import b from"./button.scss.js";var v=Object.defineProperty,_=Object.getOwnPropertyDescriptor,m=(r,e,n,o)=>{for(var t=o>1?void 0:o?_(e,n):e,p=r.length-1,l;p>=0;p--)(l=r[p])&&(t=(o?l(e,n,t):l(t))||t);return o&&t&&v(e,n,t),t};let s=class extends a{render(){const r=this.href?f`a`:f`button`;return h`
2
- <${r} href="${this.href}" class="button">
3
- <span><slot></slot></span>
4
- </${r}>
5
- `}};s.styles=[u(b)];m([i()],s.prototype,"href",2);s=m([c("grantcodes-button")],s);export{s as GrantCodesButton};
@@ -1 +0,0 @@
1
- import{GrantCodesButton as t}from"./button.component.js";const n=t;export{t as GrantCodesButton,n as default};
@@ -1 +0,0 @@
1
- import*as t from"../../node_modules/react/index.js";import{createComponent as o}from"@lit/react";import{GrantCodesButton as e}from"./button.component.js";const m=o({tagName:"grantcodes-button",elementClass:e,react:t});export{m as Button};
@@ -1 +0,0 @@
1
- const o="*,*:before,*:after{box-sizing:border-box}:host{display:block}.button{display:inline-flex;flex-direction:row;align-items:center;gap:.5rem;background:var(--component-button-base-background);color:var(--component-button-base-color);border-width:var(--component-button-base-border-width);border-style:solid;border-color:var(--component-button-base-border-color);padding:.5em 1em;border-radius:var(--component-button-base-border-radius);font-size:1rem;font-weight:700;letter-spacing:.05em;text-decoration:none;outline:1px solid transparent;transition:color .2s,border-color .2s,background-color .2s,outline .2s;outline-color:transparent;outline-offset:var(--component-focus-ring-offset, 0px);outline-style:solid;outline-width:var(--component-focus-ring-width, 2px)}.button:focus-visible{outline-color:var(--component-focus-ring-color)}@media (prefers-contrast: more){.button:focus-visible{--component-focus-ring-color: var(--color-base-primary-200);box-shadow:0 0 0 calc((var(--component-focus-ring-width) + var(--component-focus-ring-offset, 0px)) * 1.5) var(--color-base-primary-800)}}.button:hover,.button:focus-visible{color:var(--component-button-active-color);background:var(--component-button-active-background);cursor:pointer;text-decoration:none}.button:active{transform:translateY(1px)}.button[disabled]{cursor:not-allowed;filter:grayscale(70%);opacity:.8}";export{o as default};
@@ -1 +0,0 @@
1
- import"./button.js";
@@ -1,5 +0,0 @@
1
- import{LitElement as u,html as m,unsafeCSS as f}from"lit";import{customElement as v}from"lit/decorators.js";import a from"./button-group.scss.js";var c=Object.defineProperty,i=Object.getOwnPropertyDescriptor,_=(p,r,o,e)=>{for(var t=e>1?void 0:e?i(r,o):r,s=p.length-1,n;s>=0;s--)(n=p[s])&&(t=(e?n(r,o,t):n(t))||t);return e&&t&&c(r,o,t),t};let l=class extends u{render(){return m`
2
- <div class="button-group">
3
- <slot></slot>
4
- </div>
5
- `}};l.styles=[f(a)];l=_([v("grantcodes-button-group")],l);export{l as GrantCodesButtonGroup};
@@ -1 +0,0 @@
1
- import{GrantCodesButtonGroup as o}from"./button-group.component.js";const r=o;export{o as GrantCodesButtonGroup,r as default};
@@ -1 +0,0 @@
1
- import*as o from"../../node_modules/react/index.js";import{createComponent as t}from"@lit/react";import{GrantCodesButtonGroup as r}from"./button-group.component.js";const m=t({tagName:"grantcodes-button-group",elementClass:r,react:o});export{m as ButtonGroup};
@@ -1 +0,0 @@
1
- const o="*,*:before,*:after{box-sizing:border-box}:host{display:block}.button-group{display:flex;flex-direction:row;flex-wrap:wrap;background:var(--component-button-base-background);border-radius:var(--component-button-base-border-radius);min-width:fit-content;max-width:100%}";export{o as default};
@@ -1 +0,0 @@
1
- import"./button-group.js";
@@ -1,8 +0,0 @@
1
- import{LitElement as n,html as d,unsafeCSS as m}from"lit";import{customElement as _}from"lit/decorators.js";import f from"./card.scss.js";var p=Object.defineProperty,i=Object.getOwnPropertyDescriptor,v=(l,e,t,s)=>{for(var r=s>1?void 0:s?i(e,t):e,a=l.length-1,o;a>=0;a--)(o=l[a])&&(r=(s?o(e,t,r):o(r))||r);return s&&r&&p(e,t,r),r};let c=class extends n{render(){return d`
2
- <div class="card">
3
- <slot name="card-header" class="card__header"></slot>
4
- <slot name="card-content" class="card__content"></slot>
5
- <slot name="card-actions" class="card__actions"></slot>
6
- <slot name="card-footer" class="card__footer"></slot>
7
- </div>
8
- `}};c.styles=[m(f)];c=v([_("grantcodes-card")],c);export{c as GrantCodesCard};
@@ -1 +0,0 @@
1
- import{GrantCodesCard as a}from"./card.component.js";const d=a;export{a as GrantCodesCard,d as default};
@@ -1 +0,0 @@
1
- import*as r from"../../node_modules/react/index.js";import{createComponent as e}from"@lit/react";import{GrantCodesCard as o}from"./card.component.js";const m=e({tagName:"grantcodes-card",elementClass:o,react:r});export{m as Card};
@@ -1 +0,0 @@
1
- const r='*,*:before,*:after{box-sizing:border-box}:host{display:block}.card{display:flex;width:100%;flex-direction:column;justify-content:flex-start;overflow:hidden;background:var(--component-card-background);border-style:solid;border-width:var(--component-card-border-width);border-color:var(--component-card-border-color);border-radius:var(--component-card-border-radius)}.card>img{display:block;width:100%}.card__content{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--size-space-unit, 1rem);padding:var(--size-space-unit, 1rem)}.card__content>*{margin:0}.card__content>*:first-child{margin-block-start:0}.card__content>*:last-child{margin-block-end:0}.card .card__actions{display:flex;width:100%;margin-block-start:auto;border-radius:0;flex-direction:row;flex-wrap:wrap;background:var(--component-button-base-background)}.card__meta{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;gap:var(--size-space-unit);margin:0;padding-inline:var(--size-space-unit, 1rem);padding-block:1em;font-size:var(--font-size-small);background-color:var(--color-base-light-shade);color:var(--color-base-dark-shade)}.card__meta__item{display:flex;flex-direction:row;align-items:center;flex-wrap:nowrap;gap:.3em}.card__meta__item dt,.card__meta__item dd{display:block;margin:0;padding:0}.card__meta__item dt:after{content:":"}';export{r as default};
@@ -1 +0,0 @@
1
- import"./card.js";
@@ -1,3 +0,0 @@
1
- import{LitElement as h,html as m,unsafeCSS as d}from"lit";import{property as a,query as c,customElement as g}from"lit/decorators.js";import{codeToHtml as v}from"shiki/bundle/web";import u from"./code-preview.scss.js";var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,s=(o,t,p,i)=>{for(var e=i>1?void 0:i?w(t,p):t,n=o.length-1,l;n>=0;n--)(l=o[n])&&(e=(i?l(t,p,e):l(e))||e);return i&&e&&f(t,p,e),e};let r=class extends h{constructor(){super(...arguments),this.language="html",this.theme="aurora-x"}async doHighlight(){const o=this.textContent??"",t=await v(o.trim(),{lang:this.language,theme:this.theme});this.codePreview.innerHTML=t}firstUpdated(){this.doHighlight()}render(){return m`<div class="code-preview">
2
- <pre><slot></slot></pre>
3
- </div> `}};r.styles=[d(u)];s([a({type:String})],r.prototype,"language",2);s([a({type:String})],r.prototype,"theme",2);s([c(".code-preview")],r.prototype,"codePreview",2);r=s([g("grantcodes-code-preview")],r);export{r as GrantCodesCodePreview};
@@ -1 +0,0 @@
1
- import{GrantCodesCodePreview as e}from"./code-preview.component.js";const r=e;export{e as GrantCodesCodePreview,r as default};
@@ -1 +0,0 @@
1
- import*as e from"../../node_modules/react/index.js";import{createComponent as o}from"@lit/react";import{GrantCodesCodePreview as r}from"./code-preview.component.js";const a=o({tagName:"grantcodes-code-preview",elementClass:r,react:e});export{a as CodePreview};
@@ -1 +0,0 @@
1
- const e="*,*:before,*:after{box-sizing:border-box}:host{display:block}.code-preview>pre{display:block;font-family:var(--font-family-mono);line-height:1.2;width:100%;overflow:auto;border-radius:var(--component-card-border-radius);box-shadow:.1rem .2rem .4rem #0000001a;font-size:var(--font-size-small);font-weight:400;padding:var(--size-space-unit, 1rem)}";export{e as default};
@@ -1 +0,0 @@
1
- import"./code-preview.js";
@@ -1,5 +0,0 @@
1
- import{LitElement as c,html as f,unsafeCSS as m}from"lit";import{property as p,customElement as d}from"lit/decorators.js";import u from"classnames";import v from"./container.scss.js";var h=Object.defineProperty,g=Object.getOwnPropertyDescriptor,l=(r,n,i,o)=>{for(var t=o>1?void 0:o?g(n,i):n,s=r.length-1,a;s>=0;s--)(a=r[s])&&(t=(o?a(n,i,t):a(t))||t);return o&&t&&h(n,i,t),t};let e=class extends c{constructor(){super(...arguments),this.align="default",this.nopad=!1}render(){const r=u("container",{"container--wide":this.align==="wide","container--full":this.align==="full","container--viewport":this.align==="viewport","container--nopad":this.nopad});return f`
2
- <div class="${r}">
3
- <slot></slot>
4
- </div>
5
- `}};e.styles=[m(v)];l([p()],e.prototype,"align",2);l([p({type:Boolean})],e.prototype,"nopad",2);e=l([d("grantcodes-container")],e);export{e as GrantCodesContainer};
@@ -1 +0,0 @@
1
- import{GrantCodesContainer as n}from"./container.component.js";const o=n;export{n as GrantCodesContainer,o as default};
@@ -1 +0,0 @@
1
- import*as e from"../../node_modules/react/index.js";import{createComponent as o}from"@lit/react";import{GrantCodesContainer as t}from"./container.component.js";const a=o({tagName:"grantcodes-container",elementClass:t,react:e});export{a as Container};
@@ -1 +0,0 @@
1
- const i="*,*:before,*:after{box-sizing:border-box}:host{display:block}.container{display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;width:var(--size-block-width-normal);max-width:100%;padding-inline:var(--size-space-unit);margin-inline:auto;background-color:inherit}.container--wide{width:var(--size-block-width-wide)}.container--full{width:100%}.container--viewport{left:50%;position:relative;right:50%;margin-left:-50vw;margin-right:-50vw;max-width:100vw;width:100vw;margin-left:-50dvw;margin-right:-50dvw;max-width:100dvw;width:100dvw}.container--nopad{padding-inline:0}";export{i as default};
@@ -1 +0,0 @@
1
- import"./container.js";
@@ -1,23 +0,0 @@
1
- import{LitElement as m,html as p,unsafeCSS as h}from"lit";import{query as f,property as d,customElement as g}from"lit/decorators.js";import c from"./dialog.scss.js";var u=Object.defineProperty,_=Object.getOwnPropertyDescriptor,i=(o,t,a,l)=>{for(var e=l>1?void 0:l?_(t,a):t,r=o.length-1,n;r>=0;r--)(n=o[r])&&(e=(l?n(t,a,e):n(e))||e);return l&&e&&u(t,a,e),e};let s=class extends m{constructor(){super(...arguments),this.open=!1,this.dismissible=!0}updated(o){o.has("open")&&this._handleOpenChange()}_handleOpenChange(){this.open?this.dialog.showModal():this.dialog.close()}dismissTemplate(){return this.dismissible?p`
2
- <button
3
- class="dialog__dismiss"
4
- @click=${()=>{this.open=!1}}
5
- aria-label="Dismiss dialog"
6
- >
7
- &times;
8
- </button>
9
- `:p``}render(){return p`
10
- <dialog class="dialog" ?open=${this.open}>
11
- ${this.dismissTemplate()}
12
-
13
- <header class="dialog__header">
14
- <slot name="header"></slot>
15
- </header>
16
-
17
- <slot class="dialog__content"></slot>
18
-
19
- <footer class="dialog__footer">
20
- <slot name="footer"> </slot>
21
- </footer>
22
- </dialog>
23
- `}};s.styles=[h(c)];i([f("dialog")],s.prototype,"dialog",2);i([d({type:Boolean,reflect:!0})],s.prototype,"open",2);i([d({type:Boolean})],s.prototype,"dismissible",2);s=i([g("grantcodes-dialog")],s);export{s as GrantCodesDialog};
@@ -1 +0,0 @@
1
- import{GrantCodesDialog as a}from"./dialog.component.js";const s=a;export{a as GrantCodesDialog,s as default};
@@ -1 +0,0 @@
1
- import*as o from"../../node_modules/react/index.js";import{createComponent as e}from"@lit/react";import{GrantCodesDialog as t}from"./dialog.component.js";const m=e({tagName:"grantcodes-dialog",elementClass:t,react:o});export{m as Dialog};
@@ -1 +0,0 @@
1
- const e="*,*:before,*:after{box-sizing:border-box}:host{display:block}.dialog{width:100%;padding:0;max-width:var(--size-block-width-normal);background:var(--component-card-background);border-style:solid;border-width:var(--component-card-border-width);border-color:var(--component-card-border-color);border-radius:var(--component-card-border-radius);overflow:hidden}.dialog::backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#0006;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.dialog__dismiss{display:block;position:absolute;border:none;line-height:1;font-size:1.4rem;cursor:pointer;background:transparent;inset-block-start:var(--size-space-unit, 1rem);inset-inline-end:var(--size-space-unit, 1rem);margin-block-start:-.25rem;margin-inline-end:-.25rem;border-radius:50%;width:2rem;height:2rem;padding:.25rem;justify-content:center;align-items:center}.dialog__content{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--size-space-unit, 1rem);padding:var(--size-space-unit, 1rem)}.dialog__header:empty,.dialog__header:has(slot:empty),.dialog__footer:empty,.dialog__footer:has(slot:empty){display:none}.dialog__header{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding:var(--size-space-unit, 1rem);border-bottom:var(--component-card-border-width) solid var(--component-card-border-color)}.dialog__footer ::slotted(grantcodes-button-group){--component-button-base-border-radius: 0}";export{e as default};
@@ -1 +0,0 @@
1
- import"./dialog.js";
@@ -1,11 +0,0 @@
1
- import{LitElement as d,html as p,unsafeCSS as u}from"lit";import{property as f,queryAssignedElements as h,state as i,customElement as _}from"lit/decorators.js";import m from"classnames";import v from"./dropzone.scss.js";var b=Object.defineProperty,g=Object.getOwnPropertyDescriptor,s=(t,l,o,n)=>{for(var e=n>1?void 0:n?g(l,o):l,a=t.length-1,c;a>=0;a--)(c=t[a])&&(e=(n?c(l,o,e):c(e))||e);return n&&e&&b(l,o,e),e};let r=class extends d{constructor(){super(...arguments),this.fullscreenOnDrag=!1,this._fullscreen=!1,this._enableFullscreen=()=>{this.fullscreenOnDrag&&(this._fullscreen=!0)},this._disableFullscreen=()=>{this._fullscreen=!1}}connectedCallback(){super.connectedCallback(),document.addEventListener("dragenter",this._enableFullscreen),document.addEventListener("dragend",this._disableFullscreen)}disconnectedCallback(){document.removeEventListener("dragenter",this._enableFullscreen),document.removeEventListener("dragend",this._disableFullscreen),super.disconnectedCallback()}firstUpdated(){if(this._input.length===0)throw new Error("No file input found");this._placeholder=this._input[0].placeholder}render(){const t=m("dropzone",{"dropzone--fullscreen":this._fullscreen});return p`
2
- <div
3
- class=${t}
4
- @mouseLeave=${this._disableFullscreen}
5
- @dragEnd=${this._disableFullscreen}
6
- @dragLeave=${this._disableFullscreen}
7
- >
8
- <slot></slot>
9
- <span class="dropzone__placeholder">${this._placeholder}</span>
10
- </div>
11
- `}};r.styles=[u(v)];s([f({type:Boolean,reflect:!0})],r.prototype,"fullscreenOnDrag",2);s([h({selector:"input[type=file]"})],r.prototype,"_input",2);s([i()],r.prototype,"_fullscreen",2);s([i()],r.prototype,"_placeholder",2);r=s([_("grantcodes-dropzone")],r);export{r as GrantCodesDropzone};
@@ -1 +0,0 @@
1
- import{GrantCodesDropzone as o}from"./dropzone.component.js";const e=o;export{o as GrantCodesDropzone,e as default};
@@ -1 +0,0 @@
1
- import*as o from"../../node_modules/react/index.js";import{createComponent as e}from"@lit/react";import{GrantCodesDropzone as r}from"./dropzone.component.js";const m=e({tagName:"grantcodes-dropzone",elementClass:r,react:o});export{m as Dropzone};
@@ -1 +0,0 @@
1
- const e='*,*:before,*:after{box-sizing:border-box}:host{display:block}.dropzone{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:2rem;border:max(var(--size-border-width),.2rem) dashed var(--color-base-primary-500);border-radius:var(--size-border-radius)}.dropzone--fullscreen:before{content:"";position:fixed;display:block;top:0;right:0;bottom:0;left:0;z-index:10;background-color:#ffffffe6}.dropzone--fullscreen:after{content:"";display:flex;position:fixed;top:2rem;right:2rem;bottom:2rem;left:2rem;justify-content:center;align-items:center;padding:2rem;border:max(var(--size-border-width) * 2,.4rem) dashed var(--color-base-primary-500);border-radius:calc(var(--size-border-radius) * 2);z-index:11;font-weight:700;color:inherit}::slotted(input),.dropzone__input{position:absolute;display:block;width:100%;height:100%;top:0;right:0;bottom:0;left:0;opacity:0;cursor:pointer}.dropzone--fullscreen ::slotted(input),.dropzone--fullscreen .dropzone__input{position:fixed;z-index:12}';export{e as default};
@@ -1 +0,0 @@
1
- import"./dropzone.js";