@bridge-ui/vue 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/ai/AGENTS.md +31 -0
  2. package/ai/README.md +35 -0
  3. package/ai/guidelines/core.md +44 -0
  4. package/ai/llms.txt +38 -0
  5. package/ai/skills/bridge-ui-components/SKILL.md +37 -0
  6. package/ai/skills/bridge-ui-forms/SKILL.md +38 -0
  7. package/ai/skills/bridge-ui-overlays/SKILL.md +37 -0
  8. package/ai/skills/bridge-ui-setup/SKILL.md +38 -0
  9. package/bin/__tests__/ai.test.ts +319 -0
  10. package/bin/ai.mjs +469 -0
  11. package/dist/Adapters/I18n/useI18nAdapter.d.ts +1 -1
  12. package/dist/Adapters/Icon/useIconAdapter.d.ts +1 -1
  13. package/dist/Components/Autocomplete/Autocomplete.vue.d.ts +5 -5
  14. package/dist/Components/Autocomplete/composables/useAutocomplete.d.ts +3 -2
  15. package/dist/Components/Autocomplete/composables/useAutocomplete.js +6 -2
  16. package/dist/Components/Avatar/composables/useAvatar.d.ts +1 -1
  17. package/dist/Components/BaseField/BaseField.js +5 -0
  18. package/dist/Components/BaseField/BaseField.vue.d.ts +15 -0
  19. package/dist/Components/BaseField/BaseField.vue_vue_type_script_setup_true_lang.js +41 -0
  20. package/dist/Components/BaseField/BaseFieldLabel.js +5 -0
  21. package/dist/Components/{OtpField/OtpFieldLabel.vue.d.ts → BaseField/BaseFieldLabel.vue.d.ts} +2 -2
  22. package/dist/Components/{OtpField/OtpFieldLabel.vue_vue_type_script_setup_true_lang.js → BaseField/BaseFieldLabel.vue_vue_type_script_setup_true_lang.js} +2 -2
  23. package/dist/Components/BaseField/baseField.types.d.ts +222 -0
  24. package/dist/Components/BaseField/composables/useBaseField.d.ts +55 -0
  25. package/dist/Components/BaseField/composables/useBaseField.js +131 -0
  26. package/dist/Components/BaseField/index.d.ts +4 -0
  27. package/dist/Components/BaseField/index.js +3 -0
  28. package/dist/Components/Button/composables/useButton.d.ts +1 -1
  29. package/dist/Components/Checkbox/composables/useCheckbox.d.ts +1 -1
  30. package/dist/Components/Checkbox/composables/useCheckbox.js +1 -1
  31. package/dist/Components/Chip/Chip.vue.d.ts +1 -1
  32. package/dist/Components/Chip/composables/useChip.d.ts +1 -1
  33. package/dist/Components/Drawer/Drawer.vue.d.ts +2 -2
  34. package/dist/Components/Drawer/composables/useDrawer.d.ts +1 -1
  35. package/dist/Components/FormControl/composables/useFormControl.d.ts +11 -2
  36. package/dist/Components/FormControl/composables/useFormControl.js +57 -53
  37. package/dist/Components/FormControl/index.d.ts +1 -1
  38. package/dist/Components/FormField/composables/useFormField.d.ts +5 -1
  39. package/dist/Components/FormField/composables/useFormField.js +1 -1
  40. package/dist/Components/ListItem/ListItem.vue.d.ts +1 -1
  41. package/dist/Components/ListItem/composables/useListItem.d.ts +1 -1
  42. package/dist/Components/Listbox/Listbox.vue.d.ts +3 -3
  43. package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +2 -1
  44. package/dist/Components/Listbox/composables/useListbox.d.ts +10 -1
  45. package/dist/Components/Listbox/composables/useListbox.js +20 -20
  46. package/dist/Components/Listbox/index.d.ts +1 -0
  47. package/dist/Components/Listbox/listbox.types.d.ts +6 -0
  48. package/dist/Components/Menu/Menu.vue.d.ts +2 -2
  49. package/dist/Components/Modal/Modal.vue.d.ts +2 -2
  50. package/dist/Components/Modal/composables/useModal.d.ts +1 -1
  51. package/dist/Components/NumberField/NumberField.vue.d.ts +2 -2
  52. package/dist/Components/NumberField/composables/useNumberField.d.ts +2 -2
  53. package/dist/Components/NumberField/composables/useNumberField.js +4 -1
  54. package/dist/Components/OtpField/OtpField.vue.d.ts +3 -3
  55. package/dist/Components/OtpField/OtpField.vue_vue_type_script_setup_true_lang.js +34 -52
  56. package/dist/Components/OtpField/composables/useOtpField.d.ts +40 -213
  57. package/dist/Components/OtpField/composables/useOtpField.js +92 -150
  58. package/dist/Components/OtpField/otpField.types.d.ts +10 -180
  59. package/dist/Components/PasswordField/composables/usePasswordField.d.ts +2 -2
  60. package/dist/Components/PasswordField/composables/usePasswordField.js +4 -1
  61. package/dist/Components/Radio/composables/useRadio.d.ts +1 -1
  62. package/dist/Components/Radio/composables/useRadio.js +1 -1
  63. package/dist/Components/Select/Select.vue.d.ts +4 -4
  64. package/dist/Components/Select/composables/useSelect.d.ts +3 -2
  65. package/dist/Components/Select/composables/useSelect.js +6 -2
  66. package/dist/Components/Slider/Slider.js +5 -0
  67. package/dist/Components/Slider/Slider.vue.d.ts +25 -0
  68. package/dist/Components/Slider/Slider.vue_vue_type_script_setup_true_lang.js +113 -0
  69. package/dist/Components/Slider/composables/useSlider.d.ts +482 -0
  70. package/dist/Components/Slider/composables/useSlider.js +287 -0
  71. package/dist/Components/Slider/index.d.ts +4 -0
  72. package/dist/Components/Slider/index.js +3 -0
  73. package/dist/Components/Slider/slider.types.d.ts +169 -0
  74. package/dist/Components/Snackbar/Snackbar.vue.d.ts +2 -2
  75. package/dist/Components/Switch/composables/useSwitch.d.ts +1 -1
  76. package/dist/Components/Switch/composables/useSwitch.js +1 -1
  77. package/dist/Components/Tabs/Tabs.vue.d.ts +2 -2
  78. package/dist/Components/TextField/composables/useTextField.d.ts +2 -2
  79. package/dist/Components/TextField/composables/useTextField.js +1 -1
  80. package/dist/Components/Textarea/composables/useTextarea.d.ts +2 -2
  81. package/dist/Components/Textarea/composables/useTextarea.js +1 -0
  82. package/dist/Utils/index.d.ts +3 -3
  83. package/dist/Utils/index.js +5 -2
  84. package/dist/augments.d.ts +29 -17
  85. package/dist/index.d.ts +5 -1
  86. package/dist/index.js +59 -55
  87. package/docs/README.md +56 -0
  88. package/docs/components/Alert.md +96 -0
  89. package/docs/components/Autocomplete.md +198 -0
  90. package/docs/components/Avatar.md +60 -0
  91. package/docs/components/Badge.md +47 -0
  92. package/docs/components/BaseField.md +126 -0
  93. package/docs/components/BridgeUIProvider.md +151 -0
  94. package/docs/components/Button.md +93 -0
  95. package/docs/components/Card.md +287 -0
  96. package/docs/components/Checkbox.md +87 -0
  97. package/docs/components/Divider.md +56 -0
  98. package/docs/components/Drawer.md +137 -0
  99. package/docs/components/FormControl.md +66 -0
  100. package/docs/components/FormField.md +71 -0
  101. package/docs/components/I18n.md +125 -0
  102. package/docs/components/Icon.md +88 -0
  103. package/docs/components/Label.md +31 -0
  104. package/docs/components/Link.md +71 -0
  105. package/docs/components/List.md +167 -0
  106. package/docs/components/Menu.md +97 -0
  107. package/docs/components/Modal.md +154 -0
  108. package/docs/components/NumberField.md +80 -0
  109. package/docs/components/OtpField.md +133 -0
  110. package/docs/components/PasswordField.md +82 -0
  111. package/docs/components/Progress.md +68 -0
  112. package/docs/components/Radio.md +91 -0
  113. package/docs/components/Select.md +181 -0
  114. package/docs/components/Skeleton.md +38 -0
  115. package/docs/components/Slider.md +140 -0
  116. package/docs/components/Snackbar.md +99 -0
  117. package/docs/components/Spinner.md +61 -0
  118. package/docs/components/Switch.md +72 -0
  119. package/docs/components/Tabs.md +207 -0
  120. package/docs/components/TextField.md +72 -0
  121. package/docs/components/Textarea.md +80 -0
  122. package/docs/components/Tooltip.md +125 -0
  123. package/docs/components/useBreakpoint.md +100 -0
  124. package/docs/components/useDialogAction.md +97 -0
  125. package/docs/components/useDrawerAction.md +75 -0
  126. package/docs/components/useModalAction.md +75 -0
  127. package/docs/components/useSnackbarAction.md +85 -0
  128. package/docs/examples/i18n-dictionary.ts +48 -0
  129. package/docs/examples/i18n-vue-i18n.ts +34 -0
  130. package/docs/examples/icon-fontawesome.ts +112 -0
  131. package/docs/examples/icon-heroicons.ts +57 -0
  132. package/docs/examples/icon-lucide.ts +57 -0
  133. package/docs/examples/icon-phosphor.ts +57 -0
  134. package/docs/examples/icon-tabler.ts +57 -0
  135. package/package.json +12 -5
  136. package/dist/Components/OtpField/OtpFieldLabel.js +0 -5
