@decisiv/ui-components 2.0.1-alpha.154 → 2.0.1-alpha.155

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.
@@ -0,0 +1,4 @@
1
+ declare const Action: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const ActionContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export default Action;
4
+ //# sourceMappingURL=Action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/Action.tsx"],"names":[],"mappings":"AAgBA,QAAA,MAAM,MAAM,oEAcX,CAAC;AAEF,eAAO,MAAM,eAAe,oEAO3B,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.ActionContainer = void 0;
7
+
8
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
+
10
+ var _toColorString = _interopRequireDefault(require("polished/lib/color/toColorString"));
11
+
12
+ var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
13
+
14
+ var _designTokens = _interopRequireDefault(require("@decisiv/design-tokens"));
15
+
16
+ var _constants = require("./constants");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
21
+
22
+ var _designTokens$color = _designTokens.default.color,
23
+ baseColors = _designTokens$color.base,
24
+ interactionColors = _designTokens$color.interaction;
25
+ var borderRadius = (0, _styledComponents.css)(["border-radius:0 ", " ", " 0;"], (0, _rem.default)(10), (0, _rem.default)(10));
26
+
27
+ var Action = _styledComponents.default.div.withConfig({
28
+ displayName: "Action",
29
+ componentId: "sc-53eucd-0"
30
+ })(["align-items:center;appearance:none;background-color:", ";border:0;color:", ";display:flex;height:100%;justify-content:flex-start;padding:0 0 0 ", ";width:", ";outline:none;", ""], (0, _toColorString.default)(baseColors.snowWhite), (0, _toColorString.default)(interactionColors.pacificOcean), (0, _rem.default)(4), (0, _rem.default)(_constants.ACTION_WIDTH), borderRadius);
31
+
32
+ var ActionContainer = _styledComponents.default.div.withConfig({
33
+ displayName: "Action__ActionContainer",
34
+ componentId: "sc-53eucd-1"
35
+ })(["height:", ";margin-right:2px;background-color:", ";box-shadow:", " 0 0 0 ", ";", ";"], (0, _rem.default)(18), (0, _toColorString.default)(baseColors.snowWhite), (0, _rem.default)(2), (0, _toColorString.default)(baseColors.snowWhite), borderRadius);
36
+
37
+ exports.ActionContainer = ActionContainer;
38
+ var _default = Action;
39
+ exports.default = _default;
@@ -1,4 +1,4 @@
1
- export declare const ACTION_BUTTON_WIDTH = 22;
1
+ export declare const ACTION_WIDTH = 20;
2
2
  export declare const CONTAINER_X_PADDING = 14;
3
3
  export declare const ICON_CONTENT_MARGIN = 5;
4
4
  export declare const MAX_CONTAINER_WIDTH = 300;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,mBAAmB,MAAM,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,mBAAmB,MAAM,CAAC"}
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.MAX_CONTAINER_WIDTH = exports.ICON_CONTENT_MARGIN = exports.CONTAINER_X_PADDING = exports.ACTION_BUTTON_WIDTH = void 0;
7
- var ACTION_BUTTON_WIDTH = 22;
8
- exports.ACTION_BUTTON_WIDTH = ACTION_BUTTON_WIDTH;
6
+ exports.MAX_CONTAINER_WIDTH = exports.ICON_CONTENT_MARGIN = exports.CONTAINER_X_PADDING = exports.ACTION_WIDTH = void 0;
7
+ var ACTION_WIDTH = 20;
8
+ exports.ACTION_WIDTH = ACTION_WIDTH;
9
9
  var CONTAINER_X_PADDING = 14;
10
10
  exports.CONTAINER_X_PADDING = CONTAINER_X_PADDING;
11
11
  var ICON_CONTENT_MARGIN = 5;
@@ -1,7 +1,7 @@
1
1
  import { RefForwardingComponent } from 'react';
2
2
  import { CommonUIColors } from '../../utils/commonUIColors';
3
3
  import { TagProps, TagRef } from './types';
4
- export { TagProps, TagRef, TagActionButtonRef } from './types';
4
+ export { TagProps, TagRef, TagActionRef as TagActionButtonRef } from './types';
5
5
  export declare type ColorKeys = keyof CommonUIColors;
6
6
  declare const TagWithRef: RefForwardingComponent<TagRef, TagProps>;
