@k8slens/element-components 3.4.0 → 3.6.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.
@@ -1,9 +1,5 @@
1
1
  import type React from "react";
2
2
  export declare const sharedPlugins: (import("@k8slens/element-component").Plugin<import("..").DroppablePluginProps, unknown> | import("@k8slens/element-component").Plugin<import("./plugins/on-outside-click/on-outside-click").OnOutsideClickPluginProps, unknown> | import("@k8slens/element-component").Plugin<{
3
- $className?: import("@k8slens/public-utilities").IClassName;
4
- className?: string;
5
- $block?: boolean | "inline";
6
- }, unknown> | import("@k8slens/element-component").Plugin<{
7
3
  $className?: import("@k8slens/public-utilities").IClassName;
8
4
  className?: string;
9
5
  $cursor?: import("./plugins/cursor/cursor").$CursorProps;
@@ -113,6 +109,10 @@ export declare const sharedPlugins: (import("@k8slens/element-component").Plugin
113
109
  $className?: import("@k8slens/public-utilities").IClassName;
114
110
  className?: string;
115
111
  $grid?: import("./plugins/grid/grid").GridProps;
112
+ }, unknown> | import("@k8slens/element-component").Plugin<{
113
+ $className?: import("@k8slens/public-utilities").IClassName;
114
+ className?: string;
115
+ $block?: boolean | "inline";
116
116
  }, unknown> | import("@k8slens/element-component").Plugin<{
117
117
  $className?: import("@k8slens/public-utilities").IClassName;
118
118
  className?: string;
@@ -862,9 +862,9 @@ export declare const ClickableDiv: import("@k8slens/element-component").ElementC
862
862
  };
863
863
  readonly $anchor?: boolean;
864
864
  readonly $anchoredAt?: import("./plugins/anchor/anchor").AnchoredAt;
865
+ readonly children?: React.ReactNode;
865
866
  readonly $onOutsideClick?: (event: PointerEvent) => void;
866
- children?: React.ReactNode;
867
- readonly tabIndex?: number;
867
+ tabIndex?: number;
868
868
  readonly $dropDownMenu?: import("@k8slens/drop-down-menu-contracts").DropDownMenuSpec;
869
869
  $textAlign?: "left" | "center" | "right";
870
870
  $ref?: ((import("./plugins/ref/ref").$RefProp<any>[] | React.MutableRefObject<any> | ((instance: any) => undefined | void | (() => any)) | React.RefObject<any>) & (import("./plugins/ref/ref").$RefProp<HTMLDivElement>[] | React.MutableRefObject<HTMLDivElement | null> | ((instance: HTMLDivElement | null) => undefined | void | (() => any)) | React.RefObject<HTMLDivElement>)) | undefined;
@@ -1151,9 +1151,9 @@ export declare const Button: import("@k8slens/element-component").ElementCompone
1151
1151
  };
1152
1152
  readonly $anchor?: boolean;
1153
1153
  readonly $anchoredAt?: import("./plugins/anchor/anchor").AnchoredAt;
1154
+ readonly children?: React.ReactNode;
1154
1155
  readonly $onOutsideClick?: (event: PointerEvent) => void;
1155
- children?: React.ReactNode;
1156
- readonly tabIndex?: number;
1156
+ tabIndex?: number;
1157
1157
  readonly $dropDownMenu?: import("@k8slens/drop-down-menu-contracts").DropDownMenuSpec;
1158
1158
  $textAlign?: "left" | "center" | "right";
1159
1159
  $ref?: ((import("./plugins/ref/ref").$RefProp<any>[] | React.MutableRefObject<any> | ((instance: any) => undefined | void | (() => any)) | React.RefObject<any>) & (import("./plugins/ref/ref").$RefProp<HTMLButtonElement>[] | React.MutableRefObject<HTMLButtonElement | null> | ((instance: HTMLButtonElement | null) => undefined | void | (() => any)) | React.RefObject<HTMLButtonElement>)) | undefined;
@@ -2462,9 +2462,9 @@ export declare const ClickableLi: import("@k8slens/element-component").ElementCo
2462
2462
  };
2463
2463
  readonly $anchor?: boolean;
2464
2464
  readonly $anchoredAt?: import("./plugins/anchor/anchor").AnchoredAt;
2465
+ readonly children?: React.ReactNode;
2465
2466
  readonly $onOutsideClick?: (event: PointerEvent) => void;
2466
- children?: React.ReactNode;
2467
- readonly tabIndex?: number;
2467
+ tabIndex?: number;
2468
2468
  readonly $dropDownMenu?: import("@k8slens/drop-down-menu-contracts").DropDownMenuSpec;
