@rededor/cura 1.0.0-alpha.7 → 1.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 (267) hide show
  1. package/dist/assets/assets/icons/iconset-default-list.ts +1 -1
  2. package/dist/assets/assets/icons/iconset-default-tmp.svg +4 -0
  3. package/dist/assets/assets/icons/iconset-default.svg +1 -1
  4. package/dist/cjs/{app-globals-bcffd819.js → app-globals-b77d5b06.js} +7 -7
  5. package/dist/cjs/{app-globals-bcffd819.js.map → app-globals-b77d5b06.js.map} +1 -1
  6. package/dist/cjs/cura-accordion_12.cjs.entry.js +30 -16
  7. package/dist/cjs/cura-accordion_12.cjs.entry.js.map +1 -1
  8. package/dist/cjs/cura-alert.cjs.entry.js +1 -1
  9. package/dist/cjs/cura-avatar.cjs.entry.js +1 -1
  10. package/dist/cjs/cura-badge-distance.cjs.entry.js +46 -0
  11. package/dist/cjs/cura-badge-distance.cjs.entry.js.map +1 -0
  12. package/dist/cjs/cura-button-outline.cjs.entry.js +10 -6
  13. package/dist/cjs/cura-button-outline.cjs.entry.js.map +1 -1
  14. package/dist/cjs/cura-button-select.cjs.entry.js +2 -2
  15. package/dist/cjs/cura-button-select.cjs.entry.js.map +1 -1
  16. package/dist/cjs/cura-button-transparent.cjs.entry.js +11 -7
  17. package/dist/cjs/cura-button-transparent.cjs.entry.js.map +1 -1
  18. package/dist/cjs/cura-button.definitions-f036371c.js +12 -0
  19. package/dist/cjs/cura-button.definitions-f036371c.js.map +1 -0
  20. package/dist/cjs/cura-calendar.cjs.entry.js +99 -10
  21. package/dist/cjs/cura-calendar.cjs.entry.js.map +1 -1
  22. package/dist/cjs/cura-card.cjs.entry.js +1 -1
  23. package/dist/cjs/cura-checkbox.cjs.entry.js +1 -1
  24. package/dist/cjs/cura-display.cjs.entry.js +19 -10
  25. package/dist/cjs/cura-display.cjs.entry.js.map +1 -1
  26. package/dist/cjs/cura-dropdown-search-option-title.cjs.entry.js +1 -1
  27. package/dist/cjs/cura-dropdown-search-option.cjs.entry.js +5 -3
  28. package/dist/cjs/cura-dropdown-search-option.cjs.entry.js.map +1 -1
  29. package/dist/cjs/cura-dropdown-search.cjs.entry.js +3 -3
  30. package/dist/cjs/cura-dropdown-search.cjs.entry.js.map +1 -1
  31. package/dist/cjs/cura-icons-view.cjs.entry.js +4 -4
  32. package/dist/cjs/cura-icons-view.cjs.entry.js.map +1 -1
  33. package/dist/cjs/cura-loader-bar.cjs.entry.js +1 -1
  34. package/dist/cjs/cura-radio.cjs.entry.js +1 -1
  35. package/dist/cjs/cura-switch.cjs.entry.js +1 -1
  36. package/dist/cjs/cura-toast.cjs.entry.js +1 -1
  37. package/dist/cjs/cura.cjs.js +2 -2
  38. package/dist/cjs/loader.cjs.js +2 -2
  39. package/dist/collection/api/theme-presets/theme-maternity.js +6 -6
  40. package/dist/collection/api/theme-presets/theme-maternity.js.map +1 -1
  41. package/dist/collection/assets/icons/iconset-default-list.js +1 -1
  42. package/dist/collection/assets/icons/iconset-default-list.js.map +1 -1
  43. package/dist/collection/assets/icons/iconset-default-tmp.svg +4 -0
  44. package/dist/collection/assets/icons/iconset-default.svg +1 -1
  45. package/dist/collection/assets-raw/icons/default/drug.svg +3 -0
  46. package/dist/collection/collection-manifest.json +1 -0
  47. package/dist/collection/components/badges/cura-badge-distance/cura-badge-distance.css +28 -0
  48. package/dist/collection/components/badges/cura-badge-distance/cura-badge-distance.js +94 -0
  49. package/dist/collection/components/badges/cura-badge-distance/cura-badge-distance.js.map +1 -0
  50. package/dist/collection/components/badges/cura-badge-distance/cura-badge-distance.stories.js +56 -0
  51. package/dist/collection/components/badges/cura-badge-distance/cura-badge-distance.stories.js.map +1 -0
  52. package/dist/collection/components/buttons/cura-button/cura-button.css +61 -65
  53. package/dist/collection/components/buttons/cura-button/cura-button.js +26 -3
  54. package/dist/collection/components/buttons/cura-button/cura-button.js.map +1 -1
  55. package/dist/collection/components/buttons/cura-button/cura-button.stories.js +28 -2
  56. package/dist/collection/components/buttons/cura-button/cura-button.stories.js.map +1 -1
  57. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.css +50 -53
  58. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js +28 -6
  59. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js.map +1 -1
  60. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.stories.js +28 -2
  61. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.stories.js.map +1 -1
  62. package/dist/collection/components/buttons/cura-button-select/cura-button-select.css +29 -33
  63. package/dist/collection/components/buttons/cura-button-select/cura-button-select.js +1 -1
  64. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.css +37 -54
  65. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js +31 -9
  66. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js.map +1 -1
  67. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js +16 -6
  68. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js.map +1 -1
  69. package/dist/collection/components/buttons/cura-button.definitions.js +7 -0
  70. package/dist/collection/components/buttons/cura-button.definitions.js.map +1 -0
  71. package/dist/collection/components/cura-alert/cura-alert.js +1 -1
  72. package/dist/collection/components/cura-avatar/cura-avatar.js +1 -1
  73. package/dist/collection/components/cura-calendar/cura-calendar.css +18 -1
  74. package/dist/collection/components/cura-calendar/cura-calendar.js +93 -17
  75. package/dist/collection/components/cura-calendar/cura-calendar.js.map +1 -1
  76. package/dist/collection/components/cura-calendar/cura-calendar.stories.js +24 -4
  77. package/dist/collection/components/cura-calendar/cura-calendar.stories.js.map +1 -1
  78. package/dist/collection/components/cura-card/cura-card.js +1 -1
  79. package/dist/collection/components/cura-icon/cura-icon.js +1 -1
  80. package/dist/collection/components/cura-icons-view/cura-icons-view.js +3 -3
  81. package/dist/collection/components/cura-page-template/cura-page-template.js +1 -1
  82. package/dist/collection/components/cura-toast/cura-toast.js +1 -1
  83. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js +1 -1
  84. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.css +48 -29
  85. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js +4 -2
  86. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js.map +1 -1
  87. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.js +1 -1
  88. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js +3 -3
  89. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js.map +1 -1
  90. package/dist/collection/components/forms/cura-input-text/cura-input-text.js +1 -1
  91. package/dist/collection/components/forms/cura-label/cura-label.js +3 -3
  92. package/dist/collection/components/forms/cura-label/cura-label.js.map +1 -1
  93. package/dist/collection/components/forms/cura-radio/cura-radio.js +1 -1
  94. package/dist/collection/components/forms/cura-select/cura-select.js +14 -3
  95. package/dist/collection/components/forms/cura-select/cura-select.js.map +1 -1
  96. package/dist/collection/components/forms/cura-select-options/cura-select-option.js +1 -1
  97. package/dist/collection/components/forms/cura-switch/cura-switch.js +1 -1
  98. package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.js +1 -1
  99. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js +1 -1
  100. package/dist/collection/components/text/cura-display/cura-display.css +16 -0
  101. package/dist/collection/components/text/cura-display/cura-display.js +37 -10
  102. package/dist/collection/components/text/cura-display/cura-display.js.map +1 -1
  103. package/dist/collection/components/text/cura-display/cura-display.stories.js +13 -2
  104. package/dist/collection/components/text/cura-display/cura-display.stories.js.map +1 -1
  105. package/dist/collection/components/text/cura-heading/cura-heading.js +1 -1
  106. package/dist/collection/components/text/cura-paragraph/cura-paragraph.css +9 -1
  107. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +1 -1
  108. package/dist/collection/components/text/cura-paragraph/cura-paragraph.stories.js +1 -1
  109. package/dist/collection/components/text/cura-paragraph/cura-paragraph.stories.js.map +1 -1
  110. package/dist/components/cura-alert.js +1 -1
  111. package/dist/components/cura-avatar.js +1 -1
  112. package/dist/components/cura-badge-distance.d.ts +11 -0
  113. package/dist/components/cura-badge-distance.js +73 -0
  114. package/dist/components/cura-badge-distance.js.map +1 -0
  115. package/dist/components/cura-button-outline.js +11 -6
  116. package/dist/components/cura-button-outline.js.map +1 -1
  117. package/dist/components/cura-button-select.js +2 -2
  118. package/dist/components/cura-button-select.js.map +1 -1
  119. package/dist/components/cura-button-transparent2.js +13 -8
  120. package/dist/components/cura-button-transparent2.js.map +1 -1
  121. package/dist/components/cura-button.definitions.js +10 -0
  122. package/dist/components/cura-button.definitions.js.map +1 -0
  123. package/dist/components/cura-button.js +10 -4
  124. package/dist/components/cura-button.js.map +1 -1
  125. package/dist/components/cura-calendar.js +118 -15
  126. package/dist/components/cura-calendar.js.map +1 -1
  127. package/dist/components/cura-card.js +1 -1
  128. package/dist/components/cura-checkbox.js +1 -1
  129. package/dist/components/cura-display.js +21 -11
  130. package/dist/components/cura-display.js.map +1 -1
  131. package/dist/components/cura-dropdown-search-option-title.js +1 -1
  132. package/dist/components/cura-dropdown-search-option.js +5 -3
  133. package/dist/components/cura-dropdown-search-option.js.map +1 -1
  134. package/dist/components/cura-dropdown-search.js +3 -3
  135. package/dist/components/cura-dropdown-search.js.map +1 -1
  136. package/dist/components/cura-heading2.js +1 -1
  137. package/dist/components/cura-icon2.js +1 -1
  138. package/dist/components/cura-icons-view.js +4 -4
  139. package/dist/components/cura-icons-view.js.map +1 -1
  140. package/dist/components/cura-label2.js +1 -1
  141. package/dist/components/cura-label2.js.map +1 -1
  142. package/dist/components/cura-loader-bar2.js +1 -1
  143. package/dist/components/cura-loader-circle2.js +1 -1
  144. package/dist/components/cura-page-template.js +1 -1
  145. package/dist/components/cura-paragraph2.js +2 -2
  146. package/dist/components/cura-paragraph2.js.map +1 -1
  147. package/dist/components/cura-radio.js +1 -1
  148. package/dist/components/cura-select-option2.js +1 -1
  149. package/dist/components/cura-select2.js +15 -5
  150. package/dist/components/cura-select2.js.map +1 -1
  151. package/dist/components/cura-switch.js +1 -1
  152. package/dist/components/cura-toast.js +1 -1
  153. package/dist/components/index.js +8 -6
  154. package/dist/components/index.js.map +1 -1
  155. package/dist/cura/cura.esm.js +1 -1
  156. package/dist/cura/cura.esm.js.map +1 -1
  157. package/dist/cura/p-0a923806.entry.js +2 -0
  158. package/dist/cura/p-0a923806.entry.js.map +1 -0
  159. package/dist/cura/{p-260edb61.entry.js → p-0d435e42.entry.js} +2 -2
  160. package/dist/cura/{p-8433fec9.entry.js → p-0dd837cf.entry.js} +2 -2
  161. package/dist/cura/{p-c63f4695.entry.js → p-2203e829.entry.js} +2 -2
  162. package/dist/cura/{p-6373c7cd.entry.js → p-4c7a2419.entry.js} +2 -2
  163. package/dist/cura/p-4ef24fbd.entry.js +2 -0
  164. package/dist/cura/p-4ef24fbd.entry.js.map +1 -0
  165. package/dist/cura/p-57b8b468.entry.js +2 -0
  166. package/dist/cura/p-57b8b468.entry.js.map +1 -0
  167. package/dist/cura/p-599acc84.entry.js +2 -0
  168. package/dist/cura/p-599acc84.entry.js.map +1 -0
  169. package/dist/cura/p-6682619b.entry.js +2 -0
  170. package/dist/cura/p-6682619b.entry.js.map +1 -0
  171. package/dist/cura/{p-5fcfbf32.entry.js → p-66c5cf5f.entry.js} +2 -2
  172. package/dist/cura/{p-4eaeb590.entry.js → p-84d8c67d.entry.js} +2 -2
  173. package/dist/cura/p-a00d2c68.entry.js +2 -0
  174. package/dist/cura/p-a00d2c68.entry.js.map +1 -0
  175. package/dist/cura/{p-a9dad622.entry.js → p-a5cf0fd6.entry.js} +2 -2
  176. package/dist/cura/{p-70c369b1.js → p-a6c3c0ea.js} +2 -2
  177. package/dist/cura/{p-70c369b1.js.map → p-a6c3c0ea.js.map} +1 -1
  178. package/dist/cura/{p-f016eb62.entry.js → p-ad8a7e0f.entry.js} +2 -2
  179. package/dist/cura/p-b301a1ef.entry.js +2 -0
  180. package/dist/cura/p-b301a1ef.entry.js.map +1 -0
  181. package/dist/cura/{p-0b1829ed.entry.js → p-dc5d0c29.entry.js} +2 -2
  182. package/dist/cura/p-dc5d0c29.entry.js.map +1 -0
  183. package/dist/cura/p-df5c3a86.entry.js +2 -0
  184. package/dist/cura/{p-17a878d4.entry.js.map → p-df5c3a86.entry.js.map} +1 -1
  185. package/dist/cura/p-dfc65f66.entry.js +2 -0
  186. package/dist/cura/p-efcb32eb.js +2 -0
  187. package/dist/cura/p-efcb32eb.js.map +1 -0
  188. package/dist/cura/p-f9433d24.entry.js +2 -0
  189. package/dist/cura/p-f9433d24.entry.js.map +1 -0
  190. package/dist/esm/{app-globals-f2da2b14.js → app-globals-488bf508.js} +7 -7
  191. package/dist/esm/{app-globals-f2da2b14.js.map → app-globals-488bf508.js.map} +1 -1
  192. package/dist/esm/cura-accordion_12.entry.js +30 -16
  193. package/dist/esm/cura-accordion_12.entry.js.map +1 -1
  194. package/dist/esm/cura-alert.entry.js +1 -1
  195. package/dist/esm/cura-avatar.entry.js +1 -1
  196. package/dist/esm/cura-badge-distance.entry.js +42 -0
  197. package/dist/esm/cura-badge-distance.entry.js.map +1 -0
  198. package/dist/esm/cura-button-outline.entry.js +10 -6
  199. package/dist/esm/cura-button-outline.entry.js.map +1 -1
  200. package/dist/esm/cura-button-select.entry.js +2 -2
  201. package/dist/esm/cura-button-select.entry.js.map +1 -1
  202. package/dist/esm/cura-button-transparent.entry.js +11 -7
  203. package/dist/esm/cura-button-transparent.entry.js.map +1 -1
  204. package/dist/esm/cura-button.definitions-617d3bad.js +10 -0
  205. package/dist/esm/cura-button.definitions-617d3bad.js.map +1 -0
  206. package/dist/esm/cura-calendar.entry.js +99 -10
  207. package/dist/esm/cura-calendar.entry.js.map +1 -1
  208. package/dist/esm/cura-card.entry.js +1 -1
  209. package/dist/esm/cura-checkbox.entry.js +1 -1
  210. package/dist/esm/cura-display.entry.js +19 -10
  211. package/dist/esm/cura-display.entry.js.map +1 -1
  212. package/dist/esm/cura-dropdown-search-option-title.entry.js +1 -1
  213. package/dist/esm/cura-dropdown-search-option.entry.js +5 -3
  214. package/dist/esm/cura-dropdown-search-option.entry.js.map +1 -1
  215. package/dist/esm/cura-dropdown-search.entry.js +3 -3
  216. package/dist/esm/cura-dropdown-search.entry.js.map +1 -1
  217. package/dist/esm/cura-icons-view.entry.js +4 -4
  218. package/dist/esm/cura-icons-view.entry.js.map +1 -1
  219. package/dist/esm/cura-loader-bar.entry.js +1 -1
  220. package/dist/esm/cura-radio.entry.js +1 -1
  221. package/dist/esm/cura-switch.entry.js +1 -1
  222. package/dist/esm/cura-toast.entry.js +1 -1
  223. package/dist/esm/cura.js +2 -2
  224. package/dist/esm/loader.js +2 -2
  225. package/dist/types/components/badges/cura-badge-distance/cura-badge-distance.d.ts +12 -0
  226. package/dist/types/components/badges/cura-badge-distance/cura-badge-distance.stories.d.ts +39 -0
  227. package/dist/types/components/buttons/cura-button/cura-button.d.ts +5 -0
  228. package/dist/types/components/buttons/cura-button/cura-button.stories.d.ts +23 -0
  229. package/dist/types/components/buttons/cura-button-outline/cura-button-outline.d.ts +6 -1
  230. package/dist/types/components/buttons/cura-button-outline/cura-button-outline.stories.d.ts +23 -0
  231. package/dist/types/components/buttons/cura-button-transparent/cura-button-transparent.d.ts +6 -0
  232. package/dist/types/components/buttons/cura-button-transparent/cura-button-transparent.stories.d.ts +11 -0
  233. package/dist/types/components/buttons/cura-button.definitions.d.ts +6 -0
  234. package/dist/types/components/cura-calendar/cura-calendar.d.ts +13 -7
  235. package/dist/types/components/cura-calendar/cura-calendar.stories.d.ts +23 -1
  236. package/dist/types/components/forms/cura-label/cura-label.d.ts +1 -1
  237. package/dist/types/components/forms/cura-select/cura-select.d.ts +1 -0
  238. package/dist/types/components/text/cura-display/cura-display.d.ts +6 -0
  239. package/dist/types/components/text/cura-display/cura-display.stories.d.ts +14 -0
  240. package/dist/types/components.d.ts +67 -14
  241. package/package.json +2 -2
  242. package/dist/cura/p-0b1829ed.entry.js.map +0 -1
  243. package/dist/cura/p-17a878d4.entry.js +0 -2
  244. package/dist/cura/p-335323b5.entry.js +0 -2
  245. package/dist/cura/p-335323b5.entry.js.map +0 -1
  246. package/dist/cura/p-67e34464.entry.js +0 -2
  247. package/dist/cura/p-67e34464.entry.js.map +0 -1
  248. package/dist/cura/p-79fa3b97.entry.js +0 -2
  249. package/dist/cura/p-79fa3b97.entry.js.map +0 -1
  250. package/dist/cura/p-89014323.entry.js +0 -2
  251. package/dist/cura/p-89014323.entry.js.map +0 -1
  252. package/dist/cura/p-9a4094e3.entry.js +0 -2
  253. package/dist/cura/p-9a4094e3.entry.js.map +0 -1
  254. package/dist/cura/p-af2036a7.entry.js +0 -2
  255. package/dist/cura/p-b0d66386.entry.js +0 -2
  256. package/dist/cura/p-b0d66386.entry.js.map +0 -1
  257. package/dist/cura/p-c518a91c.entry.js +0 -2
  258. package/dist/cura/p-c518a91c.entry.js.map +0 -1
  259. /package/dist/cura/{p-260edb61.entry.js.map → p-0d435e42.entry.js.map} +0 -0
  260. /package/dist/cura/{p-8433fec9.entry.js.map → p-0dd837cf.entry.js.map} +0 -0
  261. /package/dist/cura/{p-c63f4695.entry.js.map → p-2203e829.entry.js.map} +0 -0
  262. /package/dist/cura/{p-6373c7cd.entry.js.map → p-4c7a2419.entry.js.map} +0 -0
  263. /package/dist/cura/{p-5fcfbf32.entry.js.map → p-66c5cf5f.entry.js.map} +0 -0
  264. /package/dist/cura/{p-4eaeb590.entry.js.map → p-84d8c67d.entry.js.map} +0 -0
  265. /package/dist/cura/{p-a9dad622.entry.js.map → p-a5cf0fd6.entry.js.map} +0 -0
  266. /package/dist/cura/{p-f016eb62.entry.js.map → p-ad8a7e0f.entry.js.map} +0 -0
  267. /package/dist/cura/{p-af2036a7.entry.js.map → p-dfc65f66.entry.js.map} +0 -0
