@wayke-se/components-react 3.5.3-beta.1 → 3.6.0-beta.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 (40) hide show
  1. package/dist-node/index.js +622 -127
  2. package/dist-node/index.js.map +1 -1
  3. package/dist-src/components/AccessoryCard/index.js +14 -0
  4. package/dist-src/components/AccessoryCard/wrapper.js +90 -0
  5. package/dist-src/components/DocumentList/wrapper.js +1 -1
  6. package/dist-src/components/Gallery/index.js +7 -4
  7. package/dist-src/components/Gallery/wrapper.js +1 -38
  8. package/dist-src/components/Icon/index.js +2 -0
  9. package/dist-src/components/Image/index.js +5 -0
  10. package/dist-src/components/Link/index.js +28 -0
  11. package/dist-src/components/NavButton/index.js +42 -0
  12. package/dist-src/components/OverflowGrid/index.js +56 -66
  13. package/dist-src/components/OverflowGrid/wrapper.js +144 -0
  14. package/dist-src/components/PriceBox/index.js +6 -0
  15. package/dist-src/components/PriceBox/wrapper.js +34 -0
  16. package/dist-src/layout/theme.js +8 -0
  17. package/dist-src/layouts/searchItem/Accessories/AccessoryModal.js +51 -0
  18. package/dist-src/layouts/searchItem/Accessories/index.js +32 -0
  19. package/dist-src/layouts/searchItem/Related.js +23 -25
  20. package/dist-src/layouts/searchItem/index.js +3 -1
  21. package/dist-src/queries/SEARCH_ITEM_BRANCH_QUERY.js +18 -0
  22. package/dist-src/queries/SEARCH_ITEM_QUERY.js +18 -0
  23. package/dist-types/@types/codegen/types.d.ts +17 -0
  24. package/dist-types/components/AccessoryCard/index.d.ts +16 -0
  25. package/dist-types/components/AccessoryCard/wrapper.d.ts +18 -0
  26. package/dist-types/components/Gallery/wrapper.d.ts +2 -6
  27. package/dist-types/components/Icon/index.d.ts +1 -0
  28. package/dist-types/components/Image/index.d.ts +1 -0
  29. package/dist-types/components/Link/index.d.ts +7 -0
  30. package/dist-types/components/NavButton/index.d.ts +3 -0
  31. package/dist-types/components/OverflowGrid/index.d.ts +12 -3
  32. package/dist-types/components/OverflowGrid/wrapper.d.ts +18 -0
  33. package/dist-types/components/PriceBox/index.d.ts +11 -0
  34. package/dist-types/components/PriceBox/wrapper.d.ts +10 -0
  35. package/dist-types/layout/theme.d.ts +8 -0
  36. package/dist-types/layouts/searchItem/Accessories/AccessoryModal.d.ts +8 -0
  37. package/dist-types/layouts/searchItem/Accessories/index.d.ts +7 -0
  38. package/dist-web/index.js +535 -122
  39. package/dist-web/index.js.map +1 -1
  40. package/package.json +1 -1
@@ -74,6 +74,14 @@ const theme = {
74
74
  Lg: '@media (min-width: 1200px)',
75
75
  LtLg: '@media (max-width: 1199px)'
76
76
  },
