@plusscommunities/pluss-core-web 1.4.6-beta.0 → 1.4.9-beta.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/dist/index.cjs.js CHANGED
@@ -11025,8 +11025,8 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11025
11025
 
11026
11026
  _this = _super.call(this, props);
11027
11027
 
11028
- _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "setColourCircle", function (colour) {
11029
- var tc = tinycolor__default['default'](colour);
11028
+ _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "setColourCircle", function () {
11029
+ var tc = tinycolor__default['default'](_this.state.colour);
11030
11030
 
11031
11031
  _this.setState({
11032
11032
  colourCircleTop: 100 - 100 * tc.getBrightness() / 255,
@@ -11043,6 +11043,7 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11043
11043
  });
11044
11044
 
11045
11045
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onColourChange", function (color) {
11046
+ // console.log('onColourChange', color);
11046
11047
  var colour = color;
11047
11048
 
11048
11049
  if (_typeof__default['default'](color) === 'object') {
@@ -11050,10 +11051,8 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11050
11051
  }
11051
11052
 
11052
11053
  _this.setState({
11053
- colour: colour.toUpperCase()
11054
+ selectedColour: colour.toUpperCase()
11054
11055
  });
11055
-
11056
- _this.setColourCircle(colour);
11057
11056
  });
11058
11057
 
11059
11058
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onSelectOption", function (selectedOption) {
@@ -11063,15 +11062,34 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11063
11062
  });
11064
11063
 
11065
11064
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onDone", function () {
11065
+ var _this$state = _this.state,
11066
+ colourPickerOpen = _this$state.colourPickerOpen,
11067
+ selectedColour = _this$state.selectedColour;
11068
+
11066
11069
  _this.setState({
11067
- colourPickerOpen: !_this.state.colourPickerOpen
11070
+ colourPickerOpen: !colourPickerOpen,
11071
+ colour: selectedColour
11068
11072
  }, function () {
11073
+ _this.setColourCircle();
11074
+
11069
11075
  var onColourSelected = _this.props.onColourSelected;
11070
11076
  if (onColourSelected) onColourSelected(_this.state.colour);
11071
11077
  });
11072
11078
  });
11073
11079
 
11080
+ _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onCancel", function () {
11081
+ var _this$state2 = _this.state,
11082
+ colourPickerOpen = _this$state2.colourPickerOpen,
11083
+ colour = _this$state2.colour;
11084
+
11085
+ _this.setState({
11086
+ colourPickerOpen: !colourPickerOpen,
11087
+ selectedColour: colour
11088
+ });
11089
+ });
11090
+
11074
11091
  _this.state = {
11092
+ selectedColour: props.value,
11075
11093
  colour: props.value,
11076
11094
  selectedOption: props.defaultTab || 'vibrant',
11077
11095
  colourPickerOpen: false,
@@ -11082,12 +11100,19 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11082
11100
  }
11083
11101
 
