@streamscloud/kit 0.90.1 → 0.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/core/validation/form-validation-handler/form-validation-handler.svelte.d.ts +20 -8
  2. package/dist/core/validation/form-validation-handler/form-validation-handler.svelte.js +80 -63
  3. package/dist/core/validation/form-validation-handler/index.d.ts +1 -1
  4. package/dist/core/validation/form-validation-handler/types.d.ts +4 -0
  5. package/dist/core/validation/form-validation-handler/validation-helper.d.ts +6 -0
  6. package/dist/core/validation/form-validation-handler/validation-helper.js +27 -0
  7. package/dist/styles/_semantic.scss +0 -1
  8. package/dist/ui/_internal/_top-layer.scss +10 -0
  9. package/dist/ui/_internal/input-emoji-picker/cmp.input-emoji-picker.svelte +1 -1
  10. package/dist/ui/_internal/top-layer/index.d.ts +1 -0
  11. package/dist/ui/_internal/top-layer/index.js +6 -0
  12. package/dist/ui/breadcrumb/cmp.breadcrumb.svelte +4 -11
  13. package/dist/ui/color-picker/cmp.color-picker.svelte +0 -1
  14. package/dist/ui/date-picker/cmp.date-picker.svelte +50 -100
  15. package/dist/ui/date-picker/cmp.date-picker.svelte.d.ts +1 -1
  16. package/dist/ui/form-field/cmp.form-field-validatable.svelte +2 -9
  17. package/dist/ui/form-field/cmp.form-field-validatable.svelte.d.ts +3 -7
  18. package/dist/ui/player/buttons/player-context-menu.svelte +1 -1
  19. package/dist/ui/popover/cmp.hover-popover.svelte.d.ts +0 -1
  20. package/dist/ui/popover/cmp.popover.svelte +84 -41
  21. package/dist/ui/popover/cmp.popover.svelte.d.ts +15 -9
  22. package/dist/ui/select/cmp.multiselect.svelte.d.ts +1 -1
  23. package/dist/ui/select/select-listbox.svelte +17 -9
  24. package/dist/ui/tile-card/cmp.tile-card.svelte +0 -1
  25. package/dist/ui/toast/cmp.toaster.svelte +0 -4
  26. package/dist/ui/tooltip/cmp.tooltip.svelte +15 -8
  27. package/dist/ui/tooltip/cmp.tooltip.svelte.d.ts +0 -1
  28. package/dist/ui/tree/cmp.tree-node-view.svelte +1 -1
  29. package/dist/ui/url-input/cmp.url-input.svelte +1 -1
  30. package/dist/ui/validatable/cmp.validatable.svelte +9 -46
  31. package/dist/ui/validatable/cmp.validatable.svelte.d.ts +4 -29
  32. package/dist/ui/validatable/index.d.ts +1 -2
  33. package/dist/ui/validatable/types.d.ts +12 -0
  34. package/package.json +1 -1
@@ -46,7 +46,7 @@ type RequiredProps = BaseProps & {
46
46
  };
47
47
  type Props = ClearableProps | RequiredProps;
48
48
  /**
49
- * DatePicker — single-day calendar picker built on Floating UI for positioning. Discriminated by
49
+ * DatePicker — single-day calendar picker whose calendar opens in a `Popover`. Discriminated by
50
50
  * `clearable`: `clearable: true` allows clearing to `null` and shows a clear (X) button;
51
51
  * `clearable: false` requires a value and renders no clear control. Emits ISO 8601 strings via
52
52
  * `on.change` from local midnight of the picked day.
@@ -1,16 +1,9 @@
1
1
  <script lang="ts" generics="T extends Record<string, unknown>, K extends keyof T & string">import { Validatable } from '../validatable';
2
2
  import { default as FormField } from './cmp.form-field.svelte';
3
- let { handler, name, label, hint, required = false, validateOn, debounceMs, disableTouchedTracking, errorPlacement, on, children: field } = $props();
3
+ let { handler, name, label, hint, required = false, debounceMs, disableTouchedTracking, errorPlacement, on, children: field } = $props();
4
4
  </script>
5
5
 
6
- <Validatable
7
- handler={handler}
8
- name={name}
9
- validateOn={validateOn}
10
- debounceMs={debounceMs}
11
- disableTouchedTracking={disableTouchedTracking}
12
- errorPlacement={errorPlacement}
13
- on={on}>
6
+ <Validatable handler={handler} name={name} debounceMs={debounceMs} disableTouchedTracking={disableTouchedTracking} errorPlacement={errorPlacement} on={on}>
14
7
  {#snippet children(binding, validating)}
15
8
  <FormField label={label} hint={hint} required={required}>
16
9
  {#snippet children(ids)}
@@ -1,12 +1,10 @@
1
1
  import type { FormValidationHandler } from '../../core/validation';
2
- import { type ErrorPlacement, type FieldBinding, type ValidateOnEvent } from '../validatable';
2
+ import { type ErrorPlacement, type FieldBinding } from '../validatable';
3
3
  import { type FormFieldIds } from './cmp.form-field.svelte';
4
4
  import type { Snippet } from 'svelte';
5
5
  declare function $$render<T extends Record<string, unknown>, K extends keyof T & string>(): {
6
6
  props: {
7
- /** Form validation handler instance. */
8
7
  handler: FormValidationHandler<T>;
