@expcat/tigercat-vue 2.1.0 → 2.1.2

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 (198) hide show
  1. package/dist/{chunk-7W3NALIL.mjs → chunk-3FPS7XVB.mjs} +26 -27
  2. package/dist/{chunk-2OI6GWOT.mjs → chunk-3KAHJF7D.mjs} +12 -11
  3. package/dist/{chunk-IEAEB4TX.mjs → chunk-3OCHBGPF.mjs} +242 -51
  4. package/dist/{chunk-OHR7IUBQ.mjs → chunk-5OILGUNU.mjs} +2 -2
  5. package/dist/{chunk-OQVGB7X6.mjs → chunk-626VUZ2Q.mjs} +1 -1
  6. package/dist/{chunk-66OS5A4D.mjs → chunk-67VS6QHJ.mjs} +26 -12
  7. package/dist/{chunk-EHGFW5GX.mjs → chunk-6JAAXPBW.mjs} +4 -3
  8. package/dist/{chunk-JHMT5Q6P.mjs → chunk-6NYC7EY2.mjs} +29 -15
  9. package/dist/{chunk-6BDDX2R4.mjs → chunk-73Z7N7VG.mjs} +1 -4
  10. package/dist/{chunk-F3ZVVVYD.mjs → chunk-7C7SG3SS.mjs} +15 -3
  11. package/dist/{chunk-CHEXI7MO.mjs → chunk-7TJE7OYH.mjs} +4 -3
  12. package/dist/{chunk-EGIMTTZA.mjs → chunk-BOHE5URZ.mjs} +18 -3
  13. package/dist/{chunk-5RIHHZF6.mjs → chunk-BQK7LH2L.mjs} +4 -1
  14. package/dist/{chunk-E6EZHSGY.mjs → chunk-BSOLH6R5.mjs} +0 -1
  15. package/dist/{chunk-RSM6FOWX.mjs → chunk-CCC3S6LK.mjs} +6 -3
  16. package/dist/{chunk-U75YXWSA.mjs → chunk-CLTRADS7.mjs} +17 -5
  17. package/dist/{chunk-BEIPGX74.mjs → chunk-DRLQCY7R.mjs} +162 -7
  18. package/dist/{chunk-KBJANUZZ.mjs → chunk-E523VGZP.mjs} +1 -1
  19. package/dist/{chunk-4HUYX5WW.mjs → chunk-EC62TY2Y.mjs} +80 -19
  20. package/dist/{chunk-D3U2NJ32.mjs → chunk-FEQ7PZXI.mjs} +8 -2
  21. package/dist/{chunk-PE5OA4YG.mjs → chunk-FHUGOSEY.mjs} +8 -2
  22. package/dist/{chunk-OAPIT53X.mjs → chunk-FIEECAJV.mjs} +7 -10
  23. package/dist/{chunk-7SFB77JR.mjs → chunk-GBPMQJJJ.mjs} +8 -1
  24. package/dist/{chunk-6AMWX5K4.mjs → chunk-GQOPDD44.mjs} +1 -1
  25. package/dist/{chunk-5RXYJWNA.mjs → chunk-H4DEIGEG.mjs} +77 -25
  26. package/dist/{chunk-AU6IC6K7.mjs → chunk-IFASMNTU.mjs} +36 -16
  27. package/dist/{chunk-EZYOCPMM.mjs → chunk-IK2WHKDA.mjs} +29 -15
  28. package/dist/{chunk-HGXD57QM.mjs → chunk-JBS3AESR.mjs} +65 -23
  29. package/dist/{chunk-PYRKFQ6J.mjs → chunk-JIU5UEOU.mjs} +70 -26
  30. package/dist/{chunk-JALHMWKW.mjs → chunk-K5MHUMKR.mjs} +2 -2
  31. package/dist/{chunk-BZ6MVFV7.mjs → chunk-K5RYFPOQ.mjs} +17 -19
  32. package/dist/{chunk-DI6RRAGQ.mjs → chunk-KIUGJNQO.mjs} +4 -4
  33. package/dist/{chunk-5E4LINDO.mjs → chunk-LH2V2JMZ.mjs} +26 -10
  34. package/dist/{chunk-PQBKN2NH.mjs → chunk-LRFKHJDU.mjs} +14 -5
  35. package/dist/{chunk-W5XFWVNV.mjs → chunk-M4FWWEMX.mjs} +15 -6
  36. package/dist/{chunk-VLW3UBIR.mjs → chunk-N2XV37BL.mjs} +37 -41
  37. package/dist/{chunk-2LIIMWBR.mjs → chunk-OYU47A57.mjs} +1 -2
  38. package/dist/{chunk-KU2Q5V3L.mjs → chunk-P62TYR3M.mjs} +18 -2
  39. package/dist/{chunk-P5FDKBXG.mjs → chunk-P7X46BAW.mjs} +70 -3
  40. package/dist/{chunk-KROVW4AW.mjs → chunk-PJQTRDIG.mjs} +13 -3
  41. package/dist/{chunk-26OI3TEA.mjs → chunk-PMQSXEMT.mjs} +42 -6
  42. package/dist/{chunk-XLNK3Z2P.mjs → chunk-POWDTOMF.mjs} +88 -79
  43. package/dist/{chunk-AXDBME5A.mjs → chunk-PSGVG4TN.mjs} +38 -21
  44. package/dist/{chunk-7DWWNFRP.mjs → chunk-PWWWACHC.mjs} +1 -1
  45. package/dist/{chunk-UUWTKCMY.mjs → chunk-QWLD5FMJ.mjs} +1 -1
  46. package/dist/{chunk-ALIUAGJO.mjs → chunk-QZLOF36M.mjs} +7 -13
  47. package/dist/{chunk-WLYQHKLZ.mjs → chunk-QZRSFGZZ.mjs} +50 -11
  48. package/dist/{chunk-37W7XTA6.mjs → chunk-RHQWQJ4I.mjs} +4 -3
  49. package/dist/{chunk-32X54QKW.mjs → chunk-RRLE7QRH.mjs} +43 -22
  50. package/dist/{chunk-RID7A5V7.mjs → chunk-RRNQL6MJ.mjs} +23 -6
  51. package/dist/{chunk-VJ6YM2EW.mjs → chunk-S4BKVFQ7.mjs} +1 -1
  52. package/dist/{chunk-LPZBXTJ6.mjs → chunk-SAC4PAG3.mjs} +4 -4
  53. package/dist/{chunk-W5RZPTFD.mjs → chunk-SNNT64HK.mjs} +13 -2
  54. package/dist/{chunk-N3C6YI7I.mjs → chunk-SWMYIORV.mjs} +22 -7
  55. package/dist/{chunk-U4B5QT72.mjs → chunk-SX3NAN4M.mjs} +1 -1
  56. package/dist/{chunk-JL3CN4UK.mjs → chunk-TDBMAKTJ.mjs} +10 -3
  57. package/dist/chunk-UEGNXN5B.mjs +28 -0
  58. package/dist/{chunk-NEEGXKJW.mjs → chunk-UGHLEKEZ.mjs} +22 -3
  59. package/dist/{chunk-HKYRRQS7.mjs → chunk-UNQO7EVG.mjs} +1 -1
  60. package/dist/{chunk-VN2TWPRC.mjs → chunk-UR5F74ZB.mjs} +112 -18
  61. package/dist/{chunk-VCCK4CDT.mjs → chunk-URPXBKK4.mjs} +23 -5
  62. package/dist/{chunk-7KCOF5US.mjs → chunk-VY6FVIOZ.mjs} +10 -8
  63. package/dist/{chunk-KICZSLOX.mjs → chunk-W2ICYZVU.mjs} +1 -1
  64. package/dist/{chunk-FIVVKBBF.mjs → chunk-W3QOMJKQ.mjs} +8 -6
  65. package/dist/{chunk-DCMRB3HR.mjs → chunk-WV25G4M3.mjs} +4 -3
  66. package/dist/{chunk-ZOYHZF4N.mjs → chunk-X5LJT76O.mjs} +49 -32
  67. package/dist/{chunk-FSJRNEZK.mjs → chunk-YLO73TDM.mjs} +4 -4
  68. package/dist/{chunk-BNYA5IUB.mjs → chunk-YNXP34KO.mjs} +39 -38
  69. package/dist/{chunk-2T2NEZRZ.mjs → chunk-YVDTXHQ6.mjs} +1 -1
  70. package/dist/{chunk-AUMTHL6N.mjs → chunk-ZOP7PEKY.mjs} +2 -1
  71. package/dist/components/ActivityFeed.d.mts +23 -5
  72. package/dist/components/ActivityFeed.mjs +2 -2
  73. package/dist/components/Affix.mjs +1 -1
  74. package/dist/components/Alert.d.mts +1 -1
  75. package/dist/components/Anchor.d.mts +1 -1
  76. package/dist/components/Anchor.mjs +1 -1
  77. package/dist/components/AreaChart.mjs +4 -3
  78. package/dist/components/AutoComplete.mjs +1 -1
  79. package/dist/components/BarChart.mjs +4 -3
  80. package/dist/components/Calendar.mjs +1 -1
  81. package/dist/components/Cascader.mjs +1 -1
  82. package/dist/components/ChartCanvas.d.mts +7 -3
  83. package/dist/components/ChartCanvas.mjs +1 -1
  84. package/dist/components/ChatWindow.d.mts +26 -8
  85. package/dist/components/ChatWindow.mjs +3 -3
  86. package/dist/components/Checkbox.d.mts +1 -1
  87. package/dist/components/Code.d.mts +34 -7
  88. package/dist/components/Code.mjs +3 -1
  89. package/dist/components/CodeEditor.d.mts +1 -1
  90. package/dist/components/CollapsePanel.mjs +1 -1
  91. package/dist/components/ColorPicker.d.mts +19 -1
  92. package/dist/components/ColorPicker.mjs +3 -1
  93. package/dist/components/ColorSwatch.d.mts +6 -0
  94. package/dist/components/ColorSwatch.mjs +1 -1
  95. package/dist/components/CommentThread.d.mts +63 -27
  96. package/dist/components/CommentThread.mjs +2 -2
  97. package/dist/components/ContextMenu.d.mts +2 -2
  98. package/dist/components/Countdown.d.mts +2 -2
  99. package/dist/components/CronEditor.d.mts +1 -1
  100. package/dist/components/DataExport.mjs +2 -2
  101. package/dist/components/DataTableWithToolbar.mjs +8 -8
  102. package/dist/components/DatePicker.d.mts +1 -1
  103. package/dist/components/Descriptions.d.mts +1 -1
  104. package/dist/components/DonutChart.mjs +4 -4
  105. package/dist/components/Drawer.d.mts +1 -1
  106. package/dist/components/Dropdown.d.mts +21 -2
  107. package/dist/components/Dropdown.mjs +1 -1
  108. package/dist/components/FileManager.d.mts +7 -1
  109. package/dist/components/FileManager.mjs +1 -1
  110. package/dist/components/FloatButton.d.mts +31 -1
  111. package/dist/components/FloatButton.mjs +1 -1
  112. package/dist/components/FormWizard.mjs +1 -1
  113. package/dist/components/FunnelChart.mjs +3 -3
  114. package/dist/components/Gantt.d.mts +3 -1
  115. package/dist/components/Gantt.mjs +2 -2
  116. package/dist/components/GaugeChart.mjs +2 -2
  117. package/dist/components/HeatmapChart.mjs +3 -3
  118. package/dist/components/Icon.d.mts +1 -1
  119. package/dist/components/Image.d.mts +1 -1
  120. package/dist/components/Image.mjs +3 -3
  121. package/dist/components/ImageAnnotation.d.mts +1 -1
  122. package/dist/components/ImageGroup.mjs +2 -2
  123. package/dist/components/ImagePreview.mjs +1 -1
  124. package/dist/components/Input.mjs +1 -1
  125. package/dist/components/InputNumber.mjs +1 -1
  126. package/dist/components/InputOTP.d.mts +1 -1
  127. package/dist/components/Kanban.mjs +2 -2
  128. package/dist/components/LineChart.mjs +4 -3
  129. package/dist/components/Link.d.mts +1 -1
  130. package/dist/components/List.mjs +2 -2
  131. package/dist/components/Loading.mjs +1 -1
  132. package/dist/components/MarkdownEditor.d.mts +1 -1
  133. package/dist/components/MarkdownEditor.mjs +1 -1
  134. package/dist/components/MaskInput.d.mts +9 -3
  135. package/dist/components/MaskInput.mjs +1 -1
  136. package/dist/components/Menu.d.mts +2 -2
  137. package/dist/components/Modal.d.mts +1 -1
  138. package/dist/components/NavigationMenu.d.mts +3 -3
  139. package/dist/components/NotificationCenter.d.mts +44 -26
  140. package/dist/components/NotificationCenter.mjs +4 -4
  141. package/dist/components/NumberKeyboard.d.mts +1 -1
  142. package/dist/components/OrgChart.mjs +2 -2
  143. package/dist/components/PageHeader.d.mts +1 -1
  144. package/dist/components/Pagination.mjs +1 -1
  145. package/dist/components/PieChart.mjs +3 -3
  146. package/dist/components/Popconfirm.d.mts +1 -1
  147. package/dist/components/Popconfirm.mjs +2 -2
  148. package/dist/components/Popover.d.mts +2 -2
  149. package/dist/components/Popover.mjs +2 -2
  150. package/dist/components/QRCode.d.mts +2 -11
  151. package/dist/components/QRCode.mjs +1 -1
  152. package/dist/components/RadarChart.mjs +3 -3
  153. package/dist/components/Radio.d.mts +1 -1
  154. package/dist/components/Radio.mjs +1 -1
  155. package/dist/components/Rate.mjs +1 -1
  156. package/dist/components/Result.d.mts +1 -1
  157. package/dist/components/RichTextEditor.d.mts +1 -1
  158. package/dist/components/RichTextEditor.mjs +1 -1
  159. package/dist/components/ScatterChart.mjs +4 -3
  160. package/dist/components/ScrollSpy.mjs +1 -1
  161. package/dist/components/Select.d.mts +4 -6
  162. package/dist/components/Select.mjs +1 -1
  163. package/dist/components/Signature.mjs +1 -1
  164. package/dist/components/Slider.d.mts +18 -0
  165. package/dist/components/Slider.mjs +1 -1
  166. package/dist/components/SplitButton.d.mts +1 -1
  167. package/dist/components/SplitButton.mjs +2 -2
  168. package/dist/components/Splitter.d.mts +4 -4
  169. package/dist/components/Splitter.mjs +1 -1
  170. package/dist/components/Spotlight.d.mts +1 -1
  171. package/dist/components/Statistic.d.mts +2 -2
  172. package/dist/components/Stepper.d.mts +7 -1
  173. package/dist/components/Stepper.mjs +1 -1
  174. package/dist/components/SunburstChart.mjs +3 -3
  175. package/dist/components/Switch.d.mts +22 -6
  176. package/dist/components/Switch.mjs +1 -1
  177. package/dist/components/Table.d.mts +4 -4
  178. package/dist/components/Table.mjs +4 -4
  179. package/dist/components/TagsInput.d.mts +1 -1
  180. package/dist/components/TaskBoard.mjs +1 -1
  181. package/dist/components/Text.d.mts +2 -2
  182. package/dist/components/Textarea.mjs +1 -1
  183. package/dist/components/TimePicker.d.mts +1 -1
  184. package/dist/components/Tooltip.d.mts +1 -1
  185. package/dist/components/Tooltip.mjs +2 -2
  186. package/dist/components/Tour.mjs +1 -1
  187. package/dist/components/Transfer.d.mts +2 -1
  188. package/dist/components/Transfer.mjs +1 -1
  189. package/dist/components/TreeMapChart.mjs +3 -3
  190. package/dist/components/TreeSelect.mjs +1 -1
  191. package/dist/components/Upload.d.mts +1 -1
  192. package/dist/components/Upload.mjs +1 -1
  193. package/dist/components/Watermark.d.mts +1 -1
  194. package/dist/composables/useChartInteraction.d.mts +5 -0
  195. package/dist/composables/useChartInteraction.mjs +1 -1
  196. package/dist/index.d.mts +1 -1
  197. package/dist/index.mjs +57 -0
  198. package/package.json +2 -2
