@miljodirektoratet/md-css 6.24.0 → 6.26.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miljodirektoratet/md-css",
3
- "version": "6.24.0",
3
+ "version": "6.26.0",
4
4
  "description": "CSS for Miljødirektoratet",
5
5
  "author": "Miljødirektoratet",
6
6
  "main": "./src/index.css",
package/src/index.css CHANGED
@@ -24,8 +24,10 @@
24
24
  @import './infoTag/infoTag.css';
25
25
  @import './link/link.css';
26
26
  @import './loadingSpinner/loadingSpinner.css';
27
+ @import './menu/menu.css';
27
28
  @import './messages/alertMessage.css';
28
29
  @import './modal/modal.css';
30
+ @import './pagination/pagination.css';
29
31
  @import './skipToMainContent/skipToMainContent.css';
30
32
  @import './stepper/stepper.css';
31
33
  @import './tabs/tabs.css';
@@ -0,0 +1,44 @@
1
+ # Menu
2
+
3
+ A dropdown menu component for accessing commands and actions. Built on [Ariakit Menu](https://ariakit.org/components/menu).
4
+
5
+ ## HTML Structure
6
+
7
+ ```html
8
+ <!-- Trigger (rendered as-is, Ariakit adds aria-haspopup / aria-expanded) -->
9
+ <button>Open menu</button>
10
+
11
+ <!-- Menu popup -->
12
+ <div class="md-menu" role="menu">
13
+
14
+ <!-- Group (optional) -->
15
+ <div class="md-menu__group" role="group">
16
+
17
+ <!-- Group heading (optional) -->
18
+ <div class="md-menu__group-heading">Heading</div>
19
+
20
+ <!-- Menu item -->
21
+ <div class="md-menu__item" role="menuitem">
22
+ <!-- Icon (optional) -->
23
+ <span class="md-menu__item-icon" aria-hidden="true">
24
+ <!-- SVG icon -->
25
+ </span>
26
+ <span class="md-menu__item-label">Item label</span>
27
+ </div>
28
+
29
+ </div>
30
+
31
+ <!-- Separator (optional, shown between groups when showDividers=true) -->
32
+ <hr class="md-menu__separator" />
33
+
34
+ </div>
35
+ ```
36
+
37
+ ## Modifiers
38
+
39
+ | Class | Description |
40
+ |-------|-------------|
41
+ | `md-menu--small` | Small size variant |
42
+ | `md-menu--large` | Large size variant |
43
+ | `md-menu__item[data-active-item]` | Applied by Ariakit to the currently focused item |
44
+ | `md-menu__item[aria-disabled="true"]` | Disabled item state |
@@ -0,0 +1,138 @@
1
+ /* Menu popup */
2
+ .md-menu {
3
+ background: var(--md-color-background-primary);
4
+ box-shadow: 0 var(--md-size-4) var(--md-size-8) 0 rgba(0, 0, 0, 0.12),
5
+ 0 var(--md-size-2) var(--md-size-4) 0 rgba(0, 0, 0, 0.12),
6
+ 0 0 1px 0 rgba(0, 0, 0, 0.14);
7
+ border-radius: var(--md-radius-sm);
8
+ border: none;
9
+ padding: var(--md-size-4) 0;
10
+ min-width: 180px;
11
+ z-index: 950;
12
+ outline: none;
13
+ font-family: var(--md-typography-family-body);
14
+ }
15
+
16
+ /* Menu item */
17
+ .md-menu__item {
18
+ display: flex;
19
+ padding: var(--md-size-12) var(--md-size-16);
20
+ align-items: center;
21
+ gap: var(--md-size-8);
22
+ align-self: stretch;
23
+ font-family: var(--md-typography-family-body);
24
+ font-size: var(--md-typography-size-14);
25
+ font-weight: var(--md-typography-weight-regular);
26
+ color: var(--md-color-text-primary);
27
+ background: transparent;
28
+ border: none;
29
+ width: 100%;
30
+ text-align: left;
31
+ cursor: pointer;
32
+ line-height: var(--md-typography-line-height-medium);
33
+ transition: background-color 100ms ease-in-out;
34
+ }
35
+
36
+ .md-menu__item:hover:not([aria-disabled='true']) {
37
+ background: var(--md-color-cta-secondary-hover, #ccdfde);
38
+ }
39
+
40
+ .md-menu__item:active:not([aria-disabled='true']) {
41
+ background: var(--md-color-cta-secondary-active, #b2cece);
42
+ }
43
+
44
+ .md-menu__item[data-active-item] {
45
+ background: var(--md-color-cta-secondary-hover, #ccdfde);
46
+ }
47
+
48
+ .md-menu__item[aria-disabled='true'] {
49
+ color: var(--md-color-text-disabled);
50
+ cursor: not-allowed;
51
+ background: transparent;
52
+ }
53
+
54
+ /* Item icon */
55
+ .md-menu__item-icon {
56
+ display: flex;
57
+ align-items: center;
58
+ justify-content: center;
59
+ width: var(--md-size-20);
60
+ height: var(--md-size-20);
61
+ flex-shrink: 0;
62
+ }
63
+
64
+ /* Item label */
65
+ .md-menu__item-label {
66
+ flex: 1;
67
+ }
68
+
69
+ /* Group */
70
+ .md-menu__group {
71
+ display: flex;
72
+ flex-direction: column;
73
+ }
74
+
75
+ /* Group heading */
76
+ .md-menu__group-heading {
77
+ font-family: var(--md-typography-family-label);
78
+ font-size: var(--md-typography-size-16);
79
+ font-style: normal;
80
+ font-weight: var(--md-typography-weight-medium);
81
+ line-height: var(--md-typography-line-height-small);
82
+ color: var(--md-color-text-disabled);
83
+ padding: var(--md-size-8) var(--md-size-16) var(--md-size-4);
84
+ }
85
+
86
+ /* Separator */
87
+ .md-menu__separator {
88
+ display: flex;
89
+ padding: var(--md-size-4) var(--md-size-16);
90
+ justify-content: center;
91
+ align-items: center;
92
+ align-self: stretch;
93
+ border: none;
94
+ margin: 0;
95
+ background: none;
96
+ }
97
+
98
+ .md-menu__separator::before {
99
+ content: '';
100
+ display: block;
101
+ height: 1px;
102
+ flex: 1;
103
+ background: var(--md-color-border-secondary);
104
+ }
105
+
106
+ /* ── Small size ─────────────────────────────────── */
107
+ .md-menu--small .md-menu__item {
108
+ padding: var(--md-size-8) var(--md-size-12);
109
+ gap: var(--md-size-4);
110
+ align-items: center;
111
+ align-self: stretch;
112
+ }
113
+
114
+ .md-menu--small .md-menu__item-icon {
115
+ width: var(--md-size-16);
116
+ height: var(--md-size-16);
117
+ }
118
+
119
+ .md-menu--small .md-menu__group-heading {
120
+ padding: var(--md-size-4) var(--md-size-12) var(--md-size-4);
121
+ }
122
+
123
+ /* ── Large size ─────────────────────────────────── */
124
+ .md-menu--large .md-menu__item {
125
+ padding: var(--md-size-16) var(--md-size-20);
126
+ gap: var(--md-size-12);
127
+ align-items: center;
128
+ align-self: stretch;
129
+ }
130
+
131
+ .md-menu--large .md-menu__item-icon {
132
+ width: var(--md-size-24);
133
+ height: var(--md-size-24);
134
+ }
135
+
136
+ .md-menu--large .md-menu__group-heading {
137
+ padding: var(--md-size-12) var(--md-size-20) var(--md-size-4);
138
+ }
@@ -0,0 +1,37 @@
1
+ # Structure
2
+
3
+ To use the `Pagination` css in `@miljodirektoratet/md-css` as a standalone, without the accompanying React component, please use the following HTML structure.
4
+
5
+ Class names and elements in brackets [] are optional-/togglable-/decorator- or state dependant classes.
6
+
7
+ See [Storybook](https://miljodir.github.io/md-components) for examples and more info.
8
+
9
+ ```html
10
+ <div class="md-pagination [md-pagination--compact]">
11
+ <button class="md-pagination__nav" aria-label="Forrige">
12
+ <span class="md-pagination__nav-icon">{chevronBackwardIcon}</span>
13
+ <span class="md-pagination__nav-label">Forrige</span>
14
+ </button>
15
+
16
+ <div class="md-pagination__pages">
17
+ <div class="md-pagination__pages-desktop">
18
+ <button class="md-pagination__page">1</button>
19
+ <span class="md-pagination__page md-pagination__page--active" aria-current="page">2</span>
20
+ <button class="md-pagination__page">3</button>
21
+ <span class="md-pagination__ellipsis">...</span>
22
+ <button class="md-pagination__page">10</button>
23
+ </div>
24
+
25
+ <div class="md-pagination__pages-compact [md-pagination__pages-compact--force]">
26
+ <button class="md-pagination__page">1</button>
27
+ <span class="md-pagination__page md-pagination__page--active" aria-current="page">2</span>
28
+ <button class="md-pagination__page">3</button>
29
+ </div>
30
+ </div>
31
+
32
+ <button class="md-pagination__nav" aria-label="Neste">
33
+ <span class="md-pagination__nav-label">Neste</span>
34
+ <span class="md-pagination__nav-icon">{chevronForwardIcon}</span>
35
+ </button>
36
+ </div>
37
+ ```
@@ -0,0 +1,148 @@
1
+ .md-pagination {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ gap: var(--md-size-8);
6
+ font-family: var(--md-typography-family-body);
7
+ font-size: var(--md-typography-size-16);
8
+ }
9
+
10
+ .md-pagination__nav {
11
+ display: flex;
12
+ align-items: center;
13
+ gap: var(--md-size-4);
14
+ padding: var(--md-size-8) var(--md-size-12);
15
+ color: var(--md-color-cta-primary-default);
16
+ background-color: transparent;
17
+ border: none;
18
+ border-radius: var(--md-radius-md);
19
+ cursor: pointer;
20
+ transition: background-color 200ms ease-in-out;
21
+ text-decoration: none;
22
+ font-family: inherit;
23
+ font-size: inherit;
24
+ line-height: 1.5;
25
+ }
26
+
27
+ .md-pagination__nav:hover:not(:disabled):not([aria-disabled='true']) {
28
+ background-color: var(--md-color-cta-secondary-hover);
29
+ }
30
+
31
+ .md-pagination__nav:focus-visible {
32
+ outline: var(--md-size-2) solid var(--md-color-cta-primary-focus);
33
+ outline-offset: var(--md-size-2);
34
+ }
35
+
36
+ .md-pagination__nav:disabled,
37
+ .md-pagination__nav[aria-disabled='true'] {
38
+ color: var(--md-color-text-disabled);
39
+ cursor: not-allowed;
40
+ pointer-events: none;
41
+ }
42
+
43
+ .md-pagination__nav-icon {
44
+ display: flex;
45
+ align-items: center;
46
+ width: var(--md-size-20);
47
+ height: var(--md-size-20);
48
+ }
49
+
50
+ .md-pagination__nav-label {
51
+ display: inline;
52
+ }
53
+
54
+ .md-pagination__pages {
55
+ display: flex;
56
+ align-items: center;
57
+ gap: var(--md-size-4);
58
+ }
59
+
60
+ .md-pagination__page {
61
+ display: flex;
62
+ align-items: center;
63
+ justify-content: center;
64
+ min-width: var(--md-size-40);
65
+ height: var(--md-size-40);
66
+ padding: 0 var(--md-size-12);
67
+ color: var(--md-color-cta-primary-default);
68
+ background-color: transparent;
69
+ border: none;
70
+ border-radius: var(--md-radius-md);
71
+ cursor: pointer;
72
+ transition: background-color 200ms ease-in-out;
73
+ text-decoration: none;
74
+ font-family: inherit;
75
+ font-size: inherit;
76
+ line-height: 1;
77
+ }
78
+
79
+ .md-pagination__page:hover:not(:disabled):not(.md-pagination__page--active) {
80
+ background-color: var(--md-color-cta-secondary-hover);
81
+ }
82
+
83
+ .md-pagination__page:focus-visible {
84
+ outline: var(--md-size-2) solid var(--md-color-cta-primary-focus);
85
+ outline-offset: var(--md-size-2);
86
+ }
87
+
88
+ .md-pagination__page--active {
89
+ background-color: var(--md-color-cta-primary-default);
90
+ color: var(--md-color-text-inverted);
91
+ cursor: default;
92
+ }
93
+
94
+ .md-pagination__page--active:focus-visible {
95
+ outline: var(--md-size-2) solid var(--md-color-text-inverted);
96
+ outline-offset: -4px;
97
+ }
98
+
99
+ .md-pagination__ellipsis {
100
+ display: flex;
101
+ align-items: center;
102
+ justify-content: center;
103
+ min-width: var(--md-size-40);
104
+ height: var(--md-size-40);
105
+ color: var(--md-color-cta-primary-default);
106
+ }
107
+
108
+ .md-pagination__pages-desktop {
109
+ display: flex;
110
+ align-items: center;
111
+ gap: var(--md-size-4);
112
+ }
113
+
114
+ .md-pagination__pages-compact {
115
+ display: none;
116
+ align-items: center;
117
+ gap: var(--md-size-4);
118
+ }
119
+
120
+ .md-pagination__pages-compact--force {
121
+ display: flex;
122
+ }
123
+
124
+ .md-pagination--compact .md-pagination__pages-desktop {
125
+ display: none;
126
+ }
127
+
128
+ .md-pagination--compact .md-pagination__pages-compact {
129
+ display: flex;
130
+ }
131
+
132
+ .md-pagination--compact .md-pagination__nav-label {
133
+ display: none;
134
+ }
135
+
136
+ @media (max-width: 600px) {
137
+ .md-pagination__nav-label {
138
+ display: none;
139
+ }
140
+
141
+ .md-pagination__pages-desktop {
142
+ display: none;
143
+ }
144
+
145
+ .md-pagination__pages-compact {
146
+ display: flex;
147
+ }
148
+ }