@codeandfunction/callaloo 5.16.0 → 5.17.0

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.
Files changed (33) hide show
  1. package/dist/callaloo.global.js +1 -1
  2. package/dist/chunks/CLCalendar.vue_vue_type_style_index_0_lang-DUc5dHAZ.js +2 -0
  3. package/dist/components/Buttons/CLButton/CLButton.vue.d.ts +4 -4
  4. package/dist/components/Containers/CLCard/CLCard.vue.d.ts +2 -2
  5. package/dist/components/Containers/CLCarousel/CLCarousel.vue.d.ts +1 -1
  6. package/dist/components/Containers/CLDrawer/CLDrawer.vue.d.ts +2 -2
  7. package/dist/components/Form/CLCalendar/CLCalendar.css +1 -1
  8. package/dist/components/Form/CLCalendar/CLCalendar.js +1 -1
  9. package/dist/components/Form/CLCalendar/CLCalendar.vue.d.ts +14 -11
  10. package/dist/components/Form/CLCheckbox/CLCheckbox.vue.d.ts +3 -3
  11. package/dist/components/Form/CLInput/CLInput.vue.d.ts +3 -3
  12. package/dist/components/Form/CLInputDatePicker/CLInputDatePicker.js +1 -1
  13. package/dist/components/Form/CLInputDatePicker/CLInputDatePicker.vue.d.ts +25 -23
  14. package/dist/components/Form/CLInputTimePicker/CLInputTimePicker.vue.d.ts +10 -10
  15. package/dist/components/Form/CLInputTimePicker/index.d.ts +10 -10
  16. package/dist/components/Form/CLTimePicker/CLTimePicker.vue.d.ts +1 -1
  17. package/dist/components/Form/CLTimePicker/index.d.ts +1 -1
  18. package/dist/components/Indicators/CLBanner/CLBanner.vue.d.ts +2 -2
  19. package/dist/components/Loading/CLSkeleton/CLSkeleton.vue.d.ts +2 -2
  20. package/dist/components/Modals/CLModal/CLModal.vue.d.ts +1 -1
  21. package/dist/components/Modals/CLModalDatePicker/CLModalDatePicker.js +1 -1
  22. package/dist/components/Modals/CLModalDatePicker/CLModalDatePicker.vue.d.ts +24 -18
  23. package/dist/components/Modals/CLModalTimePicker/CLModalTimePicker.vue.d.ts +5 -5
  24. package/dist/components/Modals/CLModalTimePicker/index.d.ts +5 -5
  25. package/dist/components/Popups/CLDropdownMenu/CLDropdownMenu.vue.d.ts +9 -9
  26. package/dist/components/Popups/CLToast/CLToast.vue.d.ts +1 -1
  27. package/dist/composables/useDatePicker.d.ts +31 -21
  28. package/dist/composables/useDatePicker.js +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/styles.css +1 -1
  31. package/dist/types.d.ts +1 -0
  32. package/package.json +1 -1
  33. package/dist/chunks/CLCalendar.vue_vue_type_style_index_0_lang-PiGGhTHo.js +0 -2
@@ -0,0 +1,2 @@
1
+ import '../components/Form/CLCalendar/CLCalendar.css';
2
+ import{defineComponent as e,mergeModels as a,useCssVars as l,useModel as t,ref as i,toRef as d,watch as r,onMounted as s,createElementBlock as o,openBlock as n,normalizeStyle as u,normalizeClass as c,unref as p,createElementVNode as f,createVNode as v,withCtx as y,createTextVNode as m,toDisplayString as _,Fragment as b,renderList as h,createBlock as D,createCommentVNode as g}from"vue";import{_ as k}from"./CLButton.vue_vue_type_style_index_0_lang-pE0JrYmS.js";import{_ as w}from"./CLText.vue_vue_type_style_index_0_lang-CdA4TW0N.js";import{a as x,c as z,e as C,f as S,h as $,d as j,b as L,i as M}from"./index-DsloP0ml.js";import{c as T}from"./utils-jYeghjKF.js";import{useDatePicker as B}from"../composables/useDatePicker.js";import{useTheme as P}from"../composables/useTheme.js";const R=["data-testid"],E=/* @__PURE__ */e({name:"CLCalendar",__name:"CLCalendar",props:/* @__PURE__ */a({allowedDates:{type:[Array,Object,Function],default:void 0},color:{default:L.Primary},disabled:{type:Boolean,default:!1},busy:{type:Boolean,default:!1},isRange:{type:Boolean,default:!0},fluid:{type:Boolean,default:!1},testId:{default:"clll-calendar"},width:{default:"280px"}},{modelValue:{},modelModifiers:{}}),emits:/* @__PURE__ */a(["date-select"],["update:modelValue"]),setup(e,{expose:a,emit:E}){l(e=>({v2a0ead45:e.width}));const F=e,G=E,I=P(),N="clll-calendar",V=t(e,"modelValue"),A=i(V.value?.end??null),O=i(V.value?.start??null),{calendarGrid:q,cancelDraft:H,clearDraft:J,currentMonthLabel:K,draftEnd:Q,draftStart:U,getDayAriaLabel:W,handleNextMonth:X,handlePrevMonth:Y,initializeDraft:Z,isDraftEnd:ee,isDraftSameDay:ae,isDraftStart:le,isInDraftRange:te,onDayClick:ie,weekDays:de}=B({allowedDates:d(F,"allowedDates"),appliedEnd:A,appliedStart:O,isRange:d(F,"isRange")});r(V,e=>{O.value=e?.start??null,A.value=e?.end??null,Z()},{deep:!0}),s(()=>{Z()});return a({apply:()=>{O.value=U.value,A.value=Q.value,V.value={end:A.value,start:O.value}},cancel:()=>{H()},draftEnd:Q,draftStart:U,initializeDraft:Z,reset:()=>{J(),O.value=null,A.value=null,V.value=null}}),(a,l)=>(n(),o("div",{class:c([N,e.fluid?`${N}__fluid`:""]),"data-testid":e.testId,style:u(p(T)(p(I)))},[f("div",{class:c(`${N}__header`)},[v(p(k),{"aria-label":"Previous month","border-radius":p($).Full,"icon-before":p(S).ChevronLeft,"icon-size":p(C).Tiny,"on-click":p(Y),size:p(z).Tiny,variant:p(x).Ghost,height:"32px",width:"32px",wrap:""},null,8,["border-radius","icon-before","icon-size","on-click","size","variant"]),v(p(w),{type:p(j).Medium,medium:""},{default:y(()=>[m(_(p(K)),1)]),_:1},8,["type"]),v(p(k),{"aria-label":"Next month","border-radius":p($).Full,"icon-before":p(S).ChevronRight,"icon-size":p(C).Tiny,"on-click":p(X),size:p(z).Tiny,variant:p(x).Ghost,height:"32px",width:"32px",wrap:""},null,8,["border-radius","icon-before","icon-size","on-click","size","variant"])],2),f("div",{class:c(`${N}__grid`)},[(n(!0),o(b,null,h(p(de),e=>(n(),o("div",{key:e,class:c(`${N}__weekday`)},[v(p(w),{align:p(M).Center,color:p(L).Neutral,type:p(j).Small},{default:y(()=>[m(_(e),1)]),_:2},1032,["align","color","type"])],2))),128)),(n(!0),o(b,null,h(p(q),(a,l)=>(n(),o("div",{key:a.date??`pad-${l}`,class:c([`${N}__cell`,a.isOutsideMonth||a.isDisabled?`${N}__cell--outside`:"",a.date&&p(ae)(a.date)?`${N}__cell--same-day`:""])},[a.day&&a.date?(n(),D(p(k),{key:0,"aria-label":p(W)(a.date),"border-radius":p($).Full,color:p(le)(a.date)||p(ee)(a.date)?e.color:p(L).Secondary,disabled:e.disabled||e.busy||a.isDisabled,size:p(z).Small,height:"100%",width:"100%","on-click":e=>((e,a)=>{a?.preventDefault(),a?.stopPropagation(),F.disabled||F.busy||!e||(ie(e),G("date-select",e))})(a.date,e),variant:p(le)(a.date)||p(ee)(a.date)?p(x).Solid:p(te)(a.date)?p(x).Soft:p(x).Ghost,wrap:""},{default:y(()=>[m(_(a.day),1)]),_:2},1032,["aria-label","border-radius","color","disabled","size","on-click","variant"])):g("",!0)],2))),128))],2)],14,R))}});export{E as _};
@@ -58,18 +58,18 @@ export interface CLButtonProps {
58
58
  wrap?: boolean;
59
59
  }
