@abcagency/hc-ui-components 1.3.14 → 1.3.16
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/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/dist/apis/hcApi.js +1 -1
- package/dist/apis/hcApi.js.map +1 -1
- package/dist/clientToken.js.map +1 -1
- package/dist/components/HireControlMap.js +15 -5
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/modules/accordions/MapAccordionItem.js +11 -1
- package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
- package/dist/components/modules/accordions/default.js.map +1 -1
- package/dist/components/modules/accordions/filterItem.js +2 -1
- package/dist/components/modules/accordions/filterItem.js.map +1 -1
- package/dist/components/modules/accordions/filters.js +0 -3
- package/dist/components/modules/accordions/filters.js.map +1 -1
- package/dist/components/modules/buttons/button-group-apply.js +36 -15
- package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
- package/dist/components/modules/buttons/commute-pill.js.map +1 -1
- package/dist/components/modules/buttons/default.js.map +1 -1
- package/dist/components/modules/buttons/items-pill.js.map +1 -1
- package/dist/components/modules/buttons/pill-wrapper.js.map +1 -1
- package/dist/components/modules/buttons/show-all-button.js.map +1 -1
- package/dist/components/modules/cards/default.js.map +1 -1
- package/dist/components/modules/cards/filter.js.map +1 -1
- package/dist/components/modules/dialogs/apply-dialog.js.map +1 -1
- package/dist/components/modules/filter/commute.js +22 -6
- package/dist/components/modules/filter/commute.js.map +1 -1
- package/dist/components/modules/filter/index.js +7 -0
- package/dist/components/modules/filter/index.js.map +1 -1
- package/dist/components/modules/filter/item.js +16 -1
- package/dist/components/modules/filter/item.js.map +1 -1
- package/dist/components/modules/filter/location.js +1 -1
- package/dist/components/modules/filter/location.js.map +1 -1
- package/dist/components/modules/filter/points-of-interest.js.map +1 -1
- package/dist/components/modules/filter/radio-item.js +7 -0
- 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.map +1 -1
- package/dist/components/modules/grid.js.map +1 -1
- package/dist/components/modules/icon.js.map +1 -1
- package/dist/components/modules/jobListing/listing-details.js +6 -0
- package/dist/components/modules/jobListing/listing-details.js.map +1 -1
- package/dist/components/modules/maps/info-window-card.js.map +1 -1
- package/dist/components/modules/maps/info-window-content.js +20 -0
- package/dist/components/modules/maps/info-window-content.js.map +1 -1
- package/dist/components/modules/maps/list/field-mapper.js.map +1 -1
- package/dist/components/modules/maps/list/header-item.js.map +1 -1
- package/dist/components/modules/maps/list/header.js.map +1 -1
- package/dist/components/modules/maps/list/index.js +21 -12
- package/dist/components/modules/maps/list/index.js.map +1 -1
- package/dist/components/modules/maps/list/item-expand-card/index.js.map +1 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js.map +1 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-details.js.map +1 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-headshot.js.map +1 -1
- package/dist/components/modules/maps/list/list-item/index.js +12 -2
- package/dist/components/modules/maps/list/list-item/index.js.map +1 -1
- package/dist/components/modules/maps/map-list.js.map +1 -1
- package/dist/components/modules/maps/map-marker.js +10 -0
- package/dist/components/modules/maps/map-marker.js.map +1 -1
- package/dist/components/modules/maps/map.js.map +1 -1
- package/dist/components/modules/maps/place-marker.js.map +1 -1
- package/dist/components/modules/maps/tabs.js.map +1 -1
- package/dist/constants/eventTypes.js +16 -0
- package/dist/constants/eventTypes.js.map +1 -0
- package/dist/constants/placeTypes.js.map +1 -1
- package/dist/contexts/mapContext.js +9 -27
- package/dist/contexts/mapContext.js.map +1 -1
- package/dist/contexts/mapListContext.js +57 -38
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/contexts/placesContext.js.map +1 -1
- package/dist/contexts/trackEventContext.js +20 -0
- package/dist/contexts/trackEventContext.js.map +1 -0
- package/dist/hooks/useList.js +1 -13
- package/dist/hooks/useList.js.map +1 -1
- package/dist/services/apis/hcApi.js +1 -1
- package/dist/services/apis/hcApi.js.map +1 -1
- package/dist/services/clientToken.js.map +1 -1
- package/dist/services/configService.js.map +1 -1
- package/dist/services/googlePlacesNearbyService.js.map +1 -1
- package/dist/services/listingAggregatorService.js +43 -16
- package/dist/services/listingAggregatorService.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/util/filterUtil.js.map +1 -1
- package/dist/util/loading.js.map +1 -1
- package/dist/util/localStorageUtil.js.map +1 -1
- package/dist/util/mapIconUtil.js.map +1 -1
- package/dist/util/mapUtil.js.map +1 -1
- package/dist/util/sortUtil.js.map +1 -1
- package/dist/util/stringUtils.js.map +1 -1
- package/jsconfig.json +7 -7
- package/package.json +60 -60
- package/postcss.config.js +13 -13
- package/preset.default.js +15 -15
- package/rollup.config.mjs +88 -87
- package/src/apis/hcApi.js +93 -93
- package/src/clientToken.js +9 -9
- package/src/components/HireControlMap.js +129 -124
- package/src/components/modules/accordions/MapAccordionItem.js +74 -72
- package/src/components/modules/accordions/default.js +171 -171
- package/src/components/modules/accordions/filterItem.js +55 -53
- package/src/components/modules/accordions/filters.js +47 -47
- package/src/components/modules/buttons/button-group-apply.js +123 -116
- package/src/components/modules/buttons/commute-pill.js +22 -22
- package/src/components/modules/buttons/default.js +194 -194
- package/src/components/modules/buttons/items-pill.js +35 -35
- package/src/components/modules/buttons/pill-wrapper.js +27 -27
- package/src/components/modules/buttons/show-all-button.js +20 -20
- package/src/components/modules/cards/default.js +167 -167
- package/src/components/modules/cards/filter.js +56 -56
- package/src/components/modules/dialogs/apply-dialog.js +48 -48
- package/src/components/modules/filter/commute.js +154 -149
- package/src/components/modules/filter/index.js +89 -87
- package/src/components/modules/filter/item.js +87 -76
- package/src/components/modules/filter/location.js +71 -71
- package/src/components/modules/filter/points-of-interest.js +44 -44
- package/src/components/modules/filter/radio-item.js +57 -53
- package/src/components/modules/filter/search.js +92 -92
- package/src/components/modules/filter/sort.js +83 -83
- package/src/components/modules/grid.js +54 -54
- package/src/components/modules/icon.js +33 -33
- package/src/components/modules/jobListing/listing-details.js +99 -95
- package/src/components/modules/maps/info-window-card.js +17 -17
- package/src/components/modules/maps/info-window-content.js +81 -74
- package/src/components/modules/maps/list/field-mapper.js +112 -112
- package/src/components/modules/maps/list/header-item.js +91 -91
- package/src/components/modules/maps/list/header.js +47 -47
- package/src/components/modules/maps/list/index.js +112 -107
- package/src/components/modules/maps/list/item-expand-card/index.js +22 -22
- package/src/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js +50 -50
- package/src/components/modules/maps/list/item-expand-card/recruiter-details.js +68 -68
- package/src/components/modules/maps/list/item-expand-card/recruiter-headshot.js +22 -22
- package/src/components/modules/maps/list/list-item/index.js +135 -133
- package/src/components/modules/maps/map-list.js +74 -74
- package/src/components/modules/maps/map-marker.js +88 -86
- package/src/components/modules/maps/map.js +230 -230
- package/src/components/modules/maps/place-marker.js +41 -41
- package/src/components/modules/maps/tabs.js +81 -81
- package/src/constants/eventTypes.js +13 -0
- package/src/constants/placeTypes.js +8 -8
- package/src/contexts/mapContext.js +101 -115
- package/src/contexts/mapListContext.js +242 -222
- package/src/contexts/placesContext.js +102 -102
- package/src/contexts/trackEventContext.js +14 -0
- package/src/hooks/useList.js +89 -100
- package/src/index.js +3 -3
- package/src/services/configService.js +16 -16
- package/src/services/googlePlacesNearbyService.js +33 -33
- package/src/services/listingAggregatorService.js +50 -45
- package/src/services/listingEntityService.js +15 -15
- package/src/services/listingService.js +26 -26
- package/src/services/recruiterService.js +17 -17
- package/src/styles/index.css +23 -23
- package/src/util/arrayUtil.js +3 -3
- package/src/util/fieldMapper.js +22 -22
- package/src/util/filterUtil.js +195 -195
- package/src/util/loading.js +17 -17
- package/src/util/localStorageUtil.js +26 -26
- package/src/util/mapIconUtil.js +180 -180
- package/src/util/mapUtil.js +91 -91
- package/src/util/sortUtil.js +32 -32
- package/src/util/stringUtils.js +6 -6
- package/src/util/urlFilterUtil.js +90 -90
- package/tailwind.config.js +126 -126
- package/.editorconfig +0 -12
- package/.eslintrc +0 -105
- package/.prettierignore +0 -3
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
import React, { useRef, useState, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
import Button from '~/components/modules/buttons/default';
|
|
4
|
-
import Icon from '~/components/modules/icon';
|
|
5
|
-
import FilterCard from '~/components/modules/cards/filter';
|
|
6
|
-
|
|
7
|
-
import { useMapList } from '~/contexts/mapListContext';
|
|
8
|
-
|
|
9
|
-
const Search = ({
|
|
10
|
-
inputPlaceholder = "Keywords",
|
|
11
|
-
showSearchIcon = false,
|
|
12
|
-
className,
|
|
13
|
-
labelClassName
|
|
14
|
-
}) => {
|
|
15
|
-
const [inputValue, setInputValue] = useState(query != null ? query : "");
|
|
16
|
-
const debounceTimer = useRef(null);
|
|
17
|
-
const {
|
|
18
|
-
query,
|
|
19
|
-
setQuery,
|
|
20
|
-
siteConfig
|
|
21
|
-
} = useMapList();
|
|
22
|
-
const handleInputChange = e => {
|
|
23
|
-
setInputValue(e.target.value);
|
|
24
|
-
if (debounceTimer.current) {
|
|
25
|
-
clearTimeout(debounceTimer.current);
|
|
26
|
-
}
|
|
27
|
-
debounceTimer.current = setTimeout(() => {
|
|
28
|
-
setQuery(e.target.value);
|
|
29
|
-
}, 500);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const handleReset = () => {
|
|
33
|
-
setInputValue("");
|
|
34
|
-
setQuery("");
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (query == null) {
|
|
39
|
-
setInputValue("");
|
|
40
|
-
}
|
|
41
|
-
}, [query]);
|
|
42
|
-
inputPlaceholder = siteConfig.searchConfig.placeholder;
|
|
43
|
-
return (
|
|
44
|
-
<FilterCard as="form" className={className ?? ""}>
|
|
45
|
-
<FilterCard.Title
|
|
46
|
-
as="label"
|
|
47
|
-
icon="fluent:search-12-filled"
|
|
48
|
-
className={labelClassName ?? ""}
|
|
49
|
-
>
|
|
50
|
-
<span>
|
|
51
|
-
{siteConfig.searchConfig.label}
|
|
52
|
-
</span>
|
|
53
|
-
</FilterCard.Title>
|
|
54
|
-
|
|
55
|
-
<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">
|
|
56
|
-
{showSearchIcon && (
|
|
57
|
-
<Icon
|
|
58
|
-
icon="fluent:search-12-filled"
|
|
59
|
-
size="hc-size-4"
|
|
60
|
-
className="hc-mr-2 hc-text-uiAccent/50"
|
|
61
|
-
/>
|
|
62
|
-
)}
|
|
63
|
-
<input
|
|
64
|
-
type="text"
|
|
65
|
-
name="search"
|
|
66
|
-
onKeyDown={e => {
|
|
67
|
-
if (e.key === 'Enter') {
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
}
|
|
70
|
-
}}
|
|
71
|
-
placeholder={inputPlaceholder}
|
|
72
|
-
value={inputValue}
|
|
73
|
-
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"
|
|
74
|
-
onChange={handleInputChange}
|
|
75
|
-
/>
|
|
76
|
-
|
|
77
|
-
<Button.Btn
|
|
78
|
-
type="reset"
|
|
79
|
-
variant="icon"
|
|
80
|
-
size="sqsm"
|
|
81
|
-
className={`transition-opacity ${inputValue ? "hc-opacity-100" : "hc-opacity-0 hc-pointer-events-none"}`}
|
|
82
|
-
onClick={handleReset}
|
|
83
|
-
>
|
|
84
|
-
<span className="sr-only">Clear</span>
|
|
85
|
-
<Button.Icon icon="uil:times" className="hc-text-uiAccent" />
|
|
86
|
-
</Button.Btn>
|
|
87
|
-
</div>
|
|
88
|
-
</FilterCard>
|
|
89
|
-
);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export default Search;
|
|
1
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
import Button from '~/components/modules/buttons/default';
|
|
4
|
+
import Icon from '~/components/modules/icon';
|
|
5
|
+
import FilterCard from '~/components/modules/cards/filter';
|
|
6
|
+
|
|
7
|
+
import { useMapList } from '~/contexts/mapListContext';
|
|
8
|
+
|
|
9
|
+
const Search = ({
|
|
10
|
+
inputPlaceholder = "Keywords",
|
|
11
|
+
showSearchIcon = false,
|
|
12
|
+
className,
|
|
13
|
+
labelClassName
|
|
14
|
+
}) => {
|
|
15
|
+
const [inputValue, setInputValue] = useState(query != null ? query : "");
|
|
16
|
+
const debounceTimer = useRef(null);
|
|
17
|
+
const {
|
|
18
|
+
query,
|
|
19
|
+
setQuery,
|
|
20
|
+
siteConfig
|
|
21
|
+
} = useMapList();
|
|
22
|
+
const handleInputChange = e => {
|
|
23
|
+
setInputValue(e.target.value);
|
|
24
|
+
if (debounceTimer.current) {
|
|
25
|
+
clearTimeout(debounceTimer.current);
|
|
26
|
+
}
|
|
27
|
+
debounceTimer.current = setTimeout(() => {
|
|
28
|
+
setQuery(e.target.value);
|
|
29
|
+
}, 500);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const handleReset = () => {
|
|
33
|
+
setInputValue("");
|
|
34
|
+
setQuery("");
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (query == null) {
|
|
39
|
+
setInputValue("");
|
|
40
|
+
}
|
|
41
|
+
}, [query]);
|
|
42
|
+
inputPlaceholder = siteConfig.searchConfig.placeholder;
|
|
43
|
+
return (
|
|
44
|
+
<FilterCard as="form" className={className ?? ""}>
|
|
45
|
+
<FilterCard.Title
|
|
46
|
+
as="label"
|
|
47
|
+
icon="fluent:search-12-filled"
|
|
48
|
+
className={labelClassName ?? ""}
|
|
49
|
+
>
|
|
50
|
+
<span>
|
|
51
|
+
{siteConfig.searchConfig.label}
|
|
52
|
+
</span>
|
|
53
|
+
</FilterCard.Title>
|
|
54
|
+
|
|
55
|
+
<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">
|
|
56
|
+
{showSearchIcon && (
|
|
57
|
+
<Icon
|
|
58
|
+
icon="fluent:search-12-filled"
|
|
59
|
+
size="hc-size-4"
|
|
60
|
+
className="hc-mr-2 hc-text-uiAccent/50"
|
|
61
|
+
/>
|
|
62
|
+
)}
|
|
63
|
+
<input
|
|
64
|
+
type="text"
|
|
65
|
+
name="search"
|
|
66
|
+
onKeyDown={e => {
|
|
67
|
+
if (e.key === 'Enter') {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
}
|
|
70
|
+
}}
|
|
71
|
+
placeholder={inputPlaceholder}
|
|
72
|
+
value={inputValue}
|
|
73
|
+
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"
|
|
74
|
+
onChange={handleInputChange}
|
|
75
|
+
/>
|
|
76
|
+
|
|
77
|
+
<Button.Btn
|
|
78
|
+
type="reset"
|
|
79
|
+
variant="icon"
|
|
80
|
+
size="sqsm"
|
|
81
|
+
className={`transition-opacity ${inputValue ? "hc-opacity-100" : "hc-opacity-0 hc-pointer-events-none"}`}
|
|
82
|
+
onClick={handleReset}
|
|
83
|
+
>
|
|
84
|
+
<span className="sr-only">Clear</span>
|
|
85
|
+
<Button.Icon icon="uil:times" className="hc-text-uiAccent" />
|
|
86
|
+
</Button.Btn>
|
|
87
|
+
</div>
|
|
88
|
+
</FilterCard>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default Search;
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import * as Select from '@radix-ui/react-select';
|
|
3
|
-
import { twMerge } from 'tailwind-merge';
|
|
4
|
-
|
|
5
|
-
import Icon from '~/components/modules/icon';
|
|
6
|
-
import Button from '~/components/modules/buttons/default';
|
|
7
|
-
|
|
8
|
-
const FilterSort = ({ className, fields, setSortSetting, fieldNames }) => {
|
|
9
|
-
const handleSortChange = value => {
|
|
10
|
-
const [field, direction] = value.split("-");
|
|
11
|
-
setSortSetting({ field, type: direction });
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<div className={className ?? ""}>
|
|
16
|
-
<Select.Root onValueChange={handleSortChange}>
|
|
17
|
-
<Select.Trigger asChild aria-label="Sort">
|
|
18
|
-
<Button.Btn variant="outline" size="sm" className="hc-normal-case">
|
|
19
|
-
<Button.Body className="hc-justify-center">
|
|
20
|
-
<Select.Value placeholder={
|
|
21
|
-
<span className="hc-flex hc-items-center hc-gap-2">
|
|
22
|
-
Sort
|
|
23
|
-
<Icon icon="mdi:sort" />
|
|
24
|
-
</span>
|
|
25
|
-
} />
|
|
26
|
-
<Select.Icon>
|
|
27
|
-
<Button.Icon icon="mdi:chevron-down" />
|
|
28
|
-
</Select.Icon>
|
|
29
|
-
</Button.Body>
|
|
30
|
-
</Button.Btn>
|
|
31
|
-
</Select.Trigger>
|
|
32
|
-
<Select.Portal>
|
|
33
|
-
<Select.Content className={`hc-relative hc-z-[200] hc-overflow-hidden hc-bg-white hc-rounded-md `}>
|
|
34
|
-
<Select.ScrollUpButton className="hc-flex hc-items-center hc-justify-center hc-h-5 hc-bg-white hc-text-primary hc-cursor-default">
|
|
35
|
-
<Icon icon="mdi:chevron-up" />
|
|
36
|
-
</Select.ScrollUpButton>
|
|
37
|
-
<Select.Viewport className="hc-p-1">
|
|
38
|
-
{fields.map(field => (
|
|
39
|
-
<Select.Group key={field}>
|
|
40
|
-
<SelectItem value={`${field}-asc`}>
|
|
41
|
-
<span className="hc-flex hc-items-center hc-justify-between hc-gap-2 hc-w-full">
|
|
42
|
-
{fieldNames[field] ?? field}
|
|
43
|
-
<Icon icon="mdi:sort-ascending" />
|
|
44
|
-
</span>
|
|
45
|
-
</SelectItem>
|
|
46
|
-
<SelectItem value={`${field}-desc`}>
|
|
47
|
-
<span className="hc-flex hc-items-center hc-justify-between hc-gap-2 w-full">
|
|
48
|
-
{fieldNames[field] ?? field}
|
|
49
|
-
<Icon icon="mdi:sort-descending" />
|
|
50
|
-
</span>
|
|
51
|
-
</SelectItem>
|
|
52
|
-
</Select.Group>
|
|
53
|
-
))}
|
|
54
|
-
</Select.Viewport>
|
|
55
|
-
<Select.ScrollDownButton className="hc-flex hc-items-center hc-justify-center hc-h-5 hc-bg-white hc-text-primary hc-cursor-default">
|
|
56
|
-
<Icon icon="mdi:chevron-down" />
|
|
57
|
-
</Select.ScrollDownButton>
|
|
58
|
-
</Select.Content>
|
|
59
|
-
</Select.Portal>
|
|
60
|
-
</Select.Root>
|
|
61
|
-
</div>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const SelectItem = forwardRef(({ children, className, ...props }, forwardedRef) => (
|
|
66
|
-
<Select.Item
|
|
67
|
-
className={twMerge(
|
|
68
|
-
"hc-text-sm hc-leading-none hc-rounded-sm hc-flex hc-items-center hc-w-full hc-py-1.5 hc-pr-4 hc-pl-7 hc-relative hc-select-none hc-cursor-pointer data-[disabled]:hc-text-gray-500 data-[disabled]:hc-pointer-events-none data-[highlighted]:hc-outline-none data-[highlighted]:hc-bg-primary data-[highlighted]:hc-text-white",
|
|
69
|
-
className
|
|
70
|
-
)}
|
|
71
|
-
{...props}
|
|
72
|
-
ref={forwardedRef}
|
|
73
|
-
>
|
|
74
|
-
<Select.ItemText>{children}</Select.ItemText>
|
|
75
|
-
<Select.ItemIndicator className="hc-absolute hc-left-0 hc-w-8 hc-inline-flex hc-items-center hc-justify-center">
|
|
76
|
-
<Icon icon="mdi:check" />
|
|
77
|
-
</Select.ItemIndicator>
|
|
78
|
-
</Select.Item>
|
|
79
|
-
));
|
|
80
|
-
|
|
81
|
-
SelectItem.displayName = "SelectItem";
|
|
82
|
-
|
|
83
|
-
export default FilterSort;
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import * as Select from '@radix-ui/react-select';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
|
|
5
|
+
import Icon from '~/components/modules/icon';
|
|
6
|
+
import Button from '~/components/modules/buttons/default';
|
|
7
|
+
|
|
8
|
+
const FilterSort = ({ className, fields, setSortSetting, fieldNames }) => {
|
|
9
|
+
const handleSortChange = value => {
|
|
10
|
+
const [field, direction] = value.split("-");
|
|
11
|
+
setSortSetting({ field, type: direction });
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className={className ?? ""}>
|
|
16
|
+
<Select.Root onValueChange={handleSortChange}>
|
|
17
|
+
<Select.Trigger asChild aria-label="Sort">
|
|
18
|
+
<Button.Btn variant="outline" size="sm" className="hc-normal-case">
|
|
19
|
+
<Button.Body className="hc-justify-center">
|
|
20
|
+
<Select.Value placeholder={
|
|
21
|
+
<span className="hc-flex hc-items-center hc-gap-2">
|
|
22
|
+
Sort
|
|
23
|
+
<Icon icon="mdi:sort" />
|
|
24
|
+
</span>
|
|
25
|
+
} />
|
|
26
|
+
<Select.Icon>
|
|
27
|
+
<Button.Icon icon="mdi:chevron-down" />
|
|
28
|
+
</Select.Icon>
|
|
29
|
+
</Button.Body>
|
|
30
|
+
</Button.Btn>
|
|
31
|
+
</Select.Trigger>
|
|
32
|
+
<Select.Portal>
|
|
33
|
+
<Select.Content className={`hc-relative hc-z-[200] hc-overflow-hidden hc-bg-white hc-rounded-md `}>
|
|
34
|
+
<Select.ScrollUpButton className="hc-flex hc-items-center hc-justify-center hc-h-5 hc-bg-white hc-text-primary hc-cursor-default">
|
|
35
|
+
<Icon icon="mdi:chevron-up" />
|
|
36
|
+
</Select.ScrollUpButton>
|
|
37
|
+
<Select.Viewport className="hc-p-1">
|
|
38
|
+
{fields.map(field => (
|
|
39
|
+
<Select.Group key={field}>
|
|
40
|
+
<SelectItem value={`${field}-asc`}>
|
|
41
|
+
<span className="hc-flex hc-items-center hc-justify-between hc-gap-2 hc-w-full">
|
|
42
|
+
{fieldNames[field] ?? field}
|
|
43
|
+
<Icon icon="mdi:sort-ascending" />
|
|
44
|
+
</span>
|
|
45
|
+
</SelectItem>
|
|
46
|
+
<SelectItem value={`${field}-desc`}>
|
|
47
|
+
<span className="hc-flex hc-items-center hc-justify-between hc-gap-2 w-full">
|
|
48
|
+
{fieldNames[field] ?? field}
|
|
49
|
+
<Icon icon="mdi:sort-descending" />
|
|
50
|
+
</span>
|
|
51
|
+
</SelectItem>
|
|
52
|
+
</Select.Group>
|
|
53
|
+
))}
|
|
54
|
+
</Select.Viewport>
|
|
55
|
+
<Select.ScrollDownButton className="hc-flex hc-items-center hc-justify-center hc-h-5 hc-bg-white hc-text-primary hc-cursor-default">
|
|
56
|
+
<Icon icon="mdi:chevron-down" />
|
|
57
|
+
</Select.ScrollDownButton>
|
|
58
|
+
</Select.Content>
|
|
59
|
+
</Select.Portal>
|
|
60
|
+
</Select.Root>
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const SelectItem = forwardRef(({ children, className, ...props }, forwardedRef) => (
|
|
66
|
+
<Select.Item
|
|
67
|
+
className={twMerge(
|
|
68
|
+
"hc-text-sm hc-leading-none hc-rounded-sm hc-flex hc-items-center hc-w-full hc-py-1.5 hc-pr-4 hc-pl-7 hc-relative hc-select-none hc-cursor-pointer data-[disabled]:hc-text-gray-500 data-[disabled]:hc-pointer-events-none data-[highlighted]:hc-outline-none data-[highlighted]:hc-bg-primary data-[highlighted]:hc-text-white",
|
|
69
|
+
className
|
|
70
|
+
)}
|
|
71
|
+
{...props}
|
|
72
|
+
ref={forwardedRef}
|
|
73
|
+
>
|
|
74
|
+
<Select.ItemText>{children}</Select.ItemText>
|
|
75
|
+
<Select.ItemIndicator className="hc-absolute hc-left-0 hc-w-8 hc-inline-flex hc-items-center hc-justify-center">
|
|
76
|
+
<Icon icon="mdi:check" />
|
|
77
|
+
</Select.ItemIndicator>
|
|
78
|
+
</Select.Item>
|
|
79
|
+
));
|
|
80
|
+
|
|
81
|
+
SelectItem.displayName = "SelectItem";
|
|
82
|
+
|
|
83
|
+
export default FilterSort;
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { twMerge } from 'tailwind-merge';
|
|
3
|
-
|
|
4
|
-
const Grid = forwardRef((props, ref) => {
|
|
5
|
-
const {
|
|
6
|
-
as = 'div',
|
|
7
|
-
children,
|
|
8
|
-
className,
|
|
9
|
-
autoRows = true,
|
|
10
|
-
columns = 'md:hc-grid-cols-2',
|
|
11
|
-
gap = 'hc-gap-12 lg:hc-gap-16',
|
|
12
|
-
...rest
|
|
13
|
-
} = props;
|
|
14
|
-
|
|
15
|
-
const Container = as;
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<Container
|
|
19
|
-
ref={ref}
|
|
20
|
-
className={twMerge(
|
|
21
|
-
'hc-grid',
|
|
22
|
-
gap,
|
|
23
|
-
autoRows ? 'hc-auto-rows-min' : '',
|
|
24
|
-
'hc-grid-cols-1',
|
|
25
|
-
columns,
|
|
26
|
-
className ?? ''
|
|
27
|
-
)}
|
|
28
|
-
{...rest}
|
|
29
|
-
>
|
|
30
|
-
{children}
|
|
31
|
-
</Container>
|
|
32
|
-
);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export const GridItem = ({
|
|
36
|
-
as = 'div',
|
|
37
|
-
children,
|
|
38
|
-
className
|
|
39
|
-
}) => {
|
|
40
|
-
const Container = as;
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<Container
|
|
44
|
-
className={className ?? ''}
|
|
45
|
-
>
|
|
46
|
-
{children}
|
|
47
|
-
</Container>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
Grid.Item = GridItem;
|
|
52
|
-
|
|
53
|
-
Grid.displayName = 'Grid';
|
|
54
|
-
export default Grid;
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
|
|
4
|
+
const Grid = forwardRef((props, ref) => {
|
|
5
|
+
const {
|
|
6
|
+
as = 'div',
|
|
7
|
+
children,
|
|
8
|
+
className,
|
|
9
|
+
autoRows = true,
|
|
10
|
+
columns = 'md:hc-grid-cols-2',
|
|
11
|
+
gap = 'hc-gap-12 lg:hc-gap-16',
|
|
12
|
+
...rest
|
|
13
|
+
} = props;
|
|
14
|
+
|
|
15
|
+
const Container = as;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Container
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={twMerge(
|
|
21
|
+
'hc-grid',
|
|
22
|
+
gap,
|
|
23
|
+
autoRows ? 'hc-auto-rows-min' : '',
|
|
24
|
+
'hc-grid-cols-1',
|
|
25
|
+
columns,
|
|
26
|
+
className ?? ''
|
|
27
|
+
)}
|
|
28
|
+
{...rest}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
</Container>
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const GridItem = ({
|
|
36
|
+
as = 'div',
|
|
37
|
+
children,
|
|
38
|
+
className
|
|
39
|
+
}) => {
|
|
40
|
+
const Container = as;
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Container
|
|
44
|
+
className={className ?? ''}
|
|
45
|
+
>
|
|
46
|
+
{children}
|
|
47
|
+
</Container>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
Grid.Item = GridItem;
|
|
52
|
+
|
|
53
|
+
Grid.displayName = 'Grid';
|
|
54
|
+
export default Grid;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Icon } from '@iconify/react';
|
|
3
|
-
|
|
4
|
-
const IconContained = ({
|
|
5
|
-
className,
|
|
6
|
-
size,
|
|
7
|
-
icon,
|
|
8
|
-
iconClasses,
|
|
9
|
-
title,
|
|
10
|
-
...iconProps
|
|
11
|
-
}) => {
|
|
12
|
-
return (
|
|
13
|
-
<span
|
|
14
|
-
title={title}
|
|
15
|
-
className={`
|
|
16
|
-
hc-inline-block hc-align-middle
|
|
17
|
-
${className ?? ''}
|
|
18
|
-
${size ?? ''}
|
|
19
|
-
`}
|
|
20
|
-
>
|
|
21
|
-
<Icon
|
|
22
|
-
icon={icon}
|
|
23
|
-
className={`
|
|
24
|
-
${iconClasses ?? ''}
|
|
25
|
-
${size ?? ''}
|
|
26
|
-
`}
|
|
27
|
-
{...iconProps}
|
|
28
|
-
/>
|
|
29
|
-
</span>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default IconContained;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Icon } from '@iconify/react';
|
|
3
|
+
|
|
4
|
+
const IconContained = ({
|
|
5
|
+
className,
|
|
6
|
+
size,
|
|
7
|
+
icon,
|
|
8
|
+
iconClasses,
|
|
9
|
+
title,
|
|
10
|
+
...iconProps
|
|
11
|
+
}) => {
|
|
12
|
+
return (
|
|
13
|
+
<span
|
|
14
|
+
title={title}
|
|
15
|
+
className={`
|
|
16
|
+
hc-inline-block hc-align-middle
|
|
17
|
+
${className ?? ''}
|
|
18
|
+
${size ?? ''}
|
|
19
|
+
`}
|
|
20
|
+
>
|
|
21
|
+
<Icon
|
|
22
|
+
icon={icon}
|
|
23
|
+
className={`
|
|
24
|
+
${iconClasses ?? ''}
|
|
25
|
+
${size ?? ''}
|
|
26
|
+
`}
|
|
27
|
+
{...iconProps}
|
|
28
|
+
/>
|
|
29
|
+
</span>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default IconContained;
|