@miljodirektoratet/md-css 6.25.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.25.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,6 +24,7 @@
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';
29
30
  @import './pagination/pagination.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
+ }