@@ -0,0 +1,287 @@
1
+ import { useBridgeUI as e } from "../../../Provider/useBridgeUI.js";
2
+ import { mergePartBind as t, useBridgeUIComponent as n, useBridgeUIMergedRegistryClasses as r } from "../../../Utils/index.js";
3
+ import { baseFieldBridgeKeys as i, useBaseField as a } from "../../BaseField/composables/useBaseField.js";
4
+ import { computed as o, ref as s, toValue as ee, useAttrs as te, watch as ne } from "vue";
5
+ import { cn as c, getSliderBarGeometry as re, getSliderPointerClientX as l, isSliderStopCovered as ie, mergeBridgeUILayeredClasses as u, normalizeSliderStops as ae, percentFromSliderPointer as d, percentToValue as f, pickClosestSliderThumb as oe, resolveSliderBounds as se, snapSliderValue as p, sortSliderRangeValue as ce, splitComponentProps as le, stepSliderValue as m, valueToPercent as h, writeSliderRangeThumb as g } from "@bridge-ui/core";
6
+ import { get as _, omit as v, pick as y } from "es-toolkit/compat";
7
+ import { colorProps as ue, invalidatedProps as de, roundedProps as fe, sizeProps as b } from "@bridge-ui/core/Tokens/Slider";
8
+ //#region src/Components/Slider/composables/useSlider.ts
9
+ var x = [
10
+ "max",
11
+ "min",
12
+ "step",
13
+ "color",
14
+ "range",
15
+ "stops",
16
+ "rounded",
17
+ "showStops",
18
+ "showTooltip",
19
+ "defaultValue"
20
+ ], pe = [...i, ...x];
21
+ function S(e, t, n) {
22
+ return n && Array.isArray(e) ? e[t] : Array.isArray(e) ? e[0] : e;
23
+ }
24
+ function C(e, t, n, r) {
25
+ return !r || !Array.isArray(e) ? {
26
+ thumbIndex: t,
27
+ value: n
28
+ } : g(e, t, n);
29
+ }
30
+ function w(g, w, T, E = {}) {
31
+ let me = te(), he = e(), D = s(null), O = s(null), k = s(null), A = s(null), j = o(() => le({
32
+ bridgeKeys: pe,
33
+ props: {
34
+ ...me,
35
+ ...ee(g)
36
+ }
37
+ })), M = a(o(() => y(j.value.componentProps, i)), {
38
+ error: !1,
39
+ hideErrorMessage: !1,
40
+ size: w.size ?? "md"
41
+ }, {
42
+ componentName: "Slider",
43
+ labelHtmlFor: (e) => `${e}-thumb-0`
44
+ }), { merged: N, entry: P } = n({
45
+ libDefaults: w,
46
+ componentName: "Slider",
47
+ props: () => ({
48
+ ...y(j.value.componentProps, x),
49
+ size: M.merged.value.size,
50
+ classes: j.value.componentProps.classes,
51
+ customProps: j.value.componentProps.customProps
52
+ })
53
+ }), F = o(() => N.value.customProps), I = r({
54
+ entry: P,
55
+ props: () => j.value.componentProps
56
+ }), L = o(() => se({
57
+ min: N.value.min,
58
+ max: N.value.max,
59
+ step: N.value.step
60
+ })), R = o(() => !!N.value.range), z = o(() => N.value.showTooltip !== !1), B = o(() => he?.global.value.direction === "rtl"), { controlId: V, isDisabled: H, isReadonly: U, invalidated: W, ariaDescribedBy: ge } = M, G = o(() => {
61
+ let e = T.value, t = L.value;
62
+ if (R.value) {
63
+ if (Array.isArray(e)) return ce(p(e[0], t.min, t.max, t.step), p(e[1], t.min, t.max, t.step));
64
+ let n = p(typeof e == "number" ? e : t.min, t.min, t.max, t.step);
65
+ return [n, n];
66
+ }
67
+ return p(Array.isArray(e) ? e[0] : typeof e == "number" ? e : t.min, t.min, t.max, t.step);
68
+ }), K = o(() => ae({
69
+ min: L.value.min,
70
+ max: L.value.max,
71
+ step: L.value.step,
72
+ stops: N.value.stops,
73
+ showStops: N.value.showStops
74
+ })), q = o(() => re({
75
+ range: R.value,
76
+ min: L.value.min,
77
+ max: L.value.max,
78
+ value: G.value
79
+ })), _e = o(() => _(u(ue, P.value?.tokens?.color), N.value.color ?? "primary")), J = o(() => u(de, P.value?.tokens?.invalidated, N.value.customProps?.invalidated)), Y = o(() => W.value ? J.value : _e.value), X = o(() => _(u(b, P.value?.tokens?.size), N.value.size ?? "md")), Z = o(() => _(u(fe, P.value?.tokens?.rounded), N.value.rounded ?? "full")), ve = o(() => K.value.some((e) => !!e.label)), Q = (e) => {
80
+ T.value = e, E.onChange?.(e);
81
+ }, ye = (e) => {
82
+ D.value &&= { thumbIndex: e }, O.value !== null && (O.value = e);
83
+ }, be = (e, t) => {
84
+ if (H.value || U.value) return;
85
+ let n = L.value, r = f(t, n.min, n.max, n.step), i = C(G.value, e, r, R.value);
86
+ i.thumbIndex !== e && ye(i.thumbIndex), Q(i.value);
87
+ }, $ = (e, t) => {
88
+ H.value || U.value || (e.preventDefault(), D.value = { thumbIndex: t }, O.value = t);
89
+ }, xe = (e) => {
90
+ if (H.value || U.value || e.target.closest("[data-bridge-slider-thumb]")) return;
91
+ let t = A.value?.getBoundingClientRect();
92
+ if (!t) return;
93
+ let n = d({
94
+ rect: t,
95
+ isRtl: B.value,
96
+ clientX: l(e)
97
+ }), r = L.value, i = f(n, r.min, r.max, r.step), a = 0, o = G.value;
98
+ R.value && Array.isArray(o) && (a = oe(i, o[0], o[1]));
99
+ let s = C(o, a, i, R.value);
100
+ Q(s.value), $(e, s.thumbIndex);
101
+ }, Se = (e) => (t) => {
102
+ $(t, e);
103
+ }, Ce = (e) => (t) => {
104
+ if (H.value || U.value) return;
105
+ let n = L.value, r = S(G.value, e, R.value), i = null, a = B.value;
106
+ switch (t.key) {
107
+ case "ArrowRight":
108
+ i = m(r, a ? -1 : 1, n.min, n.max, n.step);
109
+ break;
110
+ case "ArrowLeft":
111
+ i = m(r, a ? 1 : -1, n.min, n.max, n.step);
112
+ break;
113
+ case "ArrowUp":
114
+ i = m(r, 1, n.min, n.max, n.step);
115
+ break;
116
+ case "ArrowDown":
117
+ i = m(r, -1, n.min, n.max, n.step);
118
+ break;
119
+ case "Home":
120
+ i = n.min;
121
+ break;
122
+ case "End":
123
+ i = n.max;
124
+ break;
125
+ case "PageUp":
126
+ i = m(r, 1, n.min, n.max, n.step * 10);
127
+ break;
128
+ case "PageDown":
129
+ i = m(r, -1, n.min, n.max, n.step * 10);
130
+ break;
131
+ default: break;
132
+ }
133
+ if (i === null) return;
134
+ t.preventDefault();
135
+ let o = C(G.value, e, i, R.value);
136
+ Q(o.value), o.thumbIndex !== e && document.getElementById(`${V.value}-thumb-${o.thumbIndex}`)?.focus();
137
+ };
138
+ ne(O, (e, t, n) => {
139
+ if (e === null) return;
140
+ let r = (e) => {
141
+ let t = A.value?.getBoundingClientRect();
142
+ if (!t || D.value === null) return;
143
+ let n = d({
144
+ rect: t,
145
+ isRtl: B.value,
146
+ clientX: l(e)
147
+ });
148
+ be(D.value.thumbIndex, n);
149
+ }, i = () => {
150
+ D.value = null, O.value = null;
151
+ };
152
+ window.addEventListener("pointermove", r), window.addEventListener("pointerup", i), window.addEventListener("pointercancel", i), n(() => {
153
+ window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i), window.removeEventListener("pointercancel", i);
154
+ });
155
+ });
156
+ let we = o(() => t({}, {}, c({
157
+ "relative w-full min-w-0 flex-1": !0,
158
+ "mb-6": ve.value
159
+ }))), Te = o(() => t({
160
+ ...v(F.value?.track ?? {}, ["style"]),
161
+ onPointerdown: xe
162
+ }, {}, c({
163
+ "relative w-full select-none touch-none": !0,
164
+ "cursor-pointer": !H.value && !U.value,
165
+ "cursor-not-allowed": H.value,
166
+ [X.value?.track ?? ""]: !0,
167
+ [Z.value ?? ""]: !0,
168
+ [Y.value?.track ?? ""]: !0,
169
+ [I.value.track ?? ""]: !0
170
+ })));
171
+ return {
172
+ bounds: L,
173
+ merged: N,
174
+ barBind: o(() => t(v(F.value?.bar ?? {}, ["style"]), {
175
+ "aria-hidden": !0,
176
+ style: {
177
+ width: q.value.width,
178
+ insetInlineStart: q.value.start
179
+ }
180
+ }, c({
181
+ "absolute top-0 h-full": !0,
182
+ [Z.value ?? ""]: !0,
183
+ [Y.value?.bar ?? ""]: !0,
184
+ [I.value.bar ?? ""]: !0
185
+ }))),
186
+ isRange: R,
187
+ trackRef: A,
188
+ baseField: M,
189
+ trackBind: Te,
190
+ controlBind: we,
191
+ showTooltip: z,
192
+ getStopBind: (e) => {
193
+ let n = h(e.value, L.value.min, L.value.max), r = ie({
194
+ range: R.value,
195
+ min: L.value.min,
196
+ max: L.value.max,
197
+ stopValue: e.value,
198
+ value: G.value
199
+ });
200
+ return t(v(F.value?.stop ?? {}, ["style"]), {
201
+ "aria-hidden": !0,
202
+ style: {
203
+ insetInlineStart: `${n}%`,
204
+ display: r ? "none" : void 0
205
+ }
206
+ }, c({
207
+ "absolute top-1/2 h-2 w-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-white dark:bg-gray-400": !0,
208
+ [I.value.stop ?? ""]: !0
209
+ }));
210
+ },
211
+ thumbIndexes: o(() => R.value ? [0, 1] : [0]),
212
+ getThumbBind: (e) => {
213
+ let n = S(G.value, e, R.value), r = h(n, L.value.min, L.value.max), i = O.value === e;
214
+ return t({
215
+ ...v(F.value?.thumb ?? {}, ["style"]),
216
+ role: "slider",
217
+ type: "button",
218
+ "aria-valuenow": n,
219
+ "aria-valuemin": L.value.min,
220
+ "aria-valuemax": L.value.max,
221
+ tabIndex: H.value ? -1 : 0,
222
+ "data-bridge-slider-thumb": e,
223
+ disabled: H.value || void 0,
224
+ "aria-orientation": "horizontal",
225
+ "aria-describedby": ge.value,
226
+ onKeydown: Ce(e),
227
+ id: `${V.value}-thumb-${e}`,
228
+ "aria-disabled": H.value || void 0,
229
+ "aria-readonly": U.value || void 0,
230
+ "aria-invalid": W.value || void 0,
231
+ onPointerdown: Se(e),
232
+ style: { insetInlineStart: `${r}%` },
233
+ onFocus: () => {
234
+ k.value = e;
235
+ },
236
+ onPointerenter: () => {
237
+ k.value = e;
238
+ },
239
+ onBlur: () => {
240
+ O.value !== e && (k.value = k.value === e ? null : k.value);
241
+ },
242
+ onPointerleave: () => {
243
+ O.value !== e && (k.value = k.value === e ? null : k.value);
244
+ },
245
+ "aria-label": F.value?.thumb?.["aria-label"] ?? (R.value ? e === 0 ? "Minimum" : "Maximum" : M.merged.value.label || "Slider")
246
+ }, {}, c({
247
+ "absolute z-10 flex -translate-x-1/2 items-center justify-center bg-transparent leading-none outline-none": !0,
248
+ "cursor-grab": !H.value && !U.value,
249
+ "cursor-grabbing": i,
250
+ "cursor-not-allowed": H.value,
251
+ "focus-visible:ring-2 focus-visible:ring-offset-2": !0,
252
+ [Y.value?.focus ?? ""]: !0,
253
+ [X.value?.thumb ?? ""]: !0,
254
+ [I.value.thumb ?? ""]: !0
255
+ }));
256
+ },
257
+ resolvedStops: K,
258
+ resolvedValue: G,
259
+ isTooltipOpen: (e) => z.value && (O.value === e || k.value === e),
260
+ getStopLabelBind: (e) => {
261
+ let n = h(e.value, L.value.min, L.value.max);
262
+ return t(v(F.value?.stopLabel ?? {}, ["style"]), {
263
+ "aria-hidden": !0,
264
+ style: { insetInlineStart: `${n}%` }
265
+ }, c({
266
+ "absolute mt-5 -translate-x-1/2 text-xs whitespace-nowrap": !0,
267
+ "text-gray-700 dark:text-gray-400": !W.value,
268
+ [J.value.stopLabel ?? ""]: W.value,
269
+ [I.value.stopLabel ?? ""]: !0
270
+ }));
271
+ },
272
+ getThumbKnobBind: (e) => {
273
+ let n = O.value === e;
274
+ return t(F.value?.thumbKnob, { "aria-hidden": !0 }, c({
275
+ "block rounded-full border-2 shadow-sm transition-transform duration-100": !0,
276
+ "scale-120": n,
277
+ [X.value?.thumbKnob ?? ""]: !0,
278
+ [Y.value?.thumb ?? ""]: !0,
279
+ [I.value.thumbKnob ?? ""]: !0
280
+ }));
281
+ },
282
+ tooltipProps: o(() => F.value?.tooltip),
283
+ readThumbValue: (e) => S(G.value, e, R.value)
284
+ };
285
+ }
286
+ //#endregion
287
+ export { w as useSlider };
@@ -0,0 +1,4 @@
1
+ export { useSlider } from './composables/useSlider';
2
+ export type { UseSliderOptions, UseSliderReturn, } from './composables/useSlider';
3
+ export type { SliderClasses, SliderColorOverrides, SliderCustomProps, SliderEmits, SliderOwnProps, SliderProps, SliderRangeValue, SliderRoundedOverrides, SliderSizeOverrides, SliderSlots, SliderStop, SliderStopInput, } from './slider.types';
4
+ export { default as Slider } from './Slider.vue';
@@ -0,0 +1,3 @@
1
+ import { useSlider as e } from "./composables/useSlider.js";
2
+ import t from "./Slider.js";
3
+ export { t as Slider, e as useSlider };
@@ -0,0 +1,169 @@
1
+ import { ButtonHTMLAttributes, HTMLAttributes, Slot } from 'vue';
2
+ import { BaseFieldInvalidated, MergeHtmlProps, MergeProps, SliderColor, SliderInvalidated, SliderRangeValue, SliderRounded, SliderStopInput } from '@bridge-ui/core';
3
+ import { BaseFieldClasses, BaseFieldCustomProps, BaseFieldOwnProps, BaseFieldSlots } from '../BaseField/baseField.types';
4
+ import { TooltipOwnProps } from '../Tooltip/tooltip.types';
5
+ export type { SliderRangeValue, SliderStop, SliderStopInput, } from '@bridge-ui/core';
6
+ export interface SliderSizeOverrides {}
7
+ export interface SliderColorOverrides {}
8
+ export interface SliderRoundedOverrides {}
9
+ export interface SliderClasses extends BaseFieldClasses {
10
+ /**
11
+ * Classes for the filled bar.
12
+ */
13
+ bar?: string;
14
+ /**
15
+ * Classes for stop markers.
16
+ */
17
+ stop?: string;
18
+ /**
19
+ * Classes for stop labels.
20
+ */
21
+ stopLabel?: string;
22
+ /**
23
+ * Classes for thumb hit-area wrappers.
24
+ */
25
+ thumb?: string;
26
+ /**
27
+ * Classes for the visible thumb knob.
28
+ */
29
+ thumbKnob?: string;
30
+ /**
31
+ * Classes for the track.
32
+ */
33
+ track?: string;
34
+ }
35
+ export interface SliderCustomProps extends Omit<BaseFieldCustomProps, "invalidated"> {
36
+ /**
37
+ * Props forwarded to the filled bar.
38
+ */
39
+ bar?: HTMLAttributes;
40
+ /**
41
+ * Control error chrome (`bar`, `thumb`, `track`, …). Error message color comes
42
+ * from {@link BaseField}; pass `errorMessage` here to override.
43
+ *
44
+ * @default undefined
45
+ */
46
+ invalidated?: Partial<SliderInvalidated & BaseFieldInvalidated>;
47
+ /**
48
+ * Props forwarded to stop markers.
49
+ */
50
+ stop?: HTMLAttributes;
51
+ /**
52
+ * Props forwarded to stop labels.
53
+ */
54
+ stopLabel?: HTMLAttributes;
55
+ /**
56
+ * Props forwarded to thumb hit-area buttons.
57
+ */
58
+ thumb?: Partial<ButtonHTMLAttributes>;
59
+ /**
60
+ * Props forwarded to the visible thumb knob.
61
+ */
62
+ thumbKnob?: HTMLAttributes;
63
+ /**
64
+ * Props forwarded to each value `Tooltip` (`content` is owned by the slider).
65
+ */
66
+ tooltip?: Partial<Omit<TooltipOwnProps, "slots" | "content" | "anchorEl" | "modelValue">>;
67
+ /**
68
+ * Props forwarded to the track element.
69
+ */
70
+ track?: HTMLAttributes;
71
+ }
72
+ export interface SliderEmits {
73
+ /**
74
+ * Emitted when the slider value changes.
75
+ * Listen with `@change` / `v-on:change`.
76
+ */
77
+ change: [value: number | SliderRangeValue];
78
+ /**
79
+ * Emitted when `v-model` should update.
80
+ */
81
+ "update:modelValue": [value: number | SliderRangeValue];
82
+ }
83
+ export interface SliderOwnProps extends Omit<BaseFieldOwnProps, "field" | "slots" | "classes" | "children" | "customProps"> {
84
+ /**
85
+ * Classes for the field chrome and the slider control.
86
+ *
87
+ * @default undefined
88
+ */
89
+ classes?: SliderClasses;
90
+ /**
91
+ * The color to apply to the slider bar and thumbs.
92
+ *
93
+ * @default "primary"
94
+ */
95
+ color?: MergeProps<SliderColor, SliderColorOverrides>;
96
+ /**
97
+ * Extra props for internal parts (`track`, `thumb`, `tooltip`, …).
98
+ *
99
+ * @default undefined
100
+ */
101
+ customProps?: SliderCustomProps;
102
+ /**
103
+ * Uncontrolled initial value. Use a tuple when `range` is enabled.
104
+ *
105
+ * @default min (or `[min, min]` when `range`)
106
+ */
107
+ defaultValue?: number | SliderRangeValue;
108
+ /**
109
+ * Maximum value of the slider.
110
+ *
111
+ * @default 100
112
+ */
113
+ max?: number;
114
+ /**
115
+ * Minimum value of the slider.
116
+ *
117
+ * @default 0
118
+ */
119
+ min?: number;
120
+ /**
121
+ * When `true`, the slider selects a range with two thumbs.
122
+ *
123
+ * @default false
124
+ */
125
+ range?: boolean;
126
+ /**
127
+ * The roundedness of the track and bar.
128
+ *
129
+ * @default "full"
130
+ */
131
+ rounded?: MergeProps<SliderRounded, SliderRoundedOverrides>;
132
+ /**
133
+ * When `true`, renders stop marks (from `stops`, or every `step` when
134
+ * `stops` is empty).
135
+ *
136
+ * @default false
137
+ */
138
+ showStops?: boolean;
139
+ /**
140
+ * When `true`, shows a Tooltip with the current value on each thumb.
141
+ *
142
+ * @default true
143
+ */
144
+ showTooltip?: boolean;
145
+ /**
146
+ * Step increment between values.
147
+ *
148
+ * @default 1
149
+ */
150
+ step?: number;
151
+ /**
152
+ * Custom stop marks. Numbers are treated as `{ value }`.
153
+ *
154
+ * @default undefined
155
+ */
156
+ stops?: readonly SliderStopInput[];
157
+ }
158
+ export interface SliderSlots extends BaseFieldSlots {
159
+ /**
160
+ * Optional custom thumb content (replaces the default knob).
161
+ */
162
+ thumb?: Slot;
163
+ }
164
+ export type SliderProps = MergeHtmlProps<SliderOwnProps, Omit<HTMLAttributes, "color" | "defaultValue">> & {
165
+ /**
166
+ * Bound with `v-model` on the component (`defineModel` internally).
167
+ */
168
+ modelValue?: number | SliderRangeValue;
169
+ };
@@ -6,13 +6,13 @@ type __VLS_ModelProps = {
6
6
  };
