datastake-daf 0.6.168 → 0.6.170

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/components/index.js +256 -130
  2. package/package.json +1 -1
  3. package/src/@daf/core/components/AvatarGroup/AvatarGroup.stories.jsx +1 -1
  4. package/src/@daf/core/components/Badge/Badge.stories.js +98 -94
  5. package/src/@daf/core/components/Dashboard/Widget/CarouselWidget/CarouselWidget.stories.js +42 -0
  6. package/src/@daf/core/components/Dashboard/Widget/CarouselWidget/index.jsx +72 -0
  7. package/src/@daf/core/components/Dashboard/Widget/ImageCarousel/ImageCarousel.stories.js +93 -0
  8. package/src/@daf/core/components/Dashboard/Widget/ImageCarousel/index.jsx +132 -0
  9. package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/ProjectWidget.stories.jsx +0 -3
  10. package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/components/SdgList.jsx +9 -77
  11. package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/index.jsx +78 -80
  12. package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/style.js +47 -74
  13. package/src/@daf/core/components/EditForm/_index.scss +3 -3
  14. package/src/@daf/core/components/Icon/CustomIcon.stories.js +177 -179
  15. package/src/@daf/core/components/ProgressBar/MultiBarProgress/MultibarProgress.stories.jsx +48 -41
  16. package/src/@daf/core/components/ProgressBar/Progress.stories.jsx +31 -31
  17. package/src/@daf/core/components/Segment/Segment.stories.js +70 -64
  18. package/src/@daf/core/components/UI/SDGIcon/SGDIcon.stories.jsx +55 -0
  19. package/src/@daf/core/components/UI/SDGIcon/index.jsx +100 -0
  20. package/src/@daf/core/components/UI/SDGIcon/styles.js +26 -0
  21. package/src/@daf/core/components/ViewForm/_index.scss +1 -1
  22. package/src/index.js +2 -0
  23. package/src/@daf/core/components/Icon/Icon.stories.js +0 -27
@@ -3065,7 +3065,7 @@ const config$3 = {
3065
3065
  Integration: config$4
3066
3066
  };
3067
3067
 
