@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
|
@@ -1,29 +1,47 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { randomString } from '@splendidlabz/utils/dom'
|
|
3
3
|
import { useActions } from '../_shared/use-actions'
|
|
4
|
-
let klass = ''
|
|
5
|
-
export { klass as class }
|
|
6
|
-
export let style = null
|
|
7
|
-
export let labelClass = ''
|
|
8
|
-
export let hintClass = ''
|
|
9
|
-
export let errorClass = ''
|
|
10
|
-
export let inputGroupClass = ''
|
|
11
|
-
export let fieldClass = ''
|
|
12
4
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export let ref = null
|
|
24
|
-
export let actions = []
|
|
25
|
-
export let Stack = false
|
|
5
|
+
let { value = $bindable(''), ref = $bindable(null), ...p } = $props()
|
|
6
|
+
const {
|
|
7
|
+
// Classes
|
|
8
|
+
class: klass,
|
|
9
|
+
style,
|
|
10
|
+
labelClass,
|
|
11
|
+
hintClass,
|
|
12
|
+
errorClass,
|
|
13
|
+
inputGroupClass,
|
|
14
|
+
fieldClass,
|
|
26
15
|
|
|
16
|
+
// Slots
|
|
17
|
+
before,
|
|
18
|
+
after,
|
|
19
|
+
children,
|
|
20
|
+
|
|
21
|
+
// Options and props
|
|
22
|
+
id = randomString(8),
|
|
23
|
+
type = 'text',
|
|
24
|
+
name,
|
|
25
|
+
label = '',
|
|
26
|
+
labelVisible = true,
|
|
27
|
+
hint = null,
|
|
28
|
+
error = null,
|
|
29
|
+
disabled = null,
|
|
30
|
+
readonly = null,
|
|
31
|
+
actions = [], // Might not need this anymore in S5.
|
|
32
|
+
...rest
|
|
33
|
+
} = p
|
|
34
|
+
|
|
35
|
+
// For this binding, does it send upwards?? Need testing
|
|
36
|
+
|
|
37
|
+
// IDs for aria-describedby
|
|
38
|
+
const hintId = hint ? id + '-hint' : ''
|
|
39
|
+
const errorId = error ? id + '-error' : ''
|
|
40
|
+
const describedBy = `${hintId} ${errorId}`.trim() || null
|
|
41
|
+
|
|
42
|
+
// ========================================
|
|
43
|
+
// Check for errors
|
|
44
|
+
// ========================================
|
|
27
45
|
if (!name) throw new Error('TextInput requires a name')
|
|
28
46
|
|
|
29
47
|
const SUPPORTED_TYPES = ['text', 'email', 'password', 'search', 'url', 'tel']
|
|
@@ -32,56 +50,61 @@
|
|
|
32
50
|
if (!SUPPORTED_TYPES.includes(type)) {
|
|
33
51
|
throw new Error(`Invalid type: ${type}`)
|
|
34
52
|
}
|
|
35
|
-
|
|
36
|
-
// IDs for aria-describedby
|
|
37
|
-
id = id || randomString(8)
|
|
38
|
-
const hintId = hint ? id + '-hint' : ''
|
|
39
|
-
const errorId = error ? id + '-error' : ''
|
|
40
|
-
const describedBy = `${hintId} ${errorId}`.trim() || null
|
|
41
53
|
</script>
|
|
42
54
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
<!-- Snippets -->
|
|
56
|
+
{#snippet input()}
|
|
57
|
+
<input
|
|
58
|
+
{...rest}
|
|
59
|
+
{id}
|
|
60
|
+
class="input {fieldClass}"
|
|
61
|
+
{name}
|
|
62
|
+
{...{ type }}
|
|
63
|
+
{disabled}
|
|
64
|
+
{readonly}
|
|
65
|
+
aria-describedby={describedBy}
|
|
66
|
+
aria-invalid={error ? 'true' : null}
|
|
67
|
+
bind:this={ref}
|
|
68
|
+
bind:value
|
|
69
|
+
use:useActions={actions}
|
|
70
|
+
/>
|
|
71
|
+
{/snippet}
|
|
72
|
+
|
|
73
|
+
<!-- Output -->
|
|
74
|
+
<div
|
|
75
|
+
class="input-container text-input {klass}"
|
|
76
|
+
{style}
|
|
77
|
+
class:disabled
|
|
78
|
+
class:readonly
|
|
79
|
+
aria-label={!labelVisible && label}
|
|
80
|
+
>
|
|
81
|
+
{#if label && labelVisible}
|
|
82
|
+
<label class="label input-meta {labelClass}" for={id}>{label}</label>
|
|
46
83
|
{/if}
|
|
47
84
|
{#if hint}
|
|
48
|
-
<div id={hintId} class="
|
|
85
|
+
<div id={hintId} class="hint input-meta {hintClass}">{hint}</div>
|
|
49
86
|
{/if}
|
|
50
87
|
{#if error}
|
|
51
|
-
<output id={errorId} class="
|
|
88
|
+
<output id={errorId} class="error input-meta {errorClass}" for={id}
|
|
89
|
+
>{error}</output
|
|
90
|
+
>
|
|
52
91
|
{/if}
|
|
53
92
|
|
|
54
|
-
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
on:focus
|
|
72
|
-
on:blur
|
|
73
|
-
on:click
|
|
74
|
-
on:keydown
|
|
75
|
-
on:keyup
|
|
76
|
-
on:keypress
|
|
77
|
-
bind:this={ref}
|
|
78
|
-
bind:value
|
|
79
|
-
use:useActions={actions}
|
|
80
|
-
{...$$restProps}
|
|
81
|
-
/>
|
|
82
|
-
{#if $$slots.after}
|
|
83
|
-
{#if !Stack}<div class="Divider-vertical"></div>{/if}
|
|
84
|
-
<slot name="after" />
|
|
85
|
-
{/if}
|
|
86
|
-
</div>
|
|
93
|
+
{#if before || after}
|
|
94
|
+
<div class="input-group {inputGroupClass}">
|
|
95
|
+
{#if before}
|
|
96
|
+
{@render before()}
|
|
97
|
+
<div class="divider-vertical"></div>
|
|
98
|
+
{/if}
|
|
99
|
+
|
|
100
|
+
{@render input()}
|
|
101
|
+
|
|
102
|
+
{#if after}
|
|
103
|
+
<div class="divider-vertical"></div>
|
|
104
|
+
{@render after()}
|
|
105
|
+
{/if}
|
|
106
|
+
</div>
|
|
107
|
+
{:else}
|
|
108
|
+
{@render input()}
|
|
109
|
+
{/if}
|
|
87
110
|
</div>
|
|
@@ -1,103 +1,126 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { randomString } from '@splendidlabz/utils/dom'
|
|
3
|
+
import { mergeOpts } from '../../utils'
|
|
3
4
|
import { useActions } from '../_shared/use-actions'
|
|
4
5
|
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
let { value = $bindable(''), ref = $bindable(null), ...p } = $props()
|
|
7
|
+
const {
|
|
8
|
+
class: klass,
|
|
9
|
+
style,
|
|
10
|
+
labelClass,
|
|
11
|
+
hintClass,
|
|
12
|
+
errorClass,
|
|
13
|
+
inputGroupClass,
|
|
14
|
+
fieldClass,
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export let value = null
|
|
20
|
-
export let placeholder = null
|
|
21
|
-
export let disabled = null
|
|
22
|
-
export let readonly = null
|
|
23
|
-
export let ref = null
|
|
24
|
-
export let actions = []
|
|
16
|
+
// Slots
|
|
17
|
+
before,
|
|
18
|
+
after,
|
|
19
|
+
children,
|
|
20
|
+
} = p
|
|
25
21
|
|
|
26
|
-
|
|
22
|
+
const {
|
|
23
|
+
// Options and props
|
|
24
|
+
id = randomString(8),
|
|
25
|
+
name,
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
label = '',
|
|
28
|
+
hint = null,
|
|
29
|
+
error = null,
|
|
30
|
+
disabled = null,
|
|
31
|
+
readonly = null,
|
|
32
|
+
actions = [],
|
|
33
|
+
stack = false,
|
|
34
|
+
|
|
35
|
+
// Features
|
|
36
|
+
oninput = null,
|
|
37
|
+
autogrow = false,
|
|
38
|
+
...rest
|
|
39
|
+
} = mergeOpts(p) // Better name would be better to extract options...
|
|
29
40
|
|
|
30
41
|
// IDs for aria-describedby
|
|
31
|
-
id = id || randomString(8)
|
|
32
42
|
const hintId = hint ? id + '-hint' : ''
|
|
33
43
|
const errorId = error ? id + '-error' : ''
|
|
34
44
|
const describedBy = `${hintId} ${errorId}`.trim() || null
|
|
35
45
|
|
|
36
|
-
|
|
46
|
+
// ========================================
|
|
47
|
+
// Check for errors
|
|
48
|
+
// ========================================
|
|
49
|
+
if (!name) throw new Error('Textarea requires a name')
|
|
37
50
|
|
|
51
|
+
// ========================================
|
|
52
|
+
// Extra Features
|
|
53
|
+
// ========================================
|
|
38
54
|
// Think about auto-growing textarea
|
|
55
|
+
let dummyRef = $state(null)
|
|
39
56
|
function autoGrow(event) {
|
|
40
|
-
if (
|
|
57
|
+
if (autogrow) {
|
|
41
58
|
dummyRef.textContent = event.target.value
|
|
42
59
|
const last = event.target.value.slice(-1)
|
|
43
60
|
if (last === '\n') dummyRef.textContent += ' '
|
|
44
61
|
}
|
|
62
|
+
|
|
63
|
+
// Fire oninput event too... if any
|
|
64
|
+
if (oninput) oninput(event)
|
|
45
65
|
}
|
|
46
66
|
</script>
|
|
47
67
|
|
|
68
|
+
<!-- Snippets -->
|
|
69
|
+
{#snippet textarea()}
|
|
70
|
+
<textarea
|
|
71
|
+
{...rest}
|
|
72
|
+
{id}
|
|
73
|
+
class="input {fieldClass}"
|
|
74
|
+
{name}
|
|
75
|
+
{disabled}
|
|
76
|
+
{readonly}
|
|
77
|
+
aria-describedby={describedBy}
|
|
78
|
+
aria-invalid={error ? 'true' : null}
|
|
79
|
+
oninput={autoGrow}
|
|
80
|
+
bind:this={ref}
|
|
81
|
+
bind:value
|
|
82
|
+
use:useActions={actions}
|
|
83
|
+
></textarea>
|
|
84
|
+
{/snippet}
|
|
85
|
+
|
|
48
86
|
<div
|
|
49
|
-
class="
|
|
87
|
+
class="input-container text-field textarea {klass}"
|
|
50
88
|
class:disabled
|
|
51
89
|
class:readonly
|
|
52
|
-
class:
|
|
90
|
+
class:textarea-autogrow={autogrow}
|
|
53
91
|
{style}
|
|
54
92
|
>
|
|
55
93
|
{#if label}
|
|
56
|
-
<label class="
|
|
94
|
+
<label class="label input-meta {labelClass}" for={id}>{label}</label>
|
|
57
95
|
{/if}
|
|
58
96
|
{#if hint}
|
|
59
|
-
<div id={hintId} class="
|
|
97
|
+
<div id={hintId} class="hint input-meta {hintClass}">{hint}</div>
|
|
60
98
|
{/if}
|
|
61
99
|
{#if error}
|
|
62
|
-
<output id={errorId} class="
|
|
100
|
+
<output id={errorId} class="error input-meta {errorClass}" for={id}
|
|
101
|
+
>{error}</output
|
|
102
|
+
>
|
|
63
103
|
{/if}
|
|
64
104
|
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
105
|
+
{#if before || after}
|
|
106
|
+
<div class="input-group {inputGroupClass}">
|
|
107
|
+
{#if before}
|
|
108
|
+
{@render before()}
|
|
109
|
+
<div class="divider-vertical"></div>
|
|
110
|
+
{/if}
|
|
70
111
|
|
|
71
|
-
|
|
72
|
-
<div class="Replica Field" bind:this={dummyRef}></div>
|
|
112
|
+
{@render textarea()}
|
|
73
113
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
{placeholder}
|
|
79
|
-
{disabled}
|
|
80
|
-
{readonly}
|
|
81
|
-
aria-describedby={describedBy}
|
|
82
|
-
aria-invalid={error ? 'true' : null}
|
|
83
|
-
on:input={autoGrow}
|
|
84
|
-
on:change
|
|
85
|
-
on:focus
|
|
86
|
-
on:blur
|
|
87
|
-
on:click
|
|
88
|
-
on:keydown
|
|
89
|
-
on:keyup
|
|
90
|
-
on:keypress
|
|
91
|
-
bind:this={ref}
|
|
92
|
-
bind:value
|
|
93
|
-
use:useActions={actions}
|
|
94
|
-
{...$$restProps}
|
|
95
|
-
/>
|
|
114
|
+
{#if after}
|
|
115
|
+
<div class="divider-vertical"></div>
|
|
116
|
+
{@render after()}
|
|
117
|
+
{/if}
|
|
96
118
|
</div>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
119
|
+
{:else}
|
|
120
|
+
<div class="stack">
|
|
121
|
+
<!-- Autogrow textarea cannot be used together with input-group cos it makes the CSS very complex -->
|
|
122
|
+
<div class="replica-field" bind:this={dummyRef}></div>
|
|
123
|
+
{@render textarea()}
|
|
124
|
+
</div>
|
|
125
|
+
{/if}
|
|
103
126
|
</div>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
let klass
|
|
3
|
+
export { klass as class }
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<span class="Highlight {klass}"><slot /></span>
|
|
7
|
+
|
|
8
|
+
<style lang="scss">
|
|
9
|
+
.Highlight {
|
|
10
|
+
--color: var(--yellow-050);
|
|
11
|
+
// For Body Copy
|
|
12
|
+
background-color: var(--color);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// .Highlight.mHeadline {
|
|
16
|
+
// // Goes until baseline.
|
|
17
|
+
// // Depends on line cap.
|
|
18
|
+
// line-height: 1;
|
|
19
|
+
// background-image: linear-gradient(
|
|
20
|
+
// transparent 0.25em,
|
|
21
|
+
// var(--color) 0.25em,
|
|
22
|
+
// var(--color) 1em,
|
|
23
|
+
// transparent 1em
|
|
24
|
+
// );
|
|
25
|
+
// }
|
|
26
|
+
|
|
27
|
+
[color='red'] {
|
|
28
|
+
--color: var(--red-050);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
[color='yellow'] {
|
|
32
|
+
--color: var(--yellow-050);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[color='darkYellow'] {
|
|
36
|
+
--color: var(--yellow-300);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[color='green'] {
|
|
40
|
+
--color: var(--green-050);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[color='blue'] {
|
|
44
|
+
--color: var(--blue-050);
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { getIcon, loadIcon } from '@iconify/svelte'
|
|
3
|
+
import { toStyleString } from '@splendidlabz/utils'
|
|
4
|
+
import { onMount } from 'svelte'
|
|
5
|
+
|
|
6
|
+
export let icon
|
|
7
|
+
export let style = ''
|
|
8
|
+
|
|
9
|
+
if (typeof style === 'object') style = toStyleString(style)
|
|
10
|
+
if (!icon) throw new Error('icon property is required')
|
|
11
|
+
|
|
12
|
+
let iconData
|
|
13
|
+
let innerHTML
|
|
14
|
+
let attributes = {
|
|
15
|
+
class: `${icon.split(':')[1]}`,
|
|
16
|
+
role: 'img',
|
|
17
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
|
18
|
+
width: '1em',
|
|
19
|
+
height: '1em',
|
|
20
|
+
style,
|
|
21
|
+
...$$restProps,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// If there is an icon set, we use Iconify.
|
|
25
|
+
// This stores the icon in localStorage after loading it for the first time. Subsequent loads will use the localStorage cached version.
|
|
26
|
+
|
|
27
|
+
// Populates icon data if the icon is in cache
|
|
28
|
+
iconData = getIcon(icon)
|
|
29
|
+
|
|
30
|
+
// If icon is not in cache, loads the icon from Iconify
|
|
31
|
+
if (!iconData) onMount(async _ => (iconData = await loadIcon(icon)))
|
|
32
|
+
|
|
33
|
+
$: if (iconData) {
|
|
34
|
+
attributes.viewBox = `0 0 ${iconData.width} ${iconData.height}`
|
|
35
|
+
innerHTML = iconData.body
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
{#if innerHTML}
|
|
40
|
+
<svg {...attributes}> {@html innerHTML} </svg>
|
|
41
|
+
{:else}
|
|
42
|
+
<svg {...attributes} />
|
|
43
|
+
{/if}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-env browser */
|
|
2
2
|
// Maybe the sensitivity and perspective values can be written directly in Svelte so we don't have to use Custom Properties
|
|
3
|
-
export
|
|
3
|
+
export function perspectiveHover(node) {
|
|
4
4
|
const computedStyle = getComputedStyle(node)
|
|
5
5
|
const sensitivity = computedStyle.getPropertyValue('--sensitivity')
|
|
6
6
|
const perspective = computedStyle.getPropertyValue('--perspective')
|
package/components/Portal.svelte
CHANGED
package/components/Tabs/tabs.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import LayoutScripts from '@splendidlabz/layouts/scripts/all'
|
|
2
|
-
import { omitEmpty } from '@splendidlabz/utils'
|
|
3
1
|
import {
|
|
4
2
|
Focusable,
|
|
5
3
|
addListeners,
|
|
@@ -10,6 +8,9 @@ import {
|
|
|
10
8
|
} from '@splendidlabz/utils/dom'
|
|
11
9
|
import { initTab, updateTab } from './tab-store'
|
|
12
10
|
|
|
11
|
+
import LayoutScripts from '@splendidlabz/styles/scripts/all'
|
|
12
|
+
import { omitEmpty } from '@splendidlabz/utils'
|
|
13
|
+
|
|
13
14
|
export const DEFAULT_TABLIST_OPTIONS = {
|
|
14
15
|
state: {
|
|
15
16
|
placement: 'top', // top, left, right
|
|
@@ -36,11 +37,11 @@ export function tablist(node, props) {
|
|
|
36
37
|
|
|
37
38
|
// The filter allows us to nest tabs in tabs
|
|
38
39
|
const tablistItems = Array.from(node.querySelectorAll('[role="tab"]')).filter(
|
|
39
|
-
tab => tab.closest('.Tablist') === node
|
|
40
|
+
tab => tab.closest('.Tablist') === node
|
|
40
41
|
)
|
|
41
42
|
let activeTabIndex
|
|
42
43
|
activeTabIndex = tablistItems.findIndex(tab =>
|
|
43
|
-
tab.hasAttribute('aria-selected')
|
|
44
|
+
tab.hasAttribute('aria-selected')
|
|
44
45
|
)
|
|
45
46
|
if (activeTabIndex === -1) activeTabIndex = 0
|
|
46
47
|
|
|
@@ -129,12 +130,12 @@ export function tabpanels(node, props) {
|
|
|
129
130
|
|
|
130
131
|
// The filter allows us to nest tabs in tabs
|
|
131
132
|
const tabpanelItems = Array.from(
|
|
132
|
-
node.querySelectorAll('[role="tabpanel"]')
|
|
133
|
+
node.querySelectorAll('[role="tabpanel"]')
|
|
133
134
|
).filter(tab => tab.closest('.Tabpanels') === node)
|
|
134
135
|
|
|
135
136
|
let activeTabIndex
|
|
136
137
|
activeTabIndex = tabpanelItems.findIndex(
|
|
137
|
-
tabpanel => !tabpanel.hasAttribute('hidden')
|
|
138
|
+
tabpanel => !tabpanel.hasAttribute('hidden')
|
|
138
139
|
)
|
|
139
140
|
if (activeTabIndex === -1) activeTabIndex = 0
|
|
140
141
|
|
|
@@ -223,11 +224,7 @@ function setInitialState(Tab) {
|
|
|
223
224
|
export function selectTab(
|
|
224
225
|
Tab,
|
|
225
226
|
index,
|
|
226
|
-
{
|
|
227
|
-
shouldFocusOnTab = true,
|
|
228
|
-
shouldUpdateHash = true,
|
|
229
|
-
shouldScroll = true,
|
|
230
|
-
} = {},
|
|
227
|
+
{ shouldFocusOnTab = true, shouldUpdateHash = true, shouldScroll = true } = {}
|
|
231
228
|
) {
|
|
232
229
|
Tab.state.activeTabIndex = index
|
|
233
230
|
updateTab(Tab)
|
package/components/Video.svelte
CHANGED
package/components/Vimeo.svelte
CHANGED
|
File without changes
|
package/index.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
export * from './components/Disclosure/index.js'
|
|
2
|
+
export * from './components/Icon/index.js'
|
|
3
|
+
|
|
4
|
+
// Not tested yet
|
|
1
5
|
export * from './components/Accordion/index.js'
|
|
2
6
|
export * from './components/Breadcrumbs/index.js'
|
|
7
|
+
export * from './components/BrowserFrame/index.js'
|
|
3
8
|
export * from './components/Callout/index.js'
|
|
4
9
|
export * from './components/Codepen/index.js'
|
|
5
10
|
export * from './components/ContentList/index.js'
|
|
6
|
-
export * from './components/
|
|
11
|
+
export * from './components/effects/index.js'
|
|
7
12
|
export * from './components/FancyList/index.js'
|
|
8
13
|
export * from './components/Form/index.js'
|
|
9
14
|
export * from './components/Highlight/index.js'
|
|
@@ -19,8 +24,7 @@ export * from './components/Tabs/index.js'
|
|
|
19
24
|
export * from './components/Textwall/index.js'
|
|
20
25
|
export * from './components/Typewriter/index.js'
|
|
21
26
|
|
|
22
|
-
export { default as
|
|
23
|
-
export { default as BrowserWithTabs } from './components/BrowserWithTabs.svelte'
|
|
27
|
+
export { default as Copyright } from './components/Copyright.svelte'
|
|
24
28
|
export { default as CQChecker } from './components/CQChecker/CQChecker.svelte'
|
|
25
29
|
export { default as Image } from './components/Image.svelte'
|
|
26
30
|
export { default as Markdown } from './components/Markdown/Markdown.svelte'
|
|
@@ -29,7 +33,6 @@ export { default as Portal } from './components/Portal.svelte'
|
|
|
29
33
|
export { default as PushToLocalStorage } from './components/PushToLocalStorage.svelte'
|
|
30
34
|
export { default as Spotlight } from './components/Spotlight/Spotlight.svelte'
|
|
31
35
|
export { default as Status } from './components/Status.svelte'
|
|
32
|
-
export { default as SVG } from './components/SVG/SVG.svelte'
|
|
33
36
|
export { default as Video } from './components/Video.svelte'
|
|
34
37
|
export { default as Vimeo } from './components/Vimeo.svelte'
|
|
35
38
|
export { default as Youtube } from './components/Youtube.svelte'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splendidlabz/svelte",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0-alpha.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"scripts": {
|
|
7
7
|
"lint": "eslint . --fix",
|
|
@@ -15,25 +15,24 @@
|
|
|
15
15
|
"./actions": "./actions/index.js",
|
|
16
16
|
"./styles": "./styles.scss",
|
|
17
17
|
"./styles/*": "../components/**/*.scss",
|
|
18
|
-
"./common": "./common.js"
|
|
19
|
-
"./email": "./email-components/index.js"
|
|
18
|
+
"./common": "./common.js"
|
|
20
19
|
},
|
|
21
20
|
"dependencies": {
|
|
22
|
-
"@floating-ui/dom": "^1.
|
|
23
|
-
"@iconify/svelte": "^
|
|
21
|
+
"@floating-ui/dom": "^1.6.13",
|
|
22
|
+
"@iconify/svelte": "^4.2.0",
|
|
24
23
|
"@splendidlabz/layouts": "*",
|
|
25
|
-
"@splendidlabz/styles": "
|
|
24
|
+
"@splendidlabz/styles": "3.0.0-alpha.0",
|
|
26
25
|
"@splendidlabz/utils": "*",
|
|
27
26
|
"autosuggest-highlight": "^3.3.4",
|
|
28
27
|
"lodash-es": "^4.17.21",
|
|
29
|
-
"marked": "^
|
|
30
|
-
"marked-gfm-heading-id": "^
|
|
31
|
-
"marked-mangle": "^1.1.
|
|
32
|
-
"node-html-parser": "^
|
|
28
|
+
"marked": "^15.0.7",
|
|
29
|
+
"marked-gfm-heading-id": "^4.1.1",
|
|
30
|
+
"marked-mangle": "^1.1.10",
|
|
31
|
+
"node-html-parser": "^7.0.1"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@splendidlabz/eslint-config": "*",
|
|
36
|
-
"svelte": "^
|
|
37
|
-
"vitest": "^0.
|
|
35
|
+
"svelte": "^5.20.5",
|
|
36
|
+
"vitest": "^3.0.7"
|
|
38
37
|
}
|
|
39
38
|
}
|