@umbraco-ui/uui-tabs 1.6.0-rc.1 → 1.6.0-rc.3

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.
@@ -31,6 +31,24 @@
31
31
  "name": "",
32
32
  "description": "Default slot for the tab group"
33
33
  }
34
+ ],
35
+ "cssProperties": [
36
+ {
37
+ "name": "--uui-tab-group-dropdown-tab-text",
38
+ "description": "Define the tab text color in the dropdown"
39
+ },
40
+ {
41
+ "name": "--uui-tab-group-dropdown-tab-text-hover",
42
+ "description": "Define the tab text hover color in the dropdown"
43
+ },
44
+ {
45
+ "name": "--uui-tab-group-dropdown-tab-text-active",
46
+ "description": "Define the tab text active color in the dropdown"
47
+ },
48
+ {
49
+ "name": "--uui-tab-group-dropdown-background",
50
+ "description": "Define the background color of the dropdown"
51
+ }
34
52
  ]
35
53
  },
36
54
  {
@@ -149,10 +167,6 @@
149
167
  "name": "--uui-tab-text-active",
150
168
  "description": "Define the tab text active color"
151
169
  },
152
- {
153
- "name": "--uui-tab-background",
154
- "description": "Define the tab group background color"
155
- },
156
170
  {
157
171
  "name": "--uui-tab-divider",
158
172
  "description": "Define the tab dividers color"
@@ -279,10 +293,6 @@
279
293
  "name": "--uui-tab-text-active",
280
294
  "description": "Define the tab text active color"
281
295
  },
282
- {
283
- "name": "--uui-tab-background",
284
- "description": "Define the tab group background color"
285
- },
286
296
  {
287
297
  "name": "--uui-tab-divider",
288
298
  "description": "Define the tab dividers color"
package/lib/index.js CHANGED
@@ -108,6 +108,10 @@ UUITabElement.styles = [
108
108
  0 1px 2px rgba(0, 0, 0, 0.05);
109
109
  }
110
110
 
111
+ :host([active]) {
112
+ color: var(--uui-tab-text-active, unset);
113
+ }
114
+
111
115
  :host([active]) #button {
112
116
  cursor: default;
113
117
  }
@@ -233,7 +237,7 @@ var __privateMethod = (obj, member, method) => {
233
237
  __accessCheck(obj, member, "access private method");
234
238
  return method;
235
239
  };
