@widgetic/editor 4.1.13 → 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 +55 -40
- package/dist/components/editors/EditLeaseNotice.svelte +44 -33
- package/dist/components/editors/EmbedEditor.svelte +133 -259
- package/dist/components/editors/PropsEditor.svelte +426 -1333
- 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/InputControllerRenderer.svelte +5 -1
- package/dist/components/ic/InputControllerRenderer.svelte.d.ts +2 -1
- package/dist/components/ic/InputControllerRow.svelte +74 -0
- package/dist/components/ic/InputControllerRow.svelte.d.ts +14 -0
- package/dist/components/ic/KnowledgeDocumentsInputController.svelte +401 -0
- package/dist/components/ic/KnowledgeDocumentsInputController.svelte.d.ts +11 -0
- package/dist/components/ic/KnowledgeTextForm.svelte +109 -0
- package/dist/components/ic/KnowledgeTextForm.svelte.d.ts +15 -0
- 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 +2 -0
- package/dist/components/ic/index.js +2 -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/composition/compositionApi.d.ts +21 -1
- package/dist/composition/compositionApi.js +64 -5
- package/dist/composition/knowledgeDocuments.d.ts +90 -0
- package/dist/composition/knowledgeDocuments.js +94 -0
- package/dist/composition/knowledgeDocumentsPanel.d.ts +152 -0
- package/dist/composition/knowledgeDocumentsPanel.js +443 -0
- package/dist/i18n/language.d.ts +86 -36
- package/dist/i18n/messages.d.ts +97 -34
- package/dist/i18n/messages.js +104 -34
- package/dist/i18n/translate.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/knowledgeDocumentsContext.d.ts +10 -0
- package/dist/knowledgeDocumentsContext.js +31 -0
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +26 -2
- package/package.json +4 -4
|
@@ -36,17 +36,17 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
36
36
|
}
|
|
37
37
|
declare const FontInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
38
38
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
* Component Props
|
|
40
|
+
* @prop {string} label - Display label for the font selector
|
|
41
|
+
* @prop {string} value - Currently selected font family
|
|
42
|
+
* @prop {Function} onChange - Callback when font selection changes
|
|
43
|
+
* @prop {InputControllerConfig} config - Configuration options
|
|
44
|
+
* @prop {string} description - Optional help text
|
|
45
|
+
* @prop {string} controllerId - Unique identifier for this controller
|
|
46
|
+
* @prop {any} openDropdowns - Store tracking open dropdown states
|
|
47
|
+
* @prop {Function} toggleDropdown - Function to toggle dropdown state
|
|
48
|
+
* @prop {Function} onFocus - Optional focus handler
|
|
49
|
+
*/ label?: FontInputControllerProps["label"];
|
|
50
50
|
class?: string;
|
|
51
51
|
style?: FontInputControllerProps["style"];
|
|
52
52
|
value?: FontInputControllerProps["value"];
|
|
@@ -1,154 +1,148 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
// Svelte imports
|
|
3
|
-
import { onDestroy, onMount } from 'svelte';
|
|
4
|
-
|
|
5
|
-
// Shared listener for "the user is scrolling" (one per tree, not one per header)
|
|
6
|
-
import { onScrollActivity } from '../../utils/scrollActivity';
|
|
7
|
-
|
|
8
|
-
// Shadcn UI Components from design-system
|
|
9
|
-
import { Tooltip, Portal } from '@widgetic/design-system/components';
|
|
10
|
-
// console.log("InputControllerHeader - Tooltip:", Tooltip);
|
|
11
|
-
|
|
12
|
-
//
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
// The way the screen is read: the tip opens at the end of the line, beside the icon
|
|
16
|
-
import { sideAtEnd, useTextDirection } from '@widgetic/design-system/components/textDirection';
|
|
17
|
-
const textDirection = useTextDirection();
|
|
18
|
-
|
|
19
|
-
// Component props
|
|
20
|
-
let className = '';
|
|
21
|
-
export { className as class };
|
|
22
|
-
export let style = '';
|
|
23
|
-
//
|
|
24
|
-
export let label: string;
|
|
25
|
-
export let helpText: string | undefined = undefined;
|
|
26
|
-
|
|
27
|
-
let showHelp = false;
|
|
28
|
-
let showInfoIcon = false;
|
|
29
|
-
let isScrolling = false;
|
|
30
|
-
let isHovering = false;
|
|
31
|
-
let tooltipTimeout: ReturnType<typeof setTimeout>;
|
|
32
|
-
|
|
33
|
-
// Global scroll handler
|
|
34
|
-
function handleScroll() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
let scrollTimeout: ReturnType<typeof setTimeout>;
|
|
49
|
-
|
|
50
|
-
function handleMouseEnter() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function handleMouseLeave() {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
let headerElement: HTMLElement | undefined;
|
|
69
|
-
let stopListeningForScrolling: () => void = () => {};
|
|
70
|
-
|
|
71
|
-
onMount(() => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
onDestroy(() => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
2
|
+
// Svelte imports
|
|
3
|
+
import { onDestroy, onMount } from 'svelte';
|
|
4
|
+
|
|
5
|
+
// Shared listener for "the user is scrolling" (one per tree, not one per header)
|
|
6
|
+
import { onScrollActivity } from '../../utils/scrollActivity';
|
|
7
|
+
|
|
8
|
+
// Shadcn UI Components from design-system
|
|
9
|
+
import { Tooltip, Portal } from '@widgetic/design-system/components';
|
|
10
|
+
// console.log("InputControllerHeader - Tooltip:", Tooltip);
|
|
11
|
+
|
|
12
|
+
// Tabler icon from design-system (the Figma Panel rows show a circled question mark next to the label)
|
|
13
|
+
import { IconHelpCircle } from '@widgetic/design-system/icons';
|
|
14
|
+
|
|
15
|
+
// The way the screen is read: the tip opens at the end of the line, beside the icon
|
|
16
|
+
import { sideAtEnd, useTextDirection } from '@widgetic/design-system/components/textDirection';
|
|
17
|
+
const textDirection = useTextDirection();
|
|
18
|
+
|
|
19
|
+
// Component props
|
|
20
|
+
let className = '';
|
|
21
|
+
export { className as class };
|
|
22
|
+
export let style = '';
|
|
23
|
+
//
|
|
24
|
+
export let label: string;
|
|
25
|
+
export let helpText: string | undefined = undefined;
|
|
26
|
+
|
|
27
|
+
let showHelp = false;
|
|
28
|
+
let showInfoIcon = false;
|
|
29
|
+
let isScrolling = false;
|
|
30
|
+
let isHovering = false;
|
|
31
|
+
let tooltipTimeout: ReturnType<typeof setTimeout>;
|
|
32
|
+
|
|
33
|
+
// Global scroll handler
|
|
34
|
+
function handleScroll() {
|
|
35
|
+
showHelp = false;
|
|
36
|
+
isScrolling = true;
|
|
37
|
+
clearTimeout(scrollTimeout);
|
|
38
|
+
clearTimeout(tooltipTimeout);
|
|
39
|
+
scrollTimeout = setTimeout(() => {
|
|
40
|
+
isScrolling = false;
|
|
41
|
+
// If we're still hovering when scroll stops, show the tooltip
|
|
42
|
+
if (isHovering) {
|
|
43
|
+
showHelp = true;
|
|
44
|
+
}
|
|
45
|
+
}, 150);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let scrollTimeout: ReturnType<typeof setTimeout>;
|
|
49
|
+
|
|
50
|
+
function handleMouseEnter() {
|
|
51
|
+
isHovering = true;
|
|
52
|
+
clearTimeout(tooltipTimeout);
|
|
53
|
+
|
|
54
|
+
// Add buffer time for tooltip only
|
|
55
|
+
tooltipTimeout = setTimeout(() => {
|
|
56
|
+
if (isHovering && !isScrolling) {
|
|
57
|
+
showHelp = true;
|
|
58
|
+
}
|
|
59
|
+
}, 500); // 500ms delay for tooltip
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function handleMouseLeave() {
|
|
63
|
+
isHovering = false;
|
|
64
|
+
showHelp = false;
|
|
65
|
+
clearTimeout(tooltipTimeout);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
let headerElement: HTMLElement | undefined;
|
|
69
|
+
let stopListeningForScrolling: () => void = () => {};
|
|
70
|
+
|
|
71
|
+
onMount(() => {
|
|
72
|
+
// The listeners for scrolling are shared by all the headers in the same tree (the page or the module's shadow
|
|
73
|
+
// root): every header used to add three of its own to the window and the document.
|
|
74
|
+
stopListeningForScrolling = onScrollActivity(headerElement, handleScroll);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
onDestroy(() => {
|
|
78
|
+
stopListeningForScrolling();
|
|
79
|
+
clearTimeout(scrollTimeout);
|
|
80
|
+
clearTimeout(tooltipTimeout);
|
|
81
|
+
});
|
|
82
82
|
</script>
|
|
83
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
|
-
|
|
84
|
+
<!--
|
|
85
|
+
The label of an input controller row (Figma: the label column of the "IC Row" on the Editor page, 185 wide, Body text in
|
|
86
|
+
foreground, with the help icon next to it in muted-foreground). The help icon appears while the label is hovered and
|
|
87
|
+
opens a tip at the end of the line.
|
|
88
|
+
-->
|
|
89
|
+
<div
|
|
90
|
+
bind:this={headerElement}
|
|
91
|
+
class="input-controller-header group flex min-h-9 items-center {className ? className + ' ' : ''}"
|
|
92
|
+
{style}
|
|
93
|
+
>
|
|
94
|
+
<div class="header-label-ct flex h-full min-w-0 flex-1 items-center">
|
|
95
|
+
<div class="tooltip-group flex min-w-0 max-w-full items-center gap-2">
|
|
96
|
+
<span class="subtext text-body text-foreground cursor-default truncate select-none">
|
|
97
|
+
{label}
|
|
98
|
+
</span>
|
|
99
|
+
{#if helpText}
|
|
100
|
+
<Tooltip.Provider>
|
|
101
|
+
<Tooltip.Root open={showHelp && !isScrolling}>
|
|
102
|
+
<Tooltip.Trigger
|
|
103
|
+
tabindex={-1}
|
|
104
|
+
class="flex size-4 shrink-0 cursor-default items-center select-none focus:outline-none"
|
|
105
|
+
>
|
|
106
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
107
|
+
<span
|
|
108
|
+
class="help-icon-reveal inline-flex items-center duration-slow transition-opacity"
|
|
109
|
+
class:opacity-0={!isHovering}
|
|
110
|
+
class:opacity-100={isHovering}
|
|
111
|
+
class:cursor-help={!isScrolling}
|
|
112
|
+
onmouseenter={handleMouseEnter}
|
|
113
|
+
onmouseleave={handleMouseLeave}
|
|
114
|
+
>
|
|
115
|
+
<IconHelpCircle class="size-4 stroke-[1.333] text-muted-foreground" />
|
|
116
|
+
</span>
|
|
117
|
+
</Tooltip.Trigger>
|
|
118
|
+
|
|
119
|
+
{#if showHelp && !isScrolling}
|
|
120
|
+
<Portal target="editor-tooltips">
|
|
121
|
+
<Tooltip.Content
|
|
122
|
+
side={sideAtEnd($textDirection)}
|
|
123
|
+
sideOffset={5}
|
|
124
|
+
align="center"
|
|
125
|
+
alignOffset={-1}
|
|
126
|
+
class="tooltip-content pointer-events-none fixed whitespace-nowrap select-none"
|
|
127
|
+
style="z-index: 99999;"
|
|
128
|
+
>
|
|
129
|
+
<p class="text-caption">{helpText}</p>
|
|
130
|
+
</Tooltip.Content>
|
|
131
|
+
</Portal>
|
|
132
|
+
{/if}
|
|
133
|
+
</Tooltip.Root>
|
|
134
|
+
</Tooltip.Provider>
|
|
135
|
+
{/if}
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
129
138
|
</div>
|
|
130
139
|
|
|
131
140
|
<style>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
:global(.input-controller-header:focus-within), :global(.info-bt:focus-within) {
|
|
140
|
-
outline: none !important;
|
|
141
|
-
}
|
|
142
|
-
.tooltip-group:hover :global(.opacity-0) {
|
|
143
|
-
opacity: 1 !important;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/* Simplified tooltip styles */
|
|
147
|
-
:global(.tooltip-content) {
|
|
148
|
-
background-color: hsl(var(--dark));
|
|
149
|
-
color: white;
|
|
150
|
-
pointer-events: none;
|
|
151
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
152
|
-
}
|
|
141
|
+
/* The help icon shows as soon as the pointer is over the label or the icon (the opacity classes above come from the
|
|
142
|
+
hover state of the icon itself, this rule widens it to the whole label group) */
|
|
143
|
+
@media (hover: hover) {
|
|
144
|
+
.tooltip-group:hover .help-icon-reveal {
|
|
145
|
+
opacity: 1;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
153
148
|
</style>
|
|
154
|
-
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
SwitchInputController, ColorPickerInputController, CheckboxInputController,
|
|
8
8
|
RadioGroupInputController, FontInputController, PositionInputController,
|
|
9
9
|
BrowserInputController, FixedPositionInputController, VectorInputController,
|
|
10
|
-
AngleInputController, TimeInputController, RoundedCornersInputController, TagsInputController
|
|
10
|
+
AngleInputController, TimeInputController, RoundedCornersInputController, TagsInputController,
|
|
11
|
+
KnowledgeDocumentsInputController
|
|
11
12
|
} from './index';
|
|
12
13
|
|
|
13
14
|
type ControllerComponents = {
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
time: typeof TimeInputController;
|
|
34
35
|
roundedcorners: typeof RoundedCornersInputController;
|
|
35
36
|
tags: typeof TagsInputController;
|
|
37
|
+
knowledgedocuments: typeof KnowledgeDocumentsInputController;
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
// Each branch preserves the relationship between a controller and its props.
|
|
@@ -94,5 +96,7 @@
|
|
|
94
96
|
<RoundedCornersInputController {...controller.props} />
|
|
95
97
|
{:else if controller?.kind === 'tags'}
|
|
96
98
|
<TagsInputController {...controller.props} />
|
|
99
|
+
{:else if controller?.kind === 'knowledgedocuments'}
|
|
100
|
+
<KnowledgeDocumentsInputController {...controller.props} />
|
|
97
101
|
{/if}
|
|
98
102
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps } from 'svelte';
|
|
2
|
-
import { TextInputController, TextAreaPreviewInputController, NumberInputController, SliderInputController, SliderRangeInputController, DropdownInputController, DatePickerInputController, DateFieldInputController, RangeCalendarInputController, SwitchInputController, ColorPickerInputController, CheckboxInputController, RadioGroupInputController, FontInputController, PositionInputController, BrowserInputController, FixedPositionInputController, VectorInputController, AngleInputController, TimeInputController, RoundedCornersInputController, TagsInputController } from './index';
|
|
2
|
+
import { TextInputController, TextAreaPreviewInputController, NumberInputController, SliderInputController, SliderRangeInputController, DropdownInputController, DatePickerInputController, DateFieldInputController, RangeCalendarInputController, SwitchInputController, ColorPickerInputController, CheckboxInputController, RadioGroupInputController, FontInputController, PositionInputController, BrowserInputController, FixedPositionInputController, VectorInputController, AngleInputController, TimeInputController, RoundedCornersInputController, TagsInputController, KnowledgeDocumentsInputController } from './index';
|
|
3
3
|
type ControllerComponents = {
|
|
4
4
|
textinput: typeof TextInputController;
|
|
5
5
|
textarea: typeof TextAreaPreviewInputController;
|
|
@@ -23,6 +23,7 @@ type ControllerComponents = {
|
|
|
23
23
|
time: typeof TimeInputController;
|
|
24
24
|
roundedcorners: typeof RoundedCornersInputController;
|
|
25
25
|
tags: typeof TagsInputController;
|
|
26
|
+
knowledgedocuments: typeof KnowledgeDocumentsInputController;
|
|
26
27
|
};
|
|
27
28
|
export type ControllerDescriptor = {
|
|
28
29
|
[Kind in keyof ControllerComponents]: {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
InputControllerRow
|
|
3
|
+
|
|
4
|
+
The row every input controller of the panel sits in. Mirrors the "IC Row" of the Editor page in Figma (node ids in
|
|
5
|
+
/tmp/design-system-state-widgetic-dash-001.json -> editorScreens): label on the left, control on the right, 370 wide
|
|
6
|
+
(label 185 + control 185), controls 36 high on a 48 pitch. A control taller than one line (a text area preview, the
|
|
7
|
+
position pad, a radio group, ...) starts at the top of the row and the label stays centred on its first line.
|
|
8
|
+
|
|
9
|
+
Usage:
|
|
10
|
+
<InputControllerRow {label} {helpText} {description}>
|
|
11
|
+
<Input ... />
|
|
12
|
+
</InputControllerRow>
|
|
13
|
+
|
|
14
|
+
Props
|
|
15
|
+
label the label (already translated). Without a label the row is "headless": only the control is rendered, for a host that
|
|
16
|
+
draws the label itself (the panel does: it passes no label to the controllers)
|
|
17
|
+
helpText optional tip shown from the help icon next to the label
|
|
18
|
+
description optional line under the row (caption, muted)
|
|
19
|
+
class extra classes of the row
|
|
20
|
+
controlClass extra classes of the control column (the column is `w-editor-control`, 185)
|
|
21
|
+
-->
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import type { Snippet } from 'svelte';
|
|
24
|
+
import InputControllerHeader from './InputControllerHeader.svelte';
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
label,
|
|
28
|
+
helpText = undefined,
|
|
29
|
+
description = undefined,
|
|
30
|
+
class: className = '',
|
|
31
|
+
headerColumnClass = '',
|
|
32
|
+
controlClass = '',
|
|
33
|
+
dataState = undefined,
|
|
34
|
+
children
|
|
35
|
+
}: {
|
|
36
|
+
label?: string;
|
|
37
|
+
helpText?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
class?: string;
|
|
40
|
+
headerColumnClass?: string;
|
|
41
|
+
controlClass?: string;
|
|
42
|
+
dataState?: 'open' | 'closed';
|
|
43
|
+
children?: Snippet;
|
|
44
|
+
} = $props();
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
{#if label}
|
|
48
|
+
<div
|
|
49
|
+
class="input-controller-row flex w-full flex-col gap-1 py-1.5 {className}"
|
|
50
|
+
data-state={dataState}
|
|
51
|
+
>
|
|
52
|
+
<div class="flex w-full items-start justify-between">
|
|
53
|
+
<div class="ic-header-ct w-editor-control min-w-0 shrink-0 {headerColumnClass}">
|
|
54
|
+
<InputControllerHeader {label} {helpText} class="h-9" />
|
|
55
|
+
</div>
|
|
56
|
+
<div
|
|
57
|
+
class="ic-input-ct input-controller-row-control w-editor-control shrink-0 {controlClass}"
|
|
58
|
+
>
|
|
59
|
+
{@render children?.()}
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
{#if description}
|
|
63
|
+
<p class="text-caption text-muted-foreground">{description}</p>
|
|
64
|
+
{/if}
|
|
65
|
+
</div>
|
|
66
|
+
{:else}
|
|
67
|
+
<!-- Headless: the host (the panel) draws the label column and gives this control its column, so only the control is rendered. -->
|
|
68
|
+
<div class="input-controller-row w-full {className}">
|
|
69
|
+
{@render children?.()}
|
|
70
|
+
{#if description}
|
|
71
|
+
<p class="text-caption text-muted-foreground">{description}</p>
|
|
72
|
+
{/if}
|
|
73
|
+
</div>
|
|
74
|
+
{/if}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
label?: string;
|
|
4
|
+
helpText?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
class?: string;
|
|
7
|
+
headerColumnClass?: string;
|
|
8
|
+
controlClass?: string;
|
|
9
|
+
dataState?: 'open' | 'closed';
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
};
|
|
12
|
+
declare const InputControllerRow: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
13
|
+
type InputControllerRow = ReturnType<typeof InputControllerRow>;
|
|
14
|
+
export default InputControllerRow;
|