@octanejs/aria 0.0.40 → 0.0.42
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/README.md +20 -7
- package/UPSTREAM.md +108 -0
- package/package.json +10 -6
- package/src/calendar/useCalendar.tsx +36 -0
- package/src/calendar/useCalendarBase.tsx +142 -0
- package/src/calendar/useCalendarCell.tsx +416 -0
- package/src/calendar/useCalendarGrid.tsx +202 -0
- package/src/calendar/useCalendarHeading.tsx +85 -0
- package/src/calendar/useCalendarMonthPicker.tsx +92 -0
- package/src/calendar/useCalendarYearPicker.tsx +127 -0
- package/src/calendar/useRangeCalendar.tsx +121 -0
- package/src/calendar/utils.tsx +183 -0
- package/src/color/useColorArea.tsx +599 -0
- package/src/color/useColorAreaGradient.tsx +157 -0
- package/src/color/useColorChannelField.tsx +53 -0
- package/src/color/useColorField.tsx +170 -0
- package/src/color/useColorSlider.tsx +177 -0
- package/src/color/useColorSwatch.tsx +83 -0
- package/src/color/useColorWheel.tsx +401 -0
- package/src/compat/react.ts +111 -0
- package/src/components/Calendar.tsx +842 -0
- package/src/components/ColorArea.tsx +120 -0
- package/src/components/ColorField.tsx +304 -0
- package/src/components/ColorPicker.tsx +86 -0
- package/src/components/ColorSlider.tsx +144 -0
- package/src/components/ColorSwatch.tsx +72 -0
- package/src/components/ColorSwatchPicker.tsx +176 -0
- package/src/components/ColorThumb.tsx +140 -0
- package/src/components/ColorWheel.tsx +163 -0
- package/src/components/DateField.tsx +580 -0
- package/src/components/DatePicker.tsx +386 -0
- package/src/components/DropZone.tsx +181 -0
- package/src/components/FileTrigger.tsx +96 -0
- package/src/components/GridLayout.tsx +33 -0
- package/src/components/HiddenDateInput.tsx +169 -0
- package/src/components/TableLayout.tsx +39 -0
- package/src/components/Toast.tsx +336 -0
- package/src/components/Virtualizer.tsx +219 -0
- package/src/components/index.ts +257 -7
- package/src/components/useDragAndDrop.tsx +221 -0
- package/src/components/utils.ts +12 -89
- package/src/datepicker/useDateField.tsx +272 -0
- package/src/datepicker/useDatePicker.tsx +229 -0
- package/src/datepicker/useDatePickerGroup.tsx +147 -0
- package/src/datepicker/useDateRangePicker.tsx +288 -0
- package/src/datepicker/useDateSegment.tsx +439 -0
- package/src/datepicker/useDisplayNames.tsx +53 -0
- package/src/dnd/DragManager.tsx +718 -0
- package/src/dnd/DragPreview.tsx +100 -0
- package/src/dnd/DropTargetKeyboardNavigation.tsx +317 -0
- package/src/dnd/ListDropTargetDelegate.tsx +215 -0
- package/src/dnd/constants.tsx +93 -0
- package/src/dnd/useAutoScroll.tsx +116 -0
- package/src/dnd/useClipboard.tsx +160 -0
- package/src/dnd/useDrag.tsx +437 -0
- package/src/dnd/useDraggableCollection.tsx +35 -0
- package/src/dnd/useDraggableItem.tsx +168 -0
- package/src/dnd/useDrop.tsx +518 -0
- package/src/dnd/useDropIndicator.tsx +129 -0
- package/src/dnd/useDroppableCollection.tsx +808 -0
- package/src/dnd/useDroppableItem.tsx +99 -0
- package/src/dnd/useVirtualDrop.tsx +52 -0
- package/src/dnd/utils.tsx +430 -0
- package/src/intl/calendar/ar-AE.json +14 -0
- package/src/intl/calendar/bg-BG.json +14 -0
- package/src/intl/calendar/cs-CZ.json +14 -0
- package/src/intl/calendar/da-DK.json +14 -0
- package/src/intl/calendar/de-DE.json +14 -0
- package/src/intl/calendar/el-GR.json +14 -0
- package/src/intl/calendar/en-US.json +14 -0
- package/src/intl/calendar/es-ES.json +14 -0
- package/src/intl/calendar/et-EE.json +14 -0
- package/src/intl/calendar/fi-FI.json +14 -0
- package/src/intl/calendar/fr-FR.json +14 -0
- package/src/intl/calendar/he-IL.json +14 -0
- package/src/intl/calendar/hr-HR.json +14 -0
- package/src/intl/calendar/hu-HU.json +14 -0
- package/src/intl/calendar/index.ts +73 -0
- package/src/intl/calendar/it-IT.json +14 -0
- package/src/intl/calendar/ja-JP.json +14 -0
- package/src/intl/calendar/ko-KR.json +14 -0
- package/src/intl/calendar/lt-LT.json +14 -0
- package/src/intl/calendar/lv-LV.json +14 -0
- package/src/intl/calendar/nb-NO.json +14 -0
- package/src/intl/calendar/nl-NL.json +14 -0
- package/src/intl/calendar/pl-PL.json +14 -0
- package/src/intl/calendar/pt-BR.json +14 -0
- package/src/intl/calendar/pt-PT.json +14 -0
- package/src/intl/calendar/ro-RO.json +14 -0
- package/src/intl/calendar/ru-RU.json +14 -0
- package/src/intl/calendar/sk-SK.json +14 -0
- package/src/intl/calendar/sl-SI.json +14 -0
- package/src/intl/calendar/sr-SP.json +14 -0
- package/src/intl/calendar/sv-SE.json +14 -0
- package/src/intl/calendar/tr-TR.json +14 -0
- package/src/intl/calendar/uk-UA.json +14 -0
- package/src/intl/calendar/zh-CN.json +14 -0
- package/src/intl/calendar/zh-TW.json +14 -0
- package/src/intl/color/ar-AE.json +8 -0
- package/src/intl/color/bg-BG.json +8 -0
- package/src/intl/color/cs-CZ.json +8 -0
- package/src/intl/color/da-DK.json +8 -0
- package/src/intl/color/de-DE.json +8 -0
- package/src/intl/color/el-GR.json +8 -0
- package/src/intl/color/en-US.json +8 -0
- package/src/intl/color/es-ES.json +8 -0
- package/src/intl/color/et-EE.json +8 -0
- package/src/intl/color/fi-FI.json +8 -0
- package/src/intl/color/fr-FR.json +8 -0
- package/src/intl/color/he-IL.json +8 -0
- package/src/intl/color/hr-HR.json +8 -0
- package/src/intl/color/hu-HU.json +8 -0
- package/src/intl/color/index.ts +73 -0
- package/src/intl/color/it-IT.json +8 -0
- package/src/intl/color/ja-JP.json +8 -0
- package/src/intl/color/ko-KR.json +8 -0
- package/src/intl/color/lt-LT.json +8 -0
- package/src/intl/color/lv-LV.json +8 -0
- package/src/intl/color/nb-NO.json +8 -0
- package/src/intl/color/nl-NL.json +8 -0
- package/src/intl/color/pl-PL.json +8 -0
- package/src/intl/color/pt-BR.json +8 -0
- package/src/intl/color/pt-PT.json +8 -0
- package/src/intl/color/ro-RO.json +8 -0
- package/src/intl/color/ru-RU.json +8 -0
- package/src/intl/color/sk-SK.json +8 -0
- package/src/intl/color/sl-SI.json +8 -0
- package/src/intl/color/sr-SP.json +8 -0
- package/src/intl/color/sv-SE.json +8 -0
- package/src/intl/color/tr-TR.json +8 -0
- package/src/intl/color/uk-UA.json +8 -0
- package/src/intl/color/zh-CN.json +8 -0
- package/src/intl/color/zh-TW.json +8 -0
- package/src/intl/datepicker/ar-AE.json +18 -0
- package/src/intl/datepicker/bg-BG.json +18 -0
- package/src/intl/datepicker/cs-CZ.json +18 -0
- package/src/intl/datepicker/da-DK.json +18 -0
- package/src/intl/datepicker/de-DE.json +18 -0
- package/src/intl/datepicker/el-GR.json +18 -0
- package/src/intl/datepicker/en-US.json +18 -0
- package/src/intl/datepicker/es-ES.json +18 -0
- package/src/intl/datepicker/et-EE.json +18 -0
- package/src/intl/datepicker/fi-FI.json +18 -0
- package/src/intl/datepicker/fr-FR.json +18 -0
- package/src/intl/datepicker/he-IL.json +18 -0
- package/src/intl/datepicker/hr-HR.json +18 -0
- package/src/intl/datepicker/hu-HU.json +18 -0
- package/src/intl/datepicker/index.ts +73 -0
- package/src/intl/datepicker/it-IT.json +18 -0
- package/src/intl/datepicker/ja-JP.json +18 -0
- package/src/intl/datepicker/ko-KR.json +18 -0
- package/src/intl/datepicker/lt-LT.json +18 -0
- package/src/intl/datepicker/lv-LV.json +18 -0
- package/src/intl/datepicker/nb-NO.json +18 -0
- package/src/intl/datepicker/nl-NL.json +18 -0
- package/src/intl/datepicker/pl-PL.json +18 -0
- package/src/intl/datepicker/pt-BR.json +18 -0
- package/src/intl/datepicker/pt-PT.json +18 -0
- package/src/intl/datepicker/ro-RO.json +18 -0
- package/src/intl/datepicker/ru-RU.json +18 -0
- package/src/intl/datepicker/sk-SK.json +18 -0
- package/src/intl/datepicker/sl-SI.json +18 -0
- package/src/intl/datepicker/sr-SP.json +18 -0
- package/src/intl/datepicker/sv-SE.json +18 -0
- package/src/intl/datepicker/tr-TR.json +18 -0
- package/src/intl/datepicker/uk-UA.json +18 -0
- package/src/intl/datepicker/zh-CN.json +18 -0
- package/src/intl/datepicker/zh-TW.json +18 -0
- package/src/intl/dnd/ar-AE.json +29 -0
- package/src/intl/dnd/bg-BG.json +29 -0
- package/src/intl/dnd/cs-CZ.json +29 -0
- package/src/intl/dnd/da-DK.json +29 -0
- package/src/intl/dnd/de-DE.json +29 -0
- package/src/intl/dnd/el-GR.json +29 -0
- package/src/intl/dnd/en-US.json +29 -0
- package/src/intl/dnd/es-ES.json +29 -0
- package/src/intl/dnd/et-EE.json +29 -0
- package/src/intl/dnd/fi-FI.json +29 -0
- package/src/intl/dnd/fr-FR.json +29 -0
- package/src/intl/dnd/he-IL.json +29 -0
- package/src/intl/dnd/hr-HR.json +29 -0
- package/src/intl/dnd/hu-HU.json +29 -0
- package/src/intl/dnd/index.ts +73 -0
- package/src/intl/dnd/it-IT.json +29 -0
- package/src/intl/dnd/ja-JP.json +29 -0
- package/src/intl/dnd/ko-KR.json +29 -0
- package/src/intl/dnd/lt-LT.json +29 -0
- package/src/intl/dnd/lv-LV.json +29 -0
- package/src/intl/dnd/nb-NO.json +29 -0
- package/src/intl/dnd/nl-NL.json +29 -0
- package/src/intl/dnd/pl-PL.json +29 -0
- package/src/intl/dnd/pt-BR.json +29 -0
- package/src/intl/dnd/pt-PT.json +29 -0
- package/src/intl/dnd/ro-RO.json +29 -0
- package/src/intl/dnd/ru-RU.json +29 -0
- package/src/intl/dnd/sk-SK.json +29 -0
- package/src/intl/dnd/sl-SI.json +29 -0
- package/src/intl/dnd/sr-SP.json +29 -0
- package/src/intl/dnd/sv-SE.json +29 -0
- package/src/intl/dnd/tr-TR.json +29 -0
- package/src/intl/dnd/uk-UA.json +29 -0
- package/src/intl/dnd/zh-CN.json +29 -0
- package/src/intl/dnd/zh-TW.json +29 -0
- package/src/intl/react-aria-components/ar-AE.json +6 -0
- package/src/intl/react-aria-components/bg-BG.json +6 -0
- package/src/intl/react-aria-components/cs-CZ.json +6 -0
- package/src/intl/react-aria-components/da-DK.json +6 -0
- package/src/intl/react-aria-components/de-DE.json +6 -0
- package/src/intl/react-aria-components/el-GR.json +6 -0
- package/src/intl/react-aria-components/en-US.json +6 -0
- package/src/intl/react-aria-components/es-ES.json +6 -0
- package/src/intl/react-aria-components/et-EE.json +6 -0
- package/src/intl/react-aria-components/fi-FI.json +6 -0
- package/src/intl/react-aria-components/fr-FR.json +6 -0
- package/src/intl/react-aria-components/he-IL.json +6 -0
- package/src/intl/react-aria-components/hr-HR.json +6 -0
- package/src/intl/react-aria-components/hu-HU.json +6 -0
- package/src/intl/react-aria-components/index.ts +73 -0
- package/src/intl/react-aria-components/it-IT.json +6 -0
- package/src/intl/react-aria-components/ja-JP.json +6 -0
- package/src/intl/react-aria-components/ko-KR.json +6 -0
- package/src/intl/react-aria-components/lt-LT.json +6 -0
- package/src/intl/react-aria-components/lv-LV.json +6 -0
- package/src/intl/react-aria-components/nb-NO.json +6 -0
- package/src/intl/react-aria-components/nl-NL.json +6 -0
- package/src/intl/react-aria-components/pl-PL.json +6 -0
- package/src/intl/react-aria-components/pt-BR.json +6 -0
- package/src/intl/react-aria-components/pt-PT.json +6 -0
- package/src/intl/react-aria-components/ro-RO.json +6 -0
- package/src/intl/react-aria-components/ru-RU.json +6 -0
- package/src/intl/react-aria-components/sk-SK.json +6 -0
- package/src/intl/react-aria-components/sl-SI.json +6 -0
- package/src/intl/react-aria-components/sr-SP.json +6 -0
- package/src/intl/react-aria-components/sv-SE.json +6 -0
- package/src/intl/react-aria-components/tr-TR.json +6 -0
- package/src/intl/react-aria-components/uk-UA.json +6 -0
- package/src/intl/react-aria-components/zh-CN.json +6 -0
- package/src/intl/react-aria-components/zh-TW.json +6 -0
- package/src/intl/stately-color/ar-AE.json +39 -0
- package/src/intl/stately-color/bg-BG.json +39 -0
- package/src/intl/stately-color/cs-CZ.json +39 -0
- package/src/intl/stately-color/da-DK.json +39 -0
- package/src/intl/stately-color/de-DE.json +39 -0
- package/src/intl/stately-color/el-GR.json +39 -0
- package/src/intl/stately-color/en-US.json +39 -0
- package/src/intl/stately-color/es-ES.json +39 -0
- package/src/intl/stately-color/et-EE.json +39 -0
- package/src/intl/stately-color/fi-FI.json +39 -0
- package/src/intl/stately-color/fr-FR.json +39 -0
- package/src/intl/stately-color/he-IL.json +39 -0
- package/src/intl/stately-color/hr-HR.json +39 -0
- package/src/intl/stately-color/hu-HU.json +39 -0
- package/src/intl/stately-color/index.ts +73 -0
- package/src/intl/stately-color/it-IT.json +39 -0
- package/src/intl/stately-color/ja-JP.json +39 -0
- package/src/intl/stately-color/ko-KR.json +39 -0
- package/src/intl/stately-color/lt-LT.json +39 -0
- package/src/intl/stately-color/lv-LV.json +39 -0
- package/src/intl/stately-color/nb-NO.json +39 -0
- package/src/intl/stately-color/nl-NL.json +39 -0
- package/src/intl/stately-color/pl-PL.json +39 -0
- package/src/intl/stately-color/pt-BR.json +39 -0
- package/src/intl/stately-color/pt-PT.json +39 -0
- package/src/intl/stately-color/ro-RO.json +39 -0
- package/src/intl/stately-color/ru-RU.json +39 -0
- package/src/intl/stately-color/sk-SK.json +39 -0
- package/src/intl/stately-color/sl-SI.json +39 -0
- package/src/intl/stately-color/sr-SP.json +39 -0
- package/src/intl/stately-color/sv-SE.json +39 -0
- package/src/intl/stately-color/tr-TR.json +39 -0
- package/src/intl/stately-color/uk-UA.json +39 -0
- package/src/intl/stately-color/zh-CN.json +39 -0
- package/src/intl/stately-color/zh-TW.json +39 -0
- package/src/intl/toast/ar-AE.json +4 -0
- package/src/intl/toast/bg-BG.json +4 -0
- package/src/intl/toast/cs-CZ.json +4 -0
- package/src/intl/toast/da-DK.json +4 -0
- package/src/intl/toast/de-DE.json +4 -0
- package/src/intl/toast/el-GR.json +4 -0
- package/src/intl/toast/en-US.json +4 -0
- package/src/intl/toast/es-ES.json +4 -0
- package/src/intl/toast/et-EE.json +4 -0
- package/src/intl/toast/fi-FI.json +4 -0
- package/src/intl/toast/fr-FR.json +4 -0
- package/src/intl/toast/he-IL.json +4 -0
- package/src/intl/toast/hr-HR.json +4 -0
- package/src/intl/toast/hu-HU.json +4 -0
- package/src/intl/toast/index.ts +73 -0
- package/src/intl/toast/it-IT.json +4 -0
- package/src/intl/toast/ja-JP.json +4 -0
- package/src/intl/toast/ko-KR.json +4 -0
- package/src/intl/toast/lt-LT.json +4 -0
- package/src/intl/toast/lv-LV.json +4 -0
- package/src/intl/toast/nb-NO.json +4 -0
- package/src/intl/toast/nl-NL.json +4 -0
- package/src/intl/toast/pl-PL.json +4 -0
- package/src/intl/toast/pt-BR.json +4 -0
- package/src/intl/toast/pt-PT.json +4 -0
- package/src/intl/toast/ro-RO.json +4 -0
- package/src/intl/toast/ru-RU.json +4 -0
- package/src/intl/toast/sk-SK.json +4 -0
- package/src/intl/toast/sl-SI.json +4 -0
- package/src/intl/toast/sr-SP.json +4 -0
- package/src/intl/toast/sv-SE.json +4 -0
- package/src/intl/toast/tr-TR.json +4 -0
- package/src/intl/toast/uk-UA.json +4 -0
- package/src/intl/toast/zh-CN.json +4 -0
- package/src/intl/toast/zh-TW.json +4 -0
- package/src/landmark/useLandmark.tsx +569 -0
- package/src/stately/calendar/types.tsx +239 -0
- package/src/stately/calendar/useCalendarState.tsx +527 -0
- package/src/stately/calendar/useRangeCalendarState.tsx +323 -0
- package/src/stately/calendar/utils.tsx +175 -0
- package/src/stately/color/Color.tsx +889 -0
- package/src/stately/color/types.tsx +82 -0
- package/src/stately/color/useColor.tsx +30 -0
- package/src/stately/color/useColorAreaState.tsx +255 -0
- package/src/stately/color/useColorChannelFieldState.tsx +86 -0
- package/src/stately/color/useColorFieldState.tsx +220 -0
- package/src/stately/color/useColorPickerState.tsx +31 -0
- package/src/stately/color/useColorSliderState.tsx +143 -0
- package/src/stately/color/useColorWheelState.tsx +225 -0
- package/src/stately/data/useAsyncList.tsx +382 -0
- package/src/stately/data/useListData.tsx +447 -0
- package/src/stately/data/useTreeData.tsx +603 -0
- package/src/stately/datepicker/IncompleteDate.tsx +427 -0
- package/src/stately/datepicker/placeholders.tsx +116 -0
- package/src/stately/datepicker/types.tsx +169 -0
- package/src/stately/datepicker/useDateFieldState.tsx +564 -0
- package/src/stately/datepicker/useDatePickerState.tsx +244 -0
- package/src/stately/datepicker/useDateRangePickerState.tsx +397 -0
- package/src/stately/datepicker/useTimeFieldState.tsx +123 -0
- package/src/stately/datepicker/utils.tsx +316 -0
- package/src/stately/dnd/useDraggableCollectionState.tsx +191 -0
- package/src/stately/dnd/useDroppableCollectionState.tsx +288 -0
- package/src/stately/layout/GridLayout.tsx +449 -0
- package/src/stately/layout/ListLayout.tsx +872 -0
- package/src/stately/layout/TableLayout.tsx +793 -0
- package/src/stately/layout/WaterfallLayout.tsx +399 -0
- package/src/stately/toast/useToastState.tsx +219 -0
- package/src/stately/virtualizer/Layout.tsx +105 -0
- package/src/stately/virtualizer/LayoutInfo.tsx +127 -0
- package/src/stately/virtualizer/OverscanManager.tsx +56 -0
- package/src/stately/virtualizer/Point.tsx +47 -0
- package/src/stately/virtualizer/Rect.tsx +194 -0
- package/src/stately/virtualizer/ReusableView.tsx +101 -0
- package/src/stately/virtualizer/Size.tsx +48 -0
- package/src/stately/virtualizer/Virtualizer.tsx +408 -0
- package/src/stately/virtualizer/types.tsx +48 -0
- package/src/stately/virtualizer/useVirtualizerState.tsx +138 -0
- package/src/stately/virtualizer/utils.tsx +32 -0
- package/src/textfield/useTextField.ts +3 -0
- package/src/toast/useToast.tsx +105 -0
- package/src/toast/useToastRegion.tsx +223 -0
- package/src/upstream-exports/react-aria/I18nProvider.tsx +17 -0
- package/src/upstream-exports/react-aria/ListDropTargetDelegate.tsx +15 -0
- package/src/upstream-exports/react-aria/PortalProvider.tsx +19 -0
- package/src/upstream-exports/react-aria/SSRProvider.tsx +15 -0
- package/src/upstream-exports/react-aria/VisuallyHidden.tsx +15 -0
- package/src/upstream-exports/react-aria/filterDOMProps.tsx +3 -0
- package/src/upstream-exports/react-aria/mergeProps.tsx +14 -0
- package/src/upstream-exports/react-aria/private/dnd/DragManager.tsx +3 -0
- package/src/upstream-exports/react-aria/private/interactions/PressResponder.tsx +3 -0
- package/src/upstream-exports/react-aria/private/utils/isFocusable.tsx +3 -0
- package/src/upstream-exports/react-aria/private/utils/shadowdom/DOMFunctions.tsx +8 -0
- package/src/upstream-exports/react-aria/private/utils/useId.tsx +3 -0
- package/src/upstream-exports/react-aria/private/utils/useLabels.tsx +3 -0
- package/src/upstream-exports/react-aria/private/virtualizer/ScrollView.tsx +3 -0
- package/src/upstream-exports/react-aria/private/virtualizer/VirtualizerItem.tsx +3 -0
- package/src/upstream-exports/react-aria/useButton.tsx +22 -0
- package/src/upstream-exports/react-aria/useCalendar.tsx +37 -0
- package/src/upstream-exports/react-aria/useClipboard.tsx +23 -0
- package/src/upstream-exports/react-aria/useColorArea.tsx +19 -0
- package/src/upstream-exports/react-aria/useColorField.tsx +20 -0
- package/src/upstream-exports/react-aria/useColorSlider.tsx +19 -0
- package/src/upstream-exports/react-aria/useColorSwatch.tsx +15 -0
- package/src/upstream-exports/react-aria/useColorWheel.tsx +19 -0
- package/src/upstream-exports/react-aria/useDateField.tsx +23 -0
- package/src/upstream-exports/react-aria/useDatePicker.tsx +17 -0
- package/src/upstream-exports/react-aria/useDateRangePicker.tsx +24 -0
- package/src/upstream-exports/react-aria/useDraggableCollection.tsx +31 -0
- package/src/upstream-exports/react-aria/useDrop.tsx +33 -0
- package/src/upstream-exports/react-aria/useDroppableCollection.tsx +47 -0
- package/src/upstream-exports/react-aria/useFocusRing.tsx +16 -0
- package/src/upstream-exports/react-aria/useHover.tsx +17 -0
- package/src/upstream-exports/react-aria/useLocalizedStringFormatter.tsx +19 -0
- package/src/upstream-exports/react-aria/useObjectRef.tsx +14 -0
- package/src/upstream-exports/react-aria/useRangeCalendar.tsx +38 -0
- package/src/upstream-exports/react-aria/useTimeField.tsx +23 -0
- package/src/upstream-exports/react-aria/useToast.tsx +18 -0
- package/src/upstream-exports/react-stately/Color.tsx +23 -0
- package/src/upstream-exports/react-stately/private/form/useFormValidationState.tsx +11 -0
- package/src/upstream-exports/react-stately/useCalendarState.tsx +24 -0
- package/src/upstream-exports/react-stately/useColorAreaState.tsx +24 -0
- package/src/upstream-exports/react-stately/useColorFieldState.tsx +22 -0
- package/src/upstream-exports/react-stately/useColorPickerState.tsx +25 -0
- package/src/upstream-exports/react-stately/useColorSliderState.tsx +25 -0
- package/src/upstream-exports/react-stately/useColorWheelState.tsx +24 -0
- package/src/upstream-exports/react-stately/useDateFieldState.tsx +29 -0
- package/src/upstream-exports/react-stately/useDatePickerState.tsx +25 -0
- package/src/upstream-exports/react-stately/useDateRangePickerState.tsx +26 -0
- package/src/upstream-exports/react-stately/useDraggableCollectionState.tsx +19 -0
- package/src/upstream-exports/react-stately/useDroppableCollectionState.tsx +19 -0
- package/src/upstream-exports/react-stately/useRangeCalendarState.tsx +27 -0
- package/src/upstream-exports/react-stately/useTimeFieldState.tsx +26 -0
- package/src/upstream-exports/react-stately/useToastState.tsx +21 -0
- package/src/upstream-exports/react-stately/useVirtualizerState.tsx +22 -0
- package/src/utils/useLoadMore.tsx +89 -0
- package/src/virtualizer/ScrollView.tsx +401 -0
- package/src/virtualizer/Virtualizer.tsx +147 -0
- package/src/virtualizer/VirtualizerItem.tsx +108 -0
- package/src/virtualizer/useVirtualizerItem.tsx +57 -0
- package/src/virtualizer/utils.tsx +105 -0
- package/LICENSE +0 -21
- package/src/components/useDragAndDrop.ts +0 -164
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/** @jsxImportSource octane */
|
|
2
|
+
// Ported from adobe/react-spectrum@1c84a49a1faf50b571c84e00bcf9c60b22ddd03e (packages/react-aria/src/color/useColorWheel.ts).
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
AriaLabelingProps,
|
|
17
|
+
DOMAttributes,
|
|
18
|
+
DOMProps,
|
|
19
|
+
InputDOMProps,
|
|
20
|
+
MoveMoveEvent,
|
|
21
|
+
RefObject,
|
|
22
|
+
} from '@react-types/shared';
|
|
23
|
+
import {
|
|
24
|
+
ColorWheelProps,
|
|
25
|
+
ColorWheelState,
|
|
26
|
+
} from '../upstream-exports/react-stately/useColorWheelState';
|
|
27
|
+
import { focusWithoutScrolling } from '../utils/focusWithoutScrolling';
|
|
28
|
+
import { getEventTarget } from '../utils/shadowdom/DOMFunctions';
|
|
29
|
+
import { mergeProps } from '../utils/mergeProps';
|
|
30
|
+
import React, { InputHTMLAttributes, useCallback, useRef } from '../compat/react';
|
|
31
|
+
import { useFormReset } from '../utils/useFormReset';
|
|
32
|
+
import { useGlobalListeners } from '../utils/useGlobalListeners';
|
|
33
|
+
import { useKeyboard } from '../interactions/useKeyboard';
|
|
34
|
+
import { useLabels } from '../utils/useLabels';
|
|
35
|
+
import { useLocale } from '../i18n/I18nProvider';
|
|
36
|
+
import { useMove } from '../interactions/useMove';
|
|
37
|
+
import { useVisuallyHidden } from '../visually-hidden/VisuallyHidden';
|
|
38
|
+
|
|
39
|
+
export interface AriaColorWheelProps
|
|
40
|
+
extends ColorWheelProps, InputDOMProps, DOMProps, AriaLabelingProps {}
|
|
41
|
+
|
|
42
|
+
export interface AriaColorWheelOptions extends AriaColorWheelProps {
|
|
43
|
+
/** The outer radius of the color wheel. */
|
|
44
|
+
outerRadius: number;
|
|
45
|
+
/** The inner radius of the color wheel. */
|
|
46
|
+
innerRadius: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ColorWheelAria {
|
|
50
|
+
/** Props for the track element. */
|
|
51
|
+
trackProps: DOMAttributes;
|
|
52
|
+
/** Props for the thumb element. */
|
|
53
|
+
thumbProps: DOMAttributes;
|
|
54
|
+
/** Props for the visually hidden range input element. */
|
|
55
|
+
inputProps: InputHTMLAttributes<HTMLInputElement>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
type NativeInputEvent = Event & { currentTarget: HTMLInputElement };
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Provides the behavior and accessibility implementation for a color wheel component.
|
|
62
|
+
* Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.
|
|
63
|
+
*/
|
|
64
|
+
export function useColorWheel(
|
|
65
|
+
props: AriaColorWheelOptions,
|
|
66
|
+
state: ColorWheelState,
|
|
67
|
+
inputRef: RefObject<HTMLInputElement | null>,
|
|
68
|
+
): ColorWheelAria {
|
|
69
|
+
let { isDisabled, innerRadius, outerRadius, 'aria-label': ariaLabel, name, form } = props;
|
|
70
|
+
|
|
71
|
+
let { addGlobalListener, removeGlobalListener } = useGlobalListeners();
|
|
72
|
+
|
|
73
|
+
let thumbRadius = (innerRadius + outerRadius) / 2;
|
|
74
|
+
|
|
75
|
+
let focusInput = useCallback(() => {
|
|
76
|
+
if (inputRef.current) {
|
|
77
|
+
focusWithoutScrolling(inputRef.current);
|
|
78
|
+
}
|
|
79
|
+
}, [inputRef]);
|
|
80
|
+
|
|
81
|
+
useFormReset(inputRef, state.defaultValue, state.setValue);
|
|
82
|
+
|
|
83
|
+
let currentPosition = useRef<{ x: number; y: number } | null>(null);
|
|
84
|
+
|
|
85
|
+
let { keyboardProps } = useKeyboard({
|
|
86
|
+
onKeyDown(e) {
|
|
87
|
+
// these are the cases that useMove doesn't handle
|
|
88
|
+
if (!/^(PageUp|PageDown)$/.test(e.key)) {
|
|
89
|
+
e.continuePropagation();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
// remember to set this and unset it so that onChangeEnd is fired
|
|
95
|
+
state.setDragging(true);
|
|
96
|
+
switch (e.key) {
|
|
97
|
+
case 'PageUp':
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
state.increment(state.pageStep);
|
|
100
|
+
break;
|
|
101
|
+
case 'PageDown':
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
state.decrement(state.pageStep);
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
state.setDragging(false);
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
let moveHandler = {
|
|
111
|
+
onMoveStart() {
|
|
112
|
+
currentPosition.current = null;
|
|
113
|
+
state.setDragging(true);
|
|
114
|
+
},
|
|
115
|
+
onMove({ deltaX, deltaY, pointerType, shiftKey }: MoveMoveEvent) {
|
|
116
|
+
if (currentPosition.current == null) {
|
|
117
|
+
currentPosition.current = state.getThumbPosition(thumbRadius);
|
|
118
|
+
}
|
|
119
|
+
currentPosition.current.x += deltaX;
|
|
120
|
+
currentPosition.current.y += deltaY;
|
|
121
|
+
if (pointerType === 'keyboard') {
|
|
122
|
+
if (deltaX > 0 || deltaY < 0) {
|
|
123
|
+
state.increment(shiftKey ? state.pageStep : state.step);
|
|
124
|
+
} else if (deltaX < 0 || deltaY > 0) {
|
|
125
|
+
state.decrement(shiftKey ? state.pageStep : state.step);
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
state.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
onMoveEnd() {
|
|
132
|
+
isOnTrack.current = false;
|
|
133
|
+
state.setDragging(false);
|
|
134
|
+
focusInput();
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
let { moveProps: movePropsThumb } = useMove(moveHandler);
|
|
138
|
+
|
|
139
|
+
let currentPointer = useRef<number | null | undefined>(undefined);
|
|
140
|
+
let isOnTrack = useRef<boolean>(false);
|
|
141
|
+
let { moveProps: movePropsContainer } = useMove({
|
|
142
|
+
onMoveStart() {
|
|
143
|
+
if (isOnTrack.current) {
|
|
144
|
+
moveHandler.onMoveStart();
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
onMove(e) {
|
|
148
|
+
if (isOnTrack.current) {
|
|
149
|
+
moveHandler.onMove(e);
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
onMoveEnd() {
|
|
153
|
+
if (isOnTrack.current) {
|
|
154
|
+
moveHandler.onMoveEnd();
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
let onThumbDown = (id: number | null | undefined) => {
|
|
160
|
+
if (!state.isDragging) {
|
|
161
|
+
currentPointer.current = id;
|
|
162
|
+
focusInput();
|
|
163
|
+
state.setDragging(true);
|
|
164
|
+
|
|
165
|
+
if (typeof PointerEvent !== 'undefined') {
|
|
166
|
+
addGlobalListener(window, 'pointerup', onThumbUp, false);
|
|
167
|
+
} else {
|
|
168
|
+
addGlobalListener(window, 'mouseup', onThumbUp, false);
|
|
169
|
+
addGlobalListener(window, 'touchend', onThumbUp, false);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
let onThumbUp = (e: any) => {
|
|
175
|
+
let id = e.pointerId ?? e.changedTouches?.[0].identifier;
|
|
176
|
+
if (id === currentPointer.current) {
|
|
177
|
+
focusInput();
|
|
178
|
+
state.setDragging(false);
|
|
179
|
+
currentPointer.current = undefined;
|
|
180
|
+
isOnTrack.current = false;
|
|
181
|
+
|
|
182
|
+
if (typeof PointerEvent !== 'undefined') {
|
|
183
|
+
removeGlobalListener(window, 'pointerup', onThumbUp, false);
|
|
184
|
+
} else {
|
|
185
|
+
removeGlobalListener(window, 'mouseup', onThumbUp, false);
|
|
186
|
+
removeGlobalListener(window, 'touchend', onThumbUp, false);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
let onTrackDown = (
|
|
192
|
+
track: Element,
|
|
193
|
+
id: number | null | undefined,
|
|
194
|
+
pageX: number,
|
|
195
|
+
pageY: number,
|
|
196
|
+
) => {
|
|
197
|
+
let rect = track.getBoundingClientRect();
|
|
198
|
+
let x = pageX - rect.x - rect.width / 2;
|
|
199
|
+
let y = pageY - rect.y - rect.height / 2;
|
|
200
|
+
let radius = Math.sqrt(x * x + y * y);
|
|
201
|
+
if (
|
|
202
|
+
innerRadius < radius &&
|
|
203
|
+
radius < outerRadius &&
|
|
204
|
+
!state.isDragging &&
|
|
205
|
+
currentPointer.current === undefined
|
|
206
|
+
) {
|
|
207
|
+
isOnTrack.current = true;
|
|
208
|
+
currentPointer.current = id;
|
|
209
|
+
state.setHueFromPoint(x, y, radius);
|
|
210
|
+
|
|
211
|
+
focusInput();
|
|
212
|
+
state.setDragging(true);
|
|
213
|
+
|
|
214
|
+
if (typeof PointerEvent !== 'undefined') {
|
|
215
|
+
addGlobalListener(window, 'pointerup', onTrackUp, false);
|
|
216
|
+
} else {
|
|
217
|
+
addGlobalListener(window, 'mouseup', onTrackUp, false);
|
|
218
|
+
addGlobalListener(window, 'touchend', onTrackUp, false);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
let onTrackUp = (e: any) => {
|
|
224
|
+
let id = e.pointerId ?? e.changedTouches?.[0].identifier;
|
|
225
|
+
if (isOnTrack.current && id === currentPointer.current) {
|
|
226
|
+
isOnTrack.current = false;
|
|
227
|
+
currentPointer.current = undefined;
|
|
228
|
+
state.setDragging(false);
|
|
229
|
+
focusInput();
|
|
230
|
+
|
|
231
|
+
if (typeof PointerEvent !== 'undefined') {
|
|
232
|
+
removeGlobalListener(window, 'pointerup', onTrackUp, false);
|
|
233
|
+
} else {
|
|
234
|
+
removeGlobalListener(window, 'mouseup', onTrackUp, false);
|
|
235
|
+
removeGlobalListener(window, 'touchend', onTrackUp, false);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
let trackInteractions = isDisabled
|
|
241
|
+
? {}
|
|
242
|
+
: mergeProps(
|
|
243
|
+
{
|
|
244
|
+
...(typeof PointerEvent !== 'undefined'
|
|
245
|
+
? {
|
|
246
|
+
onPointerDown: (e: React.PointerEvent) => {
|
|
247
|
+
if (
|
|
248
|
+
e.pointerType === 'mouse' &&
|
|
249
|
+
(e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)
|
|
250
|
+
) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
|
|
254
|
+
},
|
|
255
|
+
}
|
|
256
|
+
: {
|
|
257
|
+
onMouseDown: (e: React.MouseEvent) => {
|
|
258
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);
|
|
262
|
+
},
|
|
263
|
+
onTouchStart: (e: React.TouchEvent) => {
|
|
264
|
+
onTrackDown(
|
|
265
|
+
e.currentTarget,
|
|
266
|
+
e.changedTouches[0].identifier,
|
|
267
|
+
e.changedTouches[0].clientX,
|
|
268
|
+
e.changedTouches[0].clientY,
|
|
269
|
+
);
|
|
270
|
+
},
|
|
271
|
+
}),
|
|
272
|
+
},
|
|
273
|
+
movePropsContainer,
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
let thumbInteractions = isDisabled
|
|
277
|
+
? {}
|
|
278
|
+
: mergeProps(
|
|
279
|
+
{
|
|
280
|
+
...(typeof PointerEvent !== 'undefined'
|
|
281
|
+
? {
|
|
282
|
+
onPointerDown: (e: React.PointerEvent) => {
|
|
283
|
+
if (
|
|
284
|
+
e.pointerType === 'mouse' &&
|
|
285
|
+
(e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)
|
|
286
|
+
) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
onThumbDown(e.pointerId);
|
|
290
|
+
},
|
|
291
|
+
}
|
|
292
|
+
: {
|
|
293
|
+
onMouseDown: (e: React.MouseEvent) => {
|
|
294
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
onThumbDown(undefined);
|
|
298
|
+
},
|
|
299
|
+
onTouchStart: (e: React.TouchEvent) => {
|
|
300
|
+
onThumbDown(e.changedTouches[0].identifier);
|
|
301
|
+
},
|
|
302
|
+
}),
|
|
303
|
+
},
|
|
304
|
+
keyboardProps,
|
|
305
|
+
movePropsThumb,
|
|
306
|
+
);
|
|
307
|
+
let { x, y } = state.getThumbPosition(thumbRadius);
|
|
308
|
+
|
|
309
|
+
// Provide a default aria-label if none is given
|
|
310
|
+
let { locale } = useLocale();
|
|
311
|
+
if (ariaLabel == null && props['aria-labelledby'] == null) {
|
|
312
|
+
ariaLabel = state.value.getChannelName('hue', locale);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
let inputLabellingProps = useLabels({
|
|
316
|
+
...props,
|
|
317
|
+
'aria-label': ariaLabel,
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
let { minValue, maxValue, step } = state.value.getChannelRange('hue');
|
|
321
|
+
|
|
322
|
+
let forcedColorAdjustNoneStyle = {
|
|
323
|
+
forcedColorAdjust: 'none',
|
|
324
|
+
} as const;
|
|
325
|
+
|
|
326
|
+
let { visuallyHiddenProps } = useVisuallyHidden({
|
|
327
|
+
style: {
|
|
328
|
+
opacity: '0.0001',
|
|
329
|
+
width: '100%',
|
|
330
|
+
height: '100%',
|
|
331
|
+
pointerEvents: 'none',
|
|
332
|
+
},
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
return {
|
|
336
|
+
trackProps: {
|
|
337
|
+
...trackInteractions,
|
|
338
|
+
style: {
|
|
339
|
+
position: 'relative',
|
|
340
|
+
touchAction: 'none',
|
|
341
|
+
width: outerRadius * 2,
|
|
342
|
+
height: outerRadius * 2,
|
|
343
|
+
background: `
|
|
344
|
+
conic-gradient(
|
|
345
|
+
from 90deg,
|
|
346
|
+
hsl(0, 100%, 50%),
|
|
347
|
+
hsl(30, 100%, 50%),
|
|
348
|
+
hsl(60, 100%, 50%),
|
|
349
|
+
hsl(90, 100%, 50%),
|
|
350
|
+
hsl(120, 100%, 50%),
|
|
351
|
+
hsl(150, 100%, 50%),
|
|
352
|
+
hsl(180, 100%, 50%),
|
|
353
|
+
hsl(210, 100%, 50%),
|
|
354
|
+
hsl(240, 100%, 50%),
|
|
355
|
+
hsl(270, 100%, 50%),
|
|
356
|
+
hsl(300, 100%, 50%),
|
|
357
|
+
hsl(330, 100%, 50%),
|
|
358
|
+
hsl(360, 100%, 50%)
|
|
359
|
+
)
|
|
360
|
+
`,
|
|
361
|
+
clipPath: `path(evenodd, "${circlePath(outerRadius, outerRadius, outerRadius)} ${circlePath(outerRadius, outerRadius, innerRadius)}")`,
|
|
362
|
+
...forcedColorAdjustNoneStyle,
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
thumbProps: {
|
|
366
|
+
...thumbInteractions,
|
|
367
|
+
style: {
|
|
368
|
+
position: 'absolute',
|
|
369
|
+
left: (outerRadius + x).toFixed(3) + 'px',
|
|
370
|
+
top: (outerRadius + y).toFixed(3) + 'px',
|
|
371
|
+
transform: 'translate(-50%, -50%)',
|
|
372
|
+
touchAction: 'none',
|
|
373
|
+
...forcedColorAdjustNoneStyle,
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
inputProps: mergeProps(inputLabellingProps, {
|
|
377
|
+
type: 'range',
|
|
378
|
+
min: String(minValue),
|
|
379
|
+
max: String(maxValue),
|
|
380
|
+
step: String(step),
|
|
381
|
+
'aria-valuetext': `${state.value.formatChannelValue('hue', locale)}, ${state.value.getHueName(locale)}`,
|
|
382
|
+
disabled: isDisabled,
|
|
383
|
+
value: `${state.value.getChannelValue('hue')}`,
|
|
384
|
+
name,
|
|
385
|
+
form,
|
|
386
|
+
// React's synthetic onChange for range inputs follows the native input event.
|
|
387
|
+
onInput: (e: NativeInputEvent) => {
|
|
388
|
+
state.setHue(parseFloat(e.currentTarget.value));
|
|
389
|
+
},
|
|
390
|
+
style: visuallyHiddenProps.style,
|
|
391
|
+
'aria-errormessage': (props as any)['aria-errormessage'],
|
|
392
|
+
'aria-describedby': props['aria-describedby'],
|
|
393
|
+
'aria-details': props['aria-details'],
|
|
394
|
+
}),
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// Creates an SVG path string for a circle.
|
|
399
|
+
function circlePath(cx: number, cy: number, r: number) {
|
|
400
|
+
return `M ${cx}, ${cy} m ${-r}, 0 a ${r}, ${r}, 0, 1, 0, ${r * 2}, 0 a ${r}, ${r}, 0, 1, 0 ${-r * 2}, 0`;
|
|
401
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Compatibility types and the one React wrapper needed while porting the pinned
|
|
2
|
+
// React Aria Components source. Runtime hooks and element helpers are re-exported
|
|
3
|
+
// from Octane; forwardRef is an ordinary ref-as-prop adapter, not a React-style
|
|
4
|
+
// exotic component.
|
|
5
|
+
import * as Octane from 'octane';
|
|
6
|
+
|
|
7
|
+
export * from 'octane';
|
|
8
|
+
|
|
9
|
+
// React permits `useRef<Element>(null)`. Octane has the same runtime shape but
|
|
10
|
+
// infers the initializer literally, so expose the React-compatible overload at
|
|
11
|
+
// this import boundary while keeping the call visible to the Octane compiler.
|
|
12
|
+
export const useRef = Octane.useRef as <T>(initial: T | null) => { current: T };
|
|
13
|
+
|
|
14
|
+
export type ForwardedRef<T> =
|
|
15
|
+
((instance: T | null) => void | (() => void)) | { current: T | null } | null;
|
|
16
|
+
export type ReactNode = any;
|
|
17
|
+
export type ReactElement = any;
|
|
18
|
+
export type CSSProperties = Record<string, any>;
|
|
19
|
+
export type PointerEvent<T = Element> = Omit<
|
|
20
|
+
globalThis.PointerEvent,
|
|
21
|
+
'currentTarget' | 'target'
|
|
22
|
+
> & {
|
|
23
|
+
currentTarget: T;
|
|
24
|
+
target: EventTarget & T;
|
|
25
|
+
nativeEvent: globalThis.PointerEvent;
|
|
26
|
+
};
|
|
27
|
+
export type MouseEvent<T = Element> = Omit<globalThis.MouseEvent, 'currentTarget' | 'target'> & {
|
|
28
|
+
currentTarget: T;
|
|
29
|
+
target: EventTarget & T;
|
|
30
|
+
nativeEvent: globalThis.MouseEvent;
|
|
31
|
+
};
|
|
32
|
+
export type HTMLAttributes<T = HTMLElement> = Record<string, any>;
|
|
33
|
+
export type InputHTMLAttributes<T = HTMLInputElement> = Record<string, any>;
|
|
34
|
+
export type LabelHTMLAttributes<T = HTMLLabelElement> = Record<string, any>;
|
|
35
|
+
export type DOMAttributes<T = Element> = Record<string, any>;
|
|
36
|
+
export type MutableRefObject<T> = { current: T };
|
|
37
|
+
export type RefObject<T> = { current: T };
|
|
38
|
+
export type Ref<T> = ForwardedRef<T>;
|
|
39
|
+
export type RefAttributes<T> = { ref?: ForwardedRef<T> };
|
|
40
|
+
export type ForwardRefExoticComponent<P> = (props: P) => any;
|
|
41
|
+
export type KeyboardEvent<T = Element> = Omit<
|
|
42
|
+
globalThis.KeyboardEvent,
|
|
43
|
+
'currentTarget' | 'target'
|
|
44
|
+
> & {
|
|
45
|
+
currentTarget: T;
|
|
46
|
+
target: EventTarget & T;
|
|
47
|
+
nativeEvent: globalThis.KeyboardEvent;
|
|
48
|
+
};
|
|
49
|
+
export type ChangeEvent<T = Element> = globalThis.Event & {
|
|
50
|
+
currentTarget: T;
|
|
51
|
+
target: EventTarget & T;
|
|
52
|
+
};
|
|
53
|
+
export type DragEvent<T = Element> = Omit<
|
|
54
|
+
globalThis.DragEvent,
|
|
55
|
+
'currentTarget' | 'target' | 'dataTransfer'
|
|
56
|
+
> & {
|
|
57
|
+
currentTarget: T;
|
|
58
|
+
target: EventTarget & T;
|
|
59
|
+
dataTransfer: DataTransfer;
|
|
60
|
+
nativeEvent: globalThis.DragEvent;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export namespace JSX {
|
|
64
|
+
export type Element = any;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
type ForwardRefRenderFunction<T, P> = (props: P, ref: ForwardedRef<T>) => any;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Adapts an upstream `forwardRef(render)` declaration to Octane's ref-as-prop
|
|
71
|
+
* model. The returned value is an ordinary component and the ref remains a
|
|
72
|
+
* normal prop at the public boundary.
|
|
73
|
+
*/
|
|
74
|
+
export function forwardRef<T, P = Record<string, never>>(
|
|
75
|
+
render: ForwardRefRenderFunction<T, P>,
|
|
76
|
+
): (props: P & { ref?: ForwardedRef<T> }) => any {
|
|
77
|
+
const component = (props: P & { ref?: ForwardedRef<T> }) => render(props, props.ref ?? null);
|
|
78
|
+
Object.defineProperty(component, 'name', {
|
|
79
|
+
configurable: true,
|
|
80
|
+
value: render.name || 'ForwardRef',
|
|
81
|
+
});
|
|
82
|
+
return component;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const React = Object.assign({}, Octane, { forwardRef, useRef });
|
|
86
|
+
|
|
87
|
+
namespace React {
|
|
88
|
+
export type ForwardedRef<T> = import('./react').ForwardedRef<T>;
|
|
89
|
+
export type ReactNode = import('./react').ReactNode;
|
|
90
|
+
export type ReactElement = import('./react').ReactElement;
|
|
91
|
+
export type CSSProperties = import('./react').CSSProperties;
|
|
92
|
+
export type HTMLAttributes<T = HTMLElement> = import('./react').HTMLAttributes<T>;
|
|
93
|
+
export type InputHTMLAttributes<T = HTMLInputElement> = import('./react').InputHTMLAttributes<T>;
|
|
94
|
+
export type LabelHTMLAttributes<T = HTMLLabelElement> = import('./react').LabelHTMLAttributes<T>;
|
|
95
|
+
export type DOMAttributes<T = Element> = import('./react').DOMAttributes<T>;
|
|
96
|
+
export type RefObject<T> = import('./react').RefObject<T>;
|
|
97
|
+
export type Ref<T> = import('./react').Ref<T>;
|
|
98
|
+
export type RefAttributes<T> = import('./react').RefAttributes<T>;
|
|
99
|
+
export type ForwardRefExoticComponent<P> = import('./react').ForwardRefExoticComponent<P>;
|
|
100
|
+
export type PointerEvent<T = Element> = import('./react').PointerEvent<T>;
|
|
101
|
+
export type MouseEvent<T = Element> = import('./react').MouseEvent<T>;
|
|
102
|
+
export type KeyboardEvent<T = Element> = import('./react').KeyboardEvent<T>;
|
|
103
|
+
export type DragEvent<T = Element> = import('./react').DragEvent<T>;
|
|
104
|
+
export type ChangeEvent<T = Element> = import('./react').ChangeEvent<T>;
|
|
105
|
+
export type TouchEvent<T = Element> = globalThis.TouchEvent & {
|
|
106
|
+
currentTarget: T;
|
|
107
|
+
target: EventTarget & T;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export default React;
|