-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add stripes-core useNamespace * commit the rest of the changes
- Loading branch information
1 parent
91da77e
commit c4aea45
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as useNamespace } from './useNamespace'; | ||
export const withNamespace: any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
export interface UseNamespaceOpts { | ||
ignoreParents?: boolean; | ||
key?: string; | ||
} | ||
|
||
/** | ||
* A hook which returns module namespace as a string | ||
* https://issues.folio.org/browse/STCOR-537 | ||
* | ||
* @example const [namespace, getNamespace] = useNamespace(); | ||
* | ||
* @example // from app module (e.g. ui-users) | ||
* const [namespace] = useNamespace(); // "@folio/users" | ||
* | ||
* @example // from app module (e.g. ui-users) via getNamespace | ||
* const [_, getNamespace] = useNamespace(); | ||
* const namespace = getNamespace({ key: 'test-key' }) // "@folio/users:test-key" | ||
* | ||
* @example // from plugin embedded in app module (e.g. ui-plugin-find-order executing in ui-agreements) | ||
* const [namespace] = useNamespace(); // "@folio/agreements:@folio/plugin-find-order" | ||
* | ||
* @example // from plugin embedded in app module with `ignoreParents` option (e.g. plugin ui-plugin-find-order executing in ui-agreements) | ||
* const [namespace] = useNamespace({ ignoreParents: true }); // "@folio/plugin-find-order" | ||
* | ||
* @example // from plugin embedded in app module with `key` option present (e.g. ui-plugin-find-order executing in ui-agreements) | ||
* const [namespace] = useNamespace({ key: "filters-pane" }); // "@folio/agreements:@folio/plugin-find-order:filters-pane" | ||
*/ | ||
declare function useNamespace( | ||
options?: UseNamespaceOpts, | ||
): [string, (opts: UseNamespaceOpts) => string]; | ||
|
||
export default useNamespace; |