@prokodo/ui 0.1.2 → 0.1.4

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 +63 -10
  9. package/dist/components/image/Image.js +3 -1
  10. package/dist/components/image/Image.lazy.js +1 -1
  11. package/dist/components/image/Image.server.js +16 -22
  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
@@ -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,