@geckoui/geckoui 2.0.5 → 2.1.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
@@ -8,6 +8,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
8
8
  * Reuseable hook to detect clicks outside of a ref element that is passed as an argument
9
9
  * @param handler - Function to be called when a click is detected outside of the component
10
10
  * @param refs - Ref objects to be checked for clicks outside
11
+ * @param open - Pass the overlay's open state to make it a layer: while open it only reacts
12
+ * when it is the topmost open overlay, so a menu inside a drawer closes without the drawer
11
13
  * @returns void
12
14
  * @example
13
15
  *
@@ -25,7 +27,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
25
27
  * );
26
28
  * ```
27
29
  */
28
- declare const useClickOutside: <T extends HTMLElement>(handler?: (event: Event | MouseEvent | TouchEvent) => void, refs?: RefObject<T | null>[]) => void;
30
+ declare const useClickOutside: <T extends HTMLElement>(handler?: (event: Event | MouseEvent | TouchEvent) => void, refs?: RefObject<T | null>[], open?: boolean) => void;
29
31
 
30
32
  interface FilePickerFile extends File {
31
33
  /** Preview URL of the file */
@@ -3115,6 +3117,15 @@ interface BaseSelectProps extends PropsWithChildren, SelectButtonProps {
3115
3117
  * Default is false
3116
3118
  * */
3117
3119
  filterable?: boolean | "inline" | "dropdown";
3120
+ /**
3121
+ * Focus the dropdown search box when the menu opens.
3122
+ * Off by default: on a phone, focusing it pops up the keyboard over the options.
3123
+ * Typing on a keyboard while the select is focused still moves into the search box.
3124
+ * Only for `filterable` / `"dropdown"`; `"inline"` always focuses, since that is where
3125
+ * you type.
3126
+ * Default is false
3127
+ * */
3128
+ autoFocusSearch?: boolean;
3118
3129
  /**
3119
3130
  * Whether to close the menu when an option is selected
3120
3131
  * Default is true for single select and false for multi select
@@ -3213,6 +3224,14 @@ interface SelectContextProps<T> extends Pick<BaseSelectProps, "disabled" | "pref
3213
3224
  * If you use custom `SelectButton` you should bind this to the input
3214
3225
  * */
3215
3226
  keyword: string;
3227
+ /**
3228
+ * Bumped when the dropdown search box should take focus
3229
+ * */
3230
+ searchFocusRequest: number;
3231
+ /**
3232
+ * Move focus into the dropdown search box
3233
+ * */
3234
+ requestSearchFocus: () => void;
3216
3235
  /**
3217
3236
  * Setter for filter keyword
3218
3237
  * */
package/dist/index.d.ts CHANGED
@@ -8,6 +8,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
8
8
  * Reuseable hook to detect clicks outside of a ref element that is passed as an argument
9
9
  * @param handler - Function to be called when a click is detected outside of the component
10
10
  * @param refs - Ref objects to be checked for clicks outside
11
+ * @param open - Pass the overlay's open state to make it a layer: while open it only reacts
12
+ * when it is the topmost open overlay, so a menu inside a drawer closes without the drawer
11
13
  * @returns void
12
14
  * @example
13
15
  *
@@ -25,7 +27,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
25
27
  * );
26
28
  * ```
27
29
  */
28
- declare const useClickOutside: <T extends HTMLElement>(handler?: (event: Event | MouseEvent | TouchEvent) => void, refs?: RefObject<T | null>[]) => void;
30
+ declare const useClickOutside: <T extends HTMLElement>(handler?: (event: Event | MouseEvent | TouchEvent) => void, refs?: RefObject<T | null>[], open?: boolean) => void;
29
31
 
30
32
  interface FilePickerFile extends File {
31
33
  /** Preview URL of the file */
@@ -3115,6 +3117,15 @@ interface BaseSelectProps extends PropsWithChildren, SelectButtonProps {
3115
3117
  * Default is false
3116
3118
  * */
3117
3119
  filterable?: boolean | "inline" | "dropdown";
3120
+ /**
3121
+ * Focus the dropdown search box when the menu opens.
3122
+ * Off by default: on a phone, focusing it pops up the keyboard over the options.
3123
+ * Typing on a keyboard while the select is focused still moves into the search box.
3124
+ * Only for `filterable` / `"dropdown"`; `"inline"` always focuses, since that is where
3125
+ * you type.
3126
+ * Default is false
3127
+ * */
3128
+ autoFocusSearch?: boolean;
3118
3129
  /**
3119
3130
  * Whether to close the menu when an option is selected
3120
3131
  * Default is true for single select and false for multi select
@@ -3213,6 +3224,14 @@ interface SelectContextProps<T> extends Pick<BaseSelectProps, "disabled" | "pref
3213
3224
  * If you use custom `SelectButton` you should bind this to the input
3214
3225
  * */
3215
3226
  keyword: string;
3227
+ /**
3228
+ * Bumped when the dropdown search box should take focus
3229
+ * */
3230
+ searchFocusRequest: number;
3231
+ /**
3232
+ * Move focus into the dropdown search box
3233
+ * */
3234
+ requestSearchFocus: () => void;
3216
3235
  /**
3217
3236
  * Setter for filter keyword
3218
3237
  * */