@widgetic/editor 4.1.14 → 4.1.16

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 +44 -281
  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 +5 -5
@@ -1,299 +1,333 @@
1
1
  <script lang="ts">
2
- import { onDestroy } from 'svelte';
3
- import { Button, Input } from '@widgetic/design-system/components';
4
- import { IconMinus, IconPlus } from '@widgetic/design-system/icons';
5
-
6
- export let value: number;
7
- export let onChange: (newValue: number) => void;
8
- export let min: number;
9
- export let max: number;
10
- export let step: number = 1;
11
- export let isLocked: boolean = false;
12
- export let onFocus: () => void = () => {};
13
- export let customInputClass: string = "";
14
- export let wrapAround: boolean = false; // For angle input to wrap 0-360
15
- export let suffix: string = ""; // For adding units like degrees (°)
16
- export let width: string = "185px"; // Customizable width
17
-
18
- let inputValue = String(value); // Add this to track input value separately
19
- let isEditing = false;
20
- let isPressed = false;
21
- let disabledOpacity = 60;
22
-
23
- // Fix TypeScript errors by properly typing the timers
24
- let autoRepeatTimer: number | null = null;
25
- let autoRepeatInterval: number | null = null;
26
-
27
- const HOLD_DELAY = 400;
28
- const REPEAT_INTERVAL = 80;
2
+ import { onDestroy } from 'svelte';
3
+ import { Input, StepperButton } from '@widgetic/design-system/components';
4
+ import { useEditorLanguage } from '../../i18n/language';
5
+
6
+ const { t } = useEditorLanguage();
7
+
8
+ export let value: number;
9
+ export let onChange: (newValue: number) => void;
10
+ export let min: number;
11
+ export let max: number;
12
+ export let step: number = 1;
13
+ export let isLocked: boolean = false;
14
+ export let onFocus: () => void = () => {};
15
+ export let customInputClass: string = '';
16
+ export let wrapAround: boolean = false;
17
+ export let suffix: string = '';
18
+ /** Extra classes on the outer control surface (default full width of the control column). */
19
+ let className = '';
20
+ export { className as class };
21
+ export let disabled: boolean = false;
22
+ /** Padding on the accent surface (Figma IC Number vs IC Angle field). */
23
+ export let surfacePaddingClass: string = 'pe-1 ps-3';
24
+ /** @deprecated use `class` — kept for Angle layout width. */
25
+ export let width: string | undefined = undefined;
26
+
27
+ let inputValue = String(value);
28
+ let isEditing = false;
29
+ let isPressed = false;
30
+
31
+ let autoRepeatTimer: ReturnType<typeof setTimeout> | null = null;
32
+ let autoRepeatInterval: ReturnType<typeof setInterval> | null = null;
33
+
34
+ const HOLD_DELAY = 400;
35
+ const REPEAT_INTERVAL = 80;
29
36
 
30
37
  // Add unique ID generation
31
- const inputId = `number-input-${Math.random().toString(36).substr(2, 9)}`;
38
+ const inputId = `number-input-${Math.random().toString(36).substr(2, 9)}`;
32
39
 
33
- $: isAtMin = !wrapAround && value <= min;
34
- $: isAtMax = !wrapAround && value >= max;
40
+ $: isAtMin = !wrapAround && value <= min;
41
+ $: isAtMax = !wrapAround && value >= max;
42
+ $: isDisabled = disabled || isLocked;
35
43
 
36
44
  // Update inputValue when value prop changes and we're not editing