7
7
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
8
  declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
9
- "update:modelValue": (value: boolean) => any;
10
9
  close: () => any;
10
+ "update:modelValue": (value: boolean) => any;
11
11
  "show-change": (show: boolean) => any;
12
12
  "leave-complete": () => any;
13
13
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
14
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
15
14
  onClose?: (() => any) | undefined;
15
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
16
16
  "onShow-change"?: ((show: boolean) => any) | undefined;
17
17
  "onLeave-complete"?: (() => any) | undefined;
18
18
  }>, {
@@ -243,7 +243,7 @@ export declare function useSwitch(props: MaybeRefOrGetter<SwitchOwnProps>, libDe
243
243
  hideErrorMessage: NonNullable<boolean | undefined>;
244
244
  }>;
245
245
  rowBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
246
- rootBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, Partial<Omit<Omit<import('../../FormControl').FormControlOwnProps, "field">, "error" | "size" | "classes" | "customProps" | "disabled" | "required" | "controlId" | "description" | "endLabel" | "errorMessage" | "hideErrorMessage" | "readonly" | "startLabel">>>>;
246
+ rootBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, Partial<Omit<Omit<import('../../FormControl').FormControlOwnProps, "field">, "error" | "size" | "classes" | "customProps" | "disabled" | "required" | "description" | "errorMessage" | "controlId" | "hideErrorMessage" | "readonly" | "endLabel" | "startLabel">>>>;
247
247
  controlId: import('vue').ComputedRef<string>;
248
248
  isDisabled: import('vue').ComputedRef<boolean>;
249
249
  isReadonly: import('vue').ComputedRef<boolean>;
@@ -21,7 +21,7 @@ function _(_, v, y) {
21
21
  error: !1,
22
22
  hideErrorMessage: !1,
23
23
  size: v.size ?? "sm"
24
- }), S = i(() => l({
24
+ }, { componentName: "Switch" }), S = i(() => l({
25
25
  bridgeKeys: g,
26
26
  props: {
27
27
  ...b,
@@ -6,11 +6,11 @@ type __VLS_ModelProps = {
6
6
  };
7
7
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
8
  declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
9
- "update:modelValue": (...args: unknown[]) => any;
10
9
  change: (value: string) => any;
10
+ "update:modelValue": (...args: unknown[]) => any;
11
11
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
- "onUpdate:modelValue"?: ((...args: unknown[]) => any) | undefined;
13
12
  onChange?: ((value: string) => any) | undefined;
13
+ "onUpdate:modelValue"?: ((...args: unknown[]) => any) | undefined;
14
14
  }>, {
15
15
  keepMounted: boolean;
16
16
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -427,7 +427,7 @@ export declare function useTextField(props: TextFieldOwnProps): {
427
427
  onTransitionend?: ((payload: TransitionEvent) => void) | undefined;
428
428
  onTransitionrun?: ((payload: TransitionEvent) => void) | undefined;
429
429
  onTransitionstart?: ((payload: TransitionEvent) => void) | undefined;
430
- }, Partial<Omit<Omit<import('../../FormField').FormFieldOwnProps, "field">, "error" | "color" | "end" | "size" | "classes" | "customProps" | "rounded" | "variant" | "label" | "disabled" | "endIcon" | "startIcon" | "start" | "required" | "description" | "errorMessage" | "hideErrorMessage" | "readonly" | "errorIcon" | "showErrorIcon" | "corner">>>>;
430
+ }, Partial<Omit<Omit<import('../../FormField').FormFieldOwnProps, "field">, "error" | "color" | "end" | "size" | "classes" | "customProps" | "rounded" | "variant" | "label" | "disabled" | "required" | "corner" | "description" | "errorMessage" | "start" | "endIcon" | "errorIcon" | "hideErrorMessage" | "readonly" | "showErrorIcon" | "startIcon">>>>;
431
431
  isNotched: import('vue').ComputedRef<boolean>;
432
432
  isStacked: import('vue').ComputedRef<boolean>;
433
433
  startBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
@@ -675,5 +675,5 @@ export declare function useTextField(props: TextFieldOwnProps): {
675
675
  onTransitionend?: ((payload: TransitionEvent) => void) | undefined;
676
676
  onTransitionrun?: ((payload: TransitionEvent) => void) | undefined;
677
677
  onTransitionstart?: ((payload: TransitionEvent) => void) | undefined;
678
- }, Partial<Omit<Omit<import('../../FormField').FormFieldOwnProps, "field">, "error" | "color" | "end" | "size" | "classes" | "customProps" | "rounded" | "variant" | "label" | "disabled" | "endIcon" | "startIcon" | "start" | "required" | "description" | "errorMessage" | "hideErrorMessage" | "readonly" | "errorIcon" | "showErrorIcon" | "corner">>>>;
678
+ }, Partial<Omit<Omit<import('../../FormField').FormFieldOwnProps, "field">, "error" | "color" | "end" | "size" | "classes" | "customProps" | "rounded" | "variant" | "label" | "disabled" | "required" | "corner" | "description" | "errorMessage" | "start" | "endIcon" | "errorIcon" | "hideErrorMessage" | "readonly" | "showErrorIcon" | "startIcon">>>>;
679
679
  };
@@ -14,7 +14,7 @@ function n(n) {
14
14
  color: "primary",
15
15
  variant: "outline",
16
16
  showErrorIcon: !0
17
- });
17
+ }, { componentName: "TextField" });
18
18
  return {
19
19
  formField: i,
20
20
  inputBind: i.inputBind
@@ -428,7 +428,7 @@ export declare function useTextarea(props: TextareaOwnProps, textareaRef: Ref<nu
428
428
  onTransitionend?: ((payload: TransitionEvent) => void) | undefined;
429
429
  onTransitionrun?: ((payload: TransitionEvent) => void) | undefined;
430
430
  onTransitionstart?: ((payload: TransitionEvent) => void) | undefined;
431
- }, Partial<Omit<Omit<import('../../FormField').FormFieldOwnProps, "field">, "error" | "color" | "end" | "size" | "classes" | "customProps" | "rounded" | "variant" | "label" | "disabled" | "endIcon" | "startIcon" | "start" | "required" | "description" | "errorMessage" | "hideErrorMessage" | "readonly" | "errorIcon" | "showErrorIcon" | "corner">>>>;
431
+ }, Partial<Omit<Omit<import('../../FormField').FormFieldOwnProps, "field">, "error" | "color" | "end" | "size" | "classes" | "customProps" | "rounded" | "variant" | "label" | "disabled" | "required" | "corner" | "description" | "errorMessage" | "start" | "endIcon" | "errorIcon" | "hideErrorMessage" | "readonly" | "showErrorIcon" | "startIcon">>>>;
432
432
  isNotched: import('vue').ComputedRef<boolean>;
