@frollo/frollo-web-ui 0.0.2 → 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/cjs/index.js +585 -94
- package/esm/fw-button-0f8956b5.js +1323 -0
- package/esm/fw-button.js +2 -0
- package/esm/fw-navigation-menu.js +203 -0
- package/esm/index.js +30 -1021
- package/frollo-web-ui.esm.js +619 -96
- package/index.d.ts +143 -3
- package/package.json +3 -2
- package/tailwind.config.js +4 -2
- package/types/components/fw-button/fw-button.vue.d.ts +98 -0
- package/types/components/fw-button/index.d.ts +2 -0
- package/types/components/fw-navigation-menu/fw-navigation-menu.vue.d.ts +44 -0
- package/types/components/fw-navigation-menu/index.d.ts +2 -0
- package/types/components/index.d.ts +3 -1
- package/types/index-types.esm.d.ts +6 -0
package/esm/fw-button.js
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { defineComponent, ref, createElementVNode, resolveComponent, openBlock, createElementBlock, renderSlot, createCommentVNode, Fragment, renderList, createBlock, withCtx, createTextVNode, toDisplayString, createVNode, Transition } from 'vue';
|
|
2
|
+
import { u as script$1 } from './fw-button-0f8956b5.js';
|
|
3
|
+
|
|
4
|
+
var script = defineComponent({
|
|
5
|
+
name: 'FwNavigationMenu',
|
|
6
|
+
emits: ['action'],
|
|
7
|
+
components: {
|
|
8
|
+
FwButton: script$1
|
|
9
|
+
},
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* An array of menu items
|
|
13
|
+
* `{ to?: string | object; href?: string; label: string; }`
|
|
14
|
+
*/
|
|
15
|
+
menuItems: {
|
|
16
|
+
type: Array
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The label for the action button.
|
|
21
|
+
* Also emits the `action` event.
|
|
22
|
+
*/
|
|
23
|
+
actionLabel: {
|
|
24
|
+
type: String
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
setup: function setup(_props, ctx) {
|
|
28
|
+
var isMobileMenuOpen = ref(false);
|
|
29
|
+
|
|
30
|
+
var toggleMobileMenu = function toggleMobileMenu() {
|
|
31
|
+
return isMobileMenuOpen.value = !isMobileMenuOpen.value;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var actionClicked = function actionClicked() {
|
|
35
|
+
return ctx.emit('action');
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
isMobileMenuOpen: isMobileMenuOpen,
|
|
40
|
+
toggleMobileMenu: toggleMobileMenu,
|
|
41
|
+
actionClicked: actionClicked
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
var _hoisted_1 = {
|
|
47
|
+
"class": "fw-nav-menu relative z-50 h-20 shadow-md"
|
|
48
|
+
};
|
|
49
|
+
var _hoisted_2 = {
|
|
50
|
+
"class": "px-6 flex-1 h-full flex bg-white items-stretch justify-between"
|
|
51
|
+
};
|
|
52
|
+
var _hoisted_3 = {
|
|
53
|
+
key: 0,
|
|
54
|
+
"class": "flex-shrink-0 flex items-center"
|
|
55
|
+
};
|
|
56
|
+
var _hoisted_4 = {
|
|
57
|
+
key: 1,
|
|
58
|
+
"class": "container hidden sm:flex items-center justify-start sm:ml-6"
|
|
59
|
+
};
|
|
60
|
+
var _hoisted_5 = {
|
|
61
|
+
"class": "flex space-x-2"
|
|
62
|
+
};
|
|
63
|
+
var _hoisted_6 = {
|
|
64
|
+
key: 2,
|
|
65
|
+
"class": "hidden sm:flex items-center justify-start sm:ml-6"
|
|
66
|
+
};
|
|
67
|
+
var _hoisted_7 = {
|
|
68
|
+
"class": "flex items-center sm:hidden"
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var _hoisted_8 = /*#__PURE__*/createElementVNode("span", {
|
|
72
|
+
"class": "sr-only"
|
|
73
|
+
}, "Open main menu", -1);
|
|
74
|
+
|
|
75
|
+
var _hoisted_9 = {
|
|
76
|
+
"class": "block h-6 w-6",
|
|
77
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
78
|
+
fill: "none",
|
|
79
|
+
viewBox: "0 0 24 24",
|
|
80
|
+
stroke: "currentColor",
|
|
81
|
+
"aria-hidden": "true"
|
|
82
|
+
};
|
|
83
|
+
var _hoisted_10 = ["d"];
|
|
84
|
+
var _hoisted_11 = {
|
|
85
|
+
key: 0,
|
|
86
|
+
"class": "fw-nav-menu--mobile min-h-screen top-0 left-0 pt-20 absolute w-full flex flex-col justify-between px-2 bg-white shadow-md pb-3 space-y-1"
|
|
87
|
+
};
|
|
88
|
+
var _hoisted_12 = {
|
|
89
|
+
"class": "w-full flex flex-col"
|
|
90
|
+
};
|
|
91
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
92
|
+
var _ctx$menuItems;
|
|
93
|
+
|
|
94
|
+
var _component_FwButton = resolveComponent("FwButton");
|
|
95
|
+
|
|
96
|
+
return openBlock(), createElementBlock("nav", _hoisted_1, [createElementVNode("div", _hoisted_2, [_ctx.$slots.logo ? (openBlock(), createElementBlock("div", _hoisted_3, [renderSlot(_ctx.$slots, "logo")])) : createCommentVNode("", true), ((_ctx$menuItems = _ctx.menuItems) === null || _ctx$menuItems === void 0 ? void 0 : _ctx$menuItems.length) > 0 ? (openBlock(), createElementBlock("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuItems, function (item, i) {
|
|
97
|
+
return openBlock(), createBlock(_component_FwButton, {
|
|
98
|
+
key: i,
|
|
99
|
+
variant: "text",
|
|
100
|
+
href: item.href,
|
|
101
|
+
to: item.to,
|
|
102
|
+
size: "md",
|
|
103
|
+
"aria-current": "page"
|
|
104
|
+
}, {
|
|
105
|
+
"default": withCtx(function () {
|
|
106
|
+
return [createTextVNode(toDisplayString(item.label), 1)];
|
|
107
|
+
}),
|
|
108
|
+
_: 2
|
|
109
|
+
}, 1032, ["href", "to"]);
|
|
110
|
+
}), 128))])])) : createCommentVNode("", true), _ctx.actionLabel ? (openBlock(), createElementBlock("div", _hoisted_6, [createVNode(_component_FwButton, {
|
|
111
|
+
onClick: _ctx.actionClicked,
|
|
112
|
+
size: "md",
|
|
113
|
+
"aria-label": _ctx.actionLabel
|
|
114
|
+
}, {
|
|
115
|
+
"default": withCtx(function () {
|
|
116
|
+
return [createTextVNode(toDisplayString(_ctx.actionLabel), 1)];
|
|
117
|
+
}),
|
|
118
|
+
_: 1
|
|
119
|
+
}, 8, ["onClick", "aria-label"])])) : createCommentVNode("", true), createElementVNode("div", _hoisted_7, [createVNode(_component_FwButton, {
|
|
120
|
+
variant: "text",
|
|
121
|
+
size: "sm",
|
|
122
|
+
onClick: _ctx.toggleMobileMenu
|
|
123
|
+
}, {
|
|
124
|
+
"default": withCtx(function () {
|
|
125
|
+
return [_hoisted_8, (openBlock(), createElementBlock("svg", _hoisted_9, [createElementVNode("path", {
|
|
126
|
+
"stroke-linecap": "round",
|
|
127
|
+
"stroke-linejoin": "round",
|
|
128
|
+
"stroke-width": "2",
|
|
129
|
+
d: _ctx.isMobileMenuOpen ? 'M6 18L18 6M6 6l12 12' : 'M4 6h16M4 12h16M4 18h16'
|
|
130
|
+
}, null, 8, _hoisted_10)]))];
|
|
131
|
+
}),
|
|
132
|
+
_: 1
|
|
133
|
+
}, 8, ["onClick"])])]), createVNode(Transition, {
|
|
134
|
+
name: "slideInLeft"
|
|
135
|
+
}, {
|
|
136
|
+
"default": withCtx(function () {
|
|
137
|
+
var _ctx$menuItems2;
|
|
138
|
+
|
|
139
|
+
return [((_ctx$menuItems2 = _ctx.menuItems) === null || _ctx$menuItems2 === void 0 ? void 0 : _ctx$menuItems2.length) > 0 && _ctx.isMobileMenuOpen ? (openBlock(), createElementBlock("div", _hoisted_11, [createElementVNode("div", _hoisted_12, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuItems, function (item, i) {
|
|
140
|
+
return openBlock(), createBlock(_component_FwButton, {
|
|
141
|
+
key: i,
|
|
142
|
+
"class": "w-full rounded-md px-2",
|
|
143
|
+
variant: "text",
|
|
144
|
+
href: item.href,
|
|
145
|
+
to: item.to,
|
|
146
|
+
size: "md",
|
|
147
|
+
"aria-current": "page"
|
|
148
|
+
}, {
|
|
149
|
+
"default": withCtx(function () {
|
|
150
|
+
return [createTextVNode(toDisplayString(item.label), 1)];
|
|
151
|
+
}),
|
|
152
|
+
_: 2
|
|
153
|
+
}, 1032, ["href", "to"]);
|
|
154
|
+
}), 128))]), _ctx.actionLabel ? (openBlock(), createBlock(_component_FwButton, {
|
|
155
|
+
key: 0,
|
|
156
|
+
"class": "w-full rounded-md px-2",
|
|
157
|
+
onClick: _ctx.actionClicked,
|
|
158
|
+
size: "md"
|
|
159
|
+
}, {
|
|
160
|
+
"default": withCtx(function () {
|
|
161
|
+
return [createTextVNode(toDisplayString(_ctx.actionLabel), 1)];
|
|
162
|
+
}),
|
|
163
|
+
_: 1
|
|
164
|
+
}, 8, ["onClick"])) : createCommentVNode("", true)])) : createCommentVNode("", true)];
|
|
165
|
+
}),
|
|
166
|
+
_: 1
|
|
167
|
+
})]);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function styleInject(css, ref) {
|
|
171
|
+
if ( ref === void 0 ) ref = {};
|
|
172
|
+
var insertAt = ref.insertAt;
|
|
173
|
+
|
|
174
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
175
|
+
|
|
176
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
177
|
+
var style = document.createElement('style');
|
|
178
|
+
style.type = 'text/css';
|
|
179
|
+
|
|
180
|
+
if (insertAt === 'top') {
|
|
181
|
+
if (head.firstChild) {
|
|
182
|
+
head.insertBefore(style, head.firstChild);
|
|
183
|
+
} else {
|
|
184
|
+
head.appendChild(style);
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
head.appendChild(style);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (style.styleSheet) {
|
|
191
|
+
style.styleSheet.cssText = css;
|
|
192
|
+
} else {
|
|
193
|
+
style.appendChild(document.createTextNode(css));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
var css_248z = ".fw-nav-menu--mobile{z-index:-1}.fw-nav-menu--mobile,.slideInLeft-enter-active{-webkit-transition:left .35s ease-in;-o-transition:left .35s ease-in;transition:left .35s ease-in}.slideInLeft-enter-active{-webkit-animation:slideInLeft .35s;animation:slideInLeft .35s}.slideInLeft-leave-active{animation:slideInLeft .35s reverse;-webkit-transition:left .35s ease-in-out;-o-transition:left .35s ease-in-out;transition:left .35s ease-in-out}@-webkit-keyframes slideInLeft{0%{left:100%}to{left:0}}@keyframes slideInLeft{0%{left:100%}to{left:0}}";
|
|
198
|
+
var stylesheet = ".fw-nav-menu--mobile{z-index:-1}.fw-nav-menu--mobile,.slideInLeft-enter-active{-webkit-transition:left .35s ease-in;-o-transition:left .35s ease-in;transition:left .35s ease-in}.slideInLeft-enter-active{-webkit-animation:slideInLeft .35s;animation:slideInLeft .35s}.slideInLeft-leave-active{animation:slideInLeft .35s reverse;-webkit-transition:left .35s ease-in-out;-o-transition:left .35s ease-in-out;transition:left .35s ease-in-out}@-webkit-keyframes slideInLeft{0%{left:100%}to{left:0}}@keyframes slideInLeft{0%{left:100%}to{left:0}}";
|
|
199
|
+
styleInject(css_248z);
|
|
200
|
+
|
|
201
|
+
script.render = render;
|
|
202
|
+
|
|
203
|
+
export { script as FwNavigationMenu };
|