@startlibs/form 1.0.0-alpha-10a → 1.0.0-alpha-10b
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/index.js +44 -10
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -5108,6 +5108,19 @@ var FlipDiv$1 = function FlipDiv(_ref3) {
|
|
|
5108
5108
|
}));
|
|
5109
5109
|
};
|
|
5110
5110
|
|
|
5111
|
+
function _templateObject$8() {
|
|
5112
|
+
var data = _taggedTemplateLiteral(["\n padding-right: 2.25rem;\n background: rgba(0,0,0,0.075);\n "]);
|
|
5113
|
+
|
|
5114
|
+
_templateObject$8 = function _templateObject() {
|
|
5115
|
+
return data;
|
|
5116
|
+
};
|
|
5117
|
+
|
|
5118
|
+
return data;
|
|
5119
|
+
}
|
|
5120
|
+
var InputIcon$1 = styled__default(components.Icon).withConfig({
|
|
5121
|
+
displayName: "RichText__InputIcon",
|
|
5122
|
+
componentId: "x8c1ig-0"
|
|
5123
|
+
})(["position:absolute;outline:none;bottom:0;font-size:21px;line-height:3rem;right:0;width:2rem;pointer-events:none;color:", ";"], utils.getColor('gray150'));
|
|
5111
5124
|
var FORMAT_TOOLS = {
|
|
5112
5125
|
'bold': ['b', 'strong'],
|
|
5113
5126
|
'italic': 'i',
|
|
@@ -5182,17 +5195,19 @@ var FIX_STYLE = {
|
|
|
5182
5195
|
};
|
|
5183
5196
|
var RichTextContainer = styled__default.div.withConfig({
|
|
5184
5197
|
displayName: "RichText__RichTextContainer",
|
|
5185
|
-
componentId: "x8c1ig-
|
|
5186
|
-
})(["position:relative;width:100%;border:1px solid ", ";border-radius:6px;background:white;", ";", ";", ""], utils.getColor('gray210'), function (props) {
|
|
5198
|
+
componentId: "x8c1ig-1"
|
|
5199
|
+
})(["position:relative;width:100%;border:1px solid ", ";border-radius:6px;background:white;", ";", ";", " ", " ul{list-style-type:disc;}ul,ol{padding-inline-start:25px;margin-block-start:0.5em;margin-block-end:0.5em;}"], utils.getColor('gray210'), function (props) {
|
|
5187
5200
|
return props.hasErrors && "border-color: ".concat(utils.getColor(props)('alert'));
|
|
5188
5201
|
}, function (props) {
|
|
5189
5202
|
return props.showToolbar && "\n ".concat(ToolsContainer, " {\n transition: 0.5s;\n max-height: 7.5rem;\n transition: 0.6s;\n pointer-events: auto;\n }\n ");
|
|
5190
5203
|
}, function (props) {
|
|
5191
5204
|
return props.focus && "\n border-color: ".concat(utils.getColor('gray180'), ";\n box-shadow: 0px 0px 0px 2px rgba(0,0,0,0.1);\n ");
|
|
5205
|
+
}, function (props) {
|
|
5206
|
+
return props.locked && css(_templateObject$8());
|
|
5192
5207
|
});
|
|
5193
5208
|
var RichTextInput = styled__default.div.withConfig({
|
|
5194
5209
|
displayName: "RichText__RichTextInput",
|
|
5195
|
-
componentId: "x8c1ig-
|
|
5210
|
+
componentId: "x8c1ig-2"
|
|
5196
5211
|
})(["width:100%;font-size:14px;outline:0;outline:none;color:", ";background:white;min-height:", "px;outline:0;padding:0.7rem;overflow:auto;border-radius:5px;b,strong{font-weight:600;}&[contenteditable=true]:empty:before{content:attr(placeholder);color:rgba(0,0,0,0.3);}", ""], utils.getColor('gray60'), function (props) {
|
|
5197
5212
|
return props.minHeight || 78;
|
|
5198
5213
|
}, function (props) {
|
|
@@ -5200,15 +5215,15 @@ var RichTextInput = styled__default.div.withConfig({
|
|
|
5200
5215
|
});
|
|
5201
5216
|
var ToolsContainer = styled__default.div.withConfig({
|
|
5202
5217
|
displayName: "RichText__ToolsContainer",
|
|
5203
|
-
componentId: "x8c1ig-
|
|
5218
|
+
componentId: "x8c1ig-3"
|
|
5204
5219
|
})(["background:", ";padding:0 0.125rem;border-top-left-radius:5px;border-top-right-radius:5px;transition:0.225s;max-height:0;pointer-events:none;overflow:hidden;"], utils.getColor('gray240'));
|
|
5205
5220
|
var ToolButton = styled__default(components.Button).withConfig({
|
|
5206
5221
|
displayName: "RichText__ToolButton",
|
|
5207
|
-
componentId: "x8c1ig-
|
|
5222
|
+
componentId: "x8c1ig-4"
|
|
5208
5223
|
})(["min-height:2rem;min-width:2rem;background:transparent;box-shadow:none;margin:0.25rem 0.125rem;& ~ &{margin-left:0.125rem;}.icon{font-size:23px;color:", ";position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);}&:hover,&.activated:hover{background:rgba(0,0,0,0.13);}&.activated{background:rgba(0,0,0,0.1);}&:focus:after{content:none;}"], utils.getColor('gray90'));
|
|
5209
5224
|
var ToolSeparator = styled__default.span.withConfig({
|
|
5210
5225
|
displayName: "RichText__ToolSeparator",
|
|
5211
|
-
componentId: "x8c1ig-
|
|
5226
|
+
componentId: "x8c1ig-5"
|
|
5212
5227
|
})(["border-left:1px solid ", ";margin-left:0.75rem;margin-right:0.5rem;line-height:2rem;vertical-align:-6px;"], utils.getColor('gray180'));
|
|
5213
5228
|
var JS_CLASS = "EDITOR--JS";
|
|
5214
5229
|
|
|
@@ -5413,7 +5428,8 @@ var RichText = function RichText(_ref5) {
|
|
|
5413
5428
|
tabIndex = _ref5$tabIndex === void 0 ? 1 : _ref5$tabIndex,
|
|
5414
5429
|
value = _ref5.value,
|
|
5415
5430
|
setValue = _ref5.setValue,
|
|
5416
|
-
raw = _ref5.raw
|
|
5431
|
+
raw = _ref5.raw,
|
|
5432
|
+
locked = _ref5.locked;
|
|
5417
5433
|
var linkPopup = core.usePopupToggle();
|
|
5418
5434
|
var input = core.useEnsureRef(inputRef);
|
|
5419
5435
|
var activeLinkNode = React.useRef();
|
|
@@ -5503,6 +5519,22 @@ var RichText = function RichText(_ref5) {
|
|
|
5503
5519
|
}
|
|
5504
5520
|
};
|
|
5505
5521
|
|
|
5522
|
+
var keydownHandler = function keydownHandler(e) {
|
|
5523
|
+
if (containerFocused.isOpen === 2) {
|
|
5524
|
+
if (e.key === "k" && e.ctrlKey) {
|
|
5525
|
+
e.preventDefault();
|
|
5526
|
+
execCommand(null, 'link');
|
|
5527
|
+
}
|
|
5528
|
+
}
|
|
5529
|
+
};
|
|
5530
|
+
|
|
5531
|
+
React.useEffect(function () {
|
|
5532
|
+
document.addEventListener('keydown', keydownHandler);
|
|
5533
|
+
return function () {
|
|
5534
|
+
return document.removeEventListener('keydown', keydownHandler);
|
|
5535
|
+
};
|
|
5536
|
+
}, [containerFocused.isOpen]);
|
|
5537
|
+
|
|
5506
5538
|
var execCommand = function execCommand(e, command) {
|
|
5507
5539
|
if (command === 'link') {
|
|
5508
5540
|
var nodeEl;
|
|
@@ -5828,6 +5860,8 @@ var RichText = function RichText(_ref5) {
|
|
|
5828
5860
|
className: JS_CLASS,
|
|
5829
5861
|
minHeight: minHeight,
|
|
5830
5862
|
placeholder: placeholder
|
|
5863
|
+
}), locked && React__default.createElement(InputIcon$1, {
|
|
5864
|
+
icon: "lock"
|
|
5831
5865
|
}), linkPopup.isOpen && React__default.createElement(EditLinkPopup, {
|
|
5832
5866
|
input: input,
|
|
5833
5867
|
activeLinkNode: activeLinkNode,
|
|
@@ -6039,10 +6073,10 @@ var ToggleCheckbox = styled__default(function (_ref) {
|
|
|
6039
6073
|
return props.disabled && "\n opacity: 0.8;\n pointer-events:none;\n ";
|
|
6040
6074
|
});
|
|
6041
6075
|
|
|
6042
|
-
function _templateObject$
|
|
6076
|
+
function _templateObject$9() {
|
|
6043
6077
|
var data = _taggedTemplateLiteral(["\n min-width: 0;\n ", "\n "]);
|
|
6044
6078
|
|
|
6045
|
-
_templateObject$
|
|
6079
|
+
_templateObject$9 = function _templateObject() {
|
|
6046
6080
|
return data;
|
|
6047
6081
|
};
|
|
6048
6082
|
|
|
@@ -6061,7 +6095,7 @@ var TabButton = styled__default(components.Button).withConfig({
|
|
|
6061
6095
|
return props.isFirst !== undefined && !props.isFirst && "\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n :focus:after{\n border-bottom-left-radius: 2px;\n border-top-left-radius: 2px;\n }\n ";
|
|
6062
6096
|
}, function (props) {
|
|
6063
6097
|
return props.isLast !== undefined && !props.isLast && "\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n :focus:after{\n border-bottom-right-radius: 2px;\n border-top-right-radius: 2px;\n z-index: 2;\n }\n ";
|
|
6064
|
-
}, utils.media.mobile(_templateObject$
|
|
6098
|
+
}, utils.media.mobile(_templateObject$9(), function (props) {
|
|
6065
6099
|
return props.icon ? "\n padding-left: 1.25rem;\n padding-right: 1rem;\n " : "\n padding-left: 0.25rem;\n padding-right: 0.25rem;\n ";
|
|
6066
6100
|
}), utils.customTheme('TabButton'));
|
|
6067
6101
|
var InnerButton = styled__default.a.withConfig({
|