@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 CHANGED
@@ -130,25 +130,27 @@ export default class ShowMore extends React.Component {
130
130
  </div>
131
131
  }
132
132
  >
133
- <div
134
- ref={onShowMoreChanged}
135
- className={showMoreStyles}
136
- role="navigation"
137
- tabIndex="0"
138
- onFocus={this.onFocus}
139
- onBlur={this.onBlur}
140
- onClick={this.toggleVisibility}
141
- >
142
- <Button
143
- checked={!isListHidden}
144
- className={showMoreLabelStyles}
145
- icon={<ChevronIcon />}
146
- kind="default"
147
- size="L"
148
- data-title="More tabs"
149
- noBackground
150
- isWide
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 = this.tabsWrapper.offsetWidth - this.props.showMoreWidthBuffer
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
  ))}