react-stately 3.46.0 → 3.47.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/dist/exports/Color.cjs.map +1 -1
- package/dist/exports/Color.js.map +1 -1
- package/dist/exports/Color.mjs.map +1 -1
- package/dist/exports/index.cjs.map +1 -1
- package/dist/exports/index.js.map +1 -1
- package/dist/exports/index.mjs.map +1 -1
- package/dist/exports/private/autocomplete/useAutocompleteState.cjs.map +1 -1
- package/dist/exports/private/autocomplete/useAutocompleteState.js.map +1 -1
- package/dist/exports/private/autocomplete/useAutocompleteState.mjs.map +1 -1
- package/dist/exports/private/collections/getChildNodes.cjs.map +1 -1
- package/dist/exports/private/collections/getChildNodes.js.map +1 -1
- package/dist/exports/private/collections/getChildNodes.mjs.map +1 -1
- package/dist/exports/private/flags/flags.cjs.map +1 -1
- package/dist/exports/private/flags/flags.js.map +1 -1
- package/dist/exports/private/flags/flags.mjs.map +1 -1
- package/dist/exports/private/form/useFormValidationState.cjs.map +1 -1
- package/dist/exports/private/form/useFormValidationState.js.map +1 -1
- package/dist/exports/private/form/useFormValidationState.mjs.map +1 -1
- package/dist/exports/private/grid/GridCollection.cjs.map +1 -1
- package/dist/exports/private/grid/GridCollection.js.map +1 -1
- package/dist/exports/private/grid/GridCollection.mjs.map +1 -1
- package/dist/exports/private/steplist/useStepListState.cjs.map +1 -1
- package/dist/exports/private/steplist/useStepListState.js.map +1 -1
- package/dist/exports/private/steplist/useStepListState.mjs.map +1 -1
- package/dist/exports/private/table/TableCollection.cjs.map +1 -1
- package/dist/exports/private/table/TableCollection.js.map +1 -1
- package/dist/exports/private/table/TableCollection.mjs.map +1 -1
- package/dist/exports/private/table/useTreeGridState.cjs.map +1 -1
- package/dist/exports/private/table/useTreeGridState.js.map +1 -1
- package/dist/exports/private/table/useTreeGridState.mjs.map +1 -1
- package/dist/exports/useAsyncList.cjs.map +1 -1
- package/dist/exports/useAsyncList.js.map +1 -1
- package/dist/exports/useAsyncList.mjs.map +1 -1
- package/dist/exports/useCalendarState.cjs.map +1 -1
- package/dist/exports/useCalendarState.js.map +1 -1
- package/dist/exports/useCalendarState.mjs.map +1 -1
- package/dist/exports/useColorAreaState.cjs.map +1 -1
- package/dist/exports/useColorAreaState.js.map +1 -1
- package/dist/exports/useColorAreaState.mjs.map +1 -1
- package/dist/exports/useColorFieldState.cjs.map +1 -1
- package/dist/exports/useColorFieldState.js.map +1 -1
- package/dist/exports/useColorFieldState.mjs.map +1 -1
- package/dist/exports/useColorPickerState.cjs.map +1 -1
- package/dist/exports/useColorPickerState.js.map +1 -1
- package/dist/exports/useColorPickerState.mjs.map +1 -1
- package/dist/exports/useColorSliderState.cjs.map +1 -1
- package/dist/exports/useColorSliderState.js.map +1 -1
- package/dist/exports/useColorSliderState.mjs.map +1 -1
- package/dist/exports/useColorWheelState.cjs.map +1 -1
- package/dist/exports/useColorWheelState.js.map +1 -1
- package/dist/exports/useColorWheelState.mjs.map +1 -1
- package/dist/exports/useComboBoxState.cjs +1 -1
- package/dist/exports/useComboBoxState.cjs.map +1 -1
- package/dist/exports/useComboBoxState.js +1 -1
- package/dist/exports/useComboBoxState.js.map +1 -1
- package/dist/exports/useComboBoxState.mjs +1 -1
- package/dist/exports/useComboBoxState.mjs.map +1 -1
- package/dist/exports/useDateFieldState.cjs.map +1 -1
- package/dist/exports/useDateFieldState.js.map +1 -1
- package/dist/exports/useDateFieldState.mjs.map +1 -1
- package/dist/exports/useDatePickerState.cjs.map +1 -1
- package/dist/exports/useDatePickerState.js.map +1 -1
- package/dist/exports/useDatePickerState.mjs.map +1 -1
- package/dist/exports/useDateRangePickerState.cjs.map +1 -1
- package/dist/exports/useDateRangePickerState.js.map +1 -1
- package/dist/exports/useDateRangePickerState.mjs.map +1 -1
- package/dist/exports/useDisclosureGroupState.cjs.map +1 -1
- package/dist/exports/useDisclosureGroupState.js.map +1 -1
- package/dist/exports/useDisclosureGroupState.mjs.map +1 -1
- package/dist/exports/useDraggableCollectionState.cjs.map +1 -1
- package/dist/exports/useDraggableCollectionState.js.map +1 -1
- package/dist/exports/useDraggableCollectionState.mjs.map +1 -1
- package/dist/exports/useDroppableCollectionState.cjs.map +1 -1
- package/dist/exports/useDroppableCollectionState.js.map +1 -1
- package/dist/exports/useDroppableCollectionState.mjs.map +1 -1
- package/dist/exports/useMenuTriggerState.cjs.map +1 -1
- package/dist/exports/useMenuTriggerState.js.map +1 -1
- package/dist/exports/useMenuTriggerState.mjs.map +1 -1
- package/dist/exports/useMultipleSelectionState.cjs.map +1 -1
- package/dist/exports/useMultipleSelectionState.js.map +1 -1
- package/dist/exports/useMultipleSelectionState.mjs.map +1 -1
- package/dist/exports/useOverlayTriggerState.cjs.map +1 -1
- package/dist/exports/useOverlayTriggerState.js.map +1 -1
- package/dist/exports/useOverlayTriggerState.mjs.map +1 -1
- package/dist/exports/useRangeCalendarState.cjs.map +1 -1
- package/dist/exports/useRangeCalendarState.js.map +1 -1
- package/dist/exports/useRangeCalendarState.mjs.map +1 -1
- package/dist/exports/useSelectState.cjs.map +1 -1
- package/dist/exports/useSelectState.js.map +1 -1
- package/dist/exports/useSelectState.mjs.map +1 -1
- package/dist/exports/useSingleSelectListState.cjs.map +1 -1
- package/dist/exports/useSingleSelectListState.js.map +1 -1
- package/dist/exports/useSingleSelectListState.mjs.map +1 -1
- package/dist/exports/useTableState.cjs.map +1 -1
- package/dist/exports/useTableState.js.map +1 -1
- package/dist/exports/useTableState.mjs.map +1 -1
- package/dist/exports/useTimeFieldState.cjs.map +1 -1
- package/dist/exports/useTimeFieldState.js.map +1 -1
- package/dist/exports/useTimeFieldState.mjs.map +1 -1
- package/dist/exports/useToastState.cjs.map +1 -1
- package/dist/exports/useToastState.js.map +1 -1
- package/dist/exports/useToastState.mjs.map +1 -1
- package/dist/private/autocomplete/useAutocompleteState.cjs.map +1 -1
- package/dist/private/autocomplete/useAutocompleteState.js.map +1 -1
- package/dist/private/autocomplete/useAutocompleteState.mjs.map +1 -1
- package/dist/private/calendar/useCalendarState.cjs +82 -30
- package/dist/private/calendar/useCalendarState.cjs.map +1 -1
- package/dist/private/calendar/useCalendarState.js +85 -32
- package/dist/private/calendar/useCalendarState.js.map +1 -1
- package/dist/private/calendar/useCalendarState.mjs +84 -32
- package/dist/private/calendar/useCalendarState.mjs.map +1 -1
- package/dist/private/calendar/useRangeCalendarState.cjs +53 -40
- package/dist/private/calendar/useRangeCalendarState.cjs.map +1 -1
- package/dist/private/calendar/useRangeCalendarState.js +55 -43
- package/dist/private/calendar/useRangeCalendarState.js.map +1 -1
- package/dist/private/calendar/useRangeCalendarState.mjs +55 -42
- package/dist/private/calendar/useRangeCalendarState.mjs.map +1 -1
- package/dist/private/calendar/utils.cjs +6 -1
- package/dist/private/calendar/utils.cjs.map +1 -1
- package/dist/private/calendar/utils.js +6 -2
- package/dist/private/calendar/utils.js.map +1 -1
- package/dist/private/calendar/utils.mjs +6 -2
- package/dist/private/calendar/utils.mjs.map +1 -1
- package/dist/private/checkbox/useCheckboxGroupState.cjs.map +1 -1
- package/dist/private/checkbox/useCheckboxGroupState.js.map +1 -1
- package/dist/private/checkbox/useCheckboxGroupState.mjs.map +1 -1
- package/dist/private/collections/CollectionBuilder.cjs.map +1 -1
- package/dist/private/collections/CollectionBuilder.js.map +1 -1
- package/dist/private/collections/CollectionBuilder.mjs.map +1 -1
- package/dist/private/collections/Item.cjs +1 -0
- package/dist/private/collections/Item.cjs.map +1 -1
- package/dist/private/collections/Item.js +1 -0
- package/dist/private/collections/Item.js.map +1 -1
- package/dist/private/collections/Item.mjs +1 -0
- package/dist/private/collections/Item.mjs.map +1 -1
- package/dist/private/collections/Section.cjs +1 -0
- package/dist/private/collections/Section.cjs.map +1 -1
- package/dist/private/collections/Section.js +1 -0
- package/dist/private/collections/Section.js.map +1 -1
- package/dist/private/collections/Section.mjs +1 -0
- package/dist/private/collections/Section.mjs.map +1 -1
- package/dist/private/collections/getChildNodes.cjs.map +1 -1
- package/dist/private/collections/getChildNodes.js.map +1 -1
- package/dist/private/collections/getChildNodes.mjs.map +1 -1
- package/dist/private/collections/useCollection.cjs.map +1 -1
- package/dist/private/collections/useCollection.js.map +1 -1
- package/dist/private/collections/useCollection.mjs.map +1 -1
- package/dist/private/color/Color.cjs +15 -9
- package/dist/private/color/Color.cjs.map +1 -1
- package/dist/private/color/Color.js +15 -9
- package/dist/private/color/Color.js.map +1 -1
- package/dist/private/color/Color.mjs +15 -9
- package/dist/private/color/Color.mjs.map +1 -1
- package/dist/private/color/useColorAreaState.cjs.map +1 -1
- package/dist/private/color/useColorAreaState.js.map +1 -1
- package/dist/private/color/useColorAreaState.mjs.map +1 -1
- package/dist/private/color/useColorChannelFieldState.cjs.map +1 -1
- package/dist/private/color/useColorChannelFieldState.js.map +1 -1
- package/dist/private/color/useColorChannelFieldState.mjs.map +1 -1
- package/dist/private/color/useColorFieldState.cjs.map +1 -1
- package/dist/private/color/useColorFieldState.js.map +1 -1
- package/dist/private/color/useColorFieldState.mjs.map +1 -1
- package/dist/private/color/useColorPickerState.cjs.map +1 -1
- package/dist/private/color/useColorPickerState.js.map +1 -1
- package/dist/private/color/useColorPickerState.mjs.map +1 -1
- package/dist/private/color/useColorSliderState.cjs +5 -3
- package/dist/private/color/useColorSliderState.cjs.map +1 -1
- package/dist/private/color/useColorSliderState.js +5 -3
- package/dist/private/color/useColorSliderState.js.map +1 -1
- package/dist/private/color/useColorSliderState.mjs +5 -3
- package/dist/private/color/useColorSliderState.mjs.map +1 -1
- package/dist/private/color/useColorWheelState.cjs.map +1 -1
- package/dist/private/color/useColorWheelState.js.map +1 -1
- package/dist/private/color/useColorWheelState.mjs.map +1 -1
- package/dist/private/combobox/useComboBoxState.cjs +8 -2
- package/dist/private/combobox/useComboBoxState.cjs.map +1 -1
- package/dist/private/combobox/useComboBoxState.js +8 -2
- package/dist/private/combobox/useComboBoxState.js.map +1 -1
- package/dist/private/combobox/useComboBoxState.mjs +8 -2
- package/dist/private/combobox/useComboBoxState.mjs.map +1 -1
- package/dist/private/data/useAsyncList.cjs.map +1 -1
- package/dist/private/data/useAsyncList.js.map +1 -1
- package/dist/private/data/useAsyncList.mjs.map +1 -1
- package/dist/private/data/useListData.cjs.map +1 -1
- package/dist/private/data/useListData.js.map +1 -1
- package/dist/private/data/useListData.mjs.map +1 -1
- package/dist/private/data/useTreeData.cjs.map +1 -1
- package/dist/private/data/useTreeData.js.map +1 -1
- package/dist/private/data/useTreeData.mjs.map +1 -1
- package/dist/private/datepicker/IncompleteDate.cjs +8 -2
- package/dist/private/datepicker/IncompleteDate.cjs.map +1 -1
- package/dist/private/datepicker/IncompleteDate.js +8 -2
- package/dist/private/datepicker/IncompleteDate.js.map +1 -1
- package/dist/private/datepicker/IncompleteDate.mjs +8 -2
- package/dist/private/datepicker/IncompleteDate.mjs.map +1 -1
- package/dist/private/datepicker/placeholders.cjs +5 -0
- package/dist/private/datepicker/placeholders.cjs.map +1 -1
- package/dist/private/datepicker/placeholders.js +5 -0
- package/dist/private/datepicker/placeholders.js.map +1 -1
- package/dist/private/datepicker/placeholders.mjs +5 -0
- package/dist/private/datepicker/placeholders.mjs.map +1 -1
- package/dist/private/datepicker/useDateFieldState.cjs.map +1 -1
- package/dist/private/datepicker/useDateFieldState.js.map +1 -1
- package/dist/private/datepicker/useDateFieldState.mjs.map +1 -1
- package/dist/private/datepicker/useDatePickerState.cjs.map +1 -1
- package/dist/private/datepicker/useDatePickerState.js.map +1 -1
- package/dist/private/datepicker/useDatePickerState.mjs.map +1 -1
- package/dist/private/datepicker/useDateRangePickerState.cjs +1 -1
- package/dist/private/datepicker/useDateRangePickerState.cjs.map +1 -1
- package/dist/private/datepicker/useDateRangePickerState.js +1 -1
- package/dist/private/datepicker/useDateRangePickerState.js.map +1 -1
- package/dist/private/datepicker/useDateRangePickerState.mjs +1 -1
- package/dist/private/datepicker/useDateRangePickerState.mjs.map +1 -1
- package/dist/private/datepicker/useTimeFieldState.cjs.map +1 -1
- package/dist/private/datepicker/useTimeFieldState.js.map +1 -1
- package/dist/private/datepicker/useTimeFieldState.mjs.map +1 -1
- package/dist/private/datepicker/utils.cjs +2 -2
- package/dist/private/datepicker/utils.cjs.map +1 -1
- package/dist/private/datepicker/utils.js +2 -2
- package/dist/private/datepicker/utils.js.map +1 -1
- package/dist/private/datepicker/utils.mjs +2 -2
- package/dist/private/datepicker/utils.mjs.map +1 -1
- package/dist/private/disclosure/useDisclosureGroupState.cjs.map +1 -1
- package/dist/private/disclosure/useDisclosureGroupState.js.map +1 -1
- package/dist/private/disclosure/useDisclosureGroupState.mjs.map +1 -1
- package/dist/private/disclosure/useDisclosureState.cjs.map +1 -1
- package/dist/private/disclosure/useDisclosureState.js.map +1 -1
- package/dist/private/disclosure/useDisclosureState.mjs.map +1 -1
- package/dist/private/dnd/useDraggableCollectionState.cjs.map +1 -1
- package/dist/private/dnd/useDraggableCollectionState.js.map +1 -1
- package/dist/private/dnd/useDraggableCollectionState.mjs.map +1 -1
- package/dist/private/dnd/useDroppableCollectionState.cjs.map +1 -1
- package/dist/private/dnd/useDroppableCollectionState.js.map +1 -1
- package/dist/private/dnd/useDroppableCollectionState.mjs.map +1 -1
- package/dist/private/form/useFormValidationState.cjs.map +1 -1
- package/dist/private/form/useFormValidationState.js.map +1 -1
- package/dist/private/form/useFormValidationState.mjs.map +1 -1
- package/dist/private/grid/GridCollection.cjs.map +1 -1
- package/dist/private/grid/GridCollection.js.map +1 -1
- package/dist/private/grid/GridCollection.mjs.map +1 -1
- package/dist/private/grid/useGridState.cjs.map +1 -1
- package/dist/private/grid/useGridState.js.map +1 -1
- package/dist/private/grid/useGridState.mjs.map +1 -1
- package/dist/private/layout/GridLayout.cjs +8 -3
- package/dist/private/layout/GridLayout.cjs.map +1 -1
- package/dist/private/layout/GridLayout.js +8 -3
- package/dist/private/layout/GridLayout.js.map +1 -1
- package/dist/private/layout/GridLayout.mjs +8 -3
- package/dist/private/layout/GridLayout.mjs.map +1 -1
- package/dist/private/layout/ListLayout.cjs +1 -1
- package/dist/private/layout/ListLayout.cjs.map +1 -1
- package/dist/private/layout/ListLayout.js +2 -1
- package/dist/private/layout/ListLayout.js.map +1 -1
- package/dist/private/layout/ListLayout.mjs +1 -1
- package/dist/private/layout/ListLayout.mjs.map +1 -1
- package/dist/private/layout/TableLayout.cjs +60 -35
- package/dist/private/layout/TableLayout.cjs.map +1 -1
- package/dist/private/layout/TableLayout.js +65 -38
- package/dist/private/layout/TableLayout.js.map +1 -1
- package/dist/private/layout/TableLayout.mjs +61 -36
- package/dist/private/layout/TableLayout.mjs.map +1 -1
- package/dist/private/layout/WaterfallLayout.cjs.map +1 -1
- package/dist/private/layout/WaterfallLayout.js.map +1 -1
- package/dist/private/layout/WaterfallLayout.mjs.map +1 -1
- package/dist/private/list/ListCollection.cjs.map +1 -1
- package/dist/private/list/ListCollection.js.map +1 -1
- package/dist/private/list/ListCollection.mjs.map +1 -1
- package/dist/private/list/useListState.cjs.map +1 -1
- package/dist/private/list/useListState.js.map +1 -1
- package/dist/private/list/useListState.mjs.map +1 -1
- package/dist/private/list/useSingleSelectListState.cjs.map +1 -1
- package/dist/private/list/useSingleSelectListState.js.map +1 -1
- package/dist/private/list/useSingleSelectListState.mjs.map +1 -1
- package/dist/private/menu/useMenuTriggerState.cjs.map +1 -1
- package/dist/private/menu/useMenuTriggerState.js.map +1 -1
- package/dist/private/menu/useMenuTriggerState.mjs.map +1 -1
- package/dist/private/menu/useSubmenuTriggerState.cjs.map +1 -1
- package/dist/private/menu/useSubmenuTriggerState.js.map +1 -1
- package/dist/private/menu/useSubmenuTriggerState.mjs.map +1 -1
- package/dist/private/numberfield/useNumberFieldState.cjs +13 -1
- package/dist/private/numberfield/useNumberFieldState.cjs.map +1 -1
- package/dist/private/numberfield/useNumberFieldState.js +13 -1
- package/dist/private/numberfield/useNumberFieldState.js.map +1 -1
- package/dist/private/numberfield/useNumberFieldState.mjs +13 -1
- package/dist/private/numberfield/useNumberFieldState.mjs.map +1 -1
- package/dist/private/overlays/useOverlayTriggerState.cjs.map +1 -1
- package/dist/private/overlays/useOverlayTriggerState.js.map +1 -1
- package/dist/private/overlays/useOverlayTriggerState.mjs.map +1 -1
- package/dist/private/radio/useRadioGroupState.cjs.map +1 -1
- package/dist/private/radio/useRadioGroupState.js.map +1 -1
- package/dist/private/radio/useRadioGroupState.mjs.map +1 -1
- package/dist/private/searchfield/useSearchFieldState.cjs.map +1 -1
- package/dist/private/searchfield/useSearchFieldState.js.map +1 -1
- package/dist/private/searchfield/useSearchFieldState.mjs.map +1 -1
- package/dist/private/select/useSelectState.cjs.map +1 -1
- package/dist/private/select/useSelectState.js.map +1 -1
- package/dist/private/select/useSelectState.mjs.map +1 -1
- package/dist/private/selection/SelectionManager.cjs +2 -1
- package/dist/private/selection/SelectionManager.cjs.map +1 -1
- package/dist/private/selection/SelectionManager.js +3 -2
- package/dist/private/selection/SelectionManager.js.map +1 -1
- package/dist/private/selection/SelectionManager.mjs +2 -1
- package/dist/private/selection/SelectionManager.mjs.map +1 -1
- package/dist/private/selection/useMultipleSelectionState.cjs.map +1 -1
- package/dist/private/selection/useMultipleSelectionState.js.map +1 -1
- package/dist/private/selection/useMultipleSelectionState.mjs.map +1 -1
- package/dist/private/slider/useSliderState.cjs +22 -2
- package/dist/private/slider/useSliderState.cjs.map +1 -1
- package/dist/private/slider/useSliderState.js +22 -2
- package/dist/private/slider/useSliderState.js.map +1 -1
- package/dist/private/slider/useSliderState.mjs +22 -2
- package/dist/private/slider/useSliderState.mjs.map +1 -1
- package/dist/private/steplist/useStepListState.cjs.map +1 -1
- package/dist/private/steplist/useStepListState.js.map +1 -1
- package/dist/private/steplist/useStepListState.mjs.map +1 -1
- package/dist/private/table/Cell.cjs +2 -1
- package/dist/private/table/Cell.cjs.map +1 -1
- package/dist/private/table/Cell.js +2 -1
- package/dist/private/table/Cell.js.map +1 -1
- package/dist/private/table/Cell.mjs +2 -1
- package/dist/private/table/Cell.mjs.map +1 -1
- package/dist/private/table/Column.cjs +1 -0
- package/dist/private/table/Column.cjs.map +1 -1
- package/dist/private/table/Column.js +1 -0
- package/dist/private/table/Column.js.map +1 -1
- package/dist/private/table/Column.mjs +1 -0
- package/dist/private/table/Column.mjs.map +1 -1
- package/dist/private/table/Row.cjs +2 -1
- package/dist/private/table/Row.cjs.map +1 -1
- package/dist/private/table/Row.js +2 -1
- package/dist/private/table/Row.js.map +1 -1
- package/dist/private/table/Row.mjs +2 -1
- package/dist/private/table/Row.mjs.map +1 -1
- package/dist/private/table/TableBody.cjs +4 -2
- package/dist/private/table/TableBody.cjs.map +1 -1
- package/dist/private/table/TableBody.js +4 -2
- package/dist/private/table/TableBody.js.map +1 -1
- package/dist/private/table/TableBody.mjs +4 -2
- package/dist/private/table/TableBody.mjs.map +1 -1
- package/dist/private/table/TableCollection.cjs +1 -1
- package/dist/private/table/TableCollection.cjs.map +1 -1
- package/dist/private/table/TableCollection.js +1 -1
- package/dist/private/table/TableCollection.js.map +1 -1
- package/dist/private/table/TableCollection.mjs +1 -1
- package/dist/private/table/TableCollection.mjs.map +1 -1
- package/dist/private/table/TableColumnLayout.cjs +4 -1
- package/dist/private/table/TableColumnLayout.cjs.map +1 -1
- package/dist/private/table/TableColumnLayout.js +4 -1
- package/dist/private/table/TableColumnLayout.js.map +1 -1
- package/dist/private/table/TableColumnLayout.mjs +4 -1
- package/dist/private/table/TableColumnLayout.mjs.map +1 -1
- package/dist/private/table/TableHeader.cjs +4 -2
- package/dist/private/table/TableHeader.cjs.map +1 -1
- package/dist/private/table/TableHeader.js +4 -2
- package/dist/private/table/TableHeader.js.map +1 -1
- package/dist/private/table/TableHeader.mjs +4 -2
- package/dist/private/table/TableHeader.mjs.map +1 -1
- package/dist/private/table/TableUtils.cjs +1 -1
- package/dist/private/table/TableUtils.cjs.map +1 -1
- package/dist/private/table/TableUtils.js +1 -1
- package/dist/private/table/TableUtils.js.map +1 -1
- package/dist/private/table/TableUtils.mjs +1 -1
- package/dist/private/table/TableUtils.mjs.map +1 -1
- package/dist/private/table/useTableColumnResizeState.cjs.map +1 -1
- package/dist/private/table/useTableColumnResizeState.js.map +1 -1
- package/dist/private/table/useTableColumnResizeState.mjs.map +1 -1
- package/dist/private/table/useTableState.cjs +2 -1
- package/dist/private/table/useTableState.cjs.map +1 -1
- package/dist/private/table/useTableState.js +2 -1
- package/dist/private/table/useTableState.js.map +1 -1
- package/dist/private/table/useTableState.mjs +2 -1
- package/dist/private/table/useTableState.mjs.map +1 -1
- package/dist/private/table/useTreeGridState.cjs +2 -1
- package/dist/private/table/useTreeGridState.cjs.map +1 -1
- package/dist/private/table/useTreeGridState.js +2 -1
- package/dist/private/table/useTreeGridState.js.map +1 -1
- package/dist/private/table/useTreeGridState.mjs +2 -1
- package/dist/private/table/useTreeGridState.mjs.map +1 -1
- package/dist/private/tabs/useTabListState.cjs.map +1 -1
- package/dist/private/tabs/useTabListState.js.map +1 -1
- package/dist/private/tabs/useTabListState.mjs.map +1 -1
- package/dist/private/toast/useToastState.cjs.map +1 -1
- package/dist/private/toast/useToastState.js.map +1 -1
- package/dist/private/toast/useToastState.mjs.map +1 -1
- package/dist/private/toggle/useToggleGroupState.cjs.map +1 -1
- package/dist/private/toggle/useToggleGroupState.js.map +1 -1
- package/dist/private/toggle/useToggleGroupState.mjs.map +1 -1
- package/dist/private/toggle/useToggleState.cjs.map +1 -1
- package/dist/private/toggle/useToggleState.js.map +1 -1
- package/dist/private/toggle/useToggleState.mjs.map +1 -1
- package/dist/private/tooltip/useTooltipTriggerState.cjs.map +1 -1
- package/dist/private/tooltip/useTooltipTriggerState.js.map +1 -1
- package/dist/private/tooltip/useTooltipTriggerState.mjs.map +1 -1
- package/dist/private/tree/TreeCollection.cjs.map +1 -1
- package/dist/private/tree/TreeCollection.js.map +1 -1
- package/dist/private/tree/TreeCollection.mjs.map +1 -1
- package/dist/private/tree/useTreeState.cjs.map +1 -1
- package/dist/private/tree/useTreeState.js.map +1 -1
- package/dist/private/tree/useTreeState.mjs.map +1 -1
- package/dist/private/utils/number.cjs +2 -1
- package/dist/private/utils/number.cjs.map +1 -1
- package/dist/private/utils/number.js +2 -1
- package/dist/private/utils/number.js.map +1 -1
- package/dist/private/utils/number.mjs +2 -1
- package/dist/private/utils/number.mjs.map +1 -1
- package/dist/private/utils/useControlledState.cjs.map +1 -1
- package/dist/private/utils/useControlledState.js.map +1 -1
- package/dist/private/utils/useControlledState.mjs.map +1 -1
- package/dist/private/virtualizer/Layout.cjs.map +1 -1
- package/dist/private/virtualizer/Layout.js.map +1 -1
- package/dist/private/virtualizer/Layout.mjs.map +1 -1
- package/dist/private/virtualizer/LayoutInfo.cjs +4 -2
- package/dist/private/virtualizer/LayoutInfo.cjs.map +1 -1
- package/dist/private/virtualizer/LayoutInfo.js +4 -2
- package/dist/private/virtualizer/LayoutInfo.js.map +1 -1
- package/dist/private/virtualizer/LayoutInfo.mjs +4 -2
- package/dist/private/virtualizer/LayoutInfo.mjs.map +1 -1
- package/dist/private/virtualizer/Rect.cjs +4 -0
- package/dist/private/virtualizer/Rect.cjs.map +1 -1
- package/dist/private/virtualizer/Rect.js +4 -0
- package/dist/private/virtualizer/Rect.js.map +1 -1
- package/dist/private/virtualizer/Rect.mjs +4 -0
- package/dist/private/virtualizer/Rect.mjs.map +1 -1
- package/dist/private/virtualizer/ReusableView.cjs.map +1 -1
- package/dist/private/virtualizer/ReusableView.js.map +1 -1
- package/dist/private/virtualizer/ReusableView.mjs.map +1 -1
- package/dist/private/virtualizer/Size.cjs.map +1 -1
- package/dist/private/virtualizer/Size.js.map +1 -1
- package/dist/private/virtualizer/Size.mjs.map +1 -1
- package/dist/private/virtualizer/Virtualizer.cjs +4 -4
- package/dist/private/virtualizer/Virtualizer.cjs.map +1 -1
- package/dist/private/virtualizer/Virtualizer.js +4 -4
- package/dist/private/virtualizer/Virtualizer.js.map +1 -1
- package/dist/private/virtualizer/Virtualizer.mjs +4 -4
- package/dist/private/virtualizer/Virtualizer.mjs.map +1 -1
- package/dist/private/virtualizer/useVirtualizerState.cjs.map +1 -1
- package/dist/private/virtualizer/useVirtualizerState.js.map +1 -1
- package/dist/private/virtualizer/useVirtualizerState.mjs.map +1 -1
- package/dist/types/exports/useCalendarState.d.ts +1 -1
- package/dist/types/src/autocomplete/useAutocompleteState.d.ts +4 -1
- package/dist/types/src/calendar/types.d.ts +50 -14
- package/dist/types/src/calendar/useCalendarState.d.ts +20 -6
- package/dist/types/src/calendar/useRangeCalendarState.d.ts +14 -5
- package/dist/types/src/calendar/utils.d.ts +1 -0
- package/dist/types/src/checkbox/useCheckboxGroupState.d.ts +1 -0
- package/dist/types/src/collections/useCollection.d.ts +1 -1
- package/dist/types/src/color/useColorAreaState.d.ts +21 -8
- package/dist/types/src/color/useColorFieldState.d.ts +2 -3
- package/dist/types/src/color/useColorSliderState.d.ts +4 -1
- package/dist/types/src/color/useColorWheelState.d.ts +5 -1
- package/dist/types/src/combobox/useComboBoxState.d.ts +19 -6
- package/dist/types/src/data/useAsyncList.d.ts +2 -2
- package/dist/types/src/data/useListData.d.ts +13 -1
- package/dist/types/src/data/useTreeData.d.ts +11 -0
- package/dist/types/src/datepicker/IncompleteDate.d.ts +11 -5
- package/dist/types/src/datepicker/types.d.ts +37 -11
- package/dist/types/src/datepicker/useDateFieldState.d.ts +13 -4
- package/dist/types/src/datepicker/useDatePickerState.d.ts +10 -4
- package/dist/types/src/datepicker/useDateRangePickerState.d.ts +12 -3
- package/dist/types/src/dnd/useDraggableCollectionState.d.ts +4 -1
- package/dist/types/src/form/useFormValidationState.d.ts +4 -1
- package/dist/types/src/grid/GridCollection.d.ts +2 -1
- package/dist/types/src/grid/useGridState.d.ts +7 -3
- package/dist/types/src/layout/GridLayout.d.ts +18 -2
- package/dist/types/src/layout/ListLayout.d.ts +34 -12
- package/dist/types/src/layout/TableLayout.d.ts +11 -4
- package/dist/types/src/layout/WaterfallLayout.d.ts +9 -2
- package/dist/types/src/list/useListState.d.ts +2 -2
- package/dist/types/src/menu/useMenuTriggerState.d.ts +3 -1
- package/dist/types/src/menu/useSubmenuTriggerState.d.ts +2 -2
- package/dist/types/src/numberfield/useNumberFieldState.d.ts +15 -11
- package/dist/types/src/radio/useRadioGroupState.d.ts +4 -1
- package/dist/types/src/select/useSelectState.d.ts +13 -2
- package/dist/types/src/selection/types.d.ts +4 -1
- package/dist/types/src/selection/useMultipleSelectionState.d.ts +2 -0
- package/dist/types/src/slider/useSliderState.d.ts +22 -2
- package/dist/types/src/table/Column.d.ts +4 -1
- package/dist/types/src/table/Row.d.ts +5 -3
- package/dist/types/src/table/TableBody.d.ts +3 -2
- package/dist/types/src/table/TableCollection.d.ts +4 -1
- package/dist/types/src/table/TableColumnLayout.d.ts +4 -1
- package/dist/types/src/table/TableHeader.d.ts +7 -3
- package/dist/types/src/table/TableUtils.d.ts +19 -16
- package/dist/types/src/table/useTableColumnResizeState.d.ts +5 -3
- package/dist/types/src/table/useTableState.d.ts +15 -6
- package/dist/types/src/table/useTreeGridState.d.ts +3 -2
- package/dist/types/src/toggle/useToggleGroupState.d.ts +1 -0
- package/dist/types/src/toggle/useToggleState.d.ts +2 -1
- package/dist/types/src/tooltip/useTooltipTriggerState.d.ts +8 -2
- package/dist/types/src/tree/useTreeState.d.ts +1 -1
- package/dist/types/src/utils/number.d.ts +2 -1
- package/dist/types/src/virtualizer/Layout.d.ts +5 -2
- package/dist/types/src/virtualizer/LayoutInfo.d.ts +10 -3
- package/dist/types/src/virtualizer/Rect.d.ts +4 -0
- package/dist/types/src/virtualizer/Virtualizer.d.ts +5 -4
- package/package.json +8 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA;;;;;;;;;;CAUC,GAIM,MAAM;IAOX,YAAY,KAAwB,CAAE;aAN9B,SAA4B,IAAI;aAEhC,WAAuB;aACvB,UAAsB;QAI5B,IAAI,CAAC,QAAQ,GAAG;QAEhB,IAAI,QAAQ,CAAC;YACX,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE;YAE1B,IAAI,KAAK,UAAU,IAAI,KAAK,IAAI,KAAK,WACn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AO;IACrB;IAEA,QAAQ,GAAQ,EAAkB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ;IACjC;IAEA,GAAG,GAAW,EAAkB;QAC9B,MAAM,OAAO;eAAI,IAAI,CAAC,OAAO;SAAG;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;IAC/B;IAEA,YAAY,GAAQ,EAAqB;QACvC,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;QAC3B,OAAO,MAAM,cAAc,EAAE;IAC/B;AACF","sources":["packages/react-stately/src/list/ListCollection.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nimport {Collection, Key, Node} from '@react-types/shared';\n\nexport class ListCollection<T> implements Collection<Node<T>> {\n private keyMap: Map<Key, Node<T>> = new Map();\n private iterable: Iterable<Node<T>>;\n private firstKey: Key | null = null;\n private lastKey: Key | null = null;\n private _size: number;\n\n constructor(nodes: Iterable<Node<T>>) {\n this.iterable = nodes;\n\n let visit = (node: Node<T>) => {\n this.keyMap.set(node.key, node);\n\n if (node.childNodes && node.type === 'section') {\n for (let child of node.childNodes) {\n visit(child);\n }\n }\n };\n\n for (let node of nodes) {\n visit(node);\n }\n\n let last: Node<T> | null = null;\n let index = 0;\n let size = 0;\n for (let [key, node] of this.keyMap) {\n if (last) {\n last.nextKey = key;\n node.prevKey = last.key;\n } else {\n this.firstKey = key;\n node.prevKey = undefined;\n }\n\n if (node.type === 'item') {\n node.index = index++;\n }\n\n // Only count sections and items when determining size so that\n // loaders and separators in RAC/S2 don't influence the emptyState determination\n if (node.type === 'section' || node.type === 'item') {\n size++;\n }\n\n last = node;\n\n // Set nextKey as undefined since this might be the last node\n // If it isn't the last node, last.nextKey will properly set at start of new loop\n last.nextKey = undefined;\n }\n this._size = size;\n this.lastKey = last?.key ?? null;\n }\n\n *[Symbol.iterator](): IterableIterator<Node<T>> {\n yield* this.iterable;\n }\n\n get size(): number {\n return this._size;\n }\n\n getKeys(): IterableIterator<Key> {\n return this.keyMap.keys();\n }\n\n getKeyBefore(key: Key): Key | null {\n let node = this.keyMap.get(key);\n return node ? (node.prevKey ?? null) : null;\n }\n\n getKeyAfter(key: Key): Key | null {\n let node = this.keyMap.get(key);\n return node ? (node.nextKey ?? null) : null;\n }\n\n getFirstKey(): Key | null {\n return this.firstKey;\n }\n\n getLastKey(): Key | null {\n return this.lastKey;\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) ?? null;\n }\n\n at(idx: number): Node<T> | null {\n const keys = [...this.getKeys()];\n return this.getItem(keys[idx]);\n }\n\n getChildren(key: Key): Iterable<Node<T>> {\n let node = this.keyMap.get(key);\n return node?.childNodes || [];\n }\n}\n"],"names":[],"version":3,"file":"ListCollection.mjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAuCM,SAAS,0CAAgB,KAAmB;IACjD,IAAI,UAAC,MAAM,kBAAE,cAAc,EAAC,GAAG;IAE/B,IAAI,iBAAiB,CAAA,GAAA,mDAAwB,EAAE;IAC/C,IAAI,eAAe,CAAA,GAAA,oBAAM,EACvB,IAAO,MAAM,YAAY,GAAG,IAAI,IAAI,MAAM,YAAY,IAAI,IAAI,OAC9D;QAAC,MAAM,YAAY;KAAC;IAGtB,IAAI,UAAU,CAAA,GAAA,wBAAU,EACtB,CAAA,QACE,SAAS,IAAI,C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UAAU,CAAC,iBAAiB,UAAU,CAAC,MAAM;oBACrE,iBAAiB;oBACjB;gBACF;gBAEA,MAAM,iBAAiB,OAAO,CAAC,WAAW,CAAC;YAC7C;YAEA,wCAAwC;YACxC,IAAI,kBAAkB,MAAM;gBAC1B,MAAM,iBAAiB,OAAO,CAAC,YAAY,CAAC,iBAAiB,UAAU;gBACvE,MAAO,OAAO,KAAM;oBAClB,IAAI,OAAO,WAAW,OAAO,CAAC;oBAC9B,IAAI,QAAQ,KAAK,IAAI,KAAK,UAAU,CAAC,iBAAiB,UAAU,CAAC,MAAM;wBACrE,iBAAiB;wBACjB;oBACF;oBAEA,MAAM,iBAAiB,OAAO,CAAC,YAAY,CAAC;gBAC9C;YACF;YAEA,iBAAiB,aAAa,CAAC;QACjC;QACA,iBAAiB,OAAO,GAAG;IAC7B,GAAG;QAAC;QAAY;KAAiB;AACnC","sources":["packages/react-stately/src/list/useListState.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nimport {Collection, CollectionStateBase, Key, LayoutDelegate, Node} from '@react-types/shared';\nimport {ListCollection} from './ListCollection';\nimport {\n MultipleSelectionStateProps,\n useMultipleSelectionState\n} from '../selection/useMultipleSelectionState';\nimport {SelectionManager} from '../selection/SelectionManager';\nimport {useCallback, useEffect, useMemo, useRef} from 'react';\nimport {useCollection} from '../collections/useCollection';\n\nexport interface ListProps<T> extends CollectionStateBase<T>, MultipleSelectionStateProps {\n /** Filter function to generate a filtered list of nodes. */\n filter?: (nodes: Iterable<Node<T>>) => Iterable<Node<T>>;\n /** @private */\n suppressTextValueWarning?: boolean;\n /**\n * A delegate object that provides layout information for items in the collection.\n * This can be used to override the behavior of shift selection.\n */\n layoutDelegate?: LayoutDelegate;\n}\n\nexport interface ListState<T> {\n /** A collection of items in the list. */\n collection: Collection<Node<T>>;\n\n /** A set of items that are disabled. */\n disabledKeys: Set<Key>;\n\n /** A selection manager to read and update multiple selection state. */\n selectionManager: SelectionManager;\n}\n\n/**\n * Provides state management for list-like components. Handles building a collection\n * of items from props, and manages multiple selection state.\n */\nexport function useListState<T>(props: ListProps<T>): ListState<T> {\n let {filter, layoutDelegate} = props;\n\n let selectionState = useMultipleSelectionState(props);\n let disabledKeys = useMemo(\n () => (props.disabledKeys ? new Set(props.disabledKeys) : new Set<Key>()),\n [props.disabledKeys]\n );\n\n let factory = useCallback(\n nodes =>\n filter ? new ListCollection(filter(nodes)) : new ListCollection(nodes as Iterable<Node<T>>),\n [filter]\n );\n let context = useMemo(\n () => ({suppressTextValueWarning: props.suppressTextValueWarning}),\n [props.suppressTextValueWarning]\n );\n\n let collection = useCollection(props, factory, context);\n\n let selectionManager = useMemo(\n () => new SelectionManager(collection, selectionState, {layoutDelegate}),\n [collection, selectionState, layoutDelegate]\n );\n\n useFocusedKeyReset(collection, selectionManager);\n\n return {\n collection,\n disabledKeys,\n selectionManager\n };\n}\n\n/**\n * Filters a collection using the provided filter function and returns a new ListState.\n */\nexport function UNSTABLE_useFilteredListState<T>(\n state: ListState<T>,\n filterFn: ((nodeValue: string, node: Node<T>) => boolean) | null | undefined\n): ListState<T> {\n let collection = useMemo(\n () => (filterFn ? state.collection.filter!(filterFn) : state.collection),\n [state.collection, filterFn]\n );\n let selectionManager = state.selectionManager.withCollection(collection);\n useFocusedKeyReset(collection, selectionManager);\n return {\n collection,\n selectionManager,\n disabledKeys: state.disabledKeys\n };\n}\n\nfunction useFocusedKeyReset<T>(\n collection: Collection<Node<T>>,\n selectionManager: SelectionManager\n) {\n // Reset focused key if that item is deleted from the collection.\n const cachedCollection = useRef<Collection<Node<T>> | null>(null);\n useEffect(() => {\n if (\n selectionManager.focusedKey != null &&\n !collection.getItem(selectionManager.focusedKey) &&\n cachedCollection.current\n ) {\n // Walk forward in the old collection to find the next key that still exists in the new collection.\n let key = cachedCollection.current.getKeyAfter(selectionManager.focusedKey);\n let nextFocusedKey: Key | null = null;\n while (key != null) {\n let node = collection.getItem(key);\n if (node && node.type === 'item' && !selectionManager.isDisabled(key)) {\n nextFocusedKey = key;\n break;\n }\n\n key = cachedCollection.current.getKeyAfter(key);\n }\n\n // If no such key exists, walk backward.\n if (nextFocusedKey == null) {\n key = cachedCollection.current.getKeyBefore(selectionManager.focusedKey);\n while (key != null) {\n let node = collection.getItem(key);\n if (node && node.type === 'item' && !selectionManager.isDisabled(key)) {\n nextFocusedKey = key;\n break;\n }\n\n key = cachedCollection.current.getKeyBefore(key);\n }\n }\n\n selectionManager.setFocusedKey(nextFocusedKey);\n }\n cachedCollection.current = collection;\n }, [collection, selectionManager]);\n}\n"],"names":[],"version":3,"file":"useListState.cjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAuCM,SAAS,0CAAgB,KAAmB;IACjD,IAAI,UAAC,MAAM,kBAAE,cAAc,EAAC,GAAG;IAE/B,IAAI,iBAAiB,CAAA,GAAA,yCAAwB,EAAE;IAC/C,IAAI,eAAe,CAAA,GAAA,cAAM,EACvB,IAAO,MAAM,YAAY,GAAG,IAAI,IAAI,MAAM,YAAY,IAAI,IAAI,OAC9D;QAAC,MAAM,YAAY;KAAC;IAGtB,IAAI,UAAU,CAAA,GAAA,kBAAU,EACtB,CAAA,QACE,SAAS,IAAI,CAAA,GAAA,yCAAa,EAAE,OAAO,UAAU,IAAI,CAAA,GAAA,yCAAa,EAAE,QAClE;QAAC;KAAO;IAEV,IAAI,UAAU,CAAA,GAAA,cAAM,EAClB,IAAO,C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,IAAI,kBAAkB,MAAM;gBAC1B,MAAM,iBAAiB,OAAO,CAAC,YAAY,CAAC,iBAAiB,UAAU;gBACvE,MAAO,OAAO,KAAM;oBAClB,IAAI,OAAO,WAAW,OAAO,CAAC;oBAC9B,IAAI,QAAQ,KAAK,IAAI,KAAK,UAAU,CAAC,iBAAiB,UAAU,CAAC,MAAM;wBACrE,iBAAiB;wBACjB;oBACF;oBAEA,MAAM,iBAAiB,OAAO,CAAC,YAAY,CAAC;gBAC9C;YACF;YAEA,iBAAiB,aAAa,CAAC;QACjC;QACA,iBAAiB,OAAO,GAAG;IAC7B,GAAG;QAAC;QAAY;KAAiB;AACnC","sources":["packages/react-stately/src/list/useListState.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nimport {Collection, CollectionStateBase, Key, LayoutDelegate, Node} from '@react-types/shared';\nimport {ListCollection} from './ListCollection';\nimport {\n MultipleSelectionStateProps,\n useMultipleSelectionState\n} from '../selection/useMultipleSelectionState';\nimport {SelectionManager} from '../selection/SelectionManager';\nimport {useCallback, useEffect, useMemo, useRef} from 'react';\nimport {useCollection} from '../collections/useCollection';\n\nexport interface ListProps<T> extends CollectionStateBase<T>, MultipleSelectionStateProps {\n /** Filter function to generate a filtered list of nodes. */\n filter?: (nodes: Iterable<Node<T>>) => Iterable<Node<T>>;\n /** @private */\n suppressTextValueWarning?: boolean;\n /**\n * A delegate object that provides layout information for items in the collection.\n * This can be used to override the behavior of shift selection.\n */\n layoutDelegate?: LayoutDelegate;\n}\n\nexport interface ListState<T> {\n /** A collection of items in the list. */\n collection: Collection<Node<T>>;\n\n /** A set of items that are disabled. */\n disabledKeys: Set<Key>;\n\n /** A selection manager to read and update multiple selection state. */\n selectionManager: SelectionManager;\n}\n\n/**\n * Provides state management for list-like components. Handles building a collection\n * of items from props, and manages multiple selection state.\n */\nexport function useListState<T>(props: ListProps<T>): ListState<T> {\n let {filter, layoutDelegate} = props;\n\n let selectionState = useMultipleSelectionState(props);\n let disabledKeys = useMemo(\n () => (props.disabledKeys ? new Set(props.disabledKeys) : new Set<Key>()),\n [props.disabledKeys]\n );\n\n let factory = useCallback(\n nodes =>\n filter ? new ListCollection(filter(nodes)) : new ListCollection(nodes as Iterable<Node<T>>),\n [filter]\n );\n let context = useMemo(\n () => ({suppressTextValueWarning: props.suppressTextValueWarning}),\n [props.suppressTextValueWarning]\n );\n\n let collection = useCollection(props, factory, context);\n\n let selectionManager = useMemo(\n () => new SelectionManager(collection, selectionState, {layoutDelegate}),\n [collection, selectionState, layoutDelegate]\n );\n\n useFocusedKeyReset(collection, selectionManager);\n\n return {\n collection,\n disabledKeys,\n selectionManager\n };\n}\n\n/**\n * Filters a collection using the provided filter function and returns a new ListState.\n */\nexport function UNSTABLE_useFilteredListState<T>(\n state: ListState<T>,\n filterFn: ((nodeValue: string, node: Node<T>) => boolean) | null | undefined\n): ListState<T> {\n let collection = useMemo(\n () => (filterFn ? state.collection.filter!(filterFn) : state.collection),\n [state.collection, filterFn]\n );\n let selectionManager = state.selectionManager.withCollection(collection);\n useFocusedKeyReset(collection, selectionManager);\n return {\n collection,\n selectionManager,\n disabledKeys: state.disabledKeys\n };\n}\n\nfunction useFocusedKeyReset<T>(\n collection: Collection<Node<T>>,\n selectionManager: SelectionManager\n) {\n // Reset focused key if that item is deleted from the collection.\n const cachedCollection = useRef<Collection<Node<T>> | null>(null);\n useEffect(() => {\n if (\n selectionManager.focusedKey != null &&\n !collection.getItem(selectionManager.focusedKey) &&\n cachedCollection.current\n ) {\n // Walk forward in the old collection to find the next key that still exists in the new collection.\n let key = cachedCollection.current.getKeyAfter(selectionManager.focusedKey);\n let nextFocusedKey: Key | null = null;\n while (key != null) {\n let node = collection.getItem(key);\n if (node && node.type === 'item' && !selectionManager.isDisabled(key)) {\n nextFocusedKey = key;\n break;\n }\n\n key = cachedCollection.current.getKeyAfter(key);\n }\n\n // If no such key exists, walk backward.\n if (nextFocusedKey == null) {\n key = cachedCollection.current.getKeyBefore(selectionManager.focusedKey);\n while (key != null) {\n let node = collection.getItem(key);\n if (node && node.type === 'item' && !selectionManager.isDisabled(key)) {\n nextFocusedKey = key;\n break;\n }\n\n key = cachedCollection.current.getKeyBefore(key);\n }\n }\n\n selectionManager.setFocusedKey(nextFocusedKey);\n }\n cachedCollection.current = collection;\n }, [collection, selectionManager]);\n}\n"],"names":[],"version":3,"file":"useListState.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAuCM,SAAS,0CAAgB,KAAmB;IACjD,IAAI,UAAC,MAAM,kBAAE,cAAc,EAAC,GAAG;IAE/B,IAAI,iBAAiB,CAAA,GAAA,yCAAwB,EAAE;IAC/C,IAAI,eAAe,CAAA,GAAA,cAAM,EACvB,IAAO,MAAM,YAAY,GAAG,IAAI,IAAI,MAAM,YAAY,IAAI,IAAI,OAC9D;QAAC,MAAM,YAAY;KAAC;IAGtB,IAAI,UAAU,CAAA,GAAA,kBAAU,EACtB,CAAA,QACE,SAAS,IAAI,CAAA,GAAA,yCAAa,EAAE,OAAO,UAAU,IAAI,CAAA,GAAA,yCAAa,EAAE,QAClE;QAAC;KAAO;IAEV,IAAI,UAAU,CAAA,GAAA,cAAM,EAClB,IAAO,CAAA;YAAC,0BAA0B,MAAM,wBAAwB;QAAA,CAAA,GAChE;QAAC,MAAM,wBAAwB;KAAC;IAGlC,IAAI,aAAa,CAAA,GAAA,yCAAY,EAAE,OAAO,SAAS;IAE/C,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AC;oBAC9B,IAAI,QAAQ,KAAK,IAAI,KAAK,UAAU,CAAC,iBAAiB,UAAU,CAAC,MAAM;wBACrE,iBAAiB;wBACjB;oBACF;oBAEA,MAAM,iBAAiB,OAAO,CAAC,YAAY,CAAC;gBAC9C;YACF;YAEA,iBAAiB,aAAa,CAAC;QACjC;QACA,iBAAiB,OAAO,GAAG;IAC7B,GAAG;QAAC;QAAY;KAAiB;AACnC","sources":["packages/react-stately/src/list/useListState.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nimport {Collection, CollectionStateBase, Key, LayoutDelegate, Node} from '@react-types/shared';\nimport {ListCollection} from './ListCollection';\nimport {\n MultipleSelectionStateProps,\n useMultipleSelectionState\n} from '../selection/useMultipleSelectionState';\nimport {SelectionManager} from '../selection/SelectionManager';\nimport {useCallback, useEffect, useMemo, useRef} from 'react';\nimport {useCollection} from '../collections/useCollection';\n\nexport interface ListProps<T> extends CollectionStateBase<T>, MultipleSelectionStateProps {\n /** Filter function to generate a filtered list of nodes. */\n filter?: (nodes: Iterable<Node<T>>) => Iterable<Node<T>>;\n /** @private */\n suppressTextValueWarning?: boolean;\n /**\n * A delegate object that provides layout information for items in the collection.\n * This can be used to override the behavior of shift selection.\n */\n layoutDelegate?: LayoutDelegate;\n}\n\nexport interface ListState<T> {\n /** A collection of items in the list. */\n collection: Collection<Node<T>>;\n\n /** A set of items that are disabled. */\n disabledKeys: Set<Key>;\n\n /** A selection manager to read and update multiple selection state. */\n selectionManager: SelectionManager;\n}\n\n/**\n * Provides state management for list-like components. Handles building a collection\n * of items from props, and manages multiple selection state.\n */\nexport function useListState<T>(props: ListProps<T>): ListState<T> {\n let {filter, layoutDelegate} = props;\n\n let selectionState = useMultipleSelectionState(props);\n let disabledKeys = useMemo(\n () => (props.disabledKeys ? new Set(props.disabledKeys) : new Set<Key>()),\n [props.disabledKeys]\n );\n\n let factory = useCallback(\n nodes =>\n filter ? new ListCollection(filter(nodes)) : new ListCollection(nodes as Iterable<Node<T>>),\n [filter]\n );\n let context = useMemo(\n () => ({suppressTextValueWarning: props.suppressTextValueWarning}),\n [props.suppressTextValueWarning]\n );\n\n let collection = useCollection(props, factory, context);\n\n let selectionManager = useMemo(\n () => new SelectionManager(collection, selectionState, {layoutDelegate}),\n [collection, selectionState, layoutDelegate]\n );\n\n useFocusedKeyReset(collection, selectionManager);\n\n return {\n collection,\n disabledKeys,\n selectionManager\n };\n}\n\n/**\n * Filters a collection using the provided filter function and returns a new ListState.\n */\nexport function UNSTABLE_useFilteredListState<T>(\n state: ListState<T>,\n filterFn: ((nodeValue: string, node: Node<T>) => boolean) | null | undefined\n): ListState<T> {\n let collection = useMemo(\n () => (filterFn ? state.collection.filter!(filterFn) : state.collection),\n [state.collection, filterFn]\n );\n let selectionManager = state.selectionManager.withCollection(collection);\n useFocusedKeyReset(collection, selectionManager);\n return {\n collection,\n selectionManager,\n disabledKeys: state.disabledKeys\n };\n}\n\nfunction useFocusedKeyReset<T>(\n collection: Collection<Node<T>>,\n selectionManager: SelectionManager\n) {\n // Reset focused key if that item is deleted from the collection.\n const cachedCollection = useRef<Collection<Node<T>> | null>(null);\n useEffect(() => {\n if (\n selectionManager.focusedKey != null &&\n !collection.getItem(selectionManager.focusedKey) &&\n cachedCollection.current\n ) {\n // Walk forward in the old collection to find the next key that still exists in the new collection.\n let key = cachedCollection.current.getKeyAfter(selectionManager.focusedKey);\n let nextFocusedKey: Key | null = null;\n while (key != null) {\n let node = collection.getItem(key);\n if (node && node.type === 'item' && !selectionManager.isDisabled(key)) {\n nextFocusedKey = key;\n break;\n }\n\n key = cachedCollection.current.getKeyAfter(key);\n }\n\n // If no such key exists, walk backward.\n if (nextFocusedKey == null) {\n key = cachedCollection.current.getKeyBefore(selectionManager.focusedKey);\n while (key != null) {\n let node = collection.getItem(key);\n if (node && node.type === 'item' && !selectionManager.isDisabled(key)) {\n nextFocusedKey = key;\n break;\n }\n\n key = cachedCollection.current.getKeyBefore(key);\n }\n }\n\n selectionManager.setFocusedKey(nextFocusedKey);\n }\n cachedCollection.current = collection;\n }, [collection, selectionManager]);\n}\n"],"names":[],"version":3,"file":"useListState.mjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AA8BM,SAAS,0CACd,KAA+B;IAE/B,IAAI,CAAC,aAAa,eAAe,GAAG,CAAA,GAAA,4CAAiB,EACnD,MAAM,WAAW,EACjB,MAAM,kBAAkB,IAAI,MAC5B,MAAM,iBAAiB;IAEzB,IAAI,eAAe,CAAA,GAAA,oBAAM,EAAE,IAAO,eAAe,OAAO;YAAC;SAAY,GAAG,EAAE,EAAG;QAAC;KAAY;IAC1F,IAAI,cAAC,UAAU,gBAAE,YAAY,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,sCAAW,EAAE;QAC9D,GAAG,KAAK;QACR,eAAe;QACf,wBAAwB;QACxB,+BAA+B;sBAC/B;QACA,mBAAmB,CAAC;YAClB,uCAAuC;YACvC,IAAI,SAAS,OACX;YAEF,IAAI,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,KAAK,IAAI;YAExC,6DAA6D;YAC7D,oDAAoD;YACpD,IAAI,QAAQ,eAAe,MAAM,iBAAiB,EAChD,MAAM,iBAAiB,CAAC;YAG1B,eAAe;QACjB;IACF;IAEA,IAAI,eAAe,eAAe,OAAO,WAAW,OAAO,CAAC,eAAe;IAE3E,OAAO;oBACL;sBACA;0BACA;qBACA;wBACA;sBACA;IACF;AACF","sources":["packages/react-stately/src/list/useSingleSelectListState.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nimport {CollectionStateBase, Key, Node, Selection, SingleSelection} from '@react-types/shared';\nimport {ListState, useListState} from './useListState';\nimport {useControlledState} from '../utils/useControlledState';\nimport {useMemo} from 'react';\n\nexport interface SingleSelectListProps<T>\n extends CollectionStateBase<T>, Omit<SingleSelection, 'disallowEmptySelection'> {\n /** Filter function to generate a filtered list of nodes. */\n filter?: (nodes: Iterable<Node<T>>) => Iterable<Node<T>>;\n /** @private */\n suppressTextValueWarning?: boolean;\n}\n\nexport interface SingleSelectListState<T> extends ListState<T> {\n /** The key for the currently selected item. */\n readonly selectedKey: Key | null;\n\n /** Sets the selected key. */\n setSelectedKey(key: Key | null): void;\n\n /** The value of the currently selected item. */\n readonly selectedItem: Node<T> | null;\n}\n\n/**\n * Provides state management for list-like components with single selection.\n * Handles building a collection of items from props, and manages selection state.\n */\nexport function useSingleSelectListState<T extends object>(\n props: SingleSelectListProps<T>\n): SingleSelectListState<T> {\n let [selectedKey, setSelectedKey] = useControlledState(\n props.selectedKey,\n props.defaultSelectedKey ?? null,\n props.onSelectionChange\n );\n let selectedKeys = useMemo(() => (selectedKey != null ? [selectedKey] : []), [selectedKey]);\n let {collection, disabledKeys, selectionManager} = useListState({\n ...props,\n selectionMode: 'single',\n disallowEmptySelection: true,\n allowDuplicateSelectionEvents: true,\n selectedKeys,\n onSelectionChange: (keys: Selection) => {\n // impossible, but TS doesn't know that\n if (keys === 'all') {\n return;\n }\n let key = keys.values().next().value ?? null;\n\n // Always fire onSelectionChange, even if the key is the same\n // as the current key (useControlledState does not).\n if (key === selectedKey && props.onSelectionChange) {\n props.onSelectionChange(key);\n }\n\n setSelectedKey(key);\n }\n });\n\n let selectedItem = selectedKey != null ? collection.getItem(selectedKey) : null;\n\n return {\n collection,\n disabledKeys,\n selectionManager,\n selectedKey,\n setSelectedKey,\n selectedItem\n };\n}\n"],"names":[],"version":3,"file":"useSingleSelectListState.cjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA8BM,SAAS,0CACd,KAA+B;QAI7B;IAFF,IAAI,CAAC,aAAa,eAAe,GAAG,CAAA,GAAA,yCAAiB,EACnD,MAAM,WAAW,EACjB,CAAA,4BAAA,MAAM,kBAAkB,cAAxB,uCAAA,4BAA4B,MAC5B,MAAM,iBAAiB;IAEzB,IAAI,eAAe,CAAA,GAAA,cAAM,EAAE,IAAO,eAAe,OAAO;YAAC;SAAY,GAAG,EAAE,EAAG;QAAC;KAAY;IAC1F,IAAI,cAAC,UAAU,gBAAE,YAAY,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE;QAC9D,GAAG,KAAK;QACR,eAAe;QACf,wBAAwB;QACxB,+BAA+B;sBAC/B;QACA,mBAAmB,CAAC;YAClB,uCAAuC;YACvC,IAAI,SAAS,OACX;gBAEQ;YAAV,IAAI,MAAM,CAAA,0BAAA,KAAK,MAAM,GAAG,IAAI,GAAG,KAAK,cAA1B,qCAAA,0BAA8B;YAExC,6DAA6D;YAC7D,oDAAoD;YACpD,IAAI,QAAQ,eAAe,MAAM,iBAAiB,EAChD,MAAM,iBAAiB,CAAC;YAG1B,eAAe;QACjB;IACF;IAEA,IAAI,eAAe,eAAe,OAAO,WAAW,OAAO,CAAC,eAAe;IAE3E,OAAO;oBACL;sBACA;0BACA;qBACA;wBACA;sBACA;IACF;AACF","sources":["packages/react-stately/src/list/useSingleSelectListState.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nimport {CollectionStateBase, Key, Node, Selection, SingleSelection} from '@react-types/shared';\nimport {ListState, useListState} from './useListState';\nimport {useControlledState} from '../utils/useControlledState';\nimport {useMemo} from 'react';\n\nexport interface SingleSelectListProps<T>\n extends CollectionStateBase<T>, Omit<SingleSelection, 'disallowEmptySelection'> {\n /** Filter function to generate a filtered list of nodes. */\n filter?: (nodes: Iterable<Node<T>>) => Iterable<Node<T>>;\n /** @private */\n suppressTextValueWarning?: boolean;\n}\n\nexport interface SingleSelectListState<T> extends ListState<T> {\n /** The key for the currently selected item. */\n readonly selectedKey: Key | null;\n\n /** Sets the selected key. */\n setSelectedKey(key: Key | null): void;\n\n /** The value of the currently selected item. */\n readonly selectedItem: Node<T> | null;\n}\n\n/**\n * Provides state management for list-like components with single selection.\n * Handles building a collection of items from props, and manages selection state.\n */\nexport function useSingleSelectListState<T extends object>(\n props: SingleSelectListProps<T>\n): SingleSelectListState<T> {\n let [selectedKey, setSelectedKey] = useControlledState(\n props.selectedKey,\n props.defaultSelectedKey ?? null,\n props.onSelectionChange\n );\n let selectedKeys = useMemo(() => (selectedKey != null ? [selectedKey] : []), [selectedKey]);\n let {collection, disabledKeys, selectionManager} = useListState({\n ...props,\n selectionMode: 'single',\n disallowEmptySelection: true,\n allowDuplicateSelectionEvents: true,\n selectedKeys,\n onSelectionChange: (keys: Selection) => {\n // impossible, but TS doesn't know that\n if (keys === 'all') {\n return;\n }\n let key = keys.values().next().value ?? null;\n\n // Always fire onSelectionChange, even if the key is the same\n // as the current key (useControlledState does not).\n if (key === selectedKey && props.onSelectionChange) {\n props.onSelectionChange(key);\n }\n\n setSelectedKey(key);\n }\n });\n\n let selectedItem = selectedKey != null ? collection.getItem(selectedKey) : null;\n\n return {\n collection,\n disabledKeys,\n selectionManager,\n selectedKey,\n setSelectedKey,\n selectedItem\n };\n}\n"],"names":[],"version":3,"file":"useSingleSelectListState.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA8BM,SAAS,0CACd,KAA+B;IAE/B,IAAI,CAAC,aAAa,eAAe,GAAG,CAAA,GAAA,yCAAiB,EACnD,MAAM,WAAW,EACjB,MAAM,kBAAkB,IAAI,MAC5B,MAAM,iBAAiB;IAEzB,IAAI,eAAe,CAAA,GAAA,cAAM,EAAE,IAAO,eAAe,OAAO;YAAC;SAAY,GAAG,EAAE,EAAG;QAAC;KAAY;IAC1F,IAAI,cAAC,UAAU,gBAAE,YAAY,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE;QAC9D,GAAG,KAAK;QACR,eAAe;QACf,wBAAwB;QACxB,+BAA+B;sBAC/B;QACA,mBAAmB,CAAC;YAClB,uCAAuC;YACvC,IAAI,SAAS,OACX;YAEF,IAAI,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,KAAK,IAAI;YAExC,6DAA6D;YAC7D,oDAAoD;YACpD,IAAI,QAAQ,eAAe,MAAM,iBAAiB,EAChD,MAAM,iBAAiB,CAAC;YAG1B,eAAe;QACjB;IACF;IAEA,IAAI,eAAe,eAAe,OAAO,WAAW,OAAO,CAAC,eAAe;IAE3E,OAAO;oBACL;sBACA;0BACA;qBACA;wBACA;sBACA;IACF;AACF","sources":["packages/react-stately/src/list/useSingleSelectListState.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nimport {CollectionStateBase, Key, Node, Selection, SingleSelection} from '@react-types/shared';\nimport {ListState, useListState} from './useListState';\nimport {useControlledState} from '../utils/useControlledState';\nimport {useMemo} from 'react';\n\nexport interface SingleSelectListProps<T>\n extends CollectionStateBase<T>, Omit<SingleSelection, 'disallowEmptySelection'> {\n /** Filter function to generate a filtered list of nodes. */\n filter?: (nodes: Iterable<Node<T>>) => Iterable<Node<T>>;\n /** @private */\n suppressTextValueWarning?: boolean;\n}\n\nexport interface SingleSelectListState<T> extends ListState<T> {\n /** The key for the currently selected item. */\n readonly selectedKey: Key | null;\n\n /** Sets the selected key. */\n setSelectedKey(key: Key | null): void;\n\n /** The value of the currently selected item. */\n readonly selectedItem: Node<T> | null;\n}\n\n/**\n * Provides state management for list-like components with single selection.\n * Handles building a collection of items from props, and manages selection state.\n */\nexport function useSingleSelectListState<T extends object>(\n props: SingleSelectListProps<T>\n): SingleSelectListState<T> {\n let [selectedKey, setSelectedKey] = useControlledState(\n props.selectedKey,\n props.defaultSelectedKey ?? null,\n props.onSelectionChange\n );\n let selectedKeys = useMemo(() => (selectedKey != null ? [selectedKey] : []), [selectedKey]);\n let {collection, disabledKeys, selectionManager} = useListState({\n ...props,\n selectionMode: 'single',\n disallowEmptySelection: true,\n allowDuplicateSelectionEvents: true,\n selectedKeys,\n onSelectionChange: (keys: Selection) => {\n // impossible, but TS doesn't know that\n if (keys === 'all') {\n return;\n }\n let key = keys.values().next().value ?? null;\n\n // Always fire onSelectionChange, even if the key is the same\n // as the current key (useControlledState does not).\n if (key === selectedKey && props.onSelectionChange) {\n props.onSelectionChange(key);\n }\n\n setSelectedKey(key);\n }\n });\n\n let selectedItem = selectedKey != null ? collection.getItem(selectedKey) : null;\n\n return {\n collection,\n disabledKeys,\n selectionManager,\n selectedKey,\n setSelectedKey,\n selectedItem\n };\n}\n"],"names":[],"version":3,"file":"useSingleSelectListState.mjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAsDM,SAAS,0CAAoB,KAAuB;IACzD,IAAI,sBAAsB,CAAA,GAAA,gDAAqB,EAAE;IACjD,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,qBAAO,EAAwB;IACvE,IAAI,CAAC,mBAAmB,qBAAqB,GAAG,CAAA,GAAA,qBAAO,EAAS,EAAE;IAElE,IAAI,WAAW;QACb,qBAAqB,EAAE;QACvB,oBAAoB,KAAK;IAC3B;IAEA,IAAI,cAAc,CAAC,YAAiB;QAClC,qBAAqB,CAAA;YACnB,IAAI,QAAQ,SAAS,MAAM,EACzB,OAAO;YAGT,OAAO;mBAAI,SAAS,KAAK,CAAC,GAAG;gBAAQ;aAAW;QAClD;IACF;IAEA,IAAI,eAAe,CAAC,YAAiB;QACnC,qBAAqB,CAAA;YACnB,IAAI,MAAM,QAAQ,CAAC,MAAM;YACzB,IAAI,QAAQ,YACV,OAAO,SAAS,KAAK,CAAC,GAAG;iBAEzB,OAAO;QAEX;IACF;IAEA,OAAO;uBACL;QACA,GAAG,mBAAmB;QACtB,MAAK,gBAAsC,IAAI;YAC7C,iBAAiB;YACjB,oBAAoB,IAAI;QAC1B;QACA,QAAO,gBAAsC,IAAI;YAC/C,iBAAiB;YACjB,oBAAoB,MAAM;QAC5B;QACA;YACE;QACF;2BACA;qBACA;sBACA;IACF;AACF","sources":["packages/react-stately/src/menu/useMenuTriggerState.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nimport {FocusStrategy, Key} from '@react-types/shared';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from '../overlays/useOverlayTriggerState';\nimport {useState} from 'react';\n\nexport type MenuTriggerType = 'press' | 'longPress';\n\nexport interface MenuTriggerProps extends OverlayTriggerProps {\n /**\n * How the menu is triggered.\n *\n * @default 'press'\n */\n trigger?: MenuTriggerType;\n}\n\nexport interface MenuTriggerState extends OverlayTriggerState {\n /** Controls which item will be auto focused when the menu opens. */\n readonly focusStrategy: FocusStrategy | null;\n\n /** Opens the menu. */\n open(focusStrategy?: FocusStrategy | null): void;\n\n /** Toggles the menu. */\n toggle(focusStrategy?: FocusStrategy | null): void;\n}\n\nexport interface RootMenuTriggerState extends MenuTriggerState {\n /** Opens a specific submenu tied to a specific menu item at a specific level. */\n openSubmenu: (triggerKey: Key, level: number) => void;\n\n /** Closes a specific submenu tied to a specific menu item at a specific level. */\n closeSubmenu: (triggerKey: Key, level: number) => void;\n\n /**\n * An array of open submenu trigger keys within the menu tree.\n * The index of key within array matches the submenu level in the tree.\n */\n expandedKeysStack: Key[];\n\n /** Closes the menu and all submenus in the menu tree. */\n close: () => void;\n}\n\n/**\n * Manages state for a menu trigger. Tracks whether the menu is currently open,\n * and controls which item will receive focus when it opens. Also tracks the open submenus within\n * the menu tree via their trigger keys.\n */\nexport function useMenuTriggerState(props: MenuTriggerProps): RootMenuTriggerState {\n let overlayTriggerState = useOverlayTriggerState(props);\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy | null>(null);\n let [expandedKeysStack, setExpandedKeysStack] = useState<Key[]>([]);\n\n let closeAll = () => {\n setExpandedKeysStack([]);\n overlayTriggerState.close();\n };\n\n let openSubmenu = (triggerKey: Key, level: number) => {\n setExpandedKeysStack(oldStack => {\n if (level > oldStack.length) {\n return oldStack;\n }\n\n return [...oldStack.slice(0, level), triggerKey];\n });\n };\n\n let closeSubmenu = (triggerKey: Key, level: number) => {\n setExpandedKeysStack(oldStack => {\n let key = oldStack[level];\n if (key === triggerKey) {\n return oldStack.slice(0, level);\n } else {\n return oldStack;\n }\n });\n };\n\n return {\n focusStrategy,\n ...overlayTriggerState,\n open(focusStrategy: FocusStrategy | null = null) {\n setFocusStrategy(focusStrategy);\n overlayTriggerState.open();\n },\n toggle(focusStrategy: FocusStrategy | null = null) {\n setFocusStrategy(focusStrategy);\n overlayTriggerState.toggle();\n },\n close() {\n closeAll();\n },\n expandedKeysStack,\n openSubmenu,\n closeSubmenu\n };\n}\n"],"names":[],"version":3,"file":"useMenuTriggerState.cjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAsDM,SAAS,0CAAoB,KAAuB;IACzD,IAAI,sBAAsB,CAAA,GAAA,yCAAqB,EAAE;IACjD,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,eAAO,EAAwB;IACvE,IAAI,CAAC,mBAAmB,qBAAqB,GAAG,CAAA,GAAA,eAAO,EAAS,EAAE;IAElE,IAAI,WAAW;QACb,qBAAqB,EAAE;QACvB,oBAAoB,KAAK;IAC3B;IAEA,IAAI,cAAc,CAAC,YAAiB;QAClC,qBAAqB,CAAA;YACnB,IAAI,QAAQ,SAAS,MAAM,EACzB,OAAO;YAGT,OAAO;mBAAI,SAAS,KAAK,CAAC,GAAG;gBAAQ;aAAW;QAClD;IACF;IAEA,IAAI,eAAe,CAAC,YAAiB;QACnC,qBAAqB,CAAA;YACnB,IAAI,MAAM,QAAQ,CAAC,MAAM;YACzB,IAAI,QAAQ,YACV,OAAO,SAAS,KAAK,CAAC,GAAG;iBAEzB,OAAO;QAEX;IACF;IAEA,OAAO;uBACL;QACA,GAAG,mBAAmB;QACtB,MAAK,gBAAsC,IAAI;YAC7C,iBAAiB;YACjB,oBAAoB,IAAI;QAC1B;QACA,QAAO,gBAAsC,IAAI;YAC/C,iBAAiB;YACjB,oBAAoB,MAAM;QAC5B;QACA;YACE;QACF;2BACA;qBACA;sBACA;IACF;AACF","sources":["packages/react-stately/src/menu/useMenuTriggerState.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nimport {FocusStrategy, Key} from '@react-types/shared';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from '../overlays/useOverlayTriggerState';\nimport {useState} from 'react';\n\nexport type MenuTriggerType = 'press' | 'longPress';\n\nexport interface MenuTriggerProps extends OverlayTriggerProps {\n /**\n * How the menu is triggered.\n *\n * @default 'press'\n */\n trigger?: MenuTriggerType;\n}\n\nexport interface MenuTriggerState extends OverlayTriggerState {\n /** Controls which item will be auto focused when the menu opens. */\n readonly focusStrategy: FocusStrategy | null;\n\n /** Opens the menu. */\n open(focusStrategy?: FocusStrategy | null): void;\n\n /** Toggles the menu. */\n toggle(focusStrategy?: FocusStrategy | null): void;\n}\n\nexport interface RootMenuTriggerState extends MenuTriggerState {\n /** Opens a specific submenu tied to a specific menu item at a specific level. */\n openSubmenu: (triggerKey: Key, level: number) => void;\n\n /** Closes a specific submenu tied to a specific menu item at a specific level. */\n closeSubmenu: (triggerKey: Key, level: number) => void;\n\n /**\n * An array of open submenu trigger keys within the menu tree.\n * The index of key within array matches the submenu level in the tree.\n */\n expandedKeysStack: Key[];\n\n /** Closes the menu and all submenus in the menu tree. */\n close: () => void;\n}\n\n/**\n * Manages state for a menu trigger. Tracks whether the menu is currently open,\n * and controls which item will receive focus when it opens. Also tracks the open submenus within\n * the menu tree via their trigger keys.\n */\nexport function useMenuTriggerState(props: MenuTriggerProps): RootMenuTriggerState {\n let overlayTriggerState = useOverlayTriggerState(props);\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy | null>(null);\n let [expandedKeysStack, setExpandedKeysStack] = useState<Key[]>([]);\n\n let closeAll = () => {\n setExpandedKeysStack([]);\n overlayTriggerState.close();\n };\n\n let openSubmenu = (triggerKey: Key, level: number) => {\n setExpandedKeysStack(oldStack => {\n if (level > oldStack.length) {\n return oldStack;\n }\n\n return [...oldStack.slice(0, level), triggerKey];\n });\n };\n\n let closeSubmenu = (triggerKey: Key, level: number) => {\n setExpandedKeysStack(oldStack => {\n let key = oldStack[level];\n if (key === triggerKey) {\n return oldStack.slice(0, level);\n } else {\n return oldStack;\n }\n });\n };\n\n return {\n focusStrategy,\n ...overlayTriggerState,\n open(focusStrategy: FocusStrategy | null = null) {\n setFocusStrategy(focusStrategy);\n overlayTriggerState.open();\n },\n toggle(focusStrategy: FocusStrategy | null = null) {\n setFocusStrategy(focusStrategy);\n overlayTriggerState.toggle();\n },\n close() {\n closeAll();\n },\n expandedKeysStack,\n openSubmenu,\n closeSubmenu\n };\n}\n"],"names":[],"version":3,"file":"useMenuTriggerState.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAsDM,SAAS,0CAAoB,KAAuB;IACzD,IAAI,sBAAsB,CAAA,GAAA,yCAAqB,EAAE;IACjD,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,eAAO,EAAwB;IACvE,IAAI,CAAC,mBAAmB,qBAAqB,GAAG,CAAA,GAAA,eAAO,EAAS,EAAE;IAElE,IAAI,WAAW;QACb,qBAAqB,EAAE;QACvB,oBAAoB,KAAK;IAC3B;IAEA,IAAI,cAAc,CAAC,YAAiB;QAClC,qBAAqB,CAAA;YACnB,IAAI,QAAQ,SAAS,MAAM,EACzB,OAAO;YAGT,OAAO;mBAAI,SAAS,KAAK,CAAC,GAAG;gBAAQ;aAAW;QAClD;IACF;IAEA,IAAI,eAAe,CAAC,YAAiB;QACnC,qBAAqB,CAAA;YACnB,IAAI,MAAM,QAAQ,CAAC,MAAM;YACzB,IAAI,QAAQ,YACV,OAAO,SAAS,KAAK,CAAC,GAAG;iBAEzB,OAAO;QAEX;IACF;IAEA,OAAO;uBACL;QACA,GAAG,mBAAmB;QACtB,MAAK,gBAAsC,IAAI;YAC7C,iBAAiB;YACjB,oBAAoB,IAAI;QAC1B;QACA,QAAO,gBAAsC,IAAI;YAC/C,iBAAiB;YACjB,oBAAoB,MAAM;QAC5B;QACA;YACE;QACF;2BACA;qBACA;sBACA;IACF;AACF","sources":["packages/react-stately/src/menu/useMenuTriggerState.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nimport {FocusStrategy, Key} from '@react-types/shared';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from '../overlays/useOverlayTriggerState';\nimport {useState} from 'react';\n\nexport type MenuTriggerType = 'press' | 'longPress';\n\nexport interface MenuTriggerProps extends OverlayTriggerProps {\n /**\n * How the menu is triggered.\n *\n * @default 'press'\n */\n trigger?: MenuTriggerType;\n}\n\nexport interface MenuTriggerState extends OverlayTriggerState {\n /** Controls which item will be auto focused when the menu opens. */\n readonly focusStrategy: FocusStrategy | null;\n\n /** Opens the menu. */\n open(focusStrategy?: FocusStrategy | null): void;\n\n /** Toggles the menu. */\n toggle(focusStrategy?: FocusStrategy | null): void;\n}\n\nexport interface RootMenuTriggerState extends MenuTriggerState {\n /** Opens a specific submenu tied to a specific menu item at a specific level. */\n openSubmenu: (triggerKey: Key, level: number) => void;\n\n /** Closes a specific submenu tied to a specific menu item at a specific level. */\n closeSubmenu: (triggerKey: Key, level: number) => void;\n\n /**\n * An array of open submenu trigger keys within the menu tree.\n * The index of key within array matches the submenu level in the tree.\n */\n expandedKeysStack: Key[];\n\n /** Closes the menu and all submenus in the menu tree. */\n close: () => void;\n}\n\n/**\n * Manages state for a menu trigger. Tracks whether the menu is currently open,\n * and controls which item will receive focus when it opens. Also tracks the open submenus within\n * the menu tree via their trigger keys.\n */\nexport function useMenuTriggerState(props: MenuTriggerProps): RootMenuTriggerState {\n let overlayTriggerState = useOverlayTriggerState(props);\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy | null>(null);\n let [expandedKeysStack, setExpandedKeysStack] = useState<Key[]>([]);\n\n let closeAll = () => {\n setExpandedKeysStack([]);\n overlayTriggerState.close();\n };\n\n let openSubmenu = (triggerKey: Key, level: number) => {\n setExpandedKeysStack(oldStack => {\n if (level > oldStack.length) {\n return oldStack;\n }\n\n return [...oldStack.slice(0, level), triggerKey];\n });\n };\n\n let closeSubmenu = (triggerKey: Key, level: number) => {\n setExpandedKeysStack(oldStack => {\n let key = oldStack[level];\n if (key === triggerKey) {\n return oldStack.slice(0, level);\n } else {\n return oldStack;\n }\n });\n };\n\n return {\n focusStrategy,\n ...overlayTriggerState,\n open(focusStrategy: FocusStrategy | null = null) {\n setFocusStrategy(focusStrategy);\n overlayTriggerState.open();\n },\n toggle(focusStrategy: FocusStrategy | null = null) {\n setFocusStrategy(focusStrategy);\n overlayTriggerState.toggle();\n },\n close() {\n closeAll();\n },\n expandedKeysStack,\n openSubmenu,\n closeSubmenu\n };\n}\n"],"names":[],"version":3,"file":"useMenuTriggerState.mjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAmCM,SAAS,
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAmCM,SAAS,0CACd,KAA0B,EAC1B,KAA2B;IAE3B,IAAI,cAAC,UAAU,EAAC,GAAG;IACnB,IAAI,qBAAC,iBAAiB,eAAE,WAAW,gBAAE,YAAY,EAAE,OAAO,QAAQ,EAAC,GAAG;IACtE,IAAI,CAAC,aAAa,GAAG,CAAA,GAAA,qBAAO,EAAE,mBAAmB;IACjD,IAAI,SAAS,CAAA,GAAA,oBAAM,EACjB,IAAM,iBAAiB,CAAC,aAAa,KAAK,YAC1C;QAAC;QAAmB;QAAY;KAAa;IAE/C,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,qBAAO,EAAwB;IAEvE,IAAI,OAAO,CAAA,GAAA,wBAAU,EACnB,CAAC;QACC,iBAAiB,iBAAiB;QAClC,YAAY,YAAY;IAC1B,GACA;QAAC;QAAa;QAAc;KAAW;IAGzC,IAAI,QAAQ,CAAA,GAAA,wBAAU,EAAE;QACtB,iBAAiB;QACjB,aAAa,YAAY;IAC3B,GAAG;QAAC;QAAc;QAAc;KAAW;IAE3C,IAAI,SAAS,CAAA,GAAA,wBAAU,EACrB,CAAC;QACC,iBAAiB,iBAAiB;QAClC,IAAI,QACF;aAEA,KAAK;IAET,GACA;QAAC;QAAO;QAAM;KAAO;IAGvB,OAAO,CAAA,GAAA,oBAAM,EACX,IAAO,CAAA;2BACL;oBACA;kBACA;mBACA;sBACA;0BACA;YACA,mJAAmJ;YACnJ,2EAA2E;YAC3E,SAAS,KAAO;oBAChB;QACF,CAAA,GACA;QAAC;QAAQ;QAAM;QAAO;QAAU;QAAe;QAAQ;KAAa;AAExE","sources":["packages/react-stately/src/menu/useSubmenuTriggerState.ts"],"sourcesContent":["/*\n * Copyright 2023 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\nimport {FocusStrategy, Key} from '@react-types/shared';\nimport type {OverlayTriggerState} from '../overlays/useOverlayTriggerState';\nimport {RootMenuTriggerState} from './useMenuTriggerState';\nimport {useCallback, useMemo, useState} from 'react';\n\nexport interface SubmenuTriggerProps {\n /** Key of the trigger item. */\n triggerKey: Key;\n}\n\nexport interface SubmenuTriggerState extends OverlayTriggerState {\n /** Whether the submenu is currently open. */\n isOpen: boolean;\n /** Controls which item will be auto focused when the submenu opens. */\n focusStrategy: FocusStrategy | null;\n /** Opens the submenu. */\n open: (focusStrategy?: FocusStrategy | null) => void;\n /** Closes the submenu. */\n close: () => void;\n /** Closes all menus and submenus in the menu tree. */\n closeAll: () => void;\n /** The level of the submenu. */\n submenuLevel: number;\n /** Toggles the submenu. */\n toggle: (focusStrategy?: FocusStrategy | null) => void;\n /** @private */\n setOpen: () => void;\n}\n\n/**\n * Manages state for a submenu trigger. Tracks whether the submenu is currently open, the level of\n * the submenu, and controls which item will receive focus when it opens.\n */\nexport function useSubmenuTriggerState(\n props: SubmenuTriggerProps,\n state: RootMenuTriggerState\n): SubmenuTriggerState {\n let {triggerKey} = props;\n let {expandedKeysStack, openSubmenu, closeSubmenu, close: closeAll} = state;\n let [submenuLevel] = useState(expandedKeysStack?.length);\n let isOpen = useMemo(\n () => expandedKeysStack[submenuLevel] === triggerKey,\n [expandedKeysStack, triggerKey, submenuLevel]\n );\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy | null>(null);\n\n let open = useCallback(\n (focusStrategy?: FocusStrategy | null) => {\n setFocusStrategy(focusStrategy ?? null);\n openSubmenu(triggerKey, submenuLevel);\n },\n [openSubmenu, submenuLevel, triggerKey]\n );\n\n let close = useCallback(() => {\n setFocusStrategy(null);\n closeSubmenu(triggerKey, submenuLevel);\n }, [closeSubmenu, submenuLevel, triggerKey]);\n\n let toggle = useCallback(\n (focusStrategy?: FocusStrategy | null) => {\n setFocusStrategy(focusStrategy ?? null);\n if (isOpen) {\n close();\n } else {\n open(focusStrategy);\n }\n },\n [close, open, isOpen]\n );\n\n return useMemo(\n () => ({\n focusStrategy,\n isOpen,\n open,\n close,\n closeAll,\n submenuLevel,\n // TODO: Placeholders that aren't used but give us parity with OverlayTriggerState so we can use this in Popover. Refactor if we update Popover via\n // https://github.com/adobe/react-spectrum/pull/4976#discussion_r1336472863\n setOpen: () => {},\n toggle\n }),\n [isOpen, open, close, closeAll, focusStrategy, toggle, submenuLevel]\n );\n}\n"],"names":[],"version":3,"file":"useSubmenuTriggerState.cjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAmCM,SAAS,
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAmCM,SAAS,0CACd,KAA0B,EAC1B,KAA2B;IAE3B,IAAI,cAAC,UAAU,EAAC,GAAG;IACnB,IAAI,qBAAC,iBAAiB,eAAE,WAAW,gBAAE,YAAY,EAAE,OAAO,QAAQ,EAAC,GAAG;IACtE,IAAI,CAAC,aAAa,GAAG,CAAA,GAAA,eAAO,EAAE,8BAAA,wCAAA,kBAAmB,MAAM;IACvD,IAAI,SAAS,CAAA,GAAA,cAAM,EACjB,IAAM,iBAAiB,CAAC,aAAa,KAAK,YAC1C;QAAC;QAAmB;QAAY;KAAa;IAE/C,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,eAAO,EAAwB;IAEvE,IAAI,OAAO,CAAA,GAAA,kBAAU,EACnB,CAAC;QACC,iBAAiB,0BAAA,2BAAA,gBAAiB;QAClC,YAAY,YAAY;IAC1B,GACA;QAAC;QAAa;QAAc;KAAW;IAGzC,IAAI,QAAQ,CAAA,GAAA,kBAAU,EAAE;QACtB,iBAAiB;QACjB,aAAa,YAAY;IAC3B,GAAG;QAAC;QAAc;QAAc;KAAW;IAE3C,IAAI,SAAS,CAAA,GAAA,kBAAU,EACrB,CAAC;QACC,iBAAiB,0BAAA,2BAAA,gBAAiB;QAClC,IAAI,QACF;aAEA,KAAK;IAET,GACA;QAAC;QAAO;QAAM;KAAO;IAGvB,OAAO,CAAA,GAAA,cAAM,EACX,IAAO,CAAA;2BACL;oBACA;kBACA;mBACA;sBACA;0BACA;YACA,mJAAmJ;YACnJ,2EAA2E;YAC3E,SAAS,KAAO;oBAChB;QACF,CAAA,GACA;QAAC;QAAQ;QAAM;QAAO;QAAU;QAAe;QAAQ;KAAa;AAExE","sources":["packages/react-stately/src/menu/useSubmenuTriggerState.ts"],"sourcesContent":["/*\n * Copyright 2023 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\nimport {FocusStrategy, Key} from '@react-types/shared';\nimport type {OverlayTriggerState} from '../overlays/useOverlayTriggerState';\nimport {RootMenuTriggerState} from './useMenuTriggerState';\nimport {useCallback, useMemo, useState} from 'react';\n\nexport interface SubmenuTriggerProps {\n /** Key of the trigger item. */\n triggerKey: Key;\n}\n\nexport interface SubmenuTriggerState extends OverlayTriggerState {\n /** Whether the submenu is currently open. */\n isOpen: boolean;\n /** Controls which item will be auto focused when the submenu opens. */\n focusStrategy: FocusStrategy | null;\n /** Opens the submenu. */\n open: (focusStrategy?: FocusStrategy | null) => void;\n /** Closes the submenu. */\n close: () => void;\n /** Closes all menus and submenus in the menu tree. */\n closeAll: () => void;\n /** The level of the submenu. */\n submenuLevel: number;\n /** Toggles the submenu. */\n toggle: (focusStrategy?: FocusStrategy | null) => void;\n /** @private */\n setOpen: () => void;\n}\n\n/**\n * Manages state for a submenu trigger. Tracks whether the submenu is currently open, the level of\n * the submenu, and controls which item will receive focus when it opens.\n */\nexport function useSubmenuTriggerState(\n props: SubmenuTriggerProps,\n state: RootMenuTriggerState\n): SubmenuTriggerState {\n let {triggerKey} = props;\n let {expandedKeysStack, openSubmenu, closeSubmenu, close: closeAll} = state;\n let [submenuLevel] = useState(expandedKeysStack?.length);\n let isOpen = useMemo(\n () => expandedKeysStack[submenuLevel] === triggerKey,\n [expandedKeysStack, triggerKey, submenuLevel]\n );\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy | null>(null);\n\n let open = useCallback(\n (focusStrategy?: FocusStrategy | null) => {\n setFocusStrategy(focusStrategy ?? null);\n openSubmenu(triggerKey, submenuLevel);\n },\n [openSubmenu, submenuLevel, triggerKey]\n );\n\n let close = useCallback(() => {\n setFocusStrategy(null);\n closeSubmenu(triggerKey, submenuLevel);\n }, [closeSubmenu, submenuLevel, triggerKey]);\n\n let toggle = useCallback(\n (focusStrategy?: FocusStrategy | null) => {\n setFocusStrategy(focusStrategy ?? null);\n if (isOpen) {\n close();\n } else {\n open(focusStrategy);\n }\n },\n [close, open, isOpen]\n );\n\n return useMemo(\n () => ({\n focusStrategy,\n isOpen,\n open,\n close,\n closeAll,\n submenuLevel,\n // TODO: Placeholders that aren't used but give us parity with OverlayTriggerState so we can use this in Popover. Refactor if we update Popover via\n // https://github.com/adobe/react-spectrum/pull/4976#discussion_r1336472863\n setOpen: () => {},\n toggle\n }),\n [isOpen, open, close, closeAll, focusStrategy, toggle, submenuLevel]\n );\n}\n"],"names":[],"version":3,"file":"useSubmenuTriggerState.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAmCM,SAAS,
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAmCM,SAAS,0CACd,KAA0B,EAC1B,KAA2B;IAE3B,IAAI,cAAC,UAAU,EAAC,GAAG;IACnB,IAAI,qBAAC,iBAAiB,eAAE,WAAW,gBAAE,YAAY,EAAE,OAAO,QAAQ,EAAC,GAAG;IACtE,IAAI,CAAC,aAAa,GAAG,CAAA,GAAA,eAAO,EAAE,mBAAmB;IACjD,IAAI,SAAS,CAAA,GAAA,cAAM,EACjB,IAAM,iBAAiB,CAAC,aAAa,KAAK,YAC1C;QAAC;QAAmB;QAAY;KAAa;IAE/C,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,eAAO,EAAwB;IAEvE,IAAI,OAAO,CAAA,GAAA,kBAAU,EACnB,CAAC;QACC,iBAAiB,iBAAiB;QAClC,YAAY,YAAY;IAC1B,GACA;QAAC;QAAa;QAAc;KAAW;IAGzC,IAAI,QAAQ,CAAA,GAAA,kBAAU,EAAE;QACtB,iBAAiB;QACjB,aAAa,YAAY;IAC3B,GAAG;QAAC;QAAc;QAAc;KAAW;IAE3C,IAAI,SAAS,CAAA,GAAA,kBAAU,EACrB,CAAC;QACC,iBAAiB,iBAAiB;QAClC,IAAI,QACF;aAEA,KAAK;IAET,GACA;QAAC;QAAO;QAAM;KAAO;IAGvB,OAAO,CAAA,GAAA,cAAM,EACX,IAAO,CAAA;2BACL;oBACA;kBACA;mBACA;sBACA;0BACA;YACA,mJAAmJ;YACnJ,2EAA2E;YAC3E,SAAS,KAAO;oBAChB;QACF,CAAA,GACA;QAAC;QAAQ;QAAM;QAAO;QAAU;QAAe;QAAQ;KAAa;AAExE","sources":["packages/react-stately/src/menu/useSubmenuTriggerState.ts"],"sourcesContent":["/*\n * Copyright 2023 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\nimport {FocusStrategy, Key} from '@react-types/shared';\nimport type {OverlayTriggerState} from '../overlays/useOverlayTriggerState';\nimport {RootMenuTriggerState} from './useMenuTriggerState';\nimport {useCallback, useMemo, useState} from 'react';\n\nexport interface SubmenuTriggerProps {\n /** Key of the trigger item. */\n triggerKey: Key;\n}\n\nexport interface SubmenuTriggerState extends OverlayTriggerState {\n /** Whether the submenu is currently open. */\n isOpen: boolean;\n /** Controls which item will be auto focused when the submenu opens. */\n focusStrategy: FocusStrategy | null;\n /** Opens the submenu. */\n open: (focusStrategy?: FocusStrategy | null) => void;\n /** Closes the submenu. */\n close: () => void;\n /** Closes all menus and submenus in the menu tree. */\n closeAll: () => void;\n /** The level of the submenu. */\n submenuLevel: number;\n /** Toggles the submenu. */\n toggle: (focusStrategy?: FocusStrategy | null) => void;\n /** @private */\n setOpen: () => void;\n}\n\n/**\n * Manages state for a submenu trigger. Tracks whether the submenu is currently open, the level of\n * the submenu, and controls which item will receive focus when it opens.\n */\nexport function useSubmenuTriggerState(\n props: SubmenuTriggerProps,\n state: RootMenuTriggerState\n): SubmenuTriggerState {\n let {triggerKey} = props;\n let {expandedKeysStack, openSubmenu, closeSubmenu, close: closeAll} = state;\n let [submenuLevel] = useState(expandedKeysStack?.length);\n let isOpen = useMemo(\n () => expandedKeysStack[submenuLevel] === triggerKey,\n [expandedKeysStack, triggerKey, submenuLevel]\n );\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy | null>(null);\n\n let open = useCallback(\n (focusStrategy?: FocusStrategy | null) => {\n setFocusStrategy(focusStrategy ?? null);\n openSubmenu(triggerKey, submenuLevel);\n },\n [openSubmenu, submenuLevel, triggerKey]\n );\n\n let close = useCallback(() => {\n setFocusStrategy(null);\n closeSubmenu(triggerKey, submenuLevel);\n }, [closeSubmenu, submenuLevel, triggerKey]);\n\n let toggle = useCallback(\n (focusStrategy?: FocusStrategy | null) => {\n setFocusStrategy(focusStrategy ?? null);\n if (isOpen) {\n close();\n } else {\n open(focusStrategy);\n }\n },\n [close, open, isOpen]\n );\n\n return useMemo(\n () => ({\n focusStrategy,\n isOpen,\n open,\n close,\n closeAll,\n submenuLevel,\n // TODO: Placeholders that aren't used but give us parity with OverlayTriggerState so we can use this in Popover. Refactor if we update Popover via\n // https://github.com/adobe/react-spectrum/pull/4976#discussion_r1336472863\n setOpen: () => {},\n toggle\n }),\n [isOpen, open, close, closeAll, focusStrategy, toggle, submenuLevel]\n );\n}\n"],"names":[],"version":3,"file":"useSubmenuTriggerState.mjs.map"}
|
|
@@ -74,7 +74,7 @@ function $7dbcf2f8a3f533af$export$7f629e9dc1ecf37c(props) {
|
|
|
74
74
|
let [prevValue, setPrevValue] = (0, $dsW9M$react.useState)(numberValue);
|
|
75
75
|
let [prevLocale, setPrevLocale] = (0, $dsW9M$react.useState)(locale);
|
|
76
76
|
let [prevFormatOptions, setPrevFormatOptions] = (0, $dsW9M$react.useState)(formatOptions);
|
|
77
|
-
if (!Object.is(numberValue, prevValue) || locale !== prevLocale || formatOptions
|
|
77
|
+
if (!Object.is(numberValue, prevValue) || locale !== prevLocale || !$7dbcf2f8a3f533af$var$isEqualFormatOptions(formatOptions, prevFormatOptions)) {
|
|
78
78
|
setInputValue(format(numberValue));
|
|
79
79
|
setPrevValue(numberValue);
|
|
80
80
|
setPrevLocale(locale);
|
|
@@ -187,6 +187,18 @@ function $7dbcf2f8a3f533af$export$7f629e9dc1ecf37c(props) {
|
|
|
187
187
|
commit: commit
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
|
+
// Shallow equality is sufficient here because all values in Intl.NumberFormatOptions are primitives.
|
|
191
|
+
function $7dbcf2f8a3f533af$var$isEqualFormatOptions(a, b) {
|
|
192
|
+
if (a === b) return true;
|
|
193
|
+
if (!a || !b) return false;
|
|
194
|
+
let aKeys = Object.keys(a);
|
|
195
|
+
let bKeys = Object.keys(b);
|
|
196
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
197
|
+
for (let key of aKeys){
|
|
198
|
+
if (b[key] !== a[key]) return false;
|
|
199
|
+
}
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
190
202
|
function $7dbcf2f8a3f533af$var$handleDecimalOperation(operator, value1, value2) {
|
|
191
203
|
let result = operator === '+' ? value1 + value2 : value1 - value2;
|
|
192
204
|
// Check if we have decimals
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAsFM,SAAS,0CACd,KAA8B;IAE9B,IAAI,YACF,QAAQ,YACR,QAAQ,QACR,IAAI,iBACJ,aAAa,SACb,KAAK,gBACL,eAAe,eACf,QAAQ,UACR,MAAM,cACN,UAAU,cACV,UAAU,kBACV,iBAAiB,QAClB,GAAG;IAEJ,IAAI,UAAU,MACZ,QAAQ;IAGV,IAAI,YAAY,CAAA,GAAA,wBAAU,EAAE,CAAA;QAC1B,OAAO,SAAS,aAAa,MAAM,QAC/B,CAAA,GAAA,+BAAI,EAAE,OAAO,UAAU,YACvB,CAAA,GAAA,yCAAc,EAAE,OAAO,UAAU,UAAU;IACjD,GAAG;QAAC;QAAM;QAAU;KAAS;IAE7B,IAAI,UAAU,aAAa,CAAC,MAAM,UAAU,mBAAmB,QAC7D,QAAQ,UAAU;IAGpB,IAAI,CAAC,MAAM,iBAAiB,mBAAmB,QAC7C,eAAe,UAAU;IAG3B,IAAI,CAAC,aAAa,eAAe,GAAG,CAAA,GAAA,4CAAiB,EAAU,OAAO,MAAM,gBAAg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B,MAAM,gBAAgB,eAAe;wBACzD;uBACA;oBACA;gBACA;IACF;AACF;AAEA,SAAS,6CAAuB,QAAmB,EAAE,MAAc,EAAE,MAAc;IACjF,IAAI,SAAS,aAAa,MAAM,SAAS,SAAS,SAAS;IAE3D,4BAA4B;IAC5B,IAAI,SAAS,MAAM,KAAK,SAAS,MAAM,GAAG;QACxC,MAAM,gBAAgB,OAAO,QAAQ,GAAG,KAAK,CAAC;QAC9C,MAAM,gBAAgB,OAAO,QAAQ,GAAG,KAAK,CAAC;QAC9C,MAAM,sBAAsB,AAAC,aAAa,CAAC,EAAE,IAAI,aAAa,CAAC,EAAE,CAAC,MAAM,IAAK;QAC7E,MAAM,sBAAsB,AAAC,aAAa,CAAC,EAAE,IAAI,aAAa,CAAC,EAAE,CAAC,MAAM,IAAK;QAC7E,MAAM,aAAa,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,qBAAqB;QAE9D,4DAA4D;QAC5D,SAAS,KAAK,KAAK,CAAC,SAAS;QAC7B,SAAS,KAAK,KAAK,CAAC,SAAS;QAE7B,2FAA2F;QAC3F,SAAS,aAAa,MAAM,SAAS,SAAS,SAAS;QAEvD,+CAA+C;QAC/C,UAAU;IACZ;IAEA,OAAO;AACT","sources":["packages/react-stately/src/numberfield/useNumberFieldState.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nimport {clamp, snapValueToStep} from '../utils/number';\n\nimport {FocusableProps, HelpTextProps, InputBase, LabelableProps, RangeInputBase, TextInputBase, Validation, ValueBase} from '@react-types/shared';\nimport {FormValidationState, useFormValidationState} from '../form/useFormValidationState';\nimport {NumberFormatter, NumberParser} from '@internationalized/number';\nimport {useCallback, useMemo, useState} from 'react';\nimport {useControlledState} from '../utils/useControlledState';\n\nexport interface NumberFieldProps extends InputBase, Validation<number>, FocusableProps, TextInputBase, ValueBase<number>, RangeInputBase<number>, LabelableProps, HelpTextProps {\n /**\n * Formatting options for the value displayed in the number field.\n * This also affects what characters are allowed to be typed by the user.\n */\n formatOptions?: Intl.NumberFormatOptions,\n /**\n * Controls the behavior of the number field when the user blurs the field after editing.\n * 'snap' will clamp the value to the min/max values, and snap to the nearest step value.\n * 'validate' will not clamp the value, and will validate that the value is within the min/max range and on a valid step.\n * @default 'snap'\n */\n commitBehavior?: 'snap' | 'validate'\n}\n\nexport interface NumberFieldState extends FormValidationState {\n /**\n * The current text value of the input. Updated as the user types,\n * and formatted according to `formatOptions` on blur.\n */\n inputValue: string,\n /**\n * The currently parsed number value, or NaN if a valid number could not be parsed.\n * Updated based on the `inputValue` as the user types.\n */\n numberValue: number,\n /** The default value of the input. */\n defaultNumberValue: number,\n /** The minimum value of the number field. */\n minValue?: number,\n /** The maximum value of the number field. */\n maxValue?: number,\n /** Whether the current value can be incremented according to the maximum value and step. */\n canIncrement: boolean,\n /** Whether the current value can be decremented according to the minimum value and step. */\n canDecrement: boolean,\n /**\n * Validates a user input string according to the current locale and format options.\n * Values can be partially entered, and may be valid even if they cannot currently be parsed to a number.\n * Can be used to implement validation as a user types.\n */\n validate(value: string): boolean,\n /** Sets the current text value of the input. */\n setInputValue(val: string): void,\n /** Sets the number value. */\n setNumberValue(val: number): void,\n /**\n * Commits the current input value. The value is parsed to a number, clamped according\n * to the minimum and maximum values of the field, and snapped to the nearest step value.\n * This will fire the `onChange` prop with the new value, and if uncontrolled, update the `numberValue`.\n * Typically this is called when the field is blurred.\n * @param value - The value to commit. If not provided, the current input value is used.\n */\n commit(value?: string): void,\n /** Increments the current input value to the next step boundary, and fires `onChange`. */\n increment(): void,\n /** Decrements the current input value to the next step boundary, and fires `onChange`. */\n decrement(): void,\n /** Sets the current value to the `maxValue` if any, and fires `onChange`. */\n incrementToMax(): void,\n /** Sets the current value to the `minValue` if any, and fires `onChange`. */\n decrementToMin(): void\n}\n\nexport interface NumberFieldStateOptions extends NumberFieldProps {\n /**\n * The locale that should be used for parsing.\n * @default 'en-US'\n */\n locale: string\n}\n\n/**\n * Provides state management for a number field component. Number fields allow users to enter a number,\n * and increment or decrement the value using stepper buttons.\n */\nexport function useNumberFieldState(\n props: NumberFieldStateOptions\n): NumberFieldState {\n let {\n minValue,\n maxValue,\n step,\n formatOptions,\n value,\n defaultValue = NaN,\n onChange,\n locale,\n isDisabled,\n isReadOnly,\n commitBehavior = 'snap'\n } = props;\n\n if (value === null) {\n value = NaN;\n }\n\n let snapValue = useCallback(value => {\n return step === undefined || isNaN(step)\n ? clamp(value, minValue, maxValue)\n : snapValueToStep(value, minValue, maxValue, step);\n }, [step, minValue, maxValue]);\n\n if (value !== undefined && !isNaN(value) && commitBehavior === 'snap') {\n value = snapValue(value);\n }\n\n if (!isNaN(defaultValue) && commitBehavior === 'snap') {\n defaultValue = snapValue(defaultValue);\n }\n\n let [numberValue, setNumberValue] = useControlledState<number>(value, isNaN(defaultValue) ? NaN : defaultValue, onChange);\n let [initialValue] = useState(numberValue);\n let [inputValue, setInputValue] = useState(() => isNaN(numberValue) ? '' : new NumberFormatter(locale, formatOptions).format(numberValue));\n\n let numberParser = useMemo(() => new NumberParser(locale, formatOptions), [locale, formatOptions]);\n let numberingSystem = useMemo(() => numberParser.getNumberingSystem(inputValue), [numberParser, inputValue]);\n let formatter = useMemo(() => new NumberFormatter(locale, {...formatOptions, numberingSystem}), [locale, formatOptions, numberingSystem]);\n let intlOptions = useMemo(() => formatter.resolvedOptions(), [formatter]);\n let format = useCallback((value: number) => (isNaN(value) || value === null) ? '' : formatter.format(value), [formatter]);\n\n let validation = useFormValidationState({\n ...props,\n value: numberValue\n });\n\n let clampStep = (step !== undefined && !isNaN(step)) ? step : 1;\n if (intlOptions.style === 'percent' && (step === undefined || isNaN(step))) {\n clampStep = 0.01;\n }\n\n // Update the input value when the number value or format options change. This is done\n // in a useEffect so that the controlled behavior is correct and we only update the\n // textfield after prop changes.\n let [prevValue, setPrevValue] = useState(numberValue);\n let [prevLocale, setPrevLocale] = useState(locale);\n let [prevFormatOptions, setPrevFormatOptions] = useState(formatOptions);\n if (!Object.is(numberValue, prevValue) || locale !== prevLocale || formatOptions !== prevFormatOptions) {\n setInputValue(format(numberValue));\n setPrevValue(numberValue);\n setPrevLocale(locale);\n setPrevFormatOptions(formatOptions);\n }\n\n let parsedValue = useMemo(() => numberParser.parse(inputValue), [numberParser, inputValue]);\n let commit = (overrideValue?: string) => {\n let newInputValue = overrideValue === undefined ? inputValue : overrideValue;\n let newParsedValue = parsedValue;\n if (overrideValue !== undefined) {\n newParsedValue = numberParser.parse(newInputValue);\n }\n // Set to empty state if input value is empty\n if (!newInputValue.length) {\n setNumberValue(NaN);\n setInputValue(value === undefined ? '' : format(numberValue));\n return;\n }\n\n // if it failed to parse, then reset input to formatted version of current number\n if (isNaN(newParsedValue)) {\n setInputValue(format(numberValue));\n return;\n }\n\n // Clamp to min and max, round to the nearest step, and round to specified number of digits\n let clampedValue = commitBehavior === 'snap' ? snapValue(newParsedValue) : newParsedValue;\n clampedValue = numberParser.parse(format(clampedValue));\n let shouldValidate = clampedValue !== numberValue;\n setNumberValue(clampedValue);\n\n // in a controlled state, the numberValue won't change, so we won't go back to our old input without help\n setInputValue(format(value === undefined ? clampedValue : numberValue));\n if (shouldValidate) {\n validation.commitValidation();\n }\n };\n\n let safeNextStep = (operation: '+' | '-', minMax: number = 0) => {\n let prev = parsedValue;\n\n if (isNaN(prev)) {\n // if the input is empty, start from the min/max value when incrementing/decrementing,\n // or zero if there is no min/max value defined.\n let newValue = isNaN(minMax) ? 0 : minMax;\n return snapValueToStep(newValue, minValue, maxValue, clampStep);\n } else {\n // otherwise, first snap the current value to the nearest step. if it moves in the direction\n // we're going, use that value, otherwise add the step and snap that value.\n let newValue = snapValueToStep(prev, minValue, maxValue, clampStep);\n if ((operation === '+' && newValue > prev) || (operation === '-' && newValue < prev)) {\n return newValue;\n }\n\n return snapValueToStep(\n handleDecimalOperation(operation, prev, clampStep),\n minValue,\n maxValue,\n clampStep\n );\n }\n };\n\n let increment = () => {\n let newValue = safeNextStep('+', minValue);\n\n // if we've arrived at the same value that was previously in the state, the\n // input value should be updated to match\n // ex type 4, press increment, highlight the number in the input, type 4 again, press increment\n // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input\n if (newValue === numberValue) {\n setInputValue(format(newValue));\n }\n\n setNumberValue(newValue);\n validation.commitValidation();\n };\n\n let decrement = () => {\n let newValue = safeNextStep('-', maxValue);\n\n if (newValue === numberValue) {\n setInputValue(format(newValue));\n }\n\n setNumberValue(newValue);\n validation.commitValidation();\n };\n\n let incrementToMax = () => {\n if (maxValue != null) {\n setNumberValue(snapValueToStep(maxValue, minValue, maxValue, clampStep));\n validation.commitValidation();\n }\n };\n\n let decrementToMin = () => {\n if (minValue != null) {\n setNumberValue(minValue);\n validation.commitValidation();\n }\n };\n\n let canIncrement = useMemo(() => (\n !isDisabled &&\n !isReadOnly &&\n (\n isNaN(parsedValue) ||\n (maxValue === undefined || isNaN(maxValue)) ||\n snapValueToStep(parsedValue, minValue, maxValue, clampStep) > parsedValue ||\n handleDecimalOperation('+', parsedValue, clampStep) <= maxValue\n )\n ), [isDisabled, isReadOnly, minValue, maxValue, clampStep, parsedValue]);\n\n let canDecrement = useMemo(() => (\n !isDisabled &&\n !isReadOnly &&\n (\n isNaN(parsedValue) ||\n (minValue === undefined || isNaN(minValue)) ||\n snapValueToStep(parsedValue, minValue, maxValue, clampStep) < parsedValue ||\n handleDecimalOperation('-', parsedValue, clampStep) >= minValue\n )\n ), [isDisabled, isReadOnly, minValue, maxValue, clampStep, parsedValue]);\n\n let validate = (value: string) => numberParser.isValidPartialNumber(value, minValue, maxValue);\n\n return {\n ...validation,\n validate,\n increment,\n incrementToMax,\n decrement,\n decrementToMin,\n canIncrement,\n canDecrement,\n minValue,\n maxValue,\n numberValue: parsedValue,\n defaultNumberValue: isNaN(defaultValue) ? initialValue : defaultValue,\n setNumberValue,\n setInputValue,\n inputValue,\n commit\n };\n}\n\nfunction handleDecimalOperation(operator: '-' | '+', value1: number, value2: number): number {\n let result = operator === '+' ? value1 + value2 : value1 - value2;\n\n // Check if we have decimals\n if (value1 % 1 !== 0 || value2 % 1 !== 0) {\n const value1Decimal = value1.toString().split('.');\n const value2Decimal = value2.toString().split('.');\n const value1DecimalLength = (value1Decimal[1] && value1Decimal[1].length) || 0;\n const value2DecimalLength = (value2Decimal[1] && value2Decimal[1].length) || 0;\n const multiplier = Math.pow(10, Math.max(value1DecimalLength, value2DecimalLength));\n\n // Transform the decimals to integers based on the precision\n value1 = Math.round(value1 * multiplier);\n value2 = Math.round(value2 * multiplier);\n\n // Perform the operation on integers values to make sure we don't get a fancy decimal value\n result = operator === '+' ? value1 + value2 : value1 - value2;\n\n // Transform the integer result back to decimal\n result /= multiplier;\n }\n\n return result;\n}\n"],"names":[],"version":3,"file":"useNumberFieldState.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA4GM,SAAS,0CAAoB,KAA8B;IAChE,IAAI,YACF,QAAQ,YACR,QAAQ,QACR,IAAI,iBACJ,aAAa,SACb,KAAK,gBACL,eAAe,eACf,QAAQ,UACR,MAAM,cACN,UAAU,cACV,UAAU,kBACV,iBAAiB,QAClB,GAAG;IAEJ,IAAI,UAAU,MACZ,QAAQ;IAGV,IAAI,YAAY,CAAA,GAAA,wBAAU,EACxB,CAAA;QACE,OAAO,SAAS,aAAa,MAAM,QAC/B,CAAA,GAAA,+BAAI,EAAE,OAAO,UAAU,YACvB,CAAA,GAAA,yCAAc,EAAE,OAAO,UAAU,UAAU;IACjD,GACA;QAAC;QAAM;QAAU;KAAS;IAG5B,IAA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AA2F;QAC3F,SAAS,aAAa,MAAM,SAAS,SAAS,SAAS;QAEvD,+CAA+C;QAC/C,UAAU;IACZ;IAEA,OAAO;AACT","sources":["packages/react-stately/src/numberfield/useNumberFieldState.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nimport {clamp, snapValueToStep} from '../utils/number';\n\nimport {\n FocusableProps,\n HelpTextProps,\n InputBase,\n LabelableProps,\n RangeInputBase,\n TextInputBase,\n Validation,\n ValueBase\n} from '@react-types/shared';\nimport {FormValidationState, useFormValidationState} from '../form/useFormValidationState';\nimport {NumberFormatter, NumberParser} from '@internationalized/number';\nimport {useCallback, useMemo, useState} from 'react';\nimport {useControlledState} from '../utils/useControlledState';\n\nexport interface NumberFieldProps\n extends\n InputBase,\n Validation<number>,\n FocusableProps,\n TextInputBase,\n ValueBase<number>,\n RangeInputBase<number>,\n LabelableProps,\n HelpTextProps {\n /**\n * Formatting options for the value displayed in the number field.\n * This also affects what characters are allowed to be typed by the user.\n */\n formatOptions?: Intl.NumberFormatOptions;\n /**\n * Controls the behavior of the number field when the user blurs the field after editing. 'snap'\n * will clamp the value to the min/max values, and snap to the nearest step value. 'validate' will\n * not clamp the value, and will validate that the value is within the min/max range and on a\n * valid step.\n *\n * @default 'snap'\n */\n commitBehavior?: 'snap' | 'validate';\n}\n\nexport interface NumberFieldState extends FormValidationState {\n /**\n * The current text value of the input. Updated as the user types,\n * and formatted according to `formatOptions` on blur.\n */\n inputValue: string;\n /**\n * The currently parsed number value, or NaN if a valid number could not be parsed.\n * Updated based on the `inputValue` as the user types.\n */\n numberValue: number;\n /** The default value of the input. */\n defaultNumberValue: number;\n /** The minimum value of the number field. */\n minValue?: number;\n /** The maximum value of the number field. */\n maxValue?: number;\n /** Whether the current value can be incremented according to the maximum value and step. */\n canIncrement: boolean;\n /** Whether the current value can be decremented according to the minimum value and step. */\n canDecrement: boolean;\n /**\n * Validates a user input string according to the current locale and format options. Values can be\n * partially entered, and may be valid even if they cannot currently be parsed to a number. Can be\n * used to implement validation as a user types.\n */\n validate(value: string): boolean;\n /** Sets the current text value of the input. */\n setInputValue(val: string): void;\n /** Sets the number value. */\n setNumberValue(val: number): void;\n /**\n * Commits the current input value. The value is parsed to a number, clamped according to the\n * minimum and maximum values of the field, and snapped to the nearest step value. This will fire\n * the `onChange` prop with the new value, and if uncontrolled, update the `numberValue`.\n * Typically this is called when the field is blurred.\n *\n * @param value - The value to commit. If not provided, the current input value is used.\n */\n commit(value?: string): void;\n /** Increments the current input value to the next step boundary, and fires `onChange`. */\n increment(): void;\n /** Decrements the current input value to the next step boundary, and fires `onChange`. */\n decrement(): void;\n /** Sets the current value to the `maxValue` if any, and fires `onChange`. */\n incrementToMax(): void;\n /** Sets the current value to the `minValue` if any, and fires `onChange`. */\n decrementToMin(): void;\n}\n\nexport interface NumberFieldStateOptions extends NumberFieldProps {\n /**\n * The locale that should be used for parsing.\n *\n * @default 'en-US'\n */\n locale: string;\n}\n\n/**\n * Provides state management for a number field component. Number fields allow users to enter a\n * number, and increment or decrement the value using stepper buttons.\n */\nexport function useNumberFieldState(props: NumberFieldStateOptions): NumberFieldState {\n let {\n minValue,\n maxValue,\n step,\n formatOptions,\n value,\n defaultValue = NaN,\n onChange,\n locale,\n isDisabled,\n isReadOnly,\n commitBehavior = 'snap'\n } = props;\n\n if (value === null) {\n value = NaN;\n }\n\n let snapValue = useCallback(\n value => {\n return step === undefined || isNaN(step)\n ? clamp(value, minValue, maxValue)\n : snapValueToStep(value, minValue, maxValue, step);\n },\n [step, minValue, maxValue]\n );\n\n if (value !== undefined && !isNaN(value) && commitBehavior === 'snap') {\n value = snapValue(value);\n }\n\n if (!isNaN(defaultValue) && commitBehavior === 'snap') {\n defaultValue = snapValue(defaultValue);\n }\n\n let [numberValue, setNumberValue] = useControlledState<number>(\n value,\n isNaN(defaultValue) ? NaN : defaultValue,\n onChange\n );\n let [initialValue] = useState(numberValue);\n let [inputValue, setInputValue] = useState(() =>\n isNaN(numberValue) ? '' : new NumberFormatter(locale, formatOptions).format(numberValue)\n );\n\n let numberParser = useMemo(\n () => new NumberParser(locale, formatOptions),\n [locale, formatOptions]\n );\n let numberingSystem = useMemo(\n () => numberParser.getNumberingSystem(inputValue),\n [numberParser, inputValue]\n );\n let formatter = useMemo(\n () => new NumberFormatter(locale, {...formatOptions, numberingSystem}),\n [locale, formatOptions, numberingSystem]\n );\n let intlOptions = useMemo(() => formatter.resolvedOptions(), [formatter]);\n let format = useCallback(\n (value: number) => (isNaN(value) || value === null ? '' : formatter.format(value)),\n [formatter]\n );\n\n let validation = useFormValidationState({\n ...props,\n value: numberValue\n });\n\n let clampStep = step !== undefined && !isNaN(step) ? step : 1;\n if (intlOptions.style === 'percent' && (step === undefined || isNaN(step))) {\n clampStep = 0.01;\n }\n\n // Update the input value when the number value or format options change. This is done\n // in a useEffect so that the controlled behavior is correct and we only update the\n // textfield after prop changes.\n let [prevValue, setPrevValue] = useState(numberValue);\n let [prevLocale, setPrevLocale] = useState(locale);\n let [prevFormatOptions, setPrevFormatOptions] = useState(formatOptions);\n if (\n !Object.is(numberValue, prevValue) ||\n locale !== prevLocale ||\n !isEqualFormatOptions(formatOptions, prevFormatOptions)\n ) {\n setInputValue(format(numberValue));\n setPrevValue(numberValue);\n setPrevLocale(locale);\n setPrevFormatOptions(formatOptions);\n }\n\n let parsedValue = useMemo(() => numberParser.parse(inputValue), [numberParser, inputValue]);\n let commit = (overrideValue?: string) => {\n let newInputValue = overrideValue === undefined ? inputValue : overrideValue;\n let newParsedValue = parsedValue;\n if (overrideValue !== undefined) {\n newParsedValue = numberParser.parse(newInputValue);\n }\n // Set to empty state if input value is empty\n if (!newInputValue.length) {\n setNumberValue(NaN);\n setInputValue(value === undefined ? '' : format(numberValue));\n return;\n }\n\n // if it failed to parse, then reset input to formatted version of current number\n if (isNaN(newParsedValue)) {\n setInputValue(format(numberValue));\n return;\n }\n\n // Clamp to min and max, round to the nearest step, and round to specified number of digits\n let clampedValue = commitBehavior === 'snap' ? snapValue(newParsedValue) : newParsedValue;\n clampedValue = numberParser.parse(format(clampedValue));\n let shouldValidate = clampedValue !== numberValue;\n setNumberValue(clampedValue);\n\n // in a controlled state, the numberValue won't change, so we won't go back to our old input without help\n setInputValue(format(value === undefined ? clampedValue : numberValue));\n if (shouldValidate) {\n validation.commitValidation();\n }\n };\n\n let safeNextStep = (operation: '+' | '-', minMax: number = 0) => {\n let prev = parsedValue;\n\n if (isNaN(prev)) {\n // if the input is empty, start from the min/max value when incrementing/decrementing,\n // or zero if there is no min/max value defined.\n let newValue = isNaN(minMax) ? 0 : minMax;\n return snapValueToStep(newValue, minValue, maxValue, clampStep);\n } else {\n // otherwise, first snap the current value to the nearest step. if it moves in the direction\n // we're going, use that value, otherwise add the step and snap that value.\n let newValue = snapValueToStep(prev, minValue, maxValue, clampStep);\n if ((operation === '+' && newValue > prev) || (operation === '-' && newValue < prev)) {\n return newValue;\n }\n\n return snapValueToStep(\n handleDecimalOperation(operation, prev, clampStep),\n minValue,\n maxValue,\n clampStep\n );\n }\n };\n\n let increment = () => {\n let newValue = safeNextStep('+', minValue);\n\n // if we've arrived at the same value that was previously in the state, the\n // input value should be updated to match\n // ex type 4, press increment, highlight the number in the input, type 4 again, press increment\n // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input\n if (newValue === numberValue) {\n setInputValue(format(newValue));\n }\n\n setNumberValue(newValue);\n validation.commitValidation();\n };\n\n let decrement = () => {\n let newValue = safeNextStep('-', maxValue);\n\n if (newValue === numberValue) {\n setInputValue(format(newValue));\n }\n\n setNumberValue(newValue);\n validation.commitValidation();\n };\n\n let incrementToMax = () => {\n if (maxValue != null) {\n setNumberValue(snapValueToStep(maxValue, minValue, maxValue, clampStep));\n validation.commitValidation();\n }\n };\n\n let decrementToMin = () => {\n if (minValue != null) {\n setNumberValue(minValue);\n validation.commitValidation();\n }\n };\n\n let canIncrement = useMemo(\n () =>\n !isDisabled &&\n !isReadOnly &&\n (isNaN(parsedValue) ||\n maxValue === undefined ||\n isNaN(maxValue) ||\n snapValueToStep(parsedValue, minValue, maxValue, clampStep) > parsedValue ||\n handleDecimalOperation('+', parsedValue, clampStep) <= maxValue),\n [isDisabled, isReadOnly, minValue, maxValue, clampStep, parsedValue]\n );\n\n let canDecrement = useMemo(\n () =>\n !isDisabled &&\n !isReadOnly &&\n (isNaN(parsedValue) ||\n minValue === undefined ||\n isNaN(minValue) ||\n snapValueToStep(parsedValue, minValue, maxValue, clampStep) < parsedValue ||\n handleDecimalOperation('-', parsedValue, clampStep) >= minValue),\n [isDisabled, isReadOnly, minValue, maxValue, clampStep, parsedValue]\n );\n\n let validate = (value: string) => numberParser.isValidPartialNumber(value, minValue, maxValue);\n\n return {\n ...validation,\n validate,\n increment,\n incrementToMax,\n decrement,\n decrementToMin,\n canIncrement,\n canDecrement,\n minValue,\n maxValue,\n numberValue: parsedValue,\n defaultNumberValue: isNaN(defaultValue) ? initialValue : defaultValue,\n setNumberValue,\n setInputValue,\n inputValue,\n commit\n };\n}\n\n// Shallow equality is sufficient here because all values in Intl.NumberFormatOptions are primitives.\nfunction isEqualFormatOptions(\n a: Intl.NumberFormatOptions | undefined,\n b: Intl.NumberFormatOptions | undefined\n) {\n if (a === b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n let aKeys = Object.keys(a);\n let bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n for (let key of aKeys) {\n if (b[key] !== a[key]) {\n return false;\n }\n }\n return true;\n}\n\nfunction handleDecimalOperation(operator: '-' | '+', value1: number, value2: number): number {\n let result = operator === '+' ? value1 + value2 : value1 - value2;\n\n // Check if we have decimals\n if (value1 % 1 !== 0 || value2 % 1 !== 0) {\n const value1Decimal = value1.toString().split('.');\n const value2Decimal = value2.toString().split('.');\n const value1DecimalLength = (value1Decimal[1] && value1Decimal[1].length) || 0;\n const value2DecimalLength = (value2Decimal[1] && value2Decimal[1].length) || 0;\n const multiplier = Math.pow(10, Math.max(value1DecimalLength, value2DecimalLength));\n\n // Transform the decimals to integers based on the precision\n value1 = Math.round(value1 * multiplier);\n value2 = Math.round(value2 * multiplier);\n\n // Perform the operation on integers values to make sure we don't get a fancy decimal value\n result = operator === '+' ? value1 + value2 : value1 - value2;\n\n // Transform the integer result back to decimal\n result /= multiplier;\n }\n\n return result;\n}\n"],"names":[],"version":3,"file":"useNumberFieldState.cjs.map"}
|
|
@@ -68,7 +68,7 @@ function $350d668ac1240cb8$export$7f629e9dc1ecf37c(props) {
|
|
|
68
68
|
let [prevValue, setPrevValue] = (0, $ldq6T$useState)(numberValue);
|
|
69
69
|
let [prevLocale, setPrevLocale] = (0, $ldq6T$useState)(locale);
|
|
70
70
|
let [prevFormatOptions, setPrevFormatOptions] = (0, $ldq6T$useState)(formatOptions);
|
|
71
|
-
if (!Object.is(numberValue, prevValue) || locale !== prevLocale || formatOptions
|
|
71
|
+
if (!Object.is(numberValue, prevValue) || locale !== prevLocale || !$350d668ac1240cb8$var$isEqualFormatOptions(formatOptions, prevFormatOptions)) {
|
|
72
72
|
setInputValue(format(numberValue));
|
|
73
73
|
setPrevValue(numberValue);
|
|
74
74
|
setPrevLocale(locale);
|
|
@@ -181,6 +181,18 @@ function $350d668ac1240cb8$export$7f629e9dc1ecf37c(props) {
|
|
|
181
181
|
commit: commit
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
+
// Shallow equality is sufficient here because all values in Intl.NumberFormatOptions are primitives.
|
|
185
|
+
function $350d668ac1240cb8$var$isEqualFormatOptions(a, b) {
|
|
186
|
+
if (a === b) return true;
|
|
187
|
+
if (!a || !b) return false;
|
|
188
|
+
let aKeys = Object.keys(a);
|
|
189
|
+
let bKeys = Object.keys(b);
|
|
190
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
191
|
+
for (let key of aKeys){
|
|
192
|
+
if (b[key] !== a[key]) return false;
|
|
193
|
+
}
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
184
196
|
function $350d668ac1240cb8$var$handleDecimalOperation(operator, value1, value2) {
|
|
185
197
|
let result = operator === '+' ? value1 + value2 : value1 - value2;
|
|
186
198
|
// Check if we have decimals
|