@kando-env/kando-ui 1.0.6 → 1.0.9

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 (109) hide show
  1. package/lib/CovidView/views/components/Body.js +2 -2
  2. package/lib/CovidView/views/components/Map.js +3 -2
  3. package/lib/CovidView/views/components/TrendPopupContent/TrendPopupContent.js +10 -10
  4. package/lib/CovidView/views/components/areas/AreaPolygonWBE.js +7 -7
  5. package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/ParametersContainer/ParametersButtons/styles.js +4 -4
  6. package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/ParametersContainer/ParametersContainer.js +1 -1
  7. package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/SamplingContainer/ExceptionBar/styles.js +4 -4
  8. package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/SamplingContainer/SamplingContainer.js +1 -1
  9. package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/SamplingParameters.js +3 -3
  10. package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/charts/options/options.js +25 -4
  11. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Areas/AreaBox/AreaBox.js +6 -6
  12. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Areas/AreaBox/styles.js +1 -1
  13. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Areas/Areas.js +40 -45
  14. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Areas/styles.js +3 -3
  15. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Factories/Factories.js +40 -45
  16. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Factories/FactoryBox/FactoryBox.js +5 -4
  17. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Factories/FactoryBox/styles.js +1 -1
  18. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Factories/styles.js +2 -2
  19. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/MostPolluting.js +7 -13
  20. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/ShowMore/styles.js +1 -1
  21. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Tabs/Tabs.js +17 -32
  22. package/lib/{EventsView/views/components/UtilityDashboard/TopBar → DashboardV2/UtilityDashboard/MostPolluting}/models.js +3 -1
  23. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/styles.js +2 -2
  24. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostSevereEvents/MostSevereEvents.js +1 -1
  25. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostSevereEvents/MostSevereEvents.scss +5 -5
  26. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/MostCommon/Back/Back.js +1 -1
  27. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/MostCommon/MostCommon.js +1 -1
  28. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/MostCommon/styles.js +11 -11
  29. package/lib/DashboardV2/UtilityDashboard/TopBar/QualitySummary/PieChart/PieChart.js +128 -0
  30. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/QualitySummary/PollutedLine/PollutedLine.js +3 -3
  31. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/QualitySummary/QualitySummary.js +15 -4
  32. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/QualitySummary/styles.js +8 -8
  33. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/TopBar.js +3 -3
  34. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/UtilityInformation/UtilityInformation.js +2 -2
  35. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/UtilityInformation/styles.js +6 -6
  36. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/styles.js +1 -1
  37. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/UtilityDashboard.js +1 -1
  38. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/UtilityDashboard.stories.js +62 -1
  39. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/mocks/areas.mock.js +9 -33
  40. package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/mocks/factories.mock.js +4 -16
  41. package/lib/EventsView/views/components/Body.js +55 -29
  42. package/lib/EventsView/views/components/map/FloatingGraph.js +2 -2
  43. package/lib/EventsView/views/components/map/Map.js +12 -7
  44. package/lib/EventsView/views/components/points/PointMarker.js +15 -15
  45. package/lib/index.js +67 -3
  46. package/lib/shared/components/DoubleTabs/styles.js +1 -1
  47. package/lib/shared/components/KandoModal/KandoModal.js +2 -2
  48. package/lib/shared/components/Map/Map.js +4 -1
  49. package/lib/shared/components/Select/Select.js +48 -6
  50. package/lib/shared/components/Select/Select.scss +5 -14
  51. package/lib/shared/components/Select/Select.stories.js +4 -1
  52. package/package.json +9 -8
  53. package/lib/EventsView/views/components/UtilityDashboard/TopBar/QualitySummary/PieChart/PieChart.js +0 -117
  54. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/NoResults/NoResults.js +0 -0
  55. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/NoResults/NoResults.stories.js +0 -0
  56. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/NoResults/discover.svg +0 -0
  57. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/ParametersContainer/ParametersButtons/ParameterButton/ParameterButton.js +0 -0
  58. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/ParametersContainer/ParametersButtons/ParametersButtons.js +0 -0
  59. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/SamplingContainer/ExceptionBar/ExceptionBar.js +0 -0
  60. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/SamplingContainer/ExceptionBar/ExceptionBar.stories.js +0 -0
  61. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/SamplingContainer/ExpandableSamplingTable/ExpandableSamplingTable.js +0 -0
  62. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/SamplingContainer/ExpandableSamplingTable/ExpandableSamplingTable.scss +0 -0
  63. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/SamplingContainer/ExpandableSamplingTable/assets/rigth.svg +0 -0
  64. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/SamplingParameters.mock.js +0 -0
  65. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/SamplingParameters.stories.js +0 -0
  66. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/charts/ParametersChart.js +0 -0
  67. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/charts/SamplingChart.js +0 -0
  68. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/dataParser.js +0 -0
  69. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/models.js +0 -0
  70. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/styles/samplingParameters.js +0 -0
  71. /package/lib/{EventsView/views/components → DashboardV2}/SamplingParameters/styles/styles.js +0 -0
  72. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Areas/AreaBox/AreaMap/AreaMap.js +0 -0
  73. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Areas/AreaBox/PieChart/PieChart.js +0 -0
  74. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Factories/FactoryBox/PieChart/PieChart.js +0 -0
  75. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/MostPolluting.stories.js +0 -0
  76. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/ShowMore/ShowMore.js +0 -0
  77. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Tabs/Tabs.stories.js +0 -0
  78. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Tabs/assets/home.svg +0 -0
  79. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Tabs/assets/index.js +0 -0
  80. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Tabs/assets/matash.svg +0 -0
  81. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Tabs/assets/plant.svg +0 -0
  82. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Tabs/assets/shape.svg +0 -0
  83. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/Tabs/assets/water.svg +0 -0
  84. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/assets/down-arrow.svg +0 -0
  85. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/assets/gas.svg +0 -0
  86. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/assets/index.js +0 -0
  87. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/assets/leather.svg +0 -0
  88. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/assets/metal.svg +0 -0
  89. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/assets/shop.svg +0 -0
  90. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostPolluting/assets/show-more.svg +0 -0
  91. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostSevereEvents/MostSevereEvents.stories.js +0 -0
  92. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostSevereEvents/NoEvents/NoEvents.js +0 -0
  93. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostSevereEvents/NoEvents/NoEvents.stories.js +0 -0
  94. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostSevereEvents/NoEvents/discover.svg +0 -0
  95. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostSevereEvents/SevereEvent/SevereEvent.js +0 -0
  96. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostSevereEvents/SevereEvent/SevereEvent.scss +0 -0
  97. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostSevereEvents/SevereEvent/assets/info.svg +0 -0
  98. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostSevereEvents/SevereEvent/assets/pipe-bluckages.svg +0 -0
  99. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostSevereEvents/SevereEvent/assets/pipe.svg +0 -0
  100. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/MostSevereEvents/SevereEvent/assets/sludge.svg +0 -0
  101. /package/lib/{EventsView/views/components/UtilityDashboard/MostPolluting → DashboardV2/UtilityDashboard/MostSevereEvents}/models.js +0 -0
  102. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/MostCommon/assets/arrow.svg +0 -0
  103. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/MostCommon/assets/bacteria.svg +0 -0
  104. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/MostCommon/assets/clock.svg +0 -0
  105. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/MostCommon/assets/pipes.svg +0 -0
  106. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/TopBar/QualitySummary/assets/down-arrow.svg +0 -0
  107. /package/lib/{EventsView/views/components/UtilityDashboard/MostSevereEvents → DashboardV2/UtilityDashboard/TopBar}/models.js +0 -0
  108. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/mocks/events.mock.js +0 -0
  109. /package/lib/{EventsView/views/components → DashboardV2}/UtilityDashboard/mocks/index.js +0 -0
