@dropins/tools 0.21.1 → 0.21.2-alpha2

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 (478) hide show
  1. package/components/Accordion/Accordion.d.ts +25 -0
  2. package/components/Accordion/Accordion.d.ts.map +1 -0
  3. package/components/Accordion/Accordion.jsx +59 -0
  4. package/components/Accordion/Accordion.stories.d.ts +22 -0
  5. package/components/Accordion/Accordion.stories.d.ts.map +1 -0
  6. package/components/Accordion/Accordion.stories.jsx +320 -0
  7. package/components/Accordion/Accordion.test.d.ts +3 -0
  8. package/components/Accordion/Accordion.test.d.ts.map +1 -0
  9. package/components/Accordion/Accordion.test.jsx +79 -0
  10. package/components/Accordion/index.d.ts +3 -0
  11. package/components/Accordion/index.d.ts.map +1 -0
  12. package/components/Accordion/index.js +2 -0
  13. package/components/ActionButton/ActionButton.d.ts +11 -0
  14. package/components/ActionButton/ActionButton.d.ts.map +1 -0
  15. package/components/ActionButton/ActionButton.jsx +14 -0
  16. package/components/ActionButton/ActionButton.stories.d.ts +16 -0
  17. package/components/ActionButton/ActionButton.stories.d.ts.map +1 -0
  18. package/components/ActionButton/ActionButton.stories.jsx +119 -0
  19. package/components/ActionButton/ActionButton.test.d.ts +3 -0
  20. package/components/ActionButton/ActionButton.test.d.ts.map +1 -0
  21. package/components/ActionButton/ActionButton.test.jsx +47 -0
  22. package/components/ActionButton/index.d.ts +2 -0
  23. package/components/ActionButton/index.d.ts.map +1 -0
  24. package/components/ActionButton/index.js +1 -0
  25. package/components/ActionButtonGroup/ActionButtonGroup.d.ts +20 -0
  26. package/components/ActionButtonGroup/ActionButtonGroup.d.ts.map +1 -0
  27. package/components/ActionButtonGroup/ActionButtonGroup.jsx +39 -0
  28. package/components/ActionButtonGroup/ActionButtonGroup.stories.d.ts +16 -0
  29. package/components/ActionButtonGroup/ActionButtonGroup.stories.d.ts.map +1 -0
  30. package/components/ActionButtonGroup/ActionButtonGroup.stories.jsx +72 -0
  31. package/components/ActionButtonGroup/ActionButtonGroup.test.d.ts +3 -0
  32. package/components/ActionButtonGroup/ActionButtonGroup.test.d.ts.map +1 -0
  33. package/components/ActionButtonGroup/ActionButtonGroup.test.jsx +78 -0
  34. package/components/ActionButtonGroup/index.d.ts +2 -0
  35. package/components/ActionButtonGroup/index.d.ts.map +1 -0
  36. package/components/ActionButtonGroup/index.js +1 -0
  37. package/components/AlertBanner/AlertBanner.d.ts +15 -0
  38. package/components/AlertBanner/AlertBanner.d.ts.map +1 -0
  39. package/components/AlertBanner/AlertBanner.jsx +30 -0
  40. package/components/AlertBanner/AlertBanner.stories.d.ts +17 -0
  41. package/components/AlertBanner/AlertBanner.stories.d.ts.map +1 -0
  42. package/components/AlertBanner/AlertBanner.stories.jsx +128 -0
  43. package/components/AlertBanner/AlertBanner.test.d.ts +3 -0
  44. package/components/AlertBanner/AlertBanner.test.d.ts.map +1 -0
  45. package/components/AlertBanner/AlertBanner.test.jsx +40 -0
  46. package/components/AlertBanner/index.d.ts +3 -0
  47. package/components/AlertBanner/index.d.ts.map +1 -0
  48. package/components/AlertBanner/index.js +2 -0
  49. package/components/Breadcrumbs/Breadcrumbs.d.ts +9 -0
  50. package/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -0
  51. package/components/Breadcrumbs/Breadcrumbs.jsx +26 -0
  52. package/components/Breadcrumbs/Breadcrumbs.stories.d.ts +15 -0
  53. package/components/Breadcrumbs/Breadcrumbs.stories.d.ts.map +1 -0
  54. package/components/Breadcrumbs/Breadcrumbs.stories.jsx +110 -0
  55. package/components/Breadcrumbs/Breadcrumbs.test.d.ts +3 -0
  56. package/components/Breadcrumbs/Breadcrumbs.test.d.ts.map +1 -0
  57. package/components/Breadcrumbs/Breadcrumbs.test.jsx +67 -0
  58. package/components/Breadcrumbs/index.d.ts +3 -0
  59. package/components/Breadcrumbs/index.d.ts.map +1 -0
  60. package/components/Breadcrumbs/index.js +2 -0
  61. package/components/Button/Button.d.ts +15 -0
  62. package/components/Button/Button.d.ts.map +1 -0
  63. package/components/Button/Button.jsx +59 -0
  64. package/components/Button/Button.stories.d.ts +135 -0
  65. package/components/Button/Button.stories.d.ts.map +1 -0
  66. package/components/Button/Button.stories.jsx +354 -0
  67. package/components/Button/Button.test.d.ts +2 -0
  68. package/components/Button/Button.test.d.ts.map +1 -0
  69. package/components/Button/Button.test.jsx +134 -0
  70. package/components/Button/index.d.ts +3 -0
  71. package/components/Button/index.d.ts.map +1 -0
  72. package/components/Button/index.js +2 -0
  73. package/components/Card/Card.d.ts +9 -0
  74. package/components/Card/Card.d.ts.map +1 -0
  75. package/components/Card/Card.jsx +7 -0
  76. package/components/Card/Card.stories.d.ts +16 -0
  77. package/components/Card/Card.stories.d.ts.map +1 -0
  78. package/components/Card/Card.stories.jsx +47 -0
  79. package/components/Card/Card.test.d.ts +3 -0
  80. package/components/Card/Card.test.d.ts.map +1 -0
  81. package/components/Card/Card.test.jsx +26 -0
  82. package/components/Card/index.d.ts +2 -0
  83. package/components/Card/index.d.ts.map +1 -0
  84. package/components/Card/index.js +1 -0
  85. package/components/CartItem/CartItem.d.ts +25 -0
  86. package/components/CartItem/CartItem.d.ts.map +1 -0
  87. package/components/CartItem/CartItem.jsx +124 -0
  88. package/components/CartItem/CartItem.stories.d.ts +54 -0
  89. package/components/CartItem/CartItem.stories.d.ts.map +1 -0
  90. package/components/CartItem/CartItem.stories.jsx +309 -0
  91. package/components/CartItem/CartItem.test.d.ts +3 -0
  92. package/components/CartItem/CartItem.test.d.ts.map +1 -0
  93. package/components/CartItem/CartItem.test.jsx +71 -0
  94. package/components/CartItem/CartItemSkeleton.d.ts +3 -0
  95. package/components/CartItem/CartItemSkeleton.d.ts.map +1 -0
  96. package/components/CartItem/CartItemSkeleton.jsx +25 -0
  97. package/components/CartItem/CartItemSkeleton.test.d.ts +3 -0
  98. package/components/CartItem/CartItemSkeleton.test.d.ts.map +1 -0
  99. package/components/CartItem/CartItemSkeleton.test.jsx +11 -0
  100. package/components/CartItem/index.d.ts +4 -0
  101. package/components/CartItem/index.d.ts.map +1 -0
  102. package/components/CartItem/index.js +3 -0
  103. package/components/CartList/CartList.d.ts +7 -0
  104. package/components/CartList/CartList.d.ts.map +1 -0
  105. package/components/CartList/CartList.jsx +14 -0
  106. package/components/CartList/CartList.stories.d.ts +17 -0
  107. package/components/CartList/CartList.stories.d.ts.map +1 -0
  108. package/components/CartList/CartList.stories.jsx +54 -0
  109. package/components/CartList/CartList.test.d.ts +3 -0
  110. package/components/CartList/CartList.test.d.ts.map +1 -0
  111. package/components/CartList/CartList.test.jsx +12 -0
  112. package/components/CartList/index.d.ts +3 -0
  113. package/components/CartList/index.d.ts.map +1 -0
  114. package/components/CartList/index.js +2 -0
  115. package/components/Checkbox/Checkbox.d.ts +13 -0
  116. package/components/Checkbox/Checkbox.d.ts.map +1 -0
  117. package/components/Checkbox/Checkbox.jsx +51 -0
  118. package/components/Checkbox/Checkbox.stories.d.ts +22 -0
  119. package/components/Checkbox/Checkbox.stories.d.ts.map +1 -0
  120. package/components/Checkbox/Checkbox.stories.jsx +157 -0
  121. package/components/Checkbox/Checkbox.test.d.ts +3 -0
  122. package/components/Checkbox/Checkbox.test.d.ts.map +1 -0
  123. package/components/Checkbox/Checkbox.test.jsx +136 -0
  124. package/components/Checkbox/index.d.ts +2 -0
  125. package/components/Checkbox/index.d.ts.map +1 -0
  126. package/components/Checkbox/index.js +1 -0
  127. package/components/ColorSwatch/ColorSwatch.d.ts +20 -0
  128. package/components/ColorSwatch/ColorSwatch.d.ts.map +1 -0
  129. package/components/ColorSwatch/ColorSwatch.jsx +57 -0
  130. package/components/ColorSwatch/ColorSwatch.stories.d.ts +20 -0
  131. package/components/ColorSwatch/ColorSwatch.stories.d.ts.map +1 -0
  132. package/components/ColorSwatch/ColorSwatch.stories.jsx +206 -0
  133. package/components/ColorSwatch/ColorSwatch.test.d.ts +3 -0
  134. package/components/ColorSwatch/ColorSwatch.test.d.ts.map +1 -0
  135. package/components/ColorSwatch/ColorSwatch.test.jsx +87 -0
  136. package/components/ColorSwatch/index.d.ts +3 -0
  137. package/components/ColorSwatch/index.d.ts.map +1 -0
  138. package/components/ColorSwatch/index.js +2 -0
  139. package/components/Divider/Divider.d.ts +8 -0
  140. package/components/Divider/Divider.d.ts.map +1 -0
  141. package/components/Divider/Divider.jsx +9 -0
  142. package/components/Divider/Divider.stories.d.ts +11 -0
  143. package/components/Divider/Divider.stories.d.ts.map +1 -0
  144. package/components/Divider/Divider.stories.jsx +43 -0
  145. package/components/Divider/Divider.test.d.ts +2 -0
  146. package/components/Divider/Divider.test.d.ts.map +1 -0
  147. package/components/Divider/Divider.test.jsx +19 -0
  148. package/components/Divider/index.d.ts +3 -0
  149. package/components/Divider/index.d.ts.map +1 -0
  150. package/components/Divider/index.js +2 -0
  151. package/components/Field/Field.d.ts +14 -0
  152. package/components/Field/Field.d.ts.map +1 -0
  153. package/components/Field/Field.jsx +29 -0
  154. package/components/Field/Field.stories.d.ts +37 -0
  155. package/components/Field/Field.stories.d.ts.map +1 -0
  156. package/components/Field/Field.stories.jsx +174 -0
  157. package/components/Field/Field.test.d.ts +3 -0
  158. package/components/Field/Field.test.d.ts.map +1 -0
  159. package/components/Field/Field.test.jsx +91 -0
  160. package/components/Field/index.d.ts +2 -0
  161. package/components/Field/index.d.ts.map +1 -0
  162. package/components/Field/index.js +1 -0
  163. package/components/Icon/Icon.d.ts +11 -0
  164. package/components/Icon/Icon.d.ts.map +1 -0
  165. package/components/Icon/Icon.jsx +57 -0
  166. package/components/Icon/Icon.stories.d.ts +16 -0
  167. package/components/Icon/Icon.stories.d.ts.map +1 -0
  168. package/components/Icon/Icon.stories.helpers.d.ts +4 -0
  169. package/components/Icon/Icon.stories.helpers.d.ts.map +1 -0
  170. package/components/Icon/Icon.stories.helpers.jsx +7 -0
  171. package/components/Icon/Icon.stories.jsx +48 -0
  172. package/components/Icon/Icon.test.d.ts +3 -0
  173. package/components/Icon/Icon.test.d.ts.map +1 -0
  174. package/components/Icon/Icon.test.jsx +67 -0
  175. package/components/Icon/index.d.ts +2 -0
  176. package/components/Icon/index.d.ts.map +1 -0
  177. package/components/Icon/index.js +1 -0
  178. package/components/IllustratedMessage/IllustratedMessage.d.ts +13 -0
  179. package/components/IllustratedMessage/IllustratedMessage.d.ts.map +1 -0
  180. package/components/IllustratedMessage/IllustratedMessage.jsx +21 -0
  181. package/components/IllustratedMessage/IllustratedMessage.stories.d.ts +10 -0
  182. package/components/IllustratedMessage/IllustratedMessage.stories.d.ts.map +1 -0
  183. package/components/IllustratedMessage/IllustratedMessage.stories.jsx +90 -0
  184. package/components/IllustratedMessage/IllustratedMessage.test.d.ts +3 -0
  185. package/components/IllustratedMessage/IllustratedMessage.test.d.ts.map +1 -0
  186. package/components/IllustratedMessage/IllustratedMessage.test.jsx +42 -0
  187. package/components/IllustratedMessage/index.d.ts +3 -0
  188. package/components/IllustratedMessage/index.d.ts.map +1 -0
  189. package/components/IllustratedMessage/index.js +2 -0
  190. package/components/Image/Image.d.ts +11 -0
  191. package/components/Image/Image.d.ts.map +1 -0
  192. package/components/Image/Image.jsx +26 -0
  193. package/components/Image/Image.stories.d.ts +11 -0
  194. package/components/Image/Image.stories.d.ts.map +1 -0
  195. package/components/Image/Image.stories.jsx +66 -0
  196. package/components/Image/Image.test.d.ts +3 -0
  197. package/components/Image/Image.test.d.ts.map +1 -0
  198. package/components/Image/Image.test.jsx +82 -0
  199. package/components/Image/index.d.ts +2 -0
  200. package/components/Image/index.d.ts.map +1 -0
  201. package/components/Image/index.js +1 -0
  202. package/components/ImageSwatch/ImageSwatch.d.ts +20 -0
  203. package/components/ImageSwatch/ImageSwatch.d.ts.map +1 -0
  204. package/components/ImageSwatch/ImageSwatch.jsx +49 -0
  205. package/components/ImageSwatch/ImageSwatch.stories.d.ts +20 -0
  206. package/components/ImageSwatch/ImageSwatch.stories.d.ts.map +1 -0
  207. package/components/ImageSwatch/ImageSwatch.stories.jsx +206 -0
  208. package/components/ImageSwatch/ImageSwatch.test.d.ts +3 -0
  209. package/components/ImageSwatch/ImageSwatch.test.d.ts.map +1 -0
  210. package/components/ImageSwatch/ImageSwatch.test.jsx +64 -0
  211. package/components/ImageSwatch/index.d.ts +3 -0
  212. package/components/ImageSwatch/index.d.ts.map +1 -0
  213. package/components/ImageSwatch/index.js +2 -0
  214. package/components/InLineAlert/InLineAlert.d.ts +16 -0
  215. package/components/InLineAlert/InLineAlert.d.ts.map +1 -0
  216. package/components/InLineAlert/InLineAlert.jsx +38 -0
  217. package/components/InLineAlert/InLineAlert.stories.d.ts +86 -0
  218. package/components/InLineAlert/InLineAlert.stories.d.ts.map +1 -0
  219. package/components/InLineAlert/InLineAlert.stories.jsx +193 -0
  220. package/components/InLineAlert/InLineAlert.test.d.ts +3 -0
  221. package/components/InLineAlert/InLineAlert.test.d.ts.map +1 -0
  222. package/components/InLineAlert/InLineAlert.test.jsx +77 -0
  223. package/components/InLineAlert/index.d.ts +3 -0
  224. package/components/InLineAlert/index.d.ts.map +1 -0
  225. package/components/InLineAlert/index.js +2 -0
  226. package/components/Incrementer/Incrementer.d.ts +17 -0
  227. package/components/Incrementer/Incrementer.d.ts.map +1 -0
  228. package/components/Incrementer/Incrementer.jsx +87 -0
  229. package/components/Incrementer/Incrementer.stories.d.ts +10 -0
  230. package/components/Incrementer/Incrementer.stories.d.ts.map +1 -0
  231. package/components/Incrementer/Incrementer.stories.jsx +68 -0
  232. package/components/Incrementer/Incrementer.test.d.ts +3 -0
  233. package/components/Incrementer/Incrementer.test.d.ts.map +1 -0
  234. package/components/Incrementer/Incrementer.test.jsx +112 -0
  235. package/components/Incrementer/index.d.ts +2 -0
  236. package/components/Incrementer/index.d.ts.map +1 -0
  237. package/components/Incrementer/index.js +1 -0
  238. package/components/Input/Input.d.ts +19 -0
  239. package/components/Input/Input.d.ts.map +1 -0
  240. package/components/Input/Input.jsx +73 -0
  241. package/components/Input/Input.stories.d.ts +11 -0
  242. package/components/Input/Input.stories.d.ts.map +1 -0
  243. package/components/Input/Input.stories.jsx +115 -0
  244. package/components/Input/Input.test.d.ts +3 -0
  245. package/components/Input/Input.test.d.ts.map +1 -0
  246. package/components/Input/Input.test.jsx +111 -0
  247. package/components/Input/index.d.ts +3 -0
  248. package/components/Input/index.d.ts.map +1 -0
  249. package/components/Input/index.js +2 -0
  250. package/components/Modal/Modal.d.ts +15 -0
  251. package/components/Modal/Modal.d.ts.map +1 -0
  252. package/components/Modal/Modal.jsx +93 -0
  253. package/components/Modal/Modal.stories.d.ts +56 -0
  254. package/components/Modal/Modal.stories.d.ts.map +1 -0
  255. package/components/Modal/Modal.stories.jsx +189 -0
  256. package/components/Modal/Modal.test.d.ts +3 -0
  257. package/components/Modal/Modal.test.d.ts.map +1 -0
  258. package/components/Modal/Modal.test.jsx +85 -0
  259. package/components/Modal/index.d.ts +2 -0
  260. package/components/Modal/index.d.ts.map +1 -0
  261. package/components/Modal/index.js +14 -0
  262. package/components/Picker/Picker.d.ts +26 -0
  263. package/components/Picker/Picker.d.ts.map +1 -0
  264. package/components/Picker/Picker.jsx +81 -0
  265. package/components/Picker/Picker.stories.d.ts +22 -0
  266. package/components/Picker/Picker.stories.d.ts.map +1 -0
  267. package/components/Picker/Picker.stories.jsx +236 -0
  268. package/components/Picker/Picker.test.d.ts +2 -0
  269. package/components/Picker/Picker.test.d.ts.map +1 -0
  270. package/components/Picker/Picker.test.jsx +190 -0
  271. package/components/Picker/index.d.ts +2 -0
  272. package/components/Picker/index.d.ts.map +1 -0
  273. package/components/Picker/index.js +1 -0
  274. package/components/Price/Price.d.ts +17 -0
  275. package/components/Price/Price.d.ts.map +1 -0
  276. package/components/Price/Price.jsx +24 -0
  277. package/components/Price/Price.stories.d.ts +17 -0
  278. package/components/Price/Price.stories.d.ts.map +1 -0
  279. package/components/Price/Price.stories.jsx +78 -0
  280. package/components/Price/Price.test.d.ts +3 -0
  281. package/components/Price/Price.test.d.ts.map +1 -0
  282. package/components/Price/Price.test.jsx +68 -0
  283. package/components/Price/index.d.ts +2 -0
  284. package/components/Price/index.d.ts.map +1 -0
  285. package/components/Price/index.js +1 -0
  286. package/components/PriceRange/PriceRange.d.ts +17 -0
  287. package/components/PriceRange/PriceRange.d.ts.map +1 -0
  288. package/components/PriceRange/PriceRange.jsx +75 -0
  289. package/components/PriceRange/PriceRange.stories.d.ts +107 -0
  290. package/components/PriceRange/PriceRange.stories.d.ts.map +1 -0
  291. package/components/PriceRange/PriceRange.stories.jsx +210 -0
  292. package/components/PriceRange/PriceRange.test.d.ts +3 -0
  293. package/components/PriceRange/PriceRange.test.d.ts.map +1 -0
  294. package/components/PriceRange/PriceRange.test.jsx +188 -0
  295. package/components/PriceRange/index.d.ts +3 -0
  296. package/components/PriceRange/index.d.ts.map +1 -0
  297. package/components/PriceRange/index.js +2 -0
  298. package/components/PriceSummary/PriceSummary.d.ts +43 -0
  299. package/components/PriceSummary/PriceSummary.d.ts.map +1 -0
  300. package/components/PriceSummary/PriceSummary.jsx +228 -0
  301. package/components/PriceSummary/PriceSummary.stories.d.ts +127 -0
  302. package/components/PriceSummary/PriceSummary.stories.d.ts.map +1 -0
  303. package/components/PriceSummary/PriceSummary.stories.jsx +456 -0
  304. package/components/PriceSummary/PriceSummary.test.d.ts +3 -0
  305. package/components/PriceSummary/PriceSummary.test.d.ts.map +1 -0
  306. package/components/PriceSummary/PriceSummary.test.jsx +275 -0
  307. package/components/PriceSummary/index.d.ts +3 -0
  308. package/components/PriceSummary/index.d.ts.map +1 -0
  309. package/components/PriceSummary/index.js +2 -0
  310. package/components/ProgressSpinner/ProgressSpinner.d.ts +14 -0
  311. package/components/ProgressSpinner/ProgressSpinner.d.ts.map +1 -0
  312. package/components/ProgressSpinner/ProgressSpinner.jsx +31 -0
  313. package/components/ProgressSpinner/ProgressSpinner.stories.d.ts +19 -0
  314. package/components/ProgressSpinner/ProgressSpinner.stories.d.ts.map +1 -0
  315. package/components/ProgressSpinner/ProgressSpinner.stories.jsx +195 -0
  316. package/components/ProgressSpinner/ProgressSpinner.test.d.ts +3 -0
  317. package/components/ProgressSpinner/ProgressSpinner.test.d.ts.map +1 -0
  318. package/components/ProgressSpinner/ProgressSpinner.test.jsx +40 -0
  319. package/components/ProgressSpinner/index.d.ts +3 -0
  320. package/components/ProgressSpinner/index.d.ts.map +1 -0
  321. package/components/ProgressSpinner/index.js +2 -0
  322. package/components/RadioButton/RadioButton.d.ts +15 -0
  323. package/components/RadioButton/RadioButton.d.ts.map +1 -0
  324. package/components/RadioButton/RadioButton.jsx +31 -0
  325. package/components/RadioButton/RadioButton.stories.d.ts +15 -0
  326. package/components/RadioButton/RadioButton.stories.d.ts.map +1 -0
  327. package/components/RadioButton/RadioButton.stories.jsx +92 -0
  328. package/components/RadioButton/RadioButton.test.d.ts +3 -0
  329. package/components/RadioButton/RadioButton.test.d.ts.map +1 -0
  330. package/components/RadioButton/RadioButton.test.jsx +62 -0
  331. package/components/RadioButton/index.d.ts +3 -0
  332. package/components/RadioButton/index.d.ts.map +1 -0
  333. package/components/RadioButton/index.js +2 -0
  334. package/components/Skeleton/Skeleton.d.ts +17 -0
  335. package/components/Skeleton/Skeleton.d.ts.map +1 -0
  336. package/components/Skeleton/Skeleton.jsx +52 -0
  337. package/components/Skeleton/Skeleton.stories.d.ts +67 -0
  338. package/components/Skeleton/Skeleton.stories.d.ts.map +1 -0
  339. package/components/Skeleton/Skeleton.stories.jsx +184 -0
  340. package/components/Skeleton/Skeleton.test.d.ts +3 -0
  341. package/components/Skeleton/Skeleton.test.d.ts.map +1 -0
  342. package/components/Skeleton/Skeleton.test.jsx +62 -0
  343. package/components/Skeleton/index.d.ts +2 -0
  344. package/components/Skeleton/index.d.ts.map +1 -0
  345. package/components/Skeleton/index.js +1 -0
  346. package/components/TextSwatch/TextSwatch.d.ts +18 -0
  347. package/components/TextSwatch/TextSwatch.d.ts.map +1 -0
  348. package/components/TextSwatch/TextSwatch.jsx +56 -0
  349. package/components/TextSwatch/TextSwatch.stories.d.ts +21 -0
  350. package/components/TextSwatch/TextSwatch.stories.d.ts.map +1 -0
  351. package/components/TextSwatch/TextSwatch.stories.jsx +211 -0
  352. package/components/TextSwatch/TextSwatch.test.d.ts +3 -0
  353. package/components/TextSwatch/TextSwatch.test.d.ts.map +1 -0
  354. package/components/TextSwatch/TextSwatch.test.jsx +85 -0
  355. package/components/TextSwatch/index.d.ts +3 -0
  356. package/components/TextSwatch/index.d.ts.map +1 -0
  357. package/components/TextSwatch/index.js +2 -0
  358. package/components/UIProvider/UIProvider.d.ts +18 -0
  359. package/components/UIProvider/UIProvider.d.ts.map +1 -0
  360. package/components/UIProvider/UIProvider.jsx +26 -0
  361. package/components/UIProvider/UIProvider.test.d.ts +2 -0
  362. package/components/UIProvider/UIProvider.test.d.ts.map +1 -0
  363. package/components/UIProvider/UIProvider.test.jsx +9 -0
  364. package/components/UIProvider/index.d.ts +2 -0
  365. package/components/UIProvider/index.d.ts.map +1 -0
  366. package/components/UIProvider/index.js +1 -0
  367. package/components/index.d.ts +34 -0
  368. package/components/index.d.ts.map +1 -0
  369. package/components/index.js +33 -0
  370. package/docs/Design/designBlocks.d.ts +21 -0
  371. package/docs/Design/designBlocks.d.ts.map +1 -0
  372. package/docs/Design/designBlocks.jsx +59 -0
  373. package/docs/Design/getTokenData.d.ts +7 -0
  374. package/docs/Design/getTokenData.d.ts.map +1 -0
  375. package/docs/Design/getTokenData.js +18 -0
  376. package/docs/Design/getTokenData.test.d.ts +2 -0
  377. package/docs/Design/getTokenData.test.d.ts.map +1 -0
  378. package/docs/Design/getTokenData.test.js +92 -0
  379. package/event-bus.js +49 -1
  380. package/fetch-graphql.js +62 -1
  381. package/i18n/en_US.json +112 -0
  382. package/i18n/index.d.ts +341 -0
  383. package/i18n/index.d.ts.map +1 -0
  384. package/i18n/index.js +12 -0
  385. package/i18n/index.test.d.ts +2 -0
  386. package/i18n/index.test.d.ts.map +1 -0
  387. package/i18n/index.test.js +11 -0
  388. package/icons/index.d.ts +35 -0
  389. package/icons/index.d.ts.map +1 -0
  390. package/icons/index.js +34 -0
  391. package/initializer.js +61 -1
  392. package/lib/classes.d.ts +5 -0
  393. package/lib/classes.d.ts.map +1 -0
  394. package/lib/classes.js +16 -0
  395. package/lib/classes.test.d.ts +2 -0
  396. package/lib/classes.test.d.ts.map +1 -0
  397. package/lib/classes.test.js +18 -0
  398. package/lib/config.d.ts +7 -0
  399. package/lib/config.d.ts.map +1 -0
  400. package/lib/config.js +12 -0
  401. package/lib/config.test.d.ts +2 -0
  402. package/lib/config.test.d.ts.map +1 -0
  403. package/lib/config.test.js +12 -0
  404. package/lib/debounce.d.ts +2 -0
  405. package/lib/debounce.d.ts.map +1 -0
  406. package/lib/debounce.js +7 -0
  407. package/lib/debounce.test.d.ts +2 -0
  408. package/lib/debounce.test.d.ts.map +1 -0
  409. package/lib/debounce.test.js +40 -0
  410. package/lib/deepmerge.d.ts +2 -0
  411. package/lib/deepmerge.d.ts.map +1 -0
  412. package/lib/deepmerge.js +1 -0
  413. package/lib/form-values.d.ts +5 -0
  414. package/lib/form-values.d.ts.map +1 -0
  415. package/lib/form-values.js +17 -0
  416. package/lib/form-values.test.d.ts +2 -0
  417. package/lib/form-values.test.d.ts.map +1 -0
  418. package/lib/form-values.test.jsx +29 -0
  419. package/lib/i18n.d.ts +8 -0
  420. package/lib/i18n.d.ts.map +1 -0
  421. package/lib/i18n.js +9 -0
  422. package/lib/i18n.test.d.ts +2 -0
  423. package/lib/i18n.test.d.ts.map +1 -0
  424. package/lib/i18n.test.jsx +8 -0
  425. package/lib/image-params-keymap.d.ts +4 -0
  426. package/lib/image-params-keymap.d.ts.map +1 -0
  427. package/lib/image-params-keymap.js +19 -0
  428. package/lib/image-params-keymap.test.d.ts +2 -0
  429. package/lib/image-params-keymap.test.d.ts.map +1 -0
  430. package/lib/image-params-keymap.test.js +7 -0
  431. package/lib/index.d.ts +14 -0
  432. package/lib/index.d.ts.map +1 -0
  433. package/lib/index.js +13 -0
  434. package/lib/initializer.d.ts +78 -0
  435. package/lib/initializer.d.ts.map +1 -0
  436. package/lib/initializer.js +93 -0
  437. package/lib/initializer.test.d.ts +2 -0
  438. package/lib/initializer.test.d.ts.map +1 -0
  439. package/lib/initializer.test.js +64 -0
  440. package/lib/render.d.ts +10 -0
  441. package/lib/render.d.ts.map +1 -0
  442. package/lib/render.jsx +34 -0
  443. package/lib/render.test.d.ts +2 -0
  444. package/lib/render.test.d.ts.map +1 -0
  445. package/lib/render.test.jsx +70 -0
  446. package/lib/resolve-image.d.ts +10 -0
  447. package/lib/resolve-image.d.ts.map +1 -0
  448. package/lib/resolve-image.js +57 -0
  449. package/lib/resolve-image.test.d.ts +2 -0
  450. package/lib/resolve-image.test.d.ts.map +1 -0
  451. package/lib/resolve-image.test.jsx +146 -0
  452. package/lib/slot.d.ts +43 -0
  453. package/lib/slot.d.ts.map +1 -0
  454. package/lib/slot.jsx +184 -0
  455. package/lib/slot.test.d.ts +2 -0
  456. package/lib/slot.test.d.ts.map +1 -0
  457. package/lib/slot.test.jsx +325 -0
  458. package/lib/tests.d.ts +4 -0
  459. package/lib/tests.d.ts.map +1 -0
  460. package/lib/tests.jsx +19 -0
  461. package/lib/tests.test.d.ts +2 -0
  462. package/lib/tests.test.d.ts.map +1 -0
  463. package/lib/tests.test.jsx +13 -0
  464. package/lib/types.d.ts +9 -0
  465. package/lib/types.d.ts.map +1 -0
  466. package/lib/types.js +1 -0
  467. package/lib/vcomponent.d.ts +8 -0
  468. package/lib/vcomponent.d.ts.map +1 -0
  469. package/lib/vcomponent.jsx +27 -0
  470. package/lib/vcomponent.test.d.ts +2 -0
  471. package/lib/vcomponent.test.d.ts.map +1 -0
  472. package/lib/vcomponent.test.jsx +51 -0
  473. package/package.json +1 -1
  474. package/preact-compat.js +93 -1
  475. package/preact-hooks.js +40 -1
  476. package/preact-jsx-runtime.js +35 -1
  477. package/preact.js +21 -1
  478. package/runtime.js +69 -1
