@proyecto-viviana/solidaria-components 0.5.0 → 0.7.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-APACHE-2.0 +201 -0
- package/NOTICE +91 -0
- package/README.md +4 -7
- package/dist/ActionBar.d.ts +2 -10
- package/dist/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar.js +95 -59
- package/dist/ActionBar.js.map +1 -1
- package/dist/ActionBar.jsx +42 -15
- package/dist/ActionBar.jsx.map +1 -1
- package/dist/ActionGroup.d.ts +1 -12
- package/dist/ActionGroup.d.ts.map +1 -1
- package/dist/ActionGroup.js +66 -44
- package/dist/ActionGroup.js.map +1 -1
- package/dist/ActionGroup.jsx +25 -10
- package/dist/ActionGroup.jsx.map +1 -1
- package/dist/Alert.d.ts +4 -1
- package/dist/Alert.d.ts.map +1 -1
- package/dist/Alert.js +25 -17
- package/dist/Alert.js.map +1 -1
- package/dist/Alert.jsx +9 -5
- package/dist/Alert.jsx.map +1 -1
- package/dist/Autocomplete.d.ts +2 -9
- package/dist/Autocomplete.d.ts.map +1 -1
- package/dist/Autocomplete.js +18 -5
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Autocomplete.jsx +20 -7
- package/dist/Autocomplete.jsx.map +1 -1
- package/dist/Breadcrumbs.d.ts +2 -7
- package/dist/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs.js +71 -51
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/Breadcrumbs.jsx +25 -12
- package/dist/Breadcrumbs.jsx.map +1 -1
- package/dist/Button.d.ts +1 -7
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +125 -72
- package/dist/Button.js.map +1 -1
- package/dist/Button.jsx +105 -43
- package/dist/Button.jsx.map +1 -1
- package/dist/Calendar.d.ts +1 -7
- package/dist/Calendar.d.ts.map +1 -1
- package/dist/Calendar.js +297 -221
- package/dist/Calendar.js.map +1 -1
- package/dist/Calendar.jsx +52 -32
- package/dist/Calendar.jsx.map +1 -1
- package/dist/CalendarPicker.d.ts +1 -10
- package/dist/CalendarPicker.d.ts.map +1 -1
- package/dist/CalendarPicker.js +12 -0
- package/dist/CalendarPicker.js.map +1 -1
- package/dist/CalendarPicker.jsx +12 -0
- package/dist/CalendarPicker.jsx.map +1 -1
- package/dist/Checkbox.d.ts +2 -7
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +332 -270
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox.jsx +70 -77
- package/dist/Checkbox.jsx.map +1 -1
- package/dist/Collection.d.ts +33 -7
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +128 -74
- package/dist/Collection.js.map +1 -1
- package/dist/Collection.jsx +46 -7
- package/dist/Collection.jsx.map +1 -1
- package/dist/Color.d.ts +15 -20
- package/dist/Color.d.ts.map +1 -1
- package/dist/Color.js +572 -334
- package/dist/Color.js.map +1 -1
- package/dist/Color.jsx +205 -85
- package/dist/Color.jsx.map +1 -1
- package/dist/ColorEditor.d.ts +3 -1
- package/dist/ColorEditor.d.ts.map +1 -1
- package/dist/ColorEditor.js +147 -124
- package/dist/ColorEditor.js.map +1 -1
- package/dist/ColorEditor.jsx +4 -1
- package/dist/ColorEditor.jsx.map +1 -1
- package/dist/ComboBox.d.ts +31 -10
- package/dist/ComboBox.d.ts.map +1 -1
- package/dist/ComboBox.js +539 -274
- package/dist/ComboBox.js.map +1 -1
- package/dist/ComboBox.jsx +213 -70
- package/dist/ComboBox.jsx.map +1 -1
- package/dist/ContextualHelpTrigger.d.ts +1 -7
- package/dist/ContextualHelpTrigger.d.ts.map +1 -1
- package/dist/ContextualHelpTrigger.js +102 -72
- package/dist/ContextualHelpTrigger.js.map +1 -1
- package/dist/ContextualHelpTrigger.jsx +36 -16
- package/dist/ContextualHelpTrigger.jsx.map +1 -1
- package/dist/DateField.d.ts +2 -7
- package/dist/DateField.d.ts.map +1 -1
- package/dist/DateField.js +0 -2
- package/dist/DateField.jsx +0 -2
- package/dist/DateField2.js +194 -179
- package/dist/DateField2.js.map +1 -1
- package/dist/DateField2.jsx +58 -55
- package/dist/DateField2.jsx.map +1 -1
- package/dist/DatePicker.d.ts +7 -7
- package/dist/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker.js +2 -2
- package/dist/DatePicker.jsx +2 -2
- package/dist/DatePicker2.js +357 -435
- package/dist/DatePicker2.js.map +1 -1
- package/dist/DatePicker2.jsx +109 -178
- package/dist/DatePicker2.jsx.map +1 -1
- package/dist/DateRangePickerContext.d.ts +7 -0
- package/dist/DateRangePickerContext.d.ts.map +1 -1
- package/dist/Dialog.d.ts +4 -9
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +168 -101
- package/dist/Dialog.js.map +1 -1
- package/dist/Dialog.jsx +75 -27
- package/dist/Dialog.jsx.map +1 -1
- package/dist/Disclosure.d.ts +1 -9
- package/dist/Disclosure.d.ts.map +1 -1
- package/dist/Disclosure.js +121 -79
- package/dist/Disclosure.js.map +1 -1
- package/dist/Disclosure.jsx +32 -19
- package/dist/Disclosure.jsx.map +1 -1
- package/dist/DragAndDrop.d.ts +9 -6
- package/dist/DragAndDrop.d.ts.map +1 -1
- package/dist/DragAndDrop.js +37 -22
- package/dist/DragAndDrop.js.map +1 -1
- package/dist/DragAndDrop.jsx +20 -4
- package/dist/DragAndDrop.jsx.map +1 -1
- package/dist/DragPreview.d.ts +1 -1
- package/dist/DragPreview.d.ts.map +1 -1
- package/dist/DropZone.d.ts +1 -7
- package/dist/DropZone.d.ts.map +1 -1
- package/dist/DropZone.js +74 -40
- package/dist/DropZone.js.map +1 -1
- package/dist/DropZone.jsx +24 -8
- package/dist/DropZone.jsx.map +1 -1
- package/dist/ElementTag.d.ts +9 -20
- package/dist/ElementTag.d.ts.map +1 -1
- package/dist/ElementTag.js +8 -210
- package/dist/ElementTag.js.map +1 -1
- package/dist/ElementTag.jsx +8 -57
- package/dist/ElementTag.jsx.map +1 -1
- package/dist/FieldError.d.ts +8 -7
- package/dist/FieldError.d.ts.map +1 -1
- package/dist/FieldError.js +33 -13
- package/dist/FieldError.js.map +1 -1
- package/dist/FieldError.jsx +20 -5
- package/dist/FieldError.jsx.map +1 -1
- package/dist/FileTrigger.d.ts +1 -7
- package/dist/FileTrigger.d.ts.map +1 -1
- package/dist/FileTrigger.js +30 -12
- package/dist/FileTrigger.js.map +1 -1
- package/dist/FileTrigger.jsx +15 -2
- package/dist/FileTrigger.jsx.map +1 -1
- package/dist/Focusable.d.ts +2 -8
- package/dist/Focusable.d.ts.map +1 -1
- package/dist/Focusable.js +23 -6
- package/dist/Focusable.js.map +1 -1
- package/dist/Focusable.jsx +22 -5
- package/dist/Focusable.jsx.map +1 -1
- package/dist/Form.d.ts +9 -8
- package/dist/Form.d.ts.map +1 -1
- package/dist/Form.js +66 -43
- package/dist/Form.js.map +1 -1
- package/dist/Form.jsx +36 -16
- package/dist/Form.jsx.map +1 -1
- package/dist/GridList.d.ts +5 -10
- package/dist/GridList.d.ts.map +1 -1
- package/dist/GridList.js +372 -243
- package/dist/GridList.js.map +1 -1
- package/dist/GridList.jsx +177 -99
- package/dist/GridList.jsx.map +1 -1
- package/dist/HiddenDateInput.d.ts +1 -7
- package/dist/HiddenDateInput.d.ts.map +1 -1
- package/dist/Icon.d.ts +4 -1
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +41 -37
- package/dist/Icon.js.map +1 -1
- package/dist/Icon.jsx +7 -3
- package/dist/Icon.jsx.map +1 -1
- package/dist/Keyboard.d.ts +1 -7
- package/dist/Keyboard.d.ts.map +1 -1
- package/dist/Keyboard.js +24 -11
- package/dist/Keyboard.js.map +1 -1
- package/dist/Keyboard.jsx +15 -2
- package/dist/Keyboard.jsx.map +1 -1
- package/dist/Label.d.ts +20 -0
- package/dist/Label.d.ts.map +1 -0
- package/dist/Label.js +60 -0
- package/dist/Label.js.map +1 -0
- package/dist/Label.jsx +47 -0
- package/dist/Label.jsx.map +1 -0
- package/dist/Landmark.d.ts +4 -1
- package/dist/Landmark.d.ts.map +1 -1
- package/dist/Landmark.js +10 -4
- package/dist/Landmark.js.map +1 -1
- package/dist/Landmark.jsx +5 -1
- package/dist/Landmark.jsx.map +1 -1
- package/dist/Link.d.ts +2 -7
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +56 -36
- package/dist/Link.js.map +1 -1
- package/dist/Link.jsx +52 -10
- package/dist/Link.jsx.map +1 -1
- package/dist/ListBox.d.ts +17 -13
- package/dist/ListBox.d.ts.map +1 -1
- package/dist/ListBox.js +647 -348
- package/dist/ListBox.js.map +1 -1
- package/dist/ListBox.jsx +339 -236
- package/dist/ListBox.jsx.map +1 -1
- package/dist/ListDropTargetDelegate.d.ts +3 -0
- package/dist/ListDropTargetDelegate.d.ts.map +1 -1
- package/dist/Menu.d.ts +39 -30
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +547 -368
- package/dist/Menu.js.map +1 -1
- package/dist/Menu.jsx +328 -230
- package/dist/Menu.jsx.map +1 -1
- package/dist/Meter.d.ts +6 -13
- package/dist/Meter.d.ts.map +1 -1
- package/dist/Meter.js +55 -18
- package/dist/Meter.js.map +1 -1
- package/dist/Meter.jsx +33 -8
- package/dist/Meter.jsx.map +1 -1
- package/dist/Modal.d.ts +1 -7
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.js +104 -56
- package/dist/Modal.js.map +1 -1
- package/dist/Modal.jsx +68 -38
- package/dist/Modal.jsx.map +1 -1
- package/dist/NumberField.d.ts +4 -7
- package/dist/NumberField.d.ts.map +1 -1
- package/dist/NumberField.js +243 -124
- package/dist/NumberField.js.map +1 -1
- package/dist/NumberField.jsx +115 -26
- package/dist/NumberField.jsx.map +1 -1
- package/dist/Popover.d.ts +15 -7
- package/dist/Popover.d.ts.map +1 -1
- package/dist/Popover.js +370 -181
- package/dist/Popover.js.map +1 -1
- package/dist/Popover.jsx +215 -82
- package/dist/Popover.jsx.map +1 -1
- package/dist/Pressable.d.ts +2 -8
- package/dist/Pressable.d.ts.map +1 -1
- package/dist/Pressable.js +23 -6
- package/dist/Pressable.js.map +1 -1
- package/dist/Pressable.jsx +22 -5
- package/dist/Pressable.jsx.map +1 -1
- package/dist/PreviewTrigger.d.ts +24 -0
- package/dist/PreviewTrigger.d.ts.map +1 -0
- package/dist/PreviewTrigger.js +128 -0
- package/dist/PreviewTrigger.js.map +1 -0
- package/dist/PreviewTrigger.jsx +117 -0
- package/dist/PreviewTrigger.jsx.map +1 -0
- package/dist/ProgressBar.d.ts +1 -7
- package/dist/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar.js +34 -14
- package/dist/ProgressBar.js.map +1 -1
- package/dist/ProgressBar.jsx +17 -3
- package/dist/ProgressBar.jsx.map +1 -1
- package/dist/RadioGroup.d.ts +2 -7
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +388 -269
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioGroup.jsx +110 -99
- package/dist/RadioGroup.jsx.map +1 -1
- package/dist/RangeCalendar.d.ts +3 -7
- package/dist/RangeCalendar.d.ts.map +1 -1
- package/dist/RangeCalendar.js +271 -202
- package/dist/RangeCalendar.js.map +1 -1
- package/dist/RangeCalendar.jsx +56 -37
- package/dist/RangeCalendar.jsx.map +1 -1
- package/dist/RouterProvider.d.ts +3 -9
- package/dist/RouterProvider.d.ts.map +1 -1
- package/dist/RouterProvider.js +15 -14
- package/dist/RouterProvider.js.map +1 -1
- package/dist/RouterProvider.jsx +14 -13
- package/dist/RouterProvider.jsx.map +1 -1
- package/dist/SearchField.d.ts +4 -7
- package/dist/SearchField.d.ts.map +1 -1
- package/dist/SearchField.js +191 -164
- package/dist/SearchField.js.map +1 -1
- package/dist/SearchField.jsx +69 -62
- package/dist/SearchField.jsx.map +1 -1
- package/dist/Select.d.ts +5 -10
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +565 -359
- package/dist/Select.js.map +1 -1
- package/dist/Select.jsx +281 -161
- package/dist/Select.jsx.map +1 -1
- package/dist/SelectionIndicator.d.ts +1 -4
- package/dist/SelectionIndicator.d.ts.map +1 -1
- package/dist/SelectionIndicator.js +29 -13
- package/dist/SelectionIndicator.js.map +1 -1
- package/dist/SelectionIndicator.jsx +18 -4
- package/dist/SelectionIndicator.jsx.map +1 -1
- package/dist/Separator.d.ts +1 -7
- package/dist/Separator.d.ts.map +1 -1
- package/dist/Separator.js +22 -6
- package/dist/Separator.js.map +1 -1
- package/dist/Separator.jsx +16 -3
- package/dist/Separator.jsx.map +1 -1
- package/dist/SharedElementTransition.d.ts +1 -10
- package/dist/SharedElementTransition.d.ts.map +1 -1
- package/dist/SharedElementTransition.js +68 -40
- package/dist/SharedElementTransition.js.map +1 -1
- package/dist/SharedElementTransition.jsx +49 -25
- package/dist/SharedElementTransition.jsx.map +1 -1
- package/dist/Slider.d.ts +2 -8
- package/dist/Slider.d.ts.map +1 -1
- package/dist/Slider.js +155 -97
- package/dist/Slider.js.map +1 -1
- package/dist/Slider.jsx +25 -12
- package/dist/Slider.jsx.map +1 -1
- package/dist/StepList.d.ts +1 -7
- package/dist/StepList.d.ts.map +1 -1
- package/dist/StepList.js +112 -68
- package/dist/StepList.js.map +1 -1
- package/dist/StepList.jsx +58 -20
- package/dist/StepList.jsx.map +1 -1
- package/dist/Switch.d.ts +2 -9
- package/dist/Switch.d.ts.map +1 -1
- package/dist/Switch.js +164 -114
- package/dist/Switch.js.map +1 -1
- package/dist/Switch.jsx +26 -13
- package/dist/Switch.jsx.map +1 -1
- package/dist/Table.d.ts +2 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +689 -592
- package/dist/Table.js.map +1 -1
- package/dist/Table.jsx +317 -237
- package/dist/Table.jsx.map +1 -1
- package/dist/Tabs.d.ts +2 -7
- package/dist/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +278 -293
- package/dist/Tabs.js.map +1 -1
- package/dist/Tabs.jsx +68 -66
- package/dist/Tabs.jsx.map +1 -1
- package/dist/TagGroup.d.ts +4 -11
- package/dist/TagGroup.d.ts.map +1 -1
- package/dist/TagGroup.js +153 -115
- package/dist/TagGroup.js.map +1 -1
- package/dist/TagGroup.jsx +37 -24
- package/dist/TagGroup.jsx.map +1 -1
- package/dist/Text.d.ts +3 -3
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +24 -7
- package/dist/Text.js.map +1 -1
- package/dist/Text.jsx +17 -5
- package/dist/Text.jsx.map +1 -1
- package/dist/TextField.d.ts +3 -16
- package/dist/TextField.d.ts.map +1 -1
- package/dist/TextField.js +104 -129
- package/dist/TextField.js.map +1 -1
- package/dist/TextField.jsx +76 -102
- package/dist/TextField.jsx.map +1 -1
- package/dist/TimeField.d.ts +2 -15
- package/dist/TimeField.d.ts.map +1 -1
- package/dist/TimeField.js +86 -102
- package/dist/TimeField.js.map +1 -1
- package/dist/TimeField.jsx +32 -49
- package/dist/TimeField.jsx.map +1 -1
- package/dist/Toast.d.ts +10 -13
- package/dist/Toast.d.ts.map +1 -1
- package/dist/Toast.js +209 -108
- package/dist/Toast.js.map +1 -1
- package/dist/Toast.jsx +127 -22
- package/dist/Toast.jsx.map +1 -1
- package/dist/ToggleButton.d.ts +1 -7
- package/dist/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton.js +57 -35
- package/dist/ToggleButton.js.map +1 -1
- package/dist/ToggleButton.jsx +26 -12
- package/dist/ToggleButton.jsx.map +1 -1
- package/dist/ToggleButtonGroup.d.ts +1 -7
- package/dist/ToggleButtonGroup.d.ts.map +1 -1
- package/dist/ToggleButtonGroup.js +59 -44
- package/dist/ToggleButtonGroup.js.map +1 -1
- package/dist/ToggleButtonGroup.jsx +25 -12
- package/dist/ToggleButtonGroup.jsx.map +1 -1
- package/dist/TokenField.d.ts +52 -0
- package/dist/TokenField.d.ts.map +1 -0
- package/dist/TokenField.js +301 -0
- package/dist/TokenField.js.map +1 -0
- package/dist/TokenField.jsx +197 -0
- package/dist/TokenField.jsx.map +1 -0
- package/dist/Toolbar.d.ts +2 -7
- package/dist/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar.js +35 -16
- package/dist/Toolbar.js.map +1 -1
- package/dist/Toolbar.jsx +15 -2
- package/dist/Toolbar.jsx.map +1 -1
- package/dist/Tooltip.d.ts +2 -7
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js +105 -68
- package/dist/Tooltip.js.map +1 -1
- package/dist/Tooltip.jsx +60 -36
- package/dist/Tooltip.jsx.map +1 -1
- package/dist/Tree.d.ts +8 -11
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +486 -339
- package/dist/Tree.js.map +1 -1
- package/dist/Tree.jsx +155 -107
- package/dist/Tree.jsx.map +1 -1
- package/dist/Virtualizer.d.ts +39 -9
- package/dist/Virtualizer.d.ts.map +1 -1
- package/dist/Virtualizer.js +2 -2
- package/dist/Virtualizer.jsx +2 -2
- package/dist/Virtualizer2.js +491 -136
- package/dist/Virtualizer2.js.map +1 -1
- package/dist/Virtualizer2.jsx +455 -122
- package/dist/Virtualizer2.jsx.map +1 -1
- package/dist/VirtualizerLayouts.d.ts +55 -2
- package/dist/VirtualizerLayouts.d.ts.map +1 -1
- package/dist/VisuallyHidden.d.ts +4 -3
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +18 -11
- package/dist/VisuallyHidden.js.map +1 -1
- package/dist/VisuallyHidden.jsx +15 -9
- package/dist/VisuallyHidden.jsx.map +1 -1
- package/dist/contexts.d.ts +25 -0
- package/dist/contexts.d.ts.map +1 -1
- package/dist/contexts.js +3 -0
- package/dist/contexts.js.map +1 -1
- package/dist/contexts.jsx +3 -0
- package/dist/contexts.jsx.map +1 -1
- package/dist/index.d.ts +11 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -11
- package/dist/index.jsx +14 -11
- package/dist/intl/index.d.ts +16 -0
- package/dist/intl/index.d.ts.map +1 -0
- package/dist/intl.js +212 -0
- package/dist/intl.js.map +1 -0
- package/dist/intl.jsx +212 -0
- package/dist/intl.jsx.map +1 -0
- package/dist/useDragAndDrop.d.ts +4 -2
- package/dist/useDragAndDrop.d.ts.map +1 -1
- package/dist/useDragAndDrop2.js +39 -21
- package/dist/useDragAndDrop2.js.map +1 -1
- package/dist/useDragAndDrop2.jsx +39 -21
- package/dist/useDragAndDrop2.jsx.map +1 -1
- package/dist/utils.d.ts +28 -9
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +96 -24
- package/dist/utils.js.map +1 -1
- package/dist/utils.jsx +81 -24
- package/dist/utils.jsx.map +1 -1
- package/dist/virtualizer/Layout.d.ts +9 -0
- package/dist/virtualizer/Layout.d.ts.map +1 -1
- package/dist/virtualizer/Layout.js +23 -2
- package/dist/virtualizer/Layout.js.map +1 -1
- package/dist/virtualizer/Layout.jsx +23 -2
- package/dist/virtualizer/Layout.jsx.map +1 -1
- package/package.json +29 -10
- package/src/ActionBar.tsx +50 -24
- package/src/ActionGroup.tsx +31 -19
- package/src/Alert.tsx +10 -4
- package/src/Autocomplete.tsx +24 -15
- package/src/Breadcrumbs.tsx +32 -16
- package/src/Button.tsx +182 -67
- package/src/Calendar.tsx +65 -47
- package/src/CalendarPicker.tsx +16 -1
- package/src/Checkbox.tsx +84 -116
- package/src/Collection.tsx +84 -3
- package/src/Color.tsx +282 -104
- package/src/ColorEditor.tsx +5 -1
- package/src/ComboBox.tsx +384 -109
- package/src/ContextualHelpTrigger.tsx +47 -41
- package/src/DateField.tsx +74 -106
- package/src/DatePicker.tsx +156 -352
- package/src/DateRangePickerContext.tsx +8 -0
- package/src/Dialog.tsx +105 -38
- package/src/Disclosure.tsx +29 -19
- package/src/DragAndDrop.tsx +43 -8
- package/src/DragPreview.tsx +20 -1
- package/src/DropZone.tsx +32 -18
- package/src/ElementTag.tsx +14 -104
- package/src/FieldError.tsx +39 -7
- package/src/FileTrigger.tsx +18 -3
- package/src/Focusable.tsx +27 -6
- package/src/Form.tsx +57 -11
- package/src/GridList.tsx +233 -141
- package/src/HiddenDateInput.tsx +19 -3
- package/src/Icon.tsx +8 -2
- package/src/Keyboard.tsx +18 -2
- package/src/Label.tsx +77 -0
- package/src/Landmark.tsx +6 -1
- package/src/Link.tsx +65 -19
- package/src/ListBox.tsx +645 -468
- package/src/ListDropTargetDelegate.ts +4 -0
- package/src/Menu.tsx +512 -349
- package/src/Meter.tsx +42 -8
- package/src/Modal.tsx +85 -42
- package/src/NumberField.tsx +161 -48
- package/src/Popover.tsx +424 -148
- package/src/Pressable.tsx +27 -6
- package/src/PreviewTrigger.tsx +171 -0
- package/src/ProgressBar.tsx +25 -3
- package/src/RadioGroup.tsx +230 -161
- package/src/RangeCalendar.tsx +75 -63
- package/src/RouterProvider.tsx +24 -14
- package/src/SearchField.tsx +118 -121
- package/src/Select.tsx +454 -274
- package/src/SelectionIndicator.tsx +21 -3
- package/src/Separator.tsx +17 -1
- package/src/SharedElementTransition.tsx +115 -97
- package/src/Slider.tsx +35 -17
- package/src/StepList.tsx +71 -32
- package/src/Switch.tsx +45 -29
- package/src/Table.tsx +446 -380
- package/src/Tabs.tsx +132 -155
- package/src/TagGroup.tsx +53 -40
- package/src/Text.tsx +23 -6
- package/src/TextField.tsx +118 -159
- package/src/TimeField.tsx +34 -95
- package/src/Toast.tsx +141 -67
- package/src/ToggleButton.tsx +33 -15
- package/src/ToggleButtonGroup.tsx +27 -9
- package/src/TokenField.tsx +379 -0
- package/src/Toolbar.tsx +19 -9
- package/src/Tooltip.tsx +126 -84
- package/src/Tree.tsx +233 -173
- package/src/Virtualizer.tsx +400 -138
- package/src/VirtualizerLayouts.ts +211 -26
- package/src/VisuallyHidden.tsx +22 -8
- package/src/contexts.ts +13 -0
- package/src/index.ts +32 -11
- package/src/intl/ar-AE.json +6 -0
- package/src/intl/bg-BG.json +6 -0
- package/src/intl/cs-CZ.json +6 -0
- package/src/intl/da-DK.json +6 -0
- package/src/intl/de-DE.json +6 -0
- package/src/intl/el-GR.json +6 -0
- package/src/intl/en-US.json +6 -0
- package/src/intl/es-ES.json +6 -0
- package/src/intl/et-EE.json +6 -0
- package/src/intl/fi-FI.json +6 -0
- package/src/intl/fr-FR.json +6 -0
- package/src/intl/he-IL.json +6 -0
- package/src/intl/hr-HR.json +6 -0
- package/src/intl/hu-HU.json +6 -0
- package/src/intl/index.ts +125 -0
- package/src/intl/it-IT.json +6 -0
- package/src/intl/ja-JP.json +6 -0
- package/src/intl/ko-KR.json +6 -0
- package/src/intl/lt-LT.json +6 -0
- package/src/intl/lv-LV.json +6 -0
- package/src/intl/nb-NO.json +6 -0
- package/src/intl/nl-NL.json +6 -0
- package/src/intl/pl-PL.json +6 -0
- package/src/intl/pt-BR.json +6 -0
- package/src/intl/pt-PT.json +6 -0
- package/src/intl/ro-RO.json +6 -0
- package/src/intl/ru-RU.json +6 -0
- package/src/intl/sk-SK.json +6 -0
- package/src/intl/sl-SI.json +6 -0
- package/src/intl/sr-SP.json +6 -0
- package/src/intl/sv-SE.json +6 -0
- package/src/intl/tr-TR.json +6 -0
- package/src/intl/uk-UA.json +6 -0
- package/src/intl/zh-CN.json +6 -0
- package/src/intl/zh-TW.json +6 -0
- package/src/useDragAndDrop.ts +30 -32
- package/src/utils.tsx +124 -68
- package/src/virtualizer/Layout.ts +29 -0
package/dist/TimeField.js
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/DateField.tsx
|
|
13
|
+
import { Provider, dataAttr, useRenderProps } from "./utils.js";
|
|
2
14
|
import { TextContext } from "./Text.js";
|
|
3
|
-
import { FormContext } from "./Form.js";
|
|
15
|
+
import { FormContext, resolveValidationBehavior } from "./Form.js";
|
|
4
16
|
import { n as DateFieldContext, o as DateFieldStateContext } from "./DateField2.js";
|
|
5
|
-
import { className, createComponent, effect, getNextElement, insert,
|
|
6
|
-
import {
|
|
7
|
-
import { createTimeField, mergeProps as mergeProps$
|
|
17
|
+
import { className, createComponent, effect, getNextElement, insert, readShallow, ref, runHydrationEvents, scope, setAttribute, spread, style, template } from "@solidjs/web";
|
|
18
|
+
import { createContext, createMemo, createSignal, useContext } from "solid-js";
|
|
19
|
+
import { createTimeField, mergeProps as mergeProps$1 } from "@proyecto-viviana/solidaria";
|
|
20
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
8
21
|
import { access, createTimeFieldState } from "@proyecto-viviana/solid-stately";
|
|
9
22
|
//#region src/TimeField.tsx
|
|
10
23
|
/**
|
|
11
24
|
* TimeField component for solidaria-components
|
|
12
25
|
*
|
|
13
|
-
* Pre-wired headless time field.
|
|
14
|
-
*
|
|
26
|
+
* Pre-wired headless time field. The pinned TimeField implementation does not
|
|
27
|
+
* define its own segment primitives. It reuses
|
|
15
28
|
* `DateInput`/`DateSegment` (there is no `TimeInput`/`TimeSegment` upstream).
|
|
16
29
|
* `TimeFieldState` IS a `DateFieldState` (plus `timeValue`), so this component
|
|
17
30
|
* drives the certified DateField segment/group stack directly: it provides the
|
|
@@ -21,36 +34,10 @@ import { access, createTimeFieldState } from "@proyecto-viviana/solid-stately";
|
|
|
21
34
|
* TimeField renders none); its native-validation `<input>` is still emitted by
|
|
22
35
|
* the inner DateInput sibling.
|
|
23
36
|
*/
|
|
24
|
-
var _tmpl$ =
|
|
37
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
38
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<span>`);
|
|
25
39
|
const TimeFieldContext = createContext(null);
|
|
26
40
|
const TimeFieldStateContext = createContext(null);
|
|
27
|
-
function withFormValidationBehavior(props, formContext) {
|
|
28
|
-
if (!formContext?.validationBehavior) return props;
|
|
29
|
-
return new Proxy(props, {
|
|
30
|
-
get(target, property, receiver) {
|
|
31
|
-
const localValue = Reflect.get(target, property, receiver);
|
|
32
|
-
if (property === "validationBehavior" && localValue === void 0) return formContext.validationBehavior;
|
|
33
|
-
return localValue;
|
|
34
|
-
},
|
|
35
|
-
has(target, property) {
|
|
36
|
-
return Reflect.has(target, property) || property === "validationBehavior" && formContext.validationBehavior !== void 0;
|
|
37
|
-
},
|
|
38
|
-
ownKeys(target) {
|
|
39
|
-
const keys = new Set(Reflect.ownKeys(target));
|
|
40
|
-
if (formContext.validationBehavior !== void 0) keys.add("validationBehavior");
|
|
41
|
-
return Array.from(keys);
|
|
42
|
-
},
|
|
43
|
-
getOwnPropertyDescriptor(target, property) {
|
|
44
|
-
const descriptor = Reflect.getOwnPropertyDescriptor(target, property);
|
|
45
|
-
if (descriptor) return descriptor;
|
|
46
|
-
if (property === "validationBehavior" && formContext.validationBehavior !== void 0) return {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
configurable: true,
|
|
49
|
-
get: () => formContext.validationBehavior
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
41
|
function useTimeFieldContextValue() {
|
|
55
42
|
const context = useContext(TimeFieldContext);
|
|
56
43
|
if (!context) throw new Error("TimeField components must be used within a TimeField");
|
|
@@ -73,25 +60,14 @@ function useTimeFieldContext() {
|
|
|
73
60
|
* ```
|
|
74
61
|
*/
|
|
75
62
|
function TimeField(props) {
|
|
76
|
-
|
|
77
|
-
const formContext = useContext(FormContext);
|
|
78
|
-
return createComponent(Show, {
|
|
79
|
-
get when() {
|
|
80
|
-
return isHydrated();
|
|
81
|
-
},
|
|
82
|
-
get fallback() {
|
|
83
|
-
return getNextElement(_tmpl$);
|
|
84
|
-
},
|
|
85
|
-
get children() {
|
|
86
|
-
return createComponent(TimeFieldInner, mergeProps(props, { __formContext: formContext }));
|
|
87
|
-
}
|
|
88
|
-
});
|
|
63
|
+
return createComponent(TimeFieldInner, props);
|
|
89
64
|
}
|
|
90
65
|
/**
|
|
91
66
|
* Internal TimeField component that renders after client mount.
|
|
92
67
|
*/
|
|
93
68
|
function TimeFieldInner(props) {
|
|
94
|
-
const
|
|
69
|
+
const formContext = props.__formContext ?? useContext(FormContext);
|
|
70
|
+
const [local, stateProps, rest] = splitProps(props, [
|
|
95
71
|
"children",
|
|
96
72
|
"class",
|
|
97
73
|
"style",
|
|
@@ -127,7 +103,7 @@ function TimeFieldInner(props) {
|
|
|
127
103
|
isDisabled: access(stateProps.isDisabled),
|
|
128
104
|
isReadOnly: access(stateProps.isReadOnly),
|
|
129
105
|
isRequired: access(stateProps.isRequired),
|
|
130
|
-
validationBehavior: stateProps.validationBehavior
|
|
106
|
+
validationBehavior: resolveValidationBehavior(stateProps.validationBehavior, formContext),
|
|
131
107
|
description: stateProps.description,
|
|
132
108
|
errorMessage: stateProps.errorMessage,
|
|
133
109
|
inputRef: () => validationInputRef() ?? void 0
|
|
@@ -163,7 +139,7 @@ function TimeFieldInner(props) {
|
|
|
163
139
|
return fieldAria.fieldProps;
|
|
164
140
|
},
|
|
165
141
|
get hiddenInputProps() {
|
|
166
|
-
return mergeProps$
|
|
142
|
+
return mergeProps$1(fieldAria.inputProps, { ref: setValidationInputRef });
|
|
167
143
|
},
|
|
168
144
|
get descriptionProps() {
|
|
169
145
|
return fieldAria.descriptionProps;
|
|
@@ -173,16 +149,16 @@ function TimeFieldInner(props) {
|
|
|
173
149
|
}
|
|
174
150
|
}
|
|
175
151
|
};
|
|
176
|
-
return createComponent(TimeFieldStateContext
|
|
152
|
+
return createComponent(TimeFieldStateContext, {
|
|
177
153
|
value: state,
|
|
178
154
|
get children() {
|
|
179
|
-
return createComponent(DateFieldStateContext
|
|
155
|
+
return createComponent(DateFieldStateContext, {
|
|
180
156
|
value: state,
|
|
181
157
|
get children() {
|
|
182
|
-
return createComponent(DateFieldContext
|
|
158
|
+
return createComponent(DateFieldContext, {
|
|
183
159
|
value: dateFieldContextValue,
|
|
184
160
|
get children() {
|
|
185
|
-
return createComponent(TimeFieldContext
|
|
161
|
+
return createComponent(TimeFieldContext, {
|
|
186
162
|
value: {
|
|
187
163
|
state,
|
|
188
164
|
aria: {
|
|
@@ -201,32 +177,34 @@ function TimeFieldInner(props) {
|
|
|
201
177
|
}
|
|
202
178
|
},
|
|
203
179
|
get children() {
|
|
204
|
-
var _el$
|
|
205
|
-
|
|
206
|
-
|
|
180
|
+
var _el$ = getNextElement(_tmpl$);
|
|
181
|
+
ref(() => {
|
|
182
|
+
return setFieldRef;
|
|
183
|
+
}, _el$);
|
|
184
|
+
insert(_el$, createComponent(Provider, {
|
|
207
185
|
values: [[TextContext, textSlots]],
|
|
208
186
|
get children() {
|
|
209
187
|
return local.children;
|
|
210
188
|
}
|
|
211
189
|
}));
|
|
212
|
-
effect((
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}, {
|
|
222
|
-
e
|
|
223
|
-
t
|
|
224
|
-
a
|
|
225
|
-
o
|
|
226
|
-
i
|
|
227
|
-
n
|
|
190
|
+
effect(() => {
|
|
191
|
+
return {
|
|
192
|
+
e: readShallow(renderProps.class()),
|
|
193
|
+
t: readShallow(renderProps.style()),
|
|
194
|
+
a: dataAttr(state.isDisabled()),
|
|
195
|
+
o: dataAttr(state.isReadOnly()),
|
|
196
|
+
i: dataAttr(state.isRequired()),
|
|
197
|
+
n: dataAttr(state.isInvalid())
|
|
198
|
+
};
|
|
199
|
+
}, ({ e, t, a, o, i, n }, _p$) => {
|
|
200
|
+
className(_el$, e, _p$?.e);
|
|
201
|
+
style(_el$, t, _p$?.t);
|
|
202
|
+
a !== _p$?.a && setAttribute(_el$, "data-disabled", a);
|
|
203
|
+
o !== _p$?.o && setAttribute(_el$, "data-readonly", o);
|
|
204
|
+
i !== _p$?.i && setAttribute(_el$, "data-required", i);
|
|
205
|
+
n !== _p$?.n && setAttribute(_el$, "data-invalid", n);
|
|
228
206
|
});
|
|
229
|
-
return _el
|
|
207
|
+
return _el$;
|
|
230
208
|
}
|
|
231
209
|
});
|
|
232
210
|
}
|
|
@@ -238,39 +216,45 @@ function TimeFieldInner(props) {
|
|
|
238
216
|
}
|
|
239
217
|
function TimeFieldLabel(props) {
|
|
240
218
|
const { aria } = useTimeFieldContextValue();
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return
|
|
249
|
-
})
|
|
219
|
+
var _el$2 = getNextElement(_tmpl$2);
|
|
220
|
+
spread(_el$2, [() => {
|
|
221
|
+
return aria.labelProps;
|
|
222
|
+
}, { get "class"() {
|
|
223
|
+
return props.class;
|
|
224
|
+
} }], true);
|
|
225
|
+
insert(_el$2, scope(() => {
|
|
226
|
+
return props.children;
|
|
227
|
+
}));
|
|
228
|
+
runHydrationEvents();
|
|
229
|
+
return _el$2;
|
|
250
230
|
}
|
|
251
231
|
function TimeFieldDescription(props) {
|
|
252
232
|
const { aria } = useTimeFieldContextValue();
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
return
|
|
261
|
-
})
|
|
233
|
+
var _el$3 = getNextElement(_tmpl$2);
|
|
234
|
+
spread(_el$3, [() => {
|
|
235
|
+
return aria.descriptionProps;
|
|
236
|
+
}, { get "class"() {
|
|
237
|
+
return props.class;
|
|
238
|
+
} }], true);
|
|
239
|
+
insert(_el$3, scope(() => {
|
|
240
|
+
return props.children;
|
|
241
|
+
}));
|
|
242
|
+
runHydrationEvents();
|
|
243
|
+
return _el$3;
|
|
262
244
|
}
|
|
263
245
|
function TimeFieldErrorMessage(props) {
|
|
264
246
|
const { aria } = useTimeFieldContextValue();
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
return
|
|
273
|
-
})
|
|
247
|
+
var _el$4 = getNextElement(_tmpl$2);
|
|
248
|
+
spread(_el$4, [() => {
|
|
249
|
+
return aria.errorMessageProps;
|
|
250
|
+
}, { get "class"() {
|
|
251
|
+
return props.class;
|
|
252
|
+
} }], true);
|
|
253
|
+
insert(_el$4, scope(() => {
|
|
254
|
+
return props.children;
|
|
255
|
+
}));
|
|
256
|
+
runHydrationEvents();
|
|
257
|
+
return _el$4;
|
|
274
258
|
}
|
|
275
259
|
//#endregion
|
|
276
260
|
export { TimeField, TimeFieldContext, TimeFieldDescription, TimeFieldErrorMessage, TimeFieldLabel, TimeFieldStateContext, useTimeFieldContext };
|
package/dist/TimeField.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeField.js","names":["JSX","Context","createContext","createMemo","createSignal","splitProps","useContext","Show","createTimeField","mergeProps","AriaTimeFieldProps","createTimeFieldState","access","TimeFieldState","TimeFieldStateProps","TimeSegment","TimeSegmentType","TimeValue","DateFieldContext","DateFieldStateContext","DateFieldContextValue","ClassNameOrFunction","StyleOrFunction","SlotProps","useRenderProps","dataAttr","useIsHydrated","Provider","TextContext","FormContext","FormProps","TimeFieldRenderProps","isDisabled","isReadOnly","isRequired","isInvalid","TimeFieldProps","Omit","T","children","Element","segment","class","style","locale","TimeFieldContextValue","state","aria","labelProps","Record","inputProps","descriptionProps","errorMessageProps","TimeFieldContext","TimeFieldStateContext","withFormValidationBehavior","props","P","formContext","validationBehavior","Proxy","get","target","property","receiver","localValue","Reflect","undefined","has","ownKeys","keys","Set","add","Array","from","getOwnPropertyDescriptor","descriptor","enumerable","configurable","useTimeFieldContextValue","context","Error","useTimeFieldContext","TimeField","isHydrated","_$createComponent","when","fallback","_$getNextElement","_tmpl$","TimeFieldInner","_$mergeProps","__formContext","TimeFieldInnerProps","mergedProps","local","stateProps","rest","fieldRef","setFieldRef","HTMLDivElement","validationInputRef","setValidationInputRef","HTMLInputElement","fieldAria","description","errorMessage","inputRef","renderValues","renderProps","defaultClassName","textSlots","slots","dateFieldContextValue","fieldProps","hiddenInputProps","ref","value","_el$2","_tmpl$2","_$use","_$insert","values","_$effect","_p$","_v$","_v$2","_v$3","_v$4","_v$5","_v$6","e","_$className","t","_$style","a","_$setAttribute","o","i","n","TimeFieldLabelProps","TimeFieldLabel","_el$3","_tmpl$3","_$spread","_$runHydrationEvents","TimeFieldDescriptionProps","TimeFieldDescription","_el$4","TimeFieldErrorMessageProps","TimeFieldErrorMessage","_el$5"],"sources":["../src/TimeField.tsx"],"sourcesContent":["/**\n * TimeField component for solidaria-components\n *\n * Pre-wired headless time field. Faithful port of react-aria-components'\n * TimeField, which does NOT define its own segment primitives — it reuses\n * `DateInput`/`DateSegment` (there is no `TimeInput`/`TimeSegment` upstream).\n * `TimeFieldState` IS a `DateFieldState` (plus `timeValue`), so this component\n * drives the certified DateField segment/group stack directly: it provides the\n * shared `DateFieldContext`/`DateFieldStateContext` that `DateInput`/`DateSegment`\n * read, plus a `TimeFieldContext` for the time-field label/description/error\n * chrome. Unlike DateField, TimeField renders NO root hidden autofill input (RAC\n * TimeField renders none); its native-validation `<input>` is still emitted by\n * the inner DateInput sibling.\n */\n\nimport {\n type JSX,\n type Context,\n createContext,\n createMemo,\n createSignal,\n splitProps,\n useContext,\n Show,\n} from \"solid-js\";\nimport { createTimeField, mergeProps, type AriaTimeFieldProps } from \"@proyecto-viviana/solidaria\";\nimport {\n createTimeFieldState,\n access,\n type TimeFieldState,\n type TimeFieldStateProps,\n type TimeSegment as TimeSegmentType,\n type TimeValue,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n DateFieldContext,\n DateFieldStateContext,\n type DateFieldContextValue,\n} from \"./DateField\";\nimport {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n dataAttr,\n useIsHydrated,\n Provider,\n} from \"./utils\";\nimport { TextContext } from \"./Text\";\nimport { FormContext, type FormProps } from \"./Form\";\n\nexport interface TimeFieldRenderProps {\n /** Whether the field is disabled. */\n isDisabled: boolean;\n /** Whether the field is read-only. */\n isReadOnly: boolean;\n /** Whether the field is required. */\n isRequired: boolean;\n /** Whether the field is invalid. */\n isInvalid: boolean;\n}\n\nexport interface TimeFieldProps<T extends TimeValue = TimeValue>\n extends\n Omit<AriaTimeFieldProps, \"id\" | \"isDisabled\" | \"isReadOnly\" | \"isRequired\">,\n Omit<TimeFieldStateProps<T>, \"locale\">,\n SlotProps {\n /** The children of the component. */\n children?: JSX.Element | ((segment: TimeSegmentType) => JSX.Element);\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TimeFieldRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TimeFieldRenderProps>;\n /** The locale to use for formatting. */\n locale?: string;\n}\n\nexport interface TimeFieldContextValue {\n state: TimeFieldState<TimeValue>;\n aria: {\n labelProps: Record<string, unknown>;\n inputProps: Record<string, unknown>;\n descriptionProps: Record<string, unknown>;\n errorMessageProps: Record<string, unknown>;\n };\n}\n\nexport const TimeFieldContext = createContext<TimeFieldContextValue | null>(null);\nexport const TimeFieldStateContext = createContext<TimeFieldState<TimeValue> | null>(null);\n\nfunction withFormValidationBehavior<P extends object>(props: P, formContext: FormProps | null): P {\n if (!formContext?.validationBehavior) {\n return props;\n }\n\n return new Proxy(props, {\n get(target, property, receiver) {\n const localValue = Reflect.get(target, property, receiver);\n if (property === \"validationBehavior\" && localValue === undefined) {\n return formContext.validationBehavior;\n }\n\n return localValue;\n },\n has(target, property) {\n return (\n Reflect.has(target, property) ||\n (property === \"validationBehavior\" && formContext.validationBehavior !== undefined)\n );\n },\n ownKeys(target) {\n const keys = new Set(Reflect.ownKeys(target));\n if (formContext.validationBehavior !== undefined) {\n keys.add(\"validationBehavior\");\n }\n\n return Array.from(keys);\n },\n getOwnPropertyDescriptor(target, property) {\n const descriptor = Reflect.getOwnPropertyDescriptor(target, property);\n if (descriptor) {\n return descriptor;\n }\n\n if (property === \"validationBehavior\" && formContext.validationBehavior !== undefined) {\n return {\n enumerable: true,\n configurable: true,\n get: () => formContext.validationBehavior,\n };\n }\n\n return undefined;\n },\n });\n}\n\nfunction useTimeFieldContextValue(): TimeFieldContextValue {\n const context = useContext(TimeFieldContext);\n if (!context) {\n throw new Error(\"TimeField components must be used within a TimeField\");\n }\n return context;\n}\n\nexport function useTimeFieldContext(): TimeFieldState<TimeValue> {\n return useTimeFieldContextValue().state;\n}\n\n/**\n * A time field allows users to enter and edit time values using a keyboard.\n *\n * @example\n * ```tsx\n * <TimeField label=\"Time\">\n * <Label>Time</Label>\n * <DateInput>\n * {(segment) => <DateSegment segment={segment} />}\n * </DateInput>\n * </TimeField>\n * ```\n */\nexport function TimeField<T extends TimeValue = TimeValue>(props: TimeFieldProps<T>): JSX.Element {\n // Use hydration-safe pattern for client-only rendering\n const isHydrated = useIsHydrated();\n const formContext = useContext(FormContext);\n\n return (\n <Show\n when={isHydrated()}\n fallback={\n <div class=\"solidaria-TimeField solidaria-TimeField--placeholder\" aria-hidden=\"true\" />\n }\n >\n <TimeFieldInner {...props} __formContext={formContext} />\n </Show>\n );\n}\n\ntype TimeFieldInnerProps<T extends TimeValue = TimeValue> = TimeFieldProps<T> & {\n __formContext?: FormProps | null;\n};\n\n/**\n * Internal TimeField component that renders after client mount.\n */\nfunction TimeFieldInner<T extends TimeValue = TimeValue>(\n props: TimeFieldInnerProps<T>,\n): JSX.Element {\n const formContext = props.__formContext ?? useContext(FormContext);\n const mergedProps = withFormValidationBehavior(props, formContext);\n const [local, stateProps, rest] = splitProps(\n mergedProps,\n [\"children\", \"class\", \"style\", \"slot\", \"__formContext\"],\n [\n \"value\",\n \"defaultValue\",\n \"onChange\",\n \"minValue\",\n \"maxValue\",\n \"isInvalid\",\n \"isDisabled\",\n \"isReadOnly\",\n \"isRequired\",\n \"locale\",\n \"granularity\",\n \"hourCycle\",\n \"hideTimeZone\",\n \"shouldForceLeadingZeros\",\n \"validationState\",\n \"validationBehavior\",\n \"validate\",\n \"description\",\n \"errorMessage\",\n \"placeholderValue\",\n ],\n );\n\n const [fieldRef, setFieldRef] = createSignal<HTMLDivElement | null>(null);\n // Ref to the hidden validation <input> (the DateInput's `<Input>` sibling).\n // Mirrors DateField: create it here, hand it to createTimeField below, and\n // attach it to the same input through the DateFieldContext getter.\n const [validationInputRef, setValidationInputRef] =\n createSignal<HTMLInputElement | null>(null);\n\n const state = createTimeFieldState(stateProps);\n\n const fieldAria = createTimeField(\n () => ({\n ...(rest as Record<string, unknown>),\n // RAC threads these props into both useTimeFieldState and useTimeField;\n // they live in `stateProps` here, so forward them for the field hook's\n // aria-disabled and the native validation <input> (type/required).\n isDisabled: access(stateProps.isDisabled),\n isReadOnly: access(stateProps.isReadOnly),\n isRequired: access(stateProps.isRequired),\n // Standalone default flips the hidden input to type=\"text\" so an empty\n // required value blocks HTML form submission (mirrors DateField).\n validationBehavior: stateProps.validationBehavior ?? \"native\",\n description: stateProps.description,\n errorMessage: stateProps.errorMessage,\n inputRef: () => validationInputRef() ?? undefined,\n }),\n state as unknown as TimeFieldState<TimeValue>,\n fieldRef,\n );\n\n const renderValues = createMemo<TimeFieldRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n isReadOnly: state.isReadOnly(),\n isRequired: state.isRequired(),\n isInvalid: state.isInvalid(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-TimeField\",\n },\n renderValues,\n );\n\n const textSlots = {\n slots: {\n get description() {\n return fieldAria.descriptionProps;\n },\n get errorMessage() {\n return fieldAria.errorMessageProps;\n },\n },\n };\n\n // The shared context read by the reused DateInput/DateSegment. Read through\n // getters so consumers see the LIVE memo values (createDescription appends the\n // value-description id via a deferred effect; a frozen snapshot would miss it).\n const dateFieldContextValue: DateFieldContextValue = {\n get state() {\n return state as unknown as DateFieldContextValue[\"state\"];\n },\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n // The segment group props (role=\"group\", aria-labelledby, unicode-bidi\n // isolate, arrow-key nav, focus-within handlers) are routed to the\n // DateInput element; the outer wrapper stays roleless.\n get inputProps() {\n return fieldAria.fieldProps;\n },\n // The native validation <input> props (type/hidden/required/onChange under\n // native validation), rendered as the DateInput's sibling. Thread the\n // validation-input ref so createTimeField's form-reset/validation wiring\n // resolves to the mounted element.\n get hiddenInputProps() {\n return mergeProps(fieldAria.inputProps, { ref: setValidationInputRef });\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n };\n\n return (\n <TimeFieldStateContext.Provider value={state as unknown as TimeFieldState<TimeValue>}>\n <DateFieldStateContext.Provider\n value={state as unknown as DateFieldContextValue[\"state\"]}\n >\n <DateFieldContext.Provider value={dateFieldContextValue}>\n <TimeFieldContext.Provider\n value={{\n state: state as unknown as TimeFieldState<TimeValue>,\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n get inputProps() {\n return fieldAria.fieldProps;\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n }}\n >\n <div\n ref={setFieldRef}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-readonly={dataAttr(state.isReadOnly())}\n data-required={dataAttr(state.isRequired())}\n data-invalid={dataAttr(state.isInvalid())}\n >\n <Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n {local.children as JSX.Element}\n </Provider>\n </div>\n {/*\n Unlike DateField, TimeField renders NO root hidden autofill input —\n RAC TimeField renders none (react-aria-components TimeField.mjs). The\n native-validation <input> is emitted by the inner DateInput sibling.\n */}\n </TimeFieldContext.Provider>\n </DateFieldContext.Provider>\n </DateFieldStateContext.Provider>\n </TimeFieldStateContext.Provider>\n );\n}\n\nexport interface TimeFieldLabelProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function TimeFieldLabel(props: TimeFieldLabelProps): JSX.Element {\n const { aria } = useTimeFieldContextValue();\n return (\n <span {...aria.labelProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport interface TimeFieldDescriptionProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function TimeFieldDescription(props: TimeFieldDescriptionProps): JSX.Element {\n const { aria } = useTimeFieldContextValue();\n return (\n <span {...aria.descriptionProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport interface TimeFieldErrorMessageProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function TimeFieldErrorMessage(props: TimeFieldErrorMessageProps): JSX.Element {\n const { aria } = useTimeFieldContextValue();\n return (\n <span {...aria.errorMessageProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport type { TimeFieldState, TimeSegmentType, TimeValue };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuFA,MAAaqD,mBAAmBnD,cAA4C,IAAI;AAChF,MAAaoD,wBAAwBpD,cAAgD,IAAI;AAEzF,SAASqD,2BAA6CC,OAAUE,aAAkC;CAChG,IAAI,CAACA,aAAaC,oBAChB,OAAOH;CAGT,OAAO,IAAII,MAAMJ,OAAO;EACtBK,IAAIC,QAAQC,UAAUC,UAAU;GAC9B,MAAMC,aAAaC,QAAQL,IAAIC,QAAQC,UAAUC,QAAQ;GACzD,IAAID,aAAa,wBAAwBE,eAAeE,KAAAA,GACtD,OAAOT,YAAYC;GAGrB,OAAOM;EACT;EACAG,IAAIN,QAAQC,UAAU;GACpB,OACEG,QAAQE,IAAIN,QAAQC,QAAQ,KAC3BA,aAAa,wBAAwBL,YAAYC,uBAAuBQ,KAAAA;EAE7E;EACAE,QAAQP,QAAQ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AASgC,yBAAyB;CAC1C,cAAA;EAAA,IAAAwE,QAAA/D,eAAAuD,OAAA;EAAAC,OAAAO,OAAA5D,iBACY5C,KAAKK,mBAAiB,EAAA,KAAA,WAAA;GAAA,OAASI,MAAMd;EAAK,EAAA,CAAA,GAAA,OAAA,IAAA;EAAA+E,OAAA8B,aACjD/F,MAAMjB,QAAQ;EAAA0G,mBAAA;EAAA,OAAAM;CAAA,EAAA,CAAA;AAGrB"}
|
|
1
|
+
{"version":3,"file":"TimeField.js","names":["<TimeFieldInner {...props} />","<TimeFieldStateContext value={state as unknown as TimeFieldState<TimeValue>}>\n <DateFieldStateContext value={state as unknown as DateFieldContextValue[\"state\"]}>\n <DateFieldContext value={dateFieldContextValue}>\n <TimeFieldContext\n value={{\n state: state as unknown as TimeFieldState<TimeValue>,\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n get inputProps() {\n return fieldAria.fieldProps;\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n }}\n >\n <div\n ref={setFieldRef}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-readonly={dataAttr(state.isReadOnly())}\n data-required={dataAttr(state.isRequired())}\n data-invalid={dataAttr(state.isInvalid())}\n >\n <Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n {local.children as JSX.Element}\n </Provider>\n </div>\n {/*\n Unlike DateField, TimeField renders NO root hidden autofill input —\n RAC TimeField renders none (react-aria-components TimeField.mjs). The\n native-validation <input> is emitted by the inner DateInput sibling.\n */}\n </TimeFieldContext>\n </DateFieldContext>\n </DateFieldStateContext>\n </TimeFieldStateContext>","value={state as unknown as TimeFieldState<TimeValue>}","<DateFieldStateContext value={state as unknown as DateFieldContextValue[\"state\"]}>\n <DateFieldContext value={dateFieldContextValue}>\n <TimeFieldContext\n value={{\n state: state as unknown as TimeFieldState<TimeValue>,\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n get inputProps() {\n return fieldAria.fieldProps;\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n }}\n >\n <div\n ref={setFieldRef}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-readonly={dataAttr(state.isReadOnly())}\n data-required={dataAttr(state.isRequired())}\n data-invalid={dataAttr(state.isInvalid())}\n >\n <Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n {local.children as JSX.Element}\n </Provider>\n </div>\n {/*\n Unlike DateField, TimeField renders NO root hidden autofill input —\n RAC TimeField renders none (react-aria-components TimeField.mjs). The\n native-validation <input> is emitted by the inner DateInput sibling.\n */}\n </TimeFieldContext>\n </DateFieldContext>\n </DateFieldStateContext>","value={state as unknown as DateFieldContextValue[\"state\"]}","<DateFieldContext value={dateFieldContextValue}>\n <TimeFieldContext\n value={{\n state: state as unknown as TimeFieldState<TimeValue>,\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n get inputProps() {\n return fieldAria.fieldProps;\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n }}\n >\n <div\n ref={setFieldRef}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-readonly={dataAttr(state.isReadOnly())}\n data-required={dataAttr(state.isRequired())}\n data-invalid={dataAttr(state.isInvalid())}\n >\n <Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n {local.children as JSX.Element}\n </Provider>\n </div>\n {/*\n Unlike DateField, TimeField renders NO root hidden autofill input —\n RAC TimeField renders none (react-aria-components TimeField.mjs). The\n native-validation <input> is emitted by the inner DateInput sibling.\n */}\n </TimeFieldContext>\n </DateFieldContext>","value={dateFieldContextValue}","<TimeFieldContext\n value={{\n state: state as unknown as TimeFieldState<TimeValue>,\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n get inputProps() {\n return fieldAria.fieldProps;\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n }}\n >\n <div\n ref={setFieldRef}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-readonly={dataAttr(state.isReadOnly())}\n data-required={dataAttr(state.isRequired())}\n data-invalid={dataAttr(state.isInvalid())}\n >\n <Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n {local.children as JSX.Element}\n </Provider>\n </div>\n {/*\n Unlike DateField, TimeField renders NO root hidden autofill input —\n RAC TimeField renders none (react-aria-components TimeField.mjs). The\n native-validation <input> is emitted by the inner DateInput sibling.\n */}\n </TimeFieldContext>","value={{\n state: state as unknown as TimeFieldState<TimeValue>,\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n get inputProps() {\n return fieldAria.fieldProps;\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n }}","ref={setFieldRef}","<Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n {local.children as JSX.Element}\n </Provider>","values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}","style={renderProps.style()}","data-disabled={dataAttr(state.isDisabled())}","data-readonly={dataAttr(state.isReadOnly())}","data-required={dataAttr(state.isRequired())}","data-invalid={dataAttr(state.isInvalid())}","<div\n ref={setFieldRef}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-readonly={dataAttr(state.isReadOnly())}\n data-required={dataAttr(state.isRequired())}\n data-invalid={dataAttr(state.isInvalid())}\n >\n <Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n {local.children as JSX.Element}\n </Provider>\n </div>","{props.children}","<span {...aria.labelProps} class={props.class}>\n {props.children}\n </span>","<span {...aria.descriptionProps} class={props.class}>\n {props.children}\n </span>","<span {...aria.errorMessageProps} class={props.class}>\n {props.children}\n </span>"],"sources":["../src/TimeField.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/DateField.tsx\n\n/**\n * TimeField component for solidaria-components\n *\n * Pre-wired headless time field. The pinned TimeField implementation does not\n * define its own segment primitives. It reuses\n * `DateInput`/`DateSegment` (there is no `TimeInput`/`TimeSegment` upstream).\n * `TimeFieldState` IS a `DateFieldState` (plus `timeValue`), so this component\n * drives the certified DateField segment/group stack directly: it provides the\n * shared `DateFieldContext`/`DateFieldStateContext` that `DateInput`/`DateSegment`\n * read, plus a `TimeFieldContext` for the time-field label/description/error\n * chrome. Unlike DateField, TimeField renders NO root hidden autofill input (RAC\n * TimeField renders none); its native-validation `<input>` is still emitted by\n * the inner DateInput sibling.\n */\n\nimport { createContext, createMemo, createSignal, useContext } from \"solid-js\";\nimport type { Context } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport { createTimeField, mergeProps, type AriaTimeFieldProps } from \"@proyecto-viviana/solidaria\";\nimport {\n createTimeFieldState,\n access,\n type TimeFieldState,\n type TimeFieldStateProps,\n type TimeSegment as TimeSegmentType,\n type TimeValue,\n} from \"@proyecto-viviana/solid-stately\";\nimport { DateFieldContext, DateFieldStateContext, type DateFieldContextValue } from \"./DateField\";\nimport {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n dataAttr,\n Provider,\n} from \"./utils\";\nimport { TextContext } from \"./Text\";\nimport { FormContext, resolveValidationBehavior, type FormProps } from \"./Form\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\nexport interface TimeFieldRenderProps {\n /** Whether the field is disabled. */\n isDisabled: boolean;\n /** Whether the field is read-only. */\n isReadOnly: boolean;\n /** Whether the field is required. */\n isRequired: boolean;\n /** Whether the field is invalid. */\n isInvalid: boolean;\n}\n\nexport interface TimeFieldProps<T extends TimeValue = TimeValue>\n extends\n Omit<AriaTimeFieldProps, \"id\" | \"isDisabled\" | \"isReadOnly\" | \"isRequired\">,\n Omit<TimeFieldStateProps<T>, \"locale\">,\n SlotProps {\n /** The children of the component. */\n children?: JSX.Element | ((segment: TimeSegmentType) => JSX.Element);\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TimeFieldRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TimeFieldRenderProps>;\n /** The locale to use for formatting. */\n locale?: string;\n}\n\nexport interface TimeFieldContextValue {\n state: TimeFieldState<TimeValue>;\n aria: {\n labelProps: Record<string, unknown>;\n inputProps: Record<string, unknown>;\n descriptionProps: Record<string, unknown>;\n errorMessageProps: Record<string, unknown>;\n };\n}\n\nexport const TimeFieldContext = createContext<TimeFieldContextValue | null>(null);\nexport const TimeFieldStateContext = createContext<TimeFieldState<TimeValue> | null>(null);\n\nfunction useTimeFieldContextValue(): TimeFieldContextValue {\n const context = useContext(TimeFieldContext);\n if (!context) {\n throw new Error(\"TimeField components must be used within a TimeField\");\n }\n return context;\n}\n\nexport function useTimeFieldContext(): TimeFieldState<TimeValue> {\n return useTimeFieldContextValue().state;\n}\n\n/**\n * A time field allows users to enter and edit time values using a keyboard.\n *\n * @example\n * ```tsx\n * <TimeField label=\"Time\">\n * <Label>Time</Label>\n * <DateInput>\n * {(segment) => <DateSegment segment={segment} />}\n * </DateInput>\n * </TimeField>\n * ```\n */\nexport function TimeField<T extends TimeValue = TimeValue>(props: TimeFieldProps<T>): JSX.Element {\n return <TimeFieldInner {...props} />;\n}\n\ntype TimeFieldInnerProps<T extends TimeValue = TimeValue> = TimeFieldProps<T> & {\n __formContext?: FormProps | null;\n};\n\n/**\n * Internal TimeField component that renders after client mount.\n */\nfunction TimeFieldInner<T extends TimeValue = TimeValue>(\n props: TimeFieldInnerProps<T>,\n): JSX.Element {\n const formContext = props.__formContext ?? useContext(FormContext);\n const [local, stateProps, rest] = splitProps(\n props,\n [\"children\", \"class\", \"style\", \"slot\", \"__formContext\"],\n [\n \"value\",\n \"defaultValue\",\n \"onChange\",\n \"minValue\",\n \"maxValue\",\n \"isInvalid\",\n \"isDisabled\",\n \"isReadOnly\",\n \"isRequired\",\n \"locale\",\n \"granularity\",\n \"hourCycle\",\n \"hideTimeZone\",\n \"shouldForceLeadingZeros\",\n \"validationState\",\n \"validationBehavior\",\n \"validate\",\n \"description\",\n \"errorMessage\",\n \"placeholderValue\",\n ],\n );\n\n const [fieldRef, setFieldRef] = createSignal<HTMLDivElement | null>(null);\n // Ref to the hidden validation <input> (the DateInput's `<Input>` sibling).\n // Mirrors DateField: create it here, hand it to createTimeField below, and\n // attach it to the same input through the DateFieldContext getter.\n const [validationInputRef, setValidationInputRef] = createSignal<HTMLInputElement | null>(null);\n\n const state = createTimeFieldState(stateProps);\n\n const fieldAria = createTimeField(\n () => ({\n ...(rest as Record<string, unknown>),\n // RAC threads these props into both useTimeFieldState and useTimeField;\n // they live in `stateProps` here, so forward them for the field hook's\n // aria-disabled and the native validation <input> (type/required).\n isDisabled: access(stateProps.isDisabled),\n isReadOnly: access(stateProps.isReadOnly),\n isRequired: access(stateProps.isRequired),\n // Standalone default flips the hidden input to type=\"text\" so an empty\n // required value blocks HTML form submission (mirrors DateField).\n validationBehavior: resolveValidationBehavior(stateProps.validationBehavior, formContext),\n description: stateProps.description,\n errorMessage: stateProps.errorMessage,\n inputRef: () => validationInputRef() ?? undefined,\n }),\n state as unknown as TimeFieldState<TimeValue>,\n fieldRef,\n );\n\n const renderValues = createMemo<TimeFieldRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n isReadOnly: state.isReadOnly(),\n isRequired: state.isRequired(),\n isInvalid: state.isInvalid(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-TimeField\",\n },\n renderValues,\n );\n\n const textSlots = {\n slots: {\n get description() {\n return fieldAria.descriptionProps;\n },\n get errorMessage() {\n return fieldAria.errorMessageProps;\n },\n },\n };\n\n // The shared context read by the reused DateInput/DateSegment. Read through\n // getters so consumers see the LIVE memo values (createDescription appends the\n // value-description id via a deferred effect; a frozen snapshot would miss it).\n const dateFieldContextValue: DateFieldContextValue = {\n get state() {\n return state as unknown as DateFieldContextValue[\"state\"];\n },\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n // The segment group props (role=\"group\", aria-labelledby, unicode-bidi\n // isolate, arrow-key nav, focus-within handlers) are routed to the\n // DateInput element; the outer wrapper stays roleless.\n get inputProps() {\n return fieldAria.fieldProps;\n },\n // The native validation <input> props (type/hidden/required/onChange under\n // native validation), rendered as the DateInput's sibling. Thread the\n // validation-input ref so createTimeField's form-reset/validation wiring\n // resolves to the mounted element.\n get hiddenInputProps() {\n return mergeProps(fieldAria.inputProps, { ref: setValidationInputRef });\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n };\n\n return (\n <TimeFieldStateContext value={state as unknown as TimeFieldState<TimeValue>}>\n <DateFieldStateContext value={state as unknown as DateFieldContextValue[\"state\"]}>\n <DateFieldContext value={dateFieldContextValue}>\n <TimeFieldContext\n value={{\n state: state as unknown as TimeFieldState<TimeValue>,\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n get inputProps() {\n return fieldAria.fieldProps;\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n }}\n >\n <div\n ref={setFieldRef}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-readonly={dataAttr(state.isReadOnly())}\n data-required={dataAttr(state.isRequired())}\n data-invalid={dataAttr(state.isInvalid())}\n >\n <Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n {local.children as JSX.Element}\n </Provider>\n </div>\n {/*\n Unlike DateField, TimeField renders NO root hidden autofill input —\n RAC TimeField renders none (react-aria-components TimeField.mjs). The\n native-validation <input> is emitted by the inner DateInput sibling.\n */}\n </TimeFieldContext>\n </DateFieldContext>\n </DateFieldStateContext>\n </TimeFieldStateContext>\n );\n}\n\nexport interface TimeFieldLabelProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function TimeFieldLabel(props: TimeFieldLabelProps): JSX.Element {\n const { aria } = useTimeFieldContextValue();\n return (\n <span {...aria.labelProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport interface TimeFieldDescriptionProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function TimeFieldDescription(props: TimeFieldDescriptionProps): JSX.Element {\n const { aria } = useTimeFieldContextValue();\n return (\n <span {...aria.descriptionProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport interface TimeFieldErrorMessageProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function TimeFieldErrorMessage(props: TimeFieldErrorMessageProps): JSX.Element {\n const { aria } = useTimeFieldContextValue();\n return (\n <span {...aria.errorMessageProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport type { TimeFieldState, TimeSegmentType, TimeValue };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,MAAa,mBAAmB,cAA4C,IAAI;AAChF,MAAa,wBAAwB,cAAgD,IAAI;AAEzF,SAAS,2BAAkD;CACzD,MAAM,UAAU,WAAW,gBAAgB;CAC3C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,sDAAsD;CAExE,OAAO;AACT;AA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EG;AAIJ"}
|
package/dist/TimeField.jsx
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/DateField.tsx
|
|
13
|
+
import { Provider, dataAttr, useRenderProps } from "./utils.jsx";
|
|
2
14
|
import { TextContext } from "./Text.jsx";
|
|
3
|
-
import { FormContext } from "./Form.jsx";
|
|
15
|
+
import { FormContext, resolveValidationBehavior } from "./Form.jsx";
|
|
4
16
|
import { n as DateFieldContext, o as DateFieldStateContext } from "./DateField2.jsx";
|
|
5
|
-
import {
|
|
6
|
-
import { createTimeField, mergeProps
|
|
17
|
+
import { createContext, createMemo, createSignal, useContext } from "solid-js";
|
|
18
|
+
import { createTimeField, mergeProps } from "@proyecto-viviana/solidaria";
|
|
19
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
7
20
|
import { access, createTimeFieldState } from "@proyecto-viviana/solid-stately";
|
|
8
21
|
//#region src/TimeField.tsx
|
|
9
22
|
/**
|
|
10
23
|
* TimeField component for solidaria-components
|
|
11
24
|
*
|
|
12
|
-
* Pre-wired headless time field.
|
|
13
|
-
*
|
|
25
|
+
* Pre-wired headless time field. The pinned TimeField implementation does not
|
|
26
|
+
* define its own segment primitives. It reuses
|
|
14
27
|
* `DateInput`/`DateSegment` (there is no `TimeInput`/`TimeSegment` upstream).
|
|
15
28
|
* `TimeFieldState` IS a `DateFieldState` (plus `timeValue`), so this component
|
|
16
29
|
* drives the certified DateField segment/group stack directly: it provides the
|
|
@@ -22,33 +35,6 @@ import { access, createTimeFieldState } from "@proyecto-viviana/solid-stately";
|
|
|
22
35
|
*/
|
|
23
36
|
const TimeFieldContext = createContext(null);
|
|
24
37
|
const TimeFieldStateContext = createContext(null);
|
|
25
|
-
function withFormValidationBehavior(props, formContext) {
|
|
26
|
-
if (!formContext?.validationBehavior) return props;
|
|
27
|
-
return new Proxy(props, {
|
|
28
|
-
get(target, property, receiver) {
|
|
29
|
-
const localValue = Reflect.get(target, property, receiver);
|
|
30
|
-
if (property === "validationBehavior" && localValue === void 0) return formContext.validationBehavior;
|
|
31
|
-
return localValue;
|
|
32
|
-
},
|
|
33
|
-
has(target, property) {
|
|
34
|
-
return Reflect.has(target, property) || property === "validationBehavior" && formContext.validationBehavior !== void 0;
|
|
35
|
-
},
|
|
36
|
-
ownKeys(target) {
|
|
37
|
-
const keys = new Set(Reflect.ownKeys(target));
|
|
38
|
-
if (formContext.validationBehavior !== void 0) keys.add("validationBehavior");
|
|
39
|
-
return Array.from(keys);
|
|
40
|
-
},
|
|
41
|
-
getOwnPropertyDescriptor(target, property) {
|
|
42
|
-
const descriptor = Reflect.getOwnPropertyDescriptor(target, property);
|
|
43
|
-
if (descriptor) return descriptor;
|
|
44
|
-
if (property === "validationBehavior" && formContext.validationBehavior !== void 0) return {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
configurable: true,
|
|
47
|
-
get: () => formContext.validationBehavior
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
38
|
function useTimeFieldContextValue() {
|
|
53
39
|
const context = useContext(TimeFieldContext);
|
|
54
40
|
if (!context) throw new Error("TimeField components must be used within a TimeField");
|
|
@@ -71,17 +57,14 @@ function useTimeFieldContext() {
|
|
|
71
57
|
* ```
|
|
72
58
|
*/
|
|
73
59
|
function TimeField(props) {
|
|
74
|
-
|
|
75
|
-
const formContext = useContext(FormContext);
|
|
76
|
-
return <Show when={isHydrated()} fallback={<div class="solidaria-TimeField solidaria-TimeField--placeholder" aria-hidden="true" />}>
|
|
77
|
-
<TimeFieldInner {...props} __formContext={formContext} />
|
|
78
|
-
</Show>;
|
|
60
|
+
return <TimeFieldInner {...props} />;
|
|
79
61
|
}
|
|
80
62
|
/**
|
|
81
63
|
* Internal TimeField component that renders after client mount.
|
|
82
64
|
*/
|
|
83
65
|
function TimeFieldInner(props) {
|
|
84
|
-
const
|
|
66
|
+
const formContext = props.__formContext ?? useContext(FormContext);
|
|
67
|
+
const [local, stateProps, rest] = splitProps(props, [
|
|
85
68
|
"children",
|
|
86
69
|
"class",
|
|
87
70
|
"style",
|
|
@@ -117,7 +100,7 @@ function TimeFieldInner(props) {
|
|
|
117
100
|
isDisabled: access(stateProps.isDisabled),
|
|
118
101
|
isReadOnly: access(stateProps.isReadOnly),
|
|
119
102
|
isRequired: access(stateProps.isRequired),
|
|
120
|
-
validationBehavior: stateProps.validationBehavior
|
|
103
|
+
validationBehavior: resolveValidationBehavior(stateProps.validationBehavior, formContext),
|
|
121
104
|
description: stateProps.description,
|
|
122
105
|
errorMessage: stateProps.errorMessage,
|
|
123
106
|
inputRef: () => validationInputRef() ?? void 0
|
|
@@ -153,7 +136,7 @@ function TimeFieldInner(props) {
|
|
|
153
136
|
return fieldAria.fieldProps;
|
|
154
137
|
},
|
|
155
138
|
get hiddenInputProps() {
|
|
156
|
-
return mergeProps
|
|
139
|
+
return mergeProps(fieldAria.inputProps, { ref: setValidationInputRef });
|
|
157
140
|
},
|
|
158
141
|
get descriptionProps() {
|
|
159
142
|
return fieldAria.descriptionProps;
|
|
@@ -163,10 +146,10 @@ function TimeFieldInner(props) {
|
|
|
163
146
|
}
|
|
164
147
|
}
|
|
165
148
|
};
|
|
166
|
-
return <TimeFieldStateContext
|
|
167
|
-
<DateFieldStateContext
|
|
168
|
-
<DateFieldContext
|
|
169
|
-
<TimeFieldContext
|
|
149
|
+
return <TimeFieldStateContext value={state}>
|
|
150
|
+
<DateFieldStateContext value={state}>
|
|
151
|
+
<DateFieldContext value={dateFieldContextValue}>
|
|
152
|
+
<TimeFieldContext value={{
|
|
170
153
|
state,
|
|
171
154
|
aria: {
|
|
172
155
|
get labelProps() {
|
|
@@ -189,10 +172,10 @@ function TimeFieldInner(props) {
|
|
|
189
172
|
</Provider>
|
|
190
173
|
</div>
|
|
191
174
|
{}
|
|
192
|
-
</TimeFieldContext
|
|
193
|
-
</DateFieldContext
|
|
194
|
-
</DateFieldStateContext
|
|
195
|
-
</TimeFieldStateContext
|
|
175
|
+
</TimeFieldContext>
|
|
176
|
+
</DateFieldContext>
|
|
177
|
+
</DateFieldStateContext>
|
|
178
|
+
</TimeFieldStateContext>;
|
|
196
179
|
}
|
|
197
180
|
function TimeFieldLabel(props) {
|
|
198
181
|
const { aria } = useTimeFieldContextValue();
|
package/dist/TimeField.jsx.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeField.jsx","names":["mergeProps"],"sources":["../src/TimeField.tsx"],"sourcesContent":["/**\n * TimeField component for solidaria-components\n *\n * Pre-wired headless time field. Faithful port of react-aria-components'\n * TimeField, which does NOT define its own segment primitives — it reuses\n * `DateInput`/`DateSegment` (there is no `TimeInput`/`TimeSegment` upstream).\n * `TimeFieldState` IS a `DateFieldState` (plus `timeValue`), so this component\n * drives the certified DateField segment/group stack directly: it provides the\n * shared `DateFieldContext`/`DateFieldStateContext` that `DateInput`/`DateSegment`\n * read, plus a `TimeFieldContext` for the time-field label/description/error\n * chrome. Unlike DateField, TimeField renders NO root hidden autofill input (RAC\n * TimeField renders none); its native-validation `<input>` is still emitted by\n * the inner DateInput sibling.\n */\n\nimport {\n type JSX,\n type Context,\n createContext,\n createMemo,\n createSignal,\n splitProps,\n useContext,\n Show,\n} from \"solid-js\";\nimport { createTimeField, mergeProps, type AriaTimeFieldProps } from \"@proyecto-viviana/solidaria\";\nimport {\n createTimeFieldState,\n access,\n type TimeFieldState,\n type TimeFieldStateProps,\n type TimeSegment as TimeSegmentType,\n type TimeValue,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n DateFieldContext,\n DateFieldStateContext,\n type DateFieldContextValue,\n} from \"./DateField\";\nimport {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n dataAttr,\n useIsHydrated,\n Provider,\n} from \"./utils\";\nimport { TextContext } from \"./Text\";\nimport { FormContext, type FormProps } from \"./Form\";\n\nexport interface TimeFieldRenderProps {\n /** Whether the field is disabled. */\n isDisabled: boolean;\n /** Whether the field is read-only. */\n isReadOnly: boolean;\n /** Whether the field is required. */\n isRequired: boolean;\n /** Whether the field is invalid. */\n isInvalid: boolean;\n}\n\nexport interface TimeFieldProps<T extends TimeValue = TimeValue>\n extends\n Omit<AriaTimeFieldProps, \"id\" | \"isDisabled\" | \"isReadOnly\" | \"isRequired\">,\n Omit<TimeFieldStateProps<T>, \"locale\">,\n SlotProps {\n /** The children of the component. */\n children?: JSX.Element | ((segment: TimeSegmentType) => JSX.Element);\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TimeFieldRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TimeFieldRenderProps>;\n /** The locale to use for formatting. */\n locale?: string;\n}\n\nexport interface TimeFieldContextValue {\n state: TimeFieldState<TimeValue>;\n aria: {\n labelProps: Record<string, unknown>;\n inputProps: Record<string, unknown>;\n descriptionProps: Record<string, unknown>;\n errorMessageProps: Record<string, unknown>;\n };\n}\n\nexport const TimeFieldContext = createContext<TimeFieldContextValue | null>(null);\nexport const TimeFieldStateContext = createContext<TimeFieldState<TimeValue> | null>(null);\n\nfunction withFormValidationBehavior<P extends object>(props: P, formContext: FormProps | null): P {\n if (!formContext?.validationBehavior) {\n return props;\n }\n\n return new Proxy(props, {\n get(target, property, receiver) {\n const localValue = Reflect.get(target, property, receiver);\n if (property === \"validationBehavior\" && localValue === undefined) {\n return formContext.validationBehavior;\n }\n\n return localValue;\n },\n has(target, property) {\n return (\n Reflect.has(target, property) ||\n (property === \"validationBehavior\" && formContext.validationBehavior !== undefined)\n );\n },\n ownKeys(target) {\n const keys = new Set(Reflect.ownKeys(target));\n if (formContext.validationBehavior !== undefined) {\n keys.add(\"validationBehavior\");\n }\n\n return Array.from(keys);\n },\n getOwnPropertyDescriptor(target, property) {\n const descriptor = Reflect.getOwnPropertyDescriptor(target, property);\n if (descriptor) {\n return descriptor;\n }\n\n if (property === \"validationBehavior\" && formContext.validationBehavior !== undefined) {\n return {\n enumerable: true,\n configurable: true,\n get: () => formContext.validationBehavior,\n };\n }\n\n return undefined;\n },\n });\n}\n\nfunction useTimeFieldContextValue(): TimeFieldContextValue {\n const context = useContext(TimeFieldContext);\n if (!context) {\n throw new Error(\"TimeField components must be used within a TimeField\");\n }\n return context;\n}\n\nexport function useTimeFieldContext(): TimeFieldState<TimeValue> {\n return useTimeFieldContextValue().state;\n}\n\n/**\n * A time field allows users to enter and edit time values using a keyboard.\n *\n * @example\n * ```tsx\n * <TimeField label=\"Time\">\n * <Label>Time</Label>\n * <DateInput>\n * {(segment) => <DateSegment segment={segment} />}\n * </DateInput>\n * </TimeField>\n * ```\n */\nexport function TimeField<T extends TimeValue = TimeValue>(props: TimeFieldProps<T>): JSX.Element {\n // Use hydration-safe pattern for client-only rendering\n const isHydrated = useIsHydrated();\n const formContext = useContext(FormContext);\n\n return (\n <Show\n when={isHydrated()}\n fallback={\n <div class=\"solidaria-TimeField solidaria-TimeField--placeholder\" aria-hidden=\"true\" />\n }\n >\n <TimeFieldInner {...props} __formContext={formContext} />\n </Show>\n );\n}\n\ntype TimeFieldInnerProps<T extends TimeValue = TimeValue> = TimeFieldProps<T> & {\n __formContext?: FormProps | null;\n};\n\n/**\n * Internal TimeField component that renders after client mount.\n */\nfunction TimeFieldInner<T extends TimeValue = TimeValue>(\n props: TimeFieldInnerProps<T>,\n): JSX.Element {\n const formContext = props.__formContext ?? useContext(FormContext);\n const mergedProps = withFormValidationBehavior(props, formContext);\n const [local, stateProps, rest] = splitProps(\n mergedProps,\n [\"children\", \"class\", \"style\", \"slot\", \"__formContext\"],\n [\n \"value\",\n \"defaultValue\",\n \"onChange\",\n \"minValue\",\n \"maxValue\",\n \"isInvalid\",\n \"isDisabled\",\n \"isReadOnly\",\n \"isRequired\",\n \"locale\",\n \"granularity\",\n \"hourCycle\",\n \"hideTimeZone\",\n \"shouldForceLeadingZeros\",\n \"validationState\",\n \"validationBehavior\",\n \"validate\",\n \"description\",\n \"errorMessage\",\n \"placeholderValue\",\n ],\n );\n\n const [fieldRef, setFieldRef] = createSignal<HTMLDivElement | null>(null);\n // Ref to the hidden validation <input> (the DateInput's `<Input>` sibling).\n // Mirrors DateField: create it here, hand it to createTimeField below, and\n // attach it to the same input through the DateFieldContext getter.\n const [validationInputRef, setValidationInputRef] =\n createSignal<HTMLInputElement | null>(null);\n\n const state = createTimeFieldState(stateProps);\n\n const fieldAria = createTimeField(\n () => ({\n ...(rest as Record<string, unknown>),\n // RAC threads these props into both useTimeFieldState and useTimeField;\n // they live in `stateProps` here, so forward them for the field hook's\n // aria-disabled and the native validation <input> (type/required).\n isDisabled: access(stateProps.isDisabled),\n isReadOnly: access(stateProps.isReadOnly),\n isRequired: access(stateProps.isRequired),\n // Standalone default flips the hidden input to type=\"text\" so an empty\n // required value blocks HTML form submission (mirrors DateField).\n validationBehavior: stateProps.validationBehavior ?? \"native\",\n description: stateProps.description,\n errorMessage: stateProps.errorMessage,\n inputRef: () => validationInputRef() ?? undefined,\n }),\n state as unknown as TimeFieldState<TimeValue>,\n fieldRef,\n );\n\n const renderValues = createMemo<TimeFieldRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n isReadOnly: state.isReadOnly(),\n isRequired: state.isRequired(),\n isInvalid: state.isInvalid(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-TimeField\",\n },\n renderValues,\n );\n\n const textSlots = {\n slots: {\n get description() {\n return fieldAria.descriptionProps;\n },\n get errorMessage() {\n return fieldAria.errorMessageProps;\n },\n },\n };\n\n // The shared context read by the reused DateInput/DateSegment. Read through\n // getters so consumers see the LIVE memo values (createDescription appends the\n // value-description id via a deferred effect; a frozen snapshot would miss it).\n const dateFieldContextValue: DateFieldContextValue = {\n get state() {\n return state as unknown as DateFieldContextValue[\"state\"];\n },\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n // The segment group props (role=\"group\", aria-labelledby, unicode-bidi\n // isolate, arrow-key nav, focus-within handlers) are routed to the\n // DateInput element; the outer wrapper stays roleless.\n get inputProps() {\n return fieldAria.fieldProps;\n },\n // The native validation <input> props (type/hidden/required/onChange under\n // native validation), rendered as the DateInput's sibling. Thread the\n // validation-input ref so createTimeField's form-reset/validation wiring\n // resolves to the mounted element.\n get hiddenInputProps() {\n return mergeProps(fieldAria.inputProps, { ref: setValidationInputRef });\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n };\n\n return (\n <TimeFieldStateContext.Provider value={state as unknown as TimeFieldState<TimeValue>}>\n <DateFieldStateContext.Provider\n value={state as unknown as DateFieldContextValue[\"state\"]}\n >\n <DateFieldContext.Provider value={dateFieldContextValue}>\n <TimeFieldContext.Provider\n value={{\n state: state as unknown as TimeFieldState<TimeValue>,\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n get inputProps() {\n return fieldAria.fieldProps;\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n }}\n >\n <div\n ref={setFieldRef}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-readonly={dataAttr(state.isReadOnly())}\n data-required={dataAttr(state.isRequired())}\n data-invalid={dataAttr(state.isInvalid())}\n >\n <Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n {local.children as JSX.Element}\n </Provider>\n </div>\n {/*\n Unlike DateField, TimeField renders NO root hidden autofill input —\n RAC TimeField renders none (react-aria-components TimeField.mjs). The\n native-validation <input> is emitted by the inner DateInput sibling.\n */}\n </TimeFieldContext.Provider>\n </DateFieldContext.Provider>\n </DateFieldStateContext.Provider>\n </TimeFieldStateContext.Provider>\n );\n}\n\nexport interface TimeFieldLabelProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function TimeFieldLabel(props: TimeFieldLabelProps): JSX.Element {\n const { aria } = useTimeFieldContextValue();\n return (\n <span {...aria.labelProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport interface TimeFieldDescriptionProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function TimeFieldDescription(props: TimeFieldDescriptionProps): JSX.Element {\n const { aria } = useTimeFieldContextValue();\n return (\n <span {...aria.descriptionProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport interface TimeFieldErrorMessageProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function TimeFieldErrorMessage(props: TimeFieldErrorMessageProps): JSX.Element {\n const { aria } = useTimeFieldContextValue();\n return (\n <span {...aria.errorMessageProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport type { TimeFieldState, TimeSegmentType, TimeValue };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuFA,MAAa,mBAAmB,cAA4C,IAAI;AAChF,MAAa,wBAAwB,cAAgD,IAAI;AAEzF,SAAS,2BAA6C,OAAU,aAAkC;CAChG,IAAI,CAAC,aAAa,oBAChB,OAAO;CAGT,OAAO,IAAI,MAAM,OAAO;EACtB,IAAI,QAAQ,UAAU,UAAU;GAC9B,MAAM,aAAa,QAAQ,IAAI,QAAQ,UAAU,QAAQ;GACzD,IAAI,aAAa,wBAAwB,eAAe,KAAA,GACtD,OAAO,YAAY;GAGrB,OAAO;EACT;EACA,IAAI,QAAQ,UAAU;GAC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nB;GACA,IAAI,mBAAmB;IACrB,OAAO,UAAU;GACnB;GACA,IAAI,oBAAoB;IACtB,OAAO,UAAU;GACnB;EACF;CACF,GACD;YACC,CAAC,IACC,KAAK,aACL,OAAO,YAAY,MAAM,GACzB,OAAO,YAAY,MAAM,GACzB,eAAe,SAAS,MAAM,WAAW,CAAC,GAC1C,eAAe,SAAS,MAAM,WAAW,CAAC,GAC1C,eAAe,SAAS,MAAM,WAAW,CAAC,GAC1C,cAAc,SAAS,MAAM,UAAU,CAAC,GACzC;cACC,CAAC,SAAS,QAAQ,CAAC,CAAC,aAAa,SAAS,CAAC,GAAyC;iBACjF,MAAM,SAAwB;cACjC,EAAE,SAAS;YACb,EAAE,IAAI;cAKH;UACL,EAAE,iBAAiB,SAAS;QAC9B,EAAE,iBAAiB,SAAS;MAC9B,EAAE,sBAAsB,SAAS;IACnC,EAAE,sBAAsB;AAE5B;AAOA,SAAgB,eAAe,OAAyC;CACtE,MAAM,EAAE,SAAS,yBAAyB;CAC1C,OACE,CAAC,SAAS,KAAK,YAAY,OAAO,MAAM,OAAO;OAC5C,MAAM,SAAS;IAClB,EAAE;AAEN;AAOA,SAAgB,qBAAqB,OAA+C;CAClF,MAAM,EAAE,SAAS,yBAAyB;CAC1C,OACE,CAAC,SAAS,KAAK,kBAAkB,OAAO,MAAM,OAAO;OAClD,MAAM,SAAS;IAClB,EAAE;AAEN;AAOA,SAAgB,sBAAsB,OAAgD;CACpF,MAAM,EAAE,SAAS,yBAAyB;CAC1C,OACE,CAAC,SAAS,KAAK,mBAAmB,OAAO,MAAM,OAAO;OACnD,MAAM,SAAS;IAClB,EAAE;AAEN"}
|
|
1
|
+
{"version":3,"file":"TimeField.jsx","names":[],"sources":["../src/TimeField.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/DateField.tsx\n\n/**\n * TimeField component for solidaria-components\n *\n * Pre-wired headless time field. The pinned TimeField implementation does not\n * define its own segment primitives. It reuses\n * `DateInput`/`DateSegment` (there is no `TimeInput`/`TimeSegment` upstream).\n * `TimeFieldState` IS a `DateFieldState` (plus `timeValue`), so this component\n * drives the certified DateField segment/group stack directly: it provides the\n * shared `DateFieldContext`/`DateFieldStateContext` that `DateInput`/`DateSegment`\n * read, plus a `TimeFieldContext` for the time-field label/description/error\n * chrome. Unlike DateField, TimeField renders NO root hidden autofill input (RAC\n * TimeField renders none); its native-validation `<input>` is still emitted by\n * the inner DateInput sibling.\n */\n\nimport { createContext, createMemo, createSignal, useContext } from \"solid-js\";\nimport type { Context } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport { createTimeField, mergeProps, type AriaTimeFieldProps } from \"@proyecto-viviana/solidaria\";\nimport {\n createTimeFieldState,\n access,\n type TimeFieldState,\n type TimeFieldStateProps,\n type TimeSegment as TimeSegmentType,\n type TimeValue,\n} from \"@proyecto-viviana/solid-stately\";\nimport { DateFieldContext, DateFieldStateContext, type DateFieldContextValue } from \"./DateField\";\nimport {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n dataAttr,\n Provider,\n} from \"./utils\";\nimport { TextContext } from \"./Text\";\nimport { FormContext, resolveValidationBehavior, type FormProps } from \"./Form\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\nexport interface TimeFieldRenderProps {\n /** Whether the field is disabled. */\n isDisabled: boolean;\n /** Whether the field is read-only. */\n isReadOnly: boolean;\n /** Whether the field is required. */\n isRequired: boolean;\n /** Whether the field is invalid. */\n isInvalid: boolean;\n}\n\nexport interface TimeFieldProps<T extends TimeValue = TimeValue>\n extends\n Omit<AriaTimeFieldProps, \"id\" | \"isDisabled\" | \"isReadOnly\" | \"isRequired\">,\n Omit<TimeFieldStateProps<T>, \"locale\">,\n SlotProps {\n /** The children of the component. */\n children?: JSX.Element | ((segment: TimeSegmentType) => JSX.Element);\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TimeFieldRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TimeFieldRenderProps>;\n /** The locale to use for formatting. */\n locale?: string;\n}\n\nexport interface TimeFieldContextValue {\n state: TimeFieldState<TimeValue>;\n aria: {\n labelProps: Record<string, unknown>;\n inputProps: Record<string, unknown>;\n descriptionProps: Record<string, unknown>;\n errorMessageProps: Record<string, unknown>;\n };\n}\n\nexport const TimeFieldContext = createContext<TimeFieldContextValue | null>(null);\nexport const TimeFieldStateContext = createContext<TimeFieldState<TimeValue> | null>(null);\n\nfunction useTimeFieldContextValue(): TimeFieldContextValue {\n const context = useContext(TimeFieldContext);\n if (!context) {\n throw new Error(\"TimeField components must be used within a TimeField\");\n }\n return context;\n}\n\nexport function useTimeFieldContext(): TimeFieldState<TimeValue> {\n return useTimeFieldContextValue().state;\n}\n\n/**\n * A time field allows users to enter and edit time values using a keyboard.\n *\n * @example\n * ```tsx\n * <TimeField label=\"Time\">\n * <Label>Time</Label>\n * <DateInput>\n * {(segment) => <DateSegment segment={segment} />}\n * </DateInput>\n * </TimeField>\n * ```\n */\nexport function TimeField<T extends TimeValue = TimeValue>(props: TimeFieldProps<T>): JSX.Element {\n return <TimeFieldInner {...props} />;\n}\n\ntype TimeFieldInnerProps<T extends TimeValue = TimeValue> = TimeFieldProps<T> & {\n __formContext?: FormProps | null;\n};\n\n/**\n * Internal TimeField component that renders after client mount.\n */\nfunction TimeFieldInner<T extends TimeValue = TimeValue>(\n props: TimeFieldInnerProps<T>,\n): JSX.Element {\n const formContext = props.__formContext ?? useContext(FormContext);\n const [local, stateProps, rest] = splitProps(\n props,\n [\"children\", \"class\", \"style\", \"slot\", \"__formContext\"],\n [\n \"value\",\n \"defaultValue\",\n \"onChange\",\n \"minValue\",\n \"maxValue\",\n \"isInvalid\",\n \"isDisabled\",\n \"isReadOnly\",\n \"isRequired\",\n \"locale\",\n \"granularity\",\n \"hourCycle\",\n \"hideTimeZone\",\n \"shouldForceLeadingZeros\",\n \"validationState\",\n \"validationBehavior\",\n \"validate\",\n \"description\",\n \"errorMessage\",\n \"placeholderValue\",\n ],\n );\n\n const [fieldRef, setFieldRef] = createSignal<HTMLDivElement | null>(null);\n // Ref to the hidden validation <input> (the DateInput's `<Input>` sibling).\n // Mirrors DateField: create it here, hand it to createTimeField below, and\n // attach it to the same input through the DateFieldContext getter.\n const [validationInputRef, setValidationInputRef] = createSignal<HTMLInputElement | null>(null);\n\n const state = createTimeFieldState(stateProps);\n\n const fieldAria = createTimeField(\n () => ({\n ...(rest as Record<string, unknown>),\n // RAC threads these props into both useTimeFieldState and useTimeField;\n // they live in `stateProps` here, so forward them for the field hook's\n // aria-disabled and the native validation <input> (type/required).\n isDisabled: access(stateProps.isDisabled),\n isReadOnly: access(stateProps.isReadOnly),\n isRequired: access(stateProps.isRequired),\n // Standalone default flips the hidden input to type=\"text\" so an empty\n // required value blocks HTML form submission (mirrors DateField).\n validationBehavior: resolveValidationBehavior(stateProps.validationBehavior, formContext),\n description: stateProps.description,\n errorMessage: stateProps.errorMessage,\n inputRef: () => validationInputRef() ?? undefined,\n }),\n state as unknown as TimeFieldState<TimeValue>,\n fieldRef,\n );\n\n const renderValues = createMemo<TimeFieldRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n isReadOnly: state.isReadOnly(),\n isRequired: state.isRequired(),\n isInvalid: state.isInvalid(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-TimeField\",\n },\n renderValues,\n );\n\n const textSlots = {\n slots: {\n get description() {\n return fieldAria.descriptionProps;\n },\n get errorMessage() {\n return fieldAria.errorMessageProps;\n },\n },\n };\n\n // The shared context read by the reused DateInput/DateSegment. Read through\n // getters so consumers see the LIVE memo values (createDescription appends the\n // value-description id via a deferred effect; a frozen snapshot would miss it).\n const dateFieldContextValue: DateFieldContextValue = {\n get state() {\n return state as unknown as DateFieldContextValue[\"state\"];\n },\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n // The segment group props (role=\"group\", aria-labelledby, unicode-bidi\n // isolate, arrow-key nav, focus-within handlers) are routed to the\n // DateInput element; the outer wrapper stays roleless.\n get inputProps() {\n return fieldAria.fieldProps;\n },\n // The native validation <input> props (type/hidden/required/onChange under\n // native validation), rendered as the DateInput's sibling. Thread the\n // validation-input ref so createTimeField's form-reset/validation wiring\n // resolves to the mounted element.\n get hiddenInputProps() {\n return mergeProps(fieldAria.inputProps, { ref: setValidationInputRef });\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n };\n\n return (\n <TimeFieldStateContext value={state as unknown as TimeFieldState<TimeValue>}>\n <DateFieldStateContext value={state as unknown as DateFieldContextValue[\"state\"]}>\n <DateFieldContext value={dateFieldContextValue}>\n <TimeFieldContext\n value={{\n state: state as unknown as TimeFieldState<TimeValue>,\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n get inputProps() {\n return fieldAria.fieldProps;\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n }}\n >\n <div\n ref={setFieldRef}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-readonly={dataAttr(state.isReadOnly())}\n data-required={dataAttr(state.isRequired())}\n data-invalid={dataAttr(state.isInvalid())}\n >\n <Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n {local.children as JSX.Element}\n </Provider>\n </div>\n {/*\n Unlike DateField, TimeField renders NO root hidden autofill input —\n RAC TimeField renders none (react-aria-components TimeField.mjs). The\n native-validation <input> is emitted by the inner DateInput sibling.\n */}\n </TimeFieldContext>\n </DateFieldContext>\n </DateFieldStateContext>\n </TimeFieldStateContext>\n );\n}\n\nexport interface TimeFieldLabelProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function TimeFieldLabel(props: TimeFieldLabelProps): JSX.Element {\n const { aria } = useTimeFieldContextValue();\n return (\n <span {...aria.labelProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport interface TimeFieldDescriptionProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function TimeFieldDescription(props: TimeFieldDescriptionProps): JSX.Element {\n const { aria } = useTimeFieldContextValue();\n return (\n <span {...aria.descriptionProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport interface TimeFieldErrorMessageProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function TimeFieldErrorMessage(props: TimeFieldErrorMessageProps): JSX.Element {\n const { aria } = useTimeFieldContextValue();\n return (\n <span {...aria.errorMessageProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport type { TimeFieldState, TimeSegmentType, TimeValue };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,MAAa,mBAAmB,cAA4C,IAAI;AAChF,MAAa,wBAAwB,cAAgD,IAAI;AAEzF,SAAS,2BAAkD;CACzD,MAAM,UAAU,WAAW,gBAAgB;CAC3C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,sDAAsD;CAExE,OAAO;AACT;AAEA,SAAgB,sBAAiD;CAC/D,OAAO,yBAAyB,CAAC,CAAC;AACpC;;;;;;;;;;;;;;AAeA,SAAgB,UAA2C,OAAuC;CAChG,OAAO,CAAC,mBAAmB;AAC7B;;;;AASA,SAAS,eACP,OACa;CACb,MAAM,cAAc,MAAM,iBAAiB,WAAW,WAAW;CACjE,MAAM,CAAC,OAAO,YAAY,QAAQ,WAChC,OACA;EAAC;EAAY;EAAS;EAAS;EAAQ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