@umbraco-ui/uui-tabs 1.8.0 → 1.9.0-rc.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/custom-elements.json +26 -0
- package/lib/index.js +34 -61
- package/lib/uui-tab.element.d.ts +7 -0
- package/package.json +6 -6
package/custom-elements.json
CHANGED
|
@@ -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.
|
|
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>
|
|
@@ -192,6 +193,9 @@ __decorateClass$1([
|
|
|
192
193
|
__decorateClass$1([
|
|
193
194
|
property({ type: String })
|
|
194
195
|
], UUITabElement.prototype, "target", 2);
|
|
196
|
+
__decorateClass$1([
|
|
197
|
+
property({ type: String })
|
|
198
|
+
], UUITabElement.prototype, "rel", 2);
|
|
195
199
|
__decorateClass$1([
|
|
196
200
|
property({ type: String, reflect: true })
|
|
197
201
|
], UUITabElement.prototype, "orientation", 2);
|
|
@@ -201,49 +205,27 @@ UUITabElement = __decorateClass$1([
|
|
|
201
205
|
|
|
202
206
|
var __defProp = Object.defineProperty;
|
|
203
207
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
208
|
+
var __typeError = (msg) => {
|
|
209
|
+
throw TypeError(msg);
|
|
210
|
+
};
|
|
204
211
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
205
212
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
206
213
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
207
214
|
if (decorator = decorators[i])
|
|
208
215
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
209
|
-
if (kind && result)
|
|
210
|
-
__defProp(target, key, result);
|
|
216
|
+
if (kind && result) __defProp(target, key, result);
|
|
211
217
|
return result;
|
|
212
218
|
};
|
|
213
|
-
var __accessCheck = (obj, member, msg) =>
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
var
|
|
218
|
-
|
|
219
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
220
|
-
};
|
|
221
|
-
var __privateAdd = (obj, member, value) => {
|
|
222
|
-
if (member.has(obj))
|
|
223
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
224
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
225
|
-
};
|
|
226
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
227
|
-
__accessCheck(obj, member, "write to private field");
|
|
228
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
229
|
-
return value;
|
|
230
|
-
};
|
|
231
|
-
var __privateMethod = (obj, member, method) => {
|
|
232
|
-
__accessCheck(obj, member, "access private method");
|
|
233
|
-
return method;
|
|
234
|
-
};
|
|
235
|
-
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;
|
|
236
225
|
let UUITabGroupElement = class extends LitElement {
|
|
237
226
|
constructor() {
|
|
238
227
|
super(...arguments);
|
|
239
|
-
__privateAdd(this,
|
|
240
|
-
__privateAdd(this, _onResize);
|
|
241
|
-
__privateAdd(this, _cleanupTabs);
|
|
242
|
-
__privateAdd(this, _onSlotChange);
|
|
243
|
-
__privateAdd(this, _calculateBreakPoints);
|
|
244
|
-
__privateAdd(this, _setTabArray);
|
|
245
|
-
__privateAdd(this, _updateCollapsibleTabs);
|
|
246
|
-
__privateAdd(this, _isElementTabLike);
|
|
228
|
+
__privateAdd(this, _UUITabGroupElement_instances);
|
|
247
229
|
/** Stores the current gap used in the breakpoints */
|
|
248
230
|
__privateAdd(this, _currentGap, 0);
|
|
249
231
|
this.dropdownContentDirection = "vertical";
|
|
@@ -251,12 +233,12 @@ let UUITabGroupElement = class extends LitElement {
|
|
|
251
233
|
__privateAdd(this, _hiddenTabElements, []);
|
|
252
234
|
__privateAdd(this, _hiddenTabElementsMap, /* @__PURE__ */ new Map());
|
|
253
235
|
__privateAdd(this, _visibilityBreakpoints, []);
|
|
254
|
-
__privateAdd(this, _resizeObserver, new ResizeObserver(__privateMethod(this,
|
|
236
|
+
__privateAdd(this, _resizeObserver, new ResizeObserver(__privateMethod(this, _UUITabGroupElement_instances, onResize_fn).bind(this)));
|
|
255
237
|
__privateAdd(this, _tabResizeObservers, []);
|
|
256
238
|
__privateAdd(this, _breakPointCalculationInProgress, false);
|
|
257
239
|
__privateAdd(this, _onTabClicked, (e) => {
|
|
258
240
|
const selectedElement = e.currentTarget;
|
|
259
|
-
if (__privateMethod(this,
|
|
241
|
+
if (__privateMethod(this, _UUITabGroupElement_instances, isElementTabLike_fn).call(this, selectedElement)) {
|
|
260
242
|
selectedElement.active = true;
|
|
261
243
|
const linkedElement = __privateGet(this, _hiddenTabElementsMap).get(selectedElement);
|
|
262
244
|
if (linkedElement) {
|
|
@@ -267,7 +249,7 @@ let UUITabGroupElement = class extends LitElement {
|
|
|
267
249
|
...__privateGet(this, _hiddenTabElements)
|
|
268
250
|
].filter((el) => el !== selectedElement && el !== linkedElement);
|
|
269
251
|
filtered.forEach((el) => {
|
|
270
|
-
if (__privateMethod(this,
|
|
252
|
+
if (__privateMethod(this, _UUITabGroupElement_instances, isElementTabLike_fn).call(this, el)) {
|
|
271
253
|
el.active = false;
|
|
272
254
|
}
|
|
273
255
|
});
|
|
@@ -280,18 +262,18 @@ let UUITabGroupElement = class extends LitElement {
|
|
|
280
262
|
}
|
|
281
263
|
connectedCallback() {
|
|
282
264
|
super.connectedCallback();
|
|
283
|
-
__privateMethod(this,
|
|
265
|
+
__privateMethod(this, _UUITabGroupElement_instances, initialize_fn).call(this);
|
|
284
266
|
}
|
|
285
267
|
disconnectedCallback() {
|
|
286
268
|
super.disconnectedCallback();
|
|
287
269
|
__privateGet(this, _resizeObserver).unobserve(this);
|
|
288
|
-
__privateMethod(this,
|
|
270
|
+
__privateMethod(this, _UUITabGroupElement_instances, cleanupTabs_fn).call(this);
|
|
289
271
|
}
|
|
290
272
|
render() {
|
|
291
273
|
return html`
|
|
292
274
|
<div id="main">
|
|
293
275
|
<div id="grid">
|
|
294
|
-
<slot @slotchange=${__privateMethod(this,
|
|
276
|
+
<slot @slotchange=${__privateMethod(this, _UUITabGroupElement_instances, onSlotChange_fn)}></slot>
|
|
295
277
|
</div>
|
|
296
278
|
<uui-button
|
|
297
279
|
popovertarget="popover-container"
|
|
@@ -321,29 +303,26 @@ _visibilityBreakpoints = new WeakMap();
|
|
|
321
303
|
_resizeObserver = new WeakMap();
|
|
322
304
|
_tabResizeObservers = new WeakMap();
|
|
323
305
|
_breakPointCalculationInProgress = new WeakMap();
|
|
324
|
-
|
|
306
|
+
_UUITabGroupElement_instances = new WeakSet();
|
|
325
307
|
initialize_fn = async function() {
|
|
326
308
|
demandCustomElement(this, "uui-button");
|
|
327
309
|
demandCustomElement(this, "uui-popover-container");
|
|
328
310
|
demandCustomElement(this, "uui-symbol-more");
|
|
329
|
-
if (!this.hasAttribute("role"))
|
|
330
|
-
this.setAttribute("role", "tablist");
|
|
311
|
+
if (!this.hasAttribute("role")) this.setAttribute("role", "tablist");
|
|
331
312
|
await this.updateComplete;
|
|
332
313
|
__privateGet(this, _resizeObserver).observe(this._mainElement);
|
|
333
314
|
};
|
|
334
|
-
_onResize = new WeakSet();
|
|
335
315
|
onResize_fn = function(entries) {
|
|
336
316
|
const gapCSSVar = Number.parseFloat(
|
|
337
317
|
this.style.getPropertyValue("--uui-tab-group-gap")
|
|
338
318
|
);
|
|
339
319
|
const newGap = Number.isNaN(gapCSSVar) ? 0 : gapCSSVar;
|
|
340
320
|
if (newGap !== __privateGet(this, _currentGap)) {
|
|
341
|
-
__privateMethod(this,
|
|
321
|
+
__privateMethod(this, _UUITabGroupElement_instances, calculateBreakPoints_fn).call(this);
|
|
342
322
|
} else {
|
|
343
|
-
__privateMethod(this,
|
|
323
|
+
__privateMethod(this, _UUITabGroupElement_instances, updateCollapsibleTabs_fn).call(this, entries[0].contentBoxSize[0].inlineSize);
|
|
344
324
|
}
|
|
345
325
|
};
|
|
346
|
-
_cleanupTabs = new WeakSet();
|
|
347
326
|
cleanupTabs_fn = function() {
|
|
348
327
|
__privateGet(this, _tabElements).forEach((el) => {
|
|
349
328
|
el.removeEventListener("click", __privateGet(this, _onTabClicked));
|
|
@@ -352,24 +331,21 @@ cleanupTabs_fn = function() {
|
|
|
352
331
|
__privateGet(this, _tabResizeObservers).length = 0;
|
|
353
332
|
__privateGet(this, _visibilityBreakpoints).length = 0;
|
|
354
333
|
};
|
|
355
|
-
_onSlotChange = new WeakSet();
|
|
356
334
|
onSlotChange_fn = function() {
|
|
357
|
-
__privateMethod(this,
|
|
358
|
-
__privateMethod(this,
|
|
335
|
+
__privateMethod(this, _UUITabGroupElement_instances, cleanupTabs_fn).call(this);
|
|
336
|
+
__privateMethod(this, _UUITabGroupElement_instances, setTabArray_fn).call(this);
|
|
359
337
|
__privateGet(this, _tabElements).forEach((el) => {
|
|
360
338
|
el.addEventListener("click", __privateGet(this, _onTabClicked));
|
|
361
339
|
const observer = new ResizeObserver(
|
|
362
|
-
__privateMethod(this,
|
|
340
|
+
__privateMethod(this, _UUITabGroupElement_instances, calculateBreakPoints_fn).bind(this)
|
|
363
341
|
);
|
|
364
342
|
observer.observe(el);
|
|
365
343
|
__privateGet(this, _tabResizeObservers).push(observer);
|
|
366
344
|
});
|
|
367
345
|
};
|
|
368
346
|
_onTabClicked = new WeakMap();
|
|
369
|
-
_calculateBreakPoints = new WeakSet();
|
|
370
347
|
calculateBreakPoints_fn = async function() {
|
|
371
|
-
if (__privateGet(this, _breakPointCalculationInProgress))
|
|
372
|
-
return;
|
|
348
|
+
if (__privateGet(this, _breakPointCalculationInProgress)) return;
|
|
373
349
|
__privateSet(this, _breakPointCalculationInProgress, true);
|
|
374
350
|
requestAnimationFrame(() => {
|
|
375
351
|
__privateSet(this, _breakPointCalculationInProgress, false);
|
|
@@ -389,14 +365,12 @@ calculateBreakPoints_fn = async function() {
|
|
|
389
365
|
}
|
|
390
366
|
const tolerance = 2;
|
|
391
367
|
this._mainElement.style.width = childrenWidth - gap + tolerance + "px";
|
|
392
|
-
__privateMethod(this,
|
|
368
|
+
__privateMethod(this, _UUITabGroupElement_instances, updateCollapsibleTabs_fn).call(this, this._mainElement.offsetWidth);
|
|
393
369
|
};
|
|
394
|
-
_setTabArray = new WeakSet();
|
|
395
370
|
setTabArray_fn = function() {
|
|
396
371
|
__privateSet(this, _tabElements, this._slottedNodes ? this._slottedNodes : []);
|
|
397
|
-
__privateMethod(this,
|
|
372
|
+
__privateMethod(this, _UUITabGroupElement_instances, calculateBreakPoints_fn).call(this);
|
|
398
373
|
};
|
|
399
|
-
_updateCollapsibleTabs = new WeakSet();
|
|
400
374
|
updateCollapsibleTabs_fn = function(containerWidth) {
|
|
401
375
|
const moreButtonWidth = this._moreButtonElement.offsetWidth;
|
|
402
376
|
const containerWithoutButtonWidth = containerWidth - (moreButtonWidth ? moreButtonWidth : 0);
|
|
@@ -436,7 +410,6 @@ updateCollapsibleTabs_fn = function(containerWidth) {
|
|
|
436
410
|
hasActiveTabInDropdown ? this._moreButtonElement.classList.add("active-inside") : this._moreButtonElement.classList.remove("active-inside");
|
|
437
411
|
this.requestUpdate();
|
|
438
412
|
};
|
|
439
|
-
_isElementTabLike = new WeakSet();
|
|
440
413
|
isElementTabLike_fn = function(el) {
|
|
441
414
|
return typeof el === "object" && "active" in el && typeof el.active === "boolean";
|
|
442
415
|
};
|
package/lib/uui-tab.element.d.ts
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "1.9.0-rc.1",
|
|
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.
|
|
34
|
-
"@umbraco-ui/uui-button": "1.
|
|
35
|
-
"@umbraco-ui/uui-popover-container": "1.
|
|
36
|
-
"@umbraco-ui/uui-symbol-more": "1.
|
|
33
|
+
"@umbraco-ui/uui-base": "1.9.0-rc.1",
|
|
34
|
+
"@umbraco-ui/uui-button": "1.9.0-rc.1",
|
|
35
|
+
"@umbraco-ui/uui-popover-container": "1.9.0-rc.1",
|
|
36
|
+
"@umbraco-ui/uui-symbol-more": "1.9.0-rc.1"
|
|
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": "
|
|
47
|
+
"gitHead": "7092b4717d8b9d4825b15e087508b8f75bf81a92"
|
|
48
48
|
}
|