@widgetic/editor 4.1.14 → 4.1.15
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/PreviewChromeControls.svelte +15 -21
- package/dist/components/WidgetPreview.svelte +136 -105
- package/dist/components/color-select/ColorSelect.svelte +203 -224
- package/dist/components/color-select/constants.d.ts +4 -2
- package/dist/components/color-select/constants.js +4 -2
- package/dist/components/color-select/render.js +10 -9
- package/dist/components/editors/CompositionEditorApp.svelte +47 -40
- package/dist/components/editors/EditLeaseNotice.svelte +44 -33
- package/dist/components/editors/EmbedEditor.svelte +133 -259
- package/dist/components/editors/PropsEditor.svelte +418 -1338
- package/dist/components/editors/props-editor.css +5 -68
- package/dist/components/ic/AngleInputController.svelte +202 -277
- package/dist/components/ic/BrowserInputController.svelte +813 -803
- package/dist/components/ic/CheckboxInputController.svelte +92 -169
- package/dist/components/ic/CheckboxInputController.svelte.d.ts +2 -8
- package/dist/components/ic/ColorPickerInputController.svelte +1589 -1587
- package/dist/components/ic/ColorPickerInputController.svelte.d.ts +3 -3
- package/dist/components/ic/DateFieldInputController.svelte +455 -465
- package/dist/components/ic/DatePickerInputController.svelte +355 -368
- package/dist/components/ic/DatePickerInputController.svelte.d.ts +1 -1
- package/dist/components/ic/DropdownInputController.svelte +130 -200
- package/dist/components/ic/FixedPositionInputController.svelte +255 -276
- package/dist/components/ic/FixedPositionInputController.svelte.d.ts +5 -1
- package/dist/components/ic/FontInputController.svelte +2110 -2231
- package/dist/components/ic/FontInputController.svelte.d.ts +11 -11
- package/dist/components/ic/InputControllerHeader.svelte +141 -147
- package/dist/components/ic/InputControllerRow.svelte +74 -0
- package/dist/components/ic/InputControllerRow.svelte.d.ts +14 -0
- package/dist/components/ic/KnowledgeDocumentsInputController.svelte +84 -47
- package/dist/components/ic/KnowledgeTextForm.svelte +35 -33
- package/dist/components/ic/NumberControls.svelte +303 -269
- package/dist/components/ic/NumberControls.svelte.d.ts +4 -1
- package/dist/components/ic/NumberInputController.svelte +361 -301
- package/dist/components/ic/NumberInputController.svelte.d.ts +2 -0
- package/dist/components/ic/PositionInputController.svelte +253 -176
- package/dist/components/ic/PositionInputController.svelte.d.ts +2 -0
- package/dist/components/ic/RadioGroupInputController.svelte +71 -137
- package/dist/components/ic/RadioGroupInputController.svelte.d.ts +2 -8
- package/dist/components/ic/RangeCalendarInputController.svelte +233 -270
- package/dist/components/ic/RangeCalendarInputController.svelte.d.ts +2 -2
- package/dist/components/ic/RoundedCornersInputController.svelte +412 -435
- package/dist/components/ic/RoundedCornersInputController.svelte.d.ts +2 -0
- package/dist/components/ic/SliderInputController.svelte +263 -332
- package/dist/components/ic/SliderInputController.svelte.d.ts +1 -1
- package/dist/components/ic/SliderRangeInputController.svelte +140 -144
- package/dist/components/ic/SliderRangeInputController.svelte.d.ts +3 -3
- package/dist/components/ic/SwitchInputController.svelte +47 -109
- package/dist/components/ic/TagsInputController.svelte +95 -110
- package/dist/components/ic/TextAreaInputController.svelte +1794 -1935
- package/dist/components/ic/TextAreaPreviewInputController.svelte +436 -438
- package/dist/components/ic/TextAreaPreviewInputController.svelte.d.ts +2 -2
- package/dist/components/ic/TextInputController.svelte +65 -75
- package/dist/components/ic/TextInputController.svelte.d.ts +2 -0
- package/dist/components/ic/TimeInputController.svelte +433 -431
- package/dist/components/ic/VectorInputController.svelte +1833 -1831
- package/dist/components/ic/VectorInputController.svelte.d.ts +10 -10
- package/dist/components/ic/index.d.ts +1 -0
- package/dist/components/ic/index.js +1 -0
- package/dist/components/ic/shared/CategoryTabs.svelte +28 -35
- package/dist/components/ic/shared/ItemGrid.svelte +145 -179
- package/dist/components/ic/shared/RecentItemsSection.svelte +208 -271
- package/dist/components/ic/shared/RecentItemsSection.svelte.d.ts +1 -1
- package/dist/components/ui/arrows/OpacitySliderArrows.svelte +23 -38
- package/dist/components/ui/arrows/OpacitySliderArrows.svelte.d.ts +1 -4
- package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte +45 -0
- package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte.d.ts +26 -0
- package/dist/components/ui/checkerboard-background/CheckerboardBackground.svelte +20 -12
- package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte +39 -0
- package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte.d.ts +10 -0
- package/dist/i18n/language.d.ts +43 -36
- package/dist/i18n/messages.d.ts +41 -34
- package/dist/i18n/messages.js +47 -34
- package/dist/i18n/translate.d.ts +1 -1
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +26 -2
- package/package.json +4 -4
|
@@ -38,7 +38,7 @@ declare const SliderInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
|
38
38
|
* External properties that configure the slider's behavior
|
|
39
39
|
*/ class?: string;
|
|
40
40
|
height?: SliderInputControllerProps["height"];
|
|
41
|
-
elementsGap?: SliderInputControllerProps["elementsGap"];
|
|
41
|
+
elementsGap?: SliderInputControllerProps["elementsGap"] | undefined;
|
|
42
42
|
thumbSize?: SliderInputControllerProps["thumbSize"];
|
|
43
43
|
sliderType?: SliderInputControllerProps["sliderType"];
|
|
44
44
|
barHeight?: SliderInputControllerProps["barHeight"];
|
|
@@ -18,154 +18,150 @@
|
|
|
18
18
|
-->
|
|
19
19
|
|
|
20
20
|
<script module lang="ts">
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
import type { InputControllerConfig } from './index';
|
|
22
|
+
|
|
23
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
24
|
+
* interface cannot drift from what the component actually reads. */
|
|
25
|
+
export interface SliderRangeInputControllerProps {
|
|
26
|
+
label: string;
|
|
27
|
+
value?: [number, number];
|
|
28
|
+
onChange: (newValue: [number, number]) => void;
|
|
29
|
+
config?: InputControllerConfig;
|
|
30
|
+
helpText?: string;
|
|
31
|
+
min?: number;
|
|
32
|
+
max?: number;
|
|
33
|
+
step?: number;
|
|
34
|
+
onFocus?: () => void;
|
|
35
|
+
}
|
|
36
36
|
</script>
|
|
37
37
|
|
|
38
38
|
<script lang="ts">
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
onChange(safeValue);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
39
|
+
// Svelte imports
|
|
40
|
+
import { onMount, tick } from 'svelte';
|
|
41
|
+
|
|
42
|
+
// local components imports
|
|
43
|
+
import SliderInputController from './SliderInputController.svelte';
|
|
44
|
+
|
|
45
|
+
// Component props
|
|
46
|
+
let className = '';
|
|
47
|
+
export { className as class };
|
|
48
|
+
export let label: SliderRangeInputControllerProps['label'];
|
|
49
|
+
export let value: SliderRangeInputControllerProps['value'] = [0, 100];
|
|
50
|
+
export let onChange: SliderRangeInputControllerProps['onChange'];
|
|
51
|
+
export let config: SliderRangeInputControllerProps['config'] = {};
|
|
52
|
+
export let helpText: SliderRangeInputControllerProps['helpText'] = undefined;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Configuration Options
|
|
56
|
+
* Derived from config prop with fallbacks
|
|
57
|
+
*/
|
|
58
|
+
export let min: SliderRangeInputControllerProps['min'] = config.min || 0;
|
|
59
|
+
export let max: SliderRangeInputControllerProps['max'] = config.max || 100;
|
|
60
|
+
export let step: SliderRangeInputControllerProps['step'] = config.step || 1;
|
|
61
|
+
export let onFocus: SliderRangeInputControllerProps['onFocus'] = () => {};
|
|
62
|
+
// export let autofocus: boolean = false;
|
|
63
|
+
|
|
64
|
+
// Store initial scroll position
|
|
65
|
+
let initialScrollPos = { x: 0, y: 0 };
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Validate and adjust values against min/max constraints
|
|
69
|
+
* @param val - Input array of two numbers
|
|
70
|
+
* @returns Validated and adjusted array of two numbers
|
|
71
|
+
*/
|
|
72
|
+
function validateAndAdjustValue(val: [number, number]): [number, number] {
|
|
73
|
+
// Ensure values are numbers and within bounds
|
|
74
|
+
const validStart = Math.max(min, Math.min(max, Number(val[0]) || min));
|
|
75
|
+
const validEnd = Math.max(min, Math.min(max, Number(val[1]) || max));
|
|
76
|
+
|
|
77
|
+
// Round to nearest step
|
|
78
|
+
const roundedStart = Math.round((validStart - min) / step) * step + min;
|
|
79
|
+
const roundedEnd = Math.round((validEnd - min) / step) * step + min;
|
|
80
|
+
|
|
81
|
+
// Ensure start is not greater than end
|
|
82
|
+
return roundedStart <= roundedEnd ? [roundedStart, roundedEnd] : [roundedEnd, roundedStart];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Component Initialization
|
|
87
|
+
*/
|
|
88
|
+
onMount(async () => {
|
|
89
|
+
try {
|
|
90
|
+
// Store initial scroll position
|
|
91
|
+
initialScrollPos = {
|
|
92
|
+
x: window.scrollX,
|
|
93
|
+
y: window.scrollY
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// Validate and adjust initial value
|
|
97
|
+
const adjustedValue = validateAndAdjustValue(value);
|
|
98
|
+
|
|
99
|
+
if (adjustedValue[0] !== value[0] || adjustedValue[1] !== value[1]) {
|
|
100
|
+
// console.log('Adjusting initial range values to match constraints:', { original: value, adjusted: adjustedValue });
|
|
101
|
+
value = adjustedValue;
|
|
102
|
+
|
|
103
|
+
// Wait for next tick to prevent scroll jump
|
|
104
|
+
await tick();
|
|
105
|
+
onChange(adjustedValue);
|
|
106
|
+
|
|
107
|
+
// Restore scroll position
|
|
108
|
+
window.scrollTo(initialScrollPos.x, initialScrollPos.y);
|
|
109
|
+
}
|
|
110
|
+
} catch (error) {
|
|
111
|
+
console.error('Error in SliderRangeInputController.onMount:', error);
|
|
112
|
+
// Set a safe default value
|
|
113
|
+
const safeValue: [number, number] = [min, max];
|
|
114
|
+
value = safeValue;
|
|
115
|
+
onChange(safeValue);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Handle value changes
|
|
121
|
+
*/
|
|
122
|
+
async function handleChange(newValue: number | number[]) {
|
|
123
|
+
try {
|
|
124
|
+
// Store current scroll position
|
|
125
|
+
const scrollPos = {
|
|
126
|
+
x: window.scrollX,
|
|
127
|
+
y: window.scrollY
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// Always validate and adjust the value
|
|
131
|
+
// For single number, convert to array format
|
|
132
|
+
const valueToValidate: [number, number] = Array.isArray(newValue)
|
|
133
|
+
? (newValue as [number, number])
|
|
134
|
+
: [newValue, max];
|
|
135
|
+
|
|
136
|
+
const adjustedValue = validateAndAdjustValue(valueToValidate);
|
|
137
|
+
|
|
138
|
+
// Wait for next tick to prevent scroll jump
|
|
139
|
+
await tick();
|
|
140
|
+
onChange(adjustedValue);
|
|
141
|
+
|
|
142
|
+
// Restore scroll position
|
|
143
|
+
window.scrollTo(scrollPos.x, scrollPos.y);
|
|
144
|
+
} catch (error) {
|
|
145
|
+
console.error('Error in SliderRangeInputController.handleChange:', error);
|
|
146
|
+
// Fallback to a safe default value
|
|
147
|
+
const safeValue: [number, number] = [min, max];
|
|
148
|
+
onChange(safeValue);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
154
151
|
</script>
|
|
155
152
|
|
|
156
153
|
<!-- Range Slider Container -->
|
|
157
154
|
<SliderInputController
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
155
|
+
class={className}
|
|
156
|
+
{label}
|
|
157
|
+
sliderType="multiple"
|
|
158
|
+
{value}
|
|
159
|
+
{min}
|
|
160
|
+
{max}
|
|
161
|
+
{step}
|
|
162
|
+
onChange={handleChange}
|
|
163
|
+
{onFocus}
|
|
164
|
+
{config}
|
|
165
|
+
{helpText}
|
|
166
|
+
autofocus={false}
|
|
167
|
+
/>
|
|
@@ -33,9 +33,9 @@ declare const SliderRangeInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
|
33
33
|
config?: SliderRangeInputControllerProps["config"];
|
|
34
34
|
helpText?: SliderRangeInputControllerProps["helpText"];
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
* Configuration Options
|
|
37
|
+
* Derived from config prop with fallbacks
|
|
38
|
+
*/ min?: SliderRangeInputControllerProps["min"];
|
|
39
39
|
max?: SliderRangeInputControllerProps["max"];
|
|
40
40
|
step?: SliderRangeInputControllerProps["step"];
|
|
41
41
|
onFocus?: SliderRangeInputControllerProps["onFocus"];
|
|
@@ -1,128 +1,66 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
/** Declared props contract — export lets below are annotated from it so the
|
|
3
3
|
* interface cannot drift from what the component actually reads. */
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export interface SwitchInputControllerProps {
|
|
5
|
+
label: string;
|
|
6
|
+
value: boolean;
|
|
7
|
+
onChange: (newValue: boolean) => void;
|
|
8
|
+
description?: string;
|
|
9
|
+
onFocus?: () => void;
|
|
10
|
+
}
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<script lang="ts">
|
|
14
|
-
// Svelte imports
|
|
15
|
-
import { onMount } from 'svelte';
|
|
16
|
-
|
|
17
14
|
// Shadcn UI Components
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
import { Switch } from '@widgetic/design-system/components';
|
|
16
|
+
import InputControllerRow from './InputControllerRow.svelte';
|
|
17
|
+
import { useEditorLanguage } from '../../i18n/language';
|
|
21
18
|
|
|
22
19
|
// The words of the editor in the language of the page.
|
|
23
|
-
|
|
20
|
+
const { t } = useEditorLanguage();
|
|
24
21
|
|
|
25
22
|
// Component props
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
export let label: SwitchInputControllerProps['label'];
|
|
24
|
+
export let value: SwitchInputControllerProps['value'];
|
|
25
|
+
export let onChange: SwitchInputControllerProps['onChange'];
|
|
26
|
+
export let description: SwitchInputControllerProps['description'] = undefined;
|
|
27
|
+
export let onFocus: SwitchInputControllerProps['onFocus'] = () => {};
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
function toggle(newValue?: boolean) {
|
|
30
|
+
value = typeof newValue === 'boolean' ? newValue : !value;
|
|
34
31
|
// console.log('[SwitchIC] Toggled:', { label, value });
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
onChange(value);
|
|
33
|
+
}
|
|
37
34
|
</script>
|
|
38
35
|
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<InputControllerHeader {label} />
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<div class="absolute end-0">
|
|
36
|
+
<InputControllerRow {label} {description}>
|
|
37
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
38
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
46
39
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
47
40
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
onCheckedChange={toggle}
|
|
63
|
-
class="!border-0 pointer-events-auto switch-override"
|
|
64
|
-
style="background-color: hsl(var({value ? '--sage-green' : '--grey3'})) !important"
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<!-- On text -->
|
|
69
|
-
<span class="subtext select-none pointer-events-none" style="color: hsl(var({value ? '--grey7' : '--grey3'}));">{$t('editor.switch.on')}</span>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
|
|
74
|
-
{#if description}
|
|
75
|
-
<p class="subtext" style="color: hsl(var(--grey5));">{description}</p>
|
|
76
|
-
{/if}
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
<style>
|
|
80
|
-
.switch-main-container:hover {
|
|
81
|
-
border-color: hsl(var(--forest-green));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/* Switch track */
|
|
85
|
-
:global(.switch-override) {
|
|
86
|
-
width: 44px !important;
|
|
87
|
-
height: 25px !important;
|
|
88
|
-
min-width: 44px !important;
|
|
89
|
-
border: none !important;
|
|
90
|
-
padding: 2px !important;
|
|
91
|
-
overflow: hidden !important;
|
|
92
|
-
transition: background-color 0.2s ease-in-out !important;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
:global(.switch-override:focus-visible),
|
|
96
|
-
:global(.switch-override:focus-within) {
|
|
97
|
-
outline: none !important;
|
|
98
|
-
box-shadow: none !important;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/* Switch thumb — reset translate (Tailwind 4 uses CSS translate property) and use transform */
|
|
102
|
-
:global(.switch-override > *) {
|
|
103
|
-
width: 20px !important;
|
|
104
|
-
height: 20px !important;
|
|
105
|
-
min-width: 20px !important;
|
|
106
|
-
background-color: white !important;
|
|
107
|
-
border-radius: 9999px !important;
|
|
108
|
-
box-shadow: 0 1px 3px rgba(0,0,0,0.15) !important;
|
|
109
|
-
transition: transform 0.2s ease-in-out !important;
|
|
110
|
-
display: block !important;
|
|
111
|
-
translate: none !important;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
:global(.switch-override > *[data-state="unchecked"]) {
|
|
115
|
-
transform: translateX(0) !important;
|
|
116
|
-
border: 1px solid hsl(var(--grey3)) !important;
|
|
117
|
-
}
|
|
41
|
+
<div
|
|
42
|
+
class="switch-main-container flex h-9 w-full cursor-default items-center justify-start gap-3"
|
|
43
|
+
onfocusin={onFocus}
|
|
44
|
+
onclick={(e) => {
|
|
45
|
+
if (e.target === e.currentTarget) toggle();
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
<span
|
|
49
|
+
class="pointer-events-none select-none text-caption-medium {value
|
|
50
|
+
? 'text-muted-foreground'
|
|
51
|
+
: 'text-foreground'}"
|
|
52
|
+
>
|
|
53
|
+
{$t('editor.switch.off')}
|
|
54
|
+
</span>
|
|
118
55
|
|
|
119
|
-
|
|
120
|
-
transform: translateX(20px) !important;
|
|
121
|
-
border: 1px solid hsl(var(--grey6)) !important;
|
|
122
|
-
}
|
|
56
|
+
<Switch id="switch" checked={value} onCheckedChange={toggle} class="pointer-events-auto" />
|
|
123
57
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
58
|
+
<span
|
|
59
|
+
class="pointer-events-none select-none text-caption-medium {value
|
|
60
|
+
? 'text-foreground'
|
|
61
|
+
: 'text-muted-foreground'}"
|
|
62
|
+
>
|
|
63
|
+
{$t('editor.switch.on')}
|
|
64
|
+
</span>
|
|
65
|
+
</div>
|
|
66
|
+
</InputControllerRow>
|