@llmnative/react 1.5.0 → 1.6.0
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/index.css +1 -1
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2042 -1544
- package/dist/index.mjs.map +1 -1
- package/dist/types/src/App.d.ts +6 -3
- package/dist/types/src/I18n.d.ts +10 -0
- package/dist/types/src/Theme.d.ts +6 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/ui/Card.d.ts +3 -1
- package/dist/types/src/components/ui/Loader.d.ts +3 -1
- package/dist/types/src/components/ui/fields/AddressAutocomplete.d.ts +80 -0
- package/dist/types/src/components/ui/fields/Upload.d.ts +8 -1
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/providers/googleMaps/GoogleMapsProviderContext.d.ts +8 -0
- package/dist/types/src/providers/googleMaps/loadGoogleMaps.d.ts +20 -0
- package/package.json +2 -1
- package/themes/cyber.ts +6 -0
- package/themes/default.ts +6 -0
- package/themes/flat.ts +6 -0
package/dist/types/src/App.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { AuthProviderAdapter } from "./providers/auth/AuthProvider";
|
|
|
8
8
|
import type { EmailProviderAdapter } from "./providers/email/EmailProvider";
|
|
9
9
|
import type { CredentialsAdapter } from "./providers/credentials/CredentialsProvider";
|
|
10
10
|
import { type AppIconProviderConfig } from "./providers/icon/IconProviderContext";
|
|
11
|
+
import type { GoogleMapsConfig } from "./providers/googleMaps/loadGoogleMaps";
|
|
11
12
|
import { type I18nConfig } from "./I18n";
|
|
12
13
|
import { type ServicesConfig, type GoogleProviderConfig, type SupabaseProviderConfig, type MockProviderConfig } from "./providers/manifest";
|
|
13
14
|
interface MenuItem {
|
|
@@ -81,6 +82,8 @@ export type AppProviderProps = {
|
|
|
81
82
|
providers?: AppProvidersConfig;
|
|
82
83
|
/** Icon provider registry config. String shorthand selects the default provider id. */
|
|
83
84
|
iconProvider?: AppIconProviderConfig;
|
|
85
|
+
/** Google Maps/Places config consumed by `<AddressAutocomplete>`. Omit to leave it unconfigured. */
|
|
86
|
+
googleMaps?: GoogleMapsConfig;
|
|
84
87
|
/** Theme registry config. String shorthand selects the active theme id. */
|
|
85
88
|
themeProvider?: AppThemeProviderConfig;
|
|
86
89
|
/** Internationalization config: locale and per-locale translation overrides. */
|
|
@@ -110,8 +113,8 @@ export declare const getContextMenu: () => string[];
|
|
|
110
113
|
*
|
|
111
114
|
* Wraps children with: ErrorBoundary → BrowserRouter → RuntimeProvider →
|
|
112
115
|
* AuthProvider → CredentialsProvider → DataProvider → StorageProvider →
|
|
113
|
-
* EmailProvider → AIProvider → IconProvider →
|
|
114
|
-
* ThemeProvider → [contextProviders] → children.
|
|
116
|
+
* EmailProvider → AIProvider → IconProvider → GoogleMapsProvider → HeadProvider →
|
|
117
|
+
* I18nProvider → ThemeProvider → [contextProviders] → children.
|
|
115
118
|
*
|
|
116
119
|
* `contextProviders` runs inside DataProvider, so vertical-specific providers
|
|
117
120
|
* mounted there can call `useDataProvider()`, `useI18n()`, etc. directly.
|
|
@@ -119,7 +122,7 @@ export declare const getContextMenu: () => string[];
|
|
|
119
122
|
* `App` uses `AppProvider` internally. Use `AppProvider` directly only when
|
|
120
123
|
* you need the provider stack without the routing layer (e.g. tests, Storybook).
|
|
121
124
|
*/
|
|
122
|
-
export declare function AppProvider({ contextProviders, providers, appName, scrapeConfig, iconProvider, themeProvider, i18n, children, errorReportUrl, debug, basename, }: AppProviderProps): React.JSX.Element;
|
|
125
|
+
export declare function AppProvider({ contextProviders, providers, appName, scrapeConfig, iconProvider, googleMaps, themeProvider, i18n, children, errorReportUrl, debug, basename, }: AppProviderProps): React.JSX.Element;
|
|
123
126
|
declare function App({ importPage, LayoutDefault, menuConfig, children, ...providerProps }: AppProps): React.JSX.Element;
|
|
124
127
|
export declare const useMenu: (type: string) => UseMenuItem[];
|
|
125
128
|
export default App;
|
package/dist/types/src/I18n.d.ts
CHANGED
|
@@ -71,6 +71,9 @@ export interface I18nDict {
|
|
|
71
71
|
removeFile: string;
|
|
72
72
|
uploadAnother: string;
|
|
73
73
|
dropToParse: string;
|
|
74
|
+
insertFromUrl: string;
|
|
75
|
+
urlPlaceholder: string;
|
|
76
|
+
invalidUrl: string;
|
|
74
77
|
};
|
|
75
78
|
notifications: {
|
|
76
79
|
title: string;
|
|
@@ -156,6 +159,13 @@ export interface I18nDict {
|
|
|
156
159
|
dragToResize: string;
|
|
157
160
|
dragHere: string;
|
|
158
161
|
};
|
|
162
|
+
addressAutocomplete: {
|
|
163
|
+
placeholder: string;
|
|
164
|
+
noResults: string;
|
|
165
|
+
searching: string;
|
|
166
|
+
notConfigured: string;
|
|
167
|
+
loadError: string;
|
|
168
|
+
};
|
|
159
169
|
}
|
|
160
170
|
type DeepPartial<T> = {
|
|
161
171
|
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
@@ -271,6 +271,12 @@ export interface ThemeConfig {
|
|
|
271
271
|
wrapperClassName?: string;
|
|
272
272
|
className?: string;
|
|
273
273
|
};
|
|
274
|
+
AddressAutocomplete?: {
|
|
275
|
+
wrapperClassName?: string;
|
|
276
|
+
className?: string;
|
|
277
|
+
menuClassName?: string;
|
|
278
|
+
itemClassName?: string;
|
|
279
|
+
};
|
|
274
280
|
Form?: {
|
|
275
281
|
wrapperClassName?: string;
|
|
276
282
|
buttonSaveClass?: string;
|
|
@@ -43,6 +43,7 @@ export { default as Icon } from './ui/Icon';
|
|
|
43
43
|
export { LayoutBuilder } from './ui/LayoutBuilder';
|
|
44
44
|
export * from './ui/fields/Input';
|
|
45
45
|
export * from './ui/fields/Select';
|
|
46
|
+
export * from './ui/fields/AddressAutocomplete';
|
|
46
47
|
export * from './ui/fields/Upload';
|
|
47
48
|
export * from './ui/fields/Crop';
|
|
48
49
|
export * from './ui/fields/UploadCSV';
|
|
@@ -12,8 +12,10 @@ export interface CardProps extends UIProps {
|
|
|
12
12
|
footerClassName?: string;
|
|
13
13
|
/** Show a loading skeleton instead of content. */
|
|
14
14
|
loading?: boolean;
|
|
15
|
+
/** Minimum height reserved for the loading overlay. Defaults to `200px`. */
|
|
16
|
+
loaderMinHeight?: string | number;
|
|
15
17
|
before?: React.ReactNode;
|
|
16
18
|
after?: React.ReactNode;
|
|
17
19
|
}
|
|
18
|
-
declare const Card: ({ children, title, header, footer, loading, wrapperClassName, className, headerClassName, bodyClassName, footerClassName, before, after, }: CardProps) => React.JSX.Element;
|
|
20
|
+
declare const Card: ({ children, title, header, footer, loading, loaderMinHeight, wrapperClassName, className, headerClassName, bodyClassName, footerClassName, before, after, }: CardProps) => React.JSX.Element;
|
|
19
21
|
export default Card;
|
|
@@ -8,6 +8,8 @@ interface LoaderProps extends UIProps {
|
|
|
8
8
|
icon?: string;
|
|
9
9
|
title?: string;
|
|
10
10
|
description?: string;
|
|
11
|
+
/** Minimum height reserved for the overlay while there is no content to size against. Defaults to `200px`. */
|
|
12
|
+
minHeight?: string | number;
|
|
11
13
|
}
|
|
12
|
-
declare function Loader({ children, show, icon, title, description, before, after, wrapperClassName, className }: LoaderProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
14
|
+
declare function Loader({ children, show, icon, title, description, minHeight, before, after, wrapperClassName, className }: LoaderProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
13
15
|
export default Loader;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormFieldProps } from '../../widgets/Form';
|
|
3
|
+
import type { FieldValue } from '../../../providers/data/DataProvider';
|
|
4
|
+
export interface ParsedAddress {
|
|
5
|
+
street?: string;
|
|
6
|
+
city?: string;
|
|
7
|
+
/** Province (administrative_area_level_2), falling back to the region when a country has no province level. */
|
|
8
|
+
state?: string;
|
|
9
|
+
zip?: string;
|
|
10
|
+
country?: string;
|
|
11
|
+
countryCode?: string;
|
|
12
|
+
lat?: number;
|
|
13
|
+
lng?: number;
|
|
14
|
+
formatted?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Overrides the default sub-field paths. Each key defaults to `${name}.<key>` (e.g. `name="address"`
|
|
18
|
+
* → `address.street`) — set any of these to an unrelated, absolute field path to write there instead.
|
|
19
|
+
*/
|
|
20
|
+
export interface AddressAutocompleteFieldNames {
|
|
21
|
+
street?: string;
|
|
22
|
+
city?: string;
|
|
23
|
+
state?: string;
|
|
24
|
+
zip?: string;
|
|
25
|
+
country?: string;
|
|
26
|
+
countryCode?: string;
|
|
27
|
+
lat?: string;
|
|
28
|
+
lng?: string;
|
|
29
|
+
zoom?: string;
|
|
30
|
+
formatted?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface AddressAutocompleteMapOptions {
|
|
33
|
+
/** Where the map renders relative to the search box. Defaults to `'below'`. */
|
|
34
|
+
position?: 'above' | 'below';
|
|
35
|
+
/** Zoom applied when a location is first placed (via search selection or map click) and no zoom is stored yet. Defaults to `15`. */
|
|
36
|
+
defaultZoom?: number;
|
|
37
|
+
/** Map height in pixels. Defaults to `240`. */
|
|
38
|
+
height?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface AddressAutocompleteProps extends FormFieldProps {
|
|
41
|
+
/** Base field path; see {@link AddressAutocompleteFieldNames} for the default sub-field layout. */
|
|
42
|
+
name: string;
|
|
43
|
+
placeholder?: string;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
feedback?: string;
|
|
46
|
+
/** Restrict suggestions to these ISO 3166-1 alpha-2 country codes, e.g. `['it']`. */
|
|
47
|
+
countries?: string[];
|
|
48
|
+
/** Overrides the provider-level language/region bias for this instance only. */
|
|
49
|
+
language?: string;
|
|
50
|
+
region?: string;
|
|
51
|
+
validator?: (value: FieldValue) => string | undefined | Promise<string | undefined>;
|
|
52
|
+
/** Called with the fully parsed address whenever it changes (search selection, pin drag/click)
|
|
53
|
+
* — use this if the consumer needs fields beyond the ones auto-written. */
|
|
54
|
+
onSelect?: (address: ParsedAddress) => void;
|
|
55
|
+
/** Remaps the sub-field paths this component reads/writes. Omit to use `${name}.<field>`. */
|
|
56
|
+
fieldNames?: AddressAutocompleteFieldNames;
|
|
57
|
+
/**
|
|
58
|
+
* Shows an embeddable map with a draggable/clickable pin, so the user can fine-tune the exact
|
|
59
|
+
* location beyond what the address search resolves. Pass `true` for defaults or an options
|
|
60
|
+
* object. Requires the **Geocoding API** enabled in the same Google Cloud project, in addition
|
|
61
|
+
* to Places API (New) + Maps JavaScript API.
|
|
62
|
+
*/
|
|
63
|
+
map?: boolean | AddressAutocompleteMapOptions;
|
|
64
|
+
id?: string;
|
|
65
|
+
labelClassName?: string;
|
|
66
|
+
menuClassName?: string;
|
|
67
|
+
itemClassName?: string;
|
|
68
|
+
mapClassName?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Address search field backed by the Google Places Autocomplete (New) API. Selecting a
|
|
72
|
+
* suggestion fills the structured subfields below `name` — they stay independently editable
|
|
73
|
+
* afterward, same as every other CRM-override field in this app. Optionally pairs with an
|
|
74
|
+
* embeddable map (`map` prop) with a draggable/clickable pin for fine adjustment.
|
|
75
|
+
*
|
|
76
|
+
* Requires `<App googleMaps={{ apiKey }}>` (or `<GoogleMapsProvider config={...}>`) somewhere
|
|
77
|
+
* above in the tree; without it the field renders disabled with an explanatory message.
|
|
78
|
+
*/
|
|
79
|
+
export declare const AddressAutocomplete: ({ name, label, required, placeholder, disabled, feedback, countries, language, region, validator, onSelect, fieldNames, map, id, labelClassName, inheritWrapperClassName, wrapperClassName, className, menuClassName, itemClassName, mapClassName, }: AddressAutocompleteProps) => React.ReactElement;
|
|
80
|
+
export default AddressAutocomplete;
|
|
@@ -67,7 +67,14 @@ export interface UploadImageProps extends UploadDocumentProps {
|
|
|
67
67
|
feedback?: string;
|
|
68
68
|
/** Pixel widths for responsive variants. Set with uploadPath to generate <name>_400w.jpg etc. and populate srcset/sizes in the Form record. */
|
|
69
69
|
srcsetWidths?: number[];
|
|
70
|
+
/**
|
|
71
|
+
* Show a small link icon on the drop zone that opens a dialog for pasting an image URL
|
|
72
|
+
* instead of uploading a file. The confirmed URL is stored as a file entry (progress 100,
|
|
73
|
+
* no upload) — same shape and preview as a real upload, indistinguishable to the Form field.
|
|
74
|
+
* Default `false`.
|
|
75
|
+
*/
|
|
76
|
+
allowUrl?: boolean;
|
|
70
77
|
}
|
|
71
78
|
export declare const getFileUrl: (file: FileProps, suffix?: string) => string;
|
|
72
79
|
export declare const UploadDocument: ({ name, onChange, label, required, editable, multiple, max, accept, uploadPath, storageKey, storageProvider, before, after, wrapperClassName, className, }: UploadDocumentProps) => React.JSX.Element;
|
|
73
|
-
export declare const UploadImage: ({ name, onChange, label, feedback, editable, multiple, accept, required, max, previewHeight, previewWidth, uploadPath, srcsetWidths, storageKey, storageProvider, before, after, wrapperClassName, className, }: UploadImageProps) => React.JSX.Element;
|
|
80
|
+
export declare const UploadImage: ({ name, onChange, label, feedback, editable, multiple, accept, required, max, previewHeight, previewWidth, uploadPath, srcsetWidths, storageKey, storageProvider, allowUrl, before, after, wrapperClassName, className, }: UploadImageProps) => React.JSX.Element;
|
|
@@ -73,6 +73,9 @@ export { PhosphorIconProvider } from './providers/icon/PhosphorIconProvider';
|
|
|
73
73
|
export type { PhosphorWeight } from './providers/icon/PhosphorIconProvider';
|
|
74
74
|
export { IconProvider, useIconProvider, useIconController } from './providers/icon/IconProviderContext';
|
|
75
75
|
export type { AppIconProviderConfig, IconController } from './providers/icon/IconProviderContext';
|
|
76
|
+
export { GoogleMapsProvider, useGoogleMapsConfig } from './providers/googleMaps/GoogleMapsProviderContext';
|
|
77
|
+
export { loadGoogleMaps } from './providers/googleMaps/loadGoogleMaps';
|
|
78
|
+
export type { GoogleMapsConfig } from './providers/googleMaps/loadGoogleMaps';
|
|
76
79
|
export { useEmailProvider, EmailProvider } from './providers/email/EmailProviderContext';
|
|
77
80
|
export { GmailEmailProvider } from './providers/email/google/GmailEmailProvider';
|
|
78
81
|
export type { AIRequestOptions, AIAttachment, AIProviderAdapter, AIKeyValidationResult, AIModelDescriptor, AIProviderCapabilities, AIModelCatalog, AIProviderDefinition, AICompleteRequest, AICompleteResult, AIConversationTurn, AIToolDefinition, AIToolCall, AIToolResult, } from './providers/ai';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { GoogleMapsConfig } from './loadGoogleMaps';
|
|
3
|
+
export declare function GoogleMapsProvider({ config, children }: {
|
|
4
|
+
config?: GoogleMapsConfig;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
/** `undefined` when `<App>`/`<GoogleMapsProvider>` was not given a `googleMaps` config. */
|
|
8
|
+
export declare function useGoogleMapsConfig(): GoogleMapsConfig | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface GoogleMapsConfig {
|
|
2
|
+
/** Google Cloud API key with the "Places API (New)" enabled. */
|
|
3
|
+
apiKey: string;
|
|
4
|
+
/** BCP-47 language for results, e.g. `'it'`. Defaults to the browser's language. */
|
|
5
|
+
language?: string;
|
|
6
|
+
/** Region bias (ccTLD), e.g. `'it'`. */
|
|
7
|
+
region?: string;
|
|
8
|
+
}
|
|
9
|
+
declare global {
|
|
10
|
+
interface Window {
|
|
11
|
+
[key: `__googleMapsLoader_${string}`]: (() => void) | undefined;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Loads the Google Maps JS API (places library) exactly once per page, regardless of how
|
|
16
|
+
* many `<AddressAutocomplete>` instances mount. Safe to call repeatedly with the same config;
|
|
17
|
+
* throws if called again with a *different* apiKey than the one already loading/loaded, since
|
|
18
|
+
* the script tag can't be swapped out once injected.
|
|
19
|
+
*/
|
|
20
|
+
export declare function loadGoogleMaps(config: GoogleMapsConfig): Promise<typeof google>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmnative/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "LLM-native React framework for deterministic UI generation. Data-driven by default, schema-driven optional. Ultra-low token consumption — built for AI agents, not just humans.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -101,6 +101,7 @@
|
|
|
101
101
|
"@testing-library/jest-dom": "^7.0.0",
|
|
102
102
|
"@testing-library/react": "^16.3.2",
|
|
103
103
|
"@testing-library/user-event": "^14.6.1",
|
|
104
|
+
"@types/google.maps": "^3.65.4",
|
|
104
105
|
"@types/papaparse": "^5.5.2",
|
|
105
106
|
"@types/prismjs": "^1.26.6",
|
|
106
107
|
"@types/react": "^19.2.17",
|
package/themes/cyber.ts
CHANGED
|
@@ -318,6 +318,12 @@ export const components: Theme = {
|
|
|
318
318
|
wrapperClassName: '',
|
|
319
319
|
className: '',
|
|
320
320
|
},
|
|
321
|
+
AddressAutocomplete: {
|
|
322
|
+
wrapperClassName: '',
|
|
323
|
+
className: '',
|
|
324
|
+
menuClassName: 'rounded-none border-border/70 bg-popover/95 shadow-[0_0_0_1px_hsl(var(--border)/0.55),0_12px_32px_rgba(0,0,0,0.35)] supports-[backdrop-filter]:bg-popover/92',
|
|
325
|
+
itemClassName: '',
|
|
326
|
+
},
|
|
321
327
|
Form: {
|
|
322
328
|
wrapperClassName: '',
|
|
323
329
|
buttonSaveClass: 'btn-outline-primary',
|
package/themes/default.ts
CHANGED
|
@@ -332,6 +332,12 @@ export const components: Theme = {
|
|
|
332
332
|
wrapperClassName: '',
|
|
333
333
|
className: '',
|
|
334
334
|
},
|
|
335
|
+
AddressAutocomplete: {
|
|
336
|
+
wrapperClassName: '',
|
|
337
|
+
className: '',
|
|
338
|
+
menuClassName: 'border-border/60 bg-popover/95 shadow-xl shadow-black/5 backdrop-blur supports-[backdrop-filter]:bg-popover/90 dark:shadow-black/20',
|
|
339
|
+
itemClassName: '',
|
|
340
|
+
},
|
|
335
341
|
Form: {
|
|
336
342
|
wrapperClassName: '',
|
|
337
343
|
buttonSaveClass: 'btn-outline-primary',
|
package/themes/flat.ts
CHANGED
|
@@ -318,6 +318,12 @@ export const components: Theme = {
|
|
|
318
318
|
wrapperClassName: '',
|
|
319
319
|
className: '',
|
|
320
320
|
},
|
|
321
|
+
AddressAutocomplete: {
|
|
322
|
+
wrapperClassName: '',
|
|
323
|
+
className: '',
|
|
324
|
+
menuClassName: 'border-border/60 bg-popover/95 shadow-lg shadow-black/5 supports-[backdrop-filter]:bg-popover/92',
|
|
325
|
+
itemClassName: '',
|
|
326
|
+
},
|
|
321
327
|
Form: {
|
|
322
328
|
wrapperClassName: '',
|
|
323
329
|
buttonSaveClass: 'btn-outline-primary',
|