@fluentui/react-utilities 9.9.4 → 9.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,51 @@
2
2
  "name": "@fluentui/react-utilities",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 26 Jun 2023 09:51:06 GMT",
5
+ "date": "Mon, 03 Jul 2023 11:54:00 GMT",
6
+ "tag": "@fluentui/react-utilities_v9.10.1",
7
+ "version": "9.10.1",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "bernardo.sunderhus@gmail.com",
12
+ "package": "@fluentui/react-utilities",
13
+ "commit": "7d519bdcaef0a3249b6eae721fea0e5f096f6d35",
14
+ "comment": "bugfix: removes default prevention verification on selection"
15
+ },
16
+ {
17
+ "author": "bernardo.sunderhus@gmail.com",
18
+ "package": "@fluentui/react-utilities",
19
+ "commit": "cbfa9a3717782183ebc86149abcde6468f97afa8",
20
+ "comment": "chore: adds internal tag on jsdoc for getSlotsNext"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Wed, 28 Jun 2023 11:12:35 GMT",
27
+ "tag": "@fluentui/react-utilities_v9.10.0",
28
+ "version": "9.10.0",
29
+ "comments": {
30
+ "none": [
31
+ {
32
+ "author": "martinhochel@microsoft.com",
33
+ "package": "@fluentui/react-utilities",
34
+ "commit": "fbe878e9c9785588197481f172c42c2c0a230292",
35
+ "comment": "fix: update .npmignore to unify v8 packages and exclude project.json"
36
+ }
37
+ ],
38
+ "minor": [
39
+ {
40
+ "author": "bernardo.sunderhus@gmail.com",
41
+ "package": "@fluentui/react-utilities",
42
+ "commit": "f154811cb3580595c319de809ea51a798dfd4555",
43
+ "comment": "feat: creates useSelection hook"
44
+ }
45
+ ]
46
+ }
47
+ },
48
+ {
49
+ "date": "Mon, 26 Jun 2023 09:53:54 GMT",
6
50
  "tag": "@fluentui/react-utilities_v9.9.4",
7
51
  "version": "9.9.4",
8
52
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,31 @@
1
1
  # Change Log - @fluentui/react-utilities
2
2
 
3
- This log was last generated on Mon, 26 Jun 2023 09:51:06 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 03 Jul 2023 11:54:00 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.10.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.10.1)
8
+
9
+ Mon, 03 Jul 2023 11:54:00 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.10.0..@fluentui/react-utilities_v9.10.1)
11
+
12
+ ### Patches
13
+
14
+ - bugfix: removes default prevention verification on selection ([PR #28365](https://github.com/microsoft/fluentui/pull/28365) by bernardo.sunderhus@gmail.com)
15
+ - chore: adds internal tag on jsdoc for getSlotsNext ([PR #28348](https://github.com/microsoft/fluentui/pull/28348) by bernardo.sunderhus@gmail.com)
16
+
17
+ ## [9.10.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.10.0)
18
+
19
+ Wed, 28 Jun 2023 11:12:35 GMT
20
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.9.4..@fluentui/react-utilities_v9.10.0)
21
+
22
+ ### Minor changes
23
+
24
+ - feat: creates useSelection hook ([PR #28335](https://github.com/microsoft/fluentui/pull/28335) by bernardo.sunderhus@gmail.com)
25
+
7
26
  ## [9.9.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.9.4)
8
27
 
9
- Mon, 26 Jun 2023 09:51:06 GMT
28
+ Mon, 26 Jun 2023 09:53:54 GMT
10
29
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.9.3..@fluentui/react-utilities_v9.9.4)
11
30
 
12
31
  ### Patches
package/dist/index.d.ts CHANGED
@@ -164,6 +164,11 @@ export declare function getSlots<R extends SlotPropsRecord>(state: ComponentStat
164
164
 
165
165
  /**
166
166
  * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma
167
+ *
168
+ * @internal
169
+ * This is an internal temporary method, this method will cease to exist eventually!
170
+ *
171
+ * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️
167
172
  */
168
173
  export declare function getSlotsNext<R extends SlotPropsRecord>(state: ComponentState<R>): {
169
174
  slots: Slots<R>;
@@ -363,6 +368,12 @@ declare type ObscureEventName = 'onLostPointerCaptureCapture';
363
368
  */
364
369
  export declare function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(obj: TObj, exclusions: Exclusions): Omit<TObj, Exclusions[number]>;
365
370
 
371
+ export declare type OnSelectionChangeCallback = (event: React_2.SyntheticEvent, selectedItems: Set<SelectionItemId>) => void;
372
+
373
+ export declare type OnSelectionChangeData = {
374
+ selectedItems: Set<SelectionItemId>;
375
+ };
376
+
366
377
  /**
367
378
  * @internal
368
379
  */
@@ -439,6 +450,36 @@ export declare type ResolveShorthandOptions<Props, Required extends boolean = fa
439
450
  defaultProps?: Props;
440
451
  };
441
452
 
453
+ export declare type SelectionHookParams = {
454
+ selectionMode: SelectionMode_2;
455
+ /**
456
+ * Used in uncontrolled mode to set initial selected items on mount
457
+ */
458
+ defaultSelectedItems?: Iterable<SelectionItemId>;
459
+ /**
460
+ * Used to control selected items
461
+ */
462
+ selectedItems?: Iterable<SelectionItemId>;
463
+ /**
464
+ * Called when selection changes
465
+ */
466
+ onSelectionChange?(event: React_2.SyntheticEvent, data: OnSelectionChangeData): void;
467
+ };
468
+
469
+ export declare type SelectionItemId = string | number;
470
+
471
+ export declare interface SelectionMethods {
472
+ toggleItem(event: React_2.SyntheticEvent, id: SelectionItemId): void;
473
+ selectItem(event: React_2.SyntheticEvent, id: SelectionItemId): void;
474
+ deselectItem(event: React_2.SyntheticEvent, id: SelectionItemId): void;
475
+ clearItems(event: React_2.SyntheticEvent): void;
476
+ isSelected(id: SelectionItemId): boolean;
477
+ toggleAllItems(event: React_2.SyntheticEvent, itemIds: SelectionItemId[]): void;
478
+ }
479
+
480
+ declare type SelectionMode_2 = 'single' | 'multiselect';
481
+ export { SelectionMode_2 as SelectionMode }
482
+
442
483
  /**
443
484
  * The props type and shorthand value for a slot. Type is either a single intrinsic element like `'div'`,
444
485
  * or a component like `typeof Button`.
@@ -707,6 +748,8 @@ declare interface UseScrollbarWidthOptions {
707
748
  force?: boolean;
708
749
  }
709
750
 
751
+ export declare function useSelection(params: SelectionHookParams): readonly [Set<SelectionItemId>, SelectionMethods];
752
+
710
753
  /**
711
754
  * @internal
712
755
  * Helper to manage a browser timeout.
@@ -1,6 +1,11 @@
1
1
  import * as React from 'react';
2
2
  /**
3
3
  * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma
4
+ *
5
+ * @internal
6
+ * This is an internal temporary method, this method will cease to exist eventually!
7
+ *
8
+ * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️
4
9
  */ export function getSlotsNext(state) {
5
10
  const slots = {};
6
11
  const slotProps = {};
@@ -1 +1 @@
1
- {"version":3,"sources":["getSlotsNext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentState, SlotPropsRecord, UnknownSlotProps } from './types';\nimport { ObjectSlotProps, Slots } from './getSlots';\n\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n */\nexport function getSlotsNext<R extends SlotPropsRecord>(\n state: ComponentState<R>,\n): {\n slots: Slots<R>;\n slotProps: ObjectSlotProps<R>;\n} {\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlotNext<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, ...propsWithoutAs } = props as NonUndefined<typeof props>;\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps: UnknownSlotProps = shouldOmitAsProp ? propsWithoutAs : props;\n\n return [slot, slotProps as R[K]];\n}\n"],"names":["React","getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B;;CAEC,GACD,OAAO,SAASC,aACdC,KAAwB,EAIxB;IACA,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IAEnB,MAAMC,YAAyBC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC3D,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,OAAO;QAAER;QAAOC,WAAWA;IAA2C;AACxE,CAAC;AAED,SAASQ,YACPV,KAAwB,EACxBO,QAAW,EACsC;QAY/CP,mBACcA;IAZhB,MAAMS,QAAQT,KAAK,CAACO,SAAS;IAE7B,IAAIE,UAAUE,WAAW;QACvB,OAAO;YAAC,IAAI;YAAEA;SAAkB;IAClC,CAAC;IAGD,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,OAAM,EAAE,GAAGC,gBAAgB,GAAGL;IAE1C,MAAMD,OACJR,CAAAA,CAAAA,oBAAAA,MAAMM,UAAU,cAAhBN,+BAAAA,KAAAA,IAAAA,iBAAkB,CAACO,SAAS,AAAD,MAAMI,aAAa,OAAOX,MAAMM,UAAU,CAACC,SAAS,KAAK,WAChFM,UAAUb,CAAAA,CAAAA,qBAAAA,MAAMM,UAAU,cAAhBN,gCAAAA,KAAAA,IAAAA,kBAAkB,CAACO,SAAS,AAAD,KAAK,QAC1CP,MAAMM,UAAU,CAACC,SAAS;IAGhC,MAAMQ,mBAAmB,OAAOP,SAAS,YAAYK;IACrD,MAAMX,YAA8Ba,mBAAmBD,iBAAiBL,KAAK;IAE7E,OAAO;QAACD;QAAMN;KAAkB;AAClC"}
1
+ {"version":3,"sources":["getSlotsNext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentState, SlotPropsRecord, UnknownSlotProps } from './types';\nimport { ObjectSlotProps, Slots } from './getSlots';\n\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n *\n * @internal\n * This is an internal temporary method, this method will cease to exist eventually!\n *\n * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️\n */\nexport function getSlotsNext<R extends SlotPropsRecord>(\n state: ComponentState<R>,\n): {\n slots: Slots<R>;\n slotProps: ObjectSlotProps<R>;\n} {\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlotNext<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, ...propsWithoutAs } = props as NonUndefined<typeof props>;\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps: UnknownSlotProps = shouldOmitAsProp ? propsWithoutAs : props;\n\n return [slot, slotProps as R[K]];\n}\n"],"names":["React","getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B;;;;;;;CAOC,GACD,OAAO,SAASC,aACdC,KAAwB,EAIxB;IACA,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IAEnB,MAAMC,YAAyBC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC3D,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,OAAO;QAAER;QAAOC,WAAWA;IAA2C;AACxE,CAAC;AAED,SAASQ,YACPV,KAAwB,EACxBO,QAAW,EACsC;QAY/CP,mBACcA;IAZhB,MAAMS,QAAQT,KAAK,CAACO,SAAS;IAE7B,IAAIE,UAAUE,WAAW;QACvB,OAAO;YAAC,IAAI;YAAEA;SAAkB;IAClC,CAAC;IAGD,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,OAAM,EAAE,GAAGC,gBAAgB,GAAGL;IAE1C,MAAMD,OACJR,CAAAA,CAAAA,oBAAAA,MAAMM,UAAU,cAAhBN,+BAAAA,KAAAA,IAAAA,iBAAkB,CAACO,SAAS,AAAD,MAAMI,aAAa,OAAOX,MAAMM,UAAU,CAACC,SAAS,KAAK,WAChFM,UAAUb,CAAAA,CAAAA,qBAAAA,MAAMM,UAAU,cAAhBN,gCAAAA,KAAAA,IAAAA,kBAAkB,CAACO,SAAS,AAAD,KAAK,QAC1CP,MAAMM,UAAU,CAACC,SAAS;IAGhC,MAAMQ,mBAAmB,OAAOP,SAAS,YAAYK;IACrD,MAAMX,YAA8Ba,mBAAmBD,iBAAiBL,KAAK;IAE7E,OAAO;QAACD;QAAMN;KAAkB;AAClC"}
package/lib/index.js CHANGED
@@ -4,3 +4,4 @@ export { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';
4
4
  export { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';
5
5
  export { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';
6
6
  export { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';
7
+ export { useSelection } from './selection/index';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n getSlots,\n getSlotsNext,\n resolveShorthand,\n isResolvedShorthand,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n createPriorityQueue,\n} from './utils/index';\n\nexport type { PriorityQueue } from './utils/priorityQueue';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n"],"names":["getSlots","getSlotsNext","resolveShorthand","isResolvedShorthand","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords"],"mappings":"AAAA,SACEA,QAAQ,EACRC,YAAY,EACZC,gBAAgB,EAChBC,mBAAmB,EACnBC,2BAA2B,QACtB,kBAAkB;AAiBzB,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,EACdC,KAAK,EACLC,yBAAyB,EACzBC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,iBAAiB,EACjBC,UAAU,QACL,gBAAgB;AAGvB,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,cAAc;AAE/D,SACEC,KAAK,EACLC,qBAAqB,EACrBC,yBAAyB,EACzBC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,wBAAwB,EACxBC,IAAI,EACJC,mBAAmB,QACd,gBAAgB;AAIvB,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,eAAe,QAAQ,kBAAkB;AAQhG,SAASC,YAAY,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ,iBAAiB"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n getSlots,\n getSlotsNext,\n resolveShorthand,\n isResolvedShorthand,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n createPriorityQueue,\n} from './utils/index';\n\nexport type { PriorityQueue } from './utils/priorityQueue';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n\nexport type {\n SelectionMode,\n OnSelectionChangeCallback,\n OnSelectionChangeData,\n SelectionItemId,\n SelectionHookParams,\n SelectionMethods,\n} from './selection/index';\nexport { useSelection } from './selection/index';\n"],"names":["getSlots","getSlotsNext","resolveShorthand","isResolvedShorthand","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords","useSelection"],"mappings":"AAAA,SACEA,QAAQ,EACRC,YAAY,EACZC,gBAAgB,EAChBC,mBAAmB,EACnBC,2BAA2B,QACtB,kBAAkB;AAiBzB,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,EACdC,KAAK,EACLC,yBAAyB,EACzBC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,iBAAiB,EACjBC,UAAU,QACL,gBAAgB;AAGvB,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,cAAc;AAE/D,SACEC,KAAK,EACLC,qBAAqB,EACrBC,yBAAyB,EACzBC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,wBAAwB,EACxBC,IAAI,EACJC,mBAAmB,QACd,gBAAgB;AAIvB,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,eAAe,QAAQ,kBAAkB;AAQhG,SAASC,YAAY,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ,iBAAiB;AAUlF,SAASC,YAAY,QAAQ,oBAAoB"}
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './useSelection';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './types';\nexport * from './useSelection';\n"],"names":[],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,iBAAiB"}
@@ -0,0 +1 @@
1
+ import * as React from 'react';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["types.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type SelectionMode = 'single' | 'multiselect';\n\nexport interface SelectionMethods {\n toggleItem(event: React.SyntheticEvent, id: SelectionItemId): void;\n selectItem(event: React.SyntheticEvent, id: SelectionItemId): void;\n deselectItem(event: React.SyntheticEvent, id: SelectionItemId): void;\n clearItems(event: React.SyntheticEvent): void;\n isSelected(id: SelectionItemId): boolean;\n toggleAllItems(event: React.SyntheticEvent, itemIds: SelectionItemId[]): void;\n}\n\nexport type SelectionItemId = string | number;\n\nexport type OnSelectionChangeCallback = (event: React.SyntheticEvent, selectedItems: Set<SelectionItemId>) => void;\n\nexport type OnSelectionChangeData = {\n selectedItems: Set<SelectionItemId>;\n};\n\nexport type SelectionHookParams = {\n selectionMode: SelectionMode;\n /**\n * Used in uncontrolled mode to set initial selected items on mount\n */\n defaultSelectedItems?: Iterable<SelectionItemId>;\n /**\n * Used to control selected items\n */\n selectedItems?: Iterable<SelectionItemId>;\n /**\n * Called when selection changes\n */\n onSelectionChange?(event: React.SyntheticEvent, data: OnSelectionChangeData): void;\n};\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
@@ -0,0 +1,101 @@
1
+ import * as React from 'react';
2
+ import { useControllableState } from '../hooks/useControllableState';
3
+ import { createSetFromIterable } from '../utils/createSetFromIterable';
4
+ function useSelectionState(params) {
5
+ const [selected, setSelected] = useControllableState({
6
+ initialState: new Set(),
7
+ defaultState: React.useMemo(()=>params.defaultSelectedItems && createSetFromIterable(params.defaultSelectedItems), [
8
+ params.defaultSelectedItems
9
+ ]),
10
+ state: React.useMemo(()=>params.selectedItems && createSetFromIterable(params.selectedItems), [
11
+ params.selectedItems
12
+ ])
13
+ });
14
+ const changeSelection = (event, nextSelectedItems)=>{
15
+ var _params_onSelectionChange;
16
+ (_params_onSelectionChange = params.onSelectionChange) === null || _params_onSelectionChange === void 0 ? void 0 : _params_onSelectionChange.call(params, event, {
17
+ selectedItems: nextSelectedItems
18
+ });
19
+ setSelected(nextSelectedItems);
20
+ };
21
+ return [
22
+ selected,
23
+ changeSelection
24
+ ];
25
+ }
26
+ function useSingleSelection(params) {
27
+ const [selected, changeSelection] = useSelectionState(params);
28
+ var _selected_has;
29
+ const methods = {
30
+ deselectItem: (event)=>changeSelection(event, new Set()),
31
+ selectItem: (event, itemId)=>changeSelection(event, new Set([
32
+ itemId
33
+ ])),
34
+ toggleAllItems: ()=>{
35
+ if (process.env.NODE_ENV !== 'production') {
36
+ throw new Error('[react-utilities]: `toggleAllItems` should not be used in single selection mode');
37
+ }
38
+ },
39
+ toggleItem: (event, itemId)=>changeSelection(event, new Set([
40
+ itemId
41
+ ])),
42
+ clearItems: (event)=>changeSelection(event, new Set()),
43
+ isSelected: (itemId)=>(_selected_has = selected.has(itemId)) !== null && _selected_has !== void 0 ? _selected_has : false
44
+ };
45
+ return [
46
+ selected,
47
+ methods
48
+ ];
49
+ }
50
+ function useMultipleSelection(params) {
51
+ const [selected, changeSelection] = useSelectionState(params);
52
+ const methods = {
53
+ toggleItem: (event, itemId)=>{
54
+ const nextSelectedItems = new Set(selected);
55
+ if (selected.has(itemId)) {
56
+ nextSelectedItems.delete(itemId);
57
+ } else {
58
+ nextSelectedItems.add(itemId);
59
+ }
60
+ changeSelection(event, nextSelectedItems);
61
+ },
62
+ selectItem: (event, itemId)=>{
63
+ const nextSelectedItems = new Set(selected);
64
+ nextSelectedItems.add(itemId);
65
+ changeSelection(event, nextSelectedItems);
66
+ },
67
+ deselectItem: (event, itemId)=>{
68
+ const nextSelectedItems = new Set(selected);
69
+ nextSelectedItems.delete(itemId);
70
+ changeSelection(event, nextSelectedItems);
71
+ },
72
+ clearItems: (event)=>{
73
+ changeSelection(event, new Set());
74
+ },
75
+ isSelected: (itemId)=>selected.has(itemId),
76
+ toggleAllItems: (event, itemIds)=>{
77
+ const allItemsSelected = itemIds.every((itemId)=>selected.has(itemId));
78
+ const nextSelectedItems = new Set(selected);
79
+ if (allItemsSelected) {
80
+ nextSelectedItems.clear();
81
+ } else {
82
+ itemIds.forEach((itemId)=>nextSelectedItems.add(itemId));
83
+ }
84
+ changeSelection(event, nextSelectedItems);
85
+ }
86
+ };
87
+ return [
88
+ selected,
89
+ methods
90
+ ];
91
+ }
92
+ export function useSelection(params) {
93
+ if (params.selectionMode === 'multiselect') {
94
+ // selectionMode is a static value, so we can safely ignore rules-of-hooks
95
+ // eslint-disable-next-line react-hooks/rules-of-hooks
96
+ return useMultipleSelection(params);
97
+ }
98
+ // selectionMode is a static value, so we can safely ignore rules-of-hooks
99
+ // eslint-disable-next-line react-hooks/rules-of-hooks
100
+ return useSingleSelection(params);
101
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useSelection.ts"],"sourcesContent":["import * as React from 'react';\nimport { SelectionHookParams, SelectionItemId, SelectionMethods } from './types';\nimport { useControllableState } from '../hooks/useControllableState';\nimport { createSetFromIterable } from '../utils/createSetFromIterable';\n\nfunction useSelectionState(params: Omit<SelectionHookParams, 'selectionMode'>) {\n const [selected, setSelected] = useControllableState<Set<SelectionItemId>>({\n initialState: new Set(),\n defaultState: React.useMemo(\n () => params.defaultSelectedItems && createSetFromIterable(params.defaultSelectedItems),\n [params.defaultSelectedItems],\n ),\n state: React.useMemo(\n () => params.selectedItems && createSetFromIterable(params.selectedItems),\n [params.selectedItems],\n ),\n });\n const changeSelection = (event: React.SyntheticEvent, nextSelectedItems: Set<SelectionItemId>) => {\n params.onSelectionChange?.(event, { selectedItems: nextSelectedItems });\n setSelected(nextSelectedItems);\n };\n return [selected, changeSelection] as const;\n}\n\nfunction useSingleSelection(params: Omit<SelectionHookParams, 'selectionMode'>) {\n const [selected, changeSelection] = useSelectionState(params);\n const methods: SelectionMethods = {\n deselectItem: event => changeSelection(event, new Set()),\n selectItem: (event, itemId) => changeSelection(event, new Set([itemId])),\n toggleAllItems: () => {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('[react-utilities]: `toggleAllItems` should not be used in single selection mode');\n }\n },\n toggleItem: (event, itemId) => changeSelection(event, new Set([itemId])),\n clearItems: event => changeSelection(event, new Set()),\n isSelected: itemId => selected.has(itemId) ?? false,\n };\n return [selected, methods] as const;\n}\n\nfunction useMultipleSelection(params: Omit<SelectionHookParams, 'selectionMode'>) {\n const [selected, changeSelection] = useSelectionState(params);\n const methods: SelectionMethods = {\n toggleItem: (event, itemId) => {\n const nextSelectedItems = new Set(selected);\n if (selected.has(itemId)) {\n nextSelectedItems.delete(itemId);\n } else {\n nextSelectedItems.add(itemId);\n }\n changeSelection(event, nextSelectedItems);\n },\n selectItem: (event, itemId) => {\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.add(itemId);\n changeSelection(event, nextSelectedItems);\n },\n deselectItem: (event, itemId) => {\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.delete(itemId);\n changeSelection(event, nextSelectedItems);\n },\n clearItems: event => {\n changeSelection(event, new Set());\n },\n isSelected: itemId => selected.has(itemId),\n toggleAllItems: (event, itemIds) => {\n const allItemsSelected = itemIds.every(itemId => selected.has(itemId));\n const nextSelectedItems = new Set(selected);\n if (allItemsSelected) {\n nextSelectedItems.clear();\n } else {\n itemIds.forEach(itemId => nextSelectedItems.add(itemId));\n }\n changeSelection(event, nextSelectedItems);\n },\n };\n return [selected, methods] as const;\n}\n\nexport function useSelection(params: SelectionHookParams) {\n if (params.selectionMode === 'multiselect') {\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useMultipleSelection(params);\n }\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useSingleSelection(params);\n}\n"],"names":["React","useControllableState","createSetFromIterable","useSelectionState","params","selected","setSelected","initialState","Set","defaultState","useMemo","defaultSelectedItems","state","selectedItems","changeSelection","event","nextSelectedItems","onSelectionChange","useSingleSelection","methods","deselectItem","selectItem","itemId","toggleAllItems","process","env","NODE_ENV","Error","toggleItem","clearItems","isSelected","has","useMultipleSelection","delete","add","itemIds","allItemsSelected","every","clear","forEach","useSelection","selectionMode"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,oBAAoB,QAAQ,gCAAgC;AACrE,SAASC,qBAAqB,QAAQ,iCAAiC;AAEvE,SAASC,kBAAkBC,MAAkD,EAAE;IAC7E,MAAM,CAACC,UAAUC,YAAY,GAAGL,qBAA2C;QACzEM,cAAc,IAAIC;QAClBC,cAAcT,MAAMU,OAAO,CACzB,IAAMN,OAAOO,oBAAoB,IAAIT,sBAAsBE,OAAOO,oBAAoB,GACtF;YAACP,OAAOO,oBAAoB;SAAC;QAE/BC,OAAOZ,MAAMU,OAAO,CAClB,IAAMN,OAAOS,aAAa,IAAIX,sBAAsBE,OAAOS,aAAa,GACxE;YAACT,OAAOS,aAAa;SAAC;IAE1B;IACA,MAAMC,kBAAkB,CAACC,OAA6BC,oBAA4C;YAChGZ;QAAAA,CAAAA,4BAAAA,OAAOa,iBAAiB,cAAxBb,uCAAAA,KAAAA,IAAAA,0BAAAA,KAAAA,QAA2BW,OAAO;YAAEF,eAAeG;QAAkB;QACrEV,YAAYU;IACd;IACA,OAAO;QAACX;QAAUS;KAAgB;AACpC;AAEA,SAASI,mBAAmBd,MAAkD,EAAE;IAC9E,MAAM,CAACC,UAAUS,gBAAgB,GAAGX,kBAAkBC;QAW9BC;IAVxB,MAAMc,UAA4B;QAChCC,cAAcL,CAAAA,QAASD,gBAAgBC,OAAO,IAAIP;QAClDa,YAAY,CAACN,OAAOO,SAAWR,gBAAgBC,OAAO,IAAIP,IAAI;gBAACc;aAAO;QACtEC,gBAAgB,IAAM;YACpB,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;gB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OAAO;gBACLH,QAAQI,OAAO,CAACjB,CAAAA,SAAUN,kBAAkBkB,GAAG,CAACZ;YAClD,CAAC;YACDR,gBAAgBC,OAAOC;QACzB;IACF;IACA,OAAO;QAACX;QAAUc;KAAQ;AAC5B;AAEA,OAAO,SAASqB,aAAapC,MAA2B,EAAE;IACxD,IAAIA,OAAOqC,aAAa,KAAK,eAAe;QAC1C,0EAA0E;QAC1E,sDAAsD;QACtD,OAAOT,qBAAqB5B;IAC9B,CAAC;IACD,0EAA0E;IAC1E,sDAAsD;IACtD,OAAOc,mBAAmBd;AAC5B,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Creates a set from a given iterable, in case the iterable is a set itself, returns the given set instead.
3
+ */ export function createSetFromIterable(iterable) {
4
+ return iterable instanceof Set ? iterable : new Set(iterable);
5
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["createSetFromIterable.ts"],"sourcesContent":["/**\n * Creates a set from a given iterable, in case the iterable is a set itself, returns the given set instead.\n */\nexport function createSetFromIterable<V>(iterable: Iterable<V>): Set<V> {\n return iterable instanceof Set ? iterable : new Set(iterable);\n}\n"],"names":["createSetFromIterable","iterable","Set"],"mappings":"AAAA;;CAEC,GACD,OAAO,SAASA,sBAAyBC,QAAqB,EAAU;IACtE,OAAOA,oBAAoBC,MAAMD,WAAW,IAAIC,IAAID,SAAS;AAC/D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["getSlotsNext.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n */ export function getSlotsNext(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames){\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlotNext(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [\n null,\n undefined\n ];\n }\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp , ...propsWithoutAs } = props;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? propsWithoutAs : props;\n return [\n slot,\n slotProps\n ];\n}\n"],"names":["getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","_state_components","_state_components1","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":";;;;+BAGoBA;;aAAAA;;;6DAHG;AAGZ,SAASA,aAAaC,KAAK,EAAE;IACpC,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAU;QAC7B,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IAC1B;IACA,OAAO;QACHR;QACAC,WAAWA;IACf;AACJ;AACA,SAASQ,YAAYV,KAAK,EAAEO,QAAQ,EAAE;IAClC,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACrB,OAAO;YACH,IAAI;YACJA;SACH;IACL,CAAC;IACD,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,OAAM,EAAG,GAAGC,gBAAgB,GAAGP;IAC3C,MAAMD,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWQ,UAAW,CAAA,AAACH,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,MAAMU,mBAAmB,OAAOT,SAAS,YAAYO;IACrD,MAAMb,YAAYe,mBAAmBD,iBAAiBP,KAAK;IAC3D,OAAO;QACHD;QACAN;KACH;AACL"}
1
+ {"version":3,"sources":["getSlotsNext.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n *\n * @internal\n * This is an internal temporary method, this method will cease to exist eventually!\n *\n * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️\n */ export function getSlotsNext(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames){\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlotNext(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [\n null,\n undefined\n ];\n }\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp , ...propsWithoutAs } = props;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? propsWithoutAs : props;\n return [\n slot,\n slotProps\n ];\n}\n"],"names":["getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","_state_components","_state_components1","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":";;;;+BAQoBA;;aAAAA;;;6DARG;AAQZ,SAASA,aAAaC,KAAK,EAAE;IACpC,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAU;QAC7B,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IAC1B;IACA,OAAO;QACHR;QACAC,WAAWA;IACf;AACJ;AACA,SAASQ,YAAYV,KAAK,EAAEO,QAAQ,EAAE;IAClC,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACrB,OAAO;YACH,IAAI;YACJA;SACH;IACL,CAAC;IACD,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,OAAM,EAAG,GAAGC,gBAAgB,GAAGP;IAC3C,MAAMD,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWQ,UAAW,CAAA,AAACH,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,MAAMU,mBAAmB,OAAOT,SAAS,YAAYO;IACrD,MAAMb,YAAYe,mBAAmBD,iBAAiBP,KAAK;IAC3D,OAAO;QACHD;QACAN;KACH;AACL"}
@@ -45,7 +45,8 @@ _export(exports, {
45
45
  isFluentTrigger: ()=>_index4.isFluentTrigger,
46
46
  isTouchEvent: ()=>_index5.isTouchEvent,
47
47
  isMouseEvent: ()=>_index5.isMouseEvent,
48
- getEventClientCoords: ()=>_index5.getEventClientCoords
48
+ getEventClientCoords: ()=>_index5.getEventClientCoords,
49
+ useSelection: ()=>_index6.useSelection
49
50
  });
50
51
  const _index = require("./compose/index");
51
52
  const _index1 = require("./hooks/index");
@@ -53,3 +54,4 @@ const _index2 = require("./ssr/index");
53
54
  const _index3 = require("./utils/index");
54
55
  const _index4 = require("./trigger/index");
55
56
  const _index5 = require("./events/index");
57
+ const _index6 = require("./selection/index");
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export { getSlots, getSlotsNext, resolveShorthand, isResolvedShorthand, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';\nexport { IdPrefixProvider, resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\nexport { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n"],"names":["getSlots","getSlotsNext","resolveShorthand","isResolvedShorthand","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","create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BAC7F;wBACb"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export { getSlots, getSlotsNext, resolveShorthand, isResolvedShorthand, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';\nexport { IdPrefixProvider, resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\nexport { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\nexport { useSelection } from './selection/index';\n"],"names":["getSlots","getSlotsNext","resolveShorthand","isResolvedShorthand","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords","useSelection"],"mappings":";;;;;;;;;;;IAASA,QAAQ,MAARA,eAAQ;IAAEC,YAAY,MAAZA,mBAAY;IAAEC,gBAAgB,MAAhBA,uBAAgB;IAAEC,mBAAmB,MAAnBA,0BAAmB;IAAEC,2BAA2B,MAA3BA,kCAA2B;IAC1FC,gBAAgB,MAAhBA,wBAAgB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,oBAAoB,MAApBA,4BAAoB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,KAAK,MAALA,aAAK;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,kBAAkB,MAAlBA,0BAAkB;IAAEC,WAAW,MAAXA,mBAAW;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,UAAU,MAAVA,kBAAU;IAC7OC,SAAS,MAATA,iBAAS;IAAEC,QAAQ,MAARA,gBAAQ;IAAEC,WAAW,MAAXA,mBAAW;IAChCC,KAAK,MAALA,aAAK;IAAEC,qBAAqB,MAArBA,6BAAqB;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,wBAAwB,MAAxBA,gCAAwB;IAAEC,IAAI,MAAJA,YAAI;IAAEC,mBAAmB,MAAnBA,2BAAmB;IAC1JC,2BAA2B,MAA3BA,mCAA2B;IAAEC,eAAe,MAAfA,uBAAe;IAAEC,eAAe,MAAfA,uBAAe;IAC7DC,YAAY,MAAZA,oBAAY;IAAEC,YAAY,MAAZA,oBAAY;IAAEC,oBAAoB,MAApBA,4BAAoB;IAChDC,YAAY,MAAZA,oBAAY;;uBANsF;wBACmJ;wBAC7M;wBAC0H;wBAC7F;wBACb;wBACpC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./types"), exports);
7
+ _exportStar(require("./useSelection"), exports);
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './types';\nexport * from './useSelection';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
6
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;6DAAuB"}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useSelection", {
6
+ enumerable: true,
7
+ get: ()=>useSelection
8
+ });
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _useControllableState = require("../hooks/useControllableState");
12
+ const _createSetFromIterable = require("../utils/createSetFromIterable");
13
+ function useSelectionState(params) {
14
+ const [selected, setSelected] = (0, _useControllableState.useControllableState)({
15
+ initialState: new Set(),
16
+ defaultState: _react.useMemo(()=>params.defaultSelectedItems && (0, _createSetFromIterable.createSetFromIterable)(params.defaultSelectedItems), [
17
+ params.defaultSelectedItems
18
+ ]),
19
+ state: _react.useMemo(()=>params.selectedItems && (0, _createSetFromIterable.createSetFromIterable)(params.selectedItems), [
20
+ params.selectedItems
21
+ ])
22
+ });
23
+ const changeSelection = (event, nextSelectedItems)=>{
24
+ var _params_onSelectionChange;
25
+ (_params_onSelectionChange = params.onSelectionChange) === null || _params_onSelectionChange === void 0 ? void 0 : _params_onSelectionChange.call(params, event, {
26
+ selectedItems: nextSelectedItems
27
+ });
28
+ setSelected(nextSelectedItems);
29
+ };
30
+ return [
31
+ selected,
32
+ changeSelection
33
+ ];
34
+ }
35
+ function useSingleSelection(params) {
36
+ const [selected, changeSelection] = useSelectionState(params);
37
+ var _selected_has;
38
+ const methods = {
39
+ deselectItem: (event)=>changeSelection(event, new Set()),
40
+ selectItem: (event, itemId)=>changeSelection(event, new Set([
41
+ itemId
42
+ ])),
43
+ toggleAllItems: ()=>{
44
+ if (process.env.NODE_ENV !== 'production') {
45
+ throw new Error('[react-utilities]: `toggleAllItems` should not be used in single selection mode');
46
+ }
47
+ },
48
+ toggleItem: (event, itemId)=>changeSelection(event, new Set([
49
+ itemId
50
+ ])),
51
+ clearItems: (event)=>changeSelection(event, new Set()),
52
+ isSelected: (itemId)=>(_selected_has = selected.has(itemId)) !== null && _selected_has !== void 0 ? _selected_has : false
53
+ };
54
+ return [
55
+ selected,
56
+ methods
57
+ ];
58
+ }
59
+ function useMultipleSelection(params) {
60
+ const [selected, changeSelection] = useSelectionState(params);
61
+ const methods = {
62
+ toggleItem: (event, itemId)=>{
63
+ const nextSelectedItems = new Set(selected);
64
+ if (selected.has(itemId)) {
65
+ nextSelectedItems.delete(itemId);
66
+ } else {
67
+ nextSelectedItems.add(itemId);
68
+ }
69
+ changeSelection(event, nextSelectedItems);
70
+ },
71
+ selectItem: (event, itemId)=>{
72
+ const nextSelectedItems = new Set(selected);
73
+ nextSelectedItems.add(itemId);
74
+ changeSelection(event, nextSelectedItems);
75
+ },
76
+ deselectItem: (event, itemId)=>{
77
+ const nextSelectedItems = new Set(selected);
78
+ nextSelectedItems.delete(itemId);
79
+ changeSelection(event, nextSelectedItems);
80
+ },
81
+ clearItems: (event)=>{
82
+ changeSelection(event, new Set());
83
+ },
84
+ isSelected: (itemId)=>selected.has(itemId),
85
+ toggleAllItems: (event, itemIds)=>{
86
+ const allItemsSelected = itemIds.every((itemId)=>selected.has(itemId));
87
+ const nextSelectedItems = new Set(selected);
88
+ if (allItemsSelected) {
89
+ nextSelectedItems.clear();
90
+ } else {
91
+ itemIds.forEach((itemId)=>nextSelectedItems.add(itemId));
92
+ }
93
+ changeSelection(event, nextSelectedItems);
94
+ }
95
+ };
96
+ return [
97
+ selected,
98
+ methods
99
+ ];
100
+ }
101
+ function useSelection(params) {
102
+ if (params.selectionMode === 'multiselect') {
103
+ // selectionMode is a static value, so we can safely ignore rules-of-hooks
104
+ // eslint-disable-next-line react-hooks/rules-of-hooks
105
+ return useMultipleSelection(params);
106
+ }
107
+ // selectionMode is a static value, so we can safely ignore rules-of-hooks
108
+ // eslint-disable-next-line react-hooks/rules-of-hooks
109
+ return useSingleSelection(params);
110
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useSelection.js"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState } from '../hooks/useControllableState';\nimport { createSetFromIterable } from '../utils/createSetFromIterable';\nfunction useSelectionState(params) {\n const [selected, setSelected] = useControllableState({\n initialState: new Set(),\n defaultState: React.useMemo(()=>params.defaultSelectedItems && createSetFromIterable(params.defaultSelectedItems), [\n params.defaultSelectedItems\n ]),\n state: React.useMemo(()=>params.selectedItems && createSetFromIterable(params.selectedItems), [\n params.selectedItems\n ])\n });\n const changeSelection = (event, nextSelectedItems)=>{\n var _params_onSelectionChange;\n (_params_onSelectionChange = params.onSelectionChange) === null || _params_onSelectionChange === void 0 ? void 0 : _params_onSelectionChange.call(params, event, {\n selectedItems: nextSelectedItems\n });\n setSelected(nextSelectedItems);\n };\n return [\n selected,\n changeSelection\n ];\n}\nfunction useSingleSelection(params) {\n const [selected, changeSelection] = useSelectionState(params);\n var _selected_has;\n const methods = {\n deselectItem: (event)=>changeSelection(event, new Set()),\n selectItem: (event, itemId)=>changeSelection(event, new Set([\n itemId\n ])),\n toggleAllItems: ()=>{\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('[react-utilities]: `toggleAllItems` should not be used in single selection mode');\n }\n },\n toggleItem: (event, itemId)=>changeSelection(event, new Set([\n itemId\n ])),\n clearItems: (event)=>changeSelection(event, new Set()),\n isSelected: (itemId)=>(_selected_has = selected.has(itemId)) !== null && _selected_has !== void 0 ? _selected_has : false\n };\n return [\n selected,\n methods\n ];\n}\nfunction useMultipleSelection(params) {\n const [selected, changeSelection] = useSelectionState(params);\n const methods = {\n toggleItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n if (selected.has(itemId)) {\n nextSelectedItems.delete(itemId);\n } else {\n nextSelectedItems.add(itemId);\n }\n changeSelection(event, nextSelectedItems);\n },\n selectItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.add(itemId);\n changeSelection(event, nextSelectedItems);\n },\n deselectItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.delete(itemId);\n changeSelection(event, nextSelectedItems);\n },\n clearItems: (event)=>{\n changeSelection(event, new Set());\n },\n isSelected: (itemId)=>selected.has(itemId),\n toggleAllItems: (event, itemIds)=>{\n const allItemsSelected = itemIds.every((itemId)=>selected.has(itemId));\n const nextSelectedItems = new Set(selected);\n if (allItemsSelected) {\n nextSelectedItems.clear();\n } else {\n itemIds.forEach((itemId)=>nextSelectedItems.add(itemId));\n }\n changeSelection(event, nextSelectedItems);\n }\n };\n return [\n selected,\n methods\n ];\n}\nexport function useSelection(params) {\n if (params.selectionMode === 'multiselect') {\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useMultipleSelection(params);\n }\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useSingleSelection(params);\n}\n"],"names":["useSelection","useSelectionState","params","selected","setSelected","useControllableState","initialState","Set","defaultState","React","useMemo","defaultSelectedItems","createSetFromIterable","state","selectedItems","changeSelection","event","nextSelectedItems","_params_onSelectionChange","onSelectionChange","call","useSingleSelection","_selected_has","methods","deselectItem","selectItem","itemId","toggleAllItems","process","env","NODE_ENV","Error","toggleItem","clearItems","isSelected","has","useMultipleSelection","delete","add","itemIds","allItemsSelected","every","clear","forEach","selectionMode"],"mappings":";;;;+BA2FgBA;;aAAAA;;;6DA3FO;sCACc;uCACC;AACtC,SAASC,kBAAkBC,MAAM,EAAE;IAC/B,MAAM,CAACC,UAAUC,YAAY,GAAGC,IAAAA,0CAAoB,EAAC;QACjDC,cAAc,IAAIC;QAClBC,cA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}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Creates a set from a given iterable, in case the iterable is a set itself, returns the given set instead.
3
+ */ "use strict";
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "createSetFromIterable", {
8
+ enumerable: true,
9
+ get: ()=>createSetFromIterable
10
+ });
11
+ function createSetFromIterable(iterable) {
12
+ return iterable instanceof Set ? iterable : new Set(iterable);
13
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["createSetFromIterable.js"],"sourcesContent":["/**\n * Creates a set from a given iterable, in case the iterable is a set itself, returns the given set instead.\n */ export function createSetFromIterable(iterable) {\n return iterable instanceof Set ? iterable : new Set(iterable);\n}\n"],"names":["createSetFromIterable","iterable","Set"],"mappings":"AAAA;;CAEC;;;;+BAAmBA;;aAAAA;;AAAT,SAASA,sBAAsBC,QAAQ,EAAE;IAChD,OAAOA,oBAAoBC,MAAMD,WAAW,IAAIC,IAAID,SAAS;AACjE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-utilities",
3
- "version": "9.9.4",
3
+ "version": "9.10.1",
4
4
  "description": "A set of general React-specific utilities.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",