@octanejs/aria 0.0.4 → 0.0.5

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 (93) hide show
  1. package/package.json +7 -5
  2. package/src/autocomplete/useAutocomplete.ts +656 -0
  3. package/src/collections/BaseCollection.ts +374 -0
  4. package/src/collections/CollectionBuilder.ts +343 -0
  5. package/src/collections/Document.ts +451 -0
  6. package/src/collections/Hidden.ts +84 -0
  7. package/src/collections/useCachedChildren.ts +103 -0
  8. package/src/components/Autocomplete.ts +124 -0
  9. package/src/components/Breadcrumbs.ts +170 -0
  10. package/src/components/Button.ts +209 -0
  11. package/src/components/Checkbox.ts +593 -0
  12. package/src/components/Collection.ts +301 -0
  13. package/src/components/ComboBox.ts +477 -0
  14. package/src/components/Dialog.ts +195 -0
  15. package/src/components/Disclosure.ts +322 -0
  16. package/src/components/DragAndDrop.ts +177 -0
  17. package/src/components/FieldError.ts +79 -0
  18. package/src/components/Form.ts +65 -0
  19. package/src/components/GridList.ts +1099 -0
  20. package/src/components/Group.ts +146 -0
  21. package/src/components/Header.ts +32 -0
  22. package/src/components/Heading.ts +45 -0
  23. package/src/components/Input.ts +139 -0
  24. package/src/components/Keyboard.ts +23 -0
  25. package/src/components/Label.ts +30 -0
  26. package/src/components/Link.ts +137 -0
  27. package/src/components/ListBox.ts +886 -0
  28. package/src/components/Menu.ts +685 -0
  29. package/src/components/Meter.ts +100 -0
  30. package/src/components/Modal.ts +352 -0
  31. package/src/components/NumberField.ts +221 -0
  32. package/src/components/OverlayArrow.ts +117 -0
  33. package/src/components/Popover.ts +385 -0
  34. package/src/components/ProgressBar.ts +112 -0
  35. package/src/components/RadioGroup.ts +542 -0
  36. package/src/components/SearchField.ts +208 -0
  37. package/src/components/Select.ts +505 -0
  38. package/src/components/SelectionIndicator.ts +52 -0
  39. package/src/components/Separator.ts +97 -0
  40. package/src/components/SharedElementTransition.ts +209 -0
  41. package/src/components/Slider.ts +472 -0
  42. package/src/components/Switch.ts +449 -0
  43. package/src/components/Tabs.ts +675 -0
  44. package/src/components/TagGroup.ts +443 -0
  45. package/src/components/Text.ts +27 -0
  46. package/src/components/TextArea.ts +92 -0
  47. package/src/components/TextField.ts +200 -0
  48. package/src/components/ToggleButton.ts +147 -0
  49. package/src/components/ToggleButtonGroup.ts +106 -0
  50. package/src/components/Toolbar.ts +74 -0
  51. package/src/components/Tooltip.ts +249 -0
  52. package/src/components/index.ts +302 -0
  53. package/src/components/useDragAndDrop.ts +164 -0
  54. package/src/components/utils.ts +521 -0
  55. package/src/intl/autocomplete/ar-AE.json +3 -0
  56. package/src/intl/autocomplete/bg-BG.json +3 -0
  57. package/src/intl/autocomplete/cs-CZ.json +3 -0
  58. package/src/intl/autocomplete/da-DK.json +3 -0
  59. package/src/intl/autocomplete/de-DE.json +3 -0
  60. package/src/intl/autocomplete/el-GR.json +3 -0
  61. package/src/intl/autocomplete/en-US.json +3 -0
  62. package/src/intl/autocomplete/es-ES.json +3 -0
  63. package/src/intl/autocomplete/et-EE.json +3 -0
  64. package/src/intl/autocomplete/fi-FI.json +3 -0
  65. package/src/intl/autocomplete/fr-FR.json +3 -0
  66. package/src/intl/autocomplete/he-IL.json +3 -0
  67. package/src/intl/autocomplete/hr-HR.json +3 -0
  68. package/src/intl/autocomplete/hu-HU.json +3 -0
  69. package/src/intl/autocomplete/index.ts +75 -0
  70. package/src/intl/autocomplete/it-IT.json +3 -0
  71. package/src/intl/autocomplete/ja-JP.json +3 -0
  72. package/src/intl/autocomplete/ko-KR.json +3 -0
  73. package/src/intl/autocomplete/lt-LT.json +3 -0
  74. package/src/intl/autocomplete/lv-LV.json +3 -0
  75. package/src/intl/autocomplete/nb-NO.json +3 -0
  76. package/src/intl/autocomplete/nl-NL.json +3 -0
  77. package/src/intl/autocomplete/pl-PL.json +3 -0
  78. package/src/intl/autocomplete/pt-BR.json +3 -0
  79. package/src/intl/autocomplete/pt-PT.json +3 -0
  80. package/src/intl/autocomplete/ro-RO.json +3 -0
  81. package/src/intl/autocomplete/ru-RU.json +3 -0
  82. package/src/intl/autocomplete/sk-SK.json +3 -0
  83. package/src/intl/autocomplete/sl-SI.json +3 -0
  84. package/src/intl/autocomplete/sr-SP.json +3 -0
  85. package/src/intl/autocomplete/sv-SE.json +3 -0
  86. package/src/intl/autocomplete/tr-TR.json +3 -0
  87. package/src/intl/autocomplete/uk-UA.json +3 -0
  88. package/src/intl/autocomplete/zh-CN.json +3 -0
  89. package/src/intl/autocomplete/zh-TW.json +3 -0
  90. package/src/stately/autocomplete/useAutocompleteState.ts +85 -0
  91. package/src/utils/animation.ts +149 -0
  92. package/src/utils/useLoadMoreSentinel.ts +78 -0
  93. package/src/utils/useViewportSize.ts +123 -0
