@ptlm-azulejo/datepicker 0.0.2-alpha.38 → 0.0.2-alpha.40
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/index.js +28 -20
- package/dist/index.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { defineComponent as x, computed as
|
|
1
|
+
import { defineComponent as x, computed as c, openBlock as m, createElementBlock as p, normalizeClass as g, createElementVNode as i, mergeProps as k, toDisplayString as z, createCommentVNode as y } from "vue";
|
|
2
2
|
import "@ptlm-azulejo/icons/style.css";
|
|
3
3
|
const h = ["id", "value", "name", "disabled", "aria-invalid", "readonly", "min", "max"], V = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "absolute right-11 top-3 az-datepicker__controls-options"
|
|
6
|
-
}, _ = {
|
|
6
|
+
}, _ = {
|
|
7
|
+
"data-testid": "datepicker-clear-label",
|
|
8
|
+
class: "sr-only"
|
|
9
|
+
}, B = /* @__PURE__ */ x({
|
|
7
10
|
inheritAttrs: !1,
|
|
8
11
|
__name: "index",
|
|
9
12
|
props: {
|
|
@@ -22,15 +25,15 @@ const h = ["id", "value", "name", "disabled", "aria-invalid", "readonly", "min",
|
|
|
22
25
|
disabledDates: {}
|
|
23
26
|
},
|
|
24
27
|
emits: ["update:modelValue"],
|
|
25
|
-
setup(n, { emit:
|
|
26
|
-
const e = n,
|
|
28
|
+
setup(n, { emit: r }) {
|
|
29
|
+
const e = n, o = c(() => ({
|
|
27
30
|
[`az-text-input--${e.size} az-datepicker--${e.size}`]: e.size && e.size != "m",
|
|
28
31
|
"is-invalid": e.isInvalid
|
|
29
|
-
})), s =
|
|
32
|
+
})), s = c(() => {
|
|
30
33
|
var a;
|
|
31
34
|
const t = (a = e.enabledDates) != null && a.length ? [...e.enabledDates].sort()[0] : void 0;
|
|
32
35
|
return e.minDate && t ? e.minDate > t ? e.minDate : t : t != null ? t : e.minDate;
|
|
33
|
-
}), b =
|
|
36
|
+
}), b = c(() => {
|
|
34
37
|
var a;
|
|
35
38
|
const t = (a = e.enabledDates) != null && a.length ? [...e.enabledDates].sort().pop() : void 0;
|
|
36
39
|
return e.maxDate && t ? e.maxDate < t ? e.maxDate : t : t != null ? t : e.maxDate;
|
|
@@ -40,23 +43,25 @@ const h = ["id", "value", "name", "disabled", "aria-invalid", "readonly", "min",
|
|
|
40
43
|
}, v = () => {
|
|
41
44
|
d("update:modelValue", "");
|
|
42
45
|
}, D = (t) => {
|
|
43
|
-
var
|
|
46
|
+
var u;
|
|
44
47
|
const a = t.target, l = a.value;
|
|
45
48
|
if (!l) {
|
|
46
49
|
d("update:modelValue", "");
|
|
47
50
|
return;
|
|
48
51
|
}
|
|
49
52
|
if (f(l)) {
|
|
50
|
-
a.value = String((
|
|
53
|
+
a.value = String((u = e.modelValue) != null ? u : "");
|
|
51
54
|
return;
|
|
52
55
|
}
|
|
53
56
|
d("update:modelValue", l);
|
|
54
|
-
}, d =
|
|
57
|
+
}, d = r;
|
|
55
58
|
return (t, a) => (m(), p("div", {
|
|
56
|
-
|
|
59
|
+
"data-testid": "datepicker",
|
|
60
|
+
class: g(["relative flex items-center gap-2 w-full h-12 bg-surface text-fg rounded border border-[var(--forms-color-border-default)] transition-all duration-200 az-text-input az-datepicker", o.value])
|
|
57
61
|
}, [
|
|
58
|
-
|
|
62
|
+
i("input", k({
|
|
59
63
|
id: n.id,
|
|
64
|
+
"data-testid": "datepicker-input",
|
|
60
65
|
class: "bg-transparent border-0 outline-none grow text-base font-normal text-fg az-text-input__control az-datepicker__control",
|
|
61
66
|
value: e.modelValue,
|
|
62
67
|
type: "date",
|
|
@@ -67,31 +72,34 @@ const h = ["id", "value", "name", "disabled", "aria-invalid", "readonly", "min",
|
|
|
67
72
|
min: s.value,
|
|
68
73
|
max: b.value
|
|
69
74
|
}, t.$attrs, { onInput: D }), null, 16, h),
|
|
70
|
-
a[1] || (a[1] =
|
|
75
|
+
a[1] || (a[1] = i("span", {
|
|
76
|
+
"data-testid": "datepicker-icon",
|
|
71
77
|
class: "pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 block w-4 h-4 az-datepicker__icon",
|
|
72
78
|
"aria-hidden": "true"
|
|
73
79
|
}, null, -1)),
|
|
74
80
|
n.isClearable && e.modelValue ? (m(), p("div", V, [
|
|
75
|
-
|
|
81
|
+
i("button", {
|
|
76
82
|
type: "button",
|
|
83
|
+
"data-testid": "datepicker-clear",
|
|
77
84
|
class: "flex items-center justify-center bg-transparent border-0 p-0 cursor-pointer",
|
|
78
85
|
onClick: v
|
|
79
86
|
}, [
|
|
80
|
-
a[0] || (a[0] =
|
|
87
|
+
a[0] || (a[0] = i("i", {
|
|
88
|
+
"data-testid": "datepicker-clear-icon",
|
|
81
89
|
class: "az az-ui-cross-circle-filled az-controls-options__icon",
|
|
82
90
|
"aria-hidden": "true"
|
|
83
91
|
}, null, -1)),
|
|
84
|
-
|
|
92
|
+
i("span", _, z(n.clearLabel), 1)
|
|
85
93
|
])
|
|
86
|
-
])) :
|
|
94
|
+
])) : y("", !0)
|
|
87
95
|
], 2));
|
|
88
96
|
}
|
|
89
|
-
}), C = (n,
|
|
97
|
+
}), C = (n, r) => {
|
|
90
98
|
const e = n.__vccOpts || n;
|
|
91
|
-
for (const [
|
|
92
|
-
e[
|
|
99
|
+
for (const [o, s] of r)
|
|
100
|
+
e[o] = s;
|
|
93
101
|
return e;
|
|
94
|
-
}, $ = /* @__PURE__ */ C(B, [["__scopeId", "data-v-
|
|
102
|
+
}, $ = /* @__PURE__ */ C(B, [["__scopeId", "data-v-db4d38f2"]]);
|
|
95
103
|
export {
|
|
96
104
|
$ as AzDatepicker
|
|
97
105
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(l,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue"),require("@ptlm-azulejo/icons/style.css")):typeof define=="function"&&define.amd?define(["exports","vue","@ptlm-azulejo/icons/style.css"],t):(l=typeof globalThis!="undefined"?globalThis:l||self,t(l.datepicker={},l.Vue))})(this,function(l,t){"use strict";const m=["id","value","name","disabled","aria-invalid","readonly","min","max"],p={key:0,class:"absolute right-11 top-3 az-datepicker__controls-options"},f={"data-testid":"datepicker-clear-label",class:"sr-only"},b=((i,s)=>{const e=i.__vccOpts||i;for(const[r,d]of s)e[r]=d;return e})(t.defineComponent({inheritAttrs:!1,__name:"index",props:{id:{},name:{},modelValue:{},isInvalid:{type:Boolean},disabled:{type:Boolean},size:{default:"m"},readonly:{type:Boolean},isClearable:{type:Boolean},clearLabel:{default:"clear content"},minDate:{},maxDate:{},enabledDates:{},disabledDates:{}},emits:["update:modelValue"],setup(i,{emit:s}){const e=i,r=t.computed(()=>({[`az-text-input--${e.size} az-datepicker--${e.size}`]:e.size&&e.size!="m","is-invalid":e.isInvalid})),d=t.computed(()=>{var n;const a=(n=e.enabledDates)!=null&&n.length?[...e.enabledDates].sort()[0]:void 0;return e.minDate&&a?e.minDate>a?e.minDate:a:a!=null?a:e.minDate}),D=t.computed(()=>{var n;const a=(n=e.enabledDates)!=null&&n.length?[...e.enabledDates].sort().pop():void 0;return e.maxDate&&a?e.maxDate<a?e.maxDate:a:a!=null?a:e.maxDate}),k=a=>{var n,o;return a?(n=e.enabledDates)!=null&&n.length?!e.enabledDates.includes(a):(o=e.disabledDates)!=null&&o.length?e.disabledDates.includes(a):!1:!1},x=()=>{c("update:modelValue","")},y=a=>{var u;const n=a.target,o=n.value;if(!o){c("update:modelValue","");return}if(k(o)){n.value=String((u=e.modelValue)!=null?u:"");return}c("update:modelValue",o)},c=s;return(a,n)=>(t.openBlock(),t.createElementBlock("div",{"data-testid":"datepicker",class:t.normalizeClass(["relative flex items-center gap-2 w-full h-12 bg-surface text-fg rounded border border-[var(--forms-color-border-default)] transition-all duration-200 az-text-input az-datepicker",r.value])},[t.createElementVNode("input",t.mergeProps({id:i.id,"data-testid":"datepicker-input",class:"bg-transparent border-0 outline-none grow text-base font-normal text-fg az-text-input__control az-datepicker__control",value:e.modelValue,type:"date",name:i.name,disabled:i.disabled,"aria-invalid":i.isInvalid,readonly:i.readonly,min:d.value,max:D.value},a.$attrs,{onInput:y}),null,16,m),n[1]||(n[1]=t.createElementVNode("span",{"data-testid":"datepicker-icon",class:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 block w-4 h-4 az-datepicker__icon","aria-hidden":"true"},null,-1)),i.isClearable&&e.modelValue?(t.openBlock(),t.createElementBlock("div",p,[t.createElementVNode("button",{type:"button","data-testid":"datepicker-clear",class:"flex items-center justify-center bg-transparent border-0 p-0 cursor-pointer",onClick:x},[n[0]||(n[0]=t.createElementVNode("i",{"data-testid":"datepicker-clear-icon",class:"az az-ui-cross-circle-filled az-controls-options__icon","aria-hidden":"true"},null,-1)),t.createElementVNode("span",f,t.toDisplayString(i.clearLabel),1)])])):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-db4d38f2"]]);l.AzDatepicker=b,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */.az-text-input[data-v-
|
|
1
|
+
/*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */.az-text-input[data-v-db4d38f2]:focus-within{box-shadow:0 0 0 .125rem var(--focus-color-mid,#fff),0 0 0 .25rem var(--focus-color-outer,#000);outline-offset:.125rem;outline:.125rem solid #0000}.az-text-input[data-v-db4d38f2]:hover:not(:focus-within){border-color:var(--forms-color-border-hover,#4d4d4d);box-shadow:0 0 0 .0625rem var(--forms-color-border-hover,#4d4d4d)}.az-text-input[data-v-db4d38f2]:has(input:disabled){background-color:var(--color-background-disabled);cursor:not-allowed;box-shadow:none;color:var(--color-text-disabled);pointer-events:none;border-color:#0000}.az-text-input[data-v-db4d38f2]:has(input[readonly]){border-color:var(--color-border-readonly,#ccc);pointer-events:none}.az-text-input.is-invalid[data-v-db4d38f2]{border-color:var(--color-status-standalone-error,#ea302d);box-shadow:0 0 0 .0625rem var(--color-status-standalone-error,#ea302d)}.az-text-input.is-invalid[data-v-db4d38f2]:hover:not(:focus-within){border-color:var(--color-status-standalone-error-hover,#c61112);box-shadow:0 0 0 .0625rem var(--color-status-standalone-error-hover,#c61112)}.az-text-input[data-v-db4d38f2]:has(.az-datepicker__controls-options),.az-text-input:has(.az-datepicker__controls-options) .az-text-input__control[data-v-db4d38f2]{padding-inline-end:0}.az-text-input--s[data-v-db4d38f2]{height:2rem}.az-text-input--s .az-text-input__control[data-v-db4d38f2]{padding:.375rem .6875rem;font-size:.875rem;line-height:1.3}.az-text-input__control[data-v-db4d38f2]{padding:.75rem .6875rem;line-height:1.3}.az-text-input__control[data-v-db4d38f2]::placeholder{color:var(--forms-color-placeholder,#666)}.az-datepicker__control[data-v-db4d38f2]{background-position:right .75rem center;background-repeat:no-repeat;padding:0 .75rem}.az-datepicker__control[data-v-db4d38f2]::-webkit-calendar-picker-indicator{opacity:0;padding-right:1rem;transform:scale(2)}.az-datepicker__icon[data-v-db4d38f2]{background-color:var(--color-icon-primary,#000);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M8.5 3c0-.55228-.44772-1-1-1s-1 .44772-1 1v1H3c-.55228 0-1 .44772-1 1v16c0 .5523.44772 1 1 1h18c.5523 0 1-.4477 1-1V5c0-.55228-.4477-1-1-1h-3.5V3c0-.55228-.4477-1-1-1s-1 .44772-1 1v1H13V3c0-.55228-.4477-1-1-1s-1 .44772-1 1v1H8.5V3Zm7 3H13v1c0 .55228-.4477 1-1 1s-1-.44772-1-1V6H8.5v1c0 .55228-.44772 1-1 1s-1-.44772-1-1V6H4v3.5h16V6h-2.5v1c0 .55228-.4477 1-1 1s-1-.44772-1-1V6ZM4 11.5V20h16v-8.5H4Z'/%3E%3C/svg%3E") 50%/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M8.5 3c0-.55228-.44772-1-1-1s-1 .44772-1 1v1H3c-.55228 0-1 .44772-1 1v16c0 .5523.44772 1 1 1h18c.5523 0 1-.4477 1-1V5c0-.55228-.4477-1-1-1h-3.5V3c0-.55228-.4477-1-1-1s-1 .44772-1 1v1H13V3c0-.55228-.4477-1-1-1s-1 .44772-1 1v1H8.5V3Zm7 3H13v1c0 .55228-.4477 1-1 1s-1-.44772-1-1V6H8.5v1c0 .55228-.44772 1-1 1s-1-.44772-1-1V6H4v3.5h16V6h-2.5v1c0 .55228-.4477 1-1 1s-1-.44772-1-1V6ZM4 11.5V20h16v-8.5H4Z'/%3E%3C/svg%3E") 50%/contain no-repeat}.az-datepicker__control[data-v-db4d38f2]:disabled{background-color:var(--color-background-disabled);cursor:not-allowed;box-shadow:none;color:var(--color-text-disabled);border-color:#0000}.az-text-input:has(input:disabled) .az-datepicker__icon[data-v-db4d38f2]{background-color:var(--color-icon-disabled,#737373)}.az-datepicker--s .az-datepicker__icon[data-v-db4d38f2]{width:1.25rem;height:1.25rem;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' width='1.25rem' height='1.25rem' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M7 2.5a.75.75 0 0 0-1.5 0v.917h-3a.75.75 0 0 0-.75.75V17.5c0 .414.336.75.75.75h15a.75.75 0 0 0 .75-.75V4.167a.75.75 0 0 0-.75-.75h-3V2.5a.75.75 0 0 0-1.5 0v.917h-2.25V2.5a.75.75 0 0 0-1.5 0v.917H7zm6 2.417h-2.25v.916a.75.75 0 0 1-1.5 0v-.916H7v.916a.75.75 0 1 1-1.5 0v-.916H3.25V8h13.5V4.917H14.5v.916a.75.75 0 0 1-1.5 0zM3.25 9.5v7.25h13.5V9.5z'/%3E%3C/svg%3E") 50%/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' width='1.25rem' height='1.25rem' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M7 2.5a.75.75 0 0 0-1.5 0v.917h-3a.75.75 0 0 0-.75.75V17.5c0 .414.336.75.75.75h15a.75.75 0 0 0 .75-.75V4.167a.75.75 0 0 0-.75-.75h-3V2.5a.75.75 0 0 0-1.5 0v.917h-2.25V2.5a.75.75 0 0 0-1.5 0v.917H7zm6 2.417h-2.25v.916a.75.75 0 0 1-1.5 0v-.916H7v.916a.75.75 0 1 1-1.5 0v-.916H3.25V8h13.5V4.917H14.5v.916a.75.75 0 0 1-1.5 0zM3.25 9.5v7.25h13.5V9.5z'/%3E%3C/svg%3E") 50%/contain no-repeat}.az-controls-options__icon[data-v-db4d38f2]{height:calc(var(--spacing,.25rem) * 4);width:calc(var(--spacing,.25rem) * 4);color:var(--forms-color-icon-clear,#666)}.az-text-input[data-v-db4d38f2] *{box-sizing:border-box}
|