@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.
Files changed (76) hide show
  1. package/dist/components/PreviewChromeControls.svelte +15 -21
  2. package/dist/components/WidgetPreview.svelte +136 -105
  3. package/dist/components/color-select/ColorSelect.svelte +203 -224
  4. package/dist/components/color-select/constants.d.ts +4 -2
  5. package/dist/components/color-select/constants.js +4 -2
  6. package/dist/components/color-select/render.js +10 -9
  7. package/dist/components/editors/CompositionEditorApp.svelte +47 -40
  8. package/dist/components/editors/EditLeaseNotice.svelte +44 -33
  9. package/dist/components/editors/EmbedEditor.svelte +133 -259
  10. package/dist/components/editors/PropsEditor.svelte +418 -1338
  11. package/dist/components/editors/props-editor.css +5 -68
  12. package/dist/components/ic/AngleInputController.svelte +202 -277
  13. package/dist/components/ic/BrowserInputController.svelte +813 -803
  14. package/dist/components/ic/CheckboxInputController.svelte +92 -169
  15. package/dist/components/ic/CheckboxInputController.svelte.d.ts +2 -8
  16. package/dist/components/ic/ColorPickerInputController.svelte +1589 -1587
  17. package/dist/components/ic/ColorPickerInputController.svelte.d.ts +3 -3
  18. package/dist/components/ic/DateFieldInputController.svelte +455 -465
  19. package/dist/components/ic/DatePickerInputController.svelte +355 -368
  20. package/dist/components/ic/DatePickerInputController.svelte.d.ts +1 -1
  21. package/dist/components/ic/DropdownInputController.svelte +130 -200
  22. package/dist/components/ic/FixedPositionInputController.svelte +255 -276
  23. package/dist/components/ic/FixedPositionInputController.svelte.d.ts +5 -1
  24. package/dist/components/ic/FontInputController.svelte +2110 -2231
  25. package/dist/components/ic/FontInputController.svelte.d.ts +11 -11
  26. package/dist/components/ic/InputControllerHeader.svelte +141 -147
  27. package/dist/components/ic/InputControllerRow.svelte +74 -0
  28. package/dist/components/ic/InputControllerRow.svelte.d.ts +14 -0
  29. package/dist/components/ic/KnowledgeDocumentsInputController.svelte +84 -47
  30. package/dist/components/ic/KnowledgeTextForm.svelte +35 -33
  31. package/dist/components/ic/NumberControls.svelte +303 -269
  32. package/dist/components/ic/NumberControls.svelte.d.ts +4 -1
  33. package/dist/components/ic/NumberInputController.svelte +361 -301
  34. package/dist/components/ic/NumberInputController.svelte.d.ts +2 -0
  35. package/dist/components/ic/PositionInputController.svelte +253 -176
  36. package/dist/components/ic/PositionInputController.svelte.d.ts +2 -0
  37. package/dist/components/ic/RadioGroupInputController.svelte +71 -137
  38. package/dist/components/ic/RadioGroupInputController.svelte.d.ts +2 -8
  39. package/dist/components/ic/RangeCalendarInputController.svelte +233 -270
  40. package/dist/components/ic/RangeCalendarInputController.svelte.d.ts +2 -2
  41. package/dist/components/ic/RoundedCornersInputController.svelte +412 -435
  42. package/dist/components/ic/RoundedCornersInputController.svelte.d.ts +2 -0
  43. package/dist/components/ic/SliderInputController.svelte +263 -332
  44. package/dist/components/ic/SliderInputController.svelte.d.ts +1 -1
  45. package/dist/components/ic/SliderRangeInputController.svelte +140 -144
  46. package/dist/components/ic/SliderRangeInputController.svelte.d.ts +3 -3
  47. package/dist/components/ic/SwitchInputController.svelte +47 -109
  48. package/dist/components/ic/TagsInputController.svelte +95 -110
  49. package/dist/components/ic/TextAreaInputController.svelte +1794 -1935
  50. package/dist/components/ic/TextAreaPreviewInputController.svelte +436 -438
  51. package/dist/components/ic/TextAreaPreviewInputController.svelte.d.ts +2 -2
  52. package/dist/components/ic/TextInputController.svelte +65 -75
  53. package/dist/components/ic/TextInputController.svelte.d.ts +2 -0
  54. package/dist/components/ic/TimeInputController.svelte +433 -431
  55. package/dist/components/ic/VectorInputController.svelte +1833 -1831
  56. package/dist/components/ic/VectorInputController.svelte.d.ts +10 -10
  57. package/dist/components/ic/index.d.ts +1 -0
  58. package/dist/components/ic/index.js +1 -0
  59. package/dist/components/ic/shared/CategoryTabs.svelte +28 -35
  60. package/dist/components/ic/shared/ItemGrid.svelte +145 -179
  61. package/dist/components/ic/shared/RecentItemsSection.svelte +208 -271
  62. package/dist/components/ic/shared/RecentItemsSection.svelte.d.ts +1 -1
  63. package/dist/components/ui/arrows/OpacitySliderArrows.svelte +23 -38
  64. package/dist/components/ui/arrows/OpacitySliderArrows.svelte.d.ts +1 -4
  65. package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte +45 -0
  66. package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte.d.ts +26 -0
  67. package/dist/components/ui/checkerboard-background/CheckerboardBackground.svelte +20 -12
  68. package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte +39 -0
  69. package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte.d.ts +10 -0
  70. package/dist/i18n/language.d.ts +43 -36
  71. package/dist/i18n/messages.d.ts +41 -34
  72. package/dist/i18n/messages.js +47 -34
  73. package/dist/i18n/translate.d.ts +1 -1
  74. package/dist/utils.d.ts +7 -0
  75. package/dist/utils.js +26 -2
  76. package/package.json +4 -4
