@skewedaspect/sleekspace-ui 0.5.1 → 0.7.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.
Files changed (121) hide show
  1. package/dist/components/Card/SkCard.vue.d.ts +13 -1
  2. package/dist/components/ColorPicker/SkColorPicker.vue.d.ts +29 -0
  3. package/dist/components/ColorPicker/index.d.ts +2 -0
  4. package/dist/components/ColorPicker/types.d.ts +4 -0
  5. package/dist/components/ContextMenu/SkContextMenu.vue.d.ts +25 -0
  6. package/dist/components/ContextMenu/SkContextMenuCheckboxItem.vue.d.ts +28 -0
  7. package/dist/components/ContextMenu/SkContextMenuItem.vue.d.ts +26 -0
  8. package/dist/components/ContextMenu/SkContextMenuLabel.vue.d.ts +17 -0
  9. package/dist/components/ContextMenu/SkContextMenuRadioGroup.vue.d.ts +26 -0
  10. package/dist/components/ContextMenu/SkContextMenuRadioItem.vue.d.ts +23 -0
  11. package/dist/components/ContextMenu/SkContextMenuSeparator.vue.d.ts +2 -0
  12. package/dist/components/ContextMenu/SkContextMenuSubmenu.vue.d.ts +24 -0
  13. package/dist/components/ContextMenu/index.d.ts +9 -0
  14. package/dist/components/ContextMenu/types.d.ts +2 -0
  15. package/dist/components/Dropdown/SkDropdown.vue.d.ts +1 -1
  16. package/dist/components/Dropdown/SkDropdownCheckboxItem.vue.d.ts +28 -0
  17. package/dist/components/Dropdown/SkDropdownMenuLabel.vue.d.ts +17 -0
  18. package/dist/components/Dropdown/SkDropdownRadioGroup.vue.d.ts +26 -0
  19. package/dist/components/Dropdown/SkDropdownRadioItem.vue.d.ts +23 -0
  20. package/dist/components/Dropdown/index.d.ts +4 -0
  21. package/dist/components/Panel/SkPanel.vue.d.ts +15 -1
  22. package/dist/components/Panel/types.d.ts +1 -0
  23. package/dist/components/Popover/SkPopover.vue.d.ts +1 -1
  24. package/dist/components/ScrollArea/SkScrollArea.vue.d.ts +31 -0
  25. package/dist/components/ScrollArea/index.d.ts +2 -0
  26. package/dist/components/ScrollArea/types.d.ts +4 -0
  27. package/dist/components/Select/SkSelect.vue.d.ts +61 -0
  28. package/dist/components/Select/SkSelectItem.vue.d.ts +134 -0
  29. package/dist/components/Select/SkSelectSeparator.vue.d.ts +2 -0
  30. package/dist/components/Select/index.d.ts +4 -0
  31. package/dist/components/Select/types.d.ts +3 -0
  32. package/dist/components/Sidebar/SkSidebar.vue.d.ts +8 -1
  33. package/dist/components/Sidebar/types.d.ts +1 -0
  34. package/dist/components/Skeleton/SkSkeleton.vue.d.ts +2 -2
  35. package/dist/components/Splitter/SkSplitter.vue.d.ts +29 -0
  36. package/dist/components/Splitter/SkSplitterHandle.vue.d.ts +7 -0
  37. package/dist/components/Splitter/SkSplitterPanel.vue.d.ts +30 -0
  38. package/dist/components/Splitter/index.d.ts +4 -0
  39. package/dist/components/Splitter/types.d.ts +3 -0
  40. package/dist/components/Toolbar/SkToolbar.vue.d.ts +31 -0
  41. package/dist/components/Toolbar/SkToolbarButton.vue.d.ts +22 -0
  42. package/dist/components/Toolbar/SkToolbarSeparator.vue.d.ts +2 -0
  43. package/dist/components/Toolbar/SkToolbarToggleGroup.vue.d.ts +31 -0
  44. package/dist/components/Toolbar/SkToolbarToggleItem.vue.d.ts +23 -0
  45. package/dist/components/Toolbar/index.d.ts +6 -0
  46. package/dist/components/Toolbar/types.d.ts +5 -0
  47. package/dist/components/Tooltip/SkTooltip.vue.d.ts +1 -1
  48. package/dist/components/TreeView/SkTreeItem.vue.d.ts +39 -0
  49. package/dist/components/TreeView/SkTreeView.vue.d.ts +31 -0
  50. package/dist/components/TreeView/index.d.ts +3 -0
  51. package/dist/components/TreeView/types.d.ts +3 -0
  52. package/dist/index.d.ts +61 -0
  53. package/dist/sleekspace-ui.css +1644 -65
  54. package/dist/sleekspace-ui.es.js +17444 -6063
  55. package/dist/sleekspace-ui.umd.js +17426 -6045
  56. package/package.json +2 -1
  57. package/src/components/Card/SkCard.vue +17 -1
  58. package/src/components/ColorPicker/SkColorPicker.vue +355 -0
  59. package/src/components/ColorPicker/index.ts +6 -0
  60. package/src/components/ColorPicker/types.ts +11 -0
  61. package/src/components/ContextMenu/SkContextMenu.vue +83 -0
  62. package/src/components/ContextMenu/SkContextMenuCheckboxItem.vue +72 -0
  63. package/src/components/ContextMenu/SkContextMenuItem.vue +49 -0
  64. package/src/components/ContextMenu/SkContextMenuLabel.vue +17 -0
  65. package/src/components/ContextMenu/SkContextMenuRadioGroup.vue +36 -0
  66. package/src/components/ContextMenu/SkContextMenuRadioItem.vue +53 -0
  67. package/src/components/ContextMenu/SkContextMenuSeparator.vue +21 -0
  68. package/src/components/ContextMenu/SkContextMenuSubmenu.vue +94 -0
  69. package/src/components/ContextMenu/index.ts +15 -0
  70. package/src/components/ContextMenu/types.ts +9 -0
  71. package/src/components/Dropdown/SkDropdown.vue +1 -1
  72. package/src/components/Dropdown/SkDropdownCheckboxItem.vue +72 -0
  73. package/src/components/Dropdown/SkDropdownMenuItem.vue +1 -1
  74. package/src/components/Dropdown/SkDropdownMenuLabel.vue +17 -0
  75. package/src/components/Dropdown/SkDropdownRadioGroup.vue +36 -0
  76. package/src/components/Dropdown/SkDropdownRadioItem.vue +53 -0
  77. package/src/components/Dropdown/SkDropdownSubmenu.vue +2 -2
  78. package/src/components/Dropdown/index.ts +4 -0
  79. package/src/components/Panel/SkPanel.vue +29 -4
  80. package/src/components/Panel/types.ts +3 -0
  81. package/src/components/ScrollArea/SkScrollArea.vue +87 -0
  82. package/src/components/ScrollArea/index.ts +8 -0
  83. package/src/components/ScrollArea/types.ts +11 -0
  84. package/src/components/Select/SkSelect.vue +210 -0
  85. package/src/components/Select/SkSelectItem.vue +112 -0
  86. package/src/components/Select/SkSelectSeparator.vue +40 -0
  87. package/src/components/Select/index.ts +10 -0
  88. package/src/components/Select/types.ts +10 -0
  89. package/src/components/Sidebar/SkSidebar.vue +39 -2
  90. package/src/components/Sidebar/types.ts +2 -0
  91. package/src/components/Splitter/SkSplitter.vue +65 -0
  92. package/src/components/Splitter/SkSplitterHandle.vue +40 -0
  93. package/src/components/Splitter/SkSplitterPanel.vue +45 -0
  94. package/src/components/Splitter/index.ts +10 -0
  95. package/src/components/Splitter/types.ts +10 -0
  96. package/src/components/Toolbar/SkToolbar.vue +69 -0
  97. package/src/components/Toolbar/SkToolbarButton.vue +36 -0
  98. package/src/components/Toolbar/SkToolbarSeparator.vue +15 -0
  99. package/src/components/Toolbar/SkToolbarToggleGroup.vue +49 -0
  100. package/src/components/Toolbar/SkToolbarToggleItem.vue +37 -0
  101. package/src/components/Toolbar/index.ts +12 -0
  102. package/src/components/Toolbar/types.ts +12 -0
  103. package/src/components/TreeView/SkTreeItem.vue +84 -0
  104. package/src/components/TreeView/SkTreeView.vue +120 -0
  105. package/src/components/TreeView/index.ts +9 -0
  106. package/src/components/TreeView/types.ts +10 -0
  107. package/src/global.d.ts +22 -0
  108. package/src/index.ts +110 -0
  109. package/src/styles/components/_card.scss +45 -9
  110. package/src/styles/components/_color-picker.scss +552 -0
  111. package/src/styles/components/_index.scss +6 -0
  112. package/src/styles/components/_listbox.scss +1 -0
  113. package/src/styles/components/_menu.scss +52 -3
  114. package/src/styles/components/_panel.scss +119 -13
  115. package/src/styles/components/_scroll-area.scss +120 -0
  116. package/src/styles/components/_select.scss +439 -0
  117. package/src/styles/components/_sidebar.scss +83 -4
  118. package/src/styles/components/_splitter.scss +136 -0
  119. package/src/styles/components/_toolbar.scss +296 -0
  120. package/src/styles/components/_tree-view.scss +187 -0
  121. package/web-types.json +1244 -197
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skewedaspect/sleekspace-ui",
3
- "version": "0.5.1",
3
+ "version": "0.7.0",
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
  }
