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
@@ -65,7 +65,6 @@ const IconNative_1 = __importDefault(require("../Icon/IconNative"));
65
65
  const SelectContext_1 = require("./SelectContext");
66
66
  const OptionTypeProvider_1 = __importDefault(require("../Option/OptionTypeProvider"));
67
67
  const OptionContext_1 = require("./OptionContext");
68
- const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
69
68
  const HiddenOption_1 = require("./HiddenOption");
70
69
  const FormContext_1 = require("../Form/FormContext");
71
70
  exports.defaultProps = {
@@ -84,9 +83,8 @@ exports.defaultProps = {
84
83
  const SimpleSelect = (0, react_2.forwardRef)(function SimpleSelect(props, forwardedRef) {
85
84
  const { root } = (0, ThemeContext_1.useTheme)();
86
85
  const { enabled, onBlur, autoFocus, onValueChange, validationStatus, value, height, style, placeholder, id, triggerRef, onFocus, width, children, readOnly, emptyListNode, className } = props, rest = __rest(props, ["enabled", "onBlur", "autoFocus", "onValueChange", "validationStatus", "value", "height", "style", "placeholder", "id", "triggerRef", "onFocus", "width", "children", "readOnly", "emptyListNode", "className"]);
87
- // Compose refs for proper forwarding
88
- const ref = forwardedRef ? (0, react_compose_refs_1.composeRefs)(triggerRef, forwardedRef) : triggerRef;
89
86
  const { options } = (0, SelectContext_1.useSelect)();
87
+ const composedRef = react_2.forwardRef ? (0, react_compose_refs_1.composeRefs)(triggerRef, forwardedRef) : triggerRef;
90
88
  // Convert value to string for Radix UI compatibility
91
89
  const stringValue = (0, react_2.useMemo)(() => {
92
90
  return value != undefined ? String(value) : undefined;
@@ -101,7 +99,7 @@ const SimpleSelect = (0, react_2.forwardRef)(function SimpleSelect(props, forwar
101
99
  const selectedOption = (0, react_2.useMemo)(() => {
102
100
  return optionsArray.find((option) => String(option.value) === String(value));
103
101
  }, [optionsArray, value]);
104
- return ((0, jsx_runtime_1.jsxs)(react_select_1.Root, { value: stringValue, onValueChange: handleValueChange, children: [(0, jsx_runtime_1.jsxs)(react_select_1.Trigger, Object.assign({}, rest, { id: id, "aria-haspopup": "listbox", style: style, onFocus: onFocus, onBlur: onBlur, disabled: !enabled, className: (0, classnames_1.default)(className, Select_module_scss_1.default.selectTrigger, {
102
+ return ((0, jsx_runtime_1.jsxs)(react_select_1.Root, { value: stringValue, onValueChange: handleValueChange, children: [(0, jsx_runtime_1.jsxs)(react_select_1.Trigger, Object.assign({}, rest, { id: id, ref: composedRef, "aria-haspopup": "listbox", style: style, onFocus: onFocus, onBlur: onBlur, disabled: !enabled, className: (0, classnames_1.default)(className, Select_module_scss_1.default.selectTrigger, {
105
103
  [Select_module_scss_1.default.error]: validationStatus === "error",
106
104
  [Select_module_scss_1.default.warning]: validationStatus === "warning",
107
105
  [Select_module_scss_1.default.valid]: validationStatus === "valid",
@@ -109,12 +107,12 @@ const SimpleSelect = (0, react_2.forwardRef)(function SimpleSelect(props, forwar
109
107
  // Prevent event propagation to parent elements (e.g., DropdownMenu)
110
108
  // This ensures that clicking the Select trigger doesn't close the containing DropdownMenu
111
109
  event.stopPropagation();
112
- }, ref: ref, autoFocus: autoFocus, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Select_module_scss_1.default.selectValue, {
110
+ }, autoFocus: autoFocus, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Select_module_scss_1.default.selectValue, {
113
111
  [Select_module_scss_1.default.selectValue]: value !== undefined,
114
112
  [Select_module_scss_1.default.placeholder]: value === undefined,
115
113
  }), children: selectedOption ? selectedOption.label : readOnly ? "" : placeholder }), (0, jsx_runtime_1.jsx)(react_select_1.Icon, { asChild: true, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" }) })] })), (0, jsx_runtime_1.jsx)(react_select_1.Portal, { container: root, children: (0, jsx_runtime_1.jsxs)(react_select_1.Content, { className: Select_module_scss_1.default.selectContent, position: "popper", style: { maxHeight: height, minWidth: width }, children: [(0, jsx_runtime_1.jsx)(react_select_1.ScrollUpButton, { className: Select_module_scss_1.default.selectScrollUpButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevronup" }) }), (0, jsx_runtime_1.jsxs)(react_select_1.SelectViewport, { className: Select_module_scss_1.default.selectViewport, role: "listbox", children: [children, optionsArray.length === 0 && emptyListNode] }), (0, jsx_runtime_1.jsx)(react_select_1.ScrollDownButton, { className: Select_module_scss_1.default.selectScrollDownButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" }) })] }) })] }));
116
114
  });
117
- exports.Select = (0, react_2.forwardRef)(function Select(_a, ref) {
115
+ exports.Select = (0, react_2.forwardRef)(function Select(_a, forwardedRef) {
118
116
  var _b;
119
117
  var {
120
118
  // Basic props
@@ -129,18 +127,14 @@ exports.Select = (0, react_2.forwardRef)(function Select(_a, ref) {
129
127
  searchable = exports.defaultProps.searchable, multiSelect = exports.defaultProps.multiSelect, emptyListTemplate, valueRenderer, optionRenderer,
130
128
  // Progress state
131
129
  inProgress = exports.defaultProps.inProgress, inProgressNotificationMessage = exports.defaultProps.inProgressNotificationMessage,
132
- // Label configuration
133
- label, labelPosition, labelWidth, labelBreak = exports.defaultProps.labelBreak,
134
130
  // Internal
135
- updateState = constants_1.noop, registerComponentApi, children } = _a, rest = __rest(_a, ["id", "initialValue", "value", "enabled", "placeholder", "autoFocus", "readOnly", "required", "style", "className", "dropdownHeight", "validationStatus", "onDidChange", "onFocus", "onBlur", "searchable", "multiSelect", "emptyListTemplate", "valueRenderer", "optionRenderer", "inProgress", "inProgressNotificationMessage", "label", "labelPosition", "labelWidth", "labelBreak", "updateState", "registerComponentApi", "children"]);
131
+ updateState = constants_1.noop, registerComponentApi, children } = _a, rest = __rest(_a, ["id", "initialValue", "value", "enabled", "placeholder", "autoFocus", "readOnly", "required", "style", "className", "dropdownHeight", "validationStatus", "onDidChange", "onFocus", "onBlur", "searchable", "multiSelect", "emptyListTemplate", "valueRenderer", "optionRenderer", "inProgress", "inProgressNotificationMessage", "updateState", "registerComponentApi", "children"]);
136
132
  const [referenceElement, setReferenceElement] = (0, react_2.useState)(null);
137
133
  const [open, setOpen] = (0, react_2.useState)(false);
138
134
  const [width, setWidth] = (0, react_2.useState)(0);
139
135
  const observer = (0, react_2.useRef)();
140
136
  const { root } = (0, ThemeContext_1.useTheme)();
141
137
  const [options, setOptions] = (0, react_2.useState)(new Set());
142
- const generatedId = (0, react_2.useId)();
143
- const inputId = id || generatedId;
144
138
  const isInForm = (0, FormContext_1.useIsInsideForm)();
145
139
  // Set initial state based on the initialValue prop
146
140
  (0, react_2.useEffect)(() => {
@@ -232,26 +226,26 @@ exports.Select = (0, react_2.forwardRef)(function Select(_a, ref) {
232
226
  options,
233
227
  optionRenderer,
234
228
  }), [multiSelect, toggleOption, value, options]);
235
- return ((0, jsx_runtime_1.jsx)(SelectContext_1.SelectContext.Provider, { value: selectContextValue, children: (0, jsx_runtime_1.jsx)(OptionContext_1.OptionContext.Provider, { value: optionContextValue, children: searchable || multiSelect ? ((0, jsx_runtime_1.jsxs)(OptionTypeProvider_1.default, { Component: HiddenOption_1.HiddenOption, children: [(0, jsx_runtime_1.jsxs)(react_popover_1.Popover, { open: open, onOpenChange: setOpen, modal: false, children: [(0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { ref: ref, id: inputId, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, className: className, style: style, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverTrigger, Object.assign({}, rest, { id: inputId, "aria-haspopup": "listbox", style: style, ref: setReferenceElement, onFocus: onFocus, onBlur: onBlur, disabled: !enabled, "aria-expanded": open, onClick: (event) => {
236
- // Prevent event propagation to parent elements (e.g., DropdownMenu)
237
- // This ensures that clicking the Select trigger doesn't close the containing DropdownMenu
238
- event.stopPropagation();
239
- setOpen((prev) => !prev);
240
- }, className: (0, classnames_1.default)(Select_module_scss_1.default.selectTrigger, Select_module_scss_1.default[validationStatus], {
241
- [Select_module_scss_1.default.disabled]: !enabled,
242
- [Select_module_scss_1.default.multi]: multiSelect,
243
- }, className), autoFocus: autoFocus, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [multiSelect ? (Array.isArray(value) && value.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.badgeListContainer, children: (0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.badgeList, children: value.map((v) => {
244
- var _a;
245
- return valueRenderer ? (valueRenderer(Array.from(options).find((o) => o.value === `${v}`), () => {
246
- toggleOption(v);
247
- })) : ((0, jsx_runtime_1.jsxs)("span", { className: Select_module_scss_1.default.badge, children: [(_a = Array.from(options).find((o) => o.value === `${v}`)) === null || _a === void 0 ? void 0 : _a.label, (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "close", size: "sm", onClick: (event) => {
248
- event.stopPropagation();
249
- toggleOption(v);
250
- } })] }, v));
251
- }) }) })) : ((0, jsx_runtime_1.jsx)("span", { placeholder: placeholder, className: Select_module_scss_1.default.placeholder, children: placeholder }))) : value !== undefined && value !== null ? ((0, jsx_runtime_1.jsx)("div", { children: (_b = Array.from(options).find((o) => o.value === value)) === null || _b === void 0 ? void 0 : _b.label })) : ((0, jsx_runtime_1.jsx)("span", { "aria-placeholder": placeholder, className: Select_module_scss_1.default.placeholder, children: placeholder || "" })), (0, jsx_runtime_1.jsxs)("div", { className: Select_module_scss_1.default.actions, children: [multiSelect && Array.isArray(value) && value.length > 0 && ((0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "close", onClick: (event) => {
252
- event.stopPropagation();
253
- clearValue();
254
- } })), (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" })] })] }) })) })), open && ((0, jsx_runtime_1.jsx)(react_popover_1.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(react_focus_scope_1.FocusScope, { asChild: true, loop: true, trapped: true, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverContent, { style: { minWidth: width, height: dropdownHeight }, className: Select_module_scss_1.default.selectContent, children: (0, jsx_runtime_1.jsxs)(cmdk_1.Command, { className: Select_module_scss_1.default.command, shouldFilter: searchable, filter: (_, search, keywords) => {
229
+ return ((0, jsx_runtime_1.jsx)(SelectContext_1.SelectContext.Provider, { value: selectContextValue, children: (0, jsx_runtime_1.jsx)(OptionContext_1.OptionContext.Provider, { value: optionContextValue, children: searchable || multiSelect ? ((0, jsx_runtime_1.jsxs)(OptionTypeProvider_1.default, { Component: HiddenOption_1.HiddenOption, children: [(0, jsx_runtime_1.jsxs)(react_popover_1.Popover, { open: open, onOpenChange: setOpen, modal: false, children: [(0, jsx_runtime_1.jsx)(react_popover_1.PopoverTrigger, Object.assign({}, rest, { ref: (0, react_compose_refs_1.composeRefs)(setReferenceElement, forwardedRef), id: id, "aria-haspopup": "listbox", style: style, onFocus: onFocus, onBlur: onBlur, disabled: !enabled, "aria-expanded": open, onClick: (event) => {
230
+ // Prevent event propagation to parent elements (e.g., DropdownMenu)
231
+ // This ensures that clicking the Select trigger doesn't close the containing DropdownMenu
232
+ event.stopPropagation();
233
+ setOpen((prev) => !prev);
234
+ }, className: (0, classnames_1.default)(Select_module_scss_1.default.selectTrigger, Select_module_scss_1.default[validationStatus], {
235
+ [Select_module_scss_1.default.disabled]: !enabled,
236
+ [Select_module_scss_1.default.multi]: multiSelect,
237
+ }, className), autoFocus: autoFocus, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [multiSelect ? (Array.isArray(value) && value.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.badgeListContainer, children: (0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.badgeList, children: value.map((v) => {
238
+ var _a;
239
+ return valueRenderer ? (valueRenderer(Array.from(options).find((o) => o.value === `${v}`), () => {
240
+ toggleOption(v);
241
+ })) : ((0, jsx_runtime_1.jsxs)("span", { className: Select_module_scss_1.default.badge, children: [(_a = Array.from(options).find((o) => o.value === `${v}`)) === null || _a === void 0 ? void 0 : _a.label, (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "close", size: "sm", onClick: (event) => {
242
+ event.stopPropagation();
243
+ toggleOption(v);
244
+ } })] }, v));
245
+ }) }) })) : ((0, jsx_runtime_1.jsx)("span", { placeholder: placeholder, className: Select_module_scss_1.default.placeholder, children: placeholder }))) : value !== undefined && value !== null ? ((0, jsx_runtime_1.jsx)("div", { children: (_b = Array.from(options).find((o) => o.value === value)) === null || _b === void 0 ? void 0 : _b.label })) : ((0, jsx_runtime_1.jsx)("span", { "aria-placeholder": placeholder, className: Select_module_scss_1.default.placeholder, children: placeholder || "" })), (0, jsx_runtime_1.jsxs)("div", { className: Select_module_scss_1.default.actions, children: [multiSelect && Array.isArray(value) && value.length > 0 && ((0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "close", onClick: (event) => {
246
+ event.stopPropagation();
247
+ clearValue();
248
+ } })), (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" })] })] }) })), open && ((0, jsx_runtime_1.jsx)(react_popover_1.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(react_focus_scope_1.FocusScope, { asChild: true, loop: true, trapped: true, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverContent, { style: { minWidth: width, height: dropdownHeight }, className: Select_module_scss_1.default.selectContent, children: (0, jsx_runtime_1.jsxs)(cmdk_1.Command, { className: Select_module_scss_1.default.command, shouldFilter: searchable, filter: (_, search, keywords) => {
255
249
  const lowSearch = search.toLowerCase();
256
250
  for (const kw of keywords) {
257
251
  if (kw.toLowerCase().includes(lowSearch))
@@ -260,7 +254,7 @@ exports.Select = (0, react_2.forwardRef)(function Select(_a, ref) {
260
254
  return 0;
261
255
  }, children: [searchable ? ((0, jsx_runtime_1.jsxs)("div", { className: Select_module_scss_1.default.commandInputContainer, children: [(0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "search" }), (0, jsx_runtime_1.jsx)(cmdk_1.CommandInput, { className: (0, classnames_1.default)(Select_module_scss_1.default.commandInput), placeholder: "Search..." })] })) : (
262
256
  // https://github.com/pacocoursey/cmdk/issues/322#issuecomment-2444703817
263
- (0, jsx_runtime_1.jsx)("button", { autoFocus: true, "aria-hidden": "true", className: Select_module_scss_1.default.srOnly })), (0, jsx_runtime_1.jsxs)(cmdk_1.CommandList, { className: Select_module_scss_1.default.commandList, children: [inProgress && ((0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.loading, children: inProgressNotificationMessage })), Array.from(options).map(({ value, label, enabled, keywords }) => ((0, jsx_runtime_1.jsx)(exports.ComboboxOption, { readOnly: readOnly, value: value, label: label, enabled: enabled, keywords: keywords }, value))), !inProgress && (0, jsx_runtime_1.jsx)(cmdk_1.CommandEmpty, { children: emptyListNode })] })] }) }) }) }))] }), children] })) : ((0, jsx_runtime_1.jsx)(OptionTypeProvider_1.default, { Component: SelectOption, children: (0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { ref: ref, id: inputId, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, className: className, style: style, children: (0, react_1.createElement)(SimpleSelect, Object.assign({}, rest, { readOnly: !!readOnly, ref: ref, key: isInForm ? (value ? `status-${value}` : "status-initial") : undefined, value: value, onValueChange: toggleOption, id: inputId, style: style, className: className, onFocus: onFocus, onBlur: onBlur, enabled: enabled, validationStatus: validationStatus, triggerRef: setReferenceElement, autoFocus: autoFocus, placeholder: placeholder, height: dropdownHeight, width: width, emptyListNode: emptyListNode }), children) })) })) }) }));
257
+ (0, jsx_runtime_1.jsx)("button", { autoFocus: true, "aria-hidden": "true", className: Select_module_scss_1.default.srOnly })), (0, jsx_runtime_1.jsxs)(cmdk_1.CommandList, { className: Select_module_scss_1.default.commandList, children: [inProgress && ((0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.loading, children: inProgressNotificationMessage })), Array.from(options).map(({ value, label, enabled, keywords }) => ((0, jsx_runtime_1.jsx)(exports.ComboboxOption, { readOnly: readOnly, value: value, label: label, enabled: enabled, keywords: keywords }, value))), !inProgress && (0, jsx_runtime_1.jsx)(cmdk_1.CommandEmpty, { children: emptyListNode })] })] }) }) }) }))] }), children] })) : ((0, jsx_runtime_1.jsx)(OptionTypeProvider_1.default, { Component: SelectOption, children: (0, react_1.createElement)(SimpleSelect, Object.assign({}, rest, { readOnly: !!readOnly, ref: forwardedRef, key: isInForm ? (value ? `status-${value}` : "status-initial") : undefined, value: value, onValueChange: toggleOption, id: id, style: style, className: className, onFocus: onFocus, onBlur: onBlur, enabled: enabled, validationStatus: validationStatus, triggerRef: setReferenceElement, autoFocus: autoFocus, placeholder: placeholder, height: dropdownHeight, width: width, emptyListNode: emptyListNode }), children) })) }) }));
264
258
  });
265
259
  exports.ComboboxOption = (0, react_2.forwardRef)(function Combobox(option, forwardedRef) {
266
260
  const id = (0, react_2.useId)();
@@ -21,10 +21,6 @@ exports.SliderMd = (0, metadata_helpers_1.createMetadata)({
21
21
  "Hover over the component to see the tooltip with the current value. On mobile, tap the thumb to see the tooltip.",
22
22
  props: {
23
23
  initialValue: (0, metadata_helpers_1.dInitialValue)(),
24
- label: (0, metadata_helpers_1.dLabel)(),
25
- labelPosition: (0, metadata_helpers_1.dLabelPosition)("top"),
26
- labelWidth: (0, metadata_helpers_1.dLabelWidth)(COMP),
27
- labelBreak: (0, metadata_helpers_1.dLabelBreak)(COMP),
28
24
  minValue: {
29
25
  description: `This property specifies the minimum value of the allowed input range.`,
30
26
  valueType: "number",
@@ -115,5 +111,5 @@ exports.SliderMd = (0, metadata_helpers_1.createMetadata)({
115
111
  });
116
112
  exports.sliderComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.SliderMd, ({ node, extractValue, lookupEventHandler, lookupSyncCallback, className, updateState, state, registerComponentApi, }) => {
117
113
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
118
- return ((0, jsx_runtime_1.jsx)(SliderNative_1.Slider, { validationStatus: extractValue(node.props.validationStatus), minStepsBetweenThumbs: extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.minStepsBetweenThumbs), value: state.value, initialValue: extractValue(node.props.initialValue), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, className: className, step: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.step), min: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.minValue), max: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.maxValue), enabled: extractValue.asOptionalBoolean((_e = node.props) === null || _e === void 0 ? void 0 : _e.enabled), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), label: extractValue.asOptionalString(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue.asOptionalString(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), rangeStyle: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.rangeStyle), thumbStyle: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.thumbStyle), showValues: extractValue.asOptionalBoolean((_h = node.props) === null || _h === void 0 ? void 0 : _h.showValues), valueFormat: lookupSyncCallback((_j = node.props) === null || _j === void 0 ? void 0 : _j.valueFormat) }));
114
+ return ((0, jsx_runtime_1.jsx)(SliderNative_1.Slider, { validationStatus: extractValue(node.props.validationStatus), minStepsBetweenThumbs: extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.minStepsBetweenThumbs), value: state.value, initialValue: extractValue(node.props.initialValue), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, className: className, step: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.step), min: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.minValue), max: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.maxValue), enabled: extractValue.asOptionalBoolean((_e = node.props) === null || _e === void 0 ? void 0 : _e.enabled), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), required: extractValue.asOptionalBoolean(node.props.required), rangeStyle: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.rangeStyle), thumbStyle: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.thumbStyle), showValues: extractValue.asOptionalBoolean((_h = node.props) === null || _h === void 0 ? void 0 : _h.showValues), valueFormat: lookupSyncCallback((_j = node.props) === null || _j === void 0 ? void 0 : _j.valueFormat) }));
119
115
  });
@@ -355,6 +355,13 @@ fixtures_1.test.describe("Event Handling", () => {
355
355
  yield page.getByRole("slider").focus();
356
356
  yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
357
357
  }));