@@ -1,217 +1,140 @@
1
1
  <script module lang="ts">
2
- import type { InputControllerConfig } from './index';
2
+ import type { InputControllerConfig } from './index';
3
3
 
4
4
  /** Declared props contract — export lets below are annotated from it so the
5
5
  * interface cannot drift from what the component actually reads. */
6
- export interface CheckboxInputControllerProps {
7
- value: string[] | { value: string; label: string }[] | string | { value: string; label: string };
8
- onChange: (newValue: string[]) => void;
9
- config?: InputControllerConfig;
10
- description?: string;
11
- onFocus?: () => void;
12
- options?: { value: string; label: string }[];
13
- }
6
+ export interface CheckboxInputControllerProps {
7
+ value:
8
+ | string[]
9
+ | { value: string; label: string }[]
10
+ | string
11
+ | { value: string; label: string };
12
+ onChange: (newValue: string[]) => void;
13
+ config?: InputControllerConfig;
14
+ description?: string;
15
+ onFocus?: () => void;
16
+ options?: { value: string; label: string }[];
17
+ }
14
18
  </script>
15
19
 
16
20
  <script lang="ts">
17
- /**
18
- * CheckboxInputController Component
19
- * A reusable checkbox group input component that handles multiple selections from a list of options.
20
- * Supports custom styling, external state management, and accessibility features.
21
- */
22
-
23
- /**
24
- * Svelte Lifecycle Imports
25
- * Required for component setup and cleanup
26
- */
27
- import { onMount, onDestroy } from 'svelte';
28
-
21
+ import { onMount } from 'svelte';
29
22
  /**
30
23
  * UI Components Imports
31
24
  * Shadcn UI checkbox components for consistent styling and behavior
32
25
  */
33
- import { Label, Checkbox } from '@widgetic/design-system/components';
26
+ import { Label, Checkbox } from '@widgetic/design-system/components';
34
27
 
35
- /**
36
- * Component Props
37
- * External properties that configure the checkbox group's behavior and appearance
38
- */
39
- export let value: CheckboxInputControllerProps['value']; // Selected value(s)
40
- export let onChange: CheckboxInputControllerProps['onChange']; // Callback for value changes
41
- export let config: CheckboxInputControllerProps['config'] = {}; // Additional configuration options
42
- export let description: CheckboxInputControllerProps['description'] = undefined; // Optional help description text
43
- export let onFocus: CheckboxInputControllerProps['onFocus'] = () => {}; // Focus event handler
44
-
45
- /**
46
- * Configuration Options
47
- * Derived from config prop with fallbacks
48
- */
49
- export let options: CheckboxInputControllerProps['options'] = config.options || []; // Available options
28
+ export let value: CheckboxInputControllerProps['value'];
29
+ export let onChange: CheckboxInputControllerProps['onChange'];
30
+ export let config: CheckboxInputControllerProps['config'] = {};
31
+ export let description: CheckboxInputControllerProps['description'] = undefined;
32
+ export let onFocus: CheckboxInputControllerProps['onFocus'] = () => {};
33
+ export let options: CheckboxInputControllerProps['options'] = config.options || [];
50
34
 
51
35
  /**
52
36
  * Local state
53
37
  */
54
- let selectedValues: string[] = [];
38
+ let selectedValues: string[] = [];
55
39
 
56
40
  // Initialize selectedValues based on the input value
