@australiangreens/ag-internal-components 0.0.35 → 0.0.36

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.
@@ -1 +1 @@
1
- {"version":3,"file":"TopBar.d.ts","sourceRoot":"","sources":["../../../../src/layouts/AppLayout/TopBar.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,OAAO;;CAEnB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,SAAc,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE,WAAW,eA6BhG"}
1
+ {"version":3,"file":"TopBar.d.ts","sourceRoot":"","sources":["../../../../src/layouts/AppLayout/TopBar.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,OAAO;;CAEnB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,SAAc,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE,WAAW,eA+BhG"}
@@ -1,3 +1,3 @@
1
1
  export { default } from './AppLayout';
2
- export * from './AppLayoutContext';
2
+ export * from './stateAtoms';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/layouts/AppLayout/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/layouts/AppLayout/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ export declare const navBarOpenAtom: import("jotai").PrimitiveAtom<boolean> & {
3
+ init: boolean;
4
+ };
5
+ export declare const navBarWidthOpenAtom: import("jotai").PrimitiveAtom<number> & {
6
+ init: number;
7
+ };
8
+ export declare const navBarWidthClosedAtom: import("jotai").PrimitiveAtom<number> & {
9
+ init: number;
10
+ };
11
+ export declare const titleTextAtom: import("jotai").PrimitiveAtom<string> & {
12
+ init: string;
13
+ };
14
+ export declare const topBarHeightAtom: import("jotai").PrimitiveAtom<number> & {
15
+ init: number;
16
+ };
17
+ export declare const navBarTopAtom: import("jotai").PrimitiveAtom<ReactNode> & {
18
+ init: ReactNode;
19
+ };
20
+ //# sourceMappingURL=stateAtoms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stateAtoms.d.ts","sourceRoot":"","sources":["../../../../src/layouts/AppLayout/stateAtoms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASlC,eAAO,MAAM,cAAc;;CAAa,CAAC;AAEzC,eAAO,MAAM,mBAAmB;;CAAmC,CAAC;AAEpE,eAAO,MAAM,qBAAqB;;CAAqC,CAAC;AAExE,eAAO,MAAM,aAAa;;CAAW,CAAC;AAEtC,eAAO,MAAM,gBAAgB;;CAA+B,CAAC;AAG7D,eAAO,MAAM,aAAa;;CAA6B,CAAC"}
@@ -2,24 +2,25 @@ import { WritableAtom, useAtomValue } from 'jotai';
2
2
  import { PropsWithChildren } from 'react';
3
3
  /**
4
4
  * When you need to want to set an initial value for an atom, you can use either:
5
- * - withDefaultValue (first add your atom to the atomsToInitialize)
5
+ * - withOverrideDefaults (first add your atom to the atomsToOverride with your choice of key)
6
6
  * - your own custom wrapper that extends HydrateAtoms, like withDomainCode.
7
7
  * You'll need to pass it:
8
8
  * -- an array of tuples of atoms and their values.
9
9
  * -- i.e. [[your_atom, value], [another_atom, value2]]
10
10
  */
11
- declare const atomsToInitialize: {
11
+ declare const atomsToOverride: {
12
12
  domainCode: WritableAtom<"" | "act" | "nsw" | "nt" | "qld" | "sa" | "tas" | "vic" | "wa" | "ag" | "fedmps", [newValue: "" | "act" | "nsw" | "nt" | "qld" | "sa" | "tas" | "vic" | "wa" | "ag" | "fedmps"], void>;
13
13
  };
14
- export declare const withAtomProvider: import("souvlaki").SimpleHelper<[]>;
15
- export declare const HydrateAtoms: <T>({ initialValues, children, }: PropsWithChildren<{
16
- initialValues: [WritableAtom<T, T[], void>, T][];
17
- }>) => JSX.Element;
18
- type AtomConfigOption = keyof typeof atomsToInitialize;
19
- type AtomConfigValue<T extends AtomConfigOption> = ReturnType<typeof useAtomValue<(typeof atomsToInitialize)[T]>>;
14
+ type OverrideValues<T> = [WritableAtom<T, T[], void>, T][];
15
+ type AtomConfigOption = keyof typeof atomsToOverride;
16
+ type AtomConfigValue<T extends AtomConfigOption> = ReturnType<typeof useAtomValue<(typeof atomsToOverride)[T]>>;
20
17
  type AtomConfig = {
21
18
  [K in AtomConfigOption]: AtomConfigValue<K>;
22
19
  };
23
- export declare const withDefaultValue: import("souvlaki").SimpleHelper<[overrides: Partial<AtomConfig>]>;
20
+ export declare const withAtomProvider: import("souvlaki").SimpleHelper<[]>;
21
+ export declare const HydrateAtoms: <T>({ initialValues, children, }: PropsWithChildren<{
22
+ initialValues: OverrideValues<T>;
23
+ }>) => JSX.Element;
24
+ export declare const withOverrideDefaults: import("souvlaki").SimpleHelper<[overrides: Partial<AtomConfig>]>;
24
25
  export {};
25
26
  //# sourceMappingURL=wrappers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../../../src/testing/wrappers.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAY,YAAY,EAAE,YAAY,E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gBAAgB,qCAE3B,CAAC;AAEH,eAAO,MAAM,YAAY;;kBAMxB,CAAC;AAEF,eAAO,MAAM,oBAAoB,mEAiBhC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@australiangreens/ag-internal-components",
3
3
  "private": false,
4
- "version": "0.0.35",
4
+ "version": "0.0.36",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/australiangreens/ag-internal-components#readme",
7
7
  "license": "MIT",
@@ -1,39 +0,0 @@
1
- import { PropsWithChildren, ReactNode } from 'react';
2
- export interface AppLayoutContextState {
3
- navBarOpen: boolean;
4
- navBarWidthOpen: number;
5
- navBarWidthClosed: number;
6
- topBarHeight: number;
7
- titleText: string;
8
- /** TODO: Would this be better handled with a portal? */
9
- navBarTop: ReactNode;
10
- }
11
- export interface AppLayoutContextActions {
12
- toggleNavBarOpen: () => void;
13
- setNavBarOpen: (newVal: boolean) => void;
14
- setTitleText: (newVal: string) => void;
15
- setNavBarWidthOpen: (newVal: number) => void;
16
- setNavBarWidthClosed: (newVal: number) => void;
17
- setNavBarTop: (newVal: ReactNode) => void;
18
- clearNavBarTop: () => void;
19
- }
20
- export type AppLayoutContext = AppLayoutContextState & AppLayoutContextActions;
21
- interface BasePageProviderProps {
22
- overrideState?: Partial<AppLayoutContextState>;
23
- overrideActions?: Partial<AppLayoutContextActions>;
24
- }
25
- export type PageProviderProps = PropsWithChildren<BasePageProviderProps>;
26
- /**
27
- * Provider of AppLayoutContext, which includes state such as navBarOpen and
28
- * titleText, along with actions such as setNavBarOpen() and toggleNavBarOpen().
29
- *
30
- * These functions provided by the hook are wrappers on the underlying reducer.
31
- *
32
- * The overrideState and overrideActions props are designed to be used in tests
33
- * with the Souvlaki library, for components that rely on being in the context
34
- * of a AppLayoutProvider, without the need to render the navbar etc.
35
- */
36
- export declare const AppLayoutProvider: ({ overrideState, overrideActions, children, }: PageProviderProps) => JSX.Element;
37
- export declare const useAppLayout: () => AppLayoutContext;
38
- export {};
39
- //# sourceMappingURL=AppLayoutContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppLayoutContext.d.ts","sourceRoot":"","sources":["../../../../src/layouts/AppLayout/AppLayoutContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAGjB,SAAS,EACV,MAAM,OAAO,CAAC;AAOf,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAElB,wDAAwD;IACxD,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,YAAY,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IAC1C,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,uBAAuB,CAAC;AAE/E,UAAU,qBAAqB;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC/C,eAAe,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACpD;AAED,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;AAQzE;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,kDAI3B,iBAAiB,gBA+CnB,CAAC;AAEF,eAAO,MAAM,YAAY,wBAQxB,CAAC"}
@@ -1,26 +0,0 @@
1
- import { AppLayoutContextState } from './AppLayoutContext';
2
- type Action = {
3
- type: 'toggleNavBarOpen';
4
- } | {
5
- type: 'setNavBarOpen';
6
- payload: AppLayoutContextState['navBarOpen'];
7
- } | {
8
- type: 'setTopBarHeight';
9
- payload: AppLayoutContextState['topBarHeight'];
10
- } | {
11
- type: 'setNavBarWidthOpen';
12
- payload: AppLayoutContextState['navBarWidthOpen'];
13
- } | {
14
- type: 'setNavBarWidthClosed';
15
- payload: AppLayoutContextState['navBarWidthClosed'];
16
- } | {
17
- type: 'setTitleText';
18
- payload: AppLayoutContextState['titleText'];
19
- } | {
20
- type: 'setNavBarTop';
21
- payload: AppLayoutContextState['navBarTop'];
22
- };
23
- export declare const INITIAL_PAGE_LAYOUT_CONTEXT_STATE: AppLayoutContextState;
24
- export declare function appLayoutContextStateReducer(state: AppLayoutContextState, action: Action): AppLayoutContextState;
25
- export {};
26
- //# sourceMappingURL=appLayoutContextStateReducer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appLayoutContextStateReducer.d.ts","sourceRoot":"","sources":["../../../../src/layouts/AppLayout/appLayoutContextStateReducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAO3D,KAAK,MAAM,GACP;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE,GAC5B;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,qBAAqB,CAAC,YAAY,CAAC,CAAA;CAAE,GACvE;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE,qBAAqB,CAAC,cAAc,CAAC,CAAA;CAAE,GAC3E;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,OAAO,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,CAAA;CAAE,GACjF;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAA;CAAE,GACrF;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAA;CAAE,GACrE;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAE1E,eAAO,MAAM,iCAAiC,EAAE,qBAO/C,CAAC;AAEF,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,qBAAqB,EAC5B,MAAM,EAAE,MAAM,GACb,qBAAqB,CAyCvB"}