@instructure/ui-tabs 11.6.0 → 11.6.1-snapshot-129

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.
Files changed (134) hide show
  1. package/CHANGELOG.md +48 -308
  2. package/es/Tabs/{Panel → v1/Panel}/index.js +2 -2
  3. package/es/Tabs/{Tab → v1/Tab}/index.js +2 -2
  4. package/es/Tabs/{index.js → v1/index.js} +2 -2
  5. package/es/Tabs/v2/Panel/index.js +126 -0
  6. package/es/Tabs/v2/Panel/props.js +26 -0
  7. package/es/Tabs/v2/Panel/styles.js +81 -0
  8. package/es/Tabs/v2/Tab/index.js +118 -0
  9. package/es/Tabs/v2/Tab/props.js +26 -0
  10. package/es/Tabs/v2/Tab/styles.js +145 -0
  11. package/es/Tabs/v2/index.js +396 -0
  12. package/es/Tabs/v2/props.js +26 -0
  13. package/es/Tabs/v2/styles.js +145 -0
  14. package/es/{index.js → exports/a.js} +3 -3
  15. package/es/exports/b.js +26 -0
  16. package/lib/Tabs/v1/Panel/index.js +132 -0
  17. package/lib/Tabs/v1/Tab/index.js +125 -0
  18. package/lib/Tabs/v1/index.js +410 -0
  19. package/lib/Tabs/{Panel → v2/Panel}/index.js +3 -4
  20. package/lib/Tabs/v2/Panel/props.js +31 -0
  21. package/lib/Tabs/v2/Panel/styles.js +87 -0
  22. package/lib/Tabs/{Tab → v2/Tab}/index.js +3 -4
  23. package/lib/Tabs/v2/Tab/props.js +31 -0
  24. package/lib/Tabs/v2/Tab/styles.js +151 -0
  25. package/lib/Tabs/{index.js → v2/index.js} +5 -6
  26. package/lib/Tabs/v2/props.js +31 -0
  27. package/lib/Tabs/v2/styles.js +151 -0
  28. package/lib/{index.js → exports/a.js} +4 -4
  29. package/lib/exports/b.js +26 -0
  30. package/package.json +46 -24
  31. package/src/Tabs/{Panel → v1/Panel}/index.tsx +2 -2
  32. package/src/Tabs/{Tab → v1/Tab}/index.tsx +3 -3
  33. package/src/Tabs/{Tab → v1/Tab}/props.ts +1 -1
  34. package/src/Tabs/{index.tsx → v1/index.tsx} +3 -3
  35. package/src/Tabs/{props.ts → v1/props.ts} +1 -1
  36. package/src/Tabs/v2/Panel/index.tsx +138 -0
  37. package/src/Tabs/v2/Panel/props.ts +100 -0
  38. package/src/Tabs/v2/Panel/styles.ts +92 -0
  39. package/src/Tabs/v2/README.md +559 -0
  40. package/src/Tabs/v2/Tab/index.tsx +123 -0
  41. package/src/Tabs/v2/Tab/props.ts +80 -0
  42. package/src/Tabs/v2/Tab/styles.ts +161 -0
  43. package/src/Tabs/v2/index.tsx +547 -0
  44. package/src/Tabs/v2/props.ts +126 -0
  45. package/src/Tabs/v2/styles.ts +156 -0
  46. package/src/{index.ts → exports/a.ts} +6 -6
  47. package/src/exports/b.ts +31 -0
  48. package/tsconfig.build.tsbuildinfo +1 -1
  49. package/types/Tabs/v1/Panel/index.d.ts.map +1 -0
  50. package/types/Tabs/v1/Panel/props.d.ts.map +1 -0
  51. package/types/Tabs/v1/Panel/styles.d.ts.map +1 -0
  52. package/types/Tabs/v1/Panel/theme.d.ts.map +1 -0
  53. package/types/Tabs/{Tab → v1/Tab}/index.d.ts +1 -1
  54. package/types/Tabs/v1/Tab/index.d.ts.map +1 -0
  55. package/types/Tabs/{Tab → v1/Tab}/props.d.ts +1 -1
  56. package/types/Tabs/v1/Tab/props.d.ts.map +1 -0
  57. package/types/Tabs/v1/Tab/styles.d.ts.map +1 -0
  58. package/types/Tabs/v1/Tab/theme.d.ts.map +1 -0
  59. package/types/Tabs/{index.d.ts → v1/index.d.ts} +1 -1
  60. package/types/Tabs/v1/index.d.ts.map +1 -0
  61. package/types/Tabs/{props.d.ts → v1/props.d.ts} +1 -1
  62. package/types/Tabs/v1/props.d.ts.map +1 -0
  63. package/types/Tabs/v1/styles.d.ts.map +1 -0
  64. package/types/Tabs/v1/theme.d.ts.map +1 -0
  65. package/types/Tabs/v2/Panel/index.d.ts +46 -0
  66. package/types/Tabs/v2/Panel/index.d.ts.map +1 -0
  67. package/types/Tabs/v2/Panel/props.d.ts +46 -0
  68. package/types/Tabs/v2/Panel/props.d.ts.map +1 -0
  69. package/types/Tabs/v2/Panel/styles.d.ts +19 -0
  70. package/types/Tabs/v2/Panel/styles.d.ts.map +1 -0
  71. package/types/Tabs/v2/Tab/index.d.ts +43 -0
  72. package/types/Tabs/v2/Tab/index.d.ts.map +1 -0
  73. package/types/Tabs/v2/Tab/props.d.ts +33 -0
  74. package/types/Tabs/v2/Tab/props.d.ts.map +1 -0
  75. package/types/Tabs/v2/Tab/styles.d.ts +20 -0
  76. package/types/Tabs/v2/Tab/styles.d.ts.map +1 -0
  77. package/types/Tabs/v2/index.d.ts +80 -0
  78. package/types/Tabs/v2/index.d.ts.map +1 -0
  79. package/types/Tabs/v2/props.d.ts +68 -0
  80. package/types/Tabs/v2/props.d.ts.map +1 -0
  81. package/types/Tabs/v2/styles.d.ts +19 -0
  82. package/types/Tabs/v2/styles.d.ts.map +1 -0
  83. package/types/exports/a.d.ts +7 -0
  84. package/types/exports/a.d.ts.map +1 -0
  85. package/types/exports/b.d.ts +7 -0
  86. package/types/exports/b.d.ts.map +1 -0
  87. package/types/Tabs/Panel/index.d.ts.map +0 -1
  88. package/types/Tabs/Panel/props.d.ts.map +0 -1
  89. package/types/Tabs/Panel/styles.d.ts.map +0 -1
  90. package/types/Tabs/Panel/theme.d.ts.map +0 -1
  91. package/types/Tabs/Tab/index.d.ts.map +0 -1
  92. package/types/Tabs/Tab/props.d.ts.map +0 -1
  93. package/types/Tabs/Tab/styles.d.ts.map +0 -1
  94. package/types/Tabs/Tab/theme.d.ts.map +0 -1
  95. package/types/Tabs/index.d.ts.map +0 -1
  96. package/types/Tabs/props.d.ts.map +0 -1
  97. package/types/Tabs/styles.d.ts.map +0 -1
  98. package/types/Tabs/theme.d.ts.map +0 -1
  99. package/types/index.d.ts +0 -7
  100. package/types/index.d.ts.map +0 -1
  101. /package/es/Tabs/{Panel → v1/Panel}/props.js +0 -0
  102. /package/es/Tabs/{Panel → v1/Panel}/styles.js +0 -0
  103. /package/es/Tabs/{Panel → v1/Panel}/theme.js +0 -0
  104. /package/es/Tabs/{Tab → v1/Tab}/props.js +0 -0
  105. /package/es/Tabs/{Tab → v1/Tab}/styles.js +0 -0
  106. /package/es/Tabs/{Tab → v1/Tab}/theme.js +0 -0
  107. /package/es/Tabs/{props.js → v1/props.js} +0 -0
  108. /package/es/Tabs/{styles.js → v1/styles.js} +0 -0
  109. /package/es/Tabs/{theme.js → v1/theme.js} +0 -0
  110. /package/lib/Tabs/{Panel → v1/Panel}/props.js +0 -0
  111. /package/lib/Tabs/{Panel → v1/Panel}/styles.js +0 -0
  112. /package/lib/Tabs/{Panel → v1/Panel}/theme.js +0 -0
  113. /package/lib/Tabs/{Tab → v1/Tab}/props.js +0 -0
  114. /package/lib/Tabs/{Tab → v1/Tab}/styles.js +0 -0
  115. /package/lib/Tabs/{Tab → v1/Tab}/theme.js +0 -0
  116. /package/lib/Tabs/{props.js → v1/props.js} +0 -0
  117. /package/lib/Tabs/{styles.js → v1/styles.js} +0 -0
  118. /package/lib/Tabs/{theme.js → v1/theme.js} +0 -0
  119. /package/src/Tabs/{Panel → v1/Panel}/props.ts +0 -0
  120. /package/src/Tabs/{Panel → v1/Panel}/styles.ts +0 -0
  121. /package/src/Tabs/{Panel → v1/Panel}/theme.ts +0 -0
  122. /package/src/Tabs/{README.md → v1/README.md} +0 -0
  123. /package/src/Tabs/{Tab → v1/Tab}/styles.ts +0 -0
  124. /package/src/Tabs/{Tab → v1/Tab}/theme.ts +0 -0
  125. /package/src/Tabs/{styles.ts → v1/styles.ts} +0 -0
  126. /package/src/Tabs/{theme.ts → v1/theme.ts} +0 -0
  127. /package/types/Tabs/{Panel → v1/Panel}/index.d.ts +0 -0
  128. /package/types/Tabs/{Panel → v1/Panel}/props.d.ts +0 -0
  129. /package/types/Tabs/{Panel → v1/Panel}/styles.d.ts +0 -0
  130. /package/types/Tabs/{Panel → v1/Panel}/theme.d.ts +0 -0
  131. /package/types/Tabs/{Tab → v1/Tab}/styles.d.ts +0 -0
  132. /package/types/Tabs/{Tab → v1/Tab}/theme.d.ts +0 -0
  133. /package/types/Tabs/{styles.d.ts → v1/styles.d.ts} +0 -0
  134. /package/types/Tabs/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -7,12 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = exports.Panel = void 0;