60
60
  declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<CLButtonProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CLButtonProps> & Readonly<{}>, {
61
+ width: string;
62
+ height: string;
63
+ form: string;
64
+ title: string;
61
65
  size: CLSizes;
62
66
  color: CLColors;
63
67
  variant: CLColorVariants;
64
68
  rounded: boolean;
65
69
  testId: string;
66
70
  type: CLButtonTypes;
67
- form: string;
68
- title: string;
69
71
  onClick: (event?: Event) => void;
70
72
  target: CLLinkTarget;
71
- width: string;
72
- height: string;
73
73
  borderRadius: CLBorderRadius;
74
74
  iconFilled: boolean;
75
75
  iconSize: CLIconSizes;
@@ -66,14 +66,14 @@ export interface CLCardProps {
66
66
  width?: string;
67
67
  }
68
68
  declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<CLCardProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CLCardProps> & Readonly<{}>, {
69
+ width: string;
70
+ height: string;
69
71
  color: CLColors;
70
72
  variant: CLColorVariants;
71
73
  rounded: boolean;
72
74
  testId: string;
73
75
  type: CLCardTypes;
74
76
  target: CLLinkTarget;
75
- width: string;
76
- height: string;
77
77
  align: CLAlign;
78
78
  active: boolean;
79
79
  busy: boolean;
@@ -30,11 +30,11 @@ export interface CLCarouselProps {
30
30
  width?: string;
31
31
  }
32
32
  declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<CLCarouselProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CLCarouselProps> & Readonly<{}>, {
33
+ width: string;
33
34
  color: CLColors;
34
35
  variant: CLColorVariants;
35
36
  enabled: boolean;
36
37
  testId: string;
37
- width: string;
38
38
  moreLabel: string;
39
39
  paginationType: CLPaginationType;
40
40
  controlAlign: CLAlign;
@@ -44,10 +44,10 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<CL
44
44
  "onDrawer-open"?: (() => any) | undefined;
45
45
  "onDrawer-close"?: (() => any) | undefined;
46
46
  }>, {
47
- rounded: boolean;
48
- testId: string;
49
47
  left: string;
50
48
  width: string;
49
+ rounded: boolean;
50
+ testId: string;
51
51
  borderRadius: CLBorderRadius;
52
52
  position: CLDrawerPosition;
53
53
  snapPoint: number;
@@ -1 +1 @@
1
- .clll-calendar{display:flex;flex-direction:column;background-color:var(--clll-calendar-content-bg);box-sizing:border-box;width:var(--v5d82e3ae)}.clll-calendar__fluid{width:100%;max-width:none}.clll-calendar__header{display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--clll-unit-4)}.clll-calendar__grid{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--clll-unit-1)}.clll-calendar__weekday{text-align:center;padding-bottom:var(--clll-unit-1)}.clll-calendar__cell{aspect-ratio:1;display:flex;justify-content:center;align-items:center}.clll-calendar__cell--outside{opacity:.55}.clll-calendar__cell--same-day .clll-button{outline:2px solid var(--clll-button-bg-color);outline-offset:2px}
1
+ .clll-calendar{display:flex;flex-direction:column;background-color:var(--clll-calendar-content-bg);box-sizing:border-box;width:var(--v2a0ead45)}.clll-calendar__fluid{width:100%;max-width:none}.clll-calendar__header{display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--clll-unit-4)}.clll-calendar__grid{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--clll-unit-1)}.clll-calendar__weekday{text-align:center;padding-bottom:var(--clll-unit-1)}.clll-calendar__cell{aspect-ratio:1;display:flex;justify-content:center;align-items:center}.clll-calendar__cell--outside{opacity:.55}.clll-calendar__cell--same-day .clll-button{outline:2px solid var(--clll-button-bg-color);outline-offset:2px}
@@ -1,3 +1,3 @@
1
1
  import '../../../assets/core.css';
2
2
  import './CLCalendar.css';
3
- import{_ as a}from"../../../chunks/CLCalendar.vue_vue_type_style_index_0_lang-PiGGhTHo.js";export{a as CLCalendar,a as default};
3
+ import{_ as a}from"../../../chunks/CLCalendar.vue_vue_type_style_index_0_lang-DUc5dHAZ.js";export{a as CLCalendar,a as default};
@@ -1,6 +1,8 @@
1
1
  import { CLColors } from '../../../index.ts';
