@amsterdam/design-system-css 2.0.1 → 2.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.
Files changed (91) hide show
  1. package/CHANGELOG.md +38 -1
  2. package/dist/accordion/accordion.css.map +1 -1
  3. package/dist/avatar/avatar.css +1 -1
  4. package/dist/avatar/avatar.css.map +1 -1
  5. package/dist/badge/badge.css.map +1 -1
  6. package/dist/blockquote/blockquote.css.map +1 -1
  7. package/dist/breadcrumb/breadcrumb.css +1 -1
  8. package/dist/breadcrumb/breadcrumb.css.map +1 -1
  9. package/dist/breakout/breakout.css +1 -1
  10. package/dist/breakout/breakout.css.map +1 -1
  11. package/dist/button/button.css.map +1 -1
  12. package/dist/call-to-action-link/call-to-action-link.css.map +1 -1
  13. package/dist/card/card.css +1 -1
  14. package/dist/card/card.css.map +1 -1
  15. package/dist/character-count/character-count.css.map +1 -1
  16. package/dist/checkbox/checkbox.css.map +1 -1
  17. package/dist/date-input/date-input.css +1 -1
  18. package/dist/date-input/date-input.css.map +1 -1
  19. package/dist/description-list/description-list.css +1 -1
  20. package/dist/description-list/description-list.css.map +1 -1
  21. package/dist/error-message/error-message.css.map +1 -1
  22. package/dist/field-set/field-set.css +1 -1
  23. package/dist/field-set/field-set.css.map +1 -1
  24. package/dist/figure/figure.css.map +1 -1
  25. package/dist/file-input/file-input.css.map +1 -1
  26. package/dist/file-list/file-list.css.map +1 -1
  27. package/dist/grid/grid.css.map +1 -1
  28. package/dist/heading/heading.css.map +1 -1
  29. package/dist/hint/hint.css +1 -1
  30. package/dist/hint/hint.css.map +1 -1
  31. package/dist/image-slider/image-slider.css.map +1 -1
  32. package/dist/index.css +1 -1
  33. package/dist/index.css.map +1 -1
  34. package/dist/label/label.css +1 -1
  35. package/dist/label/label.css.map +1 -1
  36. package/dist/link/link.css.map +1 -1
  37. package/dist/link-list/link-list.css.map +1 -1
  38. package/dist/menu/menu.css +1 -1
  39. package/dist/menu/menu.css.map +1 -1
  40. package/dist/ordered-list/ordered-list.css.map +1 -1
  41. package/dist/page/page.css +1 -1
  42. package/dist/page/page.css.map +1 -1
  43. package/dist/page-footer/page-footer.css.map +1 -1
  44. package/dist/page-header/page-header.css +1 -1
  45. package/dist/page-header/page-header.css.map +1 -1
  46. package/dist/page-heading/page-heading.deprecated.css.map +1 -1
  47. package/dist/pagination/pagination.css.map +1 -1
  48. package/dist/paragraph/paragraph.css.map +1 -1
  49. package/dist/password-input/password-input.css.map +1 -1
  50. package/dist/radio/radio.css.map +1 -1
  51. package/dist/search-field/search-field.css.map +1 -1
  52. package/dist/standalone-link/standalone-link.css.map +1 -1
  53. package/dist/table-of-contents/table-of-contents.css.map +1 -1
  54. package/dist/tabs/tabs.css +1 -1
  55. package/dist/tabs/tabs.css.map +1 -1
  56. package/dist/text-area/text-area.css.map +1 -1
  57. package/dist/text-input/text-input.css.map +1 -1
  58. package/dist/time-input/time-input.css +1 -1
  59. package/dist/time-input/time-input.css.map +1 -1
  60. package/dist/unordered-list/unordered-list.css.map +1 -1
  61. package/dist/visually-hidden/visually-hidden.css +1 -1
  62. package/dist/visually-hidden/visually-hidden.css.map +1 -1
  63. package/documentation/coding-conventions.md +2 -0
  64. package/package.json +3 -3
  65. package/src/common/calculate-fluid-style.scss +2 -0
  66. package/src/common/hyphenation.scss +3 -0
  67. package/src/common/text-rendering.scss +3 -0
  68. package/src/components/avatar/avatar.scss +10 -2
  69. package/src/components/breadcrumb/breadcrumb.scss +6 -1
  70. package/src/components/breakout/breakout.scss +9 -1
  71. package/src/components/card/card.scss +17 -8
  72. package/src/components/checkbox/checkbox.scss +2 -0
  73. package/src/components/date-input/date-input.scss +4 -4
  74. package/src/components/description-list/description-list.scss +0 -6
  75. package/src/components/field-set/field-set.scss +19 -1
  76. package/src/components/grid/_mixins.scss +2 -0
  77. package/src/components/heading/heading.scss +12 -0
  78. package/src/components/hint/hint.scss +4 -0
  79. package/src/components/image-slider/image-slider.scss +10 -4
  80. package/src/components/label/label.scss +16 -0
  81. package/src/components/menu/README.md +18 -2
  82. package/src/components/menu/menu.scss +38 -4
  83. package/src/components/page/README.md +6 -18
  84. package/src/components/page/page.scss +33 -0
  85. package/src/components/page-header/README.md +2 -1
  86. package/src/components/page-header/page-header.scss +30 -23
  87. package/src/components/page-heading/page-heading.deprecated.scss +2 -0
  88. package/src/components/tabs/tabs.scss +4 -0
  89. package/src/components/text-area/text-area.scss +7 -0
  90. package/src/components/time-input/time-input.scss +4 -4
  91. package/src/components/visually-hidden/visually-hidden.scss +4 -1