8
8
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
9
  var _react = require("react");
10
- var _View = require("@instructure/ui-view/lib/View");
10
+ var _latest = require("@instructure/ui-view/latest");
11
11
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
12
12
  var _Transition = require("@instructure/ui-motion/lib/Transition");
13
13
  var _emotion = require("@instructure/emotion");
14
14
  var _styles = _interopRequireDefault(require("./styles"));
15
- var _theme = _interopRequireDefault(require("./theme"));
16
15
  var _props = require("./props");
17
16
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
18
17
  const _excluded = ["labelledBy", "variant", "id", "maxHeight", "minHeight", "padding", "textAlign", "children", "elementRef", "isDisabled", "isSelected", "styles", "active", "unmountOnExit", "tabIndex"];
@@ -46,7 +45,7 @@ parent: Tabs
46
45
  id: Tabs.Panel
47
46
  ---
48
47
  **/
49
- let Panel = exports.Panel = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_Panel = class Panel extends _react.Component {
48
+ let Panel = exports.Panel = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_Panel = class Panel extends _react.Component {
50
49
  constructor(...args) {
51
50
  super(...args);
52
51
  this.ref = null;
@@ -108,7 +107,7 @@ let Panel = exports.Panel = (_dec = (0, _emotion.withStyle)(_styles.default, _th
108
107
  in: !this.isHidden,
109
108
  unmountOnExit: unmountOnExit,
110
109
  transitionExit: false,
111
- children: (0, _jsxRuntime.jsx)(_View.View, {
110
+ children: (0, _jsxRuntime.jsx)(_latest.View, {
112
111
  css: styles === null || styles === void 0 ? void 0 : styles.content,
113
112
  maxHeight: maxHeight,
114
113
  minHeight: minHeight,
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ const allowedProps = exports.allowedProps = ['renderTitle', 'children', 'variant', 'isSelected', 'isDisabled', 'maxHeight', 'minHeight', 'id', 'labelledBy', 'padding', 'textAlign', 'elementRef', 'active', 'unmountOnExit', 'tabIndex'];
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * ---
33
+ * private: true
34
+ * ---
35
+ * Generates the style object from the theme and provided additional information
36
+ * @param {Object} componentTheme The theme variable object.
37
+ * @param {Object} params the props and passed through data of the component, the style is applied to
38
+ * @return {Object} The final style object, which will be used in the component
39
+ */
40
+ const generateStyle = (componentTheme, params, sharedTokens) => {
41
+ const maxHeight = params.maxHeight,
42
+ isSelected = params.isSelected,
43
+ isHidden = params.isHidden;
44
+ return {
45
+ panel: {
46
+ label: 'panel',
47
+ boxSizing: 'border-box',
48
+ flexShrink: 0,
49
+ flexGrow: 0,
50
+ fontFamily: componentTheme.fontFamily,
51
+ fontWeight: componentTheme.fontWeight,
52
+ lineHeight: componentTheme.lineHeight,
53
+ fontSize: componentTheme.fontSize,
54
+ ...(isSelected && {
55
+ flexGrow: 1,
56
+ height: '100%'
57
+ }),
58
+ ...(isHidden && {
59
+ display: 'none'
60
+ }),
61
+ '&:focus': {
62
+ outlineColor: sharedTokens.focusOutline.infoColor
63
+ }
64
+ },
65
+ content: {
66
+ label: 'panel__content',
67
+ boxSizing: 'border-box',
68
+ width: '100%',
69
+ height: '100%',
70
+ borderWidth: componentTheme.borderWidth,
71
+ borderStyle: 'solid',
72
+ background: componentTheme.background,
73
+ borderColor: componentTheme.borderColor,
74
+ color: componentTheme.textColor,
75
+ borderLeft: 'none',
76
+ borderRight: 'none',
77
+ borderBottom: 'none',
78
+ // we exposed this so in some use cases it can be set to "visible",
79
+ // e.g. when a 100% width button's focus ring would get cropped
80
+ overflowY: componentTheme.defaultOverflowY,
81
+ ...(maxHeight && {
82
+ overflow: 'auto'
83
+ })
84
+ }
85
+ };
86
+ };
87
+ var _default = exports.default = generateStyle;
@@ -9,10 +9,9 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
9
9
  var _react = require("react");
10
10
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
11
11
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
12
- var _View = require("@instructure/ui-view/lib/View");
12
+ var _latest = require("@instructure/ui-view/latest");
13
13
  var _emotion = require("@instructure/emotion");
14
14
  var _styles = _interopRequireDefault(require("./styles"));
15
- var _theme = _interopRequireDefault(require("./theme"));
16
15
  var _props = require("./props");
17
16
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
18
17
  const _excluded = ["id", "variant", "isSelected", "isDisabled", "controls", "children", "styles"];
@@ -46,7 +45,7 @@ parent: Tabs
46
45
  id: Tabs.Tab
47
46
  ---
48
47
  **/
49
- let Tab = exports.Tab = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_Tab = class Tab extends _react.Component {
48
+ let Tab = exports.Tab = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_Tab = class Tab extends _react.Component {
50
49
  constructor(...args) {
51
50
  super(...args);
52
51
  this.handleClick = event => {
@@ -100,7 +99,7 @@ let Tab = exports.Tab = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.
100
99
  children = _this$props5.children,
101
100
  styles = _this$props5.styles,
102
101
  props = (0, _objectWithoutProperties2.default)(_this$props5, _excluded);
103
- return (0, _jsxRuntime.jsx)(_View.View, {
102
+ return (0, _jsxRuntime.jsx)(_latest.View, {
104
103
  ...(0, _passthroughProps.passthroughProps)(props),
105
104
  as: "div",
106
105
  role: "tab",
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ const allowedProps = exports.allowedProps = ['variant', 'id', 'index', 'controls', 'isDisabled', 'isSelected', 'onClick', 'onKeyDown', 'children', 'isOverflowScroll'];
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _emotion = require("@instructure/emotion");
8
+ /*
9
+ * The MIT License (MIT)
10
+ *
11
+ * Copyright (c) 2015 - present Instructure, Inc.
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ * copies of the Software, and to permit persons to whom the Software is
18
+ * furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included in all
21
+ * copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ * SOFTWARE.
30
+ */
31
+
32
+ // keyframes have to be outside of 'generateStyle',
33
+ // since it is causing problems in style recalculation
34
+ const selectedTab = (0, _emotion.keyframes)`
35
+ to {
36
+ opacity: 1;
37
+ transform: translate3d(0, 0, 0) scaleX(1);
38
+ }`;
39
+
40
+ /**
41
+ * ---
42
+ * private: true
43
+ * ---
44
+ * Generates the style object from the theme and provided additional information
45
+ * @param {Object} componentTheme The theme variable object.
46
+ * @param {Object} params the props and passed through data of the component, the style is applied to
47
+ * @return {Object} The final style object, which will be used in the component
48
+ */
49
+ const generateStyle = (componentTheme, params) => {
50
+ const variant = params.variant,
51
+ isSelected = params.isSelected,
52
+ isDisabled = params.isDisabled,
53
+ isOverflowScroll = params.isOverflowScroll;
54
+ const variants = {
55
+ default: {
56
+ padding: '1rem 1.25rem',
57
+ // if horizontal padding changes, update `scrollOverlayWidthDefault` in `Tabs/theme.js`
58
+ lineHeight: 1,
59
+ position: 'relative',
60
+ zIndex: componentTheme.zIndex,
61
+ color: componentTheme.defaultTextColor,
62
+ ...(isDisabled && {
63
+ fontWeight: 'normal'
64
+ }),
65
+ '&::after': {
66
+ content: '""',
67
+ height: '0.25rem',
68
+ width: '100%',
69
+ position: 'absolute',
70
+ insetInlineStart: 0,
71
+ bottom: 0,
72
+ opacity: 0,
73
+ transform: 'translate3d(0, 0, 0) scaleX(0.01)',
74
+ ...(isSelected && {
75
+ backgroundColor: componentTheme.defaultSelectedBorderColor,
76
+ animationName: selectedTab,
77
+ animationDuration: '0.2s',
78
+ animationFillMode: 'forwards',
79
+ animationTimingFunction: 'ease-out'
80
+ })
81
+ },
82
+ '&:hover': {
83
+ ...(!isDisabled && !isSelected && {
84
+ borderBottomColor: componentTheme.defaultHoverBorderColor
85
+ })
86
+ }
87
+ },
88
+ secondary: {
89
+ padding: '0.75rem 1rem',
90
+ // if horizontal padding changes, update `scrollOverlayWidthSecondary` in `Tabs/theme.js`
91
+ color: componentTheme.secondaryTextColor,
92
+ marginInlineEnd: '0.2em',
93
+ marginBottom: isOverflowScroll ? '0rem' : '-0.0625rem',
94
+ border: '0.0625rem solid transparent',
95
+ borderTopLeftRadius: '0.1875rem',
96
+ borderTopRightRadius: '0.1875rem',
97
+ position: 'relative',
98
+ ...(isSelected && {
99
+ background: componentTheme.secondarySelectedBackground,
100
+ borderColor: componentTheme.secondarySelectedBorderColor,
101
+ zIndex: componentTheme.zIndex,
102
+ borderBottomColor: componentTheme.secondarySelectedBackground,
103
+ color: componentTheme.secondarySelectedTextColor
104
+ }),
105
+ '&:first-of-type': {
106
+ marginInlineStart: '0'
107
+ },
108
+ '&:hover': {
109
+ ...(!isDisabled && !isSelected && {
110
+ background: componentTheme.secondarySelectedBackground,
111
+ borderColor: componentTheme.secondarySelectedBorderColor,
112
+ color: componentTheme.secondarySelectedTextColor
113
+ })
114
+ }
115
+ }
116
+ };
117
+
118
+ // overrides for View default focus ring
119
+ const focusRingStyles = {
120
+ '&:before': {
121
+ inset: '0.5rem',
122
+ borderRadius: '0.25rem'
123
+ },
124
+ '&:focus': {
125
+ '&:before': {
126
+ inset: '0.375rem'
127
+ }
128
+ }
129
+ };
130
+ return {
131
+ tab: {
132
+ label: 'tab',
133
+ fontFamily: componentTheme.fontFamily,
134
+ fontWeight: componentTheme.fontWeight,
135
+ lineHeight: componentTheme.lineHeight,
136
+ fontSize: componentTheme.fontSize,
137
+ cursor: 'pointer',
138
+ userSelect: 'none',
139
+ whiteSpace: 'nowrap',
140
+ ...((isSelected || isDisabled) && {
141
+ cursor: 'default'
142
+ }),
143
+ ...(isDisabled && {
144
+ opacity: 0.5
145
+ }),
146
+ ...focusRingStyles,
147
+ ...variants[variant]
148
+ }
149
+ };
150
+ };
151
+ var _default = exports.default = generateStyle;
@@ -14,7 +14,7 @@ exports.default = exports.Tabs = void 0;
14
14
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
15
  var _react = require("react");
16
16
  var _keycode = _interopRequireDefault(require("keycode"));
17
- var _View = require("@instructure/ui-view/lib/View");
17
+ var _latest = require("@instructure/ui-view/latest");
18
18
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
19
19
  var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
20
20
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
@@ -26,7 +26,6 @@ var _debounce = require("@instructure/debounce");
26
26
  var _px = require("@instructure/ui-utils/lib/px.js");
27
27
  var _emotion = require("@instructure/emotion");
28
28
  var _styles = _interopRequireDefault(require("./styles"));
29
- var _theme = _interopRequireDefault(require("./theme"));
30
29
  var _Tab = require("./Tab");
31
30
  var _Panel = require("./Panel");
32
31
  var _props = require("./props");
@@ -61,7 +60,7 @@ var _dec, _class, _Tabs;
61
60
  category: components
62
61
  ---
63
62
  **/
64
- let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_Tabs = class Tabs extends _react.Component {
63
+ let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_Tabs = class Tabs extends _react.Component {
65
64
  constructor(props) {
66
65
  super(props);
67
66
  this._tabList = null;
@@ -370,7 +369,7 @@ let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _them
370
369
  const endScrollOverlay = this.state.showEndOverLay ? (0, _jsxRuntime.jsx)("span", {
371
370
  css: styles === null || styles === void 0 ? void 0 : styles.endScrollOverlay
372
371
  }, "end-overlay") : null;
373
- return (0, _jsxRuntime.jsxs)(_View.View, {
372
+ return (0, _jsxRuntime.jsxs)(_latest.View, {
374
373
  ...(0, _passthroughProps.passthroughProps)(props),
375
374
  elementRef: this.handleRef,
376
375
  maxWidth: maxWidth,
@@ -380,13 +379,13 @@ let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _them
380
379
  "data-cid": "Tabs",
381
380
  children: [(0, _jsxRuntime.jsx)(_Focusable.Focusable, {
382
381
  ref: this.handleFocusableRef,
383
- children: () => (0, _jsxRuntime.jsx)(_View.View, {
382
+ children: () => (0, _jsxRuntime.jsx)(_latest.View, {
384
383
  as: "div",
385
384
  position: "relative",
386
385
  borderRadius: "medium",
387
386
  shouldAnimateFocus: false,
388
387
  css: styles === null || styles === void 0 ? void 0 : styles.tabs,
389
- children: (0, _jsxRuntime.jsxs)(_View.View, {
388
+ children: (0, _jsxRuntime.jsxs)(_latest.View, {
390
389
  as: "div",
391
390
  role: "tablist",
392
391
  css: styles === null || styles === void 0 ? void 0 : styles.tabList,
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ const allowedProps = exports.allowedProps = ['children', 'variant', 'screenReaderLabel', 'onRequestTabChange', 'maxWidth', 'maxHeight', 'minHeight', 'fixHeight', 'margin', 'padding', 'textAlign', 'elementRef', 'tabOverflow', 'shouldFocusOnRender'];
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * ---
33
+ * private: true
34
+ * ---
35
+ * Generates the style object from the theme and provided additional information
36
+ * @param {Object} componentTheme The theme variable object.
37
+ * @param {Object} params the props and passed through data of the component, the style is applied to
38
+ * @return {Object} The final style object, which will be used in the component
39
+ */
40
+ const generateStyle = (componentTheme, params) => {
41
+ const variant = params.variant,
42
+ tabOverflow = params.tabOverflow,
43
+ fixHeight = params.fixHeight;
44
+
45
+ // fixHeight can be 0, so simply `fixheight` could return falsy value
46
+ const hasFixedHeight = typeof fixHeight !== 'undefined';
47
+ const variants = {
48
+ default: {
49
+ container: {
50
+ background: componentTheme.defaultBackground
51
+ },
52
+ tabs: {
53
+ marginBottom: `calc(${componentTheme.tabVerticalOffset} * -1)`
54
+ },
55
+ scrollOverlay: {
56
+ width: componentTheme.scrollOverlayWidthDefault
57
+ }
58
+ },
59
+ secondary: {
60
+ container: {
61
+ background: componentTheme.defaultBackground
62
+ },
63
+ tabs: {},
64
+ scrollOverlay: {
65
+ width: componentTheme.scrollOverlayWidthSecondary
66
+ }
67
+ }
68
+ };
69
+ const tabOverflowVariants = {
70
+ stack: {
71
+ flexFlow: 'row wrap'
72
+ },
73
+ scroll: {
74
+ marginBottom: variant === 'secondary' ? `calc(${componentTheme.tabVerticalOffset} * -1)` : 0,
75
+ overflowX: 'auto',
76
+ ...(variant === 'default' && {
77
+ '&::-webkit-scrollbar-track': {
78
+ backgroundColor: 'transparent'
79
+ },
80
+ '&::-webkit-scrollbar': {
81
+ height: '0.0625rem',
82
+ backgroundColor: 'transparent'
83
+ },
84
+ '&::-webkit-scrollbar-thumb': {
85
+ backgroundColor: 'transparent'
86
+ }
87
+ }),
88
+ scrollbarWidth: 'none'
89
+ }
90
+ };
91
+ const commonOverlay = {
92
+ height: `calc(100% - (${componentTheme.tabVerticalOffset} + 0.25rem))`,
93
+ position: 'absolute',
94
+ zIndex: componentTheme.zIndex,
95
+ top: '0',
96
+ pointerEvents: 'none',
97
+ ...variants[variant].scrollOverlay
98
+ };
99
+ return {
100
+ tabs: {
101
+ label: 'tabs',
102
+ flexShrink: 0,
103
+ flexGrow: 0,
104
+ ...variants[variant].tabs
105
+ },
106
+ container: {
107
+ label: 'tabs__container',
108
+ display: 'flex',
109
+ flexDirection: 'column',
110
+ height: fixHeight,
111
+ ...variants[variant].container
112
+ },
113
+ tabList: {
114
+ label: 'tabs__tabList',
115
+ display: 'flex',
116
+ width: '100%',
117
+ ...tabOverflowVariants[tabOverflow]
118
+ },
119
+ panelsContainer: {
120
+ label: 'tabs__panelsContainer',
121
+ flexShrink: 1,
122
+ flexGrow: 1,
123
+ display: 'flex',
124
+ flexDirection: 'column',
125
+ ...(hasFixedHeight && {
126
+ overflowY: 'hidden'
127
+ })
128
+ },
129
+ endScrollOverlay: {
130
+ label: 'tabs__endScrollOverlay',
131
+ insetInlineEnd: '0',
132
+ background: `linear-gradient(to left, ${componentTheme.scrollFadeColor} 0%, rgba(255, 255, 255, 0) 100%)`,
133
+ '[dir="rtl"] &': {
134
+ background: `linear-gradient(to right, ${componentTheme.scrollFadeColor} 0%, rgba(255, 255, 255, 0) 100%)`
135
+ },
136
+ ...commonOverlay
137
+ },
138
+ startScrollOverlay: {
139
+ label: 'tabs__startScrollOverlay',
140
+ insetInlineStart: '0',
141
+ background: `linear-gradient(to right, ${componentTheme.scrollFadeColor} 0%, rgba(255, 255, 255, 0) 100%)`,
142
+ '[dir="rtl"] &': {
143
+ background: `linear-gradient(to left, ${componentTheme.scrollFadeColor} 0%, rgba(255, 255, 255, 0) 100%)`
144
+ },
145
+ ...commonOverlay
146
+ },
147
+ scrollOverlayWidthDefault: componentTheme.scrollOverlayWidthDefault,
148
+ scrollOverlayWidthSecondary: componentTheme.scrollOverlayWidthSecondary
149
+ };
150
+ };
151
+ var _default = exports.default = generateStyle;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "Tabs", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _Tabs.Tabs;
9
+ return _v.Tabs;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "TabsPanel", {
@@ -21,6 +21,6 @@ Object.defineProperty(exports, "TabsTab", {
21
21
  return _Tab.Tab;
22
22
  }
23
23
  });
24
- var _Tabs = require("./Tabs");
25
- var _Panel = require("./Tabs/Panel");
26
- var _Tab = require("./Tabs/Tab");
24
+ var _v = require("../Tabs/v1");
25
+ var _Panel = require("../Tabs/v1/Panel");
26
+ var _Tab = require("../Tabs/v1/Tab");
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Tabs", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _v.Tabs;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "TabsPanel", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _Panel.Panel;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "TabsTab", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _Tab.Tab;
22
+ }
23
+ });
24
+ var _v = require("../Tabs/v2");
25
+ var _Panel = require("../Tabs/v2/Panel");
26
+ var _Tab = require("../Tabs/v2/Tab");