57
- onMount(() => {
58
- if (Array.isArray(value)) {
59
- selectedValues = value.map(v => typeof v === 'object' ? v.value : v);
60
- } else if (value) {
61
- selectedValues = [typeof value === 'object' ? value.value : value];
62
- }
63
- });
41
+ onMount(() => {
42
+ if (Array.isArray(value)) {
43
+ selectedValues = value.map((v) => (typeof v === 'object' ? v.value : v));
44
+ } else if (value) {
45
+ selectedValues = [typeof value === 'object' ? value.value : value];
46
+ }
47
+ });
64
48
 
65
49
  /**
66
50
  * Handles value changes from the checkbox group
67
51
  * @param optionValue - The value of the clicked checkbox
68
52
  * @param checked - Whether the checkbox is checked or not
69
53
  */
70
- function handleValueChange(optionValue: string, checked: boolean) {
54
+ function handleValueChange(optionValue: string, checked: boolean) {
71
55
  // console.log('CheckboxInputController: handleValueChange', optionValue, checked);
72
-
73
- if (checked) {
56
+ if (checked) {
74
57
  // Add value if not already in array
75
- if (!selectedValues.includes(optionValue)) {
76
- selectedValues = [...selectedValues, optionValue];
77
- }
78
- } else {
79
- // Remove value from array
80
- selectedValues = selectedValues.filter(v => v !== optionValue);
81
- }
82
-
83
- onChange(selectedValues);
84
- }
58
+ if (!selectedValues.includes(optionValue)) {
59
+ selectedValues = [...selectedValues, optionValue];
60
+ }
61
+ } else {
62
+ selectedValues = selectedValues.filter((v) => v !== optionValue);
63
+ }
64
+ onChange(selectedValues);
65
+ }
85
66
 
86
67
  /**
87
68
  * Handles click on the entire row
88
69
  * @param optionValue - The value to toggle
89
70
  */
90
- function handleRowClick(optionValue: string) {
71
+ function handleRowClick(optionValue: string) {
91
72
  // Toggle the checkbox
92
- const isCurrentlySelected = selectedValues.includes(optionValue);
93
- handleValueChange(optionValue, !isCurrentlySelected);
94
- }
73
+ const isCurrentlySelected = selectedValues.includes(optionValue);
74
+ handleValueChange(optionValue, !isCurrentlySelected);
75
+ }
95
76
 
96
77
  /**
97
78
  * Stops event propagation to prevent double-firing of click events
98
79
  * @param event - The mouse event
99
80
  */
100
- function stopPropagation(event: MouseEvent) {
101
- event.stopPropagation();
102
- }
103
-
104
- /**
105
- * Create proper event handlers for shadcn components
106
- */
107
- function createHandlers() {
108
- return {
109
- // Use a function that returns a new object with events
110
- // Note that these are not Svelte event directives but rather
111
- // props expected by the shadcn components
112
- onclick: stopPropagation
113
- };
114
- }
81
+ function stopPropagation(event: MouseEvent) {
82
+ event.stopPropagation();
83
+ }
115
84
 
116
85
  /**
117
86
  * Update local value when external value changes
118
87
  */
119
- $: {
120
- if (value) {
121
- if (Array.isArray(value)) {
122
- selectedValues = value.map(v => typeof v === 'object' ? v.value : v);
123
- } else {
124
- selectedValues = [typeof value === 'object' ? value.value : value];
125
- }
126
- } else {
127
- selectedValues = [];
128
- }
129
- }
88
+ $: {
89
+ if (value) {
90
+ if (Array.isArray(value)) {
91
+ selectedValues = value.map((v) => (typeof v === 'object' ? v.value : v));
92
+ } else {
93
+ selectedValues = [typeof value === 'object' ? value.value : value];
94
+ }
95
+ } else {
96
+ selectedValues = [];
97
+ }
98
+ }
130
99
 
131
100
  /**
132
101
  * Helper function to check if a value is selected
133
102
  */
134
- function isChecked(optionValue: string): boolean {
135
- return selectedValues.includes(optionValue);
136
- }
103
+ function isChecked(optionValue: string): boolean {
104
+ return selectedValues.includes(optionValue);
105
+ }
137
106
  </script>
138
107
 
