@instructure/ui-tabs 8.33.1 → 8.33.2

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,6 +3,10 @@
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.33.2](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2) (2023-01-25)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-tabs
9
+
6
10
  ## [8.33.1](https://github.com/instructure/instructure-ui/compare/v8.33.0...v8.33.1) (2023-01-06)
7
11
 
8
12
  **Note:** Version bump only for package @instructure/ui-tabs
@@ -1,8 +1,6 @@
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
-
4
3
  var _dec, _class, _class2;
5
-
6
4
  /*
7
5
  * The MIT License (MIT)
8
6
  *
@@ -36,6 +34,7 @@ import { withStyle, jsx } from '@instructure/emotion';
36
34
  import generateStyle from './styles';
37
35
  import generateComponentTheme from './theme';
38
36
  import { allowedProps, propTypes } from './props';
37
+
39
38
  /**
40
39
  ---
41
40
  parent: Tabs
@@ -43,50 +42,41 @@ id: Tabs.Panel
43
42
  ---
44
43
  @tsProps
45
44
  **/
46
-
47
45
  let Panel = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_class2 = class Panel extends Component {
48
46
  constructor() {
49
47
  super(...arguments);
50
48
  this.ref = null;
51
-
52
49
  this.handleRef = el => {
53
50
  const elementRef = this.props.elementRef;
54
51
  this.ref = el;
55
-
56
52
  if (typeof elementRef === 'function') {
57
53
  elementRef(el);
58
54
  }
59
55
  };
60
56
  }
61
-
62
57
  componentDidMount() {
63
58
  var _this$props$makeStyle, _this$props;
64
-
65
59
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
66
60
  }
67
-
68
61
  componentDidUpdate() {
69
62
  var _this$props$makeStyle2, _this$props2;
70
-
71
63
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
72
64
  }
73
-
74
65
  render() {
75
66
  const _this$props3 = this.props,
76
- labelledBy = _this$props3.labelledBy,
77
- variant = _this$props3.variant,
78
- id = _this$props3.id,
79
- maxHeight = _this$props3.maxHeight,
80
- minHeight = _this$props3.minHeight,
81
- padding = _this$props3.padding,
82
- textAlign = _this$props3.textAlign,
83
- children = _this$props3.children,
84
- elementRef = _this$props3.elementRef,
85
- isDisabled = _this$props3.isDisabled,
86
- isSelected = _this$props3.isSelected,
87
- styles = _this$props3.styles,
88
- props = _objectWithoutProperties(_this$props3, _excluded);
89
-
67
+ labelledBy = _this$props3.labelledBy,
68
+ variant = _this$props3.variant,
69
+ id = _this$props3.id,
70
+ maxHeight = _this$props3.maxHeight,
71
+ minHeight = _this$props3.minHeight,
72
+ padding = _this$props3.padding,
73
+ textAlign = _this$props3.textAlign,
74
+ children = _this$props3.children,
75
+ elementRef = _this$props3.elementRef,
76
+ isDisabled = _this$props3.isDisabled,
77
+ isSelected = _this$props3.isSelected,
78
+ styles = _this$props3.styles,
79
+ props = _objectWithoutProperties(_this$props3, _excluded);
90
80
  const isHidden = !isSelected || !!isDisabled;
91
81
  return jsx("div", Object.assign({}, passthroughProps(props), {
92
82
  css: styles === null || styles === void 0 ? void 0 : styles.panel,
@@ -109,7 +99,6 @@ let Panel = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
109
99
  textAlign: textAlign
110
100
  }, children)));
111
101
  }
112
-
113
102
  }, _class2.displayName = "Panel", _class2.componentId = 'Tabs.Panel', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
114
103
  isDisabled: false,
115
104
  textAlign: 'start',
@@ -21,6 +21,7 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  import PropTypes from 'prop-types';
25
26
  import { ThemeablePropTypes } from '@instructure/emotion';
