@citizenplane/pimp 9.4.3 → 9.4.5
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/pimp.es.js +2258 -2254
- package/dist/pimp.umd.js +18 -18
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/assets/styles/helpers/_keyframes.scss +4 -2
- package/src/assets/styles/variables/_easings.scss +1 -0
- package/src/components/BaseInputLabel.vue +2 -1
- package/src/components/CpButton.vue +61 -48
- package/src/components/CpDate.vue +24 -48
- package/src/components/CpInput.vue +54 -27
- package/src/components/CpMultiselect.vue +15 -10
- package/src/components/CpSelect.vue +3 -2
- package/src/components/CpSwitch.vue +5 -5
- package/src/components/CpTextarea.vue +16 -24
- package/src/components/icons/IconBaggageSet.vue +27 -0
- package/src/constants/CpCustomIcons.ts +2 -0
- package/src/stories/CpButton.stories.ts +34 -8
- package/src/stories/CpDate.stories.ts +41 -0
- package/src/stories/CpInput.stories.ts +51 -9
- package/src/stories/CpMultiselect.stories.ts +1 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="cpDate" :class="dynamicClasses">
|
|
3
|
-
<label v-if="label"
|
|
4
|
-
{{ capitalizedLabel }}
|
|
5
|
-
|
|
6
|
-
</label>
|
|
3
|
+
<base-input-label v-if="label" v-bind-once="{ for: cpDateId }" :is-invalid="!isDateValid" :required="required">
|
|
4
|
+
{{ capitalizedLabel }}
|
|
5
|
+
</base-input-label>
|
|
7
6
|
<div class="cpDate__inputs">
|
|
8
7
|
<input
|
|
9
8
|
v-model="day"
|
|
@@ -56,6 +55,8 @@
|
|
|
56
55
|
import { Info, DateTime } from 'luxon'
|
|
57
56
|
import { ref, computed, watch } from 'vue'
|
|
58
57
|
|
|
58
|
+
import BaseInputLabel from '@/components/BaseInputLabel.vue'
|
|
59
|
+
|
|
59
60
|
import { HUMAN_MAX_AGE } from '@/constants'
|
|
60
61
|
import { randomString, capitalizeFirstLetter } from '@/helpers'
|
|
61
62
|
|
|
@@ -293,8 +294,6 @@ watch(year, handleUpdate)
|
|
|
293
294
|
// Remove select style
|
|
294
295
|
select {
|
|
295
296
|
appearance: none;
|
|
296
|
-
-webkit-appearance: none;
|
|
297
|
-
-moz-appearance: none;
|
|
298
297
|
outline: none;
|
|
299
298
|
border: none;
|
|
300
299
|
}
|
|
@@ -306,51 +305,25 @@ watch(year, handleUpdate)
|
|
|
306
305
|
color: colors.$neutral-dark;
|
|
307
306
|
}
|
|
308
307
|
|
|
309
|
-
&__label {
|
|
310
|
-
display: flex;
|
|
311
|
-
align-items: center;
|
|
312
|
-
line-height: fn.px-to-rem(24);
|
|
313
|
-
margin-bottom: sp.$space;
|
|
314
|
-
font-size: fn.px-to-em(14);
|
|
315
|
-
|
|
316
|
-
> span {
|
|
317
|
-
margin-left: sp.$space-xs;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
i {
|
|
321
|
-
margin-left: sp.$space-sm;
|
|
322
|
-
width: fn.px-to-rem(16);
|
|
323
|
-
height: fn.px-to-rem(16);
|
|
324
|
-
color: colors.$error-color;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
308
|
&__inputs {
|
|
329
309
|
display: flex;
|
|
330
|
-
|
|
331
|
-
border: fn.px-to-rem(1) solid colors.$neutral-dark-4;
|
|
310
|
+
box-shadow: 0 0 0 fn.px-to-rem(1) rgba(0, 0, 0, 0.12);
|
|
332
311
|
border-radius: fn.px-to-em(10);
|
|
333
312
|
overflow: hidden;
|
|
334
313
|
background-color: colors.$neutral-light;
|
|
335
|
-
box-shadow: inset 0 fn.px-to-em(1) fn.px-to-em(2) rgba(colors.$neutral-dark, 0.12);
|
|
336
314
|
|
|
337
|
-
&:hover
|
|
338
|
-
|
|
339
|
-
border-color: colors.$primary-color;
|
|
340
|
-
background-color: colors.$neutral-light;
|
|
315
|
+
&:hover {
|
|
316
|
+
box-shadow: 0 0 0 fn.px-to-rem(1) colors.$primary-color;
|
|
341
317
|
}
|
|
342
318
|
|
|
343
319
|
&:focus-within {
|
|
344
|
-
|
|
345
|
-
rgba(colors.$primary-color, 0.1) 0 0 0 fn.px-to-rem(4),
|
|
346
|
-
colors.$primary-color 0 0 0 fn.px-to-rem(0.5);
|
|
320
|
+
outline: fn.px-to-rem(2) solid colors.$primary-color;
|
|
347
321
|
}
|
|
348
322
|
}
|
|
349
323
|
|
|
350
324
|
&__divider {
|
|
351
325
|
flex-shrink: 0;
|
|
352
326
|
width: fn.px-to-rem(1);
|
|
353
|
-
height: 100%;
|
|
354
327
|
background-color: colors.$border-color;
|
|
355
328
|
}
|
|
356
329
|
|
|
@@ -362,7 +335,7 @@ watch(year, handleUpdate)
|
|
|
362
335
|
|
|
363
336
|
&__month {
|
|
364
337
|
position: relative;
|
|
365
|
-
flex: 1 1
|
|
338
|
+
flex: 1 1 40%;
|
|
366
339
|
|
|
367
340
|
&::after {
|
|
368
341
|
position: absolute;
|
|
@@ -380,13 +353,14 @@ watch(year, handleUpdate)
|
|
|
380
353
|
select {
|
|
381
354
|
@extend %u-text-ellipsis;
|
|
382
355
|
width: 100%;
|
|
383
|
-
padding:
|
|
356
|
+
padding: sp.$space calc(sp.$space-xl + sp.$space-sm) sp.$space sp.$space-md;
|
|
384
357
|
color: inherit;
|
|
385
358
|
cursor: pointer;
|
|
359
|
+
font-size: fn.px-to-rem(14);
|
|
360
|
+
line-height: fn.px-to-rem(24);
|
|
386
361
|
|
|
387
362
|
&:focus-visible {
|
|
388
363
|
text-decoration: underline;
|
|
389
|
-
font-weight: 500;
|
|
390
364
|
}
|
|
391
365
|
}
|
|
392
366
|
|
|
@@ -397,19 +371,21 @@ watch(year, handleUpdate)
|
|
|
397
371
|
|
|
398
372
|
&__day,
|
|
399
373
|
&__year {
|
|
400
|
-
flex: 0 0
|
|
401
|
-
padding: sp.$space-
|
|
374
|
+
flex: 0 0 30%;
|
|
375
|
+
padding: sp.$space sp.$space-lg;
|
|
376
|
+
font-size: fn.px-to-rem(14);
|
|
377
|
+
line-height: fn.px-to-rem(24);
|
|
402
378
|
}
|
|
403
379
|
|
|
404
380
|
&--isInvalid {
|
|
405
381
|
.cpDate__inputs,
|
|
406
|
-
.cpDate__inputs:hover
|
|
407
|
-
|
|
408
|
-
border-color: colors.$error-color;
|
|
382
|
+
.cpDate__inputs:hover {
|
|
383
|
+
box-shadow: 0 0 0 fn.px-to-rem(1) colors.$error-color;
|
|
409
384
|
}
|
|
410
385
|
|
|
411
386
|
.cpDate__inputs:focus-within {
|
|
412
|
-
|
|
387
|
+
outline: fn.px-to-rem(2) solid colors.$error-color;
|
|
388
|
+
box-shadow: 0 0 0 fn.px-to-em(1) color.scale(colors.$error-color, $lightness: 60%);
|
|
413
389
|
}
|
|
414
390
|
|
|
415
391
|
.cpDate__divider {
|
|
@@ -435,10 +411,10 @@ watch(year, handleUpdate)
|
|
|
435
411
|
}
|
|
436
412
|
|
|
437
413
|
&__errorMessage {
|
|
438
|
-
margin-top:
|
|
439
|
-
color: colors.$error-color;
|
|
440
|
-
font-weight: 500;
|
|
414
|
+
margin-top: sp.$space;
|
|
441
415
|
font-size: fn.px-to-em(14);
|
|
416
|
+
line-height: fn.px-to-rem(24);
|
|
417
|
+
color: colors.$error-color;
|
|
442
418
|
}
|
|
443
419
|
}
|
|
444
420
|
</style>
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
class="cpInput__inner"
|
|
31
31
|
/>
|
|
32
32
|
<div v-if="hasAfterIcon" class="cpInput__icon cpInput__icon--isAfter">
|
|
33
|
-
<slot v-if="
|
|
33
|
+
<slot v-if="displayAfterIcon" name="trailing-icon" />
|
|
34
34
|
<transition name="fade">
|
|
35
35
|
<button v-if="isClearButtonVisible" type="button" class="cpInput__clear" @click="clearInputValue">
|
|
36
36
|
<cp-icon type="x" class="cpInput__clearIcon" />
|
|
@@ -145,6 +145,7 @@ const hasBeforeIcon = computed(() => hasBeforeIconSlot.value || props.isSearch)
|
|
|
145
145
|
|
|
146
146
|
const hasAfterIconSlot = computed(() => !!slots['trailing-icon'])
|
|
147
147
|
const hasAfterIcon = computed(() => hasAfterIconSlot.value || props.isSearch)
|
|
148
|
+
const displayAfterIcon = computed(() => hasAfterIcon.value && !props.isSearch)
|
|
148
149
|
|
|
149
150
|
const DOMElement = computed(() => cpInputContainer.value.children.namedItem(inputIdentifier.value))
|
|
150
151
|
|
|
@@ -203,14 +204,14 @@ onMounted(async () => {
|
|
|
203
204
|
}
|
|
204
205
|
|
|
205
206
|
&__inner {
|
|
206
|
-
box-shadow: 0 0 0 fn.px-to-rem(1)
|
|
207
|
+
box-shadow: 0 0 0 fn.px-to-rem(1) colors.$border-color;
|
|
207
208
|
appearance: none;
|
|
208
|
-
border-radius: fn.px-to-rem(
|
|
209
|
+
border-radius: fn.px-to-rem(8);
|
|
209
210
|
width: 100%;
|
|
210
211
|
color: inherit;
|
|
211
212
|
padding: sp.$space sp.$space-lg;
|
|
212
213
|
line-height: fn.px-to-rem(24);
|
|
213
|
-
font-size: fn.px-to-
|
|
214
|
+
font-size: fn.px-to-rem(14);
|
|
214
215
|
|
|
215
216
|
&:hover {
|
|
216
217
|
box-shadow: 0 0 0 fn.px-to-rem(1) colors.$primary-color;
|
|
@@ -272,6 +273,8 @@ onMounted(async () => {
|
|
|
272
273
|
&__icon {
|
|
273
274
|
@include mx.square-sizing(16);
|
|
274
275
|
|
|
276
|
+
display: flex;
|
|
277
|
+
align-items: center;
|
|
275
278
|
left: fn.px-to-rem(14);
|
|
276
279
|
z-index: 1;
|
|
277
280
|
position: absolute;
|
|
@@ -289,6 +292,11 @@ onMounted(async () => {
|
|
|
289
292
|
stroke-width: 1.6;
|
|
290
293
|
}
|
|
291
294
|
|
|
295
|
+
&--isBefore,
|
|
296
|
+
&--isAfter {
|
|
297
|
+
font-size: fn.px-to-rem(14);
|
|
298
|
+
}
|
|
299
|
+
|
|
292
300
|
&--isAfter {
|
|
293
301
|
left: auto;
|
|
294
302
|
right: fn.px-to-rem(14);
|
|
@@ -297,62 +305,80 @@ onMounted(async () => {
|
|
|
297
305
|
&--isBefore ~ input {
|
|
298
306
|
padding-left: calc(#{sp.$space-md} + #{sp.$space-sm} + #{fn.px-to-rem(16) + sp.$space});
|
|
299
307
|
}
|
|
308
|
+
}
|
|
300
309
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
310
|
+
&:has(.cpInput__icon--isAfter) input {
|
|
311
|
+
padding-right: calc(#{sp.$space-md} + #{sp.$space-sm} + #{fn.px-to-rem(16) + sp.$space});
|
|
304
312
|
}
|
|
305
313
|
|
|
306
|
-
&--
|
|
314
|
+
&--lg {
|
|
307
315
|
.cpInput__inner {
|
|
308
|
-
|
|
309
|
-
|
|
316
|
+
border-radius: fn.px-to-rem(10);
|
|
317
|
+
padding: sp.$space-md sp.$space-lg;
|
|
318
|
+
font-size: fn.px-to-rem(16);
|
|
310
319
|
}
|
|
311
320
|
|
|
312
321
|
.cpInput__icon {
|
|
313
|
-
|
|
322
|
+
@include mx.square-sizing(20);
|
|
323
|
+
|
|
324
|
+
left: fn.px-to-rem(12);
|
|
314
325
|
}
|
|
315
326
|
|
|
327
|
+
.cpInput__icon--isBefore,
|
|
316
328
|
.cpInput__icon--isAfter {
|
|
317
|
-
|
|
318
|
-
right: fn.px-to-rem(10);
|
|
329
|
+
font-size: fn.px-to-rem(16);
|
|
319
330
|
}
|
|
320
331
|
|
|
321
|
-
.cpInput__icon--
|
|
322
|
-
|
|
332
|
+
.cpInput__icon--isAfter {
|
|
333
|
+
left: auto;
|
|
334
|
+
right: fn.px-to-rem(12);
|
|
323
335
|
}
|
|
324
336
|
|
|
325
337
|
.cpInput__icon--isAfter ~ input {
|
|
326
|
-
padding-right: calc(#{sp.$space-
|
|
338
|
+
padding-right: calc(#{sp.$space-lg} + #{fn.px-to-rem(20)} + #{sp.$space-sm});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.cpInput__icon--isBefore ~ input {
|
|
342
|
+
padding-left: calc(#{sp.$space-lg} + #{fn.px-to-rem(20)} + #{sp.$space-sm});
|
|
327
343
|
}
|
|
328
344
|
}
|
|
329
345
|
|
|
330
|
-
&--
|
|
346
|
+
&--sm {
|
|
331
347
|
.cpInput__inner {
|
|
332
|
-
padding: sp.$space-
|
|
333
|
-
font-size: fn.px-to-rem(
|
|
348
|
+
padding: sp.$space-sm sp.$space-md;
|
|
349
|
+
font-size: fn.px-to-rem(14);
|
|
334
350
|
}
|
|
335
351
|
|
|
336
352
|
.cpInput__icon {
|
|
337
|
-
|
|
353
|
+
left: fn.px-to-rem(10);
|
|
354
|
+
}
|
|
338
355
|
|
|
339
|
-
|
|
356
|
+
.cpInput__icon--isBefore,
|
|
357
|
+
.cpInput__icon--isAfter {
|
|
358
|
+
font-size: fn.px-to-rem(12);
|
|
340
359
|
}
|
|
341
360
|
|
|
342
361
|
.cpInput__icon--isAfter {
|
|
343
362
|
left: auto;
|
|
344
|
-
right: fn.px-to-rem(
|
|
363
|
+
right: fn.px-to-rem(10);
|
|
345
364
|
}
|
|
346
365
|
|
|
347
|
-
.cpInput__icon--
|
|
348
|
-
padding-
|
|
366
|
+
.cpInput__icon--isBefore ~ input {
|
|
367
|
+
padding-left: calc(#{sp.$space-sm * 2} + #{fn.px-to-rem(20) + sp.$space});
|
|
349
368
|
}
|
|
350
369
|
|
|
351
|
-
.cpInput__icon--
|
|
352
|
-
padding-
|
|
370
|
+
.cpInput__icon--isAfter ~ input {
|
|
371
|
+
padding-right: calc(#{sp.$space-sm * 2} + #{fn.px-to-rem(20) + sp.$space});
|
|
353
372
|
}
|
|
354
373
|
}
|
|
355
374
|
|
|
375
|
+
// If icon slot is text (units)
|
|
376
|
+
.cpInput__icon:not(:has(.cpIcon)) {
|
|
377
|
+
width: auto;
|
|
378
|
+
height: auto;
|
|
379
|
+
aspect-ratio: auto;
|
|
380
|
+
}
|
|
381
|
+
|
|
356
382
|
&--isSearch {
|
|
357
383
|
.cpInput__icon--isAfter {
|
|
358
384
|
width: auto;
|
|
@@ -368,7 +394,8 @@ onMounted(async () => {
|
|
|
368
394
|
background-color: colors.$neutral-dark-1;
|
|
369
395
|
|
|
370
396
|
&:focus-visible {
|
|
371
|
-
outline: fn.px-to-rem(2) solid
|
|
397
|
+
outline: fn.px-to-rem(2) solid colors.$primary-color;
|
|
398
|
+
outline-offset: fn.px-to-rem(1);
|
|
372
399
|
}
|
|
373
400
|
}
|
|
374
401
|
|
|
@@ -44,9 +44,11 @@
|
|
|
44
44
|
</slot>
|
|
45
45
|
</template>
|
|
46
46
|
<template #option="{ option }">
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
|
|
47
|
+
<slot name="option" :option="option">
|
|
48
|
+
<button type="button" class="cpMultiselect__option">
|
|
49
|
+
{{ option.name }}
|
|
50
|
+
</button>
|
|
51
|
+
</slot>
|
|
50
52
|
</template>
|
|
51
53
|
<template #dropdown>
|
|
52
54
|
<div v-if="displayPrefix" class="cpMultiselect__prefix">
|
|
@@ -281,11 +283,9 @@ onMounted(() => overrideAlignOverlay())
|
|
|
281
283
|
display: flex;
|
|
282
284
|
align-items: center;
|
|
283
285
|
justify-content: space-between;
|
|
284
|
-
padding: sp.$space;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
box-shadow: inset 0 fn.px-to-em(1) fn.px-to-em(2) rgba(0, 0, 0, 0.12);
|
|
288
|
-
border-radius: fn.px-to-rem(10);
|
|
286
|
+
padding: sp.$space sp.$space-lg;
|
|
287
|
+
box-shadow: 0 0 0 fn.px-to-rem(1) colors.$border-color;
|
|
288
|
+
border-radius: fn.px-to-rem(8);
|
|
289
289
|
gap: sp.$space;
|
|
290
290
|
|
|
291
291
|
&:has(input:hover) {
|
|
@@ -301,7 +301,7 @@ onMounted(() => overrideAlignOverlay())
|
|
|
301
301
|
cursor: not-allowed;
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
&:has([data-p
|
|
304
|
+
&:has([data-p*='invalid']) {
|
|
305
305
|
outline: fn.px-to-rem(1) solid colors.$error-color;
|
|
306
306
|
box-shadow: 0 0 0 fn.px-to-em(1) color.scale(colors.$error-color, $lightness: 70%);
|
|
307
307
|
|
|
@@ -375,6 +375,7 @@ onMounted(() => overrideAlignOverlay())
|
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
&__overlay {
|
|
378
|
+
padding-block: sp.$space-sm;
|
|
378
379
|
left: 0;
|
|
379
380
|
overflow: hidden;
|
|
380
381
|
background: colors.$neutral-light;
|
|
@@ -397,7 +398,10 @@ onMounted(() => overrideAlignOverlay())
|
|
|
397
398
|
}
|
|
398
399
|
|
|
399
400
|
&__list {
|
|
400
|
-
|
|
401
|
+
display: flex;
|
|
402
|
+
padding-inline: sp.$space-sm;
|
|
403
|
+
flex-direction: column;
|
|
404
|
+
gap: sp.$space-xs;
|
|
401
405
|
}
|
|
402
406
|
|
|
403
407
|
&__optionWrapper {
|
|
@@ -421,6 +425,7 @@ onMounted(() => overrideAlignOverlay())
|
|
|
421
425
|
}
|
|
422
426
|
}
|
|
423
427
|
|
|
428
|
+
&__optionWrapper > *,
|
|
424
429
|
&__option {
|
|
425
430
|
display: flex;
|
|
426
431
|
align-items: center;
|
|
@@ -149,10 +149,10 @@ onMounted(() => {
|
|
|
149
149
|
&__inner {
|
|
150
150
|
@extend %u-text-ellipsis;
|
|
151
151
|
|
|
152
|
-
box-shadow: 0 0 0 fn.px-to-rem(1)
|
|
152
|
+
box-shadow: 0 0 0 fn.px-to-rem(1) colors.$border-color;
|
|
153
153
|
appearance: none;
|
|
154
154
|
border: none;
|
|
155
|
-
border-radius: fn.px-to-rem(
|
|
155
|
+
border-radius: fn.px-to-rem(8);
|
|
156
156
|
background-color: colors.$neutral-light;
|
|
157
157
|
width: 100%;
|
|
158
158
|
color: colors.$neutral-dark;
|
|
@@ -226,6 +226,7 @@ onMounted(() => {
|
|
|
226
226
|
|
|
227
227
|
&--lg {
|
|
228
228
|
.cpSelect__inner {
|
|
229
|
+
border-radius: fn.px-to-rem(10);
|
|
229
230
|
font-size: fn.px-to-rem(16);
|
|
230
231
|
padding: sp.$space-md calc(#{sp.$space-lg} + #{fn.px-to-rem(20)} + #{sp.$space-sm}) sp.$space-md sp.$space-lg;
|
|
231
232
|
}
|
|
@@ -95,7 +95,7 @@ const handleClick = (value: boolean): void => {
|
|
|
95
95
|
|
|
96
96
|
<style lang="scss">
|
|
97
97
|
@mixin cp-switch-style($color, $className) {
|
|
98
|
-
&--is#{$className}#{&}--isActive &__switch {
|
|
98
|
+
&--is#{$className}#{&}--isActive:not(#{&}--isDisabled) &__switch {
|
|
99
99
|
background-color: $color;
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -108,13 +108,13 @@ const handleClick = (value: boolean): void => {
|
|
|
108
108
|
background-color: colors.$neutral-dark-1;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
&--is#{$className}#{&}--isActive:hover &__switch {
|
|
111
|
+
&--is#{$className}#{&}--isActive:not(#{&}--isDisabled):hover &__switch {
|
|
112
112
|
background-color: colors.$purple-600;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
.cpSwitch {
|
|
117
|
-
$cp-switch-base-height: fn.px-to-
|
|
117
|
+
$cp-switch-base-height: fn.px-to-rem(20);
|
|
118
118
|
align-items: center;
|
|
119
119
|
|
|
120
120
|
&,
|
|
@@ -185,7 +185,7 @@ const handleClick = (value: boolean): void => {
|
|
|
185
185
|
|
|
186
186
|
&--isActive .cpSwitch {
|
|
187
187
|
&__knobContainer {
|
|
188
|
-
transform:
|
|
188
|
+
transform: translate3d(50%, 0, 0);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
|
|
@@ -218,7 +218,7 @@ const handleClick = (value: boolean): void => {
|
|
|
218
218
|
padding: fn.px-to-rem(2);
|
|
219
219
|
display: flex;
|
|
220
220
|
align-items: center;
|
|
221
|
-
transition: transform
|
|
221
|
+
transition: transform 300ms easings.$easing-elastic;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
&__knob {
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="cpTextarea">
|
|
3
|
-
<base-input-label
|
|
3
|
+
<base-input-label
|
|
4
|
+
v-if="label"
|
|
5
|
+
v-bind-once="{ for: inputIdentifier }"
|
|
6
|
+
:is-invalid="isInvalid"
|
|
7
|
+
:required="required"
|
|
8
|
+
class="cpTextarea__label"
|
|
9
|
+
>
|
|
4
10
|
{{ capitalizedLabel }}
|
|
5
|
-
<span v-if="required" class="u-asterisk">*</span>
|
|
6
11
|
</base-input-label>
|
|
7
12
|
<textarea
|
|
8
13
|
v-model="textareaModel"
|
|
@@ -15,14 +20,9 @@
|
|
|
15
20
|
class="cpTextarea__input"
|
|
16
21
|
/>
|
|
17
22
|
<transition-expand>
|
|
18
|
-
<
|
|
19
|
-
v-if="displayErrorMessage"
|
|
20
|
-
v-bind-once="{ for: inputIdentifier }"
|
|
21
|
-
is-invalid
|
|
22
|
-
class="cpTextarea__label cpTextarea__label--isAfter"
|
|
23
|
-
>
|
|
23
|
+
<p v-if="displayErrorMessage" class="cpTextarea__error">
|
|
24
24
|
{{ errorMessage }}
|
|
25
|
-
</
|
|
25
|
+
</p>
|
|
26
26
|
</transition-expand>
|
|
27
27
|
</div>
|
|
28
28
|
</template>
|
|
@@ -86,8 +86,9 @@ const handleChange = (newValue: string) => emit('update:modelValue', newValue)
|
|
|
86
86
|
|
|
87
87
|
<style lang="scss">
|
|
88
88
|
.cpTextarea {
|
|
89
|
+
position: relative;
|
|
90
|
+
|
|
89
91
|
&__input {
|
|
90
|
-
box-shadow: inset 0 fn.px-to-em(1) fn.px-to-em(2) rgba(0, 0, 0, 0.12);
|
|
91
92
|
appearance: none;
|
|
92
93
|
border: fn.px-to-rem(1) solid colors.$neutral-dark-4;
|
|
93
94
|
border-radius: fn.px-to-em(10);
|
|
@@ -104,8 +105,7 @@ const handleChange = (newValue: string) => emit('update:modelValue', newValue)
|
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
&:focus {
|
|
107
|
-
|
|
108
|
-
border-color: colors.$primary-color;
|
|
108
|
+
outline: fn.px-to-rem(2) solid colors.$primary-color;
|
|
109
109
|
background-color: colors.$neutral-light;
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -120,7 +120,6 @@ const handleChange = (newValue: string) => emit('update:modelValue', newValue)
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
&--isInvalid {
|
|
123
|
-
box-shadow: 0 0 0 fn.px-to-rem(0.5) colors.$error-color;
|
|
124
123
|
border: fn.px-to-rem(1) solid colors.$error-color;
|
|
125
124
|
|
|
126
125
|
&:hover,
|
|
@@ -129,22 +128,15 @@ const handleChange = (newValue: string) => emit('update:modelValue', newValue)
|
|
|
129
128
|
}
|
|
130
129
|
|
|
131
130
|
&:focus {
|
|
132
|
-
|
|
131
|
+
outline: fn.px-to-rem(2) solid colors.$error-color;
|
|
133
132
|
}
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
|
|
137
|
-
&
|
|
138
|
-
|
|
136
|
+
&__error {
|
|
137
|
+
font-size: fn.px-to-em(14);
|
|
139
138
|
line-height: fn.px-to-rem(24);
|
|
140
|
-
|
|
141
|
-
&:not(#{&}--isAfter) {
|
|
142
|
-
margin-bottom: sp.$space;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
&--isAfter {
|
|
146
|
-
margin-top: fn.px-to-em(6);
|
|
147
|
-
}
|
|
139
|
+
color: colors.$error-color;
|
|
148
140
|
}
|
|
149
141
|
}
|
|
150
142
|
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
width="24"
|
|
5
|
+
height="24"
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
fill="none"
|
|
8
|
+
stroke="currentColor"
|
|
9
|
+
stroke-width="2"
|
|
10
|
+
stroke-linecap="round"
|
|
11
|
+
stroke-linejoin="round"
|
|
12
|
+
>
|
|
13
|
+
<path
|
|
14
|
+
d="M10.2103 10.0861V8.74317C10.2103 7.6386 11.1057 6.74316 12.2103 6.74316H19C20.1046 6.74316 21 7.63859 21 8.74316V18.0669C21 19.1715 20.1046 20.0669 19 20.0669H14.704"
|
|
15
|
+
/>
|
|
16
|
+
<path d="M18.911 20.323L18.911 21.0001" />
|
|
17
|
+
<path
|
|
18
|
+
d="M8.67485 21H5.10531C3.96046 21 3.04925 20.0408 3.10794 18.8974L3.31108 14.9402C3.36567 13.8769 4.24374 13.0427 5.30845 13.0427H12.4497C13.5144 13.0427 14.3925 13.8769 14.447 14.9402L14.6502 18.8974C14.7089 20.0408 13.7977 21 12.6528 21H9.08328"
|
|
19
|
+
/>
|
|
20
|
+
<path
|
|
21
|
+
d="M6.17389 12.9094C6.17389 11.2712 7.38503 9.94312 8.87905 9.94312C10.3731 9.94312 11.5842 11.2712 11.5842 12.9094"
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
d="M13.0109 4C13.0109 3.44772 13.4586 3 14.0109 3H17.1994C17.7517 3 18.1994 3.44772 18.1994 4V5.74304C18.1994 6.29533 17.7517 6.74304 17.1994 6.74304H14.0109C13.4586 6.74304 13.0109 6.29533 13.0109 5.74304V4Z"
|
|
25
|
+
/>
|
|
26
|
+
</svg>
|
|
27
|
+
</template>
|
|
@@ -8,6 +8,7 @@ import IconArrival from '@/components/icons/IconArrival.vue'
|
|
|
8
8
|
import IconBaggageCabinNone from '@/components/icons/IconBaggageCabinNone.vue'
|
|
9
9
|
import IconBaggageCheckedNone from '@/components/icons/IconBaggageCheckedNone.vue'
|
|
10
10
|
import IconBaggagePersonalNone from '@/components/icons/IconBaggagePersonalNone.vue'
|
|
11
|
+
import IconBaggageSet from '@/components/icons/IconBaggageSet.vue'
|
|
11
12
|
import IconBaggageSetPlus from '@/components/icons/IconBaggageSetPlus.vue'
|
|
12
13
|
import IconBroadcast from '@/components/icons/IconBroadcast.vue'
|
|
13
14
|
import IconCabinBag from '@/components/icons/IconCabinBag.vue'
|
|
@@ -88,6 +89,7 @@ export const CustomCpIcons = {
|
|
|
88
89
|
'baggage-cabin-none': IconBaggageCabinNone,
|
|
89
90
|
'baggage-checked-none': IconBaggageCheckedNone,
|
|
90
91
|
'baggage-personal-none': IconBaggagePersonalNone,
|
|
92
|
+
'baggage-set': IconBaggageSet,
|
|
91
93
|
'baggage-set-plus': IconBaggageSetPlus,
|
|
92
94
|
broadcast: IconBroadcast,
|
|
93
95
|
'calendar-2': IconCalendar,
|
|
@@ -11,6 +11,11 @@ const meta = {
|
|
|
11
11
|
options: ['default', 'primary', 'minimal'],
|
|
12
12
|
description: 'The visual style of the button',
|
|
13
13
|
},
|
|
14
|
+
size: {
|
|
15
|
+
control: 'select',
|
|
16
|
+
options: ['xs', 'sm', 'md', 'lg'],
|
|
17
|
+
description: 'The size of the button',
|
|
18
|
+
},
|
|
14
19
|
color: {
|
|
15
20
|
control: 'select',
|
|
16
21
|
options: ['Blue', 'Purple', 'Green', 'Orange', 'Red'],
|
|
@@ -38,10 +43,6 @@ const meta = {
|
|
|
38
43
|
control: 'boolean',
|
|
39
44
|
description: 'Whether the button has square corners',
|
|
40
45
|
},
|
|
41
|
-
isLarge: {
|
|
42
|
-
control: 'boolean',
|
|
43
|
-
description: 'Whether the button is large size',
|
|
44
|
-
},
|
|
45
46
|
onClick: { action: 'clicked' },
|
|
46
47
|
},
|
|
47
48
|
} satisfies Meta<typeof CpButton>
|
|
@@ -67,7 +68,6 @@ export const Default: Story = {
|
|
|
67
68
|
type: 'button',
|
|
68
69
|
isLoading: false,
|
|
69
70
|
isSquare: false,
|
|
70
|
-
isLarge: false,
|
|
71
71
|
},
|
|
72
72
|
render: defaultRender,
|
|
73
73
|
}
|
|
@@ -123,12 +123,38 @@ export const Disabled: Story = {
|
|
|
123
123
|
render: defaultRender,
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
export const
|
|
127
|
-
args: { ...Default.args
|
|
128
|
-
render:
|
|
126
|
+
export const DifferentSizes: Story = {
|
|
127
|
+
args: { ...Default.args },
|
|
128
|
+
render: (args) => ({
|
|
129
|
+
components: { CpButton },
|
|
130
|
+
setup: () => ({ args }),
|
|
131
|
+
template: `
|
|
132
|
+
<div style="display: flex; gap: 8px; align-items: center;">
|
|
133
|
+
<CpButton v-bind="args" color="Purple" appearance="primary" size="xs">Extra Small</CpButton>
|
|
134
|
+
<CpButton v-bind="args" color="green" appearance="primary" size="sm">Small</CpButton>
|
|
135
|
+
<CpButton v-bind="args" color="red" appearance="primary" size="md">Medium</CpButton>
|
|
136
|
+
<CpButton v-bind="args" color="orange" appearance="primary" size="lg" >Large</CpButton>
|
|
137
|
+
</div>
|
|
138
|
+
`,
|
|
139
|
+
}),
|
|
129
140
|
}
|
|
130
141
|
|
|
131
142
|
export const Square: Story = {
|
|
132
143
|
args: { ...Default.args, isSquare: true },
|
|
133
144
|
render: defaultRender,
|
|
134
145
|
}
|
|
146
|
+
|
|
147
|
+
export const IconOnly: Story = {
|
|
148
|
+
args: { ...Default.args },
|
|
149
|
+
render: (args) => ({
|
|
150
|
+
components: { CpButton },
|
|
151
|
+
setup: () => ({ args }),
|
|
152
|
+
template: `
|
|
153
|
+
<CpButton v-bind="args">
|
|
154
|
+
<template #leading-icon>
|
|
155
|
+
<CpIcon type="arrow-left" />
|
|
156
|
+
</template>
|
|
157
|
+
</CpButton>
|
|
158
|
+
`,
|
|
159
|
+
}),
|
|
160
|
+
}
|