139
- <div class="flex flex-col gap-2 widgetic-colors">
140
- <div
141
- class="px-4 py-2 rounded-large border border-grey2 bg-grey1 transition-colors duration-200 hover:border-forest-green"
142
- onfocusin={onFocus}
143
- >
144
- <div class="flex flex-col gap-2 py-2">
145
- {#each options as option}
146
- <!-- svelte-ignore a11y_click_events_have_key_events -->
147
- <!-- svelte-ignore a11y_no_static_element_interactions -->
148
- <div class="flex items-center space-x-2 cursor-pointer" onclick={() => handleRowClick(option.value)}>
149
- <Checkbox
150
- id={`checkbox-${option.value}`}
151
- checked={isChecked(option.value)}
152
- onCheckedChange={(checked) => handleValueChange(option.value, checked)}
153
- class="checkbox-item border-grey5 data-[state=checked]:border-sage-green data-[state=checked]:bg-sage-green data-[state=checked]:text-white"
154
- onclick={stopPropagation}
155
- />
156
- <Label
157
- for={`checkbox-${option.value}`}
158
- class="subtext text-grey7 cursor-pointer select-none w-full"
159
- onclick={stopPropagation}
160
- >
161
- {option.label}
162
- </Label>
163
- </div>
164
- {/each}
165
- </div>
166
- </div>
167
-
168
- {#if description}
169
- <p class="subtext text-grey5">{description}</p>
170
- {/if}
108
+ <div class="flex flex-col gap-1">
109
+ <div
110
+ class="flex w-full flex-col gap-2 rounded-lg bg-accent px-3 py-4 transition-colors duration-fast hover:bg-accent-hover focus-within:outline-hidden focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background"
111
+ onfocusin={onFocus}
112
+ >
113
+ {#each options as option}
114
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
115
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
116
+ <div
117
+ class="flex cursor-pointer items-center gap-2"
118
+ onclick={() => handleRowClick(option.value)}
119
+ >
120
+ <Checkbox
121
+ id={`checkbox-${option.value}`}
122
+ checked={isChecked(option.value)}
123
+ onCheckedChange={(checked) => handleValueChange(option.value, checked)}
124
+ onclick={stopPropagation}
125
+ />
126
+ <Label
127
+ for={`checkbox-${option.value}`}
128
+ class="w-full cursor-pointer select-none text-body text-foreground"
129
+ onclick={stopPropagation}
130
+ >
131
+ {option.label}
132
+ </Label>
133
+ </div>
134
+ {/each}
135
+ </div>
136
+
137
+ {#if description}
138
+ <p class="text-caption text-muted-foreground">{description}</p>
139
+ {/if}
171
140
  </div>
172
-
173
- <style>
174
- /* Custom checkbox styling to match design system */
175
- :global(.checkbox-item:focus-visible),
176
- :global(.checkbox-item:focus-within) {
177
- outline: none;
178
- }
179
-
180
- /* Update checkbox styles */
181
- :global(.checkbox-item) {
182
- border-radius: 3px; /* Set rounded corners to 3px */
183
- width: 16px; /* Set width to 20px */
184
- height: 16px; /* Set height to 20px */
185
- border: 2px solid hsl(var(--grey7)); /* Set border to 2px */
186
- display: flex; /* Ensure the checkbox is a flex container */
187
- align-items: center; /* Center the checkmark vertically */
188
- justify-content: center; /* Center the checkmark horizontally */
189
- }
190
-
191
- /* Scale the checkmark */
192
- :global(.checkbox-item svg) {
193
- width: 16px; /* Set width of checkmark to 16px */
194
- height: 16px; /* Set height of checkmark to 16px */
195
- }
196
-
197
- /* Remove pointer events from labels when disabled */
198
- :global(.checkbox-item[disabled] + label) {
199
- pointer-events: none;
200
- opacity: 0.5;
201
- }
202
-
203
- /* Ensure checkmark is white when checked */
204
- :global(.checkbox-item[data-state="checked"]) {
205
- color: white !important;
206
- }
207
-
208
- /* Target the SVG directly for more specificity */
209
- :global(.checkbox-item[data-state="checked"] svg) {
210
- color: white !important;
211
- }
212
-
213
- /* Hide checkmark when unchecked */
214
- :global(.checkbox-item[data-state="unchecked"] svg) {
215
- display: none;
216
- }
217
- </style>
@@ -32,18 +32,12 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
32
32
  z_$$bindings?: Bindings;
33
33
  }
34
34
  declare const CheckboxInputController: $$__sveltets_2_IsomorphicComponent<{
35
- /**
36
- * Component Props
37
- * External properties that configure the checkbox group's behavior and appearance
38
- */ value: CheckboxInputControllerProps["value"];
35
+ value: CheckboxInputControllerProps["value"];
39
36
  onChange: CheckboxInputControllerProps["onChange"];
40
37
  config?: CheckboxInputControllerProps["config"];
41
38
  description?: CheckboxInputControllerProps["description"];
42
39
  onFocus?: CheckboxInputControllerProps["onFocus"];
43
- /**
44
- * Configuration Options
45
- * Derived from config prop with fallbacks
46
- */ options?: CheckboxInputControllerProps["options"];
40
+ options?: CheckboxInputControllerProps["options"];
47
41
  }, {
48
42
  [evt: string]: CustomEvent<any>;
49
43
  }, {}, {}, string>;