@poirazis/supercomponents-shared 0.0.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/LICENSE +21 -0
- package/README.md +66 -0
- package/dist/index.js +30635 -0
- package/dist/index.umd.cjs +12 -0
- package/dist/style.css +1 -0
- package/package.json +117 -0
- package/src/index.js +29 -0
- package/src/index.ts +31 -0
- package/src/lib/Actions/autoresize_textarea.js +14 -0
- package/src/lib/Actions/click_outside.js +80 -0
- package/src/lib/Actions/index.js +4 -0
- package/src/lib/Actions/position_dropdown.js +129 -0
- package/src/lib/SuperButton/SuperButton.svelte +341 -0
- package/src/lib/SuperFieldLabel/SuperFieldLabel.svelte +91 -0
- package/src/lib/SuperFieldsCommon.css +54 -0
- package/src/lib/SuperList/SuperList.svelte +308 -0
- package/src/lib/SuperList/drag-handle.svelte +31 -0
- package/src/lib/SuperPopover/SuperPopover.svelte +134 -0
- package/src/lib/SuperTable/SuperTable.css +410 -0
- package/src/lib/SuperTable/SuperTable.svelte +1332 -0
- package/src/lib/SuperTable/constants.js +85 -0
- package/src/lib/SuperTable/controls/ColumnsSection.svelte +34 -0
- package/src/lib/SuperTable/controls/ControlSection.svelte +3 -0
- package/src/lib/SuperTable/controls/RowButtonsColumn.svelte +169 -0
- package/src/lib/SuperTable/controls/SelectionColumn.svelte +174 -0
- package/src/lib/SuperTable/controls/SuperTableWelcome.svelte +58 -0
- package/src/lib/SuperTable/overlays/AddNewRowOverlay.svelte +52 -0
- package/src/lib/SuperTable/overlays/EmptyResultSetOverlay.svelte +13 -0
- package/src/lib/SuperTable/overlays/LoadingOverlay.svelte +3 -0
- package/src/lib/SuperTable/overlays/RowContextMenu copy.svelte +57 -0
- package/src/lib/SuperTable/overlays/RowContextMenu.svelte +58 -0
- package/src/lib/SuperTable/overlays/ScrollbarsOverlay.svelte +184 -0
- package/src/lib/SuperTable/overlays/SelectedActionsOverlay.svelte +64 -0
- package/src/lib/SuperTable/state/API.js +0 -0
- package/src/lib/SuperTable/state/SuperTableStateMachine.js +0 -0
- package/src/lib/SuperTable/types.js +0 -0
- package/src/lib/SuperTableCells/CellAttachment.svelte +288 -0
- package/src/lib/SuperTableCells/CellBoolean.svelte +158 -0
- package/src/lib/SuperTableCells/CellColor.svelte +460 -0
- package/src/lib/SuperTableCells/CellCommon.css +319 -0
- package/src/lib/SuperTableCells/CellDatetime.svelte +180 -0
- package/src/lib/SuperTableCells/CellIcon.svelte +627 -0
- package/src/lib/SuperTableCells/CellJSON.svelte +297 -0
- package/src/lib/SuperTableCells/CellLink.svelte +274 -0
- package/src/lib/SuperTableCells/CellLinkAdvanced.svelte +298 -0
- package/src/lib/SuperTableCells/CellLinkPickerSelect.svelte +355 -0
- package/src/lib/SuperTableCells/CellLinkPickerTable.svelte +91 -0
- package/src/lib/SuperTableCells/CellLinkPickerTree.svelte +226 -0
- package/src/lib/SuperTableCells/CellNumber.svelte +179 -0
- package/src/lib/SuperTableCells/CellNumberSimple.svelte +56 -0
- package/src/lib/SuperTableCells/CellOptions.svelte +631 -0
- package/src/lib/SuperTableCells/CellOptionsAdvanced.svelte +684 -0
- package/src/lib/SuperTableCells/CellSkeleton.svelte +59 -0
- package/src/lib/SuperTableCells/CellString.svelte +178 -0
- package/src/lib/SuperTableCells/CellStringSimple.svelte +55 -0
- package/src/lib/SuperTableCells/index.js +21 -0
- package/src/lib/SuperTableCells/remixIcons.js +6772 -0
- package/src/lib/SuperTableColumn/SuperTableColumn.svelte +392 -0
- package/src/lib/SuperTableColumn/index.js +9 -0
- package/src/lib/SuperTableColumn/parts/SuperColumnBody.svelte +57 -0
- package/src/lib/SuperTableColumn/parts/SuperColumnFooter.svelte +14 -0
- package/src/lib/SuperTableColumn/parts/SuperColumnHeader.svelte +228 -0
- package/src/lib/SuperTableColumn/parts/SuperColumnRow.svelte +142 -0
- package/src/lib/SuperTableColumn/parts/SuperColumnRowNew.svelte +34 -0
- package/src/lib/SuperTree/SuperTree.svelte +117 -0
- package/src/types/svelte-portal.d.ts +1 -0
@@ -0,0 +1,158 @@
|
|
1
|
+
<script>
|
2
|
+
import { createEventDispatcher, getContext } from "svelte";
|
3
|
+
import fsm from "svelte-fsm";
|
4
|
+
import "./CellCommon.css";
|
5
|
+
|
6
|
+
export let value;
|
7
|
+
export let formattedValue;
|
8
|
+
export let cellOptions;
|
9
|
+
|
10
|
+
let originalValue = value;
|
11
|
+
let editor;
|
12
|
+
|
13
|
+
const dispatch = createEventDispatcher();
|
14
|
+
const { processStringSync } = getContext("sdk");
|
15
|
+
|
16
|
+
export let cellState = fsm(cellOptions.initialState ?? "View", {
|
17
|
+
"*": {
|
18
|
+
goTo(state) {
|
19
|
+
return state;
|
20
|
+
},
|
21
|
+
},
|
22
|
+
View: {
|
23
|
+
focus() {
|
24
|
+
if (!cellOptions.readonly && !cellOptions.disabled) return "Editing";
|
25
|
+
editor?.focus();
|
26
|
+
},
|
27
|
+
},
|
28
|
+
Hovered: {
|
29
|
+
cancel: () => {
|
30
|
+
return "View";
|
31
|
+
},
|
32
|
+
},
|
33
|
+
Focused: {
|
34
|
+
unfocus() {
|
35
|
+
return "View";
|
36
|
+
},
|
37
|
+
},
|
38
|
+
Error: { check: "View" },
|
39
|
+
Editing: {
|
40
|
+
_enter() {
|
41
|
+
originalValue = value;
|
42
|
+
editor?.focus();
|
43
|
+
dispatch("enteredit");
|
44
|
+
},
|
45
|
+
_exit() {
|
46
|
+
dispatch("exitedit");
|
47
|
+
},
|
48
|
+
focus() {
|
49
|
+
if (!cellOptions.readonly && !cellOptions.disabled) return "Editing";
|
50
|
+
editor?.focus();
|
51
|
+
},
|
52
|
+
change(e) {
|
53
|
+
if (cellOptions.debounce) dispatch("change", value);
|
54
|
+
},
|
55
|
+
submit() {
|
56
|
+
if (value !== originalValue) {
|
57
|
+
dispatch("change", value);
|
58
|
+
}
|
59
|
+
dispatch("focusout");
|
60
|
+
return "View";
|
61
|
+
},
|
62
|
+
cancel() {
|
63
|
+
value = originalValue;
|
64
|
+
return "View";
|
65
|
+
},
|
66
|
+
},
|
67
|
+
});
|
68
|
+
|
69
|
+
$: formattedValue = cellOptions.template
|
70
|
+
? processStringSync(cellOptions.template, { value })
|
71
|
+
: undefined;
|
72
|
+
|
73
|
+
$: inline = cellOptions.role == "inlineInput";
|
74
|
+
$: inEdit = $cellState == "Editing";
|
75
|
+
$: isDirty = inEdit && originalValue !== value;
|
76
|
+
|
77
|
+
const focus = (node) => {
|
78
|
+
if (cellOptions.role == "tableCell") node.focus();
|
79
|
+
};
|
80
|
+
</script>
|
81
|
+
|
82
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
83
|
+
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
84
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
85
|
+
<div
|
86
|
+
class="superCell"
|
87
|
+
class:inEdit
|
88
|
+
class:isDirty
|
89
|
+
class:inline
|
90
|
+
class:tableCell={cellOptions.role == "tableCell"}
|
91
|
+
class:formInput={cellOptions.role == "formInput"}
|
92
|
+
class:disabled={cellOptions.disabled}
|
93
|
+
class:readonly={cellOptions.readonly}
|
94
|
+
style:color={cellOptions.color}
|
95
|
+
style:background={$cellState == "Editing" && cellOptions.role != "inline"
|
96
|
+
? "var(--spectrum-global-color-gray-50)"
|
97
|
+
: cellOptions.background}
|
98
|
+
style:font-weight={cellOptions.fontWeight}
|
99
|
+
style:padding-top={"unset"}
|
100
|
+
style:padding-bottom={"unset"}
|
101
|
+
>
|
102
|
+
{#if cellOptions.icon}
|
103
|
+
<i class={cellOptions.icon + " frontIcon"}></i>
|
104
|
+
{/if}
|
105
|
+
|
106
|
+
{#if $cellState == "Editing" || cellOptions.role != "tableCell"}
|
107
|
+
<div
|
108
|
+
class="editor"
|
109
|
+
style:padding-left={cellOptions.icon ? "32px" : cellOptions.padding}
|
110
|
+
style:padding-right={cellOptions.clearValueIcon
|
111
|
+
? "32px"
|
112
|
+
: cellOptions.padding}
|
113
|
+
style:justify-content={cellOptions.align ?? "center"}
|
114
|
+
>
|
115
|
+
<div
|
116
|
+
class="spectrum-Switch spectrum-Switch--emphasized"
|
117
|
+
style:--spectrum-switch-height={"22px"}
|
118
|
+
style:margin={0}
|
119
|
+
>
|
120
|
+
<input
|
121
|
+
class="spectrum-Switch-input"
|
122
|
+
bind:checked={value}
|
123
|
+
bind:this={editor}
|
124
|
+
type="checkbox"
|
125
|
+
disabled={cellOptions.disabled || cellOptions.readonly}
|
126
|
+
on:focusin={cellState.focus}
|
127
|
+
on:focusout={cellState.submit}
|
128
|
+
on:change={cellState.change}
|
129
|
+
use:focus
|
130
|
+
/>
|
131
|
+
<span class="spectrum-Switch-switch" />
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
{:else}
|
135
|
+
<div
|
136
|
+
class="value"
|
137
|
+
tabIndex="0"
|
138
|
+
style:justify-content={cellOptions.align ?? "center"}
|
139
|
+
style:padding-left={cellOptions.icon ? "32px" : cellOptions.padding}
|
140
|
+
on:focusin={cellState.focus}
|
141
|
+
>
|
142
|
+
{#if formattedValue}
|
143
|
+
{formattedValue}
|
144
|
+
{:else if value}
|
145
|
+
<i class="ri-check-line icon"></i>
|
146
|
+
{:else if cellOptions.showFalse}
|
147
|
+
<i class="ri-close-line icon"></i>
|
148
|
+
{/if}
|
149
|
+
</div>
|
150
|
+
{/if}
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<style>
|
154
|
+
.icon {
|
155
|
+
font-size: 16px;
|
156
|
+
color: var(--spectrum-global-color-green-400);
|
157
|
+
}
|
158
|
+
</style>
|
@@ -0,0 +1,460 @@
|
|
1
|
+
<script>
|
2
|
+
import SuperPopover from "../SuperPopover/SuperPopover.svelte";
|
3
|
+
import { createEventDispatcher } from "svelte";
|
4
|
+
|
5
|
+
export let value;
|
6
|
+
export let size = "M";
|
7
|
+
export let spectrumTheme;
|
8
|
+
export let offset;
|
9
|
+
export let align;
|
10
|
+
export let cellState;
|
11
|
+
export let cellOptions = {};
|
12
|
+
|
13
|
+
let open = false;
|
14
|
+
let preview;
|
15
|
+
let inEdit = false;
|
16
|
+
|
17
|
+
$: customValue = getCustomValue(value);
|
18
|
+
$: checkColor = getCheckColor(value);
|
19
|
+
$: allowCustom = cellOptions?.allowCustom;
|
20
|
+
$: circle = cellOptions?.swatch === "circle";
|
21
|
+
$: readonly = cellOptions?.readonly || cellOptions?.disabled;
|
22
|
+
$: customColors = cellOptions?.customColors || [];
|
23
|
+
$: showTheme = cellOptions?.themeColors !== false;
|
24
|
+
$: showStatic = cellOptions?.staticColors !== false;
|
25
|
+
$: categories = generateCategories(showTheme, showStatic);
|
26
|
+
$: customCategory = generateCustomCategory(customColors);
|
27
|
+
|
28
|
+
const dispatch = createEventDispatcher();
|
29
|
+
|
30
|
+
function generateCategories(showTheme, showStatic) {
|
31
|
+
return [
|
32
|
+
...(showTheme
|
33
|
+
? [
|
34
|
+
{
|
35
|
+
label: "Theme colors",
|
36
|
+
colors: [
|
37
|
+
"red-100",
|
38
|
+
"orange-100",
|
39
|
+
"yellow-100",
|
40
|
+
"green-100",
|
41
|
+
"seafoam-100",
|
42
|
+
"blue-100",
|
43
|
+
"indigo-100",
|
44
|
+
"magenta-100",
|
45
|
+
"red-400",
|
46
|
+
"orange-400",
|
47
|
+
"yellow-400",
|
48
|
+
"green-400",
|
49
|
+
"seafoam-400",
|
50
|
+
"blue-400",
|
51
|
+
"indigo-400",
|
52
|
+
"magenta-400",
|
53
|
+
"red-500",
|
54
|
+
"orange-500",
|
55
|
+
"yellow-500",
|
56
|
+
"green-500",
|
57
|
+
"seafoam-500",
|
58
|
+
"blue-500",
|
59
|
+
"indigo-500",
|
60
|
+
"magenta-500",
|
61
|
+
"red-600",
|
62
|
+
"orange-600",
|
63
|
+
"yellow-600",
|
64
|
+
"green-600",
|
65
|
+
"seafoam-600",
|
66
|
+
"blue-600",
|
67
|
+
"indigo-600",
|
68
|
+
"magenta-600",
|
69
|
+
"red-700",
|
70
|
+
"orange-700",
|
71
|
+
"yellow-700",
|
72
|
+
"green-700",
|
73
|
+
"seafoam-700",
|
74
|
+
"blue-700",
|
75
|
+
"indigo-700",
|
76
|
+
"magenta-700",
|
77
|
+
"gray-50",
|
78
|
+
"gray-75",
|
79
|
+
"gray-100",
|
80
|
+
"gray-200",
|
81
|
+
"gray-300",
|
82
|
+
"gray-400",
|
83
|
+
"gray-500",
|
84
|
+
"gray-600",
|
85
|
+
"gray-700",
|
86
|
+
"gray-800",
|
87
|
+
"gray-900",
|
88
|
+
],
|
89
|
+
},
|
90
|
+
]
|
91
|
+
: []),
|
92
|
+
...(showStatic
|
93
|
+
? [
|
94
|
+
{
|
95
|
+
label: "Static colors",
|
96
|
+
colors: [
|
97
|
+
"static-red-400",
|
98
|
+
"static-orange-400",
|
99
|
+
"static-yellow-400",
|
100
|
+
"static-green-400",
|
101
|
+
"static-seafoam-400",
|
102
|
+
"static-blue-400",
|
103
|
+
"static-indigo-400",
|
104
|
+
"static-magenta-400",
|
105
|
+
"static-red-800",
|
106
|
+
"static-orange-800",
|
107
|
+
"static-yellow-800",
|
108
|
+
"static-green-800",
|
109
|
+
"static-seafoam-800",
|
110
|
+
"static-blue-800",
|
111
|
+
"static-indigo-800",
|
112
|
+
"static-magenta-800",
|
113
|
+
"static-red-1200",
|
114
|
+
"static-orange-1200",
|
115
|
+
"static-yellow-1200",
|
116
|
+
"static-green-1200",
|
117
|
+
"static-seafoam-1200",
|
118
|
+
"static-blue-1200",
|
119
|
+
"static-indigo-1200",
|
120
|
+
"static-magenta-1200",
|
121
|
+
"static-white",
|
122
|
+
"static-black",
|
123
|
+
],
|
124
|
+
},
|
125
|
+
]
|
126
|
+
: []),
|
127
|
+
];
|
128
|
+
}
|
129
|
+
|
130
|
+
function generateCustomCategory(customColors) {
|
131
|
+
return {
|
132
|
+
label: "Palette",
|
133
|
+
colors: customColors.map((color) => color.value),
|
134
|
+
customLabels: customColors.reduce((acc, color) => {
|
135
|
+
acc[color.value] = color.label;
|
136
|
+
return acc;
|
137
|
+
}, {}),
|
138
|
+
};
|
139
|
+
}
|
140
|
+
|
141
|
+
const onChange = (newValue) => {
|
142
|
+
const selectedValue = newValue === value ? null : newValue;
|
143
|
+
value = selectedValue;
|
144
|
+
dispatch("change", selectedValue);
|
145
|
+
open = false;
|
146
|
+
inEdit = false;
|
147
|
+
};
|
148
|
+
|
149
|
+
const getCustomValue = (value) => {
|
150
|
+
if (!value) return value;
|
151
|
+
const isThemeOrStatic = categories?.some((category) =>
|
152
|
+
category.colors.some(
|
153
|
+
(color) => `var(--spectrum-global-color-${color})` === value
|
154
|
+
)
|
155
|
+
);
|
156
|
+
return isThemeOrStatic ? null : value;
|
157
|
+
};
|
158
|
+
|
159
|
+
const prettyPrint = (color, category) => {
|
160
|
+
if (category.customLabels && category.customLabels[color]) {
|
161
|
+
return category.customLabels[color];
|
162
|
+
}
|
163
|
+
return color.split("-").join(" ");
|
164
|
+
};
|
165
|
+
|
166
|
+
const getCheckColor = (value) => {
|
167
|
+
if (!value) return "var(--spectrum-global-color-static-gray-900)";
|
168
|
+
if (value.includes("-gray-")) {
|
169
|
+
return /^.*(gray-(50|75|100|200|300|400|500))\)$/.test(value)
|
170
|
+
? "var(--spectrum-global-color-gray-900)"
|
171
|
+
: "var(--spectrum-global-color-gray-50)";
|
172
|
+
}
|
173
|
+
if (value.includes("-100")) {
|
174
|
+
return "var(--spectrum-global-color-gray-900)";
|
175
|
+
}
|
176
|
+
if (value.includes("static-black")) {
|
177
|
+
return "var(--spectrum-global-color-static-gray-50)";
|
178
|
+
}
|
179
|
+
return "var(--spectrum-global-color-static-gray-900)";
|
180
|
+
};
|
181
|
+
|
182
|
+
const handleKeydown = (event, color, isCustom) => {
|
183
|
+
if (event.key === "Enter" || event.key === " ") {
|
184
|
+
event.preventDefault();
|
185
|
+
onChange(isCustom ? color : `var(--spectrum-global-color-${color})`);
|
186
|
+
}
|
187
|
+
};
|
188
|
+
</script>
|
189
|
+
|
190
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
191
|
+
<div
|
192
|
+
bind:this={preview}
|
193
|
+
class="preview-swatch size--{size || 'M'}"
|
194
|
+
class:circle
|
195
|
+
class:readonly
|
196
|
+
on:click={!readonly
|
197
|
+
? () => {
|
198
|
+
inEdit = true;
|
199
|
+
open = !open;
|
200
|
+
}
|
201
|
+
: null}
|
202
|
+
on:keydown={(event) => {
|
203
|
+
if (event.key === "Enter" || (event.key === " " && !readonly)) {
|
204
|
+
inEdit = true;
|
205
|
+
open = !open;
|
206
|
+
}
|
207
|
+
}}
|
208
|
+
role="button"
|
209
|
+
tabindex="0"
|
210
|
+
>
|
211
|
+
<div
|
212
|
+
class="preview-fill {spectrumTheme || ''}"
|
213
|
+
class:circle
|
214
|
+
style={value ? `background: ${value};` : ""}
|
215
|
+
class:placeholder={!value}
|
216
|
+
/>
|
217
|
+
</div>
|
218
|
+
|
219
|
+
{#if inEdit}
|
220
|
+
<SuperPopover anchor={preview} {open} align="left" {offset}>
|
221
|
+
<div class="container">
|
222
|
+
{#each categories as category}
|
223
|
+
<div class="category">
|
224
|
+
<div class="heading">{category.label}</div>
|
225
|
+
<div class="colors">
|
226
|
+
{#each category.colors as color}
|
227
|
+
<div
|
228
|
+
on:click={() =>
|
229
|
+
onChange(`var(--spectrum-global-color-${color})`)}
|
230
|
+
on:keydown={(event) => handleKeydown(event, color, false)}
|
231
|
+
class="color-swatch"
|
232
|
+
title={prettyPrint(color, category)}
|
233
|
+
role="button"
|
234
|
+
tabindex="0"
|
235
|
+
>
|
236
|
+
<div
|
237
|
+
class="color-fill {spectrumTheme || ''}"
|
238
|
+
style="background: var(--spectrum-global-color-{color});"
|
239
|
+
>
|
240
|
+
{#if value === `var(--spectrum-global-color-${color})`}
|
241
|
+
<i class="ri-check-line" style="color: {checkColor};" />
|
242
|
+
{/if}
|
243
|
+
</div>
|
244
|
+
</div>
|
245
|
+
{/each}
|
246
|
+
</div>
|
247
|
+
</div>
|
248
|
+
{/each}
|
249
|
+
{#if customCategory.colors.length > 0}
|
250
|
+
<div class="category">
|
251
|
+
<div class="heading">
|
252
|
+
<i class="ri-palette-line heading-icon" />
|
253
|
+
{customCategory.label}
|
254
|
+
</div>
|
255
|
+
<div class="colors">
|
256
|
+
{#each customCategory.colors as color}
|
257
|
+
<div
|
258
|
+
on:click={() => onChange(color)}
|
259
|
+
on:keydown={(event) => handleKeydown(event, color, true)}
|
260
|
+
class="color-swatch"
|
261
|
+
title={prettyPrint(color, customCategory)}
|
262
|
+
role="button"
|
263
|
+
tabindex="0"
|
264
|
+
>
|
265
|
+
<div
|
266
|
+
class="color-fill {spectrumTheme || ''}"
|
267
|
+
style="background: {color};"
|
268
|
+
>
|
269
|
+
{#if value === color}
|
270
|
+
<i class="ri-check-line" style="color: {checkColor};" />
|
271
|
+
{/if}
|
272
|
+
</div>
|
273
|
+
</div>
|
274
|
+
{/each}
|
275
|
+
</div>
|
276
|
+
</div>
|
277
|
+
{/if}
|
278
|
+
{#if allowCustom}
|
279
|
+
<div class="category category--custom">
|
280
|
+
<div class="heading">Custom</div>
|
281
|
+
<div class="custom">
|
282
|
+
<input
|
283
|
+
type="text"
|
284
|
+
class="custom-input"
|
285
|
+
bind:value={customValue}
|
286
|
+
on:change={() => {
|
287
|
+
if (customValue) onChange(customValue);
|
288
|
+
}}
|
289
|
+
placeholder="Enter custom color"
|
290
|
+
/>
|
291
|
+
<button class="clear-value" on:click={() => onChange(null)}>
|
292
|
+
<i class="ri-close-line" />
|
293
|
+
</button>
|
294
|
+
</div>
|
295
|
+
</div>
|
296
|
+
{/if}
|
297
|
+
</div>
|
298
|
+
</SuperPopover>
|
299
|
+
{/if}
|
300
|
+
|
301
|
+
<style>
|
302
|
+
.container {
|
303
|
+
position: relative;
|
304
|
+
padding: 0.5rem 0.75rem 0.75rem 0.75rem;
|
305
|
+
display: flex;
|
306
|
+
flex-direction: column;
|
307
|
+
gap: 16px;
|
308
|
+
background-color: var(--spectrum-global-color-gray-50);
|
309
|
+
}
|
310
|
+
|
311
|
+
/* Preview Swatch Styles */
|
312
|
+
.preview-swatch {
|
313
|
+
position: relative;
|
314
|
+
transition: border-color 130ms ease-in-out;
|
315
|
+
|
316
|
+
&.circle {
|
317
|
+
border-radius: 50%;
|
318
|
+
}
|
319
|
+
}
|
320
|
+
.preview-swatch:hover:not(.readonly) {
|
321
|
+
cursor: pointer;
|
322
|
+
}
|
323
|
+
.preview-fill {
|
324
|
+
width: 100%;
|
325
|
+
height: 100%;
|
326
|
+
border-radius: 4px;
|
327
|
+
position: absolute;
|
328
|
+
top: 0;
|
329
|
+
left: 0;
|
330
|
+
display: grid;
|
331
|
+
place-items: center;
|
332
|
+
border: 1px solid var(--spectrum-global-color-gray-300);
|
333
|
+
&.circle {
|
334
|
+
border-radius: 50%;
|
335
|
+
}
|
336
|
+
}
|
337
|
+
.preview-fill.placeholder {
|
338
|
+
&.circle {
|
339
|
+
border-radius: 50%;
|
340
|
+
}
|
341
|
+
border: 1px solid var(--spectrum-global-color-gray-300);
|
342
|
+
--squareSize: 8px;
|
343
|
+
--squareColor: var(--spectrum-global-color-gray-200);
|
344
|
+
background-color: var(--spectrum-global-color-gray-50);
|
345
|
+
background-image: linear-gradient(
|
346
|
+
45deg,
|
347
|
+
var(--squareColor) 25%,
|
348
|
+
transparent 25%
|
349
|
+
),
|
350
|
+
linear-gradient(
|
351
|
+
135deg,
|
352
|
+
var(--spectrum-global-color-gray-200) 25%,
|
353
|
+
transparent 25%
|
354
|
+
),
|
355
|
+
linear-gradient(45deg, transparent 75%, var(--squareColor) 75%),
|
356
|
+
linear-gradient(135deg, transparent 75%, var(--squareColor) 75%);
|
357
|
+
background-size: calc(2 * var(--squareSize)) calc(2 * var(--squareSize));
|
358
|
+
background-position:
|
359
|
+
0 0,
|
360
|
+
var(--squareSize) 0,
|
361
|
+
var(--squareSize) calc(-1 * var(--squareSize)),
|
362
|
+
0 calc(-1 * var(--squareSize));
|
363
|
+
}
|
364
|
+
.size--S {
|
365
|
+
width: 20px;
|
366
|
+
height: 20px;
|
367
|
+
}
|
368
|
+
.size--M {
|
369
|
+
width: 30px;
|
370
|
+
height: 30px;
|
371
|
+
}
|
372
|
+
.size--L {
|
373
|
+
width: 48px;
|
374
|
+
height: 48px;
|
375
|
+
}
|
376
|
+
|
377
|
+
/* Color Swatch Styles */
|
378
|
+
.colors {
|
379
|
+
display: grid;
|
380
|
+
grid-template-columns: repeat(8, 1fr);
|
381
|
+
gap: 4px;
|
382
|
+
}
|
383
|
+
.color-swatch {
|
384
|
+
height: 16px;
|
385
|
+
width: 16px;
|
386
|
+
border-radius: 50%;
|
387
|
+
position: relative;
|
388
|
+
}
|
389
|
+
.color-swatch:hover {
|
390
|
+
cursor: pointer;
|
391
|
+
box-shadow: 0 0 2px 2px var(--spectrum-global-color-gray-300);
|
392
|
+
}
|
393
|
+
.color-fill {
|
394
|
+
width: 100%;
|
395
|
+
height: 100%;
|
396
|
+
border-radius: 50%;
|
397
|
+
display: grid;
|
398
|
+
place-items: center;
|
399
|
+
}
|
400
|
+
.ri-check-line {
|
401
|
+
font-size: 12px;
|
402
|
+
font-weight: bold;
|
403
|
+
}
|
404
|
+
.ri-palette-line {
|
405
|
+
font-size: 12px;
|
406
|
+
margin-right: 4px;
|
407
|
+
}
|
408
|
+
.heading-icon {
|
409
|
+
vertical-align: middle;
|
410
|
+
}
|
411
|
+
|
412
|
+
/* Other Styles */
|
413
|
+
.heading {
|
414
|
+
font-size: 12px;
|
415
|
+
font-weight: 600;
|
416
|
+
letter-spacing: 0.14px;
|
417
|
+
text-transform: uppercase;
|
418
|
+
grid-column: 1 / 5;
|
419
|
+
margin-bottom: 8px;
|
420
|
+
display: flex;
|
421
|
+
align-items: center;
|
422
|
+
}
|
423
|
+
.custom {
|
424
|
+
flex: 1;
|
425
|
+
display: flex;
|
426
|
+
align-items: center;
|
427
|
+
gap: 4px;
|
428
|
+
justify-content: space-between;
|
429
|
+
}
|
430
|
+
.category--custom .heading {
|
431
|
+
margin-bottom: 4px;
|
432
|
+
}
|
433
|
+
.custom-input {
|
434
|
+
flex: 1;
|
435
|
+
padding: 2px 4px;
|
436
|
+
border: none;
|
437
|
+
border-bottom: 1px solid var(--spectrum-global-color-gray-200);
|
438
|
+
border-radius: 2px;
|
439
|
+
font-size: 12px;
|
440
|
+
height: 20px;
|
441
|
+
width: 80px;
|
442
|
+
background-color: inherit;
|
443
|
+
color: var(--spectrum-global-color-gray-700);
|
444
|
+
font-style: italic;
|
445
|
+
}
|
446
|
+
.custom-input:focus {
|
447
|
+
outline: none;
|
448
|
+
border-color: var(--spectrum-global-color-blue-500);
|
449
|
+
}
|
450
|
+
|
451
|
+
.clear-value {
|
452
|
+
background: none;
|
453
|
+
border: none;
|
454
|
+
color: var(--spectrum-global-color-gray-900);
|
455
|
+
cursor: pointer;
|
456
|
+
font-size: 13px;
|
457
|
+
padding: 0;
|
458
|
+
margin: 0;
|
459
|
+
}
|
460
|
+
</style>
|