3068
- const _excluded$s = ["width", "height", "size", "name", "fill"];
3068
+ const _excluded$u = ["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$s);
3077
+ props = _objectWithoutProperties(_ref, _excluded$u);
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$r = ["view", "module", "scope", "form", "meta"];
9279
+ const _excluded$t = ["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$r);
9653
+ rest = _objectWithoutProperties(data, _excluded$t);
9654
9654
  const _meta = isObjectEmpty(meta) ? undefined : meta;
9655
9655
  return _objectSpread2(_objectSpread2({}, rest), {}, {
9656
9656
  meta: _meta
@@ -10035,7 +10035,7 @@ SelectFilters.propTypes = {
10035
10035
  apiUrl: PropTypes__default["default"].string
10036
10036
  };
10037
10037
 
10038
- const _excluded$q = ["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"];
10038
+ const _excluded$s = ["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"];
10039
10039
  function DAFTable(_ref) {
10040
10040
  let {
10041
10041
  columns = [],
@@ -10066,7 +10066,7 @@ function DAFTable(_ref) {
10066
10066
  app,
10067
10067
  doEmptyRows
10068
10068
  } = _ref,
10069
- rest = _objectWithoutProperties(_ref, _excluded$q);
10069
+ rest = _objectWithoutProperties(_ref, _excluded$s);
10070
10070
  const [source, setSource] = React.useState([]);
10071
10071
  const projectData = (projects || []).find(p => p.id === selectedProject);
10072
10072
  const [filtersInit, setFiltersInit] = React.useState(!loading);
@@ -10788,7 +10788,7 @@ Pagination.propTypes = {
10788
10788
  isMobile: PropTypes__default["default"].bool
10789
10789
  };
10790
10790
 
10791
- const _excluded$p = ["size", "maxHeight", "dataSource", "columns", "pagination"];
10791
+ const _excluded$r = ["size", "maxHeight", "dataSource", "columns", "pagination"];
10792
10792
  function StickyTable(_ref) {
10793
10793
  let {
10794
10794
  size = null,
@@ -10797,7 +10797,7 @@ function StickyTable(_ref) {
10797
10797
  columns = {},
10798
10798
  pagination = false
10799
10799
  } = _ref,
10800
- props = _objectWithoutProperties(_ref, _excluded$p);
10800
+ props = _objectWithoutProperties(_ref, _excluded$r);
10801
10801
  return /*#__PURE__*/jsxRuntime.jsx("div", {
10802
10802
  className: "daf-sticky-table",
10803
10803
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Table, _objectSpread2(_objectSpread2({}, props), {}, {
@@ -11262,7 +11262,7 @@ const BTN_SIZE = {
11262
11262
  LG: 'large'
11263
11263
  };
11264
11264
 
11265
- const _excluded$o = ["content", "size", "type", "icon", "onClick", "disabled", "loading", "title", "style", "className"];
11265
+ const _excluded$q = ["content", "size", "type", "icon", "onClick", "disabled", "loading", "title", "style", "className"];
11266
11266
  function DafButton(_ref) {
11267
11267
  let {
11268
11268
  content = '',
@@ -11276,7 +11276,7 @@ function DafButton(_ref) {
11276
11276
  style = {},
11277
11277
  className = ''
11278
11278
  } = _ref,
11279
- restProps = _objectWithoutProperties(_ref, _excluded$o);
11279
+ restProps = _objectWithoutProperties(_ref, _excluded$q);
11280
11280
  return /*#__PURE__*/jsxRuntime.jsx(antd.Button, _objectSpread2(_objectSpread2({
11281
11281
  icon: icon,
11282
11282
  type: type,
@@ -11510,12 +11510,12 @@ const Style$I = dt.div`
11510
11510
  }
11511
11511
  `;
11512
11512
 
11513
- const _excluded$n = ["children"];
11513
+ const _excluded$p = ["children"];
11514
11514
  const BorderedButton = _ref => {
11515
11515
  let {
11516
11516
  children
11517
11517
  } = _ref,
11518
- props = _objectWithoutProperties(_ref, _excluded$n);
11518
+ props = _objectWithoutProperties(_ref, _excluded$p);
11519
11519
  return /*#__PURE__*/jsxRuntime.jsx(Style$I, {
11520
11520
  className: "d-btn-cont",
11521
11521
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, _objectSpread2(_objectSpread2({}, props), {}, {
@@ -11655,12 +11655,12 @@ Badge.propTypes = {
11655
11655
  props: PropTypes__default["default"].object
11656
11656
  };
11657
11657
 
11658
- const _excluded$m = ["icon"];
11658
+ const _excluded$o = ["icon"];
11659
11659
  function GetIcon(_ref) {
11660
11660
  let {
11661
11661
  icon
11662
11662
  } = _ref,
11663
- props = _objectWithoutProperties(_ref, _excluded$m);
11663
+ props = _objectWithoutProperties(_ref, _excluded$o);
11664
11664
  let Icon = Icons__namespace.CloseOutlined;
11665
11665
  if (Icons__namespace[icon]) {
11666
11666
  Icon = Icons__namespace[icon];
@@ -11979,7 +11979,7 @@ GoToSelect.propTypes = {
11979
11979
  t: PropTypes__default["default"].func
11980
11980
  };
11981
11981
 
11982
- const _excluded$l = ["options", "defaultSelected", "onChange", "textWhenMultiple", "withCount", "oneAlwaysSelected", "canUnselectLast", "isAvatarGroup", "maxAvatarCount", "dropDownWidth", "topAvatarValue", "isSingle", "selectionType"];
11982
+ const _excluded$n = ["options", "defaultSelected", "onChange", "textWhenMultiple", "withCount", "oneAlwaysSelected", "canUnselectLast", "isAvatarGroup", "maxAvatarCount", "dropDownWidth", "topAvatarValue", "isSingle", "selectionType"];
11983
11983
  const {
11984
11984
  useToken: useToken$k
11985
11985
  } = antd.theme;
@@ -12072,7 +12072,7 @@ function Multiselect(_ref) {
12072
12072
  isSingle = false,
12073
12073
  selectionType = SELECTION_TYPES.DEFAULT
12074
12074
  } = _ref,
12075
- restProps = _objectWithoutProperties(_ref, _excluded$l);
12075
+ restProps = _objectWithoutProperties(_ref, _excluded$n);
12076
12076
  const {
12077
12077
  token
12078
12078
  } = useToken$k();
@@ -12739,7 +12739,7 @@ DAFHeader.propTypes = {
12739
12739
  downloadDisabled: PropTypes__default["default"].any
12740
12740
  };
12741
12741
 
12742
- const _excluded$k = ["tabs", "onChange", "value", "className"];
12742
+ const _excluded$m = ["tabs", "onChange", "value", "className"];
12743
12743
  function TabsHeader(_ref) {
12744
12744
  let {
12745
12745
  tabs = [],
@@ -12747,7 +12747,7 @@ function TabsHeader(_ref) {
12747
12747
  value = '',
12748
12748
  className = 'mt-2'
12749
12749
  } = _ref,
12750
- rest = _objectWithoutProperties(_ref, _excluded$k);
12750
+ rest = _objectWithoutProperties(_ref, _excluded$m);
12751
12751
  return /*#__PURE__*/jsxRuntime.jsx("div", {
12752
12752
  className: formatClassname(['daf-tabs-header pl-6 pr-6', className]),
12753
12753
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Tabs, _objectSpread2({
@@ -12844,7 +12844,7 @@ DrawerHeader.propTypes = {
12844
12844
  tabsConfig: PropTypes__default["default"].any
12845
12845
  };
12846
12846
 
12847
- const _excluded$j = ["label", "onClick", "icon", "type", "tooltip", "disabled", "loading", "style", "className"];
12847
+ const _excluded$l = ["label", "onClick", "icon", "type", "tooltip", "disabled", "loading", "style", "className"];
12848
12848
  const useFooter = _ref => {
12849
12849
  let {
12850
12850
  leftContent,
@@ -12879,7 +12879,7 @@ const useFooter = _ref => {
12879
12879
  style = {},
12880
12880
  className = ""
12881
12881
  } = button,
12882
- restProps = _objectWithoutProperties(button, _excluded$j);
12882
+ restProps = _objectWithoutProperties(button, _excluded$l);
12883
12883
  return /*#__PURE__*/jsxRuntime.jsx(DafButton, _objectSpread2({
12884
12884
  content: label,
12885
12885
  type: type,
@@ -15369,7 +15369,7 @@ Widget.propTypes = {
15369
15369
  onExpandChange: PropTypes__default["default"].func
15370
15370
  };
15371
15371
 
15372
- const _excluded$i = ["loading", "title", "image", "description", "imgAlt", "noDescriptionText"];
15372
+ const _excluded$k = ["loading", "title", "image", "description", "imgAlt", "noDescriptionText"];
15373
15373
  function ImageWidget(_ref) {
15374
15374
  let {
15375
15375
  loading = false,
@@ -15379,7 +15379,7 @@ function ImageWidget(_ref) {
15379
15379
  imgAlt,
15380
15380
  noDescriptionText
15381
15381
  } = _ref,
15382
- props = _objectWithoutProperties(_ref, _excluded$i);
15382
+ props = _objectWithoutProperties(_ref, _excluded$k);
15383
15383
  return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
15384
15384
  loading: loading,
15385
15385
  title: title,
@@ -15436,7 +15436,7 @@ function ImageWidget(_ref) {
15436
15436
  }
15437
15437
 
15438
15438
  var _templateObject$a;
15439
- const _excluded$h = ["title", "loading", "data", "current", "defaultActiveTab", "widgetClassname", "className", "direction"];
15439
+ const _excluded$j = ["title", "loading", "data", "current", "defaultActiveTab", "widgetClassname", "className", "direction"];
15440
15440
  function FlowWidget(_ref) {
15441
15441
  let {
15442
15442
  title,
@@ -15448,7 +15448,7 @@ function FlowWidget(_ref) {
15448
15448
  className,
15449
15449
  direction = "horizontal"
15450
15450
  } = _ref,
15451
- rest = _objectWithoutProperties(_ref, _excluded$h);
15451
+ rest = _objectWithoutProperties(_ref, _excluded$j);
15452
15452
  const [activeTab, setActiveTab] = React.useState();
15453
15453
  React.useEffect(() => {
15454
15454
  if (defaultActiveTab) {
@@ -20129,14 +20129,14 @@ const MapConfig = ({
20129
20129
  });
20130
20130
  };
20131
20131
 
20132
- const _excluded$g = ["config", "title", "loading"];
20132
+ const _excluded$i = ["config", "title", "loading"];
20133
20133
  const Details = _ref => {
20134
20134
  let {
20135
20135
  config = [],
20136
20136
  title,
20137
20137
  loading = false
20138
20138
  } = _ref,
20139
- rest = _objectWithoutProperties(_ref, _excluded$g);
20139
+ rest = _objectWithoutProperties(_ref, _excluded$i);
20140
20140
  return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
20141
20141
  className: "with-border-header h-w-btn-header card",
20142
20142
  loading: loading,
@@ -20152,14 +20152,14 @@ const Details = _ref => {
20152
20152
  }));
20153
20153
  };
20154
20154
 
20155
- const _excluded$f = ["config", "title", "loading"];
20155
+ const _excluded$h = ["config", "title", "loading"];
20156
20156
  const KeyIndicatorsDetails = _ref => {
20157
20157
  let {
20158
20158
  config,
20159
20159
  title,
20160
20160
  loading = false
20161
20161
  } = _ref,
20162
- rest = _objectWithoutProperties(_ref, _excluded$f);
20162
+ rest = _objectWithoutProperties(_ref, _excluded$h);
20163
20163
  return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
20164
20164
  className: "with-border-header h-w-btn-header",
20165
20165
  title: title,
@@ -20189,7 +20189,7 @@ const Style$y = dt.div`
20189
20189
  }
20190
20190
  `;
20191
20191
 
20192
- const _excluded$e = ["children", "config", "detailsTitle", "firstColumnWidth"];
20192
+ const _excluded$g = ["children", "config", "detailsTitle", "firstColumnWidth"];
20193
20193
  const DetailsSection = _ref => {
20194
20194
  let {
20195
20195
  children,
@@ -20197,7 +20197,7 @@ const DetailsSection = _ref => {
20197
20197
  detailsTitle,
20198
20198
  firstColumnWidth = "250px"
20199
20199
  } = _ref,
20200
- rest = _objectWithoutProperties(_ref, _excluded$e);
20200
+ rest = _objectWithoutProperties(_ref, _excluded$g);
20201
20201
  return /*#__PURE__*/jsxRuntime.jsx(Style$y, {
20202
20202
  firstColumnWidth: firstColumnWidth,
20203
20203
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -20373,14 +20373,14 @@ const getGoalConfig = () => {
20373
20373
  };
20374
20374
 
20375
20375
  var _templateObject$8;
20376
- const _excluded$d = ["title", "activeSdgGoals", "t"];
20376
+ const _excluded$f = ["title", "activeSdgGoals", "t"];
20377
20377
  function SDGWidget(_ref) {
20378
20378
  let {
20379
20379
  title = "Sustainable Development Goals",
20380
20380
  activeSdgGoals = [],
20381
20381
  t = key => key
20382
20382
  } = _ref,
20383
- props = _objectWithoutProperties(_ref, _excluded$d);
20383
+ props = _objectWithoutProperties(_ref, _excluded$f);
20384
20384
  const sdgConfig = getGoalConfig();
20385
20385
  return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
20386
20386
  title: title,
@@ -20401,100 +20401,113 @@ function SDGWidget(_ref) {
20401
20401
  const SDGContainer = dt.div(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteral(["\n\tdisplay: grid;\n\tgrid-template-columns: repeat(auto-fit, minmax(90px, 1fr));\n\tgap: 8px;\n\n\t.sdg-item {\n\t\theight: 90px;\n\t\twidth: 90px;\n\t\tborder-radius: 8px;\n\t\tbackground-size: cover;\n\t\tbackground-position: center;\n\t\tbackground-repeat: no-repeat;\n\t}\n\n\t.sdg-item-content {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\theight: 100%;\n\t\tcolor: white;\n\t\ttext-align: center;\n\t}\n"])));
20402
20402
 
20403
20403
  const ImageContainer = dt.div`
20404
- overflow: hidden;
20405
- position: relative;
20404
+ overflow: hidden;
20405
+ position: relative;
20406
20406
 
20407
- .image {
20408
- width: 100%;
20409
- height: 151px;
20410
- background-size: cover;
20411
- background-position: center;
20412
- background-repeat: no-repeat;
20407
+ .image {
20408
+ width: 100%;
20409
+ height: 151px;
20410
+ background-size: cover;
20411
+ background-position: center;
20412
+ background-repeat: no-repeat;
20413
20413
 
20414
- border-bottom-left-radius: 3px;
20415
- border-bottom-right-radius: 3px;
20416
- }
20414
+ border-bottom-left-radius: 3px;
20415
+ border-bottom-right-radius: 3px;
20416
+ }
20417
20417
 
20418
- .icon-container {
20419
- position: absolute;
20420
- top: 10px;
20421
- right: 10px;
20422
- background: white;
20423
- padding: 10px;
20424
- border-radius: 6px;
20425
- cursor: pointer;
20426
- }
20418
+ .icon-container {
20419
+ position: absolute;
20420
+ top: 10px;
20421
+ right: 10px;
20422
+ background: white;
20423
+ padding: 10px;
20424
+ border-radius: 6px;
20425
+ cursor: pointer;
20426
+ }
20427
20427
  `;
20428
20428
  const ProjectWidgetItems = dt.ul`
20429
- list-style: none;
20430
- padding: 0;
20431
- padding-top: 10px;
20432
- margin: 0;
20429
+ list-style: none;
20430
+ padding: 0;
20431
+ padding-top: 10px;
20432
+ margin: 0;
20433
20433
 
20434
- .project-widget-item {
20435
- display: flex;
20436
- justify-content: space-between;
20437
- align-items: center;
20438
- border-bottom: 1px solid var(--base-gray-30);
20439
- padding: 10px 0;
20434
+ .project-widget-item {
20435
+ display: flex;
20436
+ justify-content: space-between;
20437
+ align-items: center;
20438
+ border-bottom: 1px solid var(--base-gray-30);
20439
+ padding: 10px 0;
20440
20440
 
20441
- &:last-of-type {
20442
- border-bottom: 0;
20443
- }
20444
- }
20441
+ &:last-of-type {
20442
+ border-bottom: 0;
20443
+ }
20444
+ }
20445
20445
  `;
20446
+ const Label = dt.span`
20447
+ font-family: SF UI Display;
20448
+ font-weight: 500;
20449
+ font-style: Medium;
20450
+ font-size: 14px;
20451
+ leading-trim: NONE;
20452
+ line-height: 26px;
20453
+ letter-spacing: 0%;
20454
+ color: #6c737f;
20455
+ `;
20456
+
20446
20457
  const SDGList = dt.ul`
20447
- list-style: none;
20448
- padding: 0;
20449
- width: 100%;
20450
- overflow-x: hidden;
20451
- display: flex;
20452
- flex-wrap: nowrap;
20453
- gap: 4px;
20454
- margin: 0;
20455
-
20456
- .sdg-item-image {
20457
- width: 24px;
20458
- height: 24px;
20459
- background-size: cover;
20460
- background-position: center;
20461
- background-repeat: no-repeat;
20462
- }
20458
+ list-style: none;
20459
+ padding: 0;
20460
+ width: 100%;
20461
+ overflow-x: hidden;
20462
+ display: flex;
20463
+ flex-wrap: nowrap;
20464
+ gap: 4px;
20465
+ margin: 0;
20463
20466
 
20464
- .sdg-item-more {
20465
- display: flex;
20466
- align-items: center;
20467
- justify-content: center;
20468
- background: var(--base-gray-30);
20469
- color: var(--base-gray-90);
20470
- }
20471
- `;
20472
- const Label = dt.span`
20473
- font-family: SF UI Display;
20474
- font-weight: 500;
20475
- font-style: Medium;
20476
- font-size: 14px;
20477
- leading-trim: NONE;
20478
- line-height: 26px;
20479
- letter-spacing: 0%;
20480
- color: #6c737f;
20467
+ .sdg-item-image {
20468
+ background-size: cover;
20469
+ background-position: center;
20470
+ background-repeat: no-repeat;
20471
+ }
20472
+
20473
+ .sdg-item-more {
20474
+ display: flex;
20475
+ align-items: center;
20476
+ justify-content: center;
20477
+ background: var(--base-gray-30);
20478
+ color: var(--base-gray-90);
20479
+ }
20481
20480
  `;
20482
20481
 
20483
- const SDG_IMAGE_WIDTH = 24;
20484
20482
  const GAP_BETWEEN_SDGS = 4;
20485
- const TOTAL_SPACE_FOR_SDG = SDG_IMAGE_WIDTH + GAP_BETWEEN_SDGS;
20486
- function SdgList({
20483
+ function SDGIcons({
20487
20484
  sdgList = [],
20488
- t,
20489
- cardWidth
20485
+ t = str => str,
20486
+ iconSize = 24
20490
20487
  }) {
20491
- const maxSdgToShow = React.useMemo(() => {
20492
- return Math.floor(cardWidth / TOTAL_SPACE_FOR_SDG);
20493
- }, [cardWidth]);
20488
+ const containerRef = React__default["default"].useRef(null);
20489
+ const [width, setWidth] = React__default["default"].useState(0);
20490
+ React__default["default"].useEffect(() => {
20491
+ if (containerRef.current) {
20492
+ const resizeObserver = new ResizeObserver(entries => {
20493
+ for (let entry of entries) {
20494
+ setWidth(entry.contentRect.width);
20495
+ }
20496
+ });
20497
+ resizeObserver.observe(containerRef.current);
20498
+ return () => {
20499
+ resizeObserver.disconnect();
20500
+ };
20501
+ }
20502
+ }, []);
20503
+ const maxSdgToShow = React__default["default"].useMemo(() => {
20504
+ const TOTAL_SPACE_FOR_SDG = iconSize + GAP_BETWEEN_SDGS;
20505
+ return Math.floor(width / TOTAL_SPACE_FOR_SDG);
20506
+ }, [width, iconSize]);
20494
20507
  const {
20495
20508
  visibleSdgs,
20496
20509
  hiddenCount
20497
- } = React.useMemo(() => {
20510
+ } = React__default["default"].useMemo(() => {
20498
20511
  if (sdgList.length <= maxSdgToShow) {
20499
20512
  return {
20500
20513
  visibleSdgs: sdgList,
@@ -20506,17 +20519,18 @@ function SdgList({
20506
20519
  hiddenCount: sdgList.length - (maxSdgToShow - 1)
20507
20520
  };
20508
20521
  }, [sdgList, maxSdgToShow]);
20509
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
20510
- children: [/*#__PURE__*/jsxRuntime.jsx(Label, {
20511
- children: "SDGs:"
20512
- }), /*#__PURE__*/jsxRuntime.jsxs(SDGList, {
20522
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
20523
+ ref: containerRef,
20524
+ children: /*#__PURE__*/jsxRuntime.jsxs(SDGList, {
20513
20525
  children: [visibleSdgs.map((sdg, index) => /*#__PURE__*/jsxRuntime.jsx("li", {
20514
20526
  className: "project-widget-item",
20515
20527
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
20516
20528
  title: t(`SDGS::${sdg}`),
20517
20529
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
20518
20530
  style: {
20519
- backgroundImage: `url(${SDG_IMAGES[sdg].img})`
20531
+ backgroundImage: `url(${SDG_IMAGES[sdg].img})`,
20532
+ height: iconSize,
20533
+ width: iconSize
20520
20534
  },
20521
20535
  className: "sdg-item-image"
20522
20536
  })
@@ -20536,8 +20550,8 @@ function SdgList({
20536
20550
  title: t(`SDGS::${sdg}`),
20537
20551
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
20538
20552
  style: {
20539
- width: SDG_IMAGE_WIDTH,
20540
- height: SDG_IMAGE_WIDTH,
20553
+ width: iconSize,
20554
+ height: iconSize,
20541
20555
  backgroundImage: `url(${SDG_IMAGES[sdg].img})`,
20542
20556
  backgroundSize: "cover",
20543
20557
  borderRadius: 4
@@ -20552,11 +20566,25 @@ function SdgList({
20552
20566
  })
20553
20567
  })
20554
20568
  })]
20569
+ })
20570
+ });
20571
+ }
20572
+
20573
+ function SdgList({
20574
+ sdgList = [],
20575
+ t
20576
+ }) {
20577
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
20578
+ children: [/*#__PURE__*/jsxRuntime.jsx(Label, {
20579
+ children: "SDGs:"
20580
+ }), /*#__PURE__*/jsxRuntime.jsx(SDGIcons, {
20581
+ sdgList: sdgList,
20582
+ t: t
20555
20583
  })]
20556
20584
  });
20557
20585
  }
20558
20586
 
20559
- const _excluded$c = ["title", "description", "onLinkClick", "image", "linkIcon", "sdgList", "items", "onCardClick", "hideSDGList", "t"];
20587
+ const _excluded$e = ["title", "description", "onLinkClick", "image", "linkIcon", "sdgList", "items", "onCardClick", "hideSDGList", "t"];
20560
20588
  const {
20561
20589
  Meta
20562
20590
  } = antd.Card;
@@ -20576,20 +20604,11 @@ function ProjectWidget(_ref) {
20576
20604
  hideSDGList = false,
20577
20605
  t = x => x
20578
20606
  } = _ref,
20579
- props = _objectWithoutProperties(_ref, _excluded$c);
20607
+ props = _objectWithoutProperties(_ref, _excluded$e);
20580
20608
  const [isHovered, setIsHovered] = React__default["default"].useState(false);
20581
20609
  const {
20582
20610
  token
20583
20611
  } = useToken$i();
20584
- const cardRef = React__default["default"].useRef(null);
20585
- const [cardWidth, setCardWidth] = React__default["default"].useState(0);
20586
- React__default["default"].useEffect(() => {
20587
- const resizeObserver = new ResizeObserver(entries => {
20588
- setCardWidth(entries[0].contentRect.width);
20589
- });
20590
- resizeObserver.observe(cardRef.current);
20591
- return () => resizeObserver.disconnect();
20592
- }, [cardRef]);
20593
20612
  return /*#__PURE__*/jsxRuntime.jsxs(antd.Card, _objectSpread2(_objectSpread2({
20594
20613
  style: {
20595
20614
  flex: 1,
@@ -20601,11 +20620,18 @@ function ProjectWidget(_ref) {
20601
20620
  onMouseLeave: () => setIsHovered(false),
20602
20621
  onClick: onCardClick,
20603
20622
  cover: /*#__PURE__*/jsxRuntime.jsxs(ImageContainer, {
20604
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
20623
+ children: [image ? /*#__PURE__*/jsxRuntime.jsx("div", {
20605
20624
  className: "image",
20606
20625
  style: {
20607
20626
  backgroundImage: "url(".concat(image, ")")
20608
20627
  }
20628
+ }) : /*#__PURE__*/jsxRuntime.jsx("div", {
20629
+ style: {
20630
+ height: "103px"
20631
+ },
20632
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {
20633
+ image: antd.Empty.PRESENTED_IMAGE_SIMPLE
20634
+ })
20609
20635
  }), onLinkClick && /*#__PURE__*/jsxRuntime.jsx("div", {
20610
20636
  className: "icon-container",
20611
20637
  onClick: onLinkClick,
@@ -20633,11 +20659,9 @@ function ProjectWidget(_ref) {
20633
20659
  borderTop: "1px solid var(--base-gray-30)",
20634
20660
  paddingTop: "10px"
20635
20661
  },
20636
- ref: cardRef,
20637
20662
  children: /*#__PURE__*/jsxRuntime.jsx(SdgList, {
20638
20663
  sdgList: sdgList,
20639
- t: t,
20640
- cardWidth: cardWidth
20664
+ t: t
20641
20665
  })
20642
20666
  })]
20643
20667
  }));
@@ -20743,6 +20767,106 @@ const WidgetCard = _ref => {
20743
20767
  });
20744
20768
  };
20745
20769
 
20770
+ const _excluded$d = ["title", "children"];
20771
+ function CarouselWidget(_ref) {
20772
+ let {
20773
+ title,
20774
+ children
20775
+ } = _ref,
20776
+ rest = _objectWithoutProperties(_ref, _excluded$d);
20777
+ /**
20778
+ * Handles carousel slide change events
20779
+ * @param {number} currentSlide - The index of the current slide after change
20780
+ * @private
20781
+ */
20782
+ const onChange = currentSlide => {
20783
+ console.log(currentSlide);
20784
+ };
20785
+ return /*#__PURE__*/jsxRuntime.jsx(Widget, {
20786
+ title: title,
20787
+ className: "with-border-header h-w-btn-header",
20788
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Carousel, _objectSpread2(_objectSpread2({
20789
+ afterChange: onChange
20790
+ }, rest), {}, {
20791
+ children: children
20792
+ }))
20793
+ });
20794
+ }
20795
+
20796
+ const _excluded$c = ["title", "images", "height", "fallback"];
20797
+ function ImageCarousel(_ref) {
20798
+ let {
20799
+ title,
20800
+ images,
20801
+ height = 400,
20802
+ fallback = "/assets/images/empty-box.svg"
20803
+ } = _ref,
20804
+ rest = _objectWithoutProperties(_ref, _excluded$c);
20805
+ const [previewVisible, setPreviewVisible] = React.useState(false);
20806
+ const [current, setCurrent] = React.useState(0);
20807
+ const carouselRef = React.useRef(null);
20808
+ const handleCarouselChange = index => {
20809
+ setCurrent(index);
20810
+ };
20811
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
20812
+ children: [/*#__PURE__*/jsxRuntime.jsx(CarouselWidget, _objectSpread2(_objectSpread2({
20813
+ title: title
20814
+ }, rest), {}, {
20815
+ dots: false,
20816
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Carousel, {
20817
+ ref: carouselRef,
20818
+ afterChange: handleCarouselChange,
20819
+ infinite: true,
20820
+ children: images.map((image, index) => {
20821
+ const imageSrc = typeof image === "string" ? image : image.src;
20822
+ const imageAlt = typeof image === "string" ? "".concat(title, " - Image ").concat(index + 1) : image.alt;
20823
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
20824
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Image, {
20825
+ src: imageSrc,
20826
+ alt: imageAlt,
20827
+ height: height,
20828
+ width: "100%",
20829
+ fallback: fallback,
20830
+ loading: "lazy",
20831
+ preview: {
20832
+ visible: false
20833
+ },
20834
+ onClick: () => {
20835
+ setCurrent(index);
20836
+ setPreviewVisible(true);
20837
+ }
20838
+ })
20839
+ }, imageSrc);
20840
+ })
20841
+ })
20842
+ })), /*#__PURE__*/jsxRuntime.jsx("div", {
20843
+ style: {
20844
+ display: "none"
20845
+ },
20846
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Image.PreviewGroup, {
20847
+ preview: {
20848
+ visible: previewVisible,
20849
+ current,
20850
+ onVisibleChange: vis => setPreviewVisible(vis),
20851
+ onChange: idx => {
20852
+ var _carouselRef$current;
20853
+ setCurrent(idx);
20854
+ (_carouselRef$current = carouselRef.current) === null || _carouselRef$current === void 0 || _carouselRef$current.goTo(idx);
20855
+ }
20856
+ },
20857
+ children: images.map((image, index) => {
20858
+ const imageSrc = typeof image === "string" ? image : image.src;
20859
+ const imageAlt = typeof image === "string" ? "".concat(title, " - Image ").concat(index + 1) : image.alt;
20860
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Image, {
20861
+ src: imageSrc,
20862
+ alt: imageAlt
20863
+ }, imageSrc);
20864
+ })
20865
+ })
20866
+ })]
20867
+ });
20868
+ }
20869
+
20746
20870
  var Style$w = dt.div`
20747
20871
  border: 1px solid var(--base-gray-40);
20748
20872
  padding: 12px;
@@ -60033,6 +60157,7 @@ exports.BarChart = BarChart;
60033
60157
  exports.BaseScreen = BaseScreen;
60034
60158
  exports.BorderedButton = BorderedButton;
60035
60159
  exports.Button = DafButton;
60160
+ exports.CarouselWidget = CarouselWidget;
60036
60161
  exports.ColumnChart = ColumnChart;
60037
60162
  exports.ComponentWithFocus = ComponentWithFocus;
60038
60163
  exports.CustomIcon = CustomIcon;
@@ -60062,6 +60187,7 @@ exports.GetIcon = GetIcon;
60062
60187
  exports.Globe = Globe;
60063
60188
  exports.GoToSelect = GoToSelect;
60064
60189
  exports.Header = DAFHeader;
60190
+ exports.ImageCarousel = ImageCarousel;
60065
60191
  exports.InformationChannelProvider = InformationChannelProvider;
60066
60192
  exports.InformationChannels = DataStoreTable;
60067
60193
  exports.InformationChannelsDataPoint = DataPoint;