@startlibs/form 1.0.0-alpha-9y → 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 +70 -21
- package/package.json +2 -2
- package/src/index.js +0 -24
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
|
|
|
@@ -5410,7 +5425,11 @@ var RichText = function RichText(_ref5) {
|
|
|
5410
5425
|
helpText = _ref5.helpText,
|
|
5411
5426
|
linkColor = _ref5.linkColor,
|
|
5412
5427
|
_ref5$tabIndex = _ref5.tabIndex,
|
|
5413
|
-
tabIndex = _ref5$tabIndex === void 0 ? 1 : _ref5$tabIndex
|
|
5428
|
+
tabIndex = _ref5$tabIndex === void 0 ? 1 : _ref5$tabIndex,
|
|
5429
|
+
value = _ref5.value,
|
|
5430
|
+
setValue = _ref5.setValue,
|
|
5431
|
+
raw = _ref5.raw,
|
|
5432
|
+
locked = _ref5.locked;
|
|
5414
5433
|
var linkPopup = core.usePopupToggle();
|
|
5415
5434
|
var input = core.useEnsureRef(inputRef);
|
|
5416
5435
|
var activeLinkNode = React.useRef();
|
|
@@ -5422,21 +5441,34 @@ var RichText = function RichText(_ref5) {
|
|
|
5422
5441
|
var commands = core.useRefState([]);
|
|
5423
5442
|
var containerFocused = core.useToggle();
|
|
5424
5443
|
var needsNormalize = core.useRefState();
|
|
5425
|
-
var alreadyCancelled = core.useRefState();
|
|
5444
|
+
var alreadyCancelled = core.useRefState(); // const [formValue, setFormValue] = useInput({path})
|
|
5426
5445
|
|
|
5427
5446
|
var _useInput = useInput({
|
|
5428
|
-
path: path
|
|
5429
|
-
|
|
5430
|
-
|
|
5447
|
+
path: path,
|
|
5448
|
+
value: value,
|
|
5449
|
+
setValue: setValue
|
|
5450
|
+
}, raw),
|
|
5451
|
+
_useInput2 = _slicedToArray(_useInput, 3),
|
|
5431
5452
|
formValue = _useInput2[0],
|
|
5432
|
-
setFormValue = _useInput2[1]
|
|
5453
|
+
setFormValue = _useInput2[1],
|
|
5454
|
+
hasErrors = _useInput2[2].hasErrors; // const tempValue = useConstant(formValue)
|
|
5433
5455
|
|
|
5434
|
-
var tempValue = core.useConstant(formValue);
|
|
5435
5456
|
|
|
5436
|
-
var _useState = React.useState(
|
|
5457
|
+
var _useState = React.useState(formValue),
|
|
5437
5458
|
_useState2 = _slicedToArray(_useState, 2),
|
|
5438
|
-
|
|
5439
|
-
|
|
5459
|
+
tempValue = _useState2[0],
|
|
5460
|
+
setTempValue = _useState2[1];
|
|
5461
|
+
|
|
5462
|
+
React.useEffect(function () {
|
|
5463
|
+
if (value === formValue && formValue !== tempValue) {
|
|
5464
|
+
setTempValue(formValue);
|
|
5465
|
+
}
|
|
5466
|
+
}, [path]);
|
|
5467
|
+
|
|
5468
|
+
var _useState3 = React.useState({}),
|
|
5469
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
5470
|
+
activatedTools = _useState4[0],
|
|
5471
|
+
setActivatedTools = _useState4[1];
|
|
5440
5472
|
|
|
5441
5473
|
var validElements = core.useLazyConstant(function () {
|
|
5442
5474
|
return ['br', 'div', 'p', 'span'].concat(_flatten(formatTools.map(function (tool) {
|
|
@@ -5472,8 +5504,7 @@ var RichText = function RichText(_ref5) {
|
|
|
5472
5504
|
};
|
|
5473
5505
|
|
|
5474
5506
|
var containerBlur = function containerBlur(e) {
|
|
5475
|
-
console.log(e.target,
|
|
5476
|
-
|
|
5507
|
+
// console.log(e.target,e.currentTarget)
|
|
5477
5508
|
if (containerFocused.isOpen !== 1) {
|
|
5478
5509
|
containerFocused.close();
|
|
5479
5510
|
triggerScrollForPanel(Date.now());
|
|
@@ -5488,6 +5519,22 @@ var RichText = function RichText(_ref5) {
|
|
|
5488
5519
|
}
|
|
5489
5520
|
};
|
|
5490
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
|
+
|
|
5491
5538
|
var execCommand = function execCommand(e, command) {
|
|
5492
5539
|
if (command === 'link') {
|
|
5493
5540
|
var nodeEl;
|
|
@@ -5813,6 +5860,8 @@ var RichText = function RichText(_ref5) {
|
|
|
5813
5860
|
className: JS_CLASS,
|
|
5814
5861
|
minHeight: minHeight,
|
|
5815
5862
|
placeholder: placeholder
|
|
5863
|
+
}), locked && React__default.createElement(InputIcon$1, {
|
|
5864
|
+
icon: "lock"
|
|
5816
5865
|
}), linkPopup.isOpen && React__default.createElement(EditLinkPopup, {
|
|
5817
5866
|
input: input,
|
|
5818
5867
|
activeLinkNode: activeLinkNode,
|
|
@@ -6024,10 +6073,10 @@ var ToggleCheckbox = styled__default(function (_ref) {
|
|
|
6024
6073
|
return props.disabled && "\n opacity: 0.8;\n pointer-events:none;\n ";
|
|
6025
6074
|
});
|
|
6026
6075
|
|
|
6027
|
-
function _templateObject$
|
|
6076
|
+
function _templateObject$9() {
|
|
6028
6077
|
var data = _taggedTemplateLiteral(["\n min-width: 0;\n ", "\n "]);
|
|
6029
6078
|
|
|
6030
|
-
_templateObject$
|
|
6079
|
+
_templateObject$9 = function _templateObject() {
|
|
6031
6080
|
return data;
|
|
6032
6081
|
};
|
|
6033
6082
|
|
|
@@ -6046,7 +6095,7 @@ var TabButton = styled__default(components.Button).withConfig({
|
|
|
6046
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 ";
|
|
6047
6096
|
}, function (props) {
|
|
6048
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 ";
|
|
6049
|
-
}, utils.media.mobile(_templateObject$
|
|
6098
|
+
}, utils.media.mobile(_templateObject$9(), function (props) {
|
|
6050
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 ";
|
|
6051
6100
|
}), utils.customTheme('TabButton'));
|
|
6052
6101
|
var InnerButton = styled__default.a.withConfig({
|
package/package.json
CHANGED
package/src/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export * from './Form'
|
|
2
|
-
export * from './enhanceInput'
|
|
3
|
-
export * from './Field'
|
|
4
|
-
export * from './useConfirmDialog'
|
|
5
|
-
export * from './TextInput'
|
|
6
|
-
export * from './Errors'
|
|
7
|
-
export * from './withFormImageInput'
|
|
8
|
-
export * from './Checkbox'
|
|
9
|
-
export * from './Combobox'
|
|
10
|
-
export * from './ComboboxWithCustom'
|
|
11
|
-
export * from './AutoComplete'
|
|
12
|
-
export * from './EditableBox'
|
|
13
|
-
export * from './FormValue'
|
|
14
|
-
export * from './Radiobox'
|
|
15
|
-
export * from './InputboxGroup'
|
|
16
|
-
export * from './DatePicker'
|
|
17
|
-
export * from './ExpandableBox'
|
|
18
|
-
export * from './RichText'
|
|
19
|
-
export * from './alt/radiobox/IconRadioBox'
|
|
20
|
-
export * from './alt/checkbox/SimpleCheckbox'
|
|
21
|
-
export * from './alt/checkbox/ToggleCheckbox'
|
|
22
|
-
export * from './alt/radiobox/TabRadiobox'
|
|
23
|
-
export * from './alt/radiobox/SimpleRadiobox'
|
|
24
|
-
export {validation} from './validation'
|