@nationalarchives/frontend 0.1.65 → 0.2.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.
- package/config/.eslintrc.js +1 -1
- package/config/.htmlvalidate.json +12 -5
- package/config/stylelint.config.js +1 -0
- package/nationalarchives/all.css +1 -1
- package/nationalarchives/all.css.map +1 -1
- package/nationalarchives/all.js +1 -1
- package/nationalarchives/all.js.map +1 -1
- package/nationalarchives/all.mjs +0 -18
- package/nationalarchives/components/_forms.scss +9 -0
- package/nationalarchives/components/_index.scss +2 -35
- package/nationalarchives/components/_presentation.scss +23 -0
- package/nationalarchives/components/accordion/accordion.css.map +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
- package/nationalarchives/components/button/button.css +1 -1
- package/nationalarchives/components/button/button.css.map +1 -1
- package/nationalarchives/components/button/button.scss +9 -9
- package/nationalarchives/components/card/card.css +1 -1
- package/nationalarchives/components/card/card.css.map +1 -1
- package/nationalarchives/components/checkboxes/checkboxes.css +1 -1
- package/nationalarchives/components/checkboxes/checkboxes.css.map +1 -1
- package/nationalarchives/components/checkboxes/checkboxes.njk +1 -1
- package/nationalarchives/components/checkboxes/checkboxes.scss +1 -1
- package/nationalarchives/components/checkboxes/macro-options.json +6 -0
- package/nationalarchives/components/compound-filters/compound-filters.css.map +1 -1
- package/nationalarchives/components/date-input/date-input.css +1 -1
- package/nationalarchives/components/date-input/date-input.css.map +1 -1
- package/nationalarchives/components/date-input/date-input.scss +2 -2
- package/nationalarchives/components/date-input/fixtures.json +5 -5
- package/nationalarchives/components/date-input/template.njk +1 -1
- package/nationalarchives/components/date-search/date-search.css +1 -1
- package/nationalarchives/components/date-search/date-search.css.map +1 -1
- package/nationalarchives/components/date-search/date-search.scss +2 -2
- package/nationalarchives/components/details/details.css.map +1 -1
- package/nationalarchives/components/error-summary/error-summary.css +1 -1
- package/nationalarchives/components/error-summary/error-summary.css.map +1 -1
- package/nationalarchives/components/error-summary/error-summary.js +1 -1
- package/nationalarchives/components/error-summary/error-summary.js.map +1 -1
- package/nationalarchives/components/error-summary/error-summary.mjs +1 -1
- package/nationalarchives/components/error-summary/error-summary.scss +3 -4
- package/nationalarchives/components/files-list/_index.scss +1 -0
- package/nationalarchives/components/files-list/files-list.css +1 -0
- package/nationalarchives/components/files-list/files-list.css.map +1 -0
- package/nationalarchives/components/{files/files.scss → files-list/files-list.scss} +2 -1
- package/nationalarchives/components/files-list/fixtures.json +71 -0
- package/nationalarchives/components/files-list/macro.njk +3 -0
- package/nationalarchives/components/files-list/template.njk +33 -0
- package/nationalarchives/components/footer/footer.css.map +1 -1
- package/nationalarchives/components/gallery/fixtures.json +1 -1
- package/nationalarchives/components/gallery/gallery.css +1 -1
- package/nationalarchives/components/gallery/gallery.css.map +1 -1
- package/nationalarchives/components/gallery/gallery.scss +5 -6
- package/nationalarchives/components/gallery/template.njk +11 -7
- package/nationalarchives/components/global-header/global-header.css.map +1 -1
- package/nationalarchives/components/header/header.css.map +1 -1
- package/nationalarchives/components/hero/hero.css +1 -1
- package/nationalarchives/components/hero/hero.css.map +1 -1
- package/nationalarchives/components/hero/hero.scss +0 -24
- package/nationalarchives/components/index-grid/index-grid.css +1 -1
- package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
- package/nationalarchives/components/index-grid/index-grid.scss +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
- package/nationalarchives/components/picture/picture.css.map +1 -1
- package/nationalarchives/components/quick-filters/quick-filters.css +1 -1
- package/nationalarchives/components/quick-filters/quick-filters.css.map +1 -1
- package/nationalarchives/components/radios/radios.css +1 -1
- package/nationalarchives/components/radios/radios.css.map +1 -1
- package/nationalarchives/components/radios/radios.scss +1 -1
- package/nationalarchives/components/records-list/_index.scss +1 -0
- package/nationalarchives/components/records-list/fixtures.json +42 -0
- package/nationalarchives/components/records-list/macro.njk +3 -0
- package/nationalarchives/components/records-list/records-list.css +1 -0
- package/nationalarchives/components/records-list/records-list.css.map +1 -0
- package/nationalarchives/components/{featured-records/featured-records.scss → records-list/records-list.scss} +1 -1
- package/nationalarchives/components/records-list/template.njk +21 -0
- package/nationalarchives/components/search-field/search-field.css +1 -1
- package/nationalarchives/components/search-field/search-field.css.map +1 -1
- package/nationalarchives/components/search-field/search-field.scss +1 -1
- package/nationalarchives/components/select/select.css +1 -1
- package/nationalarchives/components/select/select.css.map +1 -1
- package/nationalarchives/components/select/select.scss +2 -2
- package/nationalarchives/components/sidebar/fixtures.json +12 -2
- package/nationalarchives/components/sidebar/sidebar.css +1 -1
- package/nationalarchives/components/sidebar/sidebar.css.map +1 -1
- package/nationalarchives/components/sidebar/template.njk +9 -0
- package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
- package/nationalarchives/components/tabs/tabs.css.map +1 -1
- package/nationalarchives/components/text-input/text-input.css +1 -1
- package/nationalarchives/components/text-input/text-input.css.map +1 -1
- package/nationalarchives/components/text-input/text-input.scss +2 -2
- package/nationalarchives/components/textarea/textarea.css +1 -1
- package/nationalarchives/components/textarea/textarea.css.map +1 -1
- package/nationalarchives/components/textarea/textarea.scss +2 -2
- package/nationalarchives/components/warning/warning.css +1 -1
- package/nationalarchives/components/warning/warning.css.map +1 -1
- package/nationalarchives/components/warning/warning.scss +1 -0
- package/nationalarchives/global-header-package.css +1 -1
- package/nationalarchives/global-header-package.css.map +1 -1
- package/nationalarchives/global-header-package.scss +1 -1
- package/nationalarchives/print.css +1 -1
- package/nationalarchives/print.css.map +1 -1
- package/nationalarchives/prototype-kit.css +1 -1
- package/nationalarchives/prototype-kit.css.map +1 -1
- package/nationalarchives/tools/_colour.scss +25 -50
- package/nationalarchives/utilities/_columns.scss +1 -1
- package/nationalarchives/utilities/_index.scss +1 -0
- package/nationalarchives/utilities/_reset.scss +2 -8
- package/nationalarchives/utilities/{_colour.scss → colour/_index.scss} +2 -2
- package/nationalarchives/utilities/{_forms.scss → forms/_index.scss} +6 -6
- package/nationalarchives/utilities/grid/macro.njk +3 -0
- package/nationalarchives/utilities/{_lists.scss → lists/_index.scss} +16 -7
- package/nationalarchives/utilities/{_overrides.scss → overrides/_index.scss} +2 -2
- package/nationalarchives/utilities/{_tables.scss → tables/_index.scss} +5 -5
- package/nationalarchives/utilities/{_typography.scss → typography/_index.scss} +5 -5
- package/nationalarchives/variables/_colour.scss +12 -5
- package/package.json +1 -1
- package/nationalarchives/components/accordion/accordion.stories.js +0 -432
- package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +0 -128
- package/nationalarchives/components/button/button-group.stories.js +0 -114
- package/nationalarchives/components/button/button.stories.js +0 -207
- package/nationalarchives/components/card/card.stories.js +0 -402
- package/nationalarchives/components/checkboxes/checkboxes.stories.js +0 -241
- package/nationalarchives/components/compound-filters/compound-filters.stories.js +0 -61
- package/nationalarchives/components/cookie-banner/cookie-banner.stories.js +0 -250
- package/nationalarchives/components/date-input/date-input.stories.js +0 -119
- package/nationalarchives/components/date-search/date-search.stories.js +0 -124
- package/nationalarchives/components/details/details.stories.js +0 -33
- package/nationalarchives/components/error-summary/error-summary.stories.js +0 -59
- package/nationalarchives/components/featured-records/_index.scss +0 -1
- package/nationalarchives/components/featured-records/featured-records.css +0 -1
- package/nationalarchives/components/featured-records/featured-records.css.map +0 -1
- package/nationalarchives/components/featured-records/featured-records.stories.js +0 -50
- package/nationalarchives/components/featured-records/fixtures.json +0 -42
- package/nationalarchives/components/featured-records/macro.njk +0 -3
- package/nationalarchives/components/featured-records/template.njk +0 -21
- package/nationalarchives/components/files/_index.scss +0 -1
- package/nationalarchives/components/files/files.css +0 -1
- package/nationalarchives/components/files/files.css.map +0 -1
- package/nationalarchives/components/files/files.stories.js +0 -59
- package/nationalarchives/components/files/fixtures.json +0 -71
- package/nationalarchives/components/files/macro.njk +0 -3
- package/nationalarchives/components/files/template.njk +0 -33
- package/nationalarchives/components/footer/footer.stories.js +0 -241
- package/nationalarchives/components/gallery/gallery.stories.js +0 -87
- package/nationalarchives/components/global-header/global-header.stories.js +0 -364
- package/nationalarchives/components/grid/_index.scss +0 -1
- package/nationalarchives/components/grid/grid.css +0 -1
- package/nationalarchives/components/grid/grid.css.map +0 -1
- package/nationalarchives/components/grid/grid.stories.js +0 -279
- package/nationalarchives/components/grid/macro.njk +0 -3
- package/nationalarchives/components/header/header.stories.js +0 -239
- package/nationalarchives/components/hero/hero.stories.js +0 -326
- package/nationalarchives/components/index-grid/index-grid.stories.js +0 -128
- package/nationalarchives/components/pagination/pagination.stories.js +0 -532
- package/nationalarchives/components/phase-banner/phase-banner.stories.js +0 -39
- package/nationalarchives/components/picture/picture.stories.js +0 -75
- package/nationalarchives/components/quick-filters/quick-filters.stories.js +0 -76
- package/nationalarchives/components/radios/radios.stories.js +0 -244
- package/nationalarchives/components/search-field/search-field.stories.js +0 -88
- package/nationalarchives/components/search-filters/_index.scss +0 -1
- package/nationalarchives/components/search-filters/fixtures.json +0 -16
- package/nationalarchives/components/search-filters/macro-options.json +0 -39
- package/nationalarchives/components/search-filters/macro.njk +0 -3
- package/nationalarchives/components/search-filters/search-filters.css +0 -1
- package/nationalarchives/components/search-filters/search-filters.css.map +0 -1
- package/nationalarchives/components/search-filters/search-filters.js +0 -2
- package/nationalarchives/components/search-filters/search-filters.js.map +0 -1
- package/nationalarchives/components/search-filters/search-filters.mjs +0 -67
- package/nationalarchives/components/search-filters/search-filters.scss +0 -198
- package/nationalarchives/components/search-filters/search-filters.stories.js +0 -207
- package/nationalarchives/components/search-filters/template.njk +0 -108
- package/nationalarchives/components/select/select.stories.js +0 -197
- package/nationalarchives/components/sensitive-image/_index.scss +0 -1
- package/nationalarchives/components/sensitive-image/fixtures.json +0 -51
- package/nationalarchives/components/sensitive-image/macro-options.json +0 -58
- package/nationalarchives/components/sensitive-image/macro.njk +0 -3
- package/nationalarchives/components/sensitive-image/sensitive-image.css +0 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.css.map +0 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.js +0 -2
- package/nationalarchives/components/sensitive-image/sensitive-image.js.map +0 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.mjs +0 -23
- package/nationalarchives/components/sensitive-image/sensitive-image.scss +0 -85
- package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +0 -86
- package/nationalarchives/components/sensitive-image/template.njk +0 -11
- package/nationalarchives/components/sidebar/sidebar.stories.js +0 -227
- package/nationalarchives/components/skip-link/skip-link.stories.js +0 -76
- package/nationalarchives/components/tabs/tabs.stories.js +0 -300
- package/nationalarchives/components/text-input/text-input.stories.js +0 -188
- package/nationalarchives/components/textarea/textarea.stories.js +0 -130
- package/nationalarchives/components/warning/warning.stories.js +0 -39
- package/nationalarchives/stories/intro.mdx +0 -13
- package/nationalarchives/stories/utilities/colour-schemes/colour-combinations.stories.js +0 -293
- package/nationalarchives/stories/utilities/colour-schemes/colour-themes.stories.js +0 -1513
- package/nationalarchives/stories/utilities/forms/forms.mdx +0 -117
- package/nationalarchives/stories/utilities/lists/lists.stories.js +0 -212
- package/nationalarchives/stories/utilities/overrides/overrides.stories.js +0 -42
- package/nationalarchives/stories/utilities/tables/tables.stories.js +0 -47
- package/nationalarchives/stories/utilities/typography/heading-groups.stories.js +0 -94
- package/nationalarchives/stories/utilities/typography/headings.stories.js +0 -33
- package/nationalarchives/stories/utilities/typography/typography.stories.js +0 -91
- package/nationalarchives/components/{files → files-list}/macro-options.json +0 -0
- package/nationalarchives/components/{featured-records → records-list}/macro-options.json +0 -0
- package/nationalarchives/{components/grid/grid.scss → utilities/grid/_index.scss} +1 -1
- /package/nationalarchives/{components → utilities}/grid/fixtures.json +0 -0
- /package/nationalarchives/{components → utilities}/grid/macro-options.json +0 -0
- /package/nationalarchives/{components → utilities}/grid/template.njk +0 -0
@@ -1,198 +0,0 @@
|
|
1
|
-
@use "sass:math";
|
2
|
-
|
3
|
-
@use "../../tools/colour";
|
4
|
-
@use "../../tools/media";
|
5
|
-
@use "../../tools/spacing";
|
6
|
-
@use "../../tools/typography";
|
7
|
-
|
8
|
-
.tna-search-filters {
|
9
|
-
@include spacing.space-above;
|
10
|
-
|
11
|
-
&__title {
|
12
|
-
}
|
13
|
-
|
14
|
-
&__update {
|
15
|
-
display: block;
|
16
|
-
}
|
17
|
-
|
18
|
-
.tna-heading-s {
|
19
|
-
margin: 0;
|
20
|
-
padding: 0;
|
21
|
-
}
|
22
|
-
|
23
|
-
&__fieldset {
|
24
|
-
border: none;
|
25
|
-
}
|
26
|
-
|
27
|
-
&__legend {
|
28
|
-
width: 100%;
|
29
|
-
}
|
30
|
-
|
31
|
-
&__heading-inner,
|
32
|
-
&__item-toggle {
|
33
|
-
padding: spacing.space(0.5) spacing.space(0.75);
|
34
|
-
|
35
|
-
@include colour.colour-border("keyline", 1px, solid);
|
36
|
-
border-bottom-width: 0;
|
37
|
-
}
|
38
|
-
|
39
|
-
&__heading-inner {
|
40
|
-
margin-top: spacing.space(1);
|
41
|
-
padding: spacing.space(0.5) spacing.space(0.75);
|
42
|
-
}
|
43
|
-
|
44
|
-
&__item-toggle {
|
45
|
-
width: 100%;
|
46
|
-
margin: 0;
|
47
|
-
padding-right: spacing.space(2.5);
|
48
|
-
|
49
|
-
display: block;
|
50
|
-
|
51
|
-
position: relative;
|
52
|
-
|
53
|
-
color: inherit;
|
54
|
-
font-family: inherit;
|
55
|
-
font-size: inherit;
|
56
|
-
font-weight: inherit;
|
57
|
-
line-height: inherit;
|
58
|
-
text-align: inherit;
|
59
|
-
|
60
|
-
background: none;
|
61
|
-
|
62
|
-
cursor: pointer;
|
63
|
-
|
64
|
-
&::before {
|
65
|
-
content: "";
|
66
|
-
|
67
|
-
width: 0;
|
68
|
-
height: 0;
|
69
|
-
|
70
|
-
position: absolute;
|
71
|
-
top: calc(50% - #{math.div(math.sqrt(3), 4)}rem);
|
72
|
-
right: spacing.space(0.75);
|
73
|
-
|
74
|
-
border-width: #{math.div(math.sqrt(3), 2)}rem 0.5rem 0 0.5rem;
|
75
|
-
border-color: colour.colour-var("font-light") transparent transparent
|
76
|
-
transparent;
|
77
|
-
border-style: solid;
|
78
|
-
}
|
79
|
-
|
80
|
-
&:hover,
|
81
|
-
&:active {
|
82
|
-
@include typography.interacted-text-decoration;
|
83
|
-
|
84
|
-
background: none;
|
85
|
-
|
86
|
-
&::before {
|
87
|
-
border-top-color: colour.colour-var("font-dark");
|
88
|
-
}
|
89
|
-
}
|
90
|
-
|
91
|
-
&[aria-expanded="true"] {
|
92
|
-
&::before {
|
93
|
-
top: calc(50% - #{math.div(math.sqrt(3), 4)}rem);
|
94
|
-
|
95
|
-
border-width: 0 0.5rem #{math.div(math.sqrt(3), 2)}rem 0.5rem;
|
96
|
-
border-color: transparent transparent colour.colour-var("font-light")
|
97
|
-
transparent;
|
98
|
-
}
|
99
|
-
|
100
|
-
&:hover {
|
101
|
-
&::before {
|
102
|
-
border-bottom-color: colour.colour-var("font-dark");
|
103
|
-
}
|
104
|
-
}
|
105
|
-
}
|
106
|
-
}
|
107
|
-
|
108
|
-
&__item-toggle-label {
|
109
|
-
}
|
110
|
-
|
111
|
-
&__item-toggle-info {
|
112
|
-
display: block;
|
113
|
-
|
114
|
-
@include typography.main-font-weight;
|
115
|
-
@include typography.font-size(14);
|
116
|
-
}
|
117
|
-
|
118
|
-
&__item {
|
119
|
-
padding: spacing.space(0.75);
|
120
|
-
|
121
|
-
@include colour.tint;
|
122
|
-
|
123
|
-
@include colour.colour-border("keyline", 1px);
|
124
|
-
border-width: 0 1px 1px;
|
125
|
-
}
|
126
|
-
|
127
|
-
&__hint {
|
128
|
-
margin-bottom: spacing.space(0.75);
|
129
|
-
|
130
|
-
@include typography.font-size(16);
|
131
|
-
@include colour.colour-font("font-light");
|
132
|
-
}
|
133
|
-
|
134
|
-
&__inline-fields {
|
135
|
-
display: flex;
|
136
|
-
flex-wrap: wrap;
|
137
|
-
gap: spacing.space(0.5) spacing.space(2);
|
138
|
-
}
|
139
|
-
|
140
|
-
&__label {
|
141
|
-
display: block;
|
142
|
-
}
|
143
|
-
|
144
|
-
&__footer {
|
145
|
-
padding: spacing.space(0.75);
|
146
|
-
|
147
|
-
display: none;
|
148
|
-
|
149
|
-
@include colour.colour-border("keyline", 1px);
|
150
|
-
}
|
151
|
-
|
152
|
-
&--js-enabled &__title {
|
153
|
-
margin-bottom: spacing.space(1);
|
154
|
-
}
|
155
|
-
|
156
|
-
&--js-enabled &__footer {
|
157
|
-
display: block;
|
158
|
-
}
|
159
|
-
|
160
|
-
&--js-enabled &__item {
|
161
|
-
border-bottom: none;
|
162
|
-
}
|
163
|
-
|
164
|
-
&--js-enabled &__update-item {
|
165
|
-
display: none;
|
166
|
-
}
|
167
|
-
|
168
|
-
&__fieldset[data-type="multiple"] &__item {
|
169
|
-
max-height: 15rem;
|
170
|
-
|
171
|
-
overflow: auto;
|
172
|
-
}
|
173
|
-
|
174
|
-
@include colour.on-forced-colours {
|
175
|
-
&__item-toggle {
|
176
|
-
&::before {
|
177
|
-
content: "\2193";
|
178
|
-
|
179
|
-
width: auto;
|
180
|
-
height: auto;
|
181
|
-
|
182
|
-
top: calc(50% - 0.5rem);
|
183
|
-
|
184
|
-
line-height: 1rem;
|
185
|
-
|
186
|
-
border: none;
|
187
|
-
}
|
188
|
-
|
189
|
-
&[aria-expanded="true"] {
|
190
|
-
&::before {
|
191
|
-
content: "\2191";
|
192
|
-
|
193
|
-
border: none;
|
194
|
-
}
|
195
|
-
}
|
196
|
-
}
|
197
|
-
}
|
198
|
-
}
|
@@ -1,207 +0,0 @@
|
|
1
|
-
import Filters from "./template.njk";
|
2
|
-
import macroOptions from "./macro-options.json";
|
3
|
-
|
4
|
-
const argTypes = {
|
5
|
-
title: { control: "text" },
|
6
|
-
rootHeadingLevel: { control: { type: "number", min: 1, max: 6 } },
|
7
|
-
formId: { control: "text" },
|
8
|
-
items: { control: "object" },
|
9
|
-
classes: { control: "text" },
|
10
|
-
attributes: { control: "object" },
|
11
|
-
};
|
12
|
-
|
13
|
-
Object.keys(argTypes).forEach((argType) => {
|
14
|
-
argTypes[argType].description = macroOptions.find(
|
15
|
-
(option) => option.name === argType,
|
16
|
-
)?.description;
|
17
|
-
});
|
18
|
-
|
19
|
-
export default {
|
20
|
-
title: "Components/Search filters",
|
21
|
-
argTypes,
|
22
|
-
};
|
23
|
-
|
24
|
-
const Template = ({
|
25
|
-
title,
|
26
|
-
rootHeadingLevel,
|
27
|
-
formId,
|
28
|
-
items,
|
29
|
-
classes,
|
30
|
-
attributes,
|
31
|
-
}) =>
|
32
|
-
Filters({
|
33
|
-
params: {
|
34
|
-
title,
|
35
|
-
rootHeadingLevel,
|
36
|
-
formId,
|
37
|
-
items,
|
38
|
-
classes,
|
39
|
-
attributes,
|
40
|
-
},
|
41
|
-
});
|
42
|
-
|
43
|
-
export const Standard = Template.bind({});
|
44
|
-
Standard.args = {
|
45
|
-
title: "Filters",
|
46
|
-
rootHeadingLevel: 2,
|
47
|
-
formId: "test-form",
|
48
|
-
items: [
|
49
|
-
{
|
50
|
-
type: "text",
|
51
|
-
label: "Refine",
|
52
|
-
id: "refine1",
|
53
|
-
name: "refine1",
|
54
|
-
// open: true,
|
55
|
-
hint: "Search within the current results",
|
56
|
-
},
|
57
|
-
// {
|
58
|
-
// type: "single",
|
59
|
-
// label: "Type",
|
60
|
-
// id: "type1",
|
61
|
-
// name: "type1",
|
62
|
-
// small: true,
|
63
|
-
// // open: true,
|
64
|
-
// hint: "You can only select one.",
|
65
|
-
// items: [
|
66
|
-
// {
|
67
|
-
// text: "Audio",
|
68
|
-
// value: "audio",
|
69
|
-
// },
|
70
|
-
// {
|
71
|
-
// text: "Image",
|
72
|
-
// value: "image",
|
73
|
-
// },
|
74
|
-
// {
|
75
|
-
// text: "Video",
|
76
|
-
// value: "video",
|
77
|
-
// },
|
78
|
-
// ],
|
79
|
-
// },
|
80
|
-
{
|
81
|
-
type: "multiple",
|
82
|
-
label: "Category",
|
83
|
-
id: "categories1",
|
84
|
-
name: "categories1",
|
85
|
-
small: true,
|
86
|
-
// open: true,
|
87
|
-
hint: "The category of the record",
|
88
|
-
// count: 2,
|
89
|
-
seeMoreText: "See all 29 categories",
|
90
|
-
seeMoreUrl: "#",
|
91
|
-
items: [
|
92
|
-
{
|
93
|
-
text: "Alpha",
|
94
|
-
value: "alpha",
|
95
|
-
},
|
96
|
-
{
|
97
|
-
text: "Beta",
|
98
|
-
value: "beta",
|
99
|
-
// checked: true,
|
100
|
-
},
|
101
|
-
{
|
102
|
-
text: "Gamma",
|
103
|
-
value: "gamma",
|
104
|
-
},
|
105
|
-
],
|
106
|
-
},
|
107
|
-
{
|
108
|
-
type: "date",
|
109
|
-
label: "Opening date",
|
110
|
-
id: "date1",
|
111
|
-
name: "date1",
|
112
|
-
hint: "The earliest opening date of the record",
|
113
|
-
},
|
114
|
-
{
|
115
|
-
type: "daterange",
|
116
|
-
label: "Covering date",
|
117
|
-
id: "dates",
|
118
|
-
hint: "The earliest and/or latest covering date of the record",
|
119
|
-
// open: true,
|
120
|
-
from: {
|
121
|
-
label: "From",
|
122
|
-
id: "date2",
|
123
|
-
name: "date2",
|
124
|
-
},
|
125
|
-
to: {
|
126
|
-
label: "To",
|
127
|
-
id: "date3",
|
128
|
-
name: "date3",
|
129
|
-
},
|
130
|
-
},
|
131
|
-
],
|
132
|
-
classes: "tna-search-filters--demo",
|
133
|
-
};
|
134
|
-
|
135
|
-
export const OpenedAndPrepopulated = Template.bind({});
|
136
|
-
OpenedAndPrepopulated.args = {
|
137
|
-
title: "Filters",
|
138
|
-
rootHeadingLevel: 2,
|
139
|
-
formId: "test-form",
|
140
|
-
items: [
|
141
|
-
{
|
142
|
-
type: "text",
|
143
|
-
label: "Refine",
|
144
|
-
id: "refine1",
|
145
|
-
name: "refine1",
|
146
|
-
open: true,
|
147
|
-
hint: "Search within the current results",
|
148
|
-
value: "iceberg",
|
149
|
-
},
|
150
|
-
{
|
151
|
-
type: "multiple",
|
152
|
-
label: "Category",
|
153
|
-
id: "categories1",
|
154
|
-
name: "categories1",
|
155
|
-
small: true,
|
156
|
-
open: true,
|
157
|
-
hint: "The category of the record",
|
158
|
-
seeMoreText: "See all 29 categories",
|
159
|
-
seeMoreUrl: "#",
|
160
|
-
items: [
|
161
|
-
{
|
162
|
-
text: "Alpha",
|
163
|
-
value: "alpha",
|
164
|
-
},
|
165
|
-
{
|
166
|
-
text: "Beta",
|
167
|
-
value: "beta",
|
168
|
-
checked: true,
|
169
|
-
},
|
170
|
-
{
|
171
|
-
text: "Gamma",
|
172
|
-
value: "gamma",
|
173
|
-
checked: true,
|
174
|
-
},
|
175
|
-
],
|
176
|
-
},
|
177
|
-
{
|
178
|
-
type: "date",
|
179
|
-
label: "Opening date",
|
180
|
-
id: "date1",
|
181
|
-
name: "date1",
|
182
|
-
hint: "The earliest opening date of the record",
|
183
|
-
open: true,
|
184
|
-
value: "1969-07-16",
|
185
|
-
},
|
186
|
-
{
|
187
|
-
type: "daterange",
|
188
|
-
label: "Covering date",
|
189
|
-
id: "dates",
|
190
|
-
hint: "The earliest and/or latest covering date of the record",
|
191
|
-
open: true,
|
192
|
-
from: {
|
193
|
-
label: "From",
|
194
|
-
id: "date2",
|
195
|
-
name: "date2",
|
196
|
-
value: "1912-04-14",
|
197
|
-
},
|
198
|
-
to: {
|
199
|
-
label: "To",
|
200
|
-
id: "date3",
|
201
|
-
name: "date3",
|
202
|
-
value: "1912-04-15",
|
203
|
-
},
|
204
|
-
},
|
205
|
-
],
|
206
|
-
classes: "tna-search-filters--demo",
|
207
|
-
};
|
@@ -1,108 +0,0 @@
|
|
1
|
-
{% from "nationalarchives/components/button/macro.njk" import tnaButton %}
|
2
|
-
{% from "nationalarchives/components/checkboxes/checkboxes.njk" import tnaCheckboxesElement %}
|
3
|
-
{% from "nationalarchives/components/date-search/date-search.njk" import tnaDateSearchElement %}
|
4
|
-
{% from "nationalarchives/components/radios/radios.njk" import tnaRadiosElement %}
|
5
|
-
{% from "nationalarchives/components/text-input/text-input.njk" import tnaTextInputElement %}
|
6
|
-
|
7
|
-
{%- set containerClasses = [params.classes] if params.classes else [] -%}
|
8
|
-
{%- set classes = containerClasses | join(' ') -%}
|
9
|
-
<div class="tna-search-filters{% if classes %} {{ classes }}{% endif %}" data-module="tna-search-filters"{% for attribute, value in params.attributes %} {{ attribute }}{% if value !== '' %}="{{ value }}"{% endif %}{% endfor %}>
|
10
|
-
<h{{ params.rootHeadingLevel }} class="tna-heading-m tna-search-filters__title">
|
11
|
-
{{ params.title }}
|
12
|
-
</h{{ params.rootHeadingLevel }}>
|
13
|
-
{%- for filter in params.items %}
|
14
|
-
<fieldset class="tna-search-filters__fieldset" {%- if filter.hint and (filter.type == 'single' or filter.type == 'multiple' or filter.type == 'daterange') %} aria-describedby="{{ filter.id }}-hint"{% endif %} data-type="{{ filter.type }}">
|
15
|
-
<legend class="tna-search-filters__legend">
|
16
|
-
<h{{ params.rootHeadingLevel + 1 }} class="tna-heading-s">
|
17
|
-
<div class="tna-search-filters__heading-inner">
|
18
|
-
{% if filter.type == 'single' or filter.type == 'multiple' or filter.type == 'daterange' %}
|
19
|
-
{{ filter.label }}
|
20
|
-
{% else %}
|
21
|
-
<label for="{{ filter.id }}">
|
22
|
-
{{ filter.label }}
|
23
|
-
</label>
|
24
|
-
{% endif %}
|
25
|
-
</div>
|
26
|
-
<button class="tna-search-filters__item-toggle" aria-controls="{{ filter.id }}-wrapper" aria-expanded="{{ filter.open or false }}" hidden>
|
27
|
-
{% if filter.type == 'single' or filter.type == 'multiple' or filter.type == 'daterange' %}
|
28
|
-
<span class="tna-search-filters__item-toggle-label">
|
29
|
-
{{ filter.label }}
|
30
|
-
</span>
|
31
|
-
{% else %}
|
32
|
-
<label class="tna-search-filters__item-toggle-label" for="{{ filter.id }}">
|
33
|
-
{{ filter.label }}
|
34
|
-
</label>
|
35
|
-
{% endif %}
|
36
|
-
{% if filter.count %}
|
37
|
-
<span class="tna-search-filters__item-toggle-info">({{ filter.count }} selected)</span>
|
38
|
-
{% else %}
|
39
|
-
<span class="tna-search-filters__item-toggle-info"></span>
|
40
|
-
{% endif %}
|
41
|
-
</button>
|
42
|
-
</h{{ params.rootHeadingLevel + 1 }}>
|
43
|
-
</legend>
|
44
|
-
<div id="{{ filter.id }}-wrapper" class="tna-search-filters__item">
|
45
|
-
{%- if filter.hint %}
|
46
|
-
<p id="{{ filter.id }}-hint" class="tna-search-filters__hint">
|
47
|
-
{{ filter.hint }}
|
48
|
-
</p>
|
49
|
-
{%- endif %}
|
50
|
-
{% if filter.type == 'single' %}
|
51
|
-
{{ tnaRadiosElement(filter, { form: params.formId }) }}
|
52
|
-
{% elif filter.type == 'multiple' %}
|
53
|
-
{{ tnaCheckboxesElement(filter, { form: params.formId }) }}
|
54
|
-
<div class="tna-button-group tna-button-group--small tna-!--margin-top-xs">
|
55
|
-
{{ tnaButton({
|
56
|
-
text: filter.seeMoreText or 'See more',
|
57
|
-
href: filter.seeMoreUrl,
|
58
|
-
plain: true
|
59
|
-
}) }}
|
60
|
-
</div>
|
61
|
-
{% elif filter.type == 'text' %}
|
62
|
-
{{ tnaTextInputElement(filter, { form: params.formId }) }}
|
63
|
-
{% elif filter.type == 'date' %}
|
64
|
-
{{ tnaDateSearchElement(filter, { form: params.formId }) }}
|
65
|
-
{% elif filter.type == 'daterange' %}
|
66
|
-
<div class="tna-search-filters__inline-fields">
|
67
|
-
<label class="tna-search-filters__label">
|
68
|
-
{{ filter.from.label }}
|
69
|
-
{{ tnaDateSearchElement(filter.from, { form: params.formId }) }}
|
70
|
-
</label>
|
71
|
-
<label class="tna-search-filters__label">
|
72
|
-
{{ filter.to.label }}
|
73
|
-
{{ tnaDateSearchElement(filter.to, { form: params.formId }) }}
|
74
|
-
</label>
|
75
|
-
</div>
|
76
|
-
{% endif %}
|
77
|
-
<div class="tna-button-group tna-button-group--small tna-search-filters__update-item tna-!--margin-top-s">
|
78
|
-
{{ tnaButton({
|
79
|
-
text: 'Update',
|
80
|
-
buttonElement: true,
|
81
|
-
buttonType: 'submit',
|
82
|
-
attributes: {
|
83
|
-
form: params.formId
|
84
|
-
}
|
85
|
-
}) }}
|
86
|
-
</div>
|
87
|
-
</div>
|
88
|
-
</fieldset>
|
89
|
-
{%- endfor %}
|
90
|
-
<div class="tna-search-filters__footer">
|
91
|
-
<div class="tna-button-group tna-button-group--small">
|
92
|
-
{{ tnaButton({
|
93
|
-
text: 'Update',
|
94
|
-
buttonElement: true,
|
95
|
-
buttonType: 'submit',
|
96
|
-
classes: 'tna-search-filters__update',
|
97
|
-
attributes: {
|
98
|
-
form: params.formId
|
99
|
-
}
|
100
|
-
}) }}
|
101
|
-
{{ tnaButton({
|
102
|
-
text: 'Clear all filters',
|
103
|
-
href: '#',
|
104
|
-
plain: true
|
105
|
-
}) }}
|
106
|
-
</div>
|
107
|
-
</div>
|
108
|
-
</div>
|
@@ -1,197 +0,0 @@
|
|
1
|
-
import Select from "./template.njk";
|
2
|
-
import macroOptions from "./macro-options.json";
|
3
|
-
|
4
|
-
const argTypes = {
|
5
|
-
label: { control: "text" },
|
6
|
-
headingLevel: { control: { type: "number", min: 1, max: 6 } },
|
7
|
-
headingSize: {
|
8
|
-
control: "inline-radio",
|
9
|
-
options: ["xs", "s", "m", "l", "xl"],
|
10
|
-
},
|
11
|
-
id: { control: "text" },
|
12
|
-
name: { control: "text" },
|
13
|
-
hint: { control: "text" },
|
14
|
-
error: { control: "object" },
|
15
|
-
items: { control: "object" },
|
16
|
-
selected: { control: "text" },
|
17
|
-
size: { control: "inline-radio", options: ["s", "m", "l", "xl"] },
|
18
|
-
inline: { control: "boolean" },
|
19
|
-
formGroupClasses: { control: "text" },
|
20
|
-
formGroupAttributes: { control: "object" },
|
21
|
-
classes: { control: "text" },
|
22
|
-
attributes: { control: "object" },
|
23
|
-
};
|
24
|
-
|
25
|
-
Object.keys(argTypes).forEach((argType) => {
|
26
|
-
argTypes[argType].description = macroOptions.find(
|
27
|
-
(option) => option.name === argType,
|
28
|
-
)?.description;
|
29
|
-
});
|
30
|
-
|
31
|
-
export default {
|
32
|
-
title: "Components/Select",
|
33
|
-
argTypes,
|
34
|
-
};
|
35
|
-
|
36
|
-
const Template = ({
|
37
|
-
label,
|
38
|
-
headingLevel,
|
39
|
-
headingSize,
|
40
|
-
id,
|
41
|
-
name,
|
42
|
-
hint,
|
43
|
-
error,
|
44
|
-
items,
|
45
|
-
selected,
|
46
|
-
size,
|
47
|
-
inline,
|
48
|
-
formGroupClasses,
|
49
|
-
formGroupAttributes,
|
50
|
-
classes,
|
51
|
-
attributes,
|
52
|
-
}) =>
|
53
|
-
Select({
|
54
|
-
params: {
|
55
|
-
label,
|
56
|
-
headingLevel,
|
57
|
-
headingSize,
|
58
|
-
id,
|
59
|
-
name,
|
60
|
-
hint,
|
61
|
-
error,
|
62
|
-
items,
|
63
|
-
selected,
|
64
|
-
size,
|
65
|
-
inline,
|
66
|
-
formGroupClasses,
|
67
|
-
formGroupAttributes,
|
68
|
-
classes,
|
69
|
-
attributes,
|
70
|
-
},
|
71
|
-
});
|
72
|
-
|
73
|
-
export const Standard = Template.bind({});
|
74
|
-
Standard.args = {
|
75
|
-
label: "Sort by",
|
76
|
-
headingLevel: 4,
|
77
|
-
headingSize: "m",
|
78
|
-
id: "sort1",
|
79
|
-
name: "sort1",
|
80
|
-
items: [
|
81
|
-
{
|
82
|
-
text: "Relevance",
|
83
|
-
value: "relevance",
|
84
|
-
},
|
85
|
-
{
|
86
|
-
text: "Date",
|
87
|
-
value: "date",
|
88
|
-
},
|
89
|
-
{
|
90
|
-
text: "Title",
|
91
|
-
value: "title",
|
92
|
-
},
|
93
|
-
],
|
94
|
-
classes: "tna-select--demo",
|
95
|
-
};
|
96
|
-
|
97
|
-
export const Preselected = Template.bind({});
|
98
|
-
Preselected.args = {
|
99
|
-
label: "Sort by",
|
100
|
-
headingLevel: 4,
|
101
|
-
headingSize: "m",
|
102
|
-
id: "sort2",
|
103
|
-
name: "sort2",
|
104
|
-
items: [
|
105
|
-
{
|
106
|
-
text: "Relevance",
|
107
|
-
value: "relevance",
|
108
|
-
},
|
109
|
-
{
|
110
|
-
text: "Date",
|
111
|
-
value: "date",
|
112
|
-
},
|
113
|
-
{
|
114
|
-
text: "Title",
|
115
|
-
value: "title",
|
116
|
-
},
|
117
|
-
],
|
118
|
-
selected: "date",
|
119
|
-
classes: "tna-select--demo",
|
120
|
-
};
|
121
|
-
|
122
|
-
export const WithHint = Template.bind({});
|
123
|
-
WithHint.args = {
|
124
|
-
label: "Sort by",
|
125
|
-
headingLevel: 4,
|
126
|
-
headingSize: "m",
|
127
|
-
id: "sort3",
|
128
|
-
name: "sort3",
|
129
|
-
hint: "Select a sort.",
|
130
|
-
items: [
|
131
|
-
{
|
132
|
-
text: "Relevance",
|
133
|
-
value: "relevance",
|
134
|
-
},
|
135
|
-
{
|
136
|
-
text: "Date",
|
137
|
-
value: "date",
|
138
|
-
},
|
139
|
-
{
|
140
|
-
text: "Title",
|
141
|
-
value: "title",
|
142
|
-
},
|
143
|
-
],
|
144
|
-
classes: "tna-select--demo",
|
145
|
-
};
|
146
|
-
|
147
|
-
export const Error = Template.bind({});
|
148
|
-
Error.args = {
|
149
|
-
label: "Sort by",
|
150
|
-
headingLevel: 4,
|
151
|
-
headingSize: "m",
|
152
|
-
id: "sort4",
|
153
|
-
name: "sort4",
|
154
|
-
error: {
|
155
|
-
text: "You must select a type",
|
156
|
-
},
|
157
|
-
items: [
|
158
|
-
{
|
159
|
-
text: "Relevance",
|
160
|
-
value: "relevance",
|
161
|
-
},
|
162
|
-
{
|
163
|
-
text: "Date",
|
164
|
-
value: "date",
|
165
|
-
},
|
166
|
-
{
|
167
|
-
text: "Title",
|
168
|
-
value: "title",
|
169
|
-
},
|
170
|
-
],
|
171
|
-
classes: "tna-select--demo",
|
172
|
-
};
|
173
|
-
|
174
|
-
export const Inline = Template.bind({});
|
175
|
-
Inline.args = {
|
176
|
-
label: "Sort by",
|
177
|
-
headingLevel: 4,
|
178
|
-
headingSize: "xs",
|
179
|
-
id: "sort5",
|
180
|
-
name: "sort5",
|
181
|
-
items: [
|
182
|
-
{
|
183
|
-
text: "Relevance",
|
184
|
-
value: "relevance",
|
185
|
-
},
|
186
|
-
{
|
187
|
-
text: "Date",
|
188
|
-
value: "date",
|
189
|
-
},
|
190
|
-
{
|
191
|
-
text: "Title",
|
192
|
-
value: "title",
|
193
|
-
},
|
194
|
-
],
|
195
|
-
inline: true,
|
196
|
-
classes: "tna-select--demo",
|
197
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
@use "sensitive-image";
|