@netlify/spark-ui 1.13.1 → 1.13.3

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.
@@ -1 +1 @@
1
- .n-popover-container{position:relative;display:inline-block;font-size:var(--font-size-text-xs)}.n-popover-trigger{background-color:transparent;border:none;padding:0;font:inherit;color:var(--color-text-weak);cursor:pointer}.n-popover{position:absolute;background-color:var(--color-bg-2);color:var(--color-text);padding:var(--space-xs) var(--space-s);border-radius:var(--radius-s);opacity:0;pointer-events:none;transition:opacity .2s ease-in-out;z-index:10}.n-popover:after{content:"";position:absolute;border-style:solid}.n-popover-container:focus-within .n-popover,.n-popover-container:hover .n-popover{opacity:1;pointer-events:auto}.n-popover-container:focus-within .n-popover-trigger,.n-popover-container:hover .n-popover-trigger{box-shadow:0 1px 0 0 var(--neutral-300);border-radius:0}.n-popover-top .n-popover{bottom:145%;left:50%;transform:translate(-50%);width:260px;box-shadow:var(--shadow-light)}.n-popover-top .n-popover:after{top:100%;left:50%;margin-left:-5px;border-width:5px;border-color:var(--color-bg-2) transparent transparent transparent}.n-popover-bottom .n-popover{top:145%;left:50%;transform:translate(-50%)}.n-popover-bottom .n-popover:after{bottom:100%;left:50%;margin-left:-5px;border-width:5px;border-color:transparent transparent var(--color-bg-2) transparent}.n-popover-left .n-popover{right:125%;top:50%;transform:translateY(-50%)}.n-popover-left .n-popover:after{top:50%;left:100%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent var(--color-bg-2)}.n-popover-right .n-popover{left:125%;top:50%;transform:translateY(-50%)}.n-popover-right .n-popover:after{top:50%;right:100%;margin-top:-5px;border-width:5px;border-color:transparent var(--color-bg-2) transparent transparent}
1
+ .n-popover-container{position:relative;display:inline-block;font-size:var(--font-size-text-xs)}.n-popover-trigger{background-color:transparent;border:none;padding:0;font:inherit;color:var(--color-text-weak);cursor:pointer}.n-popover{position:absolute;background-color:var(--color-bg-2);color:var(--color-text);padding:var(--space-xs) var(--space-s);border-radius:var(--radius-s);opacity:0;pointer-events:none;transition:opacity .2s ease-in-out;z-index:10}.n-popover:after{content:"";position:absolute;border-style:solid}.n-popover-container:focus-within .n-popover,.n-popover-container:hover .n-popover{opacity:1;pointer-events:auto}.n-popover-container:focus-within .n-popover-trigger,.n-popover-container:hover .n-popover-trigger{box-shadow:0 1px 0 0 var(--neutral-300);border-radius:0}.n-popover-top .n-popover{bottom:145%;left:50%;transform:translate(-50%);width:255px;box-shadow:var(--shadow-light)}.n-popover-top .n-popover:after{top:100%;left:50%;margin-left:-5px;border-width:5px;border-color:var(--color-bg-2) transparent transparent transparent}.n-popover-bottom .n-popover{top:145%;left:50%;transform:translate(-50%)}.n-popover-bottom .n-popover:after{bottom:100%;left:50%;margin-left:-5px;border-width:5px;border-color:transparent transparent var(--color-bg-2) transparent}.n-popover-left .n-popover{right:125%;top:50%;transform:translateY(-50%)}.n-popover-left .n-popover:after{top:50%;left:100%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent var(--color-bg-2)}.n-popover-right .n-popover{left:125%;top:50%;transform:translateY(-50%)}.n-popover-right .n-popover:after{top:50%;right:100%;margin-top:-5px;border-width:5px;border-color:transparent var(--color-bg-2) transparent transparent}
@@ -1 +1,2 @@
1
1
  export { pluralize } from './pluralize';
2
+ export { kebabCase } from './kebab';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/spark-ui",
3
3
  "description": "Assets, design tokens, components, and utilities",
4
- "version": "1.13.1",
4
+ "version": "1.13.3",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -0,0 +1,42 @@
1
+ <div class="n-action-arrow">
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none" viewBox="0 0 14 14">
3
+ <g stroke="currentColor" stroke-linecap="square" stroke-width="1.564" clip-path="url(#a)">
4
+ <path stroke-linejoin="round" d="M3.417 10.556 9.4 4.572"></path>
5
+ <path d="M9.88 9.381V4.093H4.59"></path>
6
+ </g>
7
+ </svg>
8
+ </div>
9
+
10
+ <style>
11
+ .n-action-arrow {
12
+ display: inline-flex;
13
+ overflow: hidden;
14
+
15
+ svg {
16
+ color: var(--color-icon);
17
+ transition: translate 0.1s ease-out;
18
+ }
19
+ }
20
+
21
+ @media (any-hover: hover) {
22
+ :global(
23
+ :is(.n-card-clickable, .n-action-link):where(:hover, :focus-visible) .n-action-arrow svg
24
+ ) {
25
+ --_offset: 100%;
26
+ animation: n-action-link-hover 350ms cubic-bezier(0.85, 0, 0.15, 1) forwards;
27
+ }
28
+
29
+ @keyframes n-action-link-hover {
30
+ 0%,
31
+ 100% {
32
+ translate: 0 0;
33
+ }
34
+ 30% {
35
+ translate: calc(var(--_offset) * 2) calc(var(--_offset) * -2);
36
+ }
37
+ 31% {
38
+ translate: calc(var(--_offset) * -1) var(--_offset);
39
+ }
40
+ }
41
+ }
42
+ </style>
@@ -1,4 +1,6 @@
1
1
  ---
2
+ import ActionArrow from './ActionArrow.astro';
3
+
2
4
  interface Props {
3
5
  id?: string;
4
6
  href: string;
@@ -10,19 +12,14 @@ const { id, href, text, class: className, ...rest } = Astro.props;
10
12
  ---
11
13
 
12
14
  <a id={id} class:list={['n-action-link', className]} href={href} {...rest}>
13
- <span>{text ? text : <slot />}</span><div class="n-action-link-icon">
14
- <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none" viewBox="0 0 14 14">
15
- <g stroke="currentColor" stroke-linecap="square" stroke-width="1.564" clip-path="url(#a)">
16
- <path stroke-linejoin="round" d="M3.417 10.556 9.4 4.572"></path>
17
- <path d="M9.88 9.381V4.093H4.59"></path>
18
- </g>
19
- </svg>
20
- </div>
15
+ <span>{text ? text : <slot />}</span><ActionArrow />
21
16
  </a>
22
17
 
23
18
  <style>
24
19
  .n-action-link {
25
- display: inline-block;
20
+ display: inline-flex;
21
+ gap: var(--space-3xs);
22
+ align-items: center;
26
23
  font-weight: var(--font-weight-medium);
27
24
  font-size: var(--font-size-text-md);
28
25
  text-wrap: pretty; /** Prevents orphan icon */
@@ -35,35 +32,4 @@ const { id, href, text, class: className, ...rest } = Astro.props;
35
32
  text-underline-offset: 0.1em;
36
33
  }
37
34
  }
38
-
39
- .n-action-link-icon {
40
- display: inline-flex;
41
- overflow: hidden;
42
- margin-inline-start: 0.1em;
43
-
44
- svg {
45
- color: var(--color-icon);
46
- transition: translate 0.1s ease-out;
47
- }
48
- }
49
-
50
- @media (any-hover: hover) {
51
- .n-action-link:where(:hover, :focus-visible) .n-action-link-icon svg {
52
- --_offset: 100%;
53
- animation: n-action-link-hover 350ms cubic-bezier(0.85, 0, 0.15, 1) forwards;
54
- }
55
-
56
- @keyframes n-action-link-hover {
57
- 0%,
58
- 100% {
59
- translate: 0 0;
60
- }
61
- 30% {
62
- translate: calc(var(--_offset) * 2) calc(var(--_offset) * -2);
63
- }
64
- 31% {
65
- translate: calc(var(--_offset) * -1) var(--_offset);
66
- }
67
- }
68
- }
69
35
  </style>
@@ -1,4 +1,5 @@
1
1
  ---
2
+ import ActionArrow from './ActionArrow.astro';
2
3
  import ActionLink from './ActionLink.astro';
3
4
  import Eyebrow from './Eyebrow.astro';
4
5
 
@@ -25,9 +26,19 @@ const {
25
26
  class: className,
26
27
  ...rest
27
28
  } = Astro.props;
29
+
30
+ const isAnchorHeadline = isCardClickable && headline && !link?.text && link?.href;
28
31
  ---
29
32
 
30
- <Element class:list={['n-card n-flow', isCardClickable && 'n-card-clickable', className]} {...rest}>
33
+ <Element
34
+ class:list={[
35
+ 'n-card n-flow',
36
+ isCardClickable && 'n-card-clickable',
37
+ isAnchorHeadline && 'n-card-anchor-heaadline',
38
+ className,
39
+ ]}
40
+ {...rest}
41
+ >
31
42
  {
32
43
  Astro.slots.has('icon') && (
33
44
  <div class="n-card-icon">
@@ -43,16 +54,25 @@ const {
43
54
  )
44
55
  }
45
56
  {eyebrow && <Eyebrow class="n-card-eyebrow">{eyebrow}</Eyebrow>}
46
- {headline && <div class="n-card-headline" set:html={headline} />}
57
+ {
58
+ isAnchorHeadline ? (
59
+ <a class="n-card-link n-card-link-headline" href={link?.href} id={link.id}>
60
+ <div class="n-card-headline" set:html={headline} />
61
+ </a>
62
+ ) : (
63
+ <div class="n-card-headline" set:html={headline} />
64
+ )
65
+ }
47
66
  {paragraph && <div class="n-card-paragraph" set:html={paragraph} />}
48
67
  <slot />
49
68
  {
50
- link && (
69
+ link && link.text && (
51
70
  <ActionLink class="n-card-link" id={link.id} href={link.href}>
52
71
  {link.text}
53
72
  </ActionLink>
54
73
  )
55
74
  }
75
+ {isAnchorHeadline && <ActionArrow />}
56
76
  </Element>
57
77
 
58
78
  <style>
@@ -72,6 +92,10 @@ const {
72
92
  --n-flow-space: var(--space-s);
73
93
  }
74
94
 
95
+ .n-card-link:has(> .n-card-headline) {
96
+ text-decoration: none;
97
+ }
98
+
75
99
  .n-card-headline {
76
100
  font-size: var(--font-size-display-sm);
77
101
  font-family: var(--font-family-display);
@@ -80,6 +104,29 @@ const {
80
104
  color: var(--heading-text-color);
81
105
  }
82
106
 
107
+ .n-card-headline:has(+ .n-action-link) {
108
+ margin-block-end: auto;
109
+ }
110
+
111
+ .n-card-link-headline {
112
+ display: flex;
113
+ align-items: center;
114
+ justify-content: space-between;
115
+ gap: var(--space-s);
116
+ width: 100%;
117
+ }
118
+
119
+ .n-card-link-headline .n-card-headline {
120
+ flex: 1 1 auto;
121
+ min-width: 0;
122
+ }
123
+
124
+ .n-card :global(.n-action-arrow) {
125
+ flex: 0 0 auto;
126
+ align-self: center;
127
+ margin-inline-start: auto;
128
+ }
129
+
83
130
  .n-card-paragraph {
84
131
  line-height: var(--line-height-text);
85
132
  }
@@ -119,4 +166,14 @@ const {
119
166
  inset: 0;
120
167
  }
121
168
  }
169
+
170
+ /* Focus for Anchor Headline */
171
+ .n-card-anchor-heaadline:focus-within {
172
+ box-shadow: 0 0 0 3px var(--color-focus-ring, Highlight);
173
+ border-radius: var(--radius-s, 0.25rem);
174
+ }
175
+
176
+ .n-card-anchor-heaadline a:focus {
177
+ outline: none;
178
+ }
122
179
  </style>
@@ -47,7 +47,7 @@
47
47
  bottom: 145%;
48
48
  left: 50%;
49
49
  transform: translateX(-50%);
50
- width: 260px;
50
+ width: 255px;
51
51
  box-shadow: var(--shadow-light);
52
52
  }
53
53
 
@@ -1 +1,2 @@
1
1
  export { pluralize } from './pluralize';
2
+ export { kebabCase } from './kebab';