9
- /** Field name in the form handler. */
10
8
  name: K;
11
9
  /** Label rendered above the input. String renders as text; Snippet allows extra content (e.g. tooltip icon) next to the text. */
12
10
  label?: string | Snippet;
@@ -14,11 +12,9 @@ declare function $$render<T extends Record<string, unknown>, K extends keyof T &
14
12
  hint?: string | Snippet;
15
13
  /** Appends a danger-colored `*` to the label. */
16
14
  required?: boolean;
17
- /** Which events trigger validation. Forwarded to `<Validatable>`. @default ['input', 'change', 'blur'] */
18
- validateOn?: ValidateOnEvent[];
19
- /** Debounce validator calls in ms. Forwarded to `<Validatable>`. @default 0 */
15
+ /** Delay before the validator runs after the value changes. Forwarded to `<Validatable>`. */
20
16
  debounceMs?: number;
21
- /** Show errors before the field has been touched. Forwarded to `<Validatable>`. @default false */
17
+ /** Show errors before the field has been touched. Forwarded to `<Validatable>`. */
22
18
  disableTouchedTracking?: boolean;
23
19
  /** Where the error message sits. Forwarded to `<Validatable>`. @default 'overlay' */
24
20
  errorPlacement?: ErrorPlacement;
@@ -7,7 +7,7 @@ let { actions, position = 'left-end' } = $props();
7
7
  const localization = new PlayerButtonsLocalization();
8
8
  </script>
9
9
 
