@abcagency/hc-ui-components 1.3.28 → 1.3.30

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 (34) hide show
  1. package/dist/components/containers/accordions/filter-item-container.js +4 -1
  2. package/dist/components/containers/accordions/filter-item-container.js.map +1 -1
  3. package/dist/components/containers/maps/info-window-content-container.js +9 -4
  4. package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
  5. package/dist/components/containers/maps/map-marker-container.js +3 -5
  6. package/dist/components/containers/maps/map-marker-container.js.map +1 -1
  7. package/dist/components/modules/list/field-mapper.js +2 -2
  8. package/dist/components/modules/list/field-mapper.js.map +1 -1
  9. package/dist/components/modules/list/header-item.js +2 -1
  10. package/dist/components/modules/list/header-item.js.map +1 -1
  11. package/dist/components/modules/list/header.js +6 -2
  12. package/dist/components/modules/list/header.js.map +1 -1
  13. package/dist/components/modules/list/item-list.js +46 -19
  14. package/dist/components/modules/list/item-list.js.map +1 -1
  15. package/dist/components/modules/list/list-item/list-item.js +4 -4
  16. package/dist/components/modules/list/list-item/list-item.js.map +1 -1
  17. package/dist/components/modules/maps/info-window-content.js +3 -2
  18. package/dist/components/modules/maps/info-window-content.js.map +1 -1
  19. package/dist/contexts/mapListContext.js +6 -0
  20. package/dist/contexts/mapListContext.js.map +1 -1
  21. package/dist/styles/index.css +1 -1
  22. package/dist/types/components/modules/list/header.d.ts +2 -1
  23. package/dist/types/contexts/mapListContext.d.ts +1 -0
  24. package/package.json +1 -1
  25. package/src/components/containers/accordions/filter-item-container.js +69 -66
  26. package/src/components/containers/maps/info-window-content-container.js +5 -3
  27. package/src/components/containers/maps/map-marker-container.js +2 -2
  28. package/src/components/modules/list/field-mapper.js +4 -3
  29. package/src/components/modules/list/header-item.js +92 -91
  30. package/src/components/modules/list/header.js +51 -49
  31. package/src/components/modules/list/item-list.tsx +93 -59
  32. package/src/components/modules/list/list-item/list-item.js +130 -130
  33. package/src/components/modules/maps/info-window-content.js +36 -35
  34. package/src/contexts/mapListContext.tsx +319 -311
