datastake-daf 0.6.173 → 0.6.175
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/index.js +215 -59
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Widget/Widget.stories.js +9 -0
- package/src/@daf/core/components/Dashboard/Widget/_style.scss +6 -0
- package/src/@daf/core/components/Dashboard/Widget/index.jsx +7 -2
- package/src/@daf/core/components/Filters/FloatingFilters/FloatingFilters.stories.jsx +61 -0
- package/src/@daf/core/components/Filters/FloatingFilters/components/Slider/index.jsx +120 -0
- package/src/@daf/core/components/Filters/FloatingFilters/index.js +38 -35
- package/src/@daf/core/components/ProgressBar/MultiColorProgressBar/MultiColorProgressBar.stories.js +16 -0
- package/src/@daf/core/components/ProgressBar/MultiColorProgressBar/index.jsx +53 -0
- package/src/@daf/core/components/UI/SDGIcon/index.jsx +11 -3
- package/src/@daf/core/components/UI/SDGIcon/styles.js +2 -0
- package/src/index.js +4 -1
package/dist/components/index.js
CHANGED
|
@@ -3065,7 +3065,7 @@ const config$3 = {
|
|
|
3065
3065
|
Integration: config$4
|
|
3066
3066
|
};
|
|
3067
3067
|
|
|
3068
|
-
const _excluded$
|
|
3068
|
+
const _excluded$v = ["width", "height", "size", "name", "fill"];
|
|
3069
3069
|
const CustomIcon = _ref => {
|
|
3070
3070
|
let {
|
|
3071
3071
|
width = 14,
|
|
@@ -3074,7 +3074,7 @@ const CustomIcon = _ref => {
|
|
|
3074
3074
|
name = "",
|
|
3075
3075
|
fill = "none"
|
|
3076
3076
|
} = _ref,
|
|
3077
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3077
|
+
props = _objectWithoutProperties(_ref, _excluded$v);
|
|
3078
3078
|
const conf = config$3[name];
|
|
3079
3079
|
if (conf) {
|
|
3080
3080
|
return /*#__PURE__*/jsxRuntime.jsx("svg", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
@@ -9276,7 +9276,7 @@ createCommonjsModule(function (module, exports) {
|
|
|
9276
9276
|
!function(e,n){module.exports=n();}(commonjsGlobal,(function(){return {name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var n=["th","st","nd","rd"],t=e%100;return "["+e+(n[(t-20)%10]||n[t]||n[0])+"]"}}}));
|
|
9277
9277
|
});
|
|
9278
9278
|
|
|
9279
|
-
const _excluded$
|
|
9279
|
+
const _excluded$u = ["view", "module", "scope", "form", "meta"];
|
|
9280
9280
|
dayjs__default["default"].extend(customParseFormat);
|
|
9281
9281
|
dayjs__default["default"].extend(utc);
|
|
9282
9282
|
dayjs__default["default"].extend(utc);
|
|
@@ -9650,7 +9650,7 @@ const filterCreateData = data => {
|
|
|
9650
9650
|
form,
|
|
9651
9651
|
meta
|
|
9652
9652
|
} = data,
|
|
9653
|
-
rest = _objectWithoutProperties(data, _excluded$
|
|
9653
|
+
rest = _objectWithoutProperties(data, _excluded$u);
|
|
9654
9654
|
const _meta = isObjectEmpty(meta) ? undefined : meta;
|
|
9655
9655
|
return _objectSpread2(_objectSpread2({}, rest), {}, {
|
|
9656
9656
|
meta: _meta
|
|
@@ -10029,7 +10029,7 @@ SelectFilters.propTypes = {
|
|
|
10029
10029
|
apiUrl: PropTypes__default["default"].string
|
|
10030
10030
|
};
|
|
10031
10031
|
|
|
10032
|
-
const _excluded$
|
|
10032
|
+
const _excluded$t = ["columns", "data", "defaultFilters", "style", "pagination", "loading", "onChange", "onFilterChange", "selectOptions", "filtersConfig", "rowSelection", "setShowFilters", "rowKey", "showFilters", "hideOnLoading", "sourcesKey", "className", "projects", "t", "selectedProject", "sourceId", "projectSources", "language", "scrollX", "apiUrl", "app", "doEmptyRows"];
|
|
10033
10033
|
function DAFTable(_ref) {
|
|
10034
10034
|
let {
|
|
10035
10035
|
columns = [],
|
|
@@ -10060,7 +10060,7 @@ function DAFTable(_ref) {
|
|
|
10060
10060
|
app,
|
|
10061
10061
|
doEmptyRows
|
|
10062
10062
|
} = _ref,
|
|
10063
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
10063
|
+
rest = _objectWithoutProperties(_ref, _excluded$t);
|
|
10064
10064
|
const [source, setSource] = React.useState([]);
|
|
10065
10065
|
const projectData = (projects || []).find(p => p.id === selectedProject);
|
|
10066
10066
|
const [filtersInit, setFiltersInit] = React.useState(!loading);
|
|
@@ -10782,7 +10782,7 @@ Pagination.propTypes = {
|
|
|
10782
10782
|
isMobile: PropTypes__default["default"].bool
|
|
10783
10783
|
};
|
|
10784
10784
|
|
|
10785
|
-
const _excluded$
|
|
10785
|
+
const _excluded$s = ["size", "maxHeight", "dataSource", "columns", "pagination"];
|
|
10786
10786
|
function StickyTable(_ref) {
|
|
10787
10787
|
let {
|
|
10788
10788
|
size = null,
|
|
@@ -10791,7 +10791,7 @@ function StickyTable(_ref) {
|
|
|
10791
10791
|
columns = {},
|
|
10792
10792
|
pagination = false
|
|
10793
10793
|
} = _ref,
|
|
10794
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
10794
|
+
props = _objectWithoutProperties(_ref, _excluded$s);
|
|
10795
10795
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
10796
10796
|
className: "daf-sticky-table",
|
|
10797
10797
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Table, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
@@ -11256,7 +11256,7 @@ const BTN_SIZE = {
|
|
|
11256
11256
|
LG: 'large'
|
|
11257
11257
|
};
|
|
11258
11258
|
|
|
11259
|
-
const _excluded$
|
|
11259
|
+
const _excluded$r = ["content", "size", "type", "icon", "onClick", "disabled", "loading", "title", "style", "className"];
|
|
11260
11260
|
function DafButton(_ref) {
|
|
11261
11261
|
let {
|
|
11262
11262
|
content = '',
|
|
@@ -11270,7 +11270,7 @@ function DafButton(_ref) {
|
|
|
11270
11270
|
style = {},
|
|
11271
11271
|
className = ''
|
|
11272
11272
|
} = _ref,
|
|
11273
|
-
restProps = _objectWithoutProperties(_ref, _excluded$
|
|
11273
|
+
restProps = _objectWithoutProperties(_ref, _excluded$r);
|
|
11274
11274
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Button, _objectSpread2(_objectSpread2({
|
|
11275
11275
|
icon: icon,
|
|
11276
11276
|
type: type,
|
|
@@ -11504,12 +11504,12 @@ const Style$I = dt.div`
|
|
|
11504
11504
|
}
|
|
11505
11505
|
`;
|
|
11506
11506
|
|
|
11507
|
-
const _excluded$
|
|
11507
|
+
const _excluded$q = ["children"];
|
|
11508
11508
|
const BorderedButton = _ref => {
|
|
11509
11509
|
let {
|
|
11510
11510
|
children
|
|
11511
11511
|
} = _ref,
|
|
11512
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
11512
|
+
props = _objectWithoutProperties(_ref, _excluded$q);
|
|
11513
11513
|
return /*#__PURE__*/jsxRuntime.jsx(Style$I, {
|
|
11514
11514
|
className: "d-btn-cont",
|
|
11515
11515
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
@@ -11649,12 +11649,12 @@ Badge.propTypes = {
|
|
|
11649
11649
|
props: PropTypes__default["default"].object
|
|
11650
11650
|
};
|
|
11651
11651
|
|
|
11652
|
-
const _excluded$
|
|
11652
|
+
const _excluded$p = ["icon"];
|
|
11653
11653
|
function GetIcon(_ref) {
|
|
11654
11654
|
let {
|
|
11655
11655
|
icon
|
|
11656
11656
|
} = _ref,
|
|
11657
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
11657
|
+
props = _objectWithoutProperties(_ref, _excluded$p);
|
|
11658
11658
|
let Icon = Icons__namespace.CloseOutlined;
|
|
11659
11659
|
if (Icons__namespace[icon]) {
|
|
11660
11660
|
Icon = Icons__namespace[icon];
|
|
@@ -11973,7 +11973,7 @@ GoToSelect.propTypes = {
|
|
|
11973
11973
|
t: PropTypes__default["default"].func
|
|
11974
11974
|
};
|
|
11975
11975
|
|
|
11976
|
-
const _excluded$
|
|
11976
|
+
const _excluded$o = ["options", "defaultSelected", "onChange", "textWhenMultiple", "withCount", "oneAlwaysSelected", "canUnselectLast", "isAvatarGroup", "maxAvatarCount", "dropDownWidth", "topAvatarValue", "isSingle", "selectionType"];
|
|
11977
11977
|
const {
|
|
11978
11978
|
useToken: useToken$k
|
|
11979
11979
|
} = antd.theme;
|
|
@@ -12066,7 +12066,7 @@ function Multiselect(_ref) {
|
|
|
12066
12066
|
isSingle = false,
|
|
12067
12067
|
selectionType = SELECTION_TYPES.DEFAULT
|
|
12068
12068
|
} = _ref,
|
|
12069
|
-
restProps = _objectWithoutProperties(_ref, _excluded$
|
|
12069
|
+
restProps = _objectWithoutProperties(_ref, _excluded$o);
|
|
12070
12070
|
const {
|
|
12071
12071
|
token
|
|
12072
12072
|
} = useToken$k();
|
|
@@ -12769,7 +12769,7 @@ DAFHeader.propTypes = {
|
|
|
12769
12769
|
filtersConfig: PropTypes__default["default"].any
|
|
12770
12770
|
};
|
|
12771
12771
|
|
|
12772
|
-
const _excluded$
|
|
12772
|
+
const _excluded$n = ["tabs", "onChange", "value", "className"];
|
|
12773
12773
|
function TabsHeader(_ref) {
|
|
12774
12774
|
let {
|
|
12775
12775
|
tabs = [],
|
|
@@ -12777,7 +12777,7 @@ function TabsHeader(_ref) {
|
|
|
12777
12777
|
value = '',
|
|
12778
12778
|
className = 'mt-2'
|
|
12779
12779
|
} = _ref,
|
|
12780
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
12780
|
+
rest = _objectWithoutProperties(_ref, _excluded$n);
|
|
12781
12781
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
12782
12782
|
className: formatClassname(['daf-tabs-header pl-6 pr-6', className]),
|
|
12783
12783
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Tabs, _objectSpread2({
|
|
@@ -12874,7 +12874,7 @@ DrawerHeader.propTypes = {
|
|
|
12874
12874
|
tabsConfig: PropTypes__default["default"].any
|
|
12875
12875
|
};
|
|
12876
12876
|
|
|
12877
|
-
const _excluded$
|
|
12877
|
+
const _excluded$m = ["label", "onClick", "icon", "type", "tooltip", "disabled", "loading", "style", "className"];
|
|
12878
12878
|
const useFooter = _ref => {
|
|
12879
12879
|
let {
|
|
12880
12880
|
leftContent,
|
|
@@ -12909,7 +12909,7 @@ const useFooter = _ref => {
|
|
|
12909
12909
|
style = {},
|
|
12910
12910
|
className = ""
|
|
12911
12911
|
} = button,
|
|
12912
|
-
restProps = _objectWithoutProperties(button, _excluded$
|
|
12912
|
+
restProps = _objectWithoutProperties(button, _excluded$m);
|
|
12913
12913
|
return /*#__PURE__*/jsxRuntime.jsx(DafButton, _objectSpread2({
|
|
12914
12914
|
content: label,
|
|
12915
12915
|
type: type,
|
|
@@ -15239,7 +15239,8 @@ function Widget(_ref) {
|
|
|
15239
15239
|
defaultExpanded,
|
|
15240
15240
|
isCollapsable = false,
|
|
15241
15241
|
defaultCollapsed = false,
|
|
15242
|
-
onExpandChange
|
|
15242
|
+
onExpandChange,
|
|
15243
|
+
description
|
|
15243
15244
|
} = _ref;
|
|
15244
15245
|
const [showFilters, setShowFilters] = React.useState(false);
|
|
15245
15246
|
const [isCollapsed, setIsCollapsed] = React.useState(defaultCollapsed);
|
|
@@ -15277,11 +15278,16 @@ function Widget(_ref) {
|
|
|
15277
15278
|
className: "widget-header flex-column",
|
|
15278
15279
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
15279
15280
|
className: "flex flex-row widget-header-items",
|
|
15280
|
-
children: [/*#__PURE__*/jsxRuntime.
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
children:
|
|
15284
|
-
|
|
15281
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
15282
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
15283
|
+
className: "title cont",
|
|
15284
|
+
children: /*#__PURE__*/jsxRuntime.jsx("h1", {
|
|
15285
|
+
children: title
|
|
15286
|
+
})
|
|
15287
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
15288
|
+
className: "description",
|
|
15289
|
+
children: description
|
|
15290
|
+
})]
|
|
15285
15291
|
}), tooltip && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
15286
15292
|
className: "cont icon-cont",
|
|
15287
15293
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
@@ -15396,10 +15402,11 @@ Widget.propTypes = {
|
|
|
15396
15402
|
addedHeaderFirst: PropTypes__default["default"].bool,
|
|
15397
15403
|
isCollapsable: PropTypes__default["default"].bool,
|
|
15398
15404
|
defaultCollapsed: PropTypes__default["default"].bool,
|
|
15399
|
-
onExpandChange: PropTypes__default["default"].func
|
|
15405
|
+
onExpandChange: PropTypes__default["default"].func,
|
|
15406
|
+
description: PropTypes__default["default"].string
|
|
15400
15407
|
};
|
|
15401
15408
|
|
|
15402
|
-
const _excluded$
|
|
15409
|
+
const _excluded$l = ["loading", "title", "image", "description", "imgAlt", "noDescriptionText"];
|
|
15403
15410
|
function ImageWidget(_ref) {
|
|
15404
15411
|
let {
|
|
15405
15412
|
loading = false,
|
|
@@ -15409,7 +15416,7 @@ function ImageWidget(_ref) {
|
|
|
15409
15416
|
imgAlt,
|
|
15410
15417
|
noDescriptionText
|
|
15411
15418
|
} = _ref,
|
|
15412
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
15419
|
+
props = _objectWithoutProperties(_ref, _excluded$l);
|
|
15413
15420
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
|
|
15414
15421
|
loading: loading,
|
|
15415
15422
|
title: title,
|
|
@@ -15466,7 +15473,7 @@ function ImageWidget(_ref) {
|
|
|
15466
15473
|
}
|
|
15467
15474
|
|
|
15468
15475
|
var _templateObject$a;
|
|
15469
|
-
const _excluded$
|
|
15476
|
+
const _excluded$k = ["title", "loading", "data", "current", "defaultActiveTab", "widgetClassname", "className", "direction"];
|
|
15470
15477
|
function FlowWidget(_ref) {
|
|
15471
15478
|
let {
|
|
15472
15479
|
title,
|
|
@@ -15478,7 +15485,7 @@ function FlowWidget(_ref) {
|
|
|
15478
15485
|
className,
|
|
15479
15486
|
direction = "horizontal"
|
|
15480
15487
|
} = _ref,
|
|
15481
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
15488
|
+
rest = _objectWithoutProperties(_ref, _excluded$k);
|
|
15482
15489
|
const [activeTab, setActiveTab] = React.useState();
|
|
15483
15490
|
React.useEffect(() => {
|
|
15484
15491
|
if (defaultActiveTab) {
|
|
@@ -18252,6 +18259,112 @@ const Style$B = dt.div`
|
|
|
18252
18259
|
}
|
|
18253
18260
|
`;
|
|
18254
18261
|
|
|
18262
|
+
const {
|
|
18263
|
+
Option
|
|
18264
|
+
} = antd.Select;
|
|
18265
|
+
const DEFAULT_STEP = 20;
|
|
18266
|
+
const DEFAULT_MIN = 0;
|
|
18267
|
+
const DEFAULT_MAX = 100;
|
|
18268
|
+
const STEP_SISTERS = ["#F04438", "#FF7A45", "#FFA940", "#95DE64", "#12B76A"]; // NOT REAL STEP SISTERS, JUST COLORS. 😂
|
|
18269
|
+
|
|
18270
|
+
function SliderItem({
|
|
18271
|
+
filter,
|
|
18272
|
+
onFilterChange
|
|
18273
|
+
}) {
|
|
18274
|
+
const [range, setRange] = React.useState([DEFAULT_MIN, DEFAULT_MAX]);
|
|
18275
|
+
const min = filter?.min ?? DEFAULT_MIN;
|
|
18276
|
+
const max = filter?.max ?? DEFAULT_MAX;
|
|
18277
|
+
const step = filter?.step ?? DEFAULT_STEP;
|
|
18278
|
+
const marks = React.useMemo(() => {
|
|
18279
|
+
const marksObj = {};
|
|
18280
|
+
for (let i = min; i <= max; i += step) {
|
|
18281
|
+
marksObj[i] = `${i}%`;
|
|
18282
|
+
}
|
|
18283
|
+
return marksObj;
|
|
18284
|
+
}, [min, max, step]);
|
|
18285
|
+
const getColorForValue = (start, end) => {
|
|
18286
|
+
const s = Number(start);
|
|
18287
|
+
const e = Number(end);
|
|
18288
|
+
if (Number.isNaN(s) || Number.isNaN(e)) return "transparent";
|
|
18289
|
+
const valueToStartIndex = v => {
|
|
18290
|
+
let idx = Math.floor((v - min) / step);
|
|
18291
|
+
if (idx < 0) idx = 0;
|
|
18292
|
+
if (idx >= STEP_SISTERS.length) idx = STEP_SISTERS.length - 1;
|
|
18293
|
+
return idx;
|
|
18294
|
+
};
|
|
18295
|
+
const valueToEndIndex = v => {
|
|
18296
|
+
let idx = Math.ceil((v - min) / step) - 1;
|
|
18297
|
+
if (idx < 0) idx = 0;
|
|
18298
|
+
if (idx >= STEP_SISTERS.length) idx = STEP_SISTERS.length - 1;
|
|
18299
|
+
return idx;
|
|
18300
|
+
};
|
|
18301
|
+
let startIndex = valueToStartIndex(Math.min(s, e));
|
|
18302
|
+
let endIndex = valueToEndIndex(Math.max(s, e));
|
|
18303
|
+
if (endIndex < startIndex) endIndex = startIndex;
|
|
18304
|
+
const colorsInRange = STEP_SISTERS.slice(startIndex, endIndex + 1);
|
|
18305
|
+
if (colorsInRange.length === 0) return "transparent";
|
|
18306
|
+
if (colorsInRange.length === 1) return colorsInRange[0];
|
|
18307
|
+
const sliceSize = 100 / colorsInRange.length;
|
|
18308
|
+
const gradientStops = colorsInRange.map((color, i) => {
|
|
18309
|
+
const startPct = +(i * sliceSize).toFixed(4);
|
|
18310
|
+
const endPct = +((i + 1) * sliceSize).toFixed(4);
|
|
18311
|
+
return `${color} ${startPct}% ${endPct}%`;
|
|
18312
|
+
}).join(", ");
|
|
18313
|
+
return `linear-gradient(to right, ${gradientStops})`;
|
|
18314
|
+
};
|
|
18315
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
18316
|
+
className: "form-row",
|
|
18317
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("label", {
|
|
18318
|
+
children: filter?.label
|
|
18319
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
18320
|
+
value: `${range[0]} - ${range[1]}`,
|
|
18321
|
+
dropdownRender: () => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
18322
|
+
style: {
|
|
18323
|
+
padding: "10px"
|
|
18324
|
+
},
|
|
18325
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.ConfigProvider, {
|
|
18326
|
+
theme: {
|
|
18327
|
+
components: {
|
|
18328
|
+
Slider: {
|
|
18329
|
+
dotSize: 13
|
|
18330
|
+
}
|
|
18331
|
+
}
|
|
18332
|
+
},
|
|
18333
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.Slider, {
|
|
18334
|
+
range: true,
|
|
18335
|
+
min: min,
|
|
18336
|
+
max: max,
|
|
18337
|
+
value: range,
|
|
18338
|
+
step: null,
|
|
18339
|
+
onChange: val => {
|
|
18340
|
+
setRange(val);
|
|
18341
|
+
onFilterChange({
|
|
18342
|
+
[filter?.key]: val
|
|
18343
|
+
});
|
|
18344
|
+
},
|
|
18345
|
+
tooltip: {
|
|
18346
|
+
open: false
|
|
18347
|
+
},
|
|
18348
|
+
marks: marks,
|
|
18349
|
+
styles: {
|
|
18350
|
+
track: {
|
|
18351
|
+
background: "transparent"
|
|
18352
|
+
},
|
|
18353
|
+
tracks: {
|
|
18354
|
+
background: getColorForValue(range[0], range[1])
|
|
18355
|
+
}
|
|
18356
|
+
}
|
|
18357
|
+
})
|
|
18358
|
+
})
|
|
18359
|
+
}),
|
|
18360
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(Option, {
|
|
18361
|
+
value: `${range[0]}-${range[1]}`,
|
|
18362
|
+
children: [range[0], " - ", range[1]]
|
|
18363
|
+
}, `${range[0]}-${range[1]}`)
|
|
18364
|
+
})]
|
|
18365
|
+
});
|
|
18366
|
+
}
|
|
18367
|
+
|
|
18255
18368
|
function Filters({
|
|
18256
18369
|
t,
|
|
18257
18370
|
filtersConfig,
|
|
@@ -18275,6 +18388,11 @@ function Filters({
|
|
|
18275
18388
|
})
|
|
18276
18389
|
})]
|
|
18277
18390
|
});
|
|
18391
|
+
case "slider":
|
|
18392
|
+
return /*#__PURE__*/jsxRuntime.jsx(SliderItem, {
|
|
18393
|
+
filter: filter,
|
|
18394
|
+
onFilterChange: onFilterChange
|
|
18395
|
+
});
|
|
18278
18396
|
default:
|
|
18279
18397
|
return null;
|
|
18280
18398
|
}
|
|
@@ -20159,14 +20277,14 @@ const MapConfig = ({
|
|
|
20159
20277
|
});
|
|
20160
20278
|
};
|
|
20161
20279
|
|
|
20162
|
-
const _excluded$
|
|
20280
|
+
const _excluded$j = ["config", "title", "loading"];
|
|
20163
20281
|
const Details = _ref => {
|
|
20164
20282
|
let {
|
|
20165
20283
|
config = [],
|
|
20166
20284
|
title,
|
|
20167
20285
|
loading = false
|
|
20168
20286
|
} = _ref,
|
|
20169
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
20287
|
+
rest = _objectWithoutProperties(_ref, _excluded$j);
|
|
20170
20288
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
|
|
20171
20289
|
className: "with-border-header h-w-btn-header card",
|
|
20172
20290
|
loading: loading,
|
|
@@ -20182,14 +20300,14 @@ const Details = _ref => {
|
|
|
20182
20300
|
}));
|
|
20183
20301
|
};
|
|
20184
20302
|
|
|
20185
|
-
const _excluded$
|
|
20303
|
+
const _excluded$i = ["config", "title", "loading"];
|
|
20186
20304
|
const KeyIndicatorsDetails = _ref => {
|
|
20187
20305
|
let {
|
|
20188
20306
|
config,
|
|
20189
20307
|
title,
|
|
20190
20308
|
loading = false
|
|
20191
20309
|
} = _ref,
|
|
20192
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
20310
|
+
rest = _objectWithoutProperties(_ref, _excluded$i);
|
|
20193
20311
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
|
|
20194
20312
|
className: "with-border-header h-w-btn-header",
|
|
20195
20313
|
title: title,
|
|
@@ -20219,7 +20337,7 @@ const Style$y = dt.div`
|
|
|
20219
20337
|
}
|
|
20220
20338
|
`;
|
|
20221
20339
|
|
|
20222
|
-
const _excluded$
|
|
20340
|
+
const _excluded$h = ["children", "config", "detailsTitle", "firstColumnWidth"];
|
|
20223
20341
|
const DetailsSection = _ref => {
|
|
20224
20342
|
let {
|
|
20225
20343
|
children,
|
|
@@ -20227,7 +20345,7 @@ const DetailsSection = _ref => {
|
|
|
20227
20345
|
detailsTitle,
|
|
20228
20346
|
firstColumnWidth = "250px"
|
|
20229
20347
|
} = _ref,
|
|
20230
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
20348
|
+
rest = _objectWithoutProperties(_ref, _excluded$h);
|
|
20231
20349
|
return /*#__PURE__*/jsxRuntime.jsx(Style$y, {
|
|
20232
20350
|
firstColumnWidth: firstColumnWidth,
|
|
20233
20351
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -20403,14 +20521,14 @@ const getGoalConfig = () => {
|
|
|
20403
20521
|
};
|
|
20404
20522
|
|
|
20405
20523
|
var _templateObject$8;
|
|
20406
|
-
const _excluded$
|
|
20524
|
+
const _excluded$g = ["title", "activeSdgGoals", "t"];
|
|
20407
20525
|
function SDGWidget(_ref) {
|
|
20408
20526
|
let {
|
|
20409
20527
|
title = "Sustainable Development Goals",
|
|
20410
20528
|
activeSdgGoals = [],
|
|
20411
20529
|
t = key => key
|
|
20412
20530
|
} = _ref,
|
|
20413
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
20531
|
+
props = _objectWithoutProperties(_ref, _excluded$g);
|
|
20414
20532
|
const sdgConfig = getGoalConfig();
|
|
20415
20533
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
|
|
20416
20534
|
title: title,
|
|
@@ -20506,15 +20624,18 @@ const SDGList = dt.ul`
|
|
|
20506
20624
|
justify-content: center;
|
|
20507
20625
|
background: var(--base-gray-30);
|
|
20508
20626
|
color: var(--base-gray-90);
|
|
20627
|
+
border-radius: 8px;
|
|
20628
|
+
border: 1px solid var(--base-gray-30);
|
|
20509
20629
|
}
|
|
20510
20630
|
`;
|
|
20511
20631
|
|
|
20512
20632
|
const GAP_BETWEEN_SDGS = 4;
|
|
20513
|
-
function SDGIcons({
|
|
20514
|
-
|
|
20515
|
-
|
|
20516
|
-
|
|
20517
|
-
|
|
20633
|
+
function SDGIcons(_ref) {
|
|
20634
|
+
let {
|
|
20635
|
+
sdgList = [],
|
|
20636
|
+
t = str => str,
|
|
20637
|
+
iconSize = 24
|
|
20638
|
+
} = _ref;
|
|
20518
20639
|
const containerRef = React__default["default"].useRef(null);
|
|
20519
20640
|
const [width, setWidth] = React__default["default"].useState(0);
|
|
20520
20641
|
React__default["default"].useEffect(() => {
|
|
@@ -20555,10 +20676,10 @@ function SDGIcons({
|
|
|
20555
20676
|
children: [visibleSdgs.map((sdg, index) => /*#__PURE__*/jsxRuntime.jsx("li", {
|
|
20556
20677
|
className: "project-widget-item",
|
|
20557
20678
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
20558
|
-
title: t(
|
|
20679
|
+
title: t("SDGS::".concat(sdg)),
|
|
20559
20680
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20560
20681
|
style: {
|
|
20561
|
-
backgroundImage:
|
|
20682
|
+
backgroundImage: "url(".concat(SDG_IMAGES[sdg].img, ")"),
|
|
20562
20683
|
height: iconSize,
|
|
20563
20684
|
width: iconSize
|
|
20564
20685
|
},
|
|
@@ -20577,21 +20698,25 @@ function SDGIcons({
|
|
|
20577
20698
|
maxWidth: 200
|
|
20578
20699
|
},
|
|
20579
20700
|
children: sdgList.slice(visibleSdgs.length).map((sdg, idx) => /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
20580
|
-
title: t(
|
|
20701
|
+
title: t("SDGS::".concat(sdg)),
|
|
20581
20702
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20582
20703
|
style: {
|
|
20583
20704
|
width: iconSize,
|
|
20584
20705
|
height: iconSize,
|
|
20585
|
-
backgroundImage:
|
|
20706
|
+
backgroundImage: "url(".concat(SDG_IMAGES[sdg].img, ")"),
|
|
20586
20707
|
backgroundSize: "cover",
|
|
20587
20708
|
borderRadius: 4
|
|
20588
20709
|
},
|
|
20589
|
-
title: t(
|
|
20710
|
+
title: t("SDGS::".concat(sdg))
|
|
20590
20711
|
})
|
|
20591
20712
|
}, idx))
|
|
20592
20713
|
}),
|
|
20593
20714
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
20594
20715
|
className: "sdg-item-image sdg-item-more",
|
|
20716
|
+
style: {
|
|
20717
|
+
height: iconSize,
|
|
20718
|
+
width: iconSize
|
|
20719
|
+
},
|
|
20595
20720
|
children: ["+", hiddenCount]
|
|
20596
20721
|
})
|
|
20597
20722
|
})
|
|
@@ -20614,7 +20739,7 @@ function SdgList({
|
|
|
20614
20739
|
});
|
|
20615
20740
|
}
|
|
20616
20741
|
|
|
20617
|
-
const _excluded$
|
|
20742
|
+
const _excluded$f = ["title", "description", "onLinkClick", "image", "linkIcon", "sdgList", "items", "onCardClick", "hideSDGList", "t"];
|
|
20618
20743
|
const {
|
|
20619
20744
|
Meta
|
|
20620
20745
|
} = antd.Card;
|
|
@@ -20634,7 +20759,7 @@ function ProjectWidget(_ref) {
|
|
|
20634
20759
|
hideSDGList = false,
|
|
20635
20760
|
t = x => x
|
|
20636
20761
|
} = _ref,
|
|
20637
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
20762
|
+
props = _objectWithoutProperties(_ref, _excluded$f);
|
|
20638
20763
|
const [isHovered, setIsHovered] = React__default["default"].useState(false);
|
|
20639
20764
|
const {
|
|
20640
20765
|
token
|
|
@@ -20797,13 +20922,13 @@ const WidgetCard = _ref => {
|
|
|
20797
20922
|
});
|
|
20798
20923
|
};
|
|
20799
20924
|
|
|
20800
|
-
const _excluded$
|
|
20925
|
+
const _excluded$e = ["title", "children"];
|
|
20801
20926
|
function CarouselWidget(_ref) {
|
|
20802
20927
|
let {
|
|
20803
20928
|
title,
|
|
20804
20929
|
children
|
|
20805
20930
|
} = _ref,
|
|
20806
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
20931
|
+
rest = _objectWithoutProperties(_ref, _excluded$e);
|
|
20807
20932
|
/**
|
|
20808
20933
|
* Handles carousel slide change events
|
|
20809
20934
|
* @param {number} currentSlide - The index of the current slide after change
|
|
@@ -20823,7 +20948,7 @@ function CarouselWidget(_ref) {
|
|
|
20823
20948
|
});
|
|
20824
20949
|
}
|
|
20825
20950
|
|
|
20826
|
-
const _excluded$
|
|
20951
|
+
const _excluded$d = ["title", "images", "height", "fallback"];
|
|
20827
20952
|
function ImageCarousel(_ref) {
|
|
20828
20953
|
let {
|
|
20829
20954
|
title,
|
|
@@ -20831,7 +20956,7 @@ function ImageCarousel(_ref) {
|
|
|
20831
20956
|
height = 400,
|
|
20832
20957
|
fallback = "/assets/images/empty-box.svg"
|
|
20833
20958
|
} = _ref,
|
|
20834
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
20959
|
+
rest = _objectWithoutProperties(_ref, _excluded$d);
|
|
20835
20960
|
const [previewVisible, setPreviewVisible] = React.useState(false);
|
|
20836
20961
|
const [current, setCurrent] = React.useState(0);
|
|
20837
20962
|
const carouselRef = React.useRef(null);
|
|
@@ -26012,7 +26137,7 @@ const RepeatableModals = ({
|
|
|
26012
26137
|
}) : null;
|
|
26013
26138
|
};
|
|
26014
26139
|
|
|
26015
|
-
const _excluded$
|
|
26140
|
+
const _excluded$c = ["viewGroup"],
|
|
26016
26141
|
_excluded2 = ["label", "icon", "position"];
|
|
26017
26142
|
const Content = _ref => {
|
|
26018
26143
|
let {
|
|
@@ -26080,7 +26205,7 @@ const Content = _ref => {
|
|
|
26080
26205
|
if (groups[gKey].viewGroup === key) {
|
|
26081
26206
|
// eslint-disable-next-line no-unused-vars
|
|
26082
26207
|
const _groups$gKey = groups[gKey],
|
|
26083
|
-
gCfg = _objectWithoutProperties(_groups$gKey, _excluded$
|
|
26208
|
+
gCfg = _objectWithoutProperties(_groups$gKey, _excluded$c);
|
|
26084
26209
|
items[gKey] = gCfg;
|
|
26085
26210
|
}
|
|
26086
26211
|
return items;
|
|
@@ -42188,7 +42313,7 @@ const getGrouContent = (form, values, i, formId, excludedKeys, getData, setValue
|
|
|
42188
42313
|
});
|
|
42189
42314
|
};
|
|
42190
42315
|
|
|
42191
|
-
const _excluded$
|
|
42316
|
+
const _excluded$b = ["icon"];
|
|
42192
42317
|
function DynamicForm(_ref) {
|
|
42193
42318
|
var _data$meta;
|
|
42194
42319
|
let {
|
|
@@ -42743,7 +42868,7 @@ function DynamicForm(_ref) {
|
|
|
42743
42868
|
let {
|
|
42744
42869
|
icon: Icon
|
|
42745
42870
|
} = _ref3,
|
|
42746
|
-
form = _objectWithoutProperties(_ref3, _excluded$
|
|
42871
|
+
form = _objectWithoutProperties(_ref3, _excluded$b);
|
|
42747
42872
|
return /*#__PURE__*/jsxRuntime.jsxs(antd.Button, {
|
|
42748
42873
|
type: "link",
|
|
42749
42874
|
size: "large",
|
|
@@ -43019,6 +43144,35 @@ function MultiBarProgress(_ref) {
|
|
|
43019
43144
|
}
|
|
43020
43145
|
const Style$r = dt.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n\theight: 6px;\n\twidth: 100%;\n\tbackground: var(--base-gray-40);\n\tborder-radius: 8px;\n\tdisplay: flex;\n\toverflow: hidden;\n\tdiv {\n\t\theight: 100%;\n\t}\n"])));
|
|
43021
43146
|
|
|
43147
|
+
const _excluded$a = ["tooltipTitle", "percentage", "strokeColor", "showInfo"];
|
|
43148
|
+
function MultiColorProgressBar(_ref) {
|
|
43149
|
+
let {
|
|
43150
|
+
tooltipTitle,
|
|
43151
|
+
percentage,
|
|
43152
|
+
strokeColor = {
|
|
43153
|
+
'0%': '#32D583',
|
|
43154
|
+
'50%': '#FEC84B',
|
|
43155
|
+
'100%': '#F97066'
|
|
43156
|
+
},
|
|
43157
|
+
showInfo = false
|
|
43158
|
+
} = _ref,
|
|
43159
|
+
rest = _objectWithoutProperties(_ref, _excluded$a);
|
|
43160
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
43161
|
+
title: tooltipTitle,
|
|
43162
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.Progress, _objectSpread2({
|
|
43163
|
+
percent: percentage,
|
|
43164
|
+
strokeColor: strokeColor,
|
|
43165
|
+
showInfo: showInfo
|
|
43166
|
+
}, rest))
|
|
43167
|
+
});
|
|
43168
|
+
}
|
|
43169
|
+
MultiColorProgressBar.propTypes = {
|
|
43170
|
+
tooltipTitle: PropTypes__default["default"].string,
|
|
43171
|
+
percentage: PropTypes__default["default"].number,
|
|
43172
|
+
strokeColor: PropTypes__default["default"].object,
|
|
43173
|
+
showInfo: PropTypes__default["default"].bool
|
|
43174
|
+
};
|
|
43175
|
+
|
|
43022
43176
|
var _templateObject$4;
|
|
43023
43177
|
const Style$q = dt.div(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n .icon-background {\n width: ", "px;\n height: ", "px;\n background-color: #69d99e;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n"])), _ref => {
|
|
43024
43178
|
let {
|
|
@@ -60236,6 +60390,7 @@ exports.MoreMenu = MoreMenu;
|
|
|
60236
60390
|
exports.MoreOptions = MoreOptions;
|
|
60237
60391
|
exports.MoreTags = MoreTags;
|
|
60238
60392
|
exports.MultiBarProgress = MultiBarProgress;
|
|
60393
|
+
exports.MultiColorProgressBar = MultiColorProgressBar;
|
|
60239
60394
|
exports.Multiselect = Multiselect;
|
|
60240
60395
|
exports.NotFound = NotFound;
|
|
60241
60396
|
exports.Pagination = Pagination;
|
|
@@ -60254,6 +60409,7 @@ exports.ProjectVisualisationSelect = CustomSelect;
|
|
|
60254
60409
|
exports.ProjectWidget = ProjectWidget;
|
|
60255
60410
|
exports.RadarChart = RadarChart;
|
|
60256
60411
|
exports.RadialBarChart = RadialBarChart;
|
|
60412
|
+
exports.SDGIcons = SDGIcons;
|
|
60257
60413
|
exports.SDGWidget = SDGWidget;
|
|
60258
60414
|
exports.SearchFilters = SearchFilters;
|
|
60259
60415
|
exports.Segment = Segment;
|
package/package.json
CHANGED
|
@@ -55,3 +55,12 @@ export const Primary = {
|
|
|
55
55
|
// },
|
|
56
56
|
},
|
|
57
57
|
};
|
|
58
|
+
|
|
59
|
+
export const WithDescription = {
|
|
60
|
+
name: "Widget with Description",
|
|
61
|
+
args: {
|
|
62
|
+
className: "with-border-header",
|
|
63
|
+
title: "Widget Title",
|
|
64
|
+
description: "This is a description of the widget.",
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -35,6 +35,7 @@ export default function Widget({
|
|
|
35
35
|
isCollapsable = false,
|
|
36
36
|
defaultCollapsed = false,
|
|
37
37
|
onExpandChange,
|
|
38
|
+
description,
|
|
38
39
|
}) {
|
|
39
40
|
const [showFilters, setShowFilters] = useState(false);
|
|
40
41
|
const [isCollapsed, setIsCollapsed] = useState(defaultCollapsed);
|
|
@@ -77,8 +78,11 @@ export default function Widget({
|
|
|
77
78
|
{!noTitle && (
|
|
78
79
|
<div className="widget-header flex-column">
|
|
79
80
|
<div className="flex flex-row widget-header-items">
|
|
80
|
-
<div
|
|
81
|
-
<
|
|
81
|
+
<div>
|
|
82
|
+
<div className="title cont">
|
|
83
|
+
<h1>{title}</h1>
|
|
84
|
+
</div>
|
|
85
|
+
<p className="description">{description}</p>
|
|
82
86
|
</div>
|
|
83
87
|
|
|
84
88
|
{tooltip && (
|
|
@@ -213,4 +217,5 @@ Widget.propTypes = {
|
|
|
213
217
|
isCollapsable: PropTypes.bool,
|
|
214
218
|
defaultCollapsed: PropTypes.bool,
|
|
215
219
|
onExpandChange: PropTypes.func,
|
|
220
|
+
description: PropTypes.string,
|
|
216
221
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import SearchFilters from "./index";
|
|
2
|
+
import ThemeLayout from "../../ThemeLayout";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Core/Filters/FloatingFilters",
|
|
6
|
+
component: SearchFilters,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
decorators: [
|
|
9
|
+
(Story) => (
|
|
10
|
+
<ThemeLayout>
|
|
11
|
+
<Story />
|
|
12
|
+
</ThemeLayout>
|
|
13
|
+
),
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Primary = {
|
|
18
|
+
name: "Search Filters",
|
|
19
|
+
args: {
|
|
20
|
+
t: (key) => key,
|
|
21
|
+
filtersConfig: [
|
|
22
|
+
{
|
|
23
|
+
type: "select",
|
|
24
|
+
label: "Category",
|
|
25
|
+
placeholder: "Select a category",
|
|
26
|
+
key: "category",
|
|
27
|
+
options: [
|
|
28
|
+
{ label: "Books", value: "books" },
|
|
29
|
+
{ label: "Electronics", value: "electronics" },
|
|
30
|
+
{ label: "Clothing", value: "clothing" },
|
|
31
|
+
],
|
|
32
|
+
value: null,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: "select",
|
|
36
|
+
label: "Price Range",
|
|
37
|
+
placeholder: "Select a price range",
|
|
38
|
+
key: "priceRange",
|
|
39
|
+
options: [
|
|
40
|
+
{ label: "$0 - $50", value: "0-50" },
|
|
41
|
+
{ label: "$51 - $100", value: "51-100" },
|
|
42
|
+
{ label: "$101 - $200", value: "101-200" },
|
|
43
|
+
],
|
|
44
|
+
value: null,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: "slider",
|
|
48
|
+
label: "Rating",
|
|
49
|
+
key: "rating",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
onFilterChange: (changedFilter) => {
|
|
53
|
+
console.log("Filter changed:", changedFilter);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
render: (args) => (
|
|
57
|
+
<div style={{ position: "relative", height: "400px" }}>
|
|
58
|
+
<SearchFilters {...args} />
|
|
59
|
+
</div>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Select, Slider, ConfigProvider } from "antd";
|
|
2
|
+
import { useState, useMemo } from "react";
|
|
3
|
+
|
|
4
|
+
const { Option } = Select;
|
|
5
|
+
|
|
6
|
+
const DEFAULT_STEP = 20;
|
|
7
|
+
const DEFAULT_MIN = 0;
|
|
8
|
+
const DEFAULT_MAX = 100;
|
|
9
|
+
|
|
10
|
+
const STEP_SISTERS = ["#F04438", "#FF7A45", "#FFA940", "#95DE64", "#12B76A"]; // NOT REAL STEP SISTERS, JUST COLORS. 😂
|
|
11
|
+
|
|
12
|
+
export default function SliderItem({ filter, onFilterChange }) {
|
|
13
|
+
const [range, setRange] = useState([DEFAULT_MIN, DEFAULT_MAX]);
|
|
14
|
+
|
|
15
|
+
const min = filter?.min ?? DEFAULT_MIN;
|
|
16
|
+
const max = filter?.max ?? DEFAULT_MAX;
|
|
17
|
+
const step = filter?.step ?? DEFAULT_STEP;
|
|
18
|
+
|
|
19
|
+
const marks = useMemo(() => {
|
|
20
|
+
const marksObj = {};
|
|
21
|
+
for (let i = min; i <= max; i += step) {
|
|
22
|
+
marksObj[i] = `${i}%`;
|
|
23
|
+
}
|
|
24
|
+
return marksObj;
|
|
25
|
+
}, [min, max, step]);
|
|
26
|
+
|
|
27
|
+
const getColorForValue = (start, end) => {
|
|
28
|
+
const s = Number(start);
|
|
29
|
+
const e = Number(end);
|
|
30
|
+
if (Number.isNaN(s) || Number.isNaN(e)) return "transparent";
|
|
31
|
+
|
|
32
|
+
const valueToStartIndex = (v) => {
|
|
33
|
+
let idx = Math.floor((v - min) / step);
|
|
34
|
+
if (idx < 0) idx = 0;
|
|
35
|
+
if (idx >= STEP_SISTERS.length) idx = STEP_SISTERS.length - 1;
|
|
36
|
+
return idx;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const valueToEndIndex = (v) => {
|
|
40
|
+
let idx = Math.ceil((v - min) / step) - 1;
|
|
41
|
+
if (idx < 0) idx = 0;
|
|
42
|
+
if (idx >= STEP_SISTERS.length) idx = STEP_SISTERS.length - 1;
|
|
43
|
+
return idx;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
let startIndex = valueToStartIndex(Math.min(s, e));
|
|
47
|
+
let endIndex = valueToEndIndex(Math.max(s, e));
|
|
48
|
+
|
|
49
|
+
if (endIndex < startIndex) endIndex = startIndex;
|
|
50
|
+
|
|
51
|
+
const colorsInRange = STEP_SISTERS.slice(startIndex, endIndex + 1);
|
|
52
|
+
|
|
53
|
+
if (colorsInRange.length === 0) return "transparent";
|
|
54
|
+
if (colorsInRange.length === 1) return colorsInRange[0];
|
|
55
|
+
|
|
56
|
+
const sliceSize = 100 / colorsInRange.length;
|
|
57
|
+
const gradientStops = colorsInRange
|
|
58
|
+
.map((color, i) => {
|
|
59
|
+
const startPct = +(i * sliceSize).toFixed(4);
|
|
60
|
+
const endPct = +((i + 1) * sliceSize).toFixed(4);
|
|
61
|
+
return `${color} ${startPct}% ${endPct}%`;
|
|
62
|
+
})
|
|
63
|
+
.join(", ");
|
|
64
|
+
|
|
65
|
+
return `linear-gradient(to right, ${gradientStops})`;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div className="form-row">
|
|
70
|
+
<label>{filter?.label}</label>
|
|
71
|
+
<Select
|
|
72
|
+
value={`${range[0]} - ${range[1]}`}
|
|
73
|
+
dropdownRender={() => (
|
|
74
|
+
<div style={{ padding: "10px" }}>
|
|
75
|
+
<ConfigProvider
|
|
76
|
+
theme={{
|
|
77
|
+
components: {
|
|
78
|
+
Slider: {
|
|
79
|
+
dotSize: 13,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<Slider
|
|
85
|
+
range
|
|
86
|
+
min={min}
|
|
87
|
+
max={max}
|
|
88
|
+
value={range}
|
|
89
|
+
step={null}
|
|
90
|
+
onChange={(val) => {
|
|
91
|
+
setRange(val);
|
|
92
|
+
onFilterChange({ [filter?.key]: val });
|
|
93
|
+
}}
|
|
94
|
+
tooltip={{
|
|
95
|
+
open: false,
|
|
96
|
+
}}
|
|
97
|
+
marks={marks}
|
|
98
|
+
styles={{
|
|
99
|
+
track: {
|
|
100
|
+
background: "transparent",
|
|
101
|
+
},
|
|
102
|
+
tracks: {
|
|
103
|
+
background: getColorForValue(range[0], range[1]),
|
|
104
|
+
},
|
|
105
|
+
}}
|
|
106
|
+
/>
|
|
107
|
+
</ConfigProvider>
|
|
108
|
+
</div>
|
|
109
|
+
)}
|
|
110
|
+
>
|
|
111
|
+
<Option
|
|
112
|
+
value={`${range[0]}-${range[1]}`}
|
|
113
|
+
key={`${range[0]}-${range[1]}`}
|
|
114
|
+
>
|
|
115
|
+
{range[0]} - {range[1]}
|
|
116
|
+
</Option>
|
|
117
|
+
</Select>
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
@@ -2,44 +2,47 @@ import { Button, Select } from "antd";
|
|
|
2
2
|
import CustomIcon from "../../Icon/CustomIcon.jsx";
|
|
3
3
|
import { Fragment, useState } from "react";
|
|
4
4
|
import Style from "./style.js";
|
|
5
|
+
import SliderItem from "./components/Slider/index.jsx";
|
|
5
6
|
|
|
6
7
|
export default function Filters({ t, filtersConfig, onFilterChange }) {
|
|
7
|
-
|
|
8
|
+
const [opened, setOpened] = useState(false);
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
const renderFilter = (filter) => {
|
|
11
|
+
switch (filter.type) {
|
|
12
|
+
case "select":
|
|
13
|
+
return (
|
|
14
|
+
<div className="form-row">
|
|
15
|
+
<label>{filter.label}</label>
|
|
16
|
+
<Select
|
|
17
|
+
allowClear
|
|
18
|
+
placeholder={filter.placeholder}
|
|
19
|
+
value={filter.value}
|
|
20
|
+
options={filter.options}
|
|
21
|
+
onChange={(c) => onFilterChange({ [filter.key]: c })}
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
case "slider":
|
|
26
|
+
return <SliderItem filter={filter} onFilterChange={onFilterChange} />;
|
|
27
|
+
default:
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
return (
|
|
33
|
+
<Style>
|
|
34
|
+
<Button onClick={() => setOpened((p) => !p)}>
|
|
35
|
+
{t("Filter")}
|
|
36
|
+
<CustomIcon width={16} height={16} name="Filter" />
|
|
37
|
+
</Button>
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
{opened ? (
|
|
40
|
+
<div className="filters">
|
|
41
|
+
{filtersConfig?.map((filter) => (
|
|
42
|
+
<Fragment key={filter.key}>{renderFilter(filter)}</Fragment>
|
|
43
|
+
))}
|
|
44
|
+
</div>
|
|
45
|
+
) : null}
|
|
46
|
+
</Style>
|
|
47
|
+
);
|
|
45
48
|
}
|
package/src/@daf/core/components/ProgressBar/MultiColorProgressBar/MultiColorProgressBar.stories.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import MultiColorProgressBar from "./index";
|
|
2
|
+
import ThemeLayout from "../../ThemeLayout";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Progress/MultiColorProgressBar",
|
|
6
|
+
component: MultiColorProgressBar,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Primary = {
|
|
11
|
+
name: "Default",
|
|
12
|
+
args: {
|
|
13
|
+
percentage: 100,
|
|
14
|
+
tooltipTitle: "Custom Tooltip",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Tooltip, Progress } from 'antd'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MultiColorProgressBar Component
|
|
7
|
+
*
|
|
8
|
+
* A progress bar component that displays progress with a gradient color scheme and tooltip support.
|
|
9
|
+
* Built on top of Ant Design's Progress component, this wrapper provides a multi-color gradient
|
|
10
|
+
* that transitions from green (0%) to yellow (50%) to red (100%) by default.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} props - The component props
|
|
13
|
+
* @param {string} [props.tooltipTitle] - Text to display in the tooltip on hover
|
|
14
|
+
* @param {number} props.percentage - The progress percentage (0-100)
|
|
15
|
+
* @param {Object} [props.strokeColor] - Gradient color configuration object with percentage keys
|
|
16
|
+
* @param {string} [props.strokeColor."0%"] - Start color of the gradient (default: '#32D583' - green)
|
|
17
|
+
* @param {string} [props.strokeColor."50%"] - Middle color of the gradient (default: '#FEC84B' - yellow)
|
|
18
|
+
* @param {string} [props.strokeColor."100%"] - End color of the gradient (default: '#F97066' - red)
|
|
19
|
+
* @param {boolean} [props.showInfo=false] - Whether to display the percentage text on the progress bar
|
|
20
|
+
* @param {...Object} [props.rest] - Additional props passed to the underlying Ant Design Progress component
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
function MultiColorProgressBar({
|
|
24
|
+
tooltipTitle,
|
|
25
|
+
percentage,
|
|
26
|
+
strokeColor = {
|
|
27
|
+
'0%': '#32D583',
|
|
28
|
+
'50%': '#FEC84B',
|
|
29
|
+
'100%': '#F97066',
|
|
30
|
+
},
|
|
31
|
+
showInfo = false,
|
|
32
|
+
...rest
|
|
33
|
+
}) {
|
|
34
|
+
return (
|
|
35
|
+
<Tooltip title={tooltipTitle}>
|
|
36
|
+
<Progress
|
|
37
|
+
percent={percentage}
|
|
38
|
+
strokeColor={strokeColor}
|
|
39
|
+
showInfo={showInfo}
|
|
40
|
+
{...rest}
|
|
41
|
+
/>
|
|
42
|
+
</Tooltip>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
MultiColorProgressBar.propTypes = {
|
|
47
|
+
tooltipTitle: PropTypes.string,
|
|
48
|
+
percentage: PropTypes.number,
|
|
49
|
+
strokeColor: PropTypes.object,
|
|
50
|
+
showInfo: PropTypes.bool,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default MultiColorProgressBar
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Tooltip, Popover } from "antd";
|
|
3
|
-
import { SDG_IMAGES } from "../../../../../constants/SDGs";
|
|
4
|
-
import { SDGList } from "./styles";
|
|
3
|
+
import { SDG_IMAGES } from "../../../../../constants/SDGs.js";
|
|
4
|
+
import { SDGList } from "./styles.js";
|
|
5
5
|
|
|
6
6
|
const GAP_BETWEEN_SDGS = 4;
|
|
7
7
|
|
|
@@ -90,7 +90,15 @@ export default function SDGIcons({
|
|
|
90
90
|
</div>
|
|
91
91
|
}
|
|
92
92
|
>
|
|
93
|
-
<div
|
|
93
|
+
<div
|
|
94
|
+
className="sdg-item-image sdg-item-more"
|
|
95
|
+
style={{
|
|
96
|
+
height: iconSize,
|
|
97
|
+
width: iconSize,
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
+{hiddenCount}
|
|
101
|
+
</div>
|
|
94
102
|
</Popover>
|
|
95
103
|
</li>
|
|
96
104
|
)}
|
package/src/index.js
CHANGED
|
@@ -23,7 +23,6 @@ export { default as Badge } from "./@daf/core/components/Badge/index.jsx";
|
|
|
23
23
|
// Icons
|
|
24
24
|
export { default as GetIcon } from "./@daf/core/components/Icon/index.jsx";
|
|
25
25
|
export { default as CustomIcon } from "./@daf/core/components/Icon/CustomIcon.jsx";
|
|
26
|
-
|
|
27
26
|
// Filters
|
|
28
27
|
export {
|
|
29
28
|
default as SelectFilters,
|
|
@@ -89,6 +88,7 @@ export { AjaxSelectMain as AjaxSelect } from "./@daf/core/components/EditForm/co
|
|
|
89
88
|
// Progress Bar
|
|
90
89
|
export { default as ProgressBar } from "./@daf/core/components/ProgressBar/index.jsx";
|
|
91
90
|
export { default as MultiBarProgress } from "./@daf/core/components/ProgressBar/MultiBarProgress/index.jsx";
|
|
91
|
+
export { default as MultiColorProgressBar } from "./@daf/core/components/ProgressBar/MultiColorProgressBar/index.jsx";
|
|
92
92
|
export { default as ProgressBarSideIcon } from "./@daf/core/components/ProgressBar/components/SideIcon/index.jsx";
|
|
93
93
|
export { default as ProgressTabs } from "./@daf/core/components/ProgressTabs/index.jsx";
|
|
94
94
|
|
|
@@ -162,3 +162,6 @@ export { default as InformationChannelsSubject } from "./@daf/core/components/Sc
|
|
|
162
162
|
export { default as InformationChannelsView } from "./@daf/core/components/Screens/InformationChannels/InformationChannel/index.js";
|
|
163
163
|
export { default as InformationChannelsDataPoint } from "./@daf/core/components/Screens/InformationChannels/DataPoint/index.js";
|
|
164
164
|
export { InformationChannelProvider } from "./@daf/core/components/Screens/InformationChannels/context/index.js";
|
|
165
|
+
|
|
166
|
+
// UI
|
|
167
|
+
export { default as SDGIcons } from "./@daf/core/components/UI/SDGIcon/index.jsx";
|