@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
@@ -0,0 +1,156 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import type { TabsProps, TabsStyle } from './props'
26
+ import type { NewComponentTypes } from '@instructure/ui-themes'
27
+
28
+ type StyleParams = {
29
+ tabOverflow: TabsProps['tabOverflow']
30
+ fixHeight: TabsProps['fixHeight']
31
+ variant: TabsProps['variant']
32
+ }
33
+ /**
34
+ * ---
35
+ * private: true
36
+ * ---
37
+ * Generates the style object from the theme and provided additional information
38
+ * @param {Object} componentTheme The theme variable object.
39
+ * @param {Object} params the props and passed through data of the component, the style is applied to
40
+ * @return {Object} The final style object, which will be used in the component
41
+ */
42
+ const generateStyle = (
43
+ componentTheme: NewComponentTypes['Tabs'],
44
+ params: StyleParams
45
+ ): TabsStyle => {
46
+ const { variant, tabOverflow, fixHeight } = params
47
+
48
+ // fixHeight can be 0, so simply `fixheight` could return falsy value
49
+ const hasFixedHeight = typeof fixHeight !== 'undefined'
50
+
51
+ const variants = {
52
+ default: {
53
+ container: { background: componentTheme.defaultBackground },
54
+ tabs: { marginBottom: `calc(${componentTheme.tabVerticalOffset} * -1)` },
55
+ scrollOverlay: { width: componentTheme.scrollOverlayWidthDefault }
56
+ },
57
+ secondary: {
58
+ container: { background: componentTheme.defaultBackground },
59
+ tabs: {},
60
+ scrollOverlay: { width: componentTheme.scrollOverlayWidthSecondary }
61
+ }
62
+ }
63
+
64
+ const tabOverflowVariants = {
65
+ stack: {
66
+ flexFlow: 'row wrap'
67
+ },
68
+ scroll: {
69
+ marginBottom:
70
+ variant === 'secondary'
71
+ ? `calc(${componentTheme.tabVerticalOffset} * -1)`
72
+ : 0,
73
+ overflowX: 'auto',
74
+ ...(variant === 'default' && {
75
+ '&::-webkit-scrollbar-track': {
76
+ backgroundColor: 'transparent'
77
+ },
78
+ '&::-webkit-scrollbar': {
79
+ height: '0.0625rem',
80
+ backgroundColor: 'transparent'
81
+ },
82
+ '&::-webkit-scrollbar-thumb': {
83
+ backgroundColor: 'transparent'
84
+ }
85
+ }),
86
+ scrollbarWidth: 'none'
87
+ }
88
+ }
89
+
90
+ const commonOverlay = {
91
+ height: `calc(100% - (${componentTheme.tabVerticalOffset} + 0.25rem))`,
92
+ position: 'absolute',
93
+ zIndex: componentTheme.zIndex,
94
+ top: '0',
95
+ pointerEvents: 'none',
96
+ ...variants[variant!].scrollOverlay
97
+ }
98
+
99
+ return {
100
+ tabs: {
101
+ label: 'tabs',
102
+ flexShrink: 0,
103
+ flexGrow: 0,
104
+ ...variants[variant!].tabs
105
+ },
106
+
107
+ container: {
108
+ label: 'tabs__container',
109
+ display: 'flex',
110
+ flexDirection: 'column',
111
+ height: fixHeight,
112
+ ...variants[variant!].container
113
+ },
114
+
115
+ tabList: {
116
+ label: 'tabs__tabList',
117
+ display: 'flex',
118
+ width: '100%',
119
+ ...tabOverflowVariants[tabOverflow!]
120
+ },
121
+
122
+ panelsContainer: {
123
+ label: 'tabs__panelsContainer',
124
+ flexShrink: 1,
125
+ flexGrow: 1,
126
+ display: 'flex',
127
+ flexDirection: 'column',
128
+ ...(hasFixedHeight && {
129
+ overflowY: 'hidden'
130
+ })
131
+ },
132
+
133
+ endScrollOverlay: {
134
+ label: 'tabs__endScrollOverlay',
135
+ insetInlineEnd: '0',
136
+ background: `linear-gradient(to left, ${componentTheme.scrollFadeColor} 0%, rgba(255, 255, 255, 0) 100%)`,
137
+ '[dir="rtl"] &': {
138
+ background: `linear-gradient(to right, ${componentTheme.scrollFadeColor} 0%, rgba(255, 255, 255, 0) 100%)`
139
+ },
140
+ ...commonOverlay
141
+ },
142
+ startScrollOverlay: {
143
+ label: 'tabs__startScrollOverlay',
144
+ insetInlineStart: '0',
145
+ background: `linear-gradient(to right, ${componentTheme.scrollFadeColor} 0%, rgba(255, 255, 255, 0) 100%)`,
146
+ '[dir="rtl"] &': {
147
+ background: `linear-gradient(to left, ${componentTheme.scrollFadeColor} 0%, rgba(255, 255, 255, 0) 100%)`
148
+ },
149
+ ...commonOverlay
150
+ },
151
+ scrollOverlayWidthDefault: componentTheme.scrollOverlayWidthDefault,
152
+ scrollOverlayWidthSecondary: componentTheme.scrollOverlayWidthSecondary
153
+ }
154
+ }
155
+
156
+ export default generateStyle
@@ -22,10 +22,10 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- export { Tabs } from './Tabs'
26
- export { Panel as TabsPanel } from './Tabs/Panel'
27
- export { Tab as TabsTab } from './Tabs/Tab'
25
+ export { Tabs } from '../Tabs/v1'
26
+ export { Panel as TabsPanel } from '../Tabs/v1/Panel'
27
+ export { Tab as TabsTab } from '../Tabs/v1/Tab'
28
28
 
29
- export type { TabsProps } from './Tabs/props'
30
- export type { TabsPanelProps } from './Tabs/Panel/props'
31
- export type { TabsTabProps } from './Tabs/Tab/props'
29
+ export type { TabsProps } from '../Tabs/v1/props'
30
+ export type { TabsPanelProps } from '../Tabs/v1/Panel/props'
31
+ export type { TabsTabProps } from '../Tabs/v1/Tab/props'
@@ -0,0 +1,31 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ export { Tabs } from '../Tabs/v2'
26
+ export { Panel as TabsPanel } from '../Tabs/v2/Panel'
27
+ export { Tab as TabsTab } from '../Tabs/v2/Tab'
28
+
29
+ export type { TabsProps } from '../Tabs/v2/props'
30
+ export type { TabsPanelProps } from '../Tabs/v2/Panel/props'
31
+ export type { TabsTabProps } from '../Tabs/v2/Tab/props'