@nodeblocks/frontend-hero-block 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Hero.d.ts +30 -0
- package/dist/Hero.d.ts.map +1 -0
- package/dist/blocks.d.ts +55 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/className.d.ts +9 -0
- package/dist/className.d.ts.map +1 -0
- package/dist/index.cjs.js +87 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +85 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +34 -0
- package/readme.md +57 -0
package/dist/Hero.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./hero.css";
|
|
3
|
+
import { DefaultBlocks, DefaultSettings } from "./blocks";
|
|
4
|
+
export interface HeroProps {
|
|
5
|
+
/** */
|
|
6
|
+
buttonText: string;
|
|
7
|
+
/**
|
|
8
|
+
* Configures the main byline text to display for this component.
|
|
9
|
+
* Supports components to handle inline images and text colors
|
|
10
|
+
*/
|
|
11
|
+
byline: string | React.ReactNode;
|
|
12
|
+
/** href for linking Hero */
|
|
13
|
+
onClickButton: () => void;
|
|
14
|
+
/** URL of the image to show in this hero image component */
|
|
15
|
+
imageUrl: string;
|
|
16
|
+
/** Screen size to show for this block */
|
|
17
|
+
className: string;
|
|
18
|
+
/** Show/hide secondary text */
|
|
19
|
+
secondaryText?: string | React.ReactNode;
|
|
20
|
+
/** Show/hide tertiary text */
|
|
21
|
+
tertiaryText?: string | React.ReactNode;
|
|
22
|
+
children?: (defaultBlocks: DefaultBlocks, settings?: DefaultSettings) => {
|
|
23
|
+
blocks: {
|
|
24
|
+
[x: string]: any;
|
|
25
|
+
};
|
|
26
|
+
settings?: DefaultSettings;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export declare const Hero: React.FC<HeroProps>;
|
|
30
|
+
//# sourceMappingURL=Hero.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Hero.d.ts","sourceRoot":"","sources":["../src/Hero.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAiB,eAAe,EAAa,MAAM,UAAU,CAAC;AACpF,MAAM,WAAW,SAAS;IACxB,MAAM;IACN,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACjC,4BAA4B;IAC5B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,aAAa,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACzC,8BAA8B;IAC9B,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,aAAa,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,eAAe,KAAK;QACvE,MAAM,EAAE;YAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;SAAE,CAAC;QAC7B,QAAQ,CAAC,EAAE,eAAe,CAAC;KAC9B,CAAC;CACD;AAED,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CA4BpC,CAAC"}
|
package/dist/blocks.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type DefaultBlocks = {
|
|
2
|
+
HeroImg: React.FC<{
|
|
3
|
+
imageUrl: string;
|
|
4
|
+
}>;
|
|
5
|
+
HeroByline: React.FC<{
|
|
6
|
+
byline: string | React.ReactNode;
|
|
7
|
+
}>;
|
|
8
|
+
SecondaryText: React.FC<{
|
|
9
|
+
secondaryText: string | React.ReactNode;
|
|
10
|
+
}>;
|
|
11
|
+
ActionButton: React.FC<{
|
|
12
|
+
onClickButton: () => void;
|
|
13
|
+
buttonText: string;
|
|
14
|
+
}>;
|
|
15
|
+
TertiaryText: React.FC<{
|
|
16
|
+
text: string | React.ReactNode;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
export type DefaultSettings = {};
|
|
20
|
+
export declare function HeroImg({ imageUrl }: {
|
|
21
|
+
imageUrl: string;
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function HeroByline({ byline }: {
|
|
24
|
+
byline: string | React.ReactNode;
|
|
25
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare function SecondaryText({ secondaryText }: {
|
|
27
|
+
secondaryText: string | React.ReactNode;
|
|
28
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare function ActionButton({ onClickButton, buttonText }: {
|
|
30
|
+
onClickButton: () => void;
|
|
31
|
+
buttonText: string;
|
|
32
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare function TertiaryText({ text }: {
|
|
34
|
+
text: string | React.ReactNode;
|
|
35
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare function setBlocks(defaultBlocks: DefaultBlocks, children?: (defaultBlocks: DefaultBlocks, settings?: DefaultSettings) => {
|
|
37
|
+
blocks: {
|
|
38
|
+
[x: string]: any;
|
|
39
|
+
};
|
|
40
|
+
settings?: DefaultSettings;
|
|
41
|
+
}, settings?: DefaultSettings): {
|
|
42
|
+
blocks: {
|
|
43
|
+
[k: string]: any;
|
|
44
|
+
};
|
|
45
|
+
settings: {};
|
|
46
|
+
};
|
|
47
|
+
export declare const defaultSettings: {};
|
|
48
|
+
export declare const defaultBlocks: {
|
|
49
|
+
HeroImg: typeof HeroImg;
|
|
50
|
+
HeroByline: typeof HeroByline;
|
|
51
|
+
SecondaryText: typeof SecondaryText;
|
|
52
|
+
ActionButton: typeof ActionButton;
|
|
53
|
+
TertiaryText: typeof TertiaryText;
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../src/blocks.tsx"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IACxB,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxC,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;IAC3D,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,aAAa,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;IACrE,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,aAAa,EAAE,MAAM,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1E,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;CAC9D,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,EAC7B,CAAA;AAED,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,2CAEvD;AAED,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;CAAE,2CAE1E;AAED,wBAAgB,aAAa,CAAC,EAAE,aAAa,EAAE,EAAE;IAAE,aAAa,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;CAAE,2CAE3F;AAED,wBAAgB,YAAY,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE;IAAE,aAAa,EAAE,MAAM,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,2CAU5G;AACD,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;CAAE,2CAExE;AAEH,wBAAgB,SAAS,CACrB,aAAa,EAAE,aAAa,EAC5B,QAAQ,CAAC,EAAE,CAAC,aAAa,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,eAAe,KAAK;IACrE,MAAM,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC9B,EACD,QAAQ,CAAC,EAAE,eAAe;;;;;EAiB7B;AAGD,eAAO,MAAM,eAAe,IAC3B,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;CAMzB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
function styleInject(css, ref) {
|
|
6
|
+
if ( ref === void 0 ) ref = {};
|
|
7
|
+
var insertAt = ref.insertAt;
|
|
8
|
+
|
|
9
|
+
if (typeof document === 'undefined') { return; }
|
|
10
|
+
|
|
11
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
12
|
+
var style = document.createElement('style');
|
|
13
|
+
style.type = 'text/css';
|
|
14
|
+
|
|
15
|
+
if (insertAt === 'top') {
|
|
16
|
+
if (head.firstChild) {
|
|
17
|
+
head.insertBefore(style, head.firstChild);
|
|
18
|
+
} else {
|
|
19
|
+
head.appendChild(style);
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
head.appendChild(style);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (style.styleSheet) {
|
|
26
|
+
style.styleSheet.cssText = css;
|
|
27
|
+
} else {
|
|
28
|
+
style.appendChild(document.createTextNode(css));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var css_248z = ".nbb-hero-block {\n --color-object-accent-primary: #006EAD;\n --color-object-accent-primary-emphasis: #006EAD;\n display: flex;\n flex-direction: column-reverse;\n text-align: center;\n justify-content: start;\n}\n\n.nbb-hero-block .nbb-button {\n --color-object-accent-primary: #006EAD;\n --color-object-accent-primary-emphasis: #006EAD;\n}\n\n@media (min-width: 680px) {\n .nbb-hero-block {\n display: flex;\n flex-direction: row-reverse;\n position: relative;\n align-items: center;\n }\n .nbb-hero-img {\n width: 50%;\n }\n .nbb-hero-block .text-content {\n left: 146px;\n width: 600px;\n text-align: left;\n margin-left: 32px;\n }\n}";
|
|
33
|
+
styleInject(css_248z);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Utility function to join class names together, ignoring undefined or nil values.
|
|
37
|
+
* @param classes - The class names to join.
|
|
38
|
+
* @returns The joined class names.
|
|
39
|
+
*/
|
|
40
|
+
function classNames(...classes) {
|
|
41
|
+
return classes.flat().filter(Boolean).join(' ');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function HeroImg({ imageUrl }) {
|
|
45
|
+
return jsxRuntime.jsx("img", { className: "nbb-hero-img", src: imageUrl, alt: "hero image" });
|
|
46
|
+
}
|
|
47
|
+
function HeroByline({ byline }) {
|
|
48
|
+
return jsxRuntime.jsx("h6", { children: byline });
|
|
49
|
+
}
|
|
50
|
+
function SecondaryText({ secondaryText }) {
|
|
51
|
+
return jsxRuntime.jsx("h3", { children: secondaryText });
|
|
52
|
+
}
|
|
53
|
+
function ActionButton({ onClickButton, buttonText }) {
|
|
54
|
+
return (jsxRuntime.jsx("button", { type: "button", onClick: onClickButton, className: "nbb-button primary", children: buttonText }));
|
|
55
|
+
}
|
|
56
|
+
function TertiaryText({ text }) {
|
|
57
|
+
return jsxRuntime.jsx("span", { className: "nbb-typography nbb-typography-color-brand nbb-typography-size-s nbb-typography-weight-bold", children: text });
|
|
58
|
+
}
|
|
59
|
+
function setBlocks(defaultBlocks, children, settings) {
|
|
60
|
+
const { blocks: customBlocks = {}, settings: customSettings = {} } = children ? children(defaultBlocks, settings) : { blocks: {}, settings: {} };
|
|
61
|
+
return {
|
|
62
|
+
blocks: Object.fromEntries(Object.entries(defaultBlocks).map(([key, defaultComponent]) => [
|
|
63
|
+
key,
|
|
64
|
+
customBlocks[key] || defaultComponent,
|
|
65
|
+
])),
|
|
66
|
+
settings: {
|
|
67
|
+
...settings,
|
|
68
|
+
...customSettings,
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const defaultBlocks = {
|
|
73
|
+
HeroImg: HeroImg,
|
|
74
|
+
HeroByline: HeroByline,
|
|
75
|
+
SecondaryText: SecondaryText,
|
|
76
|
+
ActionButton: ActionButton,
|
|
77
|
+
TertiaryText: TertiaryText,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const Hero = ({ onClickButton, buttonText, imageUrl, className, secondaryText, tertiaryText, byline, children, }) => {
|
|
81
|
+
const { blocks } = setBlocks(defaultBlocks, children, {});
|
|
82
|
+
const { HeroImg, HeroByline, SecondaryText, ActionButton, TertiaryText } = blocks;
|
|
83
|
+
return (jsxRuntime.jsxs("div", { className: classNames('nbb-hero-block', className), children: [jsxRuntime.jsx(HeroImg, { imageUrl: imageUrl }), jsxRuntime.jsxs("div", { className: "text-content", children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(HeroByline, { byline: byline }), jsxRuntime.jsx(SecondaryText, { secondaryText: secondaryText })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(ActionButton, { onClickButton: onClickButton, buttonText: buttonText }), jsxRuntime.jsx(TertiaryText, { text: tertiaryText })] })] })] }));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
exports.Hero = Hero;
|
|
87
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/className.tsx","../src/blocks.tsx","../src/Hero.tsx"],"sourcesContent":["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","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","export type DefaultBlocks = {\n HeroImg: React.FC<{ imageUrl: string }>;\n HeroByline: React.FC<{ byline: string | React.ReactNode }>;\n SecondaryText: React.FC<{ secondaryText: string | React.ReactNode }>;\n ActionButton: React.FC<{ onClickButton: () => void; buttonText: string }>;\n TertiaryText: React.FC<{ text: string | React.ReactNode }>;\n}\n\nexport type DefaultSettings = {\n}\n\nexport function HeroImg({ imageUrl }: { imageUrl: string }) {\n return <img className=\"nbb-hero-img\" src={imageUrl} alt=\"hero image\" />;\n }\n \n export function HeroByline({ byline }: { byline: string | React.ReactNode }) {\n return <h6>{byline}</h6>;\n }\n \n export function SecondaryText({ secondaryText }: { secondaryText: string | React.ReactNode }) {\n return <h3>{secondaryText}</h3>\n }\n \n export function ActionButton({ onClickButton, buttonText }: { onClickButton: () => void; buttonText: string }) {\n return (\n <button\n type=\"button\"\n onClick={onClickButton}\n className=\"nbb-button primary\"\n >\n {buttonText}\n </button>\n );\n }\n export function TertiaryText({ text }: { text: string | React.ReactNode }) {\n return <span className=\"nbb-typography nbb-typography-color-brand nbb-typography-size-s nbb-typography-weight-bold\">{text}</span>;\n }\n\nexport function setBlocks(\n defaultBlocks: DefaultBlocks,\n children?: (defaultBlocks: DefaultBlocks, settings?: DefaultSettings) => {\n blocks: { [x: string]: any };\n settings?: DefaultSettings;\n },\n settings?: DefaultSettings,\n) {\n const { blocks: customBlocks = {}, settings: customSettings = {} } =\n children ? children(defaultBlocks, settings) : { blocks: {}, settings: {} };\n\n return {\n blocks: Object.fromEntries(\n Object.entries(defaultBlocks).map(([key, defaultComponent]) => [\n key,\n customBlocks[key] || defaultComponent,\n ])\n ),\n settings: {\n ...settings,\n ...customSettings,\n }\n };\n}\n\n\nexport const defaultSettings = {\n}\n\nexport const defaultBlocks = {\n HeroImg: HeroImg,\n HeroByline: HeroByline,\n SecondaryText: SecondaryText,\n ActionButton: ActionButton,\n TertiaryText: TertiaryText,\n}\n","import React from \"react\";\nimport \"./hero.css\";\nimport { classNames } from \"./className\";\nimport { DefaultBlocks, defaultBlocks, DefaultSettings, setBlocks } from \"./blocks\";\nexport interface HeroProps {\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: string | React.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 /** Screen size to show for this block */\n className: string;\n /** Show/hide secondary text */\n secondaryText?: string | React.ReactNode;\n /** Show/hide tertiary text */\n tertiaryText?: string | React.ReactNode;\n children?: (defaultBlocks: DefaultBlocks, settings?: DefaultSettings) => {\n blocks: { [x: string]: any };\n settings?: DefaultSettings;\n},\n}\n\nexport const Hero: React.FC<HeroProps> = ({\n onClickButton,\n buttonText,\n imageUrl,\n className,\n secondaryText,\n tertiaryText,\n byline,\n children,\n}) => {\n const { blocks } = setBlocks(defaultBlocks, children, {});\n const { HeroImg, HeroByline, SecondaryText, ActionButton, TertiaryText} = blocks;\n return (\n \n <div className={classNames('nbb-hero-block', className)}>\n <HeroImg imageUrl={imageUrl} />\n <div className=\"text-content\">\n <div>\n <HeroByline byline={byline} />\n <SecondaryText secondaryText={secondaryText} />\n </div>\n <div>\n <ActionButton onClickButton={onClickButton} buttonText={buttonText} />\n <TertiaryText text={tertiaryText} />\n </div>\n </div>\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG,EAAE;AAChC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ;;AAE7B,EAAE,IAAY,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO;;AAExD,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAC7C,EAAE,KAAK,CAAC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,QAAQ,EAAE,EAAE,CAAC;AACzD,IAAA,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAC,GAAG,MAAM;AAChF,IAAA,QAEEC,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,EACrD,QAAA,EAAA,CAAAD,cAAA,CAAC,OAAO,EAAC,EAAA,QAAQ,EAAE,QAAQ,EAAI,CAAA,EAC/BC,eAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,cAAc,EAAA,QAAA,EAAA,CAC3BA,eACE,CAAA,KAAA,EAAA,EAAA,QAAA,EAAA,CAAAD,cAAA,CAAC,UAAU,EAAA,EAAC,MAAM,EAAE,MAAM,EAAI,CAAA,EAC9BA,cAAC,CAAA,aAAa,EAAC,EAAA,aAAa,EAAE,aAAa,EAAI,CAAA,CAAA,EAAA,CAC3C,EACNC,eAAA,CAAA,KAAA,EAAA,EAAA,QAAA,EAAA,CACED,cAAC,CAAA,YAAY,EAAC,EAAA,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAA,CAAI,EACtEA,cAAA,CAAC,YAAY,EAAC,EAAA,IAAI,EAAE,YAAY,EAAK,CAAA,CAAA,EAAA,CACjC,CACF,EAAA,CAAA,CAAA,EAAA,CACF;AAEV;;;;","x_google_ignoreList":[0]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
function styleInject(css, ref) {
|
|
4
|
+
if ( ref === void 0 ) ref = {};
|
|
5
|
+
var insertAt = ref.insertAt;
|
|
6
|
+
|
|
7
|
+
if (typeof document === 'undefined') { return; }
|
|
8
|
+
|
|
9
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
10
|
+
var style = document.createElement('style');
|
|
11
|
+
style.type = 'text/css';
|
|
12
|
+
|
|
13
|
+
if (insertAt === 'top') {
|
|
14
|
+
if (head.firstChild) {
|
|
15
|
+
head.insertBefore(style, head.firstChild);
|
|
16
|
+
} else {
|
|
17
|
+
head.appendChild(style);
|
|
18
|
+
}
|
|
19
|
+
} else {
|
|
20
|
+
head.appendChild(style);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (style.styleSheet) {
|
|
24
|
+
style.styleSheet.cssText = css;
|
|
25
|
+
} else {
|
|
26
|
+
style.appendChild(document.createTextNode(css));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var css_248z = ".nbb-hero-block {\n --color-object-accent-primary: #006EAD;\n --color-object-accent-primary-emphasis: #006EAD;\n display: flex;\n flex-direction: column-reverse;\n text-align: center;\n justify-content: start;\n}\n\n.nbb-hero-block .nbb-button {\n --color-object-accent-primary: #006EAD;\n --color-object-accent-primary-emphasis: #006EAD;\n}\n\n@media (min-width: 680px) {\n .nbb-hero-block {\n display: flex;\n flex-direction: row-reverse;\n position: relative;\n align-items: center;\n }\n .nbb-hero-img {\n width: 50%;\n }\n .nbb-hero-block .text-content {\n left: 146px;\n width: 600px;\n text-align: left;\n margin-left: 32px;\n }\n}";
|
|
31
|
+
styleInject(css_248z);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Utility function to join class names together, ignoring undefined or nil values.
|
|
35
|
+
* @param classes - The class names to join.
|
|
36
|
+
* @returns The joined class names.
|
|
37
|
+
*/
|
|
38
|
+
function classNames(...classes) {
|
|
39
|
+
return classes.flat().filter(Boolean).join(' ');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function HeroImg({ imageUrl }) {
|
|
43
|
+
return jsx("img", { className: "nbb-hero-img", src: imageUrl, alt: "hero image" });
|
|
44
|
+
}
|
|
45
|
+
function HeroByline({ byline }) {
|
|
46
|
+
return jsx("h6", { children: byline });
|
|
47
|
+
}
|
|
48
|
+
function SecondaryText({ secondaryText }) {
|
|
49
|
+
return jsx("h3", { children: secondaryText });
|
|
50
|
+
}
|
|
51
|
+
function ActionButton({ onClickButton, buttonText }) {
|
|
52
|
+
return (jsx("button", { type: "button", onClick: onClickButton, className: "nbb-button primary", children: buttonText }));
|
|
53
|
+
}
|
|
54
|
+
function TertiaryText({ text }) {
|
|
55
|
+
return jsx("span", { className: "nbb-typography nbb-typography-color-brand nbb-typography-size-s nbb-typography-weight-bold", children: text });
|
|
56
|
+
}
|
|
57
|
+
function setBlocks(defaultBlocks, children, settings) {
|
|
58
|
+
const { blocks: customBlocks = {}, settings: customSettings = {} } = children ? children(defaultBlocks, settings) : { blocks: {}, settings: {} };
|
|
59
|
+
return {
|
|
60
|
+
blocks: Object.fromEntries(Object.entries(defaultBlocks).map(([key, defaultComponent]) => [
|
|
61
|
+
key,
|
|
62
|
+
customBlocks[key] || defaultComponent,
|
|
63
|
+
])),
|
|
64
|
+
settings: {
|
|
65
|
+
...settings,
|
|
66
|
+
...customSettings,
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const defaultBlocks = {
|
|
71
|
+
HeroImg: HeroImg,
|
|
72
|
+
HeroByline: HeroByline,
|
|
73
|
+
SecondaryText: SecondaryText,
|
|
74
|
+
ActionButton: ActionButton,
|
|
75
|
+
TertiaryText: TertiaryText,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const Hero = ({ onClickButton, buttonText, imageUrl, className, secondaryText, tertiaryText, byline, children, }) => {
|
|
79
|
+
const { blocks } = setBlocks(defaultBlocks, children, {});
|
|
80
|
+
const { HeroImg, HeroByline, SecondaryText, ActionButton, TertiaryText } = blocks;
|
|
81
|
+
return (jsxs("div", { className: classNames('nbb-hero-block', className), children: [jsx(HeroImg, { imageUrl: imageUrl }), jsxs("div", { className: "text-content", children: [jsxs("div", { children: [jsx(HeroByline, { byline: byline }), jsx(SecondaryText, { secondaryText: secondaryText })] }), jsxs("div", { children: [jsx(ActionButton, { onClickButton: onClickButton, buttonText: buttonText }), jsx(TertiaryText, { text: tertiaryText })] })] })] }));
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { Hero };
|
|
85
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/className.tsx","../src/blocks.tsx","../src/Hero.tsx"],"sourcesContent":["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","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","export type DefaultBlocks = {\n HeroImg: React.FC<{ imageUrl: string }>;\n HeroByline: React.FC<{ byline: string | React.ReactNode }>;\n SecondaryText: React.FC<{ secondaryText: string | React.ReactNode }>;\n ActionButton: React.FC<{ onClickButton: () => void; buttonText: string }>;\n TertiaryText: React.FC<{ text: string | React.ReactNode }>;\n}\n\nexport type DefaultSettings = {\n}\n\nexport function HeroImg({ imageUrl }: { imageUrl: string }) {\n return <img className=\"nbb-hero-img\" src={imageUrl} alt=\"hero image\" />;\n }\n \n export function HeroByline({ byline }: { byline: string | React.ReactNode }) {\n return <h6>{byline}</h6>;\n }\n \n export function SecondaryText({ secondaryText }: { secondaryText: string | React.ReactNode }) {\n return <h3>{secondaryText}</h3>\n }\n \n export function ActionButton({ onClickButton, buttonText }: { onClickButton: () => void; buttonText: string }) {\n return (\n <button\n type=\"button\"\n onClick={onClickButton}\n className=\"nbb-button primary\"\n >\n {buttonText}\n </button>\n );\n }\n export function TertiaryText({ text }: { text: string | React.ReactNode }) {\n return <span className=\"nbb-typography nbb-typography-color-brand nbb-typography-size-s nbb-typography-weight-bold\">{text}</span>;\n }\n\nexport function setBlocks(\n defaultBlocks: DefaultBlocks,\n children?: (defaultBlocks: DefaultBlocks, settings?: DefaultSettings) => {\n blocks: { [x: string]: any };\n settings?: DefaultSettings;\n },\n settings?: DefaultSettings,\n) {\n const { blocks: customBlocks = {}, settings: customSettings = {} } =\n children ? children(defaultBlocks, settings) : { blocks: {}, settings: {} };\n\n return {\n blocks: Object.fromEntries(\n Object.entries(defaultBlocks).map(([key, defaultComponent]) => [\n key,\n customBlocks[key] || defaultComponent,\n ])\n ),\n settings: {\n ...settings,\n ...customSettings,\n }\n };\n}\n\n\nexport const defaultSettings = {\n}\n\nexport const defaultBlocks = {\n HeroImg: HeroImg,\n HeroByline: HeroByline,\n SecondaryText: SecondaryText,\n ActionButton: ActionButton,\n TertiaryText: TertiaryText,\n}\n","import React from \"react\";\nimport \"./hero.css\";\nimport { classNames } from \"./className\";\nimport { DefaultBlocks, defaultBlocks, DefaultSettings, setBlocks } from \"./blocks\";\nexport interface HeroProps {\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: string | React.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 /** Screen size to show for this block */\n className: string;\n /** Show/hide secondary text */\n secondaryText?: string | React.ReactNode;\n /** Show/hide tertiary text */\n tertiaryText?: string | React.ReactNode;\n children?: (defaultBlocks: DefaultBlocks, settings?: DefaultSettings) => {\n blocks: { [x: string]: any };\n settings?: DefaultSettings;\n},\n}\n\nexport const Hero: React.FC<HeroProps> = ({\n onClickButton,\n buttonText,\n imageUrl,\n className,\n secondaryText,\n tertiaryText,\n byline,\n children,\n}) => {\n const { blocks } = setBlocks(defaultBlocks, children, {});\n const { HeroImg, HeroByline, SecondaryText, ActionButton, TertiaryText} = blocks;\n return (\n \n <div className={classNames('nbb-hero-block', className)}>\n <HeroImg imageUrl={imageUrl} />\n <div className=\"text-content\">\n <div>\n <HeroByline byline={byline} />\n <SecondaryText secondaryText={secondaryText} />\n </div>\n <div>\n <ActionButton onClickButton={onClickButton} buttonText={buttonText} />\n <TertiaryText text={tertiaryText} />\n </div>\n </div>\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG,EAAE;AAChC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ;;AAE7B,EAAE,IAAY,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO;;AAExD,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAC7C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU;;AAEzB,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;AAC/C,KAAK,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7B;AACA,GAAG,MAAM;AACT,IAAI,IAAI,CAAC,WA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,EAAI,CAAA,EAC/BC,IAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,cAAc,EAAA,QAAA,EAAA,CAC3BA,IACE,CAAA,KAAA,EAAA,EAAA,QAAA,EAAA,CAAAD,GAAA,CAAC,UAAU,EAAA,EAAC,MAAM,EAAE,MAAM,EAAI,CAAA,EAC9BA,GAAC,CAAA,aAAa,EAAC,EAAA,aAAa,EAAE,aAAa,EAAI,CAAA,CAAA,EAAA,CAC3C,EACNC,IAAA,CAAA,KAAA,EAAA,EAAA,QAAA,EAAA,CACED,GAAC,CAAA,YAAY,EAAC,EAAA,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAA,CAAI,EACtEA,GAAA,CAAC,YAAY,EAAC,EAAA,IAAI,EAAE,YAAY,EAAK,CAAA,CAAA,EAAA,CACjC,CACF,EAAA,CAAA,CAAA,EAAA,CACF;AAEV;;;;","x_google_ignoreList":[0]}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nodeblocks/frontend-hero-block",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"main": "dist/index.cjs.js",
|
|
5
|
+
"module": "dist/index.esm.js",
|
|
6
|
+
"browser": "dist/index.iife.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/",
|
|
10
|
+
"dist/index.css"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "rollup -c",
|
|
14
|
+
"watch": "rollup -c --watch"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"react": "^18.3.1",
|
|
18
|
+
"react-dom": "^18.0.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
|
22
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
23
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
24
|
+
"@rollup/plugin-typescript": "^12.1.1",
|
|
25
|
+
"@types/react": "^18.3.12",
|
|
26
|
+
"@types/react-dom": "^18.3.1",
|
|
27
|
+
"rollup": "^4.28.0",
|
|
28
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
29
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
30
|
+
"rollup-plugin-serve": "^1.1.1",
|
|
31
|
+
"tslib": "^2.8.1",
|
|
32
|
+
"typescript": "^5.7.2"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
## ๐ Nodeblocks Frontend Starter Kit
|
|
2
|
+
|
|
3
|
+
Welcome to the Nodeblocks Frontend Starter Kit! ๐ This kit is designed to make building frontend libraries in React super easy, helping you streamline your development workflow with minimal fuss. Let's dive in! ๐คฟ
|
|
4
|
+
|
|
5
|
+
### โจ Features
|
|
6
|
+
- **๐ Bundling with Rollup:** Get a clean, minimalistic approach to bundling your JavaScript files for smoother frontend development.
|
|
7
|
+
- **๐ TypeScript Support:** We've included a pre-configured `tsconfig.json` to ensure your TypeScript setup is strict, efficient, and ready to go.
|
|
8
|
+
- **โ๏ธ Peer Dependencies:** Keep bundle sizes lean with React and React DOM set as peer dependencies.
|
|
9
|
+
- **๐จ CSS Support:** Easily import and process CSS files, giving you more control over your styles.
|
|
10
|
+
|
|
11
|
+
### ๐ ๏ธ How to Use
|
|
12
|
+
1. **Clone this repository** ๐:
|
|
13
|
+
```bash
|
|
14
|
+
git clone <repository-url>
|
|
15
|
+
cd <repository-directory>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
2. **Install dependencies** ๐ฆ:
|
|
19
|
+
```bash
|
|
20
|
+
npm install
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
3. **Start development** ๐ ๏ธ:
|
|
24
|
+
```bash
|
|
25
|
+
npm run watch
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
4. **Build for production** ๐๏ธ:
|
|
29
|
+
```bash
|
|
30
|
+
npm run build
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### ๐งช How to Test
|
|
34
|
+
|
|
35
|
+
The `test` folder contains examples that demonstrate how to use the libraries you create with this starter kit. These examples show compatibility with various bundlers, such as:
|
|
36
|
+
|
|
37
|
+
- **Create React App** (Webpack)
|
|
38
|
+
- **Vite** โก
|
|
39
|
+
- **Rollup** (itself) (Coming soon) ๐
|
|
40
|
+
- **Parcel** (Coming soon) ๐ฆ
|
|
41
|
+
|
|
42
|
+
This ensures Nodeblocks libraries integrate seamlessly with different workflows. ๐ ๏ธโจ
|
|
43
|
+
|
|
44
|
+
**Before running each project make sure you run `npm link`:**
|
|
45
|
+
|
|
46
|
+
1. In the root of this project:
|
|
47
|
+
```bash
|
|
48
|
+
npm link
|
|
49
|
+
```
|
|
50
|
+
2. In the test project you want to run:
|
|
51
|
+
```bash
|
|
52
|
+
npm i
|
|
53
|
+
npm link @basaldev/frontend-starter-kit
|
|
54
|
+
```
|
|
55
|
+
(Note that in real life your library would not be called frontend-starter-kit.)
|
|
56
|
+
|
|
57
|
+
3. Then you can follow your usual workflow either with **Create React App** (`npm start`) or with Vite (`npm run dev`). This will give you a development environment where whenever you change your library it will be available in your test project.
|