@nodeblocks/frontend-how-to-use-block 0.3.0 → 0.3.2
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/HowToUse.d.ts +10 -13
- package/dist/HowToUse.d.ts.map +1 -1
- package/dist/context.d.ts +1 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -236
- package/dist/index.esm.js +1 -234
- package/dist/lib.d.ts +19 -3
- package/dist/lib.d.ts.map +1 -1
- package/package.json +18 -11
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.js.map +0 -1
package/dist/HowToUse.d.ts
CHANGED
|
@@ -4,28 +4,23 @@ import { ReactNode } from 'react';
|
|
|
4
4
|
import { HowToUseContextValue } from './context';
|
|
5
5
|
import { BlocksOverride } from './lib';
|
|
6
6
|
declare const HowToUse: {
|
|
7
|
-
<CustomBlocks extends Record<string, ReactNode> = {}>({ className, children,
|
|
7
|
+
<CustomBlocks extends Record<string, ReactNode> = {}>({ className, children, sx, ...props }: Omit<StackProps, "children"> & {
|
|
8
8
|
children?: BlocksOverride<typeof defaultHowToUseBlocks, CustomBlocks>;
|
|
9
9
|
} & Required<Pick<HowToUseContextValue, "subtitle" | "headerContent" | "message" | "linkHref" | "linkContent">>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
Header: ({ className, children, sx, ...props }: StackProps &
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
Header: ({ className, children, sx, ...props }: StackProps & Partial<Pick<HowToUseContextValue, "subtitle" | "headerContent">>) => import("react/jsx-runtime").JSX.Element;
|
|
13
11
|
CardList: ({ children, className, sx, ...props }: StackProps & {
|
|
14
12
|
children: ReactNode;
|
|
15
13
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
Card: ({ children, className, icon: Icon, sx, ...props }: CardProps & {
|
|
14
|
+
Card: ({ children, className, icon: Icon, headerContent, sx, ...props }: CardProps & {
|
|
17
15
|
icon: SvgIconComponent;
|
|
18
|
-
|
|
16
|
+
headerContent: ReactNode;
|
|
17
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
19
18
|
Footer: ({ children, className, sx, ...props }: StackProps & Required<Pick<HowToUseContextValue, "message" | "linkHref" | "linkContent">>) => import("react/jsx-runtime").JSX.Element;
|
|
20
19
|
};
|
|
21
20
|
declare const defaultHowToUseBlocks: {
|
|
22
21
|
header: import("react").ReactElement<import("@mui/material").StackOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("@mui/material/OverridableComponent").CommonProps | keyof import("@mui/material").StackOwnProps> & {
|
|
23
22
|
component?: React.ElementType;
|
|
24
|
-
} &
|
|
25
|
-
children: ReactNode;
|
|
26
|
-
}, ({ className, children, sx, ...props }: StackProps & Required<Pick<HowToUseContextValue, "subtitle">> & {
|
|
27
|
-
children: ReactNode;
|
|
28
|
-
}) => import("react/jsx-runtime").JSX.Element>;
|
|
23
|
+
} & Partial<Pick<HowToUseContextValue, "subtitle" | "headerContent">>, ({ className, children, sx, ...props }: StackProps & Partial<Pick<HowToUseContextValue, "subtitle" | "headerContent">>) => import("react/jsx-runtime").JSX.Element>;
|
|
29
24
|
cardList: import("react").ReactElement<import("@mui/material").StackOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("@mui/material/OverridableComponent").CommonProps | keyof import("@mui/material").StackOwnProps> & {
|
|
30
25
|
component?: React.ElementType;
|
|
31
26
|
} & {
|
|
@@ -37,9 +32,11 @@ declare const defaultHowToUseBlocks: {
|
|
|
37
32
|
component?: React.ElementType;
|
|
38
33
|
} & {
|
|
39
34
|
icon: SvgIconComponent;
|
|
40
|
-
|
|
35
|
+
headerContent: ReactNode;
|
|
36
|
+
}, ({ children, className, icon: Icon, headerContent, sx, ...props }: CardProps & {
|
|
41
37
|
icon: SvgIconComponent;
|
|
42
|
-
|
|
38
|
+
headerContent: ReactNode;
|
|
39
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
43
40
|
footer: import("react").ReactElement<import("@mui/material").StackOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("@mui/material/OverridableComponent").CommonProps | keyof import("@mui/material").StackOwnProps> & {
|
|
44
41
|
component?: React.ElementType;
|
|
45
42
|
} & Required<Pick<HowToUseContextValue, "message" | "linkHref" | "linkContent">>, ({ children, className, sx, ...props }: StackProps & Required<Pick<HowToUseContextValue, "message" | "linkHref" | "linkContent">>) => import("react/jsx-runtime").JSX.Element>;
|
package/dist/HowToUse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HowToUse.d.ts","sourceRoot":"","sources":["../src/HowToUse.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAuB,SAAS,EAA0B,UAAU,EAAc,MAAM,eAAe,CAAC;AAC/G,OAAO,EAAY,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"HowToUse.d.ts","sourceRoot":"","sources":["../src/HowToUse.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAuB,SAAS,EAA0B,UAAU,EAAc,MAAM,eAAe,CAAC;AAC/G,OAAO,EAAY,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAA6D,MAAM,WAAW,CAAC;AAE5G,OAAO,EAAE,cAAc,EAAmE,MAAM,OAAO,CAAC;AAoOxG,QAAA,MAAM,QAAQ;KAAI,YAAY,SAAS,MAAM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|
9
|
+
export declare const keys: readonly ["subtitle", "headerContent", "message", "linkHref", "linkContent"];
|
|
9
10
|
export declare const HowToUseProvider: ({ children, ...value }: HowToUseContextValue & {
|
|
10
11
|
children: ReactNode;
|
|
11
12
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAc,MAAM,OAAO,CAAC;AAE7D,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,EAAE,SAAS,CAAC;IACzB,OAAO,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,SAAS,CAAC;CACxB,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAc,MAAM,OAAO,CAAC;AAE7D,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,EAAE,SAAS,CAAC;IACzB,OAAO,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,SAAS,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,IAAI,8EAMyB,CAAC;AAW3C,eAAO,MAAM,gBAAgB,GAAI,wBAG9B,oBAAoB,GAAG;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB,4CAEA,CAAC;AAEF,eAAO,MAAM,kBAAkB,4BAO9B,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,236 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof global === 'undefined') {
|
|
4
|
-
var global = window;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
'use strict';
|
|
8
|
-
|
|
9
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
10
|
-
var iconsMaterial = require('@mui/icons-material');
|
|
11
|
-
var material = require('@mui/material');
|
|
12
|
-
var react = require('react');
|
|
13
|
-
|
|
14
|
-
const HowToUseContext = react.createContext(undefined);
|
|
15
|
-
const HowToUseProvider = ({ children, ...value }) => {
|
|
16
|
-
return jsxRuntime.jsx(HowToUseContext.Provider, { value: value, children: children });
|
|
17
|
-
};
|
|
18
|
-
const useHowToUseContext = () => {
|
|
19
|
-
const context = react.useContext(HowToUseContext);
|
|
20
|
-
if (!context) {
|
|
21
|
-
throw new Error('useHowToUseContext must be used within a HowToUseProvider');
|
|
22
|
-
}
|
|
23
|
-
return context;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Creates a strongly typed `defaultBlocks` object, allowing for types to propagate into block override objects.
|
|
28
|
-
*
|
|
29
|
-
* @param components - A map of default block keys to component functions.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* const defaultBlocks = createDefaultBlocks({
|
|
33
|
-
* title: Title,
|
|
34
|
-
* description: Description,
|
|
35
|
-
* form: Form,
|
|
36
|
-
* });
|
|
37
|
-
*/
|
|
38
|
-
function createDefaultBlocks(components) {
|
|
39
|
-
return Object.fromEntries(Object.entries(components).map(([key, Component]) => [key, react.createElement(Component, { key })]));
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* A component for rendering {@link BlocksOverride|`BlocksOverride`} results.
|
|
43
|
-
* Exposes the evaluated `blocks` and `blockOrder` as arguments to the `children` function.
|
|
44
|
-
*
|
|
45
|
-
* @param props
|
|
46
|
-
* @param props.blocksOverride - The {@link BlocksOverride|`BlocksOverride`} (i.e. `children` of outer component).
|
|
47
|
-
* @param props.defaultBlocks - The default blocks of outer component.
|
|
48
|
-
* @param props.children - A function returning the JSX to render.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* <BlocksOverrideComponent
|
|
52
|
-
* defaultBlocks={defaultFormBlocks}
|
|
53
|
-
* blocksOverride={children}
|
|
54
|
-
* >
|
|
55
|
-
* {({ blocks, blockOrder }) =>
|
|
56
|
-
* blockOrder.map((key) => (
|
|
57
|
-
* <Fragment key={String(key)}>{blocks[key]}</Fragment>
|
|
58
|
-
* ))
|
|
59
|
-
* }
|
|
60
|
-
* </BlocksOverrideComponent>
|
|
61
|
-
*/
|
|
62
|
-
function BlocksOverrideComponent({ blocksOverride, defaultBlocks, defaultBlockOrder, children, }) {
|
|
63
|
-
if (blocksOverride === undefined) {
|
|
64
|
-
return children({
|
|
65
|
-
// TODO: Remove this assertion
|
|
66
|
-
blocks: defaultBlocks,
|
|
67
|
-
blockOrder: defaultBlockOrder,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
if (typeof blocksOverride === 'function') {
|
|
71
|
-
const { blocks, blockOrder } = blocksOverride({
|
|
72
|
-
defaultBlocks,
|
|
73
|
-
defaultBlockOrder,
|
|
74
|
-
});
|
|
75
|
-
return children({ blocks, blockOrder });
|
|
76
|
-
}
|
|
77
|
-
return blocksOverride;
|
|
78
|
-
}
|
|
79
|
-
function deepMerge(obj1, obj2) {
|
|
80
|
-
const result = { ...obj1 };
|
|
81
|
-
for (const key in obj2) {
|
|
82
|
-
if (obj2.hasOwnProperty(key)) {
|
|
83
|
-
const val1 = result[key];
|
|
84
|
-
const val2 = obj2[key];
|
|
85
|
-
if (Array.isArray(val1) || Array.isArray(val2)) {
|
|
86
|
-
// If either is an array, replace entirely with obj2's value
|
|
87
|
-
result[key] = val2;
|
|
88
|
-
}
|
|
89
|
-
else if (typeof val1 === 'object' && val1 !== null && typeof val2 === 'object' && val2 !== null) {
|
|
90
|
-
result[key] = deepMerge(val1, val2);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
result[key] = val2;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return result;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Utility function to join class names together, ignoring undefined or nil values.
|
|
101
|
-
* @param classes - The class names to join.
|
|
102
|
-
* @returns The joined class names.
|
|
103
|
-
*/
|
|
104
|
-
function classNames(...classes) {
|
|
105
|
-
return classes.flat().filter(Boolean).join(' ');
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const Card = ({ children, className, icon: Icon, sx, ...props }) => {
|
|
109
|
-
const { headerContent } = deepMerge(useHowToUseContext(), props);
|
|
110
|
-
return (jsxRuntime.jsx(material.Card, { component: "article", elevation: 0, className: classNames('nbb-how-to-use-card', className), sx: [
|
|
111
|
-
{
|
|
112
|
-
width: '100%',
|
|
113
|
-
maxWidth: 360,
|
|
114
|
-
},
|
|
115
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
116
|
-
], ...props, children: jsxRuntime.jsxs(material.CardContent, { component: material.Stack, spacing: 2, sx: {
|
|
117
|
-
py: { xs: 2, lg: 3 },
|
|
118
|
-
px: 2.5,
|
|
119
|
-
alignItems: { xs: 'flex-start', lg: 'unset' },
|
|
120
|
-
}, children: [jsxRuntime.jsxs(material.Stack, { direction: { xs: 'row', lg: 'column' }, spacing: { xs: 2, lg: 1 }, sx: {
|
|
121
|
-
alignItems: 'center',
|
|
122
|
-
justifyContent: 'center',
|
|
123
|
-
py: 0.5,
|
|
124
|
-
}, children: [Icon && (jsxRuntime.jsx(Icon, { sx: {
|
|
125
|
-
color: 'primary.main',
|
|
126
|
-
fontSize: { xs: 24, lg: 40 },
|
|
127
|
-
} })), jsxRuntime.jsx(material.Typography, { variant: "h6", component: "h6", sx: {
|
|
128
|
-
color: '#000',
|
|
129
|
-
fontWeight: 600,
|
|
130
|
-
fontSize: { xs: 16, lg: 25 },
|
|
131
|
-
m: 0,
|
|
132
|
-
lineHeight: 1.72,
|
|
133
|
-
}, children: headerContent })] }), jsxRuntime.jsx(material.Typography, { sx: {
|
|
134
|
-
fontSize: 16,
|
|
135
|
-
textAlign: 'left',
|
|
136
|
-
lineHeight: 1.72,
|
|
137
|
-
fontWeight: 300,
|
|
138
|
-
}, children: children })] }) }));
|
|
139
|
-
};
|
|
140
|
-
const Header = ({ className, children, sx, ...props }) => {
|
|
141
|
-
const { subtitle } = deepMerge(useHowToUseContext(), props);
|
|
142
|
-
return (jsxRuntime.jsxs(material.Stack, { spacing: { xs: 0.5, lg: 1 }, className: classNames('nbb-how-to-use-header', className), sx: [
|
|
143
|
-
{
|
|
144
|
-
textAlign: 'center',
|
|
145
|
-
},
|
|
146
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
147
|
-
], ...props, children: [jsxRuntime.jsx(material.Typography, { variant: "h4", sx: {
|
|
148
|
-
color: 'primary.main',
|
|
149
|
-
fontWeight: 'bold',
|
|
150
|
-
lineHeight: 1.5,
|
|
151
|
-
fontSize: { xs: 18, lg: 24 },
|
|
152
|
-
}, children: children }), jsxRuntime.jsx(material.Typography, { variant: "h1", component: "h1", sx: {
|
|
153
|
-
fontSize: { xs: 25, lg: 45 },
|
|
154
|
-
fontWeight: 600,
|
|
155
|
-
lineHeight: 1.5,
|
|
156
|
-
}, children: subtitle })] }));
|
|
157
|
-
};
|
|
158
|
-
const Footer = ({ children, className, sx, ...props }) => {
|
|
159
|
-
const { message, linkHref, linkContent } = deepMerge(useHowToUseContext(), props);
|
|
160
|
-
return (jsxRuntime.jsxs(material.Stack, { spacing: 1.5, className: classNames('nbb-how-to-use-footer', className), sx: [
|
|
161
|
-
{
|
|
162
|
-
alignItems: 'center',
|
|
163
|
-
},
|
|
164
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
165
|
-
], ...props, children: [message && (jsxRuntime.jsx(material.Typography, { variant: "body2", sx: {
|
|
166
|
-
color: 'primary.main',
|
|
167
|
-
fontWeight: 600,
|
|
168
|
-
lineHeight: 1.72,
|
|
169
|
-
}, children: message })), jsxRuntime.jsx(material.Button, { href: linkHref, rel: "noreferrer noopener", variant: "contained", size: "medium", sx: {
|
|
170
|
-
width: 360,
|
|
171
|
-
maxWidth: '100%',
|
|
172
|
-
py: 1.5,
|
|
173
|
-
fontSize: { lg: 22 },
|
|
174
|
-
lineHeight: 1.5,
|
|
175
|
-
fontWeight: 600,
|
|
176
|
-
}, children: linkContent })] }));
|
|
177
|
-
};
|
|
178
|
-
const CardList = ({ children, className, sx, ...props }) => {
|
|
179
|
-
return (jsxRuntime.jsx(material.Stack, { direction: { xs: 'column', lg: 'row' }, spacing: 0, className: classNames('nbb-how-to-use-card-list', className), sx: [
|
|
180
|
-
{
|
|
181
|
-
alignItems: { xs: 'center', lg: 'stretch' },
|
|
182
|
-
justifyContent: 'center',
|
|
183
|
-
},
|
|
184
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
185
|
-
], ...props, children: children && Array.isArray(children)
|
|
186
|
-
? children.reduce((total, child, i) => [
|
|
187
|
-
...total,
|
|
188
|
-
...(i > 0
|
|
189
|
-
? [
|
|
190
|
-
jsxRuntime.jsx(iconsMaterial.ArrowRight, { sx: {
|
|
191
|
-
display: { xs: 'none', lg: 'initial' },
|
|
192
|
-
fontSize: 40,
|
|
193
|
-
color: 'primary.main',
|
|
194
|
-
alignSelf: 'center',
|
|
195
|
-
} }, `right-arrow-${i}`),
|
|
196
|
-
jsxRuntime.jsx(iconsMaterial.ArrowDropDown, { sx: {
|
|
197
|
-
display: { xs: 'initial', lg: 'none' },
|
|
198
|
-
fontSize: 40,
|
|
199
|
-
color: 'primary.main',
|
|
200
|
-
alignSelf: 'center',
|
|
201
|
-
} }, `down-arrow-${i}`),
|
|
202
|
-
]
|
|
203
|
-
: []),
|
|
204
|
-
child,
|
|
205
|
-
], [])
|
|
206
|
-
: children }));
|
|
207
|
-
};
|
|
208
|
-
const HowToUse = ({ className, children, subtitle, headerContent, message, linkHref, linkContent, sx, ...props }) => {
|
|
209
|
-
return (jsxRuntime.jsx(HowToUseProvider, { subtitle,
|
|
210
|
-
headerContent,
|
|
211
|
-
message,
|
|
212
|
-
linkHref,
|
|
213
|
-
linkContent, children: jsxRuntime.jsx(material.Stack, { spacing: { xs: 5, lg: 6 }, className: classNames('nbb-how-to-use', className), sx: [
|
|
214
|
-
(theme) => ({
|
|
215
|
-
backgroundColor: theme.palette.background.default,
|
|
216
|
-
py: { xs: 5, lg: 10 },
|
|
217
|
-
px: { xs: 2, lg: 'unset' },
|
|
218
|
-
}),
|
|
219
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
220
|
-
], ...props, children: jsxRuntime.jsx(BlocksOverrideComponent, { defaultBlocks: defaultHowToUseBlocks, defaultBlockOrder: Object.keys(defaultHowToUseBlocks), blocksOverride: children, children: ({ blocks: { card, ...blocks }, blockOrder }) => (jsxRuntime.jsx(jsxRuntime.Fragment, { children: blockOrder
|
|
221
|
-
.filter((key) => key in blocks)
|
|
222
|
-
.map((key) => (jsxRuntime.jsx(react.Fragment, { children: blocks[key] }, String(key)))) })) }) }) }));
|
|
223
|
-
};
|
|
224
|
-
HowToUse.Header = Header;
|
|
225
|
-
HowToUse.CardList = CardList;
|
|
226
|
-
HowToUse.Card = Card;
|
|
227
|
-
HowToUse.Footer = Footer;
|
|
228
|
-
const defaultHowToUseBlocks = createDefaultBlocks({
|
|
229
|
-
header: HowToUse.Header,
|
|
230
|
-
cardList: HowToUse.CardList,
|
|
231
|
-
card: HowToUse.Card,
|
|
232
|
-
footer: HowToUse.Footer,
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
exports.HowToUse = HowToUse;
|
|
236
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/icons-material"),n=require("@mui/material"),t=require("react");const s=["subtitle","headerContent","message","linkHref","linkContent"],i=t.createContext(void 0),o=({children:r,...n})=>e.jsx(i.Provider,{value:n,children:r}),a=()=>{const e=t.useContext(i);if(!e)throw new Error("useHowToUseContext must be used within a HowToUseProvider");return e};function l({blocksOverride:e,defaultBlocks:r,defaultBlockOrder:n,children:t}){if(void 0===e)return t({blocks:r,blockOrder:n});if("function"==typeof e){const{blocks:s,blockOrder:i}=e({defaultBlocks:r,defaultBlockOrder:n});return t({blocks:s,blockOrder:i})}return e}function c(e,r){const n={...e};for(const e in r)Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=r[e]);return n}function d(...e){return e.flat().filter(Boolean).join(" ")}function x(e,...r){const n={...e};for(const e of r)delete n[e];return n}function h(e,...r){const n={};for(const t of r)t in e&&(n[t]=e[t]);return n}const g=({className:r,children:i,sx:a,...c})=>e.jsx(o,{...h(c,...s),children:e.jsx(n.Stack,{spacing:{xs:5,lg:6},className:d("nbb-how-to-use",r),sx:[e=>({backgroundColor:e.palette.background.default,py:{xs:5,lg:10},px:{xs:2,lg:"unset"}}),...Array.isArray(a)?a:[a]],...x(c,...s),children:e.jsx(l,{defaultBlocks:u,defaultBlockOrder:Object.keys(u),blocksOverride:i,children:({blocks:{card:r,...n},blockOrder:s})=>e.jsx(e.Fragment,{children:s.filter(e=>e in n).map(r=>e.jsx(t.Fragment,{children:n[r]},String(r)))})})})}),u=(f={header:g.Header=({className:r,children:t,sx:i,...o})=>{const l=a(),{subtitle:h,headerContent:g}=c(l,o);return e.jsxs(n.Stack,{spacing:{xs:.5,lg:1},className:d("nbb-how-to-use-header",r),sx:[{textAlign:"center"},...Array.isArray(i)?i:[i]],...x(o,...s),children:[e.jsx(n.Typography,{variant:"h4",sx:{color:"primary.main",fontWeight:"bold",lineHeight:1.5,fontSize:{xs:18,lg:24}},children:g||t}),e.jsx(n.Typography,{variant:"h1",component:"h1",sx:{fontSize:{xs:25,lg:45},fontWeight:600,lineHeight:1.5},children:h})]})},cardList:g.CardList=({children:t,className:s,sx:i,...o})=>e.jsx(n.Stack,{direction:{xs:"column",lg:"row"},spacing:0,className:d("nbb-how-to-use-card-list",s),sx:[{alignItems:{xs:"center",lg:"stretch"},justifyContent:"center"},...Array.isArray(i)?i:[i]],...o,children:t&&Array.isArray(t)?t.reduce((n,t,s)=>[...n,...s>0?[e.jsx(r.ArrowRight,{sx:{display:{xs:"none",lg:"initial"},fontSize:40,color:"primary.main",alignSelf:"center"}},`right-arrow-${s}`),e.jsx(r.ArrowDropDown,{sx:{display:{xs:"initial",lg:"none"},fontSize:40,color:"primary.main",alignSelf:"center"}},`down-arrow-${s}`)]:[],t],[]):t}),card:g.Card=({children:r,className:t,icon:i,headerContent:o,sx:a,...l})=>e.jsx(n.Card,{component:"article",elevation:0,className:d("nbb-how-to-use-card",t),sx:[{width:"100%",maxWidth:360},...Array.isArray(a)?a:[a]],...x(l,...s),children:e.jsxs(n.CardContent,{component:n.Stack,spacing:2,sx:{py:{xs:2,lg:3},px:2.5,alignItems:{xs:"flex-start",lg:"unset"}},children:[e.jsxs(n.Stack,{direction:{xs:"row",lg:"column"},spacing:{xs:2,lg:1},sx:{alignItems:"center",justifyContent:"center",py:.5},children:[i&&e.jsx(i,{sx:{color:"primary.main",fontSize:{xs:24,lg:40}}}),e.jsx(n.Typography,{variant:"h6",component:"h6",sx:{color:"#000",fontWeight:600,fontSize:{xs:16,lg:25},m:0,lineHeight:1.72},children:o})]}),e.jsx(n.Typography,{sx:{fontSize:16,textAlign:"left",lineHeight:1.72,fontWeight:300},children:r})]})}),footer:g.Footer=({children:r,className:t,sx:i,...o})=>{const l=a(),{message:h,linkHref:g,linkContent:u}=c(l,o);return e.jsxs(n.Stack,{spacing:1.5,className:d("nbb-how-to-use-footer",t),sx:[{alignItems:"center"},...Array.isArray(i)?i:[i]],...x(o,...s),children:[h&&e.jsx(n.Typography,{variant:"body2",sx:{color:"primary.main",fontWeight:600,lineHeight:1.72},children:h}),e.jsx(n.Button,{href:g,rel:"noreferrer noopener",variant:"contained",size:"large",sx:{width:360,maxWidth:"100%",fontSize:{lg:22},lineHeight:1.5,px:{lg:32}},children:u})]})}},Object.fromEntries(Object.entries(f).map(([e,r])=>[e,t.createElement(r,{key:e})])));var f;exports.HowToUse=g;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,234 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof global === 'undefined') {
|
|
4
|
-
var global = window;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
8
|
-
import { ArrowRight, ArrowDropDown } from '@mui/icons-material';
|
|
9
|
-
import { Stack, Typography, Card as Card$1, CardContent, Button } from '@mui/material';
|
|
10
|
-
import { createContext, useContext, createElement, Fragment as Fragment$1 } from 'react';
|
|
11
|
-
|
|
12
|
-
const HowToUseContext = createContext(undefined);
|
|
13
|
-
const HowToUseProvider = ({ children, ...value }) => {
|
|
14
|
-
return jsx(HowToUseContext.Provider, { value: value, children: children });
|
|
15
|
-
};
|
|
16
|
-
const useHowToUseContext = () => {
|
|
17
|
-
const context = useContext(HowToUseContext);
|
|
18
|
-
if (!context) {
|
|
19
|
-
throw new Error('useHowToUseContext must be used within a HowToUseProvider');
|
|
20
|
-
}
|
|
21
|
-
return context;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Creates a strongly typed `defaultBlocks` object, allowing for types to propagate into block override objects.
|
|
26
|
-
*
|
|
27
|
-
* @param components - A map of default block keys to component functions.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* const defaultBlocks = createDefaultBlocks({
|
|
31
|
-
* title: Title,
|
|
32
|
-
* description: Description,
|
|
33
|
-
* form: Form,
|
|
34
|
-
* });
|
|
35
|
-
*/
|
|
36
|
-
function createDefaultBlocks(components) {
|
|
37
|
-
return Object.fromEntries(Object.entries(components).map(([key, Component]) => [key, createElement(Component, { key })]));
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* A component for rendering {@link BlocksOverride|`BlocksOverride`} results.
|
|
41
|
-
* Exposes the evaluated `blocks` and `blockOrder` as arguments to the `children` function.
|
|
42
|
-
*
|
|
43
|
-
* @param props
|
|
44
|
-
* @param props.blocksOverride - The {@link BlocksOverride|`BlocksOverride`} (i.e. `children` of outer component).
|
|
45
|
-
* @param props.defaultBlocks - The default blocks of outer component.
|
|
46
|
-
* @param props.children - A function returning the JSX to render.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* <BlocksOverrideComponent
|
|
50
|
-
* defaultBlocks={defaultFormBlocks}
|
|
51
|
-
* blocksOverride={children}
|
|
52
|
-
* >
|
|
53
|
-
* {({ blocks, blockOrder }) =>
|
|
54
|
-
* blockOrder.map((key) => (
|
|
55
|
-
* <Fragment key={String(key)}>{blocks[key]}</Fragment>
|
|
56
|
-
* ))
|
|
57
|
-
* }
|
|
58
|
-
* </BlocksOverrideComponent>
|
|
59
|
-
*/
|
|
60
|
-
function BlocksOverrideComponent({ blocksOverride, defaultBlocks, defaultBlockOrder, children, }) {
|
|
61
|
-
if (blocksOverride === undefined) {
|
|
62
|
-
return children({
|
|
63
|
-
// TODO: Remove this assertion
|
|
64
|
-
blocks: defaultBlocks,
|
|
65
|
-
blockOrder: defaultBlockOrder,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
if (typeof blocksOverride === 'function') {
|
|
69
|
-
const { blocks, blockOrder } = blocksOverride({
|
|
70
|
-
defaultBlocks,
|
|
71
|
-
defaultBlockOrder,
|
|
72
|
-
});
|
|
73
|
-
return children({ blocks, blockOrder });
|
|
74
|
-
}
|
|
75
|
-
return blocksOverride;
|
|
76
|
-
}
|
|
77
|
-
function deepMerge(obj1, obj2) {
|
|
78
|
-
const result = { ...obj1 };
|
|
79
|
-
for (const key in obj2) {
|
|
80
|
-
if (obj2.hasOwnProperty(key)) {
|
|
81
|
-
const val1 = result[key];
|
|
82
|
-
const val2 = obj2[key];
|
|
83
|
-
if (Array.isArray(val1) || Array.isArray(val2)) {
|
|
84
|
-
// If either is an array, replace entirely with obj2's value
|
|
85
|
-
result[key] = val2;
|
|
86
|
-
}
|
|
87
|
-
else if (typeof val1 === 'object' && val1 !== null && typeof val2 === 'object' && val2 !== null) {
|
|
88
|
-
result[key] = deepMerge(val1, val2);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
result[key] = val2;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return result;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Utility function to join class names together, ignoring undefined or nil values.
|
|
99
|
-
* @param classes - The class names to join.
|
|
100
|
-
* @returns The joined class names.
|
|
101
|
-
*/
|
|
102
|
-
function classNames(...classes) {
|
|
103
|
-
return classes.flat().filter(Boolean).join(' ');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const Card = ({ children, className, icon: Icon, sx, ...props }) => {
|
|
107
|
-
const { headerContent } = deepMerge(useHowToUseContext(), props);
|
|
108
|
-
return (jsx(Card$1, { component: "article", elevation: 0, className: classNames('nbb-how-to-use-card', className), sx: [
|
|
109
|
-
{
|
|
110
|
-
width: '100%',
|
|
111
|
-
maxWidth: 360,
|
|
112
|
-
},
|
|
113
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
114
|
-
], ...props, children: jsxs(CardContent, { component: Stack, spacing: 2, sx: {
|
|
115
|
-
py: { xs: 2, lg: 3 },
|
|
116
|
-
px: 2.5,
|
|
117
|
-
alignItems: { xs: 'flex-start', lg: 'unset' },
|
|
118
|
-
}, children: [jsxs(Stack, { direction: { xs: 'row', lg: 'column' }, spacing: { xs: 2, lg: 1 }, sx: {
|
|
119
|
-
alignItems: 'center',
|
|
120
|
-
justifyContent: 'center',
|
|
121
|
-
py: 0.5,
|
|
122
|
-
}, children: [Icon && (jsx(Icon, { sx: {
|
|
123
|
-
color: 'primary.main',
|
|
124
|
-
fontSize: { xs: 24, lg: 40 },
|
|
125
|
-
} })), jsx(Typography, { variant: "h6", component: "h6", sx: {
|
|
126
|
-
color: '#000',
|
|
127
|
-
fontWeight: 600,
|
|
128
|
-
fontSize: { xs: 16, lg: 25 },
|
|
129
|
-
m: 0,
|
|
130
|
-
lineHeight: 1.72,
|
|
131
|
-
}, children: headerContent })] }), jsx(Typography, { sx: {
|
|
132
|
-
fontSize: 16,
|
|
133
|
-
textAlign: 'left',
|
|
134
|
-
lineHeight: 1.72,
|
|
135
|
-
fontWeight: 300,
|
|
136
|
-
}, children: children })] }) }));
|
|
137
|
-
};
|
|
138
|
-
const Header = ({ className, children, sx, ...props }) => {
|
|
139
|
-
const { subtitle } = deepMerge(useHowToUseContext(), props);
|
|
140
|
-
return (jsxs(Stack, { spacing: { xs: 0.5, lg: 1 }, className: classNames('nbb-how-to-use-header', className), sx: [
|
|
141
|
-
{
|
|
142
|
-
textAlign: 'center',
|
|
143
|
-
},
|
|
144
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
145
|
-
], ...props, children: [jsx(Typography, { variant: "h4", sx: {
|
|
146
|
-
color: 'primary.main',
|
|
147
|
-
fontWeight: 'bold',
|
|
148
|
-
lineHeight: 1.5,
|
|
149
|
-
fontSize: { xs: 18, lg: 24 },
|
|
150
|
-
}, children: children }), jsx(Typography, { variant: "h1", component: "h1", sx: {
|
|
151
|
-
fontSize: { xs: 25, lg: 45 },
|
|
152
|
-
fontWeight: 600,
|
|
153
|
-
lineHeight: 1.5,
|
|
154
|
-
}, children: subtitle })] }));
|
|
155
|
-
};
|
|
156
|
-
const Footer = ({ children, className, sx, ...props }) => {
|
|
157
|
-
const { message, linkHref, linkContent } = deepMerge(useHowToUseContext(), props);
|
|
158
|
-
return (jsxs(Stack, { spacing: 1.5, className: classNames('nbb-how-to-use-footer', className), sx: [
|
|
159
|
-
{
|
|
160
|
-
alignItems: 'center',
|
|
161
|
-
},
|
|
162
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
163
|
-
], ...props, children: [message && (jsx(Typography, { variant: "body2", sx: {
|
|
164
|
-
color: 'primary.main',
|
|
165
|
-
fontWeight: 600,
|
|
166
|
-
lineHeight: 1.72,
|
|
167
|
-
}, children: message })), jsx(Button, { href: linkHref, rel: "noreferrer noopener", variant: "contained", size: "medium", sx: {
|
|
168
|
-
width: 360,
|
|
169
|
-
maxWidth: '100%',
|
|
170
|
-
py: 1.5,
|
|
171
|
-
fontSize: { lg: 22 },
|
|
172
|
-
lineHeight: 1.5,
|
|
173
|
-
fontWeight: 600,
|
|
174
|
-
}, children: linkContent })] }));
|
|
175
|
-
};
|
|
176
|
-
const CardList = ({ children, className, sx, ...props }) => {
|
|
177
|
-
return (jsx(Stack, { direction: { xs: 'column', lg: 'row' }, spacing: 0, className: classNames('nbb-how-to-use-card-list', className), sx: [
|
|
178
|
-
{
|
|
179
|
-
alignItems: { xs: 'center', lg: 'stretch' },
|
|
180
|
-
justifyContent: 'center',
|
|
181
|
-
},
|
|
182
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
183
|
-
], ...props, children: children && Array.isArray(children)
|
|
184
|
-
? children.reduce((total, child, i) => [
|
|
185
|
-
...total,
|
|
186
|
-
...(i > 0
|
|
187
|
-
? [
|
|
188
|
-
jsx(ArrowRight, { sx: {
|
|
189
|
-
display: { xs: 'none', lg: 'initial' },
|
|
190
|
-
fontSize: 40,
|
|
191
|
-
color: 'primary.main',
|
|
192
|
-
alignSelf: 'center',
|
|
193
|
-
} }, `right-arrow-${i}`),
|
|
194
|
-
jsx(ArrowDropDown, { sx: {
|
|
195
|
-
display: { xs: 'initial', lg: 'none' },
|
|
196
|
-
fontSize: 40,
|
|
197
|
-
color: 'primary.main',
|
|
198
|
-
alignSelf: 'center',
|
|
199
|
-
} }, `down-arrow-${i}`),
|
|
200
|
-
]
|
|
201
|
-
: []),
|
|
202
|
-
child,
|
|
203
|
-
], [])
|
|
204
|
-
: children }));
|
|
205
|
-
};
|
|
206
|
-
const HowToUse = ({ className, children, subtitle, headerContent, message, linkHref, linkContent, sx, ...props }) => {
|
|
207
|
-
return (jsx(HowToUseProvider, { subtitle,
|
|
208
|
-
headerContent,
|
|
209
|
-
message,
|
|
210
|
-
linkHref,
|
|
211
|
-
linkContent, children: jsx(Stack, { spacing: { xs: 5, lg: 6 }, className: classNames('nbb-how-to-use', className), sx: [
|
|
212
|
-
(theme) => ({
|
|
213
|
-
backgroundColor: theme.palette.background.default,
|
|
214
|
-
py: { xs: 5, lg: 10 },
|
|
215
|
-
px: { xs: 2, lg: 'unset' },
|
|
216
|
-
}),
|
|
217
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
218
|
-
], ...props, children: jsx(BlocksOverrideComponent, { defaultBlocks: defaultHowToUseBlocks, defaultBlockOrder: Object.keys(defaultHowToUseBlocks), blocksOverride: children, children: ({ blocks: { card, ...blocks }, blockOrder }) => (jsx(Fragment, { children: blockOrder
|
|
219
|
-
.filter((key) => key in blocks)
|
|
220
|
-
.map((key) => (jsx(Fragment$1, { children: blocks[key] }, String(key)))) })) }) }) }));
|
|
221
|
-
};
|
|
222
|
-
HowToUse.Header = Header;
|
|
223
|
-
HowToUse.CardList = CardList;
|
|
224
|
-
HowToUse.Card = Card;
|
|
225
|
-
HowToUse.Footer = Footer;
|
|
226
|
-
const defaultHowToUseBlocks = createDefaultBlocks({
|
|
227
|
-
header: HowToUse.Header,
|
|
228
|
-
cardList: HowToUse.CardList,
|
|
229
|
-
card: HowToUse.Card,
|
|
230
|
-
footer: HowToUse.Footer,
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
export { HowToUse };
|
|
234
|
-
//# sourceMappingURL=index.esm.js.map
|
|
1
|
+
import{jsx as e,Fragment as r,jsxs as n}from"react/jsx-runtime";import{ArrowRight as t,ArrowDropDown as i}from"@mui/icons-material";import{Stack as o,Typography as l,Card as s,CardContent as a,Button as c}from"@mui/material";import{createContext as d,useContext as h,createElement as f,Fragment as m}from"react";const g=["subtitle","headerContent","message","linkHref","linkContent"],x=d(void 0),u=({children:r,...n})=>e(x.Provider,{value:n,children:r}),p=()=>{const e=h(x);if(!e)throw new Error("useHowToUseContext must be used within a HowToUseProvider");return e};function b({blocksOverride:e,defaultBlocks:r,defaultBlockOrder:n,children:t}){if(void 0===e)return t({blocks:r,blockOrder:n});if("function"==typeof e){const{blocks:i,blockOrder:o}=e({defaultBlocks:r,defaultBlockOrder:n});return t({blocks:i,blockOrder:o})}return e}function y(e,r){const n={...e};for(const e in r)Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=r[e]);return n}function k(...e){return e.flat().filter(Boolean).join(" ")}function w(e,...r){const n={...e};for(const e of r)delete n[e];return n}function v(e,...r){const n={};for(const t of r)t in e&&(n[t]=e[t]);return n}const A=({className:n,children:t,sx:i,...l})=>e(u,{...v(l,...g),children:e(o,{spacing:{xs:5,lg:6},className:k("nbb-how-to-use",n),sx:[e=>({backgroundColor:e.palette.background.default,py:{xs:5,lg:10},px:{xs:2,lg:"unset"}}),...Array.isArray(i)?i:[i]],...w(l,...g),children:e(b,{defaultBlocks:O,defaultBlockOrder:Object.keys(O),blocksOverride:t,children:({blocks:{card:n,...t},blockOrder:i})=>e(r,{children:i.filter(e=>e in t).map(r=>e(m,{children:t[r]},String(r)))})})})}),O=(C={header:A.Header=({className:r,children:t,sx:i,...s})=>{const a=p(),{subtitle:c,headerContent:d}=y(a,s);return n(o,{spacing:{xs:.5,lg:1},className:k("nbb-how-to-use-header",r),sx:[{textAlign:"center"},...Array.isArray(i)?i:[i]],...w(s,...g),children:[e(l,{variant:"h4",sx:{color:"primary.main",fontWeight:"bold",lineHeight:1.5,fontSize:{xs:18,lg:24}},children:d||t}),e(l,{variant:"h1",component:"h1",sx:{fontSize:{xs:25,lg:45},fontWeight:600,lineHeight:1.5},children:c})]})},cardList:A.CardList=({children:r,className:n,sx:l,...s})=>e(o,{direction:{xs:"column",lg:"row"},spacing:0,className:k("nbb-how-to-use-card-list",n),sx:[{alignItems:{xs:"center",lg:"stretch"},justifyContent:"center"},...Array.isArray(l)?l:[l]],...s,children:r&&Array.isArray(r)?r.reduce((r,n,o)=>[...r,...o>0?[e(t,{sx:{display:{xs:"none",lg:"initial"},fontSize:40,color:"primary.main",alignSelf:"center"}},`right-arrow-${o}`),e(i,{sx:{display:{xs:"initial",lg:"none"},fontSize:40,color:"primary.main",alignSelf:"center"}},`down-arrow-${o}`)]:[],n],[]):r}),card:A.Card=({children:r,className:t,icon:i,headerContent:c,sx:d,...h})=>e(s,{component:"article",elevation:0,className:k("nbb-how-to-use-card",t),sx:[{width:"100%",maxWidth:360},...Array.isArray(d)?d:[d]],...w(h,...g),children:n(a,{component:o,spacing:2,sx:{py:{xs:2,lg:3},px:2.5,alignItems:{xs:"flex-start",lg:"unset"}},children:[n(o,{direction:{xs:"row",lg:"column"},spacing:{xs:2,lg:1},sx:{alignItems:"center",justifyContent:"center",py:.5},children:[i&&e(i,{sx:{color:"primary.main",fontSize:{xs:24,lg:40}}}),e(l,{variant:"h6",component:"h6",sx:{color:"#000",fontWeight:600,fontSize:{xs:16,lg:25},m:0,lineHeight:1.72},children:c})]}),e(l,{sx:{fontSize:16,textAlign:"left",lineHeight:1.72,fontWeight:300},children:r})]})}),footer:A.Footer=({children:r,className:t,sx:i,...s})=>{const a=p(),{message:d,linkHref:h,linkContent:f}=y(a,s);return n(o,{spacing:1.5,className:k("nbb-how-to-use-footer",t),sx:[{alignItems:"center"},...Array.isArray(i)?i:[i]],...w(s,...g),children:[d&&e(l,{variant:"body2",sx:{color:"primary.main",fontWeight:600,lineHeight:1.72},children:d}),e(c,{href:h,rel:"noreferrer noopener",variant:"contained",size:"large",sx:{width:360,maxWidth:"100%",fontSize:{lg:22},lineHeight:1.5,px:{lg:32}},children:f})]})}},Object.fromEntries(Object.entries(C).map(([e,r])=>[e,f(r,{key:e})])));var C;export{A as HowToUse};
|
package/dist/lib.d.ts
CHANGED
|
@@ -72,10 +72,12 @@ export declare function BlocksOverrideComponent<DefaultBlocks extends Record<str
|
|
|
72
72
|
blockOrder: readonly (keyof DefaultBlocks | keyof CustomBlocks)[];
|
|
73
73
|
}) => ReactNode;
|
|
74
74
|
}): ReactNode;
|
|
75
|
-
type
|
|
76
|
-
[K in keyof
|
|
75
|
+
type MergeKeepingRequired<A, B> = Omit<A, keyof B> & {
|
|
76
|
+
[K in keyof A & keyof B]-?: undefined extends B[K] ? A[K] : B[K];
|
|
77
|
+
} & {
|
|
78
|
+
[K in Exclude<keyof B, keyof A>]: B[K];
|
|
77
79
|
};
|
|
78
|
-
export declare function
|
|
80
|
+
export declare function merge<A extends Record<PropertyKey, any>, B extends Record<PropertyKey, any>>(a: A, b: B): MergeKeepingRequired<A, B>;
|
|
79
81
|
type ClassName = string | ClassName[] | undefined | null;
|
|
80
82
|
/**
|
|
81
83
|
* Utility function to join class names together, ignoring undefined or nil values.
|
|
@@ -83,5 +85,19 @@ type ClassName = string | ClassName[] | undefined | null;
|
|
|
83
85
|
* @returns The joined class names.
|
|
84
86
|
*/
|
|
85
87
|
export declare function classNames(...classes: ClassName[]): string;
|
|
88
|
+
/**
|
|
89
|
+
* Omits the given string keys from `source`.
|
|
90
|
+
*
|
|
91
|
+
* Usage:
|
|
92
|
+
* omit(obj, "a", "b")
|
|
93
|
+
*/
|
|
94
|
+
export declare function omit<T extends object, const Keys extends readonly string[]>(source: T, ...keys: Keys): Omit<T, Extract<Keys[number], keyof T>>;
|
|
95
|
+
/**
|
|
96
|
+
* Picks the given keys out of `source` into a new object.
|
|
97
|
+
*
|
|
98
|
+
* Usage:
|
|
99
|
+
* pick(obj, "a", "b")
|
|
100
|
+
*/
|
|
101
|
+
export declare function pick<T extends object, K extends PropertyKey>(source: T, ...keys: K[]): Pick<T, Extract<K, keyof T>>;
|
|
86
102
|
export {};
|
|
87
103
|
//# sourceMappingURL=lib.d.ts.map
|
package/dist/lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,iBAAiB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElG;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,cAAc,CAAC,aAAa,EAAE,YAAY,IAClD,CAAC,CAAC,EACA,aAAa,EACb,iBAAiB,GAClB,EAAE;IACD,aAAa,EAAE,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,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAQzC;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,WAAW,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAWnH"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodeblocks/frontend-how-to-use-block",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"main": "dist/index.cjs.js",
|
|
5
|
-
"module": "dist/index.esm.js",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
3
|
+
"version": "0.3.2",
|
|
4
|
+
"main": "./dist/index.cjs.js",
|
|
5
|
+
"module": "./dist/index.esm.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.esm.js",
|
|
11
|
+
"require": "./dist/index.cjs.js",
|
|
12
|
+
"default": "./dist/index.esm.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
8
15
|
"files": [
|
|
9
|
-
"dist/"
|
|
10
|
-
"dist/index.css"
|
|
16
|
+
"dist/"
|
|
11
17
|
],
|
|
12
18
|
"scripts": {
|
|
13
|
-
"build": "rollup -c",
|
|
14
|
-
"watch": "rm -rf dist && cross-env NODE_ENV=development rollup -c --watch"
|
|
19
|
+
"build": "npm run typecheck && rollup -c",
|
|
20
|
+
"watch": "rm -rf dist && cross-env NODE_ENV=development rollup -c --watch",
|
|
21
|
+
"typecheck": "tsc --noEmit"
|
|
15
22
|
},
|
|
16
23
|
"peerDependencies": {
|
|
17
24
|
"@emotion/react": "^11.14.0",
|
|
@@ -25,12 +32,12 @@
|
|
|
25
32
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
26
33
|
"@rollup/plugin-json": "^6.1.0",
|
|
27
34
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
35
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
28
36
|
"@rollup/plugin-typescript": "^12.1.1",
|
|
29
37
|
"@types/react": "19.2.7",
|
|
30
38
|
"@types/react-dom": "19.2.3",
|
|
31
|
-
"rollup": "^4.
|
|
39
|
+
"rollup": "^4.55.1",
|
|
32
40
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
33
|
-
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
34
41
|
"rollup-plugin-postcss": "^4.0.2",
|
|
35
42
|
"rollup-plugin-serve": "^1.1.1",
|
|
36
43
|
"tslib": "^2.8.1",
|
package/dist/index.cjs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/context.tsx","../src/lib.ts","../src/HowToUse.tsx"],"sourcesContent":["import { createContext, ReactNode, useContext } from 'react';\n\nexport type HowToUseContextValue = {\n subtitle: ReactNode;\n headerContent: ReactNode;\n message: ReactNode;\n linkHref: string;\n linkContent: ReactNode;\n};\n\nconst HowToUseContext = createContext<HowToUseContextValue | undefined>(undefined);\n\nexport const HowToUseProvider = ({\n children,\n ...value\n}: HowToUseContextValue & {\n children: ReactNode;\n}) => {\n return <HowToUseContext.Provider value={value}>{children}</HowToUseContext.Provider>;\n};\n\nexport const useHowToUseContext = () => {\n const context = useContext(HowToUseContext);\n\n if (!context) {\n throw new Error('useHowToUseContext must be used within a HowToUseProvider');\n }\n return context;\n};\n","import { ComponentProps, createElement, FunctionComponent, ReactElement, ReactNode } from 'react';\n\n/**\n * The function to be passed into a block component as `children` to selectively override default blocks, or just a `ReactNode`.\n *\n * @example\n * <Block>\n * {({ defaultBlocks: { header, ...defaultBlocks }, defaultBlockOrder }) => ({\n * blocks: {\n * ...defaultBlocks,\n * header: {\n * ...header,\n * props: {\n * ...header.props,\n * label: \"Custom Label\"\n * }\n * },\n * subheader: <CustomComponent />\n * },\n * blockOrder: [\"header\", \"subheader\", \"body\", \"footer\"]\n * })}\n * </Block>\n */\nexport type BlocksOverride<DefaultBlocks, CustomBlocks> =\n | (({\n defaultBlocks,\n defaultBlockOrder,\n }: {\n defaultBlocks: DefaultBlocks;\n defaultBlockOrder: readonly (keyof DefaultBlocks)[];\n }) => {\n blocks: Partial<DefaultBlocks> & CustomBlocks;\n // NOTE: This specific combination allows proper autocomplete.\n blockOrder: readonly (keyof DefaultBlocks)[] | readonly (keyof CustomBlocks)[];\n })\n | ReactNode;\n\n/**\n * Creates a strongly typed `defaultBlocks` object, allowing for types to propagate into block override objects.\n *\n * @param components - A map of default block keys to component functions.\n *\n * @example\n * const defaultBlocks = createDefaultBlocks({\n * title: Title,\n * description: Description,\n * form: Form,\n * });\n */\nexport function createDefaultBlocks<T extends Record<string, FunctionComponent<any>>>(\n components: T\n): {\n [K in keyof T]: ReactElement<ComponentProps<T[K]>, T[K]>;\n} {\n return Object.fromEntries(\n Object.entries(components).map(([key, Component]) => [key, createElement(Component, { key })])\n ) as {\n [K in keyof T]: ReactElement<ComponentProps<T[K]>, T[K]>;\n };\n}\n\n/**\n * A component for rendering {@link BlocksOverride|`BlocksOverride`} results.\n * Exposes the evaluated `blocks` and `blockOrder` as arguments to the `children` function.\n *\n * @param props\n * @param props.blocksOverride - The {@link BlocksOverride|`BlocksOverride`} (i.e. `children` of outer component).\n * @param props.defaultBlocks - The default blocks of outer component.\n * @param props.children - A function returning the JSX to render.\n *\n * @example\n * <BlocksOverrideComponent\n * defaultBlocks={defaultFormBlocks}\n * blocksOverride={children}\n * >\n * {({ blocks, blockOrder }) =>\n * blockOrder.map((key) => (\n * <Fragment key={String(key)}>{blocks[key]}</Fragment>\n * ))\n * }\n * </BlocksOverrideComponent>\n */\nexport function BlocksOverrideComponent<\n DefaultBlocks extends Record<string, ReactNode>,\n CustomBlocks extends Record<string, ReactNode>,\n>({\n blocksOverride,\n defaultBlocks,\n defaultBlockOrder,\n children,\n}: {\n blocksOverride: BlocksOverride<DefaultBlocks, CustomBlocks>;\n defaultBlocks: DefaultBlocks;\n defaultBlockOrder: (keyof DefaultBlocks)[];\n children: ({\n blocks,\n blockOrder,\n }: {\n // TODO: Possibly find an alternative to Partial<CustomBlocks>\n blocks: Partial<DefaultBlocks> & Partial<CustomBlocks>;\n blockOrder: readonly (keyof DefaultBlocks | keyof CustomBlocks)[];\n }) => ReactNode;\n}) {\n if (blocksOverride === undefined) {\n return children({\n // TODO: Remove this assertion\n blocks: defaultBlocks as DefaultBlocks & Partial<CustomBlocks>,\n blockOrder: defaultBlockOrder,\n });\n }\n\n if (typeof blocksOverride === 'function') {\n const { blocks, blockOrder } = blocksOverride({\n defaultBlocks,\n defaultBlockOrder,\n });\n\n return children({ blocks, blockOrder });\n }\n\n return blocksOverride;\n}\n\ntype MergeTypes<Object1, Object2> = {\n [K in keyof Object1 | keyof Object2]: K extends keyof Object1\n ? Object1[K]\n : K extends keyof Object2\n ? Object2[K]\n : never;\n};\n\nexport function deepMerge<A extends Record<string, any>, B extends Record<string, any>>(obj1: A, obj2: B) {\n const result: Record<string, any> = { ...obj1 };\n\n for (const key in obj2) {\n if (obj2.hasOwnProperty(key)) {\n const val1 = result[key];\n const val2 = obj2[key];\n\n if (Array.isArray(val1) || Array.isArray(val2)) {\n // If either is an array, replace entirely with obj2's value\n result[key] = val2;\n } else if (typeof val1 === 'object' && val1 !== null && typeof val2 === 'object' && val2 !== null) {\n result[key] = deepMerge(val1, val2);\n } else {\n result[key] = val2;\n }\n }\n }\n\n return result as MergeTypes<B, A>;\n}\n\ntype ClassName = string | ClassName[] | undefined | null;\n\n/**\n * Utility function to join class names together, ignoring undefined or nil values.\n * @param classes - The class names to join.\n * @returns The joined class names.\n */\nexport function classNames(...classes: ClassName[]): string {\n return classes.flat().filter(Boolean).join(' ');\n}\n","import { ArrowDropDown, ArrowRight, SvgIconComponent } from '@mui/icons-material';\nimport { Button, CardContent, CardProps, Card as MuiCard, Stack, StackProps, Typography } from '@mui/material';\nimport { Fragment, ReactNode } from 'react';\nimport { HowToUseContextValue, HowToUseProvider, useHowToUseContext } from './context';\nimport { BlocksOverride, BlocksOverrideComponent, classNames, createDefaultBlocks, deepMerge } from './lib';\n\nconst Card = ({\n children,\n className,\n icon: Icon,\n sx,\n ...props\n}: CardProps & { icon: SvgIconComponent } & Required<Pick<HowToUseContextValue, 'headerContent'>>) => {\n const { headerContent } = deepMerge(useHowToUseContext(), props);\n\n return (\n <MuiCard\n component=\"article\"\n elevation={0}\n className={classNames('nbb-how-to-use-card', className)}\n sx={[\n {\n width: '100%',\n maxWidth: 360,\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n <CardContent\n component={Stack}\n spacing={2}\n sx={{\n py: { xs: 2, lg: 3 },\n px: 2.5,\n alignItems: { xs: 'flex-start', lg: 'unset' },\n }}\n >\n <Stack\n direction={{ xs: 'row', lg: 'column' }}\n spacing={{ xs: 2, lg: 1 }}\n sx={{\n alignItems: 'center',\n justifyContent: 'center',\n py: 0.5,\n }}\n >\n {Icon && (\n <Icon\n sx={{\n color: 'primary.main',\n fontSize: { xs: 24, lg: 40 },\n }}\n />\n )}\n <Typography\n variant=\"h6\"\n component=\"h6\"\n sx={{\n color: '#000',\n fontWeight: 600,\n fontSize: { xs: 16, lg: 25 },\n m: 0,\n lineHeight: 1.72,\n }}\n >\n {headerContent}\n </Typography>\n </Stack>\n <Typography\n sx={{\n fontSize: 16,\n textAlign: 'left',\n lineHeight: 1.72,\n fontWeight: 300,\n }}\n >\n {children}\n </Typography>\n </CardContent>\n </MuiCard>\n );\n};\n\nconst Header = ({\n className,\n children,\n sx,\n ...props\n}: StackProps & Required<Pick<HowToUseContextValue, 'subtitle'>> & { children: ReactNode }) => {\n const { subtitle } = deepMerge(useHowToUseContext(), props);\n\n return (\n <Stack\n spacing={{ xs: 0.5, lg: 1 }}\n className={classNames('nbb-how-to-use-header', className)}\n sx={[\n {\n textAlign: 'center',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n <Typography\n variant=\"h4\"\n sx={{\n color: 'primary.main',\n fontWeight: 'bold',\n lineHeight: 1.5,\n fontSize: { xs: 18, lg: 24 },\n }}\n >\n {children}\n </Typography>\n <Typography\n variant=\"h1\"\n component=\"h1\"\n sx={{\n fontSize: { xs: 25, lg: 45 },\n fontWeight: 600,\n lineHeight: 1.5,\n }}\n >\n {subtitle}\n </Typography>\n </Stack>\n );\n};\n\nconst Footer = ({\n children,\n className,\n sx,\n ...props\n}: StackProps & Required<Pick<HowToUseContextValue, 'message' | 'linkHref' | 'linkContent'>>) => {\n const { message, linkHref, linkContent } = deepMerge(useHowToUseContext(), props);\n\n return (\n <Stack\n spacing={1.5}\n className={classNames('nbb-how-to-use-footer', className)}\n sx={[\n {\n alignItems: 'center',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n {message && (\n <Typography\n variant=\"body2\"\n sx={{\n color: 'primary.main',\n fontWeight: 600,\n lineHeight: 1.72,\n }}\n >\n {message}\n </Typography>\n )}\n <Button\n href={linkHref}\n rel=\"noreferrer noopener\"\n variant=\"contained\"\n size=\"medium\"\n sx={{\n width: 360,\n maxWidth: '100%',\n py: 1.5,\n fontSize: { lg: 22 },\n lineHeight: 1.5,\n fontWeight: 600,\n }}\n >\n {linkContent}\n </Button>\n </Stack>\n );\n};\n\nconst CardList = ({ children, className, sx, ...props }: StackProps & { children: ReactNode }) => {\n return (\n <Stack\n direction={{ xs: 'column', lg: 'row' }}\n spacing={0}\n className={classNames('nbb-how-to-use-card-list', className)}\n sx={[\n {\n alignItems: { xs: 'center', lg: 'stretch' },\n justifyContent: 'center',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n {children && Array.isArray(children)\n ? children.reduce(\n (total, child, i) => [\n ...total,\n ...(i > 0\n ? [\n <ArrowRight\n key={`right-arrow-${i}`}\n sx={{\n display: { xs: 'none', lg: 'initial' },\n fontSize: 40,\n color: 'primary.main',\n alignSelf: 'center',\n }}\n />,\n <ArrowDropDown\n key={`down-arrow-${i}`}\n sx={{\n display: { xs: 'initial', lg: 'none' },\n fontSize: 40,\n color: 'primary.main',\n alignSelf: 'center',\n }}\n />,\n ]\n : []),\n child,\n ],\n []\n )\n : children}\n </Stack>\n );\n};\n\nconst HowToUse = <CustomBlocks extends Record<string, ReactNode> = {}>({\n className,\n children,\n subtitle,\n headerContent,\n message,\n linkHref,\n linkContent,\n sx,\n ...props\n}: Omit<StackProps, 'children'> & {\n children?: BlocksOverride<typeof defaultHowToUseBlocks, CustomBlocks>;\n} & Required<Pick<HowToUseContextValue, 'subtitle' | 'headerContent' | 'message' | 'linkHref' | 'linkContent'>>) => {\n return (\n <HowToUseProvider\n {...{\n subtitle,\n headerContent,\n message,\n linkHref,\n linkContent,\n }}\n >\n <Stack\n spacing={{ xs: 5, lg: 6 }}\n className={classNames('nbb-how-to-use', className)}\n sx={[\n (theme) => ({\n backgroundColor: theme.palette.background.default,\n py: { xs: 5, lg: 10 },\n px: { xs: 2, lg: 'unset' },\n }),\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n <BlocksOverrideComponent\n defaultBlocks={defaultHowToUseBlocks}\n defaultBlockOrder={Object.keys(defaultHowToUseBlocks) as (keyof typeof defaultHowToUseBlocks)[]}\n blocksOverride={children}\n >\n {/* NOTE: Must remove the some components so they aren't included in the rendering below */}\n {({ blocks: { card, ...blocks }, blockOrder }) => (\n <>\n {blockOrder\n .filter((key) => key in blocks)\n .map<ReactNode>((key) => (\n <Fragment key={String(key)}>{blocks[key]}</Fragment>\n ))}\n </>\n )}\n </BlocksOverrideComponent>\n </Stack>\n </HowToUseProvider>\n );\n};\n\nHowToUse.Header = Header;\nHowToUse.CardList = CardList;\nHowToUse.Card = Card;\nHowToUse.Footer = Footer;\n\nconst defaultHowToUseBlocks = createDefaultBlocks({\n header: HowToUse.Header,\n cardList: HowToUse.CardList,\n card: HowToUse.Card,\n footer: HowToUse.Footer,\n});\n\nexport default HowToUse;\n"],"names":["createContext","_jsx","useContext","createElement","MuiCard","_jsxs","CardContent","Stack","Typography","Button","ArrowRight","ArrowDropDown","Fragment"],"mappings":";;;;;;;;;;;;;AAUA,MAAM,eAAe,GAAGA,mBAAa,CAAmC,SAAS,CAAC;AAE3E,MAAM,gBAAgB,GAAG,CAAC,EAC/B,QAAQ,EACR,GAAG,KAAK,EAGT,KAAI;IACH,OAAOC,cAAA,CAAC,eAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,QAAA,EAAG,QAAQ,EAAA,CAA4B;AACtF,CAAC;AAEM,MAAM,kBAAkB,GAAG,MAAK;AACrC,IAAA,MAAM,OAAO,GAAGC,gBAAU,CAAC,eAAe,CAAC;IAE3C,IAAI,CAAC,OAAO,EAAE;AACZ,QAAA,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC;IAC9E;AACA,IAAA,OAAO,OAAO;AAChB,CAAC;;ACSD;;;;;;;;;;;AAWG;AACG,SAAU,mBAAmB,CACjC,UAAa,EAAA;AAIb,IAAA,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,EAAEC,mBAAa,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAG/F;AACH;AAEA;;;;;;;;;;;;;;;;;;;;AAoBG;AACG,SAAU,uBAAuB,CAGrC,EACA,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,QAAQ,GAaT,EAAA;AACC,IAAA,IAAI,cAAc,KAAK,SAAS,EAAE;AAChC,QAAA,OAAO,QAAQ,CAAC;;AAEd,YAAA,MAAM,EAAE,aAAsD;AAC9D,YAAA,UAAU,E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QAAQ;IAC3B,IAAI,EAAE,QAAQ,CAAC,IAAI;IACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;AACxB,CAAA,CAAC;;;;"}
|
package/dist/index.esm.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/context.tsx","../src/lib.ts","../src/HowToUse.tsx"],"sourcesContent":["import { createContext, ReactNode, useContext } from 'react';\n\nexport type HowToUseContextValue = {\n subtitle: ReactNode;\n headerContent: ReactNode;\n message: ReactNode;\n linkHref: string;\n linkContent: ReactNode;\n};\n\nconst HowToUseContext = createContext<HowToUseContextValue | undefined>(undefined);\n\nexport const HowToUseProvider = ({\n children,\n ...value\n}: HowToUseContextValue & {\n children: ReactNode;\n}) => {\n return <HowToUseContext.Provider value={value}>{children}</HowToUseContext.Provider>;\n};\n\nexport const useHowToUseContext = () => {\n const context = useContext(HowToUseContext);\n\n if (!context) {\n throw new Error('useHowToUseContext must be used within a HowToUseProvider');\n }\n return context;\n};\n","import { ComponentProps, createElement, FunctionComponent, ReactElement, ReactNode } from 'react';\n\n/**\n * The function to be passed into a block component as `children` to selectively override default blocks, or just a `ReactNode`.\n *\n * @example\n * <Block>\n * {({ defaultBlocks: { header, ...defaultBlocks }, defaultBlockOrder }) => ({\n * blocks: {\n * ...defaultBlocks,\n * header: {\n * ...header,\n * props: {\n * ...header.props,\n * label: \"Custom Label\"\n * }\n * },\n * subheader: <CustomComponent />\n * },\n * blockOrder: [\"header\", \"subheader\", \"body\", \"footer\"]\n * })}\n * </Block>\n */\nexport type BlocksOverride<DefaultBlocks, CustomBlocks> =\n | (({\n defaultBlocks,\n defaultBlockOrder,\n }: {\n defaultBlocks: DefaultBlocks;\n defaultBlockOrder: readonly (keyof DefaultBlocks)[];\n }) => {\n blocks: Partial<DefaultBlocks> & CustomBlocks;\n // NOTE: This specific combination allows proper autocomplete.\n blockOrder: readonly (keyof DefaultBlocks)[] | readonly (keyof CustomBlocks)[];\n })\n | ReactNode;\n\n/**\n * Creates a strongly typed `defaultBlocks` object, allowing for types to propagate into block override objects.\n *\n * @param components - A map of default block keys to component functions.\n *\n * @example\n * const defaultBlocks = createDefaultBlocks({\n * title: Title,\n * description: Description,\n * form: Form,\n * });\n */\nexport function createDefaultBlocks<T extends Record<string, FunctionComponent<any>>>(\n components: T\n): {\n [K in keyof T]: ReactElement<ComponentProps<T[K]>, T[K]>;\n} {\n return Object.fromEntries(\n Object.entries(components).map(([key, Component]) => [key, createElement(Component, { key })])\n ) as {\n [K in keyof T]: ReactElement<ComponentProps<T[K]>, T[K]>;\n };\n}\n\n/**\n * A component for rendering {@link BlocksOverride|`BlocksOverride`} results.\n * Exposes the evaluated `blocks` and `blockOrder` as arguments to the `children` function.\n *\n * @param props\n * @param props.blocksOverride - The {@link BlocksOverride|`BlocksOverride`} (i.e. `children` of outer component).\n * @param props.defaultBlocks - The default blocks of outer component.\n * @param props.children - A function returning the JSX to render.\n *\n * @example\n * <BlocksOverrideComponent\n * defaultBlocks={defaultFormBlocks}\n * blocksOverride={children}\n * >\n * {({ blocks, blockOrder }) =>\n * blockOrder.map((key) => (\n * <Fragment key={String(key)}>{blocks[key]}</Fragment>\n * ))\n * }\n * </BlocksOverrideComponent>\n */\nexport function BlocksOverrideComponent<\n DefaultBlocks extends Record<string, ReactNode>,\n CustomBlocks extends Record<string, ReactNode>,\n>({\n blocksOverride,\n defaultBlocks,\n defaultBlockOrder,\n children,\n}: {\n blocksOverride: BlocksOverride<DefaultBlocks, CustomBlocks>;\n defaultBlocks: DefaultBlocks;\n defaultBlockOrder: (keyof DefaultBlocks)[];\n children: ({\n blocks,\n blockOrder,\n }: {\n // TODO: Possibly find an alternative to Partial<CustomBlocks>\n blocks: Partial<DefaultBlocks> & Partial<CustomBlocks>;\n blockOrder: readonly (keyof DefaultBlocks | keyof CustomBlocks)[];\n }) => ReactNode;\n}) {\n if (blocksOverride === undefined) {\n return children({\n // TODO: Remove this assertion\n blocks: defaultBlocks as DefaultBlocks & Partial<CustomBlocks>,\n blockOrder: defaultBlockOrder,\n });\n }\n\n if (typeof blocksOverride === 'function') {\n const { blocks, blockOrder } = blocksOverride({\n defaultBlocks,\n defaultBlockOrder,\n });\n\n return children({ blocks, blockOrder });\n }\n\n return blocksOverride;\n}\n\ntype MergeTypes<Object1, Object2> = {\n [K in keyof Object1 | keyof Object2]: K extends keyof Object1\n ? Object1[K]\n : K extends keyof Object2\n ? Object2[K]\n : never;\n};\n\nexport function deepMerge<A extends Record<string, any>, B extends Record<string, any>>(obj1: A, obj2: B) {\n const result: Record<string, any> = { ...obj1 };\n\n for (const key in obj2) {\n if (obj2.hasOwnProperty(key)) {\n const val1 = result[key];\n const val2 = obj2[key];\n\n if (Array.isArray(val1) || Array.isArray(val2)) {\n // If either is an array, replace entirely with obj2's value\n result[key] = val2;\n } else if (typeof val1 === 'object' && val1 !== null && typeof val2 === 'object' && val2 !== null) {\n result[key] = deepMerge(val1, val2);\n } else {\n result[key] = val2;\n }\n }\n }\n\n return result as MergeTypes<B, A>;\n}\n\ntype ClassName = string | ClassName[] | undefined | null;\n\n/**\n * Utility function to join class names together, ignoring undefined or nil values.\n * @param classes - The class names to join.\n * @returns The joined class names.\n */\nexport function classNames(...classes: ClassName[]): string {\n return classes.flat().filter(Boolean).join(' ');\n}\n","import { ArrowDropDown, ArrowRight, SvgIconComponent } from '@mui/icons-material';\nimport { Button, CardContent, CardProps, Card as MuiCard, Stack, StackProps, Typography } from '@mui/material';\nimport { Fragment, ReactNode } from 'react';\nimport { HowToUseContextValue, HowToUseProvider, useHowToUseContext } from './context';\nimport { BlocksOverride, BlocksOverrideComponent, classNames, createDefaultBlocks, deepMerge } from './lib';\n\nconst Card = ({\n children,\n className,\n icon: Icon,\n sx,\n ...props\n}: CardProps & { icon: SvgIconComponent } & Required<Pick<HowToUseContextValue, 'headerContent'>>) => {\n const { headerContent } = deepMerge(useHowToUseContext(), props);\n\n return (\n <MuiCard\n component=\"article\"\n elevation={0}\n className={classNames('nbb-how-to-use-card', className)}\n sx={[\n {\n width: '100%',\n maxWidth: 360,\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n <CardContent\n component={Stack}\n spacing={2}\n sx={{\n py: { xs: 2, lg: 3 },\n px: 2.5,\n alignItems: { xs: 'flex-start', lg: 'unset' },\n }}\n >\n <Stack\n direction={{ xs: 'row', lg: 'column' }}\n spacing={{ xs: 2, lg: 1 }}\n sx={{\n alignItems: 'center',\n justifyContent: 'center',\n py: 0.5,\n }}\n >\n {Icon && (\n <Icon\n sx={{\n color: 'primary.main',\n fontSize: { xs: 24, lg: 40 },\n }}\n />\n )}\n <Typography\n variant=\"h6\"\n component=\"h6\"\n sx={{\n color: '#000',\n fontWeight: 600,\n fontSize: { xs: 16, lg: 25 },\n m: 0,\n lineHeight: 1.72,\n }}\n >\n {headerContent}\n </Typography>\n </Stack>\n <Typography\n sx={{\n fontSize: 16,\n textAlign: 'left',\n lineHeight: 1.72,\n fontWeight: 300,\n }}\n >\n {children}\n </Typography>\n </CardContent>\n </MuiCard>\n );\n};\n\nconst Header = ({\n className,\n children,\n sx,\n ...props\n}: StackProps & Required<Pick<HowToUseContextValue, 'subtitle'>> & { children: ReactNode }) => {\n const { subtitle } = deepMerge(useHowToUseContext(), props);\n\n return (\n <Stack\n spacing={{ xs: 0.5, lg: 1 }}\n className={classNames('nbb-how-to-use-header', className)}\n sx={[\n {\n textAlign: 'center',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n <Typography\n variant=\"h4\"\n sx={{\n color: 'primary.main',\n fontWeight: 'bold',\n lineHeight: 1.5,\n fontSize: { xs: 18, lg: 24 },\n }}\n >\n {children}\n </Typography>\n <Typography\n variant=\"h1\"\n component=\"h1\"\n sx={{\n fontSize: { xs: 25, lg: 45 },\n fontWeight: 600,\n lineHeight: 1.5,\n }}\n >\n {subtitle}\n </Typography>\n </Stack>\n );\n};\n\nconst Footer = ({\n children,\n className,\n sx,\n ...props\n}: StackProps & Required<Pick<HowToUseContextValue, 'message' | 'linkHref' | 'linkContent'>>) => {\n const { message, linkHref, linkContent } = deepMerge(useHowToUseContext(), props);\n\n return (\n <Stack\n spacing={1.5}\n className={classNames('nbb-how-to-use-footer', className)}\n sx={[\n {\n alignItems: 'center',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n {message && (\n <Typography\n variant=\"body2\"\n sx={{\n color: 'primary.main',\n fontWeight: 600,\n lineHeight: 1.72,\n }}\n >\n {message}\n </Typography>\n )}\n <Button\n href={linkHref}\n rel=\"noreferrer noopener\"\n variant=\"contained\"\n size=\"medium\"\n sx={{\n width: 360,\n maxWidth: '100%',\n py: 1.5,\n fontSize: { lg: 22 },\n lineHeight: 1.5,\n fontWeight: 600,\n }}\n >\n {linkContent}\n </Button>\n </Stack>\n );\n};\n\nconst CardList = ({ children, className, sx, ...props }: StackProps & { children: ReactNode }) => {\n return (\n <Stack\n direction={{ xs: 'column', lg: 'row' }}\n spacing={0}\n className={classNames('nbb-how-to-use-card-list', className)}\n sx={[\n {\n alignItems: { xs: 'center', lg: 'stretch' },\n justifyContent: 'center',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n {children && Array.isArray(children)\n ? children.reduce(\n (total, child, i) => [\n ...total,\n ...(i > 0\n ? [\n <ArrowRight\n key={`right-arrow-${i}`}\n sx={{\n display: { xs: 'none', lg: 'initial' },\n fontSize: 40,\n color: 'primary.main',\n alignSelf: 'center',\n }}\n />,\n <ArrowDropDown\n key={`down-arrow-${i}`}\n sx={{\n display: { xs: 'initial', lg: 'none' },\n fontSize: 40,\n color: 'primary.main',\n alignSelf: 'center',\n }}\n />,\n ]\n : []),\n child,\n ],\n []\n )\n : children}\n </Stack>\n );\n};\n\nconst HowToUse = <CustomBlocks extends Record<string, ReactNode> = {}>({\n className,\n children,\n subtitle,\n headerContent,\n message,\n linkHref,\n linkContent,\n sx,\n ...props\n}: Omit<StackProps, 'children'> & {\n children?: BlocksOverride<typeof defaultHowToUseBlocks, CustomBlocks>;\n} & Required<Pick<HowToUseContextValue, 'subtitle' | 'headerContent' | 'message' | 'linkHref' | 'linkContent'>>) => {\n return (\n <HowToUseProvider\n {...{\n subtitle,\n headerContent,\n message,\n linkHref,\n linkContent,\n }}\n >\n <Stack\n spacing={{ xs: 5, lg: 6 }}\n className={classNames('nbb-how-to-use', className)}\n sx={[\n (theme) => ({\n backgroundColor: theme.palette.background.default,\n py: { xs: 5, lg: 10 },\n px: { xs: 2, lg: 'unset' },\n }),\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n <BlocksOverrideComponent\n defaultBlocks={defaultHowToUseBlocks}\n defaultBlockOrder={Object.keys(defaultHowToUseBlocks) as (keyof typeof defaultHowToUseBlocks)[]}\n blocksOverride={children}\n >\n {/* NOTE: Must remove the some components so they aren't included in the rendering below */}\n {({ blocks: { card, ...blocks }, blockOrder }) => (\n <>\n {blockOrder\n .filter((key) => key in blocks)\n .map<ReactNode>((key) => (\n <Fragment key={String(key)}>{blocks[key]}</Fragment>\n ))}\n </>\n )}\n </BlocksOverrideComponent>\n </Stack>\n </HowToUseProvider>\n );\n};\n\nHowToUse.Header = Header;\nHowToUse.CardList = CardList;\nHowToUse.Card = Card;\nHowToUse.Footer = Footer;\n\nconst defaultHowToUseBlocks = createDefaultBlocks({\n header: HowToUse.Header,\n cardList: HowToUse.CardList,\n card: HowToUse.Card,\n footer: HowToUse.Footer,\n});\n\nexport default HowToUse;\n"],"names":["_jsx","MuiCard","_jsxs","Fragment"],"mappings":";;;;;;;;;;;AAUA,MAAM,eAAe,GAAG,aAAa,CAAmC,SAAS,CAAC;AAE3E,MAAM,gBAAgB,GAAG,CAAC,EAC/B,QAAQ,EACR,GAAG,KAAK,EAGT,KAAI;IACH,OAAOA,GAAA,CAAC,eAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,QAAA,EAAG,QAAQ,EAAA,CAA4B;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