@miljodirektoratet/md-css 0.0.22 → 1.0.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": "0.0.22",
3
+ "version": "1.0.0",
4
4
  "description": "CSS for Miljødirektoratet",
5
5
  "author": "Miljødirektoratet",
6
6
  "main": "./src/index.css",
@@ -1,20 +1,24 @@
1
1
  .md-accordion-item {
2
- padding: 1em;
3
- background-color: var(--mdPrimaryColor20);
4
- border: 1px solid var(--mdPrimaryColor20);
2
+ background-color: var(--mdPrimaryColor10);
3
+ border: 1px solid var(--mdGreyColor60);
5
4
  color: var(--mdGreyColor);
6
5
  font-family: 'Open sans';
7
6
  margin-bottom: 1em;
7
+ transition: all .2s linear;
8
8
  }
9
9
 
10
10
  .md-accordion-item:focus-within {
11
- outline: 2px solid var(--mdPrimaryColor80);
12
- outline-offset: -2px;
11
+ /* outline: 2px solid var(--mdPrimaryColor80);
12
+ outline-offset: -2px; */
13
+ outline: none;
14
+ }
15
+
16
+ .md-accordion-item.md-accordion-item--rounded {
17
+ border-radius: 4px;
13
18
  }
14
19
 
15
20
  .md-accordion-item.md-accordion-item--secondary {
16
21
  background-color: var(--mdSecondaryColor60);
17
- border: 1px solid var(--mdSecondaryColor60);
18
22
  }
19
23
 
20
24
  .md-accordion-item.md-accordion-item--add {
@@ -27,6 +31,21 @@
27
31
  border: 1px solid var(--mdPrimaryColor20);
28
32
  }
29
33
 
34
+ .md-accordion-item:not(.md-accordion-item--expanded):hover {
35
+ transition: all .2s linear;
36
+ background-color: var(--mdPrimaryColor20);
37
+ }
38
+
39
+ .md-accordion-item.md-accordion-item--secondary:not(.md-accordion-item--expanded):hover {
40
+ transition: all .2s linear;
41
+ background-color: var(--mdSecondaryColor);
42
+ }
43
+
44
+ .md-accordion-item.md-accordion-item--add:not(.md-accordion-item--expanded):hover {
45
+ transition: all .2s linear;
46
+ background-color: transparent;
47
+ }
48
+
30
49
  /* Header */
31
50
  .md-accordion-item__header {
32
51
  display: flex;
@@ -36,9 +55,10 @@
36
55
  border: 0;
37
56
  width: 100%;
38
57
  margin: 0;
39
- padding: 1em;
58
+ padding: 1.5em 1.8em;
40
59
  cursor: pointer;
41
60
  text-align: left;
61
+ line-height: 24px;
42
62
  }
43
63
 
44
64
  .md-accordion-item__header:focus {
@@ -87,20 +107,23 @@
87
107
  }
88
108
 
89
109
  .md-accordion-item__header-label {
90
- font-size: 1.25em;
110
+ font-size: 20px;
91
111
  margin-left: 1em;
92
112
  }
113
+ .md-accordion-item__header:hover .md-accordion-item__header-label {
114
+ text-decoration: underline;
115
+ }
93
116
 
94
117
  /* CONTENT */
95
118
  .md-accordion-item__content {
96
- padding: 0 1em;
119
+ padding: 0 1.8em;
97
120
  max-height: 0;
98
121
  overflow: hidden;
99
122
  transition: all .15s linear;
100
123
  }
101
124
  .md-accordion-item__content--expanded {
102
125
  max-height: 5000px;
103
- padding: 1em;
126
+ padding: 1em 1.8em 1.5em 1.8em;
104
127
  transition: all .15s linear;
105
128
  }
106
129
 
@@ -115,6 +138,10 @@
115
138
  font-size: 16px;
116
139
  }
117
140
 