@@ -1,130 +1,130 @@
1
- import React, { forwardRef, useState } from 'react';
2
- import Grid from '~/components/modules/grid';
3
- import Icon from '~/components/modules/icon';
4
- import FieldMapper from '~/components/modules/list/field-mapper';
5
-
6
- const ListItem = forwardRef(
7
- (
8
- {
9
- isActive,
10
- bodyClassName,
11
- className,
12
- item,
13
- fieldsShown,
14
- specialFeatures,
15
- onItemSelected,
16
- showMap,
17
- setMobileTab,
18
- handleSettingFavorites,
19
- favorites,
20
- includeFavorite = true,
21
- siteConfig,
22
- trackEvent,
23
- eventTypes,
24
- ...props
25
- },
26
- ref
27
- ) => {
28
- const mapPinColor = !showMap ? null : siteConfig.colors.primary.replace("#", "");
29
-
30
- const handleClick = () => {
31
- if (onItemSelected) {
32
- onItemSelected(item);
33
- }
34
- };
35
- let isFavorite = favorites.includes(item.id);
36
-
37
- const handleFavouriteClick = (event, item) => {
38
- if(!includeFavorite)return;
39
- event.stopPropagation();
40
- let updatedFavorites;
41
- if (isFavorite) {
42
- updatedFavorites = favorites.filter(fav => fav !== item.id);
43
- } else {
44
- updatedFavorites = [...favorites, item.id];
45
- }
46
- isFavorite = !isFavorite;
47
- handleSettingFavorites(updatedFavorites);
48
- };
49
- return (
50
- <button
51
- ref={ref}
52
- onClick={() => { handleClick(); }}
53
- className={`
54
- hc-group hc-relative hc-flex md:hc-flex-col hc-w-full md:hc-pl-4 hc-text-left hc-bg-clip-border hc-border hc-border-transparent hc-break-words hc-overflow-hidden hc-cursor-pointer hc-transition-colors hover:hc-bg-uiAccent/5 focus:hover:hc-bg-uiAccent/5
55
- ${isActive ? "hc-bg-uiAccent/5 hc-border-secondary hc-border" : "hc-text-uiText hc-bg-white"}
56
- ${className ?? ""}
57
- `}
58
- {...props}
59
- >
60
- <Grid
61
- columns="hc-grid-flow-col hc-auto-cols-fr"
62
- gap="hc-gap-2"
63
- isAnimated={false}
64
- className={`
65
- hc-block md:hc-grid hc-p-2 hc-ps-4 hc-w-full hc-grow hc-leading-tight hc-text-sm md:hc-text-xs lg:hc-text-sm
66
- ${bodyClassName ?? ""}
67
- `}
68
- >
69
- <Grid.Item className="hc-hidden md:hc-block md:hc-absolute md:hc-left-1.5 hc-top-1.5">
70
- <span className="hc-sr-only">Expand row</span>
71
- <Icon
72
- icon="fluent-emoji-high-contrast:plus"
73
- size="hc-size-2.5"
74
- className={`
75
- hc-opacity-0 hc-text-uiText/60 hc-transition group-hover:hc-opacity-100 group-active:hc-opacity-100
76
- ${isActive ? "hc-opacity-100 hc-rotate-45" : ""}
77
- `}
78
- />
79
- </Grid.Item>
80
- <FieldMapper
81
- item={item}
82
- fieldsShown={fieldsShown}
83
- specialFeatures={specialFeatures}
84
- isFavorite={isFavorite}
85
- includeFavorite={includeFavorite}
86
- handleFavouriteClick={handleFavouriteClick}
87
- />
88
- {includeFavorite &&
89
- <Grid.Item
90
- key={"favorites"}
91
- className="hc-hidden md:hc-block hc-col-span-1"
92
- >
93
- <Icon
94
- icon={isFavorite ? "mdi:heart" : "mdi:heart-outline"}
95
- size="hc-size-3.5"
96
- iconClasses={isFavorite ? "hc-text-primary" : ""}
97
- title={!isFavorite ? 'Add job to favorites' : 'Remove job from favorites'}
98
- className="hc-pr-2 hc-transition-opacity hc-duration-300 hc-cursor-pointer hc-opacity-100"
99
- onClick={e => {handleFavouriteClick(e, item);}}
100
- />
101
- </Grid.Item>
102
- }
103
- </Grid>
104
- {showMap && (
105
- <div onClick={() => { setMobileTab("mapTab"); handleClick(); }} className="md:hc-hidden hc-w-2/5 sm:hc-w-1/3 hc-p-1.5 hc-my-1 hc-bg-uiAccent/5 hc-border hc-border-uiAccent/10 hc-rounded-sm">
106
- <img
107
- src={`https://maps.googleapis.com/maps/api/staticmap?scale=2&center=${item.mapDetails?.latitude},${item.mapDetails?.longitude}&zoom=10&size=240x180&maptype=roadmap&markers=color:0x${mapPinColor}%7Clabel:•%7C${item.mapDetails?.latitude},${item.mapDetails?.longitude}&key=${process.env.GOOGLE_MAPS_API_KEY}`}
108
- alt={`Map of location for ${item.fields.position}`}
109
- className="hc-w-full hc-h-full hc-object-cover"
110
- />
111
- </div>
112
- )}
113
- </button>
114
- );
115
- }
116
- );
117
-
118
- ListItem.displayName = "ListItem";
119
-
120
- export default React.memo(ListItem, (prevProps, nextProps) => {
121
- return (
122
- prevProps.isActive === nextProps.isActive &&
123
- prevProps.favorites === nextProps.favorites &&
124
- prevProps.item.id === nextProps.item.id &&
125
- prevProps.item.fields.travelTime === nextProps.item.fields.travelTime &&
126
- prevProps.fieldsShown === nextProps.fieldsShown &&
127
- prevProps.bodyClassName === nextProps.bodyClassName &&
128
- prevProps.className === nextProps.className
129
- );
130
- });
1
+ import React, { forwardRef } from 'react';
2
+ import Grid from '~/components/modules/grid';
3
+ import Icon from '~/components/modules/icon';
4
+ import FieldMapper from '~/components/modules/list/field-mapper';
5
+
6
+ const ListItem = forwardRef(
7
+ (
8
+ {
9
+ isActive,
10
+ bodyClassName,
11
+ className,
12
+ item,
13
+ fieldsShown,
14
+ specialFeatures,
15
+ onItemSelected,
16
+ showMap,
17
+ setMobileTab,
18
+ handleSettingFavorites,
19
+ favorites,
20
+ includeFavorite = true,
21
+ siteConfig,
22
+ trackEvent,
23
+ eventTypes,
24
+ ...props
25
+ },
26
+ ref
27
+ ) => {
28
+ const mapPinColor = !showMap ? null : siteConfig.colors.primary.replace("#", "");
29
+
30
+ const handleClick = () => {
31
+ if (onItemSelected) {
32
+ onItemSelected(item);
33
+ }
34
+ };
35
+ let isFavorite = favorites.includes(item.id);
36
+
37
+ const handleFavouriteClick = (event, item) => {
38
+ if(!includeFavorite)return;
39
+ event.stopPropagation();
40
+ let updatedFavorites;
41
+ if (isFavorite) {
42
+ updatedFavorites = favorites.filter(fav => fav !== item.id);
43
+ } else {
44
+ updatedFavorites = [...favorites, item.id];
45
+ }
46
+ isFavorite = !isFavorite;
47
+ handleSettingFavorites(updatedFavorites);
48
+ };
49
+ return (
50
+ <button
51
+ ref={ref}
52
+ onClick={() => { handleClick(); }}
53
+ className={`
54
+ hc-group hc-relative hc-flex md:hc-flex-col hc-w-full hc-text-left hc-bg-clip-border hc-border hc-border-transparent hc-break-words hc-overflow-hidden hc-cursor-pointer hc-transition-colors hover:hc-bg-uiAccent/5 focus:hover:hc-bg-uiAccent/5
55
+ ${isActive ? "hc-bg-uiAccent/5 hc-border-secondary hc-border" : "hc-text-uiText hc-bg-white"}
56
+ ${className ?? ""}
57
+ `}
58
+ {...props}
59
+ >
60
+ <Grid
61
+ columns="hc-grid-flow-col hc-auto-cols-fr"
62
+ gap="hc-gap-0"
63
+ isAnimated={false}
64
+ className={`
65
+ hc-block md:hc-grid hc-py-2 hc-w-full hc-grow hc-leading-tight hc-text-sm md:hc-text-xs lg:hc-text-sm
66
+ ${bodyClassName ?? ""}
67
+ `}
68
+ >
69
+ <Grid.Item className="hc-hidden md:hc-block md:hc-absolute md:hc-left-1.5 hc-top-1.5">
70
+ <span className="hc-sr-only">Expand row</span>
71
+ <Icon
72
+ icon="fluent-emoji-high-contrast:plus"
73
+ size="hc-size-2.5"
74
+ className={`
75
+ hc-opacity-0 hc-text-uiText/60 hc-transition group-hover:hc-opacity-100 group-active:hc-opacity-100
76
+ ${isActive ? "hc-opacity-100 hc-rotate-45" : ""}
77
+ `}
78
+ />
79
+ </Grid.Item>
80
+ <FieldMapper
81
+ item={item}
82
+ fieldsShown={fieldsShown}
83
+ specialFeatures={specialFeatures}
84
+ isFavorite={isFavorite}
85
+ includeFavorite={includeFavorite}
86
+ handleFavouriteClick={handleFavouriteClick}
87
+ />
88
+ {includeFavorite &&
89
+ <Grid.Item
90
+ key={"favorites"}
91
+ className="hc-hidden md:hc-block hc-col-span-1 hc-px-2"
92
+ >
93
+ <Icon
94
+ icon={isFavorite ? "mdi:heart" : "mdi:heart-outline"}
95
+ size="hc-size-3.5"
96
+ iconClasses={isFavorite ? "hc-text-primary" : ""}
97
+ title={!isFavorite ? 'Add job to favorites' : 'Remove job from favorites'}
98
+ className="hc-pr-2 hc-transition-opacity hc-duration-300 hc-cursor-pointer hc-opacity-100"
99
+ onClick={e => {handleFavouriteClick(e, item);}}
100
+ />
101
+ </Grid.Item>
102
+ }
103
+ </Grid>
104
+ {showMap && (
105
+ <div onClick={() => { setMobileTab("mapTab"); handleClick(); }} className="md:hc-hidden hc-w-2/5 sm:hc-w-1/3 hc-p-1.5 hc-my-1 hc-bg-uiAccent/5 hc-border hc-border-uiAccent/10 hc-rounded-sm">
106
+ <img
107
+ src={`https://maps.googleapis.com/maps/api/staticmap?scale=2&center=${item.mapDetails?.latitude},${item.mapDetails?.longitude}&zoom=10&size=240x180&maptype=roadmap&markers=color:0x${mapPinColor}%7Clabel:•%7C${item.mapDetails?.latitude},${item.mapDetails?.longitude}&key=${process.env.GOOGLE_MAPS_API_KEY}`}
108
+ alt={`Map of location for ${item.fields.position}`}
109
+ className="hc-w-full hc-h-full hc-object-cover"
110
+ />
111
+ </div>
112
+ )}
113
+ </button>
114
+ );
115
+ }
116
+ );
117
+
118
+ ListItem.displayName = "ListItem";
119
+
120
+ export default React.memo(ListItem, (prevProps, nextProps) => {
121
+ return (
122
+ prevProps.isActive === nextProps.isActive &&
123
+ prevProps.favorites === nextProps.favorites &&
124
+ prevProps.item.id === nextProps.item.id &&
125
+ prevProps.item.fields.travelTime === nextProps.item.fields.travelTime &&
126
+ prevProps.fieldsShown === nextProps.fieldsShown &&
127
+ prevProps.bodyClassName === nextProps.bodyClassName &&
128
+ prevProps.className === nextProps.className
129
+ );
130
+ });
@@ -1,35 +1,36 @@
1
- import React from 'react';
2
-
3
- const InfoWindowContent = ({
4
- items,
5
- fullAddress,
6
- applyFilters
7
- }) => {
8
- if (!items || items.length < 0) {
9
- return null;
10
- }
11
- return (
12
- <div className="hc-flex-auto hc-p-2">
13
- <div>
14
- <div>
15
- <h4 className="hc-text-lg hc-font-bold hc-leading-tight hc-mb-3">
16
- {items[0].mapDetails?.entityDisplayName}
17
- </h4>
18
- <p>{fullAddress}</p>
19
- <div className="hc-pt-2">
20
- <button
21
- className="hc-cursor-pointer hover:hc-opacity-70 hc-text-primary"
22
- onClick={applyFilters}
23
- >
24
- {items.length > 1
25
- ? `View All ${items.length} jobs at this location`
26
- : `View job at this location`}
27
- </button>
28
- </div>
29
- </div>
30
- </div>
31
- </div>
32
- );
33
- };
34
-
35
- export default InfoWindowContent;
1
+ import React from 'react';
2
+
3
+ const InfoWindowContent = ({
4
+ items,
5
+ fullAddress,
6
+ applyFilters
7
+ }) => {
8
+ if (!items || items.length < 0) {
9
+ return null;
10
+ }
11
+ let entityDisplayName = items[0].mapDetails?.entityDisplayName;
12
+ return (
13
+ <div className="hc-flex-auto hc-p-2">
14
+ <div>
15
+ <div>
16
+ <h4 className="hc-text-lg hc-font-bold hc-leading-tight hc-mb-3">
17
+ {entityDisplayName}
18
+ </h4>
19
+ <p>{!entityDisplayName.includes(items[0].mapDetails?.address?.street) && !entityDisplayName.includes(items[0].mapDetails?.address?.zip) && fullAddress}</p>
20
+ <div className="hc-pt-2">
21
+ <button
22
+ className="hc-cursor-pointer hover:hc-opacity-70 hc-text-primary"
23
+ onClick={applyFilters}
24
+ >
25
+ {items.length > 1
26
+ ? `View All ${items.length} jobs at this location`
27
+ : `View job at this location`}
28
+ </button>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ );
34
+ };
35
+
36
+ export default InfoWindowContent;