ublo-lib 1.35.18 → 1.36.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 (124) hide show
  1. package/es/common/components/date-picker/calendar.d.ts.map +1 -1
  2. package/es/common/components/date-picker/calendar.js +8 -12
  3. package/es/common/components/date-picker/calendar.module.css +8 -0
  4. package/es/common/components/date-picker/date-picker.module.css +0 -44
  5. package/es/common/components/scrolling-carousel/scrolling-carousel.module.css +4 -0
  6. package/es/lbm/components/instant-search/facet-switch.d.ts +8 -0
  7. package/es/lbm/components/instant-search/facet-switch.d.ts.map +1 -0
  8. package/es/lbm/components/instant-search/facet-switch.js +15 -0
  9. package/es/lbm/components/instant-search/facet-switch.module.css +19 -0
  10. package/es/lbm/components/instant-search/faqs.d.ts +12 -0
  11. package/es/lbm/components/instant-search/faqs.d.ts.map +1 -0
  12. package/es/lbm/components/instant-search/faqs.js +44 -0
  13. package/es/lbm/components/instant-search/faqs.module.css +102 -0
  14. package/es/lbm/components/instant-search/hooks/use-constant.d.ts +2 -0
  15. package/es/lbm/components/instant-search/hooks/use-constant.d.ts.map +1 -0
  16. package/es/lbm/components/instant-search/hooks/use-constant.js +8 -0
  17. package/es/lbm/components/instant-search/hooks/use-debounced-search.d.ts +11 -0
  18. package/es/lbm/components/instant-search/hooks/use-debounced-search.d.ts.map +1 -0
  19. package/es/lbm/components/instant-search/hooks/use-debounced-search.js +12 -0
  20. package/es/lbm/components/instant-search/hooks/use-search.d.ts +17 -0
  21. package/es/lbm/components/instant-search/hooks/use-search.d.ts.map +1 -0
  22. package/es/lbm/components/instant-search/hooks/use-search.js +10 -0
  23. package/es/lbm/components/instant-search/i18n.json +32 -0
  24. package/es/lbm/components/instant-search/index.d.ts +3 -0
  25. package/es/lbm/components/instant-search/index.d.ts.map +1 -0
  26. package/es/lbm/components/instant-search/index.js +2 -0
  27. package/es/lbm/components/instant-search/instant-search.d.ts +19 -0
  28. package/es/lbm/components/instant-search/instant-search.d.ts.map +1 -0
  29. package/es/lbm/components/instant-search/instant-search.js +64 -0
  30. package/es/lbm/components/instant-search/instant-search.module.css +8 -0
  31. package/es/lbm/components/instant-search/links.d.ts +12 -0
  32. package/es/lbm/components/instant-search/links.d.ts.map +1 -0
  33. package/es/lbm/components/instant-search/links.js +30 -0
  34. package/es/lbm/components/instant-search/links.module.css +96 -0
  35. package/es/lbm/components/instant-search/no-product.d.ts +6 -0
  36. package/es/lbm/components/instant-search/no-product.d.ts.map +1 -0
  37. package/es/lbm/components/instant-search/no-product.js +4 -0
  38. package/es/lbm/components/instant-search/products.d.ts +14 -0
  39. package/es/lbm/components/instant-search/products.d.ts.map +1 -0
  40. package/es/lbm/components/instant-search/products.js +47 -0
  41. package/es/lbm/components/instant-search/products.module.css +163 -0
  42. package/es/lbm/components/instant-search/results.d.ts +79 -0
  43. package/es/lbm/components/instant-search/results.d.ts.map +1 -0
  44. package/es/lbm/components/instant-search/results.js +34 -0
  45. package/es/lbm/components/instant-search/results.module.css +85 -0
  46. package/es/lbm/components/instant-search/search-input.d.ts +15 -0
  47. package/es/lbm/components/instant-search/search-input.d.ts.map +1 -0
  48. package/es/lbm/components/instant-search/search-input.js +56 -0
  49. package/es/lbm/components/instant-search/search-input.module.css +88 -0
  50. package/es/lbm/components/instant-search/services/api.d.ts +2 -0
  51. package/es/lbm/components/instant-search/services/api.d.ts.map +1 -0
  52. package/es/lbm/components/instant-search/services/api.js +22 -0
  53. package/es/lbm/components/instant-search/services/lumiplan-api.d.ts +9 -0
  54. package/es/lbm/components/instant-search/services/lumiplan-api.d.ts.map +1 -0
  55. package/es/lbm/components/instant-search/services/lumiplan-api.js +37 -0
  56. package/es/lbm/components/instant-search/services/messages.d.ts +2 -0
  57. package/es/lbm/components/instant-search/services/messages.d.ts.map +1 -0
  58. package/es/lbm/components/instant-search/services/messages.js +5 -0
  59. package/es/lbm/components/instant-search/services/utils.d.ts +4 -0
  60. package/es/lbm/components/instant-search/services/utils.d.ts.map +1 -0
  61. package/es/lbm/components/instant-search/services/utils.js +28 -0
  62. package/es/lbm/components/instant-search/widgets/access.d.ts +8 -0
  63. package/es/lbm/components/instant-search/widgets/access.d.ts.map +1 -0
  64. package/es/lbm/components/instant-search/widgets/access.js +29 -0
  65. package/es/lbm/components/instant-search/widgets/activity.d.ts +8 -0
  66. package/es/lbm/components/instant-search/widgets/activity.d.ts.map +1 -0
  67. package/es/lbm/components/instant-search/widgets/activity.js +74 -0
  68. package/es/lbm/components/instant-search/widgets/activity.module.css +6 -0
  69. package/es/lbm/components/instant-search/widgets/components/card.d.ts +11 -0
  70. package/es/lbm/components/instant-search/widgets/components/card.d.ts.map +1 -0
  71. package/es/lbm/components/instant-search/widgets/components/card.js +15 -0
  72. package/es/lbm/components/instant-search/widgets/components/card.module.css +60 -0
  73. package/es/lbm/components/instant-search/widgets/components/metric.d.ts +8 -0
  74. package/es/lbm/components/instant-search/widgets/components/metric.d.ts.map +1 -0
  75. package/es/lbm/components/instant-search/widgets/components/metric.js +6 -0
  76. package/es/lbm/components/instant-search/widgets/components/metric.module.css +12 -0
  77. package/es/lbm/components/instant-search/widgets/components/status-with-icon.d.ts +9 -0
  78. package/es/lbm/components/instant-search/widgets/components/status-with-icon.d.ts.map +1 -0
  79. package/es/lbm/components/instant-search/widgets/components/status-with-icon.js +5 -0
  80. package/es/lbm/components/instant-search/widgets/components/status-with-icon.module.css +12 -0
  81. package/es/lbm/components/instant-search/widgets/dawn-nights-openings.d.ts +9 -0
  82. package/es/lbm/components/instant-search/widgets/dawn-nights-openings.d.ts.map +1 -0
  83. package/es/lbm/components/instant-search/widgets/dawn-nights-openings.js +37 -0
  84. package/es/lbm/components/instant-search/widgets/dawn-nights-openings.module.css +33 -0
  85. package/es/lbm/components/instant-search/widgets/lift.d.ts +8 -0
  86. package/es/lbm/components/instant-search/widgets/lift.d.ts.map +1 -0
  87. package/es/lbm/components/instant-search/widgets/lift.js +52 -0
  88. package/es/lbm/components/instant-search/widgets/lift.module.css +6 -0
  89. package/es/lbm/components/instant-search/widgets/lifts.d.ts +8 -0
  90. package/es/lbm/components/instant-search/widgets/lifts.d.ts.map +1 -0
  91. package/es/lbm/components/instant-search/widgets/lifts.js +26 -0
  92. package/es/lbm/components/instant-search/widgets/msem-widget.d.ts +8 -0
  93. package/es/lbm/components/instant-search/widgets/msem-widget.d.ts.map +1 -0
  94. package/es/lbm/components/instant-search/widgets/msem-widget.js +31 -0
  95. package/es/lbm/components/instant-search/widgets/msem-widget.module.css +51 -0
  96. package/es/lbm/components/instant-search/widgets/openings.d.ts +8 -0
  97. package/es/lbm/components/instant-search/widgets/openings.d.ts.map +1 -0
  98. package/es/lbm/components/instant-search/widgets/openings.js +32 -0
  99. package/es/lbm/components/instant-search/widgets/slope.d.ts +8 -0
  100. package/es/lbm/components/instant-search/widgets/slope.d.ts.map +1 -0
  101. package/es/lbm/components/instant-search/widgets/slope.js +73 -0
  102. package/es/lbm/components/instant-search/widgets/slope.module.css +26 -0
  103. package/es/lbm/components/instant-search/widgets/slopes.d.ts +8 -0
  104. package/es/lbm/components/instant-search/widgets/slopes.d.ts.map +1 -0
  105. package/es/lbm/components/instant-search/widgets/slopes.js +26 -0
  106. package/es/lbm/components/instant-search/widgets/snow.d.ts +9 -0
  107. package/es/lbm/components/instant-search/widgets/snow.d.ts.map +1 -0
  108. package/es/lbm/components/instant-search/widgets/snow.js +25 -0
  109. package/es/lbm/components/instant-search/widgets/types.d.ts +27 -0
  110. package/es/lbm/components/instant-search/widgets/types.d.ts.map +1 -0
  111. package/es/lbm/components/instant-search/widgets/types.js +1 -0
  112. package/es/lbm/components/instant-search/widgets/weather.d.ts +9 -0
  113. package/es/lbm/components/instant-search/widgets/weather.d.ts.map +1 -0
  114. package/es/lbm/components/instant-search/widgets/weather.js +36 -0
  115. package/es/lbm/components/instant-search/widgets/weather.module.css +32 -0
  116. package/es/lbm/components/instant-search/widgets/webcam.d.ts +8 -0
  117. package/es/lbm/components/instant-search/widgets/webcam.d.ts.map +1 -0
  118. package/es/lbm/components/instant-search/widgets/webcam.js +9 -0
  119. package/es/lbm/components/instant-search/widgets/webcam.module.css +13 -0
  120. package/es/lbm/components/instant-search/widgets.d.ts +11 -0
  121. package/es/lbm/components/instant-search/widgets.d.ts.map +1 -0
  122. package/es/lbm/components/instant-search/widgets.js +68 -0
  123. package/es/lbm/components/instant-search/widgets.module.css +14 -0
  124. package/package.json +3 -3
