superdesk-ui-framework 3.0.54 → 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-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/TabCustom.tsx +9 -2
- package/app-typescript/components/TimePicker.tsx +2 -0
- package/app-typescript/components/TreeSelect/TreeSelect.tsx +120 -107
- package/dist/examples.bundle.js +88 -78
- package/dist/superdesk-ui.bundle.css +183 -199
- package/dist/superdesk-ui.bundle.js +87 -77
- 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/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
@@ -39791,6 +39791,10 @@ var DatePicker = /** @class */ (function (_super) {
|
|
39791
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 },
|
39792
39792
|
React.createElement(calendar_1.Calendar, { inputId: this.htmlId, ariaLabelledBy: this.htmlId + 'label', ref: function (ref) {
|
39793
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
|
+
}
|
39794
39798
|
}, value: this.state.value === null ? undefined : this.state.value, onChange: function (event) {
|
39795
39799
|
var result = parseFromPrimeReactCalendarFormat(event.value);
|
39796
39800
|
if (result !== 'failed-to-parse') {
|
@@ -63757,7 +63761,7 @@ var TimePicker = /** @class */ (function (_super) {
|
|
63757
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 },
|
63758
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) {
|
63759
63763
|
_this.props.onChange(event.target.value);
|
63760
|
-
} })));
|
63764
|
+
}, "data-test-id": this.props['data-test-id'] })));
|
63761
63765
|
};
|
63762
63766
|
return TimePicker;
|
63763
63767
|
}(React.PureComponent));
|
@@ -64120,6 +64124,7 @@ var Label_1 = __webpack_require__(36);
|
|
64120
64124
|
var SelectPreview_1 = __webpack_require__(75);
|
64121
64125
|
var TreeSelectPill_1 = __webpack_require__(513);
|
64122
64126
|
var TreeSelectItem_1 = __webpack_require__(514);
|
64127
|
+
var react_dom_1 = __webpack_require__(8);
|
64123
64128
|
var TreeSelect = /** @class */ (function (_super) {
|
64124
64129
|
__extends(TreeSelect, _super);
|
64125
64130
|
function TreeSelect(props) {
|
@@ -64138,8 +64143,9 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
64138
64143
|
(_a = _this.categoryButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
64139
64144
|
};
|
64140
64145
|
_this.onMouseDown = function (event) {
|
64141
|
-
var _a;
|
64142
|
-
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)
|
64143
64149
|
&& _this.state.openDropdown) {
|
64144
64150
|
_this.setState({ openDropdown: false });
|
64145
64151
|
}
|
@@ -64542,6 +64548,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
64542
64548
|
};
|
64543
64549
|
TreeSelect.prototype.render = function () {
|
64544
64550
|
var _this = this;
|
64551
|
+
var _a;
|
64545
64552
|
if (this.props.preview) {
|
64546
64553
|
return (React.createElement(SelectPreview_1.SelectPreview, { kind: this.props.allowMultiple
|
64547
64554
|
? {
|
@@ -64554,67 +64561,70 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
64554
64561
|
}, items: this.state.value, valueTemplate: this.props.valueTemplate, getLabel: this.props.getLabel }));
|
64555
64562
|
}
|
64556
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 },
|
64557
|
-
React.createElement("div", { className: "tags-input sd-input__input tags-input--".concat(this.props.allowMultiple ? 'multi-select' : 'single-select'), ref: this.treeSelectRef },
|
64558
|
-
|
64559
|
-
|
64560
|
-
this.props.
|
64561
|
-
|
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) {
|
64562
64587
|
e.stopPropagation();
|
64563
|
-
|
64564
|
-
_this.setState({ openDropdown: !_this.state.openDropdown });
|
64565
|
-
}
|
64588
|
+
_this.setState({ value: [] });
|
64566
64589
|
} },
|
64567
|
-
React.createElement(
|
64568
|
-
|
64569
|
-
|
64570
|
-
|
64571
|
-
|
64572
|
-
|
64573
|
-
|
64574
|
-
|
64575
|
-
|
64576
|
-
|
64577
|
-
|
64578
|
-
|
64579
|
-
|
64580
|
-
|
64581
|
-
|
64582
|
-
|
64583
|
-
|
64584
|
-
React.createElement(
|
64585
|
-
|
64586
|
-
|
64587
|
-
|
64588
|
-
|
64589
|
-
_this.
|
64590
|
-
|
64591
|
-
|
64592
|
-
|
64593
|
-
|
64594
|
-
|
64595
|
-
|
64596
|
-
|
64597
|
-
|
64598
|
-
|
64599
|
-
|
64600
|
-
|
64601
|
-
|
64602
|
-
|
64603
|
-
|
64604
|
-
|
64605
|
-
React.createElement("span", { className: backgroundColor && "tags-input__tag-item", style: { backgroundColor: backgroundColor, margin: 0 } }, children),
|
64606
|
-
_this.props.readOnly
|
64607
|
-
|| React.createElement("span", { className: "tags-input__remove-button" },
|
64608
|
-
React.createElement(Icon_1.Icon, { name: 'remove-sign' })))));
|
64609
|
-
};
|
64610
|
-
return React.createElement(React.Fragment, { key: i }, _this.props.valueTemplate
|
64611
|
-
? _this.props.valueTemplate(item, Wrapper)
|
64612
|
-
: (React.createElement(Wrapper, null,
|
64613
|
-
React.createElement("span", null, _this.props.getLabel(item)))));
|
64614
|
-
})),
|
64615
|
-
this.state.openDropdown
|
64616
|
-
&& React.createElement("div", { className: "autocomplete autocomplete--multi-select"
|
64617
|
-
+ (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 },
|
64618
64628
|
React.createElement("div", { className: 'autocomplete__header' },
|
64619
64629
|
React.createElement("div", { className: "autocomplete__icon", onClick: function () {
|
64620
64630
|
_this.backButton();
|
@@ -64638,7 +64648,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
64638
64648
|
else {
|
64639
64649
|
return;
|
64640
64650
|
}
|
64641
|
-
} }))),
|
64651
|
+
}, "data-test-id": "filter-input" }))),
|
64642
64652
|
(this.state.activeTree.length > 0 && this.state.buttonValue != null)
|
64643
64653
|
&& React.createElement("div", { className: 'autocomplete__category-header' },
|
64644
64654
|
React.createElement("div", { className: "autocomplete__icon", onClick: function () {
|
@@ -64656,7 +64666,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
64656
64666
|
React.createElement(Loader_1.Loader, { overlay: true }))
|
64657
64667
|
: this.state.searchFieldValue === ''
|
64658
64668
|
? this.props.getOptions
|
64659
|
-
? 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) {
|
64660
64670
|
var selectedItem = _this.state.value.some(function (obj) {
|
64661
64671
|
return _this.props.getId(obj) === _this.props.getId(option.value);
|
64662
64672
|
});
|
@@ -64669,7 +64679,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
64669
64679
|
: null
|
64670
64680
|
: React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select", ref: this.ref }, this.filteredItem(this.props.singleLevelSearch
|
64671
64681
|
? this.state.options
|
64672
|
-
: this.state.filterArr))))));
|
64682
|
+
: this.state.filterArr)))), document.body)));
|
64673
64683
|
};
|
64674
64684
|
return TreeSelect;
|
64675
64685
|
}(React.Component));
|
@@ -65988,7 +65998,7 @@ var Input = /** @class */ (function (_super) {
|
|
65988
65998
|
React.createElement("span", null, this.props.value)));
|
65989
65999
|
}
|
65990
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 },
|
65991
|
-
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'] })));
|
65992
66002
|
};
|
65993
66003
|
return Input;
|
65994
66004
|
}(React.Component));
|
@@ -77714,7 +77724,7 @@ var RadioButtonGroup = /** @class */ (function (_super) {
|
|
77714
77724
|
_a));
|
77715
77725
|
return (React.createElement(React.Fragment, null,
|
77716
77726
|
!((_j = this.props.group) === null || _j === void 0 ? void 0 : _j.groupLabel) ?
|
77717
|
-
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 },
|
77718
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 }),
|
77719
77729
|
React.createElement("label", { className: "sd-check-button__text-label", htmlFor: _this.htmlId + index, "aria-label": item.labelHidden ? item.label : undefined },
|
77720
77730
|
item.icon ? React.createElement("i", { className: "icon-".concat(item.icon), "aria-hidden": "true" }) : null,
|
@@ -77722,7 +77732,7 @@ var RadioButtonGroup = /** @class */ (function (_super) {
|
|
77722
77732
|
React.createElement("span", { className: "sd-check-button__text-label-inner" }, item.label) : null))); }))
|
77723
77733
|
: null,
|
77724
77734
|
((_l = this.props.group) === null || _l === void 0 ? void 0 : _l.groupLabel) ?
|
77725
|
-
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'] },
|
77726
77736
|
React.createElement(FormLabel_1.FormLabel, { forId: this.htmlId + 'group', text: this.props.group.groupLabel }),
|
77727
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 },
|
77728
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 }),
|
@@ -79642,10 +79652,10 @@ var TabLabel = function (_a) {
|
|
79642
79652
|
return (React.createElement("span", null, label));
|
79643
79653
|
};
|
79644
79654
|
exports.TabLabel = TabLabel;
|
79645
|
-
var Tabs = function (
|
79646
|
-
var
|
79647
|
-
var initiallySelectedIndex =
|
79648
|
-
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];
|
79649
79659
|
function handleSelected(i) {
|
79650
79660
|
setIndex(i);
|
79651
79661
|
handleClick(i);
|
@@ -79653,11 +79663,11 @@ var Tabs = function (_a) {
|
|
79653
79663
|
var handleClick = function (i) {
|
79654
79664
|
onClick(i);
|
79655
79665
|
};
|
79656
|
-
var classes = (0, classnames_1.default)('sd-nav-tabs', (
|
79657
|
-
|
79658
|
-
|
79659
|
-
|
79660
|
-
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)); })));
|
79661
79671
|
};
|
79662
79672
|
exports.Tabs = Tabs;
|
79663
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 }),
|
@@ -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';
|