@citizenplane/pimp 14.1.5 → 15.1.0
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 +3783 -3689
- package/dist/pimp.umd.js +44 -44
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/assets/css/colors.css +1 -0
- package/src/assets/css/shadows.css +11 -0
- package/src/assets/css/tokens.css +9 -0
- package/src/components/CpBadge.vue +102 -165
- package/src/components/CpRadio.vue +117 -86
- package/src/components/CpRadioGroup.vue +146 -0
- package/src/components/CpRadioNew.vue +199 -0
- package/src/components/index.ts +4 -0
- package/src/constants/colors/Colors.ts +0 -5
- package/src/constants/colors/ToggleColors.ts +1 -4
- package/src/stories/CpBadge.stories.ts +205 -100
- package/src/stories/CpRadioGroup.stories.ts +169 -0
package/package.json
CHANGED
|
@@ -68,4 +68,15 @@
|
|
|
68
68
|
--cp-drop-shadow-side-panel-offset-x: 0;
|
|
69
69
|
--cp-drop-shadow-side-panel-offset-y: 0;
|
|
70
70
|
--cp-drop-shadow-side-panel-spread: 0;
|
|
71
|
+
|
|
72
|
+
--cp-shadow-focus-ring-accent-gap-offset-x: 0;
|
|
73
|
+
--cp-shadow-focus-ring-accent-gap-offset-y: 0;
|
|
74
|
+
--cp-shadow-focus-ring-accent-gap-blur: 0;
|
|
75
|
+
--cp-shadow-focus-ring-accent-gap-spread: 2px;
|
|
76
|
+
--cp-shadow-focus-ring-accent-gap-color: var(--cp-colors-white);
|
|
77
|
+
--cp-shadow-focus-ring-accent-ring-offset-x: 0;
|
|
78
|
+
--cp-shadow-focus-ring-accent-ring-offset-y: 0;
|
|
79
|
+
--cp-shadow-focus-ring-accent-ring-blur: 0;
|
|
80
|
+
--cp-shadow-focus-ring-accent-ring-spread: 4px;
|
|
81
|
+
--cp-shadow-focus-ring-accent-ring-color: var(--cp-colors-accent-500);
|
|
71
82
|
}
|
|
@@ -392,4 +392,13 @@
|
|
|
392
392
|
var(--cp-drop-shadow-overlay-4-blur) var(--cp-drop-shadow-overlay-4-spread) var(--cp-drop-shadow-overlay-4-color),
|
|
393
393
|
var(--cp-drop-shadow-overlay-5-offset-x) var(--cp-drop-shadow-overlay-5-offset-y)
|
|
394
394
|
var(--cp-drop-shadow-overlay-5-blur) var(--cp-drop-shadow-overlay-5-spread) var(--cp-drop-shadow-overlay-5-color);
|
|
395
|
+
|
|
396
|
+
/* Focus ring tokens */
|
|
397
|
+
--cp-shadow-focus-ring-accent:
|
|
398
|
+
var(--cp-shadow-focus-ring-accent-gap-offset-x) var(--cp-shadow-focus-ring-accent-gap-offset-y)
|
|
399
|
+
var(--cp-shadow-focus-ring-accent-gap-blur) var(--cp-shadow-focus-ring-accent-gap-spread)
|
|
400
|
+
var(--cp-shadow-focus-ring-accent-gap-color),
|
|
401
|
+
var(--cp-shadow-focus-ring-accent-ring-offset-x) var(--cp-shadow-focus-ring-accent-ring-offset-y)
|
|
402
|
+
var(--cp-shadow-focus-ring-accent-ring-blur) var(--cp-shadow-focus-ring-accent-ring-spread)
|
|
403
|
+
var(--cp-shadow-focus-ring-accent-ring-color);
|
|
395
404
|
}
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
<slot name="leading-icon">
|
|
4
4
|
<cp-icon v-if="leadingIcon" class="cpBadge__icon" :type="leadingIcon" />
|
|
5
5
|
</slot>
|
|
6
|
-
<span class="cpBadge__label">
|
|
6
|
+
<span v-if="label" class="cpBadge__label">
|
|
7
7
|
<slot>{{ label }}</slot>
|
|
8
8
|
</span>
|
|
9
|
-
<slot v-if="!
|
|
9
|
+
<slot v-if="!hasClose" name="trailing-icon">
|
|
10
10
|
<cp-icon v-if="trailingIcon" class="cpBadge__icon" :type="trailingIcon" />
|
|
11
11
|
</slot>
|
|
12
|
-
<button v-if="
|
|
12
|
+
<button v-if="hasClose" class="cpBadge__clear" :disabled="disabled" type="button" @click="emit('onClear')">
|
|
13
13
|
<cp-icon class="cpBadge__clearIcon" type="x" />
|
|
14
14
|
</button>
|
|
15
15
|
</div>
|
|
@@ -25,23 +25,25 @@ interface Emits {
|
|
|
25
25
|
(e: 'onClear'): void
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
type BadgeSizes = Extract<Sizes, '2xs' | 'xs' | 'sm' | 'md'>
|
|
29
|
+
type BadgeStyles = 'outline' | 'soft' | 'solid'
|
|
30
|
+
|
|
28
31
|
interface Props {
|
|
29
32
|
color?: Colors
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
isDisabled?: boolean
|
|
33
|
-
isSolid?: boolean
|
|
33
|
+
disabled?: boolean
|
|
34
|
+
hasClose?: boolean
|
|
34
35
|
isSquare?: boolean
|
|
35
|
-
isStroked?: boolean
|
|
36
36
|
label?: string
|
|
37
37
|
leadingIcon?: string
|
|
38
|
-
size?:
|
|
38
|
+
size?: BadgeSizes
|
|
39
|
+
style?: BadgeStyles
|
|
39
40
|
trailingIcon?: string
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
const props = withDefaults(defineProps<Props>(), {
|
|
43
|
-
color: '
|
|
44
|
+
color: 'neutral',
|
|
44
45
|
size: 'md',
|
|
46
|
+
style: 'outline',
|
|
45
47
|
label: '',
|
|
46
48
|
leadingIcon: '',
|
|
47
49
|
trailingIcon: '',
|
|
@@ -49,22 +51,52 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
49
51
|
|
|
50
52
|
const emit = defineEmits<Emits>()
|
|
51
53
|
|
|
52
|
-
const componentDynamicClasses = computed(() =>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
{ 'cpBadge--isDisabled': props.isDisabled },
|
|
60
|
-
{ 'cpBadge--isSolid': props.isSolid },
|
|
61
|
-
]
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
const handleClear = () => emit('onClear')
|
|
54
|
+
const componentDynamicClasses = computed(() => [
|
|
55
|
+
`cpBadge--${props.size}`,
|
|
56
|
+
`cpBadge--is${capitalizeFirstLetter(props.color)}`,
|
|
57
|
+
`cpBadge--is${capitalizeFirstLetter(props.style)}`,
|
|
58
|
+
{ 'cpBadge--isSquare': props.isSquare },
|
|
59
|
+
{ 'cpBadge--isDisabled': props.disabled },
|
|
60
|
+
])
|
|
65
61
|
</script>
|
|
66
62
|
|
|
67
63
|
<style lang="scss">
|
|
64
|
+
@mixin cp-badge-sized(
|
|
65
|
+
$size,
|
|
66
|
+
$font-size,
|
|
67
|
+
$line-height,
|
|
68
|
+
$padding,
|
|
69
|
+
$square-radius,
|
|
70
|
+
$no-label-padding,
|
|
71
|
+
$icon-width,
|
|
72
|
+
$clear-icon-width
|
|
73
|
+
) {
|
|
74
|
+
&--#{$size} {
|
|
75
|
+
font-size: $font-size;
|
|
76
|
+
line-height: $line-height;
|
|
77
|
+
font-weight: 400;
|
|
78
|
+
padding: $padding;
|
|
79
|
+
|
|
80
|
+
&.cpBadge--isSquare {
|
|
81
|
+
border-radius: $square-radius;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&:not(:has(.cpBadge__label)) {
|
|
85
|
+
padding: $no-label-padding;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
& .cpBadge__icon {
|
|
89
|
+
width: $icon-width;
|
|
90
|
+
aspect-ratio: 1/1;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
& .cpBadge__clearIcon {
|
|
94
|
+
width: $clear-icon-width;
|
|
95
|
+
aspect-ratio: 1/1;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
68
100
|
@mixin cp-badge-themed($className, $color, $bg-color, $solid-color, $solid-bg-color, $outline-color) {
|
|
69
101
|
&--is#{$className} {
|
|
70
102
|
color: $color;
|
|
@@ -76,6 +108,10 @@ const handleClear = () => emit('onClear')
|
|
|
76
108
|
background-color: $solid-bg-color;
|
|
77
109
|
}
|
|
78
110
|
|
|
111
|
+
&.cpBadge--isOutline {
|
|
112
|
+
box-shadow: 0 0 0 1px $outline-color;
|
|
113
|
+
}
|
|
114
|
+
|
|
79
115
|
.cpBadge__clear:not(:disabled):hover,
|
|
80
116
|
.cpBadge__clear:not(:disabled):focus-visible {
|
|
81
117
|
background-color: $color;
|
|
@@ -83,97 +119,58 @@ const handleClear = () => emit('onClear')
|
|
|
83
119
|
}
|
|
84
120
|
}
|
|
85
121
|
|
|
86
|
-
@mixin cp-badge-dynamic-padding(
|
|
87
|
-
$horizontal-padding,
|
|
88
|
-
$vertical-padding,
|
|
89
|
-
$label-padding,
|
|
90
|
-
$label-font-size,
|
|
91
|
-
$label-line-height
|
|
92
|
-
) {
|
|
93
|
-
&:has(.cpBadge__label:not(:empty)) {
|
|
94
|
-
padding: $vertical-padding $horizontal-padding;
|
|
95
|
-
|
|
96
|
-
.cpBadge__label {
|
|
97
|
-
line-height: $label-line-height;
|
|
98
|
-
font-size: $label-font-size;
|
|
99
|
-
padding: 0 $label-padding;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
122
|
.cpBadge {
|
|
105
123
|
display: inline-flex;
|
|
106
|
-
|
|
124
|
+
text-wrap: wrap;
|
|
107
125
|
align-items: center;
|
|
108
126
|
justify-content: center;
|
|
109
127
|
border-radius: var(--cp-radius-full);
|
|
110
128
|
background-color: var(--cp-background-tertiary);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
&--isStroked {
|
|
114
|
-
outline: 1px solid currentColor;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
&--isDashed {
|
|
118
|
-
outline-style: dashed;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
&--isSquare {
|
|
122
|
-
border-radius: var(--cp-radius-md);
|
|
123
|
-
|
|
124
|
-
&.cpBadge--2xs,
|
|
125
|
-
&.cpBadge--xs {
|
|
126
|
-
border-radius: var(--cp-radius-sm);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
&.cpBadge--sm {
|
|
130
|
-
border-radius: var(--cp-radius-sm-md);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
129
|
+
gap: var(--cp-spacing-sm-md);
|
|
133
130
|
|
|
134
|
-
@include cp-badge-
|
|
135
|
-
|
|
136
|
-
var(--cp-spacing-sm),
|
|
137
|
-
var(--cp-spacing-sm),
|
|
131
|
+
@include cp-badge-sized(
|
|
132
|
+
'md',
|
|
138
133
|
var(--cp-text-size-sm),
|
|
139
|
-
var(--cp-line-height-sm)
|
|
134
|
+
var(--cp-line-height-sm),
|
|
135
|
+
var(--cp-spacing-sm) var(--cp-spacing-md),
|
|
136
|
+
var(--cp-radius-md),
|
|
137
|
+
var(--cp-spacing-sm-md),
|
|
138
|
+
var(--cp-dimensions-4),
|
|
139
|
+
var(--cp-dimensions-3_5)
|
|
140
140
|
);
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
&--xs {
|
|
155
|
-
padding: var(--cp-spacing-sm);
|
|
156
|
-
|
|
157
|
-
@include cp-badge-dynamic-padding(
|
|
158
|
-
var(--cp-spacing-sm-md),
|
|
159
|
-
var(--cp-spacing-xs),
|
|
160
|
-
var(--cp-spacing-xs),
|
|
161
|
-
var(--cp-text-size-xs),
|
|
162
|
-
var(--cp-line-height-xs)
|
|
163
|
-
);
|
|
164
|
-
}
|
|
142
|
+
@include cp-badge-sized(
|
|
143
|
+
'sm',
|
|
144
|
+
var(--cp-text-size-xs),
|
|
145
|
+
var(--cp-line-height-xs),
|
|
146
|
+
var(--cp-spacing-sm) var(--cp-spacing-md),
|
|
147
|
+
var(--cp-radius-md-lg),
|
|
148
|
+
var(--cp-spacing-sm),
|
|
149
|
+
var(--cp-dimensions-4),
|
|
150
|
+
var(--cp-dimensions-3_5)
|
|
151
|
+
);
|
|
165
152
|
|
|
166
|
-
|
|
167
|
-
|
|
153
|
+
@include cp-badge-sized(
|
|
154
|
+
'xs',
|
|
155
|
+
var(--cp-text-size-xs),
|
|
156
|
+
var(--cp-line-height-xs),
|
|
157
|
+
var(--cp-spacing-xs) var(--cp-spacing-sm-md),
|
|
158
|
+
var(--cp-radius-sm-md),
|
|
159
|
+
var(--cp-spacing-sm),
|
|
160
|
+
var(--cp-dimensions-3),
|
|
161
|
+
var(--cp-dimensions-2_5)
|
|
162
|
+
);
|
|
168
163
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
)
|
|
176
|
-
|
|
164
|
+
@include cp-badge-sized(
|
|
165
|
+
'2xs',
|
|
166
|
+
var(--cp-text-size-xs),
|
|
167
|
+
var(--cp-line-height-xs),
|
|
168
|
+
var(--cp-spacing-none) var(--cp-spacing-sm),
|
|
169
|
+
var(--cp-radius-sm),
|
|
170
|
+
var(--cp-spacing-xs),
|
|
171
|
+
var(--cp-dimensions-3),
|
|
172
|
+
var(--cp-dimensions-2_5)
|
|
173
|
+
);
|
|
177
174
|
|
|
178
175
|
@include cp-badge-themed(
|
|
179
176
|
'Neutral',
|
|
@@ -274,69 +271,9 @@ const handleClear = () => emit('onClear')
|
|
|
274
271
|
var(--cp-border-disabled)
|
|
275
272
|
);
|
|
276
273
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
var(--cp-background-secondary),
|
|
281
|
-
var(--cp-foreground-primary),
|
|
282
|
-
var(--cp-background-secondary),
|
|
283
|
-
var(--cp-border-soft)
|
|
284
|
-
); // TODO: Should be replace by NEUTRAL
|
|
285
|
-
|
|
286
|
-
@include cp-badge-themed(
|
|
287
|
-
'Green',
|
|
288
|
-
var(--cp-foreground-success-primary),
|
|
289
|
-
var(--cp-background-success-secondary),
|
|
290
|
-
var(--cp-foreground-success-primary),
|
|
291
|
-
var(--cp-background-success-secondary),
|
|
292
|
-
var(--cp-border-success-primary)
|
|
293
|
-
); // TODO: Should be replace by SUCCESS
|
|
294
|
-
|
|
295
|
-
@include cp-badge-themed(
|
|
296
|
-
'Orange',
|
|
297
|
-
var(--cp-foreground-warning-primary),
|
|
298
|
-
var(--cp-background-warning-secondary),
|
|
299
|
-
var(--cp-foreground-warning-primary),
|
|
300
|
-
var(--cp-background-warning-secondary),
|
|
301
|
-
var(--cp-border-warning-primary)
|
|
302
|
-
); // TODO: Should be replace by WARNING
|
|
303
|
-
|
|
304
|
-
@include cp-badge-themed(
|
|
305
|
-
'Purple',
|
|
306
|
-
var(--cp-foreground-accent-primary),
|
|
307
|
-
var(--cp-background-accent-secondary),
|
|
308
|
-
var(--cp-foreground-accent-primary),
|
|
309
|
-
var(--cp-background-accent-secondary),
|
|
310
|
-
var(--cp-border-accent-primary)
|
|
311
|
-
); // TODO: Should be replace by ACCENT
|
|
312
|
-
|
|
313
|
-
@include cp-badge-themed(
|
|
314
|
-
'Red',
|
|
315
|
-
var(--cp-foreground-error-primary),
|
|
316
|
-
var(--cp-background-error-secondary),
|
|
317
|
-
var(--cp-foreground-error-primary),
|
|
318
|
-
var(--cp-background-error-secondary),
|
|
319
|
-
var(--cp-border-error-primary)
|
|
320
|
-
); // TODO: Should be replace by ERROR
|
|
321
|
-
|
|
322
|
-
&--isDisabled {
|
|
323
|
-
background-color: var(--cp-background-disabled);
|
|
324
|
-
color: var(--cp-text-disabled);
|
|
325
|
-
|
|
326
|
-
&.cpBadge--isStroked,
|
|
327
|
-
&.cpBadge--isDashed {
|
|
328
|
-
outline-color: var(--cp-border-disabled);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
&__icon {
|
|
333
|
-
width: var(--cp-dimensions-4);
|
|
334
|
-
aspect-ratio: 1/1;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
&__clearIcon {
|
|
338
|
-
width: var(--cp-dimensions-3_5);
|
|
339
|
-
aspect-ratio: 1/1;
|
|
274
|
+
&--isDisabled,
|
|
275
|
+
&--isDisabled * {
|
|
276
|
+
cursor: not-allowed;
|
|
340
277
|
}
|
|
341
278
|
|
|
342
279
|
&__clear {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div class="cpRadio">
|
|
3
3
|
<label
|
|
4
4
|
v-for="({ label, value, description, additionalData, disabled }, index) in options"
|
|
5
5
|
:key="getRadioId(index)"
|
|
6
|
-
class="
|
|
7
|
-
:class="computedClasses
|
|
6
|
+
class="cpRadio__item"
|
|
7
|
+
:class="computedClasses"
|
|
8
8
|
:for="getRadioId(index)"
|
|
9
9
|
>
|
|
10
10
|
<input
|
|
@@ -17,19 +17,15 @@
|
|
|
17
17
|
:value="value"
|
|
18
18
|
@input="onChange(value)"
|
|
19
19
|
/>
|
|
20
|
-
<span class="
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<span v-if="description" class="cpRadio__description">{{ description }}</span>
|
|
24
|
-
</span>
|
|
25
|
-
<span v-if="additionalData" class="cpRadio__additionalData">{{ additionalData }}</span>
|
|
26
|
-
</span>
|
|
20
|
+
<span class="cpRadio__label">{{ label }}</span>
|
|
21
|
+
<span class="cpRadio__description">{{ description }}</span>
|
|
22
|
+
<span class="cpRadio__additionalData">{{ additionalData }}</span>
|
|
27
23
|
</label>
|
|
28
24
|
</div>
|
|
29
25
|
</template>
|
|
30
26
|
|
|
31
27
|
<script setup lang="ts">
|
|
32
|
-
import { useId } from 'vue'
|
|
28
|
+
import { computed, useId } from 'vue'
|
|
33
29
|
|
|
34
30
|
import { ToggleColors } from '@/constants'
|
|
35
31
|
import { capitalizeFirstLetter } from '@/helpers'
|
|
@@ -70,20 +66,12 @@ const getRadioId = (index: number): string => `${radioUniqueId}${index}`
|
|
|
70
66
|
|
|
71
67
|
const isActive = (value: string): boolean => value === props.modelValue
|
|
72
68
|
|
|
73
|
-
const computedClasses = (
|
|
74
|
-
return [
|
|
75
|
-
{
|
|
76
|
-
'cpRadio--isActive': isActive(value),
|
|
77
|
-
'cpRadio--isDisabled': disabled,
|
|
78
|
-
},
|
|
79
|
-
`cpRadio--is${capitalizeFirstLetter(props.color)}`,
|
|
80
|
-
]
|
|
81
|
-
}
|
|
69
|
+
const computedClasses = computed(() => `cpRadio--is${capitalizeFirstLetter(props.color)}`)
|
|
82
70
|
</script>
|
|
83
71
|
|
|
84
72
|
<style lang="scss">
|
|
85
73
|
@mixin cp-radio-style($color, $className) {
|
|
86
|
-
&--is#{$className}
|
|
74
|
+
&--is#{$className}:has(input:checked) {
|
|
87
75
|
border-color: $color;
|
|
88
76
|
}
|
|
89
77
|
|
|
@@ -91,11 +79,9 @@ const computedClasses = ({ value, disabled }: { disabled?: boolean; value: strin
|
|
|
91
79
|
background-color: $color;
|
|
92
80
|
border-color: $color;
|
|
93
81
|
|
|
94
|
-
& ~
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
color: $color;
|
|
98
|
-
}
|
|
82
|
+
& ~ .cpRadio__label,
|
|
83
|
+
& ~ .cpRadio__additionalData {
|
|
84
|
+
color: $color;
|
|
99
85
|
}
|
|
100
86
|
}
|
|
101
87
|
|
|
@@ -112,53 +98,70 @@ const computedClasses = ({ value, disabled }: { disabled?: boolean; value: strin
|
|
|
112
98
|
.cpRadio {
|
|
113
99
|
$cp-radio-base-width: var(--cp-dimensions-5);
|
|
114
100
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
padding: var(--cp-spacing-xl) var(--cp-spacing-lg);
|
|
119
|
-
display: grid;
|
|
120
|
-
grid-template-columns: min-content 1fr;
|
|
121
|
-
grid-gap: var(--cp-spacing-lg);
|
|
122
|
-
align-items: center;
|
|
123
|
-
width: 100%;
|
|
124
|
-
|
|
125
|
-
&:not(#{&}--isDisabled),
|
|
126
|
-
&:not(#{&}--isDisabled) * {
|
|
127
|
-
cursor: pointer;
|
|
128
|
-
}
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
gap: var(--cp-spacing-lg);
|
|
129
104
|
|
|
130
|
-
|
|
105
|
+
&__item {
|
|
106
|
+
position: relative;
|
|
107
|
+
border: var(--cp-dimensions-0_25) solid var(--cp-border-soft);
|
|
108
|
+
border-radius: var(--cp-radius-md-lg);
|
|
109
|
+
padding: var(--cp-spacing-xl) var(--cp-spacing-lg);
|
|
110
|
+
display: grid;
|
|
111
|
+
grid-template-columns: min-content 1fr;
|
|
112
|
+
grid-template-rows: auto auto auto;
|
|
113
|
+
align-items: center;
|
|
114
|
+
column-gap: var(--cp-spacing-lg);
|
|
115
|
+
row-gap: 0;
|
|
116
|
+
width: 100%;
|
|
131
117
|
|
|
132
|
-
|
|
118
|
+
&:not(:has(input:disabled)),
|
|
119
|
+
&:not(:has(input:disabled)) * {
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
}
|
|
133
122
|
|
|
134
|
-
|
|
123
|
+
&:has(input:disabled) {
|
|
124
|
+
background-color: var(--cp-background-disabled);
|
|
125
|
+
color: var(--cp-foreground-disabled);
|
|
126
|
+
border-color: var(--cp-border-disabled);
|
|
135
127
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
128
|
+
&,
|
|
129
|
+
* {
|
|
130
|
+
cursor: not-allowed;
|
|
131
|
+
}
|
|
140
132
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
133
|
+
&:hover,
|
|
134
|
+
&:focus,
|
|
135
|
+
&:has(input:checked) {
|
|
136
|
+
box-shadow: none;
|
|
137
|
+
border-color: var(--cp-border-disabled);
|
|
138
|
+
}
|
|
144
139
|
}
|
|
140
|
+
}
|
|
145
141
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
border-color: var(--cp-border-disabled);
|
|
150
|
-
}
|
|
142
|
+
.cpRadio__label {
|
|
143
|
+
grid-column: 2;
|
|
144
|
+
grid-row: 1;
|
|
151
145
|
}
|
|
152
146
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
147
|
+
.cpRadio__description {
|
|
148
|
+
grid-column: 2;
|
|
149
|
+
grid-row: 2;
|
|
156
150
|
}
|
|
157
151
|
|
|
158
|
-
|
|
159
|
-
|
|
152
|
+
.cpRadio__additionalData {
|
|
153
|
+
grid-column: 2;
|
|
154
|
+
grid-row: 3;
|
|
155
|
+
margin-left: 0;
|
|
156
|
+
text-align: left;
|
|
160
157
|
}
|
|
161
158
|
|
|
159
|
+
@include cp-radio-style(var(--cp-foreground-accent-primary), 'Accent');
|
|
160
|
+
|
|
161
|
+
@include cp-radio-style(var(--cp-foreground-blue-primary), 'Blue');
|
|
162
|
+
|
|
163
|
+
@include cp-radio-style(var(--cp-foreground-accent-primary), 'Purple'); // TODO: Sould be replace by ACCENT
|
|
164
|
+
|
|
162
165
|
input {
|
|
163
166
|
-webkit-appearance: none;
|
|
164
167
|
-moz-appearance: none;
|
|
@@ -169,6 +172,9 @@ const computedClasses = ({ value, disabled }: { disabled?: boolean; value: strin
|
|
|
169
172
|
width: $cp-radio-base-width;
|
|
170
173
|
height: $cp-radio-base-width;
|
|
171
174
|
transition: transform 0.1s linear;
|
|
175
|
+
grid-column: 1;
|
|
176
|
+
grid-row: 1 / -1;
|
|
177
|
+
align-self: center;
|
|
172
178
|
|
|
173
179
|
&:before {
|
|
174
180
|
content: '';
|
|
@@ -198,34 +204,16 @@ const computedClasses = ({ value, disabled }: { disabled?: boolean; value: strin
|
|
|
198
204
|
background-color: var(--cp-foreground-disabled);
|
|
199
205
|
}
|
|
200
206
|
|
|
201
|
-
&:checked:disabled ~
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
color: var(--cp-foreground-disabled);
|
|
205
|
-
}
|
|
207
|
+
&:checked:disabled ~ .cpRadio__label,
|
|
208
|
+
&:checked:disabled ~ .cpRadio__additionalData {
|
|
209
|
+
color: var(--cp-foreground-disabled);
|
|
206
210
|
}
|
|
207
211
|
}
|
|
208
212
|
|
|
209
|
-
&__content {
|
|
210
|
-
display: flex;
|
|
211
|
-
align-items: center;
|
|
212
|
-
line-height: 1.3;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
&__information {
|
|
216
|
-
flex-grow: 2;
|
|
217
|
-
display: flex;
|
|
218
|
-
align-items: center;
|
|
219
|
-
justify-content: space-between;
|
|
220
|
-
flex-wrap: wrap;
|
|
221
|
-
text-transform: capitalize;
|
|
222
|
-
margin: 0 calc(var(--cp-spacing-md) * -1);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
213
|
&__label,
|
|
226
214
|
&__description {
|
|
227
|
-
|
|
228
|
-
|
|
215
|
+
line-height: 1.3;
|
|
216
|
+
text-transform: capitalize;
|
|
229
217
|
}
|
|
230
218
|
|
|
231
219
|
&__label,
|
|
@@ -242,9 +230,52 @@ const computedClasses = ({ value, disabled }: { disabled?: boolean; value: strin
|
|
|
242
230
|
white-space: nowrap;
|
|
243
231
|
}
|
|
244
232
|
|
|
245
|
-
&
|
|
246
|
-
|
|
247
|
-
|
|
233
|
+
&__description:empty {
|
|
234
|
+
display: none;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
&__additionalData:empty {
|
|
238
|
+
display: none;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@media (min-width: 768px) {
|
|
243
|
+
.cpRadio {
|
|
244
|
+
display: grid;
|
|
245
|
+
grid-template-columns: min-content max-content minmax(0, 1fr) auto;
|
|
246
|
+
column-gap: var(--cp-spacing-lg);
|
|
247
|
+
row-gap: var(--cp-spacing-lg);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.cpRadio__item {
|
|
251
|
+
grid-template-columns: subgrid;
|
|
252
|
+
grid-template-rows: auto;
|
|
253
|
+
grid-column: 1 / -1;
|
|
254
|
+
row-gap: 0;
|
|
255
|
+
|
|
256
|
+
input {
|
|
257
|
+
grid-column: auto;
|
|
258
|
+
grid-row: auto;
|
|
259
|
+
align-self: center;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.cpRadio__label {
|
|
263
|
+
grid-column: auto;
|
|
264
|
+
grid-row: auto;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.cpRadio__description {
|
|
268
|
+
grid-column: auto;
|
|
269
|
+
grid-row: auto;
|
|
270
|
+
min-width: 0;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.cpRadio__additionalData {
|
|
274
|
+
grid-column: auto;
|
|
275
|
+
grid-row: auto;
|
|
276
|
+
text-align: right;
|
|
277
|
+
margin-left: var(--cp-spacing-xl);
|
|
278
|
+
}
|
|
248
279
|
}
|
|
249
280
|
}
|
|
250
281
|
</style>
|