@wayke-se/components-react 3.5.3 → 3.6.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 (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,
@@ -3416,47 +3434,10 @@ const ImageFull = styled__default.img`
3416
3434
  object-fit: cover;
3417
3435
  `;
3418
3436
  // Arrow Nav
3419
- const Arrow = styled__default(ButtonReset)`
3437
+ const Arrow = styled__default.div`
3420
3438
  position: absolute;
3421
3439
  top: 50%;
3422
3440
  transform: translateY(-50%);
3423
- display: flex;
3424
- align-items: center;
3425
- justify-content: center;
3426
- width: ${size(4)};
3427
- height: ${size(4)};
3428
- border-radius: 50%;
3429
- font-size: 1rem;
3430
- line-height: 1;
3431
- background-color: rgba(255, 255, 255, 0.4);
3432
- backdrop-filter: blur(5px);
3433
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
3434
- color: ${props => props.theme.color.textDark};
3435
- transform-origin: 50% 50%;
3436
- transition: transform 200ms ease;
3437
-
3438
- :before {
3439
- content: '';
3440
- position: absolute;
3441
- top: 0;
3442
- bottom: 0;
3443
- left: 0;
3444
- right: 0;
3445
- border-radius: 50%;
3446
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
3447
- opacity: 0;
3448
- transition: opacity 200ms ease;
3449
- }
3450
-
3451
- :hover {
3452
- :before {
3453
- opacity: 1;
3454
- }
3455
- }
3456
-
3457
- :active {
3458
- transform: translateY(-50%) scale(0.95);
3459
- }
3460
3441
 
3461
3442
  ${props => props.theme.breakpoint.LtSm} {
3462
3443
  display: none;
@@ -3560,6 +3541,46 @@ const EnableNavigationButton = styled__default.div`
3560
3541
  z-index: 1;
3561
3542
  `;
3562
3543
 
3544
+ const NavButton = styled__default(ButtonReset)`
3545
+ position: relative;
3546
+ display: flex;
3547
+ align-items: center;
3548
+ justify-content: center;
3549
+ width: ${size(4)};
3550
+ height: ${size(4)};
3551
+ border-radius: 50%;
3552
+ background-color: ${props => props.theme.color.bg};
3553
+ color: ${props => props.theme.color.textDark};
3554
+ font-size: 0.75rem;
3555
+ box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
3556
+ transition: transform 200ms ease;
3557
+
3558
+ &::before {
3559
+ content: '';
3560
+ position: absolute;
3561
+ top: 0;
3562
+ bottom: 0;
3563
+ left: 0;
3564
+ right: 0;
3565
+ border-radius: 50%;
3566
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
3567
+ opacity: 0;
3568
+ transition: opacity 200ms ease;
3569
+ }
3570
+
3571
+ &:enabled {
3572
+ &:hover {
3573
+ &::before {
3574
+ opacity: 1;
3575
+ }
3576
+ }
3577
+ }
3578
+
3579
+ &:active {
3580
+ transform: scale(0.95);
3581
+ }
3582
+ `;
3583
+
3563
3584
  const Wrapper$h = styled__default.div`
3564
3585
  position: fixed;
3565
3586
  top: 0;
@@ -4769,17 +4790,17 @@ const Gallery = ({
4769
4790
  }))), navigationDisabled && mediaLength > 1 && React__default.createElement(EnableNavigationButton, null, React__default.createElement(ButtonSecondary, {
4770
4791
  onClick: onEnableNavigation,
4771
4792
  title: "St\u00E4ng"
4772
- }, React__default.createElement(ButtonContent, null, "St\u00E4ng")))), !navigationDisabled && mediaLength > 1 && React__default.createElement(React__default.Fragment, null, React__default.createElement(ArrowLeft, {
4793
+ }, 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, {
4773
4794
  onClick: prevImage,
4774
4795
  title: "F\u00F6reg\u00E5ende bild"
4775
4796
  }, React__default.createElement(IconChevronLeft, {
4776
4797
  block: true
4777
- })), React__default.createElement(ArrowRight, {
4798
+ }))), React__default.createElement(ArrowRight, null, React__default.createElement(NavButton, {
4778
4799
  onClick: nextImage,
4779
4800
  title: "N\u00E4sta bild"
4780
4801
  }, React__default.createElement(IconChevronRight, {
4781
4802
  block: true
4782
- })))), React__default.createElement(Alt, null, React__default.createElement(QuickNav, {
4803
+ }))))), React__default.createElement(Alt, null, React__default.createElement(QuickNav, {
4783
4804
  ref: quickNavRef
4784
4805
  }, !!(media !== null && media !== void 0 && media.length) ? media.map((m, i) => {
4785
4806
  var _m$files$0$formats$fi2;
@@ -4928,6 +4949,24 @@ const SEARCH_ITEM_QUERY = client.gql`
4928
4949
  phonenumber
4929
4950
  avatar
4930
4951
  }
4952
+ accessories {
4953
+ articleNumber
4954
+ description
4955
+ excerpt
4956
+ id
4957
+ images
4958
+ logotype
4959
+ manufacturer
4960
+ model
4961
+ name
4962
+ price
4963
+ assemblyPrice
4964
+ productPage {
4965
+ title
4966
+ url
4967
+ }
4968
+ salePrice
4969
+ }
4931
4970
  manufacturer {
4932
4971
  description
4933
4972
  logotype
@@ -6784,69 +6823,231 @@ const SectionHeader = ({
6784
6823
  onClick: onClick
6785
6824
  }, React__default.createElement(ButtonContent, null, actionTitle))));
