orcs-design-system 2.0.70 → 2.0.71

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,6 +1,7 @@
1
1
  import React from "react";
2
2
  import Tag from ".";
3
3
  import Flex from "../Flex";
4
+ import Spacer from "../Spacer";
4
5
  import mdx from "./Tag.mdx";
5
6
  export default {
6
7
  title: "Components/Tag",
@@ -12,7 +13,7 @@ export default {
12
13
  },
13
14
  decorators: [function (storyFn) {
14
15
  return /*#__PURE__*/React.createElement(Flex, {
15
- center: true
16
+ flexWrap: "wrap"
16
17
  }, storyFn());
17
18
  }]
18
19
  };
@@ -21,23 +22,67 @@ export var defaultTag = function defaultTag() {
21
22
  };
22
23
  defaultTag.storyName = "Default";
23
24
  export var selected = function selected() {
24
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tag, {
25
+ return /*#__PURE__*/React.createElement(Spacer, {
26
+ m: "2px"
27
+ }, /*#__PURE__*/React.createElement(Tag, {
25
28
  selected: true
26
29
  }, "devops"), /*#__PURE__*/React.createElement(Tag, {
27
30
  selected: true
28
31
  }, "software engineering"), /*#__PURE__*/React.createElement(Tag, null, "product design"), /*#__PURE__*/React.createElement(Tag, null, "digital transformation"));
29
32
  };
30
- export var noCross = function noCross() {
31
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tag, {
33
+ export var showEdit = function showEdit() {
34
+ return /*#__PURE__*/React.createElement(Spacer, {
35
+ m: "2px"
36
+ }, /*#__PURE__*/React.createElement(Tag, {
32
37
  selected: true,
33
- hideCross: true
38
+ showEdit: true
34
39
  }, "devops"), /*#__PURE__*/React.createElement(Tag, {
35
40
  selected: true,
36
- hideCross: true
37
- }, "software engineering"), /*#__PURE__*/React.createElement(Tag, null, "product design"), /*#__PURE__*/React.createElement(Tag, null, "digital transformation"));
41
+ showEdit: true
42
+ }, "software engineering"), /*#__PURE__*/React.createElement(Tag, {
43
+ showEdit: true
44
+ }, "product design"), /*#__PURE__*/React.createElement(Tag, {
45
+ showEdit: true
46
+ }, "digital transformation"));
47
+ };
48
+ export var showRemove = function showRemove() {
49
+ return /*#__PURE__*/React.createElement(Spacer, {
50
+ m: "2px"
51
+ }, /*#__PURE__*/React.createElement(Tag, {
52
+ selected: true,
53
+ showRemove: true
54
+ }, "devops"), /*#__PURE__*/React.createElement(Tag, {
55
+ selected: true,
56
+ showRemove: true
57
+ }, "software engineering"), /*#__PURE__*/React.createElement(Tag, {
58
+ showRemove: true
59
+ }, "product design"), /*#__PURE__*/React.createElement(Tag, {
60
+ showRemove: true
61
+ }, "digital transformation"));
62
+ };
63
+ export var showEditAndRemove = function showEditAndRemove() {
64
+ return /*#__PURE__*/React.createElement(Spacer, {
65
+ m: "2px"
66
+ }, /*#__PURE__*/React.createElement(Tag, {
67
+ selected: true,
68
+ showEdit: true,
69
+ showRemove: true
70
+ }, "devops"), /*#__PURE__*/React.createElement(Tag, {
71
+ selected: true,
72
+ showEdit: true,
73
+ showRemove: true
74
+ }, "software engineering"), /*#__PURE__*/React.createElement(Tag, {
75
+ showEdit: true,
76
+ showRemove: true
77
+ }, "product design"), /*#__PURE__*/React.createElement(Tag, {
78
+ showEdit: true,
79
+ showRemove: true
80
+ }, "digital transformation"));
38
81
  };