@@ -0,0 +1,542 @@
1
+ // Ported from react-aria-components (source: .react-spectrum/packages/react-aria-components/src/RadioGroup.tsx).
2
+ // octane adaptations: `.tsx` → `.ts`, JSX → `createElement`; NO forwardRef — the forwarded ref
3
+ // is `props.ref`, passed into `useContextProps` explicitly and re-applied as the merged object
4
+ // ref; the plain-`.ts` components use the S()/subSlot component-slot convention (`useContext`
5
+ // stays slotless — context-identity keyed); the ported useRadio already carries octane's
6
+ // native change-event wiring for the hidden radio input — inputProps pass through untouched.
7
+ import type { HoverEvents, Orientation, RefObject } from '@react-types/shared';
8
+ import { createContext, createElement, useContext, useMemo } from 'octane';
9
+
10
+ import { useFocusRing } from '../focus/useFocusRing';
11
+ import { useHover } from '../interactions/useHover';
12
+ import { S, subSlot } from '../internal';
13
+ import { type AriaRadioProps, type RadioAria, useRadio } from '../radio/useRadio';
14
+ import { type AriaRadioGroupProps, useRadioGroup } from '../radio/useRadioGroup';
15
+ import { type RadioGroupState, useRadioGroupState } from '../stately/radio/useRadioGroupState';
16
+ import { filterDOMProps } from '../utils/filterDOMProps';
17
+ import { mergeProps } from '../utils/mergeProps';
18
+ import { mergeRefs } from '../utils/mergeRefs';
19
+ import { useObjectRef } from '../utils/useObjectRef';
20
+ import { VisuallyHidden } from '../visually-hidden/VisuallyHidden';
21
+ import { FieldErrorContext } from './FieldError';
22
+ import { FormContext } from './Form';
23
+ import { LabelContext } from './Label';
24
+ import { SelectionIndicatorContext } from './SelectionIndicator';
25
+ import { SharedElementTransition } from './SharedElementTransition';
26
+ import { TextContext } from './Text';
27
+ import {
28
+ type ClassNameOrFunction,
29
+ type ContextValue,
30
+ dom,
31
+ Provider,
32
+ type RACValidation,
33
+ removeDataAttributes,
34
+ type RenderProps,
35
+ type SlotProps,
36
+ useContextProps,
37
+ useRenderProps,
38
+ useSlot,
39
+ useSlottedContext,
40
+ } from './utils';
41
+
42
+ // octane adaptation: structural bag (upstream's `GlobalDOMAttributes` drags React handler types).
43
+ type GlobalDOMAttributes = Record<string, any>;
44
+
45
+ export interface RadioGroupProps
46
+ extends
47
+ Omit<
48
+ AriaRadioGroupProps,
49
+ | 'children'
50
+ | 'label'
51
+ | 'description'
52
+ | 'errorMessage'
53
+ | 'validationState'
54
+ | 'validationBehavior'
55
+ >,
56
+ RACValidation,
57
+ RenderProps<RadioGroupRenderProps>,
58
+ SlotProps,
59
+ GlobalDOMAttributes {
60
+ /**
61
+ * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
62
+ * element. A function may be provided to compute the class based on component state.
63
+ *
64
+ * @default 'react-aria-RadioGroup'
65
+ */
66
+ className?: ClassNameOrFunction<RadioGroupRenderProps>;
67
+ }
68
+ export interface RadioProps
69
+ extends
70
+ Omit<AriaRadioProps, 'children'>,
71
+ HoverEvents,
72
+ RenderProps<RadioRenderProps, 'label'>,
73
+ SlotProps,
74
+ Omit<GlobalDOMAttributes, 'onClick'> {
75
+ /**
76
+ * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
77
+ * element. A function may be provided to compute the class based on component state.
78
+ *
79
+ * @default 'react-aria-Radio'
80
+ */
81
+ className?: ClassNameOrFunction<RadioRenderProps>;
82
+ /**
83
+ * A ref for the HTML input element.
84
+ */
85
+ inputRef?: RefObject<HTMLInputElement | null>;
86
+ }
87
+
88
+ export interface RadioFieldProps
89
+ extends
90
+ Omit<AriaRadioProps, 'children'>,
91
+ RenderProps<RadioFieldRenderProps>,
92
+ SlotProps,
93
+ Omit<GlobalDOMAttributes, 'onClick'> {
94
+ /**
95
+ * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
96
+ * element. A function may be provided to compute the class based on component state.
97
+ *
98
+ * @default 'react-aria-RadioField'
99
+ */
100
+ className?: ClassNameOrFunction<RadioFieldRenderProps>;
101
+ /**
102
+ * A ref for the HTML input element.
103
+ */
104
+ inputRef?: RefObject<HTMLInputElement | null>;
105
+ }
106
+
107
+ export interface RadioButtonProps
108
+ extends
109
+ HoverEvents,
110
+ RenderProps<RadioButtonRenderProps, 'label'>,
111
+ SlotProps,
112
+ Omit<GlobalDOMAttributes, 'onClick'> {
113
+ /**
114
+ * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
115
+ * element. A function may be provided to compute the class based on component state.
116
+ *
117
+ * @default 'react-aria-RadioButton'
118
+ */
119
+ className?: ClassNameOrFunction<RadioButtonRenderProps>;
120
+ }
121
+
122
+ export interface RadioGroupRenderProps {
123
+ /**
124
+ * The orientation of the radio group.
125
+ *
126
+ * @selector [data-orientation="horizontal | vertical"]
127
+ */
128
+ orientation: Orientation;
129
+ /**
130
+ * Whether the radio group is disabled.
131
+ *
132
+ * @selector [data-disabled]
133
+ */
134
+ isDisabled: boolean;
135
+ /**
136
+ * Whether the radio group is read only.
137
+ *
138
+ * @selector [data-readonly]
139
+ */
140
+ isReadOnly: boolean;
141
+ /**
142
+ * Whether the radio group is required.
143
+ *
144
+ * @selector [data-required]
145
+ */
146
+ isRequired: boolean;
147
+ /**
148
+ * Whether the radio group is invalid.
149
+ *
150
+ * @selector [data-invalid]
151
+ */
152
+ isInvalid: boolean;
153
+ /**
154
+ * State of the radio group.
155
+ */
156
+ state: RadioGroupState;
157
+ }
158
+
159
+ export interface RadioRenderProps {
160
+ /**
161
+ * Whether the radio is selected.
162
+ *
163
+ * @selector [data-selected]
164
+ */
165
+ isSelected: boolean;
166
+ /**
167
+ * Whether the radio is currently hovered with a mouse.
168
+ *
169
+ * @selector [data-hovered]
170
+ */
171
+ isHovered: boolean;
172
+ /**
173
+ * Whether the radio is currently in a pressed state.
174
+ *
175
+ * @selector [data-pressed]
176
+ */
177
+ isPressed: boolean;
178
+ /**
179
+ * Whether the radio is focused, either via a mouse or keyboard.
180
+ *
181
+ * @selector [data-focused]
182
+ */
183
+ isFocused: boolean;
184
+ /**
185
+ * Whether the radio is keyboard focused.
186
+ *
187
+ * @selector [data-focus-visible]
188
+ */
189
+ isFocusVisible: boolean;
190
+ /**
191
+ * Whether the radio is disabled.
192
+ *
193
+ * @selector [data-disabled]
194
+ */
195
+ isDisabled: boolean;
196
+ /**
197
+ * Whether the radio is read only.
198
+ *
199
+ * @selector [data-readonly]
200
+ */
201
+ isReadOnly: boolean;
202
+ /**
203
+ * Whether the radio is invalid.
204
+ *
205
+ * @selector [data-invalid]
206
+ */
207
+ isInvalid: boolean;
208
+ /**
209
+ * Whether the checkbox is required.
210
+ *
211
+ * @selector [data-required]
212
+ */
213
+ isRequired: boolean;
214
+ }
215
+
216
+ export interface RadioFieldRenderProps {
217
+ /**
218
+ * Whether the radio is selected.
219
+ *
220
+ * @selector [data-selected]
221
+ */
222
+ isSelected: boolean;
223
+ /**
224
+ * Whether the radio is disabled.
225
+ *
226
+ * @selector [data-disabled]
227
+ */
228
+ isDisabled: boolean;
229
+ /**
230
+ * Whether the radio is read only.
231
+ *
232
+ * @selector [data-readonly]
233
+ */
234
+ isReadOnly: boolean;
235
+ /**
236
+ * Whether the radio is invalid.
237
+ *
238
+ * @selector [data-invalid]
239
+ */
240
+ isInvalid: boolean;
241
+ /**
242
+ * Whether the checkbox is required.
243
+ *
244
+ * @selector [data-required]
245
+ */
246
+ isRequired: boolean;
247
+ }
248
+
249
+ export interface RadioButtonRenderProps extends RadioRenderProps {}
250
+
251
+ export const RadioGroupContext = createContext<ContextValue<RadioGroupProps, HTMLDivElement>>(null);
252
+ export const RadioContext =
253
+ createContext<ContextValue<Partial<RadioProps>, HTMLLabelElement>>(null);
254
+ export const RadioFieldContext =
255
+ createContext<ContextValue<Partial<RadioFieldProps>, HTMLDivElement>>(null);
256
+ export const RadioGroupStateContext = createContext<RadioGroupState | null>(null);
257
+
258
+ /**
259
+ * A radio group allows a user to select a single item from a list of mutually exclusive options.
260
+ */
261
+ export function RadioGroup(props: RadioGroupProps): any {
262
+ const slot = S('RadioGroup');
263
+ let ref: any;
264
+ [props, ref] = useContextProps(props, props.ref, RadioGroupContext, subSlot(slot, 'ctx'));
265
+ let { validationBehavior: formValidationBehavior } =
266
+ useSlottedContext(FormContext, undefined, subSlot(slot, 'form')) || {};
267
+ let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';
268
+ let state = useRadioGroupState(
269
+ {
270
+ ...props,
271
+ validationBehavior,
272
+ },
273
+ subSlot(slot, 'state'),
274
+ );
275
+
276
+ let [labelRef, label] = useSlot(
277
+ !props['aria-label'] && !props['aria-labelledby'],
278
+ subSlot(slot, 'labelSlot'),
279
+ );
280
+ let { radioGroupProps, labelProps, descriptionProps, errorMessageProps, ...validation } =
281
+ useRadioGroup(
282
+ {
283
+ ...props,
284
+ label,
285
+ validationBehavior,
286
+ },
287
+ state,
288
+ subSlot(slot, 'group'),
289
+ );
290
+
291
+ let renderProps = useRenderProps(
292
+ {
293
+ ...props,
294
+ values: {
295
+ orientation: props.orientation || 'vertical',
296
+ isDisabled: state.isDisabled,
297
+ isReadOnly: state.isReadOnly,
298
+ isRequired: state.isRequired,
299
+ isInvalid: state.isInvalid,
300
+ state,
301
+ },
302
+ defaultClassName: 'react-aria-RadioGroup',
303
+ },
304
+ subSlot(slot, 'render'),
305
+ );
306
+
307
+ let DOMProps = filterDOMProps(props, { global: true });
308
+
309
+ return createElement(dom.div, {
310
+ ...mergeProps(DOMProps, renderProps, radioGroupProps),
311
+ ref,
312
+ slot: props.slot || undefined,
313
+ 'data-orientation': props.orientation || 'vertical',
314
+ 'data-invalid': state.isInvalid || undefined,
315
+ 'data-disabled': state.isDisabled || undefined,
316
+ 'data-readonly': state.isReadOnly || undefined,
317
+ 'data-required': state.isRequired || undefined,
318
+ children: createElement(Provider, {
319
+ values: [
320
+ [RadioGroupStateContext, state],
321
+ [LabelContext, { ...labelProps, ref: labelRef, elementType: 'span' }],
322
+ [
323
+ TextContext,
324
+ {
325
+ slots: {
326
+ description: descriptionProps,
327
+ errorMessage: errorMessageProps,
328
+ },
329
+ },
330
+ ],
331
+ [FieldErrorContext, validation],
332
+ ] as any,
333
+ children: createElement(SharedElementTransition, { children: renderProps.children }),
334
+ }),
335
+ });
336
+ }
337
+
338
+ /**
339
+ * A radio represents an individual option within a radio group.
340
+ *
341
+ * @deprecated Use RadioField + RadioButton instead.
342
+ */
343
+ export function Radio(props: RadioProps): any {
344
+ const slot = S('Radio');
345
+ let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
346
+ let ref: any;
347
+ [props, ref] = useContextProps(
348
+ otherProps as RadioProps,
349
+ (otherProps as any).ref,
350
+ RadioContext,
351
+ subSlot(slot, 'ctx'),
352
+ );
353
+ let state = useContext(RadioGroupStateContext)!;
354
+ let inputRef = useObjectRef(
355
+ useMemo(
356
+ () => mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null),
357
+ [userProvidedInputRef, props.inputRef],
358
+ subSlot(slot, 'mergeRefs'),
359
+ ),
360
+ subSlot(slot, 'objectRef'),
361
+ );
362
+ let aria = useRadio(
363
+ {
364
+ ...removeDataAttributes<RadioProps>(props),
365
+ // ReactNode type doesn't allow function children.
366
+ children: typeof props.children === 'function' ? true : props.children,
367
+ },
368
+ state,
369
+ inputRef,
370
+ subSlot(slot, 'radio'),
371
+ );
372
+
373
+ return createElement(InternalRadioContext.Provider, {
374
+ value: { ...aria, inputRef, defaultClassName: 'react-aria-Radio' },
375
+ children: createElement(RadioButton, { ...props, ref } as any),
376
+ });
377
+ }
378
+
379
+ interface InternalRadioContextValue extends RadioAria {
380
+ inputRef: RefObject<HTMLInputElement | null>;
381
+ defaultClassName: string;
382
+ }
383
+
384
+ const InternalRadioContext = createContext<InternalRadioContextValue | null>(null);
385
+
386
+ /**
387
+ * A RadioField represents an individual option within a radio group, containing a RadioButton and
388
+ * optional description.
389
+ */
390
+ export function RadioField(props: RadioFieldProps): any {
391
+ const slot = S('RadioField');
392
+ let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
393
+ let ref: any;
394
+ [props, ref] = useContextProps(
395
+ otherProps as RadioFieldProps,
396
+ (otherProps as any).ref,
397
+ RadioFieldContext,
398
+ subSlot(slot, 'ctx'),
399
+ );
400
+ let state = useContext(RadioGroupStateContext)!;
401
+ let inputRef = useObjectRef(
402
+ useMemo(
403
+ () => mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null),
404
+ [userProvidedInputRef, props.inputRef],
405
+ subSlot(slot, 'mergeRefs'),
406
+ ),
407
+ subSlot(slot, 'objectRef'),
408
+ );
409
+ let aria = useRadio(
410
+ {
411
+ ...removeDataAttributes<RadioFieldProps>(props),
412
+ // ReactNode type doesn't allow function children.
413
+ children: typeof props.children === 'function' ? true : props.children,
414
+ },
415
+ state,
416
+ inputRef,
417
+ subSlot(slot, 'radio'),
418
+ );
419
+ let { descriptionProps, isSelected, isDisabled } = aria;
420
+
421
+ let renderProps = useRenderProps(
422
+ {
423
+ ...props,
424
+ defaultClassName: 'react-aria-RadioField',
425
+ values: {
426
+ isSelected,
427
+ isDisabled,
428
+ isReadOnly: state.isReadOnly,
429
+ isInvalid: state.isInvalid,
430
+ isRequired: state.isRequired,
431
+ },
432
+ },
433
+ subSlot(slot, 'render'),
434
+ );
435
+
436
+ let DOMProps = filterDOMProps(props, { global: true });
437
+ delete DOMProps.id;
438
+ delete (DOMProps as any).onClick;
439
+
440
+ return createElement(dom.div, {
441
+ ...mergeProps(DOMProps, renderProps),
442
+ ref,
443
+ 'data-selected': isSelected || undefined,
444
+ 'data-disabled': isDisabled || undefined,
445
+ 'data-readonly': state.isReadOnly || undefined,
446
+ 'data-invalid': state.isInvalid || undefined,
447
+ 'data-required': state.isRequired || undefined,
448
+ children: createElement(Provider, {
449
+ values: [
450
+ [SelectionIndicatorContext, { isSelected }],
451
+ [
452
+ InternalRadioContext,
453
+ {
454
+ ...aria,
455
+ inputRef,
456
+ defaultClassName: 'react-aria-RadioButton',
457
+ },
458
+ ],
459
+ [
460
+ TextContext,
461
+ {
462
+ slots: {
463
+ description: descriptionProps,
464
+ },
465
+ },
466
+ ],
467
+ ] as any,
468
+ children: renderProps.children,
469
+ }),
470
+ });
471
+ }
472
+
473
+ /**
474
+ * A RadioButton is the clickable area of a radio, including the indicator and label.
475
+ */
476
+ export function RadioButton(props: RadioButtonProps): any {
477
+ const slot = S('RadioButton');
478
+ let { labelProps, inputProps, isSelected, isDisabled, isPressed, defaultClassName, inputRef } =
479
+ useContext(InternalRadioContext)!;
480
+ let state = useContext(RadioGroupStateContext)!;
481
+ let { isFocused, isFocusVisible, focusProps } = useFocusRing(
482
+ undefined,
483
+ subSlot(slot, 'focusRing'),
484
+ );
485
+ let interactionDisabled = isDisabled || state.isReadOnly;
486
+
487
+ let { hoverProps, isHovered } = useHover(
488
+ {
489
+ ...props,
490
+ isDisabled: interactionDisabled,
491
+ },
492
+ subSlot(slot, 'hover'),
493
+ );
494
+
495
+ let renderProps = useRenderProps(
496
+ {
497
+ ...props,
498
+ defaultClassName,
499
+ values: {
500
+ isSelected,
501
+ isPressed,
502
+ isHovered,
503
+ isFocused,
504
+ isFocusVisible,
505
+ isDisabled,
506
+ isReadOnly: state.isReadOnly,
507
+ isInvalid: state.isInvalid,
508
+ isRequired: state.isRequired,
509
+ },
510
+ },
511
+ subSlot(slot, 'render'),
512
+ );
513
+
514
+ let DOMProps = filterDOMProps(props, { global: true });
515
+ delete DOMProps.id;
516
+ delete (DOMProps as any).onClick;
517
+
518
+ return createElement(
519
+ dom.label,
520
+ {
521
+ ...mergeProps(DOMProps, labelProps, hoverProps, renderProps),
522
+ ref: (props as any).ref,
523
+ 'data-selected': isSelected || undefined,
524
+ 'data-pressed': isPressed || undefined,
525
+ 'data-hovered': isHovered || undefined,
526
+ 'data-focused': isFocused || undefined,
527
+ 'data-focus-visible': isFocusVisible || undefined,
528
+ 'data-disabled': isDisabled || undefined,
529
+ 'data-readonly': state.isReadOnly || undefined,
530
+ 'data-invalid': state.isInvalid || undefined,
531
+ 'data-required': state.isRequired || undefined,
532
+ },
533
+ createElement(VisuallyHidden, {
534
+ elementType: 'span',
535
+ children: createElement('input', {
536
+ ...mergeProps(inputProps, focusProps),
537
+ ref: inputRef,
538
+ }),
539
+ }),
540
+ renderProps.children,
541
+ );
542
+ }