@atlaskit/select 15.5.0 → 15.6.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/select
2
2
 
3
+ ## 15.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`68cc8008851`](https://bitbucket.org/atlassian/atlassian-frontend/commits/68cc8008851) - [ux] Introduces appearance prop to component, with 'default', 'subtle' and 'none' variants
8
+
3
9
  ## 15.5.0
4
10
 
5
11
  ### Minor Changes
@@ -121,7 +121,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
121
121
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "targetRef", null);
122
122
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowClick", null);
123
123
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowKeydown", null);
124
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "defaultStyles", (0, _reactSelect.mergeStyles)((0, _styles.default)(_this.props.validationState, _this.props.spacing === 'compact'), {
124
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "defaultStyles", (0, _reactSelect.mergeStyles)((0, _styles.default)(_this.props.validationState, _this.props.spacing === 'compact', 'default'), {
125
125
  groupHeading: function groupHeading(provided) {
126
126
  return _objectSpread(_objectSpread({}, provided), {}, {
127
127
  color: "var(--ds-text-subtlest, ".concat(_colors.N80, ")")
@@ -14,7 +14,7 @@ var _analyticsNext = require("@atlaskit/analytics-next");
14
14
  var _createSelect = _interopRequireDefault(require("./createSelect"));
15
15
 
16
16
  var packageName = "@atlaskit/select";
17
- var packageVersion = "15.5.0";
17
+ var packageVersion = "15.6.0";
18
18
  var SelectWithoutAnalytics = (0, _createSelect.default)(_reactSelect.default);
19
19
  exports.SelectWithoutAnalytics = SelectWithoutAnalytics;
20
20
  var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
@@ -41,7 +41,7 @@ var defaultComponents = _interopRequireWildcard(require("./components"));
41
41
 
42
42
  var _styles = _interopRequireDefault(require("./styles"));
43
43
 
44
- var _excluded = ["styles", "validationState", "spacing", "isMulti"];
44
+ var _excluded = ["styles", "validationState", "spacing", "isMulti", "appearance"];
45
45
 
46
46
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
47
47
 
@@ -119,6 +119,7 @@ function createSelect(WrappedComponent) {
119
119
  validationState = _this$props.validationState,
120
120
  spacing = _this$props.spacing,
121
121
  isMulti = _this$props.isMulti,
122
+ appearance = _this$props.appearance,
122
123
  props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
123
124
  var isCompact = spacing === 'compact'; // props must be spread first to stop `components` being overridden
124
125
 
@@ -128,7 +129,7 @@ function createSelect(WrappedComponent) {
128
129
  "aria-live": "assertive"
129
130
  }, props, {
130
131
  components: this.components,
131
- styles: (0, _reactSelect.mergeStyles)((0, _styles.default)(validationState, isCompact), styles)
132
+ styles: (0, _reactSelect.mergeStyles)((0, _styles.default)(validationState, isCompact, this.props.appearance || 'default'), styles)
132
133
  }));
133
134
  }
134
135
  }]);
@@ -21,7 +21,7 @@ var BORDER_WIDTH = 2;
21
21
  var ICON_PADDING = 2;
22
22
  var paddingExcludingBorder = (0, _constants.gridSize)() - BORDER_WIDTH;
23
23
 
24
- function baseStyles(validationState, isCompact) {
24
+ function baseStyles(validationState, isCompact, appearance) {
25
25
  return {
26
26
  container: function container(css, _ref) {
27
27
  var isDisabled = _ref.isDisabled;
@@ -69,6 +69,20 @@ function baseStyles(validationState, isCompact) {
69
69
  }
70
70
 
71
71
  var transitionDuration = '200ms';
72
+
73
+ if (appearance === 'subtle') {
74
+ borderColor = isFocused ? "var(--ds-border-focused, ".concat(_colors.B100, ")") : 'transparent';
75
+ backgroundColor = isFocused ? "var(--ds-surface, ".concat(_colors.N0, ")") : 'transparent';
76
+ backgroundColorHover = isFocused ? "var(--ds-surface, ".concat(_colors.N0, ")") : "var(--ds-surface, ".concat(_colors.N30, ")");
77
+ }
78
+
79
+ if (appearance === 'none') {
80
+ borderColor = 'transparent';
81
+ backgroundColor = 'transparent';
82
+ backgroundColorHover = 'transparent';
83
+ borderColorHover = 'transparent';
84
+ }
85
+
72
86
  return _objectSpread(_objectSpread({}, css), {}, {
73
87
  // Turn pointer events off when disabled - this makes it so hover etc don't work.
74
88
  pointerEvents: isDisabled ? 'none' : undefined,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/select",
3
- "version": "15.5.0",
3
+ "version": "15.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -59,7 +59,7 @@ export default class PopupSelect extends PureComponent {
59
59
 
60
60
  _defineProperty(this, "unbindWindowKeydown", null);
61
61
 
62
- _defineProperty(this, "defaultStyles", mergeStyles(baseStyles(this.props.validationState, this.props.spacing === 'compact'), {
62
+ _defineProperty(this, "defaultStyles", mergeStyles(baseStyles(this.props.validationState, this.props.spacing === 'compact', 'default'), {
63
63
  groupHeading: provided => ({ ...provided,
64
64
  color: `var(--ds-text-subtlest, ${N80})`
65
65
  })
@@ -2,7 +2,7 @@ import Select from 'react-select';
2
2
  import { withAnalyticsEvents, withAnalyticsContext, createAndFireEvent } from '@atlaskit/analytics-next';
3
3
  import createSelect from './createSelect';
4
4
  const packageName = "@atlaskit/select";
5
- const packageVersion = "15.5.0";
5
+ const packageVersion = "15.6.0";
6
6
  export const SelectWithoutAnalytics = createSelect(Select);
7
7
  const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
8
8
  export default withAnalyticsContext({
@@ -64,6 +64,7 @@ export default function createSelect(WrappedComponent) {
64
64
  validationState,
65
65
  spacing,
66
66
  isMulti,
67
+ appearance,
67
68
  ...props
68
69
  } = this.props;
69
70
  const isCompact = spacing === 'compact'; // props must be spread first to stop `components` being overridden
@@ -74,7 +75,7 @@ export default function createSelect(WrappedComponent) {
74
75
  "aria-live": "assertive"
75
76
  }, props, {
76
77
  components: this.components,
77
- styles: mergeStyles(baseStyles(validationState, isCompact), styles)
78
+ styles: mergeStyles(baseStyles(validationState, isCompact, this.props.appearance || 'default'), styles)
78
79
  }));
79
80
  }
80
81
 
@@ -3,7 +3,7 @@ import { B100, B400, B50, G400, N0, N20, N200, N30, N300, N40, N500, N70, N800,
3
3
  const BORDER_WIDTH = 2;
4
4
  const ICON_PADDING = 2;
5
5
  const paddingExcludingBorder = gridSize() - BORDER_WIDTH;
6
- export default function baseStyles(validationState, isCompact) {
6
+ export default function baseStyles(validationState, isCompact, appearance) {
7
7
  return {
8
8
  container: (css, {
9
9
  isDisabled
@@ -49,6 +49,20 @@ export default function baseStyles(validationState, isCompact) {
49
49
  }
50
50
 
51
51
  const transitionDuration = '200ms';
52
+
53
+ if (appearance === 'subtle') {
54
+ borderColor = isFocused ? `var(--ds-border-focused, ${B100})` : 'transparent';
55
+ backgroundColor = isFocused ? `var(--ds-surface, ${N0})` : 'transparent';
56
+ backgroundColorHover = isFocused ? `var(--ds-surface, ${N0})` : `var(--ds-surface, ${N30})`;
57
+ }
58
+
59
+ if (appearance === 'none') {
60
+ borderColor = 'transparent';
61
+ backgroundColor = 'transparent';
62
+ backgroundColorHover = 'transparent';
63
+ borderColorHover = 'transparent';
64
+ }
65
+
52
66
  return { ...css,
53
67
  // Turn pointer events off when disabled - this makes it so hover etc don't work.
54
68
  pointerEvents: isDisabled ? 'none' : undefined,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/select",
3
- "version": "15.5.0",
3
+ "version": "15.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -92,7 +92,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
92
92
 
93
93
  _defineProperty(_assertThisInitialized(_this), "unbindWindowKeydown", null);
94
94
 
95
- _defineProperty(_assertThisInitialized(_this), "defaultStyles", mergeStyles(baseStyles(_this.props.validationState, _this.props.spacing === 'compact'), {
95
+ _defineProperty(_assertThisInitialized(_this), "defaultStyles", mergeStyles(baseStyles(_this.props.validationState, _this.props.spacing === 'compact', 'default'), {
96
96
  groupHeading: function groupHeading(provided) {
97
97
  return _objectSpread(_objectSpread({}, provided), {}, {
98
98
  color: "var(--ds-text-subtlest, ".concat(N80, ")")
@@ -2,7 +2,7 @@ import Select from 'react-select';
2
2
  import { withAnalyticsEvents, withAnalyticsContext, createAndFireEvent } from '@atlaskit/analytics-next';
3
3
  import createSelect from './createSelect';
4
4
  var packageName = "@atlaskit/select";
5
- var packageVersion = "15.5.0";
5
+ var packageVersion = "15.6.0";
6
6
  export var SelectWithoutAnalytics = createSelect(Select);
7
7
  var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
8
8
  export default withAnalyticsContext({
@@ -8,7 +8,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
8
8
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
9
9
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
10
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
11
- var _excluded = ["styles", "validationState", "spacing", "isMulti"];
11
+ var _excluded = ["styles", "validationState", "spacing", "isMulti", "appearance"];
12
12
 
13
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
14
 
@@ -94,6 +94,7 @@ export default function createSelect(WrappedComponent) {
94
94
  validationState = _this$props.validationState,
95
95
  spacing = _this$props.spacing,
96
96
  isMulti = _this$props.isMulti,
97
+ appearance = _this$props.appearance,
97
98
  props = _objectWithoutProperties(_this$props, _excluded);
98
99
 
99
100
  var isCompact = spacing === 'compact'; // props must be spread first to stop `components` being overridden
@@ -104,7 +105,7 @@ export default function createSelect(WrappedComponent) {
104
105
  "aria-live": "assertive"
105
106
  }, props, {
106
107
  components: this.components,
107
- styles: mergeStyles(baseStyles(validationState, isCompact), styles)
108
+ styles: mergeStyles(baseStyles(validationState, isCompact, this.props.appearance || 'default'), styles)
108
109
  }));
109
110
  }
110
111
  }]);
@@ -9,7 +9,7 @@ import { B100, B400, B50, G400, N0, N20, N200, N30, N300, N40, N500, N70, N800,
9
9
  var BORDER_WIDTH = 2;
10
10
  var ICON_PADDING = 2;
11
11
  var paddingExcludingBorder = gridSize() - BORDER_WIDTH;
12
- export default function baseStyles(validationState, isCompact) {
12
+ export default function baseStyles(validationState, isCompact, appearance) {
13
13
  return {
14
14
  container: function container(css, _ref) {
15
15
  var isDisabled = _ref.isDisabled;
@@ -57,6 +57,20 @@ export default function baseStyles(validationState, isCompact) {
57
57
  }
58
58
 
59
59
  var transitionDuration = '200ms';
60
+
61
+ if (appearance === 'subtle') {
62
+ borderColor = isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : 'transparent';
63
+ backgroundColor = isFocused ? "var(--ds-surface, ".concat(N0, ")") : 'transparent';
64
+ backgroundColorHover = isFocused ? "var(--ds-surface, ".concat(N0, ")") : "var(--ds-surface, ".concat(N30, ")");
65
+ }
66
+
67
+ if (appearance === 'none') {
68
+ borderColor = 'transparent';
69
+ backgroundColor = 'transparent';
70
+ backgroundColorHover = 'transparent';
71
+ borderColorHover = 'transparent';
72
+ }
73
+
60
74
  return _objectSpread(_objectSpread({}, css), {}, {
61
75
  // Turn pointer events off when disabled - this makes it so hover etc don't work.
62
76
  pointerEvents: isDisabled ? 'none' : undefined,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/select",
3
- "version": "15.5.0",
3
+ "version": "15.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,2 +1,2 @@
1
1
  import { StylesConfig, ValidationState } from './types';
2
- export default function baseStyles<Option, IsMulti extends boolean>(validationState: ValidationState, isCompact: boolean): StylesConfig<Option, IsMulti>;
2
+ export default function baseStyles<Option, IsMulti extends boolean>(validationState: ValidationState, isCompact: boolean, appearance: 'default' | 'subtle' | 'none'): StylesConfig<Option, IsMulti>;
@@ -25,6 +25,7 @@ export interface OptionProps<Option = OptionType, IsMulti extends boolean = fals
25
25
  export interface SelectProps<OptionType, IsMulti extends boolean = false> extends ReactSelectProps<OptionType, IsMulti>, WithAnalyticsEventsProps {
26
26
  spacing?: 'compact' | 'default';
27
27
  validationState?: ValidationState;
28
+ appearance?: 'default' | 'subtle' | 'none';
28
29
  }
29
30
  export declare type ActionMeta<Option = OptionType> = RSActionMeta<Option>;
30
31
  export declare type InputActionMeta = RSInputActionMeta;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/select",
3
- "version": "15.5.0",
3
+ "version": "15.6.0",
4
4
  "description": "Select allows users to make a single selection or multiple selections from a list of options.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"