@ed.yakovich/example-component-library--molecules--info-banner 1.0.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.
@@ -0,0 +1,7 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { createContext as r, useContext as x } from "react";
3
+ const n = r({}), a = () => x(n), f = ({ model: t, children: o }) => /* @__PURE__ */ e(n.Provider, { value: { ...t }, children: o });
4
+ export {
5
+ f as InfoBannerContextProvider,
6
+ a as useInfoBannerContext
7
+ };
@@ -0,0 +1,32 @@
1
+ import { jsx as e, jsxs as g } from "react/jsx-runtime";
2
+ import { useInfoBannerContext as f } from "./context/index.js";
3
+ import { createContext as H, useContext as C } from "react";
4
+ const N = H({}), v = () => C(N), I = (s) => {
5
+ const { isHidden: d, componentId: o = "", icon: t = "" } = s, i = v(), c = i == null ? void 0 : i.isHidden, n = (i == null ? void 0 : i.icon) || "", a = () => ({
6
+ isHiddenVal: c || d,
7
+ iconVal: n || t
8
+ }), { isHiddenVal: l, iconVal: r } = a();
9
+ return l ? null : /* @__PURE__ */ e("span", { "data-component-id": `Icon--${o}`, children: /* @__PURE__ */ e("i", { className: `fas ${r}` }) });
10
+ }, j = (s) => {
11
+ const { isHidden: d, componentId: o = "", heading: t = "", description: i = "", icon: c = "" } = s, n = f(), a = n == null ? void 0 : n.isHidden, l = (n == null ? void 0 : n.icon) || "", r = (n == null ? void 0 : n.heading) || "", u = (n == null ? void 0 : n.description) || "", V = () => ({
12
+ isHiddenVal: a || d,
13
+ iconVal: l || c,
14
+ headingVal: r || t,
15
+ descriptionVal: u || i
16
+ }), { isHiddenVal: x, iconVal: m, headingVal: p, descriptionVal: h } = V();
17
+ return x ? null : /* @__PURE__ */ e(
18
+ "div",
19
+ {
20
+ "data-component-id": `InfoBanner--${o}`,
21
+ className: "bg-blue-500 p-4 text-white @container/infobanner",
22
+ children: /* @__PURE__ */ e("div", { className: "text-center", children: /* @__PURE__ */ g("div", { className: "space-y-1", children: [
23
+ m && /* @__PURE__ */ e(I, { icon: m, componentId: o }),
24
+ p && /* @__PURE__ */ e("div", { className: "text-center @lg/infobanner:px-14", children: /* @__PURE__ */ e("h2", { className: "text-3xl", children: /* @__PURE__ */ e("strong", { children: p }) }) }),
25
+ h && /* @__PURE__ */ e("p", { className: "text-xs mb-2", children: /* @__PURE__ */ e("strong", { children: h }) })
26
+ ] }) })
27
+ }
28
+ );
29
+ };
30
+ export {
31
+ j as InfoBanner
32
+ };
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { InfoBannerType } from '../types';
3
+ type InfoBannerContextData = InfoBannerType;
4
+ type InfoBannerContextProviderProps = {
5
+ model: InfoBannerContextData;
6
+ children: ReactNode;
7
+ };
8
+ export declare const useInfoBannerContext: () => InfoBannerType;
9
+ export declare const InfoBannerContextProvider: ({ model, children }: InfoBannerContextProviderProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,2 @@
1
+ import { InfoBannerType } from './types';
2
+ export declare const InfoBanner: (props: InfoBannerType) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,7 @@
1
+ export type InfoBannerType = {
2
+ isHidden?: boolean;
3
+ componentId?: string;
4
+ icon?: string;
5
+ heading?: string;
6
+ description?: string;
7
+ };
@@ -0,0 +1,3 @@
1
+ export { InfoBanner } from './component';
2
+ export { InfoBannerContextProvider } from './component/context';
3
+ export type { InfoBannerType } from './component/types';
package/dist/main.js ADDED
@@ -0,0 +1,6 @@
1
+ import { InfoBanner as n } from "./component/index.js";
2
+ import { InfoBannerContextProvider as f } from "./component/context/index.js";
3
+ export {
4
+ n as InfoBanner,
5
+ f as InfoBannerContextProvider
6
+ };
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@ed.yakovich/example-component-library--molecules--info-banner",
3
+ "author": "Ed Yakovich",
4
+ "private": false,
5
+ "version": "1.0.0",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/lib/main.d.ts",
10
+ "default": "./dist/main.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "sideEffects": [
17
+ "**/*.css"
18
+ ],
19
+ "scripts": {
20
+ "dev": "vite",
21
+ "build": "tsc -b ./tsconfig.lib.json && vite build",
22
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
23
+ "preview": "vite preview"
24
+ },
25
+ "peerDependencies": {
26
+ "react": "^18.0.0 || ^19.0.0",
27
+ "react-dom": "^18.0.0 || ^19.0.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^22.5.4",
31
+ "@types/react": "^18.3.5",
32
+ "@types/react-dom": "^18.3.0",
33
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
34
+ "@typescript-eslint/parser": "^7.18.0",
35
+ "@vitejs/plugin-react": "^4.3.1",
36
+ "ajv": "^8.17.1",
37
+ "eslint": "^8.57.0",
38
+ "eslint-plugin-react-hooks": "^4.6.2",
39
+ "eslint-plugin-react-refresh": "^0.4.11",
40
+ "glob": "^11.0.0",
41
+ "react": "^18.3.1",
42
+ "react-dom": "^18.3.1",
43
+ "typescript": "^5.6.2",
44
+ "vite": "^5.4.4",
45
+ "vite-plugin-dts": "^4.2.1",
46
+ "vite-plugin-lib-inject-css": "^2.1.1",
47
+ "@ed.yakovich/example-component-library--atoms--icon": "^1.0.0"
48
+ }
49
+ }