@7pmlabs/design-system 0.5.0 → 0.5.1
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/design-system101.js +1 -1
- package/dist/design-system101.mjs +3 -3
- package/dist/design-system103.js +1 -1
- package/dist/design-system103.js.map +1 -1
- package/dist/design-system103.mjs +2138 -1069
- package/dist/design-system103.mjs.map +1 -1
- package/dist/design-system104.js +1 -1
- package/dist/design-system104.js.map +1 -1
- package/dist/design-system104.mjs +1103 -25
- package/dist/design-system104.mjs.map +1 -1
- package/dist/design-system105.js +1 -1
- package/dist/design-system105.js.map +1 -1
- package/dist/design-system105.mjs +25 -67
- package/dist/design-system105.mjs.map +1 -1
- package/dist/design-system106.js +1 -1
- package/dist/design-system106.js.map +1 -1
- package/dist/design-system106.mjs +60 -2165
- package/dist/design-system106.mjs.map +1 -1
- package/dist/design-system113.js +1 -1
- package/dist/design-system113.mjs +6 -2
- package/dist/design-system113.mjs.map +1 -1
- package/dist/design-system114.js +1 -1
- package/dist/design-system114.mjs +3 -5
- package/dist/design-system114.mjs.map +1 -1
- package/dist/design-system115.js +1 -1
- package/dist/design-system115.mjs +2 -4
- package/dist/design-system115.mjs.map +1 -1
- package/dist/design-system116.js +1 -1
- package/dist/design-system116.mjs +2 -2
- package/dist/design-system118.js +1 -1
- package/dist/design-system118.mjs +13 -13
- package/dist/design-system13.js +1 -1
- package/dist/design-system13.mjs +2 -2
- package/dist/design-system148.js +1 -1
- package/dist/design-system148.js.map +1 -1
- package/dist/design-system148.mjs +7 -11
- package/dist/design-system148.mjs.map +1 -1
- package/dist/design-system149.js +1 -1
- package/dist/design-system149.js.map +1 -1
- package/dist/design-system149.mjs +9 -7
- package/dist/design-system149.mjs.map +1 -1
- package/dist/design-system15.js +1 -1
- package/dist/design-system15.mjs +2 -2
- package/dist/design-system150.js +1 -1
- package/dist/design-system150.js.map +1 -1
- package/dist/design-system150.mjs +11 -9
- package/dist/design-system150.mjs.map +1 -1
- package/dist/design-system153.js +1 -1
- package/dist/design-system153.js.map +1 -1
- package/dist/design-system153.mjs +16 -2
- package/dist/design-system153.mjs.map +1 -1
- package/dist/design-system154.js +1 -1
- package/dist/design-system154.js.map +1 -1
- package/dist/design-system154.mjs +5 -15
- package/dist/design-system154.mjs.map +1 -1
- package/dist/design-system155.js +1 -1
- package/dist/design-system155.js.map +1 -1
- package/dist/design-system155.mjs +5 -5
- package/dist/design-system155.mjs.map +1 -1
- package/dist/design-system156.js +1 -1
- package/dist/design-system156.js.map +1 -1
- package/dist/design-system156.mjs +8 -5
- package/dist/design-system156.mjs.map +1 -1
- package/dist/design-system157.js +1 -1
- package/dist/design-system157.js.map +1 -1
- package/dist/design-system157.mjs +6 -8
- package/dist/design-system157.mjs.map +1 -1
- package/dist/design-system158.js +1 -1
- package/dist/design-system158.js.map +1 -1
- package/dist/design-system158.mjs +5 -6
- package/dist/design-system158.mjs.map +1 -1
- package/dist/design-system159.js +1 -1
- package/dist/design-system159.js.map +1 -1
- package/dist/design-system159.mjs +4 -4
- package/dist/design-system159.mjs.map +1 -1
- package/dist/design-system160.js +1 -1
- package/dist/design-system160.js.map +1 -1
- package/dist/design-system160.mjs +6 -5
- package/dist/design-system160.mjs.map +1 -1
- package/dist/design-system161.js +1 -1
- package/dist/design-system161.js.map +1 -1
- package/dist/design-system161.mjs +4 -4
- package/dist/design-system161.mjs.map +1 -1
- package/dist/design-system162.js +1 -1
- package/dist/design-system162.js.map +1 -1
- package/dist/design-system162.mjs +5 -6
- package/dist/design-system162.mjs.map +1 -1
- package/dist/design-system163.js +1 -1
- package/dist/design-system163.js.map +1 -1
- package/dist/design-system163.mjs +39 -5
- package/dist/design-system163.mjs.map +1 -1
- package/dist/design-system164.js +1 -1
- package/dist/design-system164.js.map +1 -1
- package/dist/design-system164.mjs +6 -39
- package/dist/design-system164.mjs.map +1 -1
- package/dist/design-system165.js +1 -1
- package/dist/design-system165.js.map +1 -1
- package/dist/design-system165.mjs +5 -6
- package/dist/design-system165.mjs.map +1 -1
- package/dist/design-system166.js +1 -1
- package/dist/design-system166.js.map +1 -1
- package/dist/design-system166.mjs +16 -6
- package/dist/design-system166.mjs.map +1 -1
- package/dist/design-system167.js +1 -1
- package/dist/design-system167.js.map +1 -1
- package/dist/design-system167.mjs +2 -16
- package/dist/design-system167.mjs.map +1 -1
- package/dist/design-system168.js +1 -1
- package/dist/design-system168.js.map +1 -1
- package/dist/design-system168.mjs +2 -8
- package/dist/design-system168.mjs.map +1 -1
- package/dist/design-system169.js +1 -1
- package/dist/design-system169.js.map +1 -1
- package/dist/design-system169.mjs +8 -2
- package/dist/design-system169.mjs.map +1 -1
- package/dist/design-system18.js +1 -1
- package/dist/design-system18.mjs +1 -1
- package/dist/design-system194.js +1 -1
- package/dist/design-system194.mjs +1 -1
- package/dist/design-system195.js +1 -1
- package/dist/design-system195.mjs +1 -1
- package/dist/design-system203.js +1 -1
- package/dist/design-system203.mjs +1 -1
- package/dist/design-system26.js +1 -1
- package/dist/design-system26.js.map +1 -1
- package/dist/design-system26.mjs +53 -51
- package/dist/design-system26.mjs.map +1 -1
- package/dist/design-system89.js +1 -1
- package/dist/design-system89.mjs +1 -1
- package/dist/design-system92.js +1 -1
- package/dist/design-system92.mjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/design-system18.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as u, computed as m, watch as f, onBeforeUnmount as p, openBlock as o, createBlock as a, Teleport as y, createVNode as B, Transition as _, withCtx as r, normalizeClass as v, renderSlot as z, createCommentVNode as V } from "vue";
|
|
2
2
|
import { BModalSize as k } from "./design-system5.mjs";
|
|
3
3
|
import { lockScrollBody as C, unlockScrollBody as n } from "./design-system6.mjs";
|
|
4
|
-
import S from "./design-
|
|
4
|
+
import S from "./design-system106.mjs";
|
|
5
5
|
const $ = {
|
|
6
6
|
// https://vuejs.org/guide/components/attrs.html#disabling-attribute-inheritance
|
|
7
7
|
inheritAttrs: !1
|
package/dist/design-system194.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const u=require("./design-
|
|
1
|
+
"use strict";const u=require("./design-system165.js"),a=require("./design-system123.js");function i(r,e,t){var s=e(r);return a(r)?s:u(s,t(r))}module.exports=i;
|
|
2
2
|
//# sourceMappingURL=design-system194.js.map
|
package/dist/design-system195.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const t=require("./design-
|
|
1
|
+
"use strict";const t=require("./design-system165.js"),s=require("./design-system183.js"),n=require("./design-system203.js"),o=require("./design-system147.js");var u=Object.getOwnPropertySymbols,y=u?function(r){for(var e=[];r;)t(e,n(r)),r=s(r);return e}:o;const i=y;module.exports=i;
|
|
2
2
|
//# sourceMappingURL=design-system195.js.map
|
package/dist/design-system203.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const n=require("./design-
|
|
1
|
+
"use strict";const n=require("./design-system169.js"),o=require("./design-system147.js");var s=Object.prototype,u=s.propertyIsEnumerable,t=Object.getOwnPropertySymbols,a=t?function(r){return r==null?[]:(r=Object(r),n(t(r),function(e){return u.call(r,e)}))}:o;const l=a;module.exports=l;
|
|
2
2
|
//# sourceMappingURL=design-system203.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import o from "./design-
|
|
1
|
+
import o from "./design-system169.mjs";
|
|
2
2
|
import a from "./design-system147.mjs";
|
|
3
3
|
var n = Object.prototype, l = n.propertyIsEnumerable, t = Object.getOwnPropertySymbols, m = t ? function(r) {
|
|
4
4
|
return r == null ? [] : (r = Object(r), o(t(r), function(e) {
|
package/dist/design-system26.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),g=require("./design-system102.js"),B=["href","title"],E={"aria-hidden":"true",class:"ds-pl-2"},y=e.createElementVNode("svg",{class:"ds-mb-0.5 ds-inline-block ds-h-4 ds-w-4",viewBox:"0 0 320 512",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("path",{d:"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"})],-1),R=["id"],N=["href","title"],V={key:0,"aria-hidden":"true",class:"ds-pl-2"},$=e.createElementVNode("svg",{class:"ds-mb-0.5 ds-inline-block ds-h-4 ds-w-4",viewBox:"0 0 320 512",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("path",{d:"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"})],-1),C=e.defineComponent({__name:"BBreadcrumb",props:{items:{default:()=>[]}},setup(m){const k=m,d=e.ref(!1),a=e.ref(null),c=e.ref(null),i=e.ref(null),f=e.ref(null),r=e.ref([]),h=new ResizeObserver(()=>{if(r.value.length<=1)return;const
|
|
1
|
+
"use strict";const e=require("vue"),g=require("./design-system102.js"),B=["href","title"],E={"aria-hidden":"true",class:"ds-pl-2"},y=e.createElementVNode("svg",{class:"ds-mb-0.5 ds-inline-block ds-h-4 ds-w-4",viewBox:"0 0 320 512",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("path",{d:"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"})],-1),R=["id"],N=["href","title"],V={key:0,"aria-hidden":"true",class:"ds-pl-2"},$=e.createElementVNode("svg",{class:"ds-mb-0.5 ds-inline-block ds-h-4 ds-w-4",viewBox:"0 0 320 512",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("path",{d:"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"})],-1),C=e.defineComponent({__name:"BBreadcrumb",props:{items:{default:()=>[]}},setup(m){const k=m,d=e.ref(!1),a=e.ref(null),c=e.ref(null),i=e.ref(null),f=e.ref(null),r=e.ref([]),h=new ResizeObserver(()=>{if(r.value.length<=1)return;const t=a.value.clientWidth,n=i.value[0].clientWidth;for(let s=1;s<r.value.length&&r.value.reduce((l,o)=>o.hidden?l:l+o.width,0)+n>t;s++)r.value[s].hidden=!0;for(let s=r.value.length-1;s>=1;s--)if(r.value[s].hidden)if(r.value.reduce((l,o)=>o.hidden?l:l+o.width,0)+r.value[s].width+n<=t)r.value[s].hidden=!1;else break}),u=e.computed(()=>r.value.some(t=>t.hidden)),v=e.computed(()=>`menu-id-${g()}`),w=()=>{d.value=!d.value},b=()=>{document.addEventListener("click",p)},_=()=>{document.removeEventListener("click",p)},p=t=>{[i.value[0],f.value[0]].some(l=>t.composedPath().includes(l))||(d.value=!1)};return e.onMounted(()=>{b(),h.observe(a.value),r.value=k.items.map(t=>({...t,hidden:!1,width:0})),e.nextTick(()=>{r.value.forEach((t,n)=>{t.width=c.value[n].clientWidth})})}),e.onUnmounted(()=>{_(),h.unobserve(a.value)}),(t,n)=>(e.openBlock(),e.createElementBlock("ul",{ref_key:"ulRef",ref:a,class:e.normalizeClass([{collapsed:u.value},"ds-relative ds-flex"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(s,l)=>{var o;return e.openBlock(),e.createElementBlock(e.Fragment,{key:`item${s.text}`},[l===0?(e.openBlock(),e.createElementBlock("li",{key:0,ref_for:!0,ref_key:"liRefs",ref:c,class:"ds-whitespace-nowrap ds-text-black/[0.85]"},[e.renderSlot(t.$slots,`item-${l}`,{item:s},()=>[e.createElementVNode("a",{href:s.href,title:s.href,class:"hover:ds-text-primary-t"},e.toDisplayString(s.text),9,B)]),e.createElementVNode("span",E,[e.renderSlot(t.$slots,`separator-${l}`,{item:s},()=>[y])]),e.withDirectives(e.createElementVNode("button",{ref_for:!0,ref_key:"ellipsisRefs",ref:i,class:e.normalizeClass([{"ds-bg-slate-50":d.value},"ds-ml-2 ds-rounded-lg ds-bg-slate-100 ds-px-2 ds-text-primary-t hover:ds-bg-slate-50"]),onClick:w}," ... ",2),[[e.vShow,u.value]]),e.withDirectives(e.createElementVNode("ul",{id:v.value,ref_for:!0,ref_key:"menuRefs",ref:f,class:"ds-absolute ds-space-y-2 ds-rounded-lg ds-bg-white ds-p-4 ds-shadow"},null,8,R),[[e.vShow,u.value&&d.value]])],512)):(e.openBlock(),e.createBlock(e.Teleport,{key:1,disabled:!s.hidden,to:`#${v.value}`},[e.createElementVNode("li",{ref_for:!0,ref_key:"liRefs",ref:c,class:"ds-whitespace-nowrap ds-pl-2 ds-text-black/[0.85]"},[e.renderSlot(t.$slots,`item-${l}`,{item:s},()=>[e.createElementVNode("a",{href:s.href,title:s.href,class:"hover:ds-text-primary-t"},e.toDisplayString(s.text),9,N)]),l<((o=t.items)==null?void 0:o.length)-1?(e.openBlock(),e.createElementBlock("span",V,[e.renderSlot(t.$slots,`separator-${l}`,{item:s},()=>[$])])):e.createCommentVNode("",!0)],512)],8,["disabled","to"]))],64)}),128))],2))}});module.exports=C;
|
|
2
2
|
//# sourceMappingURL=design-system26.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-system26.js","sources":["../src/components/BBreadcrumb.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, vShow as _vShow, withDirectives as _withDirectives, createCommentVNode as _createCommentVNode, Teleport as _Teleport, createBlock as _createBlock, normalizeClass as _normalizeClass } from \"vue\"\n\nconst _hoisted_1 = [\"href\", \"title\"]\nconst _hoisted_2 = {\n \"aria-hidden\": \"true\",\n class: \"ds-pl-2\"\n}\nconst _hoisted_3 = /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-mb-0.5 ds-inline-block ds-h-4 ds-w-4\",\n viewBox: \"0 0 320 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z\" })\n], -1)\nconst _hoisted_4 = [\"id\"]\nconst _hoisted_5 = [\"href\", \"title\"]\nconst _hoisted_6 = {\n key: 0,\n \"aria-hidden\": \"true\",\n class: \"ds-pl-2\"\n}\nconst _hoisted_7 = /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-mb-0.5 ds-inline-block ds-h-4 ds-w-4\",\n viewBox: \"0 0 320 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z\" })\n], -1)\n\nimport { computed, nextTick, onMounted, onUnmounted, ref } from 'vue';\nimport { v4 as uuid } from 'uuid';\nimport type { BBreadcrumbItem } from '@/types';\n\ninterface BBreadcrumbItemInternal extends BBreadcrumbItem {\n hidden: boolean;\n width: number;\n}\n\n//#region Props\nexport interface BBreadcrumbProps {\n /**\n * Array of breadcrumb items.\n */\n items?: BBreadcrumbItem[];\n}\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BBreadcrumb',\n props: {\n items: { default: () => [] }\n },\n setup(__props: any) {\n\nconst props = __props;\n//#endregion\n\n//#region Data\nconst collapsedBreadcrumbMenu = ref(false);\nconst ulRef = ref<HTMLUListElement | null>(null);\nconst liRefs = ref<HTMLLIElement[] | null>(null);\nconst ellipsisRefs = ref<HTMLSpanElement[] | null>(null);\nconst menuRefs = ref<HTMLUListElement[] | null>(null);\nconst breadcrumbItems = ref<BBreadcrumbItemInternal[]>([]);\nconst resizeObserver = new ResizeObserver(() => {\n if (breadcrumbItems.value.length <= 1) {\n return;\n }\n\n const ulRefWidth = ulRef.value!.clientWidth;\n const ellipsisRefWidth = ellipsisRefs.value![0].clientWidth;\n\n for (let i = 1; i < breadcrumbItems.value.length; i++) {\n if (\n breadcrumbItems.value.reduce(\n (acc, item) => (!item.hidden ? acc + item.width : acc),\n 0,\n ) +\n ellipsisRefWidth >\n ulRefWidth\n ) {\n breadcrumbItems.value[i].hidden = true;\n } else {\n break;\n }\n }\n\n for (let i = breadcrumbItems.value.length - 1; i >= 1; i--) {\n if (breadcrumbItems.value[i].hidden) {\n if (\n breadcrumbItems.value.reduce(\n (acc, item) => (!item.hidden ? acc + item.width : acc),\n 0,\n ) +\n breadcrumbItems.value[i].width +\n ellipsisRefWidth <=\n ulRefWidth\n ) {\n breadcrumbItems.value[i].hidden = false;\n } else {\n break;\n }\n }\n }\n});\nconst isCollapsed = computed(() => breadcrumbItems.value.some((i) => i.hidden));\nconst menuId = computed(() => `menu-id-${uuid()}`);\n//#region\n\n//#region Methods\nconst toggleCollapedBreadcrumbMenu = () => {\n console.log('...');\n collapsedBreadcrumbMenu.value = !collapsedBreadcrumbMenu.value;\n};\nconst initClickOutsideEventListener = () => {\n document.addEventListener('click', closeOnClickOutside);\n};\nconst removeClickOutsideEventListener = () => {\n document.removeEventListener('click', closeOnClickOutside);\n};\nconst closeOnClickOutside = (event: any) => {\n const refs = [ellipsisRefs.value![0], menuRefs.value![0]];\n const withinBoundaries = refs.some((r) => event.composedPath().includes(r));\n if (!withinBoundaries) {\n collapsedBreadcrumbMenu.value = false;\n }\n};\n//#region\n\n//#region Lifecycle hooks\nonMounted(() => {\n initClickOutsideEventListener();\n resizeObserver.observe(ulRef.value!);\n\n breadcrumbItems.value = props.items.map(\n (item) =>\n ({\n ...item,\n hidden: false,\n width: 0,\n }) as BBreadcrumbItemInternal,\n );\n nextTick(() => {\n breadcrumbItems.value.forEach((item, index) => {\n item.width = liRefs.value![index].clientWidth;\n });\n });\n});\nonUnmounted(() => {\n removeClickOutsideEventListener();\n resizeObserver.unobserve(ulRef.value!);\n});\n//#region\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"ul\", {\n ref_key: \"ulRef\",\n ref: ulRef,\n class: _normalizeClass([{ collapsed: isCollapsed.value }, \"ds-relative ds-flex\"])\n }, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(breadcrumbItems.value, (item, index) => {\n return (_openBlock(), _createElementBlock(_Fragment, {\n key: `item${item.text}`\n }, [\n (index === 0)\n ? (_openBlock(), _createElementBlock(\"li\", {\n key: 0,\n ref_for: true,\n ref_key: \"liRefs\",\n ref: liRefs,\n class: \"ds-whitespace-nowrap ds-text-black/[0.85]\"\n }, [\n _renderSlot(_ctx.$slots, `item-${index}`, { item: item }, () => [\n _createElementVNode(\"a\", {\n href: item.href,\n title: item.href\n }, _toDisplayString(item.text), 9, _hoisted_1)\n ]),\n _createElementVNode(\"span\", _hoisted_2, [\n _renderSlot(_ctx.$slots, `separator-${index}`, { item: item }, () => [\n _hoisted_3\n ])\n ]),\n _withDirectives(_createElementVNode(\"button\", {\n ref_for: true,\n ref_key: \"ellipsisRefs\",\n ref: ellipsisRefs,\n class: \"ds-ml-2 ds-rounded-lg ds-bg-slate-100 ds-px-2 ds-text-primary-t\",\n onClick: toggleCollapedBreadcrumbMenu\n }, \" ... \", 512), [\n [_vShow, isCollapsed.value]\n ]),\n _withDirectives(_createElementVNode(\"ul\", {\n id: menuId.value,\n ref_for: true,\n ref_key: \"menuRefs\",\n ref: menuRefs,\n class: \"ds-absolute ds-space-y-2 ds-rounded-lg ds-bg-white ds-p-4 ds-shadow\"\n }, null, 8, _hoisted_4), [\n [_vShow, isCollapsed.value && collapsedBreadcrumbMenu.value]\n ])\n ], 512))\n : (_openBlock(), _createBlock(_Teleport, {\n key: 1,\n disabled: !item.hidden,\n to: `#${menuId.value}`\n }, [\n _createElementVNode(\"li\", {\n ref_for: true,\n ref_key: \"liRefs\",\n ref: liRefs,\n class: \"ds-whitespace-nowrap ds-pl-2 ds-text-black/[0.85]\"\n }, [\n _renderSlot(_ctx.$slots, `item-${index}`, { item: item }, () => [\n _createElementVNode(\"a\", {\n href: item.href,\n title: item.href\n }, _toDisplayString(item.text), 9, _hoisted_5)\n ]),\n (index < _ctx.items?.length - 1)\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_6, [\n _renderSlot(_ctx.$slots, `separator-${index}`, { item: item }, () => [\n _hoisted_7\n ])\n ]))\n : _createCommentVNode(\"\", true)\n ], 512)\n ], 8, [\"disabled\", \"to\"]))\n ], 64))\n }), 128))\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_createElementVNode","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_sfc_main","_defineComponent","__props","props","collapsedBreadcrumbMenu","ref","ulRef","liRefs","ellipsisRefs","menuRefs","breadcrumbItems","resizeObserver","ulRefWidth","ellipsisRefWidth","i","acc","item","isCollapsed","computed","menuId","uuid","toggleCollapedBreadcrumbMenu","initClickOutsideEventListener","closeOnClickOutside","removeClickOutsideEventListener","event","r","onMounted","nextTick","index","onUnmounted","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_Fragment","_renderList","_renderSlot","_toDisplayString","_withDirectives","_vShow","_createBlock","_Teleport","_a","_createCommentVNode"],"mappings":"uEAGMA,EAAa,CAAC,OAAQ,OAAO,EAC7BC,EAAa,CACjB,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A,mBAAoB,KAAM,CACxB,QAAS,GACT,QAAS,SACT,IAAKY,EACL,MAAO,mDAAA,EACN,CACD+B,aAAYP,EAAK,OAAQ,QAAQF,CAAK,GAAI,CAAE,KAAAb,CAAW,EAAG,IAAM,CAC9DrB,EAAAA,mBAAoB,IAAK,CACvB,KAAMqB,EAAK,KACX,MAAOA,EAAK,MACXuB,EAAiB,gBAAAvB,EAAK,IAAI,EAAG,EAAGnB,CAAU,CAAA,CAC9C,EACAgC,IAAQe,EAAAb,EAAK,QAAL,YAAAa,EAAY,QAAS,GACzBX,EAAAA,YAAcC,EAAAA,mBAAoB,OAAQpC,EAAY,CACrDwC,aAAYP,EAAK,OAAQ,aAAaF,CAAK,GAAI,CAAE,KAAAb,CAAW,EAAG,IAAM,CACnEjB,CAAA,CACD,CAAA,CACF,GACD8C,EAAAA,mBAAoB,GAAI,EAAI,GAC/B,GAAG,CACL,EAAA,EAAG,CAAC,WAAY,IAAI,CAAC,IAC3B,EAAE,CACN,CAAA,EAAG,GAAG,IACN,CAAC,EAEN,CAEA,CAAC"}
|
|
1
|
+
{"version":3,"file":"design-system26.js","sources":["../src/components/BBreadcrumb.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, vShow as _vShow, normalizeClass as _normalizeClass, withDirectives as _withDirectives, createCommentVNode as _createCommentVNode, Teleport as _Teleport, createBlock as _createBlock } from \"vue\"\n\nconst _hoisted_1 = [\"href\", \"title\"]\nconst _hoisted_2 = {\n \"aria-hidden\": \"true\",\n class: \"ds-pl-2\"\n}\nconst _hoisted_3 = /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-mb-0.5 ds-inline-block ds-h-4 ds-w-4\",\n viewBox: \"0 0 320 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z\" })\n], -1)\nconst _hoisted_4 = [\"id\"]\nconst _hoisted_5 = [\"href\", \"title\"]\nconst _hoisted_6 = {\n key: 0,\n \"aria-hidden\": \"true\",\n class: \"ds-pl-2\"\n}\nconst _hoisted_7 = /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-mb-0.5 ds-inline-block ds-h-4 ds-w-4\",\n viewBox: \"0 0 320 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z\" })\n], -1)\n\nimport { computed, nextTick, onMounted, onUnmounted, ref } from 'vue';\nimport { v4 as uuid } from 'uuid';\nimport type { BBreadcrumbItem } from '@/types';\n\ninterface BBreadcrumbItemInternal extends BBreadcrumbItem {\n hidden: boolean;\n width: number;\n}\n\n//#region Props\nexport interface BBreadcrumbProps {\n /**\n * Array of breadcrumb items.\n */\n items?: BBreadcrumbItem[];\n}\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BBreadcrumb',\n props: {\n items: { default: () => [] }\n },\n setup(__props: any) {\n\nconst props = __props;\n//#endregion\n\n//#region Data\nconst collapsedBreadcrumbMenu = ref(false);\nconst ulRef = ref<HTMLUListElement | null>(null);\nconst liRefs = ref<HTMLLIElement[] | null>(null);\nconst ellipsisRefs = ref<HTMLSpanElement[] | null>(null);\nconst menuRefs = ref<HTMLUListElement[] | null>(null);\nconst breadcrumbItems = ref<BBreadcrumbItemInternal[]>([]);\nconst resizeObserver = new ResizeObserver(() => {\n if (breadcrumbItems.value.length <= 1) {\n return;\n }\n\n const ulRefWidth = ulRef.value!.clientWidth;\n const ellipsisRefWidth = ellipsisRefs.value![0].clientWidth;\n\n for (let i = 1; i < breadcrumbItems.value.length; i++) {\n if (\n breadcrumbItems.value.reduce(\n (acc, item) => (!item.hidden ? acc + item.width : acc),\n 0,\n ) +\n ellipsisRefWidth >\n ulRefWidth\n ) {\n breadcrumbItems.value[i].hidden = true;\n } else {\n break;\n }\n }\n\n for (let i = breadcrumbItems.value.length - 1; i >= 1; i--) {\n if (breadcrumbItems.value[i].hidden) {\n if (\n breadcrumbItems.value.reduce(\n (acc, item) => (!item.hidden ? acc + item.width : acc),\n 0,\n ) +\n breadcrumbItems.value[i].width +\n ellipsisRefWidth <=\n ulRefWidth\n ) {\n breadcrumbItems.value[i].hidden = false;\n } else {\n break;\n }\n }\n }\n});\nconst isCollapsed = computed(() => breadcrumbItems.value.some((i) => i.hidden));\nconst menuId = computed(() => `menu-id-${uuid()}`);\n//#region\n\n//#region Methods\nconst toggleCollapedBreadcrumbMenu = () => {\n collapsedBreadcrumbMenu.value = !collapsedBreadcrumbMenu.value;\n};\nconst initClickOutsideEventListener = () => {\n document.addEventListener('click', closeOnClickOutside);\n};\nconst removeClickOutsideEventListener = () => {\n document.removeEventListener('click', closeOnClickOutside);\n};\nconst closeOnClickOutside = (event: any) => {\n const refs = [ellipsisRefs.value![0], menuRefs.value![0]];\n const withinBoundaries = refs.some((r) => event.composedPath().includes(r));\n if (!withinBoundaries) {\n collapsedBreadcrumbMenu.value = false;\n }\n};\n//#region\n\n//#region Lifecycle hooks\nonMounted(() => {\n initClickOutsideEventListener();\n resizeObserver.observe(ulRef.value!);\n\n breadcrumbItems.value = props.items.map(\n (item) =>\n ({\n ...item,\n hidden: false,\n width: 0,\n }) as BBreadcrumbItemInternal,\n );\n nextTick(() => {\n breadcrumbItems.value.forEach((item, index) => {\n item.width = liRefs.value![index].clientWidth;\n });\n });\n});\nonUnmounted(() => {\n removeClickOutsideEventListener();\n resizeObserver.unobserve(ulRef.value!);\n});\n//#region\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"ul\", {\n ref_key: \"ulRef\",\n ref: ulRef,\n class: _normalizeClass([{ collapsed: isCollapsed.value }, \"ds-relative ds-flex\"])\n }, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(breadcrumbItems.value, (item, index) => {\n return (_openBlock(), _createElementBlock(_Fragment, {\n key: `item${item.text}`\n }, [\n (index === 0)\n ? (_openBlock(), _createElementBlock(\"li\", {\n key: 0,\n ref_for: true,\n ref_key: \"liRefs\",\n ref: liRefs,\n class: \"ds-whitespace-nowrap ds-text-black/[0.85]\"\n }, [\n _renderSlot(_ctx.$slots, `item-${index}`, { item: item }, () => [\n _createElementVNode(\"a\", {\n href: item.href,\n title: item.href,\n class: \"hover:ds-text-primary-t\"\n }, _toDisplayString(item.text), 9, _hoisted_1)\n ]),\n _createElementVNode(\"span\", _hoisted_2, [\n _renderSlot(_ctx.$slots, `separator-${index}`, { item: item }, () => [\n _hoisted_3\n ])\n ]),\n _withDirectives(_createElementVNode(\"button\", {\n ref_for: true,\n ref_key: \"ellipsisRefs\",\n ref: ellipsisRefs,\n class: _normalizeClass([{ 'ds-bg-slate-50': collapsedBreadcrumbMenu.value }, \"ds-ml-2 ds-rounded-lg ds-bg-slate-100 ds-px-2 ds-text-primary-t hover:ds-bg-slate-50\"]),\n onClick: toggleCollapedBreadcrumbMenu\n }, \" ... \", 2), [\n [_vShow, isCollapsed.value]\n ]),\n _withDirectives(_createElementVNode(\"ul\", {\n id: menuId.value,\n ref_for: true,\n ref_key: \"menuRefs\",\n ref: menuRefs,\n class: \"ds-absolute ds-space-y-2 ds-rounded-lg ds-bg-white ds-p-4 ds-shadow\"\n }, null, 8, _hoisted_4), [\n [_vShow, isCollapsed.value && collapsedBreadcrumbMenu.value]\n ])\n ], 512))\n : (_openBlock(), _createBlock(_Teleport, {\n key: 1,\n disabled: !item.hidden,\n to: `#${menuId.value}`\n }, [\n _createElementVNode(\"li\", {\n ref_for: true,\n ref_key: \"liRefs\",\n ref: liRefs,\n class: \"ds-whitespace-nowrap ds-pl-2 ds-text-black/[0.85]\"\n }, [\n _renderSlot(_ctx.$slots, `item-${index}`, { item: item }, () => [\n _createElementVNode(\"a\", {\n href: item.href,\n title: item.href,\n class: \"hover:ds-text-primary-t\"\n }, _toDisplayString(item.text), 9, _hoisted_5)\n ]),\n (index < _ctx.items?.length - 1)\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_6, [\n _renderSlot(_ctx.$slots, `separator-${index}`, { item: item }, () => [\n _hoisted_7\n ])\n ]))\n : _createCommentVNode(\"\", true)\n ], 512)\n ], 8, [\"disabled\", \"to\"]))\n ], 64))\n }), 128))\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_createElementVNode","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_sfc_main","_defineComponent","__props","props","collapsedBreadcrumbMenu","ref","ulRef","liRefs","ellipsisRefs","menuRefs","breadcrumbItems","resizeObserver","ulRefWidth","ellipsisRefWidth","i","acc","item","isCollapsed","computed","menuId","uuid","toggleCollapedBreadcrumbMenu","initClickOutsideEventListener","closeOnClickOutside","removeClickOutsideEventListener","event","r","onMounted","nextTick","index","onUnmounted","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_Fragment","_renderList","_renderSlot","_toDisplayString","_withDirectives","_vShow","_createBlock","_Teleport","_a","_createCommentVNode"],"mappings":"uEAGMA,EAAa,CAAC,OAAQ,OAAO,EAC7BC,EAAa,CACjB,cAAe,OACf,MAAO,SACT,EACMC,uBAA8C,MAAO,CACzD,MAAO,0CACP,QAAS,cACT,MAAO,4BACT,EAAG,CACgCC,EAAAA,mBAAA,OAAQ,CAAE,EAAG,2KAA4K,CAC5N,EAAG,EAAE,EACCC,EAAa,CAAC,IAAI,EAClBC,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b,CAAW,EAAG,IAAM,CAC9DrB,EAAAA,mBAAoB,IAAK,CACvB,KAAMqB,EAAK,KACX,MAAOA,EAAK,KACZ,MAAO,2BACNuB,EAAiB,gBAAAvB,EAAK,IAAI,EAAG,EAAGnB,CAAU,CAAA,CAC9C,EACAgC,IAAQe,EAAAb,EAAK,QAAL,YAAAa,EAAY,QAAS,GACzBX,EAAAA,YAAcC,EAAAA,mBAAoB,OAAQpC,EAAY,CACrDwC,aAAYP,EAAK,OAAQ,aAAaF,CAAK,GAAI,CAAE,KAAAb,CAAW,EAAG,IAAM,CACnEjB,CAAA,CACD,CAAA,CACF,GACD8C,EAAAA,mBAAoB,GAAI,EAAI,GAC/B,GAAG,CACL,EAAA,EAAG,CAAC,WAAY,IAAI,CAAC,IAC3B,EAAE,CACN,CAAA,EAAG,GAAG,IACN,CAAC,EAEN,CAEA,CAAC"}
|
package/dist/design-system26.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as z, ref as n, computed as _, onMounted as M, nextTick as W, onUnmounted as S, openBlock as a, createElementBlock as u, normalizeClass as g, Fragment as y, renderList as D, renderSlot as f, createElementVNode as r, toDisplayString as R, withDirectives as B, vShow as $, createBlock as I, Teleport as N, createCommentVNode as T } from "vue";
|
|
2
2
|
import V from "./design-system102.mjs";
|
|
3
3
|
const F = ["href", "title"], P = {
|
|
4
4
|
"aria-hidden": "true",
|
|
@@ -19,103 +19,104 @@ const F = ["href", "title"], P = {
|
|
|
19
19
|
xmlns: "http://www.w3.org/2000/svg"
|
|
20
20
|
}, [
|
|
21
21
|
/* @__PURE__ */ r("path", { d: "M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z" })
|
|
22
|
-
], -1), K = /* @__PURE__ */
|
|
22
|
+
], -1), K = /* @__PURE__ */ z({
|
|
23
23
|
__name: "BBreadcrumb",
|
|
24
24
|
props: {
|
|
25
25
|
items: { default: () => [] }
|
|
26
26
|
},
|
|
27
|
-
setup(
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
27
|
+
setup(C) {
|
|
28
|
+
const x = C, i = n(!1), c = n(null), h = n(null), v = n(null), m = n(null), l = n([]), w = new ResizeObserver(() => {
|
|
29
|
+
if (l.value.length <= 1)
|
|
30
30
|
return;
|
|
31
|
-
const s = c.value.clientWidth,
|
|
32
|
-
for (let e = 1; e <
|
|
33
|
-
(
|
|
31
|
+
const s = c.value.clientWidth, o = v.value[0].clientWidth;
|
|
32
|
+
for (let e = 1; e < l.value.length && l.value.reduce(
|
|
33
|
+
(t, d) => d.hidden ? t : t + d.width,
|
|
34
34
|
0
|
|
35
|
-
) +
|
|
36
|
-
|
|
37
|
-
for (let e =
|
|
38
|
-
if (
|
|
39
|
-
if (
|
|
40
|
-
(
|
|
35
|
+
) + o > s; e++)
|
|
36
|
+
l.value[e].hidden = !0;
|
|
37
|
+
for (let e = l.value.length - 1; e >= 1; e--)
|
|
38
|
+
if (l.value[e].hidden)
|
|
39
|
+
if (l.value.reduce(
|
|
40
|
+
(t, d) => d.hidden ? t : t + d.width,
|
|
41
41
|
0
|
|
42
|
-
) +
|
|
43
|
-
|
|
42
|
+
) + l.value[e].width + o <= s)
|
|
43
|
+
l.value[e].hidden = !1;
|
|
44
44
|
else
|
|
45
45
|
break;
|
|
46
|
-
}), p =
|
|
47
|
-
|
|
46
|
+
}), p = _(() => l.value.some((s) => s.hidden)), b = _(() => `menu-id-${V()}`), E = () => {
|
|
47
|
+
i.value = !i.value;
|
|
48
48
|
}, L = () => {
|
|
49
|
-
document.addEventListener("click",
|
|
49
|
+
document.addEventListener("click", k);
|
|
50
50
|
}, O = () => {
|
|
51
|
-
document.removeEventListener("click",
|
|
52
|
-
},
|
|
53
|
-
[v.value[0], m.value[0]].some((
|
|
51
|
+
document.removeEventListener("click", k);
|
|
52
|
+
}, k = (s) => {
|
|
53
|
+
[v.value[0], m.value[0]].some((t) => s.composedPath().includes(t)) || (i.value = !1);
|
|
54
54
|
};
|
|
55
|
-
return
|
|
56
|
-
L(), w.observe(c.value),
|
|
55
|
+
return M(() => {
|
|
56
|
+
L(), w.observe(c.value), l.value = x.items.map(
|
|
57
57
|
(s) => ({
|
|
58
58
|
...s,
|
|
59
59
|
hidden: !1,
|
|
60
60
|
width: 0
|
|
61
61
|
})
|
|
62
|
-
),
|
|
63
|
-
|
|
64
|
-
s.width = h.value[
|
|
62
|
+
), W(() => {
|
|
63
|
+
l.value.forEach((s, o) => {
|
|
64
|
+
s.width = h.value[o].clientWidth;
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
|
-
}),
|
|
67
|
+
}), S(() => {
|
|
68
68
|
O(), w.unobserve(c.value);
|
|
69
|
-
}), (s,
|
|
69
|
+
}), (s, o) => (a(), u("ul", {
|
|
70
70
|
ref_key: "ulRef",
|
|
71
71
|
ref: c,
|
|
72
|
-
class:
|
|
72
|
+
class: g([{ collapsed: p.value }, "ds-relative ds-flex"])
|
|
73
73
|
}, [
|
|
74
|
-
(a(!0),
|
|
75
|
-
var
|
|
76
|
-
return a(),
|
|
74
|
+
(a(!0), u(y, null, D(l.value, (e, t) => {
|
|
75
|
+
var d;
|
|
76
|
+
return a(), u(y, {
|
|
77
77
|
key: `item${e.text}`
|
|
78
78
|
}, [
|
|
79
|
-
|
|
79
|
+
t === 0 ? (a(), u("li", {
|
|
80
80
|
key: 0,
|
|
81
81
|
ref_for: !0,
|
|
82
82
|
ref_key: "liRefs",
|
|
83
83
|
ref: h,
|
|
84
84
|
class: "ds-whitespace-nowrap ds-text-black/[0.85]"
|
|
85
85
|
}, [
|
|
86
|
-
f(s.$slots, `item-${
|
|
86
|
+
f(s.$slots, `item-${t}`, { item: e }, () => [
|
|
87
87
|
r("a", {
|
|
88
88
|
href: e.href,
|
|
89
|
-
title: e.href
|
|
90
|
-
|
|
89
|
+
title: e.href,
|
|
90
|
+
class: "hover:ds-text-primary-t"
|
|
91
|
+
}, R(e.text), 9, F)
|
|
91
92
|
]),
|
|
92
93
|
r("span", P, [
|
|
93
|
-
f(s.$slots, `separator-${
|
|
94
|
+
f(s.$slots, `separator-${t}`, { item: e }, () => [
|
|
94
95
|
U
|
|
95
96
|
])
|
|
96
97
|
]),
|
|
97
|
-
|
|
98
|
+
B(r("button", {
|
|
98
99
|
ref_for: !0,
|
|
99
100
|
ref_key: "ellipsisRefs",
|
|
100
101
|
ref: v,
|
|
101
|
-
class: "ds-ml-2 ds-rounded-lg ds-bg-slate-100 ds-px-2 ds-text-primary-t",
|
|
102
|
+
class: g([{ "ds-bg-slate-50": i.value }, "ds-ml-2 ds-rounded-lg ds-bg-slate-100 ds-px-2 ds-text-primary-t hover:ds-bg-slate-50"]),
|
|
102
103
|
onClick: E
|
|
103
|
-
}, " ... ",
|
|
104
|
-
[
|
|
104
|
+
}, " ... ", 2), [
|
|
105
|
+
[$, p.value]
|
|
105
106
|
]),
|
|
106
|
-
|
|
107
|
-
id:
|
|
107
|
+
B(r("ul", {
|
|
108
|
+
id: b.value,
|
|
108
109
|
ref_for: !0,
|
|
109
110
|
ref_key: "menuRefs",
|
|
110
111
|
ref: m,
|
|
111
112
|
class: "ds-absolute ds-space-y-2 ds-rounded-lg ds-bg-white ds-p-4 ds-shadow"
|
|
112
113
|
}, null, 8, j), [
|
|
113
|
-
[
|
|
114
|
+
[$, p.value && i.value]
|
|
114
115
|
])
|
|
115
116
|
], 512)) : (a(), I(N, {
|
|
116
117
|
key: 1,
|
|
117
118
|
disabled: !e.hidden,
|
|
118
|
-
to: `#${
|
|
119
|
+
to: `#${b.value}`
|
|
119
120
|
}, [
|
|
120
121
|
r("li", {
|
|
121
122
|
ref_for: !0,
|
|
@@ -123,14 +124,15 @@ const F = ["href", "title"], P = {
|
|
|
123
124
|
ref: h,
|
|
124
125
|
class: "ds-whitespace-nowrap ds-pl-2 ds-text-black/[0.85]"
|
|
125
126
|
}, [
|
|
126
|
-
f(s.$slots, `item-${
|
|
127
|
+
f(s.$slots, `item-${t}`, { item: e }, () => [
|
|
127
128
|
r("a", {
|
|
128
129
|
href: e.href,
|
|
129
|
-
title: e.href
|
|
130
|
-
|
|
130
|
+
title: e.href,
|
|
131
|
+
class: "hover:ds-text-primary-t"
|
|
132
|
+
}, R(e.text), 9, q)
|
|
131
133
|
]),
|
|
132
|
-
|
|
133
|
-
f(s.$slots, `separator-${
|
|
134
|
+
t < ((d = s.items) == null ? void 0 : d.length) - 1 ? (a(), u("span", A, [
|
|
135
|
+
f(s.$slots, `separator-${t}`, { item: e }, () => [
|
|
134
136
|
G
|
|
135
137
|
])
|
|
136
138
|
])) : T("", !0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-system26.mjs","sources":["../src/components/BBreadcrumb.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, vShow as _vShow, withDirectives as _withDirectives, createCommentVNode as _createCommentVNode, Teleport as _Teleport, createBlock as _createBlock, normalizeClass as _normalizeClass } from \"vue\"\n\nconst _hoisted_1 = [\"href\", \"title\"]\nconst _hoisted_2 = {\n \"aria-hidden\": \"true\",\n class: \"ds-pl-2\"\n}\nconst _hoisted_3 = /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-mb-0.5 ds-inline-block ds-h-4 ds-w-4\",\n viewBox: \"0 0 320 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z\" })\n], -1)\nconst _hoisted_4 = [\"id\"]\nconst _hoisted_5 = [\"href\", \"title\"]\nconst _hoisted_6 = {\n key: 0,\n \"aria-hidden\": \"true\",\n class: \"ds-pl-2\"\n}\nconst _hoisted_7 = /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-mb-0.5 ds-inline-block ds-h-4 ds-w-4\",\n viewBox: \"0 0 320 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z\" })\n], -1)\n\nimport { computed, nextTick, onMounted, onUnmounted, ref } from 'vue';\nimport { v4 as uuid } from 'uuid';\nimport type { BBreadcrumbItem } from '@/types';\n\ninterface BBreadcrumbItemInternal extends BBreadcrumbItem {\n hidden: boolean;\n width: number;\n}\n\n//#region Props\nexport interface BBreadcrumbProps {\n /**\n * Array of breadcrumb items.\n */\n items?: BBreadcrumbItem[];\n}\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BBreadcrumb',\n props: {\n items: { default: () => [] }\n },\n setup(__props: any) {\n\nconst props = __props;\n//#endregion\n\n//#region Data\nconst collapsedBreadcrumbMenu = ref(false);\nconst ulRef = ref<HTMLUListElement | null>(null);\nconst liRefs = ref<HTMLLIElement[] | null>(null);\nconst ellipsisRefs = ref<HTMLSpanElement[] | null>(null);\nconst menuRefs = ref<HTMLUListElement[] | null>(null);\nconst breadcrumbItems = ref<BBreadcrumbItemInternal[]>([]);\nconst resizeObserver = new ResizeObserver(() => {\n if (breadcrumbItems.value.length <= 1) {\n return;\n }\n\n const ulRefWidth = ulRef.value!.clientWidth;\n const ellipsisRefWidth = ellipsisRefs.value![0].clientWidth;\n\n for (let i = 1; i < breadcrumbItems.value.length; i++) {\n if (\n breadcrumbItems.value.reduce(\n (acc, item) => (!item.hidden ? acc + item.width : acc),\n 0,\n ) +\n ellipsisRefWidth >\n ulRefWidth\n ) {\n breadcrumbItems.value[i].hidden = true;\n } else {\n break;\n }\n }\n\n for (let i = breadcrumbItems.value.length - 1; i >= 1; i--) {\n if (breadcrumbItems.value[i].hidden) {\n if (\n breadcrumbItems.value.reduce(\n (acc, item) => (!item.hidden ? acc + item.width : acc),\n 0,\n ) +\n breadcrumbItems.value[i].width +\n ellipsisRefWidth <=\n ulRefWidth\n ) {\n breadcrumbItems.value[i].hidden = false;\n } else {\n break;\n }\n }\n }\n});\nconst isCollapsed = computed(() => breadcrumbItems.value.some((i) => i.hidden));\nconst menuId = computed(() => `menu-id-${uuid()}`);\n//#region\n\n//#region Methods\nconst toggleCollapedBreadcrumbMenu = () => {\n console.log('...');\n collapsedBreadcrumbMenu.value = !collapsedBreadcrumbMenu.value;\n};\nconst initClickOutsideEventListener = () => {\n document.addEventListener('click', closeOnClickOutside);\n};\nconst removeClickOutsideEventListener = () => {\n document.removeEventListener('click', closeOnClickOutside);\n};\nconst closeOnClickOutside = (event: any) => {\n const refs = [ellipsisRefs.value![0], menuRefs.value![0]];\n const withinBoundaries = refs.some((r) => event.composedPath().includes(r));\n if (!withinBoundaries) {\n collapsedBreadcrumbMenu.value = false;\n }\n};\n//#region\n\n//#region Lifecycle hooks\nonMounted(() => {\n initClickOutsideEventListener();\n resizeObserver.observe(ulRef.value!);\n\n breadcrumbItems.value = props.items.map(\n (item) =>\n ({\n ...item,\n hidden: false,\n width: 0,\n }) as BBreadcrumbItemInternal,\n );\n nextTick(() => {\n breadcrumbItems.value.forEach((item, index) => {\n item.width = liRefs.value![index].clientWidth;\n });\n });\n});\nonUnmounted(() => {\n removeClickOutsideEventListener();\n resizeObserver.unobserve(ulRef.value!);\n});\n//#region\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"ul\", {\n ref_key: \"ulRef\",\n ref: ulRef,\n class: _normalizeClass([{ collapsed: isCollapsed.value }, \"ds-relative ds-flex\"])\n }, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(breadcrumbItems.value, (item, index) => {\n return (_openBlock(), _createElementBlock(_Fragment, {\n key: `item${item.text}`\n }, [\n (index === 0)\n ? (_openBlock(), _createElementBlock(\"li\", {\n key: 0,\n ref_for: true,\n ref_key: \"liRefs\",\n ref: liRefs,\n class: \"ds-whitespace-nowrap ds-text-black/[0.85]\"\n }, [\n _renderSlot(_ctx.$slots, `item-${index}`, { item: item }, () => [\n _createElementVNode(\"a\", {\n href: item.href,\n title: item.href\n }, _toDisplayString(item.text), 9, _hoisted_1)\n ]),\n _createElementVNode(\"span\", _hoisted_2, [\n _renderSlot(_ctx.$slots, `separator-${index}`, { item: item }, () => [\n _hoisted_3\n ])\n ]),\n _withDirectives(_createElementVNode(\"button\", {\n ref_for: true,\n ref_key: \"ellipsisRefs\",\n ref: ellipsisRefs,\n class: \"ds-ml-2 ds-rounded-lg ds-bg-slate-100 ds-px-2 ds-text-primary-t\",\n onClick: toggleCollapedBreadcrumbMenu\n }, \" ... \", 512), [\n [_vShow, isCollapsed.value]\n ]),\n _withDirectives(_createElementVNode(\"ul\", {\n id: menuId.value,\n ref_for: true,\n ref_key: \"menuRefs\",\n ref: menuRefs,\n class: \"ds-absolute ds-space-y-2 ds-rounded-lg ds-bg-white ds-p-4 ds-shadow\"\n }, null, 8, _hoisted_4), [\n [_vShow, isCollapsed.value && collapsedBreadcrumbMenu.value]\n ])\n ], 512))\n : (_openBlock(), _createBlock(_Teleport, {\n key: 1,\n disabled: !item.hidden,\n to: `#${menuId.value}`\n }, [\n _createElementVNode(\"li\", {\n ref_for: true,\n ref_key: \"liRefs\",\n ref: liRefs,\n class: \"ds-whitespace-nowrap ds-pl-2 ds-text-black/[0.85]\"\n }, [\n _renderSlot(_ctx.$slots, `item-${index}`, { item: item }, () => [\n _createElementVNode(\"a\", {\n href: item.href,\n title: item.href\n }, _toDisplayString(item.text), 9, _hoisted_5)\n ]),\n (index < _ctx.items?.length - 1)\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_6, [\n _renderSlot(_ctx.$slots, `separator-${index}`, { item: item }, () => [\n _hoisted_7\n ])\n ]))\n : _createCommentVNode(\"\", true)\n ], 512)\n ], 8, [\"disabled\", \"to\"]))\n ], 64))\n }), 128))\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_createElementVNode","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_sfc_main","_defineComponent","__props","props","collapsedBreadcrumbMenu","ref","ulRef","liRefs","ellipsisRefs","menuRefs","breadcrumbItems","resizeObserver","ulRefWidth","ellipsisRefWidth","i","acc","item","isCollapsed","computed","menuId","uuid","toggleCollapedBreadcrumbMenu","initClickOutsideEventListener","closeOnClickOutside","removeClickOutsideEventListener","event","r","onMounted","nextTick","index","onUnmounted","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_Fragment","_renderList","_renderSlot","_toDisplayString","_withDirectives","_vShow","_createBlock","_Teleport","_a","_createCommentVNode"],"mappings":";;AAGA,MAAMA,IAAa,CAAC,QAAQ,OAAO,GAC7BC,IAAa;AAAA,EACjB,eAAe;AAAA,EACf,OAAO;AACT,GACMC,sBAA8C,OAAO;AAAA,EACzD,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AACT,GAAG;AAAA,EACgCC,gBAAAA,EAAA,QAAQ,EAAE,GAAG,4KAA4K;AAC5N,GAAG,EAAE,GACCC,IAAa,CAAC,IAAI,GAClBC,IAAa,CAAC,QAAQ,OAAO,GAC7BC,IAAa;AAAA,EACjB,KAAK;AAAA,EACL,eAAe;AAAA,EACf,OAAO;AACT,GACMC,sBAA8C,OAAO;AAAA,EACzD,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AACT,GAAG;AAAA,EACgCJ,gBAAAA,EAAA,QAAQ,EAAE,GAAG,4KAA4K;AA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cACT,SAAS;AAAA,cACT,KAAKY;AAAA,cACL,OAAO;AAAA,YAAA,GACN;AAAA,cACD+B,EAAYP,EAAK,QAAQ,QAAQF,CAAK,IAAI,EAAE,MAAAb,EAAW,GAAG,MAAM;AAAA,gBAC9DrB,EAAoB,KAAK;AAAA,kBACvB,MAAMqB,EAAK;AAAA,kBACX,OAAOA,EAAK;AAAA,mBACXuB,EAAiBvB,EAAK,IAAI,GAAG,GAAGnB,CAAU;AAAA,cAAA,CAC9C;AAAA,cACAgC,MAAQe,IAAAb,EAAK,UAAL,gBAAAa,EAAY,UAAS,KACzBX,KAAcC,EAAoB,QAAQpC,GAAY;AAAA,gBACrDwC,EAAYP,EAAK,QAAQ,aAAaF,CAAK,IAAI,EAAE,MAAAb,EAAW,GAAG,MAAM;AAAA,kBACnEjB;AAAA,gBAAA,CACD;AAAA,cAAA,CACF,KACD8C,EAAoB,IAAI,EAAI;AAAA,eAC/B,GAAG;AAAA,UACL,GAAA,GAAG,CAAC,YAAY,IAAI,CAAC;AAAA,WAC3B,EAAE;AAAA,MACN,CAAA,GAAG,GAAG;AAAA,OACN,CAAC;AAAA,EAEN;AAEA,CAAC;"}
|
|
1
|
+
{"version":3,"file":"design-system26.mjs","sources":["../src/components/BBreadcrumb.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, vShow as _vShow, normalizeClass as _normalizeClass, withDirectives as _withDirectives, createCommentVNode as _createCommentVNode, Teleport as _Teleport, createBlock as _createBlock } from \"vue\"\n\nconst _hoisted_1 = [\"href\", \"title\"]\nconst _hoisted_2 = {\n \"aria-hidden\": \"true\",\n class: \"ds-pl-2\"\n}\nconst _hoisted_3 = /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-mb-0.5 ds-inline-block ds-h-4 ds-w-4\",\n viewBox: \"0 0 320 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z\" })\n], -1)\nconst _hoisted_4 = [\"id\"]\nconst _hoisted_5 = [\"href\", \"title\"]\nconst _hoisted_6 = {\n key: 0,\n \"aria-hidden\": \"true\",\n class: \"ds-pl-2\"\n}\nconst _hoisted_7 = /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-mb-0.5 ds-inline-block ds-h-4 ds-w-4\",\n viewBox: \"0 0 320 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z\" })\n], -1)\n\nimport { computed, nextTick, onMounted, onUnmounted, ref } from 'vue';\nimport { v4 as uuid } from 'uuid';\nimport type { BBreadcrumbItem } from '@/types';\n\ninterface BBreadcrumbItemInternal extends BBreadcrumbItem {\n hidden: boolean;\n width: number;\n}\n\n//#region Props\nexport interface BBreadcrumbProps {\n /**\n * Array of breadcrumb items.\n */\n items?: BBreadcrumbItem[];\n}\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BBreadcrumb',\n props: {\n items: { default: () => [] }\n },\n setup(__props: any) {\n\nconst props = __props;\n//#endregion\n\n//#region Data\nconst collapsedBreadcrumbMenu = ref(false);\nconst ulRef = ref<HTMLUListElement | null>(null);\nconst liRefs = ref<HTMLLIElement[] | null>(null);\nconst ellipsisRefs = ref<HTMLSpanElement[] | null>(null);\nconst menuRefs = ref<HTMLUListElement[] | null>(null);\nconst breadcrumbItems = ref<BBreadcrumbItemInternal[]>([]);\nconst resizeObserver = new ResizeObserver(() => {\n if (breadcrumbItems.value.length <= 1) {\n return;\n }\n\n const ulRefWidth = ulRef.value!.clientWidth;\n const ellipsisRefWidth = ellipsisRefs.value![0].clientWidth;\n\n for (let i = 1; i < breadcrumbItems.value.length; i++) {\n if (\n breadcrumbItems.value.reduce(\n (acc, item) => (!item.hidden ? acc + item.width : acc),\n 0,\n ) +\n ellipsisRefWidth >\n ulRefWidth\n ) {\n breadcrumbItems.value[i].hidden = true;\n } else {\n break;\n }\n }\n\n for (let i = breadcrumbItems.value.length - 1; i >= 1; i--) {\n if (breadcrumbItems.value[i].hidden) {\n if (\n breadcrumbItems.value.reduce(\n (acc, item) => (!item.hidden ? acc + item.width : acc),\n 0,\n ) +\n breadcrumbItems.value[i].width +\n ellipsisRefWidth <=\n ulRefWidth\n ) {\n breadcrumbItems.value[i].hidden = false;\n } else {\n break;\n }\n }\n }\n});\nconst isCollapsed = computed(() => breadcrumbItems.value.some((i) => i.hidden));\nconst menuId = computed(() => `menu-id-${uuid()}`);\n//#region\n\n//#region Methods\nconst toggleCollapedBreadcrumbMenu = () => {\n collapsedBreadcrumbMenu.value = !collapsedBreadcrumbMenu.value;\n};\nconst initClickOutsideEventListener = () => {\n document.addEventListener('click', closeOnClickOutside);\n};\nconst removeClickOutsideEventListener = () => {\n document.removeEventListener('click', closeOnClickOutside);\n};\nconst closeOnClickOutside = (event: any) => {\n const refs = [ellipsisRefs.value![0], menuRefs.value![0]];\n const withinBoundaries = refs.some((r) => event.composedPath().includes(r));\n if (!withinBoundaries) {\n collapsedBreadcrumbMenu.value = false;\n }\n};\n//#region\n\n//#region Lifecycle hooks\nonMounted(() => {\n initClickOutsideEventListener();\n resizeObserver.observe(ulRef.value!);\n\n breadcrumbItems.value = props.items.map(\n (item) =>\n ({\n ...item,\n hidden: false,\n width: 0,\n }) as BBreadcrumbItemInternal,\n );\n nextTick(() => {\n breadcrumbItems.value.forEach((item, index) => {\n item.width = liRefs.value![index].clientWidth;\n });\n });\n});\nonUnmounted(() => {\n removeClickOutsideEventListener();\n resizeObserver.unobserve(ulRef.value!);\n});\n//#region\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"ul\", {\n ref_key: \"ulRef\",\n ref: ulRef,\n class: _normalizeClass([{ collapsed: isCollapsed.value }, \"ds-relative ds-flex\"])\n }, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(breadcrumbItems.value, (item, index) => {\n return (_openBlock(), _createElementBlock(_Fragment, {\n key: `item${item.text}`\n }, [\n (index === 0)\n ? (_openBlock(), _createElementBlock(\"li\", {\n key: 0,\n ref_for: true,\n ref_key: \"liRefs\",\n ref: liRefs,\n class: \"ds-whitespace-nowrap ds-text-black/[0.85]\"\n }, [\n _renderSlot(_ctx.$slots, `item-${index}`, { item: item }, () => [\n _createElementVNode(\"a\", {\n href: item.href,\n title: item.href,\n class: \"hover:ds-text-primary-t\"\n }, _toDisplayString(item.text), 9, _hoisted_1)\n ]),\n _createElementVNode(\"span\", _hoisted_2, [\n _renderSlot(_ctx.$slots, `separator-${index}`, { item: item }, () => [\n _hoisted_3\n ])\n ]),\n _withDirectives(_createElementVNode(\"button\", {\n ref_for: true,\n ref_key: \"ellipsisRefs\",\n ref: ellipsisRefs,\n class: _normalizeClass([{ 'ds-bg-slate-50': collapsedBreadcrumbMenu.value }, \"ds-ml-2 ds-rounded-lg ds-bg-slate-100 ds-px-2 ds-text-primary-t hover:ds-bg-slate-50\"]),\n onClick: toggleCollapedBreadcrumbMenu\n }, \" ... \", 2), [\n [_vShow, isCollapsed.value]\n ]),\n _withDirectives(_createElementVNode(\"ul\", {\n id: menuId.value,\n ref_for: true,\n ref_key: \"menuRefs\",\n ref: menuRefs,\n class: \"ds-absolute ds-space-y-2 ds-rounded-lg ds-bg-white ds-p-4 ds-shadow\"\n }, null, 8, _hoisted_4), [\n [_vShow, isCollapsed.value && collapsedBreadcrumbMenu.value]\n ])\n ], 512))\n : (_openBlock(), _createBlock(_Teleport, {\n key: 1,\n disabled: !item.hidden,\n to: `#${menuId.value}`\n }, [\n _createElementVNode(\"li\", {\n ref_for: true,\n ref_key: \"liRefs\",\n ref: liRefs,\n class: \"ds-whitespace-nowrap ds-pl-2 ds-text-black/[0.85]\"\n }, [\n _renderSlot(_ctx.$slots, `item-${index}`, { item: item }, () => [\n _createElementVNode(\"a\", {\n href: item.href,\n title: item.href,\n class: \"hover:ds-text-primary-t\"\n }, _toDisplayString(item.text), 9, _hoisted_5)\n ]),\n (index < _ctx.items?.length - 1)\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_6, [\n _renderSlot(_ctx.$slots, `separator-${index}`, { item: item }, () => [\n _hoisted_7\n ])\n ]))\n : _createCommentVNode(\"\", true)\n ], 512)\n ], 8, [\"disabled\", \"to\"]))\n ], 64))\n }), 128))\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_createElementVNode","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_sfc_main","_defineComponent","__props","props","collapsedBreadcrumbMenu","ref","ulRef","liRefs","ellipsisRefs","menuRefs","breadcrumbItems","resizeObserver","ulRefWidth","ellipsisRefWidth","i","acc","item","isCollapsed","computed","menuId","uuid","toggleCollapedBreadcrumbMenu","initClickOutsideEventListener","closeOnClickOutside","removeClickOutsideEventListener","event","r","onMounted","nextTick","index","onUnmounted","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_Fragment","_renderList","_renderSlot","_toDisplayString","_withDirectives","_vShow","_createBlock","_Teleport","_a","_createCommentVNode"],"mappings":";;AAGA,MAAMA,IAAa,CAAC,QAAQ,OAAO,GAC7BC,IAAa;AAAA,EACjB,eAAe;AAAA,EACf,OAAO;AACT,GACMC,sBAA8C,OAAO;AAAA,EACzD,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AACT,GAAG;AA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=require("./design-system4.js"),A=require("./design-system52.js"),k=require("./design-system109.js"),P=require("./design-system48.js"),U=require("./design-system3.js"),H=require("./design-system32.js"),O=require("./design-system11.js"),G=require("./design-system31.js"),J=require("./design-system102.js"),K=require("./design-
|
|
1
|
+
"use strict";const e=require("vue"),y=require("./design-system4.js"),A=require("./design-system52.js"),k=require("./design-system109.js"),P=require("./design-system48.js"),U=require("./design-system3.js"),H=require("./design-system32.js"),O=require("./design-system11.js"),G=require("./design-system31.js"),J=require("./design-system102.js"),K=require("./design-system105.js"),Q=i=>(e.pushScopeId("data-v-8033e228"),i=i(),e.popScopeId(),i),W={class:"b-image-picker ds-w-full"},X={class:"ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow"},Y={key:0,class:"ds-flex ds-flex-wrap ds-justify-center ds-gap-1"},Z=["onClick","onDragenter","onDragstart","onDrop"],ee=["src"],te=["src"],ae={class:"ds-flex ds-flex-wrap ds-justify-center"},le=Q(()=>e.createElementVNode("svg",{class:"ds-h-4 ds-w-4 ds-fill-primary-t",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("path",{d:"M447.1 32h-384C28.64 32-.0091 60.65-.0091 96v320c0 35.35 28.65 64 63.1 64h384c35.35 0 64-28.65 64-64V96C511.1 60.65 483.3 32 447.1 32zM111.1 96c26.51 0 48 21.49 48 48S138.5 192 111.1 192s-48-21.49-48-48S85.48 96 111.1 96zM446.1 407.6C443.3 412.8 437.9 416 432 416H82.01c-6.021 0-11.53-3.379-14.26-8.75c-2.73-5.367-2.215-11.81 1.334-16.68l70-96C142.1 290.4 146.9 288 152 288s9.916 2.441 12.93 6.574l32.46 44.51l93.3-139.1C293.7 194.7 298.7 192 304 192s10.35 2.672 13.31 7.125l128 192C448.6 396 448.9 402.3 446.1 407.6z"})],-1)),se=["accept","multiple"],re=e.defineComponent({__name:"BImagePicker",props:{inputId:{default:""},modelValue:{},label:{default:""},multiple:{type:Boolean,default:!1},maxFileSize:{default:20},hideDetails:{type:Boolean,default:!1},required:{type:Boolean,default:!1},requiredErrorMessage:{default:""},validationRules:{default:void 0}},emits:["change","update:modelValue"],setup(i,{expose:V,emit:w}){const l=i,u=w,{t:p}=A.useI18n(),g=e.ref(null),f=e.ref(0),r=e.computed({get(){return l.modelValue},set(t){u("update:modelValue",t)}}),v=e.ref(!0),m=e.ref(!0),c=e.ref({visible:!1,url:""}),_=e.computed(()=>y.FileImageTypes.join(", ")),B=e.computed(()=>l.inputId||`id-${J()}`),D={validateRule:t=>!!t&&t.length>0,errorMessage:()=>l.requiredErrorMessage||p("ds.global.field_required")},C={validateRule:()=>v.value,errorMessage:()=>p("ds.components.base.image_picker.file_types_valid",{types:_.value})},I={validateRule:()=>m.value,errorMessage:()=>p("ds.components.base.image_picker.file_size_valid",{size:l.maxFileSize})},b=e.computed(()=>{let t=[];return l.required&&t.push(D),l.validationRules&&(t=t.concat(l.validationRules)),t.push(C),t.push(I),t.length?t:void 0}),{validate:d,validationResult:E}=U.useValidationField(B.value,r,b.value),q=(t,a)=>{f.value=t,a.target.classList.add("dragging"),a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("index",t.toString())},x=t=>{t.target.classList.remove("dragging")},N=(t,a)=>{const s=a.target;f.value!==t&&s.classList.add("dropped-target")},F=t=>{t.preventDefault(),t.dataTransfer.dropEffect="move"},S=t=>{t.target.classList.remove("dropped-target")},M=(t,a)=>{a.preventDefault(),a.target.classList.remove("dropped-target");const o=parseInt(a.dataTransfer.getData("index")),n=r.value[o];r.value.splice(o,1),r.value.splice(t,0,n),u("change"),d()},R=()=>{var t;(t=g.value)==null||t.click()},T=t=>{let a=t.target.files||t.dataTransfer.files;a.length&&(z(a),g.value&&(g.value.value=null))},z=t=>{Array.from(t).forEach(a=>{if(v.value=y.FileImageTypes.includes(a.type),m.value=j(a.size)<=l.maxFileSize,v.value&&m.value){let s=new FileReader;s.onload=o=>{l.multiple?r.value.push({url:o.target.result,file:a,type:a.type}):r.value={url:o.target.result,file:a,type:a.type},u("change"),d()},s.readAsDataURL(a)}else d()})},L=t=>{r.value.splice(t,1),u("change"),d()},$=()=>{r.value={},u("change"),d()},j=t=>t/1024**2,h=t=>{c.value.url=t.url||"",c.value.visible=!0};return V({validate:d}),(t,a)=>(e.openBlock(),e.createElementBlock("div",W,[e.createVNode(H,{label:l.label},null,8,["label"]),e.createElementVNode("div",X,[e.unref(K)(r.value)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Y,[l.multiple?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(r.value,(s,o)=>(e.openBlock(),e.createElementBlock("div",{key:s.url,class:"b-image-picker__draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t",draggable:"true",onClick:n=>h(s),onDragend:x,onDragenter:n=>N(o,n),onDragleave:S,onDragover:F,onDragstart:n=>q(o,n),onDrop:n=>M(o,n)},[e.createElementVNode("img",{src:s.url,alt:"image",class:"ds-h-full ds-w-full ds-rounded-lg"},null,8,ee),e.createVNode(k,{class:"ds-right-1 ds-top-1 ds-h-8 ds-w-8",onClick:e.withModifiers(n=>L(o),["stop"])},null,8,["onClick"])],40,Z))),128)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"b-image-picker__draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t",draggable:"true",onClick:a[0]||(a[0]=s=>h(r.value))},[e.createElementVNode("img",{src:r.value.url,alt:"image",class:"ds-h-full ds-w-full ds-rounded-lg"},null,8,te),e.createVNode(k,{class:"ds-right-1 ds-top-1 ds-h-8 ds-w-8",onClick:e.withModifiers($,["stop"])})]))])),e.createElementVNode("div",ae,[e.createVNode(O,{onClick:R},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p)("ds.components.base.image_picker.select_image")),1)]),appendIcon:e.withCtx(()=>[le]),_:1}),e.createElementVNode("input",{ref_key:"inputRef",ref:g,accept:_.value,multiple:l.multiple,class:"ds-hidden",type:"file",onChange:T},null,40,se)])]),l.hideDetails?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(G,{key:0,"error-message":e.unref(E).errorMessage(),class:"ds-mt-1"},null,8,["error-message"])),e.createVNode(P,{modelValue:c.value.visible,"onUpdate:modelValue":a[1]||(a[1]=s=>c.value.visible=s),url:c.value.url},null,8,["modelValue","url"])]))}});module.exports=re;
|
|
2
2
|
//# sourceMappingURL=design-system89.js.map
|
package/dist/design-system89.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import ie from "./design-system32.mjs";
|
|
|
8
8
|
import de from "./design-system11.mjs";
|
|
9
9
|
import ne from "./design-system31.mjs";
|
|
10
10
|
import ue from "./design-system102.mjs";
|
|
11
|
-
import ce from "./design-
|
|
11
|
+
import ce from "./design-system105.mjs";
|
|
12
12
|
const ge = (u) => (ae("data-v-8033e228"), u = u(), le(), u), pe = { class: "b-image-picker ds-w-full" }, me = { class: "ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow" }, ve = {
|
|
13
13
|
key: 0,
|
|
14
14
|
class: "ds-flex ds-flex-wrap ds-justify-center ds-gap-1"
|
package/dist/design-system92.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),g=require("./design-system32.js"),V=require("./design-system3.js"),q=require("./design-system31.js"),B=require("./design-system52.js"),C=require("./design-
|
|
1
|
+
"use strict";const e=require("vue"),g=require("./design-system32.js"),V=require("./design-system3.js"),q=require("./design-system31.js"),B=require("./design-system52.js"),C=require("./design-system103.js"),E=require("./design-system5.js"),N=require("./design-system102.js"),R={class:"b-currency-field"},I={class:"ds-relative"},S={key:0,class:"b-currency-field__prepend-icon ds-absolute ds-left-3 ds-top-0 ds-z-[1] ds-flex ds-h-full ds-cursor-pointer ds-items-center hover:ds-text-primary-t"},M=["id","autocomplete","disabled","placeholder","readonly"],w={key:1,class:"b-currency-field__append-icon ds-absolute ds-right-3 ds-top-0 ds-z-[1] ds-flex ds-h-full ds-cursor-pointer ds-items-center hover:ds-text-primary-t"},$=e.defineComponent({__name:"BCurrencyField",props:{inputId:{default:""},inputCssClass:{default:""},modelValue:{},label:{default:""},validationRules:{default:void 0},placeholder:{default:""},autocomplete:{type:Boolean,default:!1},required:{type:Boolean,default:!1},requiredErrorMessage:{default:""},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},hideDetails:{type:Boolean,default:!1},locale:{default:E.SupportedLocale["vi-VN"]}},emits:["press:enter","update:modelValue"],setup(i,{emit:c}){const t=i,a=c;let o;const{t:p}=B.useI18n(),u=e.ref(null),m={validateRule:s=>!!(s&&(s!=null&&s.trim())),errorMessage:()=>t.requiredErrorMessage||p("ds.global.field_required")},r=e.computed(()=>t.inputId||`id-${N()}`),l=e.computed({get(){return t.modelValue},set(s){a("update:modelValue",s)}}),f=e.computed(()=>[{"ds-cursor-not-allowed ds-bg-[#f2f2f2] ds-text-black/[0.4]":t.disabled,"ds-text-black/[0.85]":!t.disabled,"ds-border-error focus:ds-ring-1 focus:ds-ring-error":!d.value.valid,"ds-border-black/[0.1] focus:ds-border-focus focus:ds-ring-1 focus:ds-ring-focus":d.value.valid},t.inputCssClass]),v=e.computed(()=>{let s=[];return t.required&&s.push(m),t.validationRules&&(s=s.concat(t.validationRules)),s.length?s:void 0}),k=e.computed(()=>t.locale==="en-US"?{mask:"$num",blocks:{num:{mask:Number,thousandsSeparator:" "}}}:[{mask:""},{mask:"num VND",lazy:!1,blocks:{num:{mask:Number,thousandsSeparator:" "}}}]),{validate:b,validationResult:d}=V.useValidationField(r.value,l,v.value);e.watch(()=>t.locale,()=>{n()}),e.watch(()=>t.modelValue,s=>{s!=o.unmaskedValue&&(o.unmaskedValue=s.toString())});const _=()=>{b()},y=()=>{a("press:enter")},h=()=>{l.value=typeof l.value=="number"?+o.unmaskedValue:o.unmaskedValue},n=()=>{o&&o.destroy(),o=C(u.value,k.value),o.on("accept",h)};return e.onMounted(()=>{n(),o.unmaskedValue=l.value.toString()}),(s,x)=>(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(g,{id:r.value,label:s.label,required:s.required},null,8,["id","label","required"]),e.createElementVNode("div",I,[s.$slots.prependIcon?(e.openBlock(),e.createElementBlock("div",S,[e.renderSlot(s.$slots,"prependIcon",{},void 0,!0)])):e.createCommentVNode("",!0),e.createElementVNode("input",{id:r.value,ref_key:"inputRef",ref:u,autocomplete:t.autocomplete?"on":"off",class:e.normalizeClass([f.value,"ds-block ds-h-[40px] ds-w-full ds-rounded-lg ds-border ds-px-3 ds-text-sm ds-drop-shadow-light"]),disabled:t.disabled,placeholder:t.placeholder,readonly:t.readonly,onKeyup:[_,e.withKeys(y,["enter"])]},null,42,M),s.$slots.appendIcon?(e.openBlock(),e.createElementBlock("div",w,[e.renderSlot(s.$slots,"appendIcon",{},void 0,!0)])):e.createCommentVNode("",!0)]),s.hideDetails?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(q,{key:0,"error-message":e.unref(d).errorMessage(),class:"ds-mt-1"},null,8,["error-message"]))]))}});module.exports=$;
|
|
2
2
|
//# sourceMappingURL=design-system92.js.map
|
package/dist/design-system92.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import z from "./design-system32.mjs";
|
|
|
3
3
|
import { useValidationField as K } from "./design-system3.mjs";
|
|
4
4
|
import D from "./design-system31.mjs";
|
|
5
5
|
import { useI18n as U } from "./design-system52.mjs";
|
|
6
|
-
import F from "./design-
|
|
6
|
+
import F from "./design-system103.mjs";
|
|
7
7
|
import { SupportedLocale as A } from "./design-system5.mjs";
|
|
8
8
|
import L from "./design-system102.mjs";
|
|
9
9
|
const O = { class: "b-currency-field" }, j = { class: "ds-relative" }, G = {
|