td-stylekit 28.28.0 → 28.28.1

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,3 +1,10 @@
1
+ ## [28.28.1](https://github.com/treasure-data/td-stylekit/compare/v28.28.0...v28.28.1) (2023-11-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **CON-14322:** Add conditional chaining to multiselect disabled check ([#1509](https://github.com/treasure-data/td-stylekit/issues/1509)) ([928d115](https://github.com/treasure-data/td-stylekit/commit/928d115))
7
+
1
8
  # [28.28.0](https://github.com/treasure-data/td-stylekit/compare/v28.27.0...v28.28.0) (2023-11-02)
2
9
 
3
10
 
@@ -79,6 +79,8 @@ var MultiSelect = /*#__PURE__*/function (_React$Component) {
79
79
  _this = _super.call(this, _props);
80
80
 
81
81
  _defineProperty(_assertThisInitialized(_this), "select", function (_ref) {
82
+ var _this$props$options$i;
83
+
82
84
  var index = _ref.index,
83
85
  _ref$contiguous = _ref.contiguous,
84
86
  contiguous = _ref$contiguous === void 0 ? false : _ref$contiguous;
@@ -88,7 +90,7 @@ var MultiSelect = /*#__PURE__*/function (_React$Component) {
88
90
  } // if the item is disabled - do not allow it to be selected
89
91
 
90
92
 
91
- if (_this.props.options[index].disabled && !contiguous) {
93
+ if ((_this$props$options$i = _this.props.options[index]) !== null && _this$props$options$i !== void 0 && _this$props$options$i.disabled && !contiguous) {
92
94
  return;
93
95
  }
94
96
 
@@ -104,7 +106,9 @@ var MultiSelect = /*#__PURE__*/function (_React$Component) {
104
106
 
105
107
 
106
108
  var sansDisabled = selected.filter(function (option) {
107
- return !_this.props.options[option].disabled;
109
+ var _this$props$options$o;
110
+
111
+ return !((_this$props$options$o = _this.props.options[option]) !== null && _this$props$options$o !== void 0 && _this$props$options$o.disabled);
108
112
  });
109
113
  return {
110
114
  selected: sansDisabled,
@@ -116,6 +120,8 @@ var MultiSelect = /*#__PURE__*/function (_React$Component) {
116
120
  });
117
121
 
118
122
  _defineProperty(_assertThisInitialized(_this), "deselect", function (_ref2) {
123
+ var _this$props$options$i2;
124
+
119
125
  var index = _ref2.index,
120
126
  _ref2$contiguous = _ref2.contiguous,
121
127
  contiguous = _ref2$contiguous === void 0 ? false : _ref2$contiguous;
@@ -125,7 +131,7 @@ var MultiSelect = /*#__PURE__*/function (_React$Component) {
125
131
  } // if the item is disabled - do not allow it to be deselected
126
132
 
127
133
 
128
- if (_this.props.options[index].disabled && !contiguous) {
134
+ if ((_this$props$options$i2 = _this.props.options[index]) !== null && _this$props$options$i2 !== void 0 && _this$props$options$i2.disabled && !contiguous) {
129
135
  return;
130
136
  }
131
137
 
@@ -183,7 +189,7 @@ var MultiSelect = /*#__PURE__*/function (_React$Component) {
183
189
 
184
190
  if (_this.state.focusedIndex) {
185
191
  var next = (0, _lodash5["default"])(_this.props.options, function (option) {
186
- return !option.disabled;
192
+ return !(option !== null && option !== void 0 && option.disabled);
187
193
  }, _this.state.focusedIndex - 1);
188
194
  nextIndex = next !== -1 ? next : _this.state.focusedIndex;
189
195
  }
@@ -200,7 +206,7 @@ var MultiSelect = /*#__PURE__*/function (_React$Component) {
200
206
 
201
207
  if (_this.state.focusedIndex) {
202
208
  var next = (0, _lodash4["default"])(_this.props.options, function (option) {
203
- return !option.disabled;
209
+ return !(option !== null && option !== void 0 && option.disabled);
204
210
  }, _this.state.focusedIndex + 1);
205
211
  nextIndex = next !== -1 ? next : _this.state.focusedIndex;
206
212
  }
@@ -305,7 +311,7 @@ var MultiSelect = /*#__PURE__*/function (_React$Component) {
305
311
  });
306
312
 
307
313
  _defineProperty(_assertThisInitialized(_this), "rowRender", function (_ref4) {
308
- var _options$index$disabl;
314
+ var _options$index$disabl, _options$index;
309
315
 
310
316
  var index = _ref4.index,
311
317
  key = _ref4.key,
@@ -317,7 +323,7 @@ var MultiSelect = /*#__PURE__*/function (_React$Component) {
317
323
  options = _this$props.options,
318
324
  dataInstrumentation = _this$props['data-instrumentation'],
319
325
  rowRenderer = _this$props.rowRenderer;
320
- var isDisabled = (_options$index$disabl = options[index].disabled) !== null && _options$index$disabl !== void 0 ? _options$index$disabl : false;
326
+ var isDisabled = (_options$index$disabl = (_options$index = options[index]) === null || _options$index === void 0 ? void 0 : _options$index.disabled) !== null && _options$index$disabl !== void 0 ? _options$index$disabl : false;
321
327
  var isSelected = (0, _lodash["default"])(selected, index) && !isDisabled;
322
328
  return (0, _jsxRuntime.jsx)(_elements.ListItem, {
323
329
  "data-gs-c": gsC(rowRenderer({
@@ -383,7 +389,7 @@ var MultiSelect = /*#__PURE__*/function (_React$Component) {
383
389
  var _this3 = this;
384
390
 
385
391
  var selectedIndices = this.props.options.reduce(function (list, option, index) {
386
- if (!option.disabled) {
392
+ if (!(option !== null && option !== void 0 && option.disabled)) {
387
393
  list.push(index);
388
394
  }
389
395
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "td-stylekit",
3
- "version": "28.28.0",
3
+ "version": "28.28.1",
4
4
  "main": "dist/es/index.js",
5
5
  "module": "dist/es/index.js",
6
6
  "types": "dist/es/index.d.ts",