@instructure/ui-tabs 8.25.1-snapshot-7 → 8.25.1-snapshot-10

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
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [8.25.1-snapshot-7](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-7) (2022-06-13)
6
+ ## [8.25.1-snapshot-10](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-10) (2022-06-20)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-tabs
9
9
 
@@ -1,7 +1,7 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["labelledBy", "variant", "id", "maxHeight", "minHeight", "padding", "textAlign", "children", "elementRef", "isDisabled", "isSelected", "styles"];
3
3
 
4
- var _dec, _class, _class2;
4
+ var _dec, _class;
5
5
 
6
6
  /*
7
7
  * The MIT License (MIT)
@@ -44,20 +44,18 @@ id: Tabs.Panel
44
44
  @tsProps
45
45
  **/
46
46
 
47
- let Panel = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_class2 = class Panel extends Component {
48
- constructor() {
49
- super(...arguments);
50
- this.ref = null;
51
-
52
- this.handleRef = el => {
53
- const elementRef = this.props.elementRef;
54
- this.ref = el;
55
-
56
- if (typeof elementRef === 'function') {
57
- elementRef(el);
58
- }
59
- };
60
- }
47
+ let Panel = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Panel extends Component {
48
+ static displayName = "Panel";
49
+ static componentId = 'Tabs.Panel';
50
+ static allowedProps = allowedProps;
51
+ static propTypes = propTypes;
52
+ static defaultProps = {
53
+ isDisabled: false,
54
+ textAlign: 'start',
55
+ variant: 'default',
56
+ isSelected: false,
57
+ padding: 'small'
58
+ };
61
59
 
62
60
  componentDidMount() {
63
61
  var _this$props$makeStyle, _this$props;
@@ -71,6 +69,16 @@ let Panel = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
71
69
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
72
70
  }
73
71
 
72
+ ref = null;
73
+ handleRef = el => {
74
+ const elementRef = this.props.elementRef;
75
+ this.ref = el;
76
+
77
+ if (typeof elementRef === 'function') {
78
+ elementRef(el);
79
+ }
80
+ };
81
+
74
82
  render() {
75
83
  const _this$props3 = this.props,
76
84
  labelledBy = _this$props3.labelledBy,
@@ -110,12 +118,6 @@ let Panel = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
110
118
  }, children)));
111
119
  }
112
120
 
113
- }, _class2.displayName = "Panel", _class2.componentId = 'Tabs.Panel', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
114
- isDisabled: false,
115
- textAlign: 'start',
116
- variant: 'default',
117
- isSelected: false,
118
- padding: 'small'
119
- }, _class2)) || _class);
121
+ }) || _class);
120
122
  export default Panel;
121
123
  export { Panel };
@@ -1,7 +1,7 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["id", "variant", "isSelected", "isDisabled", "controls", "children", "styles"];
3
3
 
4
- var _dec, _class, _class2;
4
+ var _dec, _class;
5
5
 
6
6
  /*
7
7
  * The MIT License (MIT)
@@ -43,61 +43,66 @@ id: Tabs.Tab
43
43
  @tsProps
44
44
  **/
45
45
 