77
+ mask: {
78
+ gradient: {
79
+ toTop: 'linear-gradient(to top, #000, transparent)',
80
+ toBottom: 'linear-gradient(to bottom, #000, transparent)',
81
+ toLeft: 'linear-gradient(to left, #000, transparent)',
82
+ toRight: 'linear-gradient(to right, #000, transparent)'
83
+ }
84
+ },
77
85
  distances: {
78
86
  baseUnit: '8px',
79
87
  inputHeight: '48px',
@@ -782,6 +790,16 @@ const IconExclamationTriangle = ({
782
790
  }, React.createElement("path", {
783
791
  d: "M15.951 19.663c-0.457 0-0.828-0.37-0.828-0.828v-4.357c0-0.457 0.37-0.828 0.828-0.828s0.828 0.37 0.828 0.828v4.357c0 0.457-0.371 0.828-0.828 0.828zM15.952 22.906c-0.305 0-0.606-0.126-0.821-0.341s-0.338-0.514-0.338-0.818 0.122-0.606 0.338-0.821c0.431-0.43 1.209-0.43 1.639 0 0.215 0.215 0.341 0.516 0.341 0.821s-0.126 0.603-0.341 0.818c-0.215 0.215-0.513 0.341-0.818 0.341zM27.049 27.070h-22.196c-0.352 0-0.677-0.186-0.855-0.489s-0.184-0.677-0.014-0.985l11.098-20.105c0.175-0.317 0.508-0.513 0.87-0.513s0.695 0.197 0.87 0.513l11.098 20.105c0.17 0.308 0.165 0.683-0.014 0.985s-0.504 0.489-0.856 0.489zM6.536 25.083h18.83l-9.415-17.056-9.415 17.056z"
784
792
  }));
793
+ const IconImage = ({
794
+ block
795
+ }) => React.createElement(Icon$1, {
796
+ viewBox: "0 0 16 16",
797
+ block: block
798
+ }, React.createElement("path", {
799
+ d: "M14.4 1.6H1.6C.7 1.6 0 2.3 0 3.2v9.6c0 .9.7 1.6 1.6 1.6h12.8c.9 0 1.6-.7 1.6-1.6V3.2c0-.9-.7-1.6-1.6-1.6zm0 11.2H1.6V3.2h12.8v9.6zM3.2 6c0-.7.5-1.2 1.2-1.2s1.2.5 1.2 1.2-.5 1.2-1.2 1.2S3.2 6.7 3.2 6zm.2 4.5l6.2-4.4c.4-.3.9-.2 1.1.2v.1l2.4 4.2c.1.2 0 .4-.1.5-.1 0-.1.1-.2.1H3.7c-.2 0-.4-.2-.4-.4 0-.1 0-.3.1-.3z",
800
+ fillRule: "evenodd",
801
+ clipRule: "evenodd"
802
+ }));
785
803
 
786
804
  const SortSelect = ({
787
805
  value,
@@ -3485,47 +3503,10 @@ const ImageFull = styled__default.img`
3485
3503
  object-fit: cover;
3486
3504
  `;
3487
3505
  // Arrow Nav
3488
- const Arrow = styled__default(ButtonReset)`
3506
+ const Arrow = styled__default.div`
3489
3507
  position: absolute;
3490
3508
  top: 50%;
3491
3509
  transform: translateY(-50%);
3492
- display: flex;
3493
- align-items: center;
3494
- justify-content: center;
3495
- width: ${size(4)};
3496
- height: ${size(4)};
3497
- border-radius: 50%;
3498
- font-size: 1rem;
3499
- line-height: 1;
3500
- background-color: rgba(255, 255, 255, 0.4);
3501
- backdrop-filter: blur(5px);
3502
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
3503
- color: ${props => props.theme.color.textDark};
3504
- transform-origin: 50% 50%;
3505
- transition: transform 200ms ease;
3506
-
3507
- :before {
3508
- content: '';
3509
- position: absolute;
3510
- top: 0;
3511
- bottom: 0;
3512
- left: 0;
3513
- right: 0;
3514
- border-radius: 50%;
3515
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
3516
- opacity: 0;
3517
- transition: opacity 200ms ease;
3518
- }
3519
-
3520
- :hover {
3521
- :before {
3522
- opacity: 1;
3523
- }
3524
- }
3525
-
3526
- :active {
3527
- transform: translateY(-50%) scale(0.95);
3528
- }
3529
3510
 
3530
3511
  ${props => props.theme.breakpoint.LtSm} {
3531
3512
  display: none;
@@ -3629,6 +3610,46 @@ const EnableNavigationButton = styled__default.div`
3629
3610
  z-index: 1;
3630
3611
  `;
3631
3612
 
3613
+ const NavButton = styled__default(ButtonReset)`
3614
+ position: relative;
3615
+ display: flex;
3616
+ align-items: center;
3617
+ justify-content: center;
3618
+ width: ${size(4)};
3619
+ height: ${size(4)};
3620
+ border-radius: 50%;
3621
+ background-color: ${props => props.theme.color.bg};
3622
+ color: ${props => props.theme.color.textDark};
3623
+ font-size: 0.75rem;
3624
+ box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
3625
+ transition: transform 200ms ease;
3626
+
3627
+ &::before {
3628
+ content: '';
3629
+ position: absolute;
3630
+ top: 0;
3631
+ bottom: 0;
3632
+ left: 0;
3633
+ right: 0;
3634
+ border-radius: 50%;
3635
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
3636
+ opacity: 0;
3637
+ transition: opacity 200ms ease;
3638
+ }
3639
+
3640
+ &:enabled {
3641
+ &:hover {
3642
+ &::before {
3643
+ opacity: 1;
3644
+ }
3645
+ }
3646
+ }
3647
+
3648
+ &:active {
3649
+ transform: scale(0.95);
3650
+ }
3651
+ `;
3652
+
3632
3653
  const Wrapper$h = styled__default.div`
3633
3654
  position: fixed;
3634
3655
  top: 0;
@@ -4838,17 +4859,17 @@ const Gallery = ({
4838
4859
  }))), navigationDisabled && mediaLength > 1 && React__default.createElement(EnableNavigationButton, null, React__default.createElement(ButtonSecondary, {
4839
4860
  onClick: onEnableNavigation,
4840
4861
  title: "St\u00E4ng"
4841
- }, React__default.createElement(ButtonContent, null, "St\u00E4ng")))), !navigationDisabled && mediaLength > 1 && React__default.createElement(React__default.Fragment, null, React__default.createElement(ArrowLeft, {
4862
+ }, React__default.createElement(ButtonContent, null, "St\u00E4ng")))), !navigationDisabled && mediaLength > 1 && React__default.createElement(React__default.Fragment, null, React__default.createElement(ArrowLeft, null, React__default.createElement(NavButton, {
4842
4863
  onClick: prevImage,
4843
4864
  title: "F\u00F6reg\u00E5ende bild"
4844
4865
  }, React__default.createElement(IconChevronLeft, {
4845
4866
  block: true
4846
- })), React__default.createElement(ArrowRight, {
4867
+ }))), React__default.createElement(ArrowRight, null, React__default.createElement(NavButton, {
4847
4868
  onClick: nextImage,
4848
4869
  title: "N\u00E4sta bild"
4849
4870
  }, React__default.createElement(IconChevronRight, {
4850
4871
  block: true
4851
- })))), React__default.createElement(Alt, null, React__default.createElement(QuickNav, {
4872
+ }))))), React__default.createElement(Alt, null, React__default.createElement(QuickNav, {
4852
4873
  ref: quickNavRef
4853
4874
  }, !!(media !== null && media !== void 0 && media.length) ? media.map((m, i) => {
4854
4875
  var _m$files$0$formats$fi2;
@@ -4997,6 +5018,24 @@ const SEARCH_ITEM_QUERY = client.gql`
4997
5018
  phonenumber
4998
5019
  avatar
4999
5020
  }
5021
+ accessories {
5022
+ articleNumber
5023
+ description
5024
+ excerpt
5025
+ id
5026
+ images
5027
+ logotype
5028
+ manufacturer
5029
+ model
5030
+ name
5031
+ price
5032
+ assemblyPrice
5033
+ productPage {
5034
+ title
5035
+ url
5036
+ }
5037
+ salePrice
5038
+ }
5000
5039
  manufacturer {
5001
5040
  description
5002
5041
  logotype
@@ -6853,69 +6892,231 @@ const SectionHeader = ({
6853
6892
  onClick: onClick
6854
6893
  }, React__default.createElement(ButtonContent, null, actionTitle))));
6855
6894
 
6856
- const OverflowGrid = styled__default.div`
6857
- ${props => props.theme.breakpoint.LtMd} {
6858
- ${Wrapper} & {
6859
- margin-left: ${size(-3)};
6860
- margin-right: ${size(-2)};
6861
- }
6895
+ const Wrapper$v = styled__default.div`
6896
+ --container-gutter: ${size(2)};
6897
+ --bg: ${props => props.theme.color.bg};
6898
+
6899
+ ${props => props.theme.breakpoint.Sm} {
6900
+ --container-gutter: ${size(3)};
6862
6901
  }
6863
6902
 
6903
+ position: relative;
6904
+
6905
+ ${({
6906
+ $accentBg
6907
+ }) => $accentBg && styled.css`
6908
+ --bg: ${props => props.theme.color.accent};
6909
+ `}
6910
+ `;
6911
+ const Item$b = styled__default.li`
6912
+ flex: 1 0 auto;
6913
+ width: 100%;
6914
+ max-width: 100%;
6915
+ scroll-snap-align: start;
6916
+
6864
6917
  ${props => props.theme.breakpoint.LtSm} {
6865
- ${Wrapper} & {
6866
- margin-left: ${size(-2)};
6867
- margin-right: ${size(-1)};
6918
+ &:is(:only-child, #important) {
6919
+ width: 100%;
6920
+ max-width: 100%;
6868
6921
  }
6869
6922
  }
6870
6923
  `;
6871
- const OverflowGridList = styled__default.ul`
6924
+ const List$9 = styled__default.ul`
6872
6925
  display: flex;
6873
- align-items: flex-start;
6926
+ align-items: stretch;
6874
6927
  list-style: none;
6875
- padding: 0;
6876
- margin: ${size(-1)};
6928
+ padding: 0 var(--container-gutter);
6929
+ margin: 0;
6930
+ overflow: auto;
6931
+ scroll-snap-type: x mandatory;
6932
+ scroll-padding-left: var(--container-gutter);
6933
+ scrollbar-width: none;
6934
+ -ms-overflow-style: none;
6877
6935
 
6878
- ${props => props.theme.breakpoint.LtMd} {
6879
- ${Wrapper} & {
6880
- overflow: auto;
6881
- -webkit-overflow-scrolling: touch;
6882
- padding: 0 ${size(3)};
6936
+ &::-webkit-scrollbar {
6937
+ display: none;
6938
+ }
6883
6939
 
6884
- :after {
6885
- content: '';
6886
- flex: 0 0 auto;
6887
- height: 1px;
6888
- width: ${size(2)};
6940
+ ${({
6941
+ $columns
6942
+ }) => $columns && styled.css`
6943
+ ${Item$b} {
6944
+ width: ${100 / $columns}%;
6945
+ max-width: ${100 / $columns}%;
6889
6946
  }
6890
- }
6891
- }
6947
+ `}
6892
6948
 
6893
- ${props => props.theme.breakpoint.LtSm} {
6894
- ${Wrapper} & {
6895
- padding: 0 ${size(2)};
6949
+ ${({
6950
+ $columnsSm
6951
+ }) => $columnsSm && styled.css`
6952
+ ${props => props.theme.breakpoint.Sm} {
6953
+ ${Item$b} {
6954
+ width: ${100 / $columnsSm}%;
6955
+ max-width: ${100 / $columnsSm}%;
6956
+ }
6957
+ }
6958
+ `}
6896
6959
 
6897
- :after {
6898
- width: ${size(1)};
6960
+ ${({
6961
+ $columnsMd
6962
+ }) => $columnsMd && styled.css`
6963
+ ${props => props.theme.breakpoint.Md} {
6964
+ ${Item$b} {
6965
+ width: ${100 / $columnsMd}%;
6966
+ max-width: ${100 / $columnsMd}%;
6967
+ }
6899
6968
  }
6900
- }
6901
- }
6969
+ `}
6902
6970
  `;
