@codeandfunction/callaloo 4.9.2 → 4.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,22 @@
1
1
  import '../../../assets/core.css';
2
2
  import './CLInputDatePicker.css';
3
- import { defineComponent as U, mergeModels as q, ref as r, useModel as N, watch as T, computed as h, onMounted as A, onBeforeUnmount as G, createElementBlock as R, openBlock as k, normalizeClass as g, createVNode as y, createCommentVNode as H, unref as u, isRef as j, normalizeStyle as J, withCtx as K, createElementVNode as Q } from "vue";
3
+ import { defineComponent as U, mergeModels as q, ref as r, useModel as N, watch as T, computed as R, onMounted as A, onBeforeUnmount as G, createElementBlock as I, openBlock as k, normalizeClass as p, createVNode as y, createCommentVNode as H, unref as d, isRef as j, normalizeStyle as J, withCtx as K, createElementVNode as Q } from "vue";
4
4
  import { u as W, a as X, o as Z, f as _, s as ee } from "../../../chunks/floating-ui.vue-Fx4CxKut.js";
5
5
  import { _ as ae } from "../../../chunks/CLCard.vue_vue_type_style_index_0_lang-Sre7UYZd.js";
6
6
  import { CLInput as te } from "../CLInput/CLInput.js";
7
- import { C as le } from "../../../chunks/CLCalendar-BGwHfZr9.js";
8
- import { CLIconNames as ne, CLColorVariants as D, CLPlacement as oe, CLOrientation as ie, CLSizes as de, CLColors as ue } from "../../../index.js";
9
- import { i as L } from "../../../chunks/helper-qUkciePY.js";
7
+ import { _ as le } from "../../../chunks/CLCalendar.vue_vue_type_style_index_0_lang-Bz1JdT1A.js";
8
+ import { CLIconNames as ne, CLColorVariants as D, CLPlacement as ie, CLOrientation as oe, CLSizes as ue, CLColors as de } from "../../../index.js";
9
+ import { i as Y } from "../../../chunks/helper-qUkciePY.js";
10
10
  import { useEsc as re } from "../../../composables/useEsc.js";
11
11
  import { useDateInputMask as se } from "../../../composables/useDateInputMask.js";
