xmlui 0.10.7 → 0.10.10
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-CTri_fRG.mjs → index-C71PAj7E.mjs} +16456 -16219
- package/dist/lib/index.css +1 -1
- package/dist/{metadata/initMock-DzaOI8sC.mjs → lib/initMock-Bvbl2Pa3.mjs} +119 -113
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-DrEexTX9.mjs → metadata-utils-gIOZMGG7.mjs} +51 -46
- package/dist/lib/{server-common-ddmPKhK6.mjs → server-common-BfCSNpXG.mjs} +4467 -4437
- package/dist/lib/xmlui-parser.d.ts +3 -3
- package/dist/lib/xmlui.d.ts +14 -10
- package/dist/lib/xmlui.mjs +26 -26
- package/dist/metadata/{collectedComponentMetadata-Oj8WR8B1.mjs → collectedComponentMetadata-Dn91__HO.mjs} +18722 -18481
- package/dist/{lib/initMock-abcNyaP8.mjs → metadata/initMock-ghNfStAu.mjs} +119 -113
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +99 -99
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/Accordion/AccordionItemNative.js +2 -2
- package/dist/scripts/src/components/App/AppNative.js +6 -7
- package/dist/scripts/src/components/Breakout/BreakoutNative.js +2 -2
- package/dist/scripts/src/components/Button/ButtonNative.js +4 -0
- package/dist/scripts/src/components/Carousel/Carousel.js +13 -20
- package/dist/scripts/src/components/Carousel/CarouselContext.js +11 -2
- package/dist/scripts/src/components/Carousel/CarouselItemNative.js +2 -2
- package/dist/scripts/src/components/Carousel/CarouselNative.js +2 -2
- package/dist/scripts/src/components/Charts/BarChart/BarChart.js +4 -4
- package/dist/scripts/src/components/Charts/BarChart/BarChartNative.js +5 -1
- package/dist/scripts/src/components/Charts/LineChart/LineChart.js +3 -3
- package/dist/scripts/src/components/Charts/LineChart/LineChartNative.js +5 -1
- package/dist/scripts/src/components/ComponentProvider.js +2 -0
- package/dist/scripts/src/components/DateInput/DateInput.js +7 -9
- package/dist/scripts/src/components/DateInput/DateInputNative.js +101 -38
- package/dist/scripts/src/components/ExpandableItem/ExpandableItemNative.js +18 -12
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +3 -3
- package/dist/scripts/src/components/Input/PartialInput.js +28 -3
- package/dist/scripts/src/components/List/ListNative.js +6 -5
- package/dist/scripts/src/components/NavPanel/NavPanelNative.js +3 -8
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +2 -2
- package/dist/scripts/src/components/Pagination/Pagination.js +2 -1
- package/dist/scripts/src/components/Slider/Slider.js +10 -8
- package/dist/scripts/src/components/Slider/SliderNative.js +24 -21
- package/dist/scripts/src/components/Table/Table.js +9 -6
- package/dist/scripts/src/components/Table/TableNative.js +18 -13
- package/dist/scripts/src/components/TextArea/TextAreaNative.js +3 -3
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
- package/dist/scripts/src/components/TimeInput/TimeInput.js +10 -10
- package/dist/scripts/src/components/TimeInput/TimeInputNative.js +87 -38
- package/dist/scripts/src/components/Timer/Timer.js +62 -0
- package/dist/scripts/src/components/Timer/TimerNative.js +179 -0
- package/dist/scripts/src/components/Toggle/Toggle.js +1 -1
- package/dist/scripts/src/components/Tooltip/Tooltip.js +9 -9
- package/dist/scripts/src/components/Tooltip/TooltipNative.js +4 -4
- package/dist/scripts/src/components/abstractions.js +6 -3
- package/dist/scripts/src/components-core/ComponentDecorator.js +3 -2
- package/dist/scripts/src/components-core/interception/ApiInterceptor.js +4 -1
- package/dist/scripts/src/components-core/interception/Backend.js +14 -1
- package/dist/scripts/src/components-core/parts.js +0 -4
- package/dist/standalone/xmlui-standalone.es.d.ts +20 -14
- package/dist/standalone/xmlui-standalone.umd.js +265 -265
- package/package.json +1 -1
- package/dist/scripts/src/components-core/ScrollContext.js +0 -11
- package/dist/scripts/src/components-core/utils/audio-utils.js +0 -83
|
@@ -24,11 +24,9 @@ const date_fns_1 = require("date-fns");
|
|
|
24
24
|
const PartialInput_1 = require("../Input/PartialInput");
|
|
25
25
|
const InputDivider_1 = require("../Input/InputDivider");
|
|
26
26
|
const misc_1 = require("../../components-core/utils/misc");
|
|
27
|
-
const audio_utils_1 = require("../../components-core/utils/audio-utils");
|
|
28
27
|
const InputAdornment_1 = require("../Input/InputAdornment");
|
|
29
28
|
const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
|
|
30
29
|
const IconNative_1 = __importDefault(require("../Icon/IconNative"));
|
|
31
|
-
const parts_1 = require("../../components-core/parts");
|
|
32
30
|
// Component part names
|
|
33
31
|
const PART_DAY = "day";
|
|
34
32
|
const PART_MONTH = "month";
|
|
@@ -76,11 +74,10 @@ exports.defaultProps = {
|
|
|
76
74
|
readOnly: false,
|
|
77
75
|
autoFocus: false,
|
|
78
76
|
labelBreak: false,
|
|
79
|
-
mute: false,
|
|
80
77
|
emptyCharacter: "-",
|
|
81
78
|
};
|
|
82
79
|
exports.DateInput = (0, react_2.forwardRef)(function DateInputNative(_a, ref) {
|
|
83
|
-
var { id, initialValue, value: controlledValue, enabled = exports.defaultProps.enabled, updateState, style, className, onDidChange, onFocus, onBlur, onInvalidChange,
|
|
80
|
+
var { id, initialValue, value: controlledValue, enabled = exports.defaultProps.enabled, updateState, style, className, onDidChange, onFocus, onBlur, onInvalidChange, validationStatus = exports.defaultProps.validationStatus, registerComponentApi, mode = exports.defaultProps.mode, dateFormat = exports.defaultProps.dateFormat, showWeekNumber = exports.defaultProps.showWeekNumber, weekStartsOn = exports.defaultProps.weekStartsOn, minValue, maxValue, disabledDates, inline = exports.defaultProps.inline, clearable = exports.defaultProps.clearable, clearIcon, clearToInitialValue = exports.defaultProps.clearToInitialValue, required = exports.defaultProps.required, startText, startIcon, endText, endIcon, gap, label, labelPosition = exports.defaultProps.labelPosition, labelWidth, labelBreak = exports.defaultProps.labelBreak, readOnly = exports.defaultProps.readOnly, autoFocus = exports.defaultProps.autoFocus, emptyCharacter = exports.defaultProps.emptyCharacter } = _a, rest = __rest(_a, ["id", "initialValue", "value", "enabled", "updateState", "style", "className", "onDidChange", "onFocus", "onBlur", "onInvalidChange", "validationStatus", "registerComponentApi", "mode", "dateFormat", "showWeekNumber", "weekStartsOn", "minValue", "maxValue", "disabledDates", "inline", "clearable", "clearIcon", "clearToInitialValue", "required", "startText", "startIcon", "endText", "endIcon", "gap", "label", "labelPosition", "labelWidth", "labelBreak", "readOnly", "autoFocus", "emptyCharacter"]);
|
|
84
81
|
const dateInputRef = (0, react_2.useRef)(null);
|
|
85
82
|
// Refs for auto-tabbing between inputs
|
|
86
83
|
const dayInputRef = (0, react_2.useRef)(null);
|
|
@@ -180,15 +177,6 @@ exports.DateInput = (0, react_2.forwardRef)(function DateInputNative(_a, ref) {
|
|
|
180
177
|
}
|
|
181
178
|
onDidChange === null || onDidChange === void 0 ? void 0 : onDidChange(newValue);
|
|
182
179
|
});
|
|
183
|
-
// Method to handle beeping - both sound and event
|
|
184
|
-
const handleBeep = (0, react_2.useCallback)(() => {
|
|
185
|
-
// Play the beep sound only if not muted
|
|
186
|
-
if (!mute) {
|
|
187
|
-
(0, audio_utils_1.beep)(440, 50);
|
|
188
|
-
}
|
|
189
|
-
// Always fire the beep event for alternative implementations
|
|
190
|
-
onBeep === null || onBeep === void 0 ? void 0 : onBeep();
|
|
191
|
-
}, [onBeep, mute]);
|
|
192
180
|
// Helper function to format the complete date value
|
|
193
181
|
const formatDateValue = (0, react_2.useCallback)((d, m, y) => {
|
|
194
182
|
if (!d || !m || !y) {
|
|
@@ -224,6 +212,10 @@ exports.DateInput = (0, react_2.forwardRef)(function DateInputNative(_a, ref) {
|
|
|
224
212
|
// Update invalid state immediately for visual feedback
|
|
225
213
|
const isInvalid = validateFn(newValue);
|
|
226
214
|
setInvalid(isInvalid);
|
|
215
|
+
// Clear day invalid state when any field changes, as the date combination might become valid
|
|
216
|
+
if (!isInvalid) {
|
|
217
|
+
setIsDayCurrentlyInvalid(false);
|
|
218
|
+
}
|
|
227
219
|
// Fire invalid event if the value is invalid
|
|
228
220
|
if (isInvalid) {
|
|
229
221
|
onInvalidChange === null || onInvalidChange === void 0 ? void 0 : onInvalidChange();
|
|
@@ -235,18 +227,29 @@ exports.DateInput = (0, react_2.forwardRef)(function DateInputNative(_a, ref) {
|
|
|
235
227
|
const normalizedValue = normalizeFn(currentValue);
|
|
236
228
|
// Check if the current value was invalid (needed normalization or couldn't be normalized)
|
|
237
229
|
const wasInvalid = currentValue !== "" && (normalizedValue === null || normalizedValue !== currentValue);
|
|
238
|
-
if (wasInvalid) {
|
|
239
|
-
// Play beep sound and fire beep event when manually tabbing out of invalid input
|
|
240
|
-
handleBeep();
|
|
241
|
-
}
|
|
242
230
|
if (normalizedValue !== null && normalizedValue !== currentValue) {
|
|
243
231
|
setValue(normalizedValue);
|
|
244
232
|
setInvalid(false); // Clear invalid state after normalization
|
|
245
|
-
//
|
|
233
|
+
// Check if the complete date would be valid
|
|
246
234
|
const dateValues = { day, month, year };
|
|
247
235
|
dateValues[field] = normalizedValue;
|
|
248
236
|
const dateString = formatDateValue(dateValues.day, dateValues.month, dateValues.year);
|
|
249
|
-
|
|
237
|
+
if (dateString !== null) {
|
|
238
|
+
// Valid complete date - update normally
|
|
239
|
+
handleChange(dateString);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
// Invalid date combination - mark the day as invalid if all fields are present
|
|
243
|
+
if (dateValues.day && dateValues.month && dateValues.year) {
|
|
244
|
+
setIsDayCurrentlyInvalid(true);
|
|
245
|
+
onInvalidChange === null || onInvalidChange === void 0 ? void 0 : onInvalidChange();
|
|
246
|
+
// Don't call handleChange with null to avoid clearing the fields
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
// Incomplete date - call handleChange as normal (will be null)
|
|
250
|
+
handleChange(dateString);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
250
253
|
}
|
|
251
254
|
else if (normalizedValue === null && currentValue !== "") {
|
|
252
255
|
// Reset to previous valid value or clear
|
|
@@ -263,9 +266,24 @@ exports.DateInput = (0, react_2.forwardRef)(function DateInputNative(_a, ref) {
|
|
|
263
266
|
const dateValues = { day, month, year };
|
|
264
267
|
dateValues[field] = normalizedValue;
|
|
265
268
|
const dateString = formatDateValue(dateValues.day, dateValues.month, dateValues.year);
|
|
266
|
-
|
|
269
|
+
if (dateString !== null) {
|
|
270
|
+
// Valid complete date - update normally
|
|
271
|
+
handleChange(dateString);
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
// Invalid date combination - mark the day as invalid if all fields are present
|
|
275
|
+
if (dateValues.day && dateValues.month && dateValues.year) {
|
|
276
|
+
setIsDayCurrentlyInvalid(true);
|
|
277
|
+
onInvalidChange === null || onInvalidChange === void 0 ? void 0 : onInvalidChange();
|
|
278
|
+
// Don't call handleChange with null to avoid clearing the fields
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
// Incomplete date - call handleChange as normal (will be null)
|
|
282
|
+
handleChange(dateString);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
267
285
|
}
|
|
268
|
-
}, [day, month, year, handleChange,
|
|
286
|
+
}, [day, month, year, handleChange, onInvalidChange]);
|
|
269
287
|
// Handle changes from individual inputs
|
|
270
288
|
const handleDayChange = (0, react_2.useMemo)(() => createInputChangeHandler("day", setDay, setIsDayCurrentlyInvalid, (value) => isDayInvalid(value, month, year)), [createInputChangeHandler, month, year]);
|
|
271
289
|
const handleDayBlur = (0, react_2.useMemo)(() => createInputBlurHandler("day", setDay, setIsDayCurrentlyInvalid, (value) => normalizeDay(value, month, year)), [createInputBlurHandler, month, year]);
|
|
@@ -370,6 +388,37 @@ exports.DateInput = (0, react_2.forwardRef)(function DateInputNative(_a, ref) {
|
|
|
370
388
|
const setValue = (0, misc_1.useEvent)((newValue) => {
|
|
371
389
|
handleChange(newValue);
|
|
372
390
|
});
|
|
391
|
+
// Function to get ISO formatted date value (YYYY-MM-DD)
|
|
392
|
+
const getIsoValue = (0, react_2.useCallback)(() => {
|
|
393
|
+
if (!day || !month || !year) {
|
|
394
|
+
return null;
|
|
395
|
+
}
|
|
396
|
+
// Convert to numbers
|
|
397
|
+
const dayNum = parseInt(day, 10);
|
|
398
|
+
const monthNum = parseInt(month, 10);
|
|
399
|
+
const yearNum = parseInt(year, 10);
|
|
400
|
+
if (isNaN(dayNum) || isNaN(monthNum) || isNaN(yearNum)) {
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
try {
|
|
404
|
+
// Create date object (month is 0-indexed in Date constructor)
|
|
405
|
+
const date = new Date(yearNum, monthNum - 1, dayNum);
|
|
406
|
+
// Validate the date
|
|
407
|
+
if (date.getFullYear() !== yearNum ||
|
|
408
|
+
date.getMonth() !== monthNum - 1 ||
|
|
409
|
+
date.getDate() !== dayNum) {
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
// Format as ISO date string (YYYY-MM-DD)
|
|
413
|
+
const year4 = yearNum.toString().padStart(4, "0");
|
|
414
|
+
const month2 = monthNum.toString().padStart(2, "0");
|
|
415
|
+
const day2 = dayNum.toString().padStart(2, "0");
|
|
416
|
+
return `${year4}-${month2}-${day2}`;
|
|
417
|
+
}
|
|
418
|
+
catch (error) {
|
|
419
|
+
return null;
|
|
420
|
+
}
|
|
421
|
+
}, [day, month, year]);
|
|
373
422
|
// Component API registration
|
|
374
423
|
(0, react_2.useImperativeHandle)(ref, () => dateInputRef.current);
|
|
375
424
|
(0, react_2.useEffect)(() => {
|
|
@@ -377,9 +426,10 @@ exports.DateInput = (0, react_2.forwardRef)(function DateInputNative(_a, ref) {
|
|
|
377
426
|
registerComponentApi({
|
|
378
427
|
focus,
|
|
379
428
|
setValue,
|
|
429
|
+
isoValue: getIsoValue,
|
|
380
430
|
});
|
|
381
431
|
}
|
|
382
|
-
}, [registerComponentApi, focus, setValue]);
|
|
432
|
+
}, [registerComponentApi, focus, setValue, getIsoValue]);
|
|
383
433
|
// Custom clear icon
|
|
384
434
|
const clearIconElement = (0, react_2.useMemo)(() => {
|
|
385
435
|
if (clearIcon === null || clearIcon === "null")
|
|
@@ -428,11 +478,11 @@ exports.DateInput = (0, react_2.forwardRef)(function DateInputNative(_a, ref) {
|
|
|
428
478
|
};
|
|
429
479
|
switch (field) {
|
|
430
480
|
case "day":
|
|
431
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(DayInput, { autoFocus: autoFocus && index === 0, disabled: !enabled, inputRef: dayInputRef, nextInputRef: nextRef, minValue: minValue, maxValue: maxValue, onChange: handleDayChange, onBlur: handleDayBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, value: day, isInvalid: isDayCurrentlyInvalid, month: month, year: year,
|
|
481
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(DayInput, { autoFocus: autoFocus && index === 0, disabled: !enabled, inputRef: dayInputRef, nextInputRef: nextRef, minValue: minValue, maxValue: maxValue, onChange: handleDayChange, onBlur: handleDayBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, value: day, isInvalid: isDayCurrentlyInvalid, month: month, year: year, emptyCharacter: processedEmptyCharacter }), getSeparator() && (0, jsx_runtime_1.jsx)(InputDivider_1.InputDivider, { separator: getSeparator() })] }, "day"));
|
|
432
482
|
case "month":
|
|
433
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(MonthInput, { autoFocus: autoFocus && index === 0, disabled: !enabled, inputRef: monthInputRef, nextInputRef: nextRef, minValue: minValue, maxValue: maxValue, onChange: handleMonthChange, onBlur: handleMonthBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, value: month, isInvalid: isMonthCurrentlyInvalid,
|
|
483
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(MonthInput, { autoFocus: autoFocus && index === 0, disabled: !enabled, inputRef: monthInputRef, nextInputRef: nextRef, minValue: minValue, maxValue: maxValue, onChange: handleMonthChange, onBlur: handleMonthBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, value: month, isInvalid: isMonthCurrentlyInvalid, emptyCharacter: processedEmptyCharacter }), getSeparator() && (0, jsx_runtime_1.jsx)(InputDivider_1.InputDivider, { separator: getSeparator() })] }, "month"));
|
|
434
484
|
case "year":
|
|
435
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(YearInput, { autoFocus: autoFocus && index === 0, disabled: !enabled, inputRef: yearInputRef, nextInputRef: nextRef, minValue: minValue, maxValue: maxValue, onChange: handleYearChange, onBlur: handleYearBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, value: year, isInvalid: isYearCurrentlyInvalid, dateFormat: dateFormat,
|
|
485
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(YearInput, { autoFocus: autoFocus && index === 0, disabled: !enabled, inputRef: yearInputRef, nextInputRef: nextRef, minValue: minValue, maxValue: maxValue, onChange: handleYearChange, onBlur: handleYearBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, value: year, isInvalid: isYearCurrentlyInvalid, dateFormat: dateFormat, emptyCharacter: processedEmptyCharacter }), getSeparator() && (0, jsx_runtime_1.jsx)(InputDivider_1.InputDivider, { separator: getSeparator() })] }, "year"));
|
|
436
486
|
default:
|
|
437
487
|
return null;
|
|
438
488
|
}
|
|
@@ -444,7 +494,7 @@ exports.DateInput = (0, react_2.forwardRef)(function DateInputNative(_a, ref) {
|
|
|
444
494
|
[DateInput_module_scss_1.default.valid]: validationStatus === "valid",
|
|
445
495
|
[DateInput_module_scss_1.default.disabled]: !enabled,
|
|
446
496
|
[DateInput_module_scss_1.default.readOnly]: readOnly,
|
|
447
|
-
}, className), style: Object.assign(Object.assign({}, style), { gap }), onFocusCapture: handleComponentFocus, onBlur: handleComponentBlur, "data-validation-status": validationStatus }, rest, { children: [startAdornment, (0, jsx_runtime_1.jsxs)("div", { className: DateInput_module_scss_1.default.wrapper, children: [(0, jsx_runtime_1.jsx)("div", { className: DateInput_module_scss_1.default.inputGroup, children: createDateInputs() }), clearable && ((0, jsx_runtime_1.jsx)("button", { className: (0, classnames_1.default)(
|
|
497
|
+
}, className), style: Object.assign(Object.assign({}, style), { gap }), onFocusCapture: handleComponentFocus, onBlur: handleComponentBlur, "data-validation-status": validationStatus }, rest, { children: [startAdornment, (0, jsx_runtime_1.jsxs)("div", { className: DateInput_module_scss_1.default.wrapper, children: [(0, jsx_runtime_1.jsx)("div", { className: DateInput_module_scss_1.default.inputGroup, children: createDateInputs() }), clearable && ((0, jsx_runtime_1.jsx)("button", { "data-part-id": PART_CLEAR_BUTTON, className: (0, classnames_1.default)(DateInput_module_scss_1.default.clearButton, DateInput_module_scss_1.default.button), disabled: !enabled, onClick: clear, onFocus: stopPropagation, type: "button", children: clearIconElement }))] }), endAdornment] })));
|
|
448
498
|
// Wrap with label if needed
|
|
449
499
|
if (label) {
|
|
450
500
|
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { label: label, labelPosition: labelPosition, labelWidth: labelWidth, labelBreak: labelBreak, required: required, children: dateInputComponent }));
|
|
@@ -503,23 +553,23 @@ function DayInput(_a) {
|
|
|
503
553
|
}
|
|
504
554
|
return 31; // Default to 31 if month/year not available
|
|
505
555
|
}, [month, year]);
|
|
506
|
-
return ((0, jsx_runtime_1.jsx)(PartialInput_1.PartialInput, { value: value, emptyCharacter: emptyCharacter, placeholderLength: 2, max: Math.min(maxDay, 31), min: 1, maxLength: 2, validateFn: (val) => isDayInvalid(val, month, year), onBeep: onBeep, onChange: otherProps.onChange, onBlur: (direction, event) => {
|
|
556
|
+
return ((0, jsx_runtime_1.jsx)(PartialInput_1.PartialInput, { "data-part-id": PART_DAY, value: value, emptyCharacter: emptyCharacter, placeholderLength: 2, max: Math.min(maxDay, 31), min: 1, maxLength: 2, validateFn: (val) => isDayInvalid(val, month, year), onBeep: onBeep, onChange: otherProps.onChange, onBlur: (direction, event) => {
|
|
507
557
|
// PartialInput provides direction, but current onBlur expects just event
|
|
508
558
|
if (otherProps.onBlur) {
|
|
509
559
|
// Provide both direction and event to match the expected signature
|
|
510
560
|
otherProps.onBlur(direction, event);
|
|
511
561
|
}
|
|
512
|
-
}, onKeyDown: otherProps.onKeyDown, className: (0, classnames_1.default)(
|
|
562
|
+
}, onKeyDown: otherProps.onKeyDown, className: (0, classnames_1.default)(DateInput_module_scss_1.default.input, DateInput_module_scss_1.default.day), invalidClassName: DateInput_module_scss_1.default.invalid, disabled: otherProps.disabled, readOnly: otherProps.readOnly, required: otherProps.required, autoFocus: otherProps.autoFocus, inputRef: otherProps.inputRef, nextInputRef: otherProps.nextInputRef, name: "day", ariaLabel: otherProps.ariaLabel, isInvalid: isInvalid }));
|
|
513
563
|
}
|
|
514
564
|
function MonthInput(_a) {
|
|
515
565
|
var { minValue, maxValue, value, isInvalid = false, onBeep, emptyCharacter = "-" } = _a, otherProps = __rest(_a, ["minValue", "maxValue", "value", "isInvalid", "onBeep", "emptyCharacter"]);
|
|
516
|
-
return ((0, jsx_runtime_1.jsx)(PartialInput_1.PartialInput, { max: 12, min: 1, name: "month", value: value, invalidClassName: DateInput_module_scss_1.default.invalid, isInvalid: isInvalid, validateFn: isMonthInvalid, onBeep: onBeep, onChange: otherProps.onChange, emptyCharacter: emptyCharacter, placeholderLength: 2, className: (0, classnames_1.default)(
|
|
566
|
+
return ((0, jsx_runtime_1.jsx)(PartialInput_1.PartialInput, { "data-part-id": PART_MONTH, max: 12, min: 1, name: "month", value: value, invalidClassName: DateInput_module_scss_1.default.invalid, isInvalid: isInvalid, validateFn: isMonthInvalid, onBeep: onBeep, onChange: otherProps.onChange, emptyCharacter: emptyCharacter, placeholderLength: 2, className: (0, classnames_1.default)(DateInput_module_scss_1.default.input, DateInput_module_scss_1.default.month), maxLength: 2, disabled: otherProps.disabled, required: otherProps.required, onBlur: (direction, event) => {
|
|
517
567
|
// PartialInput provides direction, but current onBlur expects just event
|
|
518
568
|
if (otherProps.onBlur) {
|
|
519
569
|
// Provide both direction and event to match the expected signature
|
|
520
570
|
otherProps.onBlur(direction, event);
|
|
521
571
|
}
|
|
522
|
-
} }));
|
|
572
|
+
}, onKeyDown: otherProps.onKeyDown, readOnly: otherProps.readOnly, autoFocus: otherProps.autoFocus, inputRef: otherProps.inputRef, nextInputRef: otherProps.nextInputRef, ariaLabel: otherProps.ariaLabel }));
|
|
523
573
|
}
|
|
524
574
|
function YearInput(_a) {
|
|
525
575
|
var { minValue, maxValue, value, isInvalid = false, dateFormat = "MM/dd/yyyy", onBeep, emptyCharacter = "-" } = _a, otherProps = __rest(_a, ["minValue", "maxValue", "value", "isInvalid", "dateFormat", "onBeep", "emptyCharacter"]);
|
|
@@ -529,7 +579,7 @@ function YearInput(_a) {
|
|
|
529
579
|
const min = 1900;
|
|
530
580
|
const max = currentYear + 100;
|
|
531
581
|
const { className: originalClassName } = otherProps, restProps = __rest(otherProps, ["className"]);
|
|
532
|
-
return ((0, jsx_runtime_1.jsx)(PartialInput_1.PartialInput, Object.assign({ max: max, min: min, name: "year", value: value, isInvalid: isInvalid, invalidClassName: DateInput_module_scss_1.default.invalid, validateFn: isYearInvalid, onBeep: onBeep, emptyCharacter: emptyCharacter, placeholderLength: 4, className: (0, classnames_1.default)(
|
|
582
|
+
return ((0, jsx_runtime_1.jsx)(PartialInput_1.PartialInput, Object.assign({ "data-part-id": PART_YEAR, max: max, min: min, name: "year", value: value, isInvalid: isInvalid, invalidClassName: DateInput_module_scss_1.default.invalid, validateFn: isYearInvalid, onBeep: onBeep, emptyCharacter: emptyCharacter, placeholderLength: 4, className: (0, classnames_1.default)(DateInput_module_scss_1.default.input, DateInput_module_scss_1.default.year, originalClassName), maxLength: maxLength, onBlur: (direction, event) => {
|
|
533
583
|
// PartialInput provides direction, but current onBlur expects just event
|
|
534
584
|
if (otherProps.onBlur) {
|
|
535
585
|
// Provide both direction and event to match the expected signature
|
|
@@ -549,17 +599,30 @@ function onFocus(event) {
|
|
|
549
599
|
}
|
|
550
600
|
// Utility function to parse date string into components
|
|
551
601
|
function parseDateString(dateString, dateFormat) {
|
|
602
|
+
// Handle non-string values gracefully by returning null (empty fields)
|
|
603
|
+
if (typeof dateString !== 'string' || dateString === null || dateString === undefined) {
|
|
604
|
+
return null;
|
|
605
|
+
}
|
|
552
606
|
try {
|
|
553
607
|
// Try to parse the date using the specified format
|
|
554
608
|
const parsedDate = (0, date_fns_1.parse)(dateString, dateFormat, new Date());
|
|
555
|
-
if (
|
|
556
|
-
return
|
|
609
|
+
if ((0, date_fns_1.isValid)(parsedDate)) {
|
|
610
|
+
return {
|
|
611
|
+
day: parsedDate.getDate().toString().padStart(2, "0"),
|
|
612
|
+
month: (parsedDate.getMonth() + 1).toString().padStart(2, "0"),
|
|
613
|
+
year: parsedDate.getFullYear().toString(),
|
|
614
|
+
};
|
|
557
615
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
616
|
+
// Fallback: Try to parse as ISO date string
|
|
617
|
+
const isoDate = new Date(dateString);
|
|
618
|
+
if (!isNaN(isoDate.getTime())) {
|
|
619
|
+
return {
|
|
620
|
+
day: isoDate.getDate().toString().padStart(2, "0"),
|
|
621
|
+
month: (isoDate.getMonth() + 1).toString().padStart(2, "0"),
|
|
622
|
+
year: isoDate.getFullYear().toString(),
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
return null;
|
|
563
626
|
}
|
|
564
627
|
catch (error) {
|
|
565
628
|
return null;
|
|
@@ -33,6 +33,9 @@ exports.defaultExpandableItemProps = {
|
|
|
33
33
|
exports.ExpandableItem = (0, react_1.forwardRef)(function ExpandableItem(_a, ref) {
|
|
34
34
|
var { summary, children, className, style, initiallyExpanded = exports.defaultExpandableItemProps.initiallyExpanded, enabled = exports.defaultExpandableItemProps.enabled, iconExpanded = exports.defaultExpandableItemProps.iconExpanded, iconCollapsed = exports.defaultExpandableItemProps.iconCollapsed, iconPosition = exports.defaultExpandableItemProps.iconPosition, withSwitch = exports.defaultExpandableItemProps.withSwitch, onExpandedChange, registerComponentApi } = _a, rest = __rest(_a, ["summary", "children", "className", "style", "initiallyExpanded", "enabled", "iconExpanded", "iconCollapsed", "iconPosition", "withSwitch", "onExpandedChange", "registerComponentApi"]);
|
|
35
35
|
const [isOpen, setIsOpen] = (0, react_2.useState)(initiallyExpanded);
|
|
36
|
+
const generatedId = (0, react_1.useId)();
|
|
37
|
+
const summaryId = `${generatedId}-summary`;
|
|
38
|
+
const contentId = `${generatedId}-content`;
|
|
36
39
|
const toggleOpen = (0, react_1.useCallback)(() => {
|
|
37
40
|
if (!enabled)
|
|
38
41
|
return;
|
|
@@ -73,25 +76,28 @@ exports.ExpandableItem = (0, react_1.forwardRef)(function ExpandableItem(_a, ref
|
|
|
73
76
|
isExpanded: getIsExpanded,
|
|
74
77
|
});
|
|
75
78
|
}, [registerComponentApi, expand, collapse, toggle, getIsExpanded]);
|
|
76
|
-
// Create refs for the Toggle components
|
|
77
|
-
const toggleStartRef = (0, react_1.useRef)();
|
|
78
|
-
const toggleEndRef = (0, react_1.useRef)();
|
|
79
79
|
// Handler for clicking on the summary when using a switch
|
|
80
80
|
const handleSummaryClick = (0, react_1.useCallback)(() => {
|
|
81
|
-
var _a, _b;
|
|
82
81
|
if (!enabled || !withSwitch)
|
|
83
82
|
return;
|
|
84
83
|
const newValue = !isOpen;
|
|
85
84
|
setIsOpen(newValue);
|
|
86
85
|
onExpandedChange === null || onExpandedChange === void 0 ? void 0 : onExpandedChange(newValue);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
}, [enabled, withSwitch, isOpen, onExpandedChange]);
|
|
87
|
+
// Handle keyboard events for accessibility
|
|
88
|
+
const handleKeyDown = (0, react_1.useCallback)((event) => {
|
|
89
|
+
if (!enabled)
|
|
90
|
+
return;
|
|
91
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
if (withSwitch) {
|
|
94
|
+
handleSwitchChange(!isOpen);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
toggleOpen();
|
|
98
|
+
}
|
|
93
99
|
}
|
|
94
|
-
}, [enabled, withSwitch, isOpen,
|
|
100
|
+
}, [enabled, withSwitch, isOpen, handleSwitchChange, toggleOpen]);
|
|
95
101
|
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, rest, { className: (0, classnames_1.default)(ExpandableItem_module_scss_1.default.expandableItem, className, {
|
|
96
102
|
[ExpandableItem_module_scss_1.default.open]: isOpen,
|
|
97
103
|
[ExpandableItem_module_scss_1.default.disabled]: !enabled,
|
|
@@ -99,5 +105,5 @@ exports.ExpandableItem = (0, react_1.forwardRef)(function ExpandableItem(_a, ref
|
|
|
99
105
|
}), style: style, ref: ref, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(ExpandableItem_module_scss_1.default.summary, {
|
|
100
106
|
[ExpandableItem_module_scss_1.default.iconStart]: iconPosition === "start",
|
|
101
107
|
[ExpandableItem_module_scss_1.default.iconEnd]: iconPosition === "end",
|
|
102
|
-
}), onClick: enabled ? (withSwitch ? handleSummaryClick : toggleOpen) : undefined, children: [(0, jsx_runtime_1.jsx)("div", { className: withSwitch ? ExpandableItem_module_scss_1.default.switch : ExpandableItem_module_scss_1.default.icon, children: withSwitch ? ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { variant: "switch", value: isOpen, enabled: enabled, onDidChange: handleSwitchChange })) : ((0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: isOpen ? iconExpanded : iconCollapsed, fallback: isOpen ? "chevrondown" : "chevronright" })) }), (0, jsx_runtime_1.jsx)("div", { className: ExpandableItem_module_scss_1.default.summaryContent, children: summary })] }), isOpen && (0, jsx_runtime_1.jsx)("div", { className: ExpandableItem_module_scss_1.default.content, children: children })] })));
|
|
108
|
+
}), onClick: enabled ? (withSwitch ? handleSummaryClick : toggleOpen) : undefined, onKeyDown: handleKeyDown, tabIndex: enabled ? 0 : undefined, role: "button", "aria-expanded": isOpen, "aria-controls": contentId, "aria-disabled": !enabled, id: summaryId, children: [(0, jsx_runtime_1.jsx)("div", { className: withSwitch ? ExpandableItem_module_scss_1.default.switch : ExpandableItem_module_scss_1.default.icon, "aria-hidden": "true", children: withSwitch ? ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { variant: "switch", value: isOpen, enabled: enabled, onDidChange: handleSwitchChange })) : ((0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: isOpen ? iconExpanded : iconCollapsed, fallback: isOpen ? "chevrondown" : "chevronright" })) }), (0, jsx_runtime_1.jsx)("div", { className: ExpandableItem_module_scss_1.default.summaryContent, children: summary })] }), isOpen && ((0, jsx_runtime_1.jsx)("div", { className: ExpandableItem_module_scss_1.default.content, role: "region", "aria-labelledby": summaryId, id: contentId, children: children }))] })));
|
|
103
109
|
});
|
|
@@ -37,7 +37,7 @@ exports.ItemWithLabel = (0, react_1.forwardRef)(function ItemWithLabel(_a, ref)
|
|
|
37
37
|
const generatedId = (0, react_1.useId)();
|
|
38
38
|
const inputId = id || generatedId;
|
|
39
39
|
if (label === undefined && !validationResult) {
|
|
40
|
-
return ((0, jsx_runtime_1.jsx)(react_slot_1.Slot, Object.assign({}, rest, { style: style, className:
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(react_slot_1.Slot, Object.assign({}, rest, { "data-part-id": parts_1.PART_LABELED_ITEM, style: style, className: className, id: inputId, ref: ref, children: children })));
|
|
41
41
|
// return cloneElement(children as ReactElement, {
|
|
42
42
|
// ...mergeProps((children as ReactElement).props, {
|
|
43
43
|
// style,
|
|
@@ -53,9 +53,9 @@ exports.ItemWithLabel = (0, react_1.forwardRef)(function ItemWithLabel(_a, ref)
|
|
|
53
53
|
[FormItem_module_scss_1.default.start]: labelPosition === "start",
|
|
54
54
|
[FormItem_module_scss_1.default.end]: labelPosition === "end",
|
|
55
55
|
[FormItem_module_scss_1.default.shrinkToLabel]: shrinkToLabel,
|
|
56
|
-
}), children: [label && ((0, jsx_runtime_1.jsxs)("label", { htmlFor: inputId, onClick: () => { var _a; return (_a = document.getElementById(inputId)) === null || _a === void 0 ? void 0 : _a.focus(); }, style: Object.assign(Object.assign({}, labelStyle), { width: labelWidth && numberRegex.test(labelWidth) ? `${labelWidth}px` : labelWidth, flexShrink: labelWidth !== undefined ? 0 : undefined }), className: (0, classnames_1.default)(
|
|
56
|
+
}), children: [label && ((0, jsx_runtime_1.jsxs)("label", { "data-part-id": parts_1.PART_LABEL, htmlFor: inputId, onClick: () => { var _a; return (_a = document.getElementById(inputId)) === null || _a === void 0 ? void 0 : _a.focus(); }, style: Object.assign(Object.assign({}, labelStyle), { width: labelWidth && numberRegex.test(labelWidth) ? `${labelWidth}px` : labelWidth, flexShrink: labelWidth !== undefined ? 0 : undefined }), className: (0, classnames_1.default)(FormItem_module_scss_1.default.inputLabel, {
|
|
57
57
|
[FormItem_module_scss_1.default.required]: required,
|
|
58
58
|
[FormItem_module_scss_1.default.disabled]: !enabled,
|
|
59
59
|
[FormItem_module_scss_1.default.labelBreak]: labelBreak,
|
|
60
|
-
}), children: [label, " ", required && (0, jsx_runtime_1.jsx)("span", { className: FormItem_module_scss_1.default.requiredMark, children: "*" }), validationInProgress && ((0, jsx_runtime_1.jsx)(SpinnerNative_1.Spinner, { style: { height: "1em", width: "1em", marginLeft: "1em", alignSelf: "center" } }))] })), (0, jsx_runtime_1.jsx)(react_slot_1.Slot, {
|
|
60
|
+
}), children: [label, " ", required && (0, jsx_runtime_1.jsx)("span", { className: FormItem_module_scss_1.default.requiredMark, children: "*" }), validationInProgress && ((0, jsx_runtime_1.jsx)(SpinnerNative_1.Spinner, { style: { height: "1em", width: "1em", marginLeft: "1em", alignSelf: "center" } }))] })), (0, jsx_runtime_1.jsx)(react_slot_1.Slot, { "data-part-id": parts_1.PART_LABELED_ITEM, id: !isInputTemplateUsed ? inputId : undefined, children: children })] }), validationResult] })));
|
|
61
61
|
});
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
@@ -24,7 +35,8 @@ const PartialInput_module_scss_1 = __importDefault(require("./PartialInput.modul
|
|
|
24
35
|
* @param props - PartialInputProps configuration
|
|
25
36
|
* @returns A configured input element with enhanced multi-field input behavior
|
|
26
37
|
*/
|
|
27
|
-
function PartialInput(
|
|
38
|
+
function PartialInput(_a) {
|
|
39
|
+
var { value, placeholder, onChange, onBlur, onKeyDown, emptyCharacter, placeholderLength = 2, max, min, maxLength = 2, validateFn, onBeep, nextInputRef, nextButtonRef, name, ariaLabel, className, invalidClassName, disabled, readOnly, required, autoFocus, inputRef, step = 1, isInvalid = false } = _a, restProps = __rest(_a, ["value", "placeholder", "onChange", "onBlur", "onKeyDown", "emptyCharacter", "placeholderLength", "max", "min", "maxLength", "validateFn", "onBeep", "nextInputRef", "nextButtonRef", "name", "ariaLabel", "className", "invalidClassName", "disabled", "readOnly", "required", "autoFocus", "inputRef", "step", "isInvalid"]);
|
|
28
40
|
/**
|
|
29
41
|
* Process emptyCharacter according to requirements.
|
|
30
42
|
* Handles null/empty values, multi-character strings, and unicode characters.
|
|
@@ -122,9 +134,22 @@ function PartialInput({ value, placeholder, onChange, onBlur, onKeyDown, emptyCh
|
|
|
122
134
|
// Call the enhanced onBlur handler with direction
|
|
123
135
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(direction, event);
|
|
124
136
|
}, [onBlur, nextInputRef, nextButtonRef]);
|
|
125
|
-
|
|
137
|
+
/**
|
|
138
|
+
* Enhanced key down handler that prevents space character input.
|
|
139
|
+
* Filters out space key presses while allowing other keys to pass through.
|
|
140
|
+
*/
|
|
141
|
+
const handleKeyDown = (0, react_1.useCallback)((event) => {
|
|
142
|
+
// Prevent space character input
|
|
143
|
+
if (event.key === " " || event.code === "Space") {
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
// Call the original onKeyDown handler for other keys
|
|
148
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
149
|
+
}, [onKeyDown]);
|
|
150
|
+
return ((0, jsx_runtime_1.jsx)("input", Object.assign({}, restProps, { "aria-label": ariaLabel, autoComplete: "off",
|
|
126
151
|
// biome-ignore lint/a11y/noAutofocus: This is up to developers' decision
|
|
127
152
|
autoFocus: autoFocus, className: (0, classnames_1.default)(PartialInput_module_scss_1.default.partialInput, className, {
|
|
128
153
|
[invalidClassName]: isInvalid,
|
|
129
|
-
}), "data-input": "true", disabled: disabled, inputMode: "numeric", max: max, maxLength: maxLength, min: min, name: name, onChange: handleInputChange, onBlur: handleBlur, onFocus: handleInternalFocus, onKeyDown:
|
|
154
|
+
}), "data-input": "true", disabled: disabled, inputMode: "numeric", max: max, maxLength: maxLength, min: min, name: name, onChange: handleInputChange, onBlur: handleBlur, onFocus: handleInternalFocus, onKeyDown: handleKeyDown, placeholder: finalPlaceholder, readOnly: readOnly, ref: inputRef, required: required, step: step, type: "text", value: value !== null ? value : "" })));
|
|
130
155
|
}
|
|
@@ -66,7 +66,6 @@ const constants_1 = require("../../components-core/constants");
|
|
|
66
66
|
const CardNative_1 = require("../Card/CardNative");
|
|
67
67
|
const virtua_1 = require("virtua");
|
|
68
68
|
const hooks_1 = require("../../components-core/utils/hooks");
|
|
69
|
-
const ScrollContext_1 = require("../../components-core/ScrollContext");
|
|
70
69
|
const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
|
|
71
70
|
const List_module_scss_1 = __importDefault(require("./List.module.scss"));
|
|
72
71
|
const classnames_1 = __importDefault(require("classnames"));
|
|
@@ -228,14 +227,16 @@ const useShift = (listData, idKey) => {
|
|
|
228
227
|
return shouldShift.current;
|
|
229
228
|
};
|
|
230
229
|
exports.ListNative = (0, react_1.forwardRef)(function DynamicHeightList(_a, ref) {
|
|
231
|
-
var _b;
|
|
230
|
+
var _b, _c;
|
|
232
231
|
var { items = constants_1.EMPTY_ARRAY, itemRenderer = defaultItemRenderer, sectionRenderer, sectionFooterRenderer, loading, limit, groupBy, orderBy, availableGroups, scrollAnchor = exports.defaultProps.scrollAnchor, requestFetchPrevPage = lodash_es_1.noop, requestFetchNextPage = lodash_es_1.noop, pageInfo, idKey = exports.defaultProps.idKey, style, className, emptyListPlaceholder, groupsInitiallyExpanded = true, defaultGroups = constants_1.EMPTY_ARRAY, registerComponentApi, borderCollapse = exports.defaultProps.borderCollapse } = _a, rest = __rest(_a, ["items", "itemRenderer", "sectionRenderer", "sectionFooterRenderer", "loading", "limit", "groupBy", "orderBy", "availableGroups", "scrollAnchor", "requestFetchPrevPage", "requestFetchNextPage", "pageInfo", "idKey", "style", "className", "emptyListPlaceholder", "groupsInitiallyExpanded", "defaultGroups", "registerComponentApi", "borderCollapse"]);
|
|
233
232
|
const virtualizerRef = (0, react_1.useRef)(null);
|
|
234
|
-
const scrollRef = (0, react_1.useContext)(ScrollContext_1.ScrollContext);
|
|
235
233
|
const parentRef = (0, react_1.useRef)(null);
|
|
236
234
|
const rootRef = ref ? (0, react_compose_refs_1.composeRefs)(parentRef, ref) : parentRef;
|
|
235
|
+
const scrollParent = (0, hooks_1.useScrollParent)((_b = parentRef.current) === null || _b === void 0 ? void 0 : _b.parentElement);
|
|
236
|
+
const scrollRef = (0, react_1.useRef)(scrollParent);
|
|
237
|
+
scrollRef.current = scrollParent;
|
|
237
238
|
const hasHeight = (0, hooks_1.useHasExplicitHeight)(parentRef);
|
|
238
|
-
const hasOutsideScroll = scrollRef && !hasHeight;
|
|
239
|
+
const hasOutsideScroll = scrollRef.current && !hasHeight;
|
|
239
240
|
const scrollElementRef = hasOutsideScroll ? scrollRef : parentRef;
|
|
240
241
|
const shouldStickToBottom = (0, react_1.useRef)(scrollAnchor === "bottom");
|
|
241
242
|
const [expanded, setExpanded] = (0, react_1.useState)(constants_1.EMPTY_OBJECT);
|
|
@@ -384,7 +385,7 @@ exports.ListNative = (0, react_1.forwardRef)(function DynamicHeightList(_a, ref)
|
|
|
384
385
|
// REVIEW: I changed this code line because in the build version rows[index] was undefined
|
|
385
386
|
// const rowTypeContextValue = useCallback((index: number) => rows[index]._row_type, [rows]);
|
|
386
387
|
const rowTypeContextValue = (0, react_1.useCallback)((index) => { var _a; return (_a = rows === null || rows === void 0 ? void 0 : rows[index]) === null || _a === void 0 ? void 0 : _a._row_type; }, [rows]);
|
|
387
|
-
const rowCount = (
|
|
388
|
+
const rowCount = (_c = rows === null || rows === void 0 ? void 0 : rows.length) !== null && _c !== void 0 ? _c : 0;
|
|
388
389
|
const startMargin = (0, hooks_1.useStartMargin)(hasOutsideScroll, parentRef, scrollRef);
|
|
389
390
|
return ((0, jsx_runtime_1.jsx)(ListItemTypeContext.Provider, { value: rowTypeContextValue, children: (0, jsx_runtime_1.jsx)(exports.ListContext.Provider, { value: expandContextValue, children: (0, jsx_runtime_1.jsxs)("div", Object.assign({}, rest, { ref: rootRef, style: style, className: (0, classnames_1.default)(List_module_scss_1.default.outerWrapper, {
|
|
390
391
|
[List_module_scss_1.default.hasOutsideScroll]: hasOutsideScroll,
|
|
@@ -52,10 +52,8 @@ exports.buildNavHierarchy = buildNavHierarchy;
|
|
|
52
52
|
exports.buildLinkMap = buildLinkMap;
|
|
53
53
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
54
54
|
const react_1 = __importStar(require("react"));
|
|
55
|
-
const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
|
|
56
55
|
const classnames_1 = __importDefault(require("classnames"));
|
|
57
56
|
const NavPanel_module_scss_1 = __importDefault(require("./NavPanel.module.scss"));
|
|
58
|
-
const ScrollContext_1 = require("../../components-core/ScrollContext");
|
|
59
57
|
const LogoNative_1 = require("../Logo/LogoNative");
|
|
60
58
|
const AppLayoutContext_1 = require("../App/AppLayoutContext");
|
|
61
59
|
const AppNative_1 = require("../App/AppNative");
|
|
@@ -193,14 +191,11 @@ const contextValue = {
|
|
|
193
191
|
};
|
|
194
192
|
function DrawerNavPanel(_a) {
|
|
195
193
|
var { logoContent, children, className, style } = _a, rest = __rest(_a, ["logoContent", "children", "className", "style"]);
|
|
196
|
-
|
|
197
|
-
return ((0, jsx_runtime_1.jsx)(exports.NavPanelContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { ref: scrollContainerRef, className: (0, classnames_1.default)(NavPanel_module_scss_1.default.wrapper, className), style: style, children: (0, jsx_runtime_1.jsxs)(ScrollContext_1.ScrollContext.Provider, { value: scrollContainerRef, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(NavPanel_module_scss_1.default.logoWrapper, NavPanel_module_scss_1.default.inDrawer), children: logoContent || (0, jsx_runtime_1.jsx)(LogoNative_1.Logo, {}) }), (0, jsx_runtime_1.jsx)("div", { className: NavPanel_module_scss_1.default.wrapperInner, style: style, children: children })] }) })) }));
|
|
194
|
+
return ((0, jsx_runtime_1.jsx)(exports.NavPanelContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsxs)("div", Object.assign({}, rest, { className: (0, classnames_1.default)(NavPanel_module_scss_1.default.wrapper, className), style: style, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(NavPanel_module_scss_1.default.logoWrapper, NavPanel_module_scss_1.default.inDrawer), children: logoContent || (0, jsx_runtime_1.jsx)(LogoNative_1.Logo, {}) }), (0, jsx_runtime_1.jsx)("div", { className: NavPanel_module_scss_1.default.wrapperInner, style: style, children: children })] })) }));
|
|
198
195
|
}
|
|
199
196
|
exports.NavPanel = (0, react_1.forwardRef)(function NavPanel(_a, forwardedRef) {
|
|
200
197
|
var _b, _c;
|
|
201
198
|
var { children, style, logoContent, className, inDrawer = exports.defaultProps.inDrawer, renderChild, navLinks } = _a, rest = __rest(_a, ["children", "style", "logoContent", "className", "inDrawer", "renderChild", "navLinks"]);
|
|
202
|
-
const scrollContainerRef = (0, react_1.useRef)(null);
|
|
203
|
-
const ref = forwardedRef ? (0, react_compose_refs_1.composeRefs)(scrollContainerRef, forwardedRef) : scrollContainerRef;
|
|
204
199
|
const appLayoutContext = (0, AppLayoutContext_1.useAppLayoutContext)();
|
|
205
200
|
const linkInfoContext = (0, LinkInfoContext_1.useLinkInfoContext)();
|
|
206
201
|
const horizontal = (0, AppNative_1.getAppLayoutOrientation)(appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === "horizontal";
|
|
@@ -219,9 +214,9 @@ exports.NavPanel = (0, react_1.forwardRef)(function NavPanel(_a, forwardedRef) {
|
|
|
219
214
|
if (inDrawer) {
|
|
220
215
|
return ((0, jsx_runtime_1.jsx)(DrawerNavPanel, Object.assign({}, rest, { style: style, logoContent: safeLogoContent, className: className, children: children })));
|
|
221
216
|
}
|
|
222
|
-
return ((0, jsx_runtime_1.
|
|
217
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, rest, { ref: forwardedRef, className: (0, classnames_1.default)(NavPanel_module_scss_1.default.wrapper, className, {
|
|
223
218
|
[NavPanel_module_scss_1.default.horizontal]: horizontal,
|
|
224
219
|
[NavPanel_module_scss_1.default.vertical]: vertical,
|
|
225
220
|
[NavPanel_module_scss_1.default.condensed]: isCondensed,
|
|
226
|
-
}), style: style, children:
|
|
221
|
+
}), style: style, children: [showLogo && ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(NavPanel_module_scss_1.default.logoWrapper), children: safeLogoContent || (0, jsx_runtime_1.jsx)(LogoNative_1.Logo, {}) })), (0, jsx_runtime_1.jsx)("div", { className: NavPanel_module_scss_1.default.wrapperInner, style: style, children: children })] })));
|
|
227
222
|
});
|
|
@@ -321,9 +321,9 @@ exports.NumberBox = (0, react_1.forwardRef)(function NumberBox(_a, forwardedRef)
|
|
|
321
321
|
}), tabIndex: -1, onFocus: () => {
|
|
322
322
|
var _a;
|
|
323
323
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
324
|
-
}, style: { gap }, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: (0, classnames_1.default)(
|
|
324
|
+
}, 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
325
|
[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, { text: endText, iconName: endIcon, className: (0, classnames_1.default)(
|
|
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" }) })] }))] }) })));
|
|
327
327
|
});
|
|
328
328
|
function applyStep(valueStrRep, step, min, max, integersOnly) {
|
|
329
329
|
const currentValue = (0, numberbox_abstractions_1.toUsableNumber)(valueStrRep, integersOnly);
|
|
@@ -23,7 +23,8 @@ exports.PaginationMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
23
23
|
"that are enabled/disabled using the `hasPrevPage` and `hasNextPage` props.", undefined, "number"),
|
|
24
24
|
pageSize: (0, metadata_helpers_1.d)("Number of items per page", undefined, "number", PaginationNative_1.defaultProps.pageSize),
|
|
25
25
|
pageIndex: (0, metadata_helpers_1.d)("Current page index (0-based)", undefined, "number", PaginationNative_1.defaultProps.pageIndex),
|
|
26
|
-
maxVisiblePages: (0, metadata_helpers_1.d)("Maximum number of page buttons to display
|
|
26
|
+
maxVisiblePages: (0, metadata_helpers_1.d)("Maximum number of page buttons to display. " +
|
|
27
|
+
"If the value is not among the allowed values, it will fall back to the default.", PaginationNative_1.PageNumberValues, "number", PaginationNative_1.defaultProps.maxVisiblePages),
|
|
27
28
|
showPageInfo: (0, metadata_helpers_1.d)("Whether to show page information", undefined, "boolean", PaginationNative_1.defaultProps.showPageInfo),
|
|
28
29
|
showPageSizeSelector: (0, metadata_helpers_1.d)("Whether to show the page size selector", undefined, "boolean", PaginationNative_1.defaultProps.showPageSizeSelector),
|
|
29
30
|
showCurrentPage: (0, metadata_helpers_1.d)("Whether to show the current page indicator", undefined, "boolean", PaginationNative_1.defaultProps.showCurrentPage),
|
|
@@ -5,18 +5,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.sliderComponentRenderer = exports.SliderMd = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const SliderNative_1 = require("./SliderNative");
|
|
8
9
|
const Slider_module_scss_1 = __importDefault(require("./Slider.module.scss"));
|
|
9
10
|
const renderers_1 = require("../../components-core/renderers");
|
|
10
11
|
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
11
12
|
const metadata_helpers_1 = require("../metadata-helpers");
|
|
12
|
-
const SliderNative_1 = require("./SliderNative");
|
|
13
13
|
const COMP = "Slider";
|
|
14
14
|
exports.SliderMd = (0, metadata_helpers_1.createMetadata)({
|
|
15
15
|
status: "stable",
|
|
16
16
|
description: "`Slider` provides an interactive control for selecting numeric values within " +
|
|
17
17
|
"a defined range, supporting both single value selection and range selection with " +
|
|
18
18
|
"multiple thumbs. It offers precise control through customizable steps and visual " +
|
|
19
|
-
"feedback with formatted value display."
|
|
19
|
+
"feedback with formatted value display." +
|
|
20
|
+
"\n\n" +
|
|
21
|
+
"Hover over the component to see the tooltip with the current value. On mobile, tap the thumb to see the tooltip.",
|
|
20
22
|
props: {
|
|
21
23
|
initialValue: (0, metadata_helpers_1.dInitialValue)(),
|
|
22
24
|
label: (0, metadata_helpers_1.dLabel)(),
|
|
@@ -26,29 +28,29 @@ exports.SliderMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
26
28
|
minValue: {
|
|
27
29
|
description: `This property specifies the minimum value of the allowed input range.`,
|
|
28
30
|
valueType: "number",
|
|
29
|
-
defaultValue:
|
|
31
|
+
defaultValue: 0,
|
|
30
32
|
},
|
|
31
33
|
maxValue: {
|
|
32
34
|
description: `This property specifies the maximum value of the allowed input range.`,
|
|
33
35
|
valueType: "number",
|
|
34
|
-
defaultValue:
|
|
36
|
+
defaultValue: 10,
|
|
35
37
|
},
|
|
36
38
|
step: {
|
|
37
39
|
description: `This property defines the increment value for the slider, determining the allowed intervals between selectable values.`,
|
|
38
|
-
defaultValue:
|
|
40
|
+
defaultValue: 1,
|
|
39
41
|
},
|
|
40
|
-
minStepsBetweenThumbs: (0, metadata_helpers_1.d)(`This property sets the minimum number of steps required between multiple thumbs on the slider, ensuring they maintain a specified distance.`, undefined, "number",
|
|
42
|
+
minStepsBetweenThumbs: (0, metadata_helpers_1.d)(`This property sets the minimum number of steps required between multiple thumbs on the slider, ensuring they maintain a specified distance.`, undefined, "number", 1),
|
|
41
43
|
enabled: (0, metadata_helpers_1.dEnabled)(),
|
|
42
44
|
autoFocus: (0, metadata_helpers_1.dAutoFocus)(),
|
|
43
45
|
required: (0, metadata_helpers_1.dRequired)(),
|
|
44
46
|
readOnly: (0, metadata_helpers_1.dReadonly)(),
|
|
45
|
-
validationStatus: Object.assign(Object.assign({}, (0, metadata_helpers_1.dValidationStatus)()), { defaultValue:
|
|
47
|
+
validationStatus: Object.assign(Object.assign({}, (0, metadata_helpers_1.dValidationStatus)()), { defaultValue: "none" }),
|
|
46
48
|
rangeStyle: (0, metadata_helpers_1.d)(`This optional property allows you to apply custom styles to the range element of the slider.`),
|
|
47
49
|
thumbStyle: (0, metadata_helpers_1.d)(`This optional property allows you to apply custom styles to the thumb elements of the slider.`),
|
|
48
50
|
showValues: {
|
|
49
51
|
description: `This property controls whether the slider shows the current values of the thumbs.`,
|
|
50
52
|
valueType: "boolean",
|
|
51
|
-
defaultValue:
|
|
53
|
+
defaultValue: true,
|
|
52
54
|
},
|
|
53
55
|
valueFormat: {
|
|
54
56
|
description: `This property allows you to customize how the values are displayed.`,
|