xmlui 0.10.16 → 0.10.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/lib/{index-D4RYJasT.mjs → index-cuh97e2e.mjs} +1603 -1635
  2. package/dist/lib/index.css +1 -1
  3. package/dist/lib/{initMock-qzTZlH-6.mjs → initMock-BMxsanHc.mjs} +1 -1
  4. package/dist/lib/xmlui.mjs +1 -1
  5. package/dist/metadata/{collectedComponentMetadata-BQaefK3f.mjs → collectedComponentMetadata-Cp-9lpnG.mjs} +1716 -1757
  6. package/dist/metadata/{initMock-Cz6QssI3.mjs → initMock-C-cnv--V.mjs} +1 -1
  7. package/dist/metadata/style.css +1 -1
  8. package/dist/metadata/xmlui-metadata.mjs +1 -1
  9. package/dist/metadata/xmlui-metadata.umd.js +3 -3
  10. package/dist/scripts/package.json +1 -1
  11. package/dist/scripts/src/components/Accordion/Accordion.spec.js +1 -1
  12. package/dist/scripts/src/components/Accordion/AccordionItemNative.js +1 -1
  13. package/dist/scripts/src/components/AutoComplete/AutoComplete.spec.js +54 -4
  14. package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +81 -62
  15. package/dist/scripts/src/components/Checkbox/Checkbox.js +1 -5
  16. package/dist/scripts/src/components/Checkbox/Checkbox.spec.js +5 -0
  17. package/dist/scripts/src/components/ColorPicker/ColorPicker.js +2 -6
  18. package/dist/scripts/src/components/ColorPicker/ColorPicker.spec.js +29 -0
  19. package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +12 -9
  20. package/dist/scripts/src/components/ComponentProvider.js +2 -0
  21. package/dist/scripts/src/components/DateInput/DateInput.js +1 -5
  22. package/dist/scripts/src/components/DateInput/DateInput.spec.js +51 -17
  23. package/dist/scripts/src/components/DateInput/DateInputNative.js +12 -16
  24. package/dist/scripts/src/components/DatePicker/DatePicker.js +14 -13
  25. package/dist/scripts/src/components/DatePicker/DatePicker.spec.js +50 -18
  26. package/dist/scripts/src/components/DatePicker/DatePickerNative.js +34 -32
  27. package/dist/scripts/src/components/FileInput/FileInput.js +1 -5
  28. package/dist/scripts/src/components/FileInput/FileInput.spec.js +36 -0
  29. package/dist/scripts/src/components/FileInput/FileInputNative.js +14 -15
  30. package/dist/scripts/src/components/Form/Form.spec.js +11 -9
  31. package/dist/scripts/src/components/Form/FormNative.js +15 -9
  32. package/dist/scripts/src/components/FormItem/FormItem.spec.js +179 -30
  33. package/dist/scripts/src/components/FormItem/FormItemNative.js +20 -22
  34. package/dist/scripts/src/components/FormItem/ItemWithLabel.js +8 -17
  35. package/dist/scripts/src/components/FormItem/Validations.js +25 -6
  36. package/dist/scripts/src/components/Icon/Icon.js +1 -1
  37. package/dist/scripts/src/components/Input/PartialInput.js +2 -2
  38. package/dist/scripts/src/components/NumberBox/NumberBox.js +1 -5
  39. package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +38 -4
  40. package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +15 -17
  41. package/dist/scripts/src/components/RadioGroup/RadioGroup.js +1 -5
  42. package/dist/scripts/src/components/RadioGroup/RadioGroup.spec.js +9 -0
  43. package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +4 -5
  44. package/dist/scripts/src/components/RadioGroup/RadioItem.js +28 -0
  45. package/dist/scripts/src/components/Select/Select.js +1 -5
  46. package/dist/scripts/src/components/Select/Select.spec.js +290 -193
  47. package/dist/scripts/src/components/Select/SelectNative.js +26 -32
  48. package/dist/scripts/src/components/Slider/Slider.js +1 -5
  49. package/dist/scripts/src/components/Slider/Slider.spec.js +36 -0
  50. package/dist/scripts/src/components/Slider/SliderNative.js +18 -19
  51. package/dist/scripts/src/components/Switch/Switch.js +1 -5
  52. package/dist/scripts/src/components/Switch/Switch.spec.js +24 -17
  53. package/dist/scripts/src/components/Table/Table.js +11 -1
  54. package/dist/scripts/src/components/Table/Table.spec.js +272 -0
  55. package/dist/scripts/src/components/Table/TableNative.js +162 -5
  56. package/dist/scripts/src/components/TextArea/TextArea.js +1 -5
  57. package/dist/scripts/src/components/TextArea/TextArea.spec.js +80 -0
  58. package/dist/scripts/src/components/TextArea/TextAreaNative.js +8 -29
  59. package/dist/scripts/src/components/TextBox/TextBox.spec.js +45 -7
  60. package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
  61. package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +75 -37
  62. package/dist/scripts/src/components/TimeInput/TimeInputNative.js +6 -20
  63. package/dist/scripts/src/components/Timer/Timer.spec.js +66 -96
  64. package/dist/scripts/src/components/Toggle/Toggle.js +30 -25
  65. package/dist/scripts/src/components/Tree/Tree-icons.spec.js +206 -0
  66. package/dist/scripts/src/components/Tree/Tree.spec.js +1 -94
  67. package/dist/scripts/src/components/Tree/TreeComponent.js +44 -7
  68. package/dist/scripts/src/components/Tree/TreeNative.js +127 -85
  69. package/dist/scripts/src/components/Tree/testData.js +25 -1
  70. package/dist/scripts/src/components-core/behaviors/Behavior.js +2 -0
  71. package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +8 -5
  72. package/dist/scripts/src/components-core/rendering/AppRoot.js +1 -2
  73. package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +12 -13
  74. package/dist/scripts/src/components-core/utils/treeUtils.js +8 -5
  75. package/dist/scripts/src/testing/ComponentDrivers.js +2 -4
  76. package/dist/standalone/xmlui-standalone.umd.js +15 -15
  77. package/package.json +1 -1
  78. package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +0 -54
