@plasmicpkgs/plasmic-nav 0.0.5
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/LICENSE.md +21 -0
- package/README.md +1 -0
- package/dist/PlasmicNavigationBar.d.ts +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -0
- package/dist/plasmic-nav.cjs.development.js +177 -0
- package/dist/plasmic-nav.cjs.development.js.map +1 -0
- package/dist/plasmic-nav.cjs.production.min.js +2 -0
- package/dist/plasmic-nav.cjs.production.min.js.map +1 -0
- package/dist/plasmic-nav.esm.js +169 -0
- package/dist/plasmic-nav.esm.js.map +1 -0
- package/package.json +49 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Plasmic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Plasmic responsive navigation menu and registration calls.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentMeta, registerComponent } from "@plasmicapp/host";
|
|
3
|
+
import { CanvasComponentProps } from "@plasmicapp/host/registerComponent";
|
|
4
|
+
interface Props extends CanvasComponentProps {
|
|
5
|
+
brand?: React.ReactNode;
|
|
6
|
+
menuItems?: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
closeButton?: React.ReactNode;
|
|
9
|
+
openButton?: React.ReactNode;
|
|
10
|
+
forceOpenMenu?: boolean;
|
|
11
|
+
itemsGap?: number;
|
|
12
|
+
responsiveBreakpoint?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function NavigationBar(props: Props): JSX.Element;
|
|
15
|
+
export declare const navigationBarComponentMeta: ComponentMeta<Props>;
|
|
16
|
+
export declare function registerNavigationBar(loader?: {
|
|
17
|
+
registerComponent: typeof registerComponent;
|
|
18
|
+
}, customMetaProps?: ComponentMeta<React.ComponentProps<typeof NavigationBar>>): void;
|
|
19
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PlasmicNavigationBar";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
+
|
|
7
|
+
var React = _interopDefault(require('react'));
|
|
8
|
+
var host = require('@plasmicapp/host');
|
|
9
|
+
|
|
10
|
+
var CSSClasses = {
|
|
11
|
+
menuButton: "plasmic-nav-menu-button",
|
|
12
|
+
menuItemsContainer: "plasmic-nav-menu-items",
|
|
13
|
+
menuItemsContainerOpen: "plasmic-nav-menu-items-open"
|
|
14
|
+
};
|
|
15
|
+
var DEFAULT_GAP = 8;
|
|
16
|
+
var DEFAULT_RESPONSIVE_BREAKPOINT = 768;
|
|
17
|
+
function NavigationBar(props) {
|
|
18
|
+
var forceOpenMenu = props.forceOpenMenu;
|
|
19
|
+
|
|
20
|
+
var _React$useState = React.useState(false),
|
|
21
|
+
isOpen = _React$useState[0],
|
|
22
|
+
setIsOpen = _React$useState[1];
|
|
23
|
+
|
|
24
|
+
var inEditor = React.useContext(host.PlasmicCanvasContext);
|
|
25
|
+
var shouldRenderMenu = React.useMemo(function () {
|
|
26
|
+
if (inEditor && forceOpenMenu) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return isOpen;
|
|
31
|
+
}, [inEditor, forceOpenMenu, isOpen]);
|
|
32
|
+
|
|
33
|
+
var toggleMenu = function toggleMenu() {
|
|
34
|
+
return setIsOpen(function (value) {
|
|
35
|
+
return !value;
|
|
36
|
+
});
|
|
37
|
+
}; // Parsing the gap manually to ensure it's a valid number
|
|
38
|
+
// as we are using it in dangerouslySetInnerHTML.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
var gap = safeParseNumber(props.itemsGap, DEFAULT_GAP);
|
|
42
|
+
var responsiveBreakpoint = safeParseNumber(props.responsiveBreakpoint, DEFAULT_RESPONSIVE_BREAKPOINT);
|
|
43
|
+
var cssStyles = React.useMemo(function () {
|
|
44
|
+
return minifyCss("\n /* Shared Styles */\n ." + CSSClasses.menuItemsContainer + " {\n display: flex;\n }\n \n ." + CSSClasses.menuItemsContainer + " > * {\n flex: 0 0 auto;\n }\n \n /* Desktop Styles */\n @media (min-width: " + (responsiveBreakpoint + 1) + "px) {\n ." + CSSClasses.menuButton + " {\n display: none;\n }\n \n ." + CSSClasses.menuItemsContainer + " {\n flex-direction: row;\n align-items: center;\n width: auto;\n }\n ." + CSSClasses.menuItemsContainer + " > *:not(:first-child) {\n margin-inline-start: " + gap + "px;\n }\n }\n \n /* Mobile Styles */\n @media (max-width: " + responsiveBreakpoint + "px) {\n ." + CSSClasses.menuButton + " {\n unset: all;\n -webkit-appearance: none;\n min-width: 40px;\n min-height: 40px;\n padding: 0;\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n background: none;\n cursor: pointer;\n }\n \n ." + CSSClasses.menuItemsContainer + ":not(." + CSSClasses.menuItemsContainerOpen + ") {\n display: none;\n }\n \n ." + CSSClasses.menuItemsContainer + " {\n margin-top: 10px;\n flex-direction: column;\n flex-shrink: 0;\n width: 100%;\n }\n ." + CSSClasses.menuItemsContainer + " > *:not(:first-child) {\n margin-top: " + gap + "px;\n }\n }\n ");
|
|
45
|
+
}, [gap, responsiveBreakpoint]);
|
|
46
|
+
return React.createElement("div", {
|
|
47
|
+
className: props.className
|
|
48
|
+
}, React.createElement("style", {
|
|
49
|
+
dangerouslySetInnerHTML: {
|
|
50
|
+
__html: cssStyles
|
|
51
|
+
}
|
|
52
|
+
}), React.createElement("div", null, props.brand), React.createElement("button", {
|
|
53
|
+
className: CSSClasses.menuButton,
|
|
54
|
+
onClick: toggleMenu,
|
|
55
|
+
tabIndex: 0,
|
|
56
|
+
"aria-expanded": shouldRenderMenu
|
|
57
|
+
}, shouldRenderMenu ? props.closeButton : props.openButton), React.createElement("nav", {
|
|
58
|
+
role: "menu",
|
|
59
|
+
className: (CSSClasses.menuItemsContainer + " " + (shouldRenderMenu ? CSSClasses.menuItemsContainerOpen : "")).trim()
|
|
60
|
+
}, props.menuItems));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function safeParseNumber(input, defaultValue) {
|
|
64
|
+
if (defaultValue === void 0) {
|
|
65
|
+
defaultValue = 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var parsedValue = parseInt(input, 10);
|
|
69
|
+
return isNaN(parsedValue) ? defaultValue : parsedValue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function minifyCss(input) {
|
|
73
|
+
return input.replace(/\s{2,}|\n/g, "") // Remove spaces
|
|
74
|
+
.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/g, ""); // Remove comments.
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var navigationBarComponentMeta = {
|
|
78
|
+
name: "plasmic-navigation-bar",
|
|
79
|
+
displayName: "Navigation Bar",
|
|
80
|
+
importName: "NavigationBar",
|
|
81
|
+
importPath: "@plasmicpkgs/plasmic-nav",
|
|
82
|
+
props: {
|
|
83
|
+
// Properties
|
|
84
|
+
forceOpenMenu: {
|
|
85
|
+
displayName: "Force Open Menu",
|
|
86
|
+
description: "Use this option to open the menu during design time so you can easily customize the close button and menu items for small screens. This option is ignored when publishing the page.",
|
|
87
|
+
type: "boolean"
|
|
88
|
+
},
|
|
89
|
+
itemsGap: {
|
|
90
|
+
displayName: "Items Gap",
|
|
91
|
+
description: "The width of the space between menu items in pixels.",
|
|
92
|
+
type: "number",
|
|
93
|
+
min: 0,
|
|
94
|
+
defaultValue: DEFAULT_GAP
|
|
95
|
+
},
|
|
96
|
+
responsiveBreakpoint: {
|
|
97
|
+
displayName: "Small Screens Breakpoint",
|
|
98
|
+
description: "The maximum screen width used for showing the small screens version of the menu.",
|
|
99
|
+
type: "number",
|
|
100
|
+
min: 0,
|
|
101
|
+
defaultValue: DEFAULT_RESPONSIVE_BREAKPOINT
|
|
102
|
+
},
|
|
103
|
+
// Slots
|
|
104
|
+
brand: {
|
|
105
|
+
type: "slot",
|
|
106
|
+
defaultValue: [{
|
|
107
|
+
type: "hbox",
|
|
108
|
+
tag: "a",
|
|
109
|
+
attrs: {
|
|
110
|
+
href: "#"
|
|
111
|
+
},
|
|
112
|
+
styles: {
|
|
113
|
+
padding: "0px"
|
|
114
|
+
},
|
|
115
|
+
children: {
|
|
116
|
+
type: "img",
|
|
117
|
+
src: "",
|
|
118
|
+
styles: {
|
|
119
|
+
height: "50px"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}]
|
|
123
|
+
},
|
|
124
|
+
openButton: {
|
|
125
|
+
type: "slot",
|
|
126
|
+
defaultValue: {
|
|
127
|
+
type: "img",
|
|
128
|
+
src: "https://static1.plasmic.app/menu.svg"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
closeButton: {
|
|
132
|
+
type: "slot",
|
|
133
|
+
defaultValue: {
|
|
134
|
+
type: "img",
|
|
135
|
+
src: "https://static1.plasmic.app/close.svg"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
menuItems: {
|
|
139
|
+
type: "slot",
|
|
140
|
+
defaultValue: /*#__PURE__*/["Home", "About", "Contact"].map(function (title) {
|
|
141
|
+
return {
|
|
142
|
+
type: "text",
|
|
143
|
+
tag: "a",
|
|
144
|
+
attrs: {
|
|
145
|
+
href: "/"
|
|
146
|
+
},
|
|
147
|
+
styles: {
|
|
148
|
+
width: "auto"
|
|
149
|
+
},
|
|
150
|
+
value: title
|
|
151
|
+
};
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
defaultStyles: {
|
|
156
|
+
display: "flex",
|
|
157
|
+
flexDirection: "row",
|
|
158
|
+
justifyContent: "space-between",
|
|
159
|
+
width: "100%",
|
|
160
|
+
padding: "16px",
|
|
161
|
+
flexWrap: "wrap",
|
|
162
|
+
alignItems: "center",
|
|
163
|
+
marginBottom: "20px"
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
function registerNavigationBar(loader, customMetaProps) {
|
|
167
|
+
if (loader) {
|
|
168
|
+
loader.registerComponent(NavigationBar, customMetaProps != null ? customMetaProps : navigationBarComponentMeta);
|
|
169
|
+
} else {
|
|
170
|
+
host.registerComponent(NavigationBar, customMetaProps != null ? customMetaProps : navigationBarComponentMeta);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
exports.NavigationBar = NavigationBar;
|
|
175
|
+
exports.navigationBarComponentMeta = navigationBarComponentMeta;
|
|
176
|
+
exports.registerNavigationBar = registerNavigationBar;
|
|
177
|
+
//# sourceMappingURL=plasmic-nav.cjs.development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plasmic-nav.cjs.development.js","sources":["../src/PlasmicNavigationBar.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n ComponentMeta,\n registerComponent,\n PlasmicCanvasContext,\n} from \"@plasmicapp/host\";\nimport { CanvasComponentProps } from \"@plasmicapp/host/registerComponent\";\n\ninterface Props extends CanvasComponentProps {\n brand?: React.ReactNode;\n menuItems?: React.ReactNode;\n className?: string;\n closeButton?: React.ReactNode;\n openButton?: React.ReactNode;\n forceOpenMenu?: boolean;\n itemsGap?: number;\n responsiveBreakpoint?: number;\n}\n\nconst CSSClasses = {\n menuButton: \"plasmic-nav-menu-button\",\n menuItemsContainer: \"plasmic-nav-menu-items\",\n menuItemsContainerOpen: \"plasmic-nav-menu-items-open\",\n};\n\nconst DEFAULT_GAP = 8;\nconst DEFAULT_RESPONSIVE_BREAKPOINT = 768;\nexport function NavigationBar(props: Props) {\n const { forceOpenMenu } = props;\n const [isOpen, setIsOpen] = React.useState(false);\n const inEditor = React.useContext(PlasmicCanvasContext);\n\n const shouldRenderMenu = React.useMemo(() => {\n if (inEditor && forceOpenMenu) {\n return true;\n }\n\n return isOpen;\n }, [inEditor, forceOpenMenu, isOpen]);\n\n const toggleMenu = () => setIsOpen((value) => !value);\n\n // Parsing the gap manually to ensure it's a valid number\n // as we are using it in dangerouslySetInnerHTML.\n const gap = safeParseNumber(props.itemsGap, DEFAULT_GAP);\n const responsiveBreakpoint = safeParseNumber(\n props.responsiveBreakpoint,\n DEFAULT_RESPONSIVE_BREAKPOINT\n );\n\n const cssStyles = React.useMemo(\n () =>\n minifyCss(`\n /* Shared Styles */\n .${CSSClasses.menuItemsContainer} {\n display: flex;\n }\n \n .${CSSClasses.menuItemsContainer} > * {\n flex: 0 0 auto;\n }\n \n /* Desktop Styles */\n @media (min-width: ${responsiveBreakpoint + 1}px) {\n .${CSSClasses.menuButton} {\n display: none;\n }\n \n .${CSSClasses.menuItemsContainer} {\n flex-direction: row;\n align-items: center;\n width: auto;\n }\n .${CSSClasses.menuItemsContainer} > *:not(:first-child) {\n margin-inline-start: ${gap}px;\n }\n }\n \n /* Mobile Styles */\n @media (max-width: ${responsiveBreakpoint}px) {\n .${CSSClasses.menuButton} {\n unset: all;\n -webkit-appearance: none;\n min-width: 40px;\n min-height: 40px;\n padding: 0;\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n background: none;\n cursor: pointer;\n }\n \n .${CSSClasses.menuItemsContainer}:not(.${CSSClasses.menuItemsContainerOpen}) {\n display: none;\n }\n \n .${CSSClasses.menuItemsContainer} {\n margin-top: 10px;\n flex-direction: column;\n flex-shrink: 0;\n width: 100%;\n }\n .${CSSClasses.menuItemsContainer} > *:not(:first-child) {\n margin-top: ${gap}px;\n }\n }\n `),\n [gap, responsiveBreakpoint]\n );\n\n return (\n <div className={props.className}>\n <style dangerouslySetInnerHTML={{ __html: cssStyles }} />\n <div>{props.brand}</div>\n <button\n className={CSSClasses.menuButton}\n onClick={toggleMenu}\n tabIndex={0}\n aria-expanded={shouldRenderMenu}\n >\n {shouldRenderMenu ? props.closeButton : props.openButton}\n </button>\n <nav\n role=\"menu\"\n className={`${CSSClasses.menuItemsContainer} ${\n shouldRenderMenu ? CSSClasses.menuItemsContainerOpen : \"\"\n }`.trim()}\n >\n {props.menuItems}\n </nav>\n </div>\n );\n}\n\nfunction safeParseNumber(input: any, defaultValue: number = 0) {\n const parsedValue = parseInt(input, 10);\n return isNaN(parsedValue) ? defaultValue : parsedValue;\n}\n\nfunction minifyCss(input: string) {\n return input\n .replace(/\\s{2,}|\\n/g, \"\") // Remove spaces\n .replace(/\\/\\*[\\s\\S]*?\\*\\/|([^:]|^)\\/\\/.*$/g, \"\"); // Remove comments.\n}\n\nexport const navigationBarComponentMeta: ComponentMeta<Props> = {\n name: `plasmic-navigation-bar`,\n displayName: \"Navigation Bar\",\n importName: \"NavigationBar\",\n importPath: \"@plasmicpkgs/plasmic-nav\",\n props: {\n // Properties\n forceOpenMenu: {\n displayName: \"Force Open Menu\",\n description: \"Use this option to open the menu during design time so you can easily customize the close button and menu items for small screens. This option is ignored when publishing the page.\",\n type: \"boolean\",\n },\n itemsGap: {\n displayName: \"Items Gap\",\n description: \"The width of the space between menu items in pixels.\",\n type: \"number\",\n min: 0,\n defaultValue: DEFAULT_GAP,\n },\n responsiveBreakpoint: {\n displayName: \"Small Screens Breakpoint\",\n description: \"The maximum screen width used for showing the small screens version of the menu.\",\n type: \"number\",\n min: 0,\n defaultValue: DEFAULT_RESPONSIVE_BREAKPOINT,\n },\n\n // Slots\n brand: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"hbox\",\n tag: \"a\",\n attrs: { href: \"#\" },\n styles: { padding: \"0px\" },\n children: {\n type: \"img\",\n src: \"\",\n styles: { height: \"50px\" },\n },\n },\n ],\n },\n openButton: {\n type: \"slot\",\n defaultValue: {\n type: \"img\",\n src: \"https://static1.plasmic.app/menu.svg\",\n },\n },\n closeButton: {\n type: \"slot\",\n defaultValue: {\n type: \"img\",\n src: \"https://static1.plasmic.app/close.svg\",\n },\n },\n menuItems: {\n type: \"slot\",\n defaultValue: [\"Home\", \"About\", \"Contact\"].map((title) => ({\n type: \"text\",\n tag: \"a\",\n attrs: { href: \"/\" },\n styles: { width: \"auto\" },\n value: title,\n })),\n },\n },\n defaultStyles: {\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n width: \"100%\",\n padding: \"16px\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n marginBottom: \"20px\",\n },\n};\n\nexport function registerNavigationBar(\n loader?: { registerComponent: typeof registerComponent },\n customMetaProps?: ComponentMeta<React.ComponentProps<typeof NavigationBar>>\n) {\n if (loader) {\n loader.registerComponent(\n NavigationBar,\n customMetaProps ?? navigationBarComponentMeta\n );\n } else {\n registerComponent(\n NavigationBar,\n customMetaProps ?? navigationBarComponentMeta\n );\n }\n}\n"],"names":["CSSClasses","menuButton","menuItemsContainer","menuItemsContainerOpen","DEFAULT_GAP","DEFAULT_RESPONSIVE_BREAKPOINT","NavigationBar","props","forceOpenMenu","React","useState","isOpen","setIsOpen","inEditor","useContext","PlasmicCanvasContext","shouldRenderMenu","useMemo","toggleMenu","value","gap","safeParseNumber","itemsGap","responsiveBreakpoint","cssStyles","minifyCss","className","dangerouslySetInnerHTML","__html","brand","onClick","tabIndex","closeButton","openButton","role","trim","menuItems","input","defaultValue","parsedValue","parseInt","isNaN","replace","navigationBarComponentMeta","name","displayName","importName","importPath","description","type","min","tag","attrs","href","styles","padding","children","src","height","map","title","width","defaultStyles","display","flexDirection","justifyContent","flexWrap","alignItems","marginBottom","registerNavigationBar","loader","customMetaProps","registerComponent"],"mappings":";;;;;;;;;AAmBA,IAAMA,UAAU,GAAG;AACjBC,EAAAA,UAAU,EAAE,yBADK;AAEjBC,EAAAA,kBAAkB,EAAE,wBAFH;AAGjBC,EAAAA,sBAAsB,EAAE;AAHP,CAAnB;AAMA,IAAMC,WAAW,GAAG,CAApB;AACA,IAAMC,6BAA6B,GAAG,GAAtC;SACgBC,cAAcC;AAC5B,MAAQC,aAAR,GAA0BD,KAA1B,CAAQC,aAAR;;AACA,wBAA4BC,KAAK,CAACC,QAAN,CAAe,KAAf,CAA5B;AAAA,MAAOC,MAAP;AAAA,MAAeC,SAAf;;AACA,MAAMC,QAAQ,GAAGJ,KAAK,CAACK,UAAN,CAAiBC,yBAAjB,CAAjB;AAEA,MAAMC,gBAAgB,GAAGP,KAAK,CAACQ,OAAN,CAAc;AACrC,QAAIJ,QAAQ,IAAIL,aAAhB,EAA+B;AAC7B,aAAO,IAAP;AACD;;AAED,WAAOG,MAAP;AACD,GANwB,EAMtB,CAACE,QAAD,EAAWL,aAAX,EAA0BG,M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AAI,EAAE;AAAR,WAHkD;AAIzDC,UAAAA,MAAM,EAAE;AAAEO,YAAAA,KAAK,EAAE;AAAT,WAJiD;AAKzD1C,UAAAA,KAAK,EAAEyC;AALkD,SAAZ;AAAA,OAAjC;AAFL;AArDN,GALuD;AAqE9DE,EAAAA,aAAa,EAAE;AACbC,IAAAA,OAAO,EAAE,MADI;AAEbC,IAAAA,aAAa,EAAE,KAFF;AAGbC,IAAAA,cAAc,EAAE,eAHH;AAIbJ,IAAAA,KAAK,EAAE,MAJM;AAKbN,IAAAA,OAAO,EAAE,MALI;AAMbW,IAAAA,QAAQ,EAAE,MANG;AAObC,IAAAA,UAAU,EAAE,QAPC;AAQbC,IAAAA,YAAY,EAAE;AARD;AArE+C;SAiFhDC,sBACdC,QACAC;AAEA,MAAID,MAAJ,EAAY;AACVA,IAAAA,MAAM,CAACE,iBAAP,CACElE,aADF,EAEEiE,eAFF,WAEEA,eAFF,GAEqB5B,0BAFrB;AAID,GALD,MAKO;AACL6B,IAAAA,sBAAiB,CACflE,aADe,EAEfiE,eAFe,WAEfA,eAFe,GAEI5B,0BAFJ,CAAjB;AAID;AACF;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e,t=require("@plasmicapp/host");function a(e){var a=e.forceOpenMenu,s=n.useState(!1),o=s[0],r=s[1],m=n.useContext(t.PlasmicCanvasContext),p=n.useMemo((function(){return!(!m||!a)||o}),[m,a,o]),l=i(e.itemsGap,8),u=i(e.responsiveBreakpoint,768),c=n.useMemo((function(){return("\n /* Shared Styles */\n .plasmic-nav-menu-items {\n display: flex;\n }\n \n .plasmic-nav-menu-items > * {\n flex: 0 0 auto;\n }\n \n /* Desktop Styles */\n @media (min-width: "+(u+1)+"px) {\n .plasmic-nav-menu-button {\n display: none;\n }\n \n .plasmic-nav-menu-items {\n flex-direction: row;\n align-items: center;\n width: auto;\n }\n .plasmic-nav-menu-items > *:not(:first-child) {\n margin-inline-start: "+l+"px;\n }\n }\n \n /* Mobile Styles */\n @media (max-width: "+u+"px) {\n .plasmic-nav-menu-button {\n unset: all;\n -webkit-appearance: none;\n min-width: 40px;\n min-height: 40px;\n padding: 0;\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n background: none;\n cursor: pointer;\n }\n \n .plasmic-nav-menu-items:not(.plasmic-nav-menu-items-open) {\n display: none;\n }\n \n .plasmic-nav-menu-items {\n margin-top: 10px;\n flex-direction: column;\n flex-shrink: 0;\n width: 100%;\n }\n .plasmic-nav-menu-items > *:not(:first-child) {\n margin-top: "+l+"px;\n }\n }\n ").replace(/\s{2,}|\n/g,"").replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/g,"")}),[l,u]);return n.createElement("div",{className:e.className},n.createElement("style",{dangerouslySetInnerHTML:{__html:c}}),n.createElement("div",null,e.brand),n.createElement("button",{className:"plasmic-nav-menu-button",onClick:function(){return r((function(e){return!e}))},tabIndex:0,"aria-expanded":p},p?e.closeButton:e.openButton),n.createElement("nav",{role:"menu",className:("plasmic-nav-menu-items "+(p?"plasmic-nav-menu-items-open":"")).trim()},e.menuItems))}function i(e,n){void 0===n&&(n=0);var t=parseInt(e,10);return isNaN(t)?n:t}var s={name:"plasmic-navigation-bar",displayName:"Navigation Bar",importName:"NavigationBar",importPath:"@plasmicpkgs/plasmic-nav",props:{forceOpenMenu:{displayName:"Force Open Menu",description:"Use this option to open the menu during design time so you can easily customize the close button and menu items for small screens. This option is ignored when publishing the page.",type:"boolean"},itemsGap:{displayName:"Items Gap",description:"The width of the space between menu items in pixels.",type:"number",min:0,defaultValue:8},responsiveBreakpoint:{displayName:"Small Screens Breakpoint",description:"The maximum screen width used for showing the small screens version of the menu.",type:"number",min:0,defaultValue:768},brand:{type:"slot",defaultValue:[{type:"hbox",tag:"a",attrs:{href:"#"},styles:{padding:"0px"},children:{type:"img",src:"",styles:{height:"50px"}}}]},openButton:{type:"slot",defaultValue:{type:"img",src:"https://static1.plasmic.app/menu.svg"}},closeButton:{type:"slot",defaultValue:{type:"img",src:"https://static1.plasmic.app/close.svg"}},menuItems:{type:"slot",defaultValue:["Home","About","Contact"].map((function(e){return{type:"text",tag:"a",attrs:{href:"/"},styles:{width:"auto"},value:e}}))}},defaultStyles:{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",padding:"16px",flexWrap:"wrap",alignItems:"center",marginBottom:"20px"}};exports.NavigationBar=a,exports.navigationBarComponentMeta=s,exports.registerNavigationBar=function(e,n){e?e.registerComponent(a,null!=n?n:s):t.registerComponent(a,null!=n?n:s)};
|
|
2
|
+
//# sourceMappingURL=plasmic-nav.cjs.production.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plasmic-nav.cjs.production.min.js","sources":["../src/PlasmicNavigationBar.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n ComponentMeta,\n registerComponent,\n PlasmicCanvasContext,\n} from \"@plasmicapp/host\";\nimport { CanvasComponentProps } from \"@plasmicapp/host/registerComponent\";\n\ninterface Props extends CanvasComponentProps {\n brand?: React.ReactNode;\n menuItems?: React.ReactNode;\n className?: string;\n closeButton?: React.ReactNode;\n openButton?: React.ReactNode;\n forceOpenMenu?: boolean;\n itemsGap?: number;\n responsiveBreakpoint?: number;\n}\n\nconst CSSClasses = {\n menuButton: \"plasmic-nav-menu-button\",\n menuItemsContainer: \"plasmic-nav-menu-items\",\n menuItemsContainerOpen: \"plasmic-nav-menu-items-open\",\n};\n\nconst DEFAULT_GAP = 8;\nconst DEFAULT_RESPONSIVE_BREAKPOINT = 768;\nexport function NavigationBar(props: Props) {\n const { forceOpenMenu } = props;\n const [isOpen, setIsOpen] = React.useState(false);\n const inEditor = React.useContext(PlasmicCanvasContext);\n\n const shouldRenderMenu = React.useMemo(() => {\n if (inEditor && forceOpenMenu) {\n return true;\n }\n\n return isOpen;\n }, [inEditor, forceOpenMenu, isOpen]);\n\n const toggleMenu = () => setIsOpen((value) => !value);\n\n // Parsing the gap manually to ensure it's a valid number\n // as we are using it in dangerouslySetInnerHTML.\n const gap = safeParseNumber(props.itemsGap, DEFAULT_GAP);\n const responsiveBreakpoint = safeParseNumber(\n props.responsiveBreakpoint,\n DEFAULT_RESPONSIVE_BREAKPOINT\n );\n\n const cssStyles = React.useMemo(\n () =>\n minifyCss(`\n /* Shared Styles */\n .${CSSClasses.menuItemsContainer} {\n display: flex;\n }\n \n .${CSSClasses.menuItemsContainer} > * {\n flex: 0 0 auto;\n }\n \n /* Desktop Styles */\n @media (min-width: ${responsiveBreakpoint + 1}px) {\n .${CSSClasses.menuButton} {\n display: none;\n }\n \n .${CSSClasses.menuItemsContainer} {\n flex-direction: row;\n align-items: center;\n width: auto;\n }\n .${CSSClasses.menuItemsContainer} > *:not(:first-child) {\n margin-inline-start: ${gap}px;\n }\n }\n \n /* Mobile Styles */\n @media (max-width: ${responsiveBreakpoint}px) {\n .${CSSClasses.menuButton} {\n unset: all;\n -webkit-appearance: none;\n min-width: 40px;\n min-height: 40px;\n padding: 0;\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n background: none;\n cursor: pointer;\n }\n \n .${CSSClasses.menuItemsContainer}:not(.${CSSClasses.menuItemsContainerOpen}) {\n display: none;\n }\n \n .${CSSClasses.menuItemsContainer} {\n margin-top: 10px;\n flex-direction: column;\n flex-shrink: 0;\n width: 100%;\n }\n .${CSSClasses.menuItemsContainer} > *:not(:first-child) {\n margin-top: ${gap}px;\n }\n }\n `),\n [gap, responsiveBreakpoint]\n );\n\n return (\n <div className={props.className}>\n <style dangerouslySetInnerHTML={{ __html: cssStyles }} />\n <div>{props.brand}</div>\n <button\n className={CSSClasses.menuButton}\n onClick={toggleMenu}\n tabIndex={0}\n aria-expanded={shouldRenderMenu}\n >\n {shouldRenderMenu ? props.closeButton : props.openButton}\n </button>\n <nav\n role=\"menu\"\n className={`${CSSClasses.menuItemsContainer} ${\n shouldRenderMenu ? CSSClasses.menuItemsContainerOpen : \"\"\n }`.trim()}\n >\n {props.menuItems}\n </nav>\n </div>\n );\n}\n\nfunction safeParseNumber(input: any, defaultValue: number = 0) {\n const parsedValue = parseInt(input, 10);\n return isNaN(parsedValue) ? defaultValue : parsedValue;\n}\n\nfunction minifyCss(input: string) {\n return input\n .replace(/\\s{2,}|\\n/g, \"\") // Remove spaces\n .replace(/\\/\\*[\\s\\S]*?\\*\\/|([^:]|^)\\/\\/.*$/g, \"\"); // Remove comments.\n}\n\nexport const navigationBarComponentMeta: ComponentMeta<Props> = {\n name: `plasmic-navigation-bar`,\n displayName: \"Navigation Bar\",\n importName: \"NavigationBar\",\n importPath: \"@plasmicpkgs/plasmic-nav\",\n props: {\n // Properties\n forceOpenMenu: {\n displayName: \"Force Open Menu\",\n description: \"Use this option to open the menu during design time so you can easily customize the close button and menu items for small screens. This option is ignored when publishing the page.\",\n type: \"boolean\",\n },\n itemsGap: {\n displayName: \"Items Gap\",\n description: \"The width of the space between menu items in pixels.\",\n type: \"number\",\n min: 0,\n defaultValue: DEFAULT_GAP,\n },\n responsiveBreakpoint: {\n displayName: \"Small Screens Breakpoint\",\n description: \"The maximum screen width used for showing the small screens version of the menu.\",\n type: \"number\",\n min: 0,\n defaultValue: DEFAULT_RESPONSIVE_BREAKPOINT,\n },\n\n // Slots\n brand: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"hbox\",\n tag: \"a\",\n attrs: { href: \"#\" },\n styles: { padding: \"0px\" },\n children: {\n type: \"img\",\n src: \"\",\n styles: { height: \"50px\" },\n },\n },\n ],\n },\n openButton: {\n type: \"slot\",\n defaultValue: {\n type: \"img\",\n src: \"https://static1.plasmic.app/menu.svg\",\n },\n },\n closeButton: {\n type: \"slot\",\n defaultValue: {\n type: \"img\",\n src: \"https://static1.plasmic.app/close.svg\",\n },\n },\n menuItems: {\n type: \"slot\",\n defaultValue: [\"Home\", \"About\", \"Contact\"].map((title) => ({\n type: \"text\",\n tag: \"a\",\n attrs: { href: \"/\" },\n styles: { width: \"auto\" },\n value: title,\n })),\n },\n },\n defaultStyles: {\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n width: \"100%\",\n padding: \"16px\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n marginBottom: \"20px\",\n },\n};\n\nexport function registerNavigationBar(\n loader?: { registerComponent: typeof registerComponent },\n customMetaProps?: ComponentMeta<React.ComponentProps<typeof NavigationBar>>\n) {\n if (loader) {\n loader.registerComponent(\n NavigationBar,\n customMetaProps ?? navigationBarComponentMeta\n );\n } else {\n registerComponent(\n NavigationBar,\n customMetaProps ?? navigationBarComponentMeta\n );\n }\n}\n"],"names":["NavigationBar","props","forceOpenMenu","React","useState","isOpen","setIsOpen","inEditor","useContext","PlasmicCanvasContext","shouldRenderMenu","useMemo","gap","safeParseNumber","itemsGap","responsiveBreakpoint","cssStyles","replace","className","dangerouslySetInnerHTML","__html","brand","onClick","value","tabIndex","closeButton","openButton","role","CSSClasses","trim","menuItems","input","defaultValue","parsedValue","parseInt","isNaN","navigationBarComponentMeta","name","displayName","importName","importPath","description","type","min","tag","attrs","href","styles","padding","children","src","height","map","title","width","defaultStyles","display","flexDirection","justifyContent","flexWrap","alignItems","marginBottom","loader","customMetaProps","registerComponent"],"mappings":"uLA2BgBA,EAAcC,OACpBC,EAAkBD,EAAlBC,gBACoBC,EAAMC,UAAS,GAApCC,OAAQC,OACTC,EAAWJ,EAAMK,WAAWC,wBAE5BC,EAAmBP,EAAMQ,SAAQ,oBACjCJ,IAAYL,IAITG,IACN,CAACE,EAAUL,EAAeG,IAMvBO,EAAMC,EAAgBZ,EAAMa,SAnBhB,GAoBZC,EAAuBF,EAC3BZ,EAAMc,qBApB4B,KAwB9BC,EAAYb,EAAMQ,SACtB,2OAYqBI,EAAuB,sSAWjBH,gFAKNG,isBA2BHH,+BAsCjBK,QAAQ,aAAc,IACtBA,QAAQ,oCAAqC,MAnC9C,CAACL,EAAKG,W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Ae,CACbC,QAAS,OACTC,cAAe,MACfC,eAAgB,gBAChBJ,MAAO,OACPN,QAAS,OACTW,SAAU,OACVC,WAAY,SACZC,aAAc,6GAKhBC,EACAC,GAEID,EACFA,EAAOE,kBACLhE,QACA+D,EAAAA,EAAmB3B,GAGrB4B,oBACEhE,QACA+D,EAAAA,EAAmB3B"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PlasmicCanvasContext, registerComponent } from '@plasmicapp/host';
|
|
3
|
+
|
|
4
|
+
var CSSClasses = {
|
|
5
|
+
menuButton: "plasmic-nav-menu-button",
|
|
6
|
+
menuItemsContainer: "plasmic-nav-menu-items",
|
|
7
|
+
menuItemsContainerOpen: "plasmic-nav-menu-items-open"
|
|
8
|
+
};
|
|
9
|
+
var DEFAULT_GAP = 8;
|
|
10
|
+
var DEFAULT_RESPONSIVE_BREAKPOINT = 768;
|
|
11
|
+
function NavigationBar(props) {
|
|
12
|
+
var forceOpenMenu = props.forceOpenMenu;
|
|
13
|
+
|
|
14
|
+
var _React$useState = React.useState(false),
|
|
15
|
+
isOpen = _React$useState[0],
|
|
16
|
+
setIsOpen = _React$useState[1];
|
|
17
|
+
|
|
18
|
+
var inEditor = React.useContext(PlasmicCanvasContext);
|
|
19
|
+
var shouldRenderMenu = React.useMemo(function () {
|
|
20
|
+
if (inEditor && forceOpenMenu) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return isOpen;
|
|
25
|
+
}, [inEditor, forceOpenMenu, isOpen]);
|
|
26
|
+
|
|
27
|
+
var toggleMenu = function toggleMenu() {
|
|
28
|
+
return setIsOpen(function (value) {
|
|
29
|
+
return !value;
|
|
30
|
+
});
|
|
31
|
+
}; // Parsing the gap manually to ensure it's a valid number
|
|
32
|
+
// as we are using it in dangerouslySetInnerHTML.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var gap = safeParseNumber(props.itemsGap, DEFAULT_GAP);
|
|
36
|
+
var responsiveBreakpoint = safeParseNumber(props.responsiveBreakpoint, DEFAULT_RESPONSIVE_BREAKPOINT);
|
|
37
|
+
var cssStyles = React.useMemo(function () {
|
|
38
|
+
return minifyCss("\n /* Shared Styles */\n ." + CSSClasses.menuItemsContainer + " {\n display: flex;\n }\n \n ." + CSSClasses.menuItemsContainer + " > * {\n flex: 0 0 auto;\n }\n \n /* Desktop Styles */\n @media (min-width: " + (responsiveBreakpoint + 1) + "px) {\n ." + CSSClasses.menuButton + " {\n display: none;\n }\n \n ." + CSSClasses.menuItemsContainer + " {\n flex-direction: row;\n align-items: center;\n width: auto;\n }\n ." + CSSClasses.menuItemsContainer + " > *:not(:first-child) {\n margin-inline-start: " + gap + "px;\n }\n }\n \n /* Mobile Styles */\n @media (max-width: " + responsiveBreakpoint + "px) {\n ." + CSSClasses.menuButton + " {\n unset: all;\n -webkit-appearance: none;\n min-width: 40px;\n min-height: 40px;\n padding: 0;\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n background: none;\n cursor: pointer;\n }\n \n ." + CSSClasses.menuItemsContainer + ":not(." + CSSClasses.menuItemsContainerOpen + ") {\n display: none;\n }\n \n ." + CSSClasses.menuItemsContainer + " {\n margin-top: 10px;\n flex-direction: column;\n flex-shrink: 0;\n width: 100%;\n }\n ." + CSSClasses.menuItemsContainer + " > *:not(:first-child) {\n margin-top: " + gap + "px;\n }\n }\n ");
|
|
39
|
+
}, [gap, responsiveBreakpoint]);
|
|
40
|
+
return React.createElement("div", {
|
|
41
|
+
className: props.className
|
|
42
|
+
}, React.createElement("style", {
|
|
43
|
+
dangerouslySetInnerHTML: {
|
|
44
|
+
__html: cssStyles
|
|
45
|
+
}
|
|
46
|
+
}), React.createElement("div", null, props.brand), React.createElement("button", {
|
|
47
|
+
className: CSSClasses.menuButton,
|
|
48
|
+
onClick: toggleMenu,
|
|
49
|
+
tabIndex: 0,
|
|
50
|
+
"aria-expanded": shouldRenderMenu
|
|
51
|
+
}, shouldRenderMenu ? props.closeButton : props.openButton), React.createElement("nav", {
|
|
52
|
+
role: "menu",
|
|
53
|
+
className: (CSSClasses.menuItemsContainer + " " + (shouldRenderMenu ? CSSClasses.menuItemsContainerOpen : "")).trim()
|
|
54
|
+
}, props.menuItems));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function safeParseNumber(input, defaultValue) {
|
|
58
|
+
if (defaultValue === void 0) {
|
|
59
|
+
defaultValue = 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var parsedValue = parseInt(input, 10);
|
|
63
|
+
return isNaN(parsedValue) ? defaultValue : parsedValue;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function minifyCss(input) {
|
|
67
|
+
return input.replace(/\s{2,}|\n/g, "") // Remove spaces
|
|
68
|
+
.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/g, ""); // Remove comments.
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var navigationBarComponentMeta = {
|
|
72
|
+
name: "plasmic-navigation-bar",
|
|
73
|
+
displayName: "Navigation Bar",
|
|
74
|
+
importName: "NavigationBar",
|
|
75
|
+
importPath: "@plasmicpkgs/plasmic-nav",
|
|
76
|
+
props: {
|
|
77
|
+
// Properties
|
|
78
|
+
forceOpenMenu: {
|
|
79
|
+
displayName: "Force Open Menu",
|
|
80
|
+
description: "Use this option to open the menu during design time so you can easily customize the close button and menu items for small screens. This option is ignored when publishing the page.",
|
|
81
|
+
type: "boolean"
|
|
82
|
+
},
|
|
83
|
+
itemsGap: {
|
|
84
|
+
displayName: "Items Gap",
|
|
85
|
+
description: "The width of the space between menu items in pixels.",
|
|
86
|
+
type: "number",
|
|
87
|
+
min: 0,
|
|
88
|
+
defaultValue: DEFAULT_GAP
|
|
89
|
+
},
|
|
90
|
+
responsiveBreakpoint: {
|
|
91
|
+
displayName: "Small Screens Breakpoint",
|
|
92
|
+
description: "The maximum screen width used for showing the small screens version of the menu.",
|
|
93
|
+
type: "number",
|
|
94
|
+
min: 0,
|
|
95
|
+
defaultValue: DEFAULT_RESPONSIVE_BREAKPOINT
|
|
96
|
+
},
|
|
97
|
+
// Slots
|
|
98
|
+
brand: {
|
|
99
|
+
type: "slot",
|
|
100
|
+
defaultValue: [{
|
|
101
|
+
type: "hbox",
|
|
102
|
+
tag: "a",
|
|
103
|
+
attrs: {
|
|
104
|
+
href: "#"
|
|
105
|
+
},
|
|
106
|
+
styles: {
|
|
107
|
+
padding: "0px"
|
|
108
|
+
},
|
|
109
|
+
children: {
|
|
110
|
+
type: "img",
|
|
111
|
+
src: "",
|
|
112
|
+
styles: {
|
|
113
|
+
height: "50px"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}]
|
|
117
|
+
},
|
|
118
|
+
openButton: {
|
|
119
|
+
type: "slot",
|
|
120
|
+
defaultValue: {
|
|
121
|
+
type: "img",
|
|
122
|
+
src: "https://static1.plasmic.app/menu.svg"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
closeButton: {
|
|
126
|
+
type: "slot",
|
|
127
|
+
defaultValue: {
|
|
128
|
+
type: "img",
|
|
129
|
+
src: "https://static1.plasmic.app/close.svg"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
menuItems: {
|
|
133
|
+
type: "slot",
|
|
134
|
+
defaultValue: /*#__PURE__*/["Home", "About", "Contact"].map(function (title) {
|
|
135
|
+
return {
|
|
136
|
+
type: "text",
|
|
137
|
+
tag: "a",
|
|
138
|
+
attrs: {
|
|
139
|
+
href: "/"
|
|
140
|
+
},
|
|
141
|
+
styles: {
|
|
142
|
+
width: "auto"
|
|
143
|
+
},
|
|
144
|
+
value: title
|
|
145
|
+
};
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
defaultStyles: {
|
|
150
|
+
display: "flex",
|
|
151
|
+
flexDirection: "row",
|
|
152
|
+
justifyContent: "space-between",
|
|
153
|
+
width: "100%",
|
|
154
|
+
padding: "16px",
|
|
155
|
+
flexWrap: "wrap",
|
|
156
|
+
alignItems: "center",
|
|
157
|
+
marginBottom: "20px"
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
function registerNavigationBar(loader, customMetaProps) {
|
|
161
|
+
if (loader) {
|
|
162
|
+
loader.registerComponent(NavigationBar, customMetaProps != null ? customMetaProps : navigationBarComponentMeta);
|
|
163
|
+
} else {
|
|
164
|
+
registerComponent(NavigationBar, customMetaProps != null ? customMetaProps : navigationBarComponentMeta);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export { NavigationBar, navigationBarComponentMeta, registerNavigationBar };
|
|
169
|
+
//# sourceMappingURL=plasmic-nav.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plasmic-nav.esm.js","sources":["../src/PlasmicNavigationBar.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n ComponentMeta,\n registerComponent,\n PlasmicCanvasContext,\n} from \"@plasmicapp/host\";\nimport { CanvasComponentProps } from \"@plasmicapp/host/registerComponent\";\n\ninterface Props extends CanvasComponentProps {\n brand?: React.ReactNode;\n menuItems?: React.ReactNode;\n className?: string;\n closeButton?: React.ReactNode;\n openButton?: React.ReactNode;\n forceOpenMenu?: boolean;\n itemsGap?: number;\n responsiveBreakpoint?: number;\n}\n\nconst CSSClasses = {\n menuButton: \"plasmic-nav-menu-button\",\n menuItemsContainer: \"plasmic-nav-menu-items\",\n menuItemsContainerOpen: \"plasmic-nav-menu-items-open\",\n};\n\nconst DEFAULT_GAP = 8;\nconst DEFAULT_RESPONSIVE_BREAKPOINT = 768;\nexport function NavigationBar(props: Props) {\n const { forceOpenMenu } = props;\n const [isOpen, setIsOpen] = React.useState(false);\n const inEditor = React.useContext(PlasmicCanvasContext);\n\n const shouldRenderMenu = React.useMemo(() => {\n if (inEditor && forceOpenMenu) {\n return true;\n }\n\n return isOpen;\n }, [inEditor, forceOpenMenu, isOpen]);\n\n const toggleMenu = () => setIsOpen((value) => !value);\n\n // Parsing the gap manually to ensure it's a valid number\n // as we are using it in dangerouslySetInnerHTML.\n const gap = safeParseNumber(props.itemsGap, DEFAULT_GAP);\n const responsiveBreakpoint = safeParseNumber(\n props.responsiveBreakpoint,\n DEFAULT_RESPONSIVE_BREAKPOINT\n );\n\n const cssStyles = React.useMemo(\n () =>\n minifyCss(`\n /* Shared Styles */\n .${CSSClasses.menuItemsContainer} {\n display: flex;\n }\n \n .${CSSClasses.menuItemsContainer} > * {\n flex: 0 0 auto;\n }\n \n /* Desktop Styles */\n @media (min-width: ${responsiveBreakpoint + 1}px) {\n .${CSSClasses.menuButton} {\n display: none;\n }\n \n .${CSSClasses.menuItemsContainer} {\n flex-direction: row;\n align-items: center;\n width: auto;\n }\n .${CSSClasses.menuItemsContainer} > *:not(:first-child) {\n margin-inline-start: ${gap}px;\n }\n }\n \n /* Mobile Styles */\n @media (max-width: ${responsiveBreakpoint}px) {\n .${CSSClasses.menuButton} {\n unset: all;\n -webkit-appearance: none;\n min-width: 40px;\n min-height: 40px;\n padding: 0;\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n background: none;\n cursor: pointer;\n }\n \n .${CSSClasses.menuItemsContainer}:not(.${CSSClasses.menuItemsContainerOpen}) {\n display: none;\n }\n \n .${CSSClasses.menuItemsContainer} {\n margin-top: 10px;\n flex-direction: column;\n flex-shrink: 0;\n width: 100%;\n }\n .${CSSClasses.menuItemsContainer} > *:not(:first-child) {\n margin-top: ${gap}px;\n }\n }\n `),\n [gap, responsiveBreakpoint]\n );\n\n return (\n <div className={props.className}>\n <style dangerouslySetInnerHTML={{ __html: cssStyles }} />\n <div>{props.brand}</div>\n <button\n className={CSSClasses.menuButton}\n onClick={toggleMenu}\n tabIndex={0}\n aria-expanded={shouldRenderMenu}\n >\n {shouldRenderMenu ? props.closeButton : props.openButton}\n </button>\n <nav\n role=\"menu\"\n className={`${CSSClasses.menuItemsContainer} ${\n shouldRenderMenu ? CSSClasses.menuItemsContainerOpen : \"\"\n }`.trim()}\n >\n {props.menuItems}\n </nav>\n </div>\n );\n}\n\nfunction safeParseNumber(input: any, defaultValue: number = 0) {\n const parsedValue = parseInt(input, 10);\n return isNaN(parsedValue) ? defaultValue : parsedValue;\n}\n\nfunction minifyCss(input: string) {\n return input\n .replace(/\\s{2,}|\\n/g, \"\") // Remove spaces\n .replace(/\\/\\*[\\s\\S]*?\\*\\/|([^:]|^)\\/\\/.*$/g, \"\"); // Remove comments.\n}\n\nexport const navigationBarComponentMeta: ComponentMeta<Props> = {\n name: `plasmic-navigation-bar`,\n displayName: \"Navigation Bar\",\n importName: \"NavigationBar\",\n importPath: \"@plasmicpkgs/plasmic-nav\",\n props: {\n // Properties\n forceOpenMenu: {\n displayName: \"Force Open Menu\",\n description: \"Use this option to open the menu during design time so you can easily customize the close button and menu items for small screens. This option is ignored when publishing the page.\",\n type: \"boolean\",\n },\n itemsGap: {\n displayName: \"Items Gap\",\n description: \"The width of the space between menu items in pixels.\",\n type: \"number\",\n min: 0,\n defaultValue: DEFAULT_GAP,\n },\n responsiveBreakpoint: {\n displayName: \"Small Screens Breakpoint\",\n description: \"The maximum screen width used for showing the small screens version of the menu.\",\n type: \"number\",\n min: 0,\n defaultValue: DEFAULT_RESPONSIVE_BREAKPOINT,\n },\n\n // Slots\n brand: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"hbox\",\n tag: \"a\",\n attrs: { href: \"#\" },\n styles: { padding: \"0px\" },\n children: {\n type: \"img\",\n src: \"\",\n styles: { height: \"50px\" },\n },\n },\n ],\n },\n openButton: {\n type: \"slot\",\n defaultValue: {\n type: \"img\",\n src: \"https://static1.plasmic.app/menu.svg\",\n },\n },\n closeButton: {\n type: \"slot\",\n defaultValue: {\n type: \"img\",\n src: \"https://static1.plasmic.app/close.svg\",\n },\n },\n menuItems: {\n type: \"slot\",\n defaultValue: [\"Home\", \"About\", \"Contact\"].map((title) => ({\n type: \"text\",\n tag: \"a\",\n attrs: { href: \"/\" },\n styles: { width: \"auto\" },\n value: title,\n })),\n },\n },\n defaultStyles: {\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n width: \"100%\",\n padding: \"16px\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n marginBottom: \"20px\",\n },\n};\n\nexport function registerNavigationBar(\n loader?: { registerComponent: typeof registerComponent },\n customMetaProps?: ComponentMeta<React.ComponentProps<typeof NavigationBar>>\n) {\n if (loader) {\n loader.registerComponent(\n NavigationBar,\n customMetaProps ?? navigationBarComponentMeta\n );\n } else {\n registerComponent(\n NavigationBar,\n customMetaProps ?? navigationBarComponentMeta\n );\n }\n}\n"],"names":["CSSClasses","menuButton","menuItemsContainer","menuItemsContainerOpen","DEFAULT_GAP","DEFAULT_RESPONSIVE_BREAKPOINT","NavigationBar","props","forceOpenMenu","React","useState","isOpen","setIsOpen","inEditor","useContext","PlasmicCanvasContext","shouldRenderMenu","useMemo","toggleMenu","value","gap","safeParseNumber","itemsGap","responsiveBreakpoint","cssStyles","minifyCss","className","dangerouslySetInnerHTML","__html","brand","onClick","tabIndex","closeButton","openButton","role","trim","menuItems","input","defaultValue","parsedValue","parseInt","isNaN","replace","navigationBarComponentMeta","name","displayName","importName","importPath","description","type","min","tag","attrs","href","styles","padding","children","src","height","map","title","width","defaultStyles","display","flexDirection","justifyContent","flexWrap","alignItems","marginBottom","registerNavigationBar","loader","customMetaProps","registerComponent"],"mappings":";;;AAmBA,IAAMA,UAAU,GAAG;AACjBC,EAAAA,UAAU,EAAE,yBADK;AAEjBC,EAAAA,kBAAkB,EAAE,wBAFH;AAGjBC,EAAAA,sBAAsB,EAAE;AAHP,CAAnB;AAMA,IAAMC,WAAW,GAAG,CAApB;AACA,IAAMC,6BAA6B,GAAG,GAAtC;SACgBC,cAAcC;AAC5B,MAAQC,aAAR,GAA0BD,KAA1B,CAAQC,aAAR;;AACA,wBAA4BC,KAAK,CAACC,QAAN,CAAe,KAAf,CAA5B;AAAA,MAAOC,MAAP;AAAA,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DLrB,IAAAA,SAAS,EAAE;AACTa,MAAAA,IAAI,EAAE,MADG;AAETX,MAAAA,YAAY,eAAE,CAAC,MAAD,EAAS,OAAT,EAAkB,SAAlB,EAA6BqB,GAA7B,CAAiC,UAACC,KAAD;AAAA,eAAY;AACzDX,UAAAA,IAAI,EAAE,MADmD;AAEzDE,UAAAA,GAAG,EAAE,GAFoD;AAGzDC,UAAAA,KAAK,EAAE;AAAEC,YAAAA,IAAI,EAAE;AAAR,WAHkD;AAIzDC,UAAAA,MAAM,EAAE;AAAEO,YAAAA,KAAK,EAAE;AAAT,WAJiD;AAKzD1C,UAAAA,KAAK,EAAEyC;AALkD,SAAZ;AAAA,OAAjC;AAFL;AArDN,GALuD;AAqE9DE,EAAAA,aAAa,EAAE;AACbC,IAAAA,OAAO,EAAE,MADI;AAEbC,IAAAA,aAAa,EAAE,KAFF;AAGbC,IAAAA,cAAc,EAAE,eAHH;AAIbJ,IAAAA,KAAK,EAAE,MAJM;AAKbN,IAAAA,OAAO,EAAE,MALI;AAMbW,IAAAA,QAAQ,EAAE,MANG;AAObC,IAAAA,UAAU,EAAE,QAPC;AAQbC,IAAAA,YAAY,EAAE;AARD;AArE+C;SAiFhDC,sBACdC,QACAC;AAEA,MAAID,MAAJ,EAAY;AACVA,IAAAA,MAAM,CAACE,iBAAP,CACElE,aADF,EAEEiE,eAFF,WAEEA,eAFF,GAEqB5B,0BAFrB;AAID,GALD,MAKO;AACL6B,IAAAA,iBAAiB,CACflE,aADe,EAEfiE,eAFe,WAEfA,eAFe,GAEI5B,0BAFJ,CAAjB;AAID;AACF;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@plasmicpkgs/plasmic-nav",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "Plasmic mobile navigation menu and registration calls",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"module": "dist/plasmic-nav.esm.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"size-limit": [
|
|
12
|
+
{
|
|
13
|
+
"path": "dist/plasmic-nav.cjs.production.min.js",
|
|
14
|
+
"limit": "10 KB"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"path": "dist/plasmic-nav.esm.js",
|
|
18
|
+
"limit": "10 KB"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsdx build",
|
|
23
|
+
"start": "tsdx watch",
|
|
24
|
+
"test": "tsdx test --passWithNoTests",
|
|
25
|
+
"lint": "tsdx lint",
|
|
26
|
+
"prepare": "yarn build",
|
|
27
|
+
"size": "size-limit",
|
|
28
|
+
"analyze": "size-limit --why"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@plasmicapp/host": "1.0.9",
|
|
32
|
+
"@size-limit/preset-small-lib": "^4.11.0",
|
|
33
|
+
"@types/node": "^14.0.26",
|
|
34
|
+
"@types/react": "^17.0.40",
|
|
35
|
+
"size-limit": "^4.11.0",
|
|
36
|
+
"tsdx": "^0.14.1",
|
|
37
|
+
"tslib": "^2.2.0",
|
|
38
|
+
"typescript": "^3.9.7"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@plasmicapp/host": "^1.0.0",
|
|
42
|
+
"react": ">=16.8.0",
|
|
43
|
+
"react-dom": ">=16.8.0"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"gitHead": "baa29770ee1efd556c2cbe8e6d6266325bf24af6"
|
|
49
|
+
}
|