@@ -4,5 +4,21 @@
4
4
 
5
5
  A primary navigation leading to key areas of an application or website.
6
6
 
7
- The Menu component works well in the sidebar of applications, usually on a blue background.
8
- This first iteration is a simple vertical menu with 1 level of navigation.
7
+ ## Design
8
+
9
+ - The menu has a blue background.
10
+ Links have a white icon and a label.
11
+ - In a narrow window, the menu occupies the full width.
12
+ The icon and label of the link sit next to each other.
13
+ - In a wide window, the menu has a maximum width of 8rem.
14
+ It adds whitespace at the top to align with the baseline of Page Header.
15
+ The icon is larger and positioned above the label.
16
+
17
+ ## Guidelines
18
+
19
+ - This component must not be used on public websites or applications.
20
+ They should offer navigation using the Page Header only.
21
+ - Include this component twice: one in the Page Header and one to the side of the Page.
22
+ Do not use it anywhere else.
23
+ - Set the `inWideWindow` prop to the latter to ensure only one of them is visible, and to get the correct appearance.
24
+ - Use filled icons for the links.
@@ -14,10 +14,40 @@
14
14
  }
15
15
 
16
16
  .ams-menu {
17
+ background-color: var(--ams-menu-background-color);
17
18
  font-family: var(--ams-menu-font-family);
18
19
  font-size: var(--ams-menu-font-size);
19
20
  font-weight: var(--ams-menu-font-weight);
20
21
  line-height: var(--ams-menu-line-height);
22
+
23
+ // Menu must overlap the horizontal padding of Page Header to span the entire window.
24
+ // We accept that this approach with a negative margin tightly couples the component to that context.
25
+ margin-inline: calc(var(--ams-grid-padding-inline) * -1);
26
+ padding-block: var(--ams-menu-padding-block);
27
+
28
+ // We subtract the menu link padding to align the items with surrounding content.
29
+ padding-inline: calc(var(--ams-grid-padding-inline) - var(--ams-menu-link-padding-inline));
30
+
31
+ @media screen and (min-width: $ams-breakpoint-medium) {
32
+ margin-inline: calc(var(--ams-grid-medium-padding-inline) * -1);
33
+ padding-inline: var(--ams-grid-medium-padding-inline);
34
+ }
35
+
36
+ @media screen and (min-width: $ams-breakpoint-wide) {
37
+ display: none;
38
+ margin-inline: 0; // Override negative margin above.
39
+ max-inline-size: var(--ams-menu-wide-max-inline-size);
40
+ padding-block: var(--ams-menu-wide-padding-block);
41
+ padding-inline: var(--ams-menu-wide-padding-inline);
42
+ }
43
+ }
44
+
45
+ .ams-menu--in-wide-window {
46
+ display: none;
47
+
48
+ @media screen and (min-width: $ams-breakpoint-wide) {
49
+ display: block;
50
+ }
21
51
  }
22
52
 
