@abcagency/hc-ui-components 1.3.58 → 1.3.60
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.
- package/dist/components/HireControlMap.js +11 -1
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/containers/accordions/filter-item-container.js.map +1 -1
- package/dist/components/containers/filter/commute-container.js +1 -1
- package/dist/components/containers/filter/commute-container.js.map +1 -1
- package/dist/components/containers/filter/filter-container.js.map +1 -1
- package/dist/components/containers/filter/filter-item-container.js.map +1 -1
- package/dist/components/containers/filter/location-container.js.map +1 -1
- package/dist/components/containers/filter/points-of-interest-container.js.map +1 -1
- package/dist/components/containers/filter/points-of-interest-radio-item-container.js.map +1 -1
- package/dist/components/containers/filter/search-container.js.map +1 -1
- package/dist/components/containers/jobListing/listing-details-container.js +5 -1
- package/dist/components/containers/jobListing/listing-details-container.js.map +1 -1
- package/dist/components/containers/list/item-list-container.js.map +1 -1
- package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
- package/dist/components/containers/maps/map-container.js +1 -1
- package/dist/components/containers/maps/map-list-container.js.map +1 -1
- package/dist/components/containers/maps/map-marker-container.js +1 -1
- package/dist/components/containers/maps/map-marker-container.js.map +1 -1
- package/dist/components/modules/accordions/default.js +2 -2
- package/dist/components/modules/accordions/filterItem.js.map +1 -1
- package/dist/components/modules/accordions/filters.js.map +1 -1
- package/dist/components/modules/buttons/button-group-apply.js +48 -54
- package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
- package/dist/components/modules/buttons/default.js +2 -2
- package/dist/components/modules/cards/default.js +2 -2
- package/dist/components/modules/dialogs/apply-dialog.js +1 -1
- package/dist/components/modules/dialogs/apply-dialog.js.map +1 -1
- package/dist/components/modules/filter/commute.js +2 -2
- package/dist/components/modules/filter/commute.js.map +1 -1
- package/dist/components/modules/filter/index.js.map +1 -1
- package/dist/components/modules/filter/location.js.map +1 -1
- package/dist/components/modules/filter/radio-item.js.map +1 -1
- package/dist/components/modules/filter/search.js.map +1 -1
- package/dist/components/modules/filter/sort.js +2 -2
- package/dist/components/modules/grid.js +1 -1
- package/dist/components/modules/icon.js +1 -1
- package/dist/components/modules/jobListing/listing-details.js +8 -7
- package/dist/components/modules/jobListing/listing-details.js.map +1 -1
- package/dist/components/modules/list/field-mapper.js.map +1 -1
- package/dist/components/modules/list/header-item.js.map +1 -1
- package/dist/components/modules/list/header.js +1 -1
- package/dist/components/modules/list/item-expand-card/index.js +1 -1
- package/dist/components/modules/list/item-expand-card/index.js.map +1 -1
- package/dist/components/modules/list/item-expand-card/recruiter-contact-nav.js +38 -38
- package/dist/components/modules/list/item-expand-card/recruiter-details.js +40 -40
- package/dist/components/modules/list/item-expand-card/recruiter-headshot.js +20 -20
- package/dist/components/modules/list/item-list.js +3 -3
- package/dist/components/modules/list/item-list.js.map +1 -1
- package/dist/components/modules/list/list-item/list-item.js.map +1 -1
- package/dist/components/modules/maps/info-window-content.js.map +1 -1
- package/dist/components/modules/maps/map-list.js.map +1 -1
- package/dist/components/modules/maps/map-marker.js +1 -1
- package/dist/components/modules/maps/map-marker.js.map +1 -1
- package/dist/components/modules/maps/map.js +1 -1
- package/dist/components/modules/maps/place-marker.js +1 -1
- package/dist/components/modules/maps/tabs.js +1 -1
- package/dist/constants/eventTypes.js +1 -0
- package/dist/constants/eventTypes.js.map +1 -1
- package/dist/contexts/mapContext.js.map +1 -1
- package/dist/contexts/mapListContext.js +3 -1
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/contexts/placesContext.js.map +1 -1
- package/dist/contexts/themeContext.js.map +1 -1
- package/dist/services/configService.js.map +1 -1
- package/dist/services/listingEntityService.js.map +1 -1
- package/dist/services/listingService.js.map +1 -1
- package/dist/services/recruiterService.js.map +1 -1
- package/dist/types/components/modules/buttons/button-group-apply.d.ts +4 -4
- package/dist/types/components/modules/jobListing/listing-details.d.ts +3 -1
- package/dist/types/constants/eventTypes.d.ts +1 -0
- package/dist/types/contexts/mapListContext.d.ts +4 -0
- package/dist/util/filterUtil.js +3 -3
- package/dist/util/filterUtil.js.map +1 -1
- package/dist/util/mapIconUtil.js.map +1 -1
- package/dist/util/mapUtil.js.map +1 -1
- package/package.json +90 -90
- package/src/.editorconfig +12 -12
- package/src/bundleIndex.js +14 -14
- package/src/components/HireControlMap.js +148 -142
- package/src/components/containers/accordions/filter-item-container.js +83 -83
- package/src/components/containers/filter/commute-container.js +89 -89
- package/src/components/containers/filter/filter-container.js +76 -76
- package/src/components/containers/filter/filter-item-container.js +117 -117
- package/src/components/containers/filter/location-container.js +45 -45
- package/src/components/containers/filter/points-of-interest-container.js +33 -33
- package/src/components/containers/filter/points-of-interest-radio-item-container.js +35 -35
- package/src/components/containers/filter/search-container.js +61 -61
- package/src/components/containers/jobListing/listing-details-container.js +3 -1
- package/src/components/containers/list/item-list-container.tsx +81 -81
- package/src/components/containers/maps/info-window-content-container.js +53 -53
- package/src/components/containers/maps/map-list-container.js +50 -50
- package/src/components/containers/maps/map-marker-container.js +78 -78
- package/src/components/modules/accordions/filterItem.js +27 -27
- package/src/components/modules/accordions/filters.js +32 -32
- package/src/components/modules/buttons/button-group-apply.js +115 -135
- package/src/components/modules/dialogs/apply-dialog.js +48 -48
- package/src/components/modules/filter/commute.js +108 -108
- package/src/components/modules/filter/index.js +55 -55
- package/src/components/modules/filter/location.js +51 -51
- package/src/components/modules/filter/radio-item.js +42 -42
- package/src/components/modules/filter/search.js +79 -79
- package/src/components/modules/jobListing/listing-details.js +110 -108
- package/src/components/modules/list/field-mapper.js +130 -130
- package/src/components/modules/list/header-item.js +92 -92
- package/src/components/modules/list/item-expand-card/index.js +22 -22
- package/src/components/modules/list/item-list.tsx +117 -117
- package/src/components/modules/list/list-item/list-item.js +130 -130
- package/src/components/modules/maps/info-window-content.js +64 -64
- package/src/components/modules/maps/map-list.js +38 -38
- package/src/components/modules/maps/map-marker.js +29 -29
- package/src/constants/eventTypes.js +15 -14
- package/src/contexts/mapContext.tsx +129 -129
- package/src/contexts/mapListContext.tsx +326 -318
- package/src/contexts/placesContext.js +102 -102
- package/src/contexts/themeContext.js +40 -40
- package/src/services/configService.ts +16 -16
- package/src/services/listingEntityService.ts +16 -16
- package/src/services/listingService.ts +40 -40
- package/src/services/recruiterService.ts +18 -18
- package/src/styles/bundle.css +268 -268
- package/src/styles/index.css +33 -33
- package/src/types/Address.ts +7 -7
- package/src/types/ContentSection.ts +9 -9
- package/src/types/GetListingParams.ts +8 -8
- package/src/types/LatLng.ts +4 -4
- package/src/types/ListingEntity.ts +11 -11
- package/src/types/ListingFields.ts +25 -25
- package/src/types/Listings.ts +32 -32
- package/src/types/Recruiter.ts +9 -9
- package/src/types/SimilarListing.ts +24 -24
- package/src/types/config/Colors.ts +8 -8
- package/src/types/config/MapConfig.ts +31 -31
- package/src/types/config/PointsOfInterestConfig.ts +13 -13
- package/src/types/config/SearchConfig.ts +4 -4
- package/src/util/filterUtil.js +2 -1
- package/src/util/mapIconUtil.js +180 -180
- package/src/util/mapUtil.js +92 -92
- package/dist/types/contexts/themeContext.d.ts +0 -11
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Button from '~/components/modules/buttons/default';
|
|
3
|
-
|
|
4
|
-
const Filter = ({
|
|
5
|
-
className,
|
|
6
|
-
hasActiveFilters,
|
|
7
|
-
filteredListings,
|
|
8
|
-
selectedFilters,
|
|
9
|
-
setMobileTab,
|
|
10
|
-
handleReset,
|
|
11
|
-
children
|
|
12
|
-
}) => {
|
|
13
|
-
return (
|
|
14
|
-
<div
|
|
15
|
-
className={`
|
|
16
|
-
hc-relative hc-max-h-[95vh] md:hc-max-h-screen hc-overflow-y-auto hc-overflow-x-auto
|
|
17
|
-
${className ?? ""}
|
|
18
|
-
`}
|
|
19
|
-
>
|
|
20
|
-
<div className="hc-px-4 md:hc-pt-4 hc-space-y-4">
|
|
21
|
-
{children}
|
|
22
|
-
</div>
|
|
23
|
-
<div className="hc-sticky hc-bottom-0 hc-inset-x-0 hc-flex hc-items-center hc-justify-between hc-gap-2 hc-py-2 hc-px-4 hc-mt-2 hc-bg-white md:hc-bg-gray-100">
|
|
24
|
-
<Button.Btn
|
|
25
|
-
onClick={handleReset}
|
|
26
|
-
variant="outline"
|
|
27
|
-
size="sm"
|
|
28
|
-
>
|
|
29
|
-
Reset
|
|
30
|
-
</Button.Btn>
|
|
31
|
-
{selectedFilters && Object.keys(selectedFilters).length > 0 &&
|
|
32
|
-
<Button.Btn
|
|
33
|
-
onClick={() => setMobileTab("listTab")}
|
|
34
|
-
variant="primary"
|
|
35
|
-
size="sm"
|
|
36
|
-
className={`
|
|
37
|
-
md:hc-hidden
|
|
38
|
-
${hasActiveFilters ? "hc-opacity-0 hc-pointer-events-none" : "hc-opacity-100"}
|
|
39
|
-
`}
|
|
40
|
-
>
|
|
41
|
-
<Button.Body>
|
|
42
|
-
<Button.Icon
|
|
43
|
-
icon="fluent:search-12-filled"
|
|
44
|
-
size="hc-size-3.5"
|
|
45
|
-
/>
|
|
46
|
-
Show {filteredListings.length} Jobs
|
|
47
|
-
</Button.Body>
|
|
48
|
-
</Button.Btn>
|
|
49
|
-
}
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default Filter;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Button from '~/components/modules/buttons/default';
|
|
3
|
+
|
|
4
|
+
const Filter = ({
|
|
5
|
+
className,
|
|
6
|
+
hasActiveFilters,
|
|
7
|
+
filteredListings,
|
|
8
|
+
selectedFilters,
|
|
9
|
+
setMobileTab,
|
|
10
|
+
handleReset,
|
|
11
|
+
children
|
|
12
|
+
}) => {
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
className={`
|
|
16
|
+
hc-relative hc-max-h-[95vh] md:hc-max-h-screen hc-overflow-y-auto hc-overflow-x-auto
|
|
17
|
+
${className ?? ""}
|
|
18
|
+
`}
|
|
19
|
+
>
|
|
20
|
+
<div className="hc-px-4 md:hc-pt-4 hc-space-y-4">
|
|
21
|
+
{children}
|
|
22
|
+
</div>
|
|
23
|
+
<div className="hc-sticky hc-bottom-0 hc-inset-x-0 hc-flex hc-items-center hc-justify-between hc-gap-2 hc-py-2 hc-px-4 hc-mt-2 hc-bg-white md:hc-bg-gray-100">
|
|
24
|
+
<Button.Btn
|
|
25
|
+
onClick={handleReset}
|
|
26
|
+
variant="outline"
|
|
27
|
+
size="sm"
|
|
28
|
+
>
|
|
29
|
+
Reset
|
|
30
|
+
</Button.Btn>
|
|
31
|
+
{selectedFilters && Object.keys(selectedFilters).length > 0 &&
|
|
32
|
+
<Button.Btn
|
|
33
|
+
onClick={() => setMobileTab("listTab")}
|
|
34
|
+
variant="primary"
|
|
35
|
+
size="sm"
|
|
36
|
+
className={`
|
|
37
|
+
md:hc-hidden
|
|
38
|
+
${hasActiveFilters ? "hc-opacity-0 hc-pointer-events-none" : "hc-opacity-100"}
|
|
39
|
+
`}
|
|
40
|
+
>
|
|
41
|
+
<Button.Body>
|
|
42
|
+
<Button.Icon
|
|
43
|
+
icon="fluent:search-12-filled"
|
|
44
|
+
size="hc-size-3.5"
|
|
45
|
+
/>
|
|
46
|
+
Show {filteredListings.length} Jobs
|
|
47
|
+
</Button.Body>
|
|
48
|
+
</Button.Btn>
|
|
49
|
+
}
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default Filter;
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Accordion from '~/components/modules/accordions/default';
|
|
3
|
-
import FilterCard from '~/components/modules/cards/filter';
|
|
4
|
-
import AccordionFilterItem from '~/components/containers/accordions/filter-item-container';
|
|
5
|
-
import Loading from '~/util/loading';
|
|
6
|
-
|
|
7
|
-
const FilterLocation = ({
|
|
8
|
-
className,
|
|
9
|
-
defaultValue,
|
|
10
|
-
setDefaultValue,
|
|
11
|
-
setLocation,
|
|
12
|
-
setSelectedListItem,
|
|
13
|
-
locations,
|
|
14
|
-
setSelectedFilters,
|
|
15
|
-
selectedFilters,
|
|
16
|
-
children
|
|
17
|
-
}) => {
|
|
18
|
-
return (
|
|
19
|
-
<FilterCard className={className ?? ""}>
|
|
20
|
-
<FilterCard.Title icon="fluent:location-16-filled">
|
|
21
|
-
<span>
|
|
22
|
-
<span className="hc-hidden lg:hc-inline">Job</span> location
|
|
23
|
-
</span>
|
|
24
|
-
</FilterCard.Title>
|
|
25
|
-
{!locations && <Loading />}
|
|
26
|
-
{locations && (
|
|
27
|
-
<Accordion defaultValue={defaultValue} className="hc-space-y-4">
|
|
28
|
-
{locations?.map(filter => {
|
|
29
|
-
if(filter.id === 'entityName' && (!selectedFilters.cityState && !selectedFilters.state)){
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
return(<AccordionFilterItem
|
|
33
|
-
key={filter.id}
|
|
34
|
-
filter={filter}
|
|
35
|
-
setDefaultValue={setDefaultValue}
|
|
36
|
-
selectedFilters={selectedFilters}
|
|
37
|
-
setSelectedFilters={prevFilters => {
|
|
38
|
-
setSelectedFilters(prevFilters);
|
|
39
|
-
setLocation(null);
|
|
40
|
-
setSelectedListItem(null);
|
|
41
|
-
}}
|
|
42
|
-
/>);
|
|
43
|
-
})}
|
|
44
|
-
{children}
|
|
45
|
-
</Accordion>
|
|
46
|
-
)}
|
|
47
|
-
</FilterCard>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default FilterLocation;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Accordion from '~/components/modules/accordions/default';
|
|
3
|
+
import FilterCard from '~/components/modules/cards/filter';
|
|
4
|
+
import AccordionFilterItem from '~/components/containers/accordions/filter-item-container';
|
|
5
|
+
import Loading from '~/util/loading';
|
|
6
|
+
|
|
7
|
+
const FilterLocation = ({
|
|
8
|
+
className,
|
|
9
|
+
defaultValue,
|
|
10
|
+
setDefaultValue,
|
|
11
|
+
setLocation,
|
|
12
|
+
setSelectedListItem,
|
|
13
|
+
locations,
|
|
14
|
+
setSelectedFilters,
|
|
15
|
+
selectedFilters,
|
|
16
|
+
children
|
|
17
|
+
}) => {
|
|
18
|
+
return (
|
|
19
|
+
<FilterCard className={className ?? ""}>
|
|
20
|
+
<FilterCard.Title icon="fluent:location-16-filled">
|
|
21
|
+
<span>
|
|
22
|
+
<span className="hc-hidden lg:hc-inline">Job</span> location
|
|
23
|
+
</span>
|
|
24
|
+
</FilterCard.Title>
|
|
25
|
+
{!locations && <Loading />}
|
|
26
|
+
{locations && (
|
|
27
|
+
<Accordion defaultValue={defaultValue} className="hc-space-y-4">
|
|
28
|
+
{locations?.map(filter => {
|
|
29
|
+
if(filter.id === 'entityName' && (!selectedFilters.cityState && !selectedFilters.state)){
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
return(<AccordionFilterItem
|
|
33
|
+
key={filter.id}
|
|
34
|
+
filter={filter}
|
|
35
|
+
setDefaultValue={setDefaultValue}
|
|
36
|
+
selectedFilters={selectedFilters}
|
|
37
|
+
setSelectedFilters={prevFilters => {
|
|
38
|
+
setSelectedFilters(prevFilters);
|
|
39
|
+
setLocation(null);
|
|
40
|
+
setSelectedListItem(null);
|
|
41
|
+
}}
|
|
42
|
+
/>);
|
|
43
|
+
})}
|
|
44
|
+
{children}
|
|
45
|
+
</Accordion>
|
|
46
|
+
)}
|
|
47
|
+
</FilterCard>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default FilterLocation;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Icon from '~/components/modules/icon';
|
|
3
|
-
|
|
4
|
-
const RadioItem = ({
|
|
5
|
-
className,
|
|
6
|
-
item,
|
|
7
|
-
field,
|
|
8
|
-
isActive,
|
|
9
|
-
changeHandler,
|
|
10
|
-
...rest
|
|
11
|
-
}) => {
|
|
12
|
-
return (
|
|
13
|
-
<label
|
|
14
|
-
key={item.key}
|
|
15
|
-
className={`
|
|
16
|
-
hc-flex hc-items-start hc-gap-2 hc-px-2 hc-py-1.5 hc-rounded-sm hc-text-sm hc-cursor-pointer hc-transition hover:hc-bg-uiAccent/5
|
|
17
|
-
${item.count === 0 ? 'hc-text-uiDisabled hc-cursor-not-allowed' : 'hover:hc-bg-uiAccent/5'}
|
|
18
|
-
${className ?? ""}
|
|
19
|
-
`}
|
|
20
|
-
{...rest}
|
|
21
|
-
>
|
|
22
|
-
<input
|
|
23
|
-
key={item.key}
|
|
24
|
-
id={item.key}
|
|
25
|
-
name={field}
|
|
26
|
-
value={item.key}
|
|
27
|
-
type="radio"
|
|
28
|
-
className="hc-size-4 hc-mt-px hc-text-primary hc-border-uiAccent/30 hc-transition-colors hc-rounded-full"
|
|
29
|
-
checked={isActive}
|
|
30
|
-
onClick={changeHandler}
|
|
31
|
-
/>
|
|
32
|
-
<span className="hc-font-medium">{item.key}</span>
|
|
33
|
-
{isActive &&
|
|
34
|
-
<div className="hc-w-full hc-unselect-div">
|
|
35
|
-
<Icon className="hc-float-right" icon="mdi:times"></Icon>
|
|
36
|
-
</div>
|
|
37
|
-
}
|
|
38
|
-
</label>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export default RadioItem;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Icon from '~/components/modules/icon';
|
|
3
|
+
|
|
4
|
+
const RadioItem = ({
|
|
5
|
+
className,
|
|
6
|
+
item,
|
|
7
|
+
field,
|
|
8
|
+
isActive,
|
|
9
|
+
changeHandler,
|
|
10
|
+
...rest
|
|
11
|
+
}) => {
|
|
12
|
+
return (
|
|
13
|
+
<label
|
|
14
|
+
key={item.key}
|
|
15
|
+
className={`
|
|
16
|
+
hc-flex hc-items-start hc-gap-2 hc-px-2 hc-py-1.5 hc-rounded-sm hc-text-sm hc-cursor-pointer hc-transition hover:hc-bg-uiAccent/5
|
|
17
|
+
${item.count === 0 ? 'hc-text-uiDisabled hc-cursor-not-allowed' : 'hover:hc-bg-uiAccent/5'}
|
|
18
|
+
${className ?? ""}
|
|
19
|
+
`}
|
|
20
|
+
{...rest}
|
|
21
|
+
>
|
|
22
|
+
<input
|
|
23
|
+
key={item.key}
|
|
24
|
+
id={item.key}
|
|
25
|
+
name={field}
|
|
26
|
+
value={item.key}
|
|
27
|
+
type="radio"
|
|
28
|
+
className="hc-size-4 hc-mt-px hc-text-primary hc-border-uiAccent/30 hc-transition-colors hc-rounded-full"
|
|
29
|
+
checked={isActive}
|
|
30
|
+
onClick={changeHandler}
|
|
31
|
+
/>
|
|
32
|
+
<span className="hc-font-medium">{item.key}</span>
|
|
33
|
+
{isActive &&
|
|
34
|
+
<div className="hc-w-full hc-unselect-div">
|
|
35
|
+
<Icon className="hc-float-right" icon="mdi:times"></Icon>
|
|
36
|
+
</div>
|
|
37
|
+
}
|
|
38
|
+
</label>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default RadioItem;
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import React, { useRef } from 'react';
|
|
2
|
-
import Button from '~/components/modules/buttons/default';
|
|
3
|
-
import Icon from '~/components/modules/icon';
|
|
4
|
-
import FilterCard from '~/components/modules/cards/filter';
|
|
5
|
-
|
|
6
|
-
const Search = ({
|
|
7
|
-
inputPlaceholder,
|
|
8
|
-
showSearchIcon,
|
|
9
|
-
className,
|
|
10
|
-
labelClassName,
|
|
11
|
-
inputValue,
|
|
12
|
-
handleInputChange,
|
|
13
|
-
handleSubmitInput,
|
|
14
|
-
handleReset,
|
|
15
|
-
label
|
|
16
|
-
}) => {
|
|
17
|
-
const inputRef = useRef(null);
|
|
18
|
-
const buttonRef = useRef(null);
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<FilterCard as="form" className={className ?? ""}>
|
|
22
|
-
<FilterCard.Title
|
|
23
|
-
as="label"
|
|
24
|
-
icon="fluent:search-12-filled"
|
|
25
|
-
className={labelClassName ?? ""}
|
|
26
|
-
>
|
|
27
|
-
<span>{label}</span>
|
|
28
|
-
</FilterCard.Title>
|
|
29
|
-
|
|
30
|
-
<div className="hc-relative hc-flex hc-items-center hc-px-2 hc-rounded hc-bg-white hc-border hc-border-uiAccent/20 focus-within:hc-ring-1 focus-within:hc-ring-uiAccent">
|
|
31
|
-
{showSearchIcon && (
|
|
32
|
-
<Icon
|
|
33
|
-
icon="fluent:search-12-filled"
|
|
34
|
-
size="hc-size-4"
|
|
35
|
-
className="hc-mr-2 hc-text-uiAccent/50"
|
|
36
|
-
/>
|
|
37
|
-
)}
|
|
38
|
-
<input
|
|
39
|
-
type="text"
|
|
40
|
-
name="search"
|
|
41
|
-
ref={inputRef}
|
|
42
|
-
onKeyDown={e => {
|
|
43
|
-
if (e.key === 'Enter') {
|
|
44
|
-
e.preventDefault();
|
|
45
|
-
buttonRef.current.click(); // Trigger the hidden button on Enter key press
|
|
46
|
-
}
|
|
47
|
-
}}
|
|
48
|
-
placeholder={inputPlaceholder}
|
|
49
|
-
value={inputValue}
|
|
50
|
-
className="hc-w-full hc-px-0 hc-py-2 hc-text-sm hc-border-0 hc-transition-colors placeholder:hc-text-uiText/50 focus:hc-ring-0 focus:hc-outline-none"
|
|
51
|
-
onChange={handleInputChange}
|
|
52
|
-
/>
|
|
53
|
-
|
|
54
|
-
<button
|
|
55
|
-
id="SearchButton"
|
|
56
|
-
ref={buttonRef}
|
|
57
|
-
type="button"
|
|
58
|
-
className="hidden hc-invisible"
|
|
59
|
-
onClick={() => handleSubmitInput(inputRef.current.value)}
|
|
60
|
-
>
|
|
61
|
-
Hidden Submit
|
|
62
|
-
</button>
|
|
63
|
-
|
|
64
|
-
<Button.Btn
|
|
65
|
-
type="reset"
|
|
66
|
-
variant="icon"
|
|
67
|
-
size="sqsm"
|
|
68
|
-
className={`transition-opacity ${inputValue ? "hc-opacity-100" : "hc-opacity-0 hc-pointer-events-none"}`}
|
|
69
|
-
onClick={handleReset}
|
|
70
|
-
>
|
|
71
|
-
<span className="hc-sr-only">Clear</span>
|
|
72
|
-
<Button.Icon icon="uil:times" className="hc-text-uiAccent" />
|
|
73
|
-
</Button.Btn>
|
|
74
|
-
</div>
|
|
75
|
-
</FilterCard>
|
|
76
|
-
);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export default Search;
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import Button from '~/components/modules/buttons/default';
|
|
3
|
+
import Icon from '~/components/modules/icon';
|
|
4
|
+
import FilterCard from '~/components/modules/cards/filter';
|
|
5
|
+
|
|
6
|
+
const Search = ({
|
|
7
|
+
inputPlaceholder,
|
|
8
|
+
showSearchIcon,
|
|
9
|
+
className,
|
|
10
|
+
labelClassName,
|
|
11
|
+
inputValue,
|
|
12
|
+
handleInputChange,
|
|
13
|
+
handleSubmitInput,
|
|
14
|
+
handleReset,
|
|
15
|
+
label
|
|
16
|
+
}) => {
|
|
17
|
+
const inputRef = useRef(null);
|
|
18
|
+
const buttonRef = useRef(null);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<FilterCard as="form" className={className ?? ""}>
|
|
22
|
+
<FilterCard.Title
|
|
23
|
+
as="label"
|
|
24
|
+
icon="fluent:search-12-filled"
|
|
25
|
+
className={labelClassName ?? ""}
|
|
26
|
+
>
|
|
27
|
+
<span>{label}</span>
|
|
28
|
+
</FilterCard.Title>
|
|
29
|
+
|
|
30
|
+
<div className="hc-relative hc-flex hc-items-center hc-px-2 hc-rounded hc-bg-white hc-border hc-border-uiAccent/20 focus-within:hc-ring-1 focus-within:hc-ring-uiAccent">
|
|
31
|
+
{showSearchIcon && (
|
|
32
|
+
<Icon
|
|
33
|
+
icon="fluent:search-12-filled"
|
|
34
|
+
size="hc-size-4"
|
|
35
|
+
className="hc-mr-2 hc-text-uiAccent/50"
|
|
36
|
+
/>
|
|
37
|
+
)}
|
|
38
|
+
<input
|
|
39
|
+
type="text"
|
|
40
|
+
name="search"
|
|
41
|
+
ref={inputRef}
|
|
42
|
+
onKeyDown={e => {
|
|
43
|
+
if (e.key === 'Enter') {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
buttonRef.current.click(); // Trigger the hidden button on Enter key press
|
|
46
|
+
}
|
|
47
|
+
}}
|
|
48
|
+
placeholder={inputPlaceholder}
|
|
49
|
+
value={inputValue}
|
|
50
|
+
className="hc-w-full hc-px-0 hc-py-2 hc-text-sm hc-border-0 hc-transition-colors placeholder:hc-text-uiText/50 focus:hc-ring-0 focus:hc-outline-none"
|
|
51
|
+
onChange={handleInputChange}
|
|
52
|
+
/>
|
|
53
|
+
|
|
54
|
+
<button
|
|
55
|
+
id="SearchButton"
|
|
56
|
+
ref={buttonRef}
|
|
57
|
+
type="button"
|
|
58
|
+
className="hidden hc-invisible"
|
|
59
|
+
onClick={() => handleSubmitInput(inputRef.current.value)}
|
|
60
|
+
>
|
|
61
|
+
Hidden Submit
|
|
62
|
+
</button>
|
|
63
|
+
|
|
64
|
+
<Button.Btn
|
|
65
|
+
type="reset"
|
|
66
|
+
variant="icon"
|
|
67
|
+
size="sqsm"
|
|
68
|
+
className={`transition-opacity ${inputValue ? "hc-opacity-100" : "hc-opacity-0 hc-pointer-events-none"}`}
|
|
69
|
+
onClick={handleReset}
|
|
70
|
+
>
|
|
71
|
+
<span className="hc-sr-only">Clear</span>
|
|
72
|
+
<Button.Icon icon="uil:times" className="hc-text-uiAccent" />
|
|
73
|
+
</Button.Btn>
|
|
74
|
+
</div>
|
|
75
|
+
</FilterCard>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default Search;
|