@@ -2,6 +2,9 @@ import {
2
2
  renderVueOverlayTeleport,
3
3
  useVueAnchoredOverlay
4
4
  } from "./chunk-Q7Y22OFX.mjs";
5
+ import {
6
+ useTigerConfig
7
+ } from "./chunk-UOJOJBEU.mjs";
5
8
 
6
9
  // src/components/ColorPicker.ts
7
10
  import { defineComponent, h, ref, computed, watch } from "vue";
@@ -11,15 +14,27 @@ import {
11
14
  colorPickerPanelClasses,
12
15
  colorPickerInputClasses,
13
16
  colorPickerPresetClasses,
14
- hexToRgb,
15
17
  rgbToHex,
16
18
  rgbToHsv,
17
19
  hsvToRgb,
18
20
  formatColorString,
19
21
  parseColorInput,
22
+ parseColorParts,
20
23
  classNames,
21
- coerceClassValue
24
+ coerceClassValue,
25
+ mergeTigerLocale,
26
+ getColorPickerLabels,
27
+ formatColorPickerSelectPreset
22
28
  } from "@expcat/tigercat-core";
29
+ function rgbFromValue(value) {
30
+ const parts = parseColorParts(value);
31
+ return parts ? { r: parts.r, g: parts.g, b: parts.b } : { r: 0, g: 0, b: 0 };
32
+ }
33
+ function explicitAlphaFromValue(value) {
34
+ if (!/^(rgba|hsla)\(/i.test(value.trim())) return null;
35
+ const parts = parseColorParts(value);
36
+ return parts ? parts.a : null;
37
+ }
23
38
  var ColorPicker = defineComponent({
24
39
  name: "TigerColorPicker",
25
40
  props: {
@@ -28,12 +43,17 @@ var ColorPicker = defineComponent({
28
43
  size: { type: String, default: "md" },
29
44
  showAlpha: { type: Boolean, default: false },
30
45
  format: { type: String, default: "hex" },
31
- presets: { type: Array, default: void 0 }
46
+ presets: { type: Array, default: void 0 },
47
+ locale: { type: Object, default: void 0 },
48
+ labels: { type: Object, default: void 0 }
32
49
  },
33
50
  emits: ["update:modelValue", "change"],
34
51
  setup(props, { emit, attrs }) {
52
+ const config = useTigerConfig();
53
+ const mergedLocale = computed(() => mergeTigerLocale(config.value.locale, props.locale));
54
+ const labels = computed(() => getColorPickerLabels(mergedLocale.value, props.labels));
35
55
  const isOpen = ref(false);
36
- const alpha = ref(1);
56
+ const alpha = ref(explicitAlphaFromValue(props.modelValue) ?? 1);
37
57
  const containerRef = ref(null);
38
58
  const triggerRef = ref(null);
39
59
  const panelRef = ref(null);
@@ -49,8 +69,15 @@ var ColorPicker = defineComponent({
49
69
  restoreFocusOnDismiss: true,
50
70
  onDismiss: closePanel
51
71
  });
52
- const rgb = computed(() => hexToRgb(props.modelValue));
72
+ const rgb = computed(() => rgbFromValue(props.modelValue));
53
73
  const hsv = computed(() => rgbToHsv(rgb.value.r, rgb.value.g, rgb.value.b));
74
+ watch(
75
+ () => props.modelValue,
76
+ (value) => {
77
+ const next = explicitAlphaFromValue(value);
78
+ if (next !== null) alpha.value = next;
79
+ }
80
+ );
54
81
  const displayValue = computed(
55
82
  () => formatColorString(
56
83
  rgb.value.r,
@@ -84,7 +111,12 @@ var ColorPicker = defineComponent({
84
111
  }
85
112
  }
86
113
  function handleAlphaChange(e) {
87
- alpha.value = Number(e.target.value) / 100;
114
+ const nextAlpha = Number(e.target.value) / 100;
115
+ alpha.value = nextAlpha;
116
+ const format = props.format === "hex" ? "rgb" : props.format;
117
+ const next = formatColorString(rgb.value.r, rgb.value.g, rgb.value.b, format, nextAlpha);
118
+ emit("update:modelValue", next);
119
+ emit("change", next);
88
120
  }
89
121
  function handleHueChange(e) {
90
122
  const hue = Number(e.target.value);
@@ -96,10 +128,10 @@ var ColorPicker = defineComponent({
96
128
  function handleInputChange(e) {
97
129
  const val = e.target.value;
98
130
  inputValue.value = val;
99
- const hex = parseColorInput(val);
100
- if (hex) {
101
- emit("update:modelValue", hex);
102
- emit("change", hex);
131
+ const parsed = parseColorInput(val);
132
+ if (parsed) {
133
+ emit("update:modelValue", parsed);
134
+ emit("change", parsed);
103
135
  }
104
136
  }
105
137
  function handlePresetClick(color) {
@@ -112,6 +144,10 @@ var ColorPicker = defineComponent({
112
144
  handlePresetClick(color);
113
145
  }
114
146
  }
147
+ function handleClear() {
148
+ emit("update:modelValue", "");
149
+ emit("change", "");
150
+ }
115
151
  return () => h(
116
152
  "div",
117
153
  {
@@ -125,7 +161,9 @@ var ColorPicker = defineComponent({
125
161
  class: getColorPickerTriggerClasses(props.size, props.disabled),
126
162
  style: { backgroundColor: swatchColor.value },
127
163
  role: "button",
128
- "aria-label": "Pick color",
164
+ "data-tiger-colorpicker-trigger": "",
165
+ "aria-label": labels.value.trigger,
166
+ title: labels.value.trigger,
129
167
  "aria-haspopup": "dialog",
130
168
  "aria-expanded": isOpen.value,
131
169
  "aria-disabled": props.disabled || void 0,
@@ -141,15 +179,35 @@ var ColorPicker = defineComponent({
141
179
  ref: panelRef,
142
180
  class: classNames(colorPickerPanelClasses, overlay.floatingClasses.value),
143
181
  style: overlay.floatingStyles.value,
144
- "data-positioned": overlay.positioned.value
182
+ "data-positioned": overlay.positioned.value,
183
+ "data-tiger-colorpicker-panel": "",
184
+ role: "dialog",
185
+ "aria-label": labels.value.panelTitle
145
186
  },
146
187
  [
188
+ h("div", { class: "mb-2 flex items-center justify-between gap-2" }, [
189
+ h(
190
+ "span",
191
+ { class: "text-xs font-medium text-[var(--tiger-text,#111827)]" },
192
+ labels.value.panelTitle
193
+ ),
194
+ h(
195
+ "button",
196
+ {
197
+ type: "button",
198
+ class: "text-xs text-[var(--tiger-primary,#2563eb)] hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--tiger-primary,#2563eb)]",
199
+ "data-tiger-colorpicker-clear": "",
200
+ onClick: handleClear
201
+ },
202
+ labels.value.clear
203
+ )
204
+ ]),
147
205
  // Hue slider
148
206
  h("div", { class: "mb-2" }, [
149
207
  h(
150
208
  "label",
151
209
  { class: "block text-xs text-[var(--tiger-text-muted,#6b7280)] mb-1" },
152
- "Hue"
210
+ labels.value.hue
153
211
  ),
154
212
  h("input", {
155
213
  type: "range",
@@ -157,7 +215,7 @@ var ColorPicker = defineComponent({
157
215
  max: 360,
158
216
  value: hsv.value.h,
159
217
  class: "w-full h-2 rounded-full cursor-pointer accent-[var(--tiger-primary,#2563eb)]",
160
- "aria-label": "Hue",
218
+ "aria-label": labels.value.hue,
161
219
  onInput: handleHueChange
162
220
  })
163
221
  ]),
@@ -166,7 +224,7 @@ var ColorPicker = defineComponent({
166
224
  h(
167
225
  "label",
168
226
  { class: "block text-xs text-[var(--tiger-text-muted,#6b7280)] mb-1" },
169
- "Alpha"
227
+ labels.value.alpha
170
228
  ),
171
229
  h("input", {
172
230
  type: "range",
@@ -174,7 +232,7 @@ var ColorPicker = defineComponent({
174
232
  max: 100,
175
233
  value: Math.round(alpha.value * 100),
176
234
  class: "w-full h-2 rounded-full cursor-pointer accent-[var(--tiger-primary,#2563eb)]",
177
- "aria-label": "Alpha",
235
+ "aria-label": labels.value.alpha,
178
236
  onInput: handleAlphaChange
179
237
  })
180
238
  ]) : null,
@@ -191,7 +249,7 @@ var ColorPicker = defineComponent({
191
249
  type: "text",
192
250
  class: colorPickerInputClasses,
193
251
  value: inputValue.value,
194
- "aria-label": "Color value",
252
+ "aria-label": labels.value.value,
195
253
  onInput: handleInputChange
196
254
  })
197
255
  ]),
@@ -200,7 +258,7 @@ var ColorPicker = defineComponent({
200
258
  h("div", {
201
259
  class: "w-8 h-8 rounded border border-[var(--tiger-border,#d1d5db)]",
202
260
  style: { backgroundColor: swatchColor.value },
203
- "aria-label": "Color preview"
261
+ "aria-label": labels.value.preview
204
262
  }),
205
263
  h(
206
264
  "span",
@@ -217,7 +275,10 @@ var ColorPicker = defineComponent({
217
275
  style: { backgroundColor: color },
218
276
  role: "button",
219
277
  tabindex: 0,
220
- "aria-label": `Select ${color}`,
278
+ "aria-label": formatColorPickerSelectPreset(
279
+ labels.value.selectPreset,
280
+ color
281
+ ),
221
282
  onClick: () => handlePresetClick(color),
222
283
  onKeydown: (e) => handlePresetKeydown(e, color)
223
284
  })
@@ -19,6 +19,7 @@ var ColorSwatch = defineComponent({
19
19
  name: "TigerColorSwatch",
20
20
  props: {
21
21
  modelValue: { type: String, default: void 0 },
22
+ defaultValue: { type: String },
22
23
  disabled: { type: Boolean, default: false },
23
24
  size: { type: String, default: "md" },
24
25
  colors: { type: Array, default: void 0 },
@@ -28,12 +29,16 @@ var ColorSwatch = defineComponent({
28
29
  },
29
30
  emits: ["update:modelValue", "change"],
30
31
  setup(props, { attrs, emit }) {
32
+ const innerValue = ref(props.defaultValue);
31
33
  const focusIndex = ref(-1);
32
34
  const optionRefs = ref([]);
33
35
  const normalizedGroups = computed(() => normalizeColorSwatchGroups(props.groups, props.colors));
34
36
  const options = computed(() => flattenColorSwatchGroups(normalizedGroups.value));
37
+ const selectedValue = computed(
38
+ () => props.modelValue !== void 0 ? props.modelValue : innerValue.value
39
+ );
35
40
  const selectedIndex = computed(
36
- () => options.value.findIndex((option) => isColorSwatchSelected(option.value, props.modelValue))
41
+ () => options.value.findIndex((option) => isColorSwatchSelected(option.value, selectedValue.value))
37
42
  );
38
43
  const firstEnabledIndex = computed(() => options.value.findIndex((option) => !option.disabled));
39
44
  const activeIndex = computed(
@@ -41,6 +46,7 @@ var ColorSwatch = defineComponent({
41
46
  );
42
47
  function handleSelect(option) {
43
48
  if (props.disabled || option.disabled) return;
49
+ if (props.modelValue === void 0) innerValue.value = option.value;
44
50
  emit("update:modelValue", option.value);
45
51
  emit("change", option.value, option);
46
52
  }
@@ -89,7 +95,7 @@ var ColorSwatch = defineComponent({
89
95
  group.colors.map((option) => {
90
96
  const optionIndex = flatIndex;
91
97
  flatIndex += 1;
92
- const selected = isColorSwatchSelected(option.value, props.modelValue);
98
+ const selected = isColorSwatchSelected(option.value, selectedValue.value);
93
99
  const optionDisabled = props.disabled || !!option.disabled;
94
100
  const tabIndex = !optionDisabled && optionIndex === (focusIndex.value >= 0 ? focusIndex.value : activeIndex.value) ? 0 : -1;
95
101
  return h(
@@ -10,6 +10,8 @@ function unref(value) {
10
10
  }
11
11
  function useChartInteraction(options) {
12
12
  const { emit, getData, eventNames } = options;
13
+ const isHoverable = () => unref(options.hoverable);
14
+ const isShowTooltip = () => options.showTooltip === void 0 ? true : unref(options.showTooltip);
13
15
  const localHoveredIndex = ref(null);
14
16
  const localSelectedIndex = ref(null);
15
17
  const tooltipPosition = ref({ x: 0, y: 0 });
@@ -43,11 +45,13 @@ function useChartInteraction(options) {
43
45
  });
44
46
  };
45
47
  const handleMouseEnter = (index, event) => {
46
- if (!unref(options.hoverable)) return;
48
+ const hoverable = isHoverable();
49
+ if (!hoverable && !isShowTooltip()) return;
47
50
  if (options.hoveredIndexProp?.() === void 0) {
48
51
  localHoveredIndex.value = index;
49
52
  }
50
53
  tooltipPosition.value = { x: event.clientX, y: event.clientY };
54
+ if (!hoverable) return;
51
55
  emit("update:hoveredIndex", index);
52
56
  if (eventNames?.hover && getData) {
53
57
  emit(eventNames.hover, index, getData(index));
@@ -58,10 +62,12 @@ function useChartInteraction(options) {
58
62
  };
59
63
  const handleMouseLeave = () => {
60
64
  tooltipScheduler.cancel();
61
- if (!unref(options.hoverable)) return;
65
+ const hoverable = isHoverable();
66
+ if (!hoverable && !isShowTooltip()) return;
62
67
  if (options.hoveredIndexProp?.() === void 0) {
63
68
  localHoveredIndex.value = null;
64
69
  }
70
+ if (!hoverable) return;
65
71
  emit("update:hoveredIndex", null);
66
72
  if (eventNames?.hover) {
67
73
  emit(eventNames.hover, null, null);
@@ -30,9 +30,10 @@ import {
30
30
  tourFooterClasses,
31
31
  tourIndicatorClasses,
32
32
  tourCloseButtonClasses,
33
+ tourMaskClasses,
33
34
  getTourTargetRect,
34
35
  getTourPopoverPosition,
35
- getTourSpotlightStyle,
36
+ getTourMaskHoleStyle,
36
37
  getActiveTourSteps,
37
38
  getCurrentActiveTourStep,
38
39
  getActiveTourStepPosition,
@@ -161,6 +162,7 @@ var Tour = defineComponent({
161
162
  goTo(nextStep.index);
162
163
  } else {
163
164
  emit("finish");
165
+ emit("close");
164
166
  emit("update:open", false);
165
167
  }
166
168
  };
@@ -215,18 +217,13 @@ var Tour = defineComponent({
215
217
  };
216
218
  }
217
219
  const children = [];
218
- if (showMask && targetRect.value) {
220
+ if (showMask) {
219
221
  children.push(
220
222
  h("div", {
221
- style: getTourSpotlightStyle(targetRect.value),
222
- "aria-hidden": "true"
223
- })
224
- );
225
- } else if (showMask) {
226
- children.push(
227
- h("div", {
228
- class: "fixed inset-0 z-[1000] bg-black/45",
223
+ class: tourMaskClasses,
224
+ "data-tiger-tour-mask": "",
229
225
  "aria-hidden": "true",
226
+ style: targetRect.value ? getTourMaskHoleStyle(targetRect.value) : void 0,
230
227
  onClick: close
231
228
  })
232
229
  );
@@ -12,6 +12,7 @@ import {
12
12
  import {
13
13
  classNames,
14
14
  coerceClassValue,
15
+ createProgrammaticScrollLock,
15
16
  createScrollSpyObserver,
16
17
  createScrollSpyPayload,
17
18
  flattenScrollSpyItems,
@@ -93,6 +94,7 @@ var ScrollSpy = defineComponent({
93
94
  );
94
95
  const flatItems = computed(() => flattenScrollSpyItems(props.items));
95
96
  let stopObserver = null;
97
+ const scrollLock = createProgrammaticScrollLock(() => props.getContainer());
96
98
  const emitActive = (item, source) => {
97
99
  const nextKeyString = getScrollSpyKeyString(item.key);
98
100
  if (nextKeyString === activeKeyString.value) return;
@@ -108,7 +110,10 @@ var ScrollSpy = defineComponent({
108
110
  offsetTop: props.offsetTop,
109
111
  targetOffset: props.targetOffset,
110
112
  bounds: props.bounds,
111
- onChange: (item) => emitActive(item, "scroll")
113
+ onChange: (item) => {
114
+ if (scrollLock.isLocked()) return;
115
+ emitActive(item, "scroll");
116
+ }
112
117
  });
113
118
  };
114
119
  const handleClick = (item, event) => {
@@ -116,6 +121,7 @@ var ScrollSpy = defineComponent({
116
121
  if (item.disabled) return;
117
122
  emit("click", item, event);
118
123
  emitActive(item, "click");
124
+ scrollLock.lock();
119
125
  scrollToScrollSpyItem(item, props.getContainer(), props.targetOffset ?? props.offsetTop);
120
126
  };
121
127
  onMounted(() => {
@@ -141,6 +147,7 @@ var ScrollSpy = defineComponent({
141
147
  );
142
148
  onBeforeUnmount(() => {
143
149
  stopObserver?.();
150
+ scrollLock.dispose();
144
151
  });
145
152
  const renderItems = (items, nested = false) => h(
146
153
  "ul",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Pagination
3
- } from "./chunk-2LIIMWBR.mjs";
3
+ } from "./chunk-OYU47A57.mjs";
4
4
  import {
5
5
  VirtualList
6
6
  } from "./chunk-HS4YQGZQ.mjs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Textarea
3
- } from "./chunk-2OI6GWOT.mjs";
3
+ } from "./chunk-3KAHJF7D.mjs";
4
4
  import {
5
5
  Button
6
6
  } from "./chunk-YZBQ6IR7.mjs";
@@ -13,6 +13,9 @@ import {
13
13
  import {
14
14
  Avatar
15
15
  } from "./chunk-ZFTRR3KW.mjs";
16
+ import {
17
+ useTigerConfig
18
+ } from "./chunk-UOJOJBEU.mjs";
16
19
 
17
20
  // src/components/CommentThread.ts
18
21
  import { defineComponent, computed, h, ref } from "vue";
@@ -22,7 +25,13 @@ import {
22
25
  mergeStyleValues,
23
26
  buildCommentTree,
24
27
  clipCommentTreeDepth,
25
- formatCommentTime
28
+ formatCommentTime,
29
+ getCommentThreadLabels,
30
+ mergeTigerLocale,
31
+ nextCommentLikeState,
32
+ resolveCommentLikeState,
33
+ resolveLocaleText,
34
+ writeCommentLikeOverlay
26
35
  } from "@expcat/tigercat-core";
27
36
 
28
37
  // ../core/src/internal/comment-thread-styles.ts
@@ -79,39 +88,55 @@ var CommentThread = defineComponent({
79
88
  },
80
89
  emptyText: {
81
90
  type: String,
82
- default: "\u6682\u65E0\u8BC4\u8BBA"
91
+ default: void 0
83
92
  },
84
93
  replyPlaceholder: {
85
94
  type: String,
86
- default: "\u5199\u4E0B\u56DE\u590D..."
95
+ default: void 0
87
96
  },
88
97
  replyButtonText: {
89
98
  type: String,
90
- default: "\u56DE\u590D"
99
+ default: void 0
91
100
  },
92
101
  cancelReplyText: {
93
102
  type: String,
94
- default: "\u53D6\u6D88"
103
+ default: void 0
95
104
  },
96
105
  likeText: {
97
106
  type: String,
98
- default: "\u70B9\u8D5E"
107
+ default: void 0
99
108
  },
100
109
  likedText: {
101
110
  type: String,
102
- default: "\u5DF2\u8D5E"
111
+ default: void 0
103
112
  },
104
113
  replyText: {
105
114
  type: String,
106
- default: "\u56DE\u590D"
115
+ default: void 0
107
116
  },
108
117
  moreText: {
109
118
  type: String,
110
- default: "\u66F4\u591A"
119
+ default: void 0
111
120
  },
112
121
  loadMoreText: {
113
122
  type: String,
114
- default: "\u52A0\u8F7D\u66F4\u591A"
123
+ default: void 0
124
+ },
125
+ collapseRepliesText: {
126
+ type: String,
127
+ default: void 0
128
+ },
129
+ expandRepliesText: {
130
+ type: String,
131
+ default: void 0
132
+ },
133
+ locale: {
134
+ type: Object,
135
+ default: void 0
136
+ },
137
+ labels: {
138
+ type: Object,
139
+ default: void 0
115
140
  },
116
141
  showAvatar: {
117
142
  type: Boolean,
@@ -144,8 +169,12 @@ var CommentThread = defineComponent({
144
169
  },
145
170
  emits: ["like", "reply", "more", "action", "update:expandedKeys", "load-more"],
146
171
  setup(props, { emit, attrs }) {
172
+ const config = useTigerConfig();
173
+ const mergedLocale = computed(() => mergeTigerLocale(config.value.locale, props.locale));
174
+ const labels = computed(() => getCommentThreadLabels(mergedLocale.value, props.labels));
147
175
  const innerExpandedKeys = ref([...props.defaultExpandedKeys]);
148
176
  const expandedAllKeys = ref(/* @__PURE__ */ new Set());
177
+ const likeOverlay = ref(/* @__PURE__ */ new Map());
149
178
  const replyingTo = ref(null);
150
179
  const replyValue = ref("");
151
180
  const mergedExpandedKeys = computed(() => props.expandedKeys ?? innerExpandedKeys.value);
@@ -177,6 +206,11 @@ var CommentThread = defineComponent({
177
206
  expandedAllKeys.value = /* @__PURE__ */ new Set([...expandedAllKeys.value, node.id]);
178
207
  emit("load-more", node);
179
208
  };
209
+ const handleLike = (node) => {
210
+ const next = nextCommentLikeState(node, likeOverlay.value);
211
+ likeOverlay.value = writeCommentLikeOverlay(likeOverlay.value, node.id, next);
212
+ emit("like", node, next.liked);
213
+ };
180
214
  const handleReplySubmit = (node) => {
181
215
  const trimmed = replyValue.value.trim();
182
216
  if (!trimmed) return;
@@ -199,8 +233,9 @@ var CommentThread = defineComponent({
199
233
  const showLoadMore = showReplies && props.maxReplies > 0 && children.length > props.maxReplies && !showAllReplies;
200
234
  const actions = [];
201
235
  if (props.showLike) {
202
- const likeLabel = node.liked ? props.likedText : props.likeText;
203
- const likeCount = node.likes ? ` ${node.likes}` : "";
236
+ const { liked, likes } = resolveCommentLikeState(node, likeOverlay.value);
237
+ const likeLabel = liked ? resolveLocaleText(labels.value.likedText, props.likedText) : resolveLocaleText(labels.value.likeText, props.likeText);
238
+ const likeCount = likes ? ` ${likes}` : "";
204
239
  actions.push(
205
240
  h(
206
241
  Button,
@@ -211,9 +246,9 @@ var CommentThread = defineComponent({
211
246
  className: classNames(
212
247
  commentThreadActionButtonClasses,
213
248
  commentThreadLikeButtonClasses,
214
- node.liked && commentThreadLikedButtonClasses
249
+ liked && commentThreadLikedButtonClasses
215
250
  ),
216
- onClick: () => emit("like", node, !node.liked)
251
+ onClick: () => handleLike(node)
217
252
  },
218
253
  {
219
254
  default: () => h("span", { class: "flex items-center gap-1.5" }, [
@@ -222,7 +257,7 @@ var CommentThread = defineComponent({
222
257
  {
223
258
  class: classNames(
224
259
  commentThreadLikeIconClasses,
225
- node.liked ? "fill-current" : "stroke-current fill-none"
260
+ liked ? "fill-current" : "stroke-current fill-none"
226
261
  ),
227
262
  viewBox: "0 0 24 24",
228
263
  strokeWidth: "2"
@@ -277,7 +312,7 @@ var CommentThread = defineComponent({
277
312
  })
278
313
  ]
279
314
  ),
280
- h("span", props.replyText)
315
+ h("span", resolveLocaleText(labels.value.replyText, props.replyText))
281
316
  ])
282
317
  }
283
318
  )
@@ -316,7 +351,7 @@ var CommentThread = defineComponent({
316
351
  })
317
352
  ]
318
353
  ),
319
- h("span", props.moreText)
354
+ h("span", resolveLocaleText(labels.value.moreText, props.moreText))
320
355
  ])
321
356
  }
322
357
  )
@@ -436,7 +471,10 @@ var CommentThread = defineComponent({
436
471
  h(Textarea, {
437
472
  rows: 3,
438
473
  modelValue: replyValue.value,
439
- placeholder: props.replyPlaceholder,
474
+ placeholder: resolveLocaleText(
475
+ labels.value.replyPlaceholder,
476
+ props.replyPlaceholder
477
+ ),
440
478
  className: commentThreadReplyTextareaClasses,
441
479
  "onUpdate:modelValue": (value) => {
442
480
  replyValue.value = value;
@@ -454,7 +492,9 @@ var CommentThread = defineComponent({
454
492
  replyValue.value = "";
455
493
  }
456
494
  },
457
- { default: () => props.cancelReplyText }
495
+ {
496
+ default: () => resolveLocaleText(labels.value.cancelReplyText, props.cancelReplyText)
497
+ }
458
498
  ),
459
499
  h(
460
500
  Button,
@@ -464,7 +504,9 @@ var CommentThread = defineComponent({
464
504
  className: commentThreadSubmitButtonClasses,
465
505
  onClick: () => handleReplySubmit(node)
466
506
  },
467
- { default: () => props.replyButtonText }
507
+ {
508
+ default: () => resolveLocaleText(labels.value.replyButtonText, props.replyButtonText)
509
+ }
468
510
  )
469
511
  ])
470
512
  ]
@@ -483,7 +525,13 @@ var CommentThread = defineComponent({
483
525
  onClick: () => toggleExpanded(node.id)
484
526
  },
485
527
  {
486
- default: () => isExpanded ? "\u25BE \u6536\u8D77\u56DE\u590D" : `\u25B8 \u5C55\u5F00 ${children.length} \u6761\u56DE\u590D`
528
+ default: () => isExpanded ? resolveLocaleText(
529
+ labels.value.collapseRepliesText,
530
+ props.collapseRepliesText
531
+ ) : resolveLocaleText(
532
+ labels.value.expandRepliesText,
533
+ props.expandRepliesText
534
+ ).replace("{count}", String(children.length))
487
535
  }
488
536
  ) : null,
489
537
  showReplies ? h(
@@ -504,7 +552,9 @@ var CommentThread = defineComponent({
504
552
  className: commentThreadPrimaryButtonClasses,
505
553
  onClick: () => handleLoadMore(node)
506
554
  },
507
- { default: () => props.loadMoreText }
555
+ {
556
+ default: () => resolveLocaleText(labels.value.loadMoreText, props.loadMoreText)
557
+ }
508
558
  ) : null
509
559
  ]
510
560
  ) : null
@@ -514,7 +564,7 @@ var CommentThread = defineComponent({
514
564
  );
515
565
  };
516
566
  return () => {
517
- const ariaLabel = attrs["aria-label"] ?? (attrs["aria-labelledby"] ? void 0 : "\u8BC4\u8BBA\u7EBF\u7A0B");
567
+ const ariaLabel = attrs["aria-label"] ?? (attrs["aria-labelledby"] ? void 0 : "Comment thread");
518
568
  const children = resolvedNodes.value.length === 0 ? [
519
569
  h(
520
570
  "div",
@@ -542,7 +592,9 @@ var CommentThread = defineComponent({
542
592
  h(
543
593
  Text,
544
594
  { tag: "div", size: "sm", color: "muted", class: "font-medium" },
545
- { default: () => props.emptyText }
595
+ {
596
+ default: () => resolveLocaleText(labels.value.emptyText, props.emptyText)
597
+ }
546
598
  )
547
599
  ]
548
600
  )