xmlui 0.10.10 → 0.10.12
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/{metadata/apiInterceptorWorker-Bb5-fQup.mjs → lib/apiInterceptorWorker-DPgtUtdA.mjs} +5870 -3195
- package/dist/lib/index-CDOoBf2R.mjs +49626 -0
- package/dist/lib/index.css +1 -1
- package/dist/lib/initMock-BAV9RKui.mjs +843 -0
- package/dist/lib/language-server-web-worker.mjs +8 -7
- package/dist/lib/language-server.mjs +6 -6
- package/dist/lib/{metadata-utils-gIOZMGG7.mjs → metadata-utils-D90qqMGc.mjs} +159 -114
- package/dist/lib/scss/components-core/theming/_themes.scss +6 -7
- package/dist/lib/{server-common-BfCSNpXG.mjs → server-common-lmBDLpUh.mjs} +14848 -10785
- package/dist/lib/syntax-monaco.mjs +14 -11
- package/dist/lib/syntax-textmate.d.ts +2 -2
- package/dist/lib/syntax-textmate.mjs +128 -109
- package/dist/lib/transform-bHBjkKSL.mjs +7376 -0
- package/dist/lib/xmlui-parser.d.ts +17 -8
- package/dist/lib/xmlui-parser.mjs +49 -49
- package/dist/lib/xmlui-serializer-DB6BLiXK.mjs +667 -0
- package/dist/lib/xmlui.d.ts +5 -2
- package/dist/lib/xmlui.mjs +43 -43
- package/dist/{lib/apiInterceptorWorker-DH8wqOVq.mjs → metadata/apiInterceptorWorker-BmKP8bnq.mjs} +5432 -3502
- package/dist/metadata/collectedComponentMetadata-Dp8BqWQO.mjs +55444 -0
- package/dist/metadata/initMock-BvEO8W8r.mjs +843 -0
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +3 -3
- package/dist/metadata/xmlui-metadata.umd.js +207 -419
- package/dist/scripts/package.json +3 -1
- package/dist/scripts/src/components/APICall/APICall.js +4 -4
- package/dist/scripts/src/components/Accordion/Accordion.js +1 -1
- package/dist/scripts/src/components/Animation/AnimationNative.js +259 -0
- package/dist/scripts/src/components/App/App.js +10 -0
- package/dist/scripts/src/components/App/AppNative.js +23 -2
- package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +1 -1
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +6 -2
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +11 -7
- package/dist/scripts/src/components/Avatar/Avatar.js +1 -1
- package/dist/scripts/src/components/Button/Button.js +1 -1
- package/dist/scripts/src/components/Charts/AreaChart/AreaChart.js +92 -0
- package/dist/scripts/src/components/Charts/AreaChart/AreaChartNative.js +127 -0
- package/dist/scripts/src/components/Charts/BarChart/BarChart.js +6 -6
- package/dist/scripts/src/components/Charts/BarChart/BarChartNative.js +110 -96
- 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/Charts/RadarChart/RadarChart.js +92 -0
- package/dist/scripts/src/components/Charts/RadarChart/RadarChartNative.js +125 -0
- package/dist/scripts/src/components/Checkbox/Checkbox.js +2 -1
- package/dist/scripts/src/components/ComponentProvider.js +4 -2
- package/dist/scripts/src/components/DataSource/DataSource.js +124 -0
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/scripts/src/components/Footer/Footer.js +1 -1
- package/dist/scripts/src/components/Footer/FooterNative.js +1 -1
- package/dist/scripts/src/components/Form/FormNative.js +5 -3
- package/dist/scripts/src/components/FormItem/FormItem.js +1 -1
- package/dist/scripts/src/components/FormItem/FormItemNative.js +0 -9
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +3 -3
- package/dist/scripts/src/components/Heading/Heading.js +83 -28
- package/dist/scripts/src/components/Heading/HeadingNative.js +10 -1
- package/dist/scripts/src/components/HtmlTags/HtmlTags.js +1 -1
- package/dist/scripts/src/components/Icon/IconNative.js +24 -6
- package/dist/scripts/src/components/Image/ImageNative.js +13 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +8 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +5 -3
- package/dist/scripts/src/components/NavLink/NavLink.js +1 -1
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +208 -78
- package/dist/scripts/src/components/Option/Option.js +2 -2
- package/dist/scripts/src/components/Option/OptionNative.js +12 -1
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +7 -3
- package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +20 -5
- package/dist/scripts/src/components/RadioGroup/RadioItemNative.js +2 -1
- package/dist/scripts/src/components/Select/Select.js +1 -1
- package/dist/scripts/src/components/Select/SelectNative.js +1 -1
- package/dist/scripts/src/components/Spinner/SpinnerNative.js +3 -2
- package/dist/scripts/src/components/Switch/Switch.js +2 -1
- package/dist/scripts/src/components/Table/Table.js +1 -1
- package/dist/scripts/src/components/TableOfContents/TableOfContents.js +1 -1
- package/dist/scripts/src/components/Text/Text.js +32 -14
- package/dist/scripts/src/components/Text/TextNative.js +17 -5
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +1 -1
- package/dist/scripts/src/components/Toggle/Toggle.js +2 -2
- package/dist/scripts/src/components/abstractions.js +2 -1
- package/dist/scripts/src/components/collectedComponentMetadata.js +316 -0
- package/dist/scripts/src/components-core/RestApiProxy.js +3 -1
- package/dist/scripts/src/components-core/StandaloneApp.js +823 -0
- package/dist/scripts/src/components-core/markup-check.js +279 -0
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +36 -16
- package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +4 -1
- package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +4 -1
- package/dist/scripts/src/components-core/theming/themes/root.js +30 -17
- package/dist/scripts/src/components-core/theming/transformThemeVars.js +14 -7
- package/dist/scripts/src/components-core/xmlui-parser.js +60 -43
- package/dist/scripts/src/index.js +120 -0
- package/dist/scripts/src/parsers/xmlui-parser/syntax-kind.js +9 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +17 -5
- package/dist/standalone/xmlui-standalone.es.d.ts +6 -2
- package/dist/standalone/xmlui-standalone.umd.js +319 -823
- package/package.json +3 -1
- package/src/syntax/textMate/xmlui.tmLanguage.json +2 -2
- package/dist/lib/index-C71PAj7E.mjs +0 -38677
- package/dist/lib/initMock-Bvbl2Pa3.mjs +0 -571
- package/dist/lib/transform-SMWeyMoq.mjs +0 -5391
- package/dist/lib/xmlui-serializer-a0O0jFY-.mjs +0 -497
- package/dist/metadata/collectedComponentMetadata-Dn91__HO.mjs +0 -43087
- package/dist/metadata/initMock-ghNfStAu.mjs +0 -571
- package/dist/scripts/src/components/NumberBox/NumberBox2.js +0 -99
- package/dist/scripts/src/components/NumberBox/NumberBox2Native.js +0 -420
|
@@ -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);
|
|
@@ -30,13 +30,13 @@ exports.OptionMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
30
30
|
exports.optionComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.OptionMd, ({ node, extractValue, className, renderChild, layoutContext }) => {
|
|
31
31
|
var _a, _b;
|
|
32
32
|
const label = extractValue.asOptionalString(node.props.label);
|
|
33
|
-
|
|
33
|
+
let value = extractValue(node.props.value);
|
|
34
34
|
if (label === undefined && value === undefined) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
37
|
const hasTextNodeChild = ((_a = node.children) === null || _a === void 0 ? void 0 : _a.length) === 1 && (node.children[0].type === "TextNode" || node.children[0].type === "TextNodeCData");
|
|
38
38
|
const textNodeChild = hasTextNodeChild ? renderChild(node.children) : undefined;
|
|
39
|
-
return ((0, jsx_runtime_1.jsx)(OptionNative_1.OptionNative, { label: label || textNodeChild, value: value
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(OptionNative_1.OptionNative, { label: label || textNodeChild, value: value !== undefined && value !== "" ? value : label, enabled: extractValue.asOptionalBoolean(node.props.enabled), className: className, optionRenderer: ((_b = node.children) === null || _b === void 0 ? void 0 : _b.length) > 0
|
|
40
40
|
? !hasTextNodeChild ? (contextVars) => ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.children, renderChild: renderChild, contextVars: contextVars, layoutContext: layoutContext })) : undefined
|
|
41
41
|
: undefined, children: !hasTextNodeChild && renderChild(node.children) }));
|
|
42
42
|
});
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OptionNative = exports.defaultProps = void 0;
|
|
4
|
+
exports.convertOptionValue = convertOptionValue;
|
|
4
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const OptionTypeProvider_1 = require("./OptionTypeProvider");
|
|
7
8
|
// Default props for Option component
|
|
8
9
|
exports.defaultProps = {
|
|
9
|
-
enabled: true
|
|
10
|
+
enabled: true,
|
|
10
11
|
};
|
|
12
|
+
function convertOptionValue(value) {
|
|
13
|
+
if (typeof value !== "string" &&
|
|
14
|
+
(typeof value !== "number" ||
|
|
15
|
+
(typeof value === "number" && isNaN(value))) &&
|
|
16
|
+
typeof value !== "boolean" &&
|
|
17
|
+
value !== null) {
|
|
18
|
+
return "";
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
11
22
|
exports.OptionNative = (0, react_1.memo)((props) => {
|
|
12
23
|
const OptionType = (0, OptionTypeProvider_1.useOptionType)();
|
|
13
24
|
if (!OptionType) {
|
|
@@ -17,7 +17,11 @@ exports.RadioGroupMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
17
17
|
description: "`RadioGroup` creates a mutually exclusive selection interface where users can " +
|
|
18
18
|
"choose only one option from a group of radio buttons. It manages the selection " +
|
|
19
19
|
"state and ensures that selecting one option automatically deselects all others in " +
|
|
20
|
-
"the group."
|
|
20
|
+
"the group." +
|
|
21
|
+
"\n\n" +
|
|
22
|
+
"Radio options store their values as strings. Numbers and booleans are converted to strings " +
|
|
23
|
+
"when assigned, while objects, functions and arrays default to an empty string unless resolved " +
|
|
24
|
+
"via binding expressions.",
|
|
21
25
|
props: {
|
|
22
26
|
initialValue: Object.assign(Object.assign({}, (0, metadata_helpers_1.dInitialValue)()), { defaultValue: RadioGroupNative_1.defaultProps.initialValue }),
|
|
23
27
|
autoFocus: (0, metadata_helpers_1.dAutoFocus)(),
|
|
@@ -52,10 +56,10 @@ exports.RadioGroupMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
52
56
|
[`backgroundColor-${RGOption}--disabled`]: "$backgroundColor--disabled",
|
|
53
57
|
[`backgroundColor-checked-${RGOption}`]: "$color-primary-500",
|
|
54
58
|
[`backgroundColor-checked-${RGOption}--disabled`]: `$textColor--disabled`,
|
|
55
|
-
[`fontSize-${RGOption}`]: "$fontSize-
|
|
59
|
+
[`fontSize-${RGOption}`]: "$fontSize-sm",
|
|
56
60
|
[`fontWeight-${RGOption}`]: "$fontWeight-bold",
|
|
57
61
|
},
|
|
58
62
|
});
|
|
59
63
|
exports.radioGroupRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.RadioGroupMd, ({ node, extractValue, className, state, updateState, lookupEventHandler, renderChild, registerComponentApi, }) => {
|
|
60
|
-
return ((0, jsx_runtime_1.jsx)(RadioGroupNative_1.RadioGroup, { enabled: extractValue.asOptionalBoolean(node.props.enabled), className: className, initialValue: extractValue(node.props.initialValue), value: state === null || state === void 0 ? void 0 : state.value, updateState: updateState, validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, label: extractValue.asOptionalString(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), children: renderChild(node.children) }));
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)(RadioGroupNative_1.RadioGroup, { autofocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), className: className, initialValue: extractValue(node.props.initialValue), value: state === null || state === void 0 ? void 0 : state.value, updateState: updateState, validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, label: extractValue.asOptionalString(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), children: renderChild(node.children) }));
|
|
61
65
|
});
|
|
@@ -58,32 +58,47 @@ const misc_1 = require("../../components-core/utils/misc");
|
|
|
58
58
|
const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
|
|
59
59
|
const OptionTypeProvider_1 = __importDefault(require("../Option/OptionTypeProvider"));
|
|
60
60
|
const RadioItemNative_1 = require("./RadioItemNative");
|
|
61
|
+
const OptionNative_1 = require("../Option/OptionNative");
|
|
61
62
|
exports.defaultProps = {
|
|
62
63
|
value: "",
|
|
63
64
|
initialValue: "",
|
|
64
65
|
enabled: true,
|
|
65
66
|
validationStatus: "none",
|
|
66
67
|
required: false,
|
|
68
|
+
readOnly: false,
|
|
67
69
|
};
|
|
68
70
|
const RadioGroupStatusContext = (0, react_1.createContext)({
|
|
69
71
|
status: "none",
|
|
70
72
|
enabled: exports.defaultProps.enabled,
|
|
71
73
|
});
|
|
72
74
|
exports.RadioGroup = (0, react_1.forwardRef)(function RadioGroup(_a, forwardedRef) {
|
|
73
|
-
var { id, value = exports.defaultProps.value, initialValue = exports.defaultProps.initialValue, enabled = exports.defaultProps.enabled, validationStatus = exports.defaultProps.validationStatus, label, labelPosition, labelWidth, labelBreak, required = exports.defaultProps.required, updateState = constants_1.noop, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, children, registerComponentApi, style, className } = _a, rest = __rest(_a, ["id", "value", "initialValue", "enabled", "validationStatus", "label", "labelPosition", "labelWidth", "labelBreak", "required", "updateState", "onDidChange", "onFocus", "onBlur", "children", "registerComponentApi", "style", "className"]);
|
|
75
|
+
var { id, value = exports.defaultProps.value, initialValue = exports.defaultProps.initialValue, autofocus, enabled = exports.defaultProps.enabled, validationStatus = exports.defaultProps.validationStatus, label, labelPosition, labelWidth, labelBreak, required = exports.defaultProps.required, readOnly = exports.defaultProps.readOnly, updateState = constants_1.noop, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, children, registerComponentApi, style, className } = _a, rest = __rest(_a, ["id", "value", "initialValue", "autofocus", "enabled", "validationStatus", "label", "labelPosition", "labelWidth", "labelBreak", "required", "readOnly", "updateState", "onDidChange", "onFocus", "onBlur", "children", "registerComponentApi", "style", "className"]);
|
|
74
76
|
const [focused, setFocused] = react_1.default.useState(false);
|
|
77
|
+
const radioGroupRef = (0, react_1.useRef)(null);
|
|
75
78
|
// --- Initialize the related field with the input's initial value
|
|
76
79
|
(0, react_1.useEffect)(() => {
|
|
77
|
-
updateState({ value: initialValue }, { initial: true });
|
|
80
|
+
updateState({ value: (0, OptionNative_1.convertOptionValue)(initialValue) }, { initial: true });
|
|
78
81
|
}, [initialValue, updateState]);
|
|
82
|
+
// --- Handle autofocus by focusing the first radio option
|
|
83
|
+
(0, react_1.useEffect)(() => {
|
|
84
|
+
if (autofocus && radioGroupRef.current) {
|
|
85
|
+
// Find the first radio item element
|
|
86
|
+
const firstRadioItem = radioGroupRef.current.querySelector('[role="radio"]');
|
|
87
|
+
if (firstRadioItem) {
|
|
88
|
+
firstRadioItem.focus();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, [autofocus]);
|
|
79
92
|
// --- Handle the value change events for this input
|
|
80
93
|
const updateValue = (0, react_1.useCallback)((value) => {
|
|
81
94
|
updateState({ value });
|
|
82
95
|
onDidChange(value);
|
|
83
96
|
}, [onDidChange, updateState]);
|
|
84
97
|
const onInputChange = (0, react_1.useCallback)((value) => {
|
|
98
|
+
if (readOnly)
|
|
99
|
+
return;
|
|
85
100
|
updateValue(value);
|
|
86
|
-
}, [updateValue]);
|
|
101
|
+
}, [updateValue, readOnly]);
|
|
87
102
|
// --- Manage obtaining and losing the focus
|
|
88
103
|
const handleOnFocus = (0, react_1.useCallback)((ev) => {
|
|
89
104
|
setFocused(true);
|
|
@@ -105,7 +120,7 @@ exports.RadioGroup = (0, react_1.forwardRef)(function RadioGroup(_a, forwardedRe
|
|
|
105
120
|
const contextValue = (0, react_1.useMemo)(() => {
|
|
106
121
|
return { value, setValue: updateValue, status: validationStatus, enabled };
|
|
107
122
|
}, [value, updateValue, validationStatus, enabled]);
|
|
108
|
-
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, { id: id, onBlur: handleOnBlur, onFocus: handleOnFocus, onValueChange: onInputChange, value: value, disabled: !enabled, className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioGroupContainer, {
|
|
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, {
|
|
109
124
|
[RadioGroup_module_scss_1.default.focused]: focused,
|
|
110
125
|
[RadioGroup_module_scss_1.default.disabled]: !enabled,
|
|
111
126
|
}), children: children }) })) }) }));
|
|
@@ -120,7 +135,7 @@ const RadioGroupOption = ({ value, label, enabled = true, optionRenderer, style,
|
|
|
120
135
|
[RadioGroup_module_scss_1.default.valid]: value === radioGroupContext.value && radioGroupContext.status === "valid",
|
|
121
136
|
}), [enabled, radioGroupContext, value]);
|
|
122
137
|
const item = (0, react_1.useMemo)(() => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(RadioItemNative_1.UnwrappedRadioItem, { id: id, value: value, checked: value === radioGroupContext.value, disabled: !enabled, statusStyles: statusStyles }), (0, jsx_runtime_1.jsx)("label", { htmlFor: id, className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.label, statusStyles), children: label !== null && label !== void 0 ? label : value })] })), [enabled, id, label, statusStyles, value, radioGroupContext]);
|
|
123
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioOptionContainer, className), style: style, children: !!optionRenderer ? ((0, jsx_runtime_1.jsxs)("label", { className: RadioGroup_module_scss_1.default.optionLabel, children: [(0, jsx_runtime_1.jsx)("div", { className: RadioGroup_module_scss_1.default.itemContainer, children: item }), optionRenderer({
|
|
138
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioOptionContainer, className), style: style, "data-radio-item": true, children: !!optionRenderer ? ((0, jsx_runtime_1.jsxs)("label", { className: RadioGroup_module_scss_1.default.optionLabel, children: [(0, jsx_runtime_1.jsx)("div", { className: RadioGroup_module_scss_1.default.itemContainer, children: item }), optionRenderer({
|
|
124
139
|
$checked: value === radioGroupContext.value,
|
|
125
140
|
$setChecked: radioGroupContext.setValue,
|
|
126
141
|
})] })) : (item) }, id));
|
|
@@ -43,6 +43,7 @@ const RadioGroup_module_scss_1 = __importDefault(require("./RadioGroup.module.sc
|
|
|
43
43
|
const InnerRadioGroup = __importStar(require("@radix-ui/react-radio-group"));
|
|
44
44
|
const constants_1 = require("../../components-core/constants");
|
|
45
45
|
const classnames_1 = __importDefault(require("classnames"));
|
|
46
|
+
const OptionNative_1 = require("../Option/OptionNative");
|
|
46
47
|
exports.defaultProps = {
|
|
47
48
|
checked: false,
|
|
48
49
|
value: "",
|
|
@@ -56,6 +57,6 @@ const UnwrappedRadioItem = ({ id, checked = exports.defaultProps.checked, value
|
|
|
56
57
|
const onInputChange = (0, react_1.useCallback)((_) => {
|
|
57
58
|
onDidChange(value);
|
|
58
59
|
}, [onDidChange, value]);
|
|
59
|
-
return ((0, jsx_runtime_1.jsx)(InnerRadioGroup.Item, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioOption, statusStyles), id: id, value: value, checked: checked, disabled: disabled, onClick: onInputChange, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Indicator, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.indicator, statusStyles) }) }));
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)(InnerRadioGroup.Item, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioOption, statusStyles), id: id, value: (0, OptionNative_1.convertOptionValue)(value), checked: checked, disabled: disabled, onClick: onInputChange, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Indicator, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.indicator, statusStyles) }) }));
|
|
60
61
|
};
|
|
61
62
|
exports.UnwrappedRadioItem = UnwrappedRadioItem;
|
|
@@ -94,7 +94,7 @@ exports.SelectMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
94
94
|
[`borderWidth-menu-${COMP}`]: "1px",
|
|
95
95
|
[`borderColor-menu-${COMP}`]: "$borderColor",
|
|
96
96
|
[`backgroundColor-${COMP}-badge`]: "$color-primary-500",
|
|
97
|
-
[`fontSize-${COMP}-badge`]: "$fontSize-
|
|
97
|
+
[`fontSize-${COMP}-badge`]: "$fontSize-sm",
|
|
98
98
|
[`paddingHorizontal-${COMP}-badge`]: "$space-2_5",
|
|
99
99
|
[`paddingVertical-${COMP}-badge`]: "$space-0_5",
|
|
100
100
|
[`borderRadius-${COMP}-badge`]: "$borderRadius",
|
|
@@ -295,7 +295,7 @@ const SelectOption = react_2.default.forwardRef((option, ref) => {
|
|
|
295
295
|
onOptionAdd(opt);
|
|
296
296
|
return () => onOptionRemove(opt);
|
|
297
297
|
}, [opt, onOptionAdd, onOptionRemove]);
|
|
298
|
-
return ((0, jsx_runtime_1.jsxs)(react_select_1.Item, { ref: ref, className: (0, classnames_1.default)(Select_module_scss_1.default.selectItem, className), value: value
|
|
298
|
+
return ((0, jsx_runtime_1.jsxs)(react_select_1.Item, { ref: ref, className: (0, classnames_1.default)(Select_module_scss_1.default.selectItem, className), value: value, textValue: label || ((_a = visibleContentRef.current) === null || _a === void 0 ? void 0 : _a.textContent), disabled: !enabled, onClick: (event) => {
|
|
299
299
|
event.stopPropagation();
|
|
300
300
|
}, onMouseEnter: (event) => {
|
|
301
301
|
// Ensure hover state is applied even in DropdownMenu context
|
|
@@ -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
|
});
|
|
@@ -37,6 +37,7 @@ exports.SwitchMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
37
37
|
`of the ${COMP} besides its label.`),
|
|
38
38
|
},
|
|
39
39
|
events: {
|
|
40
|
+
click: (0, metadata_helpers_1.dClick)(COMP),
|
|
40
41
|
gotFocus: (0, metadata_helpers_1.dGotFocus)(COMP),
|
|
41
42
|
lostFocus: (0, metadata_helpers_1.dLostFocus)(COMP),
|
|
42
43
|
didChange: (0, metadata_helpers_1.dDidChange)(COMP),
|
|
@@ -79,5 +80,5 @@ exports.SwitchMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
79
80
|
},
|
|
80
81
|
});
|
|
81
82
|
exports.switchComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.SwitchMd, ({ node, extractValue, className, updateState, state, lookupEventHandler, registerComponentApi, }) => {
|
|
82
|
-
return ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { enabled: extractValue.asOptionalBoolean(node.props.enabled), className: className, initialValue: extractValue.asOptionalBoolean(node.props.initialValue, Toggle_1.defaultProps.initialValue), value: state === null || state === void 0 ? void 0 : state.value, readOnly: extractValue.asOptionalBoolean(node.props.readOnly), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), variant: "switch", registerComponentApi: registerComponentApi }));
|
|
83
|
+
return ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { enabled: extractValue.asOptionalBoolean(node.props.enabled), className: className, initialValue: extractValue.asOptionalBoolean(node.props.initialValue, Toggle_1.defaultProps.initialValue), value: state === null || state === void 0 ? void 0 : state.value, readOnly: extractValue.asOptionalBoolean(node.props.readOnly), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), onClick: lookupEventHandler("click"), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), variant: "switch", registerComponentApi: registerComponentApi }));
|
|
83
84
|
});
|
|
@@ -171,7 +171,7 @@ exports.TableMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
171
171
|
[`fontSize-heading-${COMP}`]: "$fontSize-tiny",
|
|
172
172
|
[`fontWeight-heading-${COMP}`]: "$fontWeight-bold",
|
|
173
173
|
[`textTransform-heading-${COMP}`]: "uppercase",
|
|
174
|
-
[`fontSize-row-${COMP}`]: "$fontSize-
|
|
174
|
+
[`fontSize-row-${COMP}`]: "$fontSize-sm",
|
|
175
175
|
// [`backgroundColor-${COMP}`]: "transparent",
|
|
176
176
|
// [`backgroundColor-row-${COMP}`]: "inherit",
|
|
177
177
|
[`backgroundColor-selected-${COMP}--hover`]: `$backgroundColor-row-${COMP}--hover`,
|