@proyecto-viviana/solid-stately 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3363 -25
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -7
- package/package.json +4 -3
- package/dist/autocomplete/createAutocompleteState.d.ts +0 -45
- package/dist/autocomplete/index.d.ts +0 -1
- package/dist/calendar/createCalendarState.d.ts +0 -129
- package/dist/calendar/createDateFieldState.d.ts +0 -109
- package/dist/calendar/createRangeCalendarState.d.ts +0 -145
- package/dist/calendar/createTimeFieldState.d.ts +0 -94
- package/dist/calendar/index.d.ts +0 -6
- package/dist/checkbox/createCheckboxGroupState.d.ts +0 -70
- package/dist/checkbox/index.d.ts +0 -1
- package/dist/collections/ListCollection.d.ts +0 -36
- package/dist/collections/createListState.d.ts +0 -78
- package/dist/collections/createMenuState.d.ts +0 -49
- package/dist/collections/createSelectionState.d.ts +0 -75
- package/dist/collections/index.d.ts +0 -5
- package/dist/collections/types.d.ts +0 -146
- package/dist/color/Color.d.ts +0 -27
- package/dist/color/createColorAreaState.d.ts +0 -75
- package/dist/color/createColorFieldState.d.ts +0 -54
- package/dist/color/createColorSliderState.d.ts +0 -66
- package/dist/color/createColorWheelState.d.ts +0 -50
- package/dist/color/index.d.ts +0 -9
- package/dist/color/types.d.ts +0 -105
- package/dist/combobox/createComboBoxState.d.ts +0 -124
- package/dist/combobox/index.d.ts +0 -4
- package/dist/disclosure/createDisclosureState.d.ts +0 -63
- package/dist/disclosure/index.d.ts +0 -1
- package/dist/dnd/createDragState.d.ts +0 -58
- package/dist/dnd/createDraggableCollectionState.d.ts +0 -56
- package/dist/dnd/createDropState.d.ts +0 -60
- package/dist/dnd/createDroppableCollectionState.d.ts +0 -77
- package/dist/dnd/index.d.ts +0 -10
- package/dist/dnd/types.d.ts +0 -263
- package/dist/form/createFormValidationState.d.ts +0 -99
- package/dist/form/index.d.ts +0 -1
- package/dist/grid/createGridState.d.ts +0 -11
- package/dist/grid/index.d.ts +0 -6
- package/dist/grid/types.d.ts +0 -155
- package/dist/numberfield/createNumberFieldState.d.ts +0 -64
- package/dist/numberfield/index.d.ts +0 -1
- package/dist/overlays/createOverlayTriggerState.d.ts +0 -31
- package/dist/overlays/index.d.ts +0 -1
- package/dist/radio/createRadioGroupState.d.ts +0 -76
- package/dist/radio/index.d.ts +0 -1
- package/dist/searchfield/createSearchFieldState.d.ts +0 -24
- package/dist/searchfield/index.d.ts +0 -2
- package/dist/select/createSelectState.d.ts +0 -72
- package/dist/select/index.d.ts +0 -1
- package/dist/slider/createSliderState.d.ts +0 -71
- package/dist/slider/index.d.ts +0 -2
- package/dist/ssr/index.d.ts +0 -27
- package/dist/table/TableCollection.d.ts +0 -51
- package/dist/table/createTableState.d.ts +0 -11
- package/dist/table/index.d.ts +0 -7
- package/dist/table/types.d.ts +0 -138
- package/dist/tabs/createTabListState.d.ts +0 -67
- package/dist/tabs/index.d.ts +0 -1
- package/dist/textfield/createTextFieldState.d.ts +0 -29
- package/dist/textfield/index.d.ts +0 -1
- package/dist/toast/createToastState.d.ts +0 -117
- package/dist/toast/index.d.ts +0 -1
- package/dist/toggle/createToggleState.d.ts +0 -33
- package/dist/toggle/index.d.ts +0 -1
- package/dist/tooltip/createTooltipTriggerState.d.ts +0 -38
- package/dist/tooltip/index.d.ts +0 -1
- package/dist/tree/TreeCollection.d.ts +0 -39
- package/dist/tree/createTreeState.d.ts +0 -13
- package/dist/tree/index.d.ts +0 -6
- package/dist/tree/types.d.ts +0 -156
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/reactivity.d.ts +0 -27
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Radio group state for Solid Stately
|
|
3
|
-
*
|
|
4
|
-
* Provides state management for a radio group component.
|
|
5
|
-
* Provides a name for the group, and manages selection and focus state.
|
|
6
|
-
*
|
|
7
|
-
* This is a 1:1 port of @react-stately/radio's useRadioGroupState.
|
|
8
|
-
*/
|
|
9
|
-
import { Accessor } from 'solid-js';
|
|
10
|
-
import { type MaybeAccessor } from '../utils';
|
|
11
|
-
export interface RadioGroupProps {
|
|
12
|
-
/** The current selected value (controlled). */
|
|
13
|
-
value?: string | null;
|
|
14
|
-
/** The default selected value (uncontrolled). */
|
|
15
|
-
defaultValue?: string | null;
|
|
16
|
-
/** Handler that is called when the value changes. */
|
|
17
|
-
onChange?: (value: string) => void;
|
|
18
|
-
/** Whether the radio group is disabled. */
|
|
19
|
-
isDisabled?: boolean;
|
|
20
|
-
/** Whether the radio group is read only. */
|
|
21
|
-
isReadOnly?: boolean;
|
|
22
|
-
/** Whether the radio group is required. */
|
|
23
|
-
isRequired?: boolean;
|
|
24
|
-
/** Whether the radio group is invalid. */
|
|
25
|
-
isInvalid?: boolean;
|
|
26
|
-
/** The name of the radio group, used when submitting an HTML form. */
|
|
27
|
-
name?: string;
|
|
28
|
-
/** The form to associate the radio group with. */
|
|
29
|
-
form?: string;
|
|
30
|
-
/** The label for the radio group. */
|
|
31
|
-
label?: string;
|
|
32
|
-
/** Orientation of the radio group. */
|
|
33
|
-
orientation?: 'horizontal' | 'vertical';
|
|
34
|
-
/** Handler that is called when the radio group receives focus. */
|
|
35
|
-
onFocus?: (e: FocusEvent) => void;
|
|
36
|
-
/** Handler that is called when the radio group loses focus. */
|
|
37
|
-
onBlur?: (e: FocusEvent) => void;
|
|
38
|
-
/** Handler that is called when the radio group's focus status changes. */
|
|
39
|
-
onFocusChange?: (isFocused: boolean) => void;
|
|
40
|
-
}
|
|
41
|
-
export interface RadioGroupState {
|
|
42
|
-
/** The name for the group, used for native form submission. */
|
|
43
|
-
readonly name: string;
|
|
44
|
-
/** Whether the radio group is disabled. */
|
|
45
|
-
readonly isDisabled: boolean;
|
|
46
|
-
/** Whether the radio group is read only. */
|
|
47
|
-
readonly isReadOnly: boolean;
|
|
48
|
-
/** Whether the radio group is required. */
|
|
49
|
-
readonly isRequired: boolean;
|
|
50
|
-
/** Whether the radio group is invalid. */
|
|
51
|
-
readonly isInvalid: boolean;
|
|
52
|
-
/** The currently selected value. */
|
|
53
|
-
readonly selectedValue: Accessor<string | null>;
|
|
54
|
-
/** The default selected value. */
|
|
55
|
-
readonly defaultSelectedValue: string | null;
|
|
56
|
-
/** Sets the selected value. */
|
|
57
|
-
setSelectedValue(value: string | null): void;
|
|
58
|
-
/** The value of the last focused radio. */
|
|
59
|
-
readonly lastFocusedValue: Accessor<string | null>;
|
|
60
|
-
/** Sets the last focused value. */
|
|
61
|
-
setLastFocusedValue(value: string | null): void;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Internal WeakMap to store sync version accessors for each radio group state.
|
|
65
|
-
* This is used by createRadio to trigger DOM sync when native radio behavior
|
|
66
|
-
* causes the DOM checked state to desync from our reactive state.
|
|
67
|
-
*
|
|
68
|
-
* This is kept separate from RadioGroupState to maintain API parity with React-Stately.
|
|
69
|
-
* @internal
|
|
70
|
-
*/
|
|
71
|
-
export declare const radioGroupSyncVersion: WeakMap<RadioGroupState, Accessor<number>>;
|
|
72
|
-
/**
|
|
73
|
-
* Provides state management for a radio group component.
|
|
74
|
-
* Provides a name for the group, and manages selection and focus state.
|
|
75
|
-
*/
|
|
76
|
-
export declare function createRadioGroupState(props?: MaybeAccessor<RadioGroupProps>): RadioGroupState;
|
package/dist/radio/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createRadioGroupState, radioGroupSyncVersion, type RadioGroupProps, type RadioGroupState, } from './createRadioGroupState';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates state for a search field component.
|
|
3
|
-
* Based on @react-stately/searchfield useSearchFieldState.
|
|
4
|
-
*/
|
|
5
|
-
import { type Accessor } from 'solid-js';
|
|
6
|
-
import { type MaybeAccessor } from '../utils';
|
|
7
|
-
export interface SearchFieldStateProps {
|
|
8
|
-
/** The current value (controlled). */
|
|
9
|
-
value?: string;
|
|
10
|
-
/** The default value (uncontrolled). */
|
|
11
|
-
defaultValue?: string;
|
|
12
|
-
/** Handler that is called when the value changes. */
|
|
13
|
-
onChange?: (value: string) => void;
|
|
14
|
-
}
|
|
15
|
-
export interface SearchFieldState {
|
|
16
|
-
/** The current value of the search field. */
|
|
17
|
-
value: Accessor<string>;
|
|
18
|
-
/** Sets the value of the search field. */
|
|
19
|
-
setValue: (value: string) => void;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Provides state management for a search field.
|
|
23
|
-
*/
|
|
24
|
-
export declare function createSearchFieldState(props: MaybeAccessor<SearchFieldStateProps>): SearchFieldState;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State management for select components.
|
|
3
|
-
* Based on @react-stately/select useSelectState.
|
|
4
|
-
*/
|
|
5
|
-
import { type Accessor } from 'solid-js';
|
|
6
|
-
import { type MaybeAccessor } from '../utils';
|
|
7
|
-
import type { Key, CollectionNode, Collection } from '../collections/types';
|
|
8
|
-
export interface SelectStateProps<T = unknown> {
|
|
9
|
-
/** The items to display in the select. */
|
|
10
|
-
items: T[];
|
|
11
|
-
/** Function to get the key for an item. */
|
|
12
|
-
getKey?: (item: T) => Key;
|
|
13
|
-
/** Function to get the text value for an item. */
|
|
14
|
-
getTextValue?: (item: T) => string;
|
|
15
|
-
/** Function to check if an item is disabled. */
|
|
16
|
-
getDisabled?: (item: T) => boolean;
|
|
17
|
-
/** Keys of disabled items. */
|
|
18
|
-
disabledKeys?: Iterable<Key>;
|
|
19
|
-
/** The currently selected key (controlled). */
|
|
20
|
-
selectedKey?: Key | null;
|
|
21
|
-
/** The default selected key (uncontrolled). */
|
|
22
|
-
defaultSelectedKey?: Key | null;
|
|
23
|
-
/** Handler called when the selection changes. */
|
|
24
|
-
onSelectionChange?: (key: Key | null) => void;
|
|
25
|
-
/** Whether the select is open (controlled). */
|
|
26
|
-
isOpen?: boolean;
|
|
27
|
-
/** Whether the select is open by default (uncontrolled). */
|
|
28
|
-
defaultOpen?: boolean;
|
|
29
|
-
/** Handler called when the open state changes. */
|
|
30
|
-
onOpenChange?: (isOpen: boolean) => void;
|
|
31
|
-
/** Whether the select is disabled. */
|
|
32
|
-
isDisabled?: boolean;
|
|
33
|
-
/** Whether the select is required. */
|
|
34
|
-
isRequired?: boolean;
|
|
35
|
-
}
|
|
36
|
-
export interface SelectState<T = unknown> {
|
|
37
|
-
/** The collection of items. */
|
|
38
|
-
readonly collection: Accessor<Collection<T>>;
|
|
39
|
-
/** Whether the select dropdown is open. */
|
|
40
|
-
readonly isOpen: Accessor<boolean>;
|
|
41
|
-
/** Open the select dropdown. */
|
|
42
|
-
open(): void;
|
|
43
|
-
/** Close the select dropdown. */
|
|
44
|
-
close(): void;
|
|
45
|
-
/** Toggle the select dropdown. */
|
|
46
|
-
toggle(): void;
|
|
47
|
-
/** The currently selected key. */
|
|
48
|
-
readonly selectedKey: Accessor<Key | null>;
|
|
49
|
-
/** The currently selected item. */
|
|
50
|
-
readonly selectedItem: Accessor<CollectionNode<T> | null>;
|
|
51
|
-
/** Set the selected key. */
|
|
52
|
-
setSelectedKey(key: Key | null): void;
|
|
53
|
-
/** The currently focused key. */
|
|
54
|
-
readonly focusedKey: Accessor<Key | null>;
|
|
55
|
-
/** Set the focused key. */
|
|
56
|
-
setFocusedKey(key: Key | null): void;
|
|
57
|
-
/** Whether the select has focus. */
|
|
58
|
-
readonly isFocused: Accessor<boolean>;
|
|
59
|
-
/** Set whether the select has focus. */
|
|
60
|
-
setFocused(isFocused: boolean): void;
|
|
61
|
-
/** Whether a specific key is disabled. */
|
|
62
|
-
isKeyDisabled(key: Key): boolean;
|
|
63
|
-
/** Whether the select is disabled. */
|
|
64
|
-
readonly isDisabled: boolean;
|
|
65
|
-
/** Whether the select is required. */
|
|
66
|
-
readonly isRequired: boolean;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Creates state for a select component.
|
|
70
|
-
* Combines list state with overlay trigger state for dropdown behavior.
|
|
71
|
-
*/
|
|
72
|
-
export declare function createSelectState<T = unknown>(props: MaybeAccessor<SelectStateProps<T>>): SelectState<T>;
|
package/dist/select/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createSelectState, type SelectStateProps, type SelectState, } from './createSelectState';
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates state for a slider component.
|
|
3
|
-
* Based on @react-stately/slider useSliderState.
|
|
4
|
-
*/
|
|
5
|
-
import { type Accessor } from 'solid-js';
|
|
6
|
-
import { type MaybeAccessor } from '../utils';
|
|
7
|
-
export type SliderOrientation = 'horizontal' | 'vertical';
|
|
8
|
-
export interface SliderStateProps {
|
|
9
|
-
/** The current value (controlled). */
|
|
10
|
-
value?: number;
|
|
11
|
-
/** The default value (uncontrolled). */
|
|
12
|
-
defaultValue?: number;
|
|
13
|
-
/** Handler called when the value changes. */
|
|
14
|
-
onChange?: (value: number) => void;
|
|
15
|
-
/** Handler called when the user stops dragging. */
|
|
16
|
-
onChangeEnd?: (value: number) => void;
|
|
17
|
-
/** The minimum value. */
|
|
18
|
-
minValue?: number;
|
|
19
|
-
/** The maximum value. */
|
|
20
|
-
maxValue?: number;
|
|
21
|
-
/** The step value. */
|
|
22
|
-
step?: number;
|
|
23
|
-
/** The orientation of the slider. */
|
|
24
|
-
orientation?: SliderOrientation;
|
|
25
|
-
/** Whether the slider is disabled. */
|
|
26
|
-
isDisabled?: boolean;
|
|
27
|
-
/** The locale for number formatting. */
|
|
28
|
-
locale?: string;
|
|
29
|
-
/** Number format options. */
|
|
30
|
-
formatOptions?: Intl.NumberFormatOptions;
|
|
31
|
-
}
|
|
32
|
-
export interface SliderState {
|
|
33
|
-
/** The current value. */
|
|
34
|
-
value: Accessor<number>;
|
|
35
|
-
/** Sets the value. */
|
|
36
|
-
setValue: (value: number) => void;
|
|
37
|
-
/** Sets the value by percent (0-1). */
|
|
38
|
-
setValuePercent: (percent: number) => void;
|
|
39
|
-
/** Gets the value as a percent (0-1). */
|
|
40
|
-
getValuePercent: Accessor<number>;
|
|
41
|
-
/** Gets the formatted value string. */
|
|
42
|
-
getFormattedValue: Accessor<string>;
|
|
43
|
-
/** Whether the thumb is being dragged. */
|
|
44
|
-
isDragging: Accessor<boolean>;
|
|
45
|
-
/** Sets the dragging state. */
|
|
46
|
-
setDragging: (dragging: boolean) => void;
|
|
47
|
-
/** Whether the slider is focused. */
|
|
48
|
-
isFocused: Accessor<boolean>;
|
|
49
|
-
/** Sets the focused state. */
|
|
50
|
-
setFocused: (focused: boolean) => void;
|
|
51
|
-
/** Increments the value by step. */
|
|
52
|
-
increment: (stepMultiplier?: number) => void;
|
|
53
|
-
/** Decrements the value by step. */
|
|
54
|
-
decrement: (stepMultiplier?: number) => void;
|
|
55
|
-
/** The minimum value. */
|
|
56
|
-
minValue: number;
|
|
57
|
-
/** The maximum value. */
|
|
58
|
-
maxValue: number;
|
|
59
|
-
/** The step value. */
|
|
60
|
-
step: number;
|
|
61
|
-
/** The page step (larger step for Page Up/Down). */
|
|
62
|
-
pageStep: number;
|
|
63
|
-
/** The orientation. */
|
|
64
|
-
orientation: SliderOrientation;
|
|
65
|
-
/** Whether the slider is disabled. */
|
|
66
|
-
isDisabled: boolean;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Provides state management for a slider component.
|
|
70
|
-
*/
|
|
71
|
-
export declare function createSliderState(props: MaybeAccessor<SliderStateProps>): SliderState;
|
package/dist/slider/index.d.ts
DELETED
package/dist/ssr/index.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SSR utilities for Solid Stately
|
|
3
|
-
*
|
|
4
|
-
* SolidJS has built-in SSR support with `isServer` and `createUniqueId()`.
|
|
5
|
-
* These utilities provide a consistent API matching React-Stately's patterns.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Re-export isServer from solid-js/web for convenience.
|
|
9
|
-
*/
|
|
10
|
-
export declare const isServer: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Returns whether the component is currently being server side rendered.
|
|
13
|
-
* Can be used to delay browser-specific rendering until after hydration.
|
|
14
|
-
*/
|
|
15
|
-
export declare function createIsSSR(): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Generate a unique ID that is stable across server and client.
|
|
18
|
-
* Uses SolidJS's built-in createUniqueId which handles SSR correctly.
|
|
19
|
-
*
|
|
20
|
-
* @param defaultId - Optional default ID to use instead of generating one.
|
|
21
|
-
*/
|
|
22
|
-
export declare function createId(defaultId?: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* Check if we can use DOM APIs.
|
|
25
|
-
* This is useful for code that needs to run only in the browser.
|
|
26
|
-
*/
|
|
27
|
-
export declare const canUseDOM: boolean;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TableCollection - A collection class for table data.
|
|
3
|
-
* Based on @react-stately/table/TableCollection.
|
|
4
|
-
*/
|
|
5
|
-
import type { Key } from '../collections/types';
|
|
6
|
-
import type { GridNode } from '../grid/types';
|
|
7
|
-
import type { TableCollection as ITableCollection, TableCollectionOptions } from './types';
|
|
8
|
-
/**
|
|
9
|
-
* Creates a table collection from column and row definitions.
|
|
10
|
-
*/
|
|
11
|
-
export declare class TableCollection<T = unknown> implements ITableCollection<T> {
|
|
12
|
-
private _columns;
|
|
13
|
-
private _rows;
|
|
14
|
-
private _headerRows;
|
|
15
|
-
private _body;
|
|
16
|
-
private _head;
|
|
17
|
-
private _keyMap;
|
|
18
|
-
private _rowHeaderColumnKeys;
|
|
19
|
-
private _size;
|
|
20
|
-
constructor(options: TableCollectionOptions<T>);
|
|
21
|
-
private buildColumns;
|
|
22
|
-
private buildColumnNode;
|
|
23
|
-
private getDefaultRowHeaderColumnKeys;
|
|
24
|
-
private buildHeaderRows;
|
|
25
|
-
private buildRows;
|
|
26
|
-
private isRowDefinition;
|
|
27
|
-
get size(): number;
|
|
28
|
-
get rows(): GridNode<T>[];
|
|
29
|
-
get columns(): GridNode<T>[];
|
|
30
|
-
get headerRows(): GridNode<T>[];
|
|
31
|
-
get head(): GridNode<T> | undefined;
|
|
32
|
-
get body(): GridNode<T>;
|
|
33
|
-
get rowCount(): number;
|
|
34
|
-
get columnCount(): number;
|
|
35
|
-
get rowHeaderColumnKeys(): Set<Key>;
|
|
36
|
-
getKeys(): Iterable<Key>;
|
|
37
|
-
getItem(key: Key): GridNode<T> | null;
|
|
38
|
-
at(index: number): GridNode<T> | null;
|
|
39
|
-
getChildren(key: Key): Iterable<GridNode<T>>;
|
|
40
|
-
getTextValue(key: Key): string;
|
|
41
|
-
getCell(rowKey: Key, columnKey: Key): GridNode<T> | null;
|
|
42
|
-
getFirstKey(): Key | null;
|
|
43
|
-
getLastKey(): Key | null;
|
|
44
|
-
getKeyBefore(key: Key): Key | null;
|
|
45
|
-
getKeyAfter(key: Key): Key | null;
|
|
46
|
-
[Symbol.iterator](): Iterator<GridNode<T>>;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Creates a table collection from options.
|
|
50
|
-
*/
|
|
51
|
-
export declare function createTableCollection<T>(options: TableCollectionOptions<T>): TableCollection<T>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Table state management for Table components.
|
|
3
|
-
* Based on @react-stately/table/useTableState.
|
|
4
|
-
*/
|
|
5
|
-
import { type Accessor } from 'solid-js';
|
|
6
|
-
import type { TableState, TableStateOptions, TableCollection } from './types';
|
|
7
|
-
/**
|
|
8
|
-
* Creates state management for a table component.
|
|
9
|
-
* Extends grid state with sorting and table-specific features.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createTableState<T extends object, C extends TableCollection<T> = TableCollection<T>>(options: Accessor<TableStateOptions<T, C>>): TableState<T, C>;
|
package/dist/table/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Table state management module.
|
|
3
|
-
* Provides state hooks for Table components.
|
|
4
|
-
*/
|
|
5
|
-
export { createTableState } from './createTableState';
|
|
6
|
-
export { TableCollection, createTableCollection } from './TableCollection';
|
|
7
|
-
export type { TableState, TableStateOptions, TableCollection as ITableCollection, SortDescriptor, SortDirection, Sortable, ColumnDefinition, RowDefinition, TableCollectionOptions, } from './types';
|
package/dist/table/types.d.ts
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Table state types for Table components.
|
|
3
|
-
* Based on @react-stately/table and @react-types/table.
|
|
4
|
-
*/
|
|
5
|
-
import type { Key } from '../collections/types';
|
|
6
|
-
import type { GridState, GridCollection, GridNode } from '../grid/types';
|
|
7
|
-
/**
|
|
8
|
-
* Sort direction for table columns.
|
|
9
|
-
*/
|
|
10
|
-
export type SortDirection = 'ascending' | 'descending';
|
|
11
|
-
/**
|
|
12
|
-
* Describes which column to sort by and in what direction.
|
|
13
|
-
*/
|
|
14
|
-
export interface SortDescriptor {
|
|
15
|
-
/** The key of the column to sort by. */
|
|
16
|
-
column: Key;
|
|
17
|
-
/** The direction to sort by. */
|
|
18
|
-
direction: SortDirection;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Interface for sortable components.
|
|
22
|
-
*/
|
|
23
|
-
export interface Sortable {
|
|
24
|
-
/** The current sorted column and direction. */
|
|
25
|
-
sortDescriptor?: SortDescriptor;
|
|
26
|
-
/** Handler that is called when the sorted column or direction changes. */
|
|
27
|
-
onSortChange?: (descriptor: SortDescriptor) => void;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* A collection of table rows and columns.
|
|
31
|
-
* Extends GridCollection with table-specific metadata.
|
|
32
|
-
*/
|
|
33
|
-
export interface TableCollection<T = unknown> extends GridCollection<T> {
|
|
34
|
-
/** A list of header row nodes in the table. */
|
|
35
|
-
readonly headerRows: GridNode<T>[];
|
|
36
|
-
/** A list of column nodes in the table. */
|
|
37
|
-
readonly columns: GridNode<T>[];
|
|
38
|
-
/** A set of column keys that serve as the row header. */
|
|
39
|
-
readonly rowHeaderColumnKeys: Set<Key>;
|
|
40
|
-
/** The node that makes up the header of the table. */
|
|
41
|
-
readonly head?: GridNode<T>;
|
|
42
|
-
/** The node that makes up the body of the table. */
|
|
43
|
-
readonly body: GridNode<T>;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* State for a table component.
|
|
47
|
-
* Extends GridState with table-specific functionality.
|
|
48
|
-
*/
|
|
49
|
-
export interface TableState<T, C extends TableCollection<T> = TableCollection<T>> extends Omit<GridState<T, GridCollection<T>>, 'collection'> {
|
|
50
|
-
/** The table collection. */
|
|
51
|
-
readonly collection: C;
|
|
52
|
-
/** Whether the row selection checkboxes should be displayed. */
|
|
53
|
-
readonly showSelectionCheckboxes: boolean;
|
|
54
|
-
/** The current sorted column and direction. */
|
|
55
|
-
readonly sortDescriptor: SortDescriptor | null;
|
|
56
|
-
/** Sort by the given column and direction. */
|
|
57
|
-
sort(columnKey: Key, direction?: SortDirection): void;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Options for creating table state.
|
|
61
|
-
*/
|
|
62
|
-
export interface TableStateOptions<T, C extends TableCollection<T> = TableCollection<T>> extends Sortable {
|
|
63
|
-
/** The table collection. */
|
|
64
|
-
collection: C;
|
|
65
|
-
/** Keys of disabled rows. */
|
|
66
|
-
disabledKeys?: Iterable<Key>;
|
|
67
|
-
/** Focus mode: 'row' or 'cell'. */
|
|
68
|
-
focusMode?: 'row' | 'cell';
|
|
69
|
-
/** Selection mode. */
|
|
70
|
-
selectionMode?: 'none' | 'single' | 'multiple';
|
|
71
|
-
/** Selection behavior. */
|
|
72
|
-
selectionBehavior?: 'toggle' | 'replace';
|
|
73
|
-
/** Whether empty selection is disallowed. */
|
|
74
|
-
disallowEmptySelection?: boolean;
|
|
75
|
-
/** Currently selected keys (controlled). */
|
|
76
|
-
selectedKeys?: 'all' | Iterable<Key>;
|
|
77
|
-
/** Default selected keys (uncontrolled). */
|
|
78
|
-
defaultSelectedKeys?: 'all' | Iterable<Key>;
|
|
79
|
-
/** Handler for selection changes. */
|
|
80
|
-
onSelectionChange?: (keys: 'all' | Set<Key>) => void;
|
|
81
|
-
/** Whether the row selection checkboxes should be displayed. */
|
|
82
|
-
showSelectionCheckboxes?: boolean;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Column definition for building table collections.
|
|
86
|
-
*/
|
|
87
|
-
export interface ColumnDefinition<T = unknown> {
|
|
88
|
-
/** The key for the column. */
|
|
89
|
-
key: Key;
|
|
90
|
-
/** The display name or rendered content. */
|
|
91
|
-
name?: string;
|
|
92
|
-
/** Text value for accessibility. */
|
|
93
|
-
textValue?: string;
|
|
94
|
-
/** Whether this column is a row header. */
|
|
95
|
-
isRowHeader?: boolean;
|
|
96
|
-
/** Whether this column allows sorting. */
|
|
97
|
-
allowsSorting?: boolean;
|
|
98
|
-
/** Child columns (for column groups). */
|
|
99
|
-
children?: ColumnDefinition<T>[];
|
|
100
|
-
/** Width of the column. */
|
|
101
|
-
width?: number | string;
|
|
102
|
-
/** Minimum width of the column. */
|
|
103
|
-
minWidth?: number;
|
|
104
|
-
/** Maximum width of the column. */
|
|
105
|
-
maxWidth?: number;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Row definition for building table collections.
|
|
109
|
-
*/
|
|
110
|
-
export interface RowDefinition<T = unknown> {
|
|
111
|
-
/** The key for the row. */
|
|
112
|
-
key: Key;
|
|
113
|
-
/** The data value for the row. */
|
|
114
|
-
value: T;
|
|
115
|
-
/** Text value for accessibility/search. */
|
|
116
|
-
textValue?: string;
|
|
117
|
-
/** Whether this row has child rows (for tree tables). */
|
|
118
|
-
hasChildRows?: boolean;
|
|
119
|
-
/** Child rows (for tree tables). */
|
|
120
|
-
childRows?: RowDefinition<T>[];
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Options for building a table collection.
|
|
124
|
-
*/
|
|
125
|
-
export interface TableCollectionOptions<T = unknown> {
|
|
126
|
-
/** Column definitions. */
|
|
127
|
-
columns: ColumnDefinition<T>[];
|
|
128
|
-
/** Row definitions or data items. */
|
|
129
|
-
rows: RowDefinition<T>[] | T[];
|
|
130
|
-
/** Function to get the key from a data item. */
|
|
131
|
-
getKey?: (item: T) => Key;
|
|
132
|
-
/** Function to get the text value from a data item. */
|
|
133
|
-
getTextValue?: (item: T, column: ColumnDefinition<T>) => string;
|
|
134
|
-
/** Whether to show selection checkboxes. */
|
|
135
|
-
showSelectionCheckboxes?: boolean;
|
|
136
|
-
/** Set of column keys that serve as row headers. */
|
|
137
|
-
rowHeaderColumnKeys?: Set<Key>;
|
|
138
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State management for tab components.
|
|
3
|
-
* Based on @react-stately/tabs.
|
|
4
|
-
*/
|
|
5
|
-
import { type Accessor } from 'solid-js';
|
|
6
|
-
import { type MaybeAccessor } from '../utils';
|
|
7
|
-
import type { Collection, CollectionNode, Key, FocusStrategy } from '../collections/types';
|
|
8
|
-
export type KeyboardActivation = 'automatic' | 'manual';
|
|
9
|
-
export type TabOrientation = 'horizontal' | 'vertical';
|
|
10
|
-
export interface TabListStateProps<T = unknown> {
|
|
11
|
-
/** The items in the tab list. */
|
|
12
|
-
items?: T[];
|
|
13
|
-
/** Function to get a key from an item. */
|
|
14
|
-
getKey?: (item: T) => Key;
|
|
15
|
-
/** Function to get text value from an item. */
|
|
16
|
-
getTextValue?: (item: T) => string;
|
|
17
|
-
/** Function to check if an item is disabled. */
|
|
18
|
-
getDisabled?: (item: T) => boolean;
|
|
19
|
-
/** Keys of disabled tabs. */
|
|
20
|
-
disabledKeys?: Iterable<Key>;
|
|
21
|
-
/** The currently selected tab key (controlled). */
|
|
22
|
-
selectedKey?: Key | null;
|
|
23
|
-
/** The default selected tab key (uncontrolled). */
|
|
24
|
-
defaultSelectedKey?: Key;
|
|
25
|
-
/** Handler for tab selection changes. */
|
|
26
|
-
onSelectionChange?: (key: Key) => void;
|
|
27
|
-
/** Whether the entire tab list is disabled. */
|
|
28
|
-
isDisabled?: boolean;
|
|
29
|
-
/** Whether tabs are activated automatically on focus or manually. */
|
|
30
|
-
keyboardActivation?: KeyboardActivation;
|
|
31
|
-
/** The orientation of the tab list. */
|
|
32
|
-
orientation?: TabOrientation;
|
|
33
|
-
}
|
|
34
|
-
export interface TabListState<T = unknown> {
|
|
35
|
-
/** The collection of tabs. */
|
|
36
|
-
readonly collection: Accessor<Collection<T>>;
|
|
37
|
-
/** The currently selected tab key. */
|
|
38
|
-
readonly selectedKey: Accessor<Key | null>;
|
|
39
|
-
/** Set the selected tab key. */
|
|
40
|
-
setSelectedKey(key: Key): void;
|
|
41
|
-
/** The currently selected tab item. */
|
|
42
|
-
readonly selectedItem: Accessor<CollectionNode<T> | null>;
|
|
43
|
-
/** Whether the tab list is disabled. */
|
|
44
|
-
readonly isDisabled: Accessor<boolean>;
|
|
45
|
-
/** The keyboard activation mode. */
|
|
46
|
-
readonly keyboardActivation: Accessor<KeyboardActivation>;
|
|
47
|
-
/** The orientation of the tab list. */
|
|
48
|
-
readonly orientation: Accessor<TabOrientation>;
|
|
49
|
-
/** Whether a tab key is disabled. */
|
|
50
|
-
isKeyDisabled(key: Key): boolean;
|
|
51
|
-
/** The set of disabled keys. */
|
|
52
|
-
readonly disabledKeys: Accessor<Set<Key>>;
|
|
53
|
-
/** Whether the collection is focused. */
|
|
54
|
-
readonly isFocused: Accessor<boolean>;
|
|
55
|
-
/** Set the focused state. */
|
|
56
|
-
setFocused(isFocused: boolean): void;
|
|
57
|
-
/** The currently focused tab key. */
|
|
58
|
-
readonly focusedKey: Accessor<Key | null>;
|
|
59
|
-
/** Set the focused tab key. */
|
|
60
|
-
setFocusedKey(key: Key | null, childStrategy?: FocusStrategy): void;
|
|
61
|
-
/** The child focus strategy. */
|
|
62
|
-
readonly childFocusStrategy: Accessor<FocusStrategy | null>;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Creates state for a tab list component.
|
|
66
|
-
*/
|
|
67
|
-
export declare function createTabListState<T = unknown>(props: MaybeAccessor<TabListStateProps<T>>): TabListState<T>;
|
package/dist/tabs/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createTabListState, type TabListStateProps, type TabListState, type KeyboardActivation, type TabOrientation, } from './createTabListState';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TextField state for Solid Stately
|
|
3
|
-
*
|
|
4
|
-
* Provides state management for text input components.
|
|
5
|
-
*
|
|
6
|
-
* This is a port of @react-stately/utils's useControlledState pattern
|
|
7
|
-
* as used by @react-aria/textfield.
|
|
8
|
-
*/
|
|
9
|
-
import { Accessor } from 'solid-js';
|
|
10
|
-
import { type MaybeAccessor } from '../utils';
|
|
11
|
-
export interface TextFieldStateOptions {
|
|
12
|
-
/** The current value (controlled). */
|
|
13
|
-
value?: string;
|
|
14
|
-
/** The default value (uncontrolled). */
|
|
15
|
-
defaultValue?: string;
|
|
16
|
-
/** Handler that is called when the value changes. */
|
|
17
|
-
onChange?: (value: string) => void;
|
|
18
|
-
}
|
|
19
|
-
export interface TextFieldState {
|
|
20
|
-
/** The current value of the text field. */
|
|
21
|
-
readonly value: Accessor<string>;
|
|
22
|
-
/** Sets the value of the text field. */
|
|
23
|
-
setValue(value: string): void;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Provides state management for text input components.
|
|
27
|
-
* Supports both controlled and uncontrolled modes.
|
|
28
|
-
*/
|
|
29
|
-
export declare function createTextFieldState(props?: MaybeAccessor<TextFieldStateOptions>): TextFieldState;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createTextFieldState, type TextFieldStateOptions, type TextFieldState, } from './createTextFieldState';
|