dibk-design 0.4.11 → 0.4.15
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/dist/components/Button.js +1 -0
- package/dist/components/CheckBoxIcon.module.scss +1 -0
- package/dist/components/CheckBoxListItem.js +3 -2
- package/dist/components/CheckBoxListItem.md +17 -0
- package/dist/components/CheckBoxListItem.module.scss +10 -5
- package/dist/components/NavigationBar.js +11 -2
- package/dist/components/NavigationBar.md +11 -0
- package/dist/components/RadioButtonIcon.module.scss +1 -0
- package/dist/components/RadioButtonListItem.js +1 -1
- package/dist/components/RadioButtonListItem.md +11 -0
- package/dist/components/RadioButtonListItem.module.scss +10 -5
- package/package.json +1 -1
|
@@ -86,6 +86,7 @@ var Button = /*#__PURE__*/function (_React$Component) {
|
|
|
86
86
|
var buttonProps = _objectSpread({}, this.props);
|
|
87
87
|
|
|
88
88
|
delete buttonProps.noHover;
|
|
89
|
+
delete buttonProps.rounded;
|
|
89
90
|
var themeStyle = this.props.theme ? this.getThemeStyle(this.props.theme, this.props.color) : null;
|
|
90
91
|
var className = "".concat(_ButtonModule.default.button, " ").concat(_ButtonModule.default[this.props.color], " ").concat(_ButtonModule.default[this.props.size], " ").concat(this.getArrowClass(), " ").concat(this.props.theme ? _ButtonModule.default.hasTheme : '', " ").concat(this.props.noHover ? _ButtonModule.default.noHover : '', " ").concat(this.props.rounded ? _ButtonModule.default.rounded : '');
|
|
91
92
|
return /*#__PURE__*/_react.default.createElement("button", _extends({}, buttonProps, {
|
|
@@ -52,7 +52,7 @@ var CheckBoxListItem = /*#__PURE__*/function (_React$Component) {
|
|
|
52
52
|
key: "render",
|
|
53
53
|
value: function render() {
|
|
54
54
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
-
className: "".concat(_CheckBoxListItemModule.default.checkBoxListItem, " ").concat(this.props.checked ? _CheckBoxListItemModule.default.checked : '', " ").concat(this.props.contentOnly ? _CheckBoxListItemModule.default.contentOnly : '')
|
|
55
|
+
className: "".concat(_CheckBoxListItemModule.default.checkBoxListItem, " ").concat(this.props.checked ? _CheckBoxListItemModule.default.checked : '', " ").concat(this.props.contentOnly ? _CheckBoxListItemModule.default.contentOnly : '', " ").concat(this.props.compact ? _CheckBoxListItemModule.default.compact : '')
|
|
56
56
|
}, /*#__PURE__*/_react.default.createElement(_CheckBoxInput.default, {
|
|
57
57
|
onChange: this.props.onChange,
|
|
58
58
|
checked: this.props.checked,
|
|
@@ -73,7 +73,8 @@ CheckBoxListItem.propTypes = {
|
|
|
73
73
|
name: _propTypes.default.string,
|
|
74
74
|
onChange: _propTypes.default.func.isRequired,
|
|
75
75
|
contentOnly: _propTypes.default.bool,
|
|
76
|
-
theme: _propTypes.default.object
|
|
76
|
+
theme: _propTypes.default.object,
|
|
77
|
+
compact: _propTypes.default.bool
|
|
77
78
|
};
|
|
78
79
|
CheckBoxListItem.defaultProps = {
|
|
79
80
|
checked: false,
|
|
@@ -15,6 +15,23 @@ Check box list item example:
|
|
|
15
15
|
</CheckBoxListItem>
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
Compact check box list item example:
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="checkbox" id="compact-checkboxListItem-1" compact>
|
|
22
|
+
Label for checked checkbox
|
|
23
|
+
</CheckBoxListItem>
|
|
24
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} name="checkbox" id="compact-checkboxListItem-2" compact>
|
|
25
|
+
Label for unchecked checkbox
|
|
26
|
+
</CheckBoxListItem>
|
|
27
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="checkbox" id="compact-checkboxListItem-3" contentOnly={true} compact>
|
|
28
|
+
Label for checked checkbox with content only
|
|
29
|
+
</CheckBoxListItem>
|
|
30
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} name="checkbox" id="compact-checkboxListItem-4" contentOnly={true} compact>
|
|
31
|
+
Label for unchecked checkbox with content only
|
|
32
|
+
</CheckBoxListItem>
|
|
33
|
+
```
|
|
34
|
+
|
|
18
35
|
Themed Check box list item example:
|
|
19
36
|
```js
|
|
20
37
|
import customTheme from 'data/customTheme';
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
:local(.checkBoxListItem) {
|
|
4
4
|
@include box-sizing(content-box);
|
|
5
|
-
@include box-shadow(0 0 2px $color-dark-blue);
|
|
6
5
|
@include border-radius(5px);
|
|
7
6
|
@include transition(all 0.1s ease-in-out);
|
|
8
7
|
display: -webkit-box;
|
|
@@ -19,13 +18,13 @@
|
|
|
19
18
|
font-size: 1rem;
|
|
20
19
|
color: #000;
|
|
21
20
|
|
|
22
|
-
&:not(:local(.contentOnly)) {
|
|
21
|
+
&:not(:local(.contentOnly)):not(:local(.compact)) {
|
|
22
|
+
@include box-shadow(0 0 2px $color-dark-blue);
|
|
23
23
|
background: white;
|
|
24
24
|
margin-bottom: 10px;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
&:local(.contentOnly) {
|
|
28
|
-
@include box-shadow(none);
|
|
29
28
|
cursor: auto;
|
|
30
29
|
label {
|
|
31
30
|
cursor: auto;
|
|
@@ -33,11 +32,11 @@
|
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
&:local(.checked):not(:local(.contentOnly)) {
|
|
35
|
+
&:local(.checked):not(:local(.contentOnly)):not(:local(.compact)) {
|
|
37
36
|
@include box-shadow(0 0 0 1px $color-dark-blue, 0 0 4px 0 $color-dark-blue);
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
&:not(:local(.checked)):not(:local(.contentOnly)):hover {
|
|
39
|
+
&:not(:local(.checked)):not(:local(.contentOnly)):not(:local(.compact)):hover {
|
|
41
40
|
@include box-shadow(0 0 6px $color-dark-blue);
|
|
42
41
|
}
|
|
43
42
|
|
|
@@ -52,6 +51,12 @@
|
|
|
52
51
|
cursor: pointer;
|
|
53
52
|
}
|
|
54
53
|
|
|
54
|
+
&:local(.compact){
|
|
55
|
+
label {
|
|
56
|
+
padding: 4px;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
input[type="checkbox"] {
|
|
56
61
|
opacity: 0;
|
|
57
62
|
position: absolute;
|
|
@@ -21,6 +21,8 @@ var _NavigationBarModule = _interopRequireDefault(require("./NavigationBar.modul
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
|
+
|
|
24
26
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
27
|
|
|
26
28
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -155,9 +157,13 @@ var NavigationBar = /*#__PURE__*/function (_React$Component) {
|
|
|
155
157
|
alt: "DIBK logo",
|
|
156
158
|
src: _dibkLogoMobile.default
|
|
157
159
|
});
|
|
158
|
-
|
|
160
|
+
var logoLinkProps = {
|
|
161
|
+
target: this.props.openLogoLinkInNewTab ? '_blank' : null,
|
|
162
|
+
rel: this.props.openLogoLinkInNewTab ? 'noopener noreferrer' : null
|
|
163
|
+
};
|
|
164
|
+
return logoLink && logoLink.length ? /*#__PURE__*/_react.default.createElement("a", _extends({}, logoLinkProps, {
|
|
159
165
|
href: logoLink
|
|
160
|
-
}, logoElement) : logoElement;
|
|
166
|
+
}), logoElement) : logoElement;
|
|
161
167
|
}
|
|
162
168
|
}, {
|
|
163
169
|
key: "render",
|
|
@@ -217,6 +223,9 @@ NavigationBar.propTypes = {
|
|
|
217
223
|
/** Link for logo */
|
|
218
224
|
logoLink: _propTypes.default.string,
|
|
219
225
|
|
|
226
|
+
/** Opens logo link in a new tab on click */
|
|
227
|
+
openLogoLinkInNewTab: _propTypes.default.bool,
|
|
228
|
+
|
|
220
229
|
/** Theme for navigation bar */
|
|
221
230
|
theme: _propTypes.default.object
|
|
222
231
|
};
|
|
@@ -4,11 +4,22 @@ NavigationBar example:
|
|
|
4
4
|
<NavigationBar primaryListItems={[{name: 'Primary item 1', listItems:['Sub item 1', 'Sub item 2']}, 'Primary item 2', {name: 'Primary item 3', href: '#'}]} secondaryListItems={['Secondary item 1', 'Secondary item 2']} />
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
NavigationBar without list items example
|
|
8
9
|
```js
|
|
9
10
|
<NavigationBar />
|
|
10
11
|
```
|
|
11
12
|
|
|
13
|
+
NavigationBar with logo link
|
|
14
|
+
```js
|
|
15
|
+
<NavigationBar logoLink="https://dibk.no/" />
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
NavigationBar with logo link that opens in new tab
|
|
19
|
+
```js
|
|
20
|
+
<NavigationBar logoLink="https://dibk.no/" openLogoLinkInNewTab />
|
|
21
|
+
```
|
|
22
|
+
|
|
12
23
|
NavigationBar with child elements
|
|
13
24
|
```js
|
|
14
25
|
<NavigationBar primaryListItems={[{name: 'Primary item 1', listItems:['Sub item 1', 'Sub item 2']}, 'Primary item 2', {name: 'Primary item 3', href: '#'}]} secondaryListItems={['Secondary item 1', 'Secondary item 2']} >
|
|
@@ -52,7 +52,7 @@ var RadioButtonListItem = /*#__PURE__*/function (_React$Component) {
|
|
|
52
52
|
key: "render",
|
|
53
53
|
value: function render() {
|
|
54
54
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
-
className: _RadioButtonListItemModule.default.radioButtonListItem
|
|
55
|
+
className: "".concat(_RadioButtonListItemModule.default.radioButtonListItem, " ").concat(this.props.compact ? _RadioButtonListItemModule.default.compact : '')
|
|
56
56
|
}, /*#__PURE__*/_react.default.createElement(_RadioButtonInput.default, {
|
|
57
57
|
onChange: this.props.onChange,
|
|
58
58
|
inputValue: this.props.inputValue,
|
|
@@ -9,6 +9,17 @@ Radio button list item example:
|
|
|
9
9
|
</RadioButtonListItem>
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
+
Compact radio button list item example:
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 1" name="compact-radio-button-list-item" id="compact-radio-button-list-item-1" checked={true} compact>
|
|
16
|
+
Checked radio button
|
|
17
|
+
</RadioButtonListItem>
|
|
18
|
+
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 2" name="compact-radio-button-list-item" id="compact-radio-button-list-item-2" compact>
|
|
19
|
+
Checked radio button
|
|
20
|
+
</RadioButtonListItem>
|
|
21
|
+
```
|
|
22
|
+
|
|
12
23
|
Themed Radio button list item example:
|
|
13
24
|
|
|
14
25
|
```js
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
:local(.radioButtonListItem) {
|
|
4
4
|
@include box-sizing(content-box);
|
|
5
|
-
@include box-shadow(0 0 2px $color-dark-blue);
|
|
6
5
|
@include border-radius(5px);
|
|
7
6
|
@include transition(all 0.1s ease-in-out);
|
|
8
7
|
display: -webkit-box;
|
|
@@ -19,13 +18,13 @@
|
|
|
19
18
|
font-size: 1rem;
|
|
20
19
|
color: #000;
|
|
21
20
|
|
|
22
|
-
&:not(:local(.contentOnly)) {
|
|
21
|
+
&:not(:local(.contentOnly)):not(:local(.compact)) {
|
|
22
|
+
@include box-shadow(0 0 2px $color-dark-blue);
|
|
23
23
|
background: white;
|
|
24
24
|
margin-bottom: 10px;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
&:local(.contentOnly) {
|
|
28
|
-
@include box-shadow(none);
|
|
29
28
|
cursor: auto;
|
|
30
29
|
label {
|
|
31
30
|
cursor: auto;
|
|
@@ -33,11 +32,11 @@
|
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
&:local(.checked):not(:local(.contentOnly)) {
|
|
35
|
+
&:local(.checked):not(:local(.contentOnly)):not(:local(.compact)) {
|
|
37
36
|
@include box-shadow(0 0 0 1px $color-dark-blue, 0 0 4px 0 $color-dark-blue);
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
&:not(:local(.checked)):not(:local(.contentOnly)):hover {
|
|
39
|
+
&:not(:local(.checked)):not(:local(.contentOnly)):not(:local(.compact)):hover {
|
|
41
40
|
@include box-shadow(0 0 6px $color-dark-blue);
|
|
42
41
|
}
|
|
43
42
|
|
|
@@ -52,6 +51,12 @@
|
|
|
52
51
|
cursor: pointer;
|
|
53
52
|
}
|
|
54
53
|
|
|
54
|
+
&:local(.compact) {
|
|
55
|
+
label {
|
|
56
|
+
padding: 4px;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
input[type="radio"] {
|
|
56
61
|
opacity: 0;
|
|
57
62
|
position: absolute;
|