26
27
  const propTypes = {
@@ -34,7 +34,7 @@
34
34
  */
35
35
  const generateStyle = (componentTheme, props) => {
36
36
  const maxHeight = props.maxHeight,
37
- isSelected = props.isSelected;
37
+ isSelected = props.isSelected;
38
38
  return {
39
39
  panel: {
40
40
  label: 'panel',
@@ -72,5 +72,4 @@ const generateStyle = (componentTheme, props) => {
72
72
  }
73
73
  };
74
74
  };
75
-
76
75
  export default generateStyle;
@@ -29,9 +29,9 @@
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
31
  const typography = theme.typography,
32
- colors = theme.colors,
33
- borders = theme.borders,
34
- themeName = theme.key;
32
+ colors = theme.colors,
33
+ borders = theme.borders,
34
+ themeName = theme.key;
35
35
  const themeSpecificStyle = {
36
36
  canvas: {
37
37
  color: theme['ic-brand-font-color-dark']
@@ -49,9 +49,9 @@ const generateComponentTheme = theme => {
49
49
  borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
50
50
  defaultOverflowY: 'auto'
51
51
  };
52
- return { ...componentVariables,
52
+ return {
53
+ ...componentVariables,
53
54
  ...themeSpecificStyle[themeName]
54
55
  };
55
56
  };
56
-
57
57
  export default generateComponentTheme;
@@ -1,8 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["id", "variant", "isSelected", "isDisabled", "controls", "children", "styles"];
3
-
4
3
  var _dec, _class, _class2;
5
-
6
4
  /*
7
5
  * The MIT License (MIT)
8
6
  *
@@ -35,6 +33,7 @@ import { withStyle, jsx } from '@instructure/emotion';
35
33
  import generateStyle from './styles';
36
34
  import generateComponentTheme from './theme';
37
35
  import { allowedProps, propTypes } from './props';
36
+
38
37
  /**
39
38
  ---
40
39
  parent: Tabs
@@ -42,22 +41,18 @@ id: Tabs.Tab
42
41
  ---
43
42
  @tsProps
44
43
  **/
45
-
46
44
  let Tab = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_class2 = class Tab extends Component {
47
45
  constructor() {
48
46
  super(...arguments);
49
-
50
47
  this.handleClick = event => {
51
48
  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
-
49
+ onClick = _this$props.onClick,
50
+ index = _this$props.index,
51
+ id = _this$props.id,
52
+ isDisabled = _this$props.isDisabled;
57
53
  if (isDisabled) {
58
54
  return;
59
55
  }
60
-
61
56
  if (typeof onClick === 'function') {
62
57
  onClick(event, {
63
58
  index,
@@ -65,18 +60,15 @@ let Tab = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
65
60
  });
66
61
  }
67
62
  };
68
-
69
63
  this.handleKeyDown = event => {
70
64
  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
-
65
+ onKeyDown = _this$props2.onKeyDown,
66
+ index = _this$props2.index,
67
+ id = _this$props2.id,
68
+ isDisabled = _this$props2.isDisabled;
76
69
  if (isDisabled) {
77
70
  return;
78
71
  }
79
-
80
72
  if (typeof onKeyDown === 'function') {
81
73
  onKeyDown(event, {
82
74
  index,
@@ -85,30 +77,24 @@ let Tab = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
85
77
  }
86
78
  };
87
79
  }
88
-
89
80
  componentDidMount() {
90
81
  var _this$props$makeStyle, _this$props3;
91
-
92
82
  (_this$props$makeStyle = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props3);
93
83
  }
94
-
95
84
  componentDidUpdate() {
96
85
  var _this$props$makeStyle2, _this$props4;
97
-
98
86
  (_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4);
99
87
  }
100
-
101
88
  render() {
102
89
  const _this$props5 = this.props,
103
- id = _this$props5.id,
104
- variant = _this$props5.variant,
105
- isSelected = _this$props5.isSelected,
106
- isDisabled = _this$props5.isDisabled,
107
- controls = _this$props5.controls,
108
- children = _this$props5.children,
109
- styles = _this$props5.styles,
110
- props = _objectWithoutProperties(_this$props5, _excluded);
111
-
90
+ id = _this$props5.id,
91
+ variant = _this$props5.variant,
92
+ isSelected = _this$props5.isSelected,
93
+ isDisabled = _this$props5.isDisabled,
94
+ controls = _this$props5.controls,
95
+ children = _this$props5.children,
96
+ styles = _this$props5.styles,
97
+ props = _objectWithoutProperties(_this$props5, _excluded);
112
98
  return jsx(View, Object.assign({}, passthroughProps(props), {
113
99
  as: "div",
114
100
  role: "tab",
@@ -124,7 +110,6 @@ let Tab = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
124
110
  focusPosition: "inset"
125
111
  }), callRenderProp(children));
126
112
  }
127
-
128
113
  }, _class2.displayName = "Tab", _class2.componentId = 'Tabs.Tab', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
129
114
  variant: 'default',
130
115
  isDisabled: false,
@@ -21,6 +21,7 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  import PropTypes from 'prop-types';
25
26
  const propTypes = {
26
27
  variant: PropTypes.oneOf(['default', 'secondary']),
@@ -21,6 +21,7 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  import { keyframes } from '@instructure/emotion';
25
26
  // keyframes have to be outside of 'generateStyle',
26
27
  // since it is causing problems in style recalculation
@@ -29,6 +30,7 @@ const selectedTab = keyframes`
29
30
  opacity: 1;
30
31
  transform: translate3d(0, 0, 0) scaleX(1);
31
32
  }`;
33
+
32
34
  /**
33
35
  * ---
34
36
  * private: true
@@ -39,11 +41,10 @@ const selectedTab = keyframes`
39
41
  * @param {Object} state the state of the component, the style is applied to
40
42
  * @return {Object} The final style object, which will be used in the component
41
43
  */
42
-
43
44
  const generateStyle = (componentTheme, props) => {
44
45
  const variant = props.variant,
45
- isSelected = props.isSelected,
46
- isDisabled = props.isDisabled;
46
+ isSelected = props.isSelected,
47
+ isDisabled = props.isDisabled;
47
48
  const variants = {
48
49
  default: {
49
50
  padding: '1rem 1.25rem',
@@ -72,7 +73,8 @@ const generateStyle = (componentTheme, props) => {
72
73
  animationTimingFunction: 'ease-out'
73
74
  })
74
75
  },
75
- '&:hover': { ...(!isDisabled && !isSelected && {
76
+ '&:hover': {
77
+ ...(!isDisabled && !isSelected && {
76
78
  borderBottomColor: componentTheme.defaultHoverBorderColor
77
79
  })
78
80
  }
@@ -96,14 +98,16 @@ const generateStyle = (componentTheme, props) => {
96
98
  '&:first-of-type': {
97
99
  marginInlineStart: '0'
98
100
  },
99
- '&:hover': { ...(!isDisabled && !isSelected && {
101
+ '&:hover': {
102
+ ...(!isDisabled && !isSelected && {
100
103
  background: componentTheme.secondarySelectedBackground,
101
104
  borderColor: componentTheme.secondarySelectedBorderColor
102
105
  })
103
106
  }
104
107
  }
105
- }; // overrides for View default focus ring
108
+ };
106
109
 
110
+ // overrides for View default focus ring
107
111
  const focusRingStyles = {
108
112
  '&:before': {
109
113
  inset: '0.5rem',
@@ -136,5 +140,4 @@ const generateStyle = (componentTheme, props) => {
136
140
  }
137
141
  };
138
142
  };
139
-
140
143
  export default generateStyle;
@@ -29,9 +29,9 @@
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
31
  const colors = theme.colors,
32
- typography = theme.typography,
33
- stacking = theme.stacking,
34
- themeName = theme.key;
32
+ typography = theme.typography,
33
+ stacking = theme.stacking,
34
+ themeName = theme.key;
35
35
  const themeSpecificStyle = {
36
36
  canvas: {
37
37
  defaultColor: theme['ic-brand-font-color-dark'],
@@ -52,9 +52,9 @@ const generateComponentTheme = theme => {
52
52
  secondarySelectedBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
53
53
  zIndex: stacking === null || stacking === void 0 ? void 0 : stacking.above
54
54
  };
55
- return { ...componentVariables,
55
+ return {
56
+ ...componentVariables,
56
57
  ...themeSpecificStyle[themeName]
57
58
  };
58
59
  };
59
-
60
60
  export default generateComponentTheme;
@@ -25,8 +25,9 @@ import { locator } from '@instructure/ui-test-locator';
25
25
  import { Tabs } from './index';
26
26
  const TabLocator = locator('[role="tab"]');
27
27
  const PanelLocator = locator('[role="tabpanel"]');
28
- const SelectedTabLocator = locator('[role="tab"][aria-selected="true"]'); // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
28
+ const SelectedTabLocator = locator('[role="tab"][aria-selected="true"]');
29
29
 
30
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
30
31
  export const TabsLocator = locator(Tabs.selector, {
31
32
  findTab: function () {
32
33
  return TabLocator.find(...arguments);