10
- <Popover position={position} fixedPosition fillContainer aria-label={localization.moreActions}>
10
+ <Popover position={position} fillContainer aria-label={localization.moreActions}>
11
11
  {#snippet trigger()}
12
12
  <IconSlot icon={IconMoreVertical} />
13
13
  {/snippet}
@@ -7,7 +7,6 @@ type Props = {
7
7
  offset?: number;
8
8
  /** Padding in px from the viewport boundary before content shifts/flips. @default 8 */
9
9
  boundaryMargin?: number;
10
- fixedPosition?: boolean;
11
10
  matchWidth?: boolean;
12
11
  disabled?: boolean;
13
12
  backdrop?: boolean;
@@ -1,17 +1,21 @@
1
1
  <script lang="ts">import { isInsideLabelOf } from '../_internal/form-field-label-context';
2
+ import { showInTopLayer } from '../_internal/top-layer';
2
3
  import { Icon } from '../icon';
3
4
  import { isIgnored } from './popover-ignore';
4
5
  import { validateTrigger } from './validate-trigger';
5
- import { autoUpdate, computePosition, flip, offset as offsetMiddleware, shift, size } from '@floating-ui/dom';
6
+ import { autoUpdate, computePosition, flip, hide, offset as offsetMiddleware, shift, size } from '@floating-ui/dom';
6
7
  import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
7
8
  import { tick } from 'svelte';
8
- let { position = 'bottom-start', disabled = false, fixedPosition = false, offset = 4, boundaryMargin = 8, backdrop = false, matchWidth = false, panel = true, keepOpen = false, fillContainer = false, tabbable = true, on, children, trigger, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby } = $props();
9
+ let { position = 'bottom-start', disabled = false, offset = 4, boundaryMargin = 8, backdrop = false, matchWidth = false, panel = true, keepOpen = false, fillContainer = false, tabbable = true, on, children, trigger, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby } = $props();
9
10
  let opened = $state(false);
10
11
  let triggerEl = $state.raw(undefined);
12
+ const customTrigger = $derived(trigger && typeof trigger !== 'function' ? trigger.custom : undefined);
11
13
  let contentEl = $state.raw(undefined);
14
+ let backdropEl = $state.raw(undefined);
12
15
  // svelte-ignore state_referenced_locally
13
16
  let resolvedPlacement = $state(position);
14
17
  let previouslyFocused = null;
18
+ let closedByEscape = false;
15
19
  /** Imperative API — bind:this on the component to access. */
16
20
  export const open = () => {
17
21
  if (disabled || opened) {
@@ -37,12 +41,22 @@ export const toggle = () => {
37
41
  };
38
42
  // Floating UI: compute + auto-update position while opened.
39
43
  $effect(() => {
40
- if (!opened || !triggerEl || !contentEl) {
44
+ if (!opened || !triggerEl || !contentEl || (backdrop && !backdropEl)) {
41
45
  return;
42
46
  }
43
47
  const t = triggerEl;
44
48
  const c = contentEl;
49
+ const b = backdropEl;
50
+ const showLayers = () => {
51
+ // The top layer stacks by show order: the backdrop must be shown before the content it sits under.
52
+ if (b) {
53
+ showInTopLayer(b);
54
+ }
55
+ showInTopLayer(c);
56
+ };
57
+ showLayers();
45
58
  const update = async () => {
59
+ showLayers();
46
60
  const middleware = [
47
61
  offsetMiddleware(offset),
48
62
  flip({ padding: boundaryMargin }),
@@ -59,17 +73,18 @@ $effect(() => {
59
73
  elements.floating.style.minWidth = `${width}px`;
60
74
  }
61
75
  }
62
- })
76
+ }),
77
+ hide()
63
78
  ];
64
79
  const result = await computePosition(t, c, {
65
80
  placement: position,
66
- strategy: fixedPosition ? 'fixed' : 'absolute',
81
+ strategy: 'fixed',
67
82
  middleware
68
83
  });
69
84
  Object.assign(c.style, {
70
- position: fixedPosition ? 'fixed' : 'absolute',
71
85
  left: `${result.x}px`,
72
- top: `${result.y}px`
86
+ top: `${result.y}px`,
87
+ visibility: result.middlewareData.hide?.referenceHidden ? 'hidden' : ''
73
88
  });
74
89
  resolvedPlacement = result.placement;
75
90
  };
@@ -91,9 +106,13 @@ $effect(() => {
91
106
  return;
92
107
  }
93
108
  previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
109
+ closedByEscape = false;
94
110
  void focusFirstFocusable();
95
111
  return () => {
96
- previouslyFocused?.focus?.();
112
+ // Only Escape: returning focus on any close flashes the trigger's focus ring when a dialog opened from an item closes.
113
+ if (closedByEscape) {
114
+ previouslyFocused?.focus?.();
115
+ }
97
116
  previouslyFocused = null;
98
117
  };
99
118
  });
@@ -115,6 +134,7 @@ $effect(() => {
115
134
  const handleKey = (e) => {
116
135
  if (e.key === 'Escape') {
117
136
  e.preventDefault();
137
+ closedByEscape = true;
118
138
  close();
119
139
  return;
120
140
  }
@@ -171,30 +191,36 @@ const handleBackdropClick = (e) => {
171
191
  </script>
172
192
 
173
193
  {#if opened && backdrop}
174
- <div class="popover-backdrop" onclick={handleBackdropClick} onkeydown={() => undefined} role="none"></div>
194
+ <div bind:this={backdropEl} class="popover-backdrop" popover="manual" onclick={handleBackdropClick} onkeydown={() => undefined} role="none"></div>
175
195
  {/if}
176
196
 
177
- <div class="popover" class:popover--disabled={disabled} class:popover--fill-container={fillContainer}>
178
- <button
179
- bind:this={triggerEl}
180
- type="button"
181
- class="popover__trigger"
182
- class:popover__trigger--fill={fillContainer}
183
- id={id}
184
- disabled={disabled}
185
- tabindex={tabbable ? undefined : -1}
186
- aria-label={ariaLabel}
187
- aria-labelledby={ariaLabelledby}
188
- aria-haspopup="true"
189
- aria-expanded={opened}
190
- onclick={handleTriggerClick}
191
- use:validateTrigger>
192
- {#if trigger}
193
- {@render trigger()}
194
- {:else}
195
- <Icon src={IconChevronDown} />
196
- {/if}
197
- </button>
197
+ <div class="popover" class:popover--disabled={disabled && !customTrigger} class:popover--fill-container={fillContainer}>
198
+ {#if customTrigger}
199
+ <span bind:this={triggerEl} class="popover__anchor" onclick={handleTriggerClick} onkeydown={() => undefined} role="none">
200
+ {@render customTrigger()}
201
+ </span>
202
+ {:else}
203
+ <button
204
+ bind:this={triggerEl}
205
+ type="button"
206
+ class="popover__trigger"
207
+ class:popover__trigger--fill={fillContainer}
208
+ id={id}
209
+ disabled={disabled}
210
+ tabindex={tabbable ? undefined : -1}
211
+ aria-label={ariaLabel}
212
+ aria-labelledby={ariaLabelledby}
213
+ aria-haspopup="true"
214
+ aria-expanded={opened}
215
+ onclick={handleTriggerClick}
216
+ use:validateTrigger>
217
+ {#if typeof trigger === 'function'}
218
+ {@render trigger()}
219
+ {:else}
220
+ <Icon src={IconChevronDown} />
221
+ {/if}
222
+ </button>
223
+ {/if}
198
224
 
199
225
  {#if opened}
200
226
  <div
@@ -202,6 +228,7 @@ const handleBackdropClick = (e) => {
202
228
  class="popover__content"
203
229
  class:popover__content--bounded={panel}
204
230
  data-placement={resolvedPlacement}
231
+ popover="manual"
205
232
  role="dialog"
206
233
  tabindex="-1"
207
234
  onclick={handleContentClick}
@@ -237,10 +264,12 @@ With `panel` on, content sizes to `max-content` and, above the `min-width` floor
237
264
  `--sc-kit--popover--content--max-width` for a tighter cap than the available space.
238
265
 
239
266
  Because the panel fits itself to the available height, it is a scroll container by default. With `panel={false}` none of the three bounds apply — no width
240
- cap, no height fit, no clipping — since that consumer owns the box entirely. Floating content nested inside it — a submenu, a `Tooltip` on
241
- an item — is not clipped **once the panel has appeared**: those bubbles resolve their position against the popover's own positioned box, which sits outside
242
- the scrolling area, so `fixedPosition` on a nested Popover stays optional. During the appear animation the panel does carry a transform and therefore does
243
- clip, so a bubble opening within that window (a `Tooltip` with a near-zero `delay`) is cut off for its duration.
267
+ cap, no height fit, no clipping — since that consumer owns the box entirely.
268
+
269
+ The content renders in the top layer (Popover API, `popover="manual"`), as do the kit's `Tooltip`, Select listboxes and `DatePicker` panel: no ancestor
270
+ `overflow`, `mask`, `transform` or `filter` clips it — floating content nested inside the panel included — and it stacks by the order things were shown,
271
+ not by `z-index`. The panel follows its trigger with `position: fixed`, repositioned on every ancestor scroll, and hides while the trigger is scrolled out
272
+ of a clipping ancestor.
244
273
 
245
274
  Two consequences of the panel being a scroll container. `--sc-kit--popover--content--overflow: visible` removes the clipping but not the height fit — the
246
275
  panel is still shrunk and its content would paint outside the chrome, so pair it with `--sc-kit--popover--content--max-height: none` to opt out of both. And
@@ -261,7 +290,6 @@ already carries the margin that keeps it clear.
261
290
  | `--sc-kit--popover--content--min-width` | Content min width. Wins over max-width when the two conflict; ignored under `matchWidth` | `12.5rem` |
262
291
  | `--sc-kit--popover--content--overflow` | Panel overflow, both axes. Applies only with `panel` on. `visible` opts out of clipping | `hidden auto` |
263
292
  | `--sc-kit--popover--content--padding` | Content padding | `var(--sc-kit--space--1) 0` |
264
- | `--sc-kit--popover--content--z-index` | Content z-index | `var(--sc-kit--z-index--popover)` |
265
293
 
266
294
  Props for keeping the popover open during interaction:
267
295
  - `keepOpen` (Popover-level): block any inner click from closing — for interactive content (color pickers, emoji panels, etc.).
@@ -270,10 +298,18 @@ Props for keeping the popover open during interaction:
270
298
  -->
271
299
 
272
300
  <style>.popover-backdrop {
301
+ inset: 0 auto auto 0;
302
+ margin: 0;
303
+ padding: 0;
304
+ border: 0;
305
+ overflow: visible;
306
+ color: inherit;
307
+ background: transparent;
273
308
  position: fixed;
274
309
  inset: 0;
310
+ width: auto;
311
+ height: auto;
275
312
  background: light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.1));
276
- z-index: calc(var(--sc-kit--z-index--popover) - 1);
277
313
  animation: popover-backdrop-fade-in var(--sc-kit--duration--base) var(--sc-kit--ease--out) both;
278
314
  }
279
315
 
@@ -312,6 +348,10 @@ Props for keeping the popover open during interaction:
312
348
  justify-content: center;
313
349
  border-radius: inherit;
314
350
  }
351
+ .popover__anchor {
352
+ display: flex;
353
+ width: 100%;
354
+ }
315
355
  .popover--disabled {
316
356
  opacity: 0.5;
317
357
  pointer-events: none;
@@ -330,15 +370,18 @@ Props for keeping the popover open during interaction:
330
370
  --_dd--content-min-width: var(--sc-kit--popover--content--min-width, 12.5rem);
331
371
  --_dd--content-overflow: var(--sc-kit--popover--content--overflow, hidden auto);
332
372
  --_dd--content-padding: var(--sc-kit--popover--content--padding, var(--sc-kit--space--1) 0);
333
- --_dd--content-z-index: var(--sc-kit--popover--content--z-index, var(--sc-kit--z-index--popover));
334
373
  --_dd--anim-shift-x: 0;
335
374
  --_dd--anim-shift-y: -4px;
336
375
  --_dd--anim-origin-x: left;
337
376
  --_dd--anim-origin-y: top;
338
- position: absolute;
339
- top: 0;
340
- left: 0;
341
- z-index: var(--_dd--content-z-index);
377
+ inset: 0 auto auto 0;
378
+ margin: 0;
379
+ padding: 0;
380
+ border: 0;
381
+ overflow: visible;
382
+ color: inherit;
383
+ background: transparent;
384
+ position: fixed;
342
385
  width: max-content;
343
386
  min-width: var(--_dd--content-min-width);
344
387
  }
@@ -4,8 +4,6 @@ type Props = {
4
4
  /** Floating UI placement. @default 'bottom-start' */
5
5
  position?: Placement;
6
6
  disabled?: boolean;
7
- /** Use `position: fixed` strategy (helpful inside overflow-clipped containers). */
8
- fixedPosition?: boolean;
9
7
  /** Distance in px between the trigger and the popover content. @default 4 */
10
8
  offset?: number;
11
9
  /** Padding in px from the viewport boundary before content shifts/flips. @default 8 */
@@ -27,8 +25,15 @@ type Props = {
27
25
  closed?: () => void;
28
26
  };
29
27
  children: Snippet;
30
- /** Content of the trigger `<button>`, so non-interactive only — `Button type="presentational"` for a button look. @default chevron-down icon */
31
- trigger?: Snippet;
28
+ /**
29
+ * A snippet is the content of the trigger `<button>`, so non-interactive only — `Button type="presentational"` for a button look.
30
+ * `{ custom }` replaces the button with the consumer's own control: its clicks toggle the popover, and its `id`, `disabled`, `aria-expanded`
31
+ * and `aria-haspopup` are the consumer's (`on.opened` / `on.closed` report the state). `id`, `tabbable` and the aria props here are not applied to it.
32
+ * @default chevron-down icon
33
+ */
34
+ trigger?: Snippet | {
35
+ custom: Snippet;
36
+ };
32
37
  id?: string;
33
38
  'aria-label'?: string;
34
39
  'aria-labelledby'?: string;
@@ -56,10 +61,12 @@ type Props = {
56
61
  * `--sc-kit--popover--content--max-width` for a tighter cap than the available space.
57
62
  *
58
63
  * Because the panel fits itself to the available height, it is a scroll container by default. With `panel={false}` none of the three bounds apply — no width
59
- * cap, no height fit, no clipping — since that consumer owns the box entirely. Floating content nested inside it — a submenu, a `Tooltip` on
60
- * an item — is not clipped **once the panel has appeared**: those bubbles resolve their position against the popover's own positioned box, which sits outside
61
- * the scrolling area, so `fixedPosition` on a nested Popover stays optional. During the appear animation the panel does carry a transform and therefore does
62
- * clip, so a bubble opening within that window (a `Tooltip` with a near-zero `delay`) is cut off for its duration.
64
+ * cap, no height fit, no clipping — since that consumer owns the box entirely.
65
+ *
66
+ * The content renders in the top layer (Popover API, `popover="manual"`), as do the kit's `Tooltip`, Select listboxes and `DatePicker` panel: no ancestor
67
+ * `overflow`, `mask`, `transform` or `filter` clips it — floating content nested inside the panel included — and it stacks by the order things were shown,
68
+ * not by `z-index`. The panel follows its trigger with `position: fixed`, repositioned on every ancestor scroll, and hides while the trigger is scrolled out
69
+ * of a clipping ancestor.
63
70
  *
64
71
  * Two consequences of the panel being a scroll container. `--sc-kit--popover--content--overflow: visible` removes the clipping but not the height fit — the
65
72
  * panel is still shrunk and its content would paint outside the chrome, so pair it with `--sc-kit--popover--content--max-height: none` to opt out of both. And
@@ -80,7 +87,6 @@ type Props = {
80
87
  * | `--sc-kit--popover--content--min-width` | Content min width. Wins over max-width when the two conflict; ignored under `matchWidth` | `12.5rem` |
81
88
  * | `--sc-kit--popover--content--overflow` | Panel overflow, both axes. Applies only with `panel` on. `visible` opts out of clipping | `hidden auto` |
82
89
  * | `--sc-kit--popover--content--padding` | Content padding | `var(--sc-kit--space--1) 0` |
83
- * | `--sc-kit--popover--content--z-index` | Content z-index | `var(--sc-kit--z-index--popover)` |
84
90
  *
85
91
  * Props for keeping the popover open during interaction:
86
92
  * - `keepOpen` (Popover-level): block any inner click from closing — for interactive content (color pickers, emoji panels, etc.).
@@ -5,7 +5,7 @@ export type MultiselectInstance = {
5
5
  };
6
6
  import { type MultiselectBaseProps, type SelectOption } from './types';
7
7
  declare function $$render<T>(): {
8
- props: Omit<MultiselectBaseProps<T>, "value" | "on" | "loadOptions" | "debounceMs" | "groupHeader" | "selectionMode" | "parentSource"> & {
8
+ props: Omit<MultiselectBaseProps<T>, "value" | "debounceMs" | "on" | "loadOptions" | "groupHeader" | "selectionMode" | "parentSource"> & {
9
9
  /** Flat option list. Fuse filters in-memory on every keystroke — no debounce. */
10
10
  options: SelectOption<T>[];
11
11
  /** Current selection — array of values. Order is preserved (and editable when `reorderable`). */
@@ -1,7 +1,8 @@
1
1
  <script lang="ts" generics="T">import { isInsideLabelOf } from '../_internal/form-field-label-context';
2
+ import { showInTopLayer } from '../_internal/top-layer';
2
3
  import { Icon } from '../icon';
3
4
  import { SelectListboxLocalization } from './select-listbox-localization';
4
- import { autoUpdate, computePosition, flip, shift, size as floatingSize } from '@floating-ui/dom';
5
+ import { autoUpdate, computePosition, flip, hide, shift, size as floatingSize } from '@floating-ui/dom';
5
6
  import IconAdd from '@fluentui/svg-icons/icons/add_16_regular.svg?raw';
6
7
  import IconCheckboxChecked from '@fluentui/svg-icons/icons/checkbox_checked_16_filled.svg?raw';
7
8
  import IconCheckboxIndeterminate from '@fluentui/svg-icons/icons/checkbox_indeterminate_16_filled.svg?raw';
@@ -24,12 +25,10 @@ $effect(() => {
24
25
  }
25
26
  const trigger = triggerEl;
26
27
  const panel = panelEl;
28
+ showInTopLayer(panel);
27
29
  const update = async () => {
30
+ showInTopLayer(panel);
28
31
  const result = await computePosition(trigger, panel, {
29
- // `fixed` keeps coords viewport-relative, which lets nested popovers (e.g. a Singleselect
30
- // inside Multi's create-with-parent section) compute their own position correctly. With
31
- // the default `absolute` strategy, an offset parent that is itself absolutely positioned
32
- // would double-offset the child popover.
33
32
  strategy: 'fixed',
34
33
  placement: 'bottom-start',
35
34
  middleware: [
@@ -51,13 +50,15 @@ $effect(() => {
51
50
  elements.floating.style.minWidth = `${rects.reference.width}px`;
52
51
  }
53
52
  }
54
- })
53
+ }),
54
+ hide()
55
55
  ]
56
56
  });
57
57
  Object.assign(panel.style, {
58
58
  position: 'fixed',
59
59
  left: `${result.x}px`,
60
- top: `${result.y}px`
60
+ top: `${result.y}px`,
61
+ visibility: result.middlewareData.hide?.referenceHidden ? 'hidden' : ''
61
62
  });
62
63
  };
63
64
  return autoUpdate(trigger, panel, update);
@@ -117,6 +118,7 @@ $effect(() => {
117
118
  <div
118
119
  bind:this={panelEl}
119
120
  class="select-listbox select-listbox--{size} select-listbox--display-{selectedDisplay}"
121
+ popover="manual"
120
122
  role="listbox"
121
123
  id={listboxId}
122
124
  tabindex="-1"
@@ -263,12 +265,18 @@ dismiss events upward. Floating UI handles placement with autoUpdate on scroll/r
263
265
  --_lb--group-header-color: var(--sc-kit--select--group-header--color, var(--sc-kit--color--text--muted));
264
266
  --_lb--group-header-font-size: var(--sc-kit--select--group-header--font-size, var(--sc-kit--font-size--xs));
265
267
  --_lb--empty-color: var(--sc-kit--select--empty--color, var(--sc-kit--color--text--muted));
268
+ inset: 0 auto auto 0;
269
+ margin: 0;
270
+ padding: 0;
271
+ border: 0;
272
+ overflow: visible;
273
+ color: inherit;
274
+ background: transparent;
266
275
  font-size: var(--_lb--font-size);
267
276
  display: flex;
268
277
  flex-direction: column;
269
278
  gap: 0.125rem;
270
- position: absolute;
271
- z-index: var(--sc-kit--z-index--popover);
279
+ position: fixed;
272
280
  background: var(--_lb--background);
273
281
  border: 1px solid var(--_lb--border-color);
274
282
  border-radius: var(--_lb--border-radius);
@@ -31,7 +31,6 @@ const withFirstFrame = (src) => (src.includes('#') ? src : `${src}#t=0.001`);
31
31
  {:else}
32
32
  <Popover
33
33
  position="bottom-end"
34
- fixedPosition
35
34
  aria-label={actions?.label ?? localization.actions}
36
35
  on={{ opened: () => (menuOpened = true), closed: () => (menuOpened = false) }}>
37
36
  {#snippet trigger()}
@@ -13,9 +13,6 @@ $effect(() => {
13
13
  if (!containerEl) {
14
14
  return;
15
15
  }
16
- if (!('showPopover' in containerEl)) {
17
- return;
18
- }
19
16
  const hasToasts = toasts.length > 0;
20
17
  const isOpen = containerEl.matches(':popover-open');
21
18
  try {
@@ -65,7 +62,6 @@ top layer above page content.
65
62
  --_toaster--max-width: var(--sc-kit--toaster--max-width, 26.25rem);
66
63
  position: fixed;
67
64
  inset: unset;
68
- z-index: var(--sc-kit--z-index--toast);
69
65
  display: flex;
70
66
  flex-direction: column;
71
67
  gap: var(--_toaster--gap);
@@ -1,4 +1,5 @@
1
- <script lang="ts">import { arrow as arrowMiddleware, autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom';
1
+ <script lang="ts">import { showInTopLayer } from '../_internal/top-layer';
2
+ import { arrow as arrowMiddleware, autoUpdate, computePosition, flip, hide as hideMiddleware, offset, shift } from '@floating-ui/dom';
2
3
  import { tick } from 'svelte';
3
4
  const { text, placement = 'top', delay = 250, fillHeight = false, children } = $props();
4
5
  let triggerEl = $state.raw(undefined);
@@ -15,14 +16,17 @@ const position = async () => {
15
16
  if (!triggerEl || !bubbleEl) {
16
17
  return;
17
18
  }
19
+ showInTopLayer(bubbleEl);
18
20
  const middleware = [offset(6), flip(), shift({ padding: 8 })];
19
21
  if (arrowEl) {
20
22
  middleware.push(arrowMiddleware({ element: arrowEl }));
21
23
  }
24
+ middleware.push(hideMiddleware());
22
25
  const result = await computePosition(triggerEl, bubbleEl, { placement, middleware, strategy: 'fixed' });
23
26
  Object.assign(bubbleEl.style, {
24
27
  left: `${result.x}px`,
25
- top: `${result.y}px`
28
+ top: `${result.y}px`,
29
+ visibility: result.middlewareData.hide?.referenceHidden ? 'hidden' : ''
26
30
  });
27
31
  resolvedPlacement = result.placement;
28
32
  if (arrowEl && result.middlewareData.arrow) {
@@ -40,6 +44,7 @@ const show = () => {
40
44
  showTimer = undefined;
41
45
  await tick();
42
46
  if (triggerEl && bubbleEl) {
47
+ showInTopLayer(bubbleEl);
43
48
  stopAutoUpdate = autoUpdate(triggerEl, bubbleEl, position);
44
49
  }
45
50
  }, delay);
@@ -76,7 +81,7 @@ $effect(() => () => {
76
81
  </span>
77
82
 
78
83
  {#if visible}
79
- <span bind:this={bubbleEl} class="tooltip__bubble" role="tooltip" aria-hidden="true" data-placement={resolvedPlacement}>
84
+ <span bind:this={bubbleEl} class="tooltip__bubble" popover="manual" role="tooltip" aria-hidden="true" data-placement={resolvedPlacement}>
80
85
  {text}
81
86
  <span bind:this={arrowEl} class="tooltip__arrow" aria-hidden="true"></span>
82
87
  </span>
@@ -101,7 +106,6 @@ or plain text. Bubble flips and shifts on viewport collision; an arrow points to
101
106
  | `--sc-kit--tooltip--shadow` | Bubble drop shadow | `var(--sc-kit--shadow--md)` |
102
107
  | `--sc-kit--tooltip--max-width` | Bubble max width | `15rem` |
103
108
  | `--sc-kit--tooltip--arrow-size` | Arrow square size | `0.5rem` |
104
- | `--sc-kit--tooltip--z-index` | Bubble z-index | `var(--sc-kit--z-index--tooltip)` |
105
109
  -->
106
110
 
107
111
  <style>.tooltip {
@@ -134,15 +138,18 @@ or plain text. Bubble flips and shifts on viewport collision; an arrow points to
134
138
  --_tt--shadow: var(--sc-kit--tooltip--shadow, var(--sc-kit--shadow--md));
135
139
  --_tt--max-width: var(--sc-kit--tooltip--max-width, 15rem);
136
140
  --_tt--arrow-size: var(--sc-kit--tooltip--arrow-size, 0.5rem);
137
- --_tt--z-index: var(--sc-kit--tooltip--z-index, var(--sc-kit--z-index--tooltip));
138
141
  --_tt--arrow-top: auto;
139
142
  --_tt--arrow-bottom: auto;
140
143
  --_tt--arrow-left: auto;
141
144
  --_tt--arrow-right: auto;
145
+ inset: 0 auto auto 0;
146
+ margin: 0;
147
+ padding: 0;
148
+ border: 0;
149
+ overflow: visible;
150
+ color: inherit;
151
+ background: transparent;
142
152
  position: fixed;
143
- top: 0;
144
- left: 0;
145
- z-index: var(--_tt--z-index);
146
153
  width: max-content;
147
154
  max-width: var(--_tt--max-width);
148
155
  padding: var(--_tt--padding-block) var(--_tt--padding-inline);
@@ -35,7 +35,6 @@ type Props = {
35
35
  * | `--sc-kit--tooltip--shadow` | Bubble drop shadow | `var(--sc-kit--shadow--md)` |
36
36
  * | `--sc-kit--tooltip--max-width` | Bubble max width | `15rem` |
37
37
  * | `--sc-kit--tooltip--arrow-size` | Arrow square size | `0.5rem` |
38
- * | `--sc-kit--tooltip--z-index` | Bubble z-index | `var(--sc-kit--z-index--tooltip)` |
39
38
  */
40
39
  declare const Cmp: import("svelte").Component<Props, {}, "">;
41
40
  type Cmp = ReturnType<typeof Cmp>;
@@ -277,7 +277,7 @@ const handleActionsClosed = () => {
277
277
  {/if}
278
278
  {#if actionsShown}
279
279
  <div class="node-actions" class:node-actions--opened={actionsOpened}>
280
- <Popover position="bottom-end" fixedPosition on={{ opened: handleActionsOpened, closed: handleActionsClosed }}>
280
+ <Popover position="bottom-end" on={{ opened: handleActionsOpened, closed: handleActionsClosed }}>
281
281
  {#snippet trigger()}
282
282
  <div class="node-actions__trigger">
283
283
  <Icon src={IconMoreVertical} />
@@ -43,7 +43,7 @@ const swallowClick = (event) => event.stopPropagation();
43
43
  title={parsed.foreign ? localization.schemeIgnored : undefined}
44
44
  onclick={pickable ? swallowClick : undefined}>
45
45
  {#if pickable}
46
- <Popover position="bottom-start" fillContainer={true} fixedPosition={true} tabbable={false} aria-label={localization.chooseScheme}>
46
+ <Popover position="bottom-start" fillContainer={true} tabbable={false} aria-label={localization.chooseScheme}>
47
47
  {#snippet trigger()}
48
48
  {@render schemeBody()}
49
49
  {/snippet}