@decisiv/ui-components 2.0.1-alpha.181 → 2.0.1-alpha.183
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/lib/atoms/OptionsList/{Category.d.ts → Category/index.d.ts} +2 -2
- package/lib/atoms/OptionsList/Category/index.d.ts.map +1 -0
- package/lib/atoms/OptionsList/{Category.js → Category/index.js} +11 -21
- package/lib/atoms/OptionsList/Category/styles.d.ts +6 -0
- package/lib/atoms/OptionsList/Category/styles.d.ts.map +1 -0
- package/lib/atoms/OptionsList/Category/styles.js +36 -0
- package/lib/atoms/OptionsList/{Option.d.ts → Option/index.d.ts} +2 -2
- package/lib/atoms/OptionsList/Option/index.d.ts.map +1 -0
- package/lib/atoms/OptionsList/{Option.js → Option/index.js} +25 -64
- package/lib/atoms/OptionsList/Option/styles.d.ts +17 -0
- package/lib/atoms/OptionsList/Option/styles.d.ts.map +1 -0
- package/lib/atoms/OptionsList/Option/styles.js +83 -0
- package/lib/atoms/OptionsList/index.d.ts.map +1 -1
- package/lib/atoms/OptionsList/index.js +11 -6
- package/lib/atoms/OptionsList/index.test.js +218 -202
- package/lib/atoms/OptionsList/schema.d.ts.map +1 -1
- package/lib/atoms/OptionsList/schema.js +2 -1
- package/lib/atoms/OptionsList/types.d.ts +18 -0
- package/lib/atoms/OptionsList/types.d.ts.map +1 -1
- package/lib/components/Avatar/AvatarContainer.d.ts +1 -13
- package/lib/components/Avatar/AvatarContainer.d.ts.map +1 -1
- package/lib/components/Avatar/AvatarContainer.js +12 -13
- package/lib/components/Avatar/AvatarContent.d.ts +2 -2
- package/lib/components/Avatar/AvatarContent.d.ts.map +1 -1
- package/lib/components/Avatar/AvatarContent.js +24 -20
- package/lib/components/Avatar/index.d.ts.map +1 -1
- package/lib/components/Avatar/index.js +39 -5
- package/lib/components/Avatar/index.test.js +4 -0
- package/lib/components/Avatar/schema.d.ts.map +1 -1
- package/lib/components/Avatar/schema.js +3 -1
- package/lib/components/Avatar/types.d.ts +15 -2
- package/lib/components/Avatar/types.d.ts.map +1 -1
- package/lib/components/CheckboxGroup/index.d.ts +1 -1
- package/lib/components/Link/DisabledLink.d.ts +1 -1
- package/lib/components/Link/styles.d.ts +5 -5
- package/lib/components/Link/styles.d.ts.map +1 -1
- package/lib/components/Tag/styles.d.ts.map +1 -1
- package/lib/components/Tag/styles.js +9 -43
- package/lib/modifiers/palette.d.ts +36 -0
- package/lib/modifiers/palette.d.ts.map +1 -0
- package/lib/modifiers/palette.js +88 -0
- package/package.json +2 -2
- package/lib/atoms/OptionsList/Category.d.ts.map +0 -1
- package/lib/atoms/OptionsList/Option.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const Category: ({ borderRadius, label, items, showCheckbox, }: import("
|
|
2
|
+
declare const Category: ({ borderRadius, label, items, showCheckbox, size, }: import("../types").Category) => JSX.Element;
|
|
3
3
|
export default Category;
|
|
4
|
-
//# sourceMappingURL=
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/atoms/OptionsList/Category/index.tsx"],"names":[],"mappings":";AAOA,QAAA,MAAM,QAAQ,mGA2Bb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -5,46 +5,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
9
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _toColorString = _interopRequireDefault(require("polished/lib/color/toColorString"));
|
|
10
|
+
var _Option = _interopRequireDefault(require("../Option"));
|
|
15
11
|
|
|
16
|
-
var
|
|
12
|
+
var _utils = require("../utils");
|
|
17
13
|
|
|
18
|
-
var
|
|
14
|
+
var _styles = require("./styles");
|
|
19
15
|
|
|
20
|
-
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
17
|
|
|
22
18
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
23
19
|
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
20
|
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); }
|
|
27
21
|
|
|
28
|
-
var StyledCategory = _styledComponents.default.li.attrs({
|
|
29
|
-
role: 'option',
|
|
30
|
-
'aria-disabled': true
|
|
31
|
-
}).withConfig({
|
|
32
|
-
displayName: "Category__StyledCategory",
|
|
33
|
-
componentId: "sc-1kvf2r-0"
|
|
34
|
-
})(["color:", ";font-size:", ";font-weight:", ";cursor:default;text-transform:uppercase;line-height:1.4;text-align:left;padding:", ";border-top:", " solid ", ";"], (0, _toColorString.default)(_designTokens.color.base.charcoal), (0, _rem.default)(_designTokens.typography.size.alias.paragraph2), _designTokens.typography.weight.alias.semibold, "".concat((0, _rem.default)(15), " ").concat((0, _rem.default)(30), " ").concat((0, _rem.default)(7), " ").concat((0, _rem.default)(10)), (0, _rem.default)(1), (0, _toColorString.default)(_designTokens.color.base.quarterMoon));
|
|
35
|
-
|
|
36
22
|
var Category = function Category(_ref) {
|
|
37
23
|
var borderRadius = _ref.borderRadius,
|
|
38
24
|
label = _ref.label,
|
|
39
25
|
items = _ref.items,
|
|
40
|
-
showCheckbox = _ref.showCheckbox
|
|
41
|
-
|
|
26
|
+
showCheckbox = _ref.showCheckbox,
|
|
27
|
+
size = _ref.size;
|
|
28
|
+
return _react.default.createElement(_react.Fragment, null, _react.default.createElement(_styles.StyledCategory, {
|
|
29
|
+
size: size
|
|
30
|
+
}, label), items.map(function (subItem) {
|
|
42
31
|
var id = (0, _utils.getId)(subItem);
|
|
43
32
|
return _react.default.createElement(_Option.default, _extends({}, subItem, {
|
|
44
33
|
key: id,
|
|
45
34
|
id: id,
|
|
46
35
|
borderRadius: borderRadius,
|
|
47
|
-
showCheckbox: showCheckbox
|
|
36
|
+
showCheckbox: showCheckbox,
|
|
37
|
+
size: size
|
|
48
38
|
}));
|
|
49
39
|
}));
|
|
50
40
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StyledCategoryProps } from '../types';
|
|
2
|
+
export declare const StyledCategory: import("styled-components").StyledComponent<"li", any, {
|
|
3
|
+
role: "option";
|
|
4
|
+
'aria-disabled': true;
|
|
5
|
+
} & StyledCategoryProps, "role" | "aria-disabled">;
|
|
6
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/atoms/OptionsList/Category/styles.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAmB/C,eAAO,MAAM,cAAc;;;kDAa1B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledCategory = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
|
|
11
|
+
|
|
12
|
+
var _toColorString = _interopRequireDefault(require("polished/lib/color/toColorString"));
|
|
13
|
+
|
|
14
|
+
var _designTokens = require("@decisiv/design-tokens");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
19
|
+
|
|
20
|
+
/* eslint-disable import/prefer-default-export */
|
|
21
|
+
var withCategorySizeModifiers = function withCategorySizeModifiers(props) {
|
|
22
|
+
var _props$size = props.size,
|
|
23
|
+
size = _props$size === void 0 ? 'small' : _props$size;
|
|
24
|
+
if (size === 'medium') return (0, _styledComponents.css)(["font-size:", ";padding:", ";"], (0, _rem.default)(_designTokens.typography.size.alias.paragraph), "".concat((0, _rem.default)(15), " ").concat((0, _rem.default)(30), " ").concat((0, _rem.default)(10), " ").concat((0, _rem.default)(10)));
|
|
25
|
+
return (0, _styledComponents.css)(["font-size:", ";padding:", ";"], (0, _rem.default)(_designTokens.typography.size.alias.paragraph2), "".concat((0, _rem.default)(15), " ").concat((0, _rem.default)(30), " ").concat((0, _rem.default)(7), " ").concat((0, _rem.default)(10)));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var StyledCategory = _styledComponents.default.li.attrs({
|
|
29
|
+
role: 'option',
|
|
30
|
+
'aria-disabled': true
|
|
31
|
+
}).withConfig({
|
|
32
|
+
displayName: "styles__StyledCategory",
|
|
33
|
+
componentId: "sc-17ahmuu-0"
|
|
34
|
+
})(["color:", ";cursor:default;text-transform:uppercase;line-height:1.4;text-align:left;border-top:", " solid ", ";font-weight:", ";", ""], (0, _toColorString.default)(_designTokens.color.base.charcoal), (0, _rem.default)(1), (0, _toColorString.default)(_designTokens.color.base.quarterMoon), _designTokens.typography.weight.alias.semibold, withCategorySizeModifiers);
|
|
35
|
+
|
|
36
|
+
exports.StyledCategory = StyledCategory;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { OptionProps } from '
|
|
2
|
+
import { OptionProps } from '../types';
|
|
3
3
|
declare function Option(props: OptionProps): JSX.Element;
|
|
4
4
|
declare const _default: React.MemoExoticComponent<typeof Option>;
|
|
5
5
|
export default _default;
|
|
6
|
-
//# sourceMappingURL=
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/atoms/OptionsList/Option/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAC/D,OAAO,EACL,WAAW,EAKZ,MAAM,UAAU,CAAC;AA4DlB,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAwH/C;;AAED,wBAAkC"}
|
|
@@ -5,35 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _color = _interopRequireDefault(require("@decisiv/design-tokens/lib/color"));
|
|
9
|
-
|
|
10
8
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
11
9
|
|
|
12
|
-
var _toColorString = _interopRequireDefault(require("polished/lib/color/toColorString"));
|
|
13
|
-
|
|
14
|
-
var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
|
|
15
|
-
|
|
16
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
11
|
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
var _focusRingWithColor = _interopRequireDefault(require("../../utils/focusRingWithColor"));
|
|
21
|
-
|
|
22
|
-
var _styleModifiers = require("../../utils/styleModifiers");
|
|
23
|
-
|
|
24
|
-
var _Typography = require("../../components/Typography");
|
|
12
|
+
var _context = require("../context");
|
|
25
13
|
|
|
26
|
-
var
|
|
14
|
+
var _Checkbox = _interopRequireDefault(require("../../../components/Checkbox"));
|
|
27
15
|
|
|
28
|
-
var
|
|
16
|
+
var _Avatar = _interopRequireDefault(require("../../../components/Avatar"));
|
|
29
17
|
|
|
30
|
-
var
|
|
18
|
+
var _Badge = _interopRequireDefault(require("../../../components/Badge"));
|
|
31
19
|
|
|
32
|
-
var
|
|
20
|
+
var _utils = require("../utils");
|
|
33
21
|
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
var _utils = require("./utils");
|
|
22
|
+
var _styles = require("./styles");
|
|
37
23
|
|
|
38
24
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
39
25
|
|
|
@@ -45,30 +31,12 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
45
31
|
|
|
46
32
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
47
33
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
var enabledFGColor = _color.default.interaction.pacificOcean;
|
|
54
|
-
var disabledFGColor = _color.default.opacity.charcoal40;
|
|
55
|
-
var StyledLink = (0, _styledComponents.default)(_Link.default).withConfig({
|
|
56
|
-
displayName: "Option__StyledLink",
|
|
57
|
-
componentId: "sc-679ny4-0"
|
|
58
|
-
})(["&&,&&:hover:not(:active),&&:focus:not(:active){text-decoration:none;", ";", ";}"], (0, _Link.linkColorStyles)(enabledFGColor, enabledFGColor, enabledFGColor), (0, _styleModifiers.when)('disabled', (0, _styledComponents.css)(["", ";cursor:not-allowed;"], (0, _Link.linkColorStyles)(disabledFGColor, disabledFGColor, disabledFGColor))));
|
|
59
|
-
|
|
60
|
-
var Container = _styledComponents.default.li.withConfig({
|
|
61
|
-
displayName: "Option__Container",
|
|
62
|
-
componentId: "sc-679ny4-1"
|
|
63
|
-
})(["text-align:left;&:focus{outline:none;}> .label,> ", "{align-items:center;border:1px solid transparent;color:", ";display:flex;padding:", ";pointer-events:none;width:100%;white-space:nowrap;> *{margin-right:", ";}}> ", "{pointer-events:auto;background-color:transparent;text-decoration:none;}&:first-child > .label,&:first-child > ", "{border-top-left-radius:", ";border-top-right-radius:", ";}&:last-child > .label,&:last-child > ", "{border-bottom-left-radius:", ";border-bottom-right-radius:", ";}&:hover:not([aria-disabled='true']):not([aria-selected='true']) > .label,&:hover:not([aria-disabled='true']):not([aria-selected='true']) > ", "{color:", ";text-decoration:none;.label > *{border-color:", ";}}&[aria-selected='true'] > .label{background:", ";color:", ";}&[aria-selected='true'] > .label > div > #optionLabelDetails{background:", ";color:", ";}", ";", " &[aria-disabled='true']{cursor:not-allowed;", "{pointer-events:none;}}&[aria-disabled='true'] > .label,&[aria-disabled='true'] > ", "{background:", ";color:", ";}"], StyledLink, (0, _toColorString.default)(_color.default.interaction.pacificOcean), "".concat((0, _rem.default)(5), " ").concat((0, _rem.default)(30), " ").concat((0, _rem.default)(5), " ").concat((0, _rem.default)(10)), (0, _rem.default)(10), StyledLink, StyledLink, getBorderRadius, getBorderRadius, StyledLink, getBorderRadius, getBorderRadius, StyledLink, (0, _toColorString.default)(_color.default.interaction.pacificOcean), (0, _toColorString.default)(_color.default.interaction.indianOcean), (0, _toColorString.default)(_color.default.interaction.pacificOcean), (0, _toColorString.default)(_color.default.base.snowWhite), (0, _toColorString.default)(_color.default.interaction.pacificOcean), (0, _toColorString.default)(_color.default.base.snowWhite), (0, _styleModifiers.when)('isActive', (0, _styledComponents.css)(["color:", ";background:", ";.label > *{border-color:", ";}"], (0, _toColorString.default)(_color.default.interaction.pacificOcean), (0, _toColorString.default)(_color.default.interaction.pacificOcean15), (0, _toColorString.default)(_color.default.interaction.indianOcean))), (0, _styleModifiers.when)([['isActive'], ['inputMethod', 'keyboard']], (0, _styledComponents.css)(["background:none;> .label,> ", "{border-color:", ";", "}&[aria-selected='true'] > .label,&[aria-selected='true'] > ", "{color:", ";", "}"], StyledLink, (0, _toColorString.default)(_color.default.interaction.pacificOcean), (0, _focusRingWithColor.default)(_color.default.interaction.pacificOcean40), StyledLink, (0, _toColorString.default)(_color.default.base.snowWhite), (0, _focusRingWithColor.default)(_color.default.opacity.fullMoon50))), StyledLink, StyledLink, (0, _toColorString.default)(_color.default.base.snowWhite), (0, _toColorString.default)(_color.default.opacity.charcoal40));
|
|
64
|
-
|
|
65
|
-
var StyleLabelWrapper = _styledComponents.default.div.withConfig({
|
|
66
|
-
displayName: "Option__StyleLabelWrapper",
|
|
67
|
-
componentId: "sc-679ny4-2"
|
|
68
|
-
})(["display:flex;flex:1;flex-direction:column;"]); // This is used below to silence a React warning about
|
|
34
|
+
var sizeMapping = {
|
|
35
|
+
small: 'small',
|
|
36
|
+
medium: undefined
|
|
37
|
+
}; // This is used below to silence a React warning about
|
|
69
38
|
// having a controlled input without a change handler.
|
|
70
39
|
|
|
71
|
-
|
|
72
40
|
var noop = process.env.NODE_ENV === 'production' ? undefined : function () {};
|
|
73
41
|
|
|
74
42
|
function isDecoration(decoration) {
|
|
@@ -99,12 +67,7 @@ function DecorationComponent(props) {
|
|
|
99
67
|
default:
|
|
100
68
|
return null;
|
|
101
69
|
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
var DecorationComponentContainer = _styledComponents.default.div.withConfig({
|
|
105
|
-
displayName: "Option__DecorationComponentContainer",
|
|
106
|
-
componentId: "sc-679ny4-3"
|
|
107
|
-
})(["", ";"], (0, _styleModifiers.when)('disabled', (0, _styledComponents.css)(["opacity:0.3;img{opacity:0.3;}"]))); // We always render the checkbox/radio inputs so that regular form
|
|
70
|
+
} // We always render the checkbox/radio inputs so that regular form
|
|
108
71
|
// submission (i.e. one not handled programmatically) still works.
|
|
109
72
|
|
|
110
73
|
|
|
@@ -116,7 +79,9 @@ function Option(props) {
|
|
|
116
79
|
borderRadius = props.borderRadius,
|
|
117
80
|
labelDetails = props.labelDetails,
|
|
118
81
|
_props$showCheckbox = props.showCheckbox,
|
|
119
|
-
showCheckbox = _props$showCheckbox === void 0 ? true : _props$showCheckbox
|
|
82
|
+
showCheckbox = _props$showCheckbox === void 0 ? true : _props$showCheckbox,
|
|
83
|
+
_props$size = props.size,
|
|
84
|
+
size = _props$size === void 0 ? 'small' : _props$size;
|
|
120
85
|
var decorationType = (0, _get.default)(decoration, 'type');
|
|
121
86
|
|
|
122
87
|
var _useOptionsList = (0, _context.useOptionsList)(),
|
|
@@ -147,8 +112,8 @@ function Option(props) {
|
|
|
147
112
|
if (!disabled) toggleItemSelection(id);
|
|
148
113
|
}, [toggleItemSelection, id, disabled]);
|
|
149
114
|
var LabelWrapper = (0, _react.useMemo)(function () {
|
|
150
|
-
return function (
|
|
151
|
-
var children =
|
|
115
|
+
return function (_ref) {
|
|
116
|
+
var children = _ref.children;
|
|
152
117
|
return selectable ? _react.default.createElement("label", {
|
|
153
118
|
className: "label"
|
|
154
119
|
}, children) : _react.default.createElement("div", {
|
|
@@ -156,7 +121,7 @@ function Option(props) {
|
|
|
156
121
|
}, children);
|
|
157
122
|
};
|
|
158
123
|
}, [selectable]);
|
|
159
|
-
return _react.default.createElement(Container, {
|
|
124
|
+
return _react.default.createElement(_styles.Container, {
|
|
160
125
|
"aria-disabled": !!disabled,
|
|
161
126
|
"aria-selected": checked,
|
|
162
127
|
borderRadius: borderRadius,
|
|
@@ -168,8 +133,9 @@ function Option(props) {
|
|
|
168
133
|
tabIndex: -1,
|
|
169
134
|
onMouseEnter: handleMouseEnter,
|
|
170
135
|
inputMethod: inputMethod,
|
|
171
|
-
role: itemRole
|
|
172
|
-
|
|
136
|
+
role: itemRole,
|
|
137
|
+
size: size
|
|
138
|
+
}, (0, _utils.isLink)(props) ? _react.default.createElement(_styles.StyledLink, {
|
|
173
139
|
tabIndex: -1,
|
|
174
140
|
to: props.linkTo,
|
|
175
141
|
text: label,
|
|
@@ -177,13 +143,13 @@ function Option(props) {
|
|
|
177
143
|
disabled: !!disabled
|
|
178
144
|
}) : _react.default.createElement(LabelWrapper, null, selectable && (multiple && !!showCheckbox ? _react.default.createElement(_Checkbox.default, _extends({}, commonProps, {
|
|
179
145
|
disabled: !!disabled,
|
|
180
|
-
size:
|
|
146
|
+
size: sizeMapping[size],
|
|
181
147
|
value: props.value
|
|
182
148
|
})) : _react.default.createElement("input", _extends({}, commonProps, {
|
|
183
149
|
type: "radio",
|
|
184
150
|
hidden: true,
|
|
185
151
|
value: props.value
|
|
186
|
-
}))), isDecoration(decoration) && _react.default.createElement(DecorationComponentContainer, {
|
|
152
|
+
}))), isDecoration(decoration) && _react.default.createElement(_styles.DecorationComponentContainer, {
|
|
187
153
|
disabled: !!disabled && decorationType !== 'Icon'
|
|
188
154
|
}, _react.default.createElement(DecorationComponent, decoration)), renderOptionLabel ? renderOptionLabel({
|
|
189
155
|
id: id,
|
|
@@ -192,14 +158,9 @@ function Option(props) {
|
|
|
192
158
|
value: props.value,
|
|
193
159
|
disabled: disabled,
|
|
194
160
|
meta: props.meta
|
|
195
|
-
}) : _react.default.createElement(StyleLabelWrapper, null, _react.default.createElement(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}, label), labelDetails && _react.default.createElement(_Typography.P, {
|
|
199
|
-
as: "span",
|
|
200
|
-
shade: 1,
|
|
201
|
-
size: "small",
|
|
202
|
-
id: "optionLabelDetails"
|
|
161
|
+
}) : _react.default.createElement(_styles.StyleLabelWrapper, null, _react.default.createElement(_styles.StyledLabel, null, label), labelDetails && _react.default.createElement(_styles.StyledLabelDetails, {
|
|
162
|
+
id: "optionLabelDetails",
|
|
163
|
+
size: sizeMapping[size]
|
|
203
164
|
}, labelDetails))));
|
|
204
165
|
}
|
|
205
166
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StyledLinkProps, ContainerProps } from '../types';
|
|
3
|
+
export declare const StyledLink: import("styled-components").StyledComponent<import("react").RefForwardingComponent<HTMLAnchorElement, import("../../../components/Link").LinkProps>, any, StyledLinkProps, never>;
|
|
4
|
+
export declare const Container: import("styled-components").StyledComponent<"li", any, ContainerProps, never>;
|
|
5
|
+
export declare const StyleLabelWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const DecorationComponentContainer: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
}, never>;
|
|
9
|
+
export declare const StyledLabel: import("styled-components").StyledComponent<"p", any, import("../../../components/Typography").PProps & {
|
|
10
|
+
as: string;
|
|
11
|
+
color: "inherit";
|
|
12
|
+
}, "color" | "as">;
|
|
13
|
+
export declare const StyledLabelDetails: import("styled-components").StyledComponent<"p", any, import("../../../components/Typography").PProps & {
|
|
14
|
+
as: string;
|
|
15
|
+
shade: number;
|
|
16
|
+
}, "as" | "shade">;
|
|
17
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/atoms/OptionsList/Option/styles.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK3D,eAAO,MAAM,UAAU,mLAgBtB,CAAC;AAuBF,eAAO,MAAM,SAAS,+EA6GrB,CAAC;AAEF,eAAO,MAAM,iBAAiB,oEAI7B,CAAC;AAEF,eAAO,MAAM,4BAA4B;;SAUxC,CAAC;AAEF,eAAO,MAAM,WAAW;;;kBAEvB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;kBAG3B,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledLabelDetails = exports.StyledLabel = exports.DecorationComponentContainer = exports.StyleLabelWrapper = exports.Container = exports.StyledLink = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
|
|
11
|
+
|
|
12
|
+
var _toColorString = _interopRequireDefault(require("polished/lib/color/toColorString"));
|
|
13
|
+
|
|
14
|
+
var _designTokens = require("@decisiv/design-tokens");
|
|
15
|
+
|
|
16
|
+
var _Link = _interopRequireWildcard(require("../../../components/Link"));
|
|
17
|
+
|
|
18
|
+
var _Typography = require("../../../components/Typography");
|
|
19
|
+
|
|
20
|
+
var _styleModifiers = require("../../../utils/styleModifiers");
|
|
21
|
+
|
|
22
|
+
var _focusRingWithColor = _interopRequireDefault(require("../../../utils/focusRingWithColor"));
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
27
|
+
|
|
28
|
+
var enabledFGColor = _designTokens.color.interaction.pacificOcean;
|
|
29
|
+
var disabledFGColor = _designTokens.color.opacity.charcoal40;
|
|
30
|
+
var StyledLink = (0, _styledComponents.default)(_Link.default).withConfig({
|
|
31
|
+
displayName: "styles__StyledLink",
|
|
32
|
+
componentId: "sc-1vr9h8x-0"
|
|
33
|
+
})(["&&,&&:hover:not(:active),&&:focus:not(:active){text-decoration:none;", ";", ";}"], (0, _Link.linkColorStyles)(enabledFGColor, enabledFGColor, enabledFGColor), (0, _styleModifiers.when)('disabled', (0, _styledComponents.css)(["", ";cursor:not-allowed;"], (0, _Link.linkColorStyles)(disabledFGColor, disabledFGColor, disabledFGColor))));
|
|
34
|
+
exports.StyledLink = StyledLink;
|
|
35
|
+
|
|
36
|
+
var withSizeModifiers = function withSizeModifiers(props) {
|
|
37
|
+
var _props$size = props.size,
|
|
38
|
+
size = _props$size === void 0 ? 'small' : _props$size;
|
|
39
|
+
if (size === 'medium') return (0, _styledComponents.css)(["font-size:", ";padding:", ";"], (0, _rem.default)(_designTokens.typography.size.alias.header4), "".concat((0, _rem.default)(10), " ").concat((0, _rem.default)(30), " ").concat((0, _rem.default)(10), " ").concat((0, _rem.default)(10)));
|
|
40
|
+
return (0, _styledComponents.css)(["font-size:", ";padding:", ";"], (0, _rem.default)(_designTokens.typography.size.alias.paragraph), "".concat((0, _rem.default)(5), " ").concat((0, _rem.default)(30), " ").concat((0, _rem.default)(5), " ").concat((0, _rem.default)(10)));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function getBorderRadius(_ref) {
|
|
44
|
+
var borderRadius = _ref.borderRadius;
|
|
45
|
+
return borderRadius || '2px';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var Container = _styledComponents.default.li.withConfig({
|
|
49
|
+
displayName: "styles__Container",
|
|
50
|
+
componentId: "sc-1vr9h8x-1"
|
|
51
|
+
})(["text-align:left;&:focus{outline:none;}> .label,> ", "{align-items:center;border:1px solid transparent;color:", ";display:flex;pointer-events:none;width:100%;white-space:nowrap;", " > *{margin-right:", ";}}> ", "{pointer-events:auto;background-color:transparent;text-decoration:none;}&:first-child > .label,&:first-child > ", "{border-top-left-radius:", ";border-top-right-radius:", ";}&:last-child > .label,&:last-child > ", "{border-bottom-left-radius:", ";border-bottom-right-radius:", ";}&:hover:not([aria-disabled='true']):not([aria-selected='true']) > .label,&:hover:not([aria-disabled='true']):not([aria-selected='true']) > ", "{color:", ";text-decoration:none;.label > *{border-color:", ";}}&[aria-selected='true'] > .label{background:", ";color:", ";}&[aria-selected='true'] > .label > div > #optionLabelDetails{background:", ";color:", ";}", ";", " &[aria-disabled='true']{cursor:not-allowed;", "{pointer-events:none;}}&[aria-disabled='true'] > .label,&[aria-disabled='true'] > ", "{background:", ";color:", ";}"], StyledLink, (0, _toColorString.default)(_designTokens.color.interaction.pacificOcean), withSizeModifiers, (0, _rem.default)(10), StyledLink, StyledLink, getBorderRadius, getBorderRadius, StyledLink, getBorderRadius, getBorderRadius, StyledLink, (0, _toColorString.default)(_designTokens.color.interaction.pacificOcean), (0, _toColorString.default)(_designTokens.color.interaction.indianOcean), (0, _toColorString.default)(_designTokens.color.interaction.pacificOcean), (0, _toColorString.default)(_designTokens.color.base.snowWhite), (0, _toColorString.default)(_designTokens.color.interaction.pacificOcean), (0, _toColorString.default)(_designTokens.color.base.snowWhite), (0, _styleModifiers.when)('isActive', (0, _styledComponents.css)(["color:", ";background:", ";.label > *{border-color:", ";}"], (0, _toColorString.default)(_designTokens.color.interaction.pacificOcean), (0, _toColorString.default)(_designTokens.color.interaction.pacificOcean15), (0, _toColorString.default)(_designTokens.color.interaction.indianOcean))), (0, _styleModifiers.when)([['isActive'], ['inputMethod', 'keyboard']], (0, _styledComponents.css)(["background:none;> .label,> ", "{border-color:", ";", "}&[aria-selected='true'] > .label,&[aria-selected='true'] > ", "{color:", ";", "}"], StyledLink, (0, _toColorString.default)(_designTokens.color.interaction.pacificOcean), (0, _focusRingWithColor.default)(_designTokens.color.interaction.pacificOcean40), StyledLink, (0, _toColorString.default)(_designTokens.color.base.snowWhite), (0, _focusRingWithColor.default)(_designTokens.color.opacity.fullMoon50))), StyledLink, StyledLink, (0, _toColorString.default)(_designTokens.color.base.snowWhite), (0, _toColorString.default)(_designTokens.color.opacity.charcoal40));
|
|
52
|
+
|
|
53
|
+
exports.Container = Container;
|
|
54
|
+
|
|
55
|
+
var StyleLabelWrapper = _styledComponents.default.div.withConfig({
|
|
56
|
+
displayName: "styles__StyleLabelWrapper",
|
|
57
|
+
componentId: "sc-1vr9h8x-2"
|
|
58
|
+
})(["display:flex;flex:1;flex-direction:column;"]);
|
|
59
|
+
|
|
60
|
+
exports.StyleLabelWrapper = StyleLabelWrapper;
|
|
61
|
+
|
|
62
|
+
var DecorationComponentContainer = _styledComponents.default.div.withConfig({
|
|
63
|
+
displayName: "styles__DecorationComponentContainer",
|
|
64
|
+
componentId: "sc-1vr9h8x-3"
|
|
65
|
+
})(["", ";"], (0, _styleModifiers.when)('disabled', (0, _styledComponents.css)(["opacity:0.3;img{opacity:0.3;}"])));
|
|
66
|
+
|
|
67
|
+
exports.DecorationComponentContainer = DecorationComponentContainer;
|
|
68
|
+
var StyledLabel = (0, _styledComponents.default)(_Typography.P).attrs({
|
|
69
|
+
as: 'span',
|
|
70
|
+
color: 'inherit'
|
|
71
|
+
}).withConfig({
|
|
72
|
+
displayName: "styles__StyledLabel",
|
|
73
|
+
componentId: "sc-1vr9h8x-4"
|
|
74
|
+
})(["font-size:inherit;"]);
|
|
75
|
+
exports.StyledLabel = StyledLabel;
|
|
76
|
+
var StyledLabelDetails = (0, _styledComponents.default)(_Typography.P).attrs({
|
|
77
|
+
as: 'span',
|
|
78
|
+
shade: 1
|
|
79
|
+
}).withConfig({
|
|
80
|
+
displayName: "styles__StyledLabelDetails",
|
|
81
|
+
componentId: "sc-1vr9h8x-5"
|
|
82
|
+
})([""]);
|
|
83
|
+
exports.StyledLabelDetails = StyledLabelDetails;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atoms/OptionsList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;AAcf,OAAO,EAGL,gBAAgB,EAIjB,MAAM,SAAS,CAAC;AAwBjB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAmCrB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atoms/OptionsList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;AAcf,OAAO,EAGL,gBAAgB,EAIjB,MAAM,SAAS,CAAC;AAwBjB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAmCrB,CAAC;AA+SF,QAAA,MAAM,2BAA2B,2FAA0B,CAAC;AAmC5D,eAAe,2BAA2B,CAAC"}
|
|
@@ -86,13 +86,13 @@ var Container = _styledComponents.default.ul.withConfig({
|
|
|
86
86
|
componentId: "sc-107p8d5-0"
|
|
87
87
|
})(["list-style:none;margin:0;width:100%;height:auto;max-height:", ";max-width:", ";padding:0;overflow:auto;position:relative;", " ", " ", " &:focus{outline:none;}"], (0, _rem.default)(310), (0, _rem.default)(340), function (_ref) {
|
|
88
88
|
var minWidth = _ref.minWidth;
|
|
89
|
-
return minWidth ? "\
|
|
89
|
+
return minWidth ? "\nmin-width: ".concat(minWidth, ";\n") : '';
|
|
90
90
|
}, function (_ref2) {
|
|
91
91
|
var maxWidth = _ref2.maxWidth;
|
|
92
|
-
return maxWidth ? "\
|
|
92
|
+
return maxWidth ? "\nmax-width: ".concat(maxWidth, ";\n") : '';
|
|
93
93
|
}, function (_ref3) {
|
|
94
94
|
var maxHeight = _ref3.maxHeight;
|
|
95
|
-
return maxHeight ? "\
|
|
95
|
+
return maxHeight ? "\nmax-height: ".concat(maxHeight, ";\n") : '';
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
exports.Container = Container;
|
|
@@ -113,6 +113,8 @@ function OptionsList(props, forwardedRef) {
|
|
|
113
113
|
showCheckbox = props.showCheckbox,
|
|
114
114
|
tabIndex = props.tabIndex,
|
|
115
115
|
selectable = props.selectable,
|
|
116
|
+
_props$size = props.size,
|
|
117
|
+
size = _props$size === void 0 ? 'small' : _props$size,
|
|
116
118
|
defaultSelected = props.defaultSelected,
|
|
117
119
|
itemRole = props.itemRole,
|
|
118
120
|
role = props.role,
|
|
@@ -299,14 +301,16 @@ function OptionsList(props, forwardedRef) {
|
|
|
299
301
|
return _react.default.createElement(_Category.default, _extends({}, item, {
|
|
300
302
|
key: id,
|
|
301
303
|
borderRadius: borderRadius,
|
|
302
|
-
showCheckbox: showCheckbox
|
|
304
|
+
showCheckbox: showCheckbox,
|
|
305
|
+
size: size
|
|
303
306
|
}));
|
|
304
307
|
}
|
|
305
308
|
|
|
306
309
|
return _react.default.createElement(_Option.default, _extends({}, item, {
|
|
307
310
|
key: id,
|
|
308
311
|
borderRadius: borderRadius,
|
|
309
|
-
showCheckbox: showCheckbox
|
|
312
|
+
showCheckbox: showCheckbox,
|
|
313
|
+
size: size
|
|
310
314
|
}));
|
|
311
315
|
}))), actions && _react.default.createElement(Row, null, _react.default.createElement(_Footer.default, {
|
|
312
316
|
actions: actions
|
|
@@ -332,7 +336,8 @@ OptionsListWithContainerRef.defaultProps = {
|
|
|
332
336
|
itemRole: 'option',
|
|
333
337
|
tabIndex: 0,
|
|
334
338
|
selectable: true,
|
|
335
|
-
showCheckbox: true
|
|
339
|
+
showCheckbox: true,
|
|
340
|
+
size: 'small'
|
|
336
341
|
};
|
|
337
342
|
var _default = OptionsListWithContainerRef;
|
|
338
343
|
exports.default = _default;
|