23
53
  .ams-menu__list {
@@ -35,7 +65,7 @@
35
65
  .ams-menu__link {
36
66
  align-items: flex-start;
37
67
  color: var(--ams-menu-link-color);
38
- display: flex;
68
+ display: inline-flex; // Inline display prevents an excessive hit area next to the link text.
39
69
  gap: var(--ams-menu-link-gap);
40
70
  outline-offset: var(--ams-menu-link-outline-offset);
41
71
  padding-block: var(--ams-menu-link-padding-block);
@@ -55,16 +85,19 @@
55
85
 
56
86
  @media screen and (min-width: $ams-breakpoint-wide) {
57
87
  align-items: center;
88
+ display: flex; // The links do stretch in the vertical layout of Menu.
58
89
  flex-direction: column;
59
- gap: 0;
90
+ gap: var(--ams-menu-link-wide-gap);
91
+ text-align: center;
60
92
 
61
93
  .ams-menu__icon {
62
- --ams-icon-font-size: var(--ams-icon-heading-3-font-size);
63
- --ams-icon-line-height: var(--ams-icon-heading-3-line-height);
94
+ --ams-icon-font-size: var(--ams-icon-heading-2-font-size);
95
+ --ams-icon-line-height: var(--ams-icon-heading-2-line-height);
64
96
  }
65
97
  }
66
98
  }
67
99
 
100
+ /** @deprecated The menu has a dark background now, so this is no longer needed. */
68
101
  .ams-menu__link--contrast {
69
102
  color: var(--ams-menu-link-contrast-color);
70
103
 
@@ -73,6 +106,7 @@
73
106
  }
74
107
  }
75
108
 