@@ -3,6 +3,7 @@
3
3
  "components/forms/cura-input-text/cura-input-text.js",
4
4
  "components/accordion/cura-accordion/cura-accordion.js",
5
5
  "components/accordion/cura-accordion-item/cura-accordion-item.js",
6
+ "components/badges/cura-badge-distance/cura-badge-distance.js",
6
7
  "components/buttons/cura-button/cura-button.js",
7
8
  "components/buttons/cura-button-outline/cura-button-outline.js",
8
9
  "components/buttons/cura-button-select/cura-button-select.js",
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Global Spacing Definitions.
3
+ * Required CSS Properties:
4
+ * --base-spacing
5
+ */
6
+ /* None: 0px */
7
+ /* Tiny default: 4px */
8
+ /* Mini default: 8px */
9
+ /* XXXS default: 12px */
10
+ /* XXS default: 16px */
11
+ /* XS default: 20px */
12
+ /* S default: 20px */
13
+ /* M default: 32px */
14
+ /* L default: 40px */
15
+ /* XL default: 48px */
16
+ /* XXL default: 64px */
17
+ /* XXXL default: 72px */
18
+ /* Huge default: 96px */
19
+ :host .container {
20
+ display: flex;
21
+ flex-direction: column;
22
+ justify-content: center;
23
+ align-items: center;
24
+ width: calc(var(--base-spacing) * 8px);
25
+ height: calc(var(--base-spacing) * 8px);
26
+ border-radius: calc(var(--base-spacing) * 1px);
27
+ background: var(--neutral-pale);
28
+ }
@@ -0,0 +1,94 @@
1
+ import { Host, h } from "@stencil/core";
2
+ export class CuraDistance {
3
+ constructor() {
4
+ this.isThousandRounded = false;
5
+ this.theme = window.CuraAPI.theme;
6
+ this.distance = 0;
7
+ this.label = 'km';
8
+ this.styles = {};
9
+ this.displayDistance = 0;
10
+ }
11
+ formatDistance() {
12
+ const roundedDistance = this.distance % 1 !== 0 ? parseFloat(this.distance.toFixed(1)) : this.distance;
13
+ this.isThousandRounded = Math.abs(roundedDistance) >= 1000;
14
+ this.displayDistance = this.isThousandRounded ? parseFloat((roundedDistance / 1000).toFixed(1)) : roundedDistance;
15
+ }
16
+ connectedCallback() {
17
+ this.setCssProperties();
18
+ this.formatDistance();
19
+ }
20
+ render() {
21
+ return (h(Host, { key: 'afc9605f43777e15c026ee00b0ca3fc18b648489' }, h("div", { key: '5e970213baad148605f9fcd0e0f0307f32a99375', class: "container", style: this.styles }, h("cura-label", { key: 'd56a580850734dedf9d7e72c0dce45d05be26119', size: 'xsmall', weight: 'bold', color: 'neutral-black' }, this.displayDistance, this.isThousandRounded ? 'K' : ''), h("cura-label", { key: 'e0ec3d1a6919b3931d807f75054b5d861e6015b3', size: 'xsmall', weight: 'bold', color: 'neutral-dark' }, this.label))));
22
+ }
23
+ setCssProperties() {
24
+ this.styles = {
25
+ '--neutral-pale': this.theme.colors.getColor(`neutral-pale`),
26
+ '--base-spacing': this.theme.spacing.getSpacing()
27
+ };
28
+ }
29
+ static get is() { return "cura-badge-distance"; }
30
+ static get encapsulation() { return "shadow"; }
31
+ static get originalStyleUrls() {
32
+ return {
33
+ "$": ["cura-badge-distance.scss"]
34
+ };
35
+ }
36
+ static get styleUrls() {
37
+ return {
38
+ "$": ["cura-badge-distance.css"]
39
+ };
40
+ }
41
+ static get properties() {
42
+ return {
43
+ "distance": {
44
+ "type": "number",
45
+ "mutable": false,
46
+ "complexType": {
47
+ "original": "number",
48
+ "resolved": "number",
49
+ "references": {}
50
+ },
51
+ "required": false,
52
+ "optional": false,
53
+ "docs": {
54
+ "tags": [],
55
+ "text": ""
56
+ },
57
+ "attribute": "distance",
58
+ "reflect": false,
59
+ "defaultValue": "0"
60
+ },
61
+ "label": {
62
+ "type": "string",
63
+ "mutable": false,
64
+ "complexType": {
65
+ "original": "string",
66
+ "resolved": "string",
67
+ "references": {}
68
+ },
69
+ "required": false,
70
+ "optional": false,
71
+ "docs": {
72
+ "tags": [],
73
+ "text": ""
74
+ },
75
+ "attribute": "label",
76
+ "reflect": true,
77
+ "defaultValue": "'km'"
78
+ }
79
+ };
80
+ }
81
+ static get states() {
82
+ return {
83
+ "styles": {},
84
+ "displayDistance": {}
85
+ };
86
+ }
87
+ static get watchers() {
88
+ return [{
89
+ "propName": "distance",
90
+ "methodName": "formatDistance"
91
+ }];
92
+ }
93
+ }
94
+ //# sourceMappingURL=cura-badge-distance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cura-badge-distance.js","sourceRoot":"","sources":["../../../../src/components/badges/cura-badge-distance/cura-badge-distance.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAOvE,MAAM,OAAO,YAAY;;QAMvB,sBAAiB,GAAG,KAAK,CAAC;QAE1B,UAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;wBANV,CAAC;qBACa,IAAI;sBACnB,EAAE;+BACO,CAAC;;IAM5B,cAAc;QACZ,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;QACvG,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,IAAI,CAAC;QAC3D,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;IACpH,CAAC;IAGD,iBAAiB;QACf,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI;YACH,4DAAK,KAAK,EAAC,WAAW,EAAC,KAAK,EAAE,IAAI,CAAC,MAAM;gBACvC,mEAAY,IAAI,EAAC,QAAQ,EAAC,MAAM,EAAC,MAAM,EAAC,KAAK,EAAC,eAAe;oBAC1D,IAAI,CAAC,eAAe;oBAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAC7C;gBACb,mEAAY,IAAI,EAAC,QAAQ,EAAC,MAAM,EAAC,MAAM,EAAC,KAAK,EAAC,cAAc,IACzD,IAAI,CAAC,KAAK,CACA,CACT,CACD,CACR,CAAC;IACJ,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,MAAM,GAAG;YACZ,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC;YAC5D,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE;SAClD,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, Prop, State, Watch, h } from '@stencil/core';\n\n@Component({\n tag: 'cura-badge-distance',\n styleUrl: 'cura-badge-distance.scss',\n shadow: true,\n})\nexport class CuraDistance {\n\n @Prop() distance = 0;\n @Prop({ reflect: true }) label = 'km';\n @State() styles = {};\n @State() displayDistance = 0;\n isThousandRounded = false;\n\n theme = window.CuraAPI.theme;\n\n @Watch('distance')\n formatDistance() {\n const roundedDistance = this.distance % 1 !== 0 ? parseFloat(this.distance.toFixed(1)) : this.distance; \n this.isThousandRounded = Math.abs(roundedDistance) >= 1000;\n this.displayDistance = this.isThousandRounded ? parseFloat((roundedDistance / 1000).toFixed(1)) : roundedDistance;\n }\n\n\n connectedCallback(){\n this.setCssProperties();\n this.formatDistance(); \n }\n\n render() {\n return (\n <Host>\n <div class=\"container\" style={this.styles}>\n <cura-label size='xsmall' weight='bold' color='neutral-black'>\n {this.displayDistance}{this.isThousandRounded ? 'K' : ''}\n </cura-label>\n <cura-label size='xsmall' weight='bold' color='neutral-dark'>\n {this.label}\n </cura-label>\n </div>\n </Host>\n );\n }\n\n setCssProperties() {\n this.styles = {\n '--neutral-pale': this.theme.colors.getColor(`neutral-pale`),\n '--base-spacing': this.theme.spacing.getSpacing()\n }\n }\n\n}\n"]}
@@ -0,0 +1,56 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s)
4
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ const renderCuraBadgeDistance = (args) => {
14
+ const block = `
15
+ <cura-badge-distance ${args.distance ? `
16
+ distance="${args.distance}"` : ''}${args.label && args.label !== 'km' ? `
17
+ label="${args.label}"` : ''}>
18
+ </cura-badge-distance>
19
+
20
+ `;
21
+ return `${block}`;
22
+ };
23
+ export default {
24
+ title: 'Componentes/Badges/Badge Distance',
25
+ tags: ['autodocs'],
26
+ render: (_a) => {
27
+ var args = __rest(_a, []);
28
+ return renderCuraBadgeDistance(args);
29
+ },
30
+ argTypes: {
31
+ distance: {
32
+ control: 'number',
33
+ description: 'Distancia que será exibida.',
34
+ table: {
35
+ category: 'Properties',
36
+ defaultValue: { summary: 1 },
37
+ },
38
+ },
39
+ label: {
40
+ control: { type: 'select' },
41
+ options: ['m', 'km'],
42
+ description: 'Unidade de medida a ser exibida',
43
+ table: {
44
+ category: 'Properties',
45
+ defaultValue: { summary: 'km' },
46
+ },
47
+ },
48
+ },
49
+ };
50
+ export const CuraBadgeDistance = {
51
+ args: {
52
+ distance: 1,
53
+ label: 'km',
54
+ },
55
+ };
56
+ //# sourceMappingURL=cura-badge-distance.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cura-badge-distance.stories.js","sourceRoot":"","sources":["../../../../src/components/badges/cura-badge-distance/cura-badge-distance.stories.tsx"],"names":[],"mappings":";;;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?`\n distance=\"${args.distance}\"` : ''}${args.label && args.label !== 'km' ?`\n label=\"${args.label}\"` : ''}>\n</cura-badge-distance>\n\n`;\n return `${block}`;\n}\n\nexport default {\n title: 'Componentes/Badges/Badge Distance',\n tags: ['autodocs'],\n render: ({ ...args }) => {\n return renderCuraBadgeDistance(args);\n },\n argTypes: {\n distance: {\n control: 'number',\n description: 'Distancia que será exibida.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 1 },\n },\n },\n label: {\n control: { type: 'select' },\n options: ['m', 'km'],\n description: 'Unidade de medida a ser exibida',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'km' },\n },\n },\n },\n};\n\nexport const CuraBadgeDistance = {\n args: {\n distance: 1,\n label: 'km',\n },\n};\n"]}
@@ -7,6 +7,27 @@
7
7
  * --font-weight-medium