2469
2469
  $textAlign?: "left" | "center" | "right";
2470
2470
  $ref?: ((import("./plugins/ref/ref").$RefProp<any>[] | React.MutableRefObject<any> | ((instance: any) => undefined | void | (() => any)) | React.RefObject<any>) & (import("./plugins/ref/ref").$RefProp<HTMLLIElement>[] | React.MutableRefObject<HTMLLIElement | null> | ((instance: HTMLLIElement | null) => undefined | void | (() => any)) | React.RefObject<HTMLLIElement>)) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../../../src/plugins/anchor/anchor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,kBAAkB,CAAC;AASvE;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GACtB,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,eAAe,GACf,gBAAgB,GAChB,kBAAkB,GAClB,mBAAmB,GACnB,eAAe,GACf,kBAAkB,GAClB,gBAAgB,GAChB,mBAAmB,CAAC;AAExB;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB,cAAc,GACd;IACE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAElC,oEAAoE;IACpE,QAAQ,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC;IAE1B,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;CAC7B,CAAC;AAIN,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEpC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;CACnC,CAAC;AAuHF,eAAO,MAAM,YAAY;;;;;;;;;;;;;wBAvIH,KAAK,CAAC,SAAS;uBAMhB,OAAO;2BASH,UAAU;WAqKjC,CAAC"}
1
+ {"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../../../src/plugins/anchor/anchor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,kBAAkB,CAAC;AASvE;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GACtB,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,eAAe,GACf,gBAAgB,GAChB,kBAAkB,GAClB,mBAAmB,GACnB,eAAe,GACf,kBAAkB,GAClB,gBAAgB,GAChB,mBAAmB,CAAC;AAExB;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB,cAAc,GACd;IACE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAElC,oEAAoE;IACpE,QAAQ,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC;IAE1B,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;CAC7B,CAAC;AAIN,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEpC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;CACnC,CAAC;AAqJF,eAAO,MAAM,YAAY;;;;;;;;;;;;;wBArKH,KAAK,CAAC,SAAS;uBAMhB,OAAO;2BASH,UAAU;WAmMjC,CAAC"}
@@ -4,6 +4,7 @@ export type BackgroundColor = Color | BackgroundColorAlias;
4
4
  export type $BackgroundColorProps = {
5
5
  normal?: BackgroundColor;
6
6
  hover?: BackgroundColor;
7
+ focus?: BackgroundColor;
7
8
  };
