@prokodo/ui 0.1.2 → 0.1.3
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 +1 -0
- package/dist/components/accordion/Accordion.base.module.scss.js +6 -1
- package/dist/components/accordion/Accordion.view.js +73 -48
- package/dist/components/card/Card.view.js +0 -1
- package/dist/components/dialog/Dialog.view.js +76 -62
- package/dist/components/form/Form.view.js +78 -67
- package/dist/components/form/FormField.client.js +18 -1
- package/dist/components/image/Image.client.js +2 -2
- package/dist/components/image/Image.js +1 -1
- package/dist/components/image/Image.lazy.js +1 -1
- package/dist/components/image/Image.server.js +7 -9
- package/dist/components/post-teaser/PostTeaser.view.js +9 -5
- package/dist/components/post-widget/PostWidget.view.js +1 -3
- package/dist/components/post-widget-carousel/PostWidgetCarousel.view.js +1 -3
- package/dist/components/rating/Rating.client.js +162 -0
- package/dist/components/rating/Rating.js +12 -0
- package/dist/components/rating/Rating.lazy.js +12 -0
- package/dist/components/rating/Rating.module.scss.js +22 -0
- package/dist/components/rating/Rating.server.js +11 -0
- package/dist/components/rating/Rating.validation.js +18 -0
- package/dist/components/rating/Rating.view.js +165 -0
- package/dist/components/rating/index.js +4 -0
- package/dist/components/snackbar/Snackbar.module.scss.js +2 -3
- package/dist/components/snackbar/Snackbar.view.js +20 -4
- package/dist/constants/project.js +1 -1
- package/dist/helpers/createIsland.js +17 -9
- package/dist/helpers/createLazyWrapper.js +9 -8
- package/dist/index.js +2 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/accordion/Accordion.model.d.ts +1 -0
- package/dist/types/components/card/Card.model.d.ts +2 -3
- package/dist/types/components/dialog/Dialog.model.d.ts +1 -0
- package/dist/types/components/dialog/Dialog.view.d.ts +1 -1
- package/dist/types/components/form/Form.model.d.ts +7 -3
- package/dist/types/components/image/Image.d.ts +26 -2
- package/dist/types/components/image/Image.lazy.d.ts +26 -2
- package/dist/types/components/image/Image.model.d.ts +2 -7
- package/dist/types/components/post-teaser/PostTeaser.view.d.ts +1 -1
- package/dist/types/components/post-widget/PostWidget.view.d.ts +1 -1
- package/dist/types/components/post-widget-carousel/PostWidgetCarousel.view.d.ts +1 -1
- package/dist/types/components/rating/Rating.client.d.ts +5 -0
- package/dist/types/components/rating/Rating.d.ts +4 -0
- package/dist/types/components/rating/Rating.lazy.d.ts +5 -0
- package/dist/types/components/rating/Rating.model.d.ts +52 -0
- package/dist/types/components/rating/Rating.server.d.ts +3 -0
- package/dist/types/components/rating/Rating.validation.d.ts +2 -0
- package/dist/types/components/rating/Rating.view.d.ts +3 -0
- package/dist/types/components/rating/index.d.ts +2 -0
- package/dist/types/components/snackbar/Snackbar.model.d.ts +4 -1
- package/dist/types/components/snackbar/Snackbar.view.d.ts +1 -1
- package/dist/types/components/snackbar/SnackbarProvider.model.d.ts +3 -13
- package/dist/types/index.d.ts +1 -0
- package/dist/ui.css +298 -26
- package/package.json +5 -1
|
@@ -4,13 +4,12 @@ import type { LinkProps } from "../link";
|
|
|
4
4
|
import type { SkeletonProps } from "../skeleton";
|
|
5
5
|
import type { Variants } from "@/types/variants";
|
|
6
6
|
import type { StaticImageData } from "next/image";
|
|
7
|
-
import type { Ref, ReactNode, KeyboardEvent
|
|
7
|
+
import type { Ref, ReactNode, KeyboardEvent } from "react";
|
|
8
8
|
export type CardVariant = Variants;
|
|
9
9
|
export type CardBackgroundProps = {
|
|
10
|
-
imageComponent: ElementType;
|
|
11
10
|
src?: string | StaticImageData;
|
|
12
11
|
alt?: string;
|
|
13
|
-
} & Omit<ImageProps, "src" | "alt" | "width" | "height"
|
|
12
|
+
} & Omit<ImageProps, "src" | "alt" | "width" | "height">;
|
|
14
13
|
export type CardProps = {
|
|
15
14
|
ref?: Ref<HTMLDivElement>;
|
|
16
15
|
variant?: CardVariant;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { DialogViewProps } from "./Dialog.model";
|
|
2
2
|
import type { JSX } from "react";
|
|
3
|
-
export declare function DialogView({ open, title, containerRef, hideTitle, renderHeader, hideCloseButton, translations, actions, contentProps, contentRef, containerChildren, className, classNameHeader, scroll, fullScreen, titleProps, children, onClose, onCloseKeyDown, wrapperProps, closeOnBackdropClick, closeButtonProps, closeButtonRef, ...rest }: DialogViewProps): JSX.Element;
|
|
3
|
+
export declare function DialogView({ open, title, containerRef, hideTitle, renderHeader, hideCloseButton, translations, actions, contentProps, contentRef, containerChildren, className, classNameHeader, height, scroll, fullScreen, titleProps, children, onClose, onCloseKeyDown, wrapperProps, closeOnBackdropClick, closeButtonProps, closeButtonRef, ...rest }: DialogViewProps): JSX.Element;
|
|
@@ -8,9 +8,10 @@ import { InputOTP } from "../inputOTP";
|
|
|
8
8
|
import { Select, type SelectProps } from "../select";
|
|
9
9
|
import { Slider, type SliderProps } from "../slider";
|
|
10
10
|
import { Switch, type SwitchProps } from "../switch";
|
|
11
|
+
import { Rating, type RatingProps } from "../rating";
|
|
11
12
|
import type { FormFieldProps } from "./FormField.client";
|
|
12
13
|
export type FormVariants = "inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning";
|
|
13
|
-
export type FormFieldTypes = "input" | "select" | "switch" | "slider" | "date" | "dynamic-list";
|
|
14
|
+
export type FormFieldTypes = "input" | "select" | "switch" | "slider" | "date" | "dynamic-list" | "rating";
|
|
14
15
|
export type FormFieldValue = string | boolean | string[] | Record<string, string>[] | undefined;
|
|
15
16
|
export type FormFieldCondition = {
|
|
16
17
|
fieldId: string;
|
|
@@ -41,7 +42,10 @@ export type FormFieldDate = FormFieldOptionals & {
|
|
|
41
42
|
export type FormFieldDynamicList = FormFieldOptionals & {
|
|
42
43
|
fieldType: "dynamic-list";
|
|
43
44
|
} & DynamicListProps;
|
|
44
|
-
export type
|
|
45
|
+
export type FormFieldRating = FormFieldOptionals & {
|
|
46
|
+
fieldType: "rating";
|
|
47
|
+
} & RatingProps;
|
|
48
|
+
export type FormField = FormFieldInput | FormFieldSelect | FormFieldSwitch | FormFieldSlider | FormFieldDate | FormFieldDynamicList | FormFieldRating;
|
|
45
49
|
export type FormMessagesErrors = {
|
|
46
50
|
[key: string]: string[];
|
|
47
51
|
};
|
|
@@ -59,7 +63,7 @@ export type FormFieldMessagesErrors = {
|
|
|
59
63
|
export type FormFieldMessages = {
|
|
60
64
|
errors?: FormFieldMessagesErrors;
|
|
61
65
|
};
|
|
62
|
-
export type FormAllowedChildren = ReactElement<typeof DatePicker> | ReactElement<typeof Input> | ReactElement<typeof InputOTP> | ReactElement<typeof Select> | ReactElement<typeof Slider> | ReactElement<typeof Switch> | ReactElement<typeof DynamicList>;
|
|
66
|
+
export type FormAllowedChildren = ReactElement<typeof DatePicker> | ReactElement<typeof Input> | ReactElement<typeof InputOTP> | ReactElement<typeof Select> | ReactElement<typeof Slider> | ReactElement<typeof Switch> | ReactElement<typeof DynamicList> | ReactElement<typeof Rating>;
|
|
63
67
|
export type ParentComponentProps = {
|
|
64
68
|
children: FormAllowedChildren | FormAllowedChildren[];
|
|
65
69
|
};
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const Image: import("react").ComponentType<Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, "width" | "height" | "src"> & {
|
|
2
|
+
caption?: string;
|
|
3
|
+
src?: string | import("next/image").StaticImageData;
|
|
4
|
+
containerClassName?: string;
|
|
5
|
+
captionClassName?: string;
|
|
6
|
+
} & Omit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "ref" | "loading" | "width" | "height" | "src" | "alt" | "srcSet"> & {
|
|
7
|
+
src: string | import("next/dist/shared/lib/get-img-props").StaticImport;
|
|
8
|
+
alt: string;
|
|
9
|
+
width?: number | `${number}`;
|
|
10
|
+
height?: number | `${number}`;
|
|
11
|
+
fill?: boolean;
|
|
12
|
+
loader?: import("next/image").ImageLoader;
|
|
13
|
+
quality?: number | `${number}`;
|
|
14
|
+
priority?: boolean;
|
|
15
|
+
loading?: "lazy" | "eager" | undefined;
|
|
16
|
+
placeholder?: import("next/dist/shared/lib/get-img-props").PlaceholderValue;
|
|
17
|
+
blurDataURL?: string;
|
|
18
|
+
unoptimized?: boolean;
|
|
19
|
+
overrideSrc?: string;
|
|
20
|
+
onLoadingComplete?: import("next/dist/shared/lib/get-img-props").OnLoadingComplete;
|
|
21
|
+
layout?: string;
|
|
22
|
+
objectFit?: string;
|
|
23
|
+
objectPosition?: string;
|
|
24
|
+
lazyBoundary?: string;
|
|
25
|
+
lazyRoot?: string;
|
|
26
|
+
} & {
|
|
3
27
|
priority?: boolean;
|
|
4
28
|
}>;
|
|
@@ -1,5 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare const _default: import("react").ComponentType<Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, "width" | "height" | "src"> & {
|
|
2
|
+
caption?: string;
|
|
3
|
+
src?: string | import("next/image").StaticImageData;
|
|
4
|
+
containerClassName?: string;
|
|
5
|
+
captionClassName?: string;
|
|
6
|
+
} & Omit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "ref" | "loading" | "width" | "height" | "src" | "alt" | "srcSet"> & {
|
|
7
|
+
src: string | import("next/dist/shared/lib/get-img-props").StaticImport;
|
|
8
|
+
alt: string;
|
|
9
|
+
width?: number | `${number}`;
|
|
10
|
+
height?: number | `${number}`;
|
|
11
|
+
fill?: boolean;
|
|
12
|
+
loader?: import("next/image").ImageLoader;
|
|
13
|
+
quality?: number | `${number}`;
|
|
14
|
+
priority?: boolean;
|
|
15
|
+
loading?: "lazy" | "eager" | undefined;
|
|
16
|
+
placeholder?: import("next/dist/shared/lib/get-img-props").PlaceholderValue;
|
|
17
|
+
blurDataURL?: string;
|
|
18
|
+
unoptimized?: boolean;
|
|
19
|
+
overrideSrc?: string;
|
|
20
|
+
onLoadingComplete?: import("next/dist/shared/lib/get-img-props").OnLoadingComplete;
|
|
21
|
+
layout?: string;
|
|
22
|
+
objectFit?: string;
|
|
23
|
+
objectPosition?: string;
|
|
24
|
+
lazyBoundary?: string;
|
|
25
|
+
lazyRoot?: string;
|
|
26
|
+
} & {
|
|
3
27
|
priority?: boolean;
|
|
4
28
|
}>;
|
|
5
29
|
export default _default;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import type { ImageProps as NextImageProps, StaticImageData } from "next/image";
|
|
2
|
-
import type { ImgHTMLAttributes
|
|
2
|
+
import type { ImgHTMLAttributes } from "react";
|
|
3
3
|
export type BaseImageProps = Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "width" | "height"> & {
|
|
4
4
|
caption?: string;
|
|
5
5
|
src?: string | StaticImageData;
|
|
6
6
|
containerClassName?: string;
|
|
7
7
|
captionClassName?: string;
|
|
8
|
-
imageComponent?: ElementType;
|
|
9
8
|
};
|
|
10
|
-
export type ImageProps = BaseImageProps &
|
|
11
|
-
imageComponent?: undefined;
|
|
12
|
-
} | ({
|
|
13
|
-
imageComponent: ElementType;
|
|
14
|
-
} & NextImageProps));
|
|
9
|
+
export type ImageProps = BaseImageProps & NextImageProps;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type JSX } from "react";
|
|
2
1
|
import type { PostWidgetProps } from "./PostWidget.model";
|
|
2
|
+
import type { JSX } from "react";
|
|
3
3
|
export declare function PostWidgetView({ fullWidth, className, title, listClassName, contentClassName, items, classes, componentsProps, structuredData, ...rest }: PostWidgetProps): JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type JSX } from "react";
|
|
2
|
+
import type { RatingProps } from "./Rating.model";
|
|
3
|
+
declare function RatingClient({ isFocused, name, value, defaultValue, max, min, disabled, readOnly, required, helperText, errorText, errorTranslations, fullWidth, className, fieldClassName, groupClassName, iconClassName, inputRef, onChange, onValidate, onFocus, onBlur, ...rest }: RatingProps): JSX.Element;
|
|
4
|
+
declare const _default: import("react").MemoExoticComponent<typeof RatingClient>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { LabelProps } from "../label";
|
|
2
|
+
import type { Ref, FocusEvent, MouseEvent } from "react";
|
|
3
|
+
export type RatingValue = number | string;
|
|
4
|
+
export type RatingChangeEvent = {
|
|
5
|
+
name: string;
|
|
6
|
+
value: RatingValue;
|
|
7
|
+
};
|
|
8
|
+
export type RatingChangeEventHandler = (event: RatingChangeEvent) => void;
|
|
9
|
+
export type RatingValidateEvent = (name: string, error?: string) => void;
|
|
10
|
+
export type RatingFocusEvent = FocusEvent<HTMLElement>;
|
|
11
|
+
export type RatingFocusEventHandler = (event: RatingFocusEvent) => void;
|
|
12
|
+
export type RatingBlurEvent = RatingFocusEvent;
|
|
13
|
+
export type RatingBlurEventHandler = (event: RatingBlurEvent) => void;
|
|
14
|
+
export type RatingErrorTranslations = {
|
|
15
|
+
required?: string;
|
|
16
|
+
min?: string;
|
|
17
|
+
max?: string;
|
|
18
|
+
};
|
|
19
|
+
export type RatingProps = {
|
|
20
|
+
id?: string;
|
|
21
|
+
name: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
labelProps?: Omit<LabelProps, "label" | "required" | "error" | "htmlFor">;
|
|
24
|
+
value?: RatingValue;
|
|
25
|
+
defaultValue?: RatingValue;
|
|
26
|
+
max?: number;
|
|
27
|
+
min?: number;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
readOnly?: boolean;
|
|
30
|
+
required?: boolean;
|
|
31
|
+
fullWidth?: boolean;
|
|
32
|
+
helperText?: string;
|
|
33
|
+
errorText?: string;
|
|
34
|
+
errorTranslations?: RatingErrorTranslations;
|
|
35
|
+
isFocused?: boolean;
|
|
36
|
+
className?: string;
|
|
37
|
+
fieldClassName?: string;
|
|
38
|
+
groupClassName?: string;
|
|
39
|
+
iconClassName?: string;
|
|
40
|
+
hideLegend?: boolean;
|
|
41
|
+
onChange?: RatingChangeEventHandler;
|
|
42
|
+
onValidate?: RatingValidateEvent;
|
|
43
|
+
onFocus?: RatingFocusEventHandler;
|
|
44
|
+
onBlur?: RatingBlurEventHandler;
|
|
45
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
46
|
+
};
|
|
47
|
+
export type RatingViewProps = RatingProps & {
|
|
48
|
+
hoverValue?: RatingValue;
|
|
49
|
+
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
50
|
+
onMouseEnter?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
51
|
+
onMouseLeave?: () => void;
|
|
52
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { RatingErrorTranslations, RatingValidateEvent, RatingValue } from "./Rating.model";
|
|
2
|
+
export declare function handleRatingValidation(name: string, value?: RatingValue, required?: boolean, min?: number, max?: number, errorTranslations?: RatingErrorTranslations, onValidate?: RatingValidateEvent): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IconProps } from "../icon";
|
|
2
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
3
|
export type SnackbarVariant = "default" | "success" | "error" | "warning" | "info";
|
|
3
4
|
export type SnackbarAnchorOrigin = {
|
|
4
5
|
vertical: "top" | "bottom";
|
|
@@ -17,4 +18,6 @@ export interface SnackbarProps {
|
|
|
17
18
|
elevation?: number;
|
|
18
19
|
onClose?: SnackbarCloseHandler;
|
|
19
20
|
className?: string;
|
|
21
|
+
closeButtonProps?: HTMLAttributes<HTMLButtonElement>;
|
|
22
|
+
closeIconProps?: IconProps;
|
|
20
23
|
}
|
|
@@ -4,4 +4,4 @@ export interface SnackbarViewProps extends Omit<SnackbarProps, "open"> {
|
|
|
4
4
|
onClose?: SnackbarCloseHandler;
|
|
5
5
|
readOnly?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare function SnackbarView({ message, variant, anchorOrigin, action, closeable, elevation, className, onClose, readOnly, }: SnackbarViewProps): JSX.Element;
|
|
7
|
+
export declare function SnackbarView({ message, variant, anchorOrigin, action, closeable, elevation, className, onClose, readOnly, closeButtonProps, closeIconProps, }: SnackbarViewProps): JSX.Element;
|
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SnackbarProps } from "./Snackbar.model";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
|
-
export
|
|
3
|
+
export type SnackbarPayload = SnackbarProps & {
|
|
4
4
|
id?: string;
|
|
5
|
-
|
|
6
|
-
message: ReactNode;
|
|
7
|
-
variant?: SnackbarVariant;
|
|
8
|
-
autoHideDuration?: number;
|
|
9
|
-
action?: ReactNode;
|
|
10
|
-
anchorOrigin?: {
|
|
11
|
-
vertical: "top" | "bottom";
|
|
12
|
-
horizontal: "left" | "center" | "right";
|
|
13
|
-
};
|
|
14
|
-
closeable?: boolean;
|
|
15
|
-
}
|
|
5
|
+
};
|
|
16
6
|
export interface SnackbarContextValue {
|
|
17
7
|
enqueue: (s: SnackbarPayload) => string;
|
|
18
8
|
close: (id: string) => void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export { PostWidget } from "./components/post-widget";
|
|
|
32
32
|
export { PostWidgetCarousel } from "./components/post-widget-carousel";
|
|
33
33
|
export { ProgressBar } from "./components/progressBar";
|
|
34
34
|
export { Quote } from "./components/quote";
|
|
35
|
+
export { Rating } from "./components/rating";
|
|
35
36
|
export { RichText } from "./components/rich-text";
|
|
36
37
|
export { Select } from "./components/select";
|
|
37
38
|
export { SideNav } from "./components/sidenav";
|