6903
- const OverflowGridItem = styled__default.li`
6904
- flex: 1 0 auto;
6905
- width: calc(100% - ${size(2)});
6906
- max-width: calc(100% - ${size(2)});
6907
- padding: ${size(1)};
6971
+ const ListWrapper = styled__default.div`
6972
+ position: relative;
6973
+ overflow: hidden;
6974
+ margin: 0 calc(var(--container-gutter) * -1);
6908
6975
 
6909
- ${props => props.theme.breakpoint.Sm} {
6910
- width: calc(50% - ${size(3)});
6911
- max-width: calc(50% - ${size(3)});
6976
+ ${props => props.theme.breakpoint.Md} {
6977
+ &::before,
6978
+ &::after {
6979
+ content: '';
6980
+ position: absolute;
6981
+ top: 0;
6982
+ bottom: 0;
6983
+ width: var(--container-gutter);
6984
+ background-color: var(--bg);
6985
+ z-index: 1;
6986
+ }
6987
+
6988
+ &::before {
6989
+ left: 0;
6990
+
6991
+ ${({
6992
+ $spacing
6993
+ }) => $spacing ? styled.css`
6994
+ mask-image: linear-gradient(to right, #000 ${size($spacing)}, transparent);
6995
+ ` : styled.css`
6996
+ mask-image: ${props => props.theme.mask.gradient.toRight};
6997
+ `}
6998
+ }
6999
+
7000
+ &::after {
7001
+ right: 0;
7002
+
7003
+ ${({
7004
+ $spacing
7005
+ }) => $spacing ? styled.css`
7006
+ mask-image: linear-gradient(to left, #000 ${size($spacing)}, transparent);
7007
+ ` : styled.css`
7008
+ mask-image: ${props => props.theme.mask.gradient.toLeft};
7009
+ `}
7010
+ }
6912
7011
  }
6913
7012
 
6914
- ${props => props.theme.breakpoint.Md} {
6915
- width: 33.333%;
6916
- max-width: 33.333%;
7013
+ ${({
7014
+ $spacing
7015
+ }) => $spacing && styled.css`
7016
+ ${List$9} {
7017
+ margin: 0 -${size($spacing / 2)};
7018
+ }
7019
+
7020
+ ${Item$b} {
7021
+ padding: 0 ${size($spacing / 2)};
7022
+ }
7023
+ `}
7024
+ `;
7025
+ const NavBtn = styled__default.div`
7026
+ position: absolute;
7027
+ top: 50%;
7028
+ z-index: 2;
7029
+
7030
+ ${props => props.theme.breakpoint.LtSm} {
7031
+ display: none;
6917
7032
  }
6918
7033
  `;
7034
+ const PrevBtn = styled__default(NavBtn)`
7035
+ left: 0;
7036
+ transform: translate(-50%, -50%);
7037
+ `;
7038
+ const NextBtn = styled__default(NavBtn)`
7039
+ right: 0;
7040
+ transform: translate(50%, -50%);
7041
+ `;
7042
+
7043
+ const OverflowGrid = ({
7044
+ items,
7045
+ itemKeyBase,
7046
+ spacing,
7047
+ columns,
7048
+ columnsSm,
7049
+ columnsMd,
7050
+ accentBg
7051
+ }) => {
7052
+ const overflowElement = React.useRef(null);
7053
+ const onPrev = React.useCallback(() => {
7054
+ var _overflowElement$curr, _overflowElement$curr2;
7055
+ const itemWidth = ((_overflowElement$curr = overflowElement.current) === null || _overflowElement$curr === void 0 ? void 0 : _overflowElement$curr.children[0].clientWidth) || 0;
7056
+ const scrollLeft = ((_overflowElement$curr2 = overflowElement.current) === null || _overflowElement$curr2 === void 0 ? void 0 : _overflowElement$curr2.scrollLeft) || 0;
7057
+ if (scrollLeft > 0) {
7058
+ var _overflowElement$curr3;
7059
+ (_overflowElement$curr3 = overflowElement.current) === null || _overflowElement$curr3 === void 0 ? void 0 : _overflowElement$curr3.scroll({
7060
+ left: scrollLeft - itemWidth,
7061
+ behavior: 'smooth'
7062
+ });
7063
+ }
7064
+ }, []);
7065
+ const onNext = React.useCallback(() => {
7066
+ var _overflowElement$curr4, _overflowElement$curr5, _overflowElement$curr6, _overflowElement$curr7;
7067
+ const itemWidth = ((_overflowElement$curr4 = overflowElement.current) === null || _overflowElement$curr4 === void 0 ? void 0 : _overflowElement$curr4.children[0].clientWidth) || 0;
7068
+ const scrollWidth = ((_overflowElement$curr5 = overflowElement.current) === null || _overflowElement$curr5 === void 0 ? void 0 : _overflowElement$curr5.scrollWidth) || 0;
7069
+ const scrollLeft = ((_overflowElement$curr6 = overflowElement.current) === null || _overflowElement$curr6 === void 0 ? void 0 : _overflowElement$curr6.scrollLeft) || 0;
7070
+ const overflowElementWidth = ((_overflowElement$curr7 = overflowElement.current) === null || _overflowElement$curr7 === void 0 ? void 0 : _overflowElement$curr7.offsetWidth) || 0;
7071
+ const overflowElementScrollWidth = scrollWidth - overflowElementWidth;
7072
+ if (overflowElementScrollWidth !== scrollLeft) {
7073
+ var _overflowElement$curr8;
7074
+ (_overflowElement$curr8 = overflowElement.current) === null || _overflowElement$curr8 === void 0 ? void 0 : _overflowElement$curr8.scroll({
7075
+ left: scrollLeft + itemWidth,
7076
+ behavior: 'smooth'
7077
+ });
7078
+ }
7079
+ }, []);
7080
+ // Hide navigation buttons depending on scroll position
7081
+ const [hidePrevNav, setHidePrevNav] = React.useState(true);
7082
+ const [hideNextNav, setHideNextNav] = React.useState(true);
7083
+ const onScroll = () => {
7084
+ var _overflowElement$curr9, _overflowElement$curr10, _overflowElement$curr11;
7085
+ const scrollLeft = ((_overflowElement$curr9 = overflowElement.current) === null || _overflowElement$curr9 === void 0 ? void 0 : _overflowElement$curr9.scrollLeft) || 0;
7086
+ const scrollWidth = ((_overflowElement$curr10 = overflowElement.current) === null || _overflowElement$curr10 === void 0 ? void 0 : _overflowElement$curr10.scrollWidth) || 0;
7087
+ const overflowElementWidth = ((_overflowElement$curr11 = overflowElement.current) === null || _overflowElement$curr11 === void 0 ? void 0 : _overflowElement$curr11.offsetWidth) || 0;
7088
+ const overflowElementScrollWidth = scrollWidth - overflowElementWidth;
7089
+ setHidePrevNav(scrollLeft == 0 ? true : false);
7090
+ setHideNextNav(overflowElementScrollWidth == scrollLeft ? true : false);
7091
+ };
7092
+ React.useEffect(() => {
7093
+ var _overflowElement$curr12;
7094
+ onScroll();
7095
+ (_overflowElement$curr12 = overflowElement.current) === null || _overflowElement$curr12 === void 0 ? void 0 : _overflowElement$curr12.addEventListener('scroll', onScroll);
7096
+ return () => {
7097
+ var _overflowElement$curr13;
7098
+ return (_overflowElement$curr13 = overflowElement.current) === null || _overflowElement$curr13 === void 0 ? void 0 : _overflowElement$curr13.removeEventListener('scroll', onScroll);
7099
+ };
7100
+ }, []);
7101
+ return React__default.createElement(Wrapper$v, {
7102
+ "$accentBg": accentBg
7103
+ }, React__default.createElement(ListWrapper, {
7104
+ "$spacing": spacing
7105
+ }, React__default.createElement(List$9, {
7106
+ ref: overflowElement,
7107
+ "$columns": columns,
7108
+ "$columnsSm": columnsSm,
7109
+ "$columnsMd": columnsMd
7110
+ }, items.map((item, i) => React__default.createElement(Item$b, {
7111
+ key: itemKeyBase ? `${itemKeyBase}-${i}` : `overflow-grid-item-${i}`
7112
+ }, item)))), !hidePrevNav && React__default.createElement(PrevBtn, null, React__default.createElement(NavButton, {
7113
+ onClick: onPrev,
7114
+ title: "Previous"
7115
+ }, React__default.createElement(IconChevronLeft, null))), !hideNextNav && React__default.createElement(NextBtn, null, React__default.createElement(NavButton, {
7116
+ onClick: onNext,
7117
+ title: "Next"
7118
+ }, React__default.createElement(IconChevronRight, null))));
7119
+ };
6919
7120
 
6920
7121
  const RelatedSearchContext = React.createContext({
6921
7122
  moreLikeThisUrl: false,
@@ -6989,37 +7190,43 @@ const Related = ({
6989
7190
  actionTitle: "Visa alla"
6990
7191
  }, React__default.createElement(H2, {
6991
7192
  noMargin: true
6992
- }, "Senast inkomna"))), React__default.createElement(Repeat, null, React__default.createElement(OverflowGrid, null, React__default.createElement(OverflowGridList, null, response === null || response === void 0 ? void 0 : response.documentList.documents.map(document => {
6993
- var _document$featuredIma, _document$featuredIma2, _document$featuredIma3, _document$branches, _document$branches$;
6994
- const prefix = pathRoute ? `/${pathRoute}` : '/';
6995
- const r = regexPathGuid();
6996
- const pathRouteUrl = window.location.pathname === '/' ? `${prefix}${document._id}` : r.test(`${pathRoute}${id}`) ? window.location.pathname.replace(r, document._id) : `${window.location.pathname}${prefix}${document._id}`;
6997
- return React__default.createElement(OverflowGridItem, {
6998
- key: document._id
6999
- }, React__default.createElement(ProductCard, {
7000
- id: document._id,
7001
- onClick: onItemClicked,
7002
- title: document.title,
7003
- href: pathRoute ? pathRouteUrl : hashRoute ? `#${document._id}` : undefined,
7004
- image: (_document$featuredIma = document.featuredImage) === null || _document$featuredIma === void 0 ? void 0 : (_document$featuredIma2 = _document$featuredIma.files) === null || _document$featuredIma2 === void 0 ? void 0 : (_document$featuredIma3 = _document$featuredIma2[0]) === null || _document$featuredIma3 === void 0 ? void 0 : _document$featuredIma3.url,
7005
- description: document.shortDescription,
7006
- branchName: displayBranchName ? (_document$branches = document.branches) === null || _document$branches === void 0 ? void 0 : (_document$branches$ = _document$branches[0]) === null || _document$branches$ === void 0 ? void 0 : _document$branches$.name : undefined,
7007
- uspList: [{
7008
- title: document.modelYear
7009
- }, {
7010
- title: `${numberSeparator(document.mileage)} mil`
7011
- }, {
7012
- title: document.gearboxType
7013
- }, {
7014
- title: document.fuelType
7015
- }],
7016
- price: `${numberSeparator(document.price)} kr`,
7017
- oldPrice: document.oldPrice !== undefined && document.price < document.oldPrice ? `${numberSeparator(document.oldPrice)} kr` : undefined,
7018
- leasingPrice: document.leasingPrice !== undefined ? `${numberSeparator(document.leasingPrice)} kr/mån` : undefined,
7019
- businessLeasingPrice: document.businessLeasingPrice !== undefined ? `${numberSeparator(document.businessLeasingPrice)} kr/mån` : undefined,
7020
- pathRoute: pathRoute
7021
- }));
7022
- }))))));
7193
+ }, "Senast inkomna"))), React__default.createElement(Repeat, null, React__default.createElement(OverflowGrid, {
7194
+ accentBg: true,
7195
+ columns: 1.05,
7196
+ columnsSm: 2.1,
7197
+ columnsMd: 3,
7198
+ spacing: 2,
7199
+ items: response === null || response === void 0 ? void 0 : response.documentList.documents.map(document => {
7200
+ var _document$featuredIma, _document$featuredIma2, _document$featuredIma3, _document$branches, _document$branches$;
7201
+ const prefix = pathRoute ? `/${pathRoute}` : '/';
7202
+ const r = regexPathGuid();
7203
+ const pathRouteUrl = window.location.pathname === '/' ? `${prefix}${document._id}` : r.test(`${pathRoute}${id}`) ? window.location.pathname.replace(r, document._id) : `${window.location.pathname}${prefix}${document._id}`;
7204
+ return React__default.createElement(ProductCard, {
7205
+ key: document._id,
7206
+ id: document._id,
7207
+ onClick: onItemClicked,
7208
+ title: document.title,
7209
+ href: pathRoute ? pathRouteUrl : hashRoute ? `#${document._id}` : undefined,
7210
+ image: (_document$featuredIma = document.featuredImage) === null || _document$featuredIma === void 0 ? void 0 : (_document$featuredIma2 = _document$featuredIma.files) === null || _document$featuredIma2 === void 0 ? void 0 : (_document$featuredIma3 = _document$featuredIma2[0]) === null || _document$featuredIma3 === void 0 ? void 0 : _document$featuredIma3.url,
7211
+ description: document.shortDescription,
7212
+ branchName: displayBranchName ? (_document$branches = document.branches) === null || _document$branches === void 0 ? void 0 : (_document$branches$ = _document$branches[0]) === null || _document$branches$ === void 0 ? void 0 : _document$branches$.name : undefined,
7213
+ uspList: [{
7214
+ title: document.modelYear
7215
+ }, {
7216
+ title: `${numberSeparator(document.mileage)} mil`
7217
+ }, {
7218
+ title: document.gearboxType
7219
+ }, {
7220
+ title: document.fuelType
7221
+ }],
7222
+ price: `${numberSeparator(document.price)} kr`,
7223
+ oldPrice: document.oldPrice !== undefined && document.price < document.oldPrice ? `${numberSeparator(document.oldPrice)} kr` : undefined,
7224
+ leasingPrice: document.leasingPrice !== undefined ? `${numberSeparator(document.leasingPrice)} kr/mån` : undefined,
7225
+ businessLeasingPrice: document.businessLeasingPrice !== undefined ? `${numberSeparator(document.businessLeasingPrice)} kr/mån` : undefined,
7226
+ pathRoute: pathRoute
7227
+ });
7228
+ })
7229
+ }))));
7023
7230
  };