12
- import { _ as fe } from "../../../chunks/_plugin-vue_export-helper-CHgC5LLL.js";
13
- const ce = /* @__PURE__ */ U({
12
+ const he = /* @__PURE__ */ U({
14
13
  name: "CLInputDatePicker",
15
14
  __name: "CLInputDatePicker",
16
15
  props: /* @__PURE__ */ q({
17
16
  ariaLabel: { default: void 0 },
18
17
  borderRadius: { default: void 0 },
19
- color: { default: ue.Primary },
20
- size: { default: de.Small },
18
+ color: { default: de.Primary },
19
+ size: { default: ue.Small },
21
20
  variant: { default: D.Outline },
22
21
  busy: { type: Boolean, default: !1 },
23
22
  disabled: { type: Boolean, default: !1 },
@@ -32,8 +31,8 @@ const ce = /* @__PURE__ */ U({
32
31
  onBlur: { type: Function, default: void 0 },
33
32
  onChange: { type: Function, default: void 0 },
34
33
  onFocus: { type: Function, default: void 0 },
35
- orientation: { default: ie.Vertical },
36
- placement: { default: oe.BottomStart },
34
+ orientation: { default: oe.Vertical },
35
+ placement: { default: ie.BottomStart },
37
36
  placeholder: { default: void 0 },
38
37
  required: { type: Boolean, default: !1 },
39
38
  rounded: { type: Boolean, default: !0 },
@@ -46,73 +45,73 @@ const ce = /* @__PURE__ */ U({
46
45
  }),
47
46
  emits: ["update:modelValue"],
48
47
  setup(e) {
49
- const n = e, f = "clll-input-date-picker", o = r(!1), c = r(), s = r(), v = r(), i = N(e, "modelValue"), d = r(""), { handleDateInput: Y, isoToSlash: C, slashToISO: p, validateDate: B } = se();
50
- T(i, () => {
51
- const a = C(i.value?.start ?? null), t = C(i.value?.end ?? null);
48
+ const n = e, f = "clll-input-date-picker", i = r(!1), c = r(), s = r(), v = r(), o = N(e, "modelValue"), u = r(""), { handleDateInput: L, isoToSlash: C, slashToISO: b, validateDate: B } = se();
49
+ T(o, () => {
50
+ const a = C(o.value?.start ?? null), t = C(o.value?.end ?? null);
52
51
  if (!a) {
53
- d.value = "";
52
+ u.value = "";
54
53
  return;
55
54
  }
56
55
  if (!n.isRange || !t) {
57
- d.value = a;
56
+ u.value = a;
58
57
  return;
59
58
  }
60
- d.value = `${a} - ${t}`;
59
+ u.value = `${a} - ${t}`;
61
60
  }, { immediate: !0, deep: !0 });
62
- const E = h(() => c.value?.$el), { floatingStyles: M } = W(E, v, {
61
+ const E = R(() => c.value?.$el), { floatingStyles: M } = W(E, v, {
63
62
  middleware: [Z(8), _(), ee()],
64
63
  placement: r(n.placement),
65
64
  whileElementsMounted: X,
66
- open: o
67
- }), x = () => {
68
- n.disabled || n.busy || (o.value = !o.value, o.value ? (n.onFocus?.(new FocusEvent("focus")), s.value?.initializeDraft()) : n.onBlur?.(new FocusEvent("blur")));
69
- }, S = h(() => {
65
+ open: i
66
+ }), S = () => {
67
+ n.disabled || n.busy || (i.value = !i.value, i.value ? (n.onFocus?.(new FocusEvent("focus")), s.value?.initializeDraft()) : n.onBlur?.(new FocusEvent("blur")));
68
+ }, x = R(() => {
70
69
  const a = s.value?.draftStart, t = s.value?.draftEnd;
71
70
  return n.isRange ? !!a && !!t : !!a;
72
- }), b = () => {
73
- o.value && (o.value = !1, n.onBlur?.(new FocusEvent("blur")));
71
+ }), g = () => {
72
+ i.value && (i.value = !1, n.onBlur?.(new FocusEvent("blur")));
74
73
  };
75
- re({ escHandler: b });
74
+ re({ escHandler: g });
76
75
  const V = (a) => {
77
76
  const t = a.target, l = c.value?.$el, m = v.value;
78
- o.value && l && m && !l.contains(t) && !m.contains(t) && b();
79
- }, P = () => {
80
- S.value && (s.value?.apply(), b(), n.onChange?.());
81
- }, I = (a) => {
77
+ i.value && l && m && !l.contains(t) && !m.contains(t) && g();
78
+ }, z = () => {
79
+ x.value && (s.value?.apply(), g(), n.onChange?.());
80
+ }, h = (a) => {
82
81
  const t = B(a, n.isRange), l = c.value?.inputRef;
83
82
  return l && (a && !t ? l.setCustomValidity("Invalid date format. Use YYYY/MM/DD") : l.setCustomValidity("")), t;
84
- }, z = (a) => {
85
- a && Y(a, d, n.isRange, () => {
86
- I(d.value);
87
- });
88
83
  }, F = (a) => {
84
+ a && L(a, u, n.isRange, () => {
85
+ h(u.value);
86
+ });
87
+ }, P = (a) => {
89
88
  if (!a) return;
90
- const l = a.target.value, m = I(l);
89
+ const l = a.target.value, m = h(l);
91
90
  if (!l.trim()) {
92
- i.value = { start: null, end: null }, n.onChange?.();
91
+ o.value = { start: null, end: null }, n.onChange?.();
93
92
  return;
94
93
  }
95
94
  if (m) {
96
95
  if (n.isRange) {
97
- const [w, $] = l.split("-").map((O) => O.trim());
98
- i.value = { start: p(w), end: p($) };
96
+ const [$, w] = l.split("-").map((O) => O.trim());
97
+ o.value = { start: b($), end: b(w) };
99
98
  } else
100
- i.value = { start: p(l.trim()), end: null };
99
+ o.value = { start: b(l.trim()), end: null };
101
100
  n.onChange?.();
102
101
  }
103
102
  };
104
103
  return A(() => {
105
- L && document.addEventListener("click", V);
104
+ Y && document.addEventListener("click", V);
106
105
  }), G(() => {
107
- L && document.removeEventListener("click", V);
108
- }), (a, t) => (k(), R("div", {
109
- class: g([f, e.fluid ? `${f}--fluid` : ""])
106
+ Y && document.removeEventListener("click", V);
107
+ }), (a, t) => (k(), I("div", {
108
+ class: p([f, e.fluid ? `${f}--fluid` : ""])
110
109
  }, [
111
- y(u(te), {
110
+ y(d(te), {
112
111
  ref_key: "inputRef",
113
112
  ref: c,
114
- modelValue: u(d),
115
- "onUpdate:modelValue": t[0] || (t[0] = (l) => j(d) ? d.value = l : null),
113
+ modelValue: d(u),
114
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => j(u) ? u.value = l : null),
116
115
  "aria-label": e.ariaLabel,
117
116
  "border-radius": e.borderRadius,
118
117
  busy: e.busy,
@@ -130,41 +129,41 @@ const ce = /* @__PURE__ */ U({
130
129
  required: e.required,
131
130
  rounded: e.rounded,
132
131
  size: e.size,
133
- suffix: u(ne).Calendar,
132
+ suffix: d(ne).Calendar,
134
133
  "suffix-aria-label": e.ariaLabel || "Open calendar",
135
134
  "test-id": e.testId,
136
135
  variant: e.variant,
137
- onInput: z,
138
- onChange: F,
139
- onSuffixClick: x
136
+ onInput: F,
137
+ onChange: P,
138
+ onSuffixClick: S
140
139
  }, null, 8, ["modelValue", "aria-label", "border-radius", "busy", "color", "disabled", "fluid", "form", "id", "label", "messages", "message-type", "name", "orientation", "placeholder", "required", "rounded", "size", "suffix", "suffix-aria-label", "test-id", "variant"]),
141
- u(o) ? (k(), R("div", {
140
+ d(i) ? (k(), I("div", {
142
141
  key: 0,
143
142
  ref_key: "popoverRef",
144
143
  ref: v,
145
- class: g(`${f}__popover`),
146
- style: J({ ...u(M), zIndex: 100 })
144
+ class: p(`${f}__popover`),
145
+ style: J({ ...d(M), zIndex: 100 })
147
146
  }, [
148
- y(u(ae), {
147
+ y(d(ae), {
149
148
  "border-radius": e.borderRadius,
150
- variant: u(D).Ghost,
149
+ variant: d(D).Ghost,
151
150
  padded: !1,
152
151
  rounded: e.rounded,
153
152
  elevated: ""
154
153
  }, {
155
154
  default: K(() => [
156
155
  Q("div", {
157
- class: g(`${f}__calendar-container`)
156
+ class: p(`${f}__calendar-container`)
158
157
  }, [
159
- y(u(le), {
158
+ y(d(le), {
160
159
  ref_key: "calendarRef",
161
160
  ref: s,
162
- modelValue: i.value,
163
- "onUpdate:modelValue": t[1] || (t[1] = (l) => i.value = l),
161
+ modelValue: o.value,
162
+ "onUpdate:modelValue": t[1] || (t[1] = (l) => o.value = l),
164
163
  disabled: e.disabled,
165
164
  busy: e.busy,
166
165
  "is-range": e.isRange,
167
- onDateSelect: P,
166
+ onDateSelect: z,
168
167
  fluid: ""
169
168
  }, null, 8, ["modelValue", "disabled", "busy", "is-range"])
170
169
  ], 2)
@@ -174,8 +173,8 @@ const ce = /* @__PURE__ */ U({
174
173
  ], 6)) : H("", !0)
175
174
  ], 2));
176
175
  }
177
- }), ke = /* @__PURE__ */ fe(ce, [["__scopeId", "data-v-5ad92cdc"]]);
176
+ });
178
177
  export {
179
- ke as CLInputDatePicker,
180
- ke as default
178
+ he as CLInputDatePicker,
179
+ he as default
181
180
  };
@@ -1 +1 @@
1
- .clll-date-picker-modal[data-v-14031572]{position:relative;display:inline-flex;flex-direction:column;flex-wrap:wrap;box-sizing:border-box}.clll-date-picker-modal--fluid[data-v-14031572]{width:100%}.clll-date-picker-modal__container[data-v-14031572]{display:inline-flex;flex-direction:column;flex-wrap:wrap}.clll-date-picker-modal__footer-actions[data-v-14031572]{display:flex;justify-content:space-between;align-items:center;width:100%}.clll-date-picker-modal__footer-right[data-v-14031572]{display:flex;gap:var(--clll-unit-2)}
1
+ .clll-date-picker-modal{position:relative;display:inline-flex;flex-direction:column;flex-wrap:wrap;box-sizing:border-box}.clll-date-picker-modal--fluid{width:100%}.clll-date-picker-modal__container{display:inline-flex;flex-direction:column;flex-wrap:wrap}.clll-date-picker-modal__footer-actions{display:flex;justify-content:space-between;align-items:center;width:100%}.clll-date-picker-modal__footer-right{display:flex;gap:var(--clll-unit-2)}
@@ -1,23 +1,22 @@
1
1
  import '../../../assets/core.css';
2
2
  import './CLModalDatePicker.css';
3
- import { defineComponent as I, mergeModels as N, ref as p, computed as u, useModel as h, onBeforeUnmount as A, createElementBlock as T, openBlock as W, normalizeClass as $, unref as e, createVNode as s, withCtx as c, createTextVNode as v, toDisplayString as G, createElementVNode as S, nextTick as O } from "vue";
3
+ import { defineComponent as P, mergeModels as h, ref as C, computed as u, useModel as I, onBeforeUnmount as A, createElementBlock as T, openBlock as W, normalizeClass as X, unref as e, createVNode as s, withCtx as c, createTextVNode as v, toDisplayString as G, createElementVNode as k, nextTick as O } from "vue";
4
4
  import { _ as y } from "../../../chunks/CLButton.vue_vue_type_style_index_0_lang-MvhnNzVW.js";
5
5
  import { _ as U } from "../../../chunks/CLModal.vue_vue_type_style_index_0_lang-BDyONfaQ.js";
6
- import { C as j } from "../../../chunks/CLCalendar-BGwHfZr9.js";
7
- import { CLSizes as n, CLIconSizes as i, CLIconNames as q, CLBorderRadius as B, CLColorVariants as X, CLColors as C } from "../../../index.js";
6
+ import { _ as j } from "../../../chunks/CLCalendar.vue_vue_type_style_index_0_lang-Bz1JdT1A.js";
7
+ import { CLSizes as n, CLIconSizes as i, CLIconNames as q, CLBorderRadius as B, CLColorVariants as g, CLColors as L } from "../../../index.js";
8
8
  import { i as z } from "../../../chunks/helper-qUkciePY.js";
9
9
  import { useDatePicker as H } from "../../../composables/useDatePicker.js";
10
- import { _ as J } from "../../../chunks/_plugin-vue_export-helper-CHgC5LLL.js";
11
- const K = ["data-testid"], Q = /* @__PURE__ */ I({
10
+ const J = ["data-testid"], ae = /* @__PURE__ */ P({
12
11
  name: "CLModalDatePicker",
13
12
  __name: "CLModalDatePicker",
14
- props: /* @__PURE__ */ N({
13
+ props: /* @__PURE__ */ h({
15
14
  buttonAriaLabel: { default: void 0 },
16
15
  buttonBorderRadius: { default: void 0 },
17
- buttonColor: { default: C.Primary },
16
+ buttonColor: { default: L.Primary },
18
17
  buttonLabel: { default: "Select dates" },
19
18
  buttonSize: { default: n.Small },
20
- buttonVariant: { default: X.Soft },
19
+ buttonVariant: { default: g.Soft },
21
20
  buttonWrapped: { type: Boolean, default: !1 },
22
21
  busy: { type: Boolean, default: !1 },
23
22
  disabled: { type: Boolean, default: !1 },
@@ -38,12 +37,12 @@ const K = ["data-testid"], Q = /* @__PURE__ */ I({
38
37
  }),
39
38
  emits: ["update:modelValue"],
40
39
  setup(t) {
41
- const a = t, o = "clll-date-picker-modal", f = p(!1), M = u(() => `date-picker-modal-${a.id}`), d = p(), b = h(t, "modelValue"), { rangeLabel: w } = H({
40
+ const a = t, l = "clll-date-picker-modal", f = C(!1), w = u(() => `date-picker-modal-${a.id}`), d = C(), b = I(t, "modelValue"), { rangeLabel: M } = H({
42
41
  appliedStart: u(() => b.value?.start ?? null),
43
42
  appliedEnd: u(() => b.value?.end ?? null),
44
43
  isRange: a.isRange
45
- }), g = p(!1), m = () => {
46
- z && (g.value = window.innerWidth < 480);
44
+ }), p = C(!1), m = () => {
45
+ z && (p.value = window.innerWidth < 480);
47
46
  }, R = () => {
48
47
  if (a.disabled || a.busy) return;
49
48
  m(), f.value = !0, O(() => {
@@ -51,7 +50,7 @@ const K = ["data-testid"], Q = /* @__PURE__ */ I({
51
50
  });
52
51
  const r = new FocusEvent("focus", { bubbles: !0, cancelable: !0 });
53
52
  a.onFocus?.(r);
54
- }, k = () => {
53
+ }, S = () => {
55
54
  f.value = !1, d.value?.cancel();
56
55
  const r = new FocusEvent("blur", { bubbles: !0, cancelable: !0 });
57
56
  a.onBlur?.(r);
@@ -59,7 +58,7 @@ const K = ["data-testid"], Q = /* @__PURE__ */ I({
59
58
  d.value?.apply(), f.value = !1, a.onChange?.();
60
59
  }, E = () => {
61
60
  d.value?.reset(), a.onChange?.();
62
- }, L = u(() => g.value);
61
+ }, $ = u(() => p.value);
63
62
  z && (m(), window.addEventListener("resize", m), A(() => {
64
63
  window.removeEventListener("resize", m);
65
64
  }));
@@ -72,23 +71,23 @@ const K = ["data-testid"], Q = /* @__PURE__ */ I({
72
71
  [n.XXL]: i.XXL,
73
72
  [n.XXXL]: i.XXXL,
74
73
  [n.XXXXL]: i.XXXXL
75
- }, D = u(() => [
76
- o,
77
- `${o}__container`,
78
- a.buttonBorderRadius ? `${o}--${a.buttonBorderRadius}` : "",
79
- a.busy ? `${o}--busy` : `${o}--ready`,
80
- `${o}--${a.buttonColor}`,
81
- `${o}--${a.buttonSize}`,
82
- `${o}--${a.buttonVariant}`,
83
- a.disabled || a.busy ? `${o}--disabled` : `${o}--active`,
84
- a.fluid ? `${o}--fluid` : `${o}--fixed`,
85
- a.rounded ? `${o}--rounded` : `${o}--box`
86
- ]), F = u(() => {
87
- const r = d.value?.draftStart, l = d.value?.draftEnd;
88
- return a.isRange ? !!r && !!l : !!r;
74
+ }, F = u(() => [
75
+ l,
76
+ `${l}__container`,
77
+ a.buttonBorderRadius ? `${l}--${a.buttonBorderRadius}` : "",
78
+ a.busy ? `${l}--busy` : `${l}--ready`,
79
+ `${l}--${a.buttonColor}`,
80
+ `${l}--${a.buttonSize}`,
81
+ `${l}--${a.buttonVariant}`,
82
+ a.disabled || a.busy ? `${l}--disabled` : `${l}--active`,
83
+ a.fluid ? `${l}--fluid` : `${l}--fixed`,
84
+ a.rounded ? `${l}--rounded` : `${l}--box`
85
+ ]), D = u(() => {
86
+ const r = d.value?.draftStart, o = d.value?.draftEnd;
87
+ return a.isRange ? !!r && !!o : !!r;
89
88
  });
90
- return (r, l) => (W(), T("div", {
91
- class: $(e(D)),
89
+ return (r, o) => (W(), T("div", {
90
+ class: X(e(F)),
92
91
  "data-testid": t.testId
93
92
  }, [
94
93
  s(e(y), {
@@ -108,17 +107,17 @@ const K = ["data-testid"], Q = /* @__PURE__ */ I({
108
107
  wrap: t.buttonWrapped
109
108
  }, {
110
109
  default: c(() => [
111
- v(G(e(w) || t.buttonLabel), 1)
110
+ v(G(e(M) || t.buttonLabel), 1)
112
111
  ]),
113
112
  _: 1
114
113
  }, 8, ["aria-label", "border-radius", "busy", "color", "disabled", "icon-before", "icon-size", "rounded", "test-id", "size", "variant", "wrap"]),
115
114
  s(e(U), {
116
- "border-radius": e(L) ? e(B).None : e(B).Medium,
117
- fullscreen: e(L),
115
+ "border-radius": e($) ? e(B).None : e(B).Medium,
116
+ fullscreen: e($),
118
117
  "is-open": e(f),
119
118
  "max-width": "336px",
120
- "modal-id": e(M),
121
- "on-close": k,
119
+ "modal-id": e(w),
120
+ "on-close": S,
122
121
  title: t.title
123
122
  }, {
124
123
  body: c(() => [
@@ -126,47 +125,47 @@ const K = ["data-testid"], Q = /* @__PURE__ */ I({
126
125
  ref_key: "calendarRef",
127
126
  ref: d,
128
127
  modelValue: b.value,
129
- "onUpdate:modelValue": l[0] || (l[0] = (P) => b.value = P),
128
+ "onUpdate:modelValue": o[0] || (o[0] = (N) => b.value = N),
130
129
  busy: t.busy,
131
130
  disabled: t.disabled,
132
- fluid: e(L),
131
+ fluid: e($),
133
132
  "is-range": t.isRange
134
133
  }, null, 8, ["modelValue", "busy", "disabled", "fluid", "is-range"])
135
134
  ]),
136
135
  footer: c(() => [
137
- S("div", {
138
- class: $(`${o}__footer-actions`)
136
+ k("div", {
137
+ class: X(`${l}__footer-actions`)
139
138
  }, [
140
139
  s(e(y), {
141
- color: e(C).Neutral,
142
- "on-click": k,
143
- variant: e(X).Ghost
140
+ color: e(L).Neutral,
141
+ "on-click": S,
142
+ variant: e(g).Ghost
144
143
  }, {
145
- default: c(() => [...l[1] || (l[1] = [
144
+ default: c(() => [...o[1] || (o[1] = [
146
145
  v(" Cancel ", -1)
147
146
  ])]),
148
147
  _: 1
149
148
  }, 8, ["color", "variant"]),
150
- S("div", {
151
- class: $(`${o}__footer-right`)
149
+ k("div", {
150
+ class: X(`${l}__footer-right`)
152
151
  }, [
153
152
  s(e(y), {
154
- color: e(C).Neutral,
153
+ color: e(L).Neutral,
155
154
  disabled: !e(d)?.draftStart && !e(d)?.draftEnd,
156
155
  "on-click": E,
157
- variant: e(X).Ghost
156
+ variant: e(g).Ghost
158
157
  }, {
159
- default: c(() => [...l[2] || (l[2] = [
158
+ default: c(() => [...o[2] || (o[2] = [
160
159
  v(" Reset ", -1)
161
160
  ])]),
162
161
  _: 1
163
162
  }, 8, ["color", "disabled", "variant"]),
164
163
  s(e(y), {
165
- color: e(C).Primary,
166
- disabled: !e(F),
164
+ color: e(L).Primary,
165
+ disabled: !e(D),
167
166
  "on-click": V
168
167
  }, {
169
- default: c(() => [...l[3] || (l[3] = [
168
+ default: c(() => [...o[3] || (o[3] = [
170
169
  v(" Apply ", -1)
171
170
  ])]),
172
171
  _: 1
@@ -176,10 +175,10 @@ const K = ["data-testid"], Q = /* @__PURE__ */ I({
176
175
  ]),
177
176
  _: 1
178
177
  }, 8, ["border-radius", "fullscreen", "is-open", "modal-id", "title"])
179
- ], 10, K));
178
+ ], 10, J));
180
179
  }
181
- }), de = /* @__PURE__ */ J(Q, [["__scopeId", "data-v-14031572"]]);
180
+ });
182
181
  export {
183
- de as CLModalDatePicker,
184
- de as default
182
+ ae as CLModalDatePicker,
183
+ ae as default
185
184
  };