7
7
  export default TagWithRef;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/index.tsx"],"names":[],"mappings":"AAEA,OAAc,EAIZ,sBAAsB,EAIvB,MAAM,OAAO,CAAC;AAMf,OAAO,EAAkB,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAY5E,OAAO,EAA4B,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAErE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE/D,oBAAY,SAAS,GAAG,MAAM,cAAc,CAAC;AA6L7C,QAAA,MAAM,UAAU,EAAE,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAmB,CAAC;AAS7E,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/index.tsx"],"names":[],"mappings":"AAEA,OAAc,EAIZ,sBAAsB,EAIvB,MAAM,OAAO,CAAC;AAQf,OAAO,EAGL,cAAc,EACf,MAAM,4BAA4B,CAAC;AAapC,OAAO,EAGL,QAAQ,EACR,MAAM,EAEP,MAAM,SAAS,CAAC;AAQjB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE/E,oBAAY,SAAS,GAAG,MAAM,cAAc,CAAC;AAkT7C,QAAA,MAAM,UAAU,EAAE,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAmB,CAAC;AAS7E,eAAe,UAAU,CAAC"}
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "TagRef", {
18
18
  Object.defineProperty(exports, "TagActionButtonRef", {
19
19
  enumerable: true,
20
20
  get: function get() {
21
- return _types.TagActionButtonRef;
21
+ return _types.TagActionRef;
22
22
  }
23
23
  });
24
24
  exports.default = void 0;
@@ -31,15 +31,17 @@ var _react = _interopRequireWildcard(require("react"));
31
31
 
32
32
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
33
33
 
34
- var _designTokens = require("@decisiv/design-tokens");
34
+ var _designTokens = _interopRequireWildcard(require("@decisiv/design-tokens"));
35
35
 
36
36
  var _color = _interopRequireDefault(require("../../modifiers/color"));
37
37
 
38
+ var _focusRingWithColor = _interopRequireDefault(require("../../utils/focusRingWithColor"));
39
+
38
40
  var _commonUIColors = require("../../utils/commonUIColors");
39
41
 
40
42
  var _Typography = require("../Typography");
41
43
 
42
- var _ActionButton = _interopRequireWildcard(require("./ActionButton"));
44
+ var _Action = _interopRequireWildcard(require("./Action"));
43
45
 
44
46
  var _constants = require("./constants");
45
47
 
@@ -47,6 +49,10 @@ var _propTypes = require("./propTypes");
47
49
 
48
50
  var _types = require("./types");
49
51
 
52
+ var _BaseButton = _interopRequireDefault(require("../../atoms/BaseButton"));
53
+
54
+ var _styleModifiers = require("../../utils/styleModifiers");
55
+
50
56
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
51
57
 
52
58
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -71,7 +77,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
71
77
 
72
78
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
73
79
 
74
- var borderColor = (0, _toColorString.default)(_designTokens.color.opacity.charcoal15);
80
+ var _designTokens$color = _designTokens.default.color,
81
+ interactionColors = _designTokens$color.interaction,
82
+ statusColors = _designTokens$color.status;
75
83
 
76
84
  var getContentMaxWidth = function getContentMaxWidth(props) {
77
85
  var isSingleChild = props.isSingleChild,
@@ -81,27 +89,43 @@ var getContentMaxWidth = function getContentMaxWidth(props) {
81
89
  var containerBorder = 2;
82
90
  var baseWidth = _constants.MAX_CONTAINER_WIDTH - _constants.CONTAINER_X_PADDING - containerBorder;
83
91
  var valuesToSubtract = [];
84
- !isSingleChild && valuesToSubtract.push(_constants.ACTION_BUTTON_WIDTH, actionBorder);
92
+ !isSingleChild && valuesToSubtract.push(_constants.ACTION_WIDTH, actionBorder);
85
93
  hasIcon && valuesToSubtract.push(iconWidth, _constants.ICON_CONTENT_MARGIN);
86
94
  return (0, _rem.default)(valuesToSubtract.reduce(function (r, v) {
87
95
  return r - v;
88
96
  }, baseWidth));
89
97
  };
90
98
 
91
- var colorModifiers = function colorModifiers(_ref) {
92
- var variant = _ref.variant,
93
- colorProp = _ref.color;
94
- return variant === 'outline' ? (0, _color.default)(_objectSpread({}, _designTokens.color.base.snowWhite, {
95
- fg: _designTokens.color.base.alaskanHusky
96
- })) : (0, _color.default)(colorProp && colorProp in _commonUIColors.commonUIColors ? _commonUIColors.commonUIColors[colorProp] : _commonUIColors.commonUIColors.licoriceMousse);
99
+ var PALETTE_MAPPER = {
100
+ pastel: 'light',
101
+ bright: 'medium',
102
+ dark: 'dark'
103
+ };
104
+ var FG_COLOR = {
105
+ pastel: _objectSpread({}, _designTokens.color.base.charcoal, {
106
+ alpha: 0.8
107
+ }),
108
+ bright: _designTokens.color.base.snowWhite,
109
+ dark: _designTokens.color.base.snowWhite
110
+ };
111
+ var BORDER_OPACITY = {
112
+ pastel: 0.1,
113
+ bright: 0.15,
114
+ dark: 0.3
97
115
  };
98
116
 
99
117
  var Content = _styledComponents.default.div.withConfig({
100
118
  displayName: "Tag__Content",
101
119
  componentId: "nifm8a-0"
102
- })(["align-items:center;border:0;display:flex;padding:0 ", ";", ";> svg{flex:1 0 auto;}* + *{margin-left:", ";}span{max-width:", ";}"], (0, _rem.default)(_constants.CONTAINER_X_PADDING / 2), function (_ref2) {
120
+ })(["color:inherit;align-items:center;border:0;display:flex;padding:0 ", ";border-right:1px solid ", ";", ";> svg{flex:1 0 auto;}* + *{margin-left:", ";}span{max-width:", ";}"], (0, _rem.default)(_constants.CONTAINER_X_PADDING / 2), function (_ref) {
121
+ var _ref$palette = _ref.palette,
122
+ palette = _ref$palette === void 0 ? 'bright' : _ref$palette;
123
+ return (0, _toColorString.default)(_objectSpread({}, _designTokens.color.base.charcoal, {
124
+ alpha: BORDER_OPACITY[palette]
125
+ }));
126
+ }, function (_ref2) {
103
127
  var isSingleChild = _ref2.isSingleChild;
104
- return (0, _styledComponents.css)(["max-width:", ";"], isSingleChild ? '100%' : "calc(100% - ".concat(_constants.ACTION_BUTTON_WIDTH, "px)"));
128
+ return (0, _styledComponents.css)(["max-width:", ";border-width:", ";"], isSingleChild ? '100%' : "calc(100% - ".concat(_constants.ACTION_WIDTH, "px)"), isSingleChild ? '0' : '1px');
105
129
  }, (0, _rem.default)(_constants.ICON_CONTENT_MARGIN), getContentMaxWidth);
106
130
 
107
131
  var contentSVGColor = function contentSVGColor(_ref3) {
@@ -115,10 +139,61 @@ var contentSVGColor = function contentSVGColor(_ref3) {
115
139
  return null;
116
140
  };
117
141
 
118
- var Container = _styledComponents.default.div.withConfig({
142
+ var getColorByProps = function getColorByProps(_ref4) {
143
+ var variant = _ref4.variant,
144
+ colorProp = _ref4.color,
145
+ _ref4$palette = _ref4.palette,
146
+ palette = _ref4$palette === void 0 ? 'bright' : _ref4$palette;
147
+ if (variant === 'outline') return _objectSpread({}, _designTokens.color.base.snowWhite, {
148
+ fg: _designTokens.color.base.alaskanHusky
149
+ });
150
+
151
+ if (colorProp && colorProp in _commonUIColors.commonUIThreeShadeColors) {
152
+ var baseColor = _commonUIColors.commonUIThreeShadeColors[colorProp];
153
+ var fgColor = FG_COLOR[palette];
154
+ var bgColor = baseColor[PALETTE_MAPPER[palette]];
155
+ return palette === 'bright' ? bgColor : _objectSpread({}, bgColor, {
156
+ fg: fgColor
157
+ });
158
+ }
159
+
160
+ return _commonUIColors.commonUIColors.licoriceMousse;
161
+ };
162
+
163
+ var colorModifiers = function colorModifiers(props) {
164
+ var _props$palette = props.palette,
165
+ palette = _props$palette === void 0 ? 'bright' : _props$palette;
166
+
167
+ var borderColor = _objectSpread({}, _designTokens.color.base.charcoal, {
168
+ alpha: BORDER_OPACITY[palette]
169
+ });
170
+
171
+ return (0, _styledComponents.css)(["", ";border:1px solid ", ";", ""], (0, _color.default)(getColorByProps(props)), (0, _toColorString.default)(borderColor), (0, _styleModifiers.when)('isSingleChild', false, (0, _styledComponents.css)(["&:hover{box-shadow:inset 0 0 0 ", " ", ";", "{border-color:transparent;}}"], (0, _rem.default)(100), (0, _toColorString.default)(borderColor), Content)));
172
+ };
173
+
174
+ var variantModifiers = function variantModifiers(props) {
175
+ var _props$variant = props.variant,
176
+ variant = _props$variant === void 0 ? 'normal' : _props$variant;
177
+ if (variant === 'normal') return undefined;
178
+ return (0, _styledComponents.css)(["border:1px solid ", ";", " &:focus{border:1px solid ", ";", ";}"], (0, _toColorString.default)(_designTokens.color.opacity.charcoal15), (0, _styleModifiers.when)('isSingleChild', false, (0, _styledComponents.css)(["&:hover{box-shadow:none;background-color:", ";}"], (0, _toColorString.default)(_objectSpread({}, _designTokens.color.base.charcoal, {
179
+ alpha: 0.07
180
+ })))), (0, _toColorString.default)(_designTokens.color.interaction.pacificOcean), (0, _focusRingWithColor.default)(_designTokens.color.interaction.pacificOcean40));
181
+ };
182
+
183
+ var actionColors = {
184
+ normal: (0, _toColorString.default)(interactionColors.indianOcean),
185
+ danger: (0, _toColorString.default)(statusColors.danger.medium)
186
+ };
187
+
188
+ var actionColor = function actionColor(_ref5) {
189
+ var actionIntent = _ref5.actionIntent;
190
+ return actionColors[actionIntent !== 'danger' ? 'normal' : 'danger'];
191
+ };
192
+
193
+ var Container = (0, _styledComponents.default)(_BaseButton.default).withConfig({
119
194
  displayName: "Tag__Container",
120
195
  componentId: "nifm8a-1"
121
- })(["font-family:", ";font-size:", ";font-weight:", ";align-items:center;border-radius:", ";border:1px solid ", ";display:inline-flex;height:", ";max-width:100%;min-width:", ";padding:0;", ";", ";", "{", ";}"], _designTokens.typography.typeface.default, (0, _rem.default)(_designTokens.typography.size.alias.default), _designTokens.typography.weight.alias.default, (0, _rem.default)(10), borderColor, (0, _rem.default)(20), (0, _rem.default)(26), colorModifiers, contentSVGColor, _ActionButton.ActionButtonContainer, colorModifiers);
196
+ })(["font-family:", ";font-size:", ";font-weight:", ";align-items:center;border-radius:", ";display:inline-flex;height:", ";max-width:100%;min-width:", ";padding:0;background-color:transparent;&:focus{border:1px solid ", ";", ";", "{height:", ";box-shadow:none;}}&:focus-visible{outline:none;}&:hover{", "{color:", ";}}", ";", ";", ";"], _designTokens.typography.typeface.default, (0, _rem.default)(_designTokens.typography.size.alias.default), _designTokens.typography.weight.alias.default, (0, _rem.default)(10), (0, _rem.default)(20), (0, _rem.default)(26), (0, _toColorString.default)(_designTokens.color.base.blackSheep), (0, _focusRingWithColor.default)(_designTokens.color.opacity.charcoal40), _Action.ActionContainer, (0, _rem.default)(14), _Action.default, actionColor, colorModifiers, variantModifiers, contentSVGColor);
122
197
 
123
198
  function Tag(props, containerRef) {
124
199
  var action = props.action,
@@ -128,50 +203,44 @@ function Tag(props, containerRef) {
128
203
  actionRef = props.actionRef,
129
204
  Icon = props.icon,
130
205
  text = props.text,
131
- rest = _objectWithoutProperties(props, ["action", "actionAttributes", "actionIcon", "actionIntent", "actionRef", "icon", "text"]);
206
+ palette = props.palette,
207
+ rest = _objectWithoutProperties(props, ["action", "actionAttributes", "actionIcon", "actionIntent", "actionRef", "icon", "text", "palette"]);
132
208
 
133
209
  var _useState = (0, _react.useState)(false),
134
210
  _useState2 = _slicedToArray(_useState, 2),
135
211
  isFocused = _useState2[0],
136
212
  setIsFocused = _useState2[1];
137
213
 
138
- var onActionFocus = (0, _react.useCallback)(function (e) {
139
- var _ref4 = actionAttributes || {
214
+ var onTagFocus = (0, _react.useCallback)(function (e) {
215
+ var _ref6 = actionAttributes || {
140
216
  onFocus: undefined
141
217
  },
142
- onFocus = _ref4.onFocus;
218
+ onFocus = _ref6.onFocus;
143
219
 
144
220
  setIsFocused(true);
145
221
  onFocus && onFocus(e);
146
222
  }, [actionAttributes]);
147
- var onActionBlur = (0, _react.useCallback)(function (e) {
148
- var _ref5 = actionAttributes || {
223
+ var onTagBlur = (0, _react.useCallback)(function (e) {
224
+ var _ref7 = actionAttributes || {
149
225
  onBlur: undefined
150
226
  },
151
- onBlur = _ref5.onBlur;
227
+ onBlur = _ref7.onBlur;
152
228
 
153
229
  setIsFocused(false);
154
230
  onBlur && onBlur(e);
155
231
  }, [actionAttributes]);
156
- var Action = (0, _react.useMemo)(function () {
232
+ var ActionElement = (0, _react.useMemo)(function () {
157
233
  if (!text || !action || !actionIcon) {
158
234
  return null;
159
235
  }
160
236
 
161
237
  var ActionIcon = actionIcon;
162
- return _react.default.createElement(_ActionButton.ActionButtonContainer, {
163
- isFocused: isFocused
164
- }, _react.default.createElement(_ActionButton.default, _extends({}, actionAttributes, {
165
- ref: actionRef,
166
- type: "button",
167
- onBlur: onActionBlur,
168
- onClick: action,
169
- onFocus: onActionFocus,
170
- actionIntent: actionIntent
171
- }), _react.default.createElement(ActionIcon, {
238
+ return _react.default.createElement(_Action.ActionContainer, null, _react.default.createElement(_Action.default, {
239
+ ref: actionRef
240
+ }, _react.default.createElement(ActionIcon, {
172
241
  size: "small"
173
242
  })));
174
- }, [text, action, actionRef, isFocused, actionIcon, actionIntent, onActionBlur, onActionFocus, actionAttributes]);
243
+ }, [text, action, actionRef, actionIcon]);
175
244
  var contentIsSingleChild = !action || !!action && !text;
176
245
  /**
177
246
  * We render the "content" twice below. The first one is visible to the user
@@ -182,9 +251,17 @@ function Tag(props, containerRef) {
182
251
  * seconds content component, and calculate the max width of the container.
183
252
  */
184
253
 
185
- return _react.default.createElement(Container, _extends({}, rest, {
186
- ref: containerRef
254
+ return _react.default.createElement(Container, _extends({}, rest, actionAttributes, {
255
+ isSingleChild: contentIsSingleChild,
256
+ palette: palette,
257
+ ref: containerRef,
258
+ onBlur: onTagBlur,
259
+ onClick: action,
260
+ onFocus: onTagFocus,
261
+ isFocused: isFocused,
262
+ actionIntent: actionIntent
187
263
  }), _react.default.createElement(Content, {
264
+ palette: palette,
188
265
  hasIcon: !!Icon,
189
266
  isSingleChild: contentIsSingleChild
190
267
  }, Icon && _react.default.createElement(Icon, {
@@ -194,7 +271,7 @@ function Tag(props, containerRef) {
194
271
  color: "inherit",
195
272
  size: "small",
196
273
  truncate: true
197
- }, text)), Action);
274
+ }, text)), ActionElement);
198
275
  }
199
276
 
200
277
  var TagWithRef = (0, _react.forwardRef)(Tag); // @ts-ignore
@@ -83,12 +83,193 @@ describe('Tag', function () {
83
83
  describe('Outline variant', function () {
84
84
  TestVariant('outline');
85
85
  });
86
+ describe('Palette variants', function () {
87
+ describe('bright', function () {
88
+ it('renders correctly', function () {
89
+ var _render = (0, _react2.render)(_react.default.createElement(_.default, {
90
+ text: "text",
91
+ palette: "bright"
92
+ })),
93
+ container = _render.container;
94
+
95
+ expect(container).toMatchSnapshot();
96
+ });
97
+ it('renders correctly with an Icon', function () {
98
+ var _render2 = (0, _react2.render)(_react.default.createElement(_.default, {
99
+ text: "text",
100
+ palette: "bright",
101
+ icon: _Home.default
102
+ })),
103
+ container = _render2.container;
104
+
105
+ expect(container).toMatchSnapshot();
106
+ });
107
+ it('renders correctly with different colors', function () {
108
+ var _render3 = (0, _react2.render)(_react.default.createElement(_.default, {
109
+ text: "text",
110
+ palette: "bright",
111
+ color: "information"
112
+ })),
113
+ container = _render3.container;
114
+
115
+ expect(container).toMatchSnapshot();
116
+ });
117
+ it('renders correctly with an action', function () {
118
+ var _render4 = (0, _react2.render)(_react.default.createElement(_.default, {
119
+ text: "text",
120
+ palette: "bright",
121
+ action: jest.fn(),
122
+ actionAttributes: {
123
+ 'aria-label': 'test'
124
+ },
125
+ actionIcon: _Home.default
126
+ })),
127
+ container = _render4.container;
128
+
129
+ expect(container).toMatchSnapshot();
130
+ });
131
+ it('renders the action correctly with the danger intent', function () {
132
+ var _render5 = (0, _react2.render)(_react.default.createElement(_.default, {
133
+ text: "text",
134
+ palette: "bright",
135
+ action: jest.fn(),
136
+ actionAttributes: {
137
+ 'aria-label': 'test'
138
+ },
139
+ actionIcon: _Home.default,
140
+ actionIntent: "danger"
141
+ })),
142
+ container = _render5.container;
143
+
144
+ expect(container).toMatchSnapshot();
145
+ });
146
+ });
147
+ describe('pastel', function () {
148
+ it('renders correctly', function () {
149
+ var _render6 = (0, _react2.render)(_react.default.createElement(_.default, {
150
+ text: "text",
151
+ palette: "pastel"
152
+ })),
153
+ container = _render6.container;
154
+
155
+ expect(container).toMatchSnapshot();
156
+ });
157
+ it('renders correctly with an Icon', function () {
158
+ var _render7 = (0, _react2.render)(_react.default.createElement(_.default, {
159
+ text: "text",
160
+ palette: "pastel",
161
+ icon: _Home.default
162
+ })),
163
+ container = _render7.container;
164
+
165
+ expect(container).toMatchSnapshot();
166
+ });
167
+ it('renders correctly with different colors', function () {
168
+ var _render8 = (0, _react2.render)(_react.default.createElement(_.default, {
169
+ text: "text",
170
+ palette: "pastel",
171
+ color: "information"
172
+ })),
173
+ container = _render8.container;
174
+
175
+ expect(container).toMatchSnapshot();
176
+ });
177
+ it('renders correctly with an action', function () {
178
+ var _render9 = (0, _react2.render)(_react.default.createElement(_.default, {
179
+ text: "text",
180
+ palette: "pastel",
181
+ action: jest.fn(),
182
+ actionAttributes: {
183
+ 'aria-label': 'test'
184
+ },
185
+ actionIcon: _Home.default
186
+ })),
187
+ container = _render9.container;
188
+
189
+ expect(container).toMatchSnapshot();
190
+ });
191
+ it('renders the action correctly with the danger intent', function () {
192
+ var _render10 = (0, _react2.render)(_react.default.createElement(_.default, {
193
+ text: "text",
194
+ palette: "pastel",
195
+ action: jest.fn(),
196
+ actionAttributes: {
197
+ 'aria-label': 'test'
198
+ },
199
+ actionIcon: _Home.default,
200
+ actionIntent: "danger"
201
+ })),
202
+ container = _render10.container;
203
+
204
+ expect(container).toMatchSnapshot();
205
+ });
206
+ });
207
+ describe('dark', function () {
208
+ it('renders correctly', function () {
209
+ var _render11 = (0, _react2.render)(_react.default.createElement(_.default, {
210
+ text: "text",
211
+ palette: "dark"
212
+ })),
213
+ container = _render11.container;
214
+
215
+ expect(container).toMatchSnapshot();
216
+ });
217
+ it('renders correctly with an Icon', function () {
218
+ var _render12 = (0, _react2.render)(_react.default.createElement(_.default, {
219
+ text: "text",
220
+ palette: "dark",
221
+ icon: _Home.default
222
+ })),
223
+ container = _render12.container;
224
+
225
+ expect(container).toMatchSnapshot();
226
+ });
227
+ it('renders correctly with different colors', function () {
228
+ var _render13 = (0, _react2.render)(_react.default.createElement(_.default, {
229
+ text: "text",
230
+ palette: "dark",
231
+ color: "information"
232
+ })),
233
+ container = _render13.container;
234
+
235
+ expect(container).toMatchSnapshot();
236
+ });
237
+ it('renders correctly with an action', function () {
238
+ var _render14 = (0, _react2.render)(_react.default.createElement(_.default, {
239
+ text: "text",
240
+ palette: "dark",
241
+ action: jest.fn(),
242
+ actionAttributes: {
243
+ 'aria-label': 'test'
244
+ },
245
+ actionIcon: _Home.default
246
+ })),
247
+ container = _render14.container;
248
+
249
+ expect(container).toMatchSnapshot();
250
+ });
251
+ it('renders the action correctly with the danger intent', function () {
252
+ var _render15 = (0, _react2.render)(_react.default.createElement(_.default, {
253
+ text: "text",
254
+ palette: "dark",
255
+ action: jest.fn(),
256
+ actionAttributes: {
257
+ 'aria-label': 'test'
258
+ },
259
+ actionIcon: _Home.default,
260
+ actionIntent: "danger"
261
+ })),
262
+ container = _render15.container;
263
+
264
+ expect(container).toMatchSnapshot();
265
+ });
266
+ });
267
+ });
86
268
  describe('Common', function () {
87
269
  it('does not render a provided action if there is not text', function () {
88
270
  jest.spyOn(console, 'error').mockImplementation(function () {});
89
271
 
90
272
  var _renderTag6 = renderTag({
91
- icon: _Home.default,
92
273
  text: undefined,
93
274
  action: function action() {
94
275
  return null;
@@ -100,7 +281,7 @@ describe('Tag', function () {
100
281
  }, 'normal'),
101
282
  container = _renderTag6.container;
102
283
 
103
- expect(container.querySelectorAll('button').length).toBe(0);
284
+ expect(container.querySelectorAll('svg').length).toBe(0);
104
285
  expect(console.error).toHaveBeenCalled(); // @ts-ignore
105
286
 
106
287
  console.error.mockRestore();
@@ -9,6 +9,7 @@ export declare const propTypes: {
9
9
  actionRef: PropTypes.Requireable<any>;
10
10
  color: PropTypes.Requireable<import("../../utils/commonUIColors").CommonUIColorKeys>;
11
11
  variant: PropTypes.Requireable<string>;
12
+ palette: PropTypes.Requireable<string>;
12
13
  };
13
14
  export declare const defaultProps: {
14
15
  action: undefined;
@@ -20,5 +21,6 @@ export declare const defaultProps: {
20
21
  icon: undefined;
21
22
  text: undefined;
22
23
  variant: string;
24
+ palette: string;
23
25
  };
24
26
  //# sourceMappingURL=propTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"propTypes.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/propTypes.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,YAAY,CAAC;AAYnC,eAAO,MAAM,SAAS;;;;;;;;;;CA0BrB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CAUxB,CAAC"}
1
+ {"version":3,"file":"propTypes.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/propTypes.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,YAAY,CAAC;AAYnC,eAAO,MAAM,SAAS;;;;;;;;;;;CA2BrB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;CAWxB,CAAC"}
@@ -40,7 +40,8 @@ var propTypes = {
40
40
  actionIntent: _propTypes.default.oneOf(['normal', 'danger']),
41
41
  actionRef: _propTypes.default.any,
42
42
  color: _propTypes.default.oneOf(_commonUIColors.commonUIColorKeys),
43
- variant: _propTypes.default.oneOf(['normal', 'outline'])
43
+ variant: _propTypes.default.oneOf(['normal', 'outline']),
44
+ palette: _propTypes.default.oneOf(['pastel', 'bright', 'dark'])
44
45
  };
45
46
  exports.propTypes = propTypes;
46
47
  var defaultProps = {
@@ -52,6 +53,7 @@ var defaultProps = {
52
53
  color: undefined,
53
54
  icon: undefined,
54
55
  text: undefined,
55
- variant: 'normal'
56
+ variant: 'normal',
57
+ palette: 'bright'
56
58
  };
57
59
  exports.defaultProps = defaultProps;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/schema.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,MAAM,KAAmC,CAAC;AA2ChD,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/schema.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,MAAM,KAAmC,CAAC;AA8ChD,eAAe,MAAM,CAAC"}
@@ -17,6 +17,7 @@ schema.propTypes = {
17
17
  text: _reactDesc.PropTypes.string.description("The tag's text"),
18
18
  icon: _reactDesc.PropTypes.element.description('Which `iconix` icon to render as the main icon'),
19
19
  color: _reactDesc.PropTypes.oneOf(_commonUIColors.commonUIColorKeys).description('The color to use as the tag background or SVG color when outlined').format('string (see notes below)').defaultValue('licoriceMousse'),
20
+ palette: _reactDesc.PropTypes.oneOf(['bright', 'pastel', 'dark']).description('What color variant to render').defaultValue('bright'),
20
21
  variant: _reactDesc.PropTypes.oneOf(['normal', 'outline']).description('What tag variant to render').defaultValue('normal'),
21
22
  action: _reactDesc.PropTypes.func.description('A function to callback when the action button is clicked'),
22
23
  actionRef: _reactDesc.PropTypes.any.description('Provide a "React Ref" to get a reference to the action\'s DOM node'),
@@ -1,13 +1,14 @@
1
- import React, { Ref, RefAttributes, ButtonHTMLAttributes } from 'react';
1
+ import React, { Ref, RefAttributes, AriaAttributes, DOMAttributes } from 'react';
2
2
  import { CSSObject } from 'styled-components';
3
3
  import { IconProps } from '@decisiv/iconix';
4
4
  import { CommonUIColorKeys } from '../../utils/commonUIColors';
5
- export declare type TagRef = HTMLDivElement;
6
- export declare type TagActionButtonRef = HTMLButtonElement;
5
+ export declare type TagRef = HTMLButtonElement;
6
+ export declare type TagActionRef = HTMLDivElement;
7
7
  export declare type IconComponent = (props: IconProps) => JSX.Element;
8
8
  export declare type ActionHandler = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => unknown;
9
9
  export declare type BaseProps = {
10
10
  color?: CommonUIColorKeys;
11
+ palette?: 'pastel' | 'bright' | 'dark';
11
12
  variant?: 'normal' | 'outline';
12
13
  style?: CSSObject;
13
14
  };
@@ -34,14 +35,11 @@ declare type ConditionalProps = Text & {
34
35
  } | Icon & {
35
36
  action?: never;
36
37
  } | Text & Icon | Text & Action & ActionIcon | Text & Icon & Action & ActionIcon;
37
- export declare type ActionButtonContainerProps = {
38
- isFocused: boolean;
39
- };
40
- export declare type ActionButtonExtraProps = {
41
- actionRef?: Ref<TagActionButtonRef>;
38
+ export declare type ActionExtraProps = {
39
+ actionRef?: Ref<TagActionRef>;
42
40
  actionIntent?: 'normal' | 'danger';
43
- actionAttributes?: ButtonHTMLAttributes<HTMLButtonElement>;
41
+ actionAttributes?: AriaAttributes & DOMAttributes<HTMLButtonElement>;
44
42
  };
45
- export declare type TagProps = RefAttributes<TagRef> & BaseProps & ContentProps & ConditionalProps & ActionButtonExtraProps;
43
+ export declare type TagProps = RefAttributes<TagRef> & BaseProps & ContentProps & ConditionalProps & ActionExtraProps;
46
44
  export {};
47
45
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,oBAAY,MAAM,GAAG,cAAc,CAAC;AACpC,oBAAY,kBAAkB,GAAG,iBAAiB,CAAC;AACnD,oBAAY,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,GAAG,CAAC,OAAO,CAAC;AAE9D,oBAAY,aAAa,GAAG,CAC1B,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,KACnD,OAAO,CAAC;AAEb,oBAAY,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,iBA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E,CAAC;AAEhD,aAAK,gBAAgB,GACjB,IAAI,GAAG;IAAE,MAAM,CAAC,EAAE,aAAa,CAAA;CAAE,GACjC,IAAI,GAAG;IAAE,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE,GACzB,IAAI,GAAG,IAAI,GACX,IAAI,GAAG,MAAM,GAAG,UAAU,GAC1B,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtC,oBAAY,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;IAC9B,YAAY,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACnC,gBAAgB,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;CACtE,CAAC;AAEF,oBAAY,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,GAC1C,SAAS,GACT,YAAY,GACZ,gBAAgB,GAChB,gBAAgB,CAAC"}
@@ -11,11 +11,359 @@ export declare type CommonUIColorKeys = StatusColorsKeys | VIColorsKeys;
11
11
  export declare type CommonUIColors = {
12
12
  [K in CommonUIColorKeys]: Color;
13
13
  };
14
- export declare const viColorKeys: import("@decisiv/design-tokens/lib/color/visual-interest").VisualInterestColorName[];
14
+ export declare const viColorKeys: ("berryCrisp" | "koolaidCake" | "cookieMonster" | "cottonCandy" | "fizzyLime" | "mamboMango" | "carrotCake" | "roseGummy" | "licoriceMousse")[];
15
15
  export declare const statusColorKeys: ("information" | "success" | "warning" | "danger")[];
16
16
  export declare const viColors: VIColors;
17
17
  export declare const statusColors: StatusColors;
18
18
  export declare const commonUIColorKeys: CommonUIColorKeys[];
19
19
  export declare const commonUIColors: CommonUIColors;
20
+ export declare const commonUIThreeShadeColors: {
21
+ readonly berryCrisp: {
22
+ light: {
23
+ readonly fg: Color;
24
+ readonly red: number;
25
+ readonly green: number;
26
+ readonly blue: number;
27
+ readonly alpha: number;
28
+ } | {
29
+ readonly fg: Color;
30
+ readonly red: number;
31
+ readonly green: number;
32
+ readonly blue: number;
33
+ };
34
+ medium: {
35
+ readonly fg: Color;
36
+ readonly red: number;
37
+ readonly green: number;
38
+ readonly blue: number;
39
+ readonly alpha: number;
40
+ } | {
41
+ readonly fg: Color;
42
+ readonly red: number;
43
+ readonly green: number;
44
+ readonly blue: number;
45
+ };
46
+ dark: {
47
+ readonly fg: Color;
48
+ readonly red: number;
49
+ readonly green: number;
50
+ readonly blue: number;
51
+ readonly alpha: number;
52
+ } | {
53
+ readonly fg: Color;
54
+ readonly red: number;
55
+ readonly green: number;
56
+ readonly blue: number;
57
+ };
58
+ };
59
+ readonly koolaidCake: {
60
+ light: {
61
+ readonly fg: Color;
62
+ readonly red: number;
63
+ readonly green: number;
64
+ readonly blue: number;
65
+ readonly alpha: number;
66
+ } | {
67
+ readonly fg: Color;
68
+ readonly red: number;
69
+ readonly green: number;
70
+ readonly blue: number;
71
+ };
72
+ medium: {
73
+ readonly fg: Color;
74
+ readonly red: number;
75
+ readonly green: number;
76
+ readonly blue: number;
77
+ readonly alpha: number;
78
+ } | {
79
+ readonly fg: Color;
80
+ readonly red: number;
81
+ readonly green: number;
82
+ readonly blue: number;
83
+ };
84
+ dark: {
85
+ readonly fg: Color;
86
+ readonly red: number;
87
+ readonly green: number;
88
+ readonly blue: number;
89
+ readonly alpha: number;
90
+ } | {
91
+ readonly fg: Color;
92
+ readonly red: number;
93
+ readonly green: number;
94
+ readonly blue: number;
95
+ };
96
+ };
97
+ readonly cookieMonster: {
98
+ light: {
99
+ readonly fg: Color;
100
+ readonly red: number;
101
+ readonly green: number;
102
+ readonly blue: number;
103
+ readonly alpha: number;
104
+ } | {
105
+ readonly fg: Color;
106
+ readonly red: number;
107
+ readonly green: number;
108
+ readonly blue: number;
109
+ };
110
+ medium: {
111
+ readonly fg: Color;
112
+ readonly red: number;
113
+ readonly green: number;
114
+ readonly blue: number;
115
+ readonly alpha: number;
116
+ } | {
117
+ readonly fg: Color;
118
+ readonly red: number;
119
+ readonly green: number;
120
+ readonly blue: number;
121
+ };
122
+ dark: {
123
+ readonly fg: Color;
124
+ readonly red: number;
125
+ readonly green: number;
126
+ readonly blue: number;
127
+ readonly alpha: number;
128
+ } | {
129
+ readonly fg: Color;
130
+ readonly red: number;
131
+ readonly green: number;
132
+ readonly blue: number;
133
+ };
134
+ };
135
+ readonly cottonCandy: {
136
+ light: {
137
+ readonly fg: Color;
138
+ readonly red: number;
139
+ readonly green: number;
140
+ readonly blue: number;
141
+ readonly alpha: number;
142
+ } | {
143
+ readonly fg: Color;
144
+ readonly red: number;
145
+ readonly green: number;
146
+ readonly blue: number;
147
+ };
148
+ medium: {
149
+ readonly fg: Color;
150
+ readonly red: number;
151
+ readonly green: number;
152
+ readonly blue: number;
153
+ readonly alpha: number;
154
+ } | {
155
+ readonly fg: Color;
156
+ readonly red: number;
157
+ readonly green: number;
158
+ readonly blue: number;
159
+ };
160
+ dark: {
161
+ readonly fg: Color;
162
+ readonly red: number;
163
+ readonly green: number;
164
+ readonly blue: number;
165
+ readonly alpha: number;
166
+ } | {
167
+ readonly fg: Color;
168
+ readonly red: number;
169
+ readonly green: number;
170
+ readonly blue: number;
171
+ };
172
+ };
173
+ readonly fizzyLime: {
174
+ light: {
175
+ readonly fg: Color;
176
+ readonly red: number;
177
+ readonly green: number;
178
+ readonly blue: number;
179
+ readonly alpha: number;
180
+ } | {
181
+ readonly fg: Color;
182
+ readonly red: number;
183
+ readonly green: number;
184
+ readonly blue: number;
185
+ };
186
+ medium: {
187
+ readonly fg: Color;
188
+ readonly red: number;
189
+ readonly green: number;
190
+ readonly blue: number;
191
+ readonly alpha: number;
192
+ } | {
193
+ readonly fg: Color;
194
+ readonly red: number;
195
+ readonly green: number;
196
+ readonly blue: number;
197
+ };
198
+ dark: {
199
+ readonly fg: Color;
200
+ readonly red: number;
201
+ readonly green: number;
202
+ readonly blue: number;
203
+ readonly alpha: number;
204
+ } | {
205
+ readonly fg: Color;
206
+ readonly red: number;
207
+ readonly green: number;
208
+ readonly blue: number;
209
+ };
210
+ };
211
+ readonly mamboMango: {
212
+ light: {
213
+ readonly fg: Color;
214
+ readonly red: number;
215
+ readonly green: number;
216
+ readonly blue: number;
217
+ readonly alpha: number;
218
+ } | {
219
+ readonly fg: Color;
220
+ readonly red: number;
221
+ readonly green: number;
222
+ readonly blue: number;
223
+ };
224
+ medium: {
225
+ readonly fg: Color;
226
+ readonly red: number;
227
+ readonly green: number;
228
+ readonly blue: number;
229
+ readonly alpha: number;
230
+ } | {
231
+ readonly fg: Color;
232
+ readonly red: number;
233
+ readonly green: number;
234
+ readonly blue: number;
235
+ };
236
+ dark: {
237
+ readonly fg: Color;
238
+ readonly red: number;
239
+ readonly green: number;
240
+ readonly blue: number;
241
+ readonly alpha: number;
242
+ } | {
243
+ readonly fg: Color;
244
+ readonly red: number;
245
+ readonly green: number;
246
+ readonly blue: number;
247
+ };
248
+ };
249
+ readonly carrotCake: {
250
+ light: {
251
+ readonly fg: Color;
252
+ readonly red: number;
253
+ readonly green: number;
254
+ readonly blue: number;
255
+ readonly alpha: number;
256
+ } | {
257
+ readonly fg: Color;
258
+ readonly red: number;
259
+ readonly green: number;
260
+ readonly blue: number;
261
+ };
262
+ medium: {
263
+ readonly fg: Color;
264
+ readonly red: number;
265
+ readonly green: number;
266
+ readonly blue: number;
267
+ readonly alpha: number;
268
+ } | {
269
+ readonly fg: Color;
270
+ readonly red: number;
271
+ readonly green: number;
272
+ readonly blue: number;
273
+ };
274
+ dark: {
275
+ readonly fg: Color;
276
+ readonly red: number;
277
+ readonly green: number;
278
+ readonly blue: number;
279
+ readonly alpha: number;
280
+ } | {
281
+ readonly fg: Color;
282
+ readonly red: number;
283
+ readonly green: number;
284
+ readonly blue: number;
285
+ };
286
+ };
287
+ readonly roseGummy: {
288
+ light: {
289
+ readonly fg: Color;
290
+ readonly red: number;
291
+ readonly green: number;
292
+ readonly blue: number;
293
+ readonly alpha: number;
294
+ } | {
295
+ readonly fg: Color;
296
+ readonly red: number;
297
+ readonly green: number;
298
+ readonly blue: number;
299
+ };
300
+ medium: {
301
+ readonly fg: Color;
302
+ readonly red: number;
303
+ readonly green: number;
304
+ readonly blue: number;
305
+ readonly alpha: number;
306
+ } | {
307
+ readonly fg: Color;
308
+ readonly red: number;
309
+ readonly green: number;
310
+ readonly blue: number;
311
+ };
312
+ dark: {
313
+ readonly fg: Color;
314
+ readonly red: number;
315
+ readonly green: number;
316
+ readonly blue: number;
317
+ readonly alpha: number;
318
+ } | {
319
+ readonly fg: Color;
320
+ readonly red: number;
321
+ readonly green: number;
322
+ readonly blue: number;
323
+ };
324
+ };
325
+ readonly licoriceMousse: {
326
+ dark: {
327
+ readonly fg: Color;
328
+ readonly red: number;
329
+ readonly green: number;
330
+ readonly blue: number;
331
+ readonly alpha: number;
332
+ } | {
333
+ readonly fg: Color;
334
+ readonly red: number;
335
+ readonly green: number;
336
+ readonly blue: number;
337
+ };
338
+ medium: {
339
+ readonly fg: Color;
340
+ readonly red: number;
341
+ readonly green: number;
342
+ readonly blue: number;
343
+ readonly alpha: number;
344
+ } | {
345
+ readonly fg: Color;
346
+ readonly red: number;
347
+ readonly green: number;
348
+ readonly blue: number;
349
+ };
350
+ light: {
351
+ readonly fg: Color;
352
+ readonly red: number;
353
+ readonly green: number;
354
+ readonly blue: number;
355
+ readonly alpha: number;
356
+ } | {
357
+ readonly fg: Color;
358
+ readonly red: number;
359
+ readonly green: number;
360
+ readonly blue: number;
361
+ };
362
+ };
363
+ readonly information: import("@decisiv/design-tokens/lib/color").ThreeShadeColor;
364
+ readonly success: import("@decisiv/design-tokens/lib/color").ThreeShadeColor;
365
+ readonly warning: import("@decisiv/design-tokens/lib/color").ThreeShadeColor;
366
+ readonly danger: import("@decisiv/design-tokens/lib/color").ThreeShadeColor;
367
+ };
20
368
  export {};
21
369
  //# sourceMappingURL=commonUIColors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commonUIColors.d.ts","sourceRoot":"","sources":["../../src/utils/commonUIColors.ts"],"names":[],"m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IAAI,iBAAiB,GAAG,KAAK;CAAE,CAAC;AAEjE,eAAO,MAAM,WAAW,iJAAgD,CAAC;AACzE,eAAO,MAAM,eAAe,sDAA4C,CAAC;AAEzE,eAAO,MAAM,QAAQ,UAMR,CAAC;AAEd,eAAO,MAAM,YAAY,cAGR,CAAC;AAElB,eAAO,MAAM,iBAAiB,qBAAuC,CAAC;AAEtE,eAAO,MAAM,cAAc,EAAE,cAG5B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG3B,CAAC"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.commonUIColors = exports.commonUIColorKeys = exports.statusColors = exports.viColors = exports.statusColorKeys = exports.viColorKeys = void 0;
6
+ exports.commonUIThreeShadeColors = exports.commonUIColors = exports.commonUIColorKeys = exports.statusColors = exports.viColors = exports.statusColorKeys = exports.viColorKeys = void 0;
7
7
 
8
8
  var _color = _interopRequireDefault(require("@decisiv/design-tokens/lib/color"));
9
9
 
@@ -42,4 +42,8 @@ exports.commonUIColorKeys = commonUIColorKeys;
42
42
 
43
43
  var commonUIColors = _objectSpread({}, statusColors, {}, viColors);
44
44
 
45
- exports.commonUIColors = commonUIColors;
45
+ exports.commonUIColors = commonUIColors;
46
+
47
+ var commonUIThreeShadeColors = _objectSpread({}, status, {}, visualInterest);
48
+
49
+ exports.commonUIThreeShadeColors = commonUIThreeShadeColors;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decisiv/ui-components",
3
- "version": "2.0.1-alpha.154+a36b70f",
3
+ "version": "2.0.1-alpha.155+2a55911",
4
4
  "description": "Decisiv's design system React components",
5
5
  "author": "Decisiv UI Development Team",
6
6
  "license": "MIT",
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@decisiv/breakpoint-observer": "^1.8.8",
19
- "@decisiv/design-tokens": "^1.8.8",
20
- "@decisiv/iconix": "^2.0.0",
19
+ "@decisiv/design-tokens": "^1.8.9-alpha.273+2a55911",
20
+ "@decisiv/iconix": "^2.0.1-alpha.155+2a55911",
21
21
  "@decisiv/prop-types": "^1.6.9",
22
22
  "@seznam/compose-react-refs": "^1.0.2",
23
23
  "csstype": "^2.6.5",
@@ -71,5 +71,5 @@
71
71
  "access": "public"
72
72
  },
73
73
  "private": false,
74
- "gitHead": "a36b70fc214170234472e5d06f14a8824d21317c"
74
+ "gitHead": "2a55911af990f81d5504d2f61475dc8968227879"
75
75
  }
@@ -1,5 +0,0 @@
1
- import { ActionButtonContainerProps, ActionButtonExtraProps } from './types';
2
- declare const ActionButton: import("styled-components").StyledComponent<"button", any, ActionButtonExtraProps, never>;
3
- export declare const ActionButtonContainer: import("styled-components").StyledComponent<"div", any, ActionButtonContainerProps, never>;
4
- export default ActionButton;
5
- //# sourceMappingURL=ActionButton.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ActionButton.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/ActionButton.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAwB7E,QAAA,MAAM,YAAY,2FAkBjB,CAAC;AAEF,eAAO,MAAM,qBAAqB,4FAiBjC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.ActionButtonContainer = void 0;
7
-
8
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
-
10
- var _toColorString = _interopRequireDefault(require("polished/lib/color/toColorString"));
11
-
12
- var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
13
-
14
- var _designTokens = _interopRequireDefault(require("@decisiv/design-tokens"));
15
-
16
- var _BaseButton = _interopRequireDefault(require("../../atoms/BaseButton"));
17
-
18
- var _focusRingWithColor = _interopRequireDefault(require("../../utils/focusRingWithColor"));
19
-
20
- var _styleModifiers = require("../../utils/styleModifiers");
21
-
22
- var _constants = require("./constants");
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
27
-
28
- var _designTokens$color = _designTokens.default.color,
29
- baseColors = _designTokens$color.base,
30
- interactionColors = _designTokens$color.interaction,
31
- statusColors = _designTokens$color.status,
32
- opacityColors = _designTokens$color.opacity;
33
- var actionButtonColors = {
34
- normal: (0, _toColorString.default)(interactionColors.indianOcean),
35
- danger: (0, _toColorString.default)(statusColors.danger.medium)
36
- };
37
- var borderRadius = (0, _styledComponents.css)(["border-radius:0 ", " ", " 0;"], (0, _rem.default)(10), (0, _rem.default)(10));
38
-
39
- var actionButtonColor = function actionButtonColor(_ref) {
40
- var actionIntent = _ref.actionIntent;
41
- return actionButtonColors[actionIntent !== 'danger' ? 'normal' : 'danger'];
42
- };
43
-
44
- var ActionButton = (0, _styledComponents.default)(_BaseButton.default).withConfig({
45
- displayName: "ActionButton",
46
- componentId: "jxjmgf-0"
47
- })(["align-items:center;appearance:none;background-color:", ";border:0;color:", ";display:flex;height:", ";justify-content:flex-start;padding:0 0 0 ", ";width:", ";outline:none;", " &:hover:not(:active){color:", ";}"], (0, _toColorString.default)(baseColors.snowWhite), (0, _toColorString.default)(interactionColors.pacificOcean), (0, _rem.default)(18), (0, _rem.default)(4), (0, _rem.default)(_constants.ACTION_BUTTON_WIDTH), borderRadius, actionButtonColor);
48
-
49
- var ActionButtonContainer = _styledComponents.default.div.withConfig({
50
- displayName: "ActionButton__ActionButtonContainer",
51
- componentId: "jxjmgf-1"
52
- })(["border:1px solid ", ";margin-right:-1px;", ";", ";"], (0, _toColorString.default)(opacityColors.charcoal15), borderRadius, (0, _styleModifiers.when)('isFocused', (0, _styledComponents.css)(["border-color:", ";", "{", "}"], (0, _toColorString.default)(interactionColors.pacificOcean), ActionButton, (0, _focusRingWithColor.default)(interactionColors.pacificOcean40))));
53
-
54
- exports.ActionButtonContainer = ActionButtonContainer;
55
- var _default = ActionButton;
56
- exports.default = _default;