@splendidlabz/svelte 1.0.0 → 3.0.0-alpha.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.
- package/CHANGELOG.md +11 -0
- package/actions/index.js +2 -5
- package/actions/portal.js +1 -1
- package/actions/scroll-observer.js +1 -1
- package/common.js +1 -1
- package/components/Accordion/Accordion.svelte +67 -60
- package/components/Breadcrumbs/Crumb.svelte +1 -1
- package/components/Breadcrumbs/CrumbCustom.svelte +1 -1
- package/components/{BrowserFrame.svelte → BrowserFrame/BrowserFrame.svelte} +1 -1
- package/components/BrowserFrame/index.js +3 -0
- package/components/ContentList/ContentList-old.svelte +1 -1
- package/components/ContentList/ContentList.svelte +1 -1
- package/components/Copyright.svelte +19 -0
- package/components/Disclosure/Drawer/DrawerCloseButton.svelte +21 -15
- package/components/Disclosure/Drawer/DrawerContent.svelte +92 -128
- package/components/Disclosure/Drawer/DrawerTrigger.svelte +38 -20
- package/components/Disclosure/Dropdown/DropdownTrigger.svelte +1 -1
- package/components/Disclosure/Modal/exit-intent.js +1 -1
- package/components/Disclosure/Popover/PopoverCloseButton.svelte +1 -1
- package/components/Disclosure/disclosure.svelte.js +432 -0
- package/components/FancyList/FancyList.svelte +1 -1
- package/components/Form/Checkbox.svelte +3 -3
- package/components/Form/Checkboxes.svelte +1 -1
- package/components/Form/Combobox/combobox.js +6 -5
- package/components/Form/Radio.svelte +3 -3
- package/components/Form/Radios.svelte +1 -1
- package/components/Form/Select.svelte +4 -4
- package/components/Form/TextInput.svelte +88 -65
- package/components/Form/Textarea.svelte +87 -64
- package/components/Highlight.svelte +46 -0
- package/components/Icon/Icon.svelte +43 -0
- package/components/Icon/index.js +2 -0
- package/components/PerspectiveHover/PerspectiveHover.svelte +1 -1
- package/components/PerspectiveHover/perspective-hover.js +1 -1
- package/components/Portal.svelte +1 -1
- package/components/Spotlight/PointerPosition.js +1 -1
- package/components/Spotlight/Spotlight.svelte +1 -1
- package/components/Tabs/tabs.js +8 -11
- package/components/Video.svelte +1 -1
- package/components/Vimeo.svelte +1 -1
- package/components/Youtube.svelte +1 -1
- package/components/_shared/accessibility.js +1 -0
- package/components/effects/index.js +0 -0
- package/index.js +7 -4
- package/package.json +11 -12
- package/utils/index.js +2 -0
- package/utils/merge-opts.js +5 -0
- package/components/Disclosure/Drawer/DrawerContent-wrecked.svelte +0 -198
- package/components/Resizer/draggable.js +0 -23
- package/components/SVG/SVG.svelte +0 -120
- package/components/Tabs-Old/Tab.svelte +0 -9
- package/components/Tabs-Old/Tablist.svelte +0 -13
- package/components/Tabs-Old/Tabpanel.svelte +0 -10
- package/components/Tabs-Old/Tabpanels.svelte +0 -14
- package/components/Tabs-Old/Tabs.svelte +0 -83
- package/components/Tabs-Old/index.js +0 -7
- package/components/Tabs-Old/tabs.js +0 -306
- package/components/_shared/key.js +0 -1
- /package/components/{BrowserWithTabs.svelte → BrowserFrame/BrowserWithTabs.svelte} +0 -0
- /package/{components/_shared → utils}/transitions.js +0 -0
package/CHANGELOG.md
CHANGED
package/actions/index.js
CHANGED
package/actions/portal.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @param {Number} threshold Float between 0 to 1. When to fire a threshold event.
|
|
7
7
|
* @param {Number} tolerance Float between 0 to 1. Tolerance for event firing.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export function scrollObserver(
|
|
10
10
|
node,
|
|
11
11
|
{
|
|
12
12
|
threshold = 0, // Float between 0 to 1.
|
package/common.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Callout } from './components/Callout'
|
|
|
4
4
|
import { Codepen } from './components/Codepen'
|
|
5
5
|
import FancyList from './components/FancyList/FancyList.svelte'
|
|
6
6
|
import Image from './components/Image.svelte'
|
|
7
|
-
import SVG from './components/
|
|
7
|
+
import SVG from './components/Icon/Icon.sveltee'
|
|
8
8
|
import Video from './components/Video.svelte'
|
|
9
9
|
import Vimeo from './components/Vimeo.svelte'
|
|
10
10
|
import Youtube from './components/Youtube.svelte'
|
|
@@ -1,48 +1,44 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { randomString } from '@splendidlabz/utils/dom'
|
|
3
|
-
import { transit } from '
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
let klass = ''
|
|
7
|
-
export { klass as class }
|
|
8
|
-
export let buttonClass = ''
|
|
9
|
-
export let svgClass = null
|
|
10
|
-
export let contentClass = ''
|
|
11
|
-
|
|
12
|
-
export let options = {}
|
|
3
|
+
import { mergeOpts, transit } from '../../utils/index.js'
|
|
4
|
+
import Icon from '../Icon/Icon.svelte'
|
|
13
5
|
|
|
6
|
+
const p = $props()
|
|
14
7
|
const DEFAULT_OPTIONS = {
|
|
15
|
-
|
|
8
|
+
titleTag: 'h3',
|
|
16
9
|
icon: 'tabler:chevron-right',
|
|
17
10
|
iconLocation: 'end',
|
|
18
11
|
transition: 'slide',
|
|
19
12
|
}
|
|
13
|
+
const opts = mergeOpts(DEFAULT_OPTIONS, p)
|
|
20
14
|
|
|
21
|
-
|
|
22
|
-
const {
|
|
15
|
+
// Classes
|
|
16
|
+
const {
|
|
17
|
+
class: klass,
|
|
18
|
+
titleClass,
|
|
19
|
+
buttonClass,
|
|
20
|
+
icon,
|
|
21
|
+
iconClass,
|
|
22
|
+
contentClass,
|
|
23
|
+
} = opts
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const id = randomString(9)
|
|
25
|
+
// Slots
|
|
26
|
+
const { title, iconSlot, content, children } = opts
|
|
27
27
|
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
if (!title) console.warn('Accordion: No title slot provided')
|
|
29
|
+
if (!content && !children)
|
|
30
|
+
console.warn('Accordion: No content or default slot provided')
|
|
31
|
+
|
|
32
|
+
const id = opts.id || randomString(9)
|
|
33
|
+
let show = $state(false)
|
|
31
34
|
|
|
35
|
+
// ========================================
|
|
36
|
+
// Event Handlers
|
|
37
|
+
// ========================================
|
|
32
38
|
function handleClick(event) {
|
|
33
39
|
// Toggle accordion show
|
|
34
40
|
show = !show
|
|
35
|
-
|
|
36
|
-
if (show) {
|
|
37
|
-
// Close all accordions except this one
|
|
38
|
-
const closestStack = event.target.closest('.AccordionStack')
|
|
39
|
-
if (!closestStack) return
|
|
40
|
-
const accordionCloseButtons = closestStack.querySelectorAll(
|
|
41
|
-
'.AccordionCloseButton',
|
|
42
|
-
)
|
|
43
|
-
accordionCloseButtons.forEach(button => button.click())
|
|
44
|
-
show = true
|
|
45
|
-
}
|
|
41
|
+
if (show) closeOtherAccordions(event)
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
function handleKeydown(event) {
|
|
@@ -53,56 +49,67 @@
|
|
|
53
49
|
function closeAccordion() {
|
|
54
50
|
show = false
|
|
55
51
|
}
|
|
52
|
+
|
|
53
|
+
// ========================================
|
|
54
|
+
// Helper functions
|
|
55
|
+
// ========================================
|
|
56
|
+
function closeOtherAccordions(event) {
|
|
57
|
+
const container = event.target.closest('.accordions')
|
|
58
|
+
if (!container) return
|
|
59
|
+
const closeButtons = container.querySelectorAll('.accordion-close-button')
|
|
60
|
+
closeButtons.forEach(button => button.click())
|
|
61
|
+
show = true
|
|
62
|
+
}
|
|
56
63
|
</script>
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
<!-- Renders the iconSlot or use the icon -->
|
|
66
|
+
{#snippet iconBlock()}
|
|
67
|
+
{#if iconSlot}
|
|
68
|
+
{@render iconSlot()}
|
|
69
|
+
{:else}
|
|
70
|
+
<Icon {icon} class={iconClass} />
|
|
71
|
+
{/if}
|
|
72
|
+
{/snippet}
|
|
73
|
+
|
|
74
|
+
<!-- The output -->
|
|
75
|
+
|
|
76
|
+
<div class="accordion {klass}" class:is-expanded={show}>
|
|
77
|
+
<svelte:element this={opts.titleTag} class="accordion-title {titleClass}">
|
|
61
78
|
<button
|
|
62
|
-
class="
|
|
63
|
-
|
|
64
|
-
|
|
79
|
+
class="accordion-button {buttonClass}"
|
|
80
|
+
onclick={handleClick}
|
|
81
|
+
onkeydown={handleKeydown}
|
|
65
82
|
aria-expanded={show}
|
|
66
83
|
aria-controls={id}
|
|
67
84
|
>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
</slot>
|
|
73
|
-
|
|
74
|
-
<slot name="title"></slot>
|
|
75
|
-
|
|
76
|
-
<slot name="icon">
|
|
77
|
-
{#if !hasCustomIcon && iconLocation === 'end'}
|
|
78
|
-
<SVG {icon} class={svgClass} />
|
|
79
|
-
{/if}
|
|
80
|
-
</slot>
|
|
85
|
+
<!-- Icon start -->
|
|
86
|
+
{#if opts.iconLocation === 'start'}{@render iconBlock()}{/if}
|
|
87
|
+
{@render title()}
|
|
88
|
+
{#if opts.iconLocation === 'end'}{@render iconBlock()}{/if}
|
|
81
89
|
</button>
|
|
82
90
|
</svelte:element>
|
|
83
91
|
|
|
84
92
|
{#if show === true}
|
|
85
93
|
<div
|
|
86
94
|
{id}
|
|
87
|
-
|
|
88
|
-
class="AccordionContent {contentClass}"
|
|
95
|
+
class="accordion-content {contentClass}"
|
|
89
96
|
transition:transit={{
|
|
90
97
|
transition: opts.transition,
|
|
91
98
|
}}
|
|
92
99
|
>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<slot name="content"></slot>
|
|
100
|
+
{#if content}{@render content()}{/if}
|
|
101
|
+
{#if children}{@render children()}{/if}
|
|
96
102
|
</div>
|
|
97
103
|
{/if}
|
|
98
|
-
|
|
99
|
-
<!--
|
|
104
|
+
|
|
105
|
+
<!-- Hidden button for closing multiple accordions only, only accessible via JS -->
|
|
106
|
+
<!-- svelte-ignore a11y_consider_explicit_label a11y_incorrect_aria_attribute_type_boolean -->
|
|
100
107
|
<button
|
|
101
|
-
|
|
102
|
-
class="
|
|
108
|
+
onclick={closeAccordion}
|
|
109
|
+
class="accordion-close-button"
|
|
110
|
+
style="display:none"
|
|
103
111
|
hidden
|
|
112
|
+
aria-hidden="true"
|
|
104
113
|
tabindex="-1"
|
|
105
114
|
></button>
|
|
106
115
|
</div>
|
|
107
|
-
|
|
108
|
-
<!-- IF ICON BEFORE, need to put flex-start on the accordion title. Because that's the default value -->
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
{#if structure.length}
|
|
62
62
|
<div class="ContentList {klass}" {...$$restProps}>
|
|
63
|
-
<div class="
|
|
63
|
+
<div class="label {labelClass}">{label}</div>
|
|
64
64
|
<ul class="IndentedList {listClass}">
|
|
65
65
|
<NestedList items={structure} />
|
|
66
66
|
</ul>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
const { class: klass, from, company = '' } = $props()
|
|
3
|
+
|
|
4
|
+
const fromYear = from && new Date(from).getFullYear()
|
|
5
|
+
const thisYear = new Date().getFullYear()
|
|
6
|
+
const string = getString()
|
|
7
|
+
|
|
8
|
+
function getString() {
|
|
9
|
+
if (!fromYear) return `${thisYear}`
|
|
10
|
+
if (fromYear === thisYear) return `${thisYear}`
|
|
11
|
+
return `${fromYear}-${thisYear}`
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div class={klass}>
|
|
16
|
+
<span>Copyright ©</span>
|
|
17
|
+
<span>{company}</span>
|
|
18
|
+
<span> {string}</span>
|
|
19
|
+
</div>
|
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import
|
|
3
|
-
import { close, getDisclosure } from '../disclosure.js'
|
|
2
|
+
import Icon from '../../Icon/Icon.svelte'
|
|
3
|
+
import { close, getDisclosure } from '../disclosure.svelte.js'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
const {
|
|
6
|
+
class: klass,
|
|
7
|
+
icon = 'tabler:x',
|
|
8
|
+
iconClass = '',
|
|
9
|
+
target,
|
|
10
|
+
children,
|
|
11
|
+
...rest
|
|
12
|
+
} = $props()
|
|
11
13
|
|
|
12
14
|
let button = null
|
|
13
15
|
|
|
14
|
-
function
|
|
16
|
+
function closeDrawer() {
|
|
15
17
|
const id =
|
|
16
18
|
document.querySelector(`${target}`)?.id ||
|
|
17
|
-
button.closest('.
|
|
19
|
+
button.closest('.drawer-content').id
|
|
18
20
|
const d = getDisclosure(id)
|
|
19
|
-
close(d, {
|
|
21
|
+
close(d, { shouldFocusWhenClosing: true })
|
|
20
22
|
}
|
|
21
23
|
</script>
|
|
22
24
|
|
|
23
25
|
<button
|
|
24
26
|
aria-label="Close dialog"
|
|
25
|
-
class="
|
|
27
|
+
class="drawer-close-button {klass}"
|
|
28
|
+
{...rest}
|
|
26
29
|
bind:this={button}
|
|
27
|
-
|
|
28
|
-
{...$$restProps}
|
|
30
|
+
onclick={closeDrawer}
|
|
29
31
|
>
|
|
30
|
-
|
|
32
|
+
{#if children}
|
|
33
|
+
{@render children()}
|
|
34
|
+
{:else}
|
|
35
|
+
<Icon class={iconClass} {icon} />
|
|
36
|
+
{/if}
|
|
31
37
|
</button>
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
<!-- Drawers are not working currently because we changed the Disclosure implementation. -->
|
|
2
1
|
<script>
|
|
3
2
|
import { splitObject, toStyleString } from '@splendidlabz/utils'
|
|
4
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
goToElement,
|
|
5
|
+
hasLabel,
|
|
6
|
+
markActiveAnchorIn,
|
|
7
|
+
} from '@splendidlabz/utils/dom'
|
|
8
|
+
import { mergeOpts, transit } from '../../../utils/index.js'
|
|
5
9
|
import Portal from '../../Portal.svelte'
|
|
6
|
-
import { hasLabel } from '../../_shared/accessibility'
|
|
7
|
-
import { transit } from '../../_shared/transitions.js'
|
|
8
|
-
import { disclosures } from '../disclosure-store.js'
|
|
9
10
|
import {
|
|
10
11
|
DISCLOSURE_CONTENT_OPT_KEYS,
|
|
11
12
|
disclosureContent,
|
|
12
|
-
|
|
13
|
+
getDisclosure,
|
|
14
|
+
} from '../disclosure.svelte.js'
|
|
13
15
|
import {
|
|
14
16
|
defaultDrawerContentOpts,
|
|
15
17
|
defaultDrawerPositionOpts,
|
|
@@ -17,148 +19,110 @@
|
|
|
17
19
|
getTransitionXY,
|
|
18
20
|
} from './drawer.js'
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const p = $props()
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
class: klass,
|
|
26
|
+
style: styleString,
|
|
27
|
+
backdropClass,
|
|
28
|
+
id,
|
|
29
|
+
role = 'dialog',
|
|
30
|
+
'aria-label': ariaLabel,
|
|
31
|
+
'aria-labelledBy': ariaLabelledBy,
|
|
32
|
+
'aria-describedby': ariaDescribedBy,
|
|
33
|
+
children,
|
|
34
|
+
portal = true,
|
|
35
|
+
// Event handlers are
|
|
36
|
+
// - onopen
|
|
37
|
+
// - onclose
|
|
38
|
+
// But they're spread into ...rest
|
|
39
|
+
...rest
|
|
40
|
+
} = p
|
|
41
|
+
|
|
42
|
+
const opts = mergeOpts(
|
|
43
|
+
defaultDrawerContentOpts,
|
|
44
|
+
defaultDrawerPositionOpts[
|
|
45
|
+
rest.position || defaultDrawerContentOpts.position
|
|
46
|
+
],
|
|
47
|
+
rest,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
const { picked: disclosureContentOpts, omitted: remaining } = splitObject(
|
|
51
|
+
opts,
|
|
52
|
+
DISCLOSURE_CONTENT_OPT_KEYS,
|
|
53
|
+
)
|
|
25
54
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export let ariaLabelledBy = $$restProps['aria-labelledby']
|
|
30
|
-
export let ariaDescribedBy = $$restProps['aria-describedby']
|
|
31
|
-
export let options = {}
|
|
55
|
+
const { placement, position, backdrop, blurBackdrop, scrollToAnchor } = opts
|
|
56
|
+
const TBLR = getTBLRValues({ placement, position })
|
|
57
|
+
const style = toStyleString(TBLR) + styleString
|
|
32
58
|
|
|
33
|
-
|
|
59
|
+
// Accessible name warning
|
|
34
60
|
if (role === 'dialog' && !hasLabel(ariaLabel, ariaLabelledBy)) {
|
|
35
61
|
console.warn(
|
|
36
62
|
`DrawerContent (with id: ${id}) is a dialog and should have an accessible name. Please create one with aria-label or aria-labelledby.`,
|
|
37
63
|
)
|
|
38
64
|
}
|
|
39
65
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
66
|
+
let ref = $state(null)
|
|
67
|
+
let d = $derived(getDisclosure(id))
|
|
68
|
+
let show = $derived(d?.state.show)
|
|
69
|
+
|
|
70
|
+
$effect(_ => {
|
|
71
|
+
if (show && ref && scrollToAnchor) {
|
|
72
|
+
const anchor = markActiveAnchorIn(ref)
|
|
73
|
+
goToElement(anchor)
|
|
74
|
+
}
|
|
75
|
+
})
|
|
48
76
|
|
|
49
77
|
// Temp remove push transition
|
|
50
78
|
// Replace transition string with our custom push transition
|
|
51
79
|
// if (options?.transition === 'push') options.transition = push
|
|
80
|
+
</script>
|
|
52
81
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
82
|
+
{#snippet drawerBackdrop()}
|
|
83
|
+
<div
|
|
84
|
+
class="{backdropClass} drawer-backdrop"
|
|
85
|
+
class:backdrop-blur={backdrop && blurBackdrop}
|
|
86
|
+
transition:transit|global={opts}
|
|
87
|
+
>
|
|
88
|
+
{@render drawerContent()}
|
|
89
|
+
</div>
|
|
90
|
+
{/snippet}
|
|
57
91
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
92
|
+
{#snippet drawerContent()}
|
|
93
|
+
<div
|
|
94
|
+
{id}
|
|
95
|
+
{...remaining}
|
|
96
|
+
class="drawer-content {klass}"
|
|
97
|
+
{role}
|
|
98
|
+
{style}
|
|
99
|
+
bind:this={ref}
|
|
100
|
+
use:disclosureContent={{ options: disclosureContentOpts }}
|
|
101
|
+
aria-label={ariaLabel}
|
|
102
|
+
aria-labelledby={ariaLabelledBy}
|
|
103
|
+
aria-describedby={ariaDescribedBy}
|
|
104
|
+
transition:transit|global={{
|
|
105
|
+
placement,
|
|
106
|
+
...getTransitionXY(placement),
|
|
107
|
+
...opts,
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
{#if children}
|
|
111
|
+
{@render children()}
|
|
112
|
+
{/if}
|
|
113
|
+
</div>
|
|
114
|
+
{/snippet}
|
|
70
115
|
|
|
71
|
-
|
|
72
|
-
{#if d?.state.show}
|
|
116
|
+
{#if show}
|
|
73
117
|
{#if position === 'fixed'}
|
|
74
|
-
{#if
|
|
75
|
-
<Portal>
|
|
76
|
-
<div
|
|
77
|
-
class={backdropClass}
|
|
78
|
-
class:DrawerBackdrop={backdrop}
|
|
79
|
-
class:DrawerBackdrop-blur={backdrop && blurBackdrop}
|
|
80
|
-
transition:transit|global={options}
|
|
81
|
-
>
|
|
82
|
-
<!-- Ideally we put this inside a Snippet in Svelte 5. Right now we have no choice but to copy-paste between different types of drawers -->
|
|
83
|
-
<div
|
|
84
|
-
{id}
|
|
85
|
-
class="DrawerContent {klass}"
|
|
86
|
-
{role}
|
|
87
|
-
{style}
|
|
88
|
-
bind:this={ref}
|
|
89
|
-
use:disclosureContent={{ options: disclosureContentOpts }}
|
|
90
|
-
aria-label={ariaLabel}
|
|
91
|
-
aria-labelledby={ariaLabelledBy}
|
|
92
|
-
aria-describedby={ariaDescribedBy}
|
|
93
|
-
on:open
|
|
94
|
-
on:close
|
|
95
|
-
transition:transit|global={{
|
|
96
|
-
placement,
|
|
97
|
-
...getTransitionXY(placement),
|
|
98
|
-
...options,
|
|
99
|
-
}}
|
|
100
|
-
>
|
|
101
|
-
<!-- Rest Props kinda breaks transition... confirmed. -->
|
|
102
|
-
<!-- {...$$restProps} -->
|
|
103
|
-
<slot />
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
</Portal>
|
|
118
|
+
{#if opts.portal}
|
|
119
|
+
<Portal>{@render drawerBackdrop()}</Portal>
|
|
107
120
|
{:else}
|
|
108
|
-
|
|
109
|
-
class={backdropClass}
|
|
110
|
-
class:DrawerBackdrop={backdrop}
|
|
111
|
-
class:DrawerBackdrop-blur={backdrop && blurBackdrop}
|
|
112
|
-
transition:transit|global={options}
|
|
113
|
-
>
|
|
114
|
-
<!-- Ideally we put this inside a Snippet in Svelte 5. Right now we have no choice but to copy-paste between different types of drawers -->
|
|
115
|
-
<di
|
|
116
|
-
{id}
|
|
117
|
-
class="DrawerContent {klass}"
|
|
118
|
-
{role}
|
|
119
|
-
{style}
|
|
120
|
-
bind:this={ref}
|
|
121
|
-
use:disclosureContent={{ options: disclosureContentOpts }}
|
|
122
|
-
on:open
|
|
123
|
-
on:close
|
|
124
|
-
aria-label={ariaLabel}
|
|
125
|
-
aria-labelledby={ariaLabelledBy}
|
|
126
|
-
aria-describedby={ariaDescribedBy}
|
|
127
|
-
transition:transit|global={{
|
|
128
|
-
placement,
|
|
129
|
-
...getTransitionXY(placement),
|
|
130
|
-
...options,
|
|
131
|
-
}}
|
|
132
|
-
>
|
|
133
|
-
<!-- Rest Props kinda breaks transition... confirmed. -->
|
|
134
|
-
<!-- {...$$restProps} -->
|
|
135
|
-
<slot />
|
|
136
|
-
</di>
|
|
137
|
-
</div>
|
|
121
|
+
{@render drawerBackdrop()}
|
|
138
122
|
{/if}
|
|
139
123
|
{/if}
|
|
140
124
|
|
|
141
125
|
{#if position === 'absolute' || position === 'static'}
|
|
142
|
-
|
|
143
|
-
{id}
|
|
144
|
-
class="DrawerContent {klass}"
|
|
145
|
-
{role}
|
|
146
|
-
{style}
|
|
147
|
-
bind:this={ref}
|
|
148
|
-
use:disclosureContent={{ options: disclosureContentOpts }}
|
|
149
|
-
aria-label={ariaLabel}
|
|
150
|
-
aria-labelledby={ariaLabelledBy}
|
|
151
|
-
aria-describedby={ariaDescribedBy}
|
|
152
|
-
on:open
|
|
153
|
-
on:close
|
|
154
|
-
transition:transit|global={{
|
|
155
|
-
placement,
|
|
156
|
-
...getTransitionXY(placement),
|
|
157
|
-
...options,
|
|
158
|
-
}}
|
|
159
|
-
>
|
|
160
|
-
<!-- {...$$restProps} -->
|
|
161
|
-
<slot />
|
|
162
|
-
</div>
|
|
126
|
+
{@render drawerContent()}
|
|
163
127
|
{/if}
|
|
164
128
|
{/if}
|