@websolutespa/bom-mixer-ui 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/CHANGELOG.md +50 -44
  2. package/package.json +3 -3
  3. package/src/__tests/example.test.ts +8 -0
  4. package/src/components/accordion/accordion-context.ts +14 -0
  5. package/src/components/accordion/accordion-group.tsx +82 -0
  6. package/src/components/accordion/accordion-icon.tsx +37 -0
  7. package/src/components/accordion/accordion.tsx +132 -0
  8. package/src/components/backdrop/backdrop.tsx +156 -0
  9. package/src/components/background/background.tsx +35 -0
  10. package/src/components/badge/badge.tsx +21 -0
  11. package/src/components/box/box.tsx +12 -0
  12. package/src/components/breadcrumb/breadcrumb-item.tsx +53 -0
  13. package/src/components/breadcrumb/breadcrumb-separator.tsx +33 -0
  14. package/src/components/breadcrumb/breadcrumb.group.tsx +27 -0
  15. package/src/components/breadcrumb/breadcrumb.tsx +77 -0
  16. package/src/components/breakpoint/breakpoint.tsx +46 -0
  17. package/src/components/button/__snapshots__/button.test.tsx.snap +61 -0
  18. package/src/components/button/button.test.enzyme.example +132 -0
  19. package/src/components/button/button.test.tsx +33 -0
  20. package/src/components/button/button.tsx +36 -0
  21. package/src/components/button/button.variants.ts +320 -0
  22. package/src/components/button-group/button-group.tsx +102 -0
  23. package/src/components/card/card-content.tsx +13 -0
  24. package/src/components/card/card-footer.tsx +18 -0
  25. package/src/components/card/card.tsx +144 -0
  26. package/src/components/carousel/carousel.tsx +62 -0
  27. package/src/components/carousel/slide.tsx +28 -0
  28. package/src/components/code/code.tsx +17 -0
  29. package/src/components/container/container.tsx +32 -0
  30. package/src/components/css.ts +292 -0
  31. package/src/components/divider/divider.tsx +54 -0
  32. package/src/components/drawer/drawer-wrapper.tsx +154 -0
  33. package/src/components/drawer/drawer.tsx +110 -0
  34. package/src/components/drawer/helper.ts +33 -0
  35. package/src/components/dropdown/dropdown-layout.ts +94 -0
  36. package/src/components/dropdown/dropdown.tsx +132 -0
  37. package/src/components/ellipsis/ellipsis.tsx +18 -0
  38. package/src/components/expand/expand.tsx +97 -0
  39. package/src/components/flex/flex-col.tsx +16 -0
  40. package/src/components/flex/flex-flow.tsx +165 -0
  41. package/src/components/flex/flex-responsive.tsx +28 -0
  42. package/src/components/flex/flex-row.tsx +18 -0
  43. package/src/components/flex/flex.tsx +29 -0
  44. package/src/components/google-map/google-map-context.ts +15 -0
  45. package/src/components/google-map/google-map-hooks._ts +28 -0
  46. package/src/components/google-map/google-map-info-window.tsx +68 -0
  47. package/src/components/google-map/google-map-loader.tsx +67 -0
  48. package/src/components/google-map/google-map-marker-clusterer-plus.tsx +104 -0
  49. package/src/components/google-map/google-map-marker-clusterer.tsx +126 -0
  50. package/src/components/google-map/google-map-marker.tsx +48 -0
  51. package/src/components/google-map/google-map-skeleton.tsx +6 -0
  52. package/src/components/google-map/google-map.service.ts +236 -0
  53. package/src/components/google-map/google-map.style.ts +80 -0
  54. package/src/components/google-map/google-map.tsx +136 -0
  55. package/src/components/google-map/types.tsx +47 -0
  56. package/src/components/google-map/useGoogleMaps._ts +37 -0
  57. package/src/components/grid/grid-row.tsx +17 -0
  58. package/src/components/grid/grid.tsx +55 -0
  59. package/src/components/highlight/highlight.tsx +79 -0
  60. package/src/components/index.ts +50 -0
  61. package/src/components/infinite-loader/infinite-loader.tsx +59 -0
  62. package/src/components/layout/layout.tsx +22 -0
  63. package/src/components/link/link-icon.tsx +25 -0
  64. package/src/components/link/link.tsx +63 -0
  65. package/src/components/list/list.tsx +24 -0
  66. package/src/components/loading/loading.tsx +51 -0
  67. package/src/components/media/media-image-next.tsx +43 -0
  68. package/src/components/media/media-image.tsx +110 -0
  69. package/src/components/media/media.tsx +195 -0
  70. package/src/components/media-gallery/media-gallery-context.tsx +14 -0
  71. package/src/components/media-gallery/media-gallery-navigation.tsx +68 -0
  72. package/src/components/media-gallery/media-gallery.tsx +163 -0
  73. package/src/components/meta/meta.tsx +33 -0
  74. package/src/components/modal/modal-button.tsx +103 -0
  75. package/src/components/modal/modal-close.tsx +67 -0
  76. package/src/components/modal/modal-content.tsx +46 -0
  77. package/src/components/modal/modal-context.ts +11 -0
  78. package/src/components/modal/modal-footer.tsx +40 -0
  79. package/src/components/modal/modal-subtitle.tsx +36 -0
  80. package/src/components/modal/modal-title.tsx +36 -0
  81. package/src/components/modal/modal-wrapper.tsx +119 -0
  82. package/src/components/modal/modal.tsx +138 -0
  83. package/src/components/nav/nav.tsx +71 -0
  84. package/src/components/nav-link/nav-link.tsx +32 -0
  85. package/src/components/page/page.tsx +13 -0
  86. package/src/components/page-nav/page-nav.tsx +120 -0
  87. package/src/components/pagination/pagination-context.ts +18 -0
  88. package/src/components/pagination/pagination-ellipsis.tsx +61 -0
  89. package/src/components/pagination/pagination-item.tsx +92 -0
  90. package/src/components/pagination/pagination-next.tsx +16 -0
  91. package/src/components/pagination/pagination-pages.tsx +90 -0
  92. package/src/components/pagination/pagination-previous.tsx +16 -0
  93. package/src/components/pagination/pagination.tsx +108 -0
  94. package/src/components/popover/popover-collections.tsx +157 -0
  95. package/src/components/popover/popover-context.ts +17 -0
  96. package/src/components/popover/popover-item.tsx +85 -0
  97. package/src/components/popover/popover.tsx +102 -0
  98. package/src/components/section/section.tsx +62 -0
  99. package/src/components/skeleton/skeleton.tsx +31 -0
  100. package/src/components/svg/svg.tsx +10 -0
  101. package/src/components/swiper/swiper-navigation.tsx +68 -0
  102. package/src/components/swiper/swiper-pagination.tsx +79 -0
  103. package/src/components/swiper/swiper.tsx +45 -0
  104. package/src/components/tabs/tabs-context.ts +31 -0
  105. package/src/components/tabs/tabs-item.tsx +148 -0
  106. package/src/components/tabs/tabs.tsx +169 -0
  107. package/src/components/text/text.tsx +101 -0
  108. package/src/components/tooltip/tooltip-content.tsx +112 -0
  109. package/src/components/tooltip/tooltip-helper.tsx +35 -0
  110. package/src/components/tooltip/tooltip-icon.tsx +32 -0
  111. package/src/components/tooltip/tooltip-placement.ts +196 -0
  112. package/src/components/tooltip/tooltip-props.ts +77 -0
  113. package/src/components/tooltip/tooltip.tsx +129 -0
  114. package/src/components/transition/transition.tsx +63 -0
  115. package/src/components/types.ts +144 -0
  116. package/src/components/utils.ts +193 -0
  117. package/src/custom.d.ts +4 -0
  118. package/src/fields/field-accept.tsx +65 -0
  119. package/src/fields/field-autocomplete.tsx +113 -0
  120. package/src/fields/field-card.tsx +69 -0
  121. package/src/fields/field-checkbox.tsx +67 -0
  122. package/src/fields/field-collection.tsx +71 -0
  123. package/src/fields/field-error.tsx +28 -0
  124. package/src/fields/field-password.tsx +72 -0
  125. package/src/fields/field-select.tsx +67 -0
  126. package/src/fields/field-text.tsx +66 -0
  127. package/src/fields/fields.tsx +31 -0
  128. package/src/fields/index.ts +10 -0
  129. package/src/forms/autocomplete/autocomplete-context.ts +25 -0
  130. package/src/forms/autocomplete/autocomplete-dropdown.tsx +55 -0
  131. package/src/forms/autocomplete/autocomplete-highlight.ts +32 -0
  132. package/src/forms/autocomplete/autocomplete.tsx +279 -0
  133. package/src/forms/checkbox/checkbox-icon.tsx +43 -0
  134. package/src/forms/checkbox/checkbox.tsx +66 -0
  135. package/src/forms/custom-select/custom-select-context.ts +22 -0
  136. package/src/forms/custom-select/custom-select-divider.tsx +28 -0
  137. package/src/forms/custom-select/custom-select-dropdown.tsx +55 -0
  138. package/src/forms/custom-select/custom-select-icon-clear.tsx +23 -0
  139. package/src/forms/custom-select/custom-select-icon.tsx +25 -0
  140. package/src/forms/custom-select/custom-select-input.tsx +56 -0
  141. package/src/forms/custom-select/custom-select-label.tsx +39 -0
  142. package/src/forms/custom-select/custom-select-multiple-value.tsx +59 -0
  143. package/src/forms/custom-select/custom-select-option.tsx +126 -0
  144. package/src/forms/custom-select/custom-select.tsx +313 -0
  145. package/src/forms/field/field.tsx +34 -0
  146. package/src/forms/form/form.tsx +30 -0
  147. package/src/forms/form-error/form-error.tsx +32 -0
  148. package/src/forms/form-tester/form-tester.tsx +38 -0
  149. package/src/forms/index.ts +19 -0
  150. package/src/forms/input/input.tsx +123 -0
  151. package/src/forms/input-group/input-group.tsx +74 -0
  152. package/src/forms/label/label.tsx +31 -0
  153. package/src/forms/radio/radio-group.tsx +78 -0
  154. package/src/forms/radio/radio-icon.tsx +43 -0
  155. package/src/forms/radio/radio.tsx +72 -0
  156. package/src/forms/radio-card/radio-card-group.tsx +70 -0
  157. package/src/forms/radio-card/radio-card.tsx +233 -0
  158. package/src/forms/radio-color/radio-color-group.tsx +66 -0
  159. package/src/forms/radio-color/radio-color.tsx +100 -0
  160. package/src/forms/radio-option/radio-option-group.tsx +66 -0
  161. package/src/forms/radio-option/radio-option.tsx +131 -0
  162. package/src/forms/rating/rating-icon.tsx +30 -0
  163. package/src/forms/rating/rating.tsx +126 -0
  164. package/src/forms/select/select.tsx +90 -0
  165. package/src/forms/textarea/textarea.tsx +71 -0
  166. package/src/hoc/index.ts +2 -0
  167. package/src/hoc/with-page-transition/with-page-transition.tsx +73 -0
  168. package/src/index.ts +12 -0
  169. package/src/lazy/carousel-1/carousel-1.tsx +91 -0
  170. package/src/lazy/download-1/download-1.tsx +45 -0
  171. package/src/lazy/index.ts +2 -0
  172. package/src/lazy/lazy-loader/lazy-loader-client.tsx +48 -0
  173. package/src/lazy/lazy-loader/lazy-loader.tsx +27 -0
  174. package/src/lazy/lazy.ts +28 -0
  175. package/src/lazy/media-full-1/media-full-1.tsx +26 -0
  176. package/src/lazy/media-full-2/media-full-2.tsx +31 -0
  177. package/src/lazy/media-media-1/media-media-1.tsx +37 -0
  178. package/src/lazy/not-found/not-found.tsx +31 -0
  179. package/src/lazy/related-1/related-1-card.tsx +59 -0
  180. package/src/lazy/related-1/related-1.tsx +44 -0
  181. package/src/lazy/sizes-colors-1/sizes-colors-1.tsx +54 -0
  182. package/src/lazy/text-1/text-1.tsx +34 -0
  183. package/src/lazy/text-aside-1/text-aside-1.tsx +52 -0
  184. package/src/lazy/text-media-1/text-media-1.tsx +45 -0
  185. package/src/lazy/text-text-1/text-text-1.tsx +32 -0
  186. package/src/sections/auth/auth-change-password.tsx +90 -0
  187. package/src/sections/auth/auth-drawer.tsx +22 -0
  188. package/src/sections/auth/auth-forgot-success.tsx +25 -0
  189. package/src/sections/auth/auth-forgot.tsx +98 -0
  190. package/src/sections/auth/auth-login.tsx +114 -0
  191. package/src/sections/auth/auth-register-success.tsx +25 -0
  192. package/src/sections/auth/auth-register.tsx +107 -0
  193. package/src/sections/auth/auth-update.tsx +91 -0
  194. package/src/sections/auth/auth.tsx +46 -0
  195. package/src/sections/blog-more/blog-card.tsx +58 -0
  196. package/src/sections/blog-more/blog-more.tsx +81 -0
  197. package/src/sections/blog-proposition/blog-proposition.tsx +58 -0
  198. package/src/sections/cart-mini/cart-mini-item.tsx +58 -0
  199. package/src/sections/cart-mini/cart-mini.tsx +76 -0
  200. package/src/sections/categories-proposition/categories-proposition-card.tsx +34 -0
  201. package/src/sections/categories-proposition/categories-proposition.tsx +39 -0
  202. package/src/sections/category-hero/category-hero.tsx +47 -0
  203. package/src/sections/category-proposition/category-proposition.tsx +49 -0
  204. package/src/sections/checkout/checkout-basket-item.tsx +64 -0
  205. package/src/sections/checkout/checkout-basket.tsx +115 -0
  206. package/src/sections/checkout/checkout-delivery.tsx +121 -0
  207. package/src/sections/checkout/checkout-discount.tsx +61 -0
  208. package/src/sections/checkout/checkout-empty.tsx +28 -0
  209. package/src/sections/checkout/checkout-error.tsx +31 -0
  210. package/src/sections/checkout/checkout-forgot-success.tsx +41 -0
  211. package/src/sections/checkout/checkout-forgot.tsx +55 -0
  212. package/src/sections/checkout/checkout-info.tsx +142 -0
  213. package/src/sections/checkout/checkout-login.tsx +56 -0
  214. package/src/sections/checkout/checkout-payment.tsx +120 -0
  215. package/src/sections/checkout/checkout-register-success.tsx +41 -0
  216. package/src/sections/checkout/checkout-register.tsx +48 -0
  217. package/src/sections/checkout/checkout-review.tsx +243 -0
  218. package/src/sections/checkout/checkout-success.tsx +57 -0
  219. package/src/sections/checkout/checkout-user-info.tsx +204 -0
  220. package/src/sections/checkout/checkout-wizard.tsx +157 -0
  221. package/src/sections/colors/colors.tsx +40 -0
  222. package/src/sections/contact-card/contact-card.tsx +104 -0
  223. package/src/sections/contact-form/contact-form.tsx +107 -0
  224. package/src/sections/contact-hero/contact-hero.tsx +54 -0
  225. package/src/sections/footer/footer.tsx +98 -0
  226. package/src/sections/header/header-card.tsx +36 -0
  227. package/src/sections/header/header-submenu.tsx +117 -0
  228. package/src/sections/header/header.tsx +306 -0
  229. package/src/sections/hero/hero.tsx +41 -0
  230. package/src/sections/icons/icons.tsx +74 -0
  231. package/src/sections/index.ts +70 -0
  232. package/src/sections/magazine-related/magazine-related.tsx +88 -0
  233. package/src/sections/magazine-search/magazine-search-card.tsx +46 -0
  234. package/src/sections/magazine-search/magazine-search-filters-modal.tsx +22 -0
  235. package/src/sections/magazine-search/magazine-search-filters.tsx +48 -0
  236. package/src/sections/magazine-search/magazine-search-recap.tsx +55 -0
  237. package/src/sections/magazine-search/magazine-search.tsx +151 -0
  238. package/src/sections/markets-and-languages/markets-and-languages-drawer.tsx +58 -0
  239. package/src/sections/order/order-address.tsx +22 -0
  240. package/src/sections/order/order-item.tsx +55 -0
  241. package/src/sections/order/order-register.tsx +105 -0
  242. package/src/sections/order/order-summary-item.tsx +38 -0
  243. package/src/sections/order/order-summary.tsx +72 -0
  244. package/src/sections/product-overview/product-overview-gallery.tsx +48 -0
  245. package/src/sections/product-overview/product-overview.tsx +112 -0
  246. package/src/sections/products-detail-download/products-detail-download.tsx +49 -0
  247. package/src/sections/products-detail-related/products-detail-related-card.tsx +59 -0
  248. package/src/sections/products-detail-related/products-detail-related.tsx +43 -0
  249. package/src/sections/products-detail-size-color/products-detail-size-color.tsx +57 -0
  250. package/src/sections/products-hero/products-hero-card.tsx +26 -0
  251. package/src/sections/products-hero/products-hero.tsx +54 -0
  252. package/src/sections/products-proposition/products-proposition-card.tsx +38 -0
  253. package/src/sections/products-proposition/products-proposition.tsx +27 -0
  254. package/src/sections/products-related/products-related-card.tsx +56 -0
  255. package/src/sections/products-related/products-related.tsx +30 -0
  256. package/src/sections/products-search/products-search-card.tsx +60 -0
  257. package/src/sections/products-search/products-search-filters-modal.tsx +22 -0
  258. package/src/sections/products-search/products-search-filters.tsx +92 -0
  259. package/src/sections/products-search/products-search-recap.tsx +55 -0
  260. package/src/sections/products-search/products-search.tsx +162 -0
  261. package/src/sections/proposition/proposition.tsx +32 -0
  262. package/src/sections/reserved_area/reserved_area.tsx +51 -0
  263. package/src/sections/reserved_area_menu/reserved_area_menu.tsx +67 -0
  264. package/src/sections/shop-category-hero/shop-category-hero.tsx +71 -0
  265. package/src/sections/shop-detail-related/shop-detail-related-card.tsx +59 -0
  266. package/src/sections/shop-detail-related/shop-detail-related.tsx +40 -0
  267. package/src/sections/shop-hero/shop-hero-card.tsx +26 -0
  268. package/src/sections/shop-hero/shop-hero.tsx +53 -0
  269. package/src/sections/shop-incentive/shop-incentive.tsx +46 -0
  270. package/src/sections/shop-items-proposition/shop-items-proposition-card.tsx +38 -0
  271. package/src/sections/shop-items-proposition/shop-items-proposition.tsx +28 -0
  272. package/src/sections/shop-search/shop-search-card.tsx +60 -0
  273. package/src/sections/shop-search/shop-search-filters-modal.tsx +22 -0
  274. package/src/sections/shop-search/shop-search-filters.tsx +53 -0
  275. package/src/sections/shop-search/shop-search-recap.tsx +45 -0
  276. package/src/sections/shop-search/shop-search.tsx +270 -0
  277. package/src/sections/split/split.tsx +60 -0
  278. package/src/sections/store-locator/store-locator-all.json +7433 -0
  279. package/src/sections/store-locator/store-locator-dots.tsx +1315 -0
  280. package/src/sections/store-locator/store-locator-features.json +26 -0
  281. package/src/sections/store-locator/store-locator-head._tsx +39 -0
  282. package/src/sections/store-locator/store-locator-search.tsx +417 -0
  283. package/src/sections/swiper-hero/swiper-hero.tsx +80 -0
  284. package/src/sections/test-framer-carousel/test-framer-carousel.tsx +56 -0
  285. package/src/sections/typography/typography.tsx +54 -0
  286. package/src/theme/global.style.ts +34 -0
  287. package/src/theme/global.vars.scss +246 -0
  288. package/src/theme/global.vars.ts +129 -0
  289. package/src/theme/index.ts +14 -0
  290. package/src/theme/styled.d.ts +13 -0
  291. package/src/theme/styles/_base.ts +15 -0
  292. package/src/theme/styles/_debug.ts +8 -0
  293. package/src/theme/styles/_print.ts +16 -0
  294. package/src/theme/styles/_reset.ts +234 -0
  295. package/src/theme/styles/_typography.ts +27 -0
  296. package/src/theme/styles/mixins/_scrollbar.scss +36 -0
  297. package/src/theme/styles/mixins/_scrollbar.ts +54 -0
  298. package/src/theme/theme.json +191 -0
  299. package/src/theme/types.ts +72 -0
  300. package/src/useVariants/useVariants.tsx +35 -0
  301. package/src/utils/index.ts +5 -0