@@ -19,39 +19,39 @@ var _useRemoveExistingLayers = _interopRequireWildcard(require("../../../../shar
19
19
 
20
20
  var _i18n = _interopRequireDefault(require("../../../../shared/utilities/i18n"));
21
21
 
22
- var _lineChart = _interopRequireDefault(require("../../../../assets/images/line-chart.svg"));
22
+ var _lineChart = _interopRequireDefault(require("../../../../assets/line-chart.svg"));
23
23
 
24
24
  var _jquery = _interopRequireDefault(require("jquery"));
25
25
 
26
26
  var _actions = require("../../../../shared/redux/global/actions");
27
27
 
28
- var _whitePoint = _interopRequireDefault(require("../../../../assets/images/white-point.png"));
28
+ var _whitePoint = _interopRequireDefault(require("../../../../assets/white-point.png"));
29
29
 
30
- var _whitePinRedShadow = _interopRequireDefault(require("../../../../assets/images/point_icons/white-pin-red-shadow.png"));
30
+ var _whitePinRedShadow = _interopRequireDefault(require("../../../../assets/point_icons/white-pin-red-shadow.png"));
31
31
 
32
- var _whitePinBlackShadow = _interopRequireDefault(require("../../../../assets/images/point_icons/white-pin-black-shadow.png"));
32
+ var _whitePinBlackShadow = _interopRequireDefault(require("../../../../assets/point_icons/white-pin-black-shadow.png"));
33
33
 
34
- var _redPinRedShadow = _interopRequireDefault(require("../../../../assets/images/point_icons/red-pin-red-shadow.png"));
34
+ var _redPinRedShadow = _interopRequireDefault(require("../../../../assets/point_icons/red-pin-red-shadow.png"));
35
35
 
36
- var _yellowCircle = _interopRequireDefault(require("../../../../assets/images/point_icons/yellow-circle.svg"));
36
+ var _yellowCircle = _interopRequireDefault(require("../../../../assets/point_icons/yellow-circle.svg"));
37
37
 
38
- var _brightBlueCircle = _interopRequireDefault(require("../../../../assets/images/point_icons/bright-blue-circle.svg"));
38
+ var _brightBlueCircle = _interopRequireDefault(require("../../../../assets/point_icons/bright-blue-circle.svg"));
39
39
 
40
- var _greenCircle = _interopRequireDefault(require("../../../../assets/images/point_icons/green-circle.svg"));
40
+ var _greenCircle = _interopRequireDefault(require("../../../../assets/point_icons/green-circle.svg"));
41
41
 
42
- var _pinkCircle = _interopRequireDefault(require("../../../../assets/images/point_icons/pink-circle.svg"));
42
+ var _pinkCircle = _interopRequireDefault(require("../../../../assets/point_icons/pink-circle.svg"));
43
43
 
44
- var _blueCircle = _interopRequireDefault(require("../../../../assets/images/point_icons/blue-circle.svg"));
44
+ var _blueCircle = _interopRequireDefault(require("../../../../assets/point_icons/blue-circle.svg"));
45
45
 
46
- var _WWTPIcon = _interopRequireDefault(require("../../../../assets/images/point_icons/WWTP-icon.svg"));
46
+ var _WWTPIcon = _interopRequireDefault(require("../../../../assets/point_icons/WWTP-icon.svg"));
47
47
 
48
- var _factoryIcon = _interopRequireDefault(require("../../../../assets/images/point_icons/factory-icon.svg"));
48
+ var _factoryIcon = _interopRequireDefault(require("../../../../assets/point_icons/factory-icon.svg"));
49
49
 
50
- var _pumpStationIcon = _interopRequireDefault(require("../../../../assets/images/point_icons/pump-station-icon.svg"));
50
+ var _pumpStationIcon = _interopRequireDefault(require("../../../../assets/point_icons/pump-station-icon.svg"));
51
51
 
52
- var _observationIcon = _interopRequireDefault(require("../../../../assets/images/point_icons/observation-icon.svg"));
52
+ var _observationIcon = _interopRequireDefault(require("../../../../assets/point_icons/observation-icon.svg"));
53
53
 
54
- var _samplingIcon = _interopRequireDefault(require("../../../../assets/images/point_icons/sampling-icon.svg"));
54
+ var _samplingIcon = _interopRequireDefault(require("../../../../assets/point_icons/sampling-icon.svg"));
55
55
 
56
56
  var _DamageType = _interopRequireDefault(require("../events/event_info/damage_type/DamageType"));
57
57
 
package/lib/index.js CHANGED
@@ -9,16 +9,80 @@ exports.KandoRouter = void 0;
9
9
 
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
 
12
- var _reactRedux = require("react-redux");
13
-
14
- var _reactRouterDom = require("react-router-dom");
12
+ var _jquery = _interopRequireDefault(require("jquery"));
15
13
 
16
14
  var _Router = _interopRequireDefault(require("./Router"));
17
15
 
16
+ var _reactRouterDom = require("react-router-dom");
17
+
18
18
  var _ErrorBoundary = _interopRequireDefault(require("./shared/utilities/ErrorBoundary"));
19
19
 
20
20
  var _rootStore = _interopRequireDefault(require("./shared/redux/rootStore"));
21
21
 
22
+ var _reactRedux = require("react-redux");
23
+
24
+ var _actioncable = _interopRequireDefault(require("actioncable"));
25
+
26
+ var CABLE_URL = 'ws://dev.kando.eco/cable';
27
+ window.KandoCable = {};
28
+
29
+ var _cable,
30
+ subscriptions = {};
31
+
32
+ function cable() {
33
+ if (!_cable) {
34
+ _cable = _actioncable.default.createConsumer();
35
+ }
36
+
37
+ return _cable;
38
+ }
39
+
40
+ _jquery.default.extend(window.KandoCable, {
41
+ cableConsumer: {
42
+ listeners: {},
43
+ subscribe: function subscribe(channel, options) {
44
+ if (!options) options = {};
45
+ if (_jquery.default.isFunction(options)) options = {
46
+ received: options
47
+ };
48
+ var received_cb = options.received,
49
+ channel_key = JSON.stringify(channel);
50
+
51
+ options.received = function (data) {
52
+ // Call the callback if it was passed in the options
53
+ if (received_cb) received_cb(data); // Custom callback according to type
54
+
55
+ if (data.notification_type && window.KandoCable.cableConsumer.listeners[data.notification_type]) {
56
+ window.KandoCable.cableConsumer.listeners[data.notification_type](data);
57
+ } // Play a sound
58
+
59
+
60
+ if (data.sound) window.KandoCable.playSound(data.sound); // Show a notification
61
+
62
+ if (data.notification) {
63
+ window.KandoCable.showNotification(data.notification);
64
+ } // Trigger cable notify event
65
+
66
+
67
+ (0, _jquery.default)(document.body).trigger('cable_notify.kando', [channel, data]);
68
+ };
69
+
70
+ if (!subscriptions[channel_key]) {
71
+ subscriptions[channel_key] = cable().subscriptions.create(channel, options);
72
+ }
73
+ },
74
+ unsubscribe: function unsubscribe(channel, options) {
75
+ channel_key = JSON.stringify(channel);
76
+ live_channel = subscriptions[channel_key];
77
+
78
+ if (live_channel) {
79
+ cable().subscriptions.remove(live_channel);
80
+ delete subscriptions[channel_key];
81
+ }
82
+ }
83
+ }
84
+ });
85
+
22
86
  var KandoRouter = function KandoRouter(props) {
23
87
  var store = (0, _rootStore.default)(props);
24
88
  return /*#__PURE__*/_react.default.createElement(_ErrorBoundary.default, null, /*#__PURE__*/_react.default.createElement(_reactRedux.Provider, {
@@ -13,7 +13,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
14
  var _templateObject, _templateObject2, _templateObject3;
15
15
 
16
- var Container = _styledComponents.default.button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background-color: #f6004f;\n border-radius: 15.5px;\n padding: 2px;\n display: flex;\n border: none;\n text-align: center;\n &.disabled {\n pointer-events: none;\n background-color: #f4f4f4;\n color: #b2b2b2;\n .active {\n background-color: white;\n color: #b2b2b2;\n pointer-events: none;\n }\n }\n\n &.left-active,\n &.right-active {\n position: relative;\n &::after {\n position: absolute;\n transition: left 0.3s ease-in-out;\n content: '';\n width: calc( 50% - 5px );\n border-radius: 12.5px;\n padding: 7px 20px 6px 21px;\n z-index: 0;\n top: 50%;\n left: 2.5px;\n transform: translateY(-50%);\n height: calc( 100% - 5px );\n background-color: white;\n }\n }\n\n &.right-active {\n &::after {\n left: calc(50% + 3px );\n }\n }\n"])));
16
+ var Container = _styledComponents.default.button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background-color: #f6004f;\n border-radius: 15.5px;\n padding: 2px;\n display: flex;\n border: none;\n text-align: center;\n &.disabled {\n pointer-events: none;\n background-color: #f4f4f4;\n color: #b2b2b2;\n .active {\n background-color: white;\n color: #b2b2b2;\n pointer-events: none;\n }\n }\n\n &.left-active,\n &.right-active {\n position: relative;\n &::after {\n position: absolute;\n transition: left 0.3s ease-in-out, width 0.3s ease-in-out;\n content: '';\n width: 102px;\n border-radius: 12.5px;\n padding: 7px 20px 6px 21px;\n z-index: 0;\n top: 3px;\n left: 3px;\n height: calc( 100% - 6px );\n background-color: white;\n }\n }\n\n &.right-active {\n &::after {\n width: 114px;\n left: 102px;\n }\n }\n"])));
17
17
 
18
18
  exports.Container = Container;
19
19
 
@@ -76,7 +76,7 @@ var KandoModal = function KandoModal(_ref) {
76
76
  value = _Object$entries$_i[1];
77
77
 
78
78
  queryURL.set(param, value);
79
- window.history.replaceState({}, '', "".concat(location.pathname, "?").concat(queryURL));
79
+ window.history.replaceState({}, '', "".concat(window.location.pathname, "?").concat(queryURL));
80
80
  }
81
81
  }
82
82
  } // Remove
@@ -90,7 +90,7 @@ var KandoModal = function KandoModal(_ref) {
90
90
  _ = _Object$entries2$_i[1];
91
91
 
92
92
  queryURL.delete(param);
93
- window.history.replaceState({}, '', "".concat(location.pathname, "?").concat(queryURL));
93
+ window.history.replaceState({}, '', "".concat(window.location.pathname, "?").concat(queryURL));
94
94
  }
95
95
  }
96
96
  }
@@ -41,7 +41,9 @@ var Map = function Map(_ref) {
41
41
  var geoLocation = geo || TEL_AVIV;
42
42
 
43
43
  var initializeMap = function initializeMap() {
44
+ // @ts-ignore
44
45
  mapRef.current = (0, _leaflet.map)("map", {
46
+ // @ts-ignore
45
47
  center: geoLocation,
46
48
  zoomSnap: 1,
47
49
  zoom: mapZoomLevel,
@@ -53,7 +55,8 @@ var Map = function Map(_ref) {
53
55
  tileSize: 512,
54
56
  zoomOffset: -1
55
57
  })]
56
- });
58
+ }); // @ts-ignore
59
+
57
60
  (0, _leaflet.marker)(geoLocation).addTo(mapRef.current); // @ts-ignore