@@ -0,0 +1,111 @@
1
+ /** https://preactjs.com/guide/v10/preact-testing-library/ */
2
+ import { Input } from '@adobe/elsie/components/Input';
3
+ import { Search } from '@adobe/elsie/icons';
4
+ import { fireEvent, render } from '@adobe/elsie/lib/tests';
5
+ import { Icon } from '..';
6
+ jest.useFakeTimers();
7
+ describe('Base/Components/Input', () => {
8
+ test('renders', () => {
9
+ const { container } = render(<Input id="dropin-input-1"/>);
10
+ const elem = container.querySelector('.dropin-input');
11
+ expect(!!elem).toEqual(true);
12
+ expect(container).toMatchSnapshot();
13
+ });
14
+ test('renders with random id', () => {
15
+ const { container } = render(<Input />);
16
+ const elem = container.querySelector('.dropin-input');
17
+ expect(!!elem).toEqual(true);
18
+ expect(elem?.id).toMatch(new RegExp(`^dropin-input-?`));
19
+ });
20
+ test('triggers onValue()', () => {
21
+ const mockFn = jest.fn();
22
+ const { container } = render(<Input name="input" onValue={mockFn}/>);
23
+ const field = container.querySelector('.dropin-input');
24
+ fireEvent.input(field, {
25
+ target: { value: 'test' },
26
+ });
27
+ jest.runAllTimers();
28
+ expect(mockFn).toBeCalledWith('test');
29
+ });
30
+ test('renders the correct shape for default variant', () => {
31
+ const { container } = render(<Input name="input" aria-label="Text Input"/>);
32
+ const elem = container.querySelector('.dropin-input-container');
33
+ expect(elem).toMatchSnapshot();
34
+ });
35
+ test('renders the variants', () => {
36
+ const { container, rerender } = render(<Input name="input-primary" aria-label="Text Input" variant="primary"/>);
37
+ const primary = container.querySelector('.dropin-input-container');
38
+ expect(primary?.classList.contains('dropin-input-container--primary')).toBe(true);
39
+ rerender(<Input name="input-secondary" aria-label="Text Input" variant="secondary"/>);
40
+ const secondary = container.querySelector('.dropin-input-container');
41
+ expect(secondary?.classList.contains('dropin-input-container--secondary')).toBe(true);
42
+ });
43
+ test('renders icons', () => {
44
+ const { container } = render(<Input name="input" icon={<Icon source={Search} id="iconLeft"/>}/>);
45
+ const iconLeft = container.querySelector('#iconLeft');
46
+ expect(iconLeft).toBeTruthy();
47
+ });
48
+ test('renders the correct shape for size large', () => {
49
+ const { container } = render(<Input name="input" aria-label="Text Input" size="large"/>);
50
+ const elem = container.querySelector('.dropin-input--large');
51
+ expect(elem).toMatchSnapshot();
52
+ });
53
+ test('calls onUpdateError() when error is thrown in onValue()', () => {
54
+ const mockFn = jest.fn(() => {
55
+ throw new Error('Mock error!');
56
+ });
57
+ const { container } = render(<Input name="input" value={'test'} onValue={mockFn}/>);
58
+ const field = container.querySelector('.dropin-input');
59
+ fireEvent.input(field, { target: { value: 'test2' } });
60
+ jest.runAllTimers();
61
+ expect(field.value).toEqual('test2');
62
+ });
63
+ test('handles input update error with error handler given', () => {
64
+ const mockFn = jest.fn(() => {
65
+ throw new Error('Mock error!');
66
+ });
67
+ const mockErrorHandler = jest.fn();
68
+ const { container } = render(<Input name="input" onValue={mockFn} onUpdateError={mockErrorHandler}/>);
69
+ const field = container.querySelector('.dropin-input');
70
+ fireEvent.input(field, { target: { value: 'test' } });
71
+ jest.runAllTimers();
72
+ expect(field.value).toEqual('test');
73
+ expect(mockErrorHandler).toHaveBeenCalledTimes(1);
74
+ expect(mockErrorHandler.mock.calls[0][0]).toMatchInlineSnapshot(`[Error: Mock error!]`);
75
+ });
76
+ test('Update input when new string is introduced', () => {
77
+ const { container } = render(<Input name="input" value={'peanut'}/>);
78
+ const field = container.querySelector('.dropin-input');
79
+ fireEvent.input(field, { target: { value: 'almonds' } });
80
+ jest.runAllTimers();
81
+ expect(field.value).toEqual('almonds');
82
+ });
83
+ test('render errorField', () => {
84
+ const { container } = render(<Input name="input" error={true}/>);
85
+ const field = container.querySelector('.dropin-input__field-icon--error');
86
+ jest.runAllTimers();
87
+ expect(field).toBeTruthy();
88
+ });
89
+ test('render successField', () => {
90
+ const { container } = render(<Input name="input" success={true}/>);
91
+ const field = container.querySelector('.dropin-input__field-icon--success');
92
+ jest.runAllTimers();
93
+ expect(field).toBeTruthy();
94
+ });
95
+ test('input spaces are trimmed if leading/trailing spaces are present', () => {
96
+ const mockFn = jest.fn();
97
+ const { container } = render(<Input name="input" onValue={mockFn}/>);
98
+ const field = container.querySelector('.dropin-input');
99
+ fireEvent.input(field, {
100
+ target: { value: ' test ' },
101
+ });
102
+ jest.runAllTimers();
103
+ expect(mockFn).toBeCalledWith('test');
104
+ });
105
+ test('floatingLabel is rendered when specified', () => {
106
+ const { container } = render(<Input name="input" floatingLabel={'Label'}/>);
107
+ const field = container.querySelector('.dropin-input__label--floating');
108
+ jest.runAllTimers();
109
+ expect(field).toBeTruthy();
110
+ });
111
+ });
@@ -0,0 +1,3 @@
1
+ export * from '@adobe/elsie/components/Input/Input';
2
+ export { Input as default } from '@adobe/elsie/components/Input';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Input/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from '@adobe/elsie/components/Input/Input';
2
+ export { Input as default } from '@adobe/elsie/components/Input';
@@ -0,0 +1,15 @@
1
+ import { FunctionComponent, HTMLAttributes } from 'preact/compat';
2
+ import { VNode } from 'preact';
3
+ import '@adobe/elsie/src/components/Modal/Modal.css';
4
+ export interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'size' | 'title'> {
5
+ size?: 'small' | 'medium' | 'full';
6
+ title?: VNode;
7
+ centered?: boolean;
8
+ onClose?: () => void;
9
+ backgroundDim?: boolean;
10
+ clickToDismiss?: boolean;
11
+ escapeToDismiss?: boolean;
12
+ showCloseButton?: boolean;
13
+ }
14
+ export declare const Modal: FunctionComponent<ModalProps>;
15
+ //# sourceMappingURL=Modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAgBA,OAAO,EACL,iBAAiB,EACjB,cAAc,EAGf,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,6CAA6C,CAAC;AAErD,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9D,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IACnC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,KAAK,EAAE,iBAAiB,CAAC,UAAU,CAyH/C,CAAC"}
@@ -0,0 +1,93 @@
1
+ /*
2
+ ADOBE CONFIDENTIAL
3
+ Copyright 2023 Adobe
4
+ All Rights Reserved.
5
+ NOTICE: All information contained herein is, and remains
6
+ the property of Adobe and its suppliers, if any. The intellectual
7
+ and technical concepts contained herein are proprietary to Adobe
8
+ and its suppliers and are protected by all applicable intellectual
9
+ property laws, including trade secret and copyright laws.
10
+ Dissemination of this information or reproduction of this material
11
+ is strictly forbidden unless prior written permission is obtained
12
+ from Adobe.
13
+ */
14
+ import { useText } from '@adobe/elsie/i18n';
15
+ import { classes } from '@adobe/elsie/lib';
16
+ import { useCallback, useEffect, } from 'preact/compat';
17
+ import { Button } from '../Button';
18
+ import { Close as CloseSVG } from '@adobe/elsie/icons';
19
+ import '@adobe/elsie/src/components/Modal/Modal.css';
20
+ export const Modal = ({ size = 'small', title = null, centered = false, backgroundDim = true, clickToDismiss = true, escapeToDismiss = true, onClose, showCloseButton = true, className, children = null, ...props }) => {
21
+ const handleOnClose = useCallback(() => {
22
+ onClose?.();
23
+ }, [onClose]);
24
+ const translations = useText({
25
+ modalCloseLabel: 'Dropin.Modal.Close.label',
26
+ });
27
+ // Close on background click
28
+ useEffect(() => {
29
+ const handleOutsideClick = (event) => {
30
+ const modal = document.querySelector('.dropin-modal');
31
+ const modalBody = document.querySelector('.dropin-modal__body');
32
+ if (clickToDismiss &&
33
+ modal &&
34
+ modalBody &&
35
+ !modalBody.contains(event.target)) {
36
+ handleOnClose();
37
+ }
38
+ };
39
+ document.addEventListener('mousedown', handleOutsideClick);
40
+ return () => {
41
+ document.removeEventListener('mousedown', handleOutsideClick);
42
+ };
43
+ }, [handleOnClose, clickToDismiss]);
44
+ // Close on ESC
45
+ useEffect(() => {
46
+ const handleKeyDown = (event) => {
47
+ if (event.key === 'Escape' && escapeToDismiss) {
48
+ handleOnClose();
49
+ }
50
+ };
51
+ document.addEventListener('keydown', handleKeyDown);
52
+ return () => {
53
+ document.removeEventListener('keydown', handleKeyDown);
54
+ };
55
+ }, [handleOnClose, escapeToDismiss]);
56
+ // Prevent document scrolling
57
+ useEffect(() => {
58
+ const scrollingElement = document.scrollingElement;
59
+ const defaultOverflowValue = scrollingElement.style.overflow;
60
+ scrollingElement.style.overflow = 'hidden';
61
+ return () => {
62
+ scrollingElement.style.overflow = defaultOverflowValue;
63
+ };
64
+ }, []);
65
+ return (<div className={classes([
66
+ 'dropin-modal',
67
+ ['dropin-modal--dim', backgroundDim],
68
+ ])}>
69
+ <div {...props} className={classes([
70
+ 'dropin-modal__body',
71
+ [`dropin-modal__body--${size}`, size],
72
+ className,
73
+ ])}>
74
+ <div className={classes([
75
+ 'dropin-modal__header',
76
+ ['dropin-modal__header-title', !!title],
77
+ ])}>
78
+ {title && (<div className={classes(['dropin-modal__header-title-content'])}>
79
+ {title}
80
+ </div>)}
81
+
82
+ {showCloseButton && (<Button aria-label={translations.modalCloseLabel} variant="tertiary" className="dropin-modal__header-close-button" onClick={handleOnClose} icon={<CloseSVG />}/>)}
83
+ </div>
84
+
85
+ <div className={classes([
86
+ 'dropin-modal__content',
87
+ ['dropin-modal__body--centered', centered],
88
+ ])}>
89
+ {children}
90
+ </div>
91
+ </div>
92
+ </div>);
93
+ };
@@ -0,0 +1,56 @@
1
+ import { Meta, StoryObj } from '@storybook/preact';
2
+ import { ModalProps } from './Modal';
3
+ declare const meta: Meta<ModalProps>;
4
+ type Story = StoryObj<ModalProps>;
5
+ /**
6
+ * ```ts
7
+ * import { Modal } from '@/elsie/components/Modal';
8
+ *
9
+ * <Modal size="small" title={<h4>Modal Title</h4>}>
10
+ * <div>👋 Howdy, I'm Howdy!</div>
11
+ * </Modal>
12
+ * ```
13
+ */
14
+ export declare const SmallModal: Story;
15
+ /**
16
+ * ```ts
17
+ * import { Modal } from '@/elsie/components/Modal';
18
+ *
19
+ * <Modal size="medium" centered={true} title={<h3>Medium modal</h3>}>
20
+ * <div>👋 Howdy, I'm Howdy!</div>
21
+ * </Modal>
22
+ * ```
23
+ */
24
+ export declare const MediumModal: Story;
25
+ /**
26
+ * ```ts
27
+ * import { Modal } from '@/elsie/components/Modal';
28
+ *
29
+ * <Modal size="full">
30
+ * <div>👋 Howdy, I'm Howdy!</div>
31
+ * </Modal>
32
+ * ```
33
+ */
34
+ export declare const FullModal: Story;
35
+ /**
36
+ * ```ts
37
+ * import { Modal } from '@/elsie/components/Modal';
38
+ *
39
+ * <Modal size="full" centered={true}>
40
+ * Lorem ipsum...
41
+ * </Modal>
42
+ * ```
43
+ */
44
+ export declare const OverflowingChildren: Story;
45
+ /**
46
+ * ```ts
47
+ * import { Modal } from '@/elsie/components/Modal';
48
+ *
49
+ * <Modal size="medium" title={<h3 style={{marginTop: 0}}>{`Howdy! This is the modal title`.repeat(5)}</h3>}>
50
+ * Howdy! This is the modal content.
51
+ * </Modal>
52
+ * ```
53
+ */
54
+ export declare const OverflowingTitle: Story;
55
+ export default meta;
56
+ //# sourceMappingURL=Modal.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.stories.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAsB,UAAU,EAAE,MAAM,SAAS,CAAC;AAKzD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UAAU,CAsE1B,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;AAElC;;;;;;;;GAQG;AAEH,eAAO,MAAM,UAAU,EAAE,KA4BxB,CAAC;AAEF;;;;;;;;GAQG;AAEH,eAAO,MAAM,WAAW,EAAE,KA6BzB,CAAC;AAEF;;;;;;;;GAQG;AAEH,eAAO,MAAM,SAAS,EAAE,KAyBvB,CAAC;AAEF;;;;;;;;GAQG;AAEH,eAAO,MAAM,mBAAmB,EAAE,KAQjC,CAAC;AAEF;;;;;;;;GAQG;AAEH,eAAO,MAAM,gBAAgB,EAAE,KAU9B,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,189 @@
1
+ import { expect } from '@storybook/jest';
2
+ import { Modal as component } from './Modal';
3
+ import { useState } from 'preact/hooks';
4
+ import { Button } from '../Button';
5
+ import { userEvent, within } from '@storybook/testing-library';
6
+ const meta = {
7
+ title: 'Components/Modal',
8
+ component,
9
+ parameters: {
10
+ layout: 'centered',
11
+ },
12
+ tags: ['autodocs'],
13
+ argTypes: {
14
+ children: {
15
+ description: 'Content',
16
+ control: { type: 'text' },
17
+ defaultValue: { summary: '<empty string>' },
18
+ },
19
+ size: {
20
+ description: 'Modal size',
21
+ control: { type: 'radio' },
22
+ options: ['small', 'medium', 'full'],
23
+ defaultValue: { summary: 'small' },
24
+ },
25
+ title: {
26
+ description: 'Title',
27
+ control: { type: 'text' },
28
+ defaultValue: { summary: '<empty string>' },
29
+ },
30
+ centered: {
31
+ description: 'Content inside modal is centered',
32
+ type: 'boolean',
33
+ defaultValue: { summary: 'false' },
34
+ },
35
+ onClose: {
36
+ description: 'On close modal callback',
37
+ control: { type: 'null' },
38
+ defaultValue: { summary: 'null' },
39
+ },
40
+ backgroundDim: {
41
+ description: 'Background behind modal content is dimmed',
42
+ type: 'boolean',
43
+ defaultValue: { summary: 'true' },
44
+ },
45
+ clickToDismiss: {
46
+ description: 'Enable click on background to dismiss the modal',
47
+ type: 'boolean',
48
+ defaultValue: { summary: 'true' },
49
+ },
50
+ escapeToDismiss: {
51
+ description: 'Enable ESCAPE key press to dismiss the modal',
52
+ type: 'boolean',
53
+ defaultValue: { summary: 'true' },
54
+ },
55
+ showCloseButton: {
56
+ description: 'Show close button',
57
+ type: 'boolean',
58
+ defaultValue: { summary: 'true' },
59
+ },
60
+ },
61
+ decorators: [
62
+ (Story, attrs) => {
63
+ const [active, setActive] = useState(false);
64
+ attrs.args.onClose = () => setActive(false);
65
+ return (<div>
66
+ <Button onClick={() => setActive(true)}>Open Modal</Button>
67
+
68
+ {active && Story()}
69
+ </div>);
70
+ },
71
+ ],
72
+ };
73
+ /**
74
+ * ```ts
75
+ * import { Modal } from '@/elsie/components/Modal';
76
+ *
77
+ * <Modal size="small" title={<h4>Modal Title</h4>}>
78
+ * <div>👋 Howdy, I'm Howdy!</div>
79
+ * </Modal>
80
+ * ```
81
+ */
82
+ export const SmallModal = {
83
+ args: {
84
+ size: 'small',
85
+ children: "👋 Howdy, I'm Howdy!",
86
+ title: <h4>Small modal</h4>,
87
+ },
88
+ play: async ({ canvasElement }) => {
89
+ const canvas = within(canvasElement);
90
+ await userEvent.click(canvas.getByRole('button'));
91
+ const modal = document.querySelector('.dropin-modal__body');
92
+ await expect(modal).toBeVisible();
93
+ await expect(await canvas.findByText('Small modal')).toBeVisible();
94
+ const closeButton = document.querySelector('.dropin-modal__header-close-button');
95
+ await userEvent.click(closeButton);
96
+ await expect(modal).not.toBeVisible();
97
+ await expect(canvas.getByText('Open Modal')).toBeVisible();
98
+ },
99
+ };
100
+ /**
101
+ * ```ts
102
+ * import { Modal } from '@/elsie/components/Modal';
103
+ *
104
+ * <Modal size="medium" centered={true} title={<h3>Medium modal</h3>}>
105
+ * <div>👋 Howdy, I'm Howdy!</div>
106
+ * </Modal>
107
+ * ```
108
+ */
109
+ export const MediumModal = {
110
+ args: {
111
+ size: 'medium',
112
+ centered: true,
113
+ children: "👋 Howdy, I'm Howdy!",
114
+ title: <h3>Medium modal</h3>,
115
+ },
116
+ play: async ({ canvasElement }) => {
117
+ const canvas = within(canvasElement);
118
+ await userEvent.click(canvas.getByRole('button'));
119
+ const modal = document.querySelector('.dropin-modal__body');
120
+ await expect(modal).toBeVisible();
121
+ await expect(await canvas.findByText('Medium modal')).toBeVisible();
122
+ const closeButton = document.querySelector('.dropin-modal__header-close-button');
123
+ await userEvent.click(closeButton);
124
+ await expect(modal).not.toBeVisible();
125
+ await expect(canvas.getByText('Open Modal')).toBeVisible();
126
+ },
127
+ };
128
+ /**
129
+ * ```ts
130
+ * import { Modal } from '@/elsie/components/Modal';
131
+ *
132
+ * <Modal size="full">
133
+ * <div>👋 Howdy, I'm Howdy!</div>
134
+ * </Modal>
135
+ * ```
136
+ */
137
+ export const FullModal = {
138
+ args: {
139
+ size: 'full',
140
+ children: "👋 Howdy, I'm Howdy!",
141
+ },
142
+ play: async ({ canvasElement }) => {
143
+ const canvas = within(canvasElement);
144
+ await userEvent.click(canvas.getByRole('button'));
145
+ const modal = document.querySelector('.dropin-modal__body');
146
+ await expect(modal).toBeVisible();
147
+ const closeButton = document.querySelector('.dropin-modal__header-close-button');
148
+ await userEvent.click(closeButton);
149
+ await expect(modal).not.toBeVisible();
150
+ await expect(canvas.getByText('Open Modal')).toBeVisible();
151
+ },
152
+ };
153
+ /**
154
+ * ```ts
155
+ * import { Modal } from '@/elsie/components/Modal';
156
+ *
157
+ * <Modal size="full" centered={true}>
158
+ * Lorem ipsum...
159
+ * </Modal>
160
+ * ```
161
+ */
162
+ export const OverflowingChildren = {
163
+ args: {
164
+ size: 'full',
165
+ centered: true,
166
+ children: `
167
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras tincidunt neque gravida ligula malesuada bibendum et quis enim. Mauris sed nunc odio. Sed ornare nec nulla at fringilla. Cras egestas laoreet mi, sit amet tristique ipsum. Quisque facilisis ante et nisi hendrerit, et cursus est iaculis. Vestibulum nec erat eleifend, convallis velit quis, pharetra est. Nam augue dolor, blandit ac suscipit pretium, efficitur ut mi. Donec et suscipit ipsum, vel ultricies felis. Maecenas vestibulum velit mauris, ut sagittis arcu auctor maximus. Nullam gravida eget felis ac iaculis. Ut a consectetur ipsum, ac cursus magna. Quisque tempus tempus magna at vehicula. Duis ac imperdiet purus, finibus aliquet enim. Sed vel diam pretium, blandit risus vel, convallis mauris. Mauris consectetur iaculis diam.
168
+ `.repeat(15),
169
+ },
170
+ };
171
+ /**
172
+ * ```ts
173
+ * import { Modal } from '@/elsie/components/Modal';
174
+ *
175
+ * <Modal size="medium" title={<h3 style={{marginTop: 0}}>{`Howdy! This is the modal title`.repeat(5)}</h3>}>
176
+ * Howdy! This is the modal content.
177
+ * </Modal>
178
+ * ```
179
+ */
180
+ export const OverflowingTitle = {
181
+ args: {
182
+ size: 'medium',
183
+ children: `Howdy! This is the modal content.`,
184
+ title: (<h3 style={{ marginTop: 0 }}>
185
+ {`Howdy! This is the modal title`.repeat(5)}
186
+ </h3>),
187
+ },
188
+ };
189
+ export default meta;
@@ -0,0 +1,3 @@
1
+ /** https://preactjs.com/guide/v10/preact-testing-library/ */
2
+ export {};
3
+ //# sourceMappingURL=Modal.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.test.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.test.tsx"],"names":[],"mappings":"AAAA,6DAA6D"}
@@ -0,0 +1,85 @@
1
+ /** https://preactjs.com/guide/v10/preact-testing-library/ */
2
+ import { fireEvent, render } from '@adobe/elsie/lib/tests';
3
+ import { Modal } from '@adobe/elsie/components';
4
+ describe('Foundations/Assets/Modal', () => {
5
+ test('renders if empty', () => {
6
+ // @ts-ignore
7
+ document.scrollingElement = document.documentElement;
8
+ const { container } = render(<Modal />);
9
+ const elem = container.querySelector('.dropin-modal');
10
+ expect(elem).toMatchSnapshot();
11
+ });
12
+ test('renders with size and children', () => {
13
+ const { container } = render(<Modal size="full">
14
+ <p>Modal test</p>
15
+ </Modal>);
16
+ const elem = container.querySelector('.dropin-modal');
17
+ expect(elem).toMatchSnapshot();
18
+ });
19
+ test('renders with multiple props', () => {
20
+ const { container } = render(<Modal size="small" centered={true} backgroundDim={true} clickToDismiss={true} showCloseButton={false}>
21
+ <p>Modal test</p>
22
+ <div>
23
+ <h5>Test title</h5>
24
+ </div>
25
+ </Modal>);
26
+ const elem = container.querySelector('.dropin-modal');
27
+ expect(elem).toMatchSnapshot();
28
+ });
29
+ test('renders with title', () => {
30
+ const title = <h4>Modal Title</h4>;
31
+ const { container } = render(<Modal size="full" title={title}>
32
+ <p>Modal test</p>
33
+ </Modal>);
34
+ const elem = container.querySelector('.dropin-modal');
35
+ expect(elem).toMatchSnapshot();
36
+ });
37
+ test('click background to dismiss', () => {
38
+ const mockCallBack = jest.fn();
39
+ const { container } = render(<Modal clickToDismiss={true} onClose={mockCallBack}>
40
+ <p>Modal test</p>
41
+ </Modal>);
42
+ const modalElement = container.querySelector('.dropin-modal');
43
+ const modalBodyElement = container.querySelector('.dropin-modal__body');
44
+ if (modalElement && modalBodyElement) {
45
+ const { top, left } = modalElement.getBoundingClientRect();
46
+ fireEvent.mouseDown(modalElement, {
47
+ clientX: left + 1,
48
+ clientY: top + 1,
49
+ });
50
+ }
51
+ expect(mockCallBack).toBeCalled();
52
+ });
53
+ test('click background if dismiss disabled', () => {
54
+ const mockCallBack = jest.fn();
55
+ const { container } = render(<Modal clickToDismiss={false} onClose={mockCallBack}>
56
+ <p>Modal test</p>
57
+ </Modal>);
58
+ const modalElement = container.querySelector('.dropin-modal');
59
+ const modalBodyElement = container.querySelector('.dropin-modal__body');
60
+ if (modalElement && modalBodyElement) {
61
+ const { top, left } = modalElement.getBoundingClientRect();
62
+ fireEvent.mouseDown(modalElement, {
63
+ clientX: left + 1,
64
+ clientY: top + 1,
65
+ });
66
+ }
67
+ expect(mockCallBack).toBeCalledTimes(0);
68
+ });
69
+ test('close on ESC key', () => {
70
+ const mockCallBack = jest.fn();
71
+ render(<Modal escapeToDismiss={true} onClose={mockCallBack}>
72
+ <p>Modal test</p>
73
+ </Modal>);
74
+ fireEvent.keyDown(document, { key: 'Escape', code: 'Escape' });
75
+ expect(mockCallBack).toHaveBeenCalled();
76
+ });
77
+ test('close on ESC key if disabled', () => {
78
+ const mockCallBack = jest.fn();
79
+ render(<Modal escapeToDismiss={false} onClose={mockCallBack}>
80
+ <p>Modal test</p>
81
+ </Modal>);
82
+ fireEvent.keyDown(document, { key: 'Escape', code: 'Escape' });
83
+ expect(mockCallBack).toBeCalledTimes(0);
84
+ });
85
+ });
@@ -0,0 +1,2 @@
1
+ export * from '@adobe/elsie/components/Modal/Modal';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.ts"],"names":[],"mappings":"AAcA,cAAc,qCAAqC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /*
2
+ ADOBE CONFIDENTIAL
3
+ Copyright 2023 Adobe
4
+ All Rights Reserved.
5
+ NOTICE: All information contained herein is, and remains
6
+ the property of Adobe and its suppliers, if any. The intellectual
7
+ and technical concepts contained herein are proprietary to Adobe
8
+ and its suppliers and are protected by all applicable intellectual
9
+ property laws, including trade secret and copyright laws.
10
+ Dissemination of this information or reproduction of this material
11
+ is strictly forbidden unless prior written permission is obtained
12
+ from Adobe.
13
+ */
14
+ export * from '@adobe/elsie/components/Modal/Modal';
@@ -0,0 +1,26 @@
1
+ import '@adobe/elsie/components/Picker/Picker.css';
2
+ import { FunctionComponent, VNode } from 'preact';
3
+ import { HTMLAttributes } from 'preact/compat';
4
+ export interface PickerOption {
5
+ value: string | null;
6
+ text?: string;
7
+ icon?: VNode<HTMLAttributes<SVGSVGElement>>;
8
+ disabled?: boolean;
9
+ }
10
+ export interface PickerProps extends Omit<HTMLAttributes<HTMLSelectElement>, 'value' | 'size' | 'icon'> {
11
+ id?: string;
12
+ name?: string;
13
+ value?: string | null;
14
+ placeholder?: string;
15
+ variant?: 'primary' | 'secondary';
16
+ size?: 'medium' | 'large';
17
+ floatingLabel?: string;
18
+ icon?: VNode<HTMLAttributes<SVGSVGElement>>;
19
+ options?: PickerOption[];
20
+ defaultOption?: PickerOption;
21
+ disabled?: boolean;
22
+ error?: boolean;
23
+ handleSelect?: (event: Event) => void;
24
+ }
25
+ export declare const Picker: FunctionComponent<PickerProps>;
26
+ //# sourceMappingURL=Picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AACA,OAAO,2CAA2C,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,cAAc,EAAuB,MAAM,eAAe,CAAC;AAGpE,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAC1E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAClC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACvC;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,CA+IjD,CAAC"}