@umbraco-ui/uui-tabs 1.8.0-rc.2 → 1.9.0-rc.0

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.
@@ -78,6 +78,12 @@
78
78
  "type": "string",
79
79
  "default": "\"undefined\""
80
80
  },
81
+ {
82
+ "name": "rel",
83
+ "description": "Set the rel attribute for an anchor tag, only used when using href.",
84
+ "type": "string",
85
+ "default": "\"undefined\""
86
+ },
81
87
  {
82
88
  "name": "orientation",
83
89
  "description": "Set the visual orientation of this tab, this changes the look and placement of the active indication.",
@@ -118,6 +124,13 @@
118
124
  "type": "string",
119
125
  "default": "\"undefined\""
120
126
  },
127
+ {
128
+ "name": "rel",
129
+ "attribute": "rel",
130
+ "description": "Set the rel attribute for an anchor tag, only used when using href.",
131
+ "type": "string",
132
+ "default": "\"undefined\""
133
+ },
121
134
  {
122
135
  "name": "orientation",
123
136
  "attribute": "orientation",
@@ -204,6 +217,12 @@
204
217
  "type": "string",
205
218
  "default": "\"undefined\""
206
219
  },
220
+ {
221
+ "name": "rel",
222
+ "description": "Set the rel attribute for an anchor tag, only used when using href.",
223
+ "type": "string",
224
+ "default": "\"undefined\""
225
+ },
207
226
  {
208
227
  "name": "orientation",
209
228
  "description": "Set the visual orientation of this tab, this changes the look and placement of the active indication.",
@@ -244,6 +263,13 @@
244
263
  "type": "string",
245
264
  "default": "\"undefined\""
246
265
  },
