@mantine/spotlight 7.13.5-alpha.0 → 7.13.5-alpha.2
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/cjs/Spotlight.cjs +82 -0
- package/cjs/Spotlight.cjs.map +1 -0
- package/cjs/Spotlight.context.cjs +12 -0
- package/cjs/Spotlight.context.cjs.map +1 -0
- package/cjs/Spotlight.module.css.cjs +7 -0
- package/cjs/Spotlight.module.css.cjs.map +1 -0
- package/cjs/SpotlightAction.cjs +98 -0
- package/cjs/SpotlightAction.cjs.map +1 -0
- package/cjs/SpotlightActionsGroup.cjs +32 -0
- package/cjs/SpotlightActionsGroup.cjs.map +1 -0
- package/cjs/SpotlightActionsList.cjs +43 -0
- package/cjs/SpotlightActionsList.cjs.map +1 -0
- package/cjs/SpotlightEmpty.cjs +30 -0
- package/cjs/SpotlightEmpty.cjs.map +1 -0
- package/cjs/SpotlightFooter.cjs +30 -0
- package/cjs/SpotlightFooter.cjs.map +1 -0
- package/cjs/SpotlightRoot.cjs +125 -0
- package/cjs/SpotlightRoot.cjs.map +1 -0
- package/cjs/SpotlightSearch.cjs +63 -0
- package/cjs/SpotlightSearch.cjs.map +1 -0
- package/cjs/default-spotlight-filter.cjs +55 -0
- package/cjs/default-spotlight-filter.cjs.map +1 -0
- package/cjs/get-hotkeys.cjs +18 -0
- package/cjs/get-hotkeys.cjs.map +1 -0
- package/cjs/index.cjs +32 -0
- package/cjs/index.cjs.map +1 -0
- package/cjs/is-actions-group.cjs +10 -0
- package/cjs/is-actions-group.cjs.map +1 -0
- package/cjs/limit-actions.cjs +31 -0
- package/cjs/limit-actions.cjs.map +1 -0
- package/cjs/spotlight.store.cjs +161 -0
- package/cjs/spotlight.store.cjs.map +1 -0
- package/esm/Spotlight.context.mjs +9 -0
- package/esm/Spotlight.context.mjs.map +1 -0
- package/esm/Spotlight.mjs +80 -0
- package/esm/Spotlight.mjs.map +1 -0
- package/esm/Spotlight.module.css.mjs +5 -0
- package/esm/Spotlight.module.css.mjs.map +1 -0
- package/esm/SpotlightAction.mjs +96 -0
- package/esm/SpotlightAction.mjs.map +1 -0
- package/esm/SpotlightActionsGroup.mjs +30 -0
- package/esm/SpotlightActionsGroup.mjs.map +1 -0
- package/esm/SpotlightActionsList.mjs +41 -0
- package/esm/SpotlightActionsList.mjs.map +1 -0
- package/esm/SpotlightEmpty.mjs +28 -0
- package/esm/SpotlightEmpty.mjs.map +1 -0
- package/esm/SpotlightFooter.mjs +28 -0
- package/esm/SpotlightFooter.mjs.map +1 -0
- package/esm/SpotlightRoot.mjs +123 -0
- package/esm/SpotlightRoot.mjs.map +1 -0
- package/esm/SpotlightSearch.mjs +61 -0
- package/esm/SpotlightSearch.mjs.map +1 -0
- package/esm/default-spotlight-filter.mjs +53 -0
- package/esm/default-spotlight-filter.mjs.map +1 -0
- package/esm/get-hotkeys.mjs +16 -0
- package/esm/get-hotkeys.mjs.map +1 -0
- package/esm/index.mjs +11 -0
- package/esm/index.mjs.map +1 -0
- package/esm/is-actions-group.mjs +8 -0
- package/esm/is-actions-group.mjs.map +1 -0
- package/esm/limit-actions.mjs +29 -0
- package/esm/limit-actions.mjs.map +1 -0
- package/esm/spotlight.store.mjs +138 -0
- package/esm/spotlight.store.mjs.map +1 -0
- package/lib/Spotlight.context.d.ts +15 -0
- package/lib/Spotlight.d.ts +68 -0
- package/lib/SpotlightAction.d.ts +36 -0
- package/lib/SpotlightActionsGroup.d.ts +20 -0
- package/lib/SpotlightActionsList.d.ts +16 -0
- package/lib/SpotlightEmpty.d.ts +16 -0
- package/lib/SpotlightFooter.d.ts +16 -0
- package/lib/SpotlightRoot.d.ts +45 -0
- package/lib/SpotlightSearch.d.ts +16 -0
- package/lib/default-spotlight-filter.d.ts +2 -0
- package/lib/get-hotkeys.d.ts +3 -0
- package/lib/index.d.mts +19 -0
- package/lib/index.d.ts +19 -0
- package/lib/is-actions-group.d.ts +2 -0
- package/lib/limit-actions.d.ts +2 -0
- package/lib/spotlight.store.d.ts +53 -0
- package/package.json +6 -6
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Factory, ModalProps, ModalStylesNames, StylesApiProps } from '@mantine/core';
|
|
2
|
+
import { SpotlightStore } from './spotlight.store';
|
|
3
|
+
export type SpotlightRootStylesNames = ModalStylesNames | 'search' | 'actionsList' | 'action' | 'empty' | 'footer' | 'actionBody' | 'actionLabel' | 'actionDescription' | 'actionSection' | 'actionsGroup';
|
|
4
|
+
export interface SpotlightRootProps extends StylesApiProps<SpotlightRootFactory>, Omit<ModalProps, 'styles' | 'classNames' | 'vars' | 'variant' | 'opened' | 'onClose' | 'closeButtonProps' | 'withCloseButton'> {
|
|
5
|
+
/** Spotlight store, can be used to create multiple instances of spotlight */
|
|
6
|
+
store?: SpotlightStore;
|
|
7
|
+
/** Controlled Spotlight search query */
|
|
8
|
+
query?: string;
|
|
9
|
+
/** Called when query changes */
|
|
10
|
+
onQueryChange?: (query: string) => void;
|
|
11
|
+
/** Determines whether the search query should be cleared when the spotlight is closed, `true` by default */
|
|
12
|
+
clearQueryOnClose?: boolean;
|
|
13
|
+
/** Keyboard shortcut or a list of shortcuts to trigger spotlight, `'mod + K'` by default */
|
|
14
|
+
shortcut?: string | string[] | null;
|
|
15
|
+
/** A list of tags which when focused will be ignored by shortcut, `['input', 'textarea', 'select']` by default */
|
|
16
|
+
tagsToIgnore?: string[];
|
|
17
|
+
/** Determines whether shortcut should trigger based in contentEditable, `false` by default */
|
|
18
|
+
triggerOnContentEditable?: boolean;
|
|
19
|
+
/** If set, spotlight will not be rendered */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Called when spotlight opens */
|
|
22
|
+
onSpotlightOpen?: () => void;
|
|
23
|
+
/** Called when spotlight closes */
|
|
24
|
+
onSpotlightClose?: () => void;
|
|
25
|
+
/** Forces opened state, useful for tests */
|
|
26
|
+
forceOpened?: boolean;
|
|
27
|
+
/** Determines whether spotlight should be closed when one of the actions is triggered, `true` by default */
|
|
28
|
+
closeOnActionTrigger?: boolean;
|
|
29
|
+
/** Spotlight content max-height. Ignored unless `scrollable` prop is set. `400` by default */
|
|
30
|
+
maxHeight?: React.CSSProperties['maxHeight'];
|
|
31
|
+
/** Determines whether the actions list should be scrollable. If not set, `maxHeight` is ignored, `false` by default */
|
|
32
|
+
scrollable?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export type SpotlightRootFactory = Factory<{
|
|
35
|
+
props: SpotlightRootProps;
|
|
36
|
+
ref: HTMLDivElement;
|
|
37
|
+
stylesNames: SpotlightRootStylesNames;
|
|
38
|
+
compound: true;
|
|
39
|
+
}>;
|
|
40
|
+
export declare const SpotlightRoot: import("@mantine/core").MantineComponent<{
|
|
41
|
+
props: SpotlightRootProps;
|
|
42
|
+
ref: HTMLDivElement;
|
|
43
|
+
stylesNames: SpotlightRootStylesNames;
|
|
44
|
+
compound: true;
|
|
45
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BoxProps, CompoundStylesApiProps, ElementProps, Factory, InputProps, InputStylesNames } from '@mantine/core';
|
|
2
|
+
export type SpotlightSearchStylesNames = InputStylesNames;
|
|
3
|
+
export interface SpotlightSearchProps extends BoxProps, Omit<InputProps, 'classNames' | 'styles' | 'vars' | 'variant'>, CompoundStylesApiProps<SpotlightSearchFactory>, ElementProps<'input', 'size'> {
|
|
4
|
+
}
|
|
5
|
+
export type SpotlightSearchFactory = Factory<{
|
|
6
|
+
props: SpotlightSearchProps;
|
|
7
|
+
ref: HTMLInputElement;
|
|
8
|
+
stylesNames: SpotlightSearchStylesNames;
|
|
9
|
+
compound: true;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const SpotlightSearch: import("@mantine/core").MantineComponent<{
|
|
12
|
+
props: SpotlightSearchProps;
|
|
13
|
+
ref: HTMLInputElement;
|
|
14
|
+
stylesNames: SpotlightSearchStylesNames;
|
|
15
|
+
compound: true;
|
|
16
|
+
}>;
|
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { spotlight, createSpotlight, createSpotlightStore, useSpotlight, openSpotlight, closeSpotlight, toggleSpotlight, } from './spotlight.store';
|
|
2
|
+
export type { SpotlightState, SpotlightStore } from './spotlight.store';
|
|
3
|
+
export { isActionsGroup } from './is-actions-group';
|
|
4
|
+
export { Spotlight } from './Spotlight';
|
|
5
|
+
export { SpotlightRoot } from './SpotlightRoot';
|
|
6
|
+
export { SpotlightAction } from './SpotlightAction';
|
|
7
|
+
export { SpotlightActionsGroup } from './SpotlightActionsGroup';
|
|
8
|
+
export { SpotlightActionsList } from './SpotlightActionsList';
|
|
9
|
+
export { SpotlightEmpty } from './SpotlightEmpty';
|
|
10
|
+
export { SpotlightFooter } from './SpotlightFooter';
|
|
11
|
+
export { SpotlightSearch } from './SpotlightSearch';
|
|
12
|
+
export type { SpotlightFactory, SpotlightFilterFunction, SpotlightActionData, SpotlightActionGroupData, SpotlightProps, SpotlightStylesNames, } from './Spotlight';
|
|
13
|
+
export type { SpotlightActionProps, SpotlightActionStylesNames } from './SpotlightAction';
|
|
14
|
+
export type { SpotlightActionsGroupProps, SpotlightActionsGroupStylesNames, } from './SpotlightActionsGroup';
|
|
15
|
+
export type { SpotlightActionsListProps, SpotlightActionsListStylesNames, } from './SpotlightActionsList';
|
|
16
|
+
export type { SpotlightEmptyProps, SpotlightEmptyStylesNames } from './SpotlightEmpty';
|
|
17
|
+
export type { SpotlightFooterProps, SpotlightFooterStylesNames } from './SpotlightFooter';
|
|
18
|
+
export type { SpotlightSearchProps, SpotlightSearchStylesNames } from './SpotlightSearch';
|
|
19
|
+
export type { SpotlightRootProps, SpotlightRootStylesNames } from './SpotlightRoot';
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { spotlight, createSpotlight, createSpotlightStore, useSpotlight, openSpotlight, closeSpotlight, toggleSpotlight, } from './spotlight.store';
|
|
2
|
+
export type { SpotlightState, SpotlightStore } from './spotlight.store';
|
|
3
|
+
export { isActionsGroup } from './is-actions-group';
|
|
4
|
+
export { Spotlight } from './Spotlight';
|
|
5
|
+
export { SpotlightRoot } from './SpotlightRoot';
|
|
6
|
+
export { SpotlightAction } from './SpotlightAction';
|
|
7
|
+
export { SpotlightActionsGroup } from './SpotlightActionsGroup';
|
|
8
|
+
export { SpotlightActionsList } from './SpotlightActionsList';
|
|
9
|
+
export { SpotlightEmpty } from './SpotlightEmpty';
|
|
10
|
+
export { SpotlightFooter } from './SpotlightFooter';
|
|
11
|
+
export { SpotlightSearch } from './SpotlightSearch';
|
|
12
|
+
export type { SpotlightFactory, SpotlightFilterFunction, SpotlightActionData, SpotlightActionGroupData, SpotlightProps, SpotlightStylesNames, } from './Spotlight';
|
|
13
|
+
export type { SpotlightActionProps, SpotlightActionStylesNames } from './SpotlightAction';
|
|
14
|
+
export type { SpotlightActionsGroupProps, SpotlightActionsGroupStylesNames, } from './SpotlightActionsGroup';
|
|
15
|
+
export type { SpotlightActionsListProps, SpotlightActionsListStylesNames, } from './SpotlightActionsList';
|
|
16
|
+
export type { SpotlightEmptyProps, SpotlightEmptyStylesNames } from './SpotlightEmpty';
|
|
17
|
+
export type { SpotlightFooterProps, SpotlightFooterStylesNames } from './SpotlightFooter';
|
|
18
|
+
export type { SpotlightSearchProps, SpotlightSearchStylesNames } from './SpotlightSearch';
|
|
19
|
+
export type { SpotlightRootProps, SpotlightRootStylesNames } from './SpotlightRoot';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { MantineStore } from '@mantine/store';
|
|
2
|
+
export interface SpotlightState {
|
|
3
|
+
opened: boolean;
|
|
4
|
+
selected: number;
|
|
5
|
+
listId: string;
|
|
6
|
+
query: string;
|
|
7
|
+
empty: boolean;
|
|
8
|
+
registeredActions: Set<string>;
|
|
9
|
+
}
|
|
10
|
+
export type SpotlightStore = MantineStore<SpotlightState>;
|
|
11
|
+
export declare const createSpotlightStore: () => MantineStore<SpotlightState>;
|
|
12
|
+
export declare const useSpotlight: (store: SpotlightStore) => SpotlightState;
|
|
13
|
+
export declare function updateSpotlightStateAction(update: (state: SpotlightState) => Partial<SpotlightState>, store: SpotlightStore): void;
|
|
14
|
+
export declare function openSpotlightAction(store: SpotlightStore): void;
|
|
15
|
+
export declare function closeSpotlightAction(store: SpotlightStore): void;
|
|
16
|
+
export declare function toggleSpotlightAction(store: SpotlightStore): void;
|
|
17
|
+
export declare function setSelectedAction(index: number, store: SpotlightStore): void;
|
|
18
|
+
export declare function setListId(id: string, store: SpotlightStore): void;
|
|
19
|
+
export declare function selectAction(index: number, store: SpotlightStore): number;
|
|
20
|
+
export declare function selectNextAction(store: SpotlightStore): number;
|
|
21
|
+
export declare function selectPreviousAction(store: SpotlightStore): number;
|
|
22
|
+
export declare function triggerSelectedAction(store: SpotlightStore): void;
|
|
23
|
+
export declare function registerAction(id: string, store: SpotlightStore): () => void;
|
|
24
|
+
export declare function setQuery(query: string, store: SpotlightStore): void;
|
|
25
|
+
export declare function clearSpotlightState({ clearQuery }: {
|
|
26
|
+
clearQuery: boolean | undefined;
|
|
27
|
+
}, store: SpotlightStore): void;
|
|
28
|
+
export declare const spotlightActions: {
|
|
29
|
+
open: typeof openSpotlightAction;
|
|
30
|
+
close: typeof closeSpotlightAction;
|
|
31
|
+
toggle: typeof toggleSpotlightAction;
|
|
32
|
+
updateState: typeof updateSpotlightStateAction;
|
|
33
|
+
setSelectedAction: typeof setSelectedAction;
|
|
34
|
+
setListId: typeof setListId;
|
|
35
|
+
selectAction: typeof selectAction;
|
|
36
|
+
selectNextAction: typeof selectNextAction;
|
|
37
|
+
selectPreviousAction: typeof selectPreviousAction;
|
|
38
|
+
triggerSelectedAction: typeof triggerSelectedAction;
|
|
39
|
+
registerAction: typeof registerAction;
|
|
40
|
+
setQuery: typeof setQuery;
|
|
41
|
+
clearSpotlightState: typeof clearSpotlightState;
|
|
42
|
+
};
|
|
43
|
+
export declare function createSpotlight(): readonly [MantineStore<SpotlightState>, {
|
|
44
|
+
open: () => void;
|
|
45
|
+
close: () => void;
|
|
46
|
+
toggle: () => void;
|
|
47
|
+
}];
|
|
48
|
+
export declare const spotlightStore: MantineStore<SpotlightState>, spotlight: {
|
|
49
|
+
open: () => void;
|
|
50
|
+
close: () => void;
|
|
51
|
+
toggle: () => void;
|
|
52
|
+
};
|
|
53
|
+
export declare const openSpotlight: () => void, closeSpotlight: () => void, toggleSpotlight: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantine/spotlight",
|
|
3
|
-
"version": "7.13.5-alpha.
|
|
3
|
+
"version": "7.13.5-alpha.2",
|
|
4
4
|
"description": "Command center components for react and Mantine",
|
|
5
5
|
"homepage": "https://mantine.dev",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"directory": "packages/@mantine/spotlight"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@mantine/core": "7.13.5-alpha.
|
|
45
|
-
"@mantine/hooks": "7.13.5-alpha.
|
|
46
|
-
"react": "^18.
|
|
47
|
-
"react-dom": "^18.
|
|
44
|
+
"@mantine/core": "7.13.5-alpha.2",
|
|
45
|
+
"@mantine/hooks": "7.13.5-alpha.2",
|
|
46
|
+
"react": "^18.x || ^19.x",
|
|
47
|
+
"react-dom": "^18.x || ^19.x"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@mantine/store": "7.13.5-alpha.
|
|
50
|
+
"@mantine/store": "7.13.5-alpha.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@mantine-tests/core": "workspace:*",
|