37
- $: if (!isEditing) {
38
- inputValue = String(value);
39
- }
40
-
41
- function handleValueChange(adjustment: number) {
42
- try {
43
- let newValue = value + adjustment;
44
-
45
- if (wrapAround) {
46
- if (newValue >= 360) newValue -= 360;
47
- if (newValue < 0) newValue += 360;
48
- } else {
49
- if (min !== undefined && newValue < min) {
50
- newValue = min;
51
- }
52
- if (max !== undefined && newValue > max) {
53
- newValue = max;
54
- }
55
- }
56
-
57
- value = newValue;
58
- onChange(newValue);
59
- } catch (error) {
60
- console.error('Error in handleValueChange:', error);
61
- }
62
- }
63
-
64
- function handleInput(e: Event) {
65
- const input = e.currentTarget as HTMLInputElement;
66
- inputValue = input.value;
67
-
68
- if (inputValue === '') {
69
- isEditing = true;
70
- return;
71
- }
45
+ $: if (!isEditing) {
46
+ inputValue = String(value);
47
+ }
48
+
49
+ const surfaceBaseClass =
50
+ 'number-controls-surface flex h-9 w-full min-w-0 items-center gap-1 rounded-lg bg-accent 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 disabled:pointer-events-none disabled:opacity-50';
51
+
52
+ function handleValueChange(adjustment: number) {
53
+ try {
54
+ let newValue = value + adjustment;
55
+
56
+ if (wrapAround) {
57
+ if (newValue >= 360) newValue -= 360;
58
+ if (newValue < 0) newValue += 360;
59
+ } else {
60
+ if (min !== undefined && newValue < min) {
61
+ newValue = min;
62
+ }
63
+ if (max !== undefined && newValue > max) {
64
+ newValue = max;
65
+ }
66
+ }
67
+
68
+ value = newValue;
69
+ onChange(newValue);
70
+ } catch (error) {
71
+ console.error('Error in handleValueChange:', error);
72
+ }
73
+ }
74
+
75
+ function handleInput(e: Event) {
76
+ const input = e.currentTarget as HTMLInputElement;
77
+ inputValue = input.value;
78
+
79
+ if (inputValue === '') {
80
+ isEditing = true;
81
+ return;
82
+ }
72
83
 
73
84
  // Handle special cases
74
- if (inputValue === '-0') {
75
- inputValue = '0';
76
- input.value = '0';
77
- value = 0;
78
- onChange(0);
79
- return;
80
- }
85
+ if (inputValue === '-0') {
86
+ inputValue = '0';
87
+ input.value = '0';
88
+ value = 0;
89
+ onChange(0);
90
+ return;
91
+ }
81
92
 
82
93
  // If starts with 0 and has more digits, remove the leading 0
83
- if (inputValue.startsWith('0') && inputValue.length > 1 && !inputValue.startsWith('-')) {
84
- inputValue = inputValue.substring(1);
85
- input.value = inputValue;
86
- }
94
+ if (inputValue.startsWith('0') && inputValue.length > 1 && !inputValue.startsWith('-')) {
95
+ inputValue = inputValue.substring(1);
96
+ input.value = inputValue;
97
+ }
87
98
 
88
99
  // Don't allow minus sign if:
89
100
  // 1. min >= 0
90
101
  // 2. there's already a minus sign
91
102
  // 3. there are numbers before it
92
- if (inputValue.includes('-')) {
93
- if (min >= 0 || inputValue.indexOf('-') > 0 || inputValue.split('-').length > 2) {
103
+ if (inputValue.includes('-')) {
104
+ if (min >= 0 || inputValue.indexOf('-') > 0 || inputValue.split('-').length > 2) {
94
105
  // Remove all minus signs or keep only the first one if allowed
95
- inputValue = min >= 0
96
- ? inputValue.replace(/-/g, '')
97
- : '-' + inputValue.replace(/-/g, '');
98
- input.value = inputValue;
99
- }
100
- }
106
+ inputValue = min >= 0 ? inputValue.replace(/-/g, '') : '-' + inputValue.replace(/-/g, '');
107
+ input.value = inputValue;
108
+ }
109
+ }
101
110
 
102
111
  // Update regex to prevent minus sign if min >= 0
103
112
  // Only allow minus at the start of the string
104
- const validNumberRegex = min >= 0 ? /^\d*$/ : /^-?\d*$/;
105
- if (!validNumberRegex.test(inputValue)) {
113
+ const validNumberRegex = min >= 0 ? /^\d*$/ : /^-?\d*$/;
114
+ if (!validNumberRegex.test(inputValue)) {
106
115
  // Remove any invalid characters
107
- input.value = inputValue.replace(min >= 0 ? /[^\d]/g : /[^\d-]/g, '');
116
+ input.value = inputValue.replace(min >= 0 ? /[^\d]/g : /[^\d-]/g, '');
108
117
  // If there's a minus, ensure it's at the start
109
- if (input.value.includes('-') && input.value.indexOf('-') > 0) {
110
- input.value = input.value.replace(/-/g, '');
111
- }
112
- inputValue = input.value;
113
- return;
114
- }
115
-
116
- const numValue = parseFloat(inputValue);
117
- if (!isNaN(numValue)) {
118
- isEditing = true;
119
-
118
+ if (input.value.includes('-') && input.value.indexOf('-') > 0) {
119
+ input.value = input.value.replace(/-/g, '');
120
+ }
121
+ inputValue = input.value;
122
+ return;
123
+ }
124
+
125
+ const numValue = parseFloat(inputValue);
126
+ if (!isNaN(numValue)) {
127
+ isEditing = true;
128
+
120
129
  // Validate both min and max during typing
121
- if (wrapAround && max === 360) {
122
- if (numValue >= 360) {
123
- inputValue = '359';
124
- value = 359;
125
- onChange(359);
126
- return;
127
- }
128
- } else if (!wrapAround) {
129
- if (numValue > max) {
130
- inputValue = String(max);
131
- value = max;
132
- onChange(max);
133
- return;
134
- }
135
- if (numValue < min) {
136
- inputValue = String(min);
137
- value = min;
138
- onChange(min);
139
- return;
140
- }
141
- }
142
-
130
+ if (wrapAround && max === 360) {
131
+ if (numValue >= 360) {
132
+ inputValue = '359';
133
+ value = 359;
134
+ onChange(359);
135
+ return;
136
+ }
137
+ } else if (!wrapAround) {
138
+ if (numValue > max) {
139
+ inputValue = String(max);
140
+ value = max;
141
+ onChange(max);
142
+ return;
143
+ }
144
+ if (numValue < min) {
145
+ inputValue = String(min);
146
+ value = min;
147
+ onChange(min);
148
+ return;
149
+ }
150
+ }
151
+
143
152
  // Value is within range
144
- value = numValue;
145
- onChange(numValue);
146
- }
147
- }
148
-
149
- function handleBlur() {
150
- isEditing = false;
151
- const finalValue = parseFloat(inputValue);
152
-
153
- if (isNaN(finalValue) || inputValue === '' || inputValue === '-') {
154
- value = min;
155
- inputValue = String(min);
156
- onChange(min);
157
- return;
158
- }
153
+ value = numValue;
154
+ onChange(numValue);
155
+ }
156
+ }
157
+
158
+ function handleBlur() {
159
+ isEditing = false;
160
+ const finalValue = parseFloat(inputValue);
161
+
162
+ if (isNaN(finalValue) || inputValue === '' || inputValue === '-') {
163
+ value = min;
164
+ inputValue = String(min);
165
+ onChange(min);
166
+ return;
167
+ }
159
168
 
160
169
  // Apply validation on blur
161
- let validatedValue = finalValue;
162
- if (!wrapAround) {
163
- if (finalValue < min) {
164
- validatedValue = min;
165
- }
166
- if (finalValue > max) {
167
- validatedValue = max;
168
- }
169
- } else if (wrapAround) {
170
- validatedValue = ((finalValue % 360) + 360) % 360;
171
- }
172
-
173
- value = validatedValue;
174
- inputValue = String(validatedValue);
175
- onChange(validatedValue);
176
- }
177
-
178
- function startAutoRepeat(operation: 'increment' | 'decrement', event: MouseEvent) {
179
- event.preventDefault();
180
- stopAutoRepeat();
181
-
182
- const adjustment = operation === 'increment' ? step : -step;
183
- isPressed = true;
184
- handleValueChange(adjustment);
185
-
186
- autoRepeatTimer = window.setTimeout(() => {
187
- if (isPressed) {
188
- autoRepeatInterval = window.setInterval(() => {
189
- if (isPressed) {
190
- handleValueChange(adjustment);
191
- }
192
- }, REPEAT_INTERVAL);
193
- }
194
- }, HOLD_DELAY);
195
- }
196
-
197
- function stopAutoRepeat(event?: MouseEvent | FocusEvent) {
198
- if (event) {
199
- event.preventDefault();
200
- event.stopPropagation();
201
- }
202
-
203
- if (autoRepeatTimer !== null) {
204
- window.clearTimeout(autoRepeatTimer);
205
- autoRepeatTimer = null;
206
- }
207
- if (autoRepeatInterval !== null) {
208
- window.clearInterval(autoRepeatInterval);
209
- autoRepeatInterval = null;
210
- }
211
-
212
- isPressed = false;
213
- }
214
-
215
- function handleKeyDown(e: KeyboardEvent) {
216
- // ... rest of the function
217
- }
218
-
219
- onDestroy(() => {
220
- stopAutoRepeat();
221
- });
170
+ let validatedValue = finalValue;
171
+ if (!wrapAround) {
172
+ if (finalValue < min) validatedValue = min;
173
+ if (finalValue > max) validatedValue = max;
174
+ } else {
175
+ validatedValue = ((finalValue % 360) + 360) % 360;
176
+ }
177
+
178
+ value = validatedValue;
179
+ inputValue = String(validatedValue);
180
+ onChange(validatedValue);
181
+ }
182
+
183
+ function startAutoRepeat(operation: 'increment' | 'decrement', event: MouseEvent) {
184
+ event.preventDefault();
185
+ stopAutoRepeat();
186
+
187
+ const adjustment = operation === 'increment' ? step : -step;
188
+ isPressed = true;
189
+ handleValueChange(adjustment);
190
+
191
+ autoRepeatTimer = setTimeout(() => {
192
+ if (isPressed) {
193
+ autoRepeatInterval = setInterval(() => {
194
+ if (isPressed) {
195
+ handleValueChange(adjustment);
196
+ }
197
+ }, REPEAT_INTERVAL);
198
+ }
199
+ }, HOLD_DELAY);
200
+ }
201
+
202
+ function stopAutoRepeat(event?: MouseEvent | FocusEvent) {
203
+ if (event) {
204
+ event.preventDefault();
205
+ event.stopPropagation();
206
+ }
207
+
208
+ if (autoRepeatTimer !== null) {
209
+ clearTimeout(autoRepeatTimer);
210
+ autoRepeatTimer = null;
211
+ }
212
+ if (autoRepeatInterval !== null) {
213
+ clearInterval(autoRepeatInterval);
214
+ autoRepeatInterval = null;
215
+ }
216
+
217
+ isPressed = false;
218
+ }
219
+
220
+ function handleKeyDown(e: KeyboardEvent) {
221
+ if ((e.metaKey || e.ctrlKey) && e.key === 'a') {
222
+ isEditing = true;
223
+ return;
224
+ }
225
+
226
+ if (
227
+ e.key === 'Backspace' ||
228
+ e.key === 'Delete' ||
229
+ e.key === 'ArrowLeft' ||
230
+ e.key === 'ArrowRight' ||
231
+ e.key === 'Tab'
232
+ ) {
233
+ isEditing = true;
234
+ return;
235
+ }
236
+
237
+ if (e.metaKey || e.ctrlKey) {
238
+ return;
239
+ }
240
+
241
+ if (e.key === 'ArrowUp') {
242
+ e.preventDefault();
243
+ handleValueChange(step);
244
+ } else if (e.key === 'ArrowDown') {
245
+ e.preventDefault();
246
+ handleValueChange(-step);
247
+ }
248
+ }
249
+
250
+ onDestroy(() => {
251
+ stopAutoRepeat();
252
+ });
222
253
  </script>
