@youcan/celeste 0.6.53 → 0.6.55
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 +874 -1348
- package/dist/cjs/chunks/index2.js +28 -0
- package/dist/cjs/color-picker.js +6 -4
- package/dist/cjs/color-swatch.js +3 -3
- package/dist/cjs/file-upload-area.js +280 -0
- package/dist/cjs/index.js +15 -9
- package/dist/components/color-picker/color-picker.d.ts +2 -0
- package/dist/components/color-picker/color-swatch.d.ts +1 -2
- package/dist/components/combobox/combobox-list.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +2 -2
- package/dist/components/file-upload/file-upload-area.d.ts +43 -0
- package/dist/components/file-upload/index.d.ts +2 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/popover/popover-content.d.ts +2 -2
- package/dist/es/chunks/index2.js +30 -2
- package/dist/es/color-picker.js +6 -4
- package/dist/es/color-swatch.js +3 -3
- package/dist/es/file-upload-area.js +281 -0
- package/dist/es/index.js +66 -60
- package/package.json +9 -9
- package/src/components/color-picker/color-picker.vue +4 -0
- package/src/components/color-picker/color-swatch.vue +1 -2
- package/src/components/file-upload/file-upload-area.vue +229 -0
- package/src/components/file-upload/index.ts +2 -0
- package/src/components/file-upload/stories/file-upload-area.stories.ts +76 -0
- package/src/components/index.ts +1 -1
- package/dist/cjs/context-menu-item.js +0 -134
- package/dist/cjs/dropdown-item.js +0 -99
- package/dist/cjs/dropdown.js +0 -290
- package/dist/components/dropdown/context-menu-item.d.ts +0 -39
- package/dist/components/dropdown/dropdown-item.d.ts +0 -30
- package/dist/components/dropdown/dropdown.d.ts +0 -55
- package/dist/components/dropdown/index.d.ts +0 -6
- package/dist/es/context-menu-item.js +0 -135
- package/dist/es/dropdown-item.js +0 -100
- package/dist/es/dropdown.js +0 -291
- package/src/components/dropdown/context-menu-item.vue +0 -317
- package/src/components/dropdown/dropdown-item.vue +0 -184
- package/src/components/dropdown/dropdown.vue +0 -650
- package/src/components/dropdown/index.ts +0 -8
- package/src/components/dropdown/stories/context-menu-item.stories.ts +0 -51
- package/src/components/dropdown/stories/dropdown-item.stories.ts +0 -33
- package/src/components/dropdown/stories/dropdown.stories.ts +0 -53
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@youcan/celeste",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.55",
|
|
5
5
|
"author": "YouCan <tech@youcan.shop>",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"youcan",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"radix-vue": "^1.9.12",
|
|
45
45
|
"tinycolor2": "^1.6.0",
|
|
46
46
|
"vue-sonner": "^2.0.2",
|
|
47
|
-
"@youcan/celeste-icons": "0.6.
|
|
48
|
-
"@youcan/celeste-tokens": "0.6.
|
|
47
|
+
"@youcan/celeste-icons": "0.6.55",
|
|
48
|
+
"@youcan/celeste-tokens": "0.6.55"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@chromatic-com/storybook": "^4.
|
|
52
|
-
"@storybook/addon-docs": "^9.
|
|
51
|
+
"@chromatic-com/storybook": "^4.1.1",
|
|
52
|
+
"@storybook/addon-docs": "^9.1.10",
|
|
53
53
|
"@storybook/addon-knobs": "^8.0.1",
|
|
54
|
-
"@storybook/addon-onboarding": "^9.
|
|
55
|
-
"@storybook/vue3-vite": "^9.
|
|
54
|
+
"@storybook/addon-onboarding": "^9.1.10",
|
|
55
|
+
"@storybook/vue3-vite": "^9.1.10",
|
|
56
56
|
"@tsconfig/node20": "^20.1.4",
|
|
57
57
|
"@types/jsdom": "^21.1.7",
|
|
58
58
|
"@types/tinycolor2": "^1.4.6",
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"@vue/tsconfig": "^0.7.0",
|
|
65
65
|
"autoprefixer": "^10.4.21",
|
|
66
66
|
"chromatic": "^11.22.1",
|
|
67
|
-
"eslint-plugin-storybook": "9.
|
|
67
|
+
"eslint-plugin-storybook": "9.1.10",
|
|
68
68
|
"glob": "^11.0.3",
|
|
69
69
|
"jsdom": "^25.0.1",
|
|
70
70
|
"postcss": "^8.5.6",
|
|
71
71
|
"postcss-nesting": "^13.0.2",
|
|
72
72
|
"rimraf": "^6.0.1",
|
|
73
73
|
"sass": "^1.83.1",
|
|
74
|
-
"storybook": "^9.
|
|
74
|
+
"storybook": "^9.1.10",
|
|
75
75
|
"unocss": "^66.3.3",
|
|
76
76
|
"vite": "^6.0.7",
|
|
77
77
|
"vite-plugin-dts": "^4.4.0",
|
|
@@ -17,6 +17,7 @@ const props = withDefaults(defineProps<ColorPickerProps>(), {
|
|
|
17
17
|
modelValue: 'hsl(240, 100%, 50%)',
|
|
18
18
|
formats: () => ['hex', 'rgb', 'hsl', 'hsb'],
|
|
19
19
|
label: 'Pick Color',
|
|
20
|
+
colorSwatchLabel: 'Recommended Colors',
|
|
20
21
|
});
|
|
21
22
|
|
|
22
23
|
const emit = defineEmits<ColorPickerEmits>();
|
|
@@ -246,6 +247,7 @@ export interface ColorPickerProps {
|
|
|
246
247
|
class?: HTMLAttributes['class'];
|
|
247
248
|
formats?: ColorFormat[];
|
|
248
249
|
defaultFormat?: ColorFormat;
|
|
250
|
+
colorSwatchLabel?: string;
|
|
249
251
|
}
|
|
250
252
|
|
|
251
253
|
export interface ColorPickerEmits {
|
|
@@ -489,6 +491,7 @@ declare global {
|
|
|
489
491
|
<ColorSwatch
|
|
490
492
|
v-else
|
|
491
493
|
v-model="tinyColorRef"
|
|
494
|
+
:label="colorSwatchLabel"
|
|
492
495
|
:hue="hueRef"
|
|
493
496
|
/>
|
|
494
497
|
</div>
|
|
@@ -507,6 +510,7 @@ declare global {
|
|
|
507
510
|
display: block;
|
|
508
511
|
width: var(--color-tile-size);
|
|
509
512
|
height: var(--color-tile-size);
|
|
513
|
+
border: 1px solid var(--color-bg-soft-200);
|
|
510
514
|
border-radius: var(--radius-4);
|
|
511
515
|
background-color: v-bind(modelValue);
|
|
512
516
|
}
|
|
@@ -5,7 +5,6 @@ import { computed } from 'vue';
|
|
|
5
5
|
import { defineColorModel } from './composable/use-color-model';
|
|
6
6
|
|
|
7
7
|
const props = withDefaults(defineProps<ColorSwatchProps>(), {
|
|
8
|
-
label: 'Recommended Colors',
|
|
9
8
|
swatch: () => DEFAULT_SWATCH,
|
|
10
9
|
});
|
|
11
10
|
const emit = defineEmits<ColorSwatchEmits>();
|
|
@@ -28,7 +27,7 @@ function isSwatchColorSelected(color: string) {
|
|
|
28
27
|
<script lang="ts">
|
|
29
28
|
export interface ColorSwatchProps {
|
|
30
29
|
modelValue: tinycolor.Instance;
|
|
31
|
-
label
|
|
30
|
+
label: string;
|
|
32
31
|
swatch?: string[];
|
|
33
32
|
defaultColor?: string;
|
|
34
33
|
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Button from '@/components/button/button.vue';
|
|
3
|
+
import { useDropZone } from '@vueuse/core';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { type InputHTMLAttributes, useTemplateRef } from 'vue';
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(defineProps<FileUploadAreaProps>(), {
|
|
8
|
+
icon: 'i-celeste-upload-cloud-2-line',
|
|
9
|
+
label: 'Choose a file or drag & drop it here.',
|
|
10
|
+
description: 'JPEG, PNG, PDF, and MP4 formats, up to 50 MB.',
|
|
11
|
+
triggerLabel: 'Browse Files',
|
|
12
|
+
labelOnDrop: 'Drop file to upload',
|
|
13
|
+
multiple: false,
|
|
14
|
+
maxSize: 2000,
|
|
15
|
+
maxFiles: 5,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const emit = defineEmits<FileUploadAreaEmit>();
|
|
19
|
+
|
|
20
|
+
const files = defineModel<File[]>({ default: [] });
|
|
21
|
+
|
|
22
|
+
const dropZoneRef = useTemplateRef<HTMLElement>('dropZoneRef');
|
|
23
|
+
const { isOverDropZone } = useDropZone(dropZoneRef, { onDrop });
|
|
24
|
+
|
|
25
|
+
function handleUpload(e: Event) {
|
|
26
|
+
const input = e.target as HTMLInputElement;
|
|
27
|
+
const newFiles = Array.from(input.files ?? []);
|
|
28
|
+
|
|
29
|
+
const filesToProcess = newFiles.slice(0, props.maxFiles);
|
|
30
|
+
const rejectedFiles = newFiles.slice(props.maxFiles);
|
|
31
|
+
|
|
32
|
+
if (rejectedFiles.length > 0) {
|
|
33
|
+
emit('error', {
|
|
34
|
+
message: 'Files exceeded upload limit',
|
|
35
|
+
type: 'count',
|
|
36
|
+
files: rejectedFiles,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const validFiles = filesToProcess.filter(isValidFile);
|
|
41
|
+
|
|
42
|
+
files.value = [...validFiles];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function onDrop(droppedFiles: File[] | null) {
|
|
46
|
+
if (!droppedFiles?.length)
|
|
47
|
+
return;
|
|
48
|
+
|
|
49
|
+
const filesToProcess = droppedFiles.slice(0, props.maxFiles);
|
|
50
|
+
const rejectedFiles = droppedFiles.slice(props.maxFiles);
|
|
51
|
+
|
|
52
|
+
if (rejectedFiles.length > 0) {
|
|
53
|
+
emit('error', {
|
|
54
|
+
message: 'Files exceeded upload limit',
|
|
55
|
+
type: 'count',
|
|
56
|
+
files: rejectedFiles,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const validFiles = filesToProcess.filter(isValidFile);
|
|
61
|
+
files.value = [...validFiles];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function isValidFile(file: File): boolean {
|
|
65
|
+
const maxBytes = props.maxSize * 1024;
|
|
66
|
+
|
|
67
|
+
if (file.size > maxBytes) {
|
|
68
|
+
emit('error', {
|
|
69
|
+
message: `File too large: ${file.name}`,
|
|
70
|
+
type: 'size',
|
|
71
|
+
files: [file],
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const acceptableTypes = props.accept?.split(',') ?? [];
|
|
78
|
+
|
|
79
|
+
if (acceptableTypes.length > 0 && !acceptableTypes.includes(file.type)) {
|
|
80
|
+
emit('error', {
|
|
81
|
+
message: 'Unsupported type',
|
|
82
|
+
type: 'type',
|
|
83
|
+
files: [file],
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function handleTriggerClick(e: Event) {
|
|
93
|
+
if (props.onTriggerClick) {
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
props.onTriggerClick();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<script lang="ts">
|
|
101
|
+
export interface FileUploadAreaProps {
|
|
102
|
+
label?: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
labelOnDrop?: string;
|
|
105
|
+
triggerLabel?: string;
|
|
106
|
+
maxSize?: number;
|
|
107
|
+
maxFiles?: number;
|
|
108
|
+
multiple?: boolean;
|
|
109
|
+
icon?: string;
|
|
110
|
+
accept?: InputHTMLAttributes['accept'];
|
|
111
|
+
onTriggerClick?: () => void;
|
|
112
|
+
class?: InputHTMLAttributes['class'];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface FileError {
|
|
116
|
+
message: string;
|
|
117
|
+
type: 'size' | 'type' | 'count';
|
|
118
|
+
files: File[];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface FileUploadAreaEmit {
|
|
122
|
+
error: [error: FileError];
|
|
123
|
+
}
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<template>
|
|
127
|
+
<label
|
|
128
|
+
ref="dropZoneRef"
|
|
129
|
+
:class="clsx(
|
|
130
|
+
'celeste-file-upload-area',
|
|
131
|
+
props.class,
|
|
132
|
+
)"
|
|
133
|
+
:data-over-drop-zone="isOverDropZone"
|
|
134
|
+
>
|
|
135
|
+
<i :class="icon" />
|
|
136
|
+
<div class="celeste-file-upload-area-content">
|
|
137
|
+
<span class="celeste-file-upload-area-label">
|
|
138
|
+
{{ isOverDropZone ? labelOnDrop : label }}
|
|
139
|
+
</span>
|
|
140
|
+
<span
|
|
141
|
+
v-if="!isOverDropZone"
|
|
142
|
+
class="celeste-file-upload-area-description"
|
|
143
|
+
>
|
|
144
|
+
{{ description }}
|
|
145
|
+
</span>
|
|
146
|
+
</div>
|
|
147
|
+
<Button
|
|
148
|
+
v-if="!isOverDropZone"
|
|
149
|
+
as-child
|
|
150
|
+
intent="neutral"
|
|
151
|
+
variant="stroke"
|
|
152
|
+
size="xs"
|
|
153
|
+
class="celeste-file-upload-area-trigger"
|
|
154
|
+
@click="handleTriggerClick"
|
|
155
|
+
>
|
|
156
|
+
<span>{{ triggerLabel }}</span>
|
|
157
|
+
</Button>
|
|
158
|
+
<input
|
|
159
|
+
v-bind="$attrs"
|
|
160
|
+
type="file"
|
|
161
|
+
:multiple="multiple"
|
|
162
|
+
:accept="accept"
|
|
163
|
+
@change="handleUpload"
|
|
164
|
+
>
|
|
165
|
+
</label>
|
|
166
|
+
</template>
|
|
167
|
+
|
|
168
|
+
<style scoped lang="scss">
|
|
169
|
+
.celeste-file-upload-area {
|
|
170
|
+
display: flex;
|
|
171
|
+
box-sizing: border-box;
|
|
172
|
+
flex-direction: column;
|
|
173
|
+
align-items: center;
|
|
174
|
+
justify-content: center;
|
|
175
|
+
min-height: 204px;
|
|
176
|
+
gap: calc(var(--spacing-10) * 2);
|
|
177
|
+
padding: calc(var(--spacing-16) * 2);
|
|
178
|
+
transition: background-color var(--animation-normal) ease-out;
|
|
179
|
+
border: 1px dashed var(--color-stroke-sub-300);
|
|
180
|
+
border-radius: var(--radius-12);
|
|
181
|
+
background-color: var(--color-bg-white-0);
|
|
182
|
+
cursor: pointer;
|
|
183
|
+
|
|
184
|
+
&:hover {
|
|
185
|
+
background-color: var(--color-bg-weak-50);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
& > i {
|
|
189
|
+
width: 24px;
|
|
190
|
+
height: 24px;
|
|
191
|
+
color: var(--color-icon-sub-600);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.celeste-file-upload-area-content {
|
|
195
|
+
display: grid;
|
|
196
|
+
gap: var(--spacing-6);
|
|
197
|
+
text-align: center;
|
|
198
|
+
|
|
199
|
+
.celeste-file-upload-area-label {
|
|
200
|
+
color: var(--color-text-strong-950);
|
|
201
|
+
font: var(--label-sm);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.celeste-file-upload-area-description {
|
|
205
|
+
color: var(--color-text-sub-600);
|
|
206
|
+
font: var(--label-xs);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.celeste-file-upload-area-trigger {
|
|
211
|
+
background-color: var(--color-bg-white-0) !important;
|
|
212
|
+
|
|
213
|
+
&:hover {
|
|
214
|
+
background-color: transparent !important;
|
|
215
|
+
box-shadow: none !important;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
& > input[type='file'] {
|
|
220
|
+
position: absolute;
|
|
221
|
+
opacity: 0;
|
|
222
|
+
scale: 0;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
&[data-over-drop-zone='true'] {
|
|
226
|
+
background-color: var(--color-bg-weak-50);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
</style>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import Sonner from '@/components/sonner/sonner.vue';
|
|
3
|
+
import { toast } from '@/utils/sonner';
|
|
4
|
+
import { ref, watch } from 'vue';
|
|
5
|
+
import FileUploadArea, { type FileError } from '../file-upload-area.vue';
|
|
6
|
+
import 'vue-sonner/style.css';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof FileUploadArea> = {
|
|
9
|
+
title: 'Components/File Upload',
|
|
10
|
+
component: FileUploadArea,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof FileUploadArea>;
|
|
16
|
+
|
|
17
|
+
export const Default: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
multiple: true,
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
render: args => ({
|
|
23
|
+
components: { FileUploadArea },
|
|
24
|
+
setup() {
|
|
25
|
+
const files = ref([]);
|
|
26
|
+
|
|
27
|
+
watch(files, (newValue) => {
|
|
28
|
+
// eslint-disable-next-line no-console
|
|
29
|
+
console.log('v-model changed:', newValue);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
function handleError(error: FileError): void {
|
|
33
|
+
console.error(error);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return { args, files, handleError };
|
|
37
|
+
},
|
|
38
|
+
template: `
|
|
39
|
+
<FileUploadArea v-bind="args" v-model="files" @error="handleError" />
|
|
40
|
+
`,
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const CustomTriggerHandler: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
multiple: true,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
render: args => ({
|
|
50
|
+
components: { FileUploadArea, Sonner },
|
|
51
|
+
setup() {
|
|
52
|
+
const files = ref([]);
|
|
53
|
+
|
|
54
|
+
watch(files, (newValue) => {
|
|
55
|
+
// eslint-disable-next-line no-console
|
|
56
|
+
console.log('v-model changed:', newValue);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
function handleTriggerClick(): void {
|
|
60
|
+
toast('Upload trigger clicked!');
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
function handleError(error: FileError): void {
|
|
64
|
+
console.error(error);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return { args, files, handleError, handleTriggerClick };
|
|
68
|
+
},
|
|
69
|
+
template: `
|
|
70
|
+
<div class="sonner-story-container">
|
|
71
|
+
<Sonner position="top-center" />
|
|
72
|
+
<FileUploadArea v-bind="args" v-model="files" @error="handleError" @triggerClick="handleTriggerClick" />
|
|
73
|
+
</div>
|
|
74
|
+
`,
|
|
75
|
+
}),
|
|
76
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -2,11 +2,11 @@ export * from './alert';
|
|
|
2
2
|
export * from './badge';
|
|
3
3
|
export * from './button';
|
|
4
4
|
export * from './checkbox';
|
|
5
|
+
export * from './color-picker';
|
|
5
6
|
export * from './combobox';
|
|
6
7
|
export * from './content-divider';
|
|
7
8
|
export * from './counter-input';
|
|
8
9
|
export * from './digit-input';
|
|
9
|
-
export * from './dropdown';
|
|
10
10
|
export * from './dropdown-menu';
|
|
11
11
|
export * from './hint-text';
|
|
12
12
|
export * from './label';
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const Mo = require("vue");
|
|
3
|
-
const clsx = require("./chunks/clsx.js");
|
|
4
|
-
const index = require("./chunks/index.js");
|
|
5
|
-
const badge = require("./badge.js");
|
|
6
|
-
const button = require("./button.js");
|
|
7
|
-
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
8
|
-
const _hoisted_1 = ["aria-disabled"];
|
|
9
|
-
const _hoisted_2 = { class: "celeste-context-menu-item-info" };
|
|
10
|
-
const _hoisted_3 = ["innerHTML"];
|
|
11
|
-
const _hoisted_4 = {
|
|
12
|
-
key: 0,
|
|
13
|
-
class: "celeste-context-menu-item-sublabel"
|
|
14
|
-
};
|
|
15
|
-
const _hoisted_5 = {
|
|
16
|
-
key: 0,
|
|
17
|
-
class: "celeste-context-menu-item-description"
|
|
18
|
-
};
|
|
19
|
-
const _hoisted_6 = {
|
|
20
|
-
key: 2,
|
|
21
|
-
class: "celeste-context-menu-item-shortcut"
|
|
22
|
-
};
|
|
23
|
-
const _hoisted_7 = { class: "celeste-context-menu-item-switch" };
|
|
24
|
-
const _hoisted_8 = { class: "celeste-context-menu-item-button" };
|
|
25
|
-
const _hoisted_9 = {
|
|
26
|
-
key: 3,
|
|
27
|
-
class: "celeste-context-menu-item-suffix"
|
|
28
|
-
};
|
|
29
|
-
const _sfc_main = /* @__PURE__ */ Mo.defineComponent({
|
|
30
|
-
__name: "context-menu-item",
|
|
31
|
-
props: /* @__PURE__ */ Mo.mergeModels({
|
|
32
|
-
size: { default: "sm" },
|
|
33
|
-
class: {},
|
|
34
|
-
label: {},
|
|
35
|
-
sublabel: {},
|
|
36
|
-
description: {},
|
|
37
|
-
disabled: { type: Boolean, default: false },
|
|
38
|
-
focused: { type: Boolean, default: false },
|
|
39
|
-
badgeProps: {},
|
|
40
|
-
shortcut: {},
|
|
41
|
-
toggle: { type: Boolean },
|
|
42
|
-
selected: { type: Boolean },
|
|
43
|
-
buttonProps: {},
|
|
44
|
-
rightIcon: {}
|
|
45
|
-
}, {
|
|
46
|
-
"selected": { type: Boolean },
|
|
47
|
-
"selectedModifiers": {}
|
|
48
|
-
}),
|
|
49
|
-
emits: ["update:selected"],
|
|
50
|
-
setup(__props) {
|
|
51
|
-
const props = __props;
|
|
52
|
-
const selectedModel = Mo.useModel(__props, "selected");
|
|
53
|
-
const mergedBadgeProps = Mo.computed(() => ({
|
|
54
|
-
...props.badgeProps,
|
|
55
|
-
disabled: props.disabled
|
|
56
|
-
}));
|
|
57
|
-
const mergedButtonProps = Mo.computed(() => {
|
|
58
|
-
return props.buttonProps ? {
|
|
59
|
-
size: props.size === "sm" ? "xxs" : "xs",
|
|
60
|
-
variant: props.size === "sm" ? "ghost" : "lighter",
|
|
61
|
-
disabled: props.disabled,
|
|
62
|
-
...props.buttonProps
|
|
63
|
-
} : null;
|
|
64
|
-
});
|
|
65
|
-
return (_ctx, _cache) => {
|
|
66
|
-
return Mo.openBlock(), Mo.createElementBlock("div", {
|
|
67
|
-
tabindex: "0",
|
|
68
|
-
"aria-disabled": _ctx.disabled,
|
|
69
|
-
class: Mo.normalizeClass(Mo.unref(clsx.clsx)(
|
|
70
|
-
"celeste-context-menu-item",
|
|
71
|
-
`celeste-context-menu-item-size-${_ctx.size}`,
|
|
72
|
-
{ "celeste-context-menu-item-disabled": _ctx.disabled },
|
|
73
|
-
{ "celeste-context-menu-item-selected": __props.selected },
|
|
74
|
-
{ "celeste-context-menu-item-focused": _ctx.focused }
|
|
75
|
-
))
|
|
76
|
-
}, [
|
|
77
|
-
_ctx.$slots.prefix ? (Mo.openBlock(), Mo.createElementBlock("div", {
|
|
78
|
-
key: 0,
|
|
79
|
-
class: Mo.normalizeClass(Mo.unref(clsx.clsx)(
|
|
80
|
-
"celeste-context-menu-item-prefix",
|
|
81
|
-
`celeste-context-menu-item-prefix-${_ctx.size}`
|
|
82
|
-
))
|
|
83
|
-
}, [
|
|
84
|
-
Mo.renderSlot(_ctx.$slots, "prefix", {}, void 0, true)
|
|
85
|
-
], 2)) : Mo.createCommentVNode("", true),
|
|
86
|
-
Mo.createElementVNode("div", _hoisted_2, [
|
|
87
|
-
Mo.createElementVNode("div", {
|
|
88
|
-
class: Mo.normalizeClass(Mo.unref(clsx.clsx)(
|
|
89
|
-
"celeste-context-menu-item-header",
|
|
90
|
-
`celeste-context-menu-item-header-${_ctx.size}`
|
|
91
|
-
))
|
|
92
|
-
}, [
|
|
93
|
-
Mo.createElementVNode("span", {
|
|
94
|
-
class: "celeste-context-menu-item-label",
|
|
95
|
-
innerHTML: _ctx.label
|
|
96
|
-
}, null, 8, _hoisted_3),
|
|
97
|
-
_ctx.sublabel ? (Mo.openBlock(), Mo.createElementBlock("span", _hoisted_4, Mo.toDisplayString(_ctx.sublabel), 1)) : Mo.createCommentVNode("", true)
|
|
98
|
-
], 2),
|
|
99
|
-
props.description && props.size === "lg" ? (Mo.openBlock(), Mo.createElementBlock("p", _hoisted_5, Mo.toDisplayString(_ctx.description), 1)) : Mo.createCommentVNode("", true)
|
|
100
|
-
]),
|
|
101
|
-
mergedBadgeProps.value ? (Mo.openBlock(), Mo.createBlock(badge, Mo.mergeProps({ key: 1 }, mergedBadgeProps.value, { class: "celeste-context-menu-item-badge" }), null, 16)) : Mo.createCommentVNode("", true),
|
|
102
|
-
_ctx.shortcut ? (Mo.openBlock(), Mo.createElementBlock("span", _hoisted_6, Mo.toDisplayString(_ctx.shortcut), 1)) : Mo.createCommentVNode("", true),
|
|
103
|
-
Mo.createElementVNode("span", _hoisted_7, [
|
|
104
|
-
Mo.createVNode(Mo.unref(index.mg), {
|
|
105
|
-
checked: selectedModel.value,
|
|
106
|
-
"onUpdate:checked": _cache[0] || (_cache[0] = ($event) => selectedModel.value = $event),
|
|
107
|
-
disabled: _ctx.disabled,
|
|
108
|
-
class: "celeste-switch-root"
|
|
109
|
-
}, {
|
|
110
|
-
default: Mo.withCtx(() => [
|
|
111
|
-
Mo.createVNode(Mo.unref(index.hg), { class: "celeste-switch-thumb" })
|
|
112
|
-
]),
|
|
113
|
-
_: 1
|
|
114
|
-
}, 8, ["checked", "disabled"])
|
|
115
|
-
]),
|
|
116
|
-
Mo.createElementVNode("span", _hoisted_8, [
|
|
117
|
-
mergedButtonProps.value ? (Mo.openBlock(), Mo.createBlock(button, Mo.normalizeProps(Mo.mergeProps({ key: 0 }, mergedButtonProps.value)), {
|
|
118
|
-
default: Mo.withCtx(() => [
|
|
119
|
-
Mo.renderSlot(_ctx.$slots, "button-label", {}, void 0, true)
|
|
120
|
-
]),
|
|
121
|
-
_: 3
|
|
122
|
-
}, 16)) : Mo.createCommentVNode("", true)
|
|
123
|
-
]),
|
|
124
|
-
_ctx.rightIcon ? (Mo.openBlock(), Mo.createElementBlock("span", _hoisted_9, [
|
|
125
|
-
Mo.createElementVNode("i", {
|
|
126
|
-
class: Mo.normalizeClass(_ctx.rightIcon)
|
|
127
|
-
}, null, 2)
|
|
128
|
-
])) : Mo.createCommentVNode("", true)
|
|
129
|
-
], 10, _hoisted_1);
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
const contextMenuItem = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-3d94f388"]]);
|
|
134
|
-
module.exports = contextMenuItem;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const Mo = require("vue");
|
|
3
|
-
const clsx = require("./chunks/clsx.js");
|
|
4
|
-
const checkbox_vue_vue_type_style_index_0_lang = require("./chunks/checkbox.vue_vue_type_style_index_0_lang.js");
|
|
5
|
-
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
6
|
-
const _hoisted_1 = ["aria-disabled"];
|
|
7
|
-
const _hoisted_2 = { class: "celeste-dropdown-item-info" };
|
|
8
|
-
const _hoisted_3 = ["innerHTML"];
|
|
9
|
-
const _hoisted_4 = {
|
|
10
|
-
key: 0,
|
|
11
|
-
class: "celeste-dropdown-item-sublabel"
|
|
12
|
-
};
|
|
13
|
-
const _hoisted_5 = {
|
|
14
|
-
key: 0,
|
|
15
|
-
class: "celeste-dropdown-item-description"
|
|
16
|
-
};
|
|
17
|
-
const _hoisted_6 = {
|
|
18
|
-
key: 2,
|
|
19
|
-
class: "celeste-dropdown-item-suffix"
|
|
20
|
-
};
|
|
21
|
-
const _hoisted_7 = {
|
|
22
|
-
key: 3,
|
|
23
|
-
class: "i-celeste-check-fill"
|
|
24
|
-
};
|
|
25
|
-
const _sfc_main = /* @__PURE__ */ Mo.defineComponent({
|
|
26
|
-
__name: "dropdown-item",
|
|
27
|
-
props: {
|
|
28
|
-
class: {},
|
|
29
|
-
label: {},
|
|
30
|
-
size: { default: "sm" },
|
|
31
|
-
checkbox: { type: Boolean },
|
|
32
|
-
sublabel: {},
|
|
33
|
-
description: {},
|
|
34
|
-
selected: { type: [Boolean, String], default: false },
|
|
35
|
-
disabled: { type: Boolean, default: false },
|
|
36
|
-
focused: { type: Boolean, default: false }
|
|
37
|
-
},
|
|
38
|
-
emits: ["update:selected"],
|
|
39
|
-
setup(__props, { emit: __emit }) {
|
|
40
|
-
const props = __props;
|
|
41
|
-
const emit = __emit;
|
|
42
|
-
function toggleSelection() {
|
|
43
|
-
if (!props.disabled && props.checkbox) {
|
|
44
|
-
emit("update:selected", !props.selected);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return (_ctx, _cache) => {
|
|
48
|
-
return Mo.openBlock(), Mo.createElementBlock("div", {
|
|
49
|
-
tabindex: "0",
|
|
50
|
-
"aria-disabled": _ctx.disabled,
|
|
51
|
-
class: Mo.normalizeClass(Mo.unref(clsx.clsx)(
|
|
52
|
-
"celeste-dropdown-item",
|
|
53
|
-
{ "celeste-dropdown-item-disabled": _ctx.disabled },
|
|
54
|
-
{ "celeste-dropdown-item-selected": _ctx.selected },
|
|
55
|
-
{ "celeste-dropdown-item-focused": _ctx.focused }
|
|
56
|
-
)),
|
|
57
|
-
onKeydown: Mo.withKeys(toggleSelection, ["enter"]),
|
|
58
|
-
onClick: toggleSelection
|
|
59
|
-
}, [
|
|
60
|
-
_ctx.checkbox && _ctx.size === "sm" ? (Mo.openBlock(), Mo.createBlock(checkbox_vue_vue_type_style_index_0_lang._sfc_main, {
|
|
61
|
-
key: 0,
|
|
62
|
-
checked: _ctx.selected,
|
|
63
|
-
disabled: _ctx.disabled,
|
|
64
|
-
"onUpdate:checked": _cache[0] || (_cache[0] = (value) => _ctx.$emit("update:selected", value))
|
|
65
|
-
}, null, 8, ["checked", "disabled"])) : Mo.createCommentVNode("", true),
|
|
66
|
-
_ctx.$slots.prefix ? (Mo.openBlock(), Mo.createElementBlock("div", {
|
|
67
|
-
key: 1,
|
|
68
|
-
class: Mo.normalizeClass(Mo.unref(clsx.clsx)(
|
|
69
|
-
"celeste-dropdown-item-prefix",
|
|
70
|
-
`celeste-dropdown-item-prefix-${_ctx.size}`
|
|
71
|
-
))
|
|
72
|
-
}, [
|
|
73
|
-
Mo.renderSlot(_ctx.$slots, "prefix", {}, void 0, true)
|
|
74
|
-
], 2)) : Mo.createCommentVNode("", true),
|
|
75
|
-
Mo.createElementVNode("div", _hoisted_2, [
|
|
76
|
-
Mo.createElementVNode("div", {
|
|
77
|
-
class: Mo.normalizeClass(Mo.unref(clsx.clsx)(
|
|
78
|
-
"celeste-dropdown-item-header",
|
|
79
|
-
`celeste-dropdown-item-header-${_ctx.size}`
|
|
80
|
-
))
|
|
81
|
-
}, [
|
|
82
|
-
Mo.createElementVNode("span", {
|
|
83
|
-
class: "celeste-dropdown-item-label",
|
|
84
|
-
innerHTML: _ctx.label
|
|
85
|
-
}, null, 8, _hoisted_3),
|
|
86
|
-
_ctx.sublabel ? (Mo.openBlock(), Mo.createElementBlock("span", _hoisted_4, Mo.toDisplayString(_ctx.sublabel), 1)) : Mo.createCommentVNode("", true)
|
|
87
|
-
], 2),
|
|
88
|
-
props.description && props.size === "lg" ? (Mo.openBlock(), Mo.createElementBlock("p", _hoisted_5, Mo.toDisplayString(_ctx.description), 1)) : Mo.createCommentVNode("", true)
|
|
89
|
-
]),
|
|
90
|
-
_ctx.$slots.suffix ? (Mo.openBlock(), Mo.createElementBlock("div", _hoisted_6, [
|
|
91
|
-
Mo.renderSlot(_ctx.$slots, "suffix", {}, void 0, true)
|
|
92
|
-
])) : Mo.createCommentVNode("", true),
|
|
93
|
-
_ctx.selected ? (Mo.openBlock(), Mo.createElementBlock("i", _hoisted_7)) : Mo.createCommentVNode("", true)
|
|
94
|
-
], 42, _hoisted_1);
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
const DropdownItem = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-a0a634ce"]]);
|
|
99
|
-
module.exports = DropdownItem;
|