@equinor/echo-components 0.2.0 → 0.2.2

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.
@@ -1,21 +1,2 @@
1
1
  /// <reference types="react" />
2
- /**
3
- * Method that returns the relevant Icon for the iconType provided
4
- * Tag icon is the default JSX.Element Icon returned
5
- * @export
6
- * @param {('electrical'
7
- * | 'main Equipment'
8
- * | 'line'
9
- * | 'manual Valve'
10
- * | 'circuit/starter'
11
- * | 'instrument'
12
- * | 'cable'
13
- * | 'function'
14
- * | 'signal'
15
- * | 'telecom'
16
- * | 'junction box'
17
- * | 'administrative'
18
- * | string)} iconType The type of icon you want returned
19
- * @return {*} {JSX.Element} Relevant icon for the provided iconType
20
- */
21
- export declare function getIcon(iconType: 'electrical' | 'main equipment' | 'line' | 'manual valve' | 'circuit/starter' | 'instrument' | 'cable' | 'function' | 'signal' | 'telecom' | 'junction box' | 'administrative' | string): JSX.Element;
2
+ export declare function getIcon(tagCategoryDescription: string): JSX.Element;
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ interface ViewTagIconProps {
3
+ tagCategoryDescription: string;
4
+ }
5
+ export declare enum TagCategoryType {
6
+ Electrical = "electrical",
7
+ MainEquipment = "main equipment",
8
+ Line = "line",
9
+ ManualValve = "manual valve",
10
+ CircuitAndStarter = "circuit",
11
+ Instrument = "instrument",
12
+ Cable = "cable",
13
+ Function = "function",
14
+ Signal = "signal",
15
+ Telecom = "telecom",
16
+ JunctionBox = "junction box",
17
+ Administrative = "administrative"
18
+ }
19
+ /**
20
+ * Method that returns the relevant Icon for the tagCategoryDescription provided
21
+ * Tag icon is the default JSX.Element Icon returned
22
+ * @export
23
+ * @param {('electrical'
24
+ * | 'main equipment'
25
+ * | 'line'
26
+ * | 'manual valve'
27
+ * | 'circuit/starter'
28
+ * | 'instrument'
29
+ * | 'cable'
30
+ * | 'function'
31
+ * | 'signal'
32
+ * | 'telecom'
33
+ * | 'junction box'
34
+ * | 'administrative'
35
+ * @return {*} {JSX.Element} Relevant icon for the provided tagCategoryDescription
36
+ */
37
+ export declare const TagCategoryIcon: React.FC<ViewTagIconProps>;
38
+ export default TagCategoryIcon;
package/dist/index.js CHANGED
@@ -17869,14 +17869,30 @@ function SvgTelecomIcon(props) {
17869
17869
  })))));
17870
17870
  }
17871
17871
 
17872
+ var TagCategoryType;
17873
+
17874
+ (function (TagCategoryType) {
17875
+ TagCategoryType["Electrical"] = "electrical";
17876
+ TagCategoryType["MainEquipment"] = "main equipment";
17877
+ TagCategoryType["Line"] = "line";
17878
+ TagCategoryType["ManualValve"] = "manual valve";
17879
+ TagCategoryType["CircuitAndStarter"] = "circuit";
17880
+ TagCategoryType["Instrument"] = "instrument";
17881
+ TagCategoryType["Cable"] = "cable";
17882
+ TagCategoryType["Function"] = "function";
17883
+ TagCategoryType["Signal"] = "signal";
17884
+ TagCategoryType["Telecom"] = "telecom";
17885
+ TagCategoryType["JunctionBox"] = "junction box";
17886
+ TagCategoryType["Administrative"] = "administrative";
17887
+ })(TagCategoryType || (TagCategoryType = {}));
17872
17888
  /**
17873
- * Method that returns the relevant Icon for the iconType provided
17889
+ * Method that returns the relevant Icon for the tagCategoryDescription provided
17874
17890
  * Tag icon is the default JSX.Element Icon returned
17875
17891
  * @export
17876
17892
  * @param {('electrical'
17877
- * | 'main Equipment'
17893
+ * | 'main equipment'
17878
17894
  * | 'line'
17879
- * | 'manual Valve'
17895
+ * | 'manual valve'
17880
17896
  * | 'circuit/starter'
17881
17897
  * | 'instrument'
17882
17898
  * | 'cable'
@@ -17885,77 +17901,86 @@ function SvgTelecomIcon(props) {
17885
17901
  * | 'telecom'
17886
17902
  * | 'junction box'
17887
17903
  * | 'administrative'
17888
- * | string)} iconType The type of icon you want returned
17889
- * @return {*} {JSX.Element} Relevant icon for the provided iconType
17904
+ * @return {*} {JSX.Element} Relevant icon for the provided tagCategoryDescription
17890
17905
  */
