@bridge-ui/vue 0.5.1 → 0.7.0
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/ai/skills/bridge-ui-components/SKILL.md +2 -2
- package/dist/Adapters/I18n/useI18nAdapter.d.ts +1 -1
- package/dist/Adapters/I18n/useI18nAdapter.js +4 -1
- package/dist/Components/Accordion/Accordion.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/Accordion/accordion.types.d.ts +2 -2
- package/dist/Components/Alert/alertDefaultIcons.js +1 -0
- package/dist/Components/Autocomplete/composables/useAutocomplete.d.ts +2 -2
- package/dist/Components/Autocomplete/composables/useAutocomplete.js +150 -145
- package/dist/Components/BaseField/BaseField.vue_vue_type_script_setup_true_lang.js +33 -28
- package/dist/Components/BaseField/BaseFieldCorner.js +5 -0
- package/dist/Components/BaseField/BaseFieldCorner.vue.d.ts +17 -0
- package/dist/Components/BaseField/BaseFieldCorner.vue_vue_type_script_setup_true_lang.js +17 -0
- package/dist/Components/BaseField/baseField.types.d.ts +4 -2
- package/dist/Components/BaseField/composables/useBaseField.d.ts +1 -1
- package/dist/Components/BaseField/composables/useBaseField.js +11 -8
- package/dist/Components/Button/Button.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/Components/Button/button.types.d.ts +6 -0
- package/dist/Components/Button/composables/useButton.d.ts +4 -1
- package/dist/Components/Button/composables/useButton.js +88 -69
- package/dist/Components/ButtonGroup/ButtonGroup.js +5 -0
- package/dist/Components/ButtonGroup/ButtonGroup.vue.d.ts +14 -0
- package/dist/Components/ButtonGroup/ButtonGroup.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/Components/ButtonGroup/buttonGroup.types.d.ts +93 -0
- package/dist/Components/ButtonGroup/buttonGroupInjectionKey.d.ts +7 -0
- package/dist/Components/ButtonGroup/buttonGroupInjectionKey.js +4 -0
- package/dist/Components/ButtonGroup/composables/useButtonGroup.d.ts +16 -0
- package/dist/Components/ButtonGroup/composables/useButtonGroup.js +66 -0
- package/dist/Components/ButtonGroup/index.d.ts +4 -0
- package/dist/Components/ButtonGroup/index.js +4 -0
- package/dist/Components/Calendar/Calendar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/CalendarRange/CalendarRange.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/Checkbox/composables/useCheckbox.js +1 -1
- package/dist/Components/ColorField/composables/useColorField.d.ts +1 -1
- package/dist/Components/DataTable/DataTable.vue_vue_type_script_setup_true_lang.js +180 -158
- package/dist/Components/DataTable/DataTableColumnsMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/DataTable/DataTableFilterMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/DataTable/DataTableFilterOptions.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/DataTable/DataTablePagination.js +5 -0
- package/dist/Components/DataTable/DataTablePagination.vue.d.ts +24 -0
- package/dist/Components/DataTable/DataTablePagination.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/Components/DataTable/DataTableSortButton.vue.d.ts +5 -11
- package/dist/Components/DataTable/DataTableSortButton.vue_vue_type_script_setup_true_lang.js +22 -26
- package/dist/Components/DataTable/composables/useDataTable.d.ts +8 -6
- package/dist/Components/DataTable/composables/useDataTable.js +268 -263
- package/dist/Components/DataTable/composables/useDataTablePagination.d.ts +69 -0
- package/dist/Components/DataTable/composables/useDataTablePagination.js +130 -0
- package/dist/Components/DataTable/dataTable.types.d.ts +27 -12
- package/dist/Components/DataTable/dataTablePagination.types.d.ts +169 -0
- package/dist/Components/DataTable/index.d.ts +2 -1
- package/dist/Components/DateField/composables/useDateField.d.ts +1 -1
- package/dist/Components/DateRangeField/composables/useDateRangeField.d.ts +1 -1
- package/dist/Components/DateTimeField/composables/useDateTimeField.d.ts +1 -1
- package/dist/Components/DateTimeRangeField/composables/useDateTimeRangeField.d.ts +1 -1
- package/dist/Components/FieldOverlay/composables/useFieldOverlay.js +4 -1
- package/dist/Components/FormField/FilledFormField.vue.d.ts +7 -7
- package/dist/Components/FormField/FilledFormField.vue_vue_type_script_setup_true_lang.js +32 -27
- package/dist/Components/FormField/FormFieldCorner.js +5 -0
- package/dist/Components/FormField/FormFieldCorner.vue.d.ts +17 -0
- package/dist/Components/FormField/FormFieldCorner.vue_vue_type_script_setup_true_lang.js +17 -0
- package/dist/Components/FormField/NotchedFormField.vue.d.ts +7 -7
- package/dist/Components/FormField/NotchedFormField.vue_vue_type_script_setup_true_lang.js +31 -26
- package/dist/Components/FormField/OutlinedFormField.vue.d.ts +7 -7
- package/dist/Components/FormField/OutlinedFormField.vue_vue_type_script_setup_true_lang.js +32 -27
- package/dist/Components/FormField/StackedFormField.vue.d.ts +6 -6
- package/dist/Components/FormField/StackedFormField.vue_vue_type_script_setup_true_lang.js +34 -29
- package/dist/Components/FormField/UnderlinedFormField.vue.d.ts +7 -7
- package/dist/Components/FormField/UnderlinedFormField.vue_vue_type_script_setup_true_lang.js +32 -27
- package/dist/Components/FormField/composables/useFormField.d.ts +1 -1
- package/dist/Components/FormField/composables/useFormField.js +15 -9
- package/dist/Components/FormField/formField.types.d.ts +4 -2
- package/dist/Components/List/composables/useList.js +1 -1
- package/dist/Components/ListItem/ListItem.vue.d.ts +1 -1
- package/dist/Components/ListItem/composables/useListItem.d.ts +2 -2
- package/dist/Components/ListItem/composables/useListItem.js +101 -86
- package/dist/Components/ListSection/composables/useListSection.js +34 -31
- package/dist/Components/ListSection/listSection.types.d.ts +2 -1
- package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +82 -82
- package/dist/Components/Listbox/collectComposedListboxOptions.d.ts +5 -0
- package/dist/Components/Listbox/collectComposedListboxOptions.js +27 -0
- package/dist/Components/NumberField/composables/useNumberField.d.ts +1 -1
- package/dist/Components/OtpField/composables/useOtpField.d.ts +1 -1
- package/dist/Components/Pagination/Pagination.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/Components/Pagination/composables/usePagination.d.ts +4 -2
- package/dist/Components/Pagination/composables/usePagination.js +125 -127
- package/dist/Components/Pagination/pagination.types.d.ts +5 -5
- package/dist/Components/PasswordField/composables/usePasswordField.d.ts +1 -1
- package/dist/Components/Radio/composables/useRadio.js +2 -1
- package/dist/Components/Select/composables/useSelect.d.ts +2 -2
- package/dist/Components/Select/composables/useSelect.js +104 -99
- package/dist/Components/Sidebar/composables/useSidebarListItem.js +29 -28
- package/dist/Components/Sidebar/composables/useSidebarTrigger.js +14 -14
- package/dist/Components/Slider/composables/useSlider.d.ts +1 -1
- package/dist/Components/Slider/composables/useSlider.js +53 -53
- package/dist/Components/Snackbar/snackbarDefaultIcons.js +1 -0
- package/dist/Components/Tabs/Tabs.vue_vue_type_script_setup_true_lang.js +13 -12
- package/dist/Components/Tabs/composables/useTabs.js +16 -10
- package/dist/Components/Tabs/tabs.types.d.ts +3 -3
- package/dist/Components/TextField/composables/useTextField.d.ts +1 -1
- package/dist/Components/Textarea/composables/useTextarea.d.ts +1 -1
- package/dist/Components/TimeField/composables/useTimeField.d.ts +1 -1
- package/dist/Components/TimePanel/composables/useTimePanel.js +106 -106
- package/dist/Components/TimeRangeField/composables/useTimeRangeField.d.ts +1 -1
- package/dist/augments.d.ts +5 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +150 -147
- package/docs/README.md +1 -0
- package/docs/components/Accordion.md +1 -1
- package/docs/components/Badge.md +2 -0
- package/docs/components/Button.md +5 -1
- package/docs/components/ButtonGroup.md +124 -0
- package/docs/components/DataTable.md +9 -11
- package/docs/components/Divider.md +1 -0
- package/docs/components/I18n.md +65 -24
- package/docs/components/Pagination.md +5 -3
- package/docs/components/Table.md +2 -2
- package/docs/components/Tabs.md +24 -6
- package/docs/components/ToggleGroup.md +1 -1
- package/docs/examples/i18n-dictionary.ts +31 -10
- package/docs/examples/i18n-vue-i18n.ts +7 -6
- package/docs/examples/icon-fontawesome.ts +4 -0
- package/docs/examples/icon-heroicons.ts +5 -1
- package/docs/examples/icon-lucide.ts +4 -0
- package/docs/examples/icon-phosphor.ts +4 -0
- package/docs/examples/icon-tabler.ts +4 -0
- package/package.json +2 -2
|
@@ -1,45 +1,50 @@
|
|
|
1
1
|
import { hasNamedSlot as e, hasSlotOrProp as t, isPropPresent as n } from "../../Utils/slotOrProp.js";
|
|
2
|
-
import r from "./
|
|
3
|
-
import
|
|
2
|
+
import r from "./BaseFieldCorner.js";
|
|
3
|
+
import i from "./BaseFieldLabel.js";
|
|
4
|
+
import { Fragment as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createSlots as u, createTextVNode as d, createVNode as f, defineComponent as p, guardReactiveProps as m, mergeProps as h, normalizeProps as g, openBlock as _, renderSlot as v, toDisplayString as y, unref as b, useSlots as x, withCtx as S } from "vue";
|
|
4
5
|
//#region src/Components/BaseField/BaseField.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var
|
|
6
|
+
var C = [
|
|
6
7
|
"data-invalid",
|
|
7
8
|
"aria-disabled",
|
|
8
9
|
"aria-readonly"
|
|
9
|
-
],
|
|
10
|
+
], w = ["id"], T = ["id", "aria-hidden"], E = /*@__PURE__*/ p({
|
|
10
11
|
inheritAttrs: !1,
|
|
11
12
|
__name: "BaseField",
|
|
12
13
|
props: { field: {} },
|
|
13
|
-
setup(
|
|
14
|
-
let
|
|
15
|
-
...
|
|
14
|
+
setup(p) {
|
|
15
|
+
let E = p, D = x(), O = o(() => ({
|
|
16
|
+
...E.field,
|
|
16
17
|
slots: {
|
|
17
|
-
...
|
|
18
|
-
...
|
|
18
|
+
...E.field.slots,
|
|
19
|
+
...D
|
|
19
20
|
}
|
|
20
|
-
})),
|
|
21
|
-
return (
|
|
22
|
-
"data-invalid":
|
|
23
|
-
"aria-disabled":
|
|
24
|
-
"aria-readonly":
|
|
21
|
+
})), k = o(() => t(D, "label", O.value.merged.value.label) || t(D, "corner", O.value.merged.value.corner));
|
|
22
|
+
return (o, p) => (_(), c("div", h(O.value.rootBind.value, {
|
|
23
|
+
"data-invalid": O.value.invalidated.value || void 0,
|
|
24
|
+
"aria-disabled": O.value.isDisabled.value || void 0,
|
|
25
|
+
"aria-readonly": O.value.isReadonly.value || void 0
|
|
25
26
|
}), [
|
|
26
|
-
|
|
27
|
+
k.value ? (_(), c("div", g(h({ key: 0 }, O.value.headerBind.value)), [f(i, { api: O.value }, u({ _: 2 }, [b(e)(b(D), "label") ? {
|
|
27
28
|
name: "label",
|
|
28
|
-
fn:
|
|
29
|
+
fn: S(() => [v(o.$slots, "label")]),
|
|
29
30
|
key: "0"
|
|
30
|
-
} : void 0]), 1032, ["api"]),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
} : void 0]), 1032, ["api"]), f(r, { api: O.value }, u({ _: 2 }, [b(e)(b(D), "corner") ? {
|
|
32
|
+
name: "corner",
|
|
33
|
+
fn: S(() => [v(o.$slots, "corner")]),
|
|
34
|
+
key: "0"
|
|
35
|
+
} : void 0]), 1032, ["api"])], 16)) : s("", !0),
|
|
36
|
+
l("div", g(m(O.value.groupBind.value)), [
|
|
37
|
+
b(e)(b(D), "start") ? (_(), c("div", g(h({ key: 0 }, O.value.startSlotBind.value)), [v(o.$slots, "start")], 16)) : s("", !0),
|
|
38
|
+
v(o.$slots, "default"),
|
|
39
|
+
b(e)(b(D), "end") ? (_(), c("div", g(h({ key: 1 }, O.value.endSlotBind.value)), [v(o.$slots, "end")], 16)) : s("", !0)
|
|
35
40
|
], 16),
|
|
36
|
-
!
|
|
37
|
-
|
|
38
|
-
id: `${
|
|
39
|
-
"aria-hidden": !
|
|
40
|
-
}), [
|
|
41
|
-
], 16,
|
|
41
|
+
!O.value.invalidated.value && b(t)(b(D), "description", O.value.merged.value.description) ? (_(), c("p", h({ key: 1 }, O.value.descriptionBind.value, { id: `${O.value.controlId.value}-description` }), [b(e)(b(D), "description") ? v(o.$slots, "description", {}, void 0, void 0, 0) : b(n)(O.value.merged.value.description) ? (_(), c(a, { key: 1 }, [d(y(O.value.merged.value.description), 1)], 64)) : s("", !0)], 16, w)) : s("", !0),
|
|
42
|
+
O.value.merged.value.hideErrorMessage ? s("", !0) : (_(), c("p", h({ key: 2 }, O.value.errorBind.value, {
|
|
43
|
+
id: `${O.value.controlId.value}-error`,
|
|
44
|
+
"aria-hidden": !O.value.showErrorMessageContent.value || void 0
|
|
45
|
+
}), [O.value.showErrorMessageContent.value ? (_(), c(a, { key: 0 }, [b(e)(b(D), "errorMessage") ? v(o.$slots, "errorMessage", {}, void 0, void 0, 0) : b(n)(O.value.merged.value.errorMessage) ? (_(), c(a, { key: 1 }, [d(y(O.value.merged.value.errorMessage), 1)], 64)) : s("", !0)], 64)) : s("", !0)], 16, T))
|
|
46
|
+
], 16, C));
|
|
42
47
|
}
|
|
43
48
|
});
|
|
44
49
|
//#endregion
|
|
45
|
-
export {
|
|
50
|
+
export { E as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UseBaseFieldReturn } from './composables/useBaseField';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
api: UseBaseFieldReturn;
|
|
4
|
+
};
|
|
5
|
+
declare var __VLS_8: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
corner?: (props: typeof __VLS_8) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: 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>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { hasNamedSlot as e, hasSlotOrProp as t } from "../../Utils/slotOrProp.js";
|
|
2
|
+
import n from "../Label/Label.js";
|
|
3
|
+
import { Fragment as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createTextVNode as s, defineComponent as c, mergeProps as l, normalizeProps as u, openBlock as d, renderSlot as f, toDisplayString as p, unref as m, useSlots as h, withCtx as g } from "vue";
|
|
4
|
+
//#region src/Components/BaseField/BaseFieldCorner.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var _ = /*@__PURE__*/ c({
|
|
6
|
+
__name: "BaseFieldCorner",
|
|
7
|
+
props: { api: {} },
|
|
8
|
+
setup(c) {
|
|
9
|
+
let _ = h();
|
|
10
|
+
return (h, v) => m(t)(m(_), "corner", c.api.merged.value.corner) ? (d(), i(m(n), u(l({ key: 0 }, c.api.fieldCornerProps.value)), {
|
|
11
|
+
default: g(() => [m(e)(m(_), "corner") ? f(h.$slots, "corner", {}, void 0, void 0, 0) : (d(), o(r, { key: 1 }, [s(p(c.api.merged.value.corner), 1)], 64))]),
|
|
12
|
+
_: 3
|
|
13
|
+
}, 16)) : a("", !0);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
//#endregion
|
|
17
|
+
export { _ as default };
|
|
@@ -48,9 +48,11 @@ export interface BaseFieldClasses {
|
|
|
48
48
|
}
|
|
49
49
|
export interface BaseFieldCustomProps {
|
|
50
50
|
/**
|
|
51
|
-
* Props forwarded to the corner
|
|
51
|
+
* Props forwarded to the corner `Label` (content stays owned by `BaseField`).
|
|
52
|
+
*
|
|
53
|
+
* @default undefined
|
|
52
54
|
*/
|
|
53
|
-
corner?:
|
|
55
|
+
corner?: Partial<Omit<LabelProps, "children">>;
|
|
54
56
|
/**
|
|
55
57
|
* Props forwarded to the helper text below the control group.
|
|
56
58
|
*/
|
|
@@ -38,7 +38,6 @@ export declare function useBaseField(props: MaybeRefOrGetter<Omit<BaseFieldOwnPr
|
|
|
38
38
|
}>>;
|
|
39
39
|
controlId: import('vue').ComputedRef<string>;
|
|
40
40
|
headerBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", HTMLAttributes | undefined, {}>>;
|
|
41
|
-
cornerBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", HTMLAttributes | undefined, {}>>;
|
|
42
41
|
isDisabled: import('vue').ComputedRef<boolean>;
|
|
43
42
|
isReadonly: import('vue').ComputedRef<boolean>;
|
|
44
43
|
sizeClasses: import('vue').ComputedRef<import('@bridge-ui/core/Tokens').BaseFieldSizeItem | undefined>;
|
|
@@ -49,6 +48,7 @@ export declare function useBaseField(props: MaybeRefOrGetter<Omit<BaseFieldOwnPr
|
|
|
49
48
|
ariaDescribedBy: import('vue').ComputedRef<string | undefined>;
|
|
50
49
|
fieldLabelProps: import('vue').ComputedRef<LabelProps>;
|
|
51
50
|
descriptionBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", HTMLAttributes | undefined, {}>>;
|
|
51
|
+
fieldCornerProps: import('vue').ComputedRef<LabelProps>;
|
|
52
52
|
showErrorMessageContent: import('vue').ComputedRef<boolean>;
|
|
53
53
|
};
|
|
54
54
|
export type UseBaseFieldReturn = ReturnType<typeof useBaseField>;
|
|
@@ -61,11 +61,14 @@ function _(_, v = {
|
|
|
61
61
|
"justify-between items-end": e(x, "label", w.value.label),
|
|
62
62
|
"justify-end": !e(x, "label", w.value.label),
|
|
63
63
|
[E.value.header ?? ""]: !0
|
|
64
|
-
}))), R = a(() =>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
}))), R = a(() => {
|
|
65
|
+
let e = y.labelHtmlFor ?? ((e) => e);
|
|
66
|
+
return t(D.value?.corner, {
|
|
67
|
+
size: w.value.size,
|
|
68
|
+
for: e(j.value),
|
|
69
|
+
classes: { root: p({ [E.value.corner ?? ""]: !0 }) }
|
|
70
|
+
});
|
|
71
|
+
}), z = a(() => n(D.value?.group, {
|
|
69
72
|
role: "group",
|
|
70
73
|
id: j.value,
|
|
71
74
|
"aria-describedby": F.value,
|
|
@@ -82,7 +85,7 @@ function _(_, v = {
|
|
|
82
85
|
"group/end wrapper-end-slot shrink-0 flex items-center [&>*]:min-h-0": !0,
|
|
83
86
|
[E.value.end ?? ""]: !0
|
|
84
87
|
}))), H = a(() => n(D.value?.description, {}, p({
|
|
85
|
-
"mt-
|
|
88
|
+
"mt-1 px-1 text-dark-500 dark:text-dark-400": !0,
|
|
86
89
|
[M.value?.text ?? ""]: !0,
|
|
87
90
|
[E.value.description ?? ""]: !0
|
|
88
91
|
})));
|
|
@@ -91,7 +94,7 @@ function _(_, v = {
|
|
|
91
94
|
merged: w,
|
|
92
95
|
rootBind: I,
|
|
93
96
|
errorBind: a(() => n(D.value?.errorMessage, {}, p({
|
|
94
|
-
"mt-
|
|
97
|
+
"mt-1 px-1": !0,
|
|
95
98
|
"min-h-[1lh]": N.value,
|
|
96
99
|
"text-error-600 dark:text-error-400": !0,
|
|
97
100
|
[M.value?.text ?? ""]: !0,
|
|
@@ -100,7 +103,6 @@ function _(_, v = {
|
|
|
100
103
|
groupBind: z,
|
|
101
104
|
controlId: j,
|
|
102
105
|
headerBind: L,
|
|
103
|
-
cornerBind: R,
|
|
104
106
|
isDisabled: k,
|
|
105
107
|
isReadonly: A,
|
|
106
108
|
sizeClasses: M,
|
|
@@ -123,6 +125,7 @@ function _(_, v = {
|
|
|
123
125
|
});
|
|
124
126
|
}),
|
|
125
127
|
descriptionBind: H,
|
|
128
|
+
fieldCornerProps: R,
|
|
126
129
|
showErrorMessageContent: P
|
|
127
130
|
};
|
|
128
131
|
}
|
|
@@ -134,6 +134,12 @@ export interface ButtonOwnProps {
|
|
|
134
134
|
* @default "md"
|
|
135
135
|
*/
|
|
136
136
|
rounded?: MergeProps<ButtonRounded, ButtonRoundedOverrides>;
|
|
137
|
+
/**
|
|
138
|
+
* Whether the button is in a selected / pressed state.
|
|
139
|
+
*
|
|
140
|
+
* @default false
|
|
141
|
+
*/
|
|
142
|
+
selected?: boolean;
|
|
137
143
|
/**
|
|
138
144
|
* The size of the button.
|
|
139
145
|
*
|
|
@@ -7,7 +7,10 @@ export declare function useButton(props: ButtonOwnProps, libDefaults: ButtonLibD
|
|
|
7
7
|
merged: import('vue').ComputedRef<ButtonMerged>;
|
|
8
8
|
isMini: import('vue').ComputedRef<boolean>;
|
|
9
9
|
iconBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", Partial<Omit<import('../../Icon').IconProps, "icon">> | undefined, {}>>;
|
|
10
|
-
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<
|
|
10
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
11
|
+
"aria-pressed": boolean | undefined;
|
|
12
|
+
class: string;
|
|
13
|
+
}, "class", import('vue').HTMLAttributes | undefined, Omit<ButtonProps, "color" | "href" | "icon" | "size" | "classes" | "customProps" | "full" | "rounded" | "variant" | "text" | "disabled" | "endIcon" | "startIcon" | "as" | "density" | "loading" | "selected">>>;
|
|
11
14
|
rootHref: import('vue').ComputedRef<string | undefined>;
|
|
12
15
|
rootType: import('vue').ComputedRef<"button" | undefined>;
|
|
13
16
|
endIconBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", Partial<Omit<import('../../Icon').IconProps, "icon">> | undefined, {}>>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { BUTTON_GROUP_INJECTION_KEY as r } from "../../ButtonGroup/buttonGroupInjectionKey.js";
|
|
3
|
+
import { computed as i, inject as a, useAttrs as o } from "vue";
|
|
4
|
+
import { get as s, includes as c, isNil as l } from "es-toolkit/compat";
|
|
5
|
+
import { buttonDensityProps as u, buttonRoundedProps as d, buttonVariantProps as f } from "@bridge-ui/core/Tokens";
|
|
6
|
+
import { cn as p, mergeBridgeUILayeredClasses as m, splitComponentProps as h } from "@bridge-ui/core/Utils";
|
|
6
7
|
//#region src/Components/Button/composables/useButton.ts
|
|
7
|
-
var
|
|
8
|
+
var g = [
|
|
8
9
|
"as",
|
|
9
10
|
"full",
|
|
10
11
|
"href",
|
|
@@ -19,90 +20,108 @@ var m = [
|
|
|
19
20
|
"rounded",
|
|
20
21
|
"variant",
|
|
21
22
|
"disabled",
|
|
23
|
+
"selected",
|
|
22
24
|
"startIcon",
|
|
23
25
|
"customProps"
|
|
24
26
|
];
|
|
25
|
-
function
|
|
26
|
-
let
|
|
27
|
-
bridgeKeys:
|
|
27
|
+
function _(_, v) {
|
|
28
|
+
let y = o(), b = a(r, null), x = i(() => h({
|
|
29
|
+
bridgeKeys: g,
|
|
28
30
|
props: {
|
|
29
|
-
...
|
|
30
|
-
...
|
|
31
|
+
...y,
|
|
32
|
+
..._
|
|
31
33
|
}
|
|
32
|
-
})),
|
|
33
|
-
|
|
34
|
+
})), S = i(() => {
|
|
35
|
+
let e = x.value.componentProps, t = b?.value;
|
|
36
|
+
return {
|
|
37
|
+
...e,
|
|
38
|
+
size: e.size ?? t?.size,
|
|
39
|
+
color: e.color ?? t?.color,
|
|
40
|
+
density: e.density ?? t?.density,
|
|
41
|
+
rounded: e.rounded ?? t?.rounded,
|
|
42
|
+
variant: e.variant ?? t?.variant
|
|
43
|
+
};
|
|
44
|
+
}), { merged: C, entry: w } = t({
|
|
45
|
+
libDefaults: v,
|
|
34
46
|
componentName: "Button",
|
|
35
|
-
props: () =>
|
|
36
|
-
}),
|
|
37
|
-
entry:
|
|
38
|
-
props: () =>
|
|
39
|
-
}),
|
|
40
|
-
if (!(!
|
|
41
|
-
}),
|
|
42
|
-
if (!
|
|
43
|
-
let e =
|
|
44
|
-
return
|
|
47
|
+
props: () => S.value
|
|
48
|
+
}), T = i(() => C.value.customProps), E = n({
|
|
49
|
+
entry: w,
|
|
50
|
+
props: () => x.value.componentProps
|
|
51
|
+
}), D = i(() => C.value.as ?? "button"), O = i(() => D.value === "a"), k = i(() => D.value === "button"), A = i(() => C.value.density === "mini"), j = i(() => C.value.disabled || C.value.loading), M = i(() => k.value ? j.value : void 0), N = i(() => C.value.loading ? !0 : void 0), P = i(() => j.value && !k.value ? !0 : void 0), F = i(() => {
|
|
52
|
+
if (!(!O.value || j.value || !C.value.href)) return C.value.href;
|
|
53
|
+
}), I = i(() => {
|
|
54
|
+
if (!k.value) return;
|
|
55
|
+
let e = s(x.value.inheritedAttrs, "type");
|
|
56
|
+
return c([
|
|
45
57
|
"submit",
|
|
46
58
|
"reset",
|
|
47
59
|
"button"
|
|
48
60
|
], e) ? e : "button";
|
|
49
|
-
}),
|
|
50
|
-
let e =
|
|
51
|
-
return
|
|
52
|
-
}),
|
|
53
|
-
let e = f
|
|
54
|
-
return
|
|
55
|
-
}),
|
|
56
|
-
let e =
|
|
57
|
-
return
|
|
61
|
+
}), L = i(() => {
|
|
62
|
+
let e = m(u, w.value?.tokens?.density);
|
|
63
|
+
return s(e, [C.value.density, C.value.size]);
|
|
64
|
+
}), R = i(() => l(S.value.variant) ? l(b) && A.value ? "flat" : C.value.variant : S.value.variant), z = i(() => {
|
|
65
|
+
let e = m(f, w.value?.tokens?.variant);
|
|
66
|
+
return s(e, [R.value, C.value.color]);
|
|
67
|
+
}), B = i(() => {
|
|
68
|
+
let e = m(d, w.value?.tokens?.rounded);
|
|
69
|
+
return s(e, C.value.rounded);
|
|
58
70
|
});
|
|
59
71
|
return {
|
|
60
|
-
tag:
|
|
61
|
-
merged:
|
|
62
|
-
isMini:
|
|
63
|
-
iconBind:
|
|
72
|
+
tag: D,
|
|
73
|
+
merged: C,
|
|
74
|
+
isMini: A,
|
|
75
|
+
iconBind: i(() => e(T.value?.icon, {}, p({
|
|
64
76
|
"shrink-0": !0,
|
|
65
|
-
[
|
|
77
|
+
[E.value.icon ?? ""]: !0
|
|
66
78
|
}))),
|
|
67
|
-
rootBind:
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
rootBind: i(() => e(T.value?.root, x.value.inheritedAttrs, {
|
|
80
|
+
"aria-pressed": l(C.value.selected) ? void 0 : C.value.selected,
|
|
81
|
+
class: p({
|
|
82
|
+
"inline-flex items-center justify-center": !0,
|
|
83
|
+
"cursor-pointer outline-none outline-hidden": !0,
|
|
84
|
+
"shrink-0": A.value,
|
|
85
|
+
[L.value ?? ""]: !0,
|
|
86
|
+
[B.value ?? ""]: !0,
|
|
87
|
+
"h-auto": A.value && !l(b) && b.value?.density !== "mini",
|
|
88
|
+
"border border-transparent": !l(b) && R.value !== "outline",
|
|
89
|
+
"w-full": !A.value && C.value.full,
|
|
90
|
+
"w-fit": !A.value && !C.value.full,
|
|
91
|
+
"group hover:shadow-xs": !A.value,
|
|
92
|
+
[s(z.value, "base") ?? ""]: !0,
|
|
93
|
+
[s(z.value, "hover") ?? ""]: !0,
|
|
94
|
+
[s(z.value, "focus") ?? ""]: !0,
|
|
95
|
+
[s(z.value, "selected") ?? ""]: C.value.selected === !0,
|
|
96
|
+
"relative z-10": C.value.selected === !0,
|
|
97
|
+
"transition-all ease-in-out duration-200": !0,
|
|
98
|
+
"focus:ring-2": !0,
|
|
99
|
+
"focus:ring-offset-background-white dark:focus:ring-offset-background-dark": !0,
|
|
100
|
+
"disabled:opacity-80 disabled:cursor-not-allowed": !0,
|
|
101
|
+
"aria-disabled:opacity-80 aria-disabled:cursor-not-allowed aria-disabled:pointer-events-none": !0,
|
|
102
|
+
[E.value.root ?? ""]: !0
|
|
103
|
+
})
|
|
104
|
+
})),
|
|
105
|
+
rootHref: F,
|
|
106
|
+
rootType: I,
|
|
107
|
+
endIconBind: i(() => e(T.value?.endIcon, {}, p({
|
|
89
108
|
"shrink-0": !0,
|
|
90
|
-
[
|
|
109
|
+
[E.value.endIcon ?? ""]: !0
|
|
91
110
|
}))),
|
|
92
|
-
endSlotBind:
|
|
93
|
-
rootAriaBusy:
|
|
94
|
-
rootDisabled:
|
|
95
|
-
startIconBind:
|
|
111
|
+
endSlotBind: i(() => e(T.value?.end, {}, "inline-flex shrink-0 items-center")),
|
|
112
|
+
rootAriaBusy: N,
|
|
113
|
+
rootDisabled: M,
|
|
114
|
+
startIconBind: i(() => e(T.value?.startIcon, {}, p({
|
|
96
115
|
"shrink-0": !0,
|
|
97
|
-
[
|
|
116
|
+
[E.value.startIcon ?? ""]: !0
|
|
98
117
|
}))),
|
|
99
|
-
startSlotBind:
|
|
100
|
-
loadingIconBind:
|
|
118
|
+
startSlotBind: i(() => e(T.value?.start, {}, "inline-flex shrink-0 items-center")),
|
|
119
|
+
loadingIconBind: i(() => e(T.value?.loading, {}, p({
|
|
101
120
|
"shrink-0 animate-spin": !0,
|
|
102
|
-
[
|
|
121
|
+
[E.value.loading ?? ""]: !0
|
|
103
122
|
}))),
|
|
104
|
-
rootAriaDisabled:
|
|
123
|
+
rootAriaDisabled: P
|
|
105
124
|
};
|
|
106
125
|
}
|
|
107
126
|
//#endregion
|
|
108
|
-
export {
|
|
127
|
+
export { _ as useButton };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ButtonGroupOwnProps, ButtonGroupSlots } from './buttonGroup.types';
|
|
2
|
+
type __VLS_Slots = ButtonGroupSlots;
|
|
3
|
+
declare const __VLS_base: import('vue').DefineComponent<ButtonGroupOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ButtonGroupOwnProps> & Readonly<{}>, {
|
|
4
|
+
full: boolean;
|
|
5
|
+
separator: boolean;
|
|
6
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
10
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
11
|
+
new (): {
|
|
12
|
+
$slots: S;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useButtonGroup as e } from "./composables/useButtonGroup.js";
|
|
2
|
+
import { createElementBlock as t, defineComponent as n, guardReactiveProps as r, normalizeProps as i, openBlock as a, renderSlot as o, unref as s } from "vue";
|
|
3
|
+
//#region src/Components/ButtonGroup/ButtonGroup.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var c = /*@__PURE__*/ n({
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "ButtonGroup",
|
|
7
|
+
props: {
|
|
8
|
+
classes: {},
|
|
9
|
+
color: {},
|
|
10
|
+
customProps: {},
|
|
11
|
+
density: {},
|
|
12
|
+
full: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: !1
|
|
15
|
+
},
|
|
16
|
+
orientation: {},
|
|
17
|
+
rounded: {},
|
|
18
|
+
separator: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: !0
|
|
21
|
+
},
|
|
22
|
+
size: {},
|
|
23
|
+
variant: {}
|
|
24
|
+
},
|
|
25
|
+
setup(n) {
|
|
26
|
+
let { rootBind: c } = e(n, {
|
|
27
|
+
full: !1,
|
|
28
|
+
separator: !0,
|
|
29
|
+
color: "primary",
|
|
30
|
+
variant: "solid",
|
|
31
|
+
orientation: "horizontal"
|
|
32
|
+
});
|
|
33
|
+
return (e, n) => (a(), t("div", i(r(s(c))), [o(e.$slots, "default")], 16));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
//#endregion
|
|
37
|
+
export { c as default };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { HTMLAttributes, Slot } from 'vue';
|
|
2
|
+
import { ButtonColor, ButtonDensity, ButtonGroupOrientation, ButtonRounded, ButtonSize, ButtonVariant } from '@bridge-ui/core/Tokens';
|
|
3
|
+
import { MergeHtmlProps, MergeProps } from '@bridge-ui/core/Utils';
|
|
4
|
+
import { ButtonColorOverrides, ButtonDensityOverrides, ButtonRoundedOverrides, ButtonSizeOverrides, ButtonVariantOverrides } from '../Button/button.types';
|
|
5
|
+
export interface ButtonGroupOrientationOverrides {}
|
|
6
|
+
export interface ButtonGroupClasses {
|
|
7
|
+
/**
|
|
8
|
+
* Classes merged onto the root.
|
|
9
|
+
*/
|
|
10
|
+
root?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ButtonGroupCustomProps {
|
|
13
|
+
/**
|
|
14
|
+
* Props forwarded to the root element.
|
|
15
|
+
*
|
|
16
|
+
* @default undefined
|
|
17
|
+
*/
|
|
18
|
+
root?: HTMLAttributes;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Groups related action buttons in a joined strip.
|
|
22
|
+
* Compose with `Button`. Size, color, density, rounded, and variant
|
|
23
|
+
* cascade to nested buttons unless they override them.
|
|
24
|
+
*/
|
|
25
|
+
export interface ButtonGroupOwnProps {
|
|
26
|
+
/**
|
|
27
|
+
* Classes for button group parts.
|
|
28
|
+
*
|
|
29
|
+
* @default undefined
|
|
30
|
+
*/
|
|
31
|
+
classes?: ButtonGroupClasses;
|
|
32
|
+
/**
|
|
33
|
+
* Color applied to nested `Button` children when set. The divider follows the button text color.
|
|
34
|
+
*
|
|
35
|
+
* @default "primary"
|
|
36
|
+
*/
|
|
37
|
+
color?: MergeProps<ButtonColor, ButtonColorOverrides>;
|
|
38
|
+
/**
|
|
39
|
+
* Extra props for internal parts.
|
|
40
|
+
*
|
|
41
|
+
* @default undefined
|
|
42
|
+
*/
|
|
43
|
+
customProps?: ButtonGroupCustomProps;
|
|
44
|
+
/**
|
|
45
|
+
* Density applied to nested `Button` children unless they set `density`.
|
|
46
|
+
*
|
|
47
|
+
* @default undefined
|
|
48
|
+
*/
|
|
49
|
+
density?: MergeProps<ButtonDensity, ButtonDensityOverrides>;
|
|
50
|
+
/**
|
|
51
|
+
* Stretch the group to the container width.
|
|
52
|
+
*
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
full?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Layout orientation of the group.
|
|
58
|
+
*
|
|
59
|
+
* @default "horizontal"
|
|
60
|
+
*/
|
|
61
|
+
orientation?: MergeProps<ButtonGroupOrientation, ButtonGroupOrientationOverrides>;
|
|
62
|
+
/**
|
|
63
|
+
* Roundness applied to nested `Button` children unless they set `rounded`.
|
|
64
|
+
*
|
|
65
|
+
* @default undefined
|
|
66
|
+
*/
|
|
67
|
+
rounded?: MergeProps<ButtonRounded, ButtonRoundedOverrides>;
|
|
68
|
+
/**
|
|
69
|
+
* Draw a full-height divider between adjacent children. The fill matches the button text color.
|
|
70
|
+
*
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
separator?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Size applied to nested `Button` children unless they set `size`.
|
|
76
|
+
*
|
|
77
|
+
* @default undefined
|
|
78
|
+
*/
|
|
79
|
+
size?: MergeProps<ButtonSize, ButtonSizeOverrides>;
|
|
80
|
+
/**
|
|
81
|
+
* Variant applied to nested `Button` children unless they set `variant`.
|
|
82
|
+
*
|
|
83
|
+
* @default undefined
|
|
84
|
+
*/
|
|
85
|
+
variant?: MergeProps<ButtonVariant, ButtonVariantOverrides>;
|
|
86
|
+
}
|
|
87
|
+
export interface ButtonGroupSlots {
|
|
88
|
+
/**
|
|
89
|
+
* Grouped controls (`Button`, nested `ButtonGroup`).
|
|
90
|
+
*/
|
|
91
|
+
default?: Slot<undefined>;
|
|
92
|
+
}
|
|
93
|
+
export type ButtonGroupProps = MergeHtmlProps<ButtonGroupOwnProps, HTMLAttributes>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
import { ButtonGroupOwnProps } from './buttonGroup.types';
|
|
3
|
+
/**
|
|
4
|
+
* Button appearance cascaded to nested `Button` children.
|
|
5
|
+
*/
|
|
6
|
+
export type ButtonGroupContextValue = Pick<ButtonGroupOwnProps, "size" | "color" | "density" | "rounded" | "variant">;
|
|
7
|
+
export declare const BUTTON_GROUP_INJECTION_KEY: InjectionKey<ComputedRef<ButtonGroupContextValue>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core/Utils';
|
|
2
|
+
import { ButtonGroupOwnProps, ButtonGroupProps } from '../buttonGroup.types';
|
|
3
|
+
type ButtonGroupLibDefaults = LibDefaultsShape<ButtonGroupOwnProps, "full" | "color" | "variant" | "separator" | "orientation">;
|
|
4
|
+
type ButtonGroupMerged = MergeLibDefaults<ButtonGroupOwnProps, ButtonGroupLibDefaults>;
|
|
5
|
+
/**
|
|
6
|
+
* Builds bind props for a grouped set of action buttons.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useButtonGroup(props: ButtonGroupOwnProps, libDefaults: ButtonGroupLibDefaults): {
|
|
9
|
+
merged: import('vue').ComputedRef<ButtonGroupMerged>;
|
|
10
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
11
|
+
role: string;
|
|
12
|
+
"data-slot": string;
|
|
13
|
+
class: string;
|
|
14
|
+
}, "class", import('vue').HTMLAttributes | undefined, Omit<ButtonGroupProps, "color" | "orientation" | "size" | "classes" | "customProps" | "full" | "rounded" | "variant" | "density" | "separator">>>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|