xmlui 0.10.8 → 0.10.11
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-BuIblMfO.mjs +50034 -0
- package/dist/lib/index.css +1 -1
- package/dist/lib/initMock-CV-9AUzP.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-DrEexTX9.mjs → metadata-utils-DzONZF-e.mjs} +161 -111
- package/dist/lib/scss/components-core/theming/_themes.scss +6 -7
- package/dist/lib/{server-common-ddmPKhK6.mjs → server-common-Dsyp3-Ro.mjs} +14949 -10880
- 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-CBz7TQJh.mjs +7375 -0
- package/dist/lib/xmlui-parser.d.ts +3 -3
- package/dist/lib/xmlui-parser.mjs +49 -49
- package/dist/lib/xmlui-serializer-Bf9bdvlV.mjs +667 -0
- package/dist/lib/xmlui.d.ts +16 -11
- package/dist/lib/xmlui.mjs +44 -44
- package/dist/{lib/apiInterceptorWorker-DH8wqOVq.mjs → metadata/apiInterceptorWorker-BmKP8bnq.mjs} +5432 -3502
- package/dist/metadata/collectedComponentMetadata-Cdi6AFD3.mjs +55851 -0
- package/dist/metadata/initMock-B7OlSKKb.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/Accordion/AccordionItemNative.js +2 -2
- 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 +29 -9
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +1 -1
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +5 -4
- package/dist/scripts/src/components/Breakout/BreakoutNative.js +2 -2
- package/dist/scripts/src/components/Button/Button.js +1 -1
- 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/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 +4 -4
- package/dist/scripts/src/components/Charts/BarChart/BarChartNative.js +90 -82
- 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/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 -0
- package/dist/scripts/src/components/DataSource/DataSource.js +124 -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/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/scripts/src/components/ExpandableItem/ExpandableItemNative.js +18 -12
- package/dist/scripts/src/components/Footer/Footer.js +1 -1
- package/dist/scripts/src/components/FormItem/FormItem.js +1 -1
- 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/Image/ImageNative.js +13 -0
- 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/NavLink/NavLink.js +1 -1
- 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/Option/Option.js +2 -2
- package/dist/scripts/src/components/Option/OptionNative.js +12 -1
- package/dist/scripts/src/components/Pagination/Pagination.js +2 -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/Slider/Slider.js +10 -8
- package/dist/scripts/src/components/Slider/SliderNative.js +24 -21
- 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/Table/TableNative.js +18 -13
- 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/TextArea/TextAreaNative.js +3 -3
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +3 -3
- 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/Toggle/Toggle.js +2 -2
- 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 +7 -3
- 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/interception/ApiInterceptor.js +4 -1
- package/dist/scripts/src/components-core/interception/Backend.js +13 -7
- package/dist/scripts/src/components-core/markup-check.js +279 -0
- package/dist/scripts/src/components-core/parts.js +0 -4
- 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/transform.js +15 -4
- package/dist/standalone/xmlui-standalone.es.d.ts +23 -15
- 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-CqzCWOUw.mjs +0 -38579
- package/dist/lib/initMock-C5CXs0-5.mjs +0 -568
- package/dist/lib/transform-SMWeyMoq.mjs +0 -5391
- package/dist/lib/xmlui-serializer-a0O0jFY-.mjs +0 -497
- package/dist/metadata/collectedComponentMetadata-DIT5VbaH.mjs +0 -42985
- package/dist/metadata/initMock-D6Vi9kU_.mjs +0 -568
- 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;
|
|
@@ -130,7 +130,7 @@ exports.MenuItemMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
130
130
|
[`color-${MICOMP}`]: "$textColor-primary",
|
|
131
131
|
[`color-${MICOMP}--disabled`]: "$textColor--disabled",
|
|
132
132
|
[`fontFamily-${MICOMP}`]: "$fontFamily",
|
|
133
|
-
[`fontSize-${MICOMP}`]: "$fontSize-
|
|
133
|
+
[`fontSize-${MICOMP}`]: "$fontSize-sm",
|
|
134
134
|
[`paddingVertical-${MICOMP}`]: "$space-2",
|
|
135
135
|
[`paddingHorizontal-${MICOMP}`]: "$space-3",
|
|
136
136
|
[`backgroundColor-${MICOMP}--hover`]: "$backgroundColor-dropdown-item--hover",
|
|
@@ -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
|
});
|
|
@@ -22,7 +22,7 @@ exports.FooterMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
22
22
|
defaultThemeVars: {
|
|
23
23
|
[`backgroundColor-${COMP}`]: "$backgroundColor-AppHeader",
|
|
24
24
|
[`verticalAlignment-${COMP}`]: "center",
|
|
25
|
-
[`fontSize-${COMP}`]: "$fontSize-
|
|
25
|
+
[`fontSize-${COMP}`]: "$fontSize-sm",
|
|
26
26
|
[`textColor-${COMP}`]: "$textColor-secondary",
|
|
27
27
|
[`maxWidth-content-${COMP}`]: "$maxWidth-content",
|
|
28
28
|
[`borderTop-${COMP}`]: `1px solid $borderColor`,
|
|
@@ -193,7 +193,7 @@ exports.FormItemMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
193
193
|
themeVars: (0, themeVars_1.parseScssVar)(FormItem_module_scss_1.default.themeVars),
|
|
194
194
|
defaultThemeVars: {
|
|
195
195
|
"textColor-FormItemLabel": "$textColor-primary",
|
|
196
|
-
"fontSize-FormItemLabel": "$fontSize-
|
|
196
|
+
"fontSize-FormItemLabel": "$fontSize-sm",
|
|
197
197
|
"fontWeight-FormItemLabel": "$fontWeight-medium",
|
|
198
198
|
"fontStyle-FormItemLabel": "normal",
|
|
199
199
|
"textTransform-FormItemLabel": "none",
|
|
@@ -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
|
});
|