11084
11102
  _createClass__default['default'](ColourPicker, [{
11103
+ key: "componentDidMount",
11104
+ value: function componentDidMount() {
11105
+ this.setColourCircle();
11106
+ }
11107
+ }, {
11085
11108
  key: "componentDidUpdate",
11086
11109
  value: function componentDidUpdate(prevProps) {
11087
11110
  if (this.props.value !== prevProps.value) {
11111
+ var value = this.props.value;
11088
11112
  this.setState({
11089
- colour: this.props.value
11090
- });
11113
+ selectedColour: value,
11114
+ colour: value
11115
+ }, this.setColourCircle);
11091
11116
  }
11092
11117
  }
11093
11118
  }, {
@@ -11133,10 +11158,12 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11133
11158
  }, {
11134
11159
  key: "renderColourOptions",
11135
11160
  value: function renderColourOptions() {
11161
+ var _this$state3 = this.state,
11162
+ selectedColour = _this$state3.selectedColour,
11163
+ selectedOption = _this$state3.selectedOption;
11136
11164
  var content;
11137
- var selectedColour = this.state.colour;
11138
11165
 
11139
- switch (this.state.selectedOption) {
11166
+ switch (selectedOption) {
11140
11167
  case 'picker':
11141
11168
  content = /*#__PURE__*/React__default['default'].createElement("div", {
11142
11169
  className: "flex flex-center-row colourQuickChoices",
@@ -11197,7 +11224,7 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11197
11224
  var tabs = this.getQuickChoiceTabs();
11198
11225
  return /*#__PURE__*/React__default['default'].createElement("div", null, tabs && tabs.length > 1 ? /*#__PURE__*/React__default['default'].createElement(Tabs, {
11199
11226
  onSelectTab: this.onSelectOption,
11200
- selectedTab: this.state.selectedOption,
11227
+ selectedTab: selectedOption,
11201
11228
  tabs: tabs
11202
11229
  }) : null, /*#__PURE__*/React__default['default'].createElement("div", {
11203
11230
  className: "flex flex-center flex-center-row"
@@ -11206,7 +11233,8 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11206
11233
  }, {
11207
11234
  key: "renderColourPopup",
11208
11235
  value: function renderColourPopup() {
11209
- if (!this.state.colourPickerOpen) return null;
11236
+ var colourPickerOpen = this.state.colourPickerOpen;
11237
+ if (!colourPickerOpen) return null;
11210
11238
  var title = this.props.title;
11211
11239
  return /*#__PURE__*/React__default['default'].createElement(Popup, {
11212
11240
  title: title || "Colour Picker",
@@ -11215,18 +11243,29 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11215
11243
  buttons: [{
11216
11244
  type: 'primary',
11217
11245
  onClick: this.onDone,
11246
+ style: {
11247
+ width: 100
11248
+ },
11218
11249
  isActive: true,
11219
11250
  text: 'Done'
11251
+ }, {
11252
+ type: 'outlinedAction',
11253
+ onClick: this.onCancel,
11254
+ style: {
11255
+ width: 100
11256
+ },
11257
+ isActive: true,
11258
+ text: 'Cancel'
11220
11259
  }]
11221
11260
  }, this.renderColourOptions());
11222
11261
  }
11223
11262
  }, {
11224
11263
  key: "render",
11225
11264
  value: function render() {
11226
- var _this$state = this.state,
11227
- colourCircleTop = _this$state.colourCircleTop,
11228
- colourCircleLeft = _this$state.colourCircleLeft,
11229
- colour = _this$state.colour;
11265
+ var _this$state4 = this.state,
11266
+ colourCircleTop = _this$state4.colourCircleTop,
11267
+ colourCircleLeft = _this$state4.colourCircleLeft,
11268
+ colour = _this$state4.colour;
11230
11269
  var _this$props = this.props,
11231
11270
  children = _this$props.children,
11232
11271
  showHex = _this$props.showHex;
package/dist/index.esm.js CHANGED
@@ -10995,8 +10995,8 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
10995
10995
 
10996
10996
  _this = _super.call(this, props);
10997
10997
 
10998
- _defineProperty(_assertThisInitialized(_this), "setColourCircle", function (colour) {
10999
- var tc = tinycolor(colour);
10998
+ _defineProperty(_assertThisInitialized(_this), "setColourCircle", function () {
10999
+ var tc = tinycolor(_this.state.colour);
11000
11000
 
11001
11001
  _this.setState({
11002
11002
  colourCircleTop: 100 - 100 * tc.getBrightness() / 255,
@@ -11013,6 +11013,7 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11013
11013
  });
11014
11014
 
11015
11015
  _defineProperty(_assertThisInitialized(_this), "onColourChange", function (color) {
11016
+ // console.log('onColourChange', color);
11016
11017
  var colour = color;
11017
11018
 
11018
11019
  if (_typeof(color) === 'object') {
@@ -11020,10 +11021,8 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11020
11021
  }
11021
11022
 
11022
11023
  _this.setState({
11023
- colour: colour.toUpperCase()
11024
+ selectedColour: colour.toUpperCase()
11024
11025
  });
11025
-
11026
- _this.setColourCircle(colour);
11027
11026
  });
11028
11027
 
11029
11028
  _defineProperty(_assertThisInitialized(_this), "onSelectOption", function (selectedOption) {
@@ -11033,15 +11032,34 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11033
11032
  });
11034
11033
 
11035
11034
  _defineProperty(_assertThisInitialized(_this), "onDone", function () {
11035
+ var _this$state = _this.state,
11036
+ colourPickerOpen = _this$state.colourPickerOpen,
11037
+ selectedColour = _this$state.selectedColour;
11038
+
11036
11039
  _this.setState({
11037
- colourPickerOpen: !_this.state.colourPickerOpen
11040
+ colourPickerOpen: !colourPickerOpen,
11041
+ colour: selectedColour
11038
11042
  }, function () {
11043
+ _this.setColourCircle();
11044
+
11039
11045
  var onColourSelected = _this.props.onColourSelected;
11040
11046
  if (onColourSelected) onColourSelected(_this.state.colour);
11041
11047
  });
11042
11048
  });
11043
11049
 
11050
+ _defineProperty(_assertThisInitialized(_this), "onCancel", function () {
11051
+ var _this$state2 = _this.state,
11052
+ colourPickerOpen = _this$state2.colourPickerOpen,
11053
+ colour = _this$state2.colour;
11054
+
11055
+ _this.setState({
11056
+ colourPickerOpen: !colourPickerOpen,
11057
+ selectedColour: colour
11058
+ });
11059
+ });
11060
+
11044
11061
  _this.state = {
11062
+ selectedColour: props.value,
11045
11063
  colour: props.value,
11046
11064
  selectedOption: props.defaultTab || 'vibrant',
11047
11065
  colourPickerOpen: false,
@@ -11052,12 +11070,19 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11052
11070
  }
11053
11071
 
11054
11072
  _createClass(ColourPicker, [{
11073
+ key: "componentDidMount",
11074
+ value: function componentDidMount() {
11075
+ this.setColourCircle();
11076
+ }
11077
+ }, {
11055
11078
  key: "componentDidUpdate",
11056
11079
  value: function componentDidUpdate(prevProps) {
11057
11080
  if (this.props.value !== prevProps.value) {
11081
+ var value = this.props.value;
11058
11082
  this.setState({
11059
- colour: this.props.value
11060
- });
11083
+ selectedColour: value,
11084
+ colour: value
11085
+ }, this.setColourCircle);
11061
11086
  }
11062
11087
  }
11063
11088
  }, {
@@ -11103,10 +11128,12 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11103
11128
  }, {
11104
11129
  key: "renderColourOptions",
11105
11130
  value: function renderColourOptions() {
11131
+ var _this$state3 = this.state,
11132
+ selectedColour = _this$state3.selectedColour,
11133
+ selectedOption = _this$state3.selectedOption;
11106
11134
  var content;
11107
- var selectedColour = this.state.colour;
11108
11135
 
11109
- switch (this.state.selectedOption) {
11136
+ switch (selectedOption) {
11110
11137
  case 'picker':
11111
11138
  content = /*#__PURE__*/React.createElement("div", {
11112
11139
  className: "flex flex-center-row colourQuickChoices",
@@ -11167,7 +11194,7 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11167
11194
  var tabs = this.getQuickChoiceTabs();
11168
11195
  return /*#__PURE__*/React.createElement("div", null, tabs && tabs.length > 1 ? /*#__PURE__*/React.createElement(Tabs, {
11169
11196
  onSelectTab: this.onSelectOption,
11170
- selectedTab: this.state.selectedOption,
11197
+ selectedTab: selectedOption,
11171
11198
  tabs: tabs
11172
11199
  }) : null, /*#__PURE__*/React.createElement("div", {
11173
11200
  className: "flex flex-center flex-center-row"
@@ -11176,7 +11203,8 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11176
11203
  }, {
11177
11204
  key: "renderColourPopup",
11178
11205
  value: function renderColourPopup() {
11179
- if (!this.state.colourPickerOpen) return null;
11206
+ var colourPickerOpen = this.state.colourPickerOpen;
11207
+ if (!colourPickerOpen) return null;
11180
11208
  var title = this.props.title;
11181
11209
  return /*#__PURE__*/React.createElement(Popup, {
11182
11210
  title: title || "Colour Picker",
@@ -11185,18 +11213,29 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
11185
11213
  buttons: [{
11186
11214
  type: 'primary',
11187
11215
  onClick: this.onDone,
11216
+ style: {
11217
+ width: 100
11218
+ },
11188
11219
  isActive: true,
11189
11220
  text: 'Done'
11221
+ }, {
11222
+ type: 'outlinedAction',
11223
+ onClick: this.onCancel,
11224
+ style: {
11225
+ width: 100
11226
+ },
11227
+ isActive: true,
11228
+ text: 'Cancel'
11190
11229
  }]
11191
11230
  }, this.renderColourOptions());
11192
11231
  }
11193
11232
  }, {
11194
11233
  key: "render",
11195
11234
  value: function render() {
11196
- var _this$state = this.state,
11197
- colourCircleTop = _this$state.colourCircleTop,
11198
- colourCircleLeft = _this$state.colourCircleLeft,
11199
- colour = _this$state.colour;
11235
+ var _this$state4 = this.state,
11236
+ colourCircleTop = _this$state4.colourCircleTop,
11237
+ colourCircleLeft = _this$state4.colourCircleLeft,
11238
+ colour = _this$state4.colour;
11200
11239
  var _this$props = this.props,
11201
11240
  children = _this$props.children,
11202
11241
  showHex = _this$props.showHex;
package/dist/index.umd.js CHANGED
@@ -10996,8 +10996,8 @@
10996
10996
 
10997
10997
  _this = _super.call(this, props);
10998
10998
 
10999
- _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "setColourCircle", function (colour) {
11000
- var tc = tinycolor__default['default'](colour);
10999
+ _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "setColourCircle", function () {
11000
+ var tc = tinycolor__default['default'](_this.state.colour);
11001
11001
 
11002
11002
  _this.setState({
11003
11003
  colourCircleTop: 100 - 100 * tc.getBrightness() / 255,
@@ -11014,6 +11014,7 @@
11014
11014
  });
11015
11015
 
11016
11016
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onColourChange", function (color) {
11017
+ // console.log('onColourChange', color);
11017
11018
  var colour = color;
11018
11019
 
11019
11020
  if (_typeof__default['default'](color) === 'object') {
@@ -11021,10 +11022,8 @@
11021
11022
  }
11022
11023
 
11023
11024
  _this.setState({
11024
- colour: colour.toUpperCase()
11025
+ selectedColour: colour.toUpperCase()
11025
11026
  });
11026
-
11027
- _this.setColourCircle(colour);
11028
11027
  });
11029
11028
 
11030
11029
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onSelectOption", function (selectedOption) {
@@ -11034,15 +11033,34 @@
11034
11033
  });
11035
11034
 
11036
11035
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onDone", function () {
11036
+ var _this$state = _this.state,
11037
+ colourPickerOpen = _this$state.colourPickerOpen,
11038
+ selectedColour = _this$state.selectedColour;
11039
+
11037
11040
  _this.setState({
11038
- colourPickerOpen: !_this.state.colourPickerOpen
11041
+ colourPickerOpen: !colourPickerOpen,
11042
+ colour: selectedColour
11039
11043
  }, function () {
11044
+ _this.setColourCircle();
11045
+
11040
11046
  var onColourSelected = _this.props.onColourSelected;
11041
11047
  if (onColourSelected) onColourSelected(_this.state.colour);
11042
11048
  });
11043
11049
  });
11044
11050
 
11051
+ _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onCancel", function () {
11052
+ var _this$state2 = _this.state,
11053
+ colourPickerOpen = _this$state2.colourPickerOpen,
11054
+ colour = _this$state2.colour;
11055
+
11056
+ _this.setState({
11057
+ colourPickerOpen: !colourPickerOpen,
11058
+ selectedColour: colour
11059
+ });
11060
+ });
11061
+
11045
11062
  _this.state = {
11063
+ selectedColour: props.value,
11046
11064
  colour: props.value,
11047
11065
  selectedOption: props.defaultTab || 'vibrant',
11048
11066
  colourPickerOpen: false,
@@ -11053,12 +11071,19 @@
11053
11071
  }
11054
11072
 
11055
11073
  _createClass__default['default'](ColourPicker, [{
11074
+ key: "componentDidMount",
11075
+ value: function componentDidMount() {
11076
+ this.setColourCircle();
11077
+ }
11078
+ }, {
11056
11079
  key: "componentDidUpdate",
11057
11080
  value: function componentDidUpdate(prevProps) {
11058
11081
  if (this.props.value !== prevProps.value) {
11082
+ var value = this.props.value;
11059
11083
  this.setState({
11060
- colour: this.props.value
11061
- });
11084
+ selectedColour: value,
11085
+ colour: value
11086
+ }, this.setColourCircle);
11062
11087
  }
11063
11088
  }
11064
11089
  }, {
@@ -11104,10 +11129,12 @@
11104
11129
  }, {
11105
11130
  key: "renderColourOptions",
11106
11131
  value: function renderColourOptions() {
11132
+ var _this$state3 = this.state,
11133
+ selectedColour = _this$state3.selectedColour,
11134
+ selectedOption = _this$state3.selectedOption;
11107
11135
  var content;
11108
- var selectedColour = this.state.colour;
11109
11136
 
11110
- switch (this.state.selectedOption) {
11137
+ switch (selectedOption) {
11111
11138
  case 'picker':
11112
11139
  content = /*#__PURE__*/React__default['default'].createElement("div", {
11113
11140
  className: "flex flex-center-row colourQuickChoices",
@@ -11168,7 +11195,7 @@
11168
11195
  var tabs = this.getQuickChoiceTabs();
11169
11196
  return /*#__PURE__*/React__default['default'].createElement("div", null, tabs && tabs.length > 1 ? /*#__PURE__*/React__default['default'].createElement(Tabs, {
11170
11197
  onSelectTab: this.onSelectOption,
11171
- selectedTab: this.state.selectedOption,
11198
+ selectedTab: selectedOption,
11172
11199
  tabs: tabs
11173
11200
  }) : null, /*#__PURE__*/React__default['default'].createElement("div", {
11174
11201
  className: "flex flex-center flex-center-row"
@@ -11177,7 +11204,8 @@
11177
11204
  }, {
11178
11205
  key: "renderColourPopup",
11179
11206
  value: function renderColourPopup() {
11180
- if (!this.state.colourPickerOpen) return null;
11207
+ var colourPickerOpen = this.state.colourPickerOpen;
11208
+ if (!colourPickerOpen) return null;
11181
11209
  var title = this.props.title;
11182
11210
  return /*#__PURE__*/React__default['default'].createElement(Popup, {
11183
11211
  title: title || "Colour Picker",
@@ -11186,18 +11214,29 @@
11186
11214
  buttons: [{
11187
11215
  type: 'primary',
11188
11216
  onClick: this.onDone,
11217
+ style: {
11218
+ width: 100
11219
+ },
11189
11220
  isActive: true,
11190
11221
  text: 'Done'
11222
+ }, {
11223
+ type: 'outlinedAction',
11224
+ onClick: this.onCancel,
11225
+ style: {
11226
+ width: 100
11227
+ },
11228
+ isActive: true,
11229
+ text: 'Cancel'
11191
11230
  }]
11192
11231
  }, this.renderColourOptions());
11193
11232
  }
11194
11233
  }, {
11195
11234
  key: "render",
11196
11235
  value: function render() {
11197
- var _this$state = this.state,
11198
- colourCircleTop = _this$state.colourCircleTop,
11199
- colourCircleLeft = _this$state.colourCircleLeft,
11200
- colour = _this$state.colour;
11236
+ var _this$state4 = this.state,
11237
+ colourCircleTop = _this$state4.colourCircleTop,
11238
+ colourCircleLeft = _this$state4.colourCircleLeft,
11239
+ colour = _this$state4.colour;
11201
11240
  var _this$props = this.props,
11202
11241
  children = _this$props.children,
11203
11242
  showHex = _this$props.showHex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-core-web",
3
- "version": "1.4.6-beta.0",
3
+ "version": "1.4.9-beta.0",
4
4
  "description": "Core extension package for Pluss Communities platform",
5
5
  "main": "dist/index.cjs.js",
6
6
  "scripts": {
@@ -10,6 +10,7 @@ class ColourPicker extends Component {
10
10
  constructor(props) {
11
11
  super(props);
12
12
  this.state = {
13
+ selectedColour: props.value,
13
14
  colour: props.value,
14
15
  selectedOption: props.defaultTab || 'vibrant',
15
16
  colourPickerOpen: false,
@@ -18,14 +19,19 @@ class ColourPicker extends Component {
18
19
  };
19
20
  }
20
21
 
22
+ componentDidMount() {
23
+ this.setColourCircle();
24
+ }
25
+
21
26
  componentDidUpdate(prevProps) {
22
27
  if (this.props.value !== prevProps.value) {
23
- this.setState({ colour: this.props.value });
28
+ const { value } = this.props;
29
+ this.setState({ selectedColour: value, colour: value }, this.setColourCircle);
24
30
  }
25
31
  }
26
32
 
27
- setColourCircle = (colour) => {
28
- const tc = tinycolor(colour);
33
+ setColourCircle = () => {
34
+ const tc = tinycolor(this.state.colour);
29
35
  this.setState({
30
36
  colourCircleTop: 100 - (100 * tc.getBrightness()) / 255,
31
37
  colourCircleLeft: (100 * tc.toHsv().h) / 360,
@@ -58,12 +64,12 @@ class ColourPicker extends Component {
58
64
  };
59
65
 
60
66
  onColourChange = (color) => {
67
+ // console.log('onColourChange', color);
61
68
  let colour = color;
62
69
  if (typeof color === 'object') {
63
70
  colour = color.hex;
64
71
  }
65
- this.setState({ colour: colour.toUpperCase() });
66
- this.setColourCircle(colour);
72
+ this.setState({ selectedColour: colour.toUpperCase() });
67
73
  };
68
74
 
69
75
  onSelectOption = (selectedOption) => {
@@ -71,12 +77,20 @@ class ColourPicker extends Component {
71
77
  };
72
78
 
73
79
  onDone = () => {
74
- this.setState({ colourPickerOpen: !this.state.colourPickerOpen }, () => {
80
+ const { colourPickerOpen, selectedColour } = this.state;
81
+ this.setState({ colourPickerOpen: !colourPickerOpen, colour: selectedColour }, () => {
82
+ this.setColourCircle();
83
+
75
84
  const { onColourSelected } = this.props;
76
85
  if (onColourSelected) onColourSelected(this.state.colour);
77
86
  });
78
87
  };
79
88
 
89
+ onCancel = () => {
90
+ const { colourPickerOpen, colour } = this.state;
91
+ this.setState({ colourPickerOpen: !colourPickerOpen, selectedColour: colour });
92
+ };
93
+
80
94
  renderColourQuickChoicesCircle(colour, selectedColour) {
81
95
  const isSelected = selectedColour.toLowerCase() === colour.toLowerCase();
82
96
  return (
@@ -91,9 +105,10 @@ class ColourPicker extends Component {
91
105
  }
92
106
 
93
107
  renderColourOptions() {
108
+ const { selectedColour, selectedOption } = this.state;
109
+
94
110
  let content;
95
- const selectedColour = this.state.colour;
96
- switch (this.state.selectedOption) {
111
+ switch (selectedOption) {
97
112
  case 'picker':
98
113
  content = (
99
114
  <div className="flex flex-center-row colourQuickChoices" style={{ marginBottom: 'unset' }}>
@@ -181,14 +196,15 @@ class ColourPicker extends Component {
181
196
 
182
197
  return (
183
198
  <div>
184
- {tabs && tabs.length > 1 ? <Tabs onSelectTab={this.onSelectOption} selectedTab={this.state.selectedOption} tabs={tabs} /> : null}
199
+ {tabs && tabs.length > 1 ? <Tabs onSelectTab={this.onSelectOption} selectedTab={selectedOption} tabs={tabs} /> : null}
185
200
  <div className="flex flex-center flex-center-row">{content}</div>
186
201
  </div>
187
202
  );
188
203
  }
189
204
 
190
205
  renderColourPopup() {
191
- if (!this.state.colourPickerOpen) return null;
206
+ const { colourPickerOpen } = this.state;
207
+ if (!colourPickerOpen) return null;
192
208
  const { title } = this.props;
193
209
 
194
210
  return (
@@ -200,9 +216,17 @@ class ColourPicker extends Component {
200
216
  {
201
217
  type: 'primary',
202
218
  onClick: this.onDone,
219
+ style: { width: 100 },
203
220
  isActive: true,
204
221
  text: 'Done',
205
222
  },
223
+ {
224
+ type: 'outlinedAction',
225
+ onClick: this.onCancel,
226
+ style: { width: 100 },
227
+ isActive: true,
228
+ text: 'Cancel',
229
+ },
206
230
  ]}
207
231
  >
208
232
  {this.renderColourOptions()}