@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.
Files changed (54) hide show
  1. package/README.md +1 -0
  2. package/dist/components/accordion/Accordion.base.module.scss.js +6 -1
  3. package/dist/components/accordion/Accordion.view.js +73 -48
  4. package/dist/components/card/Card.view.js +0 -1
  5. package/dist/components/dialog/Dialog.view.js +76 -62
  6. package/dist/components/form/Form.view.js +78 -67
  7. package/dist/components/form/FormField.client.js +18 -1
  8. package/dist/components/image/Image.client.js +2 -2
  9. package/dist/components/image/Image.js +1 -1
  10. package/dist/components/image/Image.lazy.js +1 -1
  11. package/dist/components/image/Image.server.js +7 -9
  12. package/dist/components/post-teaser/PostTeaser.view.js +9 -5
  13. package/dist/components/post-widget/PostWidget.view.js +1 -3
  14. package/dist/components/post-widget-carousel/PostWidgetCarousel.view.js +1 -3
  15. package/dist/components/rating/Rating.client.js +162 -0
  16. package/dist/components/rating/Rating.js +12 -0
  17. package/dist/components/rating/Rating.lazy.js +12 -0
  18. package/dist/components/rating/Rating.module.scss.js +22 -0
  19. package/dist/components/rating/Rating.server.js +11 -0
  20. package/dist/components/rating/Rating.validation.js +18 -0
  21. package/dist/components/rating/Rating.view.js +165 -0
  22. package/dist/components/rating/index.js +4 -0
  23. package/dist/components/snackbar/Snackbar.module.scss.js +2 -3
  24. package/dist/components/snackbar/Snackbar.view.js +20 -4
  25. package/dist/constants/project.js +1 -1
  26. package/dist/helpers/createIsland.js +17 -9
  27. package/dist/helpers/createLazyWrapper.js +9 -8
  28. package/dist/index.js +2 -0
  29. package/dist/tsconfig.build.tsbuildinfo +1 -1
  30. package/dist/types/components/accordion/Accordion.model.d.ts +1 -0
  31. package/dist/types/components/card/Card.model.d.ts +2 -3
  32. package/dist/types/components/dialog/Dialog.model.d.ts +1 -0
  33. package/dist/types/components/dialog/Dialog.view.d.ts +1 -1
  34. package/dist/types/components/form/Form.model.d.ts +7 -3
  35. package/dist/types/components/image/Image.d.ts +26 -2
  36. package/dist/types/components/image/Image.lazy.d.ts +26 -2
  37. package/dist/types/components/image/Image.model.d.ts +2 -7
  38. package/dist/types/components/post-teaser/PostTeaser.view.d.ts +1 -1
  39. package/dist/types/components/post-widget/PostWidget.view.d.ts +1 -1
  40. package/dist/types/components/post-widget-carousel/PostWidgetCarousel.view.d.ts +1 -1
  41. package/dist/types/components/rating/Rating.client.d.ts +5 -0
  42. package/dist/types/components/rating/Rating.d.ts +4 -0
  43. package/dist/types/components/rating/Rating.lazy.d.ts +5 -0
  44. package/dist/types/components/rating/Rating.model.d.ts +52 -0
  45. package/dist/types/components/rating/Rating.server.d.ts +3 -0
  46. package/dist/types/components/rating/Rating.validation.d.ts +2 -0
  47. package/dist/types/components/rating/Rating.view.d.ts +3 -0
  48. package/dist/types/components/rating/index.d.ts +2 -0
  49. package/dist/types/components/snackbar/Snackbar.model.d.ts +4 -1
  50. package/dist/types/components/snackbar/Snackbar.view.d.ts +1 -1
  51. package/dist/types/components/snackbar/SnackbarProvider.model.d.ts +3 -13
  52. package/dist/types/index.d.ts +1 -0
  53. package/dist/ui.css +298 -26
  54. package/package.json +5 -1
@@ -1,7 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { jsxs, jsx } from "react/jsx-runtime";
4
- import { isValidElement } from "react";
5
4
  import { create } from "../../helpers/bem.js";
