@nodeblocks/frontend-how-to-use-block 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/HowToUse.d.ts +20 -0
- package/dist/HowToUse.d.ts.map +1 -0
- package/dist/blocks.d.ts +61 -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 +91 -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 +89 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +34 -0
- package/readme.md +57 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './how-to-use.css';
|
|
3
|
+
import { CardProps, DefaultBlocks, DefaultSettings } from './blocks';
|
|
4
|
+
type HowToUseProps = {
|
|
5
|
+
className: string;
|
|
6
|
+
title: string;
|
|
7
|
+
subtitle: string;
|
|
8
|
+
linkHref?: string;
|
|
9
|
+
linkText?: string;
|
|
10
|
+
list: CardProps[];
|
|
11
|
+
children?: (defaultBlocks: DefaultBlocks, settings?: DefaultSettings) => {
|
|
12
|
+
blocks: {
|
|
13
|
+
[x: string]: any;
|
|
14
|
+
};
|
|
15
|
+
settings?: DefaultSettings;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare const HowToUse: React.FC<HowToUseProps>;
|
|
19
|
+
export default HowToUse;
|
|
20
|
+
//# sourceMappingURL=HowToUse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HowToUse.d.ts","sourceRoot":"","sources":["../src/HowToUse.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAA6C,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGhH,KAAK,aAAa,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,EAAE,CAAC;IACpB,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;KAC5B,CAAC;CACD,CAAC;AAGF,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAyC5C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/dist/blocks.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type DefaultBlocks = {
|
|
2
|
+
HowToUseHeader: React.FC<{
|
|
3
|
+
title: string;
|
|
4
|
+
subtitle: string;
|
|
5
|
+
}>;
|
|
6
|
+
HowToUseCard: React.FC<CardProps>;
|
|
7
|
+
HowToUseBottomLink: React.FC<{
|
|
8
|
+
href: string;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}>;
|
|
11
|
+
HowToUseArrowIcon: React.FC;
|
|
12
|
+
HowToUseCardList: React.FC<{
|
|
13
|
+
list: CardProps[];
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
16
|
+
export type DefaultSettings = {
|
|
17
|
+
showArrows: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type CardProps = {
|
|
20
|
+
title: string;
|
|
21
|
+
description: string;
|
|
22
|
+
icon: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function setBlocks(defaultBlocks: DefaultBlocks, children?: (defaultBlocks: DefaultBlocks, settings?: DefaultSettings) => {
|
|
25
|
+
blocks: {
|
|
26
|
+
[x: string]: any;
|
|
27
|
+
};
|
|
28
|
+
settings?: DefaultSettings;
|
|
29
|
+
}, settings?: DefaultSettings): {
|
|
30
|
+
blocks: {
|
|
31
|
+
[k: string]: any;
|
|
32
|
+
};
|
|
33
|
+
settings: {
|
|
34
|
+
showArrows?: boolean | undefined;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export declare function BottomLink({ href, children }: {
|
|
38
|
+
href: string;
|
|
39
|
+
children: React.ReactNode;
|
|
40
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare function ArrowIcon(): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function CardList({ list, Component, IconComponent, showArrows }: {
|
|
43
|
+
list: CardProps[];
|
|
44
|
+
Component?: React.FC<CardProps>;
|
|
45
|
+
IconComponent?: React.FC;
|
|
46
|
+
showArrows?: boolean;
|
|
47
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export declare const defaultSettings: {
|
|
49
|
+
showArrows: boolean;
|
|
50
|
+
};
|
|
51
|
+
export declare const defaultBlocks: {
|
|
52
|
+
HowToUseHeader: ({ title, subtitle }: {
|
|
53
|
+
title: string;
|
|
54
|
+
subtitle: string;
|
|
55
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
HowToUseCard: ({ title, description, icon }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
HowToUseBottomLink: typeof BottomLink;
|
|
58
|
+
HowToUseArrowIcon: typeof ArrowIcon;
|
|
59
|
+
HowToUseCardList: typeof CardList;
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../src/blocks.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,GAAG;IACxB,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC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AE,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;IACxB,UAAU,CAAC,EAAE,OAAO,CAAA;CACnB,2CAOJ;AAED,eAAO,MAAM,eAAe;;CAE3B,CAAA;AAED,eAAO,MAAM,aAAa;0CA3EmB;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;iDAfpC,SAAS;;;;CAgGpD,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,91 @@
|
|
|
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-how-to-use {\n --color-object-accent-primary: #006EAD;\n --color-object-accent-primary-emphasis: #006EAD;\n --border-radius-4: 8px;\n --color-text-mid-emphasis: #000;\n --color-surface-secondary: #f5f5f5;\n --color-surface-primary: #fff;\n}\n\n.nbb-how-to-use {\n background-color: var(--color-surface-secondary);\n padding: 32px 16px;\n}\n\n.nbb-how-to-use-section {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.nbb-how-to-use-section .nbb-section-header {\n margin-bottom: 24px;\n text-align: center;\n}\n\n.nbb-how-to-use-section .nbb-step-card {\n padding: 16px;\n}\n\n.nbb-how-to-use-section .nbb-step-card header {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n margin-bottom: 16px;\n}\n.nbb-how-to-use-section .nbb-step-card header h6 {\n color: #000;\n margin: 0px 16px;\n font-weight: bold;\n font-size: 16px;\n}\n.nbb-how-to-use-section .nbb-step-card header .material-symbols-outlined {\n color: var(--color-object-accent-primary);\n font-size: 24px;\n}\n\n.nbb-how-to-use-section .nbb-section-header h6 {\n color: var(--color-object-accent-primary);\n font-weight: bold;\n font-size: 16px;\n margin: 0;\n}\n\n.nbb-how-to-use-section .nbb-section-header h4 {\n color: #333;\n font-size: 24px;\n font-weight: bold;\n margin: 8px 0 0;\n}\n\n.nbb-how-to-use-section .nbb-how-to-use-steps {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.nbb-how-to-use-section .nbb-step-card {\n background-color: var(--color-surface-primary);\n padding: 16px;\n border-radius: var(--border-radius-4);\n}\n\n.nbb-how-to-use-section .nbb-step-text p {\n margin: 4px 0 0;\n font-size: 14px;\n color: var(--color-text-mid-emphasis);\n text-align: left;\n}\n\n.nbb-how-to-use-section .nbb-arrow {\n text-align: center;\n font-size: 32px;\n color: var(--color-object-accent-primary);\n}\n\n.nbb-how-to-use-section .nbb-sign-up {\n margin-top: 24px;\n text-align: center;\n}\n\n.nbb-how-to-use-section .nbb-sign-up-button {\n padding: 12px 24px;\n background-color: var(--color-object-accent-primary);\n color: var(--color-text-on-primary);\n font-weight: bold;\n border: none;\n border-radius: var(--border-radius-4);\n font-size: 16px;\n width: 100%;\n cursor: pointer;\n text-decoration: none;\n}\n\n.nbb-how-to-use-section .nbb-sign-up-button:hover {\n background-color: var(--color-object-accent-primary-emphasis);\n}\n";
|
|
33
|
+
styleInject(css_248z);
|
|
34
|
+
|
|
35
|
+
const Card = ({ title, description, icon }) => {
|
|
36
|
+
return (jsxRuntime.jsxs("article", { className: "nbb-step-card", children: [jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx("span", { className: "material-symbols-outlined", children: icon }), jsxRuntime.jsx("h6", { children: title })] }), jsxRuntime.jsx("div", { className: "nbb-step-text", children: jsxRuntime.jsx("p", { children: description }) })] }));
|
|
37
|
+
};
|
|
38
|
+
const HowToUseHeader = ({ title, subtitle }) => {
|
|
39
|
+
return (jsxRuntime.jsxs("div", { className: "nbb-section-header", children: [jsxRuntime.jsx("h6", { children: title }), jsxRuntime.jsx("h4", { children: subtitle })] }));
|
|
40
|
+
};
|
|
41
|
+
function setBlocks(defaultBlocks, children, settings) {
|
|
42
|
+
const { blocks: customBlocks = {}, settings: customSettings = {} } = children ? children(defaultBlocks, settings) : { blocks: {}, settings: {} };
|
|
43
|
+
return {
|
|
44
|
+
blocks: Object.fromEntries(Object.entries(defaultBlocks).map(([key, defaultComponent]) => [
|
|
45
|
+
key,
|
|
46
|
+
customBlocks[key] || defaultComponent,
|
|
47
|
+
])),
|
|
48
|
+
settings: {
|
|
49
|
+
...settings,
|
|
50
|
+
...customSettings,
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function BottomLink({ href, children }) {
|
|
55
|
+
return (jsxRuntime.jsx("div", { className: "nbb-sign-up", children: jsxRuntime.jsx("a", { href: href, rel: "noreferrer noopener", className: "nbb-sign-up-button", children: children }) }));
|
|
56
|
+
}
|
|
57
|
+
function ArrowIcon() {
|
|
58
|
+
return jsxRuntime.jsx("span", { className: "material-symbols-outlined nbb-arrow", children: "expand_more" });
|
|
59
|
+
}
|
|
60
|
+
function CardList({ list = [], Component = Card, IconComponent = ArrowIcon, showArrows = true }) {
|
|
61
|
+
return jsxRuntime.jsx("div", { className: "nbb-how-to-use-steps", children: list.map(c => {
|
|
62
|
+
return jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Component, { ...c }, c.title), showArrows && jsxRuntime.jsx(IconComponent, {})] }, c.title);
|
|
63
|
+
}) });
|
|
64
|
+
}
|
|
65
|
+
const defaultSettings = {
|
|
66
|
+
showArrows: true
|
|
67
|
+
};
|
|
68
|
+
const defaultBlocks = {
|
|
69
|
+
HowToUseHeader: HowToUseHeader,
|
|
70
|
+
HowToUseCard: Card,
|
|
71
|
+
HowToUseBottomLink: BottomLink,
|
|
72
|
+
HowToUseArrowIcon: ArrowIcon,
|
|
73
|
+
HowToUseCardList: CardList,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Utility function to join class names together, ignoring undefined or nil values.
|
|
78
|
+
* @param classes - The class names to join.
|
|
79
|
+
* @returns The joined class names.
|
|
80
|
+
*/
|
|
81
|
+
function classNames(...classes) {
|
|
82
|
+
return classes.flat().filter(Boolean).join(' ');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const HowToUse = ({ className, title, subtitle, list, linkHref = '/sign-up', linkText = '無料登録して求人を探す', children, }) => {
|
|
86
|
+
const { blocks: { HowToUseHeader, HowToUseCard, HowToUseBottomLink, HowToUseArrowIcon, HowToUseCardList }, settings: { showArrows } } = setBlocks(defaultBlocks, children, defaultSettings);
|
|
87
|
+
return (jsxRuntime.jsx("div", { className: classNames('nbb-how-to-use', className), children: jsxRuntime.jsxs("div", { className: "nbb-how-to-use-section", children: [jsxRuntime.jsx(HowToUseHeader, { title: title, subtitle: subtitle }), jsxRuntime.jsx("div", { className: "nbb-how-to-use-steps", children: jsxRuntime.jsx(HowToUseCardList, { list: list, Component: HowToUseCard, IconComponent: HowToUseArrowIcon, showArrows: showArrows }) }), jsxRuntime.jsx(HowToUseBottomLink, { href: linkHref, children: linkText })] }) }));
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
exports.HowToUse = HowToUse;
|
|
91
|
+
//# 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/blocks.tsx","../src/className.tsx","../src/HowToUse.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 HowToUse from \"./HowToUse\";\n\nexport type DefaultBlocks = {\n HowToUseHeader: React.FC<{ title: string; subtitle: string }>;\n HowToUseCard: React.FC<CardProps>;\n HowToUseBottomLink: React.FC<{ href: string; children: React.ReactNode }>;\n HowToUseArrowIcon: React.FC;\n HowToUseCardList: React.FC<{ list: CardProps[] }>;\n}\n\nexport type DefaultSettings = {\n showArrows: boolean;\n}\n\nexport type CardProps = {\n title: string;\n description: string;\n icon: string;\n};\n\nconst Card = ({ title, description, icon }: CardProps) => {\n return (\n <article className=\"nbb-step-card\">\n <header>\n <span className=\"material-symbols-outlined\">{icon}</span>\n <h6>{title}</h6>\n </header>\n <div className=\"nbb-step-text\">\n <p>{description}</p>\n </div>\n </article>\n );\n};\n\n\nconst HowToUseHeader = ({ title, subtitle }: { title: string; subtitle: string }) => {\n return (\n <div className=\"nbb-section-header\">\n <h6>{title}</h6>\n <h4>{subtitle}</h4>\n </div>\n );\n}\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\nexport function BottomLink({ href, children }: { href: string; children: React.ReactNode }) {\n return (\n <div className=\"nbb-sign-up\">\n <a\n href={href}\n rel=\"noreferrer noopener\"\n className=\"nbb-sign-up-button\"\n >\n {children}\n </a>\n </div>\n );\n}\nexport function ArrowIcon() {\n return <span className=\"material-symbols-outlined nbb-arrow\">expand_more</span>;\n}\n\nexport function CardList({\n list = [],\n Component = Card,\n IconComponent = ArrowIcon,\n showArrows = true\n}: {\n list: CardProps[],\n Component?: React.FC<CardProps>,\n IconComponent?: React.FC\n showArrows?: boolean\n }) {\n return <div className=\"nbb-how-to-use-steps\">{list.map(c => {\n return <div key={c.title} >\n <Component key={c.title} {...c} />\n {showArrows && <IconComponent />}\n </div>;\n })}</div>;\n}\n\nexport const defaultSettings = {\n showArrows: true\n}\n\nexport const defaultBlocks = {\n HowToUseHeader: HowToUseHeader,\n HowToUseCard: Card,\n HowToUseBottomLink: BottomLink,\n HowToUseArrowIcon: ArrowIcon,\n HowToUseCardList: CardList,\n}\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","import React from 'react';\nimport './how-to-use.css';\nimport { defaultBlocks, defaultSettings, setBlocks, CardProps, DefaultBlocks, DefaultSettings } from './blocks';\nimport { classNames } from './className';\n\ntype HowToUseProps = {\n className: string;\n title: string;\n subtitle: string;\n linkHref?: string;\n linkText?: string;\n list: CardProps[];\nchildren?: (defaultBlocks: DefaultBlocks, settings?: DefaultSettings) => {\n blocks: { [x: string]: any };\n settings?: DefaultSettings;\n};\n};\n\n\nexport const HowToUse: React.FC<HowToUseProps> = ({\n className,\n title,\n subtitle,\n list,\n linkHref = '/sign-up',\n linkText = '無料登録して求人を探す',\n children,\n}) => {\n \n const {\n blocks: {\n HowToUseHeader,\n HowToUseCard,\n HowToUseBottomLink,\n HowToUseArrowIcon,\n HowToUseCardList\n },\n settings: {\n showArrows\n }\n } = setBlocks(defaultBlocks, children, defaultSettings);\n\n return (\n <div className={classNames('nbb-how-to-use', className)}>\n <div className=\"nbb-how-to-use-section\">\n <HowToUseHeader title={title} subtitle={subtitle} />\n <div className=\"nbb-how-to-use-steps\">\n <HowToUseCardList\n list={list}\n Component={HowToUseCard}\n IconComponent={HowToUseArrowIcon}\n showArrows={showArrows}\n />\n </div>\n <HowToUseBottomLink href={linkHref}>\n {linkText}\n </HowToUseBottomLink>\n </div>\n </div>\n );\n};\n\nexport default HowToUse;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG,EAA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GAAG,UAAU,EACrB,QAAQ,GAAG,aAAa,EACxB,QAAQ,GACT,KAAI;AAEH,IAAA,MAAM,EACJ,MAAM,EAAE,EACN,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EACjB,EACD,QAAQ,EAAE,EACR,UAAU,EACX,EACF,GAAG,SAAS,CAAC,aAAa,EAAE,QAAQ,EAAE,eAAe,CAAC;AAEvD,IAAA,QACEA,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,EACrD,QAAA,EAAAD,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,wBAAwB,EACrC,QAAA,EAAA,CAAAC,cAAA,CAAC,cAAc,EAAA,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAI,CAAA,EACpDA,cAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,sBAAsB,EAAA,QAAA,EACnCA,cAAC,CAAA,gBAAgB,EACf,EAAA,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,YAAY,EACvB,aAAa,EAAE,iBAAiB,EAChC,UAAU,EAAE,UAAU,EAAA,CACtB,EACE,CAAA,EACNA,cAAC,CAAA,kBAAkB,IAAC,IAAI,EAAE,QAAQ,EAAA,QAAA,EAC/B,QAAQ,EAAA,CACU,CACjB,EAAA,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,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
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-how-to-use {\n --color-object-accent-primary: #006EAD;\n --color-object-accent-primary-emphasis: #006EAD;\n --border-radius-4: 8px;\n --color-text-mid-emphasis: #000;\n --color-surface-secondary: #f5f5f5;\n --color-surface-primary: #fff;\n}\n\n.nbb-how-to-use {\n background-color: var(--color-surface-secondary);\n padding: 32px 16px;\n}\n\n.nbb-how-to-use-section {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.nbb-how-to-use-section .nbb-section-header {\n margin-bottom: 24px;\n text-align: center;\n}\n\n.nbb-how-to-use-section .nbb-step-card {\n padding: 16px;\n}\n\n.nbb-how-to-use-section .nbb-step-card header {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n margin-bottom: 16px;\n}\n.nbb-how-to-use-section .nbb-step-card header h6 {\n color: #000;\n margin: 0px 16px;\n font-weight: bold;\n font-size: 16px;\n}\n.nbb-how-to-use-section .nbb-step-card header .material-symbols-outlined {\n color: var(--color-object-accent-primary);\n font-size: 24px;\n}\n\n.nbb-how-to-use-section .nbb-section-header h6 {\n color: var(--color-object-accent-primary);\n font-weight: bold;\n font-size: 16px;\n margin: 0;\n}\n\n.nbb-how-to-use-section .nbb-section-header h4 {\n color: #333;\n font-size: 24px;\n font-weight: bold;\n margin: 8px 0 0;\n}\n\n.nbb-how-to-use-section .nbb-how-to-use-steps {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.nbb-how-to-use-section .nbb-step-card {\n background-color: var(--color-surface-primary);\n padding: 16px;\n border-radius: var(--border-radius-4);\n}\n\n.nbb-how-to-use-section .nbb-step-text p {\n margin: 4px 0 0;\n font-size: 14px;\n color: var(--color-text-mid-emphasis);\n text-align: left;\n}\n\n.nbb-how-to-use-section .nbb-arrow {\n text-align: center;\n font-size: 32px;\n color: var(--color-object-accent-primary);\n}\n\n.nbb-how-to-use-section .nbb-sign-up {\n margin-top: 24px;\n text-align: center;\n}\n\n.nbb-how-to-use-section .nbb-sign-up-button {\n padding: 12px 24px;\n background-color: var(--color-object-accent-primary);\n color: var(--color-text-on-primary);\n font-weight: bold;\n border: none;\n border-radius: var(--border-radius-4);\n font-size: 16px;\n width: 100%;\n cursor: pointer;\n text-decoration: none;\n}\n\n.nbb-how-to-use-section .nbb-sign-up-button:hover {\n background-color: var(--color-object-accent-primary-emphasis);\n}\n";
|
|
31
|
+
styleInject(css_248z);
|
|
32
|
+
|
|
33
|
+
const Card = ({ title, description, icon }) => {
|
|
34
|
+
return (jsxs("article", { className: "nbb-step-card", children: [jsxs("header", { children: [jsx("span", { className: "material-symbols-outlined", children: icon }), jsx("h6", { children: title })] }), jsx("div", { className: "nbb-step-text", children: jsx("p", { children: description }) })] }));
|
|
35
|
+
};
|
|
36
|
+
const HowToUseHeader = ({ title, subtitle }) => {
|
|
37
|
+
return (jsxs("div", { className: "nbb-section-header", children: [jsx("h6", { children: title }), jsx("h4", { children: subtitle })] }));
|
|
38
|
+
};
|
|
39
|
+
function setBlocks(defaultBlocks, children, settings) {
|
|
40
|
+
const { blocks: customBlocks = {}, settings: customSettings = {} } = children ? children(defaultBlocks, settings) : { blocks: {}, settings: {} };
|
|
41
|
+
return {
|
|
42
|
+
blocks: Object.fromEntries(Object.entries(defaultBlocks).map(([key, defaultComponent]) => [
|
|
43
|
+
key,
|
|
44
|
+
customBlocks[key] || defaultComponent,
|
|
45
|
+
])),
|
|
46
|
+
settings: {
|
|
47
|
+
...settings,
|
|
48
|
+
...customSettings,
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function BottomLink({ href, children }) {
|
|
53
|
+
return (jsx("div", { className: "nbb-sign-up", children: jsx("a", { href: href, rel: "noreferrer noopener", className: "nbb-sign-up-button", children: children }) }));
|
|
54
|
+
}
|
|
55
|
+
function ArrowIcon() {
|
|
56
|
+
return jsx("span", { className: "material-symbols-outlined nbb-arrow", children: "expand_more" });
|
|
57
|
+
}
|
|
58
|
+
function CardList({ list = [], Component = Card, IconComponent = ArrowIcon, showArrows = true }) {
|
|
59
|
+
return jsx("div", { className: "nbb-how-to-use-steps", children: list.map(c => {
|
|
60
|
+
return jsxs("div", { children: [jsx(Component, { ...c }, c.title), showArrows && jsx(IconComponent, {})] }, c.title);
|
|
61
|
+
}) });
|
|
62
|
+
}
|
|
63
|
+
const defaultSettings = {
|
|
64
|
+
showArrows: true
|
|
65
|
+
};
|
|
66
|
+
const defaultBlocks = {
|
|
67
|
+
HowToUseHeader: HowToUseHeader,
|
|
68
|
+
HowToUseCard: Card,
|
|
69
|
+
HowToUseBottomLink: BottomLink,
|
|
70
|
+
HowToUseArrowIcon: ArrowIcon,
|
|
71
|
+
HowToUseCardList: CardList,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Utility function to join class names together, ignoring undefined or nil values.
|
|
76
|
+
* @param classes - The class names to join.
|
|
77
|
+
* @returns The joined class names.
|
|
78
|
+
*/
|
|
79
|
+
function classNames(...classes) {
|
|
80
|
+
return classes.flat().filter(Boolean).join(' ');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const HowToUse = ({ className, title, subtitle, list, linkHref = '/sign-up', linkText = '無料登録して求人を探す', children, }) => {
|
|
84
|
+
const { blocks: { HowToUseHeader, HowToUseCard, HowToUseBottomLink, HowToUseArrowIcon, HowToUseCardList }, settings: { showArrows } } = setBlocks(defaultBlocks, children, defaultSettings);
|
|
85
|
+
return (jsx("div", { className: classNames('nbb-how-to-use', className), children: jsxs("div", { className: "nbb-how-to-use-section", children: [jsx(HowToUseHeader, { title: title, subtitle: subtitle }), jsx("div", { className: "nbb-how-to-use-steps", children: jsx(HowToUseCardList, { list: list, Component: HowToUseCard, IconComponent: HowToUseArrowIcon, showArrows: showArrows }) }), jsx(HowToUseBottomLink, { href: linkHref, children: linkText })] }) }));
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export { HowToUse };
|
|
89
|
+
//# 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/blocks.tsx","../src/className.tsx","../src/HowToUse.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 HowToUse from \"./HowToUse\";\n\nexport type DefaultBlocks = {\n HowToUseHeader: React.FC<{ title: string; subtitle: string }>;\n HowToUseCard: React.FC<CardProps>;\n HowToUseBottomLink: React.FC<{ href: string; children: React.ReactNode }>;\n HowToUseArrowIcon: React.FC;\n HowToUseCardList: React.FC<{ list: CardProps[] }>;\n}\n\nexport type DefaultSettings = {\n showArrows: boolean;\n}\n\nexport type CardProps = {\n title: string;\n description: string;\n icon: string;\n};\n\nconst Card = ({ title, description, icon }: CardProps) => {\n return (\n <article className=\"nbb-step-card\">\n <header>\n <span className=\"material-symbols-outlined\">{icon}</span>\n <h6>{title}</h6>\n </header>\n <div className=\"nbb-step-text\">\n <p>{description}</p>\n </div>\n </article>\n );\n};\n\n\nconst HowToUseHeader = ({ title, subtitle }: { title: string; subtitle: string }) => {\n return (\n <div className=\"nbb-section-header\">\n <h6>{title}</h6>\n <h4>{subtitle}</h4>\n </div>\n );\n}\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\nexport function BottomLink({ href, children }: { href: string; children: React.ReactNode }) {\n return (\n <div className=\"nbb-sign-up\">\n <a\n href={href}\n rel=\"noreferrer noopener\"\n className=\"nbb-sign-up-button\"\n >\n {children}\n </a>\n </div>\n );\n}\nexport function ArrowIcon() {\n return <span className=\"material-symbols-outlined nbb-arrow\">expand_more</span>;\n}\n\nexport function CardList({\n list = [],\n Component = Card,\n IconComponent = ArrowIcon,\n showArrows = true\n}: {\n list: CardProps[],\n Component?: React.FC<CardProps>,\n IconComponent?: React.FC\n showArrows?: boolean\n }) {\n return <div className=\"nbb-how-to-use-steps\">{list.map(c => {\n return <div key={c.title} >\n <Component key={c.title} {...c} />\n {showArrows && <IconComponent />}\n </div>;\n })}</div>;\n}\n\nexport const defaultSettings = {\n showArrows: true\n}\n\nexport const defaultBlocks = {\n HowToUseHeader: HowToUseHeader,\n HowToUseCard: Card,\n HowToUseBottomLink: BottomLink,\n HowToUseArrowIcon: ArrowIcon,\n HowToUseCardList: CardList,\n}\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","import React from 'react';\nimport './how-to-use.css';\nimport { defaultBlocks, defaultSettings, setBlocks, CardProps, DefaultBlocks, DefaultSettings } from './blocks';\nimport { classNames } from './className';\n\ntype HowToUseProps = {\n className: string;\n title: string;\n subtitle: string;\n linkHref?: string;\n linkText?: string;\n list: CardProps[];\nchildren?: (defaultBlocks: DefaultBlocks, settings?: DefaultSettings) => {\n blocks: { [x: string]: any };\n settings?: DefaultSettings;\n};\n};\n\n\nexport const HowToUse: React.FC<HowToUseProps> = ({\n className,\n title,\n subtitle,\n list,\n linkHref = '/sign-up',\n linkText = '無料登録して求人を探す',\n children,\n}) => {\n \n const {\n blocks: {\n HowToUseHeader,\n HowToUseCard,\n HowToUseBottomLink,\n HowToUseArrowIcon,\n HowToUseCardList\n },\n settings: {\n showArrows\n }\n } = setBlocks(defaultBlocks, children, defaultSettings);\n\n return (\n <div className={classNames('nbb-how-to-use', className)}>\n <div className=\"nbb-how-to-use-section\">\n <HowToUseHeader title={title} subtitle={subtitle} />\n <div className=\"nbb-how-to-use-steps\">\n <HowToUseCardList\n list={list}\n Component={HowToUseCard}\n IconComponent={HowToUseArrowIcon}\n showArrows={showArrows}\n />\n </div>\n <HowToUseBottomLink href={linkHref}>\n {linkText}\n </HowToUseBottomLink>\n </div>\n </div>\n );\n};\n\nexport default HowToUse;\n"],"names":["_jsxs","_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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AG,aAAa,EACxB,QAAQ,GACT,KAAI;AAEH,IAAA,MAAM,EACJ,MAAM,EAAE,EACN,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EACjB,EACD,QAAQ,EAAE,EACR,UAAU,EACX,EACF,GAAG,SAAS,CAAC,aAAa,EAAE,QAAQ,EAAE,eAAe,CAAC;AAEvD,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,EACrD,QAAA,EAAAD,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,wBAAwB,EACrC,QAAA,EAAA,CAAAC,GAAA,CAAC,cAAc,EAAA,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAI,CAAA,EACpDA,GAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,sBAAsB,EAAA,QAAA,EACnCA,GAAC,CAAA,gBAAgB,EACf,EAAA,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,YAAY,EACvB,aAAa,EAAE,iBAAiB,EAChC,UAAU,EAAE,UAAU,EAAA,CACtB,EACE,CAAA,EACNA,GAAC,CAAA,kBAAkB,IAAC,IAAI,EAAE,QAAQ,EAAA,QAAA,EAC/B,QAAQ,EAAA,CACU,CACjB,EAAA,CAAA,EAAA,CACF;AAEV;;;;","x_google_ignoreList":[0]}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nodeblocks/frontend-how-to-use-block",
|
|
3
|
+
"version": "0.0.3",
|
|
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.18",
|
|
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.
|