@oneb/ui-vue 0.0.13 → 0.0.15

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),p=require("../_plugin-vue_export-helper-f246444f.cjs");const b={},g={class:"spinner",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{animation:"one-sp-ico-rot 2.7s linear infinite"}},m=e.createElementVNode("circle",{style:{"stroke-linecap":"round",animation:"one-sp-ico-dash 1.7s ease-in-out infinite"},class:"opacity-75",cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor","stroke-width":"2"},null,-1),h=[m];function f(t,n){return e.openBlock(),e.createElementBlock("svg",g,h)}const y=p._export_sfc(b,[["render",f]]),v={variant:{type:String,default:"primary"},size:{type:String,default:"md"},label:{type:String},icon:{type:[Function,Object]},isLoading:{type:Boolean},isSubmit:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},active:{type:Boolean,default:!1},iconClass:{type:[String,Array]}},w=["relative inline-flex","border","items-center justify-center","font-medium whitespace-nowrap","disabled:opacity-50 disabled:cursor-default","focus:outline-none focus:ring-2 focus:ring-offset-2","transition-colors duration-200"],k={sm:["px-2 py-1 text-sm"],md:["px-3 py-2"],lg:["px-4 py-3"]},_={primary:["rounded-md border-transparent bg-primary-base disabled:bg-primary-hover text-white hover:bg-primary-hover focus:ring-primary-glow"],secondary:["rounded-md border-primary-stroke bg-primary-body disabled:bg-primary-body-hover text-black hover:bg-primary-body-hover focus:ring-tertiary-glow"],info:["rounded-md border-transparent bg-info-base disabled:bg-info-hover text-white hover:bg-info-hover focus:ring-info-glow"],success:["rounded-md border-transparent bg-success-base disabled:bg-success-hover text-white hover:bg-success-hover focus:ring-success-glow"],warning:["rounded-md border-transparent bg-warning-base disabled:bg-warning-hover text-white hover:bg-warning-hover focus:ring-warning-glow"],danger:["rounded-md border-transparent bg-danger-base disabled:bg-danger-hover text-white hover:bg-danger-hover focus:ring-danger-glow"],touch:["rounded-full border-transparent text-black hover:bg-primary-body-hover hover:shadow p-3 focus:ring-tertiary-glow"],link:["rounded-md border-transparent items-center text-info-base hover:text-info-hover"],none:["rounded-md border-transparent text-gray-500"]},C=(t="primary",n="md")=>{const o=[];return o.push(...w),o.push(..._[t]??[]),t!=="touch"&&o.push(...k[n]??[]),o},B=["disabled","title","type","onClick"],x=e.defineComponent({__name:"OneButton",props:v,emits:["click"],setup(t,{emit:n}){const o=t,a=()=>{n("click")},r=e.computed(()=>o.icon),l=e.computed(()=>{const s=C(o.variant,o.size);return o.variant==="touch"&&o.active&&s.push("bg-primary-body-active"),s}),c=e.computed(()=>o.disabled||o.isLoading),d=e.computed(()=>o.label&&o.label.length>0&&o.variant!=="touch"),u=e.computed(()=>{const s=["inline-block text-ellipsis overflow-hidden"];return(o.icon!=null||o.isLoading)&&s.push("ml-2"),s}),i=e.computed(()=>{const s=[];return o.size==="sm"?s.push("w-3 h-3"):o.size==="lg"?s.push("w-5 h-5"):s.push("w-4 h-4"),typeof o.iconClass=="string"?s.push(o.iconClass):o.iconClass instanceof Array&&s.push(...o.iconClass),s});return(s,L)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(l.value),disabled:c.value,title:s.label,type:s.isSubmit?"submit":"button",onClick:e.withModifiers(a,["stop"])},[s.isLoading?(e.openBlock(),e.createBlock(y,{key:0,class:e.normalizeClass(i.value)},null,8,["class"])):r.value!=null?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:1,class:e.normalizeClass(i.value)},null,8,["class"])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass(u.value)},e.toDisplayString(s.label),3)):e.createCommentVNode("",!0)],10,B))}});exports.OneButton=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),p=require("../_plugin-vue_export-helper-f246444f.cjs");const b={},m={class:"spinner",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{animation:"one-sp-ico-rot 2.7s linear infinite"}},g=e.createElementVNode("circle",{style:{"stroke-linecap":"round",animation:"one-sp-ico-dash 1.7s ease-in-out infinite"},class:"opacity-75",cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor","stroke-width":"2"},null,-1),h=[g];function f(o,n){return e.openBlock(),e.createElementBlock("svg",m,h)}const y=p._export_sfc(b,[["render",f]]),v={variant:{type:String,default:"primary"},size:{type:String,default:"md"},label:{type:String},icon:{type:[Function,Object]},isLoading:{type:Boolean},isSubmit:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},active:{type:Boolean,default:!1},iconClass:{type:[String,Array]}},w=["relative inline-flex","border","items-center justify-center","font-medium whitespace-nowrap","disabled:opacity-50 disabled:cursor-default","focus:outline-none focus:ring-2 focus:ring-offset-2","transition-colors duration-200"],x={sm:["px-2 py-1 text-sm"],md:["px-3 py-2"],lg:["px-4 py-3"]},k={primary:["rounded-md border-transparent bg-primary-base disabled:bg-primary-hover text-sm text-white hover:bg-primary-hover focus:ring-primary-glow"],secondary:["rounded-md border-primary-stroke bg-primary-body disabled:bg-primary-body-hover text-black text-sm hover:bg-primary-body-hover focus:ring-tertiary-glow"],info:["rounded-md border-transparent bg-info-base disabled:bg-info-hover text-white text-sm hover:bg-info-hover focus:ring-info-glow"],success:["rounded-md border-transparent bg-success-base disabled:bg-success-hover text-white text-sm hover:bg-success-hover focus:ring-success-glow"],warning:["rounded-md border-transparent bg-warning-base disabled:bg-warning-hover text-white text-sm hover:bg-warning-hover focus:ring-warning-glow"],danger:["rounded-md border-transparent bg-danger-base disabled:bg-danger-hover text-white text-sm hover:bg-danger-hover focus:ring-danger-glow"],touch:["rounded-full border-transparent text-black hover:bg-primary-body-hover hover:shadow p-3 text-sm focus:ring-tertiary-glow"],link:["rounded-md border-transparent items-center text-info-base hover:text-info-hover text-sm"],none:["rounded-md border-transparent text-gray-500"]},_=(o="primary",n="md")=>{const t=[];return t.push(...w),t.push(...k[o]??[]),o!=="touch"&&t.push(...x[n]??[]),t},C=["disabled","title","type","onClick"],B=e.defineComponent({__name:"OneButton",props:v,emits:["click"],setup(o,{emit:n}){const t=o,a=()=>{n("click")},r=e.computed(()=>t.icon),l=e.computed(()=>{const s=_(t.variant,t.size);return t.variant==="touch"&&t.active&&s.push("bg-primary-body-active"),s}),c=e.computed(()=>t.disabled||t.isLoading),d=e.computed(()=>t.label&&t.label.length>0&&t.variant!=="touch"),u=e.computed(()=>{const s=["inline-block text-ellipsis overflow-hidden"];return(t.icon!=null||t.isLoading)&&s.push("ml-2"),s}),i=e.computed(()=>{const s=[];return t.size==="sm"?s.push("w-3 h-3"):t.size==="lg"?s.push("w-5 h-5"):s.push("w-4 h-4"),typeof t.iconClass=="string"?s.push(t.iconClass):t.iconClass instanceof Array&&s.push(...t.iconClass),s});return(s,L)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(l.value),disabled:c.value,title:s.label,type:s.isSubmit?"submit":"button",onClick:e.withModifiers(a,["stop"])},[s.isLoading?(e.openBlock(),e.createBlock(y,{key:0,class:e.normalizeClass(i.value)},null,8,["class"])):r.value!=null?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:1,class:e.normalizeClass(i.value)},null,8,["class"])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass(u.value)},e.toDisplayString(s.label),3)):e.createCommentVNode("",!0)],10,C))}});exports.OneButton=B;
@@ -1,11 +1,11 @@
1
- import { openBlock as o, createElementBlock as a, createElementVNode as m, defineComponent as y, computed as t, normalizeClass as i, withModifiers as v, createBlock as d, resolveDynamicComponent as w, createCommentVNode as u, toDisplayString as _ } from "vue";
2
- import { _ as k } from "../_plugin-vue_export-helper-dad06003.js";
3
- const x = {}, C = {
1
+ import { openBlock as o, createElementBlock as a, createElementVNode as f, defineComponent as y, computed as t, normalizeClass as i, withModifiers as v, createBlock as d, resolveDynamicComponent as w, createCommentVNode as u, toDisplayString as x } from "vue";
2
+ import { _ } from "../_plugin-vue_export-helper-dad06003.js";
3
+ const k = {}, C = {
4
4
  class: "spinner",
5
5
  xmlns: "http://www.w3.org/2000/svg",
6
6
  viewBox: "0 0 24 24",
7
7
  style: { animation: "one-sp-ico-rot 2.7s linear infinite" }
8
- }, B = /* @__PURE__ */ m("circle", {
8
+ }, B = /* @__PURE__ */ f("circle", {
9
9
  style: { "stroke-linecap": "round", animation: "one-sp-ico-dash 1.7s ease-in-out infinite" },
10
10
  class: "opacity-75",
11
11
  cx: "12",
@@ -20,7 +20,7 @@ const x = {}, C = {
20
20
  function S(n, r) {
21
21
  return o(), a("svg", C, L);
22
22
  }
23
- const z = /* @__PURE__ */ k(x, [["render", S]]), I = {
23
+ const z = /* @__PURE__ */ _(k, [["render", S]]), I = {
24
24
  variant: {
25
25
  type: String,
26
26
  default: "primary"
@@ -66,14 +66,14 @@ const z = /* @__PURE__ */ k(x, [["render", S]]), I = {
66
66
  md: ["px-3 py-2"],
67
67
  lg: ["px-4 py-3"]
68
68
  }, j = {
69
- primary: ["rounded-md border-transparent bg-primary-base disabled:bg-primary-hover text-white hover:bg-primary-hover focus:ring-primary-glow"],
70
- secondary: ["rounded-md border-primary-stroke bg-primary-body disabled:bg-primary-body-hover text-black hover:bg-primary-body-hover focus:ring-tertiary-glow"],
71
- info: ["rounded-md border-transparent bg-info-base disabled:bg-info-hover text-white hover:bg-info-hover focus:ring-info-glow"],
72
- success: ["rounded-md border-transparent bg-success-base disabled:bg-success-hover text-white hover:bg-success-hover focus:ring-success-glow"],
73
- warning: ["rounded-md border-transparent bg-warning-base disabled:bg-warning-hover text-white hover:bg-warning-hover focus:ring-warning-glow"],
74
- danger: ["rounded-md border-transparent bg-danger-base disabled:bg-danger-hover text-white hover:bg-danger-hover focus:ring-danger-glow"],
75
- touch: ["rounded-full border-transparent text-black hover:bg-primary-body-hover hover:shadow p-3 focus:ring-tertiary-glow"],
76
- link: ["rounded-md border-transparent items-center text-info-base hover:text-info-hover"],
69
+ primary: ["rounded-md border-transparent bg-primary-base disabled:bg-primary-hover text-sm text-white hover:bg-primary-hover focus:ring-primary-glow"],
70
+ secondary: ["rounded-md border-primary-stroke bg-primary-body disabled:bg-primary-body-hover text-black text-sm hover:bg-primary-body-hover focus:ring-tertiary-glow"],
71
+ info: ["rounded-md border-transparent bg-info-base disabled:bg-info-hover text-white text-sm hover:bg-info-hover focus:ring-info-glow"],
72
+ success: ["rounded-md border-transparent bg-success-base disabled:bg-success-hover text-white text-sm hover:bg-success-hover focus:ring-success-glow"],
73
+ warning: ["rounded-md border-transparent bg-warning-base disabled:bg-warning-hover text-white text-sm hover:bg-warning-hover focus:ring-warning-glow"],
74
+ danger: ["rounded-md border-transparent bg-danger-base disabled:bg-danger-hover text-white text-sm hover:bg-danger-hover focus:ring-danger-glow"],
75
+ touch: ["rounded-full border-transparent text-black hover:bg-primary-body-hover hover:shadow p-3 text-sm focus:ring-tertiary-glow"],
76
+ link: ["rounded-md border-transparent items-center text-info-base hover:text-info-hover text-sm"],
77
77
  none: ["rounded-md border-transparent text-gray-500"]
78
78
  }, A = (n = "primary", r = "md") => {
79
79
  const e = [];
@@ -88,7 +88,7 @@ const z = /* @__PURE__ */ k(x, [["render", S]]), I = {
88
88
  }, l = t(() => e.icon), b = t(() => {
89
89
  const s = A(e.variant, e.size);
90
90
  return e.variant === "touch" && e.active && s.push("bg-primary-body-active"), s;
91
- }), g = t(() => e.disabled || e.isLoading), h = t(() => e.label && e.label.length > 0 && e.variant !== "touch"), f = t(() => {
91
+ }), g = t(() => e.disabled || e.isLoading), m = t(() => e.label && e.label.length > 0 && e.variant !== "touch"), h = t(() => {
92
92
  const s = [
93
93
  "inline-block text-ellipsis overflow-hidden"
94
94
  ];
@@ -111,10 +111,10 @@ const z = /* @__PURE__ */ k(x, [["render", S]]), I = {
111
111
  key: 1,
112
112
  class: i(c.value)
113
113
  }, null, 8, ["class"])) : u("", !0),
114
- h.value ? (o(), a("span", {
114
+ m.value ? (o(), a("span", {
115
115
  key: 2,
116
- class: i(f.value)
117
- }, _(s.label), 3)) : u("", !0)
116
+ class: i(h.value)
117
+ }, x(s.label), 3)) : u("", !0)
118
118
  ], 10, E));
119
119
  }
120
120
  });
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),w=require("../OneBrowserMenu.vue_vue_type_script_setup_true_lang-24874222.cjs");require("../common/index.cjs");const v={items:{required:!0,type:Array},slim:{type:Boolean,default:!0}},k={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}},_={sidebarItems:v.items,logoSrc:{type:String},app:{required:!0,type:Object},user:{type:Object,required:!0},labels:{type:Object},handlers:{type:Object}},x=e.defineComponent({__name:"OneSidebarLink",props:k,setup(r){const l=r,n=e.computed(()=>l.route!=null?l.route:l.routeName!=null?{name:l.routeName}:"/");return(o,t)=>{const a=e.resolveComponent("RouterLink");return e.openBlock(),e.createBlock(a,{to:n.value,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"])}}}),N={class:""},B={class:"space-y-2 p-2"},y=e.defineComponent({__name:"OneSidebar",props:v,setup(r){return(l,n)=>(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",B,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.items,o=>(e.openBlock(),e.createBlock(x,{key:o.label,icon:o.icon,label:o.label,route:o.route,"route-name":o.routeName,exact:o.exact||!1,slim:l.slim},null,8,["icon","label","route","route-name","exact","slim"]))),128))])]))}});function V(r,l){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 C={class:"min-h-screen relative"},E={class:"header h-[56px] flex items-center flex-nowrap absolute top-0 left-0 w-screen"},S={class:"p-2 flex-shrink-0"},O={class:"w-10 h-10 bg-white rounded-lg border border-secondary-stroke flex items-center flex-shrink-0"},j=["src"],L={class:"whitespace-nowrap"},q={class:"text-xs whitespace-nowrap"},$={class:"w-full"},M={class:"w-full flex justify-end pr-2"},z={class:"flex items-center space-x-1"},A={class:"body w-full h-full"},D=e.defineComponent({__name:"OneMainLayout",props:_,setup(r){const l=r,n=e.ref(window.localStorage.getItem("sidebar-slim")==="1");e.watch(n,t=>{window.localStorage.setItem("sidebar-slim",String(t?1:0))});const o=e.computed(()=>{var t,a;return{name:((t=l.app)==null?void 0:t.workspace)||"",photo_url:((a=l.app)==null?void 0:a.photo_url)||""}});return(t,a)=>{var s,c,i,p,u,d,m,h,f,b;const g=e.resolveComponent("RouterLink");return e.openBlock(),e.createElementBlock("div",C,[e.createElementVNode("div",E,[e.createElementVNode("div",S,[e.createElementVNode("button",{onClick:a[0]||(a[0]=I=>n.value=!n.value),class:"w-[44px] h-[44px] p-[8px] flex items-center justify-center hover:text-secondary-content"},[e.createVNode(e.unref(V),{class:"w-[24px] h-[24px]"})])]),e.createElementVNode("div",O,[t.logoSrc!=null?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.logoSrc,class:"w-8 h-8 mx-auto",alt:"logo"},null,8,j)):e.createCommentVNode("",!0)]),t.app!=null?(e.openBlock(),e.createBlock(g,{key:0,to:"/",class:"pl-2 max-w-xs"},{default:e.withCtx(()=>[e.createElementVNode("div",L,e.toDisplayString(t.app.name),1),e.createElementVNode("div",q,e.toDisplayString(t.app.workspace),1)]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",$,[e.createElementVNode("div",M,[e.createElementVNode("div",z,[e.createVNode(w._sfc_main$3,{workspace:o.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(w._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",[n.value?"w-[60px]":"w-60"]])},[e.createVNode(y,{slim:n.value,items:t.sidebarItems},null,8,["slim","items"])],2),e.createElementVNode("div",A,[e.createElementVNode("div",{class:e.normalizeClass(["content transition-all pt-[56px]",[n.value?"pl-[60px]":"pl-60"]])},[e.renderSlot(t.$slots,"default")],2)])])}}});exports.OneMainLayout=D;exports.OneSidebar=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),w=require("../OneBrowserMenu.vue_vue_type_script_setup_true_lang-24874222.cjs");require("../common/index.cjs");const b={items:{required:!0,type:Array},slim:{type:Boolean,default:!0}},y={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}},_={sidebarItems:b.items,logoSrc:{type:String},helpUrl:{type:String},app:{required:!0,type:Object},user:{type:Object,required:!0},labels:{type:Object},handlers:{type:Object}},x=e.defineComponent({__name:"OneSidebarLink",props:y,setup(a){const l=a,n=e.computed(()=>l.route!=null?l.route:l.routeName!=null?{name:l.routeName}:"/");return(o,t)=>{const r=e.resolveComponent("RouterLink");return e.openBlock(),e.createBlock(r,{to:n.value,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"])}}}),N={class:""},B={class:"space-y-2 p-2"},v=e.defineComponent({__name:"OneSidebar",props:b,setup(a){return(l,n)=>(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",B,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.items,o=>(e.openBlock(),e.createBlock(x,{key:o.label,icon:o.icon,label:o.label,route:o.route,"route-name":o.routeName,exact:o.exact||!1,slim:l.slim},null,8,["icon","label","route","route-name","exact","slim"]))),128))])]))}});function V(a,l){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"})])}function E(a,l){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:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})])}const C={class:"min-h-screen relative"},S={class:"header h-[56px] flex items-center flex-nowrap absolute top-0 left-0 w-full"},O={class:"p-2 flex-shrink-0"},j={class:"w-10 h-10 bg-white rounded-lg border border-secondary-stroke flex items-center flex-shrink-0"},L=["src"],q={class:"whitespace-nowrap"},$={class:"text-xs whitespace-nowrap"},M={class:"w-full"},z={class:"w-full flex justify-end pr-2"},A={class:"flex items-center space-x-1"},D={key:0,class:"sm:block flex-shrink-0 hidden"},I=["href"],P={class:"body w-full h-full"},R=e.defineComponent({__name:"OneMainLayout",props:_,setup(a){const l=a,n=e.ref(window.localStorage.getItem("sidebar-slim")==="1");e.watch(n,t=>{window.localStorage.setItem("sidebar-slim",String(t?1:0))});const o=e.computed(()=>{var t,r;return{name:((t=l.app)==null?void 0:t.workspace)||"",photo_url:((r=l.app)==null?void 0:r.photo_url)||""}});return(t,r)=>{var s,c,i,p,u,d,m,h,f,k;const g=e.resolveComponent("RouterLink");return e.openBlock(),e.createElementBlock("div",C,[e.createElementVNode("div",S,[e.createElementVNode("div",O,[e.createElementVNode("button",{onClick:r[0]||(r[0]=F=>n.value=!n.value),class:"w-[44px] h-[44px] p-[8px] flex items-center justify-center hover:text-secondary-content"},[e.createVNode(e.unref(V),{class:"w-[24px] h-[24px]"})])]),e.createElementVNode("div",j,[t.logoSrc!=null?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.logoSrc,class:"w-8 h-8 mx-auto",alt:"logo"},null,8,L)):e.createCommentVNode("",!0)]),t.app!=null?(e.openBlock(),e.createBlock(g,{key:0,to:"/",class:"pl-2 max-w-xs"},{default:e.withCtx(()=>[e.createElementVNode("div",q,e.toDisplayString(t.app.name),1),e.createElementVNode("div",$,e.toDisplayString(t.app.workspace),1)]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",M,[e.createElementVNode("div",z,[e.createElementVNode("div",A,[e.renderSlot(t.$slots,"before-header-menu"),t.helpUrl?(e.openBlock(),e.createElementBlock("div",D,[e.createElementVNode("a",{href:t.helpUrl,target:"_blank",title:"Help",class:"block btn-touch text-gray-dark"},[e.createVNode(e.unref(E),{class:"w-6 h-6 text-gray-600"})],8,I)])):e.createCommentVNode("",!0),e.createVNode(w._sfc_main$3,{workspace:o.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(w._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":(k=t.handlers)==null?void 0:k.onLogout},null,8,["user","account-label","logout-label","on-account","on-logout"])])])])]),e.createElementVNode("div",{class:e.normalizeClass(["sidebar absolute top-[56px] left-0 h-full",[n.value?"w-[60px]":"w-60"]])},[e.createVNode(v,{slim:n.value,items:t.sidebarItems},null,8,["slim","items"])],2),e.createElementVNode("div",P,[e.createElementVNode("div",{class:e.normalizeClass(["content transition-all pt-[56px]",[n.value?"pl-[60px]":"pl-60"]])},[e.renderSlot(t.$slots,"default")],2)])])}}});exports.OneMainLayout=R;exports.OneSidebar=v;
@@ -1,2 +1,3 @@
1
1
  export { default as OneSidebar } from './OneSidebar.vue';
2
2
  export { default as OneMainLayout } from './OneMainLayout.vue';
3
+ export type { MainLayoutProps } from './layout';
@@ -1,7 +1,7 @@
1
- import { defineComponent as h, computed as O, resolveComponent as L, openBlock as l, createBlock as u, normalizeClass as i, withCtx as j, createElementVNode as s, resolveDynamicComponent as B, createCommentVNode as d, toDisplayString as m, createElementBlock as p, Fragment as $, renderList as N, ref as A, watch as I, createVNode as c, unref as M, renderSlot as R } from "vue";
2
- import { c as F, b as P } from "../OneBrowserMenu.vue_vue_type_script_setup_true_lang-197489be.js";
1
+ import { defineComponent as m, computed as C, resolveComponent as L, openBlock as l, createBlock as d, normalizeClass as c, withCtx as $, createElementVNode as s, resolveDynamicComponent as N, createCommentVNode as u, toDisplayString as h, createElementBlock as n, Fragment as M, renderList as A, ref as I, watch as R, createVNode as p, unref as O, renderSlot as j } from "vue";
2
+ import { c as z, b as F } from "../OneBrowserMenu.vue_vue_type_script_setup_true_lang-197489be.js";
3
3
  import "../common/index.js";
4
- const C = {
4
+ const B = {
5
5
  items: {
6
6
  required: !0,
7
7
  type: Array
@@ -10,7 +10,7 @@ const C = {
10
10
  type: Boolean,
11
11
  default: !0
12
12
  }
13
- }, V = {
13
+ }, P = {
14
14
  route: {
15
15
  required: !1,
16
16
  type: [Object, String]
@@ -43,11 +43,14 @@ const C = {
43
43
  type: Boolean,
44
44
  default: !0
45
45
  }
46
- }, D = {
47
- sidebarItems: C.items,
46
+ }, U = {
47
+ sidebarItems: B.items,
48
48
  logoSrc: {
49
49
  type: String
50
50
  },
51
+ helpUrl: {
52
+ type: String
53
+ },
51
54
  app: {
52
55
  required: !0,
53
56
  type: Object
@@ -62,44 +65,44 @@ const C = {
62
65
  handlers: {
63
66
  type: Object
64
67
  }
65
- }, E = /* @__PURE__ */ h({
68
+ }, V = /* @__PURE__ */ m({
66
69
  __name: "OneSidebarLink",
67
- props: V,
68
- setup(r) {
69
- const o = r, a = O(() => o.route != null ? o.route : o.routeName != null ? { name: o.routeName } : "/");
70
+ props: P,
71
+ setup(i) {
72
+ const o = i, r = C(() => o.route != null ? o.route : o.routeName != null ? { name: o.routeName } : "/");
70
73
  return (t, e) => {
71
- const n = L("RouterLink");
72
- return l(), u(n, {
73
- to: a.value,
74
- class: i(["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"]]),
74
+ const a = L("RouterLink");
75
+ return l(), d(a, {
76
+ to: r.value,
77
+ class: c(["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"]]),
75
78
  "active-class": t.exact ? "" : "bg-primary-10 !text-primary-base",
76
79
  "exact-active-class": t.exact ? "bg-primary-10 !text-primary-base" : "",
77
80
  exact: t.exact
78
81
  }, {
79
- default: j(() => [
82
+ default: $(() => [
80
83
  s("div", {
81
- class: i(["flex flex-nowrap items-center", [t.slim ? "w-[24px] h-[24px]" : "w-full"]])
84
+ class: c(["flex flex-nowrap items-center", [t.slim ? "w-[24px] h-[24px]" : "w-full"]])
82
85
  }, [
83
- t.icon ? (l(), u(B(t.icon), {
86
+ t.icon ? (l(), d(N(t.icon), {
84
87
  key: 0,
85
88
  class: "w-[24px] h-[24px] flex-shrink-0"
86
- })) : d("", !0),
89
+ })) : u("", !0),
87
90
  s("div", {
88
- class: i(["whitespace-nowrap overflow-hidden text-ellipsis transition-all text-left flex-shrink", [t.slim ? "w-0" : "pl-1.5 w-full"]])
89
- }, m(t.label), 3)
91
+ class: c(["whitespace-nowrap overflow-hidden text-ellipsis transition-all text-left flex-shrink", [t.slim ? "w-0" : "pl-1.5 w-full"]])
92
+ }, h(t.label), 3)
90
93
  ], 2)
91
94
  ]),
92
95
  _: 1
93
96
  }, 8, ["to", "active-class", "exact-active-class", "exact", "class"]);
94
97
  };
95
98
  }
96
- }), z = { class: "" }, G = { class: "space-y-2 p-2" }, H = /* @__PURE__ */ h({
99
+ }), D = { class: "" }, E = { class: "space-y-2 p-2" }, H = /* @__PURE__ */ m({
97
100
  __name: "OneSidebar",
98
- props: C,
99
- setup(r) {
100
- return (o, a) => (l(), p("div", z, [
101
- s("div", G, [
102
- (l(!0), p($, null, N(o.items, (t) => (l(), u(E, {
101
+ props: B,
102
+ setup(i) {
103
+ return (o, r) => (l(), n("div", D, [
104
+ s("div", E, [
105
+ (l(!0), n(M, null, A(o.items, (t) => (l(), d(V, {
103
106
  key: t.label,
104
107
  icon: t.icon,
105
108
  label: t.label,
@@ -112,8 +115,8 @@ const C = {
112
115
  ]));
113
116
  }
114
117
  });
115
- function J(r, o) {
116
- return l(), p("svg", {
118
+ function G(i, o) {
119
+ return l(), n("svg", {
117
120
  xmlns: "http://www.w3.org/2000/svg",
118
121
  fill: "none",
119
122
  viewBox: "0 0 24 24",
@@ -128,70 +131,100 @@ function J(r, o) {
128
131
  })
129
132
  ]);
130
133
  }
131
- const K = { class: "min-h-screen relative" }, Q = { class: "header h-[56px] flex items-center flex-nowrap absolute top-0 left-0 w-screen" }, T = { class: "p-2 flex-shrink-0" }, U = { class: "w-10 h-10 bg-white rounded-lg border border-secondary-stroke flex items-center flex-shrink-0" }, W = ["src"], X = { class: "whitespace-nowrap" }, Y = { class: "text-xs whitespace-nowrap" }, Z = { class: "w-full" }, ee = { class: "w-full flex justify-end pr-2" }, te = { class: "flex items-center space-x-1" }, se = { class: "body w-full h-full" }, re = /* @__PURE__ */ h({
134
+ function J(i, o) {
135
+ return l(), n("svg", {
136
+ xmlns: "http://www.w3.org/2000/svg",
137
+ fill: "none",
138
+ viewBox: "0 0 24 24",
139
+ "stroke-width": "1.8",
140
+ stroke: "currentColor",
141
+ "aria-hidden": "true"
142
+ }, [
143
+ s("path", {
144
+ "stroke-linecap": "round",
145
+ "stroke-linejoin": "round",
146
+ d: "M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"
147
+ })
148
+ ]);
149
+ }
150
+ const K = { class: "min-h-screen relative" }, Q = { class: "header h-[56px] flex items-center flex-nowrap absolute top-0 left-0 w-full" }, T = { class: "p-2 flex-shrink-0" }, W = { class: "w-10 h-10 bg-white rounded-lg border border-secondary-stroke flex items-center flex-shrink-0" }, X = ["src"], Y = { class: "whitespace-nowrap" }, Z = { class: "text-xs whitespace-nowrap" }, ee = { class: "w-full" }, te = { class: "w-full flex justify-end pr-2" }, se = { class: "flex items-center space-x-1" }, oe = {
151
+ key: 0,
152
+ class: "sm:block flex-shrink-0 hidden"
153
+ }, le = ["href"], re = { class: "body w-full h-full" }, ce = /* @__PURE__ */ m({
132
154
  __name: "OneMainLayout",
133
- props: D,
134
- setup(r) {
135
- const o = r, a = A(window.localStorage.getItem("sidebar-slim") === "1");
136
- I(a, (e) => {
155
+ props: U,
156
+ setup(i) {
157
+ const o = i, r = I(window.localStorage.getItem("sidebar-slim") === "1");
158
+ R(r, (e) => {
137
159
  window.localStorage.setItem("sidebar-slim", String(e ? 1 : 0));
138
160
  });
139
- const t = O(() => {
140
- var e, n;
161
+ const t = C(() => {
162
+ var e, a;
141
163
  return {
142
164
  name: ((e = o.app) == null ? void 0 : e.workspace) || "",
143
- photo_url: ((n = o.app) == null ? void 0 : n.photo_url) || ""
165
+ photo_url: ((a = o.app) == null ? void 0 : a.photo_url) || ""
144
166
  };
145
167
  });
146
- return (e, n) => {
147
- var f, b, w, v, y, g, x, _, k, S;
168
+ return (e, a) => {
169
+ var f, b, w, v, g, y, k, x, _, S;
148
170
  const q = L("RouterLink");
149
- return l(), p("div", K, [
171
+ return l(), n("div", K, [
150
172
  s("div", Q, [
151
173
  s("div", T, [
152
174
  s("button", {
153
- onClick: n[0] || (n[0] = (oe) => a.value = !a.value),
175
+ onClick: a[0] || (a[0] = (ae) => r.value = !r.value),
154
176
  class: "w-[44px] h-[44px] p-[8px] flex items-center justify-center hover:text-secondary-content"
155
177
  }, [
156
- c(M(J), { class: "w-[24px] h-[24px]" })
178
+ p(O(G), { class: "w-[24px] h-[24px]" })
157
179
  ])
158
180
  ]),
159
- s("div", U, [
160
- e.logoSrc != null ? (l(), p("img", {
181
+ s("div", W, [
182
+ e.logoSrc != null ? (l(), n("img", {
161
183
  key: 0,
162
184
  src: e.logoSrc,
163
185
  class: "w-8 h-8 mx-auto",
164
186
  alt: "logo"
165
- }, null, 8, W)) : d("", !0)
187
+ }, null, 8, X)) : u("", !0)
166
188
  ]),
167
- e.app != null ? (l(), u(q, {
189
+ e.app != null ? (l(), d(q, {
168
190
  key: 0,
169
191
  to: "/",
170
192
  class: "pl-2 max-w-xs"
171
193
  }, {
172
- default: j(() => [
173
- s("div", X, m(e.app.name), 1),
174
- s("div", Y, m(e.app.workspace), 1)
194
+ default: $(() => [
195
+ s("div", Y, h(e.app.name), 1),
196
+ s("div", Z, h(e.app.workspace), 1)
175
197
  ]),
176
198
  _: 1
177
- })) : d("", !0),
178
- s("div", Z, [
179
- s("div", ee, [
180
- s("div", te, [
181
- c(F, {
199
+ })) : u("", !0),
200
+ s("div", ee, [
201
+ s("div", te, [
202
+ s("div", se, [
203
+ j(e.$slots, "before-header-menu"),
204
+ e.helpUrl ? (l(), n("div", oe, [
205
+ s("a", {
206
+ href: e.helpUrl,
207
+ target: "_blank",
208
+ title: "Help",
209
+ class: "block btn-touch text-gray-dark"
210
+ }, [
211
+ p(O(J), { class: "w-6 h-6 text-gray-600" })
212
+ ], 8, le)
213
+ ])) : u("", !0),
214
+ p(z, {
182
215
  workspace: t.value,
183
216
  apps: ((f = e.app) == null ? void 0 : f.apps) || [],
184
217
  "change-label": ((b = e.labels) == null ? void 0 : b.change) || "Change",
185
218
  "apps-title": ((w = e.labels) == null ? void 0 : w.apps) || "Apps",
186
219
  "on-app": (v = e.handlers) == null ? void 0 : v.onApp,
187
- "on-change": (y = e.handlers) == null ? void 0 : y.onChange,
188
- onOpen: (g = e.handlers) == null ? void 0 : g.onBrowse
220
+ "on-change": (g = e.handlers) == null ? void 0 : g.onChange,
221
+ onOpen: (y = e.handlers) == null ? void 0 : y.onBrowse
189
222
  }, null, 8, ["workspace", "apps", "change-label", "apps-title", "on-app", "on-change", "onOpen"]),
190
- c(P, {
223
+ p(F, {
191
224
  user: e.user,
192
- "account-label": ((x = e.labels) == null ? void 0 : x.account) || "Account",
193
- "logout-label": ((_ = e.labels) == null ? void 0 : _.logout) || "Logout",
194
- "on-account": (k = e.handlers) == null ? void 0 : k.onAccount,
225
+ "account-label": ((k = e.labels) == null ? void 0 : k.account) || "Account",
226
+ "logout-label": ((x = e.labels) == null ? void 0 : x.logout) || "Logout",
227
+ "on-account": (_ = e.handlers) == null ? void 0 : _.onAccount,
195
228
  "on-logout": (S = e.handlers) == null ? void 0 : S.onLogout
196
229
  }, null, 8, ["user", "account-label", "logout-label", "on-account", "on-logout"])
197
230
  ])
@@ -199,18 +232,18 @@ const K = { class: "min-h-screen relative" }, Q = { class: "header h-[56px] flex
199
232
  ])
200
233
  ]),
201
234
  s("div", {
202
- class: i(["sidebar transition-all absolute top-[56px] left-0 h-full", [a.value ? "w-[60px]" : "w-60"]])
235
+ class: c(["sidebar absolute top-[56px] left-0 h-full", [r.value ? "w-[60px]" : "w-60"]])
203
236
  }, [
204
- c(H, {
205
- slim: a.value,
237
+ p(H, {
238
+ slim: r.value,
206
239
  items: e.sidebarItems
207
240
  }, null, 8, ["slim", "items"])
208
241
  ], 2),
209
- s("div", se, [
242
+ s("div", re, [
210
243
  s("div", {
211
- class: i(["content transition-all pt-[56px]", [a.value ? "pl-[60px]" : "pl-60"]])
244
+ class: c(["content transition-all pt-[56px]", [r.value ? "pl-[60px]" : "pl-60"]])
212
245
  }, [
213
- R(e.$slots, "default")
246
+ j(e.$slots, "default")
214
247
  ], 2)
215
248
  ])
216
249
  ]);
@@ -218,6 +251,6 @@ const K = { class: "min-h-screen relative" }, Q = { class: "header h-[56px] flex
218
251
  }
219
252
  });
220
253
  export {
221
- re as OneMainLayout,
254
+ ce as OneMainLayout,
222
255
  H as OneSidebar
223
256
  };
@@ -0,0 +1,96 @@
1
+ import type { FunctionalComponent, Component, ExtractPropTypes } from "vue";
2
+ export type SidebarItemType = {
3
+ label: string;
4
+ route?: string | Record<string, any>;
5
+ routeName?: string;
6
+ exact?: boolean;
7
+ icon?: FunctionalComponent | Component;
8
+ };
9
+ export declare const sidebarProps: {
10
+ items: {
11
+ required: boolean;
12
+ type: PropType<SidebarItemType[]>;
13
+ };
14
+ slim: {
15
+ type: BooleanConstructor;
16
+ default: boolean;
17
+ };
18
+ };
19
+ export declare const sidebarLinkProps: {
20
+ route: {
21
+ required: boolean;
22
+ type: PropType<RouteLocationRaw>;
23
+ };
24
+ routeName: {
25
+ required: boolean;
26
+ type: StringConstructor;
27
+ };
28
+ handler: {
29
+ required: boolean;
30
+ type: PropType<() => void>;
31
+ default(): () => void;
32
+ };
33
+ label: {
34
+ type: StringConstructor;
35
+ required: boolean;
36
+ };
37
+ icon: {
38
+ type: PropType<any>;
39
+ };
40
+ exact: {
41
+ type: BooleanConstructor;
42
+ required: boolean;
43
+ default: boolean;
44
+ };
45
+ slim: {
46
+ type: BooleanConstructor;
47
+ default: boolean;
48
+ };
49
+ };
50
+ export declare const mainLayoutProps: {
51
+ sidebarItems: {
52
+ required: boolean;
53
+ type: PropType<SidebarItemType[]>;
54
+ };
55
+ logoSrc: {
56
+ type: StringConstructor;
57
+ };
58
+ helpUrl: {
59
+ type: StringConstructor;
60
+ };
61
+ app: {
62
+ required: boolean;
63
+ type: PropType<{
64
+ name: string;
65
+ workspace: string;
66
+ photo_url: string;
67
+ apps: Array<any>;
68
+ }>;
69
+ };
70
+ user: {
71
+ type: PropType<{
72
+ name: string;
73
+ email: string;
74
+ photo_url?: string;
75
+ }>;
76
+ required: boolean;
77
+ };
78
+ labels: {
79
+ type: PropType<{
80
+ apps: string;
81
+ change: string;
82
+ account: string;
83
+ logout: string;
84
+ }>;
85
+ };
86
+ handlers: {
87
+ type: PropType<{
88
+ onApp: (e?: any) => void;
89
+ onChange: (e?: any) => void;
90
+ onBrowse: (e?: any) => void;
91
+ onAccount: (e?: any) => void;
92
+ onLogout: (e?: any) => void;
93
+ }>;
94
+ };
95
+ };
96
+ export type MainLayoutProps = ExtractPropTypes<typeof mainLayoutProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneb/ui-vue",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [