umwd-components 0.1.671 → 0.1.673

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 (27) hide show
  1. package/dist/node_modules/base64-js/index.js +1 -1
  2. package/dist/node_modules/ieee754/index.js +1 -1
  3. package/dist/src/components/logistics/vendor/EditVendorForm.js +1 -1
  4. package/dist/src/components/page-builder/ColumnsSection.js +1 -1
  5. package/dist/src/components/page-builder/PBPersonaliaSection.js +1 -1
  6. package/dist/src/components/page-elements/ColumnsSection.js +1 -1
  7. package/dist/src/components/page-elements/PersonaliaSection.js +1 -1
  8. package/dist/src/index.js +1 -1
  9. package/dist/tsconfig.build.tsbuildinfo +1 -1
  10. package/dist/types/components/page-builder/ColumnsSection.d.ts +0 -2
  11. package/dist/types/components/page-elements/ColumnsSection.d.ts +0 -2
  12. package/dist/types/components/page-elements/PersonaliaSection.d.ts +0 -2
  13. package/dist/types/index.d.ts +0 -1
  14. package/package.json +1 -1
  15. package/src/components/BlockRendererClient.tsx +54 -54
  16. package/src/components/logistics/vendor/AddVendorForm.tsx +2 -0
  17. package/src/components/logistics/vendor/EditVendorForm.tsx +157 -70
  18. package/src/components/page-builder/ColumnsSection.tsx +7 -7
  19. package/src/components/page-builder/PBPersonaliaSection.tsx +2 -2
  20. package/src/components/page-elements/ColumnsSection.tsx +7 -7
  21. package/src/components/page-elements/PersonaliaSection.tsx +55 -55
  22. package/src/index.ts +1 -1
  23. package/dist/node_modules/@strapi/blocks-react-renderer/dist/Block.js +0 -6
  24. package/dist/node_modules/@strapi/blocks-react-renderer/dist/BlocksRenderer.js +0 -7
  25. package/dist/node_modules/@strapi/blocks-react-renderer/dist/Text.js +0 -6
  26. package/dist/src/components/BlockRendererClient.js +0 -7
  27. package/dist/types/components/BlockRendererClient.d.ts +0 -5
@@ -15,8 +15,8 @@ import { MaxWidth } from "../../types/MaxWidth";
15
15
  // import { Email, LinkedIn } from "@mui/icons-material";
16
16
  import Email from "@mui/icons-material/Email";
17
17
  import LinkedIn from "@mui/icons-material/LinkedIn";
18
- import { BlockRendererClient } from "../BlockRendererClient";
19
- import { type BlocksContent } from "@strapi/blocks-react-renderer";
18
+ // import { BlockRendererClient } from "../BlockRendererClient";
19
+ // import { type BlocksContent } from "@strapi/blocks-react-renderer";
20
20
  import { StyledLink } from "../StyledLink";
21
21
  import { SxProps, Theme, useTheme } from "@mui/material/styles";
22
22
 
