@dillingerstaffing/strand-svelte 0.13.0 → 0.14.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/dist/css/strand-ui.css +13 -0
- package/dist/index.js +1201 -1189
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Link/Link.svelte +5 -1
- package/src/components/Link/Link.test.ts +10 -0
- package/src/components/Nav/Nav.svelte +5 -1
- package/src/components/Nav/Nav.test.ts +5 -0
- package/src/components/Section/Section.svelte +4 -1
- package/src/components/Section/Section.test.ts +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dillingerstaffing/strand-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Strand UI - Svelte component library built on the Strand Design Language",
|
|
5
5
|
"author": "Dillinger Staffing <engineering@dillingerstaffing.com> (https://dillingerstaffing.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"svelte": "^4.0.0 || ^5.0.0"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@dillingerstaffing/strand": "^0.
|
|
58
|
+
"@dillingerstaffing/strand": "^0.14.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
|
@@ -4,11 +4,15 @@
|
|
|
4
4
|
export let href: string
|
|
5
5
|
/** Opens in new tab with rel="noopener noreferrer" */
|
|
6
6
|
export let external: boolean = false
|
|
7
|
+
/** Style variant */
|
|
8
|
+
export let variant: 'default' | 'cta' | 'mono' = 'default'
|
|
9
|
+
|
|
10
|
+
$: linkClasses = ['strand-link', variant !== 'default' && `strand-link--${variant}`].filter(Boolean).join(' ')
|
|
7
11
|
</script>
|
|
8
12
|
|
|
9
13
|
<a
|
|
10
14
|
{href}
|
|
11
|
-
class=
|
|
15
|
+
class={linkClasses}
|
|
12
16
|
target={external ? '_blank' : undefined}
|
|
13
17
|
rel={external ? 'noopener noreferrer' : undefined}
|
|
14
18
|
{...$$restProps}
|
|
@@ -25,4 +25,14 @@ describe('Link', () => {
|
|
|
25
25
|
expect(el).toHaveAttribute('target', '_blank')
|
|
26
26
|
expect(el).toHaveAttribute('rel', 'noopener noreferrer')
|
|
27
27
|
})
|
|
28
|
+
|
|
29
|
+
it('applies cta variant class', () => {
|
|
30
|
+
const { container } = render(Link, { props: { href: '/start', variant: 'cta' } })
|
|
31
|
+
expect(container.querySelector('.strand-link')).toHaveClass('strand-link--cta')
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('applies mono variant class', () => {
|
|
35
|
+
const { container } = render(Link, { props: { href: '/', variant: 'mono' } })
|
|
36
|
+
expect(container.querySelector('.strand-link')).toHaveClass('strand-link--mono')
|
|
37
|
+
})
|
|
28
38
|
})
|
|
@@ -8,15 +8,19 @@
|
|
|
8
8
|
|
|
9
9
|
/** Navigation items */
|
|
10
10
|
export let items: NavItem[] = []
|
|
11
|
+
/** Glassmorphic variant (fixed, backdrop-filter, DL 11.5) */
|
|
12
|
+
export let glass: boolean = false
|
|
11
13
|
|
|
12
14
|
let menuOpen = false
|
|
13
15
|
|
|
14
16
|
function toggleMenu() {
|
|
15
17
|
menuOpen = !menuOpen
|
|
16
18
|
}
|
|
19
|
+
|
|
20
|
+
$: navClasses = ['strand-nav', glass && 'strand-nav--glass'].filter(Boolean).join(' ')
|
|
17
21
|
</script>
|
|
18
22
|
|
|
19
|
-
<nav class=
|
|
23
|
+
<nav class={navClasses} aria-label="Main navigation" {...$$restProps}>
|
|
20
24
|
<div class="strand-nav__inner">
|
|
21
25
|
{#if $$slots.logo}
|
|
22
26
|
<div class="strand-nav__logo">
|
|
@@ -72,4 +72,9 @@ describe('Nav', () => {
|
|
|
72
72
|
const { container } = render(Nav, { props: { items: testItems } })
|
|
73
73
|
expect(container.querySelector('.strand-nav__inner')).toBeInTheDocument()
|
|
74
74
|
})
|
|
75
|
+
|
|
76
|
+
it('applies glass class', () => {
|
|
77
|
+
const { container } = render(Nav, { props: { items: testItems, glass: true } })
|
|
78
|
+
expect(container.querySelector('.strand-nav')).toHaveClass('strand-nav--glass')
|
|
79
|
+
})
|
|
75
80
|
})
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
<!--! Strand Svelte | MIT License | dillingerstaffing.com -->
|
|
2
2
|
<script lang="ts">
|
|
3
3
|
/** Padding variant */
|
|
4
|
-
export let variant: 'standard' | 'hero' = 'standard'
|
|
4
|
+
export let variant: 'standard' | 'hero' | 'compact' = 'standard'
|
|
5
5
|
/** Surface background */
|
|
6
6
|
export let background: 'primary' | 'elevated' | 'recessed' = 'primary'
|
|
7
|
+
/** Top border separator */
|
|
8
|
+
export let borderTop: boolean = false
|
|
7
9
|
|
|
8
10
|
$: classes = [
|
|
9
11
|
'strand-section',
|
|
10
12
|
`strand-section--${variant}`,
|
|
11
13
|
`strand-section--bg-${background}`,
|
|
14
|
+
borderTop && 'strand-section--border-top',
|
|
12
15
|
].filter(Boolean).join(' ')
|
|
13
16
|
</script>
|
|
14
17
|
|
|
@@ -18,6 +18,16 @@ describe('Section', () => {
|
|
|
18
18
|
expect(container.querySelector('.strand-section')).toHaveClass('strand-section--hero')
|
|
19
19
|
})
|
|
20
20
|
|
|
21
|
+
it('applies compact variant class', () => {
|
|
22
|
+
const { container } = render(Section, { props: { variant: 'compact' } })
|
|
23
|
+
expect(container.querySelector('.strand-section')).toHaveClass('strand-section--compact')
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('applies border-top class', () => {
|
|
27
|
+
const { container } = render(Section, { props: { borderTop: true } })
|
|
28
|
+
expect(container.querySelector('.strand-section')).toHaveClass('strand-section--border-top')
|
|
29
|
+
})
|
|
30
|
+
|
|
21
31
|
it('applies background classes', () => {
|
|
22
32
|
const backgrounds = ['primary', 'elevated', 'recessed'] as const
|
|
23
33
|
for (const background of backgrounds) {
|