6786
6825
 
6787
- const OverflowGrid = styled__default.div`
6788
- ${props => props.theme.breakpoint.LtMd} {
6789
- ${Wrapper} & {
6790
- margin-left: ${size(-3)};
6791
- margin-right: ${size(-2)};
6792
- }
6826
+ const Wrapper$v = styled__default.div`
6827
+ --container-gutter: ${size(2)};
6828
+ --bg: ${props => props.theme.color.bg};
6829
+
6830
+ ${props => props.theme.breakpoint.Sm} {
6831
+ --container-gutter: ${size(3)};
6793
6832
  }
6794
6833
 
6834
+ position: relative;
6835
+
6836
+ ${({
6837
+ $accentBg
6838
+ }) => $accentBg && styled.css`
6839
+ --bg: ${props => props.theme.color.accent};
6840
+ `}
6841
+ `;
6842
+ const Item$b = styled__default.li`
6843
+ flex: 1 0 auto;
6844
+ width: 100%;
6845
+ max-width: 100%;
6846
+ scroll-snap-align: start;
6847
+
6795
6848
  ${props => props.theme.breakpoint.LtSm} {
6796
- ${Wrapper} & {
6797
- margin-left: ${size(-2)};
6798
- margin-right: ${size(-1)};
6849
+ &:is(:only-child, #important) {
6850
+ width: 100%;
6851
+ max-width: 100%;
6799
6852
  }
6800
6853
  }
6801
6854
  `;
6802
- const OverflowGridList = styled__default.ul`
6855
+ const List$9 = styled__default.ul`
6803
6856
  display: flex;
6804
- align-items: flex-start;
6857
+ align-items: stretch;
6805
6858
  list-style: none;
6806
- padding: 0;
6807
- margin: ${size(-1)};
6859
+ padding: 0 var(--container-gutter);
6860
+ margin: 0;
6861
+ overflow: auto;
6862
+ scroll-snap-type: x mandatory;
6863
+ scroll-padding-left: var(--container-gutter);
6864
+ scrollbar-width: none;
6865
+ -ms-overflow-style: none;
6808
6866
 
6809
- ${props => props.theme.breakpoint.LtMd} {
6810
- ${Wrapper} & {
6811
- overflow: auto;
6812
- -webkit-overflow-scrolling: touch;
6813
- padding: 0 ${size(3)};
6867
+ &::-webkit-scrollbar {
6868
+ display: none;
6869
+ }
6814
6870
 
6815
- :after {
6816
- content: '';
6817
- flex: 0 0 auto;
6818
- height: 1px;
6819
- width: ${size(2)};
6871
+ ${({
6872
+ $columns
6873
+ }) => $columns && styled.css`
6874
+ ${Item$b} {
6875
+ width: ${100 / $columns}%;
6876
+ max-width: ${100 / $columns}%;
6820
6877
  }
6821
- }
6822
- }
6878
+ `}
6823
6879
 
6824
- ${props => props.theme.breakpoint.LtSm} {
6825
- ${Wrapper} & {
6826
- padding: 0 ${size(2)};
6880
+ ${({
6881
+ $columnsSm
6882
+ }) => $columnsSm && styled.css`
6883
+ ${props => props.theme.breakpoint.Sm} {
6884
+ ${Item$b} {
6885
+ width: ${100 / $columnsSm}%;
6886
+ max-width: ${100 / $columnsSm}%;
6887
+ }
6888
+ }
6889
+ `}
6827
6890
 
6828
- :after {
6829
- width: ${size(1)};
6891
+ ${({
6892
+ $columnsMd
6893
+ }) => $columnsMd && styled.css`
6894
+ ${props => props.theme.breakpoint.Md} {
6895
+ ${Item$b} {
6896
+ width: ${100 / $columnsMd}%;
6897
+ max-width: ${100 / $columnsMd}%;
6898
+ }
6830
6899
  }
6831
- }
6832
- }
6900
+ `}
6833
6901
  `;
6834
- const OverflowGridItem = styled__default.li`
6835
- flex: 1 0 auto;
6836
- width: calc(100% - ${size(2)});
6837
- max-width: calc(100% - ${size(2)});
6838
- padding: ${size(1)};
6902
+ const ListWrapper = styled__default.div`
6903
+ position: relative;
6904
+ overflow: hidden;
6905
+ margin: 0 calc(var(--container-gutter) * -1);
6839
6906
 