17891
17906
 
17892
- function getIcon(iconType) {
17893
- switch (iconType.toLocaleLowerCase()) {
17894
- case 'electrical':
17907
+
17908
+ var TagCategoryIcon = function TagCategoryIcon(_ref) {
17909
+ var tagCategoryDescription = _ref.tagCategoryDescription;
17910
+ var tagCategory = tagCategoryDescription.toLocaleLowerCase().toString();
17911
+
17912
+ switch (tagCategory.includes(tagCategory)) {
17913
+ case isGivenTagCategory(tagCategory, TagCategoryType.Electrical):
17895
17914
  return /*#__PURE__*/React__default["default"].createElement(SvgElectricalIcon, {
17896
17915
  "aria-label": 'electrical'
17897
17916
  });
17898
17917
 
17899
- case 'main equipment':
17918
+ case isGivenTagCategory(tagCategory, TagCategoryType.MainEquipment):
17900
17919
  return /*#__PURE__*/React__default["default"].createElement(SvgMainEquipmentIcon, {
17901
17920
  "aria-label": 'main equipment'
17902
17921
  });
17903
17922
 
17904
- case 'line':
17923
+ case isGivenTagCategory(tagCategory, TagCategoryType.Line):
17905
17924
  return /*#__PURE__*/React__default["default"].createElement(SvgLineIcon, {
17906
17925
  "aria-label": 'line'
17907
17926
  });
17908
17927
 
17909
- case 'manual valve':
17928
+ case isGivenTagCategory(tagCategory, TagCategoryType.ManualValve):
17910
17929
  return /*#__PURE__*/React__default["default"].createElement(SvgManualValveIcon, {
17911
17930
  "aria-label": 'manual valve'
17912
17931
  });
17913
17932
 
17914
- case 'circuit/starter':
17933
+ case isGivenTagCategory(tagCategory, TagCategoryType.CircuitAndStarter):
17915
17934
  return /*#__PURE__*/React__default["default"].createElement(SvgCircuitIcon, {
17916
17935
  "aria-label": 'circuit/starter'
17917
17936
  });
17918
17937
 
17919
- case 'cable':
17920
- return /*#__PURE__*/React__default["default"].createElement(SvgCableIcon, {
17921
- title: 'cable'
17922
- });
17923
-
17924
- case 'instrument':
17938
+ case isGivenTagCategory(tagCategory, TagCategoryType.Instrument):
17925
17939
  return /*#__PURE__*/React__default["default"].createElement(SvgInstrumentIcon, {
17926
17940
  "aria-label": 'instrument'
17927
17941
  });
17928
17942
 
17929
- case 'function':
17943
+ case isGivenTagCategory(tagCategory, TagCategoryType.Cable):
17944
+ return /*#__PURE__*/React__default["default"].createElement(SvgCableIcon, {
17945
+ title: 'cable'
17946
+ });
17947
+
17948
+ case isGivenTagCategory(tagCategory, TagCategoryType.Function):
17930
17949
  return /*#__PURE__*/React__default["default"].createElement(SvgFunctionIcon, {
17931
17950
  "aria-label": 'function'
17932
17951
  });
17933
17952
 
17934
- case 'signal':
17953
+ case isGivenTagCategory(tagCategory, TagCategoryType.Signal):
17935
17954
  return /*#__PURE__*/React__default["default"].createElement(SvgSignalIcon, {
17936
17955
  "aria-label": 'signal'
17937
17956
  });
17938
17957
 
17939
- case 'telecom':
17958
+ case isGivenTagCategory(tagCategory, TagCategoryType.Telecom):
17940
17959
  return /*#__PURE__*/React__default["default"].createElement(SvgTelecomIcon, {
17941
17960
  "aria-label": 'telecom'
17942
17961
  });
17943
17962
 
17944
- case 'junction box':
17963
+ case isGivenTagCategory(tagCategory, TagCategoryType.JunctionBox):
17945
17964
  return /*#__PURE__*/React__default["default"].createElement(SvgJunctionBoxIcon, {
17946
17965
  "aria-label": 'junction box'
17947
17966
  });
17948
17967
 
17949
- case 'administrative':
17950
- return /*#__PURE__*/React__default["default"].createElement(SvgTagIcon, {
17951
- "aria-label": 'tag'
17952
- });
17953
-
17968
+ case isGivenTagCategory(tagCategory, TagCategoryType.Administrative):
17954
17969
  default:
17955
17970
  return /*#__PURE__*/React__default["default"].createElement(SvgTagIcon, {
17956
17971
  "aria-label": 'tag'
17957
17972
  });
17958
17973
  }
17974
+ };
17975
+
17976
+ function isGivenTagCategory(tagCategoryDescription, tagCategoryType) {
17977
+ return tagCategoryDescription.includes(tagCategoryType);
17978
+ }
17979
+
17980
+ function getIcon(tagCategoryDescription) {
17981
+ return /*#__PURE__*/React__default["default"].createElement(TagCategoryIcon, {
17982
+ tagCategoryDescription: tagCategoryDescription
17983
+ });
17959
17984
  }
17960
17985
 
17961
17986
  var css_248z$9 = ".inlineTagIconLink-module_tagButton__2Ti0i,.inlineTagIconLink-module_tagButtonNoHover__3yk4Z{cursor:pointer;display:flex!important;height:auto;min-height:64px;min-width:215px;padding:.5rem!important;width:100%}.inlineTagIconLink-module_tagButtonNoHover__3yk4Z:hover{background:none!important}.inlineTagIconLink-module_textContainer__1DCNo{flex:1 1 auto;text-align:left}.inlineTagIconLink-module_description__1GfqP{-webkit-line-clamp:2;color:var(--echoText)!important;font-size:10px!important;font-weight:500!important;word-break:break-word}.inlineTagIconLink-module_description__1GfqP,.inlineTagIconLink-module_tag__3EDcb{-webkit-box-orient:vertical;display:-webkit-box;line-height:1em;overflow:hidden;text-overflow:ellipsis}.inlineTagIconLink-module_tag__3EDcb{-webkit-line-clamp:1;word-break:break-all}.inlineTagIconLink-module_icon__2cqbr{border-radius:10rem;box-sizing:border-box;flex:1 1 auto;height:40px;margin-right:.25rem;padding:.5rem;position:relative;width:40px}";
@@ -21289,7 +21314,7 @@ var RadioButtonGroup = function RadioButtonGroup(_ref) {
21289
21314
  })));
