@eifi1/ui-kit 0.17.0 → 0.19.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 (210) hide show
  1. package/README.md +83 -4
  2. package/dist/chart.d.ts +13 -1
  3. package/dist/components/account-chips.d.ts +153 -0
  4. package/dist/components/account-chips.js +135 -0
  5. package/dist/components/account-chips.js.map +1 -0
  6. package/dist/components/account-settings-labels.d.ts +10 -2
  7. package/dist/components/account-settings-labels.js +3 -0
  8. package/dist/components/account-settings-labels.js.map +1 -1
  9. package/dist/components/amount-input.d.ts +13 -1
  10. package/dist/components/button-group.d.ts +13 -1
  11. package/dist/components/calculator.d.ts +13 -1
  12. package/dist/components/chip.d.ts +25 -1
  13. package/dist/components/chip.js +143 -6
  14. package/dist/components/chip.js.map +1 -1
  15. package/dist/components/confirm-dialog.d.ts +42 -1
  16. package/dist/components/confirm-dialog.js +36 -5
  17. package/dist/components/confirm-dialog.js.map +1 -1
  18. package/dist/components/copy-button.d.ts +13 -1
  19. package/dist/components/danger-confirm.d.ts +55 -4
  20. package/dist/components/danger-confirm.js +67 -30
  21. package/dist/components/danger-confirm.js.map +1 -1
  22. package/dist/components/data-table-cells.d.ts +1 -1
  23. package/dist/components/data-table-filter-popover.d.ts +1 -1
  24. package/dist/components/data-table-filters.d.ts +1 -1
  25. package/dist/components/data-table.d.ts +1 -1
  26. package/dist/components/data-table.js +2 -0
  27. package/dist/components/data-table.js.map +1 -1
  28. package/dist/components/facing-pair.d.ts +13 -1
  29. package/dist/components/file-button.d.ts +13 -1
  30. package/dist/components/file-dropzone.d.ts +13 -1
  31. package/dist/components/floating-panel.d.ts +4 -1
  32. package/dist/components/floating-panel.js +15 -1
  33. package/dist/components/floating-panel.js.map +1 -1
  34. package/dist/components/form-actions.d.ts +13 -1
  35. package/dist/components/form-actions.js +3 -0
  36. package/dist/components/form-actions.js.map +1 -1
  37. package/dist/components/legal.d.ts +84 -0
  38. package/dist/components/legal.js +55 -0
  39. package/dist/components/legal.js.map +1 -0
  40. package/dist/components/money-field.d.ts +13 -1
  41. package/dist/components/number-field.d.ts +14 -2
  42. package/dist/components/number-field.js +23 -22
  43. package/dist/components/number-field.js.map +1 -1
  44. package/dist/components/number-input.d.ts +13 -1
  45. package/dist/components/numpad-sheet.d.ts +13 -1
  46. package/dist/components/passkeys-setting.d.ts +27 -1
  47. package/dist/components/passkeys-setting.js +31 -5
  48. package/dist/components/passkeys-setting.js.map +1 -1
  49. package/dist/components/progress-bar.d.ts +15 -1
  50. package/dist/components/progress-bar.js +8 -1
  51. package/dist/components/progress-bar.js.map +1 -1
  52. package/dist/components/reauth-dialog.d.ts +90 -0
  53. package/dist/components/reauth-dialog.js +158 -0
  54. package/dist/components/reauth-dialog.js.map +1 -0
  55. package/dist/components/series-chart.d.ts +13 -1
  56. package/dist/components/server-wake.d.ts +60 -0
  57. package/dist/components/server-wake.js +79 -0
  58. package/dist/components/server-wake.js.map +1 -0
  59. package/dist/components/settings-fields.d.ts +13 -1
  60. package/dist/components/share-card.d.ts +64 -0
  61. package/dist/components/share-card.js +350 -0
  62. package/dist/components/share-card.js.map +1 -0
  63. package/dist/components/status-dot.d.ts +2 -0
  64. package/dist/components/text-link.d.ts +13 -1
  65. package/dist/components/time-input.d.ts +13 -1
  66. package/dist/components/toast.d.ts +10 -1
  67. package/dist/components/toast.js +42 -2
  68. package/dist/components/toast.js.map +1 -1
  69. package/dist/components/toggle-group.js +5 -2
  70. package/dist/components/toggle-group.js.map +1 -1
  71. package/dist/components/translation-review-editor.d.ts +56 -0
  72. package/dist/components/translation-review-editor.js +159 -0
  73. package/dist/components/translation-review-editor.js.map +1 -0
  74. package/dist/components/translation-review-labels.d.ts +92 -0
  75. package/dist/components/translation-review-labels.js +67 -0
  76. package/dist/components/translation-review-labels.js.map +1 -0
  77. package/dist/components/translation-review-parts.d.ts +97 -0
  78. package/dist/components/translation-review-parts.js +163 -0
  79. package/dist/components/translation-review-parts.js.map +1 -0
  80. package/dist/components/translation-review.d.ts +94 -0
  81. package/dist/components/translation-review.js +344 -0
  82. package/dist/components/translation-review.js.map +1 -0
  83. package/dist/components/ui.d.ts +13 -1
  84. package/dist/components/ui.js +43 -28
  85. package/dist/components/ui.js.map +1 -1
  86. package/dist/components/use-table-state.d.ts +1 -1
  87. package/dist/components/user-avatar.d.ts +2 -0
  88. package/dist/components/write-lock.d.ts +68 -0
  89. package/dist/components/write-lock.js +33 -0
  90. package/dist/components/write-lock.js.map +1 -0
  91. package/dist/{data-table-CpkWUJBY.d.ts → data-table-3mi2R3so.d.ts} +19 -1
  92. package/dist/data-table.d.ts +1 -1
  93. package/dist/hooks/use-file-drop.d.ts +13 -1
  94. package/dist/hooks/use-overlay-history.js +16 -0
  95. package/dist/hooks/use-overlay-history.js.map +1 -1
  96. package/dist/i18n/defaults.d.ts +13 -1
  97. package/dist/i18n/defaults.js +15 -1
  98. package/dist/i18n/defaults.js.map +1 -1
  99. package/dist/i18n/german.d.ts +81 -0
  100. package/dist/i18n/{locales/de.js → german.js} +110 -9
  101. package/dist/i18n/german.js.map +1 -0
  102. package/dist/i18n/kit-labels.d.ts +13 -1
  103. package/dist/i18n/kit-labels.js +5 -0
  104. package/dist/i18n/kit-labels.js.map +1 -1
  105. package/dist/i18n/languages.d.ts +243 -0
  106. package/dist/i18n/languages.js +70 -0
  107. package/dist/i18n/languages.js.map +1 -0
  108. package/dist/i18n/locales/de-CH.d.ts +26 -8
  109. package/dist/i18n/locales/de-CH.js +7 -3
  110. package/dist/i18n/locales/de-CH.js.map +1 -1
  111. package/dist/i18n/locales/en.d.ts +13 -1
  112. package/dist/i18n/locales/en.js +8 -0
  113. package/dist/i18n/locales/en.js.map +1 -1
  114. package/dist/i18n/locales/es.d.ts +13 -1
  115. package/dist/i18n/locales/es.js +127 -27
  116. package/dist/i18n/locales/es.js.map +1 -1
  117. package/dist/i18n/locales/fr.d.ts +13 -1
  118. package/dist/i18n/locales/fr.js +101 -1
  119. package/dist/i18n/locales/fr.js.map +1 -1
  120. package/dist/i18n/locales/hu.d.ts +13 -1
  121. package/dist/i18n/locales/hu.js +105 -1
  122. package/dist/i18n/locales/hu.js.map +1 -1
  123. package/dist/i18n/locales/it.d.ts +13 -1
  124. package/dist/i18n/locales/it.js +134 -34
  125. package/dist/i18n/locales/it.js.map +1 -1
  126. package/dist/i18n/locales/zh.d.ts +13 -1
  127. package/dist/i18n/locales/zh.js +101 -1
  128. package/dist/i18n/locales/zh.js.map +1 -1
  129. package/dist/i18n/review.d.ts +102 -0
  130. package/dist/i18n/review.js +158 -0
  131. package/dist/i18n/review.js.map +1 -0
  132. package/dist/i18n/swiss.d.ts +3 -3
  133. package/dist/i18n/swiss.js.map +1 -1
  134. package/dist/index.d.ts +17 -4
  135. package/dist/index.js +97 -1
  136. package/dist/index.js.map +1 -1
  137. package/dist/{kit-labels-C4uB_zmg.d.ts → kit-labels-D1J2_jyD.d.ts} +236 -9
  138. package/dist/lib/floating-stack.d.ts +31 -0
  139. package/dist/lib/floating-stack.js +42 -0
  140. package/dist/lib/floating-stack.js.map +1 -0
  141. package/dist/lib/server-wake.d.ts +146 -0
  142. package/dist/lib/server-wake.js +122 -0
  143. package/dist/lib/server-wake.js.map +1 -0
  144. package/dist/lib/translation-review.d.ts +232 -0
  145. package/dist/lib/translation-review.js +194 -0
  146. package/dist/lib/translation-review.js.map +1 -0
  147. package/dist/rhf/fields.d.ts +13 -1
  148. package/dist/rhf/form.d.ts +13 -1
  149. package/dist/rhf.d.ts +13 -1
  150. package/dist/search/global-search.d.ts +3 -1
  151. package/dist/search/global-search.js.map +1 -1
  152. package/dist/shell/app-shell.d.ts +13 -1
  153. package/dist/shell/top-bar-brand.d.ts +13 -1
  154. package/dist/shell/topbar-action-menu.d.ts +2 -0
  155. package/dist/shell.d.ts +13 -1
  156. package/dist/wizard/stepper-nav.d.ts +13 -1
  157. package/dist/wizard.d.ts +13 -1
  158. package/package.json +1 -1
  159. package/src/components/account-chips.tsx +302 -0
  160. package/src/components/account-settings-labels.ts +16 -2
  161. package/src/components/chip.tsx +239 -6
  162. package/src/components/confirm-dialog.tsx +82 -7
  163. package/src/components/danger-confirm.tsx +118 -33
  164. package/src/components/data-table.tsx +20 -0
  165. package/src/components/floating-panel.tsx +19 -1
  166. package/src/components/form-actions.tsx +22 -3
  167. package/src/components/legal.tsx +159 -0
  168. package/src/components/number-field.tsx +32 -26
  169. package/src/components/passkeys-setting.tsx +68 -7
  170. package/src/components/progress-bar.tsx +21 -1
  171. package/src/components/reauth-dialog.tsx +273 -0
  172. package/src/components/server-wake.tsx +156 -0
  173. package/src/components/share-card.tsx +615 -0
  174. package/src/components/toast.tsx +72 -2
  175. package/src/components/toggle-group.tsx +5 -2
  176. package/src/components/translation-review-editor.tsx +261 -0
  177. package/src/components/translation-review-labels.ts +152 -0
  178. package/src/components/translation-review-parts.tsx +269 -0
  179. package/src/components/translation-review.tsx +502 -0
  180. package/src/components/ui.tsx +89 -32
  181. package/src/components/write-lock.tsx +96 -0
  182. package/src/hooks/use-overlay-history.ts +51 -0
  183. package/src/i18n/defaults.ts +14 -0
  184. package/src/i18n/{locales/de.ts → german.ts} +120 -13
  185. package/src/i18n/kit-labels.tsx +29 -2
  186. package/src/i18n/languages.ts +285 -0
  187. package/src/i18n/locales/de-CH.ts +17 -8
  188. package/src/i18n/locales/en.ts +8 -0
  189. package/src/i18n/locales/es.ts +128 -26
  190. package/src/i18n/locales/fr.ts +103 -0
  191. package/src/i18n/locales/hu.ts +107 -0
  192. package/src/i18n/locales/it.ts +135 -33
  193. package/src/i18n/locales/zh.ts +102 -0
  194. package/src/i18n/review.ts +193 -0
  195. package/src/i18n/swiss.ts +3 -3
  196. package/src/index.ts +86 -1
  197. package/src/lib/floating-stack.ts +66 -0
  198. package/src/lib/server-wake.ts +291 -0
  199. package/src/lib/translation-review.ts +465 -0
  200. package/src/search/global-search.tsx +3 -1
  201. package/dist/i18n/locales/de-CH-informal.d.ts +0 -61
  202. package/dist/i18n/locales/de-CH-informal.js +0 -8
  203. package/dist/i18n/locales/de-CH-informal.js.map +0 -1
  204. package/dist/i18n/locales/de-informal.d.ts +0 -82
  205. package/dist/i18n/locales/de-informal.js +0 -37
  206. package/dist/i18n/locales/de-informal.js.map +0 -1
  207. package/dist/i18n/locales/de.d.ts +0 -66
  208. package/dist/i18n/locales/de.js.map +0 -1
  209. package/src/i18n/locales/de-CH-informal.ts +0 -10
  210. package/src/i18n/locales/de-informal.ts +0 -61
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ComponentPropsWithoutRef, ReactNode, Ref, MouseEvent, ReactElement } from 'react';
3
- import { f as ButtonVariant, d as ButtonSize } from '../kit-labels-C4uB_zmg.js';
3
+ import { f as ButtonVariant, d as ButtonSize } from '../kit-labels-D1J2_jyD.js';
4
4
  import './data-table-labels.js';