6840
- ${props => props.theme.breakpoint.Sm} {
6841
- width: calc(50% - ${size(3)});
6842
- max-width: calc(50% - ${size(3)});
6907
+ ${props => props.theme.breakpoint.Md} {
6908
+ &::before,
6909
+ &::after {
6910
+ content: '';
6911
+ position: absolute;
6912
+ top: 0;
6913
+ bottom: 0;
6914
+ width: var(--container-gutter);
6915
+ background-color: var(--bg);
6916
+ z-index: 1;
6917
+ }
6918
+
6919
+ &::before {
6920
+ left: 0;
6921
+
6922
+ ${({
6923
+ $spacing
6924
+ }) => $spacing ? styled.css`
6925
+ mask-image: linear-gradient(to right, #000 ${size($spacing)}, transparent);
6926
+ ` : styled.css`
6927
+ mask-image: ${props => props.theme.mask.gradient.toRight};
6928
+ `}
6929
+ }
6930
+
6931
+ &::after {
6932
+ right: 0;
6933
+
6934
+ ${({
6935
+ $spacing
6936
+ }) => $spacing ? styled.css`
6937
+ mask-image: linear-gradient(to left, #000 ${size($spacing)}, transparent);
6938
+ ` : styled.css`
6939
+ mask-image: ${props => props.theme.mask.gradient.toLeft};
6940
+ `}
6941
+ }
6843
6942
  }
6844
6943
 
6845
- ${props => props.theme.breakpoint.Md} {
6846
- width: 33.333%;
6847
- max-width: 33.333%;
6944
+ ${({
6945
+ $spacing
6946
+ }) => $spacing && styled.css`
6947
+ ${List$9} {
6948
+ margin: 0 -${size($spacing / 2)};
6949
+ }
6950
+
6951
+ ${Item$b} {
6952
+ padding: 0 ${size($spacing / 2)};
6953
+ }
6954
+ `}
6955
+ `;
6956
+ const NavBtn = styled__default.div`
6957
+ position: absolute;
6958
+ top: 50%;
6959
+ z-index: 2;
6960
+
6961
+ ${props => props.theme.breakpoint.LtSm} {
6962
+ display: none;
6848
6963
  }
6849
6964
  `;
6965
+ const PrevBtn = styled__default(NavBtn)`
6966
+ left: 0;
6967
+ transform: translate(-50%, -50%);
6968
+ `;
6969
+ const NextBtn = styled__default(NavBtn)`
6970
+ right: 0;
6971
+ transform: translate(50%, -50%);
6972
+ `;
6973
+
6974
+ const OverflowGrid = ({
6975
+ items,
6976
+ itemKeyBase,
6977
+ spacing,
6978
+ columns,
6979
+ columnsSm,
6980
+ columnsMd,
6981
+ accentBg
6982
+ }) => {
6983
+ const overflowElement = React.useRef(null);
6984
+ const onPrev = React.useCallback(() => {
6985
+ var _overflowElement$curr, _overflowElement$curr2;
6986
+ const itemWidth = ((_overflowElement$curr = overflowElement.current) === null || _overflowElement$curr === void 0 ? void 0 : _overflowElement$curr.children[0].clientWidth) || 0;
6987
+ const scrollLeft = ((_overflowElement$curr2 = overflowElement.current) === null || _overflowElement$curr2 === void 0 ? void 0 : _overflowElement$curr2.scrollLeft) || 0;
6988
+ if (scrollLeft > 0) {
6989
+ var _overflowElement$curr3;
6990
+ (_overflowElement$curr3 = overflowElement.current) === null || _overflowElement$curr3 === void 0 ? void 0 : _overflowElement$curr3.scroll({
6991
+ left: scrollLeft - itemWidth,
6992
+ behavior: 'smooth'
6993
+ });
6994
+ }
6995
+ }, []);
6996
+ const onNext = React.useCallback(() => {
6997
+ var _overflowElement$curr4, _overflowElement$curr5, _overflowElement$curr6, _overflowElement$curr7;
6998
+ const itemWidth = ((_overflowElement$curr4 = overflowElement.current) === null || _overflowElement$curr4 === void 0 ? void 0 : _overflowElement$curr4.children[0].clientWidth) || 0;
6999
+ const scrollWidth = ((_overflowElement$curr5 = overflowElement.current) === null || _overflowElement$curr5 === void 0 ? void 0 : _overflowElement$curr5.scrollWidth) || 0;
7000
+ const scrollLeft = ((_overflowElement$curr6 = overflowElement.current) === null || _overflowElement$curr6 === void 0 ? void 0 : _overflowElement$curr6.scrollLeft) || 0;
7001
+ const overflowElementWidth = ((_overflowElement$curr7 = overflowElement.current) === null || _overflowElement$curr7 === void 0 ? void 0 : _overflowElement$curr7.offsetWidth) || 0;
7002
+ const overflowElementScrollWidth = scrollWidth - overflowElementWidth;
7003
+ if (overflowElementScrollWidth !== scrollLeft) {
7004
+ var _overflowElement$curr8;
7005
+ (_overflowElement$curr8 = overflowElement.current) === null || _overflowElement$curr8 === void 0 ? void 0 : _overflowElement$curr8.scroll({
7006
+ left: scrollLeft + itemWidth,
7007
+ behavior: 'smooth'
7008
+ });
7009
+ }
7010
+ }, []);
7011
+ // Hide navigation buttons depending on scroll position
7012
+ const [hidePrevNav, setHidePrevNav] = React.useState(true);
7013
+ const [hideNextNav, setHideNextNav] = React.useState(true);
7014
+ const onScroll = () => {
7015
+ var _overflowElement$curr9, _overflowElement$curr10, _overflowElement$curr11;
7016
+ const scrollLeft = ((_overflowElement$curr9 = overflowElement.current) === null || _overflowElement$curr9 === void 0 ? void 0 : _overflowElement$curr9.scrollLeft) || 0;
7017
+ const scrollWidth = ((_overflowElement$curr10 = overflowElement.current) === null || _overflowElement$curr10 === void 0 ? void 0 : _overflowElement$curr10.scrollWidth) || 0;
7018
+ const overflowElementWidth = ((_overflowElement$curr11 = overflowElement.current) === null || _overflowElement$curr11 === void 0 ? void 0 : _overflowElement$curr11.offsetWidth) || 0;
7019
+ const overflowElementScrollWidth = scrollWidth - overflowElementWidth;
7020
+ setHidePrevNav(scrollLeft == 0 ? true : false);
7021
+ setHideNextNav(overflowElementScrollWidth == scrollLeft ? true : false);
7022
+ };
7023
+ React.useEffect(() => {
7024
+ var _overflowElement$curr12;
7025
+ onScroll();
7026
+ (_overflowElement$curr12 = overflowElement.current) === null || _overflowElement$curr12 === void 0 ? void 0 : _overflowElement$curr12.addEventListener('scroll', onScroll);
7027
+ return () => {
7028
+ var _overflowElement$curr13;
7029
+ return (_overflowElement$curr13 = overflowElement.current) === null || _overflowElement$curr13 === void 0 ? void 0 : _overflowElement$curr13.removeEventListener('scroll', onScroll);
7030
+ };
7031
+ }, []);
7032
+ return React__default.createElement(Wrapper$v, {
7033
+ "$accentBg": accentBg
7034
+ }, React__default.createElement(ListWrapper, {
7035
+ "$spacing": spacing
7036
+ }, React__default.createElement(List$9, {
7037
+ ref: overflowElement,
7038
+ "$columns": columns,
7039
+ "$columnsSm": columnsSm,
7040
+ "$columnsMd": columnsMd
7041
+ }, items.map((item, i) => React__default.createElement(Item$b, {
7042
+ key: itemKeyBase ? `${itemKeyBase}-${i}` : `overflow-grid-item-${i}`
7043
+ }, item)))), !hidePrevNav && React__default.createElement(PrevBtn, null, React__default.createElement(NavButton, {
7044
+ onClick: onPrev,
7045
+ title: "Previous"
7046
+ }, React__default.createElement(IconChevronLeft, null))), !hideNextNav && React__default.createElement(NextBtn, null, React__default.createElement(NavButton, {
7047
+ onClick: onNext,
7048
+ title: "Next"
7049
+ }, React__default.createElement(IconChevronRight, null))));
7050
+ };
6850
7051
 
6851
7052
  const RelatedSearchContext = React.createContext({
6852
7053
  moreLikeThisUrl: false,
@@ -6920,37 +7121,43 @@ const Related = ({
6920
7121
  actionTitle: "Visa alla"
6921
7122
  }, React__default.createElement(H2, {
6922
7123
  noMargin: true
6923
- }, "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 => {
6924
- var _document$featuredIma, _document$featuredIma2, _document$featuredIma3, _document$branches, _document$branches$;
6925
- const prefix = pathRoute ? `/${pathRoute}` : '/';
6926
- const r = regexPathGuid();
6927
- 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}`;
6928
- return React__default.createElement(OverflowGridItem, {
6929
- key: document._id
6930
- }, React__default.createElement(ProductCard, {
6931
- id: document._id,
6932
- onClick: onItemClicked,
6933
- title: document.title,
6934
- href: pathRoute ? pathRouteUrl : hashRoute ? `#${document._id}` : undefined,
6935
- 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,
6936
- description: document.shortDescription,
6937
- 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,
6938
- uspList: [{
6939
- title: document.modelYear
6940
- }, {
6941
- title: `${numberSeparator(document.mileage)} mil`
6942
- }, {
6943
- title: document.gearboxType
6944
- }, {
6945
- title: document.fuelType
6946
- }],
6947
- price: `${numberSeparator(document.price)} kr`,
6948
- oldPrice: document.oldPrice !== undefined && document.price < document.oldPrice ? `${numberSeparator(document.oldPrice)} kr` : undefined,
6949
- leasingPrice: document.leasingPrice !== undefined ? `${numberSeparator(document.leasingPrice)} kr/mån` : undefined,
6950
- businessLeasingPrice: document.businessLeasingPrice !== undefined ? `${numberSeparator(document.businessLeasingPrice)} kr/mån` : undefined,
6951
- pathRoute: pathRoute
6952
- }));
6953
- }))))));
7124
+ }, "Senast inkomna"))), React__default.createElement(Repeat, null, React__default.createElement(OverflowGrid, {
7125
+ accentBg: true,
7126
+ columns: 1.05,
7127
+ columnsSm: 2.1,
7128
+ columnsMd: 3,
7129
+ spacing: 2,
7130
+ items: response === null || response === void 0 ? void 0 : response.documentList.documents.map(document => {
7131
+ var _document$featuredIma, _document$featuredIma2, _document$featuredIma3, _document$branches, _document$branches$;
7132
+ const prefix = pathRoute ? `/${pathRoute}` : '/';
7133
+ const r = regexPathGuid();
7134
+ 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}`;
7135
+ return React__default.createElement(ProductCard, {
7136
+ key: document._id,
7137
+ id: document._id,
7138
+ onClick: onItemClicked,
7139
+ title: document.title,
7140
+ href: pathRoute ? pathRouteUrl : hashRoute ? `#${document._id}` : undefined,
7141
+ 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,
7142
+ description: document.shortDescription,
7143
+ 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,
7144
+ uspList: [{
7145
+ title: document.modelYear
7146
+ }, {
7147
+ title: `${numberSeparator(document.mileage)} mil`
7148
+ }, {
7149
+ title: document.gearboxType
7150
+ }, {
7151
+ title: document.fuelType
7152
+ }],
7153
+ price: `${numberSeparator(document.price)} kr`,
7154
+ oldPrice: document.oldPrice !== undefined && document.price < document.oldPrice ? `${numberSeparator(document.oldPrice)} kr` : undefined,
7155
+ leasingPrice: document.leasingPrice !== undefined ? `${numberSeparator(document.leasingPrice)} kr/mån` : undefined,
7156
+ businessLeasingPrice: document.businessLeasingPrice !== undefined ? `${numberSeparator(document.businessLeasingPrice)} kr/mån` : undefined,
7157
+ pathRoute: pathRoute
7158
+ });
7159
+ })
7160
+ }))));
6954
7161
  };