6
5
  import { localizeDate } from "../../helpers/date.js";
7
6
  import { isString, isNumber } from "../../helpers/validations.js";
@@ -58,9 +57,7 @@ function PostTeaserView(props) {
58
57
  // perf defaults
59
58
  decoding: baseImg.decoding ?? "async",
60
59
  loading: baseImg.loading ?? "lazy",
61
- sizes: baseImg.sizes ?? "(max-width: 960px) 100vw, 33vw",
62
- // IMPORTANT: do not explicitly set imageComponent if it's falsy
63
- ...isValidElement(baseImg.imageComponent) ? { imageComponent: baseImg.imageComponent } : {}
60
+ sizes: baseImg.sizes ?? "(max-width: 960px) 100vw, 33vw"
64
61
  } : void 0;
65
62
  let formattedDate;
66
63
  if (isString(date)) {
@@ -144,7 +141,14 @@ function PostTeaserView(props) {
144
141
  }
145
142
  )
146
143
  ] }),
147
- /* @__PURE__ */ jsx(Image, { ...imageMerged })
144
+ /* @__PURE__ */ jsx(
145
+ Image,
146
+ {
147
+ ...imageMerged,
148
+ alt: (imageMerged == null ? void 0 : imageMerged.alt) ?? "",
149
+ src: (imageMerged == null ? void 0 : imageMerged.src) ?? ""
150
+ }
151
+ )
148
152
  ]
149
153
  }
150
154
  ),
@@ -1,7 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { jsxs, jsx } from "react/jsx-runtime";
4
- import { isValidElement } from "react";
5
4
  import { create } from "../../helpers/bem.js";
6
5
  import { localizeDate } from "../../helpers/date.js";
7
6
  import { isString } from "../../helpers/validations.js";
@@ -99,8 +98,7 @@ function PostWidgetView({
99
98
  ),
100
99
  decoding: ((_d = (_c = item.componentsProps) == null ? void 0 : _c.image) == null ? void 0 : _d.decoding) ?? ((_e = componentsProps == null ? void 0 : componentsProps.image) == null ? void 0 : _e.decoding) ?? imgBase.decoding ?? "async",
101
100
  loading: ((_g = (_f = item.componentsProps) == null ? void 0 : _f.image) == null ? void 0 : _g.loading) ?? ((_h = componentsProps == null ? void 0 : componentsProps.image) == null ? void 0 : _h.loading) ?? imgBase.loading ?? "lazy",
102
- sizes: ((_j = (_i = item.componentsProps) == null ? void 0 : _i.image) == null ? void 0 : _j.sizes) ?? ((_k = componentsProps == null ? void 0 : componentsProps.image) == null ? void 0 : _k.sizes) ?? imgBase.sizes ?? "(max-width: 960px) 100vw, 20vw",
103
- ...isValidElement(imgBase == null ? void 0 : imgBase.imageComponent) ? { imageComponent: imgBase.imageComponent } : {}
101
+ sizes: ((_j = (_i = item.componentsProps) == null ? void 0 : _i.image) == null ? void 0 : _j.sizes) ?? ((_k = componentsProps == null ? void 0 : componentsProps.image) == null ? void 0 : _k.sizes) ?? imgBase.sizes ?? "(max-width: 960px) 100vw, 20vw"
104
102
  } : void 0;
