@imperium/layout 13.0.5 → 13.0.7

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/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # @imperium/layout
2
2
 
3
3
  [![Coverage_badge](../../docs/assets/coverage/layout/coverage.svg)](assets/coverage/layout/index.html)
4
- [![GitHub tag](https://img.shields.io/github/tag/darkadept/imperium.svg)](https://github.com/darkadept/imperium/tags/)
5
- [![GitHub issues](https://img.shields.io/github/issues/darkadept/imperium.svg)](https://github.com/darkadept/imperium/issues/)
6
- [![GitHub pull-requests](https://img.shields.io/github/issues-pr/darkadept/imperium.svg)](https://GitHub.com/darkadept/imperium/pull/)
4
+ [![GitHub tag](https://img.shields.io/github/tag/darkadept/imperium.svg)](https://github.com/thr-consulting/imperium/tags/)
5
+ [![GitHub issues](https://img.shields.io/github/issues/darkadept/imperium.svg)](https://github.com/thr-consulting/imperium/issues/)
6
+ [![GitHub pull-requests](https://img.shields.io/github/issues-pr/darkadept/imperium.svg)](https://github.com/thr-consulting/imperium/pull/)
7
7
 
8
- [![GitHub license](https://img.shields.io/github/license/darkadept/imperium.svg)](https://github.com/darkadept/imperium/blob/master/LICENSE)
9
- [![GitHub contributors](https://img.shields.io/github/contributors/darkadept/imperium.svg)](https://github.com/darkadept/imperium/graphs/contributors/)
8
+ [![GitHub license](https://img.shields.io/github/license/darkadept/imperium.svg)](https://github.com/thr-consulting/imperium/blob/master/LICENSE)
9
+ [![GitHub contributors](https://img.shields.io/github/contributors/darkadept/imperium.svg)](https://github.com/thr-consulting/imperium/graphs/contributors/)
10
10
 
11
11
  # About
12
12
  This is an Imperium client module providing an abstraction for page layout, menu items, and content.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DefineRouteOptions } from '@imperium/router';
3
2
  import type { ActionFormSidebarItem, ContentData } from '../types';
4
3
  interface ActionFormProps<T extends DefineRouteOptions, K extends keyof T> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DefineRouteOptions } from '@imperium/router';
3
2
  import type { ActionFormSidebarItem, ContentData } from '../types';
4
3
  interface ActionFormSidebarItemComponentProps<T extends DefineRouteOptions, K extends keyof T> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DefineRouteOptions } from '@imperium/router';
3
2
  import type { ActionSidebarItem, ContentData } from '../types';
4
3
  interface ActionSidebarItemComponentProps<T extends DefineRouteOptions, K extends keyof T> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DefineRouteOptions } from '@imperium/router';
3
2
  import type { Page, RouteParameters } from '../types';
4
3
  interface ContentComponentProps<T extends DefineRouteOptions, K extends keyof T> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DefineRouteOptions } from '@imperium/router';
3
2
  import type { ContentData, CustomSidebarItem } from '../types';
4
3
  interface CustomSidebarItemComponentProps<T extends DefineRouteOptions, K extends keyof T> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DefineRouteOptions } from '@imperium/router';
3
2
  import type { ContentData, ContentHeader } from '../types';
4
3
  interface HeaderProps<T extends DefineRouteOptions, K extends keyof T> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DefineRouteOptions } from '@imperium/router';
3
2
  import type { ActionFormSidebarItem, ActionSidebarItem, ContentData, CustomSidebarItem, DividerSidebarItem, SidebarItem } from '../types';
4
3
  interface PlainSidebarItemProps<T extends DefineRouteOptions, K extends keyof T> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DefineRouteOptions } from '@imperium/router';
3
2
  import type { ContentData, RouteParameters, SidebarItem } from '../types';
4
3
  interface SidebarItemWrapperProps<T extends DefineRouteOptions, K extends keyof T> {
@@ -16,6 +16,6 @@ export declare function useBuildContentData<T extends DefineRouteOptions, K exte
16
16
  state: import("../../types").State;
17
17
  active: boolean;
18
18
  permissions: import("../../types").PermissionResults;
19
- id?: string | undefined;
19
+ id?: string;
20
20
  };
21
21
  export {};
@@ -4,11 +4,11 @@ import type { SemanticCOLORS, SemanticICONS } from 'semantic-ui-react';
4
4
  import type { RouteItem, VisibilityItem, WeightedItem } from '../commonItems';
5
5
  import type { DataHookItem } from '../datahooks/types';
6
6
  import type { Data, PermissionSelectorHook, StateSelectorHook } from '../types';
7
- export declare type RouteParameters<T extends readonly string[] | undefined> = T extends readonly string[] ? ParametersFromAssertion<T> : never;
7
+ export type RouteParameters<T extends readonly string[] | undefined> = T extends readonly string[] ? ParametersFromAssertion<T> : never;
8
8
  export interface ContentData<T extends DefineRouteOptions, K extends keyof T> extends Data {
9
9
  params: RouteParameters<T[K]['params']>;
10
10
  }
11
- export declare type Content<T extends DefineRouteOptions, K extends keyof T> = (data: ContentData<T, K>) => JSX.Element;
11
+ export type Content<T extends DefineRouteOptions, K extends keyof T> = (data: ContentData<T, K>) => JSX.Element;
12
12
  export interface BaseSidebarItem<T extends DefineRouteOptions, K extends keyof T> extends WeightedItem, VisibilityItem {
13
13
  text: string | ((data: ContentData<T, K>) => string);
14
14
  icon?: SemanticICONS | ((data: ContentData<T, K>) => SemanticICONS);
@@ -35,14 +35,14 @@ export interface ActionFormSidebarItem<T extends DefineRouteOptions, K extends k
35
35
  export interface CustomSidebarItem<T extends DefineRouteOptions, K extends keyof T> extends WeightedItem, VisibilityItem {
36
36
  render: (data: ContentData<T, K>) => JSX.Element | null;
37
37
  }
38
- export declare type SidebarItem<T extends DefineRouteOptions, K extends keyof T> = (BaseSidebarItem<T, K> & RouteItem<ContentData<T, K>>) | ActionSidebarItem<T, K> | CustomSidebarItem<T, K> | ActionFormSidebarItem<T, K> | DividerSidebarItem<T, K>;
38
+ export type SidebarItem<T extends DefineRouteOptions, K extends keyof T> = (BaseSidebarItem<T, K> & RouteItem<ContentData<T, K>>) | ActionSidebarItem<T, K> | CustomSidebarItem<T, K> | ActionFormSidebarItem<T, K> | DividerSidebarItem<T, K>;
39
39
  export interface ContentHeaderObject {
40
40
  title: string;
41
41
  icon?: string;
42
42
  size?: 'tiny' | 'small' | 'medium' | 'large' | 'huge';
43
43
  }
44
44
  export declare function isContentHeaderObject(value: any): value is ContentHeaderObject;
45
- export declare type ContentHeader<T extends DefineRouteOptions, K extends keyof T> = string | ContentHeaderObject | ((data: ContentData<T, K>) => ContentHeaderObject) | JSX.Element | ((data: ContentData<T, K>) => JSX.Element) | undefined;
45
+ export type ContentHeader<T extends DefineRouteOptions, K extends keyof T> = string | ContentHeaderObject | ((data: ContentData<T, K>) => ContentHeaderObject) | JSX.Element | ((data: ContentData<T, K>) => JSX.Element) | undefined;
46
46
  export interface Page<T extends DefineRouteOptions, K extends keyof T> {
47
47
  dataHooks?: DataHookItem[];
48
48
  stateSelectorHook?: StateSelectorHook | StateSelectorHook[];
@@ -52,7 +52,7 @@ export interface Page<T extends DefineRouteOptions, K extends keyof T> {
52
52
  sidebar?: SidebarItem<T, K>[];
53
53
  full?: boolean;
54
54
  }
55
- export declare type Pages<T extends DefineRouteOptions> = {
55
+ export type Pages<T extends DefineRouteOptions> = {
56
56
  [key in keyof T]: Page<T, key> | Content<T, key>;
57
57
  };
58
58
  export declare function isPage<T extends DefineRouteOptions, K extends keyof T>(value: any): value is Page<T, K>;
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import type { DefineRouteOptions } from '@imperium/router';
3
- import { SemanticCOLORS } from 'semantic-ui-react';
2
+ import { type SemanticCOLORS } from 'semantic-ui-react';
4
3
  import type { RouteItem } from '../commonItems';
5
4
  import type { BaseSidebarItem, ContentData } from './types';
6
5
  export declare function getIcon<T extends DefineRouteOptions, K extends keyof T>(item: BaseSidebarItem<T, K>, data: ContentData<T, K>): JSX.Element | null;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DataHookItem } from './types';
3
2
  interface DataHooksProps {
4
3
  dataHooks: DataHookItem[];
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { PermissionSelectorHook } from '../types';
3
2
  interface PermissionHooksProps {
4
3
  permissionHooks: PermissionSelectorHook[];
@@ -5,19 +5,19 @@ export interface DataHookParams {
5
5
  /**
6
6
  * A simple hook, that doesn't return anything. If used together with a route match function, the returned route parameters are passed in.
7
7
  */
8
- export declare type DataHook = (params: DataHookParams) => void;
8
+ export type DataHook = (params: DataHookParams) => void;
9
9
  /**
10
10
  * A route match function that can be used by data hooks. Usually is the @imperium/router `routes.match.x()` functions.
11
11
  */
12
- export declare type DataHookRouteMatchFn = (route: string) => any;
12
+ export type DataHookRouteMatchFn = (route: string) => any;
13
13
  /**
14
14
  * An object that can specify one or more data hooks that can receive route parameters from one or more route match functions.
15
15
  */
16
- export declare type DataHookRoute = {
16
+ export type DataHookRoute = {
17
17
  routeMatch: DataHookRouteMatchFn;
18
18
  dataHook: DataHook | DataHook[];
19
19
  };
20
20
  /**
21
21
  * A datahook can either be a simple hook, or one or more hooks dependent on one or more route match functions.
22
22
  */
23
- export declare type DataHookItem = DataHook | DataHookRoute;
23
+ export type DataHookItem = DataHook | DataHookRoute;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Data } from '../../types';
3
2
  import type { CustomLayoutItem } from '../types';
4
3
  interface CustomLayoutItemComponentProps {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Data } from '../../types';
3
2
  import type { DropdownLayoutItem } from '../types';
4
3
  interface DropdownItemProps {
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  import type { LayoutData } from '../types';
3
3
  interface LayoutProps extends Required<LayoutData> {
4
4
  children?: ReactNode;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { MenuProps } from 'semantic-ui-react';
3
2
  import type { LayoutItem } from '../types';
4
3
  interface ItemBarProps extends MenuProps {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { MenuLayoutItem } from '../types';
3
2
  interface MenuItemProps {
4
3
  item: MenuLayoutItem;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface SecondaryMenuToggleItemProps {
3
2
  menuOpen: boolean;
4
3
  setMenuOpen: (open: boolean) => void;
@@ -1,13 +1,12 @@
1
- /// <reference types="react" />
2
1
  import type { SemanticICONS } from 'semantic-ui-react';
3
2
  import type { HorizontalPositionedItem, RouteItem, VisibilityItem, WeightedItem } from '../commonItems';
4
3
  import type { DataHookItem } from '../datahooks/types';
5
- import type { Data, PermissionSelector, PermissionSelectorHook, StateSelectorHook } from '../types';
4
+ import type { Data, PermissionSelector, PermissionSelectorHook } from '../types';
6
5
  /**
7
6
  * Describes a basic weighted, possibly visible item
8
7
  */
9
8
  export interface BaseLayoutItem extends WeightedItem, VisibilityItem {
10
- text: string | ((data: Data) => string);
9
+ text?: string | ((data: Data) => string);
11
10
  icon?: SemanticICONS | ((data: Data) => SemanticICONS);
12
11
  moveToKey?: string;
13
12
  }
@@ -32,10 +31,9 @@ export interface MenuLayoutItem extends BaseLayoutItem {
32
31
  /**
33
32
  * Describes a horizontal menu item which is either a route item or dropdown menu
34
33
  */
35
- export declare type LayoutItem = (BaseLayoutItem & RouteItem<Data>) | DropdownLayoutItem | MenuLayoutItem | CustomLayoutItem;
34
+ export type LayoutItem = (BaseLayoutItem & RouteItem<Data>) | DropdownLayoutItem | MenuLayoutItem | CustomLayoutItem;
36
35
  export interface LayoutData {
37
36
  permissionSelectorHooks?: PermissionSelectorHook[];
38
- stateSelectorHooks?: StateSelectorHook[];
39
37
  permissions?: PermissionSelector;
40
38
  dataHooks?: DataHookItem[];
41
39
  primaryMenu?: (LayoutItem & HorizontalPositionedItem)[];
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Link } from 'react-router-dom';
3
2
  import type { RouteItem } from '../commonItems';
4
3
  import type { Data } from '../types';
@@ -20,5 +19,5 @@ export declare function linkParameters(item: BaseLayoutItem & RouteItem<Data>, d
20
19
  active?: undefined;
21
20
  to?: undefined;
22
21
  };
23
- export declare function getText(item: BaseLayoutItem, data: Data): string;
22
+ export declare function getText(item: BaseLayoutItem, data: Data): string | undefined;
24
23
  export declare function getIcon(item: BaseLayoutItem, data: Data): JSX.Element | null;
@@ -1,4 +1,4 @@
1
- import { PayloadAction } from '@reduxjs/toolkit';
1
+ import { type PayloadAction } from '@reduxjs/toolkit';
2
2
  export declare const state: import("@reduxjs/toolkit").Slice<{
3
3
  isMobile: boolean;
4
4
  params: {};
@@ -1,18 +1,18 @@
1
1
  import type { ImperiumClientModule } from '@imperium/client';
2
2
  import type { Location } from 'history';
3
3
  import type { LayoutData } from './layout/types';
4
- export declare type State = Record<string, any>;
4
+ export type State = Record<string, any>;
5
5
  /**
6
6
  * A hook that selects from redux state.
7
7
  */
8
- export declare type StateSelectorHook = () => State;
9
- export declare type PermissionResults = Record<string, boolean>;
10
- export declare type PermissionSelectorHook = (data: Data) => PermissionResults;
11
- export declare type PermissionSelector = string[];
8
+ export type StateSelectorHook = () => State;
9
+ export type PermissionResults = Record<string, boolean>;
10
+ export type PermissionSelectorHook = (data: Data) => PermissionResults;
11
+ export type PermissionSelector = string[];
12
12
  /**
13
13
  * The visibility query can either be a mingo query or a function that returns a boolean. The data is an object with the router path merged with any state selector hook data.
14
14
  */
15
- export declare type VisibilityQueryFn = (data: Data) => boolean;
15
+ export type VisibilityQueryFn = (data: Data) => boolean;
16
16
  export interface Data extends Record<string, unknown> {
17
17
  loc: Location;
18
18
  route: {
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@imperium/layout",
3
- "version": "13.0.5",
3
+ "version": "13.0.7",
4
4
  "description": "Imperium Layout package",
5
5
  "bugs": {
6
- "url": "https://github.com/darkadept/imperium/issues"
6
+ "url": "https://github.com/thr-consulting/imperium/issues"
7
7
  },
8
8
  "repository": "darkadept/imperium",
9
9
  "license": "MIT",
@@ -31,10 +31,10 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
- "@imperium/auth-client": "^13.0.4",
35
- "@imperium/client": "^13.0.4",
36
- "@imperium/router": "^13.0.4",
37
- "@imperium/state": "^13.0.4",
34
+ "@imperium/auth-client": "^13.0.7",
35
+ "@imperium/client": "^13.0.7",
36
+ "@imperium/router": "^13.0.7",
37
+ "@imperium/state": "^13.0.7",
38
38
  "@thx/controls": "^17.0.1",
39
39
  "debug": "^4.4.0",
40
40
  "history": "^5.0.1",
@@ -60,5 +60,5 @@
60
60
  "publishConfig": {
61
61
  "access": "public"
62
62
  },
63
- "gitHead": "7b311304c366b945e15486ccd5b2c8c2c4dc3206"
63
+ "gitHead": "baf0440e1d1f0b95cfd0f5ea7753845aab2aa489"
64
64
  }