58
61
 
59
62
  mapRef.current.whenReady(function () {
@@ -11,7 +11,9 @@ exports.Select = void 0;
11
11
 
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
 
14
- var _react = _interopRequireDefault(require("react"));
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
+
16
+ var _react = _interopRequireWildcard(require("react"));
15
17
 
16
18
  var _reactSelect = _interopRequireWildcard(require("react-select"));
17
19
 
@@ -29,14 +31,47 @@ var Select = function Select(_ref) {
29
31
  var options = _ref.options,
30
32
  setValue = _ref.setValue,
31
33
  value = _ref.value,
32
- _ref$defaultValue = _ref.defaultValue,
33
- defaultValue = _ref$defaultValue === void 0 ? "" : _ref$defaultValue;
34
+ _ref$menuWidth = _ref.menuWidth,
35
+ menuWidth = _ref$menuWidth === void 0 ? "100%" : _ref$menuWidth;
34
36
 
35
37
  var onChange = function onChange(e) {
36
38
  return setValue(e);
37
39
  };
38
40
 
39
- return /*#__PURE__*/_react.default.createElement(_reactSelect.default, {
41
+ var _useState = (0, _react.useState)('100%'),
42
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
43
+ width = _useState2[0],
44
+ setWidth = _useState2[1];
45
+
46
+ (0, _react.useEffect)(function () {
47
+ if (selectRef) {
48
+ var div = document.createElement('div');
49
+ div.innerHTML = "<div style=\"font-size:18px; font-weight:700\">".concat(value.label, "</div>");
50
+ var elWIdth = measure(div, function (el) {
51
+ return el.offsetWidth;
52
+ });
53
+ setWidth("".concat(elWIdth + 50, "px"));
54
+ }
55
+ }, [value]);
56
+
57
+ function measure(el, fn) {
58
+ var pV = el.style.visibility,
59
+ pP = el.style.position;
60
+ el.style.visibility = 'hidden';
61
+ el.style.position = 'absolute';
62
+ document.body.appendChild(el);
63
+ var result = fn(el);
64
+ el.parentNode.removeChild(el);
65
+ el.style.visibility = pV;
66
+ el.style.position = pP;
67
+ return result;
68
+ }
69
+
70
+ var selectRef = (0, _react.useRef)(null);
71
+ return /*#__PURE__*/_react.default.createElement("div", {
72
+ style: {},
73
+ ref: selectRef
74
+ }, /*#__PURE__*/_react.default.createElement(_reactSelect.default, {
40
75
  className: "react-select",
41
76
  classNamePrefix: "react-select",
42
77
  label: "asfasf",
@@ -47,12 +82,19 @@ var Select = function Select(_ref) {
47
82
  // Fixes the overlapping problem of the component
48
83
  menu: function menu(provided) {
49
84
  return _objectSpread(_objectSpread({}, provided), {}, {
50
- zIndex: 9999
85
+ zIndex: 9999,
86
+ width: menuWidth
87
+ });
88
+ },
89
+ control: function control(provided) {
90
+ return _objectSpread(_objectSpread({}, provided), {}, {
91
+ width: width,
92
+ transition: 'width 0.3s '
51
93
  });
52
94
  }
53
95
  },
54
96
  options: options
55
- });
97
+ }));
56
98
  };
57
99
 
58
100
  exports.Select = Select;
@@ -4,11 +4,9 @@
4
4
  font-weight: 700;
5
5
  color: #1d1d1d !important;
6
6
 
7
-
8
- &__indicators svg {
9
- transform: rotate(0) ;
10
- transition: all .3s ease;
11
-
7
+ &__indicators svg {
8
+ transform: rotate(0);
9
+ transition: all 0.4s ;
12
10
  }
13
11
  &__menu {
14
12
  font-weight: 400;
@@ -29,18 +27,11 @@
29
27
  border: none !important;
30
28
  box-shadow: none !important;
31
29
 
32
-
33
- &--menu-is-open {
34
-
30
+ &--menu-is-open {
35
31
  .react-select__indicator > svg {
36
- transform: rotate(180deg) ;
37
-
32
+ transform: rotate(180deg);
38
33
  }
39
-
40
-
41
34
  }
42
-
43
-
44
35
  }
45
36
 
46
37
  &__indicator-separator {
@@ -40,5 +40,8 @@ Primary.args = {
40
40
  label: 'Vanilla'
41
41
  }],
42
42
  setValue: function setValue(e) {},
43
- value: 'chocolate'
43
+ value: {
44
+ value: 'chocolate',
45
+ label: 'Chocolate'
46
+ }
44
47
  };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@kando-env/kando-ui",
3
- "version": "1.0.6",
3
+ "version": "1.0.9",
4
4
  "main": "lib/index.js",
5
5
  "author": "Nadav(Private) <nadavk72@gmail.com>",
6
6
  "license": "UNLICENSED",
7
7
  "scripts": {
8
- "start": "TSC_COMPILE_ON_ERROR=true react-scripts start",
8
+ "start": "cross-env TSC_COMPILE_ON_ERROR=true react-scripts start",
9
9
  "test": "TSC_COMPILE_ON_ERROR=true react-scripts test",
10
- "build-demo": "TSC_COMPILE_ON_ERROR=true react-scripts build",
10
+ "build-demo": "cross-env TSC_COMPILE_ON_ERROR=true react-scripts build",
11
11
  "serve-demo": "nodemon demo-server.js",
12
12
  "pre-build": "rimraf lib",
13
13
  "babel": "cross-env NODE_ENV=production babel src/bundles --extensions .ts,.tsx,.js,.jsx --out-dir lib --copy-files --ignore __tests__,spec.js,test.js,stories.js,__snapshots__",
@@ -48,6 +48,7 @@
48
48
  "@types/webpack-env": "^1.16.0",
49
49
  "@typescript-eslint/eslint-plugin": "^4.0.0",
50
50
  "@typescript-eslint/parser": "^4.0.0",
51
+ "actioncable": "^5.2.6",
51
52
  "array-to-tree": "^3.3.2",
52
53
  "axios": "^0.21.1",
53
54
  "babel-eslint": "^10.0.0",
@@ -71,7 +72,7 @@
71
72
  "lodash": "^4.17.20",
72
73
  "moment": "^2.27.0",
73
74
  "moment-timezone": "^0.5.33",
74
- "msw-storybook-addon": "^1.1.0",
75
+ "msw-storybook-addon": "^1.2.0",
75
76
  "node-sass": "^6.0.1",
76
77
  "prop-types": "^15.7.2",
77
78
  "react": "^16.13.0",
@@ -114,10 +115,10 @@
114
115
  "@babel/preset-env": "^7.14.7",
115
116
  "@babel/preset-typescript": "^7.14.5",
116
117
  "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
117
- "@storybook/addon-actions": "^6.2.9",
118
- "@storybook/addon-essentials": "^6.2.9",
119
- "@storybook/addon-links": "^6.2.9",
120
- "@storybook/react": "^6.2.9",
118
+ "@storybook/addon-actions": "^6.3.4",
119
+ "@storybook/addon-essentials": "^6.3.4",
120
+ "@storybook/addon-links": "^6.3.4",
121
+ "@storybook/react": "^6.3.4",
121
122
  "@types/leaflet": "^1.7.3",
122
123
  "@types/styled-components": "^5.1.10",
123
124
  "babel-plugin-module-resolver": "^4.1.0",
@@ -1,117 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.PieChart = void 0;
9
-
10
- var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
11
-
12
- var _react = _interopRequireDefault(require("react"));
13
-
14
- var _highcharts = _interopRequireDefault(require("highcharts"));
15
-
16
- var _highchartsReactOfficial = _interopRequireDefault(require("highcharts-react-official"));
17
-
18
- var _highchartsMore = _interopRequireDefault(require("highcharts/highcharts-more"));
19
-
20
- (0, _highchartsMore.default)(_highcharts.default); // impo
21
-
22
- var PieChart = function PieChart(_ref) {
23
- (0, _objectDestructuringEmpty2.default)(_ref);
24
- var config = {
25
- credits: {
26
- enabled: false
27
- },
28
- tooltip: {
29
- enabled: false
30
- },
31
- chart: {
32
- type: 'pie',
33
- // margin: [22, 22, 22, 22],
34
- marginBottom: 30 // spacingTop: 20,
35
- // spacingBottom: 20,
36
- // spacingLeft: 20,
37
- // spacingRight: 20,
38
-
39
- },
40
- title: {
41
- text: '<span style="font-size:20px;font-weight:700;">75%</span> <br> Clear',
42
- align: 'center',
43
- verticalAlign: 'middle',
44
- y: -5,
45
- style: {
46
- fontSize: '14px'
47
- }
48
- },
49
- subtitle: {
50
- text: "75%",
51
- style: {
52
- fontSize: '14px',
53
- fontWeight: 700,
54
- color: '#1d1d1d'
55
- },
56
- align: 'center',
57
- verticalAlign: 'middle',
58
- y: 10
59
- },
60
- legend: {
61
- style: {
62
- fontSize: "10px",
63
- fontWeight: 300
64
- }
65
- },
66
- plotOptions: {
67
- series: {
68
- enableMouseTracking: false,
69
- states: {
70
- hover: {
71
- enabled: false
72
- }
73
- }
74
- },
75
- pie: {
76
- allowPointSelect: false,
77
- dataLabels: {
78
- enabled: false
79
- },
80
- point: {
81
- events: {
82
- enabled: false,
83
- legendItemClick: function legendItemClick() {
84
- return false;
85
- }
86
- }
87
- },
88
- // showInLegend: true,
89
- // borderWidth: 0,
90
- colors: ['#1db232', '#1d1d1d']
91
- }
92
- },
93
- series: [{
94
- animation: false,
95
- innerSize: '85%',
96
- data: [{
97
- name: 'Clear',
98
- y: 75
99
- }, {
100
- name: 'Pollution',
101
- y: 25
102
- }]
103
- }]
104
- };
105
- return /*#__PURE__*/_react.default.createElement(_highchartsReactOfficial.default, {
106
- highcharts: _highcharts.default,
107
- options: config,
108
- containerProps: {
109
- style: {
110
- height: '100%',
111
- width: '100%'
112
- }
113
- }
114
- });
115
- };
116
-
117
- exports.PieChart = PieChart;