@mantine/spotlight 4.0.7 → 4.0.8
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/SpotlightProvider.js +4 -1
- package/cjs/SpotlightProvider.js.map +1 -1
- package/cjs/use-actions-state/use-actions-state.js +2 -0
- package/cjs/use-actions-state/use-actions-state.js.map +1 -1
- package/esm/SpotlightProvider.js +5 -2
- package/esm/SpotlightProvider.js.map +1 -1
- package/esm/use-actions-state/use-actions-state.js +2 -0
- package/esm/use-actions-state/use-actions-state.js.map +1 -1
- package/lib/SpotlightProvider.d.ts.map +1 -1
- package/lib/use-actions-state/use-actions-state.d.ts +1 -0
- package/lib/use-actions-state/use-actions-state.d.ts.map +1 -1
- package/package.json +3 -3
package/cjs/SpotlightProvider.js
CHANGED
|
@@ -63,7 +63,10 @@ function SpotlightProvider(_a) {
|
|
|
63
63
|
]);
|
|
64
64
|
const timeoutRef = React.useRef(-1);
|
|
65
65
|
const [query, setQuery] = React.useState("");
|
|
66
|
-
const [actions, { registerActions, removeActions, triggerAction }] = useActionsState.useActionsState(initialActions, query);
|
|
66
|
+
const [actions, { registerActions, updateActions, removeActions, triggerAction }] = useActionsState.useActionsState(initialActions, query);
|
|
67
|
+
hooks.useDidUpdate(() => {
|
|
68
|
+
updateActions(initialActions);
|
|
69
|
+
}, [initialActions]);
|
|
67
70
|
const handleQueryChange = (value) => {
|
|
68
71
|
setQuery(value);
|
|
69
72
|
onQueryChange == null ? void 0 : onQueryChange(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpotlightProvider.js","sources":["../src/SpotlightProvider.tsx"],"sourcesContent":["import React, { useState, useRef } from 'react';\nimport { useDisclosure } from '@mantine/hooks';\nimport { useActionsState } from './use-actions-state/use-actions-state';\nimport { useSpotlightShortcuts } from './use-spotlight-shortcuts/use-spotlight-shortcuts';\nimport { Spotlight, InnerSpotlightProps } from './Spotlight/Spotlight';\nimport type { SpotlightAction } from './types';\nimport { SpotlightContext } from './Spotlight.context';\n\nexport interface SpotlightProviderProps extends InnerSpotlightProps {\n /** Actions list */\n actions: SpotlightAction[] | ((query: string) => SpotlightAction[]);\n\n /** Your application */\n children?: React.ReactNode;\n\n /** Called when spotlight opens */\n onSpotlightOpen?(): void;\n\n /** Called when spotlight closes */\n onSpotlightClose?(): void;\n\n /** Called when user enters text in search input */\n onQueryChange?(query: string): void;\n\n /** Keyboard shortcut or list of shortcuts to trigger spotlight */\n shortcut?: string | string[] | null;\n\n /** Should search be cleared when spotlight closes */\n cleanQueryOnClose?: boolean;\n}\n\nexport function SpotlightProvider({\n actions: initialActions,\n children,\n shortcut = 'mod + K',\n onSpotlightClose,\n onSpotlightOpen,\n onQueryChange,\n cleanQueryOnClose = true,\n transitionDuration = 150,\n ...others\n}: SpotlightProviderProps) {\n const timeoutRef = useRef<number>(-1);\n const [query, setQuery] = useState('');\n const [actions, { registerActions, removeActions, triggerAction }]
|
|
1
|
+
{"version":3,"file":"SpotlightProvider.js","sources":["../src/SpotlightProvider.tsx"],"sourcesContent":["import React, { useState, useRef } from 'react';\nimport { useDidUpdate, useDisclosure } from '@mantine/hooks';\nimport { useActionsState } from './use-actions-state/use-actions-state';\nimport { useSpotlightShortcuts } from './use-spotlight-shortcuts/use-spotlight-shortcuts';\nimport { Spotlight, InnerSpotlightProps } from './Spotlight/Spotlight';\nimport type { SpotlightAction } from './types';\nimport { SpotlightContext } from './Spotlight.context';\n\nexport interface SpotlightProviderProps extends InnerSpotlightProps {\n /** Actions list */\n actions: SpotlightAction[] | ((query: string) => SpotlightAction[]);\n\n /** Your application */\n children?: React.ReactNode;\n\n /** Called when spotlight opens */\n onSpotlightOpen?(): void;\n\n /** Called when spotlight closes */\n onSpotlightClose?(): void;\n\n /** Called when user enters text in search input */\n onQueryChange?(query: string): void;\n\n /** Keyboard shortcut or list of shortcuts to trigger spotlight */\n shortcut?: string | string[] | null;\n\n /** Should search be cleared when spotlight closes */\n cleanQueryOnClose?: boolean;\n}\n\nexport function SpotlightProvider({\n actions: initialActions,\n children,\n shortcut = 'mod + K',\n onSpotlightClose,\n onSpotlightOpen,\n onQueryChange,\n cleanQueryOnClose = true,\n transitionDuration = 150,\n ...others\n}: SpotlightProviderProps) {\n const timeoutRef = useRef<number>(-1);\n const [query, setQuery] = useState('');\n const [actions, { registerActions, updateActions, removeActions, triggerAction }] =\n useActionsState(initialActions, query);\n\n useDidUpdate(() => {\n updateActions(initialActions);\n }, [initialActions]);\n\n const handleQueryChange = (value: string) => {\n setQuery(value);\n onQueryChange?.(value);\n };\n\n const [opened, { open, close, toggle }] = useDisclosure(false, {\n onClose: () => {\n onSpotlightClose?.();\n if (cleanQueryOnClose) {\n timeoutRef.current = window.setTimeout(() => {\n handleQueryChange('');\n }, transitionDuration);\n }\n },\n onOpen: () => {\n onSpotlightOpen?.();\n window.clearTimeout(timeoutRef.current);\n },\n });\n\n useSpotlightShortcuts(shortcut, open);\n\n return (\n <SpotlightContext.Provider\n value={{\n openSpotlight: open,\n closeSpotlight: close,\n toggleSpotlight: toggle,\n registerActions,\n removeActions,\n triggerAction,\n opened,\n actions,\n query,\n }}\n >\n <Spotlight\n actions={actions}\n onClose={close}\n opened={opened}\n query={query}\n onQueryChange={handleQueryChange}\n transitionDuration={transitionDuration}\n {...others}\n />\n {children}\n </SpotlightContext.Provider>\n );\n}\n\nSpotlightProvider.displayName = '@mantine/spotlight/SpotlightProvider';\n"],"names":["useRef","useState","useActionsState","useDidUpdate","useDisclosure","useSpotlightShortcuts","React","SpotlightContext","Spotlight"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe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,GAAG,kBAAkBD,cAAK,CAAC,aAAa,CAACE,mBAAS,EAAE,cAAc,CAAC;AACnE,IAAI,OAAO;AACX,IAAI,OAAO,EAAE,KAAK;AAClB,IAAI,MAAM;AACV,IAAI,KAAK;AACT,IAAI,aAAa,EAAE,iBAAiB;AACpC,IAAI,kBAAkB;AACtB,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AACzB,CAAC;AACD,iBAAiB,CAAC,WAAW,GAAG,sCAAsC;;;;"}
|
|
@@ -47,6 +47,7 @@ function useActionsState(initialActions, query) {
|
|
|
47
47
|
setActions(prepareActions(initialActions(query)));
|
|
48
48
|
}
|
|
49
49
|
}, [query]);
|
|
50
|
+
const updateActions = (payload) => setActions(prepareActions(typeof payload === "function" ? payload(query) : payload));
|
|
50
51
|
const registerActions = (payload) => setActions((current) => prepareActions([...current, ...payload]));
|
|
51
52
|
const removeActions = (ids) => setActions((current) => current.filter((action) => !ids.includes(action.id)));
|
|
52
53
|
const triggerAction = (id) => {
|
|
@@ -58,6 +59,7 @@ function useActionsState(initialActions, query) {
|
|
|
58
59
|
actions,
|
|
59
60
|
{
|
|
60
61
|
registerActions,
|
|
62
|
+
updateActions,
|
|
61
63
|
removeActions,
|
|
62
64
|
triggerAction
|
|
63
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-actions-state.js","sources":["../../src/use-actions-state/use-actions-state.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { randomId } from '@mantine/hooks';\nimport type { SpotlightAction } from '../types';\n\nfunction prepareAction(action: SpotlightAction) {\n return { ...action, id: action.id || randomId() };\n}\n\nfunction filterDuplicateActions(actions: SpotlightAction[]) {\n const ids = [];\n\n return actions\n .reduceRight<SpotlightAction[]>((acc, action) => {\n if (!ids.includes(action.id)) {\n ids.push(action.id);\n acc.push(action);\n }\n\n return acc;\n }, [])\n .reverse();\n}\n\nfunction prepareActions(initialActions: SpotlightAction[]) {\n return filterDuplicateActions(initialActions.map((action) => prepareAction(action)));\n}\n\nexport function useActionsState(\n initialActions: SpotlightAction[] | ((query: string) => SpotlightAction[]),\n query: string\n) {\n const [actions, setActions] = useState(\n prepareActions(typeof initialActions === 'function' ? initialActions(query) : initialActions)\n );\n\n useEffect(() => {\n if (typeof initialActions === 'function') {\n setActions(prepareActions(initialActions(query)));\n }\n }, [query]);\n\n const registerActions = (payload: SpotlightAction[]) =>\n setActions((current) => prepareActions([...current, ...payload]));\n\n const removeActions = (ids: string[]) =>\n setActions((current) => current.filter((action) => !ids.includes(action.id)));\n\n const triggerAction = (id: string) => {\n const action = actions.find((item) => item.id === id);\n action?.onTrigger?.(action);\n };\n\n return [\n actions,\n {\n registerActions,\n removeActions,\n triggerAction,\n },\n ] as const;\n}\n"],"names":["randomId","useState","useEffect"],"mappings":";;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,G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S,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACjG,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,OAAO;AACX,IAAI;AACJ,MAAM,eAAe;AACrB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,KAAK;AACL,GAAG,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"use-actions-state.js","sources":["../../src/use-actions-state/use-actions-state.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { randomId } from '@mantine/hooks';\nimport type { SpotlightAction } from '../types';\n\nfunction prepareAction(action: SpotlightAction) {\n return { ...action, id: action.id || randomId() };\n}\n\nfunction filterDuplicateActions(actions: SpotlightAction[]) {\n const ids = [];\n\n return actions\n .reduceRight<SpotlightAction[]>((acc, action) => {\n if (!ids.includes(action.id)) {\n ids.push(action.id);\n acc.push(action);\n }\n\n return acc;\n }, [])\n .reverse();\n}\n\nfunction prepareActions(initialActions: SpotlightAction[]) {\n return filterDuplicateActions(initialActions.map((action) => prepareAction(action)));\n}\n\nexport function useActionsState(\n initialActions: SpotlightAction[] | ((query: string) => SpotlightAction[]),\n query: string\n) {\n const [actions, setActions] = useState(\n prepareActions(typeof initialActions === 'function' ? initialActions(query) : initialActions)\n );\n\n useEffect(() => {\n if (typeof initialActions === 'function') {\n setActions(prepareActions(initialActions(query)));\n }\n }, [query]);\n\n const updateActions = (payload: SpotlightAction[] | ((query: string) => SpotlightAction[])) =>\n setActions(prepareActions(typeof payload === 'function' ? payload(query) : payload));\n\n const registerActions = (payload: SpotlightAction[]) =>\n setActions((current) => prepareActions([...current, ...payload]));\n\n const removeActions = (ids: string[]) =>\n setActions((current) => current.filter((action) => !ids.includes(action.id)));\n\n const triggerAction = (id: string) => {\n const action = actions.find((item) => item.id === id);\n action?.onTrigger?.(action);\n };\n\n return [\n actions,\n {\n registerActions,\n updateActions,\n removeActions,\n triggerAction,\n },\n ]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@@
|
|
|
1
1
|
import React, { useRef, useState } from 'react';
|
|
2
|
-
import { useDisclosure } from '@mantine/hooks';
|
|
2
|
+
import { useDidUpdate, useDisclosure } from '@mantine/hooks';
|
|
3
3
|
import { useActionsState } from './use-actions-state/use-actions-state.js';
|
|
4
4
|
import { useSpotlightShortcuts } from './use-spotlight-shortcuts/use-spotlight-shortcuts.js';
|
|
5
5
|
import { Spotlight } from './Spotlight/Spotlight.js';
|
|
@@ -55,7 +55,10 @@ function SpotlightProvider(_a) {
|
|
|
55
55
|
]);
|
|
56
56
|
const timeoutRef = useRef(-1);
|
|
57
57
|
const [query, setQuery] = useState("");
|
|
58
|
-
const [actions, { registerActions, removeActions, triggerAction }] = useActionsState(initialActions, query);
|
|
58
|
+
const [actions, { registerActions, updateActions, removeActions, triggerAction }] = useActionsState(initialActions, query);
|
|
59
|
+
useDidUpdate(() => {
|
|
60
|
+
updateActions(initialActions);
|
|
61
|
+
}, [initialActions]);
|
|
59
62
|
const handleQueryChange = (value) => {
|
|
60
63
|
setQuery(value);
|
|
61
64
|
onQueryChange == null ? void 0 : onQueryChange(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpotlightProvider.js","sources":["../src/SpotlightProvider.tsx"],"sourcesContent":["import React, { useState, useRef } from 'react';\nimport { useDisclosure } from '@mantine/hooks';\nimport { useActionsState } from './use-actions-state/use-actions-state';\nimport { useSpotlightShortcuts } from './use-spotlight-shortcuts/use-spotlight-shortcuts';\nimport { Spotlight, InnerSpotlightProps } from './Spotlight/Spotlight';\nimport type { SpotlightAction } from './types';\nimport { SpotlightContext } from './Spotlight.context';\n\nexport interface SpotlightProviderProps extends InnerSpotlightProps {\n /** Actions list */\n actions: SpotlightAction[] | ((query: string) => SpotlightAction[]);\n\n /** Your application */\n children?: React.ReactNode;\n\n /** Called when spotlight opens */\n onSpotlightOpen?(): void;\n\n /** Called when spotlight closes */\n onSpotlightClose?(): void;\n\n /** Called when user enters text in search input */\n onQueryChange?(query: string): void;\n\n /** Keyboard shortcut or list of shortcuts to trigger spotlight */\n shortcut?: string | string[] | null;\n\n /** Should search be cleared when spotlight closes */\n cleanQueryOnClose?: boolean;\n}\n\nexport function SpotlightProvider({\n actions: initialActions,\n children,\n shortcut = 'mod + K',\n onSpotlightClose,\n onSpotlightOpen,\n onQueryChange,\n cleanQueryOnClose = true,\n transitionDuration = 150,\n ...others\n}: SpotlightProviderProps) {\n const timeoutRef = useRef<number>(-1);\n const [query, setQuery] = useState('');\n const [actions, { registerActions, removeActions, triggerAction }]
|
|
1
|
+
{"version":3,"file":"SpotlightProvider.js","sources":["../src/SpotlightProvider.tsx"],"sourcesContent":["import React, { useState, useRef } from 'react';\nimport { useDidUpdate, useDisclosure } from '@mantine/hooks';\nimport { useActionsState } from './use-actions-state/use-actions-state';\nimport { useSpotlightShortcuts } from './use-spotlight-shortcuts/use-spotlight-shortcuts';\nimport { Spotlight, InnerSpotlightProps } from './Spotlight/Spotlight';\nimport type { SpotlightAction } from './types';\nimport { SpotlightContext } from './Spotlight.context';\n\nexport interface SpotlightProviderProps extends InnerSpotlightProps {\n /** Actions list */\n actions: SpotlightAction[] | ((query: string) => SpotlightAction[]);\n\n /** Your application */\n children?: React.ReactNode;\n\n /** Called when spotlight opens */\n onSpotlightOpen?(): void;\n\n /** Called when spotlight closes */\n onSpotlightClose?(): void;\n\n /** Called when user enters text in search input */\n onQueryChange?(query: string): void;\n\n /** Keyboard shortcut or list of shortcuts to trigger spotlight */\n shortcut?: string | string[] | null;\n\n /** Should search be cleared when spotlight closes */\n cleanQueryOnClose?: boolean;\n}\n\nexport function SpotlightProvider({\n actions: initialActions,\n children,\n shortcut = 'mod + K',\n onSpotlightClose,\n onSpotlightOpen,\n onQueryChange,\n cleanQueryOnClose = true,\n transitionDuration = 150,\n ...others\n}: SpotlightProviderProps) {\n const timeoutRef = useRef<number>(-1);\n const [query, setQuery] = useState('');\n const [actions, { registerActions, updateActions, removeActions, triggerAction }] =\n useActionsState(initialActions, query);\n\n useDidUpdate(() => {\n updateActions(initialActions);\n }, [initialActions]);\n\n const handleQueryChange = (value: string) => {\n setQuery(value);\n onQueryChange?.(value);\n };\n\n const [opened, { open, close, toggle }] = useDisclosure(false, {\n onClose: () => {\n onSpotlightClose?.();\n if (cleanQueryOnClose) {\n timeoutRef.current = window.setTimeout(() => {\n handleQueryChange('');\n }, transitionDuration);\n }\n },\n onOpen: () => {\n onSpotlightOpen?.();\n window.clearTimeout(timeoutRef.current);\n },\n });\n\n useSpotlightShortcuts(shortcut, open);\n\n return (\n <SpotlightContext.Provider\n value={{\n openSpotlight: open,\n closeSpotlight: close,\n toggleSpotlight: toggle,\n registerActions,\n removeActions,\n triggerAction,\n opened,\n actions,\n query,\n }}\n >\n <Spotlight\n actions={actions}\n onClose={close}\n opened={opened}\n query={query}\n onQueryChange={handleQueryChange}\n transitionDuration={transitionDuration}\n {...others}\n />\n {children}\n </SpotlightContext.Provider>\n );\n}\n\nSpotlightProvider.displayName = '@mantine/spotlight/SpotlightProvider';\n"],"names":[],"mappings":";;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,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sState(initialActions, query) {
|
|
|
43
43
|
setActions(prepareActions(initialActions(query)));
|
|
44
44
|
}
|
|
45
45
|
}, [query]);
|
|
46
|
+
const updateActions = (payload) => setActions(prepareActions(typeof payload === "function" ? payload(query) : payload));
|
|
46
47
|
const registerActions = (payload) => setActions((current) => prepareActions([...current, ...payload]));
|
|
47
48
|
const removeActions = (ids) => setActions((current) => current.filter((action) => !ids.includes(action.id)));
|
|
48
49
|
const triggerAction = (id) => {
|
|
@@ -54,6 +55,7 @@ function useActionsState(initialActions, query) {
|
|
|
54
55
|
actions,
|
|
55
56
|
{
|
|
56
57
|
registerActions,
|
|
58
|
+
updateActions,
|
|
57
59
|
removeActions,
|
|
58
60
|
triggerAction
|
|
59
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-actions-state.js","sources":["../../src/use-actions-state/use-actions-state.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { randomId } from '@mantine/hooks';\nimport type { SpotlightAction } from '../types';\n\nfunction prepareAction(action: SpotlightAction) {\n return { ...action, id: action.id || randomId() };\n}\n\nfunction filterDuplicateActions(actions: SpotlightAction[]) {\n const ids = [];\n\n return actions\n .reduceRight<SpotlightAction[]>((acc, action) => {\n if (!ids.includes(action.id)) {\n ids.push(action.id);\n acc.push(action);\n }\n\n return acc;\n }, [])\n .reverse();\n}\n\nfunction prepareActions(initialActions: SpotlightAction[]) {\n return filterDuplicateActions(initialActions.map((action) => prepareAction(action)));\n}\n\nexport function useActionsState(\n initialActions: SpotlightAction[] | ((query: string) => SpotlightAction[]),\n query: string\n) {\n const [actions, setActions] = useState(\n prepareActions(typeof initialActions === 'function' ? initialActions(query) : initialActions)\n );\n\n useEffect(() => {\n if (typeof initialActions === 'function') {\n setActions(prepareActions(initialActions(query)));\n }\n }, [query]);\n\n const registerActions = (payload: SpotlightAction[]) =>\n setActions((current) => prepareActions([...current, ...payload]));\n\n const removeActions = (ids: string[]) =>\n setActions((current) => current.filter((action) => !ids.includes(action.id)));\n\n const triggerAction = (id: string) => {\n const action = actions.find((item) => item.id === id);\n action?.onTrigger?.(action);\n };\n\n return [\n actions,\n {\n registerActions,\n removeActions,\n triggerAction,\n },\n ] as const;\n}\n"],"names":[],"mappings":";;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;AAC7C,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AACpC,QAAQ,eAAe,CAAC,CAAC,EAAE,I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,CAAC,CAAC,CAAC;AACxI,EAAE,SAAS,CAAC,MAAM;AAClB,IAAI,IAAI,OAAO,cAAc,KAAK,UAAU,EAAE;AAC9C,MAAM,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxD,KAAK;AACL,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,EAAE,MAAM,eAAe,GAAG,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,OAAO,KAAK,cAAc,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AACzG,EAAE,MAAM,aAAa,GAAG,CAAC,GAAG,KAAK,UAAU,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/G,EAAE,MAAM,aAAa,GAAG,CAAC,EAAE,KAAK;AAChC,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAC1D,IAAI,CAAC,EAAE,GAAG,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,SAAS,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACjG,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,OAAO;AACX,IAAI;AACJ,MAAM,eAAe;AACrB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,KAAK;AACL,GAAG,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"use-actions-state.js","sources":["../../src/use-actions-state/use-actions-state.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { randomId } from '@mantine/hooks';\nimport type { SpotlightAction } from '../types';\n\nfunction prepareAction(action: SpotlightAction) {\n return { ...action, id: action.id || randomId() };\n}\n\nfunction filterDuplicateActions(actions: SpotlightAction[]) {\n const ids = [];\n\n return actions\n .reduceRight<SpotlightAction[]>((acc, action) => {\n if (!ids.includes(action.id)) {\n ids.push(action.id);\n acc.push(action);\n }\n\n return acc;\n }, [])\n .reverse();\n}\n\nfunction prepareActions(initialActions: SpotlightAction[]) {\n return filterDuplicateActions(initialActions.map((action) => prepareAction(action)));\n}\n\nexport function useActionsState(\n initialActions: SpotlightAction[] | ((query: string) => SpotlightAction[]),\n query: string\n) {\n const [actions, setActions] = useState(\n prepareActions(typeof initialActions === 'function' ? initialActions(query) : initialActions)\n );\n\n useEffect(() => {\n if (typeof initialActions === 'function') {\n setActions(prepareActions(initialActions(query)));\n }\n }, [query]);\n\n const updateActions = (payload: SpotlightAction[] | ((query: string) => SpotlightAction[])) =>\n setActions(prepareActions(typeof payload === 'function' ? payload(query) : payload));\n\n const registerActions = (payload: SpotlightAction[]) =>\n setActions((current) => prepareActions([...current, ...payload]));\n\n const removeActions = (ids: string[]) =>\n setActions((current) => current.filter((action) => !ids.includes(action.id)));\n\n const triggerAction = (id: string) => {\n const action = actions.find((item) => item.id === id);\n action?.onTrigger?.(action);\n };\n\n return [\n actions,\n {\n registerActions,\n updateActions,\n removeActions,\n triggerAction,\n },\n ] as const;\n}\n"],"names":[],"mappings":";;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe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AAM,EAAE,GAAG,IAAI,CAAC;IAEpC,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EAAE,cAAc,EACvB,QAAQ,EACR,QAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,iBAAwB,EACxB,kBAAwB,EACxB,GAAG,MAAM,EACV,EAAE,sBAAsB,eA0DxB;yBApEe,iBAAiB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SpotlightAction } from '../types';
|
|
2
2
|
export declare function useActionsState(initialActions: SpotlightAction[] | ((query: string) => SpotlightAction[]), query: string): readonly [SpotlightAction[], {
|
|
3
3
|
readonly registerActions: (payload: SpotlightAction[]) => void;
|
|
4
|
+
readonly updateActions: (payload: SpotlightAction[] | ((query: string) => SpotlightAction[])) => void;
|
|
4
5
|
readonly removeActions: (ids: string[]) => void;
|
|
5
6
|
readonly triggerAction: (id: string) => void;
|
|
6
7
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-actions-state.d.ts","sourceRoot":"","sources":["../../src/use-actions-state/use-actions-state.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAyBhD,wBAAgB,eAAe,CAC7B,cAAc,EAAE,eAAe,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,eAAe,EAAE,CAAC,EAC1E,KAAK,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"use-actions-state.d.ts","sourceRoot":"","sources":["../../src/use-actions-state/use-actions-state.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAyBhD,wBAAgB,eAAe,CAC7B,cAAc,EAAE,eAAe,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,eAAe,EAAE,CAAC,EAC1E,KAAK,EAAE,MAAM;wCAeqB,eAAe,EAAE;mEAHU,MAAM,KAAK,eAAe,EAAE;kCAM7D,MAAM,EAAE;iCAGT,MAAM;GAclC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantine/spotlight",
|
|
3
3
|
"description": "Command center for your application",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.8",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"directory": "src/mantine-spotlight"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@mantine/core": "4.0.
|
|
19
|
-
"@mantine/hooks": "4.0.
|
|
18
|
+
"@mantine/core": "4.0.8",
|
|
19
|
+
"@mantine/hooks": "4.0.8",
|
|
20
20
|
"react": ">=16.8.0",
|
|
21
21
|
"react-dom": ">=16.8.0"
|
|
22
22
|
},
|