8
9
  export type BackgroundColorPluginProps = {
9
10
  $backgroundColor?: BackgroundColor | $BackgroundColorProps;
@@ -1 +1 @@
1
- {"version":3,"file":"background-color.d.ts","sourceRoot":"","sources":["../../../../src/plugins/background-color/background-color.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,cAAc,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,oBAAoB,CAAC;AAE3D,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IAAE,gBAAgB,CAAC,EAAE,eAAe,GAAG,qBAAqB,CAAA;CAAE,CAAC;AAExG,QAAA,MAAM,cAAc;aAClB,iBAAiB,EAAE,QAAQ;aAC3B,mBAAmB,EAAE,SAAS;aAC9B,uBAAuB,EAAE,eAAe;CAChC,CAAC;AAIX,eAAO,MAAM,qBAAqB;;;uBAV4B,eAAe,GAAG,qBAAqB;WAyBnG,CAAC"}
1
+ {"version":3,"file":"background-color.d.ts","sourceRoot":"","sources":["../../../../src/plugins/background-color/background-color.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,cAAc,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,oBAAoB,CAAC;AAE3D,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IAAE,gBAAgB,CAAC,EAAE,eAAe,GAAG,qBAAqB,CAAA;CAAE,CAAC;AAExG,QAAA,MAAM,cAAc;aAClB,iBAAiB,EAAE,QAAQ;aAC3B,mBAAmB,EAAE,SAAS;aAC9B,uBAAuB,EAAE,eAAe;CAChC,CAAC;AAIX,eAAO,MAAM,qBAAqB;;;uBAV4B,eAAe,GAAG,qBAAqB;WA2BnG,CAAC"}
@@ -3,6 +3,7 @@ export type TextColor = Color | TextColorAlias;
3
3
  export type $ColorProps = {
4
4
  readonly normal?: TextColor;
5
5
  readonly hover?: TextColor;
6
+ readonly focus?: TextColor;
6
7
  readonly disabled?: TextColor;
7
8
  };
8
9
  export type ColorPluginProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../../src/plugins/color/color.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,cAAc,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,WAAW,CAAA;CAAE,CAAC;AAC7E,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,cAAc,CAAC;AAEzD,QAAA,MAAM,cAAc;aAClB,SAAS,EAAE,QAAQ;aACnB,WAAW,EAAE,QAAQ;aACrB,aAAa,EAAE,QAAQ;CACf,CAAC;AAIX,eAAO,MAAM,WAAW;;;sBAX2B,SAAS,GAAG,WAAW;WA4BxE,CAAC"}
1
+ {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../../src/plugins/color/color.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,cAAc,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,WAAW,CAAA;CAAE,CAAC;AAC7E,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,cAAc,CAAC;AAEzD,QAAA,MAAM,cAAc;aAClB,SAAS,EAAE,QAAQ;aACnB,WAAW,EAAE,QAAQ;aACrB,aAAa,EAAE,QAAQ;CACf,CAAC;AAIX,eAAO,MAAM,WAAW;;;sBAX2B,SAAS,GAAG,WAAW;WA8BxE,CAAC"}
@@ -11,10 +11,24 @@ export type DropDownMenuPluginProps = {
11
11
  * The menu positions itself against the nearest anchor around it, so the element — or something
12
12
  * enclosing it — declares `$anchor`.
13
13
  *
14
+ * Focus returns to the element once the menu is gone. A menu that opens on hovering opens with
15
+ * ArrowRight as well, and closes with ArrowLeft from anywhere within it, so a menu held by a menu
16
+ * row is reachable without a pointer.
17
+ *
14
18
  * Requires `dropDownMenuFeature` of `@lensapp/drop-down-menu` to be registered: the menu
15
19
  * component is resolved through an injection token this package does not implement.
16
20
  */
17
21
  readonly $dropDownMenu?: DropDownMenuSpec;
18
22
  };
19
- export declare const dropDownMenuPlugin: import("@k8slens/element-component").Plugin<DropDownMenuPluginProps, unknown>;
23
+ export declare const dropDownMenuPlugin: import("@k8slens/element-component").Plugin<{
24
+ $className?: import("@k8slens/public-utilities").IClassName;
25
+ className?: string;
26
+ $enabled?: boolean;
27
+ $disabled?: boolean;
28
+ disabled?: undefined;
29
+ $cursor?: import("../cursor/cursor").$CursorProps;
30
+ readonly children?: React.ReactNode;
31
+ readonly tabIndex?: number;
32
+ readonly $dropDownMenu?: DropDownMenuSpec;
33
+ }, unknown>;
20
34
  //# sourceMappingURL=drop-down-menu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"drop-down-menu.d.ts","sourceRoot":"","sources":["../../../../src/plugins/drop-down-menu/drop-down-menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGxF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAC;CAC3C,CAAC;AA8HF,eAAO,MAAM,kBAAkB,+EAiB7B,CAAC"}
1
+ {"version":3,"file":"drop-down-menu.d.ts","sourceRoot":"","sources":["../../../../src/plugins/drop-down-menu/drop-down-menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGxF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAC;CAC3C,CAAC;AAsNF,eAAO,MAAM,kBAAkB;;;;;;;wBAzOT,KAAK,CAAC,SAAS;wBACf,MAAM;6BAiBD,gBAAgB;WAwP1C,CAAC"}
@@ -1,8 +1,9 @@
1
- import type { IObservableValue } from "mobx";
2
1
  import type { KeyboardNavigableFocusableContext } from "../get-focusable-context";
3
2
  type KeyboardNavigation = {
4
3
  readonly onKeyDown: (event: React.KeyboardEvent) => void;
4
+ readonly onFocus: () => void;
5
+ readonly focusWhatThePointerIsOn: (event: React.MouseEvent) => void;
5
6
  };
6
- export declare const useKeyboardNavigation: (context: KeyboardNavigableFocusableContext<any> | undefined, item: unknown, orderNumber: number | undefined, element: HTMLElement | null, state: IObservableValue<unknown>) => KeyboardNavigation;
7
+ export declare const useKeyboardNavigation: (context: KeyboardNavigableFocusableContext<any> | undefined, item: unknown, orderNumber: number | undefined, element: HTMLElement | null) => KeyboardNavigation;
7
8
  export {};
8
9
  //# sourceMappingURL=use-keyboard-navigation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-keyboard-navigation.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/focusable/_private/use-keyboard-navigation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AAK7C,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,0BAA0B,CAAC;AAElF,KAAK,kBAAkB,GAAG;IACxB,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;CAC1D,CAAC;AAIF,eAAO,MAAM,qBAAqB,YACvB,iCAAiC,CAAC,GAAG,CAAC,GAAG,SAAS,QACrD,OAAO,eACA,MAAM,GAAG,SAAS,WACtB,WAAW,GAAG,IAAI,SACpB,gBAAgB,CAAC,OAAO,CAAC,KAC/B,kBA0EF,CAAC"}
1
+ {"version":3,"file":"use-keyboard-navigation.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/focusable/_private/use-keyboard-navigation.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iCAAiC,EAAiC,MAAM,0BAA0B,CAAC;AAEjH,KAAK,kBAAkB,GAAG;IACxB,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAC7B,QAAQ,CAAC,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CACrE,CAAC;AAQF,eAAO,MAAM,qBAAqB,YACvB,iCAAiC,CAAC,GAAG,CAAC,GAAG,SAAS,QACrD,OAAO,eACA,MAAM,GAAG,SAAS,WACtB,WAAW,GAAG,IAAI,KAC1B,kBAmGF,CAAC"}
@@ -6,12 +6,16 @@ export type NavigableEntry = {
6
6
  };
7
7
  type NavigableContext = KeyboardNavigableFocusableContext<any>;
8
8
  /**
9
- * The members of every keyboard-navigable context, and the order the contexts appeared in. Focus
10
- * belongs to the context that appeared last; when it goes away, the previous one takes it back.
9
+ * The members of every keyboard-navigable context, the order the contexts appeared in, and which
10
+ * member of each had focus. Focus belongs to the context that appeared last; when it goes away, the
11
+ * previous one takes it back — at the member it was left on, which is what makes stepping into
12
+ * something and back out of it land where it started rather than at the beginning.
11
13
  */
12
14
  export declare const keyboardNavigationStateInjectable: import("@k8slens/injectable").Injectable2<() => {
13
15
  sortedEntriesOf: (context: NavigableContext) => NavigableEntry[];
14
16
  contextInFocus: () => NavigableContext | undefined;
17
+ itemInFocusOf: (context: NavigableContext) => unknown;
18
+ noteItemInFocus: (context: NavigableContext, item: unknown) => void;
15
19
  register: (context: NavigableContext, entry: NavigableEntry) => void;
16
20
  deregister: (context: NavigableContext, entry: NavigableEntry) => void;
17
21
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"keyboard-navigation-state.injectable.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/focusable/_shared/keyboard-navigation-state.injectable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,0BAA0B,CAAC;AAElF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;CAC/B,CAAC;AAEF,KAAK,gBAAgB,GAAG,iCAAiC,CAAC,GAAG,CAAC,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,iCAAiC;+BAsBb,gBAAgB;;wBAKvB,gBAAgB,SAAS,cAAc;0BAUrC,gBAAgB,SAAS,cAAc;EAejE,CAAC"}
1
+ {"version":3,"file":"keyboard-navigation-state.injectable.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/focusable/_shared/keyboard-navigation-state.injectable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,0BAA0B,CAAC;AAElF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;CAC/B,CAAC;AAEF,KAAK,gBAAgB,GAAG,iCAAiC,CAAC,GAAG,CAAC,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC;+BAuBb,gBAAgB;;6BAKlB,gBAAgB;+BAEd,gBAAgB,QAAQ,OAAO;wBAItC,gBAAgB,SAAS,cAAc;0BAUrC,gBAAgB,SAAS,cAAc;EAmBjE,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Carries the focusable an element is, as decided by the surface it renders in rather than by the
3
+ * element itself: which context it competes in, which item it stands for, and where it sits among
4
+ * the others.
5
+ *
6
+ * A surface that knows its items — a menu, a toolbar — provides one of these per item; whatever
7
+ * draws the item adopts it through {@link useFocusableItem} while knowing nothing about the
8
+ * surface, which is what lets a dumb component be keyboard-navigable in one surface and ordinary
9
+ * in another.
10
+ */
11
+ export declare const contextForFocusableItem: import("react").Context<{
12
+ context: import("./get-focusable-context").AnyFocusableContext<any>;
13
+ item: any;
14
+ orderNumber?: number;
15
+ } | undefined>;
16
+ /**
17
+ * The `$focusable` of the item a component draws, when the surface around it decided one.
18
+ * `undefined` outside such a surface, which is what makes adopting it a matter of passing it on.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * const Row = ({ children }: { children: React.ReactNode }) => (
23
+ * <ClickableLi $focusable={useFocusableItem()}>{children}</ClickableLi>
24
+ * );
25
+ * ```
26
+ */
27
+ export declare const useFocusableItem: () => {
28
+ context: import("./get-focusable-context").AnyFocusableContext<any>;
29
+ item: any;
30
+ orderNumber?: number;
31
+ } | undefined;
32
+ //# sourceMappingURL=focusable-item-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focusable-item-context.d.ts","sourceRoot":"","sources":["../../../../src/plugins/focusable/focusable-item-context.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB;;;;cAA6D,CAAC;AAElG;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB;;;;aAA4C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"focusable.d.ts","sourceRoot":"","sources":["../../../../src/plugins/focusable/focusable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAOnE,MAAM,MAAM,oBAAoB,CAAC,CAAC,EAAE,WAAW,GAAG,GAAG,IAAI;IACvD,UAAU,CAAC,EAAE;QACX,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;QAC1C,IAAI,EAAE,WAAW,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IAEF,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;CACpC,CAAC;AA+EF,wBAAgB,eAAe,CAAC,CAAC;;;;;;sBAtFf,MAAM;;;;;eAMX,WAAW,CAAC,UAAU,CAAC;YAsGnC"}
1
+ {"version":3,"file":"focusable.d.ts","sourceRoot":"","sources":["../../../../src/plugins/focusable/focusable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAOnE,MAAM,MAAM,oBAAoB,CAAC,CAAC,EAAE,WAAW,GAAG,GAAG,IAAI;IACvD,UAAU,CAAC,EAAE;QACX,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;QAC1C,IAAI,EAAE,WAAW,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IAEF,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;CACpC,CAAC;AAkFF,wBAAgB,eAAe,CAAC,CAAC;;;;;;sBAzFf,MAAM;;;;;eAMX,WAAW,CAAC,UAAU,CAAC;YAyGnC"}
@@ -9,6 +9,8 @@ export type FocusableContext<FocusedItem> = {
9
9
  readonly isKeyboardNavigable: false;
10
10
  focusable: (item: FocusedItem) => $FocusableProps<FocusedItem>;
11
11
  };
12
+ /** Which arrow keys move focus within a keyboard-navigable context. */
13
+ export type KeyboardNavigationOrientation = "vertical" | "horizontal" | "both";
12
14
  /**
13
15
  * A focusable context whose members are also navigated with arrow keys, in the order they state.
14
16
  * The lowest order number is focused when the members appear, and focus returns to the enclosing
@@ -17,6 +19,7 @@ export type FocusableContext<FocusedItem> = {
17
19
  export type KeyboardNavigableFocusableContext<FocusedItem> = {
18
20
  readonly id: string;
19
21
  readonly isKeyboardNavigable: true;
22
+ readonly orientation: KeyboardNavigationOrientation;
20
23
  focusable: (item: FocusedItem, orderNumber: number) => $FocusableProps<FocusedItem>;
21
24
  };
22
25
  export type AnyFocusableContext<FocusedItem = any> = FocusableContext<FocusedItem> | KeyboardNavigableFocusableContext<FocusedItem>;
@@ -26,8 +29,18 @@ export type AnyFocusableContext<FocusedItem = any> = FocusableContext<FocusedIte
26
29
  * instance.
27
30
  */
28
31
  export declare const getFocusableContext: <FocusedItem>(id: string) => FocusableContext<FocusedItem>;
32
+ export type KeyboardNavigableFocusableContextOptions = {
33
+ /**
34
+ * Which arrow keys move focus. Downwards by default, as most sets of things are laid out: the
35
+ * keys of the other axis are then left to whatever the members want them for, such as a menu row
36
+ * opening the menu it holds with ArrowRight.
37
+ */
38
+ readonly orientation?: KeyboardNavigationOrientation;
39
+ };
29
40
  /**
30
- * Declares a focusable context whose members are navigated with arrow keys.
41
+ * Declares a focusable context whose members are navigated with arrow keys. As with
42
+ * {@link getFocusableContext}, the same id always yields the same context — so the options are the
43
+ * ones the first call for an id stated.
31
44
  */
32
- export declare const getKeyboardNavigableFocusableContext: <FocusedItem>(id: string) => KeyboardNavigableFocusableContext<FocusedItem>;
45
+ export declare const getKeyboardNavigableFocusableContext: <FocusedItem>(id: string, options?: KeyboardNavigableFocusableContextOptions) => KeyboardNavigableFocusableContext<FocusedItem>;
33
46
  //# sourceMappingURL=get-focusable-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-focusable-context.d.ts","sourceRoot":"","sources":["../../../../src/plugins/focusable/get-focusable-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,eAAe,CAAC,WAAW,IAAI,QAAQ,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;AAErG;;;GAGG;AAC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