@bridge-ui/vue 0.0.2 → 0.0.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.
- package/dist/Actions/Dialog/BridgeDialogAction.vue_vue_type_script_setup_true_lang.js +19 -35
- package/dist/Actions/Snackbar/BridgeSnackbarAction.vue_vue_type_script_setup_true_lang.js +41 -54
- package/dist/Actions/Snackbar/BridgeSnackbarHost.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/Alert/alertDefaultIcons.d.ts +1 -1
- package/dist/Components/Alert/composables/useAlert.js +2 -2
- package/dist/Components/Avatar/Avatar.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/Components/Avatar/avatar.types.d.ts +34 -1
- package/dist/Components/Avatar/composables/useAvatar.d.ts +4 -4
- package/dist/Components/Avatar/composables/useAvatar.js +10 -9
- package/dist/Components/Avatar/index.d.ts +1 -1
- package/dist/Components/Badge/composables/useBadge.js +2 -2
- package/dist/Components/Button/composables/useButton.d.ts +1 -1
- package/dist/Components/Button/composables/useButton.js +2 -2
- package/dist/Components/Card/composables/useCard.js +4 -4
- package/dist/Components/Checkbox/Checkbox.vue_vue_type_script_setup_true_lang.js +0 -1
- package/dist/Components/Checkbox/composables/useCheckbox.d.ts +5 -10
- package/dist/Components/Checkbox/composables/useCheckbox.js +2 -2
- package/dist/Components/Chip/composables/useChip.js +2 -2
- package/dist/Components/Divider/composables/useDivider.js +2 -2
- package/dist/Components/Drawer/Drawer.vue.d.ts +1 -1
- package/dist/Components/Drawer/composables/useDrawer.d.ts +1 -1
- package/dist/Components/Drawer/composables/useDrawer.js +2 -2
- package/dist/Components/FormControl/FormControl.vue_vue_type_script_setup_true_lang.js +24 -18
- package/dist/Components/FormControl/FormControlLabel.js +5 -0
- package/dist/Components/FormControl/FormControlLabel.vue.d.ts +8 -0
- package/dist/Components/FormControl/FormControlLabel.vue_vue_type_script_setup_true_lang.js +19 -0
- package/dist/Components/FormControl/composables/useFormControl.d.ts +7 -11
- package/dist/Components/FormControl/composables/useFormControl.js +62 -68
- package/dist/Components/FormControl/formControl.types.d.ts +19 -30
- package/dist/Components/FormField/FilledFormField.vue_vue_type_script_setup_true_lang.js +23 -25
- package/dist/Components/FormField/FormFieldLabel.js +5 -0
- package/dist/Components/FormField/FormFieldLabel.vue.d.ts +7 -0
- package/dist/Components/FormField/FormFieldLabel.vue_vue_type_script_setup_true_lang.js +16 -0
- package/dist/Components/FormField/NotchedFormField.vue_vue_type_script_setup_true_lang.js +22 -24
- package/dist/Components/FormField/OutlinedFormField.vue_vue_type_script_setup_true_lang.js +23 -25
- package/dist/Components/FormField/StackedFormField.vue_vue_type_script_setup_true_lang.js +25 -27
- package/dist/Components/FormField/UnderlinedFormField.vue_vue_type_script_setup_true_lang.js +23 -25
- package/dist/Components/FormField/composables/useFormField.d.ts +3 -3
- package/dist/Components/FormField/composables/useFormField.js +112 -111
- package/dist/Components/FormField/formField.types.d.ts +6 -3
- package/dist/Components/Icon/composables/useIcon.js +2 -2
- package/dist/Components/Label/composables/useLabel.js +2 -2
- package/dist/Components/Link/composables/useLink.js +2 -2
- package/dist/Components/Listbox/Listbox.vue.d.ts +1 -1
- package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +82 -118
- package/dist/Components/Listbox/composables/useListbox.js +2 -2
- package/dist/Components/Listbox/listbox.types.d.ts +39 -5
- package/dist/Components/Menu/Menu.vue.d.ts +2 -2
- package/dist/Components/Menu/composables/useMenu.d.ts +1 -1
- package/dist/Components/Menu/composables/useMenu.js +2 -2
- package/dist/Components/Modal/composables/useModal.js +2 -2
- package/dist/Components/NumberField/NumberField.vue_vue_type_script_setup_true_lang.js +42 -44
- package/dist/Components/NumberField/composables/useNumberField.d.ts +3 -4
- package/dist/Components/NumberField/numberField.types.d.ts +34 -2
- package/dist/Components/PasswordField/PasswordField.vue_vue_type_script_setup_true_lang.js +28 -29
- package/dist/Components/PasswordField/composables/usePasswordField.d.ts +3 -4
- package/dist/Components/PasswordField/passwordField.types.d.ts +22 -2
- package/dist/Components/Progress/composables/useProgress.js +2 -2
- package/dist/Components/Radio/Radio.vue_vue_type_script_setup_true_lang.js +0 -1
- package/dist/Components/Radio/composables/useRadio.d.ts +5 -10
- package/dist/Components/Radio/composables/useRadio.js +2 -2
- package/dist/Components/Select/Select.vue_vue_type_script_setup_true_lang.js +55 -54
- package/dist/Components/Select/composables/useSelect.d.ts +16 -16
- package/dist/Components/Select/composables/useSelect.js +13 -13
- package/dist/Components/Select/select.types.d.ts +19 -3
- package/dist/Components/Skeleton/composables/useSkeleton.js +2 -2
- package/dist/Components/Snackbar/composables/useSnackbar.js +1 -1
- package/dist/Components/Spinner/composables/useSpinner.js +2 -2
- package/dist/Components/Switch/Switch.vue_vue_type_script_setup_true_lang.js +0 -1
- package/dist/Components/Switch/composables/useSwitch.d.ts +5 -10
- package/dist/Components/Switch/composables/useSwitch.js +2 -2
- package/dist/Components/Tabs/Tabs.vue_vue_type_script_setup_true_lang.js +16 -16
- package/dist/Components/Tabs/composables/useTabs.js +2 -2
- package/dist/Components/Tabs/tabs.types.d.ts +27 -1
- package/dist/Components/TextField/composables/useTextField.d.ts +3 -4
- package/dist/Components/Textarea/composables/useTextarea.d.ts +3 -4
- package/dist/Components/Textarea/composables/useTextarea.js +2 -2
- package/dist/Utils/index.d.ts +9 -2
- package/dist/Utils/index.js +11 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -14
- package/dist/theme.css +1 -1
- package/package.json +2 -2
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
import { hasSlotOrProp as e, resolveSlotOrProp as t } from "../../Utils/slotOrProp.js";
|
|
2
|
-
import
|
|
2
|
+
import n from "./FormControlLabel.js";
|
|
3
|
+
import { computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, guardReactiveProps as u, mergeProps as d, normalizeProps as f, openBlock as p, renderSlot as m, resolveDynamicComponent as h, unref as g } from "vue";
|
|
3
4
|
//#region src/Components/FormControl/FormControl.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var
|
|
5
|
+
var _ = [
|
|
5
6
|
"data-invalid",
|
|
6
7
|
"aria-disabled",
|
|
7
8
|
"aria-readonly"
|
|
8
|
-
],
|
|
9
|
+
], v = ["aria-hidden"], y = /* @__PURE__ */ l({
|
|
9
10
|
inheritAttrs: !1,
|
|
10
11
|
__name: "FormControl",
|
|
11
12
|
props: { field: {} },
|
|
12
|
-
setup(
|
|
13
|
-
let
|
|
14
|
-
return (
|
|
15
|
-
"data-invalid":
|
|
16
|
-
"aria-disabled":
|
|
17
|
-
"aria-readonly":
|
|
13
|
+
setup(l) {
|
|
14
|
+
let y = l, b = r(() => y.field);
|
|
15
|
+
return (r, l) => (p(), o("div", d(b.value.rootBind.value, {
|
|
16
|
+
"data-invalid": b.value.invalidated.value || void 0,
|
|
17
|
+
"aria-disabled": b.value.isDisabled.value || void 0,
|
|
18
|
+
"aria-readonly": b.value.isReadonly.value || void 0
|
|
18
19
|
}), [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
s("div", f(u(b.value.rowBind.value)), [
|
|
21
|
+
c(n, {
|
|
22
|
+
api: b.value,
|
|
23
|
+
name: "startLabel"
|
|
24
|
+
}, null, 8, ["api"]),
|
|
25
|
+
m(r.$slots, "default"),
|
|
26
|
+
c(n, {
|
|
27
|
+
api: b.value,
|
|
28
|
+
name: "endLabel"
|
|
29
|
+
}, null, 8, ["api"])
|
|
24
30
|
], 16),
|
|
25
|
-
!
|
|
26
|
-
|
|
27
|
-
], 16,
|
|
31
|
+
!b.value.invalidated.value && g(e)(b.value.slots, "description", b.value.merged.value.description) ? (p(), o("p", f(d({ key: 0 }, b.value.descriptionBind.value)), [(p(), i(h(g(t)(b.value.slots, "description", b.value.merged.value.description))))], 16)) : a("", !0),
|
|
32
|
+
b.value.merged.value.withoutErrorMessage ? a("", !0) : (p(), o("p", d({ key: 1 }, b.value.errorMessageBind.value, { "aria-hidden": b.value.showErrorMessageContent.value ? void 0 : !0 }), [b.value.showErrorMessageContent.value ? (p(), i(h(g(t)(b.value.slots, "errorMessage", b.value.merged.value.errorMessage)), { key: 0 })) : a("", !0)], 16, v))
|
|
33
|
+
], 16, _));
|
|
28
34
|
}
|
|
29
35
|
});
|
|
30
36
|
//#endregion
|
|
31
|
-
export {
|
|
37
|
+
export { y as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UseFormControlReturn } from './composables/useFormControl';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
api: UseFormControlReturn;
|
|
4
|
+
name: "endLabel" | "startLabel";
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { hasNamedSlot as e, hasSlotOrProp as t, isPropPresent as n, resolveNamedSlot as r } from "../../Utils/slotOrProp.js";
|
|
2
|
+
import i from "../Label/Label.js";
|
|
3
|
+
import { Fragment as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createTextVNode as l, defineComponent as u, mergeProps as d, normalizeProps as f, openBlock as p, resolveDynamicComponent as m, toDisplayString as h, unref as g, withCtx as _ } from "vue";
|
|
4
|
+
//#region src/Components/FormControl/FormControlLabel.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var v = /* @__PURE__ */ u({
|
|
6
|
+
__name: "FormControlLabel",
|
|
7
|
+
props: {
|
|
8
|
+
api: {},
|
|
9
|
+
name: {}
|
|
10
|
+
},
|
|
11
|
+
setup(u) {
|
|
12
|
+
return (v, y) => g(t)(u.api.slots, u.name, u.api.merged.value[u.name]) ? (p(), o(g(i), f(d({ key: 0 }, u.api.fieldLabelProps.value[u.name])), {
|
|
13
|
+
default: _(() => [g(e)(u.api.slots, u.name) ? (p(), o(m(g(r)(u.api.slots, u.name)), { key: 0 })) : g(n)(u.api.merged.value[u.name]) ? (p(), c(a, { key: 1 }, [l(h(u.api.merged.value[u.name]), 1)], 64)) : s("", !0)]),
|
|
14
|
+
_: 1
|
|
15
|
+
}, 16)) : s("", !0);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { v as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { HTMLAttributes, MaybeRefOrGetter } from 'vue';
|
|
2
2
|
import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core';
|
|
3
3
|
import { FormControlOwnProps } from '../formControl.types';
|
|
4
|
-
|
|
4
|
+
import { LabelProps } from '../../Label/label.types';
|
|
5
|
+
export declare const formControlBridgeKeys: readonly ["size", "error", "classes", "disabled", "endLabel", "readonly", "required", "controlId", "startLabel", "customProps", "description", "errorMessage", "withoutErrorMessage"];
|
|
5
6
|
type FormControlLibDefaults = LibDefaultsShape<FormControlOwnProps, "size" | "error" | "withoutErrorMessage">;
|
|
6
7
|
type FormControlMerged = MergeLibDefaults<FormControlOwnProps, FormControlLibDefaults>;
|
|
7
8
|
export declare function useFormControl(props: MaybeRefOrGetter<Omit<FormControlOwnProps, "field">>, libDefaults: FormControlLibDefaults): {
|
|
@@ -10,7 +11,7 @@ export declare function useFormControl(props: MaybeRefOrGetter<Omit<FormControlO
|
|
|
10
11
|
}>;
|
|
11
12
|
merged: import('vue').ComputedRef<FormControlMerged>;
|
|
12
13
|
rowBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", HTMLAttributes | undefined, {}>>;
|
|
13
|
-
rootBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", HTMLAttributes | undefined, Partial<Omit<Omit<FormControlOwnProps, "field">, "size" | "classes" | "customProps" | "error" | "disabled" | "
|
|
14
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", HTMLAttributes | undefined, Partial<Omit<Omit<FormControlOwnProps, "field">, "size" | "classes" | "customProps" | "error" | "disabled" | "required" | "controlId" | "description" | "endLabel" | "errorMessage" | "readonly" | "startLabel" | "withoutErrorMessage">>>>;
|
|
14
15
|
controlId: import('vue').ComputedRef<string>;
|
|
15
16
|
isDisabled: import('vue').ComputedRef<boolean>;
|
|
16
17
|
isReadonly: import('vue').ComputedRef<boolean>;
|
|
@@ -23,15 +24,10 @@ export declare function useFormControl(props: MaybeRefOrGetter<Omit<FormControlO
|
|
|
23
24
|
"aria-invalid": true | undefined;
|
|
24
25
|
}>;
|
|
25
26
|
invalidated: import('vue').ComputedRef<boolean>;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
for: string;
|
|
31
|
-
}>>;
|
|
32
|
-
startLabelBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", HTMLAttributes | undefined, {
|
|
33
|
-
for: string;
|
|
34
|
-
}>>;
|
|
27
|
+
fieldLabelProps: import('vue').ComputedRef<{
|
|
28
|
+
endLabel: LabelProps;
|
|
29
|
+
startLabel: LabelProps;
|
|
30
|
+
}>;
|
|
35
31
|
descriptionBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", HTMLAttributes | undefined, {
|
|
36
32
|
id: string;
|
|
37
33
|
}>>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { hasSlotOrProp as e } from "../../../Utils/slotOrProp.js";
|
|
2
|
-
import {
|
|
3
|
-
import { computed as
|
|
4
|
-
import { get as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { invalidatedProps as
|
|
7
|
-
import { sizeProps as
|
|
2
|
+
import { mergeNestedComponentProps as t, mergePartBind as n, useBridgeUIComponent as r, useBridgeUIMergedRegistryClasses as i } from "../../../Utils/index.js";
|
|
3
|
+
import { computed as a, toValue as o, useAttrs as s, useId as c, useSlots as l } from "vue";
|
|
4
|
+
import { get as u, omit as d } from "es-toolkit/compat";
|
|
5
|
+
import { cn as f, mergeBridgeUILayeredClasses as p, splitComponentProps as m } from "@bridge-ui/core";
|
|
6
|
+
import { invalidatedProps as h } from "@bridge-ui/core/Tokens/FormControl";
|
|
7
|
+
import { sizeProps as g } from "@bridge-ui/core/Tokens/Label";
|
|
8
8
|
//#region src/Components/FormControl/composables/useFormControl.ts
|
|
9
|
-
var
|
|
9
|
+
var _ = [
|
|
10
10
|
"size",
|
|
11
11
|
"error",
|
|
12
12
|
"classes",
|
|
@@ -15,96 +15,90 @@ var g = [
|
|
|
15
15
|
"readonly",
|
|
16
16
|
"required",
|
|
17
17
|
"controlId",
|
|
18
|
-
"mainLabel",
|
|
19
18
|
"startLabel",
|
|
20
19
|
"customProps",
|
|
21
20
|
"description",
|
|
22
21
|
"errorMessage",
|
|
23
22
|
"withoutErrorMessage"
|
|
24
23
|
];
|
|
25
|
-
function
|
|
26
|
-
let
|
|
27
|
-
bridgeKeys:
|
|
24
|
+
function v(v, y) {
|
|
25
|
+
let b = c(), x = l(), S = s(), C = a(() => m({
|
|
26
|
+
bridgeKeys: _,
|
|
28
27
|
props: {
|
|
29
|
-
...
|
|
30
|
-
...
|
|
28
|
+
...S,
|
|
29
|
+
...o(v)
|
|
31
30
|
}
|
|
32
|
-
})), { merged:
|
|
33
|
-
libDefaults:
|
|
31
|
+
})), { merged: w, entry: T } = r({
|
|
32
|
+
libDefaults: y,
|
|
34
33
|
componentName: "FormControl",
|
|
35
|
-
props: () =>
|
|
36
|
-
}),
|
|
37
|
-
entry:
|
|
38
|
-
props: () =>
|
|
39
|
-
}),
|
|
40
|
-
let e =
|
|
41
|
-
return
|
|
42
|
-
}), M =
|
|
34
|
+
props: () => C.value.componentProps
|
|
35
|
+
}), E = a(() => w.value.customProps), D = i({
|
|
36
|
+
entry: T,
|
|
37
|
+
props: () => C.value.componentProps
|
|
38
|
+
}), O = a(() => w.value.error === !0), k = a(() => !!w.value.disabled), A = a(() => !!w.value.readonly), j = a(() => {
|
|
39
|
+
let e = C.value.inheritedAttrs.id;
|
|
40
|
+
return w.value.controlId ?? e ?? b;
|
|
41
|
+
}), M = a(() => !w.value.withoutErrorMessage), N = a(() => O.value && e(x, "errorMessage", w.value.errorMessage)), P = a(() => {
|
|
43
42
|
let t = [];
|
|
44
|
-
return !
|
|
45
|
-
}), F =
|
|
43
|
+
return !O.value && e(x, "description", w.value.description) && t.push(`${j.value}-description`), O.value && M.value && e(x, "errorMessage", w.value.errorMessage) && t.push(`${j.value}-error`), t.length > 0 ? t.join(" ") : void 0;
|
|
44
|
+
}), F = a(() => u(g, w.value.size ?? "md")), I = a(() => p(h, T.value?.tokens?.invalidated, w.value.customProps?.invalidated)), L = a(() => n(E.value?.root, d(C.value.inheritedAttrs, ["class"]), f({
|
|
46
45
|
"group/form-control relative w-full": !0,
|
|
47
46
|
"aria-disabled:pointer-events-none aria-disabled:select-none aria-disabled:opacity-60 aria-disabled:cursor-not-allowed": !0,
|
|
48
47
|
"aria-readonly:pointer-events-none aria-readonly:select-none": !0,
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
}))), R =
|
|
52
|
-
"flex items-center gap-x-2": !0,
|
|
53
|
-
[
|
|
54
|
-
}))), z =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
[I.value.label ?? ""]: A.value,
|
|
71
|
-
[E.value.endLabel ?? ""]: !0
|
|
72
|
-
}))), H = i(() => t(T.value?.description, { id: `${j.value}-description` }, d({
|
|
48
|
+
[D.value.root ?? ""]: !0,
|
|
49
|
+
[S.class]: !!S.class
|
|
50
|
+
}))), R = a(() => n(E.value?.row, {}, f({
|
|
51
|
+
"flex flex-row items-center gap-x-2": !0,
|
|
52
|
+
[D.value.row ?? ""]: !0
|
|
53
|
+
}))), z = a(() => {
|
|
54
|
+
let e = (e) => t(E.value?.[e], {
|
|
55
|
+
for: j.value,
|
|
56
|
+
size: w.value.size,
|
|
57
|
+
error: O.value,
|
|
58
|
+
required: w.value.required,
|
|
59
|
+
classes: { root: f({
|
|
60
|
+
"cursor-pointer": !0,
|
|
61
|
+
[D.value[e] ?? ""]: !0
|
|
62
|
+
}) }
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
endLabel: e("endLabel"),
|
|
66
|
+
startLabel: e("startLabel")
|
|
67
|
+
};
|
|
68
|
+
}), B = a(() => n(E.value?.description, { id: `${j.value}-description` }, f({
|
|
73
69
|
"mt-2 text-gray-500 dark:text-gray-400": !0,
|
|
74
70
|
[F.value ?? ""]: !0,
|
|
75
|
-
[
|
|
76
|
-
}))),
|
|
71
|
+
[D.value.description ?? ""]: !0
|
|
72
|
+
}))), V = a(() => n(E.value?.errorMessage, { id: `${j.value}-error` }, f({
|
|
77
73
|
"mt-2": !0,
|
|
78
74
|
"min-h-[1lh]": M.value,
|
|
79
75
|
[I.value.errorMessage ?? ""]: !0,
|
|
80
76
|
[F.value ?? ""]: !0,
|
|
81
|
-
[
|
|
77
|
+
[D.value.errorMessage ?? ""]: !0
|
|
82
78
|
})));
|
|
83
79
|
return {
|
|
84
|
-
slots:
|
|
85
|
-
merged:
|
|
80
|
+
slots: x,
|
|
81
|
+
merged: w,
|
|
86
82
|
rowBind: R,
|
|
87
83
|
rootBind: L,
|
|
88
84
|
controlId: j,
|
|
89
|
-
isDisabled:
|
|
90
|
-
isReadonly:
|
|
91
|
-
controlBind:
|
|
85
|
+
isDisabled: k,
|
|
86
|
+
isReadonly: A,
|
|
87
|
+
controlBind: a(() => ({
|
|
92
88
|
id: j.value,
|
|
93
|
-
disabled:
|
|
94
|
-
readonly:
|
|
89
|
+
disabled: k.value,
|
|
90
|
+
readonly: A.value,
|
|
95
91
|
"aria-describedby": P.value,
|
|
96
|
-
required:
|
|
97
|
-
"aria-invalid":
|
|
92
|
+
required: w.value.required || void 0,
|
|
93
|
+
"aria-invalid": O.value || void 0
|
|
98
94
|
})),
|
|
99
|
-
invalidated:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
descriptionBind: H,
|
|
104
|
-
errorMessageBind: U,
|
|
95
|
+
invalidated: O,
|
|
96
|
+
fieldLabelProps: z,
|
|
97
|
+
descriptionBind: B,
|
|
98
|
+
errorMessageBind: V,
|
|
105
99
|
showErrorMessageContent: N,
|
|
106
100
|
reservesErrorMessageSpace: M
|
|
107
101
|
};
|
|
108
102
|
}
|
|
109
103
|
//#endregion
|
|
110
|
-
export {
|
|
104
|
+
export { _ as formControlBridgeKeys, v as useFormControl };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HTMLAttributes, Slot } from 'vue';
|
|
2
2
|
import { FormControlInvalidated, LabelSize, MergeHtmlProps, MergeProps } from '@bridge-ui/core';
|
|
3
3
|
import { UseFormControlReturn } from './composables/useFormControl';
|
|
4
|
+
import { LabelProps } from '../Label/label.types';
|
|
4
5
|
export interface FormControlSizeOverrides {}
|
|
5
6
|
export interface FormControlClasses {
|
|
6
7
|
/**
|
|
@@ -15,10 +16,6 @@ export interface FormControlClasses {
|
|
|
15
16
|
* Classes merged onto the error message below the control row.
|
|
16
17
|
*/
|
|
17
18
|
errorMessage?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Classes merged onto the main inline label next to the control.
|
|
20
|
-
*/
|
|
21
|
-
mainLabel?: string;
|
|
22
19
|
/**
|
|
23
20
|
* Classes merged onto the root wrapper.
|
|
24
21
|
*/
|
|
@@ -38,23 +35,21 @@ export interface FormControlCustomProps {
|
|
|
38
35
|
*/
|
|
39
36
|
description?: HTMLAttributes;
|
|
40
37
|
/**
|
|
41
|
-
* Props forwarded to the inline-end
|
|
38
|
+
* Props forwarded to the inline-end `Label` (content stays owned by `FormControl`).
|
|
39
|
+
*
|
|
40
|
+
* @default undefined
|
|
42
41
|
*/
|
|
43
|
-
endLabel?:
|
|
42
|
+
endLabel?: Partial<LabelProps>;
|
|
44
43
|
/**
|
|
45
44
|
* Props forwarded to the error message element.
|
|
46
45
|
*/
|
|
47
46
|
errorMessage?: HTMLAttributes;
|
|
48
47
|
/**
|
|
49
|
-
* Error-state
|
|
48
|
+
* Error-state message colors (`errorMessage`). Label colors come from `Label` when `error` is set.
|
|
50
49
|
*
|
|
51
50
|
* @default undefined
|
|
52
51
|
*/
|
|
53
52
|
invalidated?: Partial<FormControlInvalidated>;
|
|
54
|
-
/**
|
|
55
|
-
* Props forwarded to the main inline label element.
|
|
56
|
-
*/
|
|
57
|
-
mainLabel?: HTMLAttributes;
|
|
58
53
|
/**
|
|
59
54
|
* Props forwarded to the root wrapper.
|
|
60
55
|
*/
|
|
@@ -64,9 +59,11 @@ export interface FormControlCustomProps {
|
|
|
64
59
|
*/
|
|
65
60
|
row?: HTMLAttributes;
|
|
66
61
|
/**
|
|
67
|
-
* Props forwarded to the inline-start
|
|
62
|
+
* Props forwarded to the inline-start `Label` (content stays owned by `FormControl`).
|
|
63
|
+
*
|
|
64
|
+
* @default undefined
|
|
68
65
|
*/
|
|
69
|
-
startLabel?:
|
|
66
|
+
startLabel?: Partial<LabelProps>;
|
|
70
67
|
}
|
|
71
68
|
export interface FormControlOwnProps {
|
|
72
69
|
/**
|
|
@@ -83,7 +80,7 @@ export interface FormControlOwnProps {
|
|
|
83
80
|
*/
|
|
84
81
|
controlId?: string;
|
|
85
82
|
/**
|
|
86
|
-
* Extra props for internal parts (`row`, `
|
|
83
|
+
* Extra props for internal parts (`row`, `startLabel`, `endLabel`, …).
|
|
87
84
|
*
|
|
88
85
|
* @default undefined
|
|
89
86
|
*/
|
|
@@ -101,7 +98,7 @@ export interface FormControlOwnProps {
|
|
|
101
98
|
*/
|
|
102
99
|
disabled?: boolean;
|
|
103
100
|
/**
|
|
104
|
-
* Inline-end label text after the
|
|
101
|
+
* Inline-end label text after the control (right in LTR, left in RTL).
|
|
105
102
|
*
|
|
106
103
|
* @default undefined
|
|
107
104
|
*/
|
|
@@ -125,12 +122,6 @@ export interface FormControlOwnProps {
|
|
|
125
122
|
* @default undefined
|
|
126
123
|
*/
|
|
127
124
|
field?: UseFormControlReturn;
|
|
128
|
-
/**
|
|
129
|
-
* Main label text next to the control.
|
|
130
|
-
*
|
|
131
|
-
* @default undefined
|
|
132
|
-
*/
|
|
133
|
-
mainLabel?: string;
|
|
134
125
|
/**
|
|
135
126
|
* Whether the control is read-only.
|
|
136
127
|
*
|
|
@@ -138,7 +129,8 @@ export interface FormControlOwnProps {
|
|
|
138
129
|
*/
|
|
139
130
|
readonly?: boolean;
|
|
140
131
|
/**
|
|
141
|
-
* Sets the native `required` attribute on the control
|
|
132
|
+
* Sets the native `required` attribute on the control and shows a required
|
|
133
|
+
* asterisk on start/end labels.
|
|
142
134
|
*
|
|
143
135
|
* @default false
|
|
144
136
|
*/
|
|
@@ -151,13 +143,14 @@ export interface FormControlOwnProps {
|
|
|
151
143
|
*/
|
|
152
144
|
size?: MergeProps<LabelSize, FormControlSizeOverrides>;
|
|
153
145
|
/**
|
|
154
|
-
* Chrome slots (`
|
|
146
|
+
* Chrome slots (`startLabel`, `endLabel`, `description`, `errorMessage`, …)
|
|
147
|
+
* and the control.
|
|
155
148
|
*
|
|
156
149
|
* @default undefined
|
|
157
150
|
*/
|
|
158
151
|
slots?: FormControlSlots;
|
|
159
152
|
/**
|
|
160
|
-
* Inline-start label text before the control.
|
|
153
|
+
* Inline-start label text before the control (left in LTR, right in RTL).
|
|
161
154
|
*
|
|
162
155
|
* @default undefined
|
|
163
156
|
*/
|
|
@@ -179,7 +172,7 @@ export interface FormControlSlots {
|
|
|
179
172
|
*/
|
|
180
173
|
description?: Slot<undefined>;
|
|
181
174
|
/**
|
|
182
|
-
* Inline-end label after the
|
|
175
|
+
* Inline-end label after the control (right in LTR, left in RTL).
|
|
183
176
|
*/
|
|
184
177
|
endLabel?: Slot<undefined>;
|
|
185
178
|
/**
|
|
@@ -187,11 +180,7 @@ export interface FormControlSlots {
|
|
|
187
180
|
*/
|
|
188
181
|
errorMessage?: Slot<undefined>;
|
|
189
182
|
/**
|
|
190
|
-
*
|
|
191
|
-
*/
|
|
192
|
-
mainLabel?: Slot<undefined>;
|
|
193
|
-
/**
|
|
194
|
-
* Inline-start label before the control.
|
|
183
|
+
* Inline-start label before the control (left in LTR, right in RTL).
|
|
195
184
|
*/
|
|
196
185
|
startLabel?: Slot<undefined>;
|
|
197
186
|
}
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
import { hasNamedSlot as e, hasSlotOrProp as t, isPropPresent as n, resolveNamedSlot as r, resolveSlotOrProp as i } from "../../Utils/slotOrProp.js";
|
|
2
2
|
import a from "../Icon/Icon.js";
|
|
3
|
-
import
|
|
3
|
+
import o from "./FormFieldLabel.js";
|
|
4
|
+
import { createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, guardReactiveProps as p, mergeProps as m, normalizeProps as h, openBlock as g, renderSlot as _, resolveDynamicComponent as v, toDisplayString as y, unref as b } from "vue";
|
|
4
5
|
//#region src/Components/FormField/FilledFormField.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var
|
|
6
|
+
var x = [
|
|
6
7
|
"data-invalid",
|
|
7
8
|
"aria-disabled",
|
|
8
9
|
"aria-readonly"
|
|
9
|
-
],
|
|
10
|
+
], S = ["id"], C = ["id", "aria-hidden"], w = /* @__PURE__ */ f({
|
|
10
11
|
__name: "FilledFormField",
|
|
11
12
|
props: { api: {} },
|
|
12
|
-
setup(
|
|
13
|
-
return (w, T) => (
|
|
14
|
-
"data-invalid":
|
|
15
|
-
"aria-disabled":
|
|
16
|
-
"aria-readonly":
|
|
13
|
+
setup(f) {
|
|
14
|
+
return (w, T) => (g(), l("div", m(f.api.rootBind.value, {
|
|
15
|
+
"data-invalid": f.api.invalidated.value || void 0,
|
|
16
|
+
"aria-disabled": f.api.isDisabled.value || void 0,
|
|
17
|
+
"aria-readonly": f.api.isReadonly.value || void 0
|
|
17
18
|
}), [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
icon: d.api.errorIcon.value,
|
|
27
|
-
size: d.api.merged.value.size
|
|
28
|
-
}, d.api.endIconBind.value), null, 16, ["icon", "size"])], 16)) : d.api.merged.value.endIcon ? (h(), c("div", m(p({ key: 6 }, d.api.endBind.value)), [u(y(a), p({ size: d.api.merged.value.size }, d.api.endIconBind.value, { icon: d.api.merged.value.endIcon }), null, 16, ["size", "icon"])], 16)) : s("", !0)
|
|
19
|
+
b(t)(f.api.slots, "label", f.api.merged.value.label) || b(t)(f.api.slots, "corner", f.api.merged.value.corner) ? (g(), l("div", h(m({ key: 0 }, f.api.headerBind.value)), [d(o, { api: f.api }, null, 8, ["api"]), b(t)(f.api.slots, "corner", f.api.merged.value.corner) ? (g(), l("span", h(m({ key: 0 }, f.api.cornerBind.value)), [(g(), s(v(b(i)(f.api.slots, "corner", f.api.merged.value.corner))))], 16)) : c("", !0)], 16)) : c("", !0),
|
|
20
|
+
u("div", h(p(f.api.containerBind.value)), [
|
|
21
|
+
b(e)(f.api.slots, "start") ? (g(), l("div", h(m({ key: 0 }, f.api.startSlotBind.value)), [(g(), s(v(b(r)(f.api.slots, "start"))))], 16)) : b(n)(f.api.merged.value.start) ? (g(), l("div", h(m({ key: 1 }, f.api.startBind.value)), y(f.api.merged.value.start), 17)) : f.api.merged.value.startIcon ? (g(), l("div", h(m({ key: 2 }, f.api.startBind.value)), [d(b(a), m({ size: f.api.merged.value.size }, f.api.startIconBind.value, { icon: f.api.merged.value.startIcon }), null, 16, ["size", "icon"])], 16)) : c("", !0),
|
|
22
|
+
_(w.$slots, "default"),
|
|
23
|
+
b(e)(f.api.slots, "end") ? (g(), l("div", h(m({ key: 3 }, f.api.endSlotBind.value)), [(g(), s(v(b(r)(f.api.slots, "end"))))], 16)) : b(n)(f.api.merged.value.end) ? (g(), l("div", h(m({ key: 4 }, f.api.endBind.value)), y(f.api.merged.value.end), 17)) : f.api.invalidated.value && f.api.merged.value.withErrorIcon !== !1 ? (g(), l("div", h(m({ key: 5 }, f.api.endBind.value)), [d(b(a), m({
|
|
24
|
+
icon: f.api.errorIcon.value,
|
|
25
|
+
size: f.api.merged.value.size
|
|
26
|
+
}, f.api.endIconBind.value), null, 16, ["icon", "size"])], 16)) : f.api.merged.value.endIcon ? (g(), l("div", h(m({ key: 6 }, f.api.endBind.value)), [d(b(a), m({ size: f.api.merged.value.size }, f.api.endIconBind.value, { icon: f.api.merged.value.endIcon }), null, 16, ["size", "icon"])], 16)) : c("", !0)
|
|
29
27
|
], 16),
|
|
30
|
-
!
|
|
31
|
-
|
|
32
|
-
id: `${
|
|
33
|
-
"aria-hidden":
|
|
34
|
-
}), [
|
|
35
|
-
], 16,
|
|
28
|
+
!f.api.invalidated.value && b(t)(f.api.slots, "description", f.api.merged.value.description) ? (g(), l("p", m({ key: 1 }, f.api.descriptionBind.value, { id: `${f.api.controlId.value}-description` }), [(g(), s(v(b(i)(f.api.slots, "description", f.api.merged.value.description))))], 16, S)) : c("", !0),
|
|
29
|
+
f.api.merged.value.withoutErrorMessage ? c("", !0) : (g(), l("p", m({ key: 2 }, f.api.errorBind.value, {
|
|
30
|
+
id: `${f.api.controlId.value}-error`,
|
|
31
|
+
"aria-hidden": f.api.showErrorMessageContent.value ? void 0 : !0
|
|
32
|
+
}), [f.api.showErrorMessageContent.value ? (g(), s(v(b(i)(f.api.slots, "errorMessage", f.api.merged.value.errorMessage)), { key: 0 })) : c("", !0)], 16, C))
|
|
33
|
+
], 16, x));
|
|
36
34
|
}
|
|
37
35
|
});
|
|
38
36
|
//#endregion
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UseFormFieldReturn } from './composables/useFormField';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
api: UseFormFieldReturn;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { hasNamedSlot as e, hasSlotOrProp as t, isPropPresent as n, resolveNamedSlot as r } from "../../Utils/slotOrProp.js";
|
|
2
|
+
import i from "../Label/Label.js";
|
|
3
|
+
import { Fragment as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createTextVNode as l, defineComponent as u, mergeProps as d, normalizeProps as f, openBlock as p, resolveDynamicComponent as m, toDisplayString as h, unref as g, withCtx as _ } from "vue";
|
|
4
|
+
//#region src/Components/FormField/FormFieldLabel.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var v = /* @__PURE__ */ u({
|
|
6
|
+
__name: "FormFieldLabel",
|
|
7
|
+
props: { api: {} },
|
|
8
|
+
setup(u) {
|
|
9
|
+
return (v, y) => g(t)(u.api.slots, "label", u.api.merged.value.label) ? (p(), o(g(i), f(d({ key: 0 }, u.api.fieldLabelProps.value)), {
|
|
10
|
+
default: _(() => [g(e)(u.api.slots, "label") ? (p(), o(m(g(r)(u.api.slots, "label")), { key: 0 })) : g(n)(u.api.merged.value.label) ? (p(), c(a, { key: 1 }, [l(h(u.api.merged.value.label), 1)], 64)) : s("", !0)]),
|
|
11
|
+
_: 1
|
|
12
|
+
}, 16)) : s("", !0);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
export { v as default };
|