105
103
  const linkMerged = {
106
104
  ...(componentsProps == null ? void 0 : componentsProps.link) ?? {},
@@ -1,7 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { jsxs, jsx } from "react/jsx-runtime";
4
- import { isValidElement } from "react";
5
4
  import { create } from "../../helpers/bem.js";
6
5
  import { isString } from "../../helpers/validations.js";
7
6
  import styles from "./PostWidgetCarousel.module.scss.js";
@@ -132,8 +131,7 @@ function PostWidgetCarouselView(props) {
132
131
  containerClassName: bem("carousel__item__image__container"),
133
132
  decoding: ((_e = (_d = item.componentsProps) == null ? void 0 : _d.image) == null ? void 0 : _e.decoding) ?? ((_f = componentsProps == null ? void 0 : componentsProps.image) == null ? void 0 : _f.decoding) ?? imgBase.decoding ?? "async",
134
133
  loading: ((_h = (_g = item.componentsProps) == null ? void 0 : _g.image) == null ? void 0 : _h.loading) ?? ((_i = componentsProps == null ? void 0 : componentsProps.image) == null ? void 0 : _i.loading) ?? imgBase.loading ?? "lazy",
135
- sizes: ((_k = (_j = item.componentsProps) == null ? void 0 : _j.image) == null ? void 0 : _k.sizes) ?? ((_l = componentsProps == null ? void 0 : componentsProps.image) == null ? void 0 : _l.sizes) ?? imgBase.sizes ?? "(max-width: 960px) 100vw, 100vw",
136
- ...isValidElement(imgBase == null ? void 0 : imgBase.imageComponent) ? { imageComponent: imgBase.imageComponent } : {}
134
+ sizes: ((_k = (_j = item.componentsProps) == null ? void 0 : _j.image) == null ? void 0 : _k.sizes) ?? ((_l = componentsProps == null ? void 0 : componentsProps.image) == null ? void 0 : _l.sizes) ?? imgBase.sizes ?? "(max-width: 960px) 100vw, 100vw"
137
135
  } : void 0;
138
136
  const linkMerged = {
139
137
  ...(componentsProps == null ? void 0 : componentsProps.link) ?? {},
@@ -0,0 +1,162 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { memo, useState, useEffect, useCallback, useMemo } from "react";
6
+ import { isNumber, isString } from "../../helpers/validations.js";
7
+ import { handleRatingValidation } from "./Rating.validation.js";
8
+ import { RatingView } from "./Rating.view.js";
9
+ function RatingClient({
10
+ isFocused,
11
+ name,
12
+ value,
13
+ defaultValue,
14
+ max = 5,
15
+ min = 1,
16
+ disabled,
17
+ readOnly,
18
+ required,
19
+ helperText,
20
+ errorText,
21
+ errorTranslations,
22
+ fullWidth,
23
+ className,
24
+ fieldClassName,
25
+ groupClassName,
26
+ iconClassName,
27
+ inputRef,
28
+ onChange,
29
+ onValidate,
30
+ onFocus,
31
+ onBlur,
32
+ ...rest
33
+ }) {
34
+ const [focused, setFocused] = useState(false);
35
+ const [val, setVal] = useState(
36
+ value !== void 0 ? value : defaultValue
37
+ );
38
+ const [hover, setHover] = useState(void 0);
39
+ const [err, setErr] = useState(errorText);
40
+ useEffect(() => {
41
+ if (isNumber(value) || isString(value)) {
42
+ setVal(value);
43
+ }
44
+ }, [value]);
45
+ const runValidation = useCallback(
46
+ (newVal) => {
47
+ const numeric = isNumber(newVal) ? newVal : isString(newVal) ? Number(newVal) : void 0;
48
+ handleRatingValidation(
49
+ name,
50
+ numeric,
51
+ required,
52
+ min,
53
+ max,
54
+ errorTranslations,
55
+ (n, error) => {
56
+ setErr(error);
57
+ onValidate == null ? void 0 : onValidate(n, error);
58
+ }
59
+ );
60
+ },
61
+ [name, required, min, max, errorTranslations, onValidate]
62
+ );
63
+ const handleItemClick = useCallback(
64
+ (e) => {
65
+ if (Boolean(disabled) || Boolean(readOnly)) return;
66
+ const { value: raw } = e.currentTarget.dataset;
67
+ if (raw == null) return;
68
+ const numeric = Number(raw);
69
+ const next = numeric;
70
+ setVal(next);
71
+ runValidation(next);
72
+ onChange == null ? void 0 : onChange({ name, value: next });
73
+ },
74
+ [disabled, readOnly, name, onChange, runValidation]
75
+ );
76
+ const handleItemHover = useCallback(
77
+ (e) => {
78
+ if (Boolean(disabled) || Boolean(readOnly)) return;
79
+ const { value: raw } = e.currentTarget.dataset;
80
+ if (raw == null) return;
81
+ setHover(raw);
82
+ },
83
+ [disabled, readOnly]
84
+ );
85
+ const handleMouseLeave = useCallback(() => {
86
+ if (Boolean(disabled) || Boolean(readOnly)) return;
87
+ setHover(void 0);
88
+ }, [disabled, readOnly]);
89
+ const handleFocus = useCallback(
90
+ (e) => {
91
+ setFocused(true);
92
+ onFocus == null ? void 0 : onFocus(e);
93
+ },
94
+ [onFocus]
95
+ );
96
+ const handleBlur = useCallback(
97
+ (e) => {
98
+ setFocused(false);
99
+ onBlur == null ? void 0 : onBlur(e);
100
+ },
101
+ [onBlur]
102
+ );
103
+ const viewProps = useMemo(
104
+ () => ({
105
+ ...rest,
106
+ name,
107
+ value: val,
108
+ hoverValue: hover,
109
+ max,
110
+ min,
111
+ disabled,
112
+ readOnly,
113
+ required,
114
+ helperText,
115
+ errorText: err,
116
+ fullWidth,
117
+ className,
118
+ fieldClassName,
119
+ groupClassName,
120
+ iconClassName,
121
+ inputRef,
122
+ isFocused: isFocused !== void 0 ? Boolean(isFocused) : focused,
123
+ onClick: handleItemClick,
124
+ onMouseEnter: handleItemHover,
125
+ onMouseLeave: handleMouseLeave,
126
+ onFocus: handleFocus,
127
+ onBlur: handleBlur
128
+ }),
129
+ [
130
+ rest,
131
+ name,
132
+ val,
133
+ hover,
134
+ max,
135
+ min,
136
+ disabled,
137
+ readOnly,
138
+ required,
139
+ helperText,
140
+ err,
141
+ fullWidth,
142
+ className,
143
+ fieldClassName,
144
+ groupClassName,
145
+ iconClassName,
146
+ inputRef,
147
+ isFocused,
148
+ focused,
149
+ handleItemClick,
150
+ handleItemHover,
151
+ handleMouseLeave,
152
+ handleFocus,
153
+ handleBlur
154
+ ]
155
+ );
156
+ return /* @__PURE__ */ jsx(RatingView, { ...viewProps });
157
+ }
158
+ __name(RatingClient, "RatingClient");
159
+ const RatingClient$1 = memo(RatingClient);
160
+ export {
161
+ RatingClient$1 as default
162
+ };
@@ -0,0 +1,12 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { createIsland } from "../../helpers/createIsland.js";
4
+ import RatingServer from "./Rating.server.js";
5
+ const Rating = createIsland({
6
+ name: "Rating",
7
+ Server: RatingServer,
8
+ loadLazy: /* @__PURE__ */ __name(() => import("./Rating.lazy.js"), "loadLazy")
9
+ });
10
+ export {
11
+ Rating
12
+ };
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { createLazyWrapper } from "../../helpers/createLazyWrapper.js";
3
+ import RatingClient from "./Rating.client.js";
4
+ import RatingServer from "./Rating.server.js";
5
+ const Rating_lazy = createLazyWrapper({
6
+ name: "Rating",
7
+ Client: RatingClient,
8
+ Server: RatingServer
9
+ });
10
+ export {
11
+ Rating_lazy as default
12
+ };
@@ -0,0 +1,22 @@
1
+ const styles = {
2
+ "prokodo-Rating": "prokodo-Rating",
3
+ "prokodo-Rating--full-width": "prokodo-Rating--full-width",
4
+ "prokodo-Rating__inner": "prokodo-Rating__inner",
5
+ "prokodo-Rating__label": "prokodo-Rating__label",
6
+ "prokodo-Rating__field": "prokodo-Rating__field",
7
+ "prokodo-Rating__group": "prokodo-Rating__group",
8
+ "prokodo-Rating__icon": "prokodo-Rating__icon",
9
+ "prokodo-Rating__icon__symbol": "prokodo-Rating__icon__symbol",
10
+ "prokodo-Rating__icon__sr-only": "prokodo-Rating__icon__sr-only",
11
+ "prokodo-Rating__icon--filled": "prokodo-Rating__icon--filled",
12
+ "prokodo-Rating__icon--selected": "prokodo-Rating__icon--selected",
13
+ "prokodo-Rating__icon--disabled": "prokodo-Rating__icon--disabled",
14
+ "prokodo-Rating__icon--readonly": "prokodo-Rating__icon--readonly",
15
+ "prokodo-Rating__footer": "prokodo-Rating__footer",
16
+ "prokodo-Rating__helperText": "prokodo-Rating__helperText",
17
+ "prokodo-Rating__helperText__content": "prokodo-Rating__helperText__content",
18
+ "prokodo-Rating__helperText__content--is-error": "prokodo-Rating__helperText__content--is-error"
19
+ };
20
+ export {
21
+ styles as default
22
+ };
@@ -0,0 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { RatingView } from "./Rating.view.js";
5
+ function RatingServer(p) {
6
+ return /* @__PURE__ */ jsx(RatingView, { ...p, readOnly: true });
7
+ }
8
+ __name(RatingServer, "RatingServer");
9
+ export {
10
+ RatingServer as default
11
+ };
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ function handleRatingValidation(name, value, required, min, max, errorTranslations, onValidate) {
4
+ let error;
5
+ const hasValue = typeof value === "number" && !Number.isNaN(value);
6
+ if (Boolean(required) && (!Boolean(hasValue) || value === 0)) {
7
+ error = (errorTranslations == null ? void 0 : errorTranslations.required) ?? "This field is required.";
8
+ } else if (typeof min === "number" && hasValue && value < min) {
9
+ error = (errorTranslations == null ? void 0 : errorTranslations.min) ?? `Minimum rating is ${min}.`;
10
+ } else if (typeof max === "number" && hasValue && value > max) {
11
+ error = (errorTranslations == null ? void 0 : errorTranslations.max) ?? `Maximum rating is ${max}.`;
12
+ }
13
+ onValidate == null ? void 0 : onValidate(name, error);
14
+ }
15
+ __name(handleRatingValidation, "handleRatingValidation");
16
+ export {
17
+ handleRatingValidation
18
+ };
@@ -0,0 +1,165 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { jsxs, jsx } from "react/jsx-runtime";
4
+ import { create } from "../../helpers/bem.js";
5
+ import { isString } from "../../helpers/validations.js";
6
+ import styles from "./Rating.module.scss.js";
7
+ import { Label } from "../label/Label.js";
8
+ import { Icon } from "../icon/Icon.js";
9
+ const bem = create(styles, "Rating");
10
+ function RatingView(props) {
11
+ const {
12
+ name,
13
+ label,
14
+ labelProps = {},
15
+ disabled,
16
+ readOnly,
17
+ isFocused,
18
+ required,
19
+ fullWidth,
20
+ helperText,
21
+ errorText,
22
+ className,
23
+ fieldClassName,
24
+ groupClassName,
25
+ iconClassName,
26
+ hideLegend,
27
+ value,
28
+ hoverValue,
29
+ max = 5,
30
+ min = 1,
31
+ onClick,
32
+ onMouseEnter,
33
+ onMouseLeave,
34
+ inputRef
35
+ } = props;
36
+ const isError = typeof errorText === "string";
37
+ const hasHelperText = isString(helperText);
38
+ const errorId = isError ? `${name}-error` : void 0;
39
+ const helperId = !isError && hasHelperText ? `${name}-helper` : void 0;
40
+ const describedBy = [errorId, helperId].filter(Boolean).join(" ") || void 0;
41
+ const current = hoverValue ?? value ?? null;
42
+ const maxSafe = max && max > 0 ? max : 5;
43
+ const minSafe = min && min > 0 ? min : 1;
44
+ return /* @__PURE__ */ jsxs(
45
+ "div",
46
+ {
47
+ className: bem(
48
+ void 0,
49
+ { "full-width": Boolean(fullWidth) },
50
+ className
51
+ ),
52
+ children: [
53
+ /* @__PURE__ */ jsxs("div", { className: bem("inner"), children: [
54
+ typeof label === "string" && /* @__PURE__ */ jsx(
55
+ Label,
56
+ {
57
+ ...labelProps,
58
+ error: isError,
59
+ htmlFor: name,
60
+ label,
61
+ required,
62
+ className: bem(
63
+ "label",
64
+ {
65
+ "is-focused": Boolean(isFocused) || current !== null
66
+ },
67
+ labelProps.className
68
+ )
69
+ }
70
+ ),
71
+ /* @__PURE__ */ jsx("div", { className: bem("field", void 0, fieldClassName), children: /* @__PURE__ */ jsxs(
72
+ "div",
73
+ {
74
+ "aria-describedby": describedBy,
75
+ "aria-disabled": disabled,
76
+ "aria-invalid": isError,
77
+ "aria-required": required,
78
+ className: bem("group", void 0, groupClassName),
79
+ role: "radiogroup",
80
+ children: [
81
+ Array.from({ length: maxSafe }, (_, idx) => {
82
+ const itemValue = idx + 1;
83
+ const filled = current != null && itemValue <= current;
84
+ const isSelected = value != null && itemValue === value;
85
+ return /* @__PURE__ */ jsxs(
86
+ "button",
87
+ {
88
+ "aria-checked": isSelected,
89
+ "aria-label": `${itemValue} ${itemValue === 1 ? "star" : "stars"}`,
90
+ "data-value": itemValue,
91
+ disabled,
92
+ role: "radio",
93
+ type: "button",
94
+ className: bem(
95
+ "icon",
96
+ {
97
+ filled,
98
+ disabled: Boolean(disabled),
99
+ readonly: Boolean(readOnly),
100
+ selected: isSelected
101
+ },
102
+ iconClassName
103
+ ),
104
+ onClick,
105
+ onMouseEnter,
106
+ onMouseLeave,
107
+ children: [
108
+ /* @__PURE__ */ jsx(
109
+ Icon,
110
+ {
111
+ "aria-hidden": "true",
112
+ className: bem("icon__symbol"),
113
+ name: "StarIcon",
114
+ size: "md"
115
+ }
116
+ ),
117
+ !Boolean(hideLegend) && /* @__PURE__ */ jsx("span", { className: bem("icon__sr-only"), children: itemValue >= minSafe ? `${itemValue} / ${maxSafe}` : itemValue })
118
+ ]
119
+ },
120
+ itemValue
121
+ );
122
+ }),
123
+ /* @__PURE__ */ jsx(
124
+ "input",
125
+ {
126
+ ref: inputRef,
127
+ readOnly: true,
128
+ id: name,
129
+ max: maxSafe,
130
+ min: minSafe,
131
+ name,
132
+ type: "hidden",
133
+ value: value ?? ""
134
+ }
135
+ )
136
+ ]
137
+ }
138
+ ) })
139
+ ] }),
140
+ (isError || hasHelperText) && /* @__PURE__ */ jsx("div", { className: bem("footer"), children: (isError || hasHelperText) && /* @__PURE__ */ jsx(
141
+ "div",
142
+ {
143
+ "aria-live": isError ? "assertive" : "polite",
144
+ className: bem("helperText"),
145
+ id: errorId ?? helperId,
146
+ role: isError ? "alert" : void 0,
147
+ children: /* @__PURE__ */ jsx(
148
+ "span",
149
+ {
150
+ className: bem("helperText__content", {
151
+ "is-error": isError
152
+ }),
153
+ children: errorText ?? helperText
154
+ }
155
+ )
156
+ }
157
+ ) })
158
+ ]
159
+ }
160
+ );
161
+ }
162
+ __name(RatingView, "RatingView");
163
+ export {
164
+ RatingView
165
+ };
@@ -0,0 +1,4 @@
1
+ import { Rating } from "./Rating.js";
2
+ export {
3
+ Rating
4
+ };
@@ -11,13 +11,12 @@ const styles = {
11
11
  "prokodo-SnackbarProvider": "prokodo-SnackbarProvider",
12
12
  "prokodo-SnackbarProvider--is-top": "prokodo-SnackbarProvider--is-top",
13
13
  "prokodo-SnackbarProvider--is-bottom": "prokodo-SnackbarProvider--is-bottom",
14
+ "prokodo-SnackbarProvider--is-center": "prokodo-SnackbarProvider--is-center",
14
15
  "prokodo-SnackbarProvider--is-left": "prokodo-SnackbarProvider--is-left",
15
16
  "prokodo-SnackbarProvider--is-right": "prokodo-SnackbarProvider--is-right",
16
17
  "prokodo-SnackbarProvider__snackbar": "prokodo-SnackbarProvider__snackbar",
17
18
  "prokodo-SnackbarProvider__snackbar--is-top": "prokodo-SnackbarProvider__snackbar--is-top",
18
- "prokodo-SnackbarProvider__snackbar--is-bottom": "prokodo-SnackbarProvider__snackbar--is-bottom",
19
- "prokodo-SnackbarProvider__snackbar--is-left": "prokodo-SnackbarProvider__snackbar--is-left",
20
- "prokodo-SnackbarProvider__snackbar--is-right": "prokodo-SnackbarProvider__snackbar--is-right"
19
+ "prokodo-SnackbarProvider__snackbar--is-bottom": "prokodo-SnackbarProvider__snackbar--is-bottom"
21
20
  };
22
21
  export {
23
22
  styles as default
@@ -3,6 +3,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
3
3
  import { jsxs, jsx } from "react/jsx-runtime";
4
4
  import { create } from "../../helpers/bem.js";
5
5
  import styles from "./Snackbar.module.scss.js";
6
+ import { Icon } from "../icon/Icon.js";
6
7
  const bem = create(styles, "Snackbar");
7
8
  function SnackbarView({
8
9
  message,
@@ -13,7 +14,9 @@ function SnackbarView({
13
14
  elevation = 10,
14
15
  className,
15
16
  onClose,
16
- readOnly
17
+ readOnly,
18
+ closeButtonProps,
19
+ closeIconProps
17
20
  }) {
18
21
  const pos = anchorOrigin;
19
22
  return /* @__PURE__ */ jsxs(
@@ -39,10 +42,23 @@ function SnackbarView({
39
42
  "button",
40
43
  {
41
44
  "aria-label": "Close",
42
- className: bem("close"),
43
45
  type: "button",
44
- onClick: /* @__PURE__ */ __name(() => onClose == null ? void 0 : onClose("closeIcon"), "onClick"),
45
- children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "×" })
46
+ ...closeButtonProps,
47
+ className: bem("close", void 0, closeButtonProps == null ? void 0 : closeButtonProps.className),
48
+ onClick: /* @__PURE__ */ __name((e) => {
49
+ var _a;
50
+ onClose == null ? void 0 : onClose("closeIcon");
51
+ (_a = closeButtonProps == null ? void 0 : closeButtonProps.onClick) == null ? void 0 : _a.call(closeButtonProps, e);
52
+ }, "onClick"),
53
+ children: /* @__PURE__ */ jsx(
54
+ Icon,
55
+ {
56
+ "aria-hidden": "true",
57
+ name: "Cancel01Icon",
58
+ size: "md",
59
+ ...closeIconProps
60
+ }
61
+ )
46
62
  }
47
63
  )
48
64
  ]
@@ -1,4 +1,4 @@
1
- const PROKODO_UI_VERSION = "0.1.2";
1
+ const PROKODO_UI_VERSION = "0.1.3";
2
2
  export {
3
3
  PROKODO_UI_VERSION
4
4
  };
@@ -18,27 +18,35 @@ function createIsland({
18
18
  if (typeof window === "undefined") {
19
19
  void loadLazy();
20
20
  }
21
- function withIslandAttr(el, priority) {
21
+ function withIslandAttr(el) {
22
22
  const islandName = name.toLowerCase();
23
- const extra = {
24
- "data-island": islandName
25
- };
26
- if (Boolean(priority)) extra.priority = true;
27
- return cloneElement(el, extra);
23
+ return cloneElement(
24
+ el,
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
+ { "data-island": islandName }
27
+ );
28
28
  }
29
29
  __name(withIslandAttr, "withIslandAttr");
30
- const Island = /* @__PURE__ */ __name(({ ...raw }) => {
30
+ const Island = /* @__PURE__ */ __name(({
31
+ priority = false,
32
+ ...raw
33
+ }) => {
31
34
  const props = raw;
35
+ const serverBaseProps = name === "Image" && priority ? {
36
+ ...props,
37
+ priority
38
+ } : props;
32
39
  const autoInteractive = Object.entries(props).some(
33
40
  ([k, v]) => k.startsWith("on") && typeof v === "function"
34
41
  ) || props.redirect !== void 0;
35
42
  const interactive = customInteractive ? customInteractive(props) || autoInteractive : autoInteractive;
36
- const serverSafe = stripFnProps(props);
43
+ const serverSafe = stripFnProps(serverBaseProps);
44
+ const clientProps = priority ? { ...props, priority } : { ...props };
37
45
  if (!interactive) {
38
46
  return withIslandAttr(/* @__PURE__ */ jsx(Server, { ...serverSafe }));
39
47
  }
40
48
  const fallback = withIslandAttr(/* @__PURE__ */ jsx(Server, { ...serverSafe }));
41
- return /* @__PURE__ */ jsx(Suspense, { fallback, children: withIslandAttr(/* @__PURE__ */ jsx(LazyComp, { ...props })) });
49
+ return /* @__PURE__ */ jsx(Suspense, { fallback, children: withIslandAttr(/* @__PURE__ */ jsx(LazyComp, { ...clientProps })) });
42
50
  }, "Island");
43
51
  Island.displayName = `${name}Island`;
44
52
  return Island;
@@ -16,7 +16,10 @@ function createLazyWrapper({
16
16
  ...raw
17
17
  }) => {
18
18
  var _a, _b;
19
- const props = raw;
19
+ const props = {
20
+ ...raw,
21
+ ...name === "Image" && priority ? { priority } : {}
22
+ };
20
23
  const autoInteractive = Object.entries(props).some(
21
24
  ([k, v]) => k.startsWith("on") && typeof v === "function"
22
25
  ) || props.redirect !== void 0;
@@ -35,13 +38,11 @@ function createLazyWrapper({
35
38
  )}, visible=${visible})`
36
39
  );
37
40
  }
38
- const extra = {
39
- "data-island": islandName
40
- };
41
- if (priority) {
42
- extra.priority = priority;
43
- }
44
- return cloneElement(clientEl, extra);
41
+ return cloneElement(
42
+ clientEl,
43
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
+ { "data-island": islandName }
45
+ );
45
46
  } else {
46
47
  const serverEl = /* @__PURE__ */ jsx(Server, { ...props });
47
48
  if (typeof process !== "undefined" && typeof ((_b = process == null ? void 0 : process.env) == null ? void 0 : _b.PK_ENABLE_DEBUG_LOGS) === "string") {
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ import { PostWidget } from "./components/post-widget/PostWidget.js";
35
35
  import { PostWidgetCarousel } from "./components/post-widget-carousel/PostWidgetCarousel.js";
36
36
  import { ProgressBar } from "./components/progressBar/ProgressBar.js";
37
37
  import { Quote } from "./components/quote/Quote.js";
38
+ import { Rating } from "./components/rating/Rating.js";
38
39
  import { RichText } from "./components/rich-text/RichText.js";
39
40
  import { Select } from "./components/select/Select.js";
40
41
  import { SideNav } from "./components/sidenav/SideNav.js";
@@ -82,6 +83,7 @@ export {
82
83
  PostWidgetCarousel,
83
84
  ProgressBar,
84
85
  Quote,
86
+ Rating,
85
87
  RichText,
86
88
  Select,
87
89
  SideNav,