@necto-react/types 2.0.0 → 2.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/dist/index.d.mts +264 -17
- package/dist/index.d.ts +264 -17
- package/dist/index.js +1 -1
- package/package.json +12 -5
- package/.turbo/turbo-build.log +0 -20
- package/CHANGELOG.md +0 -7
- package/LICENSE +0 -21
- package/jsr.json +0 -18
- package/src/dom.ts +0 -30
- package/src/events.ts +0 -13
- package/src/index.ts +0 -10
- package/tsconfig.json +0 -24
- package/tsup.config.ts +0 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties } from 'react';
|
|
1
|
+
import { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties, HTMLAttributeAnchorTarget, HTMLAttributeReferrerPolicy, ReactNode, SyntheticEvent, FocusEvent, ForwardedRef } from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
@@ -8,19 +8,108 @@ import { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperti
|
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Props for DOM elements that may require an id.
|
|
15
|
+
*/
|
|
16
|
+
interface DOMProps {
|
|
17
|
+
/** The unique id for the DOM element. */
|
|
18
|
+
id?: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Props for focusable DOM elements, extending basic DOM props.
|
|
23
|
+
*/
|
|
24
|
+
interface FocusableDOMProps extends DOMProps {
|
|
25
|
+
/**
|
|
26
|
+
* Whether the element should be excluded from the tab order.
|
|
27
|
+
*/
|
|
28
|
+
excludeFromTabOrder?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Standard DOM attributes for focusable elements, including ARIA and React DOM attributes.
|
|
33
|
+
*
|
|
34
|
+
* @template T The element type, defaults to FocusableElement.
|
|
35
|
+
*/
|
|
36
|
+
interface DOMAttributes<T = FocusableElement>
|
|
37
|
+
extends AriaAttributes,
|
|
38
|
+
DOMAttributes$1<T> {
|
|
39
|
+
/** The unique id for the DOM element. */
|
|
40
|
+
id?: string | undefined;
|
|
41
|
+
|
|
42
|
+
/** The ARIA role for the element. */
|
|
43
|
+
role?: AriaRole | undefined;
|
|
44
|
+
|
|
45
|
+
/** The tab index of the element. */
|
|
46
|
+
tabIndex?: number | undefined;
|
|
47
|
+
|
|
48
|
+
/** Inline CSS styles for the element. */
|
|
49
|
+
style?: CSSProperties | undefined;
|
|
50
|
+
|
|
51
|
+
/** The CSS class name for the element. */
|
|
52
|
+
className?: string | undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Props for anchor/link elements.
|
|
57
|
+
*/
|
|
58
|
+
interface LinkDOMProps {
|
|
59
|
+
/** The URL to link to. */
|
|
60
|
+
href?: string | undefined;
|
|
61
|
+
|
|
62
|
+
/** The language of the linked resource. */
|
|
63
|
+
hrefLang?: string;
|
|
64
|
+
|
|
65
|
+
/** The browsing context for the link. */
|
|
66
|
+
target?: HTMLAttributeAnchorTarget;
|
|
67
|
+
|
|
68
|
+
/** The relationship of the linked resource. */
|
|
69
|
+
rel?: string;
|
|
70
|
+
|
|
71
|
+
/** Prompts the user to save the linked URL instead of navigating to it. */
|
|
72
|
+
download?: boolean | string;
|
|
73
|
+
|
|
74
|
+
/** Space-separated list of URLs to notify when the user follows the hyperlink. */
|
|
75
|
+
ping?: string;
|
|
76
|
+
|
|
77
|
+
/** Referrer policy for the link. */
|
|
78
|
+
referrerPolicy?: HTMLAttributeReferrerPolicy;
|
|
79
|
+
|
|
80
|
+
/** Additional router options (type depends on router implementation). */
|
|
81
|
+
routerOptions?: unknown;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
86
|
+
*
|
|
87
|
+
* This source code is licensed under the MIT license found in the
|
|
88
|
+
* LICENSE file in the root directory of this source tree.
|
|
89
|
+
*
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
interface StyleRenderProps<T> {
|
|
95
|
+
/** The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. */
|
|
96
|
+
className?:
|
|
97
|
+
| string
|
|
98
|
+
| ((values: T & { defaultClassName: string | undefined }) => string);
|
|
99
|
+
|
|
100
|
+
/** The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. A function may be provided to compute the style based on component state. */
|
|
101
|
+
style?:
|
|
102
|
+
| CSSProperties
|
|
103
|
+
| ((
|
|
104
|
+
values: T & { defaultStyle: CSSProperties }
|
|
105
|
+
) => CSSProperties | undefined);
|
|
12
106
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
id?: string | undefined;
|
|
20
|
-
role?: AriaRole | undefined;
|
|
21
|
-
tabIndex?: number | undefined;
|
|
22
|
-
style?: CSSProperties | undefined;
|
|
23
|
-
className?: string | undefined;
|
|
107
|
+
|
|
108
|
+
interface RenderProps<T> extends StyleRenderProps<T> {
|
|
109
|
+
/** The children of the component. A function may be provided to alter the children based on component state. */
|
|
110
|
+
children?:
|
|
111
|
+
| ReactNode
|
|
112
|
+
| ((values: T | { defaultChildren: ReactNode | undefined }) => ReactNode);
|
|
24
113
|
}
|
|
25
114
|
|
|
26
115
|
/**
|
|
@@ -30,10 +119,168 @@ interface DOMAttributes<T = FocusableElement> extends AriaAttributes, DOMAttribu
|
|
|
30
119
|
* LICENSE file in the root directory of this source tree.
|
|
31
120
|
*
|
|
32
121
|
*/
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Flags indicating disabled states for different interaction types.
|
|
125
|
+
*/
|
|
126
|
+
type DisabledFlags = {
|
|
127
|
+
/** Whether the element is generally disabled. */
|
|
128
|
+
general?: boolean;
|
|
129
|
+
|
|
130
|
+
/** Whether the element is disabled for form interactions. */
|
|
131
|
+
form?: boolean;
|
|
132
|
+
|
|
133
|
+
/** Whether the element is disabled for user interactions (e.g., pointer, keyboard). */
|
|
134
|
+
interactions?: boolean;
|
|
135
|
+
|
|
136
|
+
/** Custom disabled flags for additional types of interactions. */
|
|
137
|
+
[key: string]: boolean | undefined;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
142
|
+
*
|
|
143
|
+
* This source code is licensed under the MIT license found in the
|
|
144
|
+
* LICENSE file in the root directory of this source tree.
|
|
145
|
+
*
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Extended SyntheticEvent with custom propagation control methods.
|
|
152
|
+
*
|
|
153
|
+
* @template T The type of the original SyntheticEvent.
|
|
154
|
+
*/
|
|
155
|
+
type BaseEvent<T extends SyntheticEvent> = T & {
|
|
156
|
+
/**
|
|
157
|
+
* Use continuePropagation instead.
|
|
158
|
+
* @deprecated
|
|
159
|
+
*/
|
|
160
|
+
stopPropagation(): void;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Continues propagation for the event.
|
|
164
|
+
*/
|
|
165
|
+
continuePropagation(): void;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Event handlers for hover interactions.
|
|
170
|
+
*/
|
|
33
171
|
interface HoverEvent {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
172
|
+
/** Called when a hover interaction starts. */
|
|
173
|
+
onHoverStart?: (event: HoverEvent) => void;
|
|
174
|
+
|
|
175
|
+
/** Called when a hover interaction ends. */
|
|
176
|
+
onHoverEnd?: (event: HoverEvent) => void;
|
|
177
|
+
|
|
178
|
+
/** Called when the hover state changes. */
|
|
179
|
+
onHoverChange?: (isHovering: boolean) => void;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Event handlers for focus interactions.
|
|
184
|
+
*/
|
|
185
|
+
interface FocusEvents<Target = Element> {
|
|
186
|
+
/** Called when the element receives focus. */
|
|
187
|
+
onFocus?: (e: FocusEvent<Target>) => void;
|
|
188
|
+
|
|
189
|
+
/** Called when the element loses focus. */
|
|
190
|
+
onBlur?: (e: FocusEvent<Target>) => void;
|
|
191
|
+
|
|
192
|
+
/** Called when the focus state changes. */
|
|
193
|
+
onFocusChange?: (isFocused: boolean) => void;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Event handlers for keyboard interactions.
|
|
198
|
+
*/
|
|
199
|
+
interface KeyboardEvents {
|
|
200
|
+
/** Called when a key is pressed down. */
|
|
201
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
|
202
|
+
|
|
203
|
+
/** Called when a key is released. */
|
|
204
|
+
onKeyUp?: (e: KeyboardEvent) => void;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
209
|
+
*
|
|
210
|
+
* This source code is licensed under the MIT license found in the
|
|
211
|
+
* LICENSE file in the root directory of this source tree.
|
|
212
|
+
*
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
type SlottedContextValue<T, E = never> =
|
|
218
|
+
| (T & {
|
|
219
|
+
slots?: Record<string | symbol, T>;
|
|
220
|
+
ref?: E extends never ? never : ForwardedRef<E>;
|
|
221
|
+
})
|
|
222
|
+
| null
|
|
223
|
+
| undefined;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
227
|
+
*
|
|
228
|
+
* This source code is licensed under the MIT license found in the
|
|
229
|
+
* LICENSE file in the root directory of this source tree.
|
|
230
|
+
*
|
|
231
|
+
*/
|
|
232
|
+
|
|
233
|
+
/** Selection mode for a collection. */
|
|
234
|
+
type SelectionMode = 'none' | 'single' | 'multiple';
|
|
235
|
+
|
|
236
|
+
/** Focus strategy when auto-focusing. */
|
|
237
|
+
type FocusStrategy = 'first' | 'last';
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Interface for managing selection state in a collection.
|
|
241
|
+
*/
|
|
242
|
+
interface SelectionManager {
|
|
243
|
+
/** The currently focused key. */
|
|
244
|
+
readonly focusedKey: (string | number) | null;
|
|
245
|
+
/** Set the focused key. */
|
|
246
|
+
setFocusedKey(
|
|
247
|
+
key: (string | number) | null,
|
|
248
|
+
childFocus?: FocusStrategy
|
|
249
|
+
): void;
|
|
250
|
+
/** Whether the collection is focused. */
|
|
251
|
+
readonly isFocused: boolean;
|
|
252
|
+
/** Set whether the collection is focused. */
|
|
253
|
+
setFocused(isFocused: boolean): void;
|
|
254
|
+
/** The set of selected keys. */
|
|
255
|
+
readonly selectedKeys: Set<string | number>;
|
|
256
|
+
/** The selection mode. */
|
|
257
|
+
readonly selectionMode: SelectionMode;
|
|
258
|
+
/** Replace selection with a single key. */
|
|
259
|
+
replaceSelection(key: string | number): void;
|
|
260
|
+
/** Extend selection to include a key. */
|
|
261
|
+
extendSelection(key: string | number): void;
|
|
262
|
+
/** Toggle selection of a key. */
|
|
263
|
+
toggleSelection(key: string | number): void;
|
|
264
|
+
/** Select all items. */
|
|
265
|
+
selectAll(): void;
|
|
266
|
+
/** Clear all selection. */
|
|
267
|
+
clearSelection(): void;
|
|
268
|
+
/** Check if a key is selected. */
|
|
269
|
+
isSelected(key: string | number): boolean;
|
|
270
|
+
/** Check if a key is disabled. */
|
|
271
|
+
isDisabled?(key: string | number): boolean;
|
|
272
|
+
/** Check if a key is a link. */
|
|
273
|
+
isLink?(key: string | number): boolean;
|
|
274
|
+
/** Get props for an item. */
|
|
275
|
+
getItemProps?(
|
|
276
|
+
key: string | number
|
|
277
|
+
): { href?: string; routerOptions?: unknown } | undefined;
|
|
278
|
+
/** Whether the user can select an item. */
|
|
279
|
+
canSelectItem?(key: string | number): boolean;
|
|
280
|
+
/** The first selected key. */
|
|
281
|
+
readonly firstSelectedKey?: (string | number) | null;
|
|
282
|
+
/** The last selected key. */
|
|
283
|
+
readonly lastSelectedKey?: (string | number) | null;
|
|
37
284
|
}
|
|
38
285
|
|
|
39
|
-
export type { DOMAttributes,
|
|
286
|
+
export type { BaseEvent, DOMAttributes, DOMProps, DisabledFlags, FocusEvents, FocusStrategy, FocusableDOMProps, HoverEvent, KeyboardEvents, LinkDOMProps, RenderProps, SelectionManager, SelectionMode, SlottedContextValue, StyleRenderProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties } from 'react';
|
|
1
|
+
import { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties, HTMLAttributeAnchorTarget, HTMLAttributeReferrerPolicy, ReactNode, SyntheticEvent, FocusEvent, ForwardedRef } from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
@@ -8,19 +8,108 @@ import { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperti
|
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Props for DOM elements that may require an id.
|
|
15
|
+
*/
|
|
16
|
+
interface DOMProps {
|
|
17
|
+
/** The unique id for the DOM element. */
|
|
18
|
+
id?: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Props for focusable DOM elements, extending basic DOM props.
|
|
23
|
+
*/
|
|
24
|
+
interface FocusableDOMProps extends DOMProps {
|
|
25
|
+
/**
|
|
26
|
+
* Whether the element should be excluded from the tab order.
|
|
27
|
+
*/
|
|
28
|
+
excludeFromTabOrder?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Standard DOM attributes for focusable elements, including ARIA and React DOM attributes.
|
|
33
|
+
*
|
|
34
|
+
* @template T The element type, defaults to FocusableElement.
|
|
35
|
+
*/
|
|
36
|
+
interface DOMAttributes<T = FocusableElement>
|
|
37
|
+
extends AriaAttributes,
|
|
38
|
+
DOMAttributes$1<T> {
|
|
39
|
+
/** The unique id for the DOM element. */
|
|
40
|
+
id?: string | undefined;
|
|
41
|
+
|
|
42
|
+
/** The ARIA role for the element. */
|
|
43
|
+
role?: AriaRole | undefined;
|
|
44
|
+
|
|
45
|
+
/** The tab index of the element. */
|
|
46
|
+
tabIndex?: number | undefined;
|
|
47
|
+
|
|
48
|
+
/** Inline CSS styles for the element. */
|
|
49
|
+
style?: CSSProperties | undefined;
|
|
50
|
+
|
|
51
|
+
/** The CSS class name for the element. */
|
|
52
|
+
className?: string | undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Props for anchor/link elements.
|
|
57
|
+
*/
|
|
58
|
+
interface LinkDOMProps {
|
|
59
|
+
/** The URL to link to. */
|
|
60
|
+
href?: string | undefined;
|
|
61
|
+
|
|
62
|
+
/** The language of the linked resource. */
|
|
63
|
+
hrefLang?: string;
|
|
64
|
+
|
|
65
|
+
/** The browsing context for the link. */
|
|
66
|
+
target?: HTMLAttributeAnchorTarget;
|
|
67
|
+
|
|
68
|
+
/** The relationship of the linked resource. */
|
|
69
|
+
rel?: string;
|
|
70
|
+
|
|
71
|
+
/** Prompts the user to save the linked URL instead of navigating to it. */
|
|
72
|
+
download?: boolean | string;
|
|
73
|
+
|
|
74
|
+
/** Space-separated list of URLs to notify when the user follows the hyperlink. */
|
|
75
|
+
ping?: string;
|
|
76
|
+
|
|
77
|
+
/** Referrer policy for the link. */
|
|
78
|
+
referrerPolicy?: HTMLAttributeReferrerPolicy;
|
|
79
|
+
|
|
80
|
+
/** Additional router options (type depends on router implementation). */
|
|
81
|
+
routerOptions?: unknown;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
86
|
+
*
|
|
87
|
+
* This source code is licensed under the MIT license found in the
|
|
88
|
+
* LICENSE file in the root directory of this source tree.
|
|
89
|
+
*
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
interface StyleRenderProps<T> {
|
|
95
|
+
/** The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. */
|
|
96
|
+
className?:
|
|
97
|
+
| string
|
|
98
|
+
| ((values: T & { defaultClassName: string | undefined }) => string);
|
|
99
|
+
|
|
100
|
+
/** The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. A function may be provided to compute the style based on component state. */
|
|
101
|
+
style?:
|
|
102
|
+
| CSSProperties
|
|
103
|
+
| ((
|
|
104
|
+
values: T & { defaultStyle: CSSProperties }
|
|
105
|
+
) => CSSProperties | undefined);
|
|
12
106
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
id?: string | undefined;
|
|
20
|
-
role?: AriaRole | undefined;
|
|
21
|
-
tabIndex?: number | undefined;
|
|
22
|
-
style?: CSSProperties | undefined;
|
|
23
|
-
className?: string | undefined;
|
|
107
|
+
|
|
108
|
+
interface RenderProps<T> extends StyleRenderProps<T> {
|
|
109
|
+
/** The children of the component. A function may be provided to alter the children based on component state. */
|
|
110
|
+
children?:
|
|
111
|
+
| ReactNode
|
|
112
|
+
| ((values: T | { defaultChildren: ReactNode | undefined }) => ReactNode);
|
|
24
113
|
}
|
|
25
114
|
|
|
26
115
|
/**
|
|
@@ -30,10 +119,168 @@ interface DOMAttributes<T = FocusableElement> extends AriaAttributes, DOMAttribu
|
|
|
30
119
|
* LICENSE file in the root directory of this source tree.
|
|
31
120
|
*
|
|
32
121
|
*/
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Flags indicating disabled states for different interaction types.
|
|
125
|
+
*/
|
|
126
|
+
type DisabledFlags = {
|
|
127
|
+
/** Whether the element is generally disabled. */
|
|
128
|
+
general?: boolean;
|
|
129
|
+
|
|
130
|
+
/** Whether the element is disabled for form interactions. */
|
|
131
|
+
form?: boolean;
|
|
132
|
+
|
|
133
|
+
/** Whether the element is disabled for user interactions (e.g., pointer, keyboard). */
|
|
134
|
+
interactions?: boolean;
|
|
135
|
+
|
|
136
|
+
/** Custom disabled flags for additional types of interactions. */
|
|
137
|
+
[key: string]: boolean | undefined;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
142
|
+
*
|
|
143
|
+
* This source code is licensed under the MIT license found in the
|
|
144
|
+
* LICENSE file in the root directory of this source tree.
|
|
145
|
+
*
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Extended SyntheticEvent with custom propagation control methods.
|
|
152
|
+
*
|
|
153
|
+
* @template T The type of the original SyntheticEvent.
|
|
154
|
+
*/
|
|
155
|
+
type BaseEvent<T extends SyntheticEvent> = T & {
|
|
156
|
+
/**
|
|
157
|
+
* Use continuePropagation instead.
|
|
158
|
+
* @deprecated
|
|
159
|
+
*/
|
|
160
|
+
stopPropagation(): void;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Continues propagation for the event.
|
|
164
|
+
*/
|
|
165
|
+
continuePropagation(): void;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Event handlers for hover interactions.
|
|
170
|
+
*/
|
|
33
171
|
interface HoverEvent {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
172
|
+
/** Called when a hover interaction starts. */
|
|
173
|
+
onHoverStart?: (event: HoverEvent) => void;
|
|
174
|
+
|
|
175
|
+
/** Called when a hover interaction ends. */
|
|
176
|
+
onHoverEnd?: (event: HoverEvent) => void;
|
|
177
|
+
|
|
178
|
+
/** Called when the hover state changes. */
|
|
179
|
+
onHoverChange?: (isHovering: boolean) => void;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Event handlers for focus interactions.
|
|
184
|
+
*/
|
|
185
|
+
interface FocusEvents<Target = Element> {
|
|
186
|
+
/** Called when the element receives focus. */
|
|
187
|
+
onFocus?: (e: FocusEvent<Target>) => void;
|
|
188
|
+
|
|
189
|
+
/** Called when the element loses focus. */
|
|
190
|
+
onBlur?: (e: FocusEvent<Target>) => void;
|
|
191
|
+
|
|
192
|
+
/** Called when the focus state changes. */
|
|
193
|
+
onFocusChange?: (isFocused: boolean) => void;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Event handlers for keyboard interactions.
|
|
198
|
+
*/
|
|
199
|
+
interface KeyboardEvents {
|
|
200
|
+
/** Called when a key is pressed down. */
|
|
201
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
|
202
|
+
|
|
203
|
+
/** Called when a key is released. */
|
|
204
|
+
onKeyUp?: (e: KeyboardEvent) => void;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
209
|
+
*
|
|
210
|
+
* This source code is licensed under the MIT license found in the
|
|
211
|
+
* LICENSE file in the root directory of this source tree.
|
|
212
|
+
*
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
type SlottedContextValue<T, E = never> =
|
|
218
|
+
| (T & {
|
|
219
|
+
slots?: Record<string | symbol, T>;
|
|
220
|
+
ref?: E extends never ? never : ForwardedRef<E>;
|
|
221
|
+
})
|
|
222
|
+
| null
|
|
223
|
+
| undefined;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
227
|
+
*
|
|
228
|
+
* This source code is licensed under the MIT license found in the
|
|
229
|
+
* LICENSE file in the root directory of this source tree.
|
|
230
|
+
*
|
|
231
|
+
*/
|
|
232
|
+
|
|
233
|
+
/** Selection mode for a collection. */
|
|
234
|
+
type SelectionMode = 'none' | 'single' | 'multiple';
|
|
235
|
+
|
|
236
|
+
/** Focus strategy when auto-focusing. */
|
|
237
|
+
type FocusStrategy = 'first' | 'last';
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Interface for managing selection state in a collection.
|
|
241
|
+
*/
|
|
242
|
+
interface SelectionManager {
|
|
243
|
+
/** The currently focused key. */
|
|
244
|
+
readonly focusedKey: (string | number) | null;
|
|
245
|
+
/** Set the focused key. */
|
|
246
|
+
setFocusedKey(
|
|
247
|
+
key: (string | number) | null,
|
|
248
|
+
childFocus?: FocusStrategy
|
|
249
|
+
): void;
|
|
250
|
+
/** Whether the collection is focused. */
|
|
251
|
+
readonly isFocused: boolean;
|
|
252
|
+
/** Set whether the collection is focused. */
|
|
253
|
+
setFocused(isFocused: boolean): void;
|
|
254
|
+
/** The set of selected keys. */
|
|
255
|
+
readonly selectedKeys: Set<string | number>;
|
|
256
|
+
/** The selection mode. */
|
|
257
|
+
readonly selectionMode: SelectionMode;
|
|
258
|
+
/** Replace selection with a single key. */
|
|
259
|
+
replaceSelection(key: string | number): void;
|
|
260
|
+
/** Extend selection to include a key. */
|
|
261
|
+
extendSelection(key: string | number): void;
|
|
262
|
+
/** Toggle selection of a key. */
|
|
263
|
+
toggleSelection(key: string | number): void;
|
|
264
|
+
/** Select all items. */
|
|
265
|
+
selectAll(): void;
|
|
266
|
+
/** Clear all selection. */
|
|
267
|
+
clearSelection(): void;
|
|
268
|
+
/** Check if a key is selected. */
|
|
269
|
+
isSelected(key: string | number): boolean;
|
|
270
|
+
/** Check if a key is disabled. */
|
|
271
|
+
isDisabled?(key: string | number): boolean;
|
|
272
|
+
/** Check if a key is a link. */
|
|
273
|
+
isLink?(key: string | number): boolean;
|
|
274
|
+
/** Get props for an item. */
|
|
275
|
+
getItemProps?(
|
|
276
|
+
key: string | number
|
|
277
|
+
): { href?: string; routerOptions?: unknown } | undefined;
|
|
278
|
+
/** Whether the user can select an item. */
|
|
279
|
+
canSelectItem?(key: string | number): boolean;
|
|
280
|
+
/** The first selected key. */
|
|
281
|
+
readonly firstSelectedKey?: (string | number) | null;
|
|
282
|
+
/** The last selected key. */
|
|
283
|
+
readonly lastSelectedKey?: (string | number) | null;
|
|
37
284
|
}
|
|
38
285
|
|
|
39
|
-
export type { DOMAttributes,
|
|
286
|
+
export type { BaseEvent, DOMAttributes, DOMProps, DisabledFlags, FocusEvents, FocusStrategy, FocusableDOMProps, HoverEvent, KeyboardEvents, LinkDOMProps, RenderProps, SelectionManager, SelectionMode, SlottedContextValue, StyleRenderProps };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var r=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var s=(o,e,m,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of x(e))!y.call(o,p)&&p!==m&&r(o,p,{get:()=>e[p],enumerable:!(t=f(e,p))||t.enumerable});return o};var n=o=>s(r({},"__esModule",{value:!0}),o);var c={};module.exports=n(c);
|
package/package.json
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@necto-react/types",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "tsup --minify"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"module": "./dist/index.mjs",
|
|
5
15
|
"author": "Corinvo OSS Team",
|
|
6
16
|
"license": "MIT",
|
|
7
17
|
"devDependencies": {
|
|
@@ -13,8 +23,5 @@
|
|
|
13
23
|
"peerDependencies": {
|
|
14
24
|
"react": "^19.1.0",
|
|
15
25
|
"react-dom": "^19.1.0"
|
|
16
|
-
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "tsup --minify"
|
|
19
26
|
}
|
|
20
|
-
}
|
|
27
|
+
}
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
> @necto-react/types@1.0.0 build /Users/botiszabo/Developer/necto/node-kit/packages/necto-react-types
|
|
4
|
-
> tsup --minify
|
|
5
|
-
|
|
6
|
-
[34mCLI[39m Building entry: src/index.ts
|
|
7
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
-
[34mCLI[39m tsup v8.4.0
|
|
9
|
-
[34mCLI[39m Using tsup config: /Users/botiszabo/Developer/necto/node-kit/packages/necto-react-types/tsup.config.ts
|
|
10
|
-
[34mCLI[39m Target: esnext
|
|
11
|
-
[34mCJS[39m Build start
|
|
12
|
-
[34mESM[39m Build start
|
|
13
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m0 B[39m
|
|
14
|
-
[32mESM[39m ⚡️ Build success in 21ms
|
|
15
|
-
[32mCJS[39m [1mdist/index.js [22m[32m397.00 B[39m
|
|
16
|
-
[32mCJS[39m ⚡️ Build success in 25ms
|
|
17
|
-
DTS Build start
|
|
18
|
-
DTS ⚡️ Build success in 827ms
|
|
19
|
-
DTS dist/index.d.ts 1.20 KB
|
|
20
|
-
DTS dist/index.d.mts 1.20 KB
|
package/CHANGELOG.md
DELETED
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Necto
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/jsr.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@necto-react/types",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "Necto's library for providing typing interfaces and definitions for React applications.",
|
|
5
|
-
"exports": {
|
|
6
|
-
".": {
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"import": "./dist/index.mjs",
|
|
9
|
-
"require": "./dist/index.cjs"
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"files": [
|
|
13
|
-
"dist",
|
|
14
|
-
"README.md"
|
|
15
|
-
],
|
|
16
|
-
"license": "MIT",
|
|
17
|
-
"author": "Corinvo OSS Team"
|
|
18
|
-
}
|
package/src/dom.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
AriaRole,
|
|
11
|
-
CSSProperties,
|
|
12
|
-
AriaAttributes,
|
|
13
|
-
DOMAttributes as ReactDOMAttributes,
|
|
14
|
-
} from "react";
|
|
15
|
-
|
|
16
|
-
export interface FocusableElement extends Element, HTMLOrSVGElement {};
|
|
17
|
-
|
|
18
|
-
export interface DOMAttributes<T = FocusableElement> extends AriaAttributes, ReactDOMAttributes<T> {
|
|
19
|
-
onMouseLeave: (event: any) => void;
|
|
20
|
-
onMouseEnter: (event: any) => void;
|
|
21
|
-
onTouchStart: () => void;
|
|
22
|
-
onPointerLeave: (event: any) => void;
|
|
23
|
-
onPointerEnter: (event: any) => void;
|
|
24
|
-
|
|
25
|
-
id?: string | undefined,
|
|
26
|
-
role?: AriaRole | undefined,
|
|
27
|
-
tabIndex?: number | undefined,
|
|
28
|
-
style?: CSSProperties | undefined,
|
|
29
|
-
className?: string | undefined
|
|
30
|
-
};
|
package/src/events.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export interface HoverEvent {
|
|
10
|
-
onHoverStart?: (event: HoverEvent) => void,
|
|
11
|
-
onHoverEnd?: (event: HoverEvent) => void,
|
|
12
|
-
onHoverChange?: (isHovering: boolean) => void
|
|
13
|
-
}
|
package/src/index.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"jsx": "react-jsx",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"outDir": "./dist",
|
|
8
|
-
"rootDir": "./src",
|
|
9
|
-
"strict": true,
|
|
10
|
-
"moduleResolution": "node",
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"isolatedModules": true,
|
|
14
|
-
"noEmit": false,
|
|
15
|
-
"skipLibCheck": true
|
|
16
|
-
},
|
|
17
|
-
"include": [
|
|
18
|
-
"src"
|
|
19
|
-
],
|
|
20
|
-
"exclude": [
|
|
21
|
-
"node_modules",
|
|
22
|
-
"dist"
|
|
23
|
-
]
|
|
24
|
-
}
|