@bridge-ui/vue 0.13.0 → 0.14.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.
Files changed (113) hide show
  1. package/ai/skills/bridge-ui-forms/SKILL.md +3 -3
  2. package/dist/Adapters/Examples/icon-fontawesome.js +22 -21
  3. package/dist/Adapters/Examples/icon-heroicons.js +13 -12
  4. package/dist/Adapters/Examples/icon-lucide.js +11 -10
  5. package/dist/Adapters/Examples/icon-phosphor.js +19 -18
  6. package/dist/Adapters/Examples/icon-tabler.js +10 -9
  7. package/dist/Adapters/Examples/rich-text-tiptap.js +34 -41
  8. package/dist/Components/BaseField/composables/useBaseField.d.ts +2 -2
  9. package/dist/Components/Calendar/Calendar.vue.d.ts +14 -6
  10. package/dist/Components/Calendar/Calendar.vue_vue_type_script_setup_true_lang.js +78 -74
  11. package/dist/Components/Calendar/calendar.types.d.ts +12 -7
  12. package/dist/Components/Calendar/composables/useCalendar.d.ts +5 -9
  13. package/dist/Components/Calendar/composables/useCalendar.js +144 -143
  14. package/dist/Components/CalendarDate/CalendarDate.vue.d.ts +14 -6
  15. package/dist/Components/CalendarDate/CalendarDate.vue_vue_type_script_setup_true_lang.js +20 -16
  16. package/dist/Components/CalendarDate/calendarDate.types.d.ts +13 -8
  17. package/dist/Components/CalendarDate/composables/useCalendarDate.d.ts +4 -8
  18. package/dist/Components/CalendarDate/composables/useCalendarDate.js +105 -105
  19. package/dist/Components/CalendarMonth/CalendarMonth.vue.d.ts +9 -2
  20. package/dist/Components/CalendarMonth/CalendarMonth.vue_vue_type_script_setup_true_lang.js +19 -12
  21. package/dist/Components/CalendarMonth/calendarMonth.types.d.ts +14 -8
  22. package/dist/Components/CalendarMonth/composables/useCalendarMonth.d.ts +4 -7
  23. package/dist/Components/CalendarMonth/composables/useCalendarMonth.js +92 -89
  24. package/dist/Components/CalendarRange/CalendarRange.vue.d.ts +14 -6
  25. package/dist/Components/CalendarRange/CalendarRange.vue_vue_type_script_setup_true_lang.js +109 -105
  26. package/dist/Components/CalendarRange/calendarRange.types.d.ts +12 -7
  27. package/dist/Components/CalendarRange/composables/useCalendarRange.d.ts +5 -9
  28. package/dist/Components/CalendarRange/composables/useCalendarRange.js +181 -154
  29. package/dist/Components/CalendarYear/CalendarYear.vue.d.ts +9 -2
  30. package/dist/Components/CalendarYear/CalendarYear.vue_vue_type_script_setup_true_lang.js +20 -13
  31. package/dist/Components/CalendarYear/calendarYear.types.d.ts +12 -6
  32. package/dist/Components/CalendarYear/composables/useCalendarYear.d.ts +4 -7
  33. package/dist/Components/CalendarYear/composables/useCalendarYear.js +91 -88
  34. package/dist/Components/Carousel/composables/useCarousel.js +117 -117
  35. package/dist/Components/ColorField/ColorField.vue_vue_type_script_setup_true_lang.js +2 -2
  36. package/dist/Components/ColorPicker/ColorPicker.vue.d.ts +9 -2
  37. package/dist/Components/ColorPicker/ColorPicker.vue_vue_type_script_setup_true_lang.js +48 -44
  38. package/dist/Components/ColorPicker/colorPicker.types.d.ts +12 -7
  39. package/dist/Components/ColorPicker/composables/useColorPicker.d.ts +3 -3
  40. package/dist/Components/ColorPicker/composables/useColorPicker.js +150 -150
  41. package/dist/Components/DateField/DateField.vue_vue_type_script_setup_true_lang.js +2 -2
  42. package/dist/Components/DatePicker/DatePicker.vue.d.ts +12 -4
  43. package/dist/Components/DatePicker/DatePicker.vue_vue_type_script_setup_true_lang.js +55 -51
  44. package/dist/Components/DatePicker/composables/useDatePicker.d.ts +3 -3
  45. package/dist/Components/DatePicker/composables/useDatePicker.js +52 -25
  46. package/dist/Components/DatePicker/datePicker.types.d.ts +12 -7
  47. package/dist/Components/DateRangeField/DateRangeField.vue_vue_type_script_setup_true_lang.js +2 -2
  48. package/dist/Components/DateRangePicker/DateRangePicker.vue.d.ts +12 -4
  49. package/dist/Components/DateRangePicker/DateRangePicker.vue_vue_type_script_setup_true_lang.js +54 -50
  50. package/dist/Components/DateRangePicker/composables/useDateRangePicker.d.ts +3 -3
  51. package/dist/Components/DateRangePicker/composables/useDateRangePicker.js +26 -26
  52. package/dist/Components/DateRangePicker/dateRangePicker.types.d.ts +12 -7
  53. package/dist/Components/DateTimeField/DateTimeField.vue_vue_type_script_setup_true_lang.js +2 -2
  54. package/dist/Components/DateTimePicker/DateTimePicker.vue.d.ts +9 -2
  55. package/dist/Components/DateTimePicker/DateTimePicker.vue_vue_type_script_setup_true_lang.js +82 -78
  56. package/dist/Components/DateTimePicker/composables/useDateTimePicker.d.ts +3 -3
  57. package/dist/Components/DateTimePicker/composables/useDateTimePicker.js +64 -63
  58. package/dist/Components/DateTimePicker/dateTimePicker.types.d.ts +12 -7
  59. package/dist/Components/DateTimeRangeField/DateTimeRangeField.vue_vue_type_script_setup_true_lang.js +2 -2
  60. package/dist/Components/DateTimeRangePicker/DateTimeRangePicker.vue.d.ts +12 -4
  61. package/dist/Components/DateTimeRangePicker/DateTimeRangePicker.vue_vue_type_script_setup_true_lang.js +110 -106
  62. package/dist/Components/DateTimeRangePicker/composables/useDateTimeRangePicker.d.ts +3 -3
  63. package/dist/Components/DateTimeRangePicker/composables/useDateTimeRangePicker.js +71 -70
  64. package/dist/Components/DateTimeRangePicker/dateTimeRangePicker.types.d.ts +12 -7
  65. package/dist/Components/FileUpload/FileUpload.vue_vue_type_script_setup_true_lang.js +1 -1
  66. package/dist/Components/FileUpload/fileUpload.types.d.ts +1 -1
  67. package/dist/Components/Rating/Rating.js +5 -0
  68. package/dist/Components/Rating/Rating.vue.d.ts +20 -0
  69. package/dist/Components/Rating/Rating.vue_vue_type_script_setup_true_lang.js +62 -0
  70. package/dist/Components/Rating/composables/useRating.d.ts +112 -0
  71. package/dist/Components/Rating/composables/useRating.js +190 -0
  72. package/dist/Components/Rating/index.d.ts +4 -0
  73. package/dist/Components/Rating/index.js +3 -0
  74. package/dist/Components/Rating/rating.types.d.ts +107 -0
  75. package/dist/Components/Sidebar/composables/useSidebar.js +1 -1
  76. package/dist/Components/Slider/composables/useSlider.d.ts +1 -1
  77. package/dist/Components/TimeField/TimeField.vue_vue_type_script_setup_true_lang.js +2 -2
  78. package/dist/Components/TimePanel/TimePanel.vue.d.ts +10 -2
  79. package/dist/Components/TimePanel/TimePanel.vue_vue_type_script_setup_true_lang.js +37 -34
  80. package/dist/Components/TimePanel/composables/useTimePanel.d.ts +5 -5
  81. package/dist/Components/TimePanel/composables/useTimePanel.js +108 -109
  82. package/dist/Components/TimePanel/timePanel.types.d.ts +10 -4
  83. package/dist/Components/TimePicker/TimePicker.vue.d.ts +10 -2
  84. package/dist/Components/TimePicker/TimePicker.vue_vue_type_script_setup_true_lang.js +46 -42
  85. package/dist/Components/TimePicker/composables/useTimePicker.d.ts +3 -3
  86. package/dist/Components/TimePicker/composables/useTimePicker.js +36 -36
  87. package/dist/Components/TimePicker/timePicker.types.d.ts +12 -7
  88. package/dist/Components/TimeRangeField/TimeRangeField.vue_vue_type_script_setup_true_lang.js +2 -2
  89. package/dist/Components/TimeRangePicker/TimeRangePicker.vue.d.ts +12 -4
  90. package/dist/Components/TimeRangePicker/TimeRangePicker.vue_vue_type_script_setup_true_lang.js +72 -68
  91. package/dist/Components/TimeRangePicker/composables/useTimeRangePicker.d.ts +4 -4
  92. package/dist/Components/TimeRangePicker/composables/useTimeRangePicker.js +87 -87
  93. package/dist/Components/TimeRangePicker/timeRangePicker.types.d.ts +12 -7
  94. package/dist/index.d.ts +2 -0
  95. package/dist/index.js +69 -67
  96. package/docs/README.md +1 -0
  97. package/docs/components/BaseField.md +3 -3
  98. package/docs/components/Calendar.md +0 -1
  99. package/docs/components/CalendarDate.md +0 -1
  100. package/docs/components/CalendarMonth.md +0 -1
  101. package/docs/components/CalendarRange.md +0 -1
  102. package/docs/components/CalendarYear.md +0 -1
  103. package/docs/components/ColorPicker.md +13 -14
  104. package/docs/components/DatePicker.md +0 -1
  105. package/docs/components/DateRangePicker.md +0 -1
  106. package/docs/components/DateTimePicker.md +0 -1
  107. package/docs/components/DateTimeRangePicker.md +0 -1
  108. package/docs/components/Rating.md +86 -0
  109. package/docs/components/RichTextEditor.md +3 -3
  110. package/docs/components/TimePanel.md +0 -1
  111. package/docs/components/TimePicker.md +0 -1
  112. package/docs/components/TimeRangePicker.md +0 -1
  113. package/package.json +2 -12
