xmlui 0.10.11 → 0.10.13
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/lib/{index-BuIblMfO.mjs → index-Db5iQkFp.mjs} +1918 -2312
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-CV-9AUzP.mjs → initMock-B9LtmFJG.mjs} +1 -1
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-DzONZF-e.mjs → metadata-utils-D90qqMGc.mjs} +1 -1
- package/dist/lib/scss/components-core/theming/_themes.scss +1 -1
- package/dist/lib/{server-common-Dsyp3-Ro.mjs → server-common-lmBDLpUh.mjs} +2595 -2571
- package/dist/lib/{transform-CBz7TQJh.mjs → transform-bHBjkKSL.mjs} +2 -1
- package/dist/lib/xmlui-parser.d.ts +17 -8
- package/dist/lib/xmlui-parser.mjs +2 -2
- package/dist/lib/{xmlui-serializer-Bf9bdvlV.mjs → xmlui-serializer-DB6BLiXK.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +3 -1
- package/dist/lib/xmlui.mjs +2 -2
- package/dist/metadata/{collectedComponentMetadata-Cdi6AFD3.mjs → collectedComponentMetadata-BN8eg9Gr.mjs} +1903 -2296
- package/dist/metadata/{initMock-B7OlSKKb.mjs → initMock-J7pN8owj.mjs} +1 -1
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +3 -3
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +1 -1
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +5 -1
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +7 -4
- package/dist/scripts/src/components/Avatar/Avatar.js +1 -1
- package/dist/scripts/src/components/Charts/BarChart/BarChart.js +6 -6
- package/dist/scripts/src/components/Charts/BarChart/BarChartNative.js +25 -15
- package/dist/scripts/src/components/Charts/LineChart/LineChart.js +5 -5
- package/dist/scripts/src/components/Charts/LineChart/LineChartNative.js +14 -4
- package/dist/scripts/src/components/ColorPicker/ColorPicker.js +3 -3
- package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +33 -5
- package/dist/scripts/src/components/ComponentProvider.js +0 -6
- package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +1 -1
- package/dist/scripts/src/components/FileInput/FileInputNative.js +14 -10
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZoneNative.js +1 -1
- package/dist/scripts/src/components/Footer/FooterNative.js +1 -1
- package/dist/scripts/src/components/Form/Form.js +6 -0
- package/dist/scripts/src/components/Form/FormNative.js +18 -6
- package/dist/scripts/src/components/FormItem/FormItemNative.js +0 -9
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +5 -5
- package/dist/scripts/src/components/Fragment/Fragment.js +5 -1
- package/dist/scripts/src/components/Heading/Heading.js +0 -12
- package/dist/scripts/src/components/Icon/IconNative.js +24 -6
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +9 -1
- package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +6 -4
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +208 -78
- package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +17 -1
- package/dist/scripts/src/components/Spinner/SpinnerNative.js +3 -2
- package/dist/scripts/src/components/Table/Table.js +8 -5
- package/dist/scripts/src/components/Table/TableNative.js +1 -1
- package/dist/scripts/src/components/Text/Text.js +0 -13
- package/dist/scripts/src/components/TextArea/TextAreaNative.js +8 -1
- package/dist/scripts/src/components/Theme/NotificationToast.js +4 -1
- package/dist/scripts/src/components-core/CompoundComponent.js +4 -4
- package/dist/scripts/src/components-core/RestApiProxy.js +4 -3
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +1 -1
- package/dist/scripts/src/components-core/rendering/Container.js +19 -8
- package/dist/scripts/src/components-core/rendering/reducer.js +1 -1
- package/dist/scripts/src/components-core/theming/themes/root.js +13 -20
- package/dist/scripts/src/parsers/xmlui-parser/syntax-kind.js +9 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +2 -1
- package/dist/standalone/xmlui-standalone.es.d.ts +3 -1
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +1 -1
- package/dist/scripts/src/components/NumberBox/NumberBox2.js +0 -99
- package/dist/scripts/src/components/NumberBox/NumberBox2Native.js +0 -420
- package/dist/scripts/src/components/RadioGroup/RadioItem.js +0 -28
|
@@ -60,6 +60,8 @@ const InputAdornment_1 = require("../Input/InputAdornment");
|
|
|
60
60
|
const ButtonNative_1 = require("../Button/ButtonNative");
|
|
61
61
|
const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
|
|
62
62
|
const parts_1 = require("../../components-core/parts");
|
|
63
|
+
const PART_SPINNER_UP = "spinnerUp";
|
|
64
|
+
const PART_SPINNER_DOWN = "spinnerDown";
|
|
63
65
|
// Default props for NumberBox component
|
|
64
66
|
exports.defaultProps = {
|
|
65
67
|
enabled: true,
|
|
@@ -140,45 +142,83 @@ exports.NumberBox = (0, react_1.forwardRef)(function NumberBox(_a, forwardedRef)
|
|
|
140
142
|
// --- Register stepper logic to buttons
|
|
141
143
|
useLongPress(upButton.current, handleIncStep);
|
|
142
144
|
useLongPress(downButton.current, handleDecStep);
|
|
143
|
-
// ---
|
|
144
|
-
const
|
|
145
|
-
var _a, _b;
|
|
146
|
-
// --- Prevent the default behavior for some characters
|
|
147
|
-
let shouldPreventDefault = false;
|
|
148
|
-
const currentValue = (_a = event.target.value) !== null && _a !== void 0 ? _a : "";
|
|
149
|
-
const currentPos = event.target.selectionStart;
|
|
145
|
+
// --- Shared character validation logic
|
|
146
|
+
const processCharacterInput = (0, react_1.useCallback)((char, currentValue, currentPos, predictedValue, isForPaste = false) => {
|
|
150
147
|
// --- Are the caret after the exponential separator?
|
|
151
|
-
const beforeCaret = currentValue.substring(0,
|
|
152
|
-
// --- If "expPos" is -1, the caret is not after the exponential separator
|
|
148
|
+
const beforeCaret = currentValue.substring(0, currentPos);
|
|
153
149
|
const expPos = beforeCaret.indexOf(numberbox_abstractions_1.EXPONENTIAL_SEPARATOR);
|
|
154
|
-
|
|
150
|
+
let shouldAccept = true;
|
|
151
|
+
let shouldPreventDefault = false;
|
|
152
|
+
let newValue = currentValue;
|
|
153
|
+
let newPos = currentPos;
|
|
154
|
+
switch (char) {
|
|
155
155
|
case "-":
|
|
156
|
+
shouldAccept = false;
|
|
156
157
|
shouldPreventDefault = true;
|
|
158
|
+
if (zeroOrPositive) {
|
|
159
|
+
// --- No minus sign allowed
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
157
162
|
if (expPos === -1) {
|
|
158
163
|
// --- Change the first char to "-" if we are before the exponential separator and it's not already there
|
|
159
164
|
if (!currentValue.startsWith("-")) {
|
|
160
|
-
|
|
165
|
+
newValue = "-" + currentValue;
|
|
166
|
+
newPos = currentPos + 1;
|
|
161
167
|
}
|
|
162
168
|
}
|
|
163
169
|
else {
|
|
164
170
|
// --- Change the char after the exponential separator to "-" if it's not already there
|
|
165
171
|
if (currentValue[expPos + 1] !== "-") {
|
|
166
|
-
|
|
172
|
+
newValue =
|
|
173
|
+
currentValue.substring(0, expPos + 1) + "-" + currentValue.substring(expPos + 1);
|
|
174
|
+
newPos = currentPos + 1;
|
|
167
175
|
}
|
|
168
176
|
}
|
|
169
177
|
break;
|
|
170
178
|
case "+":
|
|
179
|
+
shouldAccept = false;
|
|
171
180
|
shouldPreventDefault = true;
|
|
172
181
|
if (expPos === -1) {
|
|
173
182
|
// --- Remove the first char if it's "-" and we are before the exponential separator
|
|
174
183
|
if (currentValue.startsWith("-")) {
|
|
175
|
-
|
|
184
|
+
newValue = currentValue.substring(1);
|
|
185
|
+
newPos = Math.max(0, currentPos - 1);
|
|
176
186
|
}
|
|
177
187
|
}
|
|
178
188
|
else {
|
|
179
189
|
// --- Remove the char after the exponential separator if it's "-"
|
|
180
190
|
if (currentValue[expPos + 1] === "-") {
|
|
181
|
-
|
|
191
|
+
newValue = currentValue.substring(0, expPos + 1) + currentValue.substring(expPos + 2);
|
|
192
|
+
newPos = Math.max(expPos + 1, currentPos - 1);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
break;
|
|
196
|
+
case "0":
|
|
197
|
+
// --- Prevent leading zeros (before decimal or exponential separator)
|
|
198
|
+
if (currentValue === "0") {
|
|
199
|
+
shouldAccept = false;
|
|
200
|
+
shouldPreventDefault = true;
|
|
201
|
+
}
|
|
202
|
+
break;
|
|
203
|
+
case "1":
|
|
204
|
+
case "2":
|
|
205
|
+
case "3":
|
|
206
|
+
case "4":
|
|
207
|
+
case "5":
|
|
208
|
+
case "6":
|
|
209
|
+
case "7":
|
|
210
|
+
case "8":
|
|
211
|
+
case "9":
|
|
212
|
+
// --- Replace leading zero with this digit
|
|
213
|
+
if (currentValue === "0" && currentPos === 1) {
|
|
214
|
+
if (isForPaste) {
|
|
215
|
+
newValue = char;
|
|
216
|
+
shouldAccept = false; // Don't add it again for paste
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
newValue = char;
|
|
220
|
+
newPos = 1;
|
|
221
|
+
shouldPreventDefault = true;
|
|
182
222
|
}
|
|
183
223
|
}
|
|
184
224
|
break;
|
|
@@ -186,97 +226,170 @@ exports.NumberBox = (0, react_1.forwardRef)(function NumberBox(_a, forwardedRef)
|
|
|
186
226
|
// --- Prevent multiple decimal separators (integers only),
|
|
187
227
|
// --- or decimal separator after the exponential separator
|
|
188
228
|
if (integersOnly || currentValue.includes(numberbox_abstractions_1.DECIMAL_SEPARATOR) || expPos !== -1) {
|
|
229
|
+
shouldAccept = false;
|
|
230
|
+
shouldPreventDefault = true;
|
|
231
|
+
}
|
|
232
|
+
else if (predictedValue.startsWith(numberbox_abstractions_1.DECIMAL_SEPARATOR) && currentPos === 0) {
|
|
233
|
+
newValue = "0" + predictedValue;
|
|
234
|
+
newPos = currentPos + 2;
|
|
189
235
|
shouldPreventDefault = true;
|
|
190
236
|
}
|
|
191
237
|
break;
|
|
192
238
|
case numberbox_abstractions_1.EXPONENTIAL_SEPARATOR:
|
|
193
239
|
// --- Prevent exponential notation for integers
|
|
194
240
|
if (integersOnly) {
|
|
241
|
+
shouldAccept = false;
|
|
195
242
|
shouldPreventDefault = true;
|
|
196
243
|
break;
|
|
197
244
|
}
|
|
198
|
-
// --- Prevent multiple exponential separators
|
|
199
|
-
if (currentValue.includes(numberbox_abstractions_1.EXPONENTIAL_SEPARATOR)
|
|
200
|
-
|
|
245
|
+
// --- Prevent multiple exponential separators
|
|
246
|
+
if (currentValue.includes(numberbox_abstractions_1.EXPONENTIAL_SEPARATOR)) {
|
|
247
|
+
shouldAccept = false;
|
|
201
248
|
shouldPreventDefault = true;
|
|
202
249
|
}
|
|
203
250
|
break;
|
|
204
251
|
default:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
if (newInput.startsWith("-")) {
|
|
211
|
-
if (selectionStart > 0) {
|
|
212
|
-
shouldPreventDefault = true;
|
|
213
|
-
break;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
else if (newInput.startsWith("+")) {
|
|
252
|
+
// --- Only allow digits for single characters
|
|
253
|
+
if (char >= "0" && char <= "9") {
|
|
254
|
+
// --- Prevent digits before minus sign
|
|
255
|
+
if (currentValue.startsWith("-") && currentPos === 0) {
|
|
256
|
+
shouldAccept = false;
|
|
217
257
|
shouldPreventDefault = true;
|
|
218
258
|
break;
|
|
219
259
|
}
|
|
220
|
-
// ---
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
260
|
+
// --- For beforeInput, check for too many digits after exponential separator
|
|
261
|
+
if (!isForPaste && expPos !== -1) {
|
|
262
|
+
const tooManyDigitsAfterExponentialSeparator = (pos, maxDigits) => {
|
|
263
|
+
let numDigitsAfter = 0;
|
|
264
|
+
while (pos < currentValue.length) {
|
|
265
|
+
if (/\d/.test(currentValue[pos++])) {
|
|
266
|
+
numDigitsAfter++;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
numDigitsAfter = maxDigits + 1;
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return numDigitsAfter > maxDigits;
|
|
274
|
+
};
|
|
275
|
+
if (tooManyDigitsAfterExponentialSeparator(expPos + 1, 1)) {
|
|
276
|
+
shouldAccept = false;
|
|
277
|
+
shouldPreventDefault = true;
|
|
278
|
+
}
|
|
232
279
|
}
|
|
233
|
-
break;
|
|
234
280
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
281
|
+
else {
|
|
282
|
+
// --- Reject non-digit characters
|
|
283
|
+
shouldAccept = false;
|
|
284
|
+
shouldPreventDefault = true;
|
|
285
|
+
}
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
return { shouldAccept, newValue, newPos, shouldPreventDefault };
|
|
289
|
+
}, [integersOnly, zeroOrPositive]);
|
|
290
|
+
// --- This logic prevents the user from typing invalid characters (in the current typing context)
|
|
291
|
+
const handleOnBeforeInput = (event) => {
|
|
292
|
+
var _a, _b;
|
|
293
|
+
const currentValue = (_a = event.target.value) !== null && _a !== void 0 ? _a : "";
|
|
294
|
+
const currentPos = event.target.selectionStart;
|
|
295
|
+
const expectedNewValue = currentValue.substring(0, currentPos) +
|
|
296
|
+
event.data +
|
|
297
|
+
currentValue.substring(event.target.selectionEnd);
|
|
298
|
+
// --- Handle multi-character input (paste) through the legacy path
|
|
299
|
+
if (((_b = event.data) === null || _b === void 0 ? void 0 : _b.length) > 1) {
|
|
300
|
+
let shouldPreventDefault = false;
|
|
301
|
+
const selectionStart = event.target.selectionStart;
|
|
302
|
+
let newInput = event.data;
|
|
303
|
+
// --- Decide whether to accept the optional sign character
|
|
304
|
+
if (newInput.startsWith("-")) {
|
|
305
|
+
if (selectionStart > 0) {
|
|
238
306
|
shouldPreventDefault = true;
|
|
239
|
-
break;
|
|
240
307
|
}
|
|
241
|
-
|
|
242
|
-
|
|
308
|
+
}
|
|
309
|
+
else if (newInput.startsWith("+")) {
|
|
310
|
+
shouldPreventDefault = true;
|
|
311
|
+
}
|
|
312
|
+
if (!shouldPreventDefault) {
|
|
313
|
+
// --- Check for integers
|
|
314
|
+
if (integersOnly && !numberbox_abstractions_1.INT_REGEXP.test(expectedNewValue)) {
|
|
315
|
+
// --- The result is not an integer, drop the pasted input
|
|
243
316
|
shouldPreventDefault = true;
|
|
244
|
-
break;
|
|
245
317
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
// --- Caret after the exponential separator
|
|
249
|
-
// --- Prevent typing a digi if more than 2 digits after the exponential separator
|
|
318
|
+
else if (!numberbox_abstractions_1.FLOAT_REGEXP.test(expectedNewValue)) {
|
|
319
|
+
// --- The result is not a float, drop the pasted input
|
|
250
320
|
shouldPreventDefault = true;
|
|
251
321
|
}
|
|
252
|
-
|
|
322
|
+
}
|
|
323
|
+
if (shouldPreventDefault) {
|
|
324
|
+
event.preventDefault();
|
|
325
|
+
}
|
|
326
|
+
return;
|
|
253
327
|
}
|
|
254
|
-
// ---
|
|
255
|
-
|
|
328
|
+
// --- Single character processing
|
|
329
|
+
const result = processCharacterInput(event.data, currentValue, currentPos, expectedNewValue, false);
|
|
330
|
+
if (result.shouldPreventDefault) {
|
|
256
331
|
event.preventDefault();
|
|
257
332
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
333
|
+
// --- Apply value changes if needed
|
|
334
|
+
if (result.newValue !== currentValue) {
|
|
335
|
+
const setNewValue = (newValue, pos) => {
|
|
336
|
+
var _a;
|
|
337
|
+
event.target.value = newValue;
|
|
338
|
+
updateValue(newValue, newValue);
|
|
339
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.setSelectionRange(pos, pos);
|
|
340
|
+
};
|
|
341
|
+
setNewValue(result.newValue, result.newPos);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
// --- Handle paste events by applying the same character validation logic
|
|
345
|
+
const handleOnPaste = (0, react_1.useCallback)((event) => {
|
|
346
|
+
var _a, _b, _c;
|
|
347
|
+
event.preventDefault();
|
|
348
|
+
const pastedText = event.clipboardData.getData("text/plain");
|
|
349
|
+
if (!pastedText)
|
|
350
|
+
return;
|
|
351
|
+
const inputElement = event.currentTarget;
|
|
352
|
+
const currentValue = (_a = inputElement.value) !== null && _a !== void 0 ? _a : "";
|
|
353
|
+
const selectionStart = (_b = inputElement.selectionStart) !== null && _b !== void 0 ? _b : 0;
|
|
354
|
+
const selectionEnd = (_c = inputElement.selectionEnd) !== null && _c !== void 0 ? _c : 0;
|
|
355
|
+
const expectedNewValue = currentValue.substring(0, selectionStart) +
|
|
356
|
+
pastedText +
|
|
357
|
+
currentValue.substring(selectionEnd);
|
|
358
|
+
// --- Start with the value before the selection
|
|
359
|
+
let resultValue = currentValue.substring(0, selectionStart);
|
|
360
|
+
let currentPos = selectionStart;
|
|
361
|
+
// --- Process each character from the pasted text
|
|
362
|
+
for (let i = 0; i < pastedText.length; i++) {
|
|
363
|
+
const char = pastedText[i];
|
|
364
|
+
const result = processCharacterInput(char, resultValue, currentPos, expectedNewValue, true);
|
|
365
|
+
if (result.shouldAccept) {
|
|
366
|
+
resultValue =
|
|
367
|
+
resultValue.substring(0, currentPos) + char + resultValue.substring(currentPos);
|
|
368
|
+
currentPos++;
|
|
369
|
+
}
|
|
370
|
+
else if (result.newValue !== resultValue) {
|
|
371
|
+
// --- Handle special cases like sign changes or zero replacement
|
|
372
|
+
resultValue = result.newValue;
|
|
373
|
+
currentPos = result.newPos;
|
|
270
374
|
}
|
|
271
|
-
return numDigitsAfter > maxDigits;
|
|
272
375
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
376
|
+
// --- Add the rest of the original value after the selection
|
|
377
|
+
resultValue += currentValue.substring(selectionEnd);
|
|
378
|
+
// --- Final validation - ensure the result is a valid number format
|
|
379
|
+
let isValidFinal = false;
|
|
380
|
+
if (integersOnly) {
|
|
381
|
+
isValidFinal = numberbox_abstractions_1.INT_REGEXP.test(resultValue) || resultValue === "" || resultValue === "-";
|
|
278
382
|
}
|
|
279
|
-
|
|
383
|
+
else {
|
|
384
|
+
isValidFinal = numberbox_abstractions_1.FLOAT_REGEXP.test(resultValue) || resultValue === "" || resultValue === "-";
|
|
385
|
+
}
|
|
386
|
+
// --- Apply the result if valid
|
|
387
|
+
if (isValidFinal) {
|
|
388
|
+
inputElement.value = resultValue;
|
|
389
|
+
updateValue(resultValue, resultValue);
|
|
390
|
+
inputElement.setSelectionRange(currentPos, currentPos);
|
|
391
|
+
}
|
|
392
|
+
}, [processCharacterInput, updateValue, integersOnly]);
|
|
280
393
|
// --- Setting steppers with keyboard
|
|
281
394
|
const handleOnKey = (0, react_1.useCallback)((event) => {
|
|
282
395
|
if (event.code === "ArrowUp") {
|
|
@@ -293,9 +406,26 @@ exports.NumberBox = (0, react_1.forwardRef)(function NumberBox(_a, forwardedRef)
|
|
|
293
406
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
294
407
|
}, [onFocus]);
|
|
295
408
|
const handleOnBlur = (0, react_1.useCallback)(() => {
|
|
296
|
-
|
|
409
|
+
var _a, _b;
|
|
410
|
+
// --- Get the current input value
|
|
411
|
+
const currentInputValue = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
|
|
412
|
+
// --- Check if we need to add a trailing zero
|
|
413
|
+
let finalValue = currentInputValue;
|
|
414
|
+
if (!integersOnly && currentInputValue.endsWith(numberbox_abstractions_1.DECIMAL_SEPARATOR)) {
|
|
415
|
+
// --- Add trailing zero if the value ends with decimal separator
|
|
416
|
+
finalValue = currentInputValue + "0";
|
|
417
|
+
// --- Update the input and state with the new value
|
|
418
|
+
if (inputRef.current) {
|
|
419
|
+
inputRef.current.value = finalValue;
|
|
420
|
+
}
|
|
421
|
+
updateValue(finalValue, finalValue);
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
// --- Use the standard representation mapping
|
|
425
|
+
setValueStrRep((0, numberbox_abstractions_1.mapToRepresentation)(value));
|
|
426
|
+
}
|
|
297
427
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
298
|
-
}, [value, onBlur]);
|
|
428
|
+
}, [value, onBlur, integersOnly, updateValue]);
|
|
299
429
|
const focus = (0, react_1.useCallback)(() => {
|
|
300
430
|
var _a;
|
|
301
431
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -323,7 +453,7 @@ exports.NumberBox = (0, react_1.forwardRef)(function NumberBox(_a, forwardedRef)
|
|
|
323
453
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
324
454
|
}, style: { gap }, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { "data-part-id": parts_1.PART_START_ADORNMENT, text: startText, iconName: startIcon, className: (0, classnames_1.default)(NumberBox_module_scss_1.default.adornment) }), (0, jsx_runtime_1.jsx)("input", { id: id, "data-part-id": parts_1.PART_INPUT, type: "text", inputMode: "numeric", className: (0, classnames_1.default)(NumberBox_module_scss_1.default.input, {
|
|
325
455
|
[NumberBox_module_scss_1.default.readOnly]: readOnly,
|
|
326
|
-
}), disabled: !enabled, value: valueStrRep, step: step, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onBeforeInput: handleOnBeforeInput, onKeyDown: handleOnKey, readOnly: readOnly, ref: inputRef, autoFocus: autoFocus, maxLength: maxLength, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { "data-part-id": parts_1.PART_END_ADORNMENT, text: endText, iconName: endIcon, className: (0, classnames_1.default)(NumberBox_module_scss_1.default.adornment) }), hasSpinBox && ((0, jsx_runtime_1.jsxs)("div", { className: NumberBox_module_scss_1.default.spinnerBox, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-spinner": "up", type: "button", role: "spinbutton", variant: "ghost", themeColor: "secondary", tabIndex: -1, className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: upButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: spinnerUpIcon || "spinnerUp:NumberBox", fallback: "chevronup", size: "sm" }) }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-spinner": "down", type: "button", role: "spinbutton", tabIndex: -1, variant: "ghost", themeColor: "secondary", className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: downButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: spinnerDownIcon || "spinnerDown:NumberBox", fallback: "chevrondown", size: "sm" }) })] }))] }) })));
|
|
456
|
+
}), disabled: !enabled, value: valueStrRep, step: step, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onBeforeInput: handleOnBeforeInput, onPaste: handleOnPaste, onKeyDown: handleOnKey, readOnly: readOnly, ref: inputRef, autoFocus: autoFocus, maxLength: maxLength, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { "data-part-id": parts_1.PART_END_ADORNMENT, text: endText, iconName: endIcon, className: (0, classnames_1.default)(NumberBox_module_scss_1.default.adornment) }), hasSpinBox && ((0, jsx_runtime_1.jsxs)("div", { className: NumberBox_module_scss_1.default.spinnerBox, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-part-id": PART_SPINNER_UP, "data-spinner": "up", type: "button", role: "spinbutton", variant: "ghost", themeColor: "secondary", tabIndex: -1, className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: upButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: spinnerUpIcon || "spinnerUp:NumberBox", fallback: "chevronup", size: "sm" }) }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-part-id": PART_SPINNER_DOWN, "data-spinner": "down", type: "button", role: "spinbutton", tabIndex: -1, variant: "ghost", themeColor: "secondary", className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: downButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: spinnerDownIcon || "spinnerDown:NumberBox", fallback: "chevrondown", size: "sm" }) })] }))] }) })));
|
|
327
457
|
});
|
|
328
458
|
function applyStep(valueStrRep, step, min, max, integersOnly) {
|
|
329
459
|
const currentValue = (0, numberbox_abstractions_1.toUsableNumber)(valueStrRep, integersOnly);
|
|
@@ -89,6 +89,22 @@ exports.RadioGroup = (0, react_1.forwardRef)(function RadioGroup(_a, forwardedRe
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}, [autofocus]);
|
|
92
|
+
// --- Custom focus handler for label clicks
|
|
93
|
+
const focusActiveOption = (0, react_1.useCallback)(() => {
|
|
94
|
+
if (radioGroupRef.current) {
|
|
95
|
+
// First try to find the currently selected radio option
|
|
96
|
+
const selectedRadio = radioGroupRef.current.querySelector('[role="radio"][aria-checked="true"]');
|
|
97
|
+
if (selectedRadio) {
|
|
98
|
+
selectedRadio.focus();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
// If no option is selected, focus the first one
|
|
102
|
+
const firstRadio = radioGroupRef.current.querySelector('[role="radio"]');
|
|
103
|
+
if (firstRadio) {
|
|
104
|
+
firstRadio.focus();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, []);
|
|
92
108
|
// --- Handle the value change events for this input
|
|
93
109
|
const updateValue = (0, react_1.useCallback)((value) => {
|
|
94
110
|
updateState({ value });
|
|
@@ -120,7 +136,7 @@ exports.RadioGroup = (0, react_1.forwardRef)(function RadioGroup(_a, forwardedRe
|
|
|
120
136
|
const contextValue = (0, react_1.useMemo)(() => {
|
|
121
137
|
return { value, setValue: updateValue, status: validationStatus, enabled };
|
|
122
138
|
}, [value, updateValue, validationStatus, enabled]);
|
|
123
|
-
return ((0, jsx_runtime_1.jsx)(OptionTypeProvider_1.default, { Component: exports.RadioGroupOption, children: (0, jsx_runtime_1.jsx)(RadioGroupStatusContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, className: className, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Root, { ref: radioGroupRef, id: id, onBlur: handleOnBlur, onFocus: handleOnFocus, onValueChange: onInputChange, value: value, disabled: !enabled, required: required, "aria-readonly": readOnly, className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioGroupContainer, {
|
|
139
|
+
return ((0, jsx_runtime_1.jsx)(OptionTypeProvider_1.default, { Component: exports.RadioGroupOption, children: (0, jsx_runtime_1.jsx)(RadioGroupStatusContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, className: className, onLabelClick: focusActiveOption, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Root, { ref: radioGroupRef, id: id, onBlur: handleOnBlur, onFocus: handleOnFocus, onValueChange: onInputChange, value: value, disabled: !enabled, required: required, "aria-readonly": readOnly, className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioGroupContainer, {
|
|
124
140
|
[RadioGroup_module_scss_1.default.focused]: focused,
|
|
125
141
|
[RadioGroup_module_scss_1.default.disabled]: !enabled,
|
|
126
142
|
}), children: children }) })) }) }));
|
|
@@ -19,6 +19,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
19
19
|
const react_1 = require("react");
|
|
20
20
|
const Spinner_module_scss_1 = __importDefault(require("./Spinner.module.scss"));
|
|
21
21
|
const classnames_1 = __importDefault(require("classnames"));
|
|
22
|
+
const PART_RING = "ring";
|
|
22
23
|
exports.defaultProps = {
|
|
23
24
|
delay: 400,
|
|
24
25
|
fullScreen: false,
|
|
@@ -40,8 +41,8 @@ exports.Spinner = (0, react_1.forwardRef)(function Spinner(_a, forwardedRef) {
|
|
|
40
41
|
}
|
|
41
42
|
else {
|
|
42
43
|
if (fullScreen) {
|
|
43
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { role: "status", "aria-label": "Loading", className: Spinner_module_scss_1.default.fullScreenSpinnerWrapper, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(Spinner_module_scss_1.default["lds-ring"], className), style: style, ref: forwardedRef, children: [(0, jsx_runtime_1.jsx)("div", {}), (0, jsx_runtime_1.jsx)("div", {}), (0, jsx_runtime_1.jsx)("div", {}), (0, jsx_runtime_1.jsx)("div", {})] }) })));
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { role: "status", "aria-label": "Loading", className: Spinner_module_scss_1.default.fullScreenSpinnerWrapper, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(Spinner_module_scss_1.default["lds-ring"], className), style: style, ref: forwardedRef, children: [(0, jsx_runtime_1.jsx)("div", { "data-part-id": PART_RING }), (0, jsx_runtime_1.jsx)("div", {}), (0, jsx_runtime_1.jsx)("div", {}), (0, jsx_runtime_1.jsx)("div", {})] }) })));
|
|
44
45
|
}
|
|
45
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, rest, { className: (0, classnames_1.default)(Spinner_module_scss_1.default["lds-ring"], className), role: "status", "aria-label": "Loading", style: style, ref: forwardedRef, children: [(0, jsx_runtime_1.jsx)("div", {}), (0, jsx_runtime_1.jsx)("div", {}), (0, jsx_runtime_1.jsx)("div", {}), (0, jsx_runtime_1.jsx)("div", {})] })));
|
|
46
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, rest, { className: (0, classnames_1.default)(Spinner_module_scss_1.default["lds-ring"], className), role: "status", "aria-label": "Loading", style: style, ref: forwardedRef, children: [(0, jsx_runtime_1.jsx)("div", { "data-part-id": PART_RING }), (0, jsx_runtime_1.jsx)("div", {}), (0, jsx_runtime_1.jsx)("div", {}), (0, jsx_runtime_1.jsx)("div", {})] })));
|
|
46
47
|
}
|
|
47
48
|
});
|
|
@@ -160,10 +160,10 @@ exports.TableMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
160
160
|
},
|
|
161
161
|
themeVars: (0, themeVars_1.parseScssVar)(Table_module_scss_1.default.themeVars),
|
|
162
162
|
defaultThemeVars: {
|
|
163
|
-
[`padding-heading-${COMP}`]: `$space-2 $space-
|
|
164
|
-
[`padding-cell-${COMP}`]: "$space-2 $space-
|
|
163
|
+
[`padding-heading-${COMP}`]: `$space-2 $space-1 $space-2 $space-2`,
|
|
164
|
+
[`padding-cell-${COMP}`]: "$space-2 $space-1 $space-2 $space-2",
|
|
165
165
|
[`paddingHorizontal-cell-first-${COMP}`]: "$space-5",
|
|
166
|
-
[`paddingHorizontal-cell-last-${COMP}`]: "$space-
|
|
166
|
+
[`paddingHorizontal-cell-last-${COMP}`]: "$space-1",
|
|
167
167
|
[`border-cell-${COMP}`]: "1px solid $borderColor",
|
|
168
168
|
[`outlineWidth-heading-${COMP}--focus`]: "$outlineWidth--focus",
|
|
169
169
|
[`outlineStyle-heading-${COMP}--focus`]: "$outlineStyle--focus",
|
|
@@ -184,9 +184,12 @@ exports.TableMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
184
184
|
[`backgroundColor-heading-${COMP}--active`]: "$color-surface-300",
|
|
185
185
|
[`backgroundColor-heading-${COMP}`]: "$color-surface-100",
|
|
186
186
|
[`textColor-heading-${COMP}`]: "$color-surface-500",
|
|
187
|
+
[`border-${COMP}`]: "0px solid transparent",
|
|
188
|
+
[`borderBottom-last-row-${COMP}`]: `$borderBottom-cell-${COMP}`,
|
|
189
|
+
[`borderRadius-${COMP}`]: "$borderRadius",
|
|
187
190
|
},
|
|
188
191
|
});
|
|
189
|
-
const TableWithColumns = (0, react_1.forwardRef)(({ extractValue, node, renderChild, lookupEventHandler, lookupSyncCallback, className, registerComponentApi, }, ref) => {
|
|
192
|
+
const TableWithColumns = (0, react_1.memo)((0, react_1.forwardRef)(({ extractValue, node, renderChild, lookupEventHandler, lookupSyncCallback, className, registerComponentApi, }, ref) => {
|
|
190
193
|
var _a, _b, _c, _d, _e, _f;
|
|
191
194
|
const data = extractValue(node.props.items) || extractValue(node.props.data);
|
|
192
195
|
const [columnIds, setColumnIds] = (0, react_1.useState)(constants_1.EMPTY_ARRAY);
|
|
@@ -242,7 +245,7 @@ const TableWithColumns = (0, react_1.forwardRef)(({ extractValue, node, renderCh
|
|
|
242
245
|
return (0, jsx_runtime_1.jsx)(SelectionStoreNative_1.StandaloneSelectionStore, { children: tableContent });
|
|
243
246
|
}
|
|
244
247
|
return tableContent;
|
|
245
|
-
});
|
|
248
|
+
}));
|
|
246
249
|
TableWithColumns.displayName = "TableWithColumns";
|
|
247
250
|
exports.tableComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TableMd, ({ extractValue, node, renderChild, lookupEventHandler, lookupSyncCallback, className, registerComponentApi, }) => {
|
|
248
251
|
return ((0, jsx_runtime_1.jsx)(TableWithColumns, { node: node, extractValue: extractValue, lookupEventHandler: lookupEventHandler, lookupSyncCallback: lookupSyncCallback, className: className, renderChild: renderChild, registerComponentApi: registerComponentApi }));
|
|
@@ -392,7 +392,7 @@ exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
|
392
392
|
rows.length > 0 &&
|
|
393
393
|
pagination &&
|
|
394
394
|
(paginationControlsLocation === "top" || paginationControlsLocation === "both") &&
|
|
395
|
-
paginationControls, (0, jsx_runtime_1.jsxs)("table", { className: Table_module_scss_1.default.table, ref: tableRef,
|
|
395
|
+
paginationControls, (0, jsx_runtime_1.jsxs)("table", { className: Table_module_scss_1.default.table, ref: tableRef, children: [!hideHeader && ((0, jsx_runtime_1.jsx)("thead", { style: { height: headerHeight }, className: Table_module_scss_1.default.headerWrapper, children: table.getHeaderGroups().map((headerGroup, headerGroupIndex) => ((0, jsx_runtime_1.jsx)("tr", { className: (0, classnames_1.default)(Table_module_scss_1.default.headerRow, {
|
|
396
396
|
[Table_module_scss_1.default.allSelected]: table.getIsAllRowsSelected(),
|
|
397
397
|
}), children: headerGroup.headers.map((header, headerIndex) => {
|
|
398
398
|
var _a, _b, _c;
|
|
@@ -102,13 +102,11 @@ exports.TextMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
102
102
|
[`borderRadius-${COMP}`]: "$borderRadius",
|
|
103
103
|
[`borderStyle-${COMP}`]: "solid",
|
|
104
104
|
[`fontSize-${COMP}`]: "$fontSize-sm",
|
|
105
|
-
[`lineHeight-${COMP}`]: "$lineHeight-sm",
|
|
106
105
|
[`borderWidth-${COMP}`]: "$space-0",
|
|
107
106
|
[`lineHeight-${COMP}-codefence`]: "1.5",
|
|
108
107
|
[`fontWeight-${COMP}-abbr`]: "$fontWeight-bold",
|
|
109
108
|
[`textTransform-${COMP}-abbr`]: "uppercase",
|
|
110
109
|
[`fontSize-${COMP}-secondary`]: "$fontSize-sm",
|
|
111
|
-
[`lineHeight-${COMP}-secondary`]: "$lineHeight-sm",
|
|
112
110
|
[`fontStyle-${COMP}-cite`]: "italic",
|
|
113
111
|
[`textColor-${COMP}`]: "$textColor-primary",
|
|
114
112
|
[`fontFamily-${COMP}`]: "$fontFamily",
|
|
@@ -116,7 +114,6 @@ exports.TextMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
116
114
|
[`fontSize-${COMP}-codefence`]: "$fontSize-code",
|
|
117
115
|
[`fontFamily-${COMP}-code`]: "$fontFamily-monospace",
|
|
118
116
|
[`fontSize-${COMP}-code`]: "$fontSize-sm",
|
|
119
|
-
[`lineHeight-${COMP}-code`]: "$lineHeight-xs",
|
|
120
117
|
[`borderWidth-${COMP}-code`]: "1px",
|
|
121
118
|
[`borderStyle-${COMP}-code`]: "solid",
|
|
122
119
|
[`borderRadius-${COMP}-code`]: "4px",
|
|
@@ -126,37 +123,28 @@ exports.TextMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
126
123
|
[`textDecorationLine-${COMP}-inserted`]: "underline",
|
|
127
124
|
[`fontFamily-${COMP}-keyboard`]: "$fontFamily-monospace",
|
|
128
125
|
[`fontSize-${COMP}-keyboard`]: "$fontSize-sm",
|
|
129
|
-
[`lineHeight-${COMP}-keyboard`]: "$lineHeight-sm",
|
|
130
126
|
[`fontWeight-${COMP}-keyboard`]: "$fontWeight-bold",
|
|
131
127
|
[`borderWidth-${COMP}-keyboard`]: "1px",
|
|
132
128
|
[`paddingHorizontal-${COMP}-keyboard`]: "$space-1",
|
|
133
129
|
[`fontFamily-${COMP}-sample`]: "$fontFamily-monospace",
|
|
134
130
|
[`fontSize-${COMP}-sample`]: "$fontSize-sm",
|
|
135
|
-
[`lineHeight-${COMP}-sample`]: "$lineHeight-sm",
|
|
136
131
|
[`fontSize-${COMP}-sup`]: "$fontSize-xs",
|
|
137
|
-
[`lineHeight-${COMP}-sup`]: "$lineHeight-xs",
|
|
138
132
|
[`verticalAlignment-${COMP}-sup`]: "super",
|
|
139
133
|
[`fontSize-${COMP}-sub`]: "$fontSize-xs",
|
|
140
|
-
[`lineHeight-${COMP}-sub`]: "$lineHeight-xs",
|
|
141
134
|
[`verticalAlignment-${COMP}-sub`]: "sub",
|
|
142
135
|
[`fontStyle-${COMP}-var`]: "italic",
|
|
143
136
|
[`fontStyle-${COMP}-em`]: "italic",
|
|
144
137
|
[`fontFamily-${COMP}-mono`]: "$fontFamily-monospace",
|
|
145
138
|
[`fontSize-${COMP}-title`]: "$fontSize-2xl",
|
|
146
|
-
[`lineHeight-${COMP}-title`]: "$lineHeight-2xl",
|
|
147
139
|
[`fontSize-${COMP}-subtitle`]: "$fontSize-xl",
|
|
148
|
-
[`lineHeight-${COMP}-subtitle`]: "$lineHeight-xl",
|
|
149
140
|
[`fontSize-${COMP}-small`]: "$fontSize-sm",
|
|
150
|
-
[`lineHeight-${COMP}-small`]: "$lineHeight-sm",
|
|
151
141
|
[`letterSpacing-${COMP}-caption`]: "0.05rem",
|
|
152
142
|
[`fontSize-${COMP}-placeholder`]: "$fontSize-xs",
|
|
153
|
-
[`lineHeight-${COMP}-placeholder`]: "$lineHeight-xs",
|
|
154
143
|
[`fontFamily-${COMP}-codefence`]: "$fontFamily-monospace",
|
|
155
144
|
[`paddingHorizontal-${COMP}-codefence`]: "$space-4",
|
|
156
145
|
[`paddingVertical-${COMP}-codefence`]: "$space-3",
|
|
157
146
|
[`paddingVertical-${COMP}-paragraph`]: "$space-1",
|
|
158
147
|
[`fontSize-${COMP}-subheading`]: "$fontSize-H6",
|
|
159
|
-
[`lineHeight-${COMP}-subheading`]: "$lineHeight-sm",
|
|
160
148
|
[`fontWeight-${COMP}-subheading`]: "$fontWeight-bold",
|
|
161
149
|
[`letterSpacing-${COMP}-subheading`]: "0.04em",
|
|
162
150
|
[`textTransform-${COMP}-subheading`]: "uppercase",
|
|
@@ -164,7 +152,6 @@ exports.TextMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
164
152
|
[`marginBottom-${COMP}-tableheading`]: "$space-4",
|
|
165
153
|
[`paddingHorizontal-${COMP}-tableheading`]: "$space-1",
|
|
166
154
|
[`fontSize-${COMP}-tableheading`]: "$fontSize-H6",
|
|
167
|
-
[`lineHeight-${COMP}-tableheading`]: "$lineHeight-sm",
|
|
168
155
|
[`fontWeight-${COMP}-tableheading`]: "$fontWeight-bold",
|
|
169
156
|
[`backgroundColor-${COMP}-code`]: "rgb(from $color-surface-100 r g b / 0.4)",
|
|
170
157
|
[`borderColor-${COMP}-code`]: "$color-surface-100",
|
|
@@ -98,6 +98,14 @@ exports.TextArea = (0, react_1.forwardRef)(function TextArea(_a, forwardedRef) {
|
|
|
98
98
|
(0, react_1.useEffect)(() => {
|
|
99
99
|
updateState({ value: initialValue }, { initial: true });
|
|
100
100
|
}, [initialValue, updateState]);
|
|
101
|
+
(0, react_1.useEffect)(() => {
|
|
102
|
+
if (autoFocus) {
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
var _a;
|
|
105
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
106
|
+
}, 0);
|
|
107
|
+
}
|
|
108
|
+
}, [autoFocus, inputRef.current]);
|
|
101
109
|
// --- Execute this function when the user copies the value
|
|
102
110
|
const handleCopy = (event) => {
|
|
103
111
|
if (allowCopy) {
|
|
@@ -185,7 +193,6 @@ exports.TextArea = (0, react_1.forwardRef)(function TextArea(_a, forwardedRef) {
|
|
|
185
193
|
style: style,
|
|
186
194
|
value: controlled ? value || "" : undefined,
|
|
187
195
|
disabled: !enabled,
|
|
188
|
-
autoFocus,
|
|
189
196
|
name: id,
|
|
190
197
|
placeholder,
|
|
191
198
|
required,
|
|
@@ -36,7 +36,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.NotificationToast = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const react_1 = require("react");
|
|
39
|
+
const react_dom_1 = require("react-dom");
|
|
39
40
|
const react_hot_toast_1 = __importStar(require("react-hot-toast"));
|
|
41
|
+
const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
|
|
40
42
|
const TOASTER_CONTAINER_STYLE = {
|
|
41
43
|
top: 40,
|
|
42
44
|
right: 40,
|
|
@@ -48,6 +50,7 @@ const TOASTER_CONTAINER_STYLE = {
|
|
|
48
50
|
let toasterMounted = false;
|
|
49
51
|
const NotificationToast = ({ toastDuration }) => {
|
|
50
52
|
const [shouldRender, setShouldRender] = (0, react_1.useState)(false);
|
|
53
|
+
const { root } = (0, ThemeContext_1.useTheme)();
|
|
51
54
|
(0, react_1.useEffect)(() => {
|
|
52
55
|
if (!toasterMounted) {
|
|
53
56
|
toasterMounted = true;
|
|
@@ -56,6 +59,6 @@ const NotificationToast = ({ toastDuration }) => {
|
|
|
56
59
|
}, []);
|
|
57
60
|
if (!shouldRender)
|
|
58
61
|
return null;
|
|
59
|
-
return ((0, jsx_runtime_1.jsx)(react_hot_toast_1.Toaster, { position: "top-right", containerStyle: TOASTER_CONTAINER_STYLE, toastOptions: { style: { padding: "12px 16px" }, duration: toastDuration }, children: (t) => ((0, jsx_runtime_1.jsx)("div", { onClick: () => react_hot_toast_1.default.dismiss(t.id), children: (0, jsx_runtime_1.jsx)(react_hot_toast_1.ToastBar, { position: t.position, toast: t, style: { wordBreak: "break-word" }, children: ({ icon, message }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [icon, message] })) }) })) }));
|
|
62
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(react_hot_toast_1.Toaster, { position: "top-right", containerStyle: TOASTER_CONTAINER_STYLE, toastOptions: { style: { padding: "12px 16px" }, duration: toastDuration }, children: (t) => ((0, jsx_runtime_1.jsx)("div", { onClick: () => react_hot_toast_1.default.dismiss(t.id), children: (0, jsx_runtime_1.jsx)(react_hot_toast_1.ToastBar, { position: t.position, toast: t, style: { wordBreak: "break-word" }, children: ({ icon, message }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [icon, message] })) }) })) }), root);
|
|
60
63
|
};
|
|
61
64
|
exports.NotificationToast = NotificationToast;
|
|
@@ -52,8 +52,10 @@ const misc_1 = require("./utils/misc");
|
|
|
52
52
|
const hooks_1 = require("./utils/hooks");
|
|
53
53
|
const lodash_es_1 = require("lodash-es");
|
|
54
54
|
const constants_1 = require("./constants");
|
|
55
|
+
const mergeProps_1 = require("./utils/mergeProps");
|
|
55
56
|
// Acts as a bridge between a compound component definition and its renderer.
|
|
56
|
-
exports.CompoundComponent = (0, react_1.forwardRef)((
|
|
57
|
+
exports.CompoundComponent = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
58
|
+
var { node, lookupSyncCallback, lookupEventHandler, compound, api, scriptCollected, renderChild, extractValue, layoutContext, uid, updateState, registerComponentApi, extractResourceUrl, appContext, state, lookupAction } = _a, restProps = __rest(_a, ["node", "lookupSyncCallback", "lookupEventHandler", "compound", "api", "scriptCollected", "renderChild", "extractValue", "layoutContext", "uid", "updateState", "registerComponentApi", "extractResourceUrl", "appContext", "state", "lookupAction"]);
|
|
57
59
|
// --- Extract property values (resolve binding expressions)
|
|
58
60
|
const resolvedPropsInner = (0, react_1.useMemo)(() => {
|
|
59
61
|
const resolvedProps = {};
|
|
@@ -135,9 +137,7 @@ exports.CompoundComponent = (0, react_1.forwardRef)(({ node, lookupSyncCallback,
|
|
|
135
137
|
? Object.assign(Object.assign({}, layoutContext), { wrapChild: undefined }) : layoutContext;
|
|
136
138
|
const ret = renderChild(nodeWithPropsAndEvents, safeLayoutContext, memoedParentRenderContext);
|
|
137
139
|
if (forwardedRef && ret && (0, react_1.isValidElement)(ret)) {
|
|
138
|
-
return react_1.default.cloneElement(ret, {
|
|
139
|
-
ref: (0, react_compose_refs_1.composeRefs)(forwardedRef, ret.ref),
|
|
140
|
-
});
|
|
140
|
+
return react_1.default.cloneElement(ret, Object.assign({ ref: (0, react_compose_refs_1.composeRefs)(forwardedRef, ret.ref) }, (0, mergeProps_1.mergeProps)(ret.props, restProps)));
|
|
141
141
|
}
|
|
142
142
|
return react_1.default.isValidElement(ret) ? ret : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: ret });
|
|
143
143
|
});
|