@onsvisual/svelte-components 0.1.49 → 0.1.50

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.
@@ -10,6 +10,8 @@ export default class Titleblock extends SvelteComponentTyped<{
10
10
  title?: string;
11
11
  natStatBadge?: boolean;
12
12
  censusLogo?: boolean;
13
+ titleBadge?: string;
14
+ titleBadgeAriaLabel?: string;
13
15
  }, {
14
16
  [evt: string]: CustomEvent<any>;
15
17
  }, {
@@ -33,6 +35,8 @@ declare const __propDef: {
33
35
  title?: string;
34
36
  natStatBadge?: boolean;
35
37
  censusLogo?: boolean;
38
+ titleBadge?: string;
39
+ titleBadgeAriaLabel?: string;
36
40
  };
37
41
  events: {
38
42
  [evt: string]: CustomEvent<any>;
@@ -42,6 +42,16 @@
42
42
  * @type {boolean}
43
43
  */
44
44
  export let allowClientOverrides = false;
45
+ /**
46
+ * Optional badge to show next to the title
47
+ * @type {string}
48
+ */
49
+ export let titleBadge = null;
50
+ /**
51
+ * Aria-label for the optional badge to show next to the title
52
+ * @type {string}
53
+ */
54
+ export let titleBadgeAriaLabel = null;
45
55
  </script>
46
56
 
47
57
  <Container
@@ -54,9 +64,18 @@
54
64
  <slot name="before" />
55
65
  <div class="ons-grid">
56
66
  <div class="ons-grid__col ons-col-10@m">
57
- <h1 class="ons-u-fs-xxxl ons-u-mt-s ons-u-mb-m ons-u-pb-no ons-u-pt-no">
58
- {@html title}
59
- </h1>
67
+ <div class="title-container">
68
+ <h1 class="ons-u-fs-xxxl ons-u-mt-s ons-u-mb-m ons-u-pb-no ons-u-pt-no">
69
+ {#if titleBadge}
70
+ <span style="margin-right: 6px">{@html title}</span>
71
+ <span class="title-badge" aria-label="{titleBadgeAriaLabel ?? titleBadge}"
72
+ >{titleBadge}</span
73
+ >
74
+ {:else}
75
+ {@html title}
76
+ {/if}
77
+ </h1>
78
+ </div>
60
79
  </div>
61
80
  {#if natStatBadge}
62
81
  <div class="ons-grid__col ons-col-2@m">
@@ -87,7 +106,6 @@
87
106
  title="Census 2021"
88
107
  alt="Census 2021"
89
108
  class="header__svg-logo margin-right--1"
90
- focusable="false"
91
109
  width="167"
92
110
  height="32"
93
111
  />
@@ -105,4 +123,15 @@
105
123
  } */
106
124
  .ons-grid__col {
107
125
  vertical-align: bottom;
126
+ }
127
+
128
+ .title-badge {
129
+ vertical-align: 6px;
130
+ white-space: nowrap;
131
+ font-size: 40%;
132
+ font-weight: bold;
133
+ color: white;
134
+ background-color: #003c57;
135
+ padding: 2px 8px 4px 8px;
136
+ border-radius: 4px;
108
137
  }</style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onsvisual/svelte-components",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://onsvisual.github.io/svelte-components",
@@ -144,7 +144,7 @@
144
144
  "./layout/Accordion/Accordion.svelte": "./dist/layout/Accordion/Accordion.svelte",
145
145
  "./layout/Accordion/AccordionItem.svelte": "./dist/layout/Accordion/AccordionItem.svelte",
146
146
  "./layout/AnalyticsBanner/AnalyticsBanner.svelte": "./dist/layout/AnalyticsBanner/AnalyticsBanner.svelte",
147
- "./layout/Backlink/Backlink.svelte": "./dist/layout/Backlink/Backlink.svelte",
147
+ "./layout/BackLink/Backlink.svelte": "./dist/layout/BackLink/Backlink.svelte",
148
148
  "./layout/Breadcrumb/Breadcrumb.svelte": "./dist/layout/Breadcrumb/Breadcrumb.svelte",
149
149
  "./layout/Cards/Card.svelte": "./dist/layout/Cards/Card.svelte",
150
150
  "./layout/Cards/Cards.svelte": "./dist/layout/Cards/Cards.svelte",
@@ -172,8 +172,8 @@
172
172
  "./layout/Survey/init-survey": "./dist/layout/Survey/init-survey.js",
173
173
  "./layout/Tabs/Tab.svelte": "./dist/layout/Tabs/Tab.svelte",
174
174
  "./layout/Tabs/Tabs.svelte": "./dist/layout/Tabs/Tabs.svelte",
175
- "./layout/Titleblock/Meta.svelte": "./dist/layout/Titleblock/Meta.svelte",
176
- "./layout/Titleblock/Titleblock.svelte": "./dist/layout/Titleblock/Titleblock.svelte",
175
+ "./layout/TitleBlock/Meta.svelte": "./dist/layout/TitleBlock/Meta.svelte",
176
+ "./layout/TitleBlock/TitleBlock.svelte": "./dist/layout/TitleBlock/TitleBlock.svelte",
177
177
  "./layout/Twisty/Twisty.svelte": "./dist/layout/Twisty/Twisty.svelte",
178
178
  "./wrappers/Container/Container.svelte": "./dist/wrappers/Container/Container.svelte",
179
179
  "./wrappers/Embed/Embed.svelte": "./dist/wrappers/Embed/Embed.svelte",