@tmf_ciclica/ciclicastorybook 1.0.12 → 1.0.15
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/package.json +32 -54
- package/.storybook/main.js +0 -21
- package/.storybook/preview.jsx +0 -31
- package/eslint.config.js +0 -38
- package/index.html +0 -13
- package/public/vite.svg +0 -1
- package/src/App.css +0 -0
- package/src/App.jsx +0 -36
- package/src/_variables.scss +0 -56
- package/src/assets/img/arrowDown.svg +0 -3
- package/src/assets/img/closeIcon.svg +0 -4
- package/src/assets/img/copyIcon.svg +0 -17
- package/src/assets/img/deleteIcon.svg +0 -6
- package/src/assets/img/eyeActiveIcon.svg +0 -6
- package/src/assets/img/eyeNotActiveIcon.svg +0 -8
- package/src/assets/img/filtersIcon.svg +0 -6
- package/src/assets/img/langarrow.png +0 -0
- package/src/assets/img/pause.svg +0 -5
- package/src/assets/img/play.svg +0 -4
- package/src/assets/img/processingIcon.svg +0 -20
- package/src/assets/img/sample-image.png +0 -0
- package/src/assets/img/sample2.png +0 -0
- package/src/assets/img/world.svg +0 -3
- package/src/assets/mapStyles/mapStyle.js +0 -781
- package/src/components/AmbitSelector/AmbitItem/AmbitItem.jsx +0 -74
- package/src/components/AmbitSelector/AmbitItem/AmbitItem.module.scss +0 -27
- package/src/components/AmbitSelector/AmbitSelector.jsx +0 -68
- package/src/components/AmbitSelector/AmbitSelector.module.scss +0 -29
- package/src/components/AmbitSelector/AmbitSelector.stories.jsx +0 -21
- package/src/components/ButtonsList/ButtonsList.jsx +0 -92
- package/src/components/ButtonsList/ButtonsList.module.scss +0 -37
- package/src/components/ButtonsList/ButtonsList.stories.jsx +0 -55
- package/src/components/DropdownList/DropdownList.jsx +0 -69
- package/src/components/DropdownList/DropdownList.module.scss +0 -20
- package/src/components/DropdownList/DropdownList.stories.jsx +0 -22
- package/src/components/DropdownList/DropdownListExample/DropDownListExample.jsx +0 -33
- package/src/components/DropdownList/DropdownListExample/DropdownListExample.stories.jsx +0 -11
- package/src/components/EditAmbit/EditAmbit.jsx +0 -7
- package/src/components/FiltersAmbit/AppliedFilters/AppliedFilters.jsx +0 -57
- package/src/components/FiltersAmbit/AppliedFilters/AppliedFilters.module.scss +0 -13
- package/src/components/FiltersAmbit/AppliedFilters/AppliedFilters.stories.jsx +0 -47
- package/src/components/FiltersAmbit/FiltersAmbit.jsx +0 -58
- package/src/components/FiltersAmbit/FiltersAmbit.module.scss +0 -28
- package/src/components/FiltersAmbit/FiltersAmbit.stories.jsx +0 -36
- package/src/components/FiltersAmbit/GeographicFilters/GeographicalFilters.jsx +0 -33
- package/src/components/FiltersAmbit/GeographicFilters/GeographicalFilters.module.scss +0 -13
- package/src/components/FiltersAmbit/GeographicFilters/GeographicalFilters.stories.jsx +0 -47
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFilters.jsx +0 -83
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFilters.module.scss +0 -8
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFilters.stories.jsx +0 -17
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersCategory/TematicalFiltersCategory.jsx +0 -60
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/AbsoluteSlider/AbsoluteSlider.jsx +0 -61
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/AbsoluteSlider/AbsoluteSlider.module.scss +0 -45
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/CategoryCheckbox/CategoryChackbox.module.scss +0 -18
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/CategoryCheckbox/CategoryCheckbox.jsx +0 -47
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/TematicalFiltersInput.jsx +0 -267
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/TematicalFiltersInput.module.scss +0 -31
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersSubcat/TematicalFiltersSubcat.jsx +0 -58
- package/src/components/FiltersAmbit/useAmbitStore.jsx +0 -10
- package/src/components/Graphic/BarChart/BarChart.jsx +0 -146
- package/src/components/Graphic/BarChart/BarChart.module.scss +0 -5
- package/src/components/Graphic/BarChart/BarChart.stories.jsx +0 -18
- package/src/components/Graphic/Graphic.jsx +0 -55
- package/src/components/Graphic/Graphic.module.scss +0 -12
- package/src/components/Graphic/Graphic.stories.jsx +0 -25
- package/src/components/IndicatorsList/Indicator/Indicator.jsx +0 -180
- package/src/components/IndicatorsList/Indicator/Indicator.module.scss +0 -46
- package/src/components/IndicatorsList/IndicatorSubCategory/IndicatorSubCategory.jsx +0 -76
- package/src/components/IndicatorsList/IndicatorSubCategory/IndicatorSubCategory.module.scss +0 -12
- package/src/components/IndicatorsList/IndicatorsCategory/IndicatorsCategory.jsx +0 -122
- package/src/components/IndicatorsList/IndicatorsCategory/IndicatorsCategory.module.scss +0 -20
- package/src/components/IndicatorsList/IndicatorsList.jsx +0 -173
- package/src/components/IndicatorsList/IndicatorsList.module.scss +0 -10
- package/src/components/IndicatorsList/IndicatorsList.stories.jsx +0 -263
- package/src/components/LangSelector/LangSelector.jsx +0 -70
- package/src/components/LangSelector/LangSelector.module.scss +0 -41
- package/src/components/LangSelector/LangSelector.stories.jsx +0 -27
- package/src/components/Legend/Legend.jsx +0 -132
- package/src/components/Legend/Legend.module.scss +0 -121
- package/src/components/Legend/Legend.stories.jsx +0 -53
- package/src/components/LogoApp/LogoApp.jsx +0 -33
- package/src/components/LogoApp/LogoApp.module.scss +0 -7
- package/src/components/LogoApp/LogoApp.stories.jsx +0 -27
- package/src/components/MapboxMap/MapboxMap.jsx +0 -160
- package/src/components/MapboxMap/MapboxMap.module.scss +0 -4
- package/src/components/MapboxMap/MapboxMap.stories.jsx +0 -57
- package/src/components/MaplibreMap/MaplibreMap.jsx +0 -166
- package/src/components/MaplibreMap/MaplibreMap.module.scss +0 -5
- package/src/components/MaplibreMap/MaplibreMap.stories.jsx +0 -55
- package/src/components/SectionBar/SectionBar.jsx +0 -41
- package/src/components/SectionBar/SectionBar.module.scss +0 -40
- package/src/components/SectionBar/SectionBar.stories.jsx +0 -35
- package/src/components/TimeSlider/TimeSlider.jsx +0 -147
- package/src/components/TimeSlider/TimeSlider.module.scss +0 -63
- package/src/components/TimeSlider/TimeSlider.stories.jsx +0 -9
- package/src/components/Tooltip/Tooltip.jsx +0 -40
- package/src/components/Tooltip/Tooltip.module.scss +0 -141
- package/src/components/Tooltip/Tooltip.stories.jsx +0 -51
- package/src/components/TopNavMenu/TopNavMenu.jsx +0 -62
- package/src/components/TopNavMenu/TopNavMenu.module.scss +0 -21
- package/src/components/TopNavMenu/TopNavMenu.stories.jsx +0 -20
- package/src/components/UserMenuTrigger/UserMenuTrigger.jsx +0 -47
- package/src/components/UserMenuTrigger/UserMenuTrigger.module.scss +0 -5
- package/src/components/UserMenuTrigger/UserMenuTrigger.stories.jsx +0 -33
- package/src/components/index.jsx +0 -17
- package/src/constants/indicators.js +0 -1371
- package/src/constants/mapTexts.js +0 -161
- package/src/constants/textLayers.js +0 -639
- package/src/constants/topNavMenuOptions.js +0 -14
- package/src/i18n.js +0 -19
- package/src/index.jsx +0 -2
- package/src/index.scss +0 -87
- package/src/locales/ca.json +0 -8
- package/src/locales/es.json +0 -15
- package/src/main.jsx +0 -10
- package/src/sections/HeaderSection/HeaderSection.jsx +0 -51
- package/src/sections/HeaderSection/HeaderSection.module.scss +0 -33
- package/src/sections/HeaderSection/HeaderSection.stories.jsx +0 -61
- package/src/sections/RightSidebar/RightSidebar.jsx +0 -35
- package/src/sections/RightSidebar/RightSidebar.module.scss +0 -39
- package/src/sections/RightSidebar/RightSidebar.stories.jsx +0 -21
- package/src/sections/index.jsx +0 -2
- package/src/store/index.js +0 -1
- package/src/store/mapSlice/index.js +0 -1
- package/src/store/mapSlice/mapSlice.js +0 -30
- package/src/store/rightBarSlice/index.js +0 -1
- package/src/store/rightBarSlice/rightBarSlice.js +0 -28
- package/src/store/routerSlice/index.js +0 -1
- package/src/store/routerSlice/routerSlice.js +0 -14
- package/src/store/store.js +0 -14
- package/src/store/userSlice/index.js +0 -1
- package/src/store/userSlice/userSlice.js +0 -22
- package/tmf_ciclica-ciclicastorybook-1.0.8.tgz +0 -0
- package/vite.config.js +0 -49
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { AppliedFilters } from "./AppliedFilters"
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "Components/AppliedFilters",
|
|
5
|
-
component: AppliedFilters,
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
let open = true
|
|
9
|
-
let activeFilters = [
|
|
10
|
-
{
|
|
11
|
-
"type": "cat",
|
|
12
|
-
"code": "us_prn",
|
|
13
|
-
"values": [
|
|
14
|
-
0,
|
|
15
|
-
2
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"type": "cat",
|
|
20
|
-
"code": "al_max_cat",
|
|
21
|
-
"values": [
|
|
22
|
-
0
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"type": "cat",
|
|
27
|
-
"code": "uni_pluri",
|
|
28
|
-
"values": [
|
|
29
|
-
1
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"type": "abs",
|
|
34
|
-
"code": "al_max",
|
|
35
|
-
"min": 1,
|
|
36
|
-
"max": 11
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
|
|
40
|
-
export const Default = {
|
|
41
|
-
args: {
|
|
42
|
-
activeFilters,
|
|
43
|
-
isOpen: open,
|
|
44
|
-
textColor: "white",
|
|
45
|
-
backgroundColor: "#605B56"
|
|
46
|
-
},
|
|
47
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react"
|
|
2
|
-
|
|
3
|
-
import { A } from "storybook/internal/components"
|
|
4
|
-
import { AppliedFilters } from "./AppliedFilters/AppliedFilters"
|
|
5
|
-
import { GeographicalFilters } from "./GeographicFilters/GeographicalFilters"
|
|
6
|
-
import { TematicalFilters } from "./TematicalFilters/TematicalFilters"
|
|
7
|
-
import { filter } from "d3"
|
|
8
|
-
import styles from "./FiltersAmbit.module.scss"
|
|
9
|
-
import { useAmbitStore } from "./useAmbitStore"
|
|
10
|
-
import { useTranslation } from "react-i18next"
|
|
11
|
-
|
|
12
|
-
export const FiltersAmbit = ({
|
|
13
|
-
ambitName,
|
|
14
|
-
ambitDescription,
|
|
15
|
-
defaultFilters,
|
|
16
|
-
}) => {
|
|
17
|
-
const { t } = useTranslation()
|
|
18
|
-
|
|
19
|
-
const { tematicalFiltersSelected } = useAmbitStore((s) => s)
|
|
20
|
-
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (defaultFilters && defaultFilters.length > 0) {
|
|
23
|
-
// Initialize the store with default filters
|
|
24
|
-
useAmbitStore.setState((state) => ({
|
|
25
|
-
tematicalFiltersSelected: defaultFilters,
|
|
26
|
-
}))
|
|
27
|
-
}
|
|
28
|
-
}, [defaultFilters])
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
console.log("filtersSelected changed: ", tematicalFiltersSelected)
|
|
31
|
-
}, [tematicalFiltersSelected])
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<div className={styles.FiltersAmbitContainer}>
|
|
35
|
-
<div className={styles.FiltersAmbitHeader}>
|
|
36
|
-
<div className={styles.FiltersAmbitTitle}>{ambitName}</div>
|
|
37
|
-
<div className={styles.FiltersAmbitDescription}>
|
|
38
|
-
<div className={styles.FiltersAmbitDescriptionTitle}>
|
|
39
|
-
{t("Descripción")}
|
|
40
|
-
</div>
|
|
41
|
-
{ambitDescription}
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<AppliedFilters
|
|
46
|
-
title={t('Filtros Aplicados')}
|
|
47
|
-
isOpen={true}
|
|
48
|
-
textColor={"#ffffff"}
|
|
49
|
-
backgroundColor={"#605B5680"}
|
|
50
|
-
/>
|
|
51
|
-
|
|
52
|
-
<GeographicalFilters />
|
|
53
|
-
|
|
54
|
-
<TematicalFilters />
|
|
55
|
-
|
|
56
|
-
</div>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
.FiltersAmbitContainer {
|
|
2
|
-
width: 100%;
|
|
3
|
-
height: 100%;
|
|
4
|
-
padding: 28.5px 0 0 24px;
|
|
5
|
-
|
|
6
|
-
.FiltersAmbitHeader {
|
|
7
|
-
@include flex(column, start, start, $gap: 30px);
|
|
8
|
-
|
|
9
|
-
.FiltersAmbitTitle {
|
|
10
|
-
@include fontSubtitols;
|
|
11
|
-
padding: 0 0 26px 0;
|
|
12
|
-
border-bottom: 1.5px solid #605B56;
|
|
13
|
-
width: 100%;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.FiltersAmbitDescription {
|
|
17
|
-
@include flex(column, start, start, $gap: 10px);
|
|
18
|
-
padding: 0 0 26px 0;
|
|
19
|
-
// border-bottom: 1.5px solid #605B56;
|
|
20
|
-
@include fontBase;
|
|
21
|
-
|
|
22
|
-
.FiltersAmbitDescriptionTitle {
|
|
23
|
-
@include fontSubtitols;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { FiltersAmbit } from "./FiltersAmbit"
|
|
2
|
-
// import indicators from "../../../constants/indicators"
|
|
3
|
-
export default {
|
|
4
|
-
title: "Components/FiltersAmbit",
|
|
5
|
-
component: FiltersAmbit,
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const Default = {
|
|
9
|
-
args: {
|
|
10
|
-
ambitName: "Ambito 1",
|
|
11
|
-
ambitDescription:
|
|
12
|
-
"Enim occaecat consequat aute nulla fugiat ullamco proident.Culpa ex minim incididunt laboris magna ipsum. In duis irure enim culpa ex anim nulla deserunt ut voluptate amet. Aliquip id ea ut duis aute minim. Voluptate ut ipsum ea nisi quis do sunt et eu deserunt. Id tempor cupidatat veniam cupidatat enim consequat. Duis nulla velit amet ex cupidatat exercitation laborum sint dolore in dolore velit.",
|
|
13
|
-
defaultFilters: [
|
|
14
|
-
{
|
|
15
|
-
type: "cat",
|
|
16
|
-
code: "uni_pluri",
|
|
17
|
-
values: [1, 2, 3],
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
type: "cat",
|
|
21
|
-
code: "nom_cluster",
|
|
22
|
-
values: [2, 4, 6, 7, 8, 9, 10, 11, 12],
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: "cat",
|
|
26
|
-
code: "any_const_cat",
|
|
27
|
-
values: [2, 3, 4, 5],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: "cat",
|
|
31
|
-
code: "us_prn",
|
|
32
|
-
values: [2, 3, 4, 5, 6, 7, 8, 9, 10],
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react"
|
|
2
|
-
|
|
3
|
-
import { DropdownList } from "../../DropdownList/DropdownList"
|
|
4
|
-
import PropTypes from "prop-types"
|
|
5
|
-
// import styles from "./GeographicalFilters.module.scss"
|
|
6
|
-
import { useAmbitStore } from "../useAmbitStore"
|
|
7
|
-
import { useTranslation } from "react-i18next"
|
|
8
|
-
|
|
9
|
-
export const GeographicalFilters = ({ title, onClick, isOpen = true, textColor = "#ffffff", backgroundColor = "#605B5680" }) => {
|
|
10
|
-
const { t } = useTranslation()
|
|
11
|
-
|
|
12
|
-
const { tematicalFiltersSelected } = useAmbitStore((s) => s)
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<DropdownList
|
|
16
|
-
isOpen={isOpen}
|
|
17
|
-
onClick={onClick}
|
|
18
|
-
title={title ? t(title) : "Geographical Filters"}
|
|
19
|
-
>
|
|
20
|
-
|
|
21
|
-
A
|
|
22
|
-
</DropdownList>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
GeographicalFilters.propTypes = {
|
|
26
|
-
isOpen: PropTypes.bool,
|
|
27
|
-
onClick: PropTypes.func,
|
|
28
|
-
title: PropTypes.string,
|
|
29
|
-
textColor: PropTypes.string,
|
|
30
|
-
backgroundColor: PropTypes.string,
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
.GeographicalFilters {
|
|
2
|
-
@include flex(row, start, start, $gap: 10px);
|
|
3
|
-
|
|
4
|
-
.AppliedFilterContent {
|
|
5
|
-
@include flex($gap: 10px);
|
|
6
|
-
@include fontBase;
|
|
7
|
-
height: 35px;
|
|
8
|
-
width: fit-content;
|
|
9
|
-
padding: 0px 20px;
|
|
10
|
-
border-radius: 100px;
|
|
11
|
-
// background-color: red;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { GeographicalFilters } from "./GeographicalFilters"
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "Components/GeographicalFilters",
|
|
5
|
-
component: GeographicalFilters,
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
let open = true
|
|
9
|
-
let activeFilters = [
|
|
10
|
-
{
|
|
11
|
-
"type": "cat",
|
|
12
|
-
"code": "us_prn",
|
|
13
|
-
"values": [
|
|
14
|
-
0,
|
|
15
|
-
2
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"type": "cat",
|
|
20
|
-
"code": "al_max_cat",
|
|
21
|
-
"values": [
|
|
22
|
-
0
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"type": "cat",
|
|
27
|
-
"code": "uni_pluri",
|
|
28
|
-
"values": [
|
|
29
|
-
1
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"type": "abs",
|
|
34
|
-
"code": "al_max",
|
|
35
|
-
"min": 1,
|
|
36
|
-
"max": 11
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
|
|
40
|
-
export const Default = {
|
|
41
|
-
// args: {
|
|
42
|
-
// activeFilters,
|
|
43
|
-
// isOpen: open,
|
|
44
|
-
// textColor: "white",
|
|
45
|
-
// backgroundColor: "#605B56"
|
|
46
|
-
// },
|
|
47
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react"
|
|
2
|
-
import Indicadores from "../../../constants/indicators"
|
|
3
|
-
import { DropdownList } from "../../DropdownList/DropdownList"
|
|
4
|
-
import { useTranslation } from "react-i18next"
|
|
5
|
-
//import styles from "./TematicalFilters.module.scss"
|
|
6
|
-
import { TematicalFiltersCategory } from "./TematicalFiltersCategory/TematicalFiltersCategory"
|
|
7
|
-
import PropTypes from "prop-types"
|
|
8
|
-
import { useAmbitStore } from "../useAmbitStore"
|
|
9
|
-
|
|
10
|
-
//Needs DropdownList, zustand and react-slider component to be used
|
|
11
|
-
export const TematicalFilters = ({
|
|
12
|
-
indicators = Indicadores,
|
|
13
|
-
isOpen = true,
|
|
14
|
-
title,
|
|
15
|
-
fontColor = "#605B56",
|
|
16
|
-
//The color of the slider and the checkbox when is checked
|
|
17
|
-
inputsColor = "#605B56",
|
|
18
|
-
}) => {
|
|
19
|
-
const { tematicalFiltersSelected } = useAmbitStore((s) => s)
|
|
20
|
-
const { t } = useTranslation()
|
|
21
|
-
//This function is used to reset the indicator selected when type is changed
|
|
22
|
-
//Only use it if we cant select both types at the same time.
|
|
23
|
-
// const onChangeBothType = ({ code }) => {
|
|
24
|
-
// setFiltersSelected((actual) => {
|
|
25
|
-
// let foundIndicator = actual.find((f) => f.code == code)
|
|
26
|
-
// //If the indicator is found, we delete the indicator key
|
|
27
|
-
// if (foundIndicator) {
|
|
28
|
-
// let newFiltersSelected = actual.filter((f) => f.code !== code)
|
|
29
|
-
// return newFiltersSelected
|
|
30
|
-
// } else {
|
|
31
|
-
// return actual
|
|
32
|
-
// }
|
|
33
|
-
// })
|
|
34
|
-
// }
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
console.log("filtersSelected changed: ", tematicalFiltersSelected)
|
|
37
|
-
}, [tematicalFiltersSelected])
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
fontColor && useAmbitStore.setState(() => ({ fontColor: fontColor }))
|
|
40
|
-
}, [fontColor])
|
|
41
|
-
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
inputsColor && useAmbitStore.setState(() => ({ inputsColor: inputsColor }))
|
|
44
|
-
}, [inputsColor])
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<DropdownList
|
|
48
|
-
isOpen={isOpen}
|
|
49
|
-
title={title ? t(title) : "Tematical filters"}
|
|
50
|
-
color={fontColor}
|
|
51
|
-
>
|
|
52
|
-
{indicators?.map((category, key) => {
|
|
53
|
-
return (
|
|
54
|
-
<TematicalFiltersCategory
|
|
55
|
-
category={category}
|
|
56
|
-
key={`category-${key}`}
|
|
57
|
-
fontColor={fontColor}
|
|
58
|
-
// onChangeBothType={onChangeBothType}
|
|
59
|
-
/>
|
|
60
|
-
)
|
|
61
|
-
})}
|
|
62
|
-
</DropdownList>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
TematicalFilters.propTypes = {
|
|
66
|
-
isOpen: PropTypes.bool,
|
|
67
|
-
title: PropTypes.string,
|
|
68
|
-
indicators: PropTypes.arrayOf(
|
|
69
|
-
PropTypes.shape({
|
|
70
|
-
name: PropTypes.string,
|
|
71
|
-
type: PropTypes.string,
|
|
72
|
-
values: PropTypes.arrayOf(
|
|
73
|
-
PropTypes.shape({
|
|
74
|
-
codename: PropTypes.string,
|
|
75
|
-
title: PropTypes.string,
|
|
76
|
-
})
|
|
77
|
-
),
|
|
78
|
-
})
|
|
79
|
-
),
|
|
80
|
-
fontColor: PropTypes.string,
|
|
81
|
-
onChangeTematicalFilters: PropTypes.func,
|
|
82
|
-
inputsColor: PropTypes.string,
|
|
83
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { TematicalFilters } from "./TematicalFilters"
|
|
2
|
-
import indicators from "../../../constants/indicators"
|
|
3
|
-
export default {
|
|
4
|
-
title: "Components/TematicalFilters",
|
|
5
|
-
component: TematicalFilters,
|
|
6
|
-
}
|
|
7
|
-
let open = true
|
|
8
|
-
export const Default = {
|
|
9
|
-
args: {
|
|
10
|
-
indicators: indicators,
|
|
11
|
-
// activeColor: "#f75321",
|
|
12
|
-
activeColor: "#F8A925",
|
|
13
|
-
fontColor: "#605B56",
|
|
14
|
-
isOpen: open,
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { useState } from "react"
|
|
2
|
-
import { DropdownList } from "../../../DropdownList/DropdownList"
|
|
3
|
-
import { TematicalFiltersSubcat } from "../TematicalFiltersSubcat/TematicalFiltersSubcat"
|
|
4
|
-
import { TematicalFiltersInput } from "../TematicalFiltersInput/TematicalFiltersInput"
|
|
5
|
-
import PropTypes from "prop-types"
|
|
6
|
-
import { useAmbitStore } from "../../useAmbitStore"
|
|
7
|
-
|
|
8
|
-
//Needs DropdownList component to be used
|
|
9
|
-
//If category has subcategories, it will render them as dropdowns, else will render the indicators.
|
|
10
|
-
export const TematicalFiltersCategory = ({
|
|
11
|
-
category,
|
|
12
|
-
// onChangeBothType,
|
|
13
|
-
}) => {
|
|
14
|
-
const { name, subcategories, indicators } = category || {}
|
|
15
|
-
const { activeCategory, fontColor } = useAmbitStore((s) => s)
|
|
16
|
-
return (
|
|
17
|
-
category && (
|
|
18
|
-
<DropdownList
|
|
19
|
-
onClick={() => {
|
|
20
|
-
useAmbitStore.setState((s) => ({
|
|
21
|
-
activeCategory: activeCategory === `id${name}` ? "" : `id${name}`,
|
|
22
|
-
}))
|
|
23
|
-
}}
|
|
24
|
-
title={name}
|
|
25
|
-
isOpen={activeCategory === `id${name}`}
|
|
26
|
-
titleFontStyles={{ fontSize: 18, fontWeight: "bold" }}
|
|
27
|
-
showBottomBar={false}
|
|
28
|
-
color={fontColor}
|
|
29
|
-
>
|
|
30
|
-
{subcategories
|
|
31
|
-
? subcategories.map((subcategory, key) => (
|
|
32
|
-
<TematicalFiltersSubcat
|
|
33
|
-
subcategory={subcategory}
|
|
34
|
-
key={`subcategory-${key}`}
|
|
35
|
-
fontColor={fontColor}
|
|
36
|
-
//onChangeBothType={onChangeBothType}
|
|
37
|
-
/>
|
|
38
|
-
))
|
|
39
|
-
: indicators &&
|
|
40
|
-
indicators.map((indicator, key) => (
|
|
41
|
-
<TematicalFiltersInput
|
|
42
|
-
indicator={indicator}
|
|
43
|
-
key={`indicator-${key}`}
|
|
44
|
-
fontColor={fontColor}
|
|
45
|
-
//onChangeBothType={onChangeBothType}
|
|
46
|
-
/>
|
|
47
|
-
))}
|
|
48
|
-
</DropdownList>
|
|
49
|
-
)
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
TematicalFiltersCategory.propTypes = {
|
|
54
|
-
category: PropTypes.shape({
|
|
55
|
-
name: PropTypes.string.isRequired,
|
|
56
|
-
subcategories: PropTypes.array,
|
|
57
|
-
indicators: PropTypes.array,
|
|
58
|
-
}),
|
|
59
|
-
//onChangeBothType: PropTypes.func,
|
|
60
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import ReactSlider from "react-slider"
|
|
2
|
-
import styles from "./AbsoluteSlider.module.scss"
|
|
3
|
-
import { useTranslation } from "react-i18next"
|
|
4
|
-
import PropTypes from "prop-types"
|
|
5
|
-
|
|
6
|
-
export const AbsoluteSlider = ({
|
|
7
|
-
min = 0,
|
|
8
|
-
max = 100,
|
|
9
|
-
step = 1,
|
|
10
|
-
onChange,
|
|
11
|
-
width = 300,
|
|
12
|
-
unit,
|
|
13
|
-
fontColor = "#605B56",
|
|
14
|
-
value = [min, max],
|
|
15
|
-
}) => {
|
|
16
|
-
const { t } = useTranslation()
|
|
17
|
-
const handleChange = (newValues) => {
|
|
18
|
-
onChange?.({ min: newValues[0], max: newValues[1] })
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<div
|
|
23
|
-
className={styles.container}
|
|
24
|
-
style={{ width: `${width}px`, color: `${fontColor}` }}
|
|
25
|
-
>
|
|
26
|
-
<div className={styles.unitLabel}>
|
|
27
|
-
<span>{t(unit)}</span>
|
|
28
|
-
</div>
|
|
29
|
-
<ReactSlider
|
|
30
|
-
className={styles.slider}
|
|
31
|
-
thumbClassName={styles.thumb}
|
|
32
|
-
trackClassName={styles.track}
|
|
33
|
-
min={min}
|
|
34
|
-
max={max}
|
|
35
|
-
step={step}
|
|
36
|
-
value={value}
|
|
37
|
-
onChange={handleChange}
|
|
38
|
-
withTracks={true}
|
|
39
|
-
pearling
|
|
40
|
-
minDistance={1}
|
|
41
|
-
|
|
42
|
-
/>
|
|
43
|
-
<div className={styles.labels}>
|
|
44
|
-
<span>{value[0]}</span>
|
|
45
|
-
<span>{value[1]}</span>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
AbsoluteSlider.propTypes = {
|
|
51
|
-
min: PropTypes.number,
|
|
52
|
-
max: PropTypes.number,
|
|
53
|
-
step: PropTypes.number,
|
|
54
|
-
initialMin: PropTypes.number,
|
|
55
|
-
initialMax: PropTypes.number,
|
|
56
|
-
onChange: PropTypes.func,
|
|
57
|
-
width: PropTypes.number,
|
|
58
|
-
unit: PropTypes.string,
|
|
59
|
-
fontColor: PropTypes.string,
|
|
60
|
-
value: PropTypes.arrayOf(PropTypes.number),
|
|
61
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
padding-top: 15px;
|
|
3
|
-
font-size: 14px;
|
|
4
|
-
span {
|
|
5
|
-
font-size: 14px;
|
|
6
|
-
}
|
|
7
|
-
.unitLabel {
|
|
8
|
-
height: 40px;
|
|
9
|
-
}
|
|
10
|
-
.slider {
|
|
11
|
-
height: 6px;
|
|
12
|
-
background-color: #ddd;
|
|
13
|
-
border-radius: 3px;
|
|
14
|
-
position: relative;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.thumb {
|
|
18
|
-
height: 20px;
|
|
19
|
-
width: 20px;
|
|
20
|
-
background-color: #605b56;
|
|
21
|
-
border-radius: 50%;
|
|
22
|
-
cursor: grab;
|
|
23
|
-
top: -7px;
|
|
24
|
-
position: absolute;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.track {
|
|
28
|
-
top: 0;
|
|
29
|
-
bottom: 0;
|
|
30
|
-
background: #605b56;
|
|
31
|
-
border-radius: 3px;
|
|
32
|
-
|
|
33
|
-
// react-slider asigna automáticamente:
|
|
34
|
-
// - track-0: izquierda del primer thumb
|
|
35
|
-
// - track-1: entre thumbs
|
|
36
|
-
// - track-2: derecha del segundo thumb
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.labels {
|
|
40
|
-
display: flex;
|
|
41
|
-
justify-content: space-between;
|
|
42
|
-
font-size: 14px;
|
|
43
|
-
margin-top: 10px;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.checkboxContainer {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
gap: 0.5rem;
|
|
5
|
-
font-size: 14px;
|
|
6
|
-
font-weight: 400;
|
|
7
|
-
cursor: pointer;
|
|
8
|
-
|
|
9
|
-
input[type="checkbox"] {
|
|
10
|
-
appearance: none; // Oculta el estilo nativo
|
|
11
|
-
-webkit-appearance: none;
|
|
12
|
-
width: 10px;
|
|
13
|
-
height: 10px;
|
|
14
|
-
border-radius: 1px;
|
|
15
|
-
background-color: white;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import PropTypes from "prop-types"
|
|
2
|
-
import style from "./CategoryChackbox.module.scss"
|
|
3
|
-
import { useTranslation } from "react-i18next"
|
|
4
|
-
import { useAmbitStore } from "../../../useAmbitStore"
|
|
5
|
-
export const CategoryCheckbox = ({
|
|
6
|
-
onClick,
|
|
7
|
-
containerStyles,
|
|
8
|
-
color = "#605B56",
|
|
9
|
-
indicator,
|
|
10
|
-
value,
|
|
11
|
-
}) => {
|
|
12
|
-
const { t } = useTranslation()
|
|
13
|
-
const { title } = indicator || {}
|
|
14
|
-
const { fontColor, inputsColor } = useAmbitStore((s) => s)
|
|
15
|
-
return (
|
|
16
|
-
<div
|
|
17
|
-
style={{ ...containerStyles, color: color }}
|
|
18
|
-
role="checkbox"
|
|
19
|
-
className={style.checkboxContainer}
|
|
20
|
-
onClick={onClick}
|
|
21
|
-
>
|
|
22
|
-
<input
|
|
23
|
-
type="checkbox"
|
|
24
|
-
checked={typeof value === "boolean" ? value : true}
|
|
25
|
-
value={value}
|
|
26
|
-
readOnly
|
|
27
|
-
style={{
|
|
28
|
-
border: `1.5px solid ${value ? inputsColor : fontColor}`,
|
|
29
|
-
backgroundColor: value ? inputsColor : "white",
|
|
30
|
-
}}
|
|
31
|
-
/>
|
|
32
|
-
<span className="checkmark">{t(title)}</span>
|
|
33
|
-
</div>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
CategoryCheckbox.propTypes = {
|
|
38
|
-
onClick: PropTypes.func,
|
|
39
|
-
value: PropTypes.bool,
|
|
40
|
-
containerStyles: PropTypes.object,
|
|
41
|
-
color: PropTypes.string,
|
|
42
|
-
indicator: PropTypes.shape({
|
|
43
|
-
title: PropTypes.string,
|
|
44
|
-
codename: PropTypes.array,
|
|
45
|
-
}),
|
|
46
|
-
checkedColor: PropTypes.string,
|
|
47
|
-
}
|