@milaboratories/uikit 2.6.1 → 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 +143 -143
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +14 -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 +5 -3
- 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.map +1 -1
- package/dist/components/PlAccordion/ExpandTransition.vue2.js.map +1 -1
- package/dist/components/PlAccordion/ExpandTransition.vue3.js +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.d.ts +4 -0
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js +112 -106
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js.map +1 -1
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.d.ts +4 -0
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js +100 -94
- 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.d.ts +8 -0
- package/dist/components/PlDropdown/PlDropdown.vue.js +102 -95
- package/dist/components/PlDropdown/PlDropdown.vue.js.map +1 -1
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js +95 -93
- 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.d.ts +4 -0
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js +88 -82
- 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.vue.d.ts +20 -0
- package/dist/components/PlElementList/PlElementList.vue2.js +180 -135
- package/dist/components/PlElementList/PlElementList.vue2.js.map +1 -1
- package/dist/components/PlElementList/PlElementListItem.vue.d.ts +20 -0
- package/dist/components/PlElementList/PlElementListItem.vue2.js +101 -76
- 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 +78 -76
- 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 +62 -60
- 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 +6 -1
- package/dist/components/PlNumberField/PlNumberField.vue.js +66 -60
- 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 +5 -3
- 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 +55 -53
- package/dist/components/PlTextArea/PlTextArea.vue.js.map +1 -1
- package/dist/components/PlTextField/PlTextField.vue.d.ts +4 -0
- package/dist/components/PlTextField/PlTextField.vue.js +66 -60
- 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/composition/filters/metadata.d.ts +205 -0
- package/dist/composition/filters/metadata.js +129 -19
- package/dist/composition/filters/metadata.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.d.ts +7 -1
- package/dist/utils/DoubleContour.vue.js +20 -13
- package/dist/utils/DoubleContour.vue.js.map +1 -1
- package/dist/utils/DoubleContour.vue3.js +7 -0
- package/dist/utils/DoubleContour.vue3.js.map +1 -0
- 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 +5 -5
- package/src/components/PlAutocomplete/PlAutocomplete.vue +6 -1
- package/src/components/PlAutocompleteMulti/PlAutocompleteMulti.vue +6 -1
- package/src/components/PlDropdown/PlDropdown.vue +12 -2
- package/src/components/PlDropdownMulti/PlDropdownMulti.vue +6 -1
- package/src/components/PlElementList/PlElementList.vue +40 -6
- package/src/components/PlElementList/PlElementListItem.vue +64 -47
- package/src/components/PlNumberField/PlNumberField.vue +4 -1
- package/src/components/PlTextField/PlTextField.vue +5 -1
- package/src/composition/filters/metadata.ts +105 -0
- package/src/utils/DoubleContour.vue +68 -2
- package/dist/utils/DoubleContour.vue2.js +0 -7
- package/dist/utils/DoubleContour.vue2.js.map +0 -1
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(
|
|
2
|
-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(`.ui-text-area{--contour-color: var(--txt-01);--label-color: var(--txt-01);--contour-border-width: 1px;--contour-box-shadow: none;--label-offset-left-x: 8px;--label-offset-right-x: 8px;--prefix-color: var(--color-placeholder);width:100%;min-height:var(--control-height);position:relative;border-radius:var(--border-radius-control);display:flex;flex-direction:row;align-items:center;outline:none}.ui-text-area__envelope{font-family:var(--font-family-base)}.ui-text-area textarea{min-height:calc(var(--control-height) - 2px);width:100%;padding:10px 12px;border:none;font-size:inherit;background-color:transparent;color:var(--txt-01);caret-color:var(--border-color-focus);cursor:inherit;resize:none;--thumb-color: var(--ic-02);overflow-y:auto}.ui-text-area textarea::-webkit-scrollbar{width:var(--scrollbar-width, 6px);height:5px;background-color:transparent;display:block}.ui-text-area textarea::-webkit-scrollbar-thumb{background:var(--thumb-color);border-radius:5px}.ui-text-area textarea::-webkit-scrollbar-thumb:hover{--thumb-color: var(--border-color-focus)}.ui-text-area textarea:focus{outline:none}.ui-text-area textarea::placeholder{color:var(--color-placeholder)}.ui-text-area label{display:flex;align-items:center;gap:4px;position:absolute;top:0;transform:translateY(-60%);left:var(--label-offset-left-x);padding:0 4px;max-width:calc(100% - 16px);overflow:hidden;white-space:pre;text-overflow:ellipsis;cursor:inherit;color:var(--label-color);font-size:12px;font-weight:500;border-bottom-right-radius:4px;border-bottom-left-radius:4px;background:var(--bg-elevated-01)}.ui-text-area label>span{overflow:hidden;white-space:pre;text-overflow:ellipsis}.ui-text-area__contour{position:absolute;top:0;left:0;right:0;bottom:0;border-radius:var(--border-radius-control);border-width:var(--contour-border-width);border-color:var(--contour-color);border-style:solid;box-shadow:var(--contour-box-shadow);z-index:0;pointer-events:none}.ui-text-area__append{display:flex;flex-direction:row;align-items:center;gap:4px}.ui-text-area__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}.ui-text-area__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}.ui-text-area:hover{--contour-color: var(--control-hover-color)}.ui-text-area:focus-within:not(.error){--label-color: var(--txt-focus);--contour-color: var(--border-color-focus);--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--border-color-focus-shadow)}.ui-text-area:focus-within.error{--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--color-error-shadow)}.ui-text-area.dashed .ui-text-area__contour{border-style:dashed}.ui-text-area.nonEmpty{--prefix-color: var(--txt-01)}.ui-text-area.error{--contour-color: var(--txt-error)}.ui-text-area.disabled{--contour-color: var(--color-dis-01);cursor:not-allowed;pointer-events:none}.ui-text-area.disabled *{color:var(--contour-color)}
|
|
2
|
+
.double-contour.top>div{border-bottom-right-radius:0;border-bottom-left-radius:0}.double-contour.bottom>div{border-top-right-radius:0;border-top-left-radius:0}.double-contour.left>div{border-top-right-radius:0;border-bottom-right-radius:0}.double-contour.right>div{border-top-left-radius:0;border-bottom-left-radius:0}.double-contour.top-left>div{border-top-right-radius:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.double-contour.top-right>div{border-bottom-right-radius:0;border-top-left-radius:0;border-top-right-radius:0}.double-contour.bottom-left>div{border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:0}.double-contour.bottom-right>div{border-top-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0}.double-contour.middle>div{border-radius:0}`)),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
3
|
+
import { defineComponent as E, useSlots as S, ref as v, computed as a, onMounted as $, createElementBlock as s, openBlock as o, createElementVNode as n, createCommentVNode as i, normalizeClass as C, withDirectives as N, createVNode as q, createBlock as g, unref as d, toDisplayString as c, withCtx as D, renderSlot as b, vModelText as M } from "vue";
|
|
3
4
|
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
5
|
+
import j from "../PlTooltip/PlTooltip.vue.js";
|
|
6
|
+
import H from "../../utils/DoubleContour.vue.js";
|
|
7
|
+
|
|
8
|
+
import { useLabelNotch as P } from "../../utils/useLabelNotch.js";
|
|
9
|
+
import { useValidation as T } from "../../utils/useValidation.js";
|
|
10
|
+
import { getErrorMessage as z } from "../../helpers/error.js";
|
|
11
|
+
import A from "../PlSvg/PlSvg.vue.js";
|
|
12
|
+
import I from "../../assets/images/required.svg.js";
|
|
13
|
+
const L = { class: "ui-text-area__envelope" }, R = {
|
|
12
14
|
key: 0,
|
|
13
15
|
ref: "label"
|
|
14
|
-
},
|
|
16
|
+
}, U = ["readonly", "rows", "disabled", "placeholder"], F = { class: "ui-text-area__append" }, G = {
|
|
15
17
|
key: 0,
|
|
16
18
|
class: "ui-text-area__error"
|
|
17
19
|
}, J = {
|
|
@@ -19,7 +21,7 @@ const R = { class: "ui-text-area__envelope" }, U = {
|
|
|
19
21
|
class: "ui-text-area__helper"
|
|
20
22
|
}, K = {
|
|
21
23
|
name: "PlTextArea"
|
|
22
|
-
},
|
|
24
|
+
}, le = /* @__PURE__ */ E({
|
|
23
25
|
...K,
|
|
24
26
|
props: {
|
|
25
27
|
modelValue: {},
|
|
@@ -36,73 +38,73 @@ const R = { class: "ui-text-area__envelope" }, U = {
|
|
|
36
38
|
rules: {}
|
|
37
39
|
},
|
|
38
40
|
emits: ["update:modelValue"],
|
|
39
|
-
setup(
|
|
40
|
-
const
|
|
41
|
+
setup(t, { emit: k }) {
|
|
42
|
+
const x = S(), _ = k, r = t, m = v(), p = v(), u = a({
|
|
41
43
|
get() {
|
|
42
44
|
return r.modelValue ?? "";
|
|
43
45
|
},
|
|
44
46
|
set(e) {
|
|
45
|
-
|
|
47
|
+
_("update:modelValue", e);
|
|
46
48
|
}
|
|
47
|
-
}),
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
const e = [],
|
|
51
|
-
return
|
|
52
|
-
}),
|
|
49
|
+
}), V = a(() => !!r.modelValue), w = T(u, r.rules || []);
|
|
50
|
+
P(m);
|
|
51
|
+
const h = a(() => {
|
|
52
|
+
const e = [], l = z(r.error);
|
|
53
|
+
return l && e.push(l), e.push(...w.value.errors), e;
|
|
54
|
+
}), f = a(() => h.value.length > 0), y = () => {
|
|
53
55
|
if (!r.autogrow)
|
|
54
56
|
return;
|
|
55
|
-
const e =
|
|
57
|
+
const e = p.value;
|
|
56
58
|
e && (e.style.height = "auto", e.style.height = `${e.scrollHeight}px`);
|
|
57
59
|
};
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
}), (e,
|
|
61
|
-
|
|
60
|
+
return $(() => {
|
|
61
|
+
y();
|
|
62
|
+
}), (e, l) => (o(), s("div", L, [
|
|
63
|
+
n("div", {
|
|
62
64
|
ref_key: "root",
|
|
63
|
-
ref:
|
|
64
|
-
class:
|
|
65
|
+
ref: m,
|
|
66
|
+
class: C(["ui-text-area", { error: f.value, disabled: t.disabled, dashed: t.dashed, nonEmpty: V.value }])
|
|
65
67
|
}, [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
t.label ? (o(), s("label", R, [
|
|
69
|
+
t.required ? (o(), g(d(A), {
|
|
68
70
|
key: 0,
|
|
69
|
-
uri:
|
|
70
|
-
}, null, 8, ["uri"])) :
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
uri: d(I)
|
|
72
|
+
}, null, 8, ["uri"])) : i("", !0),
|
|
73
|
+
n("span", null, c(t.label), 1),
|
|
74
|
+
d(x).tooltip ? (o(), g(d(j), {
|
|
73
75
|
key: 1,
|
|
74
76
|
class: "info",
|
|
75
77
|
position: "top"
|
|
76
78
|
}, {
|
|
77
|
-
tooltip:
|
|
78
|
-
|
|
79
|
+
tooltip: D(() => [
|
|
80
|
+
b(e.$slots, "tooltip")
|
|
79
81
|
]),
|
|
80
82
|
_: 3
|
|
81
|
-
})) :
|
|
82
|
-
], 512)) :
|
|
83
|
-
|
|
83
|
+
})) : i("", !0)
|
|
84
|
+
], 512)) : i("", !0),
|
|
85
|
+
N(n("textarea", {
|
|
84
86
|
ref_key: "input",
|
|
85
|
-
ref:
|
|
86
|
-
"onUpdate:modelValue":
|
|
87
|
-
readonly:
|
|
88
|
-
rows:
|
|
89
|
-
disabled:
|
|
90
|
-
placeholder:
|
|
87
|
+
ref: p,
|
|
88
|
+
"onUpdate:modelValue": l[0] || (l[0] = (B) => u.value = B),
|
|
89
|
+
readonly: t.readonly,
|
|
90
|
+
rows: t.rows,
|
|
91
|
+
disabled: t.disabled,
|
|
92
|
+
placeholder: t.placeholder ?? "...",
|
|
91
93
|
spellcheck: "false",
|
|
92
|
-
onInput:
|
|
93
|
-
}, null, 40,
|
|
94
|
-
[
|
|
94
|
+
onInput: y
|
|
95
|
+
}, null, 40, U), [
|
|
96
|
+
[M, u.value]
|
|
95
97
|
]),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
n("div", F, [
|
|
99
|
+
b(e.$slots, "append")
|
|
98
100
|
]),
|
|
99
|
-
q(
|
|
101
|
+
q(H, { class: "ui-text-area__contour" })
|
|
100
102
|
], 2),
|
|
101
|
-
|
|
103
|
+
f.value ? (o(), s("div", G, c(h.value.join(" ")), 1)) : t.helper ? (o(), s("div", J, c(t.helper), 1)) : i("", !0)
|
|
102
104
|
]));
|
|
103
105
|
}
|
|
104
106
|
});
|
|
105
107
|
export {
|
|
106
|
-
|
|
108
|
+
le as default
|
|
107
109
|
};
|
|
108
110
|
//# sourceMappingURL=PlTextArea.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlTextArea.vue.js","sources":["../../../src/components/PlTextArea/PlTextArea.vue"],"sourcesContent":["<script lang=\"ts\">\n/** Component for multi-line string data manipulation */\nexport default {\n name: 'PlTextArea',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-textarea.scss';\nimport { computed, onMounted, ref, useSlots } from 'vue';\nimport { PlTooltip } from '../PlTooltip';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport { useValidation } from '../../utils/useValidation';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport { PlSvg } from '../PlSvg';\nimport SvgRequired from '../../assets/images/required.svg?raw';\n\nconst slots = useSlots();\n\nconst emit = defineEmits<{\n /**\n * Emitted when the model value is updated.\n */\n (e: 'update:modelValue', value: string): void;\n}>();\n\nconst props = defineProps<{\n /**\n * The current value of the texarea.\n */\n modelValue?: string;\n /**\n * The label to display above the texarea.\n */\n label?: string;\n /**\n * If `true`, the textarea is marked as required.\n */\n required?: boolean;\n /**\n * An error message to display below the textarea.\n */\n error?: unknown;\n /**\n * A helper text to display below the textarea when there are no errors.\n */\n helper?: string;\n /**\n * A placeholder text to display inside the textarea when it is empty.\n */\n placeholder?: string;\n /**\n * If `true`, the textarea is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * If `true`, the textarea is in a read-only state and cannot be edited, but it can still be focused and text can be selected.\n */\n readonly?: boolean;\n /**\n * If `true`, applies a dashed border style to the textarea, likely used for stylistic purposes or to indicate a certain state.\n */\n dashed?: boolean;\n /**\n * The number of visible text lines for the textarea, which controls the height of the textarea.\n */\n rows?: number;\n /**\n * If `true`, the textarea automatically adjusts its height to fit the content as the user types.\n */\n autogrow?: boolean;\n /**\n * An array of validation rules that are applied to the textarea input. Each rule is a function that receives the input value and returns `true` for valid input or an error message string for invalid input.\n */\n rules?: ((v: string) => boolean | string)[];\n}>();\n\nconst root = ref<HTMLInputElement>();\nconst input = ref<HTMLTextAreaElement>();\n\nconst value = computed({\n get() {\n return props.modelValue ?? '';\n },\n set(v) {\n emit('update:modelValue', v);\n },\n});\n\nconst nonEmpty = computed(() => !!props.modelValue);\nconst validationData = useValidation(value, props.rules || []);\n\nuseLabelNotch(root);\n\nconst displayErrors = computed(() => {\n const errors: string[] = [];\n const propsError = getErrorMessage(props.error);\n\n if (propsError) {\n errors.push(propsError);\n }\n\n errors.push(...validationData.value.errors);\n\n return errors;\n});\n\nconst hasErrors = computed(() => displayErrors.value.length > 0);\n\nconst adjustHeight = () => {\n if (!props.autogrow) {\n return;\n }\n const el = input.value;\n if (el) {\n el.style.height = 'auto'; // it works, do not delete it\n el.style.height = `${el.scrollHeight}px`; // Set height based on scrollHeight\n }\n};\n\nonMounted(() => {\n adjustHeight();\n});\n</script>\n\n<template>\n <div class=\"ui-text-area__envelope\">\n <div ref=\"root\" class=\"ui-text-area\" :class=\"{ error: hasErrors, disabled, dashed, nonEmpty }\">\n <label v-if=\"label\" ref=\"label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" />\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 <textarea\n ref=\"input\"\n v-model=\"value\"\n :readonly=\"readonly\"\n :rows=\"rows\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder ?? '...'\"\n spellcheck=\"false\"\n @input=\"adjustHeight\"\n />\n <div class=\"ui-text-area__append\">\n <slot name=\"append\" />\n </div>\n <DoubleContour class=\"ui-text-area__contour\" />\n </div>\n <div v-if=\"hasErrors\" class=\"ui-text-area__error\">\n {{ displayErrors.join(' ') }}\n </div>\n <div v-else-if=\"helper\" class=\"ui-text-area__helper\">{{ helper }}</div>\n </div>\n</template>\n"],"names":["__default__","slots","useSlots","emit","__emit","props","__props","root","ref","input","value","computed","v","nonEmpty","validationData","useValidation","useLabelNotch","displayErrors","errors","propsError","getErrorMessage","hasErrors","adjustHeight","el","onMounted"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PlTextArea.vue.js","sources":["../../../src/components/PlTextArea/PlTextArea.vue"],"sourcesContent":["<script lang=\"ts\">\n/** Component for multi-line string data manipulation */\nexport default {\n name: 'PlTextArea',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-textarea.scss';\nimport { computed, onMounted, ref, useSlots } from 'vue';\nimport { PlTooltip } from '../PlTooltip';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport { useValidation } from '../../utils/useValidation';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport { PlSvg } from '../PlSvg';\nimport SvgRequired from '../../assets/images/required.svg?raw';\n\nconst slots = useSlots();\n\nconst emit = defineEmits<{\n /**\n * Emitted when the model value is updated.\n */\n (e: 'update:modelValue', value: string): void;\n}>();\n\nconst props = defineProps<{\n /**\n * The current value of the texarea.\n */\n modelValue?: string;\n /**\n * The label to display above the texarea.\n */\n label?: string;\n /**\n * If `true`, the textarea is marked as required.\n */\n required?: boolean;\n /**\n * An error message to display below the textarea.\n */\n error?: unknown;\n /**\n * A helper text to display below the textarea when there are no errors.\n */\n helper?: string;\n /**\n * A placeholder text to display inside the textarea when it is empty.\n */\n placeholder?: string;\n /**\n * If `true`, the textarea is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * If `true`, the textarea is in a read-only state and cannot be edited, but it can still be focused and text can be selected.\n */\n readonly?: boolean;\n /**\n * If `true`, applies a dashed border style to the textarea, likely used for stylistic purposes or to indicate a certain state.\n */\n dashed?: boolean;\n /**\n * The number of visible text lines for the textarea, which controls the height of the textarea.\n */\n rows?: number;\n /**\n * If `true`, the textarea automatically adjusts its height to fit the content as the user types.\n */\n autogrow?: boolean;\n /**\n * An array of validation rules that are applied to the textarea input. Each rule is a function that receives the input value and returns `true` for valid input or an error message string for invalid input.\n */\n rules?: ((v: string) => boolean | string)[];\n}>();\n\nconst root = ref<HTMLInputElement>();\nconst input = ref<HTMLTextAreaElement>();\n\nconst value = computed({\n get() {\n return props.modelValue ?? '';\n },\n set(v) {\n emit('update:modelValue', v);\n },\n});\n\nconst nonEmpty = computed(() => !!props.modelValue);\nconst validationData = useValidation(value, props.rules || []);\n\nuseLabelNotch(root);\n\nconst displayErrors = computed(() => {\n const errors: string[] = [];\n const propsError = getErrorMessage(props.error);\n\n if (propsError) {\n errors.push(propsError);\n }\n\n errors.push(...validationData.value.errors);\n\n return errors;\n});\n\nconst hasErrors = computed(() => displayErrors.value.length > 0);\n\nconst adjustHeight = () => {\n if (!props.autogrow) {\n return;\n }\n const el = input.value;\n if (el) {\n el.style.height = 'auto'; // it works, do not delete it\n el.style.height = `${el.scrollHeight}px`; // Set height based on scrollHeight\n }\n};\n\nonMounted(() => {\n adjustHeight();\n});\n</script>\n\n<template>\n <div class=\"ui-text-area__envelope\">\n <div ref=\"root\" class=\"ui-text-area\" :class=\"{ error: hasErrors, disabled, dashed, nonEmpty }\">\n <label v-if=\"label\" ref=\"label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" />\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 <textarea\n ref=\"input\"\n v-model=\"value\"\n :readonly=\"readonly\"\n :rows=\"rows\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder ?? '...'\"\n spellcheck=\"false\"\n @input=\"adjustHeight\"\n />\n <div class=\"ui-text-area__append\">\n <slot name=\"append\" />\n </div>\n <DoubleContour class=\"ui-text-area__contour\" />\n </div>\n <div v-if=\"hasErrors\" class=\"ui-text-area__error\">\n {{ displayErrors.join(' ') }}\n </div>\n <div v-else-if=\"helper\" class=\"ui-text-area__helper\">{{ helper }}</div>\n </div>\n</template>\n"],"names":["__default__","slots","useSlots","emit","__emit","props","__props","root","ref","input","value","computed","v","nonEmpty","validationData","useValidation","useLabelNotch","displayErrors","errors","propsError","getErrorMessage","hasErrors","adjustHeight","el","onMounted","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_normalizeClass","_hoisted_2","_createBlock","_unref","PlSvg","SvgRequired","PlTooltip","_renderSlot","_ctx","$event","_hoisted_4","_createVNode","DoubleContour","_hoisted_5","_toDisplayString","_hoisted_6"],"mappings":";;;;;;;;;;;;;;;;;;;GAEAA,IAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;;;;;;;;AAcA,UAAMC,IAAQC,EAAA,GAERC,IAAOC,GAOPC,IAAQC,GAmDRC,IAAOC,EAAA,GACPC,IAAQD,EAAA,GAERE,IAAQC,EAAS;AAAA,MACrB,MAAM;AACJ,eAAON,EAAM,cAAc;AAAA,MAC7B;AAAA,MACA,IAAIO,GAAG;AACL,QAAAT,EAAK,qBAAqBS,CAAC;AAAA,MAC7B;AAAA,IAAA,CACD,GAEKC,IAAWF,EAAS,MAAM,CAAC,CAACN,EAAM,UAAU,GAC5CS,IAAiBC,EAAcL,GAAOL,EAAM,SAAS,CAAA,CAAE;AAE7D,IAAAW,EAAcT,CAAI;AAElB,UAAMU,IAAgBN,EAAS,MAAM;AACnC,YAAMO,IAAmB,CAAA,GACnBC,IAAaC,EAAgBf,EAAM,KAAK;AAE9C,aAAIc,KACFD,EAAO,KAAKC,CAAU,GAGxBD,EAAO,KAAK,GAAGJ,EAAe,MAAM,MAAM,GAEnCI;AAAA,IACT,CAAC,GAEKG,IAAYV,EAAS,MAAMM,EAAc,MAAM,SAAS,CAAC,GAEzDK,IAAe,MAAM;AACzB,UAAI,CAACjB,EAAM;AACT;AAEF,YAAMkB,IAAKd,EAAM;AACjB,MAAIc,MACFA,EAAG,MAAM,SAAS,QAClBA,EAAG,MAAM,SAAS,GAAGA,EAAG,YAAY;AAAA,IAExC;AAEA,WAAAC,EAAU,MAAM;AACd,MAAAF,EAAA;AAAA,IACF,CAAC,cAICG,EAAA,GAAAC,EA8BM,OA9BNC,GA8BM;AAAA,MA7BJC,EAwBM,OAAA;AAAA,iBAxBG;AAAA,QAAJ,KAAIrB;AAAA,QAAO,OAAKsB,EAAA,CAAC,gBAAc,EAAA,OAAkBR,EAAA,iBAAWf,EAAA,UAAQ,QAAEA,EAAA,QAAM,UAAEO,EAAA,OAAQ,CAAA;AAAA,MAAA;QAC5EP,EAAA,SAAbmB,EAAA,GAAAC,EAQQ,SARRI,GAQQ;AAAA,UAPOxB,EAAA,iBAAbyB,EAA4CC,EAAAC,CAAA,GAAA;AAAA;YAApB,KAAKD,EAAAE,CAAA;AAAA,UAAA;UAC7BN,EAAwB,gBAAftB,EAAA,KAAK,GAAA,CAAA;AAAA,UACG0B,EAAA/B,CAAA,EAAM,gBAAvB8B,EAIYC,EAAAG,CAAA,GAAA;AAAA;YAJoB,OAAM;AAAA,YAAO,UAAS;AAAA,UAAA;YACzC,WACT,MAAuB;AAAA,cAAvBC,EAAuBC,EAAA,QAAA,SAAA;AAAA,YAAA;;;;UAI7BT,EASE,YAAA;AAAA,mBARI;AAAA,UAAJ,KAAInB;AAAA,wDACKC,EAAK,QAAA4B;AAAA,UACb,UAAUhC,EAAA;AAAA,UACV,MAAMA,EAAA;AAAA,UACN,UAAUA,EAAA;AAAA,UACV,aAAaA,EAAA,eAAW;AAAA,UACzB,YAAW;AAAA,UACV,SAAOgB;AAAA,QAAA;cANCZ,EAAA,KAAK;AAAA,QAAA;QAQhBkB,EAEM,OAFNW,GAEM;AAAA,UADJH,EAAsBC,EAAA,QAAA,QAAA;AAAA,QAAA;QAExBG,EAA+CC,GAAA,EAAhC,OAAM,yBAAuB;AAAA,MAAA;MAEnCpB,EAAA,SAAXI,KAAAC,EAEM,OAFNgB,GAEMC,EADD1B,EAAA,MAAc,KAAI,GAAA,CAAA,GAAA,CAAA,KAEPX,EAAA,eAAhBoB,EAAuE,OAAvEkB,GAAuED,EAAfrC,EAAA,MAAM,GAAA,CAAA;;;;"}
|
|
@@ -58,6 +58,10 @@ declare const _default: <M, E = string, C = E>(__VLS_props: NonNullable<Awaited<
|
|
|
58
58
|
* The string specifies whether the field should be a password or not, value could be "password" or undefined.
|
|
59
59
|
*/
|
|
60
60
|
type?: "password";
|
|
61
|
+
/**
|
|
62
|
+
* Makes some of corners not rounded
|
|
63
|
+
* */
|
|
64
|
+
groupPosition?: "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "middle";
|
|
61
65
|
}) & Partial<{}>> & import('vue').PublicProps;
|
|
62
66
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
63
67
|
attrs: any;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(
|
|
2
|
-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(`.double-contour.top>div{border-bottom-right-radius:0;border-bottom-left-radius:0}.double-contour.bottom>div{border-top-right-radius:0;border-top-left-radius:0}.double-contour.left>div{border-top-right-radius:0;border-bottom-right-radius:0}.double-contour.right>div{border-top-left-radius:0;border-bottom-left-radius:0}.double-contour.top-left>div{border-top-right-radius:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.double-contour.top-right>div{border-bottom-right-radius:0;border-top-left-radius:0;border-top-right-radius:0}.double-contour.bottom-left>div{border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:0}.double-contour.bottom-right>div{border-top-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0}.double-contour.middle>div{border-radius:0}
|
|
2
|
+
.pl-text-field{--pl-text-field-text-color: var(--txt-01);--contour-color: var(--txt-01);--label-color: var(--txt-01);--contour-border-width: 1px;--contour-box-shadow: none;--label-offset-left-x: 8px;--label-offset-right-x: 8px;--prefix-color: var(--color-placeholder);--show-clearable: none;width:100%;min-width:160px;min-height:var(--control-height);position:relative;border-radius:var(--border-radius-control);display:flex;flex-direction:row;align-items:center;outline:none}.pl-text-field__envelope{font-family:var(--font-family-base)}.pl-text-field input{font-family:var(--font-family-base);font-weight:500;min-height:calc(var(--control-height) - 2px);line-height:20px;width:100%;padding:0 12px;border:none;font-size:inherit;background-color:transparent;color:var(--pl-text-field-text-color);caret-color:var(--border-color-focus);cursor:inherit}.pl-text-field input:focus{outline:none}.pl-text-field input::placeholder{color:var(--color-placeholder)}.pl-text-field label{display:flex;align-items:center;gap:4px;position:absolute;top:0;transform:translateY(-60%);left:var(--label-offset-left-x);padding:0 4px;max-width:calc(100% - 16px);overflow:hidden;white-space:pre;text-overflow:ellipsis;cursor:inherit;color:var(--label-color);font-size:12px;font-weight:500;border-bottom-right-radius:4px;border-bottom-left-radius:4px;background:var(--bg-elevated-01)}.pl-text-field label>span{overflow:hidden;white-space:pre;text-overflow:ellipsis}.pl-text-field__contour{position:absolute;top:0;left:0;right:0;bottom:0;border-radius:var(--border-radius-control);border-width:var(--contour-border-width);border-color:var(--contour-color);border-style:solid;box-shadow:var(--contour-box-shadow);z-index:0;pointer-events:none}.pl-text-field__prefix{padding-left:12px;white-space:nowrap;margin-right:-12px;color:var(--prefix-color)}.pl-text-field__append{padding-right:12px;display:flex;flex-direction:row;align-items:center;gap:4px;cursor:text}.pl-text-field__append .icon-16{cursor:pointer}.pl-text-field__append .mask-16{--icon-color: var(--control-mask-fill);cursor:pointer}.pl-text-field__clearable{display:var(--show-clearable)!important;--icon-color: var(--ic-02) !important}.pl-text-field__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-text-field__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-text-field:hover{--contour-color: var(--control-hover-color);--show-clearable: inline-block}.pl-text-field:focus-within{--show-clearable: inline-block}.pl-text-field:focus-within:not(.error){--label-color: var(--txt-focus);--contour-color: var(--border-color-focus);--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--border-color-focus-shadow)}.pl-text-field:focus-within.error{--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--color-error-shadow)}.pl-text-field.dashed .pl-text-field__contour{border-style:dashed}.pl-text-field.nonEmpty{--prefix-color: var(--txt-01)}.pl-text-field.error{--contour-color: var(--txt-error);--label-color: var(--txt-error)}.pl-text-field.disabled{--contour-color: var(--color-dis-01);--label-color: var(--dis-01);--pl-text-field-text-color: var(--dis-01);--mask-icon-bg-color: var(--dis-01);cursor:not-allowed}`)),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
3
|
+
import { defineComponent as I, mergeModels as N, useSlots as $, useModel as O, ref as h, reactive as T, computed as i, createElementBlock as d, openBlock as a, createElementVNode as p, createCommentVNode as n, normalizeClass as j, withDirectives as z, createVNode as L, createBlock as f, unref as c, toDisplayString as m, withCtx as U, renderSlot as E, vModelDynamic as A, withModifiers as V } from "vue";
|
|
3
4
|
import G from "../../assets/images/required.svg.js";
|
|
4
5
|
import { getErrorMessage as H } from "../../helpers/error.js";
|
|
5
6
|
import J from "../../utils/DoubleContour.vue.js";
|
|
7
|
+
|
|
6
8
|
import { useLabelNotch as K } from "../../utils/useLabelNotch.js";
|
|
7
9
|
import { useValidation as Q } from "../../utils/useValidation.js";
|
|
8
10
|
import W from "../PlIcon16/PlIcon16.vue.js";
|
|
@@ -13,10 +15,10 @@ import Z from "../PlTooltip/PlTooltip.vue.js";
|
|
|
13
15
|
const ee = { class: "pl-text-field__envelope" }, le = {
|
|
14
16
|
key: 0,
|
|
15
17
|
ref: "label"
|
|
16
|
-
},
|
|
18
|
+
}, te = {
|
|
17
19
|
key: 1,
|
|
18
20
|
class: "pl-text-field__prefix"
|
|
19
|
-
},
|
|
21
|
+
}, oe = ["disabled", "placeholder", "type"], re = {
|
|
20
22
|
key: 0,
|
|
21
23
|
class: "pl-text-field__error"
|
|
22
24
|
}, ae = {
|
|
@@ -24,7 +26,7 @@ const ee = { class: "pl-text-field__envelope" }, le = {
|
|
|
24
26
|
class: "pl-text-field__helper"
|
|
25
27
|
}, se = {
|
|
26
28
|
name: "PlTextField"
|
|
27
|
-
},
|
|
29
|
+
}, ke = /* @__PURE__ */ I({
|
|
28
30
|
...se,
|
|
29
31
|
props: /* @__PURE__ */ N({
|
|
30
32
|
label: {},
|
|
@@ -38,7 +40,8 @@ const ee = { class: "pl-text-field__envelope" }, le = {
|
|
|
38
40
|
dashed: { type: Boolean },
|
|
39
41
|
prefix: {},
|
|
40
42
|
rules: {},
|
|
41
|
-
type: {}
|
|
43
|
+
type: {},
|
|
44
|
+
groupPosition: {}
|
|
42
45
|
}, {
|
|
43
46
|
modelValue: {
|
|
44
47
|
required: !0
|
|
@@ -46,103 +49,106 @@ const ee = { class: "pl-text-field__envelope" }, le = {
|
|
|
46
49
|
modelModifiers: {}
|
|
47
50
|
}),
|
|
48
51
|
emits: ["update:modelValue"],
|
|
49
|
-
setup(
|
|
50
|
-
const
|
|
52
|
+
setup(l) {
|
|
53
|
+
const _ = $(), o = O(l, "modelValue"), e = l, y = h(void 0), b = h(), u = h(!1), s = T({
|
|
51
54
|
cached: void 0
|
|
52
|
-
}), v =
|
|
55
|
+
}), v = i({
|
|
53
56
|
get() {
|
|
54
|
-
return
|
|
57
|
+
return s.cached ? s.cached.value : o.value === void 0 || o.value === null ? "" : String(o.value);
|
|
55
58
|
},
|
|
56
|
-
set(
|
|
57
|
-
if (
|
|
59
|
+
set(t) {
|
|
60
|
+
if (s.cached = void 0, e.parse)
|
|
58
61
|
try {
|
|
59
|
-
o.value =
|
|
62
|
+
o.value = e.parse(t);
|
|
60
63
|
} catch (r) {
|
|
61
|
-
|
|
64
|
+
s.cached = {
|
|
62
65
|
error: r instanceof Error ? r.message : String(r),
|
|
63
|
-
value:
|
|
66
|
+
value: t
|
|
64
67
|
};
|
|
65
68
|
}
|
|
66
69
|
else
|
|
67
|
-
o.value =
|
|
70
|
+
o.value = t;
|
|
68
71
|
}
|
|
69
|
-
}),
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
const
|
|
73
|
-
return r &&
|
|
74
|
-
}),
|
|
75
|
-
|
|
72
|
+
}), C = i(() => e.type && e.type === "password" ? u.value ? "text" : e.type : "text"), M = i(() => u.value ? "view-show" : "view-hide"), P = () => {
|
|
73
|
+
e.clearable && (s.cached = void 0, o.value = e.clearable === !0 ? "" : e.clearable());
|
|
74
|
+
}, k = Q(v, e.rules || []), S = i(() => e.clearable ? e.clearable === !0 ? o.value === "" : o.value === e.clearable() : o.value === ""), g = i(() => !S.value), x = i(() => {
|
|
75
|
+
const t = [], r = H(e.error);
|
|
76
|
+
return r && t.push(r), s.cached && t.push(s.cached.error), k.value.isValid || t.push(...k.value.errors), t;
|
|
77
|
+
}), w = i(() => x.value.length > 0), B = i(() => e.clearable && g.value && e.type !== "password" && !e.disabled), F = () => u.value = !u.value, R = () => {
|
|
78
|
+
s.cached = void 0;
|
|
76
79
|
}, q = () => {
|
|
77
|
-
var
|
|
78
|
-
return (
|
|
80
|
+
var t;
|
|
81
|
+
return (t = b.value) == null ? void 0 : t.focus();
|
|
79
82
|
};
|
|
80
|
-
return K(y), (
|
|
81
|
-
|
|
83
|
+
return K(y), (t, r) => (a(), d("div", ee, [
|
|
84
|
+
p("div", {
|
|
82
85
|
ref_key: "rootRef",
|
|
83
86
|
ref: y,
|
|
84
87
|
class: j(["pl-text-field", {
|
|
85
|
-
error:
|
|
86
|
-
disabled:
|
|
87
|
-
dashed:
|
|
88
|
-
nonEmpty:
|
|
88
|
+
error: w.value,
|
|
89
|
+
disabled: l.disabled,
|
|
90
|
+
dashed: l.dashed,
|
|
91
|
+
nonEmpty: g.value
|
|
89
92
|
}])
|
|
90
93
|
}, [
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
l.label ? (a(), d("label", le, [
|
|
95
|
+
l.required ? (a(), f(c(Y), {
|
|
93
96
|
key: 0,
|
|
94
|
-
uri:
|
|
95
|
-
}, null, 8, ["uri"])) :
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
uri: c(G)
|
|
98
|
+
}, null, 8, ["uri"])) : n("", !0),
|
|
99
|
+
p("span", null, m(l.label), 1),
|
|
100
|
+
c(_).tooltip ? (a(), f(c(Z), {
|
|
98
101
|
key: 1,
|
|
99
102
|
class: "info",
|
|
100
103
|
position: "top"
|
|
101
104
|
}, {
|
|
102
105
|
tooltip: U(() => [
|
|
103
|
-
E(
|
|
106
|
+
E(t.$slots, "tooltip")
|
|
104
107
|
]),
|
|
105
108
|
_: 3
|
|
106
|
-
})) :
|
|
107
|
-
], 512)) :
|
|
108
|
-
|
|
109
|
-
z(
|
|
109
|
+
})) : n("", !0)
|
|
110
|
+
], 512)) : n("", !0),
|
|
111
|
+
l.prefix ? (a(), d("div", te, m(l.prefix), 1)) : n("", !0),
|
|
112
|
+
z(p("input", {
|
|
110
113
|
ref_key: "inputRef",
|
|
111
114
|
ref: b,
|
|
112
|
-
"onUpdate:modelValue": r[0] || (r[0] = (
|
|
113
|
-
disabled:
|
|
114
|
-
placeholder:
|
|
115
|
-
type:
|
|
115
|
+
"onUpdate:modelValue": r[0] || (r[0] = (D) => v.value = D),
|
|
116
|
+
disabled: l.disabled,
|
|
117
|
+
placeholder: l.placeholder || "...",
|
|
118
|
+
type: C.value,
|
|
116
119
|
spellcheck: "false",
|
|
117
|
-
onFocusout:
|
|
118
|
-
}, null, 40,
|
|
120
|
+
onFocusout: R
|
|
121
|
+
}, null, 40, oe), [
|
|
119
122
|
[A, v.value]
|
|
120
123
|
]),
|
|
121
|
-
|
|
124
|
+
p("div", {
|
|
122
125
|
class: "pl-text-field__append",
|
|
123
126
|
onClick: q
|
|
124
127
|
}, [
|
|
125
|
-
|
|
128
|
+
B.value ? (a(), f(c(W), {
|
|
126
129
|
key: 0,
|
|
127
130
|
class: "pl-text-field__clearable",
|
|
128
131
|
name: "delete-clear",
|
|
129
|
-
onClick: V(
|
|
130
|
-
})) :
|
|
131
|
-
|
|
132
|
+
onClick: V(P, ["stop"])
|
|
133
|
+
})) : n("", !0),
|
|
134
|
+
l.type === "password" ? (a(), f(c(X), {
|
|
132
135
|
key: 1,
|
|
133
|
-
name:
|
|
136
|
+
name: M.value,
|
|
134
137
|
style: { cursor: "pointer" },
|
|
135
|
-
onClick: V(
|
|
136
|
-
}, null, 8, ["name"])) :
|
|
137
|
-
E(
|
|
138
|
+
onClick: V(F, ["stop"])
|
|
139
|
+
}, null, 8, ["name"])) : n("", !0),
|
|
140
|
+
E(t.$slots, "append")
|
|
138
141
|
]),
|
|
139
|
-
L(J, {
|
|
142
|
+
L(J, {
|
|
143
|
+
class: "pl-text-field__contour",
|
|
144
|
+
"group-position": l.groupPosition
|
|
145
|
+
}, null, 8, ["group-position"])
|
|
140
146
|
], 2),
|
|
141
|
-
|
|
147
|
+
w.value ? (a(), d("div", re, m(x.value.join(" ")), 1)) : l.helper ? (a(), d("div", ae, m(l.helper), 1)) : n("", !0)
|
|
142
148
|
]));
|
|
143
149
|
}
|
|
144
150
|
});
|
|
145
151
|
export {
|
|
146
|
-
|
|
152
|
+
ke as default
|
|
147
153
|
};
|
|
148
154
|
//# sourceMappingURL=PlTextField.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlTextField.vue.js","sources":["../../../src/components/PlTextField/PlTextField.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Component for one-line string data manipulation\n */\nexport default {\n name: 'PlTextField',\n};\n</script>\n\n<script lang=\"ts\" setup generic=\"M, E = string, C = E\">\nimport type { Equal } from '@milaboratories/helpers';\nimport { computed, reactive, ref, useSlots } from 'vue';\nimport SvgRequired from '../../assets/images/required.svg?raw';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport { useValidation } from '../../utils/useValidation';\nimport { PlIcon16 } from '../PlIcon16';\nimport { PlIcon24 } from '../PlIcon24';\nimport { PlSvg } from '../PlSvg';\nimport { PlTooltip } from '../PlTooltip';\nimport './pl-text-field.scss';\n\nconst slots = useSlots();\n\ntype Model = Equal<M, E | C> extends true ? M : never; // basically in === out\n\n/**\n * The current value of the input field.\n */\nconst model = defineModel<Model>({\n required: true,\n});\n\nconst props = defineProps<{\n /**\n * The label to display above the input field.\n */\n label?: string;\n /**\n * If `true`, a clear icon will appear in the input field to clear the value (set it to empty string).\n * Or you can pass a callback that returns a custom \"empty\" value (null | undefined | string)\n */\n clearable?: boolean | (() => C);\n /**\n * An optional callback to parse and/or cast the value, the return type overrides the model type.\n * The callback must throw an exception if the value is invalid\n */\n parse?: (v: string) => E;\n /**\n * If `true`, the input field is marked as required.\n */\n required?: boolean;\n /**\n * An error message to display below the input field.\n */\n error?: unknown;\n /**\n * A helper text to display below the input field when there are no errors.\n */\n helper?: string;\n /**\n * A placeholder text to display inside the input field when it is empty.\n */\n placeholder?: string;\n /**\n * If `true`, the input field is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * If `true`, the input field has a dashed border.\n */\n dashed?: boolean;\n /**\n * A prefix text to display inside the input field before the value.\n */\n prefix?: string;\n /**\n * An array of validation rules to apply to the input field. Each rule is a function that takes the current value and returns `true` if valid or an error message if invalid.\n */\n rules?: ((v: string) => boolean | string)[];\n /**\n * The string specifies whether the field should be a password or not, value could be \"password\" or undefined.\n */\n type?: 'password';\n}>();\n\nconst rootRef = ref<HTMLInputElement | undefined>(undefined);\n\nconst inputRef = ref<HTMLInputElement | undefined>();\n\nconst showPassword = ref(false);\n\nconst data = reactive({\n cached: undefined as { error: string; value: string } | undefined,\n});\n\nconst valueRef = computed<string>({\n get() {\n if (data.cached) {\n return data.cached.value;\n }\n return model.value === undefined || model.value === null ? '' : String(model.value);\n },\n set(value) {\n data.cached = undefined;\n\n if (props.parse) {\n try {\n model.value = props.parse(value) as Model;\n } catch (err) {\n data.cached = {\n error: err instanceof Error ? err.message : String(err),\n value,\n };\n }\n } else {\n model.value = value as Model;\n }\n },\n});\n\nconst fieldType = computed(() => {\n if (props.type && props.type === 'password') {\n return showPassword.value ? 'text' : props.type;\n } else {\n return 'text';\n }\n});\n\nconst passwordIcon = computed(() => (showPassword.value ? 'view-show' : 'view-hide'));\n\nconst clear = () => {\n if (props.clearable) {\n data.cached = undefined;\n model.value = props.clearable === true ? ('' as Model) : (props.clearable() as Model);\n }\n};\n\nconst validationData = useValidation(valueRef, props.rules || []);\n\nconst isEmpty = computed(() => {\n if (props.clearable) {\n return props.clearable === true ? model.value === '' : model.value === props.clearable();\n }\n\n return model.value === '';\n});\n\nconst nonEmpty = computed(() => !isEmpty.value);\n\nconst displayErrors = computed(() => {\n const errors: string[] = [];\n const propsError = getErrorMessage(props.error);\n if (propsError) {\n errors.push(propsError);\n }\n if (data.cached) {\n errors.push(data.cached.error);\n }\n if (!validationData.value.isValid) {\n errors.push(...validationData.value.errors);\n }\n return errors;\n});\n\nconst hasErrors = computed(() => displayErrors.value.length > 0);\n\nconst canShowClearable = computed(() => props.clearable && nonEmpty.value && props.type !== 'password' && !props.disabled);\n\nconst togglePasswordVisibility = () => (showPassword.value = !showPassword.value);\n\nconst onFocusOut = () => {\n data.cached = undefined;\n};\n\nconst setFocusOnInput = () => inputRef.value?.focus();\n\nuseLabelNotch(rootRef);\n</script>\n\n<template>\n <div class=\"pl-text-field__envelope\">\n <div\n ref=\"rootRef\"\n class=\"pl-text-field\"\n :class=\"{\n error: hasErrors,\n disabled,\n dashed,\n nonEmpty,\n }\"\n >\n <label v-if=\"label\" ref=\"label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" />\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 <div v-if=\"prefix\" class=\"pl-text-field__prefix\">\n {{ prefix }}\n </div>\n <input\n ref=\"inputRef\"\n v-model=\"valueRef\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder || '...'\"\n :type=\"fieldType\"\n spellcheck=\"false\"\n @focusout=\"onFocusOut\"\n />\n <div class=\"pl-text-field__append\" @click=\"setFocusOnInput\">\n <PlIcon16 v-if=\"canShowClearable\" class=\"pl-text-field__clearable\" name=\"delete-clear\" @click.stop=\"clear\" />\n <PlIcon24 v-if=\"type === 'password'\" :name=\"passwordIcon\" style=\"cursor: pointer\" @click.stop=\"togglePasswordVisibility\" />\n <slot name=\"append\" />\n </div>\n <DoubleContour class=\"pl-text-field__contour\" />\n </div>\n <div v-if=\"hasErrors\" class=\"pl-text-field__error\">\n {{ displayErrors.join(' ') }}\n </div>\n <div v-else-if=\"helper\" class=\"pl-text-field__helper\">{{ helper }}</div>\n </div>\n</template>\n"],"names":["__default__","slots","useSlots","model","_useModel","__props","props","rootRef","ref","inputRef","showPassword","data","reactive","valueRef","computed","value","err","fieldType","passwordIcon","clear","validationData","useValidation","isEmpty","nonEmpty","displayErrors","errors","propsError","getErrorMessage","hasErrors","canShowClearable","togglePasswordVisibility","onFocusOut","setFocusOnInput","_a","useLabelNotch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;GAIAA,KAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;;;;;;;;;;;;;AAiBA,UAAMC,IAAQC,EAAA,GAORC,IAAQC,EAAkBC,GAAA,YAE/B,GAEKC,IAAQD,GAqDRE,IAAUC,EAAkC,MAAS,GAErDC,IAAWD,EAAA,GAEXE,IAAeF,EAAI,EAAK,GAExBG,IAAOC,EAAS;AAAA,MACpB,QAAQ;AAAA,IAAA,CACT,GAEKC,IAAWC,EAAiB;AAAA,MAChC,MAAM;AACJ,eAAIH,EAAK,SACAA,EAAK,OAAO,QAEdR,EAAM,UAAU,UAAaA,EAAM,UAAU,OAAO,KAAK,OAAOA,EAAM,KAAK;AAAA,MACpF;AAAA,MACA,IAAIY,GAAO;AAGT,YAFAJ,EAAK,SAAS,QAEVL,EAAM;AACR,cAAI;AACF,YAAAH,EAAM,QAAQG,EAAM,MAAMS,CAAK;AAAA,UACjC,SAASC,GAAK;AACZ,YAAAL,EAAK,SAAS;AAAA,cACZ,OAAOK,aAAe,QAAQA,EAAI,UAAU,OAAOA,CAAG;AAAA,cACtD,OAAAD;AAAA,YAAA;AAAA,UAEJ;AAAA;AAEA,UAAAZ,EAAM,QAAQY;AAAA,MAElB;AAAA,IAAA,CACD,GAEKE,IAAYH,EAAS,MACrBR,EAAM,QAAQA,EAAM,SAAS,aACxBI,EAAa,QAAQ,SAASJ,EAAM,OAEpC,MAEV,GAEKY,IAAeJ,EAAS,MAAOJ,EAAa,QAAQ,cAAc,WAAY,GAE9ES,IAAQ,MAAM;AAClB,MAAIb,EAAM,cACRK,EAAK,SAAS,QACdR,EAAM,QAAQG,EAAM,cAAc,KAAQ,KAAgBA,EAAM,UAAA;AAAA,IAEpE,GAEMc,IAAiBC,EAAcR,GAAUP,EAAM,SAAS,CAAA,CAAE,GAE1DgB,IAAUR,EAAS,MACnBR,EAAM,YACDA,EAAM,cAAc,KAAOH,EAAM,UAAU,KAAKA,EAAM,UAAUG,EAAM,UAAA,IAGxEH,EAAM,UAAU,EACxB,GAEKoB,IAAWT,EAAS,MAAM,CAACQ,EAAQ,KAAK,GAExCE,IAAgBV,EAAS,MAAM;AACnC,YAAMW,IAAmB,CAAA,GACnBC,IAAaC,EAAgBrB,EAAM,KAAK;AAC9C,aAAIoB,KACFD,EAAO,KAAKC,CAAU,GAEpBf,EAAK,UACPc,EAAO,KAAKd,EAAK,OAAO,KAAK,GAE1BS,EAAe,MAAM,WACxBK,EAAO,KAAK,GAAGL,EAAe,MAAM,MAAM,GAErCK;AAAA,IACT,CAAC,GAEKG,IAAYd,EAAS,MAAMU,EAAc,MAAM,SAAS,CAAC,GAEzDK,IAAmBf,EAAS,MAAMR,EAAM,aAAaiB,EAAS,SAASjB,EAAM,SAAS,cAAc,CAACA,EAAM,QAAQ,GAEnHwB,IAA2B,MAAOpB,EAAa,QAAQ,CAACA,EAAa,OAErEqB,IAAa,MAAM;AACvB,MAAApB,EAAK,SAAS;AAAA,IAChB,GAEMqB,IAAkB,MAAA;;AAAM,cAAAC,IAAAxB,EAAS,UAAT,gBAAAwB,EAAgB;AAAA;AAE9C,WAAAC,EAAc3B,CAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"PlTextField.vue.js","sources":["../../../src/components/PlTextField/PlTextField.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Component for one-line string data manipulation\n */\nexport default {\n name: 'PlTextField',\n};\n</script>\n\n<script lang=\"ts\" setup generic=\"M, E = string, C = E\">\nimport type { Equal } from '@milaboratories/helpers';\nimport { computed, reactive, ref, useSlots } from 'vue';\nimport SvgRequired from '../../assets/images/required.svg?raw';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport { useValidation } from '../../utils/useValidation';\nimport { PlIcon16 } from '../PlIcon16';\nimport { PlIcon24 } from '../PlIcon24';\nimport { PlSvg } from '../PlSvg';\nimport { PlTooltip } from '../PlTooltip';\nimport './pl-text-field.scss';\n\nconst slots = useSlots();\n\ntype Model = Equal<M, E | C> extends true ? M : never; // basically in === out\n\n/**\n * The current value of the input field.\n */\nconst model = defineModel<Model>({\n required: true,\n});\n\nconst props = defineProps<{\n /**\n * The label to display above the input field.\n */\n label?: string;\n /**\n * If `true`, a clear icon will appear in the input field to clear the value (set it to empty string).\n * Or you can pass a callback that returns a custom \"empty\" value (null | undefined | string)\n */\n clearable?: boolean | (() => C);\n /**\n * An optional callback to parse and/or cast the value, the return type overrides the model type.\n * The callback must throw an exception if the value is invalid\n */\n parse?: (v: string) => E;\n /**\n * If `true`, the input field is marked as required.\n */\n required?: boolean;\n /**\n * An error message to display below the input field.\n */\n error?: unknown;\n /**\n * A helper text to display below the input field when there are no errors.\n */\n helper?: string;\n /**\n * A placeholder text to display inside the input field when it is empty.\n */\n placeholder?: string;\n /**\n * If `true`, the input field is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * If `true`, the input field has a dashed border.\n */\n dashed?: boolean;\n /**\n * A prefix text to display inside the input field before the value.\n */\n prefix?: string;\n /**\n * An array of validation rules to apply to the input field. Each rule is a function that takes the current value and returns `true` if valid or an error message if invalid.\n */\n rules?: ((v: string) => boolean | string)[];\n /**\n * The string specifies whether the field should be a password or not, value could be \"password\" or undefined.\n */\n type?: 'password';\n /**\n * Makes some of corners not rounded\n * */\n groupPosition?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'middle';\n}>();\n\nconst rootRef = ref<HTMLInputElement | undefined>(undefined);\n\nconst inputRef = ref<HTMLInputElement | undefined>();\n\nconst showPassword = ref(false);\n\nconst data = reactive({\n cached: undefined as { error: string; value: string } | undefined,\n});\n\nconst valueRef = computed<string>({\n get() {\n if (data.cached) {\n return data.cached.value;\n }\n return model.value === undefined || model.value === null ? '' : String(model.value);\n },\n set(value) {\n data.cached = undefined;\n\n if (props.parse) {\n try {\n model.value = props.parse(value) as Model;\n } catch (err) {\n data.cached = {\n error: err instanceof Error ? err.message : String(err),\n value,\n };\n }\n } else {\n model.value = value as Model;\n }\n },\n});\n\nconst fieldType = computed(() => {\n if (props.type && props.type === 'password') {\n return showPassword.value ? 'text' : props.type;\n } else {\n return 'text';\n }\n});\n\nconst passwordIcon = computed(() => (showPassword.value ? 'view-show' : 'view-hide'));\n\nconst clear = () => {\n if (props.clearable) {\n data.cached = undefined;\n model.value = props.clearable === true ? ('' as Model) : (props.clearable() as Model);\n }\n};\n\nconst validationData = useValidation(valueRef, props.rules || []);\n\nconst isEmpty = computed(() => {\n if (props.clearable) {\n return props.clearable === true ? model.value === '' : model.value === props.clearable();\n }\n\n return model.value === '';\n});\n\nconst nonEmpty = computed(() => !isEmpty.value);\n\nconst displayErrors = computed(() => {\n const errors: string[] = [];\n const propsError = getErrorMessage(props.error);\n if (propsError) {\n errors.push(propsError);\n }\n if (data.cached) {\n errors.push(data.cached.error);\n }\n if (!validationData.value.isValid) {\n errors.push(...validationData.value.errors);\n }\n return errors;\n});\n\nconst hasErrors = computed(() => displayErrors.value.length > 0);\n\nconst canShowClearable = computed(() => props.clearable && nonEmpty.value && props.type !== 'password' && !props.disabled);\n\nconst togglePasswordVisibility = () => (showPassword.value = !showPassword.value);\n\nconst onFocusOut = () => {\n data.cached = undefined;\n};\n\nconst setFocusOnInput = () => inputRef.value?.focus();\n\nuseLabelNotch(rootRef);\n</script>\n\n<template>\n <div class=\"pl-text-field__envelope\">\n <div\n ref=\"rootRef\"\n class=\"pl-text-field\"\n :class=\"{\n error: hasErrors,\n disabled,\n dashed,\n nonEmpty,\n }\"\n >\n <label v-if=\"label\" ref=\"label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" />\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 <div v-if=\"prefix\" class=\"pl-text-field__prefix\">\n {{ prefix }}\n </div>\n <input\n ref=\"inputRef\"\n v-model=\"valueRef\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder || '...'\"\n :type=\"fieldType\"\n spellcheck=\"false\"\n @focusout=\"onFocusOut\"\n />\n <div class=\"pl-text-field__append\" @click=\"setFocusOnInput\">\n <PlIcon16 v-if=\"canShowClearable\" class=\"pl-text-field__clearable\" name=\"delete-clear\" @click.stop=\"clear\" />\n <PlIcon24 v-if=\"type === 'password'\" :name=\"passwordIcon\" style=\"cursor: pointer\" @click.stop=\"togglePasswordVisibility\" />\n <slot name=\"append\" />\n </div>\n <DoubleContour class=\"pl-text-field__contour\" :group-position=\"groupPosition\" />\n </div>\n <div v-if=\"hasErrors\" class=\"pl-text-field__error\">\n {{ displayErrors.join(' ') }}\n </div>\n <div v-else-if=\"helper\" class=\"pl-text-field__helper\">{{ helper }}</div>\n </div>\n</template>\n"],"names":["__default__","slots","useSlots","model","_useModel","__props","props","rootRef","ref","inputRef","showPassword","data","reactive","valueRef","computed","value","err","fieldType","passwordIcon","clear","validationData","useValidation","isEmpty","nonEmpty","displayErrors","errors","propsError","getErrorMessage","hasErrors","canShowClearable","togglePasswordVisibility","onFocusOut","setFocusOnInput","_a","useLabelNotch","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_createBlock","_unref","PlSvg","SvgRequired","PlTooltip","_renderSlot","_ctx","_hoisted_3","_toDisplayString","$event","PlIcon16","PlIcon24","_createVNode","DoubleContour","_hoisted_5","_hoisted_6"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;GAIAA,KAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,UAAMC,IAAQC,EAAA,GAORC,IAAQC,EAAkBC,GAAA,YAE/B,GAEKC,IAAQD,GAyDRE,IAAUC,EAAkC,MAAS,GAErDC,IAAWD,EAAA,GAEXE,IAAeF,EAAI,EAAK,GAExBG,IAAOC,EAAS;AAAA,MACpB,QAAQ;AAAA,IAAA,CACT,GAEKC,IAAWC,EAAiB;AAAA,MAChC,MAAM;AACJ,eAAIH,EAAK,SACAA,EAAK,OAAO,QAEdR,EAAM,UAAU,UAAaA,EAAM,UAAU,OAAO,KAAK,OAAOA,EAAM,KAAK;AAAA,MACpF;AAAA,MACA,IAAIY,GAAO;AAGT,YAFAJ,EAAK,SAAS,QAEVL,EAAM;AACR,cAAI;AACF,YAAAH,EAAM,QAAQG,EAAM,MAAMS,CAAK;AAAA,UACjC,SAASC,GAAK;AACZ,YAAAL,EAAK,SAAS;AAAA,cACZ,OAAOK,aAAe,QAAQA,EAAI,UAAU,OAAOA,CAAG;AAAA,cACtD,OAAAD;AAAA,YAAA;AAAA,UAEJ;AAAA;AAEA,UAAAZ,EAAM,QAAQY;AAAA,MAElB;AAAA,IAAA,CACD,GAEKE,IAAYH,EAAS,MACrBR,EAAM,QAAQA,EAAM,SAAS,aACxBI,EAAa,QAAQ,SAASJ,EAAM,OAEpC,MAEV,GAEKY,IAAeJ,EAAS,MAAOJ,EAAa,QAAQ,cAAc,WAAY,GAE9ES,IAAQ,MAAM;AAClB,MAAIb,EAAM,cACRK,EAAK,SAAS,QACdR,EAAM,QAAQG,EAAM,cAAc,KAAQ,KAAgBA,EAAM,UAAA;AAAA,IAEpE,GAEMc,IAAiBC,EAAcR,GAAUP,EAAM,SAAS,CAAA,CAAE,GAE1DgB,IAAUR,EAAS,MACnBR,EAAM,YACDA,EAAM,cAAc,KAAOH,EAAM,UAAU,KAAKA,EAAM,UAAUG,EAAM,UAAA,IAGxEH,EAAM,UAAU,EACxB,GAEKoB,IAAWT,EAAS,MAAM,CAACQ,EAAQ,KAAK,GAExCE,IAAgBV,EAAS,MAAM;AACnC,YAAMW,IAAmB,CAAA,GACnBC,IAAaC,EAAgBrB,EAAM,KAAK;AAC9C,aAAIoB,KACFD,EAAO,KAAKC,CAAU,GAEpBf,EAAK,UACPc,EAAO,KAAKd,EAAK,OAAO,KAAK,GAE1BS,EAAe,MAAM,WACxBK,EAAO,KAAK,GAAGL,EAAe,MAAM,MAAM,GAErCK;AAAA,IACT,CAAC,GAEKG,IAAYd,EAAS,MAAMU,EAAc,MAAM,SAAS,CAAC,GAEzDK,IAAmBf,EAAS,MAAMR,EAAM,aAAaiB,EAAS,SAASjB,EAAM,SAAS,cAAc,CAACA,EAAM,QAAQ,GAEnHwB,IAA2B,MAAOpB,EAAa,QAAQ,CAACA,EAAa,OAErEqB,IAAa,MAAM;AACvB,MAAApB,EAAK,SAAS;AAAA,IAChB,GAEMqB,IAAkB,MAAA;;AAAM,cAAAC,IAAAxB,EAAS,UAAT,gBAAAwB,EAAgB;AAAA;AAE9C,WAAAC,EAAc3B,CAAO,cAInB4B,EAAA,GAAAC,EA2CM,OA3CNC,IA2CM;AAAA,MA1CJC,EAqCM,OAAA;AAAA,iBApCA;AAAA,QAAJ,KAAI/B;AAAA,QACJ,UAAM,iBAAe;AAAA,iBACIqB,EAAA;AAAA,oBAAmBvB,EAAA;AAAA,kBAAkBA,EAAA;AAAA,oBAAgBkB,EAAA;AAAA,QAAA;;QAOjElB,EAAA,SAAb8B,EAAA,GAAAC,EAQQ,SARRG,IAQQ;AAAA,UAPOlC,EAAA,iBAAbmC,EAA4CC,EAAAC,CAAA,GAAA;AAAA;YAApB,KAAKD,EAAAE,CAAA;AAAA,UAAA;UAC7BL,EAAwB,gBAAfjC,EAAA,KAAK,GAAA,CAAA;AAAA,UACGoC,EAAAxC,CAAA,EAAM,gBAAvBuC,EAIYC,EAAAG,CAAA,GAAA;AAAA;YAJoB,OAAM;AAAA,YAAO,UAAS;AAAA,UAAA;YACzC,WACT,MAAuB;AAAA,cAAvBC,EAAuBC,EAAA,QAAA,SAAA;AAAA,YAAA;;;;QAIlBzC,EAAA,eAAX+B,EAEM,OAFNW,IAEMC,EADD3C,EAAA,MAAM,GAAA,CAAA;UAEXiC,EAQE,SAAA;AAAA,mBAPI;AAAA,UAAJ,KAAI7B;AAAA,wDACKI,EAAQ,QAAAoC;AAAA,UAChB,UAAU5C,EAAA;AAAA,UACV,aAAaA,EAAA,eAAW;AAAA,UACxB,MAAMY,EAAA;AAAA,UACP,YAAW;AAAA,UACV,YAAUc;AAAA,QAAA;cALFlB,EAAA,KAAQ;AAAA,QAAA;QAOnByB,EAIM,OAAA;AAAA,UAJD,OAAM;AAAA,UAAyB,SAAON;AAAA,QAAA;UACzBH,EAAA,cAAhBW,EAA6GC,EAAAS,CAAA,GAAA;AAAA;YAA3E,OAAM;AAAA,YAA2B,MAAK;AAAA,YAAgB,WAAY/B,GAAK,CAAA,MAAA,CAAA;AAAA,UAAA;UACzFd,EAAA,SAAI,mBAApBmC,EAA2HC,EAAAU,CAAA,GAAA;AAAA;YAArF,MAAMjC,EAAA;AAAA,YAAc,OAAA,EAAA,QAAA,UAAA;AAAA,YAAyB,WAAYY,GAAwB,CAAA,MAAA,CAAA;AAAA,UAAA;UACvHe,EAAsBC,EAAA,QAAA,QAAA;AAAA,QAAA;QAExBM,EAAgFC,GAAA;AAAA,UAAjE,OAAM;AAAA,UAA0B,kBAAgBhD,EAAA;AAAA,QAAA;;MAEtDuB,EAAA,SAAXO,KAAAC,EAEM,OAFNkB,IAEMN,EADDxB,EAAA,MAAc,KAAI,GAAA,CAAA,GAAA,CAAA,KAEPnB,EAAA,eAAhB+B,EAAwE,OAAxEmB,IAAwEP,EAAf3C,EAAA,MAAM,GAAA,CAAA;;;;"}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(".ui-toggle-switch{--handle-ml: 0;--body-bg: var(--bg-base-light);--body-shadow: var(--btn-group-shape-shadow);display:flex;align-items:center;gap:12px;outline:none}.ui-toggle-switch__body{width:40px;height:24px;display:flex;padding:5px;border-radius:12px;border:1px solid var(--color-ic-01);box-shadow:var(--body-shadow);background:var(--body-bg);cursor:pointer}.ui-toggle-switch__handle{width:12px;height:12px;border-radius:12px;border:1px solid var(--color-ic-01);background:var(--color-ic-00);margin-left:var(--handle-ml)}.ui-toggle-switch.active{--body-bg: var(--btn-switcher-bg);--handle-ml: auto}.ui-toggle-switch:focus-visible{--label-color: var(--txt-focus);--body-shadow: var(--btn-group-shape-shadow), 0 0 0 2px #fff, 0 0 0 4px var(--border-color-focus)}")),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
import { defineComponent as
|
|
2
|
+
import { defineComponent as d, createElementBlock as o, openBlock as a, withKeys as m, normalizeClass as s, createElementVNode as n, createCommentVNode as u, toDisplayString as r } from "vue";
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const g = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "label"
|
|
7
|
-
},
|
|
7
|
+
}, V = {
|
|
8
8
|
name: "PlToggleSwitch"
|
|
9
|
-
},
|
|
10
|
-
...
|
|
9
|
+
}, p = /* @__PURE__ */ d({
|
|
10
|
+
...V,
|
|
11
11
|
props: {
|
|
12
12
|
label: {},
|
|
13
13
|
modelValue: { type: Boolean }
|
|
14
14
|
},
|
|
15
15
|
emits: ["update:modelValue"],
|
|
16
|
-
setup(
|
|
17
|
-
return (
|
|
16
|
+
setup(l) {
|
|
17
|
+
return (t, e) => (a(), o("div", {
|
|
18
18
|
tabindex: "0",
|
|
19
|
-
class:
|
|
20
|
-
onClick:
|
|
21
|
-
onKeydown:
|
|
19
|
+
class: s(["ui-toggle-switch", { active: l.modelValue }]),
|
|
20
|
+
onClick: e[0] || (e[0] = (i) => t.$emit("update:modelValue", !l.modelValue)),
|
|
21
|
+
onKeydown: e[1] || (e[1] = m((i) => t.$emit("update:modelValue", !l.modelValue), ["enter"]))
|
|
22
22
|
}, [
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
e[2] || (e[2] = n("div", { class: "ui-toggle-switch__body" }, [
|
|
24
|
+
n("div", { class: "ui-toggle-switch__handle" })
|
|
25
25
|
], -1)),
|
|
26
|
-
|
|
26
|
+
l.label ? (a(), o("span", g, r(l.label), 1)) : u("", !0)
|
|
27
27
|
], 34));
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
export {
|
|
31
|
-
|
|
31
|
+
p as default
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=PlToggleSwitch.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlToggleSwitch.vue.js","sources":["../../../src/components/PlToggleSwitch/PlToggleSwitch.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Component for manipulating a boolean value\n */\nexport default {\n name: 'PlToggleSwitch',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-toggle-switch.scss';\n\ndefineEmits<{\n /**\n * Emitted when the model value is updated\n *\n * @param value - The new boolean value of the model\n */\n (e: 'update:modelValue', value: boolean): void;\n}>();\n\ndefineProps<{\n /**\n * The label text for the component (optional)\n */\n label?: string;\n /**\n * The current boolean value of the component (represents 'on' | 'off' states generally).\n */\n modelValue?: boolean;\n}>();\n</script>\n\n<template>\n <div\n tabindex=\"0\"\n class=\"ui-toggle-switch\"\n :class=\"{ active: modelValue }\"\n @click=\"$emit('update:modelValue', !modelValue)\"\n @keydown.enter=\"$emit('update:modelValue', !modelValue)\"\n >\n <div class=\"ui-toggle-switch__body\">\n <div class=\"ui-toggle-switch__handle\" />\n </div>\n <span v-if=\"label\" class=\"label\">{{ label }}</span>\n </div>\n</template>\n"],"names":["__default__"],"mappings":";;;;;GAIAA,IAAe;AAAA,EACb,MAAM;AACR
|
|
1
|
+
{"version":3,"file":"PlToggleSwitch.vue.js","sources":["../../../src/components/PlToggleSwitch/PlToggleSwitch.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Component for manipulating a boolean value\n */\nexport default {\n name: 'PlToggleSwitch',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-toggle-switch.scss';\n\ndefineEmits<{\n /**\n * Emitted when the model value is updated\n *\n * @param value - The new boolean value of the model\n */\n (e: 'update:modelValue', value: boolean): void;\n}>();\n\ndefineProps<{\n /**\n * The label text for the component (optional)\n */\n label?: string;\n /**\n * The current boolean value of the component (represents 'on' | 'off' states generally).\n */\n modelValue?: boolean;\n}>();\n</script>\n\n<template>\n <div\n tabindex=\"0\"\n class=\"ui-toggle-switch\"\n :class=\"{ active: modelValue }\"\n @click=\"$emit('update:modelValue', !modelValue)\"\n @keydown.enter=\"$emit('update:modelValue', !modelValue)\"\n >\n <div class=\"ui-toggle-switch__body\">\n <div class=\"ui-toggle-switch__handle\" />\n </div>\n <span v-if=\"label\" class=\"label\">{{ label }}</span>\n </div>\n</template>\n"],"names":["__default__","_createElementBlock","_normalizeClass","__props","_cache","$event","$emit","_withKeys","_createElementVNode","_hoisted_1","_toDisplayString"],"mappings":";;;;;GAIAA,IAAe;AAAA,EACb,MAAM;AACR;;;;;;;;2BA4BEC,EAWM,OAAA;AAAA,MAVJ,UAAS;AAAA,MACT,OAAKC,EAAA,CAAC,oBAAkB,EAAA,QACNC,EAAA,WAAA,CAAU,CAAA;AAAA,MAC3B,SAAKC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEC,EAAAA,MAAK,qBAAA,CAAuBH,EAAA,UAAU;AAAA,MAC7C,WAAOC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAAG,EAAA,CAAAF,MAAQC,EAAAA,MAAK,qBAAA,CAAuBH,EAAA,UAAU,GAAA,CAAA,OAAA,CAAA;AAAA,IAAA;sBAEtDK,EAEM,OAAA,EAFD,OAAM,4BAAwB;AAAA,QACjCA,EAAwC,OAAA,EAAnC,OAAM,4BAA0B;AAAA,MAAA;MAE3BL,EAAA,cAAZF,EAAmD,QAAnDQ,GAAmDC,EAAfP,EAAA,KAAK,GAAA,CAAA;;;;"}
|
|
@@ -9,12 +9,12 @@ const l = {}, s = {
|
|
|
9
9
|
xmlns: "http://www.w3.org/2000/svg"
|
|
10
10
|
};
|
|
11
11
|
function c(i, e) {
|
|
12
|
-
return o(), t("svg", s, e[0] || (e[0] = [
|
|
12
|
+
return o(), t("svg", s, [...e[0] || (e[0] = [
|
|
13
13
|
n("path", {
|
|
14
14
|
d: "M4.00222 8.00933L0 4.00711L4.00222 0.00488281L4.00222 8.00933Z",
|
|
15
15
|
fill: "#24223D"
|
|
16
16
|
}, null, -1)
|
|
17
|
-
]));
|
|
17
|
+
])]);
|
|
18
18
|
}
|
|
19
19
|
const m = /* @__PURE__ */ r(l, [["render", c]]);
|
|
20
20
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Beak.vue.js","sources":["../../../src/components/PlTooltip/Beak.vue"],"sourcesContent":["<template>\n <svg class=\"beak\" width=\"5\" height=\"9\" viewBox=\"0 0 3 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M4.00222 8.00933L0 4.00711L4.00222 0.00488281L4.00222 8.00933Z\" fill=\"#24223D\" />\n </svg>\n</template>\n"],"names":["_hoisted_1","_sfc_render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode"],"mappings":";;cACOA,IAAY;AAAA,EAAC,OAAM;AAAA,EAAI;EAAW;EAAkB,SAAK;AAAA,EAAO;;;AAArE,SAAAC,EAAAC,GAAAC,GAAA;SACEC,EAAA,GAA0FC,EAAA,OAAAL,GAAAG,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,IAApFG,EAAE,QAAA;AAAA,MAAiE,GAAA;AAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"Beak.vue.js","sources":["../../../src/components/PlTooltip/Beak.vue"],"sourcesContent":["<template>\n <svg class=\"beak\" width=\"5\" height=\"9\" viewBox=\"0 0 3 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M4.00222 8.00933L0 4.00711L4.00222 0.00488281L4.00222 8.00933Z\" fill=\"#24223D\" />\n </svg>\n</template>\n"],"names":["_hoisted_1","_sfc_render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode"],"mappings":";;cACOA,IAAY;AAAA,EAAC,OAAM;AAAA,EAAI;EAAW;EAAkB,SAAK;AAAA,EAAO;;;AAArE,SAAAC,EAAAC,GAAAC,GAAA;SACEC,EAAA,GAA0FC,EAAA,OAAAL,GAAA,CAAA,GAAAG,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,IAApFG,EAAE,QAAA;AAAA,MAAiE,GAAA;AAAA;;;;;"}
|