@nodeblocks/frontend-hero-block 0.2.0 → 0.2.1
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/Hero.d.ts +26 -32
- package/dist/Hero.d.ts.map +1 -1
- package/dist/context.d.ts +9 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -175
- package/dist/index.esm.js +1 -173
- package/dist/lib.d.ts +19 -3
- package/dist/lib.d.ts.map +1 -1
- package/package.json +19 -11
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.js.map +0 -1
package/dist/Hero.d.ts
CHANGED
|
@@ -1,47 +1,41 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { HeroContextValue } from './context';
|
|
2
3
|
import { BlocksOverride } from './lib';
|
|
3
4
|
import { StackProps, ButtonProps, BoxProps, TypographyProps } from '@mui/material';
|
|
4
5
|
export declare const Hero: {
|
|
5
|
-
<CustomBlocks extends Record<string, ReactNode> = {}>({
|
|
6
|
-
/** */
|
|
7
|
-
buttonText: string;
|
|
8
|
-
/**
|
|
9
|
-
* Configures the main byline text to display for this component.
|
|
10
|
-
* Supports components to handle inline images and text colors
|
|
11
|
-
*/
|
|
12
|
-
byline: ReactNode;
|
|
13
|
-
/** href for linking Hero */
|
|
14
|
-
onClickButton: () => void;
|
|
15
|
-
/** URL of the image to show in this hero image component */
|
|
16
|
-
imageUrl: string;
|
|
17
|
-
/** Show/hide secondary text */
|
|
18
|
-
secondaryText?: ReactNode;
|
|
19
|
-
/** Show/hide tertiary text */
|
|
20
|
-
tertiaryText?: ReactNode;
|
|
6
|
+
<CustomBlocks extends Record<string, ReactNode> = {}>({ className, children, ...props }: Omit<StackProps, "children"> & Required<Pick<HeroContextValue, "buttonText" | "byline" | "onClickButton" | "imageUrl">> & Partial<Pick<HeroContextValue, "secondaryText" | "tertiaryText">> & {
|
|
21
7
|
children?: BlocksOverride<typeof defaultBlocks, CustomBlocks>;
|
|
22
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
HeroImg(props: Partial<BoxProps<"img">>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
HeroImg({ component, src, alt, className, ...props }: Partial<BoxProps<"img"> & Pick<HeroContextValue, "imageUrl">>): import("react/jsx-runtime").JSX.Element;
|
|
24
10
|
HeroContent: {
|
|
25
|
-
({ className, children, spacing, sx, ...
|
|
26
|
-
HeroByline(props: Partial<TypographyProps
|
|
27
|
-
SecondaryText(props: Partial<TypographyProps
|
|
28
|
-
ActionButton(props: Partial<ButtonProps
|
|
29
|
-
TertiaryText(props: Partial<TypographyProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
({ className, children, spacing, sx, ...props }: Partial<StackProps>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
HeroByline({ variant, className, children, ...props }: Partial<TypographyProps & Pick<HeroContextValue, "byline">>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
SecondaryText({ className, variant, sx, ...props }: Partial<TypographyProps & Pick<HeroContextValue, "secondaryText">>): import("react/jsx-runtime").JSX.Element | null;
|
|
14
|
+
ActionButton({ className, variant, children, onClick, sx, ...props }: Partial<ButtonProps & Pick<HeroContextValue, "buttonText" | "onClickButton">>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
TertiaryText({ className, sx, color, variant, ...props }: Partial<TypographyProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
30
16
|
};
|
|
31
17
|
};
|
|
32
18
|
declare const defaultBlocks: {
|
|
33
19
|
heroContent: import("react").ReactElement<Partial<StackProps>, {
|
|
34
|
-
({ className, children, spacing, sx, ...
|
|
35
|
-
HeroByline(props: Partial<TypographyProps
|
|
36
|
-
SecondaryText(props: Partial<TypographyProps
|
|
37
|
-
ActionButton(props: Partial<ButtonProps
|
|
38
|
-
TertiaryText(props: Partial<TypographyProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
20
|
+
({ className, children, spacing, sx, ...props }: Partial<StackProps>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
HeroByline({ variant, className, children, ...props }: Partial<TypographyProps & Pick<HeroContextValue, "byline">>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
SecondaryText({ className, variant, sx, ...props }: Partial<TypographyProps & Pick<HeroContextValue, "secondaryText">>): import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
+
ActionButton({ className, variant, children, onClick, sx, ...props }: Partial<ButtonProps & Pick<HeroContextValue, "buttonText" | "onClickButton">>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
TertiaryText({ className, sx, color, variant, ...props }: Partial<TypographyProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
39
25
|
}>;
|
|
40
|
-
heroImg: import("react").ReactElement<Partial<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
heroImg: import("react").ReactElement<Partial<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, keyof import("@mui/material/OverridableComponent").CommonProps | keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & {
|
|
27
|
+
component?: React.ElementType;
|
|
28
|
+
} & Pick<HeroContextValue, "imageUrl">>, ({ component, src, alt, className, ...props }: Partial<BoxProps<"img"> & Pick<HeroContextValue, "imageUrl">>) => import("react/jsx-runtime").JSX.Element>;
|
|
29
|
+
heroByline: import("react").ReactElement<Partial<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "children" | "p" | "style" | "color" | "left" | "right" | "className" | "classes" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "top" | "bottom" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "sx" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variant" | "variantMapping"> & {
|
|
30
|
+
component?: React.ElementType;
|
|
31
|
+
} & Pick<HeroContextValue, "byline">>, ({ variant, className, children, ...props }: Partial<TypographyProps & Pick<HeroContextValue, "byline">>) => import("react/jsx-runtime").JSX.Element>;
|
|
32
|
+
secondaryText: import("react").ReactElement<Partial<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "children" | "p" | "style" | "color" | "left" | "right" | "className" | "classes" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "top" | "bottom" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "sx" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variant" | "variantMapping"> & {
|
|
33
|
+
component?: React.ElementType;
|
|
34
|
+
} & Pick<HeroContextValue, "secondaryText">>, ({ className, variant, sx, ...props }: Partial<TypographyProps & Pick<HeroContextValue, "secondaryText">>) => import("react/jsx-runtime").JSX.Element | null>;
|
|
35
|
+
actionButton: import("react").ReactElement<Partial<import("@mui/material").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "style" | "color" | "className" | "classes" | "sx" | "tabIndex" | "loading" | "variant" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "href" | "loadingIndicator" | "loadingPosition" | "size" | "startIcon"> & {
|
|
36
|
+
component?: React.ElementType;
|
|
37
|
+
} & Pick<HeroContextValue, "buttonText" | "onClickButton">>, ({ className, variant, children, onClick, sx, ...props }: Partial<ButtonProps & Pick<HeroContextValue, "buttonText" | "onClickButton">>) => import("react/jsx-runtime").JSX.Element>;
|
|
38
|
+
tertiaryText: import("react").ReactElement<Partial<TypographyProps>, ({ className, sx, color, variant, ...props }: Partial<TypographyProps>) => import("react/jsx-runtime").JSX.Element | null>;
|
|
45
39
|
};
|
|
46
40
|
export {};
|
|
47
41
|
//# sourceMappingURL=Hero.d.ts.map
|
package/dist/Hero.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hero.d.ts","sourceRoot":"","sources":["../src/Hero.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Hero.d.ts","sourceRoot":"","sources":["../src/Hero.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAqD,MAAM,WAAW,CAAC;AAEhG,OAAO,EAAE,cAAc,EAAmE,MAAM,OAAO,CAAC;AACxG,OAAO,EAAkC,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEnH,eAAO,MAAM,IAAI;KAAI,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,0CAIhE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,GAC7B,QAAQ,CAAC,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,QAAQ,GA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BlE,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,eAAe,CAAC,CAAC;uHA8B7E,OAAO,CAAC,eAAe,CAAC;CAgCzB,CAAC"}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
type HeroContextValue = {
|
|
2
|
+
export type HeroContextValue = {
|
|
3
3
|
buttonText: string;
|
|
4
|
+
/**
|
|
5
|
+
* Configures the main byline text to display for this component.
|
|
6
|
+
* Supports components to handle inline images and text colors
|
|
7
|
+
*/
|
|
4
8
|
byline: ReactNode;
|
|
5
9
|
onClickButton: () => void;
|
|
10
|
+
/** URL of the image to show in this hero image component */
|
|
6
11
|
imageUrl: string;
|
|
12
|
+
/** Show/hide secondary text */
|
|
7
13
|
secondaryText?: ReactNode;
|
|
14
|
+
/** Show/hide tertiary text */
|
|
8
15
|
tertiaryText?: ReactNode;
|
|
9
16
|
};
|
|
17
|
+
export declare const keys: readonly ["buttonText", "byline", "onClickButton", "imageUrl", "secondaryText", "tertiaryText"];
|
|
10
18
|
export declare const HeroProvider: ({ children, ...value }: HeroContextValue & {
|
|
11
19
|
children: ReactNode;
|
|
12
20
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
21
|
export declare const useHeroContext: () => HeroContextValue;
|
|
14
|
-
export {};
|
|
15
22
|
//# sourceMappingURL=context.d.ts.map
|
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,
|
|
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,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,MAAM,EAAE,SAAS,CAAC;IAClB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,8BAA8B;IAC9B,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,IAAI,iGAOyB,CAAC;AAW3C,eAAO,MAAM,YAAY,GAAI,wBAG1B,gBAAgB,GAAG;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,4CAEA,CAAC;AAEF,eAAO,MAAM,cAAc,wBAO1B,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,175 +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 react = require('react');
|
|
11
|
-
var material = require('@mui/material');
|
|
12
|
-
|
|
13
|
-
const HeroContext = react.createContext(undefined);
|
|
14
|
-
const HeroProvider = ({ children, ...value }) => {
|
|
15
|
-
return jsxRuntime.jsx(HeroContext.Provider, { value: value, children: children });
|
|
16
|
-
};
|
|
17
|
-
const useHeroContext = () => {
|
|
18
|
-
const context = react.useContext(HeroContext);
|
|
19
|
-
if (!context) {
|
|
20
|
-
throw new Error('useHeroContext must be used within a HeroProvider');
|
|
21
|
-
}
|
|
22
|
-
return context;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Creates a strongly typed `defaultBlocks` object, allowing for types to propagate into block override objects.
|
|
27
|
-
*
|
|
28
|
-
* @param components - A map of default block keys to component functions.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* const defaultBlocks = createDefaultBlocks({
|
|
32
|
-
* title: Title,
|
|
33
|
-
* description: Description,
|
|
34
|
-
* form: Form,
|
|
35
|
-
* });
|
|
36
|
-
*/
|
|
37
|
-
function createDefaultBlocks(components) {
|
|
38
|
-
return Object.fromEntries(Object.entries(components).map(([key, Component]) => [key, react.createElement(Component, { key })]));
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* A component for rendering {@link BlocksOverride|`BlocksOverride`} results.
|
|
42
|
-
* Exposes the evaluated `blocks` and `blockOrder` as arguments to the `children` function.
|
|
43
|
-
*
|
|
44
|
-
* @param props
|
|
45
|
-
* @param props.blocksOverride - The {@link BlocksOverride|`BlocksOverride`} (i.e. `children` of outer component).
|
|
46
|
-
* @param props.defaultBlocks - The default blocks of outer component.
|
|
47
|
-
* @param props.children - A function returning the JSX to render.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* <BlocksOverrideComponent
|
|
51
|
-
* defaultBlocks={defaultFormBlocks}
|
|
52
|
-
* blocksOverride={children}
|
|
53
|
-
* >
|
|
54
|
-
* {({ blocks, blockOrder }) =>
|
|
55
|
-
* blockOrder.map((key) => (
|
|
56
|
-
* <Fragment key={String(key)}>{blocks[key]}</Fragment>
|
|
57
|
-
* ))
|
|
58
|
-
* }
|
|
59
|
-
* </BlocksOverrideComponent>
|
|
60
|
-
*/
|
|
61
|
-
function BlocksOverrideComponent({ blocksOverride, defaultBlocks, defaultBlockOrder, children, }) {
|
|
62
|
-
if (blocksOverride === undefined) {
|
|
63
|
-
return children({
|
|
64
|
-
// TODO: Remove this assertion
|
|
65
|
-
blocks: defaultBlocks,
|
|
66
|
-
blockOrder: defaultBlockOrder,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
if (typeof blocksOverride === 'function') {
|
|
70
|
-
const { blocks, blockOrder } = blocksOverride({
|
|
71
|
-
defaultBlocks,
|
|
72
|
-
defaultBlockOrder,
|
|
73
|
-
});
|
|
74
|
-
return children({ blocks, blockOrder });
|
|
75
|
-
}
|
|
76
|
-
return blocksOverride;
|
|
77
|
-
}
|
|
78
|
-
function deepMerge(obj1, obj2) {
|
|
79
|
-
const result = { ...obj1 };
|
|
80
|
-
for (const key in obj2) {
|
|
81
|
-
if (obj2.hasOwnProperty(key)) {
|
|
82
|
-
const val1 = result[key];
|
|
83
|
-
const val2 = obj2[key];
|
|
84
|
-
if (Array.isArray(val1) || Array.isArray(val2)) {
|
|
85
|
-
// If either is an array, replace entirely with obj2's value
|
|
86
|
-
result[key] = val2;
|
|
87
|
-
}
|
|
88
|
-
else if (typeof val1 === 'object' && val1 !== null && typeof val2 === 'object' && val2 !== null) {
|
|
89
|
-
result[key] = deepMerge(val1, val2);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
result[key] = val2;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Utility function to join class names together, ignoring undefined or nil values.
|
|
100
|
-
* @param classes - The class names to join.
|
|
101
|
-
* @returns The joined class names.
|
|
102
|
-
*/
|
|
103
|
-
function classNames(...classes) {
|
|
104
|
-
return classes.flat().filter(Boolean).join(' ');
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const Hero = ({ onClickButton, buttonText, imageUrl, secondaryText, tertiaryText, byline, className, children, ...props }) => {
|
|
108
|
-
return (jsxRuntime.jsx(material.Stack, { className: classNames('nbb-hero-block', className), ...props, children: jsxRuntime.jsx(HeroProvider, { onClickButton,
|
|
109
|
-
buttonText,
|
|
110
|
-
imageUrl,
|
|
111
|
-
secondaryText,
|
|
112
|
-
tertiaryText,
|
|
113
|
-
byline, children: jsxRuntime.jsx(BlocksOverrideComponent, { defaultBlocks: defaultBlocks, defaultBlockOrder: Object.keys(defaultBlocks), blocksOverride: children, children: ({ blocks: { heroByline, secondaryText, actionButton, tertiaryText, ...blocks }, blockOrder }) => blockOrder
|
|
114
|
-
.filter((key) => key in blocks)
|
|
115
|
-
.map((key) => jsxRuntime.jsx(react.Fragment, { children: blocks[key] }, String(key))) }) }) }));
|
|
116
|
-
};
|
|
117
|
-
Hero.HeroImg = (props) => {
|
|
118
|
-
const { component = 'img', className, imageUrl, src, alt = 'hero image', ...rest } = deepMerge(useHeroContext(), props);
|
|
119
|
-
return (jsxRuntime.jsx(material.Box, { component: component, src: src || imageUrl, alt: alt, className: classNames('nbb-hero-hero-img', 'nbb-hero-img', className), ...rest }));
|
|
120
|
-
};
|
|
121
|
-
const HeroContent = ({ className, children, spacing = 3, sx, ...rest }) => {
|
|
122
|
-
return (jsxRuntime.jsx(material.Stack, { spacing: spacing, sx: { alignItems: 'center', py: 5.5, ...(Array.isArray(sx) ? sx : [sx]) }, className: classNames('nbb-hero-hero-content', 'nbb-hero-content', className), ...rest, children: children || (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(material.Stack, { sx: { alignItems: 'center' }, children: [jsxRuntime.jsx(HeroContent.HeroByline, {}), jsxRuntime.jsx(HeroContent.SecondaryText, {})] }), jsxRuntime.jsxs(material.Stack, { spacing: Number(spacing) / 2, sx: { alignItems: 'center' }, children: [jsxRuntime.jsx(HeroContent.ActionButton, {}), jsxRuntime.jsx(HeroContent.TertiaryText, {})] })] })) }));
|
|
123
|
-
};
|
|
124
|
-
Hero.HeroContent = HeroContent;
|
|
125
|
-
HeroContent.HeroByline = (props) => {
|
|
126
|
-
const { byline, variant = 'h6', className, children, ...rest } = deepMerge(useHeroContext(), props);
|
|
127
|
-
return (jsxRuntime.jsx(material.Typography, { variant: variant, className: classNames(className, 'nbb-hero-hero-content-hero-byline', 'nbb-hero-byline'), ...rest, children: children || byline }));
|
|
128
|
-
};
|
|
129
|
-
HeroContent.SecondaryText = (props) => {
|
|
130
|
-
const { className, variant = 'h2', children, secondaryText, sx = [], ...rest } = deepMerge(useHeroContext(), props);
|
|
131
|
-
const content = children || secondaryText;
|
|
132
|
-
if (!content)
|
|
133
|
-
return null;
|
|
134
|
-
return (jsxRuntime.jsx(material.Typography, { variant: variant, className: classNames(className, 'nbb-hero-hero-content-secondary-text', 'nbb-hero-secondary-text'), sx: [
|
|
135
|
-
{
|
|
136
|
-
textAlign: 'center',
|
|
137
|
-
},
|
|
138
|
-
...(Array.isArray(sx) ? sx : sx ? [sx] : []),
|
|
139
|
-
], ...rest, children: content }));
|
|
140
|
-
};
|
|
141
|
-
HeroContent.ActionButton = (props) => {
|
|
142
|
-
const { buttonText, className, variant = 'contained', children, onClick, sx = [], ...rest } = deepMerge(useHeroContext(), props);
|
|
143
|
-
return (jsxRuntime.jsx(material.Button, { variant: variant, onClick: onClick, className: classNames(className, 'nbb-hero-hero-content-action-button', 'nbb-button'), sx: [
|
|
144
|
-
{
|
|
145
|
-
fontWeight: 600,
|
|
146
|
-
px: 4,
|
|
147
|
-
py: 1.5,
|
|
148
|
-
},
|
|
149
|
-
...(Array.isArray(sx) ? sx : sx ? [sx] : []),
|
|
150
|
-
], ...rest, children: children || buttonText }));
|
|
151
|
-
};
|
|
152
|
-
HeroContent.TertiaryText = (props) => {
|
|
153
|
-
const { className, children, tertiaryText, color = 'primary', variant = 'button', sx = [], ...rest } = deepMerge(useHeroContext(), props);
|
|
154
|
-
const content = children || tertiaryText;
|
|
155
|
-
if (!content)
|
|
156
|
-
return null;
|
|
157
|
-
return (jsxRuntime.jsx(material.Typography, { color: color, variant: variant, className: classNames(className, 'nbb-hero-hero-content-tertiary-text', 'nbb-hero-tertiary-text'), sx: [
|
|
158
|
-
(theme) => ({
|
|
159
|
-
lineHeight: theme.typography.body1.lineHeight,
|
|
160
|
-
fontWeight: theme.typography.h1.fontWeight,
|
|
161
|
-
}),
|
|
162
|
-
...(Array.isArray(sx) ? sx : sx ? [sx] : []),
|
|
163
|
-
], ...rest, children: content }));
|
|
164
|
-
};
|
|
165
|
-
const defaultBlocks = createDefaultBlocks({
|
|
166
|
-
heroContent: Hero.HeroContent,
|
|
167
|
-
heroImg: Hero.HeroImg,
|
|
168
|
-
heroByline: HeroContent.HeroByline,
|
|
169
|
-
secondaryText: HeroContent.SecondaryText,
|
|
170
|
-
actionButton: HeroContent.ActionButton,
|
|
171
|
-
tertiaryText: HeroContent.TertiaryText,
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
exports.Hero = Hero;
|
|
175
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material");const n=["buttonText","byline","onClickButton","imageUrl","secondaryText","tertiaryText"],o=r.createContext(void 0),c=({children:r,...t})=>e.jsx(o.Provider,{value:t,children:r}),i=()=>{const e=r.useContext(o);if(!e)throw new Error("useHeroContext must be used within a HeroProvider");return e};function a({blocksOverride:e,defaultBlocks:r,defaultBlockOrder:t,children:n}){if(void 0===e)return n({blocks:r,blockOrder:t});if("function"==typeof e){const{blocks:o,blockOrder:c}=e({defaultBlocks:r,defaultBlockOrder:t});return n({blocks:o,blockOrder:c})}return e}function s(e,r){const t={...e};for(const e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e]);return t}function l(...e){return e.flat().filter(Boolean).join(" ")}function h(e,...r){const t={...e};for(const e of r)delete t[e];return t}function x(e,...r){const t={};for(const n of r)n in e&&(t[n]=e[n]);return t}const d=({className:o,children:i,...s})=>e.jsx(t.Stack,{className:l("nbb-hero-block",o),...h(s,...n),children:e.jsx(c,{...x(s,...n),children:e.jsx(a,{defaultBlocks:b,defaultBlockOrder:Object.keys(b),blocksOverride:i,children:({blocks:{heroByline:t,secondaryText:n,actionButton:o,tertiaryText:c,...i},blockOrder:a})=>a.filter(e=>e in i).map(t=>e.jsx(r.Fragment,{children:i[t]},String(t)))})})});d.HeroImg=({component:r="img",src:o,alt:c="hero image",className:a,...x})=>{const d=i(),{imageUrl:y}=s(d,x);return e.jsx(t.Box,{component:r,src:o||y,alt:c,className:l("nbb-hero-hero-img","nbb-hero-img",a),...h(x,...n)})};const y=({className:r,children:n,spacing:o=3,sx:c,...i})=>e.jsx(t.Stack,{spacing:o,sx:{alignItems:"center",py:5.5,...Array.isArray(c)?c:[c]},className:l("nbb-hero-hero-content","nbb-hero-content",r),...i,children:n||e.jsxs(e.Fragment,{children:[e.jsxs(t.Stack,{sx:{alignItems:"center"},children:[e.jsx(y.HeroByline,{}),e.jsx(y.SecondaryText,{})]}),e.jsxs(t.Stack,{spacing:Number(o)/2,sx:{alignItems:"center"},children:[e.jsx(y.ActionButton,{}),e.jsx(y.TertiaryText,{})]})]})});d.HeroContent=y,y.HeroByline=({variant:r="h6",className:o,children:c,...a})=>{const x=i(),{byline:d}=s(x,a);return e.jsx(t.Typography,{variant:r,className:l(o,"nbb-hero-hero-content-hero-byline","nbb-hero-byline"),...h(a,...n),children:c||d})},y.SecondaryText=({className:r,variant:o="h2",sx:c,...a})=>{const x=i(),{secondaryText:d}=s(x,a),y="children"in a?a.children:d;return y?e.jsx(t.Typography,{variant:o,className:l(r,"nbb-hero-hero-content-secondary-text","nbb-hero-secondary-text"),sx:[{textAlign:"center"},...Array.isArray(c)?c:[c]],...h(a,...n),children:y}):null},y.ActionButton=({className:r,variant:o="contained",children:c,onClick:a,sx:x,...d})=>{const y=i(),{buttonText:b,onClickButton:u}=s(y,d);return e.jsx(t.Button,{variant:o,onClick:a||u,className:l(r,"nbb-hero-hero-content-action-button","nbb-button"),sx:[{fontWeight:600,px:4,py:1.5},...Array.isArray(x)?x:[x]],...h(d,...n),children:c||b})},y.TertiaryText=({className:r,sx:o,color:c="primary",variant:a="button",...x})=>{const d=i(),{tertiaryText:y}=s(d,x),b="children"in x?x.children:y;return b?e.jsx(t.Typography,{color:c,variant:a,className:l(r,"nbb-hero-hero-content-tertiary-text","nbb-hero-tertiary-text"),sx:[e=>({lineHeight:e.typography.body1.lineHeight,fontWeight:e.typography.h1.fontWeight}),...Array.isArray(o)?o:[o]],...h(x,...n),children:b}):null};const b=(u={heroContent:d.HeroContent,heroImg:d.HeroImg,heroByline:y.HeroByline,secondaryText:y.SecondaryText,actionButton:y.ActionButton,tertiaryText:y.TertiaryText},Object.fromEntries(Object.entries(u).map(([e,t])=>[e,r.createElement(t,{key:e})])));var u;exports.Hero=d;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,173 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof global === 'undefined') {
|
|
4
|
-
var global = window;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
import { createContext, useContext, createElement, Fragment as Fragment$1 } from 'react';
|
|
9
|
-
import { Typography, Button, Stack, Box } from '@mui/material';
|
|
10
|
-
|
|
11
|
-
const HeroContext = createContext(undefined);
|
|
12
|
-
const HeroProvider = ({ children, ...value }) => {
|
|
13
|
-
return jsx(HeroContext.Provider, { value: value, children: children });
|
|
14
|
-
};
|
|
15
|
-
const useHeroContext = () => {
|
|
16
|
-
const context = useContext(HeroContext);
|
|
17
|
-
if (!context) {
|
|
18
|
-
throw new Error('useHeroContext must be used within a HeroProvider');
|
|
19
|
-
}
|
|
20
|
-
return context;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Creates a strongly typed `defaultBlocks` object, allowing for types to propagate into block override objects.
|
|
25
|
-
*
|
|
26
|
-
* @param components - A map of default block keys to component functions.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* const defaultBlocks = createDefaultBlocks({
|
|
30
|
-
* title: Title,
|
|
31
|
-
* description: Description,
|
|
32
|
-
* form: Form,
|
|
33
|
-
* });
|
|
34
|
-
*/
|
|
35
|
-
function createDefaultBlocks(components) {
|
|
36
|
-
return Object.fromEntries(Object.entries(components).map(([key, Component]) => [key, createElement(Component, { key })]));
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* A component for rendering {@link BlocksOverride|`BlocksOverride`} results.
|
|
40
|
-
* Exposes the evaluated `blocks` and `blockOrder` as arguments to the `children` function.
|
|
41
|
-
*
|
|
42
|
-
* @param props
|
|
43
|
-
* @param props.blocksOverride - The {@link BlocksOverride|`BlocksOverride`} (i.e. `children` of outer component).
|
|
44
|
-
* @param props.defaultBlocks - The default blocks of outer component.
|
|
45
|
-
* @param props.children - A function returning the JSX to render.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* <BlocksOverrideComponent
|
|
49
|
-
* defaultBlocks={defaultFormBlocks}
|
|
50
|
-
* blocksOverride={children}
|
|
51
|
-
* >
|
|
52
|
-
* {({ blocks, blockOrder }) =>
|
|
53
|
-
* blockOrder.map((key) => (
|
|
54
|
-
* <Fragment key={String(key)}>{blocks[key]}</Fragment>
|
|
55
|
-
* ))
|
|
56
|
-
* }
|
|
57
|
-
* </BlocksOverrideComponent>
|
|
58
|
-
*/
|
|
59
|
-
function BlocksOverrideComponent({ blocksOverride, defaultBlocks, defaultBlockOrder, children, }) {
|
|
60
|
-
if (blocksOverride === undefined) {
|
|
61
|
-
return children({
|
|
62
|
-
// TODO: Remove this assertion
|
|
63
|
-
blocks: defaultBlocks,
|
|
64
|
-
blockOrder: defaultBlockOrder,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
if (typeof blocksOverride === 'function') {
|
|
68
|
-
const { blocks, blockOrder } = blocksOverride({
|
|
69
|
-
defaultBlocks,
|
|
70
|
-
defaultBlockOrder,
|
|
71
|
-
});
|
|
72
|
-
return children({ blocks, blockOrder });
|
|
73
|
-
}
|
|
74
|
-
return blocksOverride;
|
|
75
|
-
}
|
|
76
|
-
function deepMerge(obj1, obj2) {
|
|
77
|
-
const result = { ...obj1 };
|
|
78
|
-
for (const key in obj2) {
|
|
79
|
-
if (obj2.hasOwnProperty(key)) {
|
|
80
|
-
const val1 = result[key];
|
|
81
|
-
const val2 = obj2[key];
|
|
82
|
-
if (Array.isArray(val1) || Array.isArray(val2)) {
|
|
83
|
-
// If either is an array, replace entirely with obj2's value
|
|
84
|
-
result[key] = val2;
|
|
85
|
-
}
|
|
86
|
-
else if (typeof val1 === 'object' && val1 !== null && typeof val2 === 'object' && val2 !== null) {
|
|
87
|
-
result[key] = deepMerge(val1, val2);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
result[key] = val2;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Utility function to join class names together, ignoring undefined or nil values.
|
|
98
|
-
* @param classes - The class names to join.
|
|
99
|
-
* @returns The joined class names.
|
|
100
|
-
*/
|
|
101
|
-
function classNames(...classes) {
|
|
102
|
-
return classes.flat().filter(Boolean).join(' ');
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const Hero = ({ onClickButton, buttonText, imageUrl, secondaryText, tertiaryText, byline, className, children, ...props }) => {
|
|
106
|
-
return (jsx(Stack, { className: classNames('nbb-hero-block', className), ...props, children: jsx(HeroProvider, { onClickButton,
|
|
107
|
-
buttonText,
|
|
108
|
-
imageUrl,
|
|
109
|
-
secondaryText,
|
|
110
|
-
tertiaryText,
|
|
111
|
-
byline, children: jsx(BlocksOverrideComponent, { defaultBlocks: defaultBlocks, defaultBlockOrder: Object.keys(defaultBlocks), blocksOverride: children, children: ({ blocks: { heroByline, secondaryText, actionButton, tertiaryText, ...blocks }, blockOrder }) => blockOrder
|
|
112
|
-
.filter((key) => key in blocks)
|
|
113
|
-
.map((key) => jsx(Fragment$1, { children: blocks[key] }, String(key))) }) }) }));
|
|
114
|
-
};
|
|
115
|
-
Hero.HeroImg = (props) => {
|
|
116
|
-
const { component = 'img', className, imageUrl, src, alt = 'hero image', ...rest } = deepMerge(useHeroContext(), props);
|
|
117
|
-
return (jsx(Box, { component: component, src: src || imageUrl, alt: alt, className: classNames('nbb-hero-hero-img', 'nbb-hero-img', className), ...rest }));
|
|
118
|
-
};
|
|
119
|
-
const HeroContent = ({ className, children, spacing = 3, sx, ...rest }) => {
|
|
120
|
-
return (jsx(Stack, { spacing: spacing, sx: { alignItems: 'center', py: 5.5, ...(Array.isArray(sx) ? sx : [sx]) }, className: classNames('nbb-hero-hero-content', 'nbb-hero-content', className), ...rest, children: children || (jsxs(Fragment, { children: [jsxs(Stack, { sx: { alignItems: 'center' }, children: [jsx(HeroContent.HeroByline, {}), jsx(HeroContent.SecondaryText, {})] }), jsxs(Stack, { spacing: Number(spacing) / 2, sx: { alignItems: 'center' }, children: [jsx(HeroContent.ActionButton, {}), jsx(HeroContent.TertiaryText, {})] })] })) }));
|
|
121
|
-
};
|
|
122
|
-
Hero.HeroContent = HeroContent;
|
|
123
|
-
HeroContent.HeroByline = (props) => {
|
|
124
|
-
const { byline, variant = 'h6', className, children, ...rest } = deepMerge(useHeroContext(), props);
|
|
125
|
-
return (jsx(Typography, { variant: variant, className: classNames(className, 'nbb-hero-hero-content-hero-byline', 'nbb-hero-byline'), ...rest, children: children || byline }));
|
|
126
|
-
};
|
|
127
|
-
HeroContent.SecondaryText = (props) => {
|
|
128
|
-
const { className, variant = 'h2', children, secondaryText, sx = [], ...rest } = deepMerge(useHeroContext(), props);
|
|
129
|
-
const content = children || secondaryText;
|
|
130
|
-
if (!content)
|
|
131
|
-
return null;
|
|
132
|
-
return (jsx(Typography, { variant: variant, className: classNames(className, 'nbb-hero-hero-content-secondary-text', 'nbb-hero-secondary-text'), sx: [
|
|
133
|
-
{
|
|
134
|
-
textAlign: 'center',
|
|
135
|
-
},
|
|
136
|
-
...(Array.isArray(sx) ? sx : sx ? [sx] : []),
|
|
137
|
-
], ...rest, children: content }));
|
|
138
|
-
};
|
|
139
|
-
HeroContent.ActionButton = (props) => {
|
|
140
|
-
const { buttonText, className, variant = 'contained', children, onClick, sx = [], ...rest } = deepMerge(useHeroContext(), props);
|
|
141
|
-
return (jsx(Button, { variant: variant, onClick: onClick, className: classNames(className, 'nbb-hero-hero-content-action-button', 'nbb-button'), sx: [
|
|
142
|
-
{
|
|
143
|
-
fontWeight: 600,
|
|
144
|
-
px: 4,
|
|
145
|
-
py: 1.5,
|
|
146
|
-
},
|
|
147
|
-
...(Array.isArray(sx) ? sx : sx ? [sx] : []),
|
|
148
|
-
], ...rest, children: children || buttonText }));
|
|
149
|
-
};
|
|
150
|
-
HeroContent.TertiaryText = (props) => {
|
|
151
|
-
const { className, children, tertiaryText, color = 'primary', variant = 'button', sx = [], ...rest } = deepMerge(useHeroContext(), props);
|
|
152
|
-
const content = children || tertiaryText;
|
|
153
|
-
if (!content)
|
|
154
|
-
return null;
|
|
155
|
-
return (jsx(Typography, { color: color, variant: variant, className: classNames(className, 'nbb-hero-hero-content-tertiary-text', 'nbb-hero-tertiary-text'), sx: [
|
|
156
|
-
(theme) => ({
|
|
157
|
-
lineHeight: theme.typography.body1.lineHeight,
|
|
158
|
-
fontWeight: theme.typography.h1.fontWeight,
|
|
159
|
-
}),
|
|
160
|
-
...(Array.isArray(sx) ? sx : sx ? [sx] : []),
|
|
161
|
-
], ...rest, children: content }));
|
|
162
|
-
};
|
|
163
|
-
const defaultBlocks = createDefaultBlocks({
|
|
164
|
-
heroContent: Hero.HeroContent,
|
|
165
|
-
heroImg: Hero.HeroImg,
|
|
166
|
-
heroByline: HeroContent.HeroByline,
|
|
167
|
-
secondaryText: HeroContent.SecondaryText,
|
|
168
|
-
actionButton: HeroContent.ActionButton,
|
|
169
|
-
tertiaryText: HeroContent.TertiaryText,
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
export { Hero };
|
|
173
|
-
//# sourceMappingURL=index.esm.js.map
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{createContext as n,useContext as o,createElement as c,Fragment as i}from"react";import{Typography as a,Button as l,Stack as s,Box as h}from"@mui/material";const d=["buttonText","byline","onClickButton","imageUrl","secondaryText","tertiaryText"],b=n(void 0),y=({children:r,...t})=>e(b.Provider,{value:t,children:r}),u=()=>{const e=o(b);if(!e)throw new Error("useHeroContext must be used within a HeroProvider");return e};function m({blocksOverride:e,defaultBlocks:r,defaultBlockOrder:t,children:n}){if(void 0===e)return n({blocks:r,blockOrder:t});if("function"==typeof e){const{blocks:o,blockOrder:c}=e({defaultBlocks:r,defaultBlockOrder:t});return n({blocks:o,blockOrder:c})}return e}function x(e,r){const t={...e};for(const e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e]);return t}function f(...e){return e.flat().filter(Boolean).join(" ")}function g(e,...r){const t={...e};for(const e of r)delete t[e];return t}function k(e,...r){const t={};for(const n of r)n in e&&(t[n]=e[n]);return t}const p=({className:r,children:t,...n})=>e(s,{className:f("nbb-hero-block",r),...g(n,...d),children:e(y,{...k(n,...d),children:e(m,{defaultBlocks:T,defaultBlockOrder:Object.keys(T),blocksOverride:t,children:({blocks:{heroByline:r,secondaryText:t,actionButton:n,tertiaryText:o,...c},blockOrder:a})=>a.filter(e=>e in c).map(r=>e(i,{children:c[r]},String(r)))})})});p.HeroImg=({component:r="img",src:t,alt:n="hero image",className:o,...c})=>{const i=u(),{imageUrl:a}=x(i,c);return e(h,{component:r,src:t||a,alt:n,className:f("nbb-hero-hero-img","nbb-hero-img",o),...g(c,...d)})};const B=({className:n,children:o,spacing:c=3,sx:i,...a})=>e(s,{spacing:c,sx:{alignItems:"center",py:5.5,...Array.isArray(i)?i:[i]},className:f("nbb-hero-hero-content","nbb-hero-content",n),...a,children:o||r(t,{children:[r(s,{sx:{alignItems:"center"},children:[e(B.HeroByline,{}),e(B.SecondaryText,{})]}),r(s,{spacing:Number(c)/2,sx:{alignItems:"center"},children:[e(B.ActionButton,{}),e(B.TertiaryText,{})]})]})});p.HeroContent=B,B.HeroByline=({variant:r="h6",className:t,children:n,...o})=>{const c=u(),{byline:i}=x(c,o);return e(a,{variant:r,className:f(t,"nbb-hero-hero-content-hero-byline","nbb-hero-byline"),...g(o,...d),children:n||i})},B.SecondaryText=({className:r,variant:t="h2",sx:n,...o})=>{const c=u(),{secondaryText:i}=x(c,o),l="children"in o?o.children:i;return l?e(a,{variant:t,className:f(r,"nbb-hero-hero-content-secondary-text","nbb-hero-secondary-text"),sx:[{textAlign:"center"},...Array.isArray(n)?n:[n]],...g(o,...d),children:l}):null},B.ActionButton=({className:r,variant:t="contained",children:n,onClick:o,sx:c,...i})=>{const a=u(),{buttonText:s,onClickButton:h}=x(a,i);return e(l,{variant:t,onClick:o||h,className:f(r,"nbb-hero-hero-content-action-button","nbb-button"),sx:[{fontWeight:600,px:4,py:1.5},...Array.isArray(c)?c:[c]],...g(i,...d),children:n||s})},B.TertiaryText=({className:r,sx:t,color:n="primary",variant:o="button",...c})=>{const i=u(),{tertiaryText:l}=x(i,c),s="children"in c?c.children:l;return s?e(a,{color:n,variant:o,className:f(r,"nbb-hero-hero-content-tertiary-text","nbb-hero-tertiary-text"),sx:[e=>({lineHeight:e.typography.body1.lineHeight,fontWeight:e.typography.h1.fontWeight}),...Array.isArray(t)?t:[t]],...g(c,...d),children:s}):null};const T=(v={heroContent:p.HeroContent,heroImg:p.HeroImg,heroByline:B.HeroByline,secondaryText:B.SecondaryText,actionButton:B.ActionButton,tertiaryText:B.TertiaryText},Object.fromEntries(Object.entries(v).map(([e,r])=>[e,c(r,{key:e})])));var v;export{p as Hero};
|
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,aAAa,CAAC;IAC7B,iBAAiB,EAAE,SAAS,CAAC,MAAM,aAAa,CAAC,EAAE,CAAC;CACrD,KAAK;IACJ,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,YAAY,CAAC;IAE9C,UAAU,EAAE,SAAS,CAAC,MAAM,aAAa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AG,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,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodeblocks/frontend-hero-block",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"main": "dist/index.cjs.js",
|
|
5
|
-
"module": "dist/index.esm.js",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
3
|
+
"version": "0.2.1",
|
|
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
|
+
"development": "./src/index.ts",
|
|
11
|
+
"import": "./dist/index.esm.js",
|
|
12
|
+
"require": "./dist/index.cjs.js",
|
|
13
|
+
"default": "./dist/index.esm.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
8
16
|
"files": [
|
|
9
|
-
"dist/"
|
|
10
|
-
"dist/index.css"
|
|
17
|
+
"dist/"
|
|
11
18
|
],
|
|
12
19
|
"scripts": {
|
|
13
|
-
"build": "rollup -c",
|
|
14
|
-
"watch": "rm -rf dist && cross-env NODE_ENV=development rollup -c --watch"
|
|
20
|
+
"build": "npm run typecheck && rollup -c",
|
|
21
|
+
"watch": "rm -rf dist && cross-env NODE_ENV=development rollup -c --watch",
|
|
22
|
+
"typecheck": "tsc --noEmit"
|
|
15
23
|
},
|
|
16
24
|
"peerDependencies": {
|
|
17
25
|
"@emotion/react": "^11.14.0",
|
|
@@ -24,12 +32,12 @@
|
|
|
24
32
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
25
33
|
"@rollup/plugin-json": "^6.1.0",
|
|
26
34
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
35
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
27
36
|
"@rollup/plugin-typescript": "^12.1.1",
|
|
28
37
|
"@types/react": "19.2.7",
|
|
29
38
|
"@types/react-dom": "19.2.3",
|
|
30
|
-
"rollup": "^4.
|
|
39
|
+
"rollup": "^4.55.1",
|
|
31
40
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
32
|
-
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
33
41
|
"rollup-plugin-postcss": "^4.0.2",
|
|
34
42
|
"rollup-plugin-serve": "^1.1.1",
|
|
35
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/Hero.tsx"],"sourcesContent":["import { createContext, ReactNode, useContext } from 'react';\n\ntype HeroContextValue = {\n buttonText: string;\n byline: ReactNode;\n onClickButton: () => void;\n imageUrl: string;\n secondaryText?: ReactNode;\n tertiaryText?: ReactNode;\n};\n\nconst HeroContext = createContext<HeroContextValue | undefined>(undefined);\n\nexport const HeroProvider = ({\n children,\n ...value\n}: HeroContextValue & {\n children: ReactNode;\n}) => {\n return <HeroContext.Provider value={value}>{children}</HeroContext.Provider>;\n};\n\nexport const useHeroContext = () => {\n const context = useContext<HeroContextValue | undefined>(HeroContext);\n\n if (!context) {\n throw new Error('useHeroContext must be used within a HeroProvider');\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 { ComponentProps, Fragment, ReactNode } from 'react';\nimport { HeroProvider, useHeroContext } from './context';\nimport { BlocksOverride, BlocksOverrideComponent, classNames, createDefaultBlocks, deepMerge } from './lib';\nimport { Box, Button, Stack, Typography, StackProps, ButtonProps, BoxProps, TypographyProps } from '@mui/material';\n\nexport const Hero = <CustomBlocks extends Record<string, ReactNode> = {}>({\n onClickButton,\n buttonText,\n imageUrl,\n secondaryText,\n tertiaryText,\n byline,\n className,\n children,\n ...props\n}: Omit<StackProps, 'children'> & {\n /** */\n buttonText: string;\n /**\n * Configures the main byline text to display for this component.\n * Supports components to handle inline images and text colors\n */\n byline: ReactNode;\n /** href for linking Hero */\n onClickButton: () => void;\n /** URL of the image to show in this hero image component */\n imageUrl: string;\n /** Show/hide secondary text */\n secondaryText?: ReactNode;\n /** Show/hide tertiary text */\n tertiaryText?: ReactNode;\n children?: BlocksOverride<typeof defaultBlocks, CustomBlocks>;\n}) => {\n return (\n <Stack className={classNames('nbb-hero-block', className)} {...props}>\n <HeroProvider\n {...{\n onClickButton,\n buttonText,\n imageUrl,\n secondaryText,\n tertiaryText,\n byline,\n }}\n >\n <BlocksOverrideComponent\n defaultBlocks={defaultBlocks}\n defaultBlockOrder={Object.keys(defaultBlocks) as (keyof typeof defaultBlocks)[]}\n blocksOverride={children}\n >\n {({ blocks: { heroByline, secondaryText, actionButton, tertiaryText, ...blocks }, blockOrder }) =>\n blockOrder\n .filter((key) => key in blocks)\n .map<ReactNode>((key) => <Fragment key={String(key)}>{blocks[key]}</Fragment>)\n }\n </BlocksOverrideComponent>\n </HeroProvider>\n </Stack>\n );\n};\n\nHero.HeroImg = (props: Partial<BoxProps<'img'>>) => {\n const {\n component = 'img',\n className,\n imageUrl,\n src,\n alt = 'hero image',\n ...rest\n } = deepMerge(useHeroContext(), props);\n\n return (\n <Box\n component={component}\n src={src || imageUrl}\n alt={alt}\n className={classNames('nbb-hero-hero-img', 'nbb-hero-img', className)}\n {...rest}\n />\n );\n};\n\nconst HeroContent = ({ className, children, spacing = 3, sx, ...rest }: Partial<StackProps>) => {\n return (\n <Stack\n spacing={spacing}\n sx={{ alignItems: 'center', py: 5.5, ...(Array.isArray(sx) ? sx : [sx]) }}\n className={classNames('nbb-hero-hero-content', 'nbb-hero-content', className)}\n {...rest}\n >\n {children || (\n <>\n <Stack sx={{ alignItems: 'center' }}>\n <HeroContent.HeroByline />\n <HeroContent.SecondaryText />\n </Stack>\n <Stack spacing={Number(spacing) / 2} sx={{ alignItems: 'center' }}>\n <HeroContent.ActionButton />\n <HeroContent.TertiaryText />\n </Stack>\n </>\n )}\n </Stack>\n );\n};\n\nHero.HeroContent = HeroContent;\n\nHeroContent.HeroByline = (props: Partial<TypographyProps>) => {\n const { byline, variant = 'h6', className, children, ...rest } = deepMerge(useHeroContext(), props);\n\n return (\n <Typography\n variant={variant}\n className={classNames(className, 'nbb-hero-hero-content-hero-byline', 'nbb-hero-byline')}\n {...rest}\n >\n {children || byline}\n </Typography>\n );\n};\n\nHeroContent.SecondaryText = (props: Partial<TypographyProps>) => {\n const { className, variant = 'h2', children, secondaryText, sx = [], ...rest } = deepMerge(useHeroContext(), props);\n const content = children || secondaryText;\n if (!content) return null;\n return (\n <Typography\n variant={variant}\n className={classNames(className, 'nbb-hero-hero-content-secondary-text', 'nbb-hero-secondary-text')}\n sx={[\n {\n textAlign: 'center',\n },\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ]}\n {...rest}\n >\n {content}\n </Typography>\n );\n};\n\nHeroContent.ActionButton = (props: Partial<ButtonProps>) => {\n const {\n buttonText,\n className,\n variant = 'contained',\n children,\n onClick,\n sx = [],\n ...rest\n } = deepMerge(useHeroContext(), props);\n\n return (\n <Button\n variant={variant}\n onClick={onClick}\n className={classNames(className, 'nbb-hero-hero-content-action-button', 'nbb-button')}\n sx={[\n {\n fontWeight: 600,\n px: 4,\n py: 1.5,\n },\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ]}\n {...rest}\n >\n {children || buttonText}\n </Button>\n );\n};\n\nHeroContent.TertiaryText = (props: Partial<TypographyProps>) => {\n const {\n className,\n children,\n tertiaryText,\n color = 'primary',\n variant = 'button',\n sx = [],\n ...rest\n } = deepMerge(useHeroContext(), props);\n\n const content = children || tertiaryText;\n if (!content) return null;\n return (\n <Typography\n color={color}\n variant={variant}\n className={classNames(className, 'nbb-hero-hero-content-tertiary-text', 'nbb-hero-tertiary-text')}\n sx={[\n (theme) => ({\n lineHeight: theme.typography.body1.lineHeight,\n fontWeight: theme.typography.h1.fontWeight,\n }),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ]}\n {...rest}\n >\n {content}\n </Typography>\n );\n};\n\nconst defaultBlocks = createDefaultBlocks({\n heroContent: Hero.HeroContent,\n heroImg: Hero.HeroImg,\n heroByline: HeroContent.HeroByline,\n secondaryText: HeroContent.SecondaryText,\n actionButton: HeroContent.ActionButton,\n tertiaryText: HeroContent.TertiaryText,\n});\n"],"names":["createContext","_jsx","useContext","createElement","Stack","Fragment","Box","_jsxs","_Fragment","Typography","Button"],"mappings":";;;;;;;;;;;;AAWA,MAAM,WAAW,GAAGA,mBAAa,CAA+B,SAAS,CAAC;AAEnE,MAAM,YAAY,GAAG,CAAC,EAC3B,QAAQ,EACR,GAAG,KAAK,EAGT,KAAI;IACH,OAAOC,cAAA,CAAC,WAAW,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAwB;AAC9E,CAAC;AAEM,MAAM,cAAc,GAAG,MAAK;AACjC,IAAA,MAAM,OAAO,GAAGC,gBAAU,CAA+B,WAAW,CAAC;IAErE,IAAI,CAAC,OAAO,EAAE;AACZ,QAAA,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC;IACtE;AACA,IAAA,OAAO,OAAO;AAChB,CAAC;;ACQD;;;;;;;;;;;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,CA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B,QACET,cAAA,CAACQ,mBAAU,EAAA,EACT,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,qCAAqC,EAAE,wBAAwB,CAAC,EACjG,EAAE,EAAE;AACF,YAAA,CAAC,KAAK,MAAM;AACV,gBAAA,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU;AAC7C,gBAAA,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU;aAC3C,CAAC;YACF,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;AAC7C,SAAA,EAAA,GACG,IAAI,EAAA,QAAA,EAEP,OAAO,EAAA,CACG;AAEjB,CAAC;AAED,MAAM,aAAa,GAAG,mBAAmB,CAAC;IACxC,WAAW,EAAE,IAAI,CAAC,WAAW;IAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;IACrB,UAAU,EAAE,WAAW,CAAC,UAAU;IAClC,aAAa,EAAE,WAAW,CAAC,aAAa;IACxC,YAAY,EAAE,WAAW,CAAC,YAAY;IACtC,YAAY,EAAE,WAAW,CAAC,YAAY;AACvC,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/Hero.tsx"],"sourcesContent":["import { createContext, ReactNode, useContext } from 'react';\n\ntype HeroContextValue = {\n buttonText: string;\n byline: ReactNode;\n onClickButton: () => void;\n imageUrl: string;\n secondaryText?: ReactNode;\n tertiaryText?: ReactNode;\n};\n\nconst HeroContext = createContext<HeroContextValue | undefined>(undefined);\n\nexport const HeroProvider = ({\n children,\n ...value\n}: HeroContextValue & {\n children: ReactNode;\n}) => {\n return <HeroContext.Provider value={value}>{children}</HeroContext.Provider>;\n};\n\nexport const useHeroContext = () => {\n const context = useContext<HeroContextValue | undefined>(HeroContext);\n\n if (!context) {\n throw new Error('useHeroContext must be used within a HeroProvider');\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 { ComponentProps, Fragment, ReactNode } from 'react';\nimport { HeroProvider, useHeroContext } from './context';\nimport { BlocksOverride, BlocksOverrideComponent, classNames, createDefaultBlocks, deepMerge } from './lib';\nimport { Box, Button, Stack, Typography, StackProps, ButtonProps, BoxProps, TypographyProps } from '@mui/material';\n\nexport const Hero = <CustomBlocks extends Record<string, ReactNode> = {}>({\n onClickButton,\n buttonText,\n imageUrl,\n secondaryText,\n tertiaryText,\n byline,\n className,\n children,\n ...props\n}: Omit<StackProps, 'children'> & {\n /** */\n buttonText: string;\n /**\n * Configures the main byline text to display for this component.\n * Supports components to handle inline images and text colors\n */\n byline: ReactNode;\n /** href for linking Hero */\n onClickButton: () => void;\n /** URL of the image to show in this hero image component */\n imageUrl: string;\n /** Show/hide secondary text */\n secondaryText?: ReactNode;\n /** Show/hide tertiary text */\n tertiaryText?: ReactNode;\n children?: BlocksOverride<typeof defaultBlocks, CustomBlocks>;\n}) => {\n return (\n <Stack className={classNames('nbb-hero-block', className)} {...props}>\n <HeroProvider\n {...{\n onClickButton,\n buttonText,\n imageUrl,\n secondaryText,\n tertiaryText,\n byline,\n }}\n >\n <BlocksOverrideComponent\n defaultBlocks={defaultBlocks}\n defaultBlockOrder={Object.keys(defaultBlocks) as (keyof typeof defaultBlocks)[]}\n blocksOverride={children}\n >\n {({ blocks: { heroByline, secondaryText, actionButton, tertiaryText, ...blocks }, blockOrder }) =>\n blockOrder\n .filter((key) => key in blocks)\n .map<ReactNode>((key) => <Fragment key={String(key)}>{blocks[key]}</Fragment>)\n }\n </BlocksOverrideComponent>\n </HeroProvider>\n </Stack>\n );\n};\n\nHero.HeroImg = (props: Partial<BoxProps<'img'>>) => {\n const {\n component = 'img',\n className,\n imageUrl,\n src,\n alt = 'hero image',\n ...rest\n } = deepMerge(useHeroContext(), props);\n\n return (\n <Box\n component={component}\n src={src || imageUrl}\n alt={alt}\n className={classNames('nbb-hero-hero-img', 'nbb-hero-img', className)}\n {...rest}\n />\n );\n};\n\nconst HeroContent = ({ className, children, spacing = 3, sx, ...rest }: Partial<StackProps>) => {\n return (\n <Stack\n spacing={spacing}\n sx={{ alignItems: 'center', py: 5.5, ...(Array.isArray(sx) ? sx : [sx]) }}\n className={classNames('nbb-hero-hero-content', 'nbb-hero-content', className)}\n {...rest}\n >\n {children || (\n <>\n <Stack sx={{ alignItems: 'center' }}>\n <HeroContent.HeroByline />\n <HeroContent.SecondaryText />\n </Stack>\n <Stack spacing={Number(spacing) / 2} sx={{ alignItems: 'center' }}>\n <HeroContent.ActionButton />\n <HeroContent.TertiaryText />\n </Stack>\n </>\n )}\n </Stack>\n );\n};\n\nHero.HeroContent = HeroContent;\n\nHeroContent.HeroByline = (props: Partial<TypographyProps>) => {\n const { byline, variant = 'h6', className, children, ...rest } = deepMerge(useHeroContext(), props);\n\n return (\n <Typography\n variant={variant}\n className={classNames(className, 'nbb-hero-hero-content-hero-byline', 'nbb-hero-byline')}\n {...rest}\n >\n {children || byline}\n </Typography>\n );\n};\n\nHeroContent.SecondaryText = (props: Partial<TypographyProps>) => {\n const { className, variant = 'h2', children, secondaryText, sx = [], ...rest } = deepMerge(useHeroContext(), props);\n const content = children || secondaryText;\n if (!content) return null;\n return (\n <Typography\n variant={variant}\n className={classNames(className, 'nbb-hero-hero-content-secondary-text', 'nbb-hero-secondary-text')}\n sx={[\n {\n textAlign: 'center',\n },\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ]}\n {...rest}\n >\n {content}\n </Typography>\n );\n};\n\nHeroContent.ActionButton = (props: Partial<ButtonProps>) => {\n const {\n buttonText,\n className,\n variant = 'contained',\n children,\n onClick,\n sx = [],\n ...rest\n } = deepMerge(useHeroContext(), props);\n\n return (\n <Button\n variant={variant}\n onClick={onClick}\n className={classNames(className, 'nbb-hero-hero-content-action-button', 'nbb-button')}\n sx={[\n {\n fontWeight: 600,\n px: 4,\n py: 1.5,\n },\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ]}\n {...rest}\n >\n {children || buttonText}\n </Button>\n );\n};\n\nHeroContent.TertiaryText = (props: Partial<TypographyProps>) => {\n const {\n className,\n children,\n tertiaryText,\n color = 'primary',\n variant = 'button',\n sx = [],\n ...rest\n } = deepMerge(useHeroContext(), props);\n\n const content = children || tertiaryText;\n if (!content) return null;\n return (\n <Typography\n color={color}\n variant={variant}\n className={classNames(className, 'nbb-hero-hero-content-tertiary-text', 'nbb-hero-tertiary-text')}\n sx={[\n (theme) => ({\n lineHeight: theme.typography.body1.lineHeight,\n fontWeight: theme.typography.h1.fontWeight,\n }),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ]}\n {...rest}\n >\n {content}\n </Typography>\n );\n};\n\nconst defaultBlocks = createDefaultBlocks({\n heroContent: Hero.HeroContent,\n heroImg: Hero.HeroImg,\n heroByline: HeroContent.HeroByline,\n secondaryText: HeroContent.SecondaryText,\n actionButton: HeroContent.ActionButton,\n tertiaryText: HeroContent.TertiaryText,\n});\n"],"names":["_jsx","Fragment","_jsxs","_Fragment"],"mappings":";;;;;;;;;;AAWA,MAAM,WAAW,GAAG,aAAa,CAA+B,SAAS,CAAC;AAEnE,MAAM,YAAY,GAAG,CAAC,EAC3B,QAAQ,EACR,GAAG,KAAK,EAGT,KAAI;IACH,OAAOA,GAAA,CAAC,WAAW,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAwB;AAC9E,CAAC;AAEM,MAAM,cAAc,GAAG,MAAK;AACjC,IAAA,MAAM,OAAO,G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