@nodeblocks/frontend-hero-block 0.1.0 → 0.2.0

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 CHANGED
@@ -1,9 +1,8 @@
1
- import { ComponentProps, ReactNode } from 'react';
2
- import '@basaldev/blocks-frontend-framework/dist/style.css';
3
- import './hero.css';
1
+ import { ReactNode } from 'react';
4
2
  import { BlocksOverride } from './lib';
3
+ import { StackProps, ButtonProps, BoxProps, TypographyProps } from '@mui/material';
5
4
  export declare const Hero: {
6
- <CustomBlocks extends Record<string, ReactNode> = {}>({ onClickButton, buttonText, imageUrl, secondaryText, tertiaryText, byline, className, children, ...props }: Omit<ComponentProps<"div">, "children"> & {
5
+ <CustomBlocks extends Record<string, ReactNode> = {}>({ onClickButton, buttonText, imageUrl, secondaryText, tertiaryText, byline, className, children, ...props }: Omit<StackProps, "children"> & {
7
6
  /** */
8
7
  buttonText: string;
9
8
  /**
@@ -21,24 +20,28 @@ export declare const Hero: {
21
20
  tertiaryText?: ReactNode;
22
21
  children?: BlocksOverride<typeof defaultBlocks, CustomBlocks>;
23
22
  }): import("react/jsx-runtime").JSX.Element;
24
- HeroImg({ src, ...props }: Partial<ComponentProps<"img">>): import("react/jsx-runtime").JSX.Element;
23
+ HeroImg(props: Partial<BoxProps<"img">>): import("react/jsx-runtime").JSX.Element;
25
24
  HeroContent: {
26
- ({ className, ...props }: Partial<ComponentProps<"div">>): import("react/jsx-runtime").JSX.Element;
27
- HeroByline({ className, children, ...props }: Partial<ComponentProps<"h6">>): import("react/jsx-runtime").JSX.Element;
28
- SecondaryText({ className, children, ...props }: Partial<ComponentProps<"h3">>): import("react/jsx-runtime").JSX.Element;
29
- ActionButton({ className, children, onClick, ...props }: Partial<ComponentProps<"button">>): import("react/jsx-runtime").JSX.Element;
30
- TertiaryText({ className, children, ...props }: Partial<ComponentProps<"span">>): import("react/jsx-runtime").JSX.Element;
25
+ ({ className, children, spacing, sx, ...rest }: Partial<StackProps>): import("react/jsx-runtime").JSX.Element;
26
+ HeroByline(props: Partial<TypographyProps>): import("react/jsx-runtime").JSX.Element;
27
+ SecondaryText(props: Partial<TypographyProps>): import("react/jsx-runtime").JSX.Element | null;
28
+ ActionButton(props: Partial<ButtonProps>): import("react/jsx-runtime").JSX.Element;
29
+ TertiaryText(props: Partial<TypographyProps>): import("react/jsx-runtime").JSX.Element | null;
31
30
  };
32
31
  };
33
32
  declare const defaultBlocks: {
34
- heroImg: import("react").ReactElement<Partial<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>>, ({ src, ...props }: Partial<ComponentProps<"img">>) => import("react/jsx-runtime").JSX.Element>;
35
- heroContent: import("react").ReactElement<Partial<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, {
36
- ({ className, ...props }: Partial<ComponentProps<"div">>): import("react/jsx-runtime").JSX.Element;
37
- HeroByline({ className, children, ...props }: Partial<ComponentProps<"h6">>): import("react/jsx-runtime").JSX.Element;
38
- SecondaryText({ className, children, ...props }: Partial<ComponentProps<"h3">>): import("react/jsx-runtime").JSX.Element;
39
- ActionButton({ className, children, onClick, ...props }: Partial<ComponentProps<"button">>): import("react/jsx-runtime").JSX.Element;
40
- TertiaryText({ className, children, ...props }: Partial<ComponentProps<"span">>): import("react/jsx-runtime").JSX.Element;
33
+ heroContent: import("react").ReactElement<Partial<StackProps>, {
34
+ ({ className, children, spacing, sx, ...rest }: Partial<StackProps>): import("react/jsx-runtime").JSX.Element;
35
+ HeroByline(props: Partial<TypographyProps>): import("react/jsx-runtime").JSX.Element;
36
+ SecondaryText(props: Partial<TypographyProps>): import("react/jsx-runtime").JSX.Element | null;
37
+ ActionButton(props: Partial<ButtonProps>): import("react/jsx-runtime").JSX.Element;
38
+ TertiaryText(props: Partial<TypographyProps>): import("react/jsx-runtime").JSX.Element | null;
41
39
  }>;
40
+ heroImg: import("react").ReactElement<Partial<BoxProps<"img">>, (props: Partial<BoxProps<"img">>) => import("react/jsx-runtime").JSX.Element>;
41
+ heroByline: import("react").ReactElement<Partial<TypographyProps>, (props: Partial<TypographyProps>) => import("react/jsx-runtime").JSX.Element>;
42
+ secondaryText: import("react").ReactElement<Partial<TypographyProps>, (props: Partial<TypographyProps>) => import("react/jsx-runtime").JSX.Element | null>;
43
+ actionButton: import("react").ReactElement<Partial<ButtonProps>, (props: Partial<ButtonProps>) => import("react/jsx-runtime").JSX.Element>;
44
+ tertiaryText: import("react").ReactElement<Partial<TypographyProps>, (props: Partial<TypographyProps>) => import("react/jsx-runtime").JSX.Element | null>;
42
45
  };
43
46
  export {};
44
47
  //# sourceMappingURL=Hero.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Hero.d.ts","sourceRoot":"","sources":["../src/Hero.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAY,SAAS,EAAE,MAAM,OAAO,CAAC;AAG5D,OAAO,oDAAoD,CAAC;AAC5D,OAAO,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAA2D,MAAM,OAAO,CAAC;AAEhG,eAAO,MAAM,IAAI;KAAI,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,oHAUhE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;QAC3C,MAAM;QACN,UAAU,EAAE,MAAM,CAAC;QACnB;;;WAGG;QACH,MAAM,EAAE,SAAS,CAAC;QAClB,4BAA4B;QAC5B,aAAa,EAAE,MAAM,IAAI,CAAC;QAC1B,4DAA4D;QAC5D,QAAQ,EAAE,MAAM,CAAC;QACjB,+BAA+B;QAC/B,aAAa,CAAC,EAAE,SAAS,CAAC;QAC1B,8BAA8B;QAC9B,YAAY,CAAC,EAAE,SAAS,CAAC;QACzB,QAAQ,CAAC,EAAE,cAAc,CAAC,OAAO,aAAa,EAAE,YAAY,CAAC,CAAC;KAC/D;+BA6BkC,OAAO,CAAC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AA+B;QAC/B,aAAa,CAAC,EAAE,SAAS,CAAC;QAC1B,8BAA8B;QAC9B,YAAY,CAAC,EAAE,SAAS,CAAC;QACzB,QAAQ,CAAC,EAAE,cAAc,CAAC,OAAO,aAAa,EAAE,YAAY,CAAC,CAAC;KAC/D;mBA6BsB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;;wDAqByB,OAAO,CAAC,UAAU,CAAC;0BA0B1D,OAAO,CAAC,eAAe,CAAC;6BAcrB,OAAO,CAAC,eAAe,CAAC;4BAqBzB,OAAO,CAAC,WAAW,CAAC;4BA+BpB,OAAO,CAAC,eAAe,CAAC;;CAnH1D,CAAC;AAmJF,QAAA,MAAM,aAAa;;wDA5HqD,OAAO,CAAC,UAAU,CAAC;0BA0B1D,OAAO,CAAC,eAAe,CAAC;6BAcrB,OAAO,CAAC,eAAe,CAAC;4BAqBzB,OAAO,CAAC,WAAW,CAAC;4BA+BpB,OAAO,CAAC,eAAe,CAAC;;4EAjHpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;+EA+Cd,OAAO,CAAC,eAAe,CAAC;kFAcrB,OAAO,CAAC,eAAe,CAAC;6EAqBzB,OAAO,CAAC,WAAW,CAAC;iFA+BpB,OAAO,CAAC,eAAe,CAAC;CAuCzD,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -8,16 +8,7 @@
8
8
 
9
9
  var jsxRuntime = require('react/jsx-runtime');
10
10
  var react = require('react');
11
- require('@basaldev/blocks-frontend-framework/dist/style.css');
12
-
13
- /**
14
- * Utility function to join class names together, ignoring undefined or nil values.
15
- * @param classes - The class names to join.
16
- * @returns The joined class names.
17
- */
18
- function classNames(...classes) {
19
- return classes.flat().filter(Boolean).join(' ');
20
- }
11
+ var material = require('@mui/material');
21
12
 
22
13
  const HeroContext = react.createContext(undefined);
23
14
  const HeroProvider = ({ children, ...value }) => {
@@ -31,36 +22,6 @@ const useHeroContext = () => {
31
22
  return context;
32
23
  };
33
24
 
34
- function styleInject(css, ref) {
35
- if ( ref === void 0 ) ref = {};
36
- var insertAt = ref.insertAt;
37
-
38
- if (typeof document === 'undefined') { return; }
39
-
40
- var head = document.head || document.getElementsByTagName('head')[0];
41
- var style = document.createElement('style');
42
- style.type = 'text/css';
43
-
44
- if (insertAt === 'top') {
45
- if (head.firstChild) {
46
- head.insertBefore(style, head.firstChild);
47
- } else {
48
- head.appendChild(style);
49
- }
50
- } else {
51
- head.appendChild(style);
52
- }
53
-
54
- if (style.styleSheet) {
55
- style.styleSheet.cssText = css;
56
- } else {
57
- style.appendChild(document.createTextNode(css));
58
- }
59
- }
60
-
61
- var css_248z = ".nbb-hero-block {\n display: flex;\n flex-direction: row-reverse;\n text-align: center;\n justify-content: center;\n flex-wrap: wrap;\n row-gap: 40px;\n font-family: var(--font-family);\n}\n\n.nbb-hero-content {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n gap: 1em;\n min-width: 400px;\n}\n\n.nbb-hero-tertiary-text {\n font-size: 30px;\n margin-block: 10px;\n}\n\n.nbb-hero-byline {\n font-size: 16px;\n margin-block: 10px;\n}\n\n.nbb-button {\n align-items: center;\n border-radius: var(--border-radius-3);\n border: 1px solid transparent;\n cursor: pointer;\n display: inline-flex;\n font-family: var(--font-family);\n gap: var(--spacing-5xs);\n transition:\n background-color 300ms,\n border-color 300ms,\n color 300ms;\n white-space: nowrap;\n padding: 13px 24px;\n color: var(--color-text-on-primary);\n background-color: var(--color-object-accent-primary);\n}\n";
62
- styleInject(css_248z);
63
-
64
25
  /**
65
26
  * Creates a strongly typed `defaultBlocks` object, allowing for types to propagate into block override objects.
66
27
  *
@@ -134,44 +95,80 @@ function deepMerge(obj1, obj2) {
134
95
  }
135
96
  return result;
136
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
+ }
137
106
 
138
107
  const Hero = ({ onClickButton, buttonText, imageUrl, secondaryText, tertiaryText, byline, className, children, ...props }) => {
139
- return (jsxRuntime.jsx("div", { className: classNames('nbb-hero-block', className), ...props, children: jsxRuntime.jsx(HeroProvider, { onClickButton,
108
+ return (jsxRuntime.jsx(material.Stack, { className: classNames('nbb-hero-block', className), ...props, children: jsxRuntime.jsx(HeroProvider, { onClickButton,
140
109
  buttonText,
141
110
  imageUrl,
142
111
  secondaryText,
143
112
  tertiaryText,
144
- byline, children: jsxRuntime.jsx(BlocksOverrideComponent, { defaultBlocks: defaultBlocks, defaultBlockOrder: Object.keys(defaultBlocks), blocksOverride: children, children: ({ blocks: { item, ...blocks }, blockOrder }) => blockOrder
113
+ byline, children: jsxRuntime.jsx(BlocksOverrideComponent, { defaultBlocks: defaultBlocks, defaultBlockOrder: Object.keys(defaultBlocks), blocksOverride: children, children: ({ blocks: { heroByline, secondaryText, actionButton, tertiaryText, ...blocks }, blockOrder }) => blockOrder
145
114
  .filter((key) => key in blocks)
146
115
  .map((key) => jsxRuntime.jsx(react.Fragment, { children: blocks[key] }, String(key))) }) }) }));
147
116
  };
148
- Hero.HeroImg = ({ src, ...props }) => {
149
- const { className, imageUrl } = deepMerge(useHeroContext(), props);
150
- return jsxRuntime.jsx("img", { className: classNames('nbb-hero-img', className), src: src || imageUrl, alt: "hero image", ...props });
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 }));
151
120
  };
152
- const HeroContent = ({ className, ...props }) => {
153
- return (jsxRuntime.jsxs("div", { className: classNames('nbb-hero-content', className), ...props, children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(HeroContent.HeroByline, {}), jsxRuntime.jsx(HeroContent.SecondaryText, {})] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(HeroContent.ActionButton, {}), jsxRuntime.jsx(HeroContent.TertiaryText, {})] })] }));
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, {})] })] })) }));
154
123
  };
155
124
  Hero.HeroContent = HeroContent;
156
- HeroContent.HeroByline = ({ className, children, ...props }) => {
157
- const { byline } = deepMerge(useHeroContext(), props);
158
- return (jsxRuntime.jsx("h6", { className: classNames(className, 'nbb-hero-byline'), ...props, children: children || byline }));
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 }));
159
128
  };
160
- HeroContent.SecondaryText = ({ className, children, ...props }) => {
161
- const { secondaryText } = deepMerge(useHeroContext(), props);
162
- return (jsxRuntime.jsx("h3", { className: classNames(className, 'nbb-hero-tertiary-text'), ...props, children: children || secondaryText }));
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 }));
163
140
  };
164
- HeroContent.ActionButton = ({ className, children, onClick, ...props }) => {
165
- const { buttonText, onClickButton } = deepMerge(useHeroContext(), props);
166
- return (jsxRuntime.jsx("button", { type: "button", onClick: onClick || onClickButton, className: classNames(className, 'nbb-button'), ...props, children: children || buttonText }));
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 }));
167
151
  };
168
- HeroContent.TertiaryText = ({ className, children, ...props }) => {
169
- const { tertiaryText } = deepMerge(useHeroContext(), props);
170
- return (jsxRuntime.jsx("span", { className: classNames(className, 'nbb-hero-tertiary-text'), ...props, children: children || tertiaryText }));
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 }));
171
164
  };
172
165
  const defaultBlocks = createDefaultBlocks({
173
- heroImg: Hero.HeroImg,
174
166
  heroContent: Hero.HeroContent,
167
+ heroImg: Hero.HeroImg,
168
+ heroByline: HeroContent.HeroByline,
169
+ secondaryText: HeroContent.SecondaryText,
170
+ actionButton: HeroContent.ActionButton,
171
+ tertiaryText: HeroContent.TertiaryText,
175
172
  });
176
173
 
177
174
  exports.Hero = Hero;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/className.tsx","../src/context.tsx","../node_modules/style-inject/dist/style-inject.es.js","../src/lib.ts","../src/Hero.tsx"],"sourcesContent":["type 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 { 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","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\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 { classNames } from './className';\nimport { HeroProvider, useHeroContext } from './context';\nimport '@basaldev/blocks-frontend-framework/dist/style.css';\nimport './hero.css';\nimport { BlocksOverride, BlocksOverrideComponent, createDefaultBlocks, deepMerge } from './lib';\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<ComponentProps<'div'>, '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 <div 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: { item, ...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 </div>\n );\n};\n\nHero.HeroImg = ({ src, ...props }: Partial<ComponentProps<'img'>>) => {\n const { className, imageUrl } = deepMerge(useHeroContext(), props);\n\n return <img className={classNames('nbb-hero-img', className)} src={src || imageUrl} alt=\"hero image\" {...props} />;\n};\n\nconst HeroContent = ({ className, ...props }: Partial<ComponentProps<'div'>>) => {\n return (\n <div className={classNames('nbb-hero-content', className)} {...props}>\n <div>\n <HeroContent.HeroByline />\n <HeroContent.SecondaryText />\n </div>\n <div>\n <HeroContent.ActionButton />\n <HeroContent.TertiaryText />\n </div>\n </div>\n );\n};\n\nHero.HeroContent = HeroContent;\n\nHeroContent.HeroByline = ({ className, children, ...props }: Partial<ComponentProps<'h6'>>) => {\n const { byline } = deepMerge(useHeroContext(), props);\n\n return (\n <h6 className={classNames(className, 'nbb-hero-byline')} {...props}>\n {children || byline}\n </h6>\n );\n};\n\nHeroContent.SecondaryText = ({ className, children, ...props }: Partial<ComponentProps<'h3'>>) => {\n const { secondaryText } = deepMerge(useHeroContext(), props);\n\n return (\n <h3 className={classNames(className, 'nbb-hero-tertiary-text')} {...props}>\n {children || secondaryText}\n </h3>\n );\n};\n\nHeroContent.ActionButton = ({ className, children, onClick, ...props }: Partial<ComponentProps<'button'>>) => {\n const { buttonText, onClickButton } = deepMerge(useHeroContext(), props);\n\n return (\n <button type=\"button\" onClick={onClick || onClickButton} className={classNames(className, 'nbb-button')} {...props}>\n {children || buttonText}\n </button>\n );\n};\n\nHeroContent.TertiaryText = ({ className, children, ...props }: Partial<ComponentProps<'span'>>) => {\n const { tertiaryText } = deepMerge(useHeroContext(), props);\n\n return (\n <span className={classNames(className, 'nbb-hero-tertiary-text')} {...props}>\n {children || tertiaryText}\n </span>\n );\n};\n\nconst defaultBlocks = createDefaultBlocks({\n heroImg: Hero.HeroImg,\n heroContent: Hero.HeroContent,\n});\n"],"names":["createContext","_jsx","useContext","createElement","Fragment","_jsxs"],"mappings":";;;;;;;;;;;;AAEA;;;;AAIG;AACG,SAAU,UAAU,CAAC,GAAG,OAAoB,EAAA;AAChD,IAAA,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CA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EAAE,EAAE,KAAK,CAAC;AAE3D,IAAA,QACEA,cAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,wBAAwB,CAAC,EAAA,GAAM,KAAK,EAAA,QAAA,EACxE,QAAQ,IAAI,YAAY,EAAA,CACpB;AAEX,CAAC;AAED,MAAM,aAAa,GAAG,mBAAmB,CAAC;IACxC,OAAO,EAAE,IAAI,CAAC,OAAO;IACrB,WAAW,EAAE,IAAI,CAAC,WAAW;AAC9B,CAAA,CAAC;;;;","x_google_ignoreList":[2]}
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,CAAC,CAG/F;AACH;AAEA;;;;;;;;;;;;;;;;;;;;AAo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E,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 CHANGED
@@ -4,18 +4,9 @@
4
4
  var global = window;
5
5
  }
6
6
 
7
- import { jsx, jsxs } from 'react/jsx-runtime';
8
- import { createContext, useContext, createElement, Fragment } from 'react';
9
- import '@basaldev/blocks-frontend-framework/dist/style.css';
10
-
11
- /**
12
- * Utility function to join class names together, ignoring undefined or nil values.
13
- * @param classes - The class names to join.
14
- * @returns The joined class names.
15
- */
16
- function classNames(...classes) {
17
- return classes.flat().filter(Boolean).join(' ');
18
- }
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';
19
10
 
20
11
  const HeroContext = createContext(undefined);
21
12
  const HeroProvider = ({ children, ...value }) => {
@@ -29,36 +20,6 @@ const useHeroContext = () => {
29
20
  return context;
30
21
  };
31
22
 
32
- function styleInject(css, ref) {
33
- if ( ref === void 0 ) ref = {};
34
- var insertAt = ref.insertAt;
35
-
36
- if (typeof document === 'undefined') { return; }
37
-
38
- var head = document.head || document.getElementsByTagName('head')[0];
39
- var style = document.createElement('style');
40
- style.type = 'text/css';
41
-
42
- if (insertAt === 'top') {
43
- if (head.firstChild) {
44
- head.insertBefore(style, head.firstChild);
45
- } else {
46
- head.appendChild(style);
47
- }
48
- } else {
49
- head.appendChild(style);
50
- }
51
-
52
- if (style.styleSheet) {
53
- style.styleSheet.cssText = css;
54
- } else {
55
- style.appendChild(document.createTextNode(css));
56
- }
57
- }
58
-
59
- var css_248z = ".nbb-hero-block {\n display: flex;\n flex-direction: row-reverse;\n text-align: center;\n justify-content: center;\n flex-wrap: wrap;\n row-gap: 40px;\n font-family: var(--font-family);\n}\n\n.nbb-hero-content {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n gap: 1em;\n min-width: 400px;\n}\n\n.nbb-hero-tertiary-text {\n font-size: 30px;\n margin-block: 10px;\n}\n\n.nbb-hero-byline {\n font-size: 16px;\n margin-block: 10px;\n}\n\n.nbb-button {\n align-items: center;\n border-radius: var(--border-radius-3);\n border: 1px solid transparent;\n cursor: pointer;\n display: inline-flex;\n font-family: var(--font-family);\n gap: var(--spacing-5xs);\n transition:\n background-color 300ms,\n border-color 300ms,\n color 300ms;\n white-space: nowrap;\n padding: 13px 24px;\n color: var(--color-text-on-primary);\n background-color: var(--color-object-accent-primary);\n}\n";
60
- styleInject(css_248z);
61
-
62
23
  /**
63
24
  * Creates a strongly typed `defaultBlocks` object, allowing for types to propagate into block override objects.
64
25
  *
@@ -132,44 +93,80 @@ function deepMerge(obj1, obj2) {
132
93
  }
133
94
  return result;
134
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
+ }
135
104
 
136
105
  const Hero = ({ onClickButton, buttonText, imageUrl, secondaryText, tertiaryText, byline, className, children, ...props }) => {
137
- return (jsx("div", { className: classNames('nbb-hero-block', className), ...props, children: jsx(HeroProvider, { onClickButton,
106
+ return (jsx(Stack, { className: classNames('nbb-hero-block', className), ...props, children: jsx(HeroProvider, { onClickButton,
138
107
  buttonText,
139
108
  imageUrl,
140
109
  secondaryText,
141
110
  tertiaryText,
142
- byline, children: jsx(BlocksOverrideComponent, { defaultBlocks: defaultBlocks, defaultBlockOrder: Object.keys(defaultBlocks), blocksOverride: children, children: ({ blocks: { item, ...blocks }, blockOrder }) => blockOrder
111
+ byline, children: jsx(BlocksOverrideComponent, { defaultBlocks: defaultBlocks, defaultBlockOrder: Object.keys(defaultBlocks), blocksOverride: children, children: ({ blocks: { heroByline, secondaryText, actionButton, tertiaryText, ...blocks }, blockOrder }) => blockOrder
143
112
  .filter((key) => key in blocks)
144
- .map((key) => jsx(Fragment, { children: blocks[key] }, String(key))) }) }) }));
113
+ .map((key) => jsx(Fragment$1, { children: blocks[key] }, String(key))) }) }) }));
145
114
  };
146
- Hero.HeroImg = ({ src, ...props }) => {
147
- const { className, imageUrl } = deepMerge(useHeroContext(), props);
148
- return jsx("img", { className: classNames('nbb-hero-img', className), src: src || imageUrl, alt: "hero image", ...props });
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 }));
149
118
  };
150
- const HeroContent = ({ className, ...props }) => {
151
- return (jsxs("div", { className: classNames('nbb-hero-content', className), ...props, children: [jsxs("div", { children: [jsx(HeroContent.HeroByline, {}), jsx(HeroContent.SecondaryText, {})] }), jsxs("div", { children: [jsx(HeroContent.ActionButton, {}), jsx(HeroContent.TertiaryText, {})] })] }));
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, {})] })] })) }));
152
121
  };
153
122
  Hero.HeroContent = HeroContent;
154
- HeroContent.HeroByline = ({ className, children, ...props }) => {
155
- const { byline } = deepMerge(useHeroContext(), props);
156
- return (jsx("h6", { className: classNames(className, 'nbb-hero-byline'), ...props, children: children || byline }));
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 }));
157
126
  };
158
- HeroContent.SecondaryText = ({ className, children, ...props }) => {
159
- const { secondaryText } = deepMerge(useHeroContext(), props);
160
- return (jsx("h3", { className: classNames(className, 'nbb-hero-tertiary-text'), ...props, children: children || secondaryText }));
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 }));
161
138
  };
162
- HeroContent.ActionButton = ({ className, children, onClick, ...props }) => {
163
- const { buttonText, onClickButton } = deepMerge(useHeroContext(), props);
164
- return (jsx("button", { type: "button", onClick: onClick || onClickButton, className: classNames(className, 'nbb-button'), ...props, children: children || buttonText }));
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 }));
165
149
  };
166
- HeroContent.TertiaryText = ({ className, children, ...props }) => {
167
- const { tertiaryText } = deepMerge(useHeroContext(), props);
168
- return (jsx("span", { className: classNames(className, 'nbb-hero-tertiary-text'), ...props, children: children || tertiaryText }));
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 }));
169
162
  };
170
163
  const defaultBlocks = createDefaultBlocks({
171
- heroImg: Hero.HeroImg,
172
164
  heroContent: Hero.HeroContent,
165
+ heroImg: Hero.HeroImg,
166
+ heroByline: HeroContent.HeroByline,
167
+ secondaryText: HeroContent.SecondaryText,
168
+ actionButton: HeroContent.ActionButton,
169
+ tertiaryText: HeroContent.TertiaryText,
173
170
  });
174
171
 
175
172
  export { Hero };
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/className.tsx","../src/context.tsx","../node_modules/style-inject/dist/style-inject.es.js","../src/lib.ts","../src/Hero.tsx"],"sourcesContent":["type 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 { 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","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\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 { classNames } from './className';\nimport { HeroProvider, useHeroContext } from './context';\nimport '@basaldev/blocks-frontend-framework/dist/style.css';\nimport './hero.css';\nimport { BlocksOverride, BlocksOverrideComponent, createDefaultBlocks, deepMerge } from './lib';\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<ComponentProps<'div'>, '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 <div 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: { item, ...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 </div>\n );\n};\n\nHero.HeroImg = ({ src, ...props }: Partial<ComponentProps<'img'>>) => {\n const { className, imageUrl } = deepMerge(useHeroContext(), props);\n\n return <img className={classNames('nbb-hero-img', className)} src={src || imageUrl} alt=\"hero image\" {...props} />;\n};\n\nconst HeroContent = ({ className, ...props }: Partial<ComponentProps<'div'>>) => {\n return (\n <div className={classNames('nbb-hero-content', className)} {...props}>\n <div>\n <HeroContent.HeroByline />\n <HeroContent.SecondaryText />\n </div>\n <div>\n <HeroContent.ActionButton />\n <HeroContent.TertiaryText />\n </div>\n </div>\n );\n};\n\nHero.HeroContent = HeroContent;\n\nHeroContent.HeroByline = ({ className, children, ...props }: Partial<ComponentProps<'h6'>>) => {\n const { byline } = deepMerge(useHeroContext(), props);\n\n return (\n <h6 className={classNames(className, 'nbb-hero-byline')} {...props}>\n {children || byline}\n </h6>\n );\n};\n\nHeroContent.SecondaryText = ({ className, children, ...props }: Partial<ComponentProps<'h3'>>) => {\n const { secondaryText } = deepMerge(useHeroContext(), props);\n\n return (\n <h3 className={classNames(className, 'nbb-hero-tertiary-text')} {...props}>\n {children || secondaryText}\n </h3>\n );\n};\n\nHeroContent.ActionButton = ({ className, children, onClick, ...props }: Partial<ComponentProps<'button'>>) => {\n const { buttonText, onClickButton } = deepMerge(useHeroContext(), props);\n\n return (\n <button type=\"button\" onClick={onClick || onClickButton} className={classNames(className, 'nbb-button')} {...props}>\n {children || buttonText}\n </button>\n );\n};\n\nHeroContent.TertiaryText = ({ className, children, ...props }: Partial<ComponentProps<'span'>>) => {\n const { tertiaryText } = deepMerge(useHeroContext(), props);\n\n return (\n <span className={classNames(className, 'nbb-hero-tertiary-text')} {...props}>\n {children || tertiaryText}\n </span>\n );\n};\n\nconst defaultBlocks = createDefaultBlocks({\n heroImg: Hero.HeroImg,\n heroContent: Hero.HeroContent,\n});\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAEA;;;;AAIG;AACG,SAAU,UAAU,CAAC,GAAG,OAAoB,EAAA;AAChD,IAAA,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AACjD;;ACEA,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,EAA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AAC;IACxC,OAAO,EAAE,IAAI,CAAC,OAAO;IACrB,WAAW,EAAE,IAAI,CAAC,WAAW;AAC9B,CAAA,CAAC;;;;","x_google_ignoreList":[2]}
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,GAAG,UAAU,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,EAAE,aAAa,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,EAAE,iBAAiB;AAC9B,SAAA,CAAC;IACJ;AAEA,IAAA,IAAI,OAAO,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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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodeblocks/frontend-hero-block",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "browser": "dist/index.iife.js",
@@ -11,19 +11,22 @@
11
11
  ],
12
12
  "scripts": {
13
13
  "build": "rollup -c",
14
- "watch": "rollup -c --watch"
14
+ "watch": "rm -rf dist && cross-env NODE_ENV=development rollup -c --watch"
15
15
  },
16
16
  "peerDependencies": {
17
- "react": "^18.3.1",
18
- "react-dom": "^18.3.1"
17
+ "@emotion/react": "^11.14.0",
18
+ "@emotion/styled": "^11.14.1",
19
+ "@mui/material": "^7.3.5",
20
+ "react": ">=18 <20",
21
+ "react-dom": ">=18 <20"
19
22
  },
20
23
  "devDependencies": {
21
24
  "@rollup/plugin-commonjs": "^28.0.6",
22
25
  "@rollup/plugin-json": "^6.1.0",
23
26
  "@rollup/plugin-node-resolve": "^15.3.0",
24
27
  "@rollup/plugin-typescript": "^12.1.1",
25
- "@types/react": "^18.3.12",
26
- "@types/react-dom": "^18.3.1",
28
+ "@types/react": "19.2.7",
29
+ "@types/react-dom": "19.2.3",
27
30
  "rollup": "^4.28.0",
28
31
  "rollup-plugin-peer-deps-external": "^2.2.4",
29
32
  "rollup-plugin-polyfill-node": "^0.13.0",
@@ -1,9 +0,0 @@
1
- type ClassName = string | ClassName[] | undefined | null;
2
- /**
3
- * Utility function to join class names together, ignoring undefined or nil values.
4
- * @param classes - The class names to join.
5
- * @returns The joined class names.
6
- */
7
- export declare function classNames(...classes: ClassName[]): string;
8
- export {};
9
- //# sourceMappingURL=className.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"className.d.ts","sourceRoot":"","sources":["../src/className.tsx"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG,MAAM,GAAG,SAAS,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,OAAO,EAAE,SAAS,EAAE,GAAG,MAAM,CAE1D"}