39
82
  export var disabled = function disabled() {
40
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tag, {
83
+ return /*#__PURE__*/React.createElement(Spacer, {
84
+ m: "2px"
85
+ }, /*#__PURE__*/React.createElement(Tag, {
41
86
  disabled: true
42
87
  }, "devops"), /*#__PURE__*/React.createElement(Tag, {
43
88
  disabled: true
@@ -47,6 +92,42 @@ export var disabled = function disabled() {
47
92
  disabled: true
48
93
  }, "digital transformation"));
49
94
  };
95
+ export var withTagType = function withTagType() {
96
+ return /*#__PURE__*/React.createElement(Spacer, {
97
+ m: "2px"
98
+ }, /*#__PURE__*/React.createElement(Tag, {
99
+ tagType: "skill"
100
+ }, "devops"), /*#__PURE__*/React.createElement(Tag, {
101
+ tagType: "skill",
102
+ showRemove: true
103
+ }, "devops"), /*#__PURE__*/React.createElement(Tag, {
104
+ tagType: "skill",
105
+ showEdit: true
106
+ }, "devops"), /*#__PURE__*/React.createElement(Tag, {
107
+ tagType: "skill",
108
+ showRemove: true,
109
+ showEdit: true
110
+ }, "devops"), /*#__PURE__*/React.createElement(Tag, {
111
+ selected: true,
112
+ tagType: "skill"
113
+ }, "javascript"), /*#__PURE__*/React.createElement(Tag, {
114
+ selected: true,
115
+ showRemove: true,
116
+ tagType: "skill"
117
+ }, "javascript"), /*#__PURE__*/React.createElement(Tag, {
118
+ selected: true,
119
+ showEdit: true,
120
+ tagType: "skill"
121
+ }, "javascript"), /*#__PURE__*/React.createElement(Tag, {
122
+ selected: true,
123
+ showRemove: true,
124
+ showEdit: true,
125
+ tagType: "skill"
126
+ }, "javascript"), /*#__PURE__*/React.createElement(Tag, {
127
+ disabled: true,
128
+ tagType: "skill"
129
+ }, "product design"));
130
+ };
50
131
  defaultTag.__docgenInfo = {
51
132
  "description": "",
52
133
  "methods": [],
@@ -57,13 +138,28 @@ selected.__docgenInfo = {
57
138
  "methods": [],
58
139
  "displayName": "selected"
59
140
  };
60
- noCross.__docgenInfo = {
141
+ showEdit.__docgenInfo = {
61
142
  "description": "",
62
143
  "methods": [],
63
- "displayName": "noCross"
144
+ "displayName": "showEdit"
145
+ };
146
+ showRemove.__docgenInfo = {
147
+ "description": "",
148
+ "methods": [],
149
+ "displayName": "showRemove"
150
+ };
151
+ showEditAndRemove.__docgenInfo = {
152
+ "description": "",
153
+ "methods": [],
154
+ "displayName": "showEditAndRemove"
64
155
  };
65
156
  disabled.__docgenInfo = {
66
157
  "description": "",
67
158
  "methods": [],
68
159
  "displayName": "disabled"
160
+ };
161
+ withTagType.__docgenInfo = {
162
+ "description": "",
163
+ "methods": [],
164
+ "displayName": "withTagType"
69
165
  };
@@ -1,38 +1,66 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
2
  import React from "react";
4
3
  import styled, { css, ThemeProvider } from "styled-components";
5
4
  import PropTypes from "prop-types";
6
5
  import systemtheme from "../../systemtheme";
7
6
  import { space, layout } from "styled-system";
7
+ import Icon from "../Icon";
8
8
  import { themeGet } from "@styled-system/theme-get";
9
- var TagWrapper = styled.button.withConfig({
9
+ var TagWrapper = styled.div.withConfig({
10
10
  displayName: "Tag__TagWrapper",
11
11
  componentId: "sc-1dh2aa8-0"
12
- })(["", " ", " -moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;display:block;border-radius:13px;font-size:1.4rem;font-weight:600;margin:3px;white-space:nowrap;position:relative;transition:", ";cursor:", ";border:solid 1px ", ";padding:", ";background:", ";color:", ";", " &:focus{outline:0;box-shadow:", ";}", ""], space, layout, themeGet("transition.transitionDefault"), function (props) {
12
+ })(["", " ", " display:flex;align-items:center;justify-content:center;"], space, layout);
13
+ var TagValue = styled.button.withConfig({
14
+ displayName: "Tag__TagValue",
15
+ componentId: "sc-1dh2aa8-1"
16
+ })(["-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;display:flex;align-items:center;flex-wrap:nowrap;font-size:1.4rem;font-weight:600;white-space:nowrap;position:relative;z-index:1;transition:", ";cursor:", ";border-radius:", ";border:solid 1px ", ";padding:", ";background-color:", ";color:", ";", " &:focus{outline:0;z-index:2;box-shadow:", ";}"], themeGet("transition.transitionDefault"), function (props) {
13
17
  return props.disabled ? "default" : "pointer";
18
+ }, function (props) {
19
+ return props.showEdit || props.showRemove ? "15px 0 0 15px" : "15px";
14
20
  }, function (props) {
15
21
  return props.disabled ? themeGet("colors.greyDark") : themeGet("colors.primary");
16
22
  }, function (props) {
17
- return props.hideCross ? "3px 12px 4px 12px;" : props.selected ? "3px 25px 4px 12px;" : "3px 12px 4px 12px;";
23
+ return props.showEdit || props.showRemove ? "3px 6px 4px 12px" : "3px 12px 4px 12px";
18
24
  }, function (props) {
19
25
  return props.selected ? themeGet("colors.primary") : props.disabled ? themeGet("colors.greyDark") : themeGet("colors.white");
20
26
  }, function (props) {
21
27
  return props.selected ? themeGet("colors.white") : props.disabled ? themeGet("colors.white") : themeGet("colors.primary");
22
28
  }, function (props) {
23
- return props.disabled ? css([""]) : css(["&:hover{border:solid 1px ", ";color:", ";background:", ";}"], themeGet("colors.primaryDark"), function (props) {
29
+ return props.disabled ? css([""]) : css(["&:hover{border:solid 1px ", ";color:", ";background-color:", ";div{color:", ";}}"], themeGet("colors.primaryDark"), function (props) {
24
30
  return props.selected ? themeGet("colors.white") : themeGet("colors.primaryDark");
25
31
  }, function (props) {
26
32
  return props.selected ? themeGet("colors.primaryDark") : themeGet("colors.white");
33
+ }, function (props) {
34
+ return props.selected ? themeGet("colors.white") : themeGet("colors.primaryDark");
27
35
  });
28
36
  }, function (props) {
29
37
  return themeGet("shadows.thinOutline")(props) + " " + themeGet("colors.primary30")(props);
38
+ });
39
+ var TagEdit = styled(TagValue).withConfig({
40
+ displayName: "Tag__TagEdit",
41
+ componentId: "sc-1dh2aa8-2"
42
+ })(["border-radius:", ";padding:2px 10px 5px 10px;&:focus{z-index:2;box-shadow:-0.5px 0 0 3.5px ", ";}", ""], function (props) {
43
+ return props.showRemove ? "0" : "0 15px 15px 0";
44
+ }, themeGet("colors.primary30"), function (props) {
45
+ return props.selected ? css(["border-left:solid 1px ", ";&:hover{border-left:solid 1px ", ";}&:focus{box-shadow:", ";}"], themeGet("colors.primaryDark"), themeGet("colors.primaryDark"), function (props) {
46
+ return themeGet("shadows.thinOutline")(props) + " " + themeGet("colors.primary30")(props);
47
+ }) : css(["border-left:0;&:hover{border-left:0;}"]);
48
+ });
49
+ var TagRemove = styled(TagValue).withConfig({
50
+ displayName: "Tag__TagRemove",
51
+ componentId: "sc-1dh2aa8-3"
52
+ })(["border-radius:0 15px 15px 0;padding:2px 12px 5px 12px;&:focus{z-index:2;box-shadow:-0.5px 0 0 3.5px ", ";}", ""], themeGet("colors.primary30"), function (props) {
53
+ return props.selected ? css(["border-left:solid 1px ", ";&:hover{border-left:solid 1px ", ";}&:focus{box-shadow:", ";}"], themeGet("colors.primaryDark"), themeGet("colors.primaryDark"), function (props) {
54
+ return themeGet("shadows.thinOutline")(props) + " " + themeGet("colors.primary30")(props);
55
+ }) : css(["border-left:0;&:hover{border-left:0;}"]);
56
+ });
57
+ var TagType = styled.div.withConfig({
58
+ displayName: "Tag__TagType",
59
+ componentId: "sc-1dh2aa8-4"
60
+ })(["text-transform:uppercase;margin-left:", ";padding:3px;line-height:1;border-radius:", ";font-size:", ";background-color:", ";color:", ";"], themeGet("space.s"), themeGet("radii.1"), themeGet("fontSizes.0"), function (props) {
61
+ return props.selected ? themeGet("colors.primaryDark") : props.disabled ? themeGet("colors.greyDarker") : themeGet("colors.primaryLightest");
30
62
  }, function (props) {
31
- return props.hideCross ? css([""]) : css(["&::after{content:\"+\";display:block;position:absolute;right:7px;top:1px;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;font-size:1.8rem;font-weight:600;transform-origin:50% 50%;color:", ";transition:", ";opacity:", ";transform:", ";}"], themeGet("colors.white"), themeGet("transition.transitionDefault"), function (props) {
32
- return props.selected ? 1 : 0;
33
- }, function (props) {
34
- return props.selected ? "rotate(45deg) scale(1)" : "rotate(45deg) scale(0)";
35
- });
63
+ return props.selected ? themeGet("colors.white") : props.disabled ? themeGet("colors.white") : themeGet("colors.primary");
36
64
  });
37
65
  /**
38
66
  * The top two rows are an example of how tags should be used when they are selectable/unselectable. There is the option to display the cross icon or not.
@@ -43,35 +71,62 @@ var TagWrapper = styled.button.withConfig({
43
71
  export default function Tag(_ref) {
44
72
  var selected = _ref.selected,
45
73
  disabled = _ref.disabled,
46
- hideCross = _ref.hideCross,
74
+ showRemove = _ref.showRemove,
47
75
  theme = _ref.theme,
48
- props = _objectWithoutProperties(_ref, ["selected", "disabled", "hideCross", "theme"]);
76
+ tagType = _ref.tagType,
77
+ showEdit = _ref.showEdit,
78
+ children = _ref.children,
79
+ props = _objectWithoutProperties(_ref, ["selected", "disabled", "showRemove", "theme", "tagType", "showEdit", "children"]);
49
80
 
50
81
  return /*#__PURE__*/React.createElement(ThemeProvider, {
51
82
  theme: theme
52
- }, /*#__PURE__*/React.createElement(TagWrapper, _extends({
83
+ }, /*#__PURE__*/React.createElement(TagWrapper, props, /*#__PURE__*/React.createElement(TagValue, {
84
+ selected: selected,
85
+ disabled: disabled,
86
+ showEdit: showEdit,
87
+ showRemove: showRemove
88
+ }, children, tagType ? /*#__PURE__*/React.createElement(TagType, {
89
+ selected: selected,
90
+ disabled: disabled
91
+ }, tagType) : null), showEdit ? /*#__PURE__*/React.createElement(TagEdit, {
53
92
  selected: selected,
54
93
  disabled: disabled,
55
- hideCross: hideCross
56
- }, props)));
94
+ showRemove: showRemove
95
+ }, /*#__PURE__*/React.createElement(Icon, {
96
+ icon: ["fas", "pen"],
97
+ size: "xs"
98
+ })) : null, showRemove ? /*#__PURE__*/React.createElement(TagRemove, {
99
+ selected: selected,
100
+ disabled: disabled
101
+ }, /*#__PURE__*/React.createElement(Icon, {
102
+ icon: ["fas", "times"],
103
+ size: "xs"
104
+ })) : null));
57
105
  }
58
106
  Tag.propTypes = {
59
107
  /** Adds selected styling to tag */
60
108
  selected: PropTypes.bool,
61
109
 
110
+ /** Shows the remove button */
111
+ showRemove: PropTypes.bool,
112
+
113
+ /** Shows edit button */
114
+ showEdit: PropTypes.bool,
115
+
116
+ /** Can add a type to a tag as text */
117
+ tagType: PropTypes.string,
118
+
62
119
  /** Adds disabled attribute and styling to tag */
63
120
  disabled: PropTypes.bool,
64
121
 
65
- /** Hides the cross icon */
66
- hideCross: PropTypes.bool,
67
-
68
122
  /** Specifies the design theme */
69
123
  theme: PropTypes.object
70
124
  };
71
125
  Tag.defaultProps = {
72
126
  selected: false,
73
127
  disabled: false,
74
- hideCross: false,
128
+ showEdit: false,
129
+ showRemove: false,
75
130
  theme: systemtheme
76
131
  };
77
132
  Tag.__docgenInfo = {
@@ -101,7 +156,7 @@ Tag.__docgenInfo = {
101
156
  "required": false,
102
157
  "description": "Adds disabled attribute and styling to tag"
103
158
  },
104
- "hideCross": {
159
+ "showEdit": {
105
160
  "defaultValue": {
106
161
  "value": "false",
107
162
  "computed": false
@@ -110,7 +165,18 @@ Tag.__docgenInfo = {
110
165
  "name": "bool"
111
166
  },
112
167
  "required": false,
113
- "description": "Hides the cross icon"
168
+ "description": "Shows edit button"
169
+ },
170
+ "showRemove": {
171
+ "defaultValue": {
172
+ "value": "false",
173
+ "computed": false
174
+ },
175
+ "type": {
176
+ "name": "bool"
177
+ },
178
+ "required": false,
179
+ "description": "Shows the remove button"
114
180
  },
115
181
  "theme": {
116
182
  "defaultValue": {
@@ -122,6 +188,13 @@ Tag.__docgenInfo = {
122
188
  },
123
189
  "required": false,
124
190
  "description": "Specifies the design theme"
191
+ },
192
+ "tagType": {
193
+ "type": {
194
+ "name": "string"
195
+ },
196
+ "required": false,
197
+ "description": "Can add a type to a tag as text"
125
198
  }
126
199
  }
127
200
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "2.0.70",
3
+ "version": "2.0.71",
4
4
  "description": "Orchestrated's Design System, aka: ORCS",
5
5
  "keywords": [
6
6
  "design",