46
- let Tab = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_class2 = class Tab extends Component {
47
- constructor() {
48
- super(...arguments);
49
-
50
- this.handleClick = event => {
51
- const _this$props = this.props,
52
- onClick = _this$props.onClick,
53
- index = _this$props.index,
54
- id = _this$props.id,
55
- isDisabled = _this$props.isDisabled;
56
-
57
- if (isDisabled) {
58
- return;
59
- }
60
-
61
- if (typeof onClick === 'function') {
62
- onClick(event, {
63
- index,
64
- id
65
- });
66
- }
67
- };
68
-
69
- this.handleKeyDown = event => {
70
- const _this$props2 = this.props,
71
- onKeyDown = _this$props2.onKeyDown,
72
- index = _this$props2.index,
73
- id = _this$props2.id,
74
- isDisabled = _this$props2.isDisabled;
75
-
76
- if (isDisabled) {
77
- return;
78
- }
79
-
80
- if (typeof onKeyDown === 'function') {
81
- onKeyDown(event, {
82
- index,
83
- id
84
- });
85
- }
86
- };
87
- }
46
+ let Tab = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Tab extends Component {
47
+ static displayName = "Tab";
48
+ static componentId = 'Tabs.Tab';
49
+ static allowedProps = allowedProps;
50
+ static propTypes = propTypes;
51
+ static defaultProps = {
52
+ variant: 'default',
53
+ isDisabled: false,
54
+ isSelected: false
55
+ };
88
56
 
89
57
  componentDidMount() {
90
- var _this$props$makeStyle, _this$props3;
58
+ var _this$props$makeStyle, _this$props;
91
59
 
92
- (_this$props$makeStyle = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props3);
60
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
93
61
  }
94
62
 
95
63
  componentDidUpdate() {
96
- var _this$props$makeStyle2, _this$props4;
64
+ var _this$props$makeStyle2, _this$props2;
97
65
 
98
- (_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4);
66
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
99
67
  }
100
68
 
69
+ handleClick = event => {
70
+ const _this$props3 = this.props,
71
+ onClick = _this$props3.onClick,
72
+ index = _this$props3.index,
73
+ id = _this$props3.id,
74
+ isDisabled = _this$props3.isDisabled;
75
+
76
+ if (isDisabled) {
77
+ return;
78
+ }
79
+
80
+ if (typeof onClick === 'function') {
81
+ onClick(event, {
82
+ index,
83
+ id
84
+ });
85
+ }
86
+ };
87
+ handleKeyDown = event => {
88
+ const _this$props4 = this.props,
89
+ onKeyDown = _this$props4.onKeyDown,
90
+ index = _this$props4.index,
91
+ id = _this$props4.id,
92
+ isDisabled = _this$props4.isDisabled;
93
+
94
+ if (isDisabled) {
95
+ return;
96
+ }
97
+
98
+ if (typeof onKeyDown === 'function') {
99
+ onKeyDown(event, {
100
+ index,
101
+ id
102
+ });
103
+ }
104
+ };
105
+
101
106
  render() {
102
107
  const _this$props5 = this.props,
103
108
  id = _this$props5.id,
@@ -125,10 +130,6 @@ let Tab = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
125
130
  }), callRenderProp(children));
126
131
  }
127
132
 
128
- }, _class2.displayName = "Tab", _class2.componentId = 'Tabs.Tab', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
129
- variant: 'default',
130
- isDisabled: false,
131
- isSelected: false
132
- }, _class2)) || _class);
133
+ }) || _class);
133
134
  export default Tab;
134
135
  export { Tab };
package/es/Tabs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["children", "elementRef", "maxWidth", "variant", "margin", "screenReaderLabel", "onRequestTabChange", "tabOverflow", "styles"];
3
3
 
4
- var _dec, _dec2, _dec3, _class, _class2;
4
+ var _dec, _dec2, _dec3, _class;
5
5
 
6
6
  /*
7
7
  * The MIT License (MIT)
@@ -53,64 +53,35 @@ category: components
53
53
  ---
54
54
  @tsProps
55
55
  **/