@@ -10,6 +10,8 @@
10
10
  :no-border="noBorder"
11
11
  :base-color="baseColor"
12
12
  :text-color="textColor"
13
+ :corners="corners"
14
+ :decoration-corner="decorationCorner"
13
15
  :class="classes"
14
16
  >
15
17
  <div v-if="title || $slots.header" class="sk-card-header" :style="headerStyles">
@@ -66,7 +68,7 @@
66
68
  // Types
67
69
  import type { ComponentCustomColors } from '@/types';
68
70
  import type { SkCardKind } from './types';
69
- import type { SkPanelSize } from '../Panel/types';
71
+ import type { SkPanelCorner, SkPanelSize } from '../Panel/types';
70
72
 
71
73
  // Components
72
74
  import SkPanel from '../Panel/SkPanel.vue';
@@ -136,6 +138,18 @@
136
138
  * @default false
137
139
  */
138
140
  scrollable ?: boolean;
141
+
142
+ /**
143
+ * Which corners receive the beveled cut. Passed through to the underlying SkPanel.
144
+ * @default ['bottom-right']
145
+ */
146
+ corners ?: SkPanelCorner[];
147
+
148
+ /**
149
+ * Which corner displays the decorative accent stripe. Passed through to SkPanel.
150
+ * @default 'bottom-right'
151
+ */
152
+ decorationCorner ?: SkPanelCorner;
139
153
  }
140
154
 
141
155
  //------------------------------------------------------------------------------------------------------------------
@@ -149,6 +163,8 @@
149
163
  title: undefined,
150
164
  headerColor: undefined,
151
165
  scrollable: false,
166
+ corners: () => [ 'bottom-right' ],
167
+ decorationCorner: 'bottom-right',
152
168
  });
153
169
 
154
170
  //------------------------------------------------------------------------------------------------------------------
@@ -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
+ <!--------------------------------------------------------------------------------------------------------------------->