@simoncomputing/mui-bueno-v3 0.1.13 → 0.1.15
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 +70 -1
- package/dist/@types/index.d.ts +2 -0
- package/dist/components/Form/Inputs/Autocomplete/Autocomplete.d.ts +6 -6
- package/dist/components/Form/Inputs/Checkbox/Checkbox.d.ts +2 -2
- package/dist/components/Form/Inputs/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/Form/Inputs/FileUpload/FileUpload.d.ts +1 -1
- package/dist/components/Form/Inputs/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/Form/Inputs/RangeSlider/RangeSlider.d.ts +1 -1
- package/dist/components/Form/Inputs/Select/Select.d.ts +1 -1
- package/dist/components/Form/Inputs/TextField/TextField.d.ts +1 -1
- package/dist/components/Form/MForm/MForm.d.ts +12 -7
- package/dist/components/Form/MForm/MFormContext.d.ts +8 -0
- package/dist/components/Form/RepeatableFormGroup/RepeatableFormGroup.d.ts +3 -3
- package/dist/index.cjs.js +129 -131
- package/dist/index.css +1 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.es.js +25144 -25907
- package/dist/index.umd.js +130 -132
- package/package.json +9 -10
- package/dist/components/Form/Inputs/CitationField/CitationBubbleMenuHandler.d.ts +0 -43
- package/dist/components/Form/Inputs/CitationField/CitationField.d.ts +0 -78
- package/dist/components/Form/Inputs/CitationField/CitationMenu/AttachmentForm.d.ts +0 -13
- package/dist/components/Form/Inputs/CitationField/CitationMenu/CitationBubbleMenu.d.ts +0 -25
- package/dist/components/Form/Inputs/CitationField/CitationMenu/CitationForm.d.ts +0 -12
- package/dist/components/Form/Inputs/CitationField/CitationMenu/CitationMenu.d.ts +0 -62
- package/dist/components/Form/Inputs/CitationField/CitationMenu/CitationTable.d.ts +0 -16
- package/dist/components/Form/Inputs/CitationField/CitationNode.d.ts +0 -2
- package/dist/components/Form/Inputs/CitationField/CitationNodeComponent.d.ts +0 -7
- package/dist/components/Form/Inputs/CitationField/CitationRefreshContext/CitationRefreshContext.d.ts +0 -29
- package/dist/components/Form/Inputs/CitationField/MenuButtonEditCitation.d.ts +0 -3
- package/dist/components/Form/Inputs/Location/Location.d.ts +0 -69
- package/dist/components/Form/Inputs/Location/Location.types.d.ts +0 -85
- package/dist/components/Form/Inputs/Location/LocationOption.d.ts +0 -38
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simoncomputing/mui-bueno-v3",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.15",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.js",
|
|
7
7
|
"module": "./dist/index.es.js",
|
|
@@ -43,11 +43,10 @@
|
|
|
43
43
|
"@mui/material": "^6.4.9",
|
|
44
44
|
"@mui/x-date-pickers": "^7.23.3",
|
|
45
45
|
"dayjs": "^1.11.13",
|
|
46
|
-
"formik": "^2.4.6",
|
|
47
46
|
"react": "^19.0.0",
|
|
48
47
|
"react-dom": "^19.0.0",
|
|
49
|
-
"react-
|
|
50
|
-
"react-
|
|
48
|
+
"react-hook-form": "^7.59.0",
|
|
49
|
+
"react-router-dom": "^7.1.1"
|
|
51
50
|
},
|
|
52
51
|
"dependencies": {
|
|
53
52
|
"@hookform/resolvers": "^5.1.1",
|
|
@@ -102,12 +101,12 @@
|
|
|
102
101
|
},
|
|
103
102
|
"devDependencies": {
|
|
104
103
|
"@chromatic-com/storybook": "^3.2.3",
|
|
105
|
-
"@storybook/addon-essentials": "^8.
|
|
106
|
-
"@storybook/addon-interactions": "^8.
|
|
107
|
-
"@storybook/addon-links": "^8.
|
|
108
|
-
"@storybook/addon-themes": "^8.
|
|
109
|
-
"@storybook/react": "^8.
|
|
110
|
-
"@storybook/react-vite": "^8.
|
|
104
|
+
"@storybook/addon-essentials": "^8.6.15",
|
|
105
|
+
"@storybook/addon-interactions": "^8.6.15",
|
|
106
|
+
"@storybook/addon-links": "^8.6.15",
|
|
107
|
+
"@storybook/addon-themes": "^8.6.15",
|
|
108
|
+
"@storybook/react": "^8.6.15",
|
|
109
|
+
"@storybook/react-vite": "^8.6.15",
|
|
111
110
|
"@testing-library/jest-dom": "^6.6.3",
|
|
112
111
|
"@testing-library/react": "^16.1.0",
|
|
113
112
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
import { CitationBubbleMenuProps } from './CitationMenu/CitationBubbleMenu';
|
|
3
|
-
declare module '@tiptap/core' {
|
|
4
|
-
interface Commands<ReturnType> {
|
|
5
|
-
citation: {
|
|
6
|
-
/**
|
|
7
|
-
* Open/show the link bubble menu. Create a link if one doesn't exist at
|
|
8
|
-
* the current cursor selection, or edit the existing link if there is
|
|
9
|
-
* already a link at the current selection.
|
|
10
|
-
*
|
|
11
|
-
* If the options are provided, they're used to override the bubble menu
|
|
12
|
-
* props, which can be useful for specific positioning needs. Each call to
|
|
13
|
-
* `openLinkBubbleMenu` will reset the options based on the provided
|
|
14
|
-
* argument, falling back to default behavior if not provided.
|
|
15
|
-
*
|
|
16
|
-
* For instance, if the anchorEl option is provided, it overrides the
|
|
17
|
-
* anchor point for positioning the bubble menu. (The default anchorEl for
|
|
18
|
-
* LinkBubbleMenu is to anchor to the location in the editor content where
|
|
19
|
-
* the link appears or will appear.)
|
|
20
|
-
*/
|
|
21
|
-
openCitationBubbleMenu: (options?: Partial<CitationBubbleMenuProps>, selectedNodePos?: number) => ReturnType;
|
|
22
|
-
/** Close/hide the link bubble menu, canceling any ongoing edits. */
|
|
23
|
-
closeCitationBubbleMenu: () => ReturnType;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export type CitationBubbleMenuHandlerStorage = {
|
|
28
|
-
isOpen: boolean;
|
|
29
|
-
selectedIds: number[];
|
|
30
|
-
bubbleMenuOptions: Partial<CitationBubbleMenuProps> | undefined;
|
|
31
|
-
selectedNodePos: number | undefined;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* To be used in conjunction with the `CitationBubbleMenuTipTap` component, as this
|
|
35
|
-
* extension provides editor commands to control the state of the link bubble
|
|
36
|
-
* menu.
|
|
37
|
-
*
|
|
38
|
-
* The Tiptap Link extension (@tiptap/extension-link) should also be installed
|
|
39
|
-
* and included in your extensions when using CitationBubbleMenuHandler:
|
|
40
|
-
* https://tiptap.dev/api/marks/link.
|
|
41
|
-
*/
|
|
42
|
-
declare const CitationBubbleMenuHandler: Extension<undefined, CitationBubbleMenuHandlerStorage>;
|
|
43
|
-
export default CitationBubbleMenuHandler;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { TypographyProps } from '@mui/material';
|
|
2
|
-
import { Citation, PageState, PageResponse, UnsavedCitation, UnsavedAttachment } from '../../../../@types';
|
|
3
|
-
export type CitationFieldProps = {
|
|
4
|
-
/**
|
|
5
|
-
* Name and ID of the component. Must match a key from initialValues in Formik.
|
|
6
|
-
* @required
|
|
7
|
-
*/
|
|
8
|
-
name: string;
|
|
9
|
-
/**
|
|
10
|
-
* (Optional) Label. NOTE: this won't be floating, it's always static.
|
|
11
|
-
*/
|
|
12
|
-
label?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Styling for label
|
|
15
|
-
*/
|
|
16
|
-
labelProps?: TypographyProps;
|
|
17
|
-
/**
|
|
18
|
-
* If `true`, the component becomes readonly.
|
|
19
|
-
* @default false
|
|
20
|
-
*/
|
|
21
|
-
readOnly?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Margin for the FormControl
|
|
24
|
-
*/
|
|
25
|
-
margin?: 'dense' | 'none' | 'normal';
|
|
26
|
-
renderContentOnly?: never;
|
|
27
|
-
/**
|
|
28
|
-
* API call for fetching paginated citations. These will populate the "Insert Citation/Attachment(s)" table.
|
|
29
|
-
*
|
|
30
|
-
* If an error occurs during the API call, notify the user then throw the error so that
|
|
31
|
-
* Mui Bueno can handle updating state.
|
|
32
|
-
*/
|
|
33
|
-
fetchExistingCitations: (req: PageState) => Promise<PageResponse<Citation>>;
|
|
34
|
-
/**
|
|
35
|
-
* API call for creating a new citation/attachment.
|
|
36
|
-
*
|
|
37
|
-
* If an error occurs during the API call, notify the user then throw the error so that
|
|
38
|
-
* Mui Bueno can handle updating state.
|
|
39
|
-
*/
|
|
40
|
-
onCreateCitation: (citation: UnsavedCitation) => Promise<Citation>;
|
|
41
|
-
/**
|
|
42
|
-
* API call for updating a citation/attachment.
|
|
43
|
-
*
|
|
44
|
-
* If an error occurs during the API call, notify the user then throw the error so that
|
|
45
|
-
* Mui Bueno can handle updating state.
|
|
46
|
-
*/
|
|
47
|
-
onUpdateCitation: (citation: Citation) => Promise<Citation>;
|
|
48
|
-
/**
|
|
49
|
-
* API call for retrieving a citation by id
|
|
50
|
-
*
|
|
51
|
-
* If an error occurs during the API call, notify the user then throw the error so that
|
|
52
|
-
* Mui Bueno can handle updating state.
|
|
53
|
-
*/
|
|
54
|
-
getCitationById: (id: number) => Promise<Citation>;
|
|
55
|
-
/**
|
|
56
|
-
* API call for storing an attachment (ex. in an s3 bucket)
|
|
57
|
-
*
|
|
58
|
-
* If an error occurs during the API call, notify the user then throw the error so that
|
|
59
|
-
* Mui Bueno can handle updating state.
|
|
60
|
-
*/
|
|
61
|
-
onStoreAttachment: (citation: UnsavedAttachment) => Promise<Citation>;
|
|
62
|
-
/**
|
|
63
|
-
* API call for retrieving an array citations by an array ids
|
|
64
|
-
*
|
|
65
|
-
* If an error occurs during the API call, notify the user then throw the error so that
|
|
66
|
-
* Mui Bueno can handle updating state.
|
|
67
|
-
*/
|
|
68
|
-
getCitationsByIds: (ids: number[]) => Promise<Citation[]>;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Rich Text field -- uses MUI Tip Tap
|
|
72
|
-
*
|
|
73
|
-
* Formik -- This field cannot be completely controlled, so keep in mind that the Formik value will not update until the field
|
|
74
|
-
* __loses focus__. This is to prevent issues with converting from rich text to HTML as the user types as it could override
|
|
75
|
-
* their changes unintentionally.
|
|
76
|
-
*/
|
|
77
|
-
export declare const CitationField: (props: CitationFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
78
|
-
export default CitationField;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { Citation, UnsavedAttachment } from '../../../../../@types';
|
|
3
|
-
export type NewAttachmentFormProps = {
|
|
4
|
-
id?: number;
|
|
5
|
-
editMenuTitle: ReactNode;
|
|
6
|
-
onSave: (citation: UnsavedAttachment) => Promise<void>;
|
|
7
|
-
onCancel: () => void;
|
|
8
|
-
getCitationById: (id: number) => Promise<Citation>;
|
|
9
|
-
disableFileUpload?: boolean;
|
|
10
|
-
onTitleChanged?: (id: number) => void;
|
|
11
|
-
};
|
|
12
|
-
declare const NewAttachmentForm: (props: NewAttachmentFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export default NewAttachmentForm;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Except } from 'type-fest';
|
|
2
|
-
import { ControlledBubbleMenuProps } from 'mui-tiptap';
|
|
3
|
-
import { CitationMenuProps } from './CitationMenu';
|
|
4
|
-
export type CitationBubbleMenuProps = Partial<Except<ControlledBubbleMenuProps, 'open' | 'editor' | 'children'>> & Omit<CitationMenuProps, 'onSelectCitations' | 'onCancel'>;
|
|
5
|
-
/**
|
|
6
|
-
* TipTap Wrapper for CitationMenu so that it renders as a bubble/pop-up menu integrated
|
|
7
|
-
* with TipTap
|
|
8
|
-
*
|
|
9
|
-
* A component that renders a bubble menu when viewing, creating, or editing a
|
|
10
|
-
* link. Requires the mui-tiptap CitationBubbleMenuHandler extension and Tiptap's
|
|
11
|
-
* Link extension (@tiptap/extension-link, https://tiptap.dev/api/marks/link) to
|
|
12
|
-
* both be included in your editor `extensions` array.
|
|
13
|
-
*
|
|
14
|
-
* Pairs well with the `<MenuButtonEditLink />` component.
|
|
15
|
-
*
|
|
16
|
-
* If you're using `RichTextEditor`, include this component via
|
|
17
|
-
* `RichTextEditor`’s `children` render-prop. Otherwise, include the
|
|
18
|
-
* `LinkBubbleMenu` as a child of the component where you call `useEditor` and
|
|
19
|
-
* render your `RichTextField` or `RichTextContent`. (The bubble menu itself
|
|
20
|
-
* will be positioned appropriately no matter where you put it in your React
|
|
21
|
-
* tree, as long as it is re-rendered whenever the Tiptap `editor` forces an
|
|
22
|
-
* update, which will happen if it's a child of the component using
|
|
23
|
-
* `useEditor`).
|
|
24
|
-
*/
|
|
25
|
-
export default function CitationBubbleMenuTipTap({ fetchExistingCitations, onCreateCitation, onUpdateCitation, getCitationById, onStoreAttachment, onTitleChanged, ...controlledBubbleMenuProps }: CitationBubbleMenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { Citation, UnsavedCitation } from '../../../../../@types';
|
|
3
|
-
export type NewCitationFormProps = {
|
|
4
|
-
id?: number;
|
|
5
|
-
editMenuTitle: ReactNode;
|
|
6
|
-
onSave: (citation: UnsavedCitation) => Promise<void>;
|
|
7
|
-
onCancel: () => void;
|
|
8
|
-
getCitationById: (id: number) => Promise<Citation>;
|
|
9
|
-
onTitleChanged?: (id: number) => void;
|
|
10
|
-
};
|
|
11
|
-
declare const NewCitationForm: (props: NewCitationFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export default NewCitationForm;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Citation, PageState, PageResponse, UnsavedCitation, UnsavedAttachment } from '../../../../../@types';
|
|
2
|
-
export interface CitationMenuProps {
|
|
3
|
-
/**
|
|
4
|
-
* API call for fetching citations. These will populate the "Insert Citation/Attachment(s)" table.
|
|
5
|
-
*/
|
|
6
|
-
fetchExistingCitations: (req: PageState) => Promise<PageResponse<Citation>>;
|
|
7
|
-
/**
|
|
8
|
-
* API call for creating a new citation/attachment.
|
|
9
|
-
*/
|
|
10
|
-
onCreateCitation: (citation: UnsavedCitation) => Promise<Citation>;
|
|
11
|
-
/**
|
|
12
|
-
* API call for updating a citation/attachment.
|
|
13
|
-
*/
|
|
14
|
-
onUpdateCitation: (citation: Citation) => Promise<Citation>;
|
|
15
|
-
/**
|
|
16
|
-
* API call for retrieving a citation by id
|
|
17
|
-
*/
|
|
18
|
-
getCitationById: (id: number) => Promise<Citation>;
|
|
19
|
-
/**
|
|
20
|
-
* API call for storing an attachment (ex. in an s3 bucket)
|
|
21
|
-
*/
|
|
22
|
-
onStoreAttachment: (citation: UnsavedAttachment) => Promise<Citation>;
|
|
23
|
-
/**
|
|
24
|
-
* Set which citations should be pre-checked in the citations table when this component is first rendered (used
|
|
25
|
-
* to initialize useState).
|
|
26
|
-
*/
|
|
27
|
-
initialSelectedIds?: number[];
|
|
28
|
-
/**
|
|
29
|
-
* Callback for when the user clicks the "Select" button. This passes an array of selected citations
|
|
30
|
-
* that the user chose to the parent component.
|
|
31
|
-
*/
|
|
32
|
-
onSelectCitations: (citationIds: number[]) => void;
|
|
33
|
-
/**
|
|
34
|
-
* Callback for when the user clicks the "Cancel" button. If you're using a modal, close your modal here.
|
|
35
|
-
*/
|
|
36
|
-
onCancel: () => void;
|
|
37
|
-
/**
|
|
38
|
-
* Callback whenever the size of the content potentially changes. Use this if you're using something like
|
|
39
|
-
* a Popper, so that it can reposition itself when the dimensions of its content changes.
|
|
40
|
-
*
|
|
41
|
-
* Currently, this will be called when the data in the citations table changes, and when the content itself changes (ex. clicks on "Add Citation")
|
|
42
|
-
*/
|
|
43
|
-
onContentUpdate?: () => void;
|
|
44
|
-
/**
|
|
45
|
-
* Optional callback, used to notify parent that the user has changed their Citation's title.
|
|
46
|
-
*/
|
|
47
|
-
onTitleChanged?: (id: number) => void;
|
|
48
|
-
}
|
|
49
|
-
export declare enum CitationMenuState {
|
|
50
|
-
CITATIONS_TABLE = 0,
|
|
51
|
-
ADD_CITATION = 1,
|
|
52
|
-
EDIT_CITATION = 2,
|
|
53
|
-
ADD_ATTACHMENT = 3,
|
|
54
|
-
EDIT_ATTACHMENT = 4
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* CitationMenu handles creating, updating, and selecting citations.
|
|
58
|
-
*
|
|
59
|
-
* Intended to be used within a bubble/pop-up/modal/dialog. For in-line citations, see CitationField instead.
|
|
60
|
-
*/
|
|
61
|
-
export declare function CitationMenu({ fetchExistingCitations, onCreateCitation, onUpdateCitation, getCitationById, onStoreAttachment, onSelectCitations, onCancel, initialSelectedIds, onContentUpdate, onTitleChanged, }: CitationMenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
62
|
-
export default CitationMenu;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { PageState, PageResponse, Citation } from '../../../../../@types';
|
|
3
|
-
export type CitationTableProps = {
|
|
4
|
-
editMenuTitle: ReactNode;
|
|
5
|
-
onCancel: () => void;
|
|
6
|
-
onNewCitation: () => void;
|
|
7
|
-
onNewAttachment: () => void;
|
|
8
|
-
onEditCitation: (citation: Citation) => void;
|
|
9
|
-
onEditAttachment: (citation: Citation) => void;
|
|
10
|
-
onSelect: (selectedIds: number[]) => void;
|
|
11
|
-
fetchExistingCitations: (req: PageState) => Promise<PageResponse<Citation>>;
|
|
12
|
-
selectedIds: number[];
|
|
13
|
-
toggleCheckbox: (citation: Citation) => void;
|
|
14
|
-
};
|
|
15
|
-
declare const CitationTable: (props: CitationTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export default CitationTable;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { NodeViewProps } from '@tiptap/react';
|
|
3
|
-
/**
|
|
4
|
-
* Handles API fetch for CitationNode in order to dynamically load the title, based on a citation's id
|
|
5
|
-
*/
|
|
6
|
-
declare const CitationNodeComponent: React.FC<NodeViewProps>;
|
|
7
|
-
export default CitationNodeComponent;
|
package/dist/components/Form/Inputs/CitationField/CitationRefreshContext/CitationRefreshContext.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Citation } from '../../../../../@types';
|
|
2
|
-
type CitationRefreshProviderProps = {
|
|
3
|
-
/**
|
|
4
|
-
* CitationField(s)
|
|
5
|
-
*/
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
/**
|
|
8
|
-
* array of unqiue ids of citations currently being referenced in the editor
|
|
9
|
-
*/
|
|
10
|
-
citationIds: number[];
|
|
11
|
-
/**
|
|
12
|
-
* API call for fetching citations. Triggered internally when citationIds changes.
|
|
13
|
-
*/
|
|
14
|
-
getCitationsByIds: (ids: number[]) => Promise<Citation[]>;
|
|
15
|
-
/**
|
|
16
|
-
* Id of the citation that had a title changed. Used internally to determine whether or
|
|
17
|
-
* not to trigger an API refresh of the citation list.
|
|
18
|
-
*/
|
|
19
|
-
titleChangedId: number | undefined;
|
|
20
|
-
};
|
|
21
|
-
export declare function CitationRefreshProvider({ children, citationIds, getCitationsByIds, titleChangedId, }: CitationRefreshProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export declare const useCitationRefreshContext: () => {
|
|
23
|
-
/**
|
|
24
|
-
* Array of ALL UNIQUE citations being referenced in the editor.
|
|
25
|
-
* (Not to be confused with table of citations in the bubble menu -- this is only the citations actually in the editor itself)
|
|
26
|
-
*/
|
|
27
|
-
citations: Citation[];
|
|
28
|
-
};
|
|
29
|
-
export {};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { TypographyProps } from '@mui/material';
|
|
2
|
-
import { TextFieldProps } from '../TextField/TextField';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
type BaseLocationProps = {
|
|
5
|
-
/**
|
|
6
|
-
* Name of the component. Must match the initialValue name in Formik.
|
|
7
|
-
* @required
|
|
8
|
-
*/
|
|
9
|
-
name: string;
|
|
10
|
-
/**
|
|
11
|
-
* API Key. Needed for Location to work.
|
|
12
|
-
*
|
|
13
|
-
* NOTE: MAKE SURE TO TIE YOUR API KEY TO A DOMAIN TO ENSURE THE SECURITY OF YOUR KEY
|
|
14
|
-
* @required
|
|
15
|
-
*/
|
|
16
|
-
apiKey: string;
|
|
17
|
-
/**
|
|
18
|
-
* The label for the text field.
|
|
19
|
-
* @recommended
|
|
20
|
-
* @default props.name
|
|
21
|
-
*/
|
|
22
|
-
label?: string;
|
|
23
|
-
/**
|
|
24
|
-
* If true, the parts of the location suggestions that match the input are highlighted
|
|
25
|
-
* @default true
|
|
26
|
-
*/
|
|
27
|
-
highlightMatches?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* The icon shown to the left of each location suggestion.
|
|
30
|
-
* Use false to indicate no icon
|
|
31
|
-
* @default <LocationOnIcon/>
|
|
32
|
-
*/
|
|
33
|
-
resultIcon?: React.ReactElement | false;
|
|
34
|
-
/**
|
|
35
|
-
* If specified, restrict results from a Place Autocomplete request to be of a certain type.
|
|
36
|
-
* More information can be found [here](https://developers.google.com/places/supported_types#table3)
|
|
37
|
-
*/
|
|
38
|
-
types?: 'geocode' | 'address' | 'establishment' | '(regions)' | '(cities)';
|
|
39
|
-
/**
|
|
40
|
-
* Specifies the visual input style.
|
|
41
|
-
* @default 'standard'
|
|
42
|
-
*/
|
|
43
|
-
variant?: 'filled' | 'outlined' | 'standard';
|
|
44
|
-
/**
|
|
45
|
-
* If true, the prepackaged dynamic input label that comes with Material UI's input components
|
|
46
|
-
* will be replaced with a static typography label above the input.
|
|
47
|
-
* @default false
|
|
48
|
-
*/
|
|
49
|
-
staticLabel?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Props from MUI-Bueno's Typography component.
|
|
52
|
-
* Used to customize the label when the static label option is selected.
|
|
53
|
-
*/
|
|
54
|
-
staticLabelProps?: TypographyProps;
|
|
55
|
-
/**
|
|
56
|
-
* Margin for the FormControl
|
|
57
|
-
*/
|
|
58
|
-
margin?: 'dense' | 'none' | 'normal';
|
|
59
|
-
};
|
|
60
|
-
export type LocationProps = BaseLocationProps & TextFieldProps;
|
|
61
|
-
/**
|
|
62
|
-
* The `Location` component provides a Google Maps Places Autocomplete functionality to the Mui Bueno library.
|
|
63
|
-
* It supplies a text field that upon input provides location suggestions.
|
|
64
|
-
*
|
|
65
|
-
* Note: You must have an active Google Maps API key to use this component. More information on creating API keys can be found
|
|
66
|
-
* at the [Google Maps API documentation](https://developers.google.com/maps/documentation/javascript/get-api-key).
|
|
67
|
-
*/
|
|
68
|
-
export declare const Location: React.FC<LocationProps>;
|
|
69
|
-
export {};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a prediction substring.
|
|
3
|
-
*
|
|
4
|
-
* **Props**
|
|
5
|
-
* - `offset`
|
|
6
|
-
* - Type: `number`
|
|
7
|
-
* - The offset to the substring's start within the description string.
|
|
8
|
-
* - `length`
|
|
9
|
-
* - Type: `number`
|
|
10
|
-
* - The length of the substring
|
|
11
|
-
*
|
|
12
|
-
* https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#PredictionSubstring
|
|
13
|
-
*/
|
|
14
|
-
export type PredictionSubstring = google.maps.places.PredictionSubstring;
|
|
15
|
-
/**
|
|
16
|
-
* Structured information about the place's description, divided into a main text and a secondary text,
|
|
17
|
-
* including an array of matched substrings from the autocomplete input,
|
|
18
|
-
* identified by an offset and a length, expressed in unicode characters.
|
|
19
|
-
*
|
|
20
|
-
* **Props**
|
|
21
|
-
* - `main_text`
|
|
22
|
-
* - Type: `string`
|
|
23
|
-
* - This is the main text part of the unformatted description of the place suggested
|
|
24
|
-
* by the Places service. Usually the name of the place.
|
|
25
|
-
* - `secondary_text`
|
|
26
|
-
* - Type: `string`
|
|
27
|
-
* - This is the secondary text part of the unformatted description of the place suggested
|
|
28
|
-
* by the Places service. Usually the location of the place.
|
|
29
|
-
* - `main_text_matched_substrings`
|
|
30
|
-
* - Type: `PredictionSubstring[]`
|
|
31
|
-
* - A set of substrings in the main text that match elements in the user's input, suitable for
|
|
32
|
-
* use in highlighting those substrings. Each substring is identified by an offset and a length,
|
|
33
|
-
* expressed in unicode characters.
|
|
34
|
-
*
|
|
35
|
-
* https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#StructuredFormatting
|
|
36
|
-
*/
|
|
37
|
-
export type StructuredFormatting = google.maps.places.StructuredFormatting;
|
|
38
|
-
/**
|
|
39
|
-
* Represents a single autocomplete prediction.
|
|
40
|
-
*
|
|
41
|
-
* **Props**
|
|
42
|
-
* - `description`
|
|
43
|
-
* - Type: `string`
|
|
44
|
-
* - This is the unformatted version of the query suggested by the Places service.
|
|
45
|
-
* - `structured_formatting`
|
|
46
|
-
* - Type: `StructuredFormatting`
|
|
47
|
-
* - Structured information about the place's description
|
|
48
|
-
* - `place_id`
|
|
49
|
-
* - Type: `string`
|
|
50
|
-
* - A place ID that can be used to retrieve details about this place using the place details service
|
|
51
|
-
* - `matched_substrings`
|
|
52
|
-
* - Type: `PredictionSubstring[]`
|
|
53
|
-
* - A set of substrings in the place's description that match elements in the user's input,
|
|
54
|
-
* suitable for use in highlighting those substrings. Each substring is identified by an offset
|
|
55
|
-
* and a length, expressed in unicode characters.
|
|
56
|
-
* - `terms`
|
|
57
|
-
* - Type: `PredictionTerm`
|
|
58
|
-
* - Information about individual terms in the above description, from most to least specific.
|
|
59
|
-
* For example, "Taco Bell", "Willitis", and "CA".
|
|
60
|
-
* - `types`
|
|
61
|
-
* - Type: `string[]`
|
|
62
|
-
* - An array of types that the prediction belongs to, for example 'establishment' or 'geocode'.
|
|
63
|
-
*
|
|
64
|
-
* https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#AutocompletePrediction
|
|
65
|
-
*/
|
|
66
|
-
export type AutocompletePrediction = google.maps.places.AutocompletePrediction;
|
|
67
|
-
/**
|
|
68
|
-
* Request for fetching AutocompletePredictions
|
|
69
|
-
*/
|
|
70
|
-
export interface FetchRequest {
|
|
71
|
-
/**
|
|
72
|
-
* Text input from autocomplete field
|
|
73
|
-
* @required
|
|
74
|
-
*/
|
|
75
|
-
input: string;
|
|
76
|
-
/**
|
|
77
|
-
* Acceptable address types for returning responses
|
|
78
|
-
* @required
|
|
79
|
-
*/
|
|
80
|
-
types: string[];
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Callback function for fetching AutocompletePredictions
|
|
84
|
-
*/
|
|
85
|
-
export type FetchCallback = (results?: AutocompletePrediction[] | null) => void;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { AutocompletePrediction } from './Location.types';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
interface LocationOptionProps {
|
|
4
|
-
/**
|
|
5
|
-
* Props for list item that wraps custom contents
|
|
6
|
-
* @required
|
|
7
|
-
*/
|
|
8
|
-
listItemProps: React.HTMLAttributes<HTMLLIElement>;
|
|
9
|
-
/**
|
|
10
|
-
* Definition of PlaceType option being rendered in list item
|
|
11
|
-
* @required
|
|
12
|
-
*/
|
|
13
|
-
option: AutocompletePrediction;
|
|
14
|
-
/**
|
|
15
|
-
* Icon to render on far left of list item
|
|
16
|
-
* @required
|
|
17
|
-
*/
|
|
18
|
-
resultIcon: React.ReactElement | false;
|
|
19
|
-
/**
|
|
20
|
-
* Indicates to highlight text in option that matches textfield input
|
|
21
|
-
* @required
|
|
22
|
-
*/
|
|
23
|
-
highlightMatches: boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Function to render custom location list items in the Autocomplete menu
|
|
27
|
-
*
|
|
28
|
-
* **Required Props**
|
|
29
|
-
* - `listItemProps` - Props for list item that wraps custom contents
|
|
30
|
-
* - `option` - Definition of PlaceType option being rendered in list item
|
|
31
|
-
* - `resultIcon` - Icon to render on far left of list item
|
|
32
|
-
* - `highlightMatches` - Indicates to highlight text in option that matches textfield input
|
|
33
|
-
*
|
|
34
|
-
* @param props LocationOptionProps
|
|
35
|
-
* @returns Custom autocomplete option
|
|
36
|
-
*/
|
|
37
|
-
declare const LocationOption: React.FC<LocationOptionProps>;
|
|
38
|
-
export default LocationOption;
|