@necto-react/types 2.3.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 CHANGED
@@ -222,4 +222,65 @@ type SlottedContextValue<T, E = never> =
222
222
  | null
223
223
  | undefined;
224
224
 
225
- export type { BaseEvent, DOMAttributes, DOMProps, DisabledFlags, FocusEvents, FocusableDOMProps, HoverEvent, KeyboardEvents, LinkDOMProps, RenderProps, SlottedContextValue, StyleRenderProps };
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;
284
+ }
285
+
286
+ export type { BaseEvent, DOMAttributes, DOMProps, DisabledFlags, FocusEvents, FocusStrategy, FocusableDOMProps, HoverEvent, KeyboardEvents, LinkDOMProps, RenderProps, SelectionManager, SelectionMode, SlottedContextValue, StyleRenderProps };
package/dist/index.d.ts CHANGED
@@ -222,4 +222,65 @@ type SlottedContextValue<T, E = never> =
222
222
  | null
223
223
  | undefined;
224
224
 
225
- export type { BaseEvent, DOMAttributes, DOMProps, DisabledFlags, FocusEvents, FocusableDOMProps, HoverEvent, KeyboardEvents, LinkDOMProps, RenderProps, SlottedContextValue, StyleRenderProps };
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;
284
+ }
285
+
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 r=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var s=(e,o,m,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of x(o))!y.call(e,p)&&p!==m&&r(e,p,{get:()=>o[p],enumerable:!(t=f(o,p))||t.enumerable});return e};var n=e=>s(r({},"__esModule",{value:!0}),e);var a={};module.exports=n(a);
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,10 @@
1
1
  {
2
2
  "name": "@necto-react/types",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "",
5
+ "scripts": {
6
+ "build": "tsup --minify"
7
+ },
5
8
  "files": [
6
9
  "dist",
7
10
  "README.md"
@@ -20,8 +23,5 @@
20
23
  "peerDependencies": {
21
24
  "react": "^19.1.0",
22
25
  "react-dom": "^19.1.0"
23
- },
24
- "scripts": {
25
- "build": "tsup --minify"
26
26
  }
27
- }
27
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Corinvo, LLC. and affiliates. All rights reserved.
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.