umwd-components 0.1.769 → 0.1.770
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/cjs/src/components/common/markdown/MarkdownDisplay.js +1 -1
- package/dist/cjs/src/components/common/markdown/MarkdownTextField.js +6 -0
- package/dist/cjs/src/components/page-builder/PBCategoryBlock.js +1 -2
- package/dist/cjs/src/components/page-builder/PageBuilder.js +1 -1
- package/dist/cjs/src/index.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/common/markdown/MarkdownDisplay.js +6 -2
- package/dist/esm/src/components/common/markdown/MarkdownTextField.js +32 -0
- package/dist/esm/src/components/page-builder/PBCategoryBlock.js +16 -11
- package/dist/esm/src/components/page-builder/PageBuilder.js +1 -1
- package/dist/esm/src/index.js +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/components/common/markdown/MarkdownDisplay.d.ts +4 -1
- package/dist/esm/types/components/common/markdown/MarkdownTextField.d.ts +10 -0
- package/dist/esm/types/components/page-builder/PBCategoryBlock.d.ts +22 -21
- package/dist/esm/types/components/page-builder/PBFeaturesSection.d.ts +4 -4
- package/dist/esm/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -7,9 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
import { jsx } from 'react/jsx-runtime';
|
|
9
9
|
import MuiMarkdown from 'mui-markdown';
|
|
10
|
+
import { Box } from '@mui/material';
|
|
10
11
|
|
|
11
|
-
function MarkdownDisplay({ children, props, }) {
|
|
12
|
-
return jsx(
|
|
12
|
+
function MarkdownDisplay({ children, props, onClickCallback, sx, }) {
|
|
13
|
+
return (jsx(Box, { onClick: onClickCallback, sx: [
|
|
14
|
+
// You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array.
|
|
15
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
16
|
+
], children: jsx(MuiMarkdown, { ...props, children: children }) }));
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
export { MarkdownDisplay as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
import TextField from '@mui/material/TextField';
|
|
10
|
+
import MarkdownDisplay from './MarkdownDisplay.js';
|
|
11
|
+
|
|
12
|
+
function MarkdownTextField({ id, name, label, defaultValue = "", sx, onChangeCallback, }) {
|
|
13
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
14
|
+
const [value, setValue] = useState(defaultValue);
|
|
15
|
+
const handleChange = (event) => {
|
|
16
|
+
const newValue = event.target.value;
|
|
17
|
+
setValue(newValue);
|
|
18
|
+
if (onChangeCallback) {
|
|
19
|
+
onChangeCallback(newValue);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return (jsxs(Fragment, { children: [jsx(TextField, { id: id, name: name, label: label, value: value, variant: "standard", fullWidth: true, multiline: true, onChange: handleChange, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), sx: {
|
|
23
|
+
display: isFocused ? "block" : "none",
|
|
24
|
+
"& .MuiInputBase-input": {
|
|
25
|
+
color: "inherit",
|
|
26
|
+
padding: 0,
|
|
27
|
+
},
|
|
28
|
+
...sx,
|
|
29
|
+
} }), !isFocused && value && (jsx(MarkdownDisplay, { onClickCallback: () => setIsFocused(true), sx: { cursor: "pointer" }, children: value }))] }));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { MarkdownTextField as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
/*
|
|
3
2
|
* UMWD-Components
|
|
4
3
|
* @copyright Jelle Paulus
|
|
@@ -13,23 +12,29 @@ import Stack from '@mui/material/Stack';
|
|
|
13
12
|
import Divider from '@mui/material/Divider';
|
|
14
13
|
import Button from '@mui/material/Button';
|
|
15
14
|
import Typography from '@mui/material/Typography';
|
|
15
|
+
import Box from '@mui/material/Box';
|
|
16
|
+
import TextField from '@mui/material/TextField';
|
|
16
17
|
import { useTheme } from '@mui/material/styles';
|
|
17
18
|
import { setOpacity } from '../../lib/utils.js';
|
|
18
19
|
import ProductCard from '../e-commerce/products/ProductCard.js';
|
|
19
20
|
import MarkdownDisplay from '../common/markdown/MarkdownDisplay.js';
|
|
20
21
|
|
|
21
|
-
function PBCategoryBlock({ data, }) {
|
|
22
|
+
function PBCategoryBlock({ data, index, }) {
|
|
22
23
|
const { maxWidth = "lg", sx = {}, glass = false, previewAmount = 3 } = data;
|
|
23
24
|
const theme = useTheme();
|
|
24
|
-
return (jsx(Container, { maxWidth: maxWidth, sx: { my: 1, ...sx }, children: jsx(Grid, { container: true, spacing: 2, children: jsx(Grid, { size: 12, children: jsx(Paper, { sx: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
return (jsx(Container, { maxWidth: maxWidth || "lg", sx: { my: 1, ...sx }, children: jsx(Box, { sx: { p: 1, border: `1px dashed ${theme.palette.primary.main}` }, children: jsx(Grid, { container: true, spacing: 2, children: jsx(Grid, { size: 12, children: jsx(Paper, { sx: {
|
|
26
|
+
p: 2,
|
|
27
|
+
backdropFilter: "blur(3px)",
|
|
28
|
+
backgroundColor: setOpacity(theme.palette.background.paper, glass ? 0.1 : 1),
|
|
29
|
+
border: glass ? "1px solid rgba(255, 255, 255, 0.15)" : "none",
|
|
30
|
+
}, children: jsxs(Stack, { spacing: 2, children: [jsx(TextField, { id: "title", name: "title", label: "Title", defaultValue: data.category.title, variant: "outlined", fullWidth: true, InputProps: {
|
|
31
|
+
readOnly: true,
|
|
32
|
+
}, sx: { mb: 2 } }), jsx(TextField, { id: "description", name: "description", label: "Description", defaultValue: data.category.description, variant: "outlined", fullWidth: true, InputProps: {
|
|
33
|
+
readOnly: true,
|
|
34
|
+
} }), data.category?.description &&
|
|
35
|
+
typeof data.category.description === "string" && (jsx(MarkdownDisplay, { children: data.category.description.substring(0, 150) + "..." })), jsx(Button, { variant: "contained", href: `/shop/categories/${data.category.slug}`, children: "Learn More" }), data.category?.products?.data != undefined && (jsxs(Fragment, { children: [jsx(Divider, { sx: { my: 2 } }), jsx(Stack, { direction: { xs: "column", sm: "row" }, spacing: 2, justifyContent: "space-around", sx: { pt: 2 }, children: data.category.products.data
|
|
36
|
+
.slice(0, previewAmount)
|
|
37
|
+
.map((product) => (jsx(ProductCard, { product: product }, product.documentId))) })] })), jsx(Typography, { variant: "body2", component: "a", href: `/shop/categories/${data.category.slug}`, sx: { textDecoration: "none", color: "inherit" }, children: "Show all" })] }) }) }) }) }) }));
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
export { PBCategoryBlock };
|
|
@@ -62,7 +62,7 @@ function blockRenderer(block, index) {
|
|
|
62
62
|
case "page-elements.product-block":
|
|
63
63
|
return (jsx(PBProductBlock, { data: block }, `${block.id}-${block.__component}`));
|
|
64
64
|
case "page-elements.category-block":
|
|
65
|
-
return (jsx(PBCategoryBlock, { data: block }, `${block.id}-${block.__component}`));
|
|
65
|
+
return (jsx(PBCategoryBlock, { data: block, index: index }, `${block.id}-${block.__component}`));
|
|
66
66
|
default:
|
|
67
67
|
return null;
|
|
68
68
|
}
|
package/dist/esm/src/index.js
CHANGED
|
@@ -90,6 +90,7 @@ export { StrapiErrors } from './components/StrapiErrors.js';
|
|
|
90
90
|
export { SubmitButton } from './components/SubmitButton.js';
|
|
91
91
|
export { default as MarkdownDisplay } from './components/common/markdown/MarkdownDisplay.js';
|
|
92
92
|
export { default as MarkdownEditor } from './components/common/markdown/MarkdownEditor.js';
|
|
93
|
+
export { default as MarkdownTextField } from './components/common/markdown/MarkdownTextField.js';
|
|
93
94
|
export { areBusinessCredentailsComplete } from './lib/areBusinessCredentialsComplete.js';
|
|
94
95
|
export { isCustomerProfileComplete } from './lib/isCustomerProfileComplete.js';
|
|
95
96
|
export { isCustomerProfileCompleteV2 } from './lib/isCustomerProfileCompleteV2.js';
|