2
- import { ISODate } from '../../../composables/useDatePicker';
2
+ import { CLISODate, CLAllowedDates } from '../../../composables/useDatePicker';
3
3
  export interface CLCalendarProps {
4
+ /** Allowed dates or range of dates that can be selected. When specified, all other dates appear disabled. */
5
+ allowedDates?: CLAllowedDates;
4
6
  /** The color theme of the calendar selection. */
5
7
  color?: CLColors;
6
8
  /** Sets the disabled state. */
@@ -18,8 +20,8 @@ export interface CLCalendarProps {
18
20
  }
19
21
  declare const _default: import('vue').DefineComponent<{
20
22
  modelValue?: {
21
- end: ISODate | null;
22
- start: ISODate | null;
23
+ end: CLISODate | null;
24
+ start: CLISODate | null;
23
25
  } | null;
24
26
  } & CLCalendarProps, {
25
27
  apply: () => void;
@@ -30,28 +32,29 @@ declare const _default: import('vue').DefineComponent<{
30
32
  reset: () => void;
31
33
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
32
34
  "update:modelValue": (value: {
33
- end: ISODate | null;
34
- start: ISODate | null;
35
+ end: CLISODate | null;
36
+ start: CLISODate | null;
35
37
  } | null) => any;
36
38
  "date-select": (date: string) => any;
37
39
  }, string, import('vue').PublicProps, Readonly<{
38
40
  modelValue?: {
39
- end: ISODate | null;
40
- start: ISODate | null;
41
+ end: CLISODate | null;
42
+ start: CLISODate | null;
41
43
  } | null;
42
44
  } & CLCalendarProps> & Readonly<{
43
45
  "onUpdate:modelValue"?: ((value: {
44
- end: ISODate | null;
45
- start: ISODate | null;
46
+ end: CLISODate | null;
47
+ start: CLISODate | null;
46
48
  } | null) => any) | undefined;
47
49
  "onDate-select"?: ((date: string) => any) | undefined;
48
50
  }>, {
51
+ width: string;
52
+ allowedDates: CLAllowedDates;
53
+ isRange: boolean;
49
54
  color: CLColors;
50
55
  fluid: boolean;
51
56
  testId: string;
52
- width: string;
53
57
  busy: boolean;
54
58
  disabled: boolean;
55
- isRange: boolean;
56
59
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
57
60
  export default _default;
@@ -52,18 +52,18 @@ declare const _default: import('vue').DefineComponent<{
52
52
  } & CLCheckboxProps> & Readonly<{
53
53
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
54
54
  }>, {
55
+ form: string;
56
+ label: string;
57
+ value: string | number | boolean;
55
58
  size: CLSizes;
56
59
  color: CLColors;
57
60
  variant: CLColorVariants.Outline | CLColorVariants.Ghost;
58
61
  rounded: boolean;
59
62
  testId: string;
60
- form: string;
61
- label: string;
62
63
  onFocus: CLGenericFocusFunction;
63
64
  onBlur: CLGenericFocusFunction;
64
65
  onChange: CLGenericFunction;
65
66
  borderRadius: CLBorderRadius;
66
- value: string | number | boolean;
67
67
  required: boolean;
68
68
  ariaLabel: string;
69
69
  busy: boolean;
@@ -92,6 +92,9 @@ declare const _default: import('vue').DefineComponent<{
92
92
  onReset?: ((...args: any[]) => any) | undefined;
93
93
  "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
94
94
  }>, {
95
+ form: string;
96
+ label: string;
97
+ pattern: string;
95
98
  size: CLSizes;
96
99
  color: CLColors;
97
100
  variant: CLColorVariants.Outline | CLColorVariants.Ghost;
@@ -99,9 +102,6 @@ declare const _default: import('vue').DefineComponent<{
99
102
  rounded: boolean;
100
103
  testId: string;
101
104
  type: CLInputTypes;
102
- form: string;
103
- label: string;
104
- pattern: string;
105
105
  onFocus: CLGenericFocusFunction;
106
106
  onBlur: CLGenericFocusFunction;
107
107
  onChange: CLGenericFunction;
@@ -1,3 +1,3 @@
1
1
  import '../../../assets/core.css';
2
2
  import './CLInputDatePicker.css';
3
- import{defineComponent as e,mergeModels as a,ref as l,useModel as t,watch as u,computed as n,onMounted as d,onBeforeUnmount as s,createElementBlock as o,openBlock as i,normalizeClass as r,createVNode as f,createCommentVNode as m,unref as p,isRef as c,normalizeStyle as v,withCtx as b,createElementVNode as y}from"vue";import{u as g,a as _,o as h,f as k,s as C}from"../../../chunks/floating-ui.vue-C0JWy0Dz.js";import{_ as D}from"../../../chunks/CLCard.vue_vue_type_style_index_0_lang-CY-Qr_CV.js";import{CLInput as Y}from"../CLInput/CLInput.js";import{_ as R}from"../../../chunks/CLCalendar.vue_vue_type_style_index_0_lang-PiGGhTHo.js";import{f as I,a as L,n as V,c as x,b as M}from"../../../chunks/index-DsloP0ml.js";import{a as B}from"../../../chunks/index-wkMXT2wB.js";import{i as j}from"../../../chunks/helper-BlxFN3eF.js";import{useEsc as E}from"../../../composables/useEsc.js";import{useDateInputMask as F}from"../../../composables/useDateInputMask.js";const S=/* @__PURE__ */e({name:"CLInputDatePicker",__name:"CLInputDatePicker",props:/* @__PURE__ */a({ariaLabel:{default:void 0},borderRadius:{default:void 0},color:{default:M.Neutral},size:{default:x.Small},variant:{default:L.Outline},busy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},fluid:{type:Boolean,default:!1},form:{default:void 0},id:{},isRange:{type:Boolean,default:!0},label:{default:void 0},messages:{default:()=>[]},messageType:{default:void 0},name:{},onBlur:{type:Function,default:void 0},onChange:{type:Function,default:void 0},onFocus:{type:Function,default:void 0},orientation:{default:B.Vertical},placement:{default:V.BottomStart},placeholder:{default:void 0},required:{type:Boolean,default:!1},rounded:{type:Boolean,default:!0},testId:{default:"clll-input-date-picker"}},{modelValue:{default:()=>({end:null,start:null})},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const a=e,V="clll-input-date-picker",x=l(!1),M=l(),B=l(),S=l(),$=t(e,"modelValue"),z=l(""),{handleDateInput:w,isoToSlash:q,slashToISO:T,validateDate:O}=F();u($,()=>{const e=q($.value?.start??null),l=q($.value?.end??null);e?a.isRange&&l?z.value=`${e} - ${l}`:z.value=e:z.value=""},{immediate:!0,deep:!0});const P=n(()=>M.value?.$el),{floatingStyles:U}=g(P,S,{middleware:[h(8),k(),C()],placement:l(a.placement),whileElementsMounted:_,open:x}),G=()=>{a.disabled||a.busy||(x.value=!x.value,x.value?(a.onFocus?.(new FocusEvent("focus")),B.value?.initializeDraft()):a.onBlur?.(new FocusEvent("blur")))},H=n(()=>{const e=B.value?.draftStart,l=B.value?.draftEnd;return a.isRange?!!e&&!!l:!!e}),N=()=>{x.value&&(x.value=!1,a.onBlur?.(new FocusEvent("blur")))};E({escHandler:N});const A=e=>{const a=e.target,l=M.value?.$el,t=S.value;x.value&&l&&t&&!l.contains(a)&&!t.contains(a)&&N()},J=()=>{H.value&&(B.value?.apply(),N(),a.onChange?.())},K=e=>{const l=O(e,a.isRange),t=M.value?.inputRef;return t&&(e&&!l?t.setCustomValidity("Invalid date format. Use YYYY/MM/DD"):t.setCustomValidity("")),l},Q=e=>{e&&w(e,z,a.isRange,()=>{K(z.value)})},W=e=>{if(!e)return;const l=e.target.value,t=K(l);if(!l.trim())return $.value={start:null,end:null},void a.onChange?.();if(t){if(a.isRange){const[e,a]=l.split("-").map(e=>e.trim());$.value={start:T(e),end:T(a)}}else $.value={start:T(l.trim()),end:null};a.onChange?.()}};return d(()=>{j&&document.addEventListener("click",A)}),s(()=>{j&&document.removeEventListener("click",A)}),(a,l)=>(i(),o("div",{class:r([V,e.fluid?`${V}--fluid`:""])},[f(p(Y),{id:e.id,ref_key:"inputRef",ref:M,modelValue:p(z),"onUpdate:modelValue":l[0]||(l[0]=e=>c(z)?z.value=e:null),"aria-label":e.ariaLabel,"border-radius":e.borderRadius,busy:e.busy,color:e.color,disabled:e.disabled,fluid:e.fluid,form:e.form,label:e.label,messages:e.messages,"message-type":e.messageType,name:e.name,orientation:e.orientation,placeholder:e.placeholder||(e.isRange?"YYYY/MM/DD - YYYY/MM/DD":"YYYY/MM/DD"),required:e.required,rounded:e.rounded,size:e.size,suffix:p(I).Calendar,"suffix-aria-label":e.ariaLabel||"Open calendar","test-id":e.testId,variant:e.variant,onInput:Q,onChange:W,onSuffixClick:G},null,8,["id","modelValue","aria-label","border-radius","busy","color","disabled","fluid","form","label","messages","message-type","name","orientation","placeholder","required","rounded","size","suffix","suffix-aria-label","test-id","variant"]),p(x)?(i(),o("div",{key:0,ref_key:"popoverRef",ref:S,class:r(`${V}__popover`),style:v({...p(U),zIndex:100})},[f(p(D),{"border-radius":e.borderRadius,variant:p(L).Ghost,padded:!1,rounded:e.rounded,elevated:""},{default:b(()=>[y("div",{class:r(`${V}__calendar-container`)},[f(p(R),{ref_key:"calendarRef",ref:B,modelValue:$.value,"onUpdate:modelValue":l[1]||(l[1]=e=>$.value=e),disabled:e.disabled,busy:e.busy,"is-range":e.isRange,fluid:"",onDateSelect:J},null,8,["modelValue","disabled","busy","is-range"])],2)]),_:1},8,["border-radius","variant","rounded"])],6)):m("",!0)],2))}});export{S as CLInputDatePicker,S as default};
3
+ import{defineComponent as e,mergeModels as a,ref as l,useModel as t,watch as u,computed as n,onMounted as d,onBeforeUnmount as s,createElementBlock as o,openBlock as i,normalizeClass as r,createVNode as f,createCommentVNode as m,unref as p,isRef as c,normalizeStyle as v,withCtx as b,createElementVNode as y}from"vue";import{u as g,a as _,o as h,f as k,s as C}from"../../../chunks/floating-ui.vue-C0JWy0Dz.js";import{_ as D}from"../../../chunks/CLCard.vue_vue_type_style_index_0_lang-CY-Qr_CV.js";import{CLInput as Y}from"../CLInput/CLInput.js";import{_ as R}from"../../../chunks/CLCalendar.vue_vue_type_style_index_0_lang-DUc5dHAZ.js";import{f as I,a as L,n as V,c as x,b as M}from"../../../chunks/index-DsloP0ml.js";import{a as B}from"../../../chunks/index-wkMXT2wB.js";import{i as j}from"../../../chunks/helper-BlxFN3eF.js";import{useEsc as E}from"../../../composables/useEsc.js";import{useDateInputMask as F}from"../../../composables/useDateInputMask.js";const S=/* @__PURE__ */e({name:"CLInputDatePicker",__name:"CLInputDatePicker",props:/* @__PURE__ */a({ariaLabel:{default:void 0},borderRadius:{default:void 0},color:{default:M.Neutral},size:{default:x.Small},variant:{default:L.Outline},busy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},fluid:{type:Boolean,default:!1},form:{default:void 0},id:{},isRange:{type:Boolean,default:!0},label:{default:void 0},messages:{default:()=>[]},messageType:{default:void 0},name:{},onBlur:{type:Function,default:void 0},onChange:{type:Function,default:void 0},onFocus:{type:Function,default:void 0},orientation:{default:B.Vertical},placement:{default:V.BottomStart},placeholder:{default:void 0},required:{type:Boolean,default:!1},rounded:{type:Boolean,default:!0},testId:{default:"clll-input-date-picker"}},{modelValue:{default:()=>({end:null,start:null})},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const a=e,V="clll-input-date-picker",x=l(!1),M=l(),B=l(),S=l(),$=t(e,"modelValue"),z=l(""),{handleDateInput:w,isoToSlash:q,slashToISO:T,validateDate:O}=F();u($,()=>{const e=q($.value?.start??null),l=q($.value?.end??null);e?a.isRange&&l?z.value=`${e} - ${l}`:z.value=e:z.value=""},{immediate:!0,deep:!0});const P=n(()=>M.value?.$el),{floatingStyles:U}=g(P,S,{middleware:[h(8),k(),C()],placement:l(a.placement),whileElementsMounted:_,open:x}),G=()=>{a.disabled||a.busy||(x.value=!x.value,x.value?(a.onFocus?.(new FocusEvent("focus")),B.value?.initializeDraft()):a.onBlur?.(new FocusEvent("blur")))},H=n(()=>{const e=B.value?.draftStart,l=B.value?.draftEnd;return a.isRange?!!e&&!!l:!!e}),N=()=>{x.value&&(x.value=!1,a.onBlur?.(new FocusEvent("blur")))};E({escHandler:N});const A=e=>{const a=e.target,l=M.value?.$el,t=S.value;x.value&&l&&t&&!l.contains(a)&&!t.contains(a)&&N()},J=()=>{H.value&&(B.value?.apply(),N(),a.onChange?.())},K=e=>{const l=O(e,a.isRange),t=M.value?.inputRef;return t&&(e&&!l?t.setCustomValidity("Invalid date format. Use YYYY/MM/DD"):t.setCustomValidity("")),l},Q=e=>{e&&w(e,z,a.isRange,()=>{K(z.value)})},W=e=>{if(!e)return;const l=e.target.value,t=K(l);if(!l.trim())return $.value={start:null,end:null},void a.onChange?.();if(t){if(a.isRange){const[e,a]=l.split("-").map(e=>e.trim());$.value={start:T(e),end:T(a)}}else $.value={start:T(l.trim()),end:null};a.onChange?.()}};return d(()=>{j&&document.addEventListener("click",A)}),s(()=>{j&&document.removeEventListener("click",A)}),(a,l)=>(i(),o("div",{class:r([V,e.fluid?`${V}--fluid`:""])},[f(p(Y),{id:e.id,ref_key:"inputRef",ref:M,modelValue:p(z),"onUpdate:modelValue":l[0]||(l[0]=e=>c(z)?z.value=e:null),"aria-label":e.ariaLabel,"border-radius":e.borderRadius,busy:e.busy,color:e.color,disabled:e.disabled,fluid:e.fluid,form:e.form,label:e.label,messages:e.messages,"message-type":e.messageType,name:e.name,orientation:e.orientation,placeholder:e.placeholder||(e.isRange?"YYYY/MM/DD - YYYY/MM/DD":"YYYY/MM/DD"),required:e.required,rounded:e.rounded,size:e.size,suffix:p(I).Calendar,"suffix-aria-label":e.ariaLabel||"Open calendar","test-id":e.testId,variant:e.variant,onInput:Q,onChange:W,onSuffixClick:G},null,8,["id","modelValue","aria-label","border-radius","busy","color","disabled","fluid","form","label","messages","message-type","name","orientation","placeholder","required","rounded","size","suffix","suffix-aria-label","test-id","variant"]),p(x)?(i(),o("div",{key:0,ref_key:"popoverRef",ref:S,class:r(`${V}__popover`),style:v({...p(U),zIndex:100})},[f(p(D),{"border-radius":e.borderRadius,variant:p(L).Ghost,padded:!1,rounded:e.rounded,elevated:""},{default:b(()=>[y("div",{class:r(`${V}__calendar-container`)},[f(p(R),{ref_key:"calendarRef",ref:B,modelValue:$.value,"onUpdate:modelValue":l[1]||(l[1]=e=>$.value=e),disabled:e.disabled,busy:e.busy,"is-range":e.isRange,fluid:"",onDateSelect:J},null,8,["modelValue","disabled","busy","is-range"])],2)]),_:1},8,["border-radius","variant","rounded"])],6)):m("",!0)],2))}});export{S as CLInputDatePicker,S as default};
@@ -70,14 +70,15 @@ declare const _default: import('vue').DefineComponent<{
70
70
  start: string | null;
71
71
  } | null) => any) | undefined;
72
72
  }>, {
73
+ form: string;
74
+ label: string;
75
+ isRange: boolean;
73
76
  size: CLSizes;
74
77
  color: CLColors;
75
78
  variant: CLColorVariants.Outline | CLColorVariants.Ghost;
76
79
  fluid: boolean;
77
80
  rounded: boolean;
78
81
  testId: string;
79
- form: string;
80
- label: string;
81
82
  onFocus: CLGenericFocusFunction;
82
83
  onBlur: CLGenericFocusFunction;
83
84
  onChange: CLGenericFunction;
@@ -87,7 +88,6 @@ declare const _default: import('vue').DefineComponent<{
87
88
  busy: boolean;
88
89
  disabled: boolean;
89
90
  placeholder: string;
90
- isRange: boolean;
91
91
  orientation: CLOrientation;
92
92
  messages: string[];
93
93
  messageType: CLColors;
@@ -104,6 +104,9 @@ declare const _default: import('vue').DefineComponent<{
104
104
  reset: (...args: any[]) => void;
105
105
  "update:modelValue": (value: string | number) => void;
106
106
  }, import('vue').PublicProps, {
107
+ form: string;
108
+ label: string;
109
+ pattern: string;
107
110
  size: CLSizes;
108
111
  color: CLColors;
109
112
  variant: CLColorVariants.Outline | CLColorVariants.Ghost;
@@ -111,9 +114,6 @@ declare const _default: import('vue').DefineComponent<{
111
114
  rounded: boolean;
112
115
  testId: string;
113
116
  type: import('@codeandfunction/callaloo-types').CLInputTypes;
114
- form: string;
115
- label: string;
116
- pattern: string;
117
117
  onFocus: CLGenericFocusFunction;
118
118
  onBlur: CLGenericFocusFunction;
119
119
  onChange: CLGenericFunction;
@@ -158,6 +158,9 @@ declare const _default: import('vue').DefineComponent<{
158
158
  }>, {
159
159
  inputRef: Readonly<globalThis.ShallowRef<HTMLInputElement | null>>;
160
160
  }, {}, {}, {}, {
161
+ form: string;
162
+ label: string;
163
+ pattern: string;
161
164
  size: CLSizes;
162
165
  color: CLColors;
163
166
  variant: CLColorVariants.Outline | CLColorVariants.Ghost;
@@ -165,9 +168,6 @@ declare const _default: import('vue').DefineComponent<{
165
168
  rounded: boolean;
166
169
  testId: string;
167
170
  type: import('@codeandfunction/callaloo-types').CLInputTypes;
168
- form: string;
169
- label: string;
170
- pattern: string;
171
171
  onFocus: CLGenericFocusFunction;
172
172
  onBlur: CLGenericFocusFunction;
173
173
  onChange: CLGenericFunction;
@@ -199,13 +199,13 @@ declare const _default: import('vue').DefineComponent<{
199
199
  popoverRef: HTMLDivElement;
200
200
  calendarRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
201
201
  modelValue?: {
202
- end: import('../../../composables/useDatePicker').ISODate | null;
203
- start: import('../../../composables/useDatePicker').ISODate | null;
202
+ end: import('../../../index.ts').CLISODate | null;
203
+ start: import('../../../index.ts').CLISODate | null;
204
204
  } | null;
205
205
  } & import('../CLCalendar/CLCalendar.vue').CLCalendarProps> & Readonly<{
206
206
  "onUpdate:modelValue"?: ((value: {
207
- end: import('../../../composables/useDatePicker').ISODate | null;
208
- start: import('../../../composables/useDatePicker').ISODate | null;
207
+ end: import('../../../index.ts').CLISODate | null;
208
+ start: import('../../../index.ts').CLISODate | null;
209
209
  } | null) => any) | undefined;
210
210
  "onDate-select"?: ((date: string) => any) | undefined;
211
211
  }>, {
@@ -217,18 +217,19 @@ declare const _default: import('vue').DefineComponent<{
217
217
  reset: () => void;
218
218
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
219
219
  "update:modelValue": (value: {
220
- end: import('../../../composables/useDatePicker').ISODate | null;
221
- start: import('../../../composables/useDatePicker').ISODate | null;
220
+ end: import('../../../index.ts').CLISODate | null;
221
+ start: import('../../../index.ts').CLISODate | null;
222
222
  } | null) => any;
223
223
  "date-select": (date: string) => any;
224
224
  }, import('vue').PublicProps, {
225
+ width: string;
226
+ allowedDates: import('../../../index.ts').CLAllowedDates;
227
+ isRange: boolean;
225
228
  color: CLColors;
226
229
  fluid: boolean;
227
230
  testId: string;
228
- width: string;
229
231
  busy: boolean;
230
232
  disabled: boolean;
231
- isRange: boolean;
232
233
  }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
233
234
  P: {};
234
235
  B: {};
@@ -238,13 +239,13 @@ declare const _default: import('vue').DefineComponent<{
238
239
  Defaults: {};
239
240
  }, Readonly<{
240
241
  modelValue?: {
241
- end: import('../../../composables/useDatePicker').ISODate | null;
242
- start: import('../../../composables/useDatePicker').ISODate | null;
242
+ end: import('../../../index.ts').CLISODate | null;
243
+ start: import('../../../index.ts').CLISODate | null;
243
244
  } | null;
244
245
  } & import('../CLCalendar/CLCalendar.vue').CLCalendarProps> & Readonly<{
245
246
  "onUpdate:modelValue"?: ((value: {
246
- end: import('../../../composables/useDatePicker').ISODate | null;
247
- start: import('../../../composables/useDatePicker').ISODate | null;
247
+ end: import('../../../index.ts').CLISODate | null;
248
+ start: import('../../../index.ts').CLISODate | null;
248
249
  } | null) => any) | undefined;
249
250
  "onDate-select"?: ((date: string) => any) | undefined;
250
251
  }>, {
@@ -255,13 +256,14 @@ declare const _default: import('vue').DefineComponent<{
255
256
  initializeDraft: () => void;
256
257
  reset: () => void;
257
258
  }, {}, {}, {}, {
259
+ width: string;
260
+ allowedDates: import('../../../index.ts').CLAllowedDates;
261
+ isRange: boolean;
258
262
  color: CLColors;
259
263
  fluid: boolean;
260
264
  testId: string;
261
- width: string;
262
265
  busy: boolean;
263
266
  disabled: boolean;
264
- isRange: boolean;
265
267
  }> | null;
266
268
  }, HTMLDivElement>;
267
269
  export default _default;
@@ -60,14 +60,14 @@ declare const _default: import('vue').DefineComponent<{
60
60
  } & CLInputTimePickerProps> & Readonly<{
61
61
  "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
62
62
  }>, {
63
+ form: string;
64
+ label: string;
63
65
  size: CLSizes;
64
66
  color: CLColors;
65
67
  variant: CLColorVariants.Outline | CLColorVariants.Ghost;
66
68
  fluid: boolean;
67
69
  rounded: boolean;
68
70
  testId: string;
69
- form: string;
70
- label: string;
71
71
  onFocus: CLGenericFocusFunction;
72
72
  onBlur: CLGenericFocusFunction;
73
73
  onChange: CLGenericFunction;
@@ -95,6 +95,9 @@ declare const _default: import('vue').DefineComponent<{
95
95
  reset: (...args: any[]) => void;
96
96
  "update:modelValue": (value: string | number) => void;
97
97
  }, import('vue').PublicProps, {
98
+ form: string;
99
+ label: string;
100
+ pattern: string;
98
101
  size: CLSizes;
99
102
  color: CLColors;
100
103
  variant: CLColorVariants.Outline | CLColorVariants.Ghost;
@@ -102,9 +105,6 @@ declare const _default: import('vue').DefineComponent<{
102
105
  rounded: boolean;
103
106
  testId: string;
104
107
  type: import('@codeandfunction/callaloo-types').CLInputTypes;
105
- form: string;
106
- label: string;
107
- pattern: string;
108
108
  onFocus: CLGenericFocusFunction;
109
109
  onBlur: CLGenericFocusFunction;
110
110
  onChange: CLGenericFunction;
@@ -149,6 +149,9 @@ declare const _default: import('vue').DefineComponent<{
149
149
  }>, {
150
150
  inputRef: Readonly<globalThis.ShallowRef<HTMLInputElement | null>>;
151
151
  }, {}, {}, {}, {
152
+ form: string;
153
+ label: string;
154
+ pattern: string;
152
155
  size: CLSizes;
153
156
  color: CLColors;
154
157
  variant: CLColorVariants.Outline | CLColorVariants.Ghost;
@@ -156,9 +159,6 @@ declare const _default: import('vue').DefineComponent<{
156
159
  rounded: boolean;
157
160
  testId: string;
158
161
  type: import('@codeandfunction/callaloo-types').CLInputTypes;
159
- form: string;
160
- label: string;
161
- pattern: string;
162
162
  onFocus: CLGenericFocusFunction;
163
163
  onBlur: CLGenericFocusFunction;
164
164
  onChange: CLGenericFunction;
@@ -206,10 +206,10 @@ declare const _default: import('vue').DefineComponent<{
206
206
  "update:modelValue": (value: string | null) => any;
207
207
  "time-select": (time: string) => any;
208
208
  }, import('vue').PublicProps, {
209
+ width: string;
209
210
  color: CLColors;
210
211
  fluid: boolean;
211
212
  testId: string;
212
- width: string;
213
213
  use24Hour: boolean;
214
214
  busy: boolean;
215
215
  disabled: boolean;
@@ -236,10 +236,10 @@ declare const _default: import('vue').DefineComponent<{
236
236
  initializeDraft: () => void;
237
237
  reset: () => void;
238
238
  }, {}, {}, {}, {
239
+ width: string;
239
240
  color: CLColors;
240
241
  fluid: boolean;
241
242
  testId: string;
242
- width: string;
243
243
  use24Hour: boolean;
244
244
  busy: boolean;
245
245
  disabled: boolean;
@@ -8,14 +8,14 @@ export declare const CLInputTimePicker: import('vue').DefineComponent<{
8
8
  } & import('./CLInputTimePicker.vue').CLInputTimePickerProps> & Readonly<{
9
9
  "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
10
10
  }>, {
11
+ form: string;
12
+ label: string;
11
13
  size: import('@codeandfunction/callaloo-tokens').CLSizes;
12
14
  color: import('@codeandfunction/callaloo-tokens').CLColors;
13
15
  variant: import("@codeandfunction/callaloo-tokens").CLColorVariants.Outline | import("@codeandfunction/callaloo-tokens").CLColorVariants.Ghost;
14
16
  fluid: boolean;
15
17
  rounded: boolean;
16
18
  testId: string;
17
- form: string;
18
- label: string;
19
19
  onFocus: import('../../..').CLGenericFocusFunction;
20
20
  onBlur: import('../../..').CLGenericFocusFunction;
21
21
  onChange: import('../../..').CLGenericFunction;
@@ -43,6 +43,9 @@ export declare const CLInputTimePicker: import('vue').DefineComponent<{
43
43
  reset: (...args: any[]) => void;
44
44
  "update:modelValue": (value: string | number) => void;
45
45
  }, import('vue').PublicProps, {
46
+ form: string;
47
+ label: string;
48
+ pattern: string;
46
49
  size: import('@codeandfunction/callaloo-tokens').CLSizes;
47
50
  color: import('@codeandfunction/callaloo-tokens').CLColors;
48
51
  variant: import("@codeandfunction/callaloo-tokens").CLColorVariants.Outline | import("@codeandfunction/callaloo-tokens").CLColorVariants.Ghost;
@@ -50,9 +53,6 @@ export declare const CLInputTimePicker: import('vue').DefineComponent<{
50
53
  rounded: boolean;
51
54
  testId: string;
52
55
  type: import('@codeandfunction/callaloo-types').CLInputTypes;
53
- form: string;
54
- label: string;
55
- pattern: string;
56
56
  onFocus: import('../../..').CLGenericFocusFunction;
57
57
  onBlur: import('../../..').CLGenericFocusFunction;
58
58
  onChange: import('../../..').CLGenericFunction;
@@ -97,6 +97,9 @@ export declare const CLInputTimePicker: import('vue').DefineComponent<{
97
97
  }>, {
98
98
  inputRef: Readonly<globalThis.ShallowRef<HTMLInputElement | null>>;
99
99
  }, {}, {}, {}, {
100
+ form: string;
101
+ label: string;
102
+ pattern: string;
100
103
  size: import('@codeandfunction/callaloo-tokens').CLSizes;
101
104
  color: import('@codeandfunction/callaloo-tokens').CLColors;
102
105
  variant: import("@codeandfunction/callaloo-tokens").CLColorVariants.Outline | import("@codeandfunction/callaloo-tokens").CLColorVariants.Ghost;
@@ -104,9 +107,6 @@ export declare const CLInputTimePicker: import('vue').DefineComponent<{
104
107
  rounded: boolean;
105
108
  testId: string;
106
109
  type: import('@codeandfunction/callaloo-types').CLInputTypes;
107
- form: string;
108
- label: string;
109
- pattern: string;
110
110
  onFocus: import('../../..').CLGenericFocusFunction;
111
111
  onBlur: import('../../..').CLGenericFocusFunction;
112
112
  onChange: import('../../..').CLGenericFunction;
@@ -154,10 +154,10 @@ export declare const CLInputTimePicker: import('vue').DefineComponent<{
154
154
  "update:modelValue": (value: string | null) => any;
155
155
  "time-select": (time: string) => any;
156
156
  }, import('vue').PublicProps, {
157
+ width: string;
157
158
  color: import('@codeandfunction/callaloo-tokens').CLColors;
158
159
  fluid: boolean;
159
160
  testId: string;
160
- width: string;
161
161
  use24Hour: boolean;
162
162
  busy: boolean;
163
163
  disabled: boolean;
@@ -184,10 +184,10 @@ export declare const CLInputTimePicker: import('vue').DefineComponent<{
184
184
  initializeDraft: () => void;
185
185
  reset: () => void;
186
186
  }, {}, {}, {}, {
187
+ width: string;
187
188
  color: import('@codeandfunction/callaloo-tokens').CLColors;
188
189
  fluid: boolean;
189
190
  testId: string;
190
- width: string;
191
191
  use24Hour: boolean;
192
192
  busy: boolean;
193
193
  disabled: boolean;
@@ -38,10 +38,10 @@ declare const _default: import('vue').DefineComponent<{
38
38
  "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
39
39
  "onTime-select"?: ((time: string) => any) | undefined;
40
40
  }>, {
41
+ width: string;
41
42
  color: CLColors;
42
43
  fluid: boolean;
43
44
  testId: string;
44
- width: string;
45
45
  use24Hour: boolean;
46
46
  busy: boolean;
47
47
  disabled: boolean;
@@ -19,10 +19,10 @@ export declare const CLTimePicker: import('vue').DefineComponent<{
19
19
  "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
20
20
  "onTime-select"?: ((time: string) => any) | undefined;
21
21
  }>, {
22
+ width: string;
22
23
  color: import('@codeandfunction/callaloo-tokens').CLColors;
23
24
  fluid: boolean;
24
25
  testId: string;
25
- width: string;
26
26
  use24Hour: boolean;
27
27
  busy: boolean;
28
28
  disabled: boolean;
@@ -36,12 +36,12 @@ export interface CLBannerProps {
36
36
  variant?: CLColorVariants.Ghost | CLColorVariants.Outline | CLColorVariants.Soft | CLColorVariants.Solid;
37
37
  }
38
38
  declare const _default: import('vue').DefineComponent<CLBannerProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CLBannerProps> & Readonly<{}>, {
39
+ width: string;
40
+ height: string;
39
41
  color: CLColors;
40
42
  variant: CLColorVariants.Ghost | CLColorVariants.Outline | CLColorVariants.Soft | CLColorVariants.Solid;
41
43
  rounded: boolean;
42
44
  testId: string;
43
- width: string;
44
- height: string;
45
45
  align: CLAlign;
46
46
  busy: boolean;
47
47
  bordered: boolean;
@@ -12,9 +12,9 @@ export interface CLSkeletonProps {
12
12
  width?: string;
13
13
  }
14
14
  declare const _default: import('vue').DefineComponent<CLSkeletonProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CLSkeletonProps> & Readonly<{}>, {
15
- rounded: boolean;
16
- testId: string;
17
15
  width: string;
18
16
  height: string;
17
+ rounded: boolean;
18
+ testId: string;
19
19
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
20
20
  export default _default;
@@ -38,9 +38,9 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<CL
38
38
  "onModal-open"?: (() => any) | undefined;
39
39
  "onModal-close"?: (() => any) | undefined;
40
40
  }>, {
41
+ title: string;
41
42
  close: boolean;
42
43
  testId: string;
43
- title: string;
44
44
  borderRadius: CLBorderRadius;
45
45
  overlay: boolean;
46
46
  dismissible: boolean;
@@ -1,3 +1,3 @@
1
1
  import '../../../assets/core.css';
2
2
  import './CLModalDatePicker.css';
3
- import{defineComponent as e,mergeModels as a,ref as t,computed as l,useModel as i,onMounted as d,onBeforeUnmount as o,createBlock as r,openBlock as u,withCtx as n,createElementVNode as s,normalizeClass as b,unref as c,createCommentVNode as f,createVNode as p,createElementBlock as m,createTextVNode as _,toDisplayString as v,nextTick as y}from"vue";import{_ as h}from"../../../chunks/CLButton.vue_vue_type_style_index_0_lang-pE0JrYmS.js";import{_ as L}from"../../../chunks/CLFormField.vue_vue_type_style_index_0_lang-Rf_Mo_VS.js";import{_ as k}from"../../../chunks/CLFormLabel.vue_vue_type_script_setup_true_lang-DoM5X-sA.js";import{_ as $}from"../../../chunks/CLModal.vue_vue_type_style_index_0_lang-DLUfvRC_.js";import{_ as g}from"../../../chunks/CLCalendar.vue_vue_type_style_index_0_lang-PiGGhTHo.js";import{c as X,e as C,f as B,h as R,a as z,b as S}from"../../../chunks/index-DsloP0ml.js";import{a as w}from"../../../chunks/index-wkMXT2wB.js";import{i as x}from"../../../chunks/helper-BlxFN3eF.js";import{useDatePicker as q}from"../../../composables/useDatePicker.js";const F=["data-testid"],V=["name","value","required"],j=/* @__PURE__ */e({name:"CLModalDatePicker",__name:"CLModalDatePicker",props:/* @__PURE__ */a({buttonAriaLabel:{default:void 0},buttonBorderRadius:{default:void 0},buttonColor:{default:S.Primary},buttonLabel:{default:"Select dates"},buttonSize:{default:X.Small},buttonVariant:{default:z.Soft},buttonWidth:{default:"auto"},buttonWrapped:{type:Boolean,default:!1},busy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},fluid:{type:Boolean,default:!1},id:{},isRange:{type:Boolean,default:!0},label:{default:void 0},name:{default:void 0},onBlur:{type:Function,default:void 0},onChange:{type:Function,default:void 0},onFocus:{type:Function,default:void 0},onReset:{},orientation:{default:w.Vertical},required:{type:Boolean,default:!1},testId:{default:"clll-date-picker-modal"},title:{default:"Select dates"}},{modelValue:{default:()=>({end:null,start:null})},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const a=e,j="clll-date-picker-modal",M=t(!1),E=l(()=>`date-picker-modal-${a.id}`),P=t(),D=i(e,"modelValue"),{rangeLabel:W}=q({appliedStart:l(()=>D.value?.start??null),appliedEnd:l(()=>D.value?.end??null),isRange:a.isRange}),A=t(!1),I=()=>{x&&(A.value=window.innerWidth<480)},N=()=>{if(a.disabled||a.busy)return;I(),M.value=!0,y(()=>{P.value?.initializeDraft()});const e=new FocusEvent("focus",{bubbles:!0,cancelable:!0});a.onFocus?.(e)},G=()=>{M.value=!1,P.value?.cancel();const e=new FocusEvent("blur",{bubbles:!0,cancelable:!0});a.onBlur?.(e)},T=()=>{P.value?.apply(),M.value=!1,a.onChange?.()},H=()=>{P.value?.reset(),a.onReset?.()},O=l(()=>A.value);d(()=>{x&&(I(),window.addEventListener("resize",I))}),o(()=>{x&&window.removeEventListener("resize",I)});const U={[X.Tiny]:C.Tiny,[X.Small]:C.Small,[X.Medium]:C.Medium,[X.Large]:C.Large,[X.XL]:C.XL,[X.XXL]:C.XXL,[X.XXXL]:C.XXXL,[X.XXXXL]:C.XXXXL},J=l(()=>[j,a.buttonBorderRadius?`${j}--${a.buttonBorderRadius}`:"",a.busy?`${j}--busy`:`${j}--ready`,`${j}--${a.buttonColor}`,`${j}--${a.buttonSize}`,`${j}--${a.buttonVariant}`,a.disabled||a.busy?`${j}--disabled`:`${j}--active`,a.fluid||a.orientation===w.Horizontal?`${j}--fluid`:`${j}--fixed`,a.label?`${j}--haslabel`:"",a.orientation?`${j}--${a.orientation}`:"",a.required?`${j}--required`:`${j}--optional`]),K=l(()=>{const e=P.value?.draftStart,t=P.value?.draftEnd;return a.isRange?!!e&&!!t:!!e});return(a,t)=>(u(),r(L,{fluid:e.fluid,orientation:e.orientation},{default:n(()=>[s("div",{class:b(c(J)),"data-testid":e.testId},[e.label?(u(),r(k,{key:0,"css-prefix":j,"html-for":e.id,label:e.label,required:e.required,size:e.buttonSize,onClick:N},null,8,["html-for","label","required","size"])):f("",!0),p(c(h),{id:e.id,"aria-label":e.buttonAriaLabel||"Open date picker","border-radius":e.buttonBorderRadius,busy:e.busy,color:e.buttonColor,disabled:e.disabled||e.busy,"icon-before":c(B).Calendar,"icon-size":U[e.buttonSize],"on-click":N,"test-id":`${e.testId}__trigger`,size:e.buttonSize,variant:e.buttonVariant,width:e.buttonWidth,wrap:e.buttonWrapped},{default:n(()=>[_(v(c(W)||e.buttonLabel),1)]),_:1},8,["id","aria-label","border-radius","busy","color","disabled","icon-before","icon-size","test-id","size","variant","width","wrap"]),e.name||e.required?(u(),m("input",{key:1,class:b(`${j}__hidden-input`),name:e.name,value:c(W)||"",required:e.required,tabindex:"-1","aria-hidden":"true"},null,10,V)):f("",!0),p(c($),{"border-radius":c(O)?c(R).None:c(R).Medium,fullscreen:c(O),"is-open":c(M),"max-width":"336px","modal-id":c(E),"on-close":G,title:e.title},{body:n(()=>[p(c(g),{ref_key:"calendarRef",ref:P,modelValue:D.value,"onUpdate:modelValue":t[0]||(t[0]=e=>D.value=e),busy:e.busy,disabled:e.disabled,fluid:c(O),"is-range":e.isRange},null,8,["modelValue","busy","disabled","fluid","is-range"])]),footer:n(()=>[s("div",{class:b(`${j}__footer-actions`)},[p(c(h),{"border-radius":e.buttonBorderRadius,color:c(S).Neutral,"on-click":G,variant:c(z).Ghost},{default:n(()=>[...t[1]||(t[1]=[_(" Cancel ",-1)])]),_:1},8,["border-radius","color","variant"]),s("div",{class:b(`${j}__footer-right`)},[p(c(h),{"border-radius":e.buttonBorderRadius,color:c(S).Neutral,disabled:!c(P)?.draftStart&&!c(P)?.draftEnd,"on-click":H,variant:c(z).Ghost},{default:n(()=>[...t[2]||(t[2]=[_(" Reset ",-1)])]),_:1},8,["border-radius","color","disabled","variant"]),p(c(h),{"border-radius":e.buttonBorderRadius,color:c(S).Primary,disabled:!c(K),"on-click":T},{default:n(()=>[...t[3]||(t[3]=[_(" Apply ",-1)])]),_:1},8,["border-radius","color","disabled"])],2)],2)]),_:1},8,["border-radius","fullscreen","is-open","modal-id","title"])],10,F)]),_:1},8,["fluid","orientation"]))}});export{j as CLModalDatePicker,j as default};
3
+ import{defineComponent as e,mergeModels as a,ref as t,computed as l,useModel as d,toRef as o,onMounted as i,onBeforeUnmount as r,createBlock as u,openBlock as n,withCtx as s,createElementVNode as b,normalizeClass as c,unref as f,createCommentVNode as p,createVNode as m,createElementBlock as _,createTextVNode as v,toDisplayString as y,nextTick as h}from"vue";import{_ as L}from"../../../chunks/CLButton.vue_vue_type_style_index_0_lang-pE0JrYmS.js";import{_ as k}from"../../../chunks/CLFormField.vue_vue_type_style_index_0_lang-Rf_Mo_VS.js";import{_ as $}from"../../../chunks/CLFormLabel.vue_vue_type_script_setup_true_lang-DoM5X-sA.js";import{_ as w}from"../../../chunks/CLModal.vue_vue_type_style_index_0_lang-DLUfvRC_.js";import{_ as g}from"../../../chunks/CLCalendar.vue_vue_type_style_index_0_lang-DUc5dHAZ.js";import{c as X,e as C,f as B,h as R,a as z,b as S}from"../../../chunks/index-DsloP0ml.js";import{a as x}from"../../../chunks/index-wkMXT2wB.js";import{i as D}from"../../../chunks/helper-BlxFN3eF.js";import{useDatePicker as F}from"../../../composables/useDatePicker.js";const j=["data-testid"],q=["name","value","required"],V=/* @__PURE__ */e({name:"CLModalDatePicker",__name:"CLModalDatePicker",props:/* @__PURE__ */a({allowedDates:{type:[Array,Object,Function],default:void 0},buttonAriaLabel:{default:void 0},buttonBorderRadius:{default:void 0},buttonColor:{default:S.Primary},buttonLabel:{default:"Select dates"},buttonSize:{default:X.Small},buttonVariant:{default:z.Soft},buttonWidth:{default:"auto"},buttonWrapped:{type:Boolean,default:!1},busy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},fluid:{type:Boolean,default:!1},id:{},isRange:{type:Boolean,default:!0},label:{default:void 0},name:{default:void 0},onBlur:{type:Function,default:void 0},onChange:{type:Function,default:void 0},onFocus:{type:Function,default:void 0},onReset:{},orientation:{default:x.Vertical},required:{type:Boolean,default:!1},testId:{default:"clll-date-picker-modal"},title:{default:"Select dates"}},{modelValue:{default:()=>({end:null,start:null})},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const a=e,V="clll-date-picker-modal",M=t(!1),E=l(()=>`date-picker-modal-${a.id}`),P=t(),W=d(e,"modelValue"),{rangeLabel:A}=F({allowedDates:o(a,"allowedDates"),appliedStart:l(()=>W.value?.start??null),appliedEnd:l(()=>W.value?.end??null),isRange:a.isRange}),I=t(!1),N=()=>{D&&(I.value=window.innerWidth<480)},G=()=>{if(a.disabled||a.busy)return;N(),M.value=!0,h(()=>{P.value?.initializeDraft()});const e=new FocusEvent("focus",{bubbles:!0,cancelable:!0});a.onFocus?.(e)},O=()=>{M.value=!1,P.value?.cancel();const e=new FocusEvent("blur",{bubbles:!0,cancelable:!0});a.onBlur?.(e)},T=()=>{P.value?.apply(),M.value=!1,a.onChange?.()},H=()=>{P.value?.reset(),a.onReset?.()},U=l(()=>I.value);i(()=>{D&&(N(),window.addEventListener("resize",N))}),r(()=>{D&&window.removeEventListener("resize",N)});const J={[X.Tiny]:C.Tiny,[X.Small]:C.Small,[X.Medium]:C.Medium,[X.Large]:C.Large,[X.XL]:C.XL,[X.XXL]:C.XXL,[X.XXXL]:C.XXXL,[X.XXXXL]:C.XXXXL},K=l(()=>[V,a.buttonBorderRadius?`${V}--${a.buttonBorderRadius}`:"",a.busy?`${V}--busy`:`${V}--ready`,`${V}--${a.buttonColor}`,`${V}--${a.buttonSize}`,`${V}--${a.buttonVariant}`,a.disabled||a.busy?`${V}--disabled`:`${V}--active`,a.fluid||a.orientation===x.Horizontal?`${V}--fluid`:`${V}--fixed`,a.label?`${V}--haslabel`:"",a.orientation?`${V}--${a.orientation}`:"",a.required?`${V}--required`:`${V}--optional`]),Q=l(()=>{const e=P.value?.draftStart,t=P.value?.draftEnd;return a.allowedDates?!!e:a.isRange?!!e&&!!t:!!e});return(a,t)=>(n(),u(k,{fluid:e.fluid,orientation:e.orientation},{default:s(()=>[b("div",{class:c(f(K)),"data-testid":e.testId},[e.label?(n(),u($,{key:0,"css-prefix":V,"html-for":e.id,label:e.label,required:e.required,size:e.buttonSize,onClick:G},null,8,["html-for","label","required","size"])):p("",!0),m(f(L),{id:e.id,"aria-label":e.buttonAriaLabel||"Open date picker","border-radius":e.buttonBorderRadius,busy:e.busy,color:e.buttonColor,disabled:e.disabled||e.busy,"icon-before":f(B).Calendar,"icon-size":J[e.buttonSize],"on-click":G,"test-id":`${e.testId}__trigger`,size:e.buttonSize,variant:e.buttonVariant,width:e.buttonWidth,wrap:e.buttonWrapped},{default:s(()=>[v(y(f(A)||e.buttonLabel),1)]),_:1},8,["id","aria-label","border-radius","busy","color","disabled","icon-before","icon-size","test-id","size","variant","width","wrap"]),e.name||e.required?(n(),_("input",{key:1,class:c(`${V}__hidden-input`),name:e.name,value:f(A)||"",required:e.required,tabindex:"-1","aria-hidden":"true"},null,10,q)):p("",!0),m(f(w),{"border-radius":f(U)?f(R).None:f(R).Medium,fullscreen:f(U),"is-open":f(M),"max-width":"336px","modal-id":f(E),"on-close":O,title:e.title},{body:s(()=>[m(f(g),{ref_key:"calendarRef",ref:P,modelValue:W.value,"onUpdate:modelValue":t[0]||(t[0]=e=>W.value=e),"allowed-dates":e.allowedDates,busy:e.busy,disabled:e.disabled,fluid:f(U),"is-range":!e.allowedDates&&e.isRange},null,8,["modelValue","allowed-dates","busy","disabled","fluid","is-range"])]),footer:s(()=>[b("div",{class:c(`${V}__footer-actions`)},[m(f(L),{"border-radius":e.buttonBorderRadius,color:f(S).Neutral,"on-click":O,variant:f(z).Ghost},{default:s(()=>[...t[1]||(t[1]=[v(" Cancel ",-1)])]),_:1},8,["border-radius","color","variant"]),b("div",{class:c(`${V}__footer-right`)},[m(f(L),{"border-radius":e.buttonBorderRadius,color:f(S).Neutral,disabled:!f(P)?.draftStart&&!f(P)?.draftEnd,"on-click":H,variant:f(z).Ghost},{default:s(()=>[...t[2]||(t[2]=[v(" Reset ",-1)])]),_:1},8,["border-radius","color","disabled","variant"]),m(f(L),{"border-radius":e.buttonBorderRadius,color:f(S).Primary,disabled:!f(Q),"on-click":T},{default:s(()=>[...t[3]||(t[3]=[v(" Apply ",-1)])]),_:1},8,["border-radius","color","disabled"])],2)],2)]),_:1},8,["border-radius","fullscreen","is-open","modal-id","title"])],10,j)]),_:1},8,["fluid","orientation"]))}});export{V as CLModalDatePicker,V as default};