223
254
 
224
- <div class="h-[48px] rounded-large border border-grey2 flex items-center bg-grey1 transition-colors duration-200 hover:border-forest-green" style="width: {width}">
225
- <div class="flex-1 relative flex items-center">
226
- <div class="flex items-center flex-1">
227
- <Input
228
- id={inputId}
229
- type="text"
230
- value={inputValue}
231
- onfocus={onFocus}
232
- oninput={handleInput}
233
- onblur={handleBlur}
234
- readonly={isLocked}
235
- class="w-full h-full border-0 bg-transparent subtext text-grey7 placeholder:text-grey3 focus-visible:ring-0 focus-visible:ring-offset-0 ps-4 {customInputClass}"
236
- />
237
- {#if suffix}
238
- <span class="subtext text-grey7 pointer-events-none -ms-1">
239
- {suffix}
240
- </span>
241
- {/if}
242
- </div>
243
- </div>
244
-
245
- <div class="flex items-center gap-2 px-2">
246
- <Button
247
- variant="outline"
248
- size="icon"
249
- class="widgetic-colors h-6 w-6 rounded-lg bg-white border border-grey2 transition-colors group active:scale-95"
250
- disabled={isLocked || isAtMin}
251
- onmousedown={(e: MouseEvent) => startAutoRepeat('decrement', e)}
252
- onmouseup={stopAutoRepeat}
253
- onmouseleave={stopAutoRepeat}
254
- style="opacity: {isLocked || isAtMin ? disabledOpacity : 100}%"
255
- >
256
- <IconMinus
257
- class="!text-grey5 group-hover:!text-grey7"
258
- style="width: 20px !important; height: 20px !important; min-width: 20px !important; min-height: 20px !important; max-width: 20px !important; max-height: 20px !important;"
259
- />
260
- </Button>
261
-
262
- <Button
263
- variant="outline"
264
- size="icon"
265
- class="widgetic-colors h-6 w-6 rounded-lg bg-white border border-grey2 transition-colors group active:scale-95"
266
- disabled={isLocked || isAtMax}
267
- onmousedown={(e: MouseEvent) => startAutoRepeat('increment', e)}
268
- onmouseup={stopAutoRepeat}
269
- onmouseleave={stopAutoRepeat}
270
- style="opacity: {isLocked || isAtMax ? disabledOpacity : 100}%"
271
- >
272
- <IconPlus
273
- class="!text-grey5 group-hover:!text-grey7"
274
- style="width: 20px !important; height: 20px !important; min-width: 20px !important; min-height: 20px !important; max-width: 20px !important; max-height: 20px !important;"
275
- />
276
- </Button>
277
- </div>
255
+ <div
256
+ class="{surfaceBaseClass} {surfacePaddingClass} {className}"
257
+ style={width ? `width: ${width}` : undefined}
258
+ class:opacity-50={disabled}
259
+ class:pointer-events-none={disabled}
260
+ >
261
+ <div
262
+ class="flex min-w-0 flex-1 items-center {suffix
263
+ ? 'justify-start gap-0'
264
+ : ''}"
265
+ >
266
+ {#if suffix}
267
+ <div class="number-controls-value inline-flex max-w-full min-w-0 items-baseline gap-0">
268
+ <Input
269
+ id={inputId}
270
+ type="text"
271
+ value={inputValue}
272
+ onfocus={onFocus}
273
+ oninput={handleInput}
274
+ onblur={handleBlur}
275
+ onkeydown={handleKeyDown}
276
+ readonly={isLocked}
277
+ {disabled}
278
+ size={Math.max(1, inputValue.length)}
279
+ class="number-controls-input number-controls-input-with-suffix h-full w-auto min-w-[1ch] max-w-full shrink border-0 bg-transparent px-0 text-start text-body text-foreground shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 {customInputClass}"
280
+ />
281
+ <span class="pointer-events-none shrink-0 text-body text-foreground">{suffix}</span>
282
+ </div>
283
+ {:else}
284
+ <Input
285
+ id={inputId}
286
+ type="text"
287
+ value={inputValue}
288
+ onfocus={onFocus}
289
+ oninput={handleInput}
290
+ onblur={handleBlur}
291
+ onkeydown={handleKeyDown}
292
+ readonly={isLocked}
293
+ {disabled}
294
+ class="number-controls-input h-full min-w-0 flex-1 border-0 bg-transparent px-0 text-body text-foreground shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 {customInputClass}"
295
+ />
296
+ {/if}
297
+ </div>
298
+
299
+ <div class="flex shrink-0 items-center gap-0">
300
+ <StepperButton
301
+ kind="minus"
302
+ label={$t('editor.stepper.decrease')}
303
+ disabled={isDisabled || isAtMin}
304
+ onmousedown={(e: MouseEvent) => startAutoRepeat('decrement', e)}
305
+ onmouseup={stopAutoRepeat}
306
+ onmouseleave={stopAutoRepeat}
307
+ />
308
+ <StepperButton
309
+ kind="plus"
310
+ label={$t('editor.stepper.increase')}
311
+ disabled={isDisabled || isAtMax}
312
+ onmousedown={(e: MouseEvent) => startAutoRepeat('increment', e)}
313
+ onmouseup={stopAutoRepeat}
314
+ onmouseleave={stopAutoRepeat}
315
+ />
316
+ </div>
278
317
  </div>
279
318
 
280
319
  <style>
281
- :global([id^="number-input-"]) {
282
- text-align: start;
283
- appearance: textfield;
284
- -moz-appearance: textfield;
285
- padding-inline-end: 0 !important;
286
- }
287
-
288
- :global([id^="number-input-"]::-webkit-outer-spin-button),
289
- :global([id^="number-input-"]::-webkit-inner-spin-button) {
290
- -webkit-appearance: none;
291
- appearance: none;
292
- margin: 0;
293
- }
294
-
295
- :global(.number-input-button:focus-visible) {
296
- outline: none !important;
297
- box-shadow: none !important;
298
- }
299
- </style>
320
+ :global(.number-controls-input) {
321
+ text-align: start;
322
+ appearance: textfield;
323
+ -moz-appearance: textfield;
324
+ padding-inline-end: 0 !important;
325
+ }
326
+
327
+ :global(.number-controls-input::-webkit-outer-spin-button),
328
+ :global(.number-controls-input::-webkit-inner-spin-button) {
329
+ -webkit-appearance: none;
330
+ appearance: none;
331
+ margin: 0;
332
+ }
333
+ </style>
@@ -22,7 +22,10 @@ declare const NumberControls: $$__sveltets_2_IsomorphicComponent<{
22
22
  customInputClass?: string;
23
23
  wrapAround?: boolean;
24
24
  suffix?: string;
25
- width?: string;
25
+ /** Extra classes on the outer control surface (default full width of the control column). */ class?: string;
26
+ disabled?: boolean;
27
+ /** Padding on the accent surface (Figma IC Number vs IC Angle field). */ surfacePaddingClass?: string;
28
+ /** @deprecated use `class` — kept for Angle layout width. */ width?: string | undefined;
26
29
  }, {
27
30
  [evt: string]: CustomEvent<any>;
28
31
  }, {}, {}, string>;