@netlify/spark-ui 1.3.0 → 1.4.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.
@@ -0,0 +1,7 @@
1
+ export type BUTTON_VARIANTS = 'primary' | 'secondary' | 'outline' | 'ghost';
2
+ export interface CallToActionProps {
3
+ id?: string;
4
+ text: string;
5
+ href: string;
6
+ variant?: BUTTON_VARIANTS;
7
+ }
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.3.0",
4
+ "version": "1.4.1",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -1,12 +1,17 @@
1
1
  ---
2
+ import { BUTTON_VARIANTS } from '@utils/types';
2
3
  import '../styles/buttons.css';
3
4
 
4
5
  interface Props {
5
- variant?: 'primary' | 'secondary' | 'outline' | 'ghost';
6
+ id?: string;
7
+ class?: string;
8
+ target?: string;
9
+ variant?: BUTTON_VARIANTS;
6
10
  href?: string;
7
11
  }
8
12
 
9
13
  const {
14
+ id,
10
15
  class: className,
11
16
  variant = 'primary',
12
17
  href,
@@ -17,6 +22,13 @@ const {
17
22
  const Element = href ? 'a' : 'button';
18
23
  ---
19
24
 
20
- <Element class:list={['button', className]} data-button-variant={variant} {href} {target} {...rest}>
25
+ <Element
26
+ {id}
27
+ class:list={['button', className]}
28
+ data-button-variant={variant}
29
+ {href}
30
+ {target}
31
+ {...rest}
32
+ >
21
33
  <slot />
22
34
  </Element>
@@ -67,11 +67,11 @@ const Element = as;
67
67
  }
68
68
 
69
69
  .n-card-headline {
70
- --n-flow-space: var(--space-xs);
71
70
  font-size: var(--font-size-display-sm);
72
71
  font-family: var(--font-family-display);
73
72
  font-weight: var(--font-weight-bold);
74
73
  line-height: var(--line-height-heading);
74
+ color: var(--heading-text-color);
75
75
  }
76
76
 
77
77
  .n-card-paragraph {
@@ -0,0 +1,106 @@
1
+ ---
2
+ import { CallToActionProps } from '@utils/types';
3
+ import Button from './Button.astro';
4
+ import Eyebrow from './Eyebrow.astro';
5
+
6
+ interface Props {
7
+ id?: string;
8
+ eyebrow?: string;
9
+ heading?: string;
10
+ headingLevel?: '1' | '2' | '3' | '4';
11
+ headingMaxWidth?: string;
12
+ text?: string;
13
+ textMaxWidth?: string;
14
+ alignment?: 'start' | 'center';
15
+ supporting?: string;
16
+ ctas?: CallToActionProps[];
17
+ class?: string;
18
+ }
19
+
20
+ const {
21
+ id,
22
+ eyebrow,
23
+ heading,
24
+ headingLevel = 2,
25
+ headingMaxWidth,
26
+ text,
27
+ textMaxWidth,
28
+ alignment = 'start',
29
+ class: className,
30
+ ctas,
31
+ ...rest
32
+ } = Astro.props;
33
+
34
+ const Heading = `h${headingLevel}` as any;
35
+
36
+ const customStyles =
37
+ headingMaxWidth || textMaxWidth
38
+ ? {
39
+ ...(headingMaxWidth && { '--n-heading-block-heading-max-width': headingMaxWidth }),
40
+ ...(textMaxWidth && { '--n-heading-block-text-max-width': textMaxWidth }),
41
+ }
42
+ : null;
43
+ ---
44
+
45
+ <div
46
+ {id}
47
+ class:list={[
48
+ 'n-heading-block n-flow',
49
+ alignment === 'center' && 'n-heading-block-center',
50
+ className,
51
+ ]}
52
+ style={customStyles}
53
+ {...rest}
54
+ >
55
+ {eyebrow && <Eyebrow class="n-heading-block-eyebrow">{eyebrow}</Eyebrow>}
56
+ {heading && <Heading class="n-heading-block-heading h1">{heading}</Heading>}
57
+ {text && <p class="n-heading-block-text" set:html={text} />}
58
+ {
59
+ ctas && ctas.length > 0 && (
60
+ <div class="n-heading-block-ctas n-cluster">
61
+ {ctas?.map((cta: CallToActionProps) => (
62
+ <Button id={cta.id} href={cta.href} variant={cta.variant}>
63
+ {cta.text}
64
+ </Button>
65
+ ))}
66
+ </div>
67
+ )
68
+ }
69
+ </div>
70
+
71
+ <style>
72
+ .n-heading-block {
73
+ padding-block: var(--space-xl);
74
+ }
75
+
76
+ .n-heading-block-center {
77
+ --n-cluster-justify: center;
78
+ text-align: center;
79
+ margin-inline: auto;
80
+
81
+ > * {
82
+ margin-inline: auto;
83
+ }
84
+ }
85
+
86
+ .n-heading-block-heading {
87
+ inline-size: min(100%, var(--n-heading-block-heading-max-width, 50rem));
88
+ text-wrap: balance;
89
+ }
90
+
91
+ .n-heading-block-text {
92
+ inline-size: min(100%, var(--n-heading-block-text-max-width, 35rem));
93
+ text-wrap: pretty;
94
+ }
95
+
96
+ .n-heading-block-ctas {
97
+ --n-flow-space: var(--space-l);
98
+ --n-cluster-gap: var(--space-xs);
99
+ }
100
+
101
+ @media (max-width: 30rem) {
102
+ .n-heading-block-ctas > * {
103
+ inline-size: 100%;
104
+ }
105
+ }
106
+ </style>
@@ -1,16 +1,20 @@
1
1
  .button {
2
2
  appearance: none;
3
3
  cursor: pointer;
4
+ outline-offset: 0.25rem;
4
5
  position: relative;
5
6
  display: inline-flex;
6
7
  align-items: center;
8
+ justify-content: center;
7
9
  gap: var(--space-xs);
8
10
  padding: 0.625rem 1.0625rem;
9
11
  font-size: var(--font-size-text-md);
10
12
  font-family: var(--font-family-display);
11
13
  font-weight: var(--font-weight-bold);
12
- line-height: normal;
14
+ line-height: var(--line-height-none);
13
15
  text-decoration: none;
16
+ text-align: center;
17
+ text-wrap: balance;
14
18
  color: var(--button-text-color, var(--button-primary-text-color));
15
19
  background-color: var(--button-bg-color, var(--button-primary-bg-color));
16
20
  border: 2px solid var(--button-border-color, var(--button-primary-bg-color));
@@ -21,7 +25,7 @@
21
25
  /* Button icons */
22
26
  svg {
23
27
  flex: none;
24
- height: var(--button-icon-size, 1.2cap);
28
+ height: var(--button-icon-size, 1.4cap);
25
29
  width: auto;
26
30
  fill: currentColor;
27
31
  }
@@ -66,6 +66,7 @@ body {
66
66
  font-size: var(--font-size-text-lg);
67
67
  font-weight: var(--font-weight-normal);
68
68
  line-height: var(--line-height-text);
69
+ color: var(--body-text-color);
69
70
  }
70
71
 
71
72
  b,
@@ -81,8 +82,16 @@ em {
81
82
 
82
83
  /* Headings */
83
84
  h1,
84
- .h1 {
85
+ h2,
86
+ h3,
87
+ h4,
88
+ h5,
89
+ h6 {
85
90
  font-family: var(--font-family-display);
91
+ }
92
+
93
+ h1,
94
+ .h1 {
86
95
  font-size: var(--font-size-display-2xl);
87
96
  font-weight: var(--font-weight-extrabold);
88
97
  line-height: var(--line-height-heading);
@@ -90,7 +99,6 @@ h1,
90
99
 
91
100
  h2,
92
101
  .h2 {
93
- font-family: var(--font-family-display);
94
102
  font-size: var(--font-size-display-xl);
95
103
  font-weight: var(--font-weight-extrabold);
96
104
  line-height: var(--line-height-heading);
@@ -98,7 +106,6 @@ h2,
98
106
 
99
107
  h3,
100
108
  .h3 {
101
- font-family: var(--font-family-display);
102
109
  font-size: var(--font-size-display-lg);
103
110
  font-weight: var(--font-weight-bold);
104
111
  line-height: var(--line-height-heading);
@@ -106,7 +113,6 @@ h3,
106
113
 
107
114
  h4,
108
115
  .h4 {
109
- font-family: var(--font-family-display);
110
116
  font-size: var(--font-size-display-sm);
111
117
  font-weight: var(--font-weight-bold);
112
118
  line-height: var(--line-height-heading);
@@ -2,6 +2,8 @@
2
2
  --_gap-default: var(--space-m);
3
3
  display: flex;
4
4
  flex-wrap: wrap;
5
+ align-items: var(--n-cluster-align, center);
6
+ justify-content: var(--n-cluster-justify, flex-start);
5
7
  column-gap: var(--n-cluster-column-gap, var(--n-cluster-gap, var(--_gap-default)));
6
8
  row-gap: var(--n-cluster-row-gap, var(--n-cluster-gap, var(--_gap-default)));
7
9
  }
@@ -97,7 +97,7 @@
97
97
  --green-800: color(srgb 0.058823529411764705 0.2901960784313726 0.12941176470588237);
98
98
  --green-900: color(srgb 0.08235294117647059 0.16470588235294117 0.09803921568627451);
99
99
  --heading-text-color: var(--neutral-800);
100
- --line-height-heading: 1.25;
100
+ --line-height-heading: 1.1;
101
101
  --line-height-none: 1;
102
102
  --line-height-text: 1.5;
103
103
  --neutral-000: color(srgb 1 1 1);
@@ -0,0 +1,8 @@
1
+ export type BUTTON_VARIANTS = 'primary' | 'secondary' | 'outline' | 'ghost';
2
+
3
+ export interface CallToActionProps {
4
+ id?: string;
5
+ text: string;
6
+ href: string;
7
+ variant?: BUTTON_VARIANTS;
8
+ }