8
8
  * --text-align
9
9
  */
10
+ /**
11
+ * Spacing sass vars
12
+ */
13
+ /**
14
+ * Global Spacing Definitions.
15
+ * Required CSS Properties:
16
+ * --base-spacing
17
+ */
18
+ /* None: 0px */
19
+ /* Tiny default: 4px */
20
+ /* Mini default: 8px */
21
+ /* XXXS default: 12px */
22
+ /* XXS default: 16px */
23
+ /* XS default: 20px */
24
+ /* S default: 20px */
25
+ /* M default: 32px */
26
+ /* L default: 40px */
27
+ /* XL default: 48px */
28
+ /* XXL default: 64px */
29
+ /* XXXL default: 72px */
30
+ /* Huge default: 96px */
10
31
  /**
11
32
  * Buttons Host element definitions.
12
33
  * Use: @include button-host() { ... }
@@ -74,25 +95,43 @@
74
95
  position: relative;
75
96
  background-color: var(--color-base-neutral-purewhite);
76
97
  box-sizing: border-box;
77
- border: 2px solid transparent;
98
+ border: none;
78
99
  }
79
100
  :host button:focus,
80
101
  :host a:focus {
81
102
  outline: 2px solid #6EA8FF;
82
103
  }
83
- :host button:not(.disabled):not(.isLoading),
84
- :host a:not(.disabled):not(.isLoading) {
104
+ :host button::before,
105
+ :host a::before {
106
+ content: "";
107
+ width: 100%;
108
+ height: 100%;
109
+ position: absolute;
110
+ left: 0px;
111
+ top: 0px;
112
+ box-sizing: border-box;
113
+ border: 2px solid transparent;
114
+ border-radius: var(--border-radius);
115
+ }
116
+ :host button:not(.disabled):not(.isLoading)::before,
117
+ :host a:not(.disabled):not(.isLoading)::before {
85
118
  border: 2px solid var(--color-base-color-light);
86
119
  }
87
120
  :host button:not(.disabled):hover,
88
121
  :host a:not(.disabled):hover {
89
- border-color: var(--color-dark-color-base);
90
122
  background: var(--color-base-color-light);
91
123
  box-shadow: 0px 4px 8px 0px rgba(38, 38, 38, 0.16);
92
124
  }
125
+ :host button:not(.disabled):not(.isLoading):hover::before,
126
+ :host a:not(.disabled):not(.isLoading):hover::before {
127
+ border-color: var(--color-dark-color-base);
128
+ }
93
129
  :host button:not(.isLoading):not(.disabled):active,
94
130
  :host a:not(.isLoading):not(.disabled):active {
95
131
  background-color: var(--color-dark-color-light);
132
+ }
133
+ :host button:not(.isLoading):not(.disabled):active::before,
134
+ :host a:not(.isLoading):not(.disabled):active::before {
96
135
  border-color: var(--color-dark-color-light);
97
136
  }
98
137
  :host button:hover,
@@ -115,39 +154,18 @@
115
154
  }
116
155
  :host button.large,
117
156
  :host a.large {
118
- padding: calc(var(--base-spacing) * 6.12px) calc(var(--base-spacing) * 9.96px);
119
- min-height: calc(var(--base-spacing) * 13px);
120
- min-width: calc(var(--base-spacing) * 33.7px);
157
+ padding: calc(var(--base-spacing) * 3px) calc(var(--base-spacing) * 4px);
158
+ min-height: calc(var(--base-spacing) * 11px);
121
159
  }
122
160
  :host button.medium,
123
161
  :host a.medium {
124
- padding: calc(var(--base-spacing) * 3.44px) calc(var(--base-spacing) * 9.96px);
125
- min-height: calc(var(--base-spacing) * 11px);
126
- min-width: calc(var(--base-spacing) * 29.95px);
162
+ padding: calc(var(--base-spacing) * 3px);
163
+ min-height: calc(var(--base-spacing) * 10px);
127
164
  }
128
165
  :host button.small,
129
166
  :host a.small {
130
- padding: calc(var(--base-spacing) * 3.24px) calc(var(--base-spacing) * 7.44px);
131
- min-height: calc(var(--base-spacing) * 8px);
132
- min-width: calc(var(--base-spacing) * 21.67px);
133
- }
134
- :host button:not(.isLoading).large,
135
- :host a:not(.isLoading).large {
136
- padding: calc(var(--base-spacing) * 3.5px) calc(var(--base-spacing) * 4px);
137
- min-height: calc(var(--base-spacing) * 13px);
138
- min-width: calc(var(--base-spacing) * 13px);
139
- }
140
- :host button:not(.isLoading).medium,
141
- :host a:not(.isLoading).medium {
142
- padding: calc(var(--base-spacing) * 2.75px) calc(var(--base-spacing) * 4px);
143
- min-height: calc(var(--base-spacing) * 11px);
144
- min-width: calc(var(--base-spacing) * 11px);
145
- }
146
- :host button:not(.isLoading).small,
147
- :host a:not(.isLoading).small {
148
- padding: calc(var(--base-spacing) * 1.5px) calc(var(--base-spacing) * 3px);
167
+ padding: calc(var(--base-spacing) * 2px);
149
168
  min-height: calc(var(--base-spacing) * 8px);
150
- min-width: calc(var(--base-spacing) * 8px);
151
169
  }
152
170
  :host button .button-container,
153
171
  :host a .button-container {
@@ -161,23 +179,15 @@
161
179
  :host a.icon-right .button-container {
162
180
  flex-direction: row-reverse;
163
181
  }
182
+ :host button.justify .button-container,
183
+ :host a.justify .button-container {
184
+ width: 100%;
185
+ }
164
186
  :host button cura-label,
165
187
  :host a cura-label {
166
188
  flex: 1;
167
- font-family: var(--font-family);
168
- font-weight: var(--font-weight-medium);
169
- font-size: 1.43em;
170
- line-height: 1.2em;
171
189
  text-align: var(--text-align, "left");
172
190
  }
173
- :host button.medium cura-label,
174
- :host a.medium cura-label {
175
- font-size: 1.14em;
176
- }
177
- :host button.small cura-label,
178
- :host a.small cura-label {
179
- font-size: 1em;
180
- }
181
191
  :host button.icon-left cura-icon,
182
192
  :host a.icon-left cura-icon {
183
193
  margin-right: calc(var(--base-spacing) * 3px);
@@ -186,21 +196,15 @@
186
196
  :host a.icon-right cura-icon {
187
197
  margin-left: calc(var(--base-spacing) * 3px);
188
198
  }
189
- :host button.medium.icon-left cura-icon,
190
- :host a.medium.icon-left cura-icon {
191
- margin-right: calc(var(--base-spacing) * 2.7px);
192
- }
193
- :host button.medium.icon-right cura-icon,
194
- :host a.medium.icon-right cura-icon {
195
- margin-left: calc(var(--base-spacing) * 2.7px);
196
- }
197
- :host button.small.icon-left cura-icon,
199
+ :host button.medium.icon-left cura-icon, :host button.small.icon-left cura-icon,
200
+ :host a.medium.icon-left cura-icon,
198
201
  :host a.small.icon-left cura-icon {
199
- margin-right: calc(var(--base-spacing) * 2.5px);
202
+ margin-right: calc(var(--base-spacing) * 2px);
200
203
  }
201
- :host button.small.icon-right cura-icon,
204
+ :host button.medium.icon-right cura-icon, :host button.small.icon-right cura-icon,
205
+ :host a.medium.icon-right cura-icon,
202
206
  :host a.small.icon-right cura-icon {
203
- margin-left: calc(var(--base-spacing) * 2.5px);
207
+ margin-left: calc(var(--base-spacing) * 2px);
204
208
  }
205
209
  :host button.disabled,
206
210
  :host a.disabled {
@@ -209,7 +213,7 @@
209
213
  }
210
214
  :host button.icon-only,
211
215
  :host a.icon-only {
212
- padding: calc(var(--base-spacing) * 3.5px);
216
+ padding: calc(var(--base-spacing) * 3px) calc(var(--base-spacing) * 3px);
213
217
  }
214
218
  :host button.icon-only cura-label,
215
219
  :host a.icon-only cura-label {
@@ -222,11 +226,11 @@
222
226
  }
223
227
  :host button.icon-only.medium,
224
228
  :host a.icon-only.medium {
225
- padding: calc(var(--base-spacing) * 2.75px);
229
+ padding: calc(var(--base-spacing) * 3px);
226
230
  }
227
231
  :host button.icon-only.small,
228
232
  :host a.icon-only.small {
229
- padding: calc(var(--base-spacing) * 1.5px);
233
+ padding: calc(var(--base-spacing) * 2px);
230
234
  }
231
235
  :host button cura-loader-circle,
232
236
  :host a cura-loader-circle {
@@ -239,17 +243,9 @@
239
243
  }
240
244
  :host button.isLoading .button-container,
241
245
  :host a.isLoading .button-container {
242
- opacity: 0.3;
243
- }
244
- :host button.isLoading.icon-only .button-container,
245
- :host a.isLoading.icon-only .button-container {
246
246
  opacity: 0;
247
247
  }
248
248
  :host button.isLoading cura-loader-circle,
249
249
  :host a.isLoading cura-loader-circle {
250
250
  display: block;
251
- }
252
- :host button.isLoading cura-label,
253
- :host a.isLoading cura-label {
254
- display: none;
255
251
  }
@@ -1,4 +1,5 @@
1
1
  import { Host, h } from "@stencil/core";
2
+ import { labelSizes } from "../cura-button.definitions";
2
3
  export class CuraButton {
3
4
  constructor() {
4
5
  this.type = 'button';
@@ -15,6 +16,7 @@ export class CuraButton {
15
16
  this.background = 'light';
16
17
  this.fontColor = 'dark';
17
18
  this.textAlign = 'left';
19
+ this.justify = false;
18
20
  this.styles = {};
19
21
  this.hovered = false;
20
22
  }
@@ -54,12 +56,13 @@ export class CuraButton {
54
56
  classes[`icon-only`] = this.iconOnly;
55
57
  classes['disabled'] = this.disabled;
56
58
  classes['isLoading'] = this.isLoading;
59
+ classes['justify'] = this.justify;
57
60
  return classes;
58
61
  }
59
62
  getIcon() {
60
- if (!this.iconName || this.isLoading)
63
+ if (!this.iconName)
61
64
  return '';
62
- const iconSize = this.size === 'small' ? 16 : this.size === 'medium' ? 20 : 24;
65
+ const iconSize = this.size === 'large' ? 20 : 16;
63
66
  return h("cura-icon", { name: this.iconName, iconset: this.iconset, size: iconSize, color: this.getSymbolColor() });
64
67
  }
65
68
  getSymbolColor() {
@@ -83,7 +86,9 @@ export class CuraButton {
83
86
  }
84
87
  }
85
88
  render() {
86
- return (h(Host, { key: '5a7c983dcae745239e7f81bc172a2aa52b5de8de' }, this.href ? (h("a", { href: this.disabled ? '' : this.href, target: this.target, class: this.getClasses(), style: this.styles, onClick: (e) => this.handleClick(e), onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave() }, h("span", { class: "button-container" }, this.getIcon(), h("cura-label", { class: "label", lineHeight: '0%', color: this.getSymbolColor() }, h("slot", null))), h("cura-loader-circle", { size: this.size, color: this.getSymbolColor() }))) : (h("button", { class: this.getClasses(), style: this.styles, disabled: this.disabled || null, onClick: (e) => this.handleClick(e), onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave(), type: this.type }, h("span", { class: "button-container" }, this.getIcon(), h("cura-label", { class: "label", lineHeight: '0%', color: this.getSymbolColor() }, h("slot", null))), h("cura-loader-circle", { size: this.size, color: this.getSymbolColor() })))));
89
+ const symbolColor = this.getSymbolColor();
90
+ const labelSize = labelSizes[this.size] || labelSizes["default"];
91
+ return (h(Host, { key: '33ee4706d79aae1ea11e804e59919f5e3afcf336' }, this.href ? (h("a", { href: this.disabled ? '' : this.href, target: this.target, class: this.getClasses(), style: this.styles, onClick: (e) => this.handleClick(e), onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave() }, h("span", { class: "button-container" }, this.getIcon(), h("cura-label", { class: "label", size: labelSize, lineHeight: '118%', color: symbolColor }, h("slot", null))), h("cura-loader-circle", { size: this.size, color: symbolColor }))) : (h("button", { class: this.getClasses(), style: this.styles, disabled: this.disabled || null, onClick: (e) => this.handleClick(e), onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave(), type: this.type }, h("span", { class: "button-container" }, this.getIcon(), h("cura-label", { class: "label", size: labelSize, lineHeight: '118%', color: symbolColor }, h("slot", null))), h("cura-loader-circle", { size: this.size, color: symbolColor })))));
87
92
  }
88
93
  static get is() { return "cura-button"; }
89
94
  static get encapsulation() { return "shadow"; }
@@ -349,6 +354,24 @@ export class CuraButton {
349
354
  "attribute": "text-align",
350
355
  "reflect": true,
351
356
  "defaultValue": "'left'"
357
+ },
358
+ "justify": {
359
+ "type": "boolean",
360
+ "mutable": false,
361
+ "complexType": {
362
+ "original": "boolean",
363
+ "resolved": "boolean",
364
+ "references": {}
365
+ },
366
+ "required": false,
367
+ "optional": false,
368
+ "docs": {
369
+ "tags": [],
370
+ "text": "Justify icons and label inside the button.\nVales: false (default) | true."
371
+ },
372
+ "attribute": "justify",
373
+ "reflect": true,
374
+ "defaultValue": "false"
352
375
  }
353
376
  };
354
377
  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n@Component({\n tag: 'cura-button',\n styleUrl: 'cura-button.scss',\n shadow: true,\n formAssociated: true\n})\nexport class CuraButton {\n\n @AttachInternals() internals: ElementInternals;\n\n /**\n * Button type: button (default) | submit | reset\n */\n @Prop({ reflect: true }) type: 'button' | 'reset' | 'submit' = 'button';\n\n /**\n * Button size: small | medium | large (default)\n */\n @Prop({ reflect: true }) size: 'small' | 'medium' | 'large' = 'large';\n\n /**\n * Disabled state. Boolean.\n */\n @Prop({ reflect: true }) disabled = false;\n /**\n * Loading state. Boolean.\n */\n @Prop({ reflect: true }) isLoading = false;\n\n /**\n * Name of the icon to be used from iconset.\n */\n @Prop({ reflect: true }) iconName: string;\n /**\n * Custom iconset if needed.\n */\n @Prop({ reflect: true }) iconset = 'default';\n /**\n * Icon position: left (default) | right.\n */\n @Prop({ reflect: true }) iconPosition: 'left' | 'right' = 'left';\n /**\n * Set button to FAB/icon only.\n */\n @Prop({ reflect: true }) iconOnly = false;\n\n /**\n * Property href switch button to link.\n */\n @Prop({ reflect: true }) href: string;\n /**\n * Set target if link.\n */\n @Prop({ reflect: true }) target = \"_self\";\n\n /**\n * Color base from color scheme. Default: accent.\n */\n @Prop() color = 'accent';\n\n /**\n * Set the background color to dark or light.\n */\n @Prop({ reflect: true }) background: 'dark' | 'light' = 'light';\n\n /**\n * Set the font color to dark or light.\n */\n @Prop({ reflect: true }) fontColor: 'dark' | 'light' = 'dark';\n /**\n * Set text aligment for the button label.\n * Vales: left (default) | center | right.\n */\n @Prop({ reflect: true }) textAlign: 'left' | 'center' | 'right' = 'left';\n\n @State() styles = {};\n\n @State() hovered = false\n\n weights;\n\n\n connectedCallback() {\n this.weights = window.CuraAPI.theme.fonts.getWeights();\n this.styles['--base-spacing'] = window.CuraAPI.theme.spacing.getSpacing();\n this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();\n this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();\n this.styles['--font-weight-medium'] = this.weights.medium;\n this.styles['--text-align'] = this.textAlign;\n this.setColors();\n }\n\n @Watch('background')\n @Watch('color')\n setColors() {\n const colors = [\n { name: '--color-base-neutral-purewhite', theme: `${this.background === 'light' ? `${this.color}-base` : 'neutral-pale'}` },\n { name: '--color-base-color-light', theme: `${this.background === 'light' ? `${this.color}-base` : `${this.color}-lighter`}` },\n { name: '--color-dark-color-light', theme: `${this.background === 'light' ? `${this.color}-dark` : `${this.color}-light`}` },\n { name: '--color-dark-color-base', theme: `${this.background === 'light' ? `${this.color}-dark` : `${this.color}-base`}` },\n { name: '--neutral-pale-neutral-black', theme: `${this.background === 'light' ? 'neutral-pale' : 'neutral-black'}` },\n ]\n\n colors.forEach(color => this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.theme));\n this.styles = { ...this.styles };\n }\n\n handleMouseEnter() {\n if (this.disabled) return;\n this.hovered = true;\n }\n\n handleMouseLeave() {\n this.hovered = false;\n }\n\n getClasses() {\n const classes = {};\n classes[`${this.size?.toLowerCase()}`] = true;\n classes[`icon-${this.iconPosition?.toLowerCase()}`] = true;\n classes[`icon-only`] = this.iconOnly;\n classes['disabled'] = this.disabled;\n classes['isLoading'] = this.isLoading;\n\n return classes;\n }\n\n getIcon() {\n if (!this.iconName || this.isLoading) return '';\n const iconSize = this.size === 'small' ? 16 : this.size === 'medium' ? 20 : 24;\n return <cura-icon name={this.iconName} iconset={this.iconset} size={iconSize} color={this.getSymbolColor()}></cura-icon>;\n }\n\n getSymbolColor() {\n if (this.isLoading && this.fontColor === 'light' ? 'neutral-white' : 'neutral-black')\n return this.disabled\n ? 'neutral-dark'\n : this.fontColor === 'light'\n ? 'neutral-white'\n : 'neutral-black';\n }\n\n handleClick(e: Event) {\n if (this.disabled || this.isLoading) {\n e.preventDefault();\n return;\n }\n if (!this.href) {\n if (this.type === 'submit' && this.internals.form) this.internals.form.submit();\n if (this.type === 'reset' && this.internals.form) this.internals.form.reset();\n }\n }\n\n render() {\n return (\n <Host>\n {this.href ? (\n <a href={this.disabled ? '' : this.href}\n target={this.target}\n class={this.getClasses()}\n style={this.styles}\n onClick={(e) => this.handleClick(e)}\n onMouseEnter={() => this.handleMouseEnter()}\n onMouseLeave={() => this.handleMouseLeave()}>\n <span class=\"button-container\">\n {this.getIcon()}\n <cura-label class=\"label\" lineHeight='0%' color={this.getSymbolColor()}><slot></slot></cura-label>\n </span>\n <cura-loader-circle size={this.size} color={this.getSymbolColor()}></cura-loader-circle>\n </a>\n ) : (\n <button class={this.getClasses()}\n style={this.styles}\n disabled={this.disabled || null}\n onClick={(e) => this.handleClick(e)}\n onMouseEnter={() => this.handleMouseEnter()}\n onMouseLeave={() => this.handleMouseLeave()}\n type={this.type}>\n <span class=\"button-container\">\n {this.getIcon()}\n <cura-label class=\"label\" lineHeight='0%' color={this.getSymbolColor()}><slot></slot></cura-label>\n </span>\n <cura-loader-circle size={this.size} color={this.getSymbolColor()}></cura-loader-circle>\n </button>\n )}\n </Host>\n );\n }\n\n}\n"]}
