@dta-au/civictheme-twig 1.13.4 → 1.13.5

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,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M6.75 8.25V6.75a5.25 5.25 0 0 1 10.5 0v1.5h.75a2.25 2.25 0 0 1 2.25 2.25v8.25A2.25 2.25 0 0 1 18 21H6a2.25 2.25 0 0 1-2.25-2.25V10.5A2.25 2.25 0 0 1 6 8.25h.75Zm2 0h6.5V6.75a3.25 3.25 0 0 0-6.5 0v1.5ZM12 13a1.5 1.5 0 0 0-.75 2.8v1.45a.75.75 0 0 0 1.5 0V15.8A1.5 1.5 0 0 0 12 13Z"/>
3
+ </svg>
@@ -0,0 +1,444 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Link List Card applies theme class 1`] = `
4
+ <div>
5
+
6
+
7
+
8
+
9
+
10
+ <div
11
+ class="ct-link-list-card ct-theme-dark ct-link-list-card--default"
12
+ data-component-name="ct-link-list-card"
13
+ >
14
+
15
+
16
+
17
+ <a
18
+ class="ct-link-list-card__link"
19
+ href="https://example.com"
20
+ >
21
+
22
+
23
+ <span
24
+ class="ct-link-list-card__title"
25
+ >
26
+ Link
27
+ </span>
28
+
29
+
30
+
31
+
32
+
33
+
34
+ <span
35
+ aria-hidden="true"
36
+ class="ct-link-list-card__icon"
37
+ >
38
+
39
+
40
+ <svg
41
+ aria-hidden="true"
42
+ class="ct-icon ct-icon--size-small"
43
+ height="24"
44
+ role="img"
45
+ viewBox="0 0 24 24"
46
+ width="24"
47
+ xmlns="http://www.w3.org/2000/svg"
48
+ >
49
+
50
+
51
+ <path
52
+ d="M17.92 11.62C17.8724 11.4973 17.801 11.3851 17.71 11.29L12.71 6.29C12.6168 6.19676 12.5061 6.1228 12.3842 6.07234C12.2624 6.02188 12.1319 5.99591 12 5.99591C11.7337 5.99591 11.4783 6.1017 11.29 6.29C11.1968 6.38324 11.1228 6.49393 11.0723 6.61575C11.0219 6.73758 10.9959 6.86814 10.9959 7C10.9959 7.2663 11.1017 7.5217 11.29 7.71L14.59 11H7C6.73478 11 6.48043 11.1054 6.29289 11.2929C6.10536 11.4804 6 11.7348 6 12C6 12.2652 6.10536 12.5196 6.29289 12.7071C6.48043 12.8946 6.73478 13 7 13H14.59L11.29 16.29C11.1963 16.383 11.1219 16.4936 11.0711 16.6154C11.0203 16.7373 10.9942 16.868 10.9942 17C10.9942 17.132 11.0203 17.2627 11.0711 17.3846C11.1219 17.5064 11.1963 17.617 11.29 17.71C11.383 17.8037 11.4936 17.8781 11.6154 17.9289C11.7373 17.9797 11.868 18.0058 12 18.0058C12.132 18.0058 12.2627 17.9797 12.3846 17.9289C12.5064 17.8781 12.617 17.8037 12.71 17.71L17.71 12.71C17.801 12.6149 17.8724 12.5028 17.92 12.38C18.02 12.1365 18.02 11.8635 17.92 11.62Z"
53
+ />
54
+
55
+
56
+ </svg>
57
+
58
+
59
+ </span>
60
+
61
+
62
+ </a>
63
+
64
+
65
+ </div>
66
+
67
+
68
+ </div>
69
+ `;
70
+
71
+ exports[`Link List Card authenticated variant adds its modifier class 1`] = `
72
+ <div>
73
+
74
+
75
+
76
+
77
+
78
+ <div
79
+ class="ct-link-list-card ct-theme-light ct-link-list-card--authenticated"
80
+ data-component-name="ct-link-list-card"
81
+ >
82
+
83
+
84
+
85
+ <a
86
+ class="ct-link-list-card__link"
87
+ href="https://example.com/secure"
88
+ >
89
+
90
+
91
+ <span
92
+ class="ct-link-list-card__title"
93
+ >
94
+ Secure document
95
+ </span>
96
+
97
+
98
+
99
+
100
+
101
+
102
+ <span
103
+ aria-hidden="true"
104
+ class="ct-link-list-card__icon"
105
+ >
106
+
107
+
108
+ <svg
109
+ aria-hidden="true"
110
+ class="ct-icon ct-icon--size-small"
111
+ height="24"
112
+ role="img"
113
+ viewBox="0 0 24 24"
114
+ width="24"
115
+ xmlns="http://www.w3.org/2000/svg"
116
+ >
117
+
118
+
119
+ <path
120
+ clip-rule="evenodd"
121
+ d="M6.75 8.25V6.75a5.25 5.25 0 0 1 10.5 0v1.5h.75a2.25 2.25 0 0 1 2.25 2.25v8.25A2.25 2.25 0 0 1 18 21H6a2.25 2.25 0 0 1-2.25-2.25V10.5A2.25 2.25 0 0 1 6 8.25h.75Zm2 0h6.5V6.75a3.25 3.25 0 0 0-6.5 0v1.5ZM12 13a1.5 1.5 0 0 0-.75 2.8v1.45a.75.75 0 0 0 1.5 0V15.8A1.5 1.5 0 0 0 12 13Z"
122
+ fill-rule="evenodd"
123
+ />
124
+
125
+
126
+ </svg>
127
+
128
+
129
+ </span>
130
+
131
+
132
+ </a>
133
+
134
+
135
+ </div>
136
+
137
+
138
+ </div>
139
+ `;
140
+
141
+ exports[`Link List Card deactivated card is non-interactive with no href 1`] = `
142
+ <div>
143
+
144
+
145
+
146
+
147
+
148
+ <div
149
+ class="ct-link-list-card ct-theme-light ct-link-list-card--authenticated ct-link-list-card--deactivated"
150
+ data-component-name="ct-link-list-card"
151
+ >
152
+
153
+
154
+
155
+ <a
156
+ aria-disabled="true"
157
+ class="ct-link-list-card__link"
158
+ tabindex="-1"
159
+ >
160
+
161
+
162
+ <span
163
+ class="ct-link-list-card__title"
164
+ >
165
+ Locked resource
166
+ </span>
167
+
168
+
169
+
170
+
171
+
172
+
173
+ <span
174
+ aria-hidden="true"
175
+ class="ct-link-list-card__icon"
176
+ >
177
+
178
+
179
+ <svg
180
+ aria-hidden="true"
181
+ class="ct-icon ct-icon--size-small"
182
+ height="24"
183
+ role="img"
184
+ viewBox="0 0 24 24"
185
+ width="24"
186
+ xmlns="http://www.w3.org/2000/svg"
187
+ >
188
+
189
+
190
+ <path
191
+ clip-rule="evenodd"
192
+ d="M6.75 8.25V6.75a5.25 5.25 0 0 1 10.5 0v1.5h.75a2.25 2.25 0 0 1 2.25 2.25v8.25A2.25 2.25 0 0 1 18 21H6a2.25 2.25 0 0 1-2.25-2.25V10.5A2.25 2.25 0 0 1 6 8.25h.75Zm2 0h6.5V6.75a3.25 3.25 0 0 0-6.5 0v1.5ZM12 13a1.5 1.5 0 0 0-.75 2.8v1.45a.75.75 0 0 0 1.5 0V15.8A1.5 1.5 0 0 0 12 13Z"
193
+ fill-rule="evenodd"
194
+ />
195
+
196
+
197
+ </svg>
198
+
199
+
200
+ </span>
201
+
202
+
203
+ </a>
204
+
205
+
206
+ </div>
207
+
208
+
209
+ </div>
210
+ `;
211
+
212
+ exports[`Link List Card external link opens in a new window with rel and hidden notice 1`] = `
213
+ <div>
214
+
215
+
216
+
217
+
218
+
219
+ <div
220
+ class="ct-link-list-card ct-theme-light ct-link-list-card--default"
221
+ data-component-name="ct-link-list-card"
222
+ >
223
+
224
+
225
+
226
+ <a
227
+ class="ct-link-list-card__link"
228
+ href="https://x.org"
229
+ rel="noopener noreferrer"
230
+ target="_blank"
231
+ >
232
+
233
+
234
+ <span
235
+ class="ct-link-list-card__title"
236
+ >
237
+ External
238
+ </span>
239
+
240
+
241
+
242
+
243
+ <span
244
+ class="ct-visually-hidden"
245
+ >
246
+ (opens in a new tab)
247
+ </span>
248
+
249
+
250
+
251
+
252
+ <span
253
+ aria-hidden="true"
254
+ class="ct-link-list-card__icon"
255
+ >
256
+
257
+
258
+ <svg
259
+ aria-hidden="true"
260
+ class="ct-icon ct-icon--size-small"
261
+ height="24"
262
+ role="img"
263
+ viewBox="0 0 24 24"
264
+ width="24"
265
+ xmlns="http://www.w3.org/2000/svg"
266
+ >
267
+
268
+
269
+ <path
270
+ d="M17.9199 6.62C17.8185 6.37565 17.6243 6.18147 17.3799 6.08C17.2597 6.02876 17.1306 6.00158 16.9999 6H6.99994C6.73472 6 6.48037 6.10536 6.29283 6.29289C6.1053 6.48043 5.99994 6.73478 5.99994 7C5.99994 7.26522 6.1053 7.51957 6.29283 7.70711C6.48037 7.89464 6.73472 8 6.99994 8H14.5899L6.28994 16.29C6.19621 16.383 6.12182 16.4936 6.07105 16.6154C6.02028 16.7373 5.99414 16.868 5.99414 17C5.99414 17.132 6.02028 17.2627 6.07105 17.3846C6.12182 17.5064 6.19621 17.617 6.28994 17.71C6.3829 17.8037 6.4935 17.8781 6.61536 17.9289C6.73722 17.9797 6.86793 18.0058 6.99994 18.0058C7.13195 18.0058 7.26266 17.9797 7.38452 17.9289C7.50638 17.8781 7.61698 17.8037 7.70994 17.71L15.9999 9.41V17C15.9999 17.2652 16.1053 17.5196 16.2928 17.7071C16.4804 17.8946 16.7347 18 16.9999 18C17.2652 18 17.5195 17.8946 17.707 17.7071C17.8946 17.5196 17.9999 17.2652 17.9999 17V7C17.9984 6.86932 17.9712 6.74022 17.9199 6.62Z"
271
+ />
272
+
273
+
274
+ </svg>
275
+
276
+
277
+ </span>
278
+
279
+
280
+ </a>
281
+
282
+
283
+ </div>
284
+
285
+
286
+ </div>
287
+ `;
288
+
289
+ exports[`Link List Card renders a single link card 1`] = `
290
+ <div>
291
+
292
+
293
+
294
+
295
+
296
+ <div
297
+ class="ct-link-list-card ct-theme-light ct-link-list-card--default"
298
+ data-component-name="ct-link-list-card"
299
+ >
300
+
301
+
302
+
303
+ <a
304
+ class="ct-link-list-card__link"
305
+ href="https://example.com/apply"
306
+ >
307
+
308
+
309
+ <span
310
+ class="ct-link-list-card__title"
311
+ >
312
+ Apply for a grant
313
+ </span>
314
+
315
+
316
+
317
+
318
+
319
+
320
+ <span
321
+ aria-hidden="true"
322
+ class="ct-link-list-card__icon"
323
+ >
324
+
325
+
326
+ <svg
327
+ aria-hidden="true"
328
+ class="ct-icon ct-icon--size-small"
329
+ height="24"
330
+ role="img"
331
+ viewBox="0 0 24 24"
332
+ width="24"
333
+ xmlns="http://www.w3.org/2000/svg"
334
+ >
335
+
336
+
337
+ <path
338
+ d="M17.92 11.62C17.8724 11.4973 17.801 11.3851 17.71 11.29L12.71 6.29C12.6168 6.19676 12.5061 6.1228 12.3842 6.07234C12.2624 6.02188 12.1319 5.99591 12 5.99591C11.7337 5.99591 11.4783 6.1017 11.29 6.29C11.1968 6.38324 11.1228 6.49393 11.0723 6.61575C11.0219 6.73758 10.9959 6.86814 10.9959 7C10.9959 7.2663 11.1017 7.5217 11.29 7.71L14.59 11H7C6.73478 11 6.48043 11.1054 6.29289 11.2929C6.10536 11.4804 6 11.7348 6 12C6 12.2652 6.10536 12.5196 6.29289 12.7071C6.48043 12.8946 6.73478 13 7 13H14.59L11.29 16.29C11.1963 16.383 11.1219 16.4936 11.0711 16.6154C11.0203 16.7373 10.9942 16.868 10.9942 17C10.9942 17.132 11.0203 17.2627 11.0711 17.3846C11.1219 17.5064 11.1963 17.617 11.29 17.71C11.383 17.8037 11.4936 17.8781 11.6154 17.9289C11.7373 17.9797 11.868 18.0058 12 18.0058C12.132 18.0058 12.2627 17.9797 12.3846 17.9289C12.5064 17.8781 12.617 17.8037 12.71 17.71L17.71 12.71C17.801 12.6149 17.8724 12.5028 17.92 12.38C18.02 12.1365 18.02 11.8635 17.92 11.62Z"
339
+ />
340
+
341
+
342
+ </svg>
343
+
344
+
345
+ </span>
346
+
347
+
348
+ </a>
349
+
350
+
351
+ </div>
352
+
353
+
354
+ </div>
355
+ `;
356
+
357
+ exports[`Link List Card renders attributes 1`] = `
358
+ <div>
359
+
360
+
361
+
362
+
363
+
364
+ <div
365
+ class="ct-link-list-card ct-theme-light ct-link-list-card--default"
366
+ data-component-name="ct-link-list-card"
367
+ data-test="value"
368
+ >
369
+
370
+
371
+
372
+ <a
373
+ class="ct-link-list-card__link"
374
+ href="https://example.com"
375
+ >
376
+
377
+
378
+ <span
379
+ class="ct-link-list-card__title"
380
+ >
381
+ Link
382
+ </span>
383
+
384
+
385
+
386
+
387
+
388
+
389
+ <span
390
+ aria-hidden="true"
391
+ class="ct-link-list-card__icon"
392
+ >
393
+
394
+
395
+ <svg
396
+ aria-hidden="true"
397
+ class="ct-icon ct-icon--size-small"
398
+ height="24"
399
+ role="img"
400
+ viewBox="0 0 24 24"
401
+ width="24"
402
+ xmlns="http://www.w3.org/2000/svg"
403
+ >
404
+
405
+
406
+ <path
407
+ d="M17.92 11.62C17.8724 11.4973 17.801 11.3851 17.71 11.29L12.71 6.29C12.6168 6.19676 12.5061 6.1228 12.3842 6.07234C12.2624 6.02188 12.1319 5.99591 12 5.99591C11.7337 5.99591 11.4783 6.1017 11.29 6.29C11.1968 6.38324 11.1228 6.49393 11.0723 6.61575C11.0219 6.73758 10.9959 6.86814 10.9959 7C10.9959 7.2663 11.1017 7.5217 11.29 7.71L14.59 11H7C6.73478 11 6.48043 11.1054 6.29289 11.2929C6.10536 11.4804 6 11.7348 6 12C6 12.2652 6.10536 12.5196 6.29289 12.7071C6.48043 12.8946 6.73478 13 7 13H14.59L11.29 16.29C11.1963 16.383 11.1219 16.4936 11.0711 16.6154C11.0203 16.7373 10.9942 16.868 10.9942 17C10.9942 17.132 11.0203 17.2627 11.0711 17.3846C11.1219 17.5064 11.1963 17.617 11.29 17.71C11.383 17.8037 11.4936 17.8781 11.6154 17.9289C11.7373 17.9797 11.868 18.0058 12 18.0058C12.132 18.0058 12.2627 17.9797 12.3846 17.9289C12.5064 17.8781 12.617 17.8037 12.71 17.71L17.71 12.71C17.801 12.6149 17.8724 12.5028 17.92 12.38C18.02 12.1365 18.02 11.8635 17.92 11.62Z"
408
+ />
409
+
410
+
411
+ </svg>
412
+
413
+
414
+ </span>
415
+
416
+
417
+ </a>
418
+
419
+
420
+ </div>
421
+
422
+
423
+ </div>
424
+ `;
425
+
426
+ exports[`Link List Card renders nothing without a title 1`] = `
427
+ <div>
428
+
429
+
430
+
431
+
432
+
433
+ </div>
434
+ `;
435
+
436
+ exports[`Link List Card renders nothing without a url 1`] = `
437
+ <div>
438
+
439
+
440
+
441
+
442
+
443
+ </div>
444
+ `;
@@ -0,0 +1,85 @@
1
+ //
2
+ // CivicTheme Link List Card component styles.
3
+ //
4
+
5
+ .ct-link-list-card {
6
+ $root: &;
7
+
8
+ & {
9
+ // Tighter, more defined card shadow than the elevation ramp's level 2
10
+ // (same 4px offset, half the blur). Tokenised with ct-particle() so it
11
+ // tracks the particle base rather than hardcoding rem/rgba.
12
+ box-shadow: 0 ct-particle(0.5) ct-particle(1) rgba(0, 0, 0, 20%);
13
+ position: relative;
14
+ width: 100%;
15
+ box-sizing: border-box;
16
+ border-radius: var(--ct-link-list-card-border-radius);
17
+ overflow: hidden;
18
+ }
19
+
20
+ // Interactive cards lift on hover and press in on active, keeping the same
21
+ // crisp blur as the resting shadow; deactivated cards stay at rest.
22
+ &:not(#{$root}--deactivated) {
23
+ &:hover {
24
+ box-shadow: 0 ct-particle(1) ct-particle(2) rgba(0, 0, 0, 20%);
25
+ }
26
+
27
+ &:active {
28
+ box-shadow: 0 ct-particle(0.25) ct-particle(0.5) rgba(0, 0, 0, 25%);
29
+ }
30
+ }
31
+
32
+ #{$root}__link {
33
+ @include ct-typography('label-regular');
34
+ @include ct-link-no-decoration();
35
+
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: space-between;
39
+ gap: ct-spacing(1);
40
+ padding: ct-spacing(3);
41
+
42
+ &:hover {
43
+ text-decoration: underline;
44
+ }
45
+
46
+ &:focus-visible {
47
+ @include ct-outline();
48
+ }
49
+ }
50
+
51
+ #{$root}__icon {
52
+ display: inline-flex;
53
+ flex-shrink: 0;
54
+ }
55
+
56
+ // Deactivated: non-interactive, no hover affordance. The padlock stays.
57
+ &--deactivated {
58
+ #{$root}__link {
59
+ cursor: default;
60
+
61
+ &:hover {
62
+ text-decoration: none;
63
+ }
64
+ }
65
+ }
66
+
67
+ @include ct-component-theme($root) using($root, $theme) {
68
+ @include ct-component-property($root, $theme, background-color);
69
+
70
+ #{$root}__link {
71
+ @include ct-component-property($root, $theme, link, color);
72
+
73
+ &:hover {
74
+ @include ct-component-property($root, $theme, link, hover, color);
75
+ }
76
+ }
77
+
78
+ &#{$root}--deactivated {
79
+ #{$root}__link,
80
+ #{$root}__link:hover {
81
+ @include ct-component-property($root, $theme, deactivated, link, color);
82
+ }
83
+ }
84
+ }
85
+ }
@@ -0,0 +1,13 @@
1
+ export default {
2
+ args: (theme = 'light') => ({
3
+ theme,
4
+ variant: 'default',
5
+ title: 'Apply for a grant',
6
+ url: 'https://example.com/apply',
7
+ is_external: false,
8
+ is_new_window: false,
9
+ is_deactivated: false,
10
+ modifier_class: '',
11
+ attributes: null,
12
+ }),
13
+ };
@@ -0,0 +1,96 @@
1
+ /**
2
+ * CivicTheme Link List Card component stories.
3
+ */
4
+
5
+ // phpcs:ignoreFile
6
+ import Component from './link-list-card.twig';
7
+ import LinkListCardData from './link-list-card.stories.data';
8
+
9
+ const meta = {
10
+ title: 'Molecules/List/Link List Card',
11
+ component: Component,
12
+ tags: ['digitalgovau'],
13
+ argTypes: {
14
+ theme: {
15
+ control: { type: 'radio' },
16
+ options: ['light', 'dark'],
17
+ },
18
+ variant: {
19
+ control: { type: 'radio' },
20
+ options: ['default', 'authenticated'],
21
+ },
22
+ title: {
23
+ control: { type: 'text' },
24
+ },
25
+ url: {
26
+ control: { type: 'text' },
27
+ },
28
+ is_external: {
29
+ control: { type: 'boolean' },
30
+ },
31
+ is_new_window: {
32
+ control: { type: 'boolean' },
33
+ },
34
+ is_deactivated: {
35
+ control: { type: 'boolean' },
36
+ },
37
+ modifier_class: {
38
+ control: { type: 'text' },
39
+ },
40
+ },
41
+ };
42
+
43
+ export default meta;
44
+
45
+ export const LinkListCard = {
46
+ parameters: {
47
+ layout: 'padded',
48
+ },
49
+ args: LinkListCardData.args(),
50
+ };
51
+
52
+ export const External = {
53
+ parameters: {
54
+ layout: 'padded',
55
+ },
56
+ args: {
57
+ ...LinkListCardData.args(),
58
+ title: 'Visit the national portal',
59
+ url: 'https://national.example.gov',
60
+ is_external: true,
61
+ is_new_window: true,
62
+ },
63
+ };
64
+
65
+ export const AuthenticatedResource = {
66
+ parameters: {
67
+ layout: 'padded',
68
+ },
69
+ args: {
70
+ ...LinkListCardData.args(),
71
+ variant: 'authenticated',
72
+ title: 'Annual report 2025 (secure)',
73
+ url: 'https://example.com/secure/annual-report',
74
+ },
75
+ };
76
+
77
+ export const AuthenticatedResourceDeactivated = {
78
+ parameters: {
79
+ layout: 'padded',
80
+ },
81
+ args: {
82
+ ...LinkListCardData.args(),
83
+ variant: 'authenticated',
84
+ title: 'Annual report 2025 (sign in to access)',
85
+ url: '',
86
+ is_deactivated: true,
87
+ },
88
+ };
89
+
90
+ export const Dark = {
91
+ parameters: {
92
+ layout: 'padded',
93
+ backgrounds: { default: 'Dark' },
94
+ },
95
+ args: LinkListCardData.args('dark'),
96
+ };