5
5
  import './mini-calendar.js';
6
6
  import './calendar-heatmap.js';
@@ -51,6 +51,18 @@ import './authed-image.js';
51
51
  import '../hooks/use-authed-src.js';
52
52
  import './image-grid.js';
53
53
  import './lightbox.js';
54
+ import './write-lock.js';
55
+ import './legal.js';
56
+ import './account-chips.js';
57
+ import '../lib/format.js';
58
+ import '../data-table-3mi2R3so.js';
59
+ import './data-table-sort.js';
60
+ import './swipeable-row.js';
61
+ import './reauth-dialog.js';
62
+ import './server-wake.js';
63
+ import '../lib/server-wake.js';
64
+ import './translation-review-labels.js';
65
+ import '../lib/translation-review.js';
54
66
 
55
67
  interface ButtonGroupProps extends Omit<ComponentPropsWithoutRef<"div">, "role"> {
56
68
  /** `horizontal` (default): side by side, in reading order. `vertical`: stacked —
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { C as CalculatorLabels } from '../kit-labels-C4uB_zmg.js';
2
+ import { C as CalculatorLabels } from '../kit-labels-D1J2_jyD.js';
3
3
  import './data-table-labels.js';
4
4
  import './mini-calendar.js';
5
5
  import './calendar-heatmap.js';
@@ -50,6 +50,18 @@ import './authed-image.js';
50
50
  import '../hooks/use-authed-src.js';
51
51
  import './image-grid.js';
52
52
  import './lightbox.js';
53
+ import './write-lock.js';
54
+ import './legal.js';
55
+ import './account-chips.js';
56
+ import '../lib/format.js';
57
+ import '../data-table-3mi2R3so.js';
58
+ import './data-table-sort.js';
59
+ import './swipeable-row.js';
60
+ import './reauth-dialog.js';
61
+ import './server-wake.js';
62
+ import '../lib/server-wake.js';
63
+ import './translation-review-labels.js';
64
+ import '../lib/translation-review.js';
53
65
 
54
66
  /** Screen-reader names for the calculator panel's own controls — any part of the
55
67
  * kit's `calculator` namespace. Once three optional keys of its own; widened, not
@@ -74,6 +74,13 @@ interface ChipLinkProps {
74
74
  [key: `aria-${string}`]: string | boolean | number | undefined;
75
75
  [key: `data-${string}`]: unknown;
76
76
  }
77
+ /**
78
+ * Re-snap every chip rendered with `snapEdges`, now. The kit already re-snaps when a
79
+ * chip renders, resizes, or the window or the ratio changes; call this after moving
80
+ * chips some other way (a side panel sliding in beside a table of status chips),
81
+ * since a move is not something an observer can see.
82
+ */
83
+ declare function refreshChipEdges(): void;
77
84
  interface ChipBaseProps {
78
85
  children: ReactNode;
79
86
  tone?: ChipTone;
@@ -156,6 +163,23 @@ interface ChipBaseProps {
156
163
  id?: string;
157
164
  /** A native tooltip. For anything a user must read, prefer the kit's `Tooltip`. */
158
165
  title?: string;
166
+ /**
167
+ * Even hairlines on fractional-ratio displays (0.18.0). At a device-pixel ratio of
168
+ * 1.25 — a 125 % Windows display, or 125 % zoom — Chrome draws a chip's two 1px
169
+ * side borders on different sub-pixel phases, one crisp and one a half-strength
170
+ * smear that reads as a thinner line (worst on the 60 %-alpha `danger` border).
171
+ * `snapEdges` widens the chip by under 4px, from where it sits, so the two edges
172
+ * rasterise as mirror images, and centres its content in the extra.
173
+ *
174
+ * Off by default: it reads the chip's position (batched for every snapped chip into
175
+ * one pass a frame, through one shared observer), and the fix is only as fresh as the
176
+ * last pass — it re-snaps on render, resize, zoom and ratio change, but not when
177
+ * something else moves the chip; call {@link refreshChipEdges} then. At an integer
178
+ * ratio, and at 1.5, it writes nothing. Turn it on for status chips that sit in a
179
+ * column and are compared side by side; a chip with no visible border (`dot`) has
180
+ * nothing to snap.
181
+ */
182
+ snapEdges?: boolean;
159
183
  }
160
184
  /**
161
185
  * A chip is a link OR a button, never both — so the types say so. Before 0.7.0 both were
@@ -280,4 +304,4 @@ interface ChipInputProps extends Omit<ComponentPropsWithoutRef<"div">, "onChange
280
304
  */
281
305
  declare function ChipInput({ value, onChange, placeholder, label, ariaLabel, validate, separators, allowDuplicates, max, tone, size, disabled, invalid, error, labels, className, "aria-label": ariaLabelAttr, ...rest }: ChipInputProps): react.JSX.Element;
282
306
 
283
- export { Chip, type ChipHue, ChipInput, type ChipInputLabels, type ChipInputProps, type ChipLinkProps, type ChipProps, type ChipShape, type ChipSize, type ChipTone, type ChipVariant, DEFAULT_CHIP_INPUT_LABELS, resolveChipInputLabels };
307
+ export { Chip, type ChipHue, ChipInput, type ChipInputLabels, type ChipInputProps, type ChipLinkProps, type ChipProps, type ChipShape, type ChipSize, type ChipTone, type ChipVariant, DEFAULT_CHIP_INPUT_LABELS, refreshChipEdges, resolveChipInputLabels };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { forwardRef, isValidElement, useId, useRef, useState } from "react";
3
+ import { forwardRef, isValidElement, useCallback, useId, useLayoutEffect, useRef, useState } from "react";
4
4
  import { Check, X } from "lucide-react";
5
5
  import { cn } from "../lib/cn.js";
6
6
  import { horizontalStep } from "../lib/direction.js";
@@ -160,6 +160,130 @@ const SIZE = {
160
160
  remove: "size-4"
161
161
  }
162
162
  };
163
+ function chipEdgeGrid(dpr) {
164
+ for (let n = 1; n <= 4; n++) if (Math.abs(n * dpr - Math.round(n * dpr)) < 1e-3) return n;
165
+ return 0;
166
+ }
167
+ function snappedChipEdgeWidth(natural, left, dpr) {
168
+ const n = chipEdgeGrid(dpr);
169
+ if (n <= 2) return natural;
170
+ const l = Math.round(left);
171
+ let w = Math.ceil(natural - 0.01);
172
+ while (((2 * l + w) % n + n) % n !== 0) w++;
173
+ return w;
174
+ }
175
+ const snapped = /* @__PURE__ */ new Set();
176
+ const written = /* @__PURE__ */ new WeakMap();
177
+ let snapFrame = 0;
178
+ let snapObserver = null;
179
+ let ratioQuery = null;
180
+ function clearOwn(el) {
181
+ const own = written.get(el);
182
+ if (own !== void 0 && el.style.minWidth === own) el.style.minWidth = "";
183
+ written.delete(el);
184
+ }
185
+ function refreshChipEdges() {
186
+ if (snapFrame) {
187
+ cancelAnimationFrame(snapFrame);
188
+ snapFrame = 0;
189
+ }
190
+ if (typeof window === "undefined" || !snapped.size) return;
191
+ const dpr = window.devicePixelRatio || 1;
192
+ const els = [...snapped];
193
+ for (const el of els) clearOwn(el);
194
+ const n = chipEdgeGrid(dpr);
195
+ if (n <= 2) return;
196
+ let pending = els;
197
+ for (let pass = 0; pass <= n && pending.length; pass++) {
198
+ const reads = pending.map((el) => {
199
+ const r = el.getBoundingClientRect();
200
+ const label = el.querySelector(".truncate");
201
+ if (!r.width || label && label.scrollWidth > label.clientWidth) return null;
202
+ const width = Math.round(r.width * 64) / 64;
203
+ const target = snappedChipEdgeWidth(width, r.left + window.scrollX, dpr);
204
+ return target === width ? null : target;
205
+ });
206
+ const next = [];
207
+ pending.forEach((el, i) => {
208
+ const target = reads[i];
209
+ if (target == null) return;
210
+ if (pass === n) {
211
+ clearOwn(el);
212
+ return;
213
+ }
214
+ const own = written.get(el);
215
+ const value = `${pass > 0 && own !== void 0 ? parseFloat(own) + 1 : target}px`;
216
+ el.style.minWidth = value;
217
+ written.set(el, value);
218
+ next.push(el);
219
+ });
220
+ pending = next;
221
+ }
222
+ }
223
+ function scheduleChipEdges() {
224
+ if (snapFrame || typeof requestAnimationFrame === "undefined") return;
225
+ snapFrame = requestAnimationFrame(() => {
226
+ snapFrame = 0;
227
+ refreshChipEdges();
228
+ });
229
+ }
230
+ function watchRatio() {
231
+ ratioQuery?.removeEventListener("change", onRatioChange);
232
+ ratioQuery = typeof window.matchMedia === "function" ? window.matchMedia(`(resolution: ${window.devicePixelRatio || 1}dppx)`) : null;
233
+ ratioQuery?.addEventListener("change", onRatioChange);
234
+ }
235
+ function onRatioChange() {
236
+ watchRatio();
237
+ scheduleChipEdges();
238
+ }
239
+ function registerSnap(el) {
240
+ if (snapped.has(el)) return;
241
+ if (!snapped.size) {
242
+ if (typeof ResizeObserver !== "undefined") snapObserver = new ResizeObserver(scheduleChipEdges);
243
+ window.addEventListener("resize", scheduleChipEdges);
244
+ watchRatio();
245
+ }
246
+ snapped.add(el);
247
+ snapObserver?.observe(el);
248
+ scheduleChipEdges();
249
+ }
250
+ function unregisterSnap(el) {
251
+ if (!snapped.delete(el)) return;
252
+ snapObserver?.unobserve(el);
253
+ clearOwn(el);
254
+ if (snapped.size) return;
255
+ snapObserver?.disconnect();
256
+ snapObserver = null;
257
+ window.removeEventListener("resize", scheduleChipEdges);
258
+ ratioQuery?.removeEventListener("change", onRatioChange);
259
+ ratioQuery = null;
260
+ }
261
+ function useSnapEdges(on) {
262
+ const node = useRef(null);
263
+ const ref = useCallback(
264
+ (el) => {
265
+ if (el === node.current) return;
266
+ const prev = node.current;
267
+ node.current = el;
268
+ if (prev) queueMicrotask(() => node.current !== prev && unregisterSnap(prev));
269
+ if (el && on) registerSnap(el);
270
+ },
271
+ [on]
272
+ );
273
+ useLayoutEffect(() => {
274
+ const el = node.current;
275
+ if (!el) return;
276
+ if (on) {
277
+ registerSnap(el);
278
+ scheduleChipEdges();
279
+ } else unregisterSnap(el);
280
+ });
281
+ return ref;
282
+ }
283
+ function assignRef(target, value) {
284
+ if (typeof target === "function") target(value);
285
+ else if (target) target.current = value;
286
+ }
163
287
  const CHIP_PILL = "inline-flex max-w-full items-center rounded-full border transition-colors";
164
288
  const CHIP_RING = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--bg-surface)]";