141
+ .md-accordion-item__close-button:hover {
142
+ text-decoration: underline;
143
+ }
144
+
118
145
  .md-accordion-item__close-button:focus {
119
146
  outline: 2px solid var(--mdPrimaryColor80);
120
147
  outline-offset: 2px;
@@ -0,0 +1,67 @@
1
+ # Multiselect
2
+
3
+ To use the `Multiselect` css as a standalone, without the accompanying React component, please use the following HTML structure.
4
+
5
+ Class names 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 className="md-select [md-multiselect--open, md-multiselect--disabled, md-multiselect--error, md-multiselect--medium, md-multiselect--small]">
11
+ <div className="md-multiselect__label">
12
+ <div>{label}</div>
13
+
14
+ <div className="md-multiselect__help-button">
15
+ <MdHelpButton/> <- see MdHelpButton styles
16
+ </div>
17
+ </div>
18
+
19
+ <div className="md-multiselect__help-text [md-multiselect__help-text--open]">
20
+ <MdHelpText>{ helpText }</MdHelpText> <- see MdHelpText styles
21
+ </div>
22
+
23
+ <MdClickOutsideWrapper> <- optional wrapper to close selectbox when clicking outside
24
+ <button
25
+ className="md-multiselect__button [md-multiselect__button--open]"
26
+ tabIndex={0}
27
+ onClick={function to toggle expand|collapse}
28
+ >
29
+ <div className="md-multiselect__button-text">{displayValue}</div>
30
+ {number of selected items > 1 && !open &&
31
+ <div className="md-multiselect__button-hasmultiple">+{selected.length - 1}</div>
32
+ }
33
+ <div className="md-multiselect__button-icon">
34
+ <MdChevronIcon />
35
+ </div>
36
+ </button>
37
+
38
+ <div className="md-multiselect__dropdown [md-multiselect__dropdown--open]">
39
+ <div
40
+ className="md-multiselect__dropdown-item [md-multiselect__dropdown-item--selected]"
41
+ >
42
+ {IMPORTANT! see MdCheckbox styles for description for the individual checkboxes}
43
+ <MdCheckbox
44
+ label={option.text}
45
+ tabIndex={open ? 0 : -1}
46
+ checked={true|false}
47
+ value={option.value}
48
+ id="id-for-checkbox"
49
+ disabled={true|false}
50
+ data-value={option.value}
51
+ data-text={option.text}
52
+ onChange={function for change handling}
53
+ />
54
+ ...
55
+ ...
56
+ </div>
57
+ </div>
58
+ </MdClickOutsideWrapper>
59
+
60
+ <div className="md-multiselect__error">{errorText}</div>
61
+
62
+ <div className="md-multiselect__chips">
63
+ To show input chips for selected options, see doc for MdInputChip. These can be listed here.
64
+ </div>
65
+ }
66
+ </div>
67
+ ```
@@ -0,0 +1,52 @@
1
+ # Select
2
+
3
+ To use the `Select` css as a standalone, without the accompanying React component, please use the following HTML structure.
4
+
5
+ Class names 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 className="md-select [md-select--open, md-select--disabled, md-select--medium, md-select--small]">
11
+ <div className="md-select__label">
12
+ <div>{label}</div>
13
+ <div className="md-select__help-button">
14
+ {button to trigger help text}
15
+ </div>
16
+ </div>
17
+
18
+ <div className="md-select__help-text [md-select__help-text--open]">
19
+ {helpText}
20
+ </div>
21
+
22
+ <MdClickOutsideWrapper> <- optional wrapper to close selectbox when clicking outside
23
+ <button
24
+ className="md-select__button [md-select__button--open]"
25
+ tabIndex={0}
26
+ onClick={function to toggle expand|collapse}
27
+ >
28
+ <div className="md-select__button-text">{displayValue}</div>
29
+ <div className="md-select__button-icon">
30
+ <MdChevronIcon />
31
+ </div>
32
+ </button>
33
+
34
+ <div className="md-select__dropdown">
35
+ <button
36
+ tabIndex={open ? 0: -1}
37
+ className="md-select__dropdown-item [md-select__dropdown-item--selected]"
38
+ onClick={function to handle select|deselect option}
39
+ >
40
+ <div className="md-select__dropdown-item-text">{option.text}</div>
41
+
42
+ {if seleceted option
43
+ <div className="md-select__dropdown-item-clear" title="Klikk for å fjerne valg">
44
+ <MdXIcon />
45
+ </div>
46
+ }
47
+
48
+ </button>
49
+ </div>
50
+ </MdClickOutsideWrapper>
51
+ </div>
52
+ ```
@@ -0,0 +1,41 @@
1
+ # Textarea
2
+
3
+ To use the `Textarea` css as a standalone, without the accompanying React component, please use the following HTML structure.
4
+
5
+ Class names 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 className="md-textarea__outer-wrapper">
11
+ <div className="md-textarea__label">
12
+ <label htmlFor="id-for-text-area">
13
+ {label}
14
+ </label>
15
+
16
+ <div className="md-textarea__help-button">
17
+ {button to trigger help text}
18
+ </div>
19
+ }
20
+ </div>
21
+
22
+ <div className="md-textarea__help-text [md-textarea__help-text--open]">
23
+ {helpText}
24
+ </div>
25
+
26
+ <div className="md-textarea__wrapper">
27
+ <textarea
28
+ id="id-for-text-area"
29
+ className="md-textarea [md-textarea--disabled, md-textarea--readonly, md-textarea--error]"
30
+ value={value}
31
+ rows={number}
32
+ placeholder="Placeholder text"
33
+ disabled={true requires class 'md-textarea--disabled'}
34
+ readOnly={true requires class 'md-textarea--readonly'}
35
+ ...
36
+ />
37
+ </div>
38
+
39
+ <div className="md-textarea__error">{errorText}</div>
40
+ </div>
41
+ ```
package/src/index.css CHANGED
@@ -16,10 +16,10 @@
16
16
  @import './formElements/input/input.css';
17
17
  @import './formElements/checkbox/checkbox.css';
18
18
  @import './formElements/checkboxgroup/checkboxgroup.css';
19
- @import './formElements/textarea.css';
20
- @import './formElements/select.css';
19
+ @import './formElements/textarea/textarea.css';
20
+ @import './formElements/select/select.css';
21
21
  @import './formElements/radiogroup.css';
22
- @import './formElements/multiselect.css';
22
+ @import './formElements/multiselect/multiselect.css';
23
23
  @import './formElements/fileupload/fileupload.css';
24
24
  @import './utils.css';
25
25
 
File without changes