1
+ {"version":3,"file":"cura-button.js","sourceRoot":"","sources":["../../../../src/components/buttons/cura-button/cura-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAQxD,MAAM,OAAO,UAAU;;oBAO0C,QAAQ;oBAKT,OAAO;wBAKjC,KAAK;yBAIJ,KAAK;;uBASP,SAAS;4BAIc,MAAM;wBAI5B,KAAK;;sBASP,OAAO;qBAKzB,QAAQ;0BAKgC,OAAO;yBAKR,MAAM;yBAMK,MAAM;uBAMrC,KAAK;sBAEtB,EAAE;uBAED,KAAK;;IAKxB,iBAAiB;QACf,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACvD,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAA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,EAAE,IAAI,CAAC,IAAI;YACf,YAAM,KAAK,EAAC,kBAAkB;gBAC3B,IAAI,CAAC,OAAO,EAAE;gBACf,kBAAY,KAAK,EAAC,OAAO,EAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAC,MAAM,EAAC,KAAK,EAAE,WAAW;oBAAE,eAAa,CAAa,CACtG;YACP,0BAAoB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,GAAuB,CACvE,CACV,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Prop, Watch, State, AttachInternals } from '@stencil/core';\nimport { labelSizes } from '../cura-button.definitions';\n\n@Component({\n tag: 'cura-button',\n styleUrl: 'cura-button.scss',\n shadow: true,\n formAssociated: true\n})\nexport class CuraButton {\n\n @AttachInternals() internals: ElementInternals;\n\n /**\n * Button type: button (default) | submit | reset\n */\n @Prop({ reflect: true }) type: 'button' | 'reset' | 'submit' = 'button';\n\n /**\n * Button size: small | medium | large (default)\n */\n @Prop({ reflect: true }) size: 'small' | 'medium' | 'large' = 'large';\n\n /**\n * Disabled state. Boolean.\n */\n @Prop({ reflect: true }) disabled = false;\n /**\n * Loading state. Boolean.\n */\n @Prop({ reflect: true }) isLoading = false;\n\n /**\n * Name of the icon to be used from iconset.\n */\n @Prop({ reflect: true }) iconName: string;\n /**\n * Custom iconset if needed.\n */\n @Prop({ reflect: true }) iconset = 'default';\n /**\n * Icon position: left (default) | right.\n */\n @Prop({ reflect: true }) iconPosition: 'left' | 'right' = 'left';\n /**\n * Set button to FAB/icon only.\n */\n @Prop({ reflect: true }) iconOnly = false;\n\n /**\n * Property href switch button to link.\n */\n @Prop({ reflect: true }) href: string;\n /**\n * Set target if link.\n */\n @Prop({ reflect: true }) target = \"_self\";\n\n /**\n * Color base from color scheme. Default: accent.\n */\n @Prop() color = 'accent';\n\n /**\n * Set the background color to dark or light.\n */\n @Prop({ reflect: true }) background: 'dark' | 'light' = 'light';\n\n /**\n * Set the font color to dark or light.\n */\n @Prop({ reflect: true }) fontColor: 'dark' | 'light' = 'dark';\n\n /**\n * Set text aligment for the button label.\n * Vales: left (default) | center | right.\n */\n @Prop({ reflect: true }) textAlign: 'left' | 'center' | 'right' = 'left';\n\n /**\n * Justify icons and label inside the button.\n * Vales: false (default) | true.\n */\n @Prop({ reflect: true }) justify = false;\n\n @State() styles = {};\n\n @State() hovered = false\n\n weights;\n\n\n connectedCallback() {\n this.weights = window.CuraAPI.theme.fonts.getWeights();\n this.styles['--base-spacing'] = window.CuraAPI.theme.spacing.getSpacing();\n this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();\n this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();\n this.styles['--font-weight-medium'] = this.weights.medium;\n this.styles['--text-align'] = this.textAlign;\n this.setColors();\n }\n\n @Watch('background')\n @Watch('color')\n setColors() {\n const colors = [\n { name: '--color-base-neutral-purewhite', theme: `${this.background === 'light' ? `${this.color}-base` : 'neutral-pale'}` },\n { name: '--color-base-color-light', theme: `${this.background === 'light' ? `${this.color}-base` : `${this.color}-lighter`}` },\n { name: '--color-dark-color-light', theme: `${this.background === 'light' ? `${this.color}-dark` : `${this.color}-light`}` },\n { name: '--color-dark-color-base', theme: `${this.background === 'light' ? `${this.color}-dark` : `${this.color}-base`}` },\n { name: '--neutral-pale-neutral-black', theme: `${this.background === 'light' ? 'neutral-pale' : 'neutral-black'}` },\n ]\n\n colors.forEach(color => this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.theme));\n this.styles = { ...this.styles };\n }\n\n handleMouseEnter() {\n if (this.disabled) return;\n this.hovered = true;\n }\n\n handleMouseLeave() {\n this.hovered = false;\n }\n\n getClasses() {\n const classes = {};\n classes[`${this.size?.toLowerCase()}`] = true;\n classes[`icon-${this.iconPosition?.toLowerCase()}`] = true;\n classes[`icon-only`] = this.iconOnly;\n classes['disabled'] = this.disabled;\n classes['isLoading'] = this.isLoading;\n classes['justify'] = this.justify;\n\n return classes;\n }\n\n getIcon() {\n if (!this.iconName) return '';\n const iconSize = this.size === 'large' ? 20 : 16;\n return <cura-icon name={this.iconName} iconset={this.iconset} size={iconSize} color={this.getSymbolColor()}></cura-icon>;\n }\n\n getSymbolColor() {\n if (this.isLoading && this.fontColor === 'light' ? 'neutral-white' : 'neutral-black')\n return this.disabled\n ? 'neutral-dark'\n : this.fontColor === 'light'\n ? 'neutral-white'\n : 'neutral-black';\n }\n\n handleClick(e: Event) {\n if (this.disabled || this.isLoading) {\n e.preventDefault();\n return;\n }\n if (!this.href) {\n if (this.type === 'submit' && this.internals.form) this.internals.form.submit();\n if (this.type === 'reset' && this.internals.form) this.internals.form.reset();\n }\n }\n\n render() {\n const symbolColor = this.getSymbolColor();\n const labelSize = labelSizes[this.size] || labelSizes[\"default\"];\n return (\n <Host>\n {this.href ? (\n <a href={this.disabled ? '' : this.href}\n target={this.target}\n class={this.getClasses()}\n style={this.styles}\n onClick={(e) => this.handleClick(e)}\n onMouseEnter={() => this.handleMouseEnter()}\n onMouseLeave={() => this.handleMouseLeave()}>\n <span class=\"button-container\">\n {this.getIcon()}\n <cura-label class=\"label\" size={labelSize} lineHeight='118%' color={symbolColor}><slot></slot></cura-label>\n </span>\n <cura-loader-circle size={this.size} color={symbolColor}></cura-loader-circle>\n </a>\n ) : (\n <button class={this.getClasses()}\n style={this.styles}\n disabled={this.disabled || null}\n onClick={(e) => this.handleClick(e)}\n onMouseEnter={() => this.handleMouseEnter()}\n onMouseLeave={() => this.handleMouseLeave()}\n type={this.type}>\n <span class=\"button-container\">\n {this.getIcon()}\n <cura-label class=\"label\" size={labelSize} lineHeight='118%' color={symbolColor}><slot></slot></cura-label>\n </span>\n <cura-loader-circle size={this.size} color={symbolColor}></cura-loader-circle>\n </button>\n )}\n </Host>\n );\n }\n\n}\n"]}
@@ -12,6 +12,12 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  };
13
13
  import iconNames from "../../../assets/icons/iconset-default-list";
