@bridge-ui/vue 0.0.5 → 0.0.6
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/Adapters/I18n/index.d.ts +1 -0
- package/dist/Adapters/I18n/index.js +2 -0
- package/dist/Adapters/I18n/useI18nAdapter.d.ts +12 -0
- package/dist/Adapters/I18n/useI18nAdapter.js +13 -0
- package/dist/Adapters/Icon/iconSource.types.d.ts +11 -0
- package/dist/Adapters/Icon/index.d.ts +2 -0
- package/dist/Adapters/Icon/index.js +2 -0
- package/dist/Adapters/Icon/useIconAdapter.d.ts +11 -0
- package/dist/Adapters/Icon/useIconAdapter.js +13 -0
- package/dist/Adapters/index.d.ts +3 -0
- package/dist/Adapters/index.js +3 -0
- package/dist/Components/Alert/Alert.vue_vue_type_script_setup_true_lang.js +1 -5
- package/dist/Components/Alert/alert.types.d.ts +2 -2
- package/dist/Components/Alert/alertDefaultIcons.d.ts +2 -2
- package/dist/Components/Alert/alertDefaultIcons.js +9 -10
- package/dist/Components/Alert/composables/useAlert.d.ts +2 -2
- package/dist/Components/Avatar/Avatar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/Avatar/avatar.types.d.ts +2 -2
- package/dist/Components/Avatar/composables/useAvatar.d.ts +1 -1
- package/dist/Components/Avatar/composables/useAvatar.js +43 -44
- package/dist/Components/Button/Button.vue_vue_type_script_setup_true_lang.js +24 -25
- package/dist/Components/Button/button.types.d.ts +4 -4
- package/dist/Components/Button/composables/useButton.d.ts +1 -1
- package/dist/Components/Checkbox/Checkbox.vue_vue_type_script_setup_true_lang.js +25 -25
- package/dist/Components/Checkbox/composables/useCheckbox.d.ts +3 -3
- package/dist/Components/Chip/Chip.vue_vue_type_script_setup_true_lang.js +8 -9
- package/dist/Components/FormControl/composables/useFormControl.d.ts +1 -1
- package/dist/Components/FormField/composables/useFormField.d.ts +4 -4
- package/dist/Components/FormField/composables/useFormField.js +98 -99
- package/dist/Components/FormField/formField.types.d.ts +5 -5
- package/dist/Components/Icon/Icon.vue_vue_type_script_setup_true_lang.js +7 -7
- package/dist/Components/Icon/composables/useIcon.d.ts +2 -0
- package/dist/Components/Icon/composables/useIcon.js +20 -18
- package/dist/Components/Icon/icon.types.d.ts +3 -3
- package/dist/Components/Label/composables/useLabel.d.ts +1 -1
- package/dist/Components/Link/Link.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/Link/link.types.d.ts +3 -3
- package/dist/Components/ListItem/composables/useListItem.d.ts +2 -2
- package/dist/Components/ListItem/composables/useListItem.js +75 -76
- package/dist/Components/ListItem/listItem.types.d.ts +2 -2
- package/dist/Components/Listbox/Listbox.vue.d.ts +0 -2
- package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +73 -72
- package/dist/Components/NumberField/NumberField.vue_vue_type_script_setup_true_lang.js +40 -40
- package/dist/Components/NumberField/composables/useNumberField.d.ts +6 -6
- package/dist/Components/PasswordField/PasswordField.vue_vue_type_script_setup_true_lang.js +24 -24
- package/dist/Components/PasswordField/composables/usePasswordField.d.ts +6 -6
- package/dist/Components/Radio/composables/useRadio.d.ts +3 -3
- package/dist/Components/Select/Select.vue.d.ts +0 -1
- package/dist/Components/Select/Select.vue_vue_type_script_setup_true_lang.js +62 -61
- package/dist/Components/Select/composables/useSelect.d.ts +8 -8
- package/dist/Components/Select/composables/useSelect.js +214 -214
- package/dist/Components/Snackbar/Snackbar.vue_vue_type_script_setup_true_lang.js +81 -75
- package/dist/Components/Snackbar/composables/useSnackbar.d.ts +4 -4
- package/dist/Components/Snackbar/snackbar.types.d.ts +2 -2
- package/dist/Components/Snackbar/snackbarDefaultIcons.d.ts +3 -3
- package/dist/Components/Snackbar/snackbarDefaultIcons.js +9 -10
- package/dist/Components/Switch/composables/useSwitch.d.ts +3 -3
- package/dist/Components/Tab/Tab.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/Tab/tab.types.d.ts +3 -3
- package/dist/Components/TabItem/TabItem.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/TabItem/tabItem.types.d.ts +3 -3
- package/dist/Components/Tabs/composables/useTabs.d.ts +468 -4
- package/dist/Components/Tabs/tabsInjectionKey.d.ts +5 -5
- package/dist/Components/TextField/composables/useTextField.d.ts +6 -6
- package/dist/Components/Textarea/composables/useTextarea.d.ts +6 -6
- package/dist/Components/Tooltip/Tooltip.js +5 -0
- package/dist/Components/Tooltip/Tooltip.vue.d.ts +35 -0
- package/dist/Components/Tooltip/Tooltip.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/Components/Tooltip/composables/useTooltip.d.ts +50 -0
- package/dist/Components/Tooltip/composables/useTooltip.js +208 -0
- package/dist/Components/Tooltip/index.d.ts +4 -0
- package/dist/Components/Tooltip/index.js +3 -0
- package/dist/Components/Tooltip/tooltip.types.d.ts +166 -0
- package/dist/Provider/createBridgeUIApi.js +2 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +80 -76
- package/package.json +20 -3
|
@@ -6,9 +6,8 @@ import { LISTBOX_INJECTION_KEY as c } from "../../Listbox/listboxInjectionKey.js
|
|
|
6
6
|
import { computed as l, getCurrentInstance as u, inject as d, onBeforeUnmount as f, toValue as p, useAttrs as m, watch as h } from "vue";
|
|
7
7
|
import { get as g, isNull as _, omit as v } from "es-toolkit/compat";
|
|
8
8
|
import { cn as y, splitComponentProps as b } from "@bridge-ui/core";
|
|
9
|
-
import { Check as x } from "@lucide/vue";
|
|
10
9
|
//#region src/Components/ListItem/composables/useListItem.ts
|
|
11
|
-
var
|
|
10
|
+
var x = [
|
|
12
11
|
"as",
|
|
13
12
|
"role",
|
|
14
13
|
"dense",
|
|
@@ -23,109 +22,109 @@ var S = [
|
|
|
23
22
|
"interactive",
|
|
24
23
|
"selectedIcon"
|
|
25
24
|
];
|
|
26
|
-
function
|
|
27
|
-
let
|
|
25
|
+
function S(t, n, S) {
|
|
26
|
+
let C = m(), w = d(o, null), T = d(c, null), E = T != null, D = l(() => b({
|
|
28
27
|
props: {
|
|
29
|
-
...
|
|
28
|
+
...C,
|
|
30
29
|
...t
|
|
31
30
|
},
|
|
32
|
-
bridgeKeys:
|
|
33
|
-
})), { merged:
|
|
31
|
+
bridgeKeys: x
|
|
32
|
+
})), { merged: O, entry: k } = i({
|
|
34
33
|
libDefaults: n,
|
|
35
34
|
componentName: "ListItem",
|
|
36
|
-
props: () =>
|
|
37
|
-
}),
|
|
38
|
-
value:
|
|
39
|
-
description:
|
|
40
|
-
disabled: !!
|
|
41
|
-
label:
|
|
42
|
-
}),
|
|
35
|
+
props: () => D.value.componentProps
|
|
36
|
+
}), A = l(() => T ? p(T) : null), j = l(() => O.value.value == null || !E ? null : {
|
|
37
|
+
value: O.value.value,
|
|
38
|
+
description: O.value.secondary,
|
|
39
|
+
disabled: !!O.value.disabled,
|
|
40
|
+
label: O.value.primary ?? String(O.value.value)
|
|
41
|
+
}), M;
|
|
43
42
|
h(() => {
|
|
44
|
-
let e =
|
|
43
|
+
let e = j.value;
|
|
45
44
|
return e ? `${String(e.value)}:${e.label}:${e.disabled}:${e.description ?? ""}` : null;
|
|
46
45
|
}, () => {
|
|
47
|
-
|
|
48
|
-
let e =
|
|
49
|
-
!e || !
|
|
46
|
+
M?.(), M = void 0;
|
|
47
|
+
let e = j.value;
|
|
48
|
+
!e || !T || (M = p(T).registerOption(e));
|
|
50
49
|
}, { immediate: !0 }), f(() => {
|
|
51
|
-
|
|
50
|
+
M?.();
|
|
52
51
|
});
|
|
53
|
-
let
|
|
54
|
-
entry:
|
|
55
|
-
props: () =>
|
|
56
|
-
}),
|
|
52
|
+
let N = l(() => j.value != null), P = l(() => !j.value || !A.value ? !1 : A.value.isSelected(j.value.value)), F = l(() => !j.value || !A.value ? -1 : A.value.getOptionIndex(j.value.value)), I = l(() => !A.value || F.value < 0 ? !1 : A.value.highlightedIndex === F.value), L = l(() => O.value.customProps), R = a({
|
|
53
|
+
entry: k,
|
|
54
|
+
props: () => D.value.componentProps
|
|
55
|
+
}), z = l(() => "dense" in (u()?.vnode.props ?? {}) ? t.dense === !0 : t.dense === !0 ? !0 : w ? p(w).dense : !1), B = l(() => e(S, "primary") || e(S, "default") || !!O.value.primary), V = l(() => e(S, "secondary") || !!O.value.secondary), H = l(() => e(S, "start")), U = l(() => N.value ? !P.value || !A.value?.showCheckmark ? null : "check" : !O.value.selected || _(O.value.selectedIcon) ? null : O.value.selectedIcon ?? "check"), W = l(() => e(S, "end") || U.value != null), G = l(() => v(D.value.inheritedAttrs, [])), K = l(() => r(L.value?.root, G.value, {
|
|
57
56
|
class: y({
|
|
58
57
|
"list-none": !0,
|
|
59
|
-
"border-b border-black/10 last:border-b-0 dark:border-white/10":
|
|
60
|
-
[g(
|
|
58
|
+
"border-b border-black/10 last:border-b-0 dark:border-white/10": O.value.divider,
|
|
59
|
+
[g(R.value, "root") ?? ""]: !0
|
|
61
60
|
}),
|
|
62
|
-
id:
|
|
63
|
-
})),
|
|
64
|
-
"aria-disabled":
|
|
65
|
-
role:
|
|
66
|
-
tabindex:
|
|
67
|
-
"data-selected":
|
|
68
|
-
"aria-selected":
|
|
69
|
-
onMousedown:
|
|
61
|
+
id: N.value && A.value?.listboxId && F.value >= 0 ? s(A.value.listboxId, F.value) : void 0
|
|
62
|
+
})), q = l(() => O.value.interactive || N.value ? r(L.value?.interactive, {}, {
|
|
63
|
+
"aria-disabled": O.value.disabled ? !0 : void 0,
|
|
64
|
+
role: N.value ? "option" : O.value.role,
|
|
65
|
+
tabindex: O.value.disabled || N.value ? -1 : 0,
|
|
66
|
+
"data-selected": O.value.selected || P.value ? !0 : void 0,
|
|
67
|
+
"aria-selected": N.value ? P.value : void 0,
|
|
68
|
+
onMousedown: N.value ? (e) => {
|
|
70
69
|
e.preventDefault();
|
|
71
70
|
} : void 0,
|
|
72
|
-
onClick:
|
|
73
|
-
|
|
71
|
+
onClick: N.value ? () => {
|
|
72
|
+
j.value && A.value?.onSelect(j.value);
|
|
74
73
|
} : void 0,
|
|
75
74
|
class: y({
|
|
76
75
|
"flex w-full min-w-0 items-center gap-x-3 text-left text-dark-900 outline-hidden transition-colors dark:text-dark-100": !0,
|
|
77
|
-
"cursor-pointer select-none": !
|
|
76
|
+
"cursor-pointer select-none": !O.value.disabled,
|
|
78
77
|
"px-4": !0,
|
|
79
|
-
"py-2": !
|
|
80
|
-
"py-1.5":
|
|
81
|
-
"hover:bg-black/5 focus-visible:bg-black/5 dark:hover:bg-white/10 dark:focus-visible:bg-white/10": !
|
|
82
|
-
"bg-dark-100 font-medium text-dark-900 dark:bg-white/15 dark:text-white":
|
|
83
|
-
[
|
|
84
|
-
[
|
|
85
|
-
[
|
|
86
|
-
[
|
|
87
|
-
"opacity-50 pointer-events-none":
|
|
88
|
-
[g(
|
|
89
|
-
[
|
|
78
|
+
"py-2": !z.value,
|
|
79
|
+
"py-1.5": z.value,
|
|
80
|
+
"hover:bg-black/5 focus-visible:bg-black/5 dark:hover:bg-white/10 dark:focus-visible:bg-white/10": !O.value.disabled && !N.value,
|
|
81
|
+
"bg-dark-100 font-medium text-dark-900 dark:bg-white/15 dark:text-white": O.value.selected && !N.value,
|
|
82
|
+
[A.value?.optionSelectedClass ?? ""]: N.value && P.value,
|
|
83
|
+
[A.value?.mergedClasses.optionSelected ?? ""]: N.value && P.value,
|
|
84
|
+
[A.value?.optionHighlightedClass ?? ""]: N.value && I.value && !P.value,
|
|
85
|
+
[A.value?.mergedClasses.optionHighlighted ?? ""]: N.value && I.value && !P.value,
|
|
86
|
+
"opacity-50 pointer-events-none": O.value.disabled,
|
|
87
|
+
[g(R.value, "interactive") ?? ""]: !0,
|
|
88
|
+
[A.value?.sizeClasses?.option ?? ""]: !0
|
|
90
89
|
})
|
|
91
|
-
}) : null),
|
|
90
|
+
}) : null), J = l(() => y({
|
|
92
91
|
"flex w-full min-w-0 gap-x-3": !0,
|
|
93
|
-
"items-center text-dark-900 dark:text-dark-100": !
|
|
94
|
-
"px-4": !
|
|
95
|
-
"py-2": !
|
|
96
|
-
"py-1.5": !
|
|
97
|
-
})),
|
|
92
|
+
"items-center text-dark-900 dark:text-dark-100": !O.value.interactive,
|
|
93
|
+
"px-4": !O.value.interactive,
|
|
94
|
+
"py-2": !O.value.interactive && !z.value,
|
|
95
|
+
"py-1.5": !O.value.interactive && z.value
|
|
96
|
+
})), Y = l(() => r(L.value?.start, {}, y({
|
|
98
97
|
"flex shrink-0 text-dark-600 dark:text-dark-300": !0,
|
|
99
|
-
[g(
|
|
100
|
-
}))),
|
|
98
|
+
[g(R.value, "start") ?? ""]: !0
|
|
99
|
+
}))), X = l(() => r(L.value?.content, {}, y({
|
|
101
100
|
"min-w-0 flex-1": !0,
|
|
102
|
-
[g(
|
|
103
|
-
}))),
|
|
101
|
+
[g(R.value, "content") ?? ""]: !0
|
|
102
|
+
}))), Z = l(() => r(L.value?.primary, {}, y("block truncate text-sm font-medium", A.value?.sizeClasses?.primary, g(R.value, "primary")))), Q = l(() => r(L.value?.secondary, {}, y("mt-0.5 block truncate text-xs text-dark-500 dark:text-dark-400", A.value?.sizeClasses?.secondary, g(R.value, "secondary"))));
|
|
104
103
|
return {
|
|
105
|
-
merged:
|
|
106
|
-
hasEnd:
|
|
107
|
-
endBind: l(() => r(
|
|
104
|
+
merged: O,
|
|
105
|
+
hasEnd: W,
|
|
106
|
+
endBind: l(() => r(L.value?.end, {}, y({
|
|
108
107
|
"ml-auto flex shrink-0 items-center": !0,
|
|
109
|
-
[g(
|
|
108
|
+
[g(R.value, "end") ?? ""]: !0
|
|
110
109
|
}))),
|
|
111
|
-
rootBind:
|
|
112
|
-
rowClass:
|
|
113
|
-
hasStart:
|
|
114
|
-
startBind:
|
|
115
|
-
hasPrimary:
|
|
116
|
-
contentBind:
|
|
117
|
-
primaryBind:
|
|
118
|
-
hasSecondary:
|
|
119
|
-
secondaryBind:
|
|
120
|
-
interactiveBind:
|
|
121
|
-
selectedIconBind: l(() => r(
|
|
110
|
+
rootBind: K,
|
|
111
|
+
rowClass: J,
|
|
112
|
+
hasStart: H,
|
|
113
|
+
startBind: Y,
|
|
114
|
+
hasPrimary: B,
|
|
115
|
+
contentBind: X,
|
|
116
|
+
primaryBind: Z,
|
|
117
|
+
hasSecondary: V,
|
|
118
|
+
secondaryBind: Q,
|
|
119
|
+
interactiveBind: q,
|
|
120
|
+
selectedIconBind: l(() => r(L.value?.selectedIcon, {}, {
|
|
122
121
|
size: "sm",
|
|
123
|
-
class: y("shrink-0",
|
|
122
|
+
class: y("shrink-0", A.value?.checkClass, g(R.value, "selectedIcon"))
|
|
124
123
|
})),
|
|
125
|
-
resolvedSelectedIcon:
|
|
124
|
+
resolvedSelectedIcon: U
|
|
126
125
|
};
|
|
127
126
|
}
|
|
128
|
-
function
|
|
127
|
+
function C(r, i) {
|
|
129
128
|
if (e(r, "primary")) return n(r, "primary");
|
|
130
129
|
if (e(r, "default")) return n(r, "default");
|
|
131
130
|
if (!t(i)) return () => null;
|
|
@@ -133,4 +132,4 @@ function w(r, i) {
|
|
|
133
132
|
return () => a;
|
|
134
133
|
}
|
|
135
134
|
//#endregion
|
|
136
|
-
export {
|
|
135
|
+
export { C as resolveListItemPrimary, S as useListItem };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LucideIcon } from '@lucide/vue';
|
|
2
1
|
import { HTMLAttributes, Slot, VNode } from 'vue';
|
|
3
2
|
import { ListboxValue, MergeHtmlProps } from '@bridge-ui/core';
|
|
3
|
+
import { IconSource } from '../../Adapters/Icon';
|
|
4
4
|
import { IconProps } from '../Icon';
|
|
5
5
|
export interface ListItemClasses {
|
|
6
6
|
/**
|
|
@@ -146,7 +146,7 @@ export interface ListItemOwnProps {
|
|
|
146
146
|
*
|
|
147
147
|
* @default Check
|
|
148
148
|
*/
|
|
149
|
-
selectedIcon?: null |
|
|
149
|
+
selectedIcon?: null | IconSource;
|
|
150
150
|
/**
|
|
151
151
|
* When set inside a `Listbox`, registers this row as a selectable option.
|
|
152
152
|
*
|
|
@@ -23,10 +23,8 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {
|
|
|
23
23
|
multiple: boolean;
|
|
24
24
|
disableAutoFocus: boolean;
|
|
25
25
|
placement: import('@floating-ui/utils').Placement;
|
|
26
|
-
emptyMessage: string;
|
|
27
26
|
hideEmptyMessage: boolean;
|
|
28
27
|
highlightedIndex: number;
|
|
29
|
-
loadingMessage: string;
|
|
30
28
|
showCheckmark: boolean;
|
|
31
29
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
32
30
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import r from "
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
1
|
+
import { useI18nAdapter as e } from "../../Adapters/I18n/useI18nAdapter.js";
|
|
2
|
+
import { hasNamedSlot as t, resolveNamedSlot as n } from "../../Utils/slotOrProp.js";
|
|
3
|
+
import { mergeNestedComponentProps as r } from "../../Utils/index.js";
|
|
4
|
+
import ee from "../List/List.js";
|
|
5
|
+
import { useListbox as te } from "./composables/useListbox.js";
|
|
6
|
+
import { LISTBOX_INJECTION_KEY as i } from "./listboxInjectionKey.js";
|
|
7
|
+
import a from "../ListItem/ListItem.js";
|
|
8
|
+
import o from "../ListSection/ListSection.js";
|
|
9
|
+
import s from "../Menu/Menu.js";
|
|
10
|
+
import ne from "../Progress/Progress.js";
|
|
11
|
+
import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createSlots as m, createVNode as h, defineComponent as g, guardReactiveProps as _, mergeModels as v, mergeProps as y, normalizeProps as b, openBlock as x, provide as S, ref as C, renderList as w, renderSlot as T, resolveDynamicComponent as E, toDisplayString as D, unref as O, useModel as re, useSlots as ie, watch as k, withCtx as A } from "vue";
|
|
11
12
|
import { isNil as ae } from "es-toolkit/compat";
|
|
12
|
-
import { cn as
|
|
13
|
+
import { cn as oe, entriesFromListboxOptions as se, flattenListboxOptions as j, mapListboxEntriesToRows as M, resolveMessage as N } from "@bridge-ui/core";
|
|
13
14
|
//#region src/Components/Listbox/Listbox.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
-
var P = { key: 1 }, F = /* @__PURE__ */
|
|
15
|
+
var P = { key: 1 }, F = /* @__PURE__ */ g({
|
|
15
16
|
__name: "Listbox",
|
|
16
|
-
props: /* @__PURE__ */
|
|
17
|
+
props: /* @__PURE__ */ v({
|
|
17
18
|
anchorEl: {},
|
|
18
19
|
classes: {},
|
|
19
20
|
color: { default: "primary" },
|
|
@@ -23,7 +24,7 @@ var P = { key: 1 }, F = /* @__PURE__ */ h({
|
|
|
23
24
|
default: !1
|
|
24
25
|
},
|
|
25
26
|
disableMaxHeight: { type: Boolean },
|
|
26
|
-
emptyMessage: {
|
|
27
|
+
emptyMessage: {},
|
|
27
28
|
entries: {},
|
|
28
29
|
hideEmptyMessage: {
|
|
29
30
|
type: Boolean,
|
|
@@ -38,7 +39,7 @@ var P = { key: 1 }, F = /* @__PURE__ */ h({
|
|
|
38
39
|
type: Boolean,
|
|
39
40
|
default: !1
|
|
40
41
|
},
|
|
41
|
-
loadingMessage: {
|
|
42
|
+
loadingMessage: {},
|
|
42
43
|
maxHeight: {},
|
|
43
44
|
multiple: {
|
|
44
45
|
type: Boolean,
|
|
@@ -59,99 +60,99 @@ var P = { key: 1 }, F = /* @__PURE__ */ h({
|
|
|
59
60
|
},
|
|
60
61
|
modelModifiers: {}
|
|
61
62
|
}),
|
|
62
|
-
emits: /* @__PURE__ */
|
|
63
|
+
emits: /* @__PURE__ */ v([
|
|
63
64
|
"registered-options-change",
|
|
64
65
|
"select",
|
|
65
66
|
"show-change"
|
|
66
67
|
], ["update:modelValue"]),
|
|
67
|
-
setup(
|
|
68
|
-
let F = ie(), I =
|
|
69
|
-
|
|
68
|
+
setup(g, { emit: v }) {
|
|
69
|
+
let F = ie(), I = v, L = re(g, "modelValue");
|
|
70
|
+
k(L, (e) => {
|
|
70
71
|
I("show-change", e);
|
|
71
72
|
});
|
|
72
|
-
let R =
|
|
73
|
+
let R = g, z = e(), B = l(() => R.emptyMessage ?? N("No options", z.value)), V = l(() => R.loadingMessage ?? N("Loading...", z.value)), { merged: H, checkClass: U, scrollBind: W, messageBind: G, sizeClasses: K, mergedClasses: q, optionSelectedClass: ce, optionHighlightedClass: le } = te(R, {
|
|
73
74
|
size: "md",
|
|
74
75
|
color: "primary"
|
|
75
|
-
}),
|
|
76
|
-
function
|
|
76
|
+
}), ue = l(() => R.options ?? []), J = l(() => R.entries ? R.entries : se(ue.value)), Y = l(() => j(J.value)), X = l(() => t(F, "default")), Z = l(() => !R.loading && !X.value && Y.value.length === 0 && R.hideEmptyMessage !== !0), de = l(() => oe(U.value, q.value.check)), Q = C([]);
|
|
77
|
+
function $(e) {
|
|
77
78
|
return R.isSelected?.(e) ?? !1;
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
+
function fe(e) {
|
|
80
81
|
e.disabled || I("select", e);
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
-
return
|
|
84
|
-
|
|
83
|
+
function pe(e) {
|
|
84
|
+
return Q.value.some((t) => String(t.value) === String(e.value)) || (Q.value = [...Q.value, e]), () => {
|
|
85
|
+
Q.value = Q.value.filter((t) => String(t.value) !== String(e.value));
|
|
85
86
|
};
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
-
return (
|
|
88
|
+
function me(e) {
|
|
89
|
+
return (X.value ? Q.value : Y.value).findIndex((t) => String(t.value) === String(e));
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}, { deep: !0 }),
|
|
93
|
-
getOptionIndex:
|
|
94
|
-
registerOption:
|
|
95
|
-
onSelect:
|
|
91
|
+
k(Q, (e) => {
|
|
92
|
+
X.value && I("registered-options-change", e);
|
|
93
|
+
}, { deep: !0 }), S(i, l(() => ({
|
|
94
|
+
getOptionIndex: me,
|
|
95
|
+
registerOption: pe,
|
|
96
|
+
onSelect: fe,
|
|
96
97
|
listboxId: R.listboxId,
|
|
97
|
-
isSelected:
|
|
98
|
-
sizeClasses:
|
|
98
|
+
isSelected: $,
|
|
99
|
+
sizeClasses: K.value,
|
|
99
100
|
showCheckmark: R.showCheckmark,
|
|
100
|
-
checkClass:
|
|
101
|
+
checkClass: de.value,
|
|
101
102
|
highlightedIndex: R.highlightedIndex,
|
|
102
|
-
optionSelectedClass:
|
|
103
|
-
optionHighlightedClass:
|
|
103
|
+
optionSelectedClass: ce.value,
|
|
104
|
+
optionHighlightedClass: le.value,
|
|
104
105
|
mergedClasses: {
|
|
105
|
-
optionSelected:
|
|
106
|
-
optionHighlighted:
|
|
106
|
+
optionSelected: q.value.optionSelected,
|
|
107
|
+
optionHighlighted: q.value.optionHighlighted
|
|
107
108
|
}
|
|
108
109
|
})));
|
|
109
|
-
let
|
|
110
|
+
let he = l(() => M(J.value, $)), ge = l(() => H.value.customProps?.menu), _e = l(() => H.value.customProps?.list), ve = l(() => H.value.customProps?.listItem), ye = l(() => H.value.customProps?.progress), be = l(() => H.value.customProps?.listSection), xe = l(() => ({
|
|
110
111
|
...ae(R.rounded) ? {} : { rounded: R.rounded },
|
|
111
|
-
...
|
|
112
|
-
})),
|
|
112
|
+
...ge.value
|
|
113
|
+
})), Se = l(() => ({
|
|
113
114
|
size: "xs",
|
|
114
115
|
"aria-hidden": !0,
|
|
115
|
-
color:
|
|
116
|
-
...
|
|
116
|
+
color: H.value.color,
|
|
117
|
+
...r(ye.value, {
|
|
117
118
|
class: "shrink-0",
|
|
118
|
-
classes: { bar:
|
|
119
|
+
classes: { bar: q.value.loading }
|
|
119
120
|
})
|
|
120
|
-
})),
|
|
121
|
+
})), Ce = l(() => ({
|
|
121
122
|
dense: !0,
|
|
122
123
|
role: "listbox",
|
|
123
124
|
id: R.listboxId,
|
|
124
125
|
"aria-labelledby": R.labelledBy,
|
|
125
126
|
"aria-multiselectable": R.multiple || void 0,
|
|
126
|
-
...
|
|
127
|
+
...r(_e.value, { class: "p-0" })
|
|
127
128
|
}));
|
|
128
|
-
return (
|
|
129
|
+
return (e, r) => (x(), u(O(s), y({
|
|
129
130
|
modelValue: L.value,
|
|
130
|
-
"onUpdate:modelValue":
|
|
131
|
-
"anchor-el":
|
|
132
|
-
placement:
|
|
131
|
+
"onUpdate:modelValue": r[0] ||= (e) => L.value = e,
|
|
132
|
+
"anchor-el": g.anchorEl,
|
|
133
|
+
placement: g.placement,
|
|
133
134
|
"close-on-click-away": !0,
|
|
134
|
-
"disable-auto-focus":
|
|
135
|
-
},
|
|
136
|
-
default:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
default:
|
|
135
|
+
"disable-auto-focus": g.disableAutoFocus
|
|
136
|
+
}, xe.value), {
|
|
137
|
+
default: A(() => [
|
|
138
|
+
O(t)(O(F), "beforeOptions") ? (x(), u(E(O(n)(O(F), "beforeOptions")), { key: 0 })) : d("", !0),
|
|
139
|
+
g.loading ? (x(), f(c, { key: 1 }, [h(O(ne), b(_(Se.value)), null, 16), p("div", b(_(O(G))), [O(t)(O(F), "loading") ? (x(), u(E(O(n)(O(F), "loading")), { key: 0 })) : (x(), f("span", P, D(V.value), 1))], 16)], 64)) : (x(), f("div", b(y({ key: 2 }, O(W))), [h(O(ee), b(_(Ce.value)), {
|
|
140
|
+
default: A(() => [X.value ? T(e.$slots, "default", { key: 0 }) : (x(!0), f(c, { key: 1 }, w(he.value, (n) => (x(), f(c, { key: n.key }, [n.kind === "section" ? (x(), u(O(o), y({
|
|
140
141
|
key: 0,
|
|
141
|
-
title:
|
|
142
|
-
sticky:
|
|
143
|
-
}, { ref_for: !0 },
|
|
142
|
+
title: n.title,
|
|
143
|
+
sticky: n.sticky
|
|
144
|
+
}, { ref_for: !0 }, be.value), null, 16, ["title", "sticky"])) : (x(), u(O(a), y({
|
|
144
145
|
key: 1,
|
|
145
146
|
interactive: "",
|
|
146
|
-
value:
|
|
147
|
-
disabled:
|
|
148
|
-
secondary:
|
|
149
|
-
primary:
|
|
150
|
-
}, { ref_for: !0 },
|
|
147
|
+
value: n.option.value,
|
|
148
|
+
disabled: n.option.disabled,
|
|
149
|
+
secondary: n.option.description,
|
|
150
|
+
primary: O(t)(O(F), "option") ? void 0 : n.option.label
|
|
151
|
+
}, { ref_for: !0 }, ve.value), m({ _: 2 }, [O(t)(O(F), "option") ? {
|
|
151
152
|
name: "default",
|
|
152
|
-
fn:
|
|
153
|
-
option:
|
|
154
|
-
selected:
|
|
153
|
+
fn: A(() => [T(e.$slots, "option", {
|
|
154
|
+
option: n.option,
|
|
155
|
+
selected: n.selected
|
|
155
156
|
})]),
|
|
156
157
|
key: "0"
|
|
157
158
|
} : void 0]), 1040, [
|
|
@@ -162,8 +163,8 @@ var P = { key: 1 }, F = /* @__PURE__ */ h({
|
|
|
162
163
|
]))], 64))), 128))]),
|
|
163
164
|
_: 3
|
|
164
165
|
}, 16)], 16)),
|
|
165
|
-
|
|
166
|
-
|
|
166
|
+
Z.value && !O(t)(O(F), "empty") ? (x(), f("div", b(y({ key: 3 }, O(G))), D(B.value), 17)) : Z.value && O(t)(O(F), "empty") ? (x(), u(E(O(n)(O(F), "empty")), { key: 4 })) : d("", !0),
|
|
167
|
+
O(t)(O(F), "afterOptions") ? (x(), u(E(O(n)(O(F), "afterOptions")), { key: 5 })) : d("", !0)
|
|
167
168
|
]),
|
|
168
169
|
_: 3
|
|
169
170
|
}, 16, [
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import r from "
|
|
4
|
-
import i from "../
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { useI18nAdapter as e } from "../../Adapters/I18n/useI18nAdapter.js";
|
|
2
|
+
import { useHoldRepeat as t } from "../../Utils/useHoldRepeat.js";
|
|
3
|
+
import { mergePartBind as n, resolveFieldAdornmentIconSize as r } from "../../Utils/index.js";
|
|
4
|
+
import i from "../Icon/Icon.js";
|
|
5
|
+
import a from "../FormField/FormField.js";
|
|
6
|
+
import { useNumberField as o } from "./composables/useNumberField.js";
|
|
7
|
+
import { computed as s, createBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, guardReactiveProps as f, isRef as p, mergeModels as m, mergeProps as h, normalizeProps as g, openBlock as _, ref as v, unref as y, useModel as b, vModelDynamic as x, withCtx as S, withDirectives as C } from "vue";
|
|
8
|
+
import { isUndefined as w } from "es-toolkit/compat";
|
|
9
|
+
import { cn as T, resolveMessage as E } from "@bridge-ui/core";
|
|
10
10
|
//#region src/Components/NumberField/NumberField.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
-
var D = { class: "bridge-end-adornment flex h-full min-w-9 flex-col gap-px overflow-hidden" }, O = /* @__PURE__ */
|
|
11
|
+
var D = { class: "bridge-end-adornment flex h-full min-w-9 flex-col gap-px overflow-hidden" }, O = /* @__PURE__ */ d({
|
|
12
12
|
inheritAttrs: !1,
|
|
13
13
|
__name: "NumberField",
|
|
14
|
-
props: /* @__PURE__ */
|
|
14
|
+
props: /* @__PURE__ */ m({
|
|
15
15
|
classes: {},
|
|
16
16
|
customProps: {},
|
|
17
17
|
defaultValue: {},
|
|
@@ -41,45 +41,45 @@ var D = { class: "bridge-end-adornment flex h-full min-w-9 flex-col gap-px overf
|
|
|
41
41
|
modelValue: {},
|
|
42
42
|
modelModifiers: {}
|
|
43
43
|
}),
|
|
44
|
-
emits: /* @__PURE__ */
|
|
45
|
-
setup(
|
|
46
|
-
let O =
|
|
44
|
+
emits: /* @__PURE__ */ m(["change", "update:modelValue"], ["update:modelValue"]),
|
|
45
|
+
setup(d, { emit: m }) {
|
|
46
|
+
let O = m, k = b(d, "modelValue"), A = d, j = v(A.defaultValue), M = s({
|
|
47
47
|
set: (e) => {
|
|
48
48
|
k.value = e, j.value = e;
|
|
49
49
|
},
|
|
50
|
-
get: () =>
|
|
51
|
-
}), { onChange: (e) => O("change", e) }),
|
|
50
|
+
get: () => w(k.value) ? j.value : k.value
|
|
51
|
+
}), N = e(), { decrement: P, formField: F, increment: I, inputBind: L, stringModel: R, mergedClasses: z } = o(A, M, { onChange: (e) => O("change", e) }), B = t(() => I(), () => ({ disabled: A.disabled })), V = t(() => P(), () => ({ disabled: A.disabled })), H = s(() => r(A.size)), U = s(() => n(A.customProps?.increment, {
|
|
52
52
|
type: "button",
|
|
53
53
|
disabled: A.disabled,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
onLostpointercapture:
|
|
59
|
-
},
|
|
54
|
+
onClick: B.onPressClick,
|
|
55
|
+
onPointerup: B.onPressPointerUp,
|
|
56
|
+
onPointerdown: B.onPressPointerDown,
|
|
57
|
+
"aria-label": E("Increment value", N.value),
|
|
58
|
+
onLostpointercapture: B.onPressLostPointerCapture
|
|
59
|
+
}, T({
|
|
60
60
|
"bridge-field-adornment-button inline-flex min-h-0 min-w-8 flex-1 items-center justify-center": !0,
|
|
61
|
-
[
|
|
62
|
-
}))),
|
|
61
|
+
[z.value.increment ?? ""]: !0
|
|
62
|
+
}))), W = s(() => n(A.customProps?.decrement, {
|
|
63
63
|
type: "button",
|
|
64
64
|
disabled: A.disabled,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
onLostpointercapture:
|
|
70
|
-
},
|
|
65
|
+
onClick: V.onPressClick,
|
|
66
|
+
onPointerup: V.onPressPointerUp,
|
|
67
|
+
onPointerdown: V.onPressPointerDown,
|
|
68
|
+
"aria-label": E("Decrement value", N.value),
|
|
69
|
+
onLostpointercapture: V.onPressLostPointerCapture
|
|
70
|
+
}, T({
|
|
71
71
|
"bridge-field-adornment-button inline-flex min-h-0 min-w-8 flex-1 items-center justify-center": !0,
|
|
72
|
-
[
|
|
72
|
+
[z.value.decrement ?? ""]: !0
|
|
73
73
|
})));
|
|
74
|
-
return (e, t) => (
|
|
75
|
-
end:
|
|
76
|
-
icon:
|
|
77
|
-
size:
|
|
78
|
-
}, A.customProps?.incrementIcon), null, 16, ["
|
|
79
|
-
icon:
|
|
80
|
-
size:
|
|
81
|
-
}, A.customProps?.decrementIcon), null, 16, ["
|
|
82
|
-
default:
|
|
74
|
+
return (e, t) => (_(), c(y(a), { field: y(F) }, {
|
|
75
|
+
end: S(() => [l("div", D, [l("button", g(f(U.value)), [u(y(i), h({
|
|
76
|
+
icon: "chevronUp",
|
|
77
|
+
size: H.value
|
|
78
|
+
}, A.customProps?.incrementIcon), null, 16, ["size"])], 16), l("button", g(f(W.value)), [u(y(i), h({
|
|
79
|
+
icon: "chevronDown",
|
|
80
|
+
size: H.value
|
|
81
|
+
}, A.customProps?.decrementIcon), null, 16, ["size"])], 16)])]),
|
|
82
|
+
default: S(() => [C(l("input", h({ "onUpdate:modelValue": t[0] ||= (e) => p(R) ? R.value = e : null }, y(L)), null, 16), [[x, y(R)]])]),
|
|
83
83
|
_: 1
|
|
84
84
|
}, 8, ["field"]));
|
|
85
85
|
}
|
|
@@ -17,7 +17,7 @@ export declare function useNumberField(props: NumberFieldOwnProps, model: Ref<nu
|
|
|
17
17
|
size: NonNullable<keyof import('@bridge-ui/core').FormFieldSize | undefined>;
|
|
18
18
|
rounded: NonNullable<keyof import('@bridge-ui/core').FormFieldRounded | undefined>;
|
|
19
19
|
variant: NonNullable<keyof import('@bridge-ui/core').FormFieldVariant | undefined>;
|
|
20
|
-
errorIcon: import('
|
|
20
|
+
errorIcon: NonNullable<import('../../..').IconSource | undefined>;
|
|
21
21
|
withErrorIcon: NonNullable<boolean | undefined>;
|
|
22
22
|
}>;
|
|
23
23
|
control: import('vue').ComputedRef<string>;
|
|
@@ -173,13 +173,13 @@ export declare function useNumberField(props: NumberFieldOwnProps, model: Ref<nu
|
|
|
173
173
|
'aria-valuenow'?: (string | number) | undefined;
|
|
174
174
|
'aria-valuetext'?: string | undefined | undefined;
|
|
175
175
|
accesskey?: string | undefined | undefined;
|
|
176
|
-
contenteditable?:
|
|
176
|
+
contenteditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
177
177
|
contextmenu?: string | undefined | undefined;
|
|
178
178
|
dir?: string | undefined | undefined;
|
|
179
179
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
180
180
|
enterkeyhint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
181
181
|
enterKeyHint?: "done" | "enter" | "go" | "next" | "previous" | "search" | "send" | undefined;
|
|
182
|
-
hidden?: "" | "until-found" | (boolean | "true" | "false") |
|
|
182
|
+
hidden?: "" | "until-found" | "hidden" | (boolean | "true" | "false") | undefined;
|
|
183
183
|
inert?: (boolean | "true" | "false") | undefined;
|
|
184
184
|
placeholder?: string | undefined | undefined;
|
|
185
185
|
spellcheck?: (boolean | "true" | "false") | undefined;
|
|
@@ -213,7 +213,7 @@ export declare function useNumberField(props: NumberFieldOwnProps, model: Ref<nu
|
|
|
213
213
|
}>>;
|
|
214
214
|
controlId: import('vue').ComputedRef<string>;
|
|
215
215
|
errorBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
216
|
-
errorIcon: import('vue').ComputedRef<import('
|
|
216
|
+
errorIcon: import('vue').ComputedRef<NonNullable<import('../../..').IconSource | undefined>>;
|
|
217
217
|
inputBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", {
|
|
218
218
|
id: string;
|
|
219
219
|
disabled: boolean;
|
|
@@ -435,7 +435,7 @@ export declare function useNumberField(props: NumberFieldOwnProps, model: Ref<nu
|
|
|
435
435
|
onTransitionend?: ((payload: TransitionEvent) => void) | undefined;
|
|
436
436
|
onTransitionrun?: ((payload: TransitionEvent) => void) | undefined;
|
|
437
437
|
onTransitionstart?: ((payload: TransitionEvent) => void) | undefined;
|
|
438
|
-
}, Partial<Omit<Omit<import('../../FormField').FormFieldOwnProps, "field">, "color" | "end" | "size" | "classes" | "customProps" | "
|
|
438
|
+
}, Partial<Omit<Omit<import('../../FormField').FormFieldOwnProps, "field">, "error" | "color" | "end" | "size" | "classes" | "customProps" | "rounded" | "variant" | "label" | "disabled" | "endIcon" | "startIcon" | "start" | "required" | "description" | "errorMessage" | "readonly" | "withoutErrorMessage" | "errorIcon" | "withErrorIcon" | "corner">>>>;
|
|
439
439
|
isNotched: import('vue').ComputedRef<boolean>;
|
|
440
440
|
isStacked: import('vue').ComputedRef<boolean>;
|
|
441
441
|
startBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
@@ -684,7 +684,7 @@ export declare function useNumberField(props: NumberFieldOwnProps, model: Ref<nu
|
|
|
684
684
|
onTransitionend?: ((payload: TransitionEvent) => void) | undefined;
|
|
685
685
|
onTransitionrun?: ((payload: TransitionEvent) => void) | undefined;
|
|
686
686
|
onTransitionstart?: ((payload: TransitionEvent) => void) | undefined;
|
|
687
|
-
}, Partial<Omit<Omit<import('../../FormField').FormFieldOwnProps, "field">, "color" | "end" | "size" | "classes" | "customProps" | "
|
|
687
|
+
}, Partial<Omit<Omit<import('../../FormField').FormFieldOwnProps, "field">, "error" | "color" | "end" | "size" | "classes" | "customProps" | "rounded" | "variant" | "label" | "disabled" | "endIcon" | "startIcon" | "start" | "required" | "description" | "errorMessage" | "readonly" | "withoutErrorMessage" | "errorIcon" | "withErrorIcon" | "corner">>>, {
|
|
688
688
|
min: number | undefined;
|
|
689
689
|
max: number | undefined;
|
|
690
690
|
type: string;
|