@ntbjs/react-components 1.1.0-beta.1 → 1.1.0-beta.2
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/{AssetGallery-9bf4cd82.js → AssetGallery-7ff60131.js} +9 -6
- package/Button-00ce7d0f.js +298 -0
- package/CompactStarRating-f9997240.js +242 -0
- package/{CompactTextInput-24126cf9.js → CompactTextInput-f00e46a3.js} +11 -22
- package/ContextMenu-a68d4f28.js +32 -0
- package/InputGroup-66dd343c.js +28 -0
- package/{Popover-d3e2f6c0.js → Popover-616682bf.js} +39 -9
- package/Tab-06b7a58d.js +30 -0
- package/Tabs-cfbf45fe.js +99 -0
- package/{TextArea-52cf4c0a.js → TextArea-06d9e80b.js} +51 -20
- package/{TextInput-a7c32f5f.js → TextInput-e4c6d536.js} +42 -22
- package/{Tooltip-f95a39f4.js → Tooltip-860530ff.js} +1 -1
- package/data/Popover/index.js +1 -1
- package/data/Tab/index.js +10 -0
- package/data/Tabs/index.js +12 -0
- package/data/index.js +6 -2
- package/edit-note-c47d292e.js +41 -0
- package/icons/delete-context-menu.svg +4 -0
- package/icons/design-services.svg +4 -0
- package/icons/expand-more.svg +4 -0
- package/icons/star-filled.svg +3 -0
- package/icons/star.svg +3 -0
- package/icons/triangle-right.svg +4 -0
- package/inputs/Button/index.js +6 -1
- package/inputs/CompactStarRating/index.js +11 -0
- package/inputs/CompactTextInput/index.js +6 -3
- package/inputs/TextArea/index.js +2 -1
- package/inputs/TextInput/index.js +2 -1
- package/inputs/index.js +13 -7
- package/layout/InputGroup/index.js +10 -0
- package/layout/index.js +2 -0
- package/package.json +1 -1
- package/widgets/AssetGallery/index.js +13 -8
- package/widgets/ContextMenu/index.js +10 -0
- package/widgets/index.js +14 -8
- package/Button-0d728b52.js +0 -156
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var defaultTheme = require('./defaultTheme-870f7df1.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var styled = require('styled-components');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
11
|
+
|
|
12
|
+
var _templateObject;
|
|
13
|
+
var ContextMenu$1 = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject || (_templateObject = defaultTheme._taggedTemplateLiteral(["\n font-family: ", ";\n padding: 3px 0;\n"])), function (props) {
|
|
14
|
+
return props.theme.primaryFontFamily;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
var ContextMenu = React__default['default'].forwardRef(function ContextMenu(_ref, forwardedRef) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
props = defaultTheme._objectWithoutProperties(_ref, ["children"]);
|
|
20
|
+
|
|
21
|
+
return React__default['default'].createElement(ContextMenu$1, defaultTheme._extends({
|
|
22
|
+
ref: forwardedRef
|
|
23
|
+
}, props, {
|
|
24
|
+
role: "menu"
|
|
25
|
+
}), children);
|
|
26
|
+
});
|
|
27
|
+
ContextMenu.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
28
|
+
children: defaultTheme.PropTypes.arrayOf(defaultTheme.PropTypes.node).isRequired
|
|
29
|
+
} : {};
|
|
30
|
+
ContextMenu.defaultProps = {};
|
|
31
|
+
|
|
32
|
+
exports.ContextMenu = ContextMenu;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var defaultTheme = require('./defaultTheme-870f7df1.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var styled = require('styled-components');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
11
|
+
|
|
12
|
+
var _templateObject;
|
|
13
|
+
var InputGroup$1 = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject || (_templateObject = defaultTheme._taggedTemplateLiteral(["\n margin: 8px 0;\n"])));
|
|
14
|
+
|
|
15
|
+
var InputGroup = React__default['default'].forwardRef(function InputGroup(_ref, forwardedRef) {
|
|
16
|
+
var children = _ref.children,
|
|
17
|
+
props = defaultTheme._objectWithoutProperties(_ref, ["children"]);
|
|
18
|
+
|
|
19
|
+
return React__default['default'].createElement(InputGroup$1, defaultTheme._extends({
|
|
20
|
+
ref: forwardedRef
|
|
21
|
+
}, props), children);
|
|
22
|
+
});
|
|
23
|
+
InputGroup.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
24
|
+
children: defaultTheme.PropTypes.node
|
|
25
|
+
} : {};
|
|
26
|
+
InputGroup.defaultProps = {};
|
|
27
|
+
|
|
28
|
+
exports.InputGroup = InputGroup;
|
|
@@ -19,15 +19,23 @@ defaultTheme.styleInject(css_248z$1);
|
|
|
19
19
|
var css_248z = ".tippy-box[data-animation=shift-away-subtle][data-state=hidden]{opacity:0}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=top]{transform:translateY(5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=bottom]{transform:translateY(-5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=left]{transform:translateX(5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=right]{transform:translateX(-5px)}";
|
|
20
20
|
defaultTheme.styleInject(css_248z);
|
|
21
21
|
|
|
22
|
-
var _templateObject;
|
|
23
|
-
var Popover$1 = styled__default['default'](TippyTooltip__default['default']).attrs(defaultTheme.applyDefaultTheme)(_templateObject || (_templateObject = defaultTheme._taggedTemplateLiteral(["\n font-family: ", ";\n font-size: 1rem;\n font-weight: 400;\n color: inherit;\n border-radius: 0;\n ", "\n ", "\n
|
|
22
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
23
|
+
var Popover$1 = styled__default['default'](TippyTooltip__default['default']).attrs(defaultTheme.applyDefaultTheme)(_templateObject || (_templateObject = defaultTheme._taggedTemplateLiteral(["\n font-family: ", ";\n font-size: 1rem;\n font-weight: 400;\n color: inherit;\n border-radius: 0;\n line-height: inherit;\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n .tippy-content {\n padding: 0;\n }\n\n .tippy-arrow {\n ", "\n }\n\n && > .tippy-arrow::before {\n position: absolute;\n border-color: transparent;\n border-style: solid;\n }\n\n & > .tippy-arrow::after {\n content: '';\n position: absolute;\n border-color: transparent;\n border-style: solid;\n }\n\n &[data-placement^='top'] {\n & > .tippy-arrow:before {\n bottom: -16px;\n left: -5px;\n border-width: 15px 13px 0;\n ", "\n }\n\n & > .tippy-arrow:after {\n bottom: -15px;\n left: -5px;\n border-width: 15px 13px 0;\n border-top-color: initial;\n transform-origin: center top;\n }\n }\n\n &[data-placement^='right'] {\n & > .tippy-arrow:before {\n bottom: -5px;\n left: -16px;\n border-width: 13px 15px 13px 0;\n ", "\n }\n\n & > .tippy-arrow:after {\n bottom: -5px;\n left: -15px;\n border-width: 13px 15px 13px 0;\n border-right-color: initial;\n transform-origin: center top;\n }\n }\n\n &[data-placement^='bottom'] {\n & > .tippy-arrow:before {\n top: -16px;\n left: -5px;\n border-width: 0 13px 15px 13px;\n ", "\n }\n\n & > .tippy-arrow:after {\n top: -15px;\n left: -5px;\n border-width: 0 13px 15px 13px;\n border-bottom-color: initial;\n transform-origin: center top;\n }\n }\n\n &[data-placement^='left'] {\n & > .tippy-arrow::before {\n bottom: -5px;\n right: -16px;\n border-width: 13px 0 13px 15px;\n ", "\n }\n\n & > .tippy-arrow::after {\n bottom: -5px;\n right: -15px;\n border-width: 13px 0 13px 15px;\n border-left-color: initial;\n transform-origin: center top;\n }\n }\n"])), function (props) {
|
|
24
24
|
return props.theme.primaryFontFamily;
|
|
25
25
|
}, function (props) {
|
|
26
26
|
return props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('white'));
|
|
27
27
|
}, function (props) {
|
|
28
|
-
return props.theme.themeProp('box-shadow', "0px 1px 6px -3px ".concat(polished.rgba(props.theme.getColor('black'), 0.7)), "0 1px 6px -4px
|
|
28
|
+
return props.theme.themeProp('box-shadow', "0px 1px 6px -3px ".concat(polished.rgba(props.theme.getColor('black'), 0.7)), "0 1px 6px -4px ".concat(props.theme.getColor('black')));
|
|
29
29
|
}, function (props) {
|
|
30
30
|
return props.theme.themeProp('border', "1px solid ".concat(props.theme.getColor('gray-800')), "1px solid ".concat(props.theme.getColor('gray-300')));
|
|
31
|
+
}, function (props) {
|
|
32
|
+
return props.contextMenu && styled.css(_templateObject2 || (_templateObject2 = defaultTheme._taggedTemplateLiteral(["\n border-radius: 4px;\n\n ", "\n\n ", "\n "])), function (props) {
|
|
33
|
+
return props.theme.themeProp('border', 'none', 'none');
|
|
34
|
+
}, function (props) {
|
|
35
|
+
return props.theme.themeProp('box-shadow', "none", "0 1px 6px ".concat(polished.rgba(props.theme.getColor('gray-900'), 0.3)));
|
|
36
|
+
});
|
|
37
|
+
}, function (props) {
|
|
38
|
+
return props.contextMenuSublevel && styled.css(_templateObject3 || (_templateObject3 = defaultTheme._taggedTemplateLiteral(["\n &[data-placement^='right-start'],\n &[data-placement^='left-start'] {\n margin-top: -4px;\n }\n\n &[data-placement^='left'] {\n margin-right: -6px;\n }\n\n &[data-placement^='right'] {\n margin-left: -6px;\n }\n "])));
|
|
31
39
|
}, function (props) {
|
|
32
40
|
return props.theme.themeProp('color', props.theme.getColor('gray-700'), props.theme.getColor('white'));
|
|
33
41
|
}, function (props) {
|
|
@@ -49,8 +57,10 @@ var Popover = React__default['default'].forwardRef(function Popover(_ref, ref) {
|
|
|
49
57
|
offset = _ref.offset,
|
|
50
58
|
arrow = _ref.arrow,
|
|
51
59
|
visible = _ref.visible,
|
|
60
|
+
contextMenu = _ref.contextMenu,
|
|
61
|
+
contextMenuSublevel = _ref.contextMenuSublevel,
|
|
52
62
|
children = _ref.children,
|
|
53
|
-
props = defaultTheme._objectWithoutProperties(_ref, ["content", "interactive", "placement", "duration", "trigger", "offset", "arrow", "visible", "children"]);
|
|
63
|
+
props = defaultTheme._objectWithoutProperties(_ref, ["content", "interactive", "placement", "duration", "trigger", "offset", "arrow", "visible", "contextMenu", "contextMenuSublevel", "children"]);
|
|
54
64
|
|
|
55
65
|
var errorOffset = React.useMemo(function () {
|
|
56
66
|
return arrow ? 15 : 0;
|
|
@@ -58,17 +68,33 @@ var Popover = React__default['default'].forwardRef(function Popover(_ref, ref) {
|
|
|
58
68
|
var isControlled = React.useMemo(function () {
|
|
59
69
|
return lodash.isBoolean(visible);
|
|
60
70
|
}, [visible]);
|
|
71
|
+
|
|
72
|
+
var handleContextMenuItemClick = function handleContextMenuItemClick() {
|
|
73
|
+
document.querySelectorAll('.context-menu-item:not(.opens-sublevel)').forEach(function (item) {
|
|
74
|
+
return item.addEventListener('click', function () {
|
|
75
|
+
document.querySelectorAll('[data-tippy-root]').forEach(function (node) {
|
|
76
|
+
if (node._tippy) {
|
|
77
|
+
node._tippy.hide();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
61
84
|
return React__default['default'].createElement(Popover$1, defaultTheme._extends({
|
|
62
85
|
ref: ref,
|
|
63
86
|
content: content,
|
|
64
87
|
interactive: interactive,
|
|
65
|
-
placement: placement,
|
|
88
|
+
placement: contextMenuSublevel ? 'right-start' : placement,
|
|
66
89
|
duration: duration,
|
|
67
90
|
animation: 'shift-away-subtle',
|
|
68
|
-
trigger: isControlled ? undefined : trigger,
|
|
91
|
+
trigger: isControlled ? undefined : contextMenuSublevel ? 'mouseenter click focus' : trigger,
|
|
69
92
|
offset: [offset[0], offset[1] + errorOffset],
|
|
70
|
-
arrow: arrow,
|
|
71
|
-
visible: visible
|
|
93
|
+
arrow: contextMenu ? false : arrow,
|
|
94
|
+
visible: visible,
|
|
95
|
+
contextMenu: contextMenu,
|
|
96
|
+
contextMenuSublevel: contextMenuSublevel,
|
|
97
|
+
onShown: contextMenu ? handleContextMenuItemClick : undefined
|
|
72
98
|
}, props), children);
|
|
73
99
|
});
|
|
74
100
|
Popover.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -80,6 +106,8 @@ Popover.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
80
106
|
offset: defaultTheme.PropTypes.arrayOf(defaultTheme.PropTypes.number),
|
|
81
107
|
arrow: defaultTheme.PropTypes.bool,
|
|
82
108
|
visible: defaultTheme.PropTypes.bool,
|
|
109
|
+
contextMenu: defaultTheme.PropTypes.bool,
|
|
110
|
+
contextMenuSublevel: defaultTheme.PropTypes.bool,
|
|
83
111
|
children: defaultTheme.PropTypes.node.isRequired
|
|
84
112
|
} : {};
|
|
85
113
|
Popover.defaultProps = {
|
|
@@ -91,7 +119,9 @@ Popover.defaultProps = {
|
|
|
91
119
|
maxWidth: 'none',
|
|
92
120
|
trigger: 'click focus',
|
|
93
121
|
arrow: true,
|
|
94
|
-
visible: undefined
|
|
122
|
+
visible: undefined,
|
|
123
|
+
contextMenu: false,
|
|
124
|
+
contextMenuSublevel: false
|
|
95
125
|
};
|
|
96
126
|
|
|
97
127
|
exports.Popover = Popover;
|
package/Tab-06b7a58d.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var defaultTheme = require('./defaultTheme-870f7df1.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var styled = require('styled-components');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
11
|
+
|
|
12
|
+
var _templateObject;
|
|
13
|
+
var Tab$1 = styled__default['default'].p.attrs(defaultTheme.applyDefaultTheme)(_templateObject || (_templateObject = defaultTheme._taggedTemplateLiteral(["\n font-family: ", ";\n font-size: 1rem;\n font-weight: 500;\n border-bottom: 1px solid;\n min-height: 35px;\n\n"])), function (props) {
|
|
14
|
+
return props.theme.primaryFontFamily;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
var Tab = React__default['default'].forwardRef(function Tab(_ref, forwardedRef) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
props = defaultTheme._objectWithoutProperties(_ref, ["children"]);
|
|
20
|
+
|
|
21
|
+
return React__default['default'].createElement(Tab$1, defaultTheme._extends({
|
|
22
|
+
ref: forwardedRef
|
|
23
|
+
}, props), children);
|
|
24
|
+
});
|
|
25
|
+
Tab.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
26
|
+
children: defaultTheme.PropTypes.element
|
|
27
|
+
} : {};
|
|
28
|
+
Tab.defaultProps = {};
|
|
29
|
+
|
|
30
|
+
exports.Tab = Tab;
|
package/Tabs-cfbf45fe.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var defaultTheme = require('./defaultTheme-870f7df1.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var styled = require('styled-components');
|
|
6
|
+
var Tab = require('./Tab-06b7a58d.js');
|
|
7
|
+
var lodash = require('lodash');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
13
|
+
|
|
14
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
15
|
+
var Tabs$1 = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject || (_templateObject = defaultTheme._taggedTemplateLiteral([""])));
|
|
16
|
+
var TabHeaders = styled__default['default'].ul.attrs(defaultTheme.applyDefaultTheme)(_templateObject2 || (_templateObject2 = defaultTheme._taggedTemplateLiteral(["\n display: flex;\n overflow-x: auto;\n overflow-y: hidden;\n white-space: nowrap;\n gap: 24px;\n margin: 0;\n padding: 0;\n\n"])));
|
|
17
|
+
var TabHeader = styled__default['default'].li.attrs(defaultTheme.applyDefaultTheme)(_templateObject3 || (_templateObject3 = defaultTheme._taggedTemplateLiteral(["\n font-family: ", ";\n text-transform: uppercase;\n font-weight: 600;\n font-size: 0.875rem;\n display: flex;\n padding-bottom: 8px;\n letter-spacing: 0.6px;\n cursor: pointer;\n border-bottom: 1px solid;\n border-color: transparent;\n margin-bottom: 1px;\n ", ";\n &&:hover:not(:focus) {\n ", ";\n"])), function (props) {
|
|
18
|
+
return props.theme.secondaryFontFamily;
|
|
19
|
+
}, function (props) {
|
|
20
|
+
return props.active && styled.css(_templateObject4 || (_templateObject4 = defaultTheme._taggedTemplateLiteral(["\n ", "\n "])), function (props) {
|
|
21
|
+
return props.theme.themeProp('border-color', props.theme.getColor('gray-400'), props.theme.getColor('gray-700'));
|
|
22
|
+
});
|
|
23
|
+
}, function (props) {
|
|
24
|
+
return props.theme.themeProp('border-color', function () {
|
|
25
|
+
if (props.active) {
|
|
26
|
+
return props.theme.getColor('gray-400');
|
|
27
|
+
} else {
|
|
28
|
+
return props.theme.getColor('gray-400');
|
|
29
|
+
}
|
|
30
|
+
}, function () {
|
|
31
|
+
if (props.active) {
|
|
32
|
+
return props.theme.getColor('gray-700');
|
|
33
|
+
} else {
|
|
34
|
+
return props.theme.getColor('gray-700');
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
var TabContent = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject5 || (_templateObject5 = defaultTheme._taggedTemplateLiteral(["\n padding-top: 16px;\n border-top: 1px solid;\n margin-top: -2px;\n ", ";\n"])), function (props) {
|
|
39
|
+
return props.theme.themeProp('border-color', props.theme.getColor('gray-600'), '#F0F2F5');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
var Tabs = React__default['default'].forwardRef(function Tabs(_ref, forwardedRef) {
|
|
43
|
+
var children = _ref.children,
|
|
44
|
+
props = defaultTheme._objectWithoutProperties(_ref, ["children"]);
|
|
45
|
+
|
|
46
|
+
var _useState = React.useState(0),
|
|
47
|
+
_useState2 = defaultTheme._slicedToArray(_useState, 2),
|
|
48
|
+
activeTab = _useState2[0],
|
|
49
|
+
setActiveTab = _useState2[1];
|
|
50
|
+
|
|
51
|
+
var tabs = React.useMemo(function () {
|
|
52
|
+
var tabs = [];
|
|
53
|
+
|
|
54
|
+
function extractChildren(children) {
|
|
55
|
+
React.Children.forEach(children, function (child, index) {
|
|
56
|
+
if (child.type === React.Fragment) {
|
|
57
|
+
extractChildren(child.props.children);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (child.type === Tab.Tab && !lodash.isEmpty(child.props.trigger)) {
|
|
61
|
+
tabs.push({
|
|
62
|
+
key: index,
|
|
63
|
+
trigger: child.props.trigger,
|
|
64
|
+
content: child.props.children
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
extractChildren(children);
|
|
71
|
+
return tabs;
|
|
72
|
+
}, [children]);
|
|
73
|
+
return React__default['default'].createElement(Tabs$1, defaultTheme._extends({
|
|
74
|
+
ref: forwardedRef
|
|
75
|
+
}, props, {
|
|
76
|
+
role: "tablist"
|
|
77
|
+
}), React__default['default'].createElement(TabHeaders, null, tabs.map(function (tab) {
|
|
78
|
+
return React__default['default'].createElement(TabHeader, {
|
|
79
|
+
key: tab.key,
|
|
80
|
+
active: tab.key === activeTab,
|
|
81
|
+
onClick: function onClick() {
|
|
82
|
+
return setActiveTab(tab.key);
|
|
83
|
+
},
|
|
84
|
+
role: "tab"
|
|
85
|
+
}, tab.trigger);
|
|
86
|
+
})), React__default['default'].createElement(TabContent, null, tabs.map(function (tab) {
|
|
87
|
+
return React__default['default'].createElement("div", {
|
|
88
|
+
key: tab.key,
|
|
89
|
+
role: "tabpanel",
|
|
90
|
+
hidden: tab.key !== activeTab
|
|
91
|
+
}, tab.content);
|
|
92
|
+
})));
|
|
93
|
+
});
|
|
94
|
+
Tabs.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
95
|
+
children: defaultTheme.PropTypes.element
|
|
96
|
+
} : {};
|
|
97
|
+
Tabs.defaultProps = {};
|
|
98
|
+
|
|
99
|
+
exports.Tabs = Tabs;
|
|
@@ -5,59 +5,77 @@ var React = require('react');
|
|
|
5
5
|
var nanoid = require('nanoid');
|
|
6
6
|
var styled = require('styled-components');
|
|
7
7
|
var lodash = require('lodash');
|
|
8
|
+
var editNote = require('./edit-note-c47d292e.js');
|
|
8
9
|
|
|
9
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
11
|
|
|
11
12
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
13
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
13
14
|
|
|
14
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
|
|
15
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21;
|
|
15
16
|
var activeLabel = styled.css(_templateObject || (_templateObject = defaultTheme._taggedTemplateLiteral(["\n font-size: 0.75rem;\n padding: 0 3px;\n top: -7px;\n letter-spacing: 0.03em;\n left: 8px !important;\n opacity: 1 !important;\n"])));
|
|
16
17
|
var placeholderBaseStyle = styled.css(_templateObject2 || (_templateObject2 = defaultTheme._taggedTemplateLiteral(["\n ", "\n\n ", "\n"])), function (props) {
|
|
17
18
|
return props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'));
|
|
18
19
|
}, function (props) {
|
|
19
20
|
return props.theme.themeProp('opacity', 0.6, 0.5);
|
|
20
21
|
});
|
|
21
|
-
var
|
|
22
|
+
var InputIconContainer = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject3 || (_templateObject3 = defaultTheme._taggedTemplateLiteral(["\n opacity: 0;\n pointer-events: none;\n border-top-right-radius: 3px;\n border-bottom-right-radius: 3px;\n display: flex;\n align-items: flex-start;\n position: absolute;\n right: 5px;\n top: 10px;\n bottom: 0;\n color: ", ";\n\n ", "\n\n ", "\n\n > svg {\n width: 12px;\n }\n"])), function (props) {
|
|
23
|
+
return props.theme.getColor('gray-400');
|
|
24
|
+
}, function (props) {
|
|
25
|
+
return props.warning && props.theme.themeProp('color', '#C3AF43', '#C3AF43');
|
|
26
|
+
}, function (props) {
|
|
27
|
+
return props.error && props.theme.themeProp('color', '#CB968F', '#CB968F');
|
|
28
|
+
});
|
|
29
|
+
var TextInputField = styled__default['default'].textarea.attrs(defaultTheme.applyDefaultTheme)(_templateObject4 || (_templateObject4 = defaultTheme._taggedTemplateLiteral(["\n display: block;\n width: 100%;\n font-family: inherit;\n font-size: 0.875rem;\n border-radius: 2px;\n padding: 13px 10px;\n resize: vertical;\n ", "\n ", "\n border: 1px solid;\n ", "\n ", " \n\n ", " \n \n \n ", " \n \n \n \n border-radius: 3px;\n box-sizing: border-box;\n appearance: none;\n transition: border-color 350ms;\n ", "\n ", "\n ", "\n\n &::placeholder {\n ", "\n\n ", "\n }\n\n :focus {\n outline: none;\n ", "\n }\n\n &&:hover:not(:focus) {\n ", ";\n transition: background 350ms;\n & + ", " {\n opacity: 1;\n transition: opacity 350ms;\n }\n }\n\n :focus {\n outline: none;\n border-color: ", " !important\n"])), function (props) {
|
|
22
30
|
return props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'));
|
|
23
31
|
}, function (props) {
|
|
24
32
|
return props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('white'));
|
|
25
33
|
}, function (props) {
|
|
26
34
|
return props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-400'));
|
|
27
35
|
}, function (props) {
|
|
28
|
-
return props.
|
|
36
|
+
return props.noBorder && styled.css(_templateObject5 || (_templateObject5 = defaultTheme._taggedTemplateLiteral(["\n border-color: transparent !important;\n "])));
|
|
37
|
+
}, function (props) {
|
|
38
|
+
return props.warningAlert && styled.css(_templateObject6 || (_templateObject6 = defaultTheme._taggedTemplateLiteral(["\n background: ", " !important;\n :focus {\n background: white !important;\n }\n &&:hover:not(:focus) {\n background: ", " !important;\n }\n "])), props.theme.getColor('signal-yellow-400'), props.theme.getColor('signal-yellow-500'));
|
|
29
39
|
}, function (props) {
|
|
30
|
-
return props.
|
|
40
|
+
return props.errorAlert && styled.css(_templateObject7 || (_templateObject7 = defaultTheme._taggedTemplateLiteral(["\n background: ", " !important;\n :focus {\n background: white !important;\n }\n &&:hover:not(:focus) {\n background: #f7d5d0 !important;\n }\n "])), props.theme.getColor('red-200'));
|
|
31
41
|
}, function (props) {
|
|
32
|
-
return props.
|
|
42
|
+
return props.warning && styled.css(_templateObject8 || (_templateObject8 = defaultTheme._taggedTemplateLiteral(["\n border-color: ", " !important;\n "])), props.theme.getColor('orange-500'));
|
|
43
|
+
}, function (props) {
|
|
44
|
+
return props.error && styled.css(_templateObject9 || (_templateObject9 = defaultTheme._taggedTemplateLiteral(["\n border-color: ", " !important;\n "])), props.theme.getColor('red-500'));
|
|
45
|
+
}, function (props) {
|
|
46
|
+
return props.hasIcon && styled.css(_templateObject10 || (_templateObject10 = defaultTheme._taggedTemplateLiteral(["\n padding-left: 35px;\n "])));
|
|
33
47
|
}, function (props) {
|
|
34
48
|
return props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'), 1);
|
|
35
49
|
}, function (props) {
|
|
36
50
|
return props.theme.themeProp('opacity', 0.6, 0.5, 1);
|
|
37
51
|
}, function (props) {
|
|
38
52
|
return props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-600'));
|
|
53
|
+
}, function (props) {
|
|
54
|
+
return props.noBorder ? props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('gray-100')) : 'background: transparent';
|
|
55
|
+
}, InputIconContainer, function (props) {
|
|
56
|
+
return props.theme.getColor('gray-600');
|
|
39
57
|
});
|
|
40
|
-
var TextInputLabel = styled__default['default'].label.attrs(defaultTheme.applyDefaultTheme)(
|
|
58
|
+
var TextInputLabel = styled__default['default'].label.attrs(defaultTheme.applyDefaultTheme)(_templateObject11 || (_templateObject11 = defaultTheme._taggedTemplateLiteral(["\n position: absolute;\n top: 13px;\n left: 11px;\n line-height: 1.2;\n font-size: 0.875rem;\n transition: all 150ms;\n\n ", ";\n\n ", "\n\n ", "\n\n content: \"\";\n\n ", "\n"])), placeholderBaseStyle, function (props) {
|
|
41
59
|
return props.theme.themeProp('background', "linear-gradient(0deg, ".concat(props.theme.getColor('gray-900'), " calc(50% + 1px), transparent 50%)"), "linear-gradient(0deg, ".concat(props.theme.getColor('white'), " calc(50% + 1px), transparent 50%)"));
|
|
42
60
|
}, function (props) {
|
|
43
|
-
return props.hasPlaceholder && styled.css(
|
|
61
|
+
return props.hasPlaceholder && styled.css(_templateObject12 || (_templateObject12 = defaultTheme._taggedTemplateLiteral(["\n ", ";\n ", "\n "])), activeLabel, props.error && styled.css(_templateObject13 || (_templateObject13 = defaultTheme._taggedTemplateLiteral(["\n color: ", " !important;\n "])), props.theme.getColor('red-500')));
|
|
44
62
|
}, function (props) {
|
|
45
|
-
return props.hasIcon && styled.css(
|
|
63
|
+
return props.hasIcon && styled.css(_templateObject14 || (_templateObject14 = defaultTheme._taggedTemplateLiteral(["\n left: 35px;\n "])));
|
|
46
64
|
});
|
|
47
|
-
var TextInputFieldIcon = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(
|
|
48
|
-
var TextInput = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(
|
|
65
|
+
var TextInputFieldIcon = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject15 || (_templateObject15 = defaultTheme._taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n height: 2.625rem;\n display: flex;\n padding: 0 10px;\n\n svg {\n width: 15px;\n opacity: 0.6;\n transition: opacity 250ms;\n }\n"])));
|
|
66
|
+
var TextInput = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject16 || (_templateObject16 = defaultTheme._taggedTemplateLiteral(["\n position: relative;\n\n &:focus-within {\n ", " {\n ", ";\n }\n\n ", " {\n svg {\n opacity: 1;\n }\n }\n }\n\n ", ":not(:placeholder-shown) + ", " {\n ", ";\n ", "\n // ", "\n ", "\n }\n\n ", "\n"])), TextInputLabel, activeLabel, TextInputFieldIcon, TextInputField, TextInputLabel, activeLabel, function (props) {
|
|
49
67
|
return props.error && props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500'));
|
|
50
68
|
}, function (props) {
|
|
51
|
-
return props.error && styled.css(
|
|
69
|
+
return props.error && styled.css(_templateObject17 || (_templateObject17 = defaultTheme._taggedTemplateLiteral(["\n // color: ", " !important;\n //\n "])), props.theme.getColor('red-500'));
|
|
52
70
|
}, function (props) {
|
|
53
|
-
return props.warning && styled.css(
|
|
71
|
+
return props.warning && styled.css(_templateObject18 || (_templateObject18 = defaultTheme._taggedTemplateLiteral(["\n color: ", " !important;\n "])), props.theme.getColor('orange-500'));
|
|
54
72
|
}, function (props) {
|
|
55
|
-
return props.disabled && styled.css(
|
|
73
|
+
return props.disabled && styled.css(_templateObject19 || (_templateObject19 = defaultTheme._taggedTemplateLiteral(["\n opacity: 0.5;\n\n > * {\n cursor: not-allowed;\n }\n "])));
|
|
56
74
|
});
|
|
57
|
-
var Description = styled__default['default'].p.attrs(defaultTheme.applyDefaultTheme)(
|
|
75
|
+
var Description = styled__default['default'].p.attrs(defaultTheme.applyDefaultTheme)(_templateObject20 || (_templateObject20 = defaultTheme._taggedTemplateLiteral(["\n margin: 8px 0 0 0;\n padding: 0 0.6875rem;\n font-size: 0.75rem;\n line-height: 1.333;\n\n ", ";\n\n ", "\n"])), function (props) {
|
|
58
76
|
return props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'));
|
|
59
77
|
}, function (props) {
|
|
60
|
-
return props.error && styled.css(
|
|
78
|
+
return props.error && styled.css(_templateObject21 || (_templateObject21 = defaultTheme._taggedTemplateLiteral(["\n content: 'error';\n ", "\n "])), props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500')));
|
|
61
79
|
});
|
|
62
80
|
|
|
63
81
|
var TextArea = React__default['default'].forwardRef(function TextArea(_ref, forwardedRef) {
|
|
@@ -79,7 +97,10 @@ var TextArea = React__default['default'].forwardRef(function TextArea(_ref, forw
|
|
|
79
97
|
style = _ref.style,
|
|
80
98
|
onChange = _ref.onChange,
|
|
81
99
|
onBlur = _ref.onBlur,
|
|
82
|
-
|
|
100
|
+
noBorder = _ref.noBorder,
|
|
101
|
+
warningAlert = _ref.warningAlert,
|
|
102
|
+
errorAlert = _ref.errorAlert,
|
|
103
|
+
rest = defaultTheme._objectWithoutProperties(_ref, ["value", "defaultValue", "name", "label", "placeholder", "required", "disabled", "readOnly", "autoComplete", "description", "error", "warning", "icon", "rows", "className", "style", "onChange", "onBlur", "noBorder", "warningAlert", "errorAlert"]);
|
|
83
104
|
|
|
84
105
|
var _useState = React.useState(nanoid.nanoid()),
|
|
85
106
|
_useState2 = defaultTheme._slicedToArray(_useState, 1),
|
|
@@ -136,8 +157,14 @@ var TextArea = React__default['default'].forwardRef(function TextArea(_ref, forw
|
|
|
136
157
|
warning: hasWarning,
|
|
137
158
|
id: "text-input-".concat(uniqueId),
|
|
138
159
|
onChange: onChange,
|
|
139
|
-
onBlur: onBlur
|
|
140
|
-
|
|
160
|
+
onBlur: onBlur,
|
|
161
|
+
noBorder: noBorder,
|
|
162
|
+
warningAlert: warningAlert,
|
|
163
|
+
errorAlert: errorAlert
|
|
164
|
+
}, rest)), !readOnly && noBorder && React__default['default'].createElement(InputIconContainer, {
|
|
165
|
+
error: error,
|
|
166
|
+
warning: warning
|
|
167
|
+
}, React__default['default'].createElement(editNote.SvgEditNote, null)), label && React__default['default'].createElement(TextInputLabel, {
|
|
141
168
|
htmlFor: "text-input-".concat(uniqueId),
|
|
142
169
|
hasPlaceholder: Boolean(placeholder),
|
|
143
170
|
hasIcon: Boolean(icon),
|
|
@@ -147,7 +174,8 @@ var TextArea = React__default['default'].forwardRef(function TextArea(_ref, forw
|
|
|
147
174
|
}, descriptionText));
|
|
148
175
|
});
|
|
149
176
|
TextArea.defaultProps = {
|
|
150
|
-
rows: 4
|
|
177
|
+
rows: 4,
|
|
178
|
+
noBorder: false
|
|
151
179
|
};
|
|
152
180
|
TextArea.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
153
181
|
value: defaultTheme.PropTypes.string,
|
|
@@ -167,7 +195,10 @@ TextArea.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
167
195
|
className: defaultTheme.PropTypes.string,
|
|
168
196
|
style: defaultTheme.PropTypes.object,
|
|
169
197
|
onChange: defaultTheme.PropTypes.func,
|
|
170
|
-
onBlur: defaultTheme.PropTypes.func
|
|
198
|
+
onBlur: defaultTheme.PropTypes.func,
|
|
199
|
+
noBorder: defaultTheme.PropTypes.bool,
|
|
200
|
+
warningAlert: defaultTheme.PropTypes.bool,
|
|
201
|
+
errorAlert: defaultTheme.PropTypes.bool
|
|
171
202
|
} : {};
|
|
172
203
|
|
|
173
204
|
exports.TextArea = TextArea;
|
|
@@ -5,13 +5,14 @@ var React = require('react');
|
|
|
5
5
|
var nanoid = require('nanoid');
|
|
6
6
|
var styled = require('styled-components');
|
|
7
7
|
var lodash = require('lodash');
|
|
8
|
+
var editNote = require('./edit-note-c47d292e.js');
|
|
8
9
|
|
|
9
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
11
|
|
|
11
12
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
13
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
13
14
|
|
|
14
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22;
|
|
15
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24;
|
|
15
16
|
var activeLabel = styled.css(_templateObject || (_templateObject = defaultTheme._taggedTemplateLiteral(["\n font-size: 0.75rem;\n padding: 0 3px;\n top: -7px;\n letter-spacing: 0.03em;\n left: 8px !important;\n opacity: 1 !important;\n"])));
|
|
16
17
|
var Adornment = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject2 || (_templateObject2 = defaultTheme._taggedTemplateLiteral(["\n flex-shrink: 0;\n font-family: inherit;\n font-size: 0.875rem;\n line-height: initial;\n padding: 13px 10px;\n ", "\n ", "\n border: 1px solid;\n ", "\n border-radius: 3px;\n z-index: 1;\n ", "\n box-sizing: border-box;\n appearance: none;\n transition: border-color 350ms;\n height: 2.75rem;\n\n ", "\n ", "\n"])), function (props) {
|
|
17
18
|
return props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'));
|
|
@@ -29,50 +30,61 @@ var Adornment = styled__default['default'].div.attrs(defaultTheme.applyDefaultTh
|
|
|
29
30
|
var TextInputWrapper = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject7 || (_templateObject7 = defaultTheme._taggedTemplateLiteral(["\n display: flex;\n align-content: center;\n\n &:focus-within {\n ", " {\n outline: none;\n ", "\n }\n }\n"])), Adornment, function (props) {
|
|
30
31
|
return props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-600'), 1);
|
|
31
32
|
});
|
|
32
|
-
var
|
|
33
|
+
var InputIconContainer = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject8 || (_templateObject8 = defaultTheme._taggedTemplateLiteral(["\n opacity: 0;\n pointer-events: none;\n border-top-right-radius: 3px;\n border-bottom-right-radius: 3px;\n padding-right: 4px;\n padding-left: 30px;\n display: flex;\n align-items: center;\n position: absolute;\n right: 0;\n top: 0;\n bottom: 0;\n color: ", ";\n\n ", "\n\n ", "\n\n > svg {\n width: 12px;\n }\n"])), function (props) {
|
|
34
|
+
return props.theme.getColor('gray-400');
|
|
35
|
+
}, function (props) {
|
|
36
|
+
return props.warning && props.theme.themeProp('color', '#C3AF43', '#C3AF43');
|
|
37
|
+
}, function (props) {
|
|
38
|
+
return props.error && props.theme.themeProp('color', '#CB968F', '#CB968F');
|
|
39
|
+
});
|
|
40
|
+
var TextInputField = styled__default['default'].input.attrs(defaultTheme.applyDefaultTheme)(_templateObject9 || (_templateObject9 = defaultTheme._taggedTemplateLiteral(["\n display: block;\n width: 100%;\n font-family: inherit;\n font-size: 0.875rem;\n line-height: 1;\n padding: 13px 10px;\n ", "\n ", "\n border: 1px solid;\n ", ";\n border-radius: 3px;\n box-sizing: border-box;\n appearance: none;\n transition: border-color 350ms;\n height: 2.75rem !important; // important is needed to override the default Foundation styling used in the Mediebank\n margin-bottom: 0; // needed to override the default Foundation styling used in the Mediebank\n\n ", "\n ", "\n ", "\n\n &::placeholder {\n ", "\n\n ", "\n }\n\n ", "\n\n &&:hover:not(:focus) {\n ", ";\n transition: background 350ms;\n & + ", " {\n opacity: 1;\n transition: opacity 350ms;\n }\n }\n\n :focus {\n outline: none;\n border-color: ", " !important\n"])), function (props) {
|
|
33
41
|
return props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'));
|
|
34
42
|
}, function (props) {
|
|
35
43
|
return props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('white'));
|
|
36
44
|
}, function (props) {
|
|
37
|
-
return props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-400'));
|
|
45
|
+
return props.noBorder ? 'border-color: transparent !important' : props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-400'));
|
|
38
46
|
}, function (props) {
|
|
39
|
-
return props.warning && styled.css(
|
|
47
|
+
return props.warning && styled.css(_templateObject10 || (_templateObject10 = defaultTheme._taggedTemplateLiteral(["\n border-color: ", " !important;\n "])), props.theme.getColor('orange-500'));
|
|
40
48
|
}, function (props) {
|
|
41
|
-
return props.error && styled.css(
|
|
49
|
+
return props.error && styled.css(_templateObject11 || (_templateObject11 = defaultTheme._taggedTemplateLiteral(["\n border-color: ", " !important;\n "])), props.theme.getColor('red-500'));
|
|
42
50
|
}, function (props) {
|
|
43
|
-
return props.hasIcon && styled.css(
|
|
51
|
+
return props.hasIcon && styled.css(_templateObject12 || (_templateObject12 = defaultTheme._taggedTemplateLiteral(["\n padding-left: 35px;\n "])));
|
|
44
52
|
}, function (props) {
|
|
45
53
|
return props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'), 1);
|
|
46
54
|
}, function (props) {
|
|
47
55
|
return props.theme.themeProp('opacity', 0.6, 0.5, 1);
|
|
48
56
|
}, function (props) {
|
|
49
|
-
return props.
|
|
57
|
+
return props.warning && styled.css(_templateObject13 || (_templateObject13 = defaultTheme._taggedTemplateLiteral(["\n color: ", " !important;\n "])), props.theme.getColor('orange-500'));
|
|
58
|
+
}, function (props) {
|
|
59
|
+
return props.noBorder ? props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('gray-200')) : 'background: transparent';
|
|
60
|
+
}, InputIconContainer, function (props) {
|
|
61
|
+
return props.theme.getColor('gray-600');
|
|
50
62
|
});
|
|
51
|
-
var TextInputLabel = styled__default['default'].label.attrs(defaultTheme.applyDefaultTheme)(
|
|
63
|
+
var TextInputLabel = styled__default['default'].label.attrs(defaultTheme.applyDefaultTheme)(_templateObject14 || (_templateObject14 = defaultTheme._taggedTemplateLiteral(["\n position: absolute;\n z-index: 1;\n top: 15px;\n left: 11px;\n line-height: 1.2;\n font-size: 0.875rem;\n transition: all 150ms;\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n content: \"\";\n\n ", "\n"])), function (props) {
|
|
52
64
|
return props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'));
|
|
53
65
|
}, function (props) {
|
|
54
66
|
return props.theme.themeProp('opacity', 0.6, 0.5);
|
|
55
67
|
}, function (props) {
|
|
56
68
|
return props.theme.themeProp('background', "linear-gradient(0deg, ".concat(props.theme.getColor('gray-900'), " calc(50% + 1px), transparent 50%)"), "linear-gradient(0deg, ".concat(props.theme.getColor('white'), " calc(50% + 1px), transparent 50%)"));
|
|
57
69
|
}, function (props) {
|
|
58
|
-
return (props.hasPlaceholder || props.hasAdornments) && styled.css(
|
|
70
|
+
return (props.hasPlaceholder || props.hasAdornments) && styled.css(_templateObject15 || (_templateObject15 = defaultTheme._taggedTemplateLiteral(["\n ", ";\n ", "\n "])), activeLabel, props.error && styled.css(_templateObject16 || (_templateObject16 = defaultTheme._taggedTemplateLiteral(["\n color: ", " !important;\n "])), props.theme.getColor('red-500')));
|
|
59
71
|
}, function (props) {
|
|
60
|
-
return props.hasIcon && styled.css(
|
|
72
|
+
return props.hasIcon && styled.css(_templateObject17 || (_templateObject17 = defaultTheme._taggedTemplateLiteral(["\n left: 35px;\n "])));
|
|
61
73
|
});
|
|
62
|
-
var TextInputFieldIcon = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(
|
|
63
|
-
var TextInput$1 = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(
|
|
74
|
+
var TextInputFieldIcon = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject18 || (_templateObject18 = defaultTheme._taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n height: 2.625rem;\n display: flex;\n padding: 0 10px;\n\n svg {\n width: 15px;\n opacity: 0.6;\n transition: opacity 250ms;\n }\n"])));
|
|
75
|
+
var TextInput$1 = styled__default['default'].div.attrs(defaultTheme.applyDefaultTheme)(_templateObject19 || (_templateObject19 = defaultTheme._taggedTemplateLiteral(["\n position: relative;\n\n &:focus-within {\n ", " {\n ", ";\n }\n\n ", " {\n svg {\n opacity: 1;\n }\n }\n }\n\n ", ":not(:placeholder-shown) + ", " {\n ", ";\n ", "\n // ", "\n ", "\n }\n\n ", "\n"])), TextInputLabel, activeLabel, TextInputFieldIcon, TextInputField, TextInputLabel, activeLabel, function (props) {
|
|
64
76
|
return props.error && props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500'));
|
|
65
77
|
}, function (props) {
|
|
66
|
-
return props.error && styled.css(
|
|
78
|
+
return props.error && styled.css(_templateObject20 || (_templateObject20 = defaultTheme._taggedTemplateLiteral(["\n // color: ", " !important;\n //\n "])), props.theme.getColor('red-500'));
|
|
67
79
|
}, function (props) {
|
|
68
|
-
return props.warning && styled.css(
|
|
80
|
+
return props.warning && styled.css(_templateObject21 || (_templateObject21 = defaultTheme._taggedTemplateLiteral(["\n color: ", " !important;\n "])), props.theme.getColor('orange-500'));
|
|
69
81
|
}, function (props) {
|
|
70
|
-
return props.disabled && styled.css(
|
|
82
|
+
return props.disabled && styled.css(_templateObject22 || (_templateObject22 = defaultTheme._taggedTemplateLiteral(["\n opacity: 0.5;\n\n > * {\n cursor: not-allowed;\n pointer-events: none !important;\n }\n "])));
|
|
71
83
|
});
|
|
72
|
-
var Description = styled__default['default'].p.attrs(defaultTheme.applyDefaultTheme)(
|
|
84
|
+
var Description = styled__default['default'].p.attrs(defaultTheme.applyDefaultTheme)(_templateObject23 || (_templateObject23 = defaultTheme._taggedTemplateLiteral(["\n margin: 8px 0 0 0;\n padding: 0 0.6875rem;\n font-size: 0.75rem;\n line-height: 1.333;\n\n ", ";\n\n ", "\n"])), function (props) {
|
|
73
85
|
return props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'));
|
|
74
86
|
}, function (props) {
|
|
75
|
-
return props.error && styled.css(
|
|
87
|
+
return props.error && styled.css(_templateObject24 || (_templateObject24 = defaultTheme._taggedTemplateLiteral(["\n content: 'error';\n ", "\n "])), props.theme.themeProp('color', props.theme.getColor('red-200'), props.theme.getColor('red-500')));
|
|
76
88
|
});
|
|
77
89
|
|
|
78
90
|
var toFnRef = function toFnRef(ref) {
|
|
@@ -132,7 +144,8 @@ var TextInput = React__default['default'].forwardRef(function TextInput(_ref, fo
|
|
|
132
144
|
style = _ref.style,
|
|
133
145
|
onChange = _ref.onChange,
|
|
134
146
|
onBlur = _ref.onBlur,
|
|
135
|
-
|
|
147
|
+
noBorder = _ref.noBorder,
|
|
148
|
+
rest = defaultTheme._objectWithoutProperties(_ref, ["value", "defaultValue", "name", "label", "placeholder", "type", "required", "disabled", "readOnly", "autoComplete", "description", "error", "warning", "icon", "adornments", "className", "style", "onChange", "onBlur", "noBorder"]);
|
|
136
149
|
|
|
137
150
|
var textInputDomNode = React.useRef(null);
|
|
138
151
|
var textInputRef = useMergedRefs(forwardedRef, textInputDomNode);
|
|
@@ -200,8 +213,13 @@ var TextInput = React__default['default'].forwardRef(function TextInput(_ref, fo
|
|
|
200
213
|
warning: hasWarning,
|
|
201
214
|
id: "text-input-".concat(uniqueId),
|
|
202
215
|
onChange: onChange,
|
|
203
|
-
onBlur: onBlur
|
|
204
|
-
|
|
216
|
+
onBlur: onBlur,
|
|
217
|
+
noBorder: noBorder
|
|
218
|
+
}, rest)), !readOnly && noBorder && React__default['default'].createElement(InputIconContainer, {
|
|
219
|
+
error: error,
|
|
220
|
+
warning: warning
|
|
221
|
+
}, React__default['default'].createElement(editNote.SvgEditNote, null)), label && React__default['default'].createElement(TextInputLabel, {
|
|
222
|
+
noBorder: noBorder,
|
|
205
223
|
htmlFor: "text-input-".concat(uniqueId),
|
|
206
224
|
hasPlaceholder: Boolean(placeholder),
|
|
207
225
|
hasAdornments: Boolean(typeof (adornments === null || adornments === void 0 ? void 0 : adornments.prefix) === 'string' && adornments.prefix.length > 0 || typeof (adornments === null || adornments === void 0 ? void 0 : adornments.suffix) === 'string' && adornments.suffix.length > 0),
|
|
@@ -219,7 +237,8 @@ var TextInput = React__default['default'].forwardRef(function TextInput(_ref, fo
|
|
|
219
237
|
}, descriptionText));
|
|
220
238
|
});
|
|
221
239
|
TextInput.defaultProps = {
|
|
222
|
-
type: 'text'
|
|
240
|
+
type: 'text',
|
|
241
|
+
noBorder: false
|
|
223
242
|
};
|
|
224
243
|
TextInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
225
244
|
value: defaultTheme.PropTypes.string,
|
|
@@ -243,7 +262,8 @@ TextInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
243
262
|
className: defaultTheme.PropTypes.string,
|
|
244
263
|
style: defaultTheme.PropTypes.object,
|
|
245
264
|
onChange: defaultTheme.PropTypes.func,
|
|
246
|
-
onBlur: defaultTheme.PropTypes.func
|
|
265
|
+
onBlur: defaultTheme.PropTypes.func,
|
|
266
|
+
noBorder: defaultTheme.PropTypes.bool
|
|
247
267
|
} : {};
|
|
248
268
|
|
|
249
269
|
exports.TextInput = TextInput;
|