@citizenplane/pimp 11.0.4 → 12.0.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 +3573 -3573
- package/dist/pimp.umd.js +44 -44
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/CpBadge.vue +1 -1
- package/src/components/CpButton.vue +193 -179
- package/src/components/CpCheckbox.vue +2 -2
- package/src/components/CpLoader.vue +1 -1
- package/src/components/CpMultiselect.vue +1 -1
- package/src/components/CpRadio.vue +2 -2
- package/src/components/CpSwitch.vue +2 -2
- package/src/components/CpTooltip.vue +2 -2
- package/src/constants/Button.ts +3 -14
- package/src/constants/colors/Colors.ts +16 -20
- package/src/constants/colors/ToggleColors.ts +2 -5
- package/src/constants/index.ts +2 -2
- package/src/stories/CpBadge.stories.ts +3 -3
- package/src/stories/CpButton.stories.ts +421 -72
- package/src/stories/CpLoader.stories.ts +1 -3
package/package.json
CHANGED
|
@@ -11,11 +11,15 @@
|
|
|
11
11
|
@click="handleClick"
|
|
12
12
|
>
|
|
13
13
|
<span class="cpButton__body">
|
|
14
|
-
<span v-if="isLoading" class="cpButton__loader"
|
|
14
|
+
<span v-if="isLoading" class="cpButton__loader">
|
|
15
|
+
<cp-loader color="neutral" />
|
|
16
|
+
</span>
|
|
15
17
|
<span v-if="hasIconBefore" class="cpButton__icon cpButton__icon--isBefore">
|
|
16
18
|
<slot name="leading-icon" />
|
|
17
19
|
</span>
|
|
18
|
-
<span v-if="hasLabel"
|
|
20
|
+
<span v-if="hasLabel" class="cpButton__label">
|
|
21
|
+
<slot />
|
|
22
|
+
</span>
|
|
19
23
|
<span v-if="hasIconAfter" class="cpButton__icon cpButton__icon--isAfter">
|
|
20
24
|
<slot name="trailing-icon" />
|
|
21
25
|
</span>
|
|
@@ -35,23 +39,25 @@ import CpLoader from '@/components/CpLoader.vue'
|
|
|
35
39
|
import { Colors, Sizes } from '@/constants'
|
|
36
40
|
import { capitalizeFirstLetter } from '@/helpers'
|
|
37
41
|
|
|
42
|
+
type ButtonColor = Extract<Colors, 'neutral' | 'accent' | 'error' | 'warning' | 'success'>
|
|
43
|
+
|
|
38
44
|
interface Props {
|
|
39
45
|
appearance?: ButtonAppearances
|
|
40
|
-
color?:
|
|
46
|
+
color?: ButtonColor
|
|
41
47
|
disabled?: boolean
|
|
42
48
|
enableHaptics?: boolean
|
|
43
49
|
isLoading?: boolean
|
|
44
50
|
isSquare?: boolean
|
|
45
|
-
size?: Sizes
|
|
51
|
+
size?: Exclude<Sizes, Sizes.XXL | Sizes.XXXL | Sizes.XXXXL>
|
|
46
52
|
tag?: ButtonTags
|
|
47
53
|
type?: ButtonTypes
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
const props = withDefaults(defineProps<Props>(), {
|
|
51
|
-
appearance:
|
|
52
|
-
color:
|
|
53
|
-
tag:
|
|
54
|
-
type:
|
|
57
|
+
appearance: 'primary',
|
|
58
|
+
color: 'neutral',
|
|
59
|
+
tag: 'button',
|
|
60
|
+
type: 'button',
|
|
55
61
|
size: Sizes.MD,
|
|
56
62
|
})
|
|
57
63
|
|
|
@@ -92,89 +98,76 @@ const handleClick = () => {
|
|
|
92
98
|
</script>
|
|
93
99
|
|
|
94
100
|
<style lang="scss">
|
|
95
|
-
@mixin cp-button-
|
|
96
|
-
&--
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
0 0 0 var(--cp-dimensions-0_25) $textColorHover;
|
|
113
|
-
color: $textColorHover;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
&:focus,
|
|
117
|
-
&:focus-visible {
|
|
118
|
-
outline: fn.px-to-rem(2) solid $textColorHover;
|
|
119
|
-
outline-offset: fn.px-to-rem(3);
|
|
101
|
+
@mixin cp-button-primary($className, $color, $backgroundColor, $hoverBackgroundColor) {
|
|
102
|
+
&--isPrimary#{&}--is#{$className} {
|
|
103
|
+
&:not(:disabled) {
|
|
104
|
+
background-color: $backgroundColor;
|
|
105
|
+
color: $color;
|
|
106
|
+
box-shadow: var(--cp-shadows-3xs);
|
|
107
|
+
|
|
108
|
+
&:hover {
|
|
109
|
+
background-color: $hoverBackgroundColor;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&:focus,
|
|
113
|
+
&:focus-visible,
|
|
114
|
+
&:active {
|
|
115
|
+
background-color: $hoverBackgroundColor;
|
|
116
|
+
outline: fn.px-to-rem(2) solid $hoverBackgroundColor;
|
|
117
|
+
}
|
|
120
118
|
}
|
|
121
119
|
}
|
|
122
120
|
}
|
|
123
121
|
|
|
124
|
-
@mixin cp-button-
|
|
125
|
-
&--
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
122
|
+
@mixin cp-button-secondary($className, $color) {
|
|
123
|
+
&--isSecondary#{&}--is#{$className} {
|
|
124
|
+
&:not(:disabled) {
|
|
125
|
+
background-color: var(--cp-background-primary);
|
|
126
|
+
border: fn.px-to-rem(1) solid var(--cp-border-soft);
|
|
127
|
+
color: $color;
|
|
128
|
+
box-shadow: var(--cp-shadows-3xs);
|
|
129
|
+
|
|
130
|
+
&:hover {
|
|
131
|
+
background-color: var(--cp-background-primary-hover);
|
|
132
|
+
border-color: var(--cp-border-soft-hover);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&:focus,
|
|
136
|
+
&:focus-visible,
|
|
137
|
+
&:active {
|
|
138
|
+
background-color: var(--cp-background-primary-hover);
|
|
139
|
+
outline: fn.px-to-rem(2) solid var(--cp-background-primary-hover);
|
|
140
|
+
}
|
|
138
141
|
}
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
|
|
142
|
-
@mixin cp-button-tertiary($className, $
|
|
143
|
-
&--
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
outline: fn.px-to-rem(2) solid $textColor;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
&:active {
|
|
163
|
-
background: $hoverColor;
|
|
164
|
-
color: $textColor;
|
|
145
|
+
@mixin cp-button-tertiary($className, $color, $hoverColor, $hoverBackgroundColor) {
|
|
146
|
+
&--isTertiary#{&}--is#{$className} {
|
|
147
|
+
&:not(:disabled) {
|
|
148
|
+
background-color: transparent;
|
|
149
|
+
color: $color;
|
|
150
|
+
|
|
151
|
+
&:hover {
|
|
152
|
+
background-color: $hoverBackgroundColor;
|
|
153
|
+
color: $hoverColor;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&:focus,
|
|
157
|
+
&:focus-visible,
|
|
158
|
+
&:active {
|
|
159
|
+
color: $hoverColor;
|
|
160
|
+
outline: fn.px-to-rem(2) solid $color;
|
|
161
|
+
}
|
|
165
162
|
}
|
|
166
163
|
}
|
|
167
164
|
}
|
|
168
165
|
|
|
169
166
|
.cpButton {
|
|
170
|
-
border-radius:
|
|
171
|
-
background-color: var(--cp-background-primary);
|
|
167
|
+
border-radius: var(--cp-radius-full);
|
|
172
168
|
padding: var(--cp-spacing-md) var(--cp-spacing-lg);
|
|
173
|
-
|
|
174
|
-
box-shadow: var(--cp-shadows-3xs);
|
|
175
|
-
line-height: var(--cp-line-height-md); /* 150% */
|
|
169
|
+
line-height: var(--cp-line-height-md);
|
|
176
170
|
text-decoration: none;
|
|
177
|
-
color: var(--cp-text-primary);
|
|
178
171
|
font-weight: 500;
|
|
179
172
|
transition-property: box-shadow, background-color, transform, width;
|
|
180
173
|
transition-duration: 150ms;
|
|
@@ -187,37 +180,6 @@ const handleClick = () => {
|
|
|
187
180
|
color: var(--cp-text-primary);
|
|
188
181
|
}
|
|
189
182
|
|
|
190
|
-
&--isDefault,
|
|
191
|
-
&--isPrimary,
|
|
192
|
-
&--isMinimal {
|
|
193
|
-
&:hover {
|
|
194
|
-
background-color: var(--cp-background-primary-hover);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
&:focus {
|
|
198
|
-
outline: fn.px-to-rem(2) solid var(--cp-border-strong);
|
|
199
|
-
box-shadow: none;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
&--isDefault {
|
|
204
|
-
box-shadow: 0 0 0 fn.px-to-rem(1) var(--cp-border-soft);
|
|
205
|
-
|
|
206
|
-
&:hover {
|
|
207
|
-
box-shadow: 0 0 0 fn.px-to-rem(1) var(--cp-border-soft-hover);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
&:focus {
|
|
211
|
-
outline: fn.px-to-rem(2) solid var(--cp-border-strong);
|
|
212
|
-
box-shadow: none;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
&--isMinimal {
|
|
217
|
-
background-color: transparent;
|
|
218
|
-
box-shadow: none;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
183
|
&,
|
|
222
184
|
&__body {
|
|
223
185
|
display: inline-flex;
|
|
@@ -233,48 +195,90 @@ const handleClick = () => {
|
|
|
233
195
|
transform: translateY(fn.px-to-rem(1));
|
|
234
196
|
}
|
|
235
197
|
|
|
236
|
-
//
|
|
237
|
-
@include cp-button-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
@include cp-button-
|
|
198
|
+
// Primary appearance
|
|
199
|
+
@include cp-button-primary(
|
|
200
|
+
'Neutral',
|
|
201
|
+
var(--cp-text-primary),
|
|
202
|
+
var(--cp-background-primary),
|
|
203
|
+
var(--cp-background-primary-hover)
|
|
204
|
+
);
|
|
205
|
+
@include cp-button-primary(
|
|
206
|
+
'Accent',
|
|
207
|
+
var(--cp-text-white),
|
|
208
|
+
var(--cp-background-accent-solid),
|
|
209
|
+
var(--cp-background-accent-solid-hover)
|
|
210
|
+
);
|
|
211
|
+
@include cp-button-primary(
|
|
212
|
+
'Success',
|
|
213
|
+
var(--cp-text-white),
|
|
214
|
+
var(--cp-background-success-solid),
|
|
215
|
+
var(--cp-background-success-solid-hover)
|
|
216
|
+
);
|
|
217
|
+
@include cp-button-primary(
|
|
218
|
+
'Warning',
|
|
219
|
+
var(--cp-text-white),
|
|
220
|
+
var(--cp-background-warning-solid),
|
|
221
|
+
var(--cp-background-warning-solid-hover)
|
|
222
|
+
);
|
|
223
|
+
@include cp-button-primary(
|
|
224
|
+
'Error',
|
|
225
|
+
var(--cp-text-white),
|
|
226
|
+
var(--cp-background-error-solid),
|
|
227
|
+
var(--cp-background-error-solid-hover)
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
// Secondary appearance
|
|
231
|
+
@include cp-button-secondary('Neutral', var(--cp-text-primary));
|
|
232
|
+
@include cp-button-secondary('Accent', var(--cp-text-accent-primary));
|
|
233
|
+
@include cp-button-secondary('Success', var(--cp-text-success-primary));
|
|
234
|
+
@include cp-button-secondary('Warning', var(--cp-text-warning-primary));
|
|
235
|
+
@include cp-button-secondary('Error', var(--cp-text-error-primary));
|
|
236
|
+
|
|
237
|
+
// Tertiary appearance
|
|
238
|
+
@include cp-button-tertiary(
|
|
239
|
+
'Neutral',
|
|
240
|
+
var(--cp-text-primary),
|
|
241
|
+
var(--cp-text-primary-hover),
|
|
242
|
+
var(--cp-background-primary-hover)
|
|
243
|
+
);
|
|
244
|
+
@include cp-button-tertiary(
|
|
245
|
+
'Accent',
|
|
246
|
+
var(--cp-text-accent-primary),
|
|
247
|
+
var(--cp-text-accent-primary-hover),
|
|
248
|
+
var(--cp-background-accent-primary-hover)
|
|
249
|
+
);
|
|
250
|
+
@include cp-button-tertiary(
|
|
251
|
+
'Success',
|
|
252
|
+
var(--cp-text-success-primary),
|
|
253
|
+
var(--cp-text-success-primary-hover),
|
|
254
|
+
var(--cp-background-success-primary-hover)
|
|
255
|
+
);
|
|
256
|
+
@include cp-button-tertiary(
|
|
257
|
+
'Warning',
|
|
258
|
+
var(--cp-text-warning-primary),
|
|
259
|
+
var(--cp-text-warning-primary-hover),
|
|
260
|
+
var(--cp-background-warning-primary-hover)
|
|
261
|
+
);
|
|
262
|
+
@include cp-button-tertiary(
|
|
263
|
+
'Error',
|
|
264
|
+
var(--cp-text-error-primary),
|
|
265
|
+
var(--cp-text-error-primary-hover),
|
|
266
|
+
var(--cp-background-error-primary-hover)
|
|
267
|
+
);
|
|
256
268
|
|
|
257
269
|
&--isDisabled {
|
|
258
|
-
box-shadow: none
|
|
259
|
-
background-color: var(--cp-background-disabled)
|
|
260
|
-
color: var(--cp-text-disabled)
|
|
261
|
-
cursor: not-allowed !important;
|
|
270
|
+
box-shadow: none;
|
|
271
|
+
background-color: var(--cp-background-disabled);
|
|
272
|
+
color: var(--cp-text-disabled);
|
|
262
273
|
user-select: none;
|
|
263
274
|
|
|
264
275
|
&:hover,
|
|
265
276
|
&:active {
|
|
277
|
+
cursor: not-allowed;
|
|
266
278
|
transform: none;
|
|
267
279
|
}
|
|
268
280
|
}
|
|
269
281
|
|
|
270
|
-
&--isIcon {
|
|
271
|
-
padding: fn.px-to-rem(10);
|
|
272
|
-
|
|
273
|
-
.cpButton__icon {
|
|
274
|
-
@include mx.square-sizing(20);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
282
|
&__body {
|
|
279
283
|
display: flex;
|
|
280
284
|
align-items: center;
|
|
@@ -284,6 +288,10 @@ const handleClick = () => {
|
|
|
284
288
|
transition: padding-left 250ms var(--cp-easing-elastic);
|
|
285
289
|
}
|
|
286
290
|
|
|
291
|
+
&__label {
|
|
292
|
+
padding-inline: var(--cp-spacing-xs);
|
|
293
|
+
}
|
|
294
|
+
|
|
287
295
|
&__icon,
|
|
288
296
|
&__loader {
|
|
289
297
|
display: flex;
|
|
@@ -299,8 +307,6 @@ const handleClick = () => {
|
|
|
299
307
|
}
|
|
300
308
|
|
|
301
309
|
&__icon {
|
|
302
|
-
@include mx.square-sizing(20);
|
|
303
|
-
|
|
304
310
|
flex-shrink: 0;
|
|
305
311
|
}
|
|
306
312
|
|
|
@@ -318,77 +324,85 @@ const handleClick = () => {
|
|
|
318
324
|
}
|
|
319
325
|
|
|
320
326
|
&--isSquare {
|
|
321
|
-
|
|
327
|
+
&.cpButton--2xs {
|
|
328
|
+
border-radius: var(--cp-radius-sm-md);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
&.cpButton--xs,
|
|
332
|
+
&.cpButton--sm,
|
|
333
|
+
&.cpButton--md {
|
|
334
|
+
border-radius: var(--cp-radius-md);
|
|
335
|
+
}
|
|
322
336
|
|
|
323
337
|
&.cpButton--lg {
|
|
324
338
|
border-radius: var(--cp-radius-md-lg);
|
|
325
339
|
}
|
|
340
|
+
}
|
|
326
341
|
|
|
327
|
-
|
|
328
|
-
|
|
342
|
+
&--2xs,
|
|
343
|
+
&--xs,
|
|
344
|
+
&--sm {
|
|
345
|
+
.cpButton__icon,
|
|
346
|
+
.cpButton__loader {
|
|
347
|
+
@include mx.square-sizing(16);
|
|
329
348
|
}
|
|
330
349
|
}
|
|
331
350
|
|
|
351
|
+
&--md,
|
|
332
352
|
&--lg {
|
|
333
|
-
padding: var(--cp-spacing-lg) var(--cp-spacing-xl);
|
|
334
|
-
font-size: var(--cp-text-size-md);
|
|
335
|
-
line-height: var(--cp-line-height-md); /* 150% */
|
|
336
|
-
|
|
337
|
-
&.cpButton--isIcon {
|
|
338
|
-
padding: var(--cp-spacing-lg);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
353
|
.cpButton__icon,
|
|
342
354
|
.cpButton__loader {
|
|
343
|
-
@include mx.square-sizing(
|
|
355
|
+
@include mx.square-sizing(20);
|
|
344
356
|
}
|
|
345
357
|
}
|
|
346
358
|
|
|
347
|
-
&--
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
359
|
+
&--2xs {
|
|
360
|
+
font-size: var(--cp-text-size-xs);
|
|
361
|
+
padding: var(--cp-spacing-sm) var(--cp-spacing-md);
|
|
362
|
+
line-height: var(--cp-line-height-xs);
|
|
352
363
|
|
|
353
364
|
&.cpButton--isIcon {
|
|
354
|
-
padding: var(--cp-spacing-sm
|
|
365
|
+
padding: var(--cp-spacing-sm);
|
|
355
366
|
}
|
|
356
367
|
}
|
|
357
368
|
|
|
358
|
-
&--
|
|
359
|
-
padding: var(--cp-spacing-sm-md) var(--cp-spacing-md);
|
|
369
|
+
&--xs {
|
|
360
370
|
font-size: var(--cp-text-size-sm);
|
|
361
|
-
|
|
371
|
+
padding: var(--cp-spacing-sm) var(--cp-spacing-md);
|
|
372
|
+
line-height: var(--cp-line-height-sm);
|
|
362
373
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
@include mx.square-sizing(20);
|
|
374
|
+
&.cpButton--isIcon {
|
|
375
|
+
padding: var(--cp-spacing-sm-md);
|
|
366
376
|
}
|
|
367
377
|
}
|
|
368
378
|
|
|
369
|
-
&--
|
|
379
|
+
&--sm {
|
|
370
380
|
font-size: var(--cp-text-size-sm);
|
|
371
|
-
padding: var(--cp-spacing-sm) var(--cp-spacing-md);
|
|
381
|
+
padding: var(--cp-spacing-sm-md) var(--cp-spacing-md);
|
|
372
382
|
line-height: var(--cp-line-height-sm);
|
|
373
383
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
@include mx.square-sizing(16);
|
|
384
|
+
&.cpButton--isIcon {
|
|
385
|
+
padding: var(--cp-spacing-md);
|
|
377
386
|
}
|
|
378
387
|
}
|
|
379
388
|
|
|
380
|
-
&--
|
|
381
|
-
font-size: var(--cp-text-size-
|
|
382
|
-
padding: var(--cp-spacing-
|
|
383
|
-
line-height: var(--cp-line-height-
|
|
389
|
+
&--md {
|
|
390
|
+
font-size: var(--cp-text-size-md);
|
|
391
|
+
padding: var(--cp-spacing-md) var(--cp-spacing-lg);
|
|
392
|
+
line-height: var(--cp-line-height-md);
|
|
384
393
|
|
|
385
|
-
|
|
386
|
-
|
|
394
|
+
&.cpButton--isIcon {
|
|
395
|
+
padding: fn.px-to-rem(10);
|
|
387
396
|
}
|
|
397
|
+
}
|
|
388
398
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
399
|
+
&--lg {
|
|
400
|
+
font-size: var(--cp-text-size-md);
|
|
401
|
+
padding: var(--cp-spacing-lg) var(--cp-spacing-xl);
|
|
402
|
+
line-height: var(--cp-line-height-md);
|
|
403
|
+
|
|
404
|
+
&.cpButton--isIcon {
|
|
405
|
+
padding: fn.px-to-rem(14);
|
|
392
406
|
}
|
|
393
407
|
}
|
|
394
408
|
}
|
|
@@ -41,7 +41,7 @@ interface Props {
|
|
|
41
41
|
autofocus?: boolean
|
|
42
42
|
checkboxLabel?: string
|
|
43
43
|
checkboxValue?: string | number
|
|
44
|
-
color?:
|
|
44
|
+
color?: ToggleColors
|
|
45
45
|
groupName?: string
|
|
46
46
|
helper?: string
|
|
47
47
|
indeterminate?: boolean
|
|
@@ -55,7 +55,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
55
55
|
checkboxValue: '',
|
|
56
56
|
checkboxLabel: '',
|
|
57
57
|
groupName: '',
|
|
58
|
-
color:
|
|
58
|
+
color: 'accent',
|
|
59
59
|
helper: '',
|
|
60
60
|
})
|
|
61
61
|
|
|
@@ -46,7 +46,7 @@ interface Props {
|
|
|
46
46
|
size?: number | string
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const props = withDefaults(defineProps<Props>(), { color:
|
|
49
|
+
const props = withDefaults(defineProps<Props>(), { color: 'accent', size: 24 })
|
|
50
50
|
|
|
51
51
|
const capitalizedColor = computed(() => capitalizeFirstLetter(props.color))
|
|
52
52
|
|
|
@@ -326,7 +326,7 @@ onMounted(() => overrideAlignOverlay())
|
|
|
326
326
|
justify-content: space-between;
|
|
327
327
|
padding: var(--cp-spacing-md) var(--cp-spacing-xl);
|
|
328
328
|
box-shadow:
|
|
329
|
-
var(--cp-shadows-3xs),
|
|
329
|
+
var(--cp-shadows-3xs-inset),
|
|
330
330
|
0 0 0 var(--cp-dimensions-0_25) var(--cp-border-soft);
|
|
331
331
|
border-radius: var(--cp-radius-md);
|
|
332
332
|
gap: var(--cp-spacing-md);
|
|
@@ -44,7 +44,7 @@ interface RadioOption {
|
|
|
44
44
|
|
|
45
45
|
interface Props {
|
|
46
46
|
autofocus?: boolean
|
|
47
|
-
color?:
|
|
47
|
+
color?: ToggleColors
|
|
48
48
|
groupName?: string
|
|
49
49
|
modelValue: string
|
|
50
50
|
options: RadioOption[]
|
|
@@ -56,7 +56,7 @@ interface Emits {
|
|
|
56
56
|
|
|
57
57
|
const props = withDefaults(defineProps<Props>(), {
|
|
58
58
|
groupName: '',
|
|
59
|
-
color:
|
|
59
|
+
color: 'blue',
|
|
60
60
|
autofocus: false,
|
|
61
61
|
})
|
|
62
62
|
|
|
@@ -41,7 +41,7 @@ import { capitalizeFirstLetter } from '@/helpers'
|
|
|
41
41
|
|
|
42
42
|
interface Props {
|
|
43
43
|
autofocus?: boolean
|
|
44
|
-
color?:
|
|
44
|
+
color?: ToggleColors
|
|
45
45
|
disabled?: boolean
|
|
46
46
|
enableHaptics?: boolean
|
|
47
47
|
groupName?: string
|
|
@@ -63,7 +63,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
63
63
|
helper: '',
|
|
64
64
|
disabled: false,
|
|
65
65
|
groupName: '',
|
|
66
|
-
color:
|
|
66
|
+
color: 'purple',
|
|
67
67
|
reverseLabel: false,
|
|
68
68
|
autofocus: false,
|
|
69
69
|
isRequired: false,
|
|
@@ -40,7 +40,7 @@ import { useId, useSlots, computed } from 'vue'
|
|
|
40
40
|
import { Colors } from '@/constants'
|
|
41
41
|
import { capitalizeFirstLetter } from '@/helpers'
|
|
42
42
|
|
|
43
|
-
type TooltipColors = Colors
|
|
43
|
+
type TooltipColors = Extract<Colors, 'accent' | 'neutral'>
|
|
44
44
|
type Placement = 'top' | 'right' | 'bottom' | 'left'
|
|
45
45
|
|
|
46
46
|
interface Props {
|
|
@@ -55,7 +55,7 @@ interface Props {
|
|
|
55
55
|
const props = withDefaults(defineProps<Props>(), {
|
|
56
56
|
content: '',
|
|
57
57
|
distance: 8,
|
|
58
|
-
color:
|
|
58
|
+
color: 'accent',
|
|
59
59
|
placement: undefined,
|
|
60
60
|
subcontent: '',
|
|
61
61
|
})
|
package/src/constants/Button.ts
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
DEFAULT = 'default',
|
|
3
|
-
PRIMARY = 'primary',
|
|
4
|
-
MINIMAL = 'minimal',
|
|
5
|
-
}
|
|
1
|
+
export type ButtonAppearances = 'primary' | 'secondary' | 'tertiary'
|
|
6
2
|
|
|
7
|
-
export
|
|
8
|
-
BUTTON = 'button',
|
|
9
|
-
A = 'a',
|
|
10
|
-
}
|
|
3
|
+
export type ButtonTags = 'button' | 'a'
|
|
11
4
|
|
|
12
|
-
export
|
|
13
|
-
BUTTON = 'button',
|
|
14
|
-
SUBMIT = 'submit',
|
|
15
|
-
RESET = 'reset',
|
|
16
|
-
}
|
|
5
|
+
export type ButtonTypes = 'button' | 'submit' | 'reset'
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
ORANGE = 'orange', // TODO: Should be replace by WARNING
|
|
18
|
-
PURPLE = 'purple', // TODO: Should be replace by ACCENT
|
|
19
|
-
RED = 'red', // TODO: Should be replace by ERROR
|
|
20
|
-
}
|
|
1
|
+
export type Colors =
|
|
2
|
+
| 'neutral'
|
|
3
|
+
| 'accent'
|
|
4
|
+
| 'error'
|
|
5
|
+
| 'warning'
|
|
6
|
+
| 'success'
|
|
7
|
+
| 'blue'
|
|
8
|
+
| 'pink'
|
|
9
|
+
| 'magenta'
|
|
10
|
+
| 'yellow'
|
|
11
|
+
| 'white'
|
|
12
|
+
| 'gray' // TODO: Should be replace by NEUTRAL
|
|
13
|
+
| 'green' // TODO: Should be replace by SUCCESS
|
|
14
|
+
| 'orange' // TODO: Should be replace by WARNING
|
|
15
|
+
| 'purple' // TODO: Should be replace by ACCENT
|
|
16
|
+
| 'red' // TODO: Should be replace by ERROR
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { Colors } from './Colors'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
BLUE = Colors.BLUE,
|
|
6
|
-
PURPLE = Colors.PURPLE, // TODO: Should be replace by ACCENT
|
|
7
|
-
}
|
|
3
|
+
// TODO: purple should be replace by ACCENT
|
|
4
|
+
export type ToggleColors = Extract<Colors, 'accent' | 'blue' | 'purple'>
|