14
14
  const renderCuraButton = (label, args) => {
15
+ const style = args.borderRadius && args.borderRadius !== '4px' ? `<style>
16
+ cura-button {
17
+ --border-radius: ${args.borderRadius} !important;
18
+ }
19
+ </style>
20
+ ` : '';
15
21
  const block = `<cura-button${args.size && args.size !== 'large' ? `
16
22
  size="${args.size}"` : ''}${args.color ? `
17
23
  type="${args.type}"
@@ -25,11 +31,12 @@ const renderCuraButton = (label, args) => {
25
31
  icon-only` : ''}${args.href ? `
26
32
  href="${args.href}"` : ''}${args.target ? `
27
33
  target="${args.target}"` : ''}${args.textAlign && args.textAlign !== 'left' ? `
28
- text-align="${args.textAlign}"` : ''}${args.fullWidth ? `
34
+ text-align="${args.textAlign}"` : ''}${args.justify ? `
35
+ justify="${args.justify}"` : ''}${args.fullWidth ? `
29
36
  style="width: 100%;"` : ''}>
30
37
  ${label}
31
38
  </cura-button>`;
32
- return `${block}`;
39
+ return `${style}${block}`;
33
40
  };
34
41
  export default {
35
42
  title: 'Componentes/Buttons/Button',
@@ -118,6 +125,23 @@ export default {
118
125
  },
119
126
  name: 'text-align'
120
127
  },
128
+ justify: {
129
+ control: 'boolean',
130
+ description: 'Expande os elementos internos para a dimensão do botão.',
131
+ table: {
132
+ category: 'Properties',
133
+ defaultValue: { summary: false }
134
+ }
135
+ },
136
+ borderRadius: {
137
+ control: 'text',
138
+ description: 'Personaliza a propriedade border-radius do botão.',
139
+ table: {
140
+ category: 'CSS Properties',
141
+ defaultValue: { summary: '4px' }
142
+ },
143
+ name: '--border-radius'
144
+ },
121
145
  fullWidth: {
122
146
  control: 'boolean',
123
147
  description: 'Não é uma propriedade do componente. Aplicado como estilo CSS diretamente para visualização em largura total',
@@ -180,6 +204,7 @@ export const Button = {
180
204
  fontColor: 'dark',
181
205
  background: 'light',
182
206
  textAlign: 'left',
207
+ justify: false,
183
208
  iconName: '',
184
209
  iconPosition: 'left',
185
210
  iconOnly: false,
@@ -187,6 +212,7 @@ export const Button = {
187
212
  isLoading: false,
188
213
  href: '',
189
214
  target: '_self',
215
+ borderRadius: '4px',
190
216
  fullWidth: false,
191
217
  },
192
218
  };