266
+ {
267
+ "name": "rel",
268
+ "attribute": "rel",
269
+ "description": "Set the rel attribute for an anchor tag, only used when using href.",
270
+ "type": "string",
271
+ "default": "\"undefined\""
272
+ },
247
273
  {
248
274
  "name": "orientation",
249
275
  "attribute": "orientation",
package/lib/index.js CHANGED
@@ -14,8 +14,7 @@ var __decorateClass$1 = (decorators, target, key, kind) => {
14
14
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
15
15
  if (decorator = decorators[i])
16
16
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
17
- if (kind && result)
18
- __defProp$1(target, key, result);
17
+ if (kind && result) __defProp$1(target, key, result);
19
18
  return result;
20
19
  };
21
20
  let UUITabElement = class extends ActiveMixin(LabelMixin("", LitElement)) {
@@ -38,7 +37,9 @@ let UUITabElement = class extends ActiveMixin(LabelMixin("", LitElement)) {
38
37
  href=${ifDefined(!this.disabled ? this.href : void 0)}
39
38
  target=${ifDefined(this.target || void 0)}
40
39
  rel=${ifDefined(
41
- this.target === "_blank" ? "noopener noreferrer" : void 0
40
+ this.rel || ifDefined(
41
+ this.target === "_blank" ? "noopener noreferrer" : void 0
42
+ )
42
43
  )}
43
44
  role="tab">
44
45
  <slot name="icon"></slot>
@@ -97,11 +98,11 @@ UUITabElement.styles = [
97
98
  var(--uui-tab-padding-horizontal, var(--uui-size-5,15px));
98
99
  }
99
100
 
100
- :host(:not([active]):not([disabled])) #button:hover {
101
+ :host(:not([disabled])) #button:hover {
101
102
  color: var(--uui-tab-text-hover, var(--uui-color-default-emphasis,#3544b1));
102
103
  }
103
104
 
104
- :host(:not([active]):not([disabled])) #button:active {
105
+ :host(:not([disabled])) #button:active {
105
106
  box-shadow:
106
107
  inset 0 2px 4px rgba(0, 0, 0, 0.15),
107
108
  0 1px 2px rgba(0, 0, 0, 0.05);
@@ -111,9 +112,6 @@ UUITabElement.styles = [
111
112
  color: var(--uui-tab-text-active, unset);
112
113
  }
113
114
 
114
- :host([active]) #button {
115
- cursor: default;
116
- }
117
115
  :host([disabled]) #button {
118
116
  color: var(--uui-color-disabled-contrast,#c4c4c4);
119
117
  cursor: default;
@@ -124,9 +122,6 @@ UUITabElement.styles = [
124
122
  position: absolute;
125
123
  background-color: var(--uui-color-current,#f5c1bc);
126
124
  opacity: 0;
127
- --transitionDuration: 120ms;
128
- --barWidth: 4px;
129
- --borderRadius: 3px;
130
125
  }
131
126
  :host([active]) #button::before {
132
127
  opacity: 1;
@@ -136,32 +131,32 @@ UUITabElement.styles = [
136
131
  :host([orientation='horizontal']) #button::before {
137
132
  left: auto;
138
133
  right: auto;
139
- border-radius: var(--borderRadius) var(--borderRadius) 0 0;
134
+ border-radius: var(--uui-border-radius,3px) var(--uui-border-radius,3px) 0 0;
140
135
  height: 0px;
141
136
  width: calc(100% - 15px);
142
137
  bottom: 0;
143
138
  transition:
144
- opacity ease-in-out var(--transitionDuration),
145
- height ease-in-out var(--transitionDuration);
139
+ opacity linear 120ms,
140
+ height ease-in-out 120ms;
146
141
  }
147
142
  :host([active][orientation='horizontal']) #button::before {
148
- height: var(--barWidth);
143
+ height: 4px;
149
144
  }
150
145
 
151
146
  /* VERTICAL */
152
147
  :host([orientation='vertical']) #button::before {
153
148
  top: auto;
154
149
  bottom: auto;
155
- border-radius: 0 var(--borderRadius) var(--borderRadius) 0;
150
+ border-radius: 0 var(--uui-border-radius,3px) var(--uui-border-radius,3px) 0;
156
151
  height: calc(100% - 12px);
157
152
  width: 0px;
158
153
  left: 0;
159
154
  transition:
160
- opacity ease-in-out var(--transitionDuration),
161
- width ease-in-out var(--transitionDuration);
155
+ opacity linear 120ms,
156
+ width ease-in-out 120ms;
162
157
  }
163
158
  :host([active][orientation='vertical']) #button::before {
164
- width: var(--barWidth);
159
+ width: 4px;
165
160
  }
166
161
 
167
162
  #button:hover::before {
@@ -198,6 +193,9 @@ __decorateClass$1([
198
193
  __decorateClass$1([
199
194
  property({ type: String })
200
195
  ], UUITabElement.prototype, "target", 2);
196
+ __decorateClass$1([
197
+ property({ type: String })
198
+ ], UUITabElement.prototype, "rel", 2);
201
199
  __decorateClass$1([
202
200
  property({ type: String, reflect: true })
203
201
  ], UUITabElement.prototype, "orientation", 2);
@@ -207,49 +205,27 @@ UUITabElement = __decorateClass$1([
207
205
 
208
206
  var __defProp = Object.defineProperty;
209
207
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
208
+ var __typeError = (msg) => {
209
+ throw TypeError(msg);
210
+ };
210
211
  var __decorateClass = (decorators, target, key, kind) => {
211
212
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
212
213
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
213
214
  if (decorator = decorators[i])
214
215
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
215
- if (kind && result)
216
- __defProp(target, key, result);
216
+ if (kind && result) __defProp(target, key, result);
217
217
  return result;
218
218
  };
219
- var __accessCheck = (obj, member, msg) => {
220
- if (!member.has(obj))
221
- throw TypeError("Cannot " + msg);
222
- };
223
- var __privateGet = (obj, member, getter) => {
224
- __accessCheck(obj, member, "read from private field");
225
- return getter ? getter.call(obj) : member.get(obj);
226
- };
227
- var __privateAdd = (obj, member, value) => {
228
- if (member.has(obj))
229
- throw TypeError("Cannot add the same private member more than once");
230
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
231
- };
232
- var __privateSet = (obj, member, value, setter) => {
233
- __accessCheck(obj, member, "write to private field");
234
- setter ? setter.call(obj, value) : member.set(obj, value);
235
- return value;
236
- };
237
- var __privateMethod = (obj, member, method) => {
238
- __accessCheck(obj, member, "access private method");
239
- return method;
240
- };
241
- var _currentGap, _tabElements, _hiddenTabElements, _hiddenTabElementsMap, _visibilityBreakpoints, _resizeObserver, _tabResizeObservers, _breakPointCalculationInProgress, _initialize, initialize_fn, _onResize, onResize_fn, _cleanupTabs, cleanupTabs_fn, _onSlotChange, onSlotChange_fn, _onTabClicked, _calculateBreakPoints, calculateBreakPoints_fn, _setTabArray, setTabArray_fn, _updateCollapsibleTabs, updateCollapsibleTabs_fn, _isElementTabLike, isElementTabLike_fn;
219
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
220
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
221
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
222
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
223
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
224
+ var _currentGap, _tabElements, _hiddenTabElements, _hiddenTabElementsMap, _visibilityBreakpoints, _resizeObserver, _tabResizeObservers, _breakPointCalculationInProgress, _UUITabGroupElement_instances, initialize_fn, onResize_fn, cleanupTabs_fn, onSlotChange_fn, _onTabClicked, calculateBreakPoints_fn, setTabArray_fn, updateCollapsibleTabs_fn, isElementTabLike_fn;
242
225
  let UUITabGroupElement = class extends LitElement {
243
226
  constructor() {
244
227
  super(...arguments);
245
- __privateAdd(this, _initialize);
246
- __privateAdd(this, _onResize);
247
- __privateAdd(this, _cleanupTabs);
248
- __privateAdd(this, _onSlotChange);
249
- __privateAdd(this, _calculateBreakPoints);
250
- __privateAdd(this, _setTabArray);
251
- __privateAdd(this, _updateCollapsibleTabs);
252
- __privateAdd(this, _isElementTabLike);
228
+ __privateAdd(this, _UUITabGroupElement_instances);
253
229
  /** Stores the current gap used in the breakpoints */
254
230
  __privateAdd(this, _currentGap, 0);
255
231
  this.dropdownContentDirection = "vertical";
@@ -257,12 +233,12 @@ let UUITabGroupElement = class extends LitElement {
257
233
  __privateAdd(this, _hiddenTabElements, []);
258
234
  __privateAdd(this, _hiddenTabElementsMap, /* @__PURE__ */ new Map());
259
235
  __privateAdd(this, _visibilityBreakpoints, []);
260
- __privateAdd(this, _resizeObserver, new ResizeObserver(__privateMethod(this, _onResize, onResize_fn).bind(this)));
236
+ __privateAdd(this, _resizeObserver, new ResizeObserver(__privateMethod(this, _UUITabGroupElement_instances, onResize_fn).bind(this)));
261
237
  __privateAdd(this, _tabResizeObservers, []);
262
238
  __privateAdd(this, _breakPointCalculationInProgress, false);
263
239
  __privateAdd(this, _onTabClicked, (e) => {
264
240
  const selectedElement = e.currentTarget;
265
- if (__privateMethod(this, _isElementTabLike, isElementTabLike_fn).call(this, selectedElement)) {
241
+ if (__privateMethod(this, _UUITabGroupElement_instances, isElementTabLike_fn).call(this, selectedElement)) {
266
242
  selectedElement.active = true;
267
243
  const linkedElement = __privateGet(this, _hiddenTabElementsMap).get(selectedElement);
268
244
  if (linkedElement) {
@@ -273,7 +249,7 @@ let UUITabGroupElement = class extends LitElement {
273
249
  ...__privateGet(this, _hiddenTabElements)
274
250
  ].filter((el) => el !== selectedElement && el !== linkedElement);
275
251
  filtered.forEach((el) => {
276
- if (__privateMethod(this, _isElementTabLike, isElementTabLike_fn).call(this, el)) {
252
+ if (__privateMethod(this, _UUITabGroupElement_instances, isElementTabLike_fn).call(this, el)) {
277
253
  el.active = false;
278
254
  }
279
255
  });
@@ -286,18 +262,18 @@ let UUITabGroupElement = class extends LitElement {
286
262
  }
287
263
  connectedCallback() {
288
264
  super.connectedCallback();
289
- __privateMethod(this, _initialize, initialize_fn).call(this);
265
+ __privateMethod(this, _UUITabGroupElement_instances, initialize_fn).call(this);
290
266
  }
291
267
  disconnectedCallback() {
292
268
  super.disconnectedCallback();
293
269
  __privateGet(this, _resizeObserver).unobserve(this);
294
- __privateMethod(this, _cleanupTabs, cleanupTabs_fn).call(this);
270
+ __privateMethod(this, _UUITabGroupElement_instances, cleanupTabs_fn).call(this);
295
271
  }
296
272
  render() {
297
273
  return html`
298
274
  <div id="main">
299
275
  <div id="grid">
300
- <slot @slotchange=${__privateMethod(this, _onSlotChange, onSlotChange_fn)}></slot>
276
+ <slot @slotchange=${__privateMethod(this, _UUITabGroupElement_instances, onSlotChange_fn)}></slot>
301
277
  </div>
302
278
  <uui-button
303
279
  popovertarget="popover-container"
@@ -327,29 +303,26 @@ _visibilityBreakpoints = new WeakMap();
327
303
  _resizeObserver = new WeakMap();
328
304
  _tabResizeObservers = new WeakMap();
329
305
  _breakPointCalculationInProgress = new WeakMap();
330
- _initialize = new WeakSet();
306
+ _UUITabGroupElement_instances = new WeakSet();
331
307
  initialize_fn = async function() {
332
308
  demandCustomElement(this, "uui-button");
333
309
  demandCustomElement(this, "uui-popover-container");
334
310
  demandCustomElement(this, "uui-symbol-more");
335
- if (!this.hasAttribute("role"))
336
- this.setAttribute("role", "tablist");
311
+ if (!this.hasAttribute("role")) this.setAttribute("role", "tablist");
337
312
  await this.updateComplete;
338
313
  __privateGet(this, _resizeObserver).observe(this._mainElement);
339
314
  };
340
- _onResize = new WeakSet();
341
315
  onResize_fn = function(entries) {
342
316
  const gapCSSVar = Number.parseFloat(
343
317
  this.style.getPropertyValue("--uui-tab-group-gap")
344
318
  );
345
319
  const newGap = Number.isNaN(gapCSSVar) ? 0 : gapCSSVar;
346
320
  if (newGap !== __privateGet(this, _currentGap)) {
347
- __privateMethod(this, _calculateBreakPoints, calculateBreakPoints_fn).call(this);
321
+ __privateMethod(this, _UUITabGroupElement_instances, calculateBreakPoints_fn).call(this);
348
322
  } else {
349
- __privateMethod(this, _updateCollapsibleTabs, updateCollapsibleTabs_fn).call(this, entries[0].contentBoxSize[0].inlineSize);
323
+ __privateMethod(this, _UUITabGroupElement_instances, updateCollapsibleTabs_fn).call(this, entries[0].contentBoxSize[0].inlineSize);
350
324
  }
351
325
  };
352
- _cleanupTabs = new WeakSet();
353
326
  cleanupTabs_fn = function() {
354
327
  __privateGet(this, _tabElements).forEach((el) => {
355
328
  el.removeEventListener("click", __privateGet(this, _onTabClicked));
@@ -358,24 +331,21 @@ cleanupTabs_fn = function() {
358
331
  __privateGet(this, _tabResizeObservers).length = 0;
359
332
  __privateGet(this, _visibilityBreakpoints).length = 0;
360
333
  };
361
- _onSlotChange = new WeakSet();
362
334
  onSlotChange_fn = function() {
363
- __privateMethod(this, _cleanupTabs, cleanupTabs_fn).call(this);
364
- __privateMethod(this, _setTabArray, setTabArray_fn).call(this);
335
+ __privateMethod(this, _UUITabGroupElement_instances, cleanupTabs_fn).call(this);
336
+ __privateMethod(this, _UUITabGroupElement_instances, setTabArray_fn).call(this);
365
337
  __privateGet(this, _tabElements).forEach((el) => {
366
338
  el.addEventListener("click", __privateGet(this, _onTabClicked));
367
339
  const observer = new ResizeObserver(
368
- __privateMethod(this, _calculateBreakPoints, calculateBreakPoints_fn).bind(this)
340
+ __privateMethod(this, _UUITabGroupElement_instances, calculateBreakPoints_fn).bind(this)
369
341
  );
370
342
  observer.observe(el);
371
343
  __privateGet(this, _tabResizeObservers).push(observer);
372
344
  });
373
345
  };
374
346
  _onTabClicked = new WeakMap();
375
- _calculateBreakPoints = new WeakSet();
376
347
  calculateBreakPoints_fn = async function() {
377
- if (__privateGet(this, _breakPointCalculationInProgress))
378
- return;
348
+ if (__privateGet(this, _breakPointCalculationInProgress)) return;
379
349
  __privateSet(this, _breakPointCalculationInProgress, true);
380
350
  requestAnimationFrame(() => {
381
351
  __privateSet(this, _breakPointCalculationInProgress, false);
@@ -395,14 +365,12 @@ calculateBreakPoints_fn = async function() {
395
365
  }
396
366
  const tolerance = 2;
397
367
  this._mainElement.style.width = childrenWidth - gap + tolerance + "px";
398
- __privateMethod(this, _updateCollapsibleTabs, updateCollapsibleTabs_fn).call(this, this._mainElement.offsetWidth);
368
+ __privateMethod(this, _UUITabGroupElement_instances, updateCollapsibleTabs_fn).call(this, this._mainElement.offsetWidth);
399
369
  };
400
- _setTabArray = new WeakSet();
401
370
  setTabArray_fn = function() {
402
371
  __privateSet(this, _tabElements, this._slottedNodes ? this._slottedNodes : []);
403
- __privateMethod(this, _calculateBreakPoints, calculateBreakPoints_fn).call(this);
372
+ __privateMethod(this, _UUITabGroupElement_instances, calculateBreakPoints_fn).call(this);
404
373
  };
405
- _updateCollapsibleTabs = new WeakSet();
406
374
  updateCollapsibleTabs_fn = function(containerWidth) {
407
375
  const moreButtonWidth = this._moreButtonElement.offsetWidth;
408
376
  const containerWithoutButtonWidth = containerWidth - (moreButtonWidth ? moreButtonWidth : 0);
@@ -442,7 +410,6 @@ updateCollapsibleTabs_fn = function(containerWidth) {
442
410
  hasActiveTabInDropdown ? this._moreButtonElement.classList.add("active-inside") : this._moreButtonElement.classList.remove("active-inside");
443
411
  this.requestUpdate();
444
412
  };
445
- _isElementTabLike = new WeakSet();
446
413
  isElementTabLike_fn = function(el) {
447
414
  return typeof el === "object" && "active" in el && typeof el.active === "boolean";
448
415
  };
@@ -35,6 +35,13 @@ export declare class UUITabElement extends UUITabElement_base {
35
35
  * @default undefined
36
36
  */
37
37
  target?: '_blank' | '_parent' | '_self' | '_top';
38
+ /**
39
+ * Set the rel attribute for an anchor tag, only used when using href.
40
+ * @type {string}
41
+ * @attr
42
+ * @default undefined
43
+ */
44
+ rel?: string;
38
45
  /**
39
46
  * Set the visual orientation of this tab, this changes the look and placement of the active indication.
40
47
  * @type {string}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-ui/uui-tabs",
3
- "version": "1.8.0-rc.2",
3
+ "version": "1.9.0-rc.0",
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.8.0-rc.0",
34
- "@umbraco-ui/uui-button": "1.8.0-rc.2",
35
- "@umbraco-ui/uui-popover-container": "1.8.0-rc.0",
36
- "@umbraco-ui/uui-symbol-more": "1.8.0-rc.0"
33
+ "@umbraco-ui/uui-base": "1.9.0-rc.0",
34
+ "@umbraco-ui/uui-button": "1.9.0-rc.0",
35
+ "@umbraco-ui/uui-popover-container": "1.9.0-rc.0",
36
+ "@umbraco-ui/uui-symbol-more": "1.9.0-rc.0"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "npm run analyze && tsc --build && 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": "d37c2c4ba77397c7e3979f04dfc221f50ed421f1"
47
+ "gitHead": "e3e398e07b6ff9874aa0656cb7767df42f58a4ce"
48
48
  }