@codeandfunction/callaloo 4.9.3 → 4.9.4

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,21 +1,21 @@
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 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";
3
+ import { defineComponent as N, mergeModels as U, ref as r, useModel as q, 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
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";
8
+ import { CLIconNames as ne, CLColorVariants as D, CLPlacement as oe, CLOrientation as ie, CLSizes as ue, CLColors as de } from "../../../index.js";
9
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
- const he = /* @__PURE__ */ U({
12
+ const he = /* @__PURE__ */ N({
13
13
  name: "CLInputDatePicker",
14
14
  __name: "CLInputDatePicker",
15
- props: /* @__PURE__ */ q({
15
+ props: /* @__PURE__ */ U({
16
16
  ariaLabel: { default: void 0 },
17
17
  borderRadius: { default: void 0 },
18
- color: { default: de.Primary },
18
+ color: { default: de.Neutral },
19
19
  size: { default: ue.Small },
20
20
  variant: { default: D.Outline },
21
21
  busy: { type: Boolean, default: !1 },
@@ -31,8 +31,8 @@ const he = /* @__PURE__ */ U({
31
31
  onBlur: { type: Function, default: void 0 },
32
32
  onChange: { type: Function, default: void 0 },
33
33
  onFocus: { type: Function, default: void 0 },
34
- orientation: { default: oe.Vertical },
35
- placement: { default: ie.BottomStart },
34
+ orientation: { default: ie.Vertical },
35
+ placement: { default: oe.BottomStart },
36
36
  placeholder: { default: void 0 },
37
37
  required: { type: Boolean, default: !1 },
38
38
  rounded: { type: Boolean, default: !0 },
@@ -45,9 +45,9 @@ const he = /* @__PURE__ */ U({
45
45
  }),
46
46
  emits: ["update:modelValue"],
47
47
  setup(e) {
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);
48
+ const n = e, f = "clll-input-date-picker", o = r(!1), c = r(), s = r(), v = r(), i = q(e, "modelValue"), u = r(""), { handleDateInput: L, isoToSlash: C, slashToISO: b, validateDate: B } = se();
49
+ T(i, () => {
50
+ const a = C(i.value?.start ?? null), t = C(i.value?.end ?? null);
51
51
  if (!a) {
52
52
  u.value = "";
53
53
  return;
@@ -62,19 +62,19 @@ const he = /* @__PURE__ */ U({
62
62
  middleware: [Z(8), _(), ee()],
63
63
  placement: r(n.placement),
64
64
  whileElementsMounted: X,
65
- open: i
65
+ open: o
66
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")));
67
+ n.disabled || n.busy || (o.value = !o.value, o.value ? (n.onFocus?.(new FocusEvent("focus")), s.value?.initializeDraft()) : n.onBlur?.(new FocusEvent("blur")));
68
68
  }, x = R(() => {
69
69
  const a = s.value?.draftStart, t = s.value?.draftEnd;
70
70
  return n.isRange ? !!a && !!t : !!a;
71
71
  }), g = () => {
72
- i.value && (i.value = !1, n.onBlur?.(new FocusEvent("blur")));
72
+ o.value && (o.value = !1, n.onBlur?.(new FocusEvent("blur")));
73
73
  };
74
74
  re({ escHandler: g });
75
75
  const V = (a) => {
76
76
  const t = a.target, l = c.value?.$el, m = v.value;
77
- i.value && l && m && !l.contains(t) && !m.contains(t) && g();
77
+ o.value && l && m && !l.contains(t) && !m.contains(t) && g();
78
78
  }, z = () => {
79
79
  x.value && (s.value?.apply(), g(), n.onChange?.());
80
80
  }, h = (a) => {
@@ -84,19 +84,19 @@ const he = /* @__PURE__ */ U({
84
84
  a && L(a, u, n.isRange, () => {
85
85
  h(u.value);
86
86
  });
87
- }, P = (a) => {
87
+ }, $ = (a) => {
88
88
  if (!a) return;
89
89
  const l = a.target.value, m = h(l);
90
90
  if (!l.trim()) {
91
- o.value = { start: null, end: null }, n.onChange?.();
91
+ i.value = { start: null, end: null }, n.onChange?.();
92
92
  return;
93
93
  }
94
94
  if (m) {
95
95
  if (n.isRange) {
96
- const [$, w] = l.split("-").map((O) => O.trim());
97
- o.value = { start: b($), end: b(w) };
96
+ const [w, P] = l.split("-").map((O) => O.trim());
97
+ i.value = { start: b(w), end: b(P) };
98
98
  } else
99
- o.value = { start: b(l.trim()), end: null };
99
+ i.value = { start: b(l.trim()), end: null };
100
100
  n.onChange?.();
101
101
  }
102
102
  };
@@ -134,10 +134,10 @@ const he = /* @__PURE__ */ U({
134
134
  "test-id": e.testId,
135
135
  variant: e.variant,
136
136
  onInput: F,
137
- onChange: P,
137
+ onChange: $,
138
138
  onSuffixClick: S
139
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"]),
140
- d(i) ? (k(), I("div", {
140
+ d(o) ? (k(), I("div", {
141
141
  key: 0,
142
142
  ref_key: "popoverRef",
143
143
  ref: v,
@@ -158,8 +158,8 @@ const he = /* @__PURE__ */ U({
158
158
  y(d(le), {
159
159
  ref_key: "calendarRef",
160
160
  ref: s,
161
- modelValue: o.value,
162
- "onUpdate:modelValue": t[1] || (t[1] = (l) => o.value = l),
161
+ modelValue: i.value,
162
+ "onUpdate:modelValue": t[1] || (t[1] = (l) => i.value = l),
163
163
  disabled: e.disabled,
164
164
  busy: e.busy,
165
165
  "is-range": e.isRange,
@@ -1 +1 @@
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
+ .clll-date-picker-modal{box-sizing:border-box}.clll-date-picker-modal--fluid{width:100%}.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,22 +1,23 @@
1
1
  import '../../../assets/core.css';
2
2
  import './CLModalDatePicker.css';
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";
3
+ import { defineComponent as N, mergeModels as P, ref as $, computed as u, useModel as I, onBeforeUnmount as W, createElementBlock as A, openBlock as T, normalizeClass as X, unref as e, createVNode as s, withCtx as c, createTextVNode as v, toDisplayString as G, createElementVNode as B, 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
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
- import { i as z } from "../../../chunks/helper-qUkciePY.js";
7
+ import { CLSizes as n, CLIconSizes as i, CLIconNames as q, CLBorderRadius as p, CLColorVariants as g, CLColors as L } from "../../../index.js";
8
+ import { i as w } from "../../../chunks/helper-qUkciePY.js";
9
9
  import { useDatePicker as H } from "../../../composables/useDatePicker.js";
10
- const J = ["data-testid"], ae = /* @__PURE__ */ P({
10
+ const J = ["data-testid"], ae = /* @__PURE__ */ N({
11
11
  name: "CLModalDatePicker",
12
12
  __name: "CLModalDatePicker",
13
- props: /* @__PURE__ */ h({
13
+ props: /* @__PURE__ */ P({
14
14
  buttonAriaLabel: { default: void 0 },
15
15
  buttonBorderRadius: { default: void 0 },
16
16
  buttonColor: { default: L.Primary },
17
17
  buttonLabel: { default: "Select dates" },
18
18
  buttonSize: { default: n.Small },
19
19
  buttonVariant: { default: g.Soft },
20
+ buttonWidth: { default: "auto" },
20
21
  buttonWrapped: { type: Boolean, default: !1 },
21
22
  busy: { type: Boolean, default: !1 },
22
23
  disabled: { type: Boolean, default: !1 },
@@ -37,12 +38,12 @@ const J = ["data-testid"], ae = /* @__PURE__ */ P({
37
38
  }),
38
39
  emits: ["update:modelValue"],
39
40
  setup(t) {
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({
41
+ const a = t, l = "clll-date-picker-modal", f = $(!1), z = u(() => `date-picker-modal-${a.id}`), d = $(), b = I(t, "modelValue"), { rangeLabel: M } = H({
41
42
  appliedStart: u(() => b.value?.start ?? null),
42
43
  appliedEnd: u(() => b.value?.end ?? null),
43
44
  isRange: a.isRange
44
- }), p = C(!1), m = () => {
45
- z && (p.value = window.innerWidth < 480);
45
+ }), S = $(!1), m = () => {
46
+ w && (S.value = window.innerWidth < 480);
46
47
  }, R = () => {
47
48
  if (a.disabled || a.busy) return;
48
49
  m(), f.value = !0, O(() => {
@@ -50,7 +51,7 @@ const J = ["data-testid"], ae = /* @__PURE__ */ P({
50
51
  });
51
52
  const r = new FocusEvent("focus", { bubbles: !0, cancelable: !0 });
52
53
  a.onFocus?.(r);
53
- }, S = () => {
54
+ }, k = () => {
54
55
  f.value = !1, d.value?.cancel();
55
56
  const r = new FocusEvent("blur", { bubbles: !0, cancelable: !0 });
56
57
  a.onBlur?.(r);
@@ -58,8 +59,8 @@ const J = ["data-testid"], ae = /* @__PURE__ */ P({
58
59
  d.value?.apply(), f.value = !1, a.onChange?.();
59
60
  }, E = () => {
60
61
  d.value?.reset(), a.onChange?.();
61
- }, $ = u(() => p.value);
62
- z && (m(), window.addEventListener("resize", m), A(() => {
62
+ }, C = u(() => S.value);
63
+ w && (m(), window.addEventListener("resize", m), W(() => {
63
64
  window.removeEventListener("resize", m);
64
65
  }));
65
66
  const x = {
@@ -71,9 +72,8 @@ const J = ["data-testid"], ae = /* @__PURE__ */ P({
71
72
  [n.XXL]: i.XXL,
72
73
  [n.XXXL]: i.XXXL,
73
74
  [n.XXXXL]: i.XXXXL
74
- }, F = u(() => [
75
+ }, h = u(() => [
75
76
  l,
76
- `${l}__container`,
77
77
  a.buttonBorderRadius ? `${l}--${a.buttonBorderRadius}` : "",
78
78
  a.busy ? `${l}--busy` : `${l}--ready`,
79
79
  `${l}--${a.buttonColor}`,
@@ -82,12 +82,12 @@ const J = ["data-testid"], ae = /* @__PURE__ */ P({
82
82
  a.disabled || a.busy ? `${l}--disabled` : `${l}--active`,
83
83
  a.fluid ? `${l}--fluid` : `${l}--fixed`,
84
84
  a.rounded ? `${l}--rounded` : `${l}--box`
85
- ]), D = u(() => {
85
+ ]), F = u(() => {
86
86
  const r = d.value?.draftStart, o = d.value?.draftEnd;
87
87
  return a.isRange ? !!r && !!o : !!r;
88
88
  });
89
- return (r, o) => (W(), T("div", {
90
- class: X(e(F)),
89
+ return (r, o) => (T(), A("div", {
90
+ class: X(e(h)),
91
91
  "data-testid": t.testId
92
92
  }, [
93
93
  s(e(y), {
@@ -103,21 +103,21 @@ const J = ["data-testid"], ae = /* @__PURE__ */ P({
103
103
  "test-id": `${t.testId}__trigger`,
104
104
  size: t.buttonSize,
105
105
  variant: t.buttonVariant,
106
- width: "100%",
106
+ width: t.buttonWidth,
107
107
  wrap: t.buttonWrapped
108
108
  }, {
109
109
  default: c(() => [
110
110
  v(G(e(M) || t.buttonLabel), 1)
111
111
  ]),
112
112
  _: 1
113
- }, 8, ["aria-label", "border-radius", "busy", "color", "disabled", "icon-before", "icon-size", "rounded", "test-id", "size", "variant", "wrap"]),
113
+ }, 8, ["aria-label", "border-radius", "busy", "color", "disabled", "icon-before", "icon-size", "rounded", "test-id", "size", "variant", "width", "wrap"]),
114
114
  s(e(U), {
115
- "border-radius": e($) ? e(B).None : e(B).Medium,
116
- fullscreen: e($),
115
+ "border-radius": e(C) ? e(p).None : e(p).Medium,
116
+ fullscreen: e(C),
117
117
  "is-open": e(f),
118
118
  "max-width": "336px",
119
- "modal-id": e(w),
120
- "on-close": S,
119
+ "modal-id": e(z),
120
+ "on-close": k,
121
121
  title: t.title
122
122
  }, {
123
123
  body: c(() => [
@@ -125,20 +125,20 @@ const J = ["data-testid"], ae = /* @__PURE__ */ P({
125
125
  ref_key: "calendarRef",
126
126
  ref: d,
127
127
  modelValue: b.value,
128
- "onUpdate:modelValue": o[0] || (o[0] = (N) => b.value = N),
128
+ "onUpdate:modelValue": o[0] || (o[0] = (D) => b.value = D),
129
129
  busy: t.busy,
130
130
  disabled: t.disabled,
131
- fluid: e($),
131
+ fluid: e(C),
132
132
  "is-range": t.isRange
133
133
  }, null, 8, ["modelValue", "busy", "disabled", "fluid", "is-range"])
134
134
  ]),
135
135
  footer: c(() => [
136
- k("div", {
136
+ B("div", {
137
137
  class: X(`${l}__footer-actions`)
138
138
  }, [
139
139
  s(e(y), {
140
140
  color: e(L).Neutral,
141
- "on-click": S,
141
+ "on-click": k,
142
142
  variant: e(g).Ghost
143
143
  }, {
144
144
  default: c(() => [...o[1] || (o[1] = [
@@ -146,7 +146,7 @@ const J = ["data-testid"], ae = /* @__PURE__ */ P({
146
146
  ])]),
147
147
  _: 1
148
148
  }, 8, ["color", "variant"]),
149
- k("div", {
149
+ B("div", {
150
150
  class: X(`${l}__footer-right`)
151
151
  }, [
152
152
  s(e(y), {
@@ -162,7 +162,7 @@ const J = ["data-testid"], ae = /* @__PURE__ */ P({
162
162
  }, 8, ["color", "disabled", "variant"]),
163
163
  s(e(y), {
164
164
  color: e(L).Primary,
165
- disabled: !e(D),
165
+ disabled: !e(F),
166
166
  "on-click": V
167
167
  }, {
168
168
  default: c(() => [...o[3] || (o[3] = [
@@ -12,6 +12,8 @@ export interface CLModalDatePickerProps {
12
12
  buttonSize?: CLSizes;
13
13
  /** Sets the color variant. The property can be one of `CLColorVariants`, e.g `CLColorVariants.Outline`. */
14
14
  buttonVariant?: CLColorVariants;
15
+ /** Sets the width of the trigger button. */
16
+ buttonWidth?: string;
15
17
  /** When set to `true`, it will remove any horizontal and vertical padding from the button. */
16
18
  buttonWrapped?: boolean;
17
19
  /** A `boolean` value which dictates the busy state of the date picker. */
@@ -74,6 +76,7 @@ declare const _default: import('vue').DefineComponent<{
74
76
  buttonLabel: string;
75
77
  buttonSize: CLSizes;
76
78
  buttonVariant: CLColorVariants;
79
+ buttonWidth: string;
77
80
  buttonWrapped: boolean;
78
81
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
79
82
  calendarRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
@@ -64,8 +64,8 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<CL
64
64
  buttonColor: CLColors;
65
65
  buttonSize: CLSizes;
66
66
  buttonVariant: CLColorVariants;
67
- buttonHeight: string;
68
67
  buttonWidth: string;
68
+ buttonHeight: string;
69
69
  containerBordered: boolean;
70
70
  containerElevated: boolean;
71
71
  contentWidth: string;