@citizenplane/pimp 18.10.1 → 18.10.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.
- package/dist/components/CpBadge.vue.d.ts.map +1 -1
- package/dist/components/CpTabs.vue.d.ts.map +1 -1
- package/dist/pimp.es.js +520 -524
- package/dist/pimp.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/CpBadge.vue +11 -1
- package/src/components/CpTabs.vue +25 -15
package/package.json
CHANGED
|
@@ -63,6 +63,7 @@ const componentDynamicClasses = computed(() => [
|
|
|
63
63
|
$font-size,
|
|
64
64
|
$line-height,
|
|
65
65
|
$padding,
|
|
66
|
+
$label-padding,
|
|
66
67
|
$square-radius,
|
|
67
68
|
$no-label-padding,
|
|
68
69
|
$icon-width,
|
|
@@ -78,6 +79,10 @@ const componentDynamicClasses = computed(() => [
|
|
|
78
79
|
border-radius: $square-radius;
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
.cpBadge__label {
|
|
83
|
+
padding-inline: $label-padding;
|
|
84
|
+
}
|
|
85
|
+
|
|
81
86
|
&:not(:has(.cpBadge__label)) {
|
|
82
87
|
padding: $no-label-padding;
|
|
83
88
|
}
|
|
@@ -122,7 +127,7 @@ const componentDynamicClasses = computed(() => [
|
|
|
122
127
|
justify-content: center;
|
|
123
128
|
border-radius: var(--cp-radius-full);
|
|
124
129
|
background-color: var(--cp-background-tertiary);
|
|
125
|
-
gap: var(--cp-spacing-
|
|
130
|
+
gap: var(--cp-spacing-xs);
|
|
126
131
|
|
|
127
132
|
&__label {
|
|
128
133
|
white-space: nowrap;
|
|
@@ -133,6 +138,7 @@ const componentDynamicClasses = computed(() => [
|
|
|
133
138
|
var(--cp-text-size-md),
|
|
134
139
|
var(--cp-line-height-md),
|
|
135
140
|
var(--cp-spacing-sm) var(--cp-spacing-md),
|
|
141
|
+
var(--cp-spacing-sm),
|
|
136
142
|
var(--cp-radius-md),
|
|
137
143
|
var(--cp-spacing-sm-md),
|
|
138
144
|
var(--cp-dimensions-5),
|
|
@@ -143,6 +149,7 @@ const componentDynamicClasses = computed(() => [
|
|
|
143
149
|
var(--cp-text-size-sm),
|
|
144
150
|
var(--cp-line-height-sm),
|
|
145
151
|
var(--cp-spacing-sm) var(--cp-spacing-md),
|
|
152
|
+
var(--cp-spacing-sm),
|
|
146
153
|
var(--cp-radius-md),
|
|
147
154
|
var(--cp-spacing-sm-md),
|
|
148
155
|
var(--cp-dimensions-4),
|
|
@@ -153,6 +160,7 @@ const componentDynamicClasses = computed(() => [
|
|
|
153
160
|
var(--cp-text-size-xs),
|
|
154
161
|
var(--cp-line-height-xs),
|
|
155
162
|
var(--cp-spacing-sm) var(--cp-spacing-md),
|
|
163
|
+
var(--cp-spacing-xs),
|
|
156
164
|
var(--cp-radius-sm-md),
|
|
157
165
|
var(--cp-spacing-sm),
|
|
158
166
|
var(--cp-dimensions-4),
|
|
@@ -163,6 +171,7 @@ const componentDynamicClasses = computed(() => [
|
|
|
163
171
|
var(--cp-text-size-xs),
|
|
164
172
|
var(--cp-line-height-xs),
|
|
165
173
|
var(--cp-spacing-xs) var(--cp-spacing-sm-md),
|
|
174
|
+
var(--cp-spacing-xs),
|
|
166
175
|
var(--cp-radius-sm),
|
|
167
176
|
var(--cp-spacing-sm),
|
|
168
177
|
var(--cp-dimensions-3),
|
|
@@ -173,6 +182,7 @@ const componentDynamicClasses = computed(() => [
|
|
|
173
182
|
var(--cp-text-size-xs),
|
|
174
183
|
var(--cp-line-height-xs),
|
|
175
184
|
var(--cp-spacing-none) var(--cp-spacing-sm),
|
|
185
|
+
var(--cp-spacing-xs),
|
|
176
186
|
var(--cp-radius-sm),
|
|
177
187
|
var(--cp-spacing-xs),
|
|
178
188
|
var(--cp-dimensions-3),
|
|
@@ -184,17 +184,6 @@ const getUnderlineElement = () => {
|
|
|
184
184
|
return underlineElement
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
// NOTE: fix mimatch width between active underline & focus outline of active tab
|
|
188
|
-
const getUnderlineInset = () => {
|
|
189
|
-
if (props.variant !== 'underline') return 0
|
|
190
|
-
|
|
191
|
-
const rootStyle = getComputedStyle(document.documentElement)
|
|
192
|
-
const rootFontSize = Number.parseFloat(rootStyle.fontSize)
|
|
193
|
-
const insetRem = Number.parseFloat(rootStyle.getPropertyValue('--cp-dimensions-0_5'))
|
|
194
|
-
|
|
195
|
-
return rootFontSize * insetRem
|
|
196
|
-
}
|
|
197
|
-
|
|
198
187
|
const setUnderlineStyle = () => {
|
|
199
188
|
const activeTabElement = getActiveTabElement()
|
|
200
189
|
const underlineElement = getUnderlineElement()
|
|
@@ -202,10 +191,12 @@ const setUnderlineStyle = () => {
|
|
|
202
191
|
|
|
203
192
|
if (!activeTabElement || !underlineElement || !containerElement) return
|
|
204
193
|
|
|
205
|
-
const
|
|
194
|
+
const containerRect = containerElement.getBoundingClientRect()
|
|
195
|
+
const tabRect = activeTabElement.getBoundingClientRect()
|
|
196
|
+
const left = tabRect.left - containerRect.left + containerElement.scrollLeft
|
|
206
197
|
|
|
207
|
-
underlineElement.style.width = `${
|
|
208
|
-
underlineElement.style.transform = `translate3d(${
|
|
198
|
+
underlineElement.style.width = `${tabRect.width}px`
|
|
199
|
+
underlineElement.style.transform = `translate3d(${left}px, 0, 0)`
|
|
209
200
|
}
|
|
210
201
|
|
|
211
202
|
const scrollToActiveElement = (behavior: ScrollBehavior = 'smooth') => {
|
|
@@ -298,7 +289,7 @@ watch(
|
|
|
298
289
|
opacity 300ms ease;
|
|
299
290
|
|
|
300
291
|
&:focus-visible {
|
|
301
|
-
outline-offset:
|
|
292
|
+
outline-offset: 0;
|
|
302
293
|
}
|
|
303
294
|
|
|
304
295
|
&--isLoading {
|
|
@@ -349,6 +340,25 @@ watch(
|
|
|
349
340
|
.cpTabs__tab:focus-visible {
|
|
350
341
|
border-bottom-left-radius: 0;
|
|
351
342
|
border-bottom-right-radius: 0;
|
|
343
|
+
outline: none;
|
|
344
|
+
|
|
345
|
+
&::before {
|
|
346
|
+
position: absolute;
|
|
347
|
+
border: var(--cp-dimensions-0_5) solid var(--cp-border-accent-solid);
|
|
348
|
+
border-radius: inherit;
|
|
349
|
+
border-bottom: none;
|
|
350
|
+
content: '';
|
|
351
|
+
inset: 0;
|
|
352
|
+
pointer-events: none;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
&.cpTabs__tab--isActive::before {
|
|
356
|
+
border-bottom: var(--cp-dimensions-0_5) solid var(--cp-border-accent-solid);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.cpTabs__tab--isActive:focus-visible ~ .cpTabs__activeUnderline--isUnderline {
|
|
361
|
+
opacity: 0;
|
|
352
362
|
}
|
|
353
363
|
}
|
|
354
364
|
|