@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,31 @@
|
|
|
1
|
+
/** @jsxImportSource octane */
|
|
2
|
+
// Ported from adobe/react-spectrum@1c84a49a1faf50b571c84e00bcf9c60b22ddd03e (packages/react-stately/src/color/useColorPickerState.ts).
|
|
3
|
+
import { Color } from './types';
|
|
4
|
+
import { parseColor } from './Color';
|
|
5
|
+
import { useColor } from './useColor';
|
|
6
|
+
import { useControlledState } from '../utils/useControlledState';
|
|
7
|
+
import { ValueBase } from '@react-types/shared';
|
|
8
|
+
|
|
9
|
+
export interface ColorPickerProps extends ValueBase<string | Color, Color> {}
|
|
10
|
+
|
|
11
|
+
export interface ColorPickerState {
|
|
12
|
+
/** The current color value of the color picker. */
|
|
13
|
+
color: Color;
|
|
14
|
+
/** Sets the current color value of the color picker. */
|
|
15
|
+
setColor(color: Color | null): void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function useColorPickerState(props: ColorPickerProps): ColorPickerState {
|
|
19
|
+
let value = useColor(props.value);
|
|
20
|
+
let defaultValue = useColor(props.defaultValue || '#000000')!;
|
|
21
|
+
let [color, setColor] = useControlledState(value || undefined, defaultValue, props.onChange);
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
color,
|
|
25
|
+
setColor(color) {
|
|
26
|
+
if (color != null) {
|
|
27
|
+
setColor(color || parseColor('#000000'));
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/** @jsxImportSource octane */
|
|
2
|
+
// Ported from adobe/react-spectrum@1c84a49a1faf50b571c84e00bcf9c60b22ddd03e (packages/react-stately/src/color/useColorSliderState.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 { Color, ColorChannel, ColorSpace } from './types';
|
|
16
|
+
import { normalizeColor, parseColor } from './Color';
|
|
17
|
+
import { SliderProps, SliderState, useSliderState } from '../slider/useSliderState';
|
|
18
|
+
import { useControlledState } from '../utils/useControlledState';
|
|
19
|
+
import { useMemo, useState } from '../../compat/react';
|
|
20
|
+
|
|
21
|
+
export interface ColorSliderProps extends Omit<
|
|
22
|
+
SliderProps<string | Color>,
|
|
23
|
+
'minValue' | 'maxValue' | 'step' | 'pageSize' | 'onChange' | 'onChangeEnd'
|
|
24
|
+
> {
|
|
25
|
+
/**
|
|
26
|
+
* The color space that the slider operates in. The `channel` must be in this color space.
|
|
27
|
+
* If not provided, this defaults to the color space of the `color` or `defaultColor` value.
|
|
28
|
+
*/
|
|
29
|
+
colorSpace?: ColorSpace;
|
|
30
|
+
/** The color channel that the slider manipulates. */
|
|
31
|
+
channel: ColorChannel;
|
|
32
|
+
/** Handler that is called when the value changes, as the user drags. */
|
|
33
|
+
onChange?: (value: Color) => void;
|
|
34
|
+
/** Handler that is called when the user stops dragging. */
|
|
35
|
+
onChangeEnd?: (value: Color) => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ColorSliderState extends SliderState {
|
|
39
|
+
/** The current color value represented by the color slider. */
|
|
40
|
+
readonly value: Color;
|
|
41
|
+
/** Sets the current color value. If a string is passed, it will be parsed to a Color. */
|
|
42
|
+
setValue(value: string | Color): void;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the color that should be displayed in the slider instead of `value` or the optional
|
|
45
|
+
* parameter.
|
|
46
|
+
*/
|
|
47
|
+
getDisplayColor(): Color;
|
|
48
|
+
/** Whether the color slider is currently being dragged. */
|
|
49
|
+
readonly isDragging: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ColorSliderStateOptions extends ColorSliderProps {
|
|
53
|
+
/** The locale to use for formatting the color channel value. */
|
|
54
|
+
locale: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Provides state management for a color slider component.
|
|
59
|
+
* Color sliders allow users to adjust an individual channel of a color value.
|
|
60
|
+
*/
|
|
61
|
+
export function useColorSliderState(props: ColorSliderStateOptions): ColorSliderState {
|
|
62
|
+
let { channel, colorSpace, value, defaultValue, onChange, locale, ...otherProps } = props;
|
|
63
|
+
if (value == null && defaultValue == null) {
|
|
64
|
+
throw new Error('useColorSliderState requires a value or defaultValue');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (value) {
|
|
68
|
+
value = normalizeColor(value);
|
|
69
|
+
}
|
|
70
|
+
if (defaultValue) {
|
|
71
|
+
defaultValue = normalizeColor(defaultValue);
|
|
72
|
+
}
|
|
73
|
+
// safe to cast value and defaultValue to Color, one of them will always be defined because if neither are, we throw an error
|
|
74
|
+
let [colorValue, setColor] = useControlledState<Color>(
|
|
75
|
+
value as Color,
|
|
76
|
+
defaultValue as Color,
|
|
77
|
+
onChange,
|
|
78
|
+
);
|
|
79
|
+
let color = useMemo(
|
|
80
|
+
() => (colorSpace && colorValue ? colorValue.toFormat(colorSpace) : colorValue),
|
|
81
|
+
[colorValue, colorSpace],
|
|
82
|
+
);
|
|
83
|
+
let [initialValue] = useState(colorValue);
|
|
84
|
+
let defaultColorValue = (defaultValue as Color) ?? initialValue;
|
|
85
|
+
let defaultColor = useMemo(
|
|
86
|
+
() =>
|
|
87
|
+
colorSpace && defaultColorValue ? defaultColorValue.toFormat(colorSpace) : defaultColorValue,
|
|
88
|
+
[defaultColorValue, colorSpace],
|
|
89
|
+
);
|
|
90
|
+
let numberFormatter = useMemo(() => new Intl.NumberFormat(), []);
|
|
91
|
+
let sliderState = useSliderState({
|
|
92
|
+
...color.getChannelRange(channel),
|
|
93
|
+
...otherProps,
|
|
94
|
+
numberFormatter,
|
|
95
|
+
value: color.getChannelValue(channel),
|
|
96
|
+
defaultValue: defaultColor.getChannelValue(channel),
|
|
97
|
+
onChange(v) {
|
|
98
|
+
setColor(color.withChannelValue(channel, v));
|
|
99
|
+
},
|
|
100
|
+
onChangeEnd(v) {
|
|
101
|
+
// onChange will have already been called with the right value, this is just to trigger onChangeEnd
|
|
102
|
+
if (props.onChangeEnd) {
|
|
103
|
+
props.onChangeEnd(color.withChannelValue(channel, v));
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
let { step, pageSize } = color.getChannelRange(channel);
|
|
109
|
+
return {
|
|
110
|
+
...sliderState,
|
|
111
|
+
value: color,
|
|
112
|
+
setValue(value) {
|
|
113
|
+
setColor(normalizeColor(value));
|
|
114
|
+
},
|
|
115
|
+
getDisplayColor() {
|
|
116
|
+
switch (channel) {
|
|
117
|
+
case 'hue':
|
|
118
|
+
return parseColor(`hsl(${color.getChannelValue('hue')}, 100%, 50%)`);
|
|
119
|
+
case 'lightness':
|
|
120
|
+
case 'brightness':
|
|
121
|
+
case 'saturation':
|
|
122
|
+
case 'red':
|
|
123
|
+
case 'green':
|
|
124
|
+
case 'blue':
|
|
125
|
+
return color.withChannelValue('alpha', 1);
|
|
126
|
+
case 'alpha': {
|
|
127
|
+
return color;
|
|
128
|
+
}
|
|
129
|
+
default:
|
|
130
|
+
throw new Error('Unknown color channel: ' + channel);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
getThumbValueLabel() {
|
|
134
|
+
return color.formatChannelValue(channel, locale);
|
|
135
|
+
},
|
|
136
|
+
getFormattedValue() {
|
|
137
|
+
return color.formatChannelValue(channel, locale);
|
|
138
|
+
},
|
|
139
|
+
step,
|
|
140
|
+
pageSize,
|
|
141
|
+
isDragging: sliderState.isThumbDragging(0),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/** @jsxImportSource octane */
|
|
2
|
+
// Ported from adobe/react-spectrum@1c84a49a1faf50b571c84e00bcf9c60b22ddd03e (packages/react-stately/src/color/useColorWheelState.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 { Color } from './types';
|
|
16
|
+
import { normalizeColor, parseColor } from './Color';
|
|
17
|
+
import { useControlledState } from '../utils/useControlledState';
|
|
18
|
+
import { useMemo, useRef, useState } from '../../compat/react';
|
|
19
|
+
import { ValueBase } from '@react-types/shared';
|
|
20
|
+
|
|
21
|
+
export interface ColorWheelProps extends Omit<ValueBase<string | Color>, 'onChange'> {
|
|
22
|
+
/** Whether the ColorWheel is disabled. */
|
|
23
|
+
isDisabled?: boolean;
|
|
24
|
+
/** Handler that is called when the value changes, as the user drags. */
|
|
25
|
+
onChange?: (value: Color) => void;
|
|
26
|
+
/** Handler that is called when the user stops dragging. */
|
|
27
|
+
onChangeEnd?: (value: Color) => void;
|
|
28
|
+
/**
|
|
29
|
+
* The default value (uncontrolled).
|
|
30
|
+
*
|
|
31
|
+
* @default 'hsl(0, 100%, 50%)'
|
|
32
|
+
*/
|
|
33
|
+
defaultValue?: string | Color;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ColorWheelState {
|
|
37
|
+
/** The current color value represented by the color wheel. */
|
|
38
|
+
readonly value: Color;
|
|
39
|
+
/** The default color value. */
|
|
40
|
+
readonly defaultValue: Color;
|
|
41
|
+
/** Sets the color value represented by the color wheel, and triggers `onChange`. */
|
|
42
|
+
setValue(value: string | Color): void;
|
|
43
|
+
|
|
44
|
+
/** The current value of the hue channel displayed by the color wheel. */
|
|
45
|
+
readonly hue: number;
|
|
46
|
+
/** Sets the hue channel of the current color value and triggers `onChange`. */
|
|
47
|
+
setHue(value: number): void;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Sets the hue channel of the current color value based on the given coordinates and radius of
|
|
51
|
+
* the color wheel, and triggers `onChange`.
|
|
52
|
+
*/
|
|
53
|
+
setHueFromPoint(x: number, y: number, radius: number): void;
|
|
54
|
+
/** Returns the coordinates of the thumb relative to the center point of the color wheel. */
|
|
55
|
+
getThumbPosition(radius: number): { x: number; y: number };
|
|
56
|
+
|
|
57
|
+
/** Increments the hue by the given amount (defaults to 1). */
|
|
58
|
+
increment(stepSize?: number): void;
|
|
59
|
+
/** Decrements the hue by the given amount (defaults to 1). */
|
|
60
|
+
decrement(stepSize?: number): void;
|
|
61
|
+
|
|
62
|
+
/** Whether the color wheel is currently being dragged. */
|
|
63
|
+
readonly isDragging: boolean;
|
|
64
|
+
/** Sets whether the color wheel is being dragged. */
|
|
65
|
+
setDragging(value: boolean): void;
|
|
66
|
+
/** Returns the color that should be displayed in the color wheel instead of `value`. */
|
|
67
|
+
getDisplayColor(): Color;
|
|
68
|
+
/** The step value of the hue channel, used when incrementing and decrementing. */
|
|
69
|
+
step: number;
|
|
70
|
+
/** The page step value of the hue channel, used when incrementing and decrementing. */
|
|
71
|
+
pageStep: number;
|
|
72
|
+
|
|
73
|
+
/** Whether the color wheel is disabled. */
|
|
74
|
+
readonly isDisabled: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const DEFAULT_COLOR = parseColor('hsl(0, 100%, 50%)');
|
|
78
|
+
|
|
79
|
+
function roundToStep(value: number, step: number): number {
|
|
80
|
+
return Math.round(value / step) * step;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function mod(n: number, m: number) {
|
|
84
|
+
return ((n % m) + m) % m;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function roundDown(v: number) {
|
|
88
|
+
let r = Math.floor(v);
|
|
89
|
+
if (r === v) {
|
|
90
|
+
return v - 1;
|
|
91
|
+
} else {
|
|
92
|
+
return r;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function degToRad(deg: number) {
|
|
97
|
+
return (deg * Math.PI) / 180;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function radToDeg(rad: number) {
|
|
101
|
+
return (rad * 180) / Math.PI;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 0deg = 3 o'clock. increases clockwise
|
|
105
|
+
function angleToCartesian(angle: number, radius: number): { x: number; y: number } {
|
|
106
|
+
let rad = degToRad(360 - angle + 90);
|
|
107
|
+
let x = Math.sin(rad) * radius;
|
|
108
|
+
let y = Math.cos(rad) * radius;
|
|
109
|
+
return { x, y };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function cartesianToAngle(x: number, y: number, radius: number): number {
|
|
113
|
+
let deg = radToDeg(Math.atan2(y / radius, x / radius));
|
|
114
|
+
return (deg + 360) % 360;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Provides state management for a color wheel component.
|
|
119
|
+
* Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.
|
|
120
|
+
*/
|
|
121
|
+
export function useColorWheelState(props: ColorWheelProps): ColorWheelState {
|
|
122
|
+
let { value: propsValue, defaultValue, onChange, onChangeEnd } = props;
|
|
123
|
+
|
|
124
|
+
if (!propsValue && !defaultValue) {
|
|
125
|
+
defaultValue = DEFAULT_COLOR;
|
|
126
|
+
}
|
|
127
|
+
if (propsValue) {
|
|
128
|
+
propsValue = normalizeColor(propsValue);
|
|
129
|
+
}
|
|
130
|
+
if (defaultValue) {
|
|
131
|
+
defaultValue = normalizeColor(defaultValue);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// safe to cast value and defaultValue to Color, one of them will always be defined because if neither are, we assign a default
|
|
135
|
+
let [stateValue, setValueState] = useControlledState<Color>(
|
|
136
|
+
propsValue as Color,
|
|
137
|
+
defaultValue as Color,
|
|
138
|
+
onChange,
|
|
139
|
+
);
|
|
140
|
+
let [initialValue] = useState(stateValue);
|
|
141
|
+
let value = useMemo(() => {
|
|
142
|
+
let colorSpace = stateValue.getColorSpace();
|
|
143
|
+
return colorSpace === 'hsl' || colorSpace === 'hsb' ? stateValue : stateValue.toFormat('hsl');
|
|
144
|
+
}, [stateValue]);
|
|
145
|
+
let valueRef = useRef(value);
|
|
146
|
+
let setValue = (value: Color) => {
|
|
147
|
+
valueRef.current = value;
|
|
148
|
+
setValueState(value);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
let channelRange = value.getChannelRange('hue');
|
|
152
|
+
let { minValue: minValueX, maxValue: maxValueX, step: step, pageSize: pageStep } = channelRange;
|
|
153
|
+
let [isDragging, setDragging] = useState(false);
|
|
154
|
+
let isDraggingRef = useRef(false);
|
|
155
|
+
|
|
156
|
+
let hue = value.getChannelValue('hue');
|
|
157
|
+
function setHue(v: number) {
|
|
158
|
+
if (v > 360) {
|
|
159
|
+
// Make sure you can always get back to 0.
|
|
160
|
+
v = 0;
|
|
161
|
+
}
|
|
162
|
+
v = roundToStep(mod(v, 360), step);
|
|
163
|
+
if (hue !== v) {
|
|
164
|
+
let color = value.withChannelValue('hue', v);
|
|
165
|
+
setValue(color);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return {
|
|
170
|
+
value,
|
|
171
|
+
defaultValue: propsValue !== undefined ? initialValue : (defaultValue as Color),
|
|
172
|
+
step,
|
|
173
|
+
pageStep,
|
|
174
|
+
setValue(v) {
|
|
175
|
+
let color = normalizeColor(v);
|
|
176
|
+
setValue(color);
|
|
177
|
+
},
|
|
178
|
+
hue,
|
|
179
|
+
setHue,
|
|
180
|
+
setHueFromPoint(x, y, radius) {
|
|
181
|
+
setHue(cartesianToAngle(x, y, radius));
|
|
182
|
+
},
|
|
183
|
+
getThumbPosition(radius) {
|
|
184
|
+
return angleToCartesian(value.getChannelValue('hue'), radius);
|
|
185
|
+
},
|
|
186
|
+
increment(stepSize = 1) {
|
|
187
|
+
let s = Math.max(stepSize, step);
|
|
188
|
+
let newValue = hue + s;
|
|
189
|
+
if (newValue >= maxValueX) {
|
|
190
|
+
// Make sure you can always get back to 0.
|
|
191
|
+
newValue = minValueX;
|
|
192
|
+
}
|
|
193
|
+
setHue(roundToStep(mod(newValue, 360), s));
|
|
194
|
+
},
|
|
195
|
+
decrement(stepSize = 1) {
|
|
196
|
+
let s = Math.max(stepSize, step);
|
|
197
|
+
if (hue === 0) {
|
|
198
|
+
// We can't just subtract step because this might be the case:
|
|
199
|
+
// |(previous step) - 0| < step size
|
|
200
|
+
setHue(roundDown(360 / s) * s);
|
|
201
|
+
} else {
|
|
202
|
+
setHue(roundToStep(mod(hue - s, 360), s));
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
setDragging(isDragging) {
|
|
206
|
+
let wasDragging = isDraggingRef.current;
|
|
207
|
+
isDraggingRef.current = isDragging;
|
|
208
|
+
|
|
209
|
+
if (onChangeEnd && !isDragging && wasDragging) {
|
|
210
|
+
onChangeEnd(valueRef.current);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
setDragging(isDragging);
|
|
214
|
+
},
|
|
215
|
+
isDragging,
|
|
216
|
+
getDisplayColor() {
|
|
217
|
+
return value
|
|
218
|
+
.toFormat('hsl')
|
|
219
|
+
.withChannelValue('saturation', 100)
|
|
220
|
+
.withChannelValue('lightness', 50)
|
|
221
|
+
.withChannelValue('alpha', 1);
|
|
222
|
+
},
|
|
223
|
+
isDisabled: props.isDisabled || false,
|
|
224
|
+
};
|
|
225
|
+
}
|