@threadlabs/looma 0.1.27 → 0.1.28

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 (87) hide show
  1. package/dist/{chunk-RLELJVBL.js → chunk-G5AWV77V.js} +33 -33
  2. package/dist/{chunk-YHXJC5M5.js → chunk-M7FPK6GN.js} +17 -12
  3. package/dist/cjs/{positioning-i0WrCAdF.js → positioning-D5q9DM-0.js} +19 -12
  4. package/dist/cjs/ui-affordance-scope.cjs.entry.js +1 -1
  5. package/dist/cjs/ui-chip_2.cjs.entry.js +1 -1
  6. package/dist/cjs/ui-context-menu.cjs.entry.js +1 -1
  7. package/dist/cjs/ui-dialog.cjs.entry.js +1 -1
  8. package/dist/cjs/ui-menu.cjs.entry.js +2 -2
  9. package/dist/cjs/ui-popover.cjs.entry.js +2 -2
  10. package/dist/cjs/ui-toast-region.cjs.entry.js +1 -1
  11. package/dist/cjs/ui-tooltip.cjs.entry.js +1 -1
  12. package/dist/collection/components/ui-dialog/ui-dialog.css +1 -0
  13. package/dist/collection/components/ui-menu/ui-menu.css +7 -2
  14. package/dist/collection/components/ui-popover/ui-popover.css +6 -2
  15. package/dist/collection/overlay/positioning.js +21 -14
  16. package/dist/components/{p-DZRtXH6j.js → p-B1macZOS.js} +1 -1
  17. package/dist/components/{p-BKzrrab4.js → p-DiyiodGX.js} +1 -1
  18. package/dist/components/p-Drw41pSY.js +1 -0
  19. package/dist/components/{p-D0wBI-9r.js → p-d5fk1vBI.js} +1 -1
  20. package/dist/components/ui-affordance-scope.js +1 -1
  21. package/dist/components/ui-combobox.js +1 -1
  22. package/dist/components/ui-context-menu.js +1 -1
  23. package/dist/components/ui-dialog.js +1 -1
  24. package/dist/components/ui-menu.js +1 -1
  25. package/dist/components/ui-multi-combobox.js +1 -1
  26. package/dist/components/ui-popover.js +1 -1
  27. package/dist/components/ui-toast-region.js +1 -1
  28. package/dist/components/ui-tooltip.js +1 -1
  29. package/dist/esm/{positioning-Bu0dmLBE.js → positioning-Drmwg-C1.js} +19 -12
  30. package/dist/esm/ui-affordance-scope.entry.js +1 -1
  31. package/dist/esm/ui-chip_2.entry.js +1 -1
  32. package/dist/esm/ui-context-menu.entry.js +1 -1
  33. package/dist/esm/ui-dialog.entry.js +1 -1
  34. package/dist/esm/ui-menu.entry.js +2 -2
  35. package/dist/esm/ui-popover.entry.js +2 -2
  36. package/dist/esm/ui-toast-region.entry.js +1 -1
  37. package/dist/esm/ui-tooltip.entry.js +1 -1
  38. package/dist/index.cjs +54 -36
  39. package/dist/index.js +26 -13
  40. package/dist/looma/looma.esm.js +1 -1
  41. package/dist/looma/{p-0fd60103.entry.js → p-311e54d4.entry.js} +1 -1
  42. package/dist/looma/{p-72338f53.entry.js → p-32c85198.entry.js} +1 -1
  43. package/dist/looma/{p-a939c00f.entry.js → p-3957f7ef.entry.js} +1 -1
  44. package/dist/looma/{p-66c6b6dd.entry.js → p-4a10a875.entry.js} +1 -1
  45. package/dist/looma/{p-77dcfa6f.entry.js → p-4f68f939.entry.js} +1 -1
  46. package/dist/looma/p-63a9159f.entry.js +1 -0
  47. package/dist/looma/{p-85a6716e.entry.js → p-82de1112.entry.js} +1 -1
  48. package/dist/looma/{p-b75aff63.entry.js → p-88e61cab.entry.js} +1 -1
  49. package/dist/looma/p-Drmwg-C1.js +1 -0
  50. package/dist/{ui-affordance-scope.entry-7H6GIQEK.js → ui-affordance-scope.entry-X5526PRP.js} +2 -2
  51. package/dist/{ui-avatar-group.entry-QB25IUWA.js → ui-avatar-group.entry-U72MPB5K.js} +1 -1
  52. package/dist/{ui-avatar.entry-L377CWPR.js → ui-avatar.entry-OC4J3LTV.js} +1 -1
  53. package/dist/{ui-badge.entry-QHC3KI5S.js → ui-badge.entry-4MSUQRQV.js} +1 -1
  54. package/dist/{ui-button.entry-MZGTPU22.js → ui-button.entry-22DESWN4.js} +1 -1
  55. package/dist/{ui-callout.entry-2D4LO74K.js → ui-callout.entry-LOGODDM5.js} +1 -1
  56. package/dist/{ui-checkbox.entry-B2O5DREC.js → ui-checkbox.entry-XAGW3BW4.js} +1 -1
  57. package/dist/{ui-chip_2.entry-OOSON72O.js → ui-chip_2.entry-JCPHPXAG.js} +2 -2
  58. package/dist/{ui-context-menu.entry-UY76G7HM.js → ui-context-menu.entry-24YOHF7L.js} +2 -2
  59. package/dist/{ui-dialog.entry-345V7IJ3.js → ui-dialog.entry-XKNYDWOQ.js} +2 -2
  60. package/dist/{ui-disclosure.entry-RUU7VNDN.js → ui-disclosure.entry-2AWCGZ4C.js} +1 -1
  61. package/dist/{ui-editable.entry-WWFFHOMP.js → ui-editable.entry-HLEWO7BN.js} +1 -1
  62. package/dist/{ui-floating-action-button.entry-Y2TLDJO4.js → ui-floating-action-button.entry-2NJDB4YN.js} +1 -1
  63. package/dist/{ui-form-field.entry-C63GZMQR.js → ui-form-field.entry-FJ5HYCTN.js} +1 -1
  64. package/dist/{ui-icon-button.entry-35MJYYEI.js → ui-icon-button.entry-YZHJQ5YR.js} +1 -1
  65. package/dist/{ui-input.entry-3FAXEH5M.js → ui-input.entry-JMBLMNP6.js} +1 -1
  66. package/dist/{ui-menu-item.entry-3J42XLCJ.js → ui-menu-item.entry-VBGXM66D.js} +1 -1
  67. package/dist/{ui-menu.entry-YDABO3OO.js → ui-menu.entry-I2N5H3YC.js} +3 -3
  68. package/dist/{ui-multi-combobox.entry-XXLS4V3I.js → ui-multi-combobox.entry-MEX7MU7P.js} +1 -1
  69. package/dist/{ui-popover.entry-YP7R6FQO.js → ui-popover.entry-7JRSJM5S.js} +3 -3
  70. package/dist/{ui-radio-group.entry-TYXAN7G5.js → ui-radio-group.entry-Q2XB7P3B.js} +1 -1
  71. package/dist/{ui-radio.entry-JW7HX3LW.js → ui-radio.entry-NJO4NA4M.js} +1 -1
  72. package/dist/{ui-search-result-row.entry-MKQYGNFO.js → ui-search-result-row.entry-RPMNDSRN.js} +1 -1
  73. package/dist/{ui-search-shell.entry-KHIQTT4J.js → ui-search-shell.entry-FMIMYD3B.js} +1 -1
  74. package/dist/{ui-select.entry-R235Y3IL.js → ui-select.entry-7NDBWNAU.js} +1 -1
  75. package/dist/{ui-switch.entry-BJ6FIEPB.js → ui-switch.entry-YUCPIZE4.js} +1 -1
  76. package/dist/{ui-tabs.entry-ZBP3FLR2.js → ui-tabs.entry-FXZWV665.js} +1 -1
  77. package/dist/{ui-textarea.entry-2YW7TCEU.js → ui-textarea.entry-HHLQR5GG.js} +1 -1
  78. package/dist/{ui-toast-region.entry-ZSCMMIKQ.js → ui-toast-region.entry-PIIBHNYA.js} +2 -2
  79. package/dist/{ui-tooltip.entry-VG4AWEBD.js → ui-tooltip.entry-AQ6UPBUP.js} +2 -2
  80. package/dist/{ui-top-bar.entry-CZW3MLC6.js → ui-top-bar.entry-S2L7ZM4U.js} +1 -1
  81. package/dist/{ui-tree-item.entry-CU2SWAOK.js → ui-tree-item.entry-UID7IJPA.js} +1 -1
  82. package/dist/{ui-tree.entry-M6KXK7GJ.js → ui-tree.entry-UMD3DNG5.js} +1 -1
  83. package/package.json +1 -1
  84. package/styles.css +6 -4
  85. package/dist/components/p-DOulVJT7.js +0 -1
  86. package/dist/looma/p-8f102407.entry.js +0 -1
  87. package/dist/looma/p-Bu0dmLBE.js +0 -1
package/dist/index.cjs CHANGED
@@ -24,7 +24,7 @@ var __copyProps = (to, from, except, desc) => {
24
24
  };
25
25
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
26
 
27
- // dist/esm/positioning-Bu0dmLBE.js
27
+ // dist/esm/positioning-Drmwg-C1.js
28
28
  function bindAnchorName(anchor, name) {
29
29
  const binding = anchorBindings.get(anchor) ?? {
30
30
  original: anchor.style.getPropertyValue("anchor-name"),
@@ -96,22 +96,21 @@ function createViewportSurface(surface) {
96
96
  }
97
97
  };
98
98
  }