package/CHANGELOG.md CHANGED
@@ -1,44 +1,50 @@
1
- # @websolutespa/bom-mixer-ui
2
-
3
- ## 0.4.0
4
-
5
- ### Minor Changes
6
-
7
- - Added: splat routes.
8
- - Added: variants.
9
-
10
- ## 0.3.0
11
-
12
- ### Minor Changes
13
-
14
- - Added: @websolutespa/bom-core.
15
-
16
- ## 0.2.0
17
-
18
- ### Minor Changes
19
-
20
- - Modified: ITheme, LazyLoader.
21
-
22
- ## 0.1.0
23
-
24
- ### Minor Changes
25
-
26
- - mock refactor.
27
-
28
- ## 0.0.3
29
-
30
- ### Patch Changes
31
-
32
- - Modified: assets.
33
-
34
- ## 0.0.2
35
-
36
- ### Patch Changes
37
-
38
- - Modified: assets.
39
-
40
- ## 0.0.1
41
-
42
- ### Patch Changes
43
-
44
- - Added: first release.
1
+ # @websolutespa/bom-mixer-ui
2
+
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Added: source files.
8
+
9
+ ## 0.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Added: splat routes.
14
+ - Added: variants.
15
+
16
+ ## 0.3.0
17
+
18
+ ### Minor Changes
19
+
20
+ - Added: @websolutespa/bom-core.
21
+
22
+ ## 0.2.0
23
+
24
+ ### Minor Changes
25
+
26
+ - Modified: ITheme, LazyLoader.
27
+
28
+ ## 0.1.0
29
+
30
+ ### Minor Changes
31
+
32
+ - mock refactor.
33
+
34
+ ## 0.0.3
35
+
36
+ ### Patch Changes
37
+
38
+ - Modified: assets.
39
+
40
+ ## 0.0.2
41
+
42
+ ### Patch Changes
43
+
44
+ - Modified: assets.
45
+
46
+ ## 0.0.1
47
+
48
+ ### Patch Changes
49
+
50
+ - Added: first release.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-mixer-ui",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Mixer UI module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -69,7 +69,7 @@
69
69
  "sideEffects": false,