6955
7162
 
6956
7163
  const PackageOptions = ({
@@ -7004,7 +7211,7 @@ const getBg = severity => {
7004
7211
  }
7005
7212
  return bg;
7006
7213
  };
7007
- const Wrapper$v = styled__default.div.attrs(() => ({
7214
+ const Wrapper$w = styled__default.div.attrs(() => ({
7008
7215
  className: 'wayke__theme wayke__font--bold'
7009
7216
  }))`
7010
7217
  display: inline-block;
@@ -7019,7 +7226,7 @@ const Wrapper$v = styled__default.div.attrs(() => ({
7019
7226
  const Badge = ({
7020
7227
  label,
7021
7228
  severity
7022
- }) => React__default.createElement(Wrapper$v, {
7229
+ }) => React__default.createElement(Wrapper$w, {
7023
7230
  severity: severity
7024
7231
  }, label);
7025
7232
 
@@ -7119,7 +7326,7 @@ const SettingsContext = React.createContext({});
7119
7326
 
7120
7327
  const useSettings = () => React.useContext(SettingsContext);
7121
7328
 
7122
- const Wrapper$w = styled__default.a`
7329
+ const Wrapper$x = styled__default.a`
7123
7330
  display: block;
7124
7331
  `;
7125
7332
  const Image$3 = styled__default.img`
@@ -7166,7 +7373,7 @@ const StaticMap = ({
7166
7373
  longitude
7167
7374
  } = position;
7168
7375
  if (visible && googleMapsApiKey) {
7169
- return React__default.createElement(Wrapper$w, {
7376
+ return React__default.createElement(Wrapper$x, {
7170
7377
  href: `http://maps.google.com/maps?q=${latitude},${longitude}`,
7171
7378
  title: "Visa p\u00E5 Google Maps",
7172
7379
  target: "_blank",
@@ -7238,6 +7445,24 @@ const SEARCH_ITEM_BRANCH_QUERY = client.gql`
7238
7445
  phonenumber
7239
7446
  avatar
7240
7447
  }
7448
+ accessories {
7449
+ articleNumber
7450
+ description
7451
+ excerpt
7452
+ id
7453
+ images
7454
+ logotype
7455
+ manufacturer
7456
+ model
7457
+ name
7458
+ price
7459
+ assemblyPrice
7460
+ productPage {
7461
+ title
7462
+ url
7463
+ }
7464
+ salePrice
7465
+ }
7241
7466
  branch {
7242
7467
  connections {
7243
7468
  id
@@ -7956,7 +8181,7 @@ const MetadataItem = ({
7956
8181
  })));
7957
8182
  };
7958
8183
 
7959
- const Wrapper$x = styled__default.div`
8184
+ const Wrapper$y = styled__default.div`
7960
8185
  overflow: hidden;
7961
8186
  margin-top: ${size(-1)};
7962
8187
  margin-left: ${size(-1)};
@@ -7967,7 +8192,7 @@ const Wrapper$x = styled__default.div`
7967
8192
  margin-right: ${size(-2)};
7968
8193
  }
7969
8194
  `;
7970
- const List$9 = styled__default.ul`
8195
+ const List$a = styled__default.ul`
7971
8196
  list-style: none;
7972
8197
  padding: 0;
7973
8198
  margin: 0;
@@ -7981,7 +8206,7 @@ const List$9 = styled__default.ul`
7981
8206
  padding-right: ${size(1)};
7982
8207
  }
7983
8208
  `;
7984
- const Item$b = styled__default.li`
8209
+ const Item$c = styled__default.li`
7985
8210
  display: inline-block;
7986
8211
  vertical-align: bottom;
7987
8212
  font-size: 1rem;
@@ -8025,7 +8250,7 @@ const Tabs = ({
8025
8250
  tabs,
8026
8251
  active,
8027
8252
  onClick
8028
- }) => React.createElement(Wrapper$x, null, React.createElement(List$9, null, tabs.map(tab => React.createElement(Item$b, {
8253
+ }) => React.createElement(Wrapper$y, null, React.createElement(List$a, null, tabs.map(tab => React.createElement(Item$c, {
8029
8254
  key: tab.name
8030
8255
  }, React.createElement(Action$8, {
8031
8256
  title: tab.displayName,
@@ -8119,7 +8344,7 @@ const PdfListItem = styled__default.li.attrs(() => ({
8119
8344
  flex: 0 0 100%;
8120
8345
  }
8121
8346
  `;
8122
- const List$a = styled__default.ul`
8347
+ const List$b = styled__default.ul`
8123
8348
  list-style: none;
8124
8349
  padding: 0;
8125
8350
  display: flex;
@@ -8147,7 +8372,7 @@ const PdfSubtitle = styled__default.div`
8147
8372
  color: ${props => props.theme.color.textDarkLighten};
8148
8373
  `;
8149
8374
  const PdfColumn = styled__default.div`
8150
- flex 0 0 auto;
8375
+ flex: 0 0 auto;
8151
8376
  &:first-child {
8152
8377
  flex: 1 1 auto;
8153
8378
  }
@@ -8184,7 +8409,7 @@ const PdfDownloadItem = ({
8184
8409
  };
8185
8410
  const DocumentList = ({
8186
8411
  documents
8187
- }) => React__default.createElement(List$a, null, documents.map((document, i) => React__default.createElement(PdfDownloadItem, {
8412
+ }) => React__default.createElement(List$b, null, documents.map((document, i) => React__default.createElement(PdfDownloadItem, {
8188
8413
  key: `${document.url}-${i}`,
8189
8414
  document: document
8190
8415
  })));
@@ -8228,6 +8453,273 @@ const Documents = ({
8228
8453
  }))));
8229
8454
  };
8230
8455
 
8456
+ const Wrapper$z = styled__default.div`
8457
+ display: flex;
8458
+ flex-direction: column;
8459
+ gap: ${size(2)};
8460
+ height: 100%;
8461
+ `;
8462
+ const imageBaseStyling = styled.css`
8463
+ flex-shrink: 0;
8464
+ aspect-ratio: 16 / 9;
8465
+ border-radius: 3px;
8466
+ `;
8467
+ const Image$4 = styled__default.img`
8468
+ ${imageBaseStyling};
8469
+ display: block;
8470
+ width: 100%;
8471
+ object-fit: cover;
8472
+ `;
8473
+ const ImageaPlaceholder = styled__default.div`
8474
+ ${imageBaseStyling};
8475
+ display: flex;
8476
+ align-items: center;
8477
+ justify-content: center;
8478
+ color: ${props => props.theme.color.textDarkLighten};
8479
+ font-size: 2rem;
8480
+ background-color: ${props => props.theme.color.accent};
8481
+ `;
8482
+ const Body$5 = styled__default.div`
8483
+ flex: 1 1 auto;
8484
+ display: flex;
8485
+ align-items: flex-start;
8486
+ flex-direction: column;
8487
+ gap: ${size(1)};
8488
+ `;
8489
+ const Heading$7 = styled__default.div`
8490
+ display: flex;
8491
+ align-items: center;
8492
+ justify-content: space-between;
8493
+ gap: ${size(2)};
8494
+ `;
8495
+ const Title$2 = styled__default.div.attrs(() => ({
8496
+ className: 'wayke__theme wayke__font--bold'
8497
+ }))`
8498
+ font-size: 1.125rem;
8499
+ `;
8500
+ const Branding = styled__default.img`
8501
+ display: block;
8502
+ `;
8503
+ const Price$2 = styled__default.div.attrs(() => ({
8504
+ className: 'wayke__theme wayke__font--bold'
8505
+ }))``;
8506
+ const Preamble = styled__default.div`
8507
+ --preamble-max-height: ${size(6)};
8508
+ --preamble-gradient-height: calc(var(--preamble-max-height) / 2);
8509
+
8510
+ position: relative;
8511
+ max-height: var(--preamble-max-height);
8512
+ overflow: hidden;
8513
+ display: -webkit-box;
8514
+ -webkit-box-orient: vertical;
8515
+ -webkit-line-clamp: 2;
8516
+ white-space: pre-wrap;
8517
+
8518
+ &::before {
8519
+ content: '';
8520
+ position: absolute;
8521
+ top: var(--preamble-max-height);
8522
+ left: 0;
8523
+ width: 100%;
8524
+ height: var(--preamble-gradient-height);
8525
+ transform: translateY(-100%); // Only visible if Preamble reaches max height
8526
+ color: ${props => props.theme.color.bg};
8527
+ mask-image: ${props => props.theme.mask.gradient.toTop};
8528
+ pointer-events: none;
8529
+ }
8530
+ `;
8531
+ const ReadMoreBtn = styled__default(ButtonReset).attrs(() => ({
8532
+ className: 'wayke__theme wayke__font--bold wayke__color--primary-text'
8533
+ }))`
8534
+ margin-top: auto;
8535
+ display: block;
8536
+ color: ${props => props.theme.color.link};
8537
+ font-size: 0.875rem;
8538
+
8539
+ &:hover {
8540
+ text-decoration: underline;
8541
+ }
8542
+ `;
8543
+
8544
+ const AccessoryCard = ({
8545
+ title,
8546
+ image,
8547
+ branding,
8548
+ price,
8549
+ preamble,
8550
+ readMoreCta
8551
+ }) => React__default.createElement(Wrapper$z, null, image ? React__default.createElement(Image$4, {
8552
+ src: image.src,
8553
+ srcSet: image.srcSet,
8554
+ alt: image.alt
8555
+ }) : 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, {
8556
+ src: branding.src,
8557
+ srcSet: branding.srcSet,
8558
+ alt: branding.alt
8559
+ })), price && React__default.createElement(Price$2, null, price), preamble && React__default.createElement(Preamble, null, preamble), readMoreCta && React__default.createElement(ReadMoreBtn, {
8560
+ onClick: readMoreCta
8561
+ }, "L\u00E4s mer")));
8562
+
8563
+ const Image$5 = styled__default.img`
8564
+ display: block;
8565
+ width: 100%;
8566
+ `;
8567
+
8568
+ const Link$1 = styled__default.a.attrs(() => ({
8569
+ className: 'wayke__theme wayke__color--primary-text'
8570
+ }))`
8571
+ text-decoration: none;
8572
+ cursor: pointer;
8573
+ text-decoration: underline;
8574
+
8575
+ :not(:hover) {
8576
+ color: ${props => props.theme.color.textDark};
8577
+ }
8578
+
8579
+ &:hover {
8580
+ text-decoration: underline;
8581
+ }
8582
+
8583
+ ${({
8584
+ $hoverGhost
8585
+ }) => $hoverGhost && styled.css`
8586
+ &:before {
8587
+ content: '';
8588
+ position: absolute;
8589
+ top: 0;
8590
+ left: 0;
8591
+ width: 100%;
8592
+ height: 100%;
8593
+ }
8594
+ `}
8595
+ `;
8596
+
8597
+ const Wrapper$A = styled__default.ul`
8598
+ --price-box-gutter: ${size(2)};
8599
+
8600
+ list-style: none;
8601
+ padding: var(--price-box-gutter);
8602
+ margin: 0;
8603
+ border: 1px solid ${props => props.theme.color.border};
8604
+ `;
8605
+ const Row = styled__default.li`
8606
+ display: flex;
8607
+ align-items: center;
8608
+ justify-content: space-between;
8609
+ gap: var(--price-box-gutter);
8610
+
8611
+ & + & {
8612
+ margin-top: calc(var(--price-box-gutter) / 4);
8613
+ }
8614
+
8615
+ ${({
8616
+ $oldPrice
8617
+ }) => $oldPrice && styled.css`
8618
+ --price-text-decoration: line-through;
8619
+
8620
+ color: ${props => props.theme.color.textDarkLighten};
8621
+ font-size: 0.875rem;
8622
+ `}
8623
+ `;
8624
+ const Label$a = styled__default.div``;
8625
+ const Price$3 = styled__default.div.attrs(() => ({
8626
+ className: 'wayke__theme wayke__font--bold'
8627
+ }))`
8628
+ text-decoration: var(--price-text-decoration);
8629
+ `;
8630
+
8631
+ const PriceBox = ({
8632
+ prices
8633
+ }) => React__default.createElement(Wrapper$A, null, prices === null || prices === void 0 ? void 0 : prices.map((item, i) => React__default.createElement(Row, {
8634
+ key: `${item.label}-${i}`,
8635
+ "$oldPrice": item.oldPrice
8636
+ }, React__default.createElement(Label$a, null, item.label), React__default.createElement(Price$3, null, item.price))));
8637
+
8638
+ const AccesoryModal = ({
8639
+ accessory,
8640
+ onClose
8641
+ }) => {
8642
+ var _accessory$images;
8643
+ const priceList = [{
8644
+ label: 'Kontantpris',
8645
+ price: `${numberSeparator(accessory.price)} kr`,
8646
+ oldPrice: false
8647
+ }];
8648
+ if (accessory.salePrice) {
8649
+ priceList.push({
8650
+ label: 'Tidigare pris',
8651
+ price: `${numberSeparator(accessory.salePrice)} kr`,
8652
+ oldPrice: true
8653
+ });
8654
+ }
8655
+ if (accessory.assemblyPrice) {
8656
+ priceList.push({
8657
+ label: 'Monteringskostnad',
8658
+ price: `${numberSeparator(accessory.assemblyPrice)} kr`,
8659
+ oldPrice: false
8660
+ });
8661
+ }
8662
+ return React__default.createElement(Modal, {
8663
+ title: accessory.name,
8664
+ onClose: onClose
8665
+ }, ((_accessory$images = accessory.images) === null || _accessory$images === void 0 ? void 0 : _accessory$images[0]) && React__default.createElement(Repeat, null, React__default.createElement(Image$5, {
8666
+ src: `${accessory.images[0]}?w=632`,
8667
+ alt: `${accessory.name}`
8668
+ })), accessory.logotype && React__default.createElement(Repeat, null, React__default.createElement(LogoBox, {
8669
+ logo: `${accessory.logotype}?w=160`,
8670
+ logo2x: `${accessory.logotype}?w=320`,
8671
+ alt: accessory.manufacturer || 'Logotyp',
8672
+ wide: true
8673
+ })), React__default.createElement(Repeat, null, React__default.createElement(PriceBox, {
8674
+ prices: priceList
8675
+ })), React__default.createElement(Repeat, null, React__default.createElement(Content$2, {
8676
+ dangerouslySetInnerHTML: {
8677
+ __html: marked.marked(accessory.description)
8678
+ }
8679
+ })), accessory.articleNumber && React__default.createElement(Repeat, null, React__default.createElement(UtilityTextBold, {
8680
+ as: "div"
8681
+ }, "Art. nr."), React__default.createElement("div", null, accessory.articleNumber)), accessory.productPage && accessory.productPage.url && React__default.createElement(Repeat, null, React__default.createElement(Link$1, {
8682
+ href: accessory.productPage.url,
8683
+ title: `Mer information om ${accessory.name}`,
8684
+ target: "_blank",
8685
+ rel: "noopener noreferrer nofollow"
8686
+ }, accessory.productPage.title || 'Läs mer', " (\u00F6ppnas i ny flik)")));
8687
+ };
8688
+
8689
+ const AccessoriesSection = ({
8690
+ accessories
8691
+ }) => {
8692
+ const [modal, setModal] = React.useState();
8693
+ const onOpenModal = accessory => setModal(accessory);
8694
+ const onCloseModal = () => setModal(undefined);
8695
+ if (!(accessories !== null && accessories !== void 0 && accessories.length)) return null;
8696
+ return React__default.createElement(React__default.Fragment, null, modal && React__default.createElement(AccesoryModal, {
8697
+ accessory: modal,
8698
+ onClose: onCloseModal
8699
+ }), React__default.createElement(ProductPageMainSection, null, React__default.createElement(Repeat, null, React__default.createElement(H2, {
8700
+ noMargin: true
8701
+ }, "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, {
8702
+ columns: 1.05,
8703
+ columnsSm: 2.1,
8704
+ columnsMd: 2,
8705
+ spacing: 2,
8706
+ items: accessories.map(accessory => {
8707
+ var _accessory$images, _accessory$images2;
8708
+ return React__default.createElement(AccessoryCard, {
8709
+ key: accessory.id,
8710
+ title: accessory.name,
8711
+ image: (_accessory$images = accessory.images) !== null && _accessory$images !== void 0 && _accessory$images[0] ? {
8712
+ src: `${(_accessory$images2 = accessory.images) === null || _accessory$images2 === void 0 ? void 0 : _accessory$images2[0]}?w=539&h=303`,
8713
+ alt: accessory.name
8714
+ } : undefined,
8715
+ price: `${numberSeparator(accessory.price)} kr`,
8716
+ preamble: accessory.excerpt,
8717
+ readMoreCta: () => onOpenModal(accessory)
8718
+ });
8719
+ })
8720
+ }))));
8721
+ };
8722
+
8231
8723
  const WaykeSearchItem = ({
8232
8724
  id,
8233
8725
  hashRoute,
@@ -8313,6 +8805,7 @@ const WaykeSearchItem = ({
8313
8805
  const branch = centralStorageVehicle === null || centralStorageVehicle === void 0 ? void 0 : centralStorageVehicle.branch;
8314
8806
  const {
8315
8807
  title,
8808
+ accessories,
8316
8809
  shortDescription,
8317
8810
  media,
8318
8811
  description,
@@ -8437,7 +8930,9 @@ const WaykeSearchItem = ({
8437
8930
  var _ecomContext$current2;
8438
8931
  return (_ecomContext$current2 = ecomContext.current) === null || _ecomContext$current2 === void 0 ? void 0 : _ecomContext$current2.start();
8439
8932
  }
8440
- }, "K\u00F6p bilen online"))), React__default.createElement(PackageOptions, {
8933
+ }, "K\u00F6p bilen online"))), React__default.createElement(AccessoriesSection, {
8934
+ accessories: accessories
8935
+ }), React__default.createElement(PackageOptions, {
8441
8936
  packageOptions: packageOptions
8442
8937
  }), React__default.createElement(ManufacturerPackageOption, {
8443
8938
  packageOption: manufacturer === null || manufacturer === void 0 ? void 0 : manufacturer.packageOption