@wayke-se/components-react 3.0.0-beta.9 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist-node/index.js +3204 -1021
  2. package/dist-node/index.js.map +1 -1
  3. package/dist-src/State/CentralStorage/useCentralStorage.js +7 -8
  4. package/dist-src/State/Path/PathProvider.js +1 -1
  5. package/dist-src/State/RelatedSearch/RelatedSearchProvider.js +1 -1
  6. package/dist-src/State/Search/SearchProvider.js +7 -10
  7. package/dist-src/components/ActionList/index.js +2 -3
  8. package/dist-src/components/Checklist/index.js +1 -1
  9. package/dist-src/components/ExtendContent/index.js +1 -1
  10. package/dist-src/components/Filter/index.js +10 -7
  11. package/dist-src/components/FilterPanel/checkListFacet.js +1 -1
  12. package/dist-src/components/FilterPanel/colorFacet.js +1 -1
  13. package/dist-src/components/FilterPanel/index.js +1 -1
  14. package/dist-src/components/FilterPanel/rangeFacet.js +14 -16
  15. package/dist-src/components/FinancialOptions/LoanModal.js +27 -29
  16. package/dist-src/components/FinancialOptions/leasing.js +6 -6
  17. package/dist-src/components/FinancialOptions/loan.js +5 -6
  18. package/dist-src/components/Gallery/index.js +11 -16
  19. package/dist-src/components/Grid/index.js +2 -3
  20. package/dist-src/components/InputSelect/index.js +1 -1
  21. package/dist-src/components/InsuranceOptions/InsuranceFree.js +1 -2
  22. package/dist-src/components/InsuranceOptions/InsuranceFreeModal.js +4 -5
  23. package/dist-src/components/InsuranceOptions/InsuranceModal.js +3 -3
  24. package/dist-src/components/Lightbox/index.js +1 -1
  25. package/dist-src/components/OpeningHours/index.js +9 -9
  26. package/dist-src/components/RangeSlider/SliderWithLabel.js +1 -1
  27. package/dist-src/components/Result/index.js +7 -6
  28. package/dist-src/components/Video/EmbededVideo.js +1 -1
  29. package/dist-src/components/Video/QuickNavEmbeded.js +2 -2
  30. package/dist-src/components/Video/useThumbnail.js +1 -1
  31. package/dist-src/components/Video/utils.js +2 -2
  32. package/dist-src/hooks/useFetch.js +1 -1
  33. package/dist-src/hooks/useVimeoThumbnail.js +1 -1
  34. package/dist-src/layouts/searchItem/Branch.js +9 -10
  35. package/dist-src/layouts/searchItem/BranchModal.js +1 -1
  36. package/dist-src/layouts/searchItem/CheckList.js +16 -16
  37. package/dist-src/layouts/searchItem/ManufacturerPackagesOption.js +1 -2
  38. package/dist-src/layouts/searchItem/PackageOptionModal.js +7 -10
  39. package/dist-src/layouts/searchItem/PackageOptions.js +11 -14
  40. package/dist-src/layouts/searchItem/Property.js +4 -6
  41. package/dist-src/layouts/searchItem/Related.js +3 -4
  42. package/dist-src/layouts/searchItem/index.js +15 -17
  43. package/dist-src/utils/phonenumbers.js +1 -1
  44. package/dist-src/utils/specification.js +9 -13
  45. package/dist-src/utils/vehicle-properties/property-tree-creator.js +5 -5
  46. package/dist-types/components/InputSearch/index.d.ts +5 -3
  47. package/dist-types/components/RangeSlider/handle.d.ts +2 -2
  48. package/dist-types/components/RangeSlider/track.d.ts +2 -2
  49. package/dist-web/index.js +206 -233
  50. package/dist-web/index.js.map +1 -1
  51. package/package.json +18 -24
@@ -137,10 +137,7 @@ const specLabels = {
137
137
  },