@@ -1,13 +1,13 @@
1
1
  import { useResolveMessage as e } from "../../../Adapters/I18n/useI18nAdapter.js";
2
2
  import { mergePartBind as t, useBridgeUIComponent as n, useBridgeUIMergedRegistryClasses as r } from "../../../Utils/index.js";
3
3
  import { CAROUSEL_INJECTION_KEY as i } from "../carouselInjectionKey.js";
4
- import { computed as a, onMounted as o, onScopeDispose as s, provide as c, ref as l, useAttrs as u, useId as ee, watch as d } from "vue";
5
- import { get as f, omit as p } from "es-toolkit/compat";
6
- import { canMoveCarousel as m, clampCarouselIndex as h, getAdjacentCarouselIndex as te, getCarouselMaxIndex as g, getCarouselSlideStyle as _, getCarouselTrackStyle as v, resolveCarouselAutoPlayInterval as y, resolveCarouselSwipeDirection as b, shouldPauseCarouselAutoPlay as ne } from "@bridge-ui/core/Domain";
7
- import { carouselSizeProps as re } from "@bridge-ui/core/Tokens";
8
- import { cn as x, mergeBridgeUILayeredClasses as ie, splitComponentProps as ae } from "@bridge-ui/core/Utils";
4
+ import { computed as a, onMounted as o, onScopeDispose as s, provide as c, ref as l, useAttrs as ee, useId as te, watch as u } from "vue";
5
+ import { get as d, isFunction as f, omit as p } from "es-toolkit/compat";
6
+ import { canMoveCarousel as m, clampCarouselIndex as h, getAdjacentCarouselIndex as g, getCarouselMaxIndex as _, getCarouselSlideStyle as v, getCarouselTrackStyle as y, resolveCarouselAutoPlayInterval as b, resolveCarouselSwipeDirection as ne, shouldPauseCarouselAutoPlay as re } from "@bridge-ui/core/Domain";
7
+ import { carouselSizeProps as ie } from "@bridge-ui/core/Tokens";
8
+ import { cn as x, mergeBridgeUILayeredClasses as ae, splitComponentProps as oe } from "@bridge-ui/core/Utils";
9
9
  //#region src/Components/Carousel/composables/useCarousel.ts