433
433
  isStacked: import('vue').ComputedRef<boolean>;
434
434
  startBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
@@ -677,7 +677,7 @@ export declare function useTextarea(props: TextareaOwnProps, textareaRef: Ref<nu
677
677
  onTransitionend?: ((payload: TransitionEvent) => void) | undefined;
678
678
  onTransitionrun?: ((payload: TransitionEvent) => void) | undefined;
679
679
  onTransitionstart?: ((payload: TransitionEvent) => void) | undefined;
680
- }, Partial<Omit<Omit<import('../../FormField').FormFieldOwnProps, "field">, "error" | "color" | "end" | "size" | "classes" | "customProps" | "rounded" | "variant" | "label" | "disabled" | "endIcon" | "startIcon" | "start" | "required" | "description" | "errorMessage" | "hideErrorMessage" | "readonly" | "errorIcon" | "showErrorIcon" | "corner">>>, {
680
+ }, Partial<Omit<Omit<import('../../FormField').FormFieldOwnProps, "field">, "error" | "color" | "end" | "size" | "classes" | "customProps" | "rounded" | "variant" | "label" | "disabled" | "required" | "corner" | "description" | "errorMessage" | "start" | "endIcon" | "errorIcon" | "hideErrorMessage" | "readonly" | "showErrorIcon" | "startIcon">>>, {
681
681
  rows?: string | number | undefined;
682
682
  onInput?: ((event: Event) => void) | undefined;
683
683
  }>>;
