@kubex/zinc 1.1.4 → 1.1.6
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/dist/custom-elements.json +19 -1
- package/dist/web-types.json +1 -1
- package/dist/zn.d.ts +1 -0
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +12 -12
- package/package.json +1 -1
- package/scss/shared/_form-elements.scss +12 -12
- package/scss/shared/_table.scss +1 -1
- package/scss/shared/layout.scss +17 -17
- package/scss/variables/_spacing.scss +7 -7
- package/src/components/icon/icon.component.ts +11 -3
- package/src/components/icon/icon.test.ts +21 -0
- package/src/components/popup/popup.scss +1 -1
- package/src/components/tooltip/tooltip.scss +2 -1
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@ select {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
@include mixins.media-query(sm) {
|
|
42
|
-
padding: mixins.spacing(
|
|
42
|
+
padding: mixins.spacing(xs);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -49,8 +49,8 @@ label {
|
|
|
49
49
|
line-height: var(--zn-spacing-medium);
|
|
50
50
|
color: rgb(var(--zn-text-heading));
|
|
51
51
|
display: block;
|
|
52
|
-
margin-bottom: mixins.spacing(
|
|
53
|
-
margin-top: mixins.spacing(
|
|
52
|
+
margin-bottom: mixins.spacing(xxs);
|
|
53
|
+
margin-top: mixins.spacing(sm);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
input[type=checkbox], input[type=radio] {
|
|
@@ -65,7 +65,7 @@ input[type=range] {
|
|
|
65
65
|
appearance: none;
|
|
66
66
|
border-radius: 10px;
|
|
67
67
|
background-color: rgb(var(--zn-border-color));
|
|
68
|
-
height: mixins.spacing(
|
|
68
|
+
height: mixins.spacing(xs);
|
|
69
69
|
accent-color: rgb(var(--zn-primary));
|
|
70
70
|
width: 100%;
|
|
71
71
|
max-width: mixins.container-width(md);
|
|
@@ -74,13 +74,13 @@ input[type=range] {
|
|
|
74
74
|
fieldset {
|
|
75
75
|
border-color: rgba(var(--zn-primary), 20%);
|
|
76
76
|
border-width: 2px;
|
|
77
|
-
padding: 0 mixins.spacing(
|
|
77
|
+
padding: 0 mixins.spacing(sm) mixins.spacing(sm);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
select {
|
|
81
81
|
|
|
82
82
|
option {
|
|
83
|
-
padding: mixins.spacing(
|
|
83
|
+
padding: mixins.spacing(xxs);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
> option:checked {
|
|
@@ -90,7 +90,7 @@ select {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
fieldset > legend {
|
|
93
|
-
padding: mixins.spacing(
|
|
93
|
+
padding: mixins.spacing(xxs);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
input[type=button],
|
|
@@ -105,22 +105,22 @@ button[type=button]:not(.button) {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
div + button {
|
|
108
|
-
margin-top: mixins.spacing(
|
|
108
|
+
margin-top: mixins.spacing(sm);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
input[type=file]::-webkit-file-upload-button {
|
|
112
112
|
@include button.button;
|
|
113
113
|
|
|
114
|
-
margin-right: mixins.spacing(
|
|
114
|
+
margin-right: mixins.spacing(xs);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
input::-webkit-calendar-picker-indicator {
|
|
118
118
|
cursor: pointer;
|
|
119
|
-
padding: mixins.spacing(
|
|
119
|
+
padding: mixins.spacing(xs);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
input[list]::-webkit-calendar-picker-indicator {
|
|
123
|
-
padding: mixins.spacing(
|
|
123
|
+
padding: mixins.spacing(xs) mixins.spacing(xxs)
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
.input--with-icon {
|
|
@@ -132,7 +132,7 @@ input[list]::-webkit-calendar-picker-indicator {
|
|
|
132
132
|
top: 50%;
|
|
133
133
|
pointer-events: none;
|
|
134
134
|
transform: translateY(-50%);
|
|
135
|
-
left: mixins.spacing(
|
|
135
|
+
left: mixins.spacing(xs);
|
|
136
136
|
background-color: rgb(var(--zn-primary));
|
|
137
137
|
color: rgb(var(--zn-text));
|
|
138
138
|
border-radius: 50%;
|
package/scss/shared/_table.scss
CHANGED
package/scss/shared/layout.scss
CHANGED
|
@@ -75,59 +75,59 @@
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
.zn-pad-y, .zn-py {
|
|
78
|
-
padding-top: #{mixins.spacing(
|
|
79
|
-
padding-bottom: #{mixins.spacing(
|
|
78
|
+
padding-top: #{mixins.spacing(sm)};
|
|
79
|
+
padding-bottom: #{mixins.spacing(sm)};
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
.zn-pad-x, .zn-px {
|
|
83
|
-
padding-left: #{mixins.spacing(
|
|
84
|
-
padding-right: #{mixins.spacing(
|
|
83
|
+
padding-left: #{mixins.spacing(sm)};
|
|
84
|
+
padding-right: #{mixins.spacing(sm)};
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
.zn-pr {
|
|
88
|
-
padding-right: #{mixins.spacing(
|
|
88
|
+
padding-right: #{mixins.spacing(sm)};
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
.zn-pl {
|
|
92
|
-
padding-left: #{mixins.spacing(
|
|
92
|
+
padding-left: #{mixins.spacing(sm)};
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
.zn-pt {
|
|
96
|
-
padding-top: #{mixins.spacing(
|
|
96
|
+
padding-top: #{mixins.spacing(sm)};
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
.zn-pb {
|
|
100
|
-
padding-bottom: #{mixins.spacing(
|
|
100
|
+
padding-bottom: #{mixins.spacing(sm)};
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
.zn-margin {
|
|
104
|
-
margin: #{mixins.spacing(
|
|
104
|
+
margin: #{mixins.spacing(sm)};
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
.zn-mx {
|
|
108
|
-
margin-left: #{mixins.spacing(
|
|
109
|
-
margin-right: #{mixins.spacing(
|
|
108
|
+
margin-left: #{mixins.spacing(sm)};
|
|
109
|
+
margin-right: #{mixins.spacing(sm)};
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
.zn-my {
|
|
113
|
-
margin-top: #{mixins.spacing(
|
|
114
|
-
margin-bottom: #{mixins.spacing(
|
|
113
|
+
margin-top: #{mixins.spacing(sm)};
|
|
114
|
+
margin-bottom: #{mixins.spacing(sm)};
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
.zn-mt {
|
|
118
|
-
margin-top: #{mixins.spacing(
|
|
118
|
+
margin-top: #{mixins.spacing(sm)};
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
.zn-mb {
|
|
122
|
-
margin-bottom: #{mixins.spacing(
|
|
122
|
+
margin-bottom: #{mixins.spacing(sm)};
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
.zn-ml {
|
|
126
|
-
margin-left: #{mixins.spacing(
|
|
126
|
+
margin-left: #{mixins.spacing(sm)};
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
.zn-mr {
|
|
130
|
-
margin-right: #{mixins.spacing(
|
|
130
|
+
margin-right: #{mixins.spacing(sm)};
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
|
|
@@ -14,13 +14,13 @@ $container: (
|
|
|
14
14
|
|
|
15
15
|
// Spacing
|
|
16
16
|
$spacing: (
|
|
17
|
-
px:
|
|
18
|
-
xxs:
|
|
19
|
-
xs:
|
|
20
|
-
sm:
|
|
21
|
-
md:
|
|
22
|
-
lg:
|
|
23
|
-
xl:
|
|
17
|
+
px: 2px,
|
|
18
|
+
xxs: 4px,
|
|
19
|
+
xs: 8px,
|
|
20
|
+
sm: 16px,
|
|
21
|
+
md: 24px,
|
|
22
|
+
lg: 32px,
|
|
23
|
+
xl: 40px,
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
// Common sizes
|
|
@@ -91,6 +91,10 @@ export default class ZnIcon extends ZincElement {
|
|
|
91
91
|
defaultLibrary: IconLibrary = "material-symbols-outlined";
|
|
92
92
|
|
|
93
93
|
convertToLibrary(input: string): IconLibrary {
|
|
94
|
+
return this.convertIndicatorToLibrary(input) ?? this.defaultLibrary
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private convertIndicatorToLibrary(input: string): IconLibrary | undefined {
|
|
94
98
|
switch (input) {
|
|
95
99
|
case "material":
|
|
96
100
|
case "mat":
|
|
@@ -130,7 +134,7 @@ export default class ZnIcon extends ZincElement {
|
|
|
130
134
|
return "brands";
|
|
131
135
|
}
|
|
132
136
|
|
|
133
|
-
return
|
|
137
|
+
return undefined;
|
|
134
138
|
}
|
|
135
139
|
|
|
136
140
|
connectedCallback() {
|
|
@@ -148,11 +152,15 @@ export default class ZnIcon extends ZincElement {
|
|
|
148
152
|
const atIndex = this.src.lastIndexOf('@');
|
|
149
153
|
const libraryOrDomain = this.src.slice(atIndex + 1);
|
|
150
154
|
|
|
155
|
+
const indicatedLibrary = this.convertIndicatorToLibrary(libraryOrDomain);
|
|
156
|
+
|
|
151
157
|
if (libraryOrDomain.includes('.')) {
|
|
152
158
|
this.library = this.library ?? "gravatar";
|
|
153
|
-
} else if ((this.library === undefined) &&
|
|
159
|
+
} else if ((this.library === undefined) && indicatedLibrary !== undefined) {
|
|
154
160
|
// if split[1] is a valid library name, set it
|
|
155
|
-
this.library =
|
|
161
|
+
this.library = indicatedLibrary;
|
|
162
|
+
this.src = this.src.slice(0, atIndex);
|
|
163
|
+
} else if (this.library !== undefined && indicatedLibrary === this.library) {
|
|
156
164
|
this.src = this.src.slice(0, atIndex);
|
|
157
165
|
}
|
|
158
166
|
|
|
@@ -54,4 +54,25 @@ describe('<zn-icon>', () => {
|
|
|
54
54
|
expect(el.src).to.equal('circle-alert');
|
|
55
55
|
expect(svg).to.exist;
|
|
56
56
|
});
|
|
57
|
+
|
|
58
|
+
it('should remove a matching library indicator from the icon src', async () => {
|
|
59
|
+
const el = await fixture<ZnIcon>(html`
|
|
60
|
+
<zn-icon src="home@lu" library="lucide" size="48"></zn-icon>
|
|
61
|
+
`);
|
|
62
|
+
|
|
63
|
+
const svg = el.shadowRoot?.querySelector('svg.lucide');
|
|
64
|
+
|
|
65
|
+
expect(el.library).to.equal('lucide');
|
|
66
|
+
expect(el.src).to.equal('home');
|
|
67
|
+
expect(svg).to.exist;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should keep a mismatched library indicator in the icon src', async () => {
|
|
71
|
+
const el = await fixture<ZnIcon>(html`
|
|
72
|
+
<zn-icon src="home@lu" library="material-symbols-outlined" size="48"></zn-icon>
|
|
73
|
+
`);
|
|
74
|
+
|
|
75
|
+
expect(el.library).to.equal('material-symbols-outlined');
|
|
76
|
+
expect(el.src).to.equal('home@lu');
|
|
77
|
+
});
|
|
57
78
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@use "../../wc";
|
|
2
2
|
|
|
3
3
|
:host {
|
|
4
|
-
--arrow-color: rgb(
|
|
4
|
+
--arrow-color: rgb(var(--zn-color-text));
|
|
5
5
|
--arrow-size: 6px;
|
|
6
6
|
--arrow-size-diagonal: calc(var(--arrow-size) * 0.7071);
|
|
7
7
|
--arrow-padding-offset: calc(var(--arrow-size-diagonal) - var(--arrow-size));
|
|
@@ -26,12 +26,13 @@
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.tooltip__body {
|
|
29
|
+
@include wc.text-style("paragraph");
|
|
30
|
+
|
|
29
31
|
display: block;
|
|
30
32
|
width: max-content;
|
|
31
33
|
max-width: max-content;
|
|
32
34
|
border-radius: 5px;
|
|
33
35
|
background-color: var(--arrow-color);
|
|
34
|
-
font-size: 12px;
|
|
35
36
|
text-align: start;
|
|
36
37
|
white-space: normal;
|
|
37
38
|
color: white;
|