99
- function fallbackPosition(surface, anchor, placement, gap, viewportGap) {
99
+ function fallbackPosition(surface, anchor, placement, gap, viewportGap, surfaceRect = surface.getBoundingClientRect()) {
100
100
  const owner = surface.ownerDocument.defaultView ?? window;
101
101
  const viewport = getVisualViewportRect(owner);
102
- const rect = surface.getBoundingClientRect();
103
102
  const preferTop = placement.startsWith("top");
104
103
  const preferEnd = placement.endsWith("end");
105
104
  const spaceBelow = viewport.bottom - anchor.bottom - viewportGap;
106
105
  const spaceAbove = anchor.top - viewport.top - viewportGap;
107
- const useTop = preferTop ? !(spaceAbove < rect.height + gap && spaceBelow > spaceAbove) : spaceBelow < rect.height + gap && spaceAbove > spaceBelow;
108
- const unclampedTop = useTop ? anchor.top - rect.height - gap : anchor.bottom + gap;
109
- const unclampedLeft = preferEnd ? anchor.right - rect.width : anchor.left;
106
+ const useTop = preferTop ? !(spaceAbove < surfaceRect.height + gap && spaceBelow > spaceAbove) : spaceBelow < surfaceRect.height + gap && spaceAbove > spaceBelow;
107
+ const unclampedTop = useTop ? anchor.top - surfaceRect.height - gap : anchor.bottom + gap;
108
+ const unclampedLeft = preferEnd ? anchor.right - surfaceRect.width : anchor.left;
110
109
  const shifted = clampRectToViewport({
111
110
  left: unclampedLeft,
112
111
  top: unclampedTop,
113
- width: rect.width,
114
- height: rect.height
112
+ width: surfaceRect.width,
113
+ height: surfaceRect.height
115
114
  }, viewport, viewportGap);
116
115
  surface.style.left = `${Math.round(unclampedLeft + shifted.x)}px`;
117
116
  surface.style.top = `${Math.round(unclampedTop + shifted.y)}px`;
@@ -169,10 +168,16 @@ function createAnchoredSurface(surface, options = {}) {
169
168
  }
170
169
  if (!anchor)
171
170
  return;
172
- if (nativeAnchor)
171
+ let surfaceRect;
172
+ if (nativeAnchor) {
173
173
  positionNative();
174
- else
175
- fallbackPosition(surface, anchor.getBoundingClientRect(), placement, gap, viewportGap);
174
+ const viewport = getVisualViewportRect(owner);
175
+ surfaceRect = surface.getBoundingClientRect();
176
+ const shift = clampRectToViewport(surfaceRect, viewport, viewportGap);
177
+ if (shift.x === 0 && shift.y === 0)
178
+ return;
179
+ }
180
+ fallbackPosition(surface, anchor.getBoundingClientRect(), placement, gap, viewportGap, surfaceRect);
176
181
  };
177
182
  const schedule = () => {
178
183
  if (!open || frame !== null)
@@ -180,7 +185,7 @@ function createAnchoredSurface(surface, options = {}) {
180
185
  frame = owner.requestAnimationFrame(position);
181
186
  };
182
187
  const syncFallbackListeners = () => {
183
- const needsListeners = open && (point !== null || !nativeAnchor);
188
+ const needsListeners = open && (point !== null || anchor !== null);
184
189
  if (!needsListeners) {
185
190
  listenerAbort?.abort();
186
191
  listenerAbort = null;
@@ -356,8 +361,8 @@ function createProximityCoordinator(scope, options = {}) {
356
361
  };
357
362
  }
358
363
  var DEFAULT_AFFORDANCE_NEAR_RADIUS, anchorSequence, anchorBindings;
359
- var init_positioning_Bu0dmLBE = __esm({
360
- "dist/esm/positioning-Bu0dmLBE.js"() {
364
+ var init_positioning_Drmwg_C1 = __esm({
365
+ "dist/esm/positioning-Drmwg-C1.js"() {
361
366
  DEFAULT_AFFORDANCE_NEAR_RADIUS = 16;
362
367
  anchorSequence = 0;
363
368
  anchorBindings = /* @__PURE__ */ new WeakMap();
@@ -373,7 +378,7 @@ var uiAffordanceScopeCss, UIAffordanceScope;
373
378
  var init_ui_affordance_scope_entry = __esm({
374
379
  "dist/esm/ui-affordance-scope.entry.js"() {
375
380
  init_index_8BGiMGQ0();
376
- init_positioning_Bu0dmLBE();
381
+ init_positioning_Drmwg_C1();
377
382
  uiAffordanceScopeCss = () => `:host{display:contents;--ui-affordance-scope-engaged:0}:host([data-ui-interaction='engaged']){--ui-affordance-scope-engaged:1}`;
378
383
  UIAffordanceScope = class {
379
384
  constructor(hostRef) {
@@ -1269,7 +1274,7 @@ var uiChipCss, UIChip, uiComboboxCss, UICombobox;
1269
1274
  var init_ui_chip_2_entry = __esm({
1270
1275
  "dist/esm/ui-chip_2.entry.js"() {
1271
1276
  init_index_8BGiMGQ0();
1272
- init_positioning_Bu0dmLBE();
1277
+ init_positioning_Drmwg_C1();
1273
1278
  init_manager_C_0syqXZ();
1274
1279
  uiChipCss = () => `:host{--ui-chip-surface:var(--ui-surface-subtle);--ui-chip-text:var(--ui-text-secondary);--ui-chip-border:var(--ui-border-default);--ui-chip-font-size:var(--ui-font-size-xs);--ui-chip-font-weight:var(--ui-font-normal);--ui-chip-line-height:var(--ui-line-height-tight);--ui-chip-padding-block:var(--ui-space-0-5);--ui-chip-padding-inline:var(--ui-space-2);--ui-chip-notch:var(--ui-space-1);display:inline-flex;min-width:0;max-width:100%}:host([data-size='sm']){--ui-chip-font-size:var(--ui-font-size-sm)}.chip__surface{display:inline-flex;align-items:center;box-sizing:border-box;min-width:0;max-width:100%;padding:var(--ui-chip-padding-block) var(--ui-chip-padding-inline);border:1px solid var(--ui-chip-border);background:var(--ui-chip-surface);color:var(--ui-chip-text) !important;font-family:var(--ui-font-family-sans) !important;font-size:var(--ui-chip-font-size) !important;font-weight:var(--ui-chip-font-weight) !important;line-height:var(--ui-chip-line-height) !important}.chip__label{min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([data-appearance='pill']) .chip__surface{border-radius:var(--ui-radius-round)}:host([data-appearance='tag']) .chip__surface{border:0;padding-inline-end:calc(var(--ui-chip-padding-inline) + var(--ui-chip-notch));clip-path:polygon(0 0, calc(100% - var(--ui-chip-notch)) 0, 100% 50%, calc(100% - var(--ui-chip-notch)) 100%, 0 100%)}`;
1275
1280
  UIChip = class {
@@ -1786,7 +1791,7 @@ var init_ui_context_menu_entry = __esm({
1786
1791
  init_index_8BGiMGQ0();
1787
1792
  init_manager_C_0syqXZ();
1788
1793
  init_events_JwSoedEO();
1789
- init_positioning_Bu0dmLBE();
1794
+ init_positioning_Drmwg_C1();
1790
1795
  uiContextMenuCss = () => `:host{display:contents}:host([data-focus-trigger='pointer']) ::slotted(ui-menu-item:focus){outline:none}.menu{position:fixed;inset:auto;margin:0;z-index:var(--ui-z-overlay, 1000);min-width:12rem;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}.menu:popover-open{opacity:1;transform:translateY(0) scale(1)}@starting-style{.menu:popover-open{opacity:0;transform:translateY(-4px) scale(0.99)}}.menu[hidden]{display:none !important}@media (prefers-reduced-motion: reduce){.menu{transition:none}}`;
1791
1796
  UIContextMenu = class {
1792
1797
  constructor(hostRef) {
@@ -2028,7 +2033,7 @@ var init_ui_dialog_entry = __esm({
2028
2033
  init_manager_C_0syqXZ();
2029
2034
  init_events_JwSoedEO();
2030
2035
  init_controlled_state_BnGhGgTH();
2031
- uiDialogCss = () => `:host{display:block}:host:not([data-open]){display:none}:host dialog{--ui-dialog-duration:var(--ui-motion-base);--ui-dialog-viewport-gap:var(--ui-space-4, 1rem);position:fixed;inset:0;inline-size:min( calc(100% - (var(--ui-dialog-viewport-gap) * 2)), var(--ui-dialog-max-width, 440px) );max-inline-size:none;max-block-size:calc(100dvh - (var(--ui-dialog-viewport-gap) * 2));margin:auto;padding:var(--ui-space-4);overflow:auto;background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-dialog);box-shadow:var(--ui-shadow-dialog);visibility:hidden;pointer-events:none;opacity:0;transform:scale(0.96);transition:opacity var(--ui-dialog-duration) var(--ui-motion-ease), transform var(--ui-dialog-duration) var(--ui-motion-ease), visibility var(--ui-dialog-duration), display var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete, overlay var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete}:host dialog[open]{visibility:visible;pointer-events:auto;opacity:1;transform:scale(1);animation:ui-dialog-enter var(--ui-dialog-duration) var(--ui-motion-ease)}@keyframes ui-dialog-enter{from{opacity:0;transform:scale(0.96)}}:host dialog::backdrop{background-color:transparent;transition:background-color var(--ui-dialog-duration) var(--ui-motion-ease), display var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete, overlay var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete}:host dialog[open]::backdrop{background-color:var(--ui-overlay-backdrop);animation:ui-dialog-backdrop-enter var(--ui-dialog-duration) var(--ui-motion-ease)}@keyframes ui-dialog-backdrop-enter{from{background-color:transparent}}`;
2036
+ uiDialogCss = () => `:host{display:block}:host:not([data-open]){display:none}:host dialog{--ui-dialog-duration:var(--ui-motion-base);--ui-dialog-viewport-gap:var(--ui-space-4, 1rem);position:fixed;inset:0;box-sizing:border-box;inline-size:min( calc(100% - (var(--ui-dialog-viewport-gap) * 2)), var(--ui-dialog-max-width, 440px) );max-inline-size:none;max-block-size:calc(100dvh - (var(--ui-dialog-viewport-gap) * 2));margin:auto;padding:var(--ui-space-4);overflow:auto;background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-dialog);box-shadow:var(--ui-shadow-dialog);visibility:hidden;pointer-events:none;opacity:0;transform:scale(0.96);transition:opacity var(--ui-dialog-duration) var(--ui-motion-ease), transform var(--ui-dialog-duration) var(--ui-motion-ease), visibility var(--ui-dialog-duration), display var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete, overlay var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete}:host dialog[open]{visibility:visible;pointer-events:auto;opacity:1;transform:scale(1);animation:ui-dialog-enter var(--ui-dialog-duration) var(--ui-motion-ease)}@keyframes ui-dialog-enter{from{opacity:0;transform:scale(0.96)}}:host dialog::backdrop{background-color:transparent;transition:background-color var(--ui-dialog-duration) var(--ui-motion-ease), display var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete, overlay var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete}:host dialog[open]::backdrop{background-color:var(--ui-overlay-backdrop);animation:ui-dialog-backdrop-enter var(--ui-dialog-duration) var(--ui-motion-ease)}@keyframes ui-dialog-backdrop-enter{from{background-color:transparent}}`;
2032
2037
  UIDialog = class {
2033
2038
  constructor(hostRef) {
2034
2039
  registerInstance(this, hostRef);
@@ -2711,8 +2716,8 @@ var init_ui_menu_entry = __esm({
2711
2716
  init_events_JwSoedEO();
2712
2717
  init_manager_C_0syqXZ();
2713
2718
  init_controlled_state_BnGhGgTH();
2714
- init_positioning_Bu0dmLBE();
2715
- uiMenuCss = () => `:host{--ui-menu-viewport-gap:var(--ui-space-2, 0.5rem);display:flex;flex-direction:column;box-sizing:border-box;inline-size:max-content;min-inline-size:min(12rem, calc(100vw - (var(--ui-menu-viewport-gap) * 2)));max-inline-size:calc(100vw - (var(--ui-menu-viewport-gap) * 2));padding:0;border:0;border-radius:0;background:transparent;box-shadow:var(--ui-shadow-lg)}.menu__surface{display:flex;flex-direction:column;box-sizing:border-box;padding:var(--ui-space-1);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;overflow:auto;max-block-size:calc(100dvh - (var(--ui-menu-viewport-gap) * 2));opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}::slotted(ui-menu-item){display:block;width:100%}`;
2719
+ init_positioning_Drmwg_C1();
2720
+ uiMenuCss = () => `:host{--ui-menu-viewport-gap:var(--ui-space-2, 0.5rem);display:flex;flex-direction:column;box-sizing:border-box;inline-size:max-content;min-inline-size:min(12rem, calc(100vw - (var(--ui-menu-viewport-gap) * 2)));max-inline-size:calc(100vw - (var(--ui-menu-viewport-gap) * 2));padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:visible}.menu__surface{display:flex;flex-direction:column;box-sizing:border-box;max-inline-size:inherit;padding:var(--ui-space-1);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg);max-block-size:inherit;overflow:auto}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;overflow:visible;max-block-size:calc(100dvh - (var(--ui-menu-viewport-gap) * 2));opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}::slotted(ui-menu-item){display:block;width:100%}`;
2716
2721
  UIMenu = class {
2717
2722
  constructor(hostRef) {
2718
2723
  registerInstance(this, hostRef);
@@ -3088,8 +3093,8 @@ var init_ui_popover_entry = __esm({
3088
3093
  init_manager_C_0syqXZ();
3089
3094
  init_events_JwSoedEO();
3090
3095
  init_controlled_state_BnGhGgTH();
3091
- init_positioning_Bu0dmLBE();
3092
- uiPopoverCss = () => `:host{--ui-popover-viewport-gap:var(--ui-space-2, 0.5rem);box-sizing:border-box;max-inline-size:min( 20rem, calc(100vw - (var(--ui-popover-viewport-gap) * 2)) );max-block-size:calc(100dvh - (var(--ui-popover-viewport-gap) * 2));overflow:auto;padding:0;border:0;border-radius:0;background:transparent;box-shadow:var(--ui-shadow-lg)}.popover__surface{box-sizing:border-box;padding:var(--ui-space-3);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}`;
3096
+ init_positioning_Drmwg_C1();
3097
+ uiPopoverCss = () => `:host{--ui-popover-viewport-gap:var(--ui-space-2, 0.5rem);box-sizing:border-box;max-inline-size:min( 20rem, calc(100vw - (var(--ui-popover-viewport-gap) * 2)) );max-block-size:calc(100dvh - (var(--ui-popover-viewport-gap) * 2));overflow:visible;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}.popover__surface{box-sizing:border-box;max-inline-size:inherit;max-block-size:inherit;overflow:auto;padding:var(--ui-space-3);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}`;
3093
3098
  UIPopover = class {
3094
3099
  constructor(hostRef) {
3095
3100
  registerInstance(this, hostRef);
@@ -4005,7 +4010,7 @@ var init_ui_toast_region_entry = __esm({
4005
4010
  "dist/esm/ui-toast-region.entry.js"() {
4006
4011
  init_index_8BGiMGQ0();
4007
4012
  init_events_JwSoedEO();
4008
- init_positioning_Bu0dmLBE();
4013
+ init_positioning_Drmwg_C1();
4009
4014
  uiToastRegionCss = () => `:host{position:fixed;top:calc(var(--ui-space-4) + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:9999;display:grid;gap:var(--ui-space-2);inline-size:min(24rem, calc(100vw - (var(--ui-space-4) * 2)));max-inline-size:100%;pointer-events:none}:host([popover]){right:auto;bottom:auto;margin:0}:host>*{pointer-events:auto}::slotted([data-ui-toast]){display:grid;grid-template-columns:1fr auto;gap:var(--ui-space-2);align-items:start;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);padding:var(--ui-space-3) var(--ui-space-4);background:var(--ui-surface-elevated);color:var(--ui-text-primary);box-shadow:var(--ui-shadow-lg);animation:ui-toast-enter 0.25s var(--ui-motion-ease) forwards}@keyframes ui-toast-enter{from{opacity:0;transform:translateY(-0.5rem)}to{opacity:1;transform:translateY(0)}}::slotted([data-ui-toast][aria-hidden='true']){display:none}::slotted([data-ui-toast-dismiss]){border:0;background:transparent;color:var(--ui-text-secondary);cursor:pointer;font:inherit}`;
4010
4015
  UIToastRegion = class {
4011
4016
  constructor(hostRef) {
@@ -4107,7 +4112,7 @@ var init_ui_tooltip_entry = __esm({
4107
4112
  init_manager_C_0syqXZ();
4108
4113
  init_events_JwSoedEO();
4109
4114
  init_controlled_state_BnGhGgTH();
4110
- init_positioning_Bu0dmLBE();
4115
+ init_positioning_Drmwg_C1();
4111
4116
  uiTooltipCss = () => `:host{position:fixed;inset:auto;margin:0;display:inline-block;box-sizing:border-box;padding:0;border:0;border-radius:0;background:transparent;opacity:0;transform:translateY(4px);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}.tooltip__surface{box-sizing:border-box;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-2);background:var(--ui-surface-elevated);color:var(--ui-text-primary);padding:var(--ui-space-2) var(--ui-space-3);font-size:var(--ui-font-size-sm);box-shadow:var(--ui-shadow-md)}:host(:popover-open){opacity:1;transform:translateY(0)}@starting-style{:host(:popover-open){opacity:0;transform:translateY(4px)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host{transition:none}}`;
4112
4117
  UITooltip = class {
4113
4118
  constructor(hostRef) {
@@ -6851,24 +6856,23 @@ function createViewportSurface2(surface) {
6851
6856
  }
6852
6857
  };
6853
6858
  }
6854
- function fallbackPosition2(surface, anchor, placement, gap, viewportGap) {
6859
+ function fallbackPosition2(surface, anchor, placement, gap, viewportGap, surfaceRect = surface.getBoundingClientRect()) {
6855
6860
  const owner = surface.ownerDocument.defaultView ?? window;
6856
6861
  const viewport = getVisualViewportRect2(owner);
6857
- const rect = surface.getBoundingClientRect();
6858
6862
  const preferTop = placement.startsWith("top");
6859
6863
  const preferEnd = placement.endsWith("end");
6860
6864
  const spaceBelow = viewport.bottom - anchor.bottom - viewportGap;
6861
6865
  const spaceAbove = anchor.top - viewport.top - viewportGap;
6862
- const useTop = preferTop ? !(spaceAbove < rect.height + gap && spaceBelow > spaceAbove) : spaceBelow < rect.height + gap && spaceAbove > spaceBelow;
6863
- const unclampedTop = useTop ? anchor.top - rect.height - gap : anchor.bottom + gap;
6864
- const unclampedLeft = preferEnd ? anchor.right - rect.width : anchor.left;
6866
+ const useTop = preferTop ? !(spaceAbove < surfaceRect.height + gap && spaceBelow > spaceAbove) : spaceBelow < surfaceRect.height + gap && spaceAbove > spaceBelow;
6867
+ const unclampedTop = useTop ? anchor.top - surfaceRect.height - gap : anchor.bottom + gap;
6868
+ const unclampedLeft = preferEnd ? anchor.right - surfaceRect.width : anchor.left;
6865
6869
  const shifted = clampRectToViewport2({
6866
6870
  left: unclampedLeft,
6867
6871
  top: unclampedTop,
6868
- right: unclampedLeft + rect.width,
6869
- bottom: unclampedTop + rect.height,
6870
- width: rect.width,
6871
- height: rect.height
6872
+ right: unclampedLeft + surfaceRect.width,
6873
+ bottom: unclampedTop + surfaceRect.height,
6874
+ width: surfaceRect.width,
6875
+ height: surfaceRect.height
6872
6876
  }, viewport, viewportGap);
6873
6877
  surface.style.left = `${Math.round(unclampedLeft + shifted.x)}px`;
6874
6878
  surface.style.top = `${Math.round(unclampedTop + shifted.y)}px`;
@@ -6925,15 +6929,29 @@ function createAnchoredSurface2(surface, options = {}) {
6925
6929
  return;
6926
6930
  }
6927
6931
  if (!anchor) return;
6928
- if (nativeAnchor) positionNative();
6929
- else fallbackPosition2(surface, anchor.getBoundingClientRect(), placement, gap, viewportGap);
6932
+ let surfaceRect;
6933
+ if (nativeAnchor) {
6934
+ positionNative();
6935
+ const viewport = getVisualViewportRect2(owner);
6936
+ surfaceRect = surface.getBoundingClientRect();
6937
+ const shift = clampRectToViewport2(surfaceRect, viewport, viewportGap);
6938
+ if (shift.x === 0 && shift.y === 0) return;
6939
+ }
6940
+ fallbackPosition2(
6941
+ surface,
6942
+ anchor.getBoundingClientRect(),
6943
+ placement,
6944
+ gap,
6945
+ viewportGap,
6946
+ surfaceRect
6947
+ );
6930
6948
  };
6931
6949
  const schedule = () => {
6932
6950
  if (!open || frame !== null) return;
6933
6951
  frame = owner.requestAnimationFrame(position);
6934
6952
  };
6935
6953
  const syncFallbackListeners = () => {
6936
- const needsListeners = open && (point !== null || !nativeAnchor);
6954
+ const needsListeners = open && (point !== null || anchor !== null);
6937
6955
  if (!needsListeners) {
6938
6956
  listenerAbort?.abort();
6939
6957
  listenerAbort = null;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  bootstrapLazy
3
- } from "./chunk-RLELJVBL.js";
3
+ } from "./chunk-G5AWV77V.js";
4
4
 
5
5
  // dist/esm/app-globals-DQuL1Twl.js
6
6
  var globalScripts = () => {
@@ -206,24 +206,23 @@ function createViewportSurface(surface) {
206
206
  }
207
207
  };
208
208
  }
209
- function fallbackPosition(surface, anchor, placement, gap, viewportGap) {
209
+ function fallbackPosition(surface, anchor, placement, gap, viewportGap, surfaceRect = surface.getBoundingClientRect()) {
210
210
  const owner = surface.ownerDocument.defaultView ?? window;
211
211
  const viewport = getVisualViewportRect(owner);
212
- const rect = surface.getBoundingClientRect();
213
212
  const preferTop = placement.startsWith("top");
214
213
  const preferEnd = placement.endsWith("end");
215
214
  const spaceBelow = viewport.bottom - anchor.bottom - viewportGap;
216
215
  const spaceAbove = anchor.top - viewport.top - viewportGap;
217
- const useTop = preferTop ? !(spaceAbove < rect.height + gap && spaceBelow > spaceAbove) : spaceBelow < rect.height + gap && spaceAbove > spaceBelow;
218
- const unclampedTop = useTop ? anchor.top - rect.height - gap : anchor.bottom + gap;
219
- const unclampedLeft = preferEnd ? anchor.right - rect.width : anchor.left;
216
+ const useTop = preferTop ? !(spaceAbove < surfaceRect.height + gap && spaceBelow > spaceAbove) : spaceBelow < surfaceRect.height + gap && spaceAbove > spaceBelow;
217
+ const unclampedTop = useTop ? anchor.top - surfaceRect.height - gap : anchor.bottom + gap;
218
+ const unclampedLeft = preferEnd ? anchor.right - surfaceRect.width : anchor.left;
220
219
  const shifted = clampRectToViewport({
221
220
  left: unclampedLeft,
222
221
  top: unclampedTop,
223
- right: unclampedLeft + rect.width,
224
- bottom: unclampedTop + rect.height,
225
- width: rect.width,
226
- height: rect.height
222
+ right: unclampedLeft + surfaceRect.width,
223
+ bottom: unclampedTop + surfaceRect.height,
224
+ width: surfaceRect.width,
225
+ height: surfaceRect.height
227
226
  }, viewport, viewportGap);
228
227
  surface.style.left = `${Math.round(unclampedLeft + shifted.x)}px`;
229
228
  surface.style.top = `${Math.round(unclampedTop + shifted.y)}px`;
@@ -280,15 +279,29 @@ function createAnchoredSurface(surface, options = {}) {
280
279
  return;
281
280
  }
282
281
  if (!anchor) return;
283
- if (nativeAnchor) positionNative();
284
- else fallbackPosition(surface, anchor.getBoundingClientRect(), placement, gap, viewportGap);
282
+ let surfaceRect;
283
+ if (nativeAnchor) {
284
+ positionNative();
285
+ const viewport = getVisualViewportRect(owner);
286
+ surfaceRect = surface.getBoundingClientRect();
287
+ const shift = clampRectToViewport(surfaceRect, viewport, viewportGap);
288
+ if (shift.x === 0 && shift.y === 0) return;
289
+ }
290
+ fallbackPosition(
291
+ surface,
292
+ anchor.getBoundingClientRect(),
293
+ placement,
294
+ gap,
295
+ viewportGap,
296
+ surfaceRect
297
+ );
285
298
  };
286
299
  const schedule = () => {
287
300
  if (!open || frame !== null) return;
288
301
  frame = owner.requestAnimationFrame(position);
289
302
  };
290
303
  const syncFallbackListeners = () => {
291
- const needsListeners = open && (point !== null || !nativeAnchor);
304
+ const needsListeners = open && (point !== null || anchor !== null);
292
305
  if (!needsListeners) {
293
306
  listenerAbort?.abort();
294
307
  listenerAbort = null;
@@ -1 +1 @@
1
- import{p as e,b as a}from"./p-8BGiMGQ0.js";export{s as setNonce}from"./p-8BGiMGQ0.js";import{g as n}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,n={};return""!==a&&(n.resourcesUrl=new URL(".",a).href),e(n)})().then((async e=>(await n(),a([["p-caa37be2",[[769,"ui-multi-combobox",{label:[1],placeholder:[1],items:[16],config:[16],query:[1],defaultQuery:[1,"default-query"],tokenSeparators:[16],disabled:[4],readOnly:[4,"readonly"],required:[4],name:[1],raw:[32],rows:[32],focusInput:[64]},null,{query:[{syncQuery:0}]}]]],["p-b75aff63",[[769,"ui-context-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],internalOpen:[32],focusTrigger:[32]},null,{open:[{syncFromProp:0}],for:[{syncTarget:0}],internalOpen:[{syncOverlay:0}]}]]],["p-72338f53",[[769,"ui-affordance-scope",{nearRadius:[514,"near-radius"]},null,{nearRadius:[{connectCoordinator:0}]}]]],["p-08f80207",[[513,"ui-avatar",{src:[1],alt:[1],name:[1],fallback:[1],hasImage:[32]},null,{src:[{watchSrc:0}]}]]],["p-d56571a2",[[769,"ui-avatar-group",{max:[2],label:[1],overflowCount:[32]},null,{max:[{syncOverflow:0}]}]]],["p-5fdcee1d",[[769,"ui-badge",{variant:[1],tone:[1]}]]],["p-7ab661ec",[[769,"ui-button",{variant:[1],size:[1],disabled:[4]},null,{variant:[{syncToButton:0}],size:[{syncToButton:0}],disabled:[{syncToButton:0}]}]]],["p-add67e4c",[[769,"ui-callout",{tone:[1]}]]],["p-9d2662ca",[[769,"ui-checkbox",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],indeterminate:[4],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}],internalChecked:[{syncToInput:0}],indeterminate:[{syncToInput:0}],disabled:[{syncToInput:0}],required:[{syncToInput:0}]}]]],["p-77dcfa6f",[[769,"ui-dialog",{open:[4],defaultOpen:[4,"default-open"],modal:[4],dismissible:[4],label:[1],internalOpen:[32],accessibleLabel:[32]},null,{open:[{syncFromProp:0}],label:[{syncLabelFromProp:0}],internalOpen:[{syncOpen:0}]}]]],["p-1e1de77f",[[769,"ui-disclosure",{open:[4],defaultOpen:[4,"default-open"],disabled:[4],internalOpen:[32],contentId:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{syncState:0}]}]]],["p-4fc9917f",[[769,"ui-editable",{edit:[4],defaultEdit:[4,"default-edit"],disabled:[4],internalEdit:[32]},null,{edit:[{syncFromProp:0}]}]]],["p-e07e6ac2",[[769,"ui-floating-action-button",{disabled:[516],mobileOnly:[516,"mobile-only"],label:[1]}]]],["p-2f3c1b57",[[769,"ui-form-field",{invalid:[4],disabled:[4],required:[4]}]]],["p-607c3056",[[769,"ui-icon-button",{disabled:[516],label:[1],size:[513],variant:[513],anticipatory:[516]}]]],["p-071c139c",[[769,"ui-input",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],readOnly:[4,"readonly"],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToInput:0}],defaultValue:[{syncToInput:0}],disabled:[{syncToInput:0}],invalid:[{syncToInput:0}],readOnly:[{syncToInput:0}]}]]],["p-b68762f2",[[769,"ui-menu-item",{disabled:[516],value:[1]}]]],["p-85a6716e",[[769,"ui-popover",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{onOpenChange:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}]}]]],["p-9551ebf6",[[769,"ui-radio",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],name:[1],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}],disabled:[{syncToInput:0}],name:[{syncToInput:0}],required:[{syncToInput:0}],value:[{syncToInput:0}]}]]],["p-8a5e3fe1",[[769,"ui-radio-group",{value:[1],name:[1],orientation:[1],disabled:[4],required:[4],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToRadios:0}],name:[{syncToRadios:0}],orientation:[{syncToRadios:0}],disabled:[{syncToRadios:0}]}]]],["p-df696cca",[[769,"ui-search-result-row",{disabled:[516],selected:[516],hasLeading:[32],hasMeta:[32],hasExcerpt:[32],hasTrailing:[32]}]]],["p-e82f104c",[[769,"ui-search-shell",{hasStatus:[32],hasFooter:[32]}]]],["p-f431dc13",[[769,"ui-select",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],required:[4],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToSelect:0}],defaultValue:[{syncToSelect:0}],disabled:[{syncToSelect:0}],invalid:[{syncToSelect:0}],required:[{syncToSelect:0}]}]]],["p-20387ffa",[[769,"ui-switch",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}]}]]],["p-1a12eb5c",[[769,"ui-tabs",{value:[1],defaultValue:[1,"default-value"],orientation:[1],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncState:0}],orientation:[{syncState:0}]}]]],["p-da6e2d01",[[769,"ui-textarea",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],readOnly:[4,"readonly"],rows:[2],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToTextarea:0}],defaultValue:[{syncToTextarea:0}],disabled:[{syncToTextarea:0}],invalid:[{syncToTextarea:0}],readOnly:[{syncToTextarea:0}],rows:[{syncToTextarea:0}]}]]],["p-a939c00f",[[769,"ui-toast-region",{open:[4],internalOpen:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{syncSurface:0}]}]]],["p-9a82c523",[[769,"ui-top-bar",{hasLeading:[32],hasSearch:[32],hasActions:[32]}]]],["p-e406656e",[[769,"ui-tree",{label:[1],hoverExpandDelay:[2,"hover-expand-delay"],maxDepth:[2,"max-depth"]}]]],["p-6cc3180b",[[769,"ui-tree-item",{itemId:[1,"item-id"],label:[1],dropDepth:[2,"drop-depth"],subtreeDepth:[2,"subtree-depth"],container:[4],sortable:[4],dragType:[1,"drag-type"],dropScope:[1,"drop-scope"],accepts:[1],expanded:[4],defaultExpanded:[4,"default-expanded"],selected:[4],disabled:[4],internalExpanded:[32],structuralLevel:[32],tabStop:[32]},null,{expanded:[{syncExpandedFromProp:0}]}]]],["p-8f102407",[[769,"ui-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},null,{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncSurface:0}]}]]],["p-0fd60103",[[769,"ui-tooltip",{for:[1],open:[4],defaultOpen:[4,"default-open"],placement:[1],showDelay:[2,"show-delay"],hideDelay:[2,"hide-delay"],toggleOnClick:[4,"toggle-on-click"],internalOpen:[32]},null,{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncOverlay:0}]}]]],["p-66c6b6dd",[[769,"ui-combobox",{label:[1],placeholder:[1],name:[1],value:[1],defaultValue:[1,"default-value"],query:[1],defaultQuery:[1,"default-query"],config:[16],disabled:[4],readOnly:[4,"readonly"],required:[4],size:[1],labelVisibility:[1,"label-visibility"],disclosure:[4],clearable:[4],help:[1],raw:[32],display:[32],selected:[32],expanded:[32],rows:[32],active:[32],loading:[32],helpOpen:[32],lookupError:[32],validation:[32],validate:[64],focusInput:[64]},null,{value:[{syncValue:0}],query:[{syncQuery:0}],disabled:[{syncDisabled:0}],readOnly:[{syncDisabled:0}],config:[{syncConfig:0}]}],[769,"ui-chip",{appearance:[1],size:[1]}]]]],e))));
1
+ import{p as e,b as a}from"./p-8BGiMGQ0.js";export{s as setNonce}from"./p-8BGiMGQ0.js";import{g as n}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,n={};return""!==a&&(n.resourcesUrl=new URL(".",a).href),e(n)})().then((async e=>(await n(),a([["p-caa37be2",[[769,"ui-multi-combobox",{label:[1],placeholder:[1],items:[16],config:[16],query:[1],defaultQuery:[1,"default-query"],tokenSeparators:[16],disabled:[4],readOnly:[4,"readonly"],required:[4],name:[1],raw:[32],rows:[32],focusInput:[64]},null,{query:[{syncQuery:0}]}]]],["p-88e61cab",[[769,"ui-context-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],internalOpen:[32],focusTrigger:[32]},null,{open:[{syncFromProp:0}],for:[{syncTarget:0}],internalOpen:[{syncOverlay:0}]}]]],["p-32c85198",[[769,"ui-affordance-scope",{nearRadius:[514,"near-radius"]},null,{nearRadius:[{connectCoordinator:0}]}]]],["p-08f80207",[[513,"ui-avatar",{src:[1],alt:[1],name:[1],fallback:[1],hasImage:[32]},null,{src:[{watchSrc:0}]}]]],["p-d56571a2",[[769,"ui-avatar-group",{max:[2],label:[1],overflowCount:[32]},null,{max:[{syncOverflow:0}]}]]],["p-5fdcee1d",[[769,"ui-badge",{variant:[1],tone:[1]}]]],["p-7ab661ec",[[769,"ui-button",{variant:[1],size:[1],disabled:[4]},null,{variant:[{syncToButton:0}],size:[{syncToButton:0}],disabled:[{syncToButton:0}]}]]],["p-add67e4c",[[769,"ui-callout",{tone:[1]}]]],["p-9d2662ca",[[769,"ui-checkbox",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],indeterminate:[4],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}],internalChecked:[{syncToInput:0}],indeterminate:[{syncToInput:0}],disabled:[{syncToInput:0}],required:[{syncToInput:0}]}]]],["p-4f68f939",[[769,"ui-dialog",{open:[4],defaultOpen:[4,"default-open"],modal:[4],dismissible:[4],label:[1],internalOpen:[32],accessibleLabel:[32]},null,{open:[{syncFromProp:0}],label:[{syncLabelFromProp:0}],internalOpen:[{syncOpen:0}]}]]],["p-1e1de77f",[[769,"ui-disclosure",{open:[4],defaultOpen:[4,"default-open"],disabled:[4],internalOpen:[32],contentId:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{syncState:0}]}]]],["p-4fc9917f",[[769,"ui-editable",{edit:[4],defaultEdit:[4,"default-edit"],disabled:[4],internalEdit:[32]},null,{edit:[{syncFromProp:0}]}]]],["p-e07e6ac2",[[769,"ui-floating-action-button",{disabled:[516],mobileOnly:[516,"mobile-only"],label:[1]}]]],["p-2f3c1b57",[[769,"ui-form-field",{invalid:[4],disabled:[4],required:[4]}]]],["p-607c3056",[[769,"ui-icon-button",{disabled:[516],label:[1],size:[513],variant:[513],anticipatory:[516]}]]],["p-071c139c",[[769,"ui-input",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],readOnly:[4,"readonly"],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToInput:0}],defaultValue:[{syncToInput:0}],disabled:[{syncToInput:0}],invalid:[{syncToInput:0}],readOnly:[{syncToInput:0}]}]]],["p-b68762f2",[[769,"ui-menu-item",{disabled:[516],value:[1]}]]],["p-82de1112",[[769,"ui-popover",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{onOpenChange:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}]}]]],["p-9551ebf6",[[769,"ui-radio",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],name:[1],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}],disabled:[{syncToInput:0}],name:[{syncToInput:0}],required:[{syncToInput:0}],value:[{syncToInput:0}]}]]],["p-8a5e3fe1",[[769,"ui-radio-group",{value:[1],name:[1],orientation:[1],disabled:[4],required:[4],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToRadios:0}],name:[{syncToRadios:0}],orientation:[{syncToRadios:0}],disabled:[{syncToRadios:0}]}]]],["p-df696cca",[[769,"ui-search-result-row",{disabled:[516],selected:[516],hasLeading:[32],hasMeta:[32],hasExcerpt:[32],hasTrailing:[32]}]]],["p-e82f104c",[[769,"ui-search-shell",{hasStatus:[32],hasFooter:[32]}]]],["p-f431dc13",[[769,"ui-select",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],required:[4],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToSelect:0}],defaultValue:[{syncToSelect:0}],disabled:[{syncToSelect:0}],invalid:[{syncToSelect:0}],required:[{syncToSelect:0}]}]]],["p-20387ffa",[[769,"ui-switch",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}]}]]],["p-1a12eb5c",[[769,"ui-tabs",{value:[1],defaultValue:[1,"default-value"],orientation:[1],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncState:0}],orientation:[{syncState:0}]}]]],["p-da6e2d01",[[769,"ui-textarea",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],readOnly:[4,"readonly"],rows:[2],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToTextarea:0}],defaultValue:[{syncToTextarea:0}],disabled:[{syncToTextarea:0}],invalid:[{syncToTextarea:0}],readOnly:[{syncToTextarea:0}],rows:[{syncToTextarea:0}]}]]],["p-3957f7ef",[[769,"ui-toast-region",{open:[4],internalOpen:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{syncSurface:0}]}]]],["p-9a82c523",[[769,"ui-top-bar",{hasLeading:[32],hasSearch:[32],hasActions:[32]}]]],["p-e406656e",[[769,"ui-tree",{label:[1],hoverExpandDelay:[2,"hover-expand-delay"],maxDepth:[2,"max-depth"]}]]],["p-6cc3180b",[[769,"ui-tree-item",{itemId:[1,"item-id"],label:[1],dropDepth:[2,"drop-depth"],subtreeDepth:[2,"subtree-depth"],container:[4],sortable:[4],dragType:[1,"drag-type"],dropScope:[1,"drop-scope"],accepts:[1],expanded:[4],defaultExpanded:[4,"default-expanded"],selected:[4],disabled:[4],internalExpanded:[32],structuralLevel:[32],tabStop:[32]},null,{expanded:[{syncExpandedFromProp:0}]}]]],["p-63a9159f",[[769,"ui-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},null,{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncSurface:0}]}]]],["p-311e54d4",[[769,"ui-tooltip",{for:[1],open:[4],defaultOpen:[4,"default-open"],placement:[1],showDelay:[2,"show-delay"],hideDelay:[2,"hide-delay"],toggleOnClick:[4,"toggle-on-click"],internalOpen:[32]},null,{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncOverlay:0}]}]]],["p-4a10a875",[[769,"ui-combobox",{label:[1],placeholder:[1],name:[1],value:[1],defaultValue:[1,"default-value"],query:[1],defaultQuery:[1,"default-query"],config:[16],disabled:[4],readOnly:[4,"readonly"],required:[4],size:[1],labelVisibility:[1,"label-visibility"],disclosure:[4],clearable:[4],help:[1],raw:[32],display:[32],selected:[32],expanded:[32],rows:[32],active:[32],loading:[32],helpOpen:[32],lookupError:[32],validation:[32],validate:[64],focusInput:[64]},null,{value:[{syncValue:0}],query:[{syncQuery:0}],disabled:[{syncDisabled:0}],readOnly:[{syncDisabled:0}],config:[{syncConfig:0}]}],[769,"ui-chip",{appearance:[1],size:[1]}]]]],e))));
@@ -1 +1 @@
1
- import{r as t,c as i,g as s,h as e,H as r}from"./p-8BGiMGQ0.js";import{o,c as h}from"./p-C-0syqXZ.js";import{d as a}from"./p-JwSoedEO.js";import{i as n,c as l}from"./p-BnGhGgTH.js";import{a as c}from"./p-Bu0dmLBE.js";const d=class{constructor(s){t(this,s),this.opened=i(this,"open"),this.closed=i(this,"close")}get host(){return s(this)}for="";open;defaultOpen=!1;placement="top-start";showDelay=500;hideDelay=100;toggleOnClick=!1;pinned=!1;focused=!1;opened;closed;internalOpen=!1;overlayId=`ui-tooltip-${Math.random().toString(36).slice(2,11)}`;trigger=null;surface=null;showTimer=null;hideTimer=null;syncFromProp(){this.clearTimers(),n(this.open)&&(this.internalOpen=this.open)}resetSurface(){this.syncTrigger(),this.setupSurface(),this.syncOverlay()}syncOverlay(){this.internalOpen?(this.surface?.show(),o({id:this.overlayId,modal:!1,element:this.host,relatedElements:this.trigger?[this.trigger]:void 0,dismissible:!0,requestClose:(t,i)=>this.handleRequestClose(t,i)})):(this.surface?.hide(),h(this.overlayId))}componentDidLoad(){this.host.id||(this.host.id=this.overlayId),this.internalOpen=l(this.open,this.defaultOpen),this.syncTrigger(),this.setupSurface(),this.host.addEventListener("pointerenter",this.onSurfaceEnter),this.host.addEventListener("pointerleave",this.onTriggerLeave),this.syncOverlay()}componentDidUpdate(){this.syncTrigger()}disconnectedCallback(){this.clearTimers(),this.detachTriggerListeners(),this.surface?.destroy(),this.surface=null,this.host.removeEventListener("pointerenter",this.onSurfaceEnter),this.host.removeEventListener("pointerleave",this.onTriggerLeave),h(this.overlayId)}syncTrigger(){const t=this.for?this.host.getRootNode().getElementById(this.for):this.host.previousElementSibling;t!==this.trigger&&(this.detachTriggerListeners(),this.trigger=t,this.attachTriggerListeners(),this.surface?.setAnchor(t))}setupSurface(){this.surface?.destroy(),this.surface=c(this.host,{anchor:this.trigger,placement:this.placement})}attachTriggerListeners(){if(this.detachTriggerListeners(),!this.trigger)return;const t=new Set((this.trigger.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean));t.add(this.host.id),this.trigger.setAttribute("aria-describedby",[...t].join(" ")),this.trigger.addEventListener("click",this.onTriggerClick),this.trigger.addEventListener("keydown",this.onTriggerKeydown),this.trigger.addEventListener("pointerenter",this.onTriggerEnter),this.trigger.addEventListener("pointerleave",this.onTriggerLeave),this.trigger.addEventListener("focusin",this.onTriggerFocusIn),this.trigger.addEventListener("focusout",this.onTriggerFocusOut)}detachTriggerListeners(){if(!this.trigger)return;const t=(this.trigger.getAttribute("aria-describedby")||"").split(/\s+/).filter((t=>t&&t!==this.host.id));t.length?this.trigger.setAttribute("aria-describedby",t.join(" ")):this.trigger.removeAttribute("aria-describedby"),this.trigger.removeEventListener("click",this.onTriggerClick),this.trigger.removeEventListener("keydown",this.onTriggerKeydown),this.trigger.removeEventListener("pointerenter",this.onTriggerEnter),this.trigger.removeEventListener("pointerleave",this.onTriggerLeave),this.trigger.removeEventListener("focusin",this.onTriggerFocusIn),this.trigger.removeEventListener("focusout",this.onTriggerFocusOut)}clearShowTimer(){null!==this.showTimer&&(clearTimeout(this.showTimer),this.showTimer=null)}clearHideTimer(){null!==this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null)}clearTimers(){this.clearShowTimer(),this.clearHideTimer()}setInteractionOpen(t,i){this.internalOpen!==t&&(n(this.open)||(this.internalOpen=t),a(this.host,t?"open":"close",{open:t,reason:"action",trigger:i}))}onSurfaceEnter=()=>this.clearHideTimer();onTriggerClick=t=>{this.toggleOnClick&&(this.clearTimers(),this.pinned=!this.pinned,this.setInteractionOpen(this.pinned,0===t.detail?"keyboard":"pointer"))};onTriggerKeydown=t=>{"Escape"===t.key&&this.clearTimers()};onTriggerEnter=t=>{"touch"!==t.pointerType&&(this.clearHideTimer(),this.internalOpen||null!==this.showTimer||(this.showTimer=setTimeout((()=>{this.showTimer=null,this.setInteractionOpen(!0,"pointer")}),Math.max(0,this.showDelay))))};onTriggerLeave=()=>{this.clearShowTimer(),this.focused||this.pinned||!this.internalOpen||null!==this.hideTimer||(this.hideTimer=setTimeout((()=>{this.hideTimer=null,this.setInteractionOpen(!1,"pointer")}),Math.max(0,this.hideDelay)))};onTriggerFocusIn=()=>{this.focused=!0,this.clearTimers(),this.setInteractionOpen(!0,"keyboard")};onTriggerFocusOut=t=>{const i=t.relatedTarget;i&&this.host.contains(i)||(this.focused=!1,this.pinned=!1,this.clearTimers(),this.setInteractionOpen(!1,"keyboard"))};handleRequestClose(t,i){("escape"===t||"light-dismiss"===t&&this.toggleOnClick)&&(this.pinned=!1,this.clearTimers(),n(this.open)||(this.internalOpen=!1),a(this.host,"close",{open:!1,reason:t,trigger:i}))}render(){return e(r,{key:"2216e8f56c408e775140200881c9bfd99b45f381",role:"tooltip",hidden:!this.internalOpen,"data-open":this.internalOpen?"":void 0},e("div",{key:"a547e43fb5f6c3c2f62cf7f1fb9198dc0024a28d",class:"tooltip__surface"},e("slot",{key:"dc8863505e8140565588c57ea200b7f548fb5df3"})))}static get watchers(){return{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncOverlay:0}]}}};d.style=":host{position:fixed;inset:auto;margin:0;display:inline-block;box-sizing:border-box;padding:0;border:0;border-radius:0;background:transparent;opacity:0;transform:translateY(4px);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}.tooltip__surface{box-sizing:border-box;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-2);background:var(--ui-surface-elevated);color:var(--ui-text-primary);padding:var(--ui-space-2) var(--ui-space-3);font-size:var(--ui-font-size-sm);box-shadow:var(--ui-shadow-md)}:host(:popover-open){opacity:1;transform:translateY(0)}@starting-style{:host(:popover-open){opacity:0;transform:translateY(4px)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host{transition:none}}";export{d as ui_tooltip}
1
+ import{r as t,c as i,g as s,h as e,H as r}from"./p-8BGiMGQ0.js";import{o,c as h}from"./p-C-0syqXZ.js";import{d as a}from"./p-JwSoedEO.js";import{i as n,c as l}from"./p-BnGhGgTH.js";import{a as c}from"./p-Drmwg-C1.js";const d=class{constructor(s){t(this,s),this.opened=i(this,"open"),this.closed=i(this,"close")}get host(){return s(this)}for="";open;defaultOpen=!1;placement="top-start";showDelay=500;hideDelay=100;toggleOnClick=!1;pinned=!1;focused=!1;opened;closed;internalOpen=!1;overlayId=`ui-tooltip-${Math.random().toString(36).slice(2,11)}`;trigger=null;surface=null;showTimer=null;hideTimer=null;syncFromProp(){this.clearTimers(),n(this.open)&&(this.internalOpen=this.open)}resetSurface(){this.syncTrigger(),this.setupSurface(),this.syncOverlay()}syncOverlay(){this.internalOpen?(this.surface?.show(),o({id:this.overlayId,modal:!1,element:this.host,relatedElements:this.trigger?[this.trigger]:void 0,dismissible:!0,requestClose:(t,i)=>this.handleRequestClose(t,i)})):(this.surface?.hide(),h(this.overlayId))}componentDidLoad(){this.host.id||(this.host.id=this.overlayId),this.internalOpen=l(this.open,this.defaultOpen),this.syncTrigger(),this.setupSurface(),this.host.addEventListener("pointerenter",this.onSurfaceEnter),this.host.addEventListener("pointerleave",this.onTriggerLeave),this.syncOverlay()}componentDidUpdate(){this.syncTrigger()}disconnectedCallback(){this.clearTimers(),this.detachTriggerListeners(),this.surface?.destroy(),this.surface=null,this.host.removeEventListener("pointerenter",this.onSurfaceEnter),this.host.removeEventListener("pointerleave",this.onTriggerLeave),h(this.overlayId)}syncTrigger(){const t=this.for?this.host.getRootNode().getElementById(this.for):this.host.previousElementSibling;t!==this.trigger&&(this.detachTriggerListeners(),this.trigger=t,this.attachTriggerListeners(),this.surface?.setAnchor(t))}setupSurface(){this.surface?.destroy(),this.surface=c(this.host,{anchor:this.trigger,placement:this.placement})}attachTriggerListeners(){if(this.detachTriggerListeners(),!this.trigger)return;const t=new Set((this.trigger.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean));t.add(this.host.id),this.trigger.setAttribute("aria-describedby",[...t].join(" ")),this.trigger.addEventListener("click",this.onTriggerClick),this.trigger.addEventListener("keydown",this.onTriggerKeydown),this.trigger.addEventListener("pointerenter",this.onTriggerEnter),this.trigger.addEventListener("pointerleave",this.onTriggerLeave),this.trigger.addEventListener("focusin",this.onTriggerFocusIn),this.trigger.addEventListener("focusout",this.onTriggerFocusOut)}detachTriggerListeners(){if(!this.trigger)return;const t=(this.trigger.getAttribute("aria-describedby")||"").split(/\s+/).filter((t=>t&&t!==this.host.id));t.length?this.trigger.setAttribute("aria-describedby",t.join(" ")):this.trigger.removeAttribute("aria-describedby"),this.trigger.removeEventListener("click",this.onTriggerClick),this.trigger.removeEventListener("keydown",this.onTriggerKeydown),this.trigger.removeEventListener("pointerenter",this.onTriggerEnter),this.trigger.removeEventListener("pointerleave",this.onTriggerLeave),this.trigger.removeEventListener("focusin",this.onTriggerFocusIn),this.trigger.removeEventListener("focusout",this.onTriggerFocusOut)}clearShowTimer(){null!==this.showTimer&&(clearTimeout(this.showTimer),this.showTimer=null)}clearHideTimer(){null!==this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null)}clearTimers(){this.clearShowTimer(),this.clearHideTimer()}setInteractionOpen(t,i){this.internalOpen!==t&&(n(this.open)||(this.internalOpen=t),a(this.host,t?"open":"close",{open:t,reason:"action",trigger:i}))}onSurfaceEnter=()=>this.clearHideTimer();onTriggerClick=t=>{this.toggleOnClick&&(this.clearTimers(),this.pinned=!this.pinned,this.setInteractionOpen(this.pinned,0===t.detail?"keyboard":"pointer"))};onTriggerKeydown=t=>{"Escape"===t.key&&this.clearTimers()};onTriggerEnter=t=>{"touch"!==t.pointerType&&(this.clearHideTimer(),this.internalOpen||null!==this.showTimer||(this.showTimer=setTimeout((()=>{this.showTimer=null,this.setInteractionOpen(!0,"pointer")}),Math.max(0,this.showDelay))))};onTriggerLeave=()=>{this.clearShowTimer(),this.focused||this.pinned||!this.internalOpen||null!==this.hideTimer||(this.hideTimer=setTimeout((()=>{this.hideTimer=null,this.setInteractionOpen(!1,"pointer")}),Math.max(0,this.hideDelay)))};onTriggerFocusIn=()=>{this.focused=!0,this.clearTimers(),this.setInteractionOpen(!0,"keyboard")};onTriggerFocusOut=t=>{const i=t.relatedTarget;i&&this.host.contains(i)||(this.focused=!1,this.pinned=!1,this.clearTimers(),this.setInteractionOpen(!1,"keyboard"))};handleRequestClose(t,i){("escape"===t||"light-dismiss"===t&&this.toggleOnClick)&&(this.pinned=!1,this.clearTimers(),n(this.open)||(this.internalOpen=!1),a(this.host,"close",{open:!1,reason:t,trigger:i}))}render(){return e(r,{key:"2216e8f56c408e775140200881c9bfd99b45f381",role:"tooltip",hidden:!this.internalOpen,"data-open":this.internalOpen?"":void 0},e("div",{key:"a547e43fb5f6c3c2f62cf7f1fb9198dc0024a28d",class:"tooltip__surface"},e("slot",{key:"dc8863505e8140565588c57ea200b7f548fb5df3"})))}static get watchers(){return{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncOverlay:0}]}}};d.style=":host{position:fixed;inset:auto;margin:0;display:inline-block;box-sizing:border-box;padding:0;border:0;border-radius:0;background:transparent;opacity:0;transform:translateY(4px);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}.tooltip__surface{box-sizing:border-box;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-2);background:var(--ui-surface-elevated);color:var(--ui-text-primary);padding:var(--ui-space-2) var(--ui-space-3);font-size:var(--ui-font-size-sm);box-shadow:var(--ui-shadow-md)}:host(:popover-open){opacity:1;transform:translateY(0)}@starting-style{:host(:popover-open){opacity:0;transform:translateY(4px)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host{transition:none}}";export{d as ui_tooltip}
@@ -1 +1 @@
1
- import{r as t,g as a,h as e,H as o}from"./p-8BGiMGQ0.js";import{D as s,c as n}from"./p-Bu0dmLBE.js";const i=class{constructor(a){t(this,a)}get host(){return a(this)}nearRadius=s;coordinator=null;componentDidLoad(){this.connectCoordinator()}disconnectedCallback(){this.coordinator?.destroy(),this.coordinator=null}connectCoordinator(){this.coordinator?.destroy(),this.coordinator=n(this.host,{nearRadius:this.nearRadius})}onSlotChange=()=>{this.coordinator?.refresh()};render(){return e(o,{key:"f500fa48554ed6224efd2dbe9632880bf0a15a19"},e("slot",{key:"37c5c5b7925b260ff8f9edd411ee6c90a12a4909",onSlotchange:this.onSlotChange}))}static get watchers(){return{nearRadius:[{connectCoordinator:0}]}}};i.style=":host{display:contents;--ui-affordance-scope-engaged:0}:host([data-ui-interaction='engaged']){--ui-affordance-scope-engaged:1}";export{i as ui_affordance_scope}
1
+ import{r as t,g as a,h as e,H as o}from"./p-8BGiMGQ0.js";import{D as s,c as n}from"./p-Drmwg-C1.js";const r=class{constructor(a){t(this,a)}get host(){return a(this)}nearRadius=s;coordinator=null;componentDidLoad(){this.connectCoordinator()}disconnectedCallback(){this.coordinator?.destroy(),this.coordinator=null}connectCoordinator(){this.coordinator?.destroy(),this.coordinator=n(this.host,{nearRadius:this.nearRadius})}onSlotChange=()=>{this.coordinator?.refresh()};render(){return e(o,{key:"f500fa48554ed6224efd2dbe9632880bf0a15a19"},e("slot",{key:"37c5c5b7925b260ff8f9edd411ee6c90a12a4909",onSlotchange:this.onSlotChange}))}static get watchers(){return{nearRadius:[{connectCoordinator:0}]}}};r.style=":host{display:contents;--ui-affordance-scope-engaged:0}:host([data-ui-interaction='engaged']){--ui-affordance-scope-engaged:1}";export{r as ui_affordance_scope}
@@ -1 +1 @@
1
- import{r as t,g as s,h as i,H as a}from"./p-8BGiMGQ0.js";import{d as r,e}from"./p-JwSoedEO.js";import{b as o}from"./p-Bu0dmLBE.js";const n=class{constructor(s){t(this,s)}get host(){return s(this)}open=!0;internalOpen=!1;surface=null;contentObserver=null;pendingDismiss=null;syncFromProp(){this.syncContents()}syncSurface(){this.internalOpen?this.surface?.show():this.surface?.hide()}componentDidLoad(){this.surface=o(this.host),this.contentObserver=new MutationObserver(this.syncContents),this.contentObserver.observe(this.host,{childList:!0,subtree:!0}),this.syncContents(),this.syncSurface(),this.host.addEventListener("click",this.onClick)}disconnectedCallback(){this.host.removeEventListener("click",this.onClick),this.contentObserver?.disconnect(),this.contentObserver=null,this.surface?.destroy(),this.surface=null}getToasts(){return Array.from(this.host.querySelectorAll("[data-ui-toast]"))}syncContents=()=>{const t=this.open&&this.getToasts().length>0,s=this.internalOpen,i=this.pendingDismiss&&!this.host.contains(this.pendingDismiss.toast)?this.pendingDismiss:null;this.internalOpen=t,s&&!t&&i&&r(this.host,"close",{open:!1,reason:"action",trigger:i.trigger}),!i&&this.open||(this.pendingDismiss=null)};onClick=t=>{const s=t.target.closest?.("[data-ui-toast-dismiss]");if(!s)return;const i=s.closest?.("[data-ui-toast]");if(!i)return;const a=i.id??"",o=e(t);this.pendingDismiss={toast:i,trigger:o},r(this.host,"dismiss",{id:a,reason:"action",trigger:o})};render(){return i(a,{key:"e3a71de7854b5937cc3f74858fc69f202fd93c71",role:"region","aria-label":"Notifications","aria-live":"polite","data-open":this.internalOpen?"":void 0},i("slot",{key:"cdf6ea0118199d149ac08820c69ec8b54654be91"}))}static get watchers(){return{open:[{syncFromProp:0}],internalOpen:[{syncSurface:0}]}}};n.style=":host{position:fixed;top:calc(var(--ui-space-4) + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:9999;display:grid;gap:var(--ui-space-2);inline-size:min(24rem, calc(100vw - (var(--ui-space-4) * 2)));max-inline-size:100%;pointer-events:none}:host([popover]){right:auto;bottom:auto;margin:0}:host>*{pointer-events:auto}::slotted([data-ui-toast]){display:grid;grid-template-columns:1fr auto;gap:var(--ui-space-2);align-items:start;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);padding:var(--ui-space-3) var(--ui-space-4);background:var(--ui-surface-elevated);color:var(--ui-text-primary);box-shadow:var(--ui-shadow-lg);animation:ui-toast-enter 0.25s var(--ui-motion-ease) forwards}@keyframes ui-toast-enter{from{opacity:0;transform:translateY(-0.5rem)}to{opacity:1;transform:translateY(0)}}::slotted([data-ui-toast][aria-hidden='true']){display:none}::slotted([data-ui-toast-dismiss]){border:0;background:transparent;color:var(--ui-text-secondary);cursor:pointer;font:inherit}";export{n as ui_toast_region}
1
+ import{r as t,g as s,h as i,H as a}from"./p-8BGiMGQ0.js";import{d as r,e}from"./p-JwSoedEO.js";import{b as o}from"./p-Drmwg-C1.js";const n=class{constructor(s){t(this,s)}get host(){return s(this)}open=!0;internalOpen=!1;surface=null;contentObserver=null;pendingDismiss=null;syncFromProp(){this.syncContents()}syncSurface(){this.internalOpen?this.surface?.show():this.surface?.hide()}componentDidLoad(){this.surface=o(this.host),this.contentObserver=new MutationObserver(this.syncContents),this.contentObserver.observe(this.host,{childList:!0,subtree:!0}),this.syncContents(),this.syncSurface(),this.host.addEventListener("click",this.onClick)}disconnectedCallback(){this.host.removeEventListener("click",this.onClick),this.contentObserver?.disconnect(),this.contentObserver=null,this.surface?.destroy(),this.surface=null}getToasts(){return Array.from(this.host.querySelectorAll("[data-ui-toast]"))}syncContents=()=>{const t=this.open&&this.getToasts().length>0,s=this.internalOpen,i=this.pendingDismiss&&!this.host.contains(this.pendingDismiss.toast)?this.pendingDismiss:null;this.internalOpen=t,s&&!t&&i&&r(this.host,"close",{open:!1,reason:"action",trigger:i.trigger}),!i&&this.open||(this.pendingDismiss=null)};onClick=t=>{const s=t.target.closest?.("[data-ui-toast-dismiss]");if(!s)return;const i=s.closest?.("[data-ui-toast]");if(!i)return;const a=i.id??"",o=e(t);this.pendingDismiss={toast:i,trigger:o},r(this.host,"dismiss",{id:a,reason:"action",trigger:o})};render(){return i(a,{key:"e3a71de7854b5937cc3f74858fc69f202fd93c71",role:"region","aria-label":"Notifications","aria-live":"polite","data-open":this.internalOpen?"":void 0},i("slot",{key:"cdf6ea0118199d149ac08820c69ec8b54654be91"}))}static get watchers(){return{open:[{syncFromProp:0}],internalOpen:[{syncSurface:0}]}}};n.style=":host{position:fixed;top:calc(var(--ui-space-4) + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:9999;display:grid;gap:var(--ui-space-2);inline-size:min(24rem, calc(100vw - (var(--ui-space-4) * 2)));max-inline-size:100%;pointer-events:none}:host([popover]){right:auto;bottom:auto;margin:0}:host>*{pointer-events:auto}::slotted([data-ui-toast]){display:grid;grid-template-columns:1fr auto;gap:var(--ui-space-2);align-items:start;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);padding:var(--ui-space-3) var(--ui-space-4);background:var(--ui-surface-elevated);color:var(--ui-text-primary);box-shadow:var(--ui-shadow-lg);animation:ui-toast-enter 0.25s var(--ui-motion-ease) forwards}@keyframes ui-toast-enter{from{opacity:0;transform:translateY(-0.5rem)}to{opacity:1;transform:translateY(0)}}::slotted([data-ui-toast][aria-hidden='true']){display:none}::slotted([data-ui-toast-dismiss]){border:0;background:transparent;color:var(--ui-text-secondary);cursor:pointer;font:inherit}";export{n as ui_toast_region}
@@ -1 +1 @@
1
- import{r as i,h as t,H as s,c as e,g as a}from"./p-8BGiMGQ0.js";import{a as o}from"./p-Bu0dmLBE.js";import{c as r,o as n}from"./p-C-0syqXZ.js";const h=class{constructor(t){i(this,t)}appearance="tag";size="xs";render(){return t(s,{key:"970cb48cf8d70c47feaab90fe428c09f0d052a03","data-appearance":this.appearance,"data-size":this.size},t("span",{key:"6d8c6104d2869520097a2a61bd2a887b363b4912",class:"chip__surface"},t("span",{key:"638fb68ff5dffa629576c9e1079bb3169f2adb4f",class:"chip__label"},t("slot",{key:"8b31f2130e202e18d7717aee6add6bc6e7f119b5"}))))}};h.style=":host{--ui-chip-surface:var(--ui-surface-subtle);--ui-chip-text:var(--ui-text-secondary);--ui-chip-border:var(--ui-border-default);--ui-chip-font-size:var(--ui-font-size-xs);--ui-chip-font-weight:var(--ui-font-normal);--ui-chip-line-height:var(--ui-line-height-tight);--ui-chip-padding-block:var(--ui-space-0-5);--ui-chip-padding-inline:var(--ui-space-2);--ui-chip-notch:var(--ui-space-1);display:inline-flex;min-width:0;max-width:100%}:host([data-size='sm']){--ui-chip-font-size:var(--ui-font-size-sm)}.chip__surface{display:inline-flex;align-items:center;box-sizing:border-box;min-width:0;max-width:100%;padding:var(--ui-chip-padding-block) var(--ui-chip-padding-inline);border:1px solid var(--ui-chip-border);background:var(--ui-chip-surface);color:var(--ui-chip-text) !important;font-family:var(--ui-font-family-sans) !important;font-size:var(--ui-chip-font-size) !important;font-weight:var(--ui-chip-font-weight) !important;line-height:var(--ui-chip-line-height) !important}.chip__label{min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([data-appearance='pill']) .chip__surface{border-radius:var(--ui-radius-round)}:host([data-appearance='tag']) .chip__surface{border:0;padding-inline-end:calc(var(--ui-chip-padding-inline) + var(--ui-chip-notch));clip-path:polygon(0 0, calc(100% - var(--ui-chip-notch)) 0, 100% 50%, calc(100% - var(--ui-chip-notch)) 100%, 0 100%)}";const l=class{constructor(t){i(this,t),this.queryChange=e(this,"query-change"),this.valueChange=e(this,"value-change"),this.freeEntry=e(this,"free-entry"),this.createEntry=e(this,"create-entry"),this.dependencyInvalidate=e(this,"dependency-invalidate"),this.validationChange=e(this,"validation-change"),this.optionsChange=e(this,"options-change")}get host(){return a(this)}label="";placeholder="";name="";value;defaultValue;query;defaultQuery="";config={};disabled=!1;readOnly=!1;required=!1;size="md";labelVisibility="visible";disclosure=!1;clearable=!1;help="";queryChange;valueChange;freeEntry;createEntry;dependencyInvalidate;validationChange;optionsChange;raw="";display="";selected=null;expanded=!1;rows=[];active=-1;loading=!1;helpOpen=!1;lookupError="";validation={status:"pristine",touched:!1,dirty:!1,issues:[]};input;popup;field;surface;lookup;validationRun;lookupTimer;composing=!1;initialRaw="";overlayId=`ui-combobox-${Math.random().toString(36).slice(2)}`;alive=!1;fullSet=!1;knownOptions=new Map;awaitingLabel=null;proposedChange;formattedRaw;formattedWith;componentWillLoad(){this.selected=void 0!==this.value?this.value:this.defaultValue??null,this.raw=this.query??this.defaultQuery,void 0!==this.query||this.raw||null===this.selected||(this.raw=this.config.options?.find((i=>i.value===this.selected))?.label??this.selected),void 0===this.query&&null!==this.selected&&this.raw===this.selected&&(this.awaitingLabel=this.selected),this.display=this.raw,this.initialRaw=this.raw,this.applyServerIssues()}connectedCallback(){this.alive=!0,this.setupSurface()}componentDidLoad(){this.setupSurface()}componentDidUpdate(){this.input&&!this.composing&&this.input.value!==this.display&&(this.input.value=this.display),this.expanded&&this.surface?.refresh()}disconnectedCallback(){this.alive=!1,this.close(),this.validationRun?.abort(),this.surface?.destroy(),this.surface=void 0}setupSurface(){!this.surface&&this.popup&&this.field&&(this.surface=o(this.popup,{anchor:this.field,placement:"bottom-start"}))}syncValue(){if(void 0!==this.value){if(this.selected=this.value,void 0===this.query){const i=this.proposedChange,t=this.config.options?.find((i=>i.value===this.selected))??(null===this.selected?void 0:this.knownOptions.get(this.selected)),s=i?.value===this.selected?i.query:t?.label??this.selected??"";i?.value===this.selected&&s===this.raw||(this.raw=s,this.display=this.raw,this.formattedRaw=void 0),this.awaitingLabel=t||null===this.selected?null:this.selected}this.resetValidation()}}syncQuery(){void 0!==this.query&&this.query!==this.raw&&(void 0===this.value&&this.proposedChange?.query!==this.query&&(this.selected=null),this.awaitingLabel=null,this.formattedRaw=void 0,this.raw=this.query,this.display=this.raw,this.resetValidation(),this.expanded&&this.search("input"))}syncDisabled(){(this.disabled||this.readOnly)&&(this.close(),this.resetValidation())}syncConfig(i,t){if(this.validationRun?.abort(),i.provider===t?.provider&&i.context===t?.context||this.knownOptions.clear(),i.context!==t?.context){this.close();const t=i.invalidation??"retain-query";this.commit("retain"===t?this.selected:null,"clear"===t?"":this.raw,null,"invalidation","programmatic"),this.validation={status:"pristine",touched:!1,dirty:this.raw!==this.initialRaw,issues:[]}}this.applyServerIssues(),this.expanded&&this.search("context")}applyServerIssues(){const i=this.config.issues??[];i.length?this.setValidation({issues:i},this.validation.touched):this.resetValidation()}resetValidation(){this.validationRun?.abort(),this.validation={status:"pristine",touched:this.validation.touched,dirty:this.raw!==this.initialRaw,issues:[]},this.validationChange?.emit(this.validation)}cancelLookup(){clearTimeout(this.lookupTimer),this.lookup?.abort(),this.lookup=void 0,this.loading=!1}close(){this.expanded=!1,this.active=-1,this.cancelLookup(),this.surface?.hide(),r(this.overlayId)}open(i="input"){this.disabled||this.readOnly||(this.expanded=!0,this.popup&&this.field&&(this.popup.style.minWidth=`${this.field.getBoundingClientRect().width}px`),this.surface?.show(),n({id:this.overlayId,element:this.popup,relatedElements:[this.host],modal:!1,requestClose:()=>this.close()}),this.search(i))}search(i){this.cancelLookup(),this.fullSet="disclosure"===i,this.active=-1,this.lookupError="";const t=this.config,s=this.fullSet?"":this.raw,e=new AbortController;this.lookup=e;const a=i=>{if(e.signal.aborted||!this.alive)return;for(const t of i)this.knownOptions.set(t.value,t);const a=null===this.selected?void 0:this.knownOptions.get(this.selected);void 0===this.query&&this.awaitingLabel===this.selected&&a&&(this.raw=a.label,this.display=this.raw,this.awaitingLabel=null,this.formattedRaw=void 0,this.resetValidation());const o=new Set;this.rows=i.filter((i=>!o.has(i.id)&&(o.add(i.id),this.fullSet||(t.filter?t.filter(i,s,t.context):!!t.provider||i.label.toLocaleLowerCase().includes(s.toLocaleLowerCase())))));const r=new Map;for(const i of this.rows){const t=i.group??"";r.has(t)||r.set(t,[]),r.get(t).push(i)}this.rows=[...r.values()].flat(),this.loading=!1,this.optionsChange.emit(this.rows)};t.provider?(this.rows=[],this.loading=!0,this.lookupTimer=setTimeout((async()=>{try{a(await t.provider({query:s,context:t.context,signal:e.signal,reason:i}))}catch(i){if(e.signal.aborted||!this.alive)return;this.loading=!1,this.lookupError=i instanceof Error?i.message:"Unable to load suggestions."}}),"disclosure"===i?0:Math.max(0,t.debounce??200))):a(t.options??[])}get canCreate(){const i=this.config.options?[...this.config.options,...this.rows]:this.rows;return Boolean(this.config.allowCreate&&this.raw.trim()&&!this.loading&&!this.lookupError&&!i.some((i=>i.label.toLocaleLowerCase()===this.raw.toLocaleLowerCase())))}format(i){if((this.config.formatOn??"blur")!==i||!this.input)return;if(this.formattedRaw===this.raw&&this.formattedWith===this.config.format)return;const t=function(i,t,s){const e={display:i,selection:t};if(!s)return e;let a;try{a=s(i,t)}catch{return e}if(!a)return e;const o=Array.from(i);let r=0;for(const i of a.display)i===o[r]&&(r+=1);return!Number.isInteger(a.selection.start)||!Number.isInteger(a.selection.end)||r!==o.length||a.selection.start<0||a.selection.end<a.selection.start||a.selection.end>a.display.length?e:a}(this.raw,{start:this.input.selectionStart??this.raw.length,end:this.input.selectionEnd??this.raw.length,direction:this.input.selectionDirection??"none"},this.config.format);this.formattedRaw=this.raw,this.formattedWith=this.config.format,this.display=t.display,this.input.value!==t.display&&(this.input.value=t.display,this.input.setSelectionRange(t.selection.start,t.selection.end,t.selection.direction))}onInput=i=>{this.composing||i.isComposing||(this.awaitingLabel=null,this.formattedRaw=void 0,this.raw=this.input.value,this.display=this.raw,this.resetValidation(),this.format("input"),this.queryChange.emit({query:this.raw,display:this.display,trigger:"keyboard"}),null!==this.selected&&this.commit(null,this.raw,null,"clear","keyboard"),this.open(),"input"===this.config.validateOn&&this.validate(),queueMicrotask((()=>{void 0!==this.query&&this.query!==this.raw&&this.syncQuery()})))};commit(i,t,s,e,a){this.awaitingLabel=null;const o=t!==this.raw;void 0===this.value&&(this.selected=i),void 0===this.query&&o&&(this.raw=t,this.display=t,this.formattedRaw=void 0),this.resetValidation();const r={value:i,query:t,option:s,kind:e,trigger:a},n={value:i,query:t};this.proposedChange=n,this.valueChange.emit(r),o&&this.queryChange.emit({query:t,display:t,trigger:a}),"create"===e&&this.createEntry.emit(r),"free-entry"===e&&this.freeEntry.emit(r),"invalidation"===e&&this.dependencyInvalidate.emit(r),queueMicrotask((()=>{this.proposedChange===n&&(void 0!==this.value&&this.value!==n.value&&this.syncValue(),void 0!==this.query&&this.query!==n.query&&(void 0===this.value&&(this.selected=null,this.resetValidation()),this.syncQuery()),this.proposedChange=void 0)}))}choose(i,t){const s=this.rows[i];if(!s?.disabled){if(s)this.commit(s.value,s.label,s,"selection",t);else{if(!this.canCreate||i!==this.rows.length)return;this.commit(null,this.raw,null,"create",t)}this.close(),this.input?.focus(),"submit"!==this.config.validateOn&&queueMicrotask((()=>{this.validate()}))}}move(i){const t=this.rows.flatMap(((i,t)=>i.disabled?[]:[t]));if(this.canCreate&&t.push(this.rows.length),!t.length)return;const s=t.indexOf(this.active),e="Home"===i?0:"End"===i?t.length-1:"ArrowDown"===i?Math.min(s+1,t.length-1):s<0?t.length-1:Math.max(0,s-1);this.active=t[e],requestAnimationFrame((()=>this.host.shadowRoot?.getElementById(`option-${this.active}`)?.scrollIntoView({block:"nearest"})))}onKeydown=i=>{if(!(this.composing||i.isComposing||this.disabled||this.readOnly))return"Escape"===i.key&&this.expanded?(i.preventDefault(),i.stopPropagation(),void this.close()):void("Tab"!==i.key?i.altKey||i.ctrlKey||i.metaKey||i.shiftKey||("ArrowDown"===i.key||"ArrowUp"===i.key?(i.preventDefault(),this.expanded||this.open("disclosure"),this.move(i.key)):("Home"===i.key||"End"===i.key)&&this.expanded&&this.active>=0?(i.preventDefault(),this.move(i.key)):"Enter"===i.key&&this.expanded&&(this.active>=0?(i.preventDefault(),this.choose(this.active,"keyboard")):this.config.allowFreeText&&(i.preventDefault(),this.commit(null,this.raw,null,"free-entry","keyboard"),this.close()))):this.close())};onFocusOut=i=>{i.relatedTarget instanceof Node&&this.host.shadowRoot?.contains(i.relatedTarget)||(this.close(),this.format("blur"),this.validation={...this.validation,touched:!0},this.config.allowFreeText&&null===this.selected&&this.commit(null,this.raw,null,"free-entry","keyboard"),"blur"===(this.config.validateOn??"blur")&&this.validate())};setValidation(i,t=this.validation.touched){const s=i.issues.some((i=>"warning"!==i.severity));this.validation={status:s?"error":i.issues.length?"warning":"valid",touched:t,dirty:this.raw!==this.initialRaw,...i},this.validationChange?.emit(this.validation)}async validate(){this.validationRun?.abort();const i=new AbortController;this.validationRun=i,this.validation={...this.validation,status:"pending",output:void 0},this.validationChange.emit(this.validation);try{const t=await async function(i,t){let s=i.raw,e=[];const a=()=>i.signal.throwIfAborted();try{if(a(),t.parse&&(s=await t.parse(i.raw,i)),a(),t.schema){const i=await t.schema["~standard"].validate(s);a(),i.issues?e=i.issues:"value"in i&&(s=i.value)}if(!e.some((i=>"warning"!==i.severity))&&(t.normalize&&(s=await t.normalize(s,i)),a(),t.validator)){const o=await t.validator(s,i);a(),e=[...e,...o.issues??[]],"output"in o&&(s=o.output)}}catch(i){a(),e=[{message:i instanceof Error?i.message:"Unable to validate this value."}]}return e=[...e,...t.issues??[]],{output:e.some((i=>"warning"!==i.severity))?void 0:s,issues:e}}({raw:this.raw,value:this.selected,context:this.config.context,signal:i.signal},this.config);this.required&&!this.raw.trim()?t.issues=[...t.issues,{message:"A value is required."}]:!this.raw||null!==this.selected||this.config.allowFreeText||this.config.allowCreate||(t.issues=[...t.issues,{message:"Choose a suggestion."}]),t.issues.some((i=>"warning"!==i.severity))&&(t.output=void 0),!i.signal.aborted&&this.alive&&this.setValidation(t)}catch{}return this.validation}async focusInput(){this.input?.focus()}render(){const i=[this.helpOpen?"help-text":"",this.validation.issues.length?"validation":""].filter(Boolean).join(" ")||void 0,e=this.loading?"Loading suggestions…":this.lookupError||(this.expanded?`${this.rows.length} suggestions available.`:""),a=[...new Set(this.rows.map((i=>i.group??"")))];return t(s,{key:"1f00d9a83729d9c2147ced7e5006b928d1b5e51d","data-size":this.size,"data-validation":this.validation.status,onFocusout:this.onFocusOut},t("label",{key:"10353b147cc68ef1d67be0988849af1527fcf9ba",htmlFor:"input",part:"label",class:"sr-only"===this.labelVisibility?"sr-only":void 0},this.label,this.required?" *":""),t("div",{key:"74bb53137d9343add37c22f3ac503eccf41807a9",class:"field",part:"field",ref:i=>this.field=i,onClick:i=>{i.composedPath().some((i=>i instanceof HTMLButtonElement))||this.input?.focus()}},t("slot",{key:"24c26916365013faa4a78bd4fe0d01f6c129c703",name:"start"}),t("input",{key:"835d19e66ec4a24c1a83f43bbc256fa2a9e3332f",id:"input",ref:i=>this.input=i,role:"combobox","aria-autocomplete":"list","aria-expanded":String(this.expanded),"aria-controls":"listbox","aria-activedescendant":this.expanded&&this.active>=0?`option-${this.active}`:void 0,"aria-describedby":i,"aria-invalid":String("error"===this.validation.status),"aria-busy":String("pending"===this.validation.status),value:this.display,placeholder:this.placeholder,name:this.name||void 0,disabled:this.disabled,readOnly:this.readOnly,required:this.required,autoComplete:"off",part:"input",onInput:this.onInput,onKeyDown:this.onKeydown,onCompositionstart:()=>this.composing=!0,onCompositionend:()=>{this.composing=!1,this.onInput(new InputEvent("input"))}}),this.clearable&&t("button",{key:"326c1e24d3c417c3a72acd8234a53937b388ba79",type:"button",part:"affordance","aria-label":`Clear ${this.label}`,disabled:this.disabled||this.readOnly,onClick:()=>{this.commit(null,"",null,"clear","pointer"),this.close(),this.input?.focus()}},"×"),this.help&&t("button",{key:"6aeb62dc2935eb95670caa1d2028c0931dc362b2",id:"help",type:"button",part:"affordance","aria-label":`Help for ${this.label}`,disabled:this.disabled},t("span",{key:"9317be0fbb0c1bbb91061be69f38037a97a4c36b","aria-hidden":"true"},"?")),this.disclosure&&t("button",{key:"1cd2a0ea92df1144ff2297fcf64df7b3d0f4713a",type:"button",part:"affordance","aria-label":`Suggestions for ${this.label}`,"aria-controls":"listbox","aria-expanded":String(this.expanded),disabled:this.disabled||this.readOnly,onClick:()=>{this.expanded?this.close():this.open("disclosure"),this.input?.focus()}},t("span",{key:"0188b2d0e8cc7b7ff4d1a2175a0ff0b47d9c7d98","aria-hidden":"true"},"⌄"))),this.help&&t("ui-tooltip",{key:"e09fd35274c3e1fa6e408850d72f7a07c2bb4baf",id:"help-text",for:"help",toggleOnClick:!0,onOpen:()=>this.helpOpen=!0,onClose:()=>this.helpOpen=!1},this.help),t("div",{key:"ddf83a5944dd03fc7eb580b81fcf291e06c03601",class:"popup",part:"popup",hidden:!this.expanded,ref:i=>this.popup=i},t("div",{key:"1d73de1dabb6eaa95af12f2af88dac74e3f163ea",id:"listbox",role:"listbox","aria-label":`${this.label} suggestions`,"aria-busy":String(this.loading)},a.map((i=>t("div",{role:i?"group":"presentation","aria-label":i||void 0},i&&t("div",{class:"group",part:"group"},i),this.rows.map(((s,e)=>(s.group??"")!==i?null:t("div",{id:`option-${e}`,role:"option","aria-selected":String(this.selected===s.value),"aria-disabled":String(Boolean(s.disabled)),"data-active":this.active===e?"":void 0,part:"option",class:"option",onPointerDown:i=>i.preventDefault(),onClick:()=>this.choose(e,"pointer")},t("slot",{name:`option-${s.id}`},t("span",{class:"primary",part:"option-primary"},s.label),s.description&&t("span",{class:"secondary",part:"option-secondary"},s.description)))))))),this.canCreate&&t("div",{key:"a0aaafa2f4ff79efa954ed780f3a7bd81d4b2ecd",id:`option-${this.rows.length}`,role:"option","aria-selected":"false",class:"option",part:"option","data-active":this.active===this.rows.length?"":void 0,onPointerDown:i=>i.preventDefault(),onClick:()=>this.choose(this.rows.length,"pointer")},t("slot",{key:"53a6706fc2c26097948b08cf0a7ee6040e37fe57",name:"create"},"Create “",this.raw,"”"))),this.loading?t("div",{class:"message"},t("slot",{name:"loading"},"Loading suggestions…")):this.lookupError?t("div",{class:"message"},t("slot",{name:"error"},this.lookupError)):this.rows.length||this.canCreate?null:t("div",{class:"message"},t("slot",{name:"empty"},"No suggestions.")),t("slot",{key:"7997a0233a3c1a560b820c846645405ec4ceec1d",name:"footer"})),t("div",{key:"9143eb79141f5f3660a63f7a2471d1eecd8e9332",id:"validation",class:"message",part:"validation",hidden:!this.validation.issues.length},this.validation.issues.map((i=>t("div",null,i.message)))),t("div",{key:"21f310613b058f528f8c4df329864fd8a2a94b55",class:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true"},e," ","pending"===this.validation.status?"Checking value…":this.validation.issues.map((i=>i.message)).join(" ")))}static get watchers(){return{value:[{syncValue:0}],query:[{syncQuery:0}],disabled:[{syncDisabled:0}],readOnly:[{syncDisabled:0}],config:[{syncConfig:0}]}}};l.style=":host{display:grid;gap:var(--ui-space-1);min-inline-size:0;color:var(--ui-text-primary);font:inherit}label{color:var(--ui-field-label-color, var(--ui-text-primary));font-size:var(--ui-field-label-size, 0.875rem);font-weight:var(--ui-field-label-weight, 500)}.field{display:flex;min-inline-size:0;border:1px solid var(--ui-control-border, var(--ui-border-default));border-radius:var(--ui-radius-2);background:var(--ui-control-surface, var(--ui-surface-default))}.field:focus-within{border-color:var(--ui-control-focus, var(--ui-focus-ring));outline:2px solid var(--ui-control-focus, var(--ui-focus-ring));outline-offset:1px}input{appearance:none;width:100%;min-inline-size:0;min-block-size:var(--ui-control-min-block-size, 2.75rem);box-sizing:border-box;border:0;border-radius:inherit;background:transparent;color:inherit;font:inherit;line-height:var(--ui-line-height-md);padding:var(--ui-space-2) var(--ui-space-3);margin:0;outline:none}:host([data-size='sm']) input{min-block-size:var(--ui-field-compact-size, 2rem);padding:var(--ui-space-1) var(--ui-space-2)}button{appearance:none;border:0;border-radius:var(--ui-radius-2);background:transparent;color:var(--ui-field-affordance-color, var(--ui-text-secondary));font:inherit;font-weight:var(--ui-field-affordance-weight, 400);min-inline-size:2rem;padding:var(--ui-space-1);cursor:pointer}button:hover:enabled{background:var(--ui-surface-muted);color:var(--ui-text-primary)}button:focus-visible{outline:2px solid var(--ui-focus-ring);outline-offset:-3px}input:disabled,button:disabled{color:var(--ui-text-muted);cursor:not-allowed}.field:has(input:disabled){background:var(--ui-control-surface-disabled, var(--ui-surface-muted))}:host([data-validation='error']) .field{border-color:var(--ui-danger-solid, var(--ui-accent-active))}.popup{box-sizing:border-box;min-inline-size:12rem;max-inline-size:calc(100vw - 1rem);max-block-size:var(--ui-combobox-max-block-size, 18rem);overflow:auto;margin:0;padding:var(--ui-space-1);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-2);background:var(--ui-surface-elevated);color:var(--ui-text-primary);box-shadow:var(--ui-shadow-md)}[hidden]{display:none !important}.option{padding:var(--ui-space-2) var(--ui-space-3);border-radius:var(--ui-radius-1);cursor:pointer;overflow-wrap:anywhere}.option:hover,.option[data-active]{background:var(--ui-surface-muted);outline:1px solid var(--ui-focus-ring);outline-offset:-1px}.option[aria-disabled='true']{color:var(--ui-text-muted);cursor:not-allowed}.primary{display:block;color:var(--ui-option-primary-color, var(--ui-text-primary));font-weight:var(--ui-option-primary-weight, 500)}.secondary{display:block;color:var(--ui-option-secondary-color, var(--ui-text-secondary));font-weight:var(--ui-option-secondary-weight, 400);font-size:var(--ui-font-size-sm)}.message,.group{color:var(--ui-field-message-color, var(--ui-text-secondary));font-weight:var(--ui-field-message-weight, 400);font-size:var(--ui-font-size-sm);line-height:var(--ui-line-height-md);overflow-wrap:anywhere}.group,.popup .message{padding:var(--ui-space-2) var(--ui-space-3)}.sr-only{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@media (pointer: coarse){button{min-inline-size:2.75rem;min-block-size:2.75rem}}@media (forced-colors: active){.field,.popup{border-color:CanvasText}.option[data-active]{outline-color:Highlight}}";export{h as ui_chip,l as ui_combobox}
1
+ import{r as i,h as t,H as s,c as e,g as a}from"./p-8BGiMGQ0.js";import{a as o}from"./p-Drmwg-C1.js";import{c as r,o as n}from"./p-C-0syqXZ.js";const h=class{constructor(t){i(this,t)}appearance="tag";size="xs";render(){return t(s,{key:"970cb48cf8d70c47feaab90fe428c09f0d052a03","data-appearance":this.appearance,"data-size":this.size},t("span",{key:"6d8c6104d2869520097a2a61bd2a887b363b4912",class:"chip__surface"},t("span",{key:"638fb68ff5dffa629576c9e1079bb3169f2adb4f",class:"chip__label"},t("slot",{key:"8b31f2130e202e18d7717aee6add6bc6e7f119b5"}))))}};h.style=":host{--ui-chip-surface:var(--ui-surface-subtle);--ui-chip-text:var(--ui-text-secondary);--ui-chip-border:var(--ui-border-default);--ui-chip-font-size:var(--ui-font-size-xs);--ui-chip-font-weight:var(--ui-font-normal);--ui-chip-line-height:var(--ui-line-height-tight);--ui-chip-padding-block:var(--ui-space-0-5);--ui-chip-padding-inline:var(--ui-space-2);--ui-chip-notch:var(--ui-space-1);display:inline-flex;min-width:0;max-width:100%}:host([data-size='sm']){--ui-chip-font-size:var(--ui-font-size-sm)}.chip__surface{display:inline-flex;align-items:center;box-sizing:border-box;min-width:0;max-width:100%;padding:var(--ui-chip-padding-block) var(--ui-chip-padding-inline);border:1px solid var(--ui-chip-border);background:var(--ui-chip-surface);color:var(--ui-chip-text) !important;font-family:var(--ui-font-family-sans) !important;font-size:var(--ui-chip-font-size) !important;font-weight:var(--ui-chip-font-weight) !important;line-height:var(--ui-chip-line-height) !important}.chip__label{min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([data-appearance='pill']) .chip__surface{border-radius:var(--ui-radius-round)}:host([data-appearance='tag']) .chip__surface{border:0;padding-inline-end:calc(var(--ui-chip-padding-inline) + var(--ui-chip-notch));clip-path:polygon(0 0, calc(100% - var(--ui-chip-notch)) 0, 100% 50%, calc(100% - var(--ui-chip-notch)) 100%, 0 100%)}";const l=class{constructor(t){i(this,t),this.queryChange=e(this,"query-change"),this.valueChange=e(this,"value-change"),this.freeEntry=e(this,"free-entry"),this.createEntry=e(this,"create-entry"),this.dependencyInvalidate=e(this,"dependency-invalidate"),this.validationChange=e(this,"validation-change"),this.optionsChange=e(this,"options-change")}get host(){return a(this)}label="";placeholder="";name="";value;defaultValue;query;defaultQuery="";config={};disabled=!1;readOnly=!1;required=!1;size="md";labelVisibility="visible";disclosure=!1;clearable=!1;help="";queryChange;valueChange;freeEntry;createEntry;dependencyInvalidate;validationChange;optionsChange;raw="";display="";selected=null;expanded=!1;rows=[];active=-1;loading=!1;helpOpen=!1;lookupError="";validation={status:"pristine",touched:!1,dirty:!1,issues:[]};input;popup;field;surface;lookup;validationRun;lookupTimer;composing=!1;initialRaw="";overlayId=`ui-combobox-${Math.random().toString(36).slice(2)}`;alive=!1;fullSet=!1;knownOptions=new Map;awaitingLabel=null;proposedChange;formattedRaw;formattedWith;componentWillLoad(){this.selected=void 0!==this.value?this.value:this.defaultValue??null,this.raw=this.query??this.defaultQuery,void 0!==this.query||this.raw||null===this.selected||(this.raw=this.config.options?.find((i=>i.value===this.selected))?.label??this.selected),void 0===this.query&&null!==this.selected&&this.raw===this.selected&&(this.awaitingLabel=this.selected),this.display=this.raw,this.initialRaw=this.raw,this.applyServerIssues()}connectedCallback(){this.alive=!0,this.setupSurface()}componentDidLoad(){this.setupSurface()}componentDidUpdate(){this.input&&!this.composing&&this.input.value!==this.display&&(this.input.value=this.display),this.expanded&&this.surface?.refresh()}disconnectedCallback(){this.alive=!1,this.close(),this.validationRun?.abort(),this.surface?.destroy(),this.surface=void 0}setupSurface(){!this.surface&&this.popup&&this.field&&(this.surface=o(this.popup,{anchor:this.field,placement:"bottom-start"}))}syncValue(){if(void 0!==this.value){if(this.selected=this.value,void 0===this.query){const i=this.proposedChange,t=this.config.options?.find((i=>i.value===this.selected))??(null===this.selected?void 0:this.knownOptions.get(this.selected)),s=i?.value===this.selected?i.query:t?.label??this.selected??"";i?.value===this.selected&&s===this.raw||(this.raw=s,this.display=this.raw,this.formattedRaw=void 0),this.awaitingLabel=t||null===this.selected?null:this.selected}this.resetValidation()}}syncQuery(){void 0!==this.query&&this.query!==this.raw&&(void 0===this.value&&this.proposedChange?.query!==this.query&&(this.selected=null),this.awaitingLabel=null,this.formattedRaw=void 0,this.raw=this.query,this.display=this.raw,this.resetValidation(),this.expanded&&this.search("input"))}syncDisabled(){(this.disabled||this.readOnly)&&(this.close(),this.resetValidation())}syncConfig(i,t){if(this.validationRun?.abort(),i.provider===t?.provider&&i.context===t?.context||this.knownOptions.clear(),i.context!==t?.context){this.close();const t=i.invalidation??"retain-query";this.commit("retain"===t?this.selected:null,"clear"===t?"":this.raw,null,"invalidation","programmatic"),this.validation={status:"pristine",touched:!1,dirty:this.raw!==this.initialRaw,issues:[]}}this.applyServerIssues(),this.expanded&&this.search("context")}applyServerIssues(){const i=this.config.issues??[];i.length?this.setValidation({issues:i},this.validation.touched):this.resetValidation()}resetValidation(){this.validationRun?.abort(),this.validation={status:"pristine",touched:this.validation.touched,dirty:this.raw!==this.initialRaw,issues:[]},this.validationChange?.emit(this.validation)}cancelLookup(){clearTimeout(this.lookupTimer),this.lookup?.abort(),this.lookup=void 0,this.loading=!1}close(){this.expanded=!1,this.active=-1,this.cancelLookup(),this.surface?.hide(),r(this.overlayId)}open(i="input"){this.disabled||this.readOnly||(this.expanded=!0,this.popup&&this.field&&(this.popup.style.minWidth=`${this.field.getBoundingClientRect().width}px`),this.surface?.show(),n({id:this.overlayId,element:this.popup,relatedElements:[this.host],modal:!1,requestClose:()=>this.close()}),this.search(i))}search(i){this.cancelLookup(),this.fullSet="disclosure"===i,this.active=-1,this.lookupError="";const t=this.config,s=this.fullSet?"":this.raw,e=new AbortController;this.lookup=e;const a=i=>{if(e.signal.aborted||!this.alive)return;for(const t of i)this.knownOptions.set(t.value,t);const a=null===this.selected?void 0:this.knownOptions.get(this.selected);void 0===this.query&&this.awaitingLabel===this.selected&&a&&(this.raw=a.label,this.display=this.raw,this.awaitingLabel=null,this.formattedRaw=void 0,this.resetValidation());const o=new Set;this.rows=i.filter((i=>!o.has(i.id)&&(o.add(i.id),this.fullSet||(t.filter?t.filter(i,s,t.context):!!t.provider||i.label.toLocaleLowerCase().includes(s.toLocaleLowerCase())))));const r=new Map;for(const i of this.rows){const t=i.group??"";r.has(t)||r.set(t,[]),r.get(t).push(i)}this.rows=[...r.values()].flat(),this.loading=!1,this.optionsChange.emit(this.rows)};t.provider?(this.rows=[],this.loading=!0,this.lookupTimer=setTimeout((async()=>{try{a(await t.provider({query:s,context:t.context,signal:e.signal,reason:i}))}catch(i){if(e.signal.aborted||!this.alive)return;this.loading=!1,this.lookupError=i instanceof Error?i.message:"Unable to load suggestions."}}),"disclosure"===i?0:Math.max(0,t.debounce??200))):a(t.options??[])}get canCreate(){const i=this.config.options?[...this.config.options,...this.rows]:this.rows;return Boolean(this.config.allowCreate&&this.raw.trim()&&!this.loading&&!this.lookupError&&!i.some((i=>i.label.toLocaleLowerCase()===this.raw.toLocaleLowerCase())))}format(i){if((this.config.formatOn??"blur")!==i||!this.input)return;if(this.formattedRaw===this.raw&&this.formattedWith===this.config.format)return;const t=function(i,t,s){const e={display:i,selection:t};if(!s)return e;let a;try{a=s(i,t)}catch{return e}if(!a)return e;const o=Array.from(i);let r=0;for(const i of a.display)i===o[r]&&(r+=1);return!Number.isInteger(a.selection.start)||!Number.isInteger(a.selection.end)||r!==o.length||a.selection.start<0||a.selection.end<a.selection.start||a.selection.end>a.display.length?e:a}(this.raw,{start:this.input.selectionStart??this.raw.length,end:this.input.selectionEnd??this.raw.length,direction:this.input.selectionDirection??"none"},this.config.format);this.formattedRaw=this.raw,this.formattedWith=this.config.format,this.display=t.display,this.input.value!==t.display&&(this.input.value=t.display,this.input.setSelectionRange(t.selection.start,t.selection.end,t.selection.direction))}onInput=i=>{this.composing||i.isComposing||(this.awaitingLabel=null,this.formattedRaw=void 0,this.raw=this.input.value,this.display=this.raw,this.resetValidation(),this.format("input"),this.queryChange.emit({query:this.raw,display:this.display,trigger:"keyboard"}),null!==this.selected&&this.commit(null,this.raw,null,"clear","keyboard"),this.open(),"input"===this.config.validateOn&&this.validate(),queueMicrotask((()=>{void 0!==this.query&&this.query!==this.raw&&this.syncQuery()})))};commit(i,t,s,e,a){this.awaitingLabel=null;const o=t!==this.raw;void 0===this.value&&(this.selected=i),void 0===this.query&&o&&(this.raw=t,this.display=t,this.formattedRaw=void 0),this.resetValidation();const r={value:i,query:t,option:s,kind:e,trigger:a},n={value:i,query:t};this.proposedChange=n,this.valueChange.emit(r),o&&this.queryChange.emit({query:t,display:t,trigger:a}),"create"===e&&this.createEntry.emit(r),"free-entry"===e&&this.freeEntry.emit(r),"invalidation"===e&&this.dependencyInvalidate.emit(r),queueMicrotask((()=>{this.proposedChange===n&&(void 0!==this.value&&this.value!==n.value&&this.syncValue(),void 0!==this.query&&this.query!==n.query&&(void 0===this.value&&(this.selected=null,this.resetValidation()),this.syncQuery()),this.proposedChange=void 0)}))}choose(i,t){const s=this.rows[i];if(!s?.disabled){if(s)this.commit(s.value,s.label,s,"selection",t);else{if(!this.canCreate||i!==this.rows.length)return;this.commit(null,this.raw,null,"create",t)}this.close(),this.input?.focus(),"submit"!==this.config.validateOn&&queueMicrotask((()=>{this.validate()}))}}move(i){const t=this.rows.flatMap(((i,t)=>i.disabled?[]:[t]));if(this.canCreate&&t.push(this.rows.length),!t.length)return;const s=t.indexOf(this.active),e="Home"===i?0:"End"===i?t.length-1:"ArrowDown"===i?Math.min(s+1,t.length-1):s<0?t.length-1:Math.max(0,s-1);this.active=t[e],requestAnimationFrame((()=>this.host.shadowRoot?.getElementById(`option-${this.active}`)?.scrollIntoView({block:"nearest"})))}onKeydown=i=>{if(!(this.composing||i.isComposing||this.disabled||this.readOnly))return"Escape"===i.key&&this.expanded?(i.preventDefault(),i.stopPropagation(),void this.close()):void("Tab"!==i.key?i.altKey||i.ctrlKey||i.metaKey||i.shiftKey||("ArrowDown"===i.key||"ArrowUp"===i.key?(i.preventDefault(),this.expanded||this.open("disclosure"),this.move(i.key)):("Home"===i.key||"End"===i.key)&&this.expanded&&this.active>=0?(i.preventDefault(),this.move(i.key)):"Enter"===i.key&&this.expanded&&(this.active>=0?(i.preventDefault(),this.choose(this.active,"keyboard")):this.config.allowFreeText&&(i.preventDefault(),this.commit(null,this.raw,null,"free-entry","keyboard"),this.close()))):this.close())};onFocusOut=i=>{i.relatedTarget instanceof Node&&this.host.shadowRoot?.contains(i.relatedTarget)||(this.close(),this.format("blur"),this.validation={...this.validation,touched:!0},this.config.allowFreeText&&null===this.selected&&this.commit(null,this.raw,null,"free-entry","keyboard"),"blur"===(this.config.validateOn??"blur")&&this.validate())};setValidation(i,t=this.validation.touched){const s=i.issues.some((i=>"warning"!==i.severity));this.validation={status:s?"error":i.issues.length?"warning":"valid",touched:t,dirty:this.raw!==this.initialRaw,...i},this.validationChange?.emit(this.validation)}async validate(){this.validationRun?.abort();const i=new AbortController;this.validationRun=i,this.validation={...this.validation,status:"pending",output:void 0},this.validationChange.emit(this.validation);try{const t=await async function(i,t){let s=i.raw,e=[];const a=()=>i.signal.throwIfAborted();try{if(a(),t.parse&&(s=await t.parse(i.raw,i)),a(),t.schema){const i=await t.schema["~standard"].validate(s);a(),i.issues?e=i.issues:"value"in i&&(s=i.value)}if(!e.some((i=>"warning"!==i.severity))&&(t.normalize&&(s=await t.normalize(s,i)),a(),t.validator)){const o=await t.validator(s,i);a(),e=[...e,...o.issues??[]],"output"in o&&(s=o.output)}}catch(i){a(),e=[{message:i instanceof Error?i.message:"Unable to validate this value."}]}return e=[...e,...t.issues??[]],{output:e.some((i=>"warning"!==i.severity))?void 0:s,issues:e}}({raw:this.raw,value:this.selected,context:this.config.context,signal:i.signal},this.config);this.required&&!this.raw.trim()?t.issues=[...t.issues,{message:"A value is required."}]:!this.raw||null!==this.selected||this.config.allowFreeText||this.config.allowCreate||(t.issues=[...t.issues,{message:"Choose a suggestion."}]),t.issues.some((i=>"warning"!==i.severity))&&(t.output=void 0),!i.signal.aborted&&this.alive&&this.setValidation(t)}catch{}return this.validation}async focusInput(){this.input?.focus()}render(){const i=[this.helpOpen?"help-text":"",this.validation.issues.length?"validation":""].filter(Boolean).join(" ")||void 0,e=this.loading?"Loading suggestions…":this.lookupError||(this.expanded?`${this.rows.length} suggestions available.`:""),a=[...new Set(this.rows.map((i=>i.group??"")))];return t(s,{key:"1f00d9a83729d9c2147ced7e5006b928d1b5e51d","data-size":this.size,"data-validation":this.validation.status,onFocusout:this.onFocusOut},t("label",{key:"10353b147cc68ef1d67be0988849af1527fcf9ba",htmlFor:"input",part:"label",class:"sr-only"===this.labelVisibility?"sr-only":void 0},this.label,this.required?" *":""),t("div",{key:"74bb53137d9343add37c22f3ac503eccf41807a9",class:"field",part:"field",ref:i=>this.field=i,onClick:i=>{i.composedPath().some((i=>i instanceof HTMLButtonElement))||this.input?.focus()}},t("slot",{key:"24c26916365013faa4a78bd4fe0d01f6c129c703",name:"start"}),t("input",{key:"835d19e66ec4a24c1a83f43bbc256fa2a9e3332f",id:"input",ref:i=>this.input=i,role:"combobox","aria-autocomplete":"list","aria-expanded":String(this.expanded),"aria-controls":"listbox","aria-activedescendant":this.expanded&&this.active>=0?`option-${this.active}`:void 0,"aria-describedby":i,"aria-invalid":String("error"===this.validation.status),"aria-busy":String("pending"===this.validation.status),value:this.display,placeholder:this.placeholder,name:this.name||void 0,disabled:this.disabled,readOnly:this.readOnly,required:this.required,autoComplete:"off",part:"input",onInput:this.onInput,onKeyDown:this.onKeydown,onCompositionstart:()=>this.composing=!0,onCompositionend:()=>{this.composing=!1,this.onInput(new InputEvent("input"))}}),this.clearable&&t("button",{key:"326c1e24d3c417c3a72acd8234a53937b388ba79",type:"button",part:"affordance","aria-label":`Clear ${this.label}`,disabled:this.disabled||this.readOnly,onClick:()=>{this.commit(null,"",null,"clear","pointer"),this.close(),this.input?.focus()}},"×"),this.help&&t("button",{key:"6aeb62dc2935eb95670caa1d2028c0931dc362b2",id:"help",type:"button",part:"affordance","aria-label":`Help for ${this.label}`,disabled:this.disabled},t("span",{key:"9317be0fbb0c1bbb91061be69f38037a97a4c36b","aria-hidden":"true"},"?")),this.disclosure&&t("button",{key:"1cd2a0ea92df1144ff2297fcf64df7b3d0f4713a",type:"button",part:"affordance","aria-label":`Suggestions for ${this.label}`,"aria-controls":"listbox","aria-expanded":String(this.expanded),disabled:this.disabled||this.readOnly,onClick:()=>{this.expanded?this.close():this.open("disclosure"),this.input?.focus()}},t("span",{key:"0188b2d0e8cc7b7ff4d1a2175a0ff0b47d9c7d98","aria-hidden":"true"},"⌄"))),this.help&&t("ui-tooltip",{key:"e09fd35274c3e1fa6e408850d72f7a07c2bb4baf",id:"help-text",for:"help",toggleOnClick:!0,onOpen:()=>this.helpOpen=!0,onClose:()=>this.helpOpen=!1},this.help),t("div",{key:"ddf83a5944dd03fc7eb580b81fcf291e06c03601",class:"popup",part:"popup",hidden:!this.expanded,ref:i=>this.popup=i},t("div",{key:"1d73de1dabb6eaa95af12f2af88dac74e3f163ea",id:"listbox",role:"listbox","aria-label":`${this.label} suggestions`,"aria-busy":String(this.loading)},a.map((i=>t("div",{role:i?"group":"presentation","aria-label":i||void 0},i&&t("div",{class:"group",part:"group"},i),this.rows.map(((s,e)=>(s.group??"")!==i?null:t("div",{id:`option-${e}`,role:"option","aria-selected":String(this.selected===s.value),"aria-disabled":String(Boolean(s.disabled)),"data-active":this.active===e?"":void 0,part:"option",class:"option",onPointerDown:i=>i.preventDefault(),onClick:()=>this.choose(e,"pointer")},t("slot",{name:`option-${s.id}`},t("span",{class:"primary",part:"option-primary"},s.label),s.description&&t("span",{class:"secondary",part:"option-secondary"},s.description)))))))),this.canCreate&&t("div",{key:"a0aaafa2f4ff79efa954ed780f3a7bd81d4b2ecd",id:`option-${this.rows.length}`,role:"option","aria-selected":"false",class:"option",part:"option","data-active":this.active===this.rows.length?"":void 0,onPointerDown:i=>i.preventDefault(),onClick:()=>this.choose(this.rows.length,"pointer")},t("slot",{key:"53a6706fc2c26097948b08cf0a7ee6040e37fe57",name:"create"},"Create “",this.raw,"”"))),this.loading?t("div",{class:"message"},t("slot",{name:"loading"},"Loading suggestions…")):this.lookupError?t("div",{class:"message"},t("slot",{name:"error"},this.lookupError)):this.rows.length||this.canCreate?null:t("div",{class:"message"},t("slot",{name:"empty"},"No suggestions.")),t("slot",{key:"7997a0233a3c1a560b820c846645405ec4ceec1d",name:"footer"})),t("div",{key:"9143eb79141f5f3660a63f7a2471d1eecd8e9332",id:"validation",class:"message",part:"validation",hidden:!this.validation.issues.length},this.validation.issues.map((i=>t("div",null,i.message)))),t("div",{key:"21f310613b058f528f8c4df329864fd8a2a94b55",class:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true"},e," ","pending"===this.validation.status?"Checking value…":this.validation.issues.map((i=>i.message)).join(" ")))}static get watchers(){return{value:[{syncValue:0}],query:[{syncQuery:0}],disabled:[{syncDisabled:0}],readOnly:[{syncDisabled:0}],config:[{syncConfig:0}]}}};l.style=":host{display:grid;gap:var(--ui-space-1);min-inline-size:0;color:var(--ui-text-primary);font:inherit}label{color:var(--ui-field-label-color, var(--ui-text-primary));font-size:var(--ui-field-label-size, 0.875rem);font-weight:var(--ui-field-label-weight, 500)}.field{display:flex;min-inline-size:0;border:1px solid var(--ui-control-border, var(--ui-border-default));border-radius:var(--ui-radius-2);background:var(--ui-control-surface, var(--ui-surface-default))}.field:focus-within{border-color:var(--ui-control-focus, var(--ui-focus-ring));outline:2px solid var(--ui-control-focus, var(--ui-focus-ring));outline-offset:1px}input{appearance:none;width:100%;min-inline-size:0;min-block-size:var(--ui-control-min-block-size, 2.75rem);box-sizing:border-box;border:0;border-radius:inherit;background:transparent;color:inherit;font:inherit;line-height:var(--ui-line-height-md);padding:var(--ui-space-2) var(--ui-space-3);margin:0;outline:none}:host([data-size='sm']) input{min-block-size:var(--ui-field-compact-size, 2rem);padding:var(--ui-space-1) var(--ui-space-2)}button{appearance:none;border:0;border-radius:var(--ui-radius-2);background:transparent;color:var(--ui-field-affordance-color, var(--ui-text-secondary));font:inherit;font-weight:var(--ui-field-affordance-weight, 400);min-inline-size:2rem;padding:var(--ui-space-1);cursor:pointer}button:hover:enabled{background:var(--ui-surface-muted);color:var(--ui-text-primary)}button:focus-visible{outline:2px solid var(--ui-focus-ring);outline-offset:-3px}input:disabled,button:disabled{color:var(--ui-text-muted);cursor:not-allowed}.field:has(input:disabled){background:var(--ui-control-surface-disabled, var(--ui-surface-muted))}:host([data-validation='error']) .field{border-color:var(--ui-danger-solid, var(--ui-accent-active))}.popup{box-sizing:border-box;min-inline-size:12rem;max-inline-size:calc(100vw - 1rem);max-block-size:var(--ui-combobox-max-block-size, 18rem);overflow:auto;margin:0;padding:var(--ui-space-1);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-2);background:var(--ui-surface-elevated);color:var(--ui-text-primary);box-shadow:var(--ui-shadow-md)}[hidden]{display:none !important}.option{padding:var(--ui-space-2) var(--ui-space-3);border-radius:var(--ui-radius-1);cursor:pointer;overflow-wrap:anywhere}.option:hover,.option[data-active]{background:var(--ui-surface-muted);outline:1px solid var(--ui-focus-ring);outline-offset:-1px}.option[aria-disabled='true']{color:var(--ui-text-muted);cursor:not-allowed}.primary{display:block;color:var(--ui-option-primary-color, var(--ui-text-primary));font-weight:var(--ui-option-primary-weight, 500)}.secondary{display:block;color:var(--ui-option-secondary-color, var(--ui-text-secondary));font-weight:var(--ui-option-secondary-weight, 400);font-size:var(--ui-font-size-sm)}.message,.group{color:var(--ui-field-message-color, var(--ui-text-secondary));font-weight:var(--ui-field-message-weight, 400);font-size:var(--ui-font-size-sm);line-height:var(--ui-line-height-md);overflow-wrap:anywhere}.group,.popup .message{padding:var(--ui-space-2) var(--ui-space-3)}.sr-only{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@media (pointer: coarse){button{min-inline-size:2.75rem;min-block-size:2.75rem}}@media (forced-colors: active){.field,.popup{border-color:CanvasText}.option[data-active]{outline-color:Highlight}}";export{h as ui_chip,l as ui_combobox}
@@ -1 +1 @@
1
- import{r as i,g as a,h as o,H as e}from"./p-8BGiMGQ0.js";import{o as t,c as s,r}from"./p-C-0syqXZ.js";import{d as n}from"./p-JwSoedEO.js";import{i as d,c as l}from"./p-BnGhGgTH.js";const c=class{constructor(a){i(this,a)}get host(){return a(this)}open;defaultOpen=!1;modal=!0;dismissible=!0;label;internalOpen=!1;accessibleLabel="Dialog";overlayId=`ui-dialog-${Math.random().toString(36).slice(2,11)}`;dialogRef;contentObserver=null;syncFromProp(){d(this.open)&&(this.internalOpen=this.open)}syncLabelFromProp(){this.syncAccessibleLabel()}componentWillLoad(){this.syncAccessibleLabel()}syncOpen(){this.dialogRef&&(this.internalOpen?(this.dialogRef.showModal(),t({id:this.overlayId,modal:this.modal,element:this.host,dismissible:this.dismissible,requestClose:(i,a)=>this.handleRequestClose(i,a)})):(this.dialogRef.close(),s(this.overlayId)))}componentDidLoad(){this.contentObserver=new MutationObserver(this.syncAccessibleLabel),this.contentObserver.observe(this.host,{childList:!0,subtree:!0,characterData:!0}),this.internalOpen=l(this.open,this.defaultOpen),this.dialogRef?.addEventListener("close",this.onDialogClose),this.syncAccessibleLabel(),this.syncOpen()}disconnectedCallback(){this.dialogRef?.removeEventListener("close",this.onDialogClose),this.contentObserver?.disconnect(),this.contentObserver=null,s(this.overlayId)}componentDidUpdate(){this.syncOpen()}handleRequestClose(i,a){d(this.open)||(this.internalOpen=!1),n(this.host,"close",{open:!1,reason:i,trigger:a})}onDialogClose=()=>{this.internalOpen&&(d(this.open)?requestAnimationFrame((()=>this.syncOpen())):(this.internalOpen=!1,s(this.overlayId)),n(this.host,"close",{open:!1,reason:"programmatic",trigger:"programmatic"}))};onKeydown=i=>{"Escape"===i.key&&r("escape","keyboard")};syncAccessibleLabel=()=>{const i=this.label?.trim(),a=this.host.querySelector('[slot="heading"], [data-ui-dialog-title], h1, h2, h3, h4, h5, h6'),o=a?.textContent?.trim(),e=i||o||"Dialog";this.accessibleLabel!==e&&(this.accessibleLabel=e)};render(){return o(e,{key:"f5b4441f54505e40851dd239d12cf8ed09daabfe","data-open":this.internalOpen?"":void 0,onKeyDown:this.onKeydown},o("dialog",{key:"6896de6166cc085d9bd581dc053705fbce6328d8",ref:i=>this.dialogRef=i,open:this.internalOpen,"aria-label":this.accessibleLabel},o("slot",{key:"07515a7b8da25ccbd18bcde226129a569c999af7"})))}static get watchers(){return{open:[{syncFromProp:0}],label:[{syncLabelFromProp:0}],internalOpen:[{syncOpen:0}]}}};c.style=":host{display:block}:host:not([data-open]){display:none}:host dialog{--ui-dialog-duration:var(--ui-motion-base);--ui-dialog-viewport-gap:var(--ui-space-4, 1rem);position:fixed;inset:0;inline-size:min( calc(100% - (var(--ui-dialog-viewport-gap) * 2)), var(--ui-dialog-max-width, 440px) );max-inline-size:none;max-block-size:calc(100dvh - (var(--ui-dialog-viewport-gap) * 2));margin:auto;padding:var(--ui-space-4);overflow:auto;background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-dialog);box-shadow:var(--ui-shadow-dialog);visibility:hidden;pointer-events:none;opacity:0;transform:scale(0.96);transition:opacity var(--ui-dialog-duration) var(--ui-motion-ease), transform var(--ui-dialog-duration) var(--ui-motion-ease), visibility var(--ui-dialog-duration), display var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete, overlay var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete}:host dialog[open]{visibility:visible;pointer-events:auto;opacity:1;transform:scale(1);animation:ui-dialog-enter var(--ui-dialog-duration) var(--ui-motion-ease)}@keyframes ui-dialog-enter{from{opacity:0;transform:scale(0.96)}}:host dialog::backdrop{background-color:transparent;transition:background-color var(--ui-dialog-duration) var(--ui-motion-ease), display var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete, overlay var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete}:host dialog[open]::backdrop{background-color:var(--ui-overlay-backdrop);animation:ui-dialog-backdrop-enter var(--ui-dialog-duration) var(--ui-motion-ease)}@keyframes ui-dialog-backdrop-enter{from{background-color:transparent}}";export{c as ui_dialog}
1
+ import{r as i,g as a,h as o,H as e}from"./p-8BGiMGQ0.js";import{o as t,c as s,r}from"./p-C-0syqXZ.js";import{d as n}from"./p-JwSoedEO.js";import{i as d,c as l}from"./p-BnGhGgTH.js";const c=class{constructor(a){i(this,a)}get host(){return a(this)}open;defaultOpen=!1;modal=!0;dismissible=!0;label;internalOpen=!1;accessibleLabel="Dialog";overlayId=`ui-dialog-${Math.random().toString(36).slice(2,11)}`;dialogRef;contentObserver=null;syncFromProp(){d(this.open)&&(this.internalOpen=this.open)}syncLabelFromProp(){this.syncAccessibleLabel()}componentWillLoad(){this.syncAccessibleLabel()}syncOpen(){this.dialogRef&&(this.internalOpen?(this.dialogRef.showModal(),t({id:this.overlayId,modal:this.modal,element:this.host,dismissible:this.dismissible,requestClose:(i,a)=>this.handleRequestClose(i,a)})):(this.dialogRef.close(),s(this.overlayId)))}componentDidLoad(){this.contentObserver=new MutationObserver(this.syncAccessibleLabel),this.contentObserver.observe(this.host,{childList:!0,subtree:!0,characterData:!0}),this.internalOpen=l(this.open,this.defaultOpen),this.dialogRef?.addEventListener("close",this.onDialogClose),this.syncAccessibleLabel(),this.syncOpen()}disconnectedCallback(){this.dialogRef?.removeEventListener("close",this.onDialogClose),this.contentObserver?.disconnect(),this.contentObserver=null,s(this.overlayId)}componentDidUpdate(){this.syncOpen()}handleRequestClose(i,a){d(this.open)||(this.internalOpen=!1),n(this.host,"close",{open:!1,reason:i,trigger:a})}onDialogClose=()=>{this.internalOpen&&(d(this.open)?requestAnimationFrame((()=>this.syncOpen())):(this.internalOpen=!1,s(this.overlayId)),n(this.host,"close",{open:!1,reason:"programmatic",trigger:"programmatic"}))};onKeydown=i=>{"Escape"===i.key&&r("escape","keyboard")};syncAccessibleLabel=()=>{const i=this.label?.trim(),a=this.host.querySelector('[slot="heading"], [data-ui-dialog-title], h1, h2, h3, h4, h5, h6'),o=a?.textContent?.trim(),e=i||o||"Dialog";this.accessibleLabel!==e&&(this.accessibleLabel=e)};render(){return o(e,{key:"f5b4441f54505e40851dd239d12cf8ed09daabfe","data-open":this.internalOpen?"":void 0,onKeyDown:this.onKeydown},o("dialog",{key:"6896de6166cc085d9bd581dc053705fbce6328d8",ref:i=>this.dialogRef=i,open:this.internalOpen,"aria-label":this.accessibleLabel},o("slot",{key:"07515a7b8da25ccbd18bcde226129a569c999af7"})))}static get watchers(){return{open:[{syncFromProp:0}],label:[{syncLabelFromProp:0}],internalOpen:[{syncOpen:0}]}}};c.style=":host{display:block}:host:not([data-open]){display:none}:host dialog{--ui-dialog-duration:var(--ui-motion-base);--ui-dialog-viewport-gap:var(--ui-space-4, 1rem);position:fixed;inset:0;box-sizing:border-box;inline-size:min( calc(100% - (var(--ui-dialog-viewport-gap) * 2)), var(--ui-dialog-max-width, 440px) );max-inline-size:none;max-block-size:calc(100dvh - (var(--ui-dialog-viewport-gap) * 2));margin:auto;padding:var(--ui-space-4);overflow:auto;background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-dialog);box-shadow:var(--ui-shadow-dialog);visibility:hidden;pointer-events:none;opacity:0;transform:scale(0.96);transition:opacity var(--ui-dialog-duration) var(--ui-motion-ease), transform var(--ui-dialog-duration) var(--ui-motion-ease), visibility var(--ui-dialog-duration), display var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete, overlay var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete}:host dialog[open]{visibility:visible;pointer-events:auto;opacity:1;transform:scale(1);animation:ui-dialog-enter var(--ui-dialog-duration) var(--ui-motion-ease)}@keyframes ui-dialog-enter{from{opacity:0;transform:scale(0.96)}}:host dialog::backdrop{background-color:transparent;transition:background-color var(--ui-dialog-duration) var(--ui-motion-ease), display var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete, overlay var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete}:host dialog[open]::backdrop{background-color:var(--ui-overlay-backdrop);animation:ui-dialog-backdrop-enter var(--ui-dialog-duration) var(--ui-motion-ease)}@keyframes ui-dialog-backdrop-enter{from{background-color:transparent}}";export{c as ui_dialog}
@@ -0,0 +1 @@
1
+ import{r as e,g as i,h as t,H as s}from"./p-8BGiMGQ0.js";import{d as a,e as r}from"./p-JwSoedEO.js";import{o,c as n,r as l}from"./p-C-0syqXZ.js";import{i as h,c}from"./p-BnGhGgTH.js";import{a as u}from"./p-Drmwg-C1.js";const d=class{constructor(i){e(this,i)}get host(){return i(this)}open;defaultOpen=!1;for;placement="bottom-start";internalOpen=!1;overlayId=`ui-menu-${Math.random().toString(36).slice(2,11)}`;anchor=null;surface=null;syncFromProp(){h(this.open)&&(this.internalOpen=this.open)}resetSurface(){this.setupSurface(),this.syncSurface()}syncSurface(){this.syncAnchorState(),this.surface&&(this.internalOpen?(this.surface.show(),o({id:this.overlayId,modal:!1,element:this.host,relatedElements:this.anchor?[this.anchor]:void 0,dismissible:!0,requestClose:(e,i)=>this.closeMenu(e,i)})):(this.surface.hide(),n(this.overlayId)))}componentDidLoad(){this.internalOpen=c(this.open,this.defaultOpen),this.host.addEventListener("click",this.onItemClick),this.host.addEventListener("keydown",this.onKeydown),this.setupSurface(),this.syncSurface()}disconnectedCallback(){this.host.removeEventListener("click",this.onItemClick),this.host.removeEventListener("keydown",this.onKeydown),this.surface?.destroy(),this.surface=null,n(this.overlayId)}setupSurface(){this.surface?.destroy(),this.surface=null,this.anchor=this.for?this.host.ownerDocument.getElementById(this.for):null,this.anchor&&(this.surface=u(this.host,{anchor:this.anchor,placement:this.placement}))}syncAnchorState(){this.anchor&&(this.anchor.setAttribute("aria-haspopup","menu"),this.anchor.setAttribute("aria-expanded",this.internalOpen?"true":"false"))}closeMenu(e,i){this.internalOpen&&(h(this.open)||(this.internalOpen=!1),a(this.host,"close",{open:!1,reason:e,trigger:i}),"escape"===e&&this.anchor?.focus())}getItems(){return Array.from(this.host.querySelectorAll("ui-menu-item"))}isItemDisabled(e){return"true"===e.getAttribute("aria-disabled")||e.hasAttribute("disabled")||"true"===e.getAttribute("disabled")||!0===e.disabled}onItemClick=e=>{const i=e.target.closest?.("ui-menu-item");if(!i||i.getRootNode()!==this.host.getRootNode())return;if(this.isItemDisabled(i))return;const t=i.getAttribute("value")??i.getAttribute("data-value")??"";a(this.host,"select",{value:t,trigger:r(e)}),a(this.host,"close",{open:!1,reason:"action",trigger:r(e)}),h(this.open)||(this.internalOpen=!1)};onKeydown=e=>{if("Escape"===e.key)return e.preventDefault(),void l("escape","keyboard");const i=this.getItems().filter((e=>!this.isItemDisabled(e)));if(0===i.length)return;const t=e.target.closest?.("ui-menu-item"),s=t&&t instanceof HTMLElement?i.indexOf(t):-1;if("Enter"!==e.key&&" "!==e.key)"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),i["ArrowDown"===e.key?s<0?0:Math.min(s+1,i.length-1):s<=0?i.length-1:s-1].focus());else if(e.preventDefault(),t&&s>=0){const e=t.getAttribute("value")??t.getAttribute("data-value")??"";a(this.host,"select",{value:e,trigger:"keyboard"}),a(this.host,"close",{open:!1,reason:"action",trigger:"keyboard"}),h(this.open)||(this.internalOpen=!1)}};render(){return t(s,{key:"22689ca1b0514bb27a76bfb9a702c0d4ce49d136",role:"menu","aria-orientation":"vertical","data-open":this.internalOpen?"":void 0},t("div",{key:"cff891a33348f077631f1b92f1167285aafd25f1",class:"menu__surface"},t("slot",{key:"3a0e9ff4f36b1afbe5f879e0e51ff4943279b5b5"})))}static get watchers(){return{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncSurface:0}]}}};d.style=":host{--ui-menu-viewport-gap:var(--ui-space-2, 0.5rem);display:flex;flex-direction:column;box-sizing:border-box;inline-size:max-content;min-inline-size:min(12rem, calc(100vw - (var(--ui-menu-viewport-gap) * 2)));max-inline-size:calc(100vw - (var(--ui-menu-viewport-gap) * 2));padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:visible}.menu__surface{display:flex;flex-direction:column;box-sizing:border-box;max-inline-size:inherit;padding:var(--ui-space-1);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg);max-block-size:inherit;overflow:auto}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;overflow:visible;max-block-size:calc(100dvh - (var(--ui-menu-viewport-gap) * 2));opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}::slotted(ui-menu-item){display:block;width:100%}";export{d as ui_menu}
@@ -1 +1 @@
1
- import{r as e,g as o,h as t,H as s}from"./p-8BGiMGQ0.js";import{o as r,c as i,r as a}from"./p-C-0syqXZ.js";import{d as n}from"./p-JwSoedEO.js";import{i as p,c as h}from"./p-BnGhGgTH.js";import{a as d}from"./p-Bu0dmLBE.js";const c=class{constructor(o){e(this,o)}get host(){return o(this)}open;defaultOpen=!1;for;placement="bottom-start";internalOpen=!1;overlayId=`ui-popover-${Math.random().toString(36).slice(2,11)}`;anchor=null;surface=null;syncFromProp(){p(this.open)&&(this.internalOpen=this.open)}onOpenChange(){this.syncOverlay(),this.internalOpen?n(this.host,"open",{open:!0,reason:"programmatic",trigger:"programmatic"}):n(this.host,"close",{open:!1,reason:"programmatic",trigger:"programmatic"})}resetSurface(){this.setupSurface(),this.syncSurface()}setupSurface(){this.surface?.destroy(),this.surface=null,this.anchor=this.for?this.host.ownerDocument.getElementById(this.for):null,this.anchor&&(this.surface=d(this.host,{anchor:this.anchor,placement:this.placement}))}syncSurface(){this.surface&&(this.internalOpen?this.surface.show():this.surface.hide())}syncOverlay(){this.syncSurface(),this.internalOpen?r({id:this.overlayId,modal:!1,element:this.host,relatedElements:this.anchor?[this.anchor]:void 0,dismissible:!0,requestClose:(e,o)=>this.handleRequestClose(e,o)}):i(this.overlayId)}componentDidLoad(){this.internalOpen=h(this.open,this.defaultOpen),this.host.addEventListener("keydown",this.onKeydown),this.setupSurface(),this.syncOverlay()}disconnectedCallback(){this.host.removeEventListener("keydown",this.onKeydown),this.surface?.destroy(),this.surface=null,i(this.overlayId)}componentDidUpdate(){this.syncOverlay()}handleRequestClose(e,o){p(this.open)||(this.internalOpen=!1),n(this.host,"close",{open:!1,reason:e,trigger:o})}onKeydown=e=>{"Escape"===e.key&&a("escape","keyboard")};render(){return t(s,{key:"f63907b8e49b8264c291048c509b6164fdd60ca4","data-open":this.internalOpen?"":void 0,onKeyDown:this.onKeydown},t("div",{key:"2425f4394749d994693f4a256256bd9e2f5daf60",class:"popover__surface"},t("slot",{key:"3b6f925da371d43e828842c4027cddee673d7ab3"})))}static get watchers(){return{open:[{syncFromProp:0}],internalOpen:[{onOpenChange:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}]}}};c.style=":host{--ui-popover-viewport-gap:var(--ui-space-2, 0.5rem);box-sizing:border-box;max-inline-size:min( 20rem, calc(100vw - (var(--ui-popover-viewport-gap) * 2)) );max-block-size:calc(100dvh - (var(--ui-popover-viewport-gap) * 2));overflow:auto;padding:0;border:0;border-radius:0;background:transparent;box-shadow:var(--ui-shadow-lg)}.popover__surface{box-sizing:border-box;padding:var(--ui-space-3);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}";export{c as ui_popover}
1
+ import{r as e,g as o,h as t,H as s}from"./p-8BGiMGQ0.js";import{o as i,c as r,r as a}from"./p-C-0syqXZ.js";import{d as n}from"./p-JwSoedEO.js";import{i as p,c as h}from"./p-BnGhGgTH.js";import{a as d}from"./p-Drmwg-C1.js";const c=class{constructor(o){e(this,o)}get host(){return o(this)}open;defaultOpen=!1;for;placement="bottom-start";internalOpen=!1;overlayId=`ui-popover-${Math.random().toString(36).slice(2,11)}`;anchor=null;surface=null;syncFromProp(){p(this.open)&&(this.internalOpen=this.open)}onOpenChange(){this.syncOverlay(),this.internalOpen?n(this.host,"open",{open:!0,reason:"programmatic",trigger:"programmatic"}):n(this.host,"close",{open:!1,reason:"programmatic",trigger:"programmatic"})}resetSurface(){this.setupSurface(),this.syncSurface()}setupSurface(){this.surface?.destroy(),this.surface=null,this.anchor=this.for?this.host.ownerDocument.getElementById(this.for):null,this.anchor&&(this.surface=d(this.host,{anchor:this.anchor,placement:this.placement}))}syncSurface(){this.surface&&(this.internalOpen?this.surface.show():this.surface.hide())}syncOverlay(){this.syncSurface(),this.internalOpen?i({id:this.overlayId,modal:!1,element:this.host,relatedElements:this.anchor?[this.anchor]:void 0,dismissible:!0,requestClose:(e,o)=>this.handleRequestClose(e,o)}):r(this.overlayId)}componentDidLoad(){this.internalOpen=h(this.open,this.defaultOpen),this.host.addEventListener("keydown",this.onKeydown),this.setupSurface(),this.syncOverlay()}disconnectedCallback(){this.host.removeEventListener("keydown",this.onKeydown),this.surface?.destroy(),this.surface=null,r(this.overlayId)}componentDidUpdate(){this.syncOverlay()}handleRequestClose(e,o){p(this.open)||(this.internalOpen=!1),n(this.host,"close",{open:!1,reason:e,trigger:o})}onKeydown=e=>{"Escape"===e.key&&a("escape","keyboard")};render(){return t(s,{key:"f63907b8e49b8264c291048c509b6164fdd60ca4","data-open":this.internalOpen?"":void 0,onKeyDown:this.onKeydown},t("div",{key:"2425f4394749d994693f4a256256bd9e2f5daf60",class:"popover__surface"},t("slot",{key:"3b6f925da371d43e828842c4027cddee673d7ab3"})))}static get watchers(){return{open:[{syncFromProp:0}],internalOpen:[{onOpenChange:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}]}}};c.style=":host{--ui-popover-viewport-gap:var(--ui-space-2, 0.5rem);box-sizing:border-box;max-inline-size:min( 20rem, calc(100vw - (var(--ui-popover-viewport-gap) * 2)) );max-block-size:calc(100dvh - (var(--ui-popover-viewport-gap) * 2));overflow:visible;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}.popover__surface{box-sizing:border-box;max-inline-size:inherit;max-block-size:inherit;overflow:auto;padding:var(--ui-space-3);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}";export{c as ui_popover}