56
- let Tabs = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = textDirectionContextConsumer(), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Tabs extends Component {
56
+ let Tabs = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = textDirectionContextConsumer(), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = class Tabs extends Component {
57
+ static displayName = "Tabs";
58
+ static componentId = 'Tabs';
59
+ static allowedProps = allowedProps;
60
+ static propTypes = propTypes;
61
+ static defaultProps = {
62
+ variant: 'default',
63
+ shouldFocusOnRender: false,
64
+ tabOverflow: 'stack'
65
+ };
66
+ static Panel = Panel;
67
+ static Tab = Tab;
68
+ _tabList = null;
69
+ _focusable = null;
70
+ _tabListPosition;
71
+ _debounced;
72
+ _resizeListener;
73
+ ref = null;
74
+ handleRef = el => {
75
+ const elementRef = this.props.elementRef;
76
+ this.ref = el;
77
+
78
+ if (typeof elementRef === 'function') {
79
+ elementRef(el);
80
+ }
81
+ };
82
+
57
83
  constructor(props) {
58
84
  super(props);
59
- this._tabList = null;
60
- this._focusable = null;
61
- this._tabListPosition = void 0;
62
- this._debounced = void 0;
63
- this._resizeListener = void 0;
64
- this.ref = null;
65
-
66
- this.handleRef = el => {
67
- const elementRef = this.props.elementRef;
68
- this.ref = el;
69
-
70
- if (typeof elementRef === 'function') {
71
- elementRef(el);
72
- }
73
- };
74
-
75
- this.handleTabClick = (event, _ref) => {
76
- let index = _ref.index;
77
- const nextTab = this.getNextTab(index, 0);
78
- this.fireOnChange(event, nextTab);
79
- };
80
-
81
- this.handleTabKeyDown = (event, _ref2) => {
82
- let index = _ref2.index;
83
- let nextTab;
84
-
85
- if (event.keyCode === keycode.codes.up || event.keyCode === keycode.codes.left) {
86
- // Select next tab to the left
87
- nextTab = this.getNextTab(index, -1);
88
- } else if (event.keyCode === keycode.codes.down || event.keyCode === keycode.codes.right) {
89
- // Select next tab to the right
90
- nextTab = this.getNextTab(index, 1);
91
- }
92
-
93
- if (nextTab) {
94
- event.preventDefault();
95
- this.fireOnChange(event, nextTab);
96
- }
97
- };
98
-
99
- this.handleResize = () => {
100
- this.setState({
101
- withTabListOverflow: this._tabList.scrollWidth > this._tabList.offsetWidth
102
- });
103
- this._tabListPosition = getBoundingClientRect(this._tabList);
104
- };
105
-
106
- this.handleFocusableRef = el => {
107
- this._focusable = el;
108
- };
109
-
110
- this.handleTabListRef = el => {
111
- this._tabList = el;
112
- };
113
-
114
85
  this.state = {
115
86
  withTabListOverflow: false
116
87
  };
@@ -248,6 +219,35 @@ let Tabs = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tex
248
219
  }
249
220
  }
250
221
 
222
+ handleTabClick = (event, _ref) => {
223
+ let index = _ref.index;
224
+ const nextTab = this.getNextTab(index, 0);
225
+ this.fireOnChange(event, nextTab);
226
+ };
227
+ handleTabKeyDown = (event, _ref2) => {
228
+ let index = _ref2.index;
229
+ let nextTab;
230
+
231
+ if (event.keyCode === keycode.codes.up || event.keyCode === keycode.codes.left) {
232
+ // Select next tab to the left
233
+ nextTab = this.getNextTab(index, -1);
234
+ } else if (event.keyCode === keycode.codes.down || event.keyCode === keycode.codes.right) {
235
+ // Select next tab to the right
236
+ nextTab = this.getNextTab(index, 1);
237
+ }
238
+
239
+ if (nextTab) {
240
+ event.preventDefault();
241
+ this.fireOnChange(event, nextTab);
242
+ }
243
+ };
244
+ handleResize = () => {
245
+ this.setState({
246
+ withTabListOverflow: this._tabList.scrollWidth > this._tabList.offsetWidth
247
+ });
248
+ this._tabListPosition = getBoundingClientRect(this._tabList);
249
+ };
250
+
251
251
  getNextTab(startIndex, step) {
252
252
  const tabs = React.Children.toArray(this.props.children).map(child => matchComponentTypes(child, [Panel]) && child);
253
253
  const count = tabs.length;
@@ -315,6 +315,13 @@ let Tabs = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tex
315
315
  });
