superdesk-ui-framework 3.0.53 → 3.0.55
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/app/styles/_sd-tag-input.scss +213 -215
- package/app/styles/primereact/_pr-general.scss +2 -2
- package/app-typescript/components/DatePicker.tsx +8 -0
- package/app-typescript/components/Input.tsx +2 -0
- package/app-typescript/components/RadioButtonGroup.tsx +8 -2
- package/app-typescript/components/SelectWithTemplate.tsx +12 -2
- package/app-typescript/components/TabCustom.tsx +9 -2
- package/app-typescript/components/TimePicker.tsx +2 -0
- package/app-typescript/components/TreeSelect/TreeSelect.tsx +120 -107
- package/app-typescript/components/avatar/avatar-image.tsx +17 -5
- package/dist/examples.bundle.js +114 -84
- package/dist/superdesk-ui.bundle.css +186 -202
- package/dist/superdesk-ui.bundle.js +113 -83
- package/package.json +1 -1
- package/react/components/DatePicker.d.ts +1 -0
- package/react/components/DatePicker.js +4 -0
- package/react/components/Input.d.ts +1 -0
- package/react/components/Input.js +1 -1
- package/react/components/RadioButtonGroup.d.ts +1 -0
- package/react/components/RadioButtonGroup.js +2 -2
- package/react/components/SelectWithTemplate.d.ts +3 -0
- package/react/components/SelectWithTemplate.js +7 -1
- package/react/components/TabCustom.d.ts +2 -1
- package/react/components/TabCustom.js +9 -9
- package/react/components/TimePicker.d.ts +1 -0
- package/react/components/TimePicker.js +1 -1
- package/react/components/TreeSelect/TreeSelect.d.ts +1 -0
- package/react/components/TreeSelect/TreeSelect.js +70 -64
- package/react/components/avatar/avatar-image.js +19 -5
@@ -38819,6 +38819,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
38819
38819
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38820
38820
|
};
|
38821
38821
|
})();
|
38822
|
+
var __assign = (this && this.__assign) || function () {
|
38823
|
+
__assign = Object.assign || function(t) {
|
38824
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
38825
|
+
s = arguments[i];
|
38826
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
38827
|
+
t[p] = s[p];
|
38828
|
+
}
|
38829
|
+
return t;
|
38830
|
+
};
|
38831
|
+
return __assign.apply(this, arguments);
|
38832
|
+
};
|
38822
38833
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
38823
38834
|
if (k2 === undefined) k2 = k;
|
38824
38835
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
@@ -38852,15 +38863,18 @@ var AvatarContentImage = /** @class */ (function (_super) {
|
|
38852
38863
|
}
|
38853
38864
|
AvatarContentImage.prototype.render = function () {
|
38854
38865
|
var _a = this.props, imageUrl = _a.imageUrl, tooltipText = _a.tooltipText, onClick = _a.onClick;
|
38855
|
-
var
|
38866
|
+
var maybeButtonProps = onClick == null ? {} : {
|
38867
|
+
role: 'button',
|
38868
|
+
onClick: function () { return onClick(); },
|
38869
|
+
};
|
38856
38870
|
if (imageUrl == null) {
|
38857
|
-
return (React.createElement("span", { className: "sd-avatar-content sd-avatar-content--dummy-img", title: tooltipText
|
38871
|
+
return (React.createElement("span", __assign({}, maybeButtonProps, { className: "sd-avatar-content sd-avatar-content--dummy-img", title: tooltipText }),
|
38858
38872
|
React.createElement("svg", { width: "200", height: "200", viewBox: "0 0 200 200", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
38859
|
-
React.createElement("circle", { cx: "100", cy: "100", r: "100", fill: "white",
|
38860
|
-
React.createElement("path", {
|
38873
|
+
React.createElement("circle", { cx: "100", cy: "100", r: "100", fill: "white", fillOpacity: "0.01" }),
|
38874
|
+
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M40 153V145.384C40 141.557 41.16 137.981 43.16 135C49.14 126.057 66.24 119.711 77.14 118C82.74 117.115 90.16 116.538 100 116.538C109.84 116.538 117.26 117.115 122.86 118C133.76 119.711 150.86 126.057 156.84 135C158.84 137.981 160 141.557 160 145.384V153C150 165 130 180 100 180C70 180 50 165 40 153ZM100 30C122.08 30 140 47.2307 140 68.4614C140 89.6922 122.08 106.923 100 106.923C77.92 106.923 60 89.6922 60 68.4614C60 47.2307 77.92 30 100 30Z", fill: "var(--sd-colour-avatar-dummy)", fillOpacity: "1" }))));
|
38861
38875
|
}
|
38862
38876
|
else {
|
38863
|
-
return (React.createElement("span", { className: "sd-avatar-content", title: tooltipText
|
38877
|
+
return (React.createElement("span", __assign({}, maybeButtonProps, { className: "sd-avatar-content", title: tooltipText }),
|
38864
38878
|
React.createElement("img", { src: imageUrl })));
|
38865
38879
|
}
|
38866
38880
|
};
|
@@ -39777,6 +39791,10 @@ var DatePicker = /** @class */ (function (_super) {
|
|
39777
39791
|
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, invalid: this.props.error != null, required: this.props.required, disabled: this.props.disabled, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
39778
39792
|
React.createElement(calendar_1.Calendar, { inputId: this.htmlId, ariaLabelledBy: this.htmlId + 'label', ref: function (ref) {
|
39779
39793
|
_this.instance = ref;
|
39794
|
+
var refAny = ref;
|
39795
|
+
if (_this.props['data-test-id'] != null && (refAny === null || refAny === void 0 ? void 0 : refAny.inputElement) != null) {
|
39796
|
+
refAny.inputElement.setAttribute('data-test-id', _this.props['data-test-id']);
|
39797
|
+
}
|
39780
39798
|
}, value: this.state.value === null ? undefined : this.state.value, onChange: function (event) {
|
39781
39799
|
var result = parseFromPrimeReactCalendarFormat(event.value);
|
39782
39800
|
if (result !== 'failed-to-parse') {
|
@@ -63743,7 +63761,7 @@ var TimePicker = /** @class */ (function (_super) {
|
|
63743
63761
|
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, invalid: this.props.error != null, required: this.props.required, disabled: this.props.disabled, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
63744
63762
|
React.createElement("input", { value: this.props.value, type: "time", className: "sd-input__input", id: this.htmlId, "aria-labelledby": this.htmlId + 'label', step: this.props.allowSeconds ? 1 : undefined, required: this.props.required, disabled: this.props.disabled, onChange: function (event) {
|
63745
63763
|
_this.props.onChange(event.target.value);
|
63746
|
-
} })));
|
63764
|
+
}, "data-test-id": this.props['data-test-id'] })));
|
63747
63765
|
};
|
63748
63766
|
return TimePicker;
|
63749
63767
|
}(React.PureComponent));
|
@@ -64106,6 +64124,7 @@ var Label_1 = __webpack_require__(36);
|
|
64106
64124
|
var SelectPreview_1 = __webpack_require__(75);
|
64107
64125
|
var TreeSelectPill_1 = __webpack_require__(513);
|
64108
64126
|
var TreeSelectItem_1 = __webpack_require__(514);
|
64127
|
+
var react_dom_1 = __webpack_require__(8);
|
64109
64128
|
var TreeSelect = /** @class */ (function (_super) {
|
64110
64129
|
__extends(TreeSelect, _super);
|
64111
64130
|
function TreeSelect(props) {
|
@@ -64124,8 +64143,9 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
64124
64143
|
(_a = _this.categoryButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
64125
64144
|
};
|
64126
64145
|
_this.onMouseDown = function (event) {
|
64127
|
-
var _a;
|
64128
|
-
if ((((_a = _this.
|
64146
|
+
var _a, _b;
|
64147
|
+
if ((((_a = _this.dropdownRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) !== true)
|
64148
|
+
&& (((_b = _this.treeSelectRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target)) !== true)
|
64129
64149
|
&& _this.state.openDropdown) {
|
64130
64150
|
_this.setState({ openDropdown: false });
|
64131
64151
|
}
|
@@ -64528,6 +64548,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
64528
64548
|
};
|
64529
64549
|
TreeSelect.prototype.render = function () {
|
64530
64550
|
var _this = this;
|
64551
|
+
var _a;
|
64531
64552
|
if (this.props.preview) {
|
64532
64553
|
return (React.createElement(SelectPreview_1.SelectPreview, { kind: this.props.allowMultiple
|
64533
64554
|
? {
|
@@ -64540,67 +64561,70 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
64540
64561
|
}, items: this.state.value, valueTemplate: this.props.valueTemplate, getLabel: this.props.getLabel }));
|
64541
64562
|
}
|
64542
64563
|
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, invalid: this.props.error != null, required: this.props.required, disabled: this.props.disabled, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
64543
|
-
React.createElement("div", { className: "tags-input sd-input__input tags-input--".concat(this.props.allowMultiple ? 'multi-select' : 'single-select'), ref: this.treeSelectRef },
|
64544
|
-
|
64545
|
-
|
64546
|
-
this.props.
|
64547
|
-
|
64564
|
+
React.createElement("div", { className: "tags-input sd-input__input tags-input--".concat(this.props.allowMultiple ? 'multi-select' : 'single-select'), ref: this.treeSelectRef }, this.props.allowMultiple
|
64565
|
+
? React.createElement("div", { className: "tags-input__tags" },
|
64566
|
+
this.props.readOnly
|
64567
|
+
|| React.createElement("button", { ref: this.openDropdownRef, className: "tags-input__add-button ".concat(this.props.disabled ? 'tags-input__add-button--disabled' : ''), onClick: function (e) {
|
64568
|
+
e.stopPropagation();
|
64569
|
+
if (!_this.props.disabled) {
|
64570
|
+
_this.setState({ openDropdown: !_this.state.openDropdown });
|
64571
|
+
}
|
64572
|
+
} },
|
64573
|
+
React.createElement("i", { className: "icon-plus-large" })),
|
64574
|
+
React.createElement("ul", { className: "tags-input__tag-list" }, this.state.value.map(function (item, i) {
|
64575
|
+
var Wrapper = function (_a) {
|
64576
|
+
var backgroundColor = _a.backgroundColor, children = _a.children;
|
64577
|
+
return (React.createElement(TreeSelectPill_1.TreeSelectPill, { item: item, readOnly: _this.props.readOnly, disabled: _this.props.disabled, valueTemplate: _this.props.valueTemplate, backgroundColor: backgroundColor, onRemove: function () { return _this.removeClick(i); }, getBackgroundColor: _this.props.getBackgroundColor }, children));
|
64578
|
+
};
|
64579
|
+
return (React.createElement(React.Fragment, { key: i }, _this.props.valueTemplate
|
64580
|
+
? _this.props.valueTemplate(item, Wrapper)
|
64581
|
+
: (React.createElement(Wrapper, null,
|
64582
|
+
React.createElement("span", null, _this.props.getLabel(item))))));
|
64583
|
+
})),
|
64584
|
+
this.state.value.length > 0
|
64585
|
+
? (this.props.readOnly || this.props.disabled)
|
64586
|
+
|| React.createElement("button", { className: "tags-input__remove-value", style: { position: 'relative', bottom: '2px' }, onClick: function (e) {
|
64548
64587
|
e.stopPropagation();
|
64549
|
-
|
64550
|
-
_this.setState({ openDropdown: !_this.state.openDropdown });
|
64551
|
-
}
|
64588
|
+
_this.setState({ value: [] });
|
64552
64589
|
} },
|
64553
|
-
React.createElement(
|
64554
|
-
|
64555
|
-
|
64556
|
-
|
64557
|
-
|
64558
|
-
|
64559
|
-
|
64560
|
-
|
64561
|
-
|
64562
|
-
|
64563
|
-
|
64564
|
-
|
64565
|
-
|
64566
|
-
|
64567
|
-
|
64568
|
-
|
64569
|
-
|
64570
|
-
React.createElement(
|
64571
|
-
|
64572
|
-
|
64573
|
-
|
64574
|
-
|
64575
|
-
_this.
|
64576
|
-
|
64577
|
-
|
64578
|
-
|
64579
|
-
|
64580
|
-
|
64581
|
-
|
64582
|
-
|
64583
|
-
|
64584
|
-
|
64585
|
-
|
64586
|
-
|
64587
|
-
|
64588
|
-
|
64589
|
-
|
64590
|
-
|
64591
|
-
React.createElement("span", { className: backgroundColor && "tags-input__tag-item", style: { backgroundColor: backgroundColor, margin: 0 } }, children),
|
64592
|
-
_this.props.readOnly
|
64593
|
-
|| React.createElement("span", { className: "tags-input__remove-button" },
|
64594
|
-
React.createElement(Icon_1.Icon, { name: 'remove-sign' })))));
|
64595
|
-
};
|
64596
|
-
return React.createElement(React.Fragment, { key: i }, _this.props.valueTemplate
|
64597
|
-
? _this.props.valueTemplate(item, Wrapper)
|
64598
|
-
: (React.createElement(Wrapper, null,
|
64599
|
-
React.createElement("span", null, _this.props.getLabel(item)))));
|
64600
|
-
})),
|
64601
|
-
this.state.openDropdown
|
64602
|
-
&& React.createElement("div", { className: "autocomplete autocomplete--multi-select"
|
64603
|
-
+ (this.props.width === 'medium' ? ' autocomplete--fixed-width' : ''), style: { zIndex: this.props.zIndex }, ref: this.dropdownRef },
|
64590
|
+
React.createElement(Icon_1.Icon, { name: 'remove-sign' }))
|
64591
|
+
: null)
|
64592
|
+
: React.createElement("div", { className: "tags-input__tags" },
|
64593
|
+
this.props.readOnly
|
64594
|
+
|| React.createElement("button", { className: "tags-input__overlay-button", ref: this.openDropdownRef, onClick: function () {
|
64595
|
+
_this.setState({ openDropdown: !_this.state.openDropdown });
|
64596
|
+
}, "data-test-id": this.state.openDropdown ? undefined : this.props['data-test-id'] }),
|
64597
|
+
this.state.value.length < 1
|
64598
|
+
&& React.createElement("span", { className: 'tags-input__single-item'
|
64599
|
+
+ (this.props.readOnly ? ' tags-input__tag-item--readonly' : '') },
|
64600
|
+
React.createElement("span", { className: "tags-input__placeholder" }, this.props.placeholder)),
|
64601
|
+
this.state.value.map(function (item, i) {
|
64602
|
+
var Wrapper = function (_a) {
|
64603
|
+
var backgroundColor = _a.backgroundColor, borderColor = _a.borderColor, children = _a.children;
|
64604
|
+
return (React.createElement("span", { className: 'tags-input__single-item'
|
64605
|
+
+ (_this.props.readOnly ? ' tags-input__tag-item--readonly' : ''), onClick: function () { return !_this.props.readOnly && _this.removeClick(i); } },
|
64606
|
+
_this.props.getBorderColor
|
64607
|
+
&& React.createElement("div", { className: "item-border item-border-selected", style: borderColor
|
64608
|
+
? { backgroundColor: borderColor }
|
64609
|
+
: { backgroundColor: _this.props.getBorderColor(item) } }),
|
64610
|
+
React.createElement("span", { className: "tags-input__helper-box", style: { color: backgroundColor && (0, Label_1.getTextColor)(backgroundColor) } },
|
64611
|
+
React.createElement("span", { className: backgroundColor && "tags-input__tag-item", style: { backgroundColor: backgroundColor, margin: 0 } }, children),
|
64612
|
+
_this.props.readOnly
|
64613
|
+
|| React.createElement("span", { className: "tags-input__remove-button" },
|
64614
|
+
React.createElement(Icon_1.Icon, { name: 'remove-sign' })))));
|
64615
|
+
};
|
64616
|
+
return React.createElement(React.Fragment, { key: i }, _this.props.valueTemplate
|
64617
|
+
? _this.props.valueTemplate(item, Wrapper)
|
64618
|
+
: (React.createElement(Wrapper, null,
|
64619
|
+
React.createElement("span", null, _this.props.getLabel(item)))));
|
64620
|
+
}))),
|
64621
|
+
(0, react_dom_1.createPortal)(this.state.openDropdown
|
64622
|
+
&& React.createElement("div", { id: 'TREESELECT_DROPDOWN', "data-test-id": this.props['data-test-id'] },
|
64623
|
+
React.createElement("div", { className: "autocomplete autocomplete--multi-select"
|
64624
|
+
+ (this.props.width === 'medium' ? ' autocomplete--fixed-width' : ''), style: {
|
64625
|
+
zIndex: this.props.zIndex,
|
64626
|
+
width: (_a = this.treeSelectRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth,
|
64627
|
+
}, ref: this.dropdownRef },
|
64604
64628
|
React.createElement("div", { className: 'autocomplete__header' },
|
64605
64629
|
React.createElement("div", { className: "autocomplete__icon", onClick: function () {
|
64606
64630
|
_this.backButton();
|
@@ -64624,7 +64648,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
64624
64648
|
else {
|
64625
64649
|
return;
|
64626
64650
|
}
|
64627
|
-
} }))),
|
64651
|
+
}, "data-test-id": "filter-input" }))),
|
64628
64652
|
(this.state.activeTree.length > 0 && this.state.buttonValue != null)
|
64629
64653
|
&& React.createElement("div", { className: 'autocomplete__category-header' },
|
64630
64654
|
React.createElement("div", { className: "autocomplete__icon", onClick: function () {
|
@@ -64642,7 +64666,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
64642
64666
|
React.createElement(Loader_1.Loader, { overlay: true }))
|
64643
64667
|
: this.state.searchFieldValue === ''
|
64644
64668
|
? this.props.getOptions
|
64645
|
-
? React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select", ref: this.ref }, this.state.options.map(function (option, i) {
|
64669
|
+
? React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select", ref: this.ref, "data-test-id": "options" }, this.state.options.map(function (option, i) {
|
64646
64670
|
var selectedItem = _this.state.value.some(function (obj) {
|
64647
64671
|
return _this.props.getId(obj) === _this.props.getId(option.value);
|
64648
64672
|
});
|
@@ -64655,7 +64679,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
64655
64679
|
: null
|
64656
64680
|
: React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select", ref: this.ref }, this.filteredItem(this.props.singleLevelSearch
|
64657
64681
|
? this.state.options
|
64658
|
-
: this.state.filterArr))))));
|
64682
|
+
: this.state.filterArr)))), document.body)));
|
64659
64683
|
};
|
64660
64684
|
return TreeSelect;
|
64661
64685
|
}(React.Component));
|
@@ -65974,7 +65998,7 @@ var Input = /** @class */ (function (_super) {
|
|
65974
65998
|
React.createElement("span", null, this.props.value)));
|
65975
65999
|
}
|
65976
66000
|
return (React.createElement(InputWrapper_1.InputWrapper, { label: this.props.label, required: this.props.required, disabled: this.props.disabled, value: this.props.value, error: this.props.error, invalid: this.props.error != null, info: this.props.info, maxLength: this.props.maxLength, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, size: (_a = this.props.size) !== null && _a !== void 0 ? _a : 'medium', fullWidth: this.props.fullWidth, htmlId: this.htmlId, boxedStyle: this.props.boxedStyle, boxedLable: this.props.boxedLable, tabindex: this.props.tabindex },
|
65977
|
-
React.createElement("input", { className: 'sd-input__input', type: (_b = this.props.type) !== null && _b !== void 0 ? _b : 'text', id: this.htmlId, value: this.props.value, "aria-describedby": this.htmlId + 'label', tabIndex: this.props.tabindex, onChange: this.handleChange, placeholder: this.props.placeholder, disabled: this.props.disabled })));
|
66001
|
+
React.createElement("input", { className: 'sd-input__input', type: (_b = this.props.type) !== null && _b !== void 0 ? _b : 'text', id: this.htmlId, value: this.props.value, "aria-describedby": this.htmlId + 'label', tabIndex: this.props.tabindex, onChange: this.handleChange, placeholder: this.props.placeholder, disabled: this.props.disabled, "data-test-id": this.props['data-test-id'] })));
|
65978
66002
|
};
|
65979
66003
|
return Input;
|
65980
66004
|
}(React.Component));
|
@@ -66689,6 +66713,7 @@ var SelectWithTemplate = /** @class */ (function (_super) {
|
|
66689
66713
|
var _this = this;
|
66690
66714
|
var _a;
|
66691
66715
|
var ItemTemplate = this.props.itemTemplate;
|
66716
|
+
var ValueTemplate = this.props.valueTemplate;
|
66692
66717
|
var _b = this.state, loading = _b.loading, options = _b.options;
|
66693
66718
|
var _c = this.props, value = _c.value, onChange = _c.onChange, getLabel = _c.getLabel, disabled = _c.disabled, required = _c.required, zIndex = _c.zIndex, autoFocus = _c.autoFocus, areEqual = _c.areEqual, getItems = _c.getItems, emptyFilterMessage = _c.noResultsFoundMessage, filterPlaceholder = _c.filterPlaceholder, width = _c.width;
|
66694
66719
|
// Using another data structure so it is possible to have getLabel function
|
@@ -66712,7 +66737,12 @@ var SelectWithTemplate = /** @class */ (function (_super) {
|
|
66712
66737
|
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, invalid: this.state.invalid, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
66713
66738
|
React.createElement(dropdown_1.Dropdown, { inputId: this.htmlId, ariaLabelledBy: this.htmlId + 'label', value: valueInternal, options: optionsInternal, onChange: function (e) {
|
66714
66739
|
onChange(e.value == null ? null : e.value.original);
|
66715
|
-
}, placeholder: fakePlaceholderWithNonBreakingSpace, filterPlaceholder: filterPlaceholder, filter: true, filterBy: labelKey, showClear: !required, emptyFilterMessage: emptyFilterMessage,
|
66740
|
+
}, placeholder: fakePlaceholderWithNonBreakingSpace, filterPlaceholder: filterPlaceholder, filter: true, filterBy: labelKey, showClear: !required, emptyFilterMessage: emptyFilterMessage, itemTemplate: function (option) { var _a; return React.createElement(ItemTemplate, { option: (_a = option === null || option === void 0 ? void 0 : option.original) !== null && _a !== void 0 ? _a : null }); }, valueTemplate: function (option) {
|
66741
|
+
var _a, _b;
|
66742
|
+
return ValueTemplate != null
|
66743
|
+
? (React.createElement(ValueTemplate, { option: (_a = option === null || option === void 0 ? void 0 : option.original) !== null && _a !== void 0 ? _a : null }))
|
66744
|
+
: (React.createElement(ItemTemplate, { option: (_b = option === null || option === void 0 ? void 0 : option.original) !== null && _b !== void 0 ? _b : null }));
|
66745
|
+
}, disabled: disabled, required: required, autoFocus: autoFocus, appendTo: document.body, loading: loading, onFilterInputChange: function (searchString) {
|
66716
66746
|
_this.setState({ loading: true });
|
66717
66747
|
getItems(searchString).then(function (_options) {
|
66718
66748
|
_this.setState({ options: _options, loading: false });
|
@@ -77694,7 +77724,7 @@ var RadioButtonGroup = /** @class */ (function (_super) {
|
|
77694
77724
|
_a));
|
77695
77725
|
return (React.createElement(React.Fragment, null,
|
77696
77726
|
!((_j = this.props.group) === null || _j === void 0 ? void 0 : _j.groupLabel) ?
|
77697
|
-
React.createElement("div", { role: "radiogroup", className: classes, "aria-labelledby": (_k = this.props.group) === null || _k === void 0 ? void 0 : _k.groupLabelledBy }, this.props.options.map(function (item, index) { return (React.createElement("span", { className: "sd-check-button sd-check-button--native", key: index, tabIndex: _this.props.tabindex === undefined ? undefined : -1 },
|
77727
|
+
React.createElement("div", { role: "radiogroup", className: classes, "aria-labelledby": (_k = this.props.group) === null || _k === void 0 ? void 0 : _k.groupLabelledBy, "data-test-id": this.props['data-test-id'] }, this.props.options.map(function (item, index) { return (React.createElement("span", { className: "sd-check-button sd-check-button--native", key: index, tabIndex: _this.props.tabindex === undefined ? undefined : -1 },
|
77698
77728
|
React.createElement("input", { type: "radio", className: "sd-check-button__input", id: _this.htmlId + index, tabIndex: _this.props.tabindex, name: _this.htmlId, onChange: function () { return _this.handleChange(item); }, disabled: item.disabled, required: _this.props.required, checked: item.value === _this.props.value }),
|
77699
77729
|
React.createElement("label", { className: "sd-check-button__text-label", htmlFor: _this.htmlId + index, "aria-label": item.labelHidden ? item.label : undefined },
|
77700
77730
|
item.icon ? React.createElement("i", { className: "icon-".concat(item.icon), "aria-hidden": "true" }) : null,
|
@@ -77702,7 +77732,7 @@ var RadioButtonGroup = /** @class */ (function (_super) {
|
|
77702
77732
|
React.createElement("span", { className: "sd-check-button__text-label-inner" }, item.label) : null))); }))
|
77703
77733
|
: null,
|
77704
77734
|
((_l = this.props.group) === null || _l === void 0 ? void 0 : _l.groupLabel) ?
|
77705
|
-
React.createElement("div", { className: 'sd-check-button__group-wrapper' },
|
77735
|
+
React.createElement("div", { className: 'sd-check-button__group-wrapper', "data-test-id": this.props['data-test-id'] },
|
77706
77736
|
React.createElement(FormLabel_1.FormLabel, { forId: this.htmlId + 'group', text: this.props.group.groupLabel }),
|
77707
77737
|
React.createElement("div", { role: "radiogroup", id: this.htmlId + 'group', className: classes }, this.props.options.map(function (item, index) { return (React.createElement("span", { className: "sd-check-button sd-check-button--native", key: index, tabIndex: -1 },
|
77708
77738
|
React.createElement("input", { type: "radio", className: "sd-check-button__input", id: _this.htmlId + index, tabIndex: 0, name: _this.htmlId, onChange: function () { return _this.handleChange(item); }, disabled: item.disabled, required: _this.props.required, checked: item.value === _this.props.value }),
|
@@ -79622,10 +79652,10 @@ var TabLabel = function (_a) {
|
|
79622
79652
|
return (React.createElement("span", null, label));
|
79623
79653
|
};
|
79624
79654
|
exports.TabLabel = TabLabel;
|
79625
|
-
var Tabs = function (
|
79626
|
-
var
|
79627
|
-
var initiallySelectedIndex =
|
79628
|
-
var
|
79655
|
+
var Tabs = function (props) {
|
79656
|
+
var _a;
|
79657
|
+
var initiallySelectedIndex = props.initiallySelectedIndex, size = props.size, theme = props.theme, ariaLabel = props.ariaLabel, children = props.children, onClick = props.onClick;
|
79658
|
+
var _b = React.useState(initiallySelectedIndex !== null && initiallySelectedIndex !== void 0 ? initiallySelectedIndex : 0), index = _b[0], setIndex = _b[1];
|
79629
79659
|
function handleSelected(i) {
|
79630
79660
|
setIndex(i);
|
79631
79661
|
handleClick(i);
|
@@ -79633,11 +79663,11 @@ var Tabs = function (_a) {
|
|
79633
79663
|
var handleClick = function (i) {
|
79634
79664
|
onClick(i);
|
79635
79665
|
};
|
79636
|
-
var classes = (0, classnames_1.default)('sd-nav-tabs', (
|
79637
|
-
|
79638
|
-
|
79639
|
-
|
79640
|
-
return (React.createElement("div", { className: classes, role: 'tablist', "aria-label": ariaLabel ? ariaLabel : 'tabs' }, children.map(function (item, i) { return (React.createElement("button", { key: i, "aria-controls": 'tabpanel-' + i, className: 'sd-nav-tabs__tab' + (index === i ? ' sd-nav-tabs__tab--active' : ''), onClick: function () { return handleSelected(i); }, role: 'tab', "aria-selected": index === i ? 'true' : 'false' }, item)); })));
|
79666
|
+
var classes = (0, classnames_1.default)('sd-nav-tabs', (_a = {},
|
79667
|
+
_a["sd-nav-tabs--".concat(size)] = size && size !== undefined,
|
79668
|
+
_a['sd-nav-tabs--ui-dark'] = theme === 'dark',
|
79669
|
+
_a));
|
79670
|
+
return (React.createElement("div", { className: classes, role: 'tablist', "aria-label": ariaLabel ? ariaLabel : 'tabs', "data-test-id": props['data-test-id'] }, children.map(function (item, i) { return (React.createElement("button", { key: i, "aria-controls": 'tabpanel-' + i, className: 'sd-nav-tabs__tab' + (index === i ? ' sd-nav-tabs__tab--active' : ''), onClick: function () { return handleSelected(i); }, role: 'tab', "aria-selected": index === i ? 'true' : 'false' }, item)); })));
|
79641
79671
|
};
|
79642
79672
|
exports.Tabs = Tabs;
|
79643
79673
|
var TabContent = function (_a) {
|
package/package.json
CHANGED
@@ -139,6 +139,10 @@ var DatePicker = /** @class */ (function (_super) {
|
|
139
139
|
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, invalid: this.props.error != null, required: this.props.required, disabled: this.props.disabled, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
140
140
|
React.createElement(calendar_1.Calendar, { inputId: this.htmlId, ariaLabelledBy: this.htmlId + 'label', ref: function (ref) {
|
141
141
|
_this.instance = ref;
|
142
|
+
var refAny = ref;
|
143
|
+
if (_this.props['data-test-id'] != null && (refAny === null || refAny === void 0 ? void 0 : refAny.inputElement) != null) {
|
144
|
+
refAny.inputElement.setAttribute('data-test-id', _this.props['data-test-id']);
|
145
|
+
}
|
142
146
|
}, value: this.state.value === null ? undefined : this.state.value, onChange: function (event) {
|
143
147
|
var result = parseFromPrimeReactCalendarFormat(event.value);
|
144
148
|
if (result !== 'failed-to-parse') {
|
@@ -68,7 +68,7 @@ var Input = /** @class */ (function (_super) {
|
|
68
68
|
React.createElement("span", null, this.props.value)));
|
69
69
|
}
|
70
70
|
return (React.createElement(InputWrapper_1.InputWrapper, { label: this.props.label, required: this.props.required, disabled: this.props.disabled, value: this.props.value, error: this.props.error, invalid: this.props.error != null, info: this.props.info, maxLength: this.props.maxLength, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, size: (_a = this.props.size) !== null && _a !== void 0 ? _a : 'medium', fullWidth: this.props.fullWidth, htmlId: this.htmlId, boxedStyle: this.props.boxedStyle, boxedLable: this.props.boxedLable, tabindex: this.props.tabindex },
|
71
|
-
React.createElement("input", { className: 'sd-input__input', type: (_b = this.props.type) !== null && _b !== void 0 ? _b : 'text', id: this.htmlId, value: this.props.value, "aria-describedby": this.htmlId + 'label', tabIndex: this.props.tabindex, onChange: this.handleChange, placeholder: this.props.placeholder, disabled: this.props.disabled })));
|
71
|
+
React.createElement("input", { className: 'sd-input__input', type: (_b = this.props.type) !== null && _b !== void 0 ? _b : 'text', id: this.htmlId, value: this.props.value, "aria-describedby": this.htmlId + 'label', tabIndex: this.props.tabindex, onChange: this.handleChange, placeholder: this.props.placeholder, disabled: this.props.disabled, "data-test-id": this.props['data-test-id'] })));
|
72
72
|
};
|
73
73
|
return Input;
|
74
74
|
}(React.Component));
|
@@ -72,7 +72,7 @@ var RadioButtonGroup = /** @class */ (function (_super) {
|
|
72
72
|
_a));
|
73
73
|
return (React.createElement(React.Fragment, null,
|
74
74
|
!((_j = this.props.group) === null || _j === void 0 ? void 0 : _j.groupLabel) ?
|
75
|
-
React.createElement("div", { role: "radiogroup", className: classes, "aria-labelledby": (_k = this.props.group) === null || _k === void 0 ? void 0 : _k.groupLabelledBy }, this.props.options.map(function (item, index) { return (React.createElement("span", { className: "sd-check-button sd-check-button--native", key: index, tabIndex: _this.props.tabindex === undefined ? undefined : -1 },
|
75
|
+
React.createElement("div", { role: "radiogroup", className: classes, "aria-labelledby": (_k = this.props.group) === null || _k === void 0 ? void 0 : _k.groupLabelledBy, "data-test-id": this.props['data-test-id'] }, this.props.options.map(function (item, index) { return (React.createElement("span", { className: "sd-check-button sd-check-button--native", key: index, tabIndex: _this.props.tabindex === undefined ? undefined : -1 },
|
76
76
|
React.createElement("input", { type: "radio", className: "sd-check-button__input", id: _this.htmlId + index, tabIndex: _this.props.tabindex, name: _this.htmlId, onChange: function () { return _this.handleChange(item); }, disabled: item.disabled, required: _this.props.required, checked: item.value === _this.props.value }),
|
77
77
|
React.createElement("label", { className: "sd-check-button__text-label", htmlFor: _this.htmlId + index, "aria-label": item.labelHidden ? item.label : undefined },
|
78
78
|
item.icon ? React.createElement("i", { className: "icon-".concat(item.icon), "aria-hidden": "true" }) : null,
|
@@ -80,7 +80,7 @@ var RadioButtonGroup = /** @class */ (function (_super) {
|
|
80
80
|
React.createElement("span", { className: "sd-check-button__text-label-inner" }, item.label) : null))); }))
|
81
81
|
: null,
|
82
82
|
((_l = this.props.group) === null || _l === void 0 ? void 0 : _l.groupLabel) ?
|
83
|
-
React.createElement("div", { className: 'sd-check-button__group-wrapper' },
|
83
|
+
React.createElement("div", { className: 'sd-check-button__group-wrapper', "data-test-id": this.props['data-test-id'] },
|
84
84
|
React.createElement(FormLabel_1.FormLabel, { forId: this.htmlId + 'group', text: this.props.group.groupLabel }),
|
85
85
|
React.createElement("div", { role: "radiogroup", id: this.htmlId + 'group', className: classes }, this.props.options.map(function (item, index) { return (React.createElement("span", { className: "sd-check-button sd-check-button--native", key: index, tabIndex: -1 },
|
86
86
|
React.createElement("input", { type: "radio", className: "sd-check-button__input", id: _this.htmlId + index, tabIndex: 0, name: _this.htmlId, onChange: function () { return _this.handleChange(item); }, disabled: item.disabled, required: _this.props.required, checked: item.value === _this.props.value }),
|
@@ -10,6 +10,9 @@ interface IProps<T> extends IInputWrapper {
|
|
10
10
|
itemTemplate: React.ComponentType<{
|
11
11
|
option: T | null;
|
12
12
|
}>;
|
13
|
+
valueTemplate?: React.ComponentType<{
|
14
|
+
option: T | null;
|
15
|
+
}>;
|
13
16
|
noResultsFoundMessage: string;
|
14
17
|
filterPlaceholder?: string;
|
15
18
|
autoFocus?: boolean;
|
@@ -75,6 +75,7 @@ var SelectWithTemplate = /** @class */ (function (_super) {
|
|
75
75
|
var _this = this;
|
76
76
|
var _a;
|
77
77
|
var ItemTemplate = this.props.itemTemplate;
|
78
|
+
var ValueTemplate = this.props.valueTemplate;
|
78
79
|
var _b = this.state, loading = _b.loading, options = _b.options;
|
79
80
|
var _c = this.props, value = _c.value, onChange = _c.onChange, getLabel = _c.getLabel, disabled = _c.disabled, required = _c.required, zIndex = _c.zIndex, autoFocus = _c.autoFocus, areEqual = _c.areEqual, getItems = _c.getItems, emptyFilterMessage = _c.noResultsFoundMessage, filterPlaceholder = _c.filterPlaceholder, width = _c.width;
|
80
81
|
// Using another data structure so it is possible to have getLabel function
|
@@ -98,7 +99,12 @@ var SelectWithTemplate = /** @class */ (function (_super) {
|
|
98
99
|
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, invalid: this.state.invalid, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
99
100
|
React.createElement(dropdown_1.Dropdown, { inputId: this.htmlId, ariaLabelledBy: this.htmlId + 'label', value: valueInternal, options: optionsInternal, onChange: function (e) {
|
100
101
|
onChange(e.value == null ? null : e.value.original);
|
101
|
-
}, placeholder: fakePlaceholderWithNonBreakingSpace, filterPlaceholder: filterPlaceholder, filter: true, filterBy: labelKey, showClear: !required, emptyFilterMessage: emptyFilterMessage,
|
102
|
+
}, placeholder: fakePlaceholderWithNonBreakingSpace, filterPlaceholder: filterPlaceholder, filter: true, filterBy: labelKey, showClear: !required, emptyFilterMessage: emptyFilterMessage, itemTemplate: function (option) { var _a; return React.createElement(ItemTemplate, { option: (_a = option === null || option === void 0 ? void 0 : option.original) !== null && _a !== void 0 ? _a : null }); }, valueTemplate: function (option) {
|
103
|
+
var _a, _b;
|
104
|
+
return ValueTemplate != null
|
105
|
+
? (React.createElement(ValueTemplate, { option: (_a = option === null || option === void 0 ? void 0 : option.original) !== null && _a !== void 0 ? _a : null }))
|
106
|
+
: (React.createElement(ItemTemplate, { option: (_b = option === null || option === void 0 ? void 0 : option.original) !== null && _b !== void 0 ? _b : null }));
|
107
|
+
}, disabled: disabled, required: required, autoFocus: autoFocus, appendTo: document.body, loading: loading, onFilterInputChange: function (searchString) {
|
102
108
|
_this.setState({ loading: true });
|
103
109
|
getItems(searchString).then(function (_options) {
|
104
110
|
_this.setState({ options: _options, loading: false });
|
@@ -5,6 +5,7 @@ interface ITabs {
|
|
5
5
|
children: Array<any>;
|
6
6
|
onClick(i: number): void;
|
7
7
|
initiallySelectedIndex?: number;
|
8
|
+
'data-test-id'?: string;
|
8
9
|
}
|
9
10
|
interface ITabLabel {
|
10
11
|
label: string;
|
@@ -20,7 +21,7 @@ interface ITabPanel {
|
|
20
21
|
children: any;
|
21
22
|
}
|
22
23
|
export declare const TabLabel: ({ label }: ITabLabel) => JSX.Element;
|
23
|
-
export declare const Tabs: (
|
24
|
+
export declare const Tabs: (props: ITabs) => JSX.Element;
|
24
25
|
export declare const TabContent: ({ theme, children, activePanel }: ITabContent) => JSX.Element;
|
25
26
|
export declare const TabPanel: ({ children, indexValue }: ITabPanel) => JSX.Element;
|
26
27
|
export {};
|
@@ -34,10 +34,10 @@ var TabLabel = function (_a) {
|
|
34
34
|
return (React.createElement("span", null, label));
|
35
35
|
};
|
36
36
|
exports.TabLabel = TabLabel;
|
37
|
-
var Tabs = function (
|
38
|
-
var
|
39
|
-
var initiallySelectedIndex =
|
40
|
-
var
|
37
|
+
var Tabs = function (props) {
|
38
|
+
var _a;
|
39
|
+
var initiallySelectedIndex = props.initiallySelectedIndex, size = props.size, theme = props.theme, ariaLabel = props.ariaLabel, children = props.children, onClick = props.onClick;
|
40
|
+
var _b = React.useState(initiallySelectedIndex !== null && initiallySelectedIndex !== void 0 ? initiallySelectedIndex : 0), index = _b[0], setIndex = _b[1];
|
41
41
|
function handleSelected(i) {
|
42
42
|
setIndex(i);
|
43
43
|
handleClick(i);
|
@@ -45,11 +45,11 @@ var Tabs = function (_a) {
|
|
45
45
|
var handleClick = function (i) {
|
46
46
|
onClick(i);
|
47
47
|
};
|
48
|
-
var classes = (0, classnames_1.default)('sd-nav-tabs', (
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
return (React.createElement("div", { className: classes, role: 'tablist', "aria-label": ariaLabel ? ariaLabel : 'tabs' }, children.map(function (item, i) { return (React.createElement("button", { key: i, "aria-controls": 'tabpanel-' + i, className: 'sd-nav-tabs__tab' + (index === i ? ' sd-nav-tabs__tab--active' : ''), onClick: function () { return handleSelected(i); }, role: 'tab', "aria-selected": index === i ? 'true' : 'false' }, item)); })));
|
48
|
+
var classes = (0, classnames_1.default)('sd-nav-tabs', (_a = {},
|
49
|
+
_a["sd-nav-tabs--".concat(size)] = size && size !== undefined,
|
50
|
+
_a['sd-nav-tabs--ui-dark'] = theme === 'dark',
|
51
|
+
_a));
|
52
|
+
return (React.createElement("div", { className: classes, role: 'tablist', "aria-label": ariaLabel ? ariaLabel : 'tabs', "data-test-id": props['data-test-id'] }, children.map(function (item, i) { return (React.createElement("button", { key: i, "aria-controls": 'tabpanel-' + i, className: 'sd-nav-tabs__tab' + (index === i ? ' sd-nav-tabs__tab--active' : ''), onClick: function () { return handleSelected(i); }, role: 'tab', "aria-selected": index === i ? 'true' : 'false' }, item)); })));
|
53
53
|
};
|
54
54
|
exports.Tabs = Tabs;
|
55
55
|
var TabContent = function (_a) {
|
@@ -61,7 +61,7 @@ var TimePicker = /** @class */ (function (_super) {
|
|
61
61
|
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, invalid: this.props.error != null, required: this.props.required, disabled: this.props.disabled, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
62
62
|
React.createElement("input", { value: this.props.value, type: "time", className: "sd-input__input", id: this.htmlId, "aria-labelledby": this.htmlId + 'label', step: this.props.allowSeconds ? 1 : undefined, required: this.props.required, disabled: this.props.disabled, onChange: function (event) {
|
63
63
|
_this.props.onChange(event.target.value);
|
64
|
-
} })));
|
64
|
+
}, "data-test-id": this.props['data-test-id'] })));
|
65
65
|
};
|
66
66
|
return TimePicker;
|
67
67
|
}(React.PureComponent));
|
@@ -32,6 +32,7 @@ interface IPropsBase<T> extends IInputWrapper {
|
|
32
32
|
optionTemplate?(item: T): React.ComponentType<T> | JSX.Element;
|
33
33
|
valueTemplate?(item: T, Wrapper: React.ElementType): React.ComponentType<T> | JSX.Element;
|
34
34
|
onChange(e: Array<T>): void;
|
35
|
+
'data-test-id'?: string;
|
35
36
|
}
|
36
37
|
interface IPropsSync<T> extends IPropsBase<T> {
|
37
38
|
kind: 'synchronous';
|