@proyecto-viviana/solid-stately 0.2.7 → 0.4.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/README.md +30 -283
- package/dist/autocomplete/createAutocompleteState.d.ts +2 -2
- package/dist/autocomplete/index.d.ts +1 -1
- package/dist/calendar/IncompleteDate.d.ts +61 -0
- package/dist/calendar/createCalendarState.d.ts +41 -16
- package/dist/calendar/createDateFieldState.d.ts +39 -9
- package/dist/calendar/createDatePickerState.d.ts +60 -0
- package/dist/calendar/createRangeCalendarState.d.ts +37 -10
- package/dist/calendar/createTimeFieldState.d.ts +34 -7
- package/dist/calendar/index.d.ts +7 -6
- package/dist/checkbox/createCheckboxGroupState.d.ts +6 -6
- package/dist/checkbox/index.d.ts +1 -1
- package/dist/collections/ListCollection.d.ts +1 -1
- package/dist/collections/createListState.d.ts +11 -8
- package/dist/collections/createMenuState.d.ts +7 -7
- package/dist/collections/createSelectionState.d.ts +22 -10
- package/dist/collections/getChildNodes.d.ts +11 -0
- package/dist/collections/index.d.ts +6 -5
- package/dist/collections/types.d.ts +12 -12
- package/dist/color/Color.d.ts +1 -1
- package/dist/color/createColorAreaState.d.ts +4 -2
- package/dist/color/createColorFieldState.d.ts +38 -12
- package/dist/color/createColorSliderState.d.ts +9 -2
- package/dist/color/createColorWheelState.d.ts +13 -2
- package/dist/color/getColorChannels.d.ts +1 -1
- package/dist/color/index.d.ts +6 -6
- package/dist/color/types.d.ts +4 -4
- package/dist/combobox/createComboBoxState.d.ts +34 -13
- package/dist/combobox/index.d.ts +1 -1
- package/dist/data/createAsyncList.d.ts +4 -4
- package/dist/data/createListData.d.ts +2 -2
- package/dist/data/createTreeData.d.ts +6 -2
- package/dist/data/index.d.ts +3 -3
- package/dist/datepicker/index.d.ts +2 -4
- package/dist/disclosure/createDisclosureState.d.ts +2 -2
- package/dist/disclosure/index.d.ts +1 -1
- package/dist/dnd/createDragState.d.ts +2 -2
- package/dist/dnd/createDraggableCollectionState.d.ts +2 -2
- package/dist/dnd/createDropState.d.ts +2 -2
- package/dist/dnd/createDroppableCollectionState.d.ts +3 -3
- package/dist/dnd/index.d.ts +5 -5
- package/dist/dnd/types.d.ts +19 -17
- package/dist/form/createFormValidationState.d.ts +3 -3
- package/dist/form/index.d.ts +1 -1
- package/dist/grid/createGridState.d.ts +2 -2
- package/dist/grid/index.d.ts +2 -2
- package/dist/grid/types.d.ts +27 -11
- package/dist/index.d.ts +31 -30
- package/dist/index.js +9077 -7246
- package/dist/index.js.map +1 -1
- package/dist/menu/index.d.ts +2 -2
- package/dist/numberfield/createNumberFieldState.d.ts +2 -2
- package/dist/numberfield/index.d.ts +1 -1
- package/dist/overlays/createOverlayTriggerState.d.ts +2 -2
- package/dist/overlays/index.d.ts +1 -1
- package/dist/radio/createRadioGroupState.d.ts +7 -7
- package/dist/radio/index.d.ts +1 -1
- package/dist/searchfield/createSearchFieldState.d.ts +2 -2
- package/dist/searchfield/index.d.ts +2 -2
- package/dist/select/createSelectState.d.ts +14 -8
- package/dist/select/index.d.ts +1 -1
- package/dist/selection/Selection.d.ts +16 -0
- package/dist/selection/SelectionManager.d.ts +110 -0
- package/dist/selection/createMultipleSelectionState.d.ts +59 -0
- package/dist/selection/index.d.ts +6 -5
- package/dist/slider/createSliderState.d.ts +3 -3
- package/dist/slider/index.d.ts +2 -2
- package/dist/steplist/createStepListState.d.ts +48 -0
- package/dist/steplist/index.d.ts +1 -0
- package/dist/table/TableCollection.d.ts +33 -3
- package/dist/table/createTableColumnResizeState.d.ts +54 -0
- package/dist/table/createTableState.d.ts +2 -2
- package/dist/table/createTreeGridState.d.ts +15 -0
- package/dist/table/index.d.ts +6 -3
- package/dist/table/types.d.ts +68 -10
- package/dist/tabs/createTabListState.d.ts +5 -5
- package/dist/tabs/index.d.ts +1 -1
- package/dist/textfield/createTextFieldState.d.ts +2 -2
- package/dist/textfield/index.d.ts +1 -1
- package/dist/toast/createToastState.d.ts +24 -2
- package/dist/toast/index.d.ts +1 -1
- package/dist/toggle/createToggleGroupState.d.ts +4 -4
- package/dist/toggle/createToggleState.d.ts +2 -2
- package/dist/toggle/index.d.ts +2 -2
- package/dist/tooltip/createTooltipTriggerState.d.ts +2 -2
- package/dist/tooltip/index.d.ts +1 -1
- package/dist/tree/TreeCollection.d.ts +2 -2
- package/dist/tree/createTreeState.d.ts +2 -2
- package/dist/tree/index.d.ts +3 -3
- package/dist/tree/types.d.ts +27 -13
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/reactivity.d.ts +1 -1
- package/package.json +29 -30
- package/src/autocomplete/createAutocompleteState.d.ts +19 -17
- package/src/autocomplete/createAutocompleteState.ts +24 -30
- package/src/autocomplete/index.d.ts +6 -2
- package/src/autocomplete/index.ts +1 -1
- package/src/calendar/IncompleteDate.ts +430 -0
- package/src/calendar/createCalendarState.d.ts +139 -117
- package/src/calendar/createCalendarState.ts +308 -94
- package/src/calendar/createDateFieldState.d.ts +130 -95
- package/src/calendar/createDateFieldState.ts +447 -334
- package/src/calendar/createDatePickerState.ts +347 -0
- package/src/calendar/createRangeCalendarState.d.ts +154 -129
- package/src/calendar/createRangeCalendarState.ts +411 -85
- package/src/calendar/createTimeFieldState.d.ts +81 -79
- package/src/calendar/createTimeFieldState.ts +187 -108
- package/src/calendar/index.d.ts +80 -7
- package/src/calendar/index.ts +23 -12
- package/src/checkbox/createCheckboxGroupState.d.ts +57 -55
- package/src/checkbox/createCheckboxGroupState.ts +20 -29
- package/src/checkbox/index.d.ts +6 -2
- package/src/checkbox/index.ts +1 -1
- package/src/collections/ListCollection.d.ts +25 -22
- package/src/collections/ListCollection.ts +6 -6
- package/src/collections/createListState.d.ts +73 -58
- package/src/collections/createListState.ts +67 -35
- package/src/collections/createMenuState.d.ts +36 -31
- package/src/collections/createMenuState.ts +21 -12
- package/src/collections/createSelectionState.d.ts +78 -65
- package/src/collections/createSelectionState.ts +66 -52
- package/src/collections/getChildNodes.ts +98 -0
- package/src/collections/index.d.ts +38 -6
- package/src/collections/index.ts +14 -10
- package/src/collections/types.d.ts +101 -101
- package/src/collections/types.ts +12 -12
- package/src/color/Color.d.ts +20 -5
- package/src/color/Color.ts +357 -254
- package/src/color/createColorAreaState.d.ts +67 -65
- package/src/color/createColorAreaState.ts +21 -13
- package/src/color/createColorFieldState.d.ts +46 -44
- package/src/color/createColorFieldState.ts +285 -149
- package/src/color/createColorSliderState.d.ts +58 -56
- package/src/color/createColorSliderState.ts +45 -14
- package/src/color/createColorWheelState.d.ts +42 -40
- package/src/color/createColorWheelState.ts +101 -64
- package/src/color/getColorChannels.ts +7 -5
- package/src/color/index.d.ts +36 -7
- package/src/color/index.ts +6 -9
- package/src/color/types.d.ts +68 -63
- package/src/color/types.ts +11 -19
- package/src/combobox/createComboBoxState.d.ts +107 -105
- package/src/combobox/createComboBoxState.ts +184 -89
- package/src/combobox/index.d.ts +10 -2
- package/src/combobox/index.ts +1 -1
- package/src/data/createAsyncList.ts +89 -63
- package/src/data/createListData.ts +67 -67
- package/src/data/createTreeData.ts +304 -91
- package/src/data/index.ts +3 -3
- package/src/datepicker/index.ts +6 -10
- package/src/disclosure/createDisclosureState.d.ts +47 -43
- package/src/disclosure/createDisclosureState.ts +7 -21
- package/src/disclosure/index.d.ts +10 -2
- package/src/disclosure/index.ts +1 -1
- package/src/dnd/createDragState.d.ts +51 -42
- package/src/dnd/createDragState.ts +12 -14
- package/src/dnd/createDraggableCollectionState.d.ts +52 -41
- package/src/dnd/createDraggableCollectionState.ts +14 -21
- package/src/dnd/createDropState.d.ts +64 -45
- package/src/dnd/createDropState.ts +22 -32
- package/src/dnd/createDroppableCollectionState.d.ts +88 -59
- package/src/dnd/createDroppableCollectionState.ts +40 -43
- package/src/dnd/index.d.ts +55 -6
- package/src/dnd/index.ts +6 -18
- package/src/dnd/types.d.ts +170 -157
- package/src/dnd/types.ts +24 -22
- package/src/form/createFormValidationState.d.ts +47 -45
- package/src/form/createFormValidationState.ts +30 -63
- package/src/form/index.d.ts +16 -2
- package/src/form/index.ts +1 -1
- package/src/grid/createGridState.d.ts +7 -4
- package/src/grid/createGridState.ts +78 -51
- package/src/grid/index.d.ts +3 -3
- package/src/grid/index.ts +2 -8
- package/src/grid/types.d.ts +136 -129
- package/src/grid/types.ts +34 -18
- package/src/index.d.ts +311 -26
- package/src/index.ts +59 -89
- package/src/menu/index.ts +2 -4
- package/src/numberfield/createNumberFieldState.d.ts +56 -54
- package/src/numberfield/createNumberFieldState.ts +26 -31
- package/src/numberfield/index.d.ts +6 -2
- package/src/numberfield/index.ts +1 -1
- package/src/overlays/createOverlayTriggerState.d.ts +22 -20
- package/src/overlays/createOverlayTriggerState.ts +3 -4
- package/src/overlays/index.d.ts +6 -2
- package/src/overlays/index.ts +1 -1
- package/src/radio/createRadioGroupState.d.ts +54 -52
- package/src/radio/createRadioGroupState.ts +27 -29
- package/src/radio/index.d.ts +7 -2
- package/src/radio/index.ts +1 -1
- package/src/searchfield/createSearchFieldState.d.ts +16 -14
- package/src/searchfield/createSearchFieldState.ts +5 -11
- package/src/searchfield/index.d.ts +3 -3
- package/src/searchfield/index.ts +2 -5
- package/src/select/createSelectState.d.ts +63 -61
- package/src/select/createSelectState.ts +42 -29
- package/src/select/index.d.ts +2 -2
- package/src/select/index.ts +1 -5
- package/src/selection/Selection.ts +28 -0
- package/src/selection/SelectionManager.ts +526 -0
- package/src/selection/createMultipleSelectionState.ts +247 -0
- package/src/selection/index.ts +12 -7
- package/src/slider/createSliderState.d.ts +60 -60
- package/src/slider/createSliderState.ts +55 -33
- package/src/slider/index.d.ts +3 -3
- package/src/slider/index.ts +2 -6
- package/src/ssr/index.d.ts +1 -1
- package/src/ssr/index.ts +2 -2
- package/src/steplist/createStepListState.ts +191 -0
- package/src/steplist/index.ts +5 -0
- package/src/table/TableCollection.d.ts +42 -40
- package/src/table/TableCollection.ts +266 -99
- package/src/table/createTableColumnResizeState.ts +242 -0
- package/src/table/createTableState.d.ts +7 -4
- package/src/table/createTableState.ts +30 -7
- package/src/table/createTreeGridState.ts +146 -0
- package/src/table/index.d.ts +14 -4
- package/src/table/index.ts +13 -3
- package/src/table/types.d.ts +98 -92
- package/src/table/types.ts +83 -13
- package/src/tabs/createTabListState.d.ts +59 -57
- package/src/tabs/createTabListState.ts +34 -39
- package/src/tabs/index.d.ts +8 -2
- package/src/tabs/index.ts +1 -1
- package/src/textfield/createTextFieldState.d.ts +16 -14
- package/src/textfield/createTextFieldState.ts +7 -18
- package/src/textfield/index.d.ts +6 -2
- package/src/textfield/index.ts +1 -1
- package/src/toast/createToastState.d.ts +92 -86
- package/src/toast/createToastState.ts +90 -52
- package/src/toast/index.d.ts +12 -2
- package/src/toast/index.ts +2 -1
- package/src/toggle/createToggleGroupState.ts +11 -21
- package/src/toggle/createToggleState.d.ts +19 -19
- package/src/toggle/createToggleState.ts +2 -16
- package/src/toggle/index.d.ts +2 -2
- package/src/toggle/index.ts +2 -6
- package/src/tooltip/createTooltipTriggerState.d.ts +17 -17
- package/src/tooltip/createTooltipTriggerState.ts +12 -11
- package/src/tooltip/index.d.ts +7 -2
- package/src/tooltip/index.ts +1 -1
- package/src/tree/TreeCollection.d.ts +26 -23
- package/src/tree/TreeCollection.ts +29 -22
- package/src/tree/createTreeState.d.ts +7 -4
- package/src/tree/createTreeState.ts +70 -41
- package/src/tree/index.d.ts +10 -4
- package/src/tree/index.ts +3 -3
- package/src/tree/types.d.ts +131 -126
- package/src/tree/types.ts +30 -13
- package/src/utils/index.d.ts +2 -2
- package/src/utils/index.ts +1 -1
- package/src/utils/reactivity.d.ts +2 -2
- package/src/utils/reactivity.ts +3 -3
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DatePickerState for Solid-Stately
|
|
3
|
+
*
|
|
4
|
+
* Provides unified state management for DatePicker components.
|
|
5
|
+
* Based on @react-stately/datepicker useDatePickerState
|
|
6
|
+
*/
|
|
7
|
+
import { type Accessor } from "solid-js";
|
|
8
|
+
import { type DateValue, DateFormatter } from "@internationalized/date";
|
|
9
|
+
import { type MaybeAccessor } from "../utils";
|
|
10
|
+
import type { ValidationState } from "./createCalendarState";
|
|
11
|
+
import type { TimeValue } from "./createTimeFieldState";
|
|
12
|
+
export type Granularity = "day" | "hour" | "minute" | "second";
|
|
13
|
+
export type DatePickerStateProps<T extends DateValue = DateValue> = DatePickerStateOptions<T>;
|
|
14
|
+
export interface DatePickerStateOptions<T extends DateValue = DateValue> {
|
|
15
|
+
value?: MaybeAccessor<T | null>;
|
|
16
|
+
defaultValue?: T | null;
|
|
17
|
+
onChange?: (value: T | null) => void;
|
|
18
|
+
minValue?: MaybeAccessor<DateValue | undefined>;
|
|
19
|
+
maxValue?: MaybeAccessor<DateValue | undefined>;
|
|
20
|
+
isDisabled?: MaybeAccessor<boolean>;
|
|
21
|
+
isReadOnly?: MaybeAccessor<boolean>;
|
|
22
|
+
isRequired?: MaybeAccessor<boolean>;
|
|
23
|
+
granularity?: Granularity;
|
|
24
|
+
hourCycle?: 12 | 24;
|
|
25
|
+
hideTimeZone?: boolean;
|
|
26
|
+
placeholderValue?: DateValue;
|
|
27
|
+
shouldCloseOnSelect?: boolean | (() => boolean);
|
|
28
|
+
defaultOpen?: boolean;
|
|
29
|
+
isOpen?: MaybeAccessor<boolean | undefined>;
|
|
30
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
31
|
+
isDateUnavailable?: (date: DateValue) => boolean;
|
|
32
|
+
validationState?: MaybeAccessor<ValidationState | undefined>;
|
|
33
|
+
}
|
|
34
|
+
export interface DatePickerState<T extends DateValue = DateValue> {
|
|
35
|
+
value: Accessor<T | null>;
|
|
36
|
+
defaultValue: T | null;
|
|
37
|
+
setValue: (value: T | null) => void;
|
|
38
|
+
dateValue: Accessor<DateValue | null>;
|
|
39
|
+
setDateValue: (value: DateValue) => void;
|
|
40
|
+
timeValue: Accessor<TimeValue | null>;
|
|
41
|
+
setTimeValue: (value: TimeValue) => void;
|
|
42
|
+
granularity: Granularity;
|
|
43
|
+
hasTime: boolean;
|
|
44
|
+
isOpen: Accessor<boolean>;
|
|
45
|
+
open: () => void;
|
|
46
|
+
close: () => void;
|
|
47
|
+
setOpen: (isOpen: boolean) => void;
|
|
48
|
+
isInvalid: Accessor<boolean>;
|
|
49
|
+
validationState: Accessor<ValidationState | undefined>;
|
|
50
|
+
builtinValidation: Accessor<{
|
|
51
|
+
isInvalid: boolean;
|
|
52
|
+
}>;
|
|
53
|
+
showEra: Accessor<boolean>;
|
|
54
|
+
formatValue: (locale: string, fieldOptions?: Intl.DateTimeFormatOptions) => string;
|
|
55
|
+
getDateFormatter: (locale: string, formatOptions?: Intl.DateTimeFormatOptions) => DateFormatter;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Provides unified state management for a DatePicker component.
|
|
59
|
+
*/
|
|
60
|
+
export declare function createDatePickerState<T extends DateValue = DateValue>(props?: DatePickerStateOptions<T>): DatePickerState<T>;
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* Provides state management for range calendar components.
|
|
5
5
|
* Based on @react-stately/calendar useRangeCalendarState
|
|
6
6
|
*/
|
|
7
|
-
import { type Accessor } from
|
|
8
|
-
import { type CalendarDate, type DateValue } from
|
|
9
|
-
import { type MaybeAccessor } from
|
|
10
|
-
import type { ValidationState } from
|
|
7
|
+
import { type Accessor } from "solid-js";
|
|
8
|
+
import { type Calendar as InternationalizedCalendar, type CalendarDate, type CalendarIdentifier, type DateValue } from "@internationalized/date";
|
|
9
|
+
import { type MaybeAccessor } from "../utils";
|
|
10
|
+
import type { CalendarDayOfWeek, ValidationState } from "./createCalendarState";
|
|
11
|
+
type RangeCalendarSelectionAlignment = "start" | "center" | "end";
|
|
12
|
+
type RangeCalendarPageBehavior = "single" | "visible";
|
|
11
13
|
export interface DateRange {
|
|
12
14
|
start: CalendarDate;
|
|
13
15
|
end: CalendarDate;
|
|
@@ -22,7 +24,7 @@ export interface RangeCalendarStateProps<T extends DateValue = DateValue> {
|
|
|
22
24
|
/** The default value (uncontrolled). */
|
|
23
25
|
defaultValue?: RangeValue<T> | null;
|
|
24
26
|
/** Handler called when the value changes. */
|
|
25
|
-
onChange?: (value: RangeValue<T>) => void;
|
|
27
|
+
onChange?: (value: RangeValue<T> | null) => void;
|
|
26
28
|
/** The minimum allowed date. */
|
|
27
29
|
minValue?: MaybeAccessor<DateValue | undefined>;
|
|
28
30
|
/** The maximum allowed date. */
|
|
@@ -32,17 +34,27 @@ export interface RangeCalendarStateProps<T extends DateValue = DateValue> {
|
|
|
32
34
|
/** Whether the calendar is read-only. */
|
|
33
35
|
isReadOnly?: MaybeAccessor<boolean>;
|
|
34
36
|
/** The date that is focused when the calendar first mounts. */
|
|
35
|
-
focusedValue?: MaybeAccessor<DateValue | undefined>;
|
|
37
|
+
focusedValue?: MaybeAccessor<DateValue | null | undefined>;
|
|
36
38
|
/** The default focused date (uncontrolled). */
|
|
37
39
|
defaultFocusedValue?: DateValue;
|
|
38
40
|
/** Handler called when the focused date changes. */
|
|
39
41
|
onFocusChange?: (date: CalendarDate) => void;
|
|
40
42
|
/** The locale to use for formatting. */
|
|
41
|
-
locale?: string
|
|
42
|
-
/**
|
|
43
|
-
|
|
43
|
+
locale?: MaybeAccessor<string | undefined>;
|
|
44
|
+
/** Creates a calendar object for a locale calendar identifier. */
|
|
45
|
+
createCalendar?: (identifier: CalendarIdentifier) => InternationalizedCalendar;
|
|
46
|
+
/**
|
|
47
|
+
* Callback that determines if a date is unavailable. The second argument is the
|
|
48
|
+
* current selection anchor (the first selected date), so availability can be
|
|
49
|
+
* derived from it. Mirrors @react-stately/calendar 1.18.
|
|
50
|
+
*/
|
|
51
|
+
isDateUnavailable?: (date: DateValue, anchorDate: CalendarDate | null) => boolean;
|
|
44
52
|
/** The number of months to display at once. */
|
|
45
|
-
visibleMonths?: number
|
|
53
|
+
visibleMonths?: MaybeAccessor<number | undefined>;
|
|
54
|
+
/** Controls how the initial visible months are aligned around the current value. */
|
|
55
|
+
selectionAlignment?: MaybeAccessor<RangeCalendarSelectionAlignment | undefined>;
|
|
56
|
+
/** Controls whether pagination moves by one month or the visible month count. */
|
|
57
|
+
pageBehavior?: MaybeAccessor<RangeCalendarPageBehavior | undefined>;
|
|
46
58
|
/** Controls which days are disabled. */
|
|
47
59
|
isDateDisabled?: (date: DateValue) => boolean;
|
|
48
60
|
/** Validation state. */
|
|
@@ -61,6 +73,10 @@ export interface RangeCalendarState<T extends DateValue = DateValue> {
|
|
|
61
73
|
focusedDate: Accessor<CalendarDate>;
|
|
62
74
|
/** Sets the focused date. */
|
|
63
75
|
setFocusedDate: (date: CalendarDate) => void;
|
|
76
|
+
/** The minimum allowed date that a user may select. */
|
|
77
|
+
minValue: Accessor<DateValue | null>;
|
|
78
|
+
/** The maximum allowed date that a user may select. */
|
|
79
|
+
maxValue: Accessor<DateValue | null>;
|
|
64
80
|
/** The anchor date when selecting a range (first click). */
|
|
65
81
|
anchorDate: Accessor<CalendarDate | null>;
|
|
66
82
|
/** Sets the anchor date. */
|
|
@@ -78,8 +94,14 @@ export interface RangeCalendarState<T extends DateValue = DateValue> {
|
|
|
78
94
|
}>;
|
|
79
95
|
/** The timezone used for date calculations. */
|
|
80
96
|
timeZone: string;
|
|
97
|
+
/** The locale used for formatting and locale-specific week starts. */
|
|
98
|
+
locale: Accessor<string>;
|
|
99
|
+
/** The explicitly requested first weekday, or undefined for the locale default. */
|
|
100
|
+
firstDayOfWeek: Accessor<CalendarDayOfWeek | undefined>;
|
|
81
101
|
/** The validation state. */
|
|
82
102
|
validationState: Accessor<ValidationState | undefined>;
|
|
103
|
+
/** Whether the current value is invalid according to validation state. */
|
|
104
|
+
isValueInvalid: Accessor<boolean>;
|
|
83
105
|
/** Whether a date is within the selected range. */
|
|
84
106
|
isSelected: (date: DateValue) => boolean;
|
|
85
107
|
/** Whether a date is the start of the selection. */
|
|
@@ -104,6 +126,10 @@ export interface RangeCalendarState<T extends DateValue = DateValue> {
|
|
|
104
126
|
focusPreviousSection: () => void;
|
|
105
127
|
/** Moves focus to the next section (year). */
|
|
106
128
|
focusNextSection: () => void;
|
|
129
|
+
/** Whether the previous visible range would be outside the allowed date range. */
|
|
130
|
+
isPreviousVisibleRangeInvalid: () => boolean;
|
|
131
|
+
/** Whether the next visible range would be outside the allowed date range. */
|
|
132
|
+
isNextVisibleRangeInvalid: () => boolean;
|
|
107
133
|
/** Moves focus to the previous day. */
|
|
108
134
|
focusPreviousDay: () => void;
|
|
109
135
|
/** Moves focus to the next day. */
|
|
@@ -143,3 +169,4 @@ export interface RangeCalendarState<T extends DateValue = DateValue> {
|
|
|
143
169
|
* Provides state management for a range calendar component.
|
|
144
170
|
*/
|
|
145
171
|
export declare function createRangeCalendarState<T extends DateValue = CalendarDate>(props?: RangeCalendarStateProps<T>): RangeCalendarState<T>;
|
|
172
|
+
export {};
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* Provides state management for time field components with segment-based editing.
|
|
5
5
|
* Based on @react-stately/datepicker useTimeFieldState
|
|
6
6
|
*/
|
|
7
|
-
import { type Accessor } from
|
|
8
|
-
import { type Time, type CalendarDateTime, type ZonedDateTime } from
|
|
9
|
-
import { type MaybeAccessor } from
|
|
10
|
-
import type { ValidationState } from
|
|
7
|
+
import { type Accessor } from "solid-js";
|
|
8
|
+
import { type Time, type CalendarDateTime, type ZonedDateTime, type DateValue } from "@internationalized/date";
|
|
9
|
+
import { type MaybeAccessor } from "../utils";
|
|
10
|
+
import type { ValidationState } from "./createCalendarState";
|
|
11
|
+
import { type ValidationBehavior, type ValidationFunction, type ValidationResult } from "../form";
|
|
11
12
|
export type TimeValue = Time | CalendarDateTime | ZonedDateTime;
|
|
12
|
-
export type TimeSegmentType =
|
|
13
|
+
export type TimeSegmentType = "hour" | "minute" | "second" | "dayPeriod" | "literal";
|
|
13
14
|
export interface TimeSegment {
|
|
14
15
|
/** The type of segment. */
|
|
15
16
|
type: TimeSegmentType;
|
|
@@ -45,20 +46,36 @@ export interface TimeFieldStateProps<T extends TimeValue = Time> {
|
|
|
45
46
|
isReadOnly?: MaybeAccessor<boolean>;
|
|
46
47
|
/** Whether the field is required. */
|
|
47
48
|
isRequired?: MaybeAccessor<boolean>;
|
|
49
|
+
/** Whether the value is invalid (controlled). */
|
|
50
|
+
isInvalid?: boolean;
|
|
48
51
|
/** The locale to use for formatting. */
|
|
49
52
|
locale?: string;
|
|
50
53
|
/** The granularity (hour, minute, second). */
|
|
51
|
-
granularity?:
|
|
54
|
+
granularity?: "hour" | "minute" | "second";
|
|
52
55
|
/** Whether to show 12 or 24 hour format. */
|
|
53
56
|
hourCycle?: 12 | 24;
|
|
57
|
+
/** Whether to force leading zeroes in the hour segment. */
|
|
58
|
+
shouldForceLeadingZeros?: boolean;
|
|
54
59
|
/** Validation state. */
|
|
55
60
|
validationState?: MaybeAccessor<ValidationState | undefined>;
|
|
61
|
+
/** Validation behavior mode. */
|
|
62
|
+
validationBehavior?: ValidationBehavior;
|
|
63
|
+
/** Custom validation function. */
|
|
64
|
+
validate?: ValidationFunction<T>;
|
|
65
|
+
/** Description text. */
|
|
66
|
+
description?: string;
|
|
67
|
+
/** Error message. */
|
|
68
|
+
errorMessage?: string;
|
|
56
69
|
/** The placeholder value. */
|
|
57
70
|
placeholderValue?: T;
|
|
71
|
+
/** Whether dates outside the min/max range are unavailable. Added for API consistency. */
|
|
72
|
+
isDateUnavailable?: (date: DateValue) => boolean;
|
|
58
73
|
}
|
|
59
74
|
export interface TimeFieldState<T extends TimeValue = Time> {
|
|
60
75
|
/** The current value. */
|
|
61
76
|
value: Accessor<T | null>;
|
|
77
|
+
/** The default value. */
|
|
78
|
+
defaultValue: T | null;
|
|
62
79
|
/** Sets the value. */
|
|
63
80
|
setValue: (value: T | null) => void;
|
|
64
81
|
/** The segments that make up the time. */
|
|
@@ -80,9 +97,19 @@ export interface TimeFieldState<T extends TimeValue = Time> {
|
|
|
80
97
|
/** The validation state. */
|
|
81
98
|
validationState: Accessor<ValidationState | undefined>;
|
|
82
99
|
/** The granularity. */
|
|
83
|
-
granularity:
|
|
100
|
+
granularity: "hour" | "minute" | "second";
|
|
84
101
|
/** Whether the value is invalid. */
|
|
85
102
|
isInvalid: Accessor<boolean>;
|
|
103
|
+
/** Realtime validation results, including native and custom constraints. */
|
|
104
|
+
realtimeValidation: Accessor<ValidationResult>;
|
|
105
|
+
/** Currently displayed validation results. */
|
|
106
|
+
displayValidation: Accessor<ValidationResult>;
|
|
107
|
+
/** Updates the current validation result. */
|
|
108
|
+
updateValidation: (result: ValidationResult) => void;
|
|
109
|
+
/** Resets displayed validation to valid. */
|
|
110
|
+
resetValidation: () => void;
|
|
111
|
+
/** Commits realtime validation to displayed validation. */
|
|
112
|
+
commitValidation: () => void;
|
|
86
113
|
/** The locale. */
|
|
87
114
|
locale: string;
|
|
88
115
|
/** The hour cycle. */
|
package/dist/calendar/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { createCalendarState, type CalendarStateProps, type CalendarState, type ValidationState, } from
|
|
2
|
-
export { createRangeCalendarState, type RangeCalendarStateProps, type RangeCalendarState, type DateRange, type RangeValue, } from
|
|
3
|
-
export { createDateFieldState, type DateFieldStateProps, type DateFieldState, type DateSegment, type DateSegmentType, } from
|
|
4
|
-
export { createTimeFieldState, type TimeFieldStateProps, type TimeFieldState, type TimeSegment, type TimeSegmentType, type TimeValue, } from
|
|
5
|
-
export
|
|
6
|
-
export {
|
|
1
|
+
export { createCalendarState, type CalendarStateProps, type CalendarState, type CalendarSelectionMode, type CalendarValueType, type ValidationState, type CalendarPageBehavior, type CalendarSelectionAlignment, type CalendarDayOfWeek, } from "./createCalendarState";
|
|
2
|
+
export { createRangeCalendarState, type RangeCalendarStateProps, type RangeCalendarState, type DateRange, type RangeValue, } from "./createRangeCalendarState";
|
|
3
|
+
export { createDateFieldState, type DateFieldStateProps, type DateFieldState, type DateSegment, type DateSegmentType, } from "./createDateFieldState";
|
|
4
|
+
export { createTimeFieldState, type TimeFieldStateProps, type TimeFieldState, type TimeSegment, type TimeSegmentType, type TimeValue, } from "./createTimeFieldState";
|
|
5
|
+
export { createDatePickerState, type DatePickerStateOptions, type DatePickerState, } from "./createDatePickerState";
|
|
6
|
+
export type { CalendarDate, CalendarDateTime, ZonedDateTime, DateValue, Time, Calendar, CalendarIdentifier, AnyCalendarDate, } from "@internationalized/date";
|
|
7
|
+
export { createCalendar, GregorianCalendar, today, now, getLocalTimeZone, parseDate, parseDateTime, parseTime, parseAbsolute, parseAbsoluteToLocal, parseZonedDateTime, toCalendarDate, toCalendarDateTime, toZoned, toTime, CalendarDate as CalendarDateClass, CalendarDateTime as CalendarDateTimeClass, ZonedDateTime as ZonedDateTimeClass, Time as TimeClass, DateFormatter, isSameDay, isSameMonth, isSameYear, isToday, isWeekend, startOfMonth, endOfMonth, startOfWeek, endOfWeek, startOfYear, endOfYear, getWeeksInMonth, getDayOfWeek, toCalendar, minDate, maxDate, } from "@internationalized/date";
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This is a 1:1 port of @react-stately/checkbox's useCheckboxGroupState.
|
|
8
8
|
*/
|
|
9
|
-
import { Accessor } from
|
|
10
|
-
import { type MaybeAccessor } from
|
|
11
|
-
import { type FormValidationState, type ValidationFunction, type ValidationResult } from
|
|
9
|
+
import { Accessor } from "solid-js";
|
|
10
|
+
import { type MaybeAccessor } from "../utils";
|
|
11
|
+
import { type FormValidationState, type ValidationFunction, type ValidationResult } from "../form";
|
|
12
12
|
export interface CheckboxGroupProps {
|
|
13
13
|
/** The current selected values (controlled). */
|
|
14
14
|
value?: string[];
|
|
@@ -37,13 +37,13 @@ export interface CheckboxGroupProps {
|
|
|
37
37
|
/** Handler that is called when the checkbox group's focus status changes. */
|
|
38
38
|
onFocusChange?: (isFocused: boolean) => void;
|
|
39
39
|
/** Backward-compatible controlled validation state. */
|
|
40
|
-
validationState?:
|
|
40
|
+
validationState?: "valid" | "invalid";
|
|
41
41
|
/** Custom validation function. */
|
|
42
42
|
validate?: ValidationFunction<readonly string[]>;
|
|
43
43
|
/** Validation behavior for the checkbox group. */
|
|
44
|
-
validationBehavior?:
|
|
44
|
+
validationBehavior?: "aria" | "native";
|
|
45
45
|
}
|
|
46
|
-
export interface CheckboxGroupState extends Pick<FormValidationState,
|
|
46
|
+
export interface CheckboxGroupState extends Pick<FormValidationState, "realtimeValidation" | "displayValidation" | "updateValidation" | "resetValidation" | "commitValidation"> {
|
|
47
47
|
/** Current selected values. */
|
|
48
48
|
readonly value: Accessor<readonly string[]>;
|
|
49
49
|
/** Default selected values. */
|
package/dist/checkbox/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createCheckboxGroupState, type CheckboxGroupProps, type CheckboxGroupState, } from
|
|
1
|
+
export { createCheckboxGroupState, type CheckboxGroupProps, type CheckboxGroupState, } from "./createCheckboxGroupState";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* A simple list collection implementation.
|
|
3
3
|
* Provides a Collection interface over an array of nodes.
|
|
4
4
|
*/
|
|
5
|
-
import type { Collection, CollectionNode, Key } from
|
|
5
|
+
import type { Collection, CollectionNode, Key } from "./types";
|
|
6
6
|
/**
|
|
7
7
|
* A basic implementation of Collection for list-based components.
|
|
8
8
|
*/
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Combines collection and selection state.
|
|
4
4
|
* Based on @react-stately/list.
|
|
5
5
|
*/
|
|
6
|
-
import { type Accessor } from
|
|
7
|
-
import { type MaybeAccessor } from
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
6
|
+
import { type Accessor } from "solid-js";
|
|
7
|
+
import { type MaybeAccessor } from "../utils";
|
|
8
|
+
import type { SelectionState } from "./createSelectionState";
|
|
9
|
+
import { SelectionManager } from "../selection/SelectionManager";
|
|
10
|
+
import type { Collection, CollectionNode, DisabledBehavior, FocusStrategy, Key, SelectionBehavior, SelectionMode } from "./types";
|
|
10
11
|
export interface ListStateProps<T = unknown> {
|
|
11
12
|
/** The items in the list (for dynamic rendering). */
|
|
12
13
|
items?: T[];
|
|
@@ -27,17 +28,19 @@ export interface ListStateProps<T = unknown> {
|
|
|
27
28
|
/** Whether empty selection is disallowed. */
|
|
28
29
|
disallowEmptySelection?: boolean;
|
|
29
30
|
/** Currently selected keys (controlled). */
|
|
30
|
-
selectedKeys?:
|
|
31
|
+
selectedKeys?: "all" | Iterable<Key>;
|
|
31
32
|
/** Default selected keys (uncontrolled). */
|
|
32
|
-
defaultSelectedKeys?:
|
|
33
|
+
defaultSelectedKeys?: "all" | Iterable<Key>;
|
|
33
34
|
/** Handler for selection changes. */
|
|
34
|
-
onSelectionChange?: (keys:
|
|
35
|
+
onSelectionChange?: (keys: "all" | Set<Key>) => void;
|
|
35
36
|
/** Whether to allow duplicate selection events. */
|
|
36
37
|
allowDuplicateSelectionEvents?: boolean;
|
|
37
38
|
}
|
|
38
39
|
export interface ListState<T = unknown> extends SelectionState {
|
|
39
40
|
/** The collection of items. */
|
|
40
41
|
readonly collection: Accessor<Collection<T>>;
|
|
42
|
+
/** The collection-aware selection manager (single source of truth for selection). */
|
|
43
|
+
readonly selectionManager: SelectionManager<T>;
|
|
41
44
|
/** Whether the collection is focused. */
|
|
42
45
|
readonly isFocused: Accessor<boolean>;
|
|
43
46
|
/** Set the focused state. */
|
|
@@ -56,7 +59,7 @@ export declare function createListState<T = unknown>(props: MaybeAccessor<ListSt
|
|
|
56
59
|
/**
|
|
57
60
|
* Props for single selection list state.
|
|
58
61
|
*/
|
|
59
|
-
export interface SingleSelectListStateProps<T = unknown> extends Omit<ListStateProps<T>,
|
|
62
|
+
export interface SingleSelectListStateProps<T = unknown> extends Omit<ListStateProps<T>, "selectionMode" | "selectedKeys" | "defaultSelectedKeys" | "onSelectionChange"> {
|
|
60
63
|
/** The currently selected key (controlled). */
|
|
61
64
|
selectedKey?: Key | null;
|
|
62
65
|
/** The default selected key (uncontrolled). */
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* State management for menu components.
|
|
3
3
|
* Based on @react-stately/menu.
|
|
4
4
|
*/
|
|
5
|
-
import { type MaybeAccessor } from
|
|
6
|
-
import { type ListState, type ListStateProps } from
|
|
7
|
-
import type { Key } from
|
|
8
|
-
export interface MenuStateProps<T = unknown> extends
|
|
5
|
+
import { type MaybeAccessor } from "../utils";
|
|
6
|
+
import { type ListState, type ListStateProps } from "./createListState";
|
|
7
|
+
import type { Key } from "./types";
|
|
8
|
+
export interface MenuStateProps<T = unknown> extends ListStateProps<T> {
|
|
9
9
|
/** Handler called when an item is activated (pressed). */
|
|
10
10
|
onAction?: (key: Key) => void;
|
|
11
11
|
/** Handler called when the menu should close. */
|
|
@@ -38,12 +38,12 @@ export interface MenuTriggerState {
|
|
|
38
38
|
/** Toggle the menu. */
|
|
39
39
|
toggle(): void;
|
|
40
40
|
/** Focus strategy for when the menu opens. */
|
|
41
|
-
readonly focusStrategy: () =>
|
|
41
|
+
readonly focusStrategy: () => "first" | "last" | null;
|
|
42
42
|
/** Set the focus strategy. */
|
|
43
|
-
setFocusStrategy(strategy:
|
|
43
|
+
setFocusStrategy(strategy: "first" | "last" | null): void;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Creates state for a menu trigger (button that opens a menu).
|
|
47
47
|
* This is essentially the same as overlay trigger state but with focus strategy.
|
|
48
48
|
*/
|
|
49
|
-
export { createOverlayTriggerState as createMenuTriggerState } from
|
|
49
|
+
export { createOverlayTriggerState as createMenuTriggerState } from "../overlays";
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Selection state management for collections.
|
|
3
3
|
* Based on @react-stately/selection.
|
|
4
4
|
*/
|
|
5
|
-
import { type Accessor } from
|
|
6
|
-
import { type MaybeAccessor } from
|
|
7
|
-
import type { Collection, DisabledBehavior, Key, Selection, SelectionBehavior, SelectionMode } from
|
|
5
|
+
import { type Accessor } from "solid-js";
|
|
6
|
+
import { type MaybeAccessor } from "../utils";
|
|
7
|
+
import type { Collection, DisabledBehavior, Key, Selection, SelectionBehavior, SelectionMode } from "./types";
|
|
8
8
|
export interface SelectionStateProps {
|
|
9
9
|
/** The selection mode. */
|
|
10
10
|
selectionMode?: SelectionMode;
|
|
@@ -13,9 +13,9 @@ export interface SelectionStateProps {
|
|
|
13
13
|
/** Whether empty selection is disallowed. */
|
|
14
14
|
disallowEmptySelection?: boolean;
|
|
15
15
|
/** Currently selected keys (controlled). */
|
|
16
|
-
selectedKeys?:
|
|
16
|
+
selectedKeys?: "all" | Iterable<Key>;
|
|
17
17
|
/** Default selected keys (uncontrolled). */
|
|
18
|
-
defaultSelectedKeys?:
|
|
18
|
+
defaultSelectedKeys?: "all" | Iterable<Key>;
|
|
19
19
|
/** Handler for selection changes. */
|
|
20
20
|
onSelectionChange?: (keys: Selection) => void;
|
|
21
21
|
/** Keys of disabled items. */
|
|
@@ -63,11 +63,23 @@ export interface SelectionState {
|
|
|
63
63
|
/** Extend selection to a key (for shift-click). */
|
|
64
64
|
extendSelection(toKey: Key, collection: Collection): void;
|
|
65
65
|
/** Select a key based on interaction. */
|
|
66
|
-
select(key: Key, e?:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
select(key: Key, e?: SelectionPressEvent): void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The press/pointer interaction consulted by {@link SelectionState.select}.
|
|
70
|
+
* Mirrors react-stately's `SelectionManager.select(e)`: only `pointerType` is
|
|
71
|
+
* read here (touch / virtual force toggle, since those devices have no modifier
|
|
72
|
+
* keys). Modifier keys (ctrl / meta / shift) are resolved one layer up in the
|
|
73
|
+
* aria-layer `onSelect` (solidaria `selectItem`), matching upstream's split
|
|
74
|
+
* between react-stately and react-aria. The modifier fields are accepted so a
|
|
75
|
+
* full press/pointer event is assignable, but they are not read here.
|
|
76
|
+
*/
|
|
77
|
+
export interface SelectionPressEvent {
|
|
78
|
+
pointerType?: "mouse" | "pen" | "touch" | "keyboard" | "virtual";
|
|
79
|
+
shiftKey?: boolean;
|
|
80
|
+
ctrlKey?: boolean;
|
|
81
|
+
metaKey?: boolean;
|
|
82
|
+
altKey?: boolean;
|
|
71
83
|
}
|
|
72
84
|
/**
|
|
73
85
|
* Creates selection state for a collection.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for traversing collection nodes and comparing their document order.
|
|
3
|
+
*
|
|
4
|
+
* Based on @react-stately/collections.
|
|
5
|
+
*/
|
|
6
|
+
import type { Collection, CollectionNode } from "./types";
|
|
7
|
+
export declare function getChildNodes<T>(node: CollectionNode<T>, collection: Collection<T>): Iterable<CollectionNode<T>>;
|
|
8
|
+
export declare function getFirstItem<T>(iterable: Iterable<T>): T | undefined;
|
|
9
|
+
export declare function getNthItem<T>(iterable: Iterable<T>, index: number): T | undefined;
|
|
10
|
+
export declare function getLastItem<T>(iterable: Iterable<T>): T | undefined;
|
|
11
|
+
export declare function compareNodeOrder<T>(collection: Collection<T>, a: CollectionNode<T>, b: CollectionNode<T>): number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export type { Key, SelectionMode, SelectionBehavior, Selection, FocusStrategy, DisabledBehavior, CollectionNode, Collection, ItemProps, SectionProps, CollectionBase, SingleSelection, MultipleSelection, } from
|
|
2
|
-
export { ListCollection, createListCollection } from
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
export type { Key, SelectionMode, SelectionBehavior, Selection, FocusStrategy, DisabledBehavior, CollectionNode, Collection, ItemProps, SectionProps, CollectionBase, SingleSelection, MultipleSelection, } from "./types";
|
|
2
|
+
export { ListCollection, createListCollection } from "./ListCollection";
|
|
3
|
+
export { getChildNodes, getFirstItem, getNthItem, getLastItem, compareNodeOrder, } from "./getChildNodes";
|
|
4
|
+
export { createSelectionState, type SelectionStateProps, type SelectionState, type SelectionPressEvent, } from "./createSelectionState";
|
|
5
|
+
export { createListState, createSingleSelectListState, type ListStateProps, type ListState, type SingleSelectListStateProps, type SingleSelectListState, } from "./createListState";
|
|
6
|
+
export { createMenuState, createMenuTriggerState, type MenuStateProps, type MenuState, type MenuTriggerStateProps, type MenuTriggerState, } from "./createMenuState";
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
* Core types for collection state management.
|
|
3
3
|
* Simplified from @react-stately/collections for SolidJS.
|
|
4
4
|
*/
|
|
5
|
-
import type { JSX } from
|
|
5
|
+
import type { JSX } from "solid-js";
|
|
6
6
|
/** A unique identifier for an item in a collection. */
|
|
7
7
|
export type Key = string | number;
|
|
8
8
|
/** The type of selection allowed in a collection. */
|
|
9
|
-
export type SelectionMode =
|
|
9
|
+
export type SelectionMode = "none" | "single" | "multiple";
|
|
10
10
|
/** How selection behaves when clicking on items. */
|
|
11
|
-
export type SelectionBehavior =
|
|
11
|
+
export type SelectionBehavior = "toggle" | "replace";
|
|
12
12
|
/** Represents the current selection state. */
|
|
13
|
-
export type Selection =
|
|
13
|
+
export type Selection = "all" | Set<Key>;
|
|
14
14
|
/** Strategy for focusing first or last item. */
|
|
15
|
-
export type FocusStrategy =
|
|
15
|
+
export type FocusStrategy = "first" | "last";
|
|
16
16
|
/** Whether disabled keys affect selection, actions, or both. */
|
|
17
|
-
export type DisabledBehavior =
|
|
17
|
+
export type DisabledBehavior = "selection" | "all";
|
|
18
18
|
/**
|
|
19
19
|
* Represents a node in a collection (item or section).
|
|
20
20
|
*/
|
|
21
21
|
export interface CollectionNode<T = unknown> {
|
|
22
22
|
/** The type of node: 'item' or 'section'. */
|
|
23
|
-
type:
|
|
23
|
+
type: "item" | "section";
|
|
24
24
|
/** A unique key for the node. */
|
|
25
25
|
key: Key;
|
|
26
26
|
/** The original value/data for this node. */
|
|
@@ -42,7 +42,7 @@ export interface CollectionNode<T = unknown> {
|
|
|
42
42
|
/** Whether this item is disabled. */
|
|
43
43
|
isDisabled?: boolean;
|
|
44
44
|
/** ARIA label for this node. */
|
|
45
|
-
|
|
45
|
+
"aria-label"?: string;
|
|
46
46
|
/** Additional props for the node. */
|
|
47
47
|
props?: Record<string, unknown>;
|
|
48
48
|
}
|
|
@@ -95,7 +95,7 @@ export interface ItemProps<T = unknown> {
|
|
|
95
95
|
/** The rendered content of the item. */
|
|
96
96
|
children?: JSX.Element;
|
|
97
97
|
/** ARIA label for the item. */
|
|
98
|
-
|
|
98
|
+
"aria-label"?: string;
|
|
99
99
|
/** The original value for dynamic collections. */
|
|
100
100
|
value?: T;
|
|
101
101
|
}
|
|
@@ -108,7 +108,7 @@ export interface SectionProps<T = unknown> {
|
|
|
108
108
|
/** The section header/title. */
|
|
109
109
|
title?: JSX.Element;
|
|
110
110
|
/** ARIA label for the section. */
|
|
111
|
-
|
|
111
|
+
"aria-label"?: string;
|
|
112
112
|
/** The items in this section. */
|
|
113
113
|
children?: JSX.Element;
|
|
114
114
|
/** Items for dynamic rendering. */
|
|
@@ -147,9 +147,9 @@ export interface MultipleSelection {
|
|
|
147
147
|
/** Whether empty selection is allowed. */
|
|
148
148
|
disallowEmptySelection?: boolean;
|
|
149
149
|
/** The currently selected keys (controlled). */
|
|
150
|
-
selectedKeys?:
|
|
150
|
+
selectedKeys?: "all" | Iterable<Key>;
|
|
151
151
|
/** The default selected keys (uncontrolled). */
|
|
152
|
-
defaultSelectedKeys?:
|
|
152
|
+
defaultSelectedKeys?: "all" | Iterable<Key>;
|
|
153
153
|
/** Handler called when selection changes. */
|
|
154
154
|
onSelectionChange?: (keys: Selection) => void;
|
|
155
155
|
/** Keys of disabled items. */
|
package/dist/color/Color.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* ColorArea state management.
|
|
3
3
|
* Based on @react-stately/color useColorAreaState.
|
|
4
4
|
*/
|
|
5
|
-
import { type Accessor } from
|
|
6
|
-
import type { Color, ColorChannel } from
|
|
5
|
+
import { type Accessor } from "solid-js";
|
|
6
|
+
import type { Color, ColorChannel, ColorSpace } from "./types";
|
|
7
7
|
export interface ColorAreaStateOptions {
|
|
8
8
|
/** The current color value (controlled). */
|
|
9
9
|
value?: Color | string;
|
|
@@ -17,6 +17,8 @@ export interface ColorAreaStateOptions {
|
|
|
17
17
|
xChannel?: ColorChannel;
|
|
18
18
|
/** The color channel for the Y axis. */
|
|
19
19
|
yChannel?: ColorChannel;
|
|
20
|
+
/** The color space to use for the color area. */
|
|
21
|
+
colorSpace?: ColorSpace;
|
|
20
22
|
/** Whether the area is disabled. */
|
|
21
23
|
isDisabled?: boolean;
|
|
22
24
|
}
|