@dscout/particle 1.0.0-alpha.1 → 1.0.0-alpha.4

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 (122) hide show
  1. package/lib/components/advanced_options.js +15 -3
  2. package/lib/components/attribute_input.js +21 -6
  3. package/lib/components/attribute_selector.js +46 -19
  4. package/lib/components/avatar.js +2 -2
  5. package/lib/components/button.js +25 -7
  6. package/lib/components/button_control.js +16 -4
  7. package/lib/components/button_icon.js +144 -40
  8. package/lib/components/button_mode.js +18 -6
  9. package/lib/components/button_plain.js +16 -4
  10. package/lib/components/card.js +12 -2
  11. package/lib/components/checkbox_input.js +15 -3
  12. package/lib/components/collapsing_menu.js +15 -3
  13. package/lib/components/common_button.js +65 -5
  14. package/lib/components/common_input.js +15 -3
  15. package/lib/components/container.js +76 -14
  16. package/lib/components/container_header.js +2 -2
  17. package/lib/components/drag_and_drop.js +14 -3
  18. package/lib/components/dropdown_input_toggle.js +15 -4
  19. package/lib/components/editing_container.js +2 -3
  20. package/lib/components/email_input.js +15 -3
  21. package/lib/components/file_input.js +16 -4
  22. package/lib/components/flex.js +11 -223
  23. package/lib/components/input_group.js +13 -2
  24. package/lib/components/link_text.js +283 -0
  25. package/lib/components/modal.js +47 -20
  26. package/lib/components/modifier.js +38 -592
  27. package/lib/components/number_input.js +15 -3
  28. package/lib/components/password_input.js +15 -3
  29. package/lib/components/radio_input.js +15 -3
  30. package/lib/components/range_input.js +15 -3
  31. package/lib/components/search_input.js +15 -3
  32. package/lib/components/select_input.js +15 -3
  33. package/lib/components/tags_input.js +19 -6
  34. package/lib/components/text_input.js +15 -3
  35. package/lib/components/textarea.js +15 -3
  36. package/lib/components/theme_provider.js +170 -39
  37. package/lib/components/togglable_fieldset.js +15 -3
  38. package/lib/components/toggle.js +15 -3
  39. package/lib/components/tooltip_container.js +1 -1
  40. package/lib/icons/circle_plus.js +4 -3
  41. package/lib/icons/exclude.js +81 -0
  42. package/lib/icons/multi_exclude.js +93 -0
  43. package/lib/icons/prop_types.js +1 -0
  44. package/lib/icons/reinclude.js +81 -0
  45. package/lib/icons/speaker_on.js +68 -0
  46. package/lib/index.js +40 -16
  47. package/lib/stylesheets/particle.css +4977 -3246
  48. package/lib/stylesheets/particle.css.map +1 -0
  49. package/lib/stylesheets/particle.min.css +1 -1
  50. package/lib/stylesheets/particle.min.css.gz +0 -0
  51. package/lib/utils/data_attributes.js +18 -0
  52. package/lib/utils/markscout.js +2 -2
  53. package/lib/utils/props.js +6 -2
  54. package/package.json +29 -27
  55. package/styles/_base.scss +5 -9
  56. package/styles/_reset.scss +5 -0
  57. package/styles/color_schemes/_bandit_dark.scss +53 -0
  58. package/styles/color_schemes/_bandit_dark_colors.scss +20 -0
  59. package/styles/color_schemes/_bandit_light.scss +6 -0
  60. package/styles/color_schemes/_bandit_light_colors.scss +20 -0
  61. package/styles/color_schemes/_base_colors.scss +91 -0
  62. package/styles/color_schemes/_color_scheme_builder.scss +169 -0
  63. package/styles/color_schemes/_index.scss +12 -0
  64. package/styles/color_schemes/_researcher_dark.scss +52 -0
  65. package/styles/color_schemes/_researcher_dark_colors.scss +14 -0
  66. package/styles/color_schemes/_researcher_light.scss +6 -0
  67. package/styles/color_schemes/_researcher_light_colors.scss +4 -0
  68. package/styles/components/_focus-intent.scss +2 -2
  69. package/styles/components/_icons.scss +7 -14
  70. package/styles/components/attribute_selector/_base.scss +26 -6
  71. package/styles/components/attribute_selector/themes/_theme_builder.scss +8 -6
  72. package/styles/components/avatar/_base.scss +4 -3
  73. package/styles/components/button_icon/_base.scss +22 -0
  74. package/styles/components/button_icon/themes/_bandit.scss +5 -0
  75. package/styles/components/button_icon/themes/_researcher.scss +5 -0
  76. package/styles/components/button_icon/themes/_theme_builder.scss +12 -0
  77. package/styles/components/buttons/_base.scss +327 -384
  78. package/styles/components/buttons/themes/_bandit.scss +16 -16
  79. package/styles/components/buttons/themes/_theme_builder.scss +49 -73
  80. package/styles/components/card/_base.scss +0 -8
  81. package/styles/components/container/_base.scss +10 -20
  82. package/styles/components/container/themes/_theme_builder.scss +15 -14
  83. package/styles/components/dropdown/_base.scss +1 -0
  84. package/styles/components/footnote/_base.scss +1 -1
  85. package/styles/components/grid/_base.scss +5 -4
  86. package/styles/components/input_group/_base.scss +7 -7
  87. package/styles/components/link_text/_base.scss +52 -0
  88. package/styles/components/link_text/themes/_bandit.scss +5 -0
  89. package/styles/components/link_text/themes/_researcher.scss +5 -0
  90. package/styles/components/link_text/themes/_theme_builder.scss +11 -0
  91. package/styles/components/menu/_base.scss +2 -3
  92. package/styles/components/modal/base.scss +7 -10
  93. package/styles/components/pill/_base.scss +14 -1
  94. package/styles/components/segmented_controls/_base.scss +1 -1
  95. package/styles/components/swappable/_base.scss +10 -2
  96. package/styles/components/toggle/_base.scss +1 -1
  97. package/styles/components/tooltip/_base.scss +8 -1
  98. package/styles/functions/_colors.scss +33 -0
  99. package/styles/particle.scss +5 -24
  100. package/styles/themes/_bandit.scss +39 -6
  101. package/styles/themes/_researcher.scss +7 -6
  102. package/styles/themes/_theme_builder.scss +70 -0
  103. package/styles/utilities/_alignment.scss +14 -137
  104. package/styles/utilities/_borders.scss +0 -44
  105. package/styles/utilities/_colors.scss +79 -605
  106. package/styles/utilities/_dimensions.scss +51 -265
  107. package/styles/utilities/_display.scss +1 -64
  108. package/styles/utilities/_overflow.scss +0 -55
  109. package/styles/utilities/_radii.scss +102 -30
  110. package/styles/utilities/_shadows.scss +0 -59
  111. package/styles/utilities/_spacing.scss +69 -534
  112. package/styles/utilities/_typography.scss +14 -331
  113. package/CHANGELOG.md +0 -1539
  114. package/lib/components/container_inner.js +0 -93
  115. package/lib/components/controls.js +0 -106
  116. package/styles/_mixins.scss +0 -134
  117. package/styles/_tables.scss +0 -138
  118. package/styles/_theme_builder.scss +0 -356
  119. package/styles/_variables.scss +0 -248
  120. package/styles/components/_links.scss +0 -141
  121. package/styles/css_variables/_bandit.scss +0 -45
  122. package/styles/css_variables/_researcher.scss +0 -5
