@umbraco-ui/uui-tabs 0.0.18 → 0.1.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/README.md +4 -0
- package/custom-elements.json +12 -2
- package/lib/index.js +17 -9
- package/lib/uui-tab-group.element.d.ts +2 -0
- package/lib/uui-tab.element.d.ts +0 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@umbraco-ui/uui-tabs)
|
|
4
4
|
|
|
5
|
+
### See it in action
|
|
6
|
+
|
|
7
|
+
Preview the component on [Storybook](https://uui.umbraco.com/?path=/story/uui-tabs)
|
|
8
|
+
|
|
5
9
|
## Installation
|
|
6
10
|
|
|
7
11
|
### ES imports
|
package/custom-elements.json
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
"type": "CSSResult[]",
|
|
11
11
|
"default": "[null]"
|
|
12
12
|
}
|
|
13
|
+
],
|
|
14
|
+
"slots": [
|
|
15
|
+
{
|
|
16
|
+
"name": "",
|
|
17
|
+
"description": "Default slot for the tab group"
|
|
18
|
+
}
|
|
13
19
|
]
|
|
14
20
|
},
|
|
15
21
|
{
|
|
@@ -25,6 +31,7 @@
|
|
|
25
31
|
},
|
|
26
32
|
{
|
|
27
33
|
"name": "active",
|
|
34
|
+
"description": "Set this boolean to true for then the related composition is sorted.",
|
|
28
35
|
"type": "boolean",
|
|
29
36
|
"default": "false"
|
|
30
37
|
},
|
|
@@ -50,6 +57,7 @@
|
|
|
50
57
|
{
|
|
51
58
|
"name": "active",
|
|
52
59
|
"attribute": "active",
|
|
60
|
+
"description": "Set this boolean to true for then the related composition is sorted.",
|
|
53
61
|
"type": "boolean",
|
|
54
62
|
"default": "false"
|
|
55
63
|
},
|
|
@@ -63,7 +71,7 @@
|
|
|
63
71
|
"slots": [
|
|
64
72
|
{
|
|
65
73
|
"name": "",
|
|
66
|
-
"description": "
|
|
74
|
+
"description": "Override the default label"
|
|
67
75
|
}
|
|
68
76
|
],
|
|
69
77
|
"cssProperties": [
|
|
@@ -102,6 +110,7 @@
|
|
|
102
110
|
},
|
|
103
111
|
{
|
|
104
112
|
"name": "active",
|
|
113
|
+
"description": "Set this boolean to true for then the related composition is sorted.",
|
|
105
114
|
"type": "boolean",
|
|
106
115
|
"default": "false"
|
|
107
116
|
},
|
|
@@ -127,6 +136,7 @@
|
|
|
127
136
|
{
|
|
128
137
|
"name": "active",
|
|
129
138
|
"attribute": "active",
|
|
139
|
+
"description": "Set this boolean to true for then the related composition is sorted.",
|
|
130
140
|
"type": "boolean",
|
|
131
141
|
"default": "false"
|
|
132
142
|
},
|
|
@@ -140,7 +150,7 @@
|
|
|
140
150
|
"slots": [
|
|
141
151
|
{
|
|
142
152
|
"name": "",
|
|
143
|
-
"description": "
|
|
153
|
+
"description": "Override the default label"
|
|
144
154
|
}
|
|
145
155
|
],
|
|
146
156
|
"cssProperties": [
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActiveMixin, LabelMixin } from '@umbraco-ui/uui-base/lib/mixins';
|
|
2
2
|
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
|
|
3
3
|
import { LitElement, html, css } from 'lit';
|
|
4
|
-
import { property,
|
|
4
|
+
import { property, queryAssignedElements } from 'lit/decorators.js';
|
|
5
5
|
import { UUIEvent } from '@umbraco-ui/uui-base/lib/events';
|
|
6
6
|
|
|
7
7
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -142,10 +142,14 @@ let UUITabGroupElement = class extends LitElement {
|
|
|
142
142
|
this.tabElements = [];
|
|
143
143
|
this.onTabActive = (e) => {
|
|
144
144
|
const selectedElement = e.target;
|
|
145
|
-
selectedElement
|
|
145
|
+
if (this.elementIsTabLike(selectedElement)) {
|
|
146
|
+
selectedElement.active = true;
|
|
147
|
+
}
|
|
146
148
|
const filtered = this.tabElements.filter((el) => el !== selectedElement);
|
|
147
149
|
filtered.forEach((el) => {
|
|
148
|
-
el
|
|
150
|
+
if (this.elementIsTabLike(el)) {
|
|
151
|
+
el.active = false;
|
|
152
|
+
}
|
|
149
153
|
});
|
|
150
154
|
};
|
|
151
155
|
}
|
|
@@ -153,16 +157,17 @@ let UUITabGroupElement = class extends LitElement {
|
|
|
153
157
|
this.tabElements = this.slotNodes ? this.slotNodes : [];
|
|
154
158
|
}
|
|
155
159
|
onSlotChange() {
|
|
160
|
+
this.tabElements.forEach((el) => {
|
|
161
|
+
el.removeEventListener("click", this.onTabActive);
|
|
162
|
+
});
|
|
156
163
|
this.setTabArray();
|
|
157
|
-
if (this.tabElements) {
|
|
158
|
-
this.tabElements.forEach((el) => {
|
|
159
|
-
el.removeEventListener("click", this.onTabActive);
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
164
|
this.tabElements.forEach((el) => {
|
|
163
165
|
el.addEventListener("click", this.onTabActive);
|
|
164
166
|
});
|
|
165
167
|
}
|
|
168
|
+
elementIsTabLike(el) {
|
|
169
|
+
return el instanceof UUITabElement || "active" in el;
|
|
170
|
+
}
|
|
166
171
|
connectedCallback() {
|
|
167
172
|
super.connectedCallback();
|
|
168
173
|
if (!this.hasAttribute("role"))
|
|
@@ -189,7 +194,10 @@ UUITabGroupElement.styles = [
|
|
|
189
194
|
`
|
|
190
195
|
];
|
|
191
196
|
__decorateClass([
|
|
192
|
-
|
|
197
|
+
queryAssignedElements({
|
|
198
|
+
flatten: true,
|
|
199
|
+
selector: "uui-tab, [uui-tab], [role=tab]"
|
|
200
|
+
})
|
|
193
201
|
], UUITabGroupElement.prototype, "slotNodes", 2);
|
|
194
202
|
UUITabGroupElement = __decorateClass([
|
|
195
203
|
defineElement("uui-tab-group")
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
/**
|
|
3
3
|
* @element uui-tab-group
|
|
4
|
+
* @slot - Default slot for the tab group
|
|
4
5
|
*/
|
|
5
6
|
export declare class UUITabGroupElement extends LitElement {
|
|
6
7
|
static styles: import("lit").CSSResult[];
|
|
@@ -9,6 +10,7 @@ export declare class UUITabGroupElement extends LitElement {
|
|
|
9
10
|
private setTabArray;
|
|
10
11
|
private onSlotChange;
|
|
11
12
|
private onTabActive;
|
|
13
|
+
private elementIsTabLike;
|
|
12
14
|
connectedCallback(): void;
|
|
13
15
|
render(): import("lit-html").TemplateResult<1>;
|
|
14
16
|
}
|
package/lib/uui-tab.element.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ declare const UUITabElement_base: (new (...args: any[]) => import("@umbraco-ui/u
|
|
|
8
8
|
* @cssprop --uui-tab-text-active - Define the tab text active color
|
|
9
9
|
* @cssprop --uui-tab-background - Define the tab group background color
|
|
10
10
|
* @cssprop --uui-tab-divider - Define the tab dividers color
|
|
11
|
-
* @slot for tab content.
|
|
12
11
|
*/
|
|
13
12
|
export declare class UUITabElement extends UUITabElement_base {
|
|
14
13
|
static styles: import("lit").CSSResult[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraco-ui/uui-tabs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Umbraco",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"custom-elements.json"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@umbraco-ui/uui-base": "0.
|
|
33
|
+
"@umbraco-ui/uui-base": "0.1.1"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://uui.umbraco.com/?path=/story/uui-tabs",
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "d91d346a0659f52de2a3c4746065c554f95e6328"
|
|
45
45
|
}
|