@youcan/celeste 0.6.48 → 0.6.50
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/celeste.css +333 -120
- package/dist/cjs/chunks/counter-input.vue_vue_type_style_index_0_lang.js +70 -0
- package/dist/cjs/chunks/index.js +684 -0
- package/dist/cjs/counter-input.js +3 -0
- package/dist/cjs/index.js +9 -0
- package/dist/cjs/modal-header.js +1 -1
- package/dist/cjs/popover-content.js +5 -8
- package/dist/cjs/radio-group-card.js +110 -0
- package/dist/cjs/radio-group-label.js +109 -0
- package/dist/components/counter-input/counter-input.d.ts +17 -0
- package/dist/components/counter-input/index.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/radio-group/index.d.ts +4 -0
- package/dist/components/radio-group/radio-group-card.d.ts +34 -0
- package/dist/components/radio-group/radio-group-label.d.ts +29 -0
- package/dist/es/button.js +1 -1
- package/dist/es/checkbox-card.js +1 -1
- package/dist/es/checkbox-label.js +1 -1
- package/dist/es/chunks/counter-input.vue_vue_type_style_index_0_lang.js +71 -0
- package/dist/es/chunks/index.js +754 -70
- package/dist/es/chunks/index3.js +1 -1
- package/dist/es/chunks/radio-group-item.vue_vue_type_style_index_0_lang.js +1 -1
- package/dist/es/chunks/switch.vue_vue_type_style_index_0_lang.js +1 -1
- package/dist/es/combobox-group.js +1 -1
- package/dist/es/combobox-input.js +1 -1
- package/dist/es/combobox-item.js +1 -1
- package/dist/es/combobox-list.js +1 -1
- package/dist/es/combobox-root.js +1 -1
- package/dist/es/combobox-separator.js +1 -1
- package/dist/es/combobox-trigger.js +1 -1
- package/dist/es/command-group.js +1 -1
- package/dist/es/command-input.js +1 -1
- package/dist/es/command-item.js +1 -1
- package/dist/es/command-list.js +1 -1
- package/dist/es/command-root.js +1 -1
- package/dist/es/command-separator.js +1 -1
- package/dist/es/compact-button.js +1 -1
- package/dist/es/context-menu-item.js +1 -1
- package/dist/es/counter-input.js +4 -0
- package/dist/es/digit-input-group.js +1 -1
- package/dist/es/digit-input-slot.js +1 -1
- package/dist/es/digit-input.js +1 -1
- package/dist/es/dropdown-menu-content.js +1 -1
- package/dist/es/dropdown-menu-group.js +1 -1
- package/dist/es/dropdown-menu-item.js +1 -1
- package/dist/es/dropdown-menu-label.js +1 -1
- package/dist/es/dropdown-menu-separator.js +1 -1
- package/dist/es/dropdown-menu-sub-content.js +1 -1
- package/dist/es/dropdown-menu-sub-trigger.js +1 -1
- package/dist/es/dropdown-menu-trigger.js +1 -1
- package/dist/es/dropdown-menu.js +1 -1
- package/dist/es/dropdown.js +1 -1
- package/dist/es/fancy-button.js +1 -1
- package/dist/es/index.js +48 -39
- package/dist/es/label.js +1 -1
- package/dist/es/link-button.js +1 -1
- package/dist/es/modal-content.js +1 -1
- package/dist/es/modal-header.js +2 -2
- package/dist/es/popover-content.js +7 -10
- package/dist/es/popover-trigger.js +1 -1
- package/dist/es/progress-bar.js +1 -1
- package/dist/es/progress-circle.js +1 -1
- package/dist/es/radio-group-card.js +111 -0
- package/dist/es/radio-group-label.js +110 -0
- package/dist/es/scroll-bar.js +1 -1
- package/dist/es/segmented-control-item.js +1 -1
- package/dist/es/segmented-control.js +1 -1
- package/dist/es/select-content.js +1 -1
- package/dist/es/select-item.js +1 -1
- package/dist/es/select-trigger.js +1 -1
- package/dist/es/select-value.js +1 -1
- package/dist/es/social-button.js +1 -1
- package/dist/es/tab-menu-content.js +1 -1
- package/dist/es/tab-menu-item.js +1 -1
- package/dist/es/tab-menu-list.js +1 -1
- package/dist/es/tab-menu.js +1 -1
- package/dist/es/tag.js +1 -1
- package/dist/es/text-input.js +1 -1
- package/dist/es/tooltip.js +1 -1
- package/package.json +3 -3
- package/src/components/counter-input/counter-input.vue +131 -0
- package/src/components/counter-input/index.ts +2 -0
- package/src/components/counter-input/stories/counter-input.stories.ts +149 -0
- package/src/components/digit-input/stories/digit-input.stories.ts +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/modal/modal-header.vue +1 -1
- package/src/components/popover/popover-content.vue +3 -7
- package/src/components/radio-group/index.ts +6 -0
- package/src/components/radio-group/radio-group-card.vue +221 -0
- package/src/components/radio-group/radio-group-label.vue +108 -0
- package/src/components/radio-group/stories/radio-group-card.stories.ts +297 -0
- package/src/components/radio-group/stories/radio-group.stories.ts +25 -15
- package/src/components/text-input/stories/text-input.stories.ts +1 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import CounterInput from '../counter-input.vue';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof CounterInput> = {
|
|
5
|
+
title: 'Components/Input/Counter Input',
|
|
6
|
+
component: CounterInput,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default meta;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof CounterInput>;
|
|
12
|
+
|
|
13
|
+
export const Default: Story = {
|
|
14
|
+
args: {
|
|
15
|
+
defaultValue: 5,
|
|
16
|
+
max: 10,
|
|
17
|
+
min: 0,
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
render: args => ({
|
|
21
|
+
components: { CounterInput },
|
|
22
|
+
setup() {
|
|
23
|
+
return { args };
|
|
24
|
+
},
|
|
25
|
+
template: `
|
|
26
|
+
<CounterInput v-bind="args" />
|
|
27
|
+
`,
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const Size: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
defaultValue: 5,
|
|
34
|
+
max: 10,
|
|
35
|
+
min: 0,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
render: args => ({
|
|
39
|
+
components: { CounterInput },
|
|
40
|
+
setup() {
|
|
41
|
+
return { args };
|
|
42
|
+
},
|
|
43
|
+
template: `
|
|
44
|
+
<div style="display: grid; gap: 12px;">
|
|
45
|
+
<CounterInput v-bind="args" size="md" />
|
|
46
|
+
<CounterInput v-bind="args" size="sm" />
|
|
47
|
+
<CounterInput v-bind="args" size="xs" />
|
|
48
|
+
</div>
|
|
49
|
+
`,
|
|
50
|
+
}),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const Disabled: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
defaultValue: 0,
|
|
56
|
+
max: 10,
|
|
57
|
+
disabled: true,
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
render: args => ({
|
|
61
|
+
components: { CounterInput },
|
|
62
|
+
setup() {
|
|
63
|
+
return { args };
|
|
64
|
+
},
|
|
65
|
+
template: `
|
|
66
|
+
<CounterInput v-bind="args" />
|
|
67
|
+
`,
|
|
68
|
+
}),
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const hasError: Story = {
|
|
72
|
+
args: {
|
|
73
|
+
defaultValue: 5,
|
|
74
|
+
max: 10,
|
|
75
|
+
hasError: true,
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
render: args => ({
|
|
79
|
+
components: { CounterInput },
|
|
80
|
+
setup() {
|
|
81
|
+
return { args };
|
|
82
|
+
},
|
|
83
|
+
template: `
|
|
84
|
+
<CounterInput v-bind="args" />
|
|
85
|
+
`,
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const Decimal: Story = {
|
|
90
|
+
args: {
|
|
91
|
+
defaultValue: 5,
|
|
92
|
+
formatOptions: {
|
|
93
|
+
signDisplay: 'negative',
|
|
94
|
+
minimumFractionDigits: 1,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
render: args => ({
|
|
99
|
+
components: { CounterInput },
|
|
100
|
+
setup() {
|
|
101
|
+
return { args };
|
|
102
|
+
},
|
|
103
|
+
template: `
|
|
104
|
+
<CounterInput v-bind="args" />
|
|
105
|
+
`,
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const Percentage: Story = {
|
|
110
|
+
args: {
|
|
111
|
+
defaultValue: 0.05,
|
|
112
|
+
step: 0.01,
|
|
113
|
+
formatOptions: {
|
|
114
|
+
style: 'percent',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
render: args => ({
|
|
119
|
+
components: { CounterInput },
|
|
120
|
+
setup() {
|
|
121
|
+
return { args };
|
|
122
|
+
},
|
|
123
|
+
template: `
|
|
124
|
+
<CounterInput v-bind="args" />
|
|
125
|
+
`,
|
|
126
|
+
}),
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const Currency: Story = {
|
|
130
|
+
args: {
|
|
131
|
+
defaultValue: 5,
|
|
132
|
+
formatOptions: {
|
|
133
|
+
style: 'currency',
|
|
134
|
+
currency: 'MAD',
|
|
135
|
+
currencyDisplay: 'code',
|
|
136
|
+
currencySign: 'accounting',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
render: args => ({
|
|
141
|
+
components: { CounterInput },
|
|
142
|
+
setup() {
|
|
143
|
+
return { args };
|
|
144
|
+
},
|
|
145
|
+
template: `
|
|
146
|
+
<CounterInput v-bind="args" />
|
|
147
|
+
`,
|
|
148
|
+
}),
|
|
149
|
+
};
|
|
@@ -5,7 +5,7 @@ import DigitInputSlot from '../digit-input-slot.vue';
|
|
|
5
5
|
import DigitInput from '../digit-input.vue';
|
|
6
6
|
|
|
7
7
|
const meta: Meta<typeof DigitInput> = {
|
|
8
|
-
title: 'Components/
|
|
8
|
+
title: 'Components/Input/Digit Input',
|
|
9
9
|
component: DigitInput,
|
|
10
10
|
argTypes: {
|
|
11
11
|
modelValue: {
|
package/src/components/index.ts
CHANGED
|
@@ -57,7 +57,7 @@ const props = withDefaults(defineProps<{
|
|
|
57
57
|
|
|
58
58
|
display: flex;
|
|
59
59
|
gap: var(--spacing-14);
|
|
60
|
-
align-items:
|
|
60
|
+
align-items: flex-start;
|
|
61
61
|
justify-content: space-between;
|
|
62
62
|
padding: var(--spacing-16);
|
|
63
63
|
border-block-end: 1px solid var(--color-stroke-soft-200);
|
|
@@ -56,15 +56,10 @@ export interface PopoverContentProps {
|
|
|
56
56
|
<PopoverContent
|
|
57
57
|
v-bind="{ ...forwarded, ...$attrs }"
|
|
58
58
|
:side-offset="sideOffset"
|
|
59
|
-
|
|
60
|
-
clsx(
|
|
61
|
-
'celeste-popover-content-wrapper',
|
|
62
|
-
props.class,
|
|
63
|
-
)
|
|
64
|
-
"
|
|
59
|
+
class="celeste-popover-content-wrapper"
|
|
65
60
|
>
|
|
66
61
|
<div
|
|
67
|
-
class="celeste-popover-content"
|
|
62
|
+
:class="clsx('celeste-popover-content', props.class)"
|
|
68
63
|
:style="{ padding: !$slots.default ? 'var(--spacing-16)' : '' }"
|
|
69
64
|
>
|
|
70
65
|
<template v-if="!$slots.default">
|
|
@@ -185,6 +180,7 @@ $icon-size-map: (
|
|
|
185
180
|
|
|
186
181
|
.celeste-popover-close-button {
|
|
187
182
|
position: absolute;
|
|
183
|
+
z-index: 50;
|
|
188
184
|
inset-inline-end: var(--spacing-16);
|
|
189
185
|
inset-block-start: var(--spacing-16);
|
|
190
186
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
export * from './radio-group-card.vue';
|
|
2
|
+
export { default as RadioGroupCard } from './radio-group-card.vue';
|
|
3
|
+
|
|
1
4
|
export * from './radio-group-item.vue';
|
|
2
5
|
export { default as RadioGroupItem } from './radio-group-item.vue';
|
|
3
6
|
|
|
7
|
+
export * from './radio-group-label.vue';
|
|
8
|
+
export { default as RadioGroupLabel } from './radio-group-label.vue';
|
|
9
|
+
|
|
4
10
|
export * from './radio-group.vue';
|
|
5
11
|
export { default as RadioGroup } from './radio-group.vue';
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { LabelProps } from 'radix-vue';
|
|
3
|
+
import type { HTMLAttributes } from 'vue';
|
|
4
|
+
import { useDelegatedProps } from '@/composables/use-delegated-props';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { Label, Primitive } from 'radix-vue';
|
|
7
|
+
|
|
8
|
+
const props = defineProps<LabelProps & {
|
|
9
|
+
required?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
class?: HTMLAttributes['class'];
|
|
12
|
+
}>();
|
|
13
|
+
|
|
14
|
+
const delegatedProps = useDelegatedProps(props, 'class');
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<Label
|
|
19
|
+
v-bind="delegatedProps"
|
|
20
|
+
:aria-required="required"
|
|
21
|
+
:aria-disabled="disabled"
|
|
22
|
+
:class="
|
|
23
|
+
clsx('celeste-radio-card', props.class, {
|
|
24
|
+
'celeste-radio-card-disabled': disabled,
|
|
25
|
+
})
|
|
26
|
+
"
|
|
27
|
+
>
|
|
28
|
+
<div
|
|
29
|
+
v-if="$slots.image || $slots.icon"
|
|
30
|
+
role="presentation"
|
|
31
|
+
class="celeste-radio-card-preview"
|
|
32
|
+
:class="[$slots.image ? 'celeste-radio-card-preview-image' : 'celeste-radio-card-preview-icon']"
|
|
33
|
+
>
|
|
34
|
+
<template v-if="$slots.image">
|
|
35
|
+
<i class="celeste-radio-card-preview-fallback" i-celeste-image-circle-fill />
|
|
36
|
+
<slot class="i-celeste-image-circle-fill?bg" name="image" />
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<template v-else-if="$slots.icon">
|
|
40
|
+
<slot name="icon" />
|
|
41
|
+
</template>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div class="celeste-radio-card-content">
|
|
45
|
+
<div role="presentation">
|
|
46
|
+
<div role="presentation" class="celeste-radio-card-row">
|
|
47
|
+
<Primitive as="span" class="celeste-radio-card-label">
|
|
48
|
+
<slot name="label" />
|
|
49
|
+
</Primitive>
|
|
50
|
+
|
|
51
|
+
<Primitive
|
|
52
|
+
v-if="$slots.sublabel"
|
|
53
|
+
as="span"
|
|
54
|
+
class="celeste-radio-card-sublabel"
|
|
55
|
+
>
|
|
56
|
+
<slot name="sublabel" />
|
|
57
|
+
</Primitive>
|
|
58
|
+
<Primitive
|
|
59
|
+
v-if="$slots.badge"
|
|
60
|
+
as-child
|
|
61
|
+
class="celeste-radio-card-badge"
|
|
62
|
+
>
|
|
63
|
+
<slot :disabled="disabled" name="badge" />
|
|
64
|
+
</Primitive>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<Primitive
|
|
69
|
+
v-if="$slots.description"
|
|
70
|
+
as="span"
|
|
71
|
+
class="celeste-radio-card-description"
|
|
72
|
+
>
|
|
73
|
+
<slot name="description" />
|
|
74
|
+
</Primitive>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<Primitive
|
|
78
|
+
:disabled="disabled"
|
|
79
|
+
as-child
|
|
80
|
+
class="celeste-radio-card-radio"
|
|
81
|
+
>
|
|
82
|
+
<slot />
|
|
83
|
+
</Primitive>
|
|
84
|
+
|
|
85
|
+
</Label>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<style lang="scss" scoped>
|
|
89
|
+
* {
|
|
90
|
+
box-sizing: border-box;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.celeste-radio-card {
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: flex-start;
|
|
96
|
+
padding: var(--spacing-16);
|
|
97
|
+
transition: all var(--animation-fast) ease-out;
|
|
98
|
+
border: 1px solid var(--color-stroke-soft-200);
|
|
99
|
+
border-radius: var(--radius-12);
|
|
100
|
+
background-color: var(--color-bg-white-0);
|
|
101
|
+
box-shadow: var(--shadow-regular-xs);
|
|
102
|
+
color: var(--color-text-strong-950);
|
|
103
|
+
font: var(--paragraph-sm);
|
|
104
|
+
gap: var(--spacing-14);
|
|
105
|
+
|
|
106
|
+
&:not(.celeste-radio-card-disabled) {
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&:has([data-state='checked']):not(.celeste-radio-card-disabled) {
|
|
111
|
+
border-color: var(--color-primary-base);
|
|
112
|
+
box-shadow: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:hover:not(.celeste-radio-card-disabled),
|
|
116
|
+
&:focus-visible:not(.celeste-radio-card-disabled) {
|
|
117
|
+
background-color: var(--color-bg-weak-50);
|
|
118
|
+
box-shadow: none;
|
|
119
|
+
|
|
120
|
+
&:not(:has([data-state='checked'])) {
|
|
121
|
+
border-color: transparent;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.celeste-radio-card-preview {
|
|
127
|
+
display: flex;
|
|
128
|
+
position: relative;
|
|
129
|
+
flex-shrink: 0;
|
|
130
|
+
align-items: center;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
width: 40px;
|
|
133
|
+
height: 40px;
|
|
134
|
+
overflow: hidden;
|
|
135
|
+
border: 1px solid var(--color-stroke-soft-200);
|
|
136
|
+
border-radius: var(--radius-full);
|
|
137
|
+
background-color: var(--color-bg-white-0);
|
|
138
|
+
box-shadow: var(--shadow-regular-xs);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.celeste-radio-card-preview-icon {
|
|
142
|
+
i {
|
|
143
|
+
width: 20px;
|
|
144
|
+
height: 20px;
|
|
145
|
+
color: var(--color-icon-sub-600);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.celeste-radio-card-preview-image {
|
|
150
|
+
border: none;
|
|
151
|
+
|
|
152
|
+
i {
|
|
153
|
+
position: absolute;
|
|
154
|
+
z-index: 0;
|
|
155
|
+
top: 50%;
|
|
156
|
+
left: 50%;
|
|
157
|
+
width: 20px;
|
|
158
|
+
height: 20px;
|
|
159
|
+
transform: translate(-50%, -50%);
|
|
160
|
+
color: var(--color-icon-sub-600);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
:deep(img) {
|
|
164
|
+
z-index: 1000;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.celeste-radio-card-content {
|
|
169
|
+
display: flex;
|
|
170
|
+
flex-direction: column;
|
|
171
|
+
gap: var(--spacing-4);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.celeste-radio-card-row {
|
|
175
|
+
display: flex;
|
|
176
|
+
flex-shrink: 1;
|
|
177
|
+
align-items: center;
|
|
178
|
+
gap: var(--spacing-8);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.celeste-radio-card-label {
|
|
182
|
+
flex-shrink: 1;
|
|
183
|
+
min-width: 0;
|
|
184
|
+
overflow: hidden;
|
|
185
|
+
color: var(--color-text-strong-950);
|
|
186
|
+
font: var(--label-sm);
|
|
187
|
+
text-overflow: ellipsis;
|
|
188
|
+
white-space: nowrap;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.celeste-radio-card-sublabel {
|
|
192
|
+
flex-shrink: 1;
|
|
193
|
+
min-width: 0;
|
|
194
|
+
overflow: hidden;
|
|
195
|
+
color: var(--color-text-sub-600);
|
|
196
|
+
font: var(--paragraph-xs);
|
|
197
|
+
text-overflow: ellipsis;
|
|
198
|
+
white-space: nowrap;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.celeste-radio-card-description {
|
|
202
|
+
color: var(--color-text-sub-600);
|
|
203
|
+
font: var(--paragraph-xs);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.celeste-radio-card-disabled {
|
|
207
|
+
cursor: not-allowed;
|
|
208
|
+
|
|
209
|
+
.celeste-radio-card-label {
|
|
210
|
+
color: var(--color-text-sub-600);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.celeste-radio-card-sublabel {
|
|
214
|
+
color: var(--color-text-soft-400);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.celeste-radio-card-description {
|
|
218
|
+
color: var(--color-text-soft-400);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
</style>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import { useDelegatedProps } from '@/composables/use-delegated-props';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { Label, type LabelProps, Primitive } from 'radix-vue';
|
|
6
|
+
|
|
7
|
+
const props = defineProps<LabelProps & {
|
|
8
|
+
required?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
class?: HTMLAttributes['class'];
|
|
11
|
+
}>();
|
|
12
|
+
|
|
13
|
+
const delegatedProps = useDelegatedProps(props, 'class');
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<Label
|
|
18
|
+
v-bind="delegatedProps"
|
|
19
|
+
:aria-required="required"
|
|
20
|
+
:aria-disabled="disabled"
|
|
21
|
+
:class="clsx('celeste-radio-label', props.class)"
|
|
22
|
+
>
|
|
23
|
+
<Primitive as-child class="celeste-radio-label-radio">
|
|
24
|
+
<slot />
|
|
25
|
+
</Primitive>
|
|
26
|
+
|
|
27
|
+
<div role="presentation">
|
|
28
|
+
<div role="presentation" class="celeste-radio-label-row">
|
|
29
|
+
<div>
|
|
30
|
+
<Primitive as="span" class="celeste-radio-label-label">
|
|
31
|
+
<slot name="label" />
|
|
32
|
+
</Primitive>
|
|
33
|
+
|
|
34
|
+
<Primitive
|
|
35
|
+
v-if="$slots.sublabel"
|
|
36
|
+
as="span"
|
|
37
|
+
class="celeste-radio-label-sublabel"
|
|
38
|
+
>
|
|
39
|
+
<slot name="sublabel" />
|
|
40
|
+
</Primitive>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<Primitive
|
|
44
|
+
v-if="$slots.badge"
|
|
45
|
+
as-child
|
|
46
|
+
class="celeste-radio-label-badge"
|
|
47
|
+
>
|
|
48
|
+
<slot name="badge" />
|
|
49
|
+
</Primitive>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div role="presentation" class="celeste-radio-label-content">
|
|
53
|
+
<Primitive
|
|
54
|
+
v-if="$slots.description"
|
|
55
|
+
as="span"
|
|
56
|
+
class="celeste-radio-label-description"
|
|
57
|
+
>
|
|
58
|
+
<slot name="description" />
|
|
59
|
+
</Primitive>
|
|
60
|
+
|
|
61
|
+
<Primitive
|
|
62
|
+
v-if="$slots.linkButton"
|
|
63
|
+
as-child
|
|
64
|
+
class="celeste-radio-label-link-button"
|
|
65
|
+
>
|
|
66
|
+
<slot name="linkButton" />
|
|
67
|
+
</Primitive>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</Label>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<style scoped lang="scss">
|
|
74
|
+
.celeste-radio-label {
|
|
75
|
+
display: flex;
|
|
76
|
+
color: var(--color-text-strong-950);
|
|
77
|
+
font: var(--paragraph-sm);
|
|
78
|
+
gap: var(--spacing-8);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:deep(.celeste-radio-label-radio) {
|
|
82
|
+
margin-top: var(--spacing-2);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.celeste-radio-label-row {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
gap: var(--spacing-8);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.celeste-radio-label-sublabel {
|
|
92
|
+
color: var(--color-text-sub-600);
|
|
93
|
+
font: var(--paragraph-xs);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.celeste-radio-label-content {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
align-items: flex-start;
|
|
100
|
+
margin-top: var(--spacing-4);
|
|
101
|
+
color: var(--color-text-sub-600);
|
|
102
|
+
font: var(--paragraph-xs);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.celeste-radio-label-link-button {
|
|
106
|
+
margin-top: var(--spacing-10);
|
|
107
|
+
}
|
|
108
|
+
</style>
|