@nodeblocks/frontend-footer-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/footer.d.ts +8 -7
- package/dist/footer.d.ts.map +1 -1
- package/dist/index.cjs.js +26 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +26 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/lib.d.ts +4 -1
- package/dist/lib.d.ts.map +1 -1
- package/package.json +10 -7
package/dist/footer.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from 'react';
|
|
2
2
|
import './footer.css';
|
|
3
3
|
import { BlocksOverride } from './lib';
|
|
4
|
+
import { Box, Stack } from '@mui/material';
|
|
4
5
|
declare const Footer: {
|
|
5
|
-
<CustomBlocks extends Record<string, ReactNode> = {}>({ logoSrc, content, copyright, className, children, ...props }: Omit<ComponentProps<
|
|
6
|
+
<CustomBlocks extends Record<string, ReactNode> = {}>({ logoSrc, content, copyright, className, children, ...props }: Omit<ComponentProps<typeof Stack>, "content" | "children"> & {
|
|
6
7
|
logoSrc: string;
|
|
7
8
|
copyright: ReactNode;
|
|
8
9
|
content: ReactNode;
|
|
9
10
|
children?: BlocksOverride<typeof defaultBlocks, CustomBlocks>;
|
|
10
11
|
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
Logo(props: Partial<ComponentProps<
|
|
12
|
-
Content(props: Partial<ComponentProps<
|
|
13
|
-
Copyright(props: Partial<ComponentProps<
|
|
12
|
+
Logo(props: Partial<ComponentProps<typeof Box>>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
Content(props: Partial<ComponentProps<typeof Box>>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
Copyright(props: Partial<ComponentProps<typeof Box>>): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
};
|
|
15
16
|
declare const defaultBlocks: {
|
|
16
|
-
logo: import("react").ReactElement<Partial<import("react").DetailedHTMLProps<import("react").
|
|
17
|
-
content: import("react").ReactElement<Partial<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement
|
|
18
|
-
copyright: import("react").ReactElement<Partial<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement
|
|
17
|
+
logo: import("react").ReactElement<Partial<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>>>, (props: Partial<ComponentProps<typeof Box>>) => import("react/jsx-runtime").JSX.Element>;
|
|
18
|
+
content: import("react").ReactElement<Partial<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>>>, (props: Partial<ComponentProps<typeof Box>>) => import("react/jsx-runtime").JSX.Element>;
|
|
19
|
+
copyright: import("react").ReactElement<Partial<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>>>, (props: Partial<ComponentProps<typeof Box>>) => import("react/jsx-runtime").JSX.Element>;
|
|
19
20
|
};
|
|
20
21
|
export default Footer;
|
|
21
22
|
//# sourceMappingURL=footer.d.ts.map
|
package/dist/footer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../src/footer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAY,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAuE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../src/footer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAY,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAuE,MAAM,OAAO,CAAC;AAE5G,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,QAAA,MAAM,MAAM;KAAI,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,uEAO3D,IAAI,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC,GAAG;QAC9D,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,SAAS,CAAC;QACrB,OAAO,EAAE,SAAS,CAAC;QACnB,QAAQ,CAAC,EAAE,cAAc,CAAC,OAAO,aAAa,EAAE,YAAY,CAAC,CAAC;KAC/D;gBAqCqB,OAAO,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC;mBAehC,OAAO,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC;qBAUjC,OAAO,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC;CA3B7D,CAAC;AAqCF,QAAA,MAAM,aAAa;4SAnCG,OAAO,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC;+SAehC,OAAO,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC;iTAUjC,OAAO,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC;CAc5D,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
var react = require('react');
|
|
11
|
+
var material = require('@mui/material');
|
|
11
12
|
|
|
12
13
|
function styleInject(css, ref) {
|
|
13
14
|
if ( ref === void 0 ) ref = {};
|
|
@@ -36,7 +37,7 @@ function styleInject(css, ref) {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
var css_248z = "
|
|
40
|
+
var css_248z = ".nbb-footer img {\n display: block;\n}\n\n.nbb-footer a {\n color: inherit;\n}\n.nbb-footer a:hover {\n text-decoration: underline;\n}\n";
|
|
40
41
|
styleInject(css_248z);
|
|
41
42
|
|
|
42
43
|
/**
|
|
@@ -134,23 +135,40 @@ const useFooterContext = () => {
|
|
|
134
135
|
};
|
|
135
136
|
|
|
136
137
|
const Footer = ({ logoSrc, content, copyright, className, children, ...props }) => {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
const { sx: sxProp, ...restProps } = props;
|
|
139
|
+
const sx = [
|
|
140
|
+
{
|
|
141
|
+
backgroundColor: 'primary.main',
|
|
142
|
+
color: 'primary.contrastText',
|
|
143
|
+
py: 3,
|
|
144
|
+
px: 2,
|
|
145
|
+
typography: 'body2',
|
|
146
|
+
},
|
|
147
|
+
...(Array.isArray(sxProp) ? sxProp : [sxProp]),
|
|
148
|
+
];
|
|
149
|
+
return (jsxRuntime.jsx(material.Stack, { component: "footer", className: classNames('nbb-footer', className), spacing: 2, sx: sx, ...restProps, children: jsxRuntime.jsx(FooterProvider, { logoSrc,
|
|
150
|
+
content,
|
|
151
|
+
copyright, children: jsxRuntime.jsx(BlocksOverrideComponent, { defaultBlocks: defaultBlocks, defaultBlockOrder: Object.keys(defaultBlocks), blocksOverride: children, children: ({ blocks: { ...blocks }, blockOrder }) => blockOrder
|
|
140
152
|
.filter((key) => key in blocks)
|
|
141
153
|
.map((key) => jsxRuntime.jsx(react.Fragment, { children: blocks[key] }, String(key))) }) }) }));
|
|
142
154
|
};
|
|
143
155
|
Footer.Logo = (props) => {
|
|
144
|
-
const { className, logoSrc,
|
|
145
|
-
|
|
156
|
+
const { className, logoSrc, sx: sxProp, ...restProps } = deepMerge(useFooterContext(), props);
|
|
157
|
+
const sx = [
|
|
158
|
+
{
|
|
159
|
+
pb: 0.5,
|
|
160
|
+
},
|
|
161
|
+
...(Array.isArray(sxProp) ? sxProp : [sxProp]),
|
|
162
|
+
];
|
|
163
|
+
return (jsxRuntime.jsx(material.Box, { className: classNames('nbb-footer-logo', className), sx: sx, ...restProps, children: jsxRuntime.jsx("img", { src: logoSrc, alt: 'Footer logo' }) }));
|
|
146
164
|
};
|
|
147
165
|
Footer.Content = (props) => {
|
|
148
166
|
const { className, children, content } = deepMerge(useFooterContext(), props);
|
|
149
|
-
return (jsxRuntime.jsx(
|
|
167
|
+
return (jsxRuntime.jsx(material.Box, { className: classNames('nbb-footer-content', className), ...props, children: content || children }));
|
|
150
168
|
};
|
|
151
169
|
Footer.Copyright = (props) => {
|
|
152
170
|
const { className, children, copyright } = deepMerge(useFooterContext(), props);
|
|
153
|
-
return (jsxRuntime.jsx(
|
|
171
|
+
return (jsxRuntime.jsx(material.Box, { className: classNames('nbb-footer-copyright', className), ...props, children: copyright || children }));
|
|
154
172
|
};
|
|
155
173
|
const defaultBlocks = createDefaultBlocks({
|
|
156
174
|
logo: Footer.Logo,
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/lib.ts","../src/context.tsx","../src/footer.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","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\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 A & B;\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 { createContext, ReactNode, useContext } from 'react';\n\ntype FooterContextValue = {\n logoSrc: string;\n copyright: ReactNode;\n content: ReactNode;\n};\n\nconst FooterContext = createContext<FooterContextValue | undefined>(undefined);\n\nexport const FooterProvider = ({\n children,\n ...value\n}: FooterContextValue & {\n children: ReactNode;\n}) => {\n return <FooterContext.Provider value={value}>{children}</FooterContext.Provider>;\n};\n\nexport const useFooterContext = () => {\n const context = useContext<FooterContextValue | undefined>(FooterContext);\n\n if (!context) {\n throw new Error('useFooterContext must be used within a FooterProvider');\n }\n return context;\n};\n","import { ComponentProps, Fragment, ReactNode } from 'react';\nimport './footer.css';\nimport { BlocksOverride, BlocksOverrideComponent, classNames, createDefaultBlocks, deepMerge } from './lib';\nimport { FooterProvider, useFooterContext } from './context';\n\nconst Footer = <CustomBlocks extends Record<string, ReactNode> = {}>({\n logoSrc,\n content,\n copyright,\n className,\n children,\n ...props\n}: Omit<ComponentProps<'footer'>, 'content'> & {\n logoSrc: string;\n copyright: ReactNode;\n content: ReactNode;\n children?: BlocksOverride<typeof defaultBlocks, CustomBlocks>;\n}) => {\n return (\n <FooterProvider\n {...{\n logoSrc,\n content,\n copyright,\n }}\n >\n <footer className={classNames('nbb-footer', className)} {...props}>\n <BlocksOverrideComponent\n defaultBlocks={defaultBlocks}\n defaultBlockOrder={Object.keys(defaultBlocks) as (keyof typeof defaultBlocks)[]}\n blocksOverride={children}\n >\n {({ blocks: { ...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 </footer>\n </FooterProvider>\n );\n};\n\nFooter.Logo = (props: Partial<ComponentProps<'img'>>) => {\n const { className, logoSrc, src } = deepMerge(useFooterContext(), props);\n\n return (\n <img className={classNames('nbb-footer-logo', className)} src={logoSrc || src} alt={'Footer logo'} {...props} />\n );\n};\n\nFooter.Content = (props: Partial<ComponentProps<'div'>>) => {\n const { className, children, content } = deepMerge(useFooterContext(), props);\n\n return (\n <div className={classNames('nbb-footer-content', className)} {...props}>\n {content || children}\n </div>\n );\n};\n\nFooter.Copyright = (props: Partial<ComponentProps<'div'>>) => {\n const { className, children, copyright } = deepMerge(useFooterContext(), props);\n\n return (\n <div className={classNames('nbb-footer-copyright', className)} {...props}>\n {copyright || children}\n </div>\n );\n};\n\nconst defaultBlocks = createDefaultBlocks({\n logo: Footer.Logo,\n content: Footer.Content,\n copyright: Footer.Copyright,\n});\n\nexport default Footer;\n"],"names":["createElement","createContext","_jsx","useContext","Fragment"],"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,WAAW,CAAC,KAAK,CAAC;AAC3B;;AAEA,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,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,SAAS,EAAE,UAAU,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAAA,GAAM,KAAK,EAAA,QAAA,EACnE,OAAO,IAAI,QAAQ,EAAA,CAChB;AAEV,CAAC;AAED,MAAM,CAAC,SAAS,GAAG,CAAC,KAAqC,KAAI;AAC3D,IAAA,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC,gBAAgB,EAAE,EAAE,KAAK,CAAC;AAE/E,IAAA,QACEA,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,CAAC,sBAAsB,EAAE,SAAS,CAAC,EAAA,GAAM,KAAK,EAAA,QAAA,EACrE,SAAS,IAAI,QAAQ,EAAA,CAClB;AAEV,CAAC;AAED,MAAM,aAAa,GAAG,mBAAmB,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,SAAS,EAAE,MAAM,CAAC,SAAS;AAC5B,CAAA,CAAC;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/lib.ts","../src/context.tsx","../src/footer.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","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 { createContext, ReactNode, useContext } from 'react';\n\ntype FooterContextValue = {\n logoSrc: string;\n copyright: ReactNode;\n content: ReactNode;\n};\n\nconst FooterContext = createContext<FooterContextValue | undefined>(undefined);\n\nexport const FooterProvider = ({\n children,\n ...value\n}: FooterContextValue & {\n children: ReactNode;\n}) => {\n return <FooterContext.Provider value={value}>{children}</FooterContext.Provider>;\n};\n\nexport const useFooterContext = () => {\n const context = useContext<FooterContextValue | undefined>(FooterContext);\n\n if (!context) {\n throw new Error('useFooterContext must be used within a FooterProvider');\n }\n return context;\n};\n","import { ComponentProps, Fragment, ReactNode } from 'react';\nimport './footer.css';\nimport { BlocksOverride, BlocksOverrideComponent, classNames, createDefaultBlocks, deepMerge } from './lib';\nimport { FooterProvider, useFooterContext } from './context';\nimport { Box, Stack } from '@mui/material';\n\nconst Footer = <CustomBlocks extends Record<string, ReactNode> = {}>({\n logoSrc,\n content,\n copyright,\n className,\n children,\n ...props\n}: Omit<ComponentProps<typeof Stack>, 'content' | 'children'> & {\n logoSrc: string;\n copyright: ReactNode;\n content: ReactNode;\n children?: BlocksOverride<typeof defaultBlocks, CustomBlocks>;\n}) => {\n const { sx: sxProp, ...restProps } = props;\n const sx = [\n {\n backgroundColor: 'primary.main',\n color: 'primary.contrastText',\n py: 3,\n px: 2,\n typography: 'body2',\n },\n ...(Array.isArray(sxProp) ? sxProp : [sxProp]),\n ];\n return (\n <Stack component=\"footer\" className={classNames('nbb-footer', className)} spacing={2} sx={sx} {...restProps}>\n <FooterProvider\n {...{\n logoSrc,\n content,\n copyright,\n }}\n >\n <BlocksOverrideComponent\n defaultBlocks={defaultBlocks}\n defaultBlockOrder={Object.keys(defaultBlocks) as (keyof typeof defaultBlocks)[]}\n blocksOverride={children}\n >\n {({ blocks: { ...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 </FooterProvider>\n </Stack>\n );\n};\n\nFooter.Logo = (props: Partial<ComponentProps<typeof Box>>) => {\n const { className, logoSrc, sx: sxProp, ...restProps } = deepMerge(useFooterContext(), props);\n const sx = [\n {\n pb: 0.5,\n },\n ...(Array.isArray(sxProp) ? sxProp : [sxProp]),\n ];\n return (\n <Box className={classNames('nbb-footer-logo', className)} sx={sx} {...restProps}>\n <img src={logoSrc} alt={'Footer logo'} />\n </Box>\n );\n};\n\nFooter.Content = (props: Partial<ComponentProps<typeof Box>>) => {\n const { className, children, content } = deepMerge(useFooterContext(), props);\n\n return (\n <Box className={classNames('nbb-footer-content', className)} {...props}>\n {content || children}\n </Box>\n );\n};\n\nFooter.Copyright = (props: Partial<ComponentProps<typeof Box>>) => {\n const { className, children, copyright } = deepMerge(useFooterContext(), props);\n\n return (\n <Box className={classNames('nbb-footer-copyright', className)} {...props}>\n {copyright || children}\n </Box>\n );\n};\n\nconst defaultBlocks = createDefaultBlocks({\n logo: Footer.Logo,\n content: Footer.Content,\n copyright: Footer.Copyright,\n});\n\nexport default Footer;\n"],"names":["createElement","createContext","_jsx","useContext","Stack","Fragment","Box"],"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,CAAC;;AAEzD,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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BAAoB,EAAE,SAAS,CAAC,EAAA,GAAM,KAAK,EAAA,QAAA,EACnE,OAAO,IAAI,QAAQ,EAAA,CAChB;AAEV,CAAC;AAED,MAAM,CAAC,SAAS,GAAG,CAAC,KAA0C,KAAI;AAChE,IAAA,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC,gBAAgB,EAAE,EAAE,KAAK,CAAC;IAE/E,QACEJ,eAACI,YAAG,EAAA,EAAC,SAAS,EAAE,UAAU,CAAC,sBAAsB,EAAE,SAAS,CAAC,EAAA,GAAM,KAAK,EAAA,QAAA,EACrE,SAAS,IAAI,QAAQ,EAAA,CAClB;AAEV,CAAC;AAED,MAAM,aAAa,GAAG,mBAAmB,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,SAAS,EAAE,MAAM,CAAC,SAAS;AAC5B,CAAA,CAAC;;;;","x_google_ignoreList":[0]}
|
package/dist/index.esm.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
8
8
|
import { createElement, createContext, useContext, Fragment } from 'react';
|
|
9
|
+
import { Stack, Box } from '@mui/material';
|
|
9
10
|
|
|
10
11
|
function styleInject(css, ref) {
|
|
11
12
|
if ( ref === void 0 ) ref = {};
|
|
@@ -34,7 +35,7 @@ function styleInject(css, ref) {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
var css_248z = "
|
|
38
|
+
var css_248z = ".nbb-footer img {\n display: block;\n}\n\n.nbb-footer a {\n color: inherit;\n}\n.nbb-footer a:hover {\n text-decoration: underline;\n}\n";
|
|
38
39
|
styleInject(css_248z);
|
|
39
40
|
|
|
40
41
|
/**
|
|
@@ -132,23 +133,40 @@ const useFooterContext = () => {
|
|
|
132
133
|
};
|
|
133
134
|
|
|
134
135
|
const Footer = ({ logoSrc, content, copyright, className, children, ...props }) => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
const { sx: sxProp, ...restProps } = props;
|
|
137
|
+
const sx = [
|
|
138
|
+
{
|
|
139
|
+
backgroundColor: 'primary.main',
|
|
140
|
+
color: 'primary.contrastText',
|
|
141
|
+
py: 3,
|
|
142
|
+
px: 2,
|
|
143
|
+
typography: 'body2',
|
|
144
|
+
},
|
|
145
|
+
...(Array.isArray(sxProp) ? sxProp : [sxProp]),
|
|
146
|
+
];
|
|
147
|
+
return (jsx(Stack, { component: "footer", className: classNames('nbb-footer', className), spacing: 2, sx: sx, ...restProps, children: jsx(FooterProvider, { logoSrc,
|
|
148
|
+
content,
|
|
149
|
+
copyright, children: jsx(BlocksOverrideComponent, { defaultBlocks: defaultBlocks, defaultBlockOrder: Object.keys(defaultBlocks), blocksOverride: children, children: ({ blocks: { ...blocks }, blockOrder }) => blockOrder
|
|
138
150
|
.filter((key) => key in blocks)
|
|
139
151
|
.map((key) => jsx(Fragment, { children: blocks[key] }, String(key))) }) }) }));
|
|
140
152
|
};
|
|
141
153
|
Footer.Logo = (props) => {
|
|
142
|
-
const { className, logoSrc,
|
|
143
|
-
|
|
154
|
+
const { className, logoSrc, sx: sxProp, ...restProps } = deepMerge(useFooterContext(), props);
|
|
155
|
+
const sx = [
|
|
156
|
+
{
|
|
157
|
+
pb: 0.5,
|
|
158
|
+
},
|
|
159
|
+
...(Array.isArray(sxProp) ? sxProp : [sxProp]),
|
|
160
|
+
];
|
|
161
|
+
return (jsx(Box, { className: classNames('nbb-footer-logo', className), sx: sx, ...restProps, children: jsx("img", { src: logoSrc, alt: 'Footer logo' }) }));
|
|
144
162
|
};
|
|
145
163
|
Footer.Content = (props) => {
|
|
146
164
|
const { className, children, content } = deepMerge(useFooterContext(), props);
|
|
147
|
-
return (jsx(
|
|
165
|
+
return (jsx(Box, { className: classNames('nbb-footer-content', className), ...props, children: content || children }));
|
|
148
166
|
};
|
|
149
167
|
Footer.Copyright = (props) => {
|
|
150
168
|
const { className, children, copyright } = deepMerge(useFooterContext(), props);
|
|
151
|
-
return (jsx(
|
|
169
|
+
return (jsx(Box, { className: classNames('nbb-footer-copyright', className), ...props, children: copyright || children }));
|
|
152
170
|
};
|
|
153
171
|
const defaultBlocks = createDefaultBlocks({
|
|
154
172
|
logo: Footer.Logo,
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/lib.ts","../src/context.tsx","../src/footer.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","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\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 A & B;\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 { createContext, ReactNode, useContext } from 'react';\n\ntype FooterContextValue = {\n logoSrc: string;\n copyright: ReactNode;\n content: ReactNode;\n};\n\nconst FooterContext = createContext<FooterContextValue | undefined>(undefined);\n\nexport const FooterProvider = ({\n children,\n ...value\n}: FooterContextValue & {\n children: ReactNode;\n}) => {\n return <FooterContext.Provider value={value}>{children}</FooterContext.Provider>;\n};\n\nexport const useFooterContext = () => {\n const context = useContext<FooterContextValue | undefined>(FooterContext);\n\n if (!context) {\n throw new Error('useFooterContext must be used within a FooterProvider');\n }\n return context;\n};\n","import { ComponentProps, Fragment, ReactNode } from 'react';\nimport './footer.css';\nimport { BlocksOverride, BlocksOverrideComponent, classNames, createDefaultBlocks, deepMerge } from './lib';\nimport { FooterProvider, useFooterContext } from './context';\n\nconst Footer = <CustomBlocks extends Record<string, ReactNode> = {}>({\n logoSrc,\n content,\n copyright,\n className,\n children,\n ...props\n}: Omit<ComponentProps<'footer'>, 'content'> & {\n logoSrc: string;\n copyright: ReactNode;\n content: ReactNode;\n children?: BlocksOverride<typeof defaultBlocks, CustomBlocks>;\n}) => {\n return (\n <FooterProvider\n {...{\n logoSrc,\n content,\n copyright,\n }}\n >\n <footer className={classNames('nbb-footer', className)} {...props}>\n <BlocksOverrideComponent\n defaultBlocks={defaultBlocks}\n defaultBlockOrder={Object.keys(defaultBlocks) as (keyof typeof defaultBlocks)[]}\n blocksOverride={children}\n >\n {({ blocks: { ...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 </footer>\n </FooterProvider>\n );\n};\n\nFooter.Logo = (props: Partial<ComponentProps<'img'>>) => {\n const { className, logoSrc, src } = deepMerge(useFooterContext(), props);\n\n return (\n <img className={classNames('nbb-footer-logo', className)} src={logoSrc || src} alt={'Footer logo'} {...props} />\n );\n};\n\nFooter.Content = (props: Partial<ComponentProps<'div'>>) => {\n const { className, children, content } = deepMerge(useFooterContext(), props);\n\n return (\n <div className={classNames('nbb-footer-content', className)} {...props}>\n {content || children}\n </div>\n );\n};\n\nFooter.Copyright = (props: Partial<ComponentProps<'div'>>) => {\n const { className, children, copyright } = deepMerge(useFooterContext(), props);\n\n return (\n <div className={classNames('nbb-footer-copyright', className)} {...props}>\n {copyright || children}\n </div>\n );\n};\n\nconst defaultBlocks = createDefaultBlocks({\n logo: Footer.Logo,\n content: Footer.Content,\n copyright: Footer.Copyright,\n});\n\nexport default Footer;\n"],"names":["_jsx"],"mappings":";;;;;;;;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG,EAAE;AAChC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C,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,SAAS,EAAE,MAAM,CAAC,SAAS;AAC5B,CAAA,CAAC;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/lib.ts","../src/context.tsx","../src/footer.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","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 { createContext, ReactNode, useContext } from 'react';\n\ntype FooterContextValue = {\n logoSrc: string;\n copyright: ReactNode;\n content: ReactNode;\n};\n\nconst FooterContext = createContext<FooterContextValue | undefined>(undefined);\n\nexport const FooterProvider = ({\n children,\n ...value\n}: FooterContextValue & {\n children: ReactNode;\n}) => {\n return <FooterContext.Provider value={value}>{children}</FooterContext.Provider>;\n};\n\nexport const useFooterContext = () => {\n const context = useContext<FooterContextValue | undefined>(FooterContext);\n\n if (!context) {\n throw new Error('useFooterContext must be used within a FooterProvider');\n }\n return context;\n};\n","import { ComponentProps, Fragment, ReactNode } from 'react';\nimport './footer.css';\nimport { BlocksOverride, BlocksOverrideComponent, classNames, createDefaultBlocks, deepMerge } from './lib';\nimport { FooterProvider, useFooterContext } from './context';\nimport { Box, Stack } from '@mui/material';\n\nconst Footer = <CustomBlocks extends Record<string, ReactNode> = {}>({\n logoSrc,\n content,\n copyright,\n className,\n children,\n ...props\n}: Omit<ComponentProps<typeof Stack>, 'content' | 'children'> & {\n logoSrc: string;\n copyright: ReactNode;\n content: ReactNode;\n children?: BlocksOverride<typeof defaultBlocks, CustomBlocks>;\n}) => {\n const { sx: sxProp, ...restProps } = props;\n const sx = [\n {\n backgroundColor: 'primary.main',\n color: 'primary.contrastText',\n py: 3,\n px: 2,\n typography: 'body2',\n },\n ...(Array.isArray(sxProp) ? sxProp : [sxProp]),\n ];\n return (\n <Stack component=\"footer\" className={classNames('nbb-footer', className)} spacing={2} sx={sx} {...restProps}>\n <FooterProvider\n {...{\n logoSrc,\n content,\n copyright,\n }}\n >\n <BlocksOverrideComponent\n defaultBlocks={defaultBlocks}\n defaultBlockOrder={Object.keys(defaultBlocks) as (keyof typeof defaultBlocks)[]}\n blocksOverride={children}\n >\n {({ blocks: { ...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 </FooterProvider>\n </Stack>\n );\n};\n\nFooter.Logo = (props: Partial<ComponentProps<typeof Box>>) => {\n const { className, logoSrc, sx: sxProp, ...restProps } = deepMerge(useFooterContext(), props);\n const sx = [\n {\n pb: 0.5,\n },\n ...(Array.isArray(sxProp) ? sxProp : [sxProp]),\n ];\n return (\n <Box className={classNames('nbb-footer-logo', className)} sx={sx} {...restProps}>\n <img src={logoSrc} alt={'Footer logo'} />\n </Box>\n );\n};\n\nFooter.Content = (props: Partial<ComponentProps<typeof Box>>) => {\n const { className, children, content } = deepMerge(useFooterContext(), props);\n\n return (\n <Box className={classNames('nbb-footer-content', className)} {...props}>\n {content || children}\n </Box>\n );\n};\n\nFooter.Copyright = (props: Partial<ComponentProps<typeof Box>>) => {\n const { className, children, copyright } = deepMerge(useFooterContext(), props);\n\n return (\n <Box className={classNames('nbb-footer-copyright', className)} {...props}>\n {copyright || children}\n </Box>\n );\n};\n\nconst defaultBlocks = createDefaultBlocks({\n logo: Footer.Logo,\n content: Footer.Content,\n copyright: Footer.Copyright,\n});\n\nexport default Footer;\n"],"names":["_jsx"],"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,CAAC;;AAEzD,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,IAAI,CAAC,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7B,IAAI;AACJ,EAAE,CAAC,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3B,EAAE;;AAEF,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG;AAClC,EAAE,CAAC,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACnD,EAAE;AACF;;;;;ACYA;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,EAAE,MAAM,CAAC,SAAS;AAC5B,CAAA,CAAC;;;;","x_google_ignoreList":[0]}
|
package/dist/lib.d.ts
CHANGED
|
@@ -72,7 +72,10 @@ export declare function BlocksOverrideComponent<DefaultBlocks extends Record<str
|
|
|
72
72
|
blockOrder: readonly (keyof DefaultBlocks | keyof CustomBlocks)[];
|
|
73
73
|
}) => ReactNode;
|
|
74
74
|
}): ReactNode;
|
|
75
|
-
|
|
75
|
+
type MergeTypes<Object1, Object2> = {
|
|
76
|
+
[K in keyof Object1 | keyof Object2]: K extends keyof Object1 ? Object1[K] : K extends keyof Object2 ? Object2[K] : never;
|
|
77
|
+
};
|
|
78
|
+
export declare function deepMerge<A extends Record<string, any>, B extends Record<string, any>>(obj1: A, obj2: B): MergeTypes<B, A>;
|
|
76
79
|
type ClassName = string | ClassName[] | undefined | null;
|
|
77
80
|
/**
|
|
78
81
|
* Utility function to join class names together, ignoring undefined or nil values.
|
package/dist/lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,iBAAiB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElG;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,cAAc,CAAC,aAAa,EAAE,YAAY,IAClD,CAAC,CAAC,EACA,aAAa,EACb,iBAAiB,GAClB,EAAE;IACD,aAAa,EAAE,aAAa,CAAC;IAC7B,iBAAiB,EAAE,SAAS,CAAC,MAAM,aAAa,CAAC,EAAE,CAAC;CACrD,KAAK;IACJ,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,YAAY,CAAC;IAE9C,UAAU,EAAE,SAAS,CAAC,MAAM,aAAa,CAAC,EAAE,GAAG,SAAS,CAAC,MAAM,YAAY,CAAC,EAAE,CAAC;CAChF,CAAC,GACF,SAAS,CAAC;AAEd;;;;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,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;QACvD,UAAU,EAAE,SAAS,CAAC,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,EAAE,CAAC;KACnE,KAAK,SAAS,CAAC;CACjB,aAmBA;AAED,KAAK,UAAU,CAAC,OAAO,EAAE,OAAO,IAAI;KACjC,CAAC,IAAI,MAAM,OAAO,GAAG,MAAM,OAAO,GAAG,CAAC,SAAS,MAAM,OAAO,GACzD,OAAO,CAAC,CAAC,CAAC,GACV,CAAC,SAAS,MAAM,OAAO,GACrB,OAAO,CAAC,CAAC,CAAC,GACV,KAAK;CACZ,CAAC;AAEF,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,GAmBrF,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAClC;AAED,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodeblocks/frontend-footer-block",
|
|
3
|
-
"version": "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
|
-
"react-dom": "
|
|
17
|
+
"react": ">=18 <20",
|
|
18
|
+
"react-dom": ">=18 <20",
|
|
19
|
+
"@mui/material": "^7.3.4",
|
|
20
|
+
"@emotion/react": "^11.14.0",
|
|
21
|
+
"@emotion/styled": "^11.14.1"
|
|
19
22
|
},
|
|
20
23
|
"devDependencies": {
|
|
21
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
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": "
|
|
26
|
-
"@types/react-dom": "
|
|
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",
|