70
70
  "prepack": {
71
71
  "types": "./dist/types/index.d.ts",
72
- "main": "./dist/cjs/index.js",
72
+ "main": "./dist/esm/index.js",
73
73
  "module": "./dist/esm/index.js",
74
74
  "source": "./src/index.ts"
75
75
  },
@@ -78,7 +78,7 @@
78
78
  "main": "./src/index.ts"
79
79
  },
80
80
  "types": "./dist/types/index.d.ts",
81
- "main": "./dist/cjs/index.js",
81
+ "main": "./dist/esm/index.js",
82
82
  "module": "./dist/esm/index.js",
83
83
  "source": "./src/index.ts"
84
84
  }
@@ -0,0 +1,8 @@
1
+ import '@testing-library/jest-dom';
2
+
3
+ describe('Example', () => {
4
+ it('passes', async () => {
5
+ const value = 'test';
6
+ expect(value).toEqual(value);
7
+ });
8
+ });
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+
3
+ const defaultContext = {
4
+ values: [],
5
+ };
6
+
7
+ export type AccordionConfig = {
8
+ values: Array<number>;
9
+ updateValues?: (currentIndex: number, nextState: boolean) => unknown;
10
+ };
11
+
12
+ export const AccordionContext = React.createContext<AccordionConfig>(defaultContext);
13
+
14
+ export const useAccordionContext = (): AccordionConfig => React.useContext<AccordionConfig>(AccordionContext);
@@ -0,0 +1,82 @@
1
+ import { getClassNames } from '@websolutespa/bom-core';
2
+ import { useCurrentState } from '@websolutespa/bom-mixer-hooks';
3
+ import React, { useMemo } from 'react';
4
+ import styled from 'styled-components';
5
+ import { setChildrenIndex } from '../popover/popover-collections';
6
+ import { Accordion } from './accordion';
7
+ import { AccordionConfig, AccordionContext } from './accordion-context';
8
+
9
+ type Props = {
10
+ accordion?: boolean;
11
+ className?: string;
12
+ };
13
+
14
+ type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>;
15
+
16
+ export type AccordionGroupProps = Props & NativeAttrs;
17
+
18
+ const StyledAccordionGroup = styled.div`
19
+ /*
20
+ width: auto;
21
+ height: auto;
22
+ padding: 0 0.6rem;
23
+ margin: 0;
24
+ */
25
+
26
+ /*
27
+ & > :global(div + div) {
28
+ border-top: none;
29
+ }
30
+ */
31
+ `;
32
+
33
+ export const AccordionGroup: React.FC<React.PropsWithChildren<AccordionGroupProps>> = ({
34
+ accordion = true,
35
+ className = '',
36
+ children,
37
+ ...props
38
+ }: React.PropsWithChildren<AccordionGroupProps>) => {
39
+
40
+ const [state, setState, stateRef] = useCurrentState<Array<number>>([]);
41
+
42
+ const updateValues = (index: number, visible: boolean) => {
43
+ const hasChild = stateRef.current.find(x => x === index);
44
+
45
+ if (accordion) {
46
+ if (visible) {
47
+ return setState([index]);
48
+ }
49
+ return setState([]);
50
+ }
51
+
52
+ if (visible) {
53
+ // In a few cases, the user will set Accordion Component state manually.
54
+ // If the user incorrectly set the state, Group component should ignore it.
55
+ /* istanbul ignore if */
56
+ if (hasChild) {
57
+ return;
58
+ }
59
+ return setState([...stateRef.current, index]);
60
+ }
61
+ setState(stateRef.current.filter(item => item !== index));
62
+ };
63
+
64
+ const initialValue = useMemo<AccordionConfig>(() => ({
65
+ values: state,
66
+ updateValues,
67
+ }), [state.join(',')]);
68
+
69
+ const indexedChildren = useMemo(() => setChildrenIndex(children, [Accordion]), [children]);
70
+
71
+ const classNames = getClassNames('accordion-group', className);
72
+
73
+ return (
74
+ <AccordionContext.Provider value={initialValue}>
75
+ <StyledAccordionGroup className={classNames} {...props}>
76
+ {indexedChildren}
77
+ </StyledAccordionGroup>
78
+ </AccordionContext.Provider>
79
+ );
80
+ };
81
+
82
+ AccordionGroup.displayName = 'AccordionGroup';
@@ -0,0 +1,37 @@
1
+ import { getClassNames } from '@websolutespa/bom-core';
2
+ import React, { SVGProps } from 'react';
3
+ import styled from 'styled-components';
4
+
5
+ type Props = {
6
+ active?: boolean;
7
+ };
8
+
9
+ const DownArrowSvg = (props: SVGProps<SVGSVGElement>) => (
10
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" {...props}>
11
+ <polyline points="6 9 12 15 18 9"></polyline>
12
+ </svg>
13
+ );
14
+
15
+ const DownArrow = styled(DownArrowSvg)`
16
+ flex-shrink: 0;
17
+ width: 1em;
18
+ height: 1em;
19
+ margin-left: -2.8rem;
20
+ align-self: center;
21
+ pointer-events: none;
22
+ transition: all 200ms ease;
23
+ transition: color 200ms ease, transform 200ms ease;
24
+
25
+ &.active {
26
+ transform: rotate(180deg);
27
+ }
28
+ `;
29
+
30
+ const AccordionIcon_: React.FC<Props> = ({ active }) => {
31
+ const classNames = getClassNames({ active });
32
+ return (
33
+ <DownArrow className={classNames} />
34
+ );
35
+ };
36
+
37
+ export const AccordionIcon = React.memo(AccordionIcon_);
@@ -0,0 +1,132 @@
1
+ import { consoleWarn, getClassNames, withSchema } from '@websolutespa/bom-core';
2
+ import { useCurrentState } from '@websolutespa/bom-mixer-hooks';
3
+ import React, { useEffect } from 'react';
4
+ import styled from 'styled-components';
5
+ import { Expand } from '../../components';
6
+ import { useAccordionContext } from './accordion-context';
7
+ import { AccordionGroup } from './accordion-group';
8
+ import { AccordionIcon } from './accordion-icon';
9
+
10
+ type Props = {
11
+ title: React.ReactNode | string
12
+ subtitle?: React.ReactNode | string
13
+ initialVisible?: boolean
14
+ shadow?: boolean
15
+ className?: string
16
+ index?: number
17
+ };
18
+
19
+ type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>;
20
+
21
+ export type AccordionProps = Props & NativeAttrs;
22
+
23
+ const StyledAccordion = styled.div`
24
+ width: auto;
25
+ height: auto;
26
+ margin: 0;
27
+ padding: 1.2rem 0;
28
+ border-top: 1px solid var(--color-neutral-200);
29
+ border-bottom: 1px solid var(--color-neutral-200);
30
+
31
+ .shadow {
32
+ box-shadow: var(--shadow-sm);
33
+ border: none;
34
+ border-radius: var(--border-radius);
35
+ padding: var(--grid-column-gap);
36
+ }
37
+
38
+ .view {
39
+ outline: none;
40
+ cursor: pointer;
41
+ }
42
+
43
+ .title {
44
+ display: flex;
45
+ justify-content: space-between;
46
+ align-items: center;
47
+ // color: var(--color-neutral-900);
48
+ user-select: none;
49
+ /*
50
+ & > span {
51
+ margin: 0;
52
+ font-size: 1.5em;
53
+ }
54
+ */
55
+ }
56
+
57
+ .subtitle {
58
+ // color: var(--color-primary-500);
59
+ margin: 0;
60
+
61
+ & > :global(*) {
62
+ margin: 0;
63
+ }
64
+ }
65
+
66
+ .content {
67
+ font-size: inherit;
68
+ line-height: 1.6em;
69
+ padding: 1.2rem 0;
70
+
71
+ & > :global(*:first-child) {
72
+ margin-top: 0;
73
+ }
74
+
75
+ & > :global(*:last-child) {
76
+ margin-bottom: 0;
77
+ }
78
+ }
79
+ `;
80
+
81
+ const AccordionBase: React.FC<React.PropsWithChildren<AccordionProps>> = ({
82
+ className = '',
83
+ shadow = false,
84
+ initialVisible = false,
85
+ index = -1,
86
+ children,
87
+ title,
88
+ subtitle,
89
+ ...props
90
+ }: React.PropsWithChildren<AccordionProps>) => {
91
+
92
+ const { values, updateValues } = useAccordionContext();
93
+
94
+ const [visible, setVisible, visibleRef] = useCurrentState<boolean>(initialVisible);
95
+
96
+ if (!title) {
97
+ consoleWarn('"title" is required.', 'Accordion');
98
+ }
99
+
100
+ useEffect(() => {
101
+ if (!values.length) {
102
+ return;
103
+ }
104
+ const visible = !!values.find(item => item === index);
105
+ setVisible(visible);
106
+ }, [values.join(',')]);
107
+
108
+ const onClick = () => {
109
+ const visible = !visibleRef.current;
110
+ setVisible(visible);
111
+ updateValues && updateValues(index, visible);
112
+ };
113
+
114
+ const classNames = getClassNames('accordion', { shadow }, className);
115
+
116
+ return (
117
+ <StyledAccordion className={classNames} {...props}>
118
+ <div className="view" role="button" onClick={onClick}>
119
+ <div className="title">
120
+ <span>{title}</span> <AccordionIcon active={visible} />
121
+ </div>
122
+ {subtitle && <div className="subtitle">{subtitle}</div>}
123
+ </div>
124
+ <Expand isExpanded={visible}>{children}</Expand>
125
+ </StyledAccordion>
126
+ );
127
+ };
128
+
129
+ export const Accordion = withSchema(AccordionBase, {
130
+ Group: AccordionGroup,
131
+ displayName: 'Accordion',
132
+ });
@@ -0,0 +1,156 @@
1
+ import { getClassNames } from '@websolutespa/bom-core';
2
+ import { useCurrentState } from '@websolutespa/bom-mixer-hooks';
3
+ import React, { MouseEvent } from 'react';
4
+ import styled from 'styled-components';
5
+ import { UIComponentProps } from '../../components/types';
6
+ import { Transition } from '../transition/transition';
7
+
8
+ type Props = {
9
+ visible?: boolean
10
+ width?: string
11
+ onClick?: (event: MouseEvent<HTMLElement>) => void
12
+ onContentClick?: (event: MouseEvent<HTMLElement>) => void
13
+ backdropClassName?: string
14
+ positionClassName?: string
15
+ layerClassName?: string
16
+ };
17
+
18
+ export type BackdropProps = UIComponentProps<Props>;
19
+
20
+ const defaultProps = {
21
+ onClick: () => { },
22
+ visible: false,
23
+ onContentClick: () => { },
24
+ backdropClassName: '',
25
+ positionClassName: '',
26
+ layerClassName: '',
27
+ };
28
+
29
+ const StyledBackdrop = styled.div`
30
+ box-sizing: border-box;
31
+ position: fixed;
32
+ top: 0;
33
+ left: 0;
34
+ right: 0;
35
+ bottom: 0;
36
+ overflow: auto;
37
+ z-index: 2000;
38
+ -webkit-overflow-scrolling: touch;
39
+ text-align: center;
40
+
41
+ &:before {
42
+ content: '';
43
+ display: inline-block;
44
+ width: 0;
45
+ height: 100%;
46
+ vertical-align: middle;
47
+ }
48
+
49
+ .position {
50
+ position: relative;
51
+ z-index: 2001;
52
+ outline: none;
53
+ max-width: 90%;
54
+ margin: 20px auto;
55
+ vertical-align: middle;
56
+ display: inline-block;
57
+ }
58
+
59
+ .position--full {
60
+ position: absolute;
61
+ display: flex;
62
+ flex-direction: column;
63
+ justify-content: center;
64
+ top: 0;
65
+ margin: 0;
66
+ max-width: 100%;
67
+ width: 100%;
68
+ height: 100%;
69
+ }
70
+
71
+ .layer {
72
+ position: fixed;
73
+ top: 0;
74
+ left: 0;
75
+ right: 0;
76
+ bottom: 0;
77
+ width: 100%;
78
+ height: 100%;
79
+ background-color: black;
80
+ transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
81
+ pointer-events: none;
82
+ z-index: 2000;
83
+ opacity: var(--backdrop-opacity);
84
+ }
85
+
86
+ &.backdrop-wrapper-enter .layer {
87
+ opacity: 0;
88
+ }
89
+
90
+ &.backdrop-wrapper-enter-active .layer {
91
+ opacity: var(--backdrop-opacity);
92
+ }
93
+
94
+ &.backdrop-wrapper-leave .layer {
95
+ opacity: var(--backdrop-opacity);
96
+ }
97
+
98
+ &.backdrop-wrapper-leave-active .layer {
99
+ opacity: 0;
100
+ }
101
+ `;
102
+
103
+ export const Backdrop: React.FC<React.PropsWithChildren<BackdropProps | any>> = React.memo(
104
+ ({
105
+ children,
106
+ onClick,
107
+ visible,
108
+ width,
109
+ onContentClick,
110
+ backdropClassName,
111
+ layerClassName,
112
+ positionClassName,
113
+ ...props
114
+ }: React.PropsWithChildren<BackdropProps> & typeof defaultProps) => { // !!! any
115
+
116
+ const [, setIsContentMouseDown, IsContentMouseDownRef] = useCurrentState(false);
117
+
118
+ const clickHandler = (event: MouseEvent<HTMLElement>) => {
119
+ if (IsContentMouseDownRef.current) {
120
+ return;
121
+ }
122
+ if (onClick) {
123
+ onClick(event);
124
+ }
125
+ };
126
+
127
+ const mouseUpHandler = () => {
128
+ if (!IsContentMouseDownRef.current) return;
129
+ const timer = setTimeout(() => {
130
+ setIsContentMouseDown(false);
131
+ clearTimeout(timer);
132
+ }, 0);
133
+ };
134
+
135
+ const backdropClassNames = getClassNames('backdrop', backdropClassName);
136
+ const layerClassNames = getClassNames('layer', layerClassName);
137
+ const positionClassNames = getClassNames('position', positionClassName);
138
+
139
+ // !!! todo backdrop position styled component with css responsive.
140
+
141
+ return (
142
+ <Transition name="backdrop-wrapper" visible={visible} clearTime={300}>
143
+ <StyledBackdrop className={backdropClassNames} onClick={clickHandler} onMouseUp={mouseUpHandler}
144
+ {...props}>
145
+ <div className={layerClassNames} />
146
+ <div className={positionClassNames} style={{ width }} onClick={onContentClick} onMouseDown={() => setIsContentMouseDown(true)}>
147
+ {children}
148
+ </div>
149
+ </StyledBackdrop>
150
+ </Transition>
151
+ );
152
+ },
153
+ );
154
+
155
+ Backdrop.defaultProps = defaultProps;
156
+ Backdrop.displayName = 'Backdrop';
@@ -0,0 +1,35 @@
1
+ import styled from 'styled-components';
2
+ import { UIStyledComponentProps } from '../../components/types';
3
+ import { getCssResponsive } from '../../components/utils';
4
+
5
+ type Props = {
6
+ };
7
+
8
+ export type BackgroundProps = UIStyledComponentProps<Props>;
9
+
10
+ export const Background = styled.div<BackgroundProps>`
11
+ position: absolute;
12
+ top: 0;
13
+ left: 0;
14
+ // background: var(--color-neutral-900);
15
+
16
+ &, & > * {
17
+ width: 100%;
18
+ height: 100%;
19
+ display: flex;
20
+ justify-content: center;
21
+ align-items: center;
22
+ }
23
+
24
+ & > * > * {
25
+ width: 100%;
26
+ height: 100%;
27
+ object-fit: cover;
28
+ }
29
+
30
+ ${props => getCssResponsive(props)}
31
+ `;
32
+
33
+ Background.defaultProps = {
34
+ className: 'background',
35
+ };
@@ -0,0 +1,21 @@
1
+ import styled from 'styled-components';
2
+ import { UIStyledComponentProps } from '../types';
3
+ import { getCssResponsive } from '../utils';
4
+
5
+ type Props = {
6
+ };
7
+
8
+ export type BadgeProps = UIStyledComponentProps<Props>;
9
+
10
+ export const Badge = styled.div<BadgeProps>`
11
+ display: inline-block;
12
+ line-height: 1;
13
+ padding: 0.3em 0.5em;
14
+ border-radius: 0.65em;
15
+ font-size: 0.7rem;
16
+ min-width: 1.2em;
17
+ text-align: center;
18
+ background: var(--color-neutral-700);
19
+ color: var(--color-neutral-100);
20
+ ${props => getCssResponsive(props)}
21
+ `;
@@ -0,0 +1,12 @@
1
+ import styled from 'styled-components';
2
+ import { UIStyledComponentProps } from '../../components/types';
3
+ import { getCssResponsive } from '../../components/utils';
4
+
5
+ type Props = {
6
+ };
7
+
8
+ export type BoxProps = UIStyledComponentProps<Props>;
9
+
10
+ export const Box = styled.div<BoxProps>`
11
+ ${props => getCssResponsive(props)}
12
+ `;
@@ -0,0 +1,53 @@
1
+ import { getClassNames } from '@websolutespa/bom-core';
2
+ import React, { ReactNode, useMemo } from 'react';
3
+ import { Link, LinkBaseProps } from '../link/link';
4
+ import { pickChild } from '../popover/popover-collections';
5
+ import { BreadcrumbSeparator } from './breadcrumb-separator';
6
+
7
+ type Props = {
8
+ href?: string
9
+ nextLink?: boolean
10
+ onClick?: (event: React.MouseEvent) => void
11
+ className?: string,
12
+ children?: ReactNode,
13
+ };
14
+
15
+ type NativeAttrs = Omit<React.AnchorHTMLAttributes<any>, keyof Props>;
16
+
17
+ type NativeLinkAttrs = Omit<NativeAttrs, keyof LinkBaseProps>;
18
+
19
+ export type BreadcrumbItemProps = Props & NativeLinkAttrs;
20
+
21
+ export const BreadcrumbItem = React.forwardRef<HTMLAnchorElement, React.PropsWithChildren<BreadcrumbItemProps>>(({
22
+ nextLink = false,
23
+ className = '',
24
+ href,
25
+ onClick,
26
+ children,
27
+ ...props
28
+ }: BreadcrumbItemProps, ref: React.Ref<HTMLAnchorElement>) => {
29
+ const isLink = useMemo(() => href !== undefined || nextLink, [href, nextLink]);
30
+ const [withoutSepChildren] = pickChild(children, BreadcrumbSeparator);
31
+
32
+ const clickHandler = (event: React.MouseEvent) => {
33
+ onClick && onClick(event);
34
+ };
35
+
36
+ const classNames = getClassNames('breadcrumb-item', className);
37
+
38
+ if (!isLink) {
39
+ return (
40
+ <span className={classNames} onClick={clickHandler}>
41
+ {withoutSepChildren}
42
+ </span>
43
+ );
44
+ }
45
+
46
+ return (
47
+ <Link className={classNames} href={href} onClick={clickHandler} ref={ref} {...props}>
48
+ {withoutSepChildren}
49
+ </Link>
50
+ );
51
+ });
52
+
53
+ BreadcrumbItem.displayName = 'BreadcrumbItem';