10
- var oe = [
10
+ var se = [
11
11
  "gap",
12
12
  "loop",
13
13
  "size",
@@ -18,33 +18,33 @@ var oe = [
18
18
  "orientation",
19
19
  "defaultIndex",
20
20
  "slidesPerView"
21
- ], S = [
21
+ ], ce = [
22
22
  "onBlur",
23
23
  "onFocus",
24
24
  "onKeydown",
25
25
  "onMouseenter",
26
26
  "onMouseleave"
27
- ], se = [
27
+ ], le = [
28
28
  "onPointerup",
29
29
  "onPointerdown",
30
30
  "onPointercancel"
31
31
  ];
32
- function ce(e) {
32
+ function S(e) {
33
33
  if (!(e instanceof HTMLElement)) return !1;
34
34
  if (e.isContentEditable) return !0;
35
35
  let t = e.tagName;
36
36
  return t === "INPUT" || t === "SELECT" || t === "TEXTAREA";
37
37
  }
38
38
  function C(e) {
39
- return typeof e == "function" ? e : void 0;
39
+ return f(e) ? e : void 0;
40
40
  }
41
41
  function w(w, T, E) {
42
- let D = e(), le = u(), ue = `bridge-carousel${ee()}`, O = l([]), k = l(w.defaultIndex ?? T.defaultIndex ?? 0), A = l(!1), j = l(!1), M = l(!1), N = l(""), P = l(null), F = l(null), I = a(() => ae({
42
+ let D = e(), ue = ee(), de = `bridge-carousel${te()}`, O = l([]), k = l(w.defaultIndex ?? T.defaultIndex ?? 0), A = l(!1), j = l(!1), M = l(!1), N = l(""), P = l(null), F = l(null), I = a(() => oe({
43
43
  props: {
44
- ...le,
44
+ ...ue,
45
45
  ...w
46
46
  },
47
- bridgeKeys: oe
47
+ bridgeKeys: se
48
48
  })), { merged: L, entry: R } = n({
49
49
  libDefaults: T,
50
50
  componentName: "Carousel",
@@ -52,25 +52,25 @@ function w(w, T, E) {
52
52
  }), z = a(() => {
53
53
  let e = E.value ?? k.value, t = O.value.length;
54
54
  if (t <= 0) return e;
55
- let n = g(t, L.value.slidesPerView);
55
+ let n = _(t, L.value.slidesPerView);
56
56
  return h(e, n + 1);
57
57
  }), B = r({
58
58
  entry: R,
59
59
  props: () => I.value.componentProps
60
- }), V = a(() => ie(re, R.value?.tokens?.size)), H = a(() => f(V.value, L.value.size)), U = a(() => f(H.value, "icon") ?? "sm");
61
- function W(e) {
60
+ }), V = a(() => ae(ie, R.value?.tokens?.size)), H = a(() => d(V.value, L.value.size)), U = a(() => d(H.value, "icon") ?? "sm");
61
+ function fe(e) {
62
62
  return O.value.includes(e) || (O.value = [...O.value, e]), () => {
63
63
  O.value = O.value.filter((t) => t !== e);
64
64
  };
65
65
  }
66
- function de(e) {
66
+ function pe(e) {
67
67
  return O.value.indexOf(e);
68
68
  }
69
- function G(e) {
70
- let t = O.value.length, n = t <= 0 ? null : g(t, L.value.slidesPerView), r = n == null ? e : h(e, n + 1);
69
+ function W(e) {
70
+ let t = O.value.length, n = t <= 0 ? null : _(t, L.value.slidesPerView), r = n == null ? e : h(e, n + 1);
71
71
  r !== z.value && (E.value === void 0 && (k.value = r), E.value = r);
72
72
  }
73
- function K(e) {
73
+ function G(e) {
74
74
  let t = O.value.length, n = {
75
75
  loop: L.value.loop === !0,
76
76
  count: t,
@@ -78,17 +78,17 @@ function w(w, T, E) {
78
78
  slidesPerView: L.value.slidesPerView,
79
79
  index: z.value
80
80
  };
81
- m(n) && G(te(n));
81
+ m(n) && W(g(n));
82
82
  }
83
- function q(e) {
84
- G(e);
83
+ function K(e) {
84
+ W(e);
85
85
  }
86
- d(() => ({
86
+ u(() => ({
87
87
  count: O.value.length,
88
88
  slidesPerView: L.value.slidesPerView
89
89
  }), ({ count: e }) => {
90
- e <= 0 || E.value !== void 0 || (k.value = h(k.value, g(e, L.value.slidesPerView) + 1));
91
- }), P.value = z.value, d(z, (e) => {
90
+ e <= 0 || E.value !== void 0 || (k.value = h(k.value, _(e, L.value.slidesPerView) + 1));
91
+ }), P.value = z.value, u(z, (e) => {
92
92
  if (e === P.value) return;
93
93
  P.value = e;
94
94
  let t = O.value.length;
@@ -97,7 +97,7 @@ function w(w, T, E) {
97
97
  index: e + 1
98
98
  }));
99
99
  }), o(() => {
100
- if (typeof window.matchMedia != "function") return;
100
+ if (!f(window.matchMedia)) return;
101
101
  let e = window.matchMedia("(prefers-reduced-motion: reduce)"), t = () => {
102
102
  M.value = e.matches;
103
103
  };
@@ -105,11 +105,11 @@ function w(w, T, E) {
105
105
  e.removeEventListener("change", t);
106
106
  });
107
107
  });
108
- let J;
109
- function Y() {
110
- J !== void 0 && (window.clearInterval(J), J = void 0);
108
+ let q;
109
+ function J() {
110
+ q !== void 0 && (window.clearInterval(q), q = void 0);
111
111
  }
112
- d(() => [
112
+ u(() => [
113
113
  A.value,
114
114
  j.value,
115
115
  L.value.loop,
@@ -117,46 +117,46 @@ function w(w, T, E) {
117
117
  M.value,
118
118
  O.value.length
119
119
  ], () => {
120
- Y();
121
- let e = y(L.value.autoPlay);
122
- e == null || ne({
120
+ J();
121
+ let e = b(L.value.autoPlay);
122
+ e == null || re({
123
123
  focused: j.value,
124
124
  hovered: A.value,
125
125
  reducedMotion: M.value
126
- }) || (J = window.setInterval(() => {
127
- K(1);
126
+ }) || (q = window.setInterval(() => {
127
+ G(1);
128
128
  }, e));
129
- }, { immediate: !0 }), s(Y);
130
- let X = a(() => {
129
+ }, { immediate: !0 }), s(J);
130
+ let Y = a(() => {
131
131
  let e = O.value.length;
132
- return e <= 0 ? 0 : g(e, L.value.slidesPerView) + 1;
133
- }), Z = a(() => X.value > 1), fe = a(() => L.value.indicators !== !1 && X.value > 1), Q = a(() => L.value.orientation === "vertical"), $ = a(() => !Q.value && I.value.inheritedAttrs.dir === "rtl"), pe = a(() => Q.value ? "ArrowUp" : $.value ? "ArrowRight" : "ArrowLeft"), me = a(() => Q.value ? "ArrowDown" : $.value ? "ArrowLeft" : "ArrowRight"), he = a(() => !m({
132
+ return e <= 0 ? 0 : _(e, L.value.slidesPerView) + 1;
133
+ }), X = a(() => Y.value > 1), me = a(() => L.value.indicators !== !1 && Y.value > 1), Z = a(() => L.value.orientation === "vertical"), Q = a(() => !Z.value && I.value.inheritedAttrs.dir === "rtl"), he = a(() => Z.value ? "ArrowUp" : Q.value ? "ArrowRight" : "ArrowLeft"), ge = a(() => Z.value ? "ArrowDown" : Q.value ? "ArrowLeft" : "ArrowRight"), _e = a(() => !m({
134
134
  direction: -1,
135
135
  index: z.value,
136
136
  count: O.value.length,
137
137
  loop: L.value.loop === !0,
138
138
  slidesPerView: L.value.slidesPerView
139
- })), ge = a(() => !m({
139
+ })), ve = a(() => !m({
140
140
  direction: 1,
141
141
  index: z.value,
142
142
  count: O.value.length,
143
143
  loop: L.value.loop === !0,
144
144
  slidesPerView: L.value.slidesPerView
145
- })), _e = a(() => Array.from({ length: X.value }, (e, t) => t)), ve = a(() => ({
146
- getIndex: de,
147
- registerSlide: W,
148
- id: ue,
145
+ })), ye = a(() => Array.from({ length: Y.value }, (e, t) => t)), be = a(() => ({
146
+ getIndex: pe,
147
+ registerSlide: fe,
148
+ id: de,
149
149
  sizeItem: H.value,
150
150
  activeIndex: z.value,
151
151
  slideCount: O.value.length,
152
152
  slidesPerView: L.value.slidesPerView,
153
153
  slidePartProps: L.value.customProps?.slide,
154
- slideClassName: f(B.value, "slide") ?? "",
155
- slideStyle: _(L.value.slidesPerView, L.value.gap, L.value.orientation)
154
+ slideClassName: d(B.value, "slide") ?? "",
155
+ slideStyle: v(L.value.slidesPerView, L.value.gap, L.value.orientation)
156
156
  }));
157
- c(i, ve);
158
- let ye = a(() => {
159
- let e = C(I.value.inheritedAttrs.onBlur), n = C(I.value.inheritedAttrs.onFocus), r = C(I.value.inheritedAttrs.onKeydown), i = C(I.value.inheritedAttrs.onMouseenter), a = C(I.value.inheritedAttrs.onMouseleave), o = p(I.value.inheritedAttrs, [...S]);
157
+ c(i, be);
158
+ let xe = a(() => {
159
+ let e = C(I.value.inheritedAttrs.onBlur), n = C(I.value.inheritedAttrs.onFocus), r = C(I.value.inheritedAttrs.onKeydown), i = C(I.value.inheritedAttrs.onMouseenter), a = C(I.value.inheritedAttrs.onMouseleave), o = p(I.value.inheritedAttrs, [...ce]);
160
160
  return t(L.value.customProps?.root, o, {
161
161
  role: "region",
162
162
  "aria-roledescription": "carousel",
@@ -172,28 +172,28 @@ function w(w, T, E) {
172
172
  },
173
173
  "aria-label": I.value.inheritedAttrs["aria-label"] ?? D("Carousel"),
174
174
  class: x({
175
- [f(H.value, "root") ?? ""]: !0,
176
- [f(B.value, "root") ?? ""]: !0
175
+ [d(H.value, "root") ?? ""]: !0,
176
+ [d(B.value, "root") ?? ""]: !0
177
177
  }),
178
178
  onBlur: (t) => {
179
179
  let n = t.relatedTarget, r = t.currentTarget;
180
180
  (!(n instanceof Node) || !(r instanceof Node) || !r.contains(n)) && (j.value = !1), e?.(t);
181
181
  },
182
182
  onKeydown: (e) => {
183
- ce(e.target) || (e.key === me.value ? (e.preventDefault(), K(1)) : e.key === pe.value ? (e.preventDefault(), K(-1)) : e.key === "Home" ? (e.preventDefault(), q(0)) : e.key === "End" && (e.preventDefault(), q(g(O.value.length, L.value.slidesPerView)))), r?.(e);
183
+ S(e.target) || (e.key === ge.value ? (e.preventDefault(), G(1)) : e.key === he.value ? (e.preventDefault(), G(-1)) : e.key === "Home" ? (e.preventDefault(), K(0)) : e.key === "End" && (e.preventDefault(), K(_(O.value.length, L.value.slidesPerView)))), r?.(e);
184
184
  }
185
185
  });
186
- }), be = a(() => {
186
+ }), Se = a(() => {
187
187
  let e = L.value.customProps?.viewport, n = C(e?.onPointerup), r = C(e?.onPointerdown), i = C(e?.onPointercancel);
188
- return t(p(e, [...se]), {}, {
188
+ return t(p(e, [...le]), {}, {
189
189
  "data-part": "viewport",
190
190
  onPointercancel: (e) => {
191
191
  F.value = null, i?.(e);
192
192
  },
193
193
  class: x({
194
- [f(H.value, "viewport") ?? ""]: !0,
195
- [f(B.value, "viewport") ?? ""]: !0,
196
- [f(H.value, "viewportVertical") ?? ""]: Q.value
194
+ [d(H.value, "viewport") ?? ""]: !0,
195
+ [d(B.value, "viewport") ?? ""]: !0,
196
+ [d(H.value, "viewportVertical") ?? ""]: Z.value
197
197
  }),
198
198
  onPointerdown: (e) => {
199
199
  (e.pointerType !== "mouse" || e.button === 0) && (F.value = {
@@ -205,126 +205,126 @@ function w(w, T, E) {
205
205
  onPointerup: (e) => {
206
206
  let t = F.value;
207
207
  if (F.value = null, t && t.pointerId === e.pointerId) {
208
- let n = b(e.clientX - t.x, e.clientY - t.y, {
209
- rtl: $.value,
208
+ let n = ne(e.clientX - t.x, e.clientY - t.y, {
209
+ rtl: Q.value,
210
210
  orientation: L.value.orientation
211
211
  });
212
- n && K(n);
212
+ n && G(n);
213
213
  }
214
214
  n?.(e);
215
215
  }
216
216
  });
217
- }), xe = a(() => t(L.value.customProps?.track, {}, {
217
+ }), $ = a(() => t(L.value.customProps?.track, {}, {
218
218
  "data-part": "track",
219
219
  class: x({
220
- [f(H.value, "track") ?? ""]: !0,
221
- [f(B.value, "track") ?? ""]: !0,
222
- [f(H.value, "trackVertical") ?? ""]: Q.value
220
+ [d(H.value, "track") ?? ""]: !0,
221
+ [d(B.value, "track") ?? ""]: !0,
222
+ [d(H.value, "trackVertical") ?? ""]: Z.value
223
223
  }),
224
- style: v(z.value, {
225
- rtl: $.value,
224
+ style: y(z.value, {
225
+ rtl: Q.value,
226
226
  gap: L.value.gap,
227
227
  count: O.value.length,
228
228
  orientation: L.value.orientation,
229
229
  slidesPerView: L.value.slidesPerView
230
230
  })
231
- })), Se = a(() => t(L.value.customProps?.controls, {}, {
231
+ })), Ce = a(() => t(L.value.customProps?.controls, {}, {
232
232
  "data-part": "controls",
233
233
  class: x({
234
- [f(H.value, "controls") ?? ""]: !0,
235
- [f(B.value, "controls") ?? ""]: !0,
236
- [f(H.value, "controlsVertical") ?? ""]: Q.value
234
+ [d(H.value, "controls") ?? ""]: !0,
235
+ [d(B.value, "controls") ?? ""]: !0,
236
+ [d(H.value, "controlsVertical") ?? ""]: Z.value
237
237
  })
238
- })), Ce = a(() => Z.value ? Q.value ? f(H.value, "frameVertical") ?? "relative" : f(H.value, "frame") ?? "relative" : "relative"), we = a(() => t(L.value.customProps?.prev, {}, {
238
+ })), we = a(() => X.value ? Z.value ? d(H.value, "frameVertical") ?? "relative" : d(H.value, "frame") ?? "relative" : "relative"), Te = a(() => t(L.value.customProps?.prev, {}, {
239
239
  "data-part": "prev",
240
240
  type: "button",
241
- disabled: he.value,
241
+ disabled: _e.value,
242
242
  onClick: () => {
243
- K(-1);
243
+ G(-1);
244
244
  },
245
245
  "aria-label": D("Previous slide"),
246
246
  class: x({
247
- [f(H.value, "control") ?? ""]: !0,
248
- [f(B.value, "prev") ?? ""]: !0,
249
- [f(B.value, "control") ?? ""]: !0
247
+ [d(H.value, "control") ?? ""]: !0,
248
+ [d(B.value, "prev") ?? ""]: !0,
249
+ [d(B.value, "control") ?? ""]: !0
250
250
  })
251
- })), Te = a(() => t(L.value.customProps?.next, {}, {
251
+ })), Ee = a(() => t(L.value.customProps?.next, {}, {
252
252
  "data-part": "next",
253
253
  type: "button",
254
- disabled: ge.value,
254
+ disabled: ve.value,
255
255
  "aria-label": D("Next slide"),
256
256
  onClick: () => {
257
- K(1);
257
+ G(1);
258
258
  },
259
259
  class: x({
260
- [f(H.value, "control") ?? ""]: !0,
261
- [f(B.value, "next") ?? ""]: !0,
262
- [f(B.value, "control") ?? ""]: !0
260
+ [d(H.value, "control") ?? ""]: !0,
261
+ [d(B.value, "next") ?? ""]: !0,
262
+ [d(B.value, "control") ?? ""]: !0
263
263
  })
264
- })), Ee = a(() => t(L.value.customProps?.prevIcon, {}, {
264
+ })), De = a(() => t(L.value.customProps?.prevIcon, {}, {
265
265
  "aria-hidden": !0,
266
266
  size: U.value,
267
- class: Q.value ? void 0 : "rtl:rotate-180"
268
- })), De = a(() => t(L.value.customProps?.nextIcon, {}, {
267
+ class: Z.value ? void 0 : "rtl:rotate-180"
268
+ })), Oe = a(() => t(L.value.customProps?.nextIcon, {}, {
269
269
  "aria-hidden": !0,
270
270
  size: U.value,
271
- class: Q.value ? void 0 : "rtl:rotate-180"
272
- })), Oe = a(() => t(L.value.customProps?.indicators, {}, {
271
+ class: Z.value ? void 0 : "rtl:rotate-180"
272
+ })), ke = a(() => t(L.value.customProps?.indicators, {}, {
273
273
  role: "group",
274
274
  "data-part": "indicators",
275
275
  "aria-label": D("Slides"),
276
276
  class: x({
277
- [f(H.value, "indicators") ?? ""]: !0,
278
- [f(B.value, "indicators") ?? ""]: !0
277
+ [d(H.value, "indicators") ?? ""]: !0,
278
+ [d(B.value, "indicators") ?? ""]: !0
279
279
  })
280
- })), ke = a(() => t(L.value.customProps?.live, {}, {
280
+ })), Ae = a(() => t(L.value.customProps?.live, {}, {
281
281
  "aria-atomic": !0,
282
282
  "data-part": "live",
283
283
  "aria-live": "polite",
284
284
  class: x({
285
- [f(H.value, "live") ?? ""]: !0,
286
- [f(B.value, "live") ?? ""]: !0
285
+ [d(H.value, "live") ?? ""]: !0,
286
+ [d(B.value, "live") ?? ""]: !0
287
287
  })
288
288
  }));
289
- function Ae(e) {
289
+ function je(e) {
290
290
  let n = e === z.value;
291
291
  return t(L.value.customProps?.indicator, {}, {
292
292
  type: "button",
293
293
  "data-part": "indicator",
294
294
  "aria-current": n ? "true" : void 0,
295
295
  onClick: () => {
296
- q(e);
296
+ K(e);
297
297
  },
298
298
  "aria-label": D("Go to slide {{index}}", { index: e + 1 }),
299
299
  class: x({
300
- [f(H.value, "indicator") ?? ""]: !0,
301
- [f(H.value, "indicatorSelected") ?? ""]: n,
302
- [f(B.value, "indicator") ?? ""]: !0
300
+ [d(H.value, "indicator") ?? ""]: !0,
301
+ [d(H.value, "indicatorSelected") ?? ""]: n,
302
+ [d(B.value, "indicator") ?? ""]: !0
303
303
  })
304
304
  });
305
305
  }
306
- let je = a(() => Q.value ? "chevronUp" : "chevronLeft");
306
+ let Me = a(() => Z.value ? "chevronUp" : "chevronLeft");
307
307
  return {
308
- go: K,
309
- liveBind: ke,
310
- nextBind: Te,
311
- nextIcon: a(() => Q.value ? "chevronDown" : "chevronRight"),
312
- prevBind: we,
313
- prevIcon: je,
314
- rootBind: ye,
315
- trackBind: xe,
308
+ go: G,
309
+ liveBind: Ae,
310
+ nextBind: Ee,
311
+ nextIcon: a(() => Z.value ? "chevronDown" : "chevronRight"),
312
+ prevBind: Te,
313
+ prevIcon: Me,
314
+ rootBind: xe,
315
+ trackBind: $,
316
316
  activeIndex: z,
317
- controlsBind: Se,
318
- nextIconBind: De,
319
- prevIconBind: Ee,
320
- showControls: Z,
321
- viewportBind: be,
317
+ controlsBind: Ce,
318
+ nextIconBind: Oe,
319
+ prevIconBind: De,
320
+ showControls: X,
321
+ viewportBind: Se,
322
322
  announcement: N,
323
- frameClassName: Ce,
324
- indicatorsBind: Oe,
325
- showIndicators: fe,
326
- getIndicatorBind: Ae,
327
- indicatorIndexes: _e
323
+ frameClassName: we,
324
+ indicatorsBind: ke,
325
+ showIndicators: me,
326
+ getIndicatorBind: je,
327
+ indicatorIndexes: ye
328
328
  };
329
329
  }
330
330
  //#endregion
@@ -102,9 +102,9 @@ var A = { class: "flex min-w-0 flex-1 items-center gap-2" }, j = ["aria-label"],
102
102
  default: D(() => [m(T(c), {
103
103
  fill: T(z),
104
104
  format: T(B),
105
- value: T(q),
106
105
  class: y(T(X)),
107
106
  alpha: T(V).alpha,
107
+ "model-value": T(q),
108
108
  "show-footer": T(J),
109
109
  "read-only": F.readonly,
110
110
  swatches: T(V).swatches,
@@ -120,9 +120,9 @@ var A = { class: "flex min-w-0 flex-1 items-center gap-2" }, j = ["aria-label"],
120
120
  } : void 0]), 1032, [
121
121
  "fill",
122
122
  "format",
123
- "value",
124
123
  "class",
125
124
  "alpha",
125
+ "model-value",
126
126
  "show-footer",
127
127
  "read-only",
128
128
  "swatches",
@@ -1,13 +1,20 @@
1
1
  import { ColorPickerOwnProps, ColorPickerSlots } from './colorPicker.types';
2
2
  type __VLS_Slots = ColorPickerSlots;
3
- declare const __VLS_base: import('vue').DefineComponent<ColorPickerOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
3
+ type __VLS_Props = ColorPickerOwnProps;
4
+ type __VLS_ModelProps = {
5
+ modelValue?: null | string;
6
+ };
7
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
4
9
  apply: () => any;
5
10
  cancel: () => any;
6
11
  change: (value: string | null) => any;
7
- }, string, import('vue').PublicProps, Readonly<ColorPickerOwnProps> & Readonly<{
12
+ "update:modelValue": (...args: unknown[]) => any;
13
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
8
14
  onApply?: (() => any) | undefined;
9
15
  onCancel?: (() => any) | undefined;
10
16
  onChange?: ((value: string | null) => any) | undefined;
17
+ "onUpdate:modelValue"?: ((...args: unknown[]) => any) | undefined;
11
18
  }>, {
12
19
  showFooter: boolean;
13
20
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -1,17 +1,18 @@
1
- import e from "../ActionFooter/ActionFooter.js";
2
- import { useColorPicker as t } from "./composables/useColorPicker.js";
3
- import { Fragment as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, guardReactiveProps as c, mergeProps as l, normalizeClass as u, normalizeProps as d, normalizeStyle as f, openBlock as p, renderList as m, renderSlot as h, toDisplayString as g, unref as _ } from "vue";
4
- import { cn as v } from "@bridge-ui/core/Utils";
1
+ import { useOptionalModel as e } from "../../Utils/useOptionalModel.js";
2
+ import t from "../ActionFooter/ActionFooter.js";
3
+ import { useColorPicker as n } from "./composables/useColorPicker.js";
4
+ import { Fragment as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, guardReactiveProps as l, mergeModels as u, mergeProps as d, normalizeClass as f, normalizeProps as p, normalizeStyle as m, openBlock as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, unref as b, useModel as x } from "vue";
5
+ import { cn as S } from "@bridge-ui/core/Utils";
5
6
  //#region src/Components/ColorPicker/ColorPicker.vue?vue&type=script&setup=true&lang.ts
6
- var y = { class: "min-w-0 truncate text-sm text-dark-700 dark:text-dark-100" }, b = [
7
+ var C = { class: "min-w-0 truncate text-sm text-dark-700 dark:text-dark-100" }, w = [
7
8
  "aria-label",
8
9
  "onClick",
9
10
  "aria-pressed",
10
11
  "disabled"
11
- ], x = /*@__PURE__*/ s({
12
+ ], T = /*@__PURE__*/ c({
12
13
  inheritAttrs: !1,
13
14
  __name: "ColorPicker",
14
- props: {
15
+ props: /*@__PURE__*/ u({
15
16
  alpha: { type: Boolean },
16
17
  classes: {},
17
18
  customProps: {},
@@ -25,68 +26,71 @@ var y = { class: "min-w-0 truncate text-sm text-dark-700 dark:text-dark-100" },
25
26
  type: Boolean,
26
27
  default: void 0
27
28
  },
28
- swatches: {},
29
- value: {}
30
- },
31
- emits: [
29
+ swatches: {}
30
+ }, {
31
+ modelValue: {},
32
+ modelModifiers: {}
33
+ }),
34
+ emits: /*@__PURE__*/ u([
32
35
  "apply",
33
36
  "cancel",
34
- "change"
35
- ],
36
- setup(s, { emit: x }) {
37
- let { merged: S, hueBind: C, rootBind: w, areaBind: T, alphaBind: E, showAlpha: D, swatchCss: O, footerBind: k, showFooter: A, previewBind: j, contentBind: M, handleApply: N, swatchesBind: P, handleCancel: F, hueThumbBind: I, areaThumbBind: L, alphaFillBind: R, formattedValue: z, alphaThumbBind: B, presetSwatches: V, applyButtonProps: H, isSwatchSelected: U, previewSwatchBind: W, handleSwatchClick: G, swatchButtonClass: K, cancelButtonProps: q, swatchSelectedClass: J, previewSwatchFillBind: Y } = t(s, {
37
+ "change",
38
+ "update:modelValue"
39
+ ], ["update:modelValue"]),
40
+ setup(c, { emit: u }) {
41
+ let T = x(c, "modelValue"), E = u, D = c, O = g(D.defaultValue ?? null), k = e(T, O), { merged: A, hueBind: j, rootBind: M, areaBind: N, alphaBind: P, showAlpha: F, swatchCss: I, footerBind: ee, showFooter: L, previewBind: R, contentBind: z, handleApply: B, swatchesBind: V, handleCancel: H, hueThumbBind: U, areaThumbBind: W, alphaFillBind: G, formattedValue: K, alphaThumbBind: q, presetSwatches: J, applyButtonProps: Y, isSwatchSelected: X, previewSwatchBind: Z, handleSwatchClick: Q, swatchButtonClass: $, cancelButtonProps: te, swatchSelectedClass: ne, previewSwatchFillBind: re } = n(D, {
38
42
  rounded: "md",
39
43
  format: "hex"
40
- }, x);
41
- return (t, s) => (p(), i("div", d(c(_(w))), [a("div", { class: u(_(M)) }, [
42
- a("div", d(c(_(T))), [
43
- s[0] ||= a("span", {
44
+ }, k, E);
45
+ return (e, n) => (h(), a("div", p(l(b(M))), [o("div", { class: f(b(z)) }, [
46
+ o("div", p(l(b(N))), [
47
+ n[0] ||= o("span", {
44
48
  "aria-hidden": "",
45
49
  class: "pointer-events-none absolute inset-0",
46
50
  style: { backgroundImage: "linear-gradient(to right, #fff, transparent)" }
47
51
  }, null, -1),
48
- s[1] ||= a("span", {
52
+ n[1] ||= o("span", {
49
53
  "aria-hidden": "",
50
54
  class: "pointer-events-none absolute inset-0",
51
55
  style: { backgroundImage: "linear-gradient(to top, #000, transparent)" }
52
56
  }, null, -1),
53
- a("span", d(c(_(L))), null, 16)
57
+ o("span", p(l(b(W))), null, 16)
54
58
  ], 16),
55
- a("div", d(c(_(C))), [a("span", d(c(_(I))), null, 16)], 16),
56
- _(D) ? (p(), i("div", d(l({ key: 0 }, _(E))), [a("span", d(c(_(R))), null, 16), a("span", d(c(_(B))), null, 16)], 16)) : r("", !0),
57
- a("div", d(c(_(j))), [a("span", d(c(_(W))), [a("span", d(c(_(Y))), null, 16)], 16), a("span", y, g(_(z)), 1)], 16),
58
- _(V).length > 0 ? (p(), i("div", d(l({ key: 1 }, _(P))), [(p(!0), i(n, null, m(_(V), (e) => (p(), i("button", {
59
+ o("div", p(l(b(j))), [o("span", p(l(b(U))), null, 16)], 16),
60
+ b(F) ? (h(), a("div", p(d({ key: 0 }, b(P))), [o("span", p(l(b(G))), null, 16), o("span", p(l(b(q))), null, 16)], 16)) : i("", !0),
61
+ o("div", p(l(b(R))), [o("span", p(l(b(Z))), [o("span", p(l(b(re))), null, 16)], 16), o("span", C, y(b(K)), 1)], 16),
62
+ b(J).length > 0 ? (h(), a("div", p(d({ key: 1 }, b(V))), [(h(!0), a(r, null, _(b(J), (e) => (h(), a("button", {
59
63
  type: "button",
60
64
  key: e,
61
65
  "aria-label": e,
62
- onClick: (t) => _(G)(e),
63
- "aria-pressed": _(U)(e),
64
- disabled: _(S).disabled || _(S).readOnly,
65
- class: u(_(v)({
66
- [_(K)]: !0,
67
- [_(J)]: _(U)(e)
66
+ onClick: (t) => b(Q)(e),
67
+ "aria-pressed": b(X)(e),
68
+ disabled: b(A).disabled || b(A).readOnly,
69
+ class: f(b(S)({
70
+ [b($)]: !0,
71
+ [b(ne)]: b(X)(e)
68
72
  }))
69
- }, [a("span", {
73
+ }, [o("span", {
70
74
  "aria-hidden": "",
71
75
  class: "absolute inset-0",
72
- style: f({ backgroundColor: _(O)(e) })
73
- }, null, 4)], 10, b))), 128))], 16)) : r("", !0)
74
- ], 2), _(A) ? (p(), i("div", d(l({ key: 0 }, _(k))), [h(t.$slots, "footer", {
75
- apply: _(N),
76
- cancel: _(F)
77
- }, () => [o(_(e), {
78
- onApply: _(N),
79
- onCancel: _(F),
76
+ style: m({ backgroundColor: b(I)(e) })
77
+ }, null, 4)], 10, w))), 128))], 16)) : i("", !0)
78
+ ], 2), b(L) ? (h(), a("div", p(d({ key: 0 }, b(ee))), [v(e.$slots, "footer", {
79
+ apply: b(B),
80
+ cancel: b(H)
81
+ }, () => [s(b(t), {
82
+ onApply: b(B),
83
+ onCancel: b(H),
80
84
  "custom-props": {
81
- applyButton: _(H),
82
- cancelButton: _(q)
85
+ applyButton: b(Y),
86
+ cancelButton: b(te)
83
87
  }
84
88
  }, null, 8, [
85
89
  "onApply",
86
90
  "onCancel",
87
91
  "custom-props"
88
- ])])], 16)) : r("", !0)], 16));
92
+ ])])], 16)) : i("", !0)], 16));
89
93
  }
90
94
  });
91
95
  //#endregion
92
- export { x as default };
96
+ export { T as default };
@@ -103,6 +103,10 @@ export interface ColorPickerEmits {
103
103
  * Emitted when Apply is pressed (`showFooter`) or when the value commits.
104
104
  */
105
105
  change: [value: null | string];
106
+ /**
107
+ * Emitted when `v-model` should update.
108
+ */
109
+ "update:modelValue": [value: null | string];
106
110
  }
107
111
  export interface ColorPickerOwnProps {
108
112
  /**
@@ -181,12 +185,6 @@ export interface ColorPickerOwnProps {
181
185
  * @default undefined
182
186
  */
183
187
  swatches?: string[];
184
- /**
185
- * Controlled value.
186
- *
187
- * @default undefined
188
- */
189
- value?: null | string;
190
188
  }
191
189
  export interface ColorPickerSlots {
192
190
  /**
@@ -197,4 +195,11 @@ export interface ColorPickerSlots {
197
195
  */
198
196
  footer?: Slot<FieldOverlayFooterSlotProps>;
199
197
  }
200
- export type ColorPickerProps = MergeHtmlProps<ColorPickerOwnProps, HTMLAttributes>;
198
+ export type ColorPickerProps = MergeHtmlProps<ColorPickerOwnProps, HTMLAttributes> & {
199
+ /**
200
+ * Bound with `v-model` on the component (`defineModel` internally).
201
+ *
202
+ * @default undefined
203
+ */
204
+ modelValue?: null | string;
205
+ };