21290
21315
  };
21291
21316
 
21292
- var css_248z$5 = ".roundIconButton-module_pageMenuButton__QVKSX{background:#fff;border:1px solid var(--equiGreen1);border-radius:50%;box-shadow:0 4px 4px rgba(0,0,0,.25);box-sizing:border-box;height:56px;padding:14px;width:56px}.roundIconButton-module_pageMenuButton__QVKSX:hover{background-color:var(--equiGreen2);color:var(--hoverIcon)}.roundIconButton-module_pageMenuButton__QVKSX:hover svg{fill:var(--hoverIcon)}.roundIconButton-module_toggleButton__1uJaa{background:var(--toggleInactive);border:1px solid var(--toggleInactive)}.roundIconButton-module_toggleButton__1uJaa:hover{background:rgba(179,13,47,.5);border:1px solid var(--toggleInactive)}.roundIconButton-module_activeButton__3Vw8P{background:var(--equiGreen1);border:2px solid var(--equiGreen1)}.roundIconButton-module_activeButton__3Vw8P.roundIconButton-module_toggleButton__1uJaa{background:var(--toggleActive);border:1px solid var(--toggleActive)}.roundIconButton-module_activeButton__3Vw8P.roundIconButton-module_toggleButton__1uJaa:hover{background:rgba(75,183,72,.5);border:1px solid var(--toggleActive)}";
21317
+ var css_248z$5 = ".roundIconButton-module_pageMenuButton__QVKSX{background:#fff;border:1px solid var(--equiGreen1);border-radius:50%;box-shadow:0 4px 4px rgba(0,0,0,.25);box-sizing:border-box;height:48px;padding:10px;width:48px}.roundIconButton-module_pageMenuButton__QVKSX:hover{background-color:var(--equiGreen2);color:var(--hoverIcon)}.roundIconButton-module_pageMenuButton__QVKSX:hover svg{fill:var(--hoverIcon)}.roundIconButton-module_toggleButton__1uJaa{background:var(--toggleInactive);border:1px solid var(--toggleInactive)}.roundIconButton-module_toggleButton__1uJaa:hover{background:rgba(179,13,47,.5);border:1px solid var(--toggleInactive)}.roundIconButton-module_activeButton__3Vw8P{background:var(--equiGreen1);border:2px solid var(--equiGreen1)}.roundIconButton-module_activeButton__3Vw8P.roundIconButton-module_toggleButton__1uJaa{background:var(--toggleActive);border:1px solid var(--toggleActive)}.roundIconButton-module_activeButton__3Vw8P.roundIconButton-module_toggleButton__1uJaa:hover{background:rgba(75,183,72,.5);border:1px solid var(--toggleActive)}";
21293
21318
  var style = {"pageMenuButton":"roundIconButton-module_pageMenuButton__QVKSX","toggleButton":"roundIconButton-module_toggleButton__1uJaa","activeButton":"roundIconButton-module_activeButton__3Vw8P"};
21294
21319
  styleInject(css_248z$5);
21295
21320
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-components",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Package for creating echo related components.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",