236
- var _tabElements, _hiddenTabElements, _hiddenTabElementsMap, _visibilityBreakpoints, _oldBreakpoint, _resizeObserver, _onResize, onResize_fn, _onSlotChange, onSlotChange_fn, _onTabClicked, _updateCollapsibleTabs, updateCollapsibleTabs_fn, _calculateBreakPoints, calculateBreakPoints_fn, _setTabArray, setTabArray_fn, _isElementTabLike, isElementTabLike_fn;
240
+ var _tabElements, _hiddenTabElements, _hiddenTabElementsMap, _visibilityBreakpoints, _resizeObserver, _onResize, onResize_fn, _onSlotChange, onSlotChange_fn, _onTabClicked, _updateCollapsibleTabs, updateCollapsibleTabs_fn, _calculateBreakPoints, calculateBreakPoints_fn, _setTabArray, setTabArray_fn, _isElementTabLike, isElementTabLike_fn;
237
241
  let UUITabGroupElement = class extends LitElement {
238
242
  constructor() {
239
243
  super(...arguments);
@@ -248,7 +252,6 @@ let UUITabGroupElement = class extends LitElement {
248
252
  __privateAdd(this, _hiddenTabElements, []);
249
253
  __privateAdd(this, _hiddenTabElementsMap, /* @__PURE__ */ new Map());
250
254
  __privateAdd(this, _visibilityBreakpoints, []);
251
- __privateAdd(this, _oldBreakpoint, 0);
252
255
  __privateAdd(this, _resizeObserver, new ResizeObserver(
253
256
  __privateMethod(this, _onResize, onResize_fn).bind(this)
254
257
  ));
@@ -300,7 +303,6 @@ let UUITabGroupElement = class extends LitElement {
300
303
  <uui-popover-container
301
304
  id="popover-container"
302
305
  popover
303
- margin="10"
304
306
  placement="bottom-end">
305
307
  <div id="hidden-tabs-container">
306
308
  ${repeat(__privateGet(this, _hiddenTabElements), (el) => html`${el}`)}
@@ -313,7 +315,6 @@ _tabElements = new WeakMap();
313
315
  _hiddenTabElements = new WeakMap();
314
316
  _hiddenTabElementsMap = new WeakMap();
315
317
  _visibilityBreakpoints = new WeakMap();
316
- _oldBreakpoint = new WeakMap();
317
318
  _resizeObserver = new WeakMap();
318
319
  _onResize = new WeakSet();
319
320
  onResize_fn = function(entries) {
@@ -333,20 +334,9 @@ _onTabClicked = new WeakMap();
333
334
  _updateCollapsibleTabs = new WeakSet();
334
335
  updateCollapsibleTabs_fn = function(containerWidth) {
335
336
  const buttonWidth = this._moreButtonElement.offsetWidth;
336
- if (__privateGet(this, _visibilityBreakpoints).slice(-1)[0] < containerWidth && __privateGet(this, _hiddenTabElements).length === 0)
337
+ const lastBreakpoint = __privateGet(this, _visibilityBreakpoints).slice(-1)[0];
338
+ if (lastBreakpoint < containerWidth && __privateGet(this, _hiddenTabElements).length === 0)
337
339
  return;
338
- let newBreakpoint = Number.MAX_VALUE;
339
- for (let i = __privateGet(this, _visibilityBreakpoints).length - 1; i > -1; i--) {
340
- const breakpoint = __privateGet(this, _visibilityBreakpoints)[i];
341
- const containerWidthButtonWidth = containerWidth - (i !== __privateGet(this, _visibilityBreakpoints).length - 1 ? buttonWidth : 0);
342
- if (breakpoint < containerWidthButtonWidth) {
343
- newBreakpoint = i;
344
- break;
345
- }
346
- }
347
- if (newBreakpoint === __privateGet(this, _oldBreakpoint))
348
- return;
349
- __privateSet(this, _oldBreakpoint, newBreakpoint);
350
340
  __privateGet(this, _hiddenTabElements).forEach((el) => {
351
341
  el.removeEventListener("click", __privateGet(this, _onTabClicked));
352
342
  });
@@ -376,16 +366,23 @@ updateCollapsibleTabs_fn = function(containerWidth) {
376
366
  }
377
367
  }
378
368
  }
369
+ if (__privateGet(this, _hiddenTabElements).length === 0) {
370
+ this._popoverContainerElement.hidePopover();
371
+ }
379
372
  hasActiveTabInDropdown ? this._moreButtonElement.classList.add("active-inside") : this._moreButtonElement.classList.remove("active-inside");
380
373
  this.requestUpdate();
381
374
  };
382
375
  _calculateBreakPoints = new WeakSet();
383
- calculateBreakPoints_fn = function() {
376
+ calculateBreakPoints_fn = async function() {
377
+ await this.updateComplete;
384
378
  let childrenWidth = 0;
385
379
  for (let i = 0; i < __privateGet(this, _tabElements).length; i++) {
380
+ __privateGet(this, _tabElements)[i].style.display = "";
386
381
  childrenWidth += __privateGet(this, _tabElements)[i].offsetWidth;
387
382
  __privateGet(this, _visibilityBreakpoints)[i] = childrenWidth;
388
383
  }
384
+ const tolerance = 2;
385
+ this.style.width = childrenWidth + tolerance + "px";
389
386
  __privateMethod(this, _updateCollapsibleTabs, updateCollapsibleTabs_fn).call(this, this.offsetWidth);
390
387
  };
391
388
  _setTabArray = new WeakSet();
@@ -401,11 +398,24 @@ UUITabGroupElement.styles = [
401
398
  css`
402
399
  :host {
403
400
  display: flex;
404
- flex-wrap: wrap;
401
+ flex-wrap: nowrap;
405
402
  color: var(--uui-tab-text);
406
- background: var(--uui-tab-background, none);
407
403
  height: 100%;
408
404
  min-height: 48px;
405
+ overflow: hidden;
406
+ text-wrap: nowrap;
407
+ }
408
+
409
+ #popover-container {
410
+ --uui-tab-text: var(--uui-tab-group-dropdown-tab-text, unset);
411
+ --uui-tab-text-hover: var(
412
+ --uui-tab-group-dropdown-tab-text-hover,
413
+ unset
414
+ );
415
+ --uui-tab-text-active: var(
416
+ --uui-tab-group-dropdown-tab-text-active,
417
+ unset
418
+ );
409
419
  }
410
420
 
411
421
  ::slotted(*:not(:last-of-type)) {
@@ -420,7 +430,10 @@ UUITabGroupElement.styles = [
420
430
  width: fit-content;
421
431
  display: flex;
422
432
  flex-direction: column;
423
- background: var(--uui-color-surface,#fff);
433
+ background-color: var(
434
+ --uui-tab-group-dropdown-background,
435
+ var(--uui-color-surface,#fff)
436
+ );
424
437
  border-radius: var(--uui-border-radius,3px);
425
438
  box-shadow: var(--uui-shadow-depth-3,0 10px 20px rgba(0,0,0,0.19) , 0 6px 6px rgba(0,0,0,0.23));
426
439
  overflow: hidden;
@@ -430,8 +443,12 @@ UUITabGroupElement.styles = [
430
443
  }
431
444
 
432
445
  #more-button {
433
- margin-left: auto;
434
446
  position: relative;
447
+
448
+ --uui-button-contrast: var(--uui-tab-text);
449
+ --uui-button-contrast-hover: var(--uui-tab-text-hover);
450
+ --uui-button-background-color: transparent;
451
+ --uui-button-background-color-hover: transparent;
435
452
  }
436
453
  #more-button::before {
437
454
  content: '';
@@ -454,6 +471,9 @@ UUITabGroupElement.styles = [
454
471
  __decorateClass([
455
472
  query("#more-button")
456
473
  ], UUITabGroupElement.prototype, "_moreButtonElement", 2);
474
+ __decorateClass([
475
+ query("#popover-container")
476
+ ], UUITabGroupElement.prototype, "_popoverContainerElement", 2);
457
477
  __decorateClass([
458
478
  queryAssignedElements({
459
479
  flatten: true,
@@ -5,10 +5,15 @@ import '@umbraco-ui/uui-symbol-more/lib';
5
5
  /**
6
6
  * @element uui-tab-group
7
7
  * @slot - Default slot for the tab group
8
+ * @cssprop --uui-tab-group-dropdown-tab-text - Define the tab text color in the dropdown
9
+ * @cssprop --uui-tab-group-dropdown-tab-text-hover - Define the tab text hover color in the dropdown
10
+ * @cssprop --uui-tab-group-dropdown-tab-text-active - Define the tab text active color in the dropdown
11
+ * @cssprop --uui-tab-group-dropdown-background - Define the background color of the dropdown
8
12
  */
9
13
  export declare class UUITabGroupElement extends LitElement {
10
14
  #private;
11
15
  private _moreButtonElement;
16
+ private _popoverContainerElement;
12
17
  private _slottedNodes?;
13
18
  /**
14
19
  * Set the flex direction of the content of the dropdown.
@@ -10,7 +10,6 @@ declare const UUITabElement_base: (new (...args: any[]) => import("@umbraco-ui/u
10
10
  * @cssprop --uui-tab-text - Define the tab text color
11
11
  * @cssprop --uui-tab-text-hover - Define the tab text hover color
12
12
  * @cssprop --uui-tab-text-active - Define the tab text active color
13
- * @cssprop --uui-tab-background - Define the tab group background color
14
13
  * @cssprop --uui-tab-divider - Define the tab dividers color
15
14
  * @cssprop --uui-tab-padding-horizontal - Define the tab horizontal padding
16
15
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-ui/uui-tabs",
3
- "version": "1.6.0-rc.1",
3
+ "version": "1.6.0-rc.3",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "Umbraco",
@@ -30,10 +30,10 @@
30
30
  "custom-elements.json"
31
31
  ],
32
32
  "dependencies": {
33
- "@umbraco-ui/uui-base": "1.6.0-rc.1",
34
- "@umbraco-ui/uui-button": "1.6.0-rc.1",
35
- "@umbraco-ui/uui-popover-container": "1.6.0-rc.1",
36
- "@umbraco-ui/uui-symbol-more": "1.6.0-rc.1"
33
+ "@umbraco-ui/uui-base": "1.6.0-rc.3",
34
+ "@umbraco-ui/uui-button": "1.6.0-rc.3",
35
+ "@umbraco-ui/uui-popover-container": "1.6.0-rc.3",
36
+ "@umbraco-ui/uui-symbol-more": "1.6.0-rc.3"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
@@ -44,5 +44,5 @@
44
44
  "access": "public"
45
45
  },
46
46
  "homepage": "https://uui.umbraco.com/?path=/story/uui-tabs",
47
- "gitHead": "9708ccbac569560b716431080c782c5531c66ea5"
47
+ "gitHead": "27c5350ac041811e4d24b656030e7dca544caff1"
48
48
  }