138
138
  height: {
139
139
  label: 'Längd/höjd/bredd',
140
- formatData: (_, data) => {
141
- var _a, _b, _c;
142
- return `${((_a = data === null || data === void 0 ? void 0 : data.properties) === null || _a === void 0 ? void 0 : _a.length) || '-'} cm/${((_b = data === null || data === void 0 ? void 0 : data.properties) === null || _b === void 0 ? void 0 : _b.height) || '-'} cm/${((_c = data === null || data === void 0 ? void 0 : data.properties) === null || _c === void 0 ? void 0 : _c.width) || '-'} cm`;
143
- },
140
+ formatData: (_, data) => `${data?.properties?.length || '-'} cm/${data?.properties?.height || '-'} cm/${data?.properties?.width || '-'} cm`,
144
141
  },
145
142
  serviceWeight: {
146
143
  label: 'Tjänstevikt',
@@ -437,14 +434,13 @@ const All = [
437
434
  'annualBonus',
438
435
  ];
439
436
  const extractSpecData = (key, item) => {
440
- var _a, _b, _c, _d, _e, _f, _g, _h;
441
437
  const spec = specLabels[key];
442
438
  let data = null;
443
439
  if (!!item[key] || (item[key] || -1) > -1) {
444
440
  data = item[key];
445
441
  }
446
- else if (!!((_a = item === null || item === void 0 ? void 0 : item.properties) === null || _a === void 0 ? void 0 : _a[key]) ||
447
- (typeof ((_b = item === null || item === void 0 ? void 0 : item.properties) === null || _b === void 0 ? void 0 : _b[key]) === 'number' && (((_c = item === null || item === void 0 ? void 0 : item.properties) === null || _c === void 0 ? void 0 : _c[key]) || -1) > -1)) {
442
+ else if (!!item?.properties?.[key] ||
443
+ (typeof item?.properties?.[key] === 'number' && (item?.properties?.[key] || -1) > -1)) {
448
444
  data = item.properties[key];
449
445
  }
450
446
  if (!spec || !data) {
@@ -466,23 +462,23 @@ const extractSpecData = (key, item) => {
466
462
  }
467
463
  const modal = spec.modal ? { title: '', text: '' } : undefined;
468
464
  if (modal) {
469
- if ((_d = spec.modal) === null || _d === void 0 ? void 0 : _d.dynamicTitle) {
465
+ if (spec.modal?.dynamicTitle) {
470
466
  modal.title = spec.modal.dynamicTitle(item);
471
467
  }
472
- else if ((_e = spec.modal) === null || _e === void 0 ? void 0 : _e.title) {
468
+ else if (spec.modal?.title) {
473
469
  modal.title = spec.modal.title;
474
470
  }
475
- if ((_f = spec.modal) === null || _f === void 0 ? void 0 : _f.dynamicText) {
471
+ if (spec.modal?.dynamicText) {
476
472
  modal.text = spec.modal.dynamicText(item);
477
473
  }
478
- else if ((_g = spec.modal) === null || _g === void 0 ? void 0 : _g.text) {
474
+ else if (spec.modal?.text) {
479
475
  modal.text = spec.modal.text;
480
476
  }
481
- if ((_h = spec.modal) === null || _h === void 0 ? void 0 : _h.concatPropValue) {
477
+ if (spec.modal?.concatPropValue) {
482
478
  const concatObj = spec.modal.concatPropValue === key
483
479
  ? { value }
484
480
  : extractSpecData(spec.modal.concatPropValue, item);
485
- if (concatObj === null || concatObj === void 0 ? void 0 : concatObj.value) {
481
+ if (concatObj?.value) {
486
482
  modal.text = modal.text.replace('{insertValue}', concatObj.value);
487
483
  }
488
484
  else if (spec.modal.nonConcatablePropValue) {
@@ -1,13 +1,13 @@
1
1
  class PropertyTreeCreator {
2
2
  constructor(properties) {
3
- this.propertiesWithCategory = (propertyKey) => { var _a; return !!((_a = this.properties[propertyKey].category) === null || _a === void 0 ? void 0 : _a.id); };
3
+ this.propertiesWithCategory = (propertyKey) => !!this.properties[propertyKey].category?.id;
4
4
  this.propertiesWithoutCategory = (propertyKey) => !this.propertiesWithCategory(propertyKey);
5
5
  this.isList = (property) => property.type === PropertyTreeCreator.TEXT_LIST_TYPE;
6
6
  this.isNonList = (property) => !this.isList(property);
7
- this.hasCategoryWithId = (propertyKey, categoryId) => { var _a; return ((_a = this.properties[propertyKey].category) === null || _a === void 0 ? void 0 : _a.id) === categoryId; };
8
- this.propertiesWithSubCategory = (propertyKey) => { var _a, _b; return !!((_b = (_a = this.properties[propertyKey].category) === null || _a === void 0 ? void 0 : _a.subCategory) === null || _b === void 0 ? void 0 : _b.id); };
7
+ this.hasCategoryWithId = (propertyKey, categoryId) => this.properties[propertyKey].category?.id === categoryId;
8
+ this.propertiesWithSubCategory = (propertyKey) => !!this.properties[propertyKey].category?.subCategory?.id;
9
9
  this.propertiesWithoutSubCategory = (propertyKey) => !this.propertiesWithSubCategory(propertyKey);
10
- this.hasSubCategoryWithId = (propertyKey, categoryId) => { var _a, _b; return ((_b = (_a = this.properties[propertyKey].category) === null || _a === void 0 ? void 0 : _a.subCategory) === null || _b === void 0 ? void 0 : _b.id) === categoryId; };
10
+ this.hasSubCategoryWithId = (propertyKey, categoryId) => this.properties[propertyKey].category?.subCategory?.id === categoryId;
11
11
  this.properties = properties;
12
12
  }
13
13
  create() {
@@ -74,7 +74,7 @@ class PropertyTreeCreator {
74
74
  const categories = Object.keys(this.properties)
75
75
  .filter((key) => this.hasCategoryWithId(key, id))
76
76
  .filter(this.propertiesWithSubCategory)
77
- .map((key) => { var _a; return (_a = this.properties[key].category) === null || _a === void 0 ? void 0 : _a.subCategory; })
77
+ .map((key) => this.properties[key].category?.subCategory)
78
78
  .filter(PropertyTreeCreator.distinctCategories);
79
79
  return categories;
80
80
  }
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
- declare const InputSearch: React.ForwardRefExoticComponent<Pick<React.ClassAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement> & {
2
+ declare type InputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
3
+ declare type Props = InputProps & {
3
4
  placeholder: string;
4
5
  label: string;
5
- value?: string | undefined;
6
+ value?: string;
6
7
  id: string;
7
8
  onSearch: () => void;
8
- }, "label" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "onSearch"> & React.RefAttributes<HTMLDivElement>>;
9
+ };
10
+ declare const InputSearch: React.ForwardRefExoticComponent<Pick<Props, "label" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "onSearch"> & React.RefAttributes<HTMLDivElement>>;
9
11
  export default InputSearch;
@@ -1,9 +1,9 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { SliderItem, GetHandleProps } from 'react-compound-slider';
3
3
  interface IHandleProps {
4
4
  domain: number[];
5
5
  handle: SliderItem;
6
6
  getHandleProps: GetHandleProps;
7
7
  }
8
- export declare const Handle: React.SFC<IHandleProps>;
8
+ export declare const Handle: ({ domain: [min, max], handle: { id, value, percent }, getHandleProps, }: IHandleProps) => JSX.Element;
9
9
  export {};
@@ -1,9 +1,9 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { SliderItem, GetTrackProps } from 'react-compound-slider';
3
3
  interface ITrackProps {
4
4
  source: SliderItem;
5
5
  target: SliderItem;
6
6
  getTrackProps: GetTrackProps;
7
7
  }
8
- export declare const Track: React.SFC<ITrackProps>;
8
+ export declare const Track: ({ source, target, getTrackProps }: ITrackProps) => JSX.Element;
9
9
  export {};