@oneb/ui-vue 0.0.8 → 0.0.10

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/index.js CHANGED
@@ -1,24 +1,26 @@
1
1
  import { OneButton as O } from "./button/index.js";
2
- import { OneCard as d, OneCardBody as m, OneCardFooter as t, OneCardHeader as p } from "./card/index.js";
3
- import { OneForm as F, OneFormFeedback as i, OneFormField as f, OneFormInput as u, OneFormLabel as w } from "./form/index.js";
4
- import { d as C, c as D, _ as b, O as B, a as c, b as l } from "./index-8ee43fa4.js";
2
+ import { OneCard as m, OneCardBody as t, OneCardFooter as d, OneCardHeader as p } from "./card/index.js";
3
+ import { OneForm as f, OneFormFeedback as s, OneFormField as x, OneFormInput as i, OneFormLabel as u } from "./form/index.js";
4
+ import { c as C, _ as D, a as b, b as B } from "./OneBrowserMenu.vue_vue_type_script_setup_true_lang-8d34213c.js";
5
+ import { OneDropdownDivider as l } from "./dropdown/index.js";
6
+ import { OneAvatar as I } from "./common/index.js";
5
7
  import "vue";
6
8
  import "./_plugin-vue_export-helper-dad06003.js";
7
9
  export {
8
- C as OneAvatar,
9
- D as OneBrowserMenu,
10
+ I as OneAvatar,
11
+ C as OneBrowserMenu,
10
12
  O as OneButton,
11
- d as OneCard,
12
- m as OneCardBody,
13
- t as OneCardFooter,
13
+ m as OneCard,
14
+ t as OneCardBody,
15
+ d as OneCardFooter,
14
16
  p as OneCardHeader,
15
- b as OneDropdown,
16
- B as OneDropdownDivider,
17
- c as OneDropdownItem,
18
- F as OneForm,
19
- i as OneFormFeedback,
20
- f as OneFormField,
21
- u as OneFormInput,
22
- w as OneFormLabel,
23
- l as OneUserMenu
17
+ D as OneDropdown,
18
+ l as OneDropdownDivider,
19
+ b as OneDropdownItem,
20
+ f as OneForm,
21
+ s as OneFormFeedback,
22
+ x as OneFormField,
23
+ i as OneFormInput,
24
+ u as OneFormLabel,
25
+ B as OneUserMenu
24
26
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),y=require("../_plugin-vue_export-helper-f246444f.cjs"),k=require("../OneBrowserMenu.vue_vue_type_script_setup_true_lang-4c394828.cjs");require("../common/index.cjs");const _={};function x(r,o){return e.openBlock(),e.createElementBlock("div",null," header ")}const N=y._export_sfc(_,[["render",x]]),g={items:{required:!0,type:Array},slim:{type:Boolean,default:!0}},B={route:{required:!1,type:[Object,String]},routeName:{required:!1,type:String},handler:{required:!1,type:Function,default(){return()=>{}}},label:{type:String,required:!0},icon:{type:[Function,Object]},exact:{type:Boolean,required:!1,default:!1},slim:{type:Boolean,default:!0}},V={sidebarItems:g.items,logoSrc:{type:String},app:{required:!0,type:Object},user:{type:Object,required:!0},labels:{type:Object},handlers:{type:Object}},E=e.defineComponent({__name:"OneSidebarLink",props:B,setup(r){return(o,l)=>{const n=e.resolveComponent("RouterLink");return e.openBlock(),e.createBlock(n,{to:o.routeName?{name:o.routeName}:o.route,class:e.normalizeClass(["flex items-center w-full p-[8px] rounded-lg text-sm font-medium hover:bg-primary-10-hover hover:text-primary-base transition-all text-primary-content",[o.slim?"w-[44px] h-[44px] justify-center":"h-[44px] justify-start"]]),"active-class":o.exact?"":"bg-primary-10 !text-primary-base","exact-active-class":o.exact?"bg-primary-10 !text-primary-base":"",exact:o.exact},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex flex-nowrap items-center",[o.slim?"w-[24px] h-[24px]":"w-full"]])},[o.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon),{key:0,class:"w-[24px] h-[24px] flex-shrink-0"})):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["whitespace-nowrap overflow-hidden text-ellipsis transition-all text-left flex-shrink",[o.slim?"w-0":"pl-1.5 w-full"]])},e.toDisplayString(o.label),3)],2)]),_:1},8,["to","active-class","exact-active-class","exact","class"])}}}),C={class:""},S={class:"space-y-2 p-2"},v=e.defineComponent({__name:"OneSidebar",props:g,setup(r){return(o,l)=>(e.openBlock(),e.createElementBlock("div",C,[e.createElementVNode("div",S,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.items,n=>(e.openBlock(),e.createBlock(E,{key:n.label,icon:n.icon,label:n.label,route:n.route,"route-name":n.routeName,exact:n.exact||!1,slim:o.slim},null,8,["icon","label","route","route-name","exact","slim"]))),128))])]))}});function O(r,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"})])}const j={class:"min-h-screen relative"},q={class:"header h-[56px] flex items-center flex-nowrap absolute top-0 left-0 w-screen"},L={class:"p-2 flex-shrink-0"},$={class:"w-10 h-10 bg-white rounded-lg border border-secondary-stroke flex items-center flex-shrink-0"},M=["src"],z={class:"text-xs"},A={class:"w-full"},D={class:"w-full flex justify-end pr-2"},I={class:"flex items-center space-x-1"},P={class:"body w-full h-full"},R=e.defineComponent({__name:"OneMainLayout",props:V,setup(r){const o=r,l=e.ref(window.localStorage.getItem("sidebar-slim")==="1");e.watch(l,t=>{window.localStorage.setItem("sidebar-slim",String(t?1:0))});const n=e.computed(()=>{var t,a;return{name:((t=o.app)==null?void 0:t.workspace)||"",photo_url:((a=o.app)==null?void 0:a.photo_url)||""}});return(t,a)=>{var s,c,i,p,u,d,m,h,f,b;const w=e.resolveComponent("RouterLink");return e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",q,[e.createElementVNode("div",L,[e.createElementVNode("button",{onClick:a[0]||(a[0]=F=>l.value=!l.value),class:"w-[44px] h-[44px] p-[8px] flex items-center justify-center hover:text-secondary-content"},[e.createVNode(e.unref(O),{class:"w-[24px] h-[24px]"})])]),e.createElementVNode("div",$,[t.logoSrc!=null?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.logoSrc,class:"w-8 h-8 mx-auto",alt:"logo"},null,8,M)):e.createCommentVNode("",!0)]),t.app!=null?(e.openBlock(),e.createBlock(w,{key:0,to:"/",class:"pl-2 max-w-xs"},{default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(t.app.name),1),e.createElementVNode("div",z,e.toDisplayString(t.app.workspace),1)]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",A,[e.createElementVNode("div",D,[e.createElementVNode("div",I,[e.createVNode(k._sfc_main$3,{workspace:n.value,apps:((s=t.app)==null?void 0:s.apps)||[],"change-label":((c=t.labels)==null?void 0:c.change)||"Change","apps-title":((i=t.labels)==null?void 0:i.apps)||"Apps","on-app":(p=t.handlers)==null?void 0:p.onApp,"on-change":(u=t.handlers)==null?void 0:u.onChange,onOpen:(d=t.handlers)==null?void 0:d.onBrowse},null,8,["workspace","apps","change-label","apps-title","on-app","on-change","onOpen"]),e.createVNode(k._sfc_main$2,{user:t.user,"account-label":((m=t.labels)==null?void 0:m.account)||"Account","logout-label":((h=t.labels)==null?void 0:h.logout)||"Logout","on-account":(f=t.handlers)==null?void 0:f.onAccount,"on-logout":(b=t.handlers)==null?void 0:b.onLogout},null,8,["user","account-label","logout-label","on-account","on-logout"])])])])]),e.createElementVNode("div",{class:e.normalizeClass(["sidebar transition-all absolute top-[56px] left-0 h-full",[l.value?"w-[60px]":"w-60"]])},[e.createVNode(v,{slim:l.value,items:t.sidebarItems},null,8,["slim","items"])],2),e.createElementVNode("div",P,[e.createElementVNode("div",{class:e.normalizeClass(["content transition-all pt-[56px]",[l.value?"pl-[60px]":"pl-60"]])},[e.renderSlot(t.$slots,"default")],2)])])}}});exports.OneHeader=N;exports.OneMainLayout=R;exports.OneSidebar=v;
@@ -0,0 +1,3 @@
1
+ export { default as OneHeader } from './OneHeader.vue';
2
+ export { default as OneSidebar } from './OneSidebar.vue';
3
+ export { default as OneMainLayout } from './OneMainLayout.vue';
@@ -0,0 +1,228 @@
1
+ import { openBlock as a, createElementBlock as l, defineComponent as h, resolveComponent as O, createBlock as u, normalizeClass as p, withCtx as L, createElementVNode as s, resolveDynamicComponent as $, createCommentVNode as d, toDisplayString as m, Fragment as q, renderList as B, ref as N, watch as A, computed as I, createVNode as c, unref as M, renderSlot as R } from "vue";
2
+ import { _ as F } from "../_plugin-vue_export-helper-dad06003.js";
3
+ import { c as P, b as V } from "../OneBrowserMenu.vue_vue_type_script_setup_true_lang-8d34213c.js";
4
+ import "../common/index.js";
5
+ const D = {};
6
+ function E(r, t) {
7
+ return a(), l("div", null, " header ");
8
+ }
9
+ const ce = /* @__PURE__ */ F(D, [["render", E]]), j = {
10
+ items: {
11
+ required: !0,
12
+ type: Array
13
+ },
14
+ slim: {
15
+ type: Boolean,
16
+ default: !0
17
+ }
18
+ }, z = {
19
+ route: {
20
+ required: !1,
21
+ type: [Object, String]
22
+ },
23
+ routeName: {
24
+ required: !1,
25
+ type: String
26
+ },
27
+ handler: {
28
+ required: !1,
29
+ type: Function,
30
+ default() {
31
+ return () => {
32
+ };
33
+ }
34
+ },
35
+ label: {
36
+ type: String,
37
+ required: !0
38
+ },
39
+ icon: {
40
+ type: [Function, Object]
41
+ },
42
+ exact: {
43
+ type: Boolean,
44
+ required: !1,
45
+ default: !1
46
+ },
47
+ slim: {
48
+ type: Boolean,
49
+ default: !0
50
+ }
51
+ }, H = {
52
+ sidebarItems: j.items,
53
+ logoSrc: {
54
+ type: String
55
+ },
56
+ app: {
57
+ required: !0,
58
+ type: Object
59
+ },
60
+ user: {
61
+ type: Object,
62
+ required: !0
63
+ },
64
+ labels: {
65
+ type: Object
66
+ },
67
+ handlers: {
68
+ type: Object
69
+ }
70
+ }, G = /* @__PURE__ */ h({
71
+ __name: "OneSidebarLink",
72
+ props: z,
73
+ setup(r) {
74
+ return (t, n) => {
75
+ const o = O("RouterLink");
76
+ return a(), u(o, {
77
+ to: t.routeName ? { name: t.routeName } : t.route,
78
+ class: p(["flex items-center w-full p-[8px] rounded-lg text-sm font-medium hover:bg-primary-10-hover hover:text-primary-base transition-all text-primary-content", [t.slim ? "w-[44px] h-[44px] justify-center" : "h-[44px] justify-start"]]),
79
+ "active-class": t.exact ? "" : "bg-primary-10 !text-primary-base",
80
+ "exact-active-class": t.exact ? "bg-primary-10 !text-primary-base" : "",
81
+ exact: t.exact
82
+ }, {
83
+ default: L(() => [
84
+ s("div", {
85
+ class: p(["flex flex-nowrap items-center", [t.slim ? "w-[24px] h-[24px]" : "w-full"]])
86
+ }, [
87
+ t.icon ? (a(), u($(t.icon), {
88
+ key: 0,
89
+ class: "w-[24px] h-[24px] flex-shrink-0"
90
+ })) : d("", !0),
91
+ s("div", {
92
+ class: p(["whitespace-nowrap overflow-hidden text-ellipsis transition-all text-left flex-shrink", [t.slim ? "w-0" : "pl-1.5 w-full"]])
93
+ }, m(t.label), 3)
94
+ ], 2)
95
+ ]),
96
+ _: 1
97
+ }, 8, ["to", "active-class", "exact-active-class", "exact", "class"]);
98
+ };
99
+ }
100
+ }), J = { class: "" }, K = { class: "space-y-2 p-2" }, Q = /* @__PURE__ */ h({
101
+ __name: "OneSidebar",
102
+ props: j,
103
+ setup(r) {
104
+ return (t, n) => (a(), l("div", J, [
105
+ s("div", K, [
106
+ (a(!0), l(q, null, B(t.items, (o) => (a(), u(G, {
107
+ key: o.label,
108
+ icon: o.icon,
109
+ label: o.label,
110
+ route: o.route,
111
+ "route-name": o.routeName,
112
+ exact: o.exact || !1,
113
+ slim: t.slim
114
+ }, null, 8, ["icon", "label", "route", "route-name", "exact", "slim"]))), 128))
115
+ ])
116
+ ]));
117
+ }
118
+ });
119
+ function T(r, t) {
120
+ return a(), l("svg", {
121
+ xmlns: "http://www.w3.org/2000/svg",
122
+ fill: "none",
123
+ viewBox: "0 0 24 24",
124
+ "stroke-width": "1.8",
125
+ stroke: "currentColor",
126
+ "aria-hidden": "true"
127
+ }, [
128
+ s("path", {
129
+ "stroke-linecap": "round",
130
+ "stroke-linejoin": "round",
131
+ d: "M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"
132
+ })
133
+ ]);
134
+ }
135
+ const U = { class: "min-h-screen relative" }, W = { class: "header h-[56px] flex items-center flex-nowrap absolute top-0 left-0 w-screen" }, X = { class: "p-2 flex-shrink-0" }, Y = { class: "w-10 h-10 bg-white rounded-lg border border-secondary-stroke flex items-center flex-shrink-0" }, Z = ["src"], ee = { class: "text-xs" }, te = { class: "w-full" }, se = { class: "w-full flex justify-end pr-2" }, oe = { class: "flex items-center space-x-1" }, ae = { class: "body w-full h-full" }, ue = /* @__PURE__ */ h({
136
+ __name: "OneMainLayout",
137
+ props: H,
138
+ setup(r) {
139
+ const t = r, n = N(window.localStorage.getItem("sidebar-slim") === "1");
140
+ A(n, (e) => {
141
+ window.localStorage.setItem("sidebar-slim", String(e ? 1 : 0));
142
+ });
143
+ const o = I(() => {
144
+ var e, i;
145
+ return {
146
+ name: ((e = t.app) == null ? void 0 : e.workspace) || "",
147
+ photo_url: ((i = t.app) == null ? void 0 : i.photo_url) || ""
148
+ };
149
+ });
150
+ return (e, i) => {
151
+ var f, b, w, v, y, g, _, x, k, S;
152
+ const C = O("RouterLink");
153
+ return a(), l("div", U, [
154
+ s("div", W, [
155
+ s("div", X, [
156
+ s("button", {
157
+ onClick: i[0] || (i[0] = (ne) => n.value = !n.value),
158
+ class: "w-[44px] h-[44px] p-[8px] flex items-center justify-center hover:text-secondary-content"
159
+ }, [
160
+ c(M(T), { class: "w-[24px] h-[24px]" })
161
+ ])
162
+ ]),
163
+ s("div", Y, [
164
+ e.logoSrc != null ? (a(), l("img", {
165
+ key: 0,
166
+ src: e.logoSrc,
167
+ class: "w-8 h-8 mx-auto",
168
+ alt: "logo"
169
+ }, null, 8, Z)) : d("", !0)
170
+ ]),
171
+ e.app != null ? (a(), u(C, {
172
+ key: 0,
173
+ to: "/",
174
+ class: "pl-2 max-w-xs"
175
+ }, {
176
+ default: L(() => [
177
+ s("div", null, m(e.app.name), 1),
178
+ s("div", ee, m(e.app.workspace), 1)
179
+ ]),
180
+ _: 1
181
+ })) : d("", !0),
182
+ s("div", te, [
183
+ s("div", se, [
184
+ s("div", oe, [
185
+ c(P, {
186
+ workspace: o.value,
187
+ apps: ((f = e.app) == null ? void 0 : f.apps) || [],
188
+ "change-label": ((b = e.labels) == null ? void 0 : b.change) || "Change",
189
+ "apps-title": ((w = e.labels) == null ? void 0 : w.apps) || "Apps",
190
+ "on-app": (v = e.handlers) == null ? void 0 : v.onApp,
191
+ "on-change": (y = e.handlers) == null ? void 0 : y.onChange,
192
+ onOpen: (g = e.handlers) == null ? void 0 : g.onBrowse
193
+ }, null, 8, ["workspace", "apps", "change-label", "apps-title", "on-app", "on-change", "onOpen"]),
194
+ c(V, {
195
+ user: e.user,
196
+ "account-label": ((_ = e.labels) == null ? void 0 : _.account) || "Account",
197
+ "logout-label": ((x = e.labels) == null ? void 0 : x.logout) || "Logout",
198
+ "on-account": (k = e.handlers) == null ? void 0 : k.onAccount,
199
+ "on-logout": (S = e.handlers) == null ? void 0 : S.onLogout
200
+ }, null, 8, ["user", "account-label", "logout-label", "on-account", "on-logout"])
201
+ ])
202
+ ])
203
+ ])
204
+ ]),
205
+ s("div", {
206
+ class: p(["sidebar transition-all absolute top-[56px] left-0 h-full", [n.value ? "w-[60px]" : "w-60"]])
207
+ }, [
208
+ c(Q, {
209
+ slim: n.value,
210
+ items: e.sidebarItems
211
+ }, null, 8, ["slim", "items"])
212
+ ], 2),
213
+ s("div", ae, [
214
+ s("div", {
215
+ class: p(["content transition-all pt-[56px]", [n.value ? "pl-[60px]" : "pl-60"]])
216
+ }, [
217
+ R(e.$slots, "default")
218
+ ], 2)
219
+ ])
220
+ ]);
221
+ };
222
+ }
223
+ });
224
+ export {
225
+ ce as OneHeader,
226
+ ue as OneMainLayout,
227
+ Q as OneSidebar
228
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneb/ui-vue",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -37,6 +37,14 @@
37
37
  "types": "./dist/dropdown/index.d.ts",
38
38
  "import": "./dist/dropdown/index.js"
39
39
  },
40
+ "./common": {
41
+ "types": "./dist/common/index.d.ts",
42
+ "import": "./dist/common/index.js"
43
+ },
44
+ "./layout": {
45
+ "types": "./dist/layout/index.d.ts",
46
+ "import": "./dist/layout/index.js"
47
+ },
40
48
  "./icons": {
41
49
  "types": "./dist/icons/outline/index.d.ts",
42
50
  "import": "./dist/icons/outline/esm/index.js",