@@ -39,6 +39,7 @@ function h(h, g) {
39
39
  variant: "outline",
40
40
  showErrorIcon: !0
41
41
  }, {
42
+ componentName: "Textarea",
42
43
  control: () => "textarea",
43
44
  likeInput: () => S.value
44
45
  }), E = i(() => C.value ? "none" : b.value.resize ?? "none"), D = i(() => d(u(m, y.value?.tokens?.resize), E.value ?? "none")), O = i(() => _.onInput), k = (e) => {
@@ -4,7 +4,7 @@ import { FormFieldSize } from '@bridge-ui/core/Tokens/FormField';
4
4
  import { IconSize } from '@bridge-ui/core/Tokens/Icon';
5
5
  import { useBridgeUI } from '../Provider/useBridgeUI';
6
6
  type RegistryEntryFor<K extends keyof BridgeUIComponentsConfig> = NonNullable<BridgeUIComponentsConfig[K]>;
7
- export type UseBridgeUIComponentReturn<P extends object, K extends keyof BridgeUIComponentsConfig> = {
7
+ export type UseBridgeUIComponentReturn<P extends object, K extends keyof BridgeUIComponentsConfig = keyof BridgeUIComponentsConfig> = {
8
8
  bridge: ReturnType<typeof useBridgeUI>;
9
9
  components: ComputedRef<null | BridgeUIComponentsConfig>;
10
10
  entry: ComputedRef<undefined | RegistryEntryFor<K>>;
@@ -28,8 +28,8 @@ export declare const mergeNestedComponentProps: <P extends {
28
28
  /**
29
29
  * Registry entry + props merged with Bridge defaults for a named component.
30
30
  */
31
- export declare function useBridgeUIComponent<P extends object, K extends keyof BridgeUIComponentsConfig>({ props, libDefaults, componentName, }: {
32
- componentName: K;
31
+ export declare function useBridgeUIComponent<P extends object, K extends keyof BridgeUIComponentsConfig = keyof BridgeUIComponentsConfig>({ props, libDefaults, componentName, }: {
32
+ componentName?: K;
33
33
  libDefaults?: Partial<P>;
34
34
  props: MaybeRefOrGetter<Partial<P>>;
35
35
  }): UseBridgeUIComponentReturn<P, K>;
@@ -19,13 +19,16 @@ var y = p("class"), b = f(y);
19
19
  function x({ props: t, libDefaults: n, componentName: r }) {
20
20
  let i = e(), a = c(() => h(i) ? null : d(i.components));
21
21
  return {
22
- entry: c(() => m(a.value, r)),
22
+ entry: c(() => {
23
+ if (r) return m(a.value, r);
24
+ }),
23
25
  bridge: i,
24
26
  merged: c(() => _({
25
27
  libDefaults: n,
26
28
  componentName: r,
27
29
  props: u(t),
28
- components: a.value
30
+ components: a.value,
31
+ formDefaults: i?.global.value.formDefaults
29
32
  })),
30
33
  components: a
31
34
  };