@proyecto-viviana/solid-stately 0.5.1 → 0.6.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-APACHE-2.0 +201 -0
- package/NOTICE +91 -0
- package/README.md +59 -29
- package/dist/autocomplete/createAutocompleteState.d.ts +2 -1
- package/dist/autocomplete/createAutocompleteState.d.ts.map +1 -0
- package/dist/autocomplete/index.d.ts +1 -0
- package/dist/autocomplete/index.d.ts.map +1 -0
- package/dist/calendar/IncompleteDate.d.ts +2 -1
- package/dist/calendar/IncompleteDate.d.ts.map +1 -0
- package/dist/calendar/createCalendarState.d.ts +10 -9
- package/dist/calendar/createCalendarState.d.ts.map +1 -0
- package/dist/calendar/createDateFieldState.d.ts +4 -20
- package/dist/calendar/createDateFieldState.d.ts.map +1 -0
- package/dist/calendar/createDatePickerState.d.ts +4 -7
- package/dist/calendar/createDatePickerState.d.ts.map +1 -0
- package/dist/calendar/createRangeCalendarState.d.ts +9 -7
- package/dist/calendar/createRangeCalendarState.d.ts.map +1 -0
- package/dist/calendar/createTimeFieldState.d.ts +5 -24
- package/dist/calendar/createTimeFieldState.d.ts.map +1 -0
- package/dist/calendar/index.d.ts +1 -0
- package/dist/calendar/index.d.ts.map +1 -0
- package/dist/calendar/intl/index.d.ts +1 -0
- package/dist/calendar/intl/index.d.ts.map +1 -0
- package/dist/checkbox/createCheckboxGroupState.d.ts +3 -0
- package/dist/checkbox/createCheckboxGroupState.d.ts.map +1 -0
- package/dist/checkbox/index.d.ts +1 -0
- package/dist/checkbox/index.d.ts.map +1 -0
- package/dist/collections/ListCollection.d.ts +5 -0
- package/dist/collections/ListCollection.d.ts.map +1 -0
- package/dist/collections/createListState.d.ts +2 -6
- package/dist/collections/createListState.d.ts.map +1 -0
- package/dist/collections/createMenuState.d.ts +74 -13
- package/dist/collections/createMenuState.d.ts.map +1 -0
- package/dist/collections/createSelectionState.d.ts +2 -5
- package/dist/collections/createSelectionState.d.ts.map +1 -0
- package/dist/collections/getChildNodes.d.ts +6 -3
- package/dist/collections/getChildNodes.d.ts.map +1 -0
- package/dist/collections/index.d.ts +2 -1
- package/dist/collections/index.d.ts.map +1 -0
- package/dist/collections/types.d.ts +36 -2
- package/dist/collections/types.d.ts.map +1 -0
- package/dist/color/Color.d.ts +7 -1
- package/dist/color/Color.d.ts.map +1 -0
- package/dist/color/createColorAreaState.d.ts +6 -5
- package/dist/color/createColorAreaState.d.ts.map +1 -0
- package/dist/color/createColorFieldState.d.ts +4 -5
- package/dist/color/createColorFieldState.d.ts.map +1 -0
- package/dist/color/createColorSliderState.d.ts +4 -5
- package/dist/color/createColorSliderState.d.ts.map +1 -0
- package/dist/color/createColorWheelState.d.ts +2 -5
- package/dist/color/createColorWheelState.d.ts.map +1 -0
- package/dist/color/getColorChannels.d.ts +3 -0
- package/dist/color/getColorChannels.d.ts.map +1 -0
- package/dist/color/index.d.ts +2 -1
- package/dist/color/index.d.ts.map +1 -0
- package/dist/color/intl/index.d.ts +1 -0
- package/dist/color/intl/index.d.ts.map +1 -0
- package/dist/color/types.d.ts +2 -1
- package/dist/color/types.d.ts.map +1 -0
- package/dist/combobox/createComboBoxState.d.ts +92 -29
- package/dist/combobox/createComboBoxState.d.ts.map +1 -0
- package/dist/combobox/index.d.ts +2 -1
- package/dist/combobox/index.d.ts.map +1 -0
- package/dist/data/createAsyncList.d.ts +1 -7
- package/dist/data/createAsyncList.d.ts.map +1 -0
- package/dist/data/createListData.d.ts +1 -6
- package/dist/data/createListData.d.ts.map +1 -0
- package/dist/data/createTreeData.d.ts +1 -6
- package/dist/data/createTreeData.d.ts.map +1 -0
- package/dist/data/index.d.ts +1 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/datepicker/index.d.ts +1 -0
- package/dist/datepicker/index.d.ts.map +1 -0
- package/dist/disclosure/createDisclosureState.d.ts +2 -5
- package/dist/disclosure/createDisclosureState.d.ts.map +1 -0
- package/dist/disclosure/index.d.ts +1 -0
- package/dist/disclosure/index.d.ts.map +1 -0
- package/dist/dnd/createDragState.d.ts +2 -6
- package/dist/dnd/createDragState.d.ts.map +1 -0
- package/dist/dnd/createDraggableCollectionState.d.ts +44 -11
- package/dist/dnd/createDraggableCollectionState.d.ts.map +1 -0
- package/dist/dnd/createDropState.d.ts +2 -6
- package/dist/dnd/createDropState.d.ts.map +1 -0
- package/dist/dnd/createDroppableCollectionState.d.ts +34 -11
- package/dist/dnd/createDroppableCollectionState.d.ts.map +1 -0
- package/dist/dnd/index.d.ts +3 -2
- package/dist/dnd/index.d.ts.map +1 -0
- package/dist/dnd/types.d.ts +17 -0
- package/dist/dnd/types.d.ts.map +1 -0
- package/dist/form/createFormValidationState.d.ts +2 -9
- package/{src → dist}/form/createFormValidationState.d.ts.map +1 -1
- package/dist/form/index.d.ts +1 -0
- package/dist/form/index.d.ts.map +1 -0
- package/dist/grid/createGridState.d.ts +4 -3
- package/dist/grid/createGridState.d.ts.map +1 -0
- package/dist/grid/index.d.ts +1 -0
- package/dist/grid/index.d.ts.map +1 -0
- package/dist/grid/types.d.ts +23 -1
- package/dist/grid/types.d.ts.map +1 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2947 -969
- package/dist/index.js.map +1 -1
- package/dist/menu/index.d.ts +3 -1
- package/dist/menu/index.d.ts.map +1 -0
- package/dist/numberfield/createNumberFieldState.d.ts +37 -9
- package/dist/numberfield/createNumberFieldState.d.ts.map +1 -0
- package/dist/numberfield/index.d.ts +1 -0
- package/dist/numberfield/index.d.ts.map +1 -0
- package/dist/overlays/createOverlayTriggerState.d.ts +12 -1
- package/dist/overlays/createOverlayTriggerState.d.ts.map +1 -0
- package/dist/overlays/index.d.ts +1 -0
- package/dist/overlays/index.d.ts.map +1 -0
- package/dist/private/flags/flags.d.ts +5 -0
- package/dist/private/flags/flags.d.ts.map +1 -0
- package/dist/private/flags/flags.js +26 -0
- package/dist/private/flags/flags.js.map +1 -0
- package/dist/radio/createRadioGroupState.d.ts +1 -0
- package/dist/radio/createRadioGroupState.d.ts.map +1 -0
- package/dist/radio/index.d.ts +1 -0
- package/dist/radio/index.d.ts.map +1 -0
- package/dist/searchfield/createSearchFieldState.d.ts +2 -5
- package/dist/searchfield/createSearchFieldState.d.ts.map +1 -0
- package/dist/searchfield/index.d.ts +1 -0
- package/dist/searchfield/index.d.ts.map +1 -0
- package/dist/select/createSelectState.d.ts +100 -33
- package/dist/select/createSelectState.d.ts.map +1 -0
- package/dist/select/index.d.ts +2 -1
- package/dist/select/index.d.ts.map +1 -0
- package/dist/selection/Selection.d.ts +2 -1
- package/dist/selection/Selection.d.ts.map +1 -0
- package/dist/selection/SelectionManager.d.ts +1 -19
- package/dist/selection/SelectionManager.d.ts.map +1 -0
- package/dist/selection/createMultipleSelectionState.d.ts +2 -13
- package/dist/selection/createMultipleSelectionState.d.ts.map +1 -0
- package/dist/selection/index.d.ts +1 -0
- package/dist/selection/index.d.ts.map +1 -0
- package/dist/slider/createSliderState.d.ts +37 -14
- package/dist/slider/createSliderState.d.ts.map +1 -0
- package/dist/slider/index.d.ts +1 -0
- package/dist/slider/index.d.ts.map +1 -0
- package/dist/ssr/index.d.ts +2 -13
- package/dist/ssr/index.d.ts.map +1 -0
- package/dist/steplist/createStepListState.d.ts +10 -18
- package/dist/steplist/createStepListState.d.ts.map +1 -0
- package/dist/steplist/index.d.ts +1 -0
- package/dist/steplist/index.d.ts.map +1 -0
- package/dist/table/TableCollection.d.ts +1 -0
- package/dist/table/TableCollection.d.ts.map +1 -0
- package/dist/table/createTableColumnResizeState.d.ts +2 -9
- package/dist/table/createTableColumnResizeState.d.ts.map +1 -0
- package/dist/table/createTableState.d.ts +3 -6
- package/dist/table/createTableState.d.ts.map +1 -0
- package/dist/table/createTreeGridState.d.ts +3 -9
- package/dist/table/createTreeGridState.d.ts.map +1 -0
- package/dist/table/index.d.ts +1 -0
- package/dist/table/index.d.ts.map +1 -0
- package/dist/table/types.d.ts +37 -3
- package/dist/table/types.d.ts.map +1 -0
- package/dist/tabs/createTabListState.d.ts +2 -5
- package/dist/tabs/createTabListState.d.ts.map +1 -0
- package/dist/tabs/index.d.ts +1 -0
- package/dist/tabs/index.d.ts.map +1 -0
- package/dist/textfield/createTextFieldState.d.ts +1 -0
- package/dist/textfield/createTextFieldState.d.ts.map +1 -0
- package/dist/textfield/index.d.ts +1 -0
- package/dist/textfield/index.d.ts.map +1 -0
- package/dist/toast/createToastState.d.ts +2 -5
- package/dist/toast/createToastState.d.ts.map +1 -0
- package/dist/toast/index.d.ts +1 -0
- package/dist/toast/index.d.ts.map +1 -0
- package/dist/toggle/createToggleGroupState.d.ts +1 -0
- package/dist/toggle/createToggleGroupState.d.ts.map +1 -0
- package/dist/toggle/createToggleState.d.ts +1 -0
- package/dist/toggle/createToggleState.d.ts.map +1 -0
- package/dist/toggle/index.d.ts +1 -0
- package/dist/toggle/index.d.ts.map +1 -0
- package/dist/tokenfield/TokenFieldValue.d.ts +96 -0
- package/dist/tokenfield/TokenFieldValue.d.ts.map +1 -0
- package/dist/tokenfield/createTokenFieldState.d.ts +33 -0
- package/dist/tokenfield/createTokenFieldState.d.ts.map +1 -0
- package/dist/tokenfield/index.d.ts +3 -0
- package/dist/tokenfield/index.d.ts.map +1 -0
- package/dist/tooltip/createTooltipTriggerState.d.ts +9 -8
- package/dist/tooltip/createTooltipTriggerState.d.ts.map +1 -0
- package/dist/tooltip/index.d.ts +1 -0
- package/dist/tooltip/index.d.ts.map +1 -0
- package/dist/tree/TreeCollection.d.ts +1 -0
- package/dist/tree/TreeCollection.d.ts.map +1 -0
- package/dist/tree/createTreeState.d.ts +3 -8
- package/dist/tree/createTreeState.d.ts.map +1 -0
- package/dist/tree/index.d.ts +1 -0
- package/dist/tree/index.d.ts.map +1 -0
- package/dist/tree/types.d.ts +19 -1
- package/dist/tree/types.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/owner.d.ts +9 -0
- package/dist/utils/owner.d.ts.map +1 -0
- package/dist/utils/reactivity.d.ts +24 -0
- package/dist/utils/reactivity.d.ts.map +1 -0
- package/package.json +21 -9
- package/src/autocomplete/createAutocompleteState.ts +18 -4
- package/src/calendar/IncompleteDate.ts +15 -1
- package/src/calendar/createCalendarState.ts +321 -125
- package/src/calendar/createDateFieldState.ts +45 -31
- package/src/calendar/createDatePickerState.ts +47 -26
- package/src/calendar/createRangeCalendarState.ts +173 -86
- package/src/calendar/createTimeFieldState.ts +26 -7
- package/src/calendar/intl/index.ts +37 -2
- package/src/checkbox/createCheckboxGroupState.ts +45 -13
- package/src/collections/ListCollection.ts +31 -0
- package/src/collections/createListState.ts +27 -10
- package/src/collections/createMenuState.ts +190 -15
- package/src/collections/createSelectionState.ts +33 -13
- package/src/collections/getChildNodes.ts +20 -3
- package/src/collections/index.ts +6 -0
- package/src/collections/types.ts +35 -2
- package/src/color/Color.ts +61 -22
- package/src/color/createColorAreaState.ts +48 -4
- package/src/color/createColorFieldState.ts +114 -38
- package/src/color/createColorSliderState.ts +61 -9
- package/src/color/createColorWheelState.ts +29 -9
- package/src/color/getColorChannels.ts +16 -0
- package/src/color/index.ts +1 -0
- package/src/color/intl/index.ts +38 -3
- package/src/color/types.ts +1 -1
- package/src/combobox/createComboBoxState.ts +530 -297
- package/src/combobox/index.ts +4 -0
- package/src/data/createAsyncList.ts +41 -6
- package/src/data/createListData.ts +27 -4
- package/src/data/createTreeData.ts +30 -6
- package/src/disclosure/createDisclosureState.ts +40 -19
- package/src/dnd/createDragState.ts +22 -4
- package/src/dnd/createDraggableCollectionState.ts +145 -11
- package/src/dnd/createDropState.ts +21 -3
- package/src/dnd/createDroppableCollectionState.ts +127 -11
- package/src/dnd/index.ts +4 -0
- package/src/dnd/types.ts +16 -0
- package/src/form/createFormValidationState.ts +69 -37
- package/src/grid/createGridState.ts +196 -111
- package/src/grid/types.ts +22 -1
- package/src/index.ts +33 -2
- package/src/menu/index.ts +7 -0
- package/src/numberfield/createNumberFieldState.ts +247 -98
- package/src/overlays/createOverlayTriggerState.ts +31 -4
- package/src/private/flags/flags.ts +25 -0
- package/src/radio/createRadioGroupState.ts +23 -6
- package/src/searchfield/createSearchFieldState.ts +18 -3
- package/src/select/createSelectState.ts +317 -130
- package/src/select/index.ts +8 -1
- package/src/selection/Selection.ts +15 -1
- package/src/selection/SelectionManager.ts +17 -1
- package/src/selection/createMultipleSelectionState.ts +45 -26
- package/src/slider/createSliderState.ts +243 -104
- package/src/ssr/index.ts +34 -4
- package/src/steplist/createStepListState.ts +184 -130
- package/src/table/TableCollection.ts +14 -0
- package/src/table/createTableColumnResizeState.ts +71 -14
- package/src/table/createTableState.ts +26 -4
- package/src/table/createTreeGridState.ts +22 -6
- package/src/table/types.ts +38 -5
- package/src/tabs/createTabListState.ts +63 -43
- package/src/textfield/createTextFieldState.ts +17 -3
- package/src/toast/createToastState.ts +28 -3
- package/src/toggle/createToggleGroupState.ts +20 -5
- package/src/toggle/createToggleState.ts +19 -4
- package/src/tokenfield/TokenFieldValue.ts +499 -0
- package/src/tokenfield/createTokenFieldState.ts +88 -0
- package/src/tokenfield/index.ts +15 -0
- package/src/tooltip/createTooltipTriggerState.ts +49 -13
- package/src/tree/TreeCollection.ts +14 -0
- package/src/tree/createTreeState.ts +70 -36
- package/src/tree/types.ts +18 -1
- package/src/utils/index.ts +10 -1
- package/src/utils/owner.ts +20 -0
- package/src/utils/reactivity.ts +53 -1
- package/src/autocomplete/createAutocompleteState.d.ts +0 -48
- package/src/autocomplete/createAutocompleteState.d.ts.map +0 -1
- package/src/autocomplete/index.d.ts +0 -6
- package/src/autocomplete/index.d.ts.map +0 -1
- package/src/calendar/createCalendarState.d.ts +0 -152
- package/src/calendar/createCalendarState.d.ts.map +0 -1
- package/src/calendar/createDateFieldState.d.ts +0 -145
- package/src/calendar/createDateFieldState.d.ts.map +0 -1
- package/src/calendar/createRangeCalendarState.d.ts +0 -171
- package/src/calendar/createRangeCalendarState.d.ts.map +0 -1
- package/src/calendar/createTimeFieldState.d.ts +0 -97
- package/src/calendar/createTimeFieldState.d.ts.map +0 -1
- package/src/calendar/index.d.ts +0 -80
- package/src/calendar/index.d.ts.map +0 -1
- package/src/checkbox/createCheckboxGroupState.d.ts +0 -73
- package/src/checkbox/createCheckboxGroupState.d.ts.map +0 -1
- package/src/checkbox/index.d.ts +0 -6
- package/src/checkbox/index.d.ts.map +0 -1
- package/src/collections/ListCollection.d.ts +0 -40
- package/src/collections/ListCollection.d.ts.map +0 -1
- package/src/collections/createListState.d.ts +0 -94
- package/src/collections/createListState.d.ts.map +0 -1
- package/src/collections/createMenuState.d.ts +0 -55
- package/src/collections/createMenuState.d.ts.map +0 -1
- package/src/collections/createSelectionState.d.ts +0 -89
- package/src/collections/createSelectionState.d.ts.map +0 -1
- package/src/collections/index.d.ts +0 -38
- package/src/collections/index.d.ts.map +0 -1
- package/src/collections/types.d.ts +0 -147
- package/src/collections/types.d.ts.map +0 -1
- package/src/color/Color.d.ts +0 -43
- package/src/color/Color.d.ts.map +0 -1
- package/src/color/createColorAreaState.d.ts +0 -78
- package/src/color/createColorAreaState.d.ts.map +0 -1
- package/src/color/createColorFieldState.d.ts +0 -57
- package/src/color/createColorFieldState.d.ts.map +0 -1
- package/src/color/createColorSliderState.d.ts +0 -69
- package/src/color/createColorSliderState.d.ts.map +0 -1
- package/src/color/createColorWheelState.d.ts +0 -53
- package/src/color/createColorWheelState.d.ts.map +0 -1
- package/src/color/index.d.ts +0 -39
- package/src/color/index.d.ts.map +0 -1
- package/src/color/types.d.ts +0 -111
- package/src/color/types.d.ts.map +0 -1
- package/src/combobox/createComboBoxState.d.ts +0 -127
- package/src/combobox/createComboBoxState.d.ts.map +0 -1
- package/src/combobox/index.d.ts +0 -13
- package/src/combobox/index.d.ts.map +0 -1
- package/src/disclosure/createDisclosureState.d.ts +0 -68
- package/src/disclosure/createDisclosureState.d.ts.map +0 -1
- package/src/disclosure/index.d.ts +0 -10
- package/src/disclosure/index.d.ts.map +0 -1
- package/src/dnd/createDragState.d.ts +0 -68
- package/src/dnd/createDragState.d.ts.map +0 -1
- package/src/dnd/createDraggableCollectionState.d.ts +0 -68
- package/src/dnd/createDraggableCollectionState.d.ts.map +0 -1
- package/src/dnd/createDropState.d.ts +0 -80
- package/src/dnd/createDropState.d.ts.map +0 -1
- package/src/dnd/createDroppableCollectionState.d.ts +0 -107
- package/src/dnd/createDroppableCollectionState.d.ts.map +0 -1
- package/src/dnd/index.d.ts +0 -60
- package/src/dnd/index.d.ts.map +0 -1
- package/src/dnd/types.d.ts +0 -277
- package/src/dnd/types.d.ts.map +0 -1
- package/src/form/createFormValidationState.d.ts +0 -102
- package/src/form/index.d.ts +0 -16
- package/src/form/index.d.ts.map +0 -1
- package/src/grid/createGridState.d.ts +0 -15
- package/src/grid/createGridState.d.ts.map +0 -1
- package/src/grid/index.d.ts +0 -7
- package/src/grid/index.d.ts.map +0 -1
- package/src/grid/types.d.ts +0 -163
- package/src/grid/types.d.ts.map +0 -1
- package/src/index.d.ts +0 -311
- package/src/index.d.ts.map +0 -1
- package/src/numberfield/createNumberFieldState.d.ts +0 -67
- package/src/numberfield/createNumberFieldState.d.ts.map +0 -1
- package/src/numberfield/index.d.ts +0 -6
- package/src/numberfield/index.d.ts.map +0 -1
- package/src/overlays/createOverlayTriggerState.d.ts +0 -34
- package/src/overlays/createOverlayTriggerState.d.ts.map +0 -1
- package/src/overlays/index.d.ts +0 -6
- package/src/overlays/index.d.ts.map +0 -1
- package/src/radio/createRadioGroupState.d.ts +0 -79
- package/src/radio/createRadioGroupState.d.ts.map +0 -1
- package/src/radio/index.d.ts +0 -7
- package/src/radio/index.d.ts.map +0 -1
- package/src/searchfield/createSearchFieldState.d.ts +0 -27
- package/src/searchfield/createSearchFieldState.d.ts.map +0 -1
- package/src/searchfield/index.d.ts +0 -3
- package/src/searchfield/index.d.ts.map +0 -1
- package/src/select/createSelectState.d.ts +0 -75
- package/src/select/createSelectState.d.ts.map +0 -1
- package/src/select/index.d.ts +0 -2
- package/src/select/index.d.ts.map +0 -1
- package/src/slider/createSliderState.d.ts +0 -72
- package/src/slider/createSliderState.d.ts.map +0 -1
- package/src/slider/index.d.ts +0 -3
- package/src/slider/index.d.ts.map +0 -1
- package/src/ssr/index.d.ts +0 -28
- package/src/ssr/index.d.ts.map +0 -1
- package/src/table/TableCollection.d.ts +0 -54
- package/src/table/TableCollection.d.ts.map +0 -1
- package/src/table/createTableState.d.ts +0 -15
- package/src/table/createTableState.d.ts.map +0 -1
- package/src/table/index.d.ts +0 -18
- package/src/table/index.d.ts.map +0 -1
- package/src/table/types.d.ts +0 -145
- package/src/table/types.d.ts.map +0 -1
- package/src/tabs/createTabListState.d.ts +0 -70
- package/src/tabs/createTabListState.d.ts.map +0 -1
- package/src/tabs/index.d.ts +0 -8
- package/src/tabs/index.d.ts.map +0 -1
- package/src/textfield/createTextFieldState.d.ts +0 -32
- package/src/textfield/createTextFieldState.d.ts.map +0 -1
- package/src/textfield/index.d.ts +0 -6
- package/src/textfield/index.d.ts.map +0 -1
- package/src/toast/createToastState.d.ts +0 -129
- package/src/toast/createToastState.d.ts.map +0 -1
- package/src/toast/index.d.ts +0 -12
- package/src/toast/index.d.ts.map +0 -1
- package/src/toggle/createToggleState.d.ts +0 -34
- package/src/toggle/createToggleState.d.ts.map +0 -1
- package/src/toggle/index.d.ts +0 -2
- package/src/toggle/index.d.ts.map +0 -1
- package/src/tooltip/createTooltipTriggerState.d.ts +0 -39
- package/src/tooltip/createTooltipTriggerState.d.ts.map +0 -1
- package/src/tooltip/index.d.ts +0 -7
- package/src/tooltip/index.d.ts.map +0 -1
- package/src/tree/TreeCollection.d.ts +0 -43
- package/src/tree/TreeCollection.d.ts.map +0 -1
- package/src/tree/createTreeState.d.ts +0 -17
- package/src/tree/createTreeState.d.ts.map +0 -1
- package/src/tree/index.d.ts +0 -13
- package/src/tree/index.d.ts.map +0 -1
- package/src/tree/types.d.ts +0 -162
- package/src/tree/types.d.ts.map +0 -1
- package/src/utils/index.d.ts +0 -2
- package/src/utils/index.d.ts.map +0 -1
- package/src/utils/reactivity.d.ts +0 -28
- package/src/utils/reactivity.d.ts.map +0 -1
|
@@ -1,11 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/calendar/useCalendarState.ts
|
|
14
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/calendar/useRangeCalendarState.ts
|
|
15
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/calendar/utils.ts
|
|
16
|
+
|
|
1
17
|
/**
|
|
2
18
|
* RangeCalendarState for Solid-Stately
|
|
3
19
|
*
|
|
4
20
|
* Provides state management for range calendar components.
|
|
5
|
-
*
|
|
21
|
+
* Ported from:
|
|
22
|
+
* - packages/react-stately/src/calendar/useRangeCalendarState.ts
|
|
23
|
+
* - packages/react-stately/src/calendar/useCalendarState.ts
|
|
24
|
+
* - packages/react-stately/src/calendar/utils.ts
|
|
6
25
|
*/
|
|
7
26
|
|
|
8
|
-
import {
|
|
27
|
+
import { createMemo, createEffect } from "solid-js";
|
|
28
|
+
import type { Accessor } from "solid-js";
|
|
9
29
|
import {
|
|
10
30
|
type Calendar as InternationalizedCalendar,
|
|
11
31
|
type CalendarDate,
|
|
@@ -28,7 +48,7 @@ import {
|
|
|
28
48
|
toCalendar as intlToCalendar,
|
|
29
49
|
toCalendarDate as intlToCalendarDate,
|
|
30
50
|
} from "@internationalized/date";
|
|
31
|
-
import { access, type MaybeAccessor } from "../utils";
|
|
51
|
+
import { access, createInternalSignal, readNow, type MaybeAccessor } from "../utils";
|
|
32
52
|
import type { CalendarDayOfWeek, ValidationState } from "./createCalendarState";
|
|
33
53
|
import { getFormatOptions } from "./createDateFieldState";
|
|
34
54
|
|
|
@@ -87,6 +107,8 @@ export interface RangeCalendarStateProps<T extends DateValue = DateValue> {
|
|
|
87
107
|
isDateDisabled?: (date: DateValue) => boolean;
|
|
88
108
|
/** Validation state. */
|
|
89
109
|
validationState?: MaybeAccessor<ValidationState | undefined>;
|
|
110
|
+
/** Whether the current selection is invalid according to application logic. */
|
|
111
|
+
isInvalid?: boolean;
|
|
90
112
|
/** Whether to allow selecting the same date for start and end. */
|
|
91
113
|
allowsNonContiguousRanges?: boolean;
|
|
92
114
|
/** The first day of the week (0 = Sunday, 1 = Monday, etc.). */
|
|
@@ -172,6 +194,11 @@ export interface RangeCalendarState<T extends DateValue = DateValue> {
|
|
|
172
194
|
selectFocusedDate: () => void;
|
|
173
195
|
/** Selects a specific date. */
|
|
174
196
|
selectDate: (date: CalendarDate) => void;
|
|
197
|
+
/**
|
|
198
|
+
* After a keyboard range-start selection, move focus to the next available
|
|
199
|
+
* day so the in-progress range is visible. RAC `focusNearestAvailableDate`.
|
|
200
|
+
*/
|
|
201
|
+
focusNearestAvailableDate: (anchorDate: CalendarDate) => void;
|
|
175
202
|
/** Whether focus is currently within the calendar. */
|
|
176
203
|
isFocused: Accessor<boolean>;
|
|
177
204
|
/** Sets whether focus is within the calendar. */
|
|
@@ -216,7 +243,7 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
216
243
|
const calendar = createMemo(() =>
|
|
217
244
|
(props.createCalendar ?? intlCreateCalendar)(resolvedOptions().calendar as CalendarIdentifier),
|
|
218
245
|
);
|
|
219
|
-
const visibleMonths = Math.max(1, Number(access(props.visibleMonths) ?? 1));
|
|
246
|
+
const visibleMonths = createMemo(() => Math.max(1, Number(access(props.visibleMonths) ?? 1)));
|
|
220
247
|
const firstDayOfWeekName = (): CalendarDayOfWeek | undefined =>
|
|
221
248
|
props.firstDayOfWeek == null ? undefined : dayOfWeekNames[props.firstDayOfWeek];
|
|
222
249
|
|
|
@@ -226,7 +253,7 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
226
253
|
// The anchor date is the first selected date during a range drag. Declared up
|
|
227
254
|
// here (ahead of constrainDate) because the available-range derivation below
|
|
228
255
|
// depends on it, and constrainDate consults that range.
|
|
229
|
-
const [anchorDate, setAnchorDate] =
|
|
256
|
+
const [anchorDate, setAnchorDate] = createInternalSignal<CalendarDate | null>(null);
|
|
230
257
|
|
|
231
258
|
// Mirrors @react-stately/calendar useRangeCalendarState getAvailableRange: once
|
|
232
259
|
// a range selection is anchored and unavailable dates exist, contiguous ranges
|
|
@@ -238,8 +265,8 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
238
265
|
if (anchor && props.isDateUnavailable && !props.allowsNonContiguousRanges) {
|
|
239
266
|
const predicate = (date: CalendarDate): boolean => props.isDateUnavailable!(date, anchor);
|
|
240
267
|
return {
|
|
241
|
-
start: nextUnavailableDate(anchor, predicate, visibleMonths, -1),
|
|
242
|
-
end: nextUnavailableDate(anchor, predicate, visibleMonths, 1),
|
|
268
|
+
start: nextUnavailableDate(anchor, predicate, visibleMonths(), -1),
|
|
269
|
+
end: nextUnavailableDate(anchor, predicate, visibleMonths(), 1),
|
|
243
270
|
};
|
|
244
271
|
}
|
|
245
272
|
return null;
|
|
@@ -281,7 +308,7 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
281
308
|
const visibleRangeEndFromStart = (start: CalendarDate): CalendarDate => {
|
|
282
309
|
let end = endOfMonth(start);
|
|
283
310
|
|
|
284
|
-
for (let i = 1; i < visibleMonths; i++) {
|
|
311
|
+
for (let i = 1; i < visibleMonths(); i++) {
|
|
285
312
|
end = endOfMonth(end.add({ months: 1 }));
|
|
286
313
|
}
|
|
287
314
|
|
|
@@ -290,10 +317,14 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
290
317
|
|
|
291
318
|
const rawAlignStart = (date: CalendarDate): CalendarDate => startOfMonth(date);
|
|
292
319
|
|
|
293
|
-
const rawAlignEnd = (date: CalendarDate): CalendarDate =>
|
|
294
|
-
startOfMonth(date).subtract({ months: Math.max(
|
|
320
|
+
const rawAlignEnd = (date: CalendarDate, months = visibleMonths()): CalendarDate =>
|
|
321
|
+
startOfMonth(date).subtract({ months: Math.max(months - 1, 0) });
|
|
295
322
|
|
|
296
|
-
const constrainVisibleRangeStart = (
|
|
323
|
+
const constrainVisibleRangeStart = (
|
|
324
|
+
date: CalendarDate,
|
|
325
|
+
aligned: CalendarDate,
|
|
326
|
+
months = visibleMonths(),
|
|
327
|
+
): CalendarDate => {
|
|
297
328
|
const minValue = access(props.minValue);
|
|
298
329
|
const maxValue = access(props.maxValue);
|
|
299
330
|
let constrained = aligned;
|
|
@@ -306,7 +337,7 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
306
337
|
}
|
|
307
338
|
|
|
308
339
|
if (maxValue && date.compare(toDisplayCalendarDate(maxValue)) <= 0) {
|
|
309
|
-
const maxStart = rawAlignEnd(toDisplayCalendarDate(maxValue));
|
|
340
|
+
const maxStart = rawAlignEnd(toDisplayCalendarDate(maxValue), months);
|
|
310
341
|
if (maxStart.compare(constrained) < 0) {
|
|
311
342
|
constrained = maxStart;
|
|
312
343
|
}
|
|
@@ -322,16 +353,19 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
322
353
|
constrainVisibleRangeStart(date, rawAlignEnd(date));
|
|
323
354
|
|
|
324
355
|
const alignCenter = (date: CalendarDate): CalendarDate => {
|
|
325
|
-
let offset = Math.floor(visibleMonths / 2);
|
|
326
|
-
if (offset > 0 && visibleMonths % 2 === 0) {
|
|
356
|
+
let offset = Math.floor(visibleMonths() / 2);
|
|
357
|
+
if (offset > 0 && visibleMonths() % 2 === 0) {
|
|
327
358
|
offset--;
|
|
328
359
|
}
|
|
329
360
|
|
|
330
361
|
return constrainVisibleRangeStart(date, rawAlignStart(date).subtract({ months: offset }));
|
|
331
362
|
};
|
|
332
363
|
|
|
364
|
+
// A controlled null is a cleared selection. Pin useControlledState treats
|
|
365
|
+
// `value !== undefined` as controlled, so null must not fall through to defaultValue.
|
|
333
366
|
const defaultSelectionAlignment = (): RangeCalendarSelectionAlignment => {
|
|
334
|
-
const
|
|
367
|
+
const controlled = access(props.value);
|
|
368
|
+
const currentValue = controlled !== undefined ? controlled : props.defaultValue;
|
|
335
369
|
if (!currentValue?.start || !currentValue?.end) {
|
|
336
370
|
return "center";
|
|
337
371
|
}
|
|
@@ -363,26 +397,28 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
363
397
|
return toDisplayCalendarDate(props.defaultFocusedValue);
|
|
364
398
|
}
|
|
365
399
|
const controlledValue = access(props.value);
|
|
366
|
-
if (controlledValue
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
400
|
+
if (controlledValue !== undefined) {
|
|
401
|
+
if (controlledValue?.start) {
|
|
402
|
+
return toDisplayCalendarDate(controlledValue.start);
|
|
403
|
+
}
|
|
404
|
+
} else if (props.defaultValue?.start) {
|
|
370
405
|
return toDisplayCalendarDate(props.defaultValue.start);
|
|
371
406
|
}
|
|
372
407
|
return intlToCalendar(today(timeZone), calendar());
|
|
373
408
|
};
|
|
374
409
|
|
|
375
410
|
// State signals
|
|
376
|
-
const [internalValue, setInternalValue] =
|
|
411
|
+
const [internalValue, setInternalValue] = createInternalSignal<RangeValue<T> | null>(
|
|
377
412
|
props.defaultValue ?? null,
|
|
378
413
|
);
|
|
379
414
|
const initialFocusedDate = constrainDate(getInitialFocusedDate());
|
|
380
|
-
const [focusedDate, setFocusedDateInternal] =
|
|
381
|
-
|
|
415
|
+
const [focusedDate, setFocusedDateInternal] =
|
|
416
|
+
createInternalSignal<CalendarDate>(initialFocusedDate);
|
|
417
|
+
const [visibleRangeStart, setVisibleRangeStart] = createInternalSignal<CalendarDate>(
|
|
382
418
|
alignVisibleRangeStart(initialFocusedDate),
|
|
383
419
|
);
|
|
384
|
-
const [isFocused, setFocused] =
|
|
385
|
-
const [isDragging, setDragging] =
|
|
420
|
+
const [isFocused, setFocused] = createInternalSignal(false);
|
|
421
|
+
const [isDragging, setDragging] = createInternalSignal(false);
|
|
386
422
|
|
|
387
423
|
// Controlled vs uncontrolled value
|
|
388
424
|
const sourceValue = createMemo<RangeValue<T> | null>(() => {
|
|
@@ -425,7 +461,10 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
425
461
|
isDateOutsideRange(toDisplayCalendarDate(v.end), minCal, maxCal)
|
|
426
462
|
);
|
|
427
463
|
});
|
|
428
|
-
const isValueInvalid = createMemo(
|
|
464
|
+
const isValueInvalid = createMemo(
|
|
465
|
+
() =>
|
|
466
|
+
Boolean(access(props.isInvalid)) || validationState() === "invalid" || isInvalidSelection(),
|
|
467
|
+
);
|
|
429
468
|
|
|
430
469
|
// Highlighted range during selection
|
|
431
470
|
const highlightedRange = createMemo<RangeValue<CalendarDate> | null>(() => {
|
|
@@ -448,7 +487,7 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
448
487
|
return { start: focused, end: anchor };
|
|
449
488
|
});
|
|
450
489
|
|
|
451
|
-
//
|
|
490
|
+
// The visible range follows React Stately's selection alignment rules.
|
|
452
491
|
const visibleRange = createMemo(() => {
|
|
453
492
|
const start = visibleRangeStart();
|
|
454
493
|
return { start, end: visibleRangeEndFromStart(start) };
|
|
@@ -461,9 +500,10 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
461
500
|
// on out-of-range keeps a same-month focus from re-firing visibleRangeStart
|
|
462
501
|
// with a fresh equal-valued object, which would otherwise recompute the grid
|
|
463
502
|
// and recreate every cell on focus.
|
|
464
|
-
const syncVisibleRangeForFocusedDate = (
|
|
465
|
-
|
|
466
|
-
|
|
503
|
+
const syncVisibleRangeForFocusedDate = (
|
|
504
|
+
nextFocusedDate: CalendarDate,
|
|
505
|
+
range: { start: CalendarDate; end: CalendarDate },
|
|
506
|
+
) => {
|
|
467
507
|
if (nextFocusedDate.compare(range.start) < 0) {
|
|
468
508
|
setVisibleRangeStart(alignEnd(nextFocusedDate));
|
|
469
509
|
} else if (nextFocusedDate.compare(range.end) > 0) {
|
|
@@ -471,56 +511,73 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
471
511
|
}
|
|
472
512
|
};
|
|
473
513
|
|
|
474
|
-
createEffect(
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
return;
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
const currentFocusedDate = focusedDate();
|
|
499
|
-
const nextFocusedDate = constrainDate(currentFocusedDate);
|
|
500
|
-
|
|
501
|
-
if (
|
|
502
|
-
nextFocusedDate.compare(currentFocusedDate) === 0 &&
|
|
503
|
-
isEqualCalendar(nextFocusedDate.calendar, currentFocusedDate.calendar)
|
|
504
|
-
) {
|
|
505
|
-
return;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
setFocusedDateInternal(nextFocusedDate);
|
|
509
|
-
setVisibleRangeStart(alignVisibleRangeStart(nextFocusedDate));
|
|
510
|
-
props.onFocusChange?.(nextFocusedDate);
|
|
511
|
-
});
|
|
512
|
-
|
|
513
|
-
createEffect(() => {
|
|
514
|
-
const currentFocusedDate = focusedDate();
|
|
515
|
-
const nextFocusedDate = toDisplayCalendarDate(currentFocusedDate);
|
|
514
|
+
createEffect(
|
|
515
|
+
() => {
|
|
516
|
+
const controlledFocused = access(props.focusedValue);
|
|
517
|
+
if (!controlledFocused) return null;
|
|
518
|
+
const nextFocusedDate = constrainDate(toDisplayCalendarDate(controlledFocused));
|
|
519
|
+
return {
|
|
520
|
+
nextFocusedDate,
|
|
521
|
+
currentFocusedDate: focusedDate(),
|
|
522
|
+
alignedStart: alignVisibleRangeStart(nextFocusedDate),
|
|
523
|
+
};
|
|
524
|
+
},
|
|
525
|
+
(data) => {
|
|
526
|
+
if (!data) return;
|
|
527
|
+
const { nextFocusedDate, currentFocusedDate, alignedStart } = data;
|
|
528
|
+
if (
|
|
529
|
+
nextFocusedDate.compare(currentFocusedDate) !== 0 ||
|
|
530
|
+
!isEqualCalendar(nextFocusedDate.calendar, currentFocusedDate.calendar)
|
|
531
|
+
) {
|
|
532
|
+
setFocusedDateInternal(nextFocusedDate);
|
|
533
|
+
setVisibleRangeStart(alignedStart);
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
);
|
|
516
537
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
538
|
+
createEffect(
|
|
539
|
+
() => {
|
|
540
|
+
const controlledFocused = access(props.focusedValue);
|
|
541
|
+
if (controlledFocused) return null;
|
|
542
|
+
const currentFocusedDate = focusedDate();
|
|
543
|
+
const nextFocusedDate = constrainDate(currentFocusedDate);
|
|
544
|
+
if (
|
|
545
|
+
nextFocusedDate.compare(currentFocusedDate) === 0 &&
|
|
546
|
+
isEqualCalendar(nextFocusedDate.calendar, currentFocusedDate.calendar)
|
|
547
|
+
) {
|
|
548
|
+
return null;
|
|
549
|
+
}
|
|
550
|
+
return {
|
|
551
|
+
nextFocusedDate,
|
|
552
|
+
alignedStart: alignVisibleRangeStart(nextFocusedDate),
|
|
553
|
+
};
|
|
554
|
+
},
|
|
555
|
+
(data) => {
|
|
556
|
+
if (!data) return;
|
|
557
|
+
setFocusedDateInternal(data.nextFocusedDate);
|
|
558
|
+
setVisibleRangeStart(data.alignedStart);
|
|
559
|
+
props.onFocusChange?.(data.nextFocusedDate);
|
|
560
|
+
},
|
|
561
|
+
);
|
|
520
562
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
563
|
+
createEffect(
|
|
564
|
+
() => {
|
|
565
|
+
const currentFocusedDate = focusedDate();
|
|
566
|
+
const nextFocusedDate = toDisplayCalendarDate(currentFocusedDate);
|
|
567
|
+
if (isEqualCalendar(currentFocusedDate.calendar, nextFocusedDate.calendar)) {
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
return {
|
|
571
|
+
nextFocusedDate,
|
|
572
|
+
alignedStart: alignVisibleRangeStart(nextFocusedDate),
|
|
573
|
+
};
|
|
574
|
+
},
|
|
575
|
+
(data) => {
|
|
576
|
+
if (!data) return;
|
|
577
|
+
setFocusedDateInternal(data.nextFocusedDate);
|
|
578
|
+
setVisibleRangeStart(data.alignedStart);
|
|
579
|
+
},
|
|
580
|
+
);
|
|
524
581
|
|
|
525
582
|
// Format week days for headers
|
|
526
583
|
const weekDays = createMemo(() => {
|
|
@@ -581,7 +638,7 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
581
638
|
return;
|
|
582
639
|
}
|
|
583
640
|
|
|
584
|
-
syncVisibleRangeForFocusedDate(constrained);
|
|
641
|
+
syncVisibleRangeForFocusedDate(constrained, visibleRange());
|
|
585
642
|
setFocusedDateInternal(constrained);
|
|
586
643
|
props.onFocusChange?.(constrained);
|
|
587
644
|
};
|
|
@@ -691,18 +748,22 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
691
748
|
// the window, so a single-month page whose focus stays in view would never
|
|
692
749
|
// advance the grid.
|
|
693
750
|
const focusPreviousPage = () => {
|
|
694
|
-
const pageMonths = access(props.pageBehavior) === "single" ? 1 : visibleMonths;
|
|
695
|
-
const
|
|
751
|
+
const pageMonths = access(props.pageBehavior) === "single" ? 1 : visibleMonths();
|
|
752
|
+
const currentFocused = focusedDate();
|
|
753
|
+
const nextFocusedDate = constrainDate(currentFocused.subtract({ months: pageMonths }));
|
|
754
|
+
const slidStart = startOfMonth(visibleRangeStart().subtract({ months: pageMonths }));
|
|
696
755
|
setFocusedDateInternal(nextFocusedDate);
|
|
697
|
-
setVisibleRangeStart(
|
|
756
|
+
setVisibleRangeStart(constrainVisibleRangeStart(currentFocused, slidStart, pageMonths));
|
|
698
757
|
props.onFocusChange?.(nextFocusedDate);
|
|
699
758
|
};
|
|
700
759
|
|
|
701
760
|
const focusNextPage = () => {
|
|
702
|
-
const pageMonths = access(props.pageBehavior) === "single" ? 1 : visibleMonths;
|
|
703
|
-
const
|
|
761
|
+
const pageMonths = access(props.pageBehavior) === "single" ? 1 : visibleMonths();
|
|
762
|
+
const currentFocused = focusedDate();
|
|
763
|
+
const nextFocusedDate = constrainDate(currentFocused.add({ months: pageMonths }));
|
|
764
|
+
const slidStart = startOfMonth(visibleRangeStart().add({ months: pageMonths }));
|
|
704
765
|
setFocusedDateInternal(nextFocusedDate);
|
|
705
|
-
setVisibleRangeStart(
|
|
766
|
+
setVisibleRangeStart(constrainVisibleRangeStart(currentFocused, slidStart, pageMonths));
|
|
706
767
|
props.onFocusChange?.(nextFocusedDate);
|
|
707
768
|
};
|
|
708
769
|
|
|
@@ -785,7 +846,7 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
785
846
|
);
|
|
786
847
|
if (!selectableDate) return;
|
|
787
848
|
|
|
788
|
-
const anchor = anchorDate
|
|
849
|
+
const anchor = readNow(anchorDate);
|
|
789
850
|
|
|
790
851
|
if (!anchor) {
|
|
791
852
|
// First click - set anchor
|
|
@@ -836,6 +897,29 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
836
897
|
return week;
|
|
837
898
|
};
|
|
838
899
|
|
|
900
|
+
const focusNearestAvailableDate = (anchor: CalendarDate) => {
|
|
901
|
+
// RAC `useRangeCalendarState.ts:261-273`: prefer anchor+1, else −1.
|
|
902
|
+
// Invalid is outside min/max or this anchor's contiguous span. A day in
|
|
903
|
+
// the next month, or an unavailable day when non-contiguous ranges are
|
|
904
|
+
// allowed, is still a valid focus target.
|
|
905
|
+
const passedRange = getAvailableRange(anchor);
|
|
906
|
+
const isDateInvalid = (candidate: CalendarDate) => {
|
|
907
|
+
if (isDateOutsideAllowedRange(candidate)) return true;
|
|
908
|
+
const calDate = toDisplayCalendarDate(candidate);
|
|
909
|
+
if (passedRange?.start && calDate.compare(passedRange.start) < 0) return true;
|
|
910
|
+
if (passedRange?.end && calDate.compare(passedRange.end) > 0) return true;
|
|
911
|
+
return false;
|
|
912
|
+
};
|
|
913
|
+
let nextDay = anchor.add({ days: 1 });
|
|
914
|
+
if (isDateInvalid(nextDay)) {
|
|
915
|
+
nextDay = anchor.subtract({ days: 1 });
|
|
916
|
+
}
|
|
917
|
+
if (!isDateInvalid(nextDay)) {
|
|
918
|
+
setFocusedDate(nextDay);
|
|
919
|
+
setFocused(true);
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
|
|
839
923
|
// Get number of weeks in a month
|
|
840
924
|
const getWeeksInMonthFn = (date?: CalendarDate): number => {
|
|
841
925
|
const monthDate = date ?? focusedDate();
|
|
@@ -966,13 +1050,16 @@ export function createRangeCalendarState<T extends DateValue = CalendarDate>(
|
|
|
966
1050
|
focusPageEnd,
|
|
967
1051
|
selectFocusedDate,
|
|
968
1052
|
selectDate,
|
|
1053
|
+
focusNearestAvailableDate,
|
|
969
1054
|
isFocused,
|
|
970
1055
|
setFocused,
|
|
971
1056
|
getDatesInWeek,
|
|
972
1057
|
getWeeksInMonth: getWeeksInMonthFn,
|
|
973
1058
|
weekDays,
|
|
974
1059
|
title,
|
|
975
|
-
visibleMonths
|
|
1060
|
+
get visibleMonths() {
|
|
1061
|
+
return visibleMonths();
|
|
1062
|
+
},
|
|
976
1063
|
isDragging,
|
|
977
1064
|
setDragging,
|
|
978
1065
|
formatValue,
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the 'License');
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/datepicker/useTimeFieldState.ts
|
|
14
|
+
|
|
1
15
|
/**
|
|
2
16
|
* TimeFieldState for Solid-Stately
|
|
3
17
|
*
|
|
4
|
-
* Faithful port of
|
|
5
|
-
*
|
|
18
|
+
* Faithful port of
|
|
19
|
+
* `packages/react-stately/src/datepicker/useTimeFieldState.ts`, which is a thin
|
|
20
|
+
* wrapper over `useDateFieldState`: a time-only `Time` value is converted
|
|
6
21
|
* to a `CalendarDateTime` (anchored on today's date, or a zoned date when the
|
|
7
22
|
* value/default carries a time zone) and fed to the date-field state machine
|
|
8
23
|
* with `maxGranularity: 'hour'` so the date segments drop away and only
|
|
@@ -19,7 +34,10 @@
|
|
|
19
34
|
* invoke and freeze them, breaking reactivity.
|
|
20
35
|
*/
|
|
21
36
|
|
|
22
|
-
import {
|
|
37
|
+
import { createMemo } from "solid-js";
|
|
38
|
+
import type { Accessor } from "solid-js";
|
|
39
|
+
import { access, createInternalSignal, type MaybeAccessor } from "../utils";
|
|
40
|
+
|
|
23
41
|
import {
|
|
24
42
|
Time,
|
|
25
43
|
type CalendarDate,
|
|
@@ -33,7 +51,6 @@ import {
|
|
|
33
51
|
toCalendarDateTime,
|
|
34
52
|
GregorianCalendar,
|
|
35
53
|
} from "@internationalized/date";
|
|
36
|
-
import { access, type MaybeAccessor } from "../utils";
|
|
37
54
|
import type { ValidationState } from "./createCalendarState";
|
|
38
55
|
import type { ValidationBehavior, ValidationFunction } from "../form";
|
|
39
56
|
import {
|
|
@@ -73,7 +90,7 @@ export interface TimeFieldStateProps<T extends TimeValue = Time> {
|
|
|
73
90
|
/** Whether the value is invalid (controlled). */
|
|
74
91
|
isInvalid?: boolean;
|
|
75
92
|
/** The locale to use for formatting. */
|
|
76
|
-
locale?: string
|
|
93
|
+
locale?: MaybeAccessor<string | undefined>;
|
|
77
94
|
/** The granularity (hour, minute, second). */
|
|
78
95
|
granularity?: "hour" | "minute" | "second";
|
|
79
96
|
/** Whether to show 12 or 24 hour format. */
|
|
@@ -105,7 +122,7 @@ export interface TimeFieldStateProps<T extends TimeValue = Time> {
|
|
|
105
122
|
* consumers.
|
|
106
123
|
*/
|
|
107
124
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
108
|
-
export interface TimeFieldState<
|
|
125
|
+
export interface TimeFieldState<_T extends TimeValue = Time> extends DateFieldState {
|
|
109
126
|
/** The current value in the `Time`/`CalendarDateTime`/`ZonedDateTime` domain. */
|
|
110
127
|
timeValue: Accessor<TimeValue | null>;
|
|
111
128
|
}
|
|
@@ -137,7 +154,9 @@ export function createTimeFieldState<T extends TimeValue = Time>(
|
|
|
137
154
|
const placeholderValue: TimeValue = props.placeholderValue ?? new Time();
|
|
138
155
|
|
|
139
156
|
// Controlled/uncontrolled Time value (mirrors useControlledState).
|
|
140
|
-
const [internalValue, setInternalValue] =
|
|
157
|
+
const [internalValue, setInternalValue] = createInternalSignal<T | null>(
|
|
158
|
+
props.defaultValue ?? null,
|
|
159
|
+
);
|
|
141
160
|
const value = (): T | null => {
|
|
142
161
|
const controlled = access(props.value);
|
|
143
162
|
return controlled !== undefined ? controlled : internalValue();
|
|
@@ -1,5 +1,40 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
1
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/ar-AE.json
|
|
2
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/bg-BG.json
|
|
3
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/cs-CZ.json
|
|
4
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/da-DK.json
|
|
5
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/de-DE.json
|
|
6
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/el-GR.json
|
|
7
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/en-US.json
|
|
8
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/es-ES.json
|
|
9
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/et-EE.json
|
|
10
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/fi-FI.json
|
|
11
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/fr-FR.json
|
|
12
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/he-IL.json
|
|
13
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/hr-HR.json
|
|
14
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/hu-HU.json
|
|
15
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/it-IT.json
|
|
16
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/ja-JP.json
|
|
17
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/ko-KR.json
|
|
18
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/lt-LT.json
|
|
19
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/lv-LV.json
|
|
20
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/nb-NO.json
|
|
21
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/nl-NL.json
|
|
22
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/pl-PL.json
|
|
23
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/pt-BR.json
|
|
24
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/pt-PT.json
|
|
25
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/ro-RO.json
|
|
26
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/ru-RU.json
|
|
27
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/sk-SK.json
|
|
28
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/sl-SI.json
|
|
29
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/sr-SP.json
|
|
30
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/sv-SE.json
|
|
31
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/tr-TR.json
|
|
32
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/uk-UA.json
|
|
33
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/zh-CN.json
|
|
34
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/intl/datepicker/zh-TW.json
|
|
35
|
+
|
|
36
|
+
// DateField validation messages. Ported from the @react-stately/datepicker intl catalog.
|
|
37
|
+
// The catalog has 34 locales. Keep it in sync with the vendored react-spectrum source on every
|
|
3
38
|
// pin bump. Hand-rolled resolver so solid-stately needs no @internationalized/string dep.
|
|
4
39
|
|
|
5
40
|
export type DateFieldErrorKey =
|