@@ -36,7 +36,7 @@ const PartialInput_module_scss_1 = __importDefault(require("./PartialInput.modul
36
36
  * @returns A configured input element with enhanced multi-field input behavior
37
37
  */
38
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"]);
39
+ var { value, placeholder, onChange, onBlur, onKeyDown, emptyCharacter, placeholderLength = 2, max, min, maxLength = 2, validateFn, onBeep, nextInputRef, nextButtonRef, id, 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", "id", "name", "ariaLabel", "className", "invalidClassName", "disabled", "readOnly", "required", "autoFocus", "inputRef", "step", "isInvalid"]);
40
40
  /**
41
41
  * Process emptyCharacter according to requirements.
42
42
  * Handles null/empty values, multi-character strings, and unicode characters.
@@ -147,7 +147,7 @@ function PartialInput(_a) {
147
147
  // Call the original onKeyDown handler for other keys
148
148
  onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
149
149
  }, [onKeyDown]);
150
- return ((0, jsx_runtime_1.jsx)("input", Object.assign({}, restProps, { "aria-label": ariaLabel, autoComplete: "off",
150
+ return ((0, jsx_runtime_1.jsx)("input", Object.assign({}, restProps, { id: id, "aria-label": ariaLabel, autoComplete: "off",
151
151
  // biome-ignore lint/a11y/noAutofocus: This is up to developers' decision
152
152
  autoFocus: autoFocus, className: (0, classnames_1.default)(PartialInput_module_scss_1.default.partialInput, className, {
153
153
  [invalidClassName]: isInvalid,
@@ -34,10 +34,6 @@ exports.NumberBoxMd = (0, metadata_helpers_1.createMetadata)({
34
34
  props: {
35
35
  placeholder: (0, metadata_helpers_1.dPlaceholder)(),
36
36
  initialValue: (0, metadata_helpers_1.dInitialValue)(),
37
- label: (0, metadata_helpers_1.dLabel)(),
38
- labelPosition: (0, metadata_helpers_1.dLabelPosition)("top"),
39
- labelWidth: (0, metadata_helpers_1.dLabelWidth)(COMP),
40
- labelBreak: (0, metadata_helpers_1.dLabelBreak)(COMP),
41
37
  maxLength: (0, metadata_helpers_1.dMaxLength)(),
42
38
  autoFocus: (0, metadata_helpers_1.dAutoFocus)(),
43
39
  required: (0, metadata_helpers_1.dRequired)(),
@@ -123,5 +119,5 @@ exports.numberBoxComponentRenderer = (0, renderers_1.createComponentRenderer)(CO
123
119
  extractedInitialValue = extractValue.asOptionalNumber(node.props.initialValue);
124
120
  }
125
121
  catch (_a) { }
126
- return ((0, jsx_runtime_1.jsx)(NumberBoxNative_1.NumberBox, { className: className, value: state === null || state === void 0 ? void 0 : state.value, initialValue: extractedInitialValue, step: extractValue(node.props.step), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, hasSpinBox: extractValue.asOptionalBoolean(node.props.hasSpinBox), integersOnly: extractValue.asOptionalBoolean(node.props.integersOnly), zeroOrPositive: extractValue.asOptionalBoolean(node.props.zeroOrPositive), min: extractValue.asOptionalNumber(node.props.minValue), max: extractValue.asOptionalNumber(node.props.maxValue), startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), gap: extractValue.asOptionalString(node.props.gap), endIcon: extractValue.asOptionalString(node.props.endIcon), spinnerUpIcon: extractValue.asOptionalString(node.props.spinnerUpIcon), spinnerDownIcon: extractValue.asOptionalString(node.props.spinnerDownIcon), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), maxLength: extractValue(node.props.maxLength), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required) }));
122
+ return ((0, jsx_runtime_1.jsx)(NumberBoxNative_1.NumberBox, { className: className, value: state === null || state === void 0 ? void 0 : state.value, initialValue: extractedInitialValue, step: extractValue(node.props.step), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, hasSpinBox: extractValue.asOptionalBoolean(node.props.hasSpinBox), integersOnly: extractValue.asOptionalBoolean(node.props.integersOnly), zeroOrPositive: extractValue.asOptionalBoolean(node.props.zeroOrPositive), min: extractValue.asOptionalNumber(node.props.minValue), max: extractValue.asOptionalNumber(node.props.maxValue), startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), gap: extractValue.asOptionalString(node.props.gap), endIcon: extractValue.asOptionalString(node.props.endIcon), spinnerUpIcon: extractValue.asOptionalString(node.props.spinnerUpIcon), spinnerDownIcon: extractValue.asOptionalString(node.props.spinnerDownIcon), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), maxLength: extractValue(node.props.maxLength), required: extractValue.asOptionalBoolean(node.props.required), direction: extractValue(node.props.direction) }));
127
123
  });
@@ -342,6 +342,11 @@ fixtures_1.test.describe("Event Handling", () => {
342
342
  yield page.getByRole("textbox").focus();
343
343
  yield fixtures_1.expect.poll(testStateDriver.testState).toBe("focused");
344
344
  }));
345
+ (0, fixtures_1.test)("gotFocus event fires on label focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
346
+ const { testStateDriver } = yield initTestBed(`<NumberBox onGotFocus="testState = 'focused'" label="test" />`);
347
+ yield page.getByText("test").click();
348
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe("focused");
349
+ }));
345
350
  (0, fixtures_1.test)("lostFocus event fires on blur", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
346
351
  const { testStateDriver } = yield initTestBed(`<NumberBox onLostFocus="testState = 'blurred'" />`);
347
352
  const input = page.getByRole("textbox");
@@ -441,7 +446,7 @@ fixtures_1.test.describe("Input Adornments", () => {
441
446
  const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
442
447
  const { left: textLeft, right: textRight } = yield (0, component_test_helpers_1.getBounds)(page.getByText("$"));
443
448
  yield (0, fixtures_1.expect)(page.getByTestId("input")).toContainText("$");
444
- (0, fixtures_1.expect)(textRight - compLeft).toBeGreaterThanOrEqual(compRight - textLeft);
449
+ (0, fixtures_1.expect)(textRight - compLeft).toBeLessThanOrEqual(compRight - textLeft);
445
450
  }));
446
451
  (0, fixtures_1.test)("endText displays at end of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
447
452
  yield initTestBed(`<NumberBox testId="input" direction="ltr" endText="USD" />`);
@@ -455,7 +460,7 @@ fixtures_1.test.describe("Input Adornments", () => {
455
460
  const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
456
461
  const { left: textLeft, right: textRight } = yield (0, component_test_helpers_1.getBounds)(page.getByText("USD"));
457
462
  yield (0, fixtures_1.expect)(page.getByTestId("input")).toContainText("USD");
458
- (0, fixtures_1.expect)(textRight - compLeft).toBeLessThanOrEqual(compRight - textLeft);
463
+ (0, fixtures_1.expect)(textRight - compLeft).toBeGreaterThanOrEqual(compRight - textLeft);
459
464
  }));
460
465
  (0, fixtures_1.test)("startIcon displays at beginning of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
461
466
  yield initTestBed(`<NumberBox testId="input" direction="ltr" startIcon="search" />`);
@@ -467,7 +472,7 @@ fixtures_1.test.describe("Input Adornments", () => {
467
472
  yield initTestBed(`<NumberBox testId="input" direction="rtl" startIcon="search" />`);
468
473
  const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
469
474
  const { left: iconLeft, right: iconRight } = yield (0, component_test_helpers_1.getBounds)(page.getByRole("img").first());
470
- (0, fixtures_1.expect)(iconRight - compLeft).toBeGreaterThanOrEqual(compRight - iconLeft);
475
+ (0, fixtures_1.expect)(iconRight - compLeft).toBeLessThanOrEqual(compRight - iconLeft);
471
476
  }));
472
477
  (0, fixtures_1.test)("endIcon displays at end of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
473
478
  yield initTestBed(`<NumberBox testId="input" endIcon="search" />`);
@@ -479,7 +484,7 @@ fixtures_1.test.describe("Input Adornments", () => {
479
484
  yield initTestBed(`<NumberBox testId="input" direction="rtl" endIcon="search" />`);
480
485
  const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
481
486
  const { left: iconLeft, right: iconRight } = yield (0, component_test_helpers_1.getBounds)(page.getByRole("img").first());
482
- (0, fixtures_1.expect)(iconRight - compLeft).toBeLessThanOrEqual(compRight - iconLeft);
487
+ (0, fixtures_1.expect)(iconRight - compLeft).toBeGreaterThanOrEqual(compRight - iconLeft);
483
488
  }));
484
489
  (0, fixtures_1.test)("multiple adornments can be combined", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
485
490
  yield initTestBed(`
@@ -918,3 +923,32 @@ fixtures_1.test.describe("Other Edge Cases", () => {
918
923
  yield (0, fixtures_1.expect)(input).toHaveValue("123.0");
919
924
  }));
920
925
  });
926
+ // =============================================================================
927
+ // VISUAL STATE TESTS
928
+ // =============================================================================
929
+ (0, fixtures_1.test)("input has correct width in px", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
930
+ yield initTestBed(`<NumberBox width="200px" testId="test"/>`, {});
931
+ const input = page.getByTestId("test");
932
+ const { width } = yield input.boundingBox();
933
+ (0, fixtures_1.expect)(width).toBe(200);
934
+ }));
935
+ (0, fixtures_1.test)("input with label has correct width in px", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
936
+ yield initTestBed(`<NumberBox width="200px" label="test" testId="test"/>`, {});
937
+ const input = page.getByTestId("test");
938
+ const { width } = yield input.boundingBox();
939
+ (0, fixtures_1.expect)(width).toBe(200);
940
+ }));
941
+ (0, fixtures_1.test)("input has correct width in %", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
942
+ yield page.setViewportSize({ width: 400, height: 300 });
943
+ yield initTestBed(`<NumberBox width="50%" testId="test"/>`, {});
944
+ const input = page.getByTestId("test");
945
+ const { width } = yield input.boundingBox();
946
+ (0, fixtures_1.expect)(width).toBe(200);
947
+ }));
948
+ (0, fixtures_1.test)("input with label has correct width in %", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
949
+ yield page.setViewportSize({ width: 400, height: 300 });
950
+ yield initTestBed(`<NumberBox width="50%" label="test" testId="test"/>`, {});
951
+ const input = page.getByTestId("test");
952
+ const { width } = yield input.boundingBox();
953
+ (0, fixtures_1.expect)(width).toBe(200);
954
+ }));
@@ -58,7 +58,6 @@ const numberbox_abstractions_1 = require("./numberbox-abstractions");
58
58
  const IconNative_1 = require("../Icon/IconNative");
59
59
  const InputAdornment_1 = require("../Input/InputAdornment");
60
60
  const ButtonNative_1 = require("../Button/ButtonNative");
61
- const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
62
61
  const parts_1 = require("../../components-core/parts");
63
62
  const PART_SPINNER_UP = "spinnerUp";
64
63
  const PART_SPINNER_DOWN = "spinnerDown";
@@ -79,7 +78,7 @@ exports.defaultProps = {
79
78
  };
80
79
  exports.NumberBox = (0, react_1.forwardRef)(function NumberBox(_a, forwardedRef) {
81
80
  var _b;
82
- var { id, value, initialValue, style, className, enabled = exports.defaultProps.enabled, placeholder, validationStatus = exports.defaultProps.validationStatus, hasSpinBox = exports.defaultProps.hasSpinBox, step = exports.defaultProps.step, integersOnly = exports.defaultProps.integersOnly, zeroOrPositive = exports.defaultProps.zeroOrPositive, min = zeroOrPositive ? 0 : exports.defaultProps.min, max = exports.defaultProps.max, maxLength, updateState = exports.defaultProps.updateState, onDidChange = exports.defaultProps.onDidChange, onFocus = exports.defaultProps.onFocus, onBlur = exports.defaultProps.onBlur, registerComponentApi, startText, startIcon, endText, endIcon, gap, spinnerUpIcon, spinnerDownIcon, autoFocus, readOnly, required, label, labelPosition, labelWidth, labelBreak } = _a, rest = __rest(_a, ["id", "value", "initialValue", "style", "className", "enabled", "placeholder", "validationStatus", "hasSpinBox", "step", "integersOnly", "zeroOrPositive", "min", "max", "maxLength", "updateState", "onDidChange", "onFocus", "onBlur", "registerComponentApi", "startText", "startIcon", "endText", "endIcon", "gap", "spinnerUpIcon", "spinnerDownIcon", "autoFocus", "readOnly", "required", "label", "labelPosition", "labelWidth", "labelBreak"]);
81
+ var { id, value, initialValue, style, className, enabled = exports.defaultProps.enabled, placeholder, validationStatus = exports.defaultProps.validationStatus, hasSpinBox = exports.defaultProps.hasSpinBox, step = exports.defaultProps.step, integersOnly = exports.defaultProps.integersOnly, zeroOrPositive = exports.defaultProps.zeroOrPositive, min = zeroOrPositive ? 0 : exports.defaultProps.min, max = exports.defaultProps.max, maxLength, updateState = exports.defaultProps.updateState, onDidChange = exports.defaultProps.onDidChange, onFocus = exports.defaultProps.onFocus, onBlur = exports.defaultProps.onBlur, registerComponentApi, startText, startIcon, endText, endIcon, gap, spinnerUpIcon, spinnerDownIcon, autoFocus, readOnly, required, direction } = _a, rest = __rest(_a, ["id", "value", "initialValue", "style", "className", "enabled", "placeholder", "validationStatus", "hasSpinBox", "step", "integersOnly", "zeroOrPositive", "min", "max", "maxLength", "updateState", "onDidChange", "onFocus", "onBlur", "registerComponentApi", "startText", "startIcon", "endText", "endIcon", "gap", "spinnerUpIcon", "spinnerDownIcon", "autoFocus", "readOnly", "required", "direction"]);
83
82
  const _id = (0, react_1.useId)();
84
83
  id = id || _id;
85
84
  // --- Ensure the provided value is a number or null
@@ -453,21 +452,20 @@ exports.NumberBox = (0, react_1.forwardRef)(function NumberBox(_a, forwardedRef)
453
452
  setValue,
454
453
  });
455
454
  }, [focus, registerComponentApi, setValue]);
456
- return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { id: id, ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, className: className,
457
- // NOTE: This is a band-aid solution to handle the multiple IDs issue - remove after resolving focus bug
458
- isInputTemplateUsed: true, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(NumberBox_module_scss_1.default.inputRoot, {
459
- [NumberBox_module_scss_1.default.readOnly]: readOnly,
460
- [NumberBox_module_scss_1.default.disabled]: !enabled,
461
- [NumberBox_module_scss_1.default.noSpinBox]: !hasSpinBox,
462
- [NumberBox_module_scss_1.default.error]: validationStatus === "error",
463
- [NumberBox_module_scss_1.default.warning]: validationStatus === "warning",
464
- [NumberBox_module_scss_1.default.valid]: validationStatus === "valid",
465
- }), tabIndex: -1, onFocus: () => {
466
- var _a;
467
- (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
468
- }, 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, {
469
- [NumberBox_module_scss_1.default.readOnly]: readOnly,
470
- }), disabled: !enabled, value: valueStrRep, step: step, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onBeforeInput: handleOnBeforeInput, onPaste: handleOnPaste, onKeyDown: handleOnKey, readOnly: readOnly, ref: inputRef, autoFocus: autoFocus, maxLength: maxLength, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { "data-part-id": parts_1.PART_END_ADORNMENT, text: endText, iconName: endIcon, className: (0, classnames_1.default)(NumberBox_module_scss_1.default.adornment) }), hasSpinBox && ((0, jsx_runtime_1.jsxs)("div", { className: NumberBox_module_scss_1.default.spinnerBox, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-part-id": PART_SPINNER_UP, "data-spinner": "up", type: "button", role: "spinbutton", variant: "ghost", themeColor: "secondary", tabIndex: -1, className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: upButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: spinnerUpIcon || "spinnerUp:NumberBox", fallback: "chevronup", size: "sm" }) }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-part-id": PART_SPINNER_DOWN, "data-spinner": "down", type: "button", role: "spinbutton", tabIndex: -1, variant: "ghost", themeColor: "secondary", className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: downButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: spinnerDownIcon || "spinnerDown:NumberBox", fallback: "chevrondown", size: "sm" }) })] }))] }) })));
455
+ return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, rest, { className: (0, classnames_1.default)(className, NumberBox_module_scss_1.default.inputRoot, {
456
+ [NumberBox_module_scss_1.default.readOnly]: readOnly,
457
+ [NumberBox_module_scss_1.default.disabled]: !enabled,
458
+ [NumberBox_module_scss_1.default.noSpinBox]: !hasSpinBox,
459
+ [NumberBox_module_scss_1.default.error]: validationStatus === "error",
460
+ [NumberBox_module_scss_1.default.warning]: validationStatus === "warning",
461
+ [NumberBox_module_scss_1.default.valid]: validationStatus === "valid",
462
+ [NumberBox_module_scss_1.default.rtl]: direction === "rtl",
463
+ }), id: id, ref: forwardedRef, tabIndex: -1, onFocus: () => {
464
+ var _a;
465
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
466
+ }, style: Object.assign(Object.assign({}, 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, {
467
+ [NumberBox_module_scss_1.default.readOnly]: readOnly,
468
+ }), disabled: !enabled, value: valueStrRep, step: step, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onBeforeInput: handleOnBeforeInput, onPaste: handleOnPaste, onKeyDown: handleOnKey, readOnly: readOnly, ref: inputRef, autoFocus: autoFocus, maxLength: maxLength, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { "data-part-id": parts_1.PART_END_ADORNMENT, text: endText, iconName: endIcon, className: (0, classnames_1.default)(NumberBox_module_scss_1.default.adornment) }), hasSpinBox && ((0, jsx_runtime_1.jsxs)("div", { className: NumberBox_module_scss_1.default.spinnerBox, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-part-id": PART_SPINNER_UP, "data-spinner": "up", type: "button", role: "spinbutton", variant: "ghost", themeColor: "secondary", tabIndex: -1, className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: upButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: spinnerUpIcon || "spinnerUp:NumberBox", fallback: "chevronup", size: "sm" }) }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-part-id": PART_SPINNER_DOWN, "data-spinner": "down", type: "button", role: "spinbutton", tabIndex: -1, variant: "ghost", themeColor: "secondary", className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: downButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: spinnerDownIcon || "spinnerDown:NumberBox", fallback: "chevrondown", size: "sm" }) })] }))] })));
471
469
  });
472
470
  function applyStep(valueStrRep, step, min, max, integersOnly) {
473
471
  const currentValue = (0, numberbox_abstractions_1.toUsableNumber)(valueStrRep, integersOnly);
@@ -31,10 +31,6 @@ exports.RadioGroupMd = (0, metadata_helpers_1.createMetadata)({
31
31
  validationStatus: Object.assign(Object.assign({}, (0, metadata_helpers_1.dValidationStatus)()), { defaultValue: RadioGroupNative_1.defaultProps.validationStatus }),
32
32
  orientation: (0, metadata_helpers_1.dInternal)(`(*** NOT IMPLEMENTED YET ***) This property sets the orientation of the ` +
33
33
  `options within the radio group.`),
34
- label: (0, metadata_helpers_1.dLabel)(),
35
- labelPosition: (0, metadata_helpers_1.dLabelPosition)("top"),
36
- labelWidth: (0, metadata_helpers_1.dLabelWidth)(COMP),
37
- labelBreak: (0, metadata_helpers_1.dLabelBreak)(COMP),
38
34
  },
39
35
  events: {
40
36
  gotFocus: (0, metadata_helpers_1.dGotFocus)(COMP),
@@ -61,5 +57,5 @@ exports.RadioGroupMd = (0, metadata_helpers_1.createMetadata)({
61
57
  },
62
58
  });
63
59
  exports.radioGroupRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.RadioGroupMd, ({ node, extractValue, className, state, updateState, lookupEventHandler, renderChild, registerComponentApi, }) => {
64
- return ((0, jsx_runtime_1.jsx)(RadioGroupNative_1.RadioGroup, { autofocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), className: className, initialValue: extractValue(node.props.initialValue), value: state === null || state === void 0 ? void 0 : state.value, updateState: updateState, validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, label: extractValue.asOptionalString(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), children: renderChild(node.children) }));
60
+ return ((0, jsx_runtime_1.jsx)(RadioGroupNative_1.RadioGroup, { autofocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), className: className, initialValue: extractValue(node.props.initialValue), value: state === null || state === void 0 ? void 0 : state.value, updateState: updateState, validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, required: extractValue.asOptionalBoolean(node.props.required), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), children: renderChild(node.children) }));
65
61
  });
@@ -293,6 +293,15 @@ fixtures_1.test.describe("Basic Functionality", () => {
293
293
  yield options.nth(0).focus();
294
294
  yield fixtures_1.expect.poll(testStateDriver.testState).toBe("focused");
295
295
  }));
296
+ (0, fixtures_1.test)("gotFocus event fires on label focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
297
+ const { testStateDriver } = yield initTestBed(`
298
+ <RadioGroup initialValue="1" onGotFocus="() => testState = 'focused'" label="test">
299
+ <Option value="1">Option 1</Option>
300
+ </RadioGroup>
301
+ `);
302
+ yield page.getByText("test").click();
303
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe("focused");
304
+ }));
296
305
  (0, fixtures_1.test)("lostFocus event fires on blurring the field", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
297
306
  const { testStateDriver } = yield initTestBed(`
298
307
  <RadioGroup initialValue="1" onLostFocus="() => testState = 'blurred'">
@@ -55,7 +55,6 @@ const classnames_1 = __importDefault(require("classnames"));
55
55
  const RadioGroup_module_scss_1 = __importDefault(require("./RadioGroup.module.scss"));
56
56
  const constants_1 = require("../../components-core/constants");
57
57
  const misc_1 = require("../../components-core/utils/misc");
58
- const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
59
58
  const OptionTypeProvider_1 = __importDefault(require("../Option/OptionTypeProvider"));
60
59
  const RadioItemNative_1 = require("./RadioItemNative");
61
60
  const OptionNative_1 = require("../Option/OptionNative");
@@ -136,10 +135,10 @@ exports.RadioGroup = (0, react_1.forwardRef)(function RadioGroup(_a, forwardedRe
136
135
  const contextValue = (0, react_1.useMemo)(() => {
137
136
  return { value, setValue: updateValue, status: validationStatus, enabled };
138
137
  }, [value, updateValue, validationStatus, enabled]);
139
- return ((0, jsx_runtime_1.jsx)(OptionTypeProvider_1.default, { Component: exports.RadioGroupOption, children: (0, jsx_runtime_1.jsx)(RadioGroupStatusContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, className: className, onLabelClick: focusActiveOption, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Root, { ref: radioGroupRef, id: id, onBlur: handleOnBlur, onFocus: handleOnFocus, onValueChange: onInputChange, value: value, disabled: !enabled, required: required, "aria-readonly": readOnly, className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioGroupContainer, {
140
- [RadioGroup_module_scss_1.default.focused]: focused,
141
- [RadioGroup_module_scss_1.default.disabled]: !enabled,
142
- }), children: children }) })) }) }));
138
+ return ((0, jsx_runtime_1.jsx)(OptionTypeProvider_1.default, { Component: exports.RadioGroupOption, children: (0, jsx_runtime_1.jsx)(RadioGroupStatusContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Root, Object.assign({}, rest, { style: style, ref: radioGroupRef, id: id, onBlur: handleOnBlur, onFocus: handleOnFocus, onValueChange: onInputChange, value: value, disabled: !enabled, required: required, "aria-readonly": readOnly, className: (0, classnames_1.default)(className, RadioGroup_module_scss_1.default.radioGroupContainer, {
139
+ [RadioGroup_module_scss_1.default.focused]: focused,
140
+ [RadioGroup_module_scss_1.default.disabled]: !enabled,
141
+ }), children: children })) }) }));
143
142
  });
144
143
  const RadioGroupOption = ({ value, label, enabled = true, optionRenderer, style, className, }) => {
145
144
  const id = (0, react_1.useId)();
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.radioItemComponentRenderer = exports.RadioItemMd = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const renderers_1 = require("../../components-core/renderers");
6
+ const metadata_helpers_1 = require("../metadata-helpers");
7
+ const RadioItemNative_1 = require("./RadioItemNative");
8
+ const COMP = "RadioItem";
9
+ exports.RadioItemMd = (0, metadata_helpers_1.createMetadata)({
10
+ status: "experimental",
11
+ description: `The \`${COMP}\` component is a radio button that is part of a group of radio buttons.`,
12
+ props: {
13
+ checked: {
14
+ description: "This property specifies whether the radio button is checked.",
15
+ defaultValue: RadioItemNative_1.defaultProps.checked,
16
+ },
17
+ value: {
18
+ description: "This property specifies the value of the radio button.",
19
+ defaultValue: RadioItemNative_1.defaultProps.value,
20
+ },
21
+ },
22
+ events: {
23
+ didChange: (0, metadata_helpers_1.dDidChange)(COMP),
24
+ },
25
+ });
26
+ exports.radioItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.RadioItemMd, ({ node, extractValue, lookupEventHandler }) => {
27
+ return ((0, jsx_runtime_1.jsx)(RadioItemNative_1.RadioItem, { checked: extractValue(node.props.checked), value: extractValue(node.props.value), onDidChange: lookupEventHandler("didChange") }));
28
+ });
@@ -31,10 +31,6 @@ exports.SelectMd = (0, metadata_helpers_1.createMetadata)({
31
31
  readOnly: Object.assign(Object.assign({}, (0, metadata_helpers_1.dReadonly)()), { defaultValue: SelectNative_1.defaultProps.readOnly }),
32
32
  enabled: Object.assign(Object.assign({}, (0, metadata_helpers_1.dEnabled)()), { defaultValue: SelectNative_1.defaultProps.enabled }),
33
33
  validationStatus: Object.assign(Object.assign({}, (0, metadata_helpers_1.dValidationStatus)()), { defaultValue: SelectNative_1.defaultProps.validationStatus }),
34
- label: (0, metadata_helpers_1.dLabel)(),
35
- labelPosition: (0, metadata_helpers_1.dLabelPosition)("top"),
36
- labelWidth: (0, metadata_helpers_1.dLabelWidth)(COMP),
37
- labelBreak: Object.assign(Object.assign({}, (0, metadata_helpers_1.dLabelBreak)(COMP)), { defaultValue: SelectNative_1.defaultProps.labelBreak }),
38
34
  optionLabelTemplate: (0, metadata_helpers_1.dComponent)(`This property allows replacing the default template to display an option in the dropdown list.`),
39
35
  optionTemplate: (0, metadata_helpers_1.dComponent)(`This property allows replacing the default template to display an option in the dropdown list.`),
40
36
  valueTemplate: (0, metadata_helpers_1.dComponent)(`This property allows replacing the default template to display a selected value when ` +
@@ -119,7 +115,7 @@ exports.selectComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP,
119
115
  const multiSelect = extractValue.asOptionalBoolean(node.props.multiSelect);
120
116
  const searchable = extractValue.asOptionalBoolean(node.props.searchable);
121
117
  const isControlled = node.props.value !== undefined;
122
- return ((0, jsx_runtime_1.jsx)(SelectNative_1.Select, { multiSelect: multiSelect, className: className, inProgress: extractValue.asOptionalBoolean(node.props.inProgress), inProgressNotificationMessage: extractValue.asOptionalString(node.props.inProgressNotificationMessage), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), updateState: isControlled ? undefined : updateState, searchable: searchable, initialValue: extractValue(node.props.initialValue), value: isControlled ? extractValue(node.props.value) : state === null || state === void 0 ? void 0 : state.value, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, emptyListTemplate: renderChild(node.props.emptyListTemplate), dropdownHeight: extractValue(node.props.dropdownHeight), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), valueRenderer: node.props.valueTemplate
118
+ return ((0, jsx_runtime_1.jsx)(SelectNative_1.Select, { multiSelect: multiSelect, className: className, inProgress: extractValue.asOptionalBoolean(node.props.inProgress), inProgressNotificationMessage: extractValue.asOptionalString(node.props.inProgressNotificationMessage), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), updateState: isControlled ? undefined : updateState, searchable: searchable, initialValue: extractValue(node.props.initialValue), value: isControlled ? extractValue(node.props.value) : state === null || state === void 0 ? void 0 : state.value, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, emptyListTemplate: renderChild(node.props.emptyListTemplate), dropdownHeight: extractValue(node.props.dropdownHeight), required: extractValue.asOptionalBoolean(node.props.required), valueRenderer: node.props.valueTemplate
123
119
  ? (item, removeItem) => {
124
120
  return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { contextVars: {
125
121
  $itemContext: { removeItem },