316
316
  }
317
317
 
318
+ handleFocusableRef = el => {
319
+ this._focusable = el;
320
+ };
321
+ handleTabListRef = el => {
322
+ this._tabList = el;
323
+ };
324
+
318
325
  focus() {
319
326
  this._focusable && typeof this._focusable.focus === 'function' && this._focusable.focus();
320
327
  }
@@ -385,10 +392,6 @@ let Tabs = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tex
385
392
  }, panels));
386
393
  }
387
394
 
388
- }, _class2.displayName = "Tabs", _class2.componentId = 'Tabs', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
389
- variant: 'default',
390
- shouldFocusOnRender: false,
391
- tabOverflow: 'stack'
392
- }, _class2.Panel = Panel, _class2.Tab = Tab, _class2)) || _class) || _class) || _class);
395
+ }) || _class) || _class) || _class);
393
396
  export default Tabs;
394
397
  export { Tabs, Panel };
@@ -27,7 +27,7 @@ var _props = require("./props");
27
27
 
28
28
  const _excluded = ["labelledBy", "variant", "id", "maxHeight", "minHeight", "padding", "textAlign", "children", "elementRef", "isDisabled", "isSelected", "styles"];
29
29
 
30
- var _dec, _class, _class2;
30
+ var _dec, _class;
31
31
 
32
32
  /**
33
33
  ---
@@ -36,20 +36,18 @@ id: Tabs.Panel
36
36
  ---
37
37
  @tsProps
38
38
  **/
39
- let Panel = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_class2 = class Panel extends _react.Component {
40
- constructor() {
41
- super(...arguments);
42
- this.ref = null;
43
-
44
- this.handleRef = el => {
45
- const elementRef = this.props.elementRef;
46
- this.ref = el;
47
-
48
- if (typeof elementRef === 'function') {
49
- elementRef(el);
50
- }
51
- };
52
- }
39
+ let Panel = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = class Panel extends _react.Component {
40
+ static displayName = "Panel";
41
+ static componentId = 'Tabs.Panel';
42
+ static allowedProps = _props.allowedProps;
43
+ static propTypes = _props.propTypes;
44
+ static defaultProps = {
45
+ isDisabled: false,
46
+ textAlign: 'start',
47
+ variant: 'default',
48
+ isSelected: false,
49
+ padding: 'small'
50
+ };
53
51
 
54
52
  componentDidMount() {
55
53
  var _this$props$makeStyle, _this$props;
@@ -63,6 +61,16 @@ let Panel = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
63
61
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
64
62
  }
65
63
 
64
+ ref = null;
65
+ handleRef = el => {
66
+ const elementRef = this.props.elementRef;
67
+ this.ref = el;
68
+
69
+ if (typeof elementRef === 'function') {
70
+ elementRef(el);
71
+ }
72
+ };
73
+
66
74
  render() {
67
75
  const _this$props3 = this.props,
68
76
  labelledBy = _this$props3.labelledBy,
@@ -101,13 +109,7 @@ let Panel = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
101
109
  }, children)));
102
110
  }
103
111
 
104
- }, _class2.displayName = "Panel", _class2.componentId = 'Tabs.Panel', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
105
- isDisabled: false,
106
- textAlign: 'start',
107
- variant: 'default',
108
- isSelected: false,
109
- padding: 'small'
110
- }, _class2)) || _class);
112
+ }) || _class);
111
113
  exports.Panel = Panel;
112
114
  var _default = Panel;
113
115
  exports.default = _default;
@@ -29,7 +29,7 @@ var _props = require("./props");
29
29
 
30
30
  const _excluded = ["id", "variant", "isSelected", "isDisabled", "controls", "children", "styles"];
31
31
 
32
- var _dec, _class, _class2;
32
+ var _dec, _class;
33
33
 