7024
7231
 
7025
7232
  const PackageOptions = ({
@@ -7073,7 +7280,7 @@ const getBg = severity => {
7073
7280
  }
7074
7281
  return bg;
7075
7282
  };
7076
- const Wrapper$v = styled__default.div.attrs(() => ({
7283
+ const Wrapper$w = styled__default.div.attrs(() => ({
7077
7284
  className: 'wayke__theme wayke__font--bold'
7078
7285
  }))`
7079
7286
  display: inline-block;
@@ -7088,7 +7295,7 @@ const Wrapper$v = styled__default.div.attrs(() => ({
7088
7295
  const Badge = ({
7089
7296
  label,
7090
7297
  severity
7091
- }) => React__default.createElement(Wrapper$v, {
7298
+ }) => React__default.createElement(Wrapper$w, {
7092
7299
  severity: severity
7093
7300
  }, label);
7094
7301
 
@@ -7188,7 +7395,7 @@ const SettingsContext = React.createContext({});
7188
7395
 
7189
7396
  const useSettings = () => React.useContext(SettingsContext);
7190
7397
 
7191
- const Wrapper$w = styled__default.a`
7398
+ const Wrapper$x = styled__default.a`
7192
7399
  display: block;
7193
7400
  `;
7194
7401
  const Image$3 = styled__default.img`
@@ -7235,7 +7442,7 @@ const StaticMap = ({
7235
7442
  longitude
7236
7443
  } = position;
7237
7444
  if (visible && googleMapsApiKey) {
7238
- return React__default.createElement(Wrapper$w, {
7445
+ return React__default.createElement(Wrapper$x, {
7239
7446
  href: `http://maps.google.com/maps?q=${latitude},${longitude}`,
7240
7447
  title: "Visa p\u00E5 Google Maps",
7241
7448
  target: "_blank",
@@ -7307,6 +7514,24 @@ const SEARCH_ITEM_BRANCH_QUERY = client.gql`
7307
7514
  phonenumber
7308
7515
  avatar
7309
7516
  }
7517
+ accessories {
7518
+ articleNumber
7519
+ description
7520
+ excerpt
7521
+ id
7522
+ images
7523
+ logotype
7524
+ manufacturer
7525
+ model
7526
+ name
7527
+ price
7528
+ assemblyPrice
7529
+ productPage {
7530
+ title
7531
+ url
7532
+ }
7533
+ salePrice
7534
+ }
7310
7535
  branch {
7311
7536
  connections {
7312
7537
  id
@@ -8025,7 +8250,7 @@ const MetadataItem = ({
8025
8250
  })));
8026
8251
  };
8027
8252
 
8028
- const Wrapper$x = styled__default.div`
8253
+ const Wrapper$y = styled__default.div`
8029
8254
  overflow: hidden;
8030
8255
  margin-top: ${size(-1)};
8031
8256
  margin-left: ${size(-1)};
@@ -8036,7 +8261,7 @@ const Wrapper$x = styled__default.div`
8036
8261
  margin-right: ${size(-2)};
8037
8262
  }
8038
8263
  `;
8039
- const List$9 = styled__default.ul`
8264
+ const List$a = styled__default.ul`
8040
8265
  list-style: none;
8041
8266
  padding: 0;
8042
8267
  margin: 0;
@@ -8050,7 +8275,7 @@ const List$9 = styled__default.ul`
8050
8275
  padding-right: ${size(1)};
8051
8276
  }
8052
8277
  `;
8053
- const Item$b = styled__default.li`
8278
+ const Item$c = styled__default.li`
8054
8279
  display: inline-block;
8055
8280
  vertical-align: bottom;
8056
8281
  font-size: 1rem;
@@ -8094,7 +8319,7 @@ const Tabs = ({
8094
8319
  tabs,
8095
8320
  active,
8096
8321
  onClick
8097
- }) => React.createElement(Wrapper$x, null, React.createElement(List$9, null, tabs.map(tab => React.createElement(Item$b, {
8322
+ }) => React.createElement(Wrapper$y, null, React.createElement(List$a, null, tabs.map(tab => React.createElement(Item$c, {
8098
8323
  key: tab.name
8099
8324
  }, React.createElement(Action$8, {
8100
8325
  title: tab.displayName,
@@ -8188,7 +8413,7 @@ const PdfListItem = styled__default.li.attrs(() => ({
8188
8413
  flex: 0 0 100%;
8189
8414
  }
8190
8415
  `;
8191
- const List$a = styled__default.ul`
8416
+ const List$b = styled__default.ul`
8192
8417
  list-style: none;
8193
8418
  padding: 0;
8194
8419
  display: flex;
@@ -8216,7 +8441,7 @@ const PdfSubtitle = styled__default.div`
8216
8441
  color: ${props => props.theme.color.textDarkLighten};
8217
8442
  `;
8218
8443
  const PdfColumn = styled__default.div`
8219
- flex 0 0 auto;
8444
+ flex: 0 0 auto;
8220
8445
  &:first-child {
8221
8446
  flex: 1 1 auto;
8222
8447
  }
@@ -8253,7 +8478,7 @@ const PdfDownloadItem = ({
8253
8478
  };
8254
8479
  const DocumentList = ({
8255
8480
  documents
8256
- }) => React__default.createElement(List$a, null, documents.map((document, i) => React__default.createElement(PdfDownloadItem, {
8481
+ }) => React__default.createElement(List$b, null, documents.map((document, i) => React__default.createElement(PdfDownloadItem, {
8257
8482
  key: `${document.url}-${i}`,
8258
8483
  document: document
8259
8484
  })));
@@ -8297,6 +8522,273 @@ const Documents = ({
8297
8522
  }))));
8298
8523
  };
8299
8524
 
8525
+ const Wrapper$z = styled__default.div`
8526
+ display: flex;
8527
+ flex-direction: column;
8528
+ gap: ${size(2)};
8529
+ height: 100%;
8530
+ `;
8531
+ const imageBaseStyling = styled.css`
8532
+ flex-shrink: 0;
8533
+ aspect-ratio: 16 / 9;
8534
+ border-radius: 3px;
8535
+ `;
8536
+ const Image$4 = styled__default.img`
8537
+ ${imageBaseStyling};
8538
+ display: block;
8539
+ width: 100%;
8540
+ object-fit: cover;
8541
+ `;
8542
+ const ImageaPlaceholder = styled__default.div`
8543
+ ${imageBaseStyling};
8544
+ display: flex;
8545
+ align-items: center;
8546
+ justify-content: center;
8547
+ color: ${props => props.theme.color.textDarkLighten};
8548
+ font-size: 2rem;
8549
+ background-color: ${props => props.theme.color.accent};
8550
+ `;
8551
+ const Body$5 = styled__default.div`
8552
+ flex: 1 1 auto;
8553
+ display: flex;
8554
+ align-items: flex-start;
8555
+ flex-direction: column;
8556
+ gap: ${size(1)};
8557
+ `;
8558
+ const Heading$7 = styled__default.div`
8559
+ display: flex;
8560
+ align-items: center;
8561
+ justify-content: space-between;
8562
+ gap: ${size(2)};
8563
+ `;
8564
+ const Title$2 = styled__default.div.attrs(() => ({
8565
+ className: 'wayke__theme wayke__font--bold'
8566
+ }))`
8567
+ font-size: 1.125rem;
8568
+ `;
8569
+ const Branding = styled__default.img`
8570
+ display: block;
8571
+ `;
8572
+ const Price$2 = styled__default.div.attrs(() => ({
8573
+ className: 'wayke__theme wayke__font--bold'
8574
+ }))``;
8575
+ const Preamble = styled__default.div`
8576
+ --preamble-max-height: ${size(6)};
8577
+ --preamble-gradient-height: calc(var(--preamble-max-height) / 2);
8578
+
8579
+ position: relative;
8580
+ max-height: var(--preamble-max-height);
8581
+ overflow: hidden;
8582
+ display: -webkit-box;
8583
+ -webkit-box-orient: vertical;
8584
+ -webkit-line-clamp: 2;
8585
+ white-space: pre-wrap;
8586
+
8587
+ &::before {
8588
+ content: '';
8589
+ position: absolute;
8590
+ top: var(--preamble-max-height);
8591
+ left: 0;
8592
+ width: 100%;
8593
+ height: var(--preamble-gradient-height);
8594
+ transform: translateY(-100%); // Only visible if Preamble reaches max height
8595
+ color: ${props => props.theme.color.bg};
8596
+ mask-image: ${props => props.theme.mask.gradient.toTop};
8597
+ pointer-events: none;
8598
+ }
8599
+ `;
8600
+ const ReadMoreBtn = styled__default(ButtonReset).attrs(() => ({
8601
+ className: 'wayke__theme wayke__font--bold wayke__color--primary-text'
8602
+ }))`
8603
+ margin-top: auto;
8604
+ display: block;
8605
+ color: ${props => props.theme.color.link};
8606
+ font-size: 0.875rem;
8607
+
8608
+ &:hover {
8609
+ text-decoration: underline;
8610
+ }
8611
+ `;
8612
+
8613
+ const AccessoryCard = ({
8614
+ title,
8615
+ image,
8616
+ branding,
8617
+ price,
8618
+ preamble,
8619
+ readMoreCta
8620
+ }) => React__default.createElement(Wrapper$z, null, image ? React__default.createElement(Image$4, {
8621
+ src: image.src,
8622
+ srcSet: image.srcSet,
8623
+ alt: image.alt
8624
+ }) : React__default.createElement(ImageaPlaceholder, null, React__default.createElement(IconImage, null)), React__default.createElement(Body$5, null, React__default.createElement(Heading$7, null, React__default.createElement(Title$2, null, title), branding && React__default.createElement(Branding, {
8625
+ src: branding.src,
8626
+ srcSet: branding.srcSet,
8627
+ alt: branding.alt
8628
+ })), price && React__default.createElement(Price$2, null, price), preamble && React__default.createElement(Preamble, null, preamble), readMoreCta && React__default.createElement(ReadMoreBtn, {
8629
+ onClick: readMoreCta
8630
+ }, "L\u00E4s mer")));
8631
+
8632
+ const Image$5 = styled__default.img`
8633
+ display: block;
8634
+ width: 100%;
8635
+ `;
8636
+
8637
+ const Link$1 = styled__default.a.attrs(() => ({
8638
+ className: 'wayke__theme wayke__color--primary-text'
8639
+ }))`
8640
+ text-decoration: none;
8641
+ cursor: pointer;
8642
+ text-decoration: underline;
8643
+
8644
+ :not(:hover) {
8645
+ color: ${props => props.theme.color.textDark};
8646
+ }
8647
+
8648
+ &:hover {
8649
+ text-decoration: underline;
8650
+ }
8651
+
8652
+ ${({
8653
+ $hoverGhost
8654
+ }) => $hoverGhost && styled.css`
8655
+ &:before {
8656
+ content: '';
8657
+ position: absolute;
8658
+ top: 0;
8659
+ left: 0;
8660
+ width: 100%;
8661
+ height: 100%;
8662
+ }
8663
+ `}
8664
+ `;
8665
+
8666
+ const Wrapper$A = styled__default.ul`
8667
+ --price-box-gutter: ${size(2)};
8668
+
8669
+ list-style: none;
8670
+ padding: var(--price-box-gutter);
8671
+ margin: 0;
8672
+ border: 1px solid ${props => props.theme.color.border};
8673
+ `;
8674
+ const Row = styled__default.li`
8675
+ display: flex;
8676
+ align-items: center;
8677
+ justify-content: space-between;
8678
+ gap: var(--price-box-gutter);
8679
+
8680
+ & + & {
8681
+ margin-top: calc(var(--price-box-gutter) / 4);
8682
+ }
8683
+
8684
+ ${({
8685
+ $oldPrice
8686
+ }) => $oldPrice && styled.css`
8687
+ --price-text-decoration: line-through;
8688
+
8689
+ color: ${props => props.theme.color.textDarkLighten};
8690
+ font-size: 0.875rem;
8691
+ `}
8692
+ `;
8693
+ const Label$a = styled__default.div``;
8694
+ const Price$3 = styled__default.div.attrs(() => ({
8695
+ className: 'wayke__theme wayke__font--bold'
8696
+ }))`
8697
+ text-decoration: var(--price-text-decoration);
8698
+ `;
8699
+
8700
+ const PriceBox = ({
8701
+ prices
8702
+ }) => React__default.createElement(Wrapper$A, null, prices === null || prices === void 0 ? void 0 : prices.map((item, i) => React__default.createElement(Row, {
8703
+ key: `${item.label}-${i}`,
8704
+ "$oldPrice": item.oldPrice
8705
+ }, React__default.createElement(Label$a, null, item.label), React__default.createElement(Price$3, null, item.price))));
8706
+
8707
+ const AccesoryModal = ({
8708
+ accessory,
8709
+ onClose
8710
+ }) => {
8711
+ var _accessory$images;
8712
+ const priceList = [{
8713
+ label: 'Kontantpris',
8714
+ price: `${numberSeparator(accessory.price)} kr`,
8715
+ oldPrice: false
8716
+ }];
8717
+ if (accessory.salePrice) {
8718
+ priceList.push({
8719
+ label: 'Tidigare pris',
8720
+ price: `${numberSeparator(accessory.salePrice)} kr`,
8721
+ oldPrice: true
8722
+ });
8723
+ }
8724
+ if (accessory.assemblyPrice) {
8725
+ priceList.push({
8726
+ label: 'Monteringskostnad',
8727
+ price: `${numberSeparator(accessory.assemblyPrice)} kr`,
8728
+ oldPrice: false
8729
+ });
8730
+ }
8731
+ return React__default.createElement(Modal, {
8732
+ title: accessory.name,
8733
+ onClose: onClose
8734
+ }, ((_accessory$images = accessory.images) === null || _accessory$images === void 0 ? void 0 : _accessory$images[0]) && React__default.createElement(Repeat, null, React__default.createElement(Image$5, {
8735
+ src: `${accessory.images[0]}?w=632`,
8736
+ alt: `${accessory.name}`
8737
+ })), accessory.logotype && React__default.createElement(Repeat, null, React__default.createElement(LogoBox, {
8738
+ logo: `${accessory.logotype}?w=160`,
8739
+ logo2x: `${accessory.logotype}?w=320`,
8740
+ alt: accessory.manufacturer || 'Logotyp',
8741
+ wide: true
8742
+ })), React__default.createElement(Repeat, null, React__default.createElement(PriceBox, {
8743
+ prices: priceList
8744
+ })), React__default.createElement(Repeat, null, React__default.createElement(Content$2, {
8745
+ dangerouslySetInnerHTML: {
8746
+ __html: marked.marked(accessory.description)
8747
+ }
8748
+ })), accessory.articleNumber && React__default.createElement(Repeat, null, React__default.createElement(UtilityTextBold, {
8749
+ as: "div"
8750
+ }, "Art. nr."), React__default.createElement("div", null, accessory.articleNumber)), accessory.productPage && accessory.productPage.url && React__default.createElement(Repeat, null, React__default.createElement(Link$1, {
8751
+ href: accessory.productPage.url,
8752
+ title: `Mer information om ${accessory.name}`,
8753
+ target: "_blank",
8754
+ rel: "noopener noreferrer nofollow"
8755
+ }, accessory.productPage.title || 'Läs mer', " (\u00F6ppnas i ny flik)")));
8756
+ };
8757
+
8758
+ const AccessoriesSection = ({
8759
+ accessories
8760
+ }) => {
8761
+ const [modal, setModal] = React.useState();
8762
+ const onOpenModal = accessory => setModal(accessory);
8763
+ const onCloseModal = () => setModal(undefined);
8764
+ if (!(accessories !== null && accessories !== void 0 && accessories.length)) return null;
8765
+ return React__default.createElement(React__default.Fragment, null, modal && React__default.createElement(AccesoryModal, {
8766
+ accessory: modal,
8767
+ onClose: onCloseModal
8768
+ }), React__default.createElement(ProductPageMainSection, null, React__default.createElement(Repeat, null, React__default.createElement(H2, {
8769
+ noMargin: true
8770
+ }, "Tillbeh\u00F6r")), React__default.createElement(Repeat, null, React__default.createElement(Content$2, null, React__default.createElement("p", null, "Tillbeh\u00F6r som passar till detta fordon."))), React__default.createElement(Repeat, null, React__default.createElement(OverflowGrid, {
8771
+ columns: 1.05,
8772
+ columnsSm: 2.1,
8773
+ columnsMd: 2,
8774
+ spacing: 2,
8775
+ items: accessories.map(accessory => {
8776
+ var _accessory$images, _accessory$images2;
8777
+ return React__default.createElement(AccessoryCard, {
8778
+ key: accessory.id,
8779
+ title: accessory.name,
8780
+ image: (_accessory$images = accessory.images) !== null && _accessory$images !== void 0 && _accessory$images[0] ? {
8781
+ src: `${(_accessory$images2 = accessory.images) === null || _accessory$images2 === void 0 ? void 0 : _accessory$images2[0]}?w=539&h=303`,
8782
+ alt: accessory.name
8783
+ } : undefined,
8784
+ price: `${numberSeparator(accessory.price)} kr`,
8785
+ preamble: accessory.excerpt,
8786
+ readMoreCta: () => onOpenModal(accessory)
8787
+ });
8788
+ })
8789
+ }))));
8790
+ };
8791
+
8300
8792
  const WaykeSearchItem = ({
8301
8793
  id,
8302
8794
  hashRoute,
@@ -8382,6 +8874,7 @@ const WaykeSearchItem = ({
8382
8874
  const branch = centralStorageVehicle === null || centralStorageVehicle === void 0 ? void 0 : centralStorageVehicle.branch;
8383
8875
  const {
8384
8876
  title,
8877
+ accessories,
8385
8878
  shortDescription,
8386
8879
  media,
8387
8880
  description,
@@ -8506,7 +8999,9 @@ const WaykeSearchItem = ({
8506
8999
  var _ecomContext$current2;
8507
9000
  return (_ecomContext$current2 = ecomContext.current) === null || _ecomContext$current2 === void 0 ? void 0 : _ecomContext$current2.start();
8508
9001
  }
8509
- }, "K\u00F6p bilen online"))), React__default.createElement(PackageOptions, {
9002
+ }, "K\u00F6p bilen online"))), React__default.createElement(AccessoriesSection, {
9003
+ accessories: accessories
9004
+ }), React__default.createElement(PackageOptions, {
8510
9005
  packageOptions: packageOptions
8511
9006
  }), React__default.createElement(ManufacturerPackageOption, {
8512
9007
  packageOption: manufacturer === null || manufacturer === void 0 ? void 0 : manufacturer.packageOption