@targetprocess/tabs 12.18.1 → 12.18.2-alpha.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/ShowMore.jsx +21 -19
- package/Tabs.jsx +15 -2
- package/dist/tabs.es.js +162 -249
- package/dist/tabs.js +162 -249
- package/package.json +4 -4
- package/style/index.css +15 -0
package/ShowMore.jsx
CHANGED
|
@@ -130,25 +130,27 @@ export default class ShowMore extends React.Component {
|
|
|
130
130
|
</div>
|
|
131
131
|
}
|
|
132
132
|
>
|
|
133
|
-
<div
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
133
|
+
<div className={styles.tabs__header__tabs__showmore__wrapper}>
|
|
134
|
+
<div
|
|
135
|
+
ref={onShowMoreChanged}
|
|
136
|
+
className={showMoreStyles}
|
|
137
|
+
role="navigation"
|
|
138
|
+
tabIndex="0"
|
|
139
|
+
onFocus={this.onFocus}
|
|
140
|
+
onBlur={this.onBlur}
|
|
141
|
+
onClick={this.toggleVisibility}
|
|
142
|
+
>
|
|
143
|
+
<Button
|
|
144
|
+
checked={!isListHidden}
|
|
145
|
+
className={showMoreLabelStyles}
|
|
146
|
+
icon={<ChevronIcon />}
|
|
147
|
+
kind="default"
|
|
148
|
+
size="L"
|
|
149
|
+
data-title="More tabs"
|
|
150
|
+
noBackground
|
|
151
|
+
isWide
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
152
154
|
</div>
|
|
153
155
|
</Popover>
|
|
154
156
|
)
|
package/Tabs.jsx
CHANGED
|
@@ -78,6 +78,8 @@ export class Tabs extends React.Component {
|
|
|
78
78
|
|
|
79
79
|
activeTabElement = null
|
|
80
80
|
|
|
81
|
+
titleWrapper = null
|
|
82
|
+
|
|
81
83
|
state = {
|
|
82
84
|
activeTabId: this.props.initialActiveTabId,
|
|
83
85
|
cachedTabs: new Set(),
|
|
@@ -199,7 +201,8 @@ export class Tabs extends React.Component {
|
|
|
199
201
|
}
|
|
200
202
|
|
|
201
203
|
// initial wrapper width calculation
|
|
202
|
-
const blockWidth =
|
|
204
|
+
const blockWidth =
|
|
205
|
+
this.tabsWrapper.offsetWidth - this.props.showMoreWidthBuffer - this.getTitleWidth()
|
|
203
206
|
|
|
204
207
|
// calculate width and offset for each tab
|
|
205
208
|
let tabsTotalWidth = 0
|
|
@@ -230,8 +233,10 @@ export class Tabs extends React.Component {
|
|
|
230
233
|
})
|
|
231
234
|
}
|
|
232
235
|
|
|
236
|
+
getTitleWidth = () => (this.titleWrapper ? this.titleWrapper.offsetWidth : 0)
|
|
237
|
+
|
|
233
238
|
onResizeThrottled = width => {
|
|
234
|
-
this.setState({blockWidth: width - this.props.showMoreWidthBuffer})
|
|
239
|
+
this.setState({blockWidth: width - this.props.showMoreWidthBuffer - this.getTitleWidth()})
|
|
235
240
|
this.adjustSlider()
|
|
236
241
|
}
|
|
237
242
|
|
|
@@ -428,6 +433,14 @@ export class Tabs extends React.Component {
|
|
|
428
433
|
onKeyDown={this.onKeyDown}
|
|
429
434
|
className={styles.tabs__header__container}
|
|
430
435
|
>
|
|
436
|
+
{this.props.title ? (
|
|
437
|
+
<div
|
|
438
|
+
className={styles.tabs__header__title}
|
|
439
|
+
ref={titleWrapper => (this.titleWrapper = titleWrapper)}
|
|
440
|
+
>
|
|
441
|
+
{this.props.title}
|
|
442
|
+
</div>
|
|
443
|
+
) : null}
|
|
431
444
|
{tabsVisible.map(tab => (
|
|
432
445
|
<TabInner {...this.getTabProps(tab)} />
|
|
433
446
|
))}
|