maverick-wave-astro 1.30.0 → 1.31.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.
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  // Questions and answers. The icon comes as a slot, rendered once and placed in
3
- // every row - the site decides whether it gets its own wrapper.
3
+ // every row - the site decides whether it gets its own wrapper. Each item is a
4
+ // <details>, so it opens without a script.
4
5
  import { answerParagraphs, type Question } from '../dist/faq.js';
5
6
 
6
7
  interface Props {
@@ -16,31 +17,20 @@ const icon = await Astro.slots.render('icon');
16
17
 
17
18
  <div class:list={['mw-accordion', className]}>
18
19
  {
19
- items.map((item, index) => {
20
- const open = firstOpen && index === 0;
21
- return (
22
- <div class="mw-accordion-item">
23
- <button
24
- type="button"
25
- class:list={['mw-accordion-header', open && 'mw-active']}
26
- aria-expanded={open ? 'true' : 'false'}
27
- aria-controls={`${idPrefix}${index}`}
28
- >
29
- <span>{item.question}</span>
30
- <Fragment set:html={icon} />
31
- </button>
32
- <div
33
- class:list={['mw-accordion-content', open && 'mw-active']}
34
- id={`${idPrefix}${index}`}
35
- >
36
- <div class="mw-accordion-content-inner">
37
- {answerParagraphs(item.answer).map(paragraph => (
38
- <p>{paragraph}</p>
39
- ))}
40
- </div>
20
+ items.map((item, index) => (
21
+ <details class="mw-accordion-item" open={firstOpen && index === 0}>
22
+ <summary class="mw-accordion-header">
23
+ <span>{item.question}</span>
24
+ <Fragment set:html={icon} />
25
+ </summary>
26
+ <div class="mw-accordion-content" id={`${idPrefix}${index}`}>
27
+ <div class="mw-accordion-content-inner">
28
+ {answerParagraphs(item.answer).map(paragraph => (
29
+ <p>{paragraph}</p>
30
+ ))}
41
31
  </div>
42
32
  </div>
43
- );
44
- })
33
+ </details>
34
+ ))
45
35
  }
46
36
  </div>
@@ -71,13 +71,13 @@ const button = classes.buttons ?? 'mw-btn-lg';
71
71
  <div class:list={['mw-home-text', classes.text]}>
72
72
  {
73
73
  badge && (
74
- <Badge class="mw-hero-badge">
75
- <span
76
- class:list={[
77
- 'mw-hero-badge-dot',
78
- badge.pulse && 'mw-badge-pulse',
79
- ]}
80
- />
74
+ <Badge
75
+ class:list={[
76
+ 'mw-hero-badge',
77
+ badge.pulse && 'mw-hero-badge-pulse',
78
+ ]}
79
+ >
80
+ <span class="mw-hero-badge-dot" />
81
81
  {badge.text}
82
82
  </Badge>
83
83
  )
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  // One key figure with its label, an optional change and a sparkline in the
3
3
  // `chart` slot. The value sizes itself to the room it gets. Several side by
4
- // side go into a StatGroup.
4
+ // side go into a StatGroup. With `facts` the figure leads and the facts sit
5
+ // small beside it - "where do I stand" reads in the same place on every page.
5
6
  interface Props {
6
7
  label: string;
7
8
  value: string | number;
@@ -14,33 +15,98 @@ interface Props {
14
15
  invert?: boolean;
15
16
  };
16
17
  note?: string;
18
+ facts?: readonly {
19
+ term: string;
20
+ value: string | number;
21
+ tone?: 'success' | 'warning' | 'danger' | 'info';
22
+ }[];
23
+ // The figure of a small box: label and value a step down.
24
+ size?: 'sm';
25
+ // A stripe and a tint in that tone - put a word next to it, a colour alone
26
+ // is no state anyone can tell apart.
27
+ edge?:
28
+ | 'primary'
29
+ | 'secondary'
30
+ | 'success'
31
+ | 'warning'
32
+ | 'danger'
33
+ | 'info'
34
+ | 'muted';
17
35
  class?: string;
18
36
  }
19
37
 
20
- const { label, value, unit, delta, note, class: className } = Astro.props;
38
+ const {
39
+ label,
40
+ value,
41
+ unit,
42
+ delta,
43
+ note,
44
+ facts,
45
+ size,
46
+ edge,
47
+ class: className,
48
+ } = Astro.props;
49
+ const Head = facts ? 'div' : Fragment;
21
50
  ---
22
51
 
23
- <div class:list={['mw-stat', className]}>
24
- <span class="mw-stat-label">{label}</span>
25
- <span class="mw-stat-value"
26
- >{value}{unit && <span class="mw-stat-unit">{unit}</span>}</span
27
- >
52
+ <div
53
+ class:list={[
54
+ 'mw-stat',
55
+ facts && 'mw-stat-lead',
56
+ size && `mw-stat-${size}`,
57
+ edge && `mw-edge-${edge}`,
58
+ className,
59
+ ]}
60
+ >
61
+ <Head {...facts ? { class: 'mw-stat-head' } : {}}>
62
+ {
63
+ facts && (
64
+ <span class="mw-stat-value">
65
+ {value}
66
+ {unit && <span class="mw-stat-unit">{unit}</span>}
67
+ </span>
68
+ )
69
+ }
70
+ <span class="mw-stat-label">{label}</span>
71
+ {
72
+ !facts && (
73
+ <span class="mw-stat-value">
74
+ {value}
75
+ {unit && <span class="mw-stat-unit">{unit}</span>}
76
+ </span>
77
+ )
78
+ }
79
+ {
80
+ (delta || note) && (
81
+ <div class="mw-stat-footer">
82
+ {delta && (
83
+ <span
84
+ class:list={[
85
+ 'mw-stat-delta',
86
+ `mw-stat-delta-${delta.direction}`,
87
+ delta.invert && 'mw-stat-delta-invert',
88
+ ]}
89
+ >
90
+ {delta.text}
91
+ </span>
92
+ )}
93
+ {note && <span class="mw-stat-note">{note}</span>}
94
+ </div>
95
+ )
96
+ }
97
+ </Head>
28
98
  {
29
- (delta || note) && (
30
- <div class="mw-stat-footer">
31
- {delta && (
32
- <span
33
- class:list={[
34
- 'mw-stat-delta',
35
- `mw-stat-delta-${delta.direction}`,
36
- delta.invert && 'mw-stat-delta-invert',
37
- ]}
38
- >
39
- {delta.text}
40
- </span>
41
- )}
42
- {note && <span class="mw-stat-note">{note}</span>}
43
- </div>
99
+ facts && (
100
+ <dl class="mw-stat-facts">
101
+ {facts.map(fact => (
102
+ <div>
103
+ <dt>{fact.term}</dt>
104
+ <dd class:list={[fact.tone && `mw-text-${fact.tone}`]}>
105
+ {fact.value}
106
+ </dd>
107
+ </div>
108
+ ))}
109
+ </dl>
44
110
  )
45
111
  }
46
112
  {
@@ -1,13 +1,15 @@
1
1
  ---
2
2
  // Stats in a row with a rule between them once the group is 30rem wide,
3
- // stacked below that.
3
+ // stacked below that. "strip" puts them in one bordered box with a hairline
4
+ // between every two - the strip under a page title.
4
5
  interface Props {
6
+ strip?: boolean;
5
7
  class?: string;
6
8
  }
7
9
 
8
- const { class: className } = Astro.props;
10
+ const { strip = false, class: className } = Astro.props;
9
11
  ---
10
12
 
11
- <div class:list={['mw-stat-group', className]}>
13
+ <div class:list={[strip ? 'mw-stat-strip' : 'mw-stat-group', className]}>
12
14
  <slot />
13
15
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maverick-wave-astro",
3
- "version": "1.30.0",
3
+ "version": "1.31.0",
4
4
  "description": "Shared frame for static Astro homepages built with MaverickWave: layout, SEO, design variants, schedule, building blocks.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "peerDependencies": {
55
55
  "astro": "^7.2.0",
56
- "maverick-wave": "^6.16.0",
56
+ "maverick-wave": "^6.17.0",
57
57
  "vite": "^8.0.0"
58
58
  },
59
59
  "dependencies": {
@@ -69,7 +69,7 @@
69
69
  "eslint-plugin-astro": "^1.5.0",
70
70
  "eslint-plugin-simple-import-sort": "^12.1.1",
71
71
  "globals": "^16.5.0",
72
- "maverick-wave": "^6.16.0",
72
+ "maverick-wave": "^6.17.0",
73
73
  "playwright-core": "^1.64.0",
74
74
  "prettier": "^3.6.2",
75
75
  "prettier-plugin-astro": "^0.14.1",