@bridge-ui/vue 0.11.0 → 0.12.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/dist/Adapters/Examples/icon-fontawesome.js +52 -40
- package/dist/Adapters/Examples/icon-heroicons.js +43 -31
- package/dist/Adapters/Examples/icon-lucide.js +46 -34
- package/dist/Adapters/Examples/icon-phosphor.js +36 -24
- package/dist/Adapters/Examples/icon-tabler.js +44 -32
- package/dist/Adapters/Examples/rich-text-tiptap.d.ts +5 -0
- package/dist/Adapters/Examples/rich-text-tiptap.js +138 -0
- package/dist/Adapters/RichText/index.d.ts +1 -0
- package/dist/Adapters/RichText/index.js +2 -0
- package/dist/Adapters/RichText/mockRichTextAdapter.d.ts +5 -0
- package/dist/Adapters/RichText/useRichTextAdapter.d.ts +12 -0
- package/dist/Adapters/RichText/useRichTextAdapter.js +13 -0
- package/dist/Adapters/index.d.ts +1 -0
- package/dist/Adapters/index.js +2 -1
- package/dist/Components/ActionFooter/composables/useActionFooter.d.ts +6 -6
- package/dist/Components/Autocomplete/composables/useAutocomplete.js +2 -2
- package/dist/Components/Breadcrumb/Breadcrumb.vue.d.ts +17 -10
- package/dist/Components/Breadcrumb/Breadcrumb.vue_vue_type_script_setup_true_lang.js +7 -2
- package/dist/Components/Breadcrumb/breadcrumb.types.d.ts +22 -4
- package/dist/Components/Breadcrumb/breadcrumbInjectionKey.d.ts +5 -1
- package/dist/Components/Breadcrumb/composables/useBreadcrumb.d.ts +6 -5
- package/dist/Components/Breadcrumb/composables/useBreadcrumb.js +2 -0
- package/dist/Components/BreadcrumbItem/BreadcrumbItem.vue.d.ts +17 -11
- package/dist/Components/BreadcrumbItem/BreadcrumbItem.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/Components/BreadcrumbItem/breadcrumbItem.types.d.ts +21 -3
- package/dist/Components/BreadcrumbItem/composables/useBreadcrumbItem.d.ts +10 -6
- package/dist/Components/BreadcrumbItem/composables/useBreadcrumbItem.js +65 -59
- package/dist/Components/Button/Button.vue.d.ts +17 -8
- package/dist/Components/Button/Button.vue_vue_type_script_setup_true_lang.js +10 -10
- package/dist/Components/Button/button.types.d.ts +22 -5
- package/dist/Components/Button/composables/useButton.d.ts +198 -8
- package/dist/Components/Button/composables/useButton.js +101 -86
- package/dist/Components/ColorPicker/composables/useColorPicker.js +1 -1
- package/dist/Components/DataTable/DataTable.vue.d.ts +1 -1
- package/dist/Components/DataTable/composables/useDataTable.d.ts +1 -1
- package/dist/Components/DataTable/composables/useDataTable.js +288 -282
- package/dist/Components/Drawer/composables/useDrawer.d.ts +1 -1
- package/dist/Components/Drawer/composables/useDrawer.js +2 -2
- package/dist/Components/FileUpload/FileUpload.js +5 -0
- package/dist/Components/FileUpload/FileUpload.vue.d.ts +28 -0
- package/dist/Components/FileUpload/FileUpload.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/Components/FileUpload/composables/useFileUpload.d.ts +70 -0
- package/dist/Components/FileUpload/composables/useFileUpload.js +210 -0
- package/dist/Components/FileUpload/fileUpload.types.d.ts +306 -0
- package/dist/Components/FileUpload/index.d.ts +3 -0
- package/dist/Components/FileUpload/index.js +3 -0
- package/dist/Components/FormField/composables/useFormField.d.ts +1 -1
- package/dist/Components/Link/Link.vue.d.ts +17 -8
- package/dist/Components/Link/Link.vue_vue_type_script_setup_true_lang.js +30 -25
- package/dist/Components/Link/composables/useLink.d.ts +8 -6
- package/dist/Components/Link/composables/useLink.js +52 -45
- package/dist/Components/Link/link.types.d.ts +21 -4
- package/dist/Components/ListItem/ListItem.vue.d.ts +17 -15
- package/dist/Components/ListItem/ListItem.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/Components/ListItem/composables/useListItem.d.ts +7 -6
- package/dist/Components/ListItem/composables/useListItem.js +108 -105
- package/dist/Components/ListItem/listItem.types.d.ts +19 -3
- package/dist/Components/Listbox/composables/useListbox.d.ts +2 -2
- package/dist/Components/Menu/composables/useMenu.js +6 -6
- package/dist/Components/Modal/composables/useModal.d.ts +1 -1
- package/dist/Components/Modal/composables/useModal.js +2 -2
- package/dist/Components/RichTextEditor/RichTextEditor.js +5 -0
- package/dist/Components/RichTextEditor/RichTextEditor.vue.d.ts +23 -0
- package/dist/Components/RichTextEditor/RichTextEditor.vue_vue_type_script_setup_true_lang.js +104 -0
- package/dist/Components/RichTextEditor/composables/useRichTextEditor.d.ts +488 -0
- package/dist/Components/RichTextEditor/composables/useRichTextEditor.js +226 -0
- package/dist/Components/RichTextEditor/index.d.ts +3 -0
- package/dist/Components/RichTextEditor/index.js +3 -0
- package/dist/Components/RichTextEditor/richTextEditor.types.d.ts +103 -0
- package/dist/Components/Select/composables/useSelect.js +2 -2
- package/dist/Components/Sidebar/SidebarListItem.vue.d.ts +17 -9
- package/dist/Components/Sidebar/SidebarListItem.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/Components/Sidebar/composables/useSidebarListItem.js +1 -1
- package/dist/Components/Sidebar/sidebar.types.d.ts +2 -1
- package/dist/Components/Snackbar/composables/useSnackbar.js +1 -1
- package/dist/Components/Textarea/composables/useTextarea.js +1 -1
- package/dist/Components/Tooltip/composables/useTooltip.js +3 -3
- package/dist/Utils/linkAs.d.ts +29 -0
- package/dist/Utils/linkAs.js +18 -0
- package/dist/augments.d.ts +10 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +175 -170
- package/dist/theme.css +3 -0
- package/docs/README.md +3 -0
- package/docs/components/Breadcrumb.md +16 -0
- package/docs/components/BridgeUIProvider.md +18 -1
- package/docs/components/Button.md +31 -19
- package/docs/components/DataTable.md +1 -1
- package/docs/components/FileUpload.md +122 -0
- package/docs/components/Link.md +28 -12
- package/docs/components/List.md +21 -19
- package/docs/components/RichTextEditor.md +88 -0
- package/docs/components/Sidebar.md +1 -1
- package/package.json +54 -18
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { useResolveMessage as e } from "../../../Adapters/I18n/useI18nAdapter.js";
|
|
2
|
+
import { useRichTextAdapter as t } from "../../../Adapters/RichText/useRichTextAdapter.js";
|
|
3
|
+
import { mergePartBind as n, useBridgeUIComponent as r, useBridgeUIMergedRegistryClasses as ee } from "../../../Utils/index.js";
|
|
4
|
+
import { formFieldBridgeKeys as i, useFormField as a } from "../../FormField/composables/useFormField.js";
|
|
5
|
+
import { computed as o, onBeforeUnmount as s, ref as c, useAttrs as l, useSlots as u, watch as d } from "vue";
|
|
6
|
+
import { DEFAULT_RICH_TEXT_TOOLS as f, RICH_TEXT_TOOL_ICONS as te, RICH_TEXT_TOOL_LABELS as p, richTextValuesEqual as ne } from "@bridge-ui/core/Adapters";
|
|
7
|
+
import { get as m, isNil as h, omit as g } from "es-toolkit/compat";
|
|
8
|
+
import { richTextEditorSizeProps as _ } from "@bridge-ui/core/Tokens";
|
|
9
|
+
import { cn as v, mergeBridgeUILayeredClasses as re, splitComponentProps as y } from "@bridge-ui/core/Utils";
|
|
10
|
+
//#region src/Components/RichTextEditor/composables/useRichTextEditor.ts
|
|
11
|
+
var b = [
|
|
12
|
+
"tools",
|
|
13
|
+
"format",
|
|
14
|
+
"classes",
|
|
15
|
+
"readOnly",
|
|
16
|
+
"customProps",
|
|
17
|
+
"placeholder",
|
|
18
|
+
"defaultValue"
|
|
19
|
+
];
|
|
20
|
+
function x(x, S, C, w) {
|
|
21
|
+
let T = l(), E = u(), D = e(), O = t(), k = c(""), A = c(0), j = c(null), M = c(null), N = c(null), P = o(() => y({
|
|
22
|
+
bridgeKeys: b,
|
|
23
|
+
props: {
|
|
24
|
+
...x,
|
|
25
|
+
...T
|
|
26
|
+
}
|
|
27
|
+
})), F = o(() => P.value.componentProps), I = o(() => y({
|
|
28
|
+
bridgeKeys: i,
|
|
29
|
+
props: g(P.value.inheritedAttrs, ["class", "onUpdate:modelValue"])
|
|
30
|
+
})), L = o(() => I.value.componentProps), R = o(() => I.value.inheritedAttrs), z = o(() => {
|
|
31
|
+
let { content: e, toolbar: t, toolbarButton: n, ...r } = F.value.customProps ?? {};
|
|
32
|
+
return r;
|
|
33
|
+
}), B = o(() => F.value.customProps?.toolbarButton), V = o(() => ({
|
|
34
|
+
tools: F.value.tools,
|
|
35
|
+
format: F.value.format,
|
|
36
|
+
classes: F.value.classes,
|
|
37
|
+
size: L.value.size,
|
|
38
|
+
color: L.value.color,
|
|
39
|
+
rounded: L.value.rounded,
|
|
40
|
+
variant: L.value.variant
|
|
41
|
+
})), { merged: H, entry: U } = r({
|
|
42
|
+
componentName: "RichTextEditor",
|
|
43
|
+
props: () => V.value,
|
|
44
|
+
libDefaults: {
|
|
45
|
+
size: "md",
|
|
46
|
+
rounded: "md",
|
|
47
|
+
format: "html",
|
|
48
|
+
color: "primary",
|
|
49
|
+
variant: "outline"
|
|
50
|
+
}
|
|
51
|
+
}), W = ee({
|
|
52
|
+
entry: U,
|
|
53
|
+
props: () => V.value
|
|
54
|
+
}), G = o(() => H.value.format ?? "html"), K = o(() => [...F.value.tools ?? H.value.tools ?? f]), q = o(() => F.value.readOnly === !0 || L.value.readonly === !0), J = o(() => !(q.value || L.value.disabled === !0) && K.value.length > 0), Y = o(() => {
|
|
55
|
+
let e = re(_, U.value?.tokens?.size);
|
|
56
|
+
return m(e, L.value.size ?? H.value.size ?? "md");
|
|
57
|
+
}), X = a(() => ({
|
|
58
|
+
...R.value,
|
|
59
|
+
...L.value,
|
|
60
|
+
classes: W.value,
|
|
61
|
+
customProps: z.value,
|
|
62
|
+
readonly: q.value || L.value.readonly
|
|
63
|
+
}), {
|
|
64
|
+
size: "md",
|
|
65
|
+
rounded: "md",
|
|
66
|
+
color: "primary",
|
|
67
|
+
variant: "outline",
|
|
68
|
+
showErrorIcon: !0
|
|
69
|
+
}, {
|
|
70
|
+
control: () => "textarea",
|
|
71
|
+
componentName: "RichTextEditor"
|
|
72
|
+
}), ie = o(() => X.invalidated.value ? "error" : X.merged.value.color ?? "primary");
|
|
73
|
+
function ae(e) {
|
|
74
|
+
return !!(X.isDisabled.value || q.value || !(N.value?.can(e) ?? !0));
|
|
75
|
+
}
|
|
76
|
+
function Z() {
|
|
77
|
+
A.value += 1;
|
|
78
|
+
}
|
|
79
|
+
function Q() {
|
|
80
|
+
k.value = "", M.value = null;
|
|
81
|
+
}
|
|
82
|
+
function oe() {
|
|
83
|
+
let e = k.value.trim();
|
|
84
|
+
e.length !== 0 && (N.value?.run("link", { href: e }), Z(), Q());
|
|
85
|
+
}
|
|
86
|
+
function se(e, t) {
|
|
87
|
+
let n = N.value;
|
|
88
|
+
if (!h(n)) {
|
|
89
|
+
if (e === "link") {
|
|
90
|
+
if (n.isActive("link")) {
|
|
91
|
+
n.run("link"), Z(), Q();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
let e = t.currentTarget;
|
|
95
|
+
e instanceof HTMLElement && (k.value = "", M.value = e);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
n.run(e), Z();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
let ce = o({
|
|
102
|
+
get() {
|
|
103
|
+
return !h(M.value);
|
|
104
|
+
},
|
|
105
|
+
set(e) {
|
|
106
|
+
e || Q();
|
|
107
|
+
}
|
|
108
|
+
}), le = o(() => k.value.trim().length > 0), ue = o(() => D("URL"));
|
|
109
|
+
d(J, (e) => {
|
|
110
|
+
e || Q();
|
|
111
|
+
});
|
|
112
|
+
function $() {
|
|
113
|
+
N.value?.destroy(), N.value = null;
|
|
114
|
+
let e = j.value;
|
|
115
|
+
h(e) || (e.remove(), j.value = null);
|
|
116
|
+
}
|
|
117
|
+
function de() {
|
|
118
|
+
$();
|
|
119
|
+
let e = w.value, t = O.value;
|
|
120
|
+
if (h(e)) return;
|
|
121
|
+
if (h(t)) throw Error("[BridgeUI] RichTextEditor requires BridgeUIProvider global.richText. See packages/{react,vue}/Adapters/Examples/rich-text-tiptap.");
|
|
122
|
+
let n = document.createElement("div");
|
|
123
|
+
n.className = "flex min-h-0 min-w-0 w-full flex-1 flex-col outline-none", e.appendChild(n), j.value = n, N.value = t.mount({
|
|
124
|
+
element: n,
|
|
125
|
+
tools: K.value,
|
|
126
|
+
value: S.value,
|
|
127
|
+
format: G.value,
|
|
128
|
+
readOnly: q.value,
|
|
129
|
+
id: X.controlId.value,
|
|
130
|
+
ariaReadonly: q.value,
|
|
131
|
+
onSelectionChange: Z,
|
|
132
|
+
disabled: X.isDisabled.value,
|
|
133
|
+
placeholder: F.value.placeholder,
|
|
134
|
+
ariaDisabled: X.isDisabled.value,
|
|
135
|
+
ariaInvalid: X.invalidated.value,
|
|
136
|
+
ariaDescribedBy: X.ariaDescribedBy.value,
|
|
137
|
+
onChange: (e) => {
|
|
138
|
+
S.value = e, C("update:modelValue", e);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
d([
|
|
143
|
+
G,
|
|
144
|
+
O,
|
|
145
|
+
w
|
|
146
|
+
], () => {
|
|
147
|
+
de();
|
|
148
|
+
}, { flush: "post" }), d(() => S.value, (e) => {
|
|
149
|
+
let t = N.value;
|
|
150
|
+
h(t) || e === void 0 || ne(t.getValue(), e) || t.setValue(e);
|
|
151
|
+
}), d(() => X.isDisabled.value, (e) => {
|
|
152
|
+
N.value?.setDisabled(e);
|
|
153
|
+
}), d(q, (e) => {
|
|
154
|
+
N.value?.setReadOnly(e);
|
|
155
|
+
}), d([
|
|
156
|
+
q,
|
|
157
|
+
() => F.value.placeholder,
|
|
158
|
+
() => X.controlId.value,
|
|
159
|
+
() => X.isDisabled.value,
|
|
160
|
+
() => X.invalidated.value,
|
|
161
|
+
() => X.ariaDescribedBy.value
|
|
162
|
+
], () => {
|
|
163
|
+
N.value?.setA11y({
|
|
164
|
+
id: X.controlId.value,
|
|
165
|
+
ariaReadonly: q.value,
|
|
166
|
+
placeholder: F.value.placeholder,
|
|
167
|
+
ariaDisabled: X.isDisabled.value,
|
|
168
|
+
ariaInvalid: X.invalidated.value,
|
|
169
|
+
ariaDescribedBy: X.ariaDescribedBy.value
|
|
170
|
+
});
|
|
171
|
+
}), s(() => {
|
|
172
|
+
$();
|
|
173
|
+
});
|
|
174
|
+
let fe = o(() => n(F.value.customProps?.toolbar, {
|
|
175
|
+
role: "toolbar",
|
|
176
|
+
"aria-label": D("Formatting")
|
|
177
|
+
}, v({
|
|
178
|
+
[Y.value?.toolbar ?? ""]: !0,
|
|
179
|
+
[W.value.toolbar ?? ""]: !0
|
|
180
|
+
}))), pe = o(() => n(F.value.customProps?.content, {}, v({
|
|
181
|
+
"min-w-0 flex-1": !0,
|
|
182
|
+
[Y.value?.content ?? ""]: !0,
|
|
183
|
+
[W.value.content ?? ""]: !0,
|
|
184
|
+
[W.value.input ?? ""]: !0
|
|
185
|
+
})));
|
|
186
|
+
function me(e) {
|
|
187
|
+
A.value;
|
|
188
|
+
let t = N.value, r = D(p[e]);
|
|
189
|
+
return n(B.value, {
|
|
190
|
+
type: "button",
|
|
191
|
+
density: "mini",
|
|
192
|
+
variant: "flat",
|
|
193
|
+
"aria-label": r,
|
|
194
|
+
color: ie.value,
|
|
195
|
+
icon: te[e],
|
|
196
|
+
disabled: ae(e),
|
|
197
|
+
size: X.merged.value.size ?? "md",
|
|
198
|
+
selected: t?.isActive(e) ?? !1,
|
|
199
|
+
rounded: X.merged.value.rounded ?? "md"
|
|
200
|
+
}, v({
|
|
201
|
+
[Y.value?.toolbarButton ?? ""]: !0,
|
|
202
|
+
[W.value.toolbarButton ?? ""]: !0
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
slots: E,
|
|
207
|
+
tools: K,
|
|
208
|
+
format: G,
|
|
209
|
+
linkHref: k,
|
|
210
|
+
linkOpen: ce,
|
|
211
|
+
formField: X,
|
|
212
|
+
linkAnchor: M,
|
|
213
|
+
isReadOnly: q,
|
|
214
|
+
contentBind: pe,
|
|
215
|
+
confirmLink: oe,
|
|
216
|
+
onToolClick: se,
|
|
217
|
+
toolbarBind: fe,
|
|
218
|
+
showToolbar: J,
|
|
219
|
+
linkUrlLabel: ue,
|
|
220
|
+
canConfirmLink: le,
|
|
221
|
+
closeLinkEditor: Q,
|
|
222
|
+
getToolbarButtonBind: me
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
export { x as useRichTextEditor };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { useRichTextEditor } from './composables/useRichTextEditor';
|
|
2
|
+
export type { RichTextEditorClasses, RichTextEditorColorOverrides, RichTextEditorCustomProps, RichTextEditorEmits, RichTextEditorOwnProps, RichTextEditorProps, RichTextEditorRoundedOverrides, RichTextEditorSizeOverrides, RichTextEditorSlots, RichTextEditorVariantOverrides, } from './richTextEditor.types';
|
|
3
|
+
export { default as RichTextEditor } from './RichTextEditor.vue';
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { HTMLAttributes, Slot } from 'vue';
|
|
2
|
+
import { RichTextFormat, RichTextTool, RichTextValue } from '@bridge-ui/core/Adapters';
|
|
3
|
+
import { MergeHtmlProps } from '@bridge-ui/core/Utils';
|
|
4
|
+
import { ButtonOwnProps } from '../Button/button.types';
|
|
5
|
+
import { FormFieldClasses, FormFieldCustomProps, FormFieldOwnProps, FormFieldSlots } from '../FormField/formField.types';
|
|
6
|
+
export interface RichTextEditorSizeOverrides {}
|
|
7
|
+
export interface RichTextEditorColorOverrides {}
|
|
8
|
+
export interface RichTextEditorRoundedOverrides {}
|
|
9
|
+
export interface RichTextEditorVariantOverrides {}
|
|
10
|
+
export interface RichTextEditorClasses extends FormFieldClasses {
|
|
11
|
+
/**
|
|
12
|
+
* Classes for the editable content surface.
|
|
13
|
+
*/
|
|
14
|
+
content?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Classes for the toolbar row.
|
|
17
|
+
*/
|
|
18
|
+
toolbar?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Classes for each toolbar tool button.
|
|
21
|
+
*/
|
|
22
|
+
toolbarButton?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface RichTextEditorCustomProps extends FormFieldCustomProps {
|
|
25
|
+
/**
|
|
26
|
+
* Props forwarded to the editable content surface.
|
|
27
|
+
*/
|
|
28
|
+
content?: HTMLAttributes;
|
|
29
|
+
/**
|
|
30
|
+
* Props forwarded to the toolbar row.
|
|
31
|
+
*/
|
|
32
|
+
toolbar?: HTMLAttributes;
|
|
33
|
+
/**
|
|
34
|
+
* Props forwarded to each toolbar `Button` (`icon` / selection stay owned).
|
|
35
|
+
*/
|
|
36
|
+
toolbarButton?: Partial<Omit<ButtonOwnProps, "icon" | "onClick" | "selected">>;
|
|
37
|
+
}
|
|
38
|
+
export interface RichTextEditorEmits {
|
|
39
|
+
/**
|
|
40
|
+
* Emitted when the document changes (`v-model`).
|
|
41
|
+
*/
|
|
42
|
+
"update:modelValue": [value: RichTextValue];
|
|
43
|
+
}
|
|
44
|
+
export interface RichTextEditorOwnProps extends Omit<FormFieldOwnProps, "field"> {
|
|
45
|
+
/**
|
|
46
|
+
* Classes for the field chrome, toolbar, and content surface.
|
|
47
|
+
*
|
|
48
|
+
* @default undefined
|
|
49
|
+
*/
|
|
50
|
+
classes?: RichTextEditorClasses;
|
|
51
|
+
/**
|
|
52
|
+
* Extra props for internal parts (`content`, `toolbar`, `toolbarButton`, …).
|
|
53
|
+
* Root HTML attributes stay on the component top level.
|
|
54
|
+
*
|
|
55
|
+
* @default undefined
|
|
56
|
+
*/
|
|
57
|
+
customProps?: RichTextEditorCustomProps;
|
|
58
|
+
/**
|
|
59
|
+
* Initial value for uncontrolled usage (when `v-model` is not bound).
|
|
60
|
+
*
|
|
61
|
+
* @default undefined
|
|
62
|
+
*/
|
|
63
|
+
defaultValue?: RichTextValue;
|
|
64
|
+
/**
|
|
65
|
+
* Controlled / emitted document format.
|
|
66
|
+
*
|
|
67
|
+
* @default "html"
|
|
68
|
+
*/
|
|
69
|
+
format?: RichTextFormat;
|
|
70
|
+
/**
|
|
71
|
+
* Empty-state hint in the content area.
|
|
72
|
+
*
|
|
73
|
+
* @default undefined
|
|
74
|
+
*/
|
|
75
|
+
placeholder?: string;
|
|
76
|
+
/**
|
|
77
|
+
* View-only surface; hides the toolbar and disables editing.
|
|
78
|
+
* Prefer this over FormField `readonly` for the rich-text surface.
|
|
79
|
+
*
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
readOnly?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Which toolbar actions to show.
|
|
85
|
+
*
|
|
86
|
+
* @default DEFAULT_RICH_TEXT_TOOLS
|
|
87
|
+
*/
|
|
88
|
+
tools?: RichTextTool[];
|
|
89
|
+
}
|
|
90
|
+
export interface RichTextEditorSlots extends FormFieldSlots {
|
|
91
|
+
/**
|
|
92
|
+
* Replace the default toolbar. Receives the resolved tool list.
|
|
93
|
+
*/
|
|
94
|
+
toolbar?: Slot<{
|
|
95
|
+
tools: RichTextTool[];
|
|
96
|
+
}>;
|
|
97
|
+
}
|
|
98
|
+
export type RichTextEditorProps = MergeHtmlProps<RichTextEditorOwnProps, HTMLAttributes> & {
|
|
99
|
+
/**
|
|
100
|
+
* Bound with `v-model` on the component.
|
|
101
|
+
*/
|
|
102
|
+
modelValue?: RichTextValue;
|
|
103
|
+
};
|
|
@@ -148,7 +148,7 @@ function p(p, m, h, g, Me) {
|
|
|
148
148
|
likeInput: () => M.value,
|
|
149
149
|
control: () => M.value ? "textarea" : "input"
|
|
150
150
|
}), tt = a(() => V.value && Ge.value && !p.readonly && !q.isDisabled.value), J = (e) => {
|
|
151
|
-
|
|
151
|
+
e && M.value && De(e);
|
|
152
152
|
};
|
|
153
153
|
function nt(e) {
|
|
154
154
|
return We.value.some((t) => d(t, e));
|
|
@@ -265,7 +265,7 @@ function p(p, m, h, g, Me) {
|
|
|
265
265
|
}
|
|
266
266
|
async function ft() {
|
|
267
267
|
let e = A.value.asyncData;
|
|
268
|
-
|
|
268
|
+
e?.resolve && R.value.length !== 0 && (E.value = Se(await e.resolve(R.value), N.value));
|
|
269
269
|
}
|
|
270
270
|
let $ = a(() => {
|
|
271
271
|
let e = ke(Ee, me(Ie.value, [
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { ListItemOwnProps, ListItemSlots } from '../ListItem/listItem.types';
|
|
2
2
|
import { SidebarListItemOwnProps } from './sidebar.types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { LinkAsTag } from '../../Utils/linkAs';
|
|
4
|
+
declare const __VLS_export: <T extends LinkAsTag = "a">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
|
+
props: import('vue').PublicProps & __VLS_PrettifyLocal<ListItemOwnProps<T> & SidebarListItemOwnProps> & (typeof globalThis extends {
|
|
6
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
7
|
+
} ? P : {});
|
|
8
|
+
expose: (exposed: {}) => void;
|
|
9
|
+
attrs: any;
|
|
10
|
+
slots: ListItemSlots;
|
|
11
|
+
emit: {};
|
|
12
|
+
}>) => import('vue').VNode & {
|
|
13
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
14
|
+
};
|
|
7
15
|
declare const _default: typeof __VLS_export;
|
|
8
16
|
export default _default;
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
17
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
18
|
+
[K in keyof T]: T[K];
|
|
19
|
+
} : {
|
|
20
|
+
[K in keyof T as K]: T[K];
|
|
21
|
+
}) & {};
|
|
@@ -17,7 +17,7 @@ function l(l) {
|
|
|
17
17
|
if (a(l.primary)) return l.primary;
|
|
18
18
|
}
|
|
19
19
|
}), m = r(() => l.tooltipPlacement === void 0 ? s(u.value.side) : l.tooltipPlacement), h = r(() => {
|
|
20
|
-
if (
|
|
20
|
+
if (f.value && a(l.primary)) return l.primary;
|
|
21
21
|
});
|
|
22
22
|
return {
|
|
23
23
|
tooltip: p,
|
|
@@ -4,6 +4,7 @@ import { SidebarCollapsible, SidebarSide, SidebarVariant } from '@bridge-ui/core
|
|
|
4
4
|
import { MergeHtmlProps, MergeProps } from '@bridge-ui/core/Utils';
|
|
5
5
|
import { ListProps } from '../List/list.types';
|
|
6
6
|
import { ListItemProps } from '../ListItem/listItem.types';
|
|
7
|
+
import { LinkAsTag } from '../../Utils/linkAs';
|
|
7
8
|
export interface SidebarSideOverrides {}
|
|
8
9
|
export interface SidebarVariantOverrides {}
|
|
9
10
|
export interface SidebarCollapsibleOverrides {}
|
|
@@ -241,4 +242,4 @@ export type SidebarListProps = ListProps & SidebarListOwnProps;
|
|
|
241
242
|
* `ListItem` bound to the nearest `Sidebar`. Shows `primary` in a tooltip
|
|
242
243
|
* when the icon rail is collapsed.
|
|
243
244
|
*/
|
|
244
|
-
export type SidebarListItemProps = ListItemProps & SidebarListItemOwnProps;
|
|
245
|
+
export type SidebarListItemProps<T extends LinkAsTag = "a"> = ListItemProps<T> & SidebarListItemOwnProps;
|
|
@@ -106,7 +106,7 @@ function m(m, xe, h = {}) {
|
|
|
106
106
|
}), Q(e);
|
|
107
107
|
}
|
|
108
108
|
function je(e) {
|
|
109
|
-
|
|
109
|
+
x.value && g.value && D.value === "closed" && e.target === e.currentTarget && e.propertyName !== "none" && e.elapsedTime !== 0 && X();
|
|
110
110
|
}
|
|
111
111
|
c(z, (e) => {
|
|
112
112
|
if (e) {
|
|
@@ -46,7 +46,7 @@ function h(h, g) {
|
|
|
46
46
|
let e = m(d, y.value?.tokens?.resize);
|
|
47
47
|
return c(e, E.value ?? "none");
|
|
48
48
|
}), O = i(() => _.onInput), k = (e) => {
|
|
49
|
-
|
|
49
|
+
e && C.value && f(e);
|
|
50
50
|
}, A = (e) => {
|
|
51
51
|
k(e.target), O.value?.(e);
|
|
52
52
|
}, j = i(() => e(T.inputBind.value, {
|
|
@@ -92,7 +92,7 @@ function b(b, ae, x = {}) {
|
|
|
92
92
|
X();
|
|
93
93
|
}
|
|
94
94
|
function de(e) {
|
|
95
|
-
e.key
|
|
95
|
+
e.key === "Escape" && I.value && (e.preventDefault(), J(), L(!1));
|
|
96
96
|
}
|
|
97
97
|
function Z() {
|
|
98
98
|
A = !1, M?.destroy(), M = null;
|
|
@@ -100,7 +100,7 @@ function b(b, ae, x = {}) {
|
|
|
100
100
|
function fe() {
|
|
101
101
|
Z();
|
|
102
102
|
let e = oe(), t = D.value;
|
|
103
|
-
|
|
103
|
+
I.value && e && t && (M = _({
|
|
104
104
|
floating: t,
|
|
105
105
|
reference: e,
|
|
106
106
|
shiftCrossAxis: !1,
|
|
@@ -109,7 +109,7 @@ function b(b, ae, x = {}) {
|
|
|
109
109
|
placement: z.value.placement,
|
|
110
110
|
arrow: z.value.arrow ? () => E.value : void 0,
|
|
111
111
|
onReferenceHidden: () => {
|
|
112
|
-
|
|
112
|
+
A && I.value && (J(), L(!1));
|
|
113
113
|
}
|
|
114
114
|
}), M.start(), a(() => {
|
|
115
115
|
A = !0;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AllowedComponentProps, Component, ComponentInstance, VNodeProps } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Tag or component accepted by `linkAs`.
|
|
4
|
+
*/
|
|
5
|
+
export type LinkAsTag = string | Component;
|
|
6
|
+
declare const linkAsReservedProps: readonly ["ref", "href", "class", "style", "children", "className"];
|
|
7
|
+
type LinkAsReservedProp = (typeof linkAsReservedProps)[number];
|
|
8
|
+
/**
|
|
9
|
+
* Props of a component passed to `linkAs`. String tags have none.
|
|
10
|
+
*/
|
|
11
|
+
type VueComponentProps<T> = T extends string ? Record<never, never> : ComponentInstance<T>["$props"];
|
|
12
|
+
/**
|
|
13
|
+
* `href` of `T`, or `string` when `T` is still the default tag.
|
|
14
|
+
*/
|
|
15
|
+
export type LinkHref<T extends LinkAsTag, DefaultTag extends LinkAsTag> = [
|
|
16
|
+
T
|
|
17
|
+
] extends [DefaultTag] ? string : "href" extends keyof VueComponentProps<T> ? VueComponentProps<T>["href"] : string;
|
|
18
|
+
/**
|
|
19
|
+
* Props of `linkAs`, excluding the ones Bridge already sets.
|
|
20
|
+
* `never` when `linkAs` is omitted.
|
|
21
|
+
*/
|
|
22
|
+
export type LinkPropsOf<T extends LinkAsTag, DefaultTag extends LinkAsTag> = [
|
|
23
|
+
T
|
|
24
|
+
] extends [DefaultTag] ? never : Omit<VueComponentProps<T>, keyof VNodeProps | LinkAsReservedProp | keyof AllowedComponentProps>;
|
|
25
|
+
/**
|
|
26
|
+
* Props to put on `linkAs`. Empty when that component is not the rendered tag.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveLinkAsProps(linkAs: unknown, linkProps: object | undefined, rendered: unknown): undefined | Record<string, unknown>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isNil as e } from "es-toolkit/compat";
|
|
2
|
+
//#region src/Utils/linkAs.ts
|
|
3
|
+
var t = /* @__PURE__ */ new Set([
|
|
4
|
+
"ref",
|
|
5
|
+
"href",
|
|
6
|
+
"class",
|
|
7
|
+
"style",
|
|
8
|
+
"children",
|
|
9
|
+
"className"
|
|
10
|
+
]);
|
|
11
|
+
function n(n, r, i) {
|
|
12
|
+
if (e(n) || e(r) || i !== n) return;
|
|
13
|
+
let a = {}, o = r;
|
|
14
|
+
for (let e of Object.keys(o)) t.has(e) || (a[e] = o[e]);
|
|
15
|
+
return a;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { n as resolveLinkAsProps };
|
package/dist/augments.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { CheckboxClasses, CheckboxProps } from './Components/Checkbox';
|
|
|
10
10
|
import { ChipClasses, ChipProps } from './Components/Chip';
|
|
11
11
|
import { DividerClasses, DividerProps } from './Components/Divider';
|
|
12
12
|
import { EmptyStateClasses, EmptyStateProps } from './Components/EmptyState';
|
|
13
|
+
import { FileUploadClasses, FileUploadProps } from './Components/FileUpload';
|
|
13
14
|
import { IconProps } from './Components/Icon';
|
|
14
15
|
import { LabelClasses, LabelProps } from './Components/Label';
|
|
15
16
|
import { LinkClasses, LinkProps } from './Components/Link';
|
|
@@ -23,6 +24,7 @@ import { OtpFieldClasses, OtpFieldProps } from './Components/OtpField';
|
|
|
23
24
|
import { PasswordFieldClasses, PasswordFieldProps } from './Components/PasswordField';
|
|
24
25
|
import { ProgressClasses, ProgressProps } from './Components/Progress';
|
|
25
26
|
import { RadioClasses, RadioProps } from './Components/Radio';
|
|
27
|
+
import { RichTextEditorClasses, RichTextEditorProps } from './Components/RichTextEditor';
|
|
26
28
|
import { SelectClasses, SelectProps } from './Components/Select';
|
|
27
29
|
import { SidebarClasses, SidebarInsetClasses, SidebarProps, SidebarProviderClasses, SidebarProviderProps } from './Components/Sidebar';
|
|
28
30
|
import { SkeletonClasses, SkeletonProps } from './Components/Skeleton';
|
|
@@ -81,6 +83,10 @@ declare module "@bridge-ui/core/Config" {
|
|
|
81
83
|
classes: EmptyStateClasses;
|
|
82
84
|
defaultProps: Partial<Pick<EmptyStateProps, "size" | "align" | "titleAs" | "mediaDecorative">>;
|
|
83
85
|
}
|
|
86
|
+
interface FileUploadConfigOverrides {
|
|
87
|
+
classes: FileUploadClasses;
|
|
88
|
+
defaultProps: Partial<Pick<FileUploadProps, "size" | "color" | "rounded" | "variant" | "multiple">>;
|
|
89
|
+
}
|
|
84
90
|
interface IconConfigOverrides {
|
|
85
91
|
defaultProps: Partial<Pick<IconProps, "size">>;
|
|
86
92
|
}
|
|
@@ -130,6 +136,10 @@ declare module "@bridge-ui/core/Config" {
|
|
|
130
136
|
classes: RadioClasses;
|
|
131
137
|
defaultProps: Partial<Pick<RadioProps, "size" | "color" | "rounded" | "hideErrorMessage">>;
|
|
132
138
|
}
|
|
139
|
+
interface RichTextEditorConfigOverrides {
|
|
140
|
+
classes: RichTextEditorClasses;
|
|
141
|
+
defaultProps: Partial<Pick<RichTextEditorProps, "size" | "color" | "format" | "rounded" | "variant" | "showErrorIcon" | "hideErrorMessage" | "showDescriptionOnError">>;
|
|
142
|
+
}
|
|
133
143
|
interface SnackbarConfigOverrides {
|
|
134
144
|
classes: SnackbarClasses;
|
|
135
145
|
defaultProps: Partial<Pick<SnackbarProps, "color" | "padding" | "rounded" | "duration" | "position" | "teleportTo" | "transition" | "closeButton" | "progressbar">>;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { setDateAdapterForTests, useDateAdapter } from './Adapters/Date';
|
|
|
2
2
|
export { setI18nAdapterForTests, useI18nAdapter, useResolveMessage, } from './Adapters/I18n';
|
|
3
3
|
export { setIconAdapterForTests, useIconAdapter } from './Adapters/Icon';
|
|
4
4
|
export type { IconElement, IconSource, SemanticIconName, } from './Adapters/Icon';
|
|
5
|
+
export { setRichTextAdapterForTests, useRichTextAdapter, } from './Adapters/RichText';
|
|
5
6
|
export { ACCORDION_INJECTION_KEY, Accordion, useAccordion, } from './Components/Accordion';
|
|
6
7
|
export type { AccordionClasses, AccordionColorOverrides, AccordionContextValue, AccordionCustomProps, AccordionEmits, AccordionOwnProps, AccordionProps, AccordionSizeOverrides, AccordionSlots, AccordionTokenClasses, AccordionVariantOverrides, } from './Components/Accordion';
|
|
7
8
|
export { AccordionItem, useAccordionItem } from './Components/AccordionItem';
|
|
@@ -70,6 +71,8 @@ export { EmptyState, useEmptyState } from './Components/EmptyState';
|
|
|
70
71
|
export type { EmptyStateAlignOverrides, EmptyStateClasses, EmptyStateCustomProps, EmptyStateOwnProps, EmptyStateProps, EmptyStateSizeOverrides, EmptyStateSlots, } from './Components/EmptyState';
|
|
71
72
|
export { FieldOverlay, useFieldOverlay } from './Components/FieldOverlay';
|
|
72
73
|
export type { FieldOverlayCustomProps, FieldOverlayEmits, FieldOverlayOwnProps, FieldOverlayProps, FieldOverlaySlots, } from './Components/FieldOverlay';
|
|
74
|
+
export { FileUpload, useFileUpload } from './Components/FileUpload';
|
|
75
|
+
export type { FileUploadClasses, FileUploadColorOverrides, FileUploadCustomProps, FileUploadEmits, FileUploadItemSlotProps, FileUploadOwnProps, FileUploadProps, FileUploadRoundedOverrides, FileUploadSizeOverrides, FileUploadSlots, FileUploadVariantOverrides, } from './Components/FileUpload';
|
|
73
76
|
export { FormControl, useFormControl } from './Components/FormControl';
|
|
74
77
|
export type { FormControlClasses, FormControlCustomProps, FormControlOwnProps, FormControlProps, FormControlSizeOverrides, FormControlSlots, UseFormControlReturn, } from './Components/FormControl';
|
|
75
78
|
export { FormField, useFormField } from './Components/FormField';
|
|
@@ -104,6 +107,8 @@ export { Progress, useProgress } from './Components/Progress';
|
|
|
104
107
|
export type { ProgressClasses, ProgressColorOverrides, ProgressCustomProps, ProgressOwnProps, ProgressProps, ProgressRoundedOverrides, ProgressSizeOverrides, ProgressVariantOverrides, } from './Components/Progress';
|
|
105
108
|
export { Radio, useRadio } from './Components/Radio';
|
|
106
109
|
export type { RadioClasses, RadioColorOverrides, RadioCustomProps, RadioOwnProps, RadioProps, RadioRoundedOverrides, RadioSizeOverrides, RadioSlots, } from './Components/Radio';
|
|
110
|
+
export { RichTextEditor, useRichTextEditor } from './Components/RichTextEditor';
|
|
111
|
+
export type { RichTextEditorClasses, RichTextEditorColorOverrides, RichTextEditorCustomProps, RichTextEditorEmits, RichTextEditorOwnProps, RichTextEditorProps, RichTextEditorRoundedOverrides, RichTextEditorSizeOverrides, RichTextEditorSlots, RichTextEditorVariantOverrides, } from './Components/RichTextEditor';
|
|
107
112
|
export { Select, SelectOption } from './Components/Select';
|
|
108
113
|
export type { SelectAsyncData, SelectClasses, SelectEmits, SelectModel, SelectOptionData, SelectOptionProps, SelectProps, SelectSlots, SelectValue, } from './Components/Select';
|
|
109
114
|
export { Sidebar, SidebarInset, SidebarList, SidebarListItem, SidebarProvider, SidebarTrigger, useSidebar, useSidebarInset, useSidebarList, useSidebarListItem, useSidebarProvider, useSidebarShell, useSidebarTrigger, } from './Components/Sidebar';
|