@@ -30,7 +30,7 @@ interface PartnerProps {
30
30
  id: number;
31
31
  name: string;
32
32
  function: string;
33
- text: BlocksContent;
33
+ // text: BlocksContent;
34
34
  photo: StrapiImageProps;
35
35
  email: string;
36
36
  phone: string;
@@ -48,53 +48,53 @@ interface PersonaliaSectionProps {
48
48
  sx?: SxProps<Theme>;
49
49
  }
50
50
 
51
- function needsShortening(data: BlocksContent, maxLength: number) {
52
- let totalLength = 0;
53
- for (const paragraph of data) {
54
- if (paragraph?.children?.length === 0) continue;
55
- if (paragraph.children[0].type !== "text") continue;
56
- totalLength += paragraph.children[0].text.length;
57
- }
58
- return totalLength > maxLength;
59
- }
60
-
61
- function shortenParagraphs(
62
- data: BlocksContent,
63
- maxLength: number
64
- ): BlocksContent {
65
- let totalLength = 0;
66
- const shortenedData: BlocksContent = [];
67
-
68
- /* for (const paragraph of data) {
69
- if (paragraph?.children?.length === 0) continue;
70
- if (paragraph.children[0].type !== "text") continue;
71
- const textNode = paragraph.children[0];
72
- const textLength = textNode.text.length;
73
- const remainingLength = maxLength - totalLength;
74
-
75
- let shortenedText;
76
- if (textLength <= remainingLength) {
77
- // Add paragraph as is if it fits entirely
78
- shortenedText = textNode.text;
79
- } else if (remainingLength > 0) {
80
- // Only shorten if there's some space left
81
- // Shorten text if it exceeds remaining space
82
- shortenedText = textNode.text.substring(0, remainingLength - 3); // Subtract 3 for "..."
83
- shortenedText += "..."; // Add ellipsis to indicate truncation
84
- } else {
85
- // No remaining space, skip adding this paragraph
86
- break;
87
- }
88
-
89
- shortenedData.push({
90
- ...paragraph,
91
- children: [{ ...textNode, text: shortenedText }],
92
- });
93
- totalLength += shortenedText.length;
94
- }*/
95
- return shortenedData;
96
- }
97
-
51
+ // function needsShortening(data: BlocksContent, maxLength: number) {
52
+ // let totalLength = 0;
53
+ // for (const paragraph of data) {
54
+ // if (paragraph?.children?.length === 0) continue;
55
+ // if (paragraph.children[0].type !== "text") continue;
56
+ // totalLength += paragraph.children[0].text.length;
57
+ // }
58
+ // return totalLength > maxLength;
59
+ // }
60
+ //
61
+ // function shortenParagraphs(
62
+ // data: BlocksContent,
63
+ // maxLength: number
64
+ // ): BlocksContent {
65
+ // let totalLength = 0;
66
+ // const shortenedData: BlocksContent = [];
67
+ //
68
+ // /* for (const paragraph of data) {
69
+ // if (paragraph?.children?.length === 0) continue;
70
+ // if (paragraph.children[0].type !== "text") continue;
71
+ // const textNode = paragraph.children[0];
72
+ // const textLength = textNode.text.length;
73
+ // const remainingLength = maxLength - totalLength;
74
+ //
75
+ // let shortenedText;
76
+ // if (textLength <= remainingLength) {
77
+ // // Add paragraph as is if it fits entirely
78
+ // shortenedText = textNode.text;
79
+ // } else if (remainingLength > 0) {
80
+ // // Only shorten if there's some space left
81
+ // // Shorten text if it exceeds remaining space
82
+ // shortenedText = textNode.text.substring(0, remainingLength - 3); // Subtract 3 for "..."
83
+ // shortenedText += "..."; // Add ellipsis to indicate truncation
84
+ // } else {
85
+ // // No remaining space, skip adding this paragraph
86
+ // break;
87
+ // }
88
+ //
89
+ // shortenedData.push({
90
+ // ...paragraph,
91
+ // children: [{ ...textNode, text: shortenedText }],
92
+ // });
93
+ // totalLength += shortenedText.length;
94
+ // }*/
95
+ // return shortenedData;
96
+ // }
97
+ //
98
98
  function PartnerDialog({
99
99
  partner,
100
100
  open,
@@ -125,7 +125,7 @@ function PartnerDialog({
125
125
  <Typography variant="body2" color="text.secondary" sx={{ mb: 2 }}>
126
126
  {partner.function}
127
127
  </Typography>
128
- {partner.text && <BlockRendererClient content={partner.text} />}
128
+ {/* {partner.text && <BlockRendererClient content={partner.text} />} */}
129
129
  </Grid>
130
130
  <Grid item xs={12} sm={5}>
131
131
  <Stack
@@ -221,11 +221,11 @@ function Partner(partner: PartnerProps, index: number) {
221
221
  setOpen(false);
222
222
  };
223
223
 
224
- const shorten = useMemo(
224
+ /* const shorten = useMemo(
225
225
  () =>
226
226
  partner?.text != null ? needsShortening(partner.text, maxLength) : false,
227
227
  [partner.text, maxLength]
228
- );
228
+ ); */
229
229
 
230
230
  return (
231
231
  <Grid item xs={12} md={6} key={partner.id}>
@@ -248,7 +248,7 @@ function Partner(partner: PartnerProps, index: number) {
248
248
  <Typography variant="body2" color="text.secondary" sx={{ mb: 2 }}>
249
249
  {partner.function}
250
250
  </Typography>
251
- {partner.text && (
251
+ {/* {partner.text && (
252
252
  <BlockRendererClient
253
253
  content={
254
254
  shorten
@@ -272,7 +272,7 @@ function Partner(partner: PartnerProps, index: number) {
272
272
  >
273
273
  more...
274
274
  </Button>
275
- )}
275
+ )} */}
276
276
  </Grid>
277
277
  <Grid item xs={12} sm={5}>
278
278
  <Stack
package/src/index.ts CHANGED
@@ -167,7 +167,7 @@ export { getUserMeLoader as getUserMeLoader } from "./data/services/get-user-me-
167
167
  export { getExtendedUserMeLoader as getExtendedUserMeLoader } from "./data/services/get-user-me-loader";
168
168
  export { getUserRole as getUserRole } from "./data/services/get-user-me-loader";
169
169
 
170
- export { BlockRendererClient as BlockRendererClient } from "./components/BlockRendererClient"; // ?? is this ok?
170
+ // export { BlockRendererClient as BlockRendererClient } from "./components/BlockRendererClient"; // ?? is this ok?
171
171
 
172
172
  // media
173
173
  export { getAllMedia as getAllMedia } from "./data/loaders/common/media/getAllMedia";
@@ -1,6 +0,0 @@
1
- /*
2
- * UMWD-Components
3
- * @copyright Jelle Paulus
4
- * @license MIT
5
- */
6
- import{jsx as t}from"react/jsx-runtime";import{createElement as e}from"react";import{useComponentsContext as r}from"./BlocksRenderer.js";import{Text as n}from"./Text.js";const c=["image"],o=i=>{let{content:p}=i;const{children:l,type:s,...u}=p,{blocks:a,missingBlockTypes:m}=r(),d=a[s];if(!d)return m.includes(s)||(console.warn('[@strapi/block-react-renderer] No component found for block type "'.concat(s,'"')),m.push(s)),null;if(c.includes(s))return t(d,{...u});if("paragraph"===s&&1===l.length&&"text"===l[0].type&&""===l[0].text)return t("br",{});const f=(t=>{const{children:e,type:r,...n}=t;if("code"===r){const e=t=>t.reduce(((t,r)=>"text"===r.type?t.concat(r.text):"link"===r.type?t.concat(e(r.children)):t),"");return{...n,plainText:e(t.children)}}return n})(p);return t(d,{...f,children:l.map(((r,c)=>{if("text"===r.type){const{type:t,...o}=r;return e(n,{...o,key:c})}return t(o,{content:r},c)}))})};export{o as Block};
@@ -1,7 +0,0 @@
1
- "use client";
2
- /*
3
- * UMWD-Components
4
- * @copyright Jelle Paulus
5
- * @license MIT
6
- */
7
- import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{Block as i}from"./Block.js";const n={blocks:{paragraph:r=>e("p",{children:r.children}),quote:r=>e("blockquote",{children:r.children}),code:r=>e("pre",{children:e("code",{children:r.plainText})}),heading:r=>{let{level:i,children:n}=r;switch(i){case 1:return e("h1",{children:n});case 2:return e("h2",{children:n});case 3:return e("h3",{children:n});case 4:return e("h4",{children:n});case 5:return e("h5",{children:n});case 6:return e("h6",{children:n})}},link:r=>e("a",{href:r.url,children:r.children}),list:r=>"ordered"===r.format?e("ol",{children:r.children}):e("ul",{children:r.children}),"list-item":r=>e("li",{children:r.children}),image:r=>e("img",{src:r.image.url,alt:r.image.alternativeText||void 0})},modifiers:{bold:r=>e("strong",{children:r.children}),italic:r=>e("em",{children:r.children}),underline:r=>e("u",{children:r.children}),strikethrough:r=>e("del",{children:r.children}),code:r=>e("code",{children:r.children})},missingBlockTypes:[],missingModifierTypes:[]},c=r.createContext(n),l=i=>{let{children:l,value:d=n}=i;const t=r.useMemo((()=>d),[d]);return e(c.Provider,{value:t,children:l})};function d(){return r.useContext(c)}const t=c=>{const d={...n.blocks,...c.blocks},t={...n.modifiers,...c.modifiers},h=r.useRef([]),o=r.useRef([]);return e(l,{value:{blocks:d,modifiers:t,missingBlockTypes:h.current,missingModifierTypes:o.current},children:c.content.map(((r,n)=>e(i,{content:r},n)))})};export{t as BlocksRenderer,l as ComponentsProvider,d as useComponentsContext};
@@ -1,6 +0,0 @@
1
- /*
2
- * UMWD-Components
3
- * @copyright Jelle Paulus
4
- * @license MIT
5
- */
6
- import{jsx as e,Fragment as r}from"react/jsx-runtime";import{useComponentsContext as o}from"./BlocksRenderer.js";const n=n=>{let{text:t,...c}=n;const{modifiers:i,missingModifierTypes:s}=o();return Object.keys(c).reduce(((r,o)=>{if(!c[o])return r;const n=i[o];return n?e(n,{children:r}):(s.includes(o)||(console.warn('[@strapi/block-react-renderer] No component found for modifier "'.concat(o,'"')),s.push(o)),r)}),e(r,{children:t}))};export{n as Text};
@@ -1,7 +0,0 @@
1
- "use client";
2
- /*
3
- * UMWD-Components
4
- * @copyright Jelle Paulus
5
- * @license MIT
6
- */
7
- import e from"react";import{BlocksRenderer as r}from"../../node_modules/@strapi/blocks-react-renderer/dist/BlocksRenderer.js";import t from"@mui/material/Typography";function n(n){var a=n.content;return a?e.createElement(r,{content:a,blocks:{paragraph:function(r){var n=r.children;return e.createElement(t,{variant:"body1",sx:{mb:2}},n)},heading:function(r){var n=r.children;switch(r.level){case 1:default:return e.createElement(t,{variant:"h1"},n);case 2:return e.createElement(t,{variant:"h2"},n);case 3:return e.createElement(t,{variant:"h3"},n);case 4:return e.createElement(t,{variant:"h4"},n);case 5:return e.createElement(t,{variant:"h5"},n);case 6:return e.createElement(t,{variant:"h6"},n)}}},modifiers:{bold:function(r){var t=r.children;return e.createElement("strong",null,t)},italic:function(r){var t=r.children;return e.createElement("span",{className:"italic"},t)}}}):null}export{n as BlockRendererClient};
@@ -1,5 +0,0 @@
1
- import React from "react";
2
- import { type BlocksContent } from "@strapi/blocks-react-renderer";
3
- export declare function BlockRendererClient({ content, }: {
4
- readonly content: BlocksContent;
5
- }): React.JSX.Element | null;