109
+ /** @deprecated The menu has a dark background now, so this is no longer needed. */
76
110
  .ams-menu__link--inverse {
77
111
  color: var(--ams-menu-link-inverse-color);
78
112
 
@@ -2,22 +2,10 @@
2
2
 
3
3
  # Page
4
4
 
5
- Contains the entire website.
6
- Sets the background colour and its maximum width, and is horizontally centered.
5
+ Contains the entire website or application.
7
6
 
8
- ## Guidelines
9
-
10
- - The Page component must be used on all websites for the City of Amsterdam.
11
- Applications can use it as well, although a specific layout for them is in development.
12
- - It is the outermost container. Within it, combine components such as
13
- [Grid](https://designsystem.amsterdam/?path=/docs/components-layout-grid--docs),
14
- [Page Header](https://designsystem.amsterdam/?path=/docs/components-containers-page-header--docs),
15
- [Page Footer](https://designsystem.amsterdam/?path=/docs/components-containers-page-footer--docs),
16
- [Spotlight](https://designsystem.amsterdam/?path=/docs/components-containers-spotlight--docs),
17
- [Image Slider](https://designsystem.amsterdam/?path=/docs/components-media-image-slider--docs),
18
- and [Figure](https://designsystem.amsterdam/?path=/docs/components-media-figure--docs).
19
-
20
- ## Design
21
-
22
- The Page container sets the maximum width for a website of the City of Amsterdam, which is 1440 pixels.
23
- It horizontally centres both itself and its content and sets a white background.
7
+ The Page component wraps the [Page Header](https://designsystem.amsterdam/?path=/docs/components-containers-page-header--docs),
8
+ [Page Footer](https://designsystem.amsterdam/?path=/docs/components-containers-page-footer--docs), and the main content in between.
9
+ As a root layout component, it must be used for all websites and applications for the City of Amsterdam.
10
+ It is centered horizontally and sets a maximum width of 90 rems (usually 1.440 pixels).
11
+ With a Menu, that becomes 120 rems (1.920 pixels).
@@ -10,3 +10,36 @@
10
10
  min-block-size: 100vh; /* Fallback for browsers that do not support dvh */
11
11
  min-block-size: 100dvh;
12
12
  }
13
+
14
+ .ams-page--with-menu {
15
+ display: grid;
16
+ grid-auto-rows: min-content auto 1fr auto;
17
+ grid-template-areas:
18
+ "skip-link skip-link"
19
+ "menu header"
20
+ "menu body"
21
+ "menu footer";
22
+ grid-template-columns: auto 1fr;
23
+ max-inline-size: var(--ams-page-with-menu-max-inline-size);
24
+
25
+ > .ams-page__area--skip-link {
26
+ grid-area: skip-link;
27
+ margin-inline-end: var(--ams-page-with-menu-area-skip-link-margin-inline-end);
28
+ }
29
+
30
+ > .ams-page__area--menu {
31
+ grid-area: menu;
32
+ }
33
+
34
+ > .ams-page__area--header {
35
+ grid-area: header;
36
+ }
37
+
38
+ > .ams-page__area--body {
39
+ grid-area: body;
40
+ }
41
+
42
+ > .ams-page__area--footer {
43
+ grid-area: footer;
44
+ }
45
+ }
@@ -10,10 +10,11 @@ Includes the name of the application if it is not the general website.
10
10
  - The Page Header must be used on all websites and applications for the City of Amsterdam.
11
11
  - It includes the logo of the City or the organization, the site title (except for the general website), and a menu with links to commonly used pages.
12
12
  - The Page Header is important because it conveys our corporate identity and is the first thing people see.
13
- Using it consistently helps users recognize and trust the website.
13
+ Using it consistently helps users recognise and trust the website.
14
14
  - The Page Header is the same on every page of the application, although full-screen pages may hide it, e.g. a video or a map.
15
15
  - The inline menu can contain a maximum of 5 items.
16
16
  The last two will often be ‘Search’ and ‘Menu’.
17
+ - An icon can be added to such a menu item if it helps clarify it, e.g. for searching and for logging in and out.
17
18
  - The 'Menu' button opens a collapsible menu, which has room for more links.
18
19
  - On narrow windows, links can move from the inline menu to the collapsible one.
19
20
  - Labels should be short to help the inline menu fit on a single line whenever possible.
@@ -47,6 +47,10 @@
47
47
 
48
48
  .ams-page-header__logo-link--hidden {
49
49
  opacity: 0%;
50
+ -webkit-user-select: none;
51
+
52
+ /* Safari support is added with the prefixed property. */
53
+ /* stylelint-disable-next-line plugin/use-baseline */
50
54
  user-select: none; // The hidden logo link section should not be selectable
51
55
  }
52
56
 
@@ -65,6 +69,12 @@
65
69
  font-size: var(--ams-page-header-brand-name-font-size);
66
70
  font-weight: var(--ams-page-header-brand-name-font-weight);
67
71
  line-height: var(--ams-page-header-brand-name-line-height);
72
+
73
+ /*
74
+ * If text-wrap is not supported, it is ignored.
75
+ * This means the wrapped text will look less balanced, which is fine.
76
+ */
77
+ /* stylelint-disable-next-line plugin/use-baseline */
68
78
  text-wrap: var(--ams-page-header-brand-name-text-wrap);
69
79
  }
70
80
 
@@ -128,7 +138,8 @@
128
138
  }
129
139
 
130
140
  .ams-page-header__menu-link {
131
- display: inline-block;
141
+ display: inline-flex;
142
+ gap: var(--ams-page-header-menu-link-gap);
132
143
  text-decoration-line: var(--ams-page-header-menu-link-text-decoration-line);
133
144
  text-decoration-thickness: var(--ams-page-header-menu-link-text-decoration-thickness);
134
145
  text-underline-offset: var(--ams-page-header-menu-link-text-underline-offset);
@@ -181,45 +192,41 @@
181
192
  .ams-page-header__mega-menu-button-hidden-label {
182
193
  font-weight: var(--ams-page-header-mega-menu-button-label-open-font-weight);
183
194
  pointer-events: none;
195
+ -webkit-user-select: none;
196
+
197
+ /* Safari support is added with the prefixed property. */
198
+ /* stylelint-disable-next-line plugin/use-baseline */
184
199
  user-select: none;
185
200
  visibility: hidden;
186
201
  }
187
202
 
188
- .ams-page-header__menu-icon {
189
- line {
190
- stroke: currentColor;
191
- stroke-width: 3px;
192
- transform-origin: center;
193
- transition:
194
- translate 0.1s ease-in-out,
195
- rotate 0.2s ease-in-out,
196
- opacity 0.1s ease-in-out;
203
+ .ams-page-header__menu-icon-top,
204
+ .ams-page-header__menu-icon-middle,
205
+ .ams-page-header__menu-icon-bottom {
206
+ transform-origin: center;
207
+ transition:
208
+ opacity 0.1s ease-in-out,
209
+ rotate 0.2s ease-in-out,
210
+ translate 0.1s ease-in-out;
197
211
 
198
- @media (prefers-reduced-motion) {
199
- transition: none;
200
- }
201
- }
202
-
203
- .ams-page-header__menu-icon-top {
204
- translate: 0 -7px;
205
- }
206
-
207
- .ams-page-header__menu-icon-bottom {
208
- translate: 0 7px;
212
+ @media (prefers-reduced-motion) {
213
+ transition: none;
209
214
  }
210
215
  }
211
216
 
212
217
  .ams-page-header__menu-icon--open {
213
218
  .ams-page-header__menu-icon-top {
214
219
  rotate: 45deg;
215
- translate: 0;
220
+ translate: -4px 4px;
216
221
  }
222
+
217
223
  .ams-page-header__menu-icon-middle {
218
224
  opacity: 0%;
219
225
  }
226
+
220
227
  .ams-page-header__menu-icon-bottom {
221
228
  rotate: -45deg;
222
- translate: 0;
229
+ translate: -4px -4px;
223
230
  }
224
231
  }
225
232
 
@@ -13,6 +13,7 @@
13
13
  /* @deprecated We no longer use this size of headings. Use `.ams-heading.ams-heading--1` instead. */
14
14
  .ams-page-heading {
15
15
  box-sizing: border-box;
16
+ /* stylelint-disable-next-line plugin/use-baseline */
16
17
  break-after: avoid;
17
18
  break-inside: avoid;
18
19
  color: var(--ams-page-heading-color);
@@ -20,6 +21,7 @@
20
21
  font-size: var(--ams-page-heading-font-size);
21
22
  font-weight: var(--ams-page-heading-font-weight);
22
23
  line-height: var(--ams-page-heading-line-height);
24
+ /* stylelint-disable-next-line plugin/use-baseline */
23
25
  text-wrap: var(--ams-page-heading-text-wrap);
24
26
 
25
27
  @include hyphenation;
@@ -77,6 +77,10 @@
77
77
  .ams-tabs__button-label-hidden {
78
78
  font-weight: var(--ams-tabs-button-selected-font-weight);
79
79
  pointer-events: none;
80
+ -webkit-user-select: none;
81
+
82
+ /* Safari support is added with the prefixed property. */
83
+ /* stylelint-disable-next-line plugin/use-baseline */
80
84
  user-select: none;
81
85
  visibility: hidden;
82
86
  }
@@ -65,15 +65,22 @@
65
65
  box-shadow: var(--ams-text-area-invalid-hover-box-shadow);
66
66
  }
67
67
 
68
+ /*
69
+ * Resizing is not fully supported in Safari on iOS.
70
+ * This is acceptable, it is not crucial functionality.
71
+ */
68
72
  .ams-text-area--resize-none {
73
+ /* stylelint-disable-next-line plugin/use-baseline */
69
74
  resize: none;
70
75
  }
71
76
 
72
77
  .ams-text-area--resize-horizontal {
78
+ /* stylelint-disable-next-line plugin/use-baseline */
73
79
  resize: inline;
74
80
  }
75
81
 
76
82
  .ams-text-area--resize-vertical {
83
+ /* stylelint-disable-next-line plugin/use-baseline */
77
84
  resize: block;
78
85
  }
79
86
 
@@ -54,12 +54,12 @@
54
54
  // This changes the default calendar icon on Chromium browsers only
55
55
  .ams-time-input::-webkit-calendar-picker-indicator {
56
56
  appearance: none;
57
- background-image: var(--ams-time-input-calender-picker-indicator-background-image);
58
- cursor: var(--ams-time-input-calender-picker-indicator-cursor);
57
+ background-image: var(--ams-time-input-calendar-picker-indicator-background-image);
58
+ cursor: var(--ams-time-input-calendar-picker-indicator-cursor);
59
59
  }
60
60
 
61
61
  .ams-time-input:hover::-webkit-calendar-picker-indicator {
62
- background-image: var(--ams-time-input-hover-calender-picker-indicator-background-image);
62
+ background-image: var(--ams-time-input-hover-calendar-picker-indicator-background-image);
63
63
  }
64
64
 
65
65
  .ams-time-input:disabled {
@@ -68,7 +68,7 @@
68
68
  }
69
69
 
70
70
  .ams-time-input:disabled::-webkit-calendar-picker-indicator {
71
- background-image: var(--ams-time-input-disabled-calender-picker-indicator-background-image);
71
+ background-image: var(--ams-time-input-disabled-calendar-picker-indicator-background-image);
72
72
  visibility: visible;
73
73
  }
74
74
 
@@ -6,11 +6,14 @@
6
6
  // Source: https://css-tricks.com/inclusively-hidden/
7
7
  .ams-visually-hidden:not(:active, :focus) {
8
8
  block-size: 1px;
9
- clip: rect(0 0 0 0);
10
9
  clip-path: inset(50%);
11
10
  inline-size: 1px;
12
11
  overflow: hidden;
13
12
  position: absolute;
13
+ -webkit-user-select: none;
14
+
15
+ /* Safari support is added with the prefixed property. */
16
+ /* stylelint-disable-next-line plugin/use-baseline */
14
17
  user-select: none;
15
18
  white-space: nowrap;
16
19
  }