bitboss-ui 1.0.34 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/BaseDatePickerInput/BaseDatePickerInput.vue.d.ts +5 -5
- package/dist/index103.js +2 -2
- package/dist/index111.js +1 -1
- package/dist/index113.js +4 -4
- package/dist/index115.js +1 -1
- package/dist/index119.js +1 -1
- package/dist/index12.js +3 -3
- package/dist/index120.js +1 -1
- package/dist/index121.js +1 -1
- package/dist/index127.js +1 -1
- package/dist/index128.js +1 -1
- package/dist/index129.js +1 -1
- package/dist/index16.js +8 -8
- package/dist/index18.js +77 -74
- package/dist/index18.js.map +1 -1
- package/dist/index20.js +4 -4
- package/dist/index200.js +3 -2
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +35 -4
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +6 -2
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +7 -121
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +2 -134
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +2 -5
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +2 -19
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +235 -2
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +4 -2
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +3 -35
- package/dist/index209.js.map +1 -1
- package/dist/index210.js +3 -174
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +5 -6
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +16 -7
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +14 -366
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +18 -372
- package/dist/index214.js.map +1 -1
- package/dist/index215.js +20 -235
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +29 -3
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +8 -3
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +2 -16
- package/dist/index218.js.map +1 -1
- package/dist/index219.js +119 -14
- package/dist/index219.js.map +1 -1
- package/dist/index22.js +2 -2
- package/dist/index220.js +2 -20
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +7 -29
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +368 -8
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +373 -3
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +134 -7
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +174 -2
- package/dist/index225.js.map +1 -1
- package/dist/index226.js +2 -10
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +10 -2
- package/dist/index227.js.map +1 -1
- package/dist/index230.js +6 -79
- package/dist/index230.js.map +1 -1
- package/dist/index231.js +17 -6
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +79 -17
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +435 -2
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +88 -68
- package/dist/index234.js.map +1 -1
- package/dist/index235.js +2 -4
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +200 -5
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +69 -6
- package/dist/index237.js.map +1 -1
- package/dist/index238.js +4 -2
- package/dist/index238.js.map +1 -1
- package/dist/index239.js +5 -295
- package/dist/index239.js.map +1 -1
- package/dist/index240.js +224 -2
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +258 -2
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +12 -103
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +291 -431
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +5 -223
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +2 -258
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +2 -117
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +2 -200
- package/dist/index247.js.map +1 -1
- package/dist/index251.js +106 -2
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +115 -87
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +2 -15
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +1 -1
- package/dist/index258.js +1 -1
- package/dist/index26.js +2 -2
- package/dist/index30.js +3 -3
- package/dist/index32.js +10 -10
- package/dist/index32.js.map +1 -1
- package/dist/index34.js +2 -2
- package/dist/index36.js +2 -2
- package/dist/index40.js +1 -1
- package/dist/index50.js +1 -1
- package/dist/index52.js +1 -1
- package/dist/index56.js +1 -1
- package/dist/index68.js +3 -3
- package/dist/index72.js +2 -2
- package/dist/index74.js +1 -1
- package/dist/index77.js +2 -2
- package/dist/index79.js +1 -1
- package/dist/index81.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
2
|
import { default as it } from 'dayjs/locale/it';
|
|
3
3
|
import type { HTMLAttributes, InputHTMLAttributes } from 'vue';
|
|
4
4
|
export type BaseDatePickerInputProps = {
|
|
@@ -109,7 +109,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
109
109
|
day?: ((props: {
|
|
110
110
|
first: boolean;
|
|
111
111
|
highlighted: boolean;
|
|
112
|
-
item:
|
|
112
|
+
item: Dayjs;
|
|
113
113
|
label: string;
|
|
114
114
|
last: boolean;
|
|
115
115
|
middle: boolean;
|
|
@@ -119,7 +119,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
119
119
|
[key: string]: (props: {
|
|
120
120
|
first: boolean;
|
|
121
121
|
highlighted: boolean;
|
|
122
|
-
item:
|
|
122
|
+
item: Dayjs;
|
|
123
123
|
label: string;
|
|
124
124
|
last: boolean;
|
|
125
125
|
middle: boolean;
|
|
@@ -134,7 +134,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
134
134
|
day?: ((props: {
|
|
135
135
|
first: boolean;
|
|
136
136
|
highlighted: boolean;
|
|
137
|
-
item:
|
|
137
|
+
item: Dayjs;
|
|
138
138
|
label: string;
|
|
139
139
|
last: boolean;
|
|
140
140
|
middle: boolean;
|
|
@@ -144,7 +144,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
144
144
|
[key: string]: (props: {
|
|
145
145
|
first: boolean;
|
|
146
146
|
highlighted: boolean;
|
|
147
|
-
item:
|
|
147
|
+
item: Dayjs;
|
|
148
148
|
label: string;
|
|
149
149
|
last: boolean;
|
|
150
150
|
middle: boolean;
|
package/dist/index103.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { defineComponent as de, ref as O, computed as p, onMounted as be, watch as q, openBlock as n, createBlock as re, resolveDynamicComponent as ue, normalizeClass as f, withCtx as pe, createElementBlock as d, toDisplayString as m, createCommentVNode as v, createElementVNode as o, renderSlot as y, createVNode as J, unref as C, Fragment as N, renderList as T, createTextVNode as fe, mergeProps as me } from "vue";
|
|
2
|
-
import { add as ye } from "./
|
|
2
|
+
import { add as ye } from "./index235.js";
|
|
3
3
|
import { clamp as he } from "./index198.js";
|
|
4
4
|
import { deepEqual as G } from "./index125.js";
|
|
5
5
|
import { isNil as j } from "./index122.js";
|
|
6
6
|
import { isNotNil as _e } from "./index126.js";
|
|
7
7
|
import { useId as ke } from "./index8.js";
|
|
8
8
|
import { useItemValue as ge } from "./index128.js";
|
|
9
|
-
import { when as ve } from "./
|
|
9
|
+
import { when as ve } from "./index208.js";
|
|
10
10
|
import K from "./index12.js";
|
|
11
11
|
import "./index13.js";
|
|
12
12
|
import Ce from "./index26.js";
|
package/dist/index111.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as s, openBlock as e, createBlock as o, Teleport as l, createElementVNode as c, normalizeClass as m, createVNode as i, TransitionGroup as p, withCtx as u, createElementBlock as d, Fragment as f, renderList as _, unref as r, mergeProps as b } from "vue";
|
|
2
2
|
import { state as k, useToast as C } from "./index6.js";
|
|
3
|
-
import B from "./
|
|
3
|
+
import B from "./index237.js";
|
|
4
4
|
const N = /* @__PURE__ */ s({
|
|
5
5
|
__name: "BbToast",
|
|
6
6
|
props: {
|
package/dist/index113.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { defineComponent as A, ref as o, computed as E, openBlock as b, createElementBlock as $, mergeProps as D, createElementVNode as i, renderSlot as L, normalizeProps as H, guardReactiveProps as I, unref as s, createBlock as M, Teleport as R, normalizeClass as U, normalizeStyle as j, withCtx as q, createCommentVNode as O } from "vue";
|
|
2
|
-
import { useFloating as G, arrow as J } from "./
|
|
2
|
+
import { useFloating as G, arrow as J } from "./index219.js";
|
|
3
3
|
import { useId as K } from "./index8.js";
|
|
4
4
|
import { wait as P } from "./index124.js";
|
|
5
5
|
import Q from "./index10.js";
|
|
6
6
|
import "./index11.js";
|
|
7
|
-
import { throttle as v } from "./
|
|
8
|
-
import { waitFor as W } from "./
|
|
9
|
-
import { autoUpdate as X, flip as Y, shift as Z } from "./
|
|
7
|
+
import { throttle as v } from "./index200.js";
|
|
8
|
+
import { waitFor as W } from "./index202.js";
|
|
9
|
+
import { autoUpdate as X, flip as Y, shift as Z } from "./index222.js";
|
|
10
10
|
const ee = { class: "bb-tooltip__bubble" }, te = /* @__PURE__ */ i("svg", {
|
|
11
11
|
fill: "none",
|
|
12
12
|
viewBox: "0 0 24 24",
|
package/dist/index115.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as $, computed as g, resolveComponent as y, openBlock as f, createElementBlock as i, Fragment as v, renderList as h, normalizeClass as b, createElementVNode as s, renderSlot as p, createVNode as k, createSlots as B, withCtx as C, normalizeProps as T, guardReactiveProps as _ } from "vue";
|
|
2
|
-
import { flattenTree as P } from "./
|
|
2
|
+
import { flattenTree as P } from "./index239.js";
|
|
3
3
|
const w = { class: "bb-tree-row" }, z = { class: "bb-tree-main-content" }, I = /* @__PURE__ */ $({
|
|
4
4
|
__name: "BbTree",
|
|
5
5
|
props: {
|
package/dist/index119.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as m, getCurrentInstance as d, inject as x, computed as l, ref as y, watchEffect as _, openBlock as b, createElementBlock as h, mergeProps as w } from "vue";
|
|
2
|
-
import { isCssColor as z } from "./
|
|
2
|
+
import { isCssColor as z } from "./index206.js";
|
|
3
3
|
const g = ["innerHTML"], $ = /* @__PURE__ */ m({
|
|
4
4
|
__name: "BbIcon",
|
|
5
5
|
props: {
|
package/dist/index12.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as C, ref as b, computed as n, watch as E, openBlock as m, createElementBlock as p, normalizeProps as c, guardReactiveProps as h, mergeProps as f, createCommentVNode as I, createElementVNode as r, renderSlot as F } from "vue";
|
|
2
|
-
import { isCssColor as k } from "./
|
|
3
|
-
import { when as N } from "./
|
|
4
|
-
import { booleanishToBoolean as S } from "./
|
|
2
|
+
import { isCssColor as k } from "./index206.js";
|
|
3
|
+
import { when as N } from "./index208.js";
|
|
4
|
+
import { booleanishToBoolean as S } from "./index204.js";
|
|
5
5
|
const A = {
|
|
6
6
|
"aria-hidden": "true",
|
|
7
7
|
class: "bb-base-checkbox-container"
|
package/dist/index120.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as v, ref as r, onMounted as p, onBeforeUnmount as h, openBlock as i, createBlock as l, resolveDynamicComponent as u, normalizeStyle as m, withCtx as f, renderSlot as d } from "vue";
|
|
2
|
-
import { throttle as g } from "./
|
|
2
|
+
import { throttle as g } from "./index200.js";
|
|
3
3
|
const O = /* @__PURE__ */ v({
|
|
4
4
|
__name: "BbSmoothHeight",
|
|
5
5
|
props: {
|
package/dist/index121.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as m, computed as r, openBlock as a, createElementBlock as d, normalizeProps as u, guardReactiveProps as z, createElementVNode as c } from "vue";
|
|
2
|
-
import { isCssColor as f } from "./
|
|
2
|
+
import { isCssColor as f } from "./index206.js";
|
|
3
3
|
const _ = /* @__PURE__ */ c("svg", {
|
|
4
4
|
viewBox: "0 0 512 512",
|
|
5
5
|
xmlns: "http://www.w3.org/2000/svg"
|
package/dist/index127.js
CHANGED
package/dist/index128.js
CHANGED
package/dist/index129.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isArray as b, isPlainObject as m } from "./
|
|
1
|
+
import { isArray as b, isPlainObject as m } from "./index242.js";
|
|
2
2
|
function i(e, n, l, o, r) {
|
|
3
3
|
const u = {}.propertyIsEnumerable.call(o, n) ? "enumerable" : "nonenumerable";
|
|
4
4
|
u === "enumerable" && (e[n] = l), r && u === "nonenumerable" && Object.defineProperty(e, n, {
|
package/dist/index16.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { defineComponent as Ve, ref as k, computed as p, watch as F, nextTick as U, openBlock as d, createElementBlock as u, mergeProps as Se, createElementVNode as r, createTextVNode as De, toDisplayString as f, unref as y, withDirectives as q, createVNode as V, Transition as S, withCtx as D, vShow as j, createCommentVNode as Y, normalizeClass as g, Fragment as w, renderList as O, renderSlot as G } from "vue";
|
|
2
|
-
import i from "./
|
|
3
|
-
import Me from "./
|
|
4
|
-
import Ae from "./
|
|
5
|
-
import xe from "./
|
|
6
|
-
import Ce from "./
|
|
7
|
-
import Ye from "./
|
|
8
|
-
import { groupBy as J } from "./
|
|
2
|
+
import i from "./index211.js";
|
|
3
|
+
import Me from "./index212.js";
|
|
4
|
+
import Ae from "./index213.js";
|
|
5
|
+
import xe from "./index214.js";
|
|
6
|
+
import Ce from "./index215.js";
|
|
7
|
+
import Ye from "./index216.js";
|
|
8
|
+
import { groupBy as J } from "./index217.js";
|
|
9
9
|
import { isNil as Be } from "./index122.js";
|
|
10
|
-
import { last as Q } from "./
|
|
10
|
+
import { last as Q } from "./index218.js";
|
|
11
11
|
const Ie = { class: "bb-base-date-picker__header" }, Ee = ["disabled"], Ne = /* @__PURE__ */ r("span", null, null, -1), Te = {
|
|
12
12
|
"aria-live": "polite",
|
|
13
13
|
class: "bb-base-date-picker__selected-day-label"
|
package/dist/index18.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useFloating as
|
|
3
|
-
import
|
|
4
|
-
import o from "./
|
|
5
|
-
import
|
|
6
|
-
import { identity as ge } from "./
|
|
7
|
-
import { last as
|
|
8
|
-
import { useFocusTrap as
|
|
9
|
-
import { useId as
|
|
10
|
-
import { vMaska as
|
|
1
|
+
import { defineComponent as ae, ref as n, computed as c, watch as te, openBlock as B, createElementBlock as ne, normalizeClass as O, renderSlot as p, createElementVNode as r, withDirectives as oe, mergeProps as z, unref as m, toDisplayString as L, createBlock as re, Teleport as le, normalizeStyle as ie, createVNode as se, createSlots as ue, renderList as de, withCtx as ce, normalizeProps as pe, guardReactiveProps as me, createCommentVNode as fe } from "vue";
|
|
2
|
+
import { useFloating as be } from "./index219.js";
|
|
3
|
+
import ve from "./index224.js";
|
|
4
|
+
import o from "./index211.js";
|
|
5
|
+
import ye from "./index214.js";
|
|
6
|
+
import { identity as ge } from "./index205.js";
|
|
7
|
+
import { last as he } from "./index218.js";
|
|
8
|
+
import { useFocusTrap as ke } from "./index201.js";
|
|
9
|
+
import { useId as Me } from "./index8.js";
|
|
10
|
+
import { vMaska as we } from "./index225.js";
|
|
11
11
|
import { wait as Y } from "./index124.js";
|
|
12
|
-
import { waitFor as
|
|
13
|
-
import
|
|
12
|
+
import { waitFor as Ve } from "./index202.js";
|
|
13
|
+
import _e from "./index16.js";
|
|
14
14
|
import "./index17.js";
|
|
15
|
-
import { useMobile as
|
|
16
|
-
import { autoUpdate as
|
|
17
|
-
import { offset as Ce } from "./
|
|
18
|
-
const
|
|
15
|
+
import { useMobile as Ye } from "./index221.js";
|
|
16
|
+
import { autoUpdate as De, flip as Ae, shift as Se } from "./index222.js";
|
|
17
|
+
import { offset as Ce } from "./index223.js";
|
|
18
|
+
const $e = ["id", "aria-describedby", "autocomplete", "autofocus", "data-maska", "disabled", "inputmode", "name", "placeholder", "readonly", "value"], Ee = ["disabled"], Be = /* @__PURE__ */ r("svg", {
|
|
19
19
|
viewBox: "-2 -3 24 24",
|
|
20
20
|
xmlns: "http://www.w3.org/2000/svg"
|
|
21
21
|
}, [
|
|
22
|
-
/* @__PURE__ */
|
|
22
|
+
/* @__PURE__ */ r("path", {
|
|
23
23
|
d: "M18 7V5a1 1 0 0 0-1-1h-1v1a1 1 0 0 1-2 0V4H6v1a1 1 0 1 1-2 0V4H3a1 1 0 0 0-1 1v2zm0 2H2v6a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1zm-2-7h1a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V5a3 3 0 0 1 3-3h1V1a1 1 0 1 1 2 0v1h8V1a1 1 0 0 1 2 0z",
|
|
24
24
|
fill: "currentColor"
|
|
25
25
|
})
|
|
26
|
-
], -1),
|
|
26
|
+
], -1), Oe = ["id"], Xe = /* @__PURE__ */ ae({
|
|
27
27
|
__name: "BaseDatePickerInput",
|
|
28
28
|
props: {
|
|
29
29
|
allowWriting: { type: [Boolean, String], default: !0 },
|
|
@@ -44,10 +44,10 @@ const Se = ["id", "aria-describedby", "autocomplete", "autofocus", "data-maska",
|
|
|
44
44
|
width: { default: 290 }
|
|
45
45
|
},
|
|
46
46
|
emits: ["active", "error", "focus", "inactive", "update:modelValue"],
|
|
47
|
-
setup(
|
|
48
|
-
o.extend(
|
|
49
|
-
const a =
|
|
50
|
-
() => a.allowWriting === "not-mobile" &&
|
|
47
|
+
setup(F, { emit: I }) {
|
|
48
|
+
o.extend(ve), o.locale(ye);
|
|
49
|
+
const a = F, l = I, i = n(null), D = n(null), A = n(null), P = n(null), f = n(null), k = n(), b = a.id || `bdpi_${Me().id.value}`, { isMobile: S } = Ye(), W = c(
|
|
50
|
+
() => a.allowWriting === "not-mobile" && S.value ? "none" : "numeric"
|
|
51
51
|
), G = c(() => ({
|
|
52
52
|
"bb-base-date-picker-input": !0,
|
|
53
53
|
"bb-base-date-picker-input--active": u.value,
|
|
@@ -59,47 +59,47 @@ const Se = ["id", "aria-describedby", "autocomplete", "autofocus", "data-maska",
|
|
|
59
59
|
if (!a.range && e.target instanceof HTMLInputElement)
|
|
60
60
|
if (f.value = e.target.value, /\d{2}\/\d{2}\/\d{4}/.test(e.target.value)) {
|
|
61
61
|
const t = o(e.target.value, "DD/MM/YYYY");
|
|
62
|
-
|
|
62
|
+
x(t) ? l("error", "invalid_date_typed") : l("update:modelValue", t.toISOString());
|
|
63
63
|
} else
|
|
64
|
-
e.target.value === "" &&
|
|
64
|
+
e.target.value === "" && l("update:modelValue", null);
|
|
65
65
|
}
|
|
66
66
|
}, u = n(!1), T = () => {
|
|
67
|
-
u.value || (
|
|
68
|
-
},
|
|
67
|
+
u.value || (l("active"), u.value = !0, document.addEventListener("focusin", v), document.addEventListener("click", v));
|
|
68
|
+
}, v = (e) => {
|
|
69
69
|
var t, s;
|
|
70
|
-
_.value || e.target instanceof HTMLElement && !((t = D.value) != null && t.contains(e.target)) && !((s = i.value) != null && s.contains(e.target)) && (u.value = !1,
|
|
71
|
-
},
|
|
70
|
+
_.value || e.target instanceof HTMLElement && !((t = D.value) != null && t.contains(e.target)) && !((s = i.value) != null && s.contains(e.target)) && (u.value = !1, l("inactive"), document.removeEventListener("focusin", v), document.removeEventListener("click", v));
|
|
71
|
+
}, C = (e) => {
|
|
72
72
|
if (e)
|
|
73
73
|
if (Array.isArray(e)) {
|
|
74
74
|
let t, s;
|
|
75
|
-
return e.length && (t = e[0]), e.length > 1 && (s =
|
|
75
|
+
return e.length && (t = e[0]), e.length > 1 && (s = he(e)), [t, s].filter(ge).map((h) => o(h).format("DD/MM/YYYY")).join(" - ");
|
|
76
76
|
} else
|
|
77
77
|
return o(e).format("DD/MM/YYYY");
|
|
78
78
|
return null;
|
|
79
|
-
}, j = c(() => f.value ? f.value :
|
|
80
|
-
|
|
79
|
+
}, j = c(() => f.value ? f.value : C(a.modelValue));
|
|
80
|
+
te(
|
|
81
81
|
() => a.modelValue,
|
|
82
82
|
(e) => {
|
|
83
|
-
f.value =
|
|
83
|
+
f.value = C(e);
|
|
84
84
|
}
|
|
85
85
|
);
|
|
86
|
-
const { floatingStyles: N } =
|
|
86
|
+
const { floatingStyles: N } = be(A, i, {
|
|
87
87
|
placement: "bottom",
|
|
88
|
-
whileElementsMounted:
|
|
89
|
-
middleware: [
|
|
88
|
+
whileElementsMounted: De,
|
|
89
|
+
middleware: [Ae(), Ce(5), Se()]
|
|
90
90
|
}), R = c(() => {
|
|
91
91
|
const e = {
|
|
92
92
|
...N.value
|
|
93
93
|
};
|
|
94
94
|
return i.value, e;
|
|
95
|
-
}), y = n(!1), M = n(!1), w = n(!1),
|
|
96
|
-
|
|
95
|
+
}), y = n(!1), M = n(!1), w = n(!1), g = n(!0), U = async () => {
|
|
96
|
+
g.value = !1, M.value = !0, await Y(350), M.value = !1, g.value = !1, y.value = !0;
|
|
97
97
|
}, V = async () => {
|
|
98
98
|
var e, t;
|
|
99
|
-
y.value = !1, w.value = !0, await Y(350), w.value = !1, y.value = !1,
|
|
99
|
+
y.value = !1, w.value = !0, await Y(350), w.value = !1, y.value = !1, g.value = !0, (e = k.value) == null || e.setSelectionModeToDay(), (t = k.value) == null || t.setCursor(a.modelValue);
|
|
100
100
|
}, $ = n(!1), E = async () => {
|
|
101
|
-
$.value = !0, await
|
|
102
|
-
}, _ = n(!1), { activate: q, deactivate: J } =
|
|
101
|
+
$.value = !0, await Ve(() => !!i.value), await U(), q();
|
|
102
|
+
}, _ = n(!1), { activate: q, deactivate: J } = ke(i, {
|
|
103
103
|
onActivate: () => _.value = !0,
|
|
104
104
|
// On post activation focus on current date
|
|
105
105
|
onPostActivate: () => {
|
|
@@ -116,10 +116,10 @@ const Se = ["id", "aria-describedby", "autocomplete", "autofocus", "data-maska",
|
|
|
116
116
|
clickOutsideDeactivates: () => (d.value = !1, V(), !0),
|
|
117
117
|
allowOutsideClick: !0
|
|
118
118
|
}), d = n(!a.allowWriting || a.range), K = async (e) => {
|
|
119
|
-
|
|
119
|
+
l("focus", e), d.value && E(), d.value = !a.allowWriting || a.allowWriting === "not-mobile" && S.value || a.range;
|
|
120
120
|
}, Q = (e) => a.range && Array.isArray(e) && e.length === 2 || !a.range && !!e, X = {
|
|
121
121
|
"onUpdate:modelValue": (e) => {
|
|
122
|
-
|
|
122
|
+
l("update:modelValue", e), Q(e) && (d.value = !1, J({ onPostDeactivate: () => V() }));
|
|
123
123
|
}
|
|
124
124
|
}, Z = c(() => {
|
|
125
125
|
if (a.range) {
|
|
@@ -131,73 +131,76 @@ const Se = ["id", "aria-describedby", "autocomplete", "autofocus", "data-maska",
|
|
|
131
131
|
} else if (typeof a.modelValue == "string")
|
|
132
132
|
return `Cambia selezione, ${o(a.modelValue).format("D MMMM YYYY")}`;
|
|
133
133
|
return "Seleziona una data";
|
|
134
|
-
})
|
|
135
|
-
|
|
134
|
+
}), x = (e) => {
|
|
135
|
+
let t = !0;
|
|
136
|
+
return a.min && t && (t = e.isSameOrAfter(o(a.min).startOf("day"))), a.max && t && (t = e.isSameOrBefore(o(a.max).startOf("day"))), typeof a.selectable == "function" && t && (t = a.selectable(e.toDate())), !t;
|
|
137
|
+
};
|
|
138
|
+
return (e, t) => (B(), ne("span", {
|
|
136
139
|
ref_key: "outerContainer",
|
|
137
140
|
ref: D,
|
|
138
|
-
class:
|
|
141
|
+
class: O(["bb-base-date-picker-input__container", G.value]),
|
|
139
142
|
onFocusin: T
|
|
140
143
|
}, [
|
|
141
144
|
p(e.$slots, "prepend-outer"),
|
|
142
|
-
|
|
145
|
+
r("span", {
|
|
143
146
|
ref_key: "innerContainer",
|
|
144
147
|
ref: A,
|
|
145
148
|
class: "bb-base-date-picker-input__inner-container"
|
|
146
149
|
}, [
|
|
147
150
|
p(e.$slots, "prepend"),
|
|
148
|
-
|
|
149
|
-
id: m(
|
|
151
|
+
oe(r("input", z({
|
|
152
|
+
id: m(b),
|
|
150
153
|
ref_key: "input",
|
|
151
|
-
ref:
|
|
152
|
-
"aria-describedby": `bdpi_description_${m(
|
|
154
|
+
ref: P,
|
|
155
|
+
"aria-describedby": `bdpi_description_${m(b)}`,
|
|
153
156
|
autocomplete: e.autocomplete,
|
|
154
157
|
autofocus: e.autofocus,
|
|
155
158
|
"data-maska": a.range ? "##/##/#### - ##/##/####" : "##/##/####",
|
|
156
159
|
disabled: e.disabled,
|
|
157
|
-
inputmode:
|
|
160
|
+
inputmode: W.value,
|
|
158
161
|
name: e.name,
|
|
159
162
|
placeholder: e.placeholder,
|
|
160
163
|
readonly: e.readonly || e.range || !e.allowWriting,
|
|
161
164
|
type: "text",
|
|
162
165
|
value: j.value
|
|
163
|
-
}, H, { onFocus: K }), null, 16,
|
|
164
|
-
[m(
|
|
166
|
+
}, H, { onFocus: K }), null, 16, $e), [
|
|
167
|
+
[m(we)]
|
|
165
168
|
]),
|
|
166
|
-
|
|
169
|
+
r("button", {
|
|
167
170
|
class: "bb-base-date-picker-input__calendar-btn",
|
|
168
171
|
disabled: e.disabled || e.readonly,
|
|
169
172
|
type: "button",
|
|
170
173
|
onClick: E
|
|
171
174
|
}, [
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
], 8,
|
|
175
|
+
Be,
|
|
176
|
+
r("span", null, L(Z.value), 1)
|
|
177
|
+
], 8, Ee),
|
|
175
178
|
p(e.$slots, "append"),
|
|
176
|
-
|
|
177
|
-
id: `bdpi_description_${m(
|
|
179
|
+
r("span", {
|
|
180
|
+
id: `bdpi_description_${m(b)}`,
|
|
178
181
|
class: "bb-base-date-picker-input__accessible-description"
|
|
179
|
-
}, "Formato della data " +
|
|
182
|
+
}, "Formato della data " + L(a.range ? "GG/MM/AAAA - GG/MM/AAAA" : "GG/MM/AAAA"), 9, Oe)
|
|
180
183
|
], 512),
|
|
181
184
|
p(e.$slots, "append-outer"),
|
|
182
|
-
$.value ? (
|
|
185
|
+
$.value ? (B(), re(le, {
|
|
183
186
|
key: 0,
|
|
184
187
|
to: "body"
|
|
185
188
|
}, [
|
|
186
|
-
|
|
189
|
+
r("span", {
|
|
187
190
|
ref_key: "calendar",
|
|
188
191
|
ref: i,
|
|
189
|
-
class:
|
|
192
|
+
class: O(["bb-base-date-picker-input__calendar", {
|
|
190
193
|
"bb-base-date-picker-input__calendar--active": u.value,
|
|
191
194
|
"bb-base-date-picker-input__calendar--shown": y.value,
|
|
192
195
|
"bb-base-date-picker-input__calendar--showing": M.value,
|
|
193
196
|
"bb-base-date-picker-input__calendar--hiding": w.value,
|
|
194
|
-
"bb-base-date-picker-input__calendar--hidden":
|
|
197
|
+
"bb-base-date-picker-input__calendar--hidden": g.value
|
|
195
198
|
}]),
|
|
196
|
-
style:
|
|
199
|
+
style: ie(R.value)
|
|
197
200
|
}, [
|
|
198
|
-
|
|
201
|
+
se(_e, z({ id: m(b) }, X, {
|
|
199
202
|
ref_key: "basedatepicker",
|
|
200
|
-
ref:
|
|
203
|
+
ref: k,
|
|
201
204
|
disabled: e.disabled,
|
|
202
205
|
"first-day-of-week": e.firstDayOfWeek,
|
|
203
206
|
max: e.max,
|
|
@@ -206,20 +209,20 @@ const Se = ["id", "aria-describedby", "autocomplete", "autofocus", "data-maska",
|
|
|
206
209
|
range: e.range,
|
|
207
210
|
readonly: e.readonly,
|
|
208
211
|
selectable: e.selectable
|
|
209
|
-
}),
|
|
210
|
-
|
|
211
|
-
name:
|
|
212
|
-
fn:
|
|
213
|
-
p(e.$slots,
|
|
212
|
+
}), ue({ _: 2 }, [
|
|
213
|
+
de(e.$slots, (s, h) => ({
|
|
214
|
+
name: h,
|
|
215
|
+
fn: ce((ee) => [
|
|
216
|
+
p(e.$slots, h, pe(me(ee)))
|
|
214
217
|
])
|
|
215
218
|
}))
|
|
216
219
|
]), 1040, ["id", "disabled", "first-day-of-week", "max", "min", "model-value", "range", "readonly", "selectable"])
|
|
217
220
|
], 6)
|
|
218
|
-
])) :
|
|
221
|
+
])) : fe("", !0)
|
|
219
222
|
], 34));
|
|
220
223
|
}
|
|
221
224
|
});
|
|
222
225
|
export {
|
|
223
|
-
|
|
226
|
+
Xe as default
|
|
224
227
|
};
|
|
225
228
|
//# sourceMappingURL=index18.js.map
|
package/dist/index18.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index18.js","sources":["../src/components/BaseDatePickerInput/BaseDatePickerInput.vue"],"sourcesContent":["<template>\n\t<span\n\t\tref=\"outerContainer\"\n\t\tclass=\"bb-base-date-picker-input__container\"\n\t\t:class=\"classes\"\n\t\t@focusin=\"onFocusIn\"\n\t>\n\t\t<slot name=\"prepend-outer\"></slot>\n\t\t<span\n\t\t\tref=\"innerContainer\"\n\t\t\tclass=\"bb-base-date-picker-input__inner-container\"\n\t\t>\n\t\t\t<slot name=\"prepend\"></slot>\n\t\t\t<input\n\t\t\t\t:id=\"id\"\n\t\t\t\tref=\"input\"\n\t\t\t\tv-maska\n\t\t\t\t:aria-describedby=\"`bdpi_description_${id}`\"\n\t\t\t\t:autocomplete=\"autocomplete\"\n\t\t\t\t:autofocus=\"autofocus\"\n\t\t\t\t:data-maska=\"props.range ? '##/##/#### - ##/##/####' : '##/##/####'\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:inputmode=\"inputmode\"\n\t\t\t\t:name=\"name\"\n\t\t\t\t:placeholder=\"placeholder\"\n\t\t\t\t:readonly=\"readonly || range || !allowWriting\"\n\t\t\t\t:type=\"'text'\"\n\t\t\t\t:value=\"displayValue\"\n\t\t\t\tv-bind=\"eventListeners\"\n\t\t\t\t@focus=\"onFocus\"\n\t\t\t/>\n\t\t\t<button\n\t\t\t\tclass=\"bb-base-date-picker-input__calendar-btn\"\n\t\t\t\t:disabled=\"disabled || readonly\"\n\t\t\t\ttype=\"button\"\n\t\t\t\t@click=\"onOpenCalendar\"\n\t\t\t>\n\t\t\t\t<svg viewBox=\"-2 -3 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M18 7V5a1 1 0 0 0-1-1h-1v1a1 1 0 0 1-2 0V4H6v1a1 1 0 1 1-2 0V4H3a1 1 0 0 0-1 1v2zm0 2H2v6a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1zm-2-7h1a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V5a3 3 0 0 1 3-3h1V1a1 1 0 1 1 2 0v1h8V1a1 1 0 0 1 2 0z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t/>\n\t\t\t\t</svg>\n\t\t\t\t<span>{{ accessibleButtonLabel }}</span>\n\t\t\t</button>\n\n\t\t\t<slot name=\"append\"></slot>\n\t\t\t<span\n\t\t\t\t:id=\"`bdpi_description_${id}`\"\n\t\t\t\tclass=\"bb-base-date-picker-input__accessible-description\"\n\t\t\t\t>Formato della data\n\t\t\t\t{{ props.range ? 'GG/MM/AAAA - GG/MM/AAAA' : 'GG/MM/AAAA' }}</span\n\t\t\t>\n\t\t</span>\n\t\t<slot name=\"append-outer\"></slot>\n\t\t<teleport v-if=\"shouldRenderCalendar\" to=\"body\">\n\t\t\t<span\n\t\t\t\tref=\"calendar\"\n\t\t\t\tclass=\"bb-base-date-picker-input__calendar\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t'bb-base-date-picker-input__calendar--active': active,\n\t\t\t\t\t'bb-base-date-picker-input__calendar--shown': shown,\n\t\t\t\t\t'bb-base-date-picker-input__calendar--showing': showing,\n\t\t\t\t\t'bb-base-date-picker-input__calendar--hiding': hiding,\n\t\t\t\t\t'bb-base-date-picker-input__calendar--hidden': hidden,\n\t\t\t\t}\"\n\t\t\t\t:style=\"calendarStyles\"\n\t\t\t>\n\t\t\t\t<BaseDatePicker\n\t\t\t\t\t:id=\"id\"\n\t\t\t\t\tv-bind=\"calendarEventListeners\"\n\t\t\t\t\tref=\"basedatepicker\"\n\t\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t\t:first-day-of-week=\"firstDayOfWeek\"\n\t\t\t\t\t:max=\"max\"\n\t\t\t\t\t:min=\"min\"\n\t\t\t\t\t:model-value=\"modelValue\"\n\t\t\t\t\t:range=\"range\"\n\t\t\t\t\t:readonly=\"readonly\"\n\t\t\t\t\t:selectable=\"selectable\"\n\t\t\t\t>\n\t\t\t\t\t<template v-for=\"(_, name) in $slots\" #[name]=\"data\">\n\t\t\t\t\t\t<slot :name=\"name\" v-bind=\"data\" />\n\t\t\t\t\t</template>\n\t\t\t\t</BaseDatePicker>\n\t\t\t</span>\n\t\t</teleport>\n\t</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { autoUpdate, flip, offset, shift, useFloating } from '@floating-ui/vue';\nimport { computed, ref, watch } from 'vue';\nimport { default as customParseFormat } from 'dayjs/plugin/customParseFormat';\nimport { default as dayjs } from 'dayjs';\nimport { default as it } from 'dayjs/locale/it';\nimport { identity } from '@/utilities/functions/identity';\nimport { last } from '@/utilities/functions/last';\nimport { useFocusTrap } from '@vueuse/integrations/useFocusTrap';\nimport { useId } from '@/composables/useId';\nimport { vMaska } from 'maska';\nimport { wait } from '@/utilities/functions/wait';\nimport { waitFor } from '@/utilities/functions/waitFor';\nimport BaseDatePicker from '../BaseDatePicker/BaseDatePicker.vue';\nimport type { BaseDatePickerSlots } from '../BaseDatePicker/BaseDatePicker.vue';\nimport type { HTMLAttributes, InputHTMLAttributes } from 'vue';\nimport { useMobile } from '@/composables/useMobile';\n\ndayjs.extend(customParseFormat);\ndayjs.locale(it);\n\nexport type BaseDatePickerInputProps = {\n\t/**\n\t * Allows typing into the input.\n\t */\n\tallowWriting?: boolean | 'not-mobile';\n\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tautocomplete?: InputHTMLAttributes['autocomplete'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Defines the first day of the week with `0` meaning Sunday and `6` meaning Saturday\n\t */\n\tfirstDayOfWeek?: (typeof it)['weekStart'];\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\n\t/**\n\t * Maximum selectable date\n\t */\n\tmax?: Date | string | number;\n\n\t/**\n\t * Minimum selectable date\n\t */\n\tmin?: Date | string | number;\n\n\t/**\n\t * Used by v-model. Can be null, a single string, or an array of strings based on whether a range or single date is needed\n\t */\n\tmodelValue: string | string[] | null;\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname?: InputHTMLAttributes['name'];\n\n\t/**\n\t * String displayed when there's no data.\n\t */\n\tplaceholder?: InputHTMLAttributes['placeholder'];\n\n\t/**\n\t * Selects a range of dates between two dates. It selects all of the days between start and end\n\t */\n\trange?: boolean;\n\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: InputHTMLAttributes['readonly'];\n\n\t/**\n\t * Function that accepts a `Date` object and returns a boolean. `false` meaning the date cannot be selected\n\t * @param date\n\t */\n\tselectable?: (date: Date) => boolean;\n\n\t/**\n\t * Width of the calendar\n\t */\n\twidth?: number | string;\n};\n\nconst props = withDefaults(defineProps<BaseDatePickerInputProps>(), {\n\tallowWriting: true,\n\tautocomplete: 'off',\n\twidth: 290,\n});\n\nexport type BaseDatePickerInputEvents = {\n\t(e: 'active'): void;\n\t(e: 'error', message: string): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'inactive'): void;\n\t(e: 'update:modelValue', value: BaseDatePickerInputProps['modelValue']): void;\n};\n\nconst emit = defineEmits<BaseDatePickerInputEvents>();\n\ndefineSlots<\n\t{\n\t\t'prepend-outer'?: (props: object) => any;\n\t\tprepend?: (props: object) => any;\n\t\tappend?: (props: object) => any;\n\t\t'append-outer'?: (props: object) => any;\n\t} & BaseDatePickerSlots\n>();\n\nconst calendar = ref<HTMLElement | null>(null);\nconst outerContainer = ref<HTMLElement | null>(null);\nconst innerContainer = ref<HTMLElement | null>(null);\nconst input = ref<HTMLElement | null>(null);\nconst inputValue = ref<string | null>(null);\nconst basedatepicker = ref();\nconst id = props.id || `bdpi_${useId().id.value}`;\n\nconst { isMobile } = useMobile();\nconst inputmode = computed(() =>\n\tprops.allowWriting === 'not-mobile' && isMobile.value ? 'none' : 'numeric'\n);\n\nconst classes = computed(() => ({\n\t'bb-base-date-picker-input': true,\n\t'bb-base-date-picker-input--active': active.value,\n\t'bb-base-date-picker-input--errors': props.hasErrors,\n\t'bb-base-date-picker-input--readonly': props.readonly,\n\t'bb-base-date-picker-input--disabled': props.disabled,\n}));\n\n/**\n * These events are just propagated\n */\nconst eventListeners = {\n\tonInput: (event: Event) => {\n\t\tif (props.range) return;\n\t\tif (event.target instanceof HTMLInputElement) {\n\t\t\tinputValue.value = event.target.value;\n\t\t\tif (/\\d{2}\\/\\d{2}\\/\\d{4}/.test(event.target.value)) {\n\t\t\t\tconst date = dayjs(event.target.value, 'DD/MM/YYYY');\n\t\t\t\tif (!basedatepicker.value.isDateDisabled(date)) {\n\t\t\t\t\temit('update:modelValue', date.toISOString());\n\t\t\t\t} else {\n\t\t\t\t\temit('error', 'invalid_date_typed');\n\t\t\t\t}\n\t\t\t} else if (event.target.value === '') {\n\t\t\t\temit('update:modelValue', null);\n\t\t\t}\n\t\t}\n\t},\n};\n\n/**\n * Applies a class when the user is inside this whole component.\n * We cannot use focus within as it doesn't work for elements that are teleported.\n * Also we cannot use the <input/> if we phisically move focus to the calendar so\n * we track it manually.\n */\nconst active = ref(false);\n\nconst onFocusIn = () => {\n\tif (active.value) return;\n\temit('active');\n\tactive.value = true;\n\tdocument.addEventListener('focusin', onDocumentInteraction);\n\tdocument.addEventListener('click', onDocumentInteraction);\n};\n\nconst onDocumentInteraction = (event: FocusEvent) => {\n\tif (trapIsActive.value) return;\n\tif (event.target instanceof HTMLElement) {\n\t\tif (\n\t\t\t!outerContainer.value?.contains(event.target) &&\n\t\t\t!calendar.value?.contains(event.target)\n\t\t) {\n\t\t\tactive.value = false;\n\t\t\temit('inactive');\n\t\t\tdocument.removeEventListener('focusin', onDocumentInteraction);\n\t\t\tdocument.removeEventListener('click', onDocumentInteraction);\n\t\t}\n\t}\n};\n\nconst getStringFromModelValue = (value: typeof props.modelValue) => {\n\tif (value) {\n\t\tif (Array.isArray(value)) {\n\t\t\tlet head;\n\t\t\tlet tail;\n\t\t\tif (value.length) head = value[0];\n\t\t\tif (value.length > 1) tail = last(value);\n\t\t\treturn [head, tail]\n\t\t\t\t.filter(identity)\n\t\t\t\t.map((el) => dayjs(el).format('DD/MM/YYYY'))\n\t\t\t\t.join(' - ');\n\t\t} else {\n\t\t\treturn dayjs(value).format('DD/MM/YYYY');\n\t\t}\n\t}\n\treturn null;\n};\n\nconst displayValue = computed(() => {\n\tif (inputValue.value) return inputValue.value;\n\treturn getStringFromModelValue(props.modelValue);\n});\n\nwatch(\n\t() => props.modelValue,\n\t(value) => {\n\t\tinputValue.value = getStringFromModelValue(value);\n\t}\n);\n\nconst { floatingStyles } = useFloating(innerContainer, calendar, {\n\tplacement: 'bottom',\n\twhileElementsMounted: autoUpdate,\n\tmiddleware: [flip(), offset(5), shift()],\n});\n\nconst calendarStyles = computed(() => {\n\tconst base: Record<string, any> = {\n\t\t...floatingStyles.value,\n\t};\n\tif (!calendar.value) return base;\n\n\treturn base;\n});\n\n/**\n * We need the transitions because elements must be hidden and shown\n * to accessibility tools when they are fully closed or fully open,\n * while still being animated for sighted users.\n */\n\n// Option panel is open\nconst shown = ref(false);\n// Option panel is opening\nconst showing = ref(false);\n// option panel is closing\nconst hiding = ref(false);\n// Option panel il closed\nconst hidden = ref(true);\n\nconst open = async () => {\n\thidden.value = false;\n\tshowing.value = true;\n\tawait wait(350);\n\tshowing.value = false;\n\n\thidden.value = false;\n\tshown.value = true;\n};\n\nconst close = async () => {\n\tshown.value = false;\n\thiding.value = true;\n\tawait wait(350);\n\thiding.value = false;\n\tshown.value = false;\n\thidden.value = true;\n\tbasedatepicker.value?.setSelectionModeToDay();\n\tbasedatepicker.value?.setCursor(props.modelValue);\n};\n\nconst shouldRenderCalendar = ref(false);\nconst onOpenCalendar = async () => {\n\tshouldRenderCalendar.value = true;\n\tawait waitFor(() => !!calendar.value);\n\tawait open();\n\tactivate();\n};\n\nconst trapIsActive = ref(false);\nconst { activate, deactivate } = useFocusTrap(calendar, {\n\tonActivate: () => (trapIsActive.value = true),\n\t// On post activation focus on current date\n\tonPostActivate: () => {\n\t\tcalendar\n\t\t\t.value!.querySelector<HTMLButtonElement>(\n\t\t\t\t'.bb-base-date-picker-date--current button'\n\t\t\t)\n\t\t\t?.focus();\n\t},\n\tonPostDeactivate: async () => {\n\t\t// Wait for transtion to end and for focus to return before\n\t\tawait wait(200);\n\t\ttrapIsActive.value = false;\n\t},\n\t/* On esc deactivate the trap, return focus and then close the modal */\n\tescapeDeactivates: () => {\n\t\tshouldOpen.value = false;\n\t\tclose();\n\t\treturn true;\n\t},\n\tclickOutsideDeactivates: () => {\n\t\tshouldOpen.value = false;\n\t\tclose();\n\t\treturn true;\n\t},\n\tallowOutsideClick: true,\n});\n\nconst shouldOpen = ref(!props.allowWriting || props.range);\nconst onFocus = async (event: FocusEvent) => {\n\temit('focus', event);\n\tif (shouldOpen.value) onOpenCalendar();\n\tshouldOpen.value =\n\t\t!props.allowWriting ||\n\t\t(props.allowWriting === 'not-mobile' && isMobile.value) ||\n\t\tprops.range;\n};\n\nconst satisfiesSelection = (value: typeof props.modelValue) => {\n\treturn (\n\t\t(props.range && Array.isArray(value) && value.length === 2) ||\n\t\t(!props.range && !!value)\n\t);\n};\n\n/**\n * These events are just propagated\n */\nconst calendarEventListeners = {\n\t'onUpdate:modelValue': (value: string | string[] | null) => {\n\t\temit('update:modelValue', value);\n\t\tif (satisfiesSelection(value)) {\n\t\t\tshouldOpen.value = false;\n\t\t\tdeactivate({ onPostDeactivate: () => close() });\n\t\t}\n\t},\n};\n\nconst accessibleButtonLabel = computed(() => {\n\tif (props.range) {\n\t\tif (!props.modelValue || props.modelValue.length < 2)\n\t\t\treturn `Seleziona un range`;\n\t\tconst start = dayjs(props.modelValue[0]).format('D MMMM YYYY');\n\t\tconst end = dayjs(props.modelValue[1]).format('D MMMM YYYY');\n\t\tif (props.range && props.modelValue.length === 2)\n\t\t\treturn `Cambia selezione, da ${start} a ${end}`;\n\t} else if (typeof props.modelValue === 'string') {\n\t\tconst selected = dayjs(props.modelValue).format('D MMMM YYYY');\n\t\treturn `Cambia selezione, ${selected}`;\n\t}\n\treturn 'Seleziona una data';\n});\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BaseDatePickerInput';\n</style>\n"],"names":["dayjs","customParseFormat","it","props","__props","emit","__emit","calendar","ref","outerContainer","innerContainer","input","inputValue","basedatepicker","id","useId","isMobile","useMobile","inputmode","computed","classes","active","eventListeners","event","date","onFocusIn","onDocumentInteraction","trapIsActive","_a","_b","getStringFromModelValue","value","head","tail","last","identity","el","displayValue","watch","floatingStyles","useFloating","autoUpdate","flip","offset","shift","calendarStyles","base","shown","showing","hiding","hidden","open","wait","close","shouldRenderCalendar","onOpenCalendar","waitFor","activate","deactivate","useFocusTrap","shouldOpen","onFocus","satisfiesSelection","calendarEventListeners","accessibleButtonLabel","start","end"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4GA,IAAAA,EAAM,OAAOC,EAAiB,GAC9BD,EAAM,OAAOE,EAAE;AAsFf,UAAMC,IAAQC,GAcRC,IAAOC,GAWPC,IAAWC,EAAwB,IAAI,GACvCC,IAAiBD,EAAwB,IAAI,GAC7CE,IAAiBF,EAAwB,IAAI,GAC7CG,IAAQH,EAAwB,IAAI,GACpCI,IAAaJ,EAAmB,IAAI,GACpCK,IAAiBL,KACjBM,IAAKX,EAAM,MAAM,QAAQY,KAAQ,GAAG,KAAK,IAEzC,EAAE,UAAAC,MAAaC,MACfC,IAAYC;AAAA,MAAS,MAC1Bh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AuB,CAAChC,MAAoC;AAC3D,QAAA1B,EAAK,qBAAqB0B,CAAK,GAC3B+B,EAAmB/B,CAAK,MAC3B6B,EAAW,QAAQ,IACnBF,EAAW,EAAE,kBAAkB,MAAML,EAAA,EAAS,CAAA;AAAA,MAEhD;AAAA,IAAA,GAGKW,IAAwB7C,EAAS,MAAM;AAC5C,UAAIhB,EAAM,OAAO;AAChB,YAAI,CAACA,EAAM,cAAcA,EAAM,WAAW,SAAS;AAC3C,iBAAA;AACF,cAAA8D,IAAQjE,EAAMG,EAAM,WAAW,CAAC,CAAC,EAAE,OAAO,aAAa,GACvD+D,IAAMlE,EAAMG,EAAM,WAAW,CAAC,CAAC,EAAE,OAAO,aAAa;AAC3D,YAAIA,EAAM,SAASA,EAAM,WAAW,WAAW;AACvC,iBAAA,wBAAwB8D,CAAK,MAAMC,CAAG;AAAA,MACpC,WAAA,OAAO/D,EAAM,cAAe;AAEtC,eAAO,qBADUH,EAAMG,EAAM,UAAU,EAAE,OAAO,aAAa,CACzB;AAE9B,aAAA;AAAA,IAAA,CACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index18.js","sources":["../src/components/BaseDatePickerInput/BaseDatePickerInput.vue"],"sourcesContent":["<template>\n\t<span\n\t\tref=\"outerContainer\"\n\t\tclass=\"bb-base-date-picker-input__container\"\n\t\t:class=\"classes\"\n\t\t@focusin=\"onFocusIn\"\n\t>\n\t\t<slot name=\"prepend-outer\"></slot>\n\t\t<span\n\t\t\tref=\"innerContainer\"\n\t\t\tclass=\"bb-base-date-picker-input__inner-container\"\n\t\t>\n\t\t\t<slot name=\"prepend\"></slot>\n\t\t\t<input\n\t\t\t\t:id=\"id\"\n\t\t\t\tref=\"input\"\n\t\t\t\tv-maska\n\t\t\t\t:aria-describedby=\"`bdpi_description_${id}`\"\n\t\t\t\t:autocomplete=\"autocomplete\"\n\t\t\t\t:autofocus=\"autofocus\"\n\t\t\t\t:data-maska=\"props.range ? '##/##/#### - ##/##/####' : '##/##/####'\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:inputmode=\"inputmode\"\n\t\t\t\t:name=\"name\"\n\t\t\t\t:placeholder=\"placeholder\"\n\t\t\t\t:readonly=\"readonly || range || !allowWriting\"\n\t\t\t\t:type=\"'text'\"\n\t\t\t\t:value=\"displayValue\"\n\t\t\t\tv-bind=\"eventListeners\"\n\t\t\t\t@focus=\"onFocus\"\n\t\t\t/>\n\t\t\t<button\n\t\t\t\tclass=\"bb-base-date-picker-input__calendar-btn\"\n\t\t\t\t:disabled=\"disabled || readonly\"\n\t\t\t\ttype=\"button\"\n\t\t\t\t@click=\"onOpenCalendar\"\n\t\t\t>\n\t\t\t\t<svg viewBox=\"-2 -3 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M18 7V5a1 1 0 0 0-1-1h-1v1a1 1 0 0 1-2 0V4H6v1a1 1 0 1 1-2 0V4H3a1 1 0 0 0-1 1v2zm0 2H2v6a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1zm-2-7h1a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V5a3 3 0 0 1 3-3h1V1a1 1 0 1 1 2 0v1h8V1a1 1 0 0 1 2 0z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t/>\n\t\t\t\t</svg>\n\t\t\t\t<span>{{ accessibleButtonLabel }}</span>\n\t\t\t</button>\n\n\t\t\t<slot name=\"append\"></slot>\n\t\t\t<span\n\t\t\t\t:id=\"`bdpi_description_${id}`\"\n\t\t\t\tclass=\"bb-base-date-picker-input__accessible-description\"\n\t\t\t\t>Formato della data\n\t\t\t\t{{ props.range ? 'GG/MM/AAAA - GG/MM/AAAA' : 'GG/MM/AAAA' }}</span\n\t\t\t>\n\t\t</span>\n\t\t<slot name=\"append-outer\"></slot>\n\t\t<teleport v-if=\"shouldRenderCalendar\" to=\"body\">\n\t\t\t<span\n\t\t\t\tref=\"calendar\"\n\t\t\t\tclass=\"bb-base-date-picker-input__calendar\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t'bb-base-date-picker-input__calendar--active': active,\n\t\t\t\t\t'bb-base-date-picker-input__calendar--shown': shown,\n\t\t\t\t\t'bb-base-date-picker-input__calendar--showing': showing,\n\t\t\t\t\t'bb-base-date-picker-input__calendar--hiding': hiding,\n\t\t\t\t\t'bb-base-date-picker-input__calendar--hidden': hidden,\n\t\t\t\t}\"\n\t\t\t\t:style=\"calendarStyles\"\n\t\t\t>\n\t\t\t\t<BaseDatePicker\n\t\t\t\t\t:id=\"id\"\n\t\t\t\t\tv-bind=\"calendarEventListeners\"\n\t\t\t\t\tref=\"basedatepicker\"\n\t\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t\t:first-day-of-week=\"firstDayOfWeek\"\n\t\t\t\t\t:max=\"max\"\n\t\t\t\t\t:min=\"min\"\n\t\t\t\t\t:model-value=\"modelValue\"\n\t\t\t\t\t:range=\"range\"\n\t\t\t\t\t:readonly=\"readonly\"\n\t\t\t\t\t:selectable=\"selectable\"\n\t\t\t\t>\n\t\t\t\t\t<template v-for=\"(_, name) in $slots\" #[name]=\"data\">\n\t\t\t\t\t\t<slot :name=\"name\" v-bind=\"data\" />\n\t\t\t\t\t</template>\n\t\t\t\t</BaseDatePicker>\n\t\t\t</span>\n\t\t</teleport>\n\t</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { autoUpdate, flip, offset, shift, useFloating } from '@floating-ui/vue';\nimport { computed, ref, watch } from 'vue';\nimport { default as customParseFormat } from 'dayjs/plugin/customParseFormat';\nimport { Dayjs, default as dayjs } from 'dayjs';\nimport { default as it } from 'dayjs/locale/it';\nimport { identity } from '@/utilities/functions/identity';\nimport { last } from '@/utilities/functions/last';\nimport { useFocusTrap } from '@vueuse/integrations/useFocusTrap';\nimport { useId } from '@/composables/useId';\nimport { vMaska } from 'maska';\nimport { wait } from '@/utilities/functions/wait';\nimport { waitFor } from '@/utilities/functions/waitFor';\nimport BaseDatePicker from '../BaseDatePicker/BaseDatePicker.vue';\nimport type { BaseDatePickerSlots } from '../BaseDatePicker/BaseDatePicker.vue';\nimport type { HTMLAttributes, InputHTMLAttributes } from 'vue';\nimport { useMobile } from '@/composables/useMobile';\n\ndayjs.extend(customParseFormat);\ndayjs.locale(it);\n\nexport type BaseDatePickerInputProps = {\n\t/**\n\t * Allows typing into the input.\n\t */\n\tallowWriting?: boolean | 'not-mobile';\n\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tautocomplete?: InputHTMLAttributes['autocomplete'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Defines the first day of the week with `0` meaning Sunday and `6` meaning Saturday\n\t */\n\tfirstDayOfWeek?: (typeof it)['weekStart'];\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\n\t/**\n\t * Maximum selectable date\n\t */\n\tmax?: Date | string | number;\n\n\t/**\n\t * Minimum selectable date\n\t */\n\tmin?: Date | string | number;\n\n\t/**\n\t * Used by v-model. Can be null, a single string, or an array of strings based on whether a range or single date is needed\n\t */\n\tmodelValue: string | string[] | null;\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname?: InputHTMLAttributes['name'];\n\n\t/**\n\t * String displayed when there's no data.\n\t */\n\tplaceholder?: InputHTMLAttributes['placeholder'];\n\n\t/**\n\t * Selects a range of dates between two dates. It selects all of the days between start and end\n\t */\n\trange?: boolean;\n\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: InputHTMLAttributes['readonly'];\n\n\t/**\n\t * Function that accepts a `Date` object and returns a boolean. `false` meaning the date cannot be selected\n\t * @param date\n\t */\n\tselectable?: (date: Date) => boolean;\n\n\t/**\n\t * Width of the calendar\n\t */\n\twidth?: number | string;\n};\n\nconst props = withDefaults(defineProps<BaseDatePickerInputProps>(), {\n\tallowWriting: true,\n\tautocomplete: 'off',\n\twidth: 290,\n});\n\nexport type BaseDatePickerInputEvents = {\n\t(e: 'active'): void;\n\t(e: 'error', message: string): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'inactive'): void;\n\t(e: 'update:modelValue', value: BaseDatePickerInputProps['modelValue']): void;\n};\n\nconst emit = defineEmits<BaseDatePickerInputEvents>();\n\ndefineSlots<\n\t{\n\t\t'prepend-outer'?: (props: object) => any;\n\t\tprepend?: (props: object) => any;\n\t\tappend?: (props: object) => any;\n\t\t'append-outer'?: (props: object) => any;\n\t} & BaseDatePickerSlots\n>();\n\nconst calendar = ref<HTMLElement | null>(null);\nconst outerContainer = ref<HTMLElement | null>(null);\nconst innerContainer = ref<HTMLElement | null>(null);\nconst input = ref<HTMLElement | null>(null);\nconst inputValue = ref<string | null>(null);\nconst basedatepicker = ref();\nconst id = props.id || `bdpi_${useId().id.value}`;\n\nconst { isMobile } = useMobile();\nconst inputmode = computed(() =>\n\tprops.allowWriting === 'not-mobile' && isMobile.value ? 'none' : 'numeric'\n);\n\nconst classes = computed(() => ({\n\t'bb-base-date-picker-input': true,\n\t'bb-base-date-picker-input--active': active.value,\n\t'bb-base-date-picker-input--errors': props.hasErrors,\n\t'bb-base-date-picker-input--readonly': props.readonly,\n\t'bb-base-date-picker-input--disabled': props.disabled,\n}));\n\n/**\n * These events are just propagated\n */\nconst eventListeners = {\n\tonInput: (event: Event) => {\n\t\tif (props.range) return;\n\t\tif (event.target instanceof HTMLInputElement) {\n\t\t\tinputValue.value = event.target.value;\n\t\t\tif (/\\d{2}\\/\\d{2}\\/\\d{4}/.test(event.target.value)) {\n\t\t\t\tconst date = dayjs(event.target.value, 'DD/MM/YYYY');\n\t\t\t\tif (!isDateDisabled(date)) {\n\t\t\t\t\temit('update:modelValue', date.toISOString());\n\t\t\t\t} else {\n\t\t\t\t\temit('error', 'invalid_date_typed');\n\t\t\t\t}\n\t\t\t} else if (event.target.value === '') {\n\t\t\t\temit('update:modelValue', null);\n\t\t\t}\n\t\t}\n\t},\n};\n\n/**\n * Applies a class when the user is inside this whole component.\n * We cannot use focus within as it doesn't work for elements that are teleported.\n * Also we cannot use the <input/> if we phisically move focus to the calendar so\n * we track it manually.\n */\nconst active = ref(false);\n\nconst onFocusIn = () => {\n\tif (active.value) return;\n\temit('active');\n\tactive.value = true;\n\tdocument.addEventListener('focusin', onDocumentInteraction);\n\tdocument.addEventListener('click', onDocumentInteraction);\n};\n\nconst onDocumentInteraction = (event: FocusEvent) => {\n\tif (trapIsActive.value) return;\n\tif (event.target instanceof HTMLElement) {\n\t\tif (\n\t\t\t!outerContainer.value?.contains(event.target) &&\n\t\t\t!calendar.value?.contains(event.target)\n\t\t) {\n\t\t\tactive.value = false;\n\t\t\temit('inactive');\n\t\t\tdocument.removeEventListener('focusin', onDocumentInteraction);\n\t\t\tdocument.removeEventListener('click', onDocumentInteraction);\n\t\t}\n\t}\n};\n\nconst getStringFromModelValue = (value: typeof props.modelValue) => {\n\tif (value) {\n\t\tif (Array.isArray(value)) {\n\t\t\tlet head;\n\t\t\tlet tail;\n\t\t\tif (value.length) head = value[0];\n\t\t\tif (value.length > 1) tail = last(value);\n\t\t\treturn [head, tail]\n\t\t\t\t.filter(identity)\n\t\t\t\t.map((el) => dayjs(el).format('DD/MM/YYYY'))\n\t\t\t\t.join(' - ');\n\t\t} else {\n\t\t\treturn dayjs(value).format('DD/MM/YYYY');\n\t\t}\n\t}\n\treturn null;\n};\n\nconst displayValue = computed(() => {\n\tif (inputValue.value) return inputValue.value;\n\treturn getStringFromModelValue(props.modelValue);\n});\n\nwatch(\n\t() => props.modelValue,\n\t(value) => {\n\t\tinputValue.value = getStringFromModelValue(value);\n\t}\n);\n\nconst { floatingStyles } = useFloating(innerContainer, calendar, {\n\tplacement: 'bottom',\n\twhileElementsMounted: autoUpdate,\n\tmiddleware: [flip(), offset(5), shift()],\n});\n\nconst calendarStyles = computed(() => {\n\tconst base: Record<string, any> = {\n\t\t...floatingStyles.value,\n\t};\n\tif (!calendar.value) return base;\n\n\treturn base;\n});\n\n/**\n * We need the transitions because elements must be hidden and shown\n * to accessibility tools when they are fully closed or fully open,\n * while still being animated for sighted users.\n */\n\n// Option panel is open\nconst shown = ref(false);\n// Option panel is opening\nconst showing = ref(false);\n// option panel is closing\nconst hiding = ref(false);\n// Option panel il closed\nconst hidden = ref(true);\n\nconst open = async () => {\n\thidden.value = false;\n\tshowing.value = true;\n\tawait wait(350);\n\tshowing.value = false;\n\n\thidden.value = false;\n\tshown.value = true;\n};\n\nconst close = async () => {\n\tshown.value = false;\n\thiding.value = true;\n\tawait wait(350);\n\thiding.value = false;\n\tshown.value = false;\n\thidden.value = true;\n\tbasedatepicker.value?.setSelectionModeToDay();\n\tbasedatepicker.value?.setCursor(props.modelValue);\n};\n\nconst shouldRenderCalendar = ref(false);\nconst onOpenCalendar = async () => {\n\tshouldRenderCalendar.value = true;\n\tawait waitFor(() => !!calendar.value);\n\tawait open();\n\tactivate();\n};\n\nconst trapIsActive = ref(false);\nconst { activate, deactivate } = useFocusTrap(calendar, {\n\tonActivate: () => (trapIsActive.value = true),\n\t// On post activation focus on current date\n\tonPostActivate: () => {\n\t\tcalendar\n\t\t\t.value!.querySelector<HTMLButtonElement>(\n\t\t\t\t'.bb-base-date-picker-date--current button'\n\t\t\t)\n\t\t\t?.focus();\n\t},\n\tonPostDeactivate: async () => {\n\t\t// Wait for transtion to end and for focus to return before\n\t\tawait wait(200);\n\t\ttrapIsActive.value = false;\n\t},\n\t/* On esc deactivate the trap, return focus and then close the modal */\n\tescapeDeactivates: () => {\n\t\tshouldOpen.value = false;\n\t\tclose();\n\t\treturn true;\n\t},\n\tclickOutsideDeactivates: () => {\n\t\tshouldOpen.value = false;\n\t\tclose();\n\t\treturn true;\n\t},\n\tallowOutsideClick: true,\n});\n\nconst shouldOpen = ref(!props.allowWriting || props.range);\nconst onFocus = async (event: FocusEvent) => {\n\temit('focus', event);\n\tif (shouldOpen.value) onOpenCalendar();\n\tshouldOpen.value =\n\t\t!props.allowWriting ||\n\t\t(props.allowWriting === 'not-mobile' && isMobile.value) ||\n\t\tprops.range;\n};\n\nconst satisfiesSelection = (value: typeof props.modelValue) => {\n\treturn (\n\t\t(props.range && Array.isArray(value) && value.length === 2) ||\n\t\t(!props.range && !!value)\n\t);\n};\n\n/**\n * These events are just propagated\n */\nconst calendarEventListeners = {\n\t'onUpdate:modelValue': (value: string | string[] | null) => {\n\t\temit('update:modelValue', value);\n\t\tif (satisfiesSelection(value)) {\n\t\t\tshouldOpen.value = false;\n\t\t\tdeactivate({ onPostDeactivate: () => close() });\n\t\t}\n\t},\n};\n\nconst accessibleButtonLabel = computed(() => {\n\tif (props.range) {\n\t\tif (!props.modelValue || props.modelValue.length < 2)\n\t\t\treturn `Seleziona un range`;\n\t\tconst start = dayjs(props.modelValue[0]).format('D MMMM YYYY');\n\t\tconst end = dayjs(props.modelValue[1]).format('D MMMM YYYY');\n\t\tif (props.range && props.modelValue.length === 2)\n\t\t\treturn `Cambia selezione, da ${start} a ${end}`;\n\t} else if (typeof props.modelValue === 'string') {\n\t\tconst selected = dayjs(props.modelValue).format('D MMMM YYYY');\n\t\treturn `Cambia selezione, ${selected}`;\n\t}\n\treturn 'Seleziona una data';\n});\n\nconst isDateDisabled = (date: Dayjs) => {\n\tlet passing = true;\n\tif (props.min) {\n\t\tpassing &&= date.isSameOrAfter(dayjs(props.min).startOf('day'));\n\t}\n\tif (props.max) {\n\t\tpassing &&= date.isSameOrBefore(dayjs(props.max).startOf('day'));\n\t}\n\tif (typeof props.selectable === 'function') {\n\t\tpassing &&= props.selectable(date.toDate());\n\t}\n\treturn !passing;\n};\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BaseDatePickerInput';\n</style>\n"],"names":["dayjs","customParseFormat","it","props","__props","emit","__emit","calendar","ref","outerContainer","innerContainer","input","inputValue","basedatepicker","id","useId","isMobile","useMobile","inputmode","computed","classes","active","eventListeners","event","date","isDateDisabled","onFocusIn","onDocumentInteraction","trapIsActive","_a","_b","getStringFromModelValue","value","head","tail","last","identity","el","displayValue","watch","floatingStyles","useFloating","autoUpdate","flip","offset","shift","calendarStyles","base","shown","showing","hiding","hidden","open","wait","close","shouldRenderCalendar","onOpenCalendar","waitFor","activate","deactivate","useFocusTrap","shouldOpen","onFocus","satisfiesSelection","calendarEventListeners","accessibleButtonLabel","start","end","passing"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4GA,IAAAA,EAAM,OAAOC,EAAiB,GAC9BD,EAAM,OAAOE,EAAE;AAsFf,UAAMC,IAAQC,GAcRC,IAAOC,GAWPC,IAAWC,EAAwB,IAAI,GACvCC,IAAiBD,EAAwB,IAAI,GAC7CE,IAAiBF,EAAwB,IAAI,GAC7CG,IAAQH,EAAwB,IAAI,GACpCI,IAAaJ,EAAmB,IAAI,GACpCK,IAAiBL,KACjBM,IAAKX,EAAM,MAAM,QAAQY,KAAQ,GAAG,KAAK,IAEzC,EAAE,UAAAC,MAAaC,MACfC,IAAYC;AAAA,MAAS,MAC1BhB,EAAM,iBAAiB,gBAAgBa,EAAS,QAAQ,SAAS;AAAA,IAAA,GAG5DI,IAAUD,EAAS,OAAO;AAAA,MAC/B,6BAA6B;AAAA,MAC7B,qCAAqCE,EAAO;AAAA,MAC5C,qCAAqClB,EAAM;AAAA,MAC3C,uCAAuCA,EAAM;AAAA,MAC7C,uCAAuCA,EAAM;AAAA,IAC5C,EAAA,GAKImB,IAAiB;AAAA,MACtB,SAAS,CAACC,MAAiB;AAC1B,YAAI,CAAApB,EAAM,SACNoB,EAAM,kBAAkB;AAE3B,cADWX,EAAA,QAAQ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aAAa,GACvDgE,IAAMnE,EAAMG,EAAM,WAAW,CAAC,CAAC,EAAE,OAAO,aAAa;AAC3D,YAAIA,EAAM,SAASA,EAAM,WAAW,WAAW;AACvC,iBAAA,wBAAwB+D,CAAK,MAAMC,CAAG;AAAA,MACpC,WAAA,OAAOhE,EAAM,cAAe;AAEtC,eAAO,qBADUH,EAAMG,EAAM,UAAU,EAAE,OAAO,aAAa,CACzB;AAE9B,aAAA;AAAA,IAAA,CACP,GAEKsB,IAAiB,CAACD,MAAgB;AACvC,UAAI4C,IAAU;AACd,aAAIjE,EAAM,OACGiE,UAAA5C,EAAK,cAAcxB,EAAMG,EAAM,GAAG,EAAE,QAAQ,KAAK,CAAC,IAE3DA,EAAM,OACGiE,UAAA5C,EAAK,eAAexB,EAAMG,EAAM,GAAG,EAAE,QAAQ,KAAK,CAAC,IAE5D,OAAOA,EAAM,cAAe,cAC/BiE,UAAYjE,EAAM,WAAWqB,EAAK,OAAQ,CAAA,IAEpC,CAAC4C;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index20.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent as oe, ref as o, getCurrentInstance as ae, computed as m, nextTick as R, useAttrs as se, onMounted as ne, onBeforeUnmount as G, watch as ie, openBlock as w, createBlock as re, Teleport as ue, createElementVNode as a, mergeProps as K, createElementBlock as H, renderSlot as r, createTextVNode as de, toDisplayString as T, createCommentVNode as $ } from "vue";
|
|
2
|
-
import { throttle as ce } from "./
|
|
3
|
-
import { useFocusTrap as ve } from "./
|
|
2
|
+
import { throttle as ce } from "./index200.js";
|
|
3
|
+
import { useFocusTrap as ve } from "./index201.js";
|
|
4
4
|
import { useId as P } from "./index8.js";
|
|
5
5
|
import { wait as L } from "./index124.js";
|
|
6
|
-
import { waitFor as be } from "./
|
|
7
|
-
import { useModalsState as k } from "./
|
|
6
|
+
import { waitFor as be } from "./index202.js";
|
|
7
|
+
import { useModalsState as k } from "./index203.js";
|
|
8
8
|
const fe = { class: "bb-base-dialog-close" }, pe = { class: "bb-base-dialog-close__content" }, me = { class: "bb-base-dialog-close__label" }, ge = /* @__PURE__ */ a("span", { class: "bb-base-dialog-close__icon" }, [
|
|
9
9
|
/* @__PURE__ */ a("svg", {
|
|
10
10
|
"aria-hidden": "true",
|
package/dist/index200.js
CHANGED
package/dist/index200.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index200.js","sources":["../src/utilities/functions/
|
|
1
|
+
{"version":3,"file":"index200.js","sources":["../src/utilities/functions/throttle.ts"],"sourcesContent":["import t from 'lodash.throttle';\n\nexport const throttle = t;\n"],"names":["throttle"],"mappings":";AAEO,MAAMA,IAAW;"}
|