@codeandfunction/callaloo 4.9.4 → 4.9.5
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/callaloo.global.js +1 -1
- package/dist/chunks/CLA11yButton.vue_vue_type_style_index_0_lang-BHF3fJsf.js +2 -0
- package/dist/chunks/CLButton.vue_vue_type_style_index_0_lang-3vGTMU-k.js +2 -0
- package/dist/chunks/CLCalendar.vue_vue_type_style_index_0_lang-BAfGE35e.js +2 -0
- package/dist/chunks/CLCard.vue_vue_type_style_index_0_lang-DPQxSLkQ.js +2 -0
- package/dist/chunks/CLFormCharCounter.vue_vue_type_style_index_0_lang-BYHbqaf0.js +2 -0
- package/dist/chunks/CLFormLabel.vue_vue_type_script_setup_true_lang-BPwFZq94.js +1 -0
- package/dist/chunks/CLHeading.vue_vue_type_style_index_0_lang-CsmrsD6c.js +2 -0
- package/dist/chunks/CLIcon.vue_vue_type_style_index_0_lang-yF4CdZbV.js +2 -0
- package/dist/chunks/CLInputMessages.vue_vue_type_style_index_0_lang-DCByJ7MB.js +2 -0
- package/dist/chunks/CLLink.vue_vue_type_style_index_0_lang-CCyY39MJ.js +2 -0
- package/dist/chunks/CLModal.vue_vue_type_style_index_0_lang-CwdYGfO9.js +2 -0
- package/dist/chunks/CLNavLink.vue_vue_type_script_setup_true_lang-Ds2aJNK9.js +1 -0
- package/dist/chunks/CLPill.vue_vue_type_style_index_0_lang-BVsLNnfE.js +2 -0
- package/dist/chunks/CLSkeleton.vue_vue_type_style_index_0_lang-BmjT9fQ_.js +2 -0
- package/dist/chunks/CLSpinner.vue_vue_type_style_index_0_lang-DgZLt9T1.js +2 -0
- package/dist/chunks/CLText.vue_vue_type_style_index_0_lang-CMXJdE-D.js +2 -0
- package/dist/chunks/CLToast.vue_vue_type_style_index_0_lang-BIehrtqC.js +2 -0
- package/dist/chunks/context-CRxE5KWX.js +1 -0
- package/dist/chunks/context-JmPivI9V.js +1 -0
- package/dist/chunks/floating-ui.vue-C0JWy0Dz.js +1 -0
- package/dist/chunks/helper-C542dSLs.js +1 -0
- package/dist/chunks/icons-6SVrmx7c.js +1 -0
- package/dist/chunks/utils-C1iUBPIL.js +1 -0
- package/dist/chunks/utils-CCWSWRuR.js +1 -0
- package/dist/chunks/utils-CYywa195.js +1 -0
- package/dist/chunks/utils-DVxwAjJ4.js +1 -0
- package/dist/chunks/utils-Dst7nzvj.js +1 -0
- package/dist/chunks/utils-MElq6rY3.js +1 -0
- package/dist/components/Buttons/CLA11yButton/CLA11yButton.js +1 -5
- package/dist/components/Buttons/CLButton/CLButton.js +1 -5
- package/dist/components/CLIcon/CLIcon.js +1 -5
- package/dist/components/CLTable/CLTable.js +1 -192
- package/dist/components/Containers/CLCard/CLCard.js +1 -5
- package/dist/components/Containers/CLCarousel/CLCarousel.js +1 -544
- package/dist/components/Containers/CLDisclosure/CLDisclosure.js +1 -139
- package/dist/components/Containers/CLDrawer/CLDrawer.js +1 -119
- package/dist/components/Form/CLCalendar/CLCalendar.js +1 -5
- package/dist/components/Form/CLCheckbox/CLCheckbox.js +1 -150
- package/dist/components/Form/CLInput/CLInput.js +1 -450
- package/dist/components/Form/CLInputDatePicker/CLInputDatePicker.js +1 -178
- package/dist/components/Form/CLRadioButton/CLRadioButton.js +1 -135
- package/dist/components/Form/CLSelect/CLSelect.js +1 -140
- package/dist/components/Form/CLTextArea/CLTextArea.js +1 -149
- package/dist/components/Indicators/CLBadge/CLBadge.js +1 -40
- package/dist/components/Indicators/CLBanner/CLBanner.js +1 -145
- package/dist/components/Indicators/CLPill/CLPill.js +1 -5
- package/dist/components/Indicators/CLProgress/CLProgress.js +1 -64
- package/dist/components/Loading/CLSkeleton/CLSkeleton.js +1 -5
- package/dist/components/Loading/CLSpinner/CLSpinner.js +1 -5
- package/dist/components/Modals/CLModal/CLModal.js +1 -5
- package/dist/components/Modals/CLModalDatePicker/CLModalDatePicker.js +1 -182
- package/dist/components/Navigation/CLLink/CLLink.js +1 -5
- package/dist/components/Navigation/CLNavLink/CLNavLink.js +1 -5
- package/dist/components/Navigation/CLNavSection/CLNavSection.js +1 -54
- package/dist/components/Popups/CLDropdownMenu/CLDropdownMenu.js +1 -150
- package/dist/components/Popups/CLToast/CLToast.js +1 -5
- package/dist/components/Providers/CLThemeProvider/CLThemeProvider.js +1 -8
- package/dist/components/Providers/CLToastProvider/CLToastProvider.js +1 -7
- package/dist/components/Typography/CLHeading/CLHeading.js +1 -5
- package/dist/components/Typography/CLText/CLText.js +1 -5
- package/dist/composables/useDateInputMask.js +1 -38
- package/dist/composables/useDatePicker.js +1 -140
- package/dist/composables/useDropdown.js +1 -49
- package/dist/composables/useElementSize.js +1 -73
- package/dist/composables/useEsc.js +1 -19
- package/dist/composables/useHasSlotContent.js +1 -14
- package/dist/composables/useTheme.js +1 -40
- package/dist/composables/useToast.js +1 -17
- package/dist/index.js +1 -30
- package/package.json +20 -20
- package/dist/chunks/CLA11yButton.vue_vue_type_style_index_0_lang-zGLnnSIW.js +0 -47
- package/dist/chunks/CLButton.vue_vue_type_style_index_0_lang-MvhnNzVW.js +0 -136
- package/dist/chunks/CLCalendar.vue_vue_type_style_index_0_lang-Bz1JdT1A.js +0 -163
- package/dist/chunks/CLCard.vue_vue_type_style_index_0_lang-Sre7UYZd.js +0 -263
- package/dist/chunks/CLFormCharCounter.vue_vue_type_style_index_0_lang-CJ4VrvmR.js +0 -39
- package/dist/chunks/CLFormLabel.vue_vue_type_script_setup_true_lang-CIQxM6aH.js +0 -46
- package/dist/chunks/CLHeading.vue_vue_type_style_index_0_lang-DH5oJc1C.js +0 -52
- package/dist/chunks/CLIcon.vue_vue_type_style_index_0_lang-Dhr2tI-g.js +0 -113
- package/dist/chunks/CLInputMessages.vue_vue_type_style_index_0_lang-DTWvAACK.js +0 -149
- package/dist/chunks/CLLink.vue_vue_type_style_index_0_lang-BXysZqLn.js +0 -69
- package/dist/chunks/CLModal.vue_vue_type_style_index_0_lang-BDyONfaQ.js +0 -176
- package/dist/chunks/CLNavLink.vue_vue_type_script_setup_true_lang-Dhnmfa9W.js +0 -44
- package/dist/chunks/CLPill.vue_vue_type_style_index_0_lang-BQim03ge.js +0 -94
- package/dist/chunks/CLSkeleton.vue_vue_type_style_index_0_lang-DduoX6Cu.js +0 -31
- package/dist/chunks/CLSpinner.vue_vue_type_style_index_0_lang-DlXqnsi8.js +0 -55
- package/dist/chunks/CLText.vue_vue_type_style_index_0_lang-B-L8ECJL.js +0 -48
- package/dist/chunks/CLThemeProvider.vue_vue_type_script_setup_true_lang-jaJYKZL8.js +0 -59
- package/dist/chunks/CLToast.vue_vue_type_style_index_0_lang-CzSDeL_X.js +0 -202
- package/dist/chunks/CLToastProvider.vue_vue_type_script_setup_true_lang-DkGK0H4Z.js +0 -35
- package/dist/chunks/context-CEvx70FY.js +0 -264
- package/dist/chunks/context-dkA4VoF7.js +0 -4
- package/dist/chunks/floating-ui.vue-Fx4CxKut.js +0 -1057
- package/dist/chunks/helper-qUkciePY.js +0 -81
- package/dist/chunks/icons-DllZKtC2.js +0 -4
- package/dist/chunks/magic-string.es-uPKorP4O.js +0 -663
- package/dist/chunks/utils-BfOa9ckr.js +0 -24
- package/dist/chunks/utils-BjZURPWx.js +0 -51
- package/dist/chunks/utils-C1xiySYN.js +0 -41
- package/dist/chunks/utils-D00IXMTR.js +0 -25
- package/dist/chunks/utils-eBt2zUZl.js +0 -17
- package/dist/chunks/utils-nD3K7jh9.js +0 -85
- package/dist/chunks/vue-test-utils.esm-bundler-BeQTU4qG.js +0 -18679
- package/dist/composables/useDatePicker.spec.js +0 -232
- package/dist/composables/useTheme.spec.js +0 -88
- package/dist/composables/useToast.spec.js +0 -45
|
@@ -1,453 +1,4 @@
|
|
|
1
1
|
import '../../../assets/core.css';
|
|
2
2
|
import './CLInput.css';
|
|
3
3
|
import '../../../assets/shared/form-utilities.css';
|
|
4
|
-
import { defineComponent as S, computed as z, createElementBlock as $, openBlock as u, normalizeClass as y, unref as a, createBlock as b, Fragment as w, createTextVNode as M, toDisplayString as P, createVNode as K, ref as q, watch as R, createCommentVNode as v, mergeModels as N, useTemplateRef as Q, useModel as W, withCtx as Y, createElementVNode as p, normalizeStyle as Z, withDirectives as _, vModelDynamic as ee, isRef as le } from "vue";
|
|
5
|
-
import { _ as ie, i as ae, a as te } from "../../../chunks/CLInputMessages.vue_vue_type_style_index_0_lang-DTWvAACK.js";
|
|
6
|
-
import { _ as oe } from "../../../chunks/CLFormLabel.vue_vue_type_script_setup_true_lang-CIQxM6aH.js";
|
|
7
|
-
import { _ as ne } from "../../../chunks/CLFormCharCounter.vue_vue_type_style_index_0_lang-CJ4VrvmR.js";
|
|
8
|
-
import { _ as A } from "../../../chunks/CLIcon.vue_vue_type_style_index_0_lang-Dhr2tI-g.js";
|
|
9
|
-
import { _ as F } from "../../../chunks/CLButton.vue_vue_type_style_index_0_lang-MvhnNzVW.js";
|
|
10
|
-
import { CLSizes as o, CLColors as k, CLBorderRadius as E, CLIconSizes as s, CLColorVariants as I, CLIconNames as X, CLInputTypes as d, CLOrientation as T, CLCharCounterLayout as de } from "../../../index.js";
|
|
11
|
-
import { _ as ue } from "../../../chunks/CLPill.vue_vue_type_style_index_0_lang-BQim03ge.js";
|
|
12
|
-
const se = ["data-testid"], H = /* @__PURE__ */ S({
|
|
13
|
-
name: "CLInputPrefix",
|
|
14
|
-
__name: "CLInputPrefix",
|
|
15
|
-
props: {
|
|
16
|
-
ariaLabel: { default: void 0 },
|
|
17
|
-
borderRadius: { default: E.XS },
|
|
18
|
-
color: { default: k.Neutral },
|
|
19
|
-
disabled: { type: Boolean, default: !1 },
|
|
20
|
-
grouped: { type: Boolean, default: !1 },
|
|
21
|
-
onClick: { type: Function, default: void 0 },
|
|
22
|
-
prefix: {},
|
|
23
|
-
size: { default: o.Small },
|
|
24
|
-
testId: { default: "clll-input-prefix" }
|
|
25
|
-
},
|
|
26
|
-
setup(e) {
|
|
27
|
-
const t = e, c = "clll-input", l = (n) => Object.values(X).includes(n), C = (n) => n, i = (n) => n?.replace("rounded-", "") || "xs", x = {
|
|
28
|
-
[o.Tiny]: s.Tiny,
|
|
29
|
-
[o.Small]: s.Small,
|
|
30
|
-
[o.Medium]: s.Medium,
|
|
31
|
-
[o.Large]: s.Large,
|
|
32
|
-
[o.XL]: s.XL,
|
|
33
|
-
[o.XXL]: s.XXL,
|
|
34
|
-
[o.XXXL]: s.XXXL,
|
|
35
|
-
[o.XXXXL]: s.XXXXL
|
|
36
|
-
}, g = z(() => !!t.onClick && l(t.prefix)), r = z(() => [
|
|
37
|
-
`${c}__input-prefix`,
|
|
38
|
-
"form-addon-flex",
|
|
39
|
-
"form-addon-flex--left",
|
|
40
|
-
l(t.prefix) ? `${c}__input-prefix--icon form-addon-flex--icon` : `${c}__input-prefix--string form-addon-flex--string`,
|
|
41
|
-
{ "--interactive": g },
|
|
42
|
-
{ "--input-group": t.grouped || t.prefix },
|
|
43
|
-
{ "--disabled": t.disabled },
|
|
44
|
-
t.grouped ? `form-addon-radius--left-${i(t.borderRadius)}` : ""
|
|
45
|
-
]), L = (n) => {
|
|
46
|
-
t.onClick && n && !t.disabled && (n.stopPropagation(), t.onClick(n));
|
|
47
|
-
};
|
|
48
|
-
return (n, B) => (u(), $("div", {
|
|
49
|
-
class: y(a(r))
|
|
50
|
-
}, [
|
|
51
|
-
a(g) ? (u(), b(a(F), {
|
|
52
|
-
key: 0,
|
|
53
|
-
"aria-label": e.ariaLabel,
|
|
54
|
-
"border-radius": e.borderRadius,
|
|
55
|
-
color: e.color,
|
|
56
|
-
disabled: e.disabled,
|
|
57
|
-
"icon-before": C(e.prefix),
|
|
58
|
-
"icon-size": x[e.size],
|
|
59
|
-
"on-click": L,
|
|
60
|
-
size: e.size,
|
|
61
|
-
"test-id": e.testId,
|
|
62
|
-
variant: a(I).Text,
|
|
63
|
-
wrap: ""
|
|
64
|
-
}, null, 8, ["aria-label", "border-radius", "color", "disabled", "icon-before", "icon-size", "size", "test-id", "variant"])) : (u(), $("span", {
|
|
65
|
-
key: 1,
|
|
66
|
-
class: "icon-container",
|
|
67
|
-
"data-testid": e.testId
|
|
68
|
-
}, [
|
|
69
|
-
l(e.prefix) ? (u(), b(a(A), {
|
|
70
|
-
key: 0,
|
|
71
|
-
name: C(e.prefix),
|
|
72
|
-
size: x[e.size],
|
|
73
|
-
color: e.color
|
|
74
|
-
}, null, 8, ["name", "size", "color"])) : (u(), $(w, { key: 1 }, [
|
|
75
|
-
M(P(e.prefix), 1)
|
|
76
|
-
], 64))
|
|
77
|
-
], 8, se))
|
|
78
|
-
], 2));
|
|
79
|
-
}
|
|
80
|
-
}), re = ["data-testid"], O = /* @__PURE__ */ S({
|
|
81
|
-
name: "CLInputSuffix",
|
|
82
|
-
__name: "CLInputSuffix",
|
|
83
|
-
props: {
|
|
84
|
-
ariaLabel: { default: void 0 },
|
|
85
|
-
borderRadius: { default: E.XS },
|
|
86
|
-
color: { default: k.Neutral },
|
|
87
|
-
disabled: { type: Boolean, default: !1 },
|
|
88
|
-
grouped: { type: Boolean, default: !1 },
|
|
89
|
-
onClick: { type: Function, default: void 0 },
|
|
90
|
-
suffix: {},
|
|
91
|
-
size: { default: o.Small },
|
|
92
|
-
testId: { default: "clll-input-suffix" }
|
|
93
|
-
},
|
|
94
|
-
setup(e) {
|
|
95
|
-
const t = e, c = "clll-input", l = (n) => Object.values(X).includes(n), C = (n) => n, i = (n) => n?.replace("rounded-", "") || "xs", x = {
|
|
96
|
-
[o.Tiny]: s.Tiny,
|
|
97
|
-
[o.Small]: s.Small,
|
|
98
|
-
[o.Medium]: s.Medium,
|
|
99
|
-
[o.Large]: s.Large,
|
|
100
|
-
[o.XL]: s.XL,
|
|
101
|
-
[o.XXL]: s.XXL,
|
|
102
|
-
[o.XXXL]: s.XXXL,
|
|
103
|
-
[o.XXXXL]: s.XXXXL
|
|
104
|
-
}, g = z(() => !!t.onClick && l(t.suffix)), r = z(() => [
|
|
105
|
-
`${c}__input-suffix`,
|
|
106
|
-
"form-addon-flex",
|
|
107
|
-
"form-addon-flex--right",
|
|
108
|
-
l(t.suffix) ? `${c}__input-suffix--icon form-addon-flex--icon` : `${c}__input-suffix--string form-addon-flex--string`,
|
|
109
|
-
{ "--interactive": g },
|
|
110
|
-
{ "--input-group": t.grouped || t.suffix },
|
|
111
|
-
{ "--disabled": t.disabled },
|
|
112
|
-
t.grouped ? `form-addon-radius--right-${i(t.borderRadius)}` : ""
|
|
113
|
-
]), L = (n) => {
|
|
114
|
-
t.onClick && n && !t.disabled && (n.stopPropagation(), t.onClick(n));
|
|
115
|
-
};
|
|
116
|
-
return (n, B) => (u(), $("div", {
|
|
117
|
-
class: y(a(r))
|
|
118
|
-
}, [
|
|
119
|
-
a(g) ? (u(), b(a(F), {
|
|
120
|
-
key: 0,
|
|
121
|
-
"aria-label": e.ariaLabel,
|
|
122
|
-
"border-radius": e.borderRadius,
|
|
123
|
-
color: e.color,
|
|
124
|
-
disabled: e.disabled,
|
|
125
|
-
"icon-before": C(e.suffix),
|
|
126
|
-
"icon-size": x[e.size],
|
|
127
|
-
"on-click": L,
|
|
128
|
-
size: e.size,
|
|
129
|
-
"test-id": e.testId,
|
|
130
|
-
variant: a(I).Text,
|
|
131
|
-
wrap: ""
|
|
132
|
-
}, null, 8, ["aria-label", "border-radius", "color", "disabled", "icon-before", "icon-size", "size", "test-id", "variant"])) : (u(), $("span", {
|
|
133
|
-
key: 1,
|
|
134
|
-
class: "icon-container",
|
|
135
|
-
"data-testid": e.testId
|
|
136
|
-
}, [
|
|
137
|
-
l(e.suffix) ? (u(), b(a(A), {
|
|
138
|
-
key: 0,
|
|
139
|
-
name: C(e.suffix),
|
|
140
|
-
size: x[e.size],
|
|
141
|
-
color: e.color
|
|
142
|
-
}, null, 8, ["name", "size", "color"])) : (u(), $(w, { key: 1 }, [
|
|
143
|
-
M(P(e.suffix), 1)
|
|
144
|
-
], 64))
|
|
145
|
-
], 8, re))
|
|
146
|
-
], 2));
|
|
147
|
-
}
|
|
148
|
-
}), ce = ["data-testid"], U = /* @__PURE__ */ S({
|
|
149
|
-
name: "CLInputPill",
|
|
150
|
-
__name: "CLInputPill",
|
|
151
|
-
props: {
|
|
152
|
-
color: { default: k.Neutral },
|
|
153
|
-
label: {},
|
|
154
|
-
testId: { default: "clll-input-pill" }
|
|
155
|
-
},
|
|
156
|
-
setup(e) {
|
|
157
|
-
const t = "clll-input";
|
|
158
|
-
return (c, l) => (u(), $("span", {
|
|
159
|
-
class: y(`${t}__pill`),
|
|
160
|
-
"data-testid": e.testId
|
|
161
|
-
}, [
|
|
162
|
-
K(a(ue), {
|
|
163
|
-
color: e.color,
|
|
164
|
-
label: e.label,
|
|
165
|
-
variant: a(I).Soft
|
|
166
|
-
}, null, 8, ["color", "label", "variant"])
|
|
167
|
-
], 10, ce));
|
|
168
|
-
}
|
|
169
|
-
}), fe = ["data-testid"], j = /* @__PURE__ */ S({
|
|
170
|
-
name: "CLInputColorTools",
|
|
171
|
-
__name: "CLInputColorTools",
|
|
172
|
-
props: {
|
|
173
|
-
copied: { type: Boolean, default: !1 },
|
|
174
|
-
initialValue: { default: void 0 },
|
|
175
|
-
modelValue: { default: void 0 },
|
|
176
|
-
size: { default: o.Small },
|
|
177
|
-
testId: { default: "clll-input-color-tools" }
|
|
178
|
-
},
|
|
179
|
-
emits: ["copy", "reset", "update:copied"],
|
|
180
|
-
setup(e, { emit: t }) {
|
|
181
|
-
const c = e, l = t, C = "clll-input", i = q(c.copied), x = {
|
|
182
|
-
[o.Tiny]: s.Tiny,
|
|
183
|
-
[o.Small]: s.Small,
|
|
184
|
-
[o.Medium]: s.Medium,
|
|
185
|
-
[o.Large]: s.Large,
|
|
186
|
-
[o.XL]: s.XL,
|
|
187
|
-
[o.XXL]: s.XXL,
|
|
188
|
-
[o.XXXL]: s.XXXL,
|
|
189
|
-
[o.XXXXL]: s.XXXXL
|
|
190
|
-
}, g = async () => {
|
|
191
|
-
try {
|
|
192
|
-
c.modelValue && (await navigator.clipboard.writeText(c.modelValue.toString()), i.value = !0, l("update:copied", !0), l("copy"));
|
|
193
|
-
} catch (L) {
|
|
194
|
-
console.error(L);
|
|
195
|
-
}
|
|
196
|
-
}, r = () => {
|
|
197
|
-
l("reset", c.initialValue);
|
|
198
|
-
};
|
|
199
|
-
return R(() => c.copied, (L) => {
|
|
200
|
-
i.value = L;
|
|
201
|
-
}), R(() => c.modelValue, () => {
|
|
202
|
-
i.value = !1, l("update:copied", !1);
|
|
203
|
-
}), (L, n) => (u(), $("span", {
|
|
204
|
-
class: y(`${C}__selected-color-tools`),
|
|
205
|
-
"data-testid": e.testId
|
|
206
|
-
}, [
|
|
207
|
-
e.modelValue ? (u(), b(a(F), {
|
|
208
|
-
key: 0,
|
|
209
|
-
"aria-label": "Copy color to clipboard",
|
|
210
|
-
class: y(`${C}__copy-to-clipboard`),
|
|
211
|
-
color: a(k).Neutral,
|
|
212
|
-
"icon-before": a(i) ? a(X).Check : a(X).Copy,
|
|
213
|
-
"icon-size": x[e.size],
|
|
214
|
-
"on-click": g,
|
|
215
|
-
size: e.size,
|
|
216
|
-
title: a(i) ? "Color copied to clipboard" : "Copy color to clipboard",
|
|
217
|
-
variant: a(I).Ghost,
|
|
218
|
-
wrap: ""
|
|
219
|
-
}, null, 8, ["class", "color", "icon-before", "icon-size", "size", "title", "variant"])) : v("", !0),
|
|
220
|
-
e.modelValue ? (u(), b(a(F), {
|
|
221
|
-
key: 1,
|
|
222
|
-
"aria-label": "Reset selected color",
|
|
223
|
-
class: y(`${C}__reset-selected-color`),
|
|
224
|
-
color: a(k).Neutral,
|
|
225
|
-
"on-click": r,
|
|
226
|
-
"icon-before": a(X).Restore,
|
|
227
|
-
"icon-size": x[e.size],
|
|
228
|
-
size: e.size,
|
|
229
|
-
title: "Reset selected color",
|
|
230
|
-
variant: a(I).Ghost,
|
|
231
|
-
wrap: ""
|
|
232
|
-
}, null, 8, ["class", "color", "icon-before", "icon-size", "size", "variant"])) : v("", !0)
|
|
233
|
-
], 10, fe));
|
|
234
|
-
}
|
|
235
|
-
}), me = ["data-testid"], be = ["id", "name", "aria-label", "autocomplete", "disabled", "form", "maxlength", "minlength", "pattern", "placeholder", "readonly", "required", "spellcheck", "type"], xe = /* @__PURE__ */ S({
|
|
236
|
-
name: "CLInput",
|
|
237
|
-
__name: "CLInput",
|
|
238
|
-
props: /* @__PURE__ */ N({
|
|
239
|
-
ariaLabel: { default: void 0 },
|
|
240
|
-
autoComplete: { type: Boolean, default: void 0 },
|
|
241
|
-
borderRadius: { default: void 0 },
|
|
242
|
-
busy: { type: Boolean, default: !1 },
|
|
243
|
-
charCounter: { type: Boolean, default: !1 },
|
|
244
|
-
color: { default: k.Neutral },
|
|
245
|
-
disabled: { type: Boolean, default: !1 },
|
|
246
|
-
fluid: { type: Boolean, default: !1 },
|
|
247
|
-
form: { default: void 0 },
|
|
248
|
-
grouped: { type: Boolean, default: !1 },
|
|
249
|
-
id: {},
|
|
250
|
-
label: { default: void 0 },
|
|
251
|
-
maxLength: { default: void 0 },
|
|
252
|
-
messages: { default: () => [] },
|
|
253
|
-
messageType: { default: void 0 },
|
|
254
|
-
minLength: { default: void 0 },
|
|
255
|
-
name: {},
|
|
256
|
-
onBlur: { type: Function, default: void 0 },
|
|
257
|
-
onChange: { type: Function, default: void 0 },
|
|
258
|
-
onFocus: { type: Function, default: void 0 },
|
|
259
|
-
onInput: { type: Function, default: void 0 },
|
|
260
|
-
onPrefixClick: { type: Function, default: void 0 },
|
|
261
|
-
onSuffixClick: { type: Function, default: void 0 },
|
|
262
|
-
orientation: { default: T.Vertical },
|
|
263
|
-
pattern: { default: void 0 },
|
|
264
|
-
pill: { default: void 0 },
|
|
265
|
-
placeholder: { default: void 0 },
|
|
266
|
-
prefix: { default: void 0 },
|
|
267
|
-
prefixAriaLabel: { default: void 0 },
|
|
268
|
-
readonly: { type: Boolean, default: !1 },
|
|
269
|
-
required: { type: Boolean, default: !1 },
|
|
270
|
-
rounded: { type: Boolean, default: !0 },
|
|
271
|
-
size: { default: o.Small },
|
|
272
|
-
spellCheck: { type: Boolean, default: void 0 },
|
|
273
|
-
suffix: { default: void 0 },
|
|
274
|
-
suffixAriaLabel: { default: void 0 },
|
|
275
|
-
testId: { default: "clll-input" },
|
|
276
|
-
type: { default: d.Text },
|
|
277
|
-
variant: { default: I.Outline }
|
|
278
|
-
}, {
|
|
279
|
-
modelValue: {},
|
|
280
|
-
modelModifiers: {}
|
|
281
|
-
}),
|
|
282
|
-
emits: /* @__PURE__ */ N(["reset"], ["update:modelValue"]),
|
|
283
|
-
setup(e, { expose: t, emit: c }) {
|
|
284
|
-
const l = e, C = c, i = "clll-input", x = q(!1), g = Q("input-elem"), r = W(e, "modelValue");
|
|
285
|
-
l.type === d.Color && !r.value && (r.value = "#FFFFFF");
|
|
286
|
-
const L = r.value?.toString(), n = (h) => Object.values(X).includes(h), B = z(() => [
|
|
287
|
-
i,
|
|
288
|
-
l.borderRadius ? `${i}--${l.borderRadius}` : "",
|
|
289
|
-
l.busy ? `${i}--busy` : `${i}--ready`,
|
|
290
|
-
`${i}--${l.color}`,
|
|
291
|
-
`${i}--${l.size}`,
|
|
292
|
-
`${i}--${l.type}`,
|
|
293
|
-
`${i}--${l.variant}`,
|
|
294
|
-
l.disabled || l.busy ? `${i}--disabled` : `${i}--active`,
|
|
295
|
-
l.fluid || l.orientation === T.Horizontal ? `${i}--fluid` : `${i}--fixed`,
|
|
296
|
-
l.grouped ? `${i}--grouped` : "",
|
|
297
|
-
l.label ? `${i}--haslabel` : "",
|
|
298
|
-
l.messageType ? `${i}--${l.messageType}` : "",
|
|
299
|
-
l.orientation ? `${i}--${l.orientation}` : "",
|
|
300
|
-
l.pill ? `${i}--haspill` : "",
|
|
301
|
-
l.charCounter && l.maxLength && [d.Email, d.None, d.Text, d.Url].includes(l.type) ? `${i}--hascharcounter` : "",
|
|
302
|
-
l.prefix && ![d.Color, d.File].includes(l.type) ? `${i}--hasprefix` : "",
|
|
303
|
-
l.prefix && ![d.Color, d.File].includes(l.type) ? n(l.prefix) ? `${i}--hasiconprefix` : `${i}--hascustomprefix` : "",
|
|
304
|
-
l.readonly ? `${i}--readonly` : `${i}--writeable`,
|
|
305
|
-
l.rounded ? `${i}--rounded` : `${i}--box`,
|
|
306
|
-
l.required ? `${i}--required` : `${i}--optional`,
|
|
307
|
-
l.suffix && ![d.Color, d.File].includes(l.type) ? `${i}--hassuffix` : "",
|
|
308
|
-
l.suffix && ![d.Color, d.File].includes(l.type) ? n(l.suffix) ? `${i}--hasiconsuffix` : `${i}--hascustomsuffix` : ""
|
|
309
|
-
]), D = z(() => [
|
|
310
|
-
`${i}__input`,
|
|
311
|
-
{ "--nocolor": l.type === d.Color && !r.value },
|
|
312
|
-
{ "--input-group": l.grouped || l.prefix || l.suffix }
|
|
313
|
-
]), G = (h) => {
|
|
314
|
-
r.value = h, C("reset", r.value);
|
|
315
|
-
}, J = (h) => {
|
|
316
|
-
!h.target.closest('button, a, [role="button"]') && g.value && g.value.focus();
|
|
317
|
-
};
|
|
318
|
-
return R(r, () => {
|
|
319
|
-
x.value = !1;
|
|
320
|
-
}), t({
|
|
321
|
-
inputRef: g
|
|
322
|
-
}), (h, f) => (u(), b(ie, {
|
|
323
|
-
fluid: e.fluid,
|
|
324
|
-
"has-pill": !!e.pill,
|
|
325
|
-
"has-char-counter": !!(e.charCounter && e.maxLength),
|
|
326
|
-
orientation: e.orientation
|
|
327
|
-
}, {
|
|
328
|
-
default: Y(() => [
|
|
329
|
-
p("span", {
|
|
330
|
-
class: y(a(B)),
|
|
331
|
-
style: Z(a(ae)({ color: e.color, variant: e.variant })),
|
|
332
|
-
"data-testid": e.testId
|
|
333
|
-
}, [
|
|
334
|
-
e.label ? (u(), b(oe, {
|
|
335
|
-
key: 0,
|
|
336
|
-
"css-prefix": i,
|
|
337
|
-
"html-for": e.id,
|
|
338
|
-
label: e.label,
|
|
339
|
-
required: e.required,
|
|
340
|
-
size: e.size
|
|
341
|
-
}, null, 8, ["html-for", "label", "required", "size"])) : v("", !0),
|
|
342
|
-
p("span", {
|
|
343
|
-
class: y([`${i}__input-container`, "--focus-within"]),
|
|
344
|
-
onClick: J
|
|
345
|
-
}, [
|
|
346
|
-
e.prefix && ![a(d).Color, a(d).File].includes(e.type) ? (u(), b(H, {
|
|
347
|
-
key: 0,
|
|
348
|
-
prefix: e.prefix,
|
|
349
|
-
size: e.size,
|
|
350
|
-
grouped: e.grouped,
|
|
351
|
-
"border-radius": e.borderRadius,
|
|
352
|
-
color: e.color,
|
|
353
|
-
"on-click": e.onPrefixClick,
|
|
354
|
-
"aria-label": e.prefixAriaLabel,
|
|
355
|
-
disabled: e.disabled || e.busy
|
|
356
|
-
}, null, 8, ["prefix", "size", "grouped", "border-radius", "color", "on-click", "aria-label", "disabled"])) : v("", !0),
|
|
357
|
-
p("span", {
|
|
358
|
-
class: y(`${i}__input-border-control`)
|
|
359
|
-
}, [
|
|
360
|
-
_(p("input", {
|
|
361
|
-
id: e.id,
|
|
362
|
-
ref: "input-elem",
|
|
363
|
-
"onUpdate:modelValue": f[0] || (f[0] = (m) => r.value = m),
|
|
364
|
-
name: e.name,
|
|
365
|
-
"aria-label": e.ariaLabel,
|
|
366
|
-
autocomplete: e.autoComplete ? "on" : "off",
|
|
367
|
-
class: y(a(D)),
|
|
368
|
-
disabled: e.disabled || e.busy,
|
|
369
|
-
form: e.form,
|
|
370
|
-
maxlength: e.maxLength,
|
|
371
|
-
minlength: e.minLength,
|
|
372
|
-
pattern: e.pattern,
|
|
373
|
-
placeholder: e.placeholder,
|
|
374
|
-
readonly: e.readonly,
|
|
375
|
-
required: e.required,
|
|
376
|
-
spellcheck: e.spellCheck,
|
|
377
|
-
type: e.type,
|
|
378
|
-
onBlur: f[1] || (f[1] = //@ts-ignore
|
|
379
|
-
(...m) => e.onBlur && e.onBlur(...m)),
|
|
380
|
-
onChange: f[2] || (f[2] = //@ts-ignore
|
|
381
|
-
(...m) => e.onChange && e.onChange(...m)),
|
|
382
|
-
onFocus: f[3] || (f[3] = //@ts-ignore
|
|
383
|
-
(...m) => e.onFocus && e.onFocus(...m)),
|
|
384
|
-
onInput: f[4] || (f[4] = //@ts-ignore
|
|
385
|
-
(...m) => e.onInput && e.onInput(...m))
|
|
386
|
-
}, null, 42, be), [
|
|
387
|
-
[ee, r.value]
|
|
388
|
-
])
|
|
389
|
-
], 2),
|
|
390
|
-
e.type === a(d).Color ? (u(), $("span", {
|
|
391
|
-
key: 1,
|
|
392
|
-
class: y(`${i}__selected-color`)
|
|
393
|
-
}, P(r.value || "none"), 3)) : v("", !0),
|
|
394
|
-
e.type === a(d).Color ? (u(), b(j, {
|
|
395
|
-
key: 2,
|
|
396
|
-
modelValue: r.value,
|
|
397
|
-
"onUpdate:modelValue": f[5] || (f[5] = (m) => r.value = m),
|
|
398
|
-
copied: a(x),
|
|
399
|
-
"onUpdate:copied": f[6] || (f[6] = (m) => le(x) ? x.value = m : null),
|
|
400
|
-
"initial-value": a(L),
|
|
401
|
-
size: e.size,
|
|
402
|
-
onReset: G
|
|
403
|
-
}, null, 8, ["modelValue", "copied", "initial-value", "size"])) : v("", !0),
|
|
404
|
-
e.suffix && ![a(d).Color, a(d).File].includes(e.type) ? (u(), b(O, {
|
|
405
|
-
key: 3,
|
|
406
|
-
suffix: e.suffix,
|
|
407
|
-
size: e.size,
|
|
408
|
-
grouped: e.grouped,
|
|
409
|
-
"border-radius": e.borderRadius,
|
|
410
|
-
color: e.color,
|
|
411
|
-
"on-click": e.onSuffixClick,
|
|
412
|
-
"aria-label": e.suffixAriaLabel,
|
|
413
|
-
disabled: e.disabled || e.busy
|
|
414
|
-
}, null, 8, ["suffix", "size", "grouped", "border-radius", "color", "on-click", "aria-label", "disabled"])) : v("", !0),
|
|
415
|
-
e.charCounter && e.maxLength && [a(d).Email, a(d).None, a(d).Text, a(d).Url].includes(e.type) ? (u(), b(ne, {
|
|
416
|
-
key: 4,
|
|
417
|
-
color: e.color,
|
|
418
|
-
"css-prefix": i,
|
|
419
|
-
"current-length": r.value ? r.value.toString().length : 0,
|
|
420
|
-
"max-length": e.maxLength,
|
|
421
|
-
layout: a(de).Inline,
|
|
422
|
-
size: e.size
|
|
423
|
-
}, null, 8, ["color", "current-length", "max-length", "layout", "size"])) : v("", !0)
|
|
424
|
-
], 2)
|
|
425
|
-
], 14, me),
|
|
426
|
-
e.pill && e.label && e.orientation === a(T).Horizontal ? (u(), $("span", {
|
|
427
|
-
key: 0,
|
|
428
|
-
class: y(`${i}__spacer`)
|
|
429
|
-
}, null, 2)) : v("", !0),
|
|
430
|
-
e.pill ? (u(), b(U, {
|
|
431
|
-
key: 1,
|
|
432
|
-
label: e.pill,
|
|
433
|
-
color: e.color
|
|
434
|
-
}, null, 8, ["label", "color"])) : v("", !0),
|
|
435
|
-
e.id ? (u(), b(te, {
|
|
436
|
-
key: 2,
|
|
437
|
-
id: e.id,
|
|
438
|
-
messages: e.messages,
|
|
439
|
-
"message-type": e.messageType
|
|
440
|
-
}, null, 8, ["id", "messages", "message-type"])) : v("", !0)
|
|
441
|
-
]),
|
|
442
|
-
_: 1
|
|
443
|
-
}, 8, ["fluid", "has-pill", "has-char-counter", "orientation"]));
|
|
444
|
-
}
|
|
445
|
-
}), V = xe;
|
|
446
|
-
V.Prefix = H;
|
|
447
|
-
V.Suffix = O;
|
|
448
|
-
V.Pill = U;
|
|
449
|
-
V.ColorTools = j;
|
|
450
|
-
export {
|
|
451
|
-
V as CLInput,
|
|
452
|
-
V as default
|
|
453
|
-
};
|
|
4
|
+
import{defineComponent as e,computed as l,createElementBlock as a,openBlock as o,normalizeClass as i,unref as t,createBlock as r,Fragment as d,createTextVNode as n,toDisplayString as u,createVNode as s,ref as p,watch as c,createCommentVNode as f,mergeModels as m,useTemplateRef as b,useModel as y,withCtx as x,createElementVNode as v,normalizeStyle as _,withDirectives as g,vModelDynamic as h,isRef as L}from"vue";import{_ as X,i as C,a as z}from"../../../chunks/CLInputMessages.vue_vue_type_style_index_0_lang-DCByJ7MB.js";import{_ as $}from"../../../chunks/CLFormLabel.vue_vue_type_script_setup_true_lang-BPwFZq94.js";import{_ as k}from"../../../chunks/CLFormCharCounter.vue_vue_type_style_index_0_lang-BYHbqaf0.js";import{_ as I}from"../../../chunks/CLIcon.vue_vue_type_style_index_0_lang-yF4CdZbV.js";import{_ as F}from"../../../chunks/CLButton.vue_vue_type_style_index_0_lang-3vGTMU-k.js";import{CLSizes as S,CLColors as B,CLBorderRadius as T,CLIconSizes as R,CLColorVariants as V,CLIconNames as P,CLInputTypes as j,CLOrientation as q,CLCharCounterLayout as w}from"../../../index.js";import{_ as M}from"../../../chunks/CLPill.vue_vue_type_style_index_0_lang-BVsLNnfE.js";const N=["data-testid"],U=/* @__PURE__ */e({name:"CLInputPrefix",__name:"CLInputPrefix",props:{ariaLabel:{default:void 0},borderRadius:{default:T.XS},color:{default:B.Neutral},disabled:{type:Boolean,default:!1},grouped:{type:Boolean,default:!1},onClick:{type:Function,default:void 0},prefix:{},size:{default:S.Small},testId:{default:"clll-input-prefix"}},setup(e){const s=e,p="clll-input",c=e=>Object.values(P).includes(e),f={[S.Tiny]:R.Tiny,[S.Small]:R.Small,[S.Medium]:R.Medium,[S.Large]:R.Large,[S.XL]:R.XL,[S.XXL]:R.XXL,[S.XXXL]:R.XXXL,[S.XXXXL]:R.XXXXL},m=l(()=>!!s.onClick&&c(s.prefix)),b=l(()=>{return[`${p}__input-prefix`,"form-addon-flex","form-addon-flex--left",c(s.prefix)?`${p}__input-prefix--icon form-addon-flex--icon`:`${p}__input-prefix--string form-addon-flex--string`,{"--interactive":m},{"--input-group":s.grouped||s.prefix},{"--disabled":s.disabled},s.grouped?`form-addon-radius--left-${e=s.borderRadius,e?.replace("rounded-","")||"xs"}`:""];var e}),y=e=>{s.onClick&&e&&!s.disabled&&(e.stopPropagation(),s.onClick(e))};return(l,s)=>(o(),a("div",{class:i(t(b))},[t(m)?(o(),r(t(F),{key:0,"aria-label":e.ariaLabel,"border-radius":e.borderRadius,color:e.color,disabled:e.disabled,"icon-before":e.prefix,"icon-size":f[e.size],"on-click":y,size:e.size,"test-id":e.testId,variant:t(V).Text,wrap:""},null,8,["aria-label","border-radius","color","disabled","icon-before","icon-size","size","test-id","variant"])):(o(),a("span",{key:1,class:"icon-container","data-testid":e.testId},[c(e.prefix)?(o(),r(t(I),{key:0,name:e.prefix,size:f[e.size],color:e.color},null,8,["name","size","color"])):(o(),a(d,{key:1},[n(u(e.prefix),1)],64))],8,N))],2))}}),A=["data-testid"],O=/* @__PURE__ */e({name:"CLInputSuffix",__name:"CLInputSuffix",props:{ariaLabel:{default:void 0},borderRadius:{default:T.XS},color:{default:B.Neutral},disabled:{type:Boolean,default:!1},grouped:{type:Boolean,default:!1},onClick:{type:Function,default:void 0},suffix:{},size:{default:S.Small},testId:{default:"clll-input-suffix"}},setup(e){const s=e,p="clll-input",c=e=>Object.values(P).includes(e),f={[S.Tiny]:R.Tiny,[S.Small]:R.Small,[S.Medium]:R.Medium,[S.Large]:R.Large,[S.XL]:R.XL,[S.XXL]:R.XXL,[S.XXXL]:R.XXXL,[S.XXXXL]:R.XXXXL},m=l(()=>!!s.onClick&&c(s.suffix)),b=l(()=>{return[`${p}__input-suffix`,"form-addon-flex","form-addon-flex--right",c(s.suffix)?`${p}__input-suffix--icon form-addon-flex--icon`:`${p}__input-suffix--string form-addon-flex--string`,{"--interactive":m},{"--input-group":s.grouped||s.suffix},{"--disabled":s.disabled},s.grouped?`form-addon-radius--right-${e=s.borderRadius,e?.replace("rounded-","")||"xs"}`:""];var e}),y=e=>{s.onClick&&e&&!s.disabled&&(e.stopPropagation(),s.onClick(e))};return(l,s)=>(o(),a("div",{class:i(t(b))},[t(m)?(o(),r(t(F),{key:0,"aria-label":e.ariaLabel,"border-radius":e.borderRadius,color:e.color,disabled:e.disabled,"icon-before":e.suffix,"icon-size":f[e.size],"on-click":y,size:e.size,"test-id":e.testId,variant:t(V).Text,wrap:""},null,8,["aria-label","border-radius","color","disabled","icon-before","icon-size","size","test-id","variant"])):(o(),a("span",{key:1,class:"icon-container","data-testid":e.testId},[c(e.suffix)?(o(),r(t(I),{key:0,name:e.suffix,size:f[e.size],color:e.color},null,8,["name","size","color"])):(o(),a(d,{key:1},[n(u(e.suffix),1)],64))],8,A))],2))}}),E=["data-testid"],G=/* @__PURE__ */e({name:"CLInputPill",__name:"CLInputPill",props:{color:{default:B.Neutral},label:{},testId:{default:"clll-input-pill"}},setup:e=>(l,r)=>(o(),a("span",{class:i("clll-input__pill"),"data-testid":e.testId},[s(t(M),{color:e.color,label:e.label,variant:t(V).Soft},null,8,["color","label","variant"])],10,E))}),H=["data-testid"],D=/* @__PURE__ */e({name:"CLInputColorTools",__name:"CLInputColorTools",props:{copied:{type:Boolean,default:!1},initialValue:{default:void 0},modelValue:{default:void 0},size:{default:S.Small},testId:{default:"clll-input-color-tools"}},emits:["copy","reset","update:copied"],setup(e,{emit:l}){const d=e,n=l,u="clll-input",s=p(d.copied),m={[S.Tiny]:R.Tiny,[S.Small]:R.Small,[S.Medium]:R.Medium,[S.Large]:R.Large,[S.XL]:R.XL,[S.XXL]:R.XXL,[S.XXXL]:R.XXXL,[S.XXXXL]:R.XXXXL},b=async()=>{try{d.modelValue&&(await navigator.clipboard.writeText(d.modelValue.toString()),s.value=!0,n("update:copied",!0),n("copy"))}catch(e){console.error(e)}},y=()=>{n("reset",d.initialValue)};return c(()=>d.copied,e=>{s.value=e}),c(()=>d.modelValue,()=>{s.value=!1,n("update:copied",!1)}),(l,d)=>(o(),a("span",{class:i(`${u}__selected-color-tools`),"data-testid":e.testId},[e.modelValue?(o(),r(t(F),{key:0,"aria-label":"Copy color to clipboard",class:i(`${u}__copy-to-clipboard`),color:t(B).Neutral,"icon-before":t(s)?t(P).Check:t(P).Copy,"icon-size":m[e.size],"on-click":b,size:e.size,title:t(s)?"Color copied to clipboard":"Copy color to clipboard",variant:t(V).Ghost,wrap:""},null,8,["class","color","icon-before","icon-size","size","title","variant"])):f("",!0),e.modelValue?(o(),r(t(F),{key:1,"aria-label":"Reset selected color",class:i(`${u}__reset-selected-color`),color:t(B).Neutral,"on-click":y,"icon-before":t(P).Restore,"icon-size":m[e.size],size:e.size,title:"Reset selected color",variant:t(V).Ghost,wrap:""},null,8,["class","color","icon-before","icon-size","size","variant"])):f("",!0)],10,H))}}),J=["data-testid"],K=["id","name","aria-label","autocomplete","disabled","form","maxlength","minlength","pattern","placeholder","readonly","required","spellcheck","type"],Q=/* @__PURE__ */e({name:"CLInput",__name:"CLInput",props:/* @__PURE__ */m({ariaLabel:{default:void 0},autoComplete:{type:Boolean,default:void 0},borderRadius:{default:void 0},busy:{type:Boolean,default:!1},charCounter:{type:Boolean,default:!1},color:{default:B.Neutral},disabled:{type:Boolean,default:!1},fluid:{type:Boolean,default:!1},form:{default:void 0},grouped:{type:Boolean,default:!1},id:{},label:{default:void 0},maxLength:{default:void 0},messages:{default:()=>[]},messageType:{default:void 0},minLength:{default:void 0},name:{},onBlur:{type:Function,default:void 0},onChange:{type:Function,default:void 0},onFocus:{type:Function,default:void 0},onInput:{type:Function,default:void 0},onPrefixClick:{type:Function,default:void 0},onSuffixClick:{type:Function,default:void 0},orientation:{default:q.Vertical},pattern:{default:void 0},pill:{default:void 0},placeholder:{default:void 0},prefix:{default:void 0},prefixAriaLabel:{default:void 0},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},rounded:{type:Boolean,default:!0},size:{default:S.Small},spellCheck:{type:Boolean,default:void 0},suffix:{default:void 0},suffixAriaLabel:{default:void 0},testId:{default:"clll-input"},type:{default:j.Text},variant:{default:V.Outline}},{modelValue:{},modelModifiers:{}}),emits:/* @__PURE__ */m(["reset"],["update:modelValue"]),setup(e,{expose:d,emit:n}){const s=e,m=n,I="clll-input",F=p(!1),S=b("input-elem"),B=y(e,"modelValue");s.type!==j.Color||B.value||(B.value="#FFFFFF");const T=B.value?.toString(),R=e=>Object.values(P).includes(e),V=l(()=>[I,s.borderRadius?`${I}--${s.borderRadius}`:"",s.busy?`${I}--busy`:`${I}--ready`,`${I}--${s.color}`,`${I}--${s.size}`,`${I}--${s.type}`,`${I}--${s.variant}`,s.disabled||s.busy?`${I}--disabled`:`${I}--active`,s.fluid||s.orientation===q.Horizontal?`${I}--fluid`:`${I}--fixed`,s.grouped?`${I}--grouped`:"",s.label?`${I}--haslabel`:"",s.messageType?`${I}--${s.messageType}`:"",s.orientation?`${I}--${s.orientation}`:"",s.pill?`${I}--haspill`:"",s.charCounter&&s.maxLength&&[j.Email,j.None,j.Text,j.Url].includes(s.type)?`${I}--hascharcounter`:"",s.prefix&&![j.Color,j.File].includes(s.type)?`${I}--hasprefix`:"",s.prefix&&![j.Color,j.File].includes(s.type)?R(s.prefix)?`${I}--hasiconprefix`:`${I}--hascustomprefix`:"",s.readonly?`${I}--readonly`:`${I}--writeable`,s.rounded?`${I}--rounded`:`${I}--box`,s.required?`${I}--required`:`${I}--optional`,s.suffix&&![j.Color,j.File].includes(s.type)?`${I}--hassuffix`:"",s.suffix&&![j.Color,j.File].includes(s.type)?R(s.suffix)?`${I}--hasiconsuffix`:`${I}--hascustomsuffix`:""]),M=l(()=>[`${I}__input`,{"--nocolor":s.type===j.Color&&!B.value},{"--input-group":s.grouped||s.prefix||s.suffix}]),N=e=>{B.value=e,m("reset",B.value)},A=e=>{!e.target.closest('button, a, [role="button"]')&&S.value&&S.value.focus()};return c(B,()=>{F.value=!1}),d({inputRef:S}),(l,d)=>(o(),r(X,{fluid:e.fluid,"has-pill":!!e.pill,"has-char-counter":!(!e.charCounter||!e.maxLength),orientation:e.orientation},{default:x(()=>[v("span",{class:i(t(V)),style:_(t(C)({color:e.color,variant:e.variant})),"data-testid":e.testId},[e.label?(o(),r($,{key:0,"css-prefix":I,"html-for":e.id,label:e.label,required:e.required,size:e.size},null,8,["html-for","label","required","size"])):f("",!0),v("span",{class:i([`${I}__input-container`,"--focus-within"]),onClick:A},[e.prefix&&![t(j).Color,t(j).File].includes(e.type)?(o(),r(U,{key:0,prefix:e.prefix,size:e.size,grouped:e.grouped,"border-radius":e.borderRadius,color:e.color,"on-click":e.onPrefixClick,"aria-label":e.prefixAriaLabel,disabled:e.disabled||e.busy},null,8,["prefix","size","grouped","border-radius","color","on-click","aria-label","disabled"])):f("",!0),v("span",{class:i(`${I}__input-border-control`)},[g(v("input",{id:e.id,ref:"input-elem","onUpdate:modelValue":d[0]||(d[0]=e=>B.value=e),name:e.name,"aria-label":e.ariaLabel,autocomplete:e.autoComplete?"on":"off",class:i(t(M)),disabled:e.disabled||e.busy,form:e.form,maxlength:e.maxLength,minlength:e.minLength,pattern:e.pattern,placeholder:e.placeholder,readonly:e.readonly,required:e.required,spellcheck:e.spellCheck,type:e.type,onBlur:d[1]||(d[1]=(...l)=>e.onBlur&&e.onBlur(...l)),onChange:d[2]||(d[2]=(...l)=>e.onChange&&e.onChange(...l)),onFocus:d[3]||(d[3]=(...l)=>e.onFocus&&e.onFocus(...l)),onInput:d[4]||(d[4]=(...l)=>e.onInput&&e.onInput(...l))},null,42,K),[[h,B.value]])],2),e.type===t(j).Color?(o(),a("span",{key:1,class:i(`${I}__selected-color`)},u(B.value||"none"),3)):f("",!0),e.type===t(j).Color?(o(),r(D,{key:2,modelValue:B.value,"onUpdate:modelValue":d[5]||(d[5]=e=>B.value=e),copied:t(F),"onUpdate:copied":d[6]||(d[6]=e=>L(F)?F.value=e:null),"initial-value":t(T),size:e.size,onReset:N},null,8,["modelValue","copied","initial-value","size"])):f("",!0),e.suffix&&![t(j).Color,t(j).File].includes(e.type)?(o(),r(O,{key:3,suffix:e.suffix,size:e.size,grouped:e.grouped,"border-radius":e.borderRadius,color:e.color,"on-click":e.onSuffixClick,"aria-label":e.suffixAriaLabel,disabled:e.disabled||e.busy},null,8,["suffix","size","grouped","border-radius","color","on-click","aria-label","disabled"])):f("",!0),e.charCounter&&e.maxLength&&[t(j).Email,t(j).None,t(j).Text,t(j).Url].includes(e.type)?(o(),r(k,{key:4,color:e.color,"css-prefix":I,"current-length":B.value?B.value.toString().length:0,"max-length":e.maxLength,layout:t(w).Inline,size:e.size},null,8,["color","current-length","max-length","layout","size"])):f("",!0)],2)],14,J),e.pill&&e.label&&e.orientation===t(q).Horizontal?(o(),a("span",{key:0,class:i(`${I}__spacer`)},null,2)):f("",!0),e.pill?(o(),r(G,{key:1,label:e.pill,color:e.color},null,8,["label","color"])):f("",!0),e.id?(o(),r(z,{key:2,id:e.id,messages:e.messages,"message-type":e.messageType},null,8,["id","messages","message-type"])):f("",!0)]),_:1},8,["fluid","has-pill","has-char-counter","orientation"]))}});Q.Prefix=U,Q.Suffix=O,Q.Pill=G,Q.ColorTools=D;export{Q as CLInput,Q as default};
|
|
@@ -1,180 +1,3 @@
|
|
|
1
1
|
import '../../../assets/core.css';
|
|
2
2
|
import './CLInputDatePicker.css';
|
|
3
|
-
import
|
|
4
|
-
import { u as W, a as X, o as Z, f as _, s as ee } from "../../../chunks/floating-ui.vue-Fx4CxKut.js";
|
|
5
|
-
import { _ as ae } from "../../../chunks/CLCard.vue_vue_type_style_index_0_lang-Sre7UYZd.js";
|
|
6
|
-
import { CLInput as te } from "../CLInput/CLInput.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 oe, CLOrientation as ie, CLSizes as ue, CLColors as de } from "../../../index.js";
|
|
9
|
-
import { i as Y } from "../../../chunks/helper-qUkciePY.js";
|
|
10
|
-
import { useEsc as re } from "../../../composables/useEsc.js";
|
|
11
|
-
import { useDateInputMask as se } from "../../../composables/useDateInputMask.js";
|
|
12
|
-
const he = /* @__PURE__ */ N({
|
|
13
|
-
name: "CLInputDatePicker",
|
|
14
|
-
__name: "CLInputDatePicker",
|
|
15
|
-
props: /* @__PURE__ */ U({
|
|
16
|
-
ariaLabel: { default: void 0 },
|
|
17
|
-
borderRadius: { default: void 0 },
|
|
18
|
-
color: { default: de.Neutral },
|
|
19
|
-
size: { default: ue.Small },
|
|
20
|
-
variant: { default: D.Outline },
|
|
21
|
-
busy: { type: Boolean, default: !1 },
|
|
22
|
-
disabled: { type: Boolean, default: !1 },
|
|
23
|
-
fluid: { type: Boolean, default: !1 },
|
|
24
|
-
form: { default: void 0 },
|
|
25
|
-
id: {},
|
|
26
|
-
isRange: { type: Boolean, default: !0 },
|
|
27
|
-
label: { default: void 0 },
|
|
28
|
-
messages: { default: () => [] },
|
|
29
|
-
messageType: { default: void 0 },
|
|
30
|
-
name: {},
|
|
31
|
-
onBlur: { type: Function, default: void 0 },
|
|
32
|
-
onChange: { type: Function, default: void 0 },
|
|
33
|
-
onFocus: { type: Function, default: void 0 },
|
|
34
|
-
orientation: { default: ie.Vertical },
|
|
35
|
-
placement: { default: oe.BottomStart },
|
|
36
|
-
placeholder: { default: void 0 },
|
|
37
|
-
required: { type: Boolean, default: !1 },
|
|
38
|
-
rounded: { type: Boolean, default: !0 },
|
|
39
|
-
testId: { default: "clll-input-date-picker" }
|
|
40
|
-
}, {
|
|
41
|
-
modelValue: {
|
|
42
|
-
default: () => ({ end: null, start: null })
|
|
43
|
-
},
|
|
44
|
-
modelModifiers: {}
|
|
45
|
-
}),
|
|
46
|
-
emits: ["update:modelValue"],
|
|
47
|
-
setup(e) {
|
|
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
|
-
if (!a) {
|
|
52
|
-
u.value = "";
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (!n.isRange || !t) {
|
|
56
|
-
u.value = a;
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
u.value = `${a} - ${t}`;
|
|
60
|
-
}, { immediate: !0, deep: !0 });
|
|
61
|
-
const E = R(() => c.value?.$el), { floatingStyles: M } = W(E, v, {
|
|
62
|
-
middleware: [Z(8), _(), ee()],
|
|
63
|
-
placement: r(n.placement),
|
|
64
|
-
whileElementsMounted: X,
|
|
65
|
-
open: o
|
|
66
|
-
}), S = () => {
|
|
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
|
-
}, x = R(() => {
|
|
69
|
-
const a = s.value?.draftStart, t = s.value?.draftEnd;
|
|
70
|
-
return n.isRange ? !!a && !!t : !!a;
|
|
71
|
-
}), g = () => {
|
|
72
|
-
o.value && (o.value = !1, n.onBlur?.(new FocusEvent("blur")));
|
|
73
|
-
};
|
|
74
|
-
re({ escHandler: g });
|
|
75
|
-
const V = (a) => {
|
|
76
|
-
const t = a.target, l = c.value?.$el, m = v.value;
|
|
77
|
-
o.value && l && m && !l.contains(t) && !m.contains(t) && g();
|
|
78
|
-
}, z = () => {
|
|
79
|
-
x.value && (s.value?.apply(), g(), n.onChange?.());
|
|
80
|
-
}, h = (a) => {
|
|
81
|
-
const t = B(a, n.isRange), l = c.value?.inputRef;
|
|
82
|
-
return l && (a && !t ? l.setCustomValidity("Invalid date format. Use YYYY/MM/DD") : l.setCustomValidity("")), t;
|
|
83
|
-
}, F = (a) => {
|
|
84
|
-
a && L(a, u, n.isRange, () => {
|
|
85
|
-
h(u.value);
|
|
86
|
-
});
|
|
87
|
-
}, $ = (a) => {
|
|
88
|
-
if (!a) return;
|
|
89
|
-
const l = a.target.value, m = h(l);
|
|
90
|
-
if (!l.trim()) {
|
|
91
|
-
i.value = { start: null, end: null }, n.onChange?.();
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (m) {
|
|
95
|
-
if (n.isRange) {
|
|
96
|
-
const [w, P] = l.split("-").map((O) => O.trim());
|
|
97
|
-
i.value = { start: b(w), end: b(P) };
|
|
98
|
-
} else
|
|
99
|
-
i.value = { start: b(l.trim()), end: null };
|
|
100
|
-
n.onChange?.();
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
return A(() => {
|
|
104
|
-
Y && document.addEventListener("click", V);
|
|
105
|
-
}), G(() => {
|
|
106
|
-
Y && document.removeEventListener("click", V);
|
|
107
|
-
}), (a, t) => (k(), I("div", {
|
|
108
|
-
class: p([f, e.fluid ? `${f}--fluid` : ""])
|
|
109
|
-
}, [
|
|
110
|
-
y(d(te), {
|
|
111
|
-
ref_key: "inputRef",
|
|
112
|
-
ref: c,
|
|
113
|
-
modelValue: d(u),
|
|
114
|
-
"onUpdate:modelValue": t[0] || (t[0] = (l) => j(u) ? u.value = l : null),
|
|
115
|
-
"aria-label": e.ariaLabel,
|
|
116
|
-
"border-radius": e.borderRadius,
|
|
117
|
-
busy: e.busy,
|
|
118
|
-
color: e.color,
|
|
119
|
-
disabled: e.disabled,
|
|
120
|
-
fluid: e.fluid,
|
|
121
|
-
form: e.form,
|
|
122
|
-
id: e.id,
|
|
123
|
-
label: e.label,
|
|
124
|
-
messages: e.messages,
|
|
125
|
-
"message-type": e.messageType,
|
|
126
|
-
name: e.name,
|
|
127
|
-
orientation: e.orientation,
|
|
128
|
-
placeholder: e.placeholder || (e.isRange ? "YYYY/MM/DD - YYYY/MM/DD" : "YYYY/MM/DD"),
|
|
129
|
-
required: e.required,
|
|
130
|
-
rounded: e.rounded,
|
|
131
|
-
size: e.size,
|
|
132
|
-
suffix: d(ne).Calendar,
|
|
133
|
-
"suffix-aria-label": e.ariaLabel || "Open calendar",
|
|
134
|
-
"test-id": e.testId,
|
|
135
|
-
variant: e.variant,
|
|
136
|
-
onInput: F,
|
|
137
|
-
onChange: $,
|
|
138
|
-
onSuffixClick: S
|
|
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(o) ? (k(), I("div", {
|
|
141
|
-
key: 0,
|
|
142
|
-
ref_key: "popoverRef",
|
|
143
|
-
ref: v,
|
|
144
|
-
class: p(`${f}__popover`),
|
|
145
|
-
style: J({ ...d(M), zIndex: 100 })
|
|
146
|
-
}, [
|
|
147
|
-
y(d(ae), {
|
|
148
|
-
"border-radius": e.borderRadius,
|
|
149
|
-
variant: d(D).Ghost,
|
|
150
|
-
padded: !1,
|
|
151
|
-
rounded: e.rounded,
|
|
152
|
-
elevated: ""
|
|
153
|
-
}, {
|
|
154
|
-
default: K(() => [
|
|
155
|
-
Q("div", {
|
|
156
|
-
class: p(`${f}__calendar-container`)
|
|
157
|
-
}, [
|
|
158
|
-
y(d(le), {
|
|
159
|
-
ref_key: "calendarRef",
|
|
160
|
-
ref: s,
|
|
161
|
-
modelValue: i.value,
|
|
162
|
-
"onUpdate:modelValue": t[1] || (t[1] = (l) => i.value = l),
|
|
163
|
-
disabled: e.disabled,
|
|
164
|
-
busy: e.busy,
|
|
165
|
-
"is-range": e.isRange,
|
|
166
|
-
onDateSelect: z,
|
|
167
|
-
fluid: ""
|
|
168
|
-
}, null, 8, ["modelValue", "disabled", "busy", "is-range"])
|
|
169
|
-
], 2)
|
|
170
|
-
]),
|
|
171
|
-
_: 1
|
|
172
|
-
}, 8, ["border-radius", "variant", "rounded"])
|
|
173
|
-
], 6)) : H("", !0)
|
|
174
|
-
], 2));
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
export {
|
|
178
|
-
he as CLInputDatePicker,
|
|
179
|
-
he as default
|
|
180
|
-
};
|
|
3
|
+
import{defineComponent as e,mergeModels as a,ref as l,useModel as t,watch as u,computed as d,onMounted as n,onBeforeUnmount as o,createElementBlock as s,openBlock as i,normalizeClass as r,createVNode as f,createCommentVNode as m,unref as p,isRef as v,normalizeStyle as c,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-DPQxSLkQ.js";import{CLInput as Y}from"../CLInput/CLInput.js";import{_ as R}from"../../../chunks/CLCalendar.vue_vue_type_style_index_0_lang-BAfGE35e.js";import{CLIconNames as I,CLColorVariants as L,CLPlacement as V,CLOrientation as M,CLSizes as x,CLColors as B}from"../../../index.js";import{i as j}from"../../../chunks/helper-C542dSLs.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:B.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:M.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",M=l(!1),x=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=d(()=>x.value?.$el),{floatingStyles:U}=g(P,S,{middleware:[h(8),k(),C()],placement:l(a.placement),whileElementsMounted:_,open:M}),G=()=>{a.disabled||a.busy||(M.value=!M.value,M.value?(a.onFocus?.(new FocusEvent("focus")),B.value?.initializeDraft()):a.onBlur?.(new FocusEvent("blur")))},H=d(()=>{const e=B.value?.draftStart,l=B.value?.draftEnd;return a.isRange?!!e&&!!l:!!e}),N=()=>{M.value&&(M.value=!1,a.onBlur?.(new FocusEvent("blur")))};E({escHandler:N});const A=e=>{const a=e.target,l=x.value?.$el,t=S.value;M.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=x.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 n(()=>{j&&document.addEventListener("click",A)}),o(()=>{j&&document.removeEventListener("click",A)}),(a,l)=>(i(),s("div",{class:r([V,e.fluid?`${V}--fluid`:""])},[f(p(Y),{ref_key:"inputRef",ref:x,modelValue:p(z),"onUpdate:modelValue":l[0]||(l[0]=e=>v(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,id:e.id,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,["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"]),p(M)?(i(),s("div",{key:0,ref_key:"popoverRef",ref:S,class:r(`${V}__popover`),style:c({...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,onDateSelect:J,fluid:""},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};
|