@streamscloud/kit 0.91.0 → 0.92.1

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.
@@ -93,7 +93,6 @@
93
93
 
94
94
  // Z-scale — relative stacking order for the library's overlay components.
95
95
  // 100-unit gaps leave room for consumers to inject custom layers between.
96
- // Tooltip sits above modals so tooltips work inside dialogs.
97
96
  --sc-kit--z-index--popover: 1000;
98
97
  --sc-kit--z-index--modal: 1100;
99
98
  --sc-kit--z-index--toast: 1200;
@@ -0,0 +1,10 @@
1
+ // Include first: the UA [popover] inset / margin / border / padding / overflow / colors otherwise override the host's box.
2
+ @mixin reset {
3
+ inset: 0 auto auto 0;
4
+ margin: 0;
5
+ padding: 0;
6
+ border: 0;
7
+ overflow: visible;
8
+ color: inherit;
9
+ background: transparent;
10
+ }
@@ -7,7 +7,7 @@ let popover = $state.raw(undefined);
7
7
  </script>
8
8
 
9
9
  <span class="input-emoji-picker input-emoji-picker--{size}">
10
- <Popover bind:this={popover} position="bottom-end" panel={false} keepOpen fillContainer fixedPosition>
10
+ <Popover bind:this={popover} position="bottom-end" panel={false} keepOpen fillContainer>
11
11
  {#snippet trigger()}
12
12
  <Icon src={IconEmoji} />
13
13
  {/snippet}
@@ -0,0 +1 @@
1
+ export declare const showInTopLayer: (element: HTMLElement) => void;
@@ -0,0 +1,6 @@
1
+ // Call it from the autoUpdate callback too: a keyed {#each} moving an ancestor re-inserts the node, which hides it without a toggle event.
2
+ export const showInTopLayer = (element) => {
3
+ if (element.isConnected && !element.matches(':popover-open')) {
4
+ element.showPopover();
5
+ }
6
+ };
@@ -6,14 +6,11 @@ let { items, separator = '/', underline = 'hover', overflow = 'wrap', maxItems }
6
6
  const localization = new BreadcrumbLocalization();
7
7
  let canScrollBack = $state(false);
8
8
  let canScrollForward = $state(false);
9
- let menuOpened = $state(false);
10
9
  const tailLength = $derived(maxItems === undefined ? 0 : Math.max(2, maxItems) - 1);
11
10
  const collapsed = $derived(maxItems !== undefined && items.length > tailLength + 1);
12
11
  const hiddenItems = $derived(collapsed ? items.slice(1, items.length - tailLength) : []);
13
12
  const shownItems = $derived(collapsed ? [items[0], ...items.slice(items.length - tailLength)] : items);
14
13
  const scrolls = $derived(overflow === 'scroll');
15
- // The "…" Popover renders inside the track; a mask would hide it.
16
- const masked = $derived(scrolls && !menuOpened);
17
14
  const updateScrollState = (node) => {
18
15
  canScrollBack = node.scrollLeft > 0;
19
16
  canScrollForward = node.scrollLeft < node.scrollWidth - node.clientWidth - 1;
@@ -61,9 +58,9 @@ const scrollTrack = (node, _items) => {
61
58
  <div
62
59
  class="breadcrumb breadcrumb--underline-{underline}"
63
60
  class:breadcrumb--scroll={scrolls}
64
- class:breadcrumb--mask-back={masked && canScrollBack && !canScrollForward}
65
- class:breadcrumb--mask-forward={masked && canScrollForward && !canScrollBack}
66
- class:breadcrumb--mask-both={masked && canScrollBack && canScrollForward}
61
+ class:breadcrumb--mask-back={scrolls && canScrollBack && !canScrollForward}
62
+ class:breadcrumb--mask-forward={scrolls && canScrollForward && !canScrollBack}
63
+ class:breadcrumb--mask-both={scrolls && canScrollBack && canScrollForward}
67
64
  role="navigation"
68
65
  aria-label={localization.navLabel}
69
66
  use:scrollTrack={shownItems}
@@ -75,11 +72,7 @@ const scrollTrack = (node, _items) => {
75
72
  {#if i === 0 && collapsed}
76
73
  <span class="breadcrumb__separator" aria-hidden="true">{separator}</span>
77
74
  <span class="breadcrumb__more" onwheel={(e) => e.stopPropagation()}>
78
- <Popover
79
- position="bottom-start"
80
- fixedPosition
81
- aria-label={localization.hiddenLevels}
82
- on={{ opened: () => (menuOpened = true), closed: () => (menuOpened = false) }}>
75
+ <Popover position="bottom-start" aria-label={localization.hiddenLevels}>
83
76
  {#snippet trigger()}
84
77
  <span class="breadcrumb__more-trigger">…</span>
85
78
  {/snippet}
@@ -54,7 +54,6 @@ const onColorPickerInput = ({ hex }) => {
54
54
  position="bottom-start"
55
55
  keepOpen
56
56
  panel={false}
57
- fixedPosition
58
57
  disabled={disabled}
59
58
  id={triggerId}
60
59
  aria-label={ariaLabel}
@@ -1,9 +1,9 @@
1
- <script lang="ts">import { claimFormFieldLabel, getFormFieldLabel, isInsideLabelOf, resolveAriaLabelledby } from '../_internal/form-field-label-context';
1
+ <script lang="ts">import { claimFormFieldLabel, getFormFieldLabel, resolveAriaLabelledby } from '../_internal/form-field-label-context';
2
2
  import { InputClearButton } from '../_internal/input-clear-button';
3
3
  import { Icon, IconSlot } from '../icon';
4
+ import { Popover } from '../popover';
4
5
  import DatePickerCalendar from './cmp.date-picker-calendar.svelte';
5
6
  import { DatePickerLocalization } from './date-picker-localization';
6
- import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom';
7
7
  import IconCalendar from '@fluentui/svg-icons/icons/calendar_16_regular.svg?raw';
8
8
  const { size = 'md', placeholder = '', disabled = false, readonly = false, inert = false, error = false, borderless = false, min, max, locale, name, id = null, autofocus = false, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, 'aria-required': ariaRequired, icon, ...mode } = $props();
9
9
  const formFieldLabel = getFormFieldLabel();
@@ -43,8 +43,8 @@ const maxDate = $derived(toDate(max ?? null));
43
43
  const triggerFmt = $derived(new Intl.DateTimeFormat(resolvedLocale, { dateStyle: 'medium' }));
44
44
  const triggerLabel = $derived(selectedDate ? triggerFmt.format(selectedDate) : '');
45
45
  let open = $state(false);
46
+ let popover = $state.raw(undefined);
46
47
  let triggerEl = $state.raw(undefined);
47
- let panelEl = $state.raw(undefined);
48
48
  const emit = (date) => {
49
49
  const iso = date ? date.toISOString() : null;
50
50
  if (mode.clearable) {
@@ -54,12 +54,9 @@ const emit = (date) => {
54
54
  mode.on?.change?.(iso);
55
55
  }
56
56
  };
57
- const toggleOpen = () => {
58
- open = !open;
59
- };
60
57
  const handleSelect = (date) => {
61
58
  emit(date);
62
- open = false;
59
+ popover?.close();
63
60
  triggerEl?.focus();
64
61
  };
65
62
  const handleClearClick = () => {
@@ -68,58 +65,8 @@ const handleClearClick = () => {
68
65
  }
69
66
  emit(null);
70
67
  };
71
- // Floating UI: position on open, auto-update on scroll/resize, cleanup on close.
72
- $effect(() => {
73
- if (!open || !triggerEl || !panelEl) {
74
- return;
75
- }
76
- const trigger = triggerEl;
77
- const panel = panelEl;
78
- const update = async () => {
79
- const result = await computePosition(trigger, panel, {
80
- placement: 'bottom-start',
81
- middleware: [offset(4), flip(), shift({ padding: 8 })]
82
- });
83
- Object.assign(panel.style, {
84
- position: 'absolute',
85
- left: `${result.x}px`,
86
- top: `${result.y}px`
87
- });
88
- };
89
- return autoUpdate(trigger, panel, update);
90
- });
91
- // Dismiss listeners: only active while open.
92
- $effect(() => {
93
- if (!open) {
94
- return;
95
- }
96
- const handleClickOutside = (e) => {
97
- const target = e.target;
98
- if (!target) {
99
- return;
100
- }
101
- if (triggerEl?.contains(target) || panelEl?.contains(target) || isInsideLabelOf(target, triggerEl)) {
102
- return;
103
- }
104
- open = false;
105
- };
106
- const handleKey = (e) => {
107
- if (e.key === 'Escape') {
108
- e.preventDefault();
109
- open = false;
110
- triggerEl?.focus();
111
- }
112
- };
113
- document.addEventListener('mousedown', handleClickOutside);
114
- document.addEventListener('keydown', handleKey);
115
- return () => {
116
- document.removeEventListener('mousedown', handleClickOutside);
117
- document.removeEventListener('keydown', handleKey);
118
- };
119
- });
120
68
  </script>
121
69
 
122
- <!-- svelte-ignore a11y_autofocus -->
123
70
  <div
124
71
  class="date-picker date-picker--{size}"
125
72
  class:date-picker--open={open}
@@ -128,55 +75,60 @@ $effect(() => {
128
75
  class:date-picker--readonly={readonly}
129
76
  class:date-picker--inert={inert}
130
77
  class:date-picker--borderless={borderless}>
131
- <button
132
- bind:this={triggerEl}
133
- type="button"
134
- class="date-picker__trigger"
135
- id={controlId}
136
- disabled={disabled}
137
- inert={inert}
138
- autofocus={autofocus}
139
- aria-haspopup="dialog"
140
- aria-expanded={open}
141
- aria-label={ariaLabel ?? name}
142
- aria-labelledby={resolveAriaLabelledby(formFieldLabel, ariaLabel, ariaLabelledby)}
143
- aria-describedby={ariaDescribedby}
144
- onclick={readonly ? undefined : toggleOpen}>
145
- {#if icon}
146
- <span class="date-picker__icon date-picker__icon--leading" aria-hidden="true"><IconSlot icon={icon} /></span>
147
- {/if}
148
- <span class="date-picker__value" class:date-picker__value--placeholder={!selectedDate}>
149
- {triggerLabel || placeholder}
150
- </span>
151
- {#if mode.clearable && selectedDate && !disabled && !readonly && !inert}
152
- <InputClearButton size={size} aria-label={localization.clearDate} on={{ clear: handleClearClick }} />
153
- {:else if !icon}
154
- <span class="date-picker__icon date-picker__icon--trailing" aria-hidden="true">
155
- <Icon src={IconCalendar} />
78
+ {#snippet triggerButton()}
79
+ <!-- svelte-ignore a11y_autofocus -->
80
+ <button
81
+ bind:this={triggerEl}
82
+ type="button"
83
+ class="date-picker__trigger"
84
+ id={controlId}
85
+ disabled={disabled}
86
+ inert={inert}
87
+ autofocus={autofocus}
88
+ aria-haspopup="dialog"
89
+ aria-expanded={open}
90
+ aria-label={ariaLabel ?? name}
91
+ aria-labelledby={resolveAriaLabelledby(formFieldLabel, ariaLabel, ariaLabelledby)}
92
+ aria-describedby={ariaDescribedby}>
93
+ {#if icon}
94
+ <span class="date-picker__icon date-picker__icon--leading" aria-hidden="true"><IconSlot icon={icon} /></span>
95
+ {/if}
96
+ <span class="date-picker__value" class:date-picker__value--placeholder={!selectedDate}>
97
+ {triggerLabel || placeholder}
156
98
  </span>
157
- {/if}
158
- </button>
99
+ {#if mode.clearable && selectedDate && !disabled && !readonly && !inert}
100
+ <InputClearButton size={size} aria-label={localization.clearDate} on={{ clear: handleClearClick }} />
101
+ {:else if !icon}
102
+ <span class="date-picker__icon date-picker__icon--trailing" aria-hidden="true">
103
+ <Icon src={IconCalendar} />
104
+ </span>
105
+ {/if}
106
+ </button>
107
+ {/snippet}
108
+ <Popover
109
+ bind:this={popover}
110
+ trigger={{ custom: triggerButton }}
111
+ panel={false}
112
+ keepOpen
113
+ disabled={disabled || readonly || inert}
114
+ on={{ opened: () => (open = true), closed: () => (open = false) }}>
115
+ <DatePickerCalendar
116
+ selectedDate={selectedDate}
117
+ minDate={minDate}
118
+ maxDate={maxDate}
119
+ locale={resolvedLocale}
120
+ firstDayOfWeek={resolvedFirstDayOfWeek}
121
+ on={{ select: handleSelect }} />
122
+ </Popover>
159
123
 
160
124
  {#if name}
161
125
  <input type="hidden" name={name} value={selectedDate ? selectedDate.toISOString() : ''} aria-required={ariaRequired ? 'true' : undefined} />
162
126
  {/if}
163
-
164
- {#if open}
165
- <div bind:this={panelEl} class="date-picker__panel">
166
- <DatePickerCalendar
167
- selectedDate={selectedDate}
168
- minDate={minDate}
169
- maxDate={maxDate}
170
- locale={resolvedLocale}
171
- firstDayOfWeek={resolvedFirstDayOfWeek}
172
- on={{ select: handleSelect }} />
173
- </div>
174
- {/if}
175
127
  </div>
176
128
 
177
129
  <!--
178
130
  @component
179
- DatePicker — single-day calendar picker built on Floating UI for positioning. Discriminated by
131
+ DatePicker — single-day calendar picker whose calendar opens in a `Popover`. Discriminated by
180
132
  `clearable`: `clearable: true` allows clearing to `null` and shows a clear (X) button;
181
133
  `clearable: false` requires a value and renders no clear control. Emits ISO 8601 strings via
182
134
  `on.change` from local midnight of the picked day.
@@ -204,6 +156,7 @@ DatePicker — single-day calendar picker built on Floating UI for positioning.
204
156
 
205
157
  <style>@charset "UTF-8";
206
158
  .date-picker {
159
+ --sc-kit--popover--width: 100%;
207
160
  /* TRIGGER — public CSS API resolved with defaults (this block IS the API documentation) */
208
161
  --_dp--height: var(--sc-kit--date-picker--height, var(--_dp--size-height, var(--sc-kit--field--height--md)));
209
162
  --_dp--padding-inline: var(--sc-kit--date-picker--padding-inline, var(--_dp--size-padding-inline, var(--sc-kit--field--padding-inline--md)));
@@ -345,7 +298,4 @@ DatePicker — single-day calendar picker built on Floating UI for positioning.
345
298
  }
346
299
  .date-picker__icon--trailing {
347
300
  margin-inline-start: var(--_dp--gap);
348
- }
349
- .date-picker__panel {
350
- z-index: var(--sc-kit--z-index--popover);
351
301
  }</style>
@@ -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.
@@ -8,29 +8,30 @@ export {};
8
8
 
9
9
  <!--
10
10
  @component
11
- A scoped style wrapper for arbitrary HTML — applies typographic and list-style defaults to descendant
12
- `h1`–`h6`, `a`, `pre`, `ul`, `ol`, `table` produced by an external HTML source (rich-text editor,
13
- markdown renderer, server-rendered email body). The wrapper itself is `display: contents` so layout is
14
- unaffected.
11
+ A scoped style wrapper for arbitrary HTML — gives reading typography, vertical rhythm, list markers, tables,
12
+ blockquotes, inline code, code blocks and `hr` to the markup of an external HTML source (rich-text editor,
13
+ markdown renderer, server-rendered email body). All spacing scales with the base font size; a wide table is
14
+ not scrolled horizontally.
15
15
 
16
16
  ### CSS Custom Properties
17
17
  | Property | Description | Default |
18
18
  |---|---|---|
19
+ | `--sc-kit--html-block--font-size` | Base font size | `0.875em` |
19
20
  | `--sc-kit--html-block--text-color` | Body text color | `--sc-kit--color--text--primary` |
20
21
  | `--sc-kit--html-block--link-color` | Anchor color | `--sc-kit--color--accent` |
21
- | `--sc-kit--html-block--code-font` | Monospace font for `pre` | `--sc-kit--font--mono` |
22
+ | `--sc-kit--html-block--code-font` | Monospace font for `pre` and `code` | `--sc-kit--font--mono` |
22
23
  -->
23
24
 
24
25
  <style>.html-block {
25
26
  --_html-block--text: var(--sc-kit--html-block--text-color, var(--sc-kit--color--text--primary));
26
27
  --_html-block--link: var(--sc-kit--html-block--link-color, var(--sc-kit--color--accent));
27
28
  --_html-block--code-font: var(--sc-kit--html-block--code-font, var(--sc-kit--font--mono));
28
- display: contents;
29
- overflow-wrap: anywhere;
30
- font-size: 0.875em;
31
- line-height: var(--sc-kit--leading--normal);
32
- font-weight: normal;
29
+ --_html-block--font-size: var(--sc-kit--html-block--font-size, 0.875em);
30
+ display: block;
31
+ font-size: var(--_html-block--font-size);
32
+ line-height: var(--sc-kit--leading--relaxed);
33
33
  color: var(--_html-block--text);
34
+ overflow-wrap: anywhere;
34
35
  }
35
36
  .html-block :global(p),
36
37
  .html-block :global(h1),
@@ -41,99 +42,143 @@ unaffected.
41
42
  .html-block :global(h6) {
42
43
  overflow-wrap: inherit;
43
44
  }
45
+ .html-block :global(p),
46
+ .html-block :global(ul),
47
+ .html-block :global(ol),
48
+ .html-block :global(table),
49
+ .html-block :global(blockquote),
50
+ .html-block :global(pre),
51
+ .html-block :global(hr) {
52
+ margin: 0 0 1em;
53
+ }
54
+ .html-block :global(h1),
55
+ .html-block :global(h2),
56
+ .html-block :global(h3),
57
+ .html-block :global(h4),
58
+ .html-block :global(h5),
59
+ .html-block :global(h6) {
60
+ margin: 1.5em 0 0.5em;
61
+ font-size: 1em;
62
+ font-weight: var(--sc-kit--font-weight--semibold);
63
+ line-height: var(--sc-kit--leading--tight);
64
+ color: var(--_html-block--text);
65
+ }
44
66
  .html-block :global(h1) {
67
+ margin: 1em 0 0.3333333333em;
45
68
  font-size: 1.5em;
46
- line-height: var(--sc-kit--leading--normal);
47
- font-weight: 600;
48
- color: var(--_html-block--text);
49
69
  }
50
70
  .html-block :global(h2) {
51
- font-size: 1.375em;
52
- line-height: var(--sc-kit--leading--normal);
53
- font-weight: 600;
54
- color: var(--_html-block--text);
71
+ margin: 1.2em 0 0.4em;
72
+ font-size: 1.25em;
55
73
  }
56
74
  .html-block :global(h3) {
57
- font-size: 1.25em;
58
- line-height: var(--sc-kit--leading--normal);
59
- font-weight: 600;
60
- color: var(--_html-block--text);
75
+ margin: 1.3333333333em 0 0.4444444444em;
76
+ font-size: 1.125em;
61
77
  }
62
78
  .html-block :global(h4) {
63
- font-size: 1.125em;
64
- line-height: var(--sc-kit--leading--normal);
65
- font-weight: 500;
66
- color: var(--_html-block--text);
79
+ margin: 1.5em 0 0.5em;
80
+ font-size: 1em;
67
81
  }
68
82
  .html-block :global(h5) {
69
- font-size: 1.0625em;
70
- line-height: var(--sc-kit--leading--normal);
71
- font-weight: 500;
72
- color: var(--_html-block--text);
83
+ margin: 1.7142857143em 0 0.5714285714em;
84
+ font-size: 0.875em;
73
85
  }
74
86
  .html-block :global(h6) {
75
- font-size: 1em;
76
- line-height: var(--sc-kit--leading--normal);
77
- font-weight: 500;
78
- color: var(--_html-block--text);
87
+ margin: 1.7142857143em 0 0.5714285714em;
88
+ font-size: 0.875em;
89
+ }
90
+ .html-block :global(h6) {
91
+ color: var(--sc-kit--color--text--secondary);
92
+ }
93
+ .html-block > :global(:first-child) {
94
+ margin-top: 0;
95
+ }
96
+ .html-block > :global(:last-child),
97
+ .html-block :global(li > :last-child),
98
+ .html-block :global(blockquote > :last-child) {
99
+ margin-bottom: 0;
79
100
  }
80
101
  .html-block :global(a) {
81
- font-size: 1em;
82
- line-height: var(--sc-kit--leading--normal);
83
- font-weight: normal;
84
- color: var(--_html-block--text);
85
102
  color: var(--_html-block--link);
86
103
  }
87
- .html-block :global(pre) {
88
- font-family: var(--_html-block--code-font);
89
- white-space: pre-wrap;
90
- margin: 1em 0;
91
- font-size: 1em;
92
- line-height: var(--sc-kit--leading--tight);
93
- font-weight: normal;
94
- color: var(--_html-block--text);
104
+ .html-block :global(ul),
105
+ .html-block :global(ol) {
106
+ padding-left: 1.5em;
95
107
  }
96
- .html-block :global(ul) :global(> li),
97
- .html-block :global(ol) :global(> li) {
98
- list-style: inherit;
99
- margin-left: 1em;
100
- position: relative;
101
- font-size: 1em;
102
- line-height: var(--sc-kit--leading--normal);
103
- font-weight: normal;
104
- color: var(--_html-block--text);
108
+ .html-block :global(ul) {
109
+ list-style-type: disc;
105
110
  }
106
111
  .html-block :global(ol) {
107
112
  list-style-type: decimal;
108
113
  }
109
- .html-block :global(ol) :global(> li > ol) {
114
+ .html-block :global(li) {
115
+ list-style: inherit;
116
+ }
117
+ .html-block :global(li + li) {
118
+ margin-top: 0.25em;
119
+ }
120
+ .html-block :global(li > ul),
121
+ .html-block :global(li > ol) {
122
+ margin-top: 0.125em;
123
+ }
124
+ .html-block :global(ul ul) {
125
+ list-style-type: circle;
126
+ }
127
+ .html-block :global(ol ol) {
110
128
  list-style-type: lower-alpha;
111
129
  }
112
130
  .html-block :global(table) {
113
131
  max-width: 100%;
132
+ border-collapse: collapse;
114
133
  }
115
- .html-block :global(table),
116
- .html-block :global(tbody),
117
- .html-block :global(thead),
118
- .html-block :global(tr),
119
134
  .html-block :global(th),
120
135
  .html-block :global(td) {
121
- border-width: initial;
122
- border-style: inherit;
123
- border-color: inherit;
124
- }
125
- .html-block :global(ul:not([style*='list-style-type'])),
126
- .html-block :global(ul:not([style*='list-style-type']) > li > ul:not([style*='list-style-type'])) {
127
- list-style-type: none;
128
- }
129
- .html-block :global(ul:not([style*='list-style-type']) > li:before),
130
- .html-block :global(ul:not([style*='list-style-type']) > li > ul:not([style*='list-style-type']) > li:before) {
131
- content: "-";
132
- text-indent: -1em;
133
- position: absolute;
134
- font-weight: bold;
135
- }
136
- .html-block :global(ul[style*='list-style-type'] > li:before),
137
- .html-block :global(ul > li > ul[style*='list-style-type'] > li:before) {
138
- content: none;
136
+ border: 1px solid var(--sc-kit--color--border);
137
+ padding: 0.5em 0.75em;
138
+ line-height: var(--sc-kit--leading--normal);
139
+ text-align: start;
140
+ vertical-align: top;
141
+ }
142
+ .html-block :global(th) {
143
+ padding: 0.4285714286em 0.8571428571em;
144
+ background: var(--sc-kit--color--bg--field-alt);
145
+ color: var(--sc-kit--color--text--secondary);
146
+ font-size: 0.875em;
147
+ font-weight: var(--sc-kit--font-weight--semibold);
148
+ vertical-align: middle;
149
+ }
150
+ .html-block :global(blockquote) {
151
+ border-left: 3px solid var(--sc-kit--color--border--strong);
152
+ padding-left: 1em;
153
+ color: var(--sc-kit--color--text--secondary);
154
+ }
155
+ .html-block :global(code) {
156
+ font-family: var(--_html-block--code-font);
157
+ font-size: 0.875em;
158
+ background: var(--sc-kit--color--bg--element);
159
+ padding: 0.125em 0.375em;
160
+ border-radius: var(--sc-kit--radius--sm);
161
+ }
162
+ .html-block :global(pre) {
163
+ font-family: var(--_html-block--code-font);
164
+ font-size: 0.875em;
165
+ line-height: var(--sc-kit--leading--normal);
166
+ background: var(--sc-kit--color--bg--element);
167
+ padding: 0.8571428571em 1.1428571429em;
168
+ border-radius: var(--sc-kit--radius--md);
169
+ overflow-x: auto;
170
+ white-space: pre;
171
+ overflow-wrap: normal;
172
+ }
173
+ .html-block :global(pre) :global(code) {
174
+ font-size: inherit;
175
+ background: none;
176
+ padding: 0;
177
+ border-radius: 0;
178
+ }
179
+ .html-block :global(hr) {
180
+ border: none;
181
+ border-top: 1px solid var(--sc-kit--color--border);
182
+ margin-top: 1.5em;
183
+ margin-bottom: 1.5em;
139
184
  }</style>
@@ -3,17 +3,18 @@ type Props = {
3
3
  children: Snippet;
4
4
  };
5
5
  /**
6
- * A scoped style wrapper for arbitrary HTML — applies typographic and list-style defaults to descendant
7
- * `h1`–`h6`, `a`, `pre`, `ul`, `ol`, `table` produced by an external HTML source (rich-text editor,
8
- * markdown renderer, server-rendered email body). The wrapper itself is `display: contents` so layout is
9
- * unaffected.
6
+ * A scoped style wrapper for arbitrary HTML — gives reading typography, vertical rhythm, list markers, tables,
7
+ * blockquotes, inline code, code blocks and `hr` to the markup of an external HTML source (rich-text editor,
8
+ * markdown renderer, server-rendered email body). All spacing scales with the base font size; a wide table is
9
+ * not scrolled horizontally.
10
10
  *
11
11
  * ### CSS Custom Properties
12
12
  * | Property | Description | Default |
13
13
  * |---|---|---|
14
+ * | `--sc-kit--html-block--font-size` | Base font size | `0.875em` |
14
15
  * | `--sc-kit--html-block--text-color` | Body text color | `--sc-kit--color--text--primary` |
15
16
  * | `--sc-kit--html-block--link-color` | Anchor color | `--sc-kit--color--accent` |
16
- * | `--sc-kit--html-block--code-font` | Monospace font for `pre` | `--sc-kit--font--mono` |
17
+ * | `--sc-kit--html-block--code-font` | Monospace font for `pre` and `code` | `--sc-kit--font--mono` |
17
18
  */
18
19
  declare const Cmp: import("svelte").Component<Props, {}, "">;
19
20
  type Cmp = ReturnType<typeof Cmp>;
@@ -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.).
@@ -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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.91.0",
3
+ "version": "0.92.1",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",