@nubisco/ui 5.42.0 → 5.43.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/{Accordion-DY1Oml0f.js → Accordion-2bbHhUR3.js} +1 -1
- package/dist/{Accordion-Deg1qqmZ.cjs → Accordion-CD_BZ3Xb.cjs} +1 -1
- package/dist/Accordion.context-D0CjtbPU.cjs +1 -0
- package/dist/{Accordion.context-BQy1VnEM.js → Accordion.context-Wz0ugH_k.js} +1 -1
- package/dist/{AccordionItem-DVwcaU3f.cjs → AccordionItem-BOIL14KX.cjs} +1 -1
- package/dist/{AccordionItem-BrpJObcb.js → AccordionItem-Cg4m1SfF.js} +1 -1
- package/dist/{AiProvider-_ZQ9C9k3.js → AiProvider-BwX0fWR4.js} +1 -1
- package/dist/{AiProvider-BaZBbtJz.cjs → AiProvider-PuA_dYYu.cjs} +1 -1
- package/dist/BarChart-34fIWzBC.cjs +1 -0
- package/dist/BarChart-CcmkojSX.js +399 -0
- package/dist/{Blueprint-BUH7BNRk.cjs → Blueprint-Bv8EweAy.cjs} +1 -1
- package/dist/{Blueprint-Bqiyvbkg.js → Blueprint-C8VbPuw9.js} +1 -1
- package/dist/Blueprint.context-BxEzW6uR.cjs +1 -0
- package/dist/Blueprint.context-CFAikJ3j.js +4 -0
- package/dist/{BlueprintCard-CRcMUcbC.cjs → BlueprintCard-WaIQcsDQ.cjs} +1 -1
- package/dist/{BlueprintCard-CrLvovri.js → BlueprintCard-jJjQydFH.js} +1 -1
- package/dist/{Checkbox-ColjurT5.js → Checkbox-5ANAIFrb.js} +1 -1
- package/dist/{Checkbox-hoojePrb.cjs → Checkbox-CtUFfX3m.cjs} +1 -1
- package/dist/{CheckboxGroup-B6UmmUpN.js → CheckboxGroup-CORB_666.js} +1 -1
- package/dist/{CheckboxGroup-DRTRfYnm.cjs → CheckboxGroup-DUwsVYmt.cjs} +1 -1
- package/dist/CheckboxGroup.context-BapH2lov.cjs +1 -0
- package/dist/{CheckboxGroup.context-BXBbxCqM.js → CheckboxGroup.context-uxyp82XM.js} +1 -1
- package/dist/{Confirm-D800tV98.cjs → Confirm-7uLqv38W.cjs} +1 -1
- package/dist/{Confirm-DuYdhU4R.js → Confirm-c2Ss3_hy.js} +1 -1
- package/dist/{DataTable-CijHryn5.js → DataTable-C44scor6.js} +1 -1
- package/dist/{DataTable-DeRtqCsP.cjs → DataTable-JG2gCpgz.cjs} +1 -1
- package/dist/{Stepper-CHRsH26g.cjs → Stepper-Br62BsXD.cjs} +1 -1
- package/dist/{Stepper-Do9WOdhu.js → Stepper-n2ZH-4Gf.js} +1 -1
- package/dist/{Stepper.context-BaKuMRsu.js → Stepper.context-7n0SuGh_.js} +1 -1
- package/dist/Stepper.context-DVnGO61u.cjs +1 -0
- package/dist/{StepperStep-8Z1ERb7I.cjs → StepperStep-CjxVhsbr.cjs} +1 -1
- package/dist/{StepperStep-AGFO5cKL.js → StepperStep-Co1KKj9h.js} +1 -1
- package/dist/{SuggestionList-BdFhF0fM.cjs → SuggestionList-C6LGxP-U.cjs} +1 -1
- package/dist/{SuggestionList-CTJEWb2x.js → SuggestionList-IAeZl5eK.js} +1 -1
- package/dist/{TextInput-D5vlfecS.js → TextInput-Cxnxq2F6.js} +1 -1
- package/dist/{TextInput-IAk1KYb5.cjs → TextInput-D6YChZsO.cjs} +1 -1
- package/dist/TextInput.context-BrDuawa9.cjs +1 -0
- package/dist/{TextInput.context-qkmg5Mpm.js → TextInput.context-CR-Svohb.js} +1 -1
- package/dist/{Tree-B0-bRZLF.js → Tree-BMKUnt--.js} +1 -1
- package/dist/{Tree-DHLVF8eV.cjs → Tree-DDYIaQhW.cjs} +1 -1
- package/dist/TreeContext-CKcfg0Nq.cjs +1 -0
- package/dist/TreeContext-CvZCLIr2.js +4 -0
- package/dist/{TreeNode-ixiFKZpi.cjs → TreeNode-BDCrTAs_.cjs} +1 -1
- package/dist/{TreeNode-CjXf_kJH.js → TreeNode-CyJM0bOD.js} +1 -1
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +18 -18
- package/dist/components/Accordion.cjs +1 -1
- package/dist/components/Accordion.context.d.ts +1 -1
- package/dist/components/Accordion.mjs +1 -1
- package/dist/components/AccordionItem.cjs +1 -1
- package/dist/components/AccordionItem.mjs +1 -1
- package/dist/components/AiProvider.cjs +1 -1
- package/dist/components/AiProvider.mjs +1 -1
- package/dist/components/Blueprint.cjs +1 -1
- package/dist/components/Blueprint.context.d.ts +1 -1
- package/dist/components/Blueprint.context.d.ts.map +1 -1
- package/dist/components/Blueprint.mjs +1 -1
- package/dist/components/BlueprintCard.cjs +1 -1
- package/dist/components/BlueprintCard.mjs +1 -1
- package/dist/components/Charts/BarChart.cjs +1 -1
- package/dist/components/Charts/BarChart.d.ts +15 -0
- package/dist/components/Charts/BarChart.mjs +1 -1
- package/dist/components/Charts/BarChart.vue.d.ts +5 -0
- package/dist/components/Charts/BarChart.vue.d.ts.map +1 -1
- package/dist/components/Checkbox.cjs +1 -1
- package/dist/components/Checkbox.mjs +1 -1
- package/dist/components/CheckboxGroup.cjs +1 -1
- package/dist/components/CheckboxGroup.context.d.ts +1 -1
- package/dist/components/CheckboxGroup.context.d.ts.map +1 -1
- package/dist/components/CheckboxGroup.mjs +1 -1
- package/dist/components/Confirm.cjs +1 -1
- package/dist/components/Confirm.mjs +1 -1
- package/dist/components/DataTable.cjs +1 -1
- package/dist/components/DataTable.mjs +1 -1
- package/dist/components/Stepper.cjs +1 -1
- package/dist/components/Stepper.context.d.ts +1 -1
- package/dist/components/Stepper.context.d.ts.map +1 -1
- package/dist/components/Stepper.mjs +1 -1
- package/dist/components/StepperStep.cjs +1 -1
- package/dist/components/StepperStep.mjs +1 -1
- package/dist/components/SuggestionList.cjs +1 -1
- package/dist/components/SuggestionList.mjs +1 -1
- package/dist/components/TextInput.cjs +1 -1
- package/dist/components/TextInput.context.d.ts +1 -1
- package/dist/components/TextInput.context.d.ts.map +1 -1
- package/dist/components/TextInput.mjs +1 -1
- package/dist/components/Tree.cjs +1 -1
- package/dist/components/Tree.mjs +1 -1
- package/dist/components/TreeContext.d.ts.map +1 -1
- package/dist/components/TreeNode.cjs +1 -1
- package/dist/components/TreeNode.mjs +1 -1
- package/dist/composables/flagRegistry.cjs +1 -1
- package/dist/composables/flagRegistry.d.ts.map +1 -1
- package/dist/composables/flagRegistry.mjs +14 -13
- package/dist/composables/iconRegistry.cjs +1 -1
- package/dist/composables/iconRegistry.d.ts.map +1 -1
- package/dist/composables/iconRegistry.mjs +12 -11
- package/dist/composables/useBlueprint.composable.cjs +1 -1
- package/dist/composables/useBlueprint.composable.mjs +1 -1
- package/dist/composables/useCommandPalette.composable.cjs +1 -1
- package/dist/composables/useCommandPalette.composable.d.ts.map +1 -1
- package/dist/composables/useCommandPalette.composable.js +1 -1
- package/dist/composables/useCommandPalette.composable.mjs +1 -1
- package/dist/composables/useConfirm.composable.cjs +1 -1
- package/dist/composables/useConfirm.composable.mjs +1 -1
- package/dist/composables/useScrollLock.composable.cjs +1 -1
- package/dist/composables/useScrollLock.composable.d.ts.map +1 -1
- package/dist/composables/useScrollLock.composable.mjs +14 -10
- package/dist/composables/useShellLayout.composable.cjs +1 -1
- package/dist/composables/useShellLayout.composable.d.ts.map +1 -1
- package/dist/composables/useShellLayout.composable.mjs +1 -1
- package/dist/composables/useShellSlot.composable.cjs +1 -1
- package/dist/composables/useShellSlot.composable.d.ts.map +1 -1
- package/dist/composables/useShellSlot.composable.mjs +1 -1
- package/dist/composables/useSurfaceLayer.composable.cjs +1 -1
- package/dist/composables/useSurfaceLayer.composable.d.ts.map +1 -1
- package/dist/composables/useSurfaceLayer.composable.mjs +1 -1
- package/dist/composables/useTheme.composable.cjs +1 -1
- package/dist/composables/useTheme.composable.d.ts.map +1 -1
- package/dist/composables/useTheme.composable.mjs +40 -33
- package/dist/composables/useToast.composable.cjs +1 -1
- package/dist/composables/useToast.composable.d.ts.map +1 -1
- package/dist/composables/useToast.composable.mjs +23 -22
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +18 -18
- package/dist/styles/BarChart.css +1 -1
- package/dist/ui.css +1 -1
- package/dist/utils/sharedState.helper.cjs +1 -0
- package/dist/utils/sharedState.helper.d.ts +39 -0
- package/dist/utils/sharedState.helper.d.ts.map +1 -0
- package/dist/utils/sharedState.helper.mjs +10 -0
- package/package.json +1 -1
- package/src/utils/sharedState.helper.ts +47 -0
- package/dist/Accordion.context-C7Xkdn0J.cjs +0 -1
- package/dist/BarChart-Ci0qaOZm.cjs +0 -1
- package/dist/BarChart-DF9C-09O.js +0 -294
- package/dist/Blueprint.context-BOP7aLQl.js +0 -4
- package/dist/Blueprint.context-C0sg1sbm.cjs +0 -1
- package/dist/CheckboxGroup.context-Cq9keYoj.cjs +0 -1
- package/dist/Stepper.context-vC_Cctnn.cjs +0 -1
- package/dist/TextInput.context-kCqQ5HWv.cjs +0 -1
- package/dist/TreeContext-B73gZjHy.cjs +0 -1
- package/dist/TreeContext-dgGdNVcW.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./Accordion.context-
|
|
1
|
+
import { t as e } from "./Accordion.context-Wz0ugH_k.js";
|
|
2
2
|
import { t } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
3
3
|
import { computed as n, createElementBlock as r, defineComponent as i, normalizeClass as a, openBlock as o, provide as s, ref as c, renderSlot as l, toRef as u } from "vue";
|
|
4
4
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Accordion.context-
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Accordion.context-D0CjtbPU.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`);let n=require(`vue`);var r=(0,n.defineComponent)({__name:`Accordion`,props:{modelValue:{default:void 0},multiple:{type:Boolean,default:!1},flush:{type:Boolean,default:!1},align:{default:`end`},size:{default:`md`},headingLevel:{default:3}},emits:[`update:modelValue`,`toggle`],setup(t,{emit:r}){let i=t,a=r,o=(0,n.ref)([]),s=(0,n.computed)(()=>i.modelValue===void 0?o.value:i.modelValue);function c(e){i.modelValue===void 0&&(o.value=e),a(`update:modelValue`,e)}function l(e){let t=s.value.includes(e);c(t?s.value.filter(t=>t!==e):i.multiple?[...s.value,e]:[e]),a(`toggle`,e,!t)}let u=[];function d(e,t){return u.push({id:e,el:t}),()=>{let t=u.findIndex(t=>t.id===e);t>=0&&u.splice(t,1)}}function f(e,t){let n=u.map(e=>({...e,node:e.el()})).filter(e=>e.node&&!e.node.hasAttribute(`disabled`)).sort((e,t)=>e.node.compareDocumentPosition(t.node)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);if(!n.length)return;let r=n.findIndex(t=>t.id===e);(t===`first`?n[0]:t===`last`?n[n.length-1]:t===`next`?n[(r+1)%n.length]:n[(r-1+n.length)%n.length])?.node?.focus()}return(0,n.provide)(e.t,{open:s,multiple:(0,n.toRef)(i,`multiple`),align:(0,n.toRef)(i,`align`),size:(0,n.toRef)(i,`size`),flush:(0,n.toRef)(i,`flush`),headingLevel:(0,n.toRef)(i,`headingLevel`),toggle:l,register:d,focusSibling:f}),(e,r)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{class:(0,n.normalizeClass)([`nb-accordion`,[`nb-accordion--${t.size}`,`nb-accordion--align-${t.align}`,{"nb-accordion--flush":t.flush}]])},[(0,n.renderSlot)(e.$slots,`default`,{},void 0,!0)],2))}}),i=t.t(r,[[`__scopeId`,`data-v-48067146`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Symbol.for(`@nubisco/ui:accordion-context`);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Accordion.context-
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Accordion.context-D0CjtbPU.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Icon-C8R_r_In.cjs`),r=require(`./composables/useStableId.composable.cjs`),i=require(`./InfoHint-D35B8g96.cjs`);let a=require(`vue`),o=require(`@nubisco/ui/icons/caret-down`);var s=[`aria-level`],c=[`id`,`aria-expanded`,`aria-controls`,`aria-describedby`,`disabled`],l={class:`nb-accordion-item__title`},u={key:1,class:`nb-accordion-item__meta`},d=[`id`],f={key:2,class:`nb-accordion-item__actions`},p=[`id`,`aria-labelledby`,`hidden`],m={class:`nb-accordion-item__body`},h=(0,a.defineComponent)({__name:`AccordionItem`,props:{id:{default:void 0},title:{default:``},icon:{default:void 0},meta:{default:``},info:{default:void 0},disabled:{type:Boolean,default:!1}},setup(t){let h=t,g=(0,a.useSlots)(),_=(0,a.computed)(()=>!!h.meta||!!g.meta),v=(0,a.computed)(()=>!!h.info||!!g.actions),y=(0,a.inject)(e.t,null),b=r.useStableId(h),x=(0,a.computed)(()=>y?.headingLevel?.value??3),S=(0,a.computed)(()=>b),C=(0,a.ref)(null),w=(0,a.computed)(()=>y?.open.value.includes(S.value)??!1);y&&(0,a.onBeforeUnmount)(y.register(S.value,()=>C.value));function T(){h.disabled||y?.toggle(S.value)}let E={ArrowUp:`prev`,ArrowDown:`next`,Home:`first`,End:`last`};function D(e){let t=E[e.key];!t||!y||(e.preventDefault(),y.focusSibling(S.value,t))}return(e,r)=>((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{class:(0,a.normalizeClass)([`nb-accordion-item`,{"nb-accordion-item--open":w.value,"nb-accordion-item--disabled":t.disabled}])},[(0,a.createElementVNode)(`div`,{class:(0,a.normalizeClass)([`nb-accordion-item__heading`,{"nb-accordion-item__heading--aside":v.value}]),role:`heading`,"aria-level":x.value},[(0,a.createElementVNode)(`button`,{id:`${S.value}-header`,ref_key:`headerRef`,ref:C,type:`button`,class:`nb-accordion-item__header`,"aria-expanded":w.value,"aria-controls":`${S.value}-panel`,"aria-describedby":v.value&&_.value?`${S.value}-meta`:void 0,disabled:t.disabled,onClick:T,onKeydown:D},[(0,a.createVNode)(n.t,{class:`nb-accordion-item__chevron`,name:(0,a.unref)(o.regular),size:16,"aria-hidden":`true`},null,8,[`name`]),t.icon?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:0,name:t.icon,size:16},null,8,[`name`])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`span`,l,[(0,a.renderSlot)(e.$slots,`title`,{},()=>[(0,a.createTextVNode)((0,a.toDisplayString)(t.title),1)],!0)]),!v.value&&_.value?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,u,[(0,a.renderSlot)(e.$slots,`meta`,{},()=>[(0,a.createTextVNode)((0,a.toDisplayString)(t.meta),1)],!0)])):(0,a.createCommentVNode)(``,!0)],40,c),v.value?((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:0},[t.info?((0,a.openBlock)(),(0,a.createBlock)(i.t,{key:0,class:`nb-accordion-item__info`,text:t.info,size:14,label:`About ${t.title||`this section`}`},null,8,[`text`,`label`])):(0,a.createCommentVNode)(``,!0),r[0]||=(0,a.createElementVNode)(`span`,{class:`nb-accordion-item__spacer`,"aria-hidden":`true`},null,-1),_.value?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,{key:1,id:`${S.value}-meta`,class:`nb-accordion-item__meta nb-accordion-item__meta--raised`,onClick:T},[(0,a.renderSlot)(e.$slots,`meta`,{},()=>[(0,a.createTextVNode)((0,a.toDisplayString)(t.meta),1)],!0)],8,d)):(0,a.createCommentVNode)(``,!0),e.$slots.actions?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,f,[(0,a.renderSlot)(e.$slots,`actions`,{},void 0,!0)])):(0,a.createCommentVNode)(``,!0)],64)):(0,a.createCommentVNode)(``,!0)],10,s),(0,a.createElementVNode)(`div`,{id:`${S.value}-panel`,class:`nb-accordion-item__panel`,role:`region`,"aria-labelledby":`${S.value}-header`,hidden:!w.value},[(0,a.createElementVNode)(`div`,m,[(0,a.renderSlot)(e.$slots,`default`,{},void 0,!0)])],8,p)],2))}}),g=t.t(h,[[`__scopeId`,`data-v-99a498d8`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return g}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./Accordion.context-
|
|
1
|
+
import { t as e } from "./Accordion.context-Wz0ugH_k.js";
|
|
2
2
|
import { t } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
3
3
|
import { t as n } from "./Icon-rREAqsu0.js";
|
|
4
4
|
import { useStableId as r } from "./composables/useStableId.composable.mjs";
|
|
@@ -3,7 +3,7 @@ import { t } from "./AiLabel-CPINOrQd.js";
|
|
|
3
3
|
import { t as n } from "./Field-6haRtm1-.js";
|
|
4
4
|
import { t as r } from "./Panel-B3kJkm_w.js";
|
|
5
5
|
import { t as i } from "./Select-cEKAoY4x.js";
|
|
6
|
-
import { t as a } from "./TextInput-
|
|
6
|
+
import { t as a } from "./TextInput-Cxnxq2F6.js";
|
|
7
7
|
import { createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, openBlock as p, renderSlot as m, toDisplayString as h, withCtx as g } from "vue";
|
|
8
8
|
//#region src/components/AiProvider.vue?vue&type=script&setup=true&lang.ts
|
|
9
9
|
var _ = { class: "nb-ai-provider__header" }, v = { class: "nb-ai-provider__title" }, y = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Button-B-8ikYRN.cjs`),t=require(`./AiLabel-BK3oecvT.cjs`),n=require(`./Field-C7JxGz6g.cjs`),r=require(`./Panel-DKp-aPUn.cjs`),i=require(`./Select-CnieTPOL.cjs`),a=require(`./TextInput-
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Button-B-8ikYRN.cjs`),t=require(`./AiLabel-BK3oecvT.cjs`),n=require(`./Field-C7JxGz6g.cjs`),r=require(`./Panel-DKp-aPUn.cjs`),i=require(`./Select-CnieTPOL.cjs`),a=require(`./TextInput-D6YChZsO.cjs`);let o=require(`vue`);var s={class:`nb-ai-provider__header`},c={class:`nb-ai-provider__title`},l={key:0,class:`nb-ai-provider__description`},u={class:`nb-ai-provider__row`},d={class:`nb-ai-provider__actions`},f=(0,o.defineComponent)({__name:`AiProvider`,props:{title:{default:`AI briefings`},providers:{default:()=>[{label:`Anthropic (Claude)`,value:`anthropic`},{label:`OpenAI`,value:`openai`},{label:`Google Gemini`,value:`gemini`}]},provider:{default:`anthropic`},model:{default:``},apiKey:{default:``},defaultModels:{default:()=>({})},hasKey:{type:Boolean,default:!1},busy:{type:Boolean,default:!1}},emits:[`update:provider`,`update:model`,`update:apiKey`,`save`,`remove`],setup(f,{emit:p}){let m=p;return(p,h)=>((0,o.openBlock)(),(0,o.createBlock)(r.t,{class:`nb-ai-provider`},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)(`header`,s,[(0,o.createElementVNode)(`h2`,c,[(0,o.createTextVNode)((0,o.toDisplayString)(f.title)+` `,1),(0,o.createVNode)(t.t,{static:``,size:`sm`})]),p.$slots.default?((0,o.openBlock)(),(0,o.createElementBlock)(`div`,l,[(0,o.renderSlot)(p.$slots,`default`)])):(0,o.createCommentVNode)(``,!0)]),(0,o.createElementVNode)(`div`,u,[(0,o.createVNode)(n.t,{label:`Provider`,orientation:`stack`},{default:(0,o.withCtx)(({id:e})=>[(0,o.createVNode)(i.t,{id:e,"model-value":f.provider,options:f.providers,disabled:f.busy,"onUpdate:modelValue":h[0]||=e=>m(`update:provider`,String(e))},null,8,[`id`,`model-value`,`options`,`disabled`])]),_:1}),(0,o.createVNode)(n.t,{label:`Model`,hint:`Empty uses the provider's default.`,orientation:`stack`},{default:(0,o.withCtx)(({id:e})=>[(0,o.createVNode)(a.t,{id:e,"model-value":f.model,placeholder:f.defaultModels[f.provider]??``,disabled:f.busy,"onUpdate:modelValue":h[1]||=e=>m(`update:model`,String(e??``))},null,8,[`id`,`model-value`,`placeholder`,`disabled`])]),_:1})]),(0,o.createVNode)(n.t,{label:`API key`,hint:`Encrypted at rest and never sent back to the browser, so this field is always empty when the page loads.`,orientation:`stack`},{default:(0,o.withCtx)(({id:e})=>[(0,o.createVNode)(a.t,{id:e,"model-value":f.apiKey,type:`password`,autocomplete:`off`,placeholder:f.hasKey?`Stored. Type a new key to replace it.`:`sk-...`,disabled:f.busy,"onUpdate:modelValue":h[2]||=e=>m(`update:apiKey`,String(e??``))},null,8,[`id`,`model-value`,`placeholder`,`disabled`])]),_:1}),(0,o.createElementVNode)(`div`,d,[(0,o.createVNode)(e.t,{variant:`primary`,loading:f.busy,onClick:h[3]||=e=>m(`save`)},{default:(0,o.withCtx)(()=>[...h[5]||=[(0,o.createTextVNode)(` Save AI settings `,-1)]]),_:1},8,[`loading`]),f.hasKey?((0,o.openBlock)(),(0,o.createBlock)(e.t,{key:0,variant:`ghost`,disabled:f.busy,onClick:h[4]||=e=>m(`remove`)},{default:(0,o.withCtx)(()=>[...h[6]||=[(0,o.createTextVNode)(` Remove key `,-1)]]),_:1},8,[`disabled`])):(0,o.createCommentVNode)(``,!0)])]),_:3}))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./palette-9NBcW3rl.cjs`),n=require(`./ChartLegend-DGUo_MYi.cjs`),r=require(`./scales-Bdgv87s2.cjs`),i=require(`./useChartSize-ByPUvppp.cjs`);let a=require(`vue`);var o=[`width`,`height`,`role`,`aria-label`],s={key:0},c=[`x1`,`x2`,`y1`,`y2`],l={key:1,class:`nb-chart__axis`},u=[`x`,`y`,`text-anchor`,`dominant-baseline`],d={class:`nb-chart__axis`},ee=[`x`,`y`,`text-anchor`,`dominant-baseline`],f=[`x1`,`x2`,`y1`,`y2`],te={key:3,class:`nb-chart__empty-layer`,"aria-hidden":`true`},ne=[`d`,`fill`,`tabindex`,`role`,`aria-label`,`onKeydown`],p=[`fill`,`tabindex`,`role`,`aria-label`,`onKeydown`],re={class:`nb-chart__hover-layer`},m=[`onMouseenter`,`onMousemove`,`onClick`],h=2,g=(0,a.defineComponent)({__name:`BarChart`,props:{series:{default:()=>[]},orientation:{default:`vertical`},stacked:{type:Boolean,default:!1},valueFormatter:{},barRadius:{default:0},showEmpty:{type:Boolean,default:!1},showBaseline:{type:Boolean,default:!0},showValueAxis:{type:Boolean,default:!0},categoryLabelEvery:{default:1},title:{default:void 0},subtitle:{default:void 0},height:{default:280},showLegend:{type:Boolean,default:!0},showTooltip:{type:Boolean,default:!0},showGrid:{type:Boolean,default:!0},colors:{default:()=>t.n}},emits:[`select`],setup(e,{emit:g}){let _=e,v=g,y=(0,a.ref)(null),b=i.t(y,{width:480,height:240}),x=(0,a.computed)(()=>_.orientation===`horizontal`),S=(0,a.computed)(()=>_.series.map((e,n)=>({name:e.name,data:e.data,color:e.color??t.i(n,_.colors)}))),C=(0,a.computed)(()=>(_.series[0]?.data??[]).map(e=>e.x)),w=(e,t)=>S.value[t]?.data[e]?.y??0,T=(e,t)=>{let n=w(e,t);if(!_.stacked)return[0,n];let r=0;for(let i=0;i<t;i+=1){let t=w(e,i);t>=0==n>=0&&(r+=t)}return[r,r+n]},E=(0,a.computed)(()=>{let e=[];return C.value.forEach((t,n)=>{S.value.forEach((t,r)=>{e.push(T(n,r)[1])})}),e.length?r.i(Math.min(0,...e),Math.max(0,...e),.05):[0,1]}),D=(0,a.computed)(()=>{if(!x.value)return{top:12,right:16,bottom:28,left:_.showValueAxis?44:16};let e=C.value.reduce((e,t)=>Math.max(e,String(t).length),0),t=Math.max(44,Math.round(b.value.width*.4));return{top:12,right:16,bottom:_.showValueAxis?28:12,left:Math.min(Math.max(44,Math.ceil(e*6.2)+12),t)}}),O=(0,a.computed)(()=>({x0:D.value.left,x1:Math.max(D.value.left,b.value.width-D.value.right),y0:D.value.top,y1:Math.max(D.value.top,b.value.height-D.value.bottom)})),k=(0,a.computed)(()=>r.t(C.value.map(e=>String(e)),x.value?[O.value.y0,O.value.y1]:[O.value.x0,O.value.x1],.2)),A=(0,a.computed)(()=>r.r(E.value,x.value?[O.value.x0,O.value.x1]:[O.value.y1,O.value.y0])),j=(0,a.computed)(()=>A.value.ticks(5)),M=e=>k.value(String(C.value[e])),N=e=>M(e)+k.value.bandwidth/2,P=(0,a.computed)(()=>{let e=S.value.length||1;return _.stacked?k.value.bandwidth:k.value.bandwidth/e}),F=(e,t)=>{let[n,r]=T(e,t),i=A.value(n),a=A.value(r),o=Math.max(0,P.value-2),s=M(e)+(_.stacked?0:t*P.value),c=Math.max(0,Math.abs(a-i));return x.value?{x:Math.min(i,a),y:s,width:c,height:o}:{x:s,y:Math.min(i,a),width:o,height:c}},ie=(0,a.computed)(()=>{let e=Math.floor(_.categoryLabelEvery);return Number.isFinite(e)&&e>1?e:1}),I=(0,a.computed)(()=>C.value.map((e,t)=>({cat:e,i:t})).filter(({i:e})=>e%ie.value===0)),L=(0,a.computed)(()=>_.barRadius>0),R=(e,t)=>{if(!_.stacked)return!0;let n=w(e,t);for(let r=t+1;r<S.value.length;r+=1){let t=w(e,r);if(t!==0&&t>=0==n>=0)return!1}return!0},z=(e,t,n,r,[i,a,o,s])=>[`M${e+i},${t}`,`H${e+n-a}`,`A${a},${a} 0 0 1 ${e+n},${t+a}`,`V${t+r-o}`,`A${o},${o} 0 0 1 ${e+n-o},${t+r}`,`H${e+s}`,`A${s},${s} 0 0 1 ${e},${t+r-s}`,`V${t+i}`,`A${i},${i} 0 0 1 ${e+i},${t}`,`Z`].join(` `),B=(e,t)=>{let{x:n,y:r,width:i,height:a}=F(e,t),o=x.value?a:i,s=x.value?i:a,c=R(e,t)?Math.max(0,Math.min(_.barRadius,o/2,s)):0,l=w(e,t)>=0,u;return u=x.value?l?[0,c,c,0]:[c,0,0,c]:l?[c,c,0,0]:[0,0,c,c],z(n,r,i,a,u)},V=(0,a.computed)(()=>C.value.map((e,t)=>t).filter(e=>S.value.every((t,n)=>w(e,n)===0))),H=e=>{let t=A.value(0),n=Math.max(0,k.value.bandwidth-2),r=L.value?Math.min(_.barRadius,h/2):0;return x.value?{x:t,y:M(e),width:h,height:n,rx:r}:{x:M(e),y:t-h,width:n,height:h,rx:r}},U=e=>{let t=M(e),n=k.value.bandwidth;return x.value?{x:O.value.x0,y:t,width:Math.max(0,O.value.x1-O.value.x0),height:n}:{x:t,y:O.value.y0,width:n,height:Math.max(0,O.value.y1-O.value.y0)}},W=e=>Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:String(e),G=e=>_.valueFormatter?_.valueFormatter(e):W(e),K=(0,a.getCurrentInstance)(),q=()=>!!K?.vnode.props?.onSelect,J=(e,t)=>{let n=S.value[t],r=G(w(e,t));return S.value.length>1?`${C.value[e]}, ${n?.name}: ${r}`:`${C.value[e]}: ${r}`},Y=(e,t)=>{let n=S.value[t],r=n?.data[e];return{kind:`series`,x:r?.x??C.value[e],y:r?.y??0,seriesName:n?.name??``,seriesIndex:t,index:e,point:r??{x:C.value[e],y:0}}},X=e=>{let t=e.currentTarget.ownerSVGElement;if(!t)return null;let n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}},ae=(e,t)=>{let n=S.value.length;if(n<=1)return 0;let r=X(e);if(!r)return 0;if(_.stacked){let e=x.value?r.x:r.y;for(let r=0;r<n;r+=1){let[n,i]=T(t,r),a=A.value(n),o=A.value(i);if(e>=Math.min(a,o)&&e<=Math.max(a,o))return r}return n-1}let i=(x.value?r.y:r.x)-M(t),a=Math.floor(i/(P.value||1));return Math.min(Math.max(a,0),n-1)},oe=(e,t)=>{q()&&v(`select`,Y(t,ae(e,t)))},Z=(e,t,n)=>{q()&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),v(`select`,Y(t,n))))},Q=(0,a.ref)(null),$=(0,a.ref)({x:0,y:0}),se=(e,t)=>{let n=X(e);n&&($.value={x:n.x+12,y:n.y+12},Q.value=t)},ce=(0,a.computed)(()=>Q.value===null?[]:S.value.map(e=>{let t=e.data[Q.value];return{label:e.name,value:t?.label??G(t?.y??0),color:e.color}}));return(r,i)=>((0,a.openBlock)(),(0,a.createBlock)(t.u,{title:e.title,subtitle:e.subtitle,height:e.height,"show-legend":e.showLegend&&S.value.length>0},{legend:(0,a.withCtx)(()=>[(0,a.createVNode)(n.t,{items:S.value.map(e=>({label:e.name,color:e.color}))},null,8,[`items`])]),default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`div`,{ref_key:`root`,ref:y,class:`nb-bar-chart`},[((0,a.openBlock)(),(0,a.createElementBlock)(`svg`,{width:(0,a.unref)(b).width,height:(0,a.unref)(b).height,class:(0,a.normalizeClass)([`nb-chart__svg`,{"nb-chart__svg--selectable":q()}]),role:q()?`group`:`img`,"aria-label":e.title||`Bar chart`,onMouseleave:i[0]||=e=>Q.value=null},[e.showGrid&&(0,a.unref)(b).width>0?((0,a.openBlock)(),(0,a.createElementBlock)(`g`,s,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(j.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`line`,{key:`grid-${e}`,class:`nb-chart__gridline`,x1:x.value?A.value(e):O.value.x0,x2:x.value?A.value(e):O.value.x1,y1:x.value?O.value.y0:A.value(e),y2:x.value?O.value.y1:A.value(e)},null,8,c))),128))])):(0,a.createCommentVNode)(``,!0),e.showValueAxis?((0,a.openBlock)(),(0,a.createElementBlock)(`g`,l,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(j.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`vt-${e}`,x:x.value?A.value(e):O.value.x0-6,y:x.value?O.value.y1+14:A.value(e),"text-anchor":x.value?`middle`:`end`,"dominant-baseline":x.value?`auto`:`middle`},(0,a.toDisplayString)(G(e)),9,u))),128))])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`g`,d,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(I.value,({cat:e,i:t})=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`ct-${t}`,x:x.value?O.value.x0-6:N(t),y:x.value?N(t):O.value.y1+14,"text-anchor":x.value?`end`:`middle`,"dominant-baseline":x.value?`middle`:`auto`},(0,a.toDisplayString)(e),9,ee))),128))]),e.showBaseline?((0,a.openBlock)(),(0,a.createElementBlock)(`line`,{key:2,class:`nb-chart__axis-line`,x1:x.value?A.value(0):O.value.x0,x2:x.value?A.value(0):O.value.x1,y1:x.value?O.value.y0:A.value(0),y2:x.value?O.value.y1:A.value(0)},null,8,f)):(0,a.createCommentVNode)(``,!0),e.showEmpty?((0,a.openBlock)(),(0,a.createElementBlock)(`g`,te,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(V.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`rect`,(0,a.mergeProps)({key:`empty-${e}`,class:`nb-chart__empty`},{ref_for:!0},H(e)),null,16))),128))])):(0,a.createCommentVNode)(``,!0),((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(C.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`g`,{key:`g-${t}`},[L.value?((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,{key:0},(0,a.renderList)(S.value,(e,n)=>((0,a.openBlock)(),(0,a.createElementBlock)(`path`,{key:`${t}-${n}`,class:(0,a.normalizeClass)([`nb-chart__bar`,{"is-dim":Q.value!==null&&Q.value!==t}]),d:B(t,n),fill:e.color,tabindex:q()?0:void 0,role:q()?`button`:void 0,"aria-label":q()?J(t,n):void 0,onKeydown:e=>Z(e,t,n)},null,42,ne))),128)):((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,{key:1},(0,a.renderList)(S.value,(e,n)=>((0,a.openBlock)(),(0,a.createElementBlock)(`rect`,(0,a.mergeProps)({key:`${t}-${n}`,class:[`nb-chart__bar`,{"is-dim":Q.value!==null&&Q.value!==t}]},{ref_for:!0},F(t,n),{fill:e.color,tabindex:q()?0:void 0,role:q()?`button`:void 0,"aria-label":q()?J(t,n):void 0,onKeydown:e=>Z(e,t,n)}),null,16,p))),128))]))),128)),(0,a.createElementVNode)(`g`,re,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(C.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`rect`,(0,a.mergeProps)({key:`hover-${t}`},{ref_for:!0},U(t),{fill:`transparent`,onMouseenter:e=>Q.value=t,onMousemove:e=>se(e,t),onClick:e=>oe(e,t)}),null,16,m))),128))])],42,o)),(0,a.createVNode)(t.l,{visible:e.showTooltip&&Q.value!==null,x:$.value.x,y:$.value.y,title:Q.value===null?``:String(C.value[Q.value]),rows:ce.value},null,8,[`visible`,`x`,`y`,`title`,`rows`])],512)]),_:1},8,[`title`,`subtitle`,`height`,`show-legend`]))}}),_=e.t(g,[[`__scopeId`,`data-v-b519cabf`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return _}});
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
2
|
+
import { i as t, l as n, n as r, u as i } from "./palette-Cq2Mb9QH.js";
|
|
3
|
+
import { t as a } from "./ChartLegend-BythwRMJ.js";
|
|
4
|
+
import { i as o, r as s, t as c } from "./scales-CzvC8OOZ.js";
|
|
5
|
+
import { t as l } from "./useChartSize-BXgOzSCU.js";
|
|
6
|
+
import { Fragment as u, computed as d, createBlock as ee, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createVNode as h, defineComponent as g, getCurrentInstance as te, mergeProps as _, normalizeClass as v, openBlock as y, ref as b, renderList as x, toDisplayString as S, unref as C, withCtx as w } from "vue";
|
|
7
|
+
//#region src/components/Charts/BarChart.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var ne = [
|
|
9
|
+
"width",
|
|
10
|
+
"height",
|
|
11
|
+
"role",
|
|
12
|
+
"aria-label"
|
|
13
|
+
], re = { key: 0 }, ie = [
|
|
14
|
+
"x1",
|
|
15
|
+
"x2",
|
|
16
|
+
"y1",
|
|
17
|
+
"y2"
|
|
18
|
+
], ae = {
|
|
19
|
+
key: 1,
|
|
20
|
+
class: "nb-chart__axis"
|
|
21
|
+
}, oe = [
|
|
22
|
+
"x",
|
|
23
|
+
"y",
|
|
24
|
+
"text-anchor",
|
|
25
|
+
"dominant-baseline"
|
|
26
|
+
], se = { class: "nb-chart__axis" }, T = [
|
|
27
|
+
"x",
|
|
28
|
+
"y",
|
|
29
|
+
"text-anchor",
|
|
30
|
+
"dominant-baseline"
|
|
31
|
+
], ce = [
|
|
32
|
+
"x1",
|
|
33
|
+
"x2",
|
|
34
|
+
"y1",
|
|
35
|
+
"y2"
|
|
36
|
+
], le = {
|
|
37
|
+
key: 3,
|
|
38
|
+
class: "nb-chart__empty-layer",
|
|
39
|
+
"aria-hidden": "true"
|
|
40
|
+
}, ue = [
|
|
41
|
+
"d",
|
|
42
|
+
"fill",
|
|
43
|
+
"tabindex",
|
|
44
|
+
"role",
|
|
45
|
+
"aria-label",
|
|
46
|
+
"onKeydown"
|
|
47
|
+
], de = [
|
|
48
|
+
"fill",
|
|
49
|
+
"tabindex",
|
|
50
|
+
"role",
|
|
51
|
+
"aria-label",
|
|
52
|
+
"onKeydown"
|
|
53
|
+
], fe = { class: "nb-chart__hover-layer" }, pe = [
|
|
54
|
+
"onMouseenter",
|
|
55
|
+
"onMousemove",
|
|
56
|
+
"onClick"
|
|
57
|
+
], E = 2, D = /* @__PURE__ */ e(/* @__PURE__ */ g({
|
|
58
|
+
__name: "BarChart",
|
|
59
|
+
props: {
|
|
60
|
+
series: { default: () => [] },
|
|
61
|
+
orientation: { default: "vertical" },
|
|
62
|
+
stacked: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: !1
|
|
65
|
+
},
|
|
66
|
+
valueFormatter: {},
|
|
67
|
+
barRadius: { default: 0 },
|
|
68
|
+
showEmpty: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: !1
|
|
71
|
+
},
|
|
72
|
+
showBaseline: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: !0
|
|
75
|
+
},
|
|
76
|
+
showValueAxis: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: !0
|
|
79
|
+
},
|
|
80
|
+
categoryLabelEvery: { default: 1 },
|
|
81
|
+
title: { default: void 0 },
|
|
82
|
+
subtitle: { default: void 0 },
|
|
83
|
+
height: { default: 280 },
|
|
84
|
+
showLegend: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: !0
|
|
87
|
+
},
|
|
88
|
+
showTooltip: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: !0
|
|
91
|
+
},
|
|
92
|
+
showGrid: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: !0
|
|
95
|
+
},
|
|
96
|
+
colors: { default: () => r }
|
|
97
|
+
},
|
|
98
|
+
emits: ["select"],
|
|
99
|
+
setup(e, { emit: r }) {
|
|
100
|
+
let g = e, D = r, O = b(null), k = l(O, {
|
|
101
|
+
width: 480,
|
|
102
|
+
height: 240
|
|
103
|
+
}), A = d(() => g.orientation === "horizontal"), j = d(() => g.series.map((e, n) => ({
|
|
104
|
+
name: e.name,
|
|
105
|
+
data: e.data,
|
|
106
|
+
color: e.color ?? t(n, g.colors)
|
|
107
|
+
}))), M = d(() => (g.series[0]?.data ?? []).map((e) => e.x)), N = (e, t) => j.value[t]?.data[e]?.y ?? 0, P = (e, t) => {
|
|
108
|
+
let n = N(e, t);
|
|
109
|
+
if (!g.stacked) return [0, n];
|
|
110
|
+
let r = 0;
|
|
111
|
+
for (let i = 0; i < t; i += 1) {
|
|
112
|
+
let t = N(e, i);
|
|
113
|
+
t >= 0 == n >= 0 && (r += t);
|
|
114
|
+
}
|
|
115
|
+
return [r, r + n];
|
|
116
|
+
}, me = d(() => {
|
|
117
|
+
let e = [];
|
|
118
|
+
return M.value.forEach((t, n) => {
|
|
119
|
+
j.value.forEach((t, r) => {
|
|
120
|
+
e.push(P(n, r)[1]);
|
|
121
|
+
});
|
|
122
|
+
}), e.length ? o(Math.min(0, ...e), Math.max(0, ...e), .05) : [0, 1];
|
|
123
|
+
}), F = d(() => {
|
|
124
|
+
if (!A.value) return {
|
|
125
|
+
top: 12,
|
|
126
|
+
right: 16,
|
|
127
|
+
bottom: 28,
|
|
128
|
+
left: g.showValueAxis ? 44 : 16
|
|
129
|
+
};
|
|
130
|
+
let e = M.value.reduce((e, t) => Math.max(e, String(t).length), 0), t = Math.max(44, Math.round(k.value.width * .4));
|
|
131
|
+
return {
|
|
132
|
+
top: 12,
|
|
133
|
+
right: 16,
|
|
134
|
+
bottom: g.showValueAxis ? 28 : 12,
|
|
135
|
+
left: Math.min(Math.max(44, Math.ceil(e * 6.2) + 12), t)
|
|
136
|
+
};
|
|
137
|
+
}), I = d(() => ({
|
|
138
|
+
x0: F.value.left,
|
|
139
|
+
x1: Math.max(F.value.left, k.value.width - F.value.right),
|
|
140
|
+
y0: F.value.top,
|
|
141
|
+
y1: Math.max(F.value.top, k.value.height - F.value.bottom)
|
|
142
|
+
})), L = d(() => c(M.value.map((e) => String(e)), A.value ? [I.value.y0, I.value.y1] : [I.value.x0, I.value.x1], .2)), R = d(() => s(me.value, A.value ? [I.value.x0, I.value.x1] : [I.value.y1, I.value.y0])), z = d(() => R.value.ticks(5)), B = (e) => L.value(String(M.value[e])), V = (e) => B(e) + L.value.bandwidth / 2, H = d(() => {
|
|
143
|
+
let e = j.value.length || 1;
|
|
144
|
+
return g.stacked ? L.value.bandwidth : L.value.bandwidth / e;
|
|
145
|
+
}), U = (e, t) => {
|
|
146
|
+
let [n, r] = P(e, t), i = R.value(n), a = R.value(r), o = Math.max(0, H.value - 2), s = B(e) + (g.stacked ? 0 : t * H.value), c = Math.max(0, Math.abs(a - i));
|
|
147
|
+
return A.value ? {
|
|
148
|
+
x: Math.min(i, a),
|
|
149
|
+
y: s,
|
|
150
|
+
width: c,
|
|
151
|
+
height: o
|
|
152
|
+
} : {
|
|
153
|
+
x: s,
|
|
154
|
+
y: Math.min(i, a),
|
|
155
|
+
width: o,
|
|
156
|
+
height: c
|
|
157
|
+
};
|
|
158
|
+
}, he = d(() => {
|
|
159
|
+
let e = Math.floor(g.categoryLabelEvery);
|
|
160
|
+
return Number.isFinite(e) && e > 1 ? e : 1;
|
|
161
|
+
}), W = d(() => M.value.map((e, t) => ({
|
|
162
|
+
cat: e,
|
|
163
|
+
i: t
|
|
164
|
+
})).filter(({ i: e }) => e % he.value === 0)), G = d(() => g.barRadius > 0), ge = (e, t) => {
|
|
165
|
+
if (!g.stacked) return !0;
|
|
166
|
+
let n = N(e, t);
|
|
167
|
+
for (let r = t + 1; r < j.value.length; r += 1) {
|
|
168
|
+
let t = N(e, r);
|
|
169
|
+
if (t !== 0 && t >= 0 == n >= 0) return !1;
|
|
170
|
+
}
|
|
171
|
+
return !0;
|
|
172
|
+
}, _e = (e, t, n, r, [i, a, o, s]) => [
|
|
173
|
+
`M${e + i},${t}`,
|
|
174
|
+
`H${e + n - a}`,
|
|
175
|
+
`A${a},${a} 0 0 1 ${e + n},${t + a}`,
|
|
176
|
+
`V${t + r - o}`,
|
|
177
|
+
`A${o},${o} 0 0 1 ${e + n - o},${t + r}`,
|
|
178
|
+
`H${e + s}`,
|
|
179
|
+
`A${s},${s} 0 0 1 ${e},${t + r - s}`,
|
|
180
|
+
`V${t + i}`,
|
|
181
|
+
`A${i},${i} 0 0 1 ${e + i},${t}`,
|
|
182
|
+
"Z"
|
|
183
|
+
].join(" "), ve = (e, t) => {
|
|
184
|
+
let { x: n, y: r, width: i, height: a } = U(e, t), o = A.value ? a : i, s = A.value ? i : a, c = ge(e, t) ? Math.max(0, Math.min(g.barRadius, o / 2, s)) : 0, l = N(e, t) >= 0, u;
|
|
185
|
+
return u = A.value ? l ? [
|
|
186
|
+
0,
|
|
187
|
+
c,
|
|
188
|
+
c,
|
|
189
|
+
0
|
|
190
|
+
] : [
|
|
191
|
+
c,
|
|
192
|
+
0,
|
|
193
|
+
0,
|
|
194
|
+
c
|
|
195
|
+
] : l ? [
|
|
196
|
+
c,
|
|
197
|
+
c,
|
|
198
|
+
0,
|
|
199
|
+
0
|
|
200
|
+
] : [
|
|
201
|
+
0,
|
|
202
|
+
0,
|
|
203
|
+
c,
|
|
204
|
+
c
|
|
205
|
+
], _e(n, r, i, a, u);
|
|
206
|
+
}, ye = d(() => M.value.map((e, t) => t).filter((e) => j.value.every((t, n) => N(e, n) === 0))), be = (e) => {
|
|
207
|
+
let t = R.value(0), n = Math.max(0, L.value.bandwidth - 2), r = G.value ? Math.min(g.barRadius, E / 2) : 0;
|
|
208
|
+
return A.value ? {
|
|
209
|
+
x: t,
|
|
210
|
+
y: B(e),
|
|
211
|
+
width: E,
|
|
212
|
+
height: n,
|
|
213
|
+
rx: r
|
|
214
|
+
} : {
|
|
215
|
+
x: B(e),
|
|
216
|
+
y: t - E,
|
|
217
|
+
width: n,
|
|
218
|
+
height: E,
|
|
219
|
+
rx: r
|
|
220
|
+
};
|
|
221
|
+
}, xe = (e) => {
|
|
222
|
+
let t = B(e), n = L.value.bandwidth;
|
|
223
|
+
return A.value ? {
|
|
224
|
+
x: I.value.x0,
|
|
225
|
+
y: t,
|
|
226
|
+
width: Math.max(0, I.value.x1 - I.value.x0),
|
|
227
|
+
height: n
|
|
228
|
+
} : {
|
|
229
|
+
x: t,
|
|
230
|
+
y: I.value.y0,
|
|
231
|
+
width: n,
|
|
232
|
+
height: Math.max(0, I.value.y1 - I.value.y0)
|
|
233
|
+
};
|
|
234
|
+
}, Se = (e) => Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : String(e), K = (e) => g.valueFormatter ? g.valueFormatter(e) : Se(e), Ce = te(), q = () => !!Ce?.vnode.props?.onSelect, J = (e, t) => {
|
|
235
|
+
let n = j.value[t], r = K(N(e, t));
|
|
236
|
+
return j.value.length > 1 ? `${M.value[e]}, ${n?.name}: ${r}` : `${M.value[e]}: ${r}`;
|
|
237
|
+
}, Y = (e, t) => {
|
|
238
|
+
let n = j.value[t], r = n?.data[e];
|
|
239
|
+
return {
|
|
240
|
+
kind: "series",
|
|
241
|
+
x: r?.x ?? M.value[e],
|
|
242
|
+
y: r?.y ?? 0,
|
|
243
|
+
seriesName: n?.name ?? "",
|
|
244
|
+
seriesIndex: t,
|
|
245
|
+
index: e,
|
|
246
|
+
point: r ?? {
|
|
247
|
+
x: M.value[e],
|
|
248
|
+
y: 0
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}, X = (e) => {
|
|
252
|
+
let t = e.currentTarget.ownerSVGElement;
|
|
253
|
+
if (!t) return null;
|
|
254
|
+
let n = t.getBoundingClientRect();
|
|
255
|
+
return {
|
|
256
|
+
x: e.clientX - n.left,
|
|
257
|
+
y: e.clientY - n.top
|
|
258
|
+
};
|
|
259
|
+
}, we = (e, t) => {
|
|
260
|
+
let n = j.value.length;
|
|
261
|
+
if (n <= 1) return 0;
|
|
262
|
+
let r = X(e);
|
|
263
|
+
if (!r) return 0;
|
|
264
|
+
if (g.stacked) {
|
|
265
|
+
let e = A.value ? r.x : r.y;
|
|
266
|
+
for (let r = 0; r < n; r += 1) {
|
|
267
|
+
let [n, i] = P(t, r), a = R.value(n), o = R.value(i);
|
|
268
|
+
if (e >= Math.min(a, o) && e <= Math.max(a, o)) return r;
|
|
269
|
+
}
|
|
270
|
+
return n - 1;
|
|
271
|
+
}
|
|
272
|
+
let i = (A.value ? r.y : r.x) - B(t), a = Math.floor(i / (H.value || 1));
|
|
273
|
+
return Math.min(Math.max(a, 0), n - 1);
|
|
274
|
+
}, Te = (e, t) => {
|
|
275
|
+
q() && D("select", Y(t, we(e, t)));
|
|
276
|
+
}, Z = (e, t, n) => {
|
|
277
|
+
q() && (e.key !== "Enter" && e.key !== " " || (e.preventDefault(), D("select", Y(t, n))));
|
|
278
|
+
}, Q = b(null), $ = b({
|
|
279
|
+
x: 0,
|
|
280
|
+
y: 0
|
|
281
|
+
}), Ee = (e, t) => {
|
|
282
|
+
let n = X(e);
|
|
283
|
+
n && ($.value = {
|
|
284
|
+
x: n.x + 12,
|
|
285
|
+
y: n.y + 12
|
|
286
|
+
}, Q.value = t);
|
|
287
|
+
}, De = d(() => Q.value === null ? [] : j.value.map((e) => {
|
|
288
|
+
let t = e.data[Q.value];
|
|
289
|
+
return {
|
|
290
|
+
label: e.name,
|
|
291
|
+
value: t?.label ?? K(t?.y ?? 0),
|
|
292
|
+
color: e.color
|
|
293
|
+
};
|
|
294
|
+
}));
|
|
295
|
+
return (t, r) => (y(), ee(i, {
|
|
296
|
+
title: e.title,
|
|
297
|
+
subtitle: e.subtitle,
|
|
298
|
+
height: e.height,
|
|
299
|
+
"show-legend": e.showLegend && j.value.length > 0
|
|
300
|
+
}, {
|
|
301
|
+
legend: w(() => [h(a, { items: j.value.map((e) => ({
|
|
302
|
+
label: e.name,
|
|
303
|
+
color: e.color
|
|
304
|
+
})) }, null, 8, ["items"])]),
|
|
305
|
+
default: w(() => [m("div", {
|
|
306
|
+
ref_key: "root",
|
|
307
|
+
ref: O,
|
|
308
|
+
class: "nb-bar-chart"
|
|
309
|
+
}, [(y(), p("svg", {
|
|
310
|
+
width: C(k).width,
|
|
311
|
+
height: C(k).height,
|
|
312
|
+
class: v(["nb-chart__svg", { "nb-chart__svg--selectable": q() }]),
|
|
313
|
+
role: q() ? "group" : "img",
|
|
314
|
+
"aria-label": e.title || "Bar chart",
|
|
315
|
+
onMouseleave: r[0] ||= (e) => Q.value = null
|
|
316
|
+
}, [
|
|
317
|
+
e.showGrid && C(k).width > 0 ? (y(), p("g", re, [(y(!0), p(u, null, x(z.value, (e) => (y(), p("line", {
|
|
318
|
+
key: `grid-${e}`,
|
|
319
|
+
class: "nb-chart__gridline",
|
|
320
|
+
x1: A.value ? R.value(e) : I.value.x0,
|
|
321
|
+
x2: A.value ? R.value(e) : I.value.x1,
|
|
322
|
+
y1: A.value ? I.value.y0 : R.value(e),
|
|
323
|
+
y2: A.value ? I.value.y1 : R.value(e)
|
|
324
|
+
}, null, 8, ie))), 128))])) : f("", !0),
|
|
325
|
+
e.showValueAxis ? (y(), p("g", ae, [(y(!0), p(u, null, x(z.value, (e) => (y(), p("text", {
|
|
326
|
+
key: `vt-${e}`,
|
|
327
|
+
x: A.value ? R.value(e) : I.value.x0 - 6,
|
|
328
|
+
y: A.value ? I.value.y1 + 14 : R.value(e),
|
|
329
|
+
"text-anchor": A.value ? "middle" : "end",
|
|
330
|
+
"dominant-baseline": A.value ? "auto" : "middle"
|
|
331
|
+
}, S(K(e)), 9, oe))), 128))])) : f("", !0),
|
|
332
|
+
m("g", se, [(y(!0), p(u, null, x(W.value, ({ cat: e, i: t }) => (y(), p("text", {
|
|
333
|
+
key: `ct-${t}`,
|
|
334
|
+
x: A.value ? I.value.x0 - 6 : V(t),
|
|
335
|
+
y: A.value ? V(t) : I.value.y1 + 14,
|
|
336
|
+
"text-anchor": A.value ? "end" : "middle",
|
|
337
|
+
"dominant-baseline": A.value ? "middle" : "auto"
|
|
338
|
+
}, S(e), 9, T))), 128))]),
|
|
339
|
+
e.showBaseline ? (y(), p("line", {
|
|
340
|
+
key: 2,
|
|
341
|
+
class: "nb-chart__axis-line",
|
|
342
|
+
x1: A.value ? R.value(0) : I.value.x0,
|
|
343
|
+
x2: A.value ? R.value(0) : I.value.x1,
|
|
344
|
+
y1: A.value ? I.value.y0 : R.value(0),
|
|
345
|
+
y2: A.value ? I.value.y1 : R.value(0)
|
|
346
|
+
}, null, 8, ce)) : f("", !0),
|
|
347
|
+
e.showEmpty ? (y(), p("g", le, [(y(!0), p(u, null, x(ye.value, (e) => (y(), p("rect", _({
|
|
348
|
+
key: `empty-${e}`,
|
|
349
|
+
class: "nb-chart__empty"
|
|
350
|
+
}, { ref_for: !0 }, be(e)), null, 16))), 128))])) : f("", !0),
|
|
351
|
+
(y(!0), p(u, null, x(M.value, (e, t) => (y(), p("g", { key: `g-${t}` }, [G.value ? (y(!0), p(u, { key: 0 }, x(j.value, (e, n) => (y(), p("path", {
|
|
352
|
+
key: `${t}-${n}`,
|
|
353
|
+
class: v(["nb-chart__bar", { "is-dim": Q.value !== null && Q.value !== t }]),
|
|
354
|
+
d: ve(t, n),
|
|
355
|
+
fill: e.color,
|
|
356
|
+
tabindex: q() ? 0 : void 0,
|
|
357
|
+
role: q() ? "button" : void 0,
|
|
358
|
+
"aria-label": q() ? J(t, n) : void 0,
|
|
359
|
+
onKeydown: (e) => Z(e, t, n)
|
|
360
|
+
}, null, 42, ue))), 128)) : (y(!0), p(u, { key: 1 }, x(j.value, (e, n) => (y(), p("rect", _({
|
|
361
|
+
key: `${t}-${n}`,
|
|
362
|
+
class: ["nb-chart__bar", { "is-dim": Q.value !== null && Q.value !== t }]
|
|
363
|
+
}, { ref_for: !0 }, U(t, n), {
|
|
364
|
+
fill: e.color,
|
|
365
|
+
tabindex: q() ? 0 : void 0,
|
|
366
|
+
role: q() ? "button" : void 0,
|
|
367
|
+
"aria-label": q() ? J(t, n) : void 0,
|
|
368
|
+
onKeydown: (e) => Z(e, t, n)
|
|
369
|
+
}), null, 16, de))), 128))]))), 128)),
|
|
370
|
+
m("g", fe, [(y(!0), p(u, null, x(M.value, (e, t) => (y(), p("rect", _({ key: `hover-${t}` }, { ref_for: !0 }, xe(t), {
|
|
371
|
+
fill: "transparent",
|
|
372
|
+
onMouseenter: (e) => Q.value = t,
|
|
373
|
+
onMousemove: (e) => Ee(e, t),
|
|
374
|
+
onClick: (e) => Te(e, t)
|
|
375
|
+
}), null, 16, pe))), 128))])
|
|
376
|
+
], 42, ne)), h(n, {
|
|
377
|
+
visible: e.showTooltip && Q.value !== null,
|
|
378
|
+
x: $.value.x,
|
|
379
|
+
y: $.value.y,
|
|
380
|
+
title: Q.value === null ? "" : String(M.value[Q.value]),
|
|
381
|
+
rows: De.value
|
|
382
|
+
}, null, 8, [
|
|
383
|
+
"visible",
|
|
384
|
+
"x",
|
|
385
|
+
"y",
|
|
386
|
+
"title",
|
|
387
|
+
"rows"
|
|
388
|
+
])], 512)]),
|
|
389
|
+
_: 1
|
|
390
|
+
}, 8, [
|
|
391
|
+
"title",
|
|
392
|
+
"subtitle",
|
|
393
|
+
"height",
|
|
394
|
+
"show-legend"
|
|
395
|
+
]));
|
|
396
|
+
}
|
|
397
|
+
}), [["__scopeId", "data-v-b519cabf"]]);
|
|
398
|
+
//#endregion
|
|
399
|
+
export { D as t };
|