@stachelock/ui 0.6.6 → 0.6.8
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/{CalendarHeader.vue_vue_type_script_setup_true_lang-CA_C4dmn.js → CalendarHeader.vue_vue_type_script_setup_true_lang-CMBsY5Y0.js} +1 -1
- package/dist/{ComboboxInput.vue_vue_type_script_setup_true_lang-D52gzkAa.js → ComboboxInput.vue_vue_type_script_setup_true_lang-DacJtKYo.js} +141 -125
- package/dist/{DynamicForm.vue_vue_type_script_setup_true_lang-BR8Pq7Kw.js → DynamicForm.vue_vue_type_script_setup_true_lang-Bq8Gvhsc.js} +1 -1
- package/dist/{DynamicFormField.vue_vue_type_script_setup_true_lang-BCVmqg_n.js → DynamicFormField.vue_vue_type_script_setup_true_lang-CdNtWWlT.js} +4 -4
- package/dist/{InlineTabs.vue_vue_type_script_setup_true_lang-slNq2sot.js → InlineTabs.vue_vue_type_script_setup_true_lang-B6A0zsE6.js} +1 -1
- package/dist/{SelectInput.vue_vue_type_script_setup_true_lang-COZuuSFS.js → SelectInput.vue_vue_type_script_setup_true_lang-DFfKsmvj.js} +96 -86
- package/dist/{SelectTextInput.vue_vue_type_script_setup_true_lang-BVaViHPl.js → SelectTextInput.vue_vue_type_script_setup_true_lang-C3BGLjY1.js} +1 -1
- package/dist/{TabGroup.vue_vue_type_script_setup_true_lang-pEKm-uUq.js → TabGroup.vue_vue_type_script_setup_true_lang-BzqtAqbr.js} +1 -1
- package/dist/{TabGroupUnderline.vue_vue_type_script_setup_true_lang--IKyRPkX.js → TabGroupUnderline.vue_vue_type_script_setup_true_lang-C6OYRDCq.js} +1 -1
- package/dist/{TabsInPills.vue_vue_type_script_setup_true_lang-EG0nj4F6.js → TabsInPills.vue_vue_type_script_setup_true_lang-C7T3PUnB.js} +1 -1
- package/dist/TextInput-C5IzX7m_.js +131 -0
- package/dist/calendars/CalendarDashboard.js +1 -1
- package/dist/calendars/CalendarHeader.js +1 -1
- package/dist/forms/DynamicForm.js +1 -1
- package/dist/forms/DynamicFormField.js +1 -1
- package/dist/index.js +132 -132
- package/dist/inputs/AddressInput.js +148 -146
- package/dist/inputs/ComboboxInput.js +1 -1
- package/dist/inputs/SelectInput.js +1 -1
- package/dist/inputs/SelectTextInput.js +1 -1
- package/dist/inputs/TextInput.js +3 -108
- package/dist/src/components/inputs/AddressInput.d.ts +6 -0
- package/dist/src/components/inputs/ComboboxInput.d.ts +3 -0
- package/dist/src/components/inputs/TextInput.d.ts +1 -0
- package/dist/src/types/ui.d.ts +5 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/validation.d.ts +11 -0
- package/dist/style.css +1 -1
- package/dist/tabs/InlineTabs.js +1 -1
- package/dist/tabs/TabGroup.js +1 -1
- package/dist/tabs/TabGroupUnderline.js +1 -1
- package/dist/tabs/TabsInPills.js +1 -1
- package/dist/tabs/index.js +4 -4
- package/dist/ui.css +1 -1
- package/package.json +1 -1
package/dist/inputs/TextInput.js
CHANGED
|
@@ -1,110 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { debounce as $ } from "lodash-es";
|
|
4
|
-
import L from "../forms/FormFieldWrapper.js";
|
|
5
|
-
import { g as R } from "../id-DafBB_QF.js";
|
|
6
|
-
import { _ as q } from "../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
7
|
-
const A = { class: "sl-form" }, P = ["name", "id", "type", "value", "placeholder", "spellcheck", "disabled"], U = /* @__PURE__ */ F({
|
|
8
|
-
inheritAttrs: !1,
|
|
9
|
-
__name: "TextInput",
|
|
10
|
-
props: {
|
|
11
|
-
boxShadow: { type: Boolean, default: !1 },
|
|
12
|
-
type: { default: "text" },
|
|
13
|
-
value: { default: "" },
|
|
14
|
-
rules: { default: () => ({}) },
|
|
15
|
-
validateOnMount: { type: Boolean, default: !0 },
|
|
16
|
-
inputClass: { default: "" },
|
|
17
|
-
inputStyle: { default: "" },
|
|
18
|
-
spellcheck: { type: Boolean, default: !0 },
|
|
19
|
-
capitalize: { type: Boolean, default: !1 },
|
|
20
|
-
lazy: { type: Boolean, default: !1 },
|
|
21
|
-
transformFunction: { type: Function, default: (e) => e },
|
|
22
|
-
showErrors: { type: Boolean, default: !1 },
|
|
23
|
-
name: {},
|
|
24
|
-
label: { default: "" },
|
|
25
|
-
placeholder: { default: "" },
|
|
26
|
-
disabled: { type: Boolean, default: !1 },
|
|
27
|
-
required: { type: Boolean },
|
|
28
|
-
className: {},
|
|
29
|
-
errorMessage: {},
|
|
30
|
-
successMessage: { default: "" },
|
|
31
|
-
isValid: { type: Boolean },
|
|
32
|
-
isTouched: { type: Boolean },
|
|
33
|
-
colorfulValidation: { type: Boolean, default: !0 },
|
|
34
|
-
showValidCheck: { type: Boolean, default: !0 },
|
|
35
|
-
tertiaryLabel: { default: "" },
|
|
36
|
-
disabledMessage: { default: "" }
|
|
37
|
-
},
|
|
38
|
-
emits: ["update:value", "focus", "blur", "error", "update:validity"],
|
|
39
|
-
setup(e, { emit: p }) {
|
|
40
|
-
const l = e, s = p, r = f(!1), c = R(l.name || "text-input"), v = f(l.validateOnMount), { value: o, errorMessage: b, handleChange: g, meta: i, validate: w, setTouched: x } = N(m(l, "name"), m(l, "rules"), {
|
|
41
|
-
initialValue: l.value,
|
|
42
|
-
validateOnValueUpdate: !l.lazy,
|
|
43
|
-
validateOnMount: v.value
|
|
44
|
-
}), u = (a) => s("update:value", a), k = $(u, 300);
|
|
45
|
-
function B(a) {
|
|
46
|
-
const d = a.target.value;
|
|
47
|
-
l.lazy ? k(d) : u(d), g(l.transformFunction(d));
|
|
48
|
-
}
|
|
49
|
-
async function V(a) {
|
|
50
|
-
r.value || (r.value = !0, x(!0)), l.lazy && u(o.value), await w(), s("blur", a);
|
|
51
|
-
}
|
|
52
|
-
function M(a) {
|
|
53
|
-
s("focus", a);
|
|
54
|
-
}
|
|
55
|
-
return h(() => i.valid, (a) => z(() => s("update:validity", a)), { immediate: !0 }), h(() => l.value, (a) => {
|
|
56
|
-
a !== o.value && (o.value = a);
|
|
57
|
-
}), (a, d) => (E(), I("div", A, [
|
|
58
|
-
O(L, {
|
|
59
|
-
id: t(c),
|
|
60
|
-
name: e.name,
|
|
61
|
-
label: e.label,
|
|
62
|
-
"tertiary-label": e.tertiaryLabel,
|
|
63
|
-
"error-message": t(b),
|
|
64
|
-
"success-message": e.successMessage,
|
|
65
|
-
"is-valid": t(i).valid,
|
|
66
|
-
"is-touched": t(i).touched,
|
|
67
|
-
"show-errors": e.showErrors,
|
|
68
|
-
"show-valid-check": e.showValidCheck,
|
|
69
|
-
"colorful-validation": e.colorfulValidation,
|
|
70
|
-
disabled: e.disabled,
|
|
71
|
-
"disabled-message": e.disabledMessage,
|
|
72
|
-
"box-shadow": e.boxShadow
|
|
73
|
-
}, {
|
|
74
|
-
prefix: n(() => [
|
|
75
|
-
y(a.$slots, "prefix", {}, void 0, !0)
|
|
76
|
-
]),
|
|
77
|
-
default: n(({ inputClasses: C }) => [
|
|
78
|
-
S("input", T(a.$attrs, {
|
|
79
|
-
name: e.name,
|
|
80
|
-
id: t(c),
|
|
81
|
-
type: e.type,
|
|
82
|
-
value: t(o),
|
|
83
|
-
placeholder: e.placeholder,
|
|
84
|
-
spellcheck: e.spellcheck,
|
|
85
|
-
disabled: e.disabled,
|
|
86
|
-
class: ["sl-block sl-w-full sl-bg-transparent placeholder:sl-text-gray-400 dark:placeholder:sl-text-gray-400 focus:sl-ring-0 focus:sl-outline-none sm:sl-text-sm sm:sl-leading-6", [
|
|
87
|
-
C,
|
|
88
|
-
"sl-py-1.5 sl-pl-2 sl-pr-2",
|
|
89
|
-
{ "sl-uppercase": e.capitalize },
|
|
90
|
-
e.disabled ? "sl-text-gray-500 dark:sl-text-slate-400 sl-cursor-not-allowed" : "sl-text-gray-900 dark:sl-text-white",
|
|
91
|
-
{ "sl-pr-10": e.showValidCheck },
|
|
92
|
-
e.inputClass
|
|
93
|
-
]],
|
|
94
|
-
style: e.inputStyle,
|
|
95
|
-
onInput: B,
|
|
96
|
-
onFocus: M,
|
|
97
|
-
onBlur: V
|
|
98
|
-
}), null, 16, P)
|
|
99
|
-
]),
|
|
100
|
-
"input-right": n(() => [
|
|
101
|
-
y(a.$slots, "input-right", {}, void 0, !0)
|
|
102
|
-
]),
|
|
103
|
-
_: 3
|
|
104
|
-
}, 8, ["id", "name", "label", "tertiary-label", "error-message", "success-message", "is-valid", "is-touched", "show-errors", "show-valid-check", "colorful-validation", "disabled", "disabled-message", "box-shadow"])
|
|
105
|
-
]));
|
|
106
|
-
}
|
|
107
|
-
}), K = /* @__PURE__ */ q(U, [["__scopeId", "data-v-95aa905a"]]);
|
|
1
|
+
import { T as a } from "../TextInput-C5IzX7m_.js";
|
|
2
|
+
import "../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
108
3
|
export {
|
|
109
|
-
|
|
4
|
+
a as default
|
|
110
5
|
};
|
|
@@ -12,6 +12,11 @@ interface Props {
|
|
|
12
12
|
successMessage?: string;
|
|
13
13
|
tertiaryLabel?: string;
|
|
14
14
|
validateOnMount?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the field is optional (hides required asterisk).
|
|
17
|
+
* When undefined, computed from rules.
|
|
18
|
+
*/
|
|
19
|
+
optional?: boolean;
|
|
15
20
|
}
|
|
16
21
|
declare function resetInput(): void;
|
|
17
22
|
declare const _default: import('vue').DefineComponent<Props, {
|
|
@@ -33,6 +38,7 @@ declare const _default: import('vue').DefineComponent<Props, {
|
|
|
33
38
|
tertiaryLabel: string;
|
|
34
39
|
disabled: boolean;
|
|
35
40
|
successMessage: string;
|
|
41
|
+
optional: boolean;
|
|
36
42
|
validateOnMount: boolean;
|
|
37
43
|
showSuggestionCount: boolean;
|
|
38
44
|
allowManualEntry: boolean;
|
|
@@ -17,17 +17,20 @@ interface Props {
|
|
|
17
17
|
multiple?: boolean;
|
|
18
18
|
showAll?: boolean;
|
|
19
19
|
modelValue?: SelectItemValue | ComboboxItem | ComboboxItem[];
|
|
20
|
+
value?: SelectItemValue | ComboboxItem | ComboboxItem[];
|
|
20
21
|
boxShadow?: boolean;
|
|
21
22
|
clearable?: boolean;
|
|
22
23
|
}
|
|
23
24
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
24
25
|
blur: (event: FocusEvent) => any;
|
|
25
26
|
focus: (event: FocusEvent) => any;
|
|
27
|
+
"update:value": (value: SelectItemValue | ComboboxItem | ComboboxItem[]) => any;
|
|
26
28
|
"update:modelValue": (value: SelectItemValue | ComboboxItem | ComboboxItem[]) => any;
|
|
27
29
|
"update:query": (query: string) => any;
|
|
28
30
|
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
29
31
|
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
30
32
|
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
33
|
+
"onUpdate:value"?: ((value: SelectItemValue | ComboboxItem | ComboboxItem[]) => any) | undefined;
|
|
31
34
|
"onUpdate:modelValue"?: ((value: SelectItemValue | ComboboxItem | ComboboxItem[]) => any) | undefined;
|
|
32
35
|
"onUpdate:query"?: ((query: string) => any) | undefined;
|
|
33
36
|
}>, {
|
package/dist/src/types/ui.d.ts
CHANGED
|
@@ -168,6 +168,11 @@ export interface TextInputType extends InputBaseType {
|
|
|
168
168
|
* Whether to force show errors
|
|
169
169
|
*/
|
|
170
170
|
showErrors?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Whether the field is optional (hides required asterisk).
|
|
173
|
+
* When undefined, computed from rules - if rules exist and have required validation, field is not optional.
|
|
174
|
+
*/
|
|
175
|
+
optional?: boolean;
|
|
171
176
|
}
|
|
172
177
|
export interface SelectOption {
|
|
173
178
|
value: string | number;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ValidationRule } from '../types/form';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a validation rule indicates the field is optional (not required).
|
|
4
|
+
*
|
|
5
|
+
* Inspects the rule to determine if it has a `required` validation.
|
|
6
|
+
* Works with Yup schemas and other common validation patterns.
|
|
7
|
+
*
|
|
8
|
+
* @param rules - The validation rules to check
|
|
9
|
+
* @returns true if the field is optional (no required validation), false if required
|
|
10
|
+
*/
|
|
11
|
+
export declare function isRuleOptional(rules: ValidationRule | undefined): boolean;
|