@@ -13,6 +13,8 @@ var _class_names = _interopRequireDefault(require("../utils/class_names"));
13
13
 
14
14
  var _refs = require("../utils/refs");
15
15
 
16
+ var _data_attributes = _interopRequireDefault(require("../utils/data_attributes"));
17
+
16
18
  var _button_plain = _interopRequireDefault(require("./button_plain"));
17
19
 
18
20
  var _collapsible_content = _interopRequireDefault(require("./collapsible_content"));
@@ -25,8 +27,16 @@ var _modifier = _interopRequireDefault(require("./modifier"));
25
27
 
26
28
  var _collapsible = _interopRequireDefault(require("./collapsible"));
27
29
 
30
+ var _excluded = ["_modifierClass", "aria-label", "aria-labelledby", "aria-describedby", "children", "disabled", "getRef", "id", "initialCollapsed", "name", "title"];
31
+
28
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
33
 
34
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
35
+
36
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
37
+
38
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
39
+
30
40
  var propTypes = {
31
41
  _modifierClass: _propTypes.default.string,
32
42
  'aria-label': _propTypes.default.string,
@@ -53,7 +63,9 @@ function AdvancedOptions(_ref) {
53
63
  _ref$initialCollapsed = _ref.initialCollapsed,
54
64
  initialCollapsed = _ref$initialCollapsed === void 0 ? true : _ref$initialCollapsed,
55
65
  name = _ref.name,
56
- title = _ref.title;
66
+ title = _ref.title,
67
+ rest = _objectWithoutProperties(_ref, _excluded);
68
+
57
69
  var ariaControlsId = id ? "advanced-options-collapsible-content-".concat(id) : null;
58
70
  return _react.default.createElement(_collapsible.default, {
59
71
  initialCollapsed: initialCollapsed
@@ -67,7 +79,7 @@ function AdvancedOptions(_ref) {
67
79
  margin: {
68
80
  bottom: '0.75'
69
81
  }
70
- }, _react.default.createElement(_button_plain.default, {
82
+ }, _react.default.createElement(_button_plain.default, _extends({}, (0, _data_attributes.default)(rest), {
71
83
  "aria-controls": ariaControlsId,
72
84
  "aria-expanded": !isCollapsed,
73
85
  "aria-label": ariaLabel,
@@ -77,7 +89,7 @@ function AdvancedOptions(_ref) {
77
89
  id: id,
78
90
  onClick: toggleCollapsed,
79
91
  name: name || title
80
- }, _react.default.createElement(_flex.default, null, title, ' ', _react.default.createElement(_triangle_inverted.default, {
92
+ }), _react.default.createElement(_flex.default, null, title, ' ', _react.default.createElement(_triangle_inverted.default, {
81
93
  direction: isCollapsed ? 'right' : 'down'
82
94
  })))), _react.default.createElement(_collapsible_content.default, {
83
95
  collapsed: isCollapsed,
@@ -15,8 +15,18 @@ var _refs = require("../utils/refs");
15
15
 
16
16
  var _forms = require("../utils/forms");
17
17
 
18
+ var _data_attributes = _interopRequireDefault(require("../utils/data_attributes"));
19
+
20
+ var _excluded = ["_modifierClass", "aria-describedby", "aria-invalid", "aria-label", "aria-labelledby", "checked", "disabled", "getRef", "id", "label", "name", "value", "onChange", "readOnly", "tabIndex"];
21
+
18
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
23
 
24
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
+
26
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
27
+
28
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
29
+
20
30
  var propTypes = {
21
31
  _modifierClass: _propTypes.default.string,
22
32
  'aria-describedby': _propTypes.default.string,
@@ -55,17 +65,20 @@ function AttributeInput(_ref) {
55
65
  value = _ref.value,
56
66
  onChange = _ref.onChange,
57
67
  readOnly = _ref.readOnly,
58
- tabIndex = _ref.tabIndex;
68
+ tabIndex = _ref.tabIndex,
69
+ rest = _objectWithoutProperties(_ref, _excluded);
70
+
59
71
  var attributeId = determineIdValue(id, label);
60
72
  var selectorClassName = (0, _class_names.default)('Attribute', _modifierClass, {
61
73
  'Attribute--with-label': label
62
74
  });
63
75
  var labelClassName = (0, _class_names.default)('Attribute__Label', {
64
- 'Attribute__Label--selected': checked
76
+ 'Attribute__Label--selected': checked,
77
+ 'Attribute__Label--read-only': readOnly
65
78
  });
66
79
  return _react.default.createElement("div", {
67
80
  className: selectorClassName
68
- }, _react.default.createElement("input", {
81
+ }, _react.default.createElement("input", _extends({}, (0, _data_attributes.default)(rest), {
69
82
  id: attributeId,
70
83
  name: name,
71
84
  "aria-label": ariaLabel,
@@ -75,16 +88,18 @@ function AttributeInput(_ref) {
75
88
  ref: getRef,
76
89
  checked: checked,
77
90
  className: "Attribute__Input",
78
- onChange: onChange,
91
+ onChange: readOnly ? undefined : onChange,
79
92
  type: "radio",
80
93
  value: value,
81
94
  tabIndex: tabIndex,
82
95
  readOnly: readOnly,
83
96
  disabled: disabled
84
- }), _react.default.createElement("label", {
97
+ })), _react.default.createElement("label", {
85
98
  className: labelClassName,
86
99
  htmlFor: attributeId
87
- }, label));
100
+ }, _react.default.createElement("span", {
101
+ className: "Attribute__Label__Content"
102
+ }, label)));
88
103
  }
89
104
 
90
105
  AttributeInput.propTypes = propTypes;
@@ -13,20 +13,32 @@ var _class_names = _interopRequireDefault(require("../utils/class_names"));
13
13
 
14
14
  var _refs = require("../utils/refs");
15
15
 
16
+ var _data_attributes = _interopRequireDefault(require("../utils/data_attributes"));
17
+
16
18
  var _attribute_input = _interopRequireDefault(require("./attribute_input"));
17
19
 
20
+ var _excluded = ["_modifierClass", "aria-label", "aria-labelledby", "aria-describedby", "attributes", "disabled", "getRef", "id", "name", "onClick", "readOnly", "selected"];
21
+
18
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
23
 
24
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
+
26
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
27
+
28
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
29
+
20
30
  var propTypes = {
21
31
  _modifierClass: _propTypes.default.string,
22
32
  'aria-label': _propTypes.default.string,
23
33
  'aria-labelledby': _propTypes.default.string,
24
34
  'aria-describedby': _propTypes.default.string,
25
35
  attributes: _propTypes.default.object.isRequired,
36
+ disabled: _propTypes.default.bool,
26
37
  getRef: _refs.getRefPropType,
27
38
  id: _propTypes.default.string,
28
- name: _propTypes.default.string,
39
+ name: _propTypes.default.string.isRequired,
29
40
  onClick: _propTypes.default.func.isRequired,
41
+ readOnly: _propTypes.default.bool,
30
42
  selected: _propTypes.default.string
31
43
  };
32
44
 
@@ -36,12 +48,14 @@ function AttributeSelector(_ref) {
36
48
  ariaLabelledby = _ref['aria-labelledby'],
37
49
  ariaDescribedby = _ref['aria-describedby'],
38
50
  attributes = _ref.attributes,
51
+ disabled = _ref.disabled,
39
52
  getRef = _ref.getRef,
40
53
  id = _ref.id,
41
- _ref$name = _ref.name,
42
- name = _ref$name === void 0 ? 'attributes' : _ref$name,
54
+ name = _ref.name,
43
55
  onClick = _ref.onClick,
44
- selected = _ref.selected;
56
+ readOnly = _ref.readOnly,
57
+ selected = _ref.selected,
58
+ rest = _objectWithoutProperties(_ref, _excluded);
45
59
 
46
60
  function handleAttributeSelected(_ref2) {
47
61
  var target = _ref2.target;
@@ -50,23 +64,26 @@ function AttributeSelector(_ref) {
50
64
 
51
65
  function renderAttribute(attribute) {
52
66
  return _react.default.createElement(_attribute_input.default, {
53
- key: attribute,
54
- onChange: handleAttributeSelected,
55
67
  checked: attribute === selected,
68
+ disabled: disabled,
69
+ id: "".concat(name, "[").concat(attribute, "]"),
70
+ key: attribute,
56
71
  label: attributes[attribute],
57
72
  name: name,
73
+ onChange: handleAttributeSelected,
74
+ readOnly: readOnly,
58
75
  value: attribute
59
76
  });
60
77
  }
61
78
 
62
- return _react.default.createElement("div", {
79
+ return _react.default.createElement("div", _extends({}, (0, _data_attributes.default)(rest), {
63
80
  "aria-label": ariaLabel,
64
81
  "aria-labelledby": ariaLabelledby,
65
82
  "aria-describedby": ariaDescribedby,
66
83
  className: (0, _class_names.default)('Attribute__Selector spacing-h--0.25', _modifierClass),
67
84
  id: id,
68
85
  ref: getRef
69
- }, Object.keys(attributes).map(renderAttribute));
86
+ }), Object.keys(attributes).map(renderAttribute));
70
87
  }
71
88
 
72
89
  AttributeSelector.propTypes = propTypes;
@@ -75,17 +92,6 @@ AttributeSelector.__docgenInfo = {
75
92
  "methods": [],
76
93
  "displayName": "AttributeSelector",
77
94
  "props": {
78
- "name": {
79
- "defaultValue": {
80
- "value": "'attributes'",
81
- "computed": false
82
- },
83
- "type": {
84
- "name": "string"
85
- },
86
- "required": false,
87
- "description": ""
88
- },
89
95
  "_modifierClass": {
90
96
  "type": {
91
97
  "name": "string"
@@ -121,6 +127,13 @@ AttributeSelector.__docgenInfo = {
121
127
  "required": true,
122
128
  "description": ""
123
129
  },
130
+ "disabled": {
131
+ "type": {
132
+ "name": "bool"
133
+ },
134
+ "required": false,
135
+ "description": ""
136
+ },
124
137
  "getRef": {
125
138
  "type": {
126
139
  "name": "custom",
@@ -136,6 +149,13 @@ AttributeSelector.__docgenInfo = {
136
149
  "required": false,
137
150
  "description": ""
138
151
  },
152
+ "name": {
153
+ "type": {
154
+ "name": "string"
155
+ },
156
+ "required": true,
157
+ "description": ""
158
+ },
139
159
  "onClick": {
140
160
  "type": {
141
161
  "name": "func"
@@ -143,6 +163,13 @@ AttributeSelector.__docgenInfo = {
143
163
  "required": true,
144
164
  "description": ""
145
165
  },
166
+ "readOnly": {
167
+ "type": {
168
+ "name": "bool"
169
+ },
170
+ "required": false,
171
+ "description": ""
172
+ },
146
173
  "selected": {
147
174
  "type": {
148
175
  "name": "string"
@@ -86,7 +86,7 @@ function Avatar(_ref) {
86
86
  img.src = avatarUrl;
87
87
  }, [avatarUrl]);
88
88
  var className = (0, _class_names.default)('Avatar', _modifierClass, {
89
- 'Avatar--background': !loaded
89
+ 'Avatar--loaded': loaded
90
90
  });
91
91
  var style = {
92
92
  backgroundImage: loaded ? "url('".concat(avatarUrl, "')") : undefined,
@@ -103,7 +103,7 @@ function Avatar(_ref) {
103
103
  style: style,
104
104
  title: title || name
105
105
  }, !loaded && _react.default.createElement("span", {
106
- className: "Avatar--initials",
106
+ className: "Avatar__Initials",
107
107
  style: size ? fontSizeStyle(size) : null
108
108
  }, (0, _strings.getInitials)(name)));
109
109
  }
@@ -13,12 +13,22 @@ var _class_names = _interopRequireDefault(require("../utils/class_names"));
13
13
 
14
14
  var _refs = require("../utils/refs");
15
15
 
16
+ var _data_attributes = _interopRequireDefault(require("../utils/data_attributes"));
17
+
16
18
  var _common_button = _interopRequireDefault(require("./common_button"));
17
19
 
20
+ var _excluded = ["_modifierClass", "aria-controls", "aria-expanded", "aria-label", "aria-labelledby", "aria-describedby", "aria-pressed", "children", "color", "disabled", "getRef", "id", "linkComponent", "linkProps", "name", "onClick", "onMouseUp", "onMouseDown", "refProp", "size", "title", "type", "width", "variant"];
21
+
18
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
23
 
24
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
+
26
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
27
+
28
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
29
+
20
30
  var ENUMS = {
21
- color: ['alert', 'close', 'coachmark', 'dscout', 'archive', 'none', 'success', 'note', 'screener', 'live', 'diary', 'test', 'invert'],
31
+ color: ['alert', 'close', 'coachmark', 'dscout', 'archive', 'none', 'success', 'note', 'screener', 'live', 'diary', 'test', 'invert', 'black', 'white'],
22
32
  size: ['big', 'small'],
23
33
  width: ['fullwidth', 'tight', 'wide'],
24
34
  variant: ['glass', 'outline', 'shadow']
@@ -53,8 +63,8 @@ var ALIAS_MAP = {
53
63
  live: 'alert'
54
64
  };
55
65
 
56
- function whitelistedClassFor(type, value) {
57
- var classPrefix = type === 'color' ? "btn--color-" : "btn--";
66
+ function supportedClassFor(type, value) {
67
+ var classPrefix = type === 'color' ? "Button--color-" : "Button--";
58
68
 
59
69
  if (ENUMS[type].includes(value)) {
60
70
  return "".concat(classPrefix).concat(ALIAS_MAP[value] || value);
@@ -85,9 +95,11 @@ function Button(_ref) {
85
95
  title = _ref.title,
86
96
  type = _ref.type,
87
97
  width = _ref.width,
88
- variant = _ref.variant;
89
- var className = (0, _class_names.default)('btn', whitelistedClassFor('size', size), whitelistedClassFor('width', width), whitelistedClassFor('variant', variant), whitelistedClassFor('color', color), _modifierClass);
90
- return _react.default.createElement(_common_button.default, {
98
+ variant = _ref.variant,
99
+ rest = _objectWithoutProperties(_ref, _excluded);
100
+
101
+ var className = (0, _class_names.default)('Button', supportedClassFor('size', size), supportedClassFor('width', width), supportedClassFor('variant', variant), supportedClassFor('color', color), _modifierClass);
102
+ return _react.default.createElement(_common_button.default, _extends({}, (0, _data_attributes.default)(rest), {
91
103
  "aria-controls": ariaControls,
92
104
  "aria-expanded": ariaExpanded,
93
105
  "aria-label": ariaLabel,
@@ -107,7 +119,7 @@ function Button(_ref) {
107
119
  refProp: refProp,
108
120
  title: title,
109
121
  type: type
110
- }, children);
122
+ }), children);
111
123
  }
112
124
 
113
125
  Button.propTypes = propTypes;
@@ -214,6 +226,12 @@ Button.__docgenInfo = {
214
226
  }, {
215
227
  "value": "'invert'",
216
228
  "computed": false
229
+ }, {
230
+ "value": "'black'",
231
+ "computed": false
232
+ }, {
233
+ "value": "'white'",
234
+ "computed": false
217
235
  }]
218
236
  },
219
237
  "required": false,
@@ -13,8 +13,18 @@ var _class_names = _interopRequireDefault(require("../utils/class_names"));
13
13
 
14
14
  var _refs = require("../utils/refs");
15
15
 
16
+ var _data_attributes = _interopRequireDefault(require("../utils/data_attributes"));
17
+
18
+ var _excluded = ["_modifierClass", "active", "aria-controls", "aria-expanded", "aria-label", "aria-labelledby", "aria-describedby", "children", "disabled", "getRef", "id", "name", "onClick", "title"];
19
+
16
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
21
 
22
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
+
24
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
25
+
26
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
27
+
18
28
  var propTypes = {
19
29
  _modifierClass: _propTypes.default.string,
20
30
  active: _propTypes.default.bool,
@@ -46,11 +56,13 @@ function ButtonControl(_ref) {
46
56
  id = _ref.id,
47
57
  name = _ref.name,
48
58
  onClick = _ref.onClick,
49
- title = _ref.title;
50
- var className = (0, _class_names.default)('btn', 'Button__Control', _modifierClass, {
59
+ title = _ref.title,
60
+ rest = _objectWithoutProperties(_ref, _excluded);
61
+
62
+ var className = (0, _class_names.default)('Button__Control', _modifierClass, {
51
63
  'Button__Control--active': active
52
64
  });
53
- return _react.default.createElement("button", {
65
+ return _react.default.createElement("button", _extends({}, (0, _data_attributes.default)(rest), {
54
66
  "aria-controls": ariaControls,
55
67
  "aria-expanded": ariaExpanded,
56
68
  "aria-label": ariaLabel,
@@ -64,7 +76,7 @@ function ButtonControl(_ref) {
64
76
  ref: getRef,
65
77
  title: title,
66
78
  type: "button"
67
- }, children);
79
+ }), children);
68
80
  }
69
81
 
70
82
  ButtonControl.propTypes = propTypes;