358
+ (0, fixtures_1.test)("gotFocus event fires on label click", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
359
+ const { testStateDriver } = yield initTestBed(`
360
+ <Slider label="Volume" onGotFocus="testState = 'focused'" />
361
+ `);
362
+ yield page.getByText("Volume").click();
363
+ yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
364
+ }));
358
365
  (0, fixtures_1.test)("lostFocus event fires on blur", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
359
366
  const { testStateDriver } = yield initTestBed(`
360
367
  <Slider onLostFocus="testState = 'blurred'" />
@@ -605,3 +612,32 @@ fixtures_1.test.describe("Edge Cases", () => {
605
612
  yield (0, fixtures_1.expect)(sliders).toHaveCount(2);
606
613
  }));
607
614
  });
615
+ // =============================================================================
616
+ // VISUAL STATE TESTS
617
+ // =============================================================================
618
+ (0, fixtures_1.test)("input has correct width in px", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
619
+ yield initTestBed(`<Slider width="200px" testId="test"/>`, {});
620
+ const input = page.getByTestId("test");
621
+ const { width } = yield input.boundingBox();
622
+ (0, fixtures_1.expect)(width).toBe(200);
623
+ }));
624
+ (0, fixtures_1.test)("input with label has correct width in px", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
625
+ yield initTestBed(`<Slider width="200px" label="test" testId="test"/>`, {});
626
+ const input = page.getByTestId("test");
627
+ const { width } = yield input.boundingBox();
628
+ (0, fixtures_1.expect)(width).toBe(200);
629
+ }));
630
+ (0, fixtures_1.test)("input has correct width in %", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
631
+ yield page.setViewportSize({ width: 400, height: 300 });
632
+ yield initTestBed(`<Slider width="50%" testId="test"/>`, {});
633
+ const input = page.getByTestId("test");
634
+ const { width } = yield input.boundingBox();
635
+ (0, fixtures_1.expect)(width).toBe(200);
636
+ }));
637
+ (0, fixtures_1.test)("input with label has correct width in %", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
638
+ yield page.setViewportSize({ width: 400, height: 300 });
639
+ yield initTestBed(`<Slider width="50%" label="test" testId="test"/>`, {});
640
+ const input = page.getByTestId("test");
641
+ const { width } = yield input.boundingBox();
642
+ (0, fixtures_1.expect)(width).toBe(200);
643
+ }));
@@ -55,10 +55,10 @@ const react_slider_1 = require("@radix-ui/react-slider");
55
55
  const Slider_module_scss_1 = __importDefault(require("./Slider.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 classnames_1 = __importDefault(require("classnames"));
60
59
  const TooltipNative_1 = require("../Tooltip/TooltipNative");
61
60
  const lodash_es_1 = require("lodash-es");
61
+ const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
62
62
  exports.defaultProps = {
63
63
  step: 1,
64
64
  min: 0,
@@ -103,10 +103,9 @@ const formatValue = (val, defaultVal = 0, minVal, maxVal) => {
103
103
  return [clampValue(defaultVal)];
104
104
  };
105
105
  exports.Slider = (0, react_2.forwardRef)((_a, forwardedRef) => {
106
- var { id, style, className, step = exports.defaultProps.step, min = exports.defaultProps.min, max = exports.defaultProps.max, inverted, updateState, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, enabled = exports.defaultProps.enabled, value, autoFocus, readOnly, tabIndex = exports.defaultProps.tabIndex, label, labelPosition, labelWidth, labelBreak, required, validationStatus = exports.defaultProps.validationStatus, initialValue, minStepsBetweenThumbs = exports.defaultProps.minStepsBetweenThumbs, rangeStyle, thumbStyle, showValues = exports.defaultProps.showValues, valueFormat = exports.defaultProps.valueFormat } = _a, rest = __rest(_a, ["id", "style", "className", "step", "min", "max", "inverted", "updateState", "onDidChange", "onFocus", "onBlur", "registerComponentApi", "enabled", "value", "autoFocus", "readOnly", "tabIndex", "label", "labelPosition", "labelWidth", "labelBreak", "required", "validationStatus", "initialValue", "minStepsBetweenThumbs", "rangeStyle", "thumbStyle", "showValues", "valueFormat"]);
107
- const _id = (0, react_1.useId)();
108
- id = id || _id;
106
+ var { id, style, className, step = exports.defaultProps.step, min = exports.defaultProps.min, max = exports.defaultProps.max, inverted, updateState, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, enabled = exports.defaultProps.enabled, value, autoFocus, readOnly, tabIndex = exports.defaultProps.tabIndex, required, validationStatus = exports.defaultProps.validationStatus, initialValue, minStepsBetweenThumbs = exports.defaultProps.minStepsBetweenThumbs, rangeStyle, thumbStyle, showValues = exports.defaultProps.showValues, valueFormat = exports.defaultProps.valueFormat } = _a, rest = __rest(_a, ["id", "style", "className", "step", "min", "max", "inverted", "updateState", "onDidChange", "onFocus", "onBlur", "registerComponentApi", "enabled", "value", "autoFocus", "readOnly", "tabIndex", "required", "validationStatus", "initialValue", "minStepsBetweenThumbs", "rangeStyle", "thumbStyle", "showValues", "valueFormat"]);
109
107
  const inputRef = (0, react_1.useRef)(null);
108
+ const ref = forwardedRef ? (0, react_compose_refs_1.composeRefs)(inputRef, forwardedRef) : inputRef;
110
109
  const tooltipRef = (0, react_1.useRef)(null);
111
110
  const thumbsRef = (0, react_1.useRef)([]);
112
111
  min = parseValue(min, exports.defaultProps.min);
@@ -218,21 +217,21 @@ exports.Slider = (0, react_2.forwardRef)((_a, forwardedRef) => {
218
217
  (0, react_1.useEffect)(() => {
219
218
  thumbsRef.current = thumbsRef.current.slice(0, displayValue.length);
220
219
  }, [displayValue.length]);
221
- return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, className: className, ref: forwardedRef, id: id, isInputTemplateUsed: true, children: (0, jsx_runtime_1.jsx)("div", { className: Slider_module_scss_1.default.sliderContainer, "data-slider-container": true, children: (0, jsx_runtime_1.jsxs)(react_slider_1.Root, { minStepsBetweenThumbs: minStepsBetweenThumbs, ref: inputRef, tabIndex: tabIndex, "aria-readonly": readOnly, className: (0, classnames_1.default)(className, Slider_module_scss_1.default.sliderRoot, {
222
- [Slider_module_scss_1.default.disabled]: !enabled,
223
- [Slider_module_scss_1.default.readOnly]: readOnly,
224
- }), style: style, max: max, min: min, inverted: inverted, step: step, disabled: !enabled, onFocus: handleOnFocus, onBlur: handleOnBlur, onValueChange: onInputChange, onMouseOver: onShowTooltip, onMouseLeave: onHideTooltip, onPointerDown: onShowTooltip, value: displayValue, children: [(0, jsx_runtime_1.jsx)(react_slider_1.Track, { "data-track": true, className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderTrack, {
220
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { ref: ref, style: style, className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderContainer, className), "data-slider-container": true, children: (0, jsx_runtime_1.jsxs)(react_slider_1.Root, { ref: inputRef, minStepsBetweenThumbs: minStepsBetweenThumbs, tabIndex: tabIndex, "aria-readonly": readOnly, className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderRoot, {
221
+ [Slider_module_scss_1.default.disabled]: !enabled,
222
+ [Slider_module_scss_1.default.readOnly]: readOnly,
223
+ }), max: max, min: min, inverted: inverted, step: step, disabled: !enabled, onFocus: handleOnFocus, onBlur: handleOnBlur, onValueChange: onInputChange, onMouseOver: onShowTooltip, onMouseLeave: onHideTooltip, onPointerDown: onShowTooltip, value: displayValue, children: [(0, jsx_runtime_1.jsx)(react_slider_1.Track, { "data-track": true, className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderTrack, {
224
+ [Slider_module_scss_1.default.disabled]: !enabled,
225
+ [Slider_module_scss_1.default.readOnly]: readOnly,
226
+ [Slider_module_scss_1.default.error]: validationStatus === "error",
227
+ [Slider_module_scss_1.default.warning]: validationStatus === "warning",
228
+ [Slider_module_scss_1.default.valid]: validationStatus === "valid",
229
+ }), style: rangeStyle ? Object.assign({}, rangeStyle) : undefined, children: (0, jsx_runtime_1.jsx)(react_slider_1.Range, { "data-range": true, className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderRange, {
225
230
  [Slider_module_scss_1.default.disabled]: !enabled,
226
- [Slider_module_scss_1.default.readOnly]: readOnly,
227
- [Slider_module_scss_1.default.error]: validationStatus === "error",
228
- [Slider_module_scss_1.default.warning]: validationStatus === "warning",
229
- [Slider_module_scss_1.default.valid]: validationStatus === "valid",
230
- }), style: rangeStyle ? Object.assign({}, rangeStyle) : undefined, children: (0, jsx_runtime_1.jsx)(react_slider_1.Range, { "data-range": true, className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderRange, {
231
- [Slider_module_scss_1.default.disabled]: !enabled,
232
- }) }) }), displayValue.map((_, index) => ((0, jsx_runtime_1.jsx)(TooltipNative_1.Tooltip, { ref: tooltipRef, text: valueFormat(displayValue[index]), delayDuration: 100, open: showValues && showTooltip, children: (0, jsx_runtime_1.jsx)(react_slider_1.Thumb, { id: id, "aria-required": required, ref: (el) => {
233
- thumbsRef.current[index] = el;
234
- }, className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderThumb, {
235
- [Slider_module_scss_1.default.disabled]: !enabled,
236
- }), style: thumbStyle ? Object.assign({}, thumbStyle) : undefined, "data-thumb-index": index, autoFocus: autoFocus && index === 0 }) }, index)))] }) }) })));
231
+ }) }) }), displayValue.map((_, index) => ((0, jsx_runtime_1.jsx)(TooltipNative_1.Tooltip, { ref: tooltipRef, text: valueFormat(displayValue[index]), delayDuration: 100, open: showValues && showTooltip, children: (0, jsx_runtime_1.jsx)(react_slider_1.Thumb, { id: id, "aria-required": required, ref: (el) => {
232
+ thumbsRef.current[index] = el;
233
+ }, className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderThumb, {
234
+ [Slider_module_scss_1.default.disabled]: !enabled,
235
+ }), style: thumbStyle ? Object.assign({}, thumbStyle) : undefined, "data-thumb-index": index, autoFocus: autoFocus && index === 0 }) }, index)))] }) })));
237
236
  });
238
237
  exports.Slider.displayName = "Slider";
@@ -23,10 +23,6 @@ exports.SwitchMd = (0, metadata_helpers_1.createMetadata)({
23
23
  },
24
24
  },
25
25
  props: {
26
- label: (0, metadata_helpers_1.dLabel)(),
27
- labelPosition: (0, metadata_helpers_1.dLabelPosition)("end"),
28
- labelWidth: (0, metadata_helpers_1.dLabelWidth)(COMP),
29
- labelBreak: (0, metadata_helpers_1.dLabelBreak)(COMP),
30
26
  required: (0, metadata_helpers_1.dRequired)(),
31
27
  initialValue: (0, metadata_helpers_1.dInitialValue)(Toggle_1.defaultProps.initialValue),
32
28
  autoFocus: (0, metadata_helpers_1.dAutoFocus)(),
@@ -80,5 +76,5 @@ exports.SwitchMd = (0, metadata_helpers_1.createMetadata)({
80
76
  },
81
77
  });
82
78
  exports.switchComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.SwitchMd, ({ node, extractValue, className, updateState, state, lookupEventHandler, registerComponentApi, }) => {
83
- return ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { enabled: extractValue.asOptionalBoolean(node.props.enabled), className: className, initialValue: extractValue.asOptionalBoolean(node.props.initialValue, Toggle_1.defaultProps.initialValue), value: state === null || state === void 0 ? void 0 : state.value, readOnly: extractValue.asOptionalBoolean(node.props.readOnly), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), onClick: lookupEventHandler("click"), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), variant: "switch", registerComponentApi: registerComponentApi }));
79
+ return ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { enabled: extractValue.asOptionalBoolean(node.props.enabled), className: className, initialValue: extractValue.asOptionalBoolean(node.props.initialValue, Toggle_1.defaultProps.initialValue), value: state === null || state === void 0 ? void 0 : state.value, readOnly: extractValue.asOptionalBoolean(node.props.readOnly), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), onClick: lookupEventHandler("click"), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), required: extractValue.asOptionalBoolean(node.props.required), variant: "switch", registerComponentApi: registerComponentApi }));
84
80
  });
@@ -84,7 +84,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
84
84
  yield initTestBed(`<Switch initialValue="false" />`);
85
85
  yield (0, fixtures_1.expect)(page.getByRole("switch")).not.toBeChecked();
86
86
  }));
87
- (0, fixtures_1.test)("initialValue handles string 'FALSE' as false (case insensitive)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
87
+ (0, fixtures_1.test)("initialValue handles string 'FALSE' as false (case insensitive)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
88
88
  yield initTestBed(`<Switch initialValue="FALSE" />`);
89
89
  yield (0, fixtures_1.expect)(page.getByRole("switch")).not.toBeChecked();
90
90
  }));
@@ -96,7 +96,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
96
96
  yield initTestBed(`<Switch initialValue="yes" />`);
97
97
  yield (0, fixtures_1.expect)(page.getByRole("switch")).toBeChecked();
98
98
  }));
99
- (0, fixtures_1.test)("initialValue handles string with content and 'false' as true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
99
+ (0, fixtures_1.test)("initialValue handles string with content and 'false' as true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
100
100
  yield initTestBed(`<Switch initialValue="not false" />`);
101
101
  yield (0, fixtures_1.expect)(page.getByRole("switch")).toBeChecked();
102
102
  }));
@@ -127,7 +127,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
127
127
  (0, fixtures_1.expect)(exists).toBe(0);
128
128
  }
129
129
  }));
130
- (0, fixtures_1.test)("initialValue handles array with single element as true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
130
+ (0, fixtures_1.test)("initialValue handles array with single element as true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
131
131
  yield initTestBed(`<Switch initialValue="{['item']}" />`);
132
132
  // Arrays may cause component to not render in some contexts
133
133
  const switchElement = page.getByRole("switch");
@@ -453,7 +453,7 @@ fixtures_1.test.describe("Event Handling", () => {
453
453
  `);
454
454
  const switchElement = page.getByRole("switch");
455
455
  yield switchElement.click();
456
- yield fixtures_1.expect.poll(testStateDriver.testState).toEqual('changed');
456
+ yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("changed");
457
457
  }));