@@ -0,0 +1,96 @@
1
+ .linksSection {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 6px;
5
+ }
6
+
7
+ .linksTitle {
8
+ position: sticky;
9
+ top: 16px;
10
+ font-size: 17px;
11
+ font-weight: 700;
12
+ padding: 3px 8px;
13
+ background-color: var(--ds-grey-200, #efefef);
14
+ border-radius: var(--ds-radius-100, 6px);
15
+ z-index: 1;
16
+ }
17
+
18
+ @media (min-width: 730px) {
19
+ .linksTitle {
20
+ top: 0;
21
+ }
22
+ }
23
+
24
+ .links {
25
+ display: flex;
26
+ flex-direction: column;
27
+ gap: 6px;
28
+ }
29
+
30
+ .loaderContainer {
31
+ position: relative;
32
+ width: 100%;
33
+ height: 44px;
34
+ border-radius: var(--ds-radius-100, 6px);
35
+ }
36
+
37
+ .link {
38
+ position: relative;
39
+ display: flex;
40
+ gap: 10px;
41
+ padding: 6px;
42
+ color: var(--ds-grey-500, #484848);
43
+ border-radius: var(--ds-radius-100, 6px);
44
+ transition: background-color 160ms
45
+ var(--ds-transition-easing, cubic-bezier(0.4, 0, 0.2, 1));
46
+ }
47
+
48
+ .link:is(:hover, :focus) {
49
+ background-color: var(--ds-grey-100, #f5f5f5);
50
+ }
51
+
52
+ .linkIcon {
53
+ flex: 0 0 16px;
54
+ width: 16px;
55
+ height: 16px;
56
+ margin-top: 2px;
57
+ fill: currentColor;
58
+ }
59
+
60
+ .linkContent {
61
+ flex: 1 1 auto;
62
+ }
63
+
64
+ .linkTitle {
65
+ font-size: 15px;
66
+ }
67
+
68
+ .link mark {
69
+ position: relative;
70
+ display: inline-block;
71
+ font-weight: 700;
72
+ color: var(--ds-secondary, var(--ds-blue-400, #4177f6));
73
+ background-color: transparent;
74
+ }
75
+
76
+ .link mark::before {
77
+ content: "";
78
+ position: absolute;
79
+ top: 0;
80
+ left: 0;
81
+ width: 100%;
82
+ height: 100%;
83
+ background-color: var(--ds-secondary, var(--ds-blue-400, #4177f6));
84
+ border-radius: calc(var(--ds-radius-100, 6px) / 3);
85
+ opacity: 0.15;
86
+ }
87
+
88
+ .linkParent {
89
+ text-transform: uppercase;
90
+ font-size: 10px;
91
+ }
92
+
93
+ .linkText {
94
+ font-size: 12px;
95
+ white-space: pre-wrap;
96
+ }
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ className?: string;
3
+ };
4
+ export default function NoProduct({ className }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export {};
6
+ //# sourceMappingURL=no-product.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-product.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/instant-search/no-product.tsx"],"names":[],"mappings":"AAEA,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,KAAK,2CA2FrD"}
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export default function NoProduct({ className }) {
3
+ return (_jsxs("svg", { width: "200", height: "200", viewBox: "0 0 200 200", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: [_jsx("path", { d: "M100.5 184.3a85.8 85.8 0 1 0 0-171.5 85.8 85.8 0 0 0 0 171.5Z", fill: "#EDEDED" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M100.5 11a87.5 87.5 0 1 0 0 175 87.5 87.5 0 0 0 0-175Zm0 3.5a84 84 0 1 1 0 168 84 84 0 0 1 0-168Z", fill: "#D7D7D7" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M161.4 61.5c1 0 1.8-.8 1.8-1.8V46.1a4.7 4.7 0 0 0-4.7-4.7H26a4.7 4.7 0 0 0-4.7 4.7v34.3c0 1 .8 1.8 1.8 1.8h61.5c.4 0 .8-.1 1.1-.4l26.4-20.3h49.3Z", fill: "#D7D7D7" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M138.4 59.7h-25.5L84.6 80.4H45.3V25.7a3 3 0 0 1 2.9-2.9h64.7l25.5 27.5v9.4Z", fill: "#fff" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M112.9 21H48.2a4.7 4.7 0 0 0-4.7 4.7v54.7c0 1 .8 1.8 1.8 1.8h39.3c.4 0 .8-.1 1-.3l27.8-20.4h25c1 0 1.8-.8 1.8-1.8V50l-.1-.3-.2-.3v-.2l-.2-.1L114 21.6l-.1-.2-.4-.2h-.1l-.3-.1H113Zm-1.8 3.6H48.2c-.6 0-1.2.5-1.2 1.1v53h37l27.8-20.4c.3-.2.7-.3 1-.3h23.8v-6H113c-1 0-1.8-.8-1.8-1.7V24.6Zm-51 44.8h25.7a1.8 1.8 0 0 0 0-3.5H60.2a1.8 1.8 0 0 0 0 3.5Zm0-16h22a1.8 1.8 0 0 0 0-3.5H60a1.8 1.8 0 0 0 0 3.5Zm0-8.4h37.4a1.8 1.8 0 0 0 0-3.6H60.2a1.8 1.8 0 0 0 0 3.6Z", fill: "#D7D7D7" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.8 84a3 3 0 0 1 2.9-3.6h76.5a3 3 0 0 0 1.7-.5l26.4-19.6a3 3 0 0 1 1.8-.6h64.7a3 3 0 0 1 3 3.5c-2.9 16-14.4 83-16.8 96.7a3 3 0 0 1-2.9 2.4H25.4a3 3 0 0 1-2.9-2.2L4.8 84Z", fill: "#EDEDED" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "m3.1 84.4 17.7 76a4.7 4.7 0 0 0 4.6 3.7h136.7c2.3 0 4.2-1.7 4.6-4l16.7-96.6a4.7 4.7 0 0 0-4.6-5.5h-64.7c-1 0-2 .3-2.8.9a1130716.6 1130716.6 0 0 1-27.1 19.8H7.7a4.7 4.7 0 0 0-4.6 5.7Zm3.5-.8a1.2 1.2 0 0 1 1.1-1.4h76.5c1 0 2-.3 2.8-1a724489.6 724489.6 0 0 1 27-19.7h64.8a1.2 1.2 0 0 1 1.2 1.4l-16.7 96.7c-.1.6-.6 1-1.2 1H25.4c-.5 0-1-.4-1.1-1l-17.7-76Z", fill: "#D7D7D7" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M159.7 161a36.5 36.5 0 0 1-46.5-4 36.6 36.6 0 0 1 .4-51.8 36.6 36.6 0 0 1 51.7-.4 36.5 36.5 0 0 1 4 46.5l25 24.9c2.6 2.6 2.6 7 0 9.6a6.8 6.8 0 0 1-9.7 0l-25-24.9Z", fill: "#fff" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "m159.5 163.2 23.8 23.9a8.6 8.6 0 0 0 12.2 0 8.6 8.6 0 0 0 0-12.2L171.6 151a38.2 38.2 0 0 0-5-47.4 38.3 38.3 0 0 0-54.2.4 38.3 38.3 0 0 0-.4 54.2 38.2 38.2 0 0 0 47.5 5Zm1.4-3.5c-.6-.6-1.5-.7-2.2-.2a34.7 34.7 0 0 1-44.2-3.8 34.8 34.8 0 0 1 .4-49.2 34.8 34.8 0 0 1 49.2-.4c12 11.9 13.1 30.5 3.8 44.2-.5.7-.4 1.6.2 2.2l24.9 25c2 1.9 2 5.1 0 7a5 5 0 0 1-7.2 0L161 159.8Z", fill: "#D7D7D7" }), _jsx("path", { d: "M163.5 130.8a24.4 24.4 0 0 0-24.2-24.6c-13.4 0-24.3 11-24.3 24.6a24.4 24.4 0 0 0 24.3 24.6c13.3 0 24.2-11 24.2-24.6Z", fill: "#EDEDED" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M113.3 130.8a26.2 26.2 0 0 0 26 26.4c14.3 0 26-11.8 26-26.4a26.2 26.2 0 0 0-26-26.4c-14.4 0-26 11.8-26 26.4Zm3.5 0c0-12.6 10-22.8 22.5-22.8a22.7 22.7 0 0 1 22.4 22.8c0 12.6-10 22.9-22.4 22.9a22.7 22.7 0 0 1-22.5-22.9Z", fill: "#D7D7D7" }), _jsx("path", { opacity: ".7", fillRule: "evenodd", clipRule: "evenodd", d: "M117 121c.7-1.4 13.9 1.6 22.3 9.9 8.1 8 11.4 21.4 10.2 22-9.1 4.3-20.2 2.7-27.6-4.7-7.4-7.3-9-18.3-4.8-27.3Z", fill: "#fff" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M120.9 112.5a26.2 26.2 0 0 0-.3 37 26.2 26.2 0 0 0 37-.2 26.2 26.2 0 0 0 .3-37 26.2 26.2 0 0 0-37 .2Zm2.5 2.5c9-9 23.3-9 32-.3a22.7 22.7 0 0 1-.2 32c-9 9-23.3 9.1-32 .3a22.7 22.7 0 0 1 .2-32Z", fill: "#D7D7D7" }), _jsx("path", { d: "M140.2 142.1c1.4 0 2.4 1 2.4 2.4 0 1.3-1 2.3-2.4 2.3-1.3 0-2.3-1-2.3-2.3 0-1.3 1-2.4 2.3-2.4Zm.1-20.5V117a9.5 9.5 0 0 0-9.4 6.8v.2l4.5 1v.1l-4.6-1.1c-.3 1.2.5 2.5 1.8 2.8 1.2.3 2.5-.5 2.8-1.7l.2-.5.7-1.2c.7-.8 1.8-1.7 4-1.7Zm9.4 5.1a9.3 9.3 0 0 0-9.4-9.8v4.7c.6 0 1.8.2 2.9 1 .9.6 1.8 1.7 1.8 4.1 0 .5-.2 1-.7 1.6-.5.6-1.3 1.2-2.2 1.7a18.4 18.4 0 0 1-3.4 1.5h-.3c-1.2.4-2 1.8-1.6 3 .4 1.3 1.7 2 3 1.6l-.7-2.2-.4-1.4-.2-.6V131.6l.6 2.3.6 2.2h.2a11.6 11.6 0 0 0 1.3-.5c.9-.3 2-.8 3.2-1.5 1.2-.6 2.4-1.5 3.4-2.7a7 7 0 0 0 2-4.7Z", fill: "#D7D7D7" })] }));
4
+ }
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import type { Hit } from "./results";
3
+ type Props = {
4
+ lang: string;
5
+ products: Hit[];
6
+ loading: boolean;
7
+ sendPlausibleGoal: (path: string) => void;
8
+ otherResultsRef: React.RefObject<HTMLDivElement>;
9
+ isOtherResultsEmpty: boolean;
10
+ faqsMaximized: boolean;
11
+ };
12
+ export default function Products({ lang, products, loading, sendPlausibleGoal, otherResultsRef, isOtherResultsEmpty, faqsMaximized, }: Props): import("react/jsx-runtime").JSX.Element;
13
+ export {};
14
+ //# sourceMappingURL=products.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/instant-search/products.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAGrC,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,GAAG,EAAE,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IAEjB,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACjD,mBAAmB,EAAE,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAIF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,aAAa,GACd,EAAE,KAAK,2CAkIP"}
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from "classnames";
3
+ import Image from "next/image";
4
+ import Link from "ublo/link";
5
+ import Loader from "dt-design-system/es/loader";
6
+ import Button from "dt-design-system/es/button";
7
+ import * as Icons from "dt-design-system/es/icons";
8
+ import * as Ripple from "dt-design-system/es/ripple";
9
+ import * as Utils from "./services/utils";
10
+ import message from "./services/messages";
11
+ import NoProduct from "./no-product";
12
+ import css from "./products.module.css";
13
+ const PLACEHOLDERS = [...new Array(5)];
14
+ export default function Products({ lang, products, loading, sendPlausibleGoal, otherResultsRef, isOtherResultsEmpty, faqsMaximized, }) {
15
+ if (faqsMaximized)
16
+ return null;
17
+ const noProduct = !loading && !products.length;
18
+ const classes = classNames(css.products, {
19
+ [css.empty]: noProduct,
20
+ });
21
+ const scrollToOtherResults = () => {
22
+ if (otherResultsRef.current) {
23
+ otherResultsRef.current.scrollIntoView({
24
+ behavior: "smooth",
25
+ block: "start",
26
+ });
27
+ }
28
+ };
29
+ const createRipple = (e) => {
30
+ Ripple.create(e);
31
+ };
32
+ return (_jsxs("div", { className: classes, children: [noProduct && (_jsxs("div", { className: css.noProduct, children: [_jsx(NoProduct, { className: css.noProductIcon }), message(lang, "noProducts"), "..."] })), loading &&
33
+ PLACEHOLDERS.map((_, i) => {
34
+ return (_jsx("div", { className: css.loaderContainer, children: _jsx(Loader, { className: css.loader, variant: "overlay" }) }, i));
35
+ }), !loading &&
36
+ products.map((product) => {
37
+ const { id, pageTitle, title, parentTitle, image = "", imagePlaceholder, price, time, text, path, target, } = product.document;
38
+ const decodedPath = decodeURIComponent(target || path);
39
+ const productPageTitle = Utils.getHighlight("pageTitle", product.highlight) || pageTitle;
40
+ const productTitle = Utils.getHighlight("title", product.highlight) || title;
41
+ const productTime = Utils.getHighlight("time", product.highlight) || time;
42
+ const productText = Utils.getHighlight("text", product.highlight) || text;
43
+ const showPrice = Boolean(price?.trim().length > 0);
44
+ const imagePlaceholderStrategy = imagePlaceholder ? "blur" : "empty";
45
+ return (_jsxs(Link, { className: css.product, href: decodedPath, onClick: sendPlausibleGoal(decodedPath), onMouseDown: createRipple, children: [_jsx(Image, { className: css.productImage, src: image, alt: title, width: 220, height: 180, placeholder: imagePlaceholderStrategy, blurDataURL: imagePlaceholder }), _jsxs("div", { className: css.productContent, children: [parentTitle && (_jsx("div", { className: css.productParent, dangerouslySetInnerHTML: { __html: parentTitle } })), _jsx("div", { className: css.productPageTitle, dangerouslySetInnerHTML: { __html: productPageTitle } }), _jsx("div", { className: css.productTitle, dangerouslySetInnerHTML: { __html: productTitle } }), _jsx("div", { className: css.productTime, dangerouslySetInnerHTML: { __html: productTime } }), _jsx("div", { className: css.productText, dangerouslySetInnerHTML: { __html: productText } }), showPrice && (_jsx("div", { className: css.productPrice, dangerouslySetInnerHTML: { __html: price } }))] })] }, id));
46
+ }), !noProduct && !isOtherResultsEmpty && (_jsx("div", { className: css.otherProducts, children: _jsxs(Button, { className: css.otherProductsButton, onClick: scrollToOtherResults, children: [message(lang, "showOtherResults"), _jsx(Icons.ArrowDown, {})] }) }))] }));
47
+ }
@@ -0,0 +1,163 @@
1
+ .products {
2
+ flex: 1 1 100%;
3
+ display: grid;
4
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
5
+ align-content: flex-start;
6
+ gap: 16px;
7
+ padding: 12px;
8
+ }
9
+
10
+ div + .products {
11
+ padding-top: 4px;
12
+ }
13
+
14
+ .products.empty {
15
+ position: absolute;
16
+ top: 0;
17
+ left: 0;
18
+ width: 100%;
19
+ height: 100%;
20
+ align-content: center;
21
+ padding-bottom: 120px;
22
+ }
23
+
24
+ .noProduct {
25
+ grid-column: 1 / -1;
26
+ display: flex;
27
+ flex-direction: column;
28
+ align-items: center;
29
+ justify-content: center;
30
+ gap: 18px;
31
+ color: var(--ds-grey-400, #9d9d9d);
32
+ text-align: center;
33
+ font-size: 17px;
34
+ }
35
+
36
+ .noProductIcon {
37
+ flex: 0 0 140px;
38
+ width: 140px;
39
+ height: 140px;
40
+ }
41
+
42
+ .loaderContainer {
43
+ position: relative;
44
+ width: 100%;
45
+ height: 290px;
46
+ border-radius: var(--ds-input-radius, var(--ds-radius-200, 8px));
47
+ }
48
+
49
+ .loader {
50
+ background: linear-gradient(
51
+ -45deg,
52
+ var(--ds-grey-300, #d4d4d4),
53
+ var(--ds-grey-400, #d2d2d2),
54
+ var(--ds-grey-200, #efefef),
55
+ var(--ds-grey-400, #d2d2d2)
56
+ );
57
+ background-size: 400% 400%;
58
+ background-position: 0% 50%;
59
+ }
60
+
61
+ .product {
62
+ position: relative;
63
+ display: flex;
64
+ flex-direction: column;
65
+ color: var(--ds-grey-500, #484848);
66
+ background-color: var(--ds-grey-000, #fff);
67
+ border-radius: var(--ds-input-radius, var(--ds-radius-200, 8px));
68
+ border: var(--ds-input-border, 1px solid var(--ds-grey-300, #d7d7d7));
69
+ }
70
+
71
+ .product mark {
72
+ position: relative;
73
+ display: inline-block;
74
+ font-weight: 700;
75
+ color: var(--ds-secondary, var(--ds-blue-400, #4177f6));
76
+ background-color: transparent;
77
+ }
78
+
79
+ .product mark::before {
80
+ content: "";
81
+ position: absolute;
82
+ top: 0;
83
+ left: 0;
84
+ width: 100%;
85
+ height: 100%;
86
+ background-color: var(--ds-secondary, var(--ds-blue-400, #4177f6));
87
+ border-radius: calc(var(--ds-radius-100, 6px) / 3);
88
+ opacity: 0.15;
89
+ }
90
+
91
+ .productImage {
92
+ width: 100%;
93
+ height: 180px;
94
+ object-fit: cover;
95
+ border-radius: var(--ds-input-radius, var(--ds-radius-200, 8px))
96
+ var(--ds-input-radius, var(--ds-radius-200, 8px)) 0 0;
97
+ }
98
+
99
+ .productContent {
100
+ flex: 1 1 auto;
101
+ display: flex;
102
+ flex-direction: column;
103
+ gap: 6px;
104
+ padding: 8px;
105
+ }
106
+
107
+ .productParent {
108
+ text-transform: uppercase;
109
+ font-size: 10px;
110
+ }
111
+
112
+ .productPageTitle {
113
+ font-weight: 700;
114
+ font-size: 14px;
115
+ line-height: 1;
116
+ }
117
+
118
+ .productTitle {
119
+ font-weight: 700;
120
+ font-size: 13px;
121
+ line-height: 1;
122
+ }
123
+
124
+ .productText {
125
+ font-size: 11px;
126
+ }
127
+
128
+ .productPrice {
129
+ position: absolute;
130
+ top: 6px;
131
+ left: 6px;
132
+ max-width: calc(100% - 12px);
133
+ padding: 4px;
134
+ color: var(--ds-grey-100, #f5f5f5);
135
+ background-color: var(--ds-secondary, var(--ds-blue-400, #4177f6));
136
+ font-weight: 700;
137
+ font-size: 12px;
138
+ border-radius: var(--ds-radius-100, 6px);
139
+ }
140
+
141
+ .productPrice:emtpy {
142
+ display: none;
143
+ }
144
+
145
+ .productTime {
146
+ font-size: 8px;
147
+ text-transform: uppercase;
148
+ font-weight: 700;
149
+ }
150
+
151
+ .otherProducts {
152
+ grid-column: 1 / -1;
153
+ position: sticky;
154
+ bottom: 16px;
155
+ display: flex;
156
+ justify-content: center;
157
+ }
158
+
159
+ @media (min-width: 730px) {
160
+ .otherProducts {
161
+ display: none;
162
+ }
163
+ }
@@ -0,0 +1,79 @@
1
+ type Document = {
2
+ id: string;
3
+ image?: string;
4
+ imagePlaceholder?: string;
5
+ imageAlt?: string;
6
+ lang: string;
7
+ pageTitle?: string;
8
+ parentTitle?: string;
9
+ path: string;
10
+ price?: string;
11
+ site: string;
12
+ text?: string;
13
+ time?: string;
14
+ title: string;
15
+ type: "page" | "product" | "information" | "faq" | "document" | "widget" | "msem-widget" | "lodging";
16
+ weeks?: number[];
17
+ shortTitle?: string;
18
+ seoKeywords?: string[];
19
+ seoTitle?: string;
20
+ target?: string;
21
+ };
22
+ type Text = {
23
+ matched_tokens: string[];
24
+ snippet: string;
25
+ };
26
+ export type PurpleHighlight = {
27
+ text?: Text;
28
+ title?: Text;
29
+ };
30
+ type HighlightElement = {
31
+ field: string;
32
+ matched_tokens: string[];
33
+ snippet: string;
34
+ };
35
+ type TextMatchInfo = {
36
+ best_field_score: string;
37
+ best_field_weight: number;
38
+ fields_matched: number;
39
+ score: string;
40
+ tokens_matched: number;
41
+ };
42
+ export type Hit = {
43
+ document: Document;
44
+ highlight: PurpleHighlight;
45
+ highlights: HighlightElement[];
46
+ text_match: number;
47
+ text_match_info: TextMatchInfo;
48
+ };
49
+ type GroupedHit = {
50
+ group_key: string[];
51
+ hits: Hit[];
52
+ };
53
+ type RequestParams = {
54
+ collection_name: string;
55
+ per_page: number;
56
+ q: string;
57
+ };
58
+ type Props = {
59
+ lang: string;
60
+ text: string;
61
+ facet: number;
62
+ setFacet: (facet: number) => void;
63
+ results: {
64
+ facet_counts?: any[];
65
+ found?: number;
66
+ found_docs?: number;
67
+ grouped_hits?: GroupedHit[];
68
+ out_of?: number;
69
+ page?: number;
70
+ request_params?: RequestParams;
71
+ search_cutoff?: boolean;
72
+ search_time_ms?: number;
73
+ };
74
+ sendPlausibleGoal: (path: string) => void;
75
+ loading: boolean;
76
+ };
77
+ export default function Results({ lang, text, facet, setFacet, results, loading, sendPlausibleGoal, }: Props): import("react/jsx-runtime").JSX.Element;
78
+ export {};
79
+ //# sourceMappingURL=results.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/instant-search/results.tsx"],"names":[],"mappings":"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"}
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import Links from "./links";
4
+ import Products from "./products";
5
+ import FacetSwitch from "./facet-switch";
6
+ import message from "./services/messages";
7
+ import css from "./results.module.css";
8
+ import Faqs from "./faqs";
9
+ import Widgets from "./widgets";
10
+ export default function Results({ lang, text, facet, setFacet, results, loading, sendPlausibleGoal, }) {
11
+ const ref = React.useRef(null);
12
+ const [faqsMaximized, setFaqsMaximized] = React.useState(false);
13
+ const { grouped_hits: groupedHits = [], found_docs: count } = results || {};
14
+ const flattenedHits = groupedHits.reduce((acc, group) => {
15
+ return [...acc, ...group.hits];
16
+ }, []);
17
+ const sortedHits = flattenedHits.reduce((acc, hit) => {
18
+ const { type } = hit.document;
19
+ return { ...acc, [type]: [...acc[type], hit] };
20
+ }, {
21
+ page: [],
22
+ product: [],
23
+ information: [],
24
+ faq: [],
25
+ widget: [],
26
+ lodging: [],
27
+ document: [],
28
+ "msem-widget": [],
29
+ });
30
+ const { page: pages, product: products, information, faq: faqs, widget: widgets, document: documents, "msem-widget": msemWidgets, } = sortedHits;
31
+ const isOtherResultsEmpty = !(pages.length || information.length);
32
+ const countLabel = message(lang, count < 2 ? "result" : "results");
33
+ return (_jsx("div", { className: css.results, children: (loading || text.length > 0) && (_jsxs("div", { className: css.inner, children: [_jsxs("div", { ref: ref, className: css.left, children: [_jsxs("div", { className: css.facet, children: [count, " ", countLabel, " ", _jsx(FacetSwitch, { lang: lang, facet: facet, setFacet: setFacet })] }), _jsx(Links, { linksTitle: message(lang, "pages"), icon: "File", links: pages, loading: loading, sendPlausibleGoal: sendPlausibleGoal }), _jsx(Links, { linksTitle: message(lang, "documents"), icon: "FileText", links: documents, loading: loading, sendPlausibleGoal: sendPlausibleGoal }), _jsx(Links, { linksTitle: message(lang, "information"), icon: "Info", links: information, loading: loading, sendPlausibleGoal: sendPlausibleGoal })] }), _jsxs("div", { className: css.right, children: [_jsx(Widgets, { lang: lang, widgets: [...widgets, ...msemWidgets], loading: loading, sendPlausibleGoal: sendPlausibleGoal, faqsMaximized: faqsMaximized }), _jsx(Products, { lang: lang, products: products, loading: loading, sendPlausibleGoal: sendPlausibleGoal, otherResultsRef: ref, isOtherResultsEmpty: isOtherResultsEmpty, faqsMaximized: faqsMaximized }), _jsx(Faqs, { lang: lang, faqs: faqs, loading: loading, sendPlausibleGoal: sendPlausibleGoal, maximized: faqsMaximized, setMaximized: setFaqsMaximized })] })] })) }));
34
+ }
@@ -0,0 +1,85 @@
1
+ .results {
2
+ width: calc(100% - 20px);
3
+ height: 700px;
4
+ max-height: 85vh;
5
+ display: flex;
6
+ flex-direction: column;
7
+ margin: 0 10px 10px 10px;
8
+ padding: 10px;
9
+ }
10
+
11
+ .results:not(:empty) {
12
+ padding: 0;
13
+ background-color: var(--ds-grey-000, #fff);
14
+ border-radius: var(--ds-input-radius, var(--ds-radius-200, 8px));
15
+ border: var(--ds-input-border, 1px solid var(--ds-grey-300, #d7d7d7));
16
+ box-shadow: var(--ds-shadow-200, 0 5px 10px rgba(0, 0, 0, 0.12));
17
+ overflow: hidden;
18
+ }
19
+
20
+ .inner {
21
+ width: 100%;
22
+ height: 100%;
23
+ display: flex;
24
+ flex-direction: column;
25
+ border-radius: var(--ds-radius-100, 6px);
26
+ overflow: auto;
27
+ overscroll-behavior: contain;
28
+ -webkit-overflow-scrolling: touch;
29
+ }
30
+
31
+ @media (min-width: 730px) {
32
+ .inner {
33
+ flex-direction: row;
34
+ overflow: visible;
35
+ }
36
+ }
37
+
38
+ .left {
39
+ display: flex;
40
+ flex-direction: column;
41
+ gap: 10px;
42
+ padding: 12px;
43
+ order: 1;
44
+ }
45
+
46
+ .left:empty {
47
+ display: none;
48
+ }
49
+
50
+ @media (min-width: 730px) {
51
+ .left {
52
+ flex: 0 0 330px;
53
+ order: 0;
54
+ overflow: auto;
55
+ overscroll-behavior: contain;
56
+ -webkit-overflow-scrolling: touch;
57
+ }
58
+ }
59
+
60
+ .facet {
61
+ display: flex;
62
+ align-items: center;
63
+ justify-content: center;
64
+ gap: 8px;
65
+ text-align: center;
66
+ }
67
+
68
+ .right {
69
+ position: relative;
70
+ flex: 1 1 auto;
71
+ display: flex;
72
+ flex-direction: column;
73
+ background-color: var(--ds-grey-100, #f5f5f5);
74
+ border-radius: var(--ds-input-radius, var(--ds-radius-200, 8px));
75
+ }
76
+
77
+ @media (min-width: 730px) {
78
+ .right {
79
+ border-left: var(--ds-input-border, 1px solid var(--ds-grey-300, #d7d7d7));
80
+ border-radius: 0 var(--ds-radius-100, 6px) var(--ds-radius-100, 6px) 0;
81
+ overflow: auto;
82
+ overscroll-behavior: contain;
83
+ -webkit-overflow-scrolling: touch;
84
+ }
85
+ }
@@ -0,0 +1,15 @@
1
+ type Suggestions = {
2
+ fr?: string[];
3
+ en?: string[];
4
+ };
5
+ type Props = {
6
+ lang: string;
7
+ text: string;
8
+ setText: (value: string) => void;
9
+ loading: boolean;
10
+ closeSearch: () => void;
11
+ suggestions?: Suggestions;
12
+ };
13
+ export default function SearchInput({ lang, text, setText, closeSearch, loading, suggestions, }: Props): import("react/jsx-runtime").JSX.Element;
14
+ export {};
15
+ //# sourceMappingURL=search-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-input.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/instant-search/search-input.tsx"],"names":[],"mappings":"AASA,KAAK,WAAW,GAAG;IACjB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;CACf,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IAEb,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAIF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,WAAW,EACX,OAAO,EACP,WAAW,GACZ,EAAE,KAAK,2CA8EP"}
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import classNames from "classnames";
4
+ import Input from "dt-design-system/es/input";
5
+ import Button from "dt-design-system/es/button";
6
+ import * as Icons from "dt-design-system/es/icons";
7
+ import * as Ripple from "dt-design-system/es/ripple";
8
+ import message from "./services/messages";
9
+ import css from "./search-input.module.css";
10
+ const TRANSITION_DURATION = 1800;
11
+ export default function SearchInput({ lang, text, setText, closeSearch, loading, suggestions, }) {
12
+ const [currentSuggestion, setCurrentSuggestion] = React.useState(0);
13
+ const updateText = (value) => () => {
14
+ setText(value);
15
+ };
16
+ const classes = classNames(css.input, {
17
+ [css.inputLoading]: loading,
18
+ });
19
+ const inputIcon = loading ? "Loader2" : "Search";
20
+ const suggestionsSet = getSuggestions(suggestions)[lang];
21
+ const enableSuggestion = Boolean(suggestionsSet);
22
+ const createRipple = (e) => {
23
+ Ripple.create(e);
24
+ };
25
+ React.useEffect(() => {
26
+ if (enableSuggestion && !text) {
27
+ const interval = setInterval(() => {
28
+ setCurrentSuggestion((current) => {
29
+ const nextSuggestion = current >= suggestionsSet.length - 1 ? 0 : current + 1;
30
+ return nextSuggestion;
31
+ });
32
+ }, TRANSITION_DURATION);
33
+ return () => {
34
+ clearInterval(interval);
35
+ };
36
+ }
37
+ }, [enableSuggestion, suggestionsSet, text]);
38
+ return (_jsxs("div", { className: css.container, children: [_jsx(Input, { value: text, onValueChange: setText, icon: inputIcon, className: classes }), enableSuggestion && !text && (_jsxs("div", { className: css.suggestion, children: [message(lang, "try"), _jsx("div", { className: css.buttons, children: suggestionsSet.map((suggestion, i) => {
39
+ const isCurrent = i === currentSuggestion;
40
+ const isPrev = currentSuggestion === 0
41
+ ? i === suggestionsSet.length - 1
42
+ : i === currentSuggestion - 1;
43
+ const classes = classNames(css.button, {
44
+ [css.buttonCurrent]: isCurrent,
45
+ [css.buttonPrev]: isPrev,
46
+ });
47
+ return (_jsxs("button", { className: classes, onClick: updateText(suggestion), onMouseDown: createRipple, children: ["\u00AB ", suggestion, " \u00BB"] }, suggestion));
48
+ }) })] })), _jsx(Button, { variant: "transparent", className: css.close, onClick: closeSearch, children: _jsx(Icons.Cross, {}) })] }));
49
+ }
50
+ function getSuggestions(suggestions = {}) {
51
+ return {
52
+ fr: ["forfait", "météo", "pistes", "VTT"],
53
+ en: ["ski pass"],
54
+ ...suggestions,
55
+ };
56
+ }