165
289
  const CHIP_BASE = `${CHIP_PILL} ${CHIP_RING}`;
@@ -185,6 +309,7 @@ const Chip = forwardRef(function Chip2({
185
309
  role,
186
310
  onKeyDown,
187
311
  onFocus,
312
+ snapEdges = false,
188
313
  ...rest
189
314
  }, ref) {
190
315
  const common = useKitLabels("common", DEFAULT_COMMON_LABELS, { remove: removeLabel });
@@ -198,6 +323,15 @@ const Chip = forwardRef(function Chip2({
198
323
  surfaceOf(tone, variant, selected),
199
324
  disabled && "cursor-default opacity-50"
200
325
  );
326
+ const snap = snapEdges && !dot;
327
+ const snapRef = useSnapEdges(snap);
328
+ const ownRef = useCallback(
329
+ (el) => {
330
+ snapRef(el);
331
+ assignRef(ref, el);
332
+ },
333
+ [snapRef, ref]
334
+ );
201
335
  const look = cn(
202
336
  CHIP_BASE,
203
337
  s.body,
@@ -207,6 +341,8 @@ const Chip = forwardRef(function Chip2({
207
341
  interactive && !disabled && "cursor-pointer hover:brightness-[0.97] dark:hover:brightness-110",
208
342
  // An inert dot chip is text in a column: no inset, so it aligns with the header.
209
343
  dot && !interactive && "px-0",
344
+ // The under-4px a snap adds is split between the two sides, not stacked at the end.
345
+ snap && "justify-center",
210
346
  className
211
347
  );
212
348
  const isCheckbox = checkbox && !!onClick && !href;
@@ -261,7 +397,7 @@ const Chip = forwardRef(function Chip2({
261
397
  children: /* @__PURE__ */ jsx(X, { className: s.remove, "aria-hidden": true })
262
398
  }
263
399
  ) : null;
264
- const pill = (inner2) => /* @__PURE__ */ jsxs("span", { className: cn(CHIP_PILL, s.tail, radius, surface, className), children: [
400
+ const pill = (inner2) => /* @__PURE__ */ jsxs("span", { ref: snap ? snapRef : void 0, className: cn(CHIP_PILL, s.tail, radius, surface, snap && "justify-center", className), children: [
265
401
  inner2,
266
402
  remove
267
403
  ] });
@@ -278,7 +414,7 @@ const Chip = forwardRef(function Chip2({
278
414
  const onLinkClick = onClick;
279
415
  const linkProps = {
280
416
  ...rest,
281
- ref,
417
+ ref: remove ? ref : ownRef,
282
418
  href,
283
419
  onClick: onLinkClick,
284
420
  "aria-current": selected ? "true" : void 0,
@@ -293,7 +429,7 @@ const Chip = forwardRef(function Chip2({
293
429
  ) : /* @__PURE__ */ jsx(
294
430
  "a",
295
431
  {
296
- ref,
432
+ ref: remove ? ref : ownRef,
297
433
  href,
298
434
  "aria-current": selected ? "true" : void 0,
299
435
  onClick: onLinkClick,
@@ -309,7 +445,7 @@ const Chip = forwardRef(function Chip2({
309
445
  const button = /* @__PURE__ */ jsx(
310
446
  "button",
311
447
  {
312
- ref,
448
+ ref: remove ? ref : ownRef,
313
449
  type: "button",
314
450
  onClick: onButtonClick,
315
451
  disabled,
@@ -330,7 +466,7 @@ const Chip = forwardRef(function Chip2({
330
466
  /* @__PURE__ */ jsxs(
331
467
  "span",
332
468
  {
333
- ref,
469
+ ref: ownRef,
334
470
  className: look,
335
471
  tabIndex,
336
472
  role,
@@ -566,6 +702,7 @@ export {
566
702
  Chip,
567
703
  ChipInput,
568
704
  DEFAULT_CHIP_INPUT_LABELS,
705
+ refreshChipEdges,
569
706
  resolveChipInputLabels
570
707
  };
571
708
  //# sourceMappingURL=chip.js.map