@milaboratories/uikit 2.6.2 → 2.6.3
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/.turbo/turbo-build.log +135 -135
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +6 -0
- package/dist/base/BtnBase.vue.js +18 -18
- package/dist/base/BtnBase.vue.js.map +1 -1
- package/dist/components/ContextProvider.vue.js.map +1 -1
- package/dist/components/DataTable/BaseCellComponent.vue.js +20 -20
- package/dist/components/DataTable/BaseCellComponent.vue.js.map +1 -1
- package/dist/components/DataTable/ColumnCaret.vue.js +6 -6
- package/dist/components/DataTable/ColumnCaret.vue.js.map +1 -1
- package/dist/components/DataTable/ColumnsCommandMenu.vue.js.map +1 -1
- package/dist/components/DataTable/RowsCommandMenu.vue.js.map +1 -1
- package/dist/components/DataTable/TScroll.vue.js +12 -12
- package/dist/components/DataTable/TScroll.vue.js.map +1 -1
- package/dist/components/DataTable/TableComponent.vue.js +1 -1
- package/dist/components/DataTable/TableComponent.vue.js.map +1 -1
- package/dist/components/DataTable/TdCell.vue.js +36 -36
- package/dist/components/DataTable/TdCell.vue.js.map +1 -1
- package/dist/components/DataTable/ThCell.vue.js +27 -27
- package/dist/components/DataTable/ThCell.vue.js.map +1 -1
- package/dist/components/DataTable/TrBody.vue.js +12 -12
- package/dist/components/DataTable/TrBody.vue.js.map +1 -1
- package/dist/components/DataTable/TrHead.vue.js.map +1 -1
- package/dist/components/DataTable/assets/TableIcon.vue.js +2 -2
- package/dist/components/DataTable/assets/TableIcon.vue.js.map +1 -1
- package/dist/components/DropdownListItem.vue.js +18 -18
- package/dist/components/DropdownListItem.vue.js.map +1 -1
- package/dist/components/HScroll.vue.js.map +1 -1
- package/dist/components/InputRange.vue.js.map +1 -1
- package/dist/components/LongText.vue.js +1 -1
- package/dist/components/LongText.vue.js.map +1 -1
- package/dist/components/LongText.vue3.js +1 -1
- package/dist/components/PlAccordion/ExpandTransition.vue.js +27 -0
- package/dist/components/PlAccordion/ExpandTransition.vue.js.map +1 -0
- package/dist/components/PlAccordion/ExpandTransition.vue2.js.map +1 -1
- package/dist/components/PlAccordion/PlAccordion.vue.js.map +1 -1
- package/dist/components/PlAccordion/PlAccordionSection.vue2.js +21 -21
- package/dist/components/PlAccordion/PlAccordionSection.vue2.js.map +1 -1
- package/dist/components/PlAlert/PlAlert.vue.js +23 -23
- package/dist/components/PlAlert/PlAlert.vue.js.map +1 -1
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js +86 -86
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js.map +1 -1
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js +83 -83
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js.map +1 -1
- package/dist/components/PlBtnAccent/PlBtnAccent.vue.js.map +1 -1
- package/dist/components/PlBtnDanger/PlBtnDanger.vue.js.map +1 -1
- package/dist/components/PlBtnGhost/PlBtnGhost.vue.js +21 -21
- package/dist/components/PlBtnGhost/PlBtnGhost.vue.js.map +1 -1
- package/dist/components/PlBtnGroup/PlBtnGroup.vue.js +34 -34
- package/dist/components/PlBtnGroup/PlBtnGroup.vue.js.map +1 -1
- package/dist/components/PlBtnLink/PlBtnLink.vue.js +12 -12
- package/dist/components/PlBtnLink/PlBtnLink.vue.js.map +1 -1
- package/dist/components/PlBtnPrimary/PlBtnPrimary.vue.js.map +1 -1
- package/dist/components/PlBtnSecondary/PlBtnSecondary.vue.js.map +1 -1
- package/dist/components/PlBtnSplit/PlBtnSplit.vue.js +31 -31
- package/dist/components/PlBtnSplit/PlBtnSplit.vue.js.map +1 -1
- package/dist/components/PlChartHistogram/PlChartHistogram.vue2.js +18 -18
- package/dist/components/PlChartHistogram/PlChartHistogram.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/Legends.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/PlChartStackedBar.vue2.js +15 -15
- package/dist/components/PlChartStackedBar/PlChartStackedBar.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/PlChartStackedBarCompact.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/StackedRow.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/StackedRowCompact.vue2.js.map +1 -1
- package/dist/components/PlCheckbox/PlCheckbox.vue.js +13 -13
- package/dist/components/PlCheckbox/PlCheckbox.vue.js.map +1 -1
- package/dist/components/PlCheckbox/PlCheckboxBase.vue.js +6 -6
- package/dist/components/PlCheckbox/PlCheckboxBase.vue.js.map +1 -1
- package/dist/components/PlCheckboxGroup/PlCheckboxGroup.vue.js +28 -28
- package/dist/components/PlCheckboxGroup/PlCheckboxGroup.vue.js.map +1 -1
- package/dist/components/PlChip/PlChip.vue.js +20 -20
- package/dist/components/PlChip/PlChip.vue.js.map +1 -1
- package/dist/components/PlClipboard/PlClipboard.vue2.js.map +1 -1
- package/dist/components/PlConfirmDialog.vue.js +14 -14
- package/dist/components/PlConfirmDialog.vue.js.map +1 -1
- package/dist/components/PlDialogModal/PlDialogModal.vue.js +30 -30
- package/dist/components/PlDialogModal/PlDialogModal.vue.js.map +1 -1
- package/dist/components/PlDropdown/OptionList.vue.js +40 -40
- package/dist/components/PlDropdown/OptionList.vue.js.map +1 -1
- package/dist/components/PlDropdown/PlDropdown.vue.js +89 -89
- package/dist/components/PlDropdown/PlDropdown.vue.js.map +1 -1
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js +92 -92
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js.map +1 -1
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.d.ts +1 -1
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.js +4 -4
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.js.map +1 -1
- package/dist/components/PlDropdownLine/ResizableInput.vue.js +12 -12
- package/dist/components/PlDropdownLine/ResizableInput.vue.js.map +1 -1
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js +70 -70
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js.map +1 -1
- package/dist/components/PlDropdownMultiRef/PlDropdownMultiRef.vue.d.ts +1 -1
- package/dist/components/PlDropdownMultiRef/PlDropdownMultiRef.vue.js.map +1 -1
- package/dist/components/PlDropdownRef/PlDropdownRef.vue.js +11 -11
- package/dist/components/PlDropdownRef/PlDropdownRef.vue.js.map +1 -1
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.d.ts +1 -1
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.js +36 -36
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.js.map +1 -1
- package/dist/components/PlElementList/PlElementList.vue2.js.map +1 -1
- package/dist/components/PlElementList/PlElementListItem.vue2.js +67 -67
- package/dist/components/PlElementList/PlElementListItem.vue2.js.map +1 -1
- package/dist/components/PlErrorAlert/PlErrorAlert.vue2.js.map +1 -1
- package/dist/components/PlErrorBoundary/PlErrorBoundary.vue.js.map +1 -1
- package/dist/components/PlFileDialog/Local.vue.js +24 -24
- package/dist/components/PlFileDialog/Local.vue.js.map +1 -1
- package/dist/components/PlFileDialog/PlFileDialog.vue.js +38 -38
- package/dist/components/PlFileDialog/PlFileDialog.vue.js.map +1 -1
- package/dist/components/PlFileDialog/Remote.vue.js +2 -2
- package/dist/components/PlFileDialog/Remote.vue.js.map +1 -1
- package/dist/components/PlFileDialog/Shortcuts.vue2.js +4 -4
- package/dist/components/PlFileDialog/Shortcuts.vue2.js.map +1 -1
- package/dist/components/PlFileInput/PlFileInput.vue.d.ts +1 -1
- package/dist/components/PlFileInput/PlFileInput.vue.js +75 -75
- package/dist/components/PlFileInput/PlFileInput.vue.js.map +1 -1
- package/dist/components/PlIcon16/PlIcon16.vue2.js.map +1 -1
- package/dist/components/PlIcon24/PlIcon24.vue2.js.map +1 -1
- package/dist/components/PlLoaderCircular/PlLoaderCircular.vue.js +11 -11
- package/dist/components/PlLoaderCircular/PlLoaderCircular.vue.js.map +1 -1
- package/dist/components/PlLogView/PlLogView.vue.js +58 -58
- package/dist/components/PlLogView/PlLogView.vue.js.map +1 -1
- package/dist/components/PlNotificationAlert/PlNotificationAlert.vue.js +22 -22
- package/dist/components/PlNotificationAlert/PlNotificationAlert.vue.js.map +1 -1
- package/dist/components/PlNumberField/PlNumberField.vue.d.ts +1 -1
- package/dist/components/PlNumberField/PlNumberField.vue.js +75 -75
- package/dist/components/PlNumberField/PlNumberField.vue.js.map +1 -1
- package/dist/components/PlProgressBar/PlProgressBar.vue.js +12 -12
- package/dist/components/PlProgressBar/PlProgressBar.vue.js.map +1 -1
- package/dist/components/PlProgressCell/PlProgressCell.vue.js +20 -20
- package/dist/components/PlProgressCell/PlProgressCell.vue.js.map +1 -1
- package/dist/components/PlRadio/PlRadio.vue2.js.map +1 -1
- package/dist/components/PlRadio/PlRadioGroup.vue2.js +8 -8
- package/dist/components/PlRadio/PlRadioGroup.vue2.js.map +1 -1
- package/dist/components/PlSearchField/PlSearchField.vue2.js +19 -19
- package/dist/components/PlSearchField/PlSearchField.vue2.js.map +1 -1
- package/dist/components/PlSectionSeparator/PlSectionSeparator.vue2.js +8 -8
- package/dist/components/PlSectionSeparator/PlSectionSeparator.vue2.js.map +1 -1
- package/dist/components/PlSidebar/PlSidebarGroup.vue2.js.map +1 -1
- package/dist/components/PlSidebar/PlSidebarItem.vue2.js.map +1 -1
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js +1 -1
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js.map +1 -1
- package/dist/components/PlSlideModal/PlSlideModal.vue2.js.map +1 -1
- package/dist/components/PlSplash/PlSplash.vue.js +16 -16
- package/dist/components/PlSplash/PlSplash.vue.js.map +1 -1
- package/dist/components/PlStatusTag/PlStatusTag.vue.js +7 -7
- package/dist/components/PlStatusTag/PlStatusTag.vue.js.map +1 -1
- package/dist/components/PlSvg/PlSvg.vue2.js.map +1 -1
- package/dist/components/PlTabs/PlTabs.vue.js +18 -18
- package/dist/components/PlTabs/PlTabs.vue.js.map +1 -1
- package/dist/components/PlTabs/Tab.vue.js +9 -9
- package/dist/components/PlTabs/Tab.vue.js.map +1 -1
- package/dist/components/PlTextArea/PlTextArea.vue.js +51 -51
- package/dist/components/PlTextArea/PlTextArea.vue.js.map +1 -1
- package/dist/components/PlTextField/PlTextField.vue.js +62 -62
- package/dist/components/PlTextField/PlTextField.vue.js.map +1 -1
- package/dist/components/PlToggleSwitch/PlToggleSwitch.vue.js +14 -14
- package/dist/components/PlToggleSwitch/PlToggleSwitch.vue.js.map +1 -1
- package/dist/components/PlTooltip/Beak.vue.js +2 -2
- package/dist/components/PlTooltip/Beak.vue.js.map +1 -1
- package/dist/components/PlTooltip/PlTooltip.vue.js +50 -50
- package/dist/components/PlTooltip/PlTooltip.vue.js.map +1 -1
- package/dist/components/Scrollable.vue.js.map +1 -1
- package/dist/components/Slider.vue.js +35 -35
- package/dist/components/Slider.vue.js.map +1 -1
- package/dist/components/SliderRange.vue.js +47 -47
- package/dist/components/SliderRange.vue.js.map +1 -1
- package/dist/components/SliderRangeTriple.vue.js +47 -47
- package/dist/components/SliderRangeTriple.vue.js.map +1 -1
- package/dist/components/TabItem.vue.js.map +1 -1
- package/dist/components/ThemeSwitcher.vue.js +2 -2
- package/dist/components/ThemeSwitcher.vue.js.map +1 -1
- package/dist/components/TransitionSlidePanel.vue.js.map +1 -1
- package/dist/components/VScroll.vue.js.map +1 -1
- package/dist/components/contextMenu/Menu.vue2.js +12 -12
- package/dist/components/contextMenu/Menu.vue2.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/layout/PlBlockPage/PlBlockPage.vue.js +27 -27
- package/dist/layout/PlBlockPage/PlBlockPage.vue.js.map +1 -1
- package/dist/layout/PlContainer/PlContainer.vue.js +10 -10
- package/dist/layout/PlContainer/PlContainer.vue.js.map +1 -1
- package/dist/layout/PlGrid/PlGrid.vue.js.map +1 -1
- package/dist/layout/PlRow/PlRow.vue.js +8 -8
- package/dist/layout/PlRow/PlRow.vue.js.map +1 -1
- package/dist/layout/PlSpacer/PlSpacer.vue.js.map +1 -1
- package/dist/utils/DoubleContour.vue.js +9 -9
- package/dist/utils/DoubleContour.vue.js.map +1 -1
- package/dist/utils/DropdownOverlay/DropdownOverlay.vue.js.map +1 -1
- package/dist/utils/PlCloseModalBtn.vue.js +2 -2
- package/dist/utils/PlCloseModalBtn.vue.js.map +1 -1
- package/dist/utils/TextLabel.vue.js.map +1 -1
- package/package.json +4 -4
- package/dist/utils/DoubleContour.vue2.js +0 -23
- package/dist/utils/DoubleContour.vue2.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".pl-btn-ghost{--font-size: 14px;--border-radius: 6px;--button-height: 40px;--focus-shadow: 0 0 0 0 transparent;--btn-disabled-bg: var(--color-dis-01);--color-text: var(--txt-00);--shape-shadow: 0 0 0 0 transparent;--append-shadow: 0 0 0 0 transparent;--drop-shadow: 0 0 0 0 transparent;--active-shadow: 0 0 0 0 transparent;--main-padding: 0 12px;text-transform:capitalize;position:relative;overflow:hidden;display:flex;flex-direction:row;justify-content:space-between;align-items:center;white-space:nowrap;gap:8px;padding:var(--main-padding);color:var(--color-text);font-weight:600;font-size:var(--font-size);font-family:var(--font-family-base);line-height:16px;height:var(--button-height);min-height:var(--button-height);border-radius:var(--border-radius);outline:none;-webkit-user-select:none;user-select:none;transition:box-shadow .05s ease-in-out;box-shadow:var(--focus-shadow),var(--append-shadow),var(--shape-shadow),var(--active-shadow),var(--drop-shadow)}.pl-btn-ghost.justifyCenter{justify-content:center}.pl-btn-ghost.round{border-radius:50%;width:var(--button-height);min-width:var(--button-height);padding:0;justify-content:center}.pl-btn-ghost.small{--button-height: 32px;--main-padding: 0 8px}.pl-btn-ghost.medium{--main-padding: 0 16px}.pl-btn-ghost.large{--button-height: 56px;--border-radius: 8px;--font-size: 16px;--main-padding: 0 18px}.pl-btn-ghost.large .mask{--mask-size: 24px}.pl-btn-ghost:disabled{--color-text: var(--dis-00);--icon-color: var(--dis-00)}.pl-btn-ghost:disabled *{color:var(--color-text)}.pl-btn-ghost:not([disabled]){cursor:pointer}.pl-btn-ghost:not([disabled]).hover{background:var(--color-btn-hover)}.pl-btn-ghost:not([disabled]):hover{background:var(--color-btn-hover)}.pl-btn-ghost:focus-visible{--focus-shadow: inset 0 0 0 2px var(--border-color-focus)}.pl-btn-ghost .icon{display:block;width:16px;height:16px}.pl-btn-ghost.loading{box-shadow:none!important}.pl-btn-ghost.loading .mask-loading{display:block;animation:spin 4s linear infinite}.pl-btn-ghost.reverse{flex-direction:row-reverse}.pl-btn-ghost>span{display:inline-flex}.pl-btn-ghost{--color-text: var(--txt-01);--color-btn-hover: var(--btn-sec-hover-grey);--btn-min-width: auto;gap:10px;background:transparent;border:none;width:fit-content;min-width:var(--btn-min-width)}.pl-btn-ghost:disabled{--color-text: var(--btn-disabled-bg);--icon-color: var(--dis-01);box-shadow:none!important;cursor:auto}.pl-btn-ghost.loading{--color-text: var(--btn-disabled-bg)}")),document.head.appendChild(t)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
-
import { defineComponent as y, computed as
|
|
2
|
+
import { defineComponent as y, computed as r, ref as z, useSlots as B, createElementBlock as i, openBlock as n, mergeProps as k, createCommentVNode as d, renderSlot as o, unref as l, createBlock as u } from "vue";
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import { useRipple as
|
|
6
|
-
const
|
|
4
|
+
import f from "../PlIcon24/PlIcon24.vue.js";
|
|
5
|
+
import { useRipple as b } from "../../composition/useRipple.js";
|
|
6
|
+
const v = { key: 0 }, $ = {
|
|
7
7
|
name: "PlBtnGhost"
|
|
8
|
-
},
|
|
9
|
-
|
|
8
|
+
}, p = /* @__PURE__ */ y({
|
|
9
|
+
...$,
|
|
10
10
|
props: {
|
|
11
11
|
loading: { type: Boolean },
|
|
12
12
|
size: { default: void 0 },
|
|
@@ -15,33 +15,33 @@ const b = { key: 0 }, v = {
|
|
|
15
15
|
reverse: { type: Boolean },
|
|
16
16
|
justifyCenter: { type: Boolean, default: !1 }
|
|
17
17
|
},
|
|
18
|
-
setup(
|
|
19
|
-
const
|
|
20
|
-
return
|
|
18
|
+
setup(e) {
|
|
19
|
+
const a = e, m = r(() => a.size === "small"), c = r(() => a.size === "large"), s = z(), g = B();
|
|
20
|
+
return b(s), (t, C) => (n(), i("button", k({
|
|
21
21
|
ref_key: "btnRef",
|
|
22
|
-
ref:
|
|
22
|
+
ref: s,
|
|
23
23
|
tabindex: "0",
|
|
24
|
-
class: ["pl-btn-ghost", { loading: e.loading, small:
|
|
25
|
-
}, { ...
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
])) :
|
|
29
|
-
|
|
30
|
-
e.loading ? (
|
|
24
|
+
class: ["pl-btn-ghost", { loading: e.loading, small: m.value, large: c.value, round: e.round, reverse: e.reverse, justifyCenter: e.justifyCenter, [t.$attrs.class + ""]: !0 }]
|
|
25
|
+
}, { ...t.$attrs, disabled: !!t.$attrs.disabled || e.loading }), [
|
|
26
|
+
l(g).default && !e.round ? (n(), i("span", v, [
|
|
27
|
+
o(t.$slots, "default")
|
|
28
|
+
])) : d("", !0),
|
|
29
|
+
o(t.$slots, "icon", {}, () => [
|
|
30
|
+
e.loading ? (n(), u(l(f), {
|
|
31
31
|
key: 0,
|
|
32
32
|
name: "loading",
|
|
33
33
|
size: e.size
|
|
34
|
-
}, null, 8, ["size"])) : e.icon ? (
|
|
34
|
+
}, null, 8, ["size"])) : e.icon ? (n(), u(l(f), {
|
|
35
35
|
key: 1,
|
|
36
36
|
name: e.icon,
|
|
37
37
|
size: e.size
|
|
38
|
-
}, null, 8, ["name", "size"])) :
|
|
38
|
+
}, null, 8, ["name", "size"])) : d("", !0)
|
|
39
39
|
]),
|
|
40
|
-
|
|
40
|
+
o(t.$slots, "append")
|
|
41
41
|
], 16));
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
export {
|
|
45
|
-
|
|
45
|
+
p as default
|
|
46
46
|
};
|
|
47
47
|
//# sourceMappingURL=PlBtnGhost.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlBtnGhost.vue.js","sources":["../../../src/components/PlBtnGhost/PlBtnGhost.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Ghost button\n */\nexport default {\n name: 'PlBtnGhost',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-btn-ghost.scss';\nimport type { MaskIconName24, Size } from '../../types';\nimport { PlMaskIcon24 } from '../PlMaskIcon24';\nimport { computed, ref, useSlots } from 'vue';\nimport { useRipple } from '../../composition/useRipple';\n\nconst props = withDefaults(\n defineProps<{\n /**\n * If `true,` the button is disabled, cannot be interacted with, and shows a special 'loading' icon.\n */\n loading?: boolean;\n /**\n * Size of the button, the default value is 'medium'\n */\n size?: Size;\n /**\n * If `true` the shape is round.\n */\n round?: boolean;\n /**\n * Icon to display\n */\n icon?: MaskIconName24;\n /**\n * If `true`, an icon is displayed before the text.\n */\n reverse?: boolean;\n /**\n * Justify text at the center (is `false` by default)\n */\n justifyCenter?: boolean;\n }>(),\n {\n size: undefined,\n icon: undefined,\n justifyCenter: false,\n },\n);\n\nconst small = computed(() => props.size === 'small');\nconst large = computed(() => props.size === 'large');\n\nconst btnRef = ref();\n\nconst slots = useSlots();\n\nuseRipple(btnRef);\n</script>\n\n<template>\n <button\n ref=\"btnRef\"\n tabindex=\"0\"\n class=\"pl-btn-ghost\"\n :class=\"{ loading, small, large, round, reverse, justifyCenter, [$attrs.class + '']: true }\"\n v-bind=\"{ ...$attrs, disabled: Boolean($attrs.disabled) || loading }\"\n >\n <span v-if=\"slots.default && !round\">\n <slot />\n </span>\n <slot name=\"icon\">\n <PlMaskIcon24 v-if=\"loading\" name=\"loading\" :size=\"size\" />\n <PlMaskIcon24 v-else-if=\"icon\" :name=\"icon\" :size=\"size\" />\n </slot>\n <slot name=\"append\" />\n </button>\n</template>\n"],"names":["__default__","props","__props","small","computed","large","btnRef","ref","slots","useSlots","useRipple"],"mappings":";;;;sBAIAA,IAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;AAUA,UAAMC,IAAQC,GAkCRC,IAAQC,EAAS,MAAMH,EAAM,SAAS,OAAO,GAC7CI,IAAQD,EAAS,MAAMH,EAAM,SAAS,OAAO,GAE7CK,IAASC,EAAA,GAETC,IAAQC,EAAA;AAEd,WAAAC,EAAUJ,CAAM
|
|
1
|
+
{"version":3,"file":"PlBtnGhost.vue.js","sources":["../../../src/components/PlBtnGhost/PlBtnGhost.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Ghost button\n */\nexport default {\n name: 'PlBtnGhost',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-btn-ghost.scss';\nimport type { MaskIconName24, Size } from '../../types';\nimport { PlMaskIcon24 } from '../PlMaskIcon24';\nimport { computed, ref, useSlots } from 'vue';\nimport { useRipple } from '../../composition/useRipple';\n\nconst props = withDefaults(\n defineProps<{\n /**\n * If `true,` the button is disabled, cannot be interacted with, and shows a special 'loading' icon.\n */\n loading?: boolean;\n /**\n * Size of the button, the default value is 'medium'\n */\n size?: Size;\n /**\n * If `true` the shape is round.\n */\n round?: boolean;\n /**\n * Icon to display\n */\n icon?: MaskIconName24;\n /**\n * If `true`, an icon is displayed before the text.\n */\n reverse?: boolean;\n /**\n * Justify text at the center (is `false` by default)\n */\n justifyCenter?: boolean;\n }>(),\n {\n size: undefined,\n icon: undefined,\n justifyCenter: false,\n },\n);\n\nconst small = computed(() => props.size === 'small');\nconst large = computed(() => props.size === 'large');\n\nconst btnRef = ref();\n\nconst slots = useSlots();\n\nuseRipple(btnRef);\n</script>\n\n<template>\n <button\n ref=\"btnRef\"\n tabindex=\"0\"\n class=\"pl-btn-ghost\"\n :class=\"{ loading, small, large, round, reverse, justifyCenter, [$attrs.class + '']: true }\"\n v-bind=\"{ ...$attrs, disabled: Boolean($attrs.disabled) || loading }\"\n >\n <span v-if=\"slots.default && !round\">\n <slot />\n </span>\n <slot name=\"icon\">\n <PlMaskIcon24 v-if=\"loading\" name=\"loading\" :size=\"size\" />\n <PlMaskIcon24 v-else-if=\"icon\" :name=\"icon\" :size=\"size\" />\n </slot>\n <slot name=\"append\" />\n </button>\n</template>\n"],"names":["__default__","props","__props","small","computed","large","btnRef","ref","slots","useSlots","useRipple","_openBlock","_createElementBlock","_mergeProps","$attrs","_unref","_hoisted_1","_renderSlot","_ctx","_createBlock","PlMaskIcon24"],"mappings":";;;;sBAIAA,IAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;AAUA,UAAMC,IAAQC,GAkCRC,IAAQC,EAAS,MAAMH,EAAM,SAAS,OAAO,GAC7CI,IAAQD,EAAS,MAAMH,EAAM,SAAS,OAAO,GAE7CK,IAASC,EAAA,GAETC,IAAQC,EAAA;AAEd,WAAAC,EAAUJ,CAAM,cAIdK,EAAA,GAAAC,EAeS,UAfTC,EAeS;AAAA,eAdH;AAAA,MAAJ,KAAIP;AAAA,MACJ,UAAS;AAAA,MACT,QAAM,gBAAc,EAAA,SACVJ,EAAA,SAAO,OAAEC,SAAK,OAAEE,EAAA,OAAK,OAAEH,EAAA,gBAAOA,EAAA,SAAO,eAAEA,iBAAa,CAAGY,EAAAA,OAAO,QAAK,EAAA,GAAA,IAAA;AAAA,IAAA,GAChEA,EAAAA,GAAAA,EAAAA,kBAAkB,EAAQA,SAAO,YAAaZ,EAAA,QAAA,CAAO,GAAA;AAAA,MAEtDa,EAAAP,CAAA,EAAM,WAAO,CAAKN,EAAA,cAA9BU,EAEO,QAAAI,GAAA;AAAA,QADLC,EAAQC,EAAA,QAAA,SAAA;AAAA,MAAA;MAEVD,EAGOC,sBAHP,MAGO;AAAA,QAFehB,EAAA,gBAApBiB,EAA2DJ,EAAAK,CAAA,GAAA;AAAA;UAA9B,MAAK;AAAA,UAAW,MAAMlB,EAAA;AAAA,QAAA,yBAC1BA,EAAA,aAAzBiB,EAA2DJ,EAAAK,CAAA,GAAA;AAAA;UAA3B,MAAMlB,EAAA;AAAA,UAAO,MAAMA,EAAA;AAAA,QAAA;;MAErDe,EAAsBC,EAAA,QAAA,QAAA;AAAA,IAAA;;;"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode('.pl-btn-group{--pl-btn-group-height: 40px;box-sizing:border-box;position:relative;font-family:var(--control-font-family)}.pl-btn-group label{margin-bottom:6px;display:flex;align-items:center;gap:4px;font-weight:500;font-size:var(--font-size-base);line-height:20px}.pl-btn-group__helper{font-size:12px;color:var(--txt-03);padding:2px 0 0;white-space:pre-wrap;text-overflow:ellipsis;font-weight:500;line-height:16px;margin-top:6px}.pl-btn-group__error{font-size:12px;color:var(--txt-error);padding:2px 0 0;white-space:pre-wrap;text-overflow:ellipsis;font-weight:500;line-height:16px;margin-top:6px}.pl-btn-group .inner-border{height:var(--pl-btn-group-height);min-height:var(--pl-btn-group-height)}.pl-btn-group .inner-border:after{border:1px solid var(--color-border-default);border-radius:6px}.pl-btn-group__container{flex:1;display:flex;align-items:center;width:100%;box-sizing:content-box;border-radius:6px;font-weight:500;font-size:10px;text-align:center;-webkit-user-select:none;user-select:none}.pl-btn-group__option{position:relative;display:flex;flex:1;flex-direction:row;justify-content:center;align-items:center;padding:0 12px;align-self:stretch;cursor:pointer;outline:none;text-transform:capitalize;color:var(--btn-switcher-option-color);white-space:nowrap}.pl-btn-group__option:hover:not(.active){background-color:var(--btn-sec-hover-grey)}.pl-btn-group__option:first-child{border-top-left-radius:6px;border-bottom-left-radius:6px}.pl-btn-group__option:last-child{border-top-right-radius:6px;border-bottom-right-radius:6px}.pl-btn-group__option:focus-visible{position:relative}.pl-btn-group__option:focus-visible:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;border:2px solid var(--border-color-focus);border-radius:inherit;z-index:1}.pl-btn-group__option:not(.active)+.pl-btn-group__option:not(.active):before{content:"";position:absolute;width:1px;height:24px;left:-1px;top:50%;transform:translateY(-50%);background-color:var(--color-border-default)}.pl-btn-group__option.active{background:var(--btn-switcher-bg);border:var(--btn-switcher-active-option-border);box-shadow:var(--btn-group-shape-shadow);color:var(--btn-switcher-active-option-color);border-radius:6px;z-index:1;padding:0 11px}.pl-btn-group.compact{--pl-btn-group-height: 32px}.pl-btn-group.disabled{--color-border-default: var(--color-dis-01);--btn-switcher-bg: var(--color-dis-01);--btn-switcher-option-color: var(--color-dis-01);--btn-switcher-active-option-color: var(--color-dis-00);--btn-switcher-active-option-border: 0px;pointer-events:none;tab-index:unset!important}')),document.head.appendChild(o)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
import { defineComponent as
|
|
2
|
+
import { defineComponent as y, useSlots as k, computed as g, createElementBlock as o, openBlock as l, normalizeClass as d, createCommentVNode as r, createVNode as V, createElementVNode as B, createBlock as x, toDisplayString as a, unref as i, withCtx as c, renderSlot as C, Fragment as _, renderList as w, withKeys as $ } from "vue";
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { getErrorMessage as
|
|
7
|
-
const
|
|
4
|
+
import E from "../PlTooltip/PlTooltip.vue.js";
|
|
5
|
+
import K from "../../utils/InnerBorder.vue.js";
|
|
6
|
+
import { getErrorMessage as N } from "../../helpers/error.js";
|
|
7
|
+
const S = { key: 0 }, z = ["tabindex", "onKeydown", "onClick"], M = {
|
|
8
8
|
key: 1,
|
|
9
9
|
class: "pl-btn-group__helper"
|
|
10
|
-
},
|
|
10
|
+
}, D = {
|
|
11
11
|
key: 2,
|
|
12
12
|
class: "pl-btn-group__error"
|
|
13
|
-
},
|
|
13
|
+
}, F = {
|
|
14
14
|
name: "PlBtnGroup"
|
|
15
|
-
},
|
|
16
|
-
...
|
|
15
|
+
}, q = /* @__PURE__ */ y({
|
|
16
|
+
...F,
|
|
17
17
|
props: {
|
|
18
18
|
modelValue: {},
|
|
19
19
|
label: {},
|
|
@@ -24,46 +24,46 @@ const z = { key: 0 }, M = ["tabindex", "onKeydown", "onClick"], D = {
|
|
|
24
24
|
error: {}
|
|
25
25
|
},
|
|
26
26
|
emits: ["update:modelValue"],
|
|
27
|
-
setup(
|
|
28
|
-
const m =
|
|
29
|
-
() => b.options.map((
|
|
30
|
-
label: "label" in
|
|
31
|
-
value:
|
|
27
|
+
setup(e, { emit: u }) {
|
|
28
|
+
const m = k(), p = u, s = (t) => p("update:modelValue", t), b = e, v = g(
|
|
29
|
+
() => b.options.map((t) => ({
|
|
30
|
+
label: "label" in t ? t.label : t.text,
|
|
31
|
+
value: t.value
|
|
32
32
|
}))
|
|
33
33
|
);
|
|
34
|
-
return (
|
|
35
|
-
class:
|
|
34
|
+
return (t, G) => (l(), o("div", {
|
|
35
|
+
class: d(["pl-btn-group", { disabled: e.disabled, compact: e.compact }])
|
|
36
36
|
}, [
|
|
37
|
-
e.label ? (
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
e.label ? (l(), o("label", S, [
|
|
38
|
+
B("span", null, a(e.label), 1),
|
|
39
|
+
i(m).tooltip ? (l(), x(i(E), {
|
|
40
40
|
key: 0,
|
|
41
41
|
class: "info",
|
|
42
42
|
position: "top"
|
|
43
43
|
}, {
|
|
44
|
-
tooltip:
|
|
45
|
-
C(
|
|
44
|
+
tooltip: c(() => [
|
|
45
|
+
C(t.$slots, "tooltip")
|
|
46
46
|
]),
|
|
47
47
|
_: 3
|
|
48
|
-
})) :
|
|
49
|
-
])) :
|
|
50
|
-
|
|
51
|
-
default:
|
|
52
|
-
(
|
|
53
|
-
key:
|
|
54
|
-
class:
|
|
55
|
-
tabindex: e.modelValue ===
|
|
56
|
-
onKeydown:
|
|
57
|
-
onClick: (
|
|
58
|
-
},
|
|
48
|
+
})) : r("", !0)
|
|
49
|
+
])) : r("", !0),
|
|
50
|
+
V(K, { class: "pl-btn-group__container" }, {
|
|
51
|
+
default: c(() => [
|
|
52
|
+
(l(!0), o(_, null, w(v.value, (n, f) => (l(), o("div", {
|
|
53
|
+
key: f,
|
|
54
|
+
class: d(["pl-btn-group__option text-s", { active: e.modelValue === n.value }]),
|
|
55
|
+
tabindex: e.modelValue === n.value || e.disabled ? void 0 : 0,
|
|
56
|
+
onKeydown: $((h) => s(n.value), ["enter"]),
|
|
57
|
+
onClick: (h) => s(n.value)
|
|
58
|
+
}, a(n.label), 43, z))), 128))
|
|
59
59
|
]),
|
|
60
60
|
_: 1
|
|
61
61
|
}),
|
|
62
|
-
e.helper ? (
|
|
62
|
+
e.helper ? (l(), o("div", M, a(e.helper), 1)) : e.error ? (l(), o("div", D, a(i(N)(e.error)), 1)) : r("", !0)
|
|
63
63
|
], 2));
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
export {
|
|
67
|
-
|
|
67
|
+
q as default
|
|
68
68
|
};
|
|
69
69
|
//# sourceMappingURL=PlBtnGroup.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlBtnGroup.vue.js","sources":["../../../src/components/PlBtnGroup/PlBtnGroup.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * A component for selecting one value from a list of options\n */\nexport default {\n name: 'PlBtnGroup',\n};\n</script>\n\n<script lang=\"ts\" setup generic=\"M = unknown\">\nimport './pl-btn-group.scss';\nimport { computed, useSlots } from 'vue';\nimport { PlTooltip } from '../PlTooltip';\nimport InnerBorder from '../../utils/InnerBorder.vue';\nimport type { SimpleOption } from '../../types';\nimport { getErrorMessage } from '../../helpers/error.ts';\n\nconst slots = useSlots();\n\nconst emit = defineEmits<{\n /**\n * Emitted when the model value is updated.\n */\n (e: 'update:modelValue', value: M): void;\n}>();\n\nconst emitModel = (v: M) => emit('update:modelValue', v);\n\nconst props = defineProps<{\n /**\n * The current selected value.\n */\n modelValue?: M;\n /**\n * The label text for the component (optional)\n */\n label?: string;\n /**\n * List of available options for the component\n */\n options: Readonly<SimpleOption<M>[]>;\n /**\n * If `true`, the component is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * If `true`, the height of the component is 32px\n */\n compact?: boolean;\n /**\n * A helper text displayed below the component when there are no errors (optional).\n */\n helper?: string;\n /**\n * Error message displayed below the component (optional)\n */\n error?: unknown;\n}>();\n\nconst normalizedOptions = computed(() =>\n props.options.map((it) => ({\n label: 'label' in it ? it.label : it.text,\n value: it.value,\n })),\n);\n</script>\n\n<template>\n <div class=\"pl-btn-group\" :class=\"{ disabled, compact }\">\n <label v-if=\"label\">\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <InnerBorder class=\"pl-btn-group__container\">\n <div\n v-for=\"(opt, i) in normalizedOptions\"\n :key=\"i\"\n class=\"pl-btn-group__option text-s\"\n :tabindex=\"modelValue === opt.value || disabled ? undefined : 0\"\n :class=\"{ active: modelValue === opt.value }\"\n @keydown.enter=\"emitModel(opt.value)\"\n @click=\"emitModel(opt.value)\"\n >\n {{ opt.label }}\n </div>\n </InnerBorder>\n <div v-if=\"helper\" class=\"pl-btn-group__helper\">{{ helper }}</div>\n <div v-else-if=\"error\" class=\"pl-btn-group__error\">{{ getErrorMessage(error) }}</div>\n </div>\n</template>\n"],"names":["__default__","slots","useSlots","emit","__emit","emitModel","v","props","__props","normalizedOptions","computed","it"],"mappings":";;;;;;;;;;;GAIAA,IAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;;;AAWA,UAAMC,IAAQC,EAAA,GAERC,IAAOC,GAOPC,IAAY,CAACC,MAASH,EAAK,qBAAqBG,CAAC,GAEjDC,IAAQC,GA+BRC,IAAoBC;AAAA,MAAS,MACjCH,EAAM,QAAQ,IAAI,CAACI,OAAQ;AAAA,QACzB,OAAO,WAAWA,IAAKA,EAAG,QAAQA,EAAG;AAAA,QACrC,OAAOA,EAAG;AAAA,MAAA,EACV;AAAA,IAAA
|
|
1
|
+
{"version":3,"file":"PlBtnGroup.vue.js","sources":["../../../src/components/PlBtnGroup/PlBtnGroup.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * A component for selecting one value from a list of options\n */\nexport default {\n name: 'PlBtnGroup',\n};\n</script>\n\n<script lang=\"ts\" setup generic=\"M = unknown\">\nimport './pl-btn-group.scss';\nimport { computed, useSlots } from 'vue';\nimport { PlTooltip } from '../PlTooltip';\nimport InnerBorder from '../../utils/InnerBorder.vue';\nimport type { SimpleOption } from '../../types';\nimport { getErrorMessage } from '../../helpers/error.ts';\n\nconst slots = useSlots();\n\nconst emit = defineEmits<{\n /**\n * Emitted when the model value is updated.\n */\n (e: 'update:modelValue', value: M): void;\n}>();\n\nconst emitModel = (v: M) => emit('update:modelValue', v);\n\nconst props = defineProps<{\n /**\n * The current selected value.\n */\n modelValue?: M;\n /**\n * The label text for the component (optional)\n */\n label?: string;\n /**\n * List of available options for the component\n */\n options: Readonly<SimpleOption<M>[]>;\n /**\n * If `true`, the component is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * If `true`, the height of the component is 32px\n */\n compact?: boolean;\n /**\n * A helper text displayed below the component when there are no errors (optional).\n */\n helper?: string;\n /**\n * Error message displayed below the component (optional)\n */\n error?: unknown;\n}>();\n\nconst normalizedOptions = computed(() =>\n props.options.map((it) => ({\n label: 'label' in it ? it.label : it.text,\n value: it.value,\n })),\n);\n</script>\n\n<template>\n <div class=\"pl-btn-group\" :class=\"{ disabled, compact }\">\n <label v-if=\"label\">\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <InnerBorder class=\"pl-btn-group__container\">\n <div\n v-for=\"(opt, i) in normalizedOptions\"\n :key=\"i\"\n class=\"pl-btn-group__option text-s\"\n :tabindex=\"modelValue === opt.value || disabled ? undefined : 0\"\n :class=\"{ active: modelValue === opt.value }\"\n @keydown.enter=\"emitModel(opt.value)\"\n @click=\"emitModel(opt.value)\"\n >\n {{ opt.label }}\n </div>\n </InnerBorder>\n <div v-if=\"helper\" class=\"pl-btn-group__helper\">{{ helper }}</div>\n <div v-else-if=\"error\" class=\"pl-btn-group__error\">{{ getErrorMessage(error) }}</div>\n </div>\n</template>\n"],"names":["__default__","slots","useSlots","emit","__emit","emitModel","v","props","__props","normalizedOptions","computed","it","_createElementBlock","_normalizeClass","_hoisted_1","_createElementVNode","_unref","_createBlock","PlTooltip","_renderSlot","_ctx","_createVNode","InnerBorder","_openBlock","_Fragment","_renderList","opt","i","_withKeys","$event","_toDisplayString","_hoisted_2","_hoisted_3","_hoisted_4","getErrorMessage"],"mappings":";;;;;;;;;;;GAIAA,IAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;;;AAWA,UAAMC,IAAQC,EAAA,GAERC,IAAOC,GAOPC,IAAY,CAACC,MAASH,EAAK,qBAAqBG,CAAC,GAEjDC,IAAQC,GA+BRC,IAAoBC;AAAA,MAAS,MACjCH,EAAM,QAAQ,IAAI,CAACI,OAAQ;AAAA,QACzB,OAAO,WAAWA,IAAKA,EAAG,QAAQA,EAAG;AAAA,QACrC,OAAOA,EAAG;AAAA,MAAA,EACV;AAAA,IAAA;2BAKFC,EAwBM,OAAA;AAAA,MAxBD,OAAKC,EAAA,CAAC,gBAAc,EAAA,UAAWL,EAAA,mBAAUA,EAAA,SAAO,CAAA;AAAA,IAAA;MACtCA,EAAA,cAAbI,EAOQ,SAAAE,GAAA;AAAA,QANNC,EAAwB,gBAAfP,EAAA,KAAK,GAAA,CAAA;AAAA,QACGQ,EAAAf,CAAA,EAAM,gBAAvBgB,EAIYD,EAAAE,CAAA,GAAA;AAAA;UAJoB,OAAM;AAAA,UAAO,UAAS;AAAA,QAAA;UACzC,WACT,MAAuB;AAAA,YAAvBC,EAAuBC,EAAA,QAAA,SAAA;AAAA,UAAA;;;;MAI7BC,EAYcC,GAAA,EAZD,OAAM,6BAAyB;AAAA,mBAExC,MAAqC;AAAA,WADvCC,EAAA,EAAA,GAAAX,EAUMY,GAAA,MAAAC,EATehB,EAAA,OAAiB,CAA5BiB,GAAKC,YADff,EAUM,OAAA;AAAA,YARH,KAAKe;AAAA,YACN,UAAM,+BAA6B,EAAA,QAEjBnB,iBAAekB,EAAI,MAAA,CAAK,CAAA;AAAA,YADzC,UAAUlB,iBAAekB,EAAI,SAASlB,EAAA,WAAW,SAAS;AAAA,YAE1D,WAAOoB,EAAA,CAAAC,MAAQxB,EAAUqB,EAAI,KAAK,GAAA,CAAA,OAAA,CAAA;AAAA,YAClC,SAAK,CAAAG,MAAExB,EAAUqB,EAAI,KAAK;AAAA,UAAA,GAExBI,EAAAJ,EAAI,KAAK,GAAA,IAAAK,CAAA;;;;MAGLvB,EAAA,eAAXI,EAAkE,OAAlEoB,GAAkEF,EAAftB,EAAA,MAAM,GAAA,CAAA,KACzCA,EAAA,SAAhBe,KAAAX,EAAqF,OAArFqB,GAAqFH,EAA/Bd,EAAAkB,CAAA,EAAgB1B,EAAA,KAAK,CAAA,GAAA,CAAA;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".ui-btn-link{display:flex;flex-direction:row;align-items:center;gap:12px;--color-text: var(--txt-01);color:var(--txt-01)}.ui-btn-link.disabled,.ui-btn-link.loading{color:var(--color-dis-01)}.ui-btn-link:hover{cursor:pointer}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
import { defineComponent as
|
|
2
|
+
import { defineComponent as a, ref as s, createElementBlock as i, openBlock as d, normalizeClass as u, createVNode as v, renderSlot as m, mergeProps as p } from "vue";
|
|
3
3
|
|
|
4
4
|
import f from "../PlBtnSecondary/PlBtnSecondary.vue.js";
|
|
5
|
-
const
|
|
5
|
+
const b = /* @__PURE__ */ a({
|
|
6
6
|
__name: "PlBtnLink",
|
|
7
7
|
props: {
|
|
8
8
|
loading: { type: Boolean },
|
|
@@ -12,22 +12,22 @@ const g = /* @__PURE__ */ s({
|
|
|
12
12
|
justifyCenter: { type: Boolean },
|
|
13
13
|
disabled: { type: Boolean }
|
|
14
14
|
},
|
|
15
|
-
setup(
|
|
16
|
-
const
|
|
17
|
-
return (
|
|
18
|
-
class:
|
|
19
|
-
onMouseover: o[0] || (o[0] = (
|
|
20
|
-
onMouseleave: o[1] || (o[1] = (
|
|
15
|
+
setup(n) {
|
|
16
|
+
const l = n, e = s(!1);
|
|
17
|
+
return (t, o) => (d(), i("div", {
|
|
18
|
+
class: u(["ui-btn-link", { disabled: n.disabled, loading: n.loading, hover: e.value }]),
|
|
19
|
+
onMouseover: o[0] || (o[0] = (r) => e.value = !0),
|
|
20
|
+
onMouseleave: o[1] || (o[1] = (r) => e.value = !1)
|
|
21
21
|
}, [
|
|
22
|
-
|
|
22
|
+
v(f, p({
|
|
23
23
|
round: "",
|
|
24
24
|
hover: e.value
|
|
25
|
-
},
|
|
26
|
-
|
|
25
|
+
}, l), null, 16, ["hover"]),
|
|
26
|
+
m(t.$slots, "default")
|
|
27
27
|
], 34));
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
export {
|
|
31
|
-
|
|
31
|
+
b as default
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=PlBtnLink.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlBtnLink.vue.js","sources":["../../../src/components/PlBtnLink/PlBtnLink.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport './pl-btn-link.scss';\nimport type { MaskIconName16, Size } from '../../types';\nimport BtnSecondary from '../PlBtnSecondary/PlBtnSecondary.vue';\nimport { ref } from 'vue';\n\nconst props = defineProps<{\n /**\n * If `true,` the button is disabled, cannot be interacted with, and shows a special 'loading' icon.\n */\n loading?: boolean;\n /**\n * Size of the button, the default value is 'medium'\n */\n size?: Size;\n /**\n * Icon to display\n */\n icon?: MaskIconName16;\n /**\n * If `true`, an icon is displayed before the text.\n */\n reverse?: boolean;\n /**\n * Justify text at the center (is `true` by default)\n */\n justifyCenter?: boolean;\n /**\n * If `true`, the button is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n}>();\n\nconst hover = ref(false);\n</script>\n\n<template>\n <div class=\"ui-btn-link\" :class=\"{ disabled, loading, hover }\" @mouseover=\"hover = true\" @mouseleave=\"hover = false\">\n <BtnSecondary round :hover=\"hover\" v-bind=\"props\" />\n <slot />\n </div>\n</template>\n"],"names":["props","__props","hover","ref"],"mappings":";;;;;;;;;;;;;;AAMA,UAAMA,IAAQC,GA2BRC,IAAQC,EAAI,EAAK
|
|
1
|
+
{"version":3,"file":"PlBtnLink.vue.js","sources":["../../../src/components/PlBtnLink/PlBtnLink.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport './pl-btn-link.scss';\nimport type { MaskIconName16, Size } from '../../types';\nimport BtnSecondary from '../PlBtnSecondary/PlBtnSecondary.vue';\nimport { ref } from 'vue';\n\nconst props = defineProps<{\n /**\n * If `true,` the button is disabled, cannot be interacted with, and shows a special 'loading' icon.\n */\n loading?: boolean;\n /**\n * Size of the button, the default value is 'medium'\n */\n size?: Size;\n /**\n * Icon to display\n */\n icon?: MaskIconName16;\n /**\n * If `true`, an icon is displayed before the text.\n */\n reverse?: boolean;\n /**\n * Justify text at the center (is `true` by default)\n */\n justifyCenter?: boolean;\n /**\n * If `true`, the button is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n}>();\n\nconst hover = ref(false);\n</script>\n\n<template>\n <div class=\"ui-btn-link\" :class=\"{ disabled, loading, hover }\" @mouseover=\"hover = true\" @mouseleave=\"hover = false\">\n <BtnSecondary round :hover=\"hover\" v-bind=\"props\" />\n <slot />\n </div>\n</template>\n"],"names":["props","__props","hover","ref","_createElementBlock","_createVNode","BtnSecondary","_mergeProps","_renderSlot","_ctx"],"mappings":";;;;;;;;;;;;;;AAMA,UAAMA,IAAQC,GA2BRC,IAAQC,EAAI,EAAK;2BAIrBC,EAGM,OAAA;AAAA,MAHD,UAAM,eAAa,EAAA,UAAWH,YAAQ,SAAEA,EAAA,gBAASC,EAAA,MAAA,CAAK,CAAA;AAAA,MAAK,oCAAWA,EAAA,QAAK;AAAA,MAAU,qCAAYA,EAAA,QAAK;AAAA,IAAA;MACzGG,EAAoDC,GAApDC,EAAoD;AAAA,QAAtC,OAAA;AAAA,QAAO,OAAOL,EAAA;AAAA,MAAA,GAAeF,CAAK,GAAA,MAAA,IAAA,CAAA,OAAA,CAAA;AAAA,MAChDQ,EAAQC,EAAA,QAAA,SAAA;AAAA,IAAA;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlBtnPrimary.vue.js","sources":["../../../src/components/PlBtnPrimary/PlBtnPrimary.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Primary button\n */\nexport default {\n name: 'PlBtnPrimary',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-btn-primary.scss';\nimport type { MaskIconName16, Size } from '../../types';\nimport BtnBase from '../../base/BtnBase.vue';\n\nconst props = defineProps<{\n /**\n * If `true,` the button is disabled, cannot be interacted with, and shows a special 'loading' icon.\n */\n loading?: boolean;\n /**\n * Size of the button, the default value is 'medium'\n */\n size?: Size;\n /**\n * If `true` the shape is round.\n */\n round?: boolean;\n /**\n * Icon to display\n */\n icon?: MaskIconName16;\n /**\n * If `true`, an icon is displayed before the text.\n */\n reverse?: boolean;\n /**\n * Justify text at the center\n */\n justifyCenter?: boolean;\n}>();\n</script>\n\n<template>\n <BtnBase class=\"pl-btn-primary\" v-bind=\"props\">\n <slot />\n </BtnBase>\n</template>\n"],"names":["__default__","props","__props"],"mappings":";;;AAIA,MAAAA,IAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;AAQA,UAAMC,IAAQC
|
|
1
|
+
{"version":3,"file":"PlBtnPrimary.vue.js","sources":["../../../src/components/PlBtnPrimary/PlBtnPrimary.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Primary button\n */\nexport default {\n name: 'PlBtnPrimary',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-btn-primary.scss';\nimport type { MaskIconName16, Size } from '../../types';\nimport BtnBase from '../../base/BtnBase.vue';\n\nconst props = defineProps<{\n /**\n * If `true,` the button is disabled, cannot be interacted with, and shows a special 'loading' icon.\n */\n loading?: boolean;\n /**\n * Size of the button, the default value is 'medium'\n */\n size?: Size;\n /**\n * If `true` the shape is round.\n */\n round?: boolean;\n /**\n * Icon to display\n */\n icon?: MaskIconName16;\n /**\n * If `true`, an icon is displayed before the text.\n */\n reverse?: boolean;\n /**\n * Justify text at the center\n */\n justifyCenter?: boolean;\n}>();\n</script>\n\n<template>\n <BtnBase class=\"pl-btn-primary\" v-bind=\"props\">\n <slot />\n </BtnBase>\n</template>\n"],"names":["__default__","props","__props","_openBlock","_createBlock","BtnBase","_mergeProps","_renderSlot","_ctx"],"mappings":";;;AAIA,MAAAA,IAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;AAQA,UAAMC,IAAQC;sBA6BZC,EAAA,GAAAC,EAEUC,GAFVC,EAEU,EAFD,OAAM,oBAAyBL,CAAK,GAAA;AAAA,iBAC3C,MAAQ;AAAA,QAARM,EAAQC,EAAA,QAAA,SAAA;AAAA,MAAA;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlBtnSecondary.vue.js","sources":["../../../src/components/PlBtnSecondary/PlBtnSecondary.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Secondary button\n */\nexport default {\n name: 'PlBtnSecondary',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-btn-secondary.scss';\nimport type { MaskIconName16, Size } from '../../types';\nimport BtnBase from '../../base/BtnBase.vue';\n\nconst props = defineProps<{\n /**\n * If `true,` the button is disabled, cannot be interacted with, and shows a special 'loading' icon.\n */\n loading?: boolean;\n /**\n * Size of the button, the default value is 'medium'\n */\n size?: Size;\n /**\n * If `true` the shape is round.\n */\n round?: boolean;\n /**\n * Icon to display\n */\n icon?: MaskIconName16;\n /**\n * If `true`, an icon is displayed before the text.\n */\n reverse?: boolean;\n /**\n * Justify text at the center\n */\n justifyCenter?: boolean;\n}>();\n</script>\n\n<template>\n <BtnBase v-bind=\"props\" class=\"pl-btn-secondary\">\n <slot />\n </BtnBase>\n</template>\n"],"names":["__default__","props","__props"],"mappings":";;;AAIA,MAAAA,IAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;AAQA,UAAMC,IAAQC
|
|
1
|
+
{"version":3,"file":"PlBtnSecondary.vue.js","sources":["../../../src/components/PlBtnSecondary/PlBtnSecondary.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Secondary button\n */\nexport default {\n name: 'PlBtnSecondary',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-btn-secondary.scss';\nimport type { MaskIconName16, Size } from '../../types';\nimport BtnBase from '../../base/BtnBase.vue';\n\nconst props = defineProps<{\n /**\n * If `true,` the button is disabled, cannot be interacted with, and shows a special 'loading' icon.\n */\n loading?: boolean;\n /**\n * Size of the button, the default value is 'medium'\n */\n size?: Size;\n /**\n * If `true` the shape is round.\n */\n round?: boolean;\n /**\n * Icon to display\n */\n icon?: MaskIconName16;\n /**\n * If `true`, an icon is displayed before the text.\n */\n reverse?: boolean;\n /**\n * Justify text at the center\n */\n justifyCenter?: boolean;\n}>();\n</script>\n\n<template>\n <BtnBase v-bind=\"props\" class=\"pl-btn-secondary\">\n <slot />\n </BtnBase>\n</template>\n"],"names":["__default__","props","__props","_openBlock","_createBlock","BtnBase","_mergeProps","_renderSlot","_ctx"],"mappings":";;;AAIA,MAAAA,IAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;AAQA,UAAMC,IAAQC;sBA6BZC,EAAA,GAAAC,EAEUC,GAFVC,EAEUL,GAFY,EAAE,OAAM,mBAAA,CAAkB,GAAA;AAAA,iBAC9C,MAAQ;AAAA,QAARM,EAAQC,EAAA,QAAA,SAAA;AAAA,MAAA;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode('.pl-btn-split{--border-color: var(--border-color-default);height:40px;min-width:160px;border-radius:6px;border:1px solid var(--border-color);cursor:pointer}.pl-btn-split.disabled,.pl-btn-split.loading{pointer-events:none;--border-color: var(--border-color-div-grey)}.pl-btn-split.loading .mask-loading{animation:spin 2.5s linear infinite}.pl-btn-split__title{padding:8px 14px;height:100%;color:var(--border-color);transition:all .1s ease-in-out}.pl-btn-split__title:focus-visible{position:relative;outline:none}.pl-btn-split__title:focus-visible:after{content:"";position:absolute;top:-1px;right:-1px;bottom:-1px;left:-1px;border:2px solid var(--border-color-focus);border-radius:6px;z-index:2}.pl-btn-split__title:hover{border-radius:6px;background-color:var(--btn-sec-hover-grey)}.pl-btn-split__title:active{border-radius:6px;background-color:var(--btn-sec-press-grey)}.pl-btn-split__icon,.pl-btn-split .mask-loading{--icon-color: var(--border-color)}.pl-btn-split__icon-container{width:36px;height:100%;position:relative;transition:all .1s ease-in-out}.pl-btn-split__icon-container:focus-visible{position:relative;outline:none}.pl-btn-split__icon-container:focus-visible:after{content:"";position:absolute;top:-1px;right:-1px;bottom:-1px;left:-1px;border:2px solid var(--border-color-focus);border-radius:6px;z-index:2}.pl-btn-split__icon-container:hover{border-radius:6px;background-color:var(--btn-sec-hover-grey)}.pl-btn-split__icon-container:active{border-radius:6px;background-color:var(--btn-sec-press-grey)}.pl-btn-split__icon-container:before{content:"";background:var(--border-color);height:26px;position:absolute;left:0;width:1px}')),document.head.appendChild(o)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
import { defineComponent as j, mergeModels as C, useModel as q, ref as u, reactive as B, watch as U, computed as r, createElementBlock as M, openBlock as s, normalizeClass as R, createElementVNode as
|
|
2
|
+
import { defineComponent as j, mergeModels as C, useModel as q, ref as u, reactive as B, watch as U, computed as r, createElementBlock as M, openBlock as s, normalizeClass as R, createElementVNode as y, createBlock as f, createCommentVNode as G, withKeys as J, withModifiers as S, toDisplayString as Q, unref as k, Teleport as X, normalizeStyle as Y, Fragment as Z, renderList as ee } from "vue";
|
|
3
3
|
import { deepEqual as H } from "@milaboratories/helpers";
|
|
4
4
|
import { useElementPosition as te } from "../../composition/usePosition.js";
|
|
5
5
|
import { normalizeListOptions as oe } from "../../helpers/utils.js";
|
|
@@ -17,8 +17,8 @@ const ie = ["onKeyup"], ue = /* @__PURE__ */ j({
|
|
|
17
17
|
modelModifiers: {}
|
|
18
18
|
}),
|
|
19
19
|
emits: /* @__PURE__ */ C(["click"], ["update:modelValue"]),
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
20
|
+
setup(m, { expose: O, emit: V }) {
|
|
21
|
+
const c = m, z = V, v = q(m, "modelValue"), l = u(), x = u(), b = u(), _ = u(), o = B({
|
|
22
22
|
open: !1,
|
|
23
23
|
optionsHeight: 0,
|
|
24
24
|
activeIndex: -1
|
|
@@ -26,13 +26,13 @@ const ie = ["onKeyup"], ue = /* @__PURE__ */ j({
|
|
|
26
26
|
O({
|
|
27
27
|
data: o
|
|
28
28
|
});
|
|
29
|
-
const
|
|
29
|
+
const a = B({
|
|
30
30
|
top: "0px",
|
|
31
31
|
left: "0px",
|
|
32
32
|
width: "0px"
|
|
33
33
|
});
|
|
34
34
|
U(
|
|
35
|
-
|
|
35
|
+
x,
|
|
36
36
|
(e) => {
|
|
37
37
|
if (e) {
|
|
38
38
|
const t = e.getBoundingClientRect();
|
|
@@ -41,26 +41,26 @@ const ie = ["onKeyup"], ue = /* @__PURE__ */ j({
|
|
|
41
41
|
},
|
|
42
42
|
{ immediate: !0 }
|
|
43
43
|
);
|
|
44
|
-
const D = r(() => o.open ? "chevron-up" : "chevron-down"), N = r(() => (
|
|
45
|
-
() => oe(
|
|
44
|
+
const D = r(() => o.open ? "chevron-up" : "chevron-down"), N = r(() => (c.options ?? []).findIndex((e) => H(e.value, v.value))), d = r(
|
|
45
|
+
() => oe(c.options ?? []).map((e, t) => ({
|
|
46
46
|
...e,
|
|
47
47
|
index: t,
|
|
48
48
|
isSelected: t === N.value,
|
|
49
49
|
isActive: t === o.activeIndex
|
|
50
50
|
}))
|
|
51
|
-
),
|
|
51
|
+
), h = r(() => c.loading || c.options === void 0), T = r(() => {
|
|
52
52
|
var e;
|
|
53
|
-
return ((e = d.value.find((t) => H(t.value,
|
|
53
|
+
return ((e = d.value.find((t) => H(t.value, v.value))) == null ? void 0 : e.label) ?? (c.options === void 0 ? "..." : "");
|
|
54
54
|
});
|
|
55
55
|
te(l, (e) => {
|
|
56
56
|
const n = e.top + e.height + 3;
|
|
57
|
-
n + o.optionsHeight > e.clientHeight ?
|
|
57
|
+
n + o.optionsHeight > e.clientHeight ? a.top = e.top - o.optionsHeight - 3 + "px" : a.top = n + "px", a.left = e.left + "px", a.width = e.width + "px";
|
|
58
58
|
});
|
|
59
59
|
const E = (e) => {
|
|
60
60
|
var t;
|
|
61
|
-
|
|
61
|
+
v.value = e, o.open = !1, (t = l == null ? void 0 : l.value) == null || t.focus();
|
|
62
62
|
};
|
|
63
|
-
function
|
|
63
|
+
function g() {
|
|
64
64
|
z("click");
|
|
65
65
|
}
|
|
66
66
|
const F = (e) => {
|
|
@@ -69,53 +69,53 @@ const ie = ["onKeyup"], ue = /* @__PURE__ */ j({
|
|
|
69
69
|
e.preventDefault();
|
|
70
70
|
else
|
|
71
71
|
return;
|
|
72
|
-
if (e.target ===
|
|
73
|
-
|
|
72
|
+
if (e.target === _.value && e.code === "Enter") {
|
|
73
|
+
g();
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
const { open: t, activeIndex: n } = o;
|
|
77
|
-
if (!t && e.target ===
|
|
77
|
+
if (!t && e.target === b.value) {
|
|
78
78
|
e.code === "Enter" && (o.open = !0);
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
e.code === "Escape" && (o.open = !1, (A = l.value) == null || A.focus());
|
|
82
|
-
const i =
|
|
82
|
+
const i = k(d), { length: p } = i;
|
|
83
83
|
if (!p)
|
|
84
84
|
return;
|
|
85
|
-
e.code === "Enter" && E((I = i.find((
|
|
86
|
-
const P = i.findIndex((
|
|
85
|
+
e.code === "Enter" && E((I = i.find((w) => w.index === n)) == null ? void 0 : I.value);
|
|
86
|
+
const P = i.findIndex((w) => w.index === n) ?? -1, W = e.code === "ArrowDown" ? 1 : e.code === "ArrowUp" ? -1 : 0, $ = Math.abs(P + W + p) % p;
|
|
87
87
|
o.activeIndex = d.value[$].index ?? -1;
|
|
88
88
|
}, L = (e) => {
|
|
89
89
|
var n, i;
|
|
90
90
|
const t = e.relatedTarget;
|
|
91
|
-
!((n = l.value) != null && n.contains(t)) && !((i =
|
|
91
|
+
!((n = l.value) != null && n.contains(t)) && !((i = x.value) != null && i.contains(t)) && (o.open = !1);
|
|
92
92
|
};
|
|
93
93
|
return (e, t) => (s(), M("div", {
|
|
94
94
|
ref_key: "root",
|
|
95
95
|
ref: l,
|
|
96
|
-
class: R([{ disabled:
|
|
96
|
+
class: R([{ disabled: m.disabled || h.value, loading: h.value }, "pl-btn-split d-flex"]),
|
|
97
97
|
onFocusout: L,
|
|
98
98
|
onKeydown: F
|
|
99
99
|
}, [
|
|
100
|
-
|
|
100
|
+
y("div", {
|
|
101
101
|
ref_key: "buttonAction",
|
|
102
|
-
ref:
|
|
102
|
+
ref: _,
|
|
103
103
|
class: "pl-btn-split__title flex-grow-1 d-flex align-center text-s-btn",
|
|
104
104
|
tabindex: "0",
|
|
105
|
-
onClick:
|
|
106
|
-
onKeyup: J(S(
|
|
105
|
+
onClick: g,
|
|
106
|
+
onKeyup: J(S(g, ["stop"]), ["enter"])
|
|
107
107
|
}, Q(T.value), 41, ie),
|
|
108
|
-
|
|
108
|
+
y("div", {
|
|
109
109
|
ref_key: "menuActivator",
|
|
110
|
-
ref:
|
|
110
|
+
ref: b,
|
|
111
111
|
class: "pl-btn-split__icon-container d-flex align-center justify-center",
|
|
112
112
|
tabindex: "0",
|
|
113
113
|
onClick: t[0] || (t[0] = (n) => o.open = !o.open)
|
|
114
114
|
}, [
|
|
115
|
-
|
|
115
|
+
h.value ? (s(), f(k(K), {
|
|
116
116
|
key: 0,
|
|
117
117
|
name: "loading"
|
|
118
|
-
})) : (s(), f(
|
|
118
|
+
})) : (s(), f(k(K), {
|
|
119
119
|
key: 1,
|
|
120
120
|
name: D.value,
|
|
121
121
|
class: "pl-btn-split__icon"
|
|
@@ -125,11 +125,11 @@ const ie = ["onKeyup"], ue = /* @__PURE__ */ j({
|
|
|
125
125
|
key: 0,
|
|
126
126
|
to: "body"
|
|
127
127
|
}, [
|
|
128
|
-
|
|
128
|
+
y("div", {
|
|
129
129
|
ref_key: "list",
|
|
130
|
-
ref:
|
|
130
|
+
ref: x,
|
|
131
131
|
class: "pl-dropdown__options",
|
|
132
|
-
style: Y(
|
|
132
|
+
style: Y(a),
|
|
133
133
|
tabindex: "-1"
|
|
134
134
|
}, [
|
|
135
135
|
(s(!0), M(Z, null, ee(d.value, (n, i) => (s(), f(ne, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlBtnSplit.vue.js","sources":["../../../src/components/PlBtnSplit/PlBtnSplit.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"M = unknown\">\nimport { deepEqual } from '@milaboratories/helpers';\nimport { computed, reactive, ref, unref, watch } from 'vue';\nimport { useElementPosition } from '../../composition/usePosition';\nimport { normalizeListOptions } from '../../helpers/utils';\nimport type { ListOption } from '../../types';\nimport DropdownListItem from '../DropdownListItem.vue';\nimport { PlIcon16 } from '../PlIcon16';\n\nimport './pl-btn-split.scss';\n\nconst props = defineProps<{\n /**\n * List of available options for the dropdown menu\n */\n options?: Readonly<ListOption<M>[]>;\n\n /**\n * If `true`, the dropdown component is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n\n /**\n * If `true,` the button is disabled, cannot be interacted with, and shows a special 'loading' icon.\n */\n loading?: boolean;\n}>();\n\nconst emits = defineEmits(['click']);\n\nconst model = defineModel<M>({ required: true });\n\nconst root = ref<HTMLElement | undefined>();\nconst list = ref<HTMLElement | undefined>();\nconst menuActivator = ref<HTMLElement | undefined>();\nconst buttonAction = ref<HTMLElement | undefined>();\n\nconst data = reactive({\n open: false,\n optionsHeight: 0,\n activeIndex: -1,\n});\n\ndefineExpose({\n data,\n});\n\nconst optionsStyle = reactive({\n top: '0px',\n left: '0px',\n width: '0px',\n});\n\nwatch(\n list,\n (el) => {\n if (el) {\n const rect = el.getBoundingClientRect();\n data.optionsHeight = rect.height;\n window.dispatchEvent(new CustomEvent('adjust'));\n }\n },\n { immediate: true },\n);\n\nconst iconName = computed(() => (data.open ? 'chevron-up' : 'chevron-down'));\n\nconst selectedIndex = computed(() => {\n return (props.options ?? []).findIndex((o) => deepEqual(o.value, model.value));\n});\n\nconst items = computed(() =>\n normalizeListOptions(props.options ?? []).map((opt, index) => ({\n ...opt,\n index,\n isSelected: index === selectedIndex.value,\n isActive: index === data.activeIndex,\n })),\n);\n\nconst isLoadingOptions = computed(() => props.loading || props.options === undefined);\n\nconst actionName = computed(() => items.value.find((o) => deepEqual(o.value, model.value))?.label ?? (props.options === undefined ? '...' : ''));\n\nuseElementPosition(root, (pos) => {\n const focusWidth = 3;\n\n const downTopOffset = pos.top + pos.height + focusWidth;\n\n if (downTopOffset + data.optionsHeight > pos.clientHeight) {\n optionsStyle.top = pos.top - data.optionsHeight - focusWidth + 'px';\n } else {\n optionsStyle.top = downTopOffset + 'px';\n }\n\n optionsStyle.left = pos.left + 'px';\n optionsStyle.width = pos.width + 'px';\n});\n\nconst selectOption = (v: M | undefined) => {\n model.value = v!;\n data.open = false;\n root?.value?.focus();\n};\n\nfunction emitEnter() {\n emits('click');\n}\n\nconst handleKeydown = (e: { code: string; preventDefault(): void; stopPropagation(): void; target: EventTarget | null }) => {\n if (!['ArrowDown', 'ArrowUp', 'Enter', 'Escape'].includes(e.code)) {\n return;\n } else {\n e.preventDefault();\n }\n\n if (e.target === buttonAction.value && e.code === 'Enter') {\n emitEnter();\n return;\n }\n\n const { open, activeIndex } = data;\n\n if (!open && e.target === menuActivator.value) {\n if (e.code === 'Enter') {\n data.open = true;\n }\n return;\n }\n\n if (e.code === 'Escape') {\n data.open = false;\n root.value?.focus();\n }\n\n const filtered = unref(items);\n\n const { length } = filtered;\n\n if (!length) {\n return;\n }\n\n if (e.code === 'Enter') {\n selectOption(filtered.find((it) => it.index === activeIndex)?.value);\n }\n\n const localIndex = filtered.findIndex((it) => it.index === activeIndex) ?? -1;\n\n const delta = e.code === 'ArrowDown' ? 1 : e.code === 'ArrowUp' ? -1 : 0;\n\n const newIndex = Math.abs(localIndex + delta + length) % length;\n\n data.activeIndex = items.value[newIndex].index ?? -1;\n};\n\nconst onFocusOut = (event: FocusEvent) => {\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!root.value?.contains(relatedTarget) && !list.value?.contains(relatedTarget)) {\n data.open = false;\n }\n};\n</script>\n<template>\n <div\n ref=\"root\"\n :class=\"{ disabled: disabled || isLoadingOptions, loading: isLoadingOptions }\"\n class=\"pl-btn-split d-flex\"\n @focusout=\"onFocusOut\"\n @keydown=\"handleKeydown\"\n >\n <div\n ref=\"buttonAction\"\n class=\"pl-btn-split__title flex-grow-1 d-flex align-center text-s-btn\"\n tabindex=\"0\"\n @click=\"emitEnter\"\n @keyup.stop.enter=\"emitEnter\"\n >\n {{ actionName }}\n </div>\n <div ref=\"menuActivator\" class=\"pl-btn-split__icon-container d-flex align-center justify-center\" tabindex=\"0\" @click=\"data.open = !data.open\">\n <PlIcon16 v-if=\"isLoadingOptions\" name=\"loading\" />\n <PlIcon16 v-else :name=\"iconName\" class=\"pl-btn-split__icon\" />\n </div>\n\n <Teleport v-if=\"data.open\" to=\"body\">\n <div ref=\"list\" class=\"pl-dropdown__options\" :style=\"optionsStyle\" tabindex=\"-1\">\n <DropdownListItem\n v-for=\"(item, index) in items\"\n :key=\"index\"\n :option=\"item\"\n :is-selected=\"item.isSelected\"\n :is-hovered=\"item.isActive\"\n :size=\"'medium'\"\n @click.stop=\"selectOption(item.value)\"\n />\n </div>\n </Teleport>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","model","_useModel","root","ref","list","menuActivator","buttonAction","data","reactive","__expose","optionsStyle","watch","el","rect","iconName","computed","selectedIndex","o","deepEqual","items","normalizeListOptions","opt","index","isLoadingOptions","actionName","_a","useElementPosition","pos","downTopOffset","selectOption","v","emitEnter","handleKeydown","open","activeIndex","filtered","unref","length","_b","it","localIndex","delta","newIndex","onFocusOut","event","relatedTarget"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA,UAAMA,IAAQC,GAiBRC,IAAQC,GAERC,IAAQC,iBAAiC,GAEzCC,IAAOC,EAAA,GACPC,IAAOD,EAAA,GACPE,IAAgBF,EAAA,GAChBG,IAAeH,EAAA,GAEfI,IAAOC,EAAS;AAAA,MACpB,MAAM;AAAA,MACN,eAAe;AAAA,MACf,aAAa;AAAA,IAAA,CACd;AAED,IAAAC,EAAa;AAAA,MACX,MAAAF;AAAA,IAAA,CACD;AAED,UAAMG,IAAeF,EAAS;AAAA,MAC5B,KAAK;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,IAAA,CACR;AAED,IAAAG;AAAA,MACEP;AAAA,MACA,CAACQ,MAAO;AACN,YAAIA,GAAI;AACN,gBAAMC,IAAOD,EAAG,sBAAA;AAChB,UAAAL,EAAK,gBAAgBM,EAAK,QAC1B,OAAO,cAAc,IAAI,YAAY,QAAQ,CAAC;AAAA,QAChD;AAAA,MACF;AAAA,MACA,EAAE,WAAW,GAAA;AAAA,IAAK;AAGpB,UAAMC,IAAWC,EAAS,MAAOR,EAAK,OAAO,eAAe,cAAe,GAErES,IAAgBD,EAAS,OACrBnB,EAAM,WAAW,CAAA,GAAI,UAAU,CAACqB,MAAMC,EAAUD,EAAE,OAAOjB,EAAM,KAAK,CAAC,CAC9E,GAEKmB,IAAQJ;AAAA,MAAS,MACrBK,GAAqBxB,EAAM,WAAW,CAAA,CAAE,EAAE,IAAI,CA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,EAAE,WAAW5B,EAAc,OAAO;AAC7C,QAAI,EAAE,SAAS,YACbE,EAAK,OAAO;AAEd;AAAA,MACF;AAEA,MAAI,EAAE,SAAS,aACbA,EAAK,OAAO,KACZkB,IAAAvB,EAAK,UAAL,QAAAuB,EAAY;AAGd,YAAMU,IAAWC,EAAMjB,CAAK,GAEtB,EAAE,QAAAkB,MAAWF;AAEnB,UAAI,CAACE;AACH;AAGF,MAAI,EAAE,SAAS,WACbR,GAAaS,IAAAH,EAAS,KAAK,CAACI,MAAOA,EAAG,UAAUL,CAAW,MAA9C,gBAAAI,EAAiD,KAAK;AAGrE,YAAME,IAAaL,EAAS,UAAU,CAACI,MAAOA,EAAG,UAAUL,CAAW,KAAK,IAErEO,IAAQ,EAAE,SAAS,cAAc,IAAI,EAAE,SAAS,YAAY,KAAK,GAEjEC,IAAW,KAAK,IAAIF,IAAaC,IAAQJ,CAAM,IAAIA;AAEzD,MAAA9B,EAAK,cAAcY,EAAM,MAAMuB,CAAQ,EAAE,SAAS;AAAA,IACpD,GAEMC,IAAa,CAACC,MAAsB;;AACxC,YAAMC,IAAgBD,EAAM;AAE5B,MAAI,GAACnB,IAAAvB,EAAK,UAAL,QAAAuB,EAAY,SAASoB,OAAkB,GAACP,IAAAlC,EAAK,UAAL,QAAAkC,EAAY,SAASO,QAChEtC,EAAK,OAAO;AAAA,IAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"PlBtnSplit.vue.js","sources":["../../../src/components/PlBtnSplit/PlBtnSplit.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"M = unknown\">\nimport { deepEqual } from '@milaboratories/helpers';\nimport { computed, reactive, ref, unref, watch } from 'vue';\nimport { useElementPosition } from '../../composition/usePosition';\nimport { normalizeListOptions } from '../../helpers/utils';\nimport type { ListOption } from '../../types';\nimport DropdownListItem from '../DropdownListItem.vue';\nimport { PlIcon16 } from '../PlIcon16';\n\nimport './pl-btn-split.scss';\n\nconst props = defineProps<{\n /**\n * List of available options for the dropdown menu\n */\n options?: Readonly<ListOption<M>[]>;\n\n /**\n * If `true`, the dropdown component is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n\n /**\n * If `true,` the button is disabled, cannot be interacted with, and shows a special 'loading' icon.\n */\n loading?: boolean;\n}>();\n\nconst emits = defineEmits(['click']);\n\nconst model = defineModel<M>({ required: true });\n\nconst root = ref<HTMLElement | undefined>();\nconst list = ref<HTMLElement | undefined>();\nconst menuActivator = ref<HTMLElement | undefined>();\nconst buttonAction = ref<HTMLElement | undefined>();\n\nconst data = reactive({\n open: false,\n optionsHeight: 0,\n activeIndex: -1,\n});\n\ndefineExpose({\n data,\n});\n\nconst optionsStyle = reactive({\n top: '0px',\n left: '0px',\n width: '0px',\n});\n\nwatch(\n list,\n (el) => {\n if (el) {\n const rect = el.getBoundingClientRect();\n data.optionsHeight = rect.height;\n window.dispatchEvent(new CustomEvent('adjust'));\n }\n },\n { immediate: true },\n);\n\nconst iconName = computed(() => (data.open ? 'chevron-up' : 'chevron-down'));\n\nconst selectedIndex = computed(() => {\n return (props.options ?? []).findIndex((o) => deepEqual(o.value, model.value));\n});\n\nconst items = computed(() =>\n normalizeListOptions(props.options ?? []).map((opt, index) => ({\n ...opt,\n index,\n isSelected: index === selectedIndex.value,\n isActive: index === data.activeIndex,\n })),\n);\n\nconst isLoadingOptions = computed(() => props.loading || props.options === undefined);\n\nconst actionName = computed(() => items.value.find((o) => deepEqual(o.value, model.value))?.label ?? (props.options === undefined ? '...' : ''));\n\nuseElementPosition(root, (pos) => {\n const focusWidth = 3;\n\n const downTopOffset = pos.top + pos.height + focusWidth;\n\n if (downTopOffset + data.optionsHeight > pos.clientHeight) {\n optionsStyle.top = pos.top - data.optionsHeight - focusWidth + 'px';\n } else {\n optionsStyle.top = downTopOffset + 'px';\n }\n\n optionsStyle.left = pos.left + 'px';\n optionsStyle.width = pos.width + 'px';\n});\n\nconst selectOption = (v: M | undefined) => {\n model.value = v!;\n data.open = false;\n root?.value?.focus();\n};\n\nfunction emitEnter() {\n emits('click');\n}\n\nconst handleKeydown = (e: { code: string; preventDefault(): void; stopPropagation(): void; target: EventTarget | null }) => {\n if (!['ArrowDown', 'ArrowUp', 'Enter', 'Escape'].includes(e.code)) {\n return;\n } else {\n e.preventDefault();\n }\n\n if (e.target === buttonAction.value && e.code === 'Enter') {\n emitEnter();\n return;\n }\n\n const { open, activeIndex } = data;\n\n if (!open && e.target === menuActivator.value) {\n if (e.code === 'Enter') {\n data.open = true;\n }\n return;\n }\n\n if (e.code === 'Escape') {\n data.open = false;\n root.value?.focus();\n }\n\n const filtered = unref(items);\n\n const { length } = filtered;\n\n if (!length) {\n return;\n }\n\n if (e.code === 'Enter') {\n selectOption(filtered.find((it) => it.index === activeIndex)?.value);\n }\n\n const localIndex = filtered.findIndex((it) => it.index === activeIndex) ?? -1;\n\n const delta = e.code === 'ArrowDown' ? 1 : e.code === 'ArrowUp' ? -1 : 0;\n\n const newIndex = Math.abs(localIndex + delta + length) % length;\n\n data.activeIndex = items.value[newIndex].index ?? -1;\n};\n\nconst onFocusOut = (event: FocusEvent) => {\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!root.value?.contains(relatedTarget) && !list.value?.contains(relatedTarget)) {\n data.open = false;\n }\n};\n</script>\n<template>\n <div\n ref=\"root\"\n :class=\"{ disabled: disabled || isLoadingOptions, loading: isLoadingOptions }\"\n class=\"pl-btn-split d-flex\"\n @focusout=\"onFocusOut\"\n @keydown=\"handleKeydown\"\n >\n <div\n ref=\"buttonAction\"\n class=\"pl-btn-split__title flex-grow-1 d-flex align-center text-s-btn\"\n tabindex=\"0\"\n @click=\"emitEnter\"\n @keyup.stop.enter=\"emitEnter\"\n >\n {{ actionName }}\n </div>\n <div ref=\"menuActivator\" class=\"pl-btn-split__icon-container d-flex align-center justify-center\" tabindex=\"0\" @click=\"data.open = !data.open\">\n <PlIcon16 v-if=\"isLoadingOptions\" name=\"loading\" />\n <PlIcon16 v-else :name=\"iconName\" class=\"pl-btn-split__icon\" />\n </div>\n\n <Teleport v-if=\"data.open\" to=\"body\">\n <div ref=\"list\" class=\"pl-dropdown__options\" :style=\"optionsStyle\" tabindex=\"-1\">\n <DropdownListItem\n v-for=\"(item, index) in items\"\n :key=\"index\"\n :option=\"item\"\n :is-selected=\"item.isSelected\"\n :is-hovered=\"item.isActive\"\n :size=\"'medium'\"\n @click.stop=\"selectOption(item.value)\"\n />\n </div>\n </Teleport>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","model","_useModel","root","ref","list","menuActivator","buttonAction","data","reactive","__expose","optionsStyle","watch","el","rect","iconName","computed","selectedIndex","o","deepEqual","items","normalizeListOptions","opt","index","isLoadingOptions","actionName","_a","useElementPosition","pos","downTopOffset","selectOption","v","emitEnter","handleKeydown","open","activeIndex","filtered","unref","length","_b","it","localIndex","delta","newIndex","onFocusOut","event","relatedTarget","_createElementBlock","_createElementVNode","_hoisted_1","_createBlock","_unref","PlIcon16","_Teleport","_openBlock","_Fragment","_renderList","item","DropdownListItem","_withModifiers","$event"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA,UAAMA,IAAQC,GAiBRC,IAAQC,GAERC,IAAQC,iBAAiC,GAEzCC,IAAOC,EAAA,GACPC,IAAOD,EAAA,GACPE,IAAgBF,EAAA,GAChBG,IAAeH,EAAA,GAEfI,IAAOC,EAAS;AAAA,MACpB,MAAM;AAAA,MACN,eAAe;AAAA,MACf,aAAa;AAAA,IAAA,CACd;AAED,IAAAC,EAAa;AAAA,MACX,MAAAF;AAAA,IAAA,CACD;AAED,UAAMG,IAAeF,EAAS;AAAA,MAC5B,KAAK;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,IAAA,CACR;AAED,IAAAG;AAAA,MACEP;AAAA,MACA,CAACQ,MAAO;AACN,YAAIA,GAAI;AACN,gBAAMC,IAAOD,EAAG,sBAAA;AAChB,UAAAL,EAAK,gBAAgBM,EAAK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A,CAAA;AAAA,UAAA;;;;;;"}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { defineComponent as b, ref as v, computed as y, watch as B, onMounted as H, createElementBlock as
|
|
2
|
-
import { createHistogramFromBins as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as b, ref as v, computed as y, watch as B, onMounted as H, createElementBlock as c, openBlock as m, normalizeClass as g, createCommentVNode as k, createElementVNode as C, toDisplayString as L } from "vue";
|
|
2
|
+
import { createHistogramFromBins as x, createHistogramLog as w, createHistogramLinear as A } from "./histogram.js";
|
|
3
|
+
const V = /* @__PURE__ */ b({
|
|
4
4
|
__name: "PlChartHistogram",
|
|
5
5
|
props: {
|
|
6
6
|
settings: {}
|
|
7
7
|
},
|
|
8
|
-
setup(
|
|
9
|
-
const e =
|
|
10
|
-
const { xAxisLabel: t, yAxisLabel:
|
|
8
|
+
setup(n) {
|
|
9
|
+
const e = n, o = v(), i = y(() => {
|
|
10
|
+
const { xAxisLabel: t, yAxisLabel: a, threshold: u, compact: l, totalWidth: h = 674, totalHeight: p = 252 } = e.settings, s = l ? { top: 0, right: 0, bottom: 0, left: 0 } : { top: 0, right: 30, bottom: 40, left: 85 }, f = h - s.left - s.right, d = p - s.top - s.bottom;
|
|
11
11
|
return {
|
|
12
12
|
width: f,
|
|
13
13
|
height: d,
|
|
14
14
|
margin: s,
|
|
15
|
-
compact:
|
|
15
|
+
compact: l,
|
|
16
16
|
nBins: "nBins" in e.settings ? e.settings.nBins : 10,
|
|
17
17
|
xAxisLabel: t,
|
|
18
|
-
yAxisLabel:
|
|
19
|
-
threshold:
|
|
18
|
+
yAxisLabel: a,
|
|
19
|
+
threshold: u
|
|
20
20
|
};
|
|
21
|
-
}),
|
|
21
|
+
}), r = () => {
|
|
22
22
|
const t = e.settings;
|
|
23
23
|
if (t.type === "log-bins") {
|
|
24
|
-
|
|
24
|
+
x(o.value, i.value, t.bins);
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
t.log ?
|
|
27
|
+
t.log ? w(o.value, i.value, t.numbers) : A(o.value, i.value, t.numbers);
|
|
28
28
|
};
|
|
29
|
-
return B(e,
|
|
30
|
-
class:
|
|
29
|
+
return B(e, r), H(r), (t, a) => (m(), c("div", {
|
|
30
|
+
class: g(t.$style.component)
|
|
31
31
|
}, [
|
|
32
|
-
|
|
32
|
+
n.settings.title && !n.settings.compact ? (m(), c("div", {
|
|
33
33
|
key: 0,
|
|
34
|
-
class:
|
|
35
|
-
}, L(
|
|
34
|
+
class: g(t.$style.title)
|
|
35
|
+
}, L(n.settings.title), 3)) : k("", !0),
|
|
36
36
|
C("div", {
|
|
37
37
|
ref_key: "chart",
|
|
38
38
|
ref: o
|
|
@@ -41,6 +41,6 @@ const _ = /* @__PURE__ */ b({
|
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
export {
|
|
44
|
-
|
|
44
|
+
V as default
|
|
45
45
|
};
|
|
46
46
|
//# sourceMappingURL=PlChartHistogram.vue2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlChartHistogram.vue2.js","sources":["../../../src/components/PlChartHistogram/PlChartHistogram.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed, onMounted, ref, watch } from 'vue';\nimport { createHistogramFromBins, createHistogramLinear, createHistogramLog } from './histogram';\nimport type { ChartOptions, PlChartHistogramSettings } from './types';\n\nconst props = defineProps<{\n settings: PlChartHistogramSettings;\n}>();\n\nconst chart = ref<HTMLElement>();\n\nconst options = computed<ChartOptions>(() => {\n const { xAxisLabel, yAxisLabel, threshold, compact, totalWidth = 674, totalHeight = 252 } = props.settings;\n\n const margin = compact ? { top: 0, right: 0, bottom: 0, left: 0 } : { top: 0, right: 30, bottom: 40, left: 85 };\n const width = totalWidth - margin.left - margin.right;\n const height = totalHeight - margin.top - margin.bottom;\n\n return {\n width,\n height,\n margin,\n compact,\n nBins: 'nBins' in props.settings ? props.settings.nBins : 10,\n xAxisLabel: xAxisLabel,\n yAxisLabel: yAxisLabel,\n threshold: threshold,\n };\n});\n\nconst createHistogram = () => {\n const settings = props.settings;\n\n if (settings.type === 'log-bins') {\n createHistogramFromBins(chart.value!, options.value, settings.bins);\n return;\n }\n\n if (settings.log) {\n createHistogramLog(chart.value!, options.value, settings.numbers);\n } else {\n createHistogramLinear(chart.value!, options.value, settings.numbers);\n }\n};\n\nwatch(props, createHistogram);\n\nonMounted(createHistogram);\n</script>\n\n<template>\n <div :class=\"$style.component\">\n <div v-if=\"settings.title && !settings.compact\" :class=\"$style.title\">{{ settings.title }}</div>\n <div ref=\"chart\" />\n </div>\n</template>\n\n<style module>\n.component {\n display: flex;\n flex-direction: column;\n gap: 24px;\n svg {\n font-family: var(--font-family-base);\n }\n}\n\n.title {\n font-size: 20px;\n font-weight: 500;\n line-height: 24px; /* 120% */\n letter-spacing: -0.2px;\n}\n\n:global(.svg-tooltip) {\n font-family: var(--font-family-base);\n background: rgba(69,77,93,.9);\n border-radius: .1rem;\n color: #fff;\n display: block;\n font-size: 14px;\n max-width: 320px;\n padding: .2rem .4rem;\n position: absolute;\n text-overflow: ellipsis;\n white-space: pre;\n z-index: 300;\n visibility: hidden;\n}\n</style>\n"],"names":["props","__props","chart","ref","options","computed","xAxisLabel","yAxisLabel","threshold","compact","totalWidth","totalHeight","margin","width","height","createHistogram","settings","createHistogramFromBins","createHistogramLog","createHistogramLinear","watch","onMounted"],"mappings":";;;;;;;;AAKA,UAAMA,IAAQC,GAIRC,IAAQC,EAAA,GAERC,IAAUC,EAAuB,MAAM;AAC3C,YAAM,EAAE,YAAAC,GAAY,YAAAC,GAAY,WAAAC,GAAW,SAAAC,GAAS,YAAAC,IAAa,KAAK,aAAAC,IAAc,IAAA,IAAQX,EAAM,UAE5FY,IAASH,IAAU,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,MAAM,EAAE,KAAK,GAAG,OAAO,IAAI,QAAQ,IAAI,MAAM,GAAA,GACrGI,IAAQH,IAAaE,EAAO,OAAOA,EAAO,OAC1CE,IAASH,IAAcC,EAAO,MAAMA,EAAO;AAEjD,aAAO;AAAA,QACL,OAAAC;AAAA,QACA,QAAAC;AAAA,QACA,QAAAF;AAAA,QACA,SAAAH;AAAA,QACA,OAAO,WAAWT,EAAM,WAAWA,EAAM,SAAS,QAAQ;AAAA,QAC1D,YAAAM;AAAA,QACA,YAAAC;AAAA,QACA,WAAAC;AAAA,MAAA;AAAA,IAEJ,CAAC,GAEKO,IAAkB,MAAM;AAC5B,YAAMC,IAAWhB,EAAM;AAEvB,UAAIgB,EAAS,SAAS,YAAY;AAChC,QAAAC,EAAwBf,EAAM,OAAQE,EAAQ,OAAOY,EAAS,IAAI;AAClE;AAAA,MACF;AAEA,MAAIA,EAAS,MACXE,EAAmBhB,EAAM,OAAQE,EAAQ,OAAOY,EAAS,OAAO,IAEhEG,EAAsBjB,EAAM,OAAQE,EAAQ,OAAOY,EAAS,OAAO;AAAA,IAEvE;AAEA,WAAAI,EAAMpB,GAAOe,CAAe,GAE5BM,EAAUN,CAAe
|
|
1
|
+
{"version":3,"file":"PlChartHistogram.vue2.js","sources":["../../../src/components/PlChartHistogram/PlChartHistogram.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed, onMounted, ref, watch } from 'vue';\nimport { createHistogramFromBins, createHistogramLinear, createHistogramLog } from './histogram';\nimport type { ChartOptions, PlChartHistogramSettings } from './types';\n\nconst props = defineProps<{\n settings: PlChartHistogramSettings;\n}>();\n\nconst chart = ref<HTMLElement>();\n\nconst options = computed<ChartOptions>(() => {\n const { xAxisLabel, yAxisLabel, threshold, compact, totalWidth = 674, totalHeight = 252 } = props.settings;\n\n const margin = compact ? { top: 0, right: 0, bottom: 0, left: 0 } : { top: 0, right: 30, bottom: 40, left: 85 };\n const width = totalWidth - margin.left - margin.right;\n const height = totalHeight - margin.top - margin.bottom;\n\n return {\n width,\n height,\n margin,\n compact,\n nBins: 'nBins' in props.settings ? props.settings.nBins : 10,\n xAxisLabel: xAxisLabel,\n yAxisLabel: yAxisLabel,\n threshold: threshold,\n };\n});\n\nconst createHistogram = () => {\n const settings = props.settings;\n\n if (settings.type === 'log-bins') {\n createHistogramFromBins(chart.value!, options.value, settings.bins);\n return;\n }\n\n if (settings.log) {\n createHistogramLog(chart.value!, options.value, settings.numbers);\n } else {\n createHistogramLinear(chart.value!, options.value, settings.numbers);\n }\n};\n\nwatch(props, createHistogram);\n\nonMounted(createHistogram);\n</script>\n\n<template>\n <div :class=\"$style.component\">\n <div v-if=\"settings.title && !settings.compact\" :class=\"$style.title\">{{ settings.title }}</div>\n <div ref=\"chart\" />\n </div>\n</template>\n\n<style module>\n.component {\n display: flex;\n flex-direction: column;\n gap: 24px;\n svg {\n font-family: var(--font-family-base);\n }\n}\n\n.title {\n font-size: 20px;\n font-weight: 500;\n line-height: 24px; /* 120% */\n letter-spacing: -0.2px;\n}\n\n:global(.svg-tooltip) {\n font-family: var(--font-family-base);\n background: rgba(69,77,93,.9);\n border-radius: .1rem;\n color: #fff;\n display: block;\n font-size: 14px;\n max-width: 320px;\n padding: .2rem .4rem;\n position: absolute;\n text-overflow: ellipsis;\n white-space: pre;\n z-index: 300;\n visibility: hidden;\n}\n</style>\n"],"names":["props","__props","chart","ref","options","computed","xAxisLabel","yAxisLabel","threshold","compact","totalWidth","totalHeight","margin","width","height","createHistogram","settings","createHistogramFromBins","createHistogramLog","createHistogramLinear","watch","onMounted","_createElementBlock","_normalizeClass","$style","_toDisplayString","_createElementVNode"],"mappings":";;;;;;;;AAKA,UAAMA,IAAQC,GAIRC,IAAQC,EAAA,GAERC,IAAUC,EAAuB,MAAM;AAC3C,YAAM,EAAE,YAAAC,GAAY,YAAAC,GAAY,WAAAC,GAAW,SAAAC,GAAS,YAAAC,IAAa,KAAK,aAAAC,IAAc,IAAA,IAAQX,EAAM,UAE5FY,IAASH,IAAU,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,MAAM,EAAE,KAAK,GAAG,OAAO,IAAI,QA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