34
34
  /**
35
35
  ---
@@ -38,61 +38,66 @@ id: Tabs.Tab
38
38
  ---
39
39
  @tsProps
40
40
  **/
41
- let Tab = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_class2 = class Tab extends _react.Component {
42
- constructor() {
43
- super(...arguments);
44
-
45
- this.handleClick = event => {
46
- const _this$props = this.props,
47
- onClick = _this$props.onClick,
48
- index = _this$props.index,
49
- id = _this$props.id,
50
- isDisabled = _this$props.isDisabled;
51
-
52
- if (isDisabled) {
53
- return;
54
- }
55
-
56
- if (typeof onClick === 'function') {
57
- onClick(event, {
58
- index,
59
- id
60
- });
61
- }
62
- };
63
-
64
- this.handleKeyDown = event => {
65
- const _this$props2 = this.props,
66
- onKeyDown = _this$props2.onKeyDown,
67
- index = _this$props2.index,
68
- id = _this$props2.id,
69
- isDisabled = _this$props2.isDisabled;
70
-
71
- if (isDisabled) {
72
- return;
73
- }
74
-
75
- if (typeof onKeyDown === 'function') {
76
- onKeyDown(event, {
77
- index,
78
- id
79
- });
80
- }
81
- };
82
- }
41
+ let Tab = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = class Tab extends _react.Component {
42
+ static displayName = "Tab";
43
+ static componentId = 'Tabs.Tab';
44
+ static allowedProps = _props.allowedProps;
45
+ static propTypes = _props.propTypes;
46
+ static defaultProps = {
47
+ variant: 'default',
48
+ isDisabled: false,
49
+ isSelected: false
50
+ };
83
51
 
84
52
  componentDidMount() {
85
- var _this$props$makeStyle, _this$props3;
53
+ var _this$props$makeStyle, _this$props;
86
54
 
87
- (_this$props$makeStyle = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props3);
55
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
88
56
  }
89
57
 
90
58
  componentDidUpdate() {
91
- var _this$props$makeStyle2, _this$props4;
59
+ var _this$props$makeStyle2, _this$props2;
92
60
 
93
- (_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4);
61
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
94
62
  }
95
63
 
64
+ handleClick = event => {
65
+ const _this$props3 = this.props,
66
+ onClick = _this$props3.onClick,
67
+ index = _this$props3.index,
68
+ id = _this$props3.id,
69
+ isDisabled = _this$props3.isDisabled;
70
+
71
+ if (isDisabled) {
72
+ return;
73
+ }
74
+
75
+ if (typeof onClick === 'function') {
76
+ onClick(event, {
77
+ index,
78
+ id
79
+ });
80
+ }
81
+ };
82
+ handleKeyDown = event => {
83
+ const _this$props4 = this.props,
84
+ onKeyDown = _this$props4.onKeyDown,
85
+ index = _this$props4.index,
86
+ id = _this$props4.id,
87
+ isDisabled = _this$props4.isDisabled;
88
+
89
+ if (isDisabled) {
90
+ return;
91
+ }
92
+
93
+ if (typeof onKeyDown === 'function') {
94
+ onKeyDown(event, {
95
+ index,
96
+ id
97
+ });
98
+ }
99
+ };
100
+
96
101
  render() {
97
102
  const _this$props5 = this.props,
98
103
  id = _this$props5.id,
@@ -119,11 +124,7 @@ let Tab = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec
119
124
  }), (0, _callRenderProp.callRenderProp)(children));
120
125
  }
121
126
 
122
- }, _class2.displayName = "Tab", _class2.componentId = 'Tabs.Tab', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
123
- variant: 'default',
124
- isDisabled: false,
125
- isSelected: false
126
- }, _class2)) || _class);
127
+ }) || _class);
127
128
  exports.Tab = Tab;
128
129
  var _default = Tab;
129
130
  exports.default = _default;