@australiangreens/ag-internal-components 0.0.57 → 0.0.59
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/dist/.gitignore +0 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/components/FetchAutocomplete/FetchAutocomplete.d.ts +46 -0
- package/dist/components/FetchAutocomplete/FetchAutocomplete.d.ts.map +1 -0
- package/dist/components/FetchAutocomplete/FetchAutocomplete.test.d.ts +2 -0
- package/dist/components/FetchAutocomplete/FetchAutocomplete.test.d.ts.map +1 -0
- package/dist/components/FetchAutocomplete/index.d.ts +4 -0
- package/dist/components/FetchAutocomplete/index.d.ts.map +1 -0
- package/dist/components/FetchAutocomplete/types.d.ts +15 -0
- package/dist/components/FetchAutocomplete/types.d.ts.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/esm/index.js +674 -501
- package/dist/esm/index.js.map +1 -1
- package/dist/layouts/AppLayout/PageContainer.d.ts +8 -1
- package/dist/layouts/AppLayout/PageContainer.d.ts.map +1 -1
- package/dist/layouts/PageLayout/PageContainer.d.ts.map +1 -1
- package/package.json +21 -21
- package/dist/DevApp.d.ts +0 -3
- package/dist/DevApp.d.ts.map +0 -1
- package/dist/DevDemo/DevDemo.d.ts +0 -3
- package/dist/DevDemo/DevDemo.d.ts.map +0 -1
- package/dist/DevDemo/DomainCodeDemo.d.ts +0 -3
- package/dist/DevDemo/DomainCodeDemo.d.ts.map +0 -1
- package/dist/DevDemo/ExampleComponentDemo.d.ts +0 -3
- package/dist/DevDemo/ExampleComponentDemo.d.ts.map +0 -1
- package/dist/DevDemo/NavBarContent.d.ts +0 -3
- package/dist/DevDemo/NavBarContent.d.ts.map +0 -1
- package/dist/DevDemo/SaladBarDemo.d.ts +0 -3
- package/dist/DevDemo/SaladBarDemo.d.ts.map +0 -1
- package/dist/DevDemo/SomeRandomDemo.d.ts +0 -3
- package/dist/DevDemo/SomeRandomDemo.d.ts.map +0 -1
- package/dist/DevDemo/SpecialPageDemo.d.ts +0 -3
- package/dist/DevDemo/SpecialPageDemo.d.ts.map +0 -1
- package/dist/DevDemo/index.d.ts +0 -2
- package/dist/DevDemo/index.d.ts.map +0 -1
- package/dist/devMain.d.ts +0 -1
- package/dist/devMain.d.ts.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SyntheticEvent } from 'react';
|
|
2
|
+
import { AutocompleteGenericEntity, FetchAutocompleteChangeReason } from './types';
|
|
3
|
+
export interface FetchAutocompleteProps<EntityType extends AutocompleteGenericEntity> {
|
|
4
|
+
/**
|
|
5
|
+
* Callback fired when the value changes. This is passed directly to the
|
|
6
|
+
* underlying Autocomplete, but it is triggered by the Autocomplete's own
|
|
7
|
+
* onChange, with the exception of the deletion of chips.
|
|
8
|
+
*/
|
|
9
|
+
onChange: (newValue: EntityType[], reason: FetchAutocompleteChangeReason, event: SyntheticEvent<Element, Event>) => unknown;
|
|
10
|
+
/** The sequence of entity types returned. */
|
|
11
|
+
value: EntityType[];
|
|
12
|
+
/**
|
|
13
|
+
* A minimum length of characters in the Autocomplete before the lookup is called. If not set,
|
|
14
|
+
* then the lookup is called every time.
|
|
15
|
+
*/
|
|
16
|
+
minLength?: number;
|
|
17
|
+
/** A nice label for the autocomplete. */
|
|
18
|
+
label: string;
|
|
19
|
+
/** The lookup function, for looking up EntityType options from a remote resource. */
|
|
20
|
+
lookup?: (lookupValue: string, abortSignal: AbortSignal) => Promise<EntityType[] | undefined | null | void>;
|
|
21
|
+
/** If you have your EntityType options at hand, preload them instead, and save the
|
|
22
|
+
* user's time. They should all be available when the user clicks on the drop down
|
|
23
|
+
* menu, without even a single keystroke provided. This is the property you want.
|
|
24
|
+
*/
|
|
25
|
+
preLoadedOptions?: EntityType[] | undefined;
|
|
26
|
+
/** The popup icon */
|
|
27
|
+
popupIcon?: React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* When testing, it is useful to give data-testid attributes to parts inside
|
|
30
|
+
* the component. This prefix is useful to distinguish one FetchAutocomplete
|
|
31
|
+
* instance from others.
|
|
32
|
+
*/
|
|
33
|
+
dataTestidPrefix?: string;
|
|
34
|
+
loadingText?: string;
|
|
35
|
+
noOptionsText?: string;
|
|
36
|
+
error?: boolean;
|
|
37
|
+
helperText?: React.ReactNode;
|
|
38
|
+
enableHighlighting?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A wrapper around MUI's Autocomplete component, specifically for use with live
|
|
42
|
+
* as-you-type fetching from an api and styled the way we want it across the app
|
|
43
|
+
* by default.
|
|
44
|
+
*/
|
|
45
|
+
export default function FetchAutocomplete<EntityType extends AutocompleteGenericEntity>({ lookup, enableHighlighting, onChange, minLength, label, value, dataTestidPrefix, loadingText, noOptionsText, popupIcon, error, helperText, preLoadedOptions, }: FetchAutocompleteProps<EntityType>): JSX.Element;
|
|
46
|
+
//# sourceMappingURL=FetchAutocomplete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchAutocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/FetchAutocomplete/FetchAutocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,cAAc,EAAE,MAAM,OAAO,CAAC;AAerE,OAAO,EACL,yBAAyB,EAEzB,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,sBAAsB,CAAC,UAAU,SAAS,yBAAyB;IAClF;;;;OAIG;IACH,QAAQ,EAAE,CACR,QAAQ,EAAE,UAAU,EAAE,EACtB,MAAM,EAAE,6BAA6B,EACrC,KAAK,EAAE,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,KAClC,OAAO,CAAC;IAEb,6CAA6C;IAC7C,KAAK,EAAE,UAAU,EAAE,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IAEd,qFAAqF;IACrF,MAAM,CAAC,EAAE,CACP,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,WAAW,KACrB,OAAO,CAAC,UAAU,EAAE,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IAErD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;IAE5C,qBAAqB;IACrB,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,UAAU,SAAS,yBAAyB,EAAE,EACtF,MAAuB,EACvB,kBAAyB,EACzB,QAAQ,EACR,SAAS,EACT,KAAK,EACL,KAAK,EACL,gBAAgB,EAChB,WAA0B,EAC1B,aAA4B,EAC5B,SAAgC,EAChC,KAAa,EACb,UAAe,EACf,gBAA4B,GAC7B,EAAE,sBAAsB,CAAC,UAAU,CAAC,eA8NpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchAutocomplete.test.d.ts","sourceRoot":"","sources":["../../../src/components/FetchAutocomplete/FetchAutocomplete.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FetchAutocomplete/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type AutocompleteGenericEntityIdType = number | string;
|
|
2
|
+
/** These are an extension of the reasons for MUI's Autocomplete. We add delete
|
|
3
|
+
* reason. */
|
|
4
|
+
export type FetchAutocompleteChangeReason = 'createOption' | 'selectOption' | 'removeOption' | 'blur' | 'clear' | 'delete';
|
|
5
|
+
export interface AutocompleteGenericEntity {
|
|
6
|
+
id: AutocompleteGenericEntityIdType;
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* optional chip label specifically for displaying custom chip
|
|
10
|
+
* eg. search by event name: show truncated label and append startDate
|
|
11
|
+
*/
|
|
12
|
+
chipLabel?: string;
|
|
13
|
+
tooltipContent?: string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/FetchAutocomplete/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,+BAA+B,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9D;aACa;AACb,MAAM,MAAM,6BAA6B,GACrC,cAAc,GACd,cAAc,GACd,cAAc,GACd,MAAM,GACN,OAAO,GACP,QAAQ,CAAC;AAEb,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,+BAA+B,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -4,4 +4,6 @@ export { default as NavBar } from './NavBar';
|
|
|
4
4
|
export * from './NavBar';
|
|
5
5
|
export { default as AgDialog } from './AgDialog';
|
|
6
6
|
export * from './AgDialog';
|
|
7
|
+
export { default as FetchAutocomplete } from './FetchAutocomplete';
|
|
8
|
+
export * from './FetchAutocomplete';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,cAAc,qBAAqB,CAAC"}
|