@ahrowe/ui 0.1.3 → 0.1.5
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.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +453 -444
- package/dist/index.mjs.map +1 -1
- package/dist/types/package/common/idleManager/idleManager.d.ts +2 -25
- package/dist/types/package/common/idleManager/idleManager.types.d.ts +8 -0
- package/dist/types/package/common/idleManager/index.d.ts +1 -2
- package/dist/types/package/common/infiniteBlock/index.d.ts +1 -2
- package/dist/types/package/common/infiniteBlock/infiniteBlock.d.ts +3 -30
- package/dist/types/package/common/infiniteBlock/infiniteBlock.types.d.ts +11 -0
- package/dist/types/package/common/roomViewer/index.d.ts +1 -2
- package/dist/types/package/common/roomViewer/roomViewer.d.ts +2 -25
- package/dist/types/package/common/roomViewer/roomViewer.types.d.ts +10 -0
- package/dist/types/package/common/themeProvider/defaultTheme.d.ts +7 -0
- package/dist/types/package/common/themeProvider/index.d.ts +1 -0
- package/dist/types/package/common/themeProvider/themeProvider.d.ts +1 -1
- package/dist/types/package/services/formValidation/FormValidatorGroupWithForm.d.ts +3 -0
- package/dist/types/package/services/formValidation/formValidatorGroup.d.ts +8 -2
- package/dist/types/package/services/formValidation/useFormValidatorGroup.d.ts +5 -2
- package/package.json +3 -2
- package/dist/types/package/common/searchInputModern/index.d.ts +0 -2
- package/dist/types/package/common/searchInputModern/searchInputModern.d.ts +0 -39
- /package/dist/{mcp → mcp.js} +0 -0
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IdleManagerProps } from './idleManager.types';
|
|
2
|
+
declare function IdleManager({ children, idleAfterSeconds, renderCondition, }: IdleManagerProps): import("react/jsx-runtime").JSX.Element;
|
|
2
3
|
export default IdleManager;
|
|
3
|
-
declare class IdleManager extends React.Component<any, any, any> {
|
|
4
|
-
static propTypes: {
|
|
5
|
-
children: any;
|
|
6
|
-
idleAfterSeconds: any;
|
|
7
|
-
renderCondition: any;
|
|
8
|
-
};
|
|
9
|
-
static defaultProps: {
|
|
10
|
-
children: null;
|
|
11
|
-
idleAfterSeconds: number;
|
|
12
|
-
renderCondition: boolean;
|
|
13
|
-
};
|
|
14
|
-
constructor(props: any);
|
|
15
|
-
state: {
|
|
16
|
-
isIdleContentShown: boolean;
|
|
17
|
-
};
|
|
18
|
-
componentDidMount(): void;
|
|
19
|
-
componentDidUpdate(prevProps: any): void;
|
|
20
|
-
componentWillUnmount(): void;
|
|
21
|
-
registerHandlers(): void;
|
|
22
|
-
unregisterhandlers(): void;
|
|
23
|
-
resetIdleTimeout: () => void;
|
|
24
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
#private;
|
|
26
|
-
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface IdleManagerProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
/** Seconds of inactivity before children are rendered. Defaults to 600 (10 min). */
|
|
5
|
+
idleAfterSeconds?: number;
|
|
6
|
+
/** Children are only rendered when this is true AND the user is idle. Defaults to true. */
|
|
7
|
+
renderCondition?: boolean;
|
|
8
|
+
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default IdleManager;
|
|
1
|
+
export { default } from './idleManager';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default InfiniteBlock;
|
|
1
|
+
export { default } from './infiniteBlock';
|
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
children: any;
|
|
5
|
-
onScroll: any;
|
|
6
|
-
className: any;
|
|
7
|
-
isDataLoading: any;
|
|
8
|
-
setHighlightedIndex: any;
|
|
9
|
-
};
|
|
10
|
-
static defaultProps: {
|
|
11
|
-
className: string;
|
|
12
|
-
children: null;
|
|
13
|
-
isDataLoading: boolean;
|
|
14
|
-
setHighlightedIndex: () => null;
|
|
15
|
-
};
|
|
16
|
-
constructor(props: any);
|
|
17
|
-
constructor(props: any, context: any);
|
|
18
|
-
state: {
|
|
19
|
-
isLoadingOnScroll: boolean;
|
|
20
|
-
index: number;
|
|
21
|
-
};
|
|
22
|
-
componentDidMount(): void;
|
|
23
|
-
componentWillUnmount(): void;
|
|
24
|
-
onScroll: () => void;
|
|
25
|
-
respondToUserInput: (event: any) => void;
|
|
26
|
-
childStartsWithKey: (child: any, key: any) => any;
|
|
27
|
-
addToIndex(val: any, index: any): any;
|
|
28
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
tableBody: HTMLDivElement | null | undefined;
|
|
30
|
-
}
|
|
1
|
+
import { InfiniteBlockProps } from './infiniteBlock.types';
|
|
2
|
+
declare function InfiniteBlock({ children, onScroll, className, isDataLoading, setHighlightedIndex, }: InfiniteBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default InfiniteBlock;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface InfiniteBlockProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
/** Called when the user scrolls to the bottom; must return a Promise that resolves when the new data has loaded. */
|
|
5
|
+
onScroll: () => Promise<void>;
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Replaces children with a full-block spinner (initial load). */
|
|
8
|
+
isDataLoading?: boolean;
|
|
9
|
+
/** Called with the newly highlighted child index after keyboard navigation. */
|
|
10
|
+
setHighlightedIndex?: (index: number) => void;
|
|
11
|
+
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default RoomViewer;
|
|
1
|
+
export { default } from './roomViewer';
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RoomViewerProps } from './roomViewer.types';
|
|
2
|
+
declare function RoomViewer({ data }: RoomViewerProps): import("react/jsx-runtime").JSX.Element;
|
|
2
3
|
export default RoomViewer;
|
|
3
|
-
declare class RoomViewer extends React.Component<any, any, any> {
|
|
4
|
-
static propTypes: {
|
|
5
|
-
data: any;
|
|
6
|
-
};
|
|
7
|
-
static defaultProps: {
|
|
8
|
-
data: never[];
|
|
9
|
-
};
|
|
10
|
-
constructor(props: any);
|
|
11
|
-
roomViewerRef: React.RefObject<any>;
|
|
12
|
-
listenerAbortController: AbortController | null;
|
|
13
|
-
state: {
|
|
14
|
-
selectedRoomId: null;
|
|
15
|
-
svgData: null;
|
|
16
|
-
selectedDataId: number;
|
|
17
|
-
isLoading: boolean;
|
|
18
|
-
};
|
|
19
|
-
componentDidMount(): void;
|
|
20
|
-
componentDidUpdate(prevProps: any, prevState: any): void;
|
|
21
|
-
componentWillUnmount(): void;
|
|
22
|
-
loadData: () => void;
|
|
23
|
-
onRoomClicked: (roomId: any) => void;
|
|
24
|
-
addToCurrentFloor: (change: any) => void;
|
|
25
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface RoomViewerFloor {
|
|
3
|
+
/** Display label shown above the floor plan (e.g. "Ground Floor") */
|
|
4
|
+
label: string;
|
|
5
|
+
/** The SVG floor plan to render for this floor */
|
|
6
|
+
data: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface RoomViewerProps {
|
|
9
|
+
data?: RoomViewerFloor[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Theme } from './theme.types';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in default theme used by ThemeProvider when no `themes` prop is
|
|
4
|
+
* supplied. Provides a complete set of CSS variables so the component
|
|
5
|
+
* library renders correctly out of the box.
|
|
6
|
+
*/
|
|
7
|
+
export declare const defaultTheme: Theme;
|
|
@@ -6,6 +6,9 @@ import { default as React } from 'react';
|
|
|
6
6
|
*
|
|
7
7
|
* This is the class you should use everywhere — it is a drop-in replacement
|
|
8
8
|
* for FormValidatorGroup with one extra property: `this.Form`.
|
|
9
|
+
*
|
|
10
|
+
* Also injects the default toast-based onSubmitError so both hook and class-component
|
|
11
|
+
* consumers surface errors out of the box; pass options.onSubmitError to override.
|
|
9
12
|
*/
|
|
10
13
|
export default class FormValidatorGroupWithForm<TGroup extends FormGroup = FormGroup, TInitial = InferGroupValues<TGroup>> extends FormValidatorGroup<TGroup, TInitial> {
|
|
11
14
|
Form: React.FC<React.FormHTMLAttributes<HTMLFormElement>>;
|
|
@@ -16,6 +16,7 @@ export interface FormValidatorGroupOptions<TGroup extends FormGroup = FormGroup,
|
|
|
16
16
|
onSubmit?: (values: MergedValues<TInitial, TGroup>, group: FormValidatorGroup<TGroup, TInitial>) => Promise<void> | void;
|
|
17
17
|
onValidate?: (group: FormValidatorGroup<TGroup, TInitial>) => ValidationError | null | void;
|
|
18
18
|
errorParser?: ErrorParser;
|
|
19
|
+
onSubmitError?: (errors: ValidationError[]) => void;
|
|
19
20
|
}
|
|
20
21
|
interface ComponentLike {
|
|
21
22
|
forceUpdate: () => void;
|
|
@@ -27,6 +28,7 @@ export default class FormValidatorGroup<TGroup extends FormGroup = FormGroup, TI
|
|
|
27
28
|
onSubmitCallback: (values: MergedValues<TInitial, TGroup>, group: FormValidatorGroup<TGroup, TInitial>) => Promise<void> | void;
|
|
28
29
|
onValidateCallback: (group: FormValidatorGroup<TGroup, TInitial>) => ValidationError | null | void;
|
|
29
30
|
errorParser: ErrorParser;
|
|
31
|
+
onSubmitError: (errors: ValidationError[]) => void;
|
|
30
32
|
submitCount: number;
|
|
31
33
|
onDebounce: (values: MergedValues<TInitial, TGroup>) => void;
|
|
32
34
|
onReset: (group: FormValidatorGroup<TGroup, TInitial>, valuesAfterCreation: FormValues, initialValues: TInitial) => void;
|
|
@@ -35,7 +37,7 @@ export default class FormValidatorGroup<TGroup extends FormGroup = FormGroup, TI
|
|
|
35
37
|
* @param component - Class component instance for forceUpdate (pass null when using hooks)
|
|
36
38
|
* @param options - initialValues, onSubmit, onValidate, errorParser
|
|
37
39
|
*/
|
|
38
|
-
constructor(formValidatorGroup: TGroup, component?: ComponentLike | null, { initialValues, onSubmit, onValidate, errorParser, }?: FormValidatorGroupOptions<TGroup, TInitial>);
|
|
40
|
+
constructor(formValidatorGroup: TGroup, component?: ComponentLike | null, { initialValues, onSubmit, onValidate, errorParser, onSubmitError, }?: FormValidatorGroupOptions<TGroup, TInitial>);
|
|
39
41
|
get isSubmitting(): boolean;
|
|
40
42
|
get wasTouched(): boolean;
|
|
41
43
|
get isDirty(): boolean;
|
|
@@ -45,7 +47,11 @@ export default class FormValidatorGroup<TGroup extends FormGroup = FormGroup, TI
|
|
|
45
47
|
set: (validatorName: keyof TGroup & string, value: unknown) => this;
|
|
46
48
|
reset: (toOverride?: FormValues) => void;
|
|
47
49
|
resetDirtyAndTouched: () => void;
|
|
48
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Parses an API error and pushes field-level errors into the matching validators.
|
|
52
|
+
* When field errors are found and isInternal is set, surfaces the first field message.
|
|
53
|
+
* When the error shape isn't recognised (no field errors), always surfaces a generic message.
|
|
54
|
+
*/
|
|
49
55
|
parseError: (err: unknown, isInternal?: boolean) => void;
|
|
50
56
|
registerOnUpdateListener: (callback: UpdateListener) => void;
|
|
51
57
|
removeOnUpdateListener: (callback: UpdateListener) => void;
|
|
@@ -8,8 +8,11 @@ import { FormGroup, FormValidatorGroupOptions, InferGroupValues } from './formVa
|
|
|
8
8
|
* onSubmit / onValidate are kept fresh via refs — they always reflect the latest
|
|
9
9
|
* closure without needing to be listed in effect dependencies.
|
|
10
10
|
*
|
|
11
|
+
* onSubmitError defaults to showing the message as an error toast (provided by FormValidatorGroupWithForm);
|
|
12
|
+
* pass options.onSubmitError to override.
|
|
13
|
+
*
|
|
11
14
|
* @param groupDef - Map of field name → FormValidator instance
|
|
12
|
-
* @param options - initialValues, onSubmit, onValidate, errorParser
|
|
15
|
+
* @param options - initialValues, onSubmit, onValidate, errorParser, onSubmitError
|
|
13
16
|
*
|
|
14
17
|
* @example
|
|
15
18
|
* const form = useFormValidatorGroup(
|
|
@@ -20,4 +23,4 @@ import { FormGroup, FormValidatorGroupOptions, InferGroupValues } from './formVa
|
|
|
20
23
|
* },
|
|
21
24
|
* );
|
|
22
25
|
*/
|
|
23
|
-
export declare function useFormValidatorGroup<TGroup extends FormGroup = FormGroup, TInitial = InferGroupValues<TGroup>>(groupDef: TGroup, { initialValues, onSubmit, onValidate, errorParser }?: FormValidatorGroupOptions<TGroup, TInitial>): FormValidatorGroup<TGroup, TInitial>;
|
|
26
|
+
export declare function useFormValidatorGroup<TGroup extends FormGroup = FormGroup, TInitial = InferGroupValues<TGroup>>(groupDef: TGroup, { initialValues, onSubmit, onValidate, errorParser, onSubmitError }?: FormValidatorGroupOptions<TGroup, TInitial>): FormValidatorGroup<TGroup, TInitial>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahrowe/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"style": "./dist/style.css",
|
|
39
39
|
"bin": {
|
|
40
|
-
"ahrowe-ui-mcp": "./dist/mcp"
|
|
40
|
+
"ahrowe-ui-mcp": "./dist/mcp.js"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
43
|
"dist",
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
"eslint-config-prettier": "^10.1.8",
|
|
100
100
|
"eslint-plugin-react": "^7.37.5",
|
|
101
101
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
102
|
+
"jiti": "^2.7.0",
|
|
102
103
|
"jsdom": "^29.1.1",
|
|
103
104
|
"postcss": "^8.5.15",
|
|
104
105
|
"postcss-nested": "^7.0.2",
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
export default class SearchInput extends React.PureComponent<any, any, any> {
|
|
3
|
-
static propTypes: {
|
|
4
|
-
id: any;
|
|
5
|
-
className: any;
|
|
6
|
-
onChange: any;
|
|
7
|
-
onDebounce: any;
|
|
8
|
-
placeholder: any;
|
|
9
|
-
value: any;
|
|
10
|
-
totalAmount: any;
|
|
11
|
-
maxLength: any;
|
|
12
|
-
dataTest: any;
|
|
13
|
-
width: any;
|
|
14
|
-
showAmount: any;
|
|
15
|
-
label: any;
|
|
16
|
-
autoComplete: any;
|
|
17
|
-
};
|
|
18
|
-
static defaultProps: {
|
|
19
|
-
id: null;
|
|
20
|
-
className: string;
|
|
21
|
-
placeholder: string;
|
|
22
|
-
totalAmount: undefined;
|
|
23
|
-
maxLength: number;
|
|
24
|
-
dataTest: string;
|
|
25
|
-
width: null;
|
|
26
|
-
showAmount: boolean;
|
|
27
|
-
onDebounce: () => null;
|
|
28
|
-
label: string;
|
|
29
|
-
autoComplete: string;
|
|
30
|
-
};
|
|
31
|
-
constructor(props: any);
|
|
32
|
-
constructor(props: any, context: any);
|
|
33
|
-
searchInput: React.RefObject<any>;
|
|
34
|
-
onChange: (value: any) => void;
|
|
35
|
-
onClearClicked: () => void;
|
|
36
|
-
focusInput(): void;
|
|
37
|
-
searchDebounce: any;
|
|
38
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
39
|
-
}
|
/package/dist/{mcp → mcp.js}
RENAMED
|
File without changes
|