@skewedaspect/sleekspace-ui 0.6.0 → 0.7.1
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/components/ColorPicker/SkColorPicker.vue.d.ts +29 -0
- package/dist/components/ColorPicker/index.d.ts +2 -0
- package/dist/components/ColorPicker/types.d.ts +4 -0
- package/dist/components/ContextMenu/SkContextMenu.vue.d.ts +25 -0
- package/dist/components/ContextMenu/SkContextMenuCheckboxItem.vue.d.ts +28 -0
- package/dist/components/ContextMenu/SkContextMenuItem.vue.d.ts +26 -0
- package/dist/components/ContextMenu/SkContextMenuLabel.vue.d.ts +17 -0
- package/dist/components/ContextMenu/SkContextMenuRadioGroup.vue.d.ts +26 -0
- package/dist/components/ContextMenu/SkContextMenuRadioItem.vue.d.ts +23 -0
- package/dist/components/ContextMenu/SkContextMenuSeparator.vue.d.ts +2 -0
- package/dist/components/ContextMenu/SkContextMenuSubmenu.vue.d.ts +24 -0
- package/dist/components/ContextMenu/index.d.ts +9 -0
- package/dist/components/ContextMenu/types.d.ts +2 -0
- package/dist/components/Dropdown/SkDropdown.vue.d.ts +1 -1
- package/dist/components/Dropdown/SkDropdownCheckboxItem.vue.d.ts +28 -0
- package/dist/components/Dropdown/SkDropdownMenuLabel.vue.d.ts +17 -0
- package/dist/components/Dropdown/SkDropdownRadioGroup.vue.d.ts +26 -0
- package/dist/components/Dropdown/SkDropdownRadioItem.vue.d.ts +23 -0
- package/dist/components/Dropdown/index.d.ts +4 -0
- package/dist/components/Popover/SkPopover.vue.d.ts +1 -1
- package/dist/components/ScrollArea/SkScrollArea.vue.d.ts +31 -0
- package/dist/components/ScrollArea/index.d.ts +2 -0
- package/dist/components/ScrollArea/types.d.ts +4 -0
- package/dist/components/Sidebar/SkSidebar.vue.d.ts +1 -1
- package/dist/components/Skeleton/SkSkeleton.vue.d.ts +1 -1
- package/dist/components/Splitter/SkSplitter.vue.d.ts +29 -0
- package/dist/components/Splitter/SkSplitterHandle.vue.d.ts +7 -0
- package/dist/components/Splitter/SkSplitterPanel.vue.d.ts +30 -0
- package/dist/components/Splitter/index.d.ts +4 -0
- package/dist/components/Splitter/types.d.ts +3 -0
- package/dist/components/Toolbar/SkToolbar.vue.d.ts +31 -0
- package/dist/components/Toolbar/SkToolbarButton.vue.d.ts +22 -0
- package/dist/components/Toolbar/SkToolbarSeparator.vue.d.ts +2 -0
- package/dist/components/Toolbar/SkToolbarToggleGroup.vue.d.ts +31 -0
- package/dist/components/Toolbar/SkToolbarToggleItem.vue.d.ts +23 -0
- package/dist/components/Toolbar/index.d.ts +6 -0
- package/dist/components/Toolbar/types.d.ts +5 -0
- package/dist/components/Tooltip/SkTooltip.vue.d.ts +1 -1
- package/dist/components/TreeView/SkTreeItem.vue.d.ts +39 -0
- package/dist/components/TreeView/SkTreeView.vue.d.ts +31 -0
- package/dist/components/TreeView/index.d.ts +3 -0
- package/dist/components/TreeView/types.d.ts +3 -0
- package/dist/index.d.ts +54 -0
- package/dist/sleekspace-ui.css +1215 -46
- package/dist/sleekspace-ui.es.js +16874 -7224
- package/dist/sleekspace-ui.umd.js +16855 -7205
- package/package.json +2 -1
- package/src/components/ColorPicker/SkColorPicker.vue +355 -0
- package/src/components/ColorPicker/index.ts +6 -0
- package/src/components/ColorPicker/types.ts +11 -0
- package/src/components/ContextMenu/SkContextMenu.vue +83 -0
- package/src/components/ContextMenu/SkContextMenuCheckboxItem.vue +72 -0
- package/src/components/ContextMenu/SkContextMenuItem.vue +49 -0
- package/src/components/ContextMenu/SkContextMenuLabel.vue +17 -0
- package/src/components/ContextMenu/SkContextMenuRadioGroup.vue +36 -0
- package/src/components/ContextMenu/SkContextMenuRadioItem.vue +53 -0
- package/src/components/ContextMenu/SkContextMenuSeparator.vue +21 -0
- package/src/components/ContextMenu/SkContextMenuSubmenu.vue +94 -0
- package/src/components/ContextMenu/index.ts +15 -0
- package/src/components/ContextMenu/types.ts +9 -0
- package/src/components/Dropdown/SkDropdown.vue +1 -1
- package/src/components/Dropdown/SkDropdownCheckboxItem.vue +72 -0
- package/src/components/Dropdown/SkDropdownMenuItem.vue +1 -1
- package/src/components/Dropdown/SkDropdownMenuLabel.vue +17 -0
- package/src/components/Dropdown/SkDropdownRadioGroup.vue +36 -0
- package/src/components/Dropdown/SkDropdownRadioItem.vue +53 -0
- package/src/components/Dropdown/SkDropdownSubmenu.vue +2 -2
- package/src/components/Dropdown/index.ts +4 -0
- package/src/components/ScrollArea/SkScrollArea.vue +87 -0
- package/src/components/ScrollArea/index.ts +8 -0
- package/src/components/ScrollArea/types.ts +11 -0
- package/src/components/Splitter/SkSplitter.vue +65 -0
- package/src/components/Splitter/SkSplitterHandle.vue +40 -0
- package/src/components/Splitter/SkSplitterPanel.vue +45 -0
- package/src/components/Splitter/index.ts +10 -0
- package/src/components/Splitter/types.ts +10 -0
- package/src/components/Toolbar/SkToolbar.vue +69 -0
- package/src/components/Toolbar/SkToolbarButton.vue +36 -0
- package/src/components/Toolbar/SkToolbarSeparator.vue +15 -0
- package/src/components/Toolbar/SkToolbarToggleGroup.vue +49 -0
- package/src/components/Toolbar/SkToolbarToggleItem.vue +37 -0
- package/src/components/Toolbar/index.ts +12 -0
- package/src/components/Toolbar/types.ts +12 -0
- package/src/components/TreeView/SkTreeItem.vue +84 -0
- package/src/components/TreeView/SkTreeView.vue +120 -0
- package/src/components/TreeView/index.ts +9 -0
- package/src/components/TreeView/types.ts +10 -0
- package/src/global.d.ts +20 -0
- package/src/index.ts +100 -0
- package/src/styles/components/_color-picker.scss +552 -0
- package/src/styles/components/_index.scss +5 -0
- package/src/styles/components/_menu.scss +52 -3
- package/src/styles/components/_scroll-area.scss +120 -0
- package/src/styles/components/_slider.scss +4 -4
- package/src/styles/components/_splitter.scss +136 -0
- package/src/styles/components/_toolbar.scss +296 -0
- package/src/styles/components/_tree-view.scss +187 -0
- package/web-types.json +1022 -122
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skewedaspect/sleekspace-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "A Vue 3 component library with a cyberpunk aesthetic, featuring OKLCH colors, beveled corners, and a powerful design token system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/sleekspace-ui.umd.js",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"vue-docgen-web-types": "^0.1.8"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
+
"@vuelor/picker": "^0.3.1",
|
|
71
72
|
"modern-normalize": "^3.0.1",
|
|
72
73
|
"reka-ui": "^2.6.0"
|
|
73
74
|
}
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
<!----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
- ColorPicker Component
|
|
3
|
+
--------------------------------------------------------------------------------------------------------------------->
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<ColorPickerRoot
|
|
7
|
+
:model-value="modelValue ?? null"
|
|
8
|
+
:default-value="defaultValue"
|
|
9
|
+
:format="format"
|
|
10
|
+
:disabled="disabled"
|
|
11
|
+
styling="vanillacss"
|
|
12
|
+
@update:model-value="onColorChange"
|
|
13
|
+
>
|
|
14
|
+
<div :class="wrapperClasses" :style="customColorStyles">
|
|
15
|
+
<PopoverRoot>
|
|
16
|
+
<PopoverTrigger as-child :disabled="disabled">
|
|
17
|
+
<div :class="anchorClasses">
|
|
18
|
+
<div
|
|
19
|
+
class="sk-color-picker-swatch"
|
|
20
|
+
:style="{ background: modelValue || defaultValue }"
|
|
21
|
+
/>
|
|
22
|
+
<span :class="inputClasses">
|
|
23
|
+
{{ modelValue || placeholder }}
|
|
24
|
+
</span>
|
|
25
|
+
<div :class="triggerClasses">
|
|
26
|
+
<svg
|
|
27
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
28
|
+
viewBox="0 0 24 24"
|
|
29
|
+
fill="none"
|
|
30
|
+
stroke="currentColor"
|
|
31
|
+
stroke-width="2"
|
|
32
|
+
stroke-linecap="square"
|
|
33
|
+
stroke-linejoin="miter"
|
|
34
|
+
style="width: 1rem; height: 1rem;"
|
|
35
|
+
>
|
|
36
|
+
<polyline points="6 9 12 15 18 9" />
|
|
37
|
+
</svg>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</PopoverTrigger>
|
|
41
|
+
|
|
42
|
+
<PopoverPortal>
|
|
43
|
+
<PopoverContent
|
|
44
|
+
:data-scheme="theme"
|
|
45
|
+
:class="panelClasses"
|
|
46
|
+
:style="customColorStyles"
|
|
47
|
+
side="bottom"
|
|
48
|
+
align="start"
|
|
49
|
+
:side-offset="4"
|
|
50
|
+
>
|
|
51
|
+
<ColorPickerCanvas />
|
|
52
|
+
<div class="sk-color-picker-controls">
|
|
53
|
+
<ColorPickerEyeDropper class="sk-color-picker-eyedropper">
|
|
54
|
+
<svg
|
|
55
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
56
|
+
viewBox="0 0 24 24"
|
|
57
|
+
fill="none"
|
|
58
|
+
stroke="currentColor"
|
|
59
|
+
stroke-width="2"
|
|
60
|
+
stroke-linecap="round"
|
|
61
|
+
stroke-linejoin="round"
|
|
62
|
+
style="width: 1rem; height: 1rem;"
|
|
63
|
+
>
|
|
64
|
+
<path d="m2 22 1-1h3l9-9" />
|
|
65
|
+
<path d="M3 21v-3l9-9" />
|
|
66
|
+
<path d="m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z" />
|
|
67
|
+
</svg>
|
|
68
|
+
</ColorPickerEyeDropper>
|
|
69
|
+
<div class="sk-color-picker-sliders">
|
|
70
|
+
<ColorPickerSliderHue class="sk-color-picker-slider" />
|
|
71
|
+
<ColorPickerSliderAlpha
|
|
72
|
+
v-if="showAlpha"
|
|
73
|
+
class="sk-color-picker-slider"
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="sk-color-picker-inputs">
|
|
78
|
+
<div class="sk-color-picker-format-buttons">
|
|
79
|
+
<button
|
|
80
|
+
v-for="fmt in FORMAT_OPTIONS"
|
|
81
|
+
:key="fmt"
|
|
82
|
+
:class="[
|
|
83
|
+
'sk-color-picker-format-btn',
|
|
84
|
+
{ 'sk-active': displayFormat === fmt }
|
|
85
|
+
]"
|
|
86
|
+
type="button"
|
|
87
|
+
@click="displayFormat = fmt"
|
|
88
|
+
>
|
|
89
|
+
{{ fmt }}
|
|
90
|
+
</button>
|
|
91
|
+
</div>
|
|
92
|
+
<component :is="INPUTS[displayFormat]" class="sk-color-picker-input-fields" />
|
|
93
|
+
</div>
|
|
94
|
+
</PopoverContent>
|
|
95
|
+
</PopoverPortal>
|
|
96
|
+
</PopoverRoot>
|
|
97
|
+
</div>
|
|
98
|
+
</ColorPickerRoot>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
102
|
+
|
|
103
|
+
<style lang="scss" scoped>
|
|
104
|
+
// Scoped attribute selector beats vuelor's un-layered CSS
|
|
105
|
+
.vuelor-picker-root
|
|
106
|
+
{
|
|
107
|
+
width: 100%;
|
|
108
|
+
background: transparent;
|
|
109
|
+
border-radius: 0;
|
|
110
|
+
padding: 0;
|
|
111
|
+
box-shadow: none;
|
|
112
|
+
}
|
|
113
|
+
</style>
|
|
114
|
+
|
|
115
|
+
<!-- Unscoped: vuelor overrides for portaled panel content (can't use scoped or layers) -->
|
|
116
|
+
<style lang="scss">
|
|
117
|
+
@use '@/styles/mixins/cut-border' as *;
|
|
118
|
+
|
|
119
|
+
.sk-color-picker-panel
|
|
120
|
+
{
|
|
121
|
+
// Ensure panel width is set (can't rely on layered CSS)
|
|
122
|
+
width: 17rem;
|
|
123
|
+
|
|
124
|
+
.vuelor-picker-canvas-root
|
|
125
|
+
{
|
|
126
|
+
width: 100% !important;
|
|
127
|
+
height: auto !important;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Override vuelor's inline styles on the canvas
|
|
131
|
+
.vuelor-picker-canvas-area
|
|
132
|
+
{
|
|
133
|
+
width: 100% !important;
|
|
134
|
+
height: 10rem !important;
|
|
135
|
+
border-radius: 0;
|
|
136
|
+
outline: none;
|
|
137
|
+
|
|
138
|
+
@include cut-border(
|
|
139
|
+
$cut: 0.375rem,
|
|
140
|
+
$border-width: var(--sk-border-width-thin),
|
|
141
|
+
$border-color: color-mix(in oklch, var(--sk-panel-color-base), transparent 50%),
|
|
142
|
+
$corners: (top-left)
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.vuelor-picker-shared-thumb
|
|
147
|
+
{
|
|
148
|
+
border-radius: 2px;
|
|
149
|
+
border-width: 2px;
|
|
150
|
+
border-color: white;
|
|
151
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(0, 0, 0, 0.3);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.vuelor-picker-slider-root
|
|
155
|
+
{
|
|
156
|
+
height: 0.875rem;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.vuelor-picker-slider-track
|
|
160
|
+
{
|
|
161
|
+
height: 0.5rem;
|
|
162
|
+
border-radius: 2px;
|
|
163
|
+
box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--sk-panel-color-base), transparent 60%);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.vuelor-picker-input-group
|
|
167
|
+
{
|
|
168
|
+
border-radius: 0;
|
|
169
|
+
outline: none;
|
|
170
|
+
gap: 2px;
|
|
171
|
+
|
|
172
|
+
@include cut-border(
|
|
173
|
+
$cut: 0.25rem,
|
|
174
|
+
$border-width: var(--sk-border-width-thin),
|
|
175
|
+
$border-color: color-mix(in oklch, var(--sk-panel-color-base), transparent 50%),
|
|
176
|
+
$corners: (top-right)
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
&:focus-within
|
|
180
|
+
{
|
|
181
|
+
border-color: var(--sk-panel-color-base);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.vuelor-picker-input-item
|
|
186
|
+
{
|
|
187
|
+
background: color-mix(in oklch, var(--sk-panel-color-base), #000 80%);
|
|
188
|
+
border-radius: 0;
|
|
189
|
+
padding: 0 var(--sk-space-xs);
|
|
190
|
+
|
|
191
|
+
&:first-child,
|
|
192
|
+
&:last-child
|
|
193
|
+
{
|
|
194
|
+
border-radius: 0;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&:last-child
|
|
198
|
+
{
|
|
199
|
+
min-width: 3rem;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.vuelor-picker-input-label
|
|
204
|
+
{
|
|
205
|
+
color: var(--sk-panel-fg);
|
|
206
|
+
opacity: 0.5;
|
|
207
|
+
font-size: 0.625rem;
|
|
208
|
+
text-transform: uppercase;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.vuelor-picker-input-field
|
|
212
|
+
{
|
|
213
|
+
color: var(--sk-panel-fg);
|
|
214
|
+
font-family: var(--sk-font-family-mono, var(--sk-font-family-base));
|
|
215
|
+
font-size: 0.75rem;
|
|
216
|
+
height: 1.75rem;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.vuelor-picker-swatch-base
|
|
220
|
+
{
|
|
221
|
+
border-radius: 2px;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
</style>
|
|
225
|
+
|
|
226
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
227
|
+
|
|
228
|
+
<script setup lang="ts">
|
|
229
|
+
import { type Component, type ComputedRef, computed, inject, ref, toRef } from 'vue';
|
|
230
|
+
import {
|
|
231
|
+
type ColorObject,
|
|
232
|
+
ColorPickerCanvas,
|
|
233
|
+
ColorPickerEyeDropper,
|
|
234
|
+
ColorPickerInputHSL,
|
|
235
|
+
ColorPickerInputHex,
|
|
236
|
+
ColorPickerInputRGB,
|
|
237
|
+
ColorPickerRoot,
|
|
238
|
+
ColorPickerSliderAlpha,
|
|
239
|
+
ColorPickerSliderHue,
|
|
240
|
+
} from '@vuelor/picker';
|
|
241
|
+
import '@vuelor/picker/style.css';
|
|
242
|
+
import {
|
|
243
|
+
PopoverContent,
|
|
244
|
+
PopoverPortal,
|
|
245
|
+
PopoverRoot,
|
|
246
|
+
PopoverTrigger,
|
|
247
|
+
} from 'reka-ui';
|
|
248
|
+
|
|
249
|
+
// Types
|
|
250
|
+
import type { ComponentCustomColors } from '@/types';
|
|
251
|
+
import type { SkColorPickerFormat, SkColorPickerKind, SkColorPickerSize } from './types';
|
|
252
|
+
|
|
253
|
+
// Composables
|
|
254
|
+
import { useCustomColors } from '@/composables/useCustomColors';
|
|
255
|
+
import { usePortalContext } from '@/composables/usePortalContext';
|
|
256
|
+
|
|
257
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
258
|
+
|
|
259
|
+
type DisplayFormat = 'Hex' | 'RGB' | 'HSL';
|
|
260
|
+
|
|
261
|
+
const FORMAT_OPTIONS : DisplayFormat[] = [ 'Hex', 'RGB', 'HSL' ];
|
|
262
|
+
|
|
263
|
+
const INPUTS : Record<DisplayFormat, Component> = {
|
|
264
|
+
Hex: ColorPickerInputHex,
|
|
265
|
+
RGB: ColorPickerInputRGB,
|
|
266
|
+
HSL: ColorPickerInputHSL,
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
270
|
+
|
|
271
|
+
export interface SkColorPickerComponentProps extends ComponentCustomColors
|
|
272
|
+
{
|
|
273
|
+
kind ?: SkColorPickerKind;
|
|
274
|
+
size ?: SkColorPickerSize;
|
|
275
|
+
format ?: SkColorPickerFormat;
|
|
276
|
+
showAlpha ?: boolean;
|
|
277
|
+
disabled ?: boolean;
|
|
278
|
+
placeholder ?: string;
|
|
279
|
+
defaultValue ?: string;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
283
|
+
|
|
284
|
+
const props = withDefaults(defineProps<SkColorPickerComponentProps>(), {
|
|
285
|
+
kind: undefined,
|
|
286
|
+
size: 'md',
|
|
287
|
+
format: 'hexa',
|
|
288
|
+
showAlpha: true,
|
|
289
|
+
disabled: false,
|
|
290
|
+
placeholder: 'Pick a color',
|
|
291
|
+
defaultValue: '#B63DDAFF',
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
295
|
+
|
|
296
|
+
const modelValue = defineModel<string>();
|
|
297
|
+
|
|
298
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
299
|
+
|
|
300
|
+
const { theme } = usePortalContext();
|
|
301
|
+
|
|
302
|
+
const fieldKind = inject<ComputedRef<SkColorPickerKind | undefined>>('field-kind', computed(() => undefined));
|
|
303
|
+
const displayFormat = ref<DisplayFormat>('Hex');
|
|
304
|
+
|
|
305
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
306
|
+
|
|
307
|
+
const effectiveKind = computed(() => fieldKind.value || props.kind || 'neutral');
|
|
308
|
+
|
|
309
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
310
|
+
|
|
311
|
+
const wrapperClasses = computed(() => ({
|
|
312
|
+
'sk-color-picker': true,
|
|
313
|
+
[`sk-${ effectiveKind.value }`]: true,
|
|
314
|
+
[`sk-${ props.size }`]: true,
|
|
315
|
+
'sk-disabled': props.disabled,
|
|
316
|
+
}));
|
|
317
|
+
|
|
318
|
+
const anchorClasses = computed(() => ({
|
|
319
|
+
'sk-color-picker-anchor': true,
|
|
320
|
+
}));
|
|
321
|
+
|
|
322
|
+
const inputClasses = computed(() => ({
|
|
323
|
+
'sk-color-picker-input': true,
|
|
324
|
+
}));
|
|
325
|
+
|
|
326
|
+
const triggerClasses = computed(() => ({
|
|
327
|
+
'sk-color-picker-trigger': true,
|
|
328
|
+
}));
|
|
329
|
+
|
|
330
|
+
const panelClasses = computed(() => ({
|
|
331
|
+
'sk-color-picker-panel': true,
|
|
332
|
+
[`sk-${ effectiveKind.value }`]: true,
|
|
333
|
+
}));
|
|
334
|
+
|
|
335
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
336
|
+
|
|
337
|
+
const customColorStyles = useCustomColors(
|
|
338
|
+
'color-picker',
|
|
339
|
+
toRef(() => props.baseColor),
|
|
340
|
+
toRef(() => props.textColor)
|
|
341
|
+
);
|
|
342
|
+
|
|
343
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
344
|
+
|
|
345
|
+
function onColorChange(value : string | ColorObject | null) : void
|
|
346
|
+
{
|
|
347
|
+
if(typeof value === 'string')
|
|
348
|
+
{
|
|
349
|
+
modelValue.value = value;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
</script>
|
|
354
|
+
|
|
355
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
export { default as SkColorPicker } from './SkColorPicker.vue';
|
|
4
|
+
export * from './types';
|
|
5
|
+
|
|
6
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
import type { ComponentKind, ComponentSize } from '@/types';
|
|
4
|
+
|
|
5
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
export type SkColorPickerKind = ComponentKind;
|
|
8
|
+
export type SkColorPickerSize = ComponentSize;
|
|
9
|
+
export type SkColorPickerFormat = 'hex' | 'hexa' | 'hsl' | 'hsla' | 'rgb' | 'rgba';
|
|
10
|
+
|
|
11
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<!----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
- ContextMenu Component
|
|
3
|
+
--------------------------------------------------------------------------------------------------------------------->
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<ContextMenuRoot>
|
|
7
|
+
<ContextMenuTrigger as-child>
|
|
8
|
+
<slot name="trigger" />
|
|
9
|
+
</ContextMenuTrigger>
|
|
10
|
+
|
|
11
|
+
<ContextMenuPortal>
|
|
12
|
+
<ContextMenuContent
|
|
13
|
+
:data-scheme="theme"
|
|
14
|
+
:class="classes"
|
|
15
|
+
:style="customColorStyles"
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</ContextMenuContent>
|
|
19
|
+
</ContextMenuPortal>
|
|
20
|
+
</ContextMenuRoot>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
24
|
+
|
|
25
|
+
<style lang="scss" scoped>
|
|
26
|
+
// Component styles use shared menu styles from /src/styles/components/_menu.scss
|
|
27
|
+
</style>
|
|
28
|
+
|
|
29
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
30
|
+
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import { computed, provide, toRef } from 'vue';
|
|
33
|
+
import {
|
|
34
|
+
ContextMenuContent,
|
|
35
|
+
ContextMenuPortal,
|
|
36
|
+
ContextMenuRoot,
|
|
37
|
+
ContextMenuTrigger,
|
|
38
|
+
} from 'reka-ui';
|
|
39
|
+
|
|
40
|
+
// Types
|
|
41
|
+
import type { ComponentCustomColors } from '@/types';
|
|
42
|
+
import type { SkContextMenuKind } from './types';
|
|
43
|
+
|
|
44
|
+
// Composables
|
|
45
|
+
import { useCustomColors } from '@/composables/useCustomColors';
|
|
46
|
+
import { usePortalContext } from '@/composables/usePortalContext';
|
|
47
|
+
|
|
48
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
49
|
+
|
|
50
|
+
export interface SkContextMenuComponentProps extends ComponentCustomColors
|
|
51
|
+
{
|
|
52
|
+
kind ?: SkContextMenuKind;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
56
|
+
|
|
57
|
+
const props = withDefaults(defineProps<SkContextMenuComponentProps>(), {
|
|
58
|
+
kind: 'neutral',
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
const { theme } = usePortalContext();
|
|
64
|
+
|
|
65
|
+
provide('context-menu-kind', computed(() => props.kind));
|
|
66
|
+
|
|
67
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
68
|
+
|
|
69
|
+
const classes = computed(() => ({
|
|
70
|
+
'sk-menu-content': true,
|
|
71
|
+
[`sk-${ props.kind }`]: true,
|
|
72
|
+
}));
|
|
73
|
+
|
|
74
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
const customColorStyles = useCustomColors(
|
|
77
|
+
'menu',
|
|
78
|
+
toRef(() => props.baseColor),
|
|
79
|
+
toRef(() => props.textColor)
|
|
80
|
+
);
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<!----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
- ContextMenuCheckboxItem Component
|
|
3
|
+
--------------------------------------------------------------------------------------------------------------------->
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<ContextMenuCheckboxItem
|
|
7
|
+
:class="classes"
|
|
8
|
+
:model-value="modelValue"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
@update:model-value="$emit('update:modelValue', $event)"
|
|
11
|
+
@select.prevent
|
|
12
|
+
>
|
|
13
|
+
<ContextMenuItemIndicator class="sk-menu-item-indicator">
|
|
14
|
+
<svg
|
|
15
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
16
|
+
viewBox="0 0 24 24"
|
|
17
|
+
fill="none"
|
|
18
|
+
stroke="currentColor"
|
|
19
|
+
stroke-width="3"
|
|
20
|
+
stroke-linecap="square"
|
|
21
|
+
stroke-linejoin="miter"
|
|
22
|
+
style="width: 0.875rem; height: 0.875rem;"
|
|
23
|
+
>
|
|
24
|
+
<polyline points="4 12 10 18 20 6" />
|
|
25
|
+
</svg>
|
|
26
|
+
</ContextMenuItemIndicator>
|
|
27
|
+
<slot />
|
|
28
|
+
</ContextMenuCheckboxItem>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
32
|
+
|
|
33
|
+
<style lang="scss" scoped>
|
|
34
|
+
// Component styles are in /src/styles/components/_menu.scss
|
|
35
|
+
</style>
|
|
36
|
+
|
|
37
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
38
|
+
|
|
39
|
+
<script setup lang="ts">
|
|
40
|
+
import { computed } from 'vue';
|
|
41
|
+
import { ContextMenuCheckboxItem, ContextMenuItemIndicator } from 'reka-ui';
|
|
42
|
+
|
|
43
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
44
|
+
|
|
45
|
+
export interface SkContextMenuCheckboxItemComponentProps
|
|
46
|
+
{
|
|
47
|
+
modelValue ?: boolean;
|
|
48
|
+
disabled ?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
52
|
+
|
|
53
|
+
withDefaults(defineProps<SkContextMenuCheckboxItemComponentProps>(), {
|
|
54
|
+
modelValue: false,
|
|
55
|
+
disabled: false,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
59
|
+
|
|
60
|
+
defineEmits<{
|
|
61
|
+
'update:modelValue' : [value : boolean];
|
|
62
|
+
}>();
|
|
63
|
+
|
|
64
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
const classes = computed(() => ({
|
|
67
|
+
'sk-menu-item': true,
|
|
68
|
+
'sk-menu-checkbox-item': true,
|
|
69
|
+
}));
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
- ContextMenuItem Component
|
|
3
|
+
--------------------------------------------------------------------------------------------------------------------->
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<ContextMenuItem :class="classes" :disabled="disabled" @click="$emit('click', $event)">
|
|
7
|
+
<slot />
|
|
8
|
+
</ContextMenuItem>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
12
|
+
|
|
13
|
+
<style lang="scss" scoped>
|
|
14
|
+
// Component styles are in /src/styles/components/_menu.scss
|
|
15
|
+
</style>
|
|
16
|
+
|
|
17
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
18
|
+
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { computed } from 'vue';
|
|
21
|
+
import { ContextMenuItem } from 'reka-ui';
|
|
22
|
+
|
|
23
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
export interface SkContextMenuItemComponentProps
|
|
26
|
+
{
|
|
27
|
+
disabled ?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
withDefaults(defineProps<SkContextMenuItemComponentProps>(), {
|
|
33
|
+
disabled: false,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
defineEmits<{
|
|
39
|
+
click : [event : Event];
|
|
40
|
+
}>();
|
|
41
|
+
|
|
42
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
const classes = computed(() => ({
|
|
45
|
+
'sk-menu-item': true,
|
|
46
|
+
}));
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
- ContextMenuLabel Component
|
|
3
|
+
--------------------------------------------------------------------------------------------------------------------->
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<ContextMenuLabel class="sk-menu-label">
|
|
7
|
+
<slot />
|
|
8
|
+
</ContextMenuLabel>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { ContextMenuLabel } from 'reka-ui';
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<!----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
- ContextMenuRadioGroup Component
|
|
3
|
+
--------------------------------------------------------------------------------------------------------------------->
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<ContextMenuRadioGroup :model-value="modelValue" @update:model-value="$emit('update:modelValue', $event)">
|
|
7
|
+
<slot />
|
|
8
|
+
</ContextMenuRadioGroup>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { ContextMenuRadioGroup } from 'reka-ui';
|
|
15
|
+
|
|
16
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
export interface SkContextMenuRadioGroupComponentProps
|
|
19
|
+
{
|
|
20
|
+
modelValue ?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
withDefaults(defineProps<SkContextMenuRadioGroupComponentProps>(), {
|
|
26
|
+
modelValue: '',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
defineEmits<{
|
|
32
|
+
'update:modelValue' : [value : string];
|
|
33
|
+
}>();
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|