458
458
  (0, fixtures_1.test)("didChange event passes new value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
459
459
  const { testStateDriver } = yield initTestBed(`
@@ -469,7 +469,14 @@ fixtures_1.test.describe("Event Handling", () => {
469
469
  `);
470
470
  const switchElement = page.getByRole("switch");
471
471
  yield switchElement.focus();
472
- yield fixtures_1.expect.poll(testStateDriver.testState).toEqual('focused');
472
+ yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
473
+ }));
474
+ (0, fixtures_1.test)("gotFocus event fires on label click", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
475
+ const { testStateDriver } = yield initTestBed(`
476
+ <Switch label="Enable" onGotFocus="testState = 'focused'" />
477
+ `);
478
+ yield page.getByText("Enable").click();
479
+ yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
473
480
  }));
474
481
  (0, fixtures_1.test)("component lostFocus event fires on blur", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
475
482
  const { testStateDriver } = yield initTestBed(`
@@ -478,7 +485,7 @@ fixtures_1.test.describe("Event Handling", () => {
478
485
  const switchElement = page.getByRole("switch");
479
486
  yield switchElement.focus();
480
487
  yield switchElement.blur();
481
- yield fixtures_1.expect.poll(testStateDriver.testState).toEqual('blurred');
488
+ yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("blurred");
482
489
  }));
483
490
  });
484
491
  // =============================================================================
@@ -526,13 +533,13 @@ fixtures_1.test.describe("Api", () => {
526
533
  </Fragment>
527
534
  `);
528
535
  yield page.getByTestId("setBtn").click();
529
- yield fixtures_1.expect.poll(testStateDriver.testState).toEqual('api-changed');
536
+ yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("api-changed");
530
537
  }));
531
538
  // =============================================================================
532
539
  // VALUE PROPERTY TESTS - Testing transformToLegitValue with dynamic value updates
533
540
  // =============================================================================
534
541
  fixtures_1.test.describe("value property with transformToLegitValue", () => {
535
- (0, fixtures_1.test)("switch reflects state changes with different value types", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
542
+ (0, fixtures_1.test)("switch reflects state changes with different value types", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
536
543
  yield initTestBed(`
537
544
  <Fragment>
538
545
  <Switch id="mySwitch" initialValue="false" />
@@ -634,7 +641,7 @@ fixtures_1.test.describe("Api", () => {
634
641
  // VISUAL STATE TESTS
635
642
  // =============================================================================
636
643
  fixtures_1.test.describe("Visual States", () => {
637
- (0, fixtures_1.test)("component applies switch-specific styling", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver }) {
644
+ (0, fixtures_1.test)("component applies switch-specific styling", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver, }) {
638
645
  yield initTestBed(`<Switch />`);
639
646
  const driver = yield createCheckboxDriver();
640
647
  // Switch should have different visual styling than checkbox
@@ -734,22 +741,22 @@ fixtures_1.test.describe("Theme Vars", () => {
734
741
  // VALIDATION STATUS TESTS
735
742
  // =============================================================================
736
743
  fixtures_1.test.describe("Validation", () => {
737
- (0, fixtures_1.test)("validationStatus=error correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver }) {
744
+ (0, fixtures_1.test)("validationStatus=error correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver, }) {
738
745
  yield initTestBed(`<Switch validationStatus="error" />`);
739
746
  const driver = yield createCheckboxDriver();
740
747
  yield (0, fixtures_1.expect)(driver.component).toHaveClass(/error/);
741
748
  }));
742
- (0, fixtures_1.test)("validationStatus=warning correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver }) {
749
+ (0, fixtures_1.test)("validationStatus=warning correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver, }) {
743
750
  yield initTestBed(`<Switch validationStatus="warning" />`);
744
751
  const driver = yield createCheckboxDriver();
745
752
  yield (0, fixtures_1.expect)(driver.component).toHaveClass(/warning/);
746
753
  }));
747
- (0, fixtures_1.test)("validationStatus=valid correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver }) {
754
+ (0, fixtures_1.test)("validationStatus=valid correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver, }) {
748
755
  yield initTestBed(`<Switch validationStatus="valid" />`);
749
756
  const driver = yield createCheckboxDriver();
750
757
  yield (0, fixtures_1.expect)(driver.component).toHaveClass(/valid/);
751
758
  }));
752
- (0, fixtures_1.test)("handles invalid validationStatus gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver }) {
759
+ (0, fixtures_1.test)("handles invalid validationStatus gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver, }) {
753
760
  yield initTestBed(`<Switch validationStatus="invalid-status" />`);
754
761
  const driver = yield createCheckboxDriver();
755
762
  yield (0, fixtures_1.expect)(driver.component).toBeVisible();
@@ -759,7 +766,7 @@ fixtures_1.test.describe("Validation", () => {
759
766
  // EDGE CASE TESTS
760
767
  // =============================================================================
761
768
  fixtures_1.test.describe("Edge Cases", () => {
762
- (0, fixtures_1.test)("component handles null and undefined props gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver }) {
769
+ (0, fixtures_1.test)("component handles null and undefined props gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver, }) {
763
770
  yield initTestBed(`<Switch/>`, {});
764
771
  const driver1 = yield createCheckboxDriver();
765
772
  yield (0, fixtures_1.expect)(driver1.component).toBeVisible();
@@ -767,12 +774,12 @@ fixtures_1.test.describe("Edge Cases", () => {
767
774
  const driver2 = yield createCheckboxDriver();
768
775
  yield (0, fixtures_1.expect)(driver2.component).toBeVisible();
769
776
  }));
770
- (0, fixtures_1.test)("component handles special characters correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver }) {
777
+ (0, fixtures_1.test)("component handles special characters correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver, }) {
771
778
  yield initTestBed(`<Switch label="Test with !@#$%^&*()"/>`, {});
772
779
  const driver = yield createCheckboxDriver();
773
780
  yield (0, fixtures_1.expect)(driver.component).toBeVisible();
774
781
  }));
775
- (0, fixtures_1.test)("component handles concurrent prop updates correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver }) {
782
+ (0, fixtures_1.test)("component handles concurrent prop updates correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver, }) {
776
783
  yield initTestBed(`<Switch initialValue="false" />`, {});
777
784
  const driver1 = yield createCheckboxDriver();
778
785
  yield (0, fixtures_1.expect)(driver1.component).not.toBeChecked();
@@ -785,7 +792,7 @@ fixtures_1.test.describe("Edge Cases", () => {
785
792
  // INTEGRATION TESTS
786
793
  // =============================================================================
787
794
  fixtures_1.test.describe("Integration", () => {
788
- (0, fixtures_1.test)("component works correctly in different layout contexts", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver }) {
795
+ (0, fixtures_1.test)("component works correctly in different layout contexts", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver, }) {
789
796
  yield initTestBed(`
790
797
  <VStack>
791
798
  <Switch label="First switch" />
@@ -125,6 +125,16 @@ exports.TableMd = (0, metadata_helpers_1.createMetadata)({
125
125
  availableValues: ["top", "center", "bottom"],
126
126
  defaultValue: "center",
127
127
  },
128
+ checkboxTolerance: {
129
+ description: `This property controls the tolerance area around checkboxes for easier interaction. ` +
130
+ `This property only has an effect when the rowsSelectable property is set to \`true\`. ` +
131
+ `\`none\` provides no tolerance (0px), \`compact\` provides minimal tolerance (8px), ` +
132
+ `\`comfortable\` provides medium tolerance (12px), and \`spacious\` provides generous tolerance (16px) ` +
133
+ `for improved accessibility.`,
134
+ valueType: "string",
135
+ availableValues: TableNative_1.CheckboxToleranceValues,
136
+ defaultValue: TableNative_1.defaultProps.checkboxTolerance,
137
+ },
128
138
  },
129
139
  events: {
130
140
  sortingDidChange: (0, metadata_helpers_1.d)(`This event is fired when the table data sorting has changed. It has two arguments: ` +
@@ -246,7 +256,7 @@ const TableWithColumns = (0, react_1.memo)((0, react_1.forwardRef)(({ extractVal
246
256
  const tableContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TableContext_1.TableContext.Provider, { value: tableContextValue, children: renderChild(node.children) }, tableKey), (0, jsx_runtime_1.jsx)(TableContext_1.TableContext.Provider, { value: columnRefresherContextValue, children: renderChild(node.children) }), (0, jsx_runtime_1.jsx)(TableNative_1.Table, { className: className, ref: ref, data: data, columns: columns, pageSizeOptions: extractValue(node.props.pageSizeOptions), pageSize: extractValue.asOptionalNumber(node.props.pageSize), rowsSelectable: extractValue.asOptionalBoolean(node.props.rowsSelectable), registerComponentApi: registerComponentApi, noDataRenderer: node.props.noDataTemplate &&
247
257
  (() => {
248
258
  return renderChild(node.props.noDataTemplate);
249
- }), hideNoDataView: node.props.noDataTemplate === null || node.props.noDataTemplate === "", loading: extractValue.asOptionalBoolean(node.props.loading), isPaginated: extractValue.asOptionalBoolean((_a = node.props) === null || _a === void 0 ? void 0 : _a.isPaginated), headerHeight: extractValue.asSize(node.props.headerHeight), rowDisabledPredicate: lookupSyncCallback(node.props.rowDisabledPredicate), sortBy: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.sortBy), sortingDirection: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.sortDirection), iconSortAsc: extractValue.asOptionalString((_d = node.props) === null || _d === void 0 ? void 0 : _d.iconSortAsc), iconSortDesc: extractValue.asOptionalString((_e = node.props) === null || _e === void 0 ? void 0 : _e.iconSortDesc), iconNoSort: extractValue.asOptionalString((_f = node.props) === null || _f === void 0 ? void 0 : _f.iconNoSort), sortingDidChange: lookupEventHandler("sortingDidChange"), onSelectionDidChange: lookupEventHandler("selectionDidChange"), willSort: lookupEventHandler("willSort"), uid: node.uid, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), hideHeader: extractValue.asOptionalBoolean(node.props.hideHeader), enableMultiRowSelection: extractValue.asOptionalBoolean(node.props.enableMultiRowSelection), alwaysShowSelectionHeader: extractValue.asOptionalBoolean(node.props.alwaysShowSelectionHeader), noBottomBorder: extractValue.asOptionalBoolean(node.props.noBottomBorder), paginationControlsLocation: extractValue.asOptionalString(node.props.paginationControlsLocation), cellVerticalAlign: extractValue.asOptionalString(node.props.cellVerticalAlign), buttonRowPosition: extractValue.asOptionalString(node.props.buttonRowPosition), pageSizeSelectorPosition: extractValue.asOptionalString(node.props.pageSizeSelectorPosition), pageInfoPosition: extractValue.asOptionalString(node.props.pageInfoPosition), showCurrentPage: extractValue.asOptionalBoolean(node.props.showCurrentPage), showPageInfo: extractValue.asOptionalBoolean(node.props.showPageInfo), showPageSizeSelector: extractValue.asOptionalBoolean(node.props.showPageSizeSelector), initiallySelected: extractValue(node.props.initiallySelected), syncWithAppState: extractValue(node.props.syncWithAppState) })] }));
259
+ }), hideNoDataView: node.props.noDataTemplate === null || node.props.noDataTemplate === "", loading: extractValue.asOptionalBoolean(node.props.loading), isPaginated: extractValue.asOptionalBoolean((_a = node.props) === null || _a === void 0 ? void 0 : _a.isPaginated), headerHeight: extractValue.asSize(node.props.headerHeight), rowDisabledPredicate: lookupSyncCallback(node.props.rowDisabledPredicate), sortBy: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.sortBy), sortingDirection: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.sortDirection), iconSortAsc: extractValue.asOptionalString((_d = node.props) === null || _d === void 0 ? void 0 : _d.iconSortAsc), iconSortDesc: extractValue.asOptionalString((_e = node.props) === null || _e === void 0 ? void 0 : _e.iconSortDesc), iconNoSort: extractValue.asOptionalString((_f = node.props) === null || _f === void 0 ? void 0 : _f.iconNoSort), sortingDidChange: lookupEventHandler("sortingDidChange"), onSelectionDidChange: lookupEventHandler("selectionDidChange"), willSort: lookupEventHandler("willSort"), uid: node.uid, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), hideHeader: extractValue.asOptionalBoolean(node.props.hideHeader), enableMultiRowSelection: extractValue.asOptionalBoolean(node.props.enableMultiRowSelection), alwaysShowSelectionHeader: extractValue.asOptionalBoolean(node.props.alwaysShowSelectionHeader), noBottomBorder: extractValue.asOptionalBoolean(node.props.noBottomBorder), paginationControlsLocation: extractValue.asOptionalString(node.props.paginationControlsLocation), cellVerticalAlign: extractValue.asOptionalString(node.props.cellVerticalAlign), buttonRowPosition: extractValue.asOptionalString(node.props.buttonRowPosition), pageSizeSelectorPosition: extractValue.asOptionalString(node.props.pageSizeSelectorPosition), pageInfoPosition: extractValue.asOptionalString(node.props.pageInfoPosition), showCurrentPage: extractValue.asOptionalBoolean(node.props.showCurrentPage), showPageInfo: extractValue.asOptionalBoolean(node.props.showPageInfo), showPageSizeSelector: extractValue.asOptionalBoolean(node.props.showPageSizeSelector), checkboxTolerance: extractValue.asOptionalString(node.props.checkboxTolerance), initiallySelected: extractValue(node.props.initiallySelected), syncWithAppState: extractValue(node.props.syncWithAppState) })] }));
250
260
  if (selectionContext === null) {
251
261
  return (0, jsx_runtime_1.